edockit 0.3.0 → 0.4.0-dev.1

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +81 -198
  3. package/TRUSTED-LIST.md +308 -0
  4. package/dist/certificate-3c9dcdac.js +549 -0
  5. package/dist/certificate-3c9dcdac.js.map +1 -0
  6. package/dist/certificate-c7123a37.js +581 -0
  7. package/dist/certificate-c7123a37.js.map +1 -0
  8. package/dist/core/canonicalization/XMLCanonicalizer.d.ts +9 -3
  9. package/dist/core/trustedlist/build.d.ts +41 -0
  10. package/dist/core/trustedlist/bundled-provider.d.ts +2 -0
  11. package/dist/core/trustedlist/contract.d.ts +19 -0
  12. package/dist/core/trustedlist/dom.d.ts +12 -0
  13. package/dist/core/trustedlist/extract.d.ts +6 -0
  14. package/dist/core/trustedlist/http.d.ts +8 -0
  15. package/dist/core/trustedlist/identity.d.ts +7 -0
  16. package/dist/core/trustedlist/index.d.ts +18 -0
  17. package/dist/core/trustedlist/loader.d.ts +5 -0
  18. package/dist/core/trustedlist/matcher.d.ts +11 -0
  19. package/dist/core/trustedlist/normalize.d.ts +14 -0
  20. package/dist/core/trustedlist/reference-provider.d.ts +12 -0
  21. package/dist/core/trustedlist/types.d.ts +114 -0
  22. package/dist/core/unzip.d.ts +0 -0
  23. package/dist/core/verification.d.ts +22 -0
  24. package/dist/data/trusted-list.d.ts +3 -0
  25. package/dist/identity-c9e5052e.js +410 -0
  26. package/dist/identity-c9e5052e.js.map +1 -0
  27. package/dist/identity-fca881b1.js +406 -0
  28. package/dist/identity-fca881b1.js.map +1 -0
  29. package/dist/index.cjs.js +540 -8838
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.d.ts +4 -2
  32. package/dist/index.esm.js +498 -8795
  33. package/dist/index.esm.js.map +1 -1
  34. package/dist/index.umd.js +23 -17
  35. package/dist/index.umd.js.map +1 -1
  36. package/dist/loader-7a0f771f.js +222 -0
  37. package/dist/loader-7a0f771f.js.map +1 -0
  38. package/dist/loader-ad1a5051.js +217 -0
  39. package/dist/loader-ad1a5051.js.map +1 -0
  40. package/dist/normalize-50862581.js +456 -0
  41. package/dist/normalize-50862581.js.map +1 -0
  42. package/dist/normalize-9626be7c.js +479 -0
  43. package/dist/normalize-9626be7c.js.map +1 -0
  44. package/dist/reference-provider-3838ebfb.js +217 -0
  45. package/dist/reference-provider-3838ebfb.js.map +1 -0
  46. package/dist/reference-provider-9bbbaab8.js +211 -0
  47. package/dist/reference-provider-9bbbaab8.js.map +1 -0
  48. package/dist/trusted-list-build.cjs.js +580 -0
  49. package/dist/trusted-list-build.cjs.js.map +1 -0
  50. package/dist/trusted-list-build.d.ts +4 -0
  51. package/dist/trusted-list-build.esm.js +569 -0
  52. package/dist/trusted-list-build.esm.js.map +1 -0
  53. package/dist/trusted-list-bundled.cjs.js +30439 -0
  54. package/dist/trusted-list-bundled.cjs.js.map +1 -0
  55. package/dist/trusted-list-bundled.d.ts +1 -0
  56. package/dist/trusted-list-bundled.esm.js +30435 -0
  57. package/dist/trusted-list-bundled.esm.js.map +1 -0
  58. package/dist/trusted-list-http.cjs.js +85 -0
  59. package/dist/trusted-list-http.cjs.js.map +1 -0
  60. package/dist/trusted-list-http.d.ts +1 -0
  61. package/dist/trusted-list-http.esm.js +81 -0
  62. package/dist/trusted-list-http.esm.js.map +1 -0
  63. package/dist/trusted-list.cjs.js +38 -0
  64. package/dist/trusted-list.cjs.js.map +1 -0
  65. package/dist/trusted-list.d.ts +9 -0
  66. package/dist/trusted-list.esm.js +13 -0
  67. package/dist/trusted-list.esm.js.map +1 -0
  68. package/package.json +32 -2
package/dist/index.umd.js CHANGED
@@ -1,14 +1,20 @@
1
- var Sl=Object.defineProperty,Bl=Object.defineProperties;var kl=Object.getOwnPropertyDescriptors;var ri=Object.getOwnPropertySymbols;var sa=Object.prototype.hasOwnProperty,aa=Object.prototype.propertyIsEnumerable;var oa=(E,$,D)=>$ in E?Sl(E,$,{enumerable:!0,configurable:!0,writable:!0,value:D}):E[$]=D,j=(E,$)=>{for(var D in $||($={}))sa.call($,D)&&oa(E,D,$[D]);if(ri)for(var D of ri($))aa.call($,D)&&oa(E,D,$[D]);return E},P=(E,$)=>Bl(E,kl($));var H=(E,$)=>{var D={};for(var se in E)sa.call(E,se)&&$.indexOf(se)<0&&(D[se]=E[se]);if(E!=null&&ri)for(var se of ri(E))$.indexOf(se)<0&&aa.call(E,se)&&(D[se]=E[se]);return D};/*!
1
+ var Hf=Object.defineProperty,qf=Object.defineProperties;var jf=Object.getOwnPropertyDescriptors;var Pi=Object.getOwnPropertySymbols;var sl=Object.prototype.hasOwnProperty,ul=Object.prototype.propertyIsEnumerable;var ol=(Ne,ze,ke)=>ze in Ne?Hf(Ne,ze,{enumerable:!0,configurable:!0,writable:!0,value:ke}):Ne[ze]=ke,Fe=(Ne,ze)=>{for(var ke in ze||(ze={}))sl.call(ze,ke)&&ol(Ne,ke,ze[ke]);if(Pi)for(var ke of Pi(ze))ul.call(ze,ke)&&ol(Ne,ke,ze[ke]);return Ne},Qe=(Ne,ze)=>qf(Ne,jf(ze));var We=(Ne,ze)=>{var ke={};for(var Ot in Ne)sl.call(Ne,Ot)&&ze.indexOf(Ot)<0&&(ke[Ot]=Ne[Ot]);if(Ne!=null&&Pi)for(var Ot of Pi(Ne))ze.indexOf(Ot)<0&&ul.call(Ne,Ot)&&(ke[Ot]=Ne[Ot]);return ke};/*!
2
2
  * MIT License
3
3
  * Copyright (c) 2025 Edgars Jēkabsons, ZenomyTech SIA
4
- */(function(E,$){typeof exports=="object"&&typeof module!="undefined"?$(exports,require("fflate"),require("@peculiar/x509")):typeof define=="function"&&define.amd?define(["exports","fflate","@peculiar/x509"],$):(E=typeof globalThis!="undefined"?globalThis:E||self,$(E.edockit={},E.fflate,E.peculiarX509))})(this,function(E,$,D){"use strict";function se(r,e){const t=[],i=e.split(",").map(s=>s.trim()),n=[];for(const s of i){const c=s.split(/\\:|:/).filter(Boolean);c.length===1?n.push({name:c[0]}):c.length===2&&n.push({ns:c[0],name:c[1]})}function o(s){if(s){if(s.nodeType===1){const c=s,l=c.nodeName,f=c.localName;for(const h of n){if(h.ns&&l===`${h.ns}:${h.name}`){t.push(c);break}if(f===h.name||l===h.name){t.push(c);break}if(l.endsWith(`:${h.name}`)){t.push(c);break}}}if(s.childNodes)for(let c=0;c<s.childNodes.length;c++)o(s.childNodes[c])}}return o(r),t}const Kn={ds:"http://www.w3.org/2000/09/xmldsig#",dsig11:"http://www.w3.org/2009/xmldsig11#",dsig2:"http://www.w3.org/2010/xmldsig2#",ec:"http://www.w3.org/2001/10/xml-exc-c14n#",dsig_more:"http://www.w3.org/2001/04/xmldsig-more#",xenc:"http://www.w3.org/2001/04/xmlenc#",xenc11:"http://www.w3.org/2009/xmlenc11#",xades:"http://uri.etsi.org/01903/v1.3.2#",xades141:"http://uri.etsi.org/01903/v1.4.1#",asic:"http://uri.etsi.org/02918/v1.2.1#"};function Jn(){if(typeof window!="undefined"&&window.DOMParser)return new window.DOMParser;try{const{DOMParser:r}=require("@xmldom/xmldom");return new r}catch(r){throw new Error("XML DOM parser not available. In Node.js environments, please install @xmldom/xmldom package.")}}function ca(r,e,t=Kn){try{if(typeof document!="undefined"&&typeof document.evaluate=="function"){const i="ownerDocument"in r?r.ownerDocument:r;if(!i||typeof i.evaluate!="function")return null;const n=Yn(t);return i.evaluate(e,r,n,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}else{const i=require("xpath"),n=t;try{const o=i.select(e,r,n);return o.length>0?o[0]:null}catch(o){if(typeof o=="object"&&o!==null&&"message"in o&&typeof o.message=="string"&&o.message.includes("Cannot resolve QName")){const s=e.match(/local-name\(\)='([^']+)'/);if(s&&s[1]){const c=`.//*[local-name()='${s[1]}']`,l=i.select(c,r);return l.length>0?l[0]:null}}throw o}}}catch(i){return console.error(`XPath evaluation failed for "${e}":`,i),null}}function la(r,e,t=Kn){try{if(typeof document!="undefined"&&typeof document.evaluate=="function"){const i="ownerDocument"in r?r.ownerDocument:r;if(!i||typeof i.evaluate!="function")return[];const n=Yn(t),o=i.evaluate(e,r,n,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),s=[];for(let c=0;c<o.snapshotLength;c++)s.push(o.snapshotItem(c));return s}else{const i=require("xpath"),n=t;try{return i.select(e,r,n)}catch(o){if(typeof o=="object"&&o!==null&&"message"in o&&typeof o.message=="string"&&o.message.includes("Cannot resolve QName")){const s=e.match(/local-name\(\)='([^']+)'/);if(s&&s[1]){const c=`.//*[local-name()='${s[1]}']`;return i.select(c,r)}}throw o}}}catch(i){return console.error(`XPath evaluation failed for "${e}":`,i),[]}}function Yn(r){return function(e){return e===null?null:r[e]||null}}function Zn(r){const e=r.split(",").map(i=>i.trim()),t=[];for(const i of e){const n=i.split(/\\:|:/).filter(Boolean);n.length===1?t.push(`.//*[local-name()='${n[0]}']`):n.length===2&&t.push(`.//${n[0]}:${n[1]} | .//*[local-name()='${n[1]}']`)}return t.join(" | ")}function Q(r,e){if(typeof r.querySelector=="function")try{const i=r.querySelector(e);if(i)return i}catch(i){}const t=se(r,e);if(t.length>0)return t[0];try{const i=Zn(e);return ca(r,i)}catch(i){return console.warn("XPath query failed, using direct DOM traversal as fallback"),null}}function Wt(r,e){if(typeof r.querySelectorAll=="function")try{const i=r.querySelectorAll(e);if(i.length>0){const n=[];for(let o=0;o<i.length;o++)n.push(i[o]);return n}}catch(i){}const t=se(r,e);if(t.length>0)return t;try{const i=Zn(e);return la(r,i)}catch(i){return console.warn("XPath query failed, using direct DOM traversal as fallback"),[]}}function ua(r){if(typeof window!="undefined"&&window.XMLSerializer)return new window.XMLSerializer().serializeToString(r);try{const{XMLSerializer:e}=require("@xmldom/xmldom");return new e().serializeToString(r)}catch(e){throw new Error("XML Serializer not available. In Node.js environments, please install @xmldom/xmldom package.")}}const Ze={default:"c14n","http://www.w3.org/TR/2001/REC-xml-c14n-20010315":"c14n","http://www.w3.org/2006/12/xml-c14n11":"c14n11","http://www.w3.org/2001/10/xml-exc-c14n#":"c14n_exc"},wt={c14n:{beforeChildren:()=>"",afterChildren:()=>"",betweenChildren:()=>"",afterElement:()=>"",isCanonicalizationMethod:"c14n"},c14n11:{beforeChildren:()=>"",afterChildren:()=>"",betweenChildren:()=>"",afterElement:()=>"",isCanonicalizationMethod:"c14n11"},c14n_exc:{beforeChildren:()=>"",afterChildren:()=>"",betweenChildren:()=>"",afterElement:()=>"",isCanonicalizationMethod:"c14n_exc"}},_={ELEMENT_NODE:1,TEXT_NODE:3};class q{constructor(e=wt.c14n){this.method=e}static fromMethod(e){const t=Ze[e];if(!t)throw new Error(`Unsupported canonicalization method: ${e}`);return new q(wt[t])}setMethod(e){this.method=e}static escapeXml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}static collectNamespaces(e,t=new Map){let i=e;for(;i&&i.nodeType===_.ELEMENT_NODE;){const n=i,o=n.getAttribute("xmlns");o!==null&&!t.has("")&&t.set("",o);const s=n.attributes;for(let c=0;c<s.length;c++){const l=s[c];if(l.name.startsWith("xmlns:")){const f=l.name.substring(6);t.has(f)||t.set(f,l.value)}}i=i.parentNode}return t}static collectUsedNamespaces(e,t=new Map,i=[]){const n=new Map,o=new Set;function s(c,l=!1){if(c.nodeType===_.ELEMENT_NODE){const f=c,h=f.namespaceURI,d=f.prefix||"";if(d&&h&&(l||!o.has(d))){o.add(d);const y=t.get(d);y&&y===h&&!n.has(d)&&n.set(d,y)}const g=f.attributes;for(let y=0;y<g.length;y++){const v=g[y];if(v.name.includes(":")&&!v.name.startsWith("xmlns:")){const B=v.name.split(":")[0];if(l||!o.has(B)){o.add(B);const b=t.get(B);b&&!n.has(B)&&n.set(B,b)}}}for(const y of i){const v=t.get(y);v&&!n.has(y)&&n.set(y,v)}for(let y=0;y<c.childNodes.length;y++)s(c.childNodes[y],!1)}}return s(e,!0),n}static isBase64Element(e){if(e.nodeType!==_.ELEMENT_NODE)return!1;const t=e,i=t.localName||t.nodeName.split(":").pop()||"";return this.base64Elements.has(i)}static analyzeWhitespace(e){const t=e.nodeType===_.ELEMENT_NODE?e:e.documentElement;function i(n){if(n.nodeType===_.ELEMENT_NODE){n._whitespace={hasMixedContent:!1,hasExistingLinebreaks:!1,originalContent:{}};const o=Array.from(n.childNodes);let s=!1,c=!1,l=!1;for(const f of o)if(f.nodeType===_.TEXT_NODE&&(f.nodeValue||"").trim().length>0){s=!0;break}for(const f of o)if(f.nodeType===_.ELEMENT_NODE){c=!0;break}for(let f=0;f<o.length;f++){const h=o[f];if(h.nodeType===_.TEXT_NODE){const d=h.nodeValue||"";h._originalText=d,d.includes(`
5
- `)&&(l=!0)}else h.nodeType===_.ELEMENT_NODE&&i(h)}n._whitespace.hasMixedContent=s&&c,n._whitespace.hasExistingLinebreaks=l}}i(t)}canonicalize(e,t=new Map,i={isStartingNode:!0}){var n,o,s;if(!e)return"";let c="";if(e.nodeType===_.ELEMENT_NODE){const l=new Map(t),f=e,h=f.getAttribute("xmlns");h!==null&&l.set("",h);const d=f.attributes;for(let C=0;C<d.length;C++){const x=d[C];if(x.name.startsWith("xmlns:")){const M=x.name.substring(6);l.set(M,x.value)}}const g=f.prefix||"",y=f.localName||f.nodeName.split(":").pop()||"",v=g?`${g}:${y}`:y;if(c+="<"+v,i.isStartingNode){const C=q.collectNamespaces(e),x=Array.from(C.entries()).sort((M,Se)=>M[0]===""?-1:Se[0]===""?1:M[0].localeCompare(Se[0]));for(const[M,Se]of x)M===""?c+=` xmlns="${Se}"`:c+=` xmlns:${M}="${Se}"`}else{const C=Array.from(l.entries()).filter(([x,M])=>!t.has(x)||t.get(x)!==M).sort((x,M)=>x[0]===""?-1:M[0]===""?1:x[0].localeCompare(M[0]));for(const[x,M]of C)x===""?c+=` xmlns="${M}"`:c+=` xmlns:${x}="${M}"`}const B=f.attributes,b=[];for(let C=0;C<B.length;C++){const x=B[C];x.name.startsWith("xmlns")||b.push(x)}b.sort((C,x)=>C.name.localeCompare(x.name));for(const C of b)c+=` ${C.name}="${q.escapeXml(C.value)}"`;c+=">";const w=Array.from(e.childNodes);let U=!1,K=!1;const N=((n=e._whitespace)==null?void 0:n.hasMixedContent)||!1;for(const C of w)if(C.nodeType===_.ELEMENT_NODE){U=!0;break}const V=this.method.isCanonicalizationMethod==="c14n11"&&U&&!((o=e._whitespace)!=null&&o.hasExistingLinebreaks)&&!N;V&&(c+=this.method.beforeChildren(U,N));for(let C=0;C<w.length;C++){const x=w[C],M=x.nodeType===_.ELEMENT_NODE,Se=C<w.length-1?w[C+1]:null;if(Se&&(Se.nodeType,_.ELEMENT_NODE),x.nodeType===_.TEXT_NODE){const Xt=x.nodeValue||"";q.isBase64Element(e)?c+=Xt.replace(/\r/g,"&#xD;"):c+=x._originalText||Xt,K=!1;continue}M&&(K&&this.method.isCanonicalizationMethod==="c14n11"&&!((s=e._whitespace)!=null&&s.hasExistingLinebreaks)&&!N&&(c+=this.method.betweenChildren(!0,!0,N)),c+=this.canonicalize(x,l,{isStartingNode:!1}),K=!0)}V&&(c+=this.method.afterChildren(U,N)),c+="</"+v+">"}else if(e.nodeType===_.TEXT_NODE){const l=e._originalText||e.nodeValue||"";c+=q.escapeXml(l)}return c}canonicalizeExclusive(e,t=new Map,i={}){if(!e)return"";const{inclusiveNamespacePrefixList:n=[],isStartingNode:o=!0}=i;let s="";if(e.nodeType===_.ELEMENT_NODE){const c=e,l=q.collectNamespaces(c),f=o?q.collectUsedNamespaces(c,l,n):new Map,h=c.prefix||"",d=c.localName||c.nodeName.split(":").pop()||"",g=h?`${h}:${d}`:d;if(s+="<"+g,o){const b=Array.from(f.entries()).sort((w,U)=>w[0]===""?-1:U[0]===""?1:w[0].localeCompare(U[0]));for(const[w,U]of b)w===""?s+=` xmlns="${U}"`:s+=` xmlns:${w}="${U}"`}const y=c.attributes,v=[];for(let b=0;b<y.length;b++){const w=y[b];w.name.startsWith("xmlns")||v.push(w)}v.sort((b,w)=>b.name.localeCompare(w.name));for(const b of v)s+=` ${b.name}="${q.escapeXml(b.value)}"`;s+=">";const B=Array.from(e.childNodes);for(let b=0;b<B.length;b++){const w=B[b];if(w.nodeType===_.TEXT_NODE){const U=w.nodeValue||"";q.isBase64Element(e)?s+=U.replace(/\r/g,"&#xD;"):s+=q.escapeXml(U)}else w.nodeType===_.ELEMENT_NODE&&(s+=this.canonicalizeExclusive(w,new Map([...t,...f]),{inclusiveNamespacePrefixList:n,isStartingNode:!1}))}s+="</"+g+">"}else if(e.nodeType===_.TEXT_NODE){const c=e.nodeValue||"";s+=q.escapeXml(c)}return s}static c14n(e){return this.analyzeWhitespace(e),new q(wt.c14n).canonicalize(e)}static c14n11(e){return this.analyzeWhitespace(e),new q(wt.c14n11).canonicalize(e)}static c14n_exc(e,t=[]){return this.analyzeWhitespace(e),new q(wt.c14n_exc).canonicalizeExclusive(e,new Map,{inclusiveNamespacePrefixList:t})}static canonicalize(e,t,i={}){switch(Ze[t]||Ze.default){case"c14n":return this.c14n(e);case"c14n11":return this.c14n11(e);case"c14n_exc":return this.c14n_exc(e,i.inclusiveNamespacePrefixList||[]);default:throw new Error(`Unsupported canonicalization method: ${t}`)}}}q.base64Elements=new Set(["DigestValue","X509Certificate","EncapsulatedTimeStamp","EncapsulatedOCSPValue","IssuerSerialV2"]);var fa=(r,e,t)=>new Promise((i,n)=>{var o=l=>{try{c(t.next(l))}catch(f){n(f)}},s=l=>{try{c(t.throw(l))}catch(f){n(f)}},c=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,s);c((t=t.apply(r,e)).next())});function ha(r){if(!r)return"";const e=r.replace(/\s+/g,""),t=[];for(let i=0;i<e.length;i+=64)t.push(e.substring(i,i+64));return`-----BEGIN CERTIFICATE-----
6
- ${t.join(`
4
+ */(function(Ne,ze){typeof exports=="object"&&typeof module!="undefined"?ze(exports,require("fflate"),require("@peculiar/x509")):typeof define=="function"&&define.amd?define(["exports","fflate","@peculiar/x509"],ze):(Ne=typeof globalThis!="undefined"?globalThis:Ne||self,ze(Ne.edockit={},Ne.fflate,Ne.peculiarX509))})(this,(function(Ne,ze,ke){"use strict";function Ot(n,e){return e.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(i){if(i!=="default"&&!(i in n)){var o=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(n,i,o.get?o:{enumerable:!0,get:function(){return r[i]}})}})}),Object.freeze(n)}function al(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var De={},nt={},Rs;function Tr(){if(Rs)return nt;Rs=1;function n(R,K,Ae){if(Ae===void 0&&(Ae=Array.prototype),R&&typeof Ae.find=="function")return Ae.find.call(R,K);for(var be=0;be<R.length;be++)if(r(R,be)){var Ce=R[be];if(K.call(void 0,Ce,be,R))return Ce}}function e(R,K){return K===void 0&&(K=Object),K&&typeof K.getOwnPropertyDescriptors=="function"&&(R=K.create(null,K.getOwnPropertyDescriptors(R))),K&&typeof K.freeze=="function"?K.freeze(R):R}function r(R,K){return Object.prototype.hasOwnProperty.call(R,K)}function i(R,K){if(R===null||typeof R!="object")throw new TypeError("target is not an object");for(var Ae in K)r(K,Ae)&&(R[Ae]=K[Ae]);return R}var o=e({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function u(R){return r(o,R.toLowerCase())}var l=e({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function f(R){return r(l,R.toLowerCase())}var p=e({script:!1,style:!1,textarea:!0,title:!0});function g(R){var K=R.toLowerCase();return r(p,K)&&!p[K]}function N(R){var K=R.toLowerCase();return r(p,K)&&p[K]}function E(R){return R===C.HTML}function S(R){return E(R)||R===C.XML_XHTML_APPLICATION}var C=e({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),I=Object.keys(C).map(function(R){return C[R]});function H(R){return I.indexOf(R)>-1}var U=e({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return nt.assign=i,nt.find=n,nt.freeze=e,nt.HTML_BOOLEAN_ATTRIBUTES=o,nt.HTML_RAW_TEXT_ELEMENTS=p,nt.HTML_VOID_ELEMENTS=l,nt.hasDefaultHTMLNamespace=S,nt.hasOwn=r,nt.isHTMLBooleanAttribute=u,nt.isHTMLRawTextElement=g,nt.isHTMLEscapableRawTextElement=N,nt.isHTMLMimeType=E,nt.isHTMLVoidElement=f,nt.isValidMimeType=H,nt.MIME_TYPE=C,nt.NAMESPACE=U,nt}var Sr={},ks;function Bn(){if(ks)return Sr;ks=1;var n=Tr();function e(S,C){S.prototype=Object.create(Error.prototype,{constructor:{value:S},name:{value:S.name,enumerable:!0,writable:C}})}var r=n.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),i=Object.keys(r);function o(S){return typeof S=="number"&&S>=1&&S<=25}function u(S){return typeof S=="string"&&S.substring(S.length-r.Error.length)===r.Error}function l(S,C){o(S)?(this.name=i[S],this.message=C||""):(this.message=S,this.name=u(C)?C:r.Error),Error.captureStackTrace&&Error.captureStackTrace(this,l)}e(l,!0),Object.defineProperties(l.prototype,{code:{enumerable:!0,get:function(){var S=i.indexOf(this.name);return o(S)?S:0}}});for(var f={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},p=Object.entries(f),g=0;g<p.length;g++){var N=p[g][0];l[N]=p[g][1]}function E(S,C){this.message=S,this.locator=C,Error.captureStackTrace&&Error.captureStackTrace(this,E)}return e(E),Sr.DOMException=l,Sr.DOMExceptionName=r,Sr.ExceptionCode=f,Sr.ParseError=E,Sr}var $e={},ye={},_s;function Ls(){if(_s)return ye;_s=1;function n(qe){try{typeof qe!="function"&&(qe=RegExp);var Le=new qe("\u{1D306}","u").exec("\u{1D306}");return!!Le&&Le[0].length===2}catch(t){}return!1}var e=n();function r(qe){if(qe.source[0]!=="[")throw new Error(qe+" can not be used with chars");return qe.source.slice(1,qe.source.lastIndexOf("]"))}function i(qe,Le){if(qe.source[0]!=="[")throw new Error("/"+qe.source+"/ can not be used with chars_without");if(!Le||typeof Le!="string")throw new Error(JSON.stringify(Le)+" is not a valid search");if(qe.source.indexOf(Le)===-1)throw new Error('"'+Le+'" is not is /'+qe.source+"/");if(Le==="-"&&qe.source.indexOf(Le)!==1)throw new Error('"'+Le+'" is not at the first postion of /'+qe.source+"/");return new RegExp(qe.source.replace(Le,""),e?"u":"")}function o(qe){var Le=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(t){var a=typeof t=="string";if(a&&Le===void 0&&t==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return a?t:t.source}).join(""),e?"mu":"m")}function u(qe){if(arguments.length===0)throw new Error("no parameters provided");return o.apply(u,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var l="\uFFFD",f=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;e&&(f=o("[",r(f),"\\u{10000}-\\u{10FFFF}","]"));var p=/[\x20\x09\x0D\x0A]/,g=r(p),N=o(p,"+"),E=o(p,"*"),S=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;e&&(S=o("[",r(S),"\\u{10000}-\\u{10FFFF}","]"));var C=r(S),I=o("[",C,r(/[-.0-9\xB7]/),r(/[\u0300-\u036F\u203F-\u2040]/),"]"),H=o(S,I,"*"),U=o(I,"+"),R=o("&",H,";"),K=u(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Ae=u(R,"|",K),be=o("%",H,";"),Ce=u(o('"',u(/[^%&"]/,"|",be,"|",Ae),"*",'"'),"|",o("'",u(/[^%&']/,"|",be,"|",Ae),"*","'")),D=u('"',u(/[^<&"]/,"|",Ae),"*",'"',"|","'",u(/[^<&']/,"|",Ae),"*","'"),A=i(S,":"),q=i(I,":"),re=o(A,q,"*"),Q=o(re,u(":",re),"?"),ge=o("^",Q,"$"),Ie=o("(",Q,")"),k=u(/"[^"]*"|'[^']*'/),de=o(/^<\?/,"(",H,")",u(N,"(",f,"*?)"),"?",/\?>/),B=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,F=u('"',B,'*"',"|","'",i(B,"'"),"*'"),Y="<!--",M="-->",V=o(Y,u(i(f,"-"),"|",o("-",i(f,"-"))),"*",M),_="#PCDATA",z=u(o(/\(/,E,_,u(E,/\|/,E,Q),"*",E,/\)\*/),"|",o(/\(/,E,_,E,/\)/)),fe=/[?*+]?/,oe=o(/\([^>]+\)/,fe),G=u("EMPTY","|","ANY","|",z,"|",oe),J="<!ELEMENT",ue=o(J,N,u(Q,"|",be),N,u(G,"|",be),E,">"),pe=o("NOTATION",N,/\(/,E,H,u(E,/\|/,E,H),"*",E,/\)/),le=o(/\(/,E,U,u(E,/\|/,E,U),"*",E,/\)/),Et=u(pe,"|",le),at=u(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",Et),Ze=u(/#REQUIRED|#IMPLIED/,"|",u(u("#FIXED",N),"?",D)),ae=u(N,H,N,at,N,Ze),Gt="<!ATTLIST",et=o(Gt,N,H,ae,"*",E,">"),L="about:legacy-compat",Xt=u('"'+L+'"',"|","'"+L+"'"),$="SYSTEM",Ge="PUBLIC",tt=u(u($,N,k),"|",u(Ge,N,F,N,k)),Oe=o("^",u(u($,N,"(?<SystemLiteralOnly>",k,")"),"|",u(Ge,N,"(?<PubidLiteral>",F,")",N,"(?<SystemLiteral>",k,")"))),ne=u(N,"NDATA",N,H),Z=u(Ce,"|",u(tt,ne,"?")),Re="<!ENTITY",Wt=o(Re,N,H,N,Z,E,">"),X=u(Ce,"|",tt),Xe=o(Re,N,"%",N,H,N,X,E,">"),Cr=u(Wt,"|",Xe),W=o(Ge,N,F),gt=o("<!NOTATION",N,H,N,u(tt,"|",W),E,">"),ce=o(E,"=",E),Te=/1[.]\d+/,_e=o(N,"version",ce,u("'",Te,"'","|",'"',Te,'"')),He=/[A-Za-z][-A-Za-z0-9._]*/,se=u(N,"encoding",ce,u('"',He,'"',"|","'",He,"'")),ee=u(N,"standalone",ce,u("'",u("yes","|","no"),"'","|",'"',u("yes","|","no"),'"')),nr=o(/^<\?xml/,_e,se,"?",ee,"?",E,/\?>/),lt="<!DOCTYPE",ct="<![CDATA[",St="]]>",Dt=/<!\[CDATA\[/,he=/\]\]>/,ir=o(f,"*?",he),xr=o(Dt,ir);return ye.chars=r,ye.chars_without=i,ye.detectUnicodeSupport=n,ye.reg=o,ye.regg=u,ye.ABOUT_LEGACY_COMPAT=L,ye.ABOUT_LEGACY_COMPAT_SystemLiteral=Xt,ye.AttlistDecl=et,ye.CDATA_START=ct,ye.CDATA_END=St,ye.CDSect=xr,ye.Char=f,ye.Comment=V,ye.COMMENT_START=Y,ye.COMMENT_END=M,ye.DOCTYPE_DECL_START=lt,ye.elementdecl=ue,ye.EntityDecl=Cr,ye.EntityValue=Ce,ye.ExternalID=tt,ye.ExternalID_match=Oe,ye.Name=H,ye.NotationDecl=gt,ye.Reference=Ae,ye.PEReference=be,ye.PI=de,ye.PUBLIC=Ge,ye.PubidLiteral=F,ye.QName=Q,ye.QName_exact=ge,ye.QName_group=Ie,ye.S=N,ye.SChar_s=g,ye.S_OPT=E,ye.SYSTEM=$,ye.SystemLiteral=k,ye.UNICODE_REPLACEMENT_CHARACTER=l,ye.UNICODE_SUPPORT=e,ye.XMLDecl=nr,ye}var Ms;function Fs(){if(Ms)return $e;Ms=1;var n=Tr(),e=n.find,r=n.hasDefaultHTMLNamespace,i=n.hasOwn,o=n.isHTMLMimeType,u=n.isHTMLRawTextElement,l=n.isHTMLVoidElement,f=n.MIME_TYPE,p=n.NAMESPACE,g=Symbol(),N=Bn(),E=N.DOMException,S=N.DOMExceptionName,C=Ls();function I(s){if(s!==g)throw new TypeError("Illegal constructor")}function H(s){return s!==""}function U(s){return s?s.split(/[\t\n\f\r ]+/).filter(H):[]}function R(s,c){return i(s,c)||(s[c]=!0),s}function K(s){if(!s)return[];var c=U(s);return Object.keys(c.reduce(R,{}))}function Ae(s){return function(c){return s&&s.indexOf(c)!==-1}}function be(s){if(!C.QName_exact.test(s))throw new E(E.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+s+'"')}function Ce(s,c){be(c),s=s||null;var y=null,b=c;if(c.indexOf(":")>=0){var x=c.split(":");y=x[0],b=x[1]}if(y!==null&&s===null)throw new E(E.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(y==="xml"&&s!==n.NAMESPACE.XML)throw new E(E.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((y==="xmlns"||c==="xmlns")&&s!==n.NAMESPACE.XMLNS)throw new E(E.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(s===n.NAMESPACE.XMLNS&&y!=="xmlns"&&c!=="xmlns")throw new E(E.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[s,y,b]}function D(s,c){for(var y in s)i(s,y)&&(c[y]=s[y])}function A(s,c){var y=s.prototype;if(!(y instanceof c)){let b=function(){};b.prototype=c.prototype,b=new b,D(y,b),s.prototype=y=b}y.constructor!=s&&(typeof s!="function"&&console.error("unknown Class:"+s),y.constructor=s)}var q={},re=q.ELEMENT_NODE=1,Q=q.ATTRIBUTE_NODE=2,ge=q.TEXT_NODE=3,Ie=q.CDATA_SECTION_NODE=4,k=q.ENTITY_REFERENCE_NODE=5,de=q.ENTITY_NODE=6,B=q.PROCESSING_INSTRUCTION_NODE=7,F=q.COMMENT_NODE=8,Y=q.DOCUMENT_NODE=9,M=q.DOCUMENT_TYPE_NODE=10,V=q.DOCUMENT_FRAGMENT_NODE=11,_=q.NOTATION_NODE=12,z=n.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function fe(s,c){if(c.length<s.length)return fe(c,s);var y=null;for(var b in s){if(s[b]!==c[b])return y;y=s[b]}return y}function oe(s){return s.guid||(s.guid=Math.random()),s.guid}function G(){}G.prototype={length:0,item:function(s){return s>=0&&s<this.length?this[s]:null},toString:function(s){for(var c=[],y=0;y<this.length;y++)a(this[y],c,s);return c.join("")},filter:function(s){return Array.prototype.filter.call(this,s)},indexOf:function(s){return Array.prototype.indexOf.call(this,s)}},G.prototype[Symbol.iterator]=function(){var s=this,c=0;return{next:function(){return c<s.length?{value:s[c++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function J(s,c){this._node=s,this._refresh=c,ue(this)}function ue(s){var c=s._node._inc||s._node.ownerDocument._inc;if(s._inc!==c){var y=s._refresh(s._node);if(v(s,"length",y.length),!s.$$length||y.length<s.$$length)for(var b=y.length;b in s;b++)i(s,b)&&delete s[b];D(y,s),s._inc=c}}J.prototype.item=function(s){return ue(this),this[s]||null},A(J,G);function pe(){}function le(s,c){for(var y=0;y<s.length;){if(s[y]===c)return y;y++}}function Et(s,c,y,b){if(b?c[le(c,b)]=y:(c[c.length]=y,c.length++),s){y.ownerElement=s;var x=s.ownerDocument;x&&(b&&$(x,s,b),Xt(x,s,y))}}function at(s,c,y){var b=le(c,y);if(b>=0){for(var x=c.length-1;b<=x;)c[b]=c[++b];if(c.length=x,s){var O=s.ownerDocument;O&&$(O,s,y),y.ownerElement=null}}}pe.prototype={length:0,item:G.prototype.item,getNamedItem:function(s){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(s=s.toLowerCase());for(var c=0;c<this.length;){var y=this[c];if(y.nodeName===s)return y;c++}return null},setNamedItem:function(s){var c=s.ownerElement;if(c&&c!==this._ownerElement)throw new E(E.INUSE_ATTRIBUTE_ERR);var y=this.getNamedItemNS(s.namespaceURI,s.localName);return y===s?s:(Et(this._ownerElement,this,s,y),y)},setNamedItemNS:function(s){return this.setNamedItem(s)},removeNamedItem:function(s){var c=this.getNamedItem(s);if(!c)throw new E(E.NOT_FOUND_ERR,s);return at(this._ownerElement,this,c),c},removeNamedItemNS:function(s,c){var y=this.getNamedItemNS(s,c);if(!y)throw new E(E.NOT_FOUND_ERR,s?s+" : "+c:c);return at(this._ownerElement,this,y),y},getNamedItemNS:function(s,c){s||(s=null);for(var y=0;y<this.length;){var b=this[y];if(b.localName===c&&b.namespaceURI===s)return b;y++}return null}},pe.prototype[Symbol.iterator]=function(){var s=this,c=0;return{next:function(){return c<s.length?{value:s[c++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Ze(){}Ze.prototype={hasFeature:function(s,c){return!0},createDocument:function(s,c,y){var b=f.XML_APPLICATION;s===p.HTML?b=f.XML_XHTML_APPLICATION:s===p.SVG&&(b=f.XML_SVG_IMAGE);var x=new L(g,{contentType:b});if(x.implementation=this,x.childNodes=new G,x.doctype=y||null,y&&x.appendChild(y),c){var O=x.createElementNS(s,c);x.appendChild(O)}return x},createDocumentType:function(s,c,y,b){be(s);var x=new lt(g);return x.name=s,x.nodeName=s,x.publicId=c||"",x.systemId=y||"",x.internalSubset=b||"",x.childNodes=new G,x},createHTMLDocument:function(s){var c=new L(g,{contentType:f.HTML});if(c.implementation=this,c.childNodes=new G,s!==!1){c.doctype=this.createDocumentType("html"),c.doctype.ownerDocument=c,c.appendChild(c.doctype);var y=c.createElement("html");c.appendChild(y);var b=c.createElement("head");if(y.appendChild(b),typeof s=="string"){var x=c.createElement("title");x.appendChild(c.createTextNode(s)),b.appendChild(x)}y.appendChild(c.createElement("body"))}return c}};function ae(s){I(s)}ae.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var s=this.getRootNode();return s&&s.nodeType===s.DOCUMENT_NODE},contains:function(s){if(!s)return!1;var c=s;do{if(this===c)return!0;c=s.parentNode}while(c);return!1},getRootNode:function(s){var c=this;do{if(!c.parentNode)return c;c=c.parentNode}while(c)},isEqualNode:function(s){if(!s||this.nodeType!==s.nodeType)return!1;switch(this.nodeType){case this.DOCUMENT_TYPE_NODE:if(this.name!==s.name||this.publicId!==s.publicId||this.systemId!==s.systemId)return!1;break;case this.ELEMENT_NODE:if(this.namespaceURI!==s.namespaceURI||this.prefix!==s.prefix||this.localName!==s.localName||this.attributes.length!==s.attributes.length)return!1;for(var c=0;c<this.attributes.length;c++){var y=this.attributes.item(c);if(!y.isEqualNode(s.getAttributeNodeNS(y.namespaceURI,y.localName)))return!1}break;case this.ATTRIBUTE_NODE:if(this.namespaceURI!==s.namespaceURI||this.localName!==s.localName||this.value!==s.value)return!1;break;case this.PROCESSING_INSTRUCTION_NODE:if(this.target!==s.target||this.data!==s.data)return!1;break;case this.TEXT_NODE:case this.COMMENT_NODE:if(this.data!==s.data)return!1;break}if(this.childNodes.length!==s.childNodes.length)return!1;for(var c=0;c<this.childNodes.length;c++)if(!this.childNodes[c].isEqualNode(s.childNodes[c]))return!1;return!0},isSameNode:function(s){return this===s},insertBefore:function(s,c){return ce(this,s,c)},replaceChild:function(s,c){ce(this,s,c,gt),c&&this.removeChild(c)},removeChild:function(s){return tt(this,s)},appendChild:function(s){return this.insertBefore(s,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(s){return w(this.ownerDocument||this,this,s)},normalize:function(){for(var s=this.firstChild;s;){var c=s.nextSibling;c&&c.nodeType==ge&&s.nodeType==ge?(this.removeChild(c),s.appendData(c.data)):(s.normalize(),s=c)}},isSupported:function(s,c){return this.ownerDocument.implementation.hasFeature(s,c)},lookupPrefix:function(s){for(var c=this;c;){var y=c._nsMap;if(y){for(var b in y)if(i(y,b)&&y[b]===s)return b}c=c.nodeType==Q?c.ownerDocument:c.parentNode}return null},lookupNamespaceURI:function(s){for(var c=this;c;){var y=c._nsMap;if(y&&i(y,s))return y[s];c=c.nodeType==Q?c.ownerDocument:c.parentNode}return null},isDefaultNamespace:function(s){var c=this.lookupPrefix(s);return c==null},compareDocumentPosition:function(s){if(this===s)return 0;var c=s,y=this,b=null,x=null;if(c instanceof _e&&(b=c,c=b.ownerElement),y instanceof _e&&(x=y,y=x.ownerElement,b&&c&&y===c))for(var O=0,me;me=y.attributes[O];O++){if(me===b)return z.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+z.DOCUMENT_POSITION_PRECEDING;if(me===x)return z.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+z.DOCUMENT_POSITION_FOLLOWING}if(!c||!y||y.ownerDocument!==c.ownerDocument)return z.DOCUMENT_POSITION_DISCONNECTED+z.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(oe(y.ownerDocument)>oe(c.ownerDocument)?z.DOCUMENT_POSITION_FOLLOWING:z.DOCUMENT_POSITION_PRECEDING);if(x&&c===y)return z.DOCUMENT_POSITION_CONTAINS+z.DOCUMENT_POSITION_PRECEDING;if(b&&c===y)return z.DOCUMENT_POSITION_CONTAINED_BY+z.DOCUMENT_POSITION_FOLLOWING;for(var Me=[],je=c.parentNode;je;){if(!x&&je===y)return z.DOCUMENT_POSITION_CONTAINED_BY+z.DOCUMENT_POSITION_FOLLOWING;Me.push(je),je=je.parentNode}Me.reverse();for(var Je=[],Ke=y.parentNode;Ke;){if(!b&&Ke===c)return z.DOCUMENT_POSITION_CONTAINS+z.DOCUMENT_POSITION_PRECEDING;Je.push(Ke),Ke=Ke.parentNode}Je.reverse();var Ct=fe(Me,Je);for(var Pt in Ct.childNodes){var At=Ct.childNodes[Pt];if(At===y)return z.DOCUMENT_POSITION_FOLLOWING;if(At===c)return z.DOCUMENT_POSITION_PRECEDING;if(Je.indexOf(At)>=0)return z.DOCUMENT_POSITION_FOLLOWING;if(Me.indexOf(At)>=0)return z.DOCUMENT_POSITION_PRECEDING}return 0}};function Gt(s){return s=="<"&&"&lt;"||s==">"&&"&gt;"||s=="&"&&"&amp;"||s=='"'&&"&quot;"||"&#"+s.charCodeAt()+";"}D(q,ae),D(q,ae.prototype),D(z,ae),D(z,ae.prototype);function et(s,c){if(c(s))return!0;if(s=s.firstChild)do if(et(s,c))return!0;while(s=s.nextSibling)}function L(s,c){I(s);var y=c||{};this.ownerDocument=this,this.contentType=y.contentType||f.XML_APPLICATION,this.type=o(this.contentType)?"html":"xml"}function Xt(s,c,y){s&&s._inc++;var b=y.namespaceURI;b===p.XMLNS&&(c._nsMap[y.prefix?y.localName:""]=y.value)}function $(s,c,y,b){s&&s._inc++;var x=y.namespaceURI;x===p.XMLNS&&delete c._nsMap[y.prefix?y.localName:""]}function Ge(s,c,y){if(s&&s._inc){s._inc++;var b=c.childNodes;if(y&&!y.nextSibling)b[b.length++]=y;else{for(var x=c.firstChild,O=0;x;)b[O++]=x,x=x.nextSibling;b.length=O,delete b[b.length]}}}function tt(s,c){if(s!==c.parentNode)throw new E(E.NOT_FOUND_ERR,"child's parent is not parent");var y=c.previousSibling,b=c.nextSibling;return y?y.nextSibling=b:s.firstChild=b,b?b.previousSibling=y:s.lastChild=y,Ge(s.ownerDocument,s),c.parentNode=null,c.previousSibling=null,c.nextSibling=null,c}function Oe(s){return s&&(s.nodeType===ae.DOCUMENT_NODE||s.nodeType===ae.DOCUMENT_FRAGMENT_NODE||s.nodeType===ae.ELEMENT_NODE)}function ne(s){return s&&(s.nodeType===ae.CDATA_SECTION_NODE||s.nodeType===ae.COMMENT_NODE||s.nodeType===ae.DOCUMENT_FRAGMENT_NODE||s.nodeType===ae.DOCUMENT_TYPE_NODE||s.nodeType===ae.ELEMENT_NODE||s.nodeType===ae.PROCESSING_INSTRUCTION_NODE||s.nodeType===ae.TEXT_NODE)}function Z(s){return s&&s.nodeType===ae.DOCUMENT_TYPE_NODE}function Re(s){return s&&s.nodeType===ae.ELEMENT_NODE}function Wt(s){return s&&s.nodeType===ae.TEXT_NODE}function X(s,c){var y=s.childNodes||[];if(e(y,Re)||Z(c))return!1;var b=e(y,Z);return!(c&&b&&y.indexOf(b)>y.indexOf(c))}function Xe(s,c){var y=s.childNodes||[];function b(O){return Re(O)&&O!==c}if(e(y,b))return!1;var x=e(y,Z);return!(c&&x&&y.indexOf(x)>y.indexOf(c))}function Cr(s,c,y){if(!Oe(s))throw new E(E.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+s.nodeType);if(y&&y.parentNode!==s)throw new E(E.NOT_FOUND_ERR,"child not in parent");if(!ne(c)||Z(c)&&s.nodeType!==ae.DOCUMENT_NODE)throw new E(E.HIERARCHY_REQUEST_ERR,"Unexpected node type "+c.nodeType+" for parent node type "+s.nodeType)}function W(s,c,y){var b=s.childNodes||[],x=c.childNodes||[];if(c.nodeType===ae.DOCUMENT_FRAGMENT_NODE){var O=x.filter(Re);if(O.length>1||e(x,Wt))throw new E(E.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(O.length===1&&!X(s,y))throw new E(E.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Re(c)&&!X(s,y))throw new E(E.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Z(c)){if(e(b,Z))throw new E(E.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var me=e(b,Re);if(y&&b.indexOf(me)<b.indexOf(y))throw new E(E.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!y&&me)throw new E(E.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function gt(s,c,y){var b=s.childNodes||[],x=c.childNodes||[];if(c.nodeType===ae.DOCUMENT_FRAGMENT_NODE){var O=x.filter(Re);if(O.length>1||e(x,Wt))throw new E(E.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(O.length===1&&!Xe(s,y))throw new E(E.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Re(c)&&!Xe(s,y))throw new E(E.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Z(c)){if(e(b,function(je){return Z(je)&&je!==y}))throw new E(E.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var me=e(b,Re);if(y&&b.indexOf(me)<b.indexOf(y))throw new E(E.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function ce(s,c,y,b){Cr(s,c,y),s.nodeType===ae.DOCUMENT_NODE&&(b||W)(s,c,y);var x=c.parentNode;if(x&&x.removeChild(c),c.nodeType===V){var O=c.firstChild;if(O==null)return c;var me=c.lastChild}else O=me=c;var Me=y?y.previousSibling:s.lastChild;O.previousSibling=Me,me.nextSibling=y,Me?Me.nextSibling=O:s.firstChild=O,y==null?s.lastChild=me:y.previousSibling=me;do O.parentNode=s;while(O!==me&&(O=O.nextSibling));return Ge(s.ownerDocument||s,s,c),c.nodeType==V&&(c.firstChild=c.lastChild=null),c}L.prototype={implementation:null,nodeName:"#document",nodeType:Y,doctype:null,documentElement:null,_inc:1,insertBefore:function(s,c){if(s.nodeType===V){for(var y=s.firstChild;y;){var b=y.nextSibling;this.insertBefore(y,c),y=b}return s}return ce(this,s,c),s.ownerDocument=this,this.documentElement===null&&s.nodeType===re&&(this.documentElement=s),s},removeChild:function(s){var c=tt(this,s);return c===this.documentElement&&(this.documentElement=null),c},replaceChild:function(s,c){ce(this,s,c,gt),s.ownerDocument=this,c&&this.removeChild(c),Re(s)&&(this.documentElement=s)},importNode:function(s,c){return m(this,s,c)},getElementById:function(s){var c=null;return et(this.documentElement,function(y){if(y.nodeType==re&&y.getAttribute("id")==s)return c=y,!0}),c},createElement:function(s){var c=new Te(g);c.ownerDocument=this,this.type==="html"&&(s=s.toLowerCase()),r(this.contentType)&&(c.namespaceURI=p.HTML),c.nodeName=s,c.tagName=s,c.localName=s,c.childNodes=new G;var y=c.attributes=new pe;return y._ownerElement=c,c},createDocumentFragment:function(){var s=new he(g);return s.ownerDocument=this,s.childNodes=new G,s},createTextNode:function(s){var c=new se(g);return c.ownerDocument=this,c.childNodes=new G,c.appendData(s),c},createComment:function(s){var c=new ee(g);return c.ownerDocument=this,c.childNodes=new G,c.appendData(s),c},createCDATASection:function(s){var c=new nr(g);return c.ownerDocument=this,c.childNodes=new G,c.appendData(s),c},createProcessingInstruction:function(s,c){var y=new ir(g);return y.ownerDocument=this,y.childNodes=new G,y.nodeName=y.target=s,y.nodeValue=y.data=c,y},createAttribute:function(s){if(!C.QName_exact.test(s))throw new E(E.INVALID_CHARACTER_ERR,'invalid character in name "'+s+'"');return this.type==="html"&&(s=s.toLowerCase()),this._createAttribute(s)},_createAttribute:function(s){var c=new _e(g);return c.ownerDocument=this,c.childNodes=new G,c.name=s,c.nodeName=s,c.localName=s,c.specified=!0,c},createEntityReference:function(s){if(!C.Name.test(s))throw new E(E.INVALID_CHARACTER_ERR,'not a valid xml name "'+s+'"');if(this.type==="html")throw new E("document is an html document",S.NotSupportedError);var c=new Dt(g);return c.ownerDocument=this,c.childNodes=new G,c.nodeName=s,c},createElementNS:function(s,c){var y=Ce(s,c),b=new Te(g),x=b.attributes=new pe;return b.childNodes=new G,b.ownerDocument=this,b.nodeName=c,b.tagName=c,b.namespaceURI=y[0],b.prefix=y[1],b.localName=y[2],x._ownerElement=b,b},createAttributeNS:function(s,c){var y=Ce(s,c),b=new _e(g);return b.ownerDocument=this,b.childNodes=new G,b.nodeName=c,b.name=c,b.specified=!0,b.namespaceURI=y[0],b.prefix=y[1],b.localName=y[2],b}},A(L,ae);function Te(s){I(s),this._nsMap=Object.create(null)}Te.prototype={nodeType:re,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===p.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(s){return!!this.getAttributeNode(s)},getAttribute:function(s){var c=this.getAttributeNode(s);return c?c.value:null},getAttributeNode:function(s){return this._isInHTMLDocumentAndNamespace()&&(s=s.toLowerCase()),this.attributes.getNamedItem(s)},setAttribute:function(s,c){this._isInHTMLDocumentAndNamespace()&&(s=s.toLowerCase());var y=this.getAttributeNode(s);y?y.value=y.nodeValue=""+c:(y=this.ownerDocument._createAttribute(s),y.value=y.nodeValue=""+c,this.setAttributeNode(y))},removeAttribute:function(s){var c=this.getAttributeNode(s);c&&this.removeAttributeNode(c)},setAttributeNode:function(s){return this.attributes.setNamedItem(s)},setAttributeNodeNS:function(s){return this.attributes.setNamedItemNS(s)},removeAttributeNode:function(s){return this.attributes.removeNamedItem(s.nodeName)},removeAttributeNS:function(s,c){var y=this.getAttributeNodeNS(s,c);y&&this.removeAttributeNode(y)},hasAttributeNS:function(s,c){return this.getAttributeNodeNS(s,c)!=null},getAttributeNS:function(s,c){var y=this.getAttributeNodeNS(s,c);return y?y.value:null},setAttributeNS:function(s,c,y){var b=Ce(s,c),x=b[2],O=this.getAttributeNodeNS(s,x);O?O.value=O.nodeValue=""+y:(O=this.ownerDocument.createAttributeNS(s,c),O.value=O.nodeValue=""+y,this.setAttributeNode(O))},getAttributeNodeNS:function(s,c){return this.attributes.getNamedItemNS(s,c)},getElementsByClassName:function(s){var c=K(s);return new J(this,function(y){var b=[];return c.length>0&&et(y,function(x){if(x!==y&&x.nodeType===re){var O=x.getAttribute("class");if(O){var me=s===O;if(!me){var Me=K(O);me=c.every(Ae(Me))}me&&b.push(x)}}}),b})},getElementsByTagName:function(s){var c=(this.nodeType===Y?this:this.ownerDocument).type==="html",y=s.toLowerCase();return new J(this,function(b){var x=[];return et(b,function(O){if(!(O===b||O.nodeType!==re))if(s==="*")x.push(O);else{var me=O.getQualifiedName(),Me=c&&O.namespaceURI===p.HTML?y:s;me===Me&&x.push(O)}}),x})},getElementsByTagNameNS:function(s,c){return new J(this,function(y){var b=[];return et(y,function(x){x!==y&&x.nodeType===re&&(s==="*"||x.namespaceURI===s)&&(c==="*"||x.localName==c)&&b.push(x)}),b})}},L.prototype.getElementsByClassName=Te.prototype.getElementsByClassName,L.prototype.getElementsByTagName=Te.prototype.getElementsByTagName,L.prototype.getElementsByTagNameNS=Te.prototype.getElementsByTagNameNS,A(Te,ae);function _e(s){I(s),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}_e.prototype.nodeType=Q,A(_e,ae);function He(s){I(s)}He.prototype={data:"",substringData:function(s,c){return this.data.substring(s,s+c)},appendData:function(s){s=this.data+s,this.nodeValue=this.data=s,this.length=s.length},insertData:function(s,c){this.replaceData(s,0,c)},deleteData:function(s,c){this.replaceData(s,c,"")},replaceData:function(s,c,y){var b=this.data.substring(0,s),x=this.data.substring(s+c);y=b+y+x,this.nodeValue=this.data=y,this.length=y.length}},A(He,ae);function se(s){I(s)}se.prototype={nodeName:"#text",nodeType:ge,splitText:function(s){var c=this.data,y=c.substring(s);c=c.substring(0,s),this.data=this.nodeValue=c,this.length=c.length;var b=this.ownerDocument.createTextNode(y);return this.parentNode&&this.parentNode.insertBefore(b,this.nextSibling),b}},A(se,He);function ee(s){I(s)}ee.prototype={nodeName:"#comment",nodeType:F},A(ee,He);function nr(s){I(s)}nr.prototype={nodeName:"#cdata-section",nodeType:Ie},A(nr,se);function lt(s){I(s)}lt.prototype.nodeType=M,A(lt,ae);function ct(s){I(s)}ct.prototype.nodeType=_,A(ct,ae);function St(s){I(s)}St.prototype.nodeType=de,A(St,ae);function Dt(s){I(s)}Dt.prototype.nodeType=k,A(Dt,ae);function he(s){I(s)}he.prototype.nodeName="#document-fragment",he.prototype.nodeType=V,A(he,ae);function ir(s){I(s)}ir.prototype.nodeType=B,A(ir,He);function xr(){}xr.prototype.serializeToString=function(s,c){return qe.call(s,c)},ae.prototype.toString=qe;function qe(s){var c=[],y=this.nodeType===Y&&this.documentElement||this,b=y.prefix,x=y.namespaceURI;if(x&&b==null){var b=y.lookupPrefix(x);if(b==null)var O=[{namespace:x,prefix:null}]}return a(this,c,s,O),c.join("")}function Le(s,c,y){var b=s.prefix||"",x=s.namespaceURI;if(!x||b==="xml"&&x===p.XML||x===p.XMLNS)return!1;for(var O=y.length;O--;){var me=y[O];if(me.prefix===b)return me.namespace!==x}return!0}function t(s,c,y){s.push(" ",c,'="',y.replace(/[<>&"\t\n\r]/g,Gt),'"')}function a(s,c,y,b){b||(b=[]);var x=s.nodeType===Y?s:s.ownerDocument,O=x.type==="html";if(y)if(s=y(s),s){if(typeof s=="string"){c.push(s);return}}else return;switch(s.nodeType){case re:var me=s.attributes,Me=me.length,Pe=s.firstChild,je=s.tagName,Je=je;if(!O&&!s.prefix&&s.namespaceURI){for(var Ke,Ct=0;Ct<me.length;Ct++)if(me.item(Ct).name==="xmlns"){Ke=me.item(Ct).value;break}if(!Ke)for(var Pt=b.length-1;Pt>=0;Pt--){var At=b[Pt];if(At.prefix===""&&At.namespace===s.namespaceURI){Ke=At.namespace;break}}if(Ke!==s.namespaceURI)for(var Pt=b.length-1;Pt>=0;Pt--){var At=b[Pt];if(At.namespace===s.namespaceURI){At.prefix&&(Je=At.prefix+":"+je);break}}}c.push("<",Je);for(var or=0;or<Me;or++){var Bt=me.item(or);Bt.prefix=="xmlns"?b.push({prefix:Bt.localName,namespace:Bt.value}):Bt.nodeName=="xmlns"&&b.push({prefix:"",namespace:Bt.value})}for(var or=0;or<Me;or++){var Bt=me.item(or);if(Le(Bt,O,b)){var P=Bt.prefix||"",Ee=Bt.namespaceURI;t(c,P?"xmlns:"+P:"xmlns",Ee),b.push({prefix:P,namespace:Ee})}a(Bt,c,y,b)}if(je===Je&&Le(s,O,b)){var P=s.prefix||"",Ee=s.namespaceURI;t(c,P?"xmlns:"+P:"xmlns",Ee),b.push({prefix:P,namespace:Ee})}var it=!Pe;if(it&&(O||s.namespaceURI===p.HTML)&&(it=l(je)),it)c.push("/>");else{if(c.push(">"),O&&u(je))for(;Pe;)Pe.data?c.push(Pe.data):a(Pe,c,y,b.slice()),Pe=Pe.nextSibling;else for(;Pe;)a(Pe,c,y,b.slice()),Pe=Pe.nextSibling;c.push("</",Je,">")}return;case Y:case V:for(var Pe=s.firstChild;Pe;)a(Pe,c,y,b.slice()),Pe=Pe.nextSibling;return;case Q:return t(c,s.name,s.value);case ge:return c.push(s.data.replace(/[<&>]/g,Gt));case Ie:return c.push(C.CDATA_START,s.data,C.CDATA_END);case F:return c.push(C.COMMENT_START,s.data,C.COMMENT_END);case M:var Ui=s.publicId,Jr=s.systemId;c.push(C.DOCTYPE_DECL_START," ",s.name),Ui?(c.push(" ",C.PUBLIC," ",Ui),Jr&&Jr!=="."&&c.push(" ",Jr)):Jr&&Jr!=="."&&c.push(" ",C.SYSTEM," ",Jr),s.internalSubset&&c.push(" [",s.internalSubset,"]"),c.push(">");return;case B:return c.push("<?",s.target," ",s.data,"?>");case k:return c.push("&",s.nodeName,";");default:c.push("??",s.nodeName)}}function m(s,c,y){var b;switch(c.nodeType){case re:b=c.cloneNode(!1),b.ownerDocument=s;case V:break;case Q:y=!0;break}if(b||(b=c.cloneNode(!1)),b.ownerDocument=s,b.parentNode=null,y)for(var x=c.firstChild;x;)b.appendChild(m(s,x,y)),x=x.nextSibling;return b}function w(s,c,y){var b=new c.constructor(g);for(var x in c)if(i(c,x)){var O=c[x];typeof O!="object"&&O!=b[x]&&(b[x]=O)}switch(c.childNodes&&(b.childNodes=new G),b.ownerDocument=s,b.nodeType){case re:var me=c.attributes,Me=b.attributes=new pe,je=me.length;Me._ownerElement=b;for(var Je=0;Je<je;Je++)b.setAttributeNode(w(s,me.item(Je),!0));break;case Q:y=!0}if(y)for(var Ke=c.firstChild;Ke;)b.appendChild(w(s,Ke,y)),Ke=Ke.nextSibling;return b}function v(s,c,y){s[c]=y}try{if(Object.defineProperty){let s=function(c){switch(c.nodeType){case re:case V:var y=[];for(c=c.firstChild;c;)c.nodeType!==7&&c.nodeType!==8&&y.push(s(c)),c=c.nextSibling;return y.join("");default:return c.nodeValue}};Object.defineProperty(J.prototype,"length",{get:function(){return ue(this),this.$$length}}),Object.defineProperty(ae.prototype,"textContent",{get:function(){return s(this)},set:function(c){switch(this.nodeType){case re:case V:for(;this.firstChild;)this.removeChild(this.firstChild);(c||String(c))&&this.appendChild(this.ownerDocument.createTextNode(c));break;default:this.data=c,this.value=c,this.nodeValue=c}}}),v=function(c,y,b){c["$$"+y]=b}}}catch(s){}return $e._updateLiveList=ue,$e.Attr=_e,$e.CDATASection=nr,$e.CharacterData=He,$e.Comment=ee,$e.Document=L,$e.DocumentFragment=he,$e.DocumentType=lt,$e.DOMImplementation=Ze,$e.Element=Te,$e.Entity=St,$e.EntityReference=Dt,$e.LiveNodeList=J,$e.NamedNodeMap=pe,$e.Node=ae,$e.NodeList=G,$e.Notation=ct,$e.Text=se,$e.ProcessingInstruction=ir,$e.XMLSerializer=xr,$e}var lr={},Vi={},Us;function ll(){return Us||(Us=1,(function(n){var e=Tr().freeze;n.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),n.HTML_ENTITIES=e({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
5
+ `,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}),n.entityMap=n.HTML_ENTITIES})(Vi)),Vi}var Kr={},Ps;function cl(){if(Ps)return Kr;Ps=1;var n=Tr(),e=Ls(),r=Bn(),i=n.isHTMLEscapableRawTextElement,o=n.isHTMLMimeType,u=n.isHTMLRawTextElement,l=n.hasOwn,f=n.NAMESPACE,p=r.ParseError,g=r.DOMException,N=0,E=1,S=2,C=3,I=4,H=5,U=6,R=7;function K(){}K.prototype={parse:function(B,F,Y){var M=this.domBuilder;M.startDocument(),re(F,F=Object.create(null)),be(B,F,Y,M,this.errorHandler),M.endDocument()}};var Ae=/&#?\w+;?/g;function be(B,F,Y,M,V){var _=o(M.mimeType);B.indexOf(e.UNICODE_REPLACEMENT_CHARACTER)>=0&&V.warning("Unicode replacement character detected, source encoding issues?");function z(ce){if(ce>65535){ce-=65536;var Te=55296+(ce>>10),_e=56320+(ce&1023);return String.fromCharCode(Te,_e)}else return String.fromCharCode(ce)}function fe(ce){var Te=ce[ce.length-1]===";"?ce:ce+";";if(!_&&Te!==ce)return V.error("EntityRef: expecting ;"),ce;var _e=e.Reference.exec(Te);if(!_e||_e[0].length!==Te.length)return V.error("entity not matching Reference production: "+ce),ce;var He=Te.slice(1,-1);return l(Y,He)?Y[He]:He.charAt(0)==="#"?z(parseInt(He.substring(1).replace("x","0x"))):(V.error("entity not found:"+ce),ce)}function oe(ce){if(ce>Ze){var Te=B.substring(Ze,ce).replace(Ae,fe);pe&&le(Ze),M.characters(Te,0,ce-Ze),Ze=ce}}var G=0,J=0,ue=/\r\n?|\n|$/g,pe=M.locator;function le(ce,Te){for(;ce>=J&&(Te=ue.exec(B));)G=J,J=Te.index+Te[0].length,pe.lineNumber++;pe.columnNumber=ce-G+1}for(var Et=[{currentNSMap:F}],at=[],Ze=0;;){try{var ae=B.indexOf("<",Ze);if(ae<0){if(!_&&at.length>0)return V.fatalError("unclosed xml tag(s): "+at.join(", "));if(!B.substring(Ze).match(/^\s*$/)){var Gt=M.doc,et=Gt.createTextNode(B.substring(Ze));if(Gt.documentElement)return V.error("Extra content at the end of the document");Gt.appendChild(et),M.currentElement=et}return}if(ae>Ze){var L=B.substring(Ze,ae);!_&&at.length===0&&(L=L.replace(new RegExp(e.S_OPT.source,"g"),""),L&&V.error("Unexpected content outside root element: '"+L+"'")),oe(ae)}switch(B.charAt(ae+1)){case"/":var X=B.indexOf(">",ae+2),Xt=B.substring(ae+2,X>0?X:void 0);if(!Xt)return V.fatalError("end tag name missing");var $=X>0&&e.reg("^",e.QName_group,e.S_OPT,"$").exec(Xt);if(!$)return V.fatalError('end tag name contains invalid characters: "'+Xt+'"');if(!M.currentElement&&!M.doc.documentElement)return;var Ge=at[at.length-1]||M.currentElement.tagName||M.doc.documentElement.tagName||"";if(Ge!==$[1]){var tt=$[1].toLowerCase();if(!_||Ge.toLowerCase()!==tt)return V.fatalError('Opening and ending tag mismatch: "'+Ge+'" != "'+Xt+'"')}var Oe=Et.pop();at.pop();var ne=Oe.localNSMap;if(M.endElement(Oe.uri,Oe.localName,Ge),ne)for(var Z in ne)l(ne,Z)&&M.endPrefixMapping(Z);X++;break;case"?":pe&&le(ae),X=k(B,ae,M,V);break;case"!":pe&&le(ae),X=Ie(B,ae,M,V,_);break;default:pe&&le(ae);var Re=new de,Wt=Et[Et.length-1].currentNSMap,X=D(B,ae,Re,Wt,fe,V,_),Xe=Re.length;if(Re.closed||(_&&n.isHTMLVoidElement(Re.tagName)?Re.closed=!0:at.push(Re.tagName)),pe&&Xe){for(var Cr=Ce(pe,{}),W=0;W<Xe;W++){var gt=Re[W];le(gt.offset),gt.locator=Ce(pe,{})}M.locator=Cr,A(Re,M,Wt)&&Et.push(Re),M.locator=pe}else A(Re,M,Wt)&&Et.push(Re);_&&!Re.closed?X=q(B,X,Re.tagName,fe,M):X++}}catch(ce){if(ce instanceof p)throw ce;if(ce instanceof g)throw new p(ce.name+": "+ce.message,M.locator,ce);V.error("element parse error: "+ce),X=-1}X>Ze?Ze=X:oe(Math.max(ae,Ze)+1)}}function Ce(B,F){return F.lineNumber=B.lineNumber,F.columnNumber=B.columnNumber,F}function D(B,F,Y,M,V,_,z){function fe(le,Et,at){if(l(Y.attributeNames,le))return _.fatalError("Attribute "+le+" redefined");if(!z&&Et.indexOf("<")>=0)return _.fatalError("Unescaped '<' not allowed in attributes values");Y.addValue(le,Et.replace(/[\t\n\r]/g," ").replace(Ae,V),at)}for(var oe,G,J=++F,ue=N;;){var pe=B.charAt(J);switch(pe){case"=":if(ue===E)oe=B.slice(F,J),ue=C;else if(ue===S)ue=C;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ue===C||ue===E)if(ue===E&&(_.warning('attribute value must after "="'),oe=B.slice(F,J)),F=J+1,J=B.indexOf(pe,F),J>0)G=B.slice(F,J),fe(oe,G,F-1),ue=H;else throw new Error("attribute value no end '"+pe+"' match");else if(ue==I)G=B.slice(F,J),fe(oe,G,F),_.warning('attribute "'+oe+'" missed start quot('+pe+")!!"),F=J+1,ue=H;else throw new Error('attribute value must after "="');break;case"/":switch(ue){case N:Y.setTagName(B.slice(F,J));case H:case U:case R:ue=R,Y.closed=!0;case I:case E:break;case S:Y.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return _.error("unexpected end of input"),ue==N&&Y.setTagName(B.slice(F,J)),J;case">":switch(ue){case N:Y.setTagName(B.slice(F,J));case H:case U:case R:break;case I:case E:G=B.slice(F,J),G.slice(-1)==="/"&&(Y.closed=!0,G=G.slice(0,-1));case S:ue===S&&(G=oe),ue==I?(_.warning('attribute "'+G+'" missed quot(")!'),fe(oe,G,F)):(z||_.warning('attribute "'+G+'" missed value!! "'+G+'" instead!!'),fe(G,G,F));break;case C:if(!z)return _.fatalError(`AttValue: ' or " expected`)}return J;case"\x80":pe=" ";default:if(pe<=" ")switch(ue){case N:Y.setTagName(B.slice(F,J)),ue=U;break;case E:oe=B.slice(F,J),ue=S;break;case I:var G=B.slice(F,J);_.warning('attribute "'+G+'" missed quot(")!!'),fe(oe,G,F);case H:ue=U;break}else switch(ue){case S:z||_.warning('attribute "'+oe+'" missed value!! "'+oe+'" instead2!!'),fe(oe,oe,F),F=J,ue=E;break;case H:_.warning('attribute space is required"'+oe+'"!!');case U:ue=E,F=J;break;case C:ue=I,F=J;break;case R:throw new Error("elements closed character '/' and '>' must be connected to")}}J++}}function A(B,F,Y){for(var M=B.tagName,V=null,ue=B.length;ue--;){var _=B[ue],z=_.qName,fe=_.value,pe=z.indexOf(":");if(pe>0)var oe=_.prefix=z.slice(0,pe),G=z.slice(pe+1),J=oe==="xmlns"&&G;else G=z,oe=null,J=z==="xmlns"&&"";_.localName=G,J!==!1&&(V==null&&(V=Object.create(null),re(Y,Y=Object.create(null))),Y[J]=V[J]=fe,_.uri=f.XMLNS,F.startPrefixMapping(J,fe))}for(var ue=B.length;ue--;)_=B[ue],_.prefix&&(_.prefix==="xml"&&(_.uri=f.XML),_.prefix!=="xmlns"&&(_.uri=Y[_.prefix]));var pe=M.indexOf(":");pe>0?(oe=B.prefix=M.slice(0,pe),G=B.localName=M.slice(pe+1)):(oe=null,G=B.localName=M);var le=B.uri=Y[oe||""];if(F.startElement(le,G,M,B),B.closed){if(F.endElement(le,G,M),V)for(oe in V)l(V,oe)&&F.endPrefixMapping(oe)}else return B.currentNSMap=Y,B.localNSMap=V,!0}function q(B,F,Y,M,V){var _=i(Y);if(_||u(Y)){var z=B.indexOf("</"+Y+">",F),fe=B.substring(F+1,z);return _&&(fe=fe.replace(Ae,M)),V.characters(fe,0,fe.length),z}return F+1}function re(B,F){for(var Y in B)l(B,Y)&&(F[Y]=B[Y])}function Q(B,F){var Y=F;function M(J){return J=J||0,B.charAt(Y+J)}function V(J){J=J||1,Y+=J}function _(){for(var J=0;Y<B.length;){var ue=M();if(ue!==" "&&ue!==`
6
+ `&&ue!==" "&&ue!=="\r")return J;J++,V()}return-1}function z(){return B.substring(Y)}function fe(J){return B.substring(Y,Y+J.length)===J}function oe(J){return B.substring(Y,Y+J.length).toUpperCase()===J.toUpperCase()}function G(J){var ue=e.reg("^",J),pe=ue.exec(z());return pe?(V(pe[0].length),pe[0]):null}return{char:M,getIndex:function(){return Y},getMatch:G,getSource:function(){return B},skip:V,skipBlanks:_,substringFromIndex:z,substringStartsWith:fe,substringStartsWithCaseInsensitive:oe}}function ge(B,F){function Y(fe,oe){var G=e.PI.exec(fe.substringFromIndex());return G?G[1].toLowerCase()==="xml"?oe.fatalError("xml declaration is only allowed at the start of the document, but found at position "+fe.getIndex()):(fe.skip(G[0].length),G[0]):oe.fatalError("processing instruction is not well-formed at position "+fe.getIndex())}var M=B.getSource();if(B.char()==="["){B.skip(1);for(var V=B.getIndex();B.getIndex()<M.length;){if(B.skipBlanks(),B.char()==="]"){var _=M.substring(V,B.getIndex());return B.skip(1),_}var z=null;if(B.char()==="<"&&B.char(1)==="!")switch(B.char(2)){case"E":B.char(3)==="L"?z=B.getMatch(e.elementdecl):B.char(3)==="N"&&(z=B.getMatch(e.EntityDecl));break;case"A":z=B.getMatch(e.AttlistDecl);break;case"N":z=B.getMatch(e.NotationDecl);break;case"-":z=B.getMatch(e.Comment);break}else if(B.char()==="<"&&B.char(1)==="?")z=Y(B,F);else if(B.char()==="%")z=B.getMatch(e.PEReference);else return F.fatalError("Error detected in Markup declaration");if(!z)return F.fatalError("Error in internal subset at position "+B.getIndex())}return F.fatalError("doctype internal subset is not well-formed, missing ]")}}function Ie(B,F,Y,M,V){var _=Q(B,F);switch(V?_.char(2).toUpperCase():_.char(2)){case"-":var z=_.getMatch(e.Comment);return z?(Y.comment(z,e.COMMENT_START.length,z.length-e.COMMENT_START.length-e.COMMENT_END.length),_.getIndex()):M.fatalError("comment is not well-formed at position "+_.getIndex());case"[":var fe=_.getMatch(e.CDSect);return fe?!V&&!Y.currentElement?M.fatalError("CDATA outside of element"):(Y.startCDATA(),Y.characters(fe,e.CDATA_START.length,fe.length-e.CDATA_START.length-e.CDATA_END.length),Y.endCDATA(),_.getIndex()):M.fatalError("Invalid CDATA starting at position "+F);case"D":{if(Y.doc&&Y.doc.documentElement)return M.fatalError("Doctype not allowed inside or after documentElement at position "+_.getIndex());if(V?!_.substringStartsWithCaseInsensitive(e.DOCTYPE_DECL_START):!_.substringStartsWith(e.DOCTYPE_DECL_START))return M.fatalError("Expected "+e.DOCTYPE_DECL_START+" at position "+_.getIndex());if(_.skip(e.DOCTYPE_DECL_START.length),_.skipBlanks()<1)return M.fatalError("Expected whitespace after "+e.DOCTYPE_DECL_START+" at position "+_.getIndex());var oe={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(oe.name=_.getMatch(e.Name),!oe.name)return M.fatalError("doctype name missing or contains unexpected characters at position "+_.getIndex());if(V&&oe.name.toLowerCase()!=="html"&&M.warning("Unexpected DOCTYPE in HTML document at position "+_.getIndex()),_.skipBlanks(),_.substringStartsWith(e.PUBLIC)||_.substringStartsWith(e.SYSTEM)){var G=e.ExternalID_match.exec(_.substringFromIndex());if(!G)return M.fatalError("doctype external id is not well-formed at position "+_.getIndex());G.groups.SystemLiteralOnly!==void 0?oe.systemId=G.groups.SystemLiteralOnly:(oe.systemId=G.groups.SystemLiteral,oe.publicId=G.groups.PubidLiteral),_.skip(G[0].length)}else if(V&&_.substringStartsWithCaseInsensitive(e.SYSTEM)){if(_.skip(e.SYSTEM.length),_.skipBlanks()<1)return M.fatalError("Expected whitespace after "+e.SYSTEM+" at position "+_.getIndex());if(oe.systemId=_.getMatch(e.ABOUT_LEGACY_COMPAT_SystemLiteral),!oe.systemId)return M.fatalError("Expected "+e.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+e.SYSTEM+" at position "+_.getIndex())}return V&&oe.systemId&&!e.ABOUT_LEGACY_COMPAT_SystemLiteral.test(oe.systemId)&&M.warning("Unexpected doctype.systemId in HTML document at position "+_.getIndex()),V||(_.skipBlanks(),oe.internalSubset=ge(_,M)),_.skipBlanks(),_.char()!==">"?M.fatalError("doctype not terminated with > at position "+_.getIndex()):(_.skip(1),Y.startDTD(oe.name,oe.publicId,oe.systemId,oe.internalSubset),Y.endDTD(),_.getIndex())}default:return M.fatalError('Not well-formed XML starting with "<!" at position '+F)}}function k(B,F,Y,M){var V=B.substring(F).match(e.PI);if(!V)return M.fatalError("Invalid processing instruction starting at position "+F);if(V[1].toLowerCase()==="xml"){if(F>0)return M.fatalError("processing instruction at position "+F+" is an xml declaration which is only at the start of the document");if(!e.XMLDecl.test(B.substring(F)))return M.fatalError("xml declaration is not well-formed")}return Y.processingInstruction(V[1],V[2]),F+V[0].length}function de(){this.attributeNames=Object.create(null)}return de.prototype={setTagName:function(B){if(!e.QName_exact.test(B))throw new Error("invalid tagName:"+B);this.tagName=B},addValue:function(B,F,Y){if(!e.QName_exact.test(B))throw new Error("invalid attribute:"+B);this.attributeNames[B]=this.length,this[this.length++]={qName:B,value:F,offset:Y}},length:0,getLocalName:function(B){return this[B].localName},getLocator:function(B){return this[B].locator},getQName:function(B){return this[B].qName},getURI:function(B){return this[B].uri},getValue:function(B){return this[B].value}},Kr.XMLReader=K,Kr.parseUtils=Q,Kr.parseDoctypeCommentOrCData=Ie,Kr}var Vs;function fl(){if(Vs)return lr;Vs=1;var n=Tr(),e=Fs(),r=Bn(),i=ll(),o=cl(),u=e.DOMImplementation,l=n.hasDefaultHTMLNamespace,f=n.isHTMLMimeType,p=n.isValidMimeType,g=n.MIME_TYPE,N=n.NAMESPACE,E=r.ParseError,S=o.XMLReader;function C(D){return D.replace(/\r[\n\u0085]/g,`
7
+ `).replace(/[\r\u0085\u2028\u2029]/g,`
8
+ `)}function I(D){if(D=D||{},D.locator===void 0&&(D.locator=!0),this.assign=D.assign||n.assign,this.domHandler=D.domHandler||H,this.onError=D.onError||D.errorHandler,D.errorHandler&&typeof D.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");D.errorHandler&&D.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=D.normalizeLineEndings||C,this.locator=!!D.locator,this.xmlns=this.assign(Object.create(null),D.xmlns)}I.prototype.parseFromString=function(D,A){if(!p(A))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+A+'" is not valid.');var q=this.assign(Object.create(null),this.xmlns),re=i.XML_ENTITIES,Q=q[""]||null;l(A)?(re=i.HTML_ENTITIES,Q=N.HTML):A===g.XML_SVG_IMAGE&&(Q=N.SVG),q[""]=Q,q.xml=q.xml||N.XML;var ge=new this.domHandler({mimeType:A,defaultNamespace:Q,onError:this.onError}),Ie=this.locator?{}:void 0;this.locator&&ge.setDocumentLocator(Ie);var k=new S;k.errorHandler=ge,k.domBuilder=ge;var de=!n.isHTMLMimeType(A);return de&&typeof D!="string"&&k.errorHandler.fatalError("source is not a string"),k.parse(this.normalizeLineEndings(String(D)),q,re),ge.doc.documentElement||k.errorHandler.fatalError("missing root element"),ge.doc};function H(D){var A=D||{};this.mimeType=A.mimeType||g.XML_APPLICATION,this.defaultNamespace=A.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=A.onError}function U(D,A){A.lineNumber=D.lineNumber,A.columnNumber=D.columnNumber}H.prototype={startDocument:function(){var D=new u;this.doc=f(this.mimeType)?D.createHTMLDocument(!1):D.createDocument(this.defaultNamespace,"")},startElement:function(D,A,q,re){var Q=this.doc,ge=Q.createElementNS(D,q||A),Ie=re.length;Ae(this,ge),this.currentElement=ge,this.locator&&U(this.locator,ge);for(var k=0;k<Ie;k++){var D=re.getURI(k),de=re.getValue(k),q=re.getQName(k),B=Q.createAttributeNS(D,q);this.locator&&U(re.getLocator(k),B),B.value=B.nodeValue=de,ge.setAttributeNode(B)}},endElement:function(D,A,q){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(D,A){},endPrefixMapping:function(D){},processingInstruction:function(D,A){var q=this.doc.createProcessingInstruction(D,A);this.locator&&U(this.locator,q),Ae(this,q)},ignorableWhitespace:function(D,A,q){},characters:function(D,A,q){if(D=K.apply(this,arguments),D){if(this.cdata)var re=this.doc.createCDATASection(D);else var re=this.doc.createTextNode(D);this.currentElement?this.currentElement.appendChild(re):/^\s*$/.test(D)&&this.doc.appendChild(re),this.locator&&U(this.locator,re)}},skippedEntity:function(D){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(D){D&&(D.lineNumber=0),this.locator=D},comment:function(D,A,q){D=K.apply(this,arguments);var re=this.doc.createComment(D);this.locator&&U(this.locator,re),Ae(this,re)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(D,A,q,re){var Q=this.doc.implementation;if(Q&&Q.createDocumentType){var ge=Q.createDocumentType(D,A,q,re);this.locator&&U(this.locator,ge),Ae(this,ge),this.doc.doctype=ge}},reportError:function(D,A){if(typeof this.onError=="function")try{this.onError(D,A,this)}catch(q){throw new E("Reporting "+D+' "'+A+'" caused '+q,this.locator)}else console.error("[xmldom "+D+"] "+A,R(this.locator))},warning:function(D){this.reportError("warning",D)},error:function(D){this.reportError("error",D)},fatalError:function(D){throw this.reportError("fatalError",D),new E(D,this.locator)}};function R(D){if(D)return`
9
+ @#[line:`+D.lineNumber+",col:"+D.columnNumber+"]"}function K(D,A,q){return typeof D=="string"?D.substr(A,q):D.length>=A+q||A?new java.lang.String(D,A,q)+"":D}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(D){H.prototype[D]=function(){return null}});function Ae(D,A){D.currentElement?D.currentElement.appendChild(A):D.doc.appendChild(A)}function be(D){if(D==="error")throw"onErrorStopParsing"}function Ce(){throw"onWarningStopParsing"}return lr.__DOMHandler=H,lr.DOMParser=I,lr.normalizeLineEndings=C,lr.onErrorStopParsing=be,lr.onWarningStopParsing=Ce,lr}var Hs;function pl(){if(Hs)return De;Hs=1;var n=Tr();De.assign=n.assign,De.hasDefaultHTMLNamespace=n.hasDefaultHTMLNamespace,De.isHTMLMimeType=n.isHTMLMimeType,De.isValidMimeType=n.isValidMimeType,De.MIME_TYPE=n.MIME_TYPE,De.NAMESPACE=n.NAMESPACE;var e=Bn();De.DOMException=e.DOMException,De.DOMExceptionName=e.DOMExceptionName,De.ExceptionCode=e.ExceptionCode,De.ParseError=e.ParseError;var r=Fs();De.Attr=r.Attr,De.CDATASection=r.CDATASection,De.CharacterData=r.CharacterData,De.Comment=r.Comment,De.Document=r.Document,De.DocumentFragment=r.DocumentFragment,De.DocumentType=r.DocumentType,De.DOMImplementation=r.DOMImplementation,De.Element=r.Element,De.Entity=r.Entity,De.EntityReference=r.EntityReference,De.LiveNodeList=r.LiveNodeList,De.NamedNodeMap=r.NamedNodeMap,De.Node=r.Node,De.NodeList=r.NodeList,De.Notation=r.Notation,De.ProcessingInstruction=r.ProcessingInstruction,De.Text=r.Text,De.XMLSerializer=r.XMLSerializer;var i=fl();return De.DOMParser=i.DOMParser,De.normalizeLineEndings=i.normalizeLineEndings,De.onErrorStopParsing=i.onErrorStopParsing,De.onWarningStopParsing=i.onWarningStopParsing,De}var qs=pl(),Hi={},js;function hl(){return js||(js=1,(function(n){var e=n;(function(r){var i="__namespace",o=function(t){return t==null},u=function(t){return t===i||Number.isInteger(t)&&t>=1&&t<=11},l=function(t){return t&&u(t.nodeType)&&typeof t.nodeName=="string"};function f(t){var a=Array.prototype.slice,m=t.length,w=function(s,c){return function(){return c.apply(this,s.concat(a.call(arguments)))}},v=function(){var s=a.call(arguments);return s.length<m?w(s,v):t.apply(this,a.apply(arguments,[0,m]))};return v}var p=function(t,a){for(var m=0;m<a.length;m+=1)t(a[m],m,a)},g=function(t,a,m){var w=a;return p(function(v,s){w=t(w,v,s)},m),w},N=function(t,a){var m=new Array(a.length);return p(function(w,v){m[v]=t(w)},a),m},E=function(t,a){var m=[];return p(function(w,v){t(w,v)&&m.push(w)},a),m},S=function(t,a){for(var m=0;m<t.length;m+=1)if(t[m]===a)return!0;return!1};function C(t){return function(){return t}}function I(t){return t.toString()}var H=function(t,a){return a.join(t)},U=function(t,a,m){return t+m+a},R=Array.prototype.concat,K=function(t,a){var m=new W;m.addArray(t);var w=m.toArray();return a?w.reverse():w},Ae=32767;function be(t){for(var a=[],m=0;m<t.length;m+=Ae){var w=t.slice(m,m+Ae);a=R.apply(a,w)}return a}function Ce(t,a){for(var m=Object(t),w=1;w<arguments.length;w++){var v=arguments[w];if(v!=null)for(var s in v)Object.prototype.hasOwnProperty.call(v,s)&&(m[s]=v[s])}return m}var D={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NAMESPACE_NODE:i};A.prototype=new Object,A.prototype.constructor=A,A.superclass=Object.prototype;function A(){this.init()}A.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(t){return new de(t[0],t[2])},this.reduceActions[5]=function(t){return new B(t[0],t[2])},this.reduceActions[7]=function(t){return new F(t[0],t[2])},this.reduceActions[8]=function(t){return new Y(t[0],t[2])},this.reduceActions[10]=function(t){return new M(t[0],t[2])},this.reduceActions[11]=function(t){return new V(t[0],t[2])},this.reduceActions[12]=function(t){return new _(t[0],t[2])},this.reduceActions[13]=function(t){return new z(t[0],t[2])},this.reduceActions[15]=function(t){return new fe(t[0],t[2])},this.reduceActions[16]=function(t){return new oe(t[0],t[2])},this.reduceActions[18]=function(t){return new G(t[0],t[2])},this.reduceActions[19]=function(t){return new J(t[0],t[2])},this.reduceActions[20]=function(t){return new ue(t[0],t[2])},this.reduceActions[22]=function(t){return new Ie(t[1])},this.reduceActions[24]=function(t){return new pe(t[0],t[2])},this.reduceActions[25]=function(t){return new le(void 0,void 0,t[0])},this.reduceActions[27]=function(t){return t[0].locationPath=t[2],t[0]},this.reduceActions[28]=function(t){return t[0].locationPath=t[2],t[0].locationPath.steps.unshift(new L(L.DESCENDANTORSELF,$.nodeTest,[])),t[0]},this.reduceActions[29]=function(t){return new le(t[0],[],void 0)},this.reduceActions[30]=function(t){return ee.instance_of(t[0],le)?(t[0].filterPredicates==null&&(t[0].filterPredicates=[]),t[0].filterPredicates.push(t[1]),t[0]):new le(t[0],[t[1]],void 0)},this.reduceActions[32]=function(t){return t[1]},this.reduceActions[33]=function(t){return new ne(t[0])},this.reduceActions[34]=function(t){return new Z(t[0])},this.reduceActions[36]=function(t){return new tt(t[0],[])},this.reduceActions[37]=function(t){return new tt(t[0],t[2])},this.reduceActions[38]=function(t){return[t[0]]},this.reduceActions[39]=function(t){return t[2].unshift(t[0]),t[2]},this.reduceActions[43]=function(t){return new et(!0,[])},this.reduceActions[44]=function(t){return t[1].absolute=!0,t[1]},this.reduceActions[46]=function(t){return new et(!1,[t[0]])},this.reduceActions[47]=function(t){return t[0].steps.push(t[2]),t[0]},this.reduceActions[49]=function(t){return new L(t[0],t[1],[])},this.reduceActions[50]=function(t){return new L(L.CHILD,t[0],[])},this.reduceActions[51]=function(t){return new L(t[0],t[1],t[2])},this.reduceActions[52]=function(t){return new L(L.CHILD,t[0],t[1])},this.reduceActions[54]=function(t){return[t[0]]},this.reduceActions[55]=function(t){return t[1].unshift(t[0]),t[1]},this.reduceActions[56]=function(t){return t[0]=="ancestor"?L.ANCESTOR:t[0]=="ancestor-or-self"?L.ANCESTORORSELF:t[0]=="attribute"?L.ATTRIBUTE:t[0]=="child"?L.CHILD:t[0]=="descendant"?L.DESCENDANT:t[0]=="descendant-or-self"?L.DESCENDANTORSELF:t[0]=="following"?L.FOLLOWING:t[0]=="following-sibling"?L.FOLLOWINGSIBLING:t[0]=="namespace"?L.NAMESPACE:t[0]=="parent"?L.PARENT:t[0]=="preceding"?L.PRECEDING:t[0]=="preceding-sibling"?L.PRECEDINGSIBLING:t[0]=="self"?L.SELF:-1},this.reduceActions[57]=function(t){return L.ATTRIBUTE},this.reduceActions[59]=function(t){return t[0]=="comment"?$.commentTest:t[0]=="text"?$.textTest:t[0]=="processing-instruction"?$.anyPiTest:t[0]=="node"?$.nodeTest:new $(-1,void 0)},this.reduceActions[60]=function(t){return new $.PITest(t[2])},this.reduceActions[61]=function(t){return t[1]},this.reduceActions[63]=function(t){return t[1].absolute=!0,t[1].steps.unshift(new L(L.DESCENDANTORSELF,$.nodeTest,[])),t[1]},this.reduceActions[64]=function(t){return t[0].steps.push(new L(L.DESCENDANTORSELF,$.nodeTest,[])),t[0].steps.push(t[2]),t[0]},this.reduceActions[65]=function(t){return new L(L.SELF,$.nodeTest,[])},this.reduceActions[66]=function(t){return new L(L.PARENT,$.nodeTest,[])},this.reduceActions[67]=function(t){return new Ge(t[1])},this.reduceActions[68]=function(t){return $.nameTestAny},this.reduceActions[69]=function(t){return new $.NameTestPrefixAny(t[0].split(":")[0])},this.reduceActions[70]=function(t){return new $.NameTestQName(t[0])}},A.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],A.actionTableNumber=[` 1 0 /.-,+*)(' & %$ # "!`," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY ",` 1 0 /.-,+*)(' & %$ # "!`,`K1 KKKKKKKK . +*)('KKKKKK KK# K" `,` 1 0 /.-,+*)(' & %$ # "!`," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q ",` 1 . +*)(' # " `,"b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX ",` 1 0 /.-,+*)(' & %$m # "!`,"_ f________ ______e __ _ ",` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 . +*)(' # " `,` 1 . +*)(' # " `,"> >>>>>>>>> >>>>>>> >> >> ",` 1 . +*)(' # " `,` 1 . +*)(' # " `,"Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," \x87 ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," \x88 "," F\x89 ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," \x8A ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE ",` 1 0 /.-,+*)(' & %$ # "!`,"] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],A.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," \x7F=>?@ AB CDEFGH IJ ","\x80456789:;<=>?@ AB CDEFGH IJ\x81"," \x82 EFGH IJ "," \x83 EFGH IJ "," "," \x84 GH IJ "," \x85 GH IJ "," i \x86 "," i \x87 "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ AB\x8CqCDEFGH IJ "," "," "],A.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],A.DOUBLEDOT=2,A.DOUBLECOLON=3,A.DOUBLESLASH=4,A.NOTEQUAL=5,A.LESSTHANOREQUAL=6,A.GREATERTHANOREQUAL=7,A.AND=8,A.OR=9,A.MOD=10,A.DIV=11,A.MULTIPLYOPERATOR=12,A.FUNCTIONNAME=13,A.AXISNAME=14,A.LITERAL=15,A.NUMBER=16,A.ASTERISKNAMETEST=17,A.QNAME=18,A.NCNAMECOLONASTERISK=19,A.NODETYPE=20,A.PROCESSINGINSTRUCTIONWITHLITERAL=21,A.EQUALS=22,A.LESSTHAN=23,A.GREATERTHAN=24,A.PLUS=25,A.MINUS=26,A.BAR=27,A.SLASH=28,A.LEFTPARENTHESIS=29,A.RIGHTPARENTHESIS=30,A.COMMA=31,A.AT=32,A.LEFTBRACKET=33,A.RIGHTBRACKET=34,A.DOT=35,A.DOLLAR=36,A.prototype.tokenize=function(t){for(var a=[],m=[],w=t+"\0",v=0,s=w.charAt(v++);;){for(;s==" "||s==" "||s=="\r"||s==`
10
+ `;)s=w.charAt(v++);if(s=="\0"||v>=w.length)break;if(s=="("){a.push(A.LEFTPARENTHESIS),m.push(s),s=w.charAt(v++);continue}if(s==")"){a.push(A.RIGHTPARENTHESIS),m.push(s),s=w.charAt(v++);continue}if(s=="["){a.push(A.LEFTBRACKET),m.push(s),s=w.charAt(v++);continue}if(s=="]"){a.push(A.RIGHTBRACKET),m.push(s),s=w.charAt(v++);continue}if(s=="@"){a.push(A.AT),m.push(s),s=w.charAt(v++);continue}if(s==","){a.push(A.COMMA),m.push(s),s=w.charAt(v++);continue}if(s=="|"){a.push(A.BAR),m.push(s),s=w.charAt(v++);continue}if(s=="+"){a.push(A.PLUS),m.push(s),s=w.charAt(v++);continue}if(s=="-"){a.push(A.MINUS),m.push(s),s=w.charAt(v++);continue}if(s=="="){a.push(A.EQUALS),m.push(s),s=w.charAt(v++);continue}if(s=="$"){a.push(A.DOLLAR),m.push(s),s=w.charAt(v++);continue}if(s=="."){if(s=w.charAt(v++),s=="."){a.push(A.DOUBLEDOT),m.push(".."),s=w.charAt(v++);continue}if(s>="0"&&s<="9"){var c="."+s;for(s=w.charAt(v++);s>="0"&&s<="9";)c+=s,s=w.charAt(v++);a.push(A.NUMBER),m.push(c);continue}a.push(A.DOT),m.push(".");continue}if(s=="'"||s=='"'){for(var y=s,b="";v<w.length&&(s=w.charAt(v))!==y;)b+=s,v+=1;if(s!==y)throw lt.fromMessage("Unterminated string literal: "+y+b);v+=1,a.push(A.LITERAL),m.push(b),s=w.charAt(v++);continue}if(s>="0"&&s<="9"){var c=s;for(s=w.charAt(v++);s>="0"&&s<="9";)c+=s,s=w.charAt(v++);if(s=="."&&w.charAt(v)>="0"&&w.charAt(v)<="9")for(c+=s,c+=w.charAt(v++),s=w.charAt(v++);s>="0"&&s<="9";)c+=s,s=w.charAt(v++);a.push(A.NUMBER),m.push(c);continue}if(s=="*"){if(a.length>0){var x=a[a.length-1];if(x!=A.AT&&x!=A.DOUBLECOLON&&x!=A.LEFTPARENTHESIS&&x!=A.LEFTBRACKET&&x!=A.AND&&x!=A.OR&&x!=A.MOD&&x!=A.DIV&&x!=A.MULTIPLYOPERATOR&&x!=A.SLASH&&x!=A.DOUBLESLASH&&x!=A.BAR&&x!=A.PLUS&&x!=A.MINUS&&x!=A.EQUALS&&x!=A.NOTEQUAL&&x!=A.LESSTHAN&&x!=A.LESSTHANOREQUAL&&x!=A.GREATERTHAN&&x!=A.GREATERTHANOREQUAL){a.push(A.MULTIPLYOPERATOR),m.push(s),s=w.charAt(v++);continue}}a.push(A.ASTERISKNAMETEST),m.push(s),s=w.charAt(v++);continue}if(s==":"&&w.charAt(v)==":"){a.push(A.DOUBLECOLON),m.push("::"),v++,s=w.charAt(v++);continue}if(s=="/"){if(s=w.charAt(v++),s=="/"){a.push(A.DOUBLESLASH),m.push("//"),s=w.charAt(v++);continue}a.push(A.SLASH),m.push("/");continue}if(s=="!"&&w.charAt(v)=="="){a.push(A.NOTEQUAL),m.push("!="),v++,s=w.charAt(v++);continue}if(s=="<"){if(w.charAt(v)=="="){a.push(A.LESSTHANOREQUAL),m.push("<="),v++,s=w.charAt(v++);continue}a.push(A.LESSTHAN),m.push("<"),s=w.charAt(v++);continue}if(s==">"){if(w.charAt(v)=="="){a.push(A.GREATERTHANOREQUAL),m.push(">="),v++,s=w.charAt(v++);continue}a.push(A.GREATERTHAN),m.push(">"),s=w.charAt(v++);continue}if(s=="_"||ee.isLetter(s.charCodeAt(0))){var O=s;for(s=w.charAt(v++);ee.isNCNameChar(s.charCodeAt(0));)O+=s,s=w.charAt(v++);if(a.length>0){var x=a[a.length-1];if(x!=A.AT&&x!=A.DOUBLECOLON&&x!=A.LEFTPARENTHESIS&&x!=A.LEFTBRACKET&&x!=A.AND&&x!=A.OR&&x!=A.MOD&&x!=A.DIV&&x!=A.MULTIPLYOPERATOR&&x!=A.SLASH&&x!=A.DOUBLESLASH&&x!=A.BAR&&x!=A.PLUS&&x!=A.MINUS&&x!=A.EQUALS&&x!=A.NOTEQUAL&&x!=A.LESSTHAN&&x!=A.LESSTHANOREQUAL&&x!=A.GREATERTHAN&&x!=A.GREATERTHANOREQUAL){if(O=="and"){a.push(A.AND),m.push(O);continue}if(O=="or"){a.push(A.OR),m.push(O);continue}if(O=="mod"){a.push(A.MOD),m.push(O);continue}if(O=="div"){a.push(A.DIV),m.push(O);continue}}}if(s==":"){if(w.charAt(v)=="*"){a.push(A.NCNAMECOLONASTERISK),m.push(O+":*"),v++,s=w.charAt(v++);continue}if(w.charAt(v)=="_"||ee.isLetter(w.charCodeAt(v))){for(O+=":",s=w.charAt(v++);ee.isNCNameChar(s.charCodeAt(0));)O+=s,s=w.charAt(v++);if(s=="("){a.push(A.FUNCTIONNAME),m.push(O);continue}a.push(A.QNAME),m.push(O);continue}if(w.charAt(v)==":"){a.push(A.AXISNAME),m.push(O);continue}}if(s=="("){if(O=="comment"||O=="text"||O=="node"){a.push(A.NODETYPE),m.push(O);continue}if(O=="processing-instruction"){w.charAt(v)==")"?a.push(A.NODETYPE):a.push(A.PROCESSINGINSTRUCTIONWITHLITERAL),m.push(O);continue}a.push(A.FUNCTIONNAME),m.push(O);continue}a.push(A.QNAME),m.push(O);continue}throw new Error("Unexpected character "+s)}return a.push(1),m.push("[EOF]"),[a,m]},A.SHIFT="s",A.REDUCE="r",A.ACCEPT="a",A.prototype.parse=function(b){if(!b)throw new Error("XPath expression unspecified.");if(typeof b!="string")throw new Error("XPath expression must be a string.");var a,m,w=this.tokenize(b);if(w!=null){a=w[0],m=w[1];var v=0,s=[],c=[],y=[],b,x,O;for(s.push(0),c.push(1),y.push("_S"),x=a[v],O=m[v++];;)switch(b=s[s.length-1],A.actionTable[b].charAt(x-1)){case A.SHIFT:c.push(-x),y.push(O),s.push(A.actionTableNumber[b].charCodeAt(x-1)-32),x=a[v],O=m[v++];break;case A.REDUCE:for(var me=A.productions[A.actionTableNumber[b].charCodeAt(x-1)-32][1],Me=[],je=0;je<me;je++)c.pop(),Me.unshift(y.pop()),s.pop();var Je=s[s.length-1];c.push(A.productions[A.actionTableNumber[b].charCodeAt(x-1)-32][0]),this.reduceActions[A.actionTableNumber[b].charCodeAt(x-1)-32]==null?y.push(Me[0]):y.push(this.reduceActions[A.actionTableNumber[b].charCodeAt(x-1)-32](Me)),s.push(A.gotoTable[Je].charCodeAt(A.productions[A.actionTableNumber[b].charCodeAt(x-1)-32][0]-2)-33);break;case A.ACCEPT:return new q(y.pop());default:throw new Error("XPath parse error")}}},q.prototype=new Object,q.prototype.constructor=q,q.superclass=Object.prototype;function q(t){this.expression=t}q.prototype.toString=function(){return this.expression.toString()};function re(t,a,m){a in t||(t[a]=m)}q.prototype.evaluate=function(t){var a=t.expressionContextNode;if(!(o(a)||l(a)))throw new Error("Context node does not appear to be a valid DOM node.");return t.contextNode=t.expressionContextNode,t.contextSize=1,t.contextPosition=1,t.isHtml&&(re(t,"caseInsensitive",!0),re(t,"allowAnyNamespaceForNoPrefix",!0)),re(t,"caseInsensitive",!1),this.expression.evaluate(t)},q.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",q.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",Q.prototype=new Object,Q.prototype.constructor=Q,Q.superclass=Object.prototype;function Q(){}Q.prototype.init=function(){},Q.prototype.toString=function(){return"<Expression>"},Q.prototype.evaluate=function(t){throw new Error("Could not evaluate expression.")},ge.prototype=new Q,ge.prototype.constructor=ge,ge.superclass=Q.prototype;function ge(t){arguments.length>0&&this.init(t)}ge.prototype.init=function(t){this.rhs=t},Ie.prototype=new ge,Ie.prototype.constructor=Ie,Ie.superclass=ge.prototype;function Ie(t){arguments.length>0&&this.init(t)}Ie.prototype.init=function(t){Ie.superclass.init.call(this,t)},Ie.prototype.evaluate=function(t){return this.rhs.evaluate(t).number().negate()},Ie.prototype.toString=function(){return"-"+this.rhs.toString()},k.prototype=new Q,k.prototype.constructor=k,k.superclass=Q.prototype;function k(t,a){arguments.length>0&&this.init(t,a)}k.prototype.init=function(t,a){this.lhs=t,this.rhs=a},de.prototype=new k,de.prototype.constructor=de,de.superclass=k.prototype;function de(t,a){arguments.length>0&&this.init(t,a)}de.prototype.init=function(t,a){de.superclass.init.call(this,t,a)},de.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},de.prototype.evaluate=function(t){var a=this.lhs.evaluate(t).bool();return a.booleanValue()?a:this.rhs.evaluate(t).bool()},B.prototype=new k,B.prototype.constructor=B,B.superclass=k.prototype;function B(t,a){arguments.length>0&&this.init(t,a)}B.prototype.init=function(t,a){B.superclass.init.call(this,t,a)},B.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},B.prototype.evaluate=function(t){var a=this.lhs.evaluate(t).bool();return a.booleanValue()?this.rhs.evaluate(t).bool():a},F.prototype=new k,F.prototype.constructor=F,F.superclass=k.prototype;function F(t,a){arguments.length>0&&this.init(t,a)}F.prototype.init=function(t,a){F.superclass.init.call(this,t,a)},F.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},F.prototype.evaluate=function(t){return this.lhs.evaluate(t).equals(this.rhs.evaluate(t))},Y.prototype=new k,Y.prototype.constructor=Y,Y.superclass=k.prototype;function Y(t,a){arguments.length>0&&this.init(t,a)}Y.prototype.init=function(t,a){Y.superclass.init.call(this,t,a)},Y.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},Y.prototype.evaluate=function(t){return this.lhs.evaluate(t).notequal(this.rhs.evaluate(t))},M.prototype=new k,M.prototype.constructor=M,M.superclass=k.prototype;function M(t,a){arguments.length>0&&this.init(t,a)}M.prototype.init=function(t,a){M.superclass.init.call(this,t,a)},M.prototype.evaluate=function(t){return this.lhs.evaluate(t).lessthan(this.rhs.evaluate(t))},M.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},V.prototype=new k,V.prototype.constructor=V,V.superclass=k.prototype;function V(t,a){arguments.length>0&&this.init(t,a)}V.prototype.init=function(t,a){V.superclass.init.call(this,t,a)},V.prototype.evaluate=function(t){return this.lhs.evaluate(t).greaterthan(this.rhs.evaluate(t))},V.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},_.prototype=new k,_.prototype.constructor=_,_.superclass=k.prototype;function _(t,a){arguments.length>0&&this.init(t,a)}_.prototype.init=function(t,a){_.superclass.init.call(this,t,a)},_.prototype.evaluate=function(t){return this.lhs.evaluate(t).lessthanorequal(this.rhs.evaluate(t))},_.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},z.prototype=new k,z.prototype.constructor=z,z.superclass=k.prototype;function z(t,a){arguments.length>0&&this.init(t,a)}z.prototype.init=function(t,a){z.superclass.init.call(this,t,a)},z.prototype.evaluate=function(t){return this.lhs.evaluate(t).greaterthanorequal(this.rhs.evaluate(t))},z.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},fe.prototype=new k,fe.prototype.constructor=fe,fe.superclass=k.prototype;function fe(t,a){arguments.length>0&&this.init(t,a)}fe.prototype.init=function(t,a){fe.superclass.init.call(this,t,a)},fe.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().plus(this.rhs.evaluate(t).number())},fe.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},oe.prototype=new k,oe.prototype.constructor=oe,oe.superclass=k.prototype;function oe(t,a){arguments.length>0&&this.init(t,a)}oe.prototype.init=function(t,a){oe.superclass.init.call(this,t,a)},oe.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().minus(this.rhs.evaluate(t).number())},oe.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},G.prototype=new k,G.prototype.constructor=G,G.superclass=k.prototype;function G(t,a){arguments.length>0&&this.init(t,a)}G.prototype.init=function(t,a){G.superclass.init.call(this,t,a)},G.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().multiply(this.rhs.evaluate(t).number())},G.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},J.prototype=new k,J.prototype.constructor=J,J.superclass=k.prototype;function J(t,a){arguments.length>0&&this.init(t,a)}J.prototype.init=function(t,a){J.superclass.init.call(this,t,a)},J.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().div(this.rhs.evaluate(t).number())},J.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},ue.prototype=new k,ue.prototype.constructor=ue,ue.superclass=k.prototype;function ue(t,a){arguments.length>0&&this.init(t,a)}ue.prototype.init=function(t,a){ue.superclass.init.call(this,t,a)},ue.prototype.evaluate=function(t){return this.lhs.evaluate(t).number().mod(this.rhs.evaluate(t).number())},ue.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},pe.prototype=new k,pe.prototype.constructor=pe,pe.superclass=k.prototype;function pe(t,a){arguments.length>0&&this.init(t,a)}pe.prototype.init=function(t,a){pe.superclass.init.call(this,t,a)},pe.prototype.evaluate=function(t){return this.lhs.evaluate(t).nodeset().union(this.rhs.evaluate(t).nodeset())},pe.prototype.toString=function(){return N(I,[this.lhs,this.rhs]).join(" | ")},le.prototype=new Q,le.prototype.constructor=le,le.superclass=Q.prototype;function le(t,a,m){arguments.length>0&&this.init(t,a,m)}le.prototype.init=function(t,a,m){le.superclass.init.call(this),this.filter=t,this.filterPredicates=a,this.locationPath=m};function Et(t){for(;t&&t.parentNode;)t=t.parentNode;return t}var at=function(t,a,m,w){if(t.length===0)return m;var v=a.extend({});return g(function(s,c){return v.contextSize=s.length,E(function(y,b){return v.contextNode=y,v.contextPosition=b+1,le.predicateMatches(c,v)},s)},K(m,w),t)};le.getRoot=function(t,a){var m=a[0];if(m&&m.nodeType===D.DOCUMENT_NODE)return m;if(t.virtualRoot)return t.virtualRoot;if(!m)throw new Error("Context node not found when determining document root.");var w=m.ownerDocument;if(w)return w;for(var v=m;v.parentNode!=null;)v=v.parentNode;return v};var Ze=function(t){var a=String(t.name);return a==="xmlns"?"":a.substring(0,6)==="xmlns:"?a.substring(6,a.length):null};le.applyStep=function(t,a,m){if(!m)throw new Error("Context node not found when evaluating XPath step: "+t);var w=[];switch(a.contextNode=m,t.axis){case L.ANCESTOR:if(a.contextNode===a.virtualRoot)break;var v;for(a.contextNode.nodeType==D.ATTRIBUTE_NODE?v=le.getOwnerElement(a.contextNode):v=a.contextNode.parentNode;v!=null&&(t.nodeTest.matches(v,a)&&w.push(v),v!==a.virtualRoot);)v=v.parentNode;break;case L.ANCESTORORSELF:for(var v=a.contextNode;v!=null&&(t.nodeTest.matches(v,a)&&w.push(v),v!==a.virtualRoot);v=v.nodeType==D.ATTRIBUTE_NODE?le.getOwnerElement(v):v.parentNode);break;case L.ATTRIBUTE:var s=a.contextNode.attributes;if(s!=null)for(var c=0;c<s.length;c++){var v=s.item(c);t.nodeTest.matches(v,a)&&w.push(v)}break;case L.CHILD:for(var v=a.contextNode.firstChild;v!=null;v=v.nextSibling)t.nodeTest.matches(v,a)&&w.push(v);break;case L.DESCENDANT:for(var O=[a.contextNode.firstChild];O.length>0;)for(var v=O.pop();v!=null;)t.nodeTest.matches(v,a)&&w.push(v),v.firstChild!=null?(O.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case L.DESCENDANTORSELF:t.nodeTest.matches(a.contextNode,a)&&w.push(a.contextNode);for(var O=[a.contextNode.firstChild];O.length>0;)for(var v=O.pop();v!=null;)t.nodeTest.matches(v,a)&&w.push(v),v.firstChild!=null?(O.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case L.FOLLOWING:if(a.contextNode===a.virtualRoot)break;var O=[];a.contextNode.firstChild!=null?O.unshift(a.contextNode.firstChild):O.unshift(a.contextNode.nextSibling);for(var v=a.contextNode.parentNode;v!=null&&v.nodeType!=D.DOCUMENT_NODE&&v!==a.virtualRoot;v=v.parentNode)O.unshift(v.nextSibling);do for(var v=O.pop();v!=null;)t.nodeTest.matches(v,a)&&w.push(v),v.firstChild!=null?(O.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;while(O.length>0);break;case L.FOLLOWINGSIBLING:if(a.contextNode===a.virtualRoot)break;for(var v=a.contextNode.nextSibling;v!=null;v=v.nextSibling)t.nodeTest.matches(v,a)&&w.push(v);break;case L.NAMESPACE:var y={};if(a.contextNode.nodeType==D.ELEMENT_NODE){y.xml=new gt("xml",null,q.XML_NAMESPACE_URI,a.contextNode);for(var v=a.contextNode;v!=null&&v.nodeType==D.ELEMENT_NODE;v=v.parentNode)for(var c=0;c<v.attributes.length;c++){var b=v.attributes.item(c),x=Ze(b);x!=null&&y[x]==null&&(y[x]=new gt(x,b,b.value,a.contextNode))}for(var x in y){var m=y[x];t.nodeTest.matches(m,a)&&w.push(m)}}break;case L.PARENT:v=null,a.contextNode!==a.virtualRoot&&(a.contextNode.nodeType==D.ATTRIBUTE_NODE?v=le.getOwnerElement(a.contextNode):v=a.contextNode.parentNode),v!=null&&t.nodeTest.matches(v,a)&&w.push(v);break;case L.PRECEDING:var O;a.virtualRoot!=null?O=[a.virtualRoot]:O=[Et(a.contextNode)];e:for(;O.length>0;)for(var v=O.pop();v!=null;){if(v==a.contextNode)break e;t.nodeTest.matches(v,a)&&w.unshift(v),v.firstChild!=null?(O.push(v.nextSibling),v=v.firstChild):v=v.nextSibling}break;case L.PRECEDINGSIBLING:if(a.contextNode===a.virtualRoot)break;for(var v=a.contextNode.previousSibling;v!=null;v=v.previousSibling)t.nodeTest.matches(v,a)&&w.push(v);break;case L.SELF:t.nodeTest.matches(a.contextNode,a)&&w.push(a.contextNode);break}return w};function ae(t,a,m){return at(t.predicates,a,le.applyStep(t,a,m),S(Xt,t.axis))}function Gt(t,a,m){return be(N(ae.bind(null,m,t),a))}le.applySteps=function(t,a,m){return g(Gt.bind(null,a),m,t)},le.prototype.applyFilter=function(t,a){if(!this.filter)return{nodes:[t.contextNode]};var m=this.filter.evaluate(t);if(!ee.instance_of(m,W)){if(this.filterPredicates!=null&&this.filterPredicates.length>0||this.locationPath!=null)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:m}}return{nodes:at(this.filterPredicates||[],a,m.toUnsortedArray(),!1)}},le.applyLocationPath=function(t,a,m){if(!t)return m;var w=t.absolute?[le.getRoot(a,m)]:m;return le.applySteps(t.steps,a,w)},le.prototype.evaluate=function(t){var a=Ce(new ce,t),m=this.applyFilter(t,a);if("nonNodes"in m)return m.nonNodes;var w=new W;return w.addArray(le.applyLocationPath(this.locationPath,a,m.nodes)),w},le.predicateMatches=function(t,a){var m=t.evaluate(a);return ee.instance_of(m,Z)?a.contextPosition===m.numberValue():m.booleanValue()},le.predicateString=function(t){return U("[","]",t.toString())},le.predicatesString=function(t){return H("",N(le.predicateString,t))},le.prototype.toString=function(){if(this.filter!=null){var t=I(this.filter);return ee.instance_of(this.filter,ne)?U("'","'",t):this.filterPredicates!=null&&this.filterPredicates.length?U("(",")",t)+le.predicatesString(this.filterPredicates):this.locationPath!=null?t+(this.locationPath.absolute?"":"/")+I(this.locationPath):t}return I(this.locationPath)},le.getOwnerElement=function(t){if(t.ownerElement)return t.ownerElement;try{if(t.selectSingleNode)return t.selectSingleNode("..")}catch(b){}for(var a=t.nodeType==D.DOCUMENT_NODE?t:t.ownerDocument,m=a.getElementsByTagName("*"),w=0;w<m.length;w++)for(var v=m.item(w),s=v.attributes,c=0;c<s.length;c++){var y=s.item(c);if(y===t)return v}return null},et.prototype=new Object,et.prototype.constructor=et,et.superclass=Object.prototype;function et(t,a){arguments.length>0&&this.init(t,a)}et.prototype.init=function(t,a){this.absolute=t,this.steps=a},et.prototype.toString=function(){return(this.absolute?"/":"")+N(I,this.steps).join("/")},L.prototype=new Object,L.prototype.constructor=L,L.superclass=Object.prototype;function L(t,a,m){arguments.length>0&&this.init(t,a,m)}L.prototype.init=function(t,a,m){this.axis=t,this.nodeTest=a,this.predicates=m},L.prototype.toString=function(){return L.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+le.predicatesString(this.predicates)},L.ANCESTOR=0,L.ANCESTORORSELF=1,L.ATTRIBUTE=2,L.CHILD=3,L.DESCENDANT=4,L.DESCENDANTORSELF=5,L.FOLLOWING=6,L.FOLLOWINGSIBLING=7,L.NAMESPACE=8,L.PARENT=9,L.PRECEDING=10,L.PRECEDINGSIBLING=11,L.SELF=12,L.STEPNAMES=g(function(t,a){return t[a[0]]=a[1],t},{},[[L.ANCESTOR,"ancestor"],[L.ANCESTORORSELF,"ancestor-or-self"],[L.ATTRIBUTE,"attribute"],[L.CHILD,"child"],[L.DESCENDANT,"descendant"],[L.DESCENDANTORSELF,"descendant-or-self"],[L.FOLLOWING,"following"],[L.FOLLOWINGSIBLING,"following-sibling"],[L.NAMESPACE,"namespace"],[L.PARENT,"parent"],[L.PRECEDING,"preceding"],[L.PRECEDINGSIBLING,"preceding-sibling"],[L.SELF,"self"]]);var Xt=[L.ANCESTOR,L.ANCESTORORSELF,L.PARENT,L.PRECEDING,L.PRECEDINGSIBLING];$.prototype=new Object,$.prototype.constructor=$,$.superclass=Object.prototype;function $(t,a){arguments.length>0&&this.init(t,a)}$.prototype.init=function(t,a){this.type=t,this.value=a},$.prototype.toString=function(){return"<unknown nodetest type>"},$.prototype.matches=function(t,a){console.warn("unknown node test type")},$.NAMETESTANY=0,$.NAMETESTPREFIXANY=1,$.NAMETESTQNAME=2,$.COMMENT=3,$.TEXT=4,$.PI=5,$.NODE=6,$.isNodeType=function(t){return function(a){return S(t,a.nodeType)}},$.makeNodeTestType=function(t,a,m){var w=m||function(){};return w.prototype=new $(t),w.prototype.constructor=w,Ce(w.prototype,a),w},$.makeNodeTypeTest=function(t,a,m){return new($.makeNodeTestType(t,{matches:$.isNodeType(a),toString:C(m)}))},$.hasPrefix=function(t){return t.prefix||(t.nodeName||t.tagName).indexOf(":")!==-1},$.isElementOrAttribute=$.isNodeType([1,2]),$.nameSpaceMatches=function(t,a,m){var w=m.namespaceURI||"";if(!t)return!w||a.allowAnyNamespaceForNoPrefix&&!$.hasPrefix(m);var v=a.namespaceResolver.getNamespace(t,a.expressionContextNode);if(v==null)throw new Error("Cannot resolve QName "+t);return v===w},$.localNameMatches=function(t,a,m){var w=m.localName||m.nodeName;return a.caseInsensitive?t.toLowerCase()===w.toLowerCase():t===w},$.NameTestPrefixAny=$.makeNodeTestType($.NAMETESTPREFIXANY,{matches:function(t,a){return $.isElementOrAttribute(t)&&$.nameSpaceMatches(this.prefix,a,t)},toString:function(){return this.prefix+":*"}},function(a){this.prefix=a}),$.NameTestQName=$.makeNodeTestType($.NAMETESTQNAME,{matches:function(t,a){return $.isNodeType([D.ELEMENT_NODE,D.ATTRIBUTE_NODE,D.NAMESPACE_NODE])(t)&&$.nameSpaceMatches(this.prefix,a,t)&&$.localNameMatches(this.localName,a,t)},toString:function(){return this.name}},function(a){var m=a.split(":");this.name=a,this.prefix=m.length>1?m[0]:null,this.localName=m[m.length>1?1:0]}),$.PITest=$.makeNodeTestType($.PI,{matches:function(t,a){return $.isNodeType([D.PROCESSING_INSTRUCTION_NODE])(t)&&(t.target||t.nodeName)===this.name},toString:function(){return U('processing-instruction("','")',this.name)}},function(t){this.name=t}),$.nameTestAny=$.makeNodeTypeTest($.NAMETESTANY,[D.ELEMENT_NODE,D.ATTRIBUTE_NODE,D.NAMESPACE_NODE],"*"),$.textTest=$.makeNodeTypeTest($.TEXT,[D.TEXT_NODE,D.CDATA_SECTION_NODE],"text()"),$.commentTest=$.makeNodeTypeTest($.COMMENT,[D.COMMENT_NODE],"comment()"),$.nodeTest=$.makeNodeTypeTest($.NODE,[D.ELEMENT_NODE,D.ATTRIBUTE_NODE,D.TEXT_NODE,D.CDATA_SECTION_NODE,D.PROCESSING_INSTRUCTION_NODE,D.COMMENT_NODE,D.DOCUMENT_NODE],"node()"),$.anyPiTest=$.makeNodeTypeTest($.PI,[D.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Ge.prototype=new Q,Ge.prototype.constructor=Ge,Ge.superclass=Q.prototype;function Ge(t){arguments.length>0&&this.init(t)}Ge.prototype.init=function(t){this.variable=t},Ge.prototype.toString=function(){return"$"+this.variable},Ge.prototype.evaluate=function(t){var a=ee.resolveQName(this.variable,t.namespaceResolver,t.contextNode,!1);if(a[0]==null)throw new Error("Cannot resolve QName "+fn);var m=t.variableResolver.getVariable(a[1],a[0]);if(!m)throw lt.fromMessage("Undeclared variable: "+this.toString());return m},tt.prototype=new Q,tt.prototype.constructor=tt,tt.superclass=Q.prototype;function tt(t,a){arguments.length>0&&this.init(t,a)}tt.prototype.init=function(t,a){this.functionName=t,this.arguments=a},tt.prototype.toString=function(){for(var t=this.functionName+"(",a=0;a<this.arguments.length;a++)a>0&&(t+=", "),t+=this.arguments[a].toString();return t+")"},tt.prototype.evaluate=function(t){var a=_e.getFunctionFromContext(this.functionName,t);if(!a)throw new Error("Unknown function "+this.functionName);var m=[t].concat(this.arguments);return a.apply(t.functionResolver.thisArg,m)};var Oe=new Object;Oe.equals=function(t,a){return t.equals(a)},Oe.notequal=function(t,a){return t.notequal(a)},Oe.lessthan=function(t,a){return t.lessthan(a)},Oe.greaterthan=function(t,a){return t.greaterthan(a)},Oe.lessthanorequal=function(t,a){return t.lessthanorequal(a)},Oe.greaterthanorequal=function(t,a){return t.greaterthanorequal(a)},ne.prototype=new Q,ne.prototype.constructor=ne,ne.superclass=Q.prototype;function ne(t){arguments.length>0&&this.init(t)}ne.prototype.init=function(t){this.str=String(t)},ne.prototype.toString=function(){return this.str},ne.prototype.evaluate=function(t){return this},ne.prototype.string=function(){return this},ne.prototype.number=function(){return new Z(this.str)},ne.prototype.bool=function(){return new X(this.str)},ne.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},ne.prototype.stringValue=function(){return this.str},ne.prototype.numberValue=function(){return this.number().numberValue()},ne.prototype.booleanValue=function(){return this.bool().booleanValue()},ne.prototype.equals=function(t){return ee.instance_of(t,X)?this.bool().equals(t):ee.instance_of(t,Z)?this.number().equals(t):ee.instance_of(t,W)?t.compareWithString(this,Oe.equals):new X(this.str==t.str)},ne.prototype.notequal=function(t){return ee.instance_of(t,X)?this.bool().notequal(t):ee.instance_of(t,Z)?this.number().notequal(t):ee.instance_of(t,W)?t.compareWithString(this,Oe.notequal):new X(this.str!=t.str)},ne.prototype.lessthan=function(t){return this.number().lessthan(t)},ne.prototype.greaterthan=function(t){return this.number().greaterthan(t)},ne.prototype.lessthanorequal=function(t){return this.number().lessthanorequal(t)},ne.prototype.greaterthanorequal=function(t){return this.number().greaterthanorequal(t)},Z.prototype=new Q,Z.prototype.constructor=Z,Z.superclass=Q.prototype;function Z(t){arguments.length>0&&this.init(t)}Z.prototype.init=function(t){this.num=typeof t=="string"?this.parse(t):Number(t)},Z.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,Z.prototype.parse=function(t){return this.numberFormat.test(t)?parseFloat(t):Number.NaN};function Re(t){for(var a=t.split("e-"),m=a[0].replace(".",""),w=Number(a[1]),v=0;v<w-1;v+=1)m="0"+m;return"0."+m}function Wt(t){for(var a=t.split("e"),m=a[0].replace(".",""),w=Number(a[1]),v=w+1-m.length,s=0;s<v;s+=1)m+="0";return m}Z.prototype.toString=function(){var t=this.num.toString();return t.indexOf("e-")!==-1?Re(t):t.indexOf("e")!==-1?Wt(t):t},Z.prototype.evaluate=function(t){return this},Z.prototype.string=function(){return new ne(this.toString())},Z.prototype.number=function(){return this},Z.prototype.bool=function(){return new X(this.num)},Z.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},Z.prototype.stringValue=function(){return this.string().stringValue()},Z.prototype.numberValue=function(){return this.num},Z.prototype.booleanValue=function(){return this.bool().booleanValue()},Z.prototype.negate=function(){return new Z(-this.num)},Z.prototype.equals=function(t){return ee.instance_of(t,X)?this.bool().equals(t):ee.instance_of(t,ne)?this.equals(t.number()):ee.instance_of(t,W)?t.compareWithNumber(this,Oe.equals):new X(this.num==t.num)},Z.prototype.notequal=function(t){return ee.instance_of(t,X)?this.bool().notequal(t):ee.instance_of(t,ne)?this.notequal(t.number()):ee.instance_of(t,W)?t.compareWithNumber(this,Oe.notequal):new X(this.num!=t.num)},Z.prototype.lessthan=function(t){return ee.instance_of(t,W)?t.compareWithNumber(this,Oe.greaterthan):ee.instance_of(t,X)||ee.instance_of(t,ne)?this.lessthan(t.number()):new X(this.num<t.num)},Z.prototype.greaterthan=function(t){return ee.instance_of(t,W)?t.compareWithNumber(this,Oe.lessthan):ee.instance_of(t,X)||ee.instance_of(t,ne)?this.greaterthan(t.number()):new X(this.num>t.num)},Z.prototype.lessthanorequal=function(t){return ee.instance_of(t,W)?t.compareWithNumber(this,Oe.greaterthanorequal):ee.instance_of(t,X)||ee.instance_of(t,ne)?this.lessthanorequal(t.number()):new X(this.num<=t.num)},Z.prototype.greaterthanorequal=function(t){return ee.instance_of(t,W)?t.compareWithNumber(this,Oe.lessthanorequal):ee.instance_of(t,X)||ee.instance_of(t,ne)?this.greaterthanorequal(t.number()):new X(this.num>=t.num)},Z.prototype.plus=function(t){return new Z(this.num+t.num)},Z.prototype.minus=function(t){return new Z(this.num-t.num)},Z.prototype.multiply=function(t){return new Z(this.num*t.num)},Z.prototype.div=function(t){return new Z(this.num/t.num)},Z.prototype.mod=function(t){return new Z(this.num%t.num)},X.prototype=new Q,X.prototype.constructor=X,X.superclass=Q.prototype;function X(t){arguments.length>0&&this.init(t)}X.prototype.init=function(t){this.b=!!t},X.prototype.toString=function(){return this.b.toString()},X.prototype.evaluate=function(t){return this},X.prototype.string=function(){return new ne(this.b)},X.prototype.number=function(){return new Z(this.b)},X.prototype.bool=function(){return this},X.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},X.prototype.stringValue=function(){return this.string().stringValue()},X.prototype.numberValue=function(){return this.number().numberValue()},X.prototype.booleanValue=function(){return this.b},X.prototype.not=function(){return new X(!this.b)},X.prototype.equals=function(t){return ee.instance_of(t,ne)||ee.instance_of(t,Z)?this.equals(t.bool()):ee.instance_of(t,W)?t.compareWithBoolean(this,Oe.equals):new X(this.b==t.b)},X.prototype.notequal=function(t){return ee.instance_of(t,ne)||ee.instance_of(t,Z)?this.notequal(t.bool()):ee.instance_of(t,W)?t.compareWithBoolean(this,Oe.notequal):new X(this.b!=t.b)},X.prototype.lessthan=function(t){return this.number().lessthan(t)},X.prototype.greaterthan=function(t){return this.number().greaterthan(t)},X.prototype.lessthanorequal=function(t){return this.number().lessthanorequal(t)},X.prototype.greaterthanorequal=function(t){return this.number().greaterthanorequal(t)},X.true_=new X(!0),X.false_=new X(!1),Xe.prototype=new Object,Xe.prototype.constructor=Xe,Xe.superclass=Object.prototype;function Xe(t){this.init(t)}Xe.prototype.init=function(t){this.left=null,this.right=null,this.node=t,this.depth=1},Xe.prototype.balance=function(){var t=this.left==null?0:this.left.depth,a=this.right==null?0:this.right.depth;if(t>a+1){var m=this.left.left==null?0:this.left.left.depth,w=this.left.right==null?0:this.left.right.depth;m<w&&this.left.rotateRR(),this.rotateLL()}else if(t+1<a){var v=this.right.right==null?0:this.right.right.depth,s=this.right.left==null?0:this.right.left.depth;s>v&&this.right.rotateLL(),this.rotateRR()}},Xe.prototype.rotateLL=function(){var t=this.node,a=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=a,this.right.node=t,this.right.updateInNewLocation(),this.updateInNewLocation()},Xe.prototype.rotateRR=function(){var t=this.node,a=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=a,this.left.node=t,this.left.updateInNewLocation(),this.updateInNewLocation()},Xe.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},Xe.prototype.getDepthFromChildren=function(){this.depth=this.node==null?0:1,this.left!=null&&(this.depth=this.left.depth+1),this.right!=null&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)};function Cr(t,a){if(t===a)return 0;if(t.compareDocumentPosition){var m=t.compareDocumentPosition(a);return m&1||m&10?1:m&20?-1:0}for(var w=0,v=0,s=t;s!=null;s=s.parentNode||s.ownerElement)w++;for(var c=a;c!=null;c=c.parentNode||c.ownerElement)v++;if(w>v){for(;w>v;)t=t.parentNode||t.ownerElement,w--;if(t===a)return 1}else if(v>w){for(;v>w;)a=a.parentNode||a.ownerElement,v--;if(t===a)return-1}for(var y=t.parentNode||t.ownerElement,b=a.parentNode||a.ownerElement;y!==b;)t=y,a=b,y=t.parentNode||t.ownerElement,b=a.parentNode||a.ownerElement;var x=nr(t),O=nr(a);if(x&&!O)return-1;if(!x&&O)return 1;if(t.isXPathNamespace){if(t.nodeValue===q.XML_NAMESPACE_URI||!a.isXPathNamespace)return-1;if(a.nodeValue===q.XML_NAMESPACE_URI)return 1}else if(a.isXPathNamespace)return 1;if(y)for(var me=x?y.attributes:y.childNodes,Me=me.length,je=t.baseNode||t,Je=a.baseNode||a,Ke=0;Ke<Me;Ke+=1){var Ct=me[Ke];if(Ct===je)return-1;if(Ct===Je)return 1}throw new Error("Unexpected: could not determine node order")}Xe.prototype.add=function(t){if(t===this.node)return!1;var a=Cr(t,this.node),m=!1;return a==-1?this.left==null?(this.left=new Xe(t),m=!0):(m=this.left.add(t),m&&this.balance()):a==1&&(this.right==null?(this.right=new Xe(t),m=!0):(m=this.right.add(t),m&&this.balance())),m&&this.getDepthFromChildren(),m},W.prototype=new Q,W.prototype.constructor=W,W.superclass=Q.prototype;function W(){this.init()}W.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},W.prototype.toString=function(){var t=this.first();return t==null?"":this.stringForNode(t)},W.prototype.evaluate=function(t){return this},W.prototype.string=function(){return new ne(this.toString())},W.prototype.stringValue=function(){return this.toString()},W.prototype.number=function(){return new Z(this.string())},W.prototype.numberValue=function(){return Number(this.string())},W.prototype.bool=function(){return new X(this.booleanValue())},W.prototype.booleanValue=function(){return!!this.size},W.prototype.nodeset=function(){return this},W.prototype.stringForNode=function(t){return t.nodeType==D.DOCUMENT_NODE||t.nodeType==D.ELEMENT_NODE||t.nodeType===D.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(t):t.nodeType===D.ATTRIBUTE_NODE?t.value||t.nodeValue:t.isNamespaceNode?t.namespace:t.nodeValue},W.prototype.stringForContainerNode=function(t){for(var a="",m=t.firstChild;m!=null;m=m.nextSibling){var w=m.nodeType;(w===1||w===3||w===4||w===9||w===11)&&(a+=this.stringForNode(m))}return a},W.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new Xe(this.nodes[0]);for(var t=1;t<this.nodes.length;t+=1)this.tree.add(this.nodes[t])}return this.tree},W.prototype.first=function(){var t=this.buildTree();if(t==null)return null;for(;t.left!=null;)t=t.left;return t.node},W.prototype.add=function(t){for(var a=0;a<this.nodes.length;a+=1)if(t===this.nodes[a])return;this.tree=null,this.nodes.push(t),this.size+=1},W.prototype.addArray=function(t){var a=this;p(function(m){a.add(m)},t)},W.prototype.toArray=function(){var t=[];return this.toArrayRec(this.buildTree(),t),t},W.prototype.toArrayRec=function(t,a){t!=null&&(this.toArrayRec(t.left,a),a.push(t.node),this.toArrayRec(t.right,a))},W.prototype.toUnsortedArray=function(){return this.nodes.slice()},W.prototype.compareWithString=function(t,a){for(var m=this.toUnsortedArray(),w=0;w<m.length;w++){var v=m[w],s=new ne(this.stringForNode(v)),c=a(s,t);if(c.booleanValue())return c}return new X(!1)},W.prototype.compareWithNumber=function(t,a){for(var m=this.toUnsortedArray(),w=0;w<m.length;w++){var v=m[w],s=new Z(this.stringForNode(v)),c=a(s,t);if(c.booleanValue())return c}return new X(!1)},W.prototype.compareWithBoolean=function(t,a){return a(this.bool(),t)},W.prototype.compareWithNodeSet=function(t,a){for(var m=this.toUnsortedArray(),w=function(y,b){return a(b,y)},v=0;v<m.length;v++){var s=new ne(this.stringForNode(m[v])),c=t.compareWithString(s,w);if(c.booleanValue())return c}return new X(!1)},W.compareWith=f(function(t,a){return ee.instance_of(a,ne)?this.compareWithString(a,t):ee.instance_of(a,Z)?this.compareWithNumber(a,t):ee.instance_of(a,X)?this.compareWithBoolean(a,t):this.compareWithNodeSet(a,t)}),W.prototype.equals=W.compareWith(Oe.equals),W.prototype.notequal=W.compareWith(Oe.notequal),W.prototype.lessthan=W.compareWith(Oe.lessthan),W.prototype.greaterthan=W.compareWith(Oe.greaterthan),W.prototype.lessthanorequal=W.compareWith(Oe.lessthanorequal),W.prototype.greaterthanorequal=W.compareWith(Oe.greaterthanorequal),W.prototype.union=function(t){var a=new W;return a.addArray(this.toUnsortedArray()),a.addArray(t.toUnsortedArray()),a},gt.prototype=new Object,gt.prototype.constructor=gt,gt.superclass=Object.prototype;function gt(t,a,m,w){this.isXPathNamespace=!0,this.baseNode=a,this.ownerDocument=w.ownerDocument,this.nodeName=t,this.prefix=t,this.localName=t,this.namespaceURI=null,this.nodeValue=m,this.ownerElement=w,this.nodeType=D.NAMESPACE_NODE}gt.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},ce.prototype=new Object,ce.prototype.constructor=ce,ce.superclass=Object.prototype;function ce(t,a,m){this.variableResolver=t!=null?t:new Te,this.namespaceResolver=a!=null?a:new He,this.functionResolver=m!=null?m:new _e}ce.prototype.extend=function(t){return Ce(new ce,this,t)},Te.prototype=new Object,Te.prototype.constructor=Te,Te.superclass=Object.prototype;function Te(){}Te.prototype.getVariable=function(t,a){return null},_e.prototype=new Object,_e.prototype.constructor=_e,_e.superclass=Object.prototype;function _e(t){this.thisArg=t!=null?t:se,this.functions=new Object,this.addStandardFunctions()}_e.prototype.addStandardFunctions=function(){this.functions["{}last"]=se.last,this.functions["{}position"]=se.position,this.functions["{}count"]=se.count,this.functions["{}id"]=se.id,this.functions["{}local-name"]=se.localName,this.functions["{}namespace-uri"]=se.namespaceURI,this.functions["{}name"]=se.name,this.functions["{}string"]=se.string,this.functions["{}concat"]=se.concat,this.functions["{}starts-with"]=se.startsWith,this.functions["{}contains"]=se.contains,this.functions["{}substring-before"]=se.substringBefore,this.functions["{}substring-after"]=se.substringAfter,this.functions["{}substring"]=se.substring,this.functions["{}string-length"]=se.stringLength,this.functions["{}normalize-space"]=se.normalizeSpace,this.functions["{}translate"]=se.translate,this.functions["{}boolean"]=se.boolean_,this.functions["{}not"]=se.not,this.functions["{}true"]=se.true_,this.functions["{}false"]=se.false_,this.functions["{}lang"]=se.lang,this.functions["{}number"]=se.number,this.functions["{}sum"]=se.sum,this.functions["{}floor"]=se.floor,this.functions["{}ceiling"]=se.ceiling,this.functions["{}round"]=se.round},_e.prototype.addFunction=function(t,a,m){this.functions["{"+t+"}"+a]=m},_e.getFunctionFromContext=function(t,a){var m=ee.resolveQName(t,a.namespaceResolver,a.contextNode,!1);if(m[0]===null)throw new Error("Cannot resolve QName "+name);return a.functionResolver.getFunction(m[1],m[0])},_e.prototype.getFunction=function(t,a){return this.functions["{"+a+"}"+t]},He.prototype=new Object,He.prototype.constructor=He,He.superclass=Object.prototype;function He(){}He.prototype.getNamespace=function(t,a){if(t=="xml")return q.XML_NAMESPACE_URI;if(t=="xmlns")return q.XMLNS_NAMESPACE_URI;for(a.nodeType==D.DOCUMENT_NODE?a=a.documentElement:a.nodeType==D.ATTRIBUTE_NODE?a=le.getOwnerElement(a):a.nodeType!=D.ELEMENT_NODE&&(a=a.parentNode);a!=null&&a.nodeType==D.ELEMENT_NODE;){for(var m=a.attributes,w=0;w<m.length;w++){var v=m.item(w),s=v.name||v.nodeName;if(s==="xmlns"&&t===""||s==="xmlns:"+t)return String(v.value||v.nodeValue)}a=a.parentNode}return null};var se=new Object;se.last=function(t){if(arguments.length!=1)throw new Error("Function last expects ()");return new Z(t.contextSize)},se.position=function(t){if(arguments.length!=1)throw new Error("Function position expects ()");return new Z(t.contextPosition)},se.count=function(){var t=arguments[0],a;if(arguments.length!=2||!ee.instance_of(a=arguments[1].evaluate(t),W))throw new Error("Function count expects (node-set)");return new Z(a.size)},se.id=function(){var t=arguments[0],a;if(arguments.length!=2)throw new Error("Function id expects (object)");a=arguments[1].evaluate(t),ee.instance_of(a,W)?a=a.toArray().join(" "):a=a.stringValue();for(var m=a.split(/[\x0d\x0a\x09\x20]+/),w=new W,v=t.contextNode.nodeType==D.DOCUMENT_NODE?t.contextNode:t.contextNode.ownerDocument,s=0;s<m.length;s++){var c;v.getElementById?c=v.getElementById(m[s]):c=ee.getElementById(v,m[s]),c!=null&&w.add(c)}return w},se.localName=function(t,a){var m;if(arguments.length==1)m=t.contextNode;else if(arguments.length==2)m=a.evaluate(t).first();else throw new Error("Function local-name expects (node-set?)");return m==null?new ne(""):new ne(m.localName||m.baseName||m.target||m.nodeName||"")},se.namespaceURI=function(){var t=arguments[0],a;if(arguments.length==1)a=t.contextNode;else if(arguments.length==2)a=arguments[1].evaluate(t).first();else throw new Error("Function namespace-uri expects (node-set?)");return a==null?new ne(""):new ne(a.namespaceURI||"")},se.name=function(){var t=arguments[0],a;if(arguments.length==1)a=t.contextNode;else if(arguments.length==2)a=arguments[1].evaluate(t).first();else throw new Error("Function name expects (node-set?)");return a==null?new ne(""):a.nodeType==D.ELEMENT_NODE?new ne(a.nodeName):a.nodeType==D.ATTRIBUTE_NODE?new ne(a.name||a.nodeName):a.nodeType===D.PROCESSING_INSTRUCTION_NODE?new ne(a.target||a.nodeName):a.localName==null?new ne(""):new ne(a.localName)},se.string=function(){var t=arguments[0];if(arguments.length==1)return new ne(W.prototype.stringForNode(t.contextNode));if(arguments.length==2)return arguments[1].evaluate(t).string();throw new Error("Function string expects (object?)")},se.concat=function(t){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var a="",m=1;m<arguments.length;m++)a+=arguments[m].evaluate(t).stringValue();return new ne(a)},se.startsWith=function(){var t=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var a=arguments[1].evaluate(t).stringValue(),m=arguments[2].evaluate(t).stringValue();return new X(a.substring(0,m.length)==m)},se.contains=function(){var t=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var a=arguments[1].evaluate(t).stringValue(),m=arguments[2].evaluate(t).stringValue();return new X(a.indexOf(m)!==-1)},se.substringBefore=function(){var t=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var a=arguments[1].evaluate(t).stringValue(),m=arguments[2].evaluate(t).stringValue();return new ne(a.substring(0,a.indexOf(m)))},se.substringAfter=function(){var t=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var a=arguments[1].evaluate(t).stringValue(),m=arguments[2].evaluate(t).stringValue();if(m.length==0)return new ne(a);var w=a.indexOf(m);return w==-1?new ne(""):new ne(a.substring(w+m.length))},se.substring=function(){var t=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var a=arguments[1].evaluate(t).stringValue(),m=Math.round(arguments[2].evaluate(t).numberValue())-1,w=arguments.length==4?m+Math.round(arguments[3].evaluate(t).numberValue()):void 0;return new ne(a.substring(m,w))},se.stringLength=function(){var t=arguments[0],a;if(arguments.length==1)a=W.prototype.stringForNode(t.contextNode);else if(arguments.length==2)a=arguments[1].evaluate(t).stringValue();else throw new Error("Function string-length expects (string?)");return new Z(a.length)},se.normalizeSpace=function(){var t=arguments[0],a;if(arguments.length==1)a=W.prototype.stringForNode(t.contextNode);else if(arguments.length==2)a=arguments[1].evaluate(t).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var m=0,w=a.length-1;ee.isSpace(a.charCodeAt(w));)w--;for(var v="";m<=w&&ee.isSpace(a.charCodeAt(m));)m++;for(;m<=w;)if(ee.isSpace(a.charCodeAt(m)))for(v+=" ";m<=w&&ee.isSpace(a.charCodeAt(m));)m++;else v+=a.charAt(m),m++;return new ne(v)},se.translate=function(t,a,m,w){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var v=a.evaluate(t).stringValue(),s=m.evaluate(t).stringValue(),c=w.evaluate(t).stringValue(),y=g(function(x,O,me){return O in x||(x[O]=me>c.length?"":c[me]),x},{},s),b=H("",N(function(x){return x in y?y[x]:x},v));return new ne(b)},se.boolean_=function(){var t=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(t).bool()},se.not=function(t,a){if(arguments.length!=2)throw new Error("Function not expects (object)");return a.evaluate(t).bool().not()},se.true_=function(){if(arguments.length!=1)throw new Error("Function true expects ()");return X.true_},se.false_=function(){if(arguments.length!=1)throw new Error("Function false expects ()");return X.false_},se.lang=function(){var t=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var a,m=t.contextNode;m!=null&&m.nodeType!=D.DOCUMENT_NODE;m=m.parentNode){var w=m.getAttributeNS(q.XML_NAMESPACE_URI,"lang");if(w!=null){a=String(w);break}}if(a==null)return X.false_;var v=arguments[1].evaluate(t).stringValue();return new X(a.substring(0,v.length)==v&&(a.length==v.length||a.charAt(v.length)=="-"))},se.number=function(){var t=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new Z(W.prototype.stringForNode(t.contextNode)):arguments[1].evaluate(t).number()},se.sum=function(){var t=arguments[0],a;if(arguments.length!=2||!ee.instance_of(a=arguments[1].evaluate(t),W))throw new Error("Function sum expects (node-set)");a=a.toUnsortedArray();for(var m=0,w=0;w<a.length;w++)m+=new Z(W.prototype.stringForNode(a[w])).numberValue();return new Z(m)},se.floor=function(){var t=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new Z(Math.floor(arguments[1].evaluate(t).numberValue()))},se.ceiling=function(){var t=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new Z(Math.ceil(arguments[1].evaluate(t).numberValue()))},se.round=function(){var t=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new Z(Math.round(arguments[1].evaluate(t).numberValue()))};var ee=new Object,nr=function(t){return t&&(t.nodeType===D.ATTRIBUTE_NODE||t.ownerElement||t.isXPathNamespace)};ee.splitQName=function(t){var a=t.indexOf(":");return a==-1?[null,t]:[t.substring(0,a),t.substring(a+1)]},ee.resolveQName=function(t,a,m,w){var v=ee.splitQName(t);return v[0]!=null?v[0]=a.getNamespace(v[0],m):w?(v[0]=a.getNamespace("",m),v[0]==null&&(v[0]="")):v[0]="",v},ee.isSpace=function(t){return t==9||t==13||t==10||t==32},ee.isLetter=function(t){return t>=65&&t<=90||t>=97&&t<=122||t>=192&&t<=214||t>=216&&t<=246||t>=248&&t<=255||t>=256&&t<=305||t>=308&&t<=318||t>=321&&t<=328||t>=330&&t<=382||t>=384&&t<=451||t>=461&&t<=496||t>=500&&t<=501||t>=506&&t<=535||t>=592&&t<=680||t>=699&&t<=705||t==902||t>=904&&t<=906||t==908||t>=910&&t<=929||t>=931&&t<=974||t>=976&&t<=982||t==986||t==988||t==990||t==992||t>=994&&t<=1011||t>=1025&&t<=1036||t>=1038&&t<=1103||t>=1105&&t<=1116||t>=1118&&t<=1153||t>=1168&&t<=1220||t>=1223&&t<=1224||t>=1227&&t<=1228||t>=1232&&t<=1259||t>=1262&&t<=1269||t>=1272&&t<=1273||t>=1329&&t<=1366||t==1369||t>=1377&&t<=1414||t>=1488&&t<=1514||t>=1520&&t<=1522||t>=1569&&t<=1594||t>=1601&&t<=1610||t>=1649&&t<=1719||t>=1722&&t<=1726||t>=1728&&t<=1742||t>=1744&&t<=1747||t==1749||t>=1765&&t<=1766||t>=2309&&t<=2361||t==2365||t>=2392&&t<=2401||t>=2437&&t<=2444||t>=2447&&t<=2448||t>=2451&&t<=2472||t>=2474&&t<=2480||t==2482||t>=2486&&t<=2489||t>=2524&&t<=2525||t>=2527&&t<=2529||t>=2544&&t<=2545||t>=2565&&t<=2570||t>=2575&&t<=2576||t>=2579&&t<=2600||t>=2602&&t<=2608||t>=2610&&t<=2611||t>=2613&&t<=2614||t>=2616&&t<=2617||t>=2649&&t<=2652||t==2654||t>=2674&&t<=2676||t>=2693&&t<=2699||t==2701||t>=2703&&t<=2705||t>=2707&&t<=2728||t>=2730&&t<=2736||t>=2738&&t<=2739||t>=2741&&t<=2745||t==2749||t==2784||t>=2821&&t<=2828||t>=2831&&t<=2832||t>=2835&&t<=2856||t>=2858&&t<=2864||t>=2866&&t<=2867||t>=2870&&t<=2873||t==2877||t>=2908&&t<=2909||t>=2911&&t<=2913||t>=2949&&t<=2954||t>=2958&&t<=2960||t>=2962&&t<=2965||t>=2969&&t<=2970||t==2972||t>=2974&&t<=2975||t>=2979&&t<=2980||t>=2984&&t<=2986||t>=2990&&t<=2997||t>=2999&&t<=3001||t>=3077&&t<=3084||t>=3086&&t<=3088||t>=3090&&t<=3112||t>=3114&&t<=3123||t>=3125&&t<=3129||t>=3168&&t<=3169||t>=3205&&t<=3212||t>=3214&&t<=3216||t>=3218&&t<=3240||t>=3242&&t<=3251||t>=3253&&t<=3257||t==3294||t>=3296&&t<=3297||t>=3333&&t<=3340||t>=3342&&t<=3344||t>=3346&&t<=3368||t>=3370&&t<=3385||t>=3424&&t<=3425||t>=3585&&t<=3630||t==3632||t>=3634&&t<=3635||t>=3648&&t<=3653||t>=3713&&t<=3714||t==3716||t>=3719&&t<=3720||t==3722||t==3725||t>=3732&&t<=3735||t>=3737&&t<=3743||t>=3745&&t<=3747||t==3749||t==3751||t>=3754&&t<=3755||t>=3757&&t<=3758||t==3760||t>=3762&&t<=3763||t==3773||t>=3776&&t<=3780||t>=3904&&t<=3911||t>=3913&&t<=3945||t>=4256&&t<=4293||t>=4304&&t<=4342||t==4352||t>=4354&&t<=4355||t>=4357&&t<=4359||t==4361||t>=4363&&t<=4364||t>=4366&&t<=4370||t==4412||t==4414||t==4416||t==4428||t==4430||t==4432||t>=4436&&t<=4437||t==4441||t>=4447&&t<=4449||t==4451||t==4453||t==4455||t==4457||t>=4461&&t<=4462||t>=4466&&t<=4467||t==4469||t==4510||t==4520||t==4523||t>=4526&&t<=4527||t>=4535&&t<=4536||t==4538||t>=4540&&t<=4546||t==4587||t==4592||t==4601||t>=7680&&t<=7835||t>=7840&&t<=7929||t>=7936&&t<=7957||t>=7960&&t<=7965||t>=7968&&t<=8005||t>=8008&&t<=8013||t>=8016&&t<=8023||t==8025||t==8027||t==8029||t>=8031&&t<=8061||t>=8064&&t<=8116||t>=8118&&t<=8124||t==8126||t>=8130&&t<=8132||t>=8134&&t<=8140||t>=8144&&t<=8147||t>=8150&&t<=8155||t>=8160&&t<=8172||t>=8178&&t<=8180||t>=8182&&t<=8188||t==8486||t>=8490&&t<=8491||t==8494||t>=8576&&t<=8578||t>=12353&&t<=12436||t>=12449&&t<=12538||t>=12549&&t<=12588||t>=44032&&t<=55203||t>=19968&&t<=40869||t==12295||t>=12321&&t<=12329},ee.isNCNameChar=function(t){return t>=48&&t<=57||t>=1632&&t<=1641||t>=1776&&t<=1785||t>=2406&&t<=2415||t>=2534&&t<=2543||t>=2662&&t<=2671||t>=2790&&t<=2799||t>=2918&&t<=2927||t>=3047&&t<=3055||t>=3174&&t<=3183||t>=3302&&t<=3311||t>=3430&&t<=3439||t>=3664&&t<=3673||t>=3792&&t<=3801||t>=3872&&t<=3881||t==46||t==45||t==95||ee.isLetter(t)||t>=768&&t<=837||t>=864&&t<=865||t>=1155&&t<=1158||t>=1425&&t<=1441||t>=1443&&t<=1465||t>=1467&&t<=1469||t==1471||t>=1473&&t<=1474||t==1476||t>=1611&&t<=1618||t==1648||t>=1750&&t<=1756||t>=1757&&t<=1759||t>=1760&&t<=1764||t>=1767&&t<=1768||t>=1770&&t<=1773||t>=2305&&t<=2307||t==2364||t>=2366&&t<=2380||t==2381||t>=2385&&t<=2388||t>=2402&&t<=2403||t>=2433&&t<=2435||t==2492||t==2494||t==2495||t>=2496&&t<=2500||t>=2503&&t<=2504||t>=2507&&t<=2509||t==2519||t>=2530&&t<=2531||t==2562||t==2620||t==2622||t==2623||t>=2624&&t<=2626||t>=2631&&t<=2632||t>=2635&&t<=2637||t>=2672&&t<=2673||t>=2689&&t<=2691||t==2748||t>=2750&&t<=2757||t>=2759&&t<=2761||t>=2763&&t<=2765||t>=2817&&t<=2819||t==2876||t>=2878&&t<=2883||t>=2887&&t<=2888||t>=2891&&t<=2893||t>=2902&&t<=2903||t>=2946&&t<=2947||t>=3006&&t<=3010||t>=3014&&t<=3016||t>=3018&&t<=3021||t==3031||t>=3073&&t<=3075||t>=3134&&t<=3140||t>=3142&&t<=3144||t>=3146&&t<=3149||t>=3157&&t<=3158||t>=3202&&t<=3203||t>=3262&&t<=3268||t>=3270&&t<=3272||t>=3274&&t<=3277||t>=3285&&t<=3286||t>=3330&&t<=3331||t>=3390&&t<=3395||t>=3398&&t<=3400||t>=3402&&t<=3405||t==3415||t==3633||t>=3636&&t<=3642||t>=3655&&t<=3662||t==3761||t>=3764&&t<=3769||t>=3771&&t<=3772||t>=3784&&t<=3789||t>=3864&&t<=3865||t==3893||t==3895||t==3897||t==3902||t==3903||t>=3953&&t<=3972||t>=3974&&t<=3979||t>=3984&&t<=3989||t==3991||t>=3993&&t<=4013||t>=4017&&t<=4023||t==4025||t>=8400&&t<=8412||t==8417||t>=12330&&t<=12335||t==12441||t==12442||t==183||t==720||t==721||t==903||t==1600||t==3654||t==3782||t==12293||t>=12337&&t<=12341||t>=12445&&t<=12446||t>=12540&&t<=12542},ee.coalesceText=function(t){for(var a=t.firstChild;a!=null;a=a.nextSibling)if(a.nodeType==D.TEXT_NODE||a.nodeType==D.CDATA_SECTION_NODE){var m=a.nodeValue,w=a;for(a=a.nextSibling;a!=null&&(a.nodeType==D.TEXT_NODE||a.nodeType==D.CDATA_SECTION_NODE);){m+=a.nodeValue;var v=a;a=a.nextSibling,v.parentNode.removeChild(v)}if(w.nodeType==D.CDATA_SECTION_NODE){var s=w.parentNode;if(w.nextSibling==null)s.removeChild(w),s.appendChild(s.ownerDocument.createTextNode(m));else{var c=w.nextSibling;s.removeChild(w),s.insertBefore(s.ownerDocument.createTextNode(m),c)}}else w.nodeValue=m;if(a==null)break}else a.nodeType==D.ELEMENT_NODE&&ee.coalesceText(a)},ee.instance_of=function(t,a){for(;t!=null;){if(t.constructor===a)return!0;if(t===Object)return!1;t=t.constructor.superclass}return!1},ee.getElementById=function(t,a){if(t.nodeType==D.ELEMENT_NODE&&(t.getAttribute("id")==a||t.getAttributeNS(null,"id")==a))return t;for(var m=t.firstChild;m!=null;m=m.nextSibling){var w=ee.getElementById(m,a);if(w!=null)return w}return null};var lt=(function(){function t(m,w){var v=w?": "+w.toString():"";switch(m){case a.INVALID_EXPRESSION_ERR:return"Invalid expression"+v;case a.TYPE_ERR:return"Type error"+v}return null}function a(m,w,v){var s=Error.call(this,t(m,w)||v);return s.code=m,s.exception=w,s}return a.prototype=Object.create(Error.prototype),a.prototype.constructor=a,a.superclass=Error,a.prototype.toString=function(){return this.message},a.fromMessage=function(m,w){return new a(null,w,m)},a.INVALID_EXPRESSION_ERR=51,a.TYPE_ERR=52,a})();ct.prototype={},ct.prototype.constructor=ct,ct.superclass=Object.prototype;function ct(t,a,m){this.xpath=m.parse(t),this.context=new ce,this.context.namespaceResolver=new St(a)}ct.getOwnerDocument=function(t){return t.nodeType===D.DOCUMENT_NODE?t:t.ownerDocument},ct.detectHtmlDom=function(t){if(!t)return!1;var a=ct.getOwnerDocument(t);try{return a.implementation.hasFeature("HTML","2.0")}catch(m){return!0}},ct.prototype.evaluate=function(t,a,m){this.context.expressionContextNode=t,this.context.caseInsensitive=ct.detectHtmlDom(t);var w=this.xpath.evaluate(this.context);return new he(w,a)},St.prototype={},St.prototype.constructor=St,St.superclass=Object.prototype;function St(t){this.xpathNSResolver=t}St.prototype.getNamespace=function(t,a){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(t)},Dt.prototype={},Dt.prototype.constructor=Dt,Dt.superclass=Object.prototype;function Dt(t){this.node=t,this.namespaceResolver=new He}Dt.prototype.lookupNamespaceURI=function(t){return this.namespaceResolver.getNamespace(t,this.node)},he.prototype={},he.prototype.constructor=he,he.superclass=Object.prototype;function he(t,a){switch(a==he.ANY_TYPE&&(t.constructor===ne?a=he.STRING_TYPE:t.constructor===Z?a=he.NUMBER_TYPE:t.constructor===X?a=he.BOOLEAN_TYPE:t.constructor===W&&(a=he.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=a,a){case he.NUMBER_TYPE:this.numberValue=t.numberValue();return;case he.STRING_TYPE:this.stringValue=t.stringValue();return;case he.BOOLEAN_TYPE:this.booleanValue=t.booleanValue();return;case he.ANY_UNORDERED_NODE_TYPE:case he.FIRST_ORDERED_NODE_TYPE:if(t.constructor===W){this.singleNodeValue=t.first();return}break;case he.UNORDERED_NODE_ITERATOR_TYPE:case he.ORDERED_NODE_ITERATOR_TYPE:if(t.constructor===W){this.invalidIteratorState=!1,this.nodes=t.toArray(),this.iteratorIndex=0;return}break;case he.UNORDERED_NODE_SNAPSHOT_TYPE:case he.ORDERED_NODE_SNAPSHOT_TYPE:if(t.constructor===W){this.nodes=t.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new lt(lt.TYPE_ERR)}he.prototype.iterateNext=function(){if(this.resultType!=he.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=he.ORDERED_NODE_ITERATOR_TYPE)throw new lt(lt.TYPE_ERR);return this.nodes[this.iteratorIndex++]},he.prototype.snapshotItem=function(t){if(this.resultType!=he.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=he.ORDERED_NODE_SNAPSHOT_TYPE)throw new lt(lt.TYPE_ERR);return this.nodes[t]},he.ANY_TYPE=0,he.NUMBER_TYPE=1,he.STRING_TYPE=2,he.BOOLEAN_TYPE=3,he.UNORDERED_NODE_ITERATOR_TYPE=4,he.ORDERED_NODE_ITERATOR_TYPE=5,he.UNORDERED_NODE_SNAPSHOT_TYPE=6,he.ORDERED_NODE_SNAPSHOT_TYPE=7,he.ANY_UNORDERED_NODE_TYPE=8,he.FIRST_ORDERED_NODE_TYPE=9;function ir(t,a){t.createExpression=function(m,w){try{return new ct(m,w,a)}catch(v){throw new lt(lt.INVALID_EXPRESSION_ERR,v)}},t.createNSResolver=function(m){return new Dt(m)},t.evaluate=function(m,w,v,s,c){if(s<0||s>9)throw{code:0,toString:function(){return"Request type not supported"}};return t.createExpression(m,v,a).evaluate(w,s,c)}}try{var xr=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(xr=!1)}catch(t){}xr&&ir(document,new A)}catch(t){}ir(r,new A),(function(){var t=new A,a=new He,m=new _e,w=new Te;function v(P){return{getNamespace:function(Ee,it){var Pe=P(Ee,it);return Pe||a.getNamespace(Ee,it)}}}function s(P){return v(P.getNamespace.bind(P))}function c(P){return v(function(Ee){return P[Ee]})}function y(P){return P&&typeof P.getNamespace=="function"?s(P):typeof P=="function"?v(P):typeof P=="object"?c(P):a}function b(P){if(P===null||typeof P=="undefined"||P instanceof ne||P instanceof X||P instanceof Z||P instanceof W)return P;switch(typeof P){case"string":return new ne(P);case"boolean":return new X(P);case"number":return new Z(P)}var Ee=new W;return Ee.addArray([].concat(P)),Ee}function x(P){return function(Ee){var it=Array.prototype.slice.call(arguments,1).map(function(Ui){return Ui.evaluate(Ee)}),Pe=P.apply(this,[].concat(Ee,it));return b(Pe)}}function O(P){return{getFunction:function(Ee,it){var Pe=P(Ee,it);return Pe?x(Pe):m.getFunction(Ee,it)}}}function me(P){return O(P.getFunction.bind(P))}function Me(P){return O(function(Ee){return P[Ee]})}function je(P){return P&&typeof P.getFunction=="function"?me(P):typeof P=="function"?O(P):typeof P=="object"?Me(P):m}function Je(P){return{getVariable:function(Ee,it){var Pe=P(Ee,it);return b(Pe)}}}function Ke(P){if(P){if(typeof P.getVariable=="function")return Je(P.getVariable.bind(P));if(typeof P=="function")return Je(P);if(typeof P=="object")return Je(function(Ee){return P[Ee]})}return w}function Ct(P,Ee,it){P in it&&(Ee[P]=it[P])}function Pt(P){var Ee=new ce;return P?(Ee.namespaceResolver=y(P.namespaces),Ee.functionResolver=je(P.functions),Ee.variableResolver=Ke(P.variables),Ee.expressionContextNode=P.node,Ct("allowAnyNamespaceForNoPrefix",Ee,P),Ct("isHtml",Ee,P)):Ee.namespaceResolver=a,Ee}function At(P,Ee){var it=Pt(Ee);return P.evaluate(it)}var or={evaluate:function(P){return At(this.expression,P)},evaluateNumber:function(P){return this.evaluate(P).numberValue()},evaluateString:function(P){return this.evaluate(P).stringValue()},evaluateBoolean:function(P){return this.evaluate(P).booleanValue()},evaluateNodeSet:function(P){return this.evaluate(P).nodeset()},select:function(P){return this.evaluateNodeSet(P).toArray()},select1:function(P){return this.select(P)[0]}};function Bt(P){var Ee=t.parse(P);return Object.create(or,{expression:{value:Ee}})}r.parse=Bt})(),Ce(r,{XPath:q,XPathParser:A,XPathResult:he,Step:L,PathExpr:le,NodeTest:$,LocationPath:et,OrOperation:de,AndOperation:B,BarOperation:pe,EqualsOperation:F,NotEqualOperation:Y,LessThanOperation:M,GreaterThanOperation:V,LessThanOrEqualOperation:_,GreaterThanOrEqualOperation:z,PlusOperation:fe,MinusOperation:oe,MultiplyOperation:G,DivOperation:J,ModOperation:ue,UnaryMinusOperation:Ie,FunctionCall:tt,VariableReference:Ge,XPathContext:ce,XNodeSet:W,XBoolean:X,XString:ne,XNumber:Z,NamespaceResolver:He,FunctionResolver:_e,VariableResolver:Te,Utilities:ee}),r.select=function(t,a,m){return r.selectWithResolver(t,a,null,m)},r.useNamespaces=function(t){var a={mappings:t||{},lookupNamespaceURI:function(m){return this.mappings[m]}};return function(m,w,v){return r.selectWithResolver(m,w,a,v)}},r.selectWithResolver=function(t,a,m,w){var v=new ct(t,m,new A),s=he.ANY_TYPE,c=v.evaluate(a,s,null);return c.resultType==he.STRING_TYPE?c=c.stringValue:c.resultType==he.NUMBER_TYPE?c=c.numberValue:c.resultType==he.BOOLEAN_TYPE?c=c.booleanValue:(c=c.nodes,w&&(c=c[0])),c},r.select1=function(t,a){return r.select(t,a,!0)};var qe=function(t){return Array.isArray(t)&&t.every(l)},Le=function(t){return function(a){return l(a)&&a.nodeType===t}};Ce(r,{isNodeLike:l,isArrayOfNodes:qe,isElement:Le(D.ELEMENT_NODE),isAttribute:Le(D.ATTRIBUTE_NODE),isTextNode:Le(D.TEXT_NODE),isCDATASection:Le(D.CDATA_SECTION_NODE),isProcessingInstruction:Le(D.PROCESSING_INSTRUCTION_NODE),isComment:Le(D.COMMENT_NODE),isDocumentNode:Le(D.DOCUMENT_NODE),isDocumentTypeNode:Le(D.DOCUMENT_TYPE_NODE),isDocumentFragment:Le(D.DOCUMENT_FRAGMENT_NODE)})})(e)})(Hi)),Hi}var $s=hl(),dl=al($s),Gs=Ot({__proto__:null,default:dl},[$s]);function Xs(n,e){const r=[],i=e.split(",").map(l=>l.trim()),o=[];for(const l of i){const f=l.split(/\\:|:/).filter(Boolean);f.length===1?o.push({name:f[0]}):f.length===2&&o.push({ns:f[0],name:f[1]})}function u(l){if(l){if(l.nodeType===1){const f=l,p=f.nodeName,g=f.localName;for(const N of o){if(N.ns&&p===`${N.ns}:${N.name}`){r.push(f);break}if(g===N.name||p===N.name){r.push(f);break}if(p.endsWith(`:${N.name}`)){r.push(f);break}}}if(l.childNodes)for(let f=0;f<l.childNodes.length;f++)u(l.childNodes[f])}}return u(n),r}const Ws={ds:"http://www.w3.org/2000/09/xmldsig#",dsig11:"http://www.w3.org/2009/xmldsig11#",dsig2:"http://www.w3.org/2010/xmldsig2#",ec:"http://www.w3.org/2001/10/xml-exc-c14n#",dsig_more:"http://www.w3.org/2001/04/xmldsig-more#",xenc:"http://www.w3.org/2001/04/xmlenc#",xenc11:"http://www.w3.org/2009/xmlenc11#",xades:"http://uri.etsi.org/01903/v1.3.2#",xades141:"http://uri.etsi.org/01903/v1.4.1#",asic:"http://uri.etsi.org/02918/v1.2.1#"};function zs(){return typeof window!="undefined"&&window.DOMParser?new window.DOMParser:new qs.DOMParser}function gl(n,e,r=Ws){try{if(typeof document!="undefined"&&typeof document.evaluate=="function"){const i="ownerDocument"in n?n.ownerDocument:n;if(!i||typeof i.evaluate!="function")return null;const o=Ys(r);return i.evaluate(e,n,o,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}else{const i=Gs,o=r;try{const u=i.select(e,n,o);return u.length>0?u[0]:null}catch(u){if(typeof u=="object"&&u!==null&&"message"in u&&typeof u.message=="string"&&u.message.includes("Cannot resolve QName")){const l=e.match(/local-name\(\)='([^']+)'/);if(l&&l[1]){const f=`.//*[local-name()='${l[1]}']`,p=i.select(f,n);return p.length>0?p[0]:null}}throw u}}}catch(i){return console.error(`XPath evaluation failed for "${e}":`,i),null}}function ml(n,e,r=Ws){try{if(typeof document!="undefined"&&typeof document.evaluate=="function"){const i="ownerDocument"in n?n.ownerDocument:n;if(!i||typeof i.evaluate!="function")return[];const o=Ys(r),u=i.evaluate(e,n,o,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),l=[];for(let f=0;f<u.snapshotLength;f++)l.push(u.snapshotItem(f));return l}else{const i=Gs,o=r;try{return i.select(e,n,o)}catch(u){if(typeof u=="object"&&u!==null&&"message"in u&&typeof u.message=="string"&&u.message.includes("Cannot resolve QName")){const l=e.match(/local-name\(\)='([^']+)'/);if(l&&l[1]){const f=`.//*[local-name()='${l[1]}']`;return i.select(f,n)}}throw u}}}catch(i){return console.error(`XPath evaluation failed for "${e}":`,i),[]}}function Ys(n){return function(e){return e===null?null:n[e]||null}}function Js(n){const e=n.split(",").map(i=>i.trim()),r=[];for(const i of e){const o=i.split(/\\:|:/).filter(Boolean);o.length===1?r.push(`.//*[local-name()='${o[0]}']`):o.length===2&&r.push(`.//${o[0]}:${o[1]} | .//*[local-name()='${o[1]}']`)}return r.join(" | ")}function ot(n,e){if(typeof n.querySelector=="function")try{const i=n.querySelector(e);if(i)return i}catch(i){}const r=Xs(n,e);if(r.length>0)return r[0];try{const i=Js(e);return gl(n,i)}catch(i){return console.warn("XPath query failed, using direct DOM traversal as fallback"),null}}function On(n,e){if(typeof n.querySelectorAll=="function")try{const i=n.querySelectorAll(e);if(i.length>0){const o=[];for(let u=0;u<i.length;u++)o.push(i[u]);return o}}catch(i){}const r=Xs(n,e);if(r.length>0)return r;try{const i=Js(e);return ml(n,i)}catch(i){return console.warn("XPath query failed, using direct DOM traversal as fallback"),[]}}function yl(n){return typeof window!="undefined"&&window.XMLSerializer?new window.XMLSerializer().serializeToString(n):new qs.XMLSerializer().serializeToString(n)}const Br={default:"c14n","http://www.w3.org/TR/2001/REC-xml-c14n-20010315":"c14n","http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":"c14n","http://www.w3.org/2006/12/xml-c14n11":"c14n11","http://www.w3.org/2006/12/xml-c14n11#WithComments":"c14n11","http://www.w3.org/2001/10/xml-exc-c14n#":"c14n_exc","http://www.w3.org/2001/10/xml-exc-c14n#WithComments":"c14n_exc"},Qr={c14n:{beforeChildren:()=>"",afterChildren:()=>"",betweenChildren:()=>"",afterElement:()=>"",isCanonicalizationMethod:"c14n"},c14n11:{beforeChildren:()=>"",afterChildren:()=>"",betweenChildren:()=>"",afterElement:()=>"",isCanonicalizationMethod:"c14n11"},c14n_exc:{beforeChildren:()=>"",afterChildren:()=>"",betweenChildren:()=>"",afterElement:()=>"",isCanonicalizationMethod:"c14n_exc"}},rt={ELEMENT_NODE:1,TEXT_NODE:3};class Ye{constructor(e=Qr.c14n){this.method=e}static fromMethod(e){const r=Br[e];if(!r)throw new Error(`Unsupported canonicalization method: ${e}`);return new Ye(Qr[r])}setMethod(e){this.method=e}static escapeXml(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}static collectNamespaces(e,r=new Map){let i=e;for(;i&&i.nodeType===rt.ELEMENT_NODE;){const o=i,u=o.getAttribute("xmlns");u!==null&&!r.has("")&&r.set("",u);const l=o.attributes;for(let f=0;f<l.length;f++){const p=l[f];if(p.name.startsWith("xmlns:")){const g=p.name.substring(6);r.has(g)||r.set(g,p.value)}}i=i.parentNode}return r}static collectUsedNamespaces(e,r=new Map,i=[]){const o=new Map,u=new Set;function l(f,p=!1){if(f.nodeType===rt.ELEMENT_NODE){const g=f,N=g.namespaceURI,E=g.prefix||"";if(E&&N&&(p||!u.has(E))){u.add(E);const C=r.get(E);C&&C===N&&!o.has(E)&&o.set(E,C)}const S=g.attributes;for(let C=0;C<S.length;C++){const I=S[C];if(I.name.includes(":")&&!I.name.startsWith("xmlns:")){const H=I.name.split(":")[0];if(p||!u.has(H)){u.add(H);const U=r.get(H);U&&!o.has(H)&&o.set(H,U)}}}for(const C of i){const I=r.get(C);I&&!o.has(C)&&o.set(C,I)}for(let C=0;C<f.childNodes.length;C++)l(f.childNodes[C],!1)}}return l(e,!0),o}static isBase64Element(e){if(e.nodeType!==rt.ELEMENT_NODE)return!1;const r=e,i=r.localName||r.nodeName.split(":").pop()||"";return this.base64Elements.has(i)}static analyzeWhitespace(e){const r=e.nodeType===rt.ELEMENT_NODE?e:e.documentElement;function i(o){if(o.nodeType===rt.ELEMENT_NODE){o._whitespace={hasMixedContent:!1,hasExistingLinebreaks:!1,originalContent:{}};const u=Array.from(o.childNodes);let l=!1,f=!1,p=!1;for(const g of u)if(g.nodeType===rt.TEXT_NODE&&(g.nodeValue||"").trim().length>0){l=!0;break}for(const g of u)if(g.nodeType===rt.ELEMENT_NODE){f=!0;break}for(let g=0;g<u.length;g++){const N=u[g];if(N.nodeType===rt.TEXT_NODE){const E=N.nodeValue||"";N._originalText=E,E.includes(`
11
+ `)&&(p=!0)}else N.nodeType===rt.ELEMENT_NODE&&i(N)}o._whitespace.hasMixedContent=l&&f,o._whitespace.hasExistingLinebreaks=p}}i(r)}canonicalize(e,r=new Map,i={isStartingNode:!0}){var o;return this.method.isCanonicalizationMethod==="c14n_exc"?this.canonicalizeExclusive(e,r,{inclusiveNamespacePrefixList:i.inclusiveNamespacePrefixList,isStartingNode:i.isStartingNode}):this.canonicalizeStandard(e,r,{isStartingNode:(o=i.isStartingNode)!=null?o:!0})}canonicalizeStandard(e,r=new Map,i={isStartingNode:!0}){var o,u,l;if(!e)return"";let f="";if(e.nodeType===rt.ELEMENT_NODE){const p=new Map(r),g=e,N=g.getAttribute("xmlns");N!==null&&p.set("",N);const E=g.attributes;for(let D=0;D<E.length;D++){const A=E[D];if(A.name.startsWith("xmlns:")){const q=A.name.substring(6);p.set(q,A.value)}}const S=g.prefix||"",C=g.localName||g.nodeName.split(":").pop()||"",I=S?`${S}:${C}`:C;if(f+="<"+I,i.isStartingNode){const D=Ye.collectNamespaces(e),A=Array.from(D.entries()).sort((q,re)=>q[0]===""?-1:re[0]===""?1:q[0].localeCompare(re[0]));for(const[q,re]of A)q===""?f+=` xmlns="${re}"`:f+=` xmlns:${q}="${re}"`}else{const D=Array.from(p.entries()).filter(([A,q])=>!r.has(A)||r.get(A)!==q).sort((A,q)=>A[0]===""?-1:q[0]===""?1:A[0].localeCompare(q[0]));for(const[A,q]of D)A===""?f+=` xmlns="${q}"`:f+=` xmlns:${A}="${q}"`}const H=g.attributes,U=[];for(let D=0;D<H.length;D++){const A=H[D];A.name.startsWith("xmlns")||U.push(A)}U.sort((D,A)=>D.name.localeCompare(A.name));for(const D of U)f+=` ${D.name}="${Ye.escapeXml(D.value)}"`;f+=">";const R=Array.from(e.childNodes);let K=!1,Ae=!1;const be=((o=e._whitespace)==null?void 0:o.hasMixedContent)||!1;for(const D of R)if(D.nodeType===rt.ELEMENT_NODE){K=!0;break}const Ce=this.method.isCanonicalizationMethod==="c14n11"&&K&&!((u=e._whitespace)!=null&&u.hasExistingLinebreaks)&&!be;Ce&&(f+=this.method.beforeChildren(K,be));for(let D=0;D<R.length;D++){const A=R[D],q=A.nodeType===rt.ELEMENT_NODE,re=D<R.length-1?R[D+1]:null;if(re&&(re.nodeType,rt.ELEMENT_NODE),A.nodeType===rt.TEXT_NODE){const Q=A.nodeValue||"";Ye.isBase64Element(e)?f+=Q.replace(/\r/g,"&#xD;"):f+=A._originalText||Q,Ae=!1;continue}q&&(Ae&&this.method.isCanonicalizationMethod==="c14n11"&&!((l=e._whitespace)!=null&&l.hasExistingLinebreaks)&&!be&&(f+=this.method.betweenChildren(!0,!0,be)),f+=this.canonicalizeStandard(A,p,{isStartingNode:!1}),Ae=!0)}Ce&&(f+=this.method.afterChildren(K,be)),f+="</"+I+">"}else if(e.nodeType===rt.TEXT_NODE){const p=e._originalText||e.nodeValue||"";f+=Ye.escapeXml(p)}return f}canonicalizeExclusive(e,r=new Map,i={}){if(!e)return"";const{inclusiveNamespacePrefixList:o=[],isStartingNode:u=!0}=i;let l="";if(e.nodeType===rt.ELEMENT_NODE){const f=e,p=Ye.collectNamespaces(f),g=u?Ye.collectUsedNamespaces(f,p,o):new Map,N=f.prefix||"",E=f.localName||f.nodeName.split(":").pop()||"",S=N?`${N}:${E}`:E;if(l+="<"+S,u){const U=Array.from(g.entries()).sort((R,K)=>R[0]===""?-1:K[0]===""?1:R[0].localeCompare(K[0]));for(const[R,K]of U)R===""?l+=` xmlns="${K}"`:l+=` xmlns:${R}="${K}"`}const C=f.attributes,I=[];for(let U=0;U<C.length;U++){const R=C[U];R.name.startsWith("xmlns")||I.push(R)}I.sort((U,R)=>U.name.localeCompare(R.name));for(const U of I)l+=` ${U.name}="${Ye.escapeXml(U.value)}"`;l+=">";const H=Array.from(e.childNodes);for(let U=0;U<H.length;U++){const R=H[U];if(R.nodeType===rt.TEXT_NODE){const K=R.nodeValue||"";Ye.isBase64Element(e)?l+=K.replace(/\r/g,"&#xD;"):l+=Ye.escapeXml(K)}else R.nodeType===rt.ELEMENT_NODE&&(l+=this.canonicalizeExclusive(R,new Map([...r,...g]),{inclusiveNamespacePrefixList:o,isStartingNode:!1}))}l+="</"+S+">"}else if(e.nodeType===rt.TEXT_NODE){const f=e.nodeValue||"";l+=Ye.escapeXml(f)}return l}static c14n(e){return this.analyzeWhitespace(e),new Ye(Qr.c14n).canonicalize(e)}static c14n11(e){return this.analyzeWhitespace(e),new Ye(Qr.c14n11).canonicalize(e)}static c14n_exc(e,r=[]){return this.analyzeWhitespace(e),new Ye(Qr.c14n_exc).canonicalizeExclusive(e,new Map,{inclusiveNamespacePrefixList:r})}static canonicalize(e,r,i={}){switch(Br[r]||Br.default){case"c14n":return this.c14n(e);case"c14n11":return this.c14n11(e);case"c14n_exc":return this.c14n_exc(e,i.inclusiveNamespacePrefixList||[]);default:throw new Error(`Unsupported canonicalization method: ${r}`)}}}Ye.base64Elements=new Set(["DigestValue","X509Certificate","EncapsulatedTimeStamp","EncapsulatedOCSPValue","IssuerSerialV2"]);var vl=(n,e,r)=>new Promise((i,o)=>{var u=p=>{try{f(r.next(p))}catch(g){o(g)}},l=p=>{try{f(r.throw(p))}catch(g){o(g)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,l);f((r=r.apply(n,e)).next())});function El(n){if(!n)return"";const e=n.replace(/\s+/g,""),r=[];for(let i=0;i<e.length;i+=64)r.push(e.substring(i,i+64));return`-----BEGIN CERTIFICATE-----
12
+ ${r.join(`
7
13
  `)}
8
- -----END CERTIFICATE-----`}function Qn(r){var e,t,i,n,o,s,c,l;const f={validFrom:r.notBefore,validTo:r.notAfter,issuer:{}};try{if(typeof r.subject=="object"&&r.subject!==null){const h=r.subject;f.commonName=h.commonName,f.organization=h.organizationName,f.country=h.countryName}if(typeof r.issuer=="object"&&r.issuer!==null){const h=r.issuer;f.issuer.commonName=h.commonName,f.issuer.organization=h.organizationName,f.issuer.country=h.countryName}}catch(h){console.warn("Could not extract subject/issuer as objects:",h)}try{if(typeof r.subject=="string"){const h=r.subject.split(",");for(const d of h){const[g,y]=d.trim().split("=");g==="CN"&&(f.commonName=f.commonName||y),g==="O"&&(f.organization=f.organization||y),g==="C"&&(f.country=f.country||y),g==="SN"&&(f.surname=y),(g==="G"||g==="GN")&&(f.givenName=y),(g==="SERIALNUMBER"||g==="2.5.4.5")&&(f.serialNumber=y==null?void 0:y.replace("PNOLV-",""))}}if(typeof r.issuer=="string"){const h=r.issuer.split(",");for(const d of h){const[g,y]=d.trim().split("=");g==="CN"&&(f.issuer.commonName=f.issuer.commonName||y),g==="O"&&(f.issuer.organization=f.issuer.organization||y),g==="C"&&(f.issuer.country=f.issuer.country||y)}}}catch(h){console.warn("Could not extract subject/issuer as strings:",h)}try{if("subjectName"in r&&(e=r.subjectName)!=null&&e.getField){const h=r.subjectName;f.commonName=f.commonName||((t=h.getField("CN"))==null?void 0:t[0]),f.surname=f.surname||((i=h.getField("SN"))==null?void 0:i[0]),f.givenName=f.givenName||((n=h.getField("G"))==null?void 0:n[0]),f.serialNumber=f.serialNumber||((s=(o=h.getField("2.5.4.5"))==null?void 0:o[0])==null?void 0:s.replace("PNOLV-","")),f.country=f.country||((c=h.getField("C"))==null?void 0:c[0]),f.organization=f.organization||((l=h.getField("O"))==null?void 0:l[0])}}catch(h){console.warn("Could not extract fields using getField method:",h)}return!f.serialNumber&&r.serialNumber&&(f.serialNumber=r.serialNumber),f}function eo(r){return fa(this,null,function*(){try{let e=r;if(!r.includes("-----BEGIN CERTIFICATE-----")){const n=r.replace(/[\r\n\s]/g,"");e=ha(n)}const t=new D.X509Certificate(e),i=Qn(t);return{subject:{commonName:i.commonName,organization:i.organization,country:i.country,surname:i.surname,givenName:i.givenName,serialNumber:i.serialNumber},validFrom:i.validFrom,validTo:i.validTo,issuer:i.issuer,serialNumber:t.serialNumber}}catch(e){throw console.error("Certificate parsing error:",e),new Error("Failed to parse certificate: "+(e instanceof Error?e.message:String(e)))}})}function pa(r,e=new Date){const t="notBefore"in r?r.notBefore:r.validFrom,i="notAfter"in r?r.notAfter:r.validTo;return e<t?{isValid:!1,reason:`Certificate not yet valid. Valid from ${t.toISOString()}`}:e>i?{isValid:!1,reason:`Certificate expired. Valid until ${i.toISOString()}`}:{isValid:!0}}function da(r){const{subject:e}=r;return e.givenName&&e.surname?`${e.givenName} ${e.surname}`:e.commonName?e.commonName:e.serialNumber||"Unknown Signer"}function ya(r){const{validFrom:e,validTo:t}=r,i=n=>n.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"});return`${i(e)} to ${i(t)}`}function Kt(r){if(!r)return"";const e=r.replace(/\s+/g,""),t=[];for(let i=0;i<e.length;i+=64)t.push(e.substring(i,i+64));return`-----BEGIN CERTIFICATE-----
9
- ${t.join(`
14
+ -----END CERTIFICATE-----`}function Ks(n){var e,r,i,o,u,l,f,p;const g={validFrom:n.notBefore,validTo:n.notAfter,issuer:{}};try{if(typeof n.subject=="object"&&n.subject!==null){const N=n.subject;g.commonName=N.commonName,g.organization=N.organizationName,g.country=N.countryName}if(typeof n.issuer=="object"&&n.issuer!==null){const N=n.issuer;g.issuer.commonName=N.commonName,g.issuer.organization=N.organizationName,g.issuer.country=N.countryName}}catch(N){console.warn("Could not extract subject/issuer as objects:",N)}try{if(typeof n.subject=="string"){const N=n.subject.split(",");for(const E of N){const[S,C]=E.trim().split("=");S==="CN"&&(g.commonName=g.commonName||C),S==="O"&&(g.organization=g.organization||C),S==="C"&&(g.country=g.country||C),S==="SN"&&(g.surname=C),(S==="G"||S==="GN")&&(g.givenName=C),(S==="SERIALNUMBER"||S==="2.5.4.5")&&(g.serialNumber=C==null?void 0:C.replace("PNOLV-",""))}}if(typeof n.issuer=="string"){const N=n.issuer.split(",");for(const E of N){const[S,C]=E.trim().split("=");S==="CN"&&(g.issuer.commonName=g.issuer.commonName||C),S==="O"&&(g.issuer.organization=g.issuer.organization||C),S==="C"&&(g.issuer.country=g.issuer.country||C)}}}catch(N){console.warn("Could not extract subject/issuer as strings:",N)}try{if("subjectName"in n&&(e=n.subjectName)!=null&&e.getField){const N=n.subjectName;g.commonName=g.commonName||((r=N.getField("CN"))==null?void 0:r[0]),g.surname=g.surname||((i=N.getField("SN"))==null?void 0:i[0]),g.givenName=g.givenName||((o=N.getField("G"))==null?void 0:o[0]),g.serialNumber=g.serialNumber||((l=(u=N.getField("2.5.4.5"))==null?void 0:u[0])==null?void 0:l.replace("PNOLV-","")),g.country=g.country||((f=N.getField("C"))==null?void 0:f[0]),g.organization=g.organization||((p=N.getField("O"))==null?void 0:p[0])}}catch(N){console.warn("Could not extract fields using getField method:",N)}return!g.serialNumber&&n.serialNumber&&(g.serialNumber=n.serialNumber),g}function Qs(n){return vl(this,null,function*(){try{let e=n;if(!n.includes("-----BEGIN CERTIFICATE-----")){const o=n.replace(/[\r\n\s]/g,"");e=El(o)}const r=new ke.X509Certificate(e),i=Ks(r);return{subject:{commonName:i.commonName,organization:i.organization,country:i.country,surname:i.surname,givenName:i.givenName,serialNumber:i.serialNumber},validFrom:i.validFrom,validTo:i.validTo,issuer:i.issuer,serialNumber:r.serialNumber}}catch(e){throw console.error("Certificate parsing error:",e),new Error("Failed to parse certificate: "+(e instanceof Error?e.message:String(e)))}})}function Al(n,e=new Date){const r="notBefore"in n?n.notBefore:n.validFrom,i="notAfter"in n?n.notAfter:n.validTo;return e<r?{isValid:!1,reason:`Certificate not yet valid. Valid from ${r.toISOString()}`}:e>i?{isValid:!1,reason:`Certificate expired. Valid until ${i.toISOString()}`}:{isValid:!0}}function Nl(n){const{subject:e}=n;return e.givenName&&e.surname?`${e.givenName} ${e.surname}`:e.commonName?e.commonName:e.serialNumber||"Unknown Signer"}function wl(n){const{validFrom:e,validTo:r}=n,i=o=>o.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"});return`${i(e)} to ${i(r)}`}function In(n){if(!n)return"";const e=n.replace(/\s+/g,""),r=[];for(let i=0;i<e.length;i+=64)r.push(e.substring(i,i+64));return`-----BEGIN CERTIFICATE-----
15
+ ${r.join(`
10
16
  `)}
11
- -----END CERTIFICATE-----`}var ga=Object.defineProperty,va=Object.defineProperties,ma=Object.getOwnPropertyDescriptors,to=Object.getOwnPropertySymbols,wa=Object.prototype.hasOwnProperty,ba=Object.prototype.propertyIsEnumerable,ro=(r,e,t)=>e in r?ga(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,io=(r,e)=>{for(var t in e||(e={}))wa.call(e,t)&&ro(r,t,e[t]);if(to)for(var t of to(e))ba.call(e,t)&&ro(r,t,e[t]);return r},no=(r,e)=>va(r,ma(e));function Aa(r){return Array.from(r.keys()).filter(e=>e.match(/META-INF\/signatures\d*\.xml$/)||e.match(/META-INF\/.*signatures.*\.xml$/i))}function Sa(r,e){const t=new TextDecoder().decode(r),i=Jn().parseFromString(t,"application/xml"),n=Wt(i,"ds\\:Signature, Signature");if(n.length===0){if(console.warn(`No Signature elements found in ${e}`),t.includes("XAdESSignatures")){const s=i.documentElement;if(s){const l=Q(s,"ds\\:Signature, Signature");if(l){let f=oo(l,i);return f.rawXml=t,f}}const c=Ba(t);if(c)return no(io({},c),{rawXml:t})}return null}let o=oo(n[0],i);return o.rawXml=t,o}function oo(r,e){var t,i,n,o,s;const c=r.getAttribute("Id")||"unknown",l=Q(r,"ds\\:SignedInfo, SignedInfo");if(!l)throw new Error("SignedInfo element not found");const f=Q(l,"ds\\:CanonicalizationMethod, CanonicalizationMethod");let h=Ze.default;f&&(h=f.getAttribute("Algorithm")||h);let d="";d=ua(l);const g=Q(l,"ds\\:SignatureMethod, SignatureMethod"),y=(g==null?void 0:g.getAttribute("Algorithm"))||"",v=Q(r,"ds\\:SignatureValue, SignatureValue"),B=((t=v==null?void 0:v.textContent)==null?void 0:t.replace(/\s+/g,""))||"";let b;if(v)try{b=new q().canonicalize(v)}catch(F){}let w="",U="",K=[],N,V;const C=Q(r,"ds\\:KeyInfo, KeyInfo");if(C){const F=Q(C,"ds\\:X509Data, X509Data");if(F){const J=Wt(F,"ds\\:X509Certificate, X509Certificate");if(J.length>0){w=((i=J[0].textContent)==null?void 0:i.replace(/\s+/g,""))||"";for(let Re=1;Re<J.length;Re++){const Be=((n=J[Re].textContent)==null?void 0:n.replace(/\s+/g,""))||"";Be&&K.push(Kt(Be))}}}}if(!w){const F=Q(r,"ds\\:X509Certificate, X509Certificate");F&&(w=((o=F.textContent)==null?void 0:o.replace(/\s+/g,""))||"")}const x=Q(e,"xades\\:CertificateValues, CertificateValues");if(x){const F=Wt(x,"xades\\:EncapsulatedX509Certificate, EncapsulatedX509Certificate");for(const J of F){const Re=((s=J.textContent)==null?void 0:s.replace(/\s+/g,""))||"";if(Re){const Be=Kt(Re);K.includes(Be)||K.push(Be)}}}if(w){U=Kt(w);try{const F=new D.X509Certificate(U),J=F.publicKey.algorithm;V=no(io({algorithm:J.name},"namedCurve"in J?{namedCurve:J.namedCurve}:{}),{rawData:F.publicKey.rawData}),N=Qn(F)}catch(F){console.error("Failed to extract certificate information:",F)}}const M=Q(e,"xades\\:SigningTime, SigningTime"),Se=M&&M.textContent?new Date(M.textContent.trim()):new Date,Xt=[],ta={},ra={},Al=Wt(l,"ds\\:Reference, Reference");for(const F of Al){const J=F.getAttribute("URI")||"",Re=F.getAttribute("Type")||"";if(!J||J.startsWith("#")||Re.includes("SignedProperties"))continue;let Be=J;try{Be=decodeURIComponent(J)}catch(ti){console.error(`Failed to decode URI: ${J}`,ti)}const Xn=Be.startsWith("./")?Be.substring(2):Be;Xt.push(Xn);const na=Q(F,"ds\\:DigestMethod, DigestMethod");if(na){const ti=na.getAttribute("Algorithm");ti&&(ra[Xn]=ti)}const Wn=Q(F,"ds\\:DigestValue, DigestValue");Wn&&Wn.textContent&&(ta[Xn]=Wn.textContent.replace(/\s+/g,""))}let ia;const zn=Q(e,"xades\\:EncapsulatedTimeStamp, EncapsulatedTimeStamp");return zn&&zn.textContent&&(ia=zn.textContent.replace(/\s+/g,"")),{id:c,signingTime:Se,certificate:w,certificatePEM:U,certificateChain:K.length>0?K:void 0,publicKey:V,signerInfo:N,signedChecksums:ta,digestAlgorithms:ra,references:Xt,algorithm:y,signatureValue:B,canonicalSignatureValue:b,signedInfoXml:d,canonicalizationMethod:h,signatureTimestamp:ia}}function Ba(r){try{const e=r.match(/<ds:Signature[^>]*Id=["']([^"']*)["']/),t=e&&e[1]?e[1]:"unknown",i=r.match(/<ds:SignatureValue[^>]*>([\s\S]*?)<\/ds:SignatureValue>/),n=i&&i[1]?i[1].replace(/\s+/g,""):"",o=r.match(/<ds:X509Certificate>([\s\S]*?)<\/ds:X509Certificate>/),s=o&&o[1]?o[1].replace(/\s+/g,""):"",c=r.match(/<ds:SignatureMethod[^>]*Algorithm=["']([^"']*)["']/),l=c&&c[1]?c[1]:"",f=r.match(/<xades:SigningTime>([\s\S]*?)<\/xades:SigningTime>/),h=f&&f[1]?new Date(f[1].trim()):new Date,d=[],g={},y=/<ds:Reference[^>]*URI=["']([^#][^"']*)["'][^>]*>[\s\S]*?<ds:DigestValue>([\s\S]*?)<\/ds:DigestValue>/g;let v;for(;(v=y.exec(r))!==null;)if(v[1]&&!v[1].startsWith("#")){const b=decodeURIComponent(v[1]);d.push(b),v[2]&&(g[b]=v[2].replace(/\s+/g,""))}const B=Kt(s);return{id:t,signingTime:h,certificate:s,certificatePEM:B,signedChecksums:g,references:d,algorithm:l,signatureValue:n}}catch(e){return console.error("Error in fallback text parsing:",e),null}}function ka(r){try{const e=$.unzipSync(r),t=new Map,i=[],n=[];Object.entries(e).forEach(([f,h])=>{t.set(f,h),f.startsWith("META-INF/")||f==="mimetype"?n.push(f):i.push(f)});const o=[],s=Aa(t),c=new Set;for(const f of s){const h=t.get(f);if(h)try{const d=Sa(h,f);d&&(o.push(d),d.references&&d.references.length>0&&d.references.forEach(g=>{t.has(g)&&c.add(g)}))}catch(d){console.error(`Error parsing signature ${f}:`,d)}}const l=Array.from(c);return{files:t,documentFileList:i,metadataFileList:n,signedFileList:l,signatures:o}}catch(e){throw new Error(`Failed to parse eDoc container: ${e instanceof Error?e.message:String(e)}`)}}function xa(r){const e=()=>{},t=new Uint8Array(r);if(t[0]!==48)return r;const i=[6,9,42,134,72,134,247,13,1,1,1];let n=-1;for(let v=0;v<=t.length-i.length;v++){let B=!0;for(let b=0;b<i.length;b++)if(t[v+b]!==i[b]){B=!1;break}if(B){n=v;break}}if(n===-1)return r;let o=-1;for(let v=n+i.length;v<t.length;v++)if(t[v]===3){o=v;break}if(o===-1)return r;let s=0;(t[o+1]&128)===0?s=1:s=1+(t[o+1]&127);const c=o+1+s;if(c>=t.length)return r;const l=c+1;if(l>=t.length||t[l]!==48)return r;let f=0;(t[l+1]&128)===0?f=1:f=1+(t[l+1]&127);const h=l+1+f;if(h>=t.length||t[h]!==2)return r;let d=0,g=0;if((t[h+1]&128)===0)g=t[h+1],d=1;else{const v=t[h+1]&127;d=1+v,g=0;for(let B=0;B<v;B++)g=g<<8|t[h+2+B]}const y=h+1+d;if(y>=t.length)return r;if((t[y]&128)!==0){const v=new Uint8Array(t.length+1);if(v.set(t.slice(0,y)),v[y]=0,v.set(t.slice(y),y+1),(t[h+1]&128)===0)v[h+1]=t[h+1]+1;else{const B=t[h+1]&127;let b=0;for(let w=0;w<B;w++)b=b<<8|t[h+2+w];b+=1;for(let w=B-1;w>=0;w--)v[h+2+w]=b&255,b>>=8}if((t[l+1]&128)===0)v[l+1]=t[l+1]+1;else{const B=t[l+1]&127;let b=0;for(let w=0;w<B;w++)b=b<<8|t[l+2+w];b+=1;for(let w=B-1;w>=0;w--)v[l+2+w]=b&255,b>>=8}if((t[o+1]&128)===0)v[o+1]=t[o+1]+1;else{const B=t[o+1]&127;let b=0;for(let w=0;w<B;w++)b=b<<8|t[o+2+w];b+=1;for(let w=B-1;w>=0;w--)v[o+2+w]=b&255,b>>=8}if((t[1]&128)===0)v[1]=t[1]+1;else{const B=t[1]&127;let b=0;for(let w=0;w<B;w++)b=b<<8|t[2+w];b+=1;for(let w=B-1;w>=0;w--)v[2+w]=b&255,b>>=8}return e("Fixed key length: "+v.length),v.buffer}return r}const Na={ocspEnabled:!0,crlEnabled:!0,ocspTimeout:5e3,crlTimeout:1e4};/*!
17
+ -----END CERTIFICATE-----`}var bl=Object.defineProperty,Dl=Object.defineProperties,Cl=Object.getOwnPropertyDescriptors,Zs=Object.getOwnPropertySymbols,xl=Object.prototype.hasOwnProperty,Tl=Object.prototype.propertyIsEnumerable,eu=(n,e,r)=>e in n?bl(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r,tu=(n,e)=>{for(var r in e||(e={}))xl.call(e,r)&&eu(n,r,e[r]);if(Zs)for(var r of Zs(e))Tl.call(e,r)&&eu(n,r,e[r]);return n},ru=(n,e)=>Dl(n,Cl(e));function Sl(n){var e;if(!n)return;const r=ot(n,"ec\\:InclusiveNamespaces, InclusiveNamespaces"),i=(e=r==null?void 0:r.getAttribute("PrefixList"))==null?void 0:e.trim();if(!i)return;const o=i.split(/\s+/).filter(Boolean);return o.length>0?o:void 0}function Bl(n){if(!n)return new Ye;try{return Ye.fromMethod(n)}catch(e){return new Ye}}function Ol(n){return Array.from(n.keys()).filter(e=>e.match(/META-INF\/signatures\d*\.xml$/)||e.match(/META-INF\/.*signatures.*\.xml$/i))}function Il(n,e){const r=new TextDecoder().decode(n),i=zs().parseFromString(r,"application/xml"),o=On(i,"ds\\:Signature, Signature");if(o.length===0){if(console.warn(`No Signature elements found in ${e}`),r.includes("XAdESSignatures")){const l=i.documentElement;if(l){const p=ot(l,"ds\\:Signature, Signature");if(p){let g=nu(p,i);return g.rawXml=r,g}}const f=Rl(r);if(f)return ru(tu({},f),{rawXml:r})}return null}let u=nu(o[0],i);return u.rawXml=r,u}function nu(n,e){var r,i,o,u,l;const f=n.getAttribute("Id")||"unknown",p=ot(n,"ds\\:SignedInfo, SignedInfo");if(!p)throw new Error("SignedInfo element not found");const g=ot(p,"ds\\:CanonicalizationMethod, CanonicalizationMethod");let N=Br.default;g&&(N=g.getAttribute("Algorithm")||N);let E="";E=yl(p);const S=ot(p,"ds\\:SignatureMethod, SignatureMethod"),C=(S==null?void 0:S.getAttribute("Algorithm"))||"",I=ot(n,"ds\\:SignatureValue, SignatureValue"),H=((r=I==null?void 0:I.textContent)==null?void 0:r.replace(/\s+/g,""))||"";let U,R,K;const Ae=ot(e,"xades\\:SignatureTimeStamp, SignatureTimeStamp");if(Ae){const M=ot(Ae,"ds\\:CanonicalizationMethod, CanonicalizationMethod");R=(M==null?void 0:M.getAttribute("Algorithm"))||void 0,K=Sl(M);const V=ot(Ae,"xades\\:EncapsulatedTimeStamp, EncapsulatedTimeStamp");V&&V.textContent&&(U=V.textContent.replace(/\s+/g,""))}let be;if(I)try{be=Bl(R).canonicalize(I,new Map,{inclusiveNamespacePrefixList:K})}catch(M){}let Ce="",D="",A=[],q,re;const Q=ot(n,"ds\\:KeyInfo, KeyInfo");if(Q){const M=ot(Q,"ds\\:X509Data, X509Data");if(M){const V=On(M,"ds\\:X509Certificate, X509Certificate");if(V.length>0){Ce=((i=V[0].textContent)==null?void 0:i.replace(/\s+/g,""))||"";for(let _=1;_<V.length;_++){const z=((o=V[_].textContent)==null?void 0:o.replace(/\s+/g,""))||"";z&&A.push(In(z))}}}}if(!Ce){const M=ot(n,"ds\\:X509Certificate, X509Certificate");M&&(Ce=((u=M.textContent)==null?void 0:u.replace(/\s+/g,""))||"")}const ge=ot(e,"xades\\:CertificateValues, CertificateValues");if(ge){const M=On(ge,"xades\\:EncapsulatedX509Certificate, EncapsulatedX509Certificate");for(const V of M){const _=((l=V.textContent)==null?void 0:l.replace(/\s+/g,""))||"";if(_){const z=In(_);A.includes(z)||A.push(z)}}}if(Ce){D=In(Ce);try{const M=new ke.X509Certificate(D),V=M.publicKey.algorithm;re=ru(tu({algorithm:V.name},"namedCurve"in V?{namedCurve:V.namedCurve}:{}),{rawData:M.publicKey.rawData}),q=Ks(M)}catch(M){console.error("Failed to extract certificate information:",M)}}const Ie=ot(e,"xades\\:SigningTime, SigningTime"),k=Ie&&Ie.textContent?new Date(Ie.textContent.trim()):new Date,de=[],B={},F={},Y=On(p,"ds\\:Reference, Reference");for(const M of Y){const V=M.getAttribute("URI")||"",_=M.getAttribute("Type")||"";if(!V||V.startsWith("#")||_.includes("SignedProperties"))continue;let z=V;try{z=decodeURIComponent(V)}catch(J){console.error(`Failed to decode URI: ${V}`,J)}const fe=z.startsWith("./")?z.substring(2):z;de.push(fe);const oe=ot(M,"ds\\:DigestMethod, DigestMethod");if(oe){const J=oe.getAttribute("Algorithm");J&&(F[fe]=J)}const G=ot(M,"ds\\:DigestValue, DigestValue");G&&G.textContent&&(B[fe]=G.textContent.replace(/\s+/g,""))}return{id:f,signingTime:k,certificate:Ce,certificatePEM:D,certificateChain:A.length>0?A:void 0,publicKey:re,signerInfo:q,signedChecksums:B,digestAlgorithms:F,references:de,algorithm:C,signatureValue:H,canonicalSignatureValue:be,signedInfoXml:E,canonicalizationMethod:N,signatureTimestamp:U}}function Rl(n){try{const e=n.match(/<ds:Signature[^>]*Id=["']([^"']*)["']/),r=e&&e[1]?e[1]:"unknown",i=n.match(/<ds:SignatureValue[^>]*>([\s\S]*?)<\/ds:SignatureValue>/),o=i&&i[1]?i[1].replace(/\s+/g,""):"",u=n.match(/<ds:X509Certificate>([\s\S]*?)<\/ds:X509Certificate>/),l=u&&u[1]?u[1].replace(/\s+/g,""):"",f=n.match(/<ds:SignatureMethod[^>]*Algorithm=["']([^"']*)["']/),p=f&&f[1]?f[1]:"",g=n.match(/<xades:SigningTime>([\s\S]*?)<\/xades:SigningTime>/),N=g&&g[1]?new Date(g[1].trim()):new Date,E=[],S={},C=/<ds:Reference[^>]*URI=["']([^#][^"']*)["'][^>]*>[\s\S]*?<ds:DigestValue>([\s\S]*?)<\/ds:DigestValue>/g;let I;for(;(I=C.exec(n))!==null;)if(I[1]&&!I[1].startsWith("#")){const U=decodeURIComponent(I[1]);E.push(U),I[2]&&(S[U]=I[2].replace(/\s+/g,""))}const H=In(l);return{id:r,signingTime:N,certificate:l,certificatePEM:H,signedChecksums:S,references:E,algorithm:p,signatureValue:o}}catch(e){return console.error("Error in fallback text parsing:",e),null}}function kl(n){try{const e=ze.unzipSync(n),r=new Map,i=[],o=[];Object.entries(e).forEach(([g,N])=>{r.set(g,N),g.startsWith("META-INF/")||g==="mimetype"?o.push(g):i.push(g)});const u=[],l=Ol(r),f=new Set;for(const g of l){const N=r.get(g);if(N)try{const E=Il(N,g);E&&(u.push(E),E.references&&E.references.length>0&&E.references.forEach(S=>{r.has(S)&&f.add(S)}))}catch(E){console.error(`Error parsing signature ${g}:`,E)}}const p=Array.from(f);return{files:r,documentFileList:i,metadataFileList:o,signedFileList:p,signatures:u}}catch(e){throw new Error(`Failed to parse eDoc container: ${e instanceof Error?e.message:String(e)}`)}}function _l(n){const e=()=>{},r=new Uint8Array(n);if(r[0]!==48)return n;const i=[6,9,42,134,72,134,247,13,1,1,1];let o=-1;for(let I=0;I<=r.length-i.length;I++){let H=!0;for(let U=0;U<i.length;U++)if(r[I+U]!==i[U]){H=!1;break}if(H){o=I;break}}if(o===-1)return n;let u=-1;for(let I=o+i.length;I<r.length;I++)if(r[I]===3){u=I;break}if(u===-1)return n;let l=0;(r[u+1]&128)===0?l=1:l=1+(r[u+1]&127);const f=u+1+l;if(f>=r.length)return n;const p=f+1;if(p>=r.length||r[p]!==48)return n;let g=0;(r[p+1]&128)===0?g=1:g=1+(r[p+1]&127);const N=p+1+g;if(N>=r.length||r[N]!==2)return n;let E=0,S=0;if((r[N+1]&128)===0)S=r[N+1],E=1;else{const I=r[N+1]&127;E=1+I,S=0;for(let H=0;H<I;H++)S=S<<8|r[N+2+H]}const C=N+1+E;if(C>=r.length)return n;if((r[C]&128)!==0){const I=new Uint8Array(r.length+1);if(I.set(r.slice(0,C)),I[C]=0,I.set(r.slice(C),C+1),(r[N+1]&128)===0)I[N+1]=r[N+1]+1;else{const H=r[N+1]&127;let U=0;for(let R=0;R<H;R++)U=U<<8|r[N+2+R];U+=1;for(let R=H-1;R>=0;R--)I[N+2+R]=U&255,U>>=8}if((r[p+1]&128)===0)I[p+1]=r[p+1]+1;else{const H=r[p+1]&127;let U=0;for(let R=0;R<H;R++)U=U<<8|r[p+2+R];U+=1;for(let R=H-1;R>=0;R--)I[p+2+R]=U&255,U>>=8}if((r[u+1]&128)===0)I[u+1]=r[u+1]+1;else{const H=r[u+1]&127;let U=0;for(let R=0;R<H;R++)U=U<<8|r[u+2+R];U+=1;for(let R=H-1;R>=0;R--)I[u+2+R]=U&255,U>>=8}if((r[1]&128)===0)I[1]=r[1]+1;else{const H=r[1]&127;let U=0;for(let R=0;R<H;R++)U=U<<8|r[2+R];U+=1;for(let R=H-1;R>=0;R--)I[2+R]=U&255,U>>=8}return e("Fixed key length: "+I.length),I.buffer}return n}const Ll={ocspEnabled:!0,crlEnabled:!0,ocspTimeout:5e3,crlTimeout:1e4};/*!
12
18
  * MIT License
13
19
  *
14
20
  * Copyright (c) 2017-2024 Peculiar Ventures, LLC
@@ -31,9 +37,9 @@ ${t.join(`
31
37
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32
38
  * SOFTWARE.
33
39
  *
34
- */const Ca="[object ArrayBuffer]";class I{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Ca}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){const i=I.toUint8Array(e),n=I.toUint8Array(t);if(i.length!==n.byteLength)return!1;for(let o=0;o<i.length;o++)if(i[o]!==n[o])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 i=0;for(const s of t)i+=s.byteLength;const n=new Uint8Array(i);let o=0;for(const s of t){const c=this.toUint8Array(s);n.set(c,o),o+=c.length}return e[e.length-1]instanceof Function?this.toView(n,e[e.length-1]):n.buffer}}const ii="string",Ea=/^[0-9a-f\s]+$/i,Ia=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Oa=/^[a-zA-Z0-9-_]+$/;class so{static fromString(e){const t=unescape(encodeURIComponent(e)),i=new Uint8Array(t.length);for(let n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i.buffer}static toString(e){const t=I.toUint8Array(e);let i="";for(let o=0;o<t.length;o++)i+=String.fromCharCode(t[o]);return decodeURIComponent(escape(i))}}class me{static toString(e,t=!1){const i=I.toArrayBuffer(e),n=new DataView(i);let o="";for(let s=0;s<i.byteLength;s+=2){const c=n.getUint16(s,t);o+=String.fromCharCode(c)}return o}static fromString(e,t=!1){const i=new ArrayBuffer(e.length*2),n=new DataView(i);for(let o=0;o<e.length;o++)n.setUint16(o*2,e.charCodeAt(o),t);return i}}class L{static isHex(e){return typeof e===ii&&Ea.test(e)}static isBase64(e){return typeof e===ii&&Ia.test(e)}static isBase64Url(e){return typeof e===ii&&Oa.test(e)}static ToString(e,t="utf8"){const i=I.toUint8Array(e);switch(t.toLowerCase()){case"utf8":return this.ToUtf8String(i);case"binary":return this.ToBinary(i);case"hex":return this.ToHex(i);case"base64":return this.ToBase64(i);case"base64url":return this.ToBase64Url(i);case"utf16le":return me.toString(i,!0);case"utf16":case"utf16be":return me.toString(i);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 me.fromString(e,!0);case"utf16":case"utf16be":return me.fromString(e);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToBase64(e){const t=I.toUint8Array(e);if(typeof btoa!="undefined"){const i=this.ToString(t,"binary");return btoa(i)}else return Buffer.from(t).toString("base64")}static FromBase64(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!L.isBase64(t))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob!="undefined"?this.FromBinary(atob(t)):new Uint8Array(Buffer.from(t,"base64")).buffer}static FromBase64Url(e){const t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!L.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=L.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.FromBinary(e);case"utf8":return so.fromString(e);case"utf16":case"utf16be":return me.fromString(e);case"utf16le":case"usc2":return me.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static ToUtf8String(e,t=L.DEFAULT_UTF8_ENCODING){switch(t){case"ascii":return this.ToBinary(e);case"utf8":return so.toString(e);case"utf16":case"utf16be":return me.toString(e);case"utf16le":case"usc2":return me.toString(e,!0);default:throw new Error(`Unknown type of encoding '${t}'`)}}static FromBinary(e){const t=e.length,i=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=e.charCodeAt(n);return i.buffer}static ToBinary(e){const t=I.toUint8Array(e);let i="";for(let n=0;n<t.length;n++)i+=String.fromCharCode(t[n]);return i}static ToHex(e){const t=I.toUint8Array(e);let i="";const n=t.length;for(let o=0;o<n;o++){const s=t[o];s<16&&(i+="0"),i+=s.toString(16)}return i}static FromHex(e){let t=this.formatString(e);if(!t)return new ArrayBuffer(0);if(!L.isHex(t))throw new TypeError("Argument 'hexString' is not HEX encoded");t.length%2&&(t=`0${t}`);const i=new Uint8Array(t.length/2);for(let n=0;n<t.length;n=n+2){const o=t.slice(n,n+2);i[n/2]=parseInt(o,16)}return i.buffer}static ToUtf16String(e,t=!1){return me.toString(e,t)}static FromUtf16String(e,t=!1){return me.fromString(e,t)}static Base64Padding(e){const t=4-e.length%4;if(t<4)for(let i=0;i<t;i++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}L.DEFAULT_UTF8_ENCODING="utf8";function Ta(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)if(t[n]!==i[n])return!1;return!0}/*!
40
+ */const Ml="[object ArrayBuffer]";class we{static isArrayBuffer(e){return Object.prototype.toString.call(e)===Ml}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,r){if(e.constructor===r)return e;if(this.isArrayBuffer(e))return new r(e);if(this.isArrayBufferView(e))return new r(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,r){const i=we.toUint8Array(e),o=we.toUint8Array(r);if(i.length!==o.byteLength)return!1;for(let u=0;u<i.length;u++)if(i[u]!==o[u])return!1;return!0}static concat(...e){let r;Array.isArray(e[0])&&!(e[1]instanceof Function)||Array.isArray(e[0])&&e[1]instanceof Function?r=e[0]:e[e.length-1]instanceof Function?r=e.slice(0,e.length-1):r=e;let i=0;for(const l of r)i+=l.byteLength;const o=new Uint8Array(i);let u=0;for(const l of r){const f=this.toUint8Array(l);o.set(f,u),u+=f.length}return e[e.length-1]instanceof Function?this.toView(o,e[e.length-1]):o.buffer}}const qi="string",Fl=/^[0-9a-f\s]+$/i,Ul=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,Pl=/^[a-zA-Z0-9-_]+$/;class iu{static fromString(e){const r=unescape(encodeURIComponent(e)),i=new Uint8Array(r.length);for(let o=0;o<r.length;o++)i[o]=r.charCodeAt(o);return i.buffer}static toString(e){const r=we.toUint8Array(e);let i="";for(let u=0;u<r.length;u++)i+=String.fromCharCode(r[u]);return decodeURIComponent(escape(i))}}class Vt{static toString(e,r=!1){const i=we.toArrayBuffer(e),o=new DataView(i);let u="";for(let l=0;l<i.byteLength;l+=2){const f=o.getUint16(l,r);u+=String.fromCharCode(f)}return u}static fromString(e,r=!1){const i=new ArrayBuffer(e.length*2),o=new DataView(i);for(let u=0;u<e.length;u++)o.setUint16(u*2,e.charCodeAt(u),r);return i}}class Ve{static isHex(e){return typeof e===qi&&Fl.test(e)}static isBase64(e){return typeof e===qi&&Ul.test(e)}static isBase64Url(e){return typeof e===qi&&Pl.test(e)}static ToString(e,r="utf8"){const i=we.toUint8Array(e);switch(r.toLowerCase()){case"utf8":return this.ToUtf8String(i);case"binary":return this.ToBinary(i);case"hex":return this.ToHex(i);case"base64":return this.ToBase64(i);case"base64url":return this.ToBase64Url(i);case"utf16le":return Vt.toString(i,!0);case"utf16":case"utf16be":return Vt.toString(i);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromString(e,r="utf8"){if(!e)return new ArrayBuffer(0);switch(r.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 Vt.fromString(e,!0);case"utf16":case"utf16be":return Vt.fromString(e);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToBase64(e){const r=we.toUint8Array(e);if(typeof btoa!="undefined"){const i=this.ToString(r,"binary");return btoa(i)}else return Buffer.from(r).toString("base64")}static FromBase64(e){const r=this.formatString(e);if(!r)return new ArrayBuffer(0);if(!Ve.isBase64(r))throw new TypeError("Argument 'base64Text' is not Base64 encoded");return typeof atob!="undefined"?this.FromBinary(atob(r)):new Uint8Array(Buffer.from(r,"base64")).buffer}static FromBase64Url(e){const r=this.formatString(e);if(!r)return new ArrayBuffer(0);if(!Ve.isBase64Url(r))throw new TypeError("Argument 'base64url' is not Base64Url encoded");return this.FromBase64(this.Base64Padding(r.replace(/\-/g,"+").replace(/\_/g,"/")))}static ToBase64Url(e){return this.ToBase64(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}static FromUtf8String(e,r=Ve.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.FromBinary(e);case"utf8":return iu.fromString(e);case"utf16":case"utf16be":return Vt.fromString(e);case"utf16le":case"usc2":return Vt.fromString(e,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static ToUtf8String(e,r=Ve.DEFAULT_UTF8_ENCODING){switch(r){case"ascii":return this.ToBinary(e);case"utf8":return iu.toString(e);case"utf16":case"utf16be":return Vt.toString(e);case"utf16le":case"usc2":return Vt.toString(e,!0);default:throw new Error(`Unknown type of encoding '${r}'`)}}static FromBinary(e){const r=e.length,i=new Uint8Array(r);for(let o=0;o<r;o++)i[o]=e.charCodeAt(o);return i.buffer}static ToBinary(e){const r=we.toUint8Array(e);let i="";for(let o=0;o<r.length;o++)i+=String.fromCharCode(r[o]);return i}static ToHex(e){const r=we.toUint8Array(e);let i="";const o=r.length;for(let u=0;u<o;u++){const l=r[u];l<16&&(i+="0"),i+=l.toString(16)}return i}static FromHex(e){let r=this.formatString(e);if(!r)return new ArrayBuffer(0);if(!Ve.isHex(r))throw new TypeError("Argument 'hexString' is not HEX encoded");r.length%2&&(r=`0${r}`);const i=new Uint8Array(r.length/2);for(let o=0;o<r.length;o=o+2){const u=r.slice(o,o+2);i[o/2]=parseInt(u,16)}return i.buffer}static ToUtf16String(e,r=!1){return Vt.toString(e,r)}static FromUtf16String(e,r=!1){return Vt.fromString(e,r)}static Base64Padding(e){const r=4-e.length%4;if(r<4)for(let i=0;i<r;i++)e+="=";return e}static formatString(e){return(e==null?void 0:e.replace(/[\n\r\t ]/g,""))||""}}Ve.DEFAULT_UTF8_ENCODING="utf8";function Vl(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const r=new Uint8Array(n),i=new Uint8Array(e);for(let o=0;o<n.byteLength;o++)if(r[o]!==i[o])return!1;return!0}/*!
35
41
  Copyright (c) Peculiar Ventures, LLC
36
- */function Qe(r,e){let t=0;if(r.length===1)return r[0];for(let i=r.length-1;i>=0;i--)t+=r[r.length-1-i]*Math.pow(2,e*i);return t}function Le(r,e,t=-1){const i=t;let n=r,o=0,s=Math.pow(2,e);for(let c=1;c<8;c++){if(r<s){let l;if(i<0)l=new ArrayBuffer(c),o=c;else{if(i<c)return new ArrayBuffer(0);l=new ArrayBuffer(i),o=i}const f=new Uint8Array(l);for(let h=c-1;h>=0;h--){const d=Math.pow(2,h*e);f[o-h-1]=Math.floor(n/d),n-=f[o-h-1]*d}return l}s*=Math.pow(2,e)}return new ArrayBuffer(0)}function ni(...r){let e=0,t=0;for(const o of r)e+=o.length;const i=new ArrayBuffer(e),n=new Uint8Array(i);for(const o of r)n.set(o,t),t+=o.length;return n}function ao(){const r=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const c=r[0]===255&&r[1]&128,l=r[0]===0&&(r[1]&128)===0;(c||l)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),t=new Uint8Array(e);for(let c=0;c<this.valueHex.byteLength;c++)t[c]=0;t[0]=r[0]&128;const i=Qe(t,8),n=new ArrayBuffer(this.valueHex.byteLength),o=new Uint8Array(n);for(let c=0;c<this.valueHex.byteLength;c++)o[c]=r[c];return o[0]&=127,Qe(o,8)-i}function Va(r){const e=r<0?r*-1:r;let t=128;for(let i=1;i<8;i++){if(e<=t){if(r<0){const s=t-e,c=Le(s,8,i),l=new Uint8Array(c);return l[0]|=128,c}let n=Le(e,8,i),o=new Uint8Array(n);if(o[0]&128){const s=n.slice(0),c=new Uint8Array(s);n=new ArrayBuffer(n.byteLength+1),o=new Uint8Array(n);for(let l=0;l<s.byteLength;l++)o[l+1]=c[l];o[0]=0}return n}t*=Math.pow(2,8)}return new ArrayBuffer(0)}function Ua(r,e){if(r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<t.length;n++)if(t[n]!==i[n])return!1;return!0}function ie(r,e){const t=r.toString(10);if(e<t.length)return"";const i=e-t.length,n=new Array(i);for(let s=0;s<i;s++)n[s]="0";return n.join("").concat(t)}/*!
42
+ */function Or(n,e){let r=0;if(n.length===1)return n[0];for(let i=n.length-1;i>=0;i--)r+=n[n.length-1-i]*Math.pow(2,e*i);return r}function cr(n,e,r=-1){const i=r;let o=n,u=0,l=Math.pow(2,e);for(let f=1;f<8;f++){if(n<l){let p;if(i<0)p=new ArrayBuffer(f),u=f;else{if(i<f)return new ArrayBuffer(0);p=new ArrayBuffer(i),u=i}const g=new Uint8Array(p);for(let N=f-1;N>=0;N--){const E=Math.pow(2,N*e);g[u-N-1]=Math.floor(o/E),o-=g[u-N-1]*E}return p}l*=Math.pow(2,e)}return new ArrayBuffer(0)}function ji(...n){let e=0,r=0;for(const u of n)e+=u.length;const i=new ArrayBuffer(e),o=new Uint8Array(i);for(const u of n)o.set(u,r),r+=u.length;return o}function ou(){const n=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const f=n[0]===255&&n[1]&128,p=n[0]===0&&(n[1]&128)===0;(f||p)&&this.warnings.push("Needlessly long format")}const e=new ArrayBuffer(this.valueHex.byteLength),r=new Uint8Array(e);for(let f=0;f<this.valueHex.byteLength;f++)r[f]=0;r[0]=n[0]&128;const i=Or(r,8),o=new ArrayBuffer(this.valueHex.byteLength),u=new Uint8Array(o);for(let f=0;f<this.valueHex.byteLength;f++)u[f]=n[f];return u[0]&=127,Or(u,8)-i}function Hl(n){const e=n<0?n*-1:n;let r=128;for(let i=1;i<8;i++){if(e<=r){if(n<0){const l=r-e,f=cr(l,8,i),p=new Uint8Array(f);return p[0]|=128,f}let o=cr(e,8,i),u=new Uint8Array(o);if(u[0]&128){const l=o.slice(0),f=new Uint8Array(l);o=new ArrayBuffer(o.byteLength+1),u=new Uint8Array(o);for(let p=0;p<l.byteLength;p++)u[p+1]=f[p];u[0]=0}return o}r*=Math.pow(2,8)}return new ArrayBuffer(0)}function ql(n,e){if(n.byteLength!==e.byteLength)return!1;const r=new Uint8Array(n),i=new Uint8Array(e);for(let o=0;o<r.length;o++)if(r[o]!==i[o])return!1;return!0}function Nt(n,e){const r=n.toString(10);if(e<r.length)return"";const i=e-r.length,o=new Array(i);for(let l=0;l<i;l++)o[l]="0";return o.join("").concat(r)}/*!
37
43
  * Copyright (c) 2014, GMO GlobalSign
38
44
  * Copyright (c) 2015-2022, Peculiar Ventures
39
45
  * All rights reserved.
@@ -65,15 +71,15 @@ ${t.join(`
65
71
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
66
72
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67
73
  *
68
- */function Jt(){if(typeof BigInt=="undefined")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function oi(r){let e=0,t=0;for(let n=0;n<r.length;n++){const o=r[n];e+=o.byteLength}const i=new Uint8Array(e);for(let n=0;n<r.length;n++){const o=r[n];i.set(new Uint8Array(o),t),t+=o.byteLength}return i.buffer}function ke(r,e,t,i){return e instanceof Uint8Array?e.byteLength?t<0?(r.error="Wrong parameter: inputOffset less than zero",!1):i<0?(r.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-t-i<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)}class Yt{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return oi(this.items)}}const bt=[new Uint8Array([1])],co="0123456789",si="name",lo="valueHexView",ja="isHexOnly",Da="idBlock",Ra="tagClass",La="tagNumber",Ha="isConstructed",$a="fromBER",Ma="toBER",Pa="local",ee="",le=new ArrayBuffer(0),Zt=new Uint8Array(0),At="EndOfContent",uo="OCTET STRING",fo="BIT STRING";function we(r){var e;return e=class extends r{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}constructor(...i){var n;super(...i);const o=i[0]||{};this.isHexOnly=(n=o.isHexOnly)!==null&&n!==void 0?n:!1,this.valueHexView=o.valueHex?I.toUint8Array(o.valueHex):Zt}fromBER(i,n,o){const s=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!ke(this,s,n,o))return-1;const c=n+o;return this.valueHexView=s.subarray(n,c),this.valueHexView.length?(this.blockLength=o,c):(this.warnings.push("Zero buffer length"),n)}toBER(i=!1){return this.isHexOnly?i?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",le)}toJSON(){return P(j({},super.toJSON()),{isHexOnly:this.isHexOnly,valueHex:L.ToHex(this.valueHexView)})}},e.NAME="hexBlock",e}class He{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=ee,warnings:i=[],valueBeforeDecode:n=Zt}={}){this.blockLength=e,this.error=t,this.warnings=i,this.valueBeforeDecodeView=I.toUint8Array(n)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:L.ToHex(this.valueBeforeDecodeView)}}}He.NAME="baseBlock";class Y extends He{fromBER(e,t,i){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'")}}Y.NAME="valueBlock";class ho extends we(He){constructor({idBlock:e={}}={}){var t,i,n,o;super(),e?(this.isHexOnly=(t=e.isHexOnly)!==null&&t!==void 0?t:!1,this.valueHexView=e.valueHex?I.toUint8Array(e.valueHex):Zt,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(n=e.tagNumber)!==null&&n!==void 0?n:-1,this.isConstructed=(o=e.isConstructed)!==null&&o!==void 0?o:!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",le}if(this.isConstructed&&(t|=32),this.tagNumber<31&&!this.isHexOnly){const n=new Uint8Array(1);if(!e){let o=this.tagNumber;o&=31,t|=o,n[0]=t}return n.buffer}if(!this.isHexOnly){const n=Le(this.tagNumber,7),o=new Uint8Array(n),s=n.byteLength,c=new Uint8Array(s+1);if(c[0]=t|31,!e){for(let l=0;l<s-1;l++)c[l+1]=o[l]|128;c[s]=o[s-1]}return c.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=t|31,!e){const n=this.valueHexView;for(let o=0;o<n.length-1;o++)i[o+1]=n[o]|128;i[this.valueHexView.byteLength]=n[n.length-1]}return i.buffer}fromBER(e,t,i){const n=I.toUint8Array(e);if(!ke(this,n,t,i))return-1;const o=n.subarray(t,t+i);if(o.length===0)return this.error="Zero buffer length",-1;switch(o[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=(o[0]&32)===32,this.isHexOnly=!1;const c=o[0]&31;if(c!==31)this.tagNumber=c,this.blockLength=1;else{let l=1,f=this.valueHexView=new Uint8Array(255),h=255;for(;o[l]&128;){if(f[l-1]=o[l]&127,l++,l>=o.length)return this.error="End of input reached before message was fully decoded",-1;if(l===h){h+=255;const g=new Uint8Array(h);for(let y=0;y<f.length;y++)g[y]=f[y];f=this.valueHexView=new Uint8Array(h)}}this.blockLength=l+1,f[l-1]=o[l]&127;const d=new Uint8Array(l);for(let g=0;g<l;g++)d[g]=f[g];f=this.valueHexView=new Uint8Array(l),f.set(d),this.blockLength<=9?this.tagNumber=Qe(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 P(j({},super.toJSON()),{tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed})}}ho.NAME="identificationBlock";class po extends He{constructor({lenBlock:e={}}={}){var t,i,n;super(),this.isIndefiniteForm=(t=e.isIndefiniteForm)!==null&&t!==void 0?t:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(n=e.length)!==null&&n!==void 0?n:0}fromBER(e,t,i){const n=I.toUint8Array(e);if(!ke(this,n,t,i))return-1;const o=n.subarray(t,t+i);if(o.length===0)return this.error="Zero buffer length",-1;if(o[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=o[0]===128,this.isIndefiniteForm)return this.blockLength=1,t+this.blockLength;if(this.longFormUsed=!!(o[0]&128),this.longFormUsed===!1)return this.length=o[0],this.blockLength=1,t+this.blockLength;const s=o[0]&127;if(s>8)return this.error="Too big integer",-1;if(s+1>o.length)return this.error="End of input reached before message was fully decoded",-1;const c=t+1,l=n.subarray(c,c+s);return l[s-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Qe(l,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=s+1,t+this.blockLength}toBER(e=!1){let t,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=128),t;if(this.longFormUsed){const n=Le(this.length,8);if(n.byteLength>127)return this.error="Too big length",le;if(t=new ArrayBuffer(n.byteLength+1),e)return t;const o=new Uint8Array(n);i=new Uint8Array(t),i[0]=n.byteLength|128;for(let s=0;s<n.byteLength;s++)i[s+1]=o[s];return t}return t=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(t),i[0]=this.length),t}toJSON(){return P(j({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length})}}po.NAME="lengthBlock";const A={};class G extends He{constructor(s={},o){var c=s,{name:e=ee,optional:t=!1,primitiveSchema:i}=c,n=H(c,["name","optional","primitiveSchema"]);super(n),this.name=e,this.optional=t,i&&(this.primitiveSchema=i),this.idBlock=new ho(n),this.lenBlock=new po(n),this.valueBlock=o?new o(n):new Y(n)}fromBER(e,t,i){const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(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),n)}toBER(e,t){const i=t||new Yt;t||yo(this);const n=this.idBlock.toBER(e);if(i.write(n),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const o=this.valueBlock.toBER(e);this.lenBlock.length=o.byteLength;const s=this.lenBlock.toBER(e);i.write(s),i.write(o)}return t?le:i.final()}toJSON(){const e=P(j({},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():L.ToHex(this.toBER())}onAsciiEncoding(){const e=this.constructor.NAME,t=L.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${t}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const t=this.toBER(),i=e.toBER();return Ua(t,i)}}G.NAME="BaseBlock";function yo(r){var e;if(r instanceof A.Constructed)for(const t of r.valueBlock.value)yo(t)&&(r.lenBlock.isIndefiniteForm=!0);return!!(!((e=r.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}class ai extends G{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(n={},i){var o=n,{value:e=ee}=o,t=H(o,["value"]);super(t,i),e&&this.fromString(e)}fromBER(e,t,i){const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(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),n)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}ai.NAME="BaseStringBlock";class go extends we(Y){constructor(i={}){var n=i,{isHexOnly:e=!0}=n,t=H(n,["isHexOnly"]);super(t),this.isHexOnly=e}}go.NAME="PrimitiveValueBlock";var vo;class St extends G{constructor(e={}){super(e,go),this.idBlock.isConstructed=!1}}vo=St,A.Primitive=vo,St.NAME="PRIMITIVE";function _a(r,e){if(r instanceof e)return r;const t=new e;return t.idBlock=r.idBlock,t.lenBlock=r.lenBlock,t.warnings=r.warnings,t.valueBeforeDecodeView=r.valueBeforeDecodeView,t}function et(r,e=0,t=r.length){const i=e;let n=new G({},Y);const o=new He;if(!ke(o,r,e,t))return n.error=o.error,{offset:-1,result:n};if(!r.subarray(e,e+t).length)return n.error="Zero buffer length",{offset:-1,result:n};let c=n.idBlock.fromBER(r,e,t);if(n.idBlock.warnings.length&&n.warnings.concat(n.idBlock.warnings),c===-1)return n.error=n.idBlock.error,{offset:-1,result:n};if(e=c,t-=n.idBlock.blockLength,c=n.lenBlock.fromBER(r,e,t),n.lenBlock.warnings.length&&n.warnings.concat(n.lenBlock.warnings),c===-1)return n.error=n.lenBlock.error,{offset:-1,result:n};if(e=c,t-=n.lenBlock.blockLength,!n.idBlock.isConstructed&&n.lenBlock.isIndefiniteForm)return n.error="Indefinite length form used for primitive encoding form",{offset:-1,result:n};let l=G;switch(n.idBlock.tagClass){case 1:if(n.idBlock.tagNumber>=37&&n.idBlock.isHexOnly===!1)return n.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:n};switch(n.idBlock.tagNumber){case 0:if(n.idBlock.isConstructed&&n.lenBlock.length>0)return n.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:n};l=A.EndOfContent;break;case 1:l=A.Boolean;break;case 2:l=A.Integer;break;case 3:l=A.BitString;break;case 4:l=A.OctetString;break;case 5:l=A.Null;break;case 6:l=A.ObjectIdentifier;break;case 10:l=A.Enumerated;break;case 12:l=A.Utf8String;break;case 13:l=A.RelativeObjectIdentifier;break;case 14:l=A.TIME;break;case 15:return n.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:n};case 16:l=A.Sequence;break;case 17:l=A.Set;break;case 18:l=A.NumericString;break;case 19:l=A.PrintableString;break;case 20:l=A.TeletexString;break;case 21:l=A.VideotexString;break;case 22:l=A.IA5String;break;case 23:l=A.UTCTime;break;case 24:l=A.GeneralizedTime;break;case 25:l=A.GraphicString;break;case 26:l=A.VisibleString;break;case 27:l=A.GeneralString;break;case 28:l=A.UniversalString;break;case 29:l=A.CharacterString;break;case 30:l=A.BmpString;break;case 31:l=A.DATE;break;case 32:l=A.TimeOfDay;break;case 33:l=A.DateTime;break;case 34:l=A.Duration;break;default:{const f=n.idBlock.isConstructed?new A.Constructed:new A.Primitive;f.idBlock=n.idBlock,f.lenBlock=n.lenBlock,f.warnings=n.warnings,n=f}}break;case 2:case 3:case 4:default:l=n.idBlock.isConstructed?A.Constructed:A.Primitive}return n=_a(n,l),c=n.fromBER(r,e,n.lenBlock.isIndefiniteForm?t:n.lenBlock.length),n.valueBeforeDecodeView=r.subarray(i,i+n.blockLength),{offset:c,result:n}}function tt(r){if(!r.byteLength){const e=new G({},Y);return e.error="Input buffer has zero length",{offset:-1,result:e}}return et(I.toUint8Array(r).slice(),0,r.byteLength)}function qa(r,e){return r?1:e}class Ue extends Y{constructor(n={}){var o=n,{value:e=[],isIndefiniteForm:t=!1}=o,i=H(o,["value","isIndefiniteForm"]);super(i),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,i){const n=I.toUint8Array(e);if(!ke(this,n,t,i))return-1;if(this.valueBeforeDecodeView=n.subarray(t,t+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),t;let o=t;for(;qa(this.isIndefiniteForm,i)>0;){const s=et(n,o,i);if(s.offset===-1)return this.error=s.result.error,this.warnings.concat(s.result.warnings),-1;if(o=s.offset,this.blockLength+=s.result.blockLength,i-=s.result.blockLength,this.value.push(s.result),this.isIndefiniteForm&&s.result.constructor.NAME===At)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===At?this.value.pop():this.warnings.push("No EndOfContent block encoded")),o}toBER(e,t){const i=t||new Yt;for(let n=0;n<this.value.length;n++)this.value[n].toBER(e,i);return t?le:i.final()}toJSON(){const e=P(j({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,value:[]});for(const t of this.value)e.value.push(t.toJSON());return e}}Ue.NAME="ConstructedValueBlock";var mo;class Z extends G{constructor(e={}){super(e,Ue),this.idBlock.isConstructed=!0}fromBER(e,t,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const n=this.valueBlock.fromBER(e,t,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return n===-1?(this.error=this.valueBlock.error,n):(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),n)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
69
- `).map(n=>` ${n}`).join(`
70
- `));const t=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :
74
+ */function Rn(){if(typeof BigInt=="undefined")throw new Error("BigInt is not defined. Your environment doesn't implement BigInt.")}function $i(n){let e=0,r=0;for(let o=0;o<n.length;o++){const u=n[o];e+=u.byteLength}const i=new Uint8Array(e);for(let o=0;o<n.length;o++){const u=n[o];i.set(new Uint8Array(u),r),r+=u.byteLength}return i.buffer}function zt(n,e,r,i){return e instanceof Uint8Array?e.byteLength?r<0?(n.error="Wrong parameter: inputOffset less than zero",!1):i<0?(n.error="Wrong parameter: inputLength less than zero",!1):e.byteLength-r-i<0?(n.error="End of input reached before message was fully decoded (inconsistent offset and length values)",!1):!0:(n.error="Wrong parameter: inputBuffer has zero length",!1):(n.error="Wrong parameter: inputBuffer must be 'Uint8Array'",!1)}class kn{constructor(){this.items=[]}write(e){this.items.push(e)}final(){return $i(this.items)}}const Zr=[new Uint8Array([1])],su="0123456789",Gi="name",uu="valueHexView",jl="isHexOnly",$l="idBlock",Gl="tagClass",Xl="tagNumber",Wl="isConstructed",zl="fromBER",Yl="toBER",Jl="local",mt="",Ht=new ArrayBuffer(0),_n=new Uint8Array(0),en="EndOfContent",au="OCTET STRING",lu="BIT STRING";function qt(n){var e;return e=class extends n{get valueHex(){return this.valueHexView.slice().buffer}set valueHex(i){this.valueHexView=new Uint8Array(i)}constructor(...i){var o;super(...i);const u=i[0]||{};this.isHexOnly=(o=u.isHexOnly)!==null&&o!==void 0?o:!1,this.valueHexView=u.valueHex?we.toUint8Array(u.valueHex):_n}fromBER(i,o,u){const l=i instanceof ArrayBuffer?new Uint8Array(i):i;if(!zt(this,l,o,u))return-1;const f=o+u;return this.valueHexView=l.subarray(o,f),this.valueHexView.length?(this.blockLength=u,f):(this.warnings.push("Zero buffer length"),o)}toBER(i=!1){return this.isHexOnly?i?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",Ht)}toJSON(){return Qe(Fe({},super.toJSON()),{isHexOnly:this.isHexOnly,valueHex:Ve.ToHex(this.valueHexView)})}},e.NAME="hexBlock",e}class fr{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:r=mt,warnings:i=[],valueBeforeDecode:o=_n}={}){this.blockLength=e,this.error=r,this.warnings=i,this.valueBeforeDecodeView=we.toUint8Array(o)}toJSON(){return{blockName:this.constructor.NAME,blockLength:this.blockLength,error:this.error,warnings:this.warnings,valueBeforeDecode:Ve.ToHex(this.valueBeforeDecodeView)}}}fr.NAME="baseBlock";class ht extends fr{fromBER(e,r,i){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}toBER(e,r){throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'")}}ht.NAME="valueBlock";class cu extends qt(fr){constructor({idBlock:e={}}={}){var r,i,o,u;super(),e?(this.isHexOnly=(r=e.isHexOnly)!==null&&r!==void 0?r:!1,this.valueHexView=e.valueHex?we.toUint8Array(e.valueHex):_n,this.tagClass=(i=e.tagClass)!==null&&i!==void 0?i:-1,this.tagNumber=(o=e.tagNumber)!==null&&o!==void 0?o:-1,this.isConstructed=(u=e.isConstructed)!==null&&u!==void 0?u:!1):(this.tagClass=-1,this.tagNumber=-1,this.isConstructed=!1)}toBER(e=!1){let r=0;switch(this.tagClass){case 1:r|=0;break;case 2:r|=64;break;case 3:r|=128;break;case 4:r|=192;break;default:return this.error="Unknown tag class",Ht}if(this.isConstructed&&(r|=32),this.tagNumber<31&&!this.isHexOnly){const o=new Uint8Array(1);if(!e){let u=this.tagNumber;u&=31,r|=u,o[0]=r}return o.buffer}if(!this.isHexOnly){const o=cr(this.tagNumber,7),u=new Uint8Array(o),l=o.byteLength,f=new Uint8Array(l+1);if(f[0]=r|31,!e){for(let p=0;p<l-1;p++)f[p+1]=u[p]|128;f[l]=u[l-1]}return f.buffer}const i=new Uint8Array(this.valueHexView.byteLength+1);if(i[0]=r|31,!e){const o=this.valueHexView;for(let u=0;u<o.length-1;u++)i[u+1]=o[u]|128;i[this.valueHexView.byteLength]=o[o.length-1]}return i.buffer}fromBER(e,r,i){const o=we.toUint8Array(e);if(!zt(this,o,r,i))return-1;const u=o.subarray(r,r+i);if(u.length===0)return this.error="Zero buffer length",-1;switch(u[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=(u[0]&32)===32,this.isHexOnly=!1;const f=u[0]&31;if(f!==31)this.tagNumber=f,this.blockLength=1;else{let p=1,g=this.valueHexView=new Uint8Array(255),N=255;for(;u[p]&128;){if(g[p-1]=u[p]&127,p++,p>=u.length)return this.error="End of input reached before message was fully decoded",-1;if(p===N){N+=255;const S=new Uint8Array(N);for(let C=0;C<g.length;C++)S[C]=g[C];g=this.valueHexView=new Uint8Array(N)}}this.blockLength=p+1,g[p-1]=u[p]&127;const E=new Uint8Array(p);for(let S=0;S<p;S++)E[S]=g[S];g=this.valueHexView=new Uint8Array(p),g.set(E),this.blockLength<=9?this.tagNumber=Or(g,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 r+this.blockLength}toJSON(){return Qe(Fe({},super.toJSON()),{tagClass:this.tagClass,tagNumber:this.tagNumber,isConstructed:this.isConstructed})}}cu.NAME="identificationBlock";class fu extends fr{constructor({lenBlock:e={}}={}){var r,i,o;super(),this.isIndefiniteForm=(r=e.isIndefiniteForm)!==null&&r!==void 0?r:!1,this.longFormUsed=(i=e.longFormUsed)!==null&&i!==void 0?i:!1,this.length=(o=e.length)!==null&&o!==void 0?o:0}fromBER(e,r,i){const o=we.toUint8Array(e);if(!zt(this,o,r,i))return-1;const u=o.subarray(r,r+i);if(u.length===0)return this.error="Zero buffer length",-1;if(u[0]===255)return this.error="Length block 0xFF is reserved by standard",-1;if(this.isIndefiniteForm=u[0]===128,this.isIndefiniteForm)return this.blockLength=1,r+this.blockLength;if(this.longFormUsed=!!(u[0]&128),this.longFormUsed===!1)return this.length=u[0],this.blockLength=1,r+this.blockLength;const l=u[0]&127;if(l>8)return this.error="Too big integer",-1;if(l+1>u.length)return this.error="End of input reached before message was fully decoded",-1;const f=r+1,p=o.subarray(f,f+l);return p[l-1]===0&&this.warnings.push("Needlessly long encoded length"),this.length=Or(p,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=l+1,r+this.blockLength}toBER(e=!1){let r,i;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return r=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(r),i[0]=128),r;if(this.longFormUsed){const o=cr(this.length,8);if(o.byteLength>127)return this.error="Too big length",Ht;if(r=new ArrayBuffer(o.byteLength+1),e)return r;const u=new Uint8Array(o);i=new Uint8Array(r),i[0]=o.byteLength|128;for(let l=0;l<o.byteLength;l++)i[l+1]=u[l];return r}return r=new ArrayBuffer(1),e===!1&&(i=new Uint8Array(r),i[0]=this.length),r}toJSON(){return Qe(Fe({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,longFormUsed:this.longFormUsed,length:this.length})}}fu.NAME="lengthBlock";const te={};class st extends fr{constructor(l={},u){var f=l,{name:e=mt,optional:r=!1,primitiveSchema:i}=f,o=We(f,["name","optional","primitiveSchema"]);super(o),this.name=e,this.optional=r,i&&(this.primitiveSchema=i),this.idBlock=new cu(o),this.lenBlock=new fu(o),this.valueBlock=u?new u(o):new ht(o)}fromBER(e,r,i){const o=this.valueBlock.fromBER(e,r,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}toBER(e,r){const i=r||new kn;r||pu(this);const o=this.idBlock.toBER(e);if(i.write(o),this.lenBlock.isIndefiniteForm)i.write(new Uint8Array([128]).buffer),this.valueBlock.toBER(e,i),i.write(new ArrayBuffer(2));else{const u=this.valueBlock.toBER(e);this.lenBlock.length=u.byteLength;const l=this.lenBlock.toBER(e);i.write(l),i.write(u)}return r?Ht:i.final()}toJSON(){const e=Qe(Fe({},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():Ve.ToHex(this.toBER())}onAsciiEncoding(){const e=this.constructor.NAME,r=Ve.ToHex(this.valueBlock.valueBeforeDecodeView);return`${e} : ${r}`}isEqual(e){if(this===e)return!0;if(!(e instanceof this.constructor))return!1;const r=this.toBER(),i=e.toBER();return ql(r,i)}}st.NAME="BaseBlock";function pu(n){var e;if(n instanceof te.Constructed)for(const r of n.valueBlock.value)pu(r)&&(n.lenBlock.isIndefiniteForm=!0);return!!(!((e=n.lenBlock)===null||e===void 0)&&e.isIndefiniteForm)}class Xi extends st{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(o={},i){var u=o,{value:e=mt}=u,r=We(u,["value"]);super(r,i),e&&this.fromString(e)}fromBER(e,r,i){const o=this.valueBlock.fromBER(e,r,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){return`${this.constructor.NAME} : '${this.valueBlock.value}'`}}Xi.NAME="BaseStringBlock";class hu extends qt(ht){constructor(i={}){var o=i,{isHexOnly:e=!0}=o,r=We(o,["isHexOnly"]);super(r),this.isHexOnly=e}}hu.NAME="PrimitiveValueBlock";var du;class tn extends st{constructor(e={}){super(e,hu),this.idBlock.isConstructed=!1}}du=tn,te.Primitive=du,tn.NAME="PRIMITIVE";function Kl(n,e){if(n instanceof e)return n;const r=new e;return r.idBlock=n.idBlock,r.lenBlock=n.lenBlock,r.warnings=n.warnings,r.valueBeforeDecodeView=n.valueBeforeDecodeView,r}function Ir(n,e=0,r=n.length){const i=e;let o=new st({},ht);const u=new fr;if(!zt(u,n,e,r))return o.error=u.error,{offset:-1,result:o};if(!n.subarray(e,e+r).length)return o.error="Zero buffer length",{offset:-1,result:o};let f=o.idBlock.fromBER(n,e,r);if(o.idBlock.warnings.length&&o.warnings.concat(o.idBlock.warnings),f===-1)return o.error=o.idBlock.error,{offset:-1,result:o};if(e=f,r-=o.idBlock.blockLength,f=o.lenBlock.fromBER(n,e,r),o.lenBlock.warnings.length&&o.warnings.concat(o.lenBlock.warnings),f===-1)return o.error=o.lenBlock.error,{offset:-1,result:o};if(e=f,r-=o.lenBlock.blockLength,!o.idBlock.isConstructed&&o.lenBlock.isIndefiniteForm)return o.error="Indefinite length form used for primitive encoding form",{offset:-1,result:o};let p=st;switch(o.idBlock.tagClass){case 1:if(o.idBlock.tagNumber>=37&&o.idBlock.isHexOnly===!1)return o.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:o};switch(o.idBlock.tagNumber){case 0:if(o.idBlock.isConstructed&&o.lenBlock.length>0)return o.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:o};p=te.EndOfContent;break;case 1:p=te.Boolean;break;case 2:p=te.Integer;break;case 3:p=te.BitString;break;case 4:p=te.OctetString;break;case 5:p=te.Null;break;case 6:p=te.ObjectIdentifier;break;case 10:p=te.Enumerated;break;case 12:p=te.Utf8String;break;case 13:p=te.RelativeObjectIdentifier;break;case 14:p=te.TIME;break;case 15:return o.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:o};case 16:p=te.Sequence;break;case 17:p=te.Set;break;case 18:p=te.NumericString;break;case 19:p=te.PrintableString;break;case 20:p=te.TeletexString;break;case 21:p=te.VideotexString;break;case 22:p=te.IA5String;break;case 23:p=te.UTCTime;break;case 24:p=te.GeneralizedTime;break;case 25:p=te.GraphicString;break;case 26:p=te.VisibleString;break;case 27:p=te.GeneralString;break;case 28:p=te.UniversalString;break;case 29:p=te.CharacterString;break;case 30:p=te.BmpString;break;case 31:p=te.DATE;break;case 32:p=te.TimeOfDay;break;case 33:p=te.DateTime;break;case 34:p=te.Duration;break;default:{const g=o.idBlock.isConstructed?new te.Constructed:new te.Primitive;g.idBlock=o.idBlock,g.lenBlock=o.lenBlock,g.warnings=o.warnings,o=g}}break;default:p=o.idBlock.isConstructed?te.Constructed:te.Primitive}return o=Kl(o,p),f=o.fromBER(n,e,o.lenBlock.isIndefiniteForm?r:o.lenBlock.length),o.valueBeforeDecodeView=n.subarray(i,i+o.blockLength),{offset:f,result:o}}function Rr(n){if(!n.byteLength){const e=new st({},ht);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Ir(we.toUint8Array(n).slice(),0,n.byteLength)}function Ql(n,e){return n?1:e}class sr extends ht{constructor(o={}){var u=o,{value:e=[],isIndefiniteForm:r=!1}=u,i=We(u,["value","isIndefiniteForm"]);super(i),this.value=e,this.isIndefiniteForm=r}fromBER(e,r,i){const o=we.toUint8Array(e);if(!zt(this,o,r,i))return-1;if(this.valueBeforeDecodeView=o.subarray(r,r+i),this.valueBeforeDecodeView.length===0)return this.warnings.push("Zero buffer length"),r;let u=r;for(;Ql(this.isIndefiniteForm,i)>0;){const l=Ir(o,u,i);if(l.offset===-1)return this.error=l.result.error,this.warnings.concat(l.result.warnings),-1;if(u=l.offset,this.blockLength+=l.result.blockLength,i-=l.result.blockLength,this.value.push(l.result),this.isIndefiniteForm&&l.result.constructor.NAME===en)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===en?this.value.pop():this.warnings.push("No EndOfContent block encoded")),u}toBER(e,r){const i=r||new kn;for(let o=0;o<this.value.length;o++)this.value[o].toBER(e,i);return r?Ht:i.final()}toJSON(){const e=Qe(Fe({},super.toJSON()),{isIndefiniteForm:this.isIndefiniteForm,value:[]});for(const r of this.value)e.value.push(r.toJSON());return e}}sr.NAME="ConstructedValueBlock";var gu;class dt extends st{constructor(e={}){super(e,sr),this.idBlock.isConstructed=!0}fromBER(e,r,i){this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm;const o=this.valueBlock.fromBER(e,r,this.lenBlock.isIndefiniteForm?i:this.lenBlock.length);return o===-1?(this.error=this.valueBlock.error,o):(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),o)}onAsciiEncoding(){const e=[];for(const i of this.valueBlock.value)e.push(i.toString("ascii").split(`
75
+ `).map(o=>` ${o}`).join(`
76
+ `));const r=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${r} :
71
77
  ${e.join(`
72
- `)}`:`${t} :`}}mo=Z,A.Constructed=mo,Z.NAME="CONSTRUCTED";class wo extends Y{fromBER(e,t,i){return t}toBER(e){return le}}wo.override="EndOfContentValueBlock";var bo;class ci extends G{constructor(e={}){super(e,wo),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}bo=ci,A.EndOfContent=bo,ci.NAME=At;var Ao;class $e extends G{constructor(e={}){super(e,Y),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,t+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+i}toBER(e,t){const i=new ArrayBuffer(2);if(!e){const n=new Uint8Array(i);n[0]=5,n[1]=0}return t&&t.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}Ao=$e,A.Null=Ao,$e.NAME="NULL";class So extends we(Y){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor(i={}){var n=i,{value:e}=n,t=H(n,["value"]);super(t),t.valueHex?this.valueHexView=I.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,t,i){const n=I.toUint8Array(e);return ke(this,n,t,i)?(this.valueHexView=n.subarray(t,t+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,ao.call(this),this.blockLength=i,t+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return P(j({},super.toJSON()),{value:this.value})}}So.NAME="BooleanValueBlock";var Bo;class Qt extends G{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,So),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}Bo=Qt,A.Boolean=Bo,Qt.NAME="BOOLEAN";class ko extends we(Ue){constructor(i={}){var n=i,{isConstructed:e=!1}=n,t=H(n,["isConstructed"]);super(t),this.isConstructed=e}fromBER(e,t,i){let n=0;if(this.isConstructed){if(this.isHexOnly=!1,n=Ue.prototype.fromBER.call(this,e,t,i),n===-1)return n;for(let o=0;o<this.value.length;o++){const s=this.value[o].constructor.NAME;if(s===At){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(s!==uo)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,n=super.fromBER(e,t,i),this.blockLength=i;return n}toBER(e,t){return this.isConstructed?Ue.prototype.toBER.call(this,e,t):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return P(j({},super.toJSON()),{isConstructed:this.isConstructed})}}ko.NAME="OctetStringValueBlock";var li;class Me extends G{constructor(n={}){var o=n,{idBlock:e={},lenBlock:t={}}=o,i=H(o,["idBlock","lenBlock"]);var s,c;(s=i.isConstructed)!==null&&s!==void 0||(i.isConstructed=!!(!((c=i.value)===null||c===void 0)&&c.length)),super(j({idBlock:j({isConstructed:i.isConstructed},e),lenBlock:P(j({},t),{isIndefiniteForm:!!i.isIndefiniteForm})},i),ko),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,t,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),t;if(!this.valueBlock.isConstructed){const o=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(t,t+i);try{if(o.byteLength){const s=et(o,0,o.byteLength);s.offset!==-1&&s.offset===i&&(this.valueBlock.value=[s.result])}}catch(s){}}return super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Z.prototype.onAsciiEncoding.call(this);const e=this.constructor.NAME,t=L.ToHex(this.valueBlock.valueHexView);return`${e} : ${t}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const t of this.valueBlock.value)t instanceof li&&e.push(t.valueBlock.valueHexView);return I.concat(e)}}li=Me,A.OctetString=li,Me.NAME=uo;class xo extends we(Ue){constructor(n={}){var o=n,{unusedBits:e=0,isConstructed:t=!1}=o,i=H(o,["unusedBits","isConstructed"]);super(i),this.unusedBits=e,this.isConstructed=t,this.blockLength=this.valueHexView.byteLength}fromBER(e,t,i){if(!i)return t;let n=-1;if(this.isConstructed){if(n=Ue.prototype.fromBER.call(this,e,t,i),n===-1)return n;for(const c of this.value){const l=c.constructor.NAME;if(l===At){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(l!==fo)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const f=c.valueBlock;if(this.unusedBits>0&&f.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=f.unusedBits}return n}const o=I.toUint8Array(e);if(!ke(this,o,t,i))return-1;const s=o.subarray(t,t+i);if(this.unusedBits=s[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const c=s.subarray(1);try{if(c.byteLength){const l=et(c,0,c.byteLength);l.offset!==-1&&l.offset===i-1&&(this.value=[l.result])}}catch(l){}}return this.valueHexView=s.subarray(1),this.blockLength=s.length,t+i}toBER(e,t){if(this.isConstructed)return Ue.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return le;const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return P(j({},super.toJSON()),{unusedBits:this.unusedBits,isConstructed:this.isConstructed})}}xo.NAME="BitStringValueBlock";var No;class Pe extends G{constructor(n={}){var o=n,{idBlock:e={},lenBlock:t={}}=o,i=H(o,["idBlock","lenBlock"]);var s,c;(s=i.isConstructed)!==null&&s!==void 0||(i.isConstructed=!!(!((c=i.value)===null||c===void 0)&&c.length)),super(j({idBlock:j({isConstructed:i.isConstructed},e),lenBlock:P(j({},t),{isIndefiniteForm:!!i.isIndefiniteForm})},i),xo),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Z.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const s of t)e.push(s.toString(2).padStart(8,"0"));const i=e.join(""),n=this.constructor.NAME,o=i.substring(0,i.length-this.valueBlock.unusedBits);return`${n} : ${o}`}}}No=Pe,A.BitString=No,Pe.NAME=fo;var Co;function Fa(r,e){const t=new Uint8Array([0]),i=new Uint8Array(r),n=new Uint8Array(e);let o=i.slice(0);const s=o.length-1,c=n.slice(0),l=c.length-1;let f=0;const h=l<s?s:l;let d=0;for(let g=h;g>=0;g--,d++){switch(!0){case d<c.length:f=o[s-d]+c[l-d]+t[0];break;default:f=o[s-d]+t[0]}switch(t[0]=f/10,!0){case d>=o.length:o=ni(new Uint8Array([f%10]),o);break;default:o[s-d]=f%10}}return t[0]>0&&(o=ni(t,o)),o}function Eo(r){if(r>=bt.length)for(let e=bt.length;e<=r;e++){const t=new Uint8Array([0]);let i=bt[e-1].slice(0);for(let n=i.length-1;n>=0;n--){const o=new Uint8Array([(i[n]<<1)+t[0]]);t[0]=o[0]/10,i[n]=o[0]%10}t[0]>0&&(i=ni(t,i)),bt.push(i)}return bt[r]}function Ga(r,e){let t=0;const i=new Uint8Array(r),n=new Uint8Array(e),o=i.slice(0),s=o.length-1,c=n.slice(0),l=c.length-1;let f,h=0;for(let d=l;d>=0;d--,h++)switch(f=o[s-h]-c[l-h]-t,!0){case f<0:t=1,o[s-h]=f+10;break;default:t=0,o[s-h]=f}if(t>0)for(let d=s-l+1;d>=0;d--,h++)if(f=o[s-h]-t,f<0)t=1,o[s-h]=f+10;else{t=0,o[s-h]=f;break}return o.slice()}class ui extends we(Y){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=ao.call(this)))}constructor(i={}){var n=i,{value:e}=n,t=H(n,["value"]);super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Va(e))}get valueDec(){return this._valueDec}fromDER(e,t,i,n=0){const o=this.fromBER(e,t,i);if(o===-1)return o;const s=this.valueHexView;return s[0]===0&&(s[1]&128)!==0?this.valueHexView=s.subarray(1):n!==0&&s.length<n&&(n-s.length>1&&(n=s.length+1),this.valueHexView=s.subarray(n-s.length)),o}toDER(e=!1){const t=this.valueHexView;switch(!0){case(t[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(t,1),this.valueHexView=i}break;case(t[0]===0&&(t[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,t,i){const n=super.fromBER(e,t,i);return n===-1||this.setValueHex(),n}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return P(j({},super.toJSON()),{valueDec:this.valueDec})}toString(){const e=this.valueHexView.length*8-1;let t=new Uint8Array(this.valueHexView.length*8/3),i=0,n;const o=this.valueHexView;let s="",c=!1;for(let l=o.byteLength-1;l>=0;l--){n=o[l];for(let f=0;f<8;f++){if((n&1)===1)switch(i){case e:t=Ga(Eo(i),t),s="-";break;default:t=Fa(t,Eo(i))}i++,n>>=1}}for(let l=0;l<t.length;l++)t[l]&&(c=!0),c&&(s+=co.charAt(t[l]));return c===!1&&(s+=co.charAt(0)),s}}Co=ui,ui.NAME="IntegerValueBlock",Object.defineProperty(Co.prototype,"valueHex",{set:function(r){this.valueHexView=new Uint8Array(r),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var Bt;class rt extends G{constructor(e={}){super(e,ui),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Jt(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Jt();const t=BigInt(e),i=new Yt,n=t.toString(16).replace(/^-/,""),o=new Uint8Array(L.FromHex(n));if(t<0){const c=new Uint8Array(o.length+(o[0]&128?1:0));c[0]|=128;const f=BigInt(`0x${L.ToHex(c)}`)+t,h=I.toUint8Array(L.FromHex(f.toString(16)));h[0]|=128,i.write(h)}else o[0]&128&&i.write(new Uint8Array([0])),i.write(o);return new Bt({valueHex:i.final()})}convertToDER(){const e=new Bt({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new Bt({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}Bt=rt,A.Integer=Bt,rt.NAME="INTEGER";var Io;class er extends rt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}Io=er,A.Enumerated=Io,er.NAME="ENUMERATED";class fi extends we(Y){constructor(n={}){var o=n,{valueDec:e=-1,isFirstSid:t=!1}=o,i=H(o,["valueDec","isFirstSid"]);super(i),this.valueDec=e,this.isFirstSid=t}fromBER(e,t,i){if(!i)return t;const n=I.toUint8Array(e);if(!ke(this,n,t,i))return-1;const o=n.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(this.valueHexView[c]=o[c]&127,this.blockLength++,(o[c]&128)!==0);c++);const s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)s[c]=this.valueHexView[c];return this.valueHexView=s,(o[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Qe(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}set valueBigInt(e){Jt();let t=BigInt(e).toString(2);for(;t.length%7;)t="0"+t;const i=new Uint8Array(t.length/7);for(let n=0;n<i.length;n++)i[n]=parseInt(t.slice(n*7,n*7+7),2)+(n+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const n=this.valueHexView,o=new Uint8Array(this.blockLength);for(let s=0;s<this.blockLength-1;s++)o[s]=n[s]|128;return o[this.blockLength-1]=n[this.blockLength-1],o.buffer}const t=Le(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",le;const i=new Uint8Array(t.byteLength);if(!e){const n=new Uint8Array(t),o=t.byteLength-1;for(let s=0;s<o;s++)i[s]=n[s]|128;i[o]=n[o]}return i}toString(){let e="";if(this.isHexOnly)e=L.ToHex(this.valueHexView);else if(this.isFirstSid){let t=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",t-=40):(e="2.",t-=80),e+=t.toString()}else e=this.valueDec.toString();return e}toJSON(){return P(j({},super.toJSON()),{valueDec:this.valueDec,isFirstSid:this.isFirstSid})}}fi.NAME="sidBlock";class Oo extends Y{constructor(i={}){var n=i,{value:e=ee}=n,t=H(n,["value"]);super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let n=t;for(;i>0;){const o=new fi;if(n=o.fromBER(e,n,i),n===-1)return this.blockLength=0,this.error=o.error,n;this.value.length===0&&(o.isFirstSid=!0),this.blockLength+=o.blockLength,i-=o.blockLength,this.value.push(o)}return n}toBER(e){const t=[];for(let i=0;i<this.value.length;i++){const n=this.value[i].toBER(e);if(n.byteLength===0)return this.error=this.value[i].error,le;t.push(n)}return oi(t)}fromString(e){this.value=[];let t=0,i=0,n="",o=!1;do if(i=e.indexOf(".",t),i===-1?n=e.substring(t):n=e.substring(t,i),t=i+1,o){const s=this.value[0];let c=0;switch(s.valueDec){case 0:break;case 1:c=40;break;case 2:c=80;break;default:this.value=[];return}const l=parseInt(n,10);if(isNaN(l))return;s.valueDec=l+c,o=!1}else{const s=new fi;if(n>Number.MAX_SAFE_INTEGER){Jt();const c=BigInt(n);s.valueBigInt=c}else if(s.valueDec=parseInt(n,10),isNaN(s.valueDec))return;this.value.length||(s.isFirstSid=!0,o=!0),this.value.push(s)}while(i!==-1)}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let n=this.value[i].toString();i!==0&&(e=`${e}.`),t?(n=`{${n}}`,this.value[i].isFirstSid?e=`2.{${n} - 80}`:e+=n):e+=n}return e}toJSON(){const e=P(j({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}Oo.NAME="ObjectIdentifierValueBlock";var To;class tr extends G{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Oo),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return P(j({},super.toJSON()),{value:this.getValue()})}}To=tr,A.ObjectIdentifier=To,tr.NAME="OBJECT IDENTIFIER";class hi extends we(He){constructor(i={}){var n=i,{valueDec:e=0}=n,t=H(n,["valueDec"]);super(t),this.valueDec=e}fromBER(e,t,i){if(i===0)return t;const n=I.toUint8Array(e);if(!ke(this,n,t,i))return-1;const o=n.subarray(t,t+i);this.valueHexView=new Uint8Array(i);for(let c=0;c<i&&(this.valueHexView[c]=o[c]&127,this.blockLength++,(o[c]&128)!==0);c++);const s=new Uint8Array(this.blockLength);for(let c=0;c<this.blockLength;c++)s[c]=this.valueHexView[c];return this.valueHexView=s,(o[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Qe(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),t+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const n=this.valueHexView,o=new Uint8Array(this.blockLength);for(let s=0;s<this.blockLength-1;s++)o[s]=n[s]|128;return o[this.blockLength-1]=n[this.blockLength-1],o.buffer}const t=Le(this.valueDec,7);if(t.byteLength===0)return this.error="Error during encoding SID value",le;const i=new Uint8Array(t.byteLength);if(!e){const n=new Uint8Array(t),o=t.byteLength-1;for(let s=0;s<o;s++)i[s]=n[s]|128;i[o]=n[o]}return i.buffer}toString(){let e="";return this.isHexOnly?e=L.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return P(j({},super.toJSON()),{valueDec:this.valueDec})}}hi.NAME="relativeSidBlock";class Vo extends Y{constructor(i={}){var n=i,{value:e=ee}=n,t=H(n,["value"]);super(t),this.value=[],e&&this.fromString(e)}fromBER(e,t,i){let n=t;for(;i>0;){const o=new hi;if(n=o.fromBER(e,n,i),n===-1)return this.blockLength=0,this.error=o.error,n;this.blockLength+=o.blockLength,i-=o.blockLength,this.value.push(o)}return n}toBER(e,t){const i=[];for(let n=0;n<this.value.length;n++){const o=this.value[n].toBER(e);if(o.byteLength===0)return this.error=this.value[n].error,le;i.push(o)}return oi(i)}fromString(e){this.value=[];let t=0,i=0,n="";do{i=e.indexOf(".",t),i===-1?n=e.substring(t):n=e.substring(t,i),t=i+1;const o=new hi;if(o.valueDec=parseInt(n,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(i!==-1);return!0}toString(){let e="",t=!1;for(let i=0;i<this.value.length;i++){t=this.value[i].isHexOnly;let n=this.value[i].toString();i!==0&&(e=`${e}.`),t&&(n=`{${n}}`),e+=n}return e}toJSON(){const e=P(j({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let t=0;t<this.value.length;t++)e.sidArray.push(this.value[t].toJSON());return e}}Vo.NAME="RelativeObjectIdentifierValueBlock";var Uo;class pi extends G{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Vo),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return P(j({},super.toJSON()),{value:this.getValue()})}}Uo=pi,A.RelativeObjectIdentifier=Uo,pi.NAME="RelativeObjectIdentifier";var jo;class ue extends Z{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}jo=ue,A.Sequence=jo,ue.NAME="SEQUENCE";var Do;class be extends Z{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}}Do=be,A.Set=Do,be.NAME="SET";class Ro extends we(Y){constructor(t={}){var e=H(t,[]);super(e),this.isHexOnly=!0,this.value=ee}toJSON(){return P(j({},super.toJSON()),{value:this.value})}}Ro.NAME="StringValueBlock";class Lo extends Ro{}Lo.NAME="SimpleStringValueBlock";class ne extends ai{constructor(t={}){var e=H(t,[]);super(e,Lo)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,I.toUint8Array(e))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=e.charCodeAt(n);this.valueBlock.value=e}}ne.NAME="SIMPLE STRING";class Ho extends ne{fromBuffer(e){this.valueBlock.valueHexView=I.toUint8Array(e);try{this.valueBlock.value=L.ToUtf8String(e)}catch(t){this.warnings.push(`Error during "decodeURIComponent": ${t}, using raw string`),this.valueBlock.value=L.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(L.FromUtf8String(e)),this.valueBlock.value=e}}Ho.NAME="Utf8StringValueBlock";var $o;class xe extends Ho{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}$o=xe,A.Utf8String=$o,xe.NAME="UTF8String";class Mo extends ne{fromBuffer(e){this.valueBlock.value=L.ToUtf16String(e),this.valueBlock.valueHexView=I.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(L.FromUtf16String(e))}}Mo.NAME="BmpStringValueBlock";var Po;class rr extends Mo{constructor(t={}){var e=H(t,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}Po=rr,A.BmpString=Po,rr.NAME="BMPString";class _o extends ne{fromBuffer(e){const t=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(t);for(let n=0;n<i.length;n+=4)i[n]=i[n+3],i[n+1]=i[n+2],i[n+2]=0,i[n+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(t))}fromString(e){const t=e.length,i=this.valueBlock.valueHexView=new Uint8Array(t*4);for(let n=0;n<t;n++){const o=Le(e.charCodeAt(n),8),s=new Uint8Array(o);if(s.length>4)continue;const c=4-s.length;for(let l=s.length-1;l>=0;l--)i[n*4+l+c]=s[l]}this.valueBlock.value=e}}_o.NAME="UniversalStringValueBlock";var qo;class ir extends _o{constructor(t={}){var e=H(t,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}qo=ir,A.UniversalString=qo,ir.NAME="UniversalString";var Fo;class nr extends ne{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Fo=nr,A.NumericString=Fo,nr.NAME="NumericString";var Go;class or extends ne{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}Go=or,A.PrintableString=Go,or.NAME="PrintableString";var zo;class sr extends ne{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}zo=sr,A.TeletexString=zo,sr.NAME="TeletexString";var Xo;class ar extends ne{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}Xo=ar,A.VideotexString=Xo,ar.NAME="VideotexString";var Wo;class cr extends ne{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}Wo=cr,A.IA5String=Wo,cr.NAME="IA5String";var Ko;class lr extends ne{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Ko=lr,A.GraphicString=Ko,lr.NAME="GraphicString";var Jo;class kt extends ne{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Jo=kt,A.VisibleString=Jo,kt.NAME="VisibleString";var Yo;class ur extends ne{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}Yo=ur,A.GeneralString=Yo,ur.NAME="GeneralString";var Zo;class fr extends ne{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Zo=fr,A.CharacterString=Zo,fr.NAME="CharacterString";var Qo;class xt extends kt{constructor(n={}){var o=n,{value:e,valueDate:t}=o,i=H(o,["value","valueDate"]);if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let s=0;s<e.length;s++)this.valueBlock.valueHexView[s]=e.charCodeAt(s)}t&&(this.fromDate(t),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,I.toUint8Array(e)))}toBuffer(){const e=this.toString(),t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return t}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const n=parseInt(i[1],10);n>=50?this.year=1900+n:this.year=2e3+n,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const t=new Array(7);return t[0]=ie(this.year<2e3?this.year-1900:this.year-2e3,2),t[1]=ie(this.month,2),t[2]=ie(this.day,2),t[3]=ie(this.hour,2),t[4]=ie(this.minute,2),t[5]=ie(this.second,2),t[6]="Z",t.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return P(j({},super.toJSON()),{year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second})}}Qo=xt,A.UTCTime=Qo,xt.NAME="UTCTime";var es;class hr extends xt{constructor(e={}){var t;super(e),(t=this.millisecond)!==null&&t!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let t=!1,i="",n="",o=0,s,c=0,l=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),t=!0;else{const d=new Number(e[e.length-1]);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(t){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let d=1,g=i.indexOf("+"),y="";if(g===-1&&(g=i.indexOf("-"),d=-1),g!==-1){if(y=i.substring(g+1),i=i.substring(0,g),y.length!==2&&y.length!==4)throw new Error("Wrong input string for conversion");let v=parseInt(y.substring(0,2),10);if(isNaN(v.valueOf()))throw new Error("Wrong input string for conversion");if(c=d*v,y.length===4){if(v=parseInt(y.substring(2,4),10),isNaN(v.valueOf()))throw new Error("Wrong input string for conversion");l=d*v}}}let f=i.indexOf(".");if(f===-1&&(f=i.indexOf(",")),f!==-1){const d=new Number(`0${i.substring(f)}`);if(isNaN(d.valueOf()))throw new Error("Wrong input string for conversion");o=d.valueOf(),n=i.substring(0,f)}else n=i;switch(!0){case n.length===8:if(s=/(\d{4})(\d{2})(\d{2})/ig,f!==-1)throw new Error("Wrong input string for conversion");break;case n.length===10:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,f!==-1){let d=60*o;this.minute=Math.floor(d),d=60*(d-this.minute),this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case n.length===12:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,f!==-1){let d=60*o;this.second=Math.floor(d),d=1e3*(d-this.second),this.millisecond=Math.floor(d)}break;case n.length===14:if(s=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,f!==-1){const d=1e3*o;this.millisecond=Math.floor(d)}break;default:throw new Error("Wrong input string for conversion")}const h=s.exec(n);if(h===null)throw new Error("Wrong input string for conversion");for(let d=1;d<h.length;d++)switch(d){case 1:this.year=parseInt(h[d],10);break;case 2:this.month=parseInt(h[d],10);break;case 3:this.day=parseInt(h[d],10);break;case 4:this.hour=parseInt(h[d],10)+c;break;case 5:this.minute=parseInt(h[d],10)+l;break;case 6:this.second=parseInt(h[d],10);break;default:throw new Error("Wrong input string for conversion")}if(t===!1){const d=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=d.getUTCFullYear(),this.month=d.getUTCMonth(),this.day=d.getUTCDay(),this.hour=d.getUTCHours(),this.minute=d.getUTCMinutes(),this.second=d.getUTCSeconds(),this.millisecond=d.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const t=[];return t.push(ie(this.year,4)),t.push(ie(this.month,2)),t.push(ie(this.day,2)),t.push(ie(this.hour,2)),t.push(ie(this.minute,2)),t.push(ie(this.second,2)),this.millisecond!==0&&(t.push("."),t.push(ie(this.millisecond,3))),t.push("Z"),t.join("")}return super.toString(e)}toJSON(){return P(j({},super.toJSON()),{millisecond:this.millisecond})}}es=hr,A.GeneralizedTime=es,hr.NAME="GeneralizedTime";var ts;class di extends xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}ts=di,A.DATE=ts,di.NAME="DATE";var rs;class yi extends xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}rs=yi,A.TimeOfDay=rs,yi.NAME="TimeOfDay";var is;class gi extends xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}is=gi,A.DateTime=is,gi.NAME="DateTime";var ns;class vi extends xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}ns=vi,A.Duration=ns,vi.NAME="Duration";var os;class mi extends xe{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}os=mi,A.TIME=os,mi.NAME="TIME";class _e{constructor({name:e=ee,optional:t=!1}={}){this.name=e,this.optional=t}}class wi extends _e{constructor(i={}){var n=i,{value:e=[]}=n,t=H(n,["value"]);super(t),this.value=e}}class pr extends _e{constructor(n={}){var o=n,{value:e=new _e,local:t=!1}=o,i=H(o,["value","local"]);super(i),this.value=e,this.local=t}}class za{get data(){return this.dataView.slice().buffer}set data(e){this.dataView=I.toUint8Array(e)}constructor({data:e=Zt}={}){this.dataView=I.toUint8Array(e)}fromBER(e,t,i){const n=t+i;return this.dataView=I.toUint8Array(e).subarray(t,n),n}toBER(e){return this.dataView.slice().buffer}}function je(r,e,t){if(t instanceof wi){for(const o of t.value)if(je(r,e,o).verified)return{verified:!0,result:r};{const o={verified:!1,result:{error:"Wrong values for Choice type"}};return t.hasOwnProperty(si)&&(o.name=t.name),o}}if(t instanceof _e)return t.hasOwnProperty(si)&&(r[t.name]=e),{verified:!0,result:r};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Da in t))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!($a in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Ma in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=t.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(t.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(t.idBlock.hasOwnProperty(Ra)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(La)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:r};if(t.idBlock.hasOwnProperty(Ha)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:r};if(!(ja in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(t.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:r};if(t.idBlock.isHexOnly){if(!(lo in t.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=t.idBlock.valueHexView,s=e.idBlock.valueHexView;if(o.length!==s.length)return{verified:!1,result:r};for(let c=0;c<o.length;c++)if(o[c]!==s[1])return{verified:!1,result:r}}if(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,ee),t.name&&(r[t.name]=e)),t instanceof A.Constructed){let o=0,s={verified:!1,result:{error:"Unknown error"}},c=t.valueBlock.value.length;if(c>0&&t.valueBlock.value[0]instanceof pr&&(c=e.valueBlock.value.length),c===0)return{verified:!0,result:r};if(e.valueBlock.value.length===0&&t.valueBlock.value.length!==0){let l=!0;for(let f=0;f<t.valueBlock.value.length;f++)l=l&&(t.valueBlock.value[f].optional||!1);return l?{verified:!0,result:r}:(t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,ee),t.name&&delete r[t.name]),r.error="Inconsistent object length",{verified:!1,result:r})}for(let l=0;l<c;l++)if(l-o>=e.valueBlock.value.length){if(t.valueBlock.value[l].optional===!1){const f={verified:!1,result:r};return r.error="Inconsistent length between ASN.1 data and schema",t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,ee),t.name&&(delete r[t.name],f.name=t.name)),f}}else if(t.valueBlock.value[0]instanceof pr){if(s=je(r,e.valueBlock.value[l],t.valueBlock.value[0].value),s.verified===!1)if(t.valueBlock.value[0].optional)o++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,ee),t.name&&delete r[t.name]),s;if(si in t.valueBlock.value[0]&&t.valueBlock.value[0].name.length>0){let f={};Pa in t.valueBlock.value[0]&&t.valueBlock.value[0].local?f=e:f=r,typeof f[t.valueBlock.value[0].name]=="undefined"&&(f[t.valueBlock.value[0].name]=[]),f[t.valueBlock.value[0].name].push(e.valueBlock.value[l])}}else if(s=je(r,e.valueBlock.value[l-o],t.valueBlock.value[l]),s.verified===!1)if(t.valueBlock.value[l].optional)o++;else return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,ee),t.name&&delete r[t.name]),s;if(s.verified===!1){const l={verified:!1,result:r};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,ee),t.name&&(delete r[t.name],l.name=t.name)),l}return{verified:!0,result:r}}if(t.primitiveSchema&&lo in e.valueBlock){const o=et(e.valueBlock.valueHexView);if(o.offset===-1){const s={verified:!1,result:o.result};return t.name&&(t.name=t.name.replace(/^\s+|\s+$/g,ee),t.name&&(delete r[t.name],s.name=t.name)),s}return je(r,o.result,t.primitiveSchema)}return{verified:!0,result:r}}function Xa(r,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const t=et(I.toUint8Array(r));return t.offset===-1?{verified:!1,result:t.result}:je(t.result,t.result,e)}var ss=Object.freeze({__proto__:null,Any:_e,BaseBlock:G,BaseStringBlock:ai,BitString:Pe,BmpString:rr,Boolean:Qt,CharacterString:fr,Choice:wi,Constructed:Z,DATE:di,DateTime:gi,Duration:vi,EndOfContent:ci,Enumerated:er,GeneralString:ur,GeneralizedTime:hr,GraphicString:lr,HexBlock:we,IA5String:cr,Integer:rt,Null:$e,NumericString:nr,ObjectIdentifier:tr,OctetString:Me,Primitive:St,PrintableString:or,RawData:za,RelativeObjectIdentifier:pi,Repeated:pr,Sequence:ue,Set:be,TIME:mi,TeletexString:sr,TimeOfDay:yi,UTCTime:xt,UniversalString:ir,Utf8String:xe,ValueBlock:Y,VideotexString:ar,ViewWriter:Yt,VisibleString:kt,compareSchema:je,fromBER:tt,verifySchema:Xa}),m;(function(r){r[r.Sequence=0]="Sequence",r[r.Set=1]="Set",r[r.Choice=2]="Choice"})(m||(m={}));var p;(function(r){r[r.Any=1]="Any",r[r.Boolean=2]="Boolean",r[r.OctetString=3]="OctetString",r[r.BitString=4]="BitString",r[r.Integer=5]="Integer",r[r.Enumerated=6]="Enumerated",r[r.ObjectIdentifier=7]="ObjectIdentifier",r[r.Utf8String=8]="Utf8String",r[r.BmpString=9]="BmpString",r[r.UniversalString=10]="UniversalString",r[r.NumericString=11]="NumericString",r[r.PrintableString=12]="PrintableString",r[r.TeletexString=13]="TeletexString",r[r.VideotexString=14]="VideotexString",r[r.IA5String=15]="IA5String",r[r.GraphicString=16]="GraphicString",r[r.VisibleString=17]="VisibleString",r[r.GeneralString=18]="GeneralString",r[r.CharacterString=19]="CharacterString",r[r.UTCTime=20]="UTCTime",r[r.GeneralizedTime=21]="GeneralizedTime",r[r.DATE=22]="DATE",r[r.TimeOfDay=23]="TimeOfDay",r[r.DateTime=24]="DateTime",r[r.Duration=25]="Duration",r[r.TIME=26]="TIME",r[r.Null=27]="Null"})(p||(p={}));class dr{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(I.isBufferSource(e))this.unusedBits=t,this.value=I.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Pe))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new Pe({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Pe({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const i of t)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const i=t.length+7>>3;this.unusedBits=(i<<3)-t.length;const n=new Uint8Array(i);t=t.padStart(i<<3,"0").split("").reverse().join("");let o=0;for(;o<i;)n[o]=parseInt(t.slice(o<<3,(o<<3)+8),2),o++;this.value=n.buffer}}class O{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):I.isBufferSource(e)?this.buffer=I.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Me))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Me({valueHex:this.buffer})}toSchema(e){return new Me({name:e})}}const Wa={fromASN:r=>r instanceof $e?null:r.valueBeforeDecodeView,toASN:r=>{if(r===null)return new $e;const e=tt(r);if(e.result.error)throw new Error(e.result.error);return e.result}},Ka={fromASN:r=>r.valueBlock.valueHexView.byteLength>=4?r.valueBlock.toString():r.valueBlock.valueDec,toASN:r=>new rt({value:+r})},Ja={fromASN:r=>r.valueBlock.valueDec,toASN:r=>new er({value:r})},oe={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new rt({valueHex:r})},Ya={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new Pe({valueHex:r})},Za={fromASN:r=>r.valueBlock.toString(),toASN:r=>new tr({value:r})},Qa={fromASN:r=>r.valueBlock.value,toASN:r=>new Qt({value:r})},bi={fromASN:r=>r.valueBlock.valueHexView,toASN:r=>new Me({valueHex:r})},ec={fromASN:r=>new O(r.getValue()),toASN:r=>r.toASN()};function ae(r){return{fromASN:e=>e.valueBlock.value,toASN:e=>new r({value:e})}}const tc=ae(xe),rc=ae(rr),ic=ae(ir),nc=ae(nr),oc=ae(or),sc=ae(sr),ac=ae(ar),cc=ae(cr),lc=ae(lr),uc=ae(kt),fc=ae(ur),hc=ae(fr),pc={fromASN:r=>r.toDate(),toASN:r=>new xt({valueDate:r})},dc={fromASN:r=>r.toDate(),toASN:r=>new hr({valueDate:r})},yc={fromASN:()=>null,toASN:()=>new $e};function Nt(r){switch(r){case p.Any:return Wa;case p.BitString:return Ya;case p.BmpString:return rc;case p.Boolean:return Qa;case p.CharacterString:return hc;case p.Enumerated:return Ja;case p.GeneralString:return fc;case p.GeneralizedTime:return dc;case p.GraphicString:return lc;case p.IA5String:return cc;case p.Integer:return Ka;case p.Null:return yc;case p.NumericString:return nc;case p.ObjectIdentifier:return Za;case p.OctetString:return bi;case p.PrintableString:return oc;case p.TeletexString:return sc;case p.UTCTime:return pc;case p.UniversalString:return ic;case p.Utf8String:return tc;case p.VideotexString:return ac;case p.VisibleString:return uc;default:return null}}function Ne(r){return typeof r=="function"&&r.prototype?r.prototype.toASN&&r.prototype.fromASN?!0:Ne(r.prototype):!!(r&&typeof r=="object"&&"toASN"in r&&"fromASN"in r)}function as(r){var e;if(r){const t=Object.getPrototypeOf(r);return((e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:as(t)}return!1}function gc(r,e){if(!(r&&e)||r.byteLength!==e.byteLength)return!1;const t=new Uint8Array(r),i=new Uint8Array(e);for(let n=0;n<r.byteLength;n++)if(t[n]!==i[n])return!1;return!0}class vc{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,t=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(t&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const t=this.get(e);t.schema||(t.schema=this.create(e,!0))}createDefault(e){const t={type:m.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(t,i),t.items=Object.assign({},t.items,i.items)),t}create(e,t){const i=this.items.get(e)||this.createDefault(e),n=[];for(const o in i.items){const s=i.items[o],c=t?o:"";let l;if(typeof s.type=="number"){const h=p[s.type],d=ss[h];if(!d)throw new Error(`Cannot get ASN1 class by name '${h}'`);l=new d({name:c})}else Ne(s.type)?l=new s.type().toSchema(c):s.optional?this.get(s.type).type===m.Choice?l=new _e({name:c}):(l=this.create(s.type,!1),l.name=c):l=new _e({name:c});const f=!!s.optional||s.defaultValue!==void 0;if(s.repeated){l.name="";const h=s.repeated==="set"?be:ue;l=new h({name:"",value:[new pr({name:c,value:l})]})}if(s.context!==null&&s.context!==void 0)if(s.implicit)if(typeof s.type=="number"||Ne(s.type)){const h=s.repeated?Z:St;n.push(new h({name:c,optional:f,idBlock:{tagClass:3,tagNumber:s.context}}))}else{this.cache(s.type);const h=!!s.repeated;let d=h?l:this.get(s.type,!0).schema;d="valueBlock"in d?d.valueBlock.value:d.value,n.push(new Z({name:h?"":c,optional:f,idBlock:{tagClass:3,tagNumber:s.context},value:d}))}else n.push(new Z({optional:f,idBlock:{tagClass:3,tagNumber:s.context},value:[l]}));else l.optional=f,n.push(l)}switch(i.type){case m.Sequence:return new ue({value:n,name:""});case m.Set:return new be({value:n,name:""});case m.Choice:return new wi({value:n,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,t){return this.items.set(e,t),this}findParentSchema(e){const t=Object.getPrototypeOf(e);return t?this.items.get(t)||this.findParentSchema(t):null}}const z=new vc,S=r=>e=>{let t;z.has(e)?t=z.get(e):(t=z.createDefault(e),z.set(e,t)),Object.assign(t,r)},u=r=>(e,t)=>{let i;z.has(e.constructor)?i=z.get(e.constructor):(i=z.createDefault(e.constructor),z.set(e.constructor,i));const n=Object.assign({},r);if(typeof n.type=="number"&&!n.converter){const o=Nt(r.type);if(!o)throw new Error(`Cannot get default converter for property '${t}' of ${e.constructor.name}`);n.converter=o}n.raw=r.raw,i.items[t]=n};class Ct extends Error{constructor(){super(...arguments),this.schemas=[]}}class cs{static parse(e,t){const i=tt(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,t)}static fromASN(e,t){try{if(Ne(t))return new t().fromASN(e);const i=z.get(t);z.cache(t);let n=i.schema;const o=this.handleChoiceTypes(e,i,t,n);if(o!=null&&o.result)return o.result;o!=null&&o.targetSchema&&(n=o.targetSchema);const s=this.handleSequenceTypes(e,i,t,n),c=new t;return as(t)?this.handleArrayTypes(e,i,t):(this.processSchemaItems(i,s,c),c)}catch(i){throw i instanceof Ct&&i.schemas.push(t.name),i}}static handleChoiceTypes(e,t,i,n){if(e.constructor===Z&&t.type===m.Choice&&e.idBlock.tagClass===3)for(const o in t.items){const s=t.items[o];if(s.context===e.idBlock.tagNumber&&s.implicit&&typeof s.type=="function"&&z.has(s.type)){const c=z.get(s.type);if(c&&c.type===m.Sequence){const l=new ue;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in l.valueBlock){l.valueBlock.value=e.valueBlock.value;const f=this.fromASN(l,s.type),h=new i;return h[o]=f,{result:h}}}}}else if(e.constructor===Z&&t.type!==m.Choice){const o=new Z({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:t.schema.valueBlock.value});for(const s in t.items)delete e[s];return{targetSchema:o}}return null}static handleSequenceTypes(e,t,i,n){if(t.type===m.Sequence){const o=je({},e,n);if(!o.verified)throw new Ct(`Data does not match to ${i.name} ASN1 schema.${o.result.error?` ${o.result.error}`:""}`);return o}else{const o=je({},e,n);if(!o.verified)throw new Ct(`Data does not match to ${i.name} ASN1 schema.${o.result.error?` ${o.result.error}`:""}`);return o}}static processRepeatedField(e,t,i){let n=e.slice(t);if(n.length===1&&n[0].constructor.name==="Sequence"){const o=n[0];o.valueBlock&&o.valueBlock.value&&Array.isArray(o.valueBlock.value)&&(n=o.valueBlock.value)}if(typeof i.type=="number"){const o=Nt(i.type);if(!o)throw new Error(`No converter for ASN.1 type ${i.type}`);return n.filter(s=>s&&s.valueBlock).map(s=>{try{return o.fromASN(s)}catch(c){return}}).filter(s=>s!==void 0)}else return n.filter(o=>o&&o.valueBlock).map(o=>{try{return this.fromASN(o,i.type)}catch(s){return}}).filter(o=>o!==void 0)}static processPrimitiveField(e,t){const i=Nt(t.type);if(!i)throw new Error(`No converter for ASN.1 type ${t.type}`);return i.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&typeof e.type=="function"&&z.has(e.type)&&z.get(e.type).type===m.Choice}static processOptionalChoiceField(e,t){try{return{processed:!0,value:this.fromASN(e,t.type)}}catch(i){if(i instanceof Ct&&/Wrong values for Choice type/.test(i.message))return{processed:!1};throw i}}static handleArrayTypes(e,t,i){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const n=t.itemType;if(typeof n=="number"){const o=Nt(n);if(!o)throw new Error(`Cannot get default converter for array item of ${i.name} ASN1 schema`);return i.from(e.valueBlock.value,s=>o.fromASN(s))}else return i.from(e.valueBlock.value,o=>this.fromASN(o,n))}static processSchemaItems(e,t,i){for(const n in e.items){const o=t.result[n];if(!o)continue;const s=e.items[n],c=s.type;let l;typeof c=="number"||Ne(c)?l=this.processPrimitiveSchemaItem(o,s,c):l=this.processComplexSchemaItem(o,s,c),l&&typeof l=="object"&&"value"in l&&"raw"in l?(i[n]=l.value,i[`${n}Raw`]=l.raw):i[n]=l}}static processPrimitiveSchemaItem(e,t,i){var n;const o=(n=t.converter)!==null&&n!==void 0?n:Ne(i)?new i:null;if(!o)throw new Error("Converter is empty");return t.repeated?this.processRepeatedPrimitiveItem(e,t,o):this.processSinglePrimitiveItem(e,t,i,o)}static processRepeatedPrimitiveItem(e,t,i){if(t.implicit){const n=t.repeated==="sequence"?ue:be,o=new n;o.valueBlock=e.valueBlock;const s=tt(o.toBER(!1));if(s.offset===-1)throw new Error(`Cannot parse the child item. ${s.result.error}`);if(!("value"in s.result.valueBlock&&Array.isArray(s.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const c=s.result.valueBlock.value;return Array.from(c,l=>i.fromASN(l))}else return Array.from(e,n=>i.fromASN(n))}static processSinglePrimitiveItem(e,t,i,n){let o=e;if(t.implicit){let s;if(Ne(i))s=new i().toSchema("");else{const c=p[i],l=ss[c];if(!l)throw new Error(`Cannot get '${c}' class from asn1js module`);s=new l}s.valueBlock=o.valueBlock,o=tt(s.toBER(!1)).result}return n.fromASN(o)}static processComplexSchemaItem(e,t,i){if(t.repeated){if(!Array.isArray(e))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(e,n=>this.fromASN(n,i))}else{const n=this.handleImplicitTagging(e,t,i);if(this.isOptionalChoiceField(t))try{return this.fromASN(n,i)}catch(o){if(o instanceof Ct&&/Wrong values for Choice type/.test(o.message))return;throw o}else{const o=this.fromASN(n,i);return t.raw?{value:o,raw:e.valueBeforeDecodeView}:o}}}static handleImplicitTagging(e,t,i){if(t.implicit&&typeof t.context=="number"){const n=z.get(i);if(n.type===m.Sequence){const o=new ue;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in o.valueBlock)return o.valueBlock.value=e.valueBlock.value,o}else if(n.type===m.Set){const o=new be;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in o.valueBlock)return o.valueBlock.value=e.valueBlock.value,o}}return e}}class Ai{static serialize(e){return e instanceof G?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&Ne(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,i=z.get(t);z.cache(t);let n=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const s=Nt(i.itemType);if(!s)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);n=e.map(c=>s.toASN(c))}else n=e.map(s=>this.toAsnItem({type:i.itemType},"[]",t,s))}else for(const s in i.items){const c=i.items[s],l=e[s];if(l===void 0||c.defaultValue===l||typeof c.defaultValue=="object"&&typeof l=="object"&&gc(this.serialize(c.defaultValue),this.serialize(l)))continue;const f=Ai.toAsnItem(c,s,t,l);if(typeof c.context=="number")if(c.implicit)if(!c.repeated&&(typeof c.type=="number"||Ne(c.type))){const h={};h.valueHex=f instanceof $e?f.valueBeforeDecodeView:f.valueBlock.toBER(),n.push(new St(j({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context}},h)))}else n.push(new Z({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:f.valueBlock.value}));else n.push(new Z({optional:c.optional,idBlock:{tagClass:3,tagNumber:c.context},value:[f]}));else c.repeated?n=n.concat(f):n.push(f)}let o;switch(i.type){case m.Sequence:o=new ue({value:n});break;case m.Set:o=new be({value:n});break;case m.Choice:if(!n[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);o=n[0];break}return o}static toAsnItem(e,t,i,n){let o;if(typeof e.type=="number"){const s=e.converter;if(!s)throw new Error(`Property '${t}' doesn't have converter for type ${p[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const c=Array.from(n,f=>s.toASN(f)),l=e.repeated==="sequence"?ue:be;o=new l({value:c})}else o=s.toASN(n)}else if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const s=Array.from(n,l=>this.toASN(l)),c=e.repeated==="sequence"?ue:be;o=new c({value:s})}else o=this.toASN(n);return o}}class R extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const t of e)this.push(t)}}}class fe{static serialize(e){return Ai.serialize(e)}static parse(e,t){return cs.parse(e,t)}static toString(e){const t=I.isBufferSource(e)?I.toArrayBuffer(e):fe.serialize(e),i=tt(t);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function a(r,e,t,i){var n=arguments.length,o=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(r,e,t,i);else for(var c=r.length-1;c>=0;c--)(s=r[c])&&(o=(n<3?s(o):n>3?s(e,t,o):s(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o}typeof SuppressedError=="function"&&SuppressedError;var Si;let ls=Si=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Si.prototype)}};ls=Si=a([S({type:m.Sequence,itemType:p.ObjectIdentifier})],ls);let Bi=class{constructor(e=new Date){this.value=e}};a([u({type:p.GeneralizedTime})],Bi.prototype,"value",void 0),Bi=a([S({type:m.Choice})],Bi);let ki=class{constructor(e=null){this.value=e}};a([u({type:p.Null})],ki.prototype,"value",void 0),ki=a([S({type:m.Choice})],ki);class us{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){const t=e.split(".");if(t.length!==4)throw new Error("Invalid IPv4 address");return t.map(i=>{const n=parseInt(i,10);if(isNaN(n)||n<0||n>255)throw new Error("Invalid IPv4 address part");return n})}static parseIPv6(e){const i=this.expandIPv6(e).split(":");if(i.length!==8)throw new Error("Invalid IPv6 address");return i.reduce((n,o)=>{const s=parseInt(o,16);if(isNaN(s)||s<0||s>65535)throw new Error("Invalid IPv6 address part");return n.push(s>>8&255),n.push(s&255),n},[])}static expandIPv6(e){if(!e.includes("::"))return e;const t=e.split("::");if(t.length>2)throw new Error("Invalid IPv6 address");const i=t[0]?t[0].split(":"):[],n=t[1]?t[1].split(":"):[],o=8-(i.length+n.length);if(o<0)throw new Error("Invalid IPv6 address");return[...i,...Array(o).fill("0"),...n].join(":")}static formatIPv6(e){const t=[];for(let i=0;i<16;i+=2)t.push((e[i]<<8|e[i+1]).toString(16));return this.compressIPv6(t.join(":"))}static compressIPv6(e){const t=e.split(":");let i=-1,n=0,o=-1,s=0;for(let c=0;c<t.length;c++)t[c]==="0"?(o===-1&&(o=c),s++):(s>n&&(i=o,n=s),o=-1,s=0);if(s>n&&(i=o,n=s),n>1){const c=t.slice(0,i).join(":"),l=t.slice(i+n).join(":");return`${c}::${l}`}return e}static parseCIDR(e){const[t,i]=e.split("/"),n=parseInt(i,10);if(this.isIPv4(t)){if(n<0||n>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(t),n]}else{if(n<0||n>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(t),n]}}static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce((n,o)=>n+ +o,0);let i=e.slice(0,8).replace(/(.{2})/g,n=>`${parseInt(n,16)}.`);return i=i.slice(0,-1),`${i}/${t}`}static toString(e){const t=new Uint8Array(e);if(t.length===4)return Array.from(t).join(".");if(t.length===16)return this.formatIPv6(t);if(t.length===8||t.length===32){const i=t.length/2,n=t.slice(0,i),o=t.slice(i);if(t.every(l=>l===0))return t.length===8?"0.0.0.0/0":"::/0";const c=o.reduce((l,f)=>l+(f.toString(2).match(/1/g)||[]).length,0);return t.length===8?`${Array.from(n).join(".")}/${c}`:`${this.formatIPv6(n)}/${c}`}return this.decodeIP(L.ToHex(e))}static fromString(e){if(e.includes("/")){const[i,n]=this.parseCIDR(e),o=new Uint8Array(i.length);let s=n;for(let l=0;l<o.length;l++)s>=8?(o[l]=255,s-=8):s>0&&(o[l]=255<<8-s,s=0);const c=new Uint8Array(i.length*2);return c.set(i,0),c.set(o,i.length),c.buffer}const t=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(t).buffer}}var xi,Ni,Ci;let he=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};a([u({type:p.TeletexString})],he.prototype,"teletexString",void 0),a([u({type:p.PrintableString})],he.prototype,"printableString",void 0),a([u({type:p.UniversalString})],he.prototype,"universalString",void 0),a([u({type:p.Utf8String})],he.prototype,"utf8String",void 0),a([u({type:p.BmpString})],he.prototype,"bmpString",void 0),he=a([S({type:m.Choice})],he);let it=class extends he{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?L.ToHex(this.anyValue):super.toString())}};a([u({type:p.IA5String})],it.prototype,"ia5String",void 0),a([u({type:p.Any})],it.prototype,"anyValue",void 0),it=a([S({type:m.Choice})],it);class Ei{constructor(e={}){this.type="",this.value=new it,Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Ei.prototype,"type",void 0),a([u({type:it})],Ei.prototype,"value",void 0);let yr=xi=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,xi.prototype)}};yr=xi=a([S({type:m.Set,itemType:Ei})],yr);let Ii=Ni=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Ni.prototype)}};Ii=Ni=a([S({type:m.Sequence,itemType:yr})],Ii);let te=Ci=class extends Ii{constructor(e){super(e),Object.setPrototypeOf(this,Ci.prototype)}};te=Ci=a([S({type:m.Sequence})],te);const mc={fromASN:r=>us.toString(bi.fromASN(r)),toASN:r=>bi.toASN(us.fromString(r))};class Oi{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Oi.prototype,"typeId",void 0),a([u({type:p.Any,context:0})],Oi.prototype,"value",void 0);class Ti{constructor(e={}){this.partyName=new he,Object.assign(this,e)}}a([u({type:he,optional:!0,context:0,implicit:!0})],Ti.prototype,"nameAssigner",void 0),a([u({type:he,context:1,implicit:!0})],Ti.prototype,"partyName",void 0);let T=class{constructor(e={}){Object.assign(this,e)}};a([u({type:Oi,context:0,implicit:!0})],T.prototype,"otherName",void 0),a([u({type:p.IA5String,context:1,implicit:!0})],T.prototype,"rfc822Name",void 0),a([u({type:p.IA5String,context:2,implicit:!0})],T.prototype,"dNSName",void 0),a([u({type:p.Any,context:3,implicit:!0})],T.prototype,"x400Address",void 0),a([u({type:te,context:4,implicit:!1})],T.prototype,"directoryName",void 0),a([u({type:Ti,context:5})],T.prototype,"ediPartyName",void 0),a([u({type:p.IA5String,context:6,implicit:!0})],T.prototype,"uniformResourceIdentifier",void 0),a([u({type:p.OctetString,context:7,implicit:!0,converter:mc})],T.prototype,"iPAddress",void 0),a([u({type:p.ObjectIdentifier,context:8,implicit:!0})],T.prototype,"registeredID",void 0),T=a([S({type:m.Choice})],T);var Vi;class gr{constructor(e={}){this.accessMethod="",this.accessLocation=new T,Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],gr.prototype,"accessMethod",void 0),a([u({type:T})],gr.prototype,"accessLocation",void 0);let vr=Vi=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Vi.prototype)}};vr=Vi=a([S({type:m.Sequence,itemType:gr})],vr);class fs extends O{}class Ui{constructor(e={}){e&&Object.assign(this,e)}}a([u({type:fs,context:0,optional:!0,implicit:!0})],Ui.prototype,"keyIdentifier",void 0),a([u({type:T,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Ui.prototype,"authorityCertIssuer",void 0),a([u({type:p.Integer,context:2,optional:!0,implicit:!0,converter:oe})],Ui.prototype,"authorityCertSerialNumber",void 0);class hs{constructor(e={}){this.cA=!1,Object.assign(this,e)}}a([u({type:p.Boolean,defaultValue:!1})],hs.prototype,"cA",void 0),a([u({type:p.Integer,optional:!0})],hs.prototype,"pathLenConstraint",void 0);var ji;let pe=ji=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,ji.prototype)}};pe=ji=a([S({type:m.Sequence,itemType:T})],pe);var Di;let ps=Di=class extends pe{constructor(e){super(e),Object.setPrototypeOf(this,Di.prototype)}};ps=Di=a([S({type:m.Sequence})],ps);var Ri;let Ce=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};a([u({type:p.IA5String})],Ce.prototype,"ia5String",void 0),a([u({type:p.VisibleString})],Ce.prototype,"visibleString",void 0),a([u({type:p.BmpString})],Ce.prototype,"bmpString",void 0),a([u({type:p.Utf8String})],Ce.prototype,"utf8String",void 0),Ce=a([S({type:m.Choice})],Ce);class Li{constructor(e={}){this.organization=new Ce,this.noticeNumbers=[],Object.assign(this,e)}}a([u({type:Ce})],Li.prototype,"organization",void 0),a([u({type:p.Integer,repeated:"sequence"})],Li.prototype,"noticeNumbers",void 0);class Hi{constructor(e={}){Object.assign(this,e)}}a([u({type:Li,optional:!0})],Hi.prototype,"noticeRef",void 0),a([u({type:Ce,optional:!0})],Hi.prototype,"explicitText",void 0);let mr=class{constructor(e={}){Object.assign(this,e)}};a([u({type:p.IA5String})],mr.prototype,"cPSuri",void 0),a([u({type:Hi})],mr.prototype,"userNotice",void 0),mr=a([S({type:m.Choice})],mr);class $i{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],$i.prototype,"policyQualifierId",void 0),a([u({type:p.Any})],$i.prototype,"qualifier",void 0);class Mi{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Mi.prototype,"policyIdentifier",void 0),a([u({type:$i,repeated:"sequence",optional:!0})],Mi.prototype,"policyQualifiers",void 0);let ds=Ri=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Ri.prototype)}};ds=Ri=a([S({type:m.Sequence,itemType:Mi})],ds);let wr=class{constructor(e=0){this.value=e}};a([u({type:p.Integer})],wr.prototype,"value",void 0),wr=a([S({type:m.Choice})],wr);let ys=class extends wr{};ys=a([S({type:m.Choice})],ys);var Pi,de;(function(r){r[r.unused=1]="unused",r[r.keyCompromise=2]="keyCompromise",r[r.cACompromise=4]="cACompromise",r[r.affiliationChanged=8]="affiliationChanged",r[r.superseded=16]="superseded",r[r.cessationOfOperation=32]="cessationOfOperation",r[r.certificateHold=64]="certificateHold",r[r.privilegeWithdrawn=128]="privilegeWithdrawn",r[r.aACompromise=256]="aACompromise"})(de||(de={}));class gs extends dr{toJSON(){const e=[],t=this.toNumber();return t&de.aACompromise&&e.push("aACompromise"),t&de.affiliationChanged&&e.push("affiliationChanged"),t&de.cACompromise&&e.push("cACompromise"),t&de.certificateHold&&e.push("certificateHold"),t&de.cessationOfOperation&&e.push("cessationOfOperation"),t&de.keyCompromise&&e.push("keyCompromise"),t&de.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&de.superseded&&e.push("superseded"),t&de.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let nt=class{constructor(e={}){Object.assign(this,e)}};a([u({type:T,context:0,repeated:"sequence",implicit:!0})],nt.prototype,"fullName",void 0),a([u({type:yr,context:1,implicit:!0})],nt.prototype,"nameRelativeToCRLIssuer",void 0),nt=a([S({type:m.Choice})],nt);class Et{constructor(e={}){Object.assign(this,e)}}a([u({type:nt,context:0,optional:!0})],Et.prototype,"distributionPoint",void 0),a([u({type:gs,context:1,optional:!0,implicit:!0})],Et.prototype,"reasons",void 0),a([u({type:T,context:2,optional:!0,repeated:"sequence",implicit:!0})],Et.prototype,"cRLIssuer",void 0);let _i=Pi=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Pi.prototype)}};_i=Pi=a([S({type:m.Sequence,itemType:Et})],_i);var qi;let vs=qi=class extends _i{constructor(e){super(e),Object.setPrototypeOf(this,qi.prototype)}};vs=qi=a([S({type:m.Sequence,itemType:Et})],vs);class X{constructor(e={}){this.onlyContainsUserCerts=X.ONLY,this.onlyContainsCACerts=X.ONLY,this.indirectCRL=X.ONLY,this.onlyContainsAttributeCerts=X.ONLY,Object.assign(this,e)}}X.ONLY=!1,a([u({type:nt,context:0,optional:!0})],X.prototype,"distributionPoint",void 0),a([u({type:p.Boolean,context:1,defaultValue:X.ONLY,implicit:!0})],X.prototype,"onlyContainsUserCerts",void 0),a([u({type:p.Boolean,context:2,defaultValue:X.ONLY,implicit:!0})],X.prototype,"onlyContainsCACerts",void 0),a([u({type:gs,context:3,optional:!0,implicit:!0})],X.prototype,"onlySomeReasons",void 0),a([u({type:p.Boolean,context:4,defaultValue:X.ONLY,implicit:!0})],X.prototype,"indirectCRL",void 0),a([u({type:p.Boolean,context:5,defaultValue:X.ONLY,implicit:!0})],X.prototype,"onlyContainsAttributeCerts",void 0);var It;(function(r){r[r.unspecified=0]="unspecified",r[r.keyCompromise=1]="keyCompromise",r[r.cACompromise=2]="cACompromise",r[r.affiliationChanged=3]="affiliationChanged",r[r.superseded=4]="superseded",r[r.cessationOfOperation=5]="cessationOfOperation",r[r.certificateHold=6]="certificateHold",r[r.removeFromCRL=8]="removeFromCRL",r[r.privilegeWithdrawn=9]="privilegeWithdrawn",r[r.aACompromise=10]="aACompromise"})(It||(It={}));let br=class{constructor(e=It.unspecified){this.reason=It.unspecified,this.reason=e}toJSON(){return It[this.reason]}toString(){return this.toJSON()}};a([u({type:p.Enumerated})],br.prototype,"reason",void 0),br=a([S({type:m.Choice})],br);var Fi;let ms=Fi=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Fi.prototype)}};ms=Fi=a([S({type:m.Sequence,itemType:p.ObjectIdentifier})],ms);let Gi=class{constructor(e=new ArrayBuffer(0)){this.value=e}};a([u({type:p.Integer,converter:oe})],Gi.prototype,"value",void 0),Gi=a([S({type:m.Choice})],Gi);let zi=class{constructor(e){this.value=new Date,e&&(this.value=e)}};a([u({type:p.GeneralizedTime})],zi.prototype,"value",void 0),zi=a([S({type:m.Choice})],zi);var Xi;let ws=Xi=class extends pe{constructor(e){super(e),Object.setPrototypeOf(this,Xi.prototype)}};ws=Xi=a([S({type:m.Sequence})],ws);var bs;(function(r){r[r.digitalSignature=1]="digitalSignature",r[r.nonRepudiation=2]="nonRepudiation",r[r.keyEncipherment=4]="keyEncipherment",r[r.dataEncipherment=8]="dataEncipherment",r[r.keyAgreement=16]="keyAgreement",r[r.keyCertSign=32]="keyCertSign",r[r.cRLSign=64]="cRLSign",r[r.encipherOnly=128]="encipherOnly",r[r.decipherOnly=256]="decipherOnly"})(bs||(bs={}));var Wi;class Ar{constructor(e={}){this.base=new T,this.minimum=0,Object.assign(this,e)}}a([u({type:T})],Ar.prototype,"base",void 0),a([u({type:p.Integer,context:0,defaultValue:0,implicit:!0})],Ar.prototype,"minimum",void 0),a([u({type:p.Integer,context:1,optional:!0,implicit:!0})],Ar.prototype,"maximum",void 0);let Sr=Wi=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Wi.prototype)}};Sr=Wi=a([S({type:m.Sequence,itemType:Ar})],Sr);class As{constructor(e={}){Object.assign(this,e)}}a([u({type:Sr,context:0,optional:!0,implicit:!0})],As.prototype,"permittedSubtrees",void 0),a([u({type:Sr,context:1,optional:!0,implicit:!0})],As.prototype,"excludedSubtrees",void 0);class Ss{constructor(e={}){Object.assign(this,e)}}a([u({type:p.Integer,context:0,implicit:!0,optional:!0,converter:oe})],Ss.prototype,"requireExplicitPolicy",void 0),a([u({type:p.Integer,context:1,implicit:!0,optional:!0,converter:oe})],Ss.prototype,"inhibitPolicyMapping",void 0);var Ki;class Ji{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Ji.prototype,"issuerDomainPolicy",void 0),a([u({type:p.ObjectIdentifier})],Ji.prototype,"subjectDomainPolicy",void 0);let Bs=Ki=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Ki.prototype)}};Bs=Ki=a([S({type:m.Sequence,itemType:Ji})],Bs);var Yi;let ks=Yi=class extends pe{constructor(e){super(e),Object.setPrototypeOf(this,Yi.prototype)}};ks=Yi=a([S({type:m.Sequence})],ks);class Ot{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Ot.prototype,"type",void 0),a([u({type:p.Any,repeated:"set"})],Ot.prototype,"values",void 0);var Zi;let xs=Zi=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Zi.prototype)}};xs=Zi=a([S({type:m.Sequence,itemType:Ot})],xs);class Tt extends fs{}class Ns{constructor(e={}){Object.assign(this,e)}}a([u({type:p.GeneralizedTime,context:0,implicit:!0,optional:!0})],Ns.prototype,"notBefore",void 0),a([u({type:p.GeneralizedTime,context:1,implicit:!0,optional:!0})],Ns.prototype,"notAfter",void 0);var Vt;(function(r){r[r.keyUpdateAllowed=1]="keyUpdateAllowed",r[r.newExtensions=2]="newExtensions",r[r.pKIXCertificate=4]="pKIXCertificate"})(Vt||(Vt={}));class Cs extends dr{toJSON(){const e=[],t=this.toNumber();return t&Vt.pKIXCertificate&&e.push("pKIXCertificate"),t&Vt.newExtensions&&e.push("newExtensions"),t&Vt.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class Es{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new Cs,Object.assign(this,e)}}a([u({type:p.GeneralString})],Es.prototype,"entrustVers",void 0),a([u({type:Cs})],Es.prototype,"entrustInfoFlags",void 0);var Qi;let Is=Qi=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Qi.prototype)}};Is=Qi=a([S({type:m.Sequence,itemType:gr})],Is);class k{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof k&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&Ta(e.parameters,this.parameters)||e.parameters===this.parameters)}}a([u({type:p.ObjectIdentifier})],k.prototype,"algorithm",void 0),a([u({type:p.Any,optional:!0})],k.prototype,"parameters",void 0);class Br{constructor(e={}){this.algorithm=new k,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:k})],Br.prototype,"algorithm",void 0),a([u({type:p.BitString})],Br.prototype,"subjectPublicKey",void 0);let W=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const t=new Date(e);t.getUTCFullYear()>2049?this.generalTime=t:this.utcTime=t}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};a([u({type:p.UTCTime})],W.prototype,"utcTime",void 0),a([u({type:p.GeneralizedTime})],W.prototype,"generalTime",void 0),W=a([S({type:m.Choice})],W);class kr{constructor(e){this.notBefore=new W(new Date),this.notAfter=new W(new Date),e&&(this.notBefore=new W(e.notBefore),this.notAfter=new W(e.notAfter))}}a([u({type:W})],kr.prototype,"notBefore",void 0),a([u({type:W})],kr.prototype,"notAfter",void 0);var en;class re{constructor(e={}){this.extnID="",this.critical=re.CRITICAL,this.extnValue=new O,Object.assign(this,e)}}re.CRITICAL=!1,a([u({type:p.ObjectIdentifier})],re.prototype,"extnID",void 0),a([u({type:p.Boolean,defaultValue:re.CRITICAL})],re.prototype,"critical",void 0),a([u({type:O})],re.prototype,"extnValue",void 0);let ot=en=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,en.prototype)}};ot=en=a([S({type:m.Sequence,itemType:re})],ot);var xr;(function(r){r[r.v1=0]="v1",r[r.v2=1]="v2",r[r.v3=2]="v3"})(xr||(xr={}));class ce{constructor(e={}){this.version=xr.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new k,this.issuer=new te,this.validity=new kr,this.subject=new te,this.subjectPublicKeyInfo=new Br,Object.assign(this,e)}}a([u({type:p.Integer,context:0,defaultValue:xr.v1})],ce.prototype,"version",void 0),a([u({type:p.Integer,converter:oe})],ce.prototype,"serialNumber",void 0),a([u({type:k})],ce.prototype,"signature",void 0),a([u({type:te})],ce.prototype,"issuer",void 0),a([u({type:kr})],ce.prototype,"validity",void 0),a([u({type:te})],ce.prototype,"subject",void 0),a([u({type:Br})],ce.prototype,"subjectPublicKeyInfo",void 0),a([u({type:p.BitString,context:1,implicit:!0,optional:!0})],ce.prototype,"issuerUniqueID",void 0),a([u({type:p.BitString,context:2,implicit:!0,optional:!0})],ce.prototype,"subjectUniqueID",void 0),a([u({type:ot,context:3,optional:!0})],ce.prototype,"extensions",void 0);class qe{constructor(e={}){this.tbsCertificate=new ce,this.signatureAlgorithm=new k,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:ce,raw:!0})],qe.prototype,"tbsCertificate",void 0),a([u({type:k})],qe.prototype,"signatureAlgorithm",void 0),a([u({type:p.BitString})],qe.prototype,"signatureValue",void 0);class Nr{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new W,Object.assign(this,e)}}a([u({type:p.Integer,converter:oe})],Nr.prototype,"userCertificate",void 0),a([u({type:W})],Nr.prototype,"revocationDate",void 0),a([u({type:re,optional:!0,repeated:"sequence"})],Nr.prototype,"crlEntryExtensions",void 0);class Ee{constructor(e={}){this.signature=new k,this.issuer=new te,this.thisUpdate=new W,Object.assign(this,e)}}a([u({type:p.Integer,optional:!0})],Ee.prototype,"version",void 0),a([u({type:k})],Ee.prototype,"signature",void 0),a([u({type:te})],Ee.prototype,"issuer",void 0),a([u({type:W})],Ee.prototype,"thisUpdate",void 0),a([u({type:W,optional:!0})],Ee.prototype,"nextUpdate",void 0),a([u({type:Nr,repeated:"sequence",optional:!0})],Ee.prototype,"revokedCertificates",void 0),a([u({type:re,optional:!0,context:0,repeated:"sequence"})],Ee.prototype,"crlExtensions",void 0);class tn{constructor(e={}){this.tbsCertList=new Ee,this.signatureAlgorithm=new k,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:Ee,raw:!0})],tn.prototype,"tbsCertList",void 0),a([u({type:k})],tn.prototype,"signatureAlgorithm",void 0),a([u({type:p.BitString})],tn.prototype,"signature",void 0);var rn;class nn{constructor(e={}){this.sigIdentifier=new k,Object.assign(this,e)}}a([u({type:k})],nn.prototype,"sigIdentifier",void 0),a([u({type:k,optional:!0})],nn.prototype,"certIdentifier",void 0);let Os=rn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,rn.prototype)}};Os=rn=a([S({type:m.Sequence,itemType:nn})],Os);class Ts{constructor(e={}){this.issuer=new te,this.locator=new vr,Object.assign(this,e)}}a([u({type:te})],Ts.prototype,"issuer",void 0),a([u({type:vr})],Ts.prototype,"locator",void 0);class wc extends O{}let st=class{constructor(e={}){Object.assign(this,e)}};a([u({type:te,context:1})],st.prototype,"byName",void 0),a([u({type:wc,context:2})],st.prototype,"byKey",void 0),st=a([S({type:m.Choice})],st);class Ie{constructor(e={}){this.hashAlgorithm=new k,this.issuerNameHash=new O,this.issuerKeyHash=new O,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:k})],Ie.prototype,"hashAlgorithm",void 0),a([u({type:O})],Ie.prototype,"issuerNameHash",void 0),a([u({type:O})],Ie.prototype,"issuerKeyHash",void 0),a([u({type:p.Integer,converter:oe})],Ie.prototype,"serialNumber",void 0);class on{constructor(e={}){this.revocationTime=new Date,Object.assign(this,e)}}a([u({type:p.GeneralizedTime})],on.prototype,"revocationTime",void 0),a([u({type:br,context:0,optional:!0})],on.prototype,"revocationReason",void 0);let Fe=class{constructor(e={}){Object.assign(this,e)}};a([u({type:p.Null,context:0,implicit:!0})],Fe.prototype,"good",void 0),a([u({type:on,context:1,implicit:!0})],Fe.prototype,"revoked",void 0),a([u({type:p.Null,context:2,implicit:!0})],Fe.prototype,"unknown",void 0),Fe=a([S({type:m.Choice})],Fe);class at{constructor(e={}){this.certID=new Ie,this.certStatus=new Fe,this.thisUpdate=new Date,Object.assign(this,e)}}a([u({type:Ie})],at.prototype,"certID",void 0),a([u({type:Fe})],at.prototype,"certStatus",void 0),a([u({type:p.GeneralizedTime})],at.prototype,"thisUpdate",void 0),a([u({type:p.GeneralizedTime,context:0,optional:!0})],at.prototype,"nextUpdate",void 0),a([u({type:re,context:1,repeated:"sequence",optional:!0})],at.prototype,"singleExtensions",void 0);var ct;(function(r){r[r.v1=0]="v1"})(ct||(ct={}));class Ge{constructor(e={}){this.version=ct.v1,this.responderID=new st,this.producedAt=new Date,this.responses=[],Object.assign(this,e)}}a([u({type:p.Integer,context:0,defaultValue:ct.v1})],Ge.prototype,"version",void 0),a([u({type:st})],Ge.prototype,"responderID",void 0),a([u({type:p.GeneralizedTime})],Ge.prototype,"producedAt",void 0),a([u({type:at,repeated:"sequence"})],Ge.prototype,"responses",void 0),a([u({type:re,repeated:"sequence",context:1,optional:!0})],Ge.prototype,"responseExtensions",void 0);class Ut{constructor(e={}){this.tbsResponseData=new Ge,this.signatureAlgorithm=new k,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:Ge,raw:!0})],Ut.prototype,"tbsResponseData",void 0),a([u({type:k})],Ut.prototype,"signatureAlgorithm",void 0),a([u({type:p.BitString})],Ut.prototype,"signature",void 0),a([u({type:qe,repeated:"sequence",optional:!0,context:0})],Ut.prototype,"certs",void 0);class Cr{constructor(e={}){this.signatureAlgorithm=new k,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:k})],Cr.prototype,"signatureAlgorithm",void 0),a([u({type:p.BitString})],Cr.prototype,"signature",void 0),a([u({type:qe,repeated:"sequence",optional:!0,context:0})],Cr.prototype,"certs",void 0);class Er{constructor(e={}){this.reqCert=new Ie,Object.assign(this,e)}}a([u({type:Ie})],Er.prototype,"reqCert",void 0),a([u({type:re,repeated:"sequence",optional:!0})],Er.prototype,"singleRequestExtensions",void 0);class ze{constructor(e={}){this.version=ct.v1,this.requestList=[],Object.assign(this,e)}}a([u({type:p.Integer,context:0,defaultValue:ct.v1})],ze.prototype,"version",void 0),a([u({type:T,context:1,optional:!0})],ze.prototype,"requestorName",void 0),a([u({type:Er,repeated:"sequence"})],ze.prototype,"requestList",void 0),a([u({type:re,context:2,optional:!0,repeated:"sequence"})],ze.prototype,"requestExtensions",void 0);class sn{constructor(e={}){this.tbsRequest=new ze,Object.assign(this,e)}}a([u({type:ze,raw:!0})],sn.prototype,"tbsRequest",void 0),a([u({type:Cr,optional:!0,context:0})],sn.prototype,"optionalSignature",void 0);var Oe;(function(r){r[r.successful=0]="successful",r[r.malformedRequest=1]="malformedRequest",r[r.internalError=2]="internalError",r[r.tryLater=3]="tryLater",r[r.sigRequired=5]="sigRequired",r[r.unauthorized=6]="unauthorized"})(Oe||(Oe={}));class an{constructor(e={}){this.responseType="",this.response=new O,Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],an.prototype,"responseType",void 0),a([u({type:O})],an.prototype,"response",void 0);class cn{constructor(e={}){this.responseStatus=Oe.successful,Object.assign(this,e)}}a([u({type:p.Enumerated})],cn.prototype,"responseStatus",void 0),a([u({type:an,context:0,optional:!0})],cn.prototype,"responseBytes",void 0);var Ir=(r,e,t)=>new Promise((i,n)=>{var o=l=>{try{c(t.next(l))}catch(f){n(f)}},s=l=>{try{c(t.throw(l))}catch(f){n(f)}},c=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,s);c((t=t.apply(r,e)).next())});function ln(r){return Ir(this,arguments,function*(e,t={}){const{timeout:i=1e4,method:n="GET",body:o,contentType:s,accept:c,proxyUrl:l}=t,f=l?`${l}${encodeURIComponent(e)}`:e,h=new AbortController,d=setTimeout(()=>h.abort(),i);try{const g={};s&&(g["Content-Type"]=s),c&&(g.Accept=c);const y=yield fetch(f,{method:n,headers:g,body:o?new Uint8Array(o):void 0,signal:h.signal});if(clearTimeout(d),!y.ok)return{ok:!1,status:y.status,error:`HTTP ${y.status}: ${y.statusText}`};const v=yield y.arrayBuffer();return{ok:!0,status:y.status,data:v}}catch(g){return clearTimeout(d),g instanceof Error?g.name==="AbortError"?{ok:!1,status:0,error:`Request timeout after ${i}ms`}:{ok:!1,status:0,error:g.message}:{ok:!1,status:0,error:String(g)}}})}function bc(r,e,t=5e3,i){return Ir(this,null,function*(){return ln(r,{method:"POST",body:e,contentType:"application/ocsp-request",accept:"application/ocsp-response",timeout:t,proxyUrl:i})})}function Ac(r,e=1e4,t){return Ir(this,null,function*(){return ln(r,{method:"GET",accept:"application/pkix-crl",timeout:e,proxyUrl:t})})}function Sc(r,e=5e3,t){return Ir(this,null,function*(){return ln(r,{method:"GET",accept:"application/pkix-cert",timeout:e,proxyUrl:t})})}function Vs(r){const e=new Uint8Array(r);if(typeof btoa=="function"){let t="";for(let i=0;i<e.length;i++)t+=String.fromCharCode(e[i]);return btoa(t)}return Buffer.from(e).toString("base64")}function Us(r){const e=r.replace(/\s/g,"");if(typeof atob=="function"){const i=atob(e),n=new Uint8Array(i.length);for(let o=0;o<i.length;o++)n[o]=i.charCodeAt(o);return n.buffer}const t=Buffer.from(e,"base64");return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}function Bc(r){return new Uint8Array(Us(r))}function un(r){return Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join("")}function kc(r){const e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2)e[t/2]=parseInt(r.substring(t,t+2),16);return e.buffer}function js(r,e="CERTIFICATE"){const t=Vs(r).match(/.{1,64}/g)||[];return`-----BEGIN ${e}-----
73
- ${t.join(`
78
+ `)}`:`${r} :`}}gu=dt,te.Constructed=gu,dt.NAME="CONSTRUCTED";class mu extends ht{fromBER(e,r,i){return r}toBER(e){return Ht}}mu.override="EndOfContentValueBlock";var yu;class Wi extends st{constructor(e={}){super(e,mu),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}yu=Wi,te.EndOfContent=yu,Wi.NAME=en;var vu;class pr extends st{constructor(e={}){super(e,ht),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,r,i){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=i,r+i>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):r+i}toBER(e,r){const i=new ArrayBuffer(2);if(!e){const o=new Uint8Array(i);o[0]=5,o[1]=0}return r&&r.write(i),i}onAsciiEncoding(){return`${this.constructor.NAME}`}}vu=pr,te.Null=vu,pr.NAME="NULL";class Eu extends qt(ht){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor(i={}){var o=i,{value:e}=o,r=We(o,["value"]);super(r),r.valueHex?this.valueHexView=we.toUint8Array(r.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,r,i){const o=we.toUint8Array(e);return zt(this,o,r,i)?(this.valueHexView=o.subarray(r,r+i),i>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,ou.call(this),this.blockLength=i,r+i):-1}toBER(){return this.valueHexView.slice()}toJSON(){return Qe(Fe({},super.toJSON()),{value:this.value})}}Eu.NAME="BooleanValueBlock";var Au;class Ln extends st{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,Eu),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}Au=Ln,te.Boolean=Au,Ln.NAME="BOOLEAN";class Nu extends qt(sr){constructor(i={}){var o=i,{isConstructed:e=!1}=o,r=We(o,["isConstructed"]);super(r),this.isConstructed=e}fromBER(e,r,i){let o=0;if(this.isConstructed){if(this.isHexOnly=!1,o=sr.prototype.fromBER.call(this,e,r,i),o===-1)return o;for(let u=0;u<this.value.length;u++){const l=this.value[u].constructor.NAME;if(l===en){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(l!==au)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,o=super.fromBER(e,r,i),this.blockLength=i;return o}toBER(e,r){return this.isConstructed?sr.prototype.toBER.call(this,e,r):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return Qe(Fe({},super.toJSON()),{isConstructed:this.isConstructed})}}Nu.NAME="OctetStringValueBlock";var zi;class hr extends st{constructor(o={}){var u=o,{idBlock:e={},lenBlock:r={}}=u,i=We(u,["idBlock","lenBlock"]);var l,f;(l=i.isConstructed)!==null&&l!==void 0||(i.isConstructed=!!(!((f=i.value)===null||f===void 0)&&f.length)),super(Fe({idBlock:Fe({isConstructed:i.isConstructed},e),lenBlock:Qe(Fe({},r),{isIndefiniteForm:!!i.isIndefiniteForm})},i),Nu),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,r,i){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,i===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),r;if(!this.valueBlock.isConstructed){const u=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(r,r+i);try{if(u.byteLength){const l=Ir(u,0,u.byteLength);l.offset!==-1&&l.offset===i&&(this.valueBlock.value=[l.result])}}catch(l){}}return super.fromBER(e,r,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return dt.prototype.onAsciiEncoding.call(this);const e=this.constructor.NAME,r=Ve.ToHex(this.valueBlock.valueHexView);return`${e} : ${r}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const r of this.valueBlock.value)r instanceof zi&&e.push(r.valueBlock.valueHexView);return we.concat(e)}}zi=hr,te.OctetString=zi,hr.NAME=au;class wu extends qt(sr){constructor(o={}){var u=o,{unusedBits:e=0,isConstructed:r=!1}=u,i=We(u,["unusedBits","isConstructed"]);super(i),this.unusedBits=e,this.isConstructed=r,this.blockLength=this.valueHexView.byteLength}fromBER(e,r,i){if(!i)return r;let o=-1;if(this.isConstructed){if(o=sr.prototype.fromBER.call(this,e,r,i),o===-1)return o;for(const f of this.value){const p=f.constructor.NAME;if(p===en){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(p!==lu)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const g=f.valueBlock;if(this.unusedBits>0&&g.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=g.unusedBits}return o}const u=we.toUint8Array(e);if(!zt(this,u,r,i))return-1;const l=u.subarray(r,r+i);if(this.unusedBits=l[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const f=l.subarray(1);try{if(f.byteLength){const p=Ir(f,0,f.byteLength);p.offset!==-1&&p.offset===i-1&&(this.value=[p.result])}}catch(p){}}return this.valueHexView=l.subarray(1),this.blockLength=l.length,r+i}toBER(e,r){if(this.isConstructed)return sr.prototype.toBER.call(this,e,r);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){const o=new Uint8Array(1);return o[0]=0,o.buffer}const i=new Uint8Array(this.valueHexView.length+1);return i[0]=this.unusedBits,i.set(this.valueHexView,1),i.buffer}toJSON(){return Qe(Fe({},super.toJSON()),{unusedBits:this.unusedBits,isConstructed:this.isConstructed})}}wu.NAME="BitStringValueBlock";var bu;class dr extends st{constructor(o={}){var u=o,{idBlock:e={},lenBlock:r={}}=u,i=We(u,["idBlock","lenBlock"]);var l,f;(l=i.isConstructed)!==null&&l!==void 0||(i.isConstructed=!!(!((f=i.value)===null||f===void 0)&&f.length)),super(Fe({idBlock:Fe({isConstructed:i.isConstructed},e),lenBlock:Qe(Fe({},r),{isIndefiniteForm:!!i.isIndefiniteForm})},i),wu),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,r,i){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,r,i)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return dt.prototype.onAsciiEncoding.call(this);{const e=[],r=this.valueBlock.valueHexView;for(const l of r)e.push(l.toString(2).padStart(8,"0"));const i=e.join(""),o=this.constructor.NAME,u=i.substring(0,i.length-this.valueBlock.unusedBits);return`${o} : ${u}`}}}bu=dr,te.BitString=bu,dr.NAME=lu;var Du;function Zl(n,e){const r=new Uint8Array([0]),i=new Uint8Array(n),o=new Uint8Array(e);let u=i.slice(0);const l=u.length-1,f=o.slice(0),p=f.length-1;let g=0;const N=p<l?l:p;let E=0;for(let S=N;S>=0;S--,E++)!0===E<f.length?g=u[l-E]+f[p-E]+r[0]:g=u[l-E]+r[0],r[0]=g/10,!0===E>=u.length?u=ji(new Uint8Array([g%10]),u):u[l-E]=g%10;return r[0]>0&&(u=ji(r,u)),u}function Cu(n){if(n>=Zr.length)for(let e=Zr.length;e<=n;e++){const r=new Uint8Array([0]);let i=Zr[e-1].slice(0);for(let o=i.length-1;o>=0;o--){const u=new Uint8Array([(i[o]<<1)+r[0]]);r[0]=u[0]/10,i[o]=u[0]%10}r[0]>0&&(i=ji(r,i)),Zr.push(i)}return Zr[n]}function ec(n,e){let r=0;const i=new Uint8Array(n),o=new Uint8Array(e),u=i.slice(0),l=u.length-1,f=o.slice(0),p=f.length-1;let g,N=0;for(let E=p;E>=0;E--,N++)g=u[l-N]-f[p-N]-r,!0===g<0?(r=1,u[l-N]=g+10):(r=0,u[l-N]=g);if(r>0)for(let E=l-p+1;E>=0;E--,N++)if(g=u[l-N]-r,g<0)r=1,u[l-N]=g+10;else{r=0,u[l-N]=g;break}return u.slice()}class Yi extends qt(ht){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=ou.call(this)))}constructor(i={}){var o=i,{value:e}=o,r=We(o,["value"]);super(r),this._valueDec=0,r.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(Hl(e))}get valueDec(){return this._valueDec}fromDER(e,r,i,o=0){const u=this.fromBER(e,r,i);if(u===-1)return u;const l=this.valueHexView;return l[0]===0&&(l[1]&128)!==0?this.valueHexView=l.subarray(1):o!==0&&l.length<o&&(o-l.length>1&&(o=l.length+1),this.valueHexView=l.subarray(o-l.length)),u}toDER(e=!1){const r=this.valueHexView;switch(!0){case(r[0]&128)!==0:{const i=new Uint8Array(this.valueHexView.length+1);i[0]=0,i.set(r,1),this.valueHexView=i}break;case(r[0]===0&&(r[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,r,i){const o=super.fromBER(e,r,i);return o===-1||this.setValueHex(),o}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return Qe(Fe({},super.toJSON()),{valueDec:this.valueDec})}toString(){const e=this.valueHexView.length*8-1;let r=new Uint8Array(this.valueHexView.length*8/3),i=0,o;const u=this.valueHexView;let l="",f=!1;for(let p=u.byteLength-1;p>=0;p--){o=u[p];for(let g=0;g<8;g++)(o&1)===1&&(i===e?(r=ec(Cu(i),r),l="-"):r=Zl(r,Cu(i))),i++,o>>=1}for(let p=0;p<r.length;p++)r[p]&&(f=!0),f&&(l+=su.charAt(r[p]));return f===!1&&(l+=su.charAt(0)),l}}Du=Yi,Yi.NAME="IntegerValueBlock",Object.defineProperty(Du.prototype,"valueHex",{set:function(n){this.valueHexView=new Uint8Array(n),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var rn;class kr extends st{constructor(e={}){super(e,Yi),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Rn(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Rn();const r=BigInt(e),i=new kn,o=r.toString(16).replace(/^-/,""),u=new Uint8Array(Ve.FromHex(o));if(r<0){const f=new Uint8Array(u.length+(u[0]&128?1:0));f[0]|=128;const g=BigInt(`0x${Ve.ToHex(f)}`)+r,N=we.toUint8Array(Ve.FromHex(g.toString(16)));N[0]|=128,i.write(N)}else u[0]&128&&i.write(new Uint8Array([0])),i.write(u);return new rn({valueHex:i.final()})}convertToDER(){const e=new rn({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new rn({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}rn=kr,te.Integer=rn,kr.NAME="INTEGER";var xu;class Mn extends kr{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}xu=Mn,te.Enumerated=xu,Mn.NAME="ENUMERATED";class Ji extends qt(ht){constructor(o={}){var u=o,{valueDec:e=-1,isFirstSid:r=!1}=u,i=We(u,["valueDec","isFirstSid"]);super(i),this.valueDec=e,this.isFirstSid=r}fromBER(e,r,i){if(!i)return r;const o=we.toUint8Array(e);if(!zt(this,o,r,i))return-1;const u=o.subarray(r,r+i);this.valueHexView=new Uint8Array(i);for(let f=0;f<i&&(this.valueHexView[f]=u[f]&127,this.blockLength++,(u[f]&128)!==0);f++);const l=new Uint8Array(this.blockLength);for(let f=0;f<this.blockLength;f++)l[f]=this.valueHexView[f];return this.valueHexView=l,(u[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Or(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),r+this.blockLength)}set valueBigInt(e){Rn();let r=BigInt(e).toString(2);for(;r.length%7;)r="0"+r;const i=new Uint8Array(r.length/7);for(let o=0;o<i.length;o++)i[o]=parseInt(r.slice(o*7,o*7+7),2)+(o+1<i.length?128:0);this.fromBER(i.buffer,0,i.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const o=this.valueHexView,u=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength-1;l++)u[l]=o[l]|128;return u[this.blockLength-1]=o[this.blockLength-1],u.buffer}const r=cr(this.valueDec,7);if(r.byteLength===0)return this.error="Error during encoding SID value",Ht;const i=new Uint8Array(r.byteLength);if(!e){const o=new Uint8Array(r),u=r.byteLength-1;for(let l=0;l<u;l++)i[l]=o[l]|128;i[u]=o[u]}return i}toString(){let e="";if(this.isHexOnly)e=Ve.ToHex(this.valueHexView);else if(this.isFirstSid){let r=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",r-=40):(e="2.",r-=80),e+=r.toString()}else e=this.valueDec.toString();return e}toJSON(){return Qe(Fe({},super.toJSON()),{valueDec:this.valueDec,isFirstSid:this.isFirstSid})}}Ji.NAME="sidBlock";class Tu extends ht{constructor(i={}){var o=i,{value:e=mt}=o,r=We(o,["value"]);super(r),this.value=[],e&&this.fromString(e)}fromBER(e,r,i){let o=r;for(;i>0;){const u=new Ji;if(o=u.fromBER(e,o,i),o===-1)return this.blockLength=0,this.error=u.error,o;this.value.length===0&&(u.isFirstSid=!0),this.blockLength+=u.blockLength,i-=u.blockLength,this.value.push(u)}return o}toBER(e){const r=[];for(let i=0;i<this.value.length;i++){const o=this.value[i].toBER(e);if(o.byteLength===0)return this.error=this.value[i].error,Ht;r.push(o)}return $i(r)}fromString(e){this.value=[];let r=0,i=0,o="",u=!1;do if(i=e.indexOf(".",r),i===-1?o=e.substring(r):o=e.substring(r,i),r=i+1,u){const l=this.value[0];let f=0;switch(l.valueDec){case 0:break;case 1:f=40;break;case 2:f=80;break;default:this.value=[];return}const p=parseInt(o,10);if(isNaN(p))return;l.valueDec=p+f,u=!1}else{const l=new Ji;if(o>Number.MAX_SAFE_INTEGER){Rn();const f=BigInt(o);l.valueBigInt=f}else if(l.valueDec=parseInt(o,10),isNaN(l.valueDec))return;this.value.length||(l.isFirstSid=!0,u=!0),this.value.push(l)}while(i!==-1)}toString(){let e="",r=!1;for(let i=0;i<this.value.length;i++){r=this.value[i].isHexOnly;let o=this.value[i].toString();i!==0&&(e=`${e}.`),r?(o=`{${o}}`,this.value[i].isFirstSid?e=`2.{${o} - 80}`:e+=o):e+=o}return e}toJSON(){const e=Qe(Fe({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let r=0;r<this.value.length;r++)e.sidArray.push(this.value[r].toJSON());return e}}Tu.NAME="ObjectIdentifierValueBlock";var Su;class Fn extends st{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Tu),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return Qe(Fe({},super.toJSON()),{value:this.getValue()})}}Su=Fn,te.ObjectIdentifier=Su,Fn.NAME="OBJECT IDENTIFIER";class Ki extends qt(fr){constructor(i={}){var o=i,{valueDec:e=0}=o,r=We(o,["valueDec"]);super(r),this.valueDec=e}fromBER(e,r,i){if(i===0)return r;const o=we.toUint8Array(e);if(!zt(this,o,r,i))return-1;const u=o.subarray(r,r+i);this.valueHexView=new Uint8Array(i);for(let f=0;f<i&&(this.valueHexView[f]=u[f]&127,this.blockLength++,(u[f]&128)!==0);f++);const l=new Uint8Array(this.blockLength);for(let f=0;f<this.blockLength;f++)l[f]=this.valueHexView[f];return this.valueHexView=l,(u[this.blockLength-1]&128)!==0?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Or(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),r+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const o=this.valueHexView,u=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength-1;l++)u[l]=o[l]|128;return u[this.blockLength-1]=o[this.blockLength-1],u.buffer}const r=cr(this.valueDec,7);if(r.byteLength===0)return this.error="Error during encoding SID value",Ht;const i=new Uint8Array(r.byteLength);if(!e){const o=new Uint8Array(r),u=r.byteLength-1;for(let l=0;l<u;l++)i[l]=o[l]|128;i[u]=o[u]}return i.buffer}toString(){let e="";return this.isHexOnly?e=Ve.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return Qe(Fe({},super.toJSON()),{valueDec:this.valueDec})}}Ki.NAME="relativeSidBlock";class Bu extends ht{constructor(i={}){var o=i,{value:e=mt}=o,r=We(o,["value"]);super(r),this.value=[],e&&this.fromString(e)}fromBER(e,r,i){let o=r;for(;i>0;){const u=new Ki;if(o=u.fromBER(e,o,i),o===-1)return this.blockLength=0,this.error=u.error,o;this.blockLength+=u.blockLength,i-=u.blockLength,this.value.push(u)}return o}toBER(e,r){const i=[];for(let o=0;o<this.value.length;o++){const u=this.value[o].toBER(e);if(u.byteLength===0)return this.error=this.value[o].error,Ht;i.push(u)}return $i(i)}fromString(e){this.value=[];let r=0,i=0,o="";do{i=e.indexOf(".",r),i===-1?o=e.substring(r):o=e.substring(r,i),r=i+1;const u=new Ki;if(u.valueDec=parseInt(o,10),isNaN(u.valueDec))return!0;this.value.push(u)}while(i!==-1);return!0}toString(){let e="",r=!1;for(let i=0;i<this.value.length;i++){r=this.value[i].isHexOnly;let o=this.value[i].toString();i!==0&&(e=`${e}.`),r&&(o=`{${o}}`),e+=o}return e}toJSON(){const e=Qe(Fe({},super.toJSON()),{value:this.toString(),sidArray:[]});for(let r=0;r<this.value.length;r++)e.sidArray.push(this.value[r].toJSON());return e}}Bu.NAME="RelativeObjectIdentifierValueBlock";var Ou;class Qi extends st{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Bu),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return Qe(Fe({},super.toJSON()),{value:this.getValue()})}}Ou=Qi,te.RelativeObjectIdentifier=Ou,Qi.NAME="RelativeObjectIdentifier";var Iu;class It extends dt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}Iu=It,te.Sequence=Iu,It.NAME="SEQUENCE";var Ru;class jt extends dt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}}Ru=jt,te.Set=Ru,jt.NAME="SET";class ku extends qt(ht){constructor(r={}){var e=We(r,[]);super(e),this.isHexOnly=!0,this.value=mt}toJSON(){return Qe(Fe({},super.toJSON()),{value:this.value})}}ku.NAME="StringValueBlock";class _u extends ku{}_u.NAME="SimpleStringValueBlock";class wt extends Xi{constructor(r={}){var e=We(r,[]);super(e,_u)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,we.toUint8Array(e))}fromString(e){const r=e.length,i=this.valueBlock.valueHexView=new Uint8Array(r);for(let o=0;o<r;o++)i[o]=e.charCodeAt(o);this.valueBlock.value=e}}wt.NAME="SIMPLE STRING";class Lu extends wt{fromBuffer(e){this.valueBlock.valueHexView=we.toUint8Array(e);try{this.valueBlock.value=Ve.ToUtf8String(e)}catch(r){this.warnings.push(`Error during "decodeURIComponent": ${r}, using raw string`),this.valueBlock.value=Ve.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(Ve.FromUtf8String(e)),this.valueBlock.value=e}}Lu.NAME="Utf8StringValueBlock";var Mu;class Yt extends Lu{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}Mu=Yt,te.Utf8String=Mu,Yt.NAME="UTF8String";class Fu extends wt{fromBuffer(e){this.valueBlock.value=Ve.ToUtf16String(e),this.valueBlock.valueHexView=we.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(Ve.FromUtf16String(e))}}Fu.NAME="BmpStringValueBlock";var Uu;class Un extends Fu{constructor(r={}){var e=We(r,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}Uu=Un,te.BmpString=Uu,Un.NAME="BMPString";class Pu extends wt{fromBuffer(e){const r=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),i=new Uint8Array(r);for(let o=0;o<i.length;o+=4)i[o]=i[o+3],i[o+1]=i[o+2],i[o+2]=0,i[o+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(r))}fromString(e){const r=e.length,i=this.valueBlock.valueHexView=new Uint8Array(r*4);for(let o=0;o<r;o++){const u=cr(e.charCodeAt(o),8),l=new Uint8Array(u);if(l.length>4)continue;const f=4-l.length;for(let p=l.length-1;p>=0;p--)i[o*4+p+f]=l[p]}this.valueBlock.value=e}}Pu.NAME="UniversalStringValueBlock";var Vu;class Pn extends Pu{constructor(r={}){var e=We(r,[]);super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}Vu=Pn,te.UniversalString=Vu,Pn.NAME="UniversalString";var Hu;class Vn extends wt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}Hu=Vn,te.NumericString=Hu,Vn.NAME="NumericString";var qu;class Hn extends wt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}qu=Hn,te.PrintableString=qu,Hn.NAME="PrintableString";var ju;class qn extends wt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}ju=qn,te.TeletexString=ju,qn.NAME="TeletexString";var $u;class jn extends wt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}$u=jn,te.VideotexString=$u,jn.NAME="VideotexString";var Gu;class $n extends wt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}Gu=$n,te.IA5String=Gu,$n.NAME="IA5String";var Xu;class Gn extends wt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}Xu=Gn,te.GraphicString=Xu,Gn.NAME="GraphicString";var Wu;class nn extends wt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}Wu=nn,te.VisibleString=Wu,nn.NAME="VisibleString";var zu;class Xn extends wt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}zu=Xn,te.GeneralString=zu,Xn.NAME="GeneralString";var Yu;class Wn extends wt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}Yu=Wn,te.CharacterString=Yu,Wn.NAME="CharacterString";var Ju;class on extends nn{constructor(o={}){var u=o,{value:e,valueDate:r}=u,i=We(u,["value","valueDate"]);if(super(i),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let l=0;l<e.length;l++)this.valueBlock.valueHexView[l]=e.charCodeAt(l)}r&&(this.fromDate(r),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,we.toUint8Array(e)))}toBuffer(){const e=this.toString(),r=new ArrayBuffer(e.length),i=new Uint8Array(r);for(let o=0;o<e.length;o++)i[o]=e.charCodeAt(o);return r}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const i=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(i===null){this.error="Wrong input string for conversion";return}const o=parseInt(i[1],10);o>=50?this.year=1900+o:this.year=2e3+o,this.month=parseInt(i[2],10),this.day=parseInt(i[3],10),this.hour=parseInt(i[4],10),this.minute=parseInt(i[5],10),this.second=parseInt(i[6],10)}toString(e="iso"){if(e==="iso"){const r=new Array(7);return r[0]=Nt(this.year<2e3?this.year-1900:this.year-2e3,2),r[1]=Nt(this.month,2),r[2]=Nt(this.day,2),r[3]=Nt(this.hour,2),r[4]=Nt(this.minute,2),r[5]=Nt(this.second,2),r[6]="Z",r.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return Qe(Fe({},super.toJSON()),{year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second})}}Ju=on,te.UTCTime=Ju,on.NAME="UTCTime";var Ku;class zn extends on{constructor(e={}){var r;super(e),(r=this.millisecond)!==null&&r!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let r=!1,i="",o="",u=0,l,f=0,p=0;if(e[e.length-1]==="Z")i=e.substring(0,e.length-1),r=!0;else{const E=new Number(e[e.length-1]);if(isNaN(E.valueOf()))throw new Error("Wrong input string for conversion");i=e}if(r){if(i.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(i.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let E=1,S=i.indexOf("+"),C="";if(S===-1&&(S=i.indexOf("-"),E=-1),S!==-1){if(C=i.substring(S+1),i=i.substring(0,S),C.length!==2&&C.length!==4)throw new Error("Wrong input string for conversion");let I=parseInt(C.substring(0,2),10);if(isNaN(I.valueOf()))throw new Error("Wrong input string for conversion");if(f=E*I,C.length===4){if(I=parseInt(C.substring(2,4),10),isNaN(I.valueOf()))throw new Error("Wrong input string for conversion");p=E*I}}}let g=i.indexOf(".");if(g===-1&&(g=i.indexOf(",")),g!==-1){const E=new Number(`0${i.substring(g)}`);if(isNaN(E.valueOf()))throw new Error("Wrong input string for conversion");u=E.valueOf(),o=i.substring(0,g)}else o=i;switch(!0){case o.length===8:if(l=/(\d{4})(\d{2})(\d{2})/ig,g!==-1)throw new Error("Wrong input string for conversion");break;case o.length===10:if(l=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,g!==-1){let E=60*u;this.minute=Math.floor(E),E=60*(E-this.minute),this.second=Math.floor(E),E=1e3*(E-this.second),this.millisecond=Math.floor(E)}break;case o.length===12:if(l=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,g!==-1){let E=60*u;this.second=Math.floor(E),E=1e3*(E-this.second),this.millisecond=Math.floor(E)}break;case o.length===14:if(l=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,g!==-1){const E=1e3*u;this.millisecond=Math.floor(E)}break;default:throw new Error("Wrong input string for conversion")}const N=l.exec(o);if(N===null)throw new Error("Wrong input string for conversion");for(let E=1;E<N.length;E++)switch(E){case 1:this.year=parseInt(N[E],10);break;case 2:this.month=parseInt(N[E],10);break;case 3:this.day=parseInt(N[E],10);break;case 4:this.hour=parseInt(N[E],10)+f;break;case 5:this.minute=parseInt(N[E],10)+p;break;case 6:this.second=parseInt(N[E],10);break;default:throw new Error("Wrong input string for conversion")}if(r===!1){const E=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=E.getUTCFullYear(),this.month=E.getUTCMonth(),this.day=E.getUTCDay(),this.hour=E.getUTCHours(),this.minute=E.getUTCMinutes(),this.second=E.getUTCSeconds(),this.millisecond=E.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const r=[];return r.push(Nt(this.year,4)),r.push(Nt(this.month,2)),r.push(Nt(this.day,2)),r.push(Nt(this.hour,2)),r.push(Nt(this.minute,2)),r.push(Nt(this.second,2)),this.millisecond!==0&&(r.push("."),r.push(Nt(this.millisecond,3))),r.push("Z"),r.join("")}return super.toString(e)}toJSON(){return Qe(Fe({},super.toJSON()),{millisecond:this.millisecond})}}Ku=zn,te.GeneralizedTime=Ku,zn.NAME="GeneralizedTime";var Qu;class Zi extends Yt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}Qu=Zi,te.DATE=Qu,Zi.NAME="DATE";var Zu;class eo extends Yt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}Zu=eo,te.TimeOfDay=Zu,eo.NAME="TimeOfDay";var ea;class to extends Yt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}ea=to,te.DateTime=ea,to.NAME="DateTime";var ta;class ro extends Yt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}ta=ro,te.Duration=ta,ro.NAME="Duration";var ra;class no extends Yt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}ra=no,te.TIME=ra,no.NAME="TIME";class gr{constructor({name:e=mt,optional:r=!1}={}){this.name=e,this.optional=r}}class io extends gr{constructor(i={}){var o=i,{value:e=[]}=o,r=We(o,["value"]);super(r),this.value=e}}class Yn extends gr{constructor(o={}){var u=o,{value:e=new gr,local:r=!1}=u,i=We(u,["value","local"]);super(i),this.value=e,this.local=r}}class tc{get data(){return this.dataView.slice().buffer}set data(e){this.dataView=we.toUint8Array(e)}constructor({data:e=_n}={}){this.dataView=we.toUint8Array(e)}fromBER(e,r,i){const o=r+i;return this.dataView=we.toUint8Array(e).subarray(r,o),o}toBER(e){return this.dataView.slice().buffer}}function ur(n,e,r){if(r instanceof io){for(const u of r.value)if(ur(n,e,u).verified)return{verified:!0,result:n};{const u={verified:!1,result:{error:"Wrong values for Choice type"}};return r.hasOwnProperty(Gi)&&(u.name=r.name),u}}if(r instanceof gr)return r.hasOwnProperty(Gi)&&(n[r.name]=e),{verified:!0,result:n};if(!(n instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(r instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!($l in r))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(zl in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(Yl in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const i=r.idBlock.toBER(!1);if(i.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(r.idBlock.fromBER(i,0,i.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(r.idBlock.hasOwnProperty(Gl)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:n};if(r.idBlock.hasOwnProperty(Xl)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:n};if(r.idBlock.hasOwnProperty(Wl)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:n};if(!(jl in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(r.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:n};if(r.idBlock.isHexOnly){if(!(uu in r.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const u=r.idBlock.valueHexView,l=e.idBlock.valueHexView;if(u.length!==l.length)return{verified:!1,result:n};for(let f=0;f<u.length;f++)if(u[f]!==l[1])return{verified:!1,result:n}}if(r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,mt),r.name&&(n[r.name]=e)),r instanceof te.Constructed){let u=0,l={verified:!1,result:{error:"Unknown error"}},f=r.valueBlock.value.length;if(f>0&&r.valueBlock.value[0]instanceof Yn&&(f=e.valueBlock.value.length),f===0)return{verified:!0,result:n};if(e.valueBlock.value.length===0&&r.valueBlock.value.length!==0){let p=!0;for(let g=0;g<r.valueBlock.value.length;g++)p=p&&(r.valueBlock.value[g].optional||!1);return p?{verified:!0,result:n}:(r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,mt),r.name&&delete n[r.name]),n.error="Inconsistent object length",{verified:!1,result:n})}for(let p=0;p<f;p++)if(p-u>=e.valueBlock.value.length){if(r.valueBlock.value[p].optional===!1){const g={verified:!1,result:n};return n.error="Inconsistent length between ASN.1 data and schema",r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,mt),r.name&&(delete n[r.name],g.name=r.name)),g}}else if(r.valueBlock.value[0]instanceof Yn){if(l=ur(n,e.valueBlock.value[p],r.valueBlock.value[0].value),l.verified===!1)if(r.valueBlock.value[0].optional)u++;else return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,mt),r.name&&delete n[r.name]),l;if(Gi in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){let g={};Jl in r.valueBlock.value[0]&&r.valueBlock.value[0].local?g=e:g=n,typeof g[r.valueBlock.value[0].name]=="undefined"&&(g[r.valueBlock.value[0].name]=[]),g[r.valueBlock.value[0].name].push(e.valueBlock.value[p])}}else if(l=ur(n,e.valueBlock.value[p-u],r.valueBlock.value[p]),l.verified===!1)if(r.valueBlock.value[p].optional)u++;else return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,mt),r.name&&delete n[r.name]),l;if(l.verified===!1){const p={verified:!1,result:n};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,mt),r.name&&(delete n[r.name],p.name=r.name)),p}return{verified:!0,result:n}}if(r.primitiveSchema&&uu in e.valueBlock){const u=Ir(e.valueBlock.valueHexView);if(u.offset===-1){const l={verified:!1,result:u.result};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,mt),r.name&&(delete n[r.name],l.name=r.name)),l}return ur(n,u.result,r.primitiveSchema)}return{verified:!0,result:n}}function rc(n,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const r=Ir(we.toUint8Array(n));return r.offset===-1?{verified:!1,result:r.result}:ur(r.result,r.result,e)}var na=Object.freeze({__proto__:null,Any:gr,BaseBlock:st,BaseStringBlock:Xi,BitString:dr,BmpString:Un,Boolean:Ln,CharacterString:Wn,Choice:io,Constructed:dt,DATE:Zi,DateTime:to,Duration:ro,EndOfContent:Wi,Enumerated:Mn,GeneralString:Xn,GeneralizedTime:zn,GraphicString:Gn,HexBlock:qt,IA5String:$n,Integer:kr,Null:pr,NumericString:Vn,ObjectIdentifier:Fn,OctetString:hr,Primitive:tn,PrintableString:Hn,RawData:tc,RelativeObjectIdentifier:Qi,Repeated:Yn,Sequence:It,Set:jt,TIME:no,TeletexString:qn,TimeOfDay:eo,UTCTime:on,UniversalString:Pn,Utf8String:Yt,ValueBlock:ht,VideotexString:jn,ViewWriter:kn,VisibleString:nn,compareSchema:ur,fromBER:Rr,verifySchema:rc}),j;(function(n){n[n.Sequence=0]="Sequence",n[n.Set=1]="Set",n[n.Choice=2]="Choice"})(j||(j={}));var T;(function(n){n[n.Any=1]="Any",n[n.Boolean=2]="Boolean",n[n.OctetString=3]="OctetString",n[n.BitString=4]="BitString",n[n.Integer=5]="Integer",n[n.Enumerated=6]="Enumerated",n[n.ObjectIdentifier=7]="ObjectIdentifier",n[n.Utf8String=8]="Utf8String",n[n.BmpString=9]="BmpString",n[n.UniversalString=10]="UniversalString",n[n.NumericString=11]="NumericString",n[n.PrintableString=12]="PrintableString",n[n.TeletexString=13]="TeletexString",n[n.VideotexString=14]="VideotexString",n[n.IA5String=15]="IA5String",n[n.GraphicString=16]="GraphicString",n[n.VisibleString=17]="VisibleString",n[n.GeneralString=18]="GeneralString",n[n.CharacterString=19]="CharacterString",n[n.UTCTime=20]="UTCTime",n[n.GeneralizedTime=21]="GeneralizedTime",n[n.DATE=22]="DATE",n[n.TimeOfDay=23]="TimeOfDay",n[n.DateTime=24]="DateTime",n[n.Duration=25]="Duration",n[n.TIME=26]="TIME",n[n.Null=27]="Null"})(T||(T={}));class Jn{constructor(e,r=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(we.isBufferSource(e))this.unusedBits=r,this.value=we.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof dr))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new dr({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new dr({name:e})}toNumber(){let e="";const r=new Uint8Array(this.value);for(const i of r)e+=i.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let r=e.toString(2);const i=r.length+7>>3;this.unusedBits=(i<<3)-r.length;const o=new Uint8Array(i);r=r.padStart(i<<3,"0").split("").reverse().join("");let u=0;for(;u<i;)o[u]=parseInt(r.slice(u<<3,(u<<3)+8),2),u++;this.value=o.buffer}}class xe{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):we.isBufferSource(e)?this.buffer=we.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof hr))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new hr({valueHex:this.buffer})}toSchema(e){return new hr({name:e})}}const nc={fromASN:n=>n instanceof pr?null:n.valueBeforeDecodeView,toASN:n=>{if(n===null)return new pr;const e=Rr(n);if(e.result.error)throw new Error(e.result.error);return e.result}},ic={fromASN:n=>n.valueBlock.valueHexView.byteLength>=4?n.valueBlock.toString():n.valueBlock.valueDec,toASN:n=>new kr({value:+n})},oc={fromASN:n=>n.valueBlock.valueDec,toASN:n=>new Mn({value:n})},bt={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new kr({valueHex:n})},sc={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new dr({valueHex:n})},uc={fromASN:n=>n.valueBlock.toString(),toASN:n=>new Fn({value:n})},ac={fromASN:n=>n.valueBlock.value,toASN:n=>new Ln({value:n})},oo={fromASN:n=>n.valueBlock.valueHexView,toASN:n=>new hr({valueHex:n})},lc={fromASN:n=>new xe(n.getValue()),toASN:n=>n.toASN()};function xt(n){return{fromASN:e=>e.valueBlock.value,toASN:e=>new n({value:e})}}const cc=xt(Yt),fc=xt(Un),pc=xt(Pn),hc=xt(Vn),dc=xt(Hn),gc=xt(qn),mc=xt(jn),yc=xt($n),vc=xt(Gn),Ec=xt(nn),Ac=xt(Xn),Nc=xt(Wn),wc={fromASN:n=>n.toDate(),toASN:n=>new on({valueDate:n})},bc={fromASN:n=>n.toDate(),toASN:n=>new zn({valueDate:n})},Dc={fromASN:()=>null,toASN:()=>new pr};function sn(n){switch(n){case T.Any:return nc;case T.BitString:return sc;case T.BmpString:return fc;case T.Boolean:return ac;case T.CharacterString:return Nc;case T.Enumerated:return oc;case T.GeneralString:return Ac;case T.GeneralizedTime:return bc;case T.GraphicString:return vc;case T.IA5String:return yc;case T.Integer:return ic;case T.Null:return Dc;case T.NumericString:return hc;case T.ObjectIdentifier:return uc;case T.OctetString:return oo;case T.PrintableString:return dc;case T.TeletexString:return gc;case T.UTCTime:return wc;case T.UniversalString:return pc;case T.Utf8String:return cc;case T.VideotexString:return mc;case T.VisibleString:return Ec;default:return null}}function Jt(n){return typeof n=="function"&&n.prototype?n.prototype.toASN&&n.prototype.fromASN?!0:Jt(n.prototype):!!(n&&typeof n=="object"&&"toASN"in n&&"fromASN"in n)}function ia(n){var e;if(n){const r=Object.getPrototypeOf(n);return((e=r==null?void 0:r.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:ia(r)}return!1}function Cc(n,e){if(!(n&&e)||n.byteLength!==e.byteLength)return!1;const r=new Uint8Array(n),i=new Uint8Array(e);for(let o=0;o<n.byteLength;o++)if(r[o]!==i[o])return!1;return!0}class xc{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,r=!1){const i=this.items.get(e);if(!i)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(r&&!i.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return i}cache(e){const r=this.get(e);r.schema||(r.schema=this.create(e,!0))}createDefault(e){const r={type:j.Sequence,items:{}},i=this.findParentSchema(e);return i&&(Object.assign(r,i),r.items=Object.assign({},r.items,i.items)),r}create(e,r){const i=this.items.get(e)||this.createDefault(e),o=[];for(const u in i.items){const l=i.items[u],f=r?u:"";let p;if(typeof l.type=="number"){const N=T[l.type],E=na[N];if(!E)throw new Error(`Cannot get ASN1 class by name '${N}'`);p=new E({name:f})}else Jt(l.type)?p=new l.type().toSchema(f):l.optional?this.get(l.type).type===j.Choice?p=new gr({name:f}):(p=this.create(l.type,!1),p.name=f):p=new gr({name:f});const g=!!l.optional||l.defaultValue!==void 0;if(l.repeated){p.name="";const N=l.repeated==="set"?jt:It;p=new N({name:"",value:[new Yn({name:f,value:p})]})}if(l.context!==null&&l.context!==void 0)if(l.implicit)if(typeof l.type=="number"||Jt(l.type)){const N=l.repeated?dt:tn;o.push(new N({name:f,optional:g,idBlock:{tagClass:3,tagNumber:l.context}}))}else{this.cache(l.type);const N=!!l.repeated;let E=N?p:this.get(l.type,!0).schema;E="valueBlock"in E?E.valueBlock.value:E.value,o.push(new dt({name:N?"":f,optional:g,idBlock:{tagClass:3,tagNumber:l.context},value:E}))}else o.push(new dt({optional:g,idBlock:{tagClass:3,tagNumber:l.context},value:[p]}));else p.optional=g,o.push(p)}switch(i.type){case j.Sequence:return new It({value:o,name:""});case j.Set:return new jt({value:o,name:""});case j.Choice:return new io({value:o,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,r){return this.items.set(e,r),this}findParentSchema(e){const r=Object.getPrototypeOf(e);return r?this.items.get(r)||this.findParentSchema(r):null}}const ut=new xc,ie=n=>e=>{let r;ut.has(e)?r=ut.get(e):(r=ut.createDefault(e),ut.set(e,r)),Object.assign(r,n)},d=n=>(e,r)=>{let i;ut.has(e.constructor)?i=ut.get(e.constructor):(i=ut.createDefault(e.constructor),ut.set(e.constructor,i));const o=Object.assign({},n);if(typeof o.type=="number"&&!o.converter){const u=sn(n.type);if(!u)throw new Error(`Cannot get default converter for property '${r}' of ${e.constructor.name}`);o.converter=u}o.raw=n.raw,i.items[r]=o};class un extends Error{constructor(){super(...arguments),this.schemas=[]}}class oa{static parse(e,r){const i=Rr(e);if(i.result.error)throw new Error(i.result.error);return this.fromASN(i.result,r)}static fromASN(e,r){try{if(Jt(r))return new r().fromASN(e);const i=ut.get(r);ut.cache(r);let o=i.schema;const u=this.handleChoiceTypes(e,i,r,o);if(u!=null&&u.result)return u.result;u!=null&&u.targetSchema&&(o=u.targetSchema);const l=this.handleSequenceTypes(e,i,r,o),f=new r;return ia(r)?this.handleArrayTypes(e,i,r):(this.processSchemaItems(i,l,f),f)}catch(i){throw i instanceof un&&i.schemas.push(r.name),i}}static handleChoiceTypes(e,r,i,o){if(e.constructor===dt&&r.type===j.Choice&&e.idBlock.tagClass===3)for(const u in r.items){const l=r.items[u];if(l.context===e.idBlock.tagNumber&&l.implicit&&typeof l.type=="function"&&ut.has(l.type)){const f=ut.get(l.type);if(f&&f.type===j.Sequence){const p=new It;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in p.valueBlock){p.valueBlock.value=e.valueBlock.value;const g=this.fromASN(p,l.type),N=new i;return N[u]=g,{result:N}}}}}else if(e.constructor===dt&&r.type!==j.Choice){const u=new dt({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:r.schema.valueBlock.value});for(const l in r.items)delete e[l];return{targetSchema:u}}return null}static handleSequenceTypes(e,r,i,o){if(r.type===j.Sequence){const u=ur({},e,o);if(!u.verified)throw new un(`Data does not match to ${i.name} ASN1 schema.${u.result.error?` ${u.result.error}`:""}`);return u}else{const u=ur({},e,o);if(!u.verified)throw new un(`Data does not match to ${i.name} ASN1 schema.${u.result.error?` ${u.result.error}`:""}`);return u}}static processRepeatedField(e,r,i){let o=e.slice(r);if(o.length===1&&o[0].constructor.name==="Sequence"){const u=o[0];u.valueBlock&&u.valueBlock.value&&Array.isArray(u.valueBlock.value)&&(o=u.valueBlock.value)}if(typeof i.type=="number"){const u=sn(i.type);if(!u)throw new Error(`No converter for ASN.1 type ${i.type}`);return o.filter(l=>l&&l.valueBlock).map(l=>{try{return u.fromASN(l)}catch(f){return}}).filter(l=>l!==void 0)}else return o.filter(u=>u&&u.valueBlock).map(u=>{try{return this.fromASN(u,i.type)}catch(l){return}}).filter(u=>u!==void 0)}static processPrimitiveField(e,r){const i=sn(r.type);if(!i)throw new Error(`No converter for ASN.1 type ${r.type}`);return i.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&typeof e.type=="function"&&ut.has(e.type)&&ut.get(e.type).type===j.Choice}static processOptionalChoiceField(e,r){try{return{processed:!0,value:this.fromASN(e,r.type)}}catch(i){if(i instanceof un&&/Wrong values for Choice type/.test(i.message))return{processed:!1};throw i}}static handleArrayTypes(e,r,i){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const o=r.itemType;if(typeof o=="number"){const u=sn(o);if(!u)throw new Error(`Cannot get default converter for array item of ${i.name} ASN1 schema`);return i.from(e.valueBlock.value,l=>u.fromASN(l))}else return i.from(e.valueBlock.value,u=>this.fromASN(u,o))}static processSchemaItems(e,r,i){for(const o in e.items){const u=r.result[o];if(!u)continue;const l=e.items[o],f=l.type;let p;typeof f=="number"||Jt(f)?p=this.processPrimitiveSchemaItem(u,l,f):p=this.processComplexSchemaItem(u,l,f),p&&typeof p=="object"&&"value"in p&&"raw"in p?(i[o]=p.value,i[`${o}Raw`]=p.raw):i[o]=p}}static processPrimitiveSchemaItem(e,r,i){var o;const u=(o=r.converter)!==null&&o!==void 0?o:Jt(i)?new i:null;if(!u)throw new Error("Converter is empty");return r.repeated?this.processRepeatedPrimitiveItem(e,r,u):this.processSinglePrimitiveItem(e,r,i,u)}static processRepeatedPrimitiveItem(e,r,i){if(r.implicit){const o=r.repeated==="sequence"?It:jt,u=new o;u.valueBlock=e.valueBlock;const l=Rr(u.toBER(!1));if(l.offset===-1)throw new Error(`Cannot parse the child item. ${l.result.error}`);if(!("value"in l.result.valueBlock&&Array.isArray(l.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const f=l.result.valueBlock.value;return Array.from(f,p=>i.fromASN(p))}else return Array.from(e,o=>i.fromASN(o))}static processSinglePrimitiveItem(e,r,i,o){let u=e;if(r.implicit){let l;if(Jt(i))l=new i().toSchema("");else{const f=T[i],p=na[f];if(!p)throw new Error(`Cannot get '${f}' class from asn1js module`);l=new p}l.valueBlock=u.valueBlock,u=Rr(l.toBER(!1)).result}return o.fromASN(u)}static processComplexSchemaItem(e,r,i){if(r.repeated){if(!Array.isArray(e))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(e,o=>this.fromASN(o,i))}else{const o=this.handleImplicitTagging(e,r,i);if(this.isOptionalChoiceField(r))try{return this.fromASN(o,i)}catch(u){if(u instanceof un&&/Wrong values for Choice type/.test(u.message))return;throw u}else{const u=this.fromASN(o,i);return r.raw?{value:u,raw:e.valueBeforeDecodeView}:u}}}static handleImplicitTagging(e,r,i){if(r.implicit&&typeof r.context=="number"){const o=ut.get(i);if(o.type===j.Sequence){const u=new It;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in u.valueBlock)return u.valueBlock.value=e.valueBlock.value,u}else if(o.type===j.Set){const u=new jt;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in u.valueBlock)return u.valueBlock.value=e.valueBlock.value,u}}return e}}class so{static serialize(e){return e instanceof st?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&Jt(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const r=e.constructor,i=ut.get(r);ut.cache(r);let o=[];if(i.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof i.itemType=="number"){const l=sn(i.itemType);if(!l)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);o=e.map(f=>l.toASN(f))}else o=e.map(l=>this.toAsnItem({type:i.itemType},"[]",r,l))}else for(const l in i.items){const f=i.items[l],p=e[l];if(p===void 0||f.defaultValue===p||typeof f.defaultValue=="object"&&typeof p=="object"&&Cc(this.serialize(f.defaultValue),this.serialize(p)))continue;const g=so.toAsnItem(f,l,r,p);if(typeof f.context=="number")if(f.implicit)if(!f.repeated&&(typeof f.type=="number"||Jt(f.type))){const N={};N.valueHex=g instanceof pr?g.valueBeforeDecodeView:g.valueBlock.toBER(),o.push(new tn(Fe({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context}},N)))}else o.push(new dt({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},value:g.valueBlock.value}));else o.push(new dt({optional:f.optional,idBlock:{tagClass:3,tagNumber:f.context},value:[g]}));else f.repeated?o=o.concat(g):o.push(g)}let u;switch(i.type){case j.Sequence:u=new It({value:o});break;case j.Set:u=new jt({value:o});break;case j.Choice:if(!o[0])throw new Error(`Schema '${r.name}' has wrong data. Choice cannot be empty.`);u=o[0];break}return u}static toAsnItem(e,r,i,o){let u;if(typeof e.type=="number"){const l=e.converter;if(!l)throw new Error(`Property '${r}' doesn't have converter for type ${T[e.type]} in schema '${i.name}'`);if(e.repeated){if(!Array.isArray(o))throw new TypeError("Parameter 'objProp' should be type of Array.");const f=Array.from(o,g=>l.toASN(g)),p=e.repeated==="sequence"?It:jt;u=new p({value:f})}else u=l.toASN(o)}else if(e.repeated){if(!Array.isArray(o))throw new TypeError("Parameter 'objProp' should be type of Array.");const l=Array.from(o,p=>this.toASN(p)),f=e.repeated==="sequence"?It:jt;u=new f({value:l})}else u=this.toASN(o);return u}}class Ue extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const r of e)this.push(r)}}}class Rt{static serialize(e){return so.serialize(e)}static parse(e,r){return oa.parse(e,r)}static toString(e){const r=we.isBufferSource(e)?we.toArrayBuffer(e):Rt.serialize(e),i=Rr(r);if(i.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${i.result.error}`);return i.result.toString()}}function h(n,e,r,i){var o=arguments.length,u=o<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(n,e,r,i);else for(var f=n.length-1;f>=0;f--)(l=n[f])&&(u=(o<3?l(u):o>3?l(e,r,u):l(e,r))||u);return o>3&&u&&Object.defineProperty(e,r,u),u}typeof SuppressedError=="function"&&SuppressedError;var uo;let sa=uo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,uo.prototype)}};sa=uo=h([ie({type:j.Sequence,itemType:T.ObjectIdentifier})],sa);let ao=class{constructor(e=new Date){this.value=e}};h([d({type:T.GeneralizedTime})],ao.prototype,"value",void 0),ao=h([ie({type:j.Choice})],ao);let lo=class{constructor(e=null){this.value=e}};h([d({type:T.Null})],lo.prototype,"value",void 0),lo=h([ie({type:j.Choice})],lo);class ua{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){const r=e.split(".");if(r.length!==4)throw new Error("Invalid IPv4 address");return r.map(i=>{const o=parseInt(i,10);if(isNaN(o)||o<0||o>255)throw new Error("Invalid IPv4 address part");return o})}static parseIPv6(e){const i=this.expandIPv6(e).split(":");if(i.length!==8)throw new Error("Invalid IPv6 address");return i.reduce((o,u)=>{const l=parseInt(u,16);if(isNaN(l)||l<0||l>65535)throw new Error("Invalid IPv6 address part");return o.push(l>>8&255),o.push(l&255),o},[])}static expandIPv6(e){if(!e.includes("::"))return e;const r=e.split("::");if(r.length>2)throw new Error("Invalid IPv6 address");const i=r[0]?r[0].split(":"):[],o=r[1]?r[1].split(":"):[],u=8-(i.length+o.length);if(u<0)throw new Error("Invalid IPv6 address");return[...i,...Array(u).fill("0"),...o].join(":")}static formatIPv6(e){const r=[];for(let i=0;i<16;i+=2)r.push((e[i]<<8|e[i+1]).toString(16));return this.compressIPv6(r.join(":"))}static compressIPv6(e){const r=e.split(":");let i=-1,o=0,u=-1,l=0;for(let f=0;f<r.length;f++)r[f]==="0"?(u===-1&&(u=f),l++):(l>o&&(i=u,o=l),u=-1,l=0);if(l>o&&(i=u,o=l),o>1){const f=r.slice(0,i).join(":"),p=r.slice(i+o).join(":");return`${f}::${p}`}return e}static parseCIDR(e){const[r,i]=e.split("/"),o=parseInt(i,10);if(this.isIPv4(r)){if(o<0||o>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(r),o]}else{if(o<0||o>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(r),o]}}static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const r=parseInt(e.slice(8),16).toString(2).split("").reduce((o,u)=>o+ +u,0);let i=e.slice(0,8).replace(/(.{2})/g,o=>`${parseInt(o,16)}.`);return i=i.slice(0,-1),`${i}/${r}`}static toString(e){const r=new Uint8Array(e);if(r.length===4)return Array.from(r).join(".");if(r.length===16)return this.formatIPv6(r);if(r.length===8||r.length===32){const i=r.length/2,o=r.slice(0,i),u=r.slice(i);if(r.every(p=>p===0))return r.length===8?"0.0.0.0/0":"::/0";const f=u.reduce((p,g)=>p+(g.toString(2).match(/1/g)||[]).length,0);return r.length===8?`${Array.from(o).join(".")}/${f}`:`${this.formatIPv6(o)}/${f}`}return this.decodeIP(Ve.ToHex(e))}static fromString(e){if(e.includes("/")){const[i,o]=this.parseCIDR(e),u=new Uint8Array(i.length);let l=o;for(let p=0;p<u.length;p++)l>=8?(u[p]=255,l-=8):l>0&&(u[p]=255<<8-l,l=0);const f=new Uint8Array(i.length*2);return f.set(i,0),f.set(u,i.length),f.buffer}const r=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(r).buffer}}var co,fo,po;let kt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};h([d({type:T.TeletexString})],kt.prototype,"teletexString",void 0),h([d({type:T.PrintableString})],kt.prototype,"printableString",void 0),h([d({type:T.UniversalString})],kt.prototype,"universalString",void 0),h([d({type:T.Utf8String})],kt.prototype,"utf8String",void 0),h([d({type:T.BmpString})],kt.prototype,"bmpString",void 0),kt=h([ie({type:j.Choice})],kt);let _r=class extends kt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?Ve.ToHex(this.anyValue):super.toString())}};h([d({type:T.IA5String})],_r.prototype,"ia5String",void 0),h([d({type:T.Any})],_r.prototype,"anyValue",void 0),_r=h([ie({type:j.Choice})],_r);class ho{constructor(e={}){this.type="",this.value=new _r,Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],ho.prototype,"type",void 0),h([d({type:_r})],ho.prototype,"value",void 0);let Kn=co=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,co.prototype)}};Kn=co=h([ie({type:j.Set,itemType:ho})],Kn);let go=fo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,fo.prototype)}};go=fo=h([ie({type:j.Sequence,itemType:Kn})],go);let yt=po=class extends go{constructor(e){super(e),Object.setPrototypeOf(this,po.prototype)}};yt=po=h([ie({type:j.Sequence})],yt);const Tc={fromASN:n=>ua.toString(oo.fromASN(n)),toASN:n=>oo.toASN(ua.fromString(n))};class mo{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],mo.prototype,"typeId",void 0),h([d({type:T.Any,context:0})],mo.prototype,"value",void 0);class yo{constructor(e={}){this.partyName=new kt,Object.assign(this,e)}}h([d({type:kt,optional:!0,context:0,implicit:!0})],yo.prototype,"nameAssigner",void 0),h([d({type:kt,context:1,implicit:!0})],yo.prototype,"partyName",void 0);let Se=class{constructor(e={}){Object.assign(this,e)}};h([d({type:mo,context:0,implicit:!0})],Se.prototype,"otherName",void 0),h([d({type:T.IA5String,context:1,implicit:!0})],Se.prototype,"rfc822Name",void 0),h([d({type:T.IA5String,context:2,implicit:!0})],Se.prototype,"dNSName",void 0),h([d({type:T.Any,context:3,implicit:!0})],Se.prototype,"x400Address",void 0),h([d({type:yt,context:4,implicit:!1})],Se.prototype,"directoryName",void 0),h([d({type:yo,context:5})],Se.prototype,"ediPartyName",void 0),h([d({type:T.IA5String,context:6,implicit:!0})],Se.prototype,"uniformResourceIdentifier",void 0),h([d({type:T.OctetString,context:7,implicit:!0,converter:Tc})],Se.prototype,"iPAddress",void 0),h([d({type:T.ObjectIdentifier,context:8,implicit:!0})],Se.prototype,"registeredID",void 0),Se=h([ie({type:j.Choice})],Se);var vo;class Qn{constructor(e={}){this.accessMethod="",this.accessLocation=new Se,Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],Qn.prototype,"accessMethod",void 0),h([d({type:Se})],Qn.prototype,"accessLocation",void 0);let Zn=vo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,vo.prototype)}};Zn=vo=h([ie({type:j.Sequence,itemType:Qn})],Zn);class aa extends xe{}class Eo{constructor(e={}){e&&Object.assign(this,e)}}h([d({type:aa,context:0,optional:!0,implicit:!0})],Eo.prototype,"keyIdentifier",void 0),h([d({type:Se,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Eo.prototype,"authorityCertIssuer",void 0),h([d({type:T.Integer,context:2,optional:!0,implicit:!0,converter:bt})],Eo.prototype,"authorityCertSerialNumber",void 0);class la{constructor(e={}){this.cA=!1,Object.assign(this,e)}}h([d({type:T.Boolean,defaultValue:!1})],la.prototype,"cA",void 0),h([d({type:T.Integer,optional:!0})],la.prototype,"pathLenConstraint",void 0);var Ao;let _t=Ao=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,Ao.prototype)}};_t=Ao=h([ie({type:j.Sequence,itemType:Se})],_t);var No;let ca=No=class extends _t{constructor(e){super(e),Object.setPrototypeOf(this,No.prototype)}};ca=No=h([ie({type:j.Sequence})],ca);var wo;let Kt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};h([d({type:T.IA5String})],Kt.prototype,"ia5String",void 0),h([d({type:T.VisibleString})],Kt.prototype,"visibleString",void 0),h([d({type:T.BmpString})],Kt.prototype,"bmpString",void 0),h([d({type:T.Utf8String})],Kt.prototype,"utf8String",void 0),Kt=h([ie({type:j.Choice})],Kt);class bo{constructor(e={}){this.organization=new Kt,this.noticeNumbers=[],Object.assign(this,e)}}h([d({type:Kt})],bo.prototype,"organization",void 0),h([d({type:T.Integer,repeated:"sequence"})],bo.prototype,"noticeNumbers",void 0);class Do{constructor(e={}){Object.assign(this,e)}}h([d({type:bo,optional:!0})],Do.prototype,"noticeRef",void 0),h([d({type:Kt,optional:!0})],Do.prototype,"explicitText",void 0);let ei=class{constructor(e={}){Object.assign(this,e)}};h([d({type:T.IA5String})],ei.prototype,"cPSuri",void 0),h([d({type:Do})],ei.prototype,"userNotice",void 0),ei=h([ie({type:j.Choice})],ei);class Co{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],Co.prototype,"policyQualifierId",void 0),h([d({type:T.Any})],Co.prototype,"qualifier",void 0);class xo{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],xo.prototype,"policyIdentifier",void 0),h([d({type:Co,repeated:"sequence",optional:!0})],xo.prototype,"policyQualifiers",void 0);let fa=wo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,wo.prototype)}};fa=wo=h([ie({type:j.Sequence,itemType:xo})],fa);let ti=class{constructor(e=0){this.value=e}};h([d({type:T.Integer})],ti.prototype,"value",void 0),ti=h([ie({type:j.Choice})],ti);let pa=class extends ti{};pa=h([ie({type:j.Choice})],pa);var To,Lt;(function(n){n[n.unused=1]="unused",n[n.keyCompromise=2]="keyCompromise",n[n.cACompromise=4]="cACompromise",n[n.affiliationChanged=8]="affiliationChanged",n[n.superseded=16]="superseded",n[n.cessationOfOperation=32]="cessationOfOperation",n[n.certificateHold=64]="certificateHold",n[n.privilegeWithdrawn=128]="privilegeWithdrawn",n[n.aACompromise=256]="aACompromise"})(Lt||(Lt={}));class ha extends Jn{toJSON(){const e=[],r=this.toNumber();return r&Lt.aACompromise&&e.push("aACompromise"),r&Lt.affiliationChanged&&e.push("affiliationChanged"),r&Lt.cACompromise&&e.push("cACompromise"),r&Lt.certificateHold&&e.push("certificateHold"),r&Lt.cessationOfOperation&&e.push("cessationOfOperation"),r&Lt.keyCompromise&&e.push("keyCompromise"),r&Lt.privilegeWithdrawn&&e.push("privilegeWithdrawn"),r&Lt.superseded&&e.push("superseded"),r&Lt.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Lr=class{constructor(e={}){Object.assign(this,e)}};h([d({type:Se,context:0,repeated:"sequence",implicit:!0})],Lr.prototype,"fullName",void 0),h([d({type:Kn,context:1,implicit:!0})],Lr.prototype,"nameRelativeToCRLIssuer",void 0),Lr=h([ie({type:j.Choice})],Lr);class an{constructor(e={}){Object.assign(this,e)}}h([d({type:Lr,context:0,optional:!0})],an.prototype,"distributionPoint",void 0),h([d({type:ha,context:1,optional:!0,implicit:!0})],an.prototype,"reasons",void 0),h([d({type:Se,context:2,optional:!0,repeated:"sequence",implicit:!0})],an.prototype,"cRLIssuer",void 0);let So=To=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,To.prototype)}};So=To=h([ie({type:j.Sequence,itemType:an})],So);var Bo;let da=Bo=class extends So{constructor(e){super(e),Object.setPrototypeOf(this,Bo.prototype)}};da=Bo=h([ie({type:j.Sequence,itemType:an})],da);class ft{constructor(e={}){this.onlyContainsUserCerts=ft.ONLY,this.onlyContainsCACerts=ft.ONLY,this.indirectCRL=ft.ONLY,this.onlyContainsAttributeCerts=ft.ONLY,Object.assign(this,e)}}ft.ONLY=!1,h([d({type:Lr,context:0,optional:!0})],ft.prototype,"distributionPoint",void 0),h([d({type:T.Boolean,context:1,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"onlyContainsUserCerts",void 0),h([d({type:T.Boolean,context:2,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"onlyContainsCACerts",void 0),h([d({type:ha,context:3,optional:!0,implicit:!0})],ft.prototype,"onlySomeReasons",void 0),h([d({type:T.Boolean,context:4,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"indirectCRL",void 0),h([d({type:T.Boolean,context:5,defaultValue:ft.ONLY,implicit:!0})],ft.prototype,"onlyContainsAttributeCerts",void 0);var ln;(function(n){n[n.unspecified=0]="unspecified",n[n.keyCompromise=1]="keyCompromise",n[n.cACompromise=2]="cACompromise",n[n.affiliationChanged=3]="affiliationChanged",n[n.superseded=4]="superseded",n[n.cessationOfOperation=5]="cessationOfOperation",n[n.certificateHold=6]="certificateHold",n[n.removeFromCRL=8]="removeFromCRL",n[n.privilegeWithdrawn=9]="privilegeWithdrawn",n[n.aACompromise=10]="aACompromise"})(ln||(ln={}));let ri=class{constructor(e=ln.unspecified){this.reason=ln.unspecified,this.reason=e}toJSON(){return ln[this.reason]}toString(){return this.toJSON()}};h([d({type:T.Enumerated})],ri.prototype,"reason",void 0),ri=h([ie({type:j.Choice})],ri);var Oo;let ga=Oo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,Oo.prototype)}};ga=Oo=h([ie({type:j.Sequence,itemType:T.ObjectIdentifier})],ga);let Io=class{constructor(e=new ArrayBuffer(0)){this.value=e}};h([d({type:T.Integer,converter:bt})],Io.prototype,"value",void 0),Io=h([ie({type:j.Choice})],Io);let Ro=class{constructor(e){this.value=new Date,e&&(this.value=e)}};h([d({type:T.GeneralizedTime})],Ro.prototype,"value",void 0),Ro=h([ie({type:j.Choice})],Ro);var ko;let ma=ko=class extends _t{constructor(e){super(e),Object.setPrototypeOf(this,ko.prototype)}};ma=ko=h([ie({type:j.Sequence})],ma);var ya;(function(n){n[n.digitalSignature=1]="digitalSignature",n[n.nonRepudiation=2]="nonRepudiation",n[n.keyEncipherment=4]="keyEncipherment",n[n.dataEncipherment=8]="dataEncipherment",n[n.keyAgreement=16]="keyAgreement",n[n.keyCertSign=32]="keyCertSign",n[n.cRLSign=64]="cRLSign",n[n.encipherOnly=128]="encipherOnly",n[n.decipherOnly=256]="decipherOnly"})(ya||(ya={}));var _o;class ni{constructor(e={}){this.base=new Se,this.minimum=0,Object.assign(this,e)}}h([d({type:Se})],ni.prototype,"base",void 0),h([d({type:T.Integer,context:0,defaultValue:0,implicit:!0})],ni.prototype,"minimum",void 0),h([d({type:T.Integer,context:1,optional:!0,implicit:!0})],ni.prototype,"maximum",void 0);let ii=_o=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,_o.prototype)}};ii=_o=h([ie({type:j.Sequence,itemType:ni})],ii);class va{constructor(e={}){Object.assign(this,e)}}h([d({type:ii,context:0,optional:!0,implicit:!0})],va.prototype,"permittedSubtrees",void 0),h([d({type:ii,context:1,optional:!0,implicit:!0})],va.prototype,"excludedSubtrees",void 0);class Ea{constructor(e={}){Object.assign(this,e)}}h([d({type:T.Integer,context:0,implicit:!0,optional:!0,converter:bt})],Ea.prototype,"requireExplicitPolicy",void 0),h([d({type:T.Integer,context:1,implicit:!0,optional:!0,converter:bt})],Ea.prototype,"inhibitPolicyMapping",void 0);var Lo;class Mo{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],Mo.prototype,"issuerDomainPolicy",void 0),h([d({type:T.ObjectIdentifier})],Mo.prototype,"subjectDomainPolicy",void 0);let Aa=Lo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,Lo.prototype)}};Aa=Lo=h([ie({type:j.Sequence,itemType:Mo})],Aa);var Fo;let Na=Fo=class extends _t{constructor(e){super(e),Object.setPrototypeOf(this,Fo.prototype)}};Na=Fo=h([ie({type:j.Sequence})],Na);class cn{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],cn.prototype,"type",void 0),h([d({type:T.Any,repeated:"set"})],cn.prototype,"values",void 0);var Uo;let wa=Uo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,Uo.prototype)}};wa=Uo=h([ie({type:j.Sequence,itemType:cn})],wa);class pn extends aa{}class ba{constructor(e={}){Object.assign(this,e)}}h([d({type:T.GeneralizedTime,context:0,implicit:!0,optional:!0})],ba.prototype,"notBefore",void 0),h([d({type:T.GeneralizedTime,context:1,implicit:!0,optional:!0})],ba.prototype,"notAfter",void 0);var hn;(function(n){n[n.keyUpdateAllowed=1]="keyUpdateAllowed",n[n.newExtensions=2]="newExtensions",n[n.pKIXCertificate=4]="pKIXCertificate"})(hn||(hn={}));class Da extends Jn{toJSON(){const e=[],r=this.toNumber();return r&hn.pKIXCertificate&&e.push("pKIXCertificate"),r&hn.newExtensions&&e.push("newExtensions"),r&hn.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class Ca{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new Da,Object.assign(this,e)}}h([d({type:T.GeneralString})],Ca.prototype,"entrustVers",void 0),h([d({type:Da})],Ca.prototype,"entrustInfoFlags",void 0);var Po;let xa=Po=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,Po.prototype)}};xa=Po=h([ie({type:j.Sequence,itemType:Qn})],xa);class ve{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof ve&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&Vl(e.parameters,this.parameters)||e.parameters===this.parameters)}}h([d({type:T.ObjectIdentifier})],ve.prototype,"algorithm",void 0),h([d({type:T.Any,optional:!0})],ve.prototype,"parameters",void 0);class oi{constructor(e={}){this.algorithm=new ve,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:ve})],oi.prototype,"algorithm",void 0),h([d({type:T.BitString})],oi.prototype,"subjectPublicKey",void 0);let pt=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const r=new Date(e);r.setMilliseconds(0),r.getUTCFullYear()>2049?this.generalTime=r:this.utcTime=r}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};h([d({type:T.UTCTime})],pt.prototype,"utcTime",void 0),h([d({type:T.GeneralizedTime})],pt.prototype,"generalTime",void 0),pt=h([ie({type:j.Choice})],pt);class si{constructor(e){this.notBefore=new pt(new Date),this.notAfter=new pt(new Date),e&&(this.notBefore=new pt(e.notBefore),this.notAfter=new pt(e.notAfter))}}h([d({type:pt})],si.prototype,"notBefore",void 0),h([d({type:pt})],si.prototype,"notAfter",void 0);var Vo;class vt{constructor(e={}){this.extnID="",this.critical=vt.CRITICAL,this.extnValue=new xe,Object.assign(this,e)}}vt.CRITICAL=!1,h([d({type:T.ObjectIdentifier})],vt.prototype,"extnID",void 0),h([d({type:T.Boolean,defaultValue:vt.CRITICAL})],vt.prototype,"critical",void 0),h([d({type:xe})],vt.prototype,"extnValue",void 0);let Mr=Vo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,Vo.prototype)}};Mr=Vo=h([ie({type:j.Sequence,itemType:vt})],Mr);var ui;(function(n){n[n.v1=0]="v1",n[n.v2=1]="v2",n[n.v3=2]="v3"})(ui||(ui={}));class Tt{constructor(e={}){this.version=ui.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ve,this.issuer=new yt,this.validity=new si,this.subject=new yt,this.subjectPublicKeyInfo=new oi,Object.assign(this,e)}}h([d({type:T.Integer,context:0,defaultValue:ui.v1})],Tt.prototype,"version",void 0),h([d({type:T.Integer,converter:bt})],Tt.prototype,"serialNumber",void 0),h([d({type:ve})],Tt.prototype,"signature",void 0),h([d({type:yt})],Tt.prototype,"issuer",void 0),h([d({type:si})],Tt.prototype,"validity",void 0),h([d({type:yt})],Tt.prototype,"subject",void 0),h([d({type:oi})],Tt.prototype,"subjectPublicKeyInfo",void 0),h([d({type:T.BitString,context:1,implicit:!0,optional:!0})],Tt.prototype,"issuerUniqueID",void 0),h([d({type:T.BitString,context:2,implicit:!0,optional:!0})],Tt.prototype,"subjectUniqueID",void 0),h([d({type:Mr,context:3,optional:!0})],Tt.prototype,"extensions",void 0);class mr{constructor(e={}){this.tbsCertificate=new Tt,this.signatureAlgorithm=new ve,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:Tt,raw:!0})],mr.prototype,"tbsCertificate",void 0),h([d({type:ve})],mr.prototype,"signatureAlgorithm",void 0),h([d({type:T.BitString})],mr.prototype,"signatureValue",void 0);class ai{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new pt,Object.assign(this,e)}}h([d({type:T.Integer,converter:bt})],ai.prototype,"userCertificate",void 0),h([d({type:pt})],ai.prototype,"revocationDate",void 0),h([d({type:vt,optional:!0,repeated:"sequence"})],ai.prototype,"crlEntryExtensions",void 0);class Qt{constructor(e={}){this.signature=new ve,this.issuer=new yt,this.thisUpdate=new pt,Object.assign(this,e)}}h([d({type:T.Integer,optional:!0})],Qt.prototype,"version",void 0),h([d({type:ve})],Qt.prototype,"signature",void 0),h([d({type:yt})],Qt.prototype,"issuer",void 0),h([d({type:pt})],Qt.prototype,"thisUpdate",void 0),h([d({type:pt,optional:!0})],Qt.prototype,"nextUpdate",void 0),h([d({type:ai,repeated:"sequence",optional:!0})],Qt.prototype,"revokedCertificates",void 0),h([d({type:vt,optional:!0,context:0,repeated:"sequence"})],Qt.prototype,"crlExtensions",void 0);class Ho{constructor(e={}){this.tbsCertList=new Qt,this.signatureAlgorithm=new ve,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:Qt,raw:!0})],Ho.prototype,"tbsCertList",void 0),h([d({type:ve})],Ho.prototype,"signatureAlgorithm",void 0),h([d({type:T.BitString})],Ho.prototype,"signature",void 0);var qo;class jo{constructor(e={}){this.sigIdentifier=new ve,Object.assign(this,e)}}h([d({type:ve})],jo.prototype,"sigIdentifier",void 0),h([d({type:ve,optional:!0})],jo.prototype,"certIdentifier",void 0);let Ta=qo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,qo.prototype)}};Ta=qo=h([ie({type:j.Sequence,itemType:jo})],Ta);class Sa{constructor(e={}){this.issuer=new yt,this.locator=new Zn,Object.assign(this,e)}}h([d({type:yt})],Sa.prototype,"issuer",void 0),h([d({type:Zn})],Sa.prototype,"locator",void 0);class Sc extends xe{}let Fr=class{constructor(e={}){Object.assign(this,e)}};h([d({type:yt,context:1})],Fr.prototype,"byName",void 0),h([d({type:Sc,context:2})],Fr.prototype,"byKey",void 0),Fr=h([ie({type:j.Choice})],Fr);class Zt{constructor(e={}){this.hashAlgorithm=new ve,this.issuerNameHash=new xe,this.issuerKeyHash=new xe,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:ve})],Zt.prototype,"hashAlgorithm",void 0),h([d({type:xe})],Zt.prototype,"issuerNameHash",void 0),h([d({type:xe})],Zt.prototype,"issuerKeyHash",void 0),h([d({type:T.Integer,converter:bt})],Zt.prototype,"serialNumber",void 0);class $o{constructor(e={}){this.revocationTime=new Date,Object.assign(this,e)}}h([d({type:T.GeneralizedTime})],$o.prototype,"revocationTime",void 0),h([d({type:ri,context:0,optional:!0})],$o.prototype,"revocationReason",void 0);let yr=class{constructor(e={}){Object.assign(this,e)}};h([d({type:T.Null,context:0,implicit:!0})],yr.prototype,"good",void 0),h([d({type:$o,context:1,implicit:!0})],yr.prototype,"revoked",void 0),h([d({type:T.Null,context:2,implicit:!0})],yr.prototype,"unknown",void 0),yr=h([ie({type:j.Choice})],yr);class Ur{constructor(e={}){this.certID=new Zt,this.certStatus=new yr,this.thisUpdate=new Date,Object.assign(this,e)}}h([d({type:Zt})],Ur.prototype,"certID",void 0),h([d({type:yr})],Ur.prototype,"certStatus",void 0),h([d({type:T.GeneralizedTime})],Ur.prototype,"thisUpdate",void 0),h([d({type:T.GeneralizedTime,context:0,optional:!0})],Ur.prototype,"nextUpdate",void 0),h([d({type:vt,context:1,repeated:"sequence",optional:!0})],Ur.prototype,"singleExtensions",void 0);var Pr;(function(n){n[n.v1=0]="v1"})(Pr||(Pr={}));class vr{constructor(e={}){this.version=Pr.v1,this.responderID=new Fr,this.producedAt=new Date,this.responses=[],Object.assign(this,e)}}h([d({type:T.Integer,context:0,defaultValue:Pr.v1})],vr.prototype,"version",void 0),h([d({type:Fr})],vr.prototype,"responderID",void 0),h([d({type:T.GeneralizedTime})],vr.prototype,"producedAt",void 0),h([d({type:Ur,repeated:"sequence"})],vr.prototype,"responses",void 0),h([d({type:vt,repeated:"sequence",context:1,optional:!0})],vr.prototype,"responseExtensions",void 0);class dn{constructor(e={}){this.tbsResponseData=new vr,this.signatureAlgorithm=new ve,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:vr,raw:!0})],dn.prototype,"tbsResponseData",void 0),h([d({type:ve})],dn.prototype,"signatureAlgorithm",void 0),h([d({type:T.BitString})],dn.prototype,"signature",void 0),h([d({type:mr,repeated:"sequence",optional:!0,context:0})],dn.prototype,"certs",void 0);class li{constructor(e={}){this.signatureAlgorithm=new ve,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:ve})],li.prototype,"signatureAlgorithm",void 0),h([d({type:T.BitString})],li.prototype,"signature",void 0),h([d({type:mr,repeated:"sequence",optional:!0,context:0})],li.prototype,"certs",void 0);class ci{constructor(e={}){this.reqCert=new Zt,Object.assign(this,e)}}h([d({type:Zt})],ci.prototype,"reqCert",void 0),h([d({type:vt,repeated:"sequence",optional:!0})],ci.prototype,"singleRequestExtensions",void 0);class Er{constructor(e={}){this.version=Pr.v1,this.requestList=[],Object.assign(this,e)}}h([d({type:T.Integer,context:0,defaultValue:Pr.v1})],Er.prototype,"version",void 0),h([d({type:Se,context:1,optional:!0})],Er.prototype,"requestorName",void 0),h([d({type:ci,repeated:"sequence"})],Er.prototype,"requestList",void 0),h([d({type:vt,context:2,optional:!0,repeated:"sequence"})],Er.prototype,"requestExtensions",void 0);class Go{constructor(e={}){this.tbsRequest=new Er,Object.assign(this,e)}}h([d({type:Er,raw:!0})],Go.prototype,"tbsRequest",void 0),h([d({type:li,optional:!0,context:0})],Go.prototype,"optionalSignature",void 0);var er;(function(n){n[n.successful=0]="successful",n[n.malformedRequest=1]="malformedRequest",n[n.internalError=2]="internalError",n[n.tryLater=3]="tryLater",n[n.sigRequired=5]="sigRequired",n[n.unauthorized=6]="unauthorized"})(er||(er={}));class Xo{constructor(e={}){this.responseType="",this.response=new xe,Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],Xo.prototype,"responseType",void 0),h([d({type:xe})],Xo.prototype,"response",void 0);class Wo{constructor(e={}){this.responseStatus=er.successful,Object.assign(this,e)}}h([d({type:T.Enumerated})],Wo.prototype,"responseStatus",void 0),h([d({type:Xo,context:0,optional:!0})],Wo.prototype,"responseBytes",void 0);var fi=(n,e,r)=>new Promise((i,o)=>{var u=p=>{try{f(r.next(p))}catch(g){o(g)}},l=p=>{try{f(r.throw(p))}catch(g){o(g)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,l);f((r=r.apply(n,e)).next())});function zo(n){return fi(this,arguments,function*(e,r={}){const{timeout:i=1e4,method:o="GET",body:u,contentType:l,accept:f,proxyUrl:p}=r,g=p?`${p}${encodeURIComponent(e)}`:e,N=new AbortController,E=setTimeout(()=>N.abort(),i);try{const S={};l&&(S["Content-Type"]=l),f&&(S.Accept=f);const C=yield fetch(g,{method:o,headers:S,body:u?new Uint8Array(u):void 0,signal:N.signal});if(clearTimeout(E),!C.ok)return{ok:!1,status:C.status,error:`HTTP ${C.status}: ${C.statusText}`};const I=yield C.arrayBuffer();return{ok:!0,status:C.status,data:I}}catch(S){return clearTimeout(E),S instanceof Error?S.name==="AbortError"?{ok:!1,status:0,error:`Request timeout after ${i}ms`}:{ok:!1,status:0,error:S.message}:{ok:!1,status:0,error:String(S)}}})}function Bc(n,e,r=5e3,i){return fi(this,null,function*(){return zo(n,{method:"POST",body:e,contentType:"application/ocsp-request",accept:"application/ocsp-response",timeout:r,proxyUrl:i})})}function Oc(n,e=1e4,r){return fi(this,null,function*(){return zo(n,{method:"GET",accept:"application/pkix-crl",timeout:e,proxyUrl:r})})}function Ic(n,e=5e3,r){return fi(this,null,function*(){return zo(n,{method:"GET",accept:"application/pkix-cert",timeout:e,proxyUrl:r})})}function Ba(n){const e=new Uint8Array(n);if(typeof btoa=="function"){let r="";for(let i=0;i<e.length;i++)r+=String.fromCharCode(e[i]);return btoa(r)}return Buffer.from(e).toString("base64")}function Oa(n){const e=n.replace(/\s/g,"");if(typeof atob=="function"){const i=atob(e),o=new Uint8Array(i.length);for(let u=0;u<i.length;u++)o[u]=i.charCodeAt(u);return o.buffer}const r=Buffer.from(e,"base64");return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}function Rc(n){return new Uint8Array(Oa(n))}function pi(n){return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,"0")).join("")}function kc(n){const e=new Uint8Array(n.length/2);for(let r=0;r<n.length;r+=2)e[r/2]=parseInt(n.substring(r,r+2),16);return e.buffer}function Ia(n,e="CERTIFICATE"){const r=Ba(n).match(/.{1,64}/g)||[];return`-----BEGIN ${e}-----
79
+ ${r.join(`
74
80
  `)}
75
- -----END ${e}-----`}var Or=(r,e,t)=>new Promise((i,n)=>{var o=l=>{try{c(t.next(l))}catch(f){n(f)}},s=l=>{try{c(t.throw(l))}catch(f){n(f)}},c=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,s);c((t=t.apply(r,e)).next())});const Ds="1.3.6.1.5.5.7.1.1",xc="1.3.14.3.2.26";function Rs(r){return Or(this,null,function*(){if(typeof crypto!="undefined"&&crypto.subtle)return crypto.subtle.digest("SHA-1",r);const e=require("crypto").createHash("sha1");return e.update(Buffer.from(r)),e.digest().buffer})}function Nc(r){try{const e=r.getExtension(Ds);return e?e.ocsp.filter(t=>t.type==="url").map(t=>t.value):[]}catch(e){return[]}}function Cc(r){try{const e=r.getExtension(Ds);return e?e.caIssuers.filter(t=>t.type==="url").map(t=>t.value):[]}catch(e){return[]}}function Ec(r,e){const t=r.issuer;for(const i of e)try{const n=new D.X509Certificate(i);if(n.subject===t)return n}catch(n){}return null}function Ic(r,e=5e3,t){return Or(this,null,function*(){const i=Cc(r);for(const n of i)try{const o=yield Sc(n,e,t);if(o.ok&&o.data)try{return new D.X509Certificate(o.data)}catch(s){const c=js(o.data);return new D.X509Certificate(c)}}catch(o){}return null})}function Oc(r,e){return Or(this,null,function*(){const t=cs.parse(e.rawData,qe),i=fe.serialize(t.tbsCertificate.subject),n=yield Rs(i),o=yield Rs(t.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey),s=kc(r.serialNumber),c=new Ie({hashAlgorithm:new k({algorithm:xc}),issuerNameHash:new O(n),issuerKeyHash:new O(o),serialNumber:s}),l=new Er({reqCert:c}),f=new ze({requestList:[l]}),h=new sn({tbsRequest:f});return fe.serialize(h)})}function Tc(r){const e=new Date;try{const t=fe.parse(r,cn);switch(t.responseStatus){case Oe.successful:break;case Oe.malformedRequest:return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP responder returned: malformed request",checkedAt:e};case Oe.internalError:return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP responder returned: internal error",checkedAt:e};case Oe.tryLater:return{isValid:!1,status:"unknown",method:"ocsp",reason:"OCSP responder returned: try later",checkedAt:e};case Oe.sigRequired:return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP responder requires signature",checkedAt:e};case Oe.unauthorized:return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP responder returned: unauthorized",checkedAt:e};default:return{isValid:!1,status:"error",method:"ocsp",reason:`OCSP responder returned unknown status: ${t.responseStatus}`,checkedAt:e}}if(!t.responseBytes)return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP response has no response bytes",checkedAt:e};const i=fe.parse(t.responseBytes.response.buffer,Ut).tbsResponseData.responses;if(!i||i.length===0)return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP response contains no certificate status",checkedAt:e};const n=i[0].certStatus;return n.good!==void 0?{isValid:!0,status:"good",method:"ocsp",checkedAt:e}:n.revoked?{isValid:!1,status:"revoked",method:"ocsp",reason:n.revoked.revocationReason!==void 0?`Certificate revoked (reason: ${n.revoked.revocationReason})`:"Certificate revoked",revokedAt:n.revoked.revocationTime,checkedAt:e}:n.unknown!==void 0?{isValid:!1,status:"unknown",method:"ocsp",reason:"OCSP responder does not know about this certificate",checkedAt:e}:{isValid:!1,status:"error",method:"ocsp",reason:"Unexpected certificate status in OCSP response",checkedAt:e}}catch(t){return{isValid:!1,status:"error",method:"ocsp",reason:`Failed to parse OCSP response: ${t instanceof Error?t.message:String(t)}`,checkedAt:e}}}function Vc(r,e){return Or(this,arguments,function*(t,i,n={}){const{timeout:o=5e3,certificateChain:s=[],proxyUrl:c}=n,l=new Date,f=Nc(t);if(f.length===0)return{isValid:!1,status:"unknown",method:"ocsp",reason:"Certificate has no OCSP responder URL",checkedAt:l};let h=i;if(h||(h=Ec(t,s)),h||(h=yield Ic(t,o,c)),!h)return{isValid:!1,status:"unknown",method:"ocsp",reason:"Could not find or fetch issuer certificate for OCSP",checkedAt:l};let d;try{d=yield Oc(t,h)}catch(g){return{isValid:!1,status:"error",method:"ocsp",reason:`Failed to build OCSP request: ${g instanceof Error?g.message:String(g)}`,checkedAt:l}}for(const g of f)try{const y=yield bc(g,d,o,c);if(y.ok&&y.data)return Tc(y.data)}catch(y){}return{isValid:!1,status:"error",method:"ocsp",reason:"All OCSP requests failed",checkedAt:l}})}var Uc=(r,e,t)=>new Promise((i,n)=>{var o=l=>{try{c(t.next(l))}catch(f){n(f)}},s=l=>{try{c(t.throw(l))}catch(f){n(f)}},c=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,s);c((t=t.apply(r,e)).next())});const jc="2.5.29.31";function Dc(r){try{const e=r.getExtension(jc);if(!e)return[];const t=[];for(const i of e.distributionPoints)if(i.distributionPoint){const n=i.distributionPoint;if("fullName"in n&&n.fullName)for(const o of n.fullName)o.uniformResourceIdentifier&&t.push(o.uniformResourceIdentifier)}return t}catch(e){return[]}}function Rc(r,e){const t=e.toLowerCase().replace(/^0+(?=.)/,"")||"0";for(const i of r.entries)if((i.serialNumber.toLowerCase().replace(/^0+(?=.)/,"")||"0")===t)return{isRevoked:!0,revokedAt:i.revocationDate,reason:i.reason};return{isRevoked:!1}}function Lc(r){try{return new D.X509Crl(r)}catch(e){try{const t=`-----BEGIN X509 CRL-----
76
- ${(Vs(r).match(/.{1,64}/g)||[]).join(`
81
+ -----END ${e}-----`}var hi=(n,e,r)=>new Promise((i,o)=>{var u=p=>{try{f(r.next(p))}catch(g){o(g)}},l=p=>{try{f(r.throw(p))}catch(g){o(g)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,l);f((r=r.apply(n,e)).next())});const Ra="1.3.6.1.5.5.7.1.1",_c="1.3.14.3.2.26";function ka(n){return hi(this,null,function*(){if(typeof crypto!="undefined"&&crypto.subtle)return crypto.subtle.digest("SHA-1",n);const e=require("crypto").createHash("sha1");return e.update(Buffer.from(n)),e.digest().buffer})}function Lc(n){try{const e=n.getExtension(Ra);return e?e.ocsp.filter(r=>r.type==="url").map(r=>r.value):[]}catch(e){return[]}}function Mc(n){try{const e=n.getExtension(Ra);return e?e.caIssuers.filter(r=>r.type==="url").map(r=>r.value):[]}catch(e){return[]}}function _a(n,e){const r=n.issuer;for(const i of e)try{const o=new ke.X509Certificate(i);if(o.subject===r)return o}catch(o){}return null}function La(n,e=5e3,r){return hi(this,null,function*(){const i=Mc(n);for(const o of i)try{const u=yield Ic(o,e,r);if(u.ok&&u.data)try{return new ke.X509Certificate(u.data)}catch(l){const f=Ia(u.data);return new ke.X509Certificate(f)}}catch(u){}return null})}function Fc(n,e){return hi(this,null,function*(){const r=oa.parse(e.rawData,mr),i=Rt.serialize(r.tbsCertificate.subject),o=yield ka(i),u=yield ka(r.tbsCertificate.subjectPublicKeyInfo.subjectPublicKey),l=kc(n.serialNumber),f=new Zt({hashAlgorithm:new ve({algorithm:_c}),issuerNameHash:new xe(o),issuerKeyHash:new xe(u),serialNumber:l}),p=new ci({reqCert:f}),g=new Er({requestList:[p]}),N=new Go({tbsRequest:g});return Rt.serialize(N)})}function Uc(n){const e=new Date;try{const r=Rt.parse(n,Wo);switch(r.responseStatus){case er.successful:break;case er.malformedRequest:return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP responder returned: malformed request",checkedAt:e};case er.internalError:return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP responder returned: internal error",checkedAt:e};case er.tryLater:return{isValid:!1,status:"unknown",method:"ocsp",reason:"OCSP responder returned: try later",checkedAt:e};case er.sigRequired:return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP responder requires signature",checkedAt:e};case er.unauthorized:return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP responder returned: unauthorized",checkedAt:e};default:return{isValid:!1,status:"error",method:"ocsp",reason:`OCSP responder returned unknown status: ${r.responseStatus}`,checkedAt:e}}if(!r.responseBytes)return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP response has no response bytes",checkedAt:e};const i=Rt.parse(r.responseBytes.response.buffer,dn).tbsResponseData.responses;if(!i||i.length===0)return{isValid:!1,status:"error",method:"ocsp",reason:"OCSP response contains no certificate status",checkedAt:e};const o=i[0].certStatus;return o.good!==void 0?{isValid:!0,status:"good",method:"ocsp",checkedAt:e}:o.revoked?{isValid:!1,status:"revoked",method:"ocsp",reason:o.revoked.revocationReason!==void 0?`Certificate revoked (reason: ${o.revoked.revocationReason})`:"Certificate revoked",revokedAt:o.revoked.revocationTime,checkedAt:e}:o.unknown!==void 0?{isValid:!1,status:"unknown",method:"ocsp",reason:"OCSP responder does not know about this certificate",checkedAt:e}:{isValid:!1,status:"error",method:"ocsp",reason:"Unexpected certificate status in OCSP response",checkedAt:e}}catch(r){return{isValid:!1,status:"error",method:"ocsp",reason:`Failed to parse OCSP response: ${r instanceof Error?r.message:String(r)}`,checkedAt:e}}}function Pc(n,e){return hi(this,arguments,function*(r,i,o={}){const{timeout:u=5e3,certificateChain:l=[],proxyUrl:f}=o,p=new Date,g=Lc(r);if(g.length===0)return{isValid:!1,status:"unknown",method:"ocsp",reason:"Certificate has no OCSP responder URL",checkedAt:p};let N=i;if(N||(N=_a(r,l)),N||(N=yield La(r,u,f)),!N)return{isValid:!1,status:"unknown",method:"ocsp",reason:"Could not find or fetch issuer certificate for OCSP",checkedAt:p};let E;try{E=yield Fc(r,N)}catch(S){return{isValid:!1,status:"error",method:"ocsp",reason:`Failed to build OCSP request: ${S instanceof Error?S.message:String(S)}`,checkedAt:p}}for(const S of g)try{const C=yield Bc(S,E,u,f);if(C.ok&&C.data)return Uc(C.data)}catch(C){}return{isValid:!1,status:"error",method:"ocsp",reason:"All OCSP requests failed",checkedAt:p}})}var Vc=(n,e,r)=>new Promise((i,o)=>{var u=p=>{try{f(r.next(p))}catch(g){o(g)}},l=p=>{try{f(r.throw(p))}catch(g){o(g)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,l);f((r=r.apply(n,e)).next())});const Hc="2.5.29.31";function qc(n){try{const e=n.getExtension(Hc);if(!e)return[];const r=[];for(const i of e.distributionPoints)if(i.distributionPoint){const o=i.distributionPoint;if("fullName"in o&&o.fullName){for(const u of o.fullName)if(u.uniformResourceIdentifier){const l=u.uniformResourceIdentifier;(l.startsWith("http://")||l.startsWith("https://"))&&r.push(l)}}}return r}catch(e){return[]}}function jc(n,e){const r=e.toLowerCase().replace(/^0+(?=.)/,"")||"0";for(const i of n.entries)if((i.serialNumber.toLowerCase().replace(/^0+(?=.)/,"")||"0")===r)return{isRevoked:!0,revokedAt:i.revocationDate,reason:i.reason};return{isRevoked:!1}}function $c(n){try{return new ke.X509Crl(n)}catch(e){try{const r=`-----BEGIN X509 CRL-----
82
+ ${(Ba(n).match(/.{1,64}/g)||[]).join(`
77
83
  `)}
78
- -----END X509 CRL-----`;return new D.X509Crl(t)}catch(t){return null}}}function Hc(r){return Uc(this,arguments,function*(e,t={}){const{timeout:i=1e4,proxyUrl:n}=t,o=new Date,s=Dc(e);if(s.length===0)return{isValid:!1,status:"unknown",method:"crl",reason:"Certificate has no CRL distribution point",checkedAt:o};const c=[];for(const l of s)try{const f=yield Ac(l,i,n);if(!f.ok||!f.data){c.push(`${l}: ${f.error||"Failed to fetch"}`);continue}const h=Lc(f.data);if(!h){c.push(`${l}: Failed to parse CRL data`);continue}const d=Rc(h,e.serialNumber);return d.isRevoked?{isValid:!1,status:"revoked",method:"crl",reason:d.reason!==void 0?`Certificate revoked (reason code: ${d.reason})`:"Certificate revoked",revokedAt:d.revokedAt,checkedAt:o}:{isValid:!0,status:"good",method:"crl",checkedAt:o}}catch(f){c.push(`${l}: ${f instanceof Error?f.message:String(f)}`)}return{isValid:!1,status:"error",method:"crl",reason:`All CRL checks failed: ${c.join("; ")}`,checkedAt:o}})}var $c=Object.defineProperty,Ls=Object.getOwnPropertySymbols,Mc=Object.prototype.hasOwnProperty,Pc=Object.prototype.propertyIsEnumerable,Hs=(r,e,t)=>e in r?$c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,$s=(r,e)=>{for(var t in e||(e={}))Mc.call(e,t)&&Hs(r,t,e[t]);if(Ls)for(var t of Ls(e))Pc.call(e,t)&&Hs(r,t,e[t]);return r},_c=(r,e,t)=>new Promise((i,n)=>{var o=l=>{try{c(t.next(l))}catch(f){n(f)}},s=l=>{try{c(t.throw(l))}catch(f){n(f)}},c=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,s);c((t=t.apply(r,e)).next())});function fn(r){return _c(this,arguments,function*(e,t={}){const i=new Date,n=$s($s({},Na),t);let o;try{o=typeof e=="string"?new D.X509Certificate(e):e}catch(f){return{isValid:!1,status:"error",method:"none",reason:`Failed to parse certificate: ${f instanceof Error?f.message:String(f)}`,checkedAt:i}}let s=null,c=null;if(n.ocspEnabled&&(s=yield Vc(o,null,{timeout:n.ocspTimeout,certificateChain:n.certificateChain,proxyUrl:t.proxyUrl}),s.status==="good"||s.status==="revoked"))return s;if(n.crlEnabled&&(c=yield Hc(o,{timeout:n.crlTimeout,proxyUrl:t.proxyUrl}),c.status==="good"||c.status==="revoked"))return c;const l=[];return s!=null&&s.reason&&l.push(`OCSP: ${s.reason}`),c!=null&&c.reason&&l.push(`CRL: ${c.reason}`),{isValid:!1,status:"unknown",method:"none",reason:l.length>0?l.join("; "):"No revocation checking method available",checkedAt:i}})}class lt{constructor(e={}){this.issuer=new te,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:te})],lt.prototype,"issuer",void 0),a([u({type:p.Integer,converter:oe})],lt.prototype,"serialNumber",void 0);let ut=class{constructor(e={}){Object.assign(this,e)}};a([u({type:Tt,context:0,implicit:!0})],ut.prototype,"subjectKeyIdentifier",void 0),a([u({type:lt})],ut.prototype,"issuerAndSerialNumber",void 0),ut=a([S({type:m.Choice})],ut);var Te;(function(r){r[r.v0=0]="v0",r[r.v1=1]="v1",r[r.v2=2]="v2",r[r.v3=3]="v3",r[r.v4=4]="v4",r[r.v5=5]="v5"})(Te||(Te={}));let jt=class extends k{};jt=a([S({type:m.Sequence})],jt);let Tr=class extends k{};Tr=a([S({type:m.Sequence})],Tr);let Ae=class extends k{};Ae=a([S({type:m.Sequence})],Ae);let Vr=class extends k{};Vr=a([S({type:m.Sequence})],Vr);let Ms=class extends k{};Ms=a([S({type:m.Sequence})],Ms);let hn=class extends k{};hn=a([S({type:m.Sequence})],hn);class Dt{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Dt.prototype,"attrType",void 0),a([u({type:p.Any,repeated:"set"})],Dt.prototype,"attrValues",void 0);var pn;class Ve{constructor(e={}){this.version=Te.v0,this.sid=new ut,this.digestAlgorithm=new jt,this.signatureAlgorithm=new Tr,this.signature=new O,Object.assign(this,e)}}a([u({type:p.Integer})],Ve.prototype,"version",void 0),a([u({type:ut})],Ve.prototype,"sid",void 0),a([u({type:jt})],Ve.prototype,"digestAlgorithm",void 0),a([u({type:Dt,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],Ve.prototype,"signedAttrs",void 0),a([u({type:Tr})],Ve.prototype,"signatureAlgorithm",void 0),a([u({type:O})],Ve.prototype,"signature",void 0),a([u({type:Dt,repeated:"set",context:1,implicit:!0,optional:!0})],Ve.prototype,"unsignedAttrs",void 0);let Ur=pn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,pn.prototype)}};Ur=pn=a([S({type:m.Set,itemType:Ve})],Ur);let Ps=class extends Ve{};Ps=a([S({type:m.Sequence})],Ps);let _s=class extends W{};_s=a([S({type:m.Choice})],_s);class dn{constructor(e={}){this.acIssuer=new T,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}a([u({type:T})],dn.prototype,"acIssuer",void 0),a([u({type:p.Integer})],dn.prototype,"acSerial",void 0),a([u({type:Ot,repeated:"sequence"})],dn.prototype,"attrs",void 0);var yn;let jr=yn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,yn.prototype)}};jr=yn=a([S({type:m.Sequence,itemType:p.ObjectIdentifier})],jr);class Dr{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}a([u({type:p.Integer,optional:!0})],Dr.prototype,"pathLenConstraint",void 0),a([u({type:jr,implicit:!0,context:0,optional:!0})],Dr.prototype,"permittedAttrs",void 0),a([u({type:jr,implicit:!0,context:1,optional:!0})],Dr.prototype,"excludedAttrs",void 0),a([u({type:p.Boolean,defaultValue:!0})],Dr.prototype,"permitUnSpecified",void 0);class Xe{constructor(e={}){this.issuer=new pe,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:pe})],Xe.prototype,"issuer",void 0),a([u({type:p.Integer,converter:oe})],Xe.prototype,"serial",void 0),a([u({type:p.BitString,optional:!0})],Xe.prototype,"issuerUID",void 0);var gn;(function(r){r[r.publicKey=0]="publicKey",r[r.publicKeyCert=1]="publicKeyCert",r[r.otherObjectTypes=2]="otherObjectTypes"})(gn||(gn={}));class We{constructor(e={}){this.digestedObjectType=gn.publicKey,this.digestAlgorithm=new k,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:p.Enumerated})],We.prototype,"digestedObjectType",void 0),a([u({type:p.ObjectIdentifier,optional:!0})],We.prototype,"otherObjectTypeID",void 0),a([u({type:k})],We.prototype,"digestAlgorithm",void 0),a([u({type:p.BitString})],We.prototype,"objectDigest",void 0);class Rr{constructor(e={}){Object.assign(this,e)}}a([u({type:pe,optional:!0})],Rr.prototype,"issuerName",void 0),a([u({type:Xe,context:0,implicit:!0,optional:!0})],Rr.prototype,"baseCertificateID",void 0),a([u({type:We,context:1,implicit:!0,optional:!0})],Rr.prototype,"objectDigestInfo",void 0);let ft=class{constructor(e={}){Object.assign(this,e)}};a([u({type:T,repeated:"sequence"})],ft.prototype,"v1Form",void 0),a([u({type:Rr,context:0,implicit:!0})],ft.prototype,"v2Form",void 0),ft=a([S({type:m.Choice})],ft);class Lr{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}a([u({type:p.GeneralizedTime})],Lr.prototype,"notBeforeTime",void 0),a([u({type:p.GeneralizedTime})],Lr.prototype,"notAfterTime",void 0);class Rt{constructor(e={}){Object.assign(this,e)}}a([u({type:Xe,implicit:!0,context:0,optional:!0})],Rt.prototype,"baseCertificateID",void 0),a([u({type:pe,implicit:!0,context:1,optional:!0})],Rt.prototype,"entityName",void 0),a([u({type:We,implicit:!0,context:2,optional:!0})],Rt.prototype,"objectDigestInfo",void 0);var vn;(function(r){r[r.v2=1]="v2"})(vn||(vn={}));class ye{constructor(e={}){this.version=vn.v2,this.holder=new Rt,this.issuer=new ft,this.signature=new k,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Lr,this.attributes=[],Object.assign(this,e)}}a([u({type:p.Integer})],ye.prototype,"version",void 0),a([u({type:Rt})],ye.prototype,"holder",void 0),a([u({type:ft})],ye.prototype,"issuer",void 0),a([u({type:k})],ye.prototype,"signature",void 0),a([u({type:p.Integer,converter:oe})],ye.prototype,"serialNumber",void 0),a([u({type:Lr})],ye.prototype,"attrCertValidityPeriod",void 0),a([u({type:Ot,repeated:"sequence"})],ye.prototype,"attributes",void 0),a([u({type:p.BitString,optional:!0})],ye.prototype,"issuerUniqueID",void 0),a([u({type:ot,optional:!0})],ye.prototype,"extensions",void 0);class Hr{constructor(e={}){this.acinfo=new ye,this.signatureAlgorithm=new k,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:ye})],Hr.prototype,"acinfo",void 0),a([u({type:k})],Hr.prototype,"signatureAlgorithm",void 0),a([u({type:p.BitString})],Hr.prototype,"signatureValue",void 0);var $r;(function(r){r[r.unmarked=1]="unmarked",r[r.unclassified=2]="unclassified",r[r.restricted=4]="restricted",r[r.confidential=8]="confidential",r[r.secret=16]="secret",r[r.topSecret=32]="topSecret"})($r||($r={}));class mn extends dr{}class wn{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:p.ObjectIdentifier,implicit:!0,context:0})],wn.prototype,"type",void 0),a([u({type:p.Any,implicit:!0,context:1})],wn.prototype,"value",void 0);class bn{constructor(e={}){this.policyId="",this.classList=new mn($r.unclassified),Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],bn.prototype,"policyId",void 0),a([u({type:mn,defaultValue:new mn($r.unclassified)})],bn.prototype,"classList",void 0),a([u({type:wn,repeated:"set"})],bn.prototype,"securityCategories",void 0);class Mr{constructor(e={}){Object.assign(this,e)}}a([u({type:O})],Mr.prototype,"cotets",void 0),a([u({type:p.ObjectIdentifier})],Mr.prototype,"oid",void 0),a([u({type:p.Utf8String})],Mr.prototype,"string",void 0);class qs{constructor(e={}){this.values=[],Object.assign(this,e)}}a([u({type:pe,implicit:!0,context:0,optional:!0})],qs.prototype,"policyAuthority",void 0),a([u({type:Mr,repeated:"sequence"})],qs.prototype,"values",void 0);var An;class Pr{constructor(e={}){this.targetCertificate=new Xe,Object.assign(this,e)}}a([u({type:Xe})],Pr.prototype,"targetCertificate",void 0),a([u({type:T,optional:!0})],Pr.prototype,"targetName",void 0),a([u({type:We,optional:!0})],Pr.prototype,"certDigestInfo",void 0);let ht=class{constructor(e={}){Object.assign(this,e)}};a([u({type:T,context:0,implicit:!0})],ht.prototype,"targetName",void 0),a([u({type:T,context:1,implicit:!0})],ht.prototype,"targetGroup",void 0),a([u({type:Pr,context:2,implicit:!0})],ht.prototype,"targetCert",void 0),ht=a([S({type:m.Choice})],ht);let Sn=An=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,An.prototype)}};Sn=An=a([S({type:m.Sequence,itemType:ht})],Sn);var Bn;let Fs=Bn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Bn.prototype)}};Fs=Bn=a([S({type:m.Sequence,itemType:Sn})],Fs);class Gs{constructor(e={}){Object.assign(this,e)}}a([u({type:pe,implicit:!0,context:0,optional:!0})],Gs.prototype,"roleAuthority",void 0),a([u({type:T,implicit:!0,context:1})],Gs.prototype,"roleName",void 0);class kn{constructor(e={}){this.service=new T,this.ident=new T,Object.assign(this,e)}}a([u({type:T})],kn.prototype,"service",void 0),a([u({type:T})],kn.prototype,"ident",void 0),a([u({type:O,optional:!0})],kn.prototype,"authInfo",void 0);var xn;class Nn{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Nn.prototype,"otherCertFormat",void 0),a([u({type:p.Any})],Nn.prototype,"otherCert",void 0);let pt=class{constructor(e={}){Object.assign(this,e)}};a([u({type:qe})],pt.prototype,"certificate",void 0),a([u({type:Hr,context:2,implicit:!0})],pt.prototype,"v2AttrCert",void 0),a([u({type:Nn,context:3,implicit:!0})],pt.prototype,"other",void 0),pt=a([S({type:m.Choice})],pt);let _r=xn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,xn.prototype)}};_r=xn=a([S({type:m.Set,itemType:pt})],_r);class qr{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],qr.prototype,"contentType",void 0),a([u({type:p.Any,context:0})],qr.prototype,"content",void 0);let Lt=class{constructor(e={}){Object.assign(this,e)}};a([u({type:O})],Lt.prototype,"single",void 0),a([u({type:p.Any})],Lt.prototype,"any",void 0),Lt=a([S({type:m.Choice})],Lt);class Fr{constructor(e={}){this.eContentType="",Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Fr.prototype,"eContentType",void 0),a([u({type:Lt,context:0,optional:!0})],Fr.prototype,"eContent",void 0);let Ht=class{constructor(e={}){Object.assign(this,e)}};a([u({type:O,context:0,implicit:!0,optional:!0})],Ht.prototype,"value",void 0),a([u({type:O,converter:ec,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Ht.prototype,"constructedValue",void 0),Ht=a([S({type:m.Choice})],Ht);class $t{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new Vr,Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],$t.prototype,"contentType",void 0),a([u({type:Vr})],$t.prototype,"contentEncryptionAlgorithm",void 0),a([u({type:Ht,optional:!0})],$t.prototype,"encryptedContent",void 0);class Gr{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Gr.prototype,"keyAttrId",void 0),a([u({type:p.Any,optional:!0})],Gr.prototype,"keyAttr",void 0);var Cn;class zr{constructor(e={}){this.subjectKeyIdentifier=new Tt,Object.assign(this,e)}}a([u({type:Tt})],zr.prototype,"subjectKeyIdentifier",void 0),a([u({type:p.GeneralizedTime,optional:!0})],zr.prototype,"date",void 0),a([u({type:Gr,optional:!0})],zr.prototype,"other",void 0);let dt=class{constructor(e={}){Object.assign(this,e)}};a([u({type:zr,context:0,implicit:!0,optional:!0})],dt.prototype,"rKeyId",void 0),a([u({type:lt,optional:!0})],dt.prototype,"issuerAndSerialNumber",void 0),dt=a([S({type:m.Choice})],dt);class En{constructor(e={}){this.rid=new dt,this.encryptedKey=new O,Object.assign(this,e)}}a([u({type:dt})],En.prototype,"rid",void 0),a([u({type:O})],En.prototype,"encryptedKey",void 0);let Xr=Cn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Cn.prototype)}};Xr=Cn=a([S({type:m.Sequence,itemType:En})],Xr);class In{constructor(e={}){this.algorithm=new k,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:k})],In.prototype,"algorithm",void 0),a([u({type:p.BitString})],In.prototype,"publicKey",void 0);let Ke=class{constructor(e={}){Object.assign(this,e)}};a([u({type:Tt,context:0,implicit:!0,optional:!0})],Ke.prototype,"subjectKeyIdentifier",void 0),a([u({type:In,context:1,implicit:!0,optional:!0})],Ke.prototype,"originatorKey",void 0),a([u({type:lt,optional:!0})],Ke.prototype,"issuerAndSerialNumber",void 0),Ke=a([S({type:m.Choice})],Ke);class yt{constructor(e={}){this.version=Te.v3,this.originator=new Ke,this.keyEncryptionAlgorithm=new Ae,this.recipientEncryptedKeys=new Xr,Object.assign(this,e)}}a([u({type:p.Integer})],yt.prototype,"version",void 0),a([u({type:Ke,context:0})],yt.prototype,"originator",void 0),a([u({type:O,context:1,optional:!0})],yt.prototype,"ukm",void 0),a([u({type:Ae})],yt.prototype,"keyEncryptionAlgorithm",void 0),a([u({type:Xr})],yt.prototype,"recipientEncryptedKeys",void 0);let gt=class{constructor(e={}){Object.assign(this,e)}};a([u({type:Tt,context:0,implicit:!0})],gt.prototype,"subjectKeyIdentifier",void 0),a([u({type:lt})],gt.prototype,"issuerAndSerialNumber",void 0),gt=a([S({type:m.Choice})],gt);class Mt{constructor(e={}){this.version=Te.v0,this.rid=new gt,this.keyEncryptionAlgorithm=new Ae,this.encryptedKey=new O,Object.assign(this,e)}}a([u({type:p.Integer})],Mt.prototype,"version",void 0),a([u({type:gt})],Mt.prototype,"rid",void 0),a([u({type:Ae})],Mt.prototype,"keyEncryptionAlgorithm",void 0),a([u({type:O})],Mt.prototype,"encryptedKey",void 0);class Pt{constructor(e={}){this.keyIdentifier=new O,Object.assign(this,e)}}a([u({type:O})],Pt.prototype,"keyIdentifier",void 0),a([u({type:p.GeneralizedTime,optional:!0})],Pt.prototype,"date",void 0),a([u({type:Gr,optional:!0})],Pt.prototype,"other",void 0);class _t{constructor(e={}){this.version=Te.v4,this.kekid=new Pt,this.keyEncryptionAlgorithm=new Ae,this.encryptedKey=new O,Object.assign(this,e)}}a([u({type:p.Integer})],_t.prototype,"version",void 0),a([u({type:Pt})],_t.prototype,"kekid",void 0),a([u({type:Ae})],_t.prototype,"keyEncryptionAlgorithm",void 0),a([u({type:O})],_t.prototype,"encryptedKey",void 0);class qt{constructor(e={}){this.version=Te.v0,this.keyEncryptionAlgorithm=new Ae,this.encryptedKey=new O,Object.assign(this,e)}}a([u({type:p.Integer})],qt.prototype,"version",void 0),a([u({type:hn,context:0,optional:!0})],qt.prototype,"keyDerivationAlgorithm",void 0),a([u({type:Ae})],qt.prototype,"keyEncryptionAlgorithm",void 0),a([u({type:O})],qt.prototype,"encryptedKey",void 0);class On{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],On.prototype,"oriType",void 0),a([u({type:p.Any})],On.prototype,"oriValue",void 0);let De=class{constructor(e={}){Object.assign(this,e)}};a([u({type:Mt,optional:!0})],De.prototype,"ktri",void 0),a([u({type:yt,context:1,implicit:!0,optional:!0})],De.prototype,"kari",void 0),a([u({type:_t,context:2,implicit:!0,optional:!0})],De.prototype,"kekri",void 0),a([u({type:qt,context:3,implicit:!0,optional:!0})],De.prototype,"pwri",void 0),a([u({type:On,context:4,implicit:!0,optional:!0})],De.prototype,"ori",void 0),De=a([S({type:m.Choice})],De);var Tn;let Wr=Tn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Tn.prototype)}};Wr=Tn=a([S({type:m.Set,itemType:De})],Wr);var Vn;class Kr{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}a([u({type:p.ObjectIdentifier})],Kr.prototype,"otherRevInfoFormat",void 0),a([u({type:p.Any})],Kr.prototype,"otherRevInfo",void 0);let Jr=class{constructor(e={}){this.other=new Kr,Object.assign(this,e)}};a([u({type:Kr,context:1,implicit:!0})],Jr.prototype,"other",void 0),Jr=a([S({type:m.Choice})],Jr);let Yr=Vn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Vn.prototype)}};Yr=Vn=a([S({type:m.Set,itemType:Jr})],Yr);class Un{constructor(e={}){Object.assign(this,e)}}a([u({type:_r,context:0,implicit:!0,optional:!0})],Un.prototype,"certs",void 0),a([u({type:Yr,context:1,implicit:!0,optional:!0})],Un.prototype,"crls",void 0);var jn;let Dn=jn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,jn.prototype)}};Dn=jn=a([S({type:m.Set,itemType:Dt})],Dn);class Ft{constructor(e={}){this.version=Te.v0,this.recipientInfos=new Wr,this.encryptedContentInfo=new $t,Object.assign(this,e)}}a([u({type:p.Integer})],Ft.prototype,"version",void 0),a([u({type:Un,context:0,implicit:!0,optional:!0})],Ft.prototype,"originatorInfo",void 0),a([u({type:Wr})],Ft.prototype,"recipientInfos",void 0),a([u({type:$t})],Ft.prototype,"encryptedContentInfo",void 0),a([u({type:Dn,context:1,implicit:!0,optional:!0})],Ft.prototype,"unprotectedAttrs",void 0);var Rn;let Zr=Rn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Rn.prototype)}};Zr=Rn=a([S({type:m.Set,itemType:jt})],Zr);class Je{constructor(e={}){this.version=Te.v0,this.digestAlgorithms=new Zr,this.encapContentInfo=new Fr,this.signerInfos=new Ur,Object.assign(this,e)}}a([u({type:p.Integer})],Je.prototype,"version",void 0),a([u({type:Zr})],Je.prototype,"digestAlgorithms",void 0),a([u({type:Fr})],Je.prototype,"encapContentInfo",void 0),a([u({type:_r,context:0,implicit:!0,optional:!0})],Je.prototype,"certificates",void 0),a([u({type:Yr,context:1,implicit:!0,optional:!0})],Je.prototype,"crls",void 0),a([u({type:Ur})],Je.prototype,"signerInfos",void 0);class Qr{constructor(e={}){this.seconds=0,Object.assign(this,e)}}a([u({type:p.Integer,optional:!0})],Qr.prototype,"seconds",void 0),a([u({type:p.Integer,context:0,implicit:!0,optional:!0})],Qr.prototype,"millis",void 0),a([u({type:p.Integer,context:1,implicit:!0,optional:!0})],Qr.prototype,"micros",void 0);class vt{constructor(e={}){this.hashAlgorithm=new k,this.hashedMessage=new O,Object.assign(this,e)}}a([u({type:k})],vt.prototype,"hashAlgorithm",void 0),a([u({type:O})],vt.prototype,"hashedMessage",void 0);var ge;(function(r){r[r.badAlg=1]="badAlg",r[r.badRequest=2]="badRequest",r[r.badDataFormat=16]="badDataFormat",r[r.timeNotAvailable=8192]="timeNotAvailable",r[r.unacceptedPolicy=16384]="unacceptedPolicy",r[r.unacceptedExtension=32768]="unacceptedExtension",r[r.addInfoNotAvailable=65536]="addInfoNotAvailable",r[r.systemFailure=16777216]="systemFailure"})(ge||(ge={}));class qc extends dr{toJSON(){const e=this.toNumber(),t=[];return e&ge.addInfoNotAvailable&&t.push("addInfoNotAvailable"),e&ge.badAlg&&t.push("badAlg"),e&ge.badDataFormat&&t.push("badDataFormat"),e&ge.badRequest&&t.push("badRequest"),e&ge.systemFailure&&t.push("systemFailure"),e&ge.systemFailure&&t.push("systemFailure"),e&ge.timeNotAvailable&&t.push("timeNotAvailable"),e&ge.unacceptedExtension&&t.push("unacceptedExtension"),e&ge.unacceptedPolicy&&t.push("unacceptedPolicy"),t}toString(){return`[${this.toJSON().join(", ")}]`}}var Ln;(function(r){r[r.granted=0]="granted",r[r.grantedWithMods=1]="grantedWithMods",r[r.rejection=2]="rejection",r[r.waiting=3]="waiting",r[r.revocationWarning=4]="revocationWarning",r[r.revocationNotification=5]="revocationNotification"})(Ln||(Ln={}));var Hn;let $n=Hn=class extends R{constructor(e){super(e),Object.setPrototypeOf(this,Hn.prototype)}};$n=Hn=a([S({type:m.Sequence,itemType:p.Utf8String})],$n);class Gt{constructor(e={}){this.status=Ln.granted,Object.assign(this,e)}}a([u({type:p.Integer})],Gt.prototype,"status",void 0),a([u({type:$n,optional:!0})],Gt.prototype,"statusString",void 0),a([u({type:qc,optional:!0})],Gt.prototype,"failInfo",void 0);var Mn;(function(r){r[r.v1=1]="v1"})(Mn||(Mn={}));class mt{constructor(e={}){this.version=Mn.v1,this.messageImprint=new vt,this.certReq=!1,Object.assign(this,e)}}a([u({type:p.Integer})],mt.prototype,"version",void 0),a([u({type:vt})],mt.prototype,"messageImprint",void 0),a([u({type:p.ObjectIdentifier,optional:!0})],mt.prototype,"reqPolicy",void 0),a([u({type:p.Integer,converter:oe,optional:!0})],mt.prototype,"nonce",void 0),a([u({type:p.Boolean,defaultValue:!1})],mt.prototype,"certReq",void 0),a([u({type:ot,optional:!0,context:0,implicit:!0})],mt.prototype,"extensions",void 0);let Pn=class extends qr{};Pn=a([S({type:m.Sequence})],Pn);class zs{constructor(e={}){this.status=new Gt,Object.assign(this,e)}}a([u({type:Gt})],zs.prototype,"status",void 0),a([u({type:Pn,optional:!0})],zs.prototype,"timeStampToken",void 0);var _n;(function(r){r[r.v1=1]="v1"})(_n||(_n={}));class ve{constructor(e={}){this.version=_n.v1,this.policy="",this.messageImprint=new vt,this.serialNumber=new ArrayBuffer(0),this.genTime=new Date,this.ordering=!1,Object.assign(this,e)}}a([u({type:p.Integer})],ve.prototype,"version",void 0),a([u({type:p.ObjectIdentifier})],ve.prototype,"policy",void 0),a([u({type:vt})],ve.prototype,"messageImprint",void 0),a([u({type:p.Integer,converter:oe})],ve.prototype,"serialNumber",void 0),a([u({type:p.GeneralizedTime})],ve.prototype,"genTime",void 0),a([u({type:Qr,optional:!0})],ve.prototype,"accuracy",void 0),a([u({type:p.Boolean,defaultValue:!1})],ve.prototype,"ordering",void 0),a([u({type:p.Integer,converter:oe,optional:!0})],ve.prototype,"nonce",void 0),a([u({type:T,context:0,optional:!0})],ve.prototype,"tsa",void 0),a([u({type:ot,context:1,implicit:!0,optional:!0})],ve.prototype,"extensions",void 0);var qn=(r,e,t)=>new Promise((i,n)=>{var o=l=>{try{c(t.next(l))}catch(f){n(f)}},s=l=>{try{c(t.throw(l))}catch(f){n(f)}},c=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,s);c((t=t.apply(r,e)).next())});const Fc="1.2.840.113549.1.7.2",Gc="1.2.840.113549.1.9.16.1.4";function zc(r){return{"1.3.14.3.2.26":"SHA-1","2.16.840.1.101.3.4.2.1":"SHA-256","2.16.840.1.101.3.4.2.2":"SHA-384","2.16.840.1.101.3.4.2.3":"SHA-512"}[r]||r}const Xc={"2.5.4.3":"CN","2.5.4.6":"C","2.5.4.7":"L","2.5.4.8":"ST","2.5.4.10":"O","2.5.4.11":"OU","2.5.4.5":"serialNumber","1.2.840.113549.1.9.1":"emailAddress"};function Wc(r){var e;const t=[];for(const i of r)for(const n of i){const o=Xc[n.type]||n.type,s=((e=n.value)==null?void 0:e.toString())||"";s&&t.push(`${o}=${s}`)}return t.join(", ")}function Fn(r){try{const e=Us(r),t=fe.parse(e,qr);if(t.contentType!==Fc)return console.warn("Timestamp is not SignedData"),null;const i=fe.parse(t.content,Je);if(i.encapContentInfo.eContentType!==Gc)return console.warn("SignedData does not contain TSTInfo"),null;if(!i.encapContentInfo.eContent)return console.warn("No eContent in SignedData"),null;const n=i.encapContentInfo.eContent;let o;n.single?o=n.single.buffer:n.any?o=n.any:o=fe.serialize(n);const s=fe.parse(o,ve);let c;if(i.certificates&&i.certificates.length>0){const h=i.certificates[0];"certificate"in h&&h.certificate&&(c=js(fe.serialize(h.certificate)))}let l;s.tsa&&(s.tsa.directoryName?l=Wc(s.tsa.directoryName):s.tsa.uniformResourceIdentifier&&(l=s.tsa.uniformResourceIdentifier));let f;return s.accuracy&&(f=(s.accuracy.seconds||0)+(s.accuracy.millis||0)/1e3+(s.accuracy.micros||0)/1e6),{genTime:s.genTime,policy:s.policy,serialNumber:un(s.serialNumber),hashAlgorithm:zc(s.messageImprint.hashAlgorithm.algorithm),messageImprint:un(s.messageImprint.hashedMessage.buffer),tsaName:l,tsaCertificate:c,accuracy:f}}catch(e){return console.error("Failed to parse timestamp:",e instanceof Error?e.message:String(e)),null}}function Kc(r,e){return qn(this,null,function*(){const t={"SHA-1":"SHA-1","SHA-256":"SHA-256","SHA-384":"SHA-384","SHA-512":"SHA-512"}[e];if(!t)throw new Error(`Unsupported hash algorithm: ${e}`);if(typeof crypto!="undefined"&&crypto.subtle)return crypto.subtle.digest(t,r);const i=require("crypto").createHash(e.toLowerCase().replace("-",""));return i.update(Buffer.from(r)),i.digest().buffer})}function Jc(r,e){return qn(this,null,function*(){try{const t=r.messageImprint.toLowerCase(),i=new TextEncoder().encode(e),n=yield Kc(i.buffer,r.hashAlgorithm);return un(n).toLowerCase()===t}catch(t){return console.error("Failed to verify timestamp coverage:",t instanceof Error?t.message:String(t)),!1}})}function Xs(r){return qn(this,arguments,function*(e,t={}){const i=Fn(e);if(!i)return{isValid:!1,reason:"Failed to parse timestamp token"};let n,o;t.canonicalSignatureValue&&(n=yield Jc(i,t.canonicalSignatureValue),n||(o="Could not verify timestamp covers signature (hash mismatch)"));let s;if(t.verifyTsaCertificate&&i.tsaCertificate)try{const c=new D.X509Certificate(i.tsaCertificate);if(i.genTime<c.notBefore||i.genTime>c.notAfter)return{isValid:!1,info:i,coversSignature:n,reason:`TSA certificate was not valid at timestamp time (${i.genTime.toISOString()})`};if(t.checkTsaRevocation!==!1)try{if(s=yield fn(c,t.revocationOptions),s.status==="revoked")return{isValid:!1,info:i,coversSignature:n,tsaRevocation:s,reason:`TSA certificate has been revoked: ${s.reason||"No reason provided"}`}}catch(l){s={isValid:!1,status:"error",method:"none",reason:`TSA revocation check failed: ${l instanceof Error?l.message:String(l)}`,checkedAt:new Date}}}catch(c){return{isValid:!1,info:i,coversSignature:n,reason:`Failed to verify TSA certificate: ${c instanceof Error?c.message:String(c)}`}}return{isValid:!0,info:i,coversSignature:n,tsaRevocation:s,reason:o}})}function Yc(r){const e=Fn(r);return(e==null?void 0:e.genTime)||null}var Zc=(r,e,t)=>new Promise((i,n)=>{var o=l=>{try{c(t.next(l))}catch(f){n(f)}},s=l=>{try{c(t.throw(l))}catch(f){n(f)}},c=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,s);c((t=t.apply(r,e)).next())});function Qc(r){const e=new Uint8Array(r);let t=0;const i=()=>{const o=e[t++];if((o&128)===0)return o;const s=o&127;let c=0;for(let l=0;l<s;l++)c=c<<8|e[t++];return c},n=()=>{if(e[t++]!==2)return BigInt(0);const o=i();let s=BigInt(0);for(let c=0;c<o;c++)s=s<<BigInt(8)|BigInt(e[t++]);return s};try{if(e[t++]!==48||(i(),e[t++]!==48))return null;const o=i();if(t+=o,e[t++]!==3||(i(),t++,e[t++]!==48))return null;i();const s=n(),c=n();return{n:s,e:c}}catch(o){return null}}function el(r,e,t){let i=BigInt(1);for(r=r%t;e>0;)e%BigInt(2)===BigInt(1)&&(i=i*r%t),e=e>>BigInt(1),r=r*r%t;return i}function tl(r){let e=BigInt(0);for(const t of r)e=e<<BigInt(8)|BigInt(t);return e}function rl(r,e){const t=new Uint8Array(e);for(let i=e-1;i>=0;i--)t[i]=Number(r&BigInt(255)),r=r>>BigInt(8);return t}function il(r){if(r[0]!==0||r[1]!==1)return null;let e=-1;for(let t=2;t<r.length;t++){if(r[t]===0){e=t;break}if(r[t]!==255)return null}return e===-1||e<10?null:r.slice(e+1)}function nl(r,e){for(let t=0;t<r.length-1;t++)if(r[t]===4){const i=r[t+1];if(i===e&&t+2+i<=r.length)return r.slice(t+2,t+2+i)}return null}function ol(r){switch(r.toLowerCase().replace("-","")){case"sha1":return 20;case"sha256":return 32;case"sha384":return 48;case"sha512":return 64;default:return 32}}function Ws(){return typeof window!="undefined"&&typeof window.crypto!="undefined"&&typeof window.crypto.subtle!="undefined"}function Ks(r,e,t,i){return Zc(this,null,function*(){try{let n;if(Ws()){const f=Qc(r);if(!f)return!1;const{n:h,e:d}=f,g=Math.ceil(h.toString(16).length/2),y=tl(e),v=el(y,d,h),B=rl(v,g);n=il(B)}else{const f=require("crypto"),h=f.createPublicKey({key:Buffer.from(r),format:"der",type:"spki"}),d=f.publicDecrypt({key:h,padding:f.constants.RSA_PKCS1_PADDING},Buffer.from(e));n=new Uint8Array(d)}if(!n)return!1;const o=ol(i),s=nl(n,o);if(!s)return!1;let c;if(Ws()){let f=i.toUpperCase().replace(/-/g,"");f=f.replace(/^SHA(\d)/,"SHA-$1");const h=yield window.crypto.subtle.digest(f,t);c=new Uint8Array(h)}else{const f=require("crypto"),h=i.toLowerCase().replace("-","");c=f.createHash(h).update(Buffer.from(t)).digest()}if(s.length!==c.length)return!1;let l=0;for(let f=0;f<s.length;f++)l|=s[f]^c[f];return l===0}catch(n){return!1}})}var sl=Object.defineProperty,Js=Object.getOwnPropertySymbols,al=Object.prototype.hasOwnProperty,cl=Object.prototype.propertyIsEnumerable,Ys=(r,e,t)=>e in r?sl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Gn=(r,e)=>{for(var t in e||(e={}))al.call(e,t)&&Ys(r,t,e[t]);if(Js)for(var t of Js(e))cl.call(e,t)&&Ys(r,t,e[t]);return r},Ye=(r,e,t)=>new Promise((i,n)=>{var o=l=>{try{c(t.next(l))}catch(f){n(f)}},s=l=>{try{c(t.throw(l))}catch(f){n(f)}},c=l=>l.done?i(l.value):Promise.resolve(l.value).then(o,s);c((t=t.apply(r,e)).next())});function zt(){return typeof window!="undefined"&&typeof window.crypto!="undefined"&&typeof window.crypto.subtle!="undefined"}function ll(){if(typeof navigator=="undefined")return!1;const r=navigator.userAgent,e=/AppleWebKit/.test(r),t=/Chrome/.test(r)||/Chromium/.test(r)||/Edg/.test(r);return e&&!t}function ul(r){const e=new Uint8Array(r),t=[6,9,42,134,72,134,247,13,1,1,1];let i=-1;for(let c=0;c<=e.length-t.length;c++){let l=!0;for(let f=0;f<t.length;f++)if(e[c+f]!==t[f]){l=!1;break}if(l){i=c;break}}if(i===-1)return 0;let n=-1;for(let c=i+t.length;c<e.length;c++)if(e[c]===3){n=c;break}if(n===-1)return 0;let o=n+1;if((e[o]&128)===0?o+=1:o+=1+(e[o]&127),o+=1,e[o]!==48||(o+=1,(e[o]&128)===0?o+=1:o+=1+(e[o]&127),e[o]!==2))return 0;o+=1;let s=0;if((e[o]&128)===0)s=e[o];else{const c=e[o]&127;for(let l=0;l<c;l++)s=s<<8|e[o+1+l]}return s*8}function fl(r){return!zt()||!ll()?!0:r<=4096}function Zs(r,e){return Ye(this,null,function*(){const t=e.replace(/-/g,"").toLowerCase();let i;if(t.includes("sha256"))i="sha256";else if(t.includes("sha1"))i="sha1";else if(t.includes("sha384"))i="sha384";else if(t.includes("sha512"))i="sha512";else throw new Error(`Unsupported digest algorithm: ${e}`);return zt()?hl(r,i):pl(r,i)})}function hl(r,e){return Ye(this,null,function*(){const t={sha1:"SHA-1",sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"}[e];if(!t)throw new Error(`Unsupported browser digest algorithm: ${e}`);const i=yield window.crypto.subtle.digest(t,r),n=Array.from(new Uint8Array(i));return btoa(String.fromCharCode.apply(null,n))})}function pl(r,e){return new Promise((t,i)=>{try{const n=require("crypto").createHash(e);n.update(Buffer.from(r)),t(n.digest("base64"))}catch(n){i(new Error(`Node digest computation failed: ${n instanceof Error?n.message:String(n)}`))}})}function dl(r){const e=r.toLowerCase();return e.includes("sha512")?"SHA-512":e.includes("sha384")?"SHA-384":e.includes("sha256")?"SHA-256":e.includes("sha1")?"SHA-1":"SHA-256"}function Qs(r,e){return Ye(this,null,function*(){const t={};let i=!0,n="SHA-256";r.algorithm&&(r.algorithm.includes("sha1")?n="SHA-1":r.algorithm.includes("sha384")?n="SHA-384":r.algorithm.includes("sha512")&&(n="SHA-512"));const o=Object.entries(r.signedChecksums).map(s=>Ye(this,[s],function*([c,l]){var f;const h=(f=r.digestAlgorithms)!=null&&f[c]?dl(r.digestAlgorithms[c]):n,d=e.get(c);if(d){const g=yield Zs(d,h),y=l===g;t[c]={expected:l,actual:g,matches:y,fileFound:!0},y||(i=!1)}else{const g=c.includes("/")?c.split("/").pop():c;let y=!1;if(g){for(const[v,B]of e.entries())if(v.endsWith(g)){const b=yield Zs(B,h),w=l===b;t[c]={expected:l,actual:b,matches:w,fileFound:!0},w||(i=!1),y=!0;break}}y||(t[c]={expected:l,actual:"",matches:!1,fileFound:!1},i=!1)}}));return yield Promise.all(o),{isValid:i,details:t}})}function yl(r){return Ye(this,arguments,function*(e,t=new Date){try{const i=new D.X509Certificate(e),n=pa(i,t),o=yield eo(e);return{isValid:n.isValid,reason:n.reason,info:o}}catch(i){return{isValid:!1,reason:`Certificate parsing error: ${i instanceof Error?i.message:String(i)}`}}})}function gl(r){switch(r){case"P-256":return 32;case"P-384":return 48;case"P-521":return 66;default:return 32}}function vl(r,e){const t=gl(e),i=t*2;if(r.length===i)return r;if(r[0]===48)return ml(r,t);if(r.length>i){const n=r.length/2;if(Number.isInteger(n)){const o=r.slice(0,n),s=r.slice(n),c=ei(o,t),l=ei(s,t),f=new Uint8Array(i);return f.set(c,0),f.set(l,t),f}}return r}function ei(r,e){let t=0;for(;t<r.length-1&&r[t]===0;)t++;const i=r.slice(t);if(i.length===e)return i;if(i.length<e){const n=new Uint8Array(e);return n.set(i,e-i.length),n}else return i.slice(i.length-e)}function ml(r,e){let t=0;if(r[t++]!==48)throw new Error("Invalid DER signature: missing SEQUENCE tag");const i=r[t++];if(i&128&&(t+=i&127),r[t++]!==2)throw new Error("Invalid DER signature: missing INTEGER tag for R");const n=r[t++],o=r.slice(t,t+n);if(t+=n,r[t++]!==2)throw new Error("Invalid DER signature: missing INTEGER tag for S");const s=r[t++],c=r.slice(t,t+s),l=new Uint8Array(e*2);return l.set(ei(o,e),0),l.set(ei(c,e),e),l}function ea(){return zt()?window.crypto.subtle:crypto.subtle}function wl(r,e,t,i,n){return Ye(this,null,function*(){try{const o=Jn().parseFromString(r,"application/xml"),s=Q(o,"ds:SignedInfo");if(!s)return{isValid:!1,reason:"SignedInfo element not found in provided XML"};const c=n||Ze.default,l=q.canonicalize(s,c),f=e.replace(/\s+/g,"");let h;try{h=Bc(f)}catch(y){return{isValid:!1,reason:`Failed to decode signature value: ${y instanceof Error?y.message:String(y)}`}}i.name==="ECDSA"&&(h=vl(h,i.namedCurve));let d;try{const y=ea(),v=i.name==="RSASSA-PKCS1-v1_5"||i.name==="RSA-PSS";if(v){const B=ul(t);if(B>0&&!fl(B))return{isValid:!1,unsupportedPlatform:!0,reason:`RSA key size (${B} bits) not supported in this browser`,errorDetails:{category:"RSA_KEY_SIZE_UNSUPPORTED",originalMessage:"Safari/WebKit only supports RSA keys up to 4096 bits",algorithm:Gn({},i),environment:"browser",keyLength:t.byteLength}}}if(zt()&&v)try{d=yield y.importKey("spki",t,i,!1,["verify"])}catch(B){const b=xa(t);d=yield y.importKey("spki",b,i,!1,["verify"])}else d=yield y.importKey("spki",t,i,!1,["verify"])}catch(y){const v=y instanceof Error?y:new Error(String(y));let B="Unknown reason",b="KEY_IMPORT_ERROR";if(v.name==="DataError"?(B="Key data format is invalid or incompatible",b="INVALID_KEY_FORMAT"):v.name==="NotSupportedError"?(B="Algorithm or parameters not supported",b="UNSUPPORTED_ALGORITHM"):v.message.includes("namedCurve")?(B="Missing or invalid namedCurve parameter",b="INVALID_CURVE"):v.message.includes("hash")&&(B="Incompatible or unsupported hash algorithm",b="INVALID_HASH"),i.name==="ECDSA"){const w=t.byteLength;B+=` (Key length: ${w})`}return{isValid:!1,reason:`Failed to import public key: ${B}`,errorDetails:{category:b,originalMessage:v.message,algorithm:Gn({},i),environment:zt()?"browser":"node",keyLength:t.byteLength}}}const g=new TextEncoder().encode(l);try{return(yield ea().verify(i,d,h,g))?{isValid:!0}:i.name==="RSASSA-PKCS1-v1_5"&&(yield Ks(t,h,g,i.hash))?{isValid:!0}:{isValid:!1,reason:"Signature verification failed"}}catch(y){return i.name==="RSASSA-PKCS1-v1_5"&&(yield Ks(t,h,g,i.hash))?{isValid:!0}:{isValid:!1,reason:`Signature verification error: ${y instanceof Error?y.message:String(y)}`}}}catch(o){return{isValid:!1,reason:`SignedInfo verification error: ${o instanceof Error?o.message:String(o)}`}}})}function bl(r,e){return Ye(this,arguments,function*(t,i,n={}){var o,s,c,l;const f=[];let h,d=n.verifyTime||t.signingTime;t.signatureTimestamp&&n.verifyTimestamps!==!1&&(h=yield Xs(t.signatureTimestamp,{canonicalSignatureValue:t.canonicalSignatureValue,verifyTsaCertificate:!0,revocationOptions:n.revocationOptions}),h.isValid&&h.info?d=h.info.genTime:h.isValid||f.push(`Timestamp verification failed: ${h.reason||"Unknown reason"}`));const g=yield yl(t.certificatePEM,d);if(!g.isValid){const N=`Certificate validation error: ${g.reason||"Unknown reason"}`;f.push(N)}if(n.checkRevocation!==!1&&g.isValid)try{const N=yield fn(t.certificatePEM,Gn({certificateChain:t.certificateChain},n.revocationOptions));if(g.revocation=N,N.status==="revoked"){const V=N.revokedAt,C=V&&V.getTime()>0;if(C&&d<V)g.revocation.isValid=!0,g.revocation.reason=`Certificate was revoked on ${V.toISOString()}, but signature was made on ${d.toISOString()} (before revocation)`;else{g.isValid=!1;const x=C?` on ${V.toISOString()}`:"";g.reason=N.reason||`Certificate has been revoked${x}`,f.push(N.reason||`Certificate revoked${x}`)}}}catch(N){g.revocation={isValid:!1,status:"error",method:"none",reason:`Revocation check failed: ${N instanceof Error?N.message:String(N)}`,checkedAt:new Date}}const y=n.verifyChecksums!==!1?yield Qs(t,i):{isValid:!0,details:{}};if(!y.isValid){const N=Object.entries(y.details).filter(([V,C])=>!C.matches).map(([V])=>V).join(", ");f.push(`Checksum validation failed for files: ${N}`)}let v={isValid:!0};if(n.verifySignatures!==!1&&t.rawXml&&t.signatureValue&&t.publicKey){const N=t.algorithm||"",V={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"};if(N.includes("ecdsa")&&t.publicKey.namedCurve&&(V.namedCurve=t.publicKey.namedCurve,V.name="ECDSA"),N.includes("ecdsa-sha256")?V.hash="SHA-256":N.includes("ecdsa-sha384")?V.hash="SHA-384":N.includes("ecdsa-sha512")?V.hash="SHA-512":N.includes("rsa-sha1")?V.hash="SHA-1":N.includes("rsa-pss")?(V.name="RSA-PSS",V.saltLength=32,N.includes("sha384")?(V.hash="SHA-384",V.saltLength=48):N.includes("sha512")?(V.hash="SHA-512",V.saltLength=64):V.hash="SHA-256"):N.includes("rsa-sha384")?V.hash="SHA-384":N.includes("rsa-sha512")&&(V.hash="SHA-512"),v=yield wl(t.rawXml,t.signatureValue,t.publicKey.rawData,V,t.canonicalizationMethod),!v.isValid){let C=v.reason||"XML signature verification failed";if(v.errorDetails){const x=v.errorDetails;C+=` [Category: ${x.category}, Environment: ${x.environment}`,x.algorithm&&(C+=`, Algorithm: ${x.algorithm.name}`,x.algorithm.namedCurve&&(C+=`, Curve: ${x.algorithm.namedCurve}`)),x.keyLength&&(C+=`, Key length: ${x.keyLength} bytes`),C+="]"}f.push(C)}}else if(n.verifySignatures!==!1){const N=[];t.rawXml||N.push("Signature XML"),t.signatureValue||N.push("SignatureValue"),t.publicKey||N.push("Public Key"),f.push(`Cannot verify XML signature: missing ${N.join(", ")}`),v={isValid:!1,reason:`Missing required components: ${N.join(", ")}`}}const B=!t.signatureTimestamp||n.verifyTimestamps===!1||((o=h==null?void 0:h.isValid)!=null?o:!0),b=g.isValid&&y.isValid&&v.isValid&&B;let w="VALID",U;const K=[];return b||(v.unsupportedPlatform?(w="UNSUPPORTED",U=v.reason,K.push({code:"RSA_KEY_SIZE_UNSUPPORTED",description:v.reason||"RSA key size not supported",platform:"Safari/WebKit"})):y.isValid?!v.isValid&&!v.unsupportedPlatform?(w="INVALID",U=v.reason||"Signature verification failed"):g.isValid?h&&!h.isValid?(w="INDETERMINATE",U=h.reason||"Timestamp verification failed",K.push({code:"TIMESTAMP_VERIFICATION_FAILED",description:h.reason||"Could not verify timestamp to establish proof of existence"})):((l=g.revocation)==null?void 0:l.status)==="unknown"?(w="INDETERMINATE",U="Certificate revocation status could not be determined",K.push({code:"REVOCATION_UNKNOWN",description:g.revocation.reason||"Could not check certificate revocation status"})):(w="INVALID",U=f[0]||"Verification failed"):(s=g.reason)!=null&&s.includes("expired")&&!(h!=null&&h.isValid)?(w="INDETERMINATE",U="Certificate expired and no valid timestamp proof",K.push({code:"CERT_EXPIRED_NO_POE",description:"Certificate has expired and there is no valid timestamp to prove signature was made when certificate was valid"})):((c=g.revocation)==null?void 0:c.status)==="revoked"?(w="INVALID",U="Certificate has been revoked"):(w="INDETERMINATE",U=g.reason||"Certificate validation inconclusive"):(w="INVALID",U="File integrity check failed")),{isValid:b,status:w,statusMessage:U,limitations:K.length>0?K:void 0,certificate:g,checksums:y,signature:n.verifySignatures!==!1?v:void 0,timestamp:h,errors:f.length>0?f:void 0}})}E.CANONICALIZATION_METHODS=Ze,E.XMLCanonicalizer=q,E.checkCertificateRevocation=fn,E.formatValidityPeriod=ya,E.getSignerDisplayName=da,E.getTimestampTime=Yc,E.parseCertificate=eo,E.parseEdoc=ka,E.parseTimestamp=Fn,E.verifyChecksums=Qs,E.verifySignature=bl,E.verifyTimestamp=Xs,Object.defineProperty(E,"__esModule",{value:!0})});
84
+ -----END X509 CRL-----`;return new ke.X509Crl(r)}catch(r){return null}}}function Gc(n){return Vc(this,arguments,function*(e,r={}){const{timeout:i=1e4,proxyUrl:o}=r,u=new Date,l=qc(e);if(l.length===0)return{isValid:!1,status:"unknown",method:"crl",reason:"Certificate has no CRL distribution point",checkedAt:u};const f=[];for(const p of l)try{const g=yield Oc(p,i,o);if(!g.ok||!g.data){f.push(`${p}: ${g.error||"Failed to fetch"}`);continue}const N=$c(g.data);if(!N){f.push(`${p}: Failed to parse CRL data`);continue}const E=jc(N,e.serialNumber);return E.isRevoked?{isValid:!1,status:"revoked",method:"crl",reason:E.reason!==void 0?`Certificate revoked (reason code: ${E.reason})`:"Certificate revoked",revokedAt:E.revokedAt,checkedAt:u}:{isValid:!0,status:"good",method:"crl",checkedAt:u}}catch(g){f.push(`${p}: ${g instanceof Error?g.message:String(g)}`)}return{isValid:!1,status:"error",method:"crl",reason:`All CRL checks failed: ${f.join("; ")}`,checkedAt:u}})}var Xc=Object.defineProperty,Ma=Object.getOwnPropertySymbols,Wc=Object.prototype.hasOwnProperty,zc=Object.prototype.propertyIsEnumerable,Fa=(n,e,r)=>e in n?Xc(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r,Ua=(n,e)=>{for(var r in e||(e={}))Wc.call(e,r)&&Fa(n,r,e[r]);if(Ma)for(var r of Ma(e))zc.call(e,r)&&Fa(n,r,e[r]);return n},Yc=(n,e,r)=>new Promise((i,o)=>{var u=p=>{try{f(r.next(p))}catch(g){o(g)}},l=p=>{try{f(r.throw(p))}catch(g){o(g)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,l);f((r=r.apply(n,e)).next())});function Yo(n){return Yc(this,arguments,function*(e,r={}){const i=new Date,o=Ua(Ua({},Ll),r);let u;try{u=typeof e=="string"?new ke.X509Certificate(e):e}catch(g){return{isValid:!1,status:"error",method:"none",reason:`Failed to parse certificate: ${g instanceof Error?g.message:String(g)}`,checkedAt:i}}let l=null,f=null;if(o.ocspEnabled&&(l=yield Pc(u,null,{timeout:o.ocspTimeout,certificateChain:o.certificateChain,proxyUrl:r.proxyUrl}),l.status==="good"||l.status==="revoked"))return l;if(o.crlEnabled&&(f=yield Gc(u,{timeout:o.crlTimeout,proxyUrl:r.proxyUrl}),f.status==="good"||f.status==="revoked"))return f;const p=[];return l!=null&&l.reason&&p.push(`OCSP: ${l.reason}`),f!=null&&f.reason&&p.push(`CRL: ${f.reason}`),{isValid:!1,status:"unknown",method:"none",reason:p.length>0?p.join("; "):"No revocation checking method available",checkedAt:i}})}class Vr{constructor(e={}){this.issuer=new yt,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:yt})],Vr.prototype,"issuer",void 0),h([d({type:T.Integer,converter:bt})],Vr.prototype,"serialNumber",void 0);let Hr=class{constructor(e={}){Object.assign(this,e)}};h([d({type:pn,context:0,implicit:!0})],Hr.prototype,"subjectKeyIdentifier",void 0),h([d({type:Vr})],Hr.prototype,"issuerAndSerialNumber",void 0),Hr=h([ie({type:j.Choice})],Hr);var tr;(function(n){n[n.v0=0]="v0",n[n.v1=1]="v1",n[n.v2=2]="v2",n[n.v3=3]="v3",n[n.v4=4]="v4",n[n.v5=5]="v5"})(tr||(tr={}));let gn=class extends ve{};gn=h([ie({type:j.Sequence})],gn);let di=class extends ve{};di=h([ie({type:j.Sequence})],di);let $t=class extends ve{};$t=h([ie({type:j.Sequence})],$t);let gi=class extends ve{};gi=h([ie({type:j.Sequence})],gi);let Pa=class extends ve{};Pa=h([ie({type:j.Sequence})],Pa);let Jo=class extends ve{};Jo=h([ie({type:j.Sequence})],Jo);class mn{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],mn.prototype,"attrType",void 0),h([d({type:T.Any,repeated:"set"})],mn.prototype,"attrValues",void 0);var Ko;class rr{constructor(e={}){this.version=tr.v0,this.sid=new Hr,this.digestAlgorithm=new gn,this.signatureAlgorithm=new di,this.signature=new xe,Object.assign(this,e)}}h([d({type:T.Integer})],rr.prototype,"version",void 0),h([d({type:Hr})],rr.prototype,"sid",void 0),h([d({type:gn})],rr.prototype,"digestAlgorithm",void 0),h([d({type:mn,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],rr.prototype,"signedAttrs",void 0),h([d({type:di})],rr.prototype,"signatureAlgorithm",void 0),h([d({type:xe})],rr.prototype,"signature",void 0),h([d({type:mn,repeated:"set",context:1,implicit:!0,optional:!0})],rr.prototype,"unsignedAttrs",void 0);let mi=Ko=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,Ko.prototype)}};mi=Ko=h([ie({type:j.Set,itemType:rr})],mi);let Va=class extends rr{};Va=h([ie({type:j.Sequence})],Va);let Ha=class extends pt{};Ha=h([ie({type:j.Choice})],Ha);class Qo{constructor(e={}){this.acIssuer=new Se,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}h([d({type:Se})],Qo.prototype,"acIssuer",void 0),h([d({type:T.Integer})],Qo.prototype,"acSerial",void 0),h([d({type:cn,repeated:"sequence"})],Qo.prototype,"attrs",void 0);var Zo;let yi=Zo=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,Zo.prototype)}};yi=Zo=h([ie({type:j.Sequence,itemType:T.ObjectIdentifier})],yi);class vi{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}h([d({type:T.Integer,optional:!0})],vi.prototype,"pathLenConstraint",void 0),h([d({type:yi,implicit:!0,context:0,optional:!0})],vi.prototype,"permittedAttrs",void 0),h([d({type:yi,implicit:!0,context:1,optional:!0})],vi.prototype,"excludedAttrs",void 0),h([d({type:T.Boolean,defaultValue:!0})],vi.prototype,"permitUnSpecified",void 0);class Ar{constructor(e={}){this.issuer=new _t,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:_t})],Ar.prototype,"issuer",void 0),h([d({type:T.Integer,converter:bt})],Ar.prototype,"serial",void 0),h([d({type:T.BitString,optional:!0})],Ar.prototype,"issuerUID",void 0);var es;(function(n){n[n.publicKey=0]="publicKey",n[n.publicKeyCert=1]="publicKeyCert",n[n.otherObjectTypes=2]="otherObjectTypes"})(es||(es={}));class Nr{constructor(e={}){this.digestedObjectType=es.publicKey,this.digestAlgorithm=new ve,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:T.Enumerated})],Nr.prototype,"digestedObjectType",void 0),h([d({type:T.ObjectIdentifier,optional:!0})],Nr.prototype,"otherObjectTypeID",void 0),h([d({type:ve})],Nr.prototype,"digestAlgorithm",void 0),h([d({type:T.BitString})],Nr.prototype,"objectDigest",void 0);class Ei{constructor(e={}){Object.assign(this,e)}}h([d({type:_t,optional:!0})],Ei.prototype,"issuerName",void 0),h([d({type:Ar,context:0,implicit:!0,optional:!0})],Ei.prototype,"baseCertificateID",void 0),h([d({type:Nr,context:1,implicit:!0,optional:!0})],Ei.prototype,"objectDigestInfo",void 0);let qr=class{constructor(e={}){Object.assign(this,e)}};h([d({type:Se,repeated:"sequence"})],qr.prototype,"v1Form",void 0),h([d({type:Ei,context:0,implicit:!0})],qr.prototype,"v2Form",void 0),qr=h([ie({type:j.Choice})],qr);class Ai{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}h([d({type:T.GeneralizedTime})],Ai.prototype,"notBeforeTime",void 0),h([d({type:T.GeneralizedTime})],Ai.prototype,"notAfterTime",void 0);class yn{constructor(e={}){Object.assign(this,e)}}h([d({type:Ar,implicit:!0,context:0,optional:!0})],yn.prototype,"baseCertificateID",void 0),h([d({type:_t,implicit:!0,context:1,optional:!0})],yn.prototype,"entityName",void 0),h([d({type:Nr,implicit:!0,context:2,optional:!0})],yn.prototype,"objectDigestInfo",void 0);var ts;(function(n){n[n.v2=1]="v2"})(ts||(ts={}));class Mt{constructor(e={}){this.version=ts.v2,this.holder=new yn,this.issuer=new qr,this.signature=new ve,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Ai,this.attributes=[],Object.assign(this,e)}}h([d({type:T.Integer})],Mt.prototype,"version",void 0),h([d({type:yn})],Mt.prototype,"holder",void 0),h([d({type:qr})],Mt.prototype,"issuer",void 0),h([d({type:ve})],Mt.prototype,"signature",void 0),h([d({type:T.Integer,converter:bt})],Mt.prototype,"serialNumber",void 0),h([d({type:Ai})],Mt.prototype,"attrCertValidityPeriod",void 0),h([d({type:cn,repeated:"sequence"})],Mt.prototype,"attributes",void 0),h([d({type:T.BitString,optional:!0})],Mt.prototype,"issuerUniqueID",void 0),h([d({type:Mr,optional:!0})],Mt.prototype,"extensions",void 0);class Ni{constructor(e={}){this.acinfo=new Mt,this.signatureAlgorithm=new ve,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:Mt})],Ni.prototype,"acinfo",void 0),h([d({type:ve})],Ni.prototype,"signatureAlgorithm",void 0),h([d({type:T.BitString})],Ni.prototype,"signatureValue",void 0);var wi;(function(n){n[n.unmarked=1]="unmarked",n[n.unclassified=2]="unclassified",n[n.restricted=4]="restricted",n[n.confidential=8]="confidential",n[n.secret=16]="secret",n[n.topSecret=32]="topSecret"})(wi||(wi={}));class rs extends Jn{}class ns{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:T.ObjectIdentifier,implicit:!0,context:0})],ns.prototype,"type",void 0),h([d({type:T.Any,implicit:!0,context:1})],ns.prototype,"value",void 0);class is{constructor(e={}){this.policyId="",this.classList=new rs(wi.unclassified),Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],is.prototype,"policyId",void 0),h([d({type:rs,defaultValue:new rs(wi.unclassified)})],is.prototype,"classList",void 0),h([d({type:ns,repeated:"set"})],is.prototype,"securityCategories",void 0);class bi{constructor(e={}){Object.assign(this,e)}}h([d({type:xe})],bi.prototype,"cotets",void 0),h([d({type:T.ObjectIdentifier})],bi.prototype,"oid",void 0),h([d({type:T.Utf8String})],bi.prototype,"string",void 0);class qa{constructor(e={}){this.values=[],Object.assign(this,e)}}h([d({type:_t,implicit:!0,context:0,optional:!0})],qa.prototype,"policyAuthority",void 0),h([d({type:bi,repeated:"sequence"})],qa.prototype,"values",void 0);var os;class Di{constructor(e={}){this.targetCertificate=new Ar,Object.assign(this,e)}}h([d({type:Ar})],Di.prototype,"targetCertificate",void 0),h([d({type:Se,optional:!0})],Di.prototype,"targetName",void 0),h([d({type:Nr,optional:!0})],Di.prototype,"certDigestInfo",void 0);let jr=class{constructor(e={}){Object.assign(this,e)}};h([d({type:Se,context:0,implicit:!0})],jr.prototype,"targetName",void 0),h([d({type:Se,context:1,implicit:!0})],jr.prototype,"targetGroup",void 0),h([d({type:Di,context:2,implicit:!0})],jr.prototype,"targetCert",void 0),jr=h([ie({type:j.Choice})],jr);let ss=os=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,os.prototype)}};ss=os=h([ie({type:j.Sequence,itemType:jr})],ss);var us;let ja=us=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,us.prototype)}};ja=us=h([ie({type:j.Sequence,itemType:ss})],ja);class $a{constructor(e={}){Object.assign(this,e)}}h([d({type:_t,implicit:!0,context:0,optional:!0})],$a.prototype,"roleAuthority",void 0),h([d({type:Se,implicit:!0,context:1})],$a.prototype,"roleName",void 0);class as{constructor(e={}){this.service=new Se,this.ident=new Se,Object.assign(this,e)}}h([d({type:Se})],as.prototype,"service",void 0),h([d({type:Se})],as.prototype,"ident",void 0),h([d({type:xe,optional:!0})],as.prototype,"authInfo",void 0);var ls;class cs{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],cs.prototype,"otherCertFormat",void 0),h([d({type:T.Any})],cs.prototype,"otherCert",void 0);let $r=class{constructor(e={}){Object.assign(this,e)}};h([d({type:mr})],$r.prototype,"certificate",void 0),h([d({type:Ni,context:2,implicit:!0})],$r.prototype,"v2AttrCert",void 0),h([d({type:cs,context:3,implicit:!0})],$r.prototype,"other",void 0),$r=h([ie({type:j.Choice})],$r);let Ci=ls=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,ls.prototype)}};Ci=ls=h([ie({type:j.Set,itemType:$r})],Ci);class xi{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],xi.prototype,"contentType",void 0),h([d({type:T.Any,context:0})],xi.prototype,"content",void 0);let vn=class{constructor(e={}){Object.assign(this,e)}};h([d({type:xe})],vn.prototype,"single",void 0),h([d({type:T.Any})],vn.prototype,"any",void 0),vn=h([ie({type:j.Choice})],vn);class Ti{constructor(e={}){this.eContentType="",Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],Ti.prototype,"eContentType",void 0),h([d({type:vn,context:0,optional:!0})],Ti.prototype,"eContent",void 0);let En=class{constructor(e={}){Object.assign(this,e)}};h([d({type:xe,context:0,implicit:!0,optional:!0})],En.prototype,"value",void 0),h([d({type:xe,converter:lc,context:0,implicit:!0,optional:!0,repeated:"sequence"})],En.prototype,"constructedValue",void 0),En=h([ie({type:j.Choice})],En);class An{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new gi,Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],An.prototype,"contentType",void 0),h([d({type:gi})],An.prototype,"contentEncryptionAlgorithm",void 0),h([d({type:En,optional:!0})],An.prototype,"encryptedContent",void 0);class Si{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],Si.prototype,"keyAttrId",void 0),h([d({type:T.Any,optional:!0})],Si.prototype,"keyAttr",void 0);var fs;class Bi{constructor(e={}){this.subjectKeyIdentifier=new pn,Object.assign(this,e)}}h([d({type:pn})],Bi.prototype,"subjectKeyIdentifier",void 0),h([d({type:T.GeneralizedTime,optional:!0})],Bi.prototype,"date",void 0),h([d({type:Si,optional:!0})],Bi.prototype,"other",void 0);let Gr=class{constructor(e={}){Object.assign(this,e)}};h([d({type:Bi,context:0,implicit:!0,optional:!0})],Gr.prototype,"rKeyId",void 0),h([d({type:Vr,optional:!0})],Gr.prototype,"issuerAndSerialNumber",void 0),Gr=h([ie({type:j.Choice})],Gr);class ps{constructor(e={}){this.rid=new Gr,this.encryptedKey=new xe,Object.assign(this,e)}}h([d({type:Gr})],ps.prototype,"rid",void 0),h([d({type:xe})],ps.prototype,"encryptedKey",void 0);let Oi=fs=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,fs.prototype)}};Oi=fs=h([ie({type:j.Sequence,itemType:ps})],Oi);class hs{constructor(e={}){this.algorithm=new ve,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:ve})],hs.prototype,"algorithm",void 0),h([d({type:T.BitString})],hs.prototype,"publicKey",void 0);let wr=class{constructor(e={}){Object.assign(this,e)}};h([d({type:pn,context:0,implicit:!0,optional:!0})],wr.prototype,"subjectKeyIdentifier",void 0),h([d({type:hs,context:1,implicit:!0,optional:!0})],wr.prototype,"originatorKey",void 0),h([d({type:Vr,optional:!0})],wr.prototype,"issuerAndSerialNumber",void 0),wr=h([ie({type:j.Choice})],wr);class Xr{constructor(e={}){this.version=tr.v3,this.originator=new wr,this.keyEncryptionAlgorithm=new $t,this.recipientEncryptedKeys=new Oi,Object.assign(this,e)}}h([d({type:T.Integer})],Xr.prototype,"version",void 0),h([d({type:wr,context:0})],Xr.prototype,"originator",void 0),h([d({type:xe,context:1,optional:!0})],Xr.prototype,"ukm",void 0),h([d({type:$t})],Xr.prototype,"keyEncryptionAlgorithm",void 0),h([d({type:Oi})],Xr.prototype,"recipientEncryptedKeys",void 0);let Wr=class{constructor(e={}){Object.assign(this,e)}};h([d({type:pn,context:0,implicit:!0})],Wr.prototype,"subjectKeyIdentifier",void 0),h([d({type:Vr})],Wr.prototype,"issuerAndSerialNumber",void 0),Wr=h([ie({type:j.Choice})],Wr);class Nn{constructor(e={}){this.version=tr.v0,this.rid=new Wr,this.keyEncryptionAlgorithm=new $t,this.encryptedKey=new xe,Object.assign(this,e)}}h([d({type:T.Integer})],Nn.prototype,"version",void 0),h([d({type:Wr})],Nn.prototype,"rid",void 0),h([d({type:$t})],Nn.prototype,"keyEncryptionAlgorithm",void 0),h([d({type:xe})],Nn.prototype,"encryptedKey",void 0);class wn{constructor(e={}){this.keyIdentifier=new xe,Object.assign(this,e)}}h([d({type:xe})],wn.prototype,"keyIdentifier",void 0),h([d({type:T.GeneralizedTime,optional:!0})],wn.prototype,"date",void 0),h([d({type:Si,optional:!0})],wn.prototype,"other",void 0);class bn{constructor(e={}){this.version=tr.v4,this.kekid=new wn,this.keyEncryptionAlgorithm=new $t,this.encryptedKey=new xe,Object.assign(this,e)}}h([d({type:T.Integer})],bn.prototype,"version",void 0),h([d({type:wn})],bn.prototype,"kekid",void 0),h([d({type:$t})],bn.prototype,"keyEncryptionAlgorithm",void 0),h([d({type:xe})],bn.prototype,"encryptedKey",void 0);class Dn{constructor(e={}){this.version=tr.v0,this.keyEncryptionAlgorithm=new $t,this.encryptedKey=new xe,Object.assign(this,e)}}h([d({type:T.Integer})],Dn.prototype,"version",void 0),h([d({type:Jo,context:0,optional:!0})],Dn.prototype,"keyDerivationAlgorithm",void 0),h([d({type:$t})],Dn.prototype,"keyEncryptionAlgorithm",void 0),h([d({type:xe})],Dn.prototype,"encryptedKey",void 0);class ds{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],ds.prototype,"oriType",void 0),h([d({type:T.Any})],ds.prototype,"oriValue",void 0);let ar=class{constructor(e={}){Object.assign(this,e)}};h([d({type:Nn,optional:!0})],ar.prototype,"ktri",void 0),h([d({type:Xr,context:1,implicit:!0,optional:!0})],ar.prototype,"kari",void 0),h([d({type:bn,context:2,implicit:!0,optional:!0})],ar.prototype,"kekri",void 0),h([d({type:Dn,context:3,implicit:!0,optional:!0})],ar.prototype,"pwri",void 0),h([d({type:ds,context:4,implicit:!0,optional:!0})],ar.prototype,"ori",void 0),ar=h([ie({type:j.Choice})],ar);var gs;let Ii=gs=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,gs.prototype)}};Ii=gs=h([ie({type:j.Set,itemType:ar})],Ii);var ms;class Ri{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}h([d({type:T.ObjectIdentifier})],Ri.prototype,"otherRevInfoFormat",void 0),h([d({type:T.Any})],Ri.prototype,"otherRevInfo",void 0);let ki=class{constructor(e={}){this.other=new Ri,Object.assign(this,e)}};h([d({type:Ri,context:1,implicit:!0})],ki.prototype,"other",void 0),ki=h([ie({type:j.Choice})],ki);let _i=ms=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,ms.prototype)}};_i=ms=h([ie({type:j.Set,itemType:ki})],_i);class ys{constructor(e={}){Object.assign(this,e)}}h([d({type:Ci,context:0,implicit:!0,optional:!0})],ys.prototype,"certs",void 0),h([d({type:_i,context:1,implicit:!0,optional:!0})],ys.prototype,"crls",void 0);var vs;let Es=vs=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,vs.prototype)}};Es=vs=h([ie({type:j.Set,itemType:mn})],Es);class Cn{constructor(e={}){this.version=tr.v0,this.recipientInfos=new Ii,this.encryptedContentInfo=new An,Object.assign(this,e)}}h([d({type:T.Integer})],Cn.prototype,"version",void 0),h([d({type:ys,context:0,implicit:!0,optional:!0})],Cn.prototype,"originatorInfo",void 0),h([d({type:Ii})],Cn.prototype,"recipientInfos",void 0),h([d({type:An})],Cn.prototype,"encryptedContentInfo",void 0),h([d({type:Es,context:1,implicit:!0,optional:!0})],Cn.prototype,"unprotectedAttrs",void 0);var As;let Li=As=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,As.prototype)}};Li=As=h([ie({type:j.Set,itemType:gn})],Li);class br{constructor(e={}){this.version=tr.v0,this.digestAlgorithms=new Li,this.encapContentInfo=new Ti,this.signerInfos=new mi,Object.assign(this,e)}}h([d({type:T.Integer})],br.prototype,"version",void 0),h([d({type:Li})],br.prototype,"digestAlgorithms",void 0),h([d({type:Ti})],br.prototype,"encapContentInfo",void 0),h([d({type:Ci,context:0,implicit:!0,optional:!0})],br.prototype,"certificates",void 0),h([d({type:_i,context:1,implicit:!0,optional:!0})],br.prototype,"crls",void 0),h([d({type:mi})],br.prototype,"signerInfos",void 0);class Mi{constructor(e={}){this.seconds=0,Object.assign(this,e)}}h([d({type:T.Integer,optional:!0})],Mi.prototype,"seconds",void 0),h([d({type:T.Integer,context:0,implicit:!0,optional:!0})],Mi.prototype,"millis",void 0),h([d({type:T.Integer,context:1,implicit:!0,optional:!0})],Mi.prototype,"micros",void 0);class zr{constructor(e={}){this.hashAlgorithm=new ve,this.hashedMessage=new xe,Object.assign(this,e)}}h([d({type:ve})],zr.prototype,"hashAlgorithm",void 0),h([d({type:xe})],zr.prototype,"hashedMessage",void 0);var Ft;(function(n){n[n.badAlg=1]="badAlg",n[n.badRequest=2]="badRequest",n[n.badDataFormat=16]="badDataFormat",n[n.timeNotAvailable=8192]="timeNotAvailable",n[n.unacceptedPolicy=16384]="unacceptedPolicy",n[n.unacceptedExtension=32768]="unacceptedExtension",n[n.addInfoNotAvailable=65536]="addInfoNotAvailable",n[n.systemFailure=16777216]="systemFailure"})(Ft||(Ft={}));class Jc extends Jn{toJSON(){const e=this.toNumber(),r=[];return e&Ft.addInfoNotAvailable&&r.push("addInfoNotAvailable"),e&Ft.badAlg&&r.push("badAlg"),e&Ft.badDataFormat&&r.push("badDataFormat"),e&Ft.badRequest&&r.push("badRequest"),e&Ft.systemFailure&&r.push("systemFailure"),e&Ft.systemFailure&&r.push("systemFailure"),e&Ft.timeNotAvailable&&r.push("timeNotAvailable"),e&Ft.unacceptedExtension&&r.push("unacceptedExtension"),e&Ft.unacceptedPolicy&&r.push("unacceptedPolicy"),r}toString(){return`[${this.toJSON().join(", ")}]`}}var Ns;(function(n){n[n.granted=0]="granted",n[n.grantedWithMods=1]="grantedWithMods",n[n.rejection=2]="rejection",n[n.waiting=3]="waiting",n[n.revocationWarning=4]="revocationWarning",n[n.revocationNotification=5]="revocationNotification"})(Ns||(Ns={}));var ws;let bs=ws=class extends Ue{constructor(e){super(e),Object.setPrototypeOf(this,ws.prototype)}};bs=ws=h([ie({type:j.Sequence,itemType:T.Utf8String})],bs);class xn{constructor(e={}){this.status=Ns.granted,Object.assign(this,e)}}h([d({type:T.Integer})],xn.prototype,"status",void 0),h([d({type:bs,optional:!0})],xn.prototype,"statusString",void 0),h([d({type:Jc,optional:!0})],xn.prototype,"failInfo",void 0);var Ds;(function(n){n[n.v1=1]="v1"})(Ds||(Ds={}));class Yr{constructor(e={}){this.version=Ds.v1,this.messageImprint=new zr,this.certReq=!1,Object.assign(this,e)}}h([d({type:T.Integer})],Yr.prototype,"version",void 0),h([d({type:zr})],Yr.prototype,"messageImprint",void 0),h([d({type:T.ObjectIdentifier,optional:!0})],Yr.prototype,"reqPolicy",void 0),h([d({type:T.Integer,converter:bt,optional:!0})],Yr.prototype,"nonce",void 0),h([d({type:T.Boolean,defaultValue:!1})],Yr.prototype,"certReq",void 0),h([d({type:Mr,optional:!0,context:0,implicit:!0})],Yr.prototype,"extensions",void 0);let Cs=class extends xi{};Cs=h([ie({type:j.Sequence})],Cs);class Ga{constructor(e={}){this.status=new xn,Object.assign(this,e)}}h([d({type:xn})],Ga.prototype,"status",void 0),h([d({type:Cs,optional:!0})],Ga.prototype,"timeStampToken",void 0);var xs;(function(n){n[n.v1=1]="v1"})(xs||(xs={}));class Ut{constructor(e={}){this.version=xs.v1,this.policy="",this.messageImprint=new zr,this.serialNumber=new ArrayBuffer(0),this.genTime=new Date,this.ordering=!1,Object.assign(this,e)}}h([d({type:T.Integer})],Ut.prototype,"version",void 0),h([d({type:T.ObjectIdentifier})],Ut.prototype,"policy",void 0),h([d({type:zr})],Ut.prototype,"messageImprint",void 0),h([d({type:T.Integer,converter:bt})],Ut.prototype,"serialNumber",void 0),h([d({type:T.GeneralizedTime})],Ut.prototype,"genTime",void 0),h([d({type:Mi,optional:!0})],Ut.prototype,"accuracy",void 0),h([d({type:T.Boolean,defaultValue:!1})],Ut.prototype,"ordering",void 0),h([d({type:T.Integer,converter:bt,optional:!0})],Ut.prototype,"nonce",void 0),h([d({type:Se,context:0,optional:!0})],Ut.prototype,"tsa",void 0),h([d({type:Mr,context:1,implicit:!0,optional:!0})],Ut.prototype,"extensions",void 0);var Ts=(n,e,r)=>new Promise((i,o)=>{var u=p=>{try{f(r.next(p))}catch(g){o(g)}},l=p=>{try{f(r.throw(p))}catch(g){o(g)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,l);f((r=r.apply(n,e)).next())});const Kc="1.2.840.113549.1.7.2",Qc="1.2.840.113549.1.9.16.1.4";function Zc(n){return{"1.3.14.3.2.26":"SHA-1","2.16.840.1.101.3.4.2.1":"SHA-256","2.16.840.1.101.3.4.2.2":"SHA-384","2.16.840.1.101.3.4.2.3":"SHA-512"}[n]||n}const ef={"2.5.4.3":"CN","2.5.4.6":"C","2.5.4.7":"L","2.5.4.8":"ST","2.5.4.10":"O","2.5.4.11":"OU","2.5.4.5":"serialNumber","1.2.840.113549.1.9.1":"emailAddress"};function tf(n){var e;const r=[];for(const i of n)for(const o of i){const u=ef[o.type]||o.type,l=((e=o.value)==null?void 0:e.toString())||"";l&&r.push(`${u}=${l}`)}return r.join(", ")}function Ss(n){try{const e=Oa(n),r=Rt.parse(e,xi);if(r.contentType!==Kc)return console.warn("Timestamp is not SignedData"),null;const i=Rt.parse(r.content,br);if(i.encapContentInfo.eContentType!==Qc)return console.warn("SignedData does not contain TSTInfo"),null;if(!i.encapContentInfo.eContent)return console.warn("No eContent in SignedData"),null;const o=i.encapContentInfo.eContent;let u;o.single?u=o.single.buffer:o.any?u=o.any:u=Rt.serialize(o);const l=Rt.parse(u,Ut);let f;if(i.certificates&&i.certificates.length>0){const N=i.certificates[0];"certificate"in N&&N.certificate&&(f=Ia(Rt.serialize(N.certificate)))}let p;l.tsa&&(l.tsa.directoryName?p=tf(l.tsa.directoryName):l.tsa.uniformResourceIdentifier&&(p=l.tsa.uniformResourceIdentifier));let g;return l.accuracy&&(g=(l.accuracy.seconds||0)+(l.accuracy.millis||0)/1e3+(l.accuracy.micros||0)/1e6),{genTime:l.genTime,policy:l.policy,serialNumber:pi(l.serialNumber),hashAlgorithm:Zc(l.messageImprint.hashAlgorithm.algorithm),messageImprint:pi(l.messageImprint.hashedMessage.buffer),tsaName:p,tsaCertificate:f,accuracy:g}}catch(e){return console.error("Failed to parse timestamp:",e instanceof Error?e.message:String(e)),null}}function rf(n,e){return Ts(this,null,function*(){const r={"SHA-1":"SHA-1","SHA-256":"SHA-256","SHA-384":"SHA-384","SHA-512":"SHA-512"}[e];if(!r)throw new Error(`Unsupported hash algorithm: ${e}`);if(typeof crypto!="undefined"&&crypto.subtle)return crypto.subtle.digest(r,n);const i=require("crypto").createHash(e.toLowerCase().replace("-",""));return i.update(Buffer.from(n)),i.digest().buffer})}function nf(n,e){return Ts(this,null,function*(){try{const r=n.messageImprint.toLowerCase(),i=new TextEncoder().encode(e),o=yield rf(i.buffer,n.hashAlgorithm);return pi(o).toLowerCase()===r}catch(r){return console.error("Failed to verify timestamp coverage:",r instanceof Error?r.message:String(r)),!1}})}function Xa(n){return Ts(this,arguments,function*(e,r={}){const i=Ss(e);if(!i)return{isValid:!1,reason:"Failed to parse timestamp token"};let o,u;r.canonicalSignatureValue&&(o=yield nf(i,r.canonicalSignatureValue),o||(u="Could not verify timestamp covers signature (hash mismatch)"));let l;if(r.verifyTsaCertificate&&i.tsaCertificate)try{const f=new ke.X509Certificate(i.tsaCertificate);if(i.genTime<f.notBefore||i.genTime>f.notAfter)return{isValid:!1,info:i,coversSignature:o,reason:`TSA certificate was not valid at timestamp time (${i.genTime.toISOString()})`};if(r.checkTsaRevocation!==!1)try{if(l=yield Yo(f,r.revocationOptions),l.status==="revoked")return{isValid:!1,info:i,coversSignature:o,tsaRevocation:l,reason:`TSA certificate has been revoked: ${l.reason||"No reason provided"}`}}catch(p){l={isValid:!1,status:"error",method:"none",reason:`TSA revocation check failed: ${p instanceof Error?p.message:String(p)}`,checkedAt:new Date}}}catch(f){return{isValid:!1,info:i,coversSignature:o,reason:`Failed to verify TSA certificate: ${f instanceof Error?f.message:String(f)}`}}return{isValid:!0,info:i,coversSignature:o,tsaRevocation:l,reason:u}})}function of(n){const e=Ss(n);return(e==null?void 0:e.genTime)||null}var sf=(n,e,r)=>new Promise((i,o)=>{var u=p=>{try{f(r.next(p))}catch(g){o(g)}},l=p=>{try{f(r.throw(p))}catch(g){o(g)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,l);f((r=r.apply(n,e)).next())});function uf(n){const e=new Uint8Array(n);let r=0;const i=()=>{const u=e[r++];if((u&128)===0)return u;const l=u&127;let f=0;for(let p=0;p<l;p++)f=f<<8|e[r++];return f},o=()=>{if(e[r++]!==2)return BigInt(0);const u=i();let l=BigInt(0);for(let f=0;f<u;f++)l=l<<BigInt(8)|BigInt(e[r++]);return l};try{if(e[r++]!==48||(i(),e[r++]!==48))return null;const u=i();if(r+=u,e[r++]!==3||(i(),r++,e[r++]!==48))return null;i();const l=o(),f=o();return{n:l,e:f}}catch(u){return null}}function af(n,e,r){let i=BigInt(1);for(n=n%r;e>0;)e%BigInt(2)===BigInt(1)&&(i=i*n%r),e=e>>BigInt(1),n=n*n%r;return i}function lf(n){let e=BigInt(0);for(const r of n)e=e<<BigInt(8)|BigInt(r);return e}function cf(n,e){const r=new Uint8Array(e);for(let i=e-1;i>=0;i--)r[i]=Number(n&BigInt(255)),n=n>>BigInt(8);return r}function ff(n){if(n[0]!==0||n[1]!==1)return null;let e=-1;for(let r=2;r<n.length;r++){if(n[r]===0){e=r;break}if(n[r]!==255)return null}return e===-1||e<10?null:n.slice(e+1)}function pf(n,e){for(let r=0;r<n.length-1;r++)if(n[r]===4){const i=n[r+1];if(i===e&&r+2+i<=n.length)return n.slice(r+2,r+2+i)}return null}function hf(n){switch(n.toLowerCase().replace("-","")){case"sha1":return 20;case"sha256":return 32;case"sha384":return 48;case"sha512":return 64;default:return 32}}function Wa(){return typeof window!="undefined"&&typeof window.crypto!="undefined"&&typeof window.crypto.subtle!="undefined"}function za(n,e,r,i){return sf(this,null,function*(){try{let o;if(Wa()){const g=uf(n);if(!g)return!1;const{n:N,e:E}=g,S=Math.ceil(N.toString(16).length/2),C=lf(e),I=af(C,E,N),H=cf(I,S);o=ff(H)}else{const g=require("crypto"),N=g.createPublicKey({key:Buffer.from(n),format:"der",type:"spki"}),E=g.publicDecrypt({key:N,padding:g.constants.RSA_PKCS1_PADDING},Buffer.from(e));o=new Uint8Array(E)}if(!o)return!1;const u=hf(i),l=pf(o,u);if(!l)return!1;let f;if(Wa()){let g=i.toUpperCase().replace(/-/g,"");g=g.replace(/^SHA(\d)/,"SHA-$1");const N=yield window.crypto.subtle.digest(g,new Uint8Array(r));f=new Uint8Array(N)}else{const g=require("crypto"),N=i.toLowerCase().replace("-","");f=g.createHash(N).update(Buffer.from(r)).digest()}if(l.length!==f.length)return!1;let p=0;for(let g=0;g<l.length;g++)p|=l[g]^f[g];return p===0}catch(o){return!1}})}const df={c:"C",cn:"CN",dnq:"DNQ",emailaddress:"E",e:"E",g:"GN",givenname:"GN",gn:"GN",l:"L",o:"O",organizationidentifier:"ORGANIZATIONIDENTIFIER","2.5.4.97":"ORGANIZATIONIDENTIFIER","oid.2.5.4.97":"ORGANIZATIONIDENTIFIER",ou:"OU",serialnumber:"SERIALNUMBER",sn:"SN",st:"ST",surname:"SN",street:"STREET","2.5.4.5":"SERIALNUMBER"};function Ya(n,e){const r=[];let i="",o=!1;for(const u of n){if(o){i+=u,o=!1;continue}if(u==="\\"){i+=u,o=!0;continue}if(u===e){r.push(i),i="";continue}i+=u}return r.push(i),r}function gf(n){const e=n.trim();return df[e.toLowerCase()]||e.toUpperCase()}function mf(n,e){const r=e.trim().replace(/\s+/g," ");return n==="C"?r.toUpperCase():r}function yf(n){return n&&n.replace(/[^a-fA-F0-9]/g,"").toLowerCase()||null}function Bs(n){return Array.from(n,e=>e.toString(16).padStart(2,"0")).join("")}function vf(n){const e=n.replace(/\s+/g,"");try{if(typeof Buffer!="undefined")return Uint8Array.from(Buffer.from(e,"base64"));if(typeof atob=="function"){const r=atob(e);return Uint8Array.from(r,i=>i.charCodeAt(0))}}catch(r){return null}return null}function Ja(n){if(!n)return null;if(typeof n!="string")return ArrayBuffer.isView(n)?Bs(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)):Bs(new Uint8Array(n));const e=n.trim();if(!e)return null;const r=yf(e),i=e.replace(/[\s:-]+/g,"");if(r&&/^[a-fA-F0-9]+$/.test(i)&&i.length%2===0)return r;if(/^[A-Za-z0-9+/=\s]+$/.test(e)&&e.replace(/\s+/g,"").length%4===0){const o=vf(e);if(o&&o.length>0)return Bs(o)}return r}function Os(n){return n?Ya(n,",").map(e=>e.trim()).filter(Boolean).map(e=>{const[r,...i]=Ya(e,"=");if(!r||i.length===0)return e.replace(/\s+/g," ");const o=gf(r),u=mf(o,i.join("="));return`${o}=${u}`}).sort((e,r)=>e.localeCompare(r)).join(","):""}var Is=(n,e,r)=>new Promise((i,o)=>{var u=p=>{try{f(r.next(p))}catch(g){o(g)}},l=p=>{try{f(r.throw(p))}catch(g){o(g)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,l);f((r=r.apply(n,e)).next())});const Ef="2.5.29.35",Af="2.5.29.14";function Ka(n){return Is(this,null,function*(){const e=yield crypto.subtle.digest("SHA-256",n);return pi(e)})}function Nf(n){const e=n.getExtension(Ef);return Ja(e==null?void 0:e.keyId)}function wf(n){const e=n.getExtension(Af);return Ja(e==null?void 0:e.keyId)}function bf(n){return Is(this,arguments,function*(e,r={}){const i=new ke.X509Certificate(e);let o=r.certificateChain&&r.certificateChain.length>0?_a(i,r.certificateChain):null;return!o&&r.fetchOptions&&(o=yield La(i,r.fetchOptions.timeout,r.fetchOptions.proxyUrl)),{issuerSubjectDn:Os(i.issuer),authorityKeyIdentifierHex:Nf(i),issuerCertificate:o?{subjectDn:Os(o.subject),spkiSha256Hex:yield Ka(o.publicKey.rawData)}:null}})}function Df(n){return Is(this,null,function*(){const e=new ke.X509Certificate(n);return{subjectDn:Os(e.subject),subjectKeyIdentifierHex:wf(e),spkiSha256Hex:yield Ka(e.publicKey.rawData)}})}var Cf=Object.defineProperty,Qa=Object.getOwnPropertySymbols,xf=Object.prototype.hasOwnProperty,Tf=Object.prototype.propertyIsEnumerable,Za=(n,e,r)=>e in n?Cf(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r,Tn=(n,e)=>{for(var r in e||(e={}))xf.call(e,r)&&Za(n,r,e[r]);if(Qa)for(var r of Qa(e))Tf.call(e,r)&&Za(n,r,e[r]);return n},Dr=(n,e,r)=>new Promise((i,o)=>{var u=p=>{try{f(r.next(p))}catch(g){o(g)}},l=p=>{try{f(r.throw(p))}catch(g){o(g)}},f=p=>p.done?i(p.value):Promise.resolve(p.value).then(u,l);f((r=r.apply(n,e)).next())});function Be(n,e,r,i,o){return Tn(Tn({check:n,label:e,status:r},i?{detail:i}:{}),o?{country:o}:{})}function el(n){const e=Object.entries(n.details).filter(([r,i])=>!i.matches).map(([r])=>r).join(", ");return e?`Checksum validation failed for files: ${e}`:"Checksum validation failed"}function tl(n,e,r,i,o,u){return i?Be(n,e,"indeterminate",i):r?r.confidence==="dn_only"&&!u?Be(n,e,"indeterminate",r.detail||o,r.country):r.trustedAtTime===!0?Be(n,e,"pass",r.detail,r.country):r.trustedAtTime===!1||!r.found?Be(n,e,"fail",r.detail,r.country):Be(n,e,"indeterminate",r.detail||o,r.country):Be(n,e,"indeterminate",o)}function Sf({options:n,signatureInfo:e,certificateValidityAtSigningTime:r,certificateResult:i,checksumResult:o,signatureResult:u,timestampResult:l,overallStatus:f,trustListMatch:p,trustListError:g,timestampTrustListMatch:N,timestampTrustListError:E}){var S;const C=[];return n.verifyChecksums===!1?C.push(Be("document_integrity","Document integrity","skipped","Checksum verification not enabled")):C.push(Be("document_integrity","Document integrity",o.isValid?"pass":"fail",o.isValid?void 0:el(o))),n.verifySignatures===!1?C.push(Be("signature_valid","Signature cryptographically valid","skipped","Signature verification not enabled")):u.unsupportedPlatform?C.push(Be("signature_valid","Signature cryptographically valid","indeterminate",u.reason||"Signature verification is not supported on this platform")):C.push(Be("signature_valid","Signature cryptographically valid",u.isValid?"pass":"fail",u.isValid?void 0:u.reason)),r.isValid?C.push(Be("certificate_valid_at_signing_time","Certificate valid at trusted signing time","pass")):C.push(Be("certificate_valid_at_signing_time","Certificate valid at trusted signing time",f==="INDETERMINATE"?"indeterminate":"fail",r.reason||i.reason)),e.signatureTimestamp?C.push(Be("timestamp_present","Signature timestamp present","pass")):C.push(Be("timestamp_present","Signature timestamp present","skipped","Signature timestamp not present")),e.signatureTimestamp?n.verifyTimestamps===!1?C.push(Be("timestamp_valid","Timestamp valid and bound to signature","skipped","Timestamp verification not enabled")):l?l.coversSignature===!1?C.push(Be("timestamp_valid","Timestamp valid and bound to signature","fail",l.reason||"Timestamp token does not cover the signature value")):l.isValid?l.coversSignature===!0?C.push(Be("timestamp_valid","Timestamp valid and bound to signature","pass")):C.push(Be("timestamp_valid","Timestamp valid and bound to signature","indeterminate",l.reason||"Timestamp token verified, but signature binding could not be confirmed")):C.push(Be("timestamp_valid","Timestamp valid and bound to signature","fail",l.reason||"Timestamp verification failed")):C.push(Be("timestamp_valid","Timestamp valid and bound to signature","indeterminate","Timestamp verification did not return a result")):C.push(Be("timestamp_valid","Timestamp valid and bound to signature","skipped","Signature timestamp not present")),e.signatureTimestamp?n.verifyTimestamps===!1?C.push(Be("timestamp_authority_trusted_at_signing_time","Timestamp authority trusted at signing time","skipped","Timestamp verification not enabled")):n.trustListProvider?(S=l==null?void 0:l.info)!=null&&S.tsaCertificate?C.push(tl("timestamp_authority_trusted_at_signing_time","Timestamp authority trusted at signing time",N,E,"Timestamp authority trust check did not return a result",n.allowWeakDnOnlyTrustMatch===!0)):C.push(Be("timestamp_authority_trusted_at_signing_time","Timestamp authority trusted at signing time","indeterminate",(l==null?void 0:l.reason)||"Timestamp verification did not produce a TSA certificate")):C.push(Be("timestamp_authority_trusted_at_signing_time","Timestamp authority trusted at signing time","skipped","Trusted-list provider not configured")):C.push(Be("timestamp_authority_trusted_at_signing_time","Timestamp authority trusted at signing time","skipped","Signature timestamp not present")),n.checkRevocation===!1?C.push(Be("certificate_not_revoked_at_signing_time","Certificate not revoked at signing time","skipped","Revocation check not enabled")):i.revocation?i.revocation.status==="good"||i.revocation.isValid?C.push(Be("certificate_not_revoked_at_signing_time","Certificate not revoked at signing time","pass",i.revocation.reason)):i.revocation.status==="unknown"||i.revocation.status==="error"?C.push(Be("certificate_not_revoked_at_signing_time","Certificate not revoked at signing time","indeterminate",i.revocation.reason)):C.push(Be("certificate_not_revoked_at_signing_time","Certificate not revoked at signing time","fail",i.revocation.reason)):C.push(Be("certificate_not_revoked_at_signing_time","Certificate not revoked at signing time","skipped","Revocation check was not performed")),n.trustListProvider?C.push(tl("issuer_trusted_at_signing_time","Issuer trusted at signing time",p,g,"Issuer trust check did not return a result",n.allowWeakDnOnlyTrustMatch===!0)):C.push(Be("issuer_trusted_at_signing_time","Issuer trusted at signing time","skipped","Trusted-list provider not configured")),C}function Sn(){return typeof window!="undefined"&&typeof window.crypto!="undefined"&&typeof window.crypto.subtle!="undefined"}function Bf(){if(typeof navigator=="undefined")return!1;const n=navigator.userAgent,e=/AppleWebKit/.test(n),r=/Chrome/.test(n)||/Chromium/.test(n)||/Edg/.test(n);return e&&!r}function Of(n){const e=new Uint8Array(n),r=[6,9,42,134,72,134,247,13,1,1,1];let i=-1;for(let f=0;f<=e.length-r.length;f++){let p=!0;for(let g=0;g<r.length;g++)if(e[f+g]!==r[g]){p=!1;break}if(p){i=f;break}}if(i===-1)return 0;let o=-1;for(let f=i+r.length;f<e.length;f++)if(e[f]===3){o=f;break}if(o===-1)return 0;let u=o+1;if((e[u]&128)===0?u+=1:u+=1+(e[u]&127),u+=1,e[u]!==48||(u+=1,(e[u]&128)===0?u+=1:u+=1+(e[u]&127),e[u]!==2))return 0;u+=1;let l=0;if((e[u]&128)===0)l=e[u];else{const f=e[u]&127;for(let p=0;p<f;p++)l=l<<8|e[u+1+p]}return l*8}function If(n){return!Sn()||!Bf()?!0:n<=4096}function rl(n,e){return Dr(this,null,function*(){const r=e.replace(/-/g,"").toLowerCase();let i;if(r.includes("sha256"))i="sha256";else if(r.includes("sha1"))i="sha1";else if(r.includes("sha384"))i="sha384";else if(r.includes("sha512"))i="sha512";else throw new Error(`Unsupported digest algorithm: ${e}`);return Sn()?Rf(n,i):kf(n,i)})}function Rf(n,e){return Dr(this,null,function*(){const r={sha1:"SHA-1",sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"}[e];if(!r)throw new Error(`Unsupported browser digest algorithm: ${e}`);const i=yield window.crypto.subtle.digest(r,new Uint8Array(n)),o=Array.from(new Uint8Array(i));return btoa(String.fromCharCode.apply(null,o))})}function kf(n,e){return new Promise((r,i)=>{try{const o=require("crypto").createHash(e);o.update(Buffer.from(n)),r(o.digest("base64"))}catch(o){i(new Error(`Node digest computation failed: ${o instanceof Error?o.message:String(o)}`))}})}function _f(n){const e=n.toLowerCase();return e.includes("sha512")?"SHA-512":e.includes("sha384")?"SHA-384":e.includes("sha256")?"SHA-256":e.includes("sha1")?"SHA-1":"SHA-256"}function nl(n,e){return Dr(this,null,function*(){const r={};let i=!0,o="SHA-256";n.algorithm&&(n.algorithm.includes("sha1")?o="SHA-1":n.algorithm.includes("sha384")?o="SHA-384":n.algorithm.includes("sha512")&&(o="SHA-512"));const u=Object.entries(n.signedChecksums).map(l=>Dr(null,[l],function*([f,p]){var g;const N=(g=n.digestAlgorithms)!=null&&g[f]?_f(n.digestAlgorithms[f]):o,E=e.get(f);if(E){const S=yield rl(E,N),C=p===S;r[f]={expected:p,actual:S,matches:C,fileFound:!0},C||(i=!1)}else{const S=f.includes("/")?f.split("/").pop():f;let C=!1;if(S){for(const[I,H]of e.entries())if(I.endsWith(S)){const U=yield rl(H,N),R=p===U;r[f]={expected:p,actual:U,matches:R,fileFound:!0},R||(i=!1),C=!0;break}}C||(r[f]={expected:p,actual:"",matches:!1,fileFound:!1},i=!1)}}));return yield Promise.all(u),{isValid:i,details:r}})}function Lf(n){return Dr(this,arguments,function*(e,r=new Date){try{const i=new ke.X509Certificate(e),o=Al(i,r),u=yield Qs(e);return{isValid:o.isValid,reason:o.reason,info:u}}catch(i){return{isValid:!1,reason:`Certificate parsing error: ${i instanceof Error?i.message:String(i)}`}}})}function Mf(n){switch(n){case"P-256":return 32;case"P-384":return 48;case"P-521":return 66;default:return 32}}function Ff(n,e){const r=Mf(e),i=r*2;if(n.length===i)return n;if(n[0]===48)return Uf(n,r);if(n.length>i){const o=n.length/2;if(Number.isInteger(o)){const u=n.slice(0,o),l=n.slice(o),f=Fi(u,r),p=Fi(l,r),g=new Uint8Array(i);return g.set(f,0),g.set(p,r),g}}return n}function Fi(n,e){let r=0;for(;r<n.length-1&&n[r]===0;)r++;const i=n.slice(r);if(i.length===e)return i;if(i.length<e){const o=new Uint8Array(e);return o.set(i,e-i.length),o}else return i.slice(i.length-e)}function Uf(n,e){let r=0;if(n[r++]!==48)throw new Error("Invalid DER signature: missing SEQUENCE tag");const i=n[r++];if(i&128&&(r+=i&127),n[r++]!==2)throw new Error("Invalid DER signature: missing INTEGER tag for R");const o=n[r++],u=n.slice(r,r+o);if(r+=o,n[r++]!==2)throw new Error("Invalid DER signature: missing INTEGER tag for S");const l=n[r++],f=n.slice(r,r+l),p=new Uint8Array(e*2);return p.set(Fi(u,e),0),p.set(Fi(f,e),e),p}function il(){return Sn()?window.crypto.subtle:crypto.subtle}function Pf(n,e,r,i,o){return Dr(this,null,function*(){try{const u=zs().parseFromString(n,"application/xml"),l=ot(u,"ds:SignedInfo");if(!l)return{isValid:!1,reason:"SignedInfo element not found in provided XML"};const f=o||Br.default,p=Ye.canonicalize(l,f),g=e.replace(/\s+/g,"");let N;try{N=Rc(g)}catch(C){return{isValid:!1,reason:`Failed to decode signature value: ${C instanceof Error?C.message:String(C)}`}}i.name==="ECDSA"&&(N=Ff(N,i.namedCurve));let E;try{const C=il(),I=i.name==="RSASSA-PKCS1-v1_5"||i.name==="RSA-PSS";if(I){const H=Of(r);if(H>0&&!If(H))return{isValid:!1,unsupportedPlatform:!0,reason:`RSA key size (${H} bits) not supported in this browser`,errorDetails:{category:"RSA_KEY_SIZE_UNSUPPORTED",originalMessage:"Safari/WebKit only supports RSA keys up to 4096 bits",algorithm:Tn({},i),environment:"browser",keyLength:r.byteLength}}}if(Sn()&&I)try{E=yield C.importKey("spki",r,i,!1,["verify"])}catch(H){const U=_l(r);E=yield C.importKey("spki",U,i,!1,["verify"])}else E=yield C.importKey("spki",r,i,!1,["verify"])}catch(C){const I=C instanceof Error?C:new Error(String(C));let H="Unknown reason",U="KEY_IMPORT_ERROR";if(I.name==="DataError"?(H="Key data format is invalid or incompatible",U="INVALID_KEY_FORMAT"):I.name==="NotSupportedError"?(H="Algorithm or parameters not supported",U="UNSUPPORTED_ALGORITHM"):I.message.includes("namedCurve")?(H="Missing or invalid namedCurve parameter",U="INVALID_CURVE"):I.message.includes("hash")&&(H="Incompatible or unsupported hash algorithm",U="INVALID_HASH"),i.name==="ECDSA"){const R=r.byteLength;H+=` (Key length: ${R})`}return{isValid:!1,reason:`Failed to import public key: ${H}`,errorDetails:{category:U,originalMessage:I.message,algorithm:Tn({},i),environment:Sn()?"browser":"node",keyLength:r.byteLength}}}const S=new TextEncoder().encode(p);try{return(yield il().verify(i,E,new Uint8Array(N),new Uint8Array(S)))?{isValid:!0}:i.name==="RSASSA-PKCS1-v1_5"&&(yield za(r,N,S,i.hash))?{isValid:!0}:{isValid:!1,reason:"Signature verification failed"}}catch(C){return i.name==="RSASSA-PKCS1-v1_5"&&(yield za(r,N,S,i.hash))?{isValid:!0}:{isValid:!1,reason:`Signature verification error: ${C instanceof Error?C.message:String(C)}`}}}catch(u){return{isValid:!1,reason:`SignedInfo verification error: ${u instanceof Error?u.message:String(u)}`}}})}function Vf(n,e){return Dr(this,arguments,function*(r,i,o={}){var u,l,f,p,g,N;const E=[];let S,C,I,H,U,R=o.verifyTime||r.signingTime;r.signatureTimestamp&&o.verifyTimestamps!==!1&&(S=yield Xa(r.signatureTimestamp,{canonicalSignatureValue:r.canonicalSignatureValue,verifyTsaCertificate:!0,revocationOptions:o.revocationOptions}),S.isValid&&S.info?R=S.info.genTime:S.isValid||E.push(`Timestamp verification failed: ${S.reason||"Unknown reason"}`));const K=yield Lf(r.certificatePEM,R),Ae={isValid:K.isValid,reason:K.reason};if(!K.isValid){const k=`Certificate validation error: ${K.reason||"Unknown reason"}`;E.push(k)}if(o.checkRevocation!==!1&&K.isValid)try{const k=yield Yo(r.certificatePEM,Tn({certificateChain:r.certificateChain},o.revocationOptions));if(K.revocation=k,k.status==="revoked"){const de=k.revokedAt,B=de&&de.getTime()>0;if(B&&R<de)K.revocation.isValid=!0,K.revocation.reason=`Certificate was revoked on ${de.toISOString()}, but signature was made on ${R.toISOString()} (before revocation)`;else{K.isValid=!1;const F=B?` on ${de.toISOString()}`:"";K.reason=k.reason||`Certificate has been revoked${F}`,E.push(k.reason||`Certificate revoked${F}`)}}}catch(k){K.revocation={isValid:!1,status:"error",method:"none",reason:`Revocation check failed: ${k instanceof Error?k.message:String(k)}`,checkedAt:new Date}}if(o.trustListProvider){try{const k=yield bf(r.certificatePEM,{certificateChain:r.certificateChain,fetchOptions:o.trustedListFetchOptions});C=yield o.trustListProvider.match({purpose:"signature_issuer",subjectDn:k.issuerSubjectDn,skiHex:k.authorityKeyIdentifierHex,spkiSha256Hex:(u=k.issuerCertificate)==null?void 0:u.spkiSha256Hex,time:R})}catch(k){I=`Trusted list check failed: ${k instanceof Error?k.message:String(k)}`,E.push(I)}if((l=S==null?void 0:S.info)!=null&&l.tsaCertificate&&S.info.genTime)try{const k=yield Df(S.info.tsaCertificate);H=yield o.trustListProvider.match({purpose:"timestamp_tsa",subjectDn:k.subjectDn,skiHex:k.subjectKeyIdentifierHex,spkiSha256Hex:k.spkiSha256Hex,time:S.info.genTime})}catch(k){U=`Timestamp authority trusted-list check failed: ${k instanceof Error?k.message:String(k)}`,E.push(U)}}const be=o.verifyChecksums!==!1?yield nl(r,i):{isValid:!0,details:{}},Ce=be.isValid?void 0:el(be);Ce&&E.push(Ce);let D={isValid:!0};if(o.verifySignatures!==!1&&r.rawXml&&r.signatureValue&&r.publicKey){const k=r.algorithm||"",de={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"};if(k.includes("ecdsa")&&r.publicKey.namedCurve&&(de.namedCurve=r.publicKey.namedCurve,de.name="ECDSA"),k.includes("ecdsa-sha256")?de.hash="SHA-256":k.includes("ecdsa-sha384")?de.hash="SHA-384":k.includes("ecdsa-sha512")?de.hash="SHA-512":k.includes("rsa-sha1")?de.hash="SHA-1":k.includes("rsa-pss")?(de.name="RSA-PSS",de.saltLength=32,k.includes("sha384")?(de.hash="SHA-384",de.saltLength=48):k.includes("sha512")?(de.hash="SHA-512",de.saltLength=64):de.hash="SHA-256"):k.includes("rsa-sha384")?de.hash="SHA-384":k.includes("rsa-sha512")&&(de.hash="SHA-512"),D=yield Pf(r.rawXml,r.signatureValue,r.publicKey.rawData,de,r.canonicalizationMethod),!D.isValid){let B=D.reason||"XML signature verification failed";if(D.errorDetails){const F=D.errorDetails;B+=` [Category: ${F.category}, Environment: ${F.environment}`,F.algorithm&&(B+=`, Algorithm: ${F.algorithm.name}`,F.algorithm.namedCurve&&(B+=`, Curve: ${F.algorithm.namedCurve}`)),F.keyLength&&(B+=`, Key length: ${F.keyLength} bytes`),B+="]"}E.push(B)}}else if(o.verifySignatures!==!1){const k=[];r.rawXml||k.push("Signature XML"),r.signatureValue||k.push("SignatureValue"),r.publicKey||k.push("Public Key"),E.push(`Cannot verify XML signature: missing ${k.join(", ")}`),D={isValid:!1,reason:`Missing required components: ${k.join(", ")}`}}const A=!r.signatureTimestamp||o.verifyTimestamps===!1||((f=S==null?void 0:S.isValid)!=null?f:!0);let q=K.isValid&&be.isValid&&D.isValid&&A,re="VALID",Q;const ge=[];q||(D.unsupportedPlatform?(re="UNSUPPORTED",Q=D.reason,ge.push({code:"RSA_KEY_SIZE_UNSUPPORTED",description:D.reason||"RSA key size not supported",platform:"Safari/WebKit"})):be.isValid?!D.isValid&&!D.unsupportedPlatform?(re="INVALID",Q=D.reason||"Signature verification failed"):K.isValid?S&&!S.isValid?(re="INDETERMINATE",Q=S.reason||"Timestamp verification failed",ge.push({code:"TIMESTAMP_VERIFICATION_FAILED",description:S.reason||"Could not verify timestamp to establish proof of existence"})):((N=K.revocation)==null?void 0:N.status)==="unknown"?(re="INDETERMINATE",Q="Certificate revocation status could not be determined",ge.push({code:"REVOCATION_UNKNOWN",description:K.revocation.reason||"Could not check certificate revocation status"})):(re="INVALID",Q=E[0]||"Verification failed"):(p=K.reason)!=null&&p.includes("expired")&&!(S!=null&&S.isValid)?(re="INDETERMINATE",Q="Certificate expired and no valid timestamp proof",ge.push({code:"CERT_EXPIRED_NO_POE",description:"Certificate has expired and there is no valid timestamp to prove signature was made when certificate was valid"})):((g=K.revocation)==null?void 0:g.status)==="revoked"?(re="INVALID",Q="Certificate has been revoked"):(re="INDETERMINATE",Q=K.reason||"Certificate validation inconclusive"):(re="INVALID",Q="File integrity check failed")),re==="VALID"&&o.trustListProvider&&(C&&(!C.found||C.trustedAtTime===!1)?(re="INDETERMINATE",q=!1,Q=C.found?"Signer issuer found in trusted list but was not trusted at signing time":"Signer issuer not found in trusted list",ge.push({code:"ISSUER_NOT_TRUSTED",description:Q})):!C&&I&&(re="INDETERMINATE",q=!1,Q="Trusted list check failed",ge.push({code:"TRUST_LIST_CHECK_FAILED",description:I})));const Ie=o.includeChecklist?Sf({options:o,signatureInfo:r,certificateValidityAtSigningTime:Ae,certificateResult:K,checksumResult:be,signatureResult:D,timestampResult:S,overallStatus:re,trustListMatch:C,trustListError:I,timestampTrustListMatch:H,timestampTrustListError:U}):void 0;return{isValid:q,status:re,statusMessage:Q,limitations:ge.length>0?ge:void 0,certificate:K,checksums:be,signature:o.verifySignatures!==!1?D:void 0,timestamp:S,checklist:Ie,trustListMatch:C,timestampTrustListMatch:H,errors:E.length>0?E:void 0}})}Ne.CANONICALIZATION_METHODS=Br,Ne.XMLCanonicalizer=Ye,Ne.checkCertificateRevocation=Yo,Ne.formatValidityPeriod=wl,Ne.getSignerDisplayName=Nl,Ne.getTimestampTime=of,Ne.parseCertificate=Qs,Ne.parseEdoc=kl,Ne.parseTimestamp=Ss,Ne.verifyChecksums=nl,Ne.verifySignature=Vf,Ne.verifyTimestamp=Xa,Object.defineProperty(Ne,"__esModule",{value:!0})}));
79
85
  //# sourceMappingURL=index.umd.js.map