@blockcerts/blockcerts-verifier 1.50.0 → 1.50.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.
package/dist/ie11.js
CHANGED
|
@@ -444,7 +444,7 @@ var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
|
|
|
444
444
|
</svg>
|
|
445
445
|
<span class='buv-u-visually-hidden'>${na("text.brandname")}</span>
|
|
446
446
|
`}
|
|
447
|
-
</a>`;const oa={en:function(e){const t=na("numbers","ordinal"),r=e%100;return t[(r-20)%10]||t[r]||t[0]},fr:function(e){const t=na("numbers","ordinal");return 1===e?t[e]:t[0]},es:()=>na("numbers","ordinal"),it:()=>na("numbers","ordinal"),mt:e=>na("numbers","ordinal")[e-1]};function sa(e){return"mt"===ea.locale?oa[ea.locale](e):e+oa[ea.locale](e)}const ua=({certificateTitle:e="",issueDate:t="",issuerName:r="",recipientName:n="",issuerPublicKey:i=[],issuerPublicDomain:a=[],issuerPublicUrl:o=[],issuerLogo:s="",qrCodeImage:u=""})=>{const c=[];(e||s)&&(c.push("<section>"),s&&c.push(`<div style="margin:0 auto;width:140px;height:140px;background-repeat:no-repeat;background-position:center;background-size:contain;background-image:url('${s}');"></div>`),e&&c.push(`<h2 style="margin:20px 0;font-size:18px;text-align:center">${e}</h2>`),c.push("</section>")),c.push('<section style="text-align:center">');const l=[{title:"Issue Date",value:t},{title:"Recipient",value:n},{title:"Issuer",value:r}];c.push(...l.map((e=>`<div style="margin:15px 0"><dt style="margin-bottom:5px;text-transform:uppercase;font-weight:600;font-size:12px">${e.title}</dt><dd style="margin:0;word-break:break-all;font-size:13px">${e.value}</dd></div>`)));const f=i.map(((e,t)=>({publicKey:e,url:o[t],domain:a[t]})));c.push(function(e){const t=e.length>1,r=['<div style="margin:15px 0">'];return r.push('<dt style="margin-bottom:5px;text-transform:uppercase;font-weight:600;font-size:12px">Issuer Information</dt>'),r.push('<dd style="margin:0;word-break:break-all;font-size:13px">'),r.push('<div style="display:flex;flex-direction:column;align-content:center;row-gap:4px;padding:0 20px;font-size:12px">'),r.push(...e.map(((e,r)=>{const n=['<div style="display:flex;flex-direction:column;row-gap:3px;justify-content:center;padding:5px 10px">'];return n.push("<div>"),t&&n.push(`<span style="font-weight:500;margin-right:10px">${sa(r+1)}</span>`),n.push(`<span>Public Key: ${e.publicKey}</span>`),n.push("</div>"),e.url&&e.domain&&n.push(`<span><a href="${e.url}">${e.domain}</a></span>`),n.push("</div>"),n.join("")}))),r.push("<div/>"),r.push("<dd/>"),r.push("<div/>"),r.join("")}(f)),c.push("</section>"),u&&(c.push("<section>"),c.push('<span style="margin-bottom:15px;font-size:10px">Scan the QR code to verify the document.</span>'),c.push(`<div style="margin:0 auto;width:110px;height:110px;background-repeat:no-repeat;background-position:center;background-size:contain;background-image:url('data:image/svg+xml;base64,${u}');"></div>`),c.push("</section>")),c.push(`<div style="width:150px">${ia().getHTML()}</div>`);const h=document.createElement("section");return h.setAttribute("style","width:595px;height:842px;padding:40px 20px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:space-between;align-items:center;font-family:'Open Sans',-apple-system,BlinkMacSystemFont,sans-serif;color:rgb(0,0,0);"),h.innerHTML=c.join(""),h};var ca={exports:{}};!function(e){function t(e){this.mode=n.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,r=this.data.length;t<r;t++){var i=[],a=this.data.charCodeAt(t);a>65536?(i[0]=240|(1835008&a)>>>18,i[1]=128|(258048&a)>>>12,i[2]=128|(4032&a)>>>6,i[3]=128|63&a):a>2048?(i[0]=224|(61440&a)>>>12,i[1]=128|(4032&a)>>>6,i[2]=128|63&a):a>128?(i[0]=192|(1984&a)>>>6,i[1]=128|63&a):i[0]=a,this.parsedData.push(i)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function r(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}t.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t<r;t++)e.put(this.parsedData[t],8)}},r.prototype={addData:function(e){var r=new t(e);this.dataList.push(r),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++)this.modules[n][i]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=r.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(this.modules[e+r][t+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=v.getLostPoint(this);(0==r||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r);this.make();for(var i=0;i<this.modules.length;i++)for(var a=1*i,o=0;o<this.modules[i].length;o++){var s=1*o;this.modules[i][o]&&(n.beginFill(0,100),n.moveTo(s,a),n.lineTo(s+1,a),n.lineTo(s+1,a+1),n.lineTo(s,a+1),n.endFill())}return n},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)null==this.modules[e][6]&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=t%2==0)},setupPositionAdjustPattern:function(){for(var e=v.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var n=e[t],i=e[r];if(null==this.modules[n][i])for(var a=-2;a<=2;a++)for(var o=-2;o<=2;o++)this.modules[n+a][i+o]=-2==a||2==a||-2==o||2==o||0==a&&0==o}},setupTypeNumber:function(e){for(var t=v.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var n=!e&&1==(t>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(r=0;r<18;r++){n=!e&&1==(t>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=v.getBCHTypeInfo(r),i=0;i<15;i++){var a=!e&&1==(n>>i&1);i<6?this.modules[i][8]=a:i<8?this.modules[i+1][8]=a:this.modules[this.moduleCount-15+i][8]=a}for(i=0;i<15;i++){a=!e&&1==(n>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=a:i<9?this.modules[8][15-i-1+1]=a:this.modules[8][15-i-1]=a}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,a=0,o=this.moduleCount-1;o>0;o-=2)for(6==o&&o--;;){for(var s=0;s<2;s++)if(null==this.modules[n][o-s]){var u=!1;a<e.length&&(u=1==(e[a]>>>i&1)),v.getMask(t,n,o-s)&&(u=!u),this.modules[n][o-s]=u,-1==--i&&(a++,i=7)}if((n+=r)<0||this.moduleCount<=n){n-=r,r=-r;break}}}},r.PAD0=236,r.PAD1=17,r.createData=function(e,t,n){for(var i=b.getRSBlocks(e,t),a=new w,o=0;o<n.length;o++){var s=n[o];a.put(s.mode,4),a.put(s.getLength(),v.getLengthInBits(s.mode,e)),s.write(a)}var u=0;for(o=0;o<i.length;o++)u+=i[o].dataCount;if(a.getLengthInBits()>8*u)throw new Error("code length overflow. ("+a.getLengthInBits()+">"+8*u+")");for(a.getLengthInBits()+4<=8*u&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(!1);for(;!(a.getLengthInBits()>=8*u||(a.put(r.PAD0,8),a.getLengthInBits()>=8*u));)a.put(r.PAD1,8);return r.createBytes(a,i)},r.createBytes=function(e,t){for(var r=0,n=0,i=0,a=new Array(t.length),o=new Array(t.length),s=0;s<t.length;s++){var u=t[s].dataCount,c=t[s].totalCount-u;n=Math.max(n,u),i=Math.max(i,c),a[s]=new Array(u);for(var l=0;l<a[s].length;l++)a[s][l]=255&e.buffer[l+r];r+=u;var f=v.getErrorCorrectPolynomial(c),h=new m(a[s],f.getLength()-1).mod(f);o[s]=new Array(f.getLength()-1);for(l=0;l<o[s].length;l++){var A=l+h.getLength()-o[s].length;o[s][l]=A>=0?h.get(A):0}}var d=0;for(l=0;l<t.length;l++)d+=t[l].totalCount;var p=new Array(d),g=0;for(l=0;l<n;l++)for(s=0;s<t.length;s++)l<a[s].length&&(p[g++]=a[s][l]);for(l=0;l<i;l++)for(s=0;s<t.length;s++)l<o[s].length&&(p[g++]=o[s][l]);return p};for(var n={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},i=1,a=0,o=3,s=2,u=0,c=1,l=2,f=3,h=4,A=5,d=6,p=7,v={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;v.getBCHDigit(t)-v.getBCHDigit(v.G15)>=0;)t^=v.G15<<v.getBCHDigit(t)-v.getBCHDigit(v.G15);return(e<<10|t)^v.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;v.getBCHDigit(t)-v.getBCHDigit(v.G18)>=0;)t^=v.G18<<v.getBCHDigit(t)-v.getBCHDigit(v.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;0!=e;)t++,e>>>=1;return t},getPatternPosition:function(e){return v.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case u:return(t+r)%2==0;case c:return t%2==0;case l:return r%3==0;case f:return(t+r)%3==0;case h:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case A:return t*r%2+t*r%3==0;case d:return(t*r%2+t*r%3)%2==0;case p:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new m([1],0),r=0;r<e;r++)t=t.multiply(new m([1,g.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case n.MODE_NUMBER:return 10;case n.MODE_ALPHA_NUM:return 9;case n.MODE_8BIT_BYTE:case n.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case n.MODE_NUMBER:return 12;case n.MODE_ALPHA_NUM:return 11;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else{if(!(t<41))throw new Error("type:"+t);switch(e){case n.MODE_NUMBER:return 14;case n.MODE_ALPHA_NUM:return 13;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}}},getLostPoint:function(e){for(var t=e.getModuleCount(),r=0,n=0;n<t;n++)for(var i=0;i<t;i++){for(var a=0,o=e.isDark(n,i),s=-1;s<=1;s++)if(!(n+s<0||t<=n+s))for(var u=-1;u<=1;u++)i+u<0||t<=i+u||0==s&&0==u||o==e.isDark(n+s,i+u)&&a++;a>5&&(r+=3+a-5)}for(n=0;n<t-1;n++)for(i=0;i<t-1;i++){var c=0;e.isDark(n,i)&&c++,e.isDark(n+1,i)&&c++,e.isDark(n,i+1)&&c++,e.isDark(n+1,i+1)&&c++,0!=c&&4!=c||(r+=3)}for(n=0;n<t;n++)for(i=0;i<t-6;i++)e.isDark(n,i)&&!e.isDark(n,i+1)&&e.isDark(n,i+2)&&e.isDark(n,i+3)&&e.isDark(n,i+4)&&!e.isDark(n,i+5)&&e.isDark(n,i+6)&&(r+=40);for(i=0;i<t;i++)for(n=0;n<t-6;n++)e.isDark(n,i)&&!e.isDark(n+1,i)&&e.isDark(n+2,i)&&e.isDark(n+3,i)&&e.isDark(n+4,i)&&!e.isDark(n+5,i)&&e.isDark(n+6,i)&&(r+=40);var l=0;for(i=0;i<t;i++)for(n=0;n<t;n++)e.isDark(n,i)&&l++;return r+=10*(Math.abs(100*l/t/t-50)/5)}},g={glog:function(e){if(e<1)throw new Error("glog("+e+")");return g.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return g.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},y=0;y<8;y++)g.EXP_TABLE[y]=1<<y;for(y=8;y<256;y++)g.EXP_TABLE[y]=g.EXP_TABLE[y-4]^g.EXP_TABLE[y-5]^g.EXP_TABLE[y-6]^g.EXP_TABLE[y-8];for(y=0;y<255;y++)g.LOG_TABLE[g.EXP_TABLE[y]]=y;function m(e,t){if(null==e.length)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&0==e[r];)r++;this.num=new Array(e.length-r+t);for(var n=0;n<e.length-r;n++)this.num[n]=e[n+r]}function b(e,t){this.totalCount=e,this.dataCount=t}function w(){this.buffer=[],this.length=0}m.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<e.getLength();n++)t[r+n]^=g.gexp(g.glog(this.get(r))+g.glog(e.get(n)));return new m(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=g.glog(this.get(0))-g.glog(e.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(n=0;n<e.getLength();n++)r[n]^=g.gexp(g.glog(e.get(n))+t);return new m(r,0).mod(e)}},b.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],b.getRSBlocks=function(e,t){var r=b.getRsBlockTable(e,t);if(null==r)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var n=r.length/3,i=[],a=0;a<n;a++)for(var o=r[3*a+0],s=r[3*a+1],u=r[3*a+2],c=0;c<o;c++)i.push(new b(s,u));return i},b.getRsBlockTable=function(e,t){switch(t){case i:return b.RS_BLOCK_TABLE[4*(e-1)+0];case a:return b.RS_BLOCK_TABLE[4*(e-1)+1];case o:return b.RS_BLOCK_TABLE[4*(e-1)+2];case s:return b.RS_BLOCK_TABLE[4*(e-1)+3];default:return}},w.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var x=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function k(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M"},"string"==typeof e&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if("string"!=typeof this.options.content)throw new Error("Expected 'content' as string!");if(0===this.options.content.length)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0&&this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");var n=this.options.content,u=function(e,t){for(var r=function(e){var t=encodeURI(e).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=e?3:0)}(e),n=1,i=0,a=0,o=x.length;a<=o;a++){var s=x[a];if(!s)throw new Error("Content too long: expected "+i+" but got "+r);switch(t){case"L":i=s[0];break;case"M":i=s[1];break;case"Q":i=s[2];break;case"H":i=s[3];break;default:throw new Error("Unknwon error correction level: "+t)}if(r<=i)break;n++}if(n>x.length)throw new Error("Content too long");return n}(n,this.options.ecl),c=function(e){switch(e){case"L":return i;case"M":return a;case"Q":return o;case"H":return s;default:throw new Error("Unknwon error correction level: "+e)}}(this.options.ecl);this.qrcode=new r(u,c),this.qrcode.addData(n),this.qrcode.make()}k.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;void 0===e&&(e={container:t.container||"svg"});for(var n=void 0===t.pretty||!!t.pretty,i=n?" ":"",a=n?"\r\n":"",o=t.width,s=t.height,u=r.length,c=o/(u+2*t.padding),l=s/(u+2*t.padding),f=void 0!==t.join&&!!t.join,h=void 0!==t.swap&&!!t.swap,A=void 0===t.xmlDeclaration||!!t.xmlDeclaration,d=void 0!==t.predefined&&!!t.predefined,p=d?i+'<defs><path id="qrmodule" d="M0 0 h'+l+" v"+c+' H0 z" style="fill:'+t.color+';shape-rendering:crispEdges;" /></defs>'+a:"",v=i+'<rect x="0" y="0" width="'+o+'" height="'+s+'" style="fill:'+t.background+';shape-rendering:crispEdges;"/>'+a,g="",y="",m=0;m<u;m++)for(var b=0;b<u;b++){if(r[b][m]){var w=b*c+t.padding*c,x=m*l+t.padding*l;if(h){var k=w;w=x,x=k}if(f){var _=c+w,B=l+x;w=Number.isInteger(w)?Number(w):w.toFixed(2),x=Number.isInteger(x)?Number(x):x.toFixed(2),_=Number.isInteger(_)?Number(_):_.toFixed(2),y+="M"+w+","+x+" V"+(B=Number.isInteger(B)?Number(B):B.toFixed(2))+" H"+_+" V"+x+" H"+w+" Z "}else g+=d?i+'<use x="'+w.toString()+'" y="'+x.toString()+'" href="#qrmodule" />'+a:i+'<rect x="'+w.toString()+'" y="'+x.toString()+'" width="'+c+'" height="'+l+'" style="fill:'+t.color+';shape-rendering:crispEdges;"/>'+a}}f&&(g=i+'<path x="0" y="0" style="fill:'+t.color+';shape-rendering:crispEdges;" d="'+y+'" />');var E="";switch(e.container){case"svg":A&&(E+='<?xml version="1.0" standalone="yes"?>'+a),E+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+o+'" height="'+s+'">'+a,E+=p+v+g,E+="</svg>";break;case"svg-viewbox":A&&(E+='<?xml version="1.0" standalone="yes"?>'+a),E+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+o+" "+s+'">'+a,E+=p+v+g,E+="</svg>";break;case"g":E+='<g width="'+o+'" height="'+s+'">'+a,E+=p+v+g,E+="</g>";break;default:E+=(p+v+g).replace(/^\s+/,"")}return E},k.prototype.save=function(e,t){var r=this.svg();"function"!=typeof t&&(t=function(e,t){});try{require("fs").writeFile(e,r,t)}catch(e){t(e)}},e.exports=k}(ca);var la=ca.exports;const fa=e=>e?(e=>window.btoa(e))(new la(e).svg()):null;const ha={height:"0",overflow:"hidden"},Aa={padding:"20px","background-color":"#fff","font-family":"serif","text-align":"center",color:"#49555f","font-size":"12px","word-wrap":"break-word","min-height":"calc(100vh - 145px)","box-sizing":"border-box",margin:"0 auto","min-width":"600px","line-height":"initial",clipPath:"inset(0 100% 0 0)"},da={"max-width":"460px"},pa=async(e,t)=>{const r=Tt(t),n=va({...Aa,...ha,...r?da:{}});n.insertAdjacentHTML("beforeend",t);const i=((e,t)=>t?[e]:Array.from(e.querySelectorAll(":scope > div > div")))(n,r);for(const t of i){const r=Lt(t);e=await Ji({pdf:e,pageHTMLElement:t,width:r.width,height:r.height,margin:10})}return ga(n),e},va=e=>{const t=document.createElement("div");var r,n;return t.setAttribute("id","html2pdf-dom-container-identifier"),e&&(r=t,n=e,Object.keys(n).forEach((e=>{r.style[e]=n[e]}))),document.body.appendChild(t),t},ga=e=>{document.body.removeChild(e)},ya=async({contentType:e=null,contentEncoding:t="",content:r="",recipientName:n="",certificateTitle:i="",issueDate:a="",issuerName:o="",issuerLogo:s="",recordLink:u="",issuerPublicKey:c=[],issuerProfileUrl:l=[],issuerProfileDomain:f=[]})=>{const h=i;let A;const d=(e=>[Ct.IMAGE_GIF,Ct.IMAGE_BMP,Ct.IMAGE_PNG,Ct.IMAGE_JPEG].includes(e))(e),p=e===Ct.TEXT_HTML;if((p||d)&&(A=await(async(e,t,r,n,i,a,o,s,u)=>{const c=va(ha),l=fa(a),f=ua({certificateTitle:t,issueDate:r,issuerName:n,issuerLogo:i,issuerPublicKey:o,issuerPublicDomain:s,issuerPublicUrl:u,recipientName:e,qrCodeImage:l});c.appendChild(f);const h=await Ji({pageHTMLElement:f,width:595,height:842,margin:0});return ga(c),h})(n,i,a,o,s,u,c,f,l)),p)A=await pa(A,r);else if(d)A=await Xi(A,`data:${e};${t},${r}`);else{const n=function(e){return e===Ct.APPLICATION_PDF?"pdf":""}(Ct.APPLICATION_PDF);!function(e,t,r,n,i=""){const a=`data:${t};${r},${e}`,o=document.createElement("a"),s=[n];i&&s.push(i);const u=s.join(".");o.href=a,o.download=u,o.click()}(r,e,t,h,n)}!function(e,t){e.save(t)}(A,h)};var ma,ba,wa,xa=["seed"],ka=["publicKeyBase58","privateKeyBase58"],_a=["documentLoader"],Ba="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ea(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var Sa={},Ca="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Ia=[],Pa=[],Ta="undefined"!=typeof Uint8Array?Uint8Array:Array,Oa=!1;function La(){Oa=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)Ia[t]=e[t],Pa[e.charCodeAt(t)]=t;Pa["-".charCodeAt(0)]=62,Pa["_".charCodeAt(0)]=63}function Na(e,t,r){for(var n,i,a=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push(Ia[(i=n)>>18&63]+Ia[i>>12&63]+Ia[i>>6&63]+Ia[63&i]);return a.join("")}function Ma(e){var t;Oa||La();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,u=r-n;s<u;s+=o)a.push(Na(e,s,s+o>u?u:s+o));return 1===n?(t=e[r-1],i+=Ia[t>>2],i+=Ia[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=Ia[t>>10],i+=Ia[t>>4&63],i+=Ia[t<<2&63],i+="="),a.push(i),a.join("")}function Ua(e,t,r,n,i){var a,o,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,h=r?-1:1,A=e[t+f];for(f+=h,a=A&(1<<-l)-1,A>>=-l,l+=s;l>0;a=256*a+e[t+f],f+=h,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+e[t+f],f+=h,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(A?-1:1);o+=Math.pow(2,n),a-=c}return(A?-1:1)*o*Math.pow(2,a-n)}function Fa(e,t,r,n,i,a){var o,s,u,c=8*a-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:a-1,d=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=l?(s=0,o=l):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+A]=255&s,A+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+A]=255&o,A+=d,o/=256,c-=8);e[r+A-d]|=128*p}var Ra={}.toString,Da=Array.isArray||function(e){return"[object Array]"==Ra.call(e)};Ka.TYPED_ARRAY_SUPPORT=void 0===Ca.TYPED_ARRAY_SUPPORT||Ca.TYPED_ARRAY_SUPPORT;var ja=Qa();function Qa(){return Ka.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ha(e,t){if(Qa()<t)throw new RangeError("Invalid typed array length");return Ka.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Ka.prototype:(null===e&&(e=new Ka(t)),e.length=t),e}function Ka(e,t,r){if(!(Ka.TYPED_ARRAY_SUPPORT||this instanceof Ka))return new Ka(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return qa(this,e)}return Va(this,e,t,r)}function Va(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),Ka.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Ka.prototype:e=Ga(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!Ka.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Xa(t,r),i=(e=Ha(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(Ja(t)){var r=0|Wa(t.length);return 0===(e=Ha(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?Ha(e,0):Ga(e,t);if("Buffer"===t.type&&Da(t.data))return Ga(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function za(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function qa(e,t){if(za(t),e=Ha(e,t<0?0:0|Wa(t)),!Ka.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function Ga(e,t){var r=t.length<0?0:0|Wa(t.length);e=Ha(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function Wa(e){if(e>=Qa())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Qa().toString(16)+" bytes");return 0|e}function Ja(e){return!(null==e||!e._isBuffer)}function Xa(e,t){if(Ja(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return ko(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return _o(e).length;default:if(n)return ko(e).length;t=(""+t).toLowerCase(),n=!0}}function Ya(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return fo(this,t,r);case"utf8":case"utf-8":return uo(this,t,r);case"ascii":return co(this,t,r);case"latin1":case"binary":return lo(this,t,r);case"base64":return so(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ho(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function $a(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Za(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=Ka.from(t,n)),Ja(t))return 0===t.length?-1:eo(e,t,r,n,i);if("number"==typeof t)return t&=255,Ka.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):eo(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function eo(e,t,r,n,i){var a,o=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var l=-1;for(a=r;a<s;a++)if(c(e,a)===c(t,-1===l?0:a-l)){if(-1===l&&(l=a),a-l+1===u)return l*o}else-1!==l&&(a-=a-l),l=-1}else for(r+u>s&&(r=s-u),a=r;a>=0;a--){for(var f=!0,h=0;h<u;h++)if(c(e,a+h)!==c(t,h)){f=!1;break}if(f)return a}return-1}function to(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function ro(e,t,r,n){return Bo(ko(t,e.length-r),e,r,n)}function no(e,t,r,n){return Bo(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function io(e,t,r,n){return no(e,t,r,n)}function ao(e,t,r,n){return Bo(_o(t),e,r,n)}function oo(e,t,r,n){return Bo(function(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function so(e,t,r){return 0===t&&r===e.length?Ma(e):Ma(e.slice(t,r))}function uo(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&c)<<6|63&a)>127&&(l=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&c)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}function co(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function lo(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function fo(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=xo(e[a]);return i}function ho(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function Ao(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function po(e,t,r,n,i,a){if(!Ja(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function vo(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function go(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function yo(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function mo(e,t,r,n,i){return i||yo(e,0,r,4),Fa(e,t,r,n,23,4),r+4}function bo(e,t,r,n,i){return i||yo(e,0,r,8),Fa(e,t,r,n,52,8),r+8}Ka.poolSize=8192,Ka._augment=function(e){return e.__proto__=Ka.prototype,e},Ka.from=function(e,t,r){return Va(null,e,t,r)},Ka.TYPED_ARRAY_SUPPORT&&(Ka.prototype.__proto__=Uint8Array.prototype,Ka.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Ka[Symbol.species]),Ka.alloc=function(e,t,r){return function(e,t,r,n){return za(t),t<=0?Ha(e,t):void 0!==r?"string"==typeof n?Ha(e,t).fill(r,n):Ha(e,t).fill(r):Ha(e,t)}(null,e,t,r)},Ka.allocUnsafe=function(e){return qa(null,e)},Ka.allocUnsafeSlow=function(e){return qa(null,e)},Ka.isBuffer=Eo,Ka.compare=function(e,t){if(!Ja(e)||!Ja(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},Ka.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Ka.concat=function(e,t){if(!Da(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Ka.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=Ka.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!Ja(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},Ka.byteLength=Xa,Ka.prototype._isBuffer=!0,Ka.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)$a(this,t,t+1);return this},Ka.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)$a(this,t,t+3),$a(this,t+1,t+2);return this},Ka.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)$a(this,t,t+7),$a(this,t+1,t+6),$a(this,t+2,t+5),$a(this,t+3,t+4);return this},Ka.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?uo(this,0,e):Ya.apply(this,arguments)},Ka.prototype.equals=function(e){if(!Ja(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Ka.compare(this,e)},Ka.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Ka.prototype.compare=function(e,t,r,n,i){if(!Ja(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),u=this.slice(n,i),c=e.slice(t,r),l=0;l<s;++l)if(u[l]!==c[l]){a=u[l],o=c[l];break}return a<o?-1:o<a?1:0},Ka.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Ka.prototype.indexOf=function(e,t,r){return Za(this,e,t,r,!0)},Ka.prototype.lastIndexOf=function(e,t,r){return Za(this,e,t,r,!1)},Ka.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return to(this,e,t,r);case"utf8":case"utf-8":return ro(this,e,t,r);case"ascii":return no(this,e,t,r);case"latin1":case"binary":return io(this,e,t,r);case"base64":return ao(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oo(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},Ka.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},Ka.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Ka.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Ka.prototype;else{var i=t-e;r=new Ka(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},Ka.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Ao(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},Ka.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Ao(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Ka.prototype.readUInt8=function(e,t){return t||Ao(e,1,this.length),this[e]},Ka.prototype.readUInt16LE=function(e,t){return t||Ao(e,2,this.length),this[e]|this[e+1]<<8},Ka.prototype.readUInt16BE=function(e,t){return t||Ao(e,2,this.length),this[e]<<8|this[e+1]},Ka.prototype.readUInt32LE=function(e,t){return t||Ao(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Ka.prototype.readUInt32BE=function(e,t){return t||Ao(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Ka.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Ao(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Ka.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Ao(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},Ka.prototype.readInt8=function(e,t){return t||Ao(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Ka.prototype.readInt16LE=function(e,t){t||Ao(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Ka.prototype.readInt16BE=function(e,t){t||Ao(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Ka.prototype.readInt32LE=function(e,t){return t||Ao(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Ka.prototype.readInt32BE=function(e,t){return t||Ao(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Ka.prototype.readFloatLE=function(e,t){return t||Ao(e,4,this.length),Ua(this,e,!0,23,4)},Ka.prototype.readFloatBE=function(e,t){return t||Ao(e,4,this.length),Ua(this,e,!1,23,4)},Ka.prototype.readDoubleLE=function(e,t){return t||Ao(e,8,this.length),Ua(this,e,!0,52,8)},Ka.prototype.readDoubleBE=function(e,t){return t||Ao(e,8,this.length),Ua(this,e,!1,52,8)},Ka.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||po(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},Ka.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||po(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},Ka.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,1,255,0),Ka.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Ka.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,2,65535,0),Ka.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):vo(this,e,t,!0),t+2},Ka.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,2,65535,0),Ka.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):vo(this,e,t,!1),t+2},Ka.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,4,4294967295,0),Ka.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):go(this,e,t,!0),t+4},Ka.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,4,4294967295,0),Ka.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):go(this,e,t,!1),t+4},Ka.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);po(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Ka.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);po(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Ka.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,1,127,-128),Ka.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Ka.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,2,32767,-32768),Ka.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):vo(this,e,t,!0),t+2},Ka.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,2,32767,-32768),Ka.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):vo(this,e,t,!1),t+2},Ka.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,4,2147483647,-2147483648),Ka.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):go(this,e,t,!0),t+4},Ka.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Ka.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):go(this,e,t,!1),t+4},Ka.prototype.writeFloatLE=function(e,t,r){return mo(this,e,t,!0,r)},Ka.prototype.writeFloatBE=function(e,t,r){return mo(this,e,t,!1,r)},Ka.prototype.writeDoubleLE=function(e,t,r){return bo(this,e,t,!0,r)},Ka.prototype.writeDoubleBE=function(e,t,r){return bo(this,e,t,!1,r)},Ka.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!Ka.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},Ka.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Ka.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=Ja(e)?e:ko(new Ka(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var wo=/[^+\/0-9A-Za-z-_]/g;function xo(e){return e<16?"0"+e.toString(16):e.toString(16)}function ko(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function _o(e){return function(e){var t,r,n,i,a,o;Oa||La();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new Ta(3*s/4-a),n=a>0?s-4:s;var u=0;for(t=0,r=0;t<n;t+=4,r+=3)i=Pa[e.charCodeAt(t)]<<18|Pa[e.charCodeAt(t+1)]<<12|Pa[e.charCodeAt(t+2)]<<6|Pa[e.charCodeAt(t+3)],o[u++]=i>>16&255,o[u++]=i>>8&255,o[u++]=255&i;return 2===a?(i=Pa[e.charCodeAt(t)]<<2|Pa[e.charCodeAt(t+1)]>>4,o[u++]=255&i):1===a&&(i=Pa[e.charCodeAt(t)]<<10|Pa[e.charCodeAt(t+1)]<<4|Pa[e.charCodeAt(t+2)]>>2,o[u++]=i>>8&255,o[u++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(wo,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Bo(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Eo(e){return null!=e&&(!!e._isBuffer||So(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&So(e.slice(0,0))}(e))}function So(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Co=Ea(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:ja,Buffer:Ka,SlowBuffer:function(e){return+e!=e&&(e=0),Ka.alloc(+e)},isBuffer:Eo})),Io={/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */read:function(e,t,r,n,i){var a,o,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,h=r?-1:1,A=e[t+f];for(f+=h,a=A&(1<<-l)-1,A>>=-l,l+=s;l>0;a=256*a+e[t+f],f+=h,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+e[t+f],f+=h,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(A?-1:1);o+=Math.pow(2,n),a-=c}return(A?-1:1)*o*Math.pow(2,a-n)},write:function(e,t,r,n,i,a){var o,s,u,c=8*a-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:a-1,d=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=l?(s=0,o=l):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+A]=255&s,A+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+A]=255&o,A+=d,o/=256,c-=8);e[r+A-d]|=128*p}},Po={exports:{}};!function(e){!function(t){var r,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,o=Math.floor,s="[BigNumber Error] ",u=s+"Number primitive has more than 15 significant digits: ",c=1e14,l=14,f=9007199254740991,h=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],A=1e7,d=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,a=e[0]+"";n<i;){for(t=e[n++]+"",r=l-t.length;r--;t="0"+t);a+=t}for(i=a.length;48===a.charCodeAt(--i););return a.slice(0,i+1||1)}function g(e,t){var r,n,i=e.c,a=t.c,o=e.s,s=t.s,u=e.e,c=t.e;if(!o||!s)return null;if(r=i&&!i[0],n=a&&!a[0],r||n)return r?n?0:-s:o;if(o!=s)return o;if(r=o<0,n=u==c,!i||!a)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(s=(u=i.length)<(c=a.length)?u:c,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^r?1:-1;return u==c?0:u>c^r?1:-1}function y(e,t,r,n){if(e<t||e>r||e!==o(e))throw Error(s+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function m(e){var t=e.c.length-1;return p(e.e/l)==t&&e.c[t]%2!=0}function b(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function w(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}r=function e(t){var r,x,k,_,B,E,S,C,I,P,T=z.prototype={constructor:z,toString:null,valueOf:null},O=new z(1),L=20,N=4,M=-7,U=21,F=-1e7,R=1e7,D=!1,j=1,Q=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",V=!0;function z(e,t){var r,i,a,s,c,h,A,d,p=this;if(!(p instanceof z))return new z(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>R?p.c=p.e=null:e.e<F?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,c=e;c>=10;c/=10,s++);return void(s>R?p.c=p.e=null:(p.e=s,p.c=[e]))}d=String(e)}else{if(!n.test(d=String(e)))return k(p,d,h);p.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(s=d.indexOf("."))>-1&&(d=d.replace(".","")),(c=d.search(/e/i))>0?(s<0&&(s=c),s+=+d.slice(c+1),d=d.substring(0,c)):s<0&&(s=d.length)}else{if(y(t,2,K.length,"Base"),10==t&&V)return J(p=new z(e),L+p.e+1,N);if(d=String(e),h="number"==typeof e){if(0*e!=0)return k(p,d,h,t);if(p.s=1/e<0?(d=d.slice(1),-1):1,z.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(u+e)}else p.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(r=K.slice(0,t),s=c=0,A=d.length;c<A;c++)if(r.indexOf(i=d.charAt(c))<0){if("."==i){if(c>s){s=A;continue}}else if(!a&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){a=!0,c=-1,s=0;continue}return k(p,String(e),h,t)}h=!1,(s=(d=x(d,t,10,p.s)).indexOf("."))>-1?d=d.replace(".",""):s=d.length}for(c=0;48===d.charCodeAt(c);c++);for(A=d.length;48===d.charCodeAt(--A););if(d=d.slice(c,++A)){if(A-=c,h&&z.DEBUG&&A>15&&(e>f||e!==o(e)))throw Error(u+p.s*e);if((s=s-c-1)>R)p.c=p.e=null;else if(s<F)p.c=[p.e=0];else{if(p.e=s,p.c=[],c=(s+1)%l,s<0&&(c+=l),c<A){for(c&&p.c.push(+d.slice(0,c)),A-=l;c<A;)p.c.push(+d.slice(c,c+=l));c=l-(d=d.slice(c)).length}else c-=A;for(;c--;d+="0");p.c.push(+d)}}else p.c=[p.e=0]}function q(e,t,r,n){var i,a,o,s,u;if(null==r?r=N:y(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)u=v(e.c),u=1==n||2==n&&(o<=M||o>=U)?b(u,o):w(u,o,"0");else if(a=(e=J(new z(e),t,r)).e,s=(u=v(e.c)).length,1==n||2==n&&(t<=a||a<=M)){for(;s<t;u+="0",s++);u=b(u,a)}else if(t-=o,u=w(u,a,"0"),a+1>s){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=a-s)>0)for(a+1==s&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function G(e,t){for(var r,n=1,i=new z(e[0]);n<e.length;n++){if(!(r=new z(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function W(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*l-1)>R?e.c=e.e=null:r<F?e.c=[e.e=0]:(e.e=r,e.c=t),e}function J(e,t,r,n){var i,s,u,f,A,d,p,v=e.c,g=h;if(v){e:{for(i=1,f=v[0];f>=10;f/=10,i++);if((s=t-i)<0)s+=l,u=t,p=(A=v[d=0])/g[i-u-1]%10|0;else if((d=a((s+1)/l))>=v.length){if(!n)break e;for(;v.length<=d;v.push(0));A=p=0,i=1,u=(s%=l)-l+1}else{for(A=f=v[d],i=1;f>=10;f/=10,i++);p=(u=(s%=l)-l+i)<0?0:A/g[i-u-1]%10|0}if(n=n||t<0||null!=v[d+1]||(u<0?A:A%g[i-u-1]),n=r<4?(p||n)&&(0==r||r==(e.s<0?3:2)):p>5||5==p&&(4==r||n||6==r&&(s>0?u>0?A/g[i-u]:0:v[d-1])%10&1||r==(e.s<0?8:7)),t<1||!v[0])return v.length=0,n?(t-=e.e+1,v[0]=g[(l-t%l)%l],e.e=-t||0):v[0]=e.e=0,e;if(0==s?(v.length=d,f=1,d--):(v.length=d+1,f=g[l-s],v[d]=u>0?o(A/g[i-u]%g[u])*f:0),n)for(;;){if(0==d){for(s=1,u=v[0];u>=10;u/=10,s++);for(u=v[0]+=f,f=1;u>=10;u/=10,f++);s!=f&&(e.e++,v[0]==c&&(v[0]=1));break}if(v[d]+=f,v[d]!=c)break;v[d--]=0,f=1}for(s=v.length;0===v[--s];v.pop());}e.e>R?e.c=e.e=null:e.e<F&&(e.c=[e.e=0])}return e}function X(e){var t,r=e.e;return null===r?e.toString():(t=v(e.c),t=r<=M||r>=U?b(t,r):w(t,r,"0"),e.s<0?"-"+t:t)}return z.clone=e,z.ROUND_UP=0,z.ROUND_DOWN=1,z.ROUND_CEIL=2,z.ROUND_FLOOR=3,z.ROUND_HALF_UP=4,z.ROUND_HALF_DOWN=5,z.ROUND_HALF_EVEN=6,z.ROUND_HALF_CEIL=7,z.ROUND_HALF_FLOOR=8,z.EUCLID=9,z.config=z.set=function(e){var t,r;if(null!=e){if("object"!=i(e))throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(r=e[t],0,d,t),L=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(r=e[t],0,8,t),N=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(y(r[0],-d,0,t),y(r[1],0,d,t),M=r[0],U=r[1]):(y(r,-d,d,t),M=-(U=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)y(r[0],-d,-1,t),y(r[1],1,d,t),F=r[0],R=r[1];else{if(y(r,-d,d,t),!r)throw Error(s+t+" cannot be zero: "+r);F=-(R=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(s+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!r,Error(s+"crypto unavailable");D=r}else D=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(r=e[t],0,9,t),j=r),e.hasOwnProperty(t="POW_PRECISION")&&(y(r=e[t],0,d,t),Q=r),e.hasOwnProperty(t="FORMAT")){if("object"!=i(r=e[t]))throw Error(s+t+" not an object: "+r);H=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);V="0123456789"==r.slice(0,10),K=r}}return{DECIMAL_PLACES:L,ROUNDING_MODE:N,EXPONENTIAL_AT:[M,U],RANGE:[F,R],CRYPTO:D,MODULO_MODE:j,POW_PRECISION:Q,FORMAT:H,ALPHABET:K}},z.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!z.DEBUG)return!0;var t,r,n=e.c,i=e.e,a=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===a||-1===a)&&i>=-d&&i<=d&&i===o(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%l)<1&&(t+=l),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=c||r!==o(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===a||1===a||-1===a))return!0;throw Error(s+"Invalid BigNumber: "+e)},z.maximum=z.max=function(){return G(arguments,T.lt)},z.minimum=z.min=function(){return G(arguments,T.gt)},z.random=(_=9007199254740992,B=Math.random()*_&2097151?function(){return o(Math.random()*_)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,u,c=0,f=[],A=new z(O);if(null==e?e=L:y(e,0,d),i=a(e/l),D)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));c<i;)(u=131072*t[c]+(t[c+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[c]=r[0],t[c+1]=r[1]):(f.push(u%1e14),c+=2);c=i/2}else{if(!crypto.randomBytes)throw D=!1,Error(s+"crypto unavailable");for(t=crypto.randomBytes(i*=7);c<i;)(u=281474976710656*(31&t[c])+1099511627776*t[c+1]+4294967296*t[c+2]+16777216*t[c+3]+(t[c+4]<<16)+(t[c+5]<<8)+t[c+6])>=9e15?crypto.randomBytes(7).copy(t,c):(f.push(u%1e14),c+=7);c=i/7}if(!D)for(;c<i;)(u=B())<9e15&&(f[c++]=u%1e14);for(i=f[--c],e%=l,i&&e&&(u=h[l-e],f[c]=o(i/u)*u);0===f[c];f.pop(),c--);if(c<0)f=[n=0];else{for(n=-1;0===f[0];f.splice(0,1),n-=l);for(c=1,u=f[0];u>=10;u/=10,c++);c<l&&(n-=l-c)}return A.e=n,A.c=f,A}),z.sum=function(){for(var e=1,t=arguments,r=new z(t[0]);e<t.length;)r=r.plus(t[e++]);return r},x=function(){var e="0123456789";function t(e,t,r,n){for(var i,a,o=[0],s=0,u=e.length;s<u;){for(a=o.length;a--;o[a]*=t);for(o[0]+=n.indexOf(e.charAt(s++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(n,i,a,o,s){var u,c,l,f,h,A,d,p,g=n.indexOf("."),y=L,m=N;for(g>=0&&(f=Q,Q=0,n=n.replace(".",""),A=(p=new z(i)).pow(n.length-g),Q=f,p.c=t(w(v(A.c),A.e,"0"),10,a,e),p.e=p.c.length),l=f=(d=t(n,i,a,s?(u=K,e):(u=e,K))).length;0==d[--f];d.pop());if(!d[0])return u.charAt(0);if(g<0?--l:(A.c=d,A.e=l,A.s=o,d=(A=r(A,p,y,m,a)).c,h=A.r,l=A.e),g=d[c=l+y+1],f=a/2,h=h||c<0||null!=d[c+1],h=m<4?(null!=g||h)&&(0==m||m==(A.s<0?3:2)):g>f||g==f&&(4==m||h||6==m&&1&d[c-1]||m==(A.s<0?8:7)),c<1||!d[0])n=h?w(u.charAt(1),-y,u.charAt(0)):u.charAt(0);else{if(d.length=c,h)for(--a;++d[--c]>a;)d[c]=0,c||(++l,d=[1].concat(d));for(f=d.length;!d[--f];);for(g=0,n="";g<=f;n+=u.charAt(d[g++]));n=w(n,l,u.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,a,o,s=0,u=e.length,c=t%A,l=t/A|0;for(e=e.slice();u--;)s=((i=c*(a=e[u]%A)+(n=l*a+(o=e[u]/A|0)*c)%A*A+s)/r|0)+(n/A|0)+l*o,e[u]=i%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,a,s,u){var f,h,A,d,v,g,y,m,b,w,x,k,_,B,E,S,C,I=n.s==i.s?1:-1,P=n.c,T=i.c;if(!(P&&P[0]&&T&&T[0]))return new z(n.s&&i.s&&(P?!T||P[0]!=T[0]:T)?P&&0==P[0]||!T?0*I:I/0:NaN);for(b=(m=new z(I)).c=[],I=a+(h=n.e-i.e)+1,u||(u=c,h=p(n.e/l)-p(i.e/l),I=I/l|0),A=0;T[A]==(P[A]||0);A++);if(T[A]>(P[A]||0)&&h--,I<0)b.push(1),d=!0;else{for(B=P.length,S=T.length,A=0,I+=2,(v=o(u/(T[0]+1)))>1&&(T=e(T,v,u),P=e(P,v,u),S=T.length,B=P.length),_=S,x=(w=P.slice(0,S)).length;x<S;w[x++]=0);C=T.slice(),C=[0].concat(C),E=T[0],T[1]>=u/2&&E++;do{if(v=0,(f=t(T,w,S,x))<0){if(k=w[0],S!=x&&(k=k*u+(w[1]||0)),(v=o(k/E))>1)for(v>=u&&(v=u-1),y=(g=e(T,v,u)).length,x=w.length;1==t(g,w,y,x);)v--,r(g,S<y?C:T,y,u),y=g.length,f=1;else 0==v&&(f=v=1),y=(g=T.slice()).length;if(y<x&&(g=[0].concat(g)),r(w,g,x,u),x=w.length,-1==f)for(;t(T,w,S,x)<1;)v++,r(w,S<x?C:T,x,u),x=w.length}else 0===f&&(v++,w=[0]);b[A++]=v,w[0]?w[x++]=P[_]||0:(w=[P[_]],x=1)}while((_++<B||null!=w[0])&&I--);d=null!=w[0],b[0]||b.splice(0,1)}if(u==c){for(A=1,I=b[0];I>=10;I/=10,A++);J(m,a+(m.e=A+h*l-1)+1,s,d)}else m.e=h,m.r=+d;return m}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,C=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g,k=function(e,t,r,n){var i,a=r?t:t.replace(P,"");if(I.test(a))e.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(E,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,a=a.replace(S,"$1").replace(C,"0.$1")),t!=a))return new z(a,i);if(z.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},T.absoluteValue=T.abs=function(){var e=new z(this);return e.s<0&&(e.s=1),e},T.comparedTo=function(e,t){return g(this,new z(e,t))},T.decimalPlaces=T.dp=function(e,t){var r,n,i,a=this;if(null!=e)return y(e,0,d),null==t?t=N:y(t,0,8),J(new z(a),e+a.e+1,t);if(!(r=a.c))return null;if(n=((i=r.length-1)-p(this.e/l))*l,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},T.dividedBy=T.div=function(e,t){return r(this,new z(e,t),L,N)},T.dividedToIntegerBy=T.idiv=function(e,t){return r(this,new z(e,t),0,1)},T.exponentiatedBy=T.pow=function(e,t){var r,n,i,u,c,f,h,A,d=this;if((e=new z(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+X(e));if(null!=t&&(t=new z(t)),c=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return A=new z(Math.pow(+X(d),c?2-m(e):+X(e))),t?A.mod(t):A;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new z(NaN);(n=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||c&&d.c[1]>=24e7:d.c[0]<8e13||c&&d.c[0]<=9999975e7)))return u=d.s<0&&m(e)?-0:0,d.e>-1&&(u=1/u),new z(f?1/u:u);Q&&(u=a(Q/l+2))}for(c?(r=new z(.5),f&&(e.s=1),h=m(e)):h=(i=Math.abs(+X(e)))%2,A=new z(O);;){if(h){if(!(A=A.times(d)).c)break;u?A.c.length>u&&(A.c.length=u):n&&(A=A.mod(t))}if(i){if(0===(i=o(i/2)))break;h=i%2}else if(J(e=e.times(r),e.e+1,1),e.e>14)h=m(e);else{if(0==(i=+X(e)))break;h=i%2}d=d.times(d),u?d.c&&d.c.length>u&&(d.c.length=u):n&&(d=d.mod(t))}return n?A:(f&&(A=O.div(A)),t?A.mod(t):u?J(A,Q,N,void 0):A)},T.integerValue=function(e){var t=new z(this);return null==e?e=N:y(e,0,8),J(t,t.e+1,e)},T.isEqualTo=T.eq=function(e,t){return 0===g(this,new z(e,t))},T.isFinite=function(){return!!this.c},T.isGreaterThan=T.gt=function(e,t){return g(this,new z(e,t))>0},T.isGreaterThanOrEqualTo=T.gte=function(e,t){return 1===(t=g(this,new z(e,t)))||0===t},T.isInteger=function(){return!!this.c&&p(this.e/l)>this.c.length-2},T.isLessThan=T.lt=function(e,t){return g(this,new z(e,t))<0},T.isLessThanOrEqualTo=T.lte=function(e,t){return-1===(t=g(this,new z(e,t)))||0===t},T.isNaN=function(){return!this.s},T.isNegative=function(){return this.s<0},T.isPositive=function(){return this.s>0},T.isZero=function(){return!!this.c&&0==this.c[0]},T.minus=function(e,t){var r,n,i,a,o=this,s=o.s;if(t=(e=new z(e,t)).s,!s||!t)return new z(NaN);if(s!=t)return e.s=-t,o.plus(e);var u=o.e/l,f=e.e/l,h=o.c,A=e.c;if(!u||!f){if(!h||!A)return h?(e.s=-t,e):new z(A?o:NaN);if(!h[0]||!A[0])return A[0]?(e.s=-t,e):new z(h[0]?o:3==N?-0:0)}if(u=p(u),f=p(f),h=h.slice(),s=u-f){for((a=s<0)?(s=-s,i=h):(f=u,i=A),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(a=(s=h.length)<(t=A.length))?s:t,s=t=0;t<n;t++)if(h[t]!=A[t]){a=h[t]<A[t];break}if(a&&(i=h,h=A,A=i,e.s=-e.s),(t=(n=A.length)-(r=h.length))>0)for(;t--;h[r++]=0);for(t=c-1;n>s;){if(h[--n]<A[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r],h[n]+=c}h[n]-=A[n]}for(;0==h[0];h.splice(0,1),--f);return h[0]?W(e,h,f):(e.s=3==N?-1:1,e.c=[e.e=0],e)},T.modulo=T.mod=function(e,t){var n,i,a=this;return e=new z(e,t),!a.c||!e.s||e.c&&!e.c[0]?new z(NaN):!e.c||a.c&&!a.c[0]?new z(a):(9==j?(i=e.s,e.s=1,n=r(a,e,0,3),e.s=i,n.s*=i):n=r(a,e,0,j),(e=a.minus(n.times(e))).c[0]||1!=j||(e.s=a.s),e)},T.multipliedBy=T.times=function(e,t){var r,n,i,a,o,s,u,f,h,d,v,g,y,m,b,w=this,x=w.c,k=(e=new z(e,t)).c;if(!(x&&k&&x[0]&&k[0]))return!w.s||!e.s||x&&!x[0]&&!k||k&&!k[0]&&!x?e.c=e.e=e.s=null:(e.s*=w.s,x&&k?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(w.e/l)+p(e.e/l),e.s*=w.s,(u=x.length)<(d=k.length)&&(y=x,x=k,k=y,i=u,u=d,d=i),i=u+d,y=[];i--;y.push(0));for(m=c,b=A,i=d;--i>=0;){for(r=0,v=k[i]%b,g=k[i]/b|0,a=i+(o=u);a>i;)r=((f=v*(f=x[--o]%b)+(s=g*f+(h=x[o]/b|0)*v)%b*b+y[a]+r)/m|0)+(s/b|0)+g*h,y[a--]=f%m;y[a]=r}return r?++n:y.splice(0,1),W(e,y,n)},T.negated=function(){var e=new z(this);return e.s=-e.s||null,e},T.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new z(e,t)).s,!i||!t)return new z(NaN);if(i!=t)return e.s=-t,n.minus(e);var a=n.e/l,o=e.e/l,s=n.c,u=e.c;if(!a||!o){if(!s||!u)return new z(i/0);if(!s[0]||!u[0])return u[0]?e:new z(s[0]?n:0*i)}if(a=p(a),o=p(o),s=s.slice(),i=a-o){for(i>0?(o=a,r=u):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=u.length)<0&&(r=u,u=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+u[t]+i)/c|0,s[t]=c===s[t]?0:s[t]%c;return i&&(s=[i].concat(s),++o),W(e,s,o)},T.precision=T.sd=function(e,t){var r,n,i,a=this;if(null!=e&&e!==!!e)return y(e,1,d),null==t?t=N:y(t,0,8),J(new z(a),e,t);if(!(r=a.c))return null;if(n=(i=r.length-1)*l+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&a.e+1>n&&(n=a.e+1),n},T.shiftedBy=function(e){return y(e,-9007199254740991,f),this.times("1e"+e)},T.squareRoot=T.sqrt=function(){var e,t,n,i,a,o=this,s=o.c,u=o.s,c=o.e,l=L+4,f=new z("0.5");if(1!==u||!s||!s[0])return new z(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);if(0==(u=Math.sqrt(+X(o)))||u==1/0?(((t=v(s)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=p((c+1)/2)-(c<0||c%2),n=new z(t=u==1/0?"5e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new z(u+""),n.c[0])for((u=(c=n.e)+l)<3&&(u=0);;)if(a=n,n=f.times(a.plus(r(o,a,l,1))),v(a.c).slice(0,u)===(t=v(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(J(n,n.e+L+2,1),e=!n.times(n).eq(o));break}if(!i&&(J(a,a.e+L+2,0),a.times(a).eq(o))){n=a;break}l+=4,u+=4,i=1}return J(n,n.e+L+1,N,e)},T.toExponential=function(e,t){return null!=e&&(y(e,0,d),e++),q(this,e,t,1)},T.toFixed=function(e,t){return null!=e&&(y(e,0,d),e=e+this.e+1),q(this,e,t)},T.toFormat=function(e,t,r){var n,a=this;if(null==r)null!=e&&t&&"object"==i(t)?(r=t,t=null):e&&"object"==i(e)?(r=e,e=t=null):r=H;else if("object"!=i(r))throw Error(s+"Argument not an object: "+r);if(n=a.toFixed(e,t),a.c){var o,u=n.split("."),c=+r.groupSize,l=+r.secondaryGroupSize,f=r.groupSeparator||"",h=u[0],A=u[1],d=a.s<0,p=d?h.slice(1):h,v=p.length;if(l&&(o=c,c=l,l=o,v-=o),c>0&&v>0){for(o=v%c||c,h=p.substr(0,o);o<v;o+=c)h+=f+p.substr(o,c);l>0&&(h+=f+p.slice(o)),d&&(h="-"+h)}n=A?h+(r.decimalSeparator||"")+((l=+r.fractionGroupSize)?A.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):A):h}return(r.prefix||"")+n+(r.suffix||"")},T.toFraction=function(e){var t,n,i,a,o,u,c,f,A,d,p,g,y=this,m=y.c;if(null!=e&&(!(c=new z(e)).isInteger()&&(c.c||1!==c.s)||c.lt(O)))throw Error(s+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+X(c));if(!m)return new z(y);for(t=new z(O),A=n=new z(O),i=f=new z(O),g=v(m),o=t.e=g.length-y.e-1,t.c[0]=h[(u=o%l)<0?l+u:u],e=!e||c.comparedTo(t)>0?o>0?t:A:c,u=R,R=1/0,c=new z(g),f.c[0]=0;d=r(c,t,0,1),1!=(a=n.plus(d.times(i))).comparedTo(e);)n=i,i=a,A=f.plus(d.times(a=A)),f=a,t=c.minus(d.times(a=t)),c=a;return a=r(e.minus(n),i,0,1),f=f.plus(a.times(A)),n=n.plus(a.times(i)),f.s=A.s=y.s,p=r(A,i,o*=2,N).minus(y).abs().comparedTo(r(f,n,o,N).minus(y).abs())<1?[A,i]:[f,n],R=u,p},T.toNumber=function(){return+X(this)},T.toPrecision=function(e,t){return null!=e&&y(e,1,d),q(this,e,t,2)},T.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=M||i>=U?b(v(r.c),i):w(v(r.c),i,"0"):10===e&&V?t=w(v((r=J(new z(r),L+i+1,N)).c),r.e,"0"):(y(e,2,K.length,"Base"),t=x(w(v(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},T.valueOf=T.toJSON=function(){return X(this)},T._isBigNumber=!0,null!=t&&z.set(t),z}(),r.default=r.BigNumber=r,e.exports?e.exports=r:(t||(t="undefined"!=typeof self&&self?self:window),t.BigNumber=r)}(Ba)}(Po);var To={},Oo={},Lo=Po.exports.BigNumber;Oo.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},Oo.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},Oo.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},Oo.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},Oo.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},Oo.SHIFT32=Math.pow(2,32),Oo.SHIFT16=Math.pow(2,16),Oo.MAX_SAFE_HIGH=2097151,Oo.NEG_ONE=new Lo(-1),Oo.TEN=new Lo(10),Oo.TWO=new Lo(2),Oo.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5},function(e){var t=Co.Buffer,r=Po.exports.BigNumber,n=Oo,i=n.SHIFT32,a=n.SHIFT16;function o(e){return e<16?"0"+e.toString(16):e.toString(16)}e.parseHalf=function(e){var t,r,n;return n=128&e[0]?-1:1,t=(124&e[0])>>2,r=(3&e[0])<<8|e[1],t?31===t?n*(r?NaN:1/0):n*Math.pow(2,t-25)*(1024+r):5.960464477539063e-8*n*r},e.arrayBufferToBignumber=function(e){for(var t=e.byteLength,n="",i=0;i<t;i++)n+=o(e[i]);return new r(n,16)},e.buildMap=function(e){for(var t=new Map,r=Object.keys(e),n=r.length,i=0;i<n;i++)t.set(r[i],e[r[i]]);return t},e.buildInt32=function(e,t){return e*a+t},e.buildInt64=function(t,n,a,o){var s=e.buildInt32(t,n),u=e.buildInt32(a,o);return s>2097151?new r(s).times(i).plus(u):s*i+u},e.writeHalf=function(e,r){var n=t.allocUnsafe(4);n.writeFloatBE(r,0);var i=n.readUInt32BE(0);if(0!=(8191&i))return!1;var a=i>>16&32768,o=i>>23&255,s=8388607&i;if(o>=113&&o<=142)a+=(o-112<<10)+(s>>13);else{if(!(o>=103&&o<113))return!1;if(s&(1<<126-o)-1)return!1;a+=s+8388608>>126-o}return e.writeUInt16BE(a,0),!0},e.keySorter=function(e,t){var r=e[0].byteLength,n=t[0].byteLength;return r>n?1:n>r?-1:e[0].compare(t[0])},e.isNegativeZero=function(e){return 0===e&&1/e<0},e.nextPowerOf2=function(e){var t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<<t}}(To);var No=Oo,Mo=No.MT,Uo=No.SIMPLE,Fo=No.SYMS,Ro=function(){function e(t){if(s(this,e),"number"!=typeof t)throw new Error("Invalid Simple type: "+i(t));if(t<0||t>255||(0|t)!==t)throw new Error("value must be a small positive integer: "+t);this.value=t}return c(e,[{key:"toString",value:function(){return"simple("+this.value+")"}},{key:"inspect",value:function(){return"simple("+this.value+")"}},{key:"encodeCBOR",value:function(e){return e._pushInt(this.value,Mo.SIMPLE_FLOAT)}}],[{key:"isSimple",value:function(t){return t instanceof e}},{key:"decode",value:function(t,r){switch(null==r&&(r=!0),t){case Uo.FALSE:return!1;case Uo.TRUE:return!0;case Uo.NULL:return r?null:Fo.NULL;case Uo.UNDEFINED:return r?void 0:Fo.UNDEFINED;case-1:if(!r)throw new Error("Invalid BREAK");return Fo.BREAK;default:return new e(t)}}}]),e}(),Do=Ro,jo=function(){function e(t,r,n){if(s(this,e),this.tag=t,this.value=r,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+i(this.tag)+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}return c(e,[{key:"toString",value:function(){return"".concat(this.tag,"(").concat(JSON.stringify(this.value),")")}},{key:"encodeCBOR",value:function(e){return e._pushTag(this.tag),e.pushAny(this.value)}},{key:"convert",value:function(t){var r,n;if("function"!=typeof(n=null!=t?t[this.tag]:void 0)&&"function"!=typeof(n=e["_tag"+this.tag]))return this;try{return n.call(e,this.value)}catch(t){return r=t,this.err=r,this}}}]),e}(),Qo=jo,Ho=self.location?self.location.protocol+"//"+self.location.host:"",Ko=self.URL,Vo={URLWithLegacySupport:function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ho;s(this,e),this.super=new Ko(t,r),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}return c(e,[{key:"hash",get:function(){return this.super.hash},set:function(e){this.super.hash=e}},{key:"host",get:function(){return this.super.host},set:function(e){this.super.host=e}},{key:"hostname",get:function(){return this.super.hostname},set:function(e){this.super.hostname=e}},{key:"href",get:function(){return this.super.href},set:function(e){this.super.href=e}},{key:"origin",get:function(){return this.super.origin},set:function(e){this.super.origin=e}},{key:"password",get:function(){return this.super.password},set:function(e){this.super.password=e}},{key:"pathname",get:function(){return this.super.pathname},set:function(e){this.super.pathname=e}},{key:"port",get:function(){return this.super.port},set:function(e){this.super.port=e}},{key:"protocol",get:function(){return this.super.protocol},set:function(e){this.super.protocol=e}},{key:"search",get:function(){return this.super.search},set:function(e){this.super.search=e}},{key:"searchParams",get:function(){return this.super.searchParams},set:function(e){this.super.searchParams=e}},{key:"username",get:function(){return this.super.username},set:function(e){this.super.username=e}},{key:"createObjectURL",value:function(e){return this.super.createObjectURL(e)}},{key:"revokeObjectURL",value:function(e){this.super.revokeObjectURL(e)}},{key:"toJSON",value:function(){return this.super.toJSON()}},{key:"toString",value:function(){return this.super.toString()}},{key:"format",value:function(){return this.toString()}}]),e}(),URLSearchParams:self.URLSearchParams,defaultBase:Ho,format:function(e){if("string"==typeof e)return new Ko(e).toString();if(!(e instanceof Ko)){var t=e.username&&e.password?"".concat(e.username,":").concat(e.password,"@"):"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",a=e.host||"",o=e.hostname||"",s=e.search||(e.query?"?"+e.query:""),u=e.hash||"",c=e.pathname||"";return"".concat(i).concat(t||r).concat(a||o+n).concat(e.path||c+s).concat(u)}}},zo=Vo.URLWithLegacySupport,qo=Vo.format,Go={URL:Vo.URLWithLegacySupport,URLSearchParams:Vo.URLSearchParams,format:Vo.format,relative:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,a=r.protocol?r.protocol.replace(":",""):"http";a=(n[a]||i||a)+":";try{t=new zo(e)}catch(e){t={}}var o=Object.assign({},r,{protocol:a||t.protocol,host:r.host||t.host});return new zo(e,qo(o)).toString()},defaultBase:Vo.defaultBase},Wo=Co.Buffer,Jo=Io,Xo=Po.exports.BigNumber,Yo=To,$o=Oo,Zo=Do,es=Qo,ts=Go.URL,rs=function(){function e(t){s(this,e),!(t=t||{}).size||t.size<65536?t.size=65536:t.size=Yo.nextPowerOf2(t.size),this._heap=new ArrayBuffer(t.size),this._heap8=new Uint8Array(this._heap),this._buffer=Wo.from(this._heap),this._reset(),this._knownTags=Object.assign({0:function(e){return new Date(e)},1:function(e){return new Date(1e3*e)},2:function(e){return Yo.arrayBufferToBignumber(e)},3:function(e){return $o.NEG_ONE.minus(Yo.arrayBufferToBignumber(e))},4:function(e){return $o.TEN.pow(e[0]).times(e[1])},5:function(e){return $o.TWO.pow(e[0]).times(e[1])},32:function(e){return new ts(e)},35:function(e){return new RegExp(e)}},t.tags),this.parser=function(e,t,r){"use asm";var n=new e.Uint8Array(r),i=t.pushInt,a=t.pushInt32,o=t.pushInt32Neg,s=t.pushInt64,u=t.pushInt64Neg,c=t.pushFloat,l=t.pushFloatSingle,f=t.pushFloatDouble,h=t.pushTrue,A=t.pushFalse,d=t.pushUndefined,p=t.pushNull,v=t.pushInfinity,g=t.pushInfinityNeg,y=t.pushNaN,m=t.pushNaNNeg,b=t.pushArrayStart,w=t.pushArrayStartFixed,x=t.pushArrayStartFixed32,k=t.pushArrayStartFixed64,_=t.pushObjectStart,B=t.pushObjectStartFixed,E=t.pushObjectStartFixed32,S=t.pushObjectStartFixed64,C=t.pushByteString,I=t.pushByteStringStart,P=t.pushUtf8String,T=t.pushUtf8StringStart,O=t.pushSimpleUnassigned,L=t.pushTagStart,N=t.pushTagStart4,M=t.pushTagStart8,U=t.pushTagUnassigned,F=t.pushBreak,R=e.Math.pow,D=0,j=0,Q=0;function H(e){e=e|0;D=0;j=e;while((D|0)<(j|0)){Q=Xe[n[D]&255](n[D]|0)|0;if((Q|0)>0){break}}return Q|0}function K(e){e=e|0;if(((D|0)+(e|0)|0)<(j|0)){return 0}return 1}function V(e){e=e|0;return n[e|0]<<8|n[e+1|0]|0}function z(e){e=e|0;return n[e|0]<<24|n[e+1|0]<<16|n[e+2|0]<<8|n[e+3|0]|0}function q(e){e=e|0;i(e|0);D=D+1|0;return 0}function G(e){e=e|0;if(K(1)|0){return 1}i(n[D+1|0]|0);D=D+2|0;return 0}function W(e){e=e|0;if(K(2)|0){return 1}i(V(D+1|0)|0);D=D+3|0;return 0}function J(e){e=e|0;if(K(4)|0){return 1}a(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function X(e){e=e|0;if(K(8)|0){return 1}s(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function Y(e){e=e|0;i(-1-(e-32|0)|0);D=D+1|0;return 0}function $(e){e=e|0;if(K(1)|0){return 1}i(-1-(n[D+1|0]|0)|0);D=D+2|0;return 0}function Z(e){e=e|0;var t=0;if(K(2)|0){return 1}t=V(D+1|0)|0;i(-1-(t|0)|0);D=D+3|0;return 0}function ee(e){e=e|0;if(K(4)|0){return 1}o(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function te(e){e=e|0;if(K(8)|0){return 1}u(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function re(e){e=e|0;var t=0;var r=0;var n=0;n=e-64|0;if(K(n|0)|0){return 1}t=D+1|0;r=(D+1|0)+(n|0)|0;C(t|0,r|0);D=r|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var i=0;if(K(1)|0){return 1}i=n[D+1|0]|0;t=D+2|0;r=(D+2|0)+(i|0)|0;if(K(i+1|0)|0){return 1}C(t|0,r|0);D=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=V(D+1|0)|0;t=D+3|0;r=(D+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}C(t|0,r|0);D=r|0;return 0}function ae(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=z(D+1|0)|0;t=D+5|0;r=(D+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}C(t|0,r|0);D=r|0;return 0}function oe(e){e=e|0;return 1}function se(e){e=e|0;I();D=D+1|0;return 0}function ue(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(K(n|0)|0){return 1}t=D+1|0;r=(D+1|0)+(n|0)|0;P(t|0,r|0);D=r|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var i=0;if(K(1)|0){return 1}i=n[D+1|0]|0;t=D+2|0;r=(D+2|0)+(i|0)|0;if(K(i+1|0)|0){return 1}P(t|0,r|0);D=r|0;return 0}function le(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=V(D+1|0)|0;t=D+3|0;r=(D+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}P(t|0,r|0);D=r|0;return 0}function fe(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=z(D+1|0)|0;t=D+5|0;r=(D+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}P(t|0,r|0);D=r|0;return 0}function he(e){e=e|0;return 1}function Ae(e){e=e|0;T();D=D+1|0;return 0}function de(e){e=e|0;w(e-128|0);D=D+1|0;return 0}function pe(e){e=e|0;if(K(1)|0){return 1}w(n[D+1|0]|0);D=D+2|0;return 0}function ve(e){e=e|0;if(K(2)|0){return 1}w(V(D+1|0)|0);D=D+3|0;return 0}function ge(e){e=e|0;if(K(4)|0){return 1}x(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function ye(e){e=e|0;if(K(8)|0){return 1}k(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function me(e){e=e|0;b();D=D+1|0;return 0}function be(e){e=e|0;var t=0;t=e-160|0;if(K(t|0)|0){return 1}B(t|0);D=D+1|0;return 0}function we(e){e=e|0;if(K(1)|0){return 1}B(n[D+1|0]|0);D=D+2|0;return 0}function xe(e){e=e|0;if(K(2)|0){return 1}B(V(D+1|0)|0);D=D+3|0;return 0}function ke(e){e=e|0;if(K(4)|0){return 1}E(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function _e(e){e=e|0;if(K(8)|0){return 1}S(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function Be(e){e=e|0;_();D=D+1|0;return 0}function Ee(e){e=e|0;L(e-192|0|0);D=D+1|0;return 0}function Se(e){e|0;L(e|0);D=D+1|0;return 0}function Ce(e){e|0;L(e|0);D=D+1|0;return 0}function Ie(e){e|0;L(e|0);D=D+1|0;return 0}function Pe(e){e|0;L(e|0);D=D+1|0;return 0}function Te(e){e=e|0;L(e-192|0|0);D=D+1|0;return 0}function Oe(e){e|0;L(e|0);D=D+1|0;return 0}function Le(e){e|0;L(e|0);D=D+1|0;return 0}function Ne(e){e|0;L(e|0);D=D+1|0;return 0}function Me(e){e=e|0;if(K(1)|0){return 1}L(n[D+1|0]|0);D=D+2|0;return 0}function Ue(e){e=e|0;if(K(2)|0){return 1}L(V(D+1|0)|0);D=D+3|0;return 0}function Fe(e){e=e|0;if(K(4)|0){return 1}N(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function Re(e){e=e|0;if(K(8)|0){return 1}M(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function De(e){e=e|0;O((e|0)-224|0);D=D+1|0;return 0}function je(e){e=e|0;A();D=D+1|0;return 0}function Qe(e){e=e|0;h();D=D+1|0;return 0}function He(e){e=e|0;p();D=D+1|0;return 0}function Ke(e){e=e|0;d();D=D+1|0;return 0}function Ve(e){e=e|0;if(K(1)|0){return 1}O(n[D+1|0]|0);D=D+2|0;return 0}function ze(e){e=e|0;var t=0;var r=0;var i=1.0;var a=0.0;var o=0.0;var s=0.0;if(K(2)|0){return 1}t=n[D+1|0]|0;r=n[D+2|0]|0;if((t|0)&0x80){i=-1.0}a=+(((t|0)&0x7C)>>2);o=+(((t|0)&0x03)<<8|r);if(+a==0.0){c(+(+i*+5.9604644775390625e-8*+o))}else if(+a==31.0){if(+i==1.0){if(+o>0.0){y()}else{v()}}else{if(+o>0.0){m()}else{g()}}}else{c(+(+i*R(+2,+(+a-25.0))*+(1024.0+o)))}D=D+3|0;return 0}function qe(e){e=e|0;if(K(4)|0){return 1}l(n[D+1|0]|0,n[D+2|0]|0,n[D+3|0]|0,n[D+4|0]|0);D=D+5|0;return 0}function Ge(e){e=e|0;if(K(8)|0){return 1}f(n[D+1|0]|0,n[D+2|0]|0,n[D+3|0]|0,n[D+4|0]|0,n[D+5|0]|0,n[D+6|0]|0,n[D+7|0]|0,n[D+8|0]|0);D=D+9|0;return 0}function We(e){e=e|0;return 1}function Je(e){e=e|0;F();D=D+1|0;return 0}var Xe=[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,G,W,J,X,We,We,We,We,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,$,Z,ee,te,We,We,We,We,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,ne,ie,ae,oe,We,We,We,se,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ce,le,fe,he,We,We,We,Ae,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,pe,ve,ge,ye,We,We,We,me,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,we,xe,ke,_e,We,We,We,Be,Ee,Ee,Ee,Ee,Ee,Ee,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Me,Ue,Fe,Re,We,We,We,We,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,je,Qe,He,Ke,Ve,ze,qe,Ge,We,We,We,Je];return{parse:H}}(Ba,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}return c(e,[{key:"_depth",get:function(){return this._parents.length}},{key:"_currentParent",get:function(){return this._parents[this._depth-1]}},{key:"_ref",get:function(){return this._currentParent.ref}},{key:"_closeParent",value:function(){var e=this._parents.pop();if(e.length>0)throw new Error("Missing ".concat(e.length," elements"));switch(e.type){case $o.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case $o.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case $o.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case $o.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case $o.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case $o.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===$o.PARENT.TAG&&this._dec()}},{key:"_dec",value:function(){var e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}},{key:"_push",value:function(e,t){var r=this._currentParent;switch(r.values++,r.type){case $o.PARENT.ARRAY:case $o.PARENT.BYTE_STRING:case $o.PARENT.UTF8_STRING:r.length>-1?this._ref[this._ref.length-r.length]=e:this._ref.push(e),this._dec();break;case $o.PARENT.OBJECT:null!=r.tmpKey?(this._ref[r.tmpKey]=e,r.tmpKey=null,this._dec()):(r.tmpKey=e,"string"!=typeof r.tmpKey&&(r.type=$o.PARENT.MAP,r.ref=Yo.buildMap(r.ref)));break;case $o.PARENT.MAP:null!=r.tmpKey?(this._ref.set(r.tmpKey,e),r.tmpKey=null,this._dec()):r.tmpKey=e;break;case $o.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}},{key:"_createParent",value:function(e,t,r){this._parents[this._depth]={type:t,length:r,ref:e,values:0,tmpKey:null}}},{key:"_reset",value:function(){this._res=[],this._parents=[{type:$o.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}},{key:"createTag",value:function(e,t){var r=this._knownTags[e];return r?r(t):new es(e,t)}},{key:"createMap",value:function(e,t){return e}},{key:"createObject",value:function(e,t){return e}},{key:"createArray",value:function(e,t){return e}},{key:"createByteString",value:function(e,t){return Wo.concat(e)}},{key:"createByteStringFromHeap",value:function(e,t){return e===t?Wo.alloc(0):Wo.from(this._heap.slice(e,t))}},{key:"createInt",value:function(e){return e}},{key:"createInt32",value:function(e,t){return Yo.buildInt32(e,t)}},{key:"createInt64",value:function(e,t,r,n){return Yo.buildInt64(e,t,r,n)}},{key:"createFloat",value:function(e){return e}},{key:"createFloatSingle",value:function(e,t,r,n){return Jo.read([e,t,r,n],0,!1,23,4)}},{key:"createFloatDouble",value:function(e,t,r,n,i,a,o,s){return Jo.read([e,t,r,n,i,a,o,s],0,!1,52,8)}},{key:"createInt32Neg",value:function(e,t){return-1-Yo.buildInt32(e,t)}},{key:"createInt64Neg",value:function(e,t,r,n){var i=Yo.buildInt32(e,t),a=Yo.buildInt32(r,n);return i>$o.MAX_SAFE_HIGH?$o.NEG_ONE.minus(new Xo(i).times($o.SHIFT32).plus(a)):-1-(i*$o.SHIFT32+a)}},{key:"createTrue",value:function(){return!0}},{key:"createFalse",value:function(){return!1}},{key:"createNull",value:function(){return null}},{key:"createUndefined",value:function(){}},{key:"createInfinity",value:function(){return 1/0}},{key:"createInfinityNeg",value:function(){return-1/0}},{key:"createNaN",value:function(){return NaN}},{key:"createNaNNeg",value:function(){return NaN}},{key:"createUtf8String",value:function(e,t){return e.join("")}},{key:"createUtf8StringFromHeap",value:function(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}},{key:"createSimpleUnassigned",value:function(e){return new Zo(e)}},{key:"pushInt",value:function(e){this._push(this.createInt(e))}},{key:"pushInt32",value:function(e,t){this._push(this.createInt32(e,t))}},{key:"pushInt64",value:function(e,t,r,n){this._push(this.createInt64(e,t,r,n))}},{key:"pushFloat",value:function(e){this._push(this.createFloat(e))}},{key:"pushFloatSingle",value:function(e,t,r,n){this._push(this.createFloatSingle(e,t,r,n))}},{key:"pushFloatDouble",value:function(e,t,r,n,i,a,o,s){this._push(this.createFloatDouble(e,t,r,n,i,a,o,s))}},{key:"pushInt32Neg",value:function(e,t){this._push(this.createInt32Neg(e,t))}},{key:"pushInt64Neg",value:function(e,t,r,n){this._push(this.createInt64Neg(e,t,r,n))}},{key:"pushTrue",value:function(){this._push(this.createTrue())}},{key:"pushFalse",value:function(){this._push(this.createFalse())}},{key:"pushNull",value:function(){this._push(this.createNull())}},{key:"pushUndefined",value:function(){this._push(this.createUndefined())}},{key:"pushInfinity",value:function(){this._push(this.createInfinity())}},{key:"pushInfinityNeg",value:function(){this._push(this.createInfinityNeg())}},{key:"pushNaN",value:function(){this._push(this.createNaN())}},{key:"pushNaNNeg",value:function(){this._push(this.createNaNNeg())}},{key:"pushArrayStart",value:function(){this._createParent([],$o.PARENT.ARRAY,-1)}},{key:"pushArrayStartFixed",value:function(e){this._createArrayStartFixed(e)}},{key:"pushArrayStartFixed32",value:function(e,t){var r=Yo.buildInt32(e,t);this._createArrayStartFixed(r)}},{key:"pushArrayStartFixed64",value:function(e,t,r,n){var i=Yo.buildInt64(e,t,r,n);this._createArrayStartFixed(i)}},{key:"pushObjectStart",value:function(){this._createObjectStartFixed(-1)}},{key:"pushObjectStartFixed",value:function(e){this._createObjectStartFixed(e)}},{key:"pushObjectStartFixed32",value:function(e,t){var r=Yo.buildInt32(e,t);this._createObjectStartFixed(r)}},{key:"pushObjectStartFixed64",value:function(e,t,r,n){var i=Yo.buildInt64(e,t,r,n);this._createObjectStartFixed(i)}},{key:"pushByteStringStart",value:function(){this._parents[this._depth]={type:$o.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}},{key:"pushByteString",value:function(e,t){this._push(this.createByteStringFromHeap(e,t))}},{key:"pushUtf8StringStart",value:function(){this._parents[this._depth]={type:$o.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}},{key:"pushUtf8String",value:function(e,t){this._push(this.createUtf8StringFromHeap(e,t))}},{key:"pushSimpleUnassigned",value:function(e){this._push(this.createSimpleUnassigned(e))}},{key:"pushTagStart",value:function(e){this._parents[this._depth]={type:$o.PARENT.TAG,length:1,ref:[e]}}},{key:"pushTagStart4",value:function(e,t){this.pushTagStart(Yo.buildInt32(e,t))}},{key:"pushTagStart8",value:function(e,t,r,n){this.pushTagStart(Yo.buildInt64(e,t,r,n))}},{key:"pushTagUnassigned",value:function(e){this._push(this.createTag(e))}},{key:"pushBreak",value:function(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}},{key:"_createObjectStartFixed",value:function(e){0!==e?this._createParent({},$o.PARENT.OBJECT,e):this._push(this.createObject({}))}},{key:"_createArrayStartFixed",value:function(e){0!==e?this._createParent(new Array(e),$o.PARENT.ARRAY,e):this._push(this.createArray([]))}},{key:"_decode",value:function(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);var t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}},{key:"decodeFirst",value:function(e){return this._decode(e),this._res[0]}},{key:"decodeAll",value:function(e){return this._decode(e),this._res}}],[{key:"decode",value:function(t,r){return"string"==typeof t&&(t=Wo.from(t,r||"hex")),new e({size:t.length}).decodeFirst(t)}},{key:"decodeAll",value:function(t,r){return"string"==typeof t&&(t=Wo.from(t,r||"hex")),new e({size:t.length}).decodeAll(t)}}]),e}();rs.decodeFirst=rs.decode;var ns=rs,is=Co.Buffer,as=To,os=function(e){f(r,e);var t=w(r);function r(){return s(this,r),t.apply(this,arguments)}return c(r,[{key:"createTag",value:function(e,t){return"".concat(e,"(").concat(t,")")}},{key:"createInt",value:function(e){return k(h(r.prototype),"createInt",this).call(this,e).toString()}},{key:"createInt32",value:function(e,t){return k(h(r.prototype),"createInt32",this).call(this,e,t).toString()}},{key:"createInt64",value:function(e,t,n,i){return k(h(r.prototype),"createInt64",this).call(this,e,t,n,i).toString()}},{key:"createInt32Neg",value:function(e,t){return k(h(r.prototype),"createInt32Neg",this).call(this,e,t).toString()}},{key:"createInt64Neg",value:function(e,t,n,i){return k(h(r.prototype),"createInt64Neg",this).call(this,e,t,n,i).toString()}},{key:"createTrue",value:function(){return"true"}},{key:"createFalse",value:function(){return"false"}},{key:"createFloat",value:function(e){var t=k(h(r.prototype),"createFloat",this).call(this,e);return as.isNegativeZero(e)?"-0_1":"".concat(t,"_1")}},{key:"createFloatSingle",value:function(e,t,n,i){return"".concat(k(h(r.prototype),"createFloatSingle",this).call(this,e,t,n,i),"_2")}},{key:"createFloatDouble",value:function(e,t,n,i,a,o,s,u){return"".concat(k(h(r.prototype),"createFloatDouble",this).call(this,e,t,n,i,a,o,s,u),"_3")}},{key:"createByteString",value:function(e,t){var r=e.join(", ");return-1===t?"(_ ".concat(r,")"):"h'".concat(r)}},{key:"createByteStringFromHeap",value:function(e,t){return"h'".concat(is.from(k(h(r.prototype),"createByteStringFromHeap",this).call(this,e,t)).toString("hex"),"'")}},{key:"createInfinity",value:function(){return"Infinity_1"}},{key:"createInfinityNeg",value:function(){return"-Infinity_1"}},{key:"createNaN",value:function(){return"NaN_1"}},{key:"createNaNNeg",value:function(){return"-NaN_1"}},{key:"createNull",value:function(){return"null"}},{key:"createUndefined",value:function(){return"undefined"}},{key:"createSimpleUnassigned",value:function(e){return"simple(".concat(e,")")}},{key:"createArray",value:function(e,t){var n=k(h(r.prototype),"createArray",this).call(this,e,t);return-1===t?"[_ ".concat(n.join(", "),"]"):"[".concat(n.join(", "),"]")}},{key:"createMap",value:function(e,t){var n=k(h(r.prototype),"createMap",this).call(this,e),i=Array.from(n.keys()).reduce(us(n),"");return-1===t?"{_ ".concat(i,"}"):"{".concat(i,"}")}},{key:"createObject",value:function(e,t){var n=k(h(r.prototype),"createObject",this).call(this,e),i=Object.keys(n).reduce(us(n),"");return-1===t?"{_ ".concat(i,"}"):"{".concat(i,"}")}},{key:"createUtf8String",value:function(e,t){var r=e.join(", ");return-1===t?"(_ ".concat(r,")"):'"'.concat(r,'"')}},{key:"createUtf8StringFromHeap",value:function(e,t){return'"'.concat(is.from(k(h(r.prototype),"createUtf8StringFromHeap",this).call(this,e,t)).toString("utf8"),'"')}}],[{key:"diagnose",value:function(e,t){return"string"==typeof e&&(e=is.from(e,t||"hex")),(new r).decodeFirst(e)}}]),r}(ns),ss=os;function us(e){return function(t,r){return t?"".concat(t,", ").concat(r,": ").concat(e[r]):"".concat(r,": ").concat(e[r])}}var cs=Co.Buffer,ls=Go.URL,fs=Po.exports.BigNumber,hs=To,As=Oo,ds=As.MT,ps=As.NUMBYTES,vs=As.SHIFT32,gs=As.SYMS,ys=As.TAG,ms=As.MT.SIMPLE_FLOAT<<5|As.NUMBYTES.TWO,bs=As.MT.SIMPLE_FLOAT<<5|As.NUMBYTES.FOUR,ws=As.MT.SIMPLE_FLOAT<<5|As.NUMBYTES.EIGHT,xs=As.MT.SIMPLE_FLOAT<<5|As.SIMPLE.TRUE,ks=As.MT.SIMPLE_FLOAT<<5|As.SIMPLE.FALSE,_s=As.MT.SIMPLE_FLOAT<<5|As.SIMPLE.UNDEFINED,Bs=As.MT.SIMPLE_FLOAT<<5|As.SIMPLE.NULL,Es=new fs("0x20000000000000"),Ss=cs.from("f97e00","hex"),Cs=cs.from("f9fc00","hex"),Is=cs.from("f97c00","hex"),Ps=function(){function e(t){s(this,e),t=t||{},this.streaming="function"==typeof t.stream,this.onData=t.stream,this.semanticTypes=[[ls,this._pushUrl],[fs,this._pushBigNumber]];for(var r=t.genTypes||[],n=r.length,i=0;i<n;i++)this.addSemanticType(r[i][0],r[i][1]);this._reset()}return c(e,[{key:"addSemanticType",value:function(e,t){for(var r=this.semanticTypes.length,n=0;n<r;n++)if(this.semanticTypes[n][0]===e){var i=this.semanticTypes[n][1];return this.semanticTypes[n][1]=t,i}return this.semanticTypes.push([e,t]),null}},{key:"push",value:function(e){return!e||(this.result[this.offset]=e,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=e.length,this.offset++,this.streaming&&this.onData(this.finalize()),!0)}},{key:"pushWrite",value:function(e,t,r){return this.result[this.offset]=e,this.resultMethod[this.offset]=t,this.resultLength[this.offset]=r,this.offset++,this.streaming&&this.onData(this.finalize()),!0}},{key:"_pushUInt8",value:function(e){return this.pushWrite(e,1,1)}},{key:"_pushUInt16BE",value:function(e){return this.pushWrite(e,2,2)}},{key:"_pushUInt32BE",value:function(e){return this.pushWrite(e,3,4)}},{key:"_pushDoubleBE",value:function(e){return this.pushWrite(e,4,8)}},{key:"_pushNaN",value:function(){return this.push(Ss)}},{key:"_pushInfinity",value:function(e){var t=e<0?Cs:Is;return this.push(t)}},{key:"_pushFloat",value:function(e){var t=cs.allocUnsafe(2);if(hs.writeHalf(t,e)&&hs.parseHalf(t)===e)return this._pushUInt8(ms)&&this.push(t);var r=cs.allocUnsafe(4);return r.writeFloatBE(e,0),r.readFloatBE(0)===e?this._pushUInt8(bs)&&this.push(r):this._pushUInt8(ws)&&this._pushDoubleBE(e)}},{key:"_pushInt",value:function(e,t,r){var n=t<<5;return e<24?this._pushUInt8(n|e):e<=255?this._pushUInt8(n|ps.ONE)&&this._pushUInt8(e):e<=65535?this._pushUInt8(n|ps.TWO)&&this._pushUInt16BE(e):e<=4294967295?this._pushUInt8(n|ps.FOUR)&&this._pushUInt32BE(e):e<=Number.MAX_SAFE_INTEGER?this._pushUInt8(n|ps.EIGHT)&&this._pushUInt32BE(Math.floor(e/vs))&&this._pushUInt32BE(e%vs):t===ds.NEG_INT?this._pushFloat(r):this._pushFloat(e)}},{key:"_pushIntNum",value:function(e){return e<0?this._pushInt(-e-1,ds.NEG_INT,e):this._pushInt(e,ds.POS_INT)}},{key:"_pushNumber",value:function(e){switch(!1){case e==e:return this._pushNaN(e);case isFinite(e):return this._pushInfinity(e);case e%1!=0:return this._pushIntNum(e);default:return this._pushFloat(e)}}},{key:"_pushString",value:function(e){var t=cs.byteLength(e,"utf8");return this._pushInt(t,ds.UTF8_STRING)&&this.pushWrite(e,5,t)}},{key:"_pushBoolean",value:function(e){return this._pushUInt8(e?xs:ks)}},{key:"_pushUndefined",value:function(e){return this._pushUInt8(_s)}},{key:"_pushArray",value:function(e,t){var r=t.length;if(!e._pushInt(r,ds.ARRAY))return!1;for(var n=0;n<r;n++)if(!e.pushAny(t[n]))return!1;return!0}},{key:"_pushTag",value:function(e){return this._pushInt(e,ds.TAG)}},{key:"_pushDate",value:function(e,t){return e._pushTag(ys.DATE_EPOCH)&&e.pushAny(Math.round(t/1e3))}},{key:"_pushBuffer",value:function(e,t){return e._pushInt(t.length,ds.BYTE_STRING)&&e.push(t)}},{key:"_pushNoFilter",value:function(e,t){return e._pushBuffer(e,t.slice())}},{key:"_pushRegexp",value:function(e,t){return e._pushTag(ys.REGEXP)&&e.pushAny(t.source)}},{key:"_pushSet",value:function(e,t){if(!e._pushInt(t.size,ds.ARRAY))return!1;var r,n=L(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(!e.pushAny(i))return!1}}catch(e){n.e(e)}finally{n.f()}return!0}},{key:"_pushUrl",value:function(e,t){return e._pushTag(ys.URI)&&e.pushAny(t.format())}},{key:"_pushBigint",value:function(e){var t=ys.POS_BIGINT;e.isNegative()&&(e=e.negated().minus(1),t=ys.NEG_BIGINT);var r=e.toString(16);r.length%2&&(r="0"+r);var n=cs.from(r,"hex");return this._pushTag(t)&&this._pushBuffer(this,n)}},{key:"_pushBigNumber",value:function(e,t){if(t.isNaN())return e._pushNaN();if(!t.isFinite())return e._pushInfinity(t.isNegative()?-1/0:1/0);if(t.isInteger())return e._pushBigint(t);if(!e._pushTag(ys.DECIMAL_FRAC)||!e._pushInt(2,ds.ARRAY))return!1;var r=t.decimalPlaces(),n=t.multipliedBy(new fs(10).pow(r));return!!e._pushIntNum(-r)&&(n.abs().isLessThan(Es)?e._pushIntNum(n.toNumber()):e._pushBigint(n))}},{key:"_pushMap",value:function(e,t){return!!e._pushInt(t.size,ds.MAP)&&this._pushRawMap(t.size,Array.from(t))}},{key:"_pushObject",value:function(e){if(!e)return this._pushUInt8(Bs);for(var t=this.semanticTypes.length,r=0;r<t;r++)if(e instanceof this.semanticTypes[r][0])return this.semanticTypes[r][1].call(e,this,e);var n=e.encodeCBOR;if("function"==typeof n)return n.call(e,this);var i=Object.keys(e),a=i.length;return!!this._pushInt(a,ds.MAP)&&this._pushRawMap(a,i.map((function(t){return[t,e[t]]})))}},{key:"_pushRawMap",value:function(t,r){r=r.map((function(t){return t[0]=e.encode(t[0]),t})).sort(hs.keySorter);for(var n=0;n<t;n++){if(!this.push(r[n][0]))return!1;if(!this.pushAny(r[n][1]))return!1}return!0}},{key:"write",value:function(e){return this.pushAny(e)}},{key:"pushAny",value:function(e){var t=function(e){return{}.toString.call(e).slice(8,-1)}(e);switch(t){case"Number":return this._pushNumber(e);case"String":return this._pushString(e);case"Boolean":return this._pushBoolean(e);case"Object":return this._pushObject(e);case"Array":return this._pushArray(this,e);case"Uint8Array":return this._pushBuffer(this,cs.isBuffer(e)?e:cs.from(e));case"Null":return this._pushUInt8(Bs);case"Undefined":return this._pushUndefined(e);case"Map":return this._pushMap(this,e);case"Set":return this._pushSet(this,e);case"URL":return this._pushUrl(this,e);case"BigNumber":return this._pushBigNumber(this,e);case"Date":return this._pushDate(this,e);case"RegExp":return this._pushRegexp(this,e);case"Symbol":switch(e){case gs.NULL:return this._pushObject(null);case gs.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+e.toString())}default:throw new Error("Unknown type: "+i(e)+", "+(e?e.toString():""))}}},{key:"finalize",value:function(){if(0===this.offset)return null;for(var e=this.result,t=this.resultLength,r=this.resultMethod,n=this.offset,i=0,a=0;a<n;a++)i+=t[a];var o=cs.allocUnsafe(i),s=0,u=0;for(a=0;a<n;a++){switch(u=t[a],r[a]){case 0:e[a].copy(o,s);break;case 1:o.writeUInt8(e[a],s,!0);break;case 2:o.writeUInt16BE(e[a],s,!0);break;case 3:o.writeUInt32BE(e[a],s,!0);break;case 4:o.writeDoubleBE(e[a],s,!0);break;case 5:o.write(e[a],s,u,"utf8");break;default:throw new Error("unkown method")}s+=u}var c=o;return this._reset(),c}},{key:"_reset",value:function(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}}],[{key:"encode",value:function(t){var r=new e;if(!r.pushAny(t))throw new Error("Failed to encode input");return r.finalize()}}]),e}(),Ts=Ps;function Os(e){if("string"==typeof e)return(new TextEncoder).encode(e);if(!(e instanceof Uint8Array))throw new TypeError('"data" be a string or Uint8Array.');return e}
|
|
447
|
+
</a>`;const oa={en:function(e){const t=na("numbers","ordinal"),r=e%100;return t[(r-20)%10]||t[r]||t[0]},fr:function(e){const t=na("numbers","ordinal");return 1===e?t[e]:t[0]},es:()=>na("numbers","ordinal"),it:()=>na("numbers","ordinal"),mt:e=>na("numbers","ordinal")[e-1]};function sa(e){return"mt"===ea.locale?oa[ea.locale](e):e+oa[ea.locale](e)}const ua=({certificateTitle:e="",issueDate:t="",issuerName:r="",recipientName:n="",issuerPublicKey:i=[],issuerPublicDomain:a=[],issuerPublicUrl:o=[],issuerLogo:s="",qrCodeImage:u=""})=>{const c=[];(e||s)&&(c.push("<section>"),s&&c.push(`<div style="margin:0 auto;width:140px;height:140px;background-repeat:no-repeat;background-position:center;background-size:contain;background-image:url('${s}');"></div>`),e&&c.push(`<h2 style="margin:20px 0;font-size:18px;text-align:center">${e}</h2>`),c.push("</section>")),c.push('<section style="text-align:center">');const l=[{title:"Issue Date",value:t},{title:"Recipient",value:n},{title:"Issuer",value:r}];c.push(...l.map((e=>`<div style="margin:15px 0"><dt style="margin-bottom:5px;text-transform:uppercase;font-weight:600;font-size:12px">${e.title}</dt><dd style="margin:0;font-size:13px">${e.value}</dd></div>`)));const f=i.map(((e,t)=>({publicKey:e,url:o[t],domain:a[t]})));c.push(function(e){const t=e.length>1,r=['<div style="margin:15px 0">'];return r.push('<dt style="margin-bottom:5px;text-transform:uppercase;font-weight:600;font-size:12px">Issuer Information</dt>'),r.push('<dd style="margin:0;font-size:13px">'),r.push('<div style="display:flex;flex-direction:column;align-content:center;row-gap:4px;padding:0 20px;font-size:12px">'),r.push(...e.map(((e,r)=>{const n=['<div style="display:flex;flex-direction:column;row-gap:3px;justify-content:center;padding:5px 10px">'];return n.push("<div>"),t&&n.push(`<span style="font-weight:500;margin-right:10px">${sa(r+1)}</span>`),n.push(`<span>Public Key: ${e.publicKey}</span>`),n.push("</div>"),e.url&&e.domain&&n.push(`<span><a href="${e.url}">${e.domain}</a></span>`),n.push("</div>"),n.join("")}))),r.push("<div/>"),r.push("<dd/>"),r.push("<div/>"),r.join("")}(f)),c.push("</section>"),u&&(c.push("<section>"),c.push('<span style="margin-bottom:15px;font-size:10px">Scan the QR code to verify the document.</span>'),c.push(`<div style="margin:0 auto;width:110px;height:110px;background-repeat:no-repeat;background-position:center;background-size:contain;background-image:url('data:image/svg+xml;base64,${u}');"></div>`),c.push("</section>")),c.push(`<div style="width:150px">${ia().getHTML()}</div>`);const h=document.createElement("section");return h.setAttribute("style","width:595px;height:842px;padding:40px 20px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:space-between;align-items:center;font-family:'Open Sans',-apple-system,BlinkMacSystemFont,sans-serif;color:rgb(0,0,0);"),h.innerHTML=c.join(""),h};var ca={exports:{}};!function(e){function t(e){this.mode=n.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,r=this.data.length;t<r;t++){var i=[],a=this.data.charCodeAt(t);a>65536?(i[0]=240|(1835008&a)>>>18,i[1]=128|(258048&a)>>>12,i[2]=128|(4032&a)>>>6,i[3]=128|63&a):a>2048?(i[0]=224|(61440&a)>>>12,i[1]=128|(4032&a)>>>6,i[2]=128|63&a):a>128?(i[0]=192|(1984&a)>>>6,i[1]=128|63&a):i[0]=a,this.parsedData.push(i)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function r(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}t.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t<r;t++)e.put(this.parsedData[t],8)}},r.prototype={addData:function(e){var r=new t(e);this.dataList.push(r),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++)this.modules[n][i]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=r.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(this.modules[e+r][t+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=v.getLostPoint(this);(0==r||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r);this.make();for(var i=0;i<this.modules.length;i++)for(var a=1*i,o=0;o<this.modules[i].length;o++){var s=1*o;this.modules[i][o]&&(n.beginFill(0,100),n.moveTo(s,a),n.lineTo(s+1,a),n.lineTo(s+1,a+1),n.lineTo(s,a+1),n.endFill())}return n},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)null==this.modules[e][6]&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=t%2==0)},setupPositionAdjustPattern:function(){for(var e=v.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var n=e[t],i=e[r];if(null==this.modules[n][i])for(var a=-2;a<=2;a++)for(var o=-2;o<=2;o++)this.modules[n+a][i+o]=-2==a||2==a||-2==o||2==o||0==a&&0==o}},setupTypeNumber:function(e){for(var t=v.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var n=!e&&1==(t>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(r=0;r<18;r++){n=!e&&1==(t>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=v.getBCHTypeInfo(r),i=0;i<15;i++){var a=!e&&1==(n>>i&1);i<6?this.modules[i][8]=a:i<8?this.modules[i+1][8]=a:this.modules[this.moduleCount-15+i][8]=a}for(i=0;i<15;i++){a=!e&&1==(n>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=a:i<9?this.modules[8][15-i-1+1]=a:this.modules[8][15-i-1]=a}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,a=0,o=this.moduleCount-1;o>0;o-=2)for(6==o&&o--;;){for(var s=0;s<2;s++)if(null==this.modules[n][o-s]){var u=!1;a<e.length&&(u=1==(e[a]>>>i&1)),v.getMask(t,n,o-s)&&(u=!u),this.modules[n][o-s]=u,-1==--i&&(a++,i=7)}if((n+=r)<0||this.moduleCount<=n){n-=r,r=-r;break}}}},r.PAD0=236,r.PAD1=17,r.createData=function(e,t,n){for(var i=b.getRSBlocks(e,t),a=new w,o=0;o<n.length;o++){var s=n[o];a.put(s.mode,4),a.put(s.getLength(),v.getLengthInBits(s.mode,e)),s.write(a)}var u=0;for(o=0;o<i.length;o++)u+=i[o].dataCount;if(a.getLengthInBits()>8*u)throw new Error("code length overflow. ("+a.getLengthInBits()+">"+8*u+")");for(a.getLengthInBits()+4<=8*u&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(!1);for(;!(a.getLengthInBits()>=8*u||(a.put(r.PAD0,8),a.getLengthInBits()>=8*u));)a.put(r.PAD1,8);return r.createBytes(a,i)},r.createBytes=function(e,t){for(var r=0,n=0,i=0,a=new Array(t.length),o=new Array(t.length),s=0;s<t.length;s++){var u=t[s].dataCount,c=t[s].totalCount-u;n=Math.max(n,u),i=Math.max(i,c),a[s]=new Array(u);for(var l=0;l<a[s].length;l++)a[s][l]=255&e.buffer[l+r];r+=u;var f=v.getErrorCorrectPolynomial(c),h=new m(a[s],f.getLength()-1).mod(f);o[s]=new Array(f.getLength()-1);for(l=0;l<o[s].length;l++){var A=l+h.getLength()-o[s].length;o[s][l]=A>=0?h.get(A):0}}var d=0;for(l=0;l<t.length;l++)d+=t[l].totalCount;var p=new Array(d),g=0;for(l=0;l<n;l++)for(s=0;s<t.length;s++)l<a[s].length&&(p[g++]=a[s][l]);for(l=0;l<i;l++)for(s=0;s<t.length;s++)l<o[s].length&&(p[g++]=o[s][l]);return p};for(var n={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},i=1,a=0,o=3,s=2,u=0,c=1,l=2,f=3,h=4,A=5,d=6,p=7,v={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;v.getBCHDigit(t)-v.getBCHDigit(v.G15)>=0;)t^=v.G15<<v.getBCHDigit(t)-v.getBCHDigit(v.G15);return(e<<10|t)^v.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;v.getBCHDigit(t)-v.getBCHDigit(v.G18)>=0;)t^=v.G18<<v.getBCHDigit(t)-v.getBCHDigit(v.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;0!=e;)t++,e>>>=1;return t},getPatternPosition:function(e){return v.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case u:return(t+r)%2==0;case c:return t%2==0;case l:return r%3==0;case f:return(t+r)%3==0;case h:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case A:return t*r%2+t*r%3==0;case d:return(t*r%2+t*r%3)%2==0;case p:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new m([1],0),r=0;r<e;r++)t=t.multiply(new m([1,g.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case n.MODE_NUMBER:return 10;case n.MODE_ALPHA_NUM:return 9;case n.MODE_8BIT_BYTE:case n.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case n.MODE_NUMBER:return 12;case n.MODE_ALPHA_NUM:return 11;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else{if(!(t<41))throw new Error("type:"+t);switch(e){case n.MODE_NUMBER:return 14;case n.MODE_ALPHA_NUM:return 13;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}}},getLostPoint:function(e){for(var t=e.getModuleCount(),r=0,n=0;n<t;n++)for(var i=0;i<t;i++){for(var a=0,o=e.isDark(n,i),s=-1;s<=1;s++)if(!(n+s<0||t<=n+s))for(var u=-1;u<=1;u++)i+u<0||t<=i+u||0==s&&0==u||o==e.isDark(n+s,i+u)&&a++;a>5&&(r+=3+a-5)}for(n=0;n<t-1;n++)for(i=0;i<t-1;i++){var c=0;e.isDark(n,i)&&c++,e.isDark(n+1,i)&&c++,e.isDark(n,i+1)&&c++,e.isDark(n+1,i+1)&&c++,0!=c&&4!=c||(r+=3)}for(n=0;n<t;n++)for(i=0;i<t-6;i++)e.isDark(n,i)&&!e.isDark(n,i+1)&&e.isDark(n,i+2)&&e.isDark(n,i+3)&&e.isDark(n,i+4)&&!e.isDark(n,i+5)&&e.isDark(n,i+6)&&(r+=40);for(i=0;i<t;i++)for(n=0;n<t-6;n++)e.isDark(n,i)&&!e.isDark(n+1,i)&&e.isDark(n+2,i)&&e.isDark(n+3,i)&&e.isDark(n+4,i)&&!e.isDark(n+5,i)&&e.isDark(n+6,i)&&(r+=40);var l=0;for(i=0;i<t;i++)for(n=0;n<t;n++)e.isDark(n,i)&&l++;return r+=10*(Math.abs(100*l/t/t-50)/5)}},g={glog:function(e){if(e<1)throw new Error("glog("+e+")");return g.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return g.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},y=0;y<8;y++)g.EXP_TABLE[y]=1<<y;for(y=8;y<256;y++)g.EXP_TABLE[y]=g.EXP_TABLE[y-4]^g.EXP_TABLE[y-5]^g.EXP_TABLE[y-6]^g.EXP_TABLE[y-8];for(y=0;y<255;y++)g.LOG_TABLE[g.EXP_TABLE[y]]=y;function m(e,t){if(null==e.length)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&0==e[r];)r++;this.num=new Array(e.length-r+t);for(var n=0;n<e.length-r;n++)this.num[n]=e[n+r]}function b(e,t){this.totalCount=e,this.dataCount=t}function w(){this.buffer=[],this.length=0}m.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<e.getLength();n++)t[r+n]^=g.gexp(g.glog(this.get(r))+g.glog(e.get(n)));return new m(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=g.glog(this.get(0))-g.glog(e.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(n=0;n<e.getLength();n++)r[n]^=g.gexp(g.glog(e.get(n))+t);return new m(r,0).mod(e)}},b.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],b.getRSBlocks=function(e,t){var r=b.getRsBlockTable(e,t);if(null==r)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var n=r.length/3,i=[],a=0;a<n;a++)for(var o=r[3*a+0],s=r[3*a+1],u=r[3*a+2],c=0;c<o;c++)i.push(new b(s,u));return i},b.getRsBlockTable=function(e,t){switch(t){case i:return b.RS_BLOCK_TABLE[4*(e-1)+0];case a:return b.RS_BLOCK_TABLE[4*(e-1)+1];case o:return b.RS_BLOCK_TABLE[4*(e-1)+2];case s:return b.RS_BLOCK_TABLE[4*(e-1)+3];default:return}},w.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var x=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function k(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M"},"string"==typeof e&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if("string"!=typeof this.options.content)throw new Error("Expected 'content' as string!");if(0===this.options.content.length)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0&&this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");var n=this.options.content,u=function(e,t){for(var r=function(e){var t=encodeURI(e).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=e?3:0)}(e),n=1,i=0,a=0,o=x.length;a<=o;a++){var s=x[a];if(!s)throw new Error("Content too long: expected "+i+" but got "+r);switch(t){case"L":i=s[0];break;case"M":i=s[1];break;case"Q":i=s[2];break;case"H":i=s[3];break;default:throw new Error("Unknwon error correction level: "+t)}if(r<=i)break;n++}if(n>x.length)throw new Error("Content too long");return n}(n,this.options.ecl),c=function(e){switch(e){case"L":return i;case"M":return a;case"Q":return o;case"H":return s;default:throw new Error("Unknwon error correction level: "+e)}}(this.options.ecl);this.qrcode=new r(u,c),this.qrcode.addData(n),this.qrcode.make()}k.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;void 0===e&&(e={container:t.container||"svg"});for(var n=void 0===t.pretty||!!t.pretty,i=n?" ":"",a=n?"\r\n":"",o=t.width,s=t.height,u=r.length,c=o/(u+2*t.padding),l=s/(u+2*t.padding),f=void 0!==t.join&&!!t.join,h=void 0!==t.swap&&!!t.swap,A=void 0===t.xmlDeclaration||!!t.xmlDeclaration,d=void 0!==t.predefined&&!!t.predefined,p=d?i+'<defs><path id="qrmodule" d="M0 0 h'+l+" v"+c+' H0 z" style="fill:'+t.color+';shape-rendering:crispEdges;" /></defs>'+a:"",v=i+'<rect x="0" y="0" width="'+o+'" height="'+s+'" style="fill:'+t.background+';shape-rendering:crispEdges;"/>'+a,g="",y="",m=0;m<u;m++)for(var b=0;b<u;b++){if(r[b][m]){var w=b*c+t.padding*c,x=m*l+t.padding*l;if(h){var k=w;w=x,x=k}if(f){var _=c+w,B=l+x;w=Number.isInteger(w)?Number(w):w.toFixed(2),x=Number.isInteger(x)?Number(x):x.toFixed(2),_=Number.isInteger(_)?Number(_):_.toFixed(2),y+="M"+w+","+x+" V"+(B=Number.isInteger(B)?Number(B):B.toFixed(2))+" H"+_+" V"+x+" H"+w+" Z "}else g+=d?i+'<use x="'+w.toString()+'" y="'+x.toString()+'" href="#qrmodule" />'+a:i+'<rect x="'+w.toString()+'" y="'+x.toString()+'" width="'+c+'" height="'+l+'" style="fill:'+t.color+';shape-rendering:crispEdges;"/>'+a}}f&&(g=i+'<path x="0" y="0" style="fill:'+t.color+';shape-rendering:crispEdges;" d="'+y+'" />');var E="";switch(e.container){case"svg":A&&(E+='<?xml version="1.0" standalone="yes"?>'+a),E+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+o+'" height="'+s+'">'+a,E+=p+v+g,E+="</svg>";break;case"svg-viewbox":A&&(E+='<?xml version="1.0" standalone="yes"?>'+a),E+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+o+" "+s+'">'+a,E+=p+v+g,E+="</svg>";break;case"g":E+='<g width="'+o+'" height="'+s+'">'+a,E+=p+v+g,E+="</g>";break;default:E+=(p+v+g).replace(/^\s+/,"")}return E},k.prototype.save=function(e,t){var r=this.svg();"function"!=typeof t&&(t=function(e,t){});try{require("fs").writeFile(e,r,t)}catch(e){t(e)}},e.exports=k}(ca);var la=ca.exports;const fa=e=>e?(e=>window.btoa(e))(new la(e).svg()):null;const ha={height:"0",overflow:"hidden"},Aa={padding:"20px","background-color":"#fff","font-family":"serif","text-align":"center",color:"#49555f","font-size":"12px","word-wrap":"break-word","min-height":"calc(100vh - 145px)","box-sizing":"border-box",margin:"0 auto","min-width":"600px","line-height":"initial",clipPath:"inset(0 100% 0 0)"},da={"max-width":"460px"},pa=async(e,t)=>{const r=Tt(t),n=va({...Aa,...ha,...r?da:{}});n.insertAdjacentHTML("beforeend",t);const i=((e,t)=>t?[e]:Array.from(e.querySelectorAll(":scope > div > div")))(n,r);for(const t of i){const r=Lt(t);e=await Ji({pdf:e,pageHTMLElement:t,width:r.width,height:r.height,margin:10})}return ga(n),e},va=e=>{const t=document.createElement("div");var r,n;return t.setAttribute("id","html2pdf-dom-container-identifier"),e&&(r=t,n=e,Object.keys(n).forEach((e=>{r.style[e]=n[e]}))),document.body.appendChild(t),t},ga=e=>{document.body.removeChild(e)},ya=async({contentType:e=null,contentEncoding:t="",content:r="",recipientName:n="",certificateTitle:i="",issueDate:a="",issuerName:o="",issuerLogo:s="",recordLink:u="",issuerPublicKey:c=[],issuerProfileUrl:l=[],issuerProfileDomain:f=[]})=>{const h=i;let A;const d=(e=>[Ct.IMAGE_GIF,Ct.IMAGE_BMP,Ct.IMAGE_PNG,Ct.IMAGE_JPEG].includes(e))(e),p=e===Ct.TEXT_HTML;if((p||d)&&(A=await(async(e,t,r,n,i,a,o,s,u)=>{const c=va(ha),l=fa(a),f=ua({certificateTitle:t,issueDate:r,issuerName:n,issuerLogo:i,issuerPublicKey:o,issuerPublicDomain:s,issuerPublicUrl:u,recipientName:e,qrCodeImage:l});c.appendChild(f);const h=await Ji({pageHTMLElement:f,width:595,height:842,margin:0});return ga(c),h})(n,i,a,o,s,u,c,f,l)),p)A=await pa(A,r);else if(d)A=await Xi(A,`data:${e};${t},${r}`);else{const n=function(e){return e===Ct.APPLICATION_PDF?"pdf":""}(Ct.APPLICATION_PDF);!function(e,t,r,n,i=""){const a=`data:${t};${r},${e}`,o=document.createElement("a"),s=[n];i&&s.push(i);const u=s.join(".");o.href=a,o.download=u,o.click()}(r,e,t,h,n)}!function(e,t){e.save(t)}(A,h)};var ma,ba,wa,xa=["seed"],ka=["publicKeyBase58","privateKeyBase58"],_a=["documentLoader"],Ba="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Ea(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var Sa={},Ca="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Ia=[],Pa=[],Ta="undefined"!=typeof Uint8Array?Uint8Array:Array,Oa=!1;function La(){Oa=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)Ia[t]=e[t],Pa[e.charCodeAt(t)]=t;Pa["-".charCodeAt(0)]=62,Pa["_".charCodeAt(0)]=63}function Na(e,t,r){for(var n,i,a=[],o=t;o<r;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],a.push(Ia[(i=n)>>18&63]+Ia[i>>12&63]+Ia[i>>6&63]+Ia[63&i]);return a.join("")}function Ma(e){var t;Oa||La();for(var r=e.length,n=r%3,i="",a=[],o=16383,s=0,u=r-n;s<u;s+=o)a.push(Na(e,s,s+o>u?u:s+o));return 1===n?(t=e[r-1],i+=Ia[t>>2],i+=Ia[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=Ia[t>>10],i+=Ia[t>>4&63],i+=Ia[t<<2&63],i+="="),a.push(i),a.join("")}function Ua(e,t,r,n,i){var a,o,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,h=r?-1:1,A=e[t+f];for(f+=h,a=A&(1<<-l)-1,A>>=-l,l+=s;l>0;a=256*a+e[t+f],f+=h,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+e[t+f],f+=h,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(A?-1:1);o+=Math.pow(2,n),a-=c}return(A?-1:1)*o*Math.pow(2,a-n)}function Fa(e,t,r,n,i,a){var o,s,u,c=8*a-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:a-1,d=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=l?(s=0,o=l):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+A]=255&s,A+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+A]=255&o,A+=d,o/=256,c-=8);e[r+A-d]|=128*p}var Ra={}.toString,Da=Array.isArray||function(e){return"[object Array]"==Ra.call(e)};Ka.TYPED_ARRAY_SUPPORT=void 0===Ca.TYPED_ARRAY_SUPPORT||Ca.TYPED_ARRAY_SUPPORT;var ja=Qa();function Qa(){return Ka.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Ha(e,t){if(Qa()<t)throw new RangeError("Invalid typed array length");return Ka.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=Ka.prototype:(null===e&&(e=new Ka(t)),e.length=t),e}function Ka(e,t,r){if(!(Ka.TYPED_ARRAY_SUPPORT||this instanceof Ka))return new Ka(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return qa(this,e)}return Va(this,e,t,r)}function Va(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),Ka.TYPED_ARRAY_SUPPORT?(e=t).__proto__=Ka.prototype:e=Ga(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!Ka.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Xa(t,r),i=(e=Ha(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(Ja(t)){var r=0|Wa(t.length);return 0===(e=Ha(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?Ha(e,0):Ga(e,t);if("Buffer"===t.type&&Da(t.data))return Ga(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function za(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function qa(e,t){if(za(t),e=Ha(e,t<0?0:0|Wa(t)),!Ka.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function Ga(e,t){var r=t.length<0?0:0|Wa(t.length);e=Ha(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function Wa(e){if(e>=Qa())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Qa().toString(16)+" bytes");return 0|e}function Ja(e){return!(null==e||!e._isBuffer)}function Xa(e,t){if(Ja(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return ko(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return _o(e).length;default:if(n)return ko(e).length;t=(""+t).toLowerCase(),n=!0}}function Ya(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return fo(this,t,r);case"utf8":case"utf-8":return uo(this,t,r);case"ascii":return co(this,t,r);case"latin1":case"binary":return lo(this,t,r);case"base64":return so(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ho(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function $a(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Za(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=Ka.from(t,n)),Ja(t))return 0===t.length?-1:eo(e,t,r,n,i);if("number"==typeof t)return t&=255,Ka.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):eo(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function eo(e,t,r,n,i){var a,o=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var l=-1;for(a=r;a<s;a++)if(c(e,a)===c(t,-1===l?0:a-l)){if(-1===l&&(l=a),a-l+1===u)return l*o}else-1!==l&&(a-=a-l),l=-1}else for(r+u>s&&(r=s-u),a=r;a>=0;a--){for(var f=!0,h=0;h<u;h++)if(c(e,a+h)!==c(t,h)){f=!1;break}if(f)return a}return-1}function to(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function ro(e,t,r,n){return Bo(ko(t,e.length-r),e,r,n)}function no(e,t,r,n){return Bo(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function io(e,t,r,n){return no(e,t,r,n)}function ao(e,t,r,n){return Bo(_o(t),e,r,n)}function oo(e,t,r,n){return Bo(function(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function so(e,t,r){return 0===t&&r===e.length?Ma(e):Ma(e.slice(t,r))}function uo(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,u,c=e[i],l=null,f=c>239?4:c>223?3:c>191?2:1;if(i+f<=r)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&c)<<6|63&a)>127&&(l=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&c)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}function co(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function lo(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function fo(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=xo(e[a]);return i}function ho(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function Ao(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function po(e,t,r,n,i,a){if(!Ja(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function vo(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function go(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function yo(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function mo(e,t,r,n,i){return i||yo(e,0,r,4),Fa(e,t,r,n,23,4),r+4}function bo(e,t,r,n,i){return i||yo(e,0,r,8),Fa(e,t,r,n,52,8),r+8}Ka.poolSize=8192,Ka._augment=function(e){return e.__proto__=Ka.prototype,e},Ka.from=function(e,t,r){return Va(null,e,t,r)},Ka.TYPED_ARRAY_SUPPORT&&(Ka.prototype.__proto__=Uint8Array.prototype,Ka.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&Ka[Symbol.species]),Ka.alloc=function(e,t,r){return function(e,t,r,n){return za(t),t<=0?Ha(e,t):void 0!==r?"string"==typeof n?Ha(e,t).fill(r,n):Ha(e,t).fill(r):Ha(e,t)}(null,e,t,r)},Ka.allocUnsafe=function(e){return qa(null,e)},Ka.allocUnsafeSlow=function(e){return qa(null,e)},Ka.isBuffer=Eo,Ka.compare=function(e,t){if(!Ja(e)||!Ja(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},Ka.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},Ka.concat=function(e,t){if(!Da(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return Ka.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=Ka.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!Ja(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},Ka.byteLength=Xa,Ka.prototype._isBuffer=!0,Ka.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)$a(this,t,t+1);return this},Ka.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)$a(this,t,t+3),$a(this,t+1,t+2);return this},Ka.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)$a(this,t,t+7),$a(this,t+1,t+6),$a(this,t+2,t+5),$a(this,t+3,t+4);return this},Ka.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?uo(this,0,e):Ya.apply(this,arguments)},Ka.prototype.equals=function(e){if(!Ja(e))throw new TypeError("Argument must be a Buffer");return this===e||0===Ka.compare(this,e)},Ka.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},Ka.prototype.compare=function(e,t,r,n,i){if(!Ja(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),u=this.slice(n,i),c=e.slice(t,r),l=0;l<s;++l)if(u[l]!==c[l]){a=u[l],o=c[l];break}return a<o?-1:o<a?1:0},Ka.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},Ka.prototype.indexOf=function(e,t,r){return Za(this,e,t,r,!0)},Ka.prototype.lastIndexOf=function(e,t,r){return Za(this,e,t,r,!1)},Ka.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return to(this,e,t,r);case"utf8":case"utf-8":return ro(this,e,t,r);case"ascii":return no(this,e,t,r);case"latin1":case"binary":return io(this,e,t,r);case"base64":return ao(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return oo(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},Ka.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},Ka.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),Ka.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=Ka.prototype;else{var i=t-e;r=new Ka(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},Ka.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Ao(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},Ka.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Ao(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},Ka.prototype.readUInt8=function(e,t){return t||Ao(e,1,this.length),this[e]},Ka.prototype.readUInt16LE=function(e,t){return t||Ao(e,2,this.length),this[e]|this[e+1]<<8},Ka.prototype.readUInt16BE=function(e,t){return t||Ao(e,2,this.length),this[e]<<8|this[e+1]},Ka.prototype.readUInt32LE=function(e,t){return t||Ao(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},Ka.prototype.readUInt32BE=function(e,t){return t||Ao(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},Ka.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Ao(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},Ka.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Ao(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},Ka.prototype.readInt8=function(e,t){return t||Ao(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},Ka.prototype.readInt16LE=function(e,t){t||Ao(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},Ka.prototype.readInt16BE=function(e,t){t||Ao(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},Ka.prototype.readInt32LE=function(e,t){return t||Ao(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},Ka.prototype.readInt32BE=function(e,t){return t||Ao(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},Ka.prototype.readFloatLE=function(e,t){return t||Ao(e,4,this.length),Ua(this,e,!0,23,4)},Ka.prototype.readFloatBE=function(e,t){return t||Ao(e,4,this.length),Ua(this,e,!1,23,4)},Ka.prototype.readDoubleLE=function(e,t){return t||Ao(e,8,this.length),Ua(this,e,!0,52,8)},Ka.prototype.readDoubleBE=function(e,t){return t||Ao(e,8,this.length),Ua(this,e,!1,52,8)},Ka.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||po(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},Ka.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||po(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},Ka.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,1,255,0),Ka.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},Ka.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,2,65535,0),Ka.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):vo(this,e,t,!0),t+2},Ka.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,2,65535,0),Ka.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):vo(this,e,t,!1),t+2},Ka.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,4,4294967295,0),Ka.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):go(this,e,t,!0),t+4},Ka.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,4,4294967295,0),Ka.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):go(this,e,t,!1),t+4},Ka.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);po(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Ka.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);po(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},Ka.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,1,127,-128),Ka.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},Ka.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,2,32767,-32768),Ka.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):vo(this,e,t,!0),t+2},Ka.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,2,32767,-32768),Ka.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):vo(this,e,t,!1),t+2},Ka.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,4,2147483647,-2147483648),Ka.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):go(this,e,t,!0),t+4},Ka.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||po(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),Ka.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):go(this,e,t,!1),t+4},Ka.prototype.writeFloatLE=function(e,t,r){return mo(this,e,t,!0,r)},Ka.prototype.writeFloatBE=function(e,t,r){return mo(this,e,t,!1,r)},Ka.prototype.writeDoubleLE=function(e,t,r){return bo(this,e,t,!0,r)},Ka.prototype.writeDoubleBE=function(e,t,r){return bo(this,e,t,!1,r)},Ka.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!Ka.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},Ka.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Ka.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=Ja(e)?e:ko(new Ka(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var wo=/[^+\/0-9A-Za-z-_]/g;function xo(e){return e<16?"0"+e.toString(16):e.toString(16)}function ko(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function _o(e){return function(e){var t,r,n,i,a,o;Oa||La();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new Ta(3*s/4-a),n=a>0?s-4:s;var u=0;for(t=0,r=0;t<n;t+=4,r+=3)i=Pa[e.charCodeAt(t)]<<18|Pa[e.charCodeAt(t+1)]<<12|Pa[e.charCodeAt(t+2)]<<6|Pa[e.charCodeAt(t+3)],o[u++]=i>>16&255,o[u++]=i>>8&255,o[u++]=255&i;return 2===a?(i=Pa[e.charCodeAt(t)]<<2|Pa[e.charCodeAt(t+1)]>>4,o[u++]=255&i):1===a&&(i=Pa[e.charCodeAt(t)]<<10|Pa[e.charCodeAt(t+1)]<<4|Pa[e.charCodeAt(t+2)]>>2,o[u++]=i>>8&255,o[u++]=255&i),o}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(wo,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Bo(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Eo(e){return null!=e&&(!!e._isBuffer||So(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&So(e.slice(0,0))}(e))}function So(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Co=Ea(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:ja,Buffer:Ka,SlowBuffer:function(e){return+e!=e&&(e=0),Ka.alloc(+e)},isBuffer:Eo})),Io={/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */read:function(e,t,r,n,i){var a,o,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,f=r?i-1:0,h=r?-1:1,A=e[t+f];for(f+=h,a=A&(1<<-l)-1,A>>=-l,l+=s;l>0;a=256*a+e[t+f],f+=h,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+e[t+f],f+=h,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(A?-1:1);o+=Math.pow(2,n),a-=c}return(A?-1:1)*o*Math.pow(2,a-n)},write:function(e,t,r,n,i,a){var o,s,u,c=8*a-i-1,l=(1<<c)-1,f=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:a-1,d=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=l?(s=0,o=l):o+f>=1?(s=(t*u-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+A]=255&s,A+=d,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+A]=255&o,A+=d,o/=256,c-=8);e[r+A-d]|=128*p}},Po={exports:{}};!function(e){!function(t){var r,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,o=Math.floor,s="[BigNumber Error] ",u=s+"Number primitive has more than 15 significant digits: ",c=1e14,l=14,f=9007199254740991,h=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],A=1e7,d=1e9;function p(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,n=1,i=e.length,a=e[0]+"";n<i;){for(t=e[n++]+"",r=l-t.length;r--;t="0"+t);a+=t}for(i=a.length;48===a.charCodeAt(--i););return a.slice(0,i+1||1)}function g(e,t){var r,n,i=e.c,a=t.c,o=e.s,s=t.s,u=e.e,c=t.e;if(!o||!s)return null;if(r=i&&!i[0],n=a&&!a[0],r||n)return r?n?0:-s:o;if(o!=s)return o;if(r=o<0,n=u==c,!i||!a)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(s=(u=i.length)<(c=a.length)?u:c,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^r?1:-1;return u==c?0:u>c^r?1:-1}function y(e,t,r,n){if(e<t||e>r||e!==o(e))throw Error(s+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function m(e){var t=e.c.length-1;return p(e.e/l)==t&&e.c[t]%2!=0}function b(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function w(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}r=function e(t){var r,x,k,_,B,E,S,C,I,P,T=z.prototype={constructor:z,toString:null,valueOf:null},O=new z(1),L=20,N=4,M=-7,U=21,F=-1e7,R=1e7,D=!1,j=1,Q=0,H={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},K="0123456789abcdefghijklmnopqrstuvwxyz",V=!0;function z(e,t){var r,i,a,s,c,h,A,d,p=this;if(!(p instanceof z))return new z(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>R?p.c=p.e=null:e.e<F?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(s=0,c=e;c>=10;c/=10,s++);return void(s>R?p.c=p.e=null:(p.e=s,p.c=[e]))}d=String(e)}else{if(!n.test(d=String(e)))return k(p,d,h);p.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(s=d.indexOf("."))>-1&&(d=d.replace(".","")),(c=d.search(/e/i))>0?(s<0&&(s=c),s+=+d.slice(c+1),d=d.substring(0,c)):s<0&&(s=d.length)}else{if(y(t,2,K.length,"Base"),10==t&&V)return J(p=new z(e),L+p.e+1,N);if(d=String(e),h="number"==typeof e){if(0*e!=0)return k(p,d,h,t);if(p.s=1/e<0?(d=d.slice(1),-1):1,z.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(u+e)}else p.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(r=K.slice(0,t),s=c=0,A=d.length;c<A;c++)if(r.indexOf(i=d.charAt(c))<0){if("."==i){if(c>s){s=A;continue}}else if(!a&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){a=!0,c=-1,s=0;continue}return k(p,String(e),h,t)}h=!1,(s=(d=x(d,t,10,p.s)).indexOf("."))>-1?d=d.replace(".",""):s=d.length}for(c=0;48===d.charCodeAt(c);c++);for(A=d.length;48===d.charCodeAt(--A););if(d=d.slice(c,++A)){if(A-=c,h&&z.DEBUG&&A>15&&(e>f||e!==o(e)))throw Error(u+p.s*e);if((s=s-c-1)>R)p.c=p.e=null;else if(s<F)p.c=[p.e=0];else{if(p.e=s,p.c=[],c=(s+1)%l,s<0&&(c+=l),c<A){for(c&&p.c.push(+d.slice(0,c)),A-=l;c<A;)p.c.push(+d.slice(c,c+=l));c=l-(d=d.slice(c)).length}else c-=A;for(;c--;d+="0");p.c.push(+d)}}else p.c=[p.e=0]}function q(e,t,r,n){var i,a,o,s,u;if(null==r?r=N:y(r,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,null==t)u=v(e.c),u=1==n||2==n&&(o<=M||o>=U)?b(u,o):w(u,o,"0");else if(a=(e=J(new z(e),t,r)).e,s=(u=v(e.c)).length,1==n||2==n&&(t<=a||a<=M)){for(;s<t;u+="0",s++);u=b(u,a)}else if(t-=o,u=w(u,a,"0"),a+1>s){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=a-s)>0)for(a+1==s&&(u+=".");t--;u+="0");return e.s<0&&i?"-"+u:u}function G(e,t){for(var r,n=1,i=new z(e[0]);n<e.length;n++){if(!(r=new z(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function W(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*l-1)>R?e.c=e.e=null:r<F?e.c=[e.e=0]:(e.e=r,e.c=t),e}function J(e,t,r,n){var i,s,u,f,A,d,p,v=e.c,g=h;if(v){e:{for(i=1,f=v[0];f>=10;f/=10,i++);if((s=t-i)<0)s+=l,u=t,p=(A=v[d=0])/g[i-u-1]%10|0;else if((d=a((s+1)/l))>=v.length){if(!n)break e;for(;v.length<=d;v.push(0));A=p=0,i=1,u=(s%=l)-l+1}else{for(A=f=v[d],i=1;f>=10;f/=10,i++);p=(u=(s%=l)-l+i)<0?0:A/g[i-u-1]%10|0}if(n=n||t<0||null!=v[d+1]||(u<0?A:A%g[i-u-1]),n=r<4?(p||n)&&(0==r||r==(e.s<0?3:2)):p>5||5==p&&(4==r||n||6==r&&(s>0?u>0?A/g[i-u]:0:v[d-1])%10&1||r==(e.s<0?8:7)),t<1||!v[0])return v.length=0,n?(t-=e.e+1,v[0]=g[(l-t%l)%l],e.e=-t||0):v[0]=e.e=0,e;if(0==s?(v.length=d,f=1,d--):(v.length=d+1,f=g[l-s],v[d]=u>0?o(A/g[i-u]%g[u])*f:0),n)for(;;){if(0==d){for(s=1,u=v[0];u>=10;u/=10,s++);for(u=v[0]+=f,f=1;u>=10;u/=10,f++);s!=f&&(e.e++,v[0]==c&&(v[0]=1));break}if(v[d]+=f,v[d]!=c)break;v[d--]=0,f=1}for(s=v.length;0===v[--s];v.pop());}e.e>R?e.c=e.e=null:e.e<F&&(e.c=[e.e=0])}return e}function X(e){var t,r=e.e;return null===r?e.toString():(t=v(e.c),t=r<=M||r>=U?b(t,r):w(t,r,"0"),e.s<0?"-"+t:t)}return z.clone=e,z.ROUND_UP=0,z.ROUND_DOWN=1,z.ROUND_CEIL=2,z.ROUND_FLOOR=3,z.ROUND_HALF_UP=4,z.ROUND_HALF_DOWN=5,z.ROUND_HALF_EVEN=6,z.ROUND_HALF_CEIL=7,z.ROUND_HALF_FLOOR=8,z.EUCLID=9,z.config=z.set=function(e){var t,r;if(null!=e){if("object"!=i(e))throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(y(r=e[t],0,d,t),L=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(y(r=e[t],0,8,t),N=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(y(r[0],-d,0,t),y(r[1],0,d,t),M=r[0],U=r[1]):(y(r,-d,d,t),M=-(U=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)y(r[0],-d,-1,t),y(r[1],1,d,t),F=r[0],R=r[1];else{if(y(r,-d,d,t),!r)throw Error(s+t+" cannot be zero: "+r);F=-(R=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(s+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw D=!r,Error(s+"crypto unavailable");D=r}else D=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(y(r=e[t],0,9,t),j=r),e.hasOwnProperty(t="POW_PRECISION")&&(y(r=e[t],0,d,t),Q=r),e.hasOwnProperty(t="FORMAT")){if("object"!=i(r=e[t]))throw Error(s+t+" not an object: "+r);H=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);V="0123456789"==r.slice(0,10),K=r}}return{DECIMAL_PLACES:L,ROUNDING_MODE:N,EXPONENTIAL_AT:[M,U],RANGE:[F,R],CRYPTO:D,MODULO_MODE:j,POW_PRECISION:Q,FORMAT:H,ALPHABET:K}},z.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!z.DEBUG)return!0;var t,r,n=e.c,i=e.e,a=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===a||-1===a)&&i>=-d&&i<=d&&i===o(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%l)<1&&(t+=l),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=c||r!==o(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===a||1===a||-1===a))return!0;throw Error(s+"Invalid BigNumber: "+e)},z.maximum=z.max=function(){return G(arguments,T.lt)},z.minimum=z.min=function(){return G(arguments,T.gt)},z.random=(_=9007199254740992,B=Math.random()*_&2097151?function(){return o(Math.random()*_)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,i,u,c=0,f=[],A=new z(O);if(null==e?e=L:y(e,0,d),i=a(e/l),D)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(i*=2));c<i;)(u=131072*t[c]+(t[c+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[c]=r[0],t[c+1]=r[1]):(f.push(u%1e14),c+=2);c=i/2}else{if(!crypto.randomBytes)throw D=!1,Error(s+"crypto unavailable");for(t=crypto.randomBytes(i*=7);c<i;)(u=281474976710656*(31&t[c])+1099511627776*t[c+1]+4294967296*t[c+2]+16777216*t[c+3]+(t[c+4]<<16)+(t[c+5]<<8)+t[c+6])>=9e15?crypto.randomBytes(7).copy(t,c):(f.push(u%1e14),c+=7);c=i/7}if(!D)for(;c<i;)(u=B())<9e15&&(f[c++]=u%1e14);for(i=f[--c],e%=l,i&&e&&(u=h[l-e],f[c]=o(i/u)*u);0===f[c];f.pop(),c--);if(c<0)f=[n=0];else{for(n=-1;0===f[0];f.splice(0,1),n-=l);for(c=1,u=f[0];u>=10;u/=10,c++);c<l&&(n-=l-c)}return A.e=n,A.c=f,A}),z.sum=function(){for(var e=1,t=arguments,r=new z(t[0]);e<t.length;)r=r.plus(t[e++]);return r},x=function(){var e="0123456789";function t(e,t,r,n){for(var i,a,o=[0],s=0,u=e.length;s<u;){for(a=o.length;a--;o[a]*=t);for(o[0]+=n.indexOf(e.charAt(s++)),i=0;i<o.length;i++)o[i]>r-1&&(null==o[i+1]&&(o[i+1]=0),o[i+1]+=o[i]/r|0,o[i]%=r)}return o.reverse()}return function(n,i,a,o,s){var u,c,l,f,h,A,d,p,g=n.indexOf("."),y=L,m=N;for(g>=0&&(f=Q,Q=0,n=n.replace(".",""),A=(p=new z(i)).pow(n.length-g),Q=f,p.c=t(w(v(A.c),A.e,"0"),10,a,e),p.e=p.c.length),l=f=(d=t(n,i,a,s?(u=K,e):(u=e,K))).length;0==d[--f];d.pop());if(!d[0])return u.charAt(0);if(g<0?--l:(A.c=d,A.e=l,A.s=o,d=(A=r(A,p,y,m,a)).c,h=A.r,l=A.e),g=d[c=l+y+1],f=a/2,h=h||c<0||null!=d[c+1],h=m<4?(null!=g||h)&&(0==m||m==(A.s<0?3:2)):g>f||g==f&&(4==m||h||6==m&&1&d[c-1]||m==(A.s<0?8:7)),c<1||!d[0])n=h?w(u.charAt(1),-y,u.charAt(0)):u.charAt(0);else{if(d.length=c,h)for(--a;++d[--c]>a;)d[c]=0,c||(++l,d=[1].concat(d));for(f=d.length;!d[--f];);for(g=0,n="";g<=f;n+=u.charAt(d[g++]));n=w(n,l,u.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,a,o,s=0,u=e.length,c=t%A,l=t/A|0;for(e=e.slice();u--;)s=((i=c*(a=e[u]%A)+(n=l*a+(o=e[u]/A|0)*c)%A*A+s)/r|0)+(n/A|0)+l*o,e[u]=i%r;return s&&(e=[s].concat(e)),e}function t(e,t,r,n){var i,a;if(r!=n)a=r>n?1:-1;else for(i=a=0;i<r;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,a,s,u){var f,h,A,d,v,g,y,m,b,w,x,k,_,B,E,S,C,I=n.s==i.s?1:-1,P=n.c,T=i.c;if(!(P&&P[0]&&T&&T[0]))return new z(n.s&&i.s&&(P?!T||P[0]!=T[0]:T)?P&&0==P[0]||!T?0*I:I/0:NaN);for(b=(m=new z(I)).c=[],I=a+(h=n.e-i.e)+1,u||(u=c,h=p(n.e/l)-p(i.e/l),I=I/l|0),A=0;T[A]==(P[A]||0);A++);if(T[A]>(P[A]||0)&&h--,I<0)b.push(1),d=!0;else{for(B=P.length,S=T.length,A=0,I+=2,(v=o(u/(T[0]+1)))>1&&(T=e(T,v,u),P=e(P,v,u),S=T.length,B=P.length),_=S,x=(w=P.slice(0,S)).length;x<S;w[x++]=0);C=T.slice(),C=[0].concat(C),E=T[0],T[1]>=u/2&&E++;do{if(v=0,(f=t(T,w,S,x))<0){if(k=w[0],S!=x&&(k=k*u+(w[1]||0)),(v=o(k/E))>1)for(v>=u&&(v=u-1),y=(g=e(T,v,u)).length,x=w.length;1==t(g,w,y,x);)v--,r(g,S<y?C:T,y,u),y=g.length,f=1;else 0==v&&(f=v=1),y=(g=T.slice()).length;if(y<x&&(g=[0].concat(g)),r(w,g,x,u),x=w.length,-1==f)for(;t(T,w,S,x)<1;)v++,r(w,S<x?C:T,x,u),x=w.length}else 0===f&&(v++,w=[0]);b[A++]=v,w[0]?w[x++]=P[_]||0:(w=[P[_]],x=1)}while((_++<B||null!=w[0])&&I--);d=null!=w[0],b[0]||b.splice(0,1)}if(u==c){for(A=1,I=b[0];I>=10;I/=10,A++);J(m,a+(m.e=A+h*l-1)+1,s,d)}else m.e=h,m.r=+d;return m}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,C=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,P=/^\s*\+(?=[\w.])|^\s+|\s+$/g,k=function(e,t,r,n){var i,a=r?t:t.replace(P,"");if(I.test(a))e.s=isNaN(a)?null:a<0?-1:1;else{if(!r&&(a=a.replace(E,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,a=a.replace(S,"$1").replace(C,"0.$1")),t!=a))return new z(a,i);if(z.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},T.absoluteValue=T.abs=function(){var e=new z(this);return e.s<0&&(e.s=1),e},T.comparedTo=function(e,t){return g(this,new z(e,t))},T.decimalPlaces=T.dp=function(e,t){var r,n,i,a=this;if(null!=e)return y(e,0,d),null==t?t=N:y(t,0,8),J(new z(a),e+a.e+1,t);if(!(r=a.c))return null;if(n=((i=r.length-1)-p(this.e/l))*l,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},T.dividedBy=T.div=function(e,t){return r(this,new z(e,t),L,N)},T.dividedToIntegerBy=T.idiv=function(e,t){return r(this,new z(e,t),0,1)},T.exponentiatedBy=T.pow=function(e,t){var r,n,i,u,c,f,h,A,d=this;if((e=new z(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+X(e));if(null!=t&&(t=new z(t)),c=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return A=new z(Math.pow(+X(d),c?2-m(e):+X(e))),t?A.mod(t):A;if(f=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new z(NaN);(n=!f&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||c&&d.c[1]>=24e7:d.c[0]<8e13||c&&d.c[0]<=9999975e7)))return u=d.s<0&&m(e)?-0:0,d.e>-1&&(u=1/u),new z(f?1/u:u);Q&&(u=a(Q/l+2))}for(c?(r=new z(.5),f&&(e.s=1),h=m(e)):h=(i=Math.abs(+X(e)))%2,A=new z(O);;){if(h){if(!(A=A.times(d)).c)break;u?A.c.length>u&&(A.c.length=u):n&&(A=A.mod(t))}if(i){if(0===(i=o(i/2)))break;h=i%2}else if(J(e=e.times(r),e.e+1,1),e.e>14)h=m(e);else{if(0==(i=+X(e)))break;h=i%2}d=d.times(d),u?d.c&&d.c.length>u&&(d.c.length=u):n&&(d=d.mod(t))}return n?A:(f&&(A=O.div(A)),t?A.mod(t):u?J(A,Q,N,void 0):A)},T.integerValue=function(e){var t=new z(this);return null==e?e=N:y(e,0,8),J(t,t.e+1,e)},T.isEqualTo=T.eq=function(e,t){return 0===g(this,new z(e,t))},T.isFinite=function(){return!!this.c},T.isGreaterThan=T.gt=function(e,t){return g(this,new z(e,t))>0},T.isGreaterThanOrEqualTo=T.gte=function(e,t){return 1===(t=g(this,new z(e,t)))||0===t},T.isInteger=function(){return!!this.c&&p(this.e/l)>this.c.length-2},T.isLessThan=T.lt=function(e,t){return g(this,new z(e,t))<0},T.isLessThanOrEqualTo=T.lte=function(e,t){return-1===(t=g(this,new z(e,t)))||0===t},T.isNaN=function(){return!this.s},T.isNegative=function(){return this.s<0},T.isPositive=function(){return this.s>0},T.isZero=function(){return!!this.c&&0==this.c[0]},T.minus=function(e,t){var r,n,i,a,o=this,s=o.s;if(t=(e=new z(e,t)).s,!s||!t)return new z(NaN);if(s!=t)return e.s=-t,o.plus(e);var u=o.e/l,f=e.e/l,h=o.c,A=e.c;if(!u||!f){if(!h||!A)return h?(e.s=-t,e):new z(A?o:NaN);if(!h[0]||!A[0])return A[0]?(e.s=-t,e):new z(h[0]?o:3==N?-0:0)}if(u=p(u),f=p(f),h=h.slice(),s=u-f){for((a=s<0)?(s=-s,i=h):(f=u,i=A),i.reverse(),t=s;t--;i.push(0));i.reverse()}else for(n=(a=(s=h.length)<(t=A.length))?s:t,s=t=0;t<n;t++)if(h[t]!=A[t]){a=h[t]<A[t];break}if(a&&(i=h,h=A,A=i,e.s=-e.s),(t=(n=A.length)-(r=h.length))>0)for(;t--;h[r++]=0);for(t=c-1;n>s;){if(h[--n]<A[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r],h[n]+=c}h[n]-=A[n]}for(;0==h[0];h.splice(0,1),--f);return h[0]?W(e,h,f):(e.s=3==N?-1:1,e.c=[e.e=0],e)},T.modulo=T.mod=function(e,t){var n,i,a=this;return e=new z(e,t),!a.c||!e.s||e.c&&!e.c[0]?new z(NaN):!e.c||a.c&&!a.c[0]?new z(a):(9==j?(i=e.s,e.s=1,n=r(a,e,0,3),e.s=i,n.s*=i):n=r(a,e,0,j),(e=a.minus(n.times(e))).c[0]||1!=j||(e.s=a.s),e)},T.multipliedBy=T.times=function(e,t){var r,n,i,a,o,s,u,f,h,d,v,g,y,m,b,w=this,x=w.c,k=(e=new z(e,t)).c;if(!(x&&k&&x[0]&&k[0]))return!w.s||!e.s||x&&!x[0]&&!k||k&&!k[0]&&!x?e.c=e.e=e.s=null:(e.s*=w.s,x&&k?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=p(w.e/l)+p(e.e/l),e.s*=w.s,(u=x.length)<(d=k.length)&&(y=x,x=k,k=y,i=u,u=d,d=i),i=u+d,y=[];i--;y.push(0));for(m=c,b=A,i=d;--i>=0;){for(r=0,v=k[i]%b,g=k[i]/b|0,a=i+(o=u);a>i;)r=((f=v*(f=x[--o]%b)+(s=g*f+(h=x[o]/b|0)*v)%b*b+y[a]+r)/m|0)+(s/b|0)+g*h,y[a--]=f%m;y[a]=r}return r?++n:y.splice(0,1),W(e,y,n)},T.negated=function(){var e=new z(this);return e.s=-e.s||null,e},T.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new z(e,t)).s,!i||!t)return new z(NaN);if(i!=t)return e.s=-t,n.minus(e);var a=n.e/l,o=e.e/l,s=n.c,u=e.c;if(!a||!o){if(!s||!u)return new z(i/0);if(!s[0]||!u[0])return u[0]?e:new z(s[0]?n:0*i)}if(a=p(a),o=p(o),s=s.slice(),i=a-o){for(i>0?(o=a,r=u):(i=-i,r=s),r.reverse();i--;r.push(0));r.reverse()}for((i=s.length)-(t=u.length)<0&&(r=u,u=s,s=r,t=i),i=0;t;)i=(s[--t]=s[t]+u[t]+i)/c|0,s[t]=c===s[t]?0:s[t]%c;return i&&(s=[i].concat(s),++o),W(e,s,o)},T.precision=T.sd=function(e,t){var r,n,i,a=this;if(null!=e&&e!==!!e)return y(e,1,d),null==t?t=N:y(t,0,8),J(new z(a),e,t);if(!(r=a.c))return null;if(n=(i=r.length-1)*l+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&a.e+1>n&&(n=a.e+1),n},T.shiftedBy=function(e){return y(e,-9007199254740991,f),this.times("1e"+e)},T.squareRoot=T.sqrt=function(){var e,t,n,i,a,o=this,s=o.c,u=o.s,c=o.e,l=L+4,f=new z("0.5");if(1!==u||!s||!s[0])return new z(!u||u<0&&(!s||s[0])?NaN:s?o:1/0);if(0==(u=Math.sqrt(+X(o)))||u==1/0?(((t=v(s)).length+c)%2==0&&(t+="0"),u=Math.sqrt(+t),c=p((c+1)/2)-(c<0||c%2),n=new z(t=u==1/0?"5e"+c:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+c)):n=new z(u+""),n.c[0])for((u=(c=n.e)+l)<3&&(u=0);;)if(a=n,n=f.times(a.plus(r(o,a,l,1))),v(a.c).slice(0,u)===(t=v(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(t=t.slice(u-3,u+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(J(n,n.e+L+2,1),e=!n.times(n).eq(o));break}if(!i&&(J(a,a.e+L+2,0),a.times(a).eq(o))){n=a;break}l+=4,u+=4,i=1}return J(n,n.e+L+1,N,e)},T.toExponential=function(e,t){return null!=e&&(y(e,0,d),e++),q(this,e,t,1)},T.toFixed=function(e,t){return null!=e&&(y(e,0,d),e=e+this.e+1),q(this,e,t)},T.toFormat=function(e,t,r){var n,a=this;if(null==r)null!=e&&t&&"object"==i(t)?(r=t,t=null):e&&"object"==i(e)?(r=e,e=t=null):r=H;else if("object"!=i(r))throw Error(s+"Argument not an object: "+r);if(n=a.toFixed(e,t),a.c){var o,u=n.split("."),c=+r.groupSize,l=+r.secondaryGroupSize,f=r.groupSeparator||"",h=u[0],A=u[1],d=a.s<0,p=d?h.slice(1):h,v=p.length;if(l&&(o=c,c=l,l=o,v-=o),c>0&&v>0){for(o=v%c||c,h=p.substr(0,o);o<v;o+=c)h+=f+p.substr(o,c);l>0&&(h+=f+p.slice(o)),d&&(h="-"+h)}n=A?h+(r.decimalSeparator||"")+((l=+r.fractionGroupSize)?A.replace(new RegExp("\\d{"+l+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):A):h}return(r.prefix||"")+n+(r.suffix||"")},T.toFraction=function(e){var t,n,i,a,o,u,c,f,A,d,p,g,y=this,m=y.c;if(null!=e&&(!(c=new z(e)).isInteger()&&(c.c||1!==c.s)||c.lt(O)))throw Error(s+"Argument "+(c.isInteger()?"out of range: ":"not an integer: ")+X(c));if(!m)return new z(y);for(t=new z(O),A=n=new z(O),i=f=new z(O),g=v(m),o=t.e=g.length-y.e-1,t.c[0]=h[(u=o%l)<0?l+u:u],e=!e||c.comparedTo(t)>0?o>0?t:A:c,u=R,R=1/0,c=new z(g),f.c[0]=0;d=r(c,t,0,1),1!=(a=n.plus(d.times(i))).comparedTo(e);)n=i,i=a,A=f.plus(d.times(a=A)),f=a,t=c.minus(d.times(a=t)),c=a;return a=r(e.minus(n),i,0,1),f=f.plus(a.times(A)),n=n.plus(a.times(i)),f.s=A.s=y.s,p=r(A,i,o*=2,N).minus(y).abs().comparedTo(r(f,n,o,N).minus(y).abs())<1?[A,i]:[f,n],R=u,p},T.toNumber=function(){return+X(this)},T.toPrecision=function(e,t){return null!=e&&y(e,1,d),q(this,e,t,2)},T.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=M||i>=U?b(v(r.c),i):w(v(r.c),i,"0"):10===e&&V?t=w(v((r=J(new z(r),L+i+1,N)).c),r.e,"0"):(y(e,2,K.length,"Base"),t=x(w(v(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},T.valueOf=T.toJSON=function(){return X(this)},T._isBigNumber=!0,null!=t&&z.set(t),z}(),r.default=r.BigNumber=r,e.exports?e.exports=r:(t||(t="undefined"!=typeof self&&self?self:window),t.BigNumber=r)}(Ba)}(Po);var To={},Oo={},Lo=Po.exports.BigNumber;Oo.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},Oo.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},Oo.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},Oo.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},Oo.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},Oo.SHIFT32=Math.pow(2,32),Oo.SHIFT16=Math.pow(2,16),Oo.MAX_SAFE_HIGH=2097151,Oo.NEG_ONE=new Lo(-1),Oo.TEN=new Lo(10),Oo.TWO=new Lo(2),Oo.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5},function(e){var t=Co.Buffer,r=Po.exports.BigNumber,n=Oo,i=n.SHIFT32,a=n.SHIFT16;function o(e){return e<16?"0"+e.toString(16):e.toString(16)}e.parseHalf=function(e){var t,r,n;return n=128&e[0]?-1:1,t=(124&e[0])>>2,r=(3&e[0])<<8|e[1],t?31===t?n*(r?NaN:1/0):n*Math.pow(2,t-25)*(1024+r):5.960464477539063e-8*n*r},e.arrayBufferToBignumber=function(e){for(var t=e.byteLength,n="",i=0;i<t;i++)n+=o(e[i]);return new r(n,16)},e.buildMap=function(e){for(var t=new Map,r=Object.keys(e),n=r.length,i=0;i<n;i++)t.set(r[i],e[r[i]]);return t},e.buildInt32=function(e,t){return e*a+t},e.buildInt64=function(t,n,a,o){var s=e.buildInt32(t,n),u=e.buildInt32(a,o);return s>2097151?new r(s).times(i).plus(u):s*i+u},e.writeHalf=function(e,r){var n=t.allocUnsafe(4);n.writeFloatBE(r,0);var i=n.readUInt32BE(0);if(0!=(8191&i))return!1;var a=i>>16&32768,o=i>>23&255,s=8388607&i;if(o>=113&&o<=142)a+=(o-112<<10)+(s>>13);else{if(!(o>=103&&o<113))return!1;if(s&(1<<126-o)-1)return!1;a+=s+8388608>>126-o}return e.writeUInt16BE(a,0),!0},e.keySorter=function(e,t){var r=e[0].byteLength,n=t[0].byteLength;return r>n?1:n>r?-1:e[0].compare(t[0])},e.isNegativeZero=function(e){return 0===e&&1/e<0},e.nextPowerOf2=function(e){var t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<<t}}(To);var No=Oo,Mo=No.MT,Uo=No.SIMPLE,Fo=No.SYMS,Ro=function(){function e(t){if(s(this,e),"number"!=typeof t)throw new Error("Invalid Simple type: "+i(t));if(t<0||t>255||(0|t)!==t)throw new Error("value must be a small positive integer: "+t);this.value=t}return c(e,[{key:"toString",value:function(){return"simple("+this.value+")"}},{key:"inspect",value:function(){return"simple("+this.value+")"}},{key:"encodeCBOR",value:function(e){return e._pushInt(this.value,Mo.SIMPLE_FLOAT)}}],[{key:"isSimple",value:function(t){return t instanceof e}},{key:"decode",value:function(t,r){switch(null==r&&(r=!0),t){case Uo.FALSE:return!1;case Uo.TRUE:return!0;case Uo.NULL:return r?null:Fo.NULL;case Uo.UNDEFINED:return r?void 0:Fo.UNDEFINED;case-1:if(!r)throw new Error("Invalid BREAK");return Fo.BREAK;default:return new e(t)}}}]),e}(),Do=Ro,jo=function(){function e(t,r,n){if(s(this,e),this.tag=t,this.value=r,this.err=n,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+i(this.tag)+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}return c(e,[{key:"toString",value:function(){return"".concat(this.tag,"(").concat(JSON.stringify(this.value),")")}},{key:"encodeCBOR",value:function(e){return e._pushTag(this.tag),e.pushAny(this.value)}},{key:"convert",value:function(t){var r,n;if("function"!=typeof(n=null!=t?t[this.tag]:void 0)&&"function"!=typeof(n=e["_tag"+this.tag]))return this;try{return n.call(e,this.value)}catch(t){return r=t,this.err=r,this}}}]),e}(),Qo=jo,Ho=self.location?self.location.protocol+"//"+self.location.host:"",Ko=self.URL,Vo={URLWithLegacySupport:function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ho;s(this,e),this.super=new Ko(t,r),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}return c(e,[{key:"hash",get:function(){return this.super.hash},set:function(e){this.super.hash=e}},{key:"host",get:function(){return this.super.host},set:function(e){this.super.host=e}},{key:"hostname",get:function(){return this.super.hostname},set:function(e){this.super.hostname=e}},{key:"href",get:function(){return this.super.href},set:function(e){this.super.href=e}},{key:"origin",get:function(){return this.super.origin},set:function(e){this.super.origin=e}},{key:"password",get:function(){return this.super.password},set:function(e){this.super.password=e}},{key:"pathname",get:function(){return this.super.pathname},set:function(e){this.super.pathname=e}},{key:"port",get:function(){return this.super.port},set:function(e){this.super.port=e}},{key:"protocol",get:function(){return this.super.protocol},set:function(e){this.super.protocol=e}},{key:"search",get:function(){return this.super.search},set:function(e){this.super.search=e}},{key:"searchParams",get:function(){return this.super.searchParams},set:function(e){this.super.searchParams=e}},{key:"username",get:function(){return this.super.username},set:function(e){this.super.username=e}},{key:"createObjectURL",value:function(e){return this.super.createObjectURL(e)}},{key:"revokeObjectURL",value:function(e){this.super.revokeObjectURL(e)}},{key:"toJSON",value:function(){return this.super.toJSON()}},{key:"toString",value:function(){return this.super.toString()}},{key:"format",value:function(){return this.toString()}}]),e}(),URLSearchParams:self.URLSearchParams,defaultBase:Ho,format:function(e){if("string"==typeof e)return new Ko(e).toString();if(!(e instanceof Ko)){var t=e.username&&e.password?"".concat(e.username,":").concat(e.password,"@"):"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",a=e.host||"",o=e.hostname||"",s=e.search||(e.query?"?"+e.query:""),u=e.hash||"",c=e.pathname||"";return"".concat(i).concat(t||r).concat(a||o+n).concat(e.path||c+s).concat(u)}}},zo=Vo.URLWithLegacySupport,qo=Vo.format,Go={URL:Vo.URLWithLegacySupport,URLSearchParams:Vo.URLSearchParams,format:Vo.format,relative:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0,a=r.protocol?r.protocol.replace(":",""):"http";a=(n[a]||i||a)+":";try{t=new zo(e)}catch(e){t={}}var o=Object.assign({},r,{protocol:a||t.protocol,host:r.host||t.host});return new zo(e,qo(o)).toString()},defaultBase:Vo.defaultBase},Wo=Co.Buffer,Jo=Io,Xo=Po.exports.BigNumber,Yo=To,$o=Oo,Zo=Do,es=Qo,ts=Go.URL,rs=function(){function e(t){s(this,e),!(t=t||{}).size||t.size<65536?t.size=65536:t.size=Yo.nextPowerOf2(t.size),this._heap=new ArrayBuffer(t.size),this._heap8=new Uint8Array(this._heap),this._buffer=Wo.from(this._heap),this._reset(),this._knownTags=Object.assign({0:function(e){return new Date(e)},1:function(e){return new Date(1e3*e)},2:function(e){return Yo.arrayBufferToBignumber(e)},3:function(e){return $o.NEG_ONE.minus(Yo.arrayBufferToBignumber(e))},4:function(e){return $o.TEN.pow(e[0]).times(e[1])},5:function(e){return $o.TWO.pow(e[0]).times(e[1])},32:function(e){return new ts(e)},35:function(e){return new RegExp(e)}},t.tags),this.parser=function(e,t,r){"use asm";var n=new e.Uint8Array(r),i=t.pushInt,a=t.pushInt32,o=t.pushInt32Neg,s=t.pushInt64,u=t.pushInt64Neg,c=t.pushFloat,l=t.pushFloatSingle,f=t.pushFloatDouble,h=t.pushTrue,A=t.pushFalse,d=t.pushUndefined,p=t.pushNull,v=t.pushInfinity,g=t.pushInfinityNeg,y=t.pushNaN,m=t.pushNaNNeg,b=t.pushArrayStart,w=t.pushArrayStartFixed,x=t.pushArrayStartFixed32,k=t.pushArrayStartFixed64,_=t.pushObjectStart,B=t.pushObjectStartFixed,E=t.pushObjectStartFixed32,S=t.pushObjectStartFixed64,C=t.pushByteString,I=t.pushByteStringStart,P=t.pushUtf8String,T=t.pushUtf8StringStart,O=t.pushSimpleUnassigned,L=t.pushTagStart,N=t.pushTagStart4,M=t.pushTagStart8,U=t.pushTagUnassigned,F=t.pushBreak,R=e.Math.pow,D=0,j=0,Q=0;function H(e){e=e|0;D=0;j=e;while((D|0)<(j|0)){Q=Xe[n[D]&255](n[D]|0)|0;if((Q|0)>0){break}}return Q|0}function K(e){e=e|0;if(((D|0)+(e|0)|0)<(j|0)){return 0}return 1}function V(e){e=e|0;return n[e|0]<<8|n[e+1|0]|0}function z(e){e=e|0;return n[e|0]<<24|n[e+1|0]<<16|n[e+2|0]<<8|n[e+3|0]|0}function q(e){e=e|0;i(e|0);D=D+1|0;return 0}function G(e){e=e|0;if(K(1)|0){return 1}i(n[D+1|0]|0);D=D+2|0;return 0}function W(e){e=e|0;if(K(2)|0){return 1}i(V(D+1|0)|0);D=D+3|0;return 0}function J(e){e=e|0;if(K(4)|0){return 1}a(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function X(e){e=e|0;if(K(8)|0){return 1}s(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function Y(e){e=e|0;i(-1-(e-32|0)|0);D=D+1|0;return 0}function $(e){e=e|0;if(K(1)|0){return 1}i(-1-(n[D+1|0]|0)|0);D=D+2|0;return 0}function Z(e){e=e|0;var t=0;if(K(2)|0){return 1}t=V(D+1|0)|0;i(-1-(t|0)|0);D=D+3|0;return 0}function ee(e){e=e|0;if(K(4)|0){return 1}o(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function te(e){e=e|0;if(K(8)|0){return 1}u(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function re(e){e=e|0;var t=0;var r=0;var n=0;n=e-64|0;if(K(n|0)|0){return 1}t=D+1|0;r=(D+1|0)+(n|0)|0;C(t|0,r|0);D=r|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var i=0;if(K(1)|0){return 1}i=n[D+1|0]|0;t=D+2|0;r=(D+2|0)+(i|0)|0;if(K(i+1|0)|0){return 1}C(t|0,r|0);D=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=V(D+1|0)|0;t=D+3|0;r=(D+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}C(t|0,r|0);D=r|0;return 0}function ae(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=z(D+1|0)|0;t=D+5|0;r=(D+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}C(t|0,r|0);D=r|0;return 0}function oe(e){e=e|0;return 1}function se(e){e=e|0;I();D=D+1|0;return 0}function ue(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(K(n|0)|0){return 1}t=D+1|0;r=(D+1|0)+(n|0)|0;P(t|0,r|0);D=r|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var i=0;if(K(1)|0){return 1}i=n[D+1|0]|0;t=D+2|0;r=(D+2|0)+(i|0)|0;if(K(i+1|0)|0){return 1}P(t|0,r|0);D=r|0;return 0}function le(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=V(D+1|0)|0;t=D+3|0;r=(D+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}P(t|0,r|0);D=r|0;return 0}function fe(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=z(D+1|0)|0;t=D+5|0;r=(D+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}P(t|0,r|0);D=r|0;return 0}function he(e){e=e|0;return 1}function Ae(e){e=e|0;T();D=D+1|0;return 0}function de(e){e=e|0;w(e-128|0);D=D+1|0;return 0}function pe(e){e=e|0;if(K(1)|0){return 1}w(n[D+1|0]|0);D=D+2|0;return 0}function ve(e){e=e|0;if(K(2)|0){return 1}w(V(D+1|0)|0);D=D+3|0;return 0}function ge(e){e=e|0;if(K(4)|0){return 1}x(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function ye(e){e=e|0;if(K(8)|0){return 1}k(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function me(e){e=e|0;b();D=D+1|0;return 0}function be(e){e=e|0;var t=0;t=e-160|0;if(K(t|0)|0){return 1}B(t|0);D=D+1|0;return 0}function we(e){e=e|0;if(K(1)|0){return 1}B(n[D+1|0]|0);D=D+2|0;return 0}function xe(e){e=e|0;if(K(2)|0){return 1}B(V(D+1|0)|0);D=D+3|0;return 0}function ke(e){e=e|0;if(K(4)|0){return 1}E(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function _e(e){e=e|0;if(K(8)|0){return 1}S(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function Be(e){e=e|0;_();D=D+1|0;return 0}function Ee(e){e=e|0;L(e-192|0|0);D=D+1|0;return 0}function Se(e){e|0;L(e|0);D=D+1|0;return 0}function Ce(e){e|0;L(e|0);D=D+1|0;return 0}function Ie(e){e|0;L(e|0);D=D+1|0;return 0}function Pe(e){e|0;L(e|0);D=D+1|0;return 0}function Te(e){e=e|0;L(e-192|0|0);D=D+1|0;return 0}function Oe(e){e|0;L(e|0);D=D+1|0;return 0}function Le(e){e|0;L(e|0);D=D+1|0;return 0}function Ne(e){e|0;L(e|0);D=D+1|0;return 0}function Me(e){e=e|0;if(K(1)|0){return 1}L(n[D+1|0]|0);D=D+2|0;return 0}function Ue(e){e=e|0;if(K(2)|0){return 1}L(V(D+1|0)|0);D=D+3|0;return 0}function Fe(e){e=e|0;if(K(4)|0){return 1}N(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function Re(e){e=e|0;if(K(8)|0){return 1}M(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function De(e){e=e|0;O((e|0)-224|0);D=D+1|0;return 0}function je(e){e=e|0;A();D=D+1|0;return 0}function Qe(e){e=e|0;h();D=D+1|0;return 0}function He(e){e=e|0;p();D=D+1|0;return 0}function Ke(e){e=e|0;d();D=D+1|0;return 0}function Ve(e){e=e|0;if(K(1)|0){return 1}O(n[D+1|0]|0);D=D+2|0;return 0}function ze(e){e=e|0;var t=0;var r=0;var i=1.0;var a=0.0;var o=0.0;var s=0.0;if(K(2)|0){return 1}t=n[D+1|0]|0;r=n[D+2|0]|0;if((t|0)&0x80){i=-1.0}a=+(((t|0)&0x7C)>>2);o=+(((t|0)&0x03)<<8|r);if(+a==0.0){c(+(+i*+5.9604644775390625e-8*+o))}else if(+a==31.0){if(+i==1.0){if(+o>0.0){y()}else{v()}}else{if(+o>0.0){m()}else{g()}}}else{c(+(+i*R(+2,+(+a-25.0))*+(1024.0+o)))}D=D+3|0;return 0}function qe(e){e=e|0;if(K(4)|0){return 1}l(n[D+1|0]|0,n[D+2|0]|0,n[D+3|0]|0,n[D+4|0]|0);D=D+5|0;return 0}function Ge(e){e=e|0;if(K(8)|0){return 1}f(n[D+1|0]|0,n[D+2|0]|0,n[D+3|0]|0,n[D+4|0]|0,n[D+5|0]|0,n[D+6|0]|0,n[D+7|0]|0,n[D+8|0]|0);D=D+9|0;return 0}function We(e){e=e|0;return 1}function Je(e){e=e|0;F();D=D+1|0;return 0}var Xe=[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,G,W,J,X,We,We,We,We,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,$,Z,ee,te,We,We,We,We,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,ne,ie,ae,oe,We,We,We,se,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ue,ce,le,fe,he,We,We,We,Ae,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,pe,ve,ge,ye,We,We,We,me,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,we,xe,ke,_e,We,We,We,Be,Ee,Ee,Ee,Ee,Ee,Ee,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Me,Ue,Fe,Re,We,We,We,We,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,je,Qe,He,Ke,Ve,ze,qe,Ge,We,We,We,Je];return{parse:H}}(Ba,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}return c(e,[{key:"_depth",get:function(){return this._parents.length}},{key:"_currentParent",get:function(){return this._parents[this._depth-1]}},{key:"_ref",get:function(){return this._currentParent.ref}},{key:"_closeParent",value:function(){var e=this._parents.pop();if(e.length>0)throw new Error("Missing ".concat(e.length," elements"));switch(e.type){case $o.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case $o.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case $o.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case $o.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case $o.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case $o.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===$o.PARENT.TAG&&this._dec()}},{key:"_dec",value:function(){var e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}},{key:"_push",value:function(e,t){var r=this._currentParent;switch(r.values++,r.type){case $o.PARENT.ARRAY:case $o.PARENT.BYTE_STRING:case $o.PARENT.UTF8_STRING:r.length>-1?this._ref[this._ref.length-r.length]=e:this._ref.push(e),this._dec();break;case $o.PARENT.OBJECT:null!=r.tmpKey?(this._ref[r.tmpKey]=e,r.tmpKey=null,this._dec()):(r.tmpKey=e,"string"!=typeof r.tmpKey&&(r.type=$o.PARENT.MAP,r.ref=Yo.buildMap(r.ref)));break;case $o.PARENT.MAP:null!=r.tmpKey?(this._ref.set(r.tmpKey,e),r.tmpKey=null,this._dec()):r.tmpKey=e;break;case $o.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}},{key:"_createParent",value:function(e,t,r){this._parents[this._depth]={type:t,length:r,ref:e,values:0,tmpKey:null}}},{key:"_reset",value:function(){this._res=[],this._parents=[{type:$o.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}},{key:"createTag",value:function(e,t){var r=this._knownTags[e];return r?r(t):new es(e,t)}},{key:"createMap",value:function(e,t){return e}},{key:"createObject",value:function(e,t){return e}},{key:"createArray",value:function(e,t){return e}},{key:"createByteString",value:function(e,t){return Wo.concat(e)}},{key:"createByteStringFromHeap",value:function(e,t){return e===t?Wo.alloc(0):Wo.from(this._heap.slice(e,t))}},{key:"createInt",value:function(e){return e}},{key:"createInt32",value:function(e,t){return Yo.buildInt32(e,t)}},{key:"createInt64",value:function(e,t,r,n){return Yo.buildInt64(e,t,r,n)}},{key:"createFloat",value:function(e){return e}},{key:"createFloatSingle",value:function(e,t,r,n){return Jo.read([e,t,r,n],0,!1,23,4)}},{key:"createFloatDouble",value:function(e,t,r,n,i,a,o,s){return Jo.read([e,t,r,n,i,a,o,s],0,!1,52,8)}},{key:"createInt32Neg",value:function(e,t){return-1-Yo.buildInt32(e,t)}},{key:"createInt64Neg",value:function(e,t,r,n){var i=Yo.buildInt32(e,t),a=Yo.buildInt32(r,n);return i>$o.MAX_SAFE_HIGH?$o.NEG_ONE.minus(new Xo(i).times($o.SHIFT32).plus(a)):-1-(i*$o.SHIFT32+a)}},{key:"createTrue",value:function(){return!0}},{key:"createFalse",value:function(){return!1}},{key:"createNull",value:function(){return null}},{key:"createUndefined",value:function(){}},{key:"createInfinity",value:function(){return 1/0}},{key:"createInfinityNeg",value:function(){return-1/0}},{key:"createNaN",value:function(){return NaN}},{key:"createNaNNeg",value:function(){return NaN}},{key:"createUtf8String",value:function(e,t){return e.join("")}},{key:"createUtf8StringFromHeap",value:function(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}},{key:"createSimpleUnassigned",value:function(e){return new Zo(e)}},{key:"pushInt",value:function(e){this._push(this.createInt(e))}},{key:"pushInt32",value:function(e,t){this._push(this.createInt32(e,t))}},{key:"pushInt64",value:function(e,t,r,n){this._push(this.createInt64(e,t,r,n))}},{key:"pushFloat",value:function(e){this._push(this.createFloat(e))}},{key:"pushFloatSingle",value:function(e,t,r,n){this._push(this.createFloatSingle(e,t,r,n))}},{key:"pushFloatDouble",value:function(e,t,r,n,i,a,o,s){this._push(this.createFloatDouble(e,t,r,n,i,a,o,s))}},{key:"pushInt32Neg",value:function(e,t){this._push(this.createInt32Neg(e,t))}},{key:"pushInt64Neg",value:function(e,t,r,n){this._push(this.createInt64Neg(e,t,r,n))}},{key:"pushTrue",value:function(){this._push(this.createTrue())}},{key:"pushFalse",value:function(){this._push(this.createFalse())}},{key:"pushNull",value:function(){this._push(this.createNull())}},{key:"pushUndefined",value:function(){this._push(this.createUndefined())}},{key:"pushInfinity",value:function(){this._push(this.createInfinity())}},{key:"pushInfinityNeg",value:function(){this._push(this.createInfinityNeg())}},{key:"pushNaN",value:function(){this._push(this.createNaN())}},{key:"pushNaNNeg",value:function(){this._push(this.createNaNNeg())}},{key:"pushArrayStart",value:function(){this._createParent([],$o.PARENT.ARRAY,-1)}},{key:"pushArrayStartFixed",value:function(e){this._createArrayStartFixed(e)}},{key:"pushArrayStartFixed32",value:function(e,t){var r=Yo.buildInt32(e,t);this._createArrayStartFixed(r)}},{key:"pushArrayStartFixed64",value:function(e,t,r,n){var i=Yo.buildInt64(e,t,r,n);this._createArrayStartFixed(i)}},{key:"pushObjectStart",value:function(){this._createObjectStartFixed(-1)}},{key:"pushObjectStartFixed",value:function(e){this._createObjectStartFixed(e)}},{key:"pushObjectStartFixed32",value:function(e,t){var r=Yo.buildInt32(e,t);this._createObjectStartFixed(r)}},{key:"pushObjectStartFixed64",value:function(e,t,r,n){var i=Yo.buildInt64(e,t,r,n);this._createObjectStartFixed(i)}},{key:"pushByteStringStart",value:function(){this._parents[this._depth]={type:$o.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}},{key:"pushByteString",value:function(e,t){this._push(this.createByteStringFromHeap(e,t))}},{key:"pushUtf8StringStart",value:function(){this._parents[this._depth]={type:$o.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}},{key:"pushUtf8String",value:function(e,t){this._push(this.createUtf8StringFromHeap(e,t))}},{key:"pushSimpleUnassigned",value:function(e){this._push(this.createSimpleUnassigned(e))}},{key:"pushTagStart",value:function(e){this._parents[this._depth]={type:$o.PARENT.TAG,length:1,ref:[e]}}},{key:"pushTagStart4",value:function(e,t){this.pushTagStart(Yo.buildInt32(e,t))}},{key:"pushTagStart8",value:function(e,t,r,n){this.pushTagStart(Yo.buildInt64(e,t,r,n))}},{key:"pushTagUnassigned",value:function(e){this._push(this.createTag(e))}},{key:"pushBreak",value:function(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}},{key:"_createObjectStartFixed",value:function(e){0!==e?this._createParent({},$o.PARENT.OBJECT,e):this._push(this.createObject({}))}},{key:"_createArrayStartFixed",value:function(e){0!==e?this._createParent(new Array(e),$o.PARENT.ARRAY,e):this._push(this.createArray([]))}},{key:"_decode",value:function(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);var t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}},{key:"decodeFirst",value:function(e){return this._decode(e),this._res[0]}},{key:"decodeAll",value:function(e){return this._decode(e),this._res}}],[{key:"decode",value:function(t,r){return"string"==typeof t&&(t=Wo.from(t,r||"hex")),new e({size:t.length}).decodeFirst(t)}},{key:"decodeAll",value:function(t,r){return"string"==typeof t&&(t=Wo.from(t,r||"hex")),new e({size:t.length}).decodeAll(t)}}]),e}();rs.decodeFirst=rs.decode;var ns=rs,is=Co.Buffer,as=To,os=function(e){f(r,e);var t=w(r);function r(){return s(this,r),t.apply(this,arguments)}return c(r,[{key:"createTag",value:function(e,t){return"".concat(e,"(").concat(t,")")}},{key:"createInt",value:function(e){return k(h(r.prototype),"createInt",this).call(this,e).toString()}},{key:"createInt32",value:function(e,t){return k(h(r.prototype),"createInt32",this).call(this,e,t).toString()}},{key:"createInt64",value:function(e,t,n,i){return k(h(r.prototype),"createInt64",this).call(this,e,t,n,i).toString()}},{key:"createInt32Neg",value:function(e,t){return k(h(r.prototype),"createInt32Neg",this).call(this,e,t).toString()}},{key:"createInt64Neg",value:function(e,t,n,i){return k(h(r.prototype),"createInt64Neg",this).call(this,e,t,n,i).toString()}},{key:"createTrue",value:function(){return"true"}},{key:"createFalse",value:function(){return"false"}},{key:"createFloat",value:function(e){var t=k(h(r.prototype),"createFloat",this).call(this,e);return as.isNegativeZero(e)?"-0_1":"".concat(t,"_1")}},{key:"createFloatSingle",value:function(e,t,n,i){return"".concat(k(h(r.prototype),"createFloatSingle",this).call(this,e,t,n,i),"_2")}},{key:"createFloatDouble",value:function(e,t,n,i,a,o,s,u){return"".concat(k(h(r.prototype),"createFloatDouble",this).call(this,e,t,n,i,a,o,s,u),"_3")}},{key:"createByteString",value:function(e,t){var r=e.join(", ");return-1===t?"(_ ".concat(r,")"):"h'".concat(r)}},{key:"createByteStringFromHeap",value:function(e,t){return"h'".concat(is.from(k(h(r.prototype),"createByteStringFromHeap",this).call(this,e,t)).toString("hex"),"'")}},{key:"createInfinity",value:function(){return"Infinity_1"}},{key:"createInfinityNeg",value:function(){return"-Infinity_1"}},{key:"createNaN",value:function(){return"NaN_1"}},{key:"createNaNNeg",value:function(){return"-NaN_1"}},{key:"createNull",value:function(){return"null"}},{key:"createUndefined",value:function(){return"undefined"}},{key:"createSimpleUnassigned",value:function(e){return"simple(".concat(e,")")}},{key:"createArray",value:function(e,t){var n=k(h(r.prototype),"createArray",this).call(this,e,t);return-1===t?"[_ ".concat(n.join(", "),"]"):"[".concat(n.join(", "),"]")}},{key:"createMap",value:function(e,t){var n=k(h(r.prototype),"createMap",this).call(this,e),i=Array.from(n.keys()).reduce(us(n),"");return-1===t?"{_ ".concat(i,"}"):"{".concat(i,"}")}},{key:"createObject",value:function(e,t){var n=k(h(r.prototype),"createObject",this).call(this,e),i=Object.keys(n).reduce(us(n),"");return-1===t?"{_ ".concat(i,"}"):"{".concat(i,"}")}},{key:"createUtf8String",value:function(e,t){var r=e.join(", ");return-1===t?"(_ ".concat(r,")"):'"'.concat(r,'"')}},{key:"createUtf8StringFromHeap",value:function(e,t){return'"'.concat(is.from(k(h(r.prototype),"createUtf8StringFromHeap",this).call(this,e,t)).toString("utf8"),'"')}}],[{key:"diagnose",value:function(e,t){return"string"==typeof e&&(e=is.from(e,t||"hex")),(new r).decodeFirst(e)}}]),r}(ns),ss=os;function us(e){return function(t,r){return t?"".concat(t,", ").concat(r,": ").concat(e[r]):"".concat(r,": ").concat(e[r])}}var cs=Co.Buffer,ls=Go.URL,fs=Po.exports.BigNumber,hs=To,As=Oo,ds=As.MT,ps=As.NUMBYTES,vs=As.SHIFT32,gs=As.SYMS,ys=As.TAG,ms=As.MT.SIMPLE_FLOAT<<5|As.NUMBYTES.TWO,bs=As.MT.SIMPLE_FLOAT<<5|As.NUMBYTES.FOUR,ws=As.MT.SIMPLE_FLOAT<<5|As.NUMBYTES.EIGHT,xs=As.MT.SIMPLE_FLOAT<<5|As.SIMPLE.TRUE,ks=As.MT.SIMPLE_FLOAT<<5|As.SIMPLE.FALSE,_s=As.MT.SIMPLE_FLOAT<<5|As.SIMPLE.UNDEFINED,Bs=As.MT.SIMPLE_FLOAT<<5|As.SIMPLE.NULL,Es=new fs("0x20000000000000"),Ss=cs.from("f97e00","hex"),Cs=cs.from("f9fc00","hex"),Is=cs.from("f97c00","hex"),Ps=function(){function e(t){s(this,e),t=t||{},this.streaming="function"==typeof t.stream,this.onData=t.stream,this.semanticTypes=[[ls,this._pushUrl],[fs,this._pushBigNumber]];for(var r=t.genTypes||[],n=r.length,i=0;i<n;i++)this.addSemanticType(r[i][0],r[i][1]);this._reset()}return c(e,[{key:"addSemanticType",value:function(e,t){for(var r=this.semanticTypes.length,n=0;n<r;n++)if(this.semanticTypes[n][0]===e){var i=this.semanticTypes[n][1];return this.semanticTypes[n][1]=t,i}return this.semanticTypes.push([e,t]),null}},{key:"push",value:function(e){return!e||(this.result[this.offset]=e,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=e.length,this.offset++,this.streaming&&this.onData(this.finalize()),!0)}},{key:"pushWrite",value:function(e,t,r){return this.result[this.offset]=e,this.resultMethod[this.offset]=t,this.resultLength[this.offset]=r,this.offset++,this.streaming&&this.onData(this.finalize()),!0}},{key:"_pushUInt8",value:function(e){return this.pushWrite(e,1,1)}},{key:"_pushUInt16BE",value:function(e){return this.pushWrite(e,2,2)}},{key:"_pushUInt32BE",value:function(e){return this.pushWrite(e,3,4)}},{key:"_pushDoubleBE",value:function(e){return this.pushWrite(e,4,8)}},{key:"_pushNaN",value:function(){return this.push(Ss)}},{key:"_pushInfinity",value:function(e){var t=e<0?Cs:Is;return this.push(t)}},{key:"_pushFloat",value:function(e){var t=cs.allocUnsafe(2);if(hs.writeHalf(t,e)&&hs.parseHalf(t)===e)return this._pushUInt8(ms)&&this.push(t);var r=cs.allocUnsafe(4);return r.writeFloatBE(e,0),r.readFloatBE(0)===e?this._pushUInt8(bs)&&this.push(r):this._pushUInt8(ws)&&this._pushDoubleBE(e)}},{key:"_pushInt",value:function(e,t,r){var n=t<<5;return e<24?this._pushUInt8(n|e):e<=255?this._pushUInt8(n|ps.ONE)&&this._pushUInt8(e):e<=65535?this._pushUInt8(n|ps.TWO)&&this._pushUInt16BE(e):e<=4294967295?this._pushUInt8(n|ps.FOUR)&&this._pushUInt32BE(e):e<=Number.MAX_SAFE_INTEGER?this._pushUInt8(n|ps.EIGHT)&&this._pushUInt32BE(Math.floor(e/vs))&&this._pushUInt32BE(e%vs):t===ds.NEG_INT?this._pushFloat(r):this._pushFloat(e)}},{key:"_pushIntNum",value:function(e){return e<0?this._pushInt(-e-1,ds.NEG_INT,e):this._pushInt(e,ds.POS_INT)}},{key:"_pushNumber",value:function(e){switch(!1){case e==e:return this._pushNaN(e);case isFinite(e):return this._pushInfinity(e);case e%1!=0:return this._pushIntNum(e);default:return this._pushFloat(e)}}},{key:"_pushString",value:function(e){var t=cs.byteLength(e,"utf8");return this._pushInt(t,ds.UTF8_STRING)&&this.pushWrite(e,5,t)}},{key:"_pushBoolean",value:function(e){return this._pushUInt8(e?xs:ks)}},{key:"_pushUndefined",value:function(e){return this._pushUInt8(_s)}},{key:"_pushArray",value:function(e,t){var r=t.length;if(!e._pushInt(r,ds.ARRAY))return!1;for(var n=0;n<r;n++)if(!e.pushAny(t[n]))return!1;return!0}},{key:"_pushTag",value:function(e){return this._pushInt(e,ds.TAG)}},{key:"_pushDate",value:function(e,t){return e._pushTag(ys.DATE_EPOCH)&&e.pushAny(Math.round(t/1e3))}},{key:"_pushBuffer",value:function(e,t){return e._pushInt(t.length,ds.BYTE_STRING)&&e.push(t)}},{key:"_pushNoFilter",value:function(e,t){return e._pushBuffer(e,t.slice())}},{key:"_pushRegexp",value:function(e,t){return e._pushTag(ys.REGEXP)&&e.pushAny(t.source)}},{key:"_pushSet",value:function(e,t){if(!e._pushInt(t.size,ds.ARRAY))return!1;var r,n=L(t);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(!e.pushAny(i))return!1}}catch(e){n.e(e)}finally{n.f()}return!0}},{key:"_pushUrl",value:function(e,t){return e._pushTag(ys.URI)&&e.pushAny(t.format())}},{key:"_pushBigint",value:function(e){var t=ys.POS_BIGINT;e.isNegative()&&(e=e.negated().minus(1),t=ys.NEG_BIGINT);var r=e.toString(16);r.length%2&&(r="0"+r);var n=cs.from(r,"hex");return this._pushTag(t)&&this._pushBuffer(this,n)}},{key:"_pushBigNumber",value:function(e,t){if(t.isNaN())return e._pushNaN();if(!t.isFinite())return e._pushInfinity(t.isNegative()?-1/0:1/0);if(t.isInteger())return e._pushBigint(t);if(!e._pushTag(ys.DECIMAL_FRAC)||!e._pushInt(2,ds.ARRAY))return!1;var r=t.decimalPlaces(),n=t.multipliedBy(new fs(10).pow(r));return!!e._pushIntNum(-r)&&(n.abs().isLessThan(Es)?e._pushIntNum(n.toNumber()):e._pushBigint(n))}},{key:"_pushMap",value:function(e,t){return!!e._pushInt(t.size,ds.MAP)&&this._pushRawMap(t.size,Array.from(t))}},{key:"_pushObject",value:function(e){if(!e)return this._pushUInt8(Bs);for(var t=this.semanticTypes.length,r=0;r<t;r++)if(e instanceof this.semanticTypes[r][0])return this.semanticTypes[r][1].call(e,this,e);var n=e.encodeCBOR;if("function"==typeof n)return n.call(e,this);var i=Object.keys(e),a=i.length;return!!this._pushInt(a,ds.MAP)&&this._pushRawMap(a,i.map((function(t){return[t,e[t]]})))}},{key:"_pushRawMap",value:function(t,r){r=r.map((function(t){return t[0]=e.encode(t[0]),t})).sort(hs.keySorter);for(var n=0;n<t;n++){if(!this.push(r[n][0]))return!1;if(!this.pushAny(r[n][1]))return!1}return!0}},{key:"write",value:function(e){return this.pushAny(e)}},{key:"pushAny",value:function(e){var t=function(e){return{}.toString.call(e).slice(8,-1)}(e);switch(t){case"Number":return this._pushNumber(e);case"String":return this._pushString(e);case"Boolean":return this._pushBoolean(e);case"Object":return this._pushObject(e);case"Array":return this._pushArray(this,e);case"Uint8Array":return this._pushBuffer(this,cs.isBuffer(e)?e:cs.from(e));case"Null":return this._pushUInt8(Bs);case"Undefined":return this._pushUndefined(e);case"Map":return this._pushMap(this,e);case"Set":return this._pushSet(this,e);case"URL":return this._pushUrl(this,e);case"BigNumber":return this._pushBigNumber(this,e);case"Date":return this._pushDate(this,e);case"RegExp":return this._pushRegexp(this,e);case"Symbol":switch(e){case gs.NULL:return this._pushObject(null);case gs.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+e.toString())}default:throw new Error("Unknown type: "+i(e)+", "+(e?e.toString():""))}}},{key:"finalize",value:function(){if(0===this.offset)return null;for(var e=this.result,t=this.resultLength,r=this.resultMethod,n=this.offset,i=0,a=0;a<n;a++)i+=t[a];var o=cs.allocUnsafe(i),s=0,u=0;for(a=0;a<n;a++){switch(u=t[a],r[a]){case 0:e[a].copy(o,s);break;case 1:o.writeUInt8(e[a],s,!0);break;case 2:o.writeUInt16BE(e[a],s,!0);break;case 3:o.writeUInt32BE(e[a],s,!0);break;case 4:o.writeDoubleBE(e[a],s,!0);break;case 5:o.write(e[a],s,u,"utf8");break;default:throw new Error("unkown method")}s+=u}var c=o;return this._reset(),c}},{key:"_reset",value:function(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}}],[{key:"encode",value:function(t){var r=new e;if(!r.pushAny(t))throw new Error("Failed to encode input");return r.finalize()}}]),e}(),Ts=Ps;function Os(e){if("string"==typeof e)return(new TextEncoder).encode(e);if(!(e instanceof Uint8Array))throw new TypeError('"data" be a string or Uint8Array.');return e}
|
|
448
448
|
/*!
|
|
449
449
|
* Copyright (c) 2019 Digital Bazaar, Inc. All rights reserved.
|
|
450
450
|
*/!function(e){e.Diagnose=ss,e.Decoder=ns,e.Encoder=Ts,e.Simple=Do,e.Tagged=Qo,e.decodeAll=e.Decoder.decodeAll,e.decodeFirst=e.Decoder.decodeFirst,e.diagnose=e.Diagnose.diagnose,e.encode=e.Encoder.encode,e.decode=e.Decoder.decode,e.leveldb={decode:e.Decoder.decodeAll,encode:e.Encoder.encode,buffer:!0,name:"cbor"}}(Sa);var Ls=function(){function e(){s(this,e),l(this,"registeredCodecs",void 0),this.registeredCodecs={}}var t,i,a;return c(e,[{key:"encode",value:(a=o(n().mark((function e(t){var i,a,s,u,c,l,f,h,A,d,p,v,g=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.data,a=t.urls,s=t.codecs,u=void 0===s?["mh-sha2-256","mb-base58-btc"]:s,c=t.meta,l=void 0===c?{}:c,void 0!==i||void 0!==a){e.next=3;break}throw new Error("Either `data` or `urls` must be provided.");case 3:if(void 0!==u){e.next=5;break}throw new Error("The hashlink creation `codecs` must be provided.");case 5:return void 0!==a&&(Array.isArray(a)||(a=[a]),a.forEach((function(e){if("string"!=typeof e)throw new Error('URL "'.concat(e,'" must be a string.'))})),l=r(r({},l),{},{url:a})),e.next=8,u.reduce(function(){var e=o(n().mark((function e(t,r){var i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(i=g.registeredCodecs[r])){e.next=3;break}throw new Error('Unknown cryptographic hash encoder "'.concat(r,'".'));case 3:return e.t0=i,e.next=6,t;case 6:return e.t1=e.sent,e.abrupt("return",e.t0.encode.call(e.t0,e.t1));case 8:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),i);case 8:if(f=e.sent,h=new Map,l.url&&h.set(15,l.url),l["content-type"]&&h.set(14,l["content-type"]),l.experimental&&h.set(13,l.experimental),l.transform&&h.set(12,l.transform),A=new TextDecoder,d="hl:"+A.decode(f),!(h.size>0)){e.next=22;break}return p=u[u.length-1],v=new Uint8Array(Sa.encode(h)),e.t0=d,e.t1=A,e.next=19,this.registeredCodecs[p].encode(v);case 19:e.t2=e.sent,e.t3=e.t1.decode.call(e.t1,e.t2),d=e.t0+=":"+e.t3;case 22:return e.abrupt("return",d);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"decode",value:(i=o(n().mark((function e(t){var r,i,a,o,s,u,c,l,f,h;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.hashlink,i=r.split(":"),a={hashName:"unknown",hashValue:null,meta:{}},!(i.length<2)){e.next=4;break}throw new Error('Hashlink "'.concat(r,'" is invalid; it must contain at least one colon.'));case 4:if(!(i.length>3)){e.next=6;break}throw new Error('Hashlink "'.concat(r,'" is invalid; it contains more than two colons.'));case 6:return o=Os(i[1]),s=this._findDecoder(o),u=s.decode(o),c=this._findDecoder(u),a.hashName=c.name,a.hashValue=c.decode(u),3===i.length&&(l=Os(i[2]),f=s.decode(l),(h=Sa.decode(f)).has(15)&&(a.meta.url=h.get(15)),h.has(14)&&(a.meta["content-type"]=h.get(14)),h.has(13)&&(a.meta.experimental=h.get(13)),h.has(12)&&(a.meta.transform=h.get(12))),e.abrupt("return",a);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"verify",value:(t=o(n().mark((function e(t){var r,i,a,o,s,u,c,l,f,h,A,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.data,i=t.hashlink,!((a=i.split(":")).length>3)){e.next=4;break}throw new Error('Hashlink "'.concat(i,'" is invalid; it contains more than two colons.'));case 4:return o=Os(a[1]),s=this._findDecoder(o),u=s.decode(o),c=this._findDecoder(u),l=[],3===a.length&&(f=Os(a[2]),h=s.decode(f),(A=Sa.decode(h)).has(12)&&l.push.apply(l,S(A.get(12)))),l.push(c.algorithm,s.algorithm),e.next=9,this.encode({data:r,codecs:l});case 9:return d=e.sent.split(":"),e.abrupt("return",a[1]===d[1]);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"use",value:function(e){this.registeredCodecs[e.algorithm]=e}},{key:"_findDecoder",value:function(e){var t=Object.values(this.registeredCodecs).find((function(t){return t.identifier.every((function(t,r){return t===e[r]}))}));if(!t)throw new Error("Could not determine decoder for: "+e);return t}}]),e}(),Ns={};function Ms(e,t){return function(e,t,r){if(!(e instanceof Uint8Array))throw new TypeError('"input" must be a Uint8Array.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');if(0===e.length)return"";var n="",i=0,a=t.length,o=t.charAt(0),s=[0];for(i=0;i<e.length;++i){for(var u=e[i],c=0;c<s.length;++c)u+=s[c]<<8,s[c]=u%a,u=u/a|0;for(;u>0;)s.push(u%a),u=u/a|0}for(i=0;0===e[i]&&i<e.length-1;++i)n+=o;for(i=s.length-1;i>=0;--i)n+=t[s[i]];if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n}(e,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",t)}function Us(e){return(4294967296+e).toString(16).substring(1)}var Fs={normalizeInput:function(e){var t;if(e instanceof Uint8Array)t=e;else{if("string"!=typeof e)throw new Error("Input must be an string, Buffer or Uint8Array");t=(new TextEncoder).encode(e)}return t},toHex:function(e){return Array.prototype.map.call(e,(function(e){return(e<16?"0":"")+e.toString(16)})).join("")},debugPrint:function(e,t,r){for(var n="\n"+e+" = ",i=0;i<t.length;i+=2){if(32===r)n+=Us(t[i]).toUpperCase(),n+=" ",n+=Us(t[i+1]).toUpperCase();else{if(64!==r)throw new Error("Invalid size "+r);n+=Us(t[i+1]).toUpperCase(),n+=Us(t[i]).toUpperCase()}i%6==4?n+="\n"+new Array(e.length+4).join(" "):i<t.length-2&&(n+=" ")}console.log(n)},testSpeed:function(e,t,r){for(var n=(new Date).getTime(),i=new Uint8Array(t),a=0;a<t;a++)i[a]=a%256;var o=(new Date).getTime();console.log("Generated random input in "+(o-n)+"ms"),n=o;for(var s=0;s<r;s++){var u=e(i),c=(new Date).getTime(),l=c-n;n=c,console.log("Hashed in "+l+"ms: "+u.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(l/1e3)*100)/100+" MB PER SECOND")}}},Rs=Fs;function Ds(e,t,r){var n=e[t]+e[r],i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function js(e,t,r,n){var i=e[t]+r;r<0&&(i+=4294967296);var a=e[t+1]+n;i>=4294967296&&a++,e[t]=i,e[t+1]=a}function Qs(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function Hs(e,t,r,n,i,a){var o=qs[i],s=qs[i+1],u=qs[a],c=qs[a+1];Ds(zs,e,t),js(zs,e,o,s);var l=zs[n]^zs[e],f=zs[n+1]^zs[e+1];zs[n]=f,zs[n+1]=l,Ds(zs,r,n),l=zs[t]^zs[r],f=zs[t+1]^zs[r+1],zs[t]=l>>>24^f<<8,zs[t+1]=f>>>24^l<<8,Ds(zs,e,t),js(zs,e,u,c),l=zs[n]^zs[e],f=zs[n+1]^zs[e+1],zs[n]=l>>>16^f<<16,zs[n+1]=f>>>16^l<<16,Ds(zs,r,n),l=zs[t]^zs[r],f=zs[t+1]^zs[r+1],zs[t]=f>>>31^l<<1,zs[t+1]=l>>>31^f<<1}var Ks=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),Vs=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map((function(e){return 2*e}))),zs=new Uint32Array(32),qs=new Uint32Array(32);function Gs(e,t){var r=0;for(r=0;r<16;r++)zs[r]=e.h[r],zs[r+16]=Ks[r];for(zs[24]=zs[24]^e.t,zs[25]=zs[25]^e.t/4294967296,t&&(zs[28]=~zs[28],zs[29]=~zs[29]),r=0;r<32;r++)qs[r]=Qs(e.b,4*r);for(r=0;r<12;r++)Hs(0,8,16,24,Vs[16*r+0],Vs[16*r+1]),Hs(2,10,18,26,Vs[16*r+2],Vs[16*r+3]),Hs(4,12,20,28,Vs[16*r+4],Vs[16*r+5]),Hs(6,14,22,30,Vs[16*r+6],Vs[16*r+7]),Hs(0,10,20,30,Vs[16*r+8],Vs[16*r+9]),Hs(2,12,22,24,Vs[16*r+10],Vs[16*r+11]),Hs(4,14,16,26,Vs[16*r+12],Vs[16*r+13]),Hs(6,8,18,28,Vs[16*r+14],Vs[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^zs[r]^zs[r+16]}var Ws=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function Js(e,t,r,n){if(0===e||e>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(r&&16!==r.length)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(n&&16!==n.length)throw new Error("Illegal personal, expected Uint8Array with length is 16");var i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};Ws.fill(0),Ws[0]=e,t&&(Ws[1]=t.length),Ws[2]=1,Ws[3]=1,r&&Ws.set(r,32),n&&Ws.set(n,48);for(var a=0;a<16;a++)i.h[a]=Ks[a]^Qs(Ws,4*a);return t&&(Xs(i,t),i.c=128),i}function Xs(e,t){for(var r=0;r<t.length;r++)128===e.c&&(e.t+=e.c,Gs(e,!1),e.c=0),e.b[e.c++]=t[r]}function Ys(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;Gs(e,!0);for(var t=new Uint8Array(e.outlen),r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r);return t}function $s(e,t,r,n,i){r=r||64,e=Rs.normalizeInput(e),n&&(n=Rs.normalizeInput(n)),i&&(i=Rs.normalizeInput(i));var a=Js(r,t,n,i);return Xs(a,e),Ys(a)}var Zs={blake2b:$s,blake2bHex:function(e,t,r,n,i){var a=$s(e,t,r,n,i);return Rs.toHex(a)},blake2bInit:Js,blake2bUpdate:Xs,blake2bFinal:Ys},eu=Fs;function tu(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function ru(e,t,r,n,i,a){ou[e]=ou[e]+ou[t]+i,ou[n]=nu(ou[n]^ou[e],16),ou[r]=ou[r]+ou[n],ou[t]=nu(ou[t]^ou[r],12),ou[e]=ou[e]+ou[t]+a,ou[n]=nu(ou[n]^ou[e],8),ou[r]=ou[r]+ou[n],ou[t]=nu(ou[t]^ou[r],7)}function nu(e,t){return e>>>t^e<<32-t}var iu=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),au=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),ou=new Uint32Array(16),su=new Uint32Array(16);function uu(e,t){var r=0;for(r=0;r<8;r++)ou[r]=e.h[r],ou[r+8]=iu[r];for(ou[12]^=e.t,ou[13]^=e.t/4294967296,t&&(ou[14]=~ou[14]),r=0;r<16;r++)su[r]=tu(e.b,4*r);for(r=0;r<10;r++)ru(0,4,8,12,su[au[16*r+0]],su[au[16*r+1]]),ru(1,5,9,13,su[au[16*r+2]],su[au[16*r+3]]),ru(2,6,10,14,su[au[16*r+4]],su[au[16*r+5]]),ru(3,7,11,15,su[au[16*r+6]],su[au[16*r+7]]),ru(0,5,10,15,su[au[16*r+8]],su[au[16*r+9]]),ru(1,6,11,12,su[au[16*r+10]],su[au[16*r+11]]),ru(2,7,8,13,su[au[16*r+12]],su[au[16*r+13]]),ru(3,4,9,14,su[au[16*r+14]],su[au[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=ou[r]^ou[r+8]}function cu(e,t){if(!(e>0&&e<=32))throw new Error("Incorrect output length, should be in [1, 32]");var r=t?t.length:0;if(t&&!(r>0&&r<=32))throw new Error("Incorrect key length, should be in [1, 32]");var n={h:new Uint32Array(iu),b:new Uint8Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(lu(n,t),n.c=64),n}function lu(e,t){for(var r=0;r<t.length;r++)64===e.c&&(e.t+=e.c,uu(e,!1),e.c=0),e.b[e.c++]=t[r]}function fu(e){for(e.t+=e.c;e.c<64;)e.b[e.c++]=0;uu(e,!0);for(var t=new Uint8Array(e.outlen),r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r)&255;return t}function hu(e,t,r){r=r||32,e=eu.normalizeInput(e);var n=cu(r,t);return lu(n,e),fu(n)}var Au,du,pu={blake2s:hu,blake2sHex:function(e,t,r){var n=hu(e,t,r);return eu.toHex(n)},blake2sInit:cu,blake2sUpdate:lu,blake2sFinal:fu},vu={blake2b:Zs.blake2b,blake2bHex:Zs.blake2bHex,blake2bInit:Zs.blake2bInit,blake2bUpdate:Zs.blake2bUpdate,blake2bFinal:Zs.blake2bFinal,blake2s:pu.blake2s,blake2sHex:pu.blake2sHex,blake2sInit:pu.blake2sInit,blake2sUpdate:pu.blake2sUpdate,blake2sFinal:pu.blake2sFinal},gu=self.crypto||self.msCrypto,yu=c((function e(){s(this,e),l(this,"identifier",void 0),l(this,"algorithm",void 0),l(this,"name",void 0)})),mu=function(e){f(i,e);var t,r=w(i);function i(){var e;return s(this,i),(e=r.call(this)).identifier=new Uint8Array([18,32]),e.algorithm="mh-sha2-256",e.name="sha2-256",e}return c(i,[{key:"encode",value:(t=o(n().mark((function e(t){var r,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Uint8Array,e.next=3,gu.subtle.digest({name:"SHA-256"},t);case 3:return e.t1=e.sent,r=new e.t0(e.t1),i=new Uint8Array(r.byteLength+this.identifier.byteLength),e.abrupt("return",(i.set(this.identifier,0),i.set(r,this.identifier.byteLength),i));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"decode",value:function(e){return e.slice(this.identifier.length)}}]),i}(yu),bu=function(e){f(i,e);var t,r=w(i);function i(){var e;return s(this,i),(e=r.call(this)).identifier=new Uint8Array([178,8,8]),e.algorithm="mh-blake2b-64",e.name="blake2b-64",e}return c(i,[{key:"encode",value:(t=o(n().mark((function e(t){var r,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=vu.blake2b(t,null,8),i=new Uint8Array(r.byteLength+this.identifier.byteLength),e.abrupt("return",(i.set(this.identifier,0),i.set(r,this.identifier.byteLength),i));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"decode",value:function(e){return e.slice(this.identifier.length)}}]),i}(yu),wu=function(e){f(i,e);var t,r=w(i);function i(){var e;return s(this,i),(e=r.call(this)).identifier=new Uint8Array([122]),e.algorithm="mb-base58-btc",e.name="base58-btc",e}return c(i,[{key:"encode",value:(t=o(n().mark((function e(t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Uint8Array(Os("z"+Ms(t))));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})},{key:"decode",value:function(e){return function(e){return function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if(0===e.length)return new Uint8Array;var r=Ns[t];if(!r){r=Ns[t]=[];for(var n=0;n<t.length;++n)r[t.charCodeAt(n)]=n}e=e.replace(/\s/g,"");for(var i=t.length,a=t.charAt(0),o=[0],s=0;s<e.length;s++){var u=r[e.charCodeAt(s)];if(void 0===u)return;for(var c=u,l=0;l<o.length;++l)c+=o[l]*i,o[l]=255&c,c>>=8;for(;c>0;)o.push(255&c),c>>=8}for(var f=0;e[f]===a&&f<e.length-1;++f)o.push(0);return new Uint8Array(o.reverse())}
|
package/dist/main.js
CHANGED
|
@@ -515,7 +515,7 @@ var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Arr
|
|
|
515
515
|
</svg>
|
|
516
516
|
<span class='buv-u-visually-hidden'>${xi("text.brandname")}</span>
|
|
517
517
|
`}
|
|
518
|
-
</a>`;const Ei={en:function(e){const t=xi("numbers","ordinal"),r=e%100;return t[(r-20)%10]||t[r]||t[0]},fr:function(e){const t=xi("numbers","ordinal");return 1===e?t[e]:t[0]},es:()=>xi("numbers","ordinal"),it:()=>xi("numbers","ordinal"),mt:e=>xi("numbers","ordinal")[e-1]};function Si(e){return"mt"===vi.locale?Ei[vi.locale](e):e+Ei[vi.locale](e)}const Ci=({certificateTitle:e="",issueDate:t="",issuerName:r="",recipientName:n="",issuerPublicKey:i=[],issuerPublicDomain:o=[],issuerPublicUrl:s=[],issuerLogo:a="",qrCodeImage:c=""})=>{const u=[];(e||a)&&(u.push("<section>"),a&&u.push(`<div style="margin:0 auto;width:140px;height:140px;background-repeat:no-repeat;background-position:center;background-size:contain;background-image:url('${a}');"></div>`),e&&u.push(`<h2 style="margin:20px 0;font-size:18px;text-align:center">${e}</h2>`),u.push("</section>")),u.push('<section style="text-align:center">');const l=[{title:"Issue Date",value:t},{title:"Recipient",value:n},{title:"Issuer",value:r}];u.push(...l.map((e=>`<div style="margin:15px 0"><dt style="margin-bottom:5px;text-transform:uppercase;font-weight:600;font-size:12px">${e.title}</dt><dd style="margin:0;word-break:break-all;font-size:13px">${e.value}</dd></div>`)));const A=i.map(((e,t)=>({publicKey:e,url:s[t],domain:o[t]})));u.push(function(e){const t=e.length>1,r=['<div style="margin:15px 0">'];return r.push('<dt style="margin-bottom:5px;text-transform:uppercase;font-weight:600;font-size:12px">Issuer Information</dt>'),r.push('<dd style="margin:0;word-break:break-all;font-size:13px">'),r.push('<div style="display:flex;flex-direction:column;align-content:center;row-gap:4px;padding:0 20px;font-size:12px">'),r.push(...e.map(((e,r)=>{const n=['<div style="display:flex;flex-direction:column;row-gap:3px;justify-content:center;padding:5px 10px">'];return n.push("<div>"),t&&n.push(`<span style="font-weight:500;margin-right:10px">${Si(r+1)}</span>`),n.push(`<span>Public Key: ${e.publicKey}</span>`),n.push("</div>"),e.url&&e.domain&&n.push(`<span><a href="${e.url}">${e.domain}</a></span>`),n.push("</div>"),n.join("")}))),r.push("<div/>"),r.push("<dd/>"),r.push("<div/>"),r.join("")}(A)),u.push("</section>"),c&&(u.push("<section>"),u.push('<span style="margin-bottom:15px;font-size:10px">Scan the QR code to verify the document.</span>'),u.push(`<div style="margin:0 auto;width:110px;height:110px;background-repeat:no-repeat;background-position:center;background-size:contain;background-image:url('data:image/svg+xml;base64,${c}');"></div>`),u.push("</section>")),u.push(`<div style="width:150px">${_i().getHTML()}</div>`);const h=document.createElement("section");return h.setAttribute("style","width:595px;height:842px;padding:40px 20px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:space-between;align-items:center;font-family:'Open Sans',-apple-system,BlinkMacSystemFont,sans-serif;color:rgb(0,0,0);"),h.innerHTML=u.join(""),h};var Ii={exports:{}};!function(e){function t(e){this.mode=n.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,r=this.data.length;t<r;t++){var i=[],o=this.data.charCodeAt(t);o>65536?(i[0]=240|(1835008&o)>>>18,i[1]=128|(258048&o)>>>12,i[2]=128|(4032&o)>>>6,i[3]=128|63&o):o>2048?(i[0]=224|(61440&o)>>>12,i[1]=128|(4032&o)>>>6,i[2]=128|63&o):o>128?(i[0]=192|(1984&o)>>>6,i[1]=128|63&o):i[0]=o,this.parsedData.push(i)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function r(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}t.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t<r;t++)e.put(this.parsedData[t],8)}},r.prototype={addData:function(e){var r=new t(e);this.dataList.push(r),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++)this.modules[n][i]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=r.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(this.modules[e+r][t+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=g.getLostPoint(this);(0==r||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r);this.make();for(var i=0;i<this.modules.length;i++)for(var o=1*i,s=0;s<this.modules[i].length;s++){var a=1*s;this.modules[i][s]&&(n.beginFill(0,100),n.moveTo(a,o),n.lineTo(a+1,o),n.lineTo(a+1,o+1),n.lineTo(a,o+1),n.endFill())}return n},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)null==this.modules[e][6]&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=t%2==0)},setupPositionAdjustPattern:function(){for(var e=g.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var n=e[t],i=e[r];if(null==this.modules[n][i])for(var o=-2;o<=2;o++)for(var s=-2;s<=2;s++)this.modules[n+o][i+s]=-2==o||2==o||-2==s||2==s||0==o&&0==s}},setupTypeNumber:function(e){for(var t=g.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var n=!e&&1==(t>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(r=0;r<18;r++){n=!e&&1==(t>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=g.getBCHTypeInfo(r),i=0;i<15;i++){var o=!e&&1==(n>>i&1);i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(i=0;i<15;i++){o=!e&&1==(n>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(6==s&&s--;;){for(var a=0;a<2;a++)if(null==this.modules[n][s-a]){var c=!1;o<e.length&&(c=1==(e[o]>>>i&1)),g.getMask(t,n,s-a)&&(c=!c),this.modules[n][s-a]=c,-1==--i&&(o++,i=7)}if((n+=r)<0||this.moduleCount<=n){n-=r,r=-r;break}}}},r.PAD0=236,r.PAD1=17,r.createData=function(e,t,n){for(var i=b.getRSBlocks(e,t),o=new w,s=0;s<n.length;s++){var a=n[s];o.put(a.mode,4),o.put(a.getLength(),g.getLengthInBits(a.mode,e)),a.write(o)}var c=0;for(s=0;s<i.length;s++)c+=i[s].dataCount;if(o.getLengthInBits()>8*c)throw new Error("code length overflow. ("+o.getLengthInBits()+">"+8*c+")");for(o.getLengthInBits()+4<=8*c&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(!1);for(;!(o.getLengthInBits()>=8*c||(o.put(r.PAD0,8),o.getLengthInBits()>=8*c));)o.put(r.PAD1,8);return r.createBytes(o,i)},r.createBytes=function(e,t){for(var r=0,n=0,i=0,o=new Array(t.length),s=new Array(t.length),a=0;a<t.length;a++){var c=t[a].dataCount,u=t[a].totalCount-c;n=Math.max(n,c),i=Math.max(i,u),o[a]=new Array(c);for(var l=0;l<o[a].length;l++)o[a][l]=255&e.buffer[l+r];r+=c;var A=g.getErrorCorrectPolynomial(u),h=new v(o[a],A.getLength()-1).mod(A);s[a]=new Array(A.getLength()-1);for(l=0;l<s[a].length;l++){var f=l+h.getLength()-s[a].length;s[a][l]=f>=0?h.get(f):0}}var d=0;for(l=0;l<t.length;l++)d+=t[l].totalCount;var p=new Array(d),m=0;for(l=0;l<n;l++)for(a=0;a<t.length;a++)l<o[a].length&&(p[m++]=o[a][l]);for(l=0;l<i;l++)for(a=0;a<t.length;a++)l<s[a].length&&(p[m++]=s[a][l]);return p};for(var n={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},i=1,o=0,s=3,a=2,c=0,u=1,l=2,A=3,h=4,f=5,d=6,p=7,g={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;g.getBCHDigit(t)-g.getBCHDigit(g.G15)>=0;)t^=g.G15<<g.getBCHDigit(t)-g.getBCHDigit(g.G15);return(e<<10|t)^g.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;g.getBCHDigit(t)-g.getBCHDigit(g.G18)>=0;)t^=g.G18<<g.getBCHDigit(t)-g.getBCHDigit(g.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;0!=e;)t++,e>>>=1;return t},getPatternPosition:function(e){return g.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case c:return(t+r)%2==0;case u:return t%2==0;case l:return r%3==0;case A:return(t+r)%3==0;case h:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case f:return t*r%2+t*r%3==0;case d:return(t*r%2+t*r%3)%2==0;case p:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new v([1],0),r=0;r<e;r++)t=t.multiply(new v([1,m.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case n.MODE_NUMBER:return 10;case n.MODE_ALPHA_NUM:return 9;case n.MODE_8BIT_BYTE:case n.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case n.MODE_NUMBER:return 12;case n.MODE_ALPHA_NUM:return 11;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else{if(!(t<41))throw new Error("type:"+t);switch(e){case n.MODE_NUMBER:return 14;case n.MODE_ALPHA_NUM:return 13;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}}},getLostPoint:function(e){for(var t=e.getModuleCount(),r=0,n=0;n<t;n++)for(var i=0;i<t;i++){for(var o=0,s=e.isDark(n,i),a=-1;a<=1;a++)if(!(n+a<0||t<=n+a))for(var c=-1;c<=1;c++)i+c<0||t<=i+c||0==a&&0==c||s==e.isDark(n+a,i+c)&&o++;o>5&&(r+=3+o-5)}for(n=0;n<t-1;n++)for(i=0;i<t-1;i++){var u=0;e.isDark(n,i)&&u++,e.isDark(n+1,i)&&u++,e.isDark(n,i+1)&&u++,e.isDark(n+1,i+1)&&u++,0!=u&&4!=u||(r+=3)}for(n=0;n<t;n++)for(i=0;i<t-6;i++)e.isDark(n,i)&&!e.isDark(n,i+1)&&e.isDark(n,i+2)&&e.isDark(n,i+3)&&e.isDark(n,i+4)&&!e.isDark(n,i+5)&&e.isDark(n,i+6)&&(r+=40);for(i=0;i<t;i++)for(n=0;n<t-6;n++)e.isDark(n,i)&&!e.isDark(n+1,i)&&e.isDark(n+2,i)&&e.isDark(n+3,i)&&e.isDark(n+4,i)&&!e.isDark(n+5,i)&&e.isDark(n+6,i)&&(r+=40);var l=0;for(i=0;i<t;i++)for(n=0;n<t;n++)e.isDark(n,i)&&l++;return r+=10*(Math.abs(100*l/t/t-50)/5)}},m={glog:function(e){if(e<1)throw new Error("glog("+e+")");return m.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return m.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},y=0;y<8;y++)m.EXP_TABLE[y]=1<<y;for(y=8;y<256;y++)m.EXP_TABLE[y]=m.EXP_TABLE[y-4]^m.EXP_TABLE[y-5]^m.EXP_TABLE[y-6]^m.EXP_TABLE[y-8];for(y=0;y<255;y++)m.LOG_TABLE[m.EXP_TABLE[y]]=y;function v(e,t){if(null==e.length)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&0==e[r];)r++;this.num=new Array(e.length-r+t);for(var n=0;n<e.length-r;n++)this.num[n]=e[n+r]}function b(e,t){this.totalCount=e,this.dataCount=t}function w(){this.buffer=[],this.length=0}v.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<e.getLength();n++)t[r+n]^=m.gexp(m.glog(this.get(r))+m.glog(e.get(n)));return new v(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=m.glog(this.get(0))-m.glog(e.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(n=0;n<e.getLength();n++)r[n]^=m.gexp(m.glog(e.get(n))+t);return new v(r,0).mod(e)}},b.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],b.getRSBlocks=function(e,t){var r=b.getRsBlockTable(e,t);if(null==r)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var n=r.length/3,i=[],o=0;o<n;o++)for(var s=r[3*o+0],a=r[3*o+1],c=r[3*o+2],u=0;u<s;u++)i.push(new b(a,c));return i},b.getRsBlockTable=function(e,t){switch(t){case i:return b.RS_BLOCK_TABLE[4*(e-1)+0];case o:return b.RS_BLOCK_TABLE[4*(e-1)+1];case s:return b.RS_BLOCK_TABLE[4*(e-1)+2];case a:return b.RS_BLOCK_TABLE[4*(e-1)+3];default:return}},w.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var x=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function _(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M"},"string"==typeof e&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if("string"!=typeof this.options.content)throw new Error("Expected 'content' as string!");if(0===this.options.content.length)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0&&this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");var n=this.options.content,c=function(e,t){for(var r=function(e){var t=encodeURI(e).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=e?3:0)}(e),n=1,i=0,o=0,s=x.length;o<=s;o++){var a=x[o];if(!a)throw new Error("Content too long: expected "+i+" but got "+r);switch(t){case"L":i=a[0];break;case"M":i=a[1];break;case"Q":i=a[2];break;case"H":i=a[3];break;default:throw new Error("Unknwon error correction level: "+t)}if(r<=i)break;n++}if(n>x.length)throw new Error("Content too long");return n}(n,this.options.ecl),u=function(e){switch(e){case"L":return i;case"M":return o;case"Q":return s;case"H":return a;default:throw new Error("Unknwon error correction level: "+e)}}(this.options.ecl);this.qrcode=new r(c,u),this.qrcode.addData(n),this.qrcode.make()}_.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;void 0===e&&(e={container:t.container||"svg"});for(var n=void 0===t.pretty||!!t.pretty,i=n?" ":"",o=n?"\r\n":"",s=t.width,a=t.height,c=r.length,u=s/(c+2*t.padding),l=a/(c+2*t.padding),A=void 0!==t.join&&!!t.join,h=void 0!==t.swap&&!!t.swap,f=void 0===t.xmlDeclaration||!!t.xmlDeclaration,d=void 0!==t.predefined&&!!t.predefined,p=d?i+'<defs><path id="qrmodule" d="M0 0 h'+l+" v"+u+' H0 z" style="fill:'+t.color+';shape-rendering:crispEdges;" /></defs>'+o:"",g=i+'<rect x="0" y="0" width="'+s+'" height="'+a+'" style="fill:'+t.background+';shape-rendering:crispEdges;"/>'+o,m="",y="",v=0;v<c;v++)for(var b=0;b<c;b++){if(r[b][v]){var w=b*u+t.padding*u,x=v*l+t.padding*l;if(h){var _=w;w=x,x=_}if(A){var B=u+w,E=l+x;w=Number.isInteger(w)?Number(w):w.toFixed(2),x=Number.isInteger(x)?Number(x):x.toFixed(2),B=Number.isInteger(B)?Number(B):B.toFixed(2),y+="M"+w+","+x+" V"+(E=Number.isInteger(E)?Number(E):E.toFixed(2))+" H"+B+" V"+x+" H"+w+" Z "}else m+=d?i+'<use x="'+w.toString()+'" y="'+x.toString()+'" href="#qrmodule" />'+o:i+'<rect x="'+w.toString()+'" y="'+x.toString()+'" width="'+u+'" height="'+l+'" style="fill:'+t.color+';shape-rendering:crispEdges;"/>'+o}}A&&(m=i+'<path x="0" y="0" style="fill:'+t.color+';shape-rendering:crispEdges;" d="'+y+'" />');var S="";switch(e.container){case"svg":f&&(S+='<?xml version="1.0" standalone="yes"?>'+o),S+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+s+'" height="'+a+'">'+o,S+=p+g+m,S+="</svg>";break;case"svg-viewbox":f&&(S+='<?xml version="1.0" standalone="yes"?>'+o),S+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+s+" "+a+'">'+o,S+=p+g+m,S+="</svg>";break;case"g":S+='<g width="'+s+'" height="'+a+'">'+o,S+=p+g+m,S+="</g>";break;default:S+=(p+g+m).replace(/^\s+/,"")}return S},_.prototype.save=function(e,t){var r=this.svg();"function"!=typeof t&&(t=function(e,t){});try{require("fs").writeFile(e,r,t)}catch(e){t(e)}},e.exports=_}(Ii);var ki=Ii.exports;const Pi=e=>e?(e=>window.btoa(e))(new ki(e).svg()):null;const Ti={height:"0",overflow:"hidden"},Oi={padding:"20px","background-color":"#fff","font-family":"serif","text-align":"center",color:"#49555f","font-size":"12px","word-wrap":"break-word","min-height":"calc(100vh - 145px)","box-sizing":"border-box",margin:"0 auto","min-width":"600px","line-height":"initial",clipPath:"inset(0 100% 0 0)"},Li={"max-width":"460px"},Ni=async(e,t)=>{const r=Xe(t),n=Ui({...Oi,...Ti,...r?Li:{}});n.insertAdjacentHTML("beforeend",t);const i=((e,t)=>t?[e]:Array.from(e.querySelectorAll(":scope > div > div")))(n,r);for(const t of i){const r=Ze(t);e=await pi({pdf:e,pageHTMLElement:t,width:r.width,height:r.height,margin:10})}return Fi(n),e},Ui=e=>{const t=document.createElement("div");var r,n;return t.setAttribute("id","html2pdf-dom-container-identifier"),e&&(r=t,n=e,Object.keys(n).forEach((e=>{r.style[e]=n[e]}))),document.body.appendChild(t),t},Fi=e=>{document.body.removeChild(e)},Mi=async({contentType:e=null,contentEncoding:t="",content:r="",recipientName:n="",certificateTitle:i="",issueDate:o="",issuerName:s="",issuerLogo:a="",recordLink:c="",issuerPublicKey:u=[],issuerProfileUrl:l=[],issuerProfileDomain:A=[]})=>{const h=i;let f;const d=(e=>[$e.IMAGE_GIF,$e.IMAGE_BMP,$e.IMAGE_PNG,$e.IMAGE_JPEG].includes(e))(e),p=e===$e.TEXT_HTML;if((p||d)&&(f=await(async(e,t,r,n,i,o,s,a,c)=>{const u=Ui(Ti),l=Pi(o),A=Ci({certificateTitle:t,issueDate:r,issuerName:n,issuerLogo:i,issuerPublicKey:s,issuerPublicDomain:a,issuerPublicUrl:c,recipientName:e,qrCodeImage:l});u.appendChild(A);const h=await pi({pageHTMLElement:A,width:595,height:842,margin:0});return Fi(u),h})(n,i,o,s,a,c,u,A,l)),p)f=await Ni(f,r);else if(d)f=await gi(f,`data:${e};${t},${r}`);else{const n=function(e){return e===$e.APPLICATION_PDF?"pdf":""}($e.APPLICATION_PDF);!function(e,t,r,n,i=""){const o=`data:${t};${r},${e}`,s=document.createElement("a"),a=[n];i&&a.push(i);const c=a.join(".");s.href=o,s.download=c,s.click()}(r,e,t,h,n)}!function(e,t){e.save(t)}(f,h)};var Ri="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Di(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var ji={},Qi="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Hi=[],Ki=[],Vi="undefined"!=typeof Uint8Array?Uint8Array:Array,zi=!1;function qi(){zi=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)Hi[t]=e[t],Ki[e.charCodeAt(t)]=t;Ki["-".charCodeAt(0)]=62,Ki["_".charCodeAt(0)]=63}function Gi(e,t,r){for(var n,i,o=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(Hi[(i=n)>>18&63]+Hi[i>>12&63]+Hi[i>>6&63]+Hi[63&i]);return o.join("")}function Wi(e){var t;zi||qi();for(var r=e.length,n=r%3,i="",o=[],s=16383,a=0,c=r-n;a<c;a+=s)o.push(Gi(e,a,a+s>c?c:a+s));return 1===n?(t=e[r-1],i+=Hi[t>>2],i+=Hi[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=Hi[t>>10],i+=Hi[t>>4&63],i+=Hi[t<<2&63],i+="="),o.push(i),o.join("")}function $i(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,A=r?i-1:0,h=r?-1:1,f=e[t+A];for(A+=h,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+A],A+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+A],A+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)}function Ji(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,A=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+A>=1?h/c:h*Math.pow(2,1-A))*c>=2&&(s++,c/=2),s+A>=l?(a=0,s=l):s+A>=1?(a=(t*c-1)*Math.pow(2,i),s+=A):(a=t*Math.pow(2,A-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+f]=255&s,f+=d,s/=256,u-=8);e[r+f-d]|=128*p}var Xi={}.toString,Yi=Array.isArray||function(e){return"[object Array]"==Xi.call(e)};ro.TYPED_ARRAY_SUPPORT=void 0===Qi.TYPED_ARRAY_SUPPORT||Qi.TYPED_ARRAY_SUPPORT;var Zi=eo();function eo(){return ro.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function to(e,t){if(eo()<t)throw new RangeError("Invalid typed array length");return ro.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=ro.prototype:(null===e&&(e=new ro(t)),e.length=t),e}function ro(e,t,r){if(!(ro.TYPED_ARRAY_SUPPORT||this instanceof ro))return new ro(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return oo(this,e)}return no(this,e,t,r)}function no(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),ro.TYPED_ARRAY_SUPPORT?(e=t).__proto__=ro.prototype:e=so(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!ro.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|uo(t,r),i=(e=to(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(co(t)){var r=0|ao(t.length);return 0===(e=to(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?to(e,0):so(e,t);if("Buffer"===t.type&&Yi(t.data))return so(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function io(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function oo(e,t){if(io(t),e=to(e,t<0?0:0|ao(t)),!ro.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function so(e,t){var r=t.length<0?0:0|ao(t.length);e=to(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function ao(e){if(e>=eo())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+eo().toString(16)+" bytes");return 0|e}function co(e){return!(null==e||!e._isBuffer)}function uo(e,t){if(co(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Fo(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Mo(e).length;default:if(n)return Fo(e).length;t=(""+t).toLowerCase(),n=!0}}function lo(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Eo(this,t,r);case"utf8":case"utf-8":return xo(this,t,r);case"ascii":return _o(this,t,r);case"latin1":case"binary":return Bo(this,t,r);case"base64":return wo(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return So(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Ao(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function ho(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=ro.from(t,n)),co(t))return 0===t.length?-1:fo(e,t,r,n,i);if("number"==typeof t)return t&=255,ro.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):fo(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function fo(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var A=!0,h=0;h<c;h++)if(u(e,o+h)!==u(t,h)){A=!1;break}if(A)return o}return-1}function po(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function go(e,t,r,n){return Ro(Fo(t,e.length-r),e,r,n)}function mo(e,t,r,n){return Ro(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function yo(e,t,r,n){return mo(e,t,r,n)}function vo(e,t,r,n){return Ro(Mo(t),e,r,n)}function bo(e,t,r,n){return Ro(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function wo(e,t,r){return 0===t&&r===e.length?Wi(e):Wi(e.slice(t,r))}function xo(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,c,u=e[i],l=null,A=u>239?4:u>223?3:u>191?2:1;if(i+A<=r)switch(A){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,A=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=A}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}function _o(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function Bo(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Eo(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=Uo(e[o]);return i}function So(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function Co(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Io(e,t,r,n,i,o){if(!co(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function ko(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Po(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function To(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Oo(e,t,r,n,i){return i||To(e,0,r,4),Ji(e,t,r,n,23,4),r+4}function Lo(e,t,r,n,i){return i||To(e,0,r,8),Ji(e,t,r,n,52,8),r+8}ro.poolSize=8192,ro._augment=function(e){return e.__proto__=ro.prototype,e},ro.from=function(e,t,r){return no(null,e,t,r)},ro.TYPED_ARRAY_SUPPORT&&(ro.prototype.__proto__=Uint8Array.prototype,ro.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&ro[Symbol.species]),ro.alloc=function(e,t,r){return function(e,t,r,n){return io(t),t<=0?to(e,t):void 0!==r?"string"==typeof n?to(e,t).fill(r,n):to(e,t).fill(r):to(e,t)}(null,e,t,r)},ro.allocUnsafe=function(e){return oo(null,e)},ro.allocUnsafeSlow=function(e){return oo(null,e)},ro.isBuffer=Do,ro.compare=function(e,t){if(!co(e)||!co(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},ro.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},ro.concat=function(e,t){if(!Yi(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return ro.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=ro.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(!co(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},ro.byteLength=uo,ro.prototype._isBuffer=!0,ro.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Ao(this,t,t+1);return this},ro.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Ao(this,t,t+3),Ao(this,t+1,t+2);return this},ro.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Ao(this,t,t+7),Ao(this,t+1,t+6),Ao(this,t+2,t+5),Ao(this,t+3,t+4);return this},ro.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?xo(this,0,e):lo.apply(this,arguments)},ro.prototype.equals=function(e){if(!co(e))throw new TypeError("Argument must be a Buffer");return this===e||0===ro.compare(this,e)},ro.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},ro.prototype.compare=function(e,t,r,n,i){if(!co(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(n,i),u=e.slice(t,r),l=0;l<a;++l)if(c[l]!==u[l]){o=c[l],s=u[l];break}return o<s?-1:s<o?1:0},ro.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},ro.prototype.indexOf=function(e,t,r){return ho(this,e,t,r,!0)},ro.prototype.lastIndexOf=function(e,t,r){return ho(this,e,t,r,!1)},ro.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return po(this,e,t,r);case"utf8":case"utf-8":return go(this,e,t,r);case"ascii":return mo(this,e,t,r);case"latin1":case"binary":return yo(this,e,t,r);case"base64":return vo(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bo(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},ro.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},ro.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),ro.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=ro.prototype;else{var i=t-e;r=new ro(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},ro.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Co(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},ro.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Co(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},ro.prototype.readUInt8=function(e,t){return t||Co(e,1,this.length),this[e]},ro.prototype.readUInt16LE=function(e,t){return t||Co(e,2,this.length),this[e]|this[e+1]<<8},ro.prototype.readUInt16BE=function(e,t){return t||Co(e,2,this.length),this[e]<<8|this[e+1]},ro.prototype.readUInt32LE=function(e,t){return t||Co(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},ro.prototype.readUInt32BE=function(e,t){return t||Co(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},ro.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Co(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},ro.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Co(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},ro.prototype.readInt8=function(e,t){return t||Co(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},ro.prototype.readInt16LE=function(e,t){t||Co(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},ro.prototype.readInt16BE=function(e,t){t||Co(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},ro.prototype.readInt32LE=function(e,t){return t||Co(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},ro.prototype.readInt32BE=function(e,t){return t||Co(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},ro.prototype.readFloatLE=function(e,t){return t||Co(e,4,this.length),$i(this,e,!0,23,4)},ro.prototype.readFloatBE=function(e,t){return t||Co(e,4,this.length),$i(this,e,!1,23,4)},ro.prototype.readDoubleLE=function(e,t){return t||Co(e,8,this.length),$i(this,e,!0,52,8)},ro.prototype.readDoubleBE=function(e,t){return t||Co(e,8,this.length),$i(this,e,!1,52,8)},ro.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||Io(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},ro.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||Io(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},ro.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,1,255,0),ro.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},ro.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,2,65535,0),ro.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ko(this,e,t,!0),t+2},ro.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,2,65535,0),ro.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ko(this,e,t,!1),t+2},ro.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,4,4294967295,0),ro.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Po(this,e,t,!0),t+4},ro.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,4,4294967295,0),ro.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Po(this,e,t,!1),t+4},ro.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Io(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},ro.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Io(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},ro.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,1,127,-128),ro.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},ro.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,2,32767,-32768),ro.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ko(this,e,t,!0),t+2},ro.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,2,32767,-32768),ro.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ko(this,e,t,!1),t+2},ro.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,4,2147483647,-2147483648),ro.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Po(this,e,t,!0),t+4},ro.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),ro.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Po(this,e,t,!1),t+4},ro.prototype.writeFloatLE=function(e,t,r){return Oo(this,e,t,!0,r)},ro.prototype.writeFloatBE=function(e,t,r){return Oo(this,e,t,!1,r)},ro.prototype.writeDoubleLE=function(e,t,r){return Lo(this,e,t,!0,r)},ro.prototype.writeDoubleBE=function(e,t,r){return Lo(this,e,t,!1,r)},ro.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!ro.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},ro.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!ro.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=co(e)?e:Fo(new ro(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var No=/[^+\/0-9A-Za-z-_]/g;function Uo(e){return e<16?"0"+e.toString(16):e.toString(16)}function Fo(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Mo(e){return function(e){var t,r,n,i,o,s;zi||qi();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new Vi(3*a/4-o),n=o>0?a-4:a;var c=0;for(t=0,r=0;t<n;t+=4,r+=3)i=Ki[e.charCodeAt(t)]<<18|Ki[e.charCodeAt(t+1)]<<12|Ki[e.charCodeAt(t+2)]<<6|Ki[e.charCodeAt(t+3)],s[c++]=i>>16&255,s[c++]=i>>8&255,s[c++]=255&i;return 2===o?(i=Ki[e.charCodeAt(t)]<<2|Ki[e.charCodeAt(t+1)]>>4,s[c++]=255&i):1===o&&(i=Ki[e.charCodeAt(t)]<<10|Ki[e.charCodeAt(t+1)]<<4|Ki[e.charCodeAt(t+2)]>>2,s[c++]=i>>8&255,s[c++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(No,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Ro(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Do(e){return null!=e&&(!!e._isBuffer||jo(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&jo(e.slice(0,0))}(e))}function jo(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Qo=Di(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:Zi,Buffer:ro,SlowBuffer:function(e){return+e!=e&&(e=0),ro.alloc(+e)},isBuffer:Do})),Ho={
|
|
518
|
+
</a>`;const Ei={en:function(e){const t=xi("numbers","ordinal"),r=e%100;return t[(r-20)%10]||t[r]||t[0]},fr:function(e){const t=xi("numbers","ordinal");return 1===e?t[e]:t[0]},es:()=>xi("numbers","ordinal"),it:()=>xi("numbers","ordinal"),mt:e=>xi("numbers","ordinal")[e-1]};function Si(e){return"mt"===vi.locale?Ei[vi.locale](e):e+Ei[vi.locale](e)}const Ci=({certificateTitle:e="",issueDate:t="",issuerName:r="",recipientName:n="",issuerPublicKey:i=[],issuerPublicDomain:o=[],issuerPublicUrl:s=[],issuerLogo:a="",qrCodeImage:c=""})=>{const u=[];(e||a)&&(u.push("<section>"),a&&u.push(`<div style="margin:0 auto;width:140px;height:140px;background-repeat:no-repeat;background-position:center;background-size:contain;background-image:url('${a}');"></div>`),e&&u.push(`<h2 style="margin:20px 0;font-size:18px;text-align:center">${e}</h2>`),u.push("</section>")),u.push('<section style="text-align:center">');const l=[{title:"Issue Date",value:t},{title:"Recipient",value:n},{title:"Issuer",value:r}];u.push(...l.map((e=>`<div style="margin:15px 0"><dt style="margin-bottom:5px;text-transform:uppercase;font-weight:600;font-size:12px">${e.title}</dt><dd style="margin:0;font-size:13px">${e.value}</dd></div>`)));const A=i.map(((e,t)=>({publicKey:e,url:s[t],domain:o[t]})));u.push(function(e){const t=e.length>1,r=['<div style="margin:15px 0">'];return r.push('<dt style="margin-bottom:5px;text-transform:uppercase;font-weight:600;font-size:12px">Issuer Information</dt>'),r.push('<dd style="margin:0;font-size:13px">'),r.push('<div style="display:flex;flex-direction:column;align-content:center;row-gap:4px;padding:0 20px;font-size:12px">'),r.push(...e.map(((e,r)=>{const n=['<div style="display:flex;flex-direction:column;row-gap:3px;justify-content:center;padding:5px 10px">'];return n.push("<div>"),t&&n.push(`<span style="font-weight:500;margin-right:10px">${Si(r+1)}</span>`),n.push(`<span>Public Key: ${e.publicKey}</span>`),n.push("</div>"),e.url&&e.domain&&n.push(`<span><a href="${e.url}">${e.domain}</a></span>`),n.push("</div>"),n.join("")}))),r.push("<div/>"),r.push("<dd/>"),r.push("<div/>"),r.join("")}(A)),u.push("</section>"),c&&(u.push("<section>"),u.push('<span style="margin-bottom:15px;font-size:10px">Scan the QR code to verify the document.</span>'),u.push(`<div style="margin:0 auto;width:110px;height:110px;background-repeat:no-repeat;background-position:center;background-size:contain;background-image:url('data:image/svg+xml;base64,${c}');"></div>`),u.push("</section>")),u.push(`<div style="width:150px">${_i().getHTML()}</div>`);const h=document.createElement("section");return h.setAttribute("style","width:595px;height:842px;padding:40px 20px;box-sizing:border-box;display:flex;flex-direction:column;justify-content:space-between;align-items:center;font-family:'Open Sans',-apple-system,BlinkMacSystemFont,sans-serif;color:rgb(0,0,0);"),h.innerHTML=u.join(""),h};var Ii={exports:{}};!function(e){function t(e){this.mode=n.MODE_8BIT_BYTE,this.data=e,this.parsedData=[];for(var t=0,r=this.data.length;t<r;t++){var i=[],o=this.data.charCodeAt(t);o>65536?(i[0]=240|(1835008&o)>>>18,i[1]=128|(258048&o)>>>12,i[2]=128|(4032&o)>>>6,i[3]=128|63&o):o>2048?(i[0]=224|(61440&o)>>>12,i[1]=128|(4032&o)>>>6,i[2]=128|63&o):o>128?(i[0]=192|(1984&o)>>>6,i[1]=128|63&o):i[0]=o,this.parsedData.push(i)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}function r(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}t.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t<r;t++)e.put(this.parsedData[t],8)}},r.prototype={addData:function(e){var r=new t(e);this.dataList.push(r),this.dataCache=null},isDark:function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw new Error(e+","+t);return this.modules[e][t]},getModuleCount:function(){return this.moduleCount},make:function(){this.makeImpl(!1,this.getBestMaskPattern())},makeImpl:function(e,t){this.moduleCount=4*this.typeNumber+17,this.modules=new Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++){this.modules[n]=new Array(this.moduleCount);for(var i=0;i<this.moduleCount;i++)this.modules[n][i]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),null==this.dataCache&&(this.dataCache=r.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(this.modules[e+r][t+n]=0<=r&&r<=6&&(0==n||6==n)||0<=n&&n<=6&&(0==r||6==r)||2<=r&&r<=4&&2<=n&&n<=4)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=g.getLostPoint(this);(0==r||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r);this.make();for(var i=0;i<this.modules.length;i++)for(var o=1*i,s=0;s<this.modules[i].length;s++){var a=1*s;this.modules[i][s]&&(n.beginFill(0,100),n.moveTo(a,o),n.lineTo(a+1,o),n.lineTo(a+1,o+1),n.lineTo(a,o+1),n.endFill())}return n},setupTimingPattern:function(){for(var e=8;e<this.moduleCount-8;e++)null==this.modules[e][6]&&(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)null==this.modules[6][t]&&(this.modules[6][t]=t%2==0)},setupPositionAdjustPattern:function(){for(var e=g.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var r=0;r<e.length;r++){var n=e[t],i=e[r];if(null==this.modules[n][i])for(var o=-2;o<=2;o++)for(var s=-2;s<=2;s++)this.modules[n+o][i+s]=-2==o||2==o||-2==s||2==s||0==o&&0==s}},setupTypeNumber:function(e){for(var t=g.getBCHTypeNumber(this.typeNumber),r=0;r<18;r++){var n=!e&&1==(t>>r&1);this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(r=0;r<18;r++){n=!e&&1==(t>>r&1);this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=g.getBCHTypeInfo(r),i=0;i<15;i++){var o=!e&&1==(n>>i&1);i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(i=0;i<15;i++){o=!e&&1==(n>>i&1);i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(6==s&&s--;;){for(var a=0;a<2;a++)if(null==this.modules[n][s-a]){var c=!1;o<e.length&&(c=1==(e[o]>>>i&1)),g.getMask(t,n,s-a)&&(c=!c),this.modules[n][s-a]=c,-1==--i&&(o++,i=7)}if((n+=r)<0||this.moduleCount<=n){n-=r,r=-r;break}}}},r.PAD0=236,r.PAD1=17,r.createData=function(e,t,n){for(var i=b.getRSBlocks(e,t),o=new w,s=0;s<n.length;s++){var a=n[s];o.put(a.mode,4),o.put(a.getLength(),g.getLengthInBits(a.mode,e)),a.write(o)}var c=0;for(s=0;s<i.length;s++)c+=i[s].dataCount;if(o.getLengthInBits()>8*c)throw new Error("code length overflow. ("+o.getLengthInBits()+">"+8*c+")");for(o.getLengthInBits()+4<=8*c&&o.put(0,4);o.getLengthInBits()%8!=0;)o.putBit(!1);for(;!(o.getLengthInBits()>=8*c||(o.put(r.PAD0,8),o.getLengthInBits()>=8*c));)o.put(r.PAD1,8);return r.createBytes(o,i)},r.createBytes=function(e,t){for(var r=0,n=0,i=0,o=new Array(t.length),s=new Array(t.length),a=0;a<t.length;a++){var c=t[a].dataCount,u=t[a].totalCount-c;n=Math.max(n,c),i=Math.max(i,u),o[a]=new Array(c);for(var l=0;l<o[a].length;l++)o[a][l]=255&e.buffer[l+r];r+=c;var A=g.getErrorCorrectPolynomial(u),h=new v(o[a],A.getLength()-1).mod(A);s[a]=new Array(A.getLength()-1);for(l=0;l<s[a].length;l++){var f=l+h.getLength()-s[a].length;s[a][l]=f>=0?h.get(f):0}}var d=0;for(l=0;l<t.length;l++)d+=t[l].totalCount;var p=new Array(d),m=0;for(l=0;l<n;l++)for(a=0;a<t.length;a++)l<o[a].length&&(p[m++]=o[a][l]);for(l=0;l<i;l++)for(a=0;a<t.length;a++)l<s[a].length&&(p[m++]=s[a][l]);return p};for(var n={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},i=1,o=0,s=3,a=2,c=0,u=1,l=2,A=3,h=4,f=5,d=6,p=7,g={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;g.getBCHDigit(t)-g.getBCHDigit(g.G15)>=0;)t^=g.G15<<g.getBCHDigit(t)-g.getBCHDigit(g.G15);return(e<<10|t)^g.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;g.getBCHDigit(t)-g.getBCHDigit(g.G18)>=0;)t^=g.G18<<g.getBCHDigit(t)-g.getBCHDigit(g.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;0!=e;)t++,e>>>=1;return t},getPatternPosition:function(e){return g.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case c:return(t+r)%2==0;case u:return t%2==0;case l:return r%3==0;case A:return(t+r)%3==0;case h:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case f:return t*r%2+t*r%3==0;case d:return(t*r%2+t*r%3)%2==0;case p:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new v([1],0),r=0;r<e;r++)t=t.multiply(new v([1,m.gexp(r)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case n.MODE_NUMBER:return 10;case n.MODE_ALPHA_NUM:return 9;case n.MODE_8BIT_BYTE:case n.MODE_KANJI:return 8;default:throw new Error("mode:"+e)}else if(t<27)switch(e){case n.MODE_NUMBER:return 12;case n.MODE_ALPHA_NUM:return 11;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 10;default:throw new Error("mode:"+e)}else{if(!(t<41))throw new Error("type:"+t);switch(e){case n.MODE_NUMBER:return 14;case n.MODE_ALPHA_NUM:return 13;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 12;default:throw new Error("mode:"+e)}}},getLostPoint:function(e){for(var t=e.getModuleCount(),r=0,n=0;n<t;n++)for(var i=0;i<t;i++){for(var o=0,s=e.isDark(n,i),a=-1;a<=1;a++)if(!(n+a<0||t<=n+a))for(var c=-1;c<=1;c++)i+c<0||t<=i+c||0==a&&0==c||s==e.isDark(n+a,i+c)&&o++;o>5&&(r+=3+o-5)}for(n=0;n<t-1;n++)for(i=0;i<t-1;i++){var u=0;e.isDark(n,i)&&u++,e.isDark(n+1,i)&&u++,e.isDark(n,i+1)&&u++,e.isDark(n+1,i+1)&&u++,0!=u&&4!=u||(r+=3)}for(n=0;n<t;n++)for(i=0;i<t-6;i++)e.isDark(n,i)&&!e.isDark(n,i+1)&&e.isDark(n,i+2)&&e.isDark(n,i+3)&&e.isDark(n,i+4)&&!e.isDark(n,i+5)&&e.isDark(n,i+6)&&(r+=40);for(i=0;i<t;i++)for(n=0;n<t-6;n++)e.isDark(n,i)&&!e.isDark(n+1,i)&&e.isDark(n+2,i)&&e.isDark(n+3,i)&&e.isDark(n+4,i)&&!e.isDark(n+5,i)&&e.isDark(n+6,i)&&(r+=40);var l=0;for(i=0;i<t;i++)for(n=0;n<t;n++)e.isDark(n,i)&&l++;return r+=10*(Math.abs(100*l/t/t-50)/5)}},m={glog:function(e){if(e<1)throw new Error("glog("+e+")");return m.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return m.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)},y=0;y<8;y++)m.EXP_TABLE[y]=1<<y;for(y=8;y<256;y++)m.EXP_TABLE[y]=m.EXP_TABLE[y-4]^m.EXP_TABLE[y-5]^m.EXP_TABLE[y-6]^m.EXP_TABLE[y-8];for(y=0;y<255;y++)m.LOG_TABLE[m.EXP_TABLE[y]]=y;function v(e,t){if(null==e.length)throw new Error(e.length+"/"+t);for(var r=0;r<e.length&&0==e[r];)r++;this.num=new Array(e.length-r+t);for(var n=0;n<e.length-r;n++)this.num[n]=e[n+r]}function b(e,t){this.totalCount=e,this.dataCount=t}function w(){this.buffer=[],this.length=0}v.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=new Array(this.getLength()+e.getLength()-1),r=0;r<this.getLength();r++)for(var n=0;n<e.getLength();n++)t[r+n]^=m.gexp(m.glog(this.get(r))+m.glog(e.get(n)));return new v(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=m.glog(this.get(0))-m.glog(e.get(0)),r=new Array(this.getLength()),n=0;n<this.getLength();n++)r[n]=this.get(n);for(n=0;n<e.getLength();n++)r[n]^=m.gexp(m.glog(e.get(n))+t);return new v(r,0).mod(e)}},b.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],b.getRSBlocks=function(e,t){var r=b.getRsBlockTable(e,t);if(null==r)throw new Error("bad rs block @ typeNumber:"+e+"/errorCorrectLevel:"+t);for(var n=r.length/3,i=[],o=0;o<n;o++)for(var s=r[3*o+0],a=r[3*o+1],c=r[3*o+2],u=0;u<s;u++)i.push(new b(a,c));return i},b.getRsBlockTable=function(e,t){switch(t){case i:return b.RS_BLOCK_TABLE[4*(e-1)+0];case o:return b.RS_BLOCK_TABLE[4*(e-1)+1];case s:return b.RS_BLOCK_TABLE[4*(e-1)+2];case a:return b.RS_BLOCK_TABLE[4*(e-1)+3];default:return}},w.prototype={get:function(e){var t=Math.floor(e/8);return 1==(this.buffer[t]>>>7-e%8&1)},put:function(e,t){for(var r=0;r<t;r++)this.putBit(1==(e>>>t-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var x=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function _(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M"},"string"==typeof e&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if("string"!=typeof this.options.content)throw new Error("Expected 'content' as string!");if(0===this.options.content.length)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0&&this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");var n=this.options.content,c=function(e,t){for(var r=function(e){var t=encodeURI(e).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return t.length+(t.length!=e?3:0)}(e),n=1,i=0,o=0,s=x.length;o<=s;o++){var a=x[o];if(!a)throw new Error("Content too long: expected "+i+" but got "+r);switch(t){case"L":i=a[0];break;case"M":i=a[1];break;case"Q":i=a[2];break;case"H":i=a[3];break;default:throw new Error("Unknwon error correction level: "+t)}if(r<=i)break;n++}if(n>x.length)throw new Error("Content too long");return n}(n,this.options.ecl),u=function(e){switch(e){case"L":return i;case"M":return o;case"Q":return s;case"H":return a;default:throw new Error("Unknwon error correction level: "+e)}}(this.options.ecl);this.qrcode=new r(c,u),this.qrcode.addData(n),this.qrcode.make()}_.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;void 0===e&&(e={container:t.container||"svg"});for(var n=void 0===t.pretty||!!t.pretty,i=n?" ":"",o=n?"\r\n":"",s=t.width,a=t.height,c=r.length,u=s/(c+2*t.padding),l=a/(c+2*t.padding),A=void 0!==t.join&&!!t.join,h=void 0!==t.swap&&!!t.swap,f=void 0===t.xmlDeclaration||!!t.xmlDeclaration,d=void 0!==t.predefined&&!!t.predefined,p=d?i+'<defs><path id="qrmodule" d="M0 0 h'+l+" v"+u+' H0 z" style="fill:'+t.color+';shape-rendering:crispEdges;" /></defs>'+o:"",g=i+'<rect x="0" y="0" width="'+s+'" height="'+a+'" style="fill:'+t.background+';shape-rendering:crispEdges;"/>'+o,m="",y="",v=0;v<c;v++)for(var b=0;b<c;b++){if(r[b][v]){var w=b*u+t.padding*u,x=v*l+t.padding*l;if(h){var _=w;w=x,x=_}if(A){var B=u+w,E=l+x;w=Number.isInteger(w)?Number(w):w.toFixed(2),x=Number.isInteger(x)?Number(x):x.toFixed(2),B=Number.isInteger(B)?Number(B):B.toFixed(2),y+="M"+w+","+x+" V"+(E=Number.isInteger(E)?Number(E):E.toFixed(2))+" H"+B+" V"+x+" H"+w+" Z "}else m+=d?i+'<use x="'+w.toString()+'" y="'+x.toString()+'" href="#qrmodule" />'+o:i+'<rect x="'+w.toString()+'" y="'+x.toString()+'" width="'+u+'" height="'+l+'" style="fill:'+t.color+';shape-rendering:crispEdges;"/>'+o}}A&&(m=i+'<path x="0" y="0" style="fill:'+t.color+';shape-rendering:crispEdges;" d="'+y+'" />');var S="";switch(e.container){case"svg":f&&(S+='<?xml version="1.0" standalone="yes"?>'+o),S+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="'+s+'" height="'+a+'">'+o,S+=p+g+m,S+="</svg>";break;case"svg-viewbox":f&&(S+='<?xml version="1.0" standalone="yes"?>'+o),S+='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 '+s+" "+a+'">'+o,S+=p+g+m,S+="</svg>";break;case"g":S+='<g width="'+s+'" height="'+a+'">'+o,S+=p+g+m,S+="</g>";break;default:S+=(p+g+m).replace(/^\s+/,"")}return S},_.prototype.save=function(e,t){var r=this.svg();"function"!=typeof t&&(t=function(e,t){});try{require("fs").writeFile(e,r,t)}catch(e){t(e)}},e.exports=_}(Ii);var ki=Ii.exports;const Pi=e=>e?(e=>window.btoa(e))(new ki(e).svg()):null;const Ti={height:"0",overflow:"hidden"},Oi={padding:"20px","background-color":"#fff","font-family":"serif","text-align":"center",color:"#49555f","font-size":"12px","word-wrap":"break-word","min-height":"calc(100vh - 145px)","box-sizing":"border-box",margin:"0 auto","min-width":"600px","line-height":"initial",clipPath:"inset(0 100% 0 0)"},Li={"max-width":"460px"},Ni=async(e,t)=>{const r=Xe(t),n=Ui({...Oi,...Ti,...r?Li:{}});n.insertAdjacentHTML("beforeend",t);const i=((e,t)=>t?[e]:Array.from(e.querySelectorAll(":scope > div > div")))(n,r);for(const t of i){const r=Ze(t);e=await pi({pdf:e,pageHTMLElement:t,width:r.width,height:r.height,margin:10})}return Fi(n),e},Ui=e=>{const t=document.createElement("div");var r,n;return t.setAttribute("id","html2pdf-dom-container-identifier"),e&&(r=t,n=e,Object.keys(n).forEach((e=>{r.style[e]=n[e]}))),document.body.appendChild(t),t},Fi=e=>{document.body.removeChild(e)},Mi=async({contentType:e=null,contentEncoding:t="",content:r="",recipientName:n="",certificateTitle:i="",issueDate:o="",issuerName:s="",issuerLogo:a="",recordLink:c="",issuerPublicKey:u=[],issuerProfileUrl:l=[],issuerProfileDomain:A=[]})=>{const h=i;let f;const d=(e=>[$e.IMAGE_GIF,$e.IMAGE_BMP,$e.IMAGE_PNG,$e.IMAGE_JPEG].includes(e))(e),p=e===$e.TEXT_HTML;if((p||d)&&(f=await(async(e,t,r,n,i,o,s,a,c)=>{const u=Ui(Ti),l=Pi(o),A=Ci({certificateTitle:t,issueDate:r,issuerName:n,issuerLogo:i,issuerPublicKey:s,issuerPublicDomain:a,issuerPublicUrl:c,recipientName:e,qrCodeImage:l});u.appendChild(A);const h=await pi({pageHTMLElement:A,width:595,height:842,margin:0});return Fi(u),h})(n,i,o,s,a,c,u,A,l)),p)f=await Ni(f,r);else if(d)f=await gi(f,`data:${e};${t},${r}`);else{const n=function(e){return e===$e.APPLICATION_PDF?"pdf":""}($e.APPLICATION_PDF);!function(e,t,r,n,i=""){const o=`data:${t};${r},${e}`,s=document.createElement("a"),a=[n];i&&a.push(i);const c=a.join(".");s.href=o,s.download=c,s.click()}(r,e,t,h,n)}!function(e,t){e.save(t)}(f,h)};var Ri="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Di(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t}var ji={},Qi="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Hi=[],Ki=[],Vi="undefined"!=typeof Uint8Array?Uint8Array:Array,zi=!1;function qi(){zi=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t<r;++t)Hi[t]=e[t],Ki[e.charCodeAt(t)]=t;Ki["-".charCodeAt(0)]=62,Ki["_".charCodeAt(0)]=63}function Gi(e,t,r){for(var n,i,o=[],s=t;s<r;s+=3)n=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(Hi[(i=n)>>18&63]+Hi[i>>12&63]+Hi[i>>6&63]+Hi[63&i]);return o.join("")}function Wi(e){var t;zi||qi();for(var r=e.length,n=r%3,i="",o=[],s=16383,a=0,c=r-n;a<c;a+=s)o.push(Gi(e,a,a+s>c?c:a+s));return 1===n?(t=e[r-1],i+=Hi[t>>2],i+=Hi[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=Hi[t>>10],i+=Hi[t>>4&63],i+=Hi[t<<2&63],i+="="),o.push(i),o.join("")}function $i(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,A=r?i-1:0,h=r?-1:1,f=e[t+A];for(A+=h,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+A],A+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+A],A+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)}function Ji(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,A=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+A>=1?h/c:h*Math.pow(2,1-A))*c>=2&&(s++,c/=2),s+A>=l?(a=0,s=l):s+A>=1?(a=(t*c-1)*Math.pow(2,i),s+=A):(a=t*Math.pow(2,A-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+f]=255&s,f+=d,s/=256,u-=8);e[r+f-d]|=128*p}var Xi={}.toString,Yi=Array.isArray||function(e){return"[object Array]"==Xi.call(e)};ro.TYPED_ARRAY_SUPPORT=void 0===Qi.TYPED_ARRAY_SUPPORT||Qi.TYPED_ARRAY_SUPPORT;var Zi=eo();function eo(){return ro.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function to(e,t){if(eo()<t)throw new RangeError("Invalid typed array length");return ro.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=ro.prototype:(null===e&&(e=new ro(t)),e.length=t),e}function ro(e,t,r){if(!(ro.TYPED_ARRAY_SUPPORT||this instanceof ro))return new ro(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return oo(this,e)}return no(this,e,t,r)}function no(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),ro.TYPED_ARRAY_SUPPORT?(e=t).__proto__=ro.prototype:e=so(e,t),e}(e,t,r,n):"string"==typeof t?function(e,t,r){if("string"==typeof r&&""!==r||(r="utf8"),!ro.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|uo(t,r),i=(e=to(e,n)).write(t,r);return i!==n&&(e=e.slice(0,i)),e}(e,t,r):function(e,t){if(co(t)){var r=0|ao(t.length);return 0===(e=to(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?to(e,0):so(e,t);if("Buffer"===t.type&&Yi(t.data))return so(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function io(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function oo(e,t){if(io(t),e=to(e,t<0?0:0|ao(t)),!ro.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function so(e,t){var r=t.length<0?0:0|ao(t.length);e=to(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function ao(e){if(e>=eo())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+eo().toString(16)+" bytes");return 0|e}function co(e){return!(null==e||!e._isBuffer)}function uo(e,t){if(co(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return Fo(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Mo(e).length;default:if(n)return Fo(e).length;t=(""+t).toLowerCase(),n=!0}}function lo(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Eo(this,t,r);case"utf8":case"utf-8":return xo(this,t,r);case"ascii":return _o(this,t,r);case"latin1":case"binary":return Bo(this,t,r);case"base64":return wo(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return So(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function Ao(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function ho(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=ro.from(t,n)),co(t))return 0===t.length?-1:fo(e,t,r,n,i);if("number"==typeof t)return t&=255,ro.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):fo(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function fo(e,t,r,n,i){var o,s=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,r/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(i){var l=-1;for(o=r;o<a;o++)if(u(e,o)===u(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===c)return l*s}else-1!==l&&(o-=o-l),l=-1}else for(r+c>a&&(r=a-c),o=r;o>=0;o--){for(var A=!0,h=0;h<c;h++)if(u(e,o+h)!==u(t,h)){A=!1;break}if(A)return o}return-1}function po(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var s=0;s<n;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[r+s]=a}return s}function go(e,t,r,n){return Ro(Fo(t,e.length-r),e,r,n)}function mo(e,t,r,n){return Ro(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function yo(e,t,r,n){return mo(e,t,r,n)}function vo(e,t,r,n){return Ro(Mo(t),e,r,n)}function bo(e,t,r,n){return Ro(function(e,t){for(var r,n,i,o=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function wo(e,t,r){return 0===t&&r===e.length?Wi(e):Wi(e.slice(t,r))}function xo(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var o,s,a,c,u=e[i],l=null,A=u>239?4:u>223?3:u>191?2:1;if(i+A<=r)switch(A){case 1:u<128&&(l=u);break;case 2:128==(192&(o=e[i+1]))&&(c=(31&u)<<6|63&o)>127&&(l=c);break;case 3:o=e[i+1],s=e[i+2],128==(192&o)&&128==(192&s)&&(c=(15&u)<<12|(63&o)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:o=e[i+1],s=e[i+2],a=e[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,A=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=A}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}function _o(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function Bo(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function Eo(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",o=t;o<r;++o)i+=Uo(e[o]);return i}function So(e,t,r){for(var n=e.slice(t,r),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function Co(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function Io(e,t,r,n,i,o){if(!co(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function ko(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-r,2);i<o;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Po(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-r,4);i<o;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function To(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Oo(e,t,r,n,i){return i||To(e,0,r,4),Ji(e,t,r,n,23,4),r+4}function Lo(e,t,r,n,i){return i||To(e,0,r,8),Ji(e,t,r,n,52,8),r+8}ro.poolSize=8192,ro._augment=function(e){return e.__proto__=ro.prototype,e},ro.from=function(e,t,r){return no(null,e,t,r)},ro.TYPED_ARRAY_SUPPORT&&(ro.prototype.__proto__=Uint8Array.prototype,ro.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&ro[Symbol.species]),ro.alloc=function(e,t,r){return function(e,t,r,n){return io(t),t<=0?to(e,t):void 0!==r?"string"==typeof n?to(e,t).fill(r,n):to(e,t).fill(r):to(e,t)}(null,e,t,r)},ro.allocUnsafe=function(e){return oo(null,e)},ro.allocUnsafeSlow=function(e){return oo(null,e)},ro.isBuffer=Do,ro.compare=function(e,t){if(!co(e)||!co(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},ro.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},ro.concat=function(e,t){if(!Yi(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return ro.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=ro.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(!co(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},ro.byteLength=uo,ro.prototype._isBuffer=!0,ro.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)Ao(this,t,t+1);return this},ro.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)Ao(this,t,t+3),Ao(this,t+1,t+2);return this},ro.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)Ao(this,t,t+7),Ao(this,t+1,t+6),Ao(this,t+2,t+5),Ao(this,t+3,t+4);return this},ro.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?xo(this,0,e):lo.apply(this,arguments)},ro.prototype.equals=function(e){if(!co(e))throw new TypeError("Argument must be a Buffer");return this===e||0===ro.compare(this,e)},ro.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},ro.prototype.compare=function(e,t,r,n,i){if(!co(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),a=Math.min(o,s),c=this.slice(n,i),u=e.slice(t,r),l=0;l<a;++l)if(c[l]!==u[l]){o=c[l],s=u[l];break}return o<s?-1:s<o?1:0},ro.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},ro.prototype.indexOf=function(e,t,r){return ho(this,e,t,r,!0)},ro.prototype.lastIndexOf=function(e,t,r){return ho(this,e,t,r,!1)},ro.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return po(this,e,t,r);case"utf8":case"utf-8":return go(this,e,t,r);case"ascii":return mo(this,e,t,r);case"latin1":case"binary":return yo(this,e,t,r);case"base64":return vo(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bo(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},ro.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},ro.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),ro.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=ro.prototype;else{var i=t-e;r=new ro(i,void 0);for(var o=0;o<i;++o)r[o]=this[o+e]}return r},ro.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||Co(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n},ro.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||Co(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},ro.prototype.readUInt8=function(e,t){return t||Co(e,1,this.length),this[e]},ro.prototype.readUInt16LE=function(e,t){return t||Co(e,2,this.length),this[e]|this[e+1]<<8},ro.prototype.readUInt16BE=function(e,t){return t||Co(e,2,this.length),this[e]<<8|this[e+1]},ro.prototype.readUInt32LE=function(e,t){return t||Co(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},ro.prototype.readUInt32BE=function(e,t){return t||Co(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},ro.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||Co(e,t,this.length);for(var n=this[e],i=1,o=0;++o<t&&(i*=256);)n+=this[e+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},ro.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||Co(e,t,this.length);for(var n=t,i=1,o=this[e+--n];n>0&&(i*=256);)o+=this[e+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},ro.prototype.readInt8=function(e,t){return t||Co(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},ro.prototype.readInt16LE=function(e,t){t||Co(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},ro.prototype.readInt16BE=function(e,t){t||Co(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},ro.prototype.readInt32LE=function(e,t){return t||Co(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},ro.prototype.readInt32BE=function(e,t){return t||Co(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},ro.prototype.readFloatLE=function(e,t){return t||Co(e,4,this.length),$i(this,e,!0,23,4)},ro.prototype.readFloatBE=function(e,t){return t||Co(e,4,this.length),$i(this,e,!1,23,4)},ro.prototype.readDoubleLE=function(e,t){return t||Co(e,8,this.length),$i(this,e,!0,52,8)},ro.prototype.readDoubleBE=function(e,t){return t||Co(e,8,this.length),$i(this,e,!1,52,8)},ro.prototype.writeUIntLE=function(e,t,r,n){e=+e,t|=0,r|=0,n||Io(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},ro.prototype.writeUIntBE=function(e,t,r,n){e=+e,t|=0,r|=0,n||Io(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},ro.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,1,255,0),ro.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},ro.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,2,65535,0),ro.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ko(this,e,t,!0),t+2},ro.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,2,65535,0),ro.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ko(this,e,t,!1),t+2},ro.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,4,4294967295,0),ro.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Po(this,e,t,!0),t+4},ro.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,4,4294967295,0),ro.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Po(this,e,t,!1),t+4},ro.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Io(this,e,t,r,i-1,-i)}var o=0,s=1,a=0;for(this[t]=255&e;++o<r&&(s*=256);)e<0&&0===a&&0!==this[t+o-1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},ro.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);Io(this,e,t,r,i-1,-i)}var o=r-1,s=1,a=0;for(this[t+o]=255&e;--o>=0&&(s*=256);)e<0&&0===a&&0!==this[t+o+1]&&(a=1),this[t+o]=(e/s>>0)-a&255;return t+r},ro.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,1,127,-128),ro.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},ro.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,2,32767,-32768),ro.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):ko(this,e,t,!0),t+2},ro.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,2,32767,-32768),ro.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):ko(this,e,t,!1),t+2},ro.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,4,2147483647,-2147483648),ro.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Po(this,e,t,!0),t+4},ro.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||Io(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),ro.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Po(this,e,t,!1),t+4},ro.prototype.writeFloatLE=function(e,t,r){return Oo(this,e,t,!0,r)},ro.prototype.writeFloatBE=function(e,t,r){return Oo(this,e,t,!1,r)},ro.prototype.writeDoubleLE=function(e,t,r){return Lo(this,e,t,!0,r)},ro.prototype.writeDoubleBE=function(e,t,r){return Lo(this,e,t,!1,r)},ro.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,o=n-r;if(this===e&&r<t&&t<n)for(i=o-1;i>=0;--i)e[i+t]=this[i+r];else if(o<1e3||!ro.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+o),t);return o},ro.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!ro.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var o;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=co(e)?e:Fo(new ro(e,n).toString()),a=s.length;for(o=0;o<r-t;++o)this[o+t]=s[o%a]}return this};var No=/[^+\/0-9A-Za-z-_]/g;function Uo(e){return e<16?"0"+e.toString(16):e.toString(16)}function Fo(e,t){var r;t=t||1/0;for(var n=e.length,i=null,o=[],s=0;s<n;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function Mo(e){return function(e){var t,r,n,i,o,s;zi||qi();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[a-2]?2:"="===e[a-1]?1:0,s=new Vi(3*a/4-o),n=o>0?a-4:a;var c=0;for(t=0,r=0;t<n;t+=4,r+=3)i=Ki[e.charCodeAt(t)]<<18|Ki[e.charCodeAt(t+1)]<<12|Ki[e.charCodeAt(t+2)]<<6|Ki[e.charCodeAt(t+3)],s[c++]=i>>16&255,s[c++]=i>>8&255,s[c++]=255&i;return 2===o?(i=Ki[e.charCodeAt(t)]<<2|Ki[e.charCodeAt(t+1)]>>4,s[c++]=255&i):1===o&&(i=Ki[e.charCodeAt(t)]<<10|Ki[e.charCodeAt(t+1)]<<4|Ki[e.charCodeAt(t+2)]>>2,s[c++]=i>>8&255,s[c++]=255&i),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(No,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Ro(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Do(e){return null!=e&&(!!e._isBuffer||jo(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&jo(e.slice(0,0))}(e))}function jo(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Qo=Di(Object.freeze({__proto__:null,INSPECT_MAX_BYTES:50,kMaxLength:Zi,Buffer:ro,SlowBuffer:function(e){return+e!=e&&(e=0),ro.alloc(+e)},isBuffer:Do})),Ho={
|
|
519
519
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
520
520
|
read:function(e,t,r,n,i){var o,s,a=8*i-n-1,c=(1<<a)-1,u=c>>1,l=-7,A=r?i-1:0,h=r?-1:1,f=e[t+A];for(A+=h,o=f&(1<<-l)-1,f>>=-l,l+=a;l>0;o=256*o+e[t+A],A+=h,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=n;l>0;s=256*s+e[t+A],A+=h,l-=8);if(0===o)o=1-u;else{if(o===c)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,n),o-=u}return(f?-1:1)*s*Math.pow(2,o-n)},write:function(e,t,r,n,i,o){var s,a,c,u=8*o-i-1,l=(1<<u)-1,A=l>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,d=n?1:-1,p=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+A>=1?h/c:h*Math.pow(2,1-A))*c>=2&&(s++,c/=2),s+A>=l?(a=0,s=l):s+A>=1?(a=(t*c-1)*Math.pow(2,i),s+=A):(a=t*Math.pow(2,A-1)*Math.pow(2,i),s=0));i>=8;e[r+f]=255&a,f+=d,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;e[r+f]=255&s,f+=d,s/=256,u-=8);e[r+f-d]|=128*p}},Ko={exports:{}};!function(e){!function(t){var r,n=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,i=Math.ceil,o=Math.floor,s="[BigNumber Error] ",a=s+"Number primitive has more than 15 significant digits: ",c=1e14,u=14,l=9007199254740991,A=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],h=1e7,f=1e9;function d(e){var t=0|e;return e>0||e===t?t:t-1}function p(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=u-t.length;r--;t="0"+t);o+=t}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function g(e,t){var r,n,i=e.c,o=t.c,s=e.s,a=t.s,c=e.e,u=t.e;if(!s||!a)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-a:s;if(s!=a)return s;if(r=s<0,n=c==u,!i||!o)return n?0:!i^r?1:-1;if(!n)return c>u^r?1:-1;for(a=(c=i.length)<(u=o.length)?c:u,s=0;s<a;s++)if(i[s]!=o[s])return i[s]>o[s]^r?1:-1;return c==u?0:c>u^r?1:-1}function m(e,t,r,n){if(e<t||e>r||e!==o(e))throw Error(s+(n||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function y(e){var t=e.c.length-1;return d(e.e/u)==t&&e.c[t]%2!=0}function v(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function b(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(++t>(n=e.length)){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}r=function e(t){var r,w,x,_,B,E,S,C,I,k,P=V.prototype={constructor:V,toString:null,valueOf:null},T=new V(1),O=20,L=4,N=-7,U=21,F=-1e7,M=1e7,R=!1,D=1,j=0,Q={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},H="0123456789abcdefghijklmnopqrstuvwxyz",K=!0;function V(e,t){var r,i,s,c,A,h,f,d,p=this;if(!(p instanceof V))return new V(e,t);if(null==t){if(e&&!0===e._isBigNumber)return p.s=e.s,void(!e.c||e.e>M?p.c=p.e=null:e.e<F?p.c=[p.e=0]:(p.e=e.e,p.c=e.c.slice()));if((h="number"==typeof e)&&0*e==0){if(p.s=1/e<0?(e=-e,-1):1,e===~~e){for(c=0,A=e;A>=10;A/=10,c++);return void(c>M?p.c=p.e=null:(p.e=c,p.c=[e]))}d=String(e)}else{if(!n.test(d=String(e)))return x(p,d,h);p.s=45==d.charCodeAt(0)?(d=d.slice(1),-1):1}(c=d.indexOf("."))>-1&&(d=d.replace(".","")),(A=d.search(/e/i))>0?(c<0&&(c=A),c+=+d.slice(A+1),d=d.substring(0,A)):c<0&&(c=d.length)}else{if(m(t,2,H.length,"Base"),10==t&&K)return W(p=new V(e),O+p.e+1,L);if(d=String(e),h="number"==typeof e){if(0*e!=0)return x(p,d,h,t);if(p.s=1/e<0?(d=d.slice(1),-1):1,V.DEBUG&&d.replace(/^0\.0*|\./,"").length>15)throw Error(a+e)}else p.s=45===d.charCodeAt(0)?(d=d.slice(1),-1):1;for(r=H.slice(0,t),c=A=0,f=d.length;A<f;A++)if(r.indexOf(i=d.charAt(A))<0){if("."==i){if(A>c){c=f;continue}}else if(!s&&(d==d.toUpperCase()&&(d=d.toLowerCase())||d==d.toLowerCase()&&(d=d.toUpperCase()))){s=!0,A=-1,c=0;continue}return x(p,String(e),h,t)}h=!1,(c=(d=w(d,t,10,p.s)).indexOf("."))>-1?d=d.replace(".",""):c=d.length}for(A=0;48===d.charCodeAt(A);A++);for(f=d.length;48===d.charCodeAt(--f););if(d=d.slice(A,++f)){if(f-=A,h&&V.DEBUG&&f>15&&(e>l||e!==o(e)))throw Error(a+p.s*e);if((c=c-A-1)>M)p.c=p.e=null;else if(c<F)p.c=[p.e=0];else{if(p.e=c,p.c=[],A=(c+1)%u,c<0&&(A+=u),A<f){for(A&&p.c.push(+d.slice(0,A)),f-=u;A<f;)p.c.push(+d.slice(A,A+=u));A=u-(d=d.slice(A)).length}else A-=f;for(;A--;d+="0");p.c.push(+d)}}else p.c=[p.e=0]}function z(e,t,r,n){var i,o,s,a,c;if(null==r?r=L:m(r,0,8),!e.c)return e.toString();if(i=e.c[0],s=e.e,null==t)c=p(e.c),c=1==n||2==n&&(s<=N||s>=U)?v(c,s):b(c,s,"0");else if(o=(e=W(new V(e),t,r)).e,a=(c=p(e.c)).length,1==n||2==n&&(t<=o||o<=N)){for(;a<t;c+="0",a++);c=v(c,o)}else if(t-=s,c=b(c,o,"0"),o+1>a){if(--t>0)for(c+=".";t--;c+="0");}else if((t+=o-a)>0)for(o+1==a&&(c+=".");t--;c+="0");return e.s<0&&i?"-"+c:c}function q(e,t){for(var r,n=1,i=new V(e[0]);n<e.length;n++){if(!(r=new V(e[n])).s){i=r;break}t.call(i,r)&&(i=r)}return i}function G(e,t,r){for(var n=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,n++);return(r=n+r*u-1)>M?e.c=e.e=null:r<F?e.c=[e.e=0]:(e.e=r,e.c=t),e}function W(e,t,r,n){var s,a,l,h,f,d,p,g=e.c,m=A;if(g){e:{for(s=1,h=g[0];h>=10;h/=10,s++);if((a=t-s)<0)a+=u,l=t,p=(f=g[d=0])/m[s-l-1]%10|0;else if((d=i((a+1)/u))>=g.length){if(!n)break e;for(;g.length<=d;g.push(0));f=p=0,s=1,l=(a%=u)-u+1}else{for(f=h=g[d],s=1;h>=10;h/=10,s++);p=(l=(a%=u)-u+s)<0?0:f/m[s-l-1]%10|0}if(n=n||t<0||null!=g[d+1]||(l<0?f:f%m[s-l-1]),n=r<4?(p||n)&&(0==r||r==(e.s<0?3:2)):p>5||5==p&&(4==r||n||6==r&&(a>0?l>0?f/m[s-l]:0:g[d-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,n?(t-=e.e+1,g[0]=m[(u-t%u)%u],e.e=-t||0):g[0]=e.e=0,e;if(0==a?(g.length=d,h=1,d--):(g.length=d+1,h=m[u-a],g[d]=l>0?o(f/m[s-l]%m[l])*h:0),n)for(;;){if(0==d){for(a=1,l=g[0];l>=10;l/=10,a++);for(l=g[0]+=h,h=1;l>=10;l/=10,h++);a!=h&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[d]+=h,g[d]!=c)break;g[d--]=0,h=1}for(a=g.length;0===g[--a];g.pop());}e.e>M?e.c=e.e=null:e.e<F&&(e.c=[e.e=0])}return e}function $(e){var t,r=e.e;return null===r?e.toString():(t=p(e.c),t=r<=N||r>=U?v(t,r):b(t,r,"0"),e.s<0?"-"+t:t)}return V.clone=e,V.ROUND_UP=0,V.ROUND_DOWN=1,V.ROUND_CEIL=2,V.ROUND_FLOOR=3,V.ROUND_HALF_UP=4,V.ROUND_HALF_DOWN=5,V.ROUND_HALF_EVEN=6,V.ROUND_HALF_CEIL=7,V.ROUND_HALF_FLOOR=8,V.EUCLID=9,V.config=V.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(s+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(m(r=e[t],0,f,t),O=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(m(r=e[t],0,8,t),L=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(m(r[0],-f,0,t),m(r[1],0,f,t),N=r[0],U=r[1]):(m(r,-f,f,t),N=-(U=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)m(r[0],-f,-1,t),m(r[1],1,f,t),F=r[0],M=r[1];else{if(m(r,-f,f,t),!r)throw Error(s+t+" cannot be zero: "+r);F=-(M=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(s+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw R=!r,Error(s+"crypto unavailable");R=r}else R=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(m(r=e[t],0,9,t),D=r),e.hasOwnProperty(t="POW_PRECISION")&&(m(r=e[t],0,f,t),j=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(s+t+" not an object: "+r);Q=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(s+t+" invalid: "+r);K="0123456789"==r.slice(0,10),H=r}}return{DECIMAL_PLACES:O,ROUNDING_MODE:L,EXPONENTIAL_AT:[N,U],RANGE:[F,M],CRYPTO:R,MODULO_MODE:D,POW_PRECISION:j,FORMAT:Q,ALPHABET:H}},V.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!V.DEBUG)return!0;var t,r,n=e.c,i=e.e,a=e.s;e:if("[object Array]"=={}.toString.call(n)){if((1===a||-1===a)&&i>=-f&&i<=f&&i===o(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break e}if((t=(i+1)%u)<1&&(t+=u),String(n[0]).length==t){for(t=0;t<n.length;t++)if((r=n[t])<0||r>=c||r!==o(r))break e;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===a||1===a||-1===a))return!0;throw Error(s+"Invalid BigNumber: "+e)},V.maximum=V.max=function(){return q(arguments,P.lt)},V.minimum=V.min=function(){return q(arguments,P.gt)},V.random=(_=9007199254740992,B=Math.random()*_&2097151?function(){return o(Math.random()*_)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,n,a,c,l=0,h=[],d=new V(T);if(null==e?e=O:m(e,0,f),a=i(e/u),R)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(a*=2));l<a;)(c=131072*t[l]+(t[l+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[l]=r[0],t[l+1]=r[1]):(h.push(c%1e14),l+=2);l=a/2}else{if(!crypto.randomBytes)throw R=!1,Error(s+"crypto unavailable");for(t=crypto.randomBytes(a*=7);l<a;)(c=281474976710656*(31&t[l])+1099511627776*t[l+1]+4294967296*t[l+2]+16777216*t[l+3]+(t[l+4]<<16)+(t[l+5]<<8)+t[l+6])>=9e15?crypto.randomBytes(7).copy(t,l):(h.push(c%1e14),l+=7);l=a/7}if(!R)for(;l<a;)(c=B())<9e15&&(h[l++]=c%1e14);for(a=h[--l],e%=u,a&&e&&(c=A[u-e],h[l]=o(a/c)*c);0===h[l];h.pop(),l--);if(l<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=u);for(l=1,c=h[0];c>=10;c/=10,l++);l<u&&(n-=u-l)}return d.e=n,d.c=h,d}),V.sum=function(){for(var e=1,t=arguments,r=new V(t[0]);e<t.length;)r=r.plus(t[e++]);return r},w=function(){var e="0123456789";function t(e,t,r,n){for(var i,o,s=[0],a=0,c=e.length;a<c;){for(o=s.length;o--;s[o]*=t);for(s[0]+=n.indexOf(e.charAt(a++)),i=0;i<s.length;i++)s[i]>r-1&&(null==s[i+1]&&(s[i+1]=0),s[i+1]+=s[i]/r|0,s[i]%=r)}return s.reverse()}return function(n,i,o,s,a){var c,u,l,A,h,f,d,g,m=n.indexOf("."),y=O,v=L;for(m>=0&&(A=j,j=0,n=n.replace(".",""),f=(g=new V(i)).pow(n.length-m),j=A,g.c=t(b(p(f.c),f.e,"0"),10,o,e),g.e=g.c.length),l=A=(d=t(n,i,o,a?(c=H,e):(c=e,H))).length;0==d[--A];d.pop());if(!d[0])return c.charAt(0);if(m<0?--l:(f.c=d,f.e=l,f.s=s,d=(f=r(f,g,y,v,o)).c,h=f.r,l=f.e),m=d[u=l+y+1],A=o/2,h=h||u<0||null!=d[u+1],h=v<4?(null!=m||h)&&(0==v||v==(f.s<0?3:2)):m>A||m==A&&(4==v||h||6==v&&1&d[u-1]||v==(f.s<0?8:7)),u<1||!d[0])n=h?b(c.charAt(1),-y,c.charAt(0)):c.charAt(0);else{if(d.length=u,h)for(--o;++d[--u]>o;)d[u]=0,u||(++l,d=[1].concat(d));for(A=d.length;!d[--A];);for(m=0,n="";m<=A;n+=c.charAt(d[m++]));n=b(n,l,c.charAt(0))}return n}}(),r=function(){function e(e,t,r){var n,i,o,s,a=0,c=e.length,u=t%h,l=t/h|0;for(e=e.slice();c--;)a=((i=u*(o=e[c]%h)+(n=l*o+(s=e[c]/h|0)*u)%h*h+a)/r|0)+(n/h|0)+l*s,e[c]=i%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,n){var i,o;if(r!=n)o=r>n?1:-1;else for(i=o=0;i<r;i++)if(e[i]!=t[i]){o=e[i]>t[i]?1:-1;break}return o}function r(e,t,r,n){for(var i=0;r--;)e[r]-=i,i=e[r]<t[r]?1:0,e[r]=i*n+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(n,i,s,a,l){var A,h,f,p,g,m,y,v,b,w,x,_,B,E,S,C,I,k=n.s==i.s?1:-1,P=n.c,T=i.c;if(!(P&&P[0]&&T&&T[0]))return new V(n.s&&i.s&&(P?!T||P[0]!=T[0]:T)?P&&0==P[0]||!T?0*k:k/0:NaN);for(b=(v=new V(k)).c=[],k=s+(h=n.e-i.e)+1,l||(l=c,h=d(n.e/u)-d(i.e/u),k=k/u|0),f=0;T[f]==(P[f]||0);f++);if(T[f]>(P[f]||0)&&h--,k<0)b.push(1),p=!0;else{for(E=P.length,C=T.length,f=0,k+=2,(g=o(l/(T[0]+1)))>1&&(T=e(T,g,l),P=e(P,g,l),C=T.length,E=P.length),B=C,x=(w=P.slice(0,C)).length;x<C;w[x++]=0);I=T.slice(),I=[0].concat(I),S=T[0],T[1]>=l/2&&S++;do{if(g=0,(A=t(T,w,C,x))<0){if(_=w[0],C!=x&&(_=_*l+(w[1]||0)),(g=o(_/S))>1)for(g>=l&&(g=l-1),y=(m=e(T,g,l)).length,x=w.length;1==t(m,w,y,x);)g--,r(m,C<y?I:T,y,l),y=m.length,A=1;else 0==g&&(A=g=1),y=(m=T.slice()).length;if(y<x&&(m=[0].concat(m)),r(w,m,x,l),x=w.length,-1==A)for(;t(T,w,C,x)<1;)g++,r(w,C<x?I:T,x,l),x=w.length}else 0===A&&(g++,w=[0]);b[f++]=g,w[0]?w[x++]=P[B]||0:(w=[P[B]],x=1)}while((B++<E||null!=w[0])&&k--);p=null!=w[0],b[0]||b.splice(0,1)}if(l==c){for(f=1,k=b[0];k>=10;k/=10,f++);W(v,s+(v.e=f+h*u-1)+1,a,p)}else v.e=h,v.r=+p;return v}}(),E=/^(-?)0([xbo])(?=\w[\w.]*$)/i,S=/^([^.]+)\.$/,C=/^\.([^.]+)$/,I=/^-?(Infinity|NaN)$/,k=/^\s*\+(?=[\w.])|^\s+|\s+$/g,x=function(e,t,r,n){var i,o=r?t:t.replace(k,"");if(I.test(o))e.s=isNaN(o)?null:o<0?-1:1;else{if(!r&&(o=o.replace(E,(function(e,t,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?e:t})),n&&(i=n,o=o.replace(S,"$1").replace(C,"0.$1")),t!=o))return new V(o,i);if(V.DEBUG)throw Error(s+"Not a"+(n?" base "+n:"")+" number: "+t);e.s=null}e.c=e.e=null},P.absoluteValue=P.abs=function(){var e=new V(this);return e.s<0&&(e.s=1),e},P.comparedTo=function(e,t){return g(this,new V(e,t))},P.decimalPlaces=P.dp=function(e,t){var r,n,i,o=this;if(null!=e)return m(e,0,f),null==t?t=L:m(t,0,8),W(new V(o),e+o.e+1,t);if(!(r=o.c))return null;if(n=((i=r.length-1)-d(this.e/u))*u,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},P.dividedBy=P.div=function(e,t){return r(this,new V(e,t),O,L)},P.dividedToIntegerBy=P.idiv=function(e,t){return r(this,new V(e,t),0,1)},P.exponentiatedBy=P.pow=function(e,t){var r,n,a,c,l,A,h,f,d=this;if((e=new V(e)).c&&!e.isInteger())throw Error(s+"Exponent not an integer: "+$(e));if(null!=t&&(t=new V(t)),l=e.e>14,!d.c||!d.c[0]||1==d.c[0]&&!d.e&&1==d.c.length||!e.c||!e.c[0])return f=new V(Math.pow(+$(d),l?2-y(e):+$(e))),t?f.mod(t):f;if(A=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new V(NaN);(n=!A&&d.isInteger()&&t.isInteger())&&(d=d.mod(t))}else{if(e.e>9&&(d.e>0||d.e<-1||(0==d.e?d.c[0]>1||l&&d.c[1]>=24e7:d.c[0]<8e13||l&&d.c[0]<=9999975e7)))return c=d.s<0&&y(e)?-0:0,d.e>-1&&(c=1/c),new V(A?1/c:c);j&&(c=i(j/u+2))}for(l?(r=new V(.5),A&&(e.s=1),h=y(e)):h=(a=Math.abs(+$(e)))%2,f=new V(T);;){if(h){if(!(f=f.times(d)).c)break;c?f.c.length>c&&(f.c.length=c):n&&(f=f.mod(t))}if(a){if(0===(a=o(a/2)))break;h=a%2}else if(W(e=e.times(r),e.e+1,1),e.e>14)h=y(e);else{if(0==(a=+$(e)))break;h=a%2}d=d.times(d),c?d.c&&d.c.length>c&&(d.c.length=c):n&&(d=d.mod(t))}return n?f:(A&&(f=T.div(f)),t?f.mod(t):c?W(f,j,L,void 0):f)},P.integerValue=function(e){var t=new V(this);return null==e?e=L:m(e,0,8),W(t,t.e+1,e)},P.isEqualTo=P.eq=function(e,t){return 0===g(this,new V(e,t))},P.isFinite=function(){return!!this.c},P.isGreaterThan=P.gt=function(e,t){return g(this,new V(e,t))>0},P.isGreaterThanOrEqualTo=P.gte=function(e,t){return 1===(t=g(this,new V(e,t)))||0===t},P.isInteger=function(){return!!this.c&&d(this.e/u)>this.c.length-2},P.isLessThan=P.lt=function(e,t){return g(this,new V(e,t))<0},P.isLessThanOrEqualTo=P.lte=function(e,t){return-1===(t=g(this,new V(e,t)))||0===t},P.isNaN=function(){return!this.s},P.isNegative=function(){return this.s<0},P.isPositive=function(){return this.s>0},P.isZero=function(){return!!this.c&&0==this.c[0]},P.minus=function(e,t){var r,n,i,o,s=this,a=s.s;if(t=(e=new V(e,t)).s,!a||!t)return new V(NaN);if(a!=t)return e.s=-t,s.plus(e);var l=s.e/u,A=e.e/u,h=s.c,f=e.c;if(!l||!A){if(!h||!f)return h?(e.s=-t,e):new V(f?s:NaN);if(!h[0]||!f[0])return f[0]?(e.s=-t,e):new V(h[0]?s:3==L?-0:0)}if(l=d(l),A=d(A),h=h.slice(),a=l-A){for((o=a<0)?(a=-a,i=h):(A=l,i=f),i.reverse(),t=a;t--;i.push(0));i.reverse()}else for(n=(o=(a=h.length)<(t=f.length))?a:t,a=t=0;t<n;t++)if(h[t]!=f[t]){o=h[t]<f[t];break}if(o&&(i=h,h=f,f=i,e.s=-e.s),(t=(n=f.length)-(r=h.length))>0)for(;t--;h[r++]=0);for(t=c-1;n>a;){if(h[--n]<f[n]){for(r=n;r&&!h[--r];h[r]=t);--h[r],h[n]+=c}h[n]-=f[n]}for(;0==h[0];h.splice(0,1),--A);return h[0]?G(e,h,A):(e.s=3==L?-1:1,e.c=[e.e=0],e)},P.modulo=P.mod=function(e,t){var n,i,o=this;return e=new V(e,t),!o.c||!e.s||e.c&&!e.c[0]?new V(NaN):!e.c||o.c&&!o.c[0]?new V(o):(9==D?(i=e.s,e.s=1,n=r(o,e,0,3),e.s=i,n.s*=i):n=r(o,e,0,D),(e=o.minus(n.times(e))).c[0]||1!=D||(e.s=o.s),e)},P.multipliedBy=P.times=function(e,t){var r,n,i,o,s,a,l,A,f,p,g,m,y,v,b,w=this,x=w.c,_=(e=new V(e,t)).c;if(!(x&&_&&x[0]&&_[0]))return!w.s||!e.s||x&&!x[0]&&!_||_&&!_[0]&&!x?e.c=e.e=e.s=null:(e.s*=w.s,x&&_?(e.c=[0],e.e=0):e.c=e.e=null),e;for(n=d(w.e/u)+d(e.e/u),e.s*=w.s,(l=x.length)<(p=_.length)&&(y=x,x=_,_=y,i=l,l=p,p=i),i=l+p,y=[];i--;y.push(0));for(v=c,b=h,i=p;--i>=0;){for(r=0,g=_[i]%b,m=_[i]/b|0,o=i+(s=l);o>i;)r=((A=g*(A=x[--s]%b)+(a=m*A+(f=x[s]/b|0)*g)%b*b+y[o]+r)/v|0)+(a/b|0)+m*f,y[o--]=A%v;y[o]=r}return r?++n:y.splice(0,1),G(e,y,n)},P.negated=function(){var e=new V(this);return e.s=-e.s||null,e},P.plus=function(e,t){var r,n=this,i=n.s;if(t=(e=new V(e,t)).s,!i||!t)return new V(NaN);if(i!=t)return e.s=-t,n.minus(e);var o=n.e/u,s=e.e/u,a=n.c,l=e.c;if(!o||!s){if(!a||!l)return new V(i/0);if(!a[0]||!l[0])return l[0]?e:new V(a[0]?n:0*i)}if(o=d(o),s=d(s),a=a.slice(),i=o-s){for(i>0?(s=o,r=l):(i=-i,r=a),r.reverse();i--;r.push(0));r.reverse()}for((i=a.length)-(t=l.length)<0&&(r=l,l=a,a=r,t=i),i=0;t;)i=(a[--t]=a[t]+l[t]+i)/c|0,a[t]=c===a[t]?0:a[t]%c;return i&&(a=[i].concat(a),++s),G(e,a,s)},P.precision=P.sd=function(e,t){var r,n,i,o=this;if(null!=e&&e!==!!e)return m(e,1,f),null==t?t=L:m(t,0,8),W(new V(o),e,t);if(!(r=o.c))return null;if(n=(i=r.length-1)*u+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return e&&o.e+1>n&&(n=o.e+1),n},P.shiftedBy=function(e){return m(e,-9007199254740991,l),this.times("1e"+e)},P.squareRoot=P.sqrt=function(){var e,t,n,i,o,s=this,a=s.c,c=s.s,u=s.e,l=O+4,A=new V("0.5");if(1!==c||!a||!a[0])return new V(!c||c<0&&(!a||a[0])?NaN:a?s:1/0);if(0==(c=Math.sqrt(+$(s)))||c==1/0?(((t=p(a)).length+u)%2==0&&(t+="0"),c=Math.sqrt(+t),u=d((u+1)/2)-(u<0||u%2),n=new V(t=c==1/0?"5e"+u:(t=c.toExponential()).slice(0,t.indexOf("e")+1)+u)):n=new V(c+""),n.c[0])for((c=(u=n.e)+l)<3&&(c=0);;)if(o=n,n=A.times(o.plus(r(s,o,l,1))),p(o.c).slice(0,c)===(t=p(n.c)).slice(0,c)){if(n.e<u&&--c,"9999"!=(t=t.slice(c-3,c+1))&&(i||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(W(n,n.e+O+2,1),e=!n.times(n).eq(s));break}if(!i&&(W(o,o.e+O+2,0),o.times(o).eq(s))){n=o;break}l+=4,c+=4,i=1}return W(n,n.e+O+1,L,e)},P.toExponential=function(e,t){return null!=e&&(m(e,0,f),e++),z(this,e,t,1)},P.toFixed=function(e,t){return null!=e&&(m(e,0,f),e=e+this.e+1),z(this,e,t)},P.toFormat=function(e,t,r){var n,i=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=Q;else if("object"!=typeof r)throw Error(s+"Argument not an object: "+r);if(n=i.toFixed(e,t),i.c){var o,a=n.split("."),c=+r.groupSize,u=+r.secondaryGroupSize,l=r.groupSeparator||"",A=a[0],h=a[1],f=i.s<0,d=f?A.slice(1):A,p=d.length;if(u&&(o=c,c=u,u=o,p-=o),c>0&&p>0){for(o=p%c||c,A=d.substr(0,o);o<p;o+=c)A+=l+d.substr(o,c);u>0&&(A+=l+d.slice(o)),f&&(A="-"+A)}n=h?A+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):A}return(r.prefix||"")+n+(r.suffix||"")},P.toFraction=function(e){var t,n,i,o,a,c,l,h,f,d,g,m,y=this,v=y.c;if(null!=e&&(!(l=new V(e)).isInteger()&&(l.c||1!==l.s)||l.lt(T)))throw Error(s+"Argument "+(l.isInteger()?"out of range: ":"not an integer: ")+$(l));if(!v)return new V(y);for(t=new V(T),f=n=new V(T),i=h=new V(T),m=p(v),a=t.e=m.length-y.e-1,t.c[0]=A[(c=a%u)<0?u+c:c],e=!e||l.comparedTo(t)>0?a>0?t:f:l,c=M,M=1/0,l=new V(m),h.c[0]=0;d=r(l,t,0,1),1!=(o=n.plus(d.times(i))).comparedTo(e);)n=i,i=o,f=h.plus(d.times(o=f)),h=o,t=l.minus(d.times(o=t)),l=o;return o=r(e.minus(n),i,0,1),h=h.plus(o.times(f)),n=n.plus(o.times(i)),h.s=f.s=y.s,g=r(f,i,a*=2,L).minus(y).abs().comparedTo(r(h,n,a,L).minus(y).abs())<1?[f,i]:[h,n],M=c,g},P.toNumber=function(){return+$(this)},P.toPrecision=function(e,t){return null!=e&&m(e,1,f),z(this,e,t,2)},P.toString=function(e){var t,r=this,n=r.s,i=r.e;return null===i?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=i<=N||i>=U?v(p(r.c),i):b(p(r.c),i,"0"):10===e&&K?t=b(p((r=W(new V(r),O+i+1,L)).c),r.e,"0"):(m(e,2,H.length,"Base"),t=w(b(p(r.c),i,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},P.valueOf=P.toJSON=function(){return $(this)},P._isBigNumber=!0,null!=t&&V.set(t),V}(),r.default=r.BigNumber=r,e.exports?e.exports=r:(t||(t="undefined"!=typeof self&&self?self:window),t.BigNumber=r)}(Ri)}(Ko);var Vo={},zo={};const qo=Ko.exports.BigNumber;zo.MT={POS_INT:0,NEG_INT:1,BYTE_STRING:2,UTF8_STRING:3,ARRAY:4,MAP:5,TAG:6,SIMPLE_FLOAT:7},zo.TAG={DATE_STRING:0,DATE_EPOCH:1,POS_BIGINT:2,NEG_BIGINT:3,DECIMAL_FRAC:4,BIGFLOAT:5,BASE64URL_EXPECTED:21,BASE64_EXPECTED:22,BASE16_EXPECTED:23,CBOR:24,URI:32,BASE64URL:33,BASE64:34,REGEXP:35,MIME:36},zo.NUMBYTES={ZERO:0,ONE:24,TWO:25,FOUR:26,EIGHT:27,INDEFINITE:31},zo.SIMPLE={FALSE:20,TRUE:21,NULL:22,UNDEFINED:23},zo.SYMS={NULL:Symbol("null"),UNDEFINED:Symbol("undef"),PARENT:Symbol("parent"),BREAK:Symbol("break"),STREAM:Symbol("stream")},zo.SHIFT32=Math.pow(2,32),zo.SHIFT16=Math.pow(2,16),zo.MAX_SAFE_HIGH=2097151,zo.NEG_ONE=new qo(-1),zo.TEN=new qo(10),zo.TWO=new qo(2),zo.PARENT={ARRAY:0,OBJECT:1,MAP:2,TAG:3,BYTE_STRING:4,UTF8_STRING:5},function(e){const{Buffer:t}=Qo,r=Ko.exports.BigNumber,n=zo,i=n.SHIFT32,o=n.SHIFT16;function s(e){return e<16?"0"+e.toString(16):e.toString(16)}e.parseHalf=function(e){var t,r,n;return n=128&e[0]?-1:1,t=(124&e[0])>>2,r=(3&e[0])<<8|e[1],t?31===t?n*(r?NaN:1/0):n*Math.pow(2,t-25)*(1024+r):5.960464477539063e-8*n*r},e.arrayBufferToBignumber=function(e){const t=e.byteLength;let n="";for(let r=0;r<t;r++)n+=s(e[r]);return new r(n,16)},e.buildMap=e=>{const t=new Map,r=Object.keys(e),n=r.length;for(let i=0;i<n;i++)t.set(r[i],e[r[i]]);return t},e.buildInt32=(e,t)=>e*o+t,e.buildInt64=(t,n,o,s)=>{const a=e.buildInt32(t,n),c=e.buildInt32(o,s);return a>2097151?new r(a).times(i).plus(c):a*i+c},e.writeHalf=function(e,r){const n=t.allocUnsafe(4);n.writeFloatBE(r,0);const i=n.readUInt32BE(0);if(0!=(8191&i))return!1;var o=i>>16&32768;const s=i>>23&255,a=8388607&i;if(s>=113&&s<=142)o+=(s-112<<10)+(a>>13);else{if(!(s>=103&&s<113))return!1;if(a&(1<<126-s)-1)return!1;o+=a+8388608>>126-s}return e.writeUInt16BE(o,0),!0},e.keySorter=function(e,t){var r=e[0].byteLength,n=t[0].byteLength;return r>n?1:n>r?-1:e[0].compare(t[0])},e.isNegativeZero=e=>0===e&&1/e<0,e.nextPowerOf2=e=>{let t=0;if(e&&!(e&e-1))return e;for(;0!==e;)e>>=1,t+=1;return 1<<t}}(Vo);const Go=zo,Wo=Go.MT,$o=Go.SIMPLE,Jo=Go.SYMS;class Xo{constructor(e){if("number"!=typeof e)throw new Error("Invalid Simple type: "+typeof e);if(e<0||e>255||(0|e)!==e)throw new Error("value must be a small positive integer: "+e);this.value=e}toString(){return"simple("+this.value+")"}inspect(){return"simple("+this.value+")"}encodeCBOR(e){return e._pushInt(this.value,Wo.SIMPLE_FLOAT)}static isSimple(e){return e instanceof Xo}static decode(e,t){switch(null==t&&(t=!0),e){case $o.FALSE:return!1;case $o.TRUE:return!0;case $o.NULL:return t?null:Jo.NULL;case $o.UNDEFINED:return t?void 0:Jo.UNDEFINED;case-1:if(!t)throw new Error("Invalid BREAK");return Jo.BREAK;default:return new Xo(e)}}}var Yo=Xo;class Zo{constructor(e,t,r){if(this.tag=e,this.value=t,this.err=r,"number"!=typeof this.tag)throw new Error("Invalid tag type ("+typeof this.tag+")");if(this.tag<0||(0|this.tag)!==this.tag)throw new Error("Tag must be a positive integer: "+this.tag)}toString(){return`${this.tag}(${JSON.stringify(this.value)})`}encodeCBOR(e){return e._pushTag(this.tag),e.pushAny(this.value)}convert(e){var t,r;if("function"!=typeof(r=null!=e?e[this.tag]:void 0)&&"function"!=typeof(r=Zo["_tag"+this.tag]))return this;try{return r.call(Zo,this.value)}catch(e){return t=e,this.err=t,this}}}var es=Zo;const ts=self.location?self.location.protocol+"//"+self.location.host:"",rs=self.URL;var ns={URLWithLegacySupport:class{constructor(e="",t=ts){this.super=new rs(e,t),this.path=this.pathname+this.search,this.auth=this.username&&this.password?this.username+":"+this.password:null,this.query=this.search&&this.search.startsWith("?")?this.search.slice(1):null}get hash(){return this.super.hash}get host(){return this.super.host}get hostname(){return this.super.hostname}get href(){return this.super.href}get origin(){return this.super.origin}get password(){return this.super.password}get pathname(){return this.super.pathname}get port(){return this.super.port}get protocol(){return this.super.protocol}get search(){return this.super.search}get searchParams(){return this.super.searchParams}get username(){return this.super.username}set hash(e){this.super.hash=e}set host(e){this.super.host=e}set hostname(e){this.super.hostname=e}set href(e){this.super.href=e}set origin(e){this.super.origin=e}set password(e){this.super.password=e}set pathname(e){this.super.pathname=e}set port(e){this.super.port=e}set protocol(e){this.super.protocol=e}set search(e){this.super.search=e}set searchParams(e){this.super.searchParams=e}set username(e){this.super.username=e}createObjectURL(e){return this.super.createObjectURL(e)}revokeObjectURL(e){this.super.revokeObjectURL(e)}toJSON(){return this.super.toJSON()}toString(){return this.super.toString()}format(){return this.toString()}},URLSearchParams:self.URLSearchParams,defaultBase:ts,format:function(e){if("string"==typeof e)return new rs(e).toString();if(!(e instanceof rs)){const t=e.username&&e.password?`${e.username}:${e.password}@`:"",r=e.auth?e.auth+"@":"",n=e.port?":"+e.port:"",i=e.protocol?e.protocol+"//":"",o=e.host||"",s=e.hostname||"",a=e.search||(e.query?"?"+e.query:""),c=e.hash||"",u=e.pathname||"";return`${i}${t||r}${o||s+n}${e.path||u+a}${c}`}}};const{URLWithLegacySupport:is,format:os}=ns,{URLWithLegacySupport:ss,format:as,URLSearchParams:cs,defaultBase:us}=ns;var ls={URL:ss,URLSearchParams:cs,format:as,relative:(e,t={},r={},n)=>{let i,o=t.protocol?t.protocol.replace(":",""):"http";o=(r[o]||n||o)+":";try{i=new is(e)}catch(e){i={}}const s=Object.assign({},t,{protocol:o||i.protocol,host:t.host||i.host});return new is(e,os(s)).toString()},defaultBase:us};const{Buffer:As}=Qo,hs=Ho,fs=Ko.exports.BigNumber,ds=Vo,ps=zo,gs=Yo,ms=es,{URL:ys}=ls;class vs{constructor(e){!(e=e||{}).size||e.size<65536?e.size=65536:e.size=ds.nextPowerOf2(e.size),this._heap=new ArrayBuffer(e.size),this._heap8=new Uint8Array(this._heap),this._buffer=As.from(this._heap),this._reset(),this._knownTags=Object.assign({0:e=>new Date(e),1:e=>new Date(1e3*e),2:e=>ds.arrayBufferToBignumber(e),3:e=>ps.NEG_ONE.minus(ds.arrayBufferToBignumber(e)),4:e=>ps.TEN.pow(e[0]).times(e[1]),5:e=>ps.TWO.pow(e[0]).times(e[1]),32:e=>new ys(e),35:e=>new RegExp(e)},e.tags),this.parser=function(e,t,r){"use asm";var n=new e.Uint8Array(r),i=t.pushInt,o=t.pushInt32,s=t.pushInt32Neg,a=t.pushInt64,c=t.pushInt64Neg,u=t.pushFloat,l=t.pushFloatSingle,A=t.pushFloatDouble,h=t.pushTrue,f=t.pushFalse,d=t.pushUndefined,p=t.pushNull,g=t.pushInfinity,m=t.pushInfinityNeg,y=t.pushNaN,v=t.pushNaNNeg,b=t.pushArrayStart,w=t.pushArrayStartFixed,x=t.pushArrayStartFixed32,_=t.pushArrayStartFixed64,B=t.pushObjectStart,E=t.pushObjectStartFixed,S=t.pushObjectStartFixed32,C=t.pushObjectStartFixed64,I=t.pushByteString,k=t.pushByteStringStart,P=t.pushUtf8String,T=t.pushUtf8StringStart,O=t.pushSimpleUnassigned,L=t.pushTagStart,N=t.pushTagStart4,U=t.pushTagStart8,F=t.pushTagUnassigned,M=t.pushBreak,R=e.Math.pow,D=0,j=0,Q=0;function H(e){e=e|0;D=0;j=e;while((D|0)<(j|0)){Q=Je[n[D]&255](n[D]|0)|0;if((Q|0)>0){break}}return Q|0}function K(e){e=e|0;if(((D|0)+(e|0)|0)<(j|0)){return 0}return 1}function V(e){e=e|0;return n[e|0]<<8|n[e+1|0]|0}function z(e){e=e|0;return n[e|0]<<24|n[e+1|0]<<16|n[e+2|0]<<8|n[e+3|0]|0}function q(e){e=e|0;i(e|0);D=D+1|0;return 0}function G(e){e=e|0;if(K(1)|0){return 1}i(n[D+1|0]|0);D=D+2|0;return 0}function W(e){e=e|0;if(K(2)|0){return 1}i(V(D+1|0)|0);D=D+3|0;return 0}function $(e){e=e|0;if(K(4)|0){return 1}o(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function J(e){e=e|0;if(K(8)|0){return 1}a(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function X(e){e=e|0;i(-1-(e-32|0)|0);D=D+1|0;return 0}function Y(e){e=e|0;if(K(1)|0){return 1}i(-1-(n[D+1|0]|0)|0);D=D+2|0;return 0}function Z(e){e=e|0;var t=0;if(K(2)|0){return 1}t=V(D+1|0)|0;i(-1-(t|0)|0);D=D+3|0;return 0}function ee(e){e=e|0;if(K(4)|0){return 1}s(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function te(e){e=e|0;if(K(8)|0){return 1}c(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function re(e){e=e|0;var t=0;var r=0;var n=0;n=e-64|0;if(K(n|0)|0){return 1}t=D+1|0;r=(D+1|0)+(n|0)|0;I(t|0,r|0);D=r|0;return 0}function ne(e){e=e|0;var t=0;var r=0;var i=0;if(K(1)|0){return 1}i=n[D+1|0]|0;t=D+2|0;r=(D+2|0)+(i|0)|0;if(K(i+1|0)|0){return 1}I(t|0,r|0);D=r|0;return 0}function ie(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=V(D+1|0)|0;t=D+3|0;r=(D+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}I(t|0,r|0);D=r|0;return 0}function oe(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=z(D+1|0)|0;t=D+5|0;r=(D+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}I(t|0,r|0);D=r|0;return 0}function se(e){e=e|0;return 1}function ae(e){e=e|0;k();D=D+1|0;return 0}function ce(e){e=e|0;var t=0;var r=0;var n=0;n=e-96|0;if(K(n|0)|0){return 1}t=D+1|0;r=(D+1|0)+(n|0)|0;P(t|0,r|0);D=r|0;return 0}function ue(e){e=e|0;var t=0;var r=0;var i=0;if(K(1)|0){return 1}i=n[D+1|0]|0;t=D+2|0;r=(D+2|0)+(i|0)|0;if(K(i+1|0)|0){return 1}P(t|0,r|0);D=r|0;return 0}function le(e){e=e|0;var t=0;var r=0;var n=0;if(K(2)|0){return 1}n=V(D+1|0)|0;t=D+3|0;r=(D+3|0)+(n|0)|0;if(K(n+2|0)|0){return 1}P(t|0,r|0);D=r|0;return 0}function Ae(e){e=e|0;var t=0;var r=0;var n=0;if(K(4)|0){return 1}n=z(D+1|0)|0;t=D+5|0;r=(D+5|0)+(n|0)|0;if(K(n+4|0)|0){return 1}P(t|0,r|0);D=r|0;return 0}function he(e){e=e|0;return 1}function fe(e){e=e|0;T();D=D+1|0;return 0}function de(e){e=e|0;w(e-128|0);D=D+1|0;return 0}function pe(e){e=e|0;if(K(1)|0){return 1}w(n[D+1|0]|0);D=D+2|0;return 0}function ge(e){e=e|0;if(K(2)|0){return 1}w(V(D+1|0)|0);D=D+3|0;return 0}function me(e){e=e|0;if(K(4)|0){return 1}x(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function ye(e){e=e|0;if(K(8)|0){return 1}_(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function ve(e){e=e|0;b();D=D+1|0;return 0}function be(e){e=e|0;var t=0;t=e-160|0;if(K(t|0)|0){return 1}E(t|0);D=D+1|0;return 0}function we(e){e=e|0;if(K(1)|0){return 1}E(n[D+1|0]|0);D=D+2|0;return 0}function xe(e){e=e|0;if(K(2)|0){return 1}E(V(D+1|0)|0);D=D+3|0;return 0}function _e(e){e=e|0;if(K(4)|0){return 1}S(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function Be(e){e=e|0;if(K(8)|0){return 1}C(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function Ee(e){e=e|0;B();D=D+1|0;return 0}function Se(e){e=e|0;L(e-192|0|0);D=D+1|0;return 0}function Ce(e){e|0;L(e|0);D=D+1|0;return 0}function Ie(e){e|0;L(e|0);D=D+1|0;return 0}function ke(e){e|0;L(e|0);D=D+1|0;return 0}function Pe(e){e|0;L(e|0);D=D+1|0;return 0}function Te(e){e=e|0;L(e-192|0|0);D=D+1|0;return 0}function Oe(e){e|0;L(e|0);D=D+1|0;return 0}function Le(e){e|0;L(e|0);D=D+1|0;return 0}function Ne(e){e|0;L(e|0);D=D+1|0;return 0}function Ue(e){e=e|0;if(K(1)|0){return 1}L(n[D+1|0]|0);D=D+2|0;return 0}function Fe(e){e=e|0;if(K(2)|0){return 1}L(V(D+1|0)|0);D=D+3|0;return 0}function Me(e){e=e|0;if(K(4)|0){return 1}N(V(D+1|0)|0,V(D+3|0)|0);D=D+5|0;return 0}function Re(e){e=e|0;if(K(8)|0){return 1}U(V(D+1|0)|0,V(D+3|0)|0,V(D+5|0)|0,V(D+7|0)|0);D=D+9|0;return 0}function De(e){e=e|0;O((e|0)-224|0);D=D+1|0;return 0}function je(e){e=e|0;f();D=D+1|0;return 0}function Qe(e){e=e|0;h();D=D+1|0;return 0}function He(e){e=e|0;p();D=D+1|0;return 0}function Ke(e){e=e|0;d();D=D+1|0;return 0}function Ve(e){e=e|0;if(K(1)|0){return 1}O(n[D+1|0]|0);D=D+2|0;return 0}function ze(e){e=e|0;var t=0;var r=0;var i=1.0;var o=0.0;var s=0.0;var a=0.0;if(K(2)|0){return 1}t=n[D+1|0]|0;r=n[D+2|0]|0;if((t|0)&0x80){i=-1.0}o=+(((t|0)&0x7C)>>2);s=+(((t|0)&0x03)<<8|r);if(+o==0.0){u(+(+i*+5.9604644775390625e-8*+s))}else if(+o==31.0){if(+i==1.0){if(+s>0.0){y()}else{g()}}else{if(+s>0.0){v()}else{m()}}}else{u(+(+i*R(+2,+(+o-25.0))*+(1024.0+s)))}D=D+3|0;return 0}function qe(e){e=e|0;if(K(4)|0){return 1}l(n[D+1|0]|0,n[D+2|0]|0,n[D+3|0]|0,n[D+4|0]|0);D=D+5|0;return 0}function Ge(e){e=e|0;if(K(8)|0){return 1}A(n[D+1|0]|0,n[D+2|0]|0,n[D+3|0]|0,n[D+4|0]|0,n[D+5|0]|0,n[D+6|0]|0,n[D+7|0]|0,n[D+8|0]|0);D=D+9|0;return 0}function We(e){e=e|0;return 1}function $e(e){e=e|0;M();D=D+1|0;return 0}var Je=[q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,q,G,W,$,J,We,We,We,We,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,X,Y,Z,ee,te,We,We,We,We,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,re,ne,ie,oe,se,We,We,We,ae,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ce,ue,le,Ae,he,We,We,We,fe,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,de,pe,ge,me,ye,We,We,We,ve,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,be,we,xe,_e,Be,We,We,We,Ee,Se,Se,Se,Se,Se,Se,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Te,Ue,Fe,Me,Re,We,We,We,We,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,De,je,Qe,He,Ke,Ve,ze,qe,Ge,We,We,We,$e];return{parse:H}}(Ri,{log:console.log.bind(console),pushInt:this.pushInt.bind(this),pushInt32:this.pushInt32.bind(this),pushInt32Neg:this.pushInt32Neg.bind(this),pushInt64:this.pushInt64.bind(this),pushInt64Neg:this.pushInt64Neg.bind(this),pushFloat:this.pushFloat.bind(this),pushFloatSingle:this.pushFloatSingle.bind(this),pushFloatDouble:this.pushFloatDouble.bind(this),pushTrue:this.pushTrue.bind(this),pushFalse:this.pushFalse.bind(this),pushUndefined:this.pushUndefined.bind(this),pushNull:this.pushNull.bind(this),pushInfinity:this.pushInfinity.bind(this),pushInfinityNeg:this.pushInfinityNeg.bind(this),pushNaN:this.pushNaN.bind(this),pushNaNNeg:this.pushNaNNeg.bind(this),pushArrayStart:this.pushArrayStart.bind(this),pushArrayStartFixed:this.pushArrayStartFixed.bind(this),pushArrayStartFixed32:this.pushArrayStartFixed32.bind(this),pushArrayStartFixed64:this.pushArrayStartFixed64.bind(this),pushObjectStart:this.pushObjectStart.bind(this),pushObjectStartFixed:this.pushObjectStartFixed.bind(this),pushObjectStartFixed32:this.pushObjectStartFixed32.bind(this),pushObjectStartFixed64:this.pushObjectStartFixed64.bind(this),pushByteString:this.pushByteString.bind(this),pushByteStringStart:this.pushByteStringStart.bind(this),pushUtf8String:this.pushUtf8String.bind(this),pushUtf8StringStart:this.pushUtf8StringStart.bind(this),pushSimpleUnassigned:this.pushSimpleUnassigned.bind(this),pushTagUnassigned:this.pushTagUnassigned.bind(this),pushTagStart:this.pushTagStart.bind(this),pushTagStart4:this.pushTagStart4.bind(this),pushTagStart8:this.pushTagStart8.bind(this),pushBreak:this.pushBreak.bind(this)},this._heap)}get _depth(){return this._parents.length}get _currentParent(){return this._parents[this._depth-1]}get _ref(){return this._currentParent.ref}_closeParent(){var e=this._parents.pop();if(e.length>0)throw new Error(`Missing ${e.length} elements`);switch(e.type){case ps.PARENT.TAG:this._push(this.createTag(e.ref[0],e.ref[1]));break;case ps.PARENT.BYTE_STRING:this._push(this.createByteString(e.ref,e.length));break;case ps.PARENT.UTF8_STRING:this._push(this.createUtf8String(e.ref,e.length));break;case ps.PARENT.MAP:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createMap(e.ref,e.length));break;case ps.PARENT.OBJECT:if(e.values%2>0)throw new Error("Odd number of elements in the map");this._push(this.createObject(e.ref,e.length));break;case ps.PARENT.ARRAY:this._push(this.createArray(e.ref,e.length))}this._currentParent&&this._currentParent.type===ps.PARENT.TAG&&this._dec()}_dec(){const e=this._currentParent;e.length<0||(e.length--,0===e.length&&this._closeParent())}_push(e,t){const r=this._currentParent;switch(r.values++,r.type){case ps.PARENT.ARRAY:case ps.PARENT.BYTE_STRING:case ps.PARENT.UTF8_STRING:r.length>-1?this._ref[this._ref.length-r.length]=e:this._ref.push(e),this._dec();break;case ps.PARENT.OBJECT:null!=r.tmpKey?(this._ref[r.tmpKey]=e,r.tmpKey=null,this._dec()):(r.tmpKey=e,"string"!=typeof r.tmpKey&&(r.type=ps.PARENT.MAP,r.ref=ds.buildMap(r.ref)));break;case ps.PARENT.MAP:null!=r.tmpKey?(this._ref.set(r.tmpKey,e),r.tmpKey=null,this._dec()):r.tmpKey=e;break;case ps.PARENT.TAG:this._ref.push(e),t||this._dec();break;default:throw new Error("Unknown parent type")}}_createParent(e,t,r){this._parents[this._depth]={type:t,length:r,ref:e,values:0,tmpKey:null}}_reset(){this._res=[],this._parents=[{type:ps.PARENT.ARRAY,length:-1,ref:this._res,values:0,tmpKey:null}]}createTag(e,t){const r=this._knownTags[e];return r?r(t):new ms(e,t)}createMap(e,t){return e}createObject(e,t){return e}createArray(e,t){return e}createByteString(e,t){return As.concat(e)}createByteStringFromHeap(e,t){return e===t?As.alloc(0):As.from(this._heap.slice(e,t))}createInt(e){return e}createInt32(e,t){return ds.buildInt32(e,t)}createInt64(e,t,r,n){return ds.buildInt64(e,t,r,n)}createFloat(e){return e}createFloatSingle(e,t,r,n){return hs.read([e,t,r,n],0,!1,23,4)}createFloatDouble(e,t,r,n,i,o,s,a){return hs.read([e,t,r,n,i,o,s,a],0,!1,52,8)}createInt32Neg(e,t){return-1-ds.buildInt32(e,t)}createInt64Neg(e,t,r,n){const i=ds.buildInt32(e,t),o=ds.buildInt32(r,n);return i>ps.MAX_SAFE_HIGH?ps.NEG_ONE.minus(new fs(i).times(ps.SHIFT32).plus(o)):-1-(i*ps.SHIFT32+o)}createTrue(){return!0}createFalse(){return!1}createNull(){return null}createUndefined(){}createInfinity(){return 1/0}createInfinityNeg(){return-1/0}createNaN(){return NaN}createNaNNeg(){return NaN}createUtf8String(e,t){return e.join("")}createUtf8StringFromHeap(e,t){return e===t?"":this._buffer.toString("utf8",e,t)}createSimpleUnassigned(e){return new gs(e)}pushInt(e){this._push(this.createInt(e))}pushInt32(e,t){this._push(this.createInt32(e,t))}pushInt64(e,t,r,n){this._push(this.createInt64(e,t,r,n))}pushFloat(e){this._push(this.createFloat(e))}pushFloatSingle(e,t,r,n){this._push(this.createFloatSingle(e,t,r,n))}pushFloatDouble(e,t,r,n,i,o,s,a){this._push(this.createFloatDouble(e,t,r,n,i,o,s,a))}pushInt32Neg(e,t){this._push(this.createInt32Neg(e,t))}pushInt64Neg(e,t,r,n){this._push(this.createInt64Neg(e,t,r,n))}pushTrue(){this._push(this.createTrue())}pushFalse(){this._push(this.createFalse())}pushNull(){this._push(this.createNull())}pushUndefined(){this._push(this.createUndefined())}pushInfinity(){this._push(this.createInfinity())}pushInfinityNeg(){this._push(this.createInfinityNeg())}pushNaN(){this._push(this.createNaN())}pushNaNNeg(){this._push(this.createNaNNeg())}pushArrayStart(){this._createParent([],ps.PARENT.ARRAY,-1)}pushArrayStartFixed(e){this._createArrayStartFixed(e)}pushArrayStartFixed32(e,t){const r=ds.buildInt32(e,t);this._createArrayStartFixed(r)}pushArrayStartFixed64(e,t,r,n){const i=ds.buildInt64(e,t,r,n);this._createArrayStartFixed(i)}pushObjectStart(){this._createObjectStartFixed(-1)}pushObjectStartFixed(e){this._createObjectStartFixed(e)}pushObjectStartFixed32(e,t){const r=ds.buildInt32(e,t);this._createObjectStartFixed(r)}pushObjectStartFixed64(e,t,r,n){const i=ds.buildInt64(e,t,r,n);this._createObjectStartFixed(i)}pushByteStringStart(){this._parents[this._depth]={type:ps.PARENT.BYTE_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushByteString(e,t){this._push(this.createByteStringFromHeap(e,t))}pushUtf8StringStart(){this._parents[this._depth]={type:ps.PARENT.UTF8_STRING,length:-1,ref:[],values:0,tmpKey:null}}pushUtf8String(e,t){this._push(this.createUtf8StringFromHeap(e,t))}pushSimpleUnassigned(e){this._push(this.createSimpleUnassigned(e))}pushTagStart(e){this._parents[this._depth]={type:ps.PARENT.TAG,length:1,ref:[e]}}pushTagStart4(e,t){this.pushTagStart(ds.buildInt32(e,t))}pushTagStart8(e,t,r,n){this.pushTagStart(ds.buildInt64(e,t,r,n))}pushTagUnassigned(e){this._push(this.createTag(e))}pushBreak(){if(this._currentParent.length>-1)throw new Error("Unexpected break");this._closeParent()}_createObjectStartFixed(e){0!==e?this._createParent({},ps.PARENT.OBJECT,e):this._push(this.createObject({}))}_createArrayStartFixed(e){0!==e?this._createParent(new Array(e),ps.PARENT.ARRAY,e):this._push(this.createArray([]))}_decode(e){if(0===e.byteLength)throw new Error("Input too short");this._reset(),this._heap8.set(e);const t=this.parser.parse(e.byteLength);if(this._depth>1){for(;0===this._currentParent.length;)this._closeParent();if(this._depth>1)throw new Error("Undeterminated nesting")}if(t>0)throw new Error("Failed to parse");if(0===this._res.length)throw new Error("No valid result")}decodeFirst(e){return this._decode(e),this._res[0]}decodeAll(e){return this._decode(e),this._res}static decode(e,t){return"string"==typeof e&&(e=As.from(e,t||"hex")),new vs({size:e.length}).decodeFirst(e)}static decodeAll(e,t){return"string"==typeof e&&(e=As.from(e,t||"hex")),new vs({size:e.length}).decodeAll(e)}}vs.decodeFirst=vs.decode;var bs=vs;const{Buffer:ws}=Qo,xs=bs,_s=Vo;class Bs extends xs{createTag(e,t){return`${e}(${t})`}createInt(e){return super.createInt(e).toString()}createInt32(e,t){return super.createInt32(e,t).toString()}createInt64(e,t,r,n){return super.createInt64(e,t,r,n).toString()}createInt32Neg(e,t){return super.createInt32Neg(e,t).toString()}createInt64Neg(e,t,r,n){return super.createInt64Neg(e,t,r,n).toString()}createTrue(){return"true"}createFalse(){return"false"}createFloat(e){const t=super.createFloat(e);return _s.isNegativeZero(e)?"-0_1":`${t}_1`}createFloatSingle(e,t,r,n){return`${super.createFloatSingle(e,t,r,n)}_2`}createFloatDouble(e,t,r,n,i,o,s,a){return`${super.createFloatDouble(e,t,r,n,i,o,s,a)}_3`}createByteString(e,t){const r=e.join(", ");return-1===t?`(_ ${r})`:`h'${r}`}createByteStringFromHeap(e,t){return`h'${ws.from(super.createByteStringFromHeap(e,t)).toString("hex")}'`}createInfinity(){return"Infinity_1"}createInfinityNeg(){return"-Infinity_1"}createNaN(){return"NaN_1"}createNaNNeg(){return"-NaN_1"}createNull(){return"null"}createUndefined(){return"undefined"}createSimpleUnassigned(e){return`simple(${e})`}createArray(e,t){const r=super.createArray(e,t);return-1===t?`[_ ${r.join(", ")}]`:`[${r.join(", ")}]`}createMap(e,t){const r=super.createMap(e),n=Array.from(r.keys()).reduce(Ss(r),"");return-1===t?`{_ ${n}}`:`{${n}}`}createObject(e,t){const r=super.createObject(e),n=Object.keys(r).reduce(Ss(r),"");return-1===t?`{_ ${n}}`:`{${n}}`}createUtf8String(e,t){const r=e.join(", ");return-1===t?`(_ ${r})`:`"${r}"`}createUtf8StringFromHeap(e,t){return`"${ws.from(super.createUtf8StringFromHeap(e,t)).toString("utf8")}"`}static diagnose(e,t){return"string"==typeof e&&(e=ws.from(e,t||"hex")),(new Bs).decodeFirst(e)}}var Es=Bs;function Ss(e){return(t,r)=>t?`${t}, ${r}: ${e[r]}`:`${r}: ${e[r]}`}const{Buffer:Cs}=Qo,{URL:Is}=ls,ks=Ko.exports.BigNumber,Ps=Vo,Ts=zo,Os=Ts.MT,Ls=Ts.NUMBYTES,Ns=Ts.SHIFT32,Us=Ts.SYMS,Fs=Ts.TAG,Ms=Ts.MT.SIMPLE_FLOAT<<5|Ts.NUMBYTES.TWO,Rs=Ts.MT.SIMPLE_FLOAT<<5|Ts.NUMBYTES.FOUR,Ds=Ts.MT.SIMPLE_FLOAT<<5|Ts.NUMBYTES.EIGHT,js=Ts.MT.SIMPLE_FLOAT<<5|Ts.SIMPLE.TRUE,Qs=Ts.MT.SIMPLE_FLOAT<<5|Ts.SIMPLE.FALSE,Hs=Ts.MT.SIMPLE_FLOAT<<5|Ts.SIMPLE.UNDEFINED,Ks=Ts.MT.SIMPLE_FLOAT<<5|Ts.SIMPLE.NULL,Vs=new ks("0x20000000000000"),zs=Cs.from("f97e00","hex"),qs=Cs.from("f9fc00","hex"),Gs=Cs.from("f97c00","hex");class Ws{constructor(e){e=e||{},this.streaming="function"==typeof e.stream,this.onData=e.stream,this.semanticTypes=[[Is,this._pushUrl],[ks,this._pushBigNumber]];const t=e.genTypes||[],r=t.length;for(let e=0;e<r;e++)this.addSemanticType(t[e][0],t[e][1]);this._reset()}addSemanticType(e,t){const r=this.semanticTypes.length;for(let n=0;n<r;n++)if(this.semanticTypes[n][0]===e){const e=this.semanticTypes[n][1];return this.semanticTypes[n][1]=t,e}return this.semanticTypes.push([e,t]),null}push(e){return!e||(this.result[this.offset]=e,this.resultMethod[this.offset]=0,this.resultLength[this.offset]=e.length,this.offset++,this.streaming&&this.onData(this.finalize()),!0)}pushWrite(e,t,r){return this.result[this.offset]=e,this.resultMethod[this.offset]=t,this.resultLength[this.offset]=r,this.offset++,this.streaming&&this.onData(this.finalize()),!0}_pushUInt8(e){return this.pushWrite(e,1,1)}_pushUInt16BE(e){return this.pushWrite(e,2,2)}_pushUInt32BE(e){return this.pushWrite(e,3,4)}_pushDoubleBE(e){return this.pushWrite(e,4,8)}_pushNaN(){return this.push(zs)}_pushInfinity(e){const t=e<0?qs:Gs;return this.push(t)}_pushFloat(e){const t=Cs.allocUnsafe(2);if(Ps.writeHalf(t,e)&&Ps.parseHalf(t)===e)return this._pushUInt8(Ms)&&this.push(t);const r=Cs.allocUnsafe(4);return r.writeFloatBE(e,0),r.readFloatBE(0)===e?this._pushUInt8(Rs)&&this.push(r):this._pushUInt8(Ds)&&this._pushDoubleBE(e)}_pushInt(e,t,r){const n=t<<5;return e<24?this._pushUInt8(n|e):e<=255?this._pushUInt8(n|Ls.ONE)&&this._pushUInt8(e):e<=65535?this._pushUInt8(n|Ls.TWO)&&this._pushUInt16BE(e):e<=4294967295?this._pushUInt8(n|Ls.FOUR)&&this._pushUInt32BE(e):e<=Number.MAX_SAFE_INTEGER?this._pushUInt8(n|Ls.EIGHT)&&this._pushUInt32BE(Math.floor(e/Ns))&&this._pushUInt32BE(e%Ns):t===Os.NEG_INT?this._pushFloat(r):this._pushFloat(e)}_pushIntNum(e){return e<0?this._pushInt(-e-1,Os.NEG_INT,e):this._pushInt(e,Os.POS_INT)}_pushNumber(e){switch(!1){case e==e:return this._pushNaN(e);case isFinite(e):return this._pushInfinity(e);case e%1!=0:return this._pushIntNum(e);default:return this._pushFloat(e)}}_pushString(e){const t=Cs.byteLength(e,"utf8");return this._pushInt(t,Os.UTF8_STRING)&&this.pushWrite(e,5,t)}_pushBoolean(e){return this._pushUInt8(e?js:Qs)}_pushUndefined(e){return this._pushUInt8(Hs)}_pushArray(e,t){const r=t.length;if(!e._pushInt(r,Os.ARRAY))return!1;for(let n=0;n<r;n++)if(!e.pushAny(t[n]))return!1;return!0}_pushTag(e){return this._pushInt(e,Os.TAG)}_pushDate(e,t){return e._pushTag(Fs.DATE_EPOCH)&&e.pushAny(Math.round(t/1e3))}_pushBuffer(e,t){return e._pushInt(t.length,Os.BYTE_STRING)&&e.push(t)}_pushNoFilter(e,t){return e._pushBuffer(e,t.slice())}_pushRegexp(e,t){return e._pushTag(Fs.REGEXP)&&e.pushAny(t.source)}_pushSet(e,t){if(!e._pushInt(t.size,Os.ARRAY))return!1;for(const r of t)if(!e.pushAny(r))return!1;return!0}_pushUrl(e,t){return e._pushTag(Fs.URI)&&e.pushAny(t.format())}_pushBigint(e){let t=Fs.POS_BIGINT;e.isNegative()&&(e=e.negated().minus(1),t=Fs.NEG_BIGINT);let r=e.toString(16);r.length%2&&(r="0"+r);const n=Cs.from(r,"hex");return this._pushTag(t)&&this._pushBuffer(this,n)}_pushBigNumber(e,t){if(t.isNaN())return e._pushNaN();if(!t.isFinite())return e._pushInfinity(t.isNegative()?-1/0:1/0);if(t.isInteger())return e._pushBigint(t);if(!e._pushTag(Fs.DECIMAL_FRAC)||!e._pushInt(2,Os.ARRAY))return!1;const r=t.decimalPlaces(),n=t.multipliedBy(new ks(10).pow(r));return!!e._pushIntNum(-r)&&(n.abs().isLessThan(Vs)?e._pushIntNum(n.toNumber()):e._pushBigint(n))}_pushMap(e,t){return!!e._pushInt(t.size,Os.MAP)&&this._pushRawMap(t.size,Array.from(t))}_pushObject(e){if(!e)return this._pushUInt8(Ks);for(var t=this.semanticTypes.length,r=0;r<t;r++)if(e instanceof this.semanticTypes[r][0])return this.semanticTypes[r][1].call(e,this,e);var n=e.encodeCBOR;if("function"==typeof n)return n.call(e,this);var i=Object.keys(e),o=i.length;return!!this._pushInt(o,Os.MAP)&&this._pushRawMap(o,i.map((t=>[t,e[t]])))}_pushRawMap(e,t){t=t.map((function(e){return e[0]=Ws.encode(e[0]),e})).sort(Ps.keySorter);for(var r=0;r<e;r++){if(!this.push(t[r][0]))return!1;if(!this.pushAny(t[r][1]))return!1}return!0}write(e){return this.pushAny(e)}pushAny(e){var t=function(e){return{}.toString.call(e).slice(8,-1)}(e);switch(t){case"Number":return this._pushNumber(e);case"String":return this._pushString(e);case"Boolean":return this._pushBoolean(e);case"Object":return this._pushObject(e);case"Array":return this._pushArray(this,e);case"Uint8Array":return this._pushBuffer(this,Cs.isBuffer(e)?e:Cs.from(e));case"Null":return this._pushUInt8(Ks);case"Undefined":return this._pushUndefined(e);case"Map":return this._pushMap(this,e);case"Set":return this._pushSet(this,e);case"URL":return this._pushUrl(this,e);case"BigNumber":return this._pushBigNumber(this,e);case"Date":return this._pushDate(this,e);case"RegExp":return this._pushRegexp(this,e);case"Symbol":switch(e){case Us.NULL:return this._pushObject(null);case Us.UNDEFINED:return this._pushUndefined(void 0);default:throw new Error("Unknown symbol: "+e.toString())}default:throw new Error("Unknown type: "+typeof e+", "+(e?e.toString():""))}}finalize(){if(0===this.offset)return null;for(var e=this.result,t=this.resultLength,r=this.resultMethod,n=this.offset,i=0,o=0;o<n;o++)i+=t[o];var s=Cs.allocUnsafe(i),a=0,c=0;for(o=0;o<n;o++){switch(c=t[o],r[o]){case 0:e[o].copy(s,a);break;case 1:s.writeUInt8(e[o],a,!0);break;case 2:s.writeUInt16BE(e[o],a,!0);break;case 3:s.writeUInt32BE(e[o],a,!0);break;case 4:s.writeDoubleBE(e[o],a,!0);break;case 5:s.write(e[o],a,c,"utf8");break;default:throw new Error("unkown method")}a+=c}var u=s;return this._reset(),u}_reset(){this.result=[],this.resultMethod=[],this.resultLength=[],this.offset=0}static encode(e){const t=new Ws;if(!t.pushAny(e))throw new Error("Failed to encode input");return t.finalize()}}var $s=Ws;function Js(e){if("string"==typeof e)return(new TextEncoder).encode(e);if(!(e instanceof Uint8Array))throw new TypeError('"data" be a string or Uint8Array.');return e}
|
|
521
521
|
/*!
|
package/package.json
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
automated_update_bv_in_repo () {
|
|
4
|
+
# Parameters in order: $GITHUB_ORG, $GITHUB_REPO, $WORK_BRANCH, $GITHUB_USER
|
|
5
|
+
GITHUB_ORG=$1
|
|
6
|
+
GITHUB_REPO=$2
|
|
7
|
+
WORK_BRANCH=$3
|
|
8
|
+
GITHUB_USER=$4
|
|
9
|
+
|
|
10
|
+
# Local Parameters
|
|
11
|
+
GITHUB_COM=github.com
|
|
12
|
+
GITHUB_REPO_PATH=$GITHUB_COM/$GITHUB_ORG/$GITHUB_REPO
|
|
13
|
+
|
|
14
|
+
# clone repo
|
|
15
|
+
git clone https://"$GITHUB_REPO_PATH".git
|
|
16
|
+
cd "$GITHUB_REPO" || exit
|
|
17
|
+
|
|
18
|
+
# rename remote to add authentication
|
|
19
|
+
git remote rm origin
|
|
20
|
+
git remote add origin https://"$GITHUB_USER":"$BOTCERTS_PR_GITHUB_TOKEN"@"$GITHUB_REPO_PATH".git
|
|
21
|
+
|
|
22
|
+
# run script from client repo
|
|
23
|
+
. scripts/update_blockcerts_verifier.sh
|
|
24
|
+
|
|
25
|
+
curl --data '{"head":"'"${WORK_BRANCH}"'", "base":"master", "title": "bump Blockcerts Verifier version", "body": "Please review and merge @lemoustachiste @raiseandfall"}' -H "Authorization: token ${BOTCERTS_PR_GITHUB_TOKEN}" https://api.github.com/repos/"$GITHUB_ORG"/"$GITHUB_REPO"/pulls -v
|
|
26
|
+
|
|
27
|
+
# clean after use
|
|
28
|
+
cd ..
|
|
29
|
+
echo 'Delete working directory'
|
|
30
|
+
rm -rf "$GITHUB_REPO"
|
|
31
|
+
}
|
|
@@ -1,34 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
GITHUB_COM=github.com
|
|
5
|
-
BLOCKCERTS_GITHUB_REPO=blockchain-certificates-web/blockchain-certificates-web.github.io
|
|
6
|
-
GIT_REPO=$GITHUB_COM/$BLOCKCERTS_GITHUB_REPO.git
|
|
7
|
-
WORK_BRANCH=feat/update-bv
|
|
8
|
-
GITHUB_USER=botcerts
|
|
3
|
+
source ./automated-update-blockcerts-verifier-in-other-repo.sh
|
|
9
4
|
|
|
10
|
-
|
|
11
|
-
git clone https://$GIT_REPO
|
|
12
|
-
cd blockchain-certificates-web.github.io
|
|
13
|
-
|
|
14
|
-
# rename remote to add authentication
|
|
15
|
-
git remote rm origin
|
|
16
|
-
git remote add origin https://$GITHUB_USER:$BOTCERTS_PR_GITHUB_TOKEN@$GIT_REPO
|
|
17
|
-
|
|
18
|
-
# run script from client repo
|
|
19
|
-
. scripts/update_blockcerts_verifier.sh
|
|
20
|
-
|
|
21
|
-
# open PR
|
|
22
|
-
#{
|
|
23
|
-
# "title": "Amazing new feature",
|
|
24
|
-
# "body": "Please pull this in!",
|
|
25
|
-
# "head": "octocat:new-feature",
|
|
26
|
-
# "base": "master"
|
|
27
|
-
#}
|
|
28
|
-
|
|
29
|
-
curl --data '{"head":"'${WORK_BRANCH}'", "base":"master", "title": "bump Blockcerts Verifier version", "body": "Please review and merge @lemoustachiste @raiseandfall"}' -H "Authorization: token ${BOTCERTS_PR_GITHUB_TOKEN}" https://api.github.com/repos/$BLOCKCERTS_GITHUB_REPO/pulls -v
|
|
30
|
-
|
|
31
|
-
# clean after use
|
|
32
|
-
cd ..
|
|
33
|
-
echo 'Delete working directory'
|
|
34
|
-
rm -rf blockchain-certificates.github.io
|
|
5
|
+
automated_update_bv_in_repo "blockchain-certificates-web" "blockchain-certificates-web.github.io" "feat/update-bv" "botcerts"
|