jiezhangxin-utils 0.3.11 → 0.3.13

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.
@@ -1,29 +1,29 @@
1
- "use strict";var t=require("ui-element-plus"),e=require("vue");const r={TOKEN:"token",USER_INFO:"userInfo",COMPANYCODE:"companyCode",COMPANYNAME:"companyName"};function n(){return localStorage.getItem(r.TOKEN)}var i,s,o,a,u,c,h,l,f,p="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},g={userAgent:!1},d={},v=v||function(t){var e={},r=e.lib={},n=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var r=new t;return e&&r.mixIn(e),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=n.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||o).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var s=0;s<i;s++){var o=r[s>>>2]>>>24-s%4*8&255;e[n+s>>>2]|=o<<24-(n+s)%4*8}else for(s=0;s<i;s+=4)e[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=n.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r=[],n=0;n<e;n+=4)r.push(4294967296*t.random()|0);return new i.init(r,e)}}),s=e.enc={},o=s.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new i.init(r,e/2)}},a=s.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new i.init(r,e)}},u=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(a.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return a.parse(unescape(encodeURIComponent(t)))}},c=r.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,s=r.sigBytes,o=this.blockSize,a=s/(4*o),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*o,c=t.min(4*u,s);if(u){for(var h=0;h<u;h+=o)this._doProcessBlock(n,h);var l=n.splice(0,u);r.sigBytes-=c}return new i.init(l,c)},clone:function(){var t=n.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});r.Hasher=c.extend({cfg:n.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new h.HMAC.init(t,r).finalize(e)}}});var h=e.algo={};return e}(Math);s=(i=v).lib,o=s.Base,a=s.WordArray,(i=i.x64={}).Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),i.WordArray=o.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,r=[],n=0;n<e;n++){var i=t[n];r.push(i.high),r.push(i.low)}return a.create(r,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),r=e.length,n=0;n<r;n++)e[n]=e[n].clone();return t}}),v.lib.Cipher||function(){var t=(f=v).lib,e=t.Base,r=t.WordArray,n=t.BufferedBlockAlgorithm,i=f.enc.Base64,s=f.algo.EvpKDF,o=t.Cipher=n.extend({cfg:e.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){n.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(t){return{encrypt:function(e,r,n){return("string"==typeof r?p:l).encrypt(t,e,r,n)},decrypt:function(e,r,n){return("string"==typeof r?p:l).decrypt(t,e,r,n)}}}});t.StreamCipher=o.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var a=f.mode={},u=function(t,e,r){var n=this._iv;n?this._iv=undefined:n=this._prevBlock;for(var i=0;i<r;i++)t[e+i]^=n[i]},c=(t.BlockCipherMode=e.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}})).extend();c.Encryptor=c.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize;u.call(this,t,e,n),r.encryptBlock(t,e),this._prevBlock=t.slice(e,e+n)}}),c.Decryptor=c.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=t.slice(e,e+n);r.decryptBlock(t,e),u.call(this,t,e,n),this._prevBlock=i}}),a=a.CBC=c,c=(f.pad={}).Pkcs7={pad:function(t,e){for(var n,i=(n=(n=4*e)-t.sigBytes%n)<<24|n<<16|n<<8|n,s=[],o=0;o<n;o+=4)s.push(i);n=r.create(s,n),t.concat(n)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}},t.BlockCipher=o.extend({cfg:o.cfg.extend({mode:a,padding:c}),reset:function(){o.reset.call(this);var t=(e=this.cfg).iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=e.createEncryptor;else r=e.createDecryptor,this._minBufferSize=1;this._mode=r.call(e,this,t&&t.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var h=t.CipherParams=e.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),l=(a=(f.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext;return((t=t.salt)?r.create([1398893684,1701076831]).concat(t).concat(e):e).toString(i)},parse:function(t){var e=(t=i.parse(t)).words;if(1398893684==e[0]&&1701076831==e[1]){var n=r.create(e.slice(2,4));e.splice(0,4),t.sigBytes-=16}return h.create({ciphertext:t,salt:n})}},t.SerializableCipher=e.extend({cfg:e.extend({format:a}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n);return e=i.finalize(e),i=i.cfg,h.create({ciphertext:e,key:r,iv:i.iv,algorithm:t,mode:i.mode,padding:i.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}})),f=(f.kdf={}).OpenSSL={execute:function(t,e,n,i){return i||(i=r.random(8)),t=s.create({keySize:e+n}).compute(t,i),n=r.create(t.words.slice(e),4*n),t.sigBytes=4*e,h.create({key:t,iv:n,salt:i})}},p=t.PasswordBasedCipher=l.extend({cfg:l.cfg.extend({kdf:f}),encrypt:function(t,e,r,n){return r=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize),n.iv=r.iv,(t=l.encrypt.call(this,t,e,r.key,n)).mixIn(r),t},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),r=n.kdf.execute(r,t.keySize,t.ivSize,e.salt),n.iv=r.iv,l.decrypt.call(this,t,e,r.key,n)}})}(),function(){for(var t=v,e=t.lib.BlockCipher,r=t.algo,n=[],i=[],s=[],o=[],a=[],u=[],c=[],h=[],l=[],f=[],p=[],g=0;256>g;g++)p[g]=128>g?g<<1:g<<1^283;var d=0,m=0;for(g=0;256>g;g++){var y=(y=m^m<<1^m<<2^m<<3^m<<4)>>>8^255&y^99;n[d]=y,i[y]=d;var x=p[d],w=p[x],S=p[w],E=257*p[y]^16843008*y;s[d]=E<<24|E>>>8,o[d]=E<<16|E>>>16,a[d]=E<<8|E>>>24,u[d]=E,E=16843009*S^65537*w^257*x^16843008*d,c[y]=E<<24|E>>>8,h[y]=E<<16|E>>>16,l[y]=E<<8|E>>>24,f[y]=E,d?(d=x^p[p[p[S^x]]],m^=p[p[m]]):d=m=1}var b=[0,1,2,4,8,16,32,64,128,27,54];r=r.AES=e.extend({_doReset:function(){for(var t=(r=this._key).words,e=r.sigBytes/4,r=4*((this._nRounds=e+6)+1),i=this._keySchedule=[],s=0;s<r;s++)if(s<e)i[s]=t[s];else{var o=i[s-1];s%e?6<e&&4==s%e&&(o=n[o>>>24]<<24|n[o>>>16&255]<<16|n[o>>>8&255]<<8|n[255&o]):(o=n[(o=o<<8|o>>>24)>>>24]<<24|n[o>>>16&255]<<16|n[o>>>8&255]<<8|n[255&o],o^=b[s/e|0]<<24),i[s]=i[s-e]^o}for(t=this._invKeySchedule=[],e=0;e<r;e++)s=r-e,o=e%4?i[s]:i[s-4],t[e]=4>e||4>=s?o:c[n[o>>>24]]^h[n[o>>>16&255]]^l[n[o>>>8&255]]^f[n[255&o]]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,o,a,u,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,c,h,l,f,i),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,n,i,s,o,a){for(var u=this._nRounds,c=t[e]^r[0],h=t[e+1]^r[1],l=t[e+2]^r[2],f=t[e+3]^r[3],p=4,g=1;g<u;g++){var d=n[c>>>24]^i[h>>>16&255]^s[l>>>8&255]^o[255&f]^r[p++],v=n[h>>>24]^i[l>>>16&255]^s[f>>>8&255]^o[255&c]^r[p++],m=n[l>>>24]^i[f>>>16&255]^s[c>>>8&255]^o[255&h]^r[p++];f=n[f>>>24]^i[c>>>16&255]^s[h>>>8&255]^o[255&l]^r[p++],c=d,h=v,l=m}d=(a[c>>>24]<<24|a[h>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^r[p++],v=(a[h>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&c])^r[p++],m=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[c>>>8&255]<<8|a[255&h])^r[p++],f=(a[f>>>24]<<24|a[c>>>16&255]<<16|a[h>>>8&255]<<8|a[255&l])^r[p++],t[e]=d,t[e+1]=v,t[e+2]=m,t[e+3]=f},keySize:8});t.AES=e._createHelper(r)}(),function(){function t(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function e(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}var r=v,n=(i=r.lib).WordArray,i=i.BlockCipher,s=r.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=s.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;56>r;r++){var n=o[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(t=this._subKeys=[],n=0;16>n;n++){var i=t[n]=[],s=u[n];for(r=0;24>r;r++)i[r/6|0]|=e[(a[r]-1+s)%28]<<31-r%6,i[4+(r/6|0)]|=e[28+(a[r+24]-1+s)%28]<<31-r%6;for(i[0]=i[0]<<1|i[0]>>>31,r=1;7>r;r++)i[r]>>>=4*(r-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(e=this._invSubKeys=[],r=0;16>r;r++)e[r]=t[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(r,n,i){this._lBlock=r[n],this._rBlock=r[n+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var s=0;16>s;s++){for(var o=i[s],a=this._lBlock,u=this._rBlock,l=0,f=0;8>f;f++)l|=c[f][((u^o[f])&h[f])>>>0];this._lBlock=u,this._rBlock=a^l}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,t.call(this,1,1431655765),e.call(this,8,16711935),e.call(this,2,858993459),t.call(this,16,65535),t.call(this,4,252645135),r[n]=this._lBlock,r[n+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(l),s=s.TripleDES=i.extend({_doReset:function(){var t=this._key.words;this._des1=l.createEncryptor(n.create(t.slice(0,2))),this._des2=l.createEncryptor(n.create(t.slice(2,4))),this._des3=l.createEncryptor(n.create(t.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(s)}(),function(){var t=v,e=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp(),t=[];for(var i=0;i<r;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,o=0;4>o&&i+.75*o<r;o++)t.push(n.charAt(s>>>6*(3-o)&63));if(e=n.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var r=t.length,n=this._map;(i=n.charAt(64))&&(-1!=(i=t.indexOf(i))&&(r=i));for(var i=[],s=0,o=0;o<r;o++)if(o%4){var a=n.indexOf(t.charAt(o-1))<<o%4*2,u=n.indexOf(t.charAt(o))>>>6-o%4*2;i[s>>>2]|=(a|u)<<24-s%4*8,s++}return e.create(i,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){function e(t,e,r,n,i,s,o){return((t=t+(e&r|~e&n)+i+o)<<s|t>>>32-s)+e}function r(t,e,r,n,i,s,o){return((t=t+(e&n|r&~n)+i+o)<<s|t>>>32-s)+e}function n(t,e,r,n,i,s,o){return((t=t+(e^r^n)+i+o)<<s|t>>>32-s)+e}function i(t,e,r,n,i,s,o){return((t=t+(r^(e|~n))+i+o)<<s|t>>>32-s)+e}for(var s=v,o=(u=s.lib).WordArray,a=u.Hasher,u=s.algo,c=[],h=0;64>h;h++)c[h]=4294967296*t.abs(t.sin(h+1))|0;u=u.MD5=a.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,s){for(var o=0;16>o;o++){var a=t[u=s+o];t[u]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}o=this._hash.words;var u=t[s+0],h=(a=t[s+1],t[s+2]),l=t[s+3],f=t[s+4],p=t[s+5],g=t[s+6],d=t[s+7],v=t[s+8],m=t[s+9],y=t[s+10],x=t[s+11],w=t[s+12],S=t[s+13],E=t[s+14],b=t[s+15],F=e(F=o[0],D=o[1],C=o[2],A=o[3],u,7,c[0]),A=e(A,F,D,C,a,12,c[1]),C=e(C,A,F,D,h,17,c[2]),D=e(D,C,A,F,l,22,c[3]);F=e(F,D,C,A,f,7,c[4]),A=e(A,F,D,C,p,12,c[5]),C=e(C,A,F,D,g,17,c[6]),D=e(D,C,A,F,d,22,c[7]),F=e(F,D,C,A,v,7,c[8]),A=e(A,F,D,C,m,12,c[9]),C=e(C,A,F,D,y,17,c[10]),D=e(D,C,A,F,x,22,c[11]),F=e(F,D,C,A,w,7,c[12]),A=e(A,F,D,C,S,12,c[13]),C=e(C,A,F,D,E,17,c[14]),F=r(F,D=e(D,C,A,F,b,22,c[15]),C,A,a,5,c[16]),A=r(A,F,D,C,g,9,c[17]),C=r(C,A,F,D,x,14,c[18]),D=r(D,C,A,F,u,20,c[19]),F=r(F,D,C,A,p,5,c[20]),A=r(A,F,D,C,y,9,c[21]),C=r(C,A,F,D,b,14,c[22]),D=r(D,C,A,F,f,20,c[23]),F=r(F,D,C,A,m,5,c[24]),A=r(A,F,D,C,E,9,c[25]),C=r(C,A,F,D,l,14,c[26]),D=r(D,C,A,F,v,20,c[27]),F=r(F,D,C,A,S,5,c[28]),A=r(A,F,D,C,h,9,c[29]),C=r(C,A,F,D,d,14,c[30]),F=n(F,D=r(D,C,A,F,w,20,c[31]),C,A,p,4,c[32]),A=n(A,F,D,C,v,11,c[33]),C=n(C,A,F,D,x,16,c[34]),D=n(D,C,A,F,E,23,c[35]),F=n(F,D,C,A,a,4,c[36]),A=n(A,F,D,C,f,11,c[37]),C=n(C,A,F,D,d,16,c[38]),D=n(D,C,A,F,y,23,c[39]),F=n(F,D,C,A,S,4,c[40]),A=n(A,F,D,C,u,11,c[41]),C=n(C,A,F,D,l,16,c[42]),D=n(D,C,A,F,g,23,c[43]),F=n(F,D,C,A,m,4,c[44]),A=n(A,F,D,C,w,11,c[45]),C=n(C,A,F,D,b,16,c[46]),F=i(F,D=n(D,C,A,F,h,23,c[47]),C,A,u,6,c[48]),A=i(A,F,D,C,d,10,c[49]),C=i(C,A,F,D,E,15,c[50]),D=i(D,C,A,F,p,21,c[51]),F=i(F,D,C,A,w,6,c[52]),A=i(A,F,D,C,l,10,c[53]),C=i(C,A,F,D,y,15,c[54]),D=i(D,C,A,F,a,21,c[55]),F=i(F,D,C,A,v,6,c[56]),A=i(A,F,D,C,b,10,c[57]),C=i(C,A,F,D,g,15,c[58]),D=i(D,C,A,F,S,21,c[59]),F=i(F,D,C,A,f,6,c[60]),A=i(A,F,D,C,x,10,c[61]),C=i(C,A,F,D,h,15,c[62]),D=i(D,C,A,F,m,21,c[63]);o[0]=o[0]+F|0,o[1]=o[1]+D|0,o[2]=o[2]+C|0,o[3]=o[3]+A|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var s=t.floor(n/4294967296);for(r[15+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(r.length+1),this._process(),r=(e=this._hash).words,n=0;4>n;n++)i=r[n],r[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return e},clone:function(){var t=a.clone.call(this);return t._hash=this._hash.clone(),t}}),s.MD5=a._createHelper(u),s.HmacMD5=a._createHmacHelper(u)}(Math),c=(f=(u=v).lib).WordArray,h=f.Hasher,l=[],f=u.algo.SHA1=h.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],o=r[3],a=r[4],u=0;80>u;u++){if(16>u)l[u]=0|t[e+u];else{var c=l[u-3]^l[u-8]^l[u-14]^l[u-16];l[u]=c<<1|c>>>31}c=(n<<5|n>>>27)+a+l[u],c=20>u?c+(1518500249+(i&s|~i&o)):40>u?c+(1859775393+(i^s^o)):60>u?c+((i&s|i&o|s&o)-1894007588):c+((i^s^o)-899497514),a=o,o=s,s=i<<30|i>>>2,i=n,n=c}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+a|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=h.clone.call(this);return t._hash=this._hash.clone(),t}}),u.SHA1=h._createHelper(f),u.HmacSHA1=h._createHmacHelper(f),function(t){for(var e=v,r=(i=e.lib).WordArray,n=i.Hasher,i=e.algo,s=[],o=[],a=function(t){return 4294967296*(t-(0|t))|0},u=2,c=0;64>c;){var h;t:{h=u;for(var l=t.sqrt(h),f=2;f<=l;f++)if(!(h%f)){h=!1;break t}h=!0}h&&(8>c&&(s[c]=a(t.pow(u,.5))),o[c]=a(t.pow(u,1/3)),c++),u++}var p=[];i=i.SHA256=n.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],u=r[4],c=r[5],h=r[6],l=r[7],f=0;64>f;f++){if(16>f)p[f]=0|t[e+f];else{var g=p[f-15],d=p[f-2];p[f]=((g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3)+p[f-7]+((d<<15|d>>>17)^(d<<13|d>>>19)^d>>>10)+p[f-16]}g=l+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&h)+o[f]+p[f],d=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&s^i&s),l=h,h=c,c=u,u=a+g|0,a=s,s=i,i=n,n=g+d|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+u|0,r[5]=r[5]+c|0,r[6]=r[6]+h|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=n._createHelper(i),e.HmacSHA256=n._createHmacHelper(i)}(Math),function(){var t=v,e=t.lib.WordArray,r=(n=t.algo).SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=r._doFinalize.call(this);return t.sigBytes-=4,t}});t.SHA224=r._createHelper(n),t.HmacSHA224=r._createHmacHelper(n)}(),function(){function t(){return n.create.apply(n,arguments)}for(var e=v,r=e.lib.Hasher,n=(s=e.x64).Word,i=s.WordArray,s=e.algo,o=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=t();s=s.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=(l=this._hash.words)[0],n=l[1],i=l[2],s=l[3],u=l[4],c=l[5],h=l[6],l=l[7],f=r.high,p=r.low,g=n.high,d=n.low,v=i.high,m=i.low,y=s.high,x=s.low,w=u.high,S=u.low,E=c.high,b=c.low,F=h.high,A=h.low,C=l.high,D=l.low,P=f,I=p,T=g,R=d,N=v,_=m,O=y,B=x,j=w,H=S,k=E,L=b,V=F,M=A,q=C,K=D,U=0;80>U;U++){var z=a[U];if(16>U)var W=z.high=0|t[e+2*U],G=z.low=0|t[e+2*U+1];else{W=((G=(W=a[U-15]).high)>>>1|($=W.low)<<31)^(G>>>8|$<<24)^G>>>7;var $=($>>>1|G<<31)^($>>>8|G<<24)^($>>>7|G<<25),J=((G=(J=a[U-2]).high)>>>19|(Y=J.low)<<13)^(G<<3|Y>>>29)^G>>>6,Y=(Y>>>19|G<<13)^(Y<<3|G>>>29)^(Y>>>6|G<<26),X=(G=a[U-7]).high,Z=(Q=a[U-16]).high,Q=Q.low;W=(W=(W=W+X+((G=$+G.low)>>>0<$>>>0?1:0))+J+((G=G+Y)>>>0<Y>>>0?1:0))+Z+((G=G+Q)>>>0<Q>>>0?1:0);z.high=W,z.low=G}X=j&k^~j&V,Q=H&L^~H&M,z=P&T^P&N^T&N;var tt=I&R^I&_^R&_,et=($=(P>>>28|I<<4)^(P<<30|I>>>2)^(P<<25|I>>>7),J=(I>>>28|P<<4)^(I<<30|P>>>2)^(I<<25|P>>>7),(Y=o[U]).high),rt=Y.low;Z=q+((j>>>14|H<<18)^(j>>>18|H<<14)^(j<<23|H>>>9))+((Y=K+((H>>>14|j<<18)^(H>>>18|j<<14)^(H<<23|j>>>9)))>>>0<K>>>0?1:0),q=V,K=M,V=k,M=L,k=j,L=H,j=O+(Z=(Z=(Z=Z+X+((Y=Y+Q)>>>0<Q>>>0?1:0))+et+((Y=Y+rt)>>>0<rt>>>0?1:0))+W+((Y=Y+G)>>>0<G>>>0?1:0))+((H=B+Y|0)>>>0<B>>>0?1:0)|0,O=N,B=_,N=T,_=R,T=P,R=I,P=Z+(z=$+z+((G=J+tt)>>>0<J>>>0?1:0))+((I=Y+G|0)>>>0<Y>>>0?1:0)|0}p=r.low=p+I,r.high=f+P+(p>>>0<I>>>0?1:0),d=n.low=d+R,n.high=g+T+(d>>>0<R>>>0?1:0),m=i.low=m+_,i.high=v+N+(m>>>0<_>>>0?1:0),x=s.low=x+B,s.high=y+O+(x>>>0<B>>>0?1:0),S=u.low=S+H,u.high=w+j+(S>>>0<H>>>0?1:0),b=c.low=b+L,c.high=E+k+(b>>>0<L>>>0?1:0),A=h.low=A+M,h.high=F+V+(A>>>0<M>>>0?1:0),D=l.low=D+K,l.high=C+q+(D>>>0<K>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),e[31+(n+128>>>10<<5)]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32}),e.SHA512=r._createHelper(s),e.HmacSHA512=r._createHmacHelper(s)}(),function(){var t=v,e=(i=t.x64).Word,r=i.WordArray,n=(i=t.algo).SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=n._createHelper(i),t.HmacSHA384=n._createHmacHelper(i)}(),function(){var t=v,e=(n=t.lib).WordArray,r=n.Hasher,n=t.algo,i=e.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=e.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),o=e.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),a=e.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=e.create([0,1518500249,1859775393,2400959708,2840853838]),c=e.create([1352829926,1548603684,1836072691,2053994217,0]);n=n.RIPEMD160=r.extend({_doReset:function(){this._hash=e.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;16>r;r++){var n=t[w=e+r];t[w]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var h,l,f,p,g,d,v,m,y,x,w=this._hash.words,S=(n=u.words,c.words),E=i.words,b=s.words,F=o.words,A=a.words;d=h=w[0],v=l=w[1],m=f=w[2],y=p=w[3],x=g=w[4];var C;for(r=0;80>r;r+=1)C=h+t[e+E[r]]|0,C=16>r?C+((l^f^p)+n[0]):32>r?C+((l&f|~l&p)+n[1]):48>r?C+(((l|~f)^p)+n[2]):64>r?C+((l&p|f&~p)+n[3]):C+((l^(f|~p))+n[4]),C=(C=(C|=0)<<F[r]|C>>>32-F[r])+g|0,h=g,g=p,p=f<<10|f>>>22,f=l,l=C,C=d+t[e+b[r]]|0,C=16>r?C+((v^(m|~y))+S[0]):32>r?C+((v&y|m&~y)+S[1]):48>r?C+(((v|~m)^y)+S[2]):64>r?C+((v&m|~v&y)+S[3]):C+((v^m^y)+S[4]),C=(C=(C|=0)<<A[r]|C>>>32-A[r])+x|0,d=x,x=y,y=m<<10|m>>>22,m=v,v=C;C=w[1]+f+y|0,w[1]=w[2]+p+x|0,w[2]=w[3]+g+d|0,w[3]=w[4]+h+v|0,w[4]=w[0]+l+m|0,w[0]=C},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;for(e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process(),e=(t=this._hash).words,r=0;5>r;r++)n=e[r],e[r]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8);return t},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});t.RIPEMD160=r._createHelper(n),t.HmacRIPEMD160=r._createHmacHelper(n)}(),function(){var t=v,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(t,r){t=this._hasher=new t.init,"string"==typeof r&&(r=e.parse(r));var n=t.blockSize,i=4*n;r.sigBytes>i&&(r=t.finalize(r)),r.clamp();for(var s=this._oKey=r.clone(),o=this._iKey=r.clone(),a=s.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;s.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher;return t=e.finalize(t),e.reset(),e.finalize(this._oKey.clone().concat(t))}})}(),function(){var t,e=v,r=(t=e.lib).Base,n=t.WordArray,i=(t=e.algo).HMAC,s=t.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:t.SHA1,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var r=this.cfg,s=i.create(r.hasher,t),o=n.create(),a=n.create([1]),u=o.words,c=a.words,h=r.keySize;for(r=r.iterations;u.length<h;){var l=s.update(e).finalize(a);s.reset();for(var f=l.words,p=f.length,g=l,d=1;d<r;d++){g=s.finalize(g),s.reset();for(var v=g.words,m=0;m<p;m++)f[m]^=v[m]}o.concat(l),c[0]++}return o.sigBytes=4*h,o}});e.PBKDF2=function(t,e,r){return s.create(r).compute(t,e)}}();
1
+ "use strict";var t=require("ui-element-plus"),e=require("vue"),r=require("node-forge");const n={TOKEN:"token",USER_INFO:"userInfo",COMPANYCODE:"companyCode",COMPANYNAME:"companyName"};function i(){return localStorage.getItem(n.TOKEN)}var s,a,o,u,c,h,l,f,p,g="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},d={userAgent:!1},v={},m=m||function(t){var e={},r=e.lib={},n=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var r=new t;return e&&r.mixIn(e),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=n.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||a).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var s=0;s<i;s++){var a=r[s>>>2]>>>24-s%4*8&255;e[n+s>>>2]|=a<<24-(n+s)%4*8}else for(s=0;s<i;s+=4)e[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=n.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r=[],n=0;n<e;n+=4)r.push(4294967296*t.random()|0);return new i.init(r,e)}}),s=e.enc={},a=s.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new i.init(r,e/2)}},o=s.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new i.init(r,e)}},u=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(o.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return o.parse(unescape(encodeURIComponent(t)))}},c=r.BufferedBlockAlgorithm=n.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,s=r.sigBytes,a=this.blockSize,o=s/(4*a),u=(o=e?t.ceil(o):t.max((0|o)-this._minBufferSize,0))*a,c=t.min(4*u,s);if(u){for(var h=0;h<u;h+=a)this._doProcessBlock(n,h);var l=n.splice(0,u);r.sigBytes-=c}return new i.init(l,c)},clone:function(){var t=n.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});r.Hasher=c.extend({cfg:n.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new h.HMAC.init(t,r).finalize(e)}}});var h=e.algo={};return e}(Math);a=(s=m).lib,o=a.Base,u=a.WordArray,(s=s.x64={}).Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),s.WordArray=o.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,r=[],n=0;n<e;n++){var i=t[n];r.push(i.high),r.push(i.low)}return u.create(r,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),r=e.length,n=0;n<r;n++)e[n]=e[n].clone();return t}}),m.lib.Cipher||function(){var t=(f=m).lib,e=t.Base,r=t.WordArray,n=t.BufferedBlockAlgorithm,i=f.enc.Base64,s=f.algo.EvpKDF,a=t.Cipher=n.extend({cfg:e.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){n.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(t){return{encrypt:function(e,r,n){return("string"==typeof r?p:l).encrypt(t,e,r,n)},decrypt:function(e,r,n){return("string"==typeof r?p:l).decrypt(t,e,r,n)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var o=f.mode={},u=function(t,e,r){var n=this._iv;n?this._iv=undefined:n=this._prevBlock;for(var i=0;i<r;i++)t[e+i]^=n[i]},c=(t.BlockCipherMode=e.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}})).extend();c.Encryptor=c.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize;u.call(this,t,e,n),r.encryptBlock(t,e),this._prevBlock=t.slice(e,e+n)}}),c.Decryptor=c.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=t.slice(e,e+n);r.decryptBlock(t,e),u.call(this,t,e,n),this._prevBlock=i}}),o=o.CBC=c,c=(f.pad={}).Pkcs7={pad:function(t,e){for(var n,i=(n=(n=4*e)-t.sigBytes%n)<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(i);n=r.create(s,n),t.concat(n)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:o,padding:c}),reset:function(){a.reset.call(this);var t=(e=this.cfg).iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=e.createEncryptor;else r=e.createDecryptor,this._minBufferSize=1;this._mode=r.call(e,this,t&&t.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var h=t.CipherParams=e.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),l=(o=(f.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext;return((t=t.salt)?r.create([1398893684,1701076831]).concat(t).concat(e):e).toString(i)},parse:function(t){var e=(t=i.parse(t)).words;if(1398893684==e[0]&&1701076831==e[1]){var n=r.create(e.slice(2,4));e.splice(0,4),t.sigBytes-=16}return h.create({ciphertext:t,salt:n})}},t.SerializableCipher=e.extend({cfg:e.extend({format:o}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n);return e=i.finalize(e),i=i.cfg,h.create({ciphertext:e,key:r,iv:i.iv,algorithm:t,mode:i.mode,padding:i.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}})),f=(f.kdf={}).OpenSSL={execute:function(t,e,n,i){return i||(i=r.random(8)),t=s.create({keySize:e+n}).compute(t,i),n=r.create(t.words.slice(e),4*n),t.sigBytes=4*e,h.create({key:t,iv:n,salt:i})}},p=t.PasswordBasedCipher=l.extend({cfg:l.cfg.extend({kdf:f}),encrypt:function(t,e,r,n){return r=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize),n.iv=r.iv,(t=l.encrypt.call(this,t,e,r.key,n)).mixIn(r),t},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),r=n.kdf.execute(r,t.keySize,t.ivSize,e.salt),n.iv=r.iv,l.decrypt.call(this,t,e,r.key,n)}})}(),function(){for(var t=m,e=t.lib.BlockCipher,r=t.algo,n=[],i=[],s=[],a=[],o=[],u=[],c=[],h=[],l=[],f=[],p=[],g=0;256>g;g++)p[g]=128>g?g<<1:g<<1^283;var d=0,v=0;for(g=0;256>g;g++){var y=(y=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&y^99;n[d]=y,i[y]=d;var x=p[d],w=p[x],S=p[w],E=257*p[y]^16843008*y;s[d]=E<<24|E>>>8,a[d]=E<<16|E>>>16,o[d]=E<<8|E>>>24,u[d]=E,E=16843009*S^65537*w^257*x^16843008*d,c[y]=E<<24|E>>>8,h[y]=E<<16|E>>>16,l[y]=E<<8|E>>>24,f[y]=E,d?(d=x^p[p[p[S^x]]],v^=p[p[v]]):d=v=1}var b=[0,1,2,4,8,16,32,64,128,27,54];r=r.AES=e.extend({_doReset:function(){for(var t=(r=this._key).words,e=r.sigBytes/4,r=4*((this._nRounds=e+6)+1),i=this._keySchedule=[],s=0;s<r;s++)if(s<e)i[s]=t[s];else{var a=i[s-1];s%e?6<e&&4==s%e&&(a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a]):(a=n[(a=a<<8|a>>>24)>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a],a^=b[s/e|0]<<24),i[s]=i[s-e]^a}for(t=this._invKeySchedule=[],e=0;e<r;e++)s=r-e,a=e%4?i[s]:i[s-4],t[e]=4>e||4>=s?a:c[n[a>>>24]]^h[n[a>>>16&255]]^l[n[a>>>8&255]]^f[n[255&a]]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,a,o,u,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,c,h,l,f,i),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,n,i,s,a,o){for(var u=this._nRounds,c=t[e]^r[0],h=t[e+1]^r[1],l=t[e+2]^r[2],f=t[e+3]^r[3],p=4,g=1;g<u;g++){var d=n[c>>>24]^i[h>>>16&255]^s[l>>>8&255]^a[255&f]^r[p++],v=n[h>>>24]^i[l>>>16&255]^s[f>>>8&255]^a[255&c]^r[p++],m=n[l>>>24]^i[f>>>16&255]^s[c>>>8&255]^a[255&h]^r[p++];f=n[f>>>24]^i[c>>>16&255]^s[h>>>8&255]^a[255&l]^r[p++],c=d,h=v,l=m}d=(o[c>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&f])^r[p++],v=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[f>>>8&255]<<8|o[255&c])^r[p++],m=(o[l>>>24]<<24|o[f>>>16&255]<<16|o[c>>>8&255]<<8|o[255&h])^r[p++],f=(o[f>>>24]<<24|o[c>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[p++],t[e]=d,t[e+1]=v,t[e+2]=m,t[e+3]=f},keySize:8});t.AES=e._createHelper(r)}(),function(){function t(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function e(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}var r=m,n=(i=r.lib).WordArray,i=i.BlockCipher,s=r.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=s.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;56>r;r++){var n=a[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(t=this._subKeys=[],n=0;16>n;n++){var i=t[n]=[],s=u[n];for(r=0;24>r;r++)i[r/6|0]|=e[(o[r]-1+s)%28]<<31-r%6,i[4+(r/6|0)]|=e[28+(o[r+24]-1+s)%28]<<31-r%6;for(i[0]=i[0]<<1|i[0]>>>31,r=1;7>r;r++)i[r]>>>=4*(r-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(e=this._invSubKeys=[],r=0;16>r;r++)e[r]=t[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(r,n,i){this._lBlock=r[n],this._rBlock=r[n+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var s=0;16>s;s++){for(var a=i[s],o=this._lBlock,u=this._rBlock,l=0,f=0;8>f;f++)l|=c[f][((u^a[f])&h[f])>>>0];this._lBlock=u,this._rBlock=o^l}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,t.call(this,1,1431655765),e.call(this,8,16711935),e.call(this,2,858993459),t.call(this,16,65535),t.call(this,4,252645135),r[n]=this._lBlock,r[n+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(l),s=s.TripleDES=i.extend({_doReset:function(){var t=this._key.words;this._des1=l.createEncryptor(n.create(t.slice(0,2))),this._des2=l.createEncryptor(n.create(t.slice(2,4))),this._des3=l.createEncryptor(n.create(t.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(s)}(),function(){var t=m,e=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp(),t=[];for(var i=0;i<r;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;4>a&&i+.75*a<r;a++)t.push(n.charAt(s>>>6*(3-a)&63));if(e=n.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var r=t.length,n=this._map;(i=n.charAt(64))&&(-1!=(i=t.indexOf(i))&&(r=i));for(var i=[],s=0,a=0;a<r;a++)if(a%4){var o=n.indexOf(t.charAt(a-1))<<a%4*2,u=n.indexOf(t.charAt(a))>>>6-a%4*2;i[s>>>2]|=(o|u)<<24-s%4*8,s++}return e.create(i,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){function e(t,e,r,n,i,s,a){return((t=t+(e&r|~e&n)+i+a)<<s|t>>>32-s)+e}function r(t,e,r,n,i,s,a){return((t=t+(e&n|r&~n)+i+a)<<s|t>>>32-s)+e}function n(t,e,r,n,i,s,a){return((t=t+(e^r^n)+i+a)<<s|t>>>32-s)+e}function i(t,e,r,n,i,s,a){return((t=t+(r^(e|~n))+i+a)<<s|t>>>32-s)+e}for(var s=m,a=(u=s.lib).WordArray,o=u.Hasher,u=s.algo,c=[],h=0;64>h;h++)c[h]=4294967296*t.abs(t.sin(h+1))|0;u=u.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,s){for(var a=0;16>a;a++){var o=t[u=s+a];t[u]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}a=this._hash.words;var u=t[s+0],h=(o=t[s+1],t[s+2]),l=t[s+3],f=t[s+4],p=t[s+5],g=t[s+6],d=t[s+7],v=t[s+8],m=t[s+9],y=t[s+10],x=t[s+11],w=t[s+12],S=t[s+13],E=t[s+14],b=t[s+15],F=e(F=a[0],D=a[1],C=a[2],A=a[3],u,7,c[0]),A=e(A,F,D,C,o,12,c[1]),C=e(C,A,F,D,h,17,c[2]),D=e(D,C,A,F,l,22,c[3]);F=e(F,D,C,A,f,7,c[4]),A=e(A,F,D,C,p,12,c[5]),C=e(C,A,F,D,g,17,c[6]),D=e(D,C,A,F,d,22,c[7]),F=e(F,D,C,A,v,7,c[8]),A=e(A,F,D,C,m,12,c[9]),C=e(C,A,F,D,y,17,c[10]),D=e(D,C,A,F,x,22,c[11]),F=e(F,D,C,A,w,7,c[12]),A=e(A,F,D,C,S,12,c[13]),C=e(C,A,F,D,E,17,c[14]),F=r(F,D=e(D,C,A,F,b,22,c[15]),C,A,o,5,c[16]),A=r(A,F,D,C,g,9,c[17]),C=r(C,A,F,D,x,14,c[18]),D=r(D,C,A,F,u,20,c[19]),F=r(F,D,C,A,p,5,c[20]),A=r(A,F,D,C,y,9,c[21]),C=r(C,A,F,D,b,14,c[22]),D=r(D,C,A,F,f,20,c[23]),F=r(F,D,C,A,m,5,c[24]),A=r(A,F,D,C,E,9,c[25]),C=r(C,A,F,D,l,14,c[26]),D=r(D,C,A,F,v,20,c[27]),F=r(F,D,C,A,S,5,c[28]),A=r(A,F,D,C,h,9,c[29]),C=r(C,A,F,D,d,14,c[30]),F=n(F,D=r(D,C,A,F,w,20,c[31]),C,A,p,4,c[32]),A=n(A,F,D,C,v,11,c[33]),C=n(C,A,F,D,x,16,c[34]),D=n(D,C,A,F,E,23,c[35]),F=n(F,D,C,A,o,4,c[36]),A=n(A,F,D,C,f,11,c[37]),C=n(C,A,F,D,d,16,c[38]),D=n(D,C,A,F,y,23,c[39]),F=n(F,D,C,A,S,4,c[40]),A=n(A,F,D,C,u,11,c[41]),C=n(C,A,F,D,l,16,c[42]),D=n(D,C,A,F,g,23,c[43]),F=n(F,D,C,A,m,4,c[44]),A=n(A,F,D,C,w,11,c[45]),C=n(C,A,F,D,b,16,c[46]),F=i(F,D=n(D,C,A,F,h,23,c[47]),C,A,u,6,c[48]),A=i(A,F,D,C,d,10,c[49]),C=i(C,A,F,D,E,15,c[50]),D=i(D,C,A,F,p,21,c[51]),F=i(F,D,C,A,w,6,c[52]),A=i(A,F,D,C,l,10,c[53]),C=i(C,A,F,D,y,15,c[54]),D=i(D,C,A,F,o,21,c[55]),F=i(F,D,C,A,v,6,c[56]),A=i(A,F,D,C,b,10,c[57]),C=i(C,A,F,D,g,15,c[58]),D=i(D,C,A,F,S,21,c[59]),F=i(F,D,C,A,f,6,c[60]),A=i(A,F,D,C,x,10,c[61]),C=i(C,A,F,D,h,15,c[62]),D=i(D,C,A,F,m,21,c[63]);a[0]=a[0]+F|0,a[1]=a[1]+D|0,a[2]=a[2]+C|0,a[3]=a[3]+A|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var s=t.floor(n/4294967296);for(r[15+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(r.length+1),this._process(),r=(e=this._hash).words,n=0;4>n;n++)i=r[n],r[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return e},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}}),s.MD5=o._createHelper(u),s.HmacMD5=o._createHmacHelper(u)}(Math),h=(p=(c=m).lib).WordArray,l=p.Hasher,f=[],p=c.algo.SHA1=l.extend({_doReset:function(){this._hash=new h.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],o=r[4],u=0;80>u;u++){if(16>u)f[u]=0|t[e+u];else{var c=f[u-3]^f[u-8]^f[u-14]^f[u-16];f[u]=c<<1|c>>>31}c=(n<<5|n>>>27)+o+f[u],c=20>u?c+(1518500249+(i&s|~i&a)):40>u?c+(1859775393+(i^s^a)):60>u?c+((i&s|i&a|s&a)-1894007588):c+((i^s^a)-899497514),o=a,a=s,s=i<<30|i>>>2,i=n,n=c}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=l.clone.call(this);return t._hash=this._hash.clone(),t}}),c.SHA1=l._createHelper(p),c.HmacSHA1=l._createHmacHelper(p),function(t){for(var e=m,r=(i=e.lib).WordArray,n=i.Hasher,i=e.algo,s=[],a=[],o=function(t){return 4294967296*(t-(0|t))|0},u=2,c=0;64>c;){var h;t:{h=u;for(var l=t.sqrt(h),f=2;f<=l;f++)if(!(h%f)){h=!1;break t}h=!0}h&&(8>c&&(s[c]=o(t.pow(u,.5))),a[c]=o(t.pow(u,1/3)),c++),u++}var p=[];i=i.SHA256=n.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],o=r[3],u=r[4],c=r[5],h=r[6],l=r[7],f=0;64>f;f++){if(16>f)p[f]=0|t[e+f];else{var g=p[f-15],d=p[f-2];p[f]=((g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3)+p[f-7]+((d<<15|d>>>17)^(d<<13|d>>>19)^d>>>10)+p[f-16]}g=l+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&h)+a[f]+p[f],d=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&s^i&s),l=h,h=c,c=u,u=o+g|0,o=s,s=i,i=n,n=g+d|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+u|0,r[5]=r[5]+c|0,r[6]=r[6]+h|0,r[7]=r[7]+l|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=n._createHelper(i),e.HmacSHA256=n._createHmacHelper(i)}(Math),function(){var t=m,e=t.lib.WordArray,r=(n=t.algo).SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=r._doFinalize.call(this);return t.sigBytes-=4,t}});t.SHA224=r._createHelper(n),t.HmacSHA224=r._createHmacHelper(n)}(),function(){function t(){return n.create.apply(n,arguments)}for(var e=m,r=e.lib.Hasher,n=(s=e.x64).Word,i=s.WordArray,s=e.algo,a=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],o=[],u=0;80>u;u++)o[u]=t();s=s.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=(l=this._hash.words)[0],n=l[1],i=l[2],s=l[3],u=l[4],c=l[5],h=l[6],l=l[7],f=r.high,p=r.low,g=n.high,d=n.low,v=i.high,m=i.low,y=s.high,x=s.low,w=u.high,S=u.low,E=c.high,b=c.low,F=h.high,A=h.low,C=l.high,D=l.low,I=f,P=p,T=g,R=d,N=v,O=m,B=y,_=x,j=w,H=S,k=E,L=b,V=F,M=A,q=C,K=D,U=0;80>U;U++){var z=o[U];if(16>U)var W=z.high=0|t[e+2*U],G=z.low=0|t[e+2*U+1];else{W=((G=(W=o[U-15]).high)>>>1|($=W.low)<<31)^(G>>>8|$<<24)^G>>>7;var $=($>>>1|G<<31)^($>>>8|G<<24)^($>>>7|G<<25),J=((G=(J=o[U-2]).high)>>>19|(Y=J.low)<<13)^(G<<3|Y>>>29)^G>>>6,Y=(Y>>>19|G<<13)^(Y<<3|G>>>29)^(Y>>>6|G<<26),X=(G=o[U-7]).high,Z=(Q=o[U-16]).high,Q=Q.low;W=(W=(W=W+X+((G=$+G.low)>>>0<$>>>0?1:0))+J+((G=G+Y)>>>0<Y>>>0?1:0))+Z+((G=G+Q)>>>0<Q>>>0?1:0);z.high=W,z.low=G}X=j&k^~j&V,Q=H&L^~H&M,z=I&T^I&N^T&N;var tt=P&R^P&O^R&O,et=($=(I>>>28|P<<4)^(I<<30|P>>>2)^(I<<25|P>>>7),J=(P>>>28|I<<4)^(P<<30|I>>>2)^(P<<25|I>>>7),(Y=a[U]).high),rt=Y.low;Z=q+((j>>>14|H<<18)^(j>>>18|H<<14)^(j<<23|H>>>9))+((Y=K+((H>>>14|j<<18)^(H>>>18|j<<14)^(H<<23|j>>>9)))>>>0<K>>>0?1:0),q=V,K=M,V=k,M=L,k=j,L=H,j=B+(Z=(Z=(Z=Z+X+((Y=Y+Q)>>>0<Q>>>0?1:0))+et+((Y=Y+rt)>>>0<rt>>>0?1:0))+W+((Y=Y+G)>>>0<G>>>0?1:0))+((H=_+Y|0)>>>0<_>>>0?1:0)|0,B=N,_=O,N=T,O=R,T=I,R=P,I=Z+(z=$+z+((G=J+tt)>>>0<J>>>0?1:0))+((P=Y+G|0)>>>0<Y>>>0?1:0)|0}p=r.low=p+P,r.high=f+I+(p>>>0<P>>>0?1:0),d=n.low=d+R,n.high=g+T+(d>>>0<R>>>0?1:0),m=i.low=m+O,i.high=v+N+(m>>>0<O>>>0?1:0),x=s.low=x+_,s.high=y+B+(x>>>0<_>>>0?1:0),S=u.low=S+H,u.high=w+j+(S>>>0<H>>>0?1:0),b=c.low=b+L,c.high=E+k+(b>>>0<L>>>0?1:0),A=h.low=A+M,h.high=F+V+(A>>>0<M>>>0?1:0),D=l.low=D+K,l.high=C+q+(D>>>0<K>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),e[31+(n+128>>>10<<5)]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32}),e.SHA512=r._createHelper(s),e.HmacSHA512=r._createHmacHelper(s)}(),function(){var t=m,e=(i=t.x64).Word,r=i.WordArray,n=(i=t.algo).SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=n._createHelper(i),t.HmacSHA384=n._createHmacHelper(i)}(),function(){var t=m,e=(n=t.lib).WordArray,r=n.Hasher,n=t.algo,i=e.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=e.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),a=e.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),o=e.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=e.create([0,1518500249,1859775393,2400959708,2840853838]),c=e.create([1352829926,1548603684,1836072691,2053994217,0]);n=n.RIPEMD160=r.extend({_doReset:function(){this._hash=e.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;16>r;r++){var n=t[w=e+r];t[w]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var h,l,f,p,g,d,v,m,y,x,w=this._hash.words,S=(n=u.words,c.words),E=i.words,b=s.words,F=a.words,A=o.words;d=h=w[0],v=l=w[1],m=f=w[2],y=p=w[3],x=g=w[4];var C;for(r=0;80>r;r+=1)C=h+t[e+E[r]]|0,C=16>r?C+((l^f^p)+n[0]):32>r?C+((l&f|~l&p)+n[1]):48>r?C+(((l|~f)^p)+n[2]):64>r?C+((l&p|f&~p)+n[3]):C+((l^(f|~p))+n[4]),C=(C=(C|=0)<<F[r]|C>>>32-F[r])+g|0,h=g,g=p,p=f<<10|f>>>22,f=l,l=C,C=d+t[e+b[r]]|0,C=16>r?C+((v^(m|~y))+S[0]):32>r?C+((v&y|m&~y)+S[1]):48>r?C+(((v|~m)^y)+S[2]):64>r?C+((v&m|~v&y)+S[3]):C+((v^m^y)+S[4]),C=(C=(C|=0)<<A[r]|C>>>32-A[r])+x|0,d=x,x=y,y=m<<10|m>>>22,m=v,v=C;C=w[1]+f+y|0,w[1]=w[2]+p+x|0,w[2]=w[3]+g+d|0,w[3]=w[4]+h+v|0,w[4]=w[0]+l+m|0,w[0]=C},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;for(e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process(),e=(t=this._hash).words,r=0;5>r;r++)n=e[r],e[r]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8);return t},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});t.RIPEMD160=r._createHelper(n),t.HmacRIPEMD160=r._createHmacHelper(n)}(),function(){var t=m,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(t,r){t=this._hasher=new t.init,"string"==typeof r&&(r=e.parse(r));var n=t.blockSize,i=4*n;r.sigBytes>i&&(r=t.finalize(r)),r.clamp();for(var s=this._oKey=r.clone(),a=this._iKey=r.clone(),o=s.words,u=a.words,c=0;c<n;c++)o[c]^=1549556828,u[c]^=909522486;s.sigBytes=a.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher;return t=e.finalize(t),e.reset(),e.finalize(this._oKey.clone().concat(t))}})}(),function(){var t,e=m,r=(t=e.lib).Base,n=t.WordArray,i=(t=e.algo).HMAC,s=t.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:t.SHA1,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var r=this.cfg,s=i.create(r.hasher,t),a=n.create(),o=n.create([1]),u=a.words,c=o.words,h=r.keySize;for(r=r.iterations;u.length<h;){var l=s.update(e).finalize(o);s.reset();for(var f=l.words,p=f.length,g=l,d=1;d<r;d++){g=s.finalize(g),s.reset();for(var v=g.words,m=0;m<p;m++)f[m]^=v[m]}a.concat(l),c[0]++}return a.sigBytes=4*h,a}});e.PBKDF2=function(t,e,r){return s.create(r).compute(t,e)}}();
2
2
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
3
3
  */
4
- var m,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function x(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=y.charAt(r>>6)+y.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=y.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=y.charAt(r>>2)+y.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function w(t){var e,r,n,i="",s=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e)(n=y.indexOf(t.charAt(e)))<0||(0==s?(i+=D(n>>2),r=3&n,s=1):1==s?(i+=D(r<<2|n>>4),r=15&n,s=2):2==s?(i+=D(r),i+=D(n>>2),r=3&n,s=3):(i+=D(r<<2|n>>4),i+=D(15&n),s=0));return 1==s&&(i+=D(r<<2)),i}
4
+ var y,x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function w(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=x.charAt(r>>6)+x.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=x.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=x.charAt(r>>2)+x.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function S(t){var e,r,n,i="",s=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e)(n=x.indexOf(t.charAt(e)))<0||(0==s?(i+=I(n>>2),r=3&n,s=1):1==s?(i+=I(r<<2|n>>4),r=15&n,s=2):2==s?(i+=I(r),i+=I(n>>2),r=3&n,s=3):(i+=I(r<<2|n>>4),i+=I(15&n),s=0));return 1==s&&(i+=I(r<<2)),i}
5
5
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
6
- */function S(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function E(){return new S(null)}"Microsoft Internet Explorer"==g.appName?(S.prototype.am=function(t,e,r,n,i,s){for(var o=32767&e,a=e>>15;--s>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*o;i=((u=o*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i},m=30):"Netscape"!=g.appName?(S.prototype.am=function(t,e,r,n,i,s){for(;--s>=0;){var o=e*this[t++]+r[n]+i;i=Math.floor(o/67108864),r[n++]=67108863&o}return i},m=26):(S.prototype.am=function(t,e,r,n,i,s){for(var o=16383&e,a=e>>14;--s>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*o;i=((u=o*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+a*c,r[n++]=268435455&u}return i},m=28),S.prototype.DB=m,S.prototype.DM=(1<<m)-1,S.prototype.DV=1<<m;S.prototype.FV=Math.pow(2,52),S.prototype.F1=52-m,S.prototype.F2=2*m-52;var b,F,A="0123456789abcdefghijklmnopqrstuvwxyz",C=new Array;for(b="0".charCodeAt(0),F=0;F<=9;++F)C[b++]=F;for(b="a".charCodeAt(0),F=10;F<36;++F)C[b++]=F;for(b="A".charCodeAt(0),F=10;F<36;++F)C[b++]=F;function D(t){return A.charAt(t)}function P(t,e){var r=C[t.charCodeAt(e)];return null==r?-1:r}function I(t){var e=E();return e.fromInt(t),e}function T(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function R(t){this.m=t}function N(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function _(t,e){return t&e}function O(t,e){return t|e}function B(t,e){return t^e}function j(t,e){return t&~e}function H(t){if(0==t)return-1;var e=0;return 65535&t||(t>>=16,e+=16),255&t||(t>>=8,e+=8),15&t||(t>>=4,e+=4),3&t||(t>>=2,e+=2),1&t||++e,e}function k(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function L(){}function V(t){return t}function M(t){this.r2=E(),this.q3=E(),S.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}R.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},R.prototype.revert=function(t){return t},R.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},R.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},R.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},N.prototype.convert=function(t){var e=E();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(S.ZERO)>0&&this.m.subTo(e,e),e},N.prototype.revert=function(t){var e=E();return t.copyTo(e),this.reduce(e),e},N.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},N.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},N.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},S.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},S.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},S.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var o=8==r?255&t[n]:P(t,n);o<0?"-"==t.charAt(n)&&(i=!0):(i=!1,0==s?this[this.t++]=o:s+r>this.DB?(this[this.t-1]|=(o&(1<<this.DB-s)-1)<<s,this[this.t++]=o>>this.DB-s):this[this.t-1]|=o<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&S.ZERO.subTo(this,this)},S.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},S.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},S.prototype.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},S.prototype.lShiftTo=function(t,e){var r,n=t%this.DB,i=this.DB-n,s=(1<<i)-1,o=Math.floor(t/this.DB),a=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)e[r+o+1]=this[r]>>i|a,a=(this[r]&s)<<n;for(r=o-1;r>=0;--r)e[r]=0;e[o]=a,e.t=this.t+o+1,e.s=this.s,e.clamp()},S.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,s=(1<<n)-1;e[0]=this[r]>>n;for(var o=r+1;o<this.t;++o)e[o-r-1]|=(this[o]&s)<<i,e[o-r]=this[o]>>n;n>0&&(e[this.t-r-1]|=(this.s&s)<<i),e.t=this.t-r,e.clamp()}},S.prototype.subTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},S.prototype.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i<n.t;++i)e[i+r.t]=r.am(0,n[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&S.ZERO.subTo(e,e)},S.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},S.prototype.divRemTo=function(t,e,r){var n=t.abs();if(n.t<=0)throw"BigInteger divide by zero";var i=this.abs();if(i.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=E());var s=E(),o=this.s,a=t.s,u=this.DB-T(n[n.t-1]);u>0?(n.lShiftTo(u,s),i.lShiftTo(u,r)):(n.copyTo(s),i.copyTo(r));var c=s.t,h=s[c-1];if(0!=h){var l=h*(1<<this.F1)+(c>1?s[c-2]>>this.F2:0),f=this.FV/l,p=(1<<this.F1)/l,g=1<<this.F2,d=r.t,v=d-c,m=null==e?E():e;for(s.dlShiftTo(v,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),S.ONE.dlShiftTo(c,m),m.subTo(s,s);s.t<c;)s[s.t++]=0;for(;--v>=0;){var y=r[--d]==h?this.DM:Math.floor(r[d]*f+(r[d-1]+g)*p);if((r[d]+=s.am(0,y,r,v,0,c))<y)for(s.dlShiftTo(v,m),r.subTo(m,r);r[d]<--y;)r.subTo(m,r)}null!=e&&(r.drShiftTo(c,e),o!=a&&S.ZERO.subTo(e,e)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),o<0&&S.ZERO.subTo(r,r)}},S.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},S.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},S.prototype.exp=function(t,e){if(t>4294967295||t<1)return S.ONE;var r=E(),n=E(),i=e.convert(this),s=T(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<<s)>0)e.mulTo(n,i,r);else{var o=r;r=n,n=o}return e.revert(r)},S.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,i=!1,s="",o=this.t,a=this.DB-o*this.DB%e;if(o-- >0)for(a<this.DB&&(r=this[o]>>a)>0&&(i=!0,s=D(r));o>=0;)a<e?(r=(this[o]&(1<<a)-1)<<e-a,r|=this[--o]>>(a+=this.DB-e)):(r=this[o]>>(a-=e)&n,a<=0&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=D(r));return i?s:"0"},S.prototype.negate=function(){var t=E();return S.ZERO.subTo(this,t),t},S.prototype.abs=function(){return this.s<0?this.negate():this},S.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},S.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+T(this[this.t-1]^this.s&this.DM)},S.prototype.mod=function(t){var e=E();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(S.ZERO)>0&&t.subTo(e,e),e},S.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new R(e):new N(e),this.exp(t,r)},S.ZERO=I(0),S.ONE=I(1),L.prototype.convert=V,L.prototype.revert=V,L.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},L.prototype.sqrTo=function(t,e){t.squareTo(e)},M.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=E();return t.copyTo(e),this.reduce(e),e},M.prototype.revert=function(t){return t},M.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},M.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},M.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var q=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],K=(1<<26)/q[q.length-1];
6
+ */function E(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function b(){return new E(null)}"Microsoft Internet Explorer"==d.appName?(E.prototype.am=function(t,e,r,n,i,s){for(var a=32767&e,o=e>>15;--s>=0;){var u=32767&this[t],c=this[t++]>>15,h=o*u+c*a;i=((u=a*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+o*c+(i>>>30),r[n++]=1073741823&u}return i},y=30):"Netscape"!=d.appName?(E.prototype.am=function(t,e,r,n,i,s){for(;--s>=0;){var a=e*this[t++]+r[n]+i;i=Math.floor(a/67108864),r[n++]=67108863&a}return i},y=26):(E.prototype.am=function(t,e,r,n,i,s){for(var a=16383&e,o=e>>14;--s>=0;){var u=16383&this[t],c=this[t++]>>14,h=o*u+c*a;i=((u=a*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+o*c,r[n++]=268435455&u}return i},y=28),E.prototype.DB=y,E.prototype.DM=(1<<y)-1,E.prototype.DV=1<<y;E.prototype.FV=Math.pow(2,52),E.prototype.F1=52-y,E.prototype.F2=2*y-52;var F,A,C="0123456789abcdefghijklmnopqrstuvwxyz",D=new Array;for(F="0".charCodeAt(0),A=0;A<=9;++A)D[F++]=A;for(F="a".charCodeAt(0),A=10;A<36;++A)D[F++]=A;for(F="A".charCodeAt(0),A=10;A<36;++A)D[F++]=A;function I(t){return C.charAt(t)}function P(t,e){var r=D[t.charCodeAt(e)];return null==r?-1:r}function T(t){var e=b();return e.fromInt(t),e}function R(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function N(t){this.m=t}function O(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function B(t,e){return t&e}function _(t,e){return t|e}function j(t,e){return t^e}function H(t,e){return t&~e}function k(t){if(0==t)return-1;var e=0;return 65535&t||(t>>=16,e+=16),255&t||(t>>=8,e+=8),15&t||(t>>=4,e+=4),3&t||(t>>=2,e+=2),1&t||++e,e}function L(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function V(){}function M(t){return t}function q(t){this.r2=b(),this.q3=b(),E.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}N.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},N.prototype.revert=function(t){return t},N.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},N.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},N.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},O.prototype.convert=function(t){var e=b();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(E.ZERO)>0&&this.m.subTo(e,e),e},O.prototype.revert=function(t){var e=b();return t.copyTo(e),this.reduce(e),e},O.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},O.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},O.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},E.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},E.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},E.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var a=8==r?255&t[n]:P(t,n);a<0?"-"==t.charAt(n)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&128&t[0]&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&E.ZERO.subTo(this,this)},E.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},E.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},E.prototype.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},E.prototype.lShiftTo=function(t,e){var r,n=t%this.DB,i=this.DB-n,s=(1<<i)-1,a=Math.floor(t/this.DB),o=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)e[r+a+1]=this[r]>>i|o,o=(this[r]&s)<<n;for(r=a-1;r>=0;--r)e[r]=0;e[a]=o,e.t=this.t+a+1,e.s=this.s,e.clamp()},E.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,s=(1<<n)-1;e[0]=this[r]>>n;for(var a=r+1;a<this.t;++a)e[a-r-1]|=(this[a]&s)<<i,e[a-r]=this[a]>>n;n>0&&(e[this.t-r-1]|=(this.s&s)<<i),e.t=this.t-r,e.clamp()}},E.prototype.subTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},E.prototype.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i<n.t;++i)e[i+r.t]=r.am(0,n[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&E.ZERO.subTo(e,e)},E.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},E.prototype.divRemTo=function(t,e,r){var n=t.abs();if(n.t<=0)throw"BigInteger divide by zero";var i=this.abs();if(i.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=b());var s=b(),a=this.s,o=t.s,u=this.DB-R(n[n.t-1]);u>0?(n.lShiftTo(u,s),i.lShiftTo(u,r)):(n.copyTo(s),i.copyTo(r));var c=s.t,h=s[c-1];if(0!=h){var l=h*(1<<this.F1)+(c>1?s[c-2]>>this.F2:0),f=this.FV/l,p=(1<<this.F1)/l,g=1<<this.F2,d=r.t,v=d-c,m=null==e?b():e;for(s.dlShiftTo(v,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),E.ONE.dlShiftTo(c,m),m.subTo(s,s);s.t<c;)s[s.t++]=0;for(;--v>=0;){var y=r[--d]==h?this.DM:Math.floor(r[d]*f+(r[d-1]+g)*p);if((r[d]+=s.am(0,y,r,v,0,c))<y)for(s.dlShiftTo(v,m),r.subTo(m,r);r[d]<--y;)r.subTo(m,r)}null!=e&&(r.drShiftTo(c,e),a!=o&&E.ZERO.subTo(e,e)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),a<0&&E.ZERO.subTo(r,r)}},E.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(!(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},E.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},E.prototype.exp=function(t,e){if(t>4294967295||t<1)return E.ONE;var r=b(),n=b(),i=e.convert(this),s=R(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<<s)>0)e.mulTo(n,i,r);else{var a=r;r=n,n=a}return e.revert(r)},E.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,i=!1,s="",a=this.t,o=this.DB-a*this.DB%e;if(a-- >0)for(o<this.DB&&(r=this[a]>>o)>0&&(i=!0,s=I(r));a>=0;)o<e?(r=(this[a]&(1<<o)-1)<<e-o,r|=this[--a]>>(o+=this.DB-e)):(r=this[a]>>(o-=e)&n,o<=0&&(o+=this.DB,--a)),r>0&&(i=!0),i&&(s+=I(r));return i?s:"0"},E.prototype.negate=function(){var t=b();return E.ZERO.subTo(this,t),t},E.prototype.abs=function(){return this.s<0?this.negate():this},E.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},E.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+R(this[this.t-1]^this.s&this.DM)},E.prototype.mod=function(t){var e=b();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(E.ZERO)>0&&t.subTo(e,e),e},E.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new N(e):new O(e),this.exp(t,r)},E.ZERO=T(0),E.ONE=T(1),V.prototype.convert=M,V.prototype.revert=M,V.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},V.prototype.sqrTo=function(t,e){t.squareTo(e)},q.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=b();return t.copyTo(e),this.reduce(e),e},q.prototype.revert=function(t){return t},q.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},q.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},q.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var K=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],U=(1<<26)/K[K.length-1];
7
7
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
8
8
  */
9
- function U(){this.i=0,this.j=0,this.S=new Array}S.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},S.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=I(r),i=E(),s=E(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(t).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(t)+o},S.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,o=0,a=0;a<t.length;++a){var u=P(t,a);u<0?"-"==t.charAt(a)&&0==this.signum()&&(i=!0):(o=e*o+u,++s>=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(o,0)),i&&S.ZERO.subTo(this,this)},S.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(S.ONE.shiftLeft(t-1),O,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(S.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},S.prototype.bitwiseTo=function(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n<s;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=s;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},S.prototype.changeBit=function(t,e){var r=S.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},S.prototype.addTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},S.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},S.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},S.prototype.multiplyLowerTo=function(t,e,r){var n,i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()},S.prototype.multiplyUpperTo=function(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},S.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},S.prototype.millerRabin=function(t){if(this.signum()<=0)return!1;var e=this.subtract(S.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>q.length&&(t=q.length);for(var i=E(),s=0;s<t;++s){i.fromInt(q[Math.floor(Math.random()*q.length)]);var o=i.modPow(n,this);if(0!=o.compareTo(S.ONE)&&0!=o.compareTo(e)){for(var a=1;a++<r&&0!=o.compareTo(e);)if(0==(o=o.modPowInt(2,this)).compareTo(S.ONE))return!1;if(0!=o.compareTo(e))return!1}}return!0},S.prototype.clone=
9
+ function z(){this.i=0,this.j=0,this.S=new Array}E.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},E.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=T(r),i=b(),s=b(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(t).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(t)+a},E.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,a=0,o=0;o<t.length;++o){var u=P(t,o);u<0?"-"==t.charAt(o)&&0==this.signum()&&(i=!0):(a=e*a+u,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&E.ZERO.subTo(this,this)},E.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(E.ONE.shiftLeft(t-1),_,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(E.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},E.prototype.bitwiseTo=function(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n<s;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=s;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},E.prototype.changeBit=function(t,e){var r=E.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},E.prototype.addTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},E.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},E.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},E.prototype.multiplyLowerTo=function(t,e,r){var n,i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()},E.prototype.multiplyUpperTo=function(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},E.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},E.prototype.millerRabin=function(t){if(this.signum()<=0)return!1;var e=this.subtract(E.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>K.length&&(t=K.length);for(var i=b(),s=0;s<t;++s){i.fromInt(K[Math.floor(Math.random()*K.length)]);var a=i.modPow(n,this);if(0!=a.compareTo(E.ONE)&&0!=a.compareTo(e)){for(var o=1;o++<r&&0!=a.compareTo(e);)if(0==(a=a.modPowInt(2,this)).compareTo(E.ONE))return!1;if(0!=a.compareTo(e))return!1}}return!0},E.prototype.clone=
10
10
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
11
11
  */
12
- function(){var t=E();return this.copyTo(t),t},S.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},S.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},S.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},S.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},S.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),128&r&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},S.prototype.equals=function(t){return 0==this.compareTo(t)},S.prototype.min=function(t){return this.compareTo(t)<0?this:t},S.prototype.max=function(t){return this.compareTo(t)>0?this:t},S.prototype.and=function(t){var e=E();return this.bitwiseTo(t,_,e),e},S.prototype.or=function(t){var e=E();return this.bitwiseTo(t,O,e),e},S.prototype.xor=function(t){var e=E();return this.bitwiseTo(t,B,e),e},S.prototype.andNot=function(t){var e=E();return this.bitwiseTo(t,j,e),e},S.prototype.not=function(){for(var t=E(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},S.prototype.shiftLeft=function(t){var e=E();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},S.prototype.shiftRight=function(t){var e=E();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},S.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+H(this[t]);return this.s<0?this.t*this.DB:-1},S.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=k(this[r]^e);return t},S.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)},S.prototype.setBit=function(t){return this.changeBit(t,O)},S.prototype.clearBit=function(t){return this.changeBit(t,j)},S.prototype.flipBit=function(t){return this.changeBit(t,B)},S.prototype.add=function(t){var e=E();return this.addTo(t,e),e},S.prototype.subtract=function(t){var e=E();return this.subTo(t,e),e},S.prototype.multiply=function(t){var e=E();return this.multiplyTo(t,e),e},S.prototype.divide=function(t){var e=E();return this.divRemTo(t,e,null),e},S.prototype.remainder=function(t){var e=E();return this.divRemTo(t,null,e),e},S.prototype.divideAndRemainder=function(t){var e=E(),r=E();return this.divRemTo(t,e,r),new Array(e,r)},S.prototype.modPow=function(t,e){if(t.signum()<0)return this.modInverse(e).modPow(t.negate(),e);var r,n,i=t.bitLength(),s=I(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new R(e):e.isEven()?new M(e):new N(e);var o=new Array,a=3,u=r-1,c=(1<<r)-1;if(o[1]=n.convert(this),r>1){var h=E();for(n.sqrTo(o[1],h);a<=c;)o[a]=E(),n.mulTo(h,o[a-2],o[a]),a+=2}var l,f,p=t.t-1,g=!0,d=E();for(i=T(t[p])-1;p>=0;){for(i>=u?l=t[p]>>i-u&c:(l=(t[p]&(1<<i+1)-1)<<u-i,p>0&&(l|=t[p-1]>>this.DB+i-u)),a=r;!(1&l);)l>>=1,--a;if((i-=a)<0&&(i+=this.DB,--p),g)o[l].copyTo(s),g=!1;else{for(;a>1;)n.sqrTo(s,d),n.sqrTo(d,s),a-=2;a>0?n.sqrTo(s,d):(f=s,s=d,d=f),n.mulTo(d,o[l],s)}for(;p>=0&&!(t[p]&1<<i);)n.sqrTo(s,d),f=s,s=d,d=f,--i<0&&(i=this.DB-1,--p)}return n.revert(s)},S.prototype.modInverse=function(t){if(0==t.signum())return S.ZERO;var e=this.mod(t),r=t.isEven();if(e.isEven()&&r||0==e.signum())return S.ZERO;for(var n=t.clone(),i=e.clone(),s=I(1),o=I(0),a=I(0),u=I(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),r?(s.isEven()&&o.isEven()||(s.addTo(e,s),o.subTo(t,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),r?(a.isEven()&&u.isEven()||(a.addTo(e,a),u.subTo(t,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);n.compareTo(i)>=0?(n.subTo(i,n),r&&s.subTo(a,s),o.subTo(u,o)):(i.subTo(n,i),r&&a.subTo(s,a),u.subTo(o,u))}return 0!=i.compareTo(S.ONE)?S.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},S.prototype.pow=function(t){return this.exp(t,new L)},S.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return e;for(i<s&&(s=i),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},S.prototype.isProbablePrime=function(t){if(this.signum()<=0)return!1;var e,r=this.abs();if(1==r.t&&r[0]<=q[q.length-1]){for(e=0;e<q.length;++e)if(r[0]==q[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<q.length;){for(var n=q[e],i=e+1;i<q.length&&n<K;)n*=q[i++];for(n=r.modInt(n);e<i;)if(n%q[e++]==0)return!1}return r.millerRabin(t)},S.prototype.square=function(){var t=E();return this.squareTo(t),t},S.prototype.sqrt=function(){for(var t=S.ZERO.setBit(this.bitLength()/2),e=t;;){var r=t.add(this.divide(t)).shiftRight(1);if(r.equals(t)||r.equals(e))return r;e=t,t=r}},U.prototype.init=function(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0},U.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var z,W,G,$=256;
12
+ function(){var t=b();return this.copyTo(t),t},E.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},E.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},E.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},E.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},E.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),128&r&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},E.prototype.equals=function(t){return 0==this.compareTo(t)},E.prototype.min=function(t){return this.compareTo(t)<0?this:t},E.prototype.max=function(t){return this.compareTo(t)>0?this:t},E.prototype.and=function(t){var e=b();return this.bitwiseTo(t,B,e),e},E.prototype.or=function(t){var e=b();return this.bitwiseTo(t,_,e),e},E.prototype.xor=function(t){var e=b();return this.bitwiseTo(t,j,e),e},E.prototype.andNot=function(t){var e=b();return this.bitwiseTo(t,H,e),e},E.prototype.not=function(){for(var t=b(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},E.prototype.shiftLeft=function(t){var e=b();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},E.prototype.shiftRight=function(t){var e=b();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},E.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+k(this[t]);return this.s<0?this.t*this.DB:-1},E.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=L(this[r]^e);return t},E.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)},E.prototype.setBit=function(t){return this.changeBit(t,_)},E.prototype.clearBit=function(t){return this.changeBit(t,H)},E.prototype.flipBit=function(t){return this.changeBit(t,j)},E.prototype.add=function(t){var e=b();return this.addTo(t,e),e},E.prototype.subtract=function(t){var e=b();return this.subTo(t,e),e},E.prototype.multiply=function(t){var e=b();return this.multiplyTo(t,e),e},E.prototype.divide=function(t){var e=b();return this.divRemTo(t,e,null),e},E.prototype.remainder=function(t){var e=b();return this.divRemTo(t,null,e),e},E.prototype.divideAndRemainder=function(t){var e=b(),r=b();return this.divRemTo(t,e,r),new Array(e,r)},E.prototype.modPow=function(t,e){if(t.signum()<0)return this.modInverse(e).modPow(t.negate(),e);var r,n,i=t.bitLength(),s=T(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new N(e):e.isEven()?new q(e):new O(e);var a=new Array,o=3,u=r-1,c=(1<<r)-1;if(a[1]=n.convert(this),r>1){var h=b();for(n.sqrTo(a[1],h);o<=c;)a[o]=b(),n.mulTo(h,a[o-2],a[o]),o+=2}var l,f,p=t.t-1,g=!0,d=b();for(i=R(t[p])-1;p>=0;){for(i>=u?l=t[p]>>i-u&c:(l=(t[p]&(1<<i+1)-1)<<u-i,p>0&&(l|=t[p-1]>>this.DB+i-u)),o=r;!(1&l);)l>>=1,--o;if((i-=o)<0&&(i+=this.DB,--p),g)a[l].copyTo(s),g=!1;else{for(;o>1;)n.sqrTo(s,d),n.sqrTo(d,s),o-=2;o>0?n.sqrTo(s,d):(f=s,s=d,d=f),n.mulTo(d,a[l],s)}for(;p>=0&&!(t[p]&1<<i);)n.sqrTo(s,d),f=s,s=d,d=f,--i<0&&(i=this.DB-1,--p)}return n.revert(s)},E.prototype.modInverse=function(t){if(0==t.signum())return E.ZERO;var e=this.mod(t),r=t.isEven();if(e.isEven()&&r||0==e.signum())return E.ZERO;for(var n=t.clone(),i=e.clone(),s=T(1),a=T(0),o=T(0),u=T(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),r?(s.isEven()&&a.isEven()||(s.addTo(e,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);for(;i.isEven();)i.rShiftTo(1,i),r?(o.isEven()&&u.isEven()||(o.addTo(e,o),u.subTo(t,u)),o.rShiftTo(1,o)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);n.compareTo(i)>=0?(n.subTo(i,n),r&&s.subTo(o,s),a.subTo(u,a)):(i.subTo(n,i),r&&o.subTo(s,o),u.subTo(a,u))}return 0!=i.compareTo(E.ONE)?E.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},E.prototype.pow=function(t){return this.exp(t,new V)},E.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return e;for(i<s&&(s=i),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},E.prototype.isProbablePrime=function(t){if(this.signum()<=0)return!1;var e,r=this.abs();if(1==r.t&&r[0]<=K[K.length-1]){for(e=0;e<K.length;++e)if(r[0]==K[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<K.length;){for(var n=K[e],i=e+1;i<K.length&&n<U;)n*=K[i++];for(n=r.modInt(n);e<i;)if(n%K[e++]==0)return!1}return r.millerRabin(t)},E.prototype.square=function(){var t=b();return this.squareTo(t),t},E.prototype.sqrt=function(){for(var t=E.ZERO.setBit(this.bitLength()/2),e=t;;){var r=t.add(this.divide(t)).shiftRight(1);if(r.equals(t)||r.equals(e))return r;e=t,t=r}},z.prototype.init=function(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0},z.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var W,G,$,J=256;
13
13
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
14
- */function J(){!function(t){W[G++]^=255&t,W[G++]^=t>>8&255,W[G++]^=t>>16&255,W[G++]^=t>>24&255,G>=$&&(G-=$)}((new Date).getTime())}if(null==W){var Y;if(W=new Array,G=0,void 0!==d&&(void 0!==d.crypto||void 0!==d.msCrypto)){var X=d.crypto||d.msCrypto;if(X.getRandomValues){var Z=new Uint8Array(32);for(X.getRandomValues(Z),Y=0;Y<32;++Y)W[G++]=Z[Y]}else if("Netscape"==g.appName&&g.appVersion<"5"){var Q=d.crypto.random(32);for(Y=0;Y<Q.length;++Y)W[G++]=255&Q.charCodeAt(Y)}}if(G<$&&"undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.getRandomValues){var tt=new Uint8Array($-G);for(globalThis.crypto.getRandomValues(tt),Y=0;Y<tt.length;++Y)W[G++]=tt[Y]}for(;G<$;)Y=Math.floor(65536*Math.random()),W[G++]=Y>>>8,W[G++]=255&Y;G=0,J()}function et(){if(null==z){for(J(),(z=new U).init(W),G=0;G<W.length;++G)W[G]=0;G=0}return z.next()}function rt(){}
14
+ */function Y(){!function(t){G[$++]^=255&t,G[$++]^=t>>8&255,G[$++]^=t>>16&255,G[$++]^=t>>24&255,$>=J&&($-=J)}((new Date).getTime())}if(null==G){var X;if(G=new Array,$=0,void 0!==v&&(void 0!==v.crypto||void 0!==v.msCrypto)){var Z=v.crypto||v.msCrypto;if(Z.getRandomValues){var Q=new Uint8Array(32);for(Z.getRandomValues(Q),X=0;X<32;++X)G[$++]=Q[X]}else if("Netscape"==d.appName&&d.appVersion<"5"){var tt=v.crypto.random(32);for(X=0;X<tt.length;++X)G[$++]=255&tt.charCodeAt(X)}}if($<J&&"undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.getRandomValues){var et=new Uint8Array(J-$);for(globalThis.crypto.getRandomValues(et),X=0;X<et.length;++X)G[$++]=et[X]}for(;$<J;)X=Math.floor(65536*Math.random()),G[$++]=X>>>8,G[$++]=255&X;$=0,Y()}function rt(){if(null==W){for(Y(),(W=new z).init(G),$=0;$<G.length;++$)G[$]=0;$=0}return W.next()}function nt(){}
15
15
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
16
16
  */
17
- function nt(t,e){return new S(t,e)}function it(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}
17
+ function it(t,e){return new E(t,e)}function st(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}
18
18
  /*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
19
19
  */
20
- function st(t,e){this.x=e,this.q=t}function ot(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=null==n?S.ONE:n,this.zinv=null}function at(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new ot(this,null,null)}rt.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=et()},it.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},it.prototype.setPublic=function(t,e){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA public key";this.n=nt(t,16),this.e=parseInt(e,16)}if(null==this.n||"function"!=typeof this.n.compareTo||this.n.compareTo(S.ONE)<=0||null==this.e||isNaN(this.e)||this.e<=0)throw"Invalid RSA public key"},it.prototype.type="RSA",it.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)},it.prototype.setPrivate=function(t,e,r){if(this.isPrivate=!0,"string"!=typeof t)this.n=t,this.e=e,this.d=r;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key";this.n=nt(t,16),this.e=parseInt(e,16),this.d=nt(r,16)}},it.prototype.setPrivateEx=function(t,e,r,n,i,s,o,a){if(this.isPrivate=!0,this.isPublic=!1,null==t)throw"RSASetPrivateEx N == null";if(null==e)throw"RSASetPrivateEx E == null";if(0==t.length)throw"RSASetPrivateEx N.length == 0";if(0==e.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=nt(t,16),this.e=parseInt(e,16),this.d=nt(r,16),this.p=nt(n,16),this.q=nt(i,16),this.dmp1=nt(s,16),this.dmq1=nt(o,16),this.coeff=nt(a,16)},it.prototype.generate=function(t,e){var r=new rt,n=t>>1;this.e=parseInt(e,16);for(var i=new S(e,16),s=t/2-100,o=S.ONE.shiftLeft(s);;){for(;this.p=new S(t-n,1,r),0!=this.p.subtract(S.ONE).gcd(i).compareTo(S.ONE)||!this.p.isProbablePrime(10););for(;this.q=new S(n,1,r),0!=this.q.subtract(S.ONE).gcd(i).compareTo(S.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var a=this.p;this.p=this.q,this.q=a}var u=this.q.subtract(this.p).abs();if(!(u.bitLength()<s||u.compareTo(o)<=0)){var c=this.p.subtract(S.ONE),h=this.q.subtract(S.ONE),l=c.multiply(h);if(0==l.gcd(i).compareTo(S.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==t)){this.d=i.modInverse(l),this.dmp1=this.d.mod(c),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0},st.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},st.prototype.toBigInteger=function(){return this.x},st.prototype.negate=function(){return new st(this.q,this.x.negate().mod(this.q))},st.prototype.add=function(t){return new st(this.q,this.x.add(t.toBigInteger()).mod(this.q))},st.prototype.subtract=function(t){return new st(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},st.prototype.multiply=function(t){return new st(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},st.prototype.square=function(){return new st(this.q,this.x.square().mod(this.q))},st.prototype.divide=function(t){return new st(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},st.prototype.sqrt=function(){return new st(this.q,this.x.sqrt().mod(this.q))},ot.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ot.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ot.prototype.equals=function(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(S.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(S.ZERO))},ot.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(S.ZERO)&&!this.y.toBigInteger().equals(S.ZERO)},ot.prototype.negate=function(){return new ot(this.curve,this.x,this.y.negate(),this.z)},ot.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(S.ZERO.equals(r))return S.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new S("3"),i=this.x.toBigInteger(),s=this.y.toBigInteger();t.x.toBigInteger(),t.y.toBigInteger();var o=r.square(),a=o.multiply(r),u=i.multiply(o),c=e.square().multiply(this.z),h=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(a).multiply(r).mod(this.curve.q),l=u.multiply(n).multiply(e).subtract(s.multiply(a)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(a)).mod(this.curve.q),f=a.multiply(this.z).multiply(t.z).mod(this.curve.q);return new ot(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(l),f)},ot.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new S("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),s=this.curve.a.toBigInteger(),o=e.square().multiply(t);S.ZERO.equals(s)||(o=o.add(this.z.square().multiply(s)));var a=(o=o.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=o.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(o.square().multiply(o)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new ot(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),c)},ot.prototype.multiply=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new S("3")),i=this.negate(),s=this,o=this.curve.q.subtract(t),a=o.multiply(new S("3")),u=new ot(this.curve,this.x,this.y),c=u.negate();for(e=n.bitLength()-2;e>0;--e){s=s.twice();var h=n.testBit(e);h!=r.testBit(e)&&(s=s.add(h?this:i))}for(e=a.bitLength()-2;e>0;--e){u=u.twice();var l=a.testBit(e);l!=o.testBit(e)&&(u=u.add(l?u:c))}return s},ot.prototype.multiplyTwo=function(t,e,r){var n;n=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),s=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?i=r.testBit(n)?i.add(s):i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i},at.prototype.getQ=function(){return this.q},at.prototype.getA=function(){return this.a},at.prototype.getB=function(){return this.b},at.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},at.prototype.getInfinity=function(){return this.infinity},at.prototype.fromBigInteger=function(t){return new st(this.q,t)},at.prototype.decodePointHex=function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var e=t.substr(0,2);t.substr(2);var r=this.fromBigInteger(new S(a,16)),n=this.getA(),i=this.getB(),s=r.square().add(n).multiply(r).add(i).sqrt();return"03"==e&&(s=s.negate()),new ot(this,r,s);case 4:case 6:case 7:var o=(t.length-2)/2,a=t.substr(2,o),u=t.substr(o+2,o);return new ot(this,this.fromBigInteger(new S(a,16)),this.fromBigInteger(new S(u,16)));default:return null}},
20
+ function at(t,e){this.x=e,this.q=t}function ot(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=null==n?E.ONE:n,this.zinv=null}function ut(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new ot(this,null,null)}nt.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=rt()},st.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},st.prototype.setPublic=function(t,e){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA public key";this.n=it(t,16),this.e=parseInt(e,16)}if(null==this.n||"function"!=typeof this.n.compareTo||this.n.compareTo(E.ONE)<=0||null==this.e||isNaN(this.e)||this.e<=0)throw"Invalid RSA public key"},st.prototype.type="RSA",st.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)},st.prototype.setPrivate=function(t,e,r){if(this.isPrivate=!0,"string"!=typeof t)this.n=t,this.e=e,this.d=r;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key";this.n=it(t,16),this.e=parseInt(e,16),this.d=it(r,16)}},st.prototype.setPrivateEx=function(t,e,r,n,i,s,a,o){if(this.isPrivate=!0,this.isPublic=!1,null==t)throw"RSASetPrivateEx N == null";if(null==e)throw"RSASetPrivateEx E == null";if(0==t.length)throw"RSASetPrivateEx N.length == 0";if(0==e.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=it(t,16),this.e=parseInt(e,16),this.d=it(r,16),this.p=it(n,16),this.q=it(i,16),this.dmp1=it(s,16),this.dmq1=it(a,16),this.coeff=it(o,16)},st.prototype.generate=function(t,e){var r=new nt,n=t>>1;this.e=parseInt(e,16);for(var i=new E(e,16),s=t/2-100,a=E.ONE.shiftLeft(s);;){for(;this.p=new E(t-n,1,r),0!=this.p.subtract(E.ONE).gcd(i).compareTo(E.ONE)||!this.p.isProbablePrime(10););for(;this.q=new E(n,1,r),0!=this.q.subtract(E.ONE).gcd(i).compareTo(E.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var u=this.q.subtract(this.p).abs();if(!(u.bitLength()<s||u.compareTo(a)<=0)){var c=this.p.subtract(E.ONE),h=this.q.subtract(E.ONE),l=c.multiply(h);if(0==l.gcd(i).compareTo(E.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==t)){this.d=i.modInverse(l),this.dmp1=this.d.mod(c),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0},at.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},at.prototype.toBigInteger=function(){return this.x},at.prototype.negate=function(){return new at(this.q,this.x.negate().mod(this.q))},at.prototype.add=function(t){return new at(this.q,this.x.add(t.toBigInteger()).mod(this.q))},at.prototype.subtract=function(t){return new at(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},at.prototype.multiply=function(t){return new at(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},at.prototype.square=function(){return new at(this.q,this.x.square().mod(this.q))},at.prototype.divide=function(t){return new at(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},at.prototype.sqrt=function(){return new at(this.q,this.x.sqrt().mod(this.q))},ot.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ot.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ot.prototype.equals=function(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(E.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(E.ZERO))},ot.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(E.ZERO)&&!this.y.toBigInteger().equals(E.ZERO)},ot.prototype.negate=function(){return new ot(this.curve,this.x,this.y.negate(),this.z)},ot.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(E.ZERO.equals(r))return E.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new E("3"),i=this.x.toBigInteger(),s=this.y.toBigInteger();t.x.toBigInteger(),t.y.toBigInteger();var a=r.square(),o=a.multiply(r),u=i.multiply(a),c=e.square().multiply(this.z),h=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(o).multiply(r).mod(this.curve.q),l=u.multiply(n).multiply(e).subtract(s.multiply(o)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(o)).mod(this.curve.q),f=o.multiply(this.z).multiply(t.z).mod(this.curve.q);return new ot(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(l),f)},ot.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new E("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),s=this.curve.a.toBigInteger(),a=e.square().multiply(t);E.ZERO.equals(s)||(a=a.add(this.z.square().multiply(s)));var o=(a=a.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=a.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(a.square().multiply(a)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new ot(this.curve,this.curve.fromBigInteger(o),this.curve.fromBigInteger(u),c)},ot.prototype.multiply=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new E("3")),i=this.negate(),s=this,a=this.curve.q.subtract(t),o=a.multiply(new E("3")),u=new ot(this.curve,this.x,this.y),c=u.negate();for(e=n.bitLength()-2;e>0;--e){s=s.twice();var h=n.testBit(e);h!=r.testBit(e)&&(s=s.add(h?this:i))}for(e=o.bitLength()-2;e>0;--e){u=u.twice();var l=o.testBit(e);l!=a.testBit(e)&&(u=u.add(l?u:c))}return s},ot.prototype.multiplyTwo=function(t,e,r){var n;n=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),s=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?i=r.testBit(n)?i.add(s):i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i},ut.prototype.getQ=function(){return this.q},ut.prototype.getA=function(){return this.a},ut.prototype.getB=function(){return this.b},ut.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},ut.prototype.getInfinity=function(){return this.infinity},ut.prototype.fromBigInteger=function(t){return new at(this.q,t)},ut.prototype.decodePointHex=function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var e=t.substr(0,2);t.substr(2);var r=this.fromBigInteger(new E(o,16)),n=this.getA(),i=this.getB(),s=r.square().add(n).multiply(r).add(i).sqrt();return"03"==e&&(s=s.negate()),new ot(this,r,s);case 4:case 6:case 7:var a=(t.length-2)/2,o=t.substr(2,a),u=t.substr(a+2,a);return new ot(this,this.fromBigInteger(new E(o,16)),this.fromBigInteger(new E(u,16)));default:return null}},
21
21
  /*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
22
22
  */
23
- st.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ot.prototype.getEncoded=function(t){var e=function(t,e){var r=t.toByteArrayUnsigned();if(e<r.length)r=r.slice(r.length-e);else for(;e>r.length;)r.unshift(0);return r},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i},ot.decodeFrom=function(t,e){var r=e.length-1,n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var s=new S(n),o=new S(i);return new ot(t,t.fromBigInteger(s),t.fromBigInteger(o))},ot.decodeFromHex=function(t,e){e.substr(0,2);var r=e.length-2,n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),s=new S(n,16),o=new S(i,16);return new ot(t,t.fromBigInteger(s),t.fromBigInteger(o))},ot.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y).divide(e),n=r.square().subtract(this.x).subtract(t.x),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new ot(this.curve,n,i)},ot.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(S.valueOf(2)),e=this.curve.fromBigInteger(S.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),n=r.square().subtract(this.x.multiply(t)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new ot(this.curve,n,i)},ot.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new S("3")),i=this.negate(),s=this;for(e=n.bitLength()-2;e>0;--e){s=s.twice();var o=n.testBit(e);o!=r.testBit(e)&&(s=s.add2D(o?this:i))}return s},ot.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),s=e.multiply(e).mod(i),o=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return s.equals(o)},ot.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ot.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(S.ONE)<0||e.compareTo(t.subtract(S.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(S.ONE)<0||r.compareTo(t.subtract(S.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};
23
+ at.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ot.prototype.getEncoded=function(t){var e=function(t,e){var r=t.toByteArrayUnsigned();if(e<r.length)r=r.slice(r.length-e);else for(;e>r.length;)r.unshift(0);return r},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i},ot.decodeFrom=function(t,e){e[0];var r=e.length-1,n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var s=new E(n),a=new E(i);return new ot(t,t.fromBigInteger(s),t.fromBigInteger(a))},ot.decodeFromHex=function(t,e){e.substr(0,2);var r=e.length-2,n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),s=new E(n,16),a=new E(i,16);return new ot(t,t.fromBigInteger(s),t.fromBigInteger(a))},ot.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y).divide(e),n=r.square().subtract(this.x).subtract(t.x),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new ot(this.curve,n,i)},ot.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(E.valueOf(2)),e=this.curve.fromBigInteger(E.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),n=r.square().subtract(this.x.multiply(t)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new ot(this.curve,n,i)},ot.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new E("3")),i=this.negate(),s=this;for(e=n.bitLength()-2;e>0;--e){s=s.twice();var a=n.testBit(e);a!=r.testBit(e)&&(s=s.add2D(a?this:i))}return s},ot.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),s=e.multiply(e).mod(i),a=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return s.equals(a)},ot.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ot.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(E.ONE)<0||e.compareTo(t.subtract(E.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(E.ONE)<0||r.compareTo(t.subtract(E.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};
24
24
  /*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
25
25
  */
26
- var ut=function(){var t=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),e=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),r={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function n(t,e,n){return e?r[e]:String.fromCharCode(parseInt(n,16))}var i=new String(""),s=Object.hasOwnProperty;return function(r,o){var a,u,c=r.match(t),h=c[0],l=!1;"{"===h?a={}:"["===h?a=[]:(a=[],l=!0);for(var f=[a],p=1-l,g=c.length;p<g;++p){var d;switch((h=c[p]).charCodeAt(0)){default:(d=f[0])[u||d.length]=+h,u=void 0;break;case 34:if(-1!==(h=h.substring(1,h.length-1)).indexOf("\\")&&(h=h.replace(e,n)),d=f[0],!u){if(!(d instanceof Array)){u=h||i;break}u=d.length}d[u]=h,u=void 0;break;case 91:d=f[0],f.unshift(d[u||d.length]=[]),u=void 0;break;case 93:case 125:f.shift();break;case 102:(d=f[0])[u||d.length]=!1,u=void 0;break;case 110:(d=f[0])[u||d.length]=null,u=void 0;break;case 116:(d=f[0])[u||d.length]=!0,u=void 0;break;case 123:d=f[0],f.unshift(d[u||d.length]={}),u=void 0}}if(l){if(1!==f.length)throw new Error;a=a[0]}else if(f.length)throw new Error;if(o){var v=function(t,e){var r=t[e];if(r&&"object"==typeof r){var n=null;for(var i in r)if(s.call(r,i)&&r!==t){var a=v(r,i);void 0!==a?r[i]=a:(n||(n=[]),n.push(i))}if(n)for(var u=n.length;--u>=0;)delete r[n[u]]}return o.call(t,e,r)};a=v({"":a},"")}return a}}();void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),ct.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){return Kt(t)},this.getPEMStringFromHex=function(t,e){return Ft(t,e)},this.newObject=function(t){var e=ct.asn1,r=e.ASN1Object,n=e.DERBoolean,i=e.DERInteger,s=e.DERBitString,o=e.DEROctetString,a=e.DERNull,u=e.DERObjectIdentifier,c=e.DEREnumerated,h=e.DERUTF8String,l=e.DERNumericString,f=e.DERPrintableString,p=e.DERTeletexString,g=e.DERIA5String,d=e.DERUTCTime,v=e.DERGeneralizedTime,m=e.DERVisibleString,y=e.DERBMPString,x=e.DERSequence,w=e.DERSet,S=e.DERTaggedObject,E=e.ASN1Util.newObject;if(t instanceof e.ASN1Object)return t;var b=Object.keys(t);if(1!=b.length)throw new Error("key of param shall be only one.");var F=b[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+F+":"))throw new Error("undefined key: "+F);if("bool"==F)return new n(t[F]);if("int"==F)return new i(t[F]);if("bitstr"==F)return new s(t[F]);if("octstr"==F)return new o(t[F]);if("null"==F)return new a(t[F]);if("oid"==F)return new u(t[F]);if("enum"==F)return new c(t[F]);if("utf8str"==F)return new h(t[F]);if("numstr"==F)return new l(t[F]);if("prnstr"==F)return new f(t[F]);if("telstr"==F)return new p(t[F]);if("ia5str"==F)return new g(t[F]);if("utctime"==F)return new d(t[F]);if("gentime"==F)return new v(t[F]);if("visstr"==F)return new m(t[F]);if("bmpstr"==F)return new y(t[F]);if("asn1"==F)return new r(t[F]);if("seq"==F){for(var A=t[F],C=[],D=0;D<A.length;D++){var P=E(A[D]);C.push(P)}return new x({array:C})}if("set"==F){for(A=t[F],C=[],D=0;D<A.length;D++){P=E(A[D]);C.push(P)}return new w({array:C})}if("tag"==F){var I=t[F];if("[object Array]"===Object.prototype.toString.call(I)&&3==I.length){var T=E(I[2]);return new S({tag:I[0],explicit:I[1],obj:T})}return new S(I)}},this.jsonToASN1HEX=function(t){return this.newObject(t).tohex()}},ct.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var s=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);if(n+=s.substr(1,7),"0"==s.substr(0,1))e=e+"."+new S(n,2).toString(10),n=""}return e},ct.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new S(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var s="",o=0;o<i;o++)s+="0";n=s+n;for(o=0;o<n.length-1;o+=7){var a=n.substr(o,7);o!=n.length-7&&(a="1"+a),r+=e(parseInt(a,2))}return r};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),s=40*parseInt(i[0])+parseInt(i[1]);n+=e(s),i.splice(0,2);for(var o=0;o<i.length;o++)n+=r(i[o]);return n},ct.asn1.ASN1Object=function(t){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n=0,v="+this.hV);var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var r=e.length/2;if(r>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+t.toString(16));return(128+r).toString(16)+e},this.tohex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},ct.asn1.DERAbstractString=function(t){ct.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=xt(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},Gt(ct.asn1.DERAbstractString,ct.asn1.ASN1Object),ct.asn1.DERAbstractTime=function(t){ct.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){var e=t.getTime()+6e4*t.getTimezoneOffset();return new Date(e)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),s=String(i.getFullYear());"utc"==e&&(s=s.substr(2,2));var o=s+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var a=i.getMilliseconds();if(0!=a){var u=n(String(a),3);o=o+"."+(u=u.replace(/[0]+$/,""))}}return o+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.setByParam=function(t){this.hV=null,this.hTLV=null,this.params=t},this.getString=function(){},this.setString=function(t){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.str=t},this.setByDate=function(t){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.date=t},this.setByDateValue=function(t,e,r,n,i,s){var o=new Date(Date.UTC(t,e-1,r,n,i,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},Gt(ct.asn1.DERAbstractTime,ct.asn1.ASN1Object),ct.asn1.DERAbstractStructured=function(t){ct.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},Gt(ct.asn1.DERAbstractStructured,ct.asn1.ASN1Object),ct.asn1.DERBoolean=function(t){ct.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==t?"010100":"0101ff"},Gt(ct.asn1.DERBoolean,ct.asn1.ASN1Object),ct.asn1.DERInteger=function(t){ct.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var e=Kt;this.setByBigInteger=function(t){this.isModified=!0,this.params={bigint:t}},this.setByInteger=function(t){this.isModified=!0,this.params=t},this.setValueHex=function(t){this.isModified=!0,this.params={hex:t}},this.getFreshValueHex=function(){var t=this.params,r=null;if(null==t)throw new Error("value not set");if("object"==typeof t&&null!=t.hex)return this.hV=t.hex,this.hV;if("number"==typeof t)r=new S(String(t),10);else if(null!=t.int)r=new S(String(t.int),10);else{if(null==t.bigint)throw new Error("wrong parameter");r=t.bigint}return this.hV=e(r),this.hV},null!=t&&(this.params=t)},Gt(ct.asn1.DERInteger,ct.asn1.ASN1Object),ct.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ct.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.tohex()}ct.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0),t+="0000000".substr(0,e);for(var r="",n=0;n<t.length-1;n+=8){var i=t.substr(n,8),s=parseInt(i,2).toString(16);1==s.length&&(s="0"+s),r+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",r=0;r<t.length;r++)1==t[r]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},Gt(ct.asn1.DERBitString,ct.asn1.ASN1Object),ct.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ct.asn1.ASN1Util.newObject(t.obj);t.hex=e.tohex()}ct.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},Gt(ct.asn1.DEROctetString,ct.asn1.DERAbstractString),ct.asn1.DERNull=function(){ct.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Gt(ct.asn1.DERNull,ct.asn1.ASN1Object),ct.asn1.DERObjectIdentifier=function(t){ct.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var e=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=parseInt(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var s="",o=0;o<i;o++)s+="0";n=s+n;for(o=0;o<n.length-1;o+=7){var a=n.substr(o,7);o!=n.length-7&&(a="1"+a),r+=e(parseInt(a,2))}return r};try{if(!t.match(/^[0-9.]+$/))return null;var n="",i=t.split("."),s=40*parseInt(i[0],10)+parseInt(i[1],10);n+=e(s),i.splice(0,2);for(var o=0;o<i.length;o++)n+=r(i[o]);return n}catch(t){return null}}(t);if(null==e)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){var e=ct.asn1.x509.OID.name2oid(t);if(""===e)throw new Error("DERObjectIdentifier oidName undefined: "+t);this.setValueOidString(e)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){"string"==typeof t?this.setValueNameOrOid(t):void 0!==t.oid?this.setValueNameOrOid(t.oid):void 0!==t.name?this.setValueNameOrOid(t.name):void 0!==t.hex&&this.setValueHex(t.hex)},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.DERObjectIdentifier,ct.asn1.ASN1Object),ct.asn1.DEREnumerated=function(t){ct.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Kt(t)},this.setByInteger=function(t){var e=new S(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Gt(ct.asn1.DEREnumerated,ct.asn1.ASN1Object),ct.asn1.DERUTF8String=function(t){ct.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},Gt(ct.asn1.DERUTF8String,ct.asn1.DERAbstractString),ct.asn1.DERNumericString=function(t){ct.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},Gt(ct.asn1.DERNumericString,ct.asn1.DERAbstractString),ct.asn1.DERPrintableString=function(t){ct.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},Gt(ct.asn1.DERPrintableString,ct.asn1.DERAbstractString),ct.asn1.DERTeletexString=function(t){ct.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},Gt(ct.asn1.DERTeletexString,ct.asn1.DERAbstractString),ct.asn1.DERIA5String=function(t){ct.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},Gt(ct.asn1.DERIA5String,ct.asn1.DERAbstractString),ct.asn1.DERVisibleString=function(t){ct.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="1a"},Gt(ct.asn1.DERVisibleString,ct.asn1.DERAbstractString),ct.asn1.DERBMPString=function(t){ct.asn1.DERBMPString.superclass.constructor.call(this,t),this.hT="1e"},Gt(ct.asn1.DERBMPString,ct.asn1.DERAbstractString),ct.asn1.DERUTCTime=function(t){ct.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.params=void 0,this.getFreshValueHex=function(){var t=this.params;if(null==this.params&&(t={date:new Date}),"string"==typeof t){if(!t.match(/^[0-9]{12}Z$/)&&!t.match(/^[0-9]{12}\.[0-9]+Z$/))throw new Error("malformed string for UTCTime: "+t);this.hV=gt(t)}else if(null!=t.str)this.hV=gt(t.str);else if(null==t.date&&1==t.millis){var e=new Date;this.hV=gt(this.formatDate(e,"utc",!0))}else if(null!=t.date&&t.date instanceof Date){var r=!0===t.millis;this.hV=gt(this.formatDate(t.date,"utc",r))}else t instanceof Date&&(this.hV=gt(this.formatDate(t,"utc")));if(null==this.hV)throw new Error("parameter not specified properly for UTCTime");return this.hV},null!=t&&this.setByParam(t)},Gt(ct.asn1.DERUTCTime,ct.asn1.DERAbstractTime),ct.asn1.DERGeneralizedTime=function(t){ct.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.params=t,this.getFreshValueHex=function(){var t=this.params;if(null==this.params&&(t={date:new Date}),"string"==typeof t){if(!t.match(/^[0-9]{14}Z$/)&&!t.match(/^[0-9]{14}\.[0-9]+Z$/))throw new Error("malformed string for GeneralizedTime: "+t);this.hV=gt(t)}else if(null!=t.str)this.hV=gt(t.str);else if(null==t.date&&1==t.millis){var e=new Date;this.hV=gt(this.formatDate(e,"gen",!0))}else if(null!=t.date&&t.date instanceof Date){var r=!0===t.millis;this.hV=gt(this.formatDate(t.date,"gen",r))}else t instanceof Date&&(this.hV=gt(this.formatDate(t,"gen")));if(null==this.hV)throw new Error("parameter not specified properly for GeneralizedTime");return this.hV},null!=t&&this.setByParam(t)},Gt(ct.asn1.DERGeneralizedTime,ct.asn1.DERAbstractTime),ct.asn1.DERSequence=function(t){ct.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){t+=this.asn1Array[e].tohex()}return this.hV=t,this.hV}},Gt(ct.asn1.DERSequence,ct.asn1.DERAbstractStructured),ct.asn1.DERSet=function(t){ct.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.tohex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},Gt(ct.asn1.DERSet,ct.asn1.DERAbstractStructured),ct.asn1.DERTaggedObject=function(t){ct.asn1.DERTaggedObject.superclass.constructor.call(this);var e=ct.asn1,r=ft.getV,n=e.ASN1Util.newObject;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(t,e,r){this.params={tag:e,explicit:t,obj:r}},this.getFreshValueHex=function(){var t=this.params;if(null==t.explicit&&(t.explicit=!0),null!=t.tage&&(t.tag=t.tage,t.explicit=!0),null!=t.tagi&&(t.tag=t.tagi,t.explicit=!1),null!=t.str)this.hV=xt(t.str);else if(null!=t.hex)this.hV=t.hex;else{if(null==t.obj)throw new Error("str, hex nor obj not specified");var i;t.obj instanceof e.ASN1Object?i=t.obj.tohex():"object"==typeof t.obj&&(i=n(t.obj).tohex()),t.explicit?this.hV=i:this.hV=r(i,0)}return null==t.tag&&(t.tag="a0"),this.hT=t.tag,this.hTLV=null,this.isModified=!0,this.hV},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.DERTaggedObject,ct.asn1.ASN1Object);var ct,ht,lt,ft=new function(){};function pt(t){for(var e="",r=0;r<t.length;r++){var n=t[r].toString(16);1==n.length&&(n="0"+n),e+=n}return e}function gt(t){return pt(function(t){for(var e=new Array,r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}(t))}function dt(t){return t=(t=(t=t.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function vt(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),t=(t=t.replace(/-/g,"+")).replace(/_/g,"/")}function mt(t){return t.length%2==1&&(t="0"+t),dt(x(t))}function yt(t){return w(vt(t))}function xt(t){return Dt(jt(t)).toLowerCase()}function wt(t){try{return decodeURIComponent(Pt(t))}catch(t){return null}}function St(t){return wt(function(t){for(var e=t.match(/.{1,2}/g),r=[],n=0;n<e.length;n++){var i=parseInt(e[n],16);161<=i&&i<=191?(r.push("c2"),r.push(e[n])):192<=i&&i<=255?(r.push("c3"),r.push((i-64).toString(16))):r.push(e[n])}return r.join("")}(t))}function Et(t){for(var e="",r=0;r<t.length-1;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e}function bt(t){for(var e="",r=0;r<t.length;r++)e+=("0"+t.charCodeAt(r).toString(16)).slice(-2);return e}function Ft(t,e){return"-----BEGIN "+e+"-----\r\n"+function(t,e){return(t=t.replace(new RegExp("(.{"+e+"})","g"),"$1\r\n")).replace(/\s+$/,"")}(function(t){return x(t)}(t),64)+"\r\n-----END "+e+"-----\r\n"}function At(t,e){if(-1==t.indexOf("-----BEGIN "))throw new Error("can't find PEM header");return function(t){return w(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}(t=void 0!==e?(t=t.replace(new RegExp("^[^]*-----BEGIN "+e+"-----"),"")).replace(new RegExp("-----END "+e+"-----[^]*$"),""):(t=t.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Ct(t){return Math.round(function(t){var e,r,n,i,s,o,a,u,c,h;if(t=function(t){return t.match(/^[0-9]{12}Z$/)||t.match(/^[0-9]{12}[.][0-9]*Z$/)?t.match(/^[0-4]/)?"20"+t:"19"+t:t}(t),h=t.match(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return e=parseInt(h[1]),r=parseInt(h[2])-1,n=parseInt(h[3]),i=parseInt(h[4]),s=parseInt(h[5]),o=parseInt(h[6]),a=0,""!==(u=h[7])&&(c=(u.substr(1)+"00").substr(0,3),a=parseInt(c)),Date.UTC(e,r,n,i,s,o,a);throw new Error("unsupported zulu format: "+t)}(t)/1e3)}function Dt(t){return t.replace(/%/g,"")}function Pt(t){return t.replace(/(..)/g,"%$1")}function It(t){var e="malformed IPv6 address";if(!t.match(/^[0-9A-Fa-f:]+$/))throw e;var r=(t=t.toLowerCase()).split(":").length-1;if(r<2)throw e;var n=":".repeat(7-r+2),i=(t=t.replace("::",n)).split(":");if(8!=i.length)throw e;for(var s=0;s<8;s++)i[s]=("0000"+i[s]).slice(-4);return i.join("")}function Tt(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw new Error("malformed IPv6 address: "+t);var e=(t=t.toLowerCase()).match(/.{1,4}/g);e=e.map(function(t){return t.replace(/^0+/,"")}),e=e.map(function(t){return""==t?"0":t});var r=(t=":"+e.join(":")+":").match(/:(0:){2,}/g);if(null==r)return t.slice(1,-1);var n=r.sort().slice(-1)[0];return"::"!=(t=t.replace(n.substr(0,n.length-1),":")).substr(0,2)&&(t=t.substr(1)),"::"!=t.substr(-2,2)&&(t=t.substr(0,t.length-1)),t}function Rt(t){var e=new Error("malformed hex value");if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8==t.length){try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}}else{if(16!=t.length){if(32==t.length)return Tt(t);if(64==t.length){try{return Tt(t.substr(0,32))+"/"+Nt(t.substr(32))}catch(t){throw e}return}return t}try{return Rt(t.substr(0,8))+"/"+Nt(t.substr(8))}catch(t){throw e}}}function Nt(t){var e,r=new Error("malformed mask");try{e=new S(t,16).toString(2)}catch(t){throw r}if(!e.match(/^1*0*$/))throw r;return e.replace(/0+$/,"").length}function _t(t){var e=new Error("malformed IP address");if(!(t=t.toLowerCase(t)).match(/^[0-9a-f.:/]+$/))throw e;if(!t.match(/^[0-9.]+$/)){var r;if(t.match(/^[0-9.]+\/[0-9]+$/))return _t((r=t.split("/"))[0])+Ot(parseInt(r[1]),32);if(t.match(/^[0-9a-f:]+$/)&&-1!==t.indexOf(":"))return It(t);if(t.match(/^[0-9a-f:]+\/[0-9]+$/)&&-1!==t.indexOf(":"))return It((r=t.split("/"))[0])+Ot(parseInt(r[1]),128);throw e}var n=t.split(".");if(4!==n.length)throw e;var i="";try{for(var s=0;s<4;s++){i+=("0"+parseInt(n[s]).toString(16)).slice(-2)}return i}catch(t){throw e}}function Ot(t,e){return 32==e&&0==t?"00000000":128==e&&0==t?"00000000000000000000000000000000":new S(Array(t+1).join("1")+Array(e-t+1).join("0"),2).toString(16)}function Bt(t){var e=t.match(/.{4}/g).map(function(t){var e=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2),16);if(0==e&r<128)return String.fromCharCode(r);if(e<8){var n=128|63&r;return wt((192|(7&e)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&r)>>6;var i=128|63&r;return wt((224|(240&e)>>4).toString(16)+n.toString(16)+i.toString(16))});return e.join("")}function jt(t){for(var e=encodeURIComponent(t),r="",n=0;n<e.length;n++)"%"==e[n]?(r+=e.substr(n,3),n+=2):r=r+"%"+gt(e[n]);return r}function Ht(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))}function kt(t){return!!t.match(/^[0-9A-Za-z-_.]+$/)}function Lt(t){return t.length%2==1?"0"+t:t.substr(0,1)>"7"?"00"+t:t}function Vt(t,e){if("string"!=typeof t||"string"!=typeof e)throw new Error("arguments shall be string");if(t.length!==e.length)throw new Error("input strings must have the same length");if("function"==typeof Buffer&&void 0!==X){if(void 0!==X.timingSafeEqual)return X.timingSafeEqual(Buffer.from(t),Buffer.from(e));if(void 0!==X.subtle&&X.subtle.timingSafeEqual)return X.subtle.timingSafeEqual(Buffer.from(t),Buffer.from(e))}return function(t,e){if("string"!=typeof t||"string"!=typeof e)throw new Error("arguments shall be string");if(t.length!==e.length)throw new Error("input strings must have the same length");const r=e.slice();for(var n=0,i=0;i<t.length;i++)n|=t.charCodeAt(i)^r.charCodeAt(i);return 0===n}(t,e)}function Mt(t){if(!Ht(t))return null;try{var e=[],r=t.substr(0,2),n=parseInt(r,16);e[0]=new String(Math.floor(n/40)),e[1]=new String(n%40);for(var i=t.substr(2),s=[],o=0;o<i.length/2;o++)s.push(parseInt(i.substr(2*o,2),16));var a=[],u="";for(o=0;o<s.length;o++)128&s[o]?u+=Ut((127&s[o]).toString(2),7):(u+=Ut((127&s[o]).toString(2),7),a.push(new String(parseInt(u,2))),u="");var c=e.join(".");return a.length>0&&(c=c+"."+a.join(".")),c}catch(t){return null}}function qt(t){return Kt(new S(String(t),10))}function Kt(t){var e=t.toString(16);if("-"!=e.substr(0,1))return e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e),e;var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";return e=new S(n,16).xor(t).add(S.ONE).toString(16).replace(/^-/,"")}ft.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0<r&&r<10?r+1:-2},ft.getL=function(t,e){var r=ft.getLblen(t,e);return r<1?"":t.substr(e+2,2*r)},ft.getVblen=function(t,e){var r;return""==(r=ft.getL(t,e))?-1:("8"===r.substr(0,1)?new S(r.substr(2),16):new S(r,16)).intValue()},ft.getVidx=function(t,e){var r=ft.getLblen(t,e);return r<0?r:e+2*(r+1)},ft.getV=function(t,e){var r=ft.getVidx(t,e),n=ft.getVblen(t,e);return t.substr(r,2*n)},ft.getTLV=function(t,e){return t.substr(e,2)+ft.getL(t,e)+ft.getV(t,e)},ft.getTLVblen=function(t,e){return 2+2*ft.getLblen(t,e)+2*ft.getVblen(t,e)},ft.getNextSiblingIdx=function(t,e){return ft.getVidx(t,e)+2*ft.getVblen(t,e)},ft.getChildIdx=function(t,e){var r,n,i,s=ft,o=[];if((r=s.getVidx(t,e))+(n=2*s.getVblen(t,e))>t.length)throw new Error("too short ASN.1 value");"03"==t.substr(e,2)&&(r+=2,n-=2),i=0;for(var a=r;i<=n;){var u=s.getTLVblen(t,a);if(u<=0)throw new Error("malformed ASN.1: invalid TLV length");if((i+=u)<=n&&o.push(a),a+=u,i>=n)break}return o},ft.getNthChildIdx=function(t,e,r){return ft.getChildIdx(t,e)[r]},ft.getIdxbyList=function(t,e,r,n){var i,s,o=ft;return 0==r.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(i=r.shift())>=(s=o.getChildIdx(t,e)).length?-1:o.getIdxbyList(t,s[i],r,n)},ft.getIdxbyListEx=function(t,e,r,n){var i,s,o=ft;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),s=o.getChildIdx(t,e);for(var a=0,u=0;u<s.length;u++){var c=t.substr(s[u],2);if("number"==typeof i&&!o.isContextTag(c)&&a==i||"string"==typeof i&&o.isContextTag(c,i))return o.getIdxbyListEx(t,s[u],r,n);o.isContextTag(c)||a++}return-1},ft.getTLVbyList=function(t,e,r,n){var i=ft,s=i.getIdxbyList(t,e,r,n);return-1==s||s>=t.length?null:i.getTLV(t,s)},ft.getTLVbyListEx=function(t,e,r,n){var i=ft,s=i.getIdxbyListEx(t,e,r,n);return-1==s?null:i.getTLV(t,s)},ft.getVbyList=function(t,e,r,n,i){var s,o,a=ft;return-1==(s=a.getIdxbyList(t,e,r,n))||s>=t.length?null:(o=a.getV(t,s),!0===i&&(o=o.substr(2)),o)},ft.getVbyListEx=function(t,e,r,n,i){var s,o,a=ft;return-1==(s=a.getIdxbyListEx(t,e,r,n))?null:(o=a.getV(t,s),"03"==t.substr(s,2)&&!1!==i&&(o=o.substr(2)),o)},ft.getInt=function(t,e,r){null==r&&(r=-1);try{var n=t.substr(e,2);if("02"!=n&&"03"!=n)return r;var i=ft.getV(t,e);return"02"==n?parseInt(i,16):function(t){if(t.length%2!=0)return-1;if(t=t.toLowerCase(),null==t.match(/^[0-9a-f]+$/))return-1;try{var e=t.substr(0,2);if("00"==e)return parseInt(t.substr(2),16);var r=parseInt(e,16);if(r>7)return-1;var n=t.substr(2),i=parseInt(n,16).toString(2);"0"==i&&(i="00000000"),i=i.slice(0,0-r);var s=parseInt(i,2);return NaN==s?-1:s}catch(t){return-1}}(i)}catch(t){return r}},ft.getOID=function(t,e,r){null==r&&(r=null);try{return"06"!=t.substr(e,2)?r:Mt(ft.getV(t,e))}catch(t){return r}},ft.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=ft.getOID(t,e,r);if(n==r)return r;var i=ct.asn1.x509.OID.oid2name(n);return""==i?n:i}catch(t){return r}},ft.getString=function(t,e,r){null==r&&(r=null);try{return Et(ft.getV(t,e))}catch(t){return r}},ft.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var s=t.substr(2),o=[],a=0;a<s.length/2;a++)o.push(parseInt(s.substr(2*a,2),16));var u=[],c="";for(a=0;a<o.length;a++)128&o[a]?c+=e((127&o[a]).toString(2),7):(c+=e((127&o[a]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var h=r.join(".");return u.length>0&&(h=h+"."+u.join(".")),h},ft.dump=function(t,e,r,n){var i=ft,s=i.getV,o=i.dump,a=i.getChildIdx,u=t;t instanceof ct.asn1.ASN1Object&&(u=t.tohex());var c=function(t,e){return t.length<=2*e?t:t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e)};void 0===e&&(e={ommit_long_octet:32}),void 0===r&&(r=0),void 0===n&&(n="");var h,l=e.ommit_long_octet;if("01"==(h=u.substr(r,2)))return"00"==(f=s(u,r))?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n";if("02"==h)return n+"INTEGER "+c(f=s(u,r),l)+"\n";if("03"==h){var f=s(u,r);if(i.isASN1HEX(f.substr(2))){var p=n+"BITSTRING, encapsulates\n";return p+=o(f.substr(2),e,0,n+" ")}return n+"BITSTRING "+c(f,l)+"\n"}if("04"==h){f=s(u,r);if(i.isASN1HEX(f)){p=n+"OCTETSTRING, encapsulates\n";return p+=o(f,e,0,n+" ")}return n+"OCTETSTRING "+c(f,l)+"\n"}if("05"==h)return n+"NULL\n";if("06"==h){var g=s(u,r),d=ct.asn1.ASN1Util.oidHexToInt(g),v=ct.asn1.x509.OID.oid2name(d),m=d.replace(/\./g," ");return""!=v?n+"ObjectIdentifier "+v+" ("+m+")\n":n+"ObjectIdentifier ("+m+")\n"}if("0a"==h)return n+"ENUMERATED "+parseInt(s(u,r))+"\n";if("0c"==h)return n+"UTF8String '"+wt(s(u,r))+"'\n";if("13"==h)return n+"PrintableString '"+wt(s(u,r))+"'\n";if("14"==h)return n+"TeletexString '"+wt(s(u,r))+"'\n";if("16"==h)return n+"IA5String '"+wt(s(u,r))+"'\n";if("17"==h)return n+"UTCTime "+wt(s(u,r))+"\n";if("18"==h)return n+"GeneralizedTime "+wt(s(u,r))+"\n";if("1a"==h)return n+"VisualString '"+wt(s(u,r))+"'\n";if("1e"==h)return n+"BMPString '"+Bt(s(u,r))+"'\n";if("30"==h){if("3000"==u.substr(r,4))return n+"SEQUENCE {}\n";p=n+"SEQUENCE\n";var y=e;if((2==(S=a(u,r)).length||3==S.length)&&"06"==u.substr(S[0],2)&&"04"==u.substr(S[S.length-1],2)){v=i.oidname(s(u,S[0]));var x=JSON.parse(JSON.stringify(e));x.x509ExtName=v,y=x}for(var w=0;w<S.length;w++)p+=o(u,y,S[w],n+" ");return p}if("31"==h){p=n+"SET\n";var S=a(u,r);for(w=0;w<S.length;w++)p+=o(u,e,S[w],n+" ");return p}if(128&(h=parseInt(h,16))){var E=31&h;if(32&h){for(p=n+"["+E+"]\n",S=a(u,r),w=0;w<S.length;w++)p+=o(u,e,S[w],n+" ");return p}f=s(u,r);if(ft.isASN1HEX(f)){var p=n+"["+E+"]\n";return p+=o(f,e,0,n+" ")}return("68747470"==f.substr(0,8)||"subjectAltName"===e.x509ExtName&&2==E)&&(f=wt(f)),p=n+"["+E+"] "+f+"\n"}return n+"UNKNOWN("+h+") "+s(u,r)+"\n"},ft.parse=function(t){var e=ft,r=e.parse,n=e.isASN1HEX,i=e.getV,s=e.getTLV,o=e.getChildIdx,a=ct.asn1,u=a.ASN1Util.oidHexToInt,c=a.x509.OID.oid2name,h=wt,l=Bt,f=St,p={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},g=t.substr(0,2),d={},v=i(t,0);if("01"==g)return"0101ff"==t?{bool:!0}:{bool:!1};if("02"==g)return{int:{hex:v}};if("03"==g)try{if("00"!=v.substr(0,2))throw"not encap";var m=v.substr(2);if(!n(m))throw"not encap";return{bitstr:{obj:r(m)}}}catch(t){var y=null;return v.length<=10&&(y=function(t){if("string"!=typeof t)return null;if(t.length%2!=0)return null;if(!t.match(/^[0-9a-f]+$/))return null;try{var e=parseInt(t.substr(0,2),16);if(e<0||7<e)return null;for(var r=t.substr(2),n="",i=0;i<r.length;i+=2){var s=r.substr(i,2),o=parseInt(s,16).toString(2);n+=o=("0000000"+o).slice(-8)}return n.substr(0,n.length-e)}catch(t){return null}}(v)),null==y?{bitstr:{hex:v}}:{bitstr:{bin:y}}}else if("04"==g)try{if(!n(v))throw"not encap";return{octstr:{obj:r(v)}}}catch(t){return{octstr:{hex:v}}}else{if("05"==g)return{null:""};if("06"==g){var x=u(v),w=c(x);return""==w?{oid:x}:{oid:w}}if("0a"==g)return v.length>4?{enum:{hex:v}}:{enum:parseInt(v,16)};if("30"==g||"31"==g)return d[p[g]]=function(t){for(var e=[],n=o(t,0),i=0;i<n.length;i++){var a=n[i],u=s(t,a),c=r(u);e.push(c)}return e}(t),d;if("14"==g){var S=f(v);return d[p[g]]={str:S},d}if("1e"==g){S=l(v);return d[p[g]]={str:S},d}if(-1!=":0c:12:13:16:17:18:1a:".indexOf(g)){S=h(v);return d[p[g]]={str:S},d}if(g.match(/^8[0-9]$/))return null==(S=h(v))|""==S||null!=S.match(/[\x00-\x1F\x7F-\x9F]/)||null!=S.match(/[\u0000-\u001F\u0080–\u009F]/)?{tag:{tag:g,explicit:!1,hex:v}}:{tag:{tag:g,explicit:!1,str:S}};if(!g.match(/^a[0-9]$/)){var E=new ct.asn1.ASN1Object;return E.hV=v,{asn1:{tlv:g+E.getLengthHexFromValue()+v}}}try{if(!n(v))throw new Error("not encap");return{tag:{tag:g,explicit:!0,obj:r(v)}}}catch(t){return{tag:{tag:g,explicit:!0,hex:v}}}}},ft.isContextTag=function(t,e){var r,n;t=t.toLowerCase();try{r=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&r);try{return null!=e.match(/^\[[0-9]+\]$/)&&(!((n=parseInt(e.substr(1,e.length-1),10))>31)&&(128==(192&r)&&(31&r)==n))}catch(t){return!1}},ft.isASN1HEX=function(t){var e=ft;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0);return t.length-n.length-i.length==2*r},ft.checkStrictDER=function(t,e,r,n,i){var s=ft;if(void 0===r){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!ct.lang.String.isHex(t))throw new Error("not hex string");r=t.length,i=(n=t.length/2)<128?1:Math.ceil(n.toString(16))+1}if(s.getL(t,e).length>2*i)throw new Error("L of TLV too long: idx="+e);var o=s.getVblen(t,e);if(o>n)throw new Error("value of L too long than hex: idx="+e);var a=s.getTLV(t,e),u=a.length-2-s.getL(t,e).length;if(u!==2*o)throw new Error("V string length and L's value not the same:"+u+"/"+2*o);if(0===e&&t.length!=a.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+a.length);var c=t.substr(e,2);if("02"===c){var h=s.getVidx(t,e);if("00"==t.substr(h,2)&&t.charCodeAt(h+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var l=s.getVblen(t,e),f=0,p=s.getChildIdx(t,e),g=0;g<p.length;g++){f+=s.getTLV(t,p[g]).length,s.checkStrictDER(t,p[g],r,n,i)}if(2*l!=f)throw new Error("sum of children's TLV length and L unmatch: "+2*l+"!="+f)}},ft.oidname=function(t){var e=ct.asn1;ct.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var r=e.x509.OID.oid2name(t);return""===r&&(r=t),r},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.x509&&ct.asn1.x509||(ct.asn1.x509={}),ct.asn1.x509.Certificate=function(t){ct.asn1.x509.Certificate.superclass.constructor.call(this);var e=ct.asn1,r=e.DERBitString,n=e.DERSequence,i=e.x509,s=i.TBSCertificate,o=i.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=this.params,e=t.sigalg;null!=t.sigalg.name&&(e=t.sigalg.name);var r=t.tbsobj.tohex(),n=new ct.crypto.Signature({alg:e});n.init(t.cakey),n.updateHex(r),t.sighex=n.sign()},this.getPEM=function(){return Ft(this.tohex(),"CERTIFICATE")},this.tohex=function(){var t=this.params;if(null!=t.tbsobj&&null!=t.tbsobj||(t.tbsobj=new s(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new o({name:t.sigalg})),e.push(new r({hex:"00"+t.sighex})),new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&(this.params=t)},Gt(ct.asn1.x509.Certificate,ct.asn1.ASN1Object),ct.asn1.x509.TBSCertificate=function(t){ct.asn1.x509.TBSCertificate.superclass.constructor.call(this);var e=ct.asn1,r=e.x509,n=e.DERTaggedObject,i=e.DERInteger,s=e.DERSequence,o=r.AlgorithmIdentifier,a=r.Time,u=r.X500Name,c=r.Extensions,h=r.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=[],e=this.params;if(null!=e.version||1!=e.version){var r=2;null!=e.version&&(r=e.version-1);var l=new n({obj:new i({int:r})});t.push(l)}return t.push(new i(e.serial)),t.push(new o({name:e.sigalg})),t.push(new u(e.issuer)),t.push(new s({array:[new a(e.notbefore),new a(e.notafter)]})),t.push(new u(e.subject)),t.push(new h($t.getKey(e.sbjpubkey))),void 0!==e.ext&&e.ext.length>0&&t.push(new n({tag:"a3",obj:new c(e.ext)})),new ct.asn1.DERSequence({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.x509.TBSCertificate,ct.asn1.ASN1Object),ct.asn1.x509.Extensions=function(t){ct.asn1.x509.Extensions.superclass.constructor.call(this);var e=ct.asn1,r=e.DERSequence,n=e.x509;this.aParam=[],this.setByParam=function(t){this.aParam=t},this.tohex=function(){for(var t=[],e=0;e<this.aParam.length;e++){var i=this.aParam[e],s=i.extname,o=null;if(null!=i.extn)o=new n.PrivateExtension(i);else if("subjectKeyIdentifier"==s)o=new n.SubjectKeyIdentifier(i);else if("keyUsage"==s)o=new n.KeyUsage(i);else if("subjectAltName"==s)o=new n.SubjectAltName(i);else if("issuerAltName"==s)o=new n.IssuerAltName(i);else if("basicConstraints"==s)o=new n.BasicConstraints(i);else if("nameConstraints"==s)o=new n.NameConstraints(i);else if("cRLDistributionPoints"==s)o=new n.CRLDistributionPoints(i);else if("certificatePolicies"==s)o=new n.CertificatePolicies(i);else if("policyMappings"==s)o=new n.PolicyMappings(i);else if("policyConstraints"==s)o=new n.PolicyConstraints(i);else if("inhibitAnyPolicy"==s)o=new n.InhibitAnyPolicy(i);else if("authorityKeyIdentifier"==s)o=new n.AuthorityKeyIdentifier(i);else if("extKeyUsage"==s)o=new n.ExtKeyUsage(i);else if("authorityInfoAccess"==s)o=new n.AuthorityInfoAccess(i);else if("cRLNumber"==s)o=new n.CRLNumber(i);else if("cRLReason"==s)o=new n.CRLReason(i);else if("ocspNonce"==s)o=new n.OCSPNonce(i);else if("ocspNoCheck"==s)o=new n.OCSPNoCheck(i);else if("adobeTimeStamp"==s)o=new n.AdobeTimeStamp(i);else{if("subjectDirectoryAttributes"!=s)throw new Error("extension not supported:"+JSON.stringify(i));o=new n.SubjectDirectoryAttributes(i)}null!=o&&t.push(o)}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.x509.Extensions,ct.asn1.ASN1Object),ct.asn1.x509.Extension=function(t){ct.asn1.x509.Extension.superclass.constructor.call(this);var e=ct.asn1,r=e.DERObjectIdentifier,n=e.DEROctetString,i=e.DERBoolean,s=e.DERSequence;this.tohex=function(){var t=new r({oid:this.oid}),e=new n({hex:this.getExtnValueHex()}),o=new Array;return o.push(t),this.critical&&o.push(new i),o.push(e),new s({array:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,void 0!==t&&void 0!==t.critical&&(this.critical=t.critical)},Gt(ct.asn1.x509.Extension,ct.asn1.ASN1Object),ct.asn1.x509.KeyUsage=function(t){ct.asn1.x509.KeyUsage.superclass.constructor.call(this,t);var e=Error,r={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var t=this.getBinValue();return this.asn1ExtnValue=new ct.asn1.DERBitString({bin:t}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var t=this.params;if("object"!=typeof t||"object"!=typeof t.names&&"string"!=typeof t.bin)throw new e("parameter not yet set");if(null!=t.names)return zt(t.names,r);if(null!=t.bin)return t.bin;throw new e("parameter not set properly")},this.oid="2.5.29.15",void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.KeyUsage,ct.asn1.x509.Extension),ct.asn1.x509.BasicConstraints=function(t){ct.asn1.x509.BasicConstraints.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERBoolean,n=e.DERInteger,i=e.DERSequence;this.getExtnValueHex=function(){var t=new Array;this.cA&&t.push(new r),this.pathLen>-1&&t.push(new n({int:this.pathLen}));var e=new i({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==t&&(void 0!==t.cA&&(this.cA=t.cA),void 0!==t.pathLen&&(this.pathLen=t.pathLen))},Gt(ct.asn1.x509.BasicConstraints,ct.asn1.x509.Extension),ct.asn1.x509.CRLDistributionPoints=function(t){ct.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t);var e=ct.asn1,r=e.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(t){for(var n=[],i=0;i<t.length;i++)if(t[i]instanceof ct.asn1.ASN1Object)n.push(t[i]);else{var s=new r.DistributionPoint(t[i]);n.push(s)}this.asn1ExtnValue=new e.DERSequence({array:n})},this.setByOneURI=function(t){var e=new r.DistributionPoint({fulluri:t});this.setByDPArray([e])},this.oid="2.5.29.31",void 0!==t&&(void 0!==t.array?this.setByDPArray(t.array):void 0!==t.uri&&this.setByOneURI(t.uri))},Gt(ct.asn1.x509.CRLDistributionPoints,ct.asn1.x509.Extension),ct.asn1.x509.DistributionPoint=function(t){ct.asn1.x509.DistributionPoint.superclass.constructor.call(this);var e=ct.asn1,r=e.x509.DistributionPointName;this.tohex=function(){var t=new e.DERSequence;if(null!=this.asn1DP){var r=new e.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});t.appendASN1Object(r)}return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.dpobj?this.asn1DP=t.dpobj:void 0!==t.dpname?this.asn1DP=new r(t.dpname):void 0!==t.fulluri&&(this.asn1DP=new r({full:[{uri:t.fulluri}]})))},Gt(ct.asn1.x509.DistributionPoint,ct.asn1.ASN1Object),ct.asn1.x509.DistributionPointName=function(t){ct.asn1.x509.DistributionPointName.superclass.constructor.call(this);var e=ct.asn1,r=e.DERTaggedObject;if(this.tohex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new r({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t)if(e.x509.GeneralNames.prototype.isPrototypeOf(t))this.type="full",this.tag="a0",this.asn1V=t;else{if(void 0===t.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new e.x509.GeneralNames(t.full)}},Gt(ct.asn1.x509.DistributionPointName,ct.asn1.ASN1Object),ct.asn1.x509.CertificatePolicies=function(t){ct.asn1.x509.CertificatePolicies.superclass.constructor.call(this,t);var e=ct.asn1,r=e.x509,n=e.DERSequence,i=r.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++)t.push(new i(this.params.array[e]));var r=new n({array:t});return this.asn1ExtnValue=r,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.CertificatePolicies,ct.asn1.x509.Extension),ct.asn1.x509.PolicyInformation=function(t){ct.asn1.x509.PolicyInformation.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.x509.PolicyQualifierInfo;this.params=null,this.tohex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var t=[new n(this.params.policyoid)];if(void 0!==this.params.array){for(var e=[],s=0;s<this.params.array.length;s++)e.push(new i(this.params.array[s]));e.length>0&&t.push(new r({array:e}))}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.PolicyInformation,ct.asn1.ASN1Object),ct.asn1.x509.PolicyQualifierInfo=function(t){ct.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERSequence,n=e.DERIA5String,i=e.DERObjectIdentifier,s=e.x509.UserNotice;this.params=null,this.tohex=function(){return void 0!==this.params.cps?new r({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]}).tohex():null!=this.params.unotice?new r({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new s(this.params.unotice)]}).tohex():void 0},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.PolicyQualifierInfo,ct.asn1.ASN1Object),ct.asn1.x509.UserNotice=function(t){ct.asn1.x509.UserNotice.superclass.constructor.call(this,t);var e=ct.asn1.DERSequence,r=ct.asn1.x509.DisplayText,n=ct.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var t=[];return void 0!==this.params.noticeref&&t.push(new n(this.params.noticeref)),void 0!==this.params.exptext&&t.push(new r(this.params.exptext)),new e({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.UserNotice,ct.asn1.ASN1Object),ct.asn1.x509.NoticeReference=function(t){ct.asn1.x509.NoticeReference.superclass.constructor.call(this,t);var e=ct.asn1.DERSequence,r=ct.asn1.DERInteger,n=ct.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var t=[];if(void 0!==this.params.org&&t.push(new n(this.params.org)),void 0!==this.params.noticenum){for(var i=[],s=this.params.noticenum,o=0;o<s.length;o++)i.push(new r(s[o]));t.push(new e({array:i}))}if(0==t.length)throw new Error("parameter is empty");return new e({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.NoticeReference,ct.asn1.ASN1Object),ct.asn1.x509.DisplayText=function(t){ct.asn1.x509.DisplayText.superclass.constructor.call(this,t),this.hT="0c",void 0!==t&&("ia5"===t.type?this.hT="16":"vis"===t.type?this.hT="1a":"bmp"===t.type&&(this.hT="1e"))},Gt(ct.asn1.x509.DisplayText,ct.asn1.DERAbstractString),ct.asn1.x509.PolicyMappings=function(t){ct.asn1.x509.PolicyMappings.superclass.constructor.call(this,t);var e=ct.asn1.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){for(var t=this.params,r=[],n=0;n<t.array.length;n++){var i=t.array[n];r.push({seq:[{oid:i[0]},{oid:i[1]}]})}return this.asn1ExtnValue=e({seq:r}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.PolicyMappings,ct.asn1.x509.Extension),ct.asn1.x509.PolicyConstraints=function(t){ct.asn1.x509.PolicyConstraints.superclass.constructor.call(this,t);var e=ct.asn1.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){var t=this.params,r=[];return null!=t.reqexp&&r.push({tag:{tagi:"80",obj:{int:t.reqexp}}}),null!=t.inhibit&&r.push({tag:{tagi:"81",obj:{int:t.inhibit}}}),this.asn1ExtnValue=e({seq:r}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.PolicyConstraints,ct.asn1.x509.Extension),ct.asn1.x509.InhibitAnyPolicy=function(t){ct.asn1.x509.InhibitAnyPolicy.superclass.constructor.call(this,t);var e=ct.asn1.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=e({int:this.params.skip}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.54",void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.InhibitAnyPolicy,ct.asn1.x509.Extension),ct.asn1.x509.NameConstraints=function(t){ct.asn1.x509.NameConstraints.superclass.constructor.call(this,t);var e=ct.asn1,r=e.x509,n=e.ASN1Util.newObject,i=r.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[];if(null!=t.permit&&null!=t.permit.length){for(var r=[],s=0;s<t.permit.length;s++)r.push(new i(t.permit[s]));e.push({tag:{tagi:"a0",obj:{seq:r}}})}if(null!=t.exclude&&null!=t.exclude.length){var o=[];for(s=0;s<t.exclude.length;s++)o.push(new i(t.exclude[s]));e.push({tag:{tagi:"a1",obj:{seq:o}}})}return this.asn1ExtnValue=n({seq:e}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.NameConstraints,ct.asn1.x509.Extension),ct.asn1.x509.GeneralSubtree=function(t){ct.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var e=ct.asn1,r=e.x509.GeneralName,n=e.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params,e=[new r(t)];return null!=t.min&&e.push({tag:{tagi:"80",obj:{int:t.min}}}),null!=t.max&&e.push({tag:{tagi:"81",obj:{int:t.max}}}),n({seq:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.x509.GeneralSubtree,ct.asn1.ASN1Object),ct.asn1.x509.ExtKeyUsage=function(t){ct.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,t);var e=ct.asn1;this.setPurposeArray=function(t){this.asn1ExtnValue=new e.DERSequence;for(var r=0;r<t.length;r++){var n=new e.DERObjectIdentifier(t[r]);this.asn1ExtnValue.appendASN1Object(n)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",void 0!==t&&void 0!==t.array&&this.setPurposeArray(t.array)},Gt(ct.asn1.x509.ExtKeyUsage,ct.asn1.x509.Extension),ct.asn1.x509.AuthorityKeyIdentifier=function(t){ct.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERTaggedObject,n=e.x509.GeneralNames;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var t=new Array;this.asn1KID&&t.push(new r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&t.push(new r({explicit:!1,tag:"a1",obj:new n([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&t.push(new r({explicit:!1,tag:"82",obj:this.asn1CertSN}));var i=new e.DERSequence({array:t});return this.asn1ExtnValue=i,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new ct.asn1.DEROctetString(t);else if("object"==typeof t&&ct.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN ")){var e=t;"string"==typeof t&&(e=$t.getKey(t));var r=$t.getKeyID(e);this.asn1KID=new ct.asn1.DEROctetString({hex:r})}},this.setCertIssuerByParam=function(t){void 0!==t.str||void 0!==t.ldapstr||void 0!==t.hex||void 0!==t.certsubject||void 0!==t.certissuer?this.asn1CertIssuer=new ct.asn1.x509.X500Name(t):"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&-1!=t.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new ct.asn1.x509.X500Name({certissuer:t}))},this.setCertSNByParam=function(t){if(void 0!==t.str||void 0!==t.bigint||void 0!==t.hex)this.asn1CertSN=new ct.asn1.DERInteger(t);else if("string"==typeof t&&-1!=t.indexOf("BEGIN ")&&t.indexOf("CERTIFICATE")){var e=new Zt;e.readCertPEM(t);var r=e.getSerialNumberHex();this.asn1CertSN=new ct.asn1.DERInteger({hex:r})}},this.oid="2.5.29.35",void 0!==t&&(void 0!==t.kid&&this.setKIDByParam(t.kid),void 0!==t.issuer&&this.setCertIssuerByParam(t.issuer),void 0!==t.sn&&this.setCertSNByParam(t.sn),void 0!==t.issuersn&&"string"==typeof t.issuersn&&-1!=t.issuersn.indexOf("BEGIN ")&&t.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(t.issuersn),this.setCertIssuerByParam(t.issuersn)))},Gt(ct.asn1.x509.AuthorityKeyIdentifier,ct.asn1.x509.Extension),ct.asn1.x509.SubjectKeyIdentifier=function(t){ct.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,t);var e=ct.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new e(t);else if("object"==typeof t&&ct.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN")){var r=t;"string"==typeof t&&(r=$t.getKey(t));var n=$t.getKeyID(r);this.asn1KID=new ct.asn1.DEROctetString({hex:n})}},this.oid="2.5.29.14",void 0!==t&&void 0!==t.kid&&this.setKIDByParam(t.kid)},Gt(ct.asn1.x509.SubjectKeyIdentifier,ct.asn1.x509.Extension),ct.asn1.x509.AuthorityInfoAccess=function(t){ct.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,t),this.setAccessDescriptionArray=function(t){for(var e=new Array,r=ct.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,s=r.x509.GeneralName,o=0;o<t.length;o++){var a,u=t[o];if(void 0!==u.ocsp)a=new n({array:[new i({oid:"1.3.6.1.5.5.7.48.1"}),new s({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));a=new n({array:[new i({oid:"1.3.6.1.5.5.7.48.2"}),new s({uri:u.caissuer})]})}e.push(a)}this.asn1ExtnValue=new n({array:e})},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==t&&void 0!==t.array&&this.setAccessDescriptionArray(t.array)},Gt(ct.asn1.x509.AuthorityInfoAccess,ct.asn1.x509.Extension),ct.asn1.x509.SubjectAltName=function(t){ct.asn1.x509.SubjectAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new ct.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.17",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},Gt(ct.asn1.x509.SubjectAltName,ct.asn1.x509.Extension),ct.asn1.x509.IssuerAltName=function(t){ct.asn1.x509.IssuerAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new ct.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.18",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},Gt(ct.asn1.x509.IssuerAltName,ct.asn1.x509.Extension),ct.asn1.x509.SubjectDirectoryAttributes=function(t){ct.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERSequence,n=e.ASN1Util.newObject,i=e.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++){var s=this.params.array[e];if(null==s.attr||null==s.array){var o={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==s.attr)o.seq[0].oid=i(s.attr),o.seq[1].set[0]={gentime:s.str};else if("placeOfBirth"==s.attr)o.seq[0].oid=i(s.attr),o.seq[1].set[0]={utf8str:s.str};else if("gender"==s.attr)o.seq[0].oid=i(s.attr),o.seq[1].set[0]={prnstr:s.str};else if("countryOfCitizenship"==s.attr)o.seq[0].oid=i(s.attr),o.seq[1].set[0]={prnstr:s.str};else{if("countryOfResidence"!=s.attr)throw new Error("unsupported attribute: "+s.attr);o.seq[0].oid=i(s.attr),o.seq[1].set[0]={prnstr:s.str}}t.push(new n(o))}else{var a={seq:[{oid:s.attr},{set:s.array}]};t.push(n(a))}}var u=new r({array:t});return this.asn1ExtnValue=u,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",void 0!==t&&(this.params=t)},Gt(ct.asn1.x509.SubjectDirectoryAttributes,ct.asn1.x509.Extension),ct.asn1.x509.PrivateExtension=function(t){ct.asn1.x509.PrivateExtension.superclass.constructor.call(this,t);var e=ct,r=e.lang.String.isHex,n=e.asn1,i=n.x509.OID.name2oid,s=n.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.oid=i(t.extname),this.params=t},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var t=this.params.extn;if("string"==typeof t&&r(t))return t;if("object"==typeof t)try{return s(t).tohex()}catch(t){}throw new Error("unsupported extn value")},null!=t&&this.setByParam(t)},Gt(ct.asn1.x509.PrivateExtension,ct.asn1.x509.Extension),ct.asn1.x509.CRL=function(t){ct.asn1.x509.CRL.superclass.constructor.call(this);var e=ct.asn1,r=e.DERSequence,n=e.DERBitString,i=e.x509,s=i.AlgorithmIdentifier,o=i.TBSCertList;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=new o(this.params).tohex(),e=new ct.crypto.Signature({alg:this.params.sigalg});e.init(this.params.cakey),e.updateHex(t);var r=e.sign();this.params.sighex=r},this.getPEM=function(){return Ft(this.tohex(),"X509 CRL")},this.tohex=function(){var t=this.params;if(null==t.tbsobj&&(t.tbsobj=new o(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new s({name:t.sigalg})),e.push(new n({hex:"00"+t.sighex})),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&(this.params=t)},Gt(ct.asn1.x509.CRL,ct.asn1.ASN1Object),ct.asn1.x509.TBSCertList=function(t){ct.asn1.x509.TBSCertList.superclass.constructor.call(this);var e=ct.asn1,r=e.DERInteger,n=e.DERSequence,i=e.DERTaggedObject,s=e.x509,o=s.AlgorithmIdentifier,a=s.Time,u=s.Extensions,c=s.X500Name;this.params=null,this.setByParam=function(t){this.params=t},this.getRevCertSequence=function(){for(var t=[],e=this.params.revcert,i=0;i<e.length;i++){var s=[new r(e[i].sn),new a(e[i].date)];null!=e[i].ext&&s.push(new u(e[i].ext)),t.push(new n({array:s}))}return new n({array:t})},this.tohex=function(){var t=[],e=this.params;if(null!=e.version){var s=e.version-1,h=new r({int:s});t.push(h)}if(t.push(new o({name:e.sigalg})),t.push(new c(e.issuer)),t.push(new a(e.thisupdate)),null!=e.nextupdate&&t.push(new a(e.nextupdate)),null!=e.revcert&&t.push(this.getRevCertSequence()),null!=e.ext){var l=new u(e.ext);t.push(new i({tag:"a0",explicit:!0,obj:l}))}return new n({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.x509.TBSCertList,ct.asn1.ASN1Object),ct.asn1.x509.CRLEntry=function(t){ct.asn1.x509.CRLEntry.superclass.constructor.call(this);var e=ct.asn1;this.setCertSerial=function(t){this.sn=new e.DERInteger(t)},this.setRevocationDate=function(t){this.time=new e.x509.Time(t)},this.tohex=function(){var t=new e.DERSequence({array:[this.sn,this.time]});return this.TLV=t.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.time&&this.setRevocationDate(t.time),void 0!==t.sn&&this.setCertSerial(t.sn))},Gt(ct.asn1.x509.CRLEntry,ct.asn1.ASN1Object),ct.asn1.x509.CRLNumber=function(t){ct.asn1.x509.CRLNumber.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ct.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",null!=t&&(this.params=t)},Gt(ct.asn1.x509.CRLNumber,ct.asn1.x509.Extension),ct.asn1.x509.CRLReason=function(t){ct.asn1.x509.CRLReason.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ct.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",null!=t&&(this.params=t)},Gt(ct.asn1.x509.CRLReason,ct.asn1.x509.Extension),ct.asn1.x509.OCSPNonce=function(t){ct.asn1.x509.OCSPNonce.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ct.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=t&&(this.params=t)},Gt(ct.asn1.x509.OCSPNonce,ct.asn1.x509.Extension),ct.asn1.x509.OCSPNoCheck=function(t){ct.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ct.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=t&&(this.params=t)},Gt(ct.asn1.x509.OCSPNoCheck,ct.asn1.x509.Extension),ct.asn1.x509.AdobeTimeStamp=function(t){ct.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERInteger,n=e.DERBoolean,i=e.DERSequence,s=e.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[new r(1)];return e.push(new s({uri:t.uri})),null!=t.reqauth&&e.push(new n(t.reqauth)),this.asn1ExtnValue=new i({array:e}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==t&&this.setByParam(t)},Gt(ct.asn1.x509.AdobeTimeStamp,ct.asn1.x509.Extension),ct.asn1.x509.X500Name=function(t){ct.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=ct.asn1,r=e.x509,n=r.RDN;this.setByString=function(t,e){void 0!==e&&(this.sRule=e);var r=t.split("/");r.shift();for(var i=[],s=0;s<r.length;s++)if(r[s].match(/^[^=]+=.+$/))i.push(r[s]);else{var o=i.length-1;i[o]=i[o]+"/"+r[s]}for(s=0;s<i.length;s++)this.asn1Array.push(new n({str:i[s],rule:this.sRule}))},this.setByLdapString=function(t,e){void 0!==e&&(this.sRule=e);var n=r.X500Name.ldapToCompat(t);this.setByString(n,e)},this.setByObject=function(t,e){for(var r in void 0!==e&&(this.sRule=e),t)if(t.hasOwnProperty(r)){var i=new n({str:r+"="+t[r],rule:this.sRule});this.asn1Array?this.asn1Array.push(i):this.asn1Array=[i]}},this.setByParam=function(t){var e;(void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.array)?this.paramArray=t.array:void 0!==t.str?this.setByString(t.str):void 0!==t.ldapstr?this.setByLdapString(t.ldapstr):void 0!==t.hex?this.hTLV=t.hex:void 0!==t.certissuer?((e=new Zt).readCertPEM(t.certissuer),this.hTLV=e.getIssuerHex()):void 0!==t.certsubject?((e=new Zt).readCertPEM(t.certsubject),this.hTLV=e.getSubjectHex()):"object"==typeof t&&void 0===t.certsubject&&void 0===t.certissuer&&this.setByObject(t)},this.tohex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var r={array:this.paramArray[t]};"utf8"!=this.sRule&&(r.rule=this.sRule);var i=new n(r);this.asn1Array.push(i)}var s=new e.DERSequence({array:this.asn1Array});return this.hTLV=s.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.x509.X500Name,ct.asn1.ASN1Object),ct.asn1.x509.X500Name.compatToLDAP=function(t){if("/"!==t.substr(0,1))throw"malformed input";var e=(t=t.substr(1)).split("/");return e.reverse(),e=e.map(function(t){return t.replace(/,/,"\\,")}),e.join(",")},ct.asn1.x509.X500Name.onelineToLDAP=function(t){return ct.asn1.x509.X500Name.compatToLDAP(t)},ct.asn1.x509.X500Name.ldapToCompat=function(t){for(var e=t.split(","),r=!1,n=[],i=0;e.length>0;i++){var s=e.shift();if(!0===r){var o=(n.pop()+","+s).replace(/\\,/g,",");n.push(o),r=!1}else n.push(s);"\\"===s.substr(-1,1)&&(r=!0)}return n=n.map(function(t){return t.replace("/","\\/")}),n.reverse(),"/"+n.join("/")},ct.asn1.x509.X500Name.ldapToOneline=function(t){return ct.asn1.x509.X500Name.ldapToCompat(t)},ct.asn1.x509.RDN=function(t){ct.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=ct.asn1.x509.AttributeTypeAndValue;this.setByParam=function(t){void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.str&&this.addByMultiValuedString(t.str),void 0!==t.array&&(this.paramArray=t.array)},this.addByString=function(t){this.asn1Array.push(new ct.asn1.x509.AttributeTypeAndValue({str:t,rule:this.sRule}))},this.addByMultiValuedString=function(t){for(var e=ct.asn1.x509.RDN.parseString(t),r=0;r<e.length;r++)this.addByString(e[r])},this.tohex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var r=this.paramArray[t];void 0!==r.rule&&"utf8"!=this.sRule&&(r.rule=this.sRule);var n=new e(r);this.asn1Array.push(n)}var i=new ct.asn1.DERSet({array:this.asn1Array});return this.TLV=i.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.x509.RDN,ct.asn1.ASN1Object),ct.asn1.x509.RDN.parseString=function(t){for(var e=t.split(/\+/),r=!1,n=[],i=0;e.length>0;i++){var s=e.shift();if(!0===r){var o=(n.pop()+"+"+s).replace(/\\\+/g,"+");n.push(o),r=!1}else n.push(s);"\\"===s.substr(-1,1)&&(r=!0)}var a=!1,u=[];for(i=0;n.length>0;i++){s=n.shift();if(!0===a){var c=u.pop();if(s.match(/"$/)){o=(c+"+"+s).replace(/^([^=]+)="(.*)"$/,"$1=$2");u.push(o),a=!1}else u.push(c+"+"+s)}else u.push(s);s.match(/^[^=]+="/)&&(a=!0)}return u},ct.asn1.x509.AttributeTypeAndValue=function(t){ct.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var e=ct,r=e.asn1,n=r.DERSequence,i=r.DERUTF8String,s=r.DERPrintableString,o=r.DERTeletexString,a=r.DERIA5String,u=r.DERVisibleString,c=r.DERBMPString,h=e.lang.String.isMail,l=e.lang.String.isPrintable;this.setByParam=function(t){if(void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.ds&&(this.dsType=t.ds),void 0===t.value&&void 0!==t.str){var e=t.str.match(/^([^=]+)=(.+)$/);if(!e)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=e[1],this.sValue=e[2]}else this.sType=t.type,this.sValue=t.value},this.setByString=function(t,e){void 0!==e&&(this.sRule=e);var r=t.match(/^([^=]+)=(.+)$/);if(!r)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(r[1],r[2])},this._getDsType=function(){var t=this.sType,e=this.sValue,r=this.sRule;return"prn"===r?"CN"==t&&h(e)?"ia5":l(e)?"prn":"utf8":"utf8"===r?"CN"==t&&h(e)?"ia5":"C"==t?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(t,e,r){void 0!==r&&(this.sRule=r),this.sType=t,this.sValue=e},this.getValueObj=function(t,e){if("utf8"==t)return new i({str:e});if("prn"==t)return new s({str:e});if("tel"==t)return new o({str:e});if("ia5"==t)return new a({str:e});if("vis"==t)return new u({str:e});if("bmp"==t)return new c({str:e});throw new Error("unsupported directory string type: type="+t+" value="+e)},this.tohex=function(){null==this.dsType&&(this.dsType=this._getDsType());var t=ct.asn1.x509.OID.atype2obj(this.sType),e=this.getValueObj(this.dsType,this.sValue),r=new n({array:[t,e]});return this.TLV=r.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.x509.AttributeTypeAndValue,ct.asn1.ASN1Object),ct.asn1.x509.SubjectPublicKeyInfo=function(t){ct.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var e=ct.asn1,r=e.DERInteger,n=e.DERBitString,i=e.DERObjectIdentifier,s=e.DERSequence,o=e.ASN1Util.newObject,a=e.x509.AlgorithmIdentifier;this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new s({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.tohex=function(){var t=this.getASN1Object();return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(t){try{if(t instanceof it){var e=o({seq:[{int:{bigint:t.n}},{int:{int:t.e}}]}).tohex();this.asn1AlgId=new a({name:"rsaEncryption"}),this.asn1SubjPKey=new n({hex:"00"+e})}}catch(t){}try{if(t instanceof ct.crypto.ECDSA){var s=new i({name:t.curveName});this.asn1AlgId=new a({name:"ecPublicKey",asn1params:s}),this.asn1SubjPKey=new n({hex:"00"+t.pubKeyHex})}}catch(t){}try{if(t instanceof ct.crypto.DSA){s=new o({seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]});this.asn1AlgId=new a({name:"dsa",asn1params:s});var u=new r({bigint:t.y});this.asn1SubjPKey=new n({hex:"00"+u.tohex()})}}catch(t){}},void 0!==t&&this.setPubKey(t)},Gt(ct.asn1.x509.SubjectPublicKeyInfo,ct.asn1.ASN1Object),ct.asn1.x509.Time=function(t){ct.asn1.x509.Time.superclass.constructor.call(this);var e=ct.asn1,r=e.DERUTCTime,n=e.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(t){this.timeParams=t},this.setByParam=function(t){this.params=t},this.getType=function(t){return t.match(/^[0-9]{12}Z$/)?"utc":t.match(/^[0-9]{14}Z$/)?"gen":t.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":t.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var t=this.params,e=null;if("string"==typeof t&&(t={str:t}),null==t||!t.str||null!=t.type&&null!=t.type||(t.type=this.getType(t.str)),null!=t&&t.str?("utc"==t.type&&(e=new r(t.str)),"gen"==t.type&&(e=new n(t.str))):e="gen"==this.type?new n:new r,null==e)throw new Error("wrong setting for Time");return this.TLV=e.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},ct.asn1.x509.Time_bak=function(t){ct.asn1.x509.Time_bak.superclass.constructor.call(this);var e=ct.asn1,r=e.DERUTCTime,n=e.DERGeneralizedTime;this.setTimeParams=function(t){this.timeParams=t},this.tohex=function(){var t=null;return t=null!=this.timeParams?"utc"==this.type?new r(this.timeParams):new n(this.timeParams):"utc"==this.type?new r:new n,this.TLV=t.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",void 0!==t&&(void 0!==t.type?this.type=t.type:void 0!==t.str&&(t.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),t.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=t)},Gt(ct.asn1.x509.Time,ct.asn1.ASN1Object),ct.asn1.x509.AlgorithmIdentifier=function(t){ct.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var e=ct.asn1,r=e.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var t=null;for(var n in r)n===this.nameAlg&&(t=r[n]);if(null!==t)return this.hTLV=t,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=e.x509.OID.name2obj(this.nameAlg));var i=[this.asn1Alg];null!==this.asn1Params&&i.push(this.asn1Params);var s=new e.DERSequence({array:i});return this.hTLV=s.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.name&&(this.nameAlg=t.name),void 0!==t.asn1params&&(this.asn1Params=t.asn1params),void 0!==t.paramempty&&(this.paramEmpty=t.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var n=this.nameAlg.toLowerCase();"withdsa"!==n.substr(-7,7)&&"withecdsa"!==n.substr(-9,9)&&(this.asn1Params=new e.DERNull)}},Gt(ct.asn1.x509.AlgorithmIdentifier,ct.asn1.ASN1Object),ct.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},ct.asn1.x509.GeneralName=function(t){ct.asn1.x509.GeneralName.superclass.constructor.call(this);var e=ct.asn1,r=e.x509,n=r.X500Name,i=r.OtherName,s=e.DERIA5String,o=e.DEROctetString,a=e.DERTaggedObject,u=e.ASN1Object,c=Error;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t,e,r=this.params,h=!1;if(void 0!==r.other)t="a0",e=new i(r.other);else if(void 0!==r.rfc822)t="81",e=new s({str:r.rfc822});else if(void 0!==r.dns)t="82",e=new s({str:r.dns});else if(void 0!==r.dn)t="a4",h=!0,e="string"==typeof r.dn?new n({str:r.dn}):r.dn instanceof ct.asn1.x509.X500Name?r.dn:new n(r.dn);else if(void 0!==r.ldapdn)t="a4",h=!0,e=new n({ldapstr:r.ldapdn});else if(void 0!==r.certissuer||void 0!==r.certsubj){var l,f;t="a4",h=!0;var p=null;if(void 0!==r.certsubj?(l=!1,f=r.certsubj):(l=!0,f=r.certissuer),f.match(/^[0-9A-Fa-f]+$/),-1!=f.indexOf("-----BEGIN ")&&(p=At(f)),null==p)throw new Error("certsubj/certissuer not cert");var g,d=new Zt;d.hex=p,g=l?d.getIssuerHex():d.getSubjectHex(),(e=new u).hTLV=g}else if(void 0!==r.uri)t="86",e=new s({str:r.uri});else{if(void 0===r.ip)throw new c("improper params");var v;t="87";var m=r.ip;try{if(m.match(/^[0-9a-f]+$/)){var y=m.length;if(8!=y&&16!=y&&32!=y&&64!=y)throw"err";v=m}else v=_t(m)}catch(t){throw new c("malformed IP address: "+r.ip+":"+t.message)}e=new o({hex:v})}return new a({tag:t,explicit:h,obj:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.x509.GeneralName,ct.asn1.ASN1Object),ct.asn1.x509.GeneralNames=function(t){ct.asn1.x509.GeneralNames.superclass.constructor.call(this);var e=ct.asn1;this.setByParamArray=function(t){for(var r=0;r<t.length;r++){var n=new e.x509.GeneralName(t[r]);this.asn1Array.push(n)}},this.tohex=function(){return new e.DERSequence({array:this.asn1Array}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,void 0!==t&&this.setByParamArray(t)},Gt(ct.asn1.x509.GeneralNames,ct.asn1.ASN1Object),ct.asn1.x509.OtherName=function(t){ct.asn1.x509.OtherName.superclass.constructor.call(this);var e=ct.asn1,r=e.DERObjectIdentifier,n=e.DERSequence,i=e.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if(null==t.oid||null==t.value)throw new Error("oid or value not specified");var e=new r({oid:t.oid}),s=i({tag:{tag:"a0",explicit:!0,obj:t.value}});return new n({array:[e,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.x509.OtherName,ct.asn1.ASN1Object),ct.asn1.x509.OID=new function(){var t=ct.asn1.DERObjectIdentifier;this.name2oidList={"aes128-CBC":"2.16.840.1.101.3.4.1.2","aes256-CBC":"2.16.840.1.101.3.4.1.42",sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",hmacWithSHA1:"1.2.840.113549.2.7",hmacWithSHA224:"1.2.840.113549.2.8",hmacWithSHA256:"1.2.840.113549.2.9",hmacWithSHA384:"1.2.840.113549.2.10",hmacWithSHA512:"1.2.840.113549.2.11",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",policyMappings:"2.5.29.33",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",inhibitAnyPolicy:"2.5.29.54",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",smtpUTF8Mailbox:"1.3.6.1.5.5.7.8.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1",smimeMailboxLegacy:"2.23.140.1.5.1.1",smimeMailboxMulti:"2.23.140.1.5.1.2",smimeMailboxStrict:"2.23.140.1.5.1.3",smimeOrganizationLegacy:"2.23.140.1.5.2.1",smimeOrganizationMulti:"2.23.140.1.5.2.2",smimeOrganizationStrict:"2.23.140.1.5.2.3",smimeSponsorLegacy:"2.23.140.1.5.3.1",smimeSponsorMulti:"2.23.140.1.5.3.2",smimeSponsorStrict:"2.23.140.1.5.3.3",smimeIndividualLegacy:"2.23.140.1.5.4.1",smimeIndividualMulti:"2.23.140.1.5.4.2",smimeIndividualStrict:"2.23.140.1.5.4.3"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",GN:"2.5.4.42",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var r=this.name2oidList[e],n=new t({oid:r});return this.objCache[e]=n,n},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var r;if(e.match(/^\d+\.\d+\.[0-9.]+$/))r=e;else if(void 0!==this.atype2oidList[e])r=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw new Error("AttributeType name undefined: "+e);r=this.name2oidList[e]}var n=new t({oid:r});return this.objCache[e]=n,n},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var e in t)this.name2oidList[e]=t[e]},this.checkOIDs=function(t){try{var e=Object.keys(t);return 0!=e.length&&(e.map(function(t,e,r){if(!this[t].match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},t),!0)}catch(t){return!1}}},ct.asn1.x509.OID.oid2name=function(t){var e=ct.asn1.x509.OID.name2oidList;for(var r in e)if(e[r]==t)return r;return""},ct.asn1.x509.OID.oid2atype=function(t){var e=ct.asn1.x509.OID.atype2oidList;for(var r in e)if(e[r]==t)return r;return t},ct.asn1.x509.OID.name2oid=function(t){if(t.match(/^[0-9.]+$/))return t;var e=ct.asn1.x509.OID.name2oidList;return void 0===e[t]?"":e[t]},ct.asn1.x509.X509Util={},ct.asn1.x509.X509Util.newCertPEM=function(t){return new(0,ct.asn1.x509.Certificate)(t).getPEM()},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.cms&&ct.asn1.cms||(ct.asn1.cms={}),ct.asn1.cms.Attribute=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.DERSet,s=r.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(t){this.params=t},this.getValueArray=function(){throw new e("not yet implemented abstract")},this.tohex=function(){var t=new s({oid:this.typeOid}),e=new i({array:this.getValueArray()});return new n({array:[t,e]}).tohex()},this.getEncodedHex=function(){return this.tohex()}},Gt(ct.asn1.cms.Attribute,ct.asn1.ASN1Object),ct.asn1.cms.ContentType=function(t){var e=ct.asn1;e.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new e.DERObjectIdentifier(this.params.type)]},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.ContentType,ct.asn1.cms.Attribute),ct.asn1.cms.MessageDigest=function(t){var e=ct.asn1,r=e.DEROctetString;e.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new r(this.params)]},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.MessageDigest,ct.asn1.cms.Attribute),ct.asn1.cms.SigningTime=function(t){var e=ct.asn1;e.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new e.x509.Time(this.params)]},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.SigningTime,ct.asn1.cms.Attribute),ct.asn1.cms.SigningCertificate=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.cms,s=i.ESSCertID;i.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new e("parameter 'array' not specified");for(var r=this.params.array,i=[],o=0;o<r.length;o++){var a=r[o];0!=t.hasis||"string"!=typeof a||-1==a.indexOf("-----BEGIN")&&!ft.isASN1HEX(a)||(a={cert:a}),0!=a.hasis&&0==t.hasis&&(a.hasis=!1),i.push(new s(a))}var u=new n({array:i});return[new n({array:[u]})]},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.SigningCertificate,ct.asn1.cms.Attribute),ct.asn1.cms.ESSCertID=function(t){ct.asn1.cms.ESSCertID.superclass.constructor.call(this);var e=Error,r=ct,n=r.asn1,i=n.DEROctetString,s=n.DERSequence,o=n.cms.IssuerSerial;this.params=null,this.getCertHash=function(t,n){if(null!=t.hash)return t.hash;if("string"==typeof t&&-1==t.indexOf("-----BEGIN")&&!ft.isASN1HEX(t))return t;var i,s,o;if("string"==typeof t)i=t;else{if(null==t.cert)throw new e("hash nor cert unspecified");i=t.cert}if(s=-1!=i.indexOf("-----BEGIN")?At(i):i,"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?s=At(t):ft.isASN1HEX(t)&&(s=t)),null!=t.alg)o=t.alg;else{if(null==n)throw new e("hash alg unspecified");o=n}return r.crypto.Util.hashHex(s,o)},this.tohex=function(){var t=this.params,e=this.getCertHash(t,"sha1"),r=[];return r.push(new i({hex:e})),("string"==typeof t&&-1!=t.indexOf("-----BEGIN")||null!=t.cert&&0!=t.hasis||null!=t.issuer&&null!=t.serial)&&r.push(new o(t)),new s({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.ESSCertID,ct.asn1.ASN1Object),ct.asn1.cms.SigningCertificateV2=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.cms,s=i.ESSCertIDv2;i.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new e("parameter 'array' not specified");for(var r=this.params.array,i=[],o=0;o<r.length;o++){var a=r[o];null==t.alg&&0!=t.hasis||"string"!=typeof a||-1==a.indexOf("-----BEGIN")&&!ft.isASN1HEX(a)||(a={cert:a}),null==a.alg&&null!=t.alg&&(a.alg=t.alg),0!=a.hasis&&0==t.hasis&&(a.hasis=!1),i.push(new s(a))}var u=new n({array:i});return[new n({array:[u]})]},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.SigningCertificateV2,ct.asn1.cms.Attribute),ct.asn1.cms.ESSCertIDv2=function(t){ct.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);var e=ct.asn1,r=e.DEROctetString,n=e.DERSequence,i=e.cms.IssuerSerial,s=e.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var t=this.params,e=this.getCertHash(t,"sha256"),o=[];return null!=t.alg&&"sha256"!=t.alg&&o.push(new s({name:t.alg})),o.push(new r({hex:e})),("string"==typeof t&&-1!=t.indexOf("-----BEGIN")||null!=t.cert&&0!=t.hasis||null!=t.issuer&&null!=t.serial)&&o.push(new i(t)),new n({array:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.ESSCertIDv2,ct.asn1.cms.ESSCertID),ct.asn1.cms.IssuerSerial=function(t){var e=Error,r=ct.asn1,n=r.DERInteger,i=r.DERSequence,s=r.cms,o=r.x509.GeneralNames,a=Zt;s.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(t){this.params=t},this.tohex=function(){var t,r,s=this.params;if("string"==typeof s&&-1!=s.indexOf("-----BEGIN")||null!=s.cert){var u;u=null!=s.cert?s.cert:s;var c=new a;c.readCertPEM(u),t=c.getIssuer(),r={hex:c.getSerialNumberHex()}}else{if(null==s.issuer||!s.serial)throw new e("cert or issuer and serial parameter not specified");t=s.issuer,r=s.serial}var h=new o([{dn:t}]),l=new n(r);return new i({array:[h,l]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.IssuerSerial,ct.asn1.ASN1Object),ct.asn1.cms.SignerIdentifier=function(t){var e=ct.asn1.cms,r=e.IssuerAndSerialNumber,n=e.SubjectKeyIdentifier;e.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if("isssn"==t.type)return new r(t).tohex();if("skid"==t.type)return new n(t).tohex();throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.SignerIdentifier,ct.asn1.ASN1Object),ct.asn1.cms.IssuerAndSerialNumber=function(t){var e=ct.asn1,r=e.DERInteger,n=e.DERSequence,i=e.cms,s=e.x509.X500Name,o=Zt,a=Error;i.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t,e,i=this.params;if("string"==typeof i&&-1!=i.indexOf("-----BEGIN")||null!=i.cert){var u;u=null!=i.cert?i.cert:i;var c=new o;c.readCertPEM(u),t=c.getIssuer(),e={hex:c.getSerialNumberHex()}}else{if(null==i.issuer||!i.serial)throw new a("cert or issuer and serial parameter not specified");t=i.issuer,e=i.serial}var h=new s(t),l=new r(e);return new n({array:[h,l]}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.IssuerAndSerialNumber,ct.asn1.ASN1Object),ct.asn1.cms.SubjectKeyIdentifier=function(t){var e=ct.asn1,r=e.ASN1Util.newObject,n=e.cms,i=Zt,s=Error;n.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var t,e=this.params;if(null==e.cert&&null==e.skid)throw new s("property cert nor skid undefined");null!=e.cert?t=new i(e.cert).getExtSubjectKeyIdentifier().kid.hex:null!=e.skid&&(t=e.skid);return r({tag:{tage:"a0",obj:{octstr:{hex:t}}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.SubjectKeyIdentifier,ct.asn1.ASN1Object),ct.asn1.cms.AttributeList=function(t){var e=Error,r=ct.asn1,n=r.DERSet,i=r.cms;i.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if(null!=this.hTLV)return this.hTLV;var r=!0;null!=t.sortflag&&(r=t.sortflag);for(var s=t.array,o=[],a=0;a<s.length;a++){var u=s[a],c=u.attr;if("contentType"==c)o.push(new i.ContentType(u));else if("messageDigest"==c)o.push(new i.MessageDigest(u));else if("signingTime"==c)o.push(new i.SigningTime(u));else if("signingCertificate"==c)o.push(new i.SigningCertificate(u));else if("signingCertificateV2"==c)o.push(new i.SigningCertificateV2(u));else if("signaturePolicyIdentifier"==c)o.push(new ct.asn1.cades.SignaturePolicyIdentifier(u));else{if("signatureTimeStamp"!=c&&"timeStampToken"!=c)throw new e("unknown attr: "+c);o.push(new ct.asn1.cades.SignatureTimeStamp(u))}}var h=new n({array:o,sortflag:r});return this.hTLV=h.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.AttributeList,ct.asn1.ASN1Object),ct.asn1.cms.SignerInfo=function(t){var e=Error,r=ct,n=r.asn1,i=n.DERInteger,s=n.DEROctetString,o=n.DERSequence,a=n.DERTaggedObject,u=n.cms,c=u.SignerIdentifier,h=u.AttributeList,l=n.x509.AlgorithmIdentifier,f=r.crypto,p=$t;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var t=this.params,e=t.sigalg,r=new h(t.sattrs).tohex(),n=p.getKey(t.signkey),i=new f.Signature({alg:e});i.init(n),i.updateHex(r);var s=i.sign();t.sighex=s},this.tohex=function(){var t=this.params,r=[];if(r.push(new i({int:t.version})),r.push(new c(t.id)),r.push(new l({name:t.hashalg})),null!=t.sattrs){var n=new h(t.sattrs);try{r.push(new a({tag:"a0",explicit:!1,obj:n}))}catch(t){throw new e("si sattr error: "+t)}}if(null!=t.sigalgfield?r.push(new l({name:t.sigalgfield})):r.push(new l({name:t.sigalg})),null==t.sighex&&null!=t.signkey&&this.sign(),r.push(new s({hex:t.sighex})),null!=t.uattrs){n=new h(t.uattrs);try{r.push(new a({tag:"a1",explicit:!1,obj:n}))}catch(t){throw new e("si uattr error: "+t)}}return new o({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.SignerInfo,ct.asn1.ASN1Object),ct.asn1.cms.EncapsulatedContentInfo=function(t){var e=ct.asn1,r=e.DERTaggedObject,n=e.DERSequence,i=e.DERObjectIdentifier,s=e.DEROctetString;e.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];if(e.push(new i(t.type)),null!=t.content&&(null!=t.content.hex||null!=t.content.str)&&1!=t.isDetached){var o=new s(t.content),a=new r({tag:"a0",explicit:!0,obj:o});e.push(a)}return new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.EncapsulatedContentInfo,ct.asn1.ASN1Object),ct.asn1.cms.ContentInfo=function(t){var e=ct.asn1,r=e.DERTaggedObject,n=e.DERSequence,i=e.DERObjectIdentifier;ct.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];e.push(new i(t.type));var s=new r({tag:"a0",explicit:!0,obj:t.obj});return e.push(s),new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.ContentInfo,ct.asn1.ASN1Object),ct.asn1.cms.SignedData=function(t){var e=ct.asn1,r=e.DERInteger,n=e.DERSet,i=e.DERSequence,s=e.cms,o=s.EncapsulatedContentInfo,a=s.SignerInfo,u=s.ContentInfo,c=s.CertificateSet,h=s.RevocationInfoChoices,l=e.x509.AlgorithmIdentifier;ct.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var t=this.params;this._setDigestAlgs(t),this._setContentTypeByEContent(t),this._setMessageDigestByEContent(t),this._setSignerInfoVersion(t),this._setSignedDataVersion(t)},this._setDigestAlgs=function(t){for(var e={},r=t.sinfos,n=0;n<r.length;n++){e[r[n].hashalg]=1}t.hashalgs=Object.keys(e).sort()},this._setContentTypeByEContent=function(t){for(var e=t.econtent.type,r=t.sinfos,n=0;n<r.length;n++){var i=r[n];this._getAttrParamByName(i,"contentType").type=e}},this._setMessageDigestByEContent=function(t){var e=t.econtent,r=e.content.hex;null==r&&"data"==e.type&&null!=e.content.str&&(r=bt(e.content.str));for(var n=t.sinfos,i=0;i<n.length;i++){var s=n[i],o=s.hashalg,a=this._getAttrParamByName(s,"messageDigest"),u=ct.crypto.Util.hashHex(r,o);a.hex=u}},this._getAttrParamByName=function(t,e){for(var r=t.sattrs.array,n=0;n<r.length;n++)if(r[n].attr==e)return r[n]},this._setSignerInfoVersion=function(t){for(var e=t.sinfos,r=0;r<e.length;r++){var n=e[r],i=1;"skid"==n.id.type&&(i=3),n.version=i}},this._setSignedDataVersion=function(t){var e=this._getSignedDataVersion(t);t.version=e},this._getSignedDataVersion=function(t){if(null!=t.revinfos)for(var e=t.revinfos,r=0;r<e.length;r++){if(null!=e[r].ocsp)return 5}var n=t.sinfos;for(r=0;r<n.length;r++){if(3==t.sinfos[r].version)return 3}return"data"!=t.econtent.type?3:1},this.tohex=function(){var t=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=t.fixed&&this.checkAndFixParam();var e=[];e.push(new r({int:t.version}));for(var s=[],u=0;u<t.hashalgs.length;u++){var f=t.hashalgs[u];s.push(new l({name:f}))}e.push(new n({array:s})),e.push(new o(t.econtent)),null!=t.certs&&e.push(new c(t.certs)),null!=t.revinfos&&e.push(new h(t.revinfos));var p=[];for(u=0;u<t.sinfos.length;u++){var g=t.sinfos[u];p.push(new a(g))}return e.push(new n({array:p})),new i({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){return new u({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.SignedData,ct.asn1.ASN1Object),ct.asn1.cms.CertificateSet=function(t){ct.asn1.cms.CertificateSet.superclass.constructor.call(this);var e=Error,r=ct.asn1,n=r.DERTaggedObject,i=r.DERSet,s=r.ASN1Object;this.params=null,this.tohex=function(){var t,r=this.params,o=[];if(r instanceof Array)t=r;else{if(null==r.array)throw new e("cert array not specified");t=r.array}for(var a=0;a<t.length;a++){var u=At(t[a]),c=new s;c.hTLV=u,o.push(c)}var h={array:o};0==r.sortflag&&(h.sortflag=!1);var l=new i(h);return new n({tag:"a0",explicit:!1,obj:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.CertificateSet,ct.asn1.ASN1Object),ct.asn1.cms.RevocationInfoChoices=function(t){ct.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new Error("params is not array");for(var e=[],r=0;r<t.length;r++)e.push(new ct.asn1.cms.RevocationInfoChoice(t[r]));return ct.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:e}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.RevocationInfoChoices,ct.asn1.ASN1Object),ct.asn1.cms.RevocationInfoChoice=function(t){ct.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(null!=t.crl&&"string"==typeof t.crl){var e=t.crl;return-1!=t.crl.indexOf("-----BEGIN")&&(e=At(t.crl)),e}if(null!=t.ocsp)return ct.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new ct.asn1.cms.OtherRevocationFormat(t)}}).tohex();throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.RevocationInfoChoice,ct.asn1.ASN1Object),ct.asn1.cms.OtherRevocationFormat=function(t){ct.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var e=Error,r=ct,n=r.asn1.ASN1Util.newObject,i=r.lang.String.isHex;this.params=null,this.tohex=function(){var t=this.params;if(null==t.ocsp)throw new e("property ocsp not specified");if(!i(t.ocsp)||!ft.isASN1HEX(t.ocsp))throw new e("ocsp value not ASN.1 hex string");return n({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:t.ocsp}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cms.OtherRevocationFormat,ct.asn1.ASN1Object),ct.asn1.cms.CMSUtil=new function(){},ct.asn1.cms.CMSUtil.newSignedData=function(t){return new ct.asn1.cms.SignedData(t)},ct.asn1.cms.CMSUtil.verifySignedData=function(t){var e=ct,r=e.lang.String.isHex,n=ft,i=n.getVbyList,s=n.getTLVbyList,o=n.getIdxbyList,a=n.getChildIdx,u=n.getTLV,c=n.oidname,h=e.crypto.Util.hashHex;void 0===t.cms&&r(t.cms);var l=t.cms,f=function(t,e){var r=e.idx;e.signerid_issuer1=s(t,r,[1,0],"30"),e.signerid_serial1=i(t,r,[1,1],"02"),e.hashalg=c(i(t,r,[2,0],"06"));var n=o(t,r,[3],"a0");e.idxSignedAttrs=n,p(t,e,n);var u=a(t,r).length;if(u<6)throw"malformed SignerInfo";e.sigalg=c(i(t,r,[u-2,0],"06")),e.sigval=i(t,r,[u-1],"04")},p=function(t,e,r){var n=a(t,r);e.signedAttrIdxList=n;for(var s=0;s<n.length;s++){var o,u=n[s],c=i(t,u,[0],"06");"2a864886f70d010905"===c?(o=wt(i(t,u,[1,0])),e.saSigningTime=o):"2a864886f70d010904"===c&&(o=i(t,u,[1,0],"04"),e.saMessageDigest=o)}},g=function(t,e,r,n){r.verifyDetail={};var i=r.verifyDetail,s=e.parse.econtent,o=r.hashalg,c=r.saMessageDigest;i.validMessageDigest=!1,h(s,o)===c&&(i.validMessageDigest=!0),function(t,e,r){var n,i=e.parse.certsIdx;if(void 0===e.certs){n=[],e.certkeys=[];for(var s=a(t,i),o=0;o<s.length;o++){var c=u(t,s[o]),h=new Zt;h.readCertHex(c),n[o]=h,e.certkeys[o]=h.getPublicKey()}e.certs=n}else n=e.certs;for(e.cccc=n.length,e.cccci=s.length,o=0;o<n.length;o++){var l=h.getIssuerHex(),f=h.getSerialNumberHex();r.signerid_issuer1===l&&r.signerid_serial1===f&&(r.certkey_idx=o)}}(t,e,r),i.validSignatureValue=!1;var l=r.sigalg,f="31"+u(t,r.idxSignedAttrs).substr(2);r.signedattrshex=f;var p=e.certs[r.certkey_idx].getPublicKey(),g=new ct.crypto.Signature({alg:l});g.init(p),g.updateHex(f);var d=g.verify(r.sigval);i.validSignatureValue_isValid=d,!0===d&&(i.validSignatureValue=!0),r.isValid=!1,i.validMessageDigest&&i.validSignatureValue&&(r.isValid=!0)},d={isValid:!1,parse:{}};return function(t,e){if("2a864886f70d010702"!==i(t,0,[0],"06"))return e;e.cmsType="signedData",e.econtent=i(t,0,[1,0,2,1,0]),function(t,e){for(var r,n=3;n<6;n++)if(void 0!==(r=o(t,0,[1,0,n]))){var i=t.substr(r,2);"a0"===i&&(e.certsIdx=r),"a1"===i&&(e.revinfosIdx=r),"31"===i&&(e.signerinfosIdx=r)}}(t,e),e.signerInfos=[],function(t,e){var r=e.signerinfosIdx;if(void 0!==r){var n=a(t,r);e.signerInfoIdxList=n;for(var i=0;i<n.length;i++){var s={idx:n[i]};f(t,s),e.signerInfos.push(s)}}}(t,e)}(l,d.parse),function(t,e){for(var r=e.parse.signerInfos,n=r.length,i=!0,s=0;s<n;s++){var o=r[s];g(t,e,o),o.isValid||(i=!1)}e.isValid=i}(l,d),d},ct.asn1.cms.CMSParser=function(){var t=Error,e=Zt,r=new e,n=ft,i=n.getV,s=n.getTLV,o=n.getTLVbyList,a=n.getTLVbyListEx,u=n.getVbyList,c=n.getVbyListEx,h=n.getChildIdx;this.getCMSSignedData=function(t){var e=o(t,0,[1,0]);return this.getSignedData(e)},this.getSignedData=function(t){var e=h(t,0),r={},n=i(t,e[0]),o=parseInt(n,16);r.version=o;var u=s(t,e[1]);r.hashalgs=this.getHashAlgArray(u);var c=s(t,e[2]);r.econtent=this.getEContent(c);var l=a(t,0,["[0]"]);null!=l&&(r.certs=this.getCertificateSet(l)),a(t,0,["[1]"]);var f=a(t,0,[3]);return r.sinfos=this.getSignerInfos(f),r},this.getHashAlgArray=function(t){for(var r=h(t,0),n=new e,i=[],o=0;o<r.length;o++){var a=s(t,r[o]),u=n.getAlgorithmIdentifierName(a);i.push(u)}return i},this.getEContent=function(t){var e={},r=u(t,0,[0]),n=u(t,0,[1,0]);return e.type=ct.asn1.x509.OID.oid2name(ft.hextooidstr(r)),e.content={hex:n},e},this.getSignerInfos=function(t){for(var e=[],r=h(t,0),n=0;n<r.length;n++){var i=s(t,r[n]),o=this.getSignerInfo(i);e.push(o)}return e},this.getSignerInfo=function(t){var e={},i=h(t,0),o=n.getInt(t,i[0],-1);-1!=o&&(e.version=o);var u=s(t,i[1]),l=this.getIssuerAndSerialNumber(u);e.id=l;var f=s(t,i[2]),p=r.getAlgorithmIdentifierName(f);e.hashalg=p;var g=a(t,0,["[0]"]);if(null!=g){var d=this.getAttributeList(g);e.sattrs=d}var v=a(t,0,[3]),m=r.getAlgorithmIdentifierName(v);e.sigalg=m;var y=c(t,0,[4]);e.sighex=y;var x=a(t,0,["[1]"]);if(null!=x){var w=this.getAttributeList(x);e.uattrs=w}return e},this.getSignerIdentifier=function(t){if("30"==t.substr(0,2))return this.getIssuerAndSerialNumber(t);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(t){var e={type:"isssn"},n=h(t,0),o=s(t,n[0]);e.issuer=r.getX500Name(o);var a=i(t,n[1]);return e.serial={hex:a},e},this.getAttributeList=function(t){for(var e=[],r=h(t,0),n=0;n<r.length;n++){var i=s(t,r[n]),o=this.getAttribute(i);e.push(o)}return{array:e}},this.getAttribute=function(t){var e={},r=h(t,0),i=n.getOID(t,r[0]),o=ct.asn1.x509.OID.oid2name(i);e.attr=o;var a=s(t,r[1]),u=h(a,0);if(1==u.length)e.valhex=s(a,u[0]);else{for(var c=[],l=0;l<u.length;l++)c.push(s(a,u[l]));e.valhex=c}return"contentType"==o?this.setContentType(e):"messageDigest"==o?this.setMessageDigest(e):"signingTime"==o?this.setSigningTime(e):"signingCertificate"==o?this.setSigningCertificate(e):"signingCertificateV2"==o?this.setSigningCertificateV2(e):"signaturePolicyIdentifier"==o&&this.setSignaturePolicyIdentifier(e),e},this.setContentType=function(t){var e=n.getOIDName(t.valhex,0,null);null!=e&&(t.type=e,delete t.valhex)},this.setSigningTime=function(t){var e=wt(i(t.valhex,0));t.str=e,delete t.valhex},this.setMessageDigest=function(t){var e=i(t.valhex,0);t.hex=e,delete t.valhex},this.setSigningCertificate=function(t){var e=h(t.valhex,0);if(e.length>0){for(var r=s(t.valhex,e[0]),n=h(r,0),i=[],o=0;o<n.length;o++){var a=s(r,n[o]),u=this.getESSCertID(a);i.push(u)}t.array=i}if(e.length>1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.setSignaturePolicyIdentifier=function(t){var r=h(t.valhex,0);if(r.length>0){var o=n.getOID(t.valhex,r[0]);t.oid=o}if(r.length>1){var a=new e,u=h(t.valhex,r[1]),c=s(t.valhex,u[0]),l=a.getAlgorithmIdentifierName(c);t.alg=l;var f=i(t.valhex,u[1]);t.hash=f}delete t.valhex},this.setSigningCertificateV2=function(t){var e=h(t.valhex,0);if(e.length>0){for(var r=s(t.valhex,e[0]),n=h(r,0),i=[],o=0;o<n.length;o++){var a=s(r,n[o]),u=this.getESSCertIDv2(a);i.push(u)}t.array=i}if(e.length>1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.getESSCertID=function(t){var e={},r=h(t,0);if(r.length>0){var n=i(t,r[0]);e.hash=n}if(r.length>1){var o=s(t,r[1]),a=this.getIssuerSerial(o);null!=a.serial&&(e.serial=a.serial),null!=a.issuer&&(e.issuer=a.issuer)}return e},this.getESSCertIDv2=function(e){var n={},o=h(e,0);if(o.length<1||3<o.length)throw new t("wrong number of elements");var a=0;if("30"==e.substr(o[0],2)){var u=s(e,o[0]);n.alg=r.getAlgorithmIdentifierName(u),a++}else n.alg="sha256";var c=i(e,o[a]);if(n.hash=c,o.length>a+1){var l=s(e,o[a+1]),f=this.getIssuerSerial(l);n.issuer=f.issuer,n.serial=f.serial}return n},this.getIssuerSerial=function(t){var e={},n=h(t,0),o=s(t,n[0]),a=r.getGeneralNames(o)[0].dn;e.issuer=a;var u=i(t,n[1]);return e.serial={hex:u},e},this.getCertificateSet=function(t){for(var e=h(t,0),r=[],n=0;n<e.length;n++){var i=s(t,e[n]);if("30"==i.substr(0,2)){var o=Ft(i,"CERTIFICATE");r.push(o)}}return{array:r,sortflag:!1}}},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.tsp&&ct.asn1.tsp||(ct.asn1.tsp={}),ct.asn1.tsp.TimeStampToken=function(t){var e=ct.asn1.tsp;e.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var t=new e.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=t.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.tsp.TimeStampToken,ct.asn1.cms.SignedData),ct.asn1.tsp.TSTInfo=function(t){var e=ct.asn1,r=e.DERSequence,n=e.DERInteger,i=e.DERBoolean,s=e.DERGeneralizedTime,o=e.DERObjectIdentifier,a=e.DERTaggedObject,u=e.tsp,c=u.MessageImprint,h=u.Accuracy,l=e.x509.GeneralName;if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new n({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var t=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(t.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(t.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(t.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");t.push(this.dGenTime),null!=this.dAccuracy&&t.push(this.dAccuracy),null!=this.dOrdering&&t.push(this.dOrdering),null!=this.dNonce&&t.push(this.dNonce),null!=this.dTsa&&t.push(this.dTsa);var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t){if("string"==typeof t.policy){if(!t.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new o({oid:t.policy})}void 0!==t.messageImprint&&(this.dMessageImprint=new c(t.messageImprint)),void 0!==t.serial&&(this.dSerial=new n(t.serial)),void 0!==t.genTime&&(this.dGenTime=new s(t.genTime)),void 0!==t.accuracy&&(this.dAccuracy=new h(t.accuracy)),void 0!==t.ordering&&1==t.ordering&&(this.dOrdering=new i),void 0!==t.nonce&&(this.dNonce=new n(t.nonce)),void 0!==t.tsa&&(this.dTsa=new a({tag:"a0",explicit:!0,obj:new l({dn:t.tsa})}))}},Gt(ct.asn1.tsp.TSTInfo,ct.asn1.ASN1Object),ct.asn1.tsp.Accuracy=function(t){var e=ct.asn1,r=e.ASN1Util.newObject;e.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return null!=t.seconds&&"number"==typeof t.seconds&&e.push({int:t.seconds}),null!=t.millis&&"number"==typeof t.millis&&e.push({tag:{tagi:"80",obj:{int:t.millis}}}),null!=t.micros&&"number"==typeof t.micros&&e.push({tag:{tagi:"81",obj:{int:t.micros}}}),r({seq:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.tsp.Accuracy,ct.asn1.ASN1Object),ct.asn1.tsp.MessageImprint=function(t){var e=ct.asn1,r=e.DERSequence,n=e.DEROctetString,i=e.x509.AlgorithmIdentifier;e.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=new i({name:t.alg}),s=new n({hex:t.hash});return new r({array:[e,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.tsp.MessageImprint,ct.asn1.ASN1Object),ct.asn1.tsp.TimeStampReq=function(t){var e=ct.asn1,r=e.DERSequence,n=e.DERInteger,i=e.DERBoolean,s=e.DERObjectIdentifier,o=e.tsp,a=o.MessageImprint;o.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return e.push(new n({int:1})),t.messageImprint instanceof ct.asn1.ASN1Object?e.push(t.messageImprint):e.push(new a(t.messageImprint)),null!=t.policy&&e.push(new s(t.policy)),null!=t.nonce&&e.push(new n(t.nonce)),1==t.certreq&&e.push(new i),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.tsp.TimeStampReq,ct.asn1.ASN1Object),ct.asn1.tsp.TimeStampResp=function(t){var e=ct.asn1,r=e.DERSequence,n=e.tsp,i=n.PKIStatusInfo;n.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,s=[];if(null!=t.econtent||null!=t.tst)if(null!=t.statusinfo?s.push(new i(t.statusinfo)):s.push(new i("granted")),null!=t.econtent)s.push(new n.TimeStampToken(t).getContentInfo());else{if(!(t.tst instanceof e.ASN1Object))throw new Error("improper member tst value");s.push(t.tst)}else{if(null==t.statusinfo)throw new Error("parameter for token nor statusinfo not specified");s.push(new i(t.statusinfo))}return new r({array:s}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.tsp.TimeStampResp,ct.asn1.ASN1Object),ct.asn1.tsp.PKIStatusInfo=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.tsp,s=i.PKIStatus,o=i.PKIFreeText,a=i.PKIFailureInfo;i.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,r=[];if("string"==typeof t)r.push(new s(t));else{if(null==t.status)throw new e("property 'status' unspecified");r.push(new s(t.status)),null!=t.statusstr&&r.push(new o(t.statusstr)),null!=t.failinfo&&r.push(new a(t.failinfo))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.tsp.PKIStatusInfo,ct.asn1.ASN1Object),ct.asn1.tsp.PKIStatus=function(t){var e=Error,r=ct.asn1,n=r.DERInteger;r.tsp.PKIStatus.superclass.constructor.call(this);var i={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var t,r=this.params;if("string"==typeof r)try{t=i[r]}catch(t){throw new e("undefined name: "+r)}else{if("number"!=typeof r)throw new e("unsupported params");t=r}return new n({int:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.tsp.PKIStatus,ct.asn1.ASN1Object),ct.asn1.tsp.PKIFreeText=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.DERUTF8String;r.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!(t instanceof Array))throw new e("wrong params: not array");for(var r=[],s=0;s<t.length;s++)r.push(new i({str:t[s]}));return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.tsp.PKIFreeText,ct.asn1.ASN1Object),ct.asn1.tsp.PKIFailureInfo=function(t){var e=Error,r=ct.asn1,n=r.DERBitString,i=r.tsp.PKIFailureInfo,s={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};i.superclass.constructor.call(this),this.params=null,this.getBinValue=function(){var t=this.params,r=0;if("number"==typeof t&&0<=t&&t<=25){for(var n=(r|=1<<t).toString(2),i="",o=n.length-1;o>=0;o--)i+=n[o];return i}if("string"==typeof t&&null!=s[t])return zt([t],s);if("object"==typeof t&&null!=t.length)return zt(t,s);throw new e("wrong params")},this.tohex=function(){var t=this.getBinValue();return new n({bin:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.tsp.PKIFailureInfo,ct.asn1.ASN1Object),ct.asn1.tsp.AbstractTSAAdapter=function(t){this.getTSTHex=function(t,e){throw"not implemented yet"}},ct.asn1.tsp.SimpleTSAAdapter=function(t){var e=ct,r=e.asn1.tsp,n=e.crypto.Util.hashHex;r.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(t,e){var i=n(t,e);this.params.econtent.content.messageImprint={alg:e,hash:i},this.params.econtent.content.serial={int:this.serial++};var s=Math.floor(1e9*Math.random());return this.params.econtent.content.nonce={int:s},new r.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==t&&(this.params=t)},Gt(ct.asn1.tsp.SimpleTSAAdapter,ct.asn1.tsp.AbstractTSAAdapter),ct.asn1.tsp.FixedTSAAdapter=function(t){var e=ct,r=e.asn1.tsp,n=e.crypto.Util.hashHex;r.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(t,e){var i=n(t,e);return this.params.econtent.content.messageImprint={alg:e,hash:i},new r.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==t&&(this.params=t)},Gt(ct.asn1.tsp.FixedTSAAdapter,ct.asn1.tsp.AbstractTSAAdapter),ct.asn1.tsp.TSPUtil=new function(){},ct.asn1.tsp.TSPUtil.newTimeStampToken=function(t){return new ct.asn1.tsp.TimeStampToken(t)},ct.asn1.tsp.TSPUtil.parseTimeStampReq=function(t){return(new ct.asn1.tsp.TSPParser).getTimeStampReq(t)},ct.asn1.tsp.TSPUtil.parseMessageImprint=function(t){return(new ct.asn1.tsp.TSPParser).getMessageImprint(t)},ct.asn1.tsp.TSPParser=function(){var t=new Zt,e=ft,r=e.getV,n=e.getTLV,i=e.getIdxbyList,s=e.getChildIdx,o=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],a={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(t){var e=s(t,0);if(1==e.length)return this.getPKIStatusInfo(n(t,e[0]));if(e.length>1){var r=this.getPKIStatusInfo(n(t,e[0])),i=n(t,e[1]),o=this.getToken(i);return o.statusinfo=r,o}},this.getToken=function(t){var e=(new ct.asn1.cms.CMSParser).getCMSSignedData(t);return this.setTSTInfo(e),e},this.setTSTInfo=function(t){var e=t.econtent;if("tstinfo"==e.type){var r=e.content.hex,n=this.getTSTInfo(r);e.content=n}},this.getTSTInfo=function(e){var i={},o=s(e,0),a=r(e,o[1]);i.policy=Mt(a);var u=n(e,o[2]);i.messageImprint=this.getMessageImprint(u);var c=r(e,o[3]);i.serial={hex:c};var h=r(e,o[4]);i.genTime={str:wt(h)};var l=0;if(o.length>5&&"30"==e.substr(o[5],2)){var f=n(e,o[5]);i.accuracy=this.getAccuracy(f),l++}o.length>5+l&&"01"==e.substr(o[5+l],2)&&("ff"==r(e,o[5+l])&&(i.ordering=!0),l++);if(o.length>5+l&&"02"==e.substr(o[5+l],2)){var p=r(e,o[5+l]);i.nonce={hex:p},l++}if(o.length>5+l&&"a0"==e.substr(o[5+l],2)){var g=n(e,o[5+l]);g="30"+g.substr(2),pGeneralNames=t.getGeneralNames(g);var d=pGeneralNames[0].dn;i.tsa=d,l++}if(o.length>5+l&&"a1"==e.substr(o[5+l],2)){var v=n(e,o[5+l]);v="30"+v.substr(2);var m=t.getExtParamArray(v);i.ext=m,l++}return i},this.getAccuracy=function(t){for(var e={},n=s(t,0),i=0;i<n.length;i++){var o=t.substr(n[i],2),a=r(t,n[i]),u=parseInt(a,16);"02"==o?e.seconds=u:"80"==o?e.millis=u:"81"==o&&(e.micros=u)}return e},this.getMessageImprint=function(t){if("30"!=t.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var n={};s(t,0);var o=i(t,0,[0,0]),a=r(t,o),u=e.hextooidstr(a),c=ct.asn1.x509.OID.oid2name(u);if(""==c)throw new Error("hashAlg name undefined: "+u);var h=c,l=i(t,0,[1]);return n.alg=h,n.hash=r(t,l),n},this.getPKIStatusInfo=function(t){var e={},i=s(t,0),a=0;try{var u=r(t,i[0]),c=parseInt(u,16);e.status=o[c]}catch(t){}if(i.length>1&&"30"==t.substr(i[1],2)){var h=n(t,i[1]);e.statusstr=this.getPKIFreeText(h),a++}if(i.length>a&&"03"==t.substr(i[1+a],2)){var l=n(t,i[1+a]);e.failinfo=this.getPKIFailureInfo(l)}return e},this.getPKIFreeText=function(t){for(var r=[],n=s(t,0),i=0;i<n.length;i++)r.push(e.getString(t,n[i]));return r},this.getPKIFailureInfo=function(t){var r=e.getInt(t,0);return null!=a[r]?a[r]:r},this.getTimeStampReq=function(t){var i={certreq:!1},o=s(t,0);if(o.length<2)throw new Error("TimeStampReq must have at least 2 items");var a=n(t,o[1]);i.messageImprint=ct.asn1.tsp.TSPUtil.parseMessageImprint(a);for(var u=2;u<o.length;u++){var c=o[u],h=t.substr(c,2);if("06"==h){var l=r(t,c);i.policy=e.hextooidstr(l)}"02"==h&&(i.nonce=r(t,c)),"01"==h&&(i.certreq=!0)}return i}},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.cades&&ct.asn1.cades||(ct.asn1.cades={}),ct.asn1.cades.SignaturePolicyIdentifier=function(t){var e=ct.asn1.cades,r=e.SignaturePolicyId;e.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new r(this.params)]},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Gt(ct.asn1.cades.SignaturePolicyIdentifier,ct.asn1.cms.Attribute),ct.asn1.cades.SignaturePolicyId=function(t){var e=ct.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.cades,s=i.SignaturePolicyId,o=i.OtherHashAlgAndValue;s.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return e.push(new n(t.oid)),e.push(new o(t)),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Gt(ct.asn1.cades.SignaturePolicyId,ct.asn1.ASN1Object),ct.asn1.cades.OtherHashAlgAndValue=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.DEROctetString,s=r.x509.AlgorithmIdentifier;r.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(null==t.alg)throw new e("property 'alg' not specified");if(null==t.hash&&null==t.cert)throw new e("property 'hash' nor 'cert' not specified");var r=null;if(null!=t.hash)r=t.hash;else if(null!=t.cert){if("string"!=typeof t.cert)throw new e("cert not string");var o=t.cert;-1!=t.cert.indexOf("-----BEGIN")&&(o=At(t.cert)),r=ct.crypto.Util.hashHex(o,t.alg)}var a=[];return a.push(new s({name:t.alg})),a.push(new i({hex:r})),new n({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cades.OtherHashAlgAndValue,ct.asn1.ASN1Object),ct.asn1.cades.OtherHashValue=function(t){ct.asn1.cades.OtherHashValue.superclass.constructor.call(this);var e=Error,r=ct.asn1.DEROctetString;this.params=null,this.tohex=function(){var t=this.params;if(null==t.hash&&null==t.cert)throw new e("hash or cert not specified");var n=null;if(null!=t.hash)n=t.hash;else if(null!=t.cert){if("string"!=typeof t.cert)throw new e("cert not string");var i=t.cert;-1!=t.cert.indexOf("-----BEGIN")&&(i=At(t.cert)),n=ct.crypto.Util.hashHex(i,"sha1")}return new r({hex:n}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cades.OtherHashValue,ct.asn1.ASN1Object),ct.asn1.cades.SignatureTimeStamp=function(t){var e=Error,r=ct,n=r.lang.String.isHex,i=r.asn1,s=i.ASN1Object;i.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var t=this.params;if(null!=t.tst){if(n(t.tst))return(r=new s).hTLV=t.tst,[r];if(t.tst instanceof s)return[t.tst];throw new e("params.tst has wrong value")}if(null!=t.res){var r,i=t.res;if(i instanceof s&&(i=i.tohex()),"string"!=typeof i||!n(i))throw new e("params.res has wrong value");return ft.getTLVbyList(i,0,[1]),(r=new s).hTLV=t.tst,[r]}},null!=t&&this.setByParam(t)},Gt(ct.asn1.cades.SignatureTimeStamp,ct.asn1.cms.Attribute),ct.asn1.cades.CompleteCertificateRefs=function(t){var e=Error,r=ct,n=r.asn1,i=n.DERSequence,s=n.cades,o=s.OtherCertID,a=r.lang.String.isHex;s.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var t=this.params,r=[],n=0;n<t.array.length;n++){var s=t.array[n];if("string"==typeof s)if(-1!=s.indexOf("-----BEGIN"))s={cert:s};else{if(!a(s))throw new e("unsupported value: "+s);s={hash:s}}null!=t.alg&&null==s.alg&&(s.alg=t.alg),null!=t.hasis&&null==s.hasis&&(s.hasis=t.hasis);var u=new o(s);r.push(u)}return[new i({array:r})]},null!=t&&this.setByParam(t)},Gt(ct.asn1.cades.CompleteCertificateRefs,ct.asn1.cms.Attribute),ct.asn1.cades.OtherCertID=function(t){var e=ct.asn1,r=e.DERSequence,n=e.cms.IssuerSerial,i=e.cades,s=i.OtherHashValue,o=i.OtherHashAlgAndValue;i.OtherCertID.superclass.constructor.call(this),this.params=t,this.tohex=function(){var t=this.params;"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?t={cert:t}:_isHex(t)&&(t={hash:t}));var e=[],i=null;if(i=null!=t.alg?new o(t):new s(t),e.push(i),null!=t.cert&&1==t.hasis||null!=t.issuer&&null!=t.serial){var a=new n(t);e.push(a)}return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cades.OtherCertID,ct.asn1.ASN1Object),ct.asn1.cades.OtherHash=function(t){var e=ct,r=e.asn1.cades,n=r.OtherHashAlgAndValue,i=r.OtherHashValue,s=e.lang.String.isHex;r.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?t={cert:t}:s(t)&&(t={hash:t}));return(null!=t.alg?new n(t):new i(t)).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.cades.OtherHash,ct.asn1.ASN1Object),ct.asn1.cades.CAdESUtil=new function(){},ct.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(t){return(new ct.asn1.cms.CMSParser).getCMSSignedData(t)},ct.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(t,e,r){var n=ft,i=n.getChildIdx,s=n.getTLV,o=n.getV,a=ct.asn1,u=a.ASN1Object,c=a.cms,h=c.AttributeList,l=c.SignerInfo,f={},p=i(t,e);if(6!=p.length)throw"not supported items for SignerInfo (!=6)";var g=p.shift();f.version=s(t,g);var d=p.shift();f.si=s(t,d);var v=p.shift();f.digalg=s(t,v);var m=p.shift();f.sattrs=s(t,m);var y=p.shift();f.sigalg=s(t,y);var x=p.shift();f.sig=s(t,x),f.sigval=o(t,x);var w=null;return f.obj=new l,(w=new u).hTLV=f.version,f.obj.dCMSVersion=w,(w=new u).hTLV=f.si,f.obj.dSignerIdentifier=w,(w=new u).hTLV=f.digalg,f.obj.dDigestAlgorithm=w,(w=new u).hTLV=f.sattrs,f.obj.dSignedAttrs=w,(w=new u).hTLV=f.sigalg,f.obj.dSigAlg=w,(w=new u).hTLV=f.sig,f.obj.dSig=w,f.obj.dUnsignedAttrs=new h,f},void 0!==ct.asn1.csr&&ct.asn1.csr||(ct.asn1.csr={}),ct.asn1.csr.CertificationRequest=function(t){var e=ct.asn1,r=e.DERBitString,n=e.DERSequence,i=e.csr,s=i.CertificationRequestInfo;i.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(t){this.params=t},this.sign=function(){var t=new s(this.params).tohex(),e=new ct.crypto.Signature({alg:this.params.sigalg});e.init(this.params.sbjprvkey),e.updateHex(t);var r=e.sign();this.params.sighex=r},this.getPEM=function(){return Ft(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var t=this.params,e=new ct.asn1.csr.CertificationRequestInfo(this.params),i=new ct.asn1.x509.AlgorithmIdentifier({name:t.sigalg});if(null==t.sighex&&null!=t.sbjprvkey&&this.sign(),null==t.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var s=new r({hex:"00"+t.sighex});return new n({array:[e,i,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.csr.CertificationRequest,ct.asn1.ASN1Object),ct.asn1.csr.CertificationRequestInfo=function(t){var e=ct.asn1,r=e.DERSequence,n=e.DERInteger,i=e.DERUTF8String,s=e.DERTaggedObject,o=e.ASN1Util.newObject,a=e.csr,u=e.x509,c=u.X500Name,h=u.Extensions,l=u.SubjectPublicKeyInfo;a.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(t){null!=t&&(this.params=t)},this.tohex=function(){var t=this.params,e=[];if(e.push(new n({int:0})),e.push(new c(t.subject)),e.push(new l($t.getKey(t.sbjpubkey))),null!=t.attrs){var a=function(t){for(var e=Error,r=ct.asn1.x509.Extensions,n=[],i=0;i<t.length;i++){var s=t[i],o=s.attr;if("extensionRequest"==o){var a={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[new r(s.ext)]}]};n.push(a)}else if("unstructuredName"==o){a={seq:[{oid:"1.2.840.113549.1.9.2"},{set:s.names}]};n.push(a)}else{if("challengePassword"!=o)throw new e("unknown CSR attribute");a={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:s.password}]}]};n.push(a)}}return{set:n}}(t.attrs),u=o({tag:{tage:"a0",obj:a}});e.push(u)}else if(null!=t.extreq){var f=new h(t.extreq);u=o({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[f]}]}}});e.push(u)}else e.push(new s({tag:"a0",explicit:!1,obj:new i({str:""})}));return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Gt(ct.asn1.csr.CertificationRequestInfo,ct.asn1.ASN1Object),ct.asn1.csr.AttributeList=function(t){},Gt(ct.asn1.csr.AttributeList,ct.asn1.ASN1Object),ct.asn1.csr.CSRUtil=new function(){},ct.asn1.csr.CSRUtil.newCSRPEM=function(t){return new ct.asn1.csr.CertificationRequest(t).getPEM()},ct.asn1.csr.CSRUtil.getParam=function(t,e){var r=ft,n=r.getV,i=r.getIdxbyList,s=r.getTLVbyList,o=r.getTLVbyListEx,a=r.getVbyListEx,u={};if(-1==t.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var c=At(t,"CERTIFICATE REQUEST");e&&(u.tbs=s(c,0,[0]));try{var h=o(c,0,[0,1]);if("3000"==h)u.subject={};else{var l=new Zt;u.subject=l.getX500Name(h)}}catch(t){}var f=o(c,0,[0,2]),p=$t.getKey(f,null,"pkcs8pub");u.sbjpubkey=$t.getPEM(p,"PKCS8PUB");var g=function(t){var e=i(t,0,[0,3,0,0],"06");return"2a864886f70d01090e"!=n(t,e)?null:s(t,0,[0,3,0,1,0],"30")}(c);l=new Zt;null!=g&&(u.extreq=l.getExtParamArray(g));try{var d=o(c,0,[1],"30");l=new Zt;u.sigalg=l.getAlgorithmIdentifierName(d)}catch(t){}try{var v=a(c,0,[2]);u.sighex=v}catch(t){}return u},ct.asn1.csr.CSRUtil.verifySignature=function(t){try{var e=null;if("string"==typeof t&&-1!=t.indexOf("-----BEGIN CERTIFICATE REQUEST")?e=ct.asn1.csr.CSRUtil.getParam(t,!0):"object"==typeof t&&null!=t.sbjpubkey&&null!=t.sigalg&&null!=t.sighex&&null!=t.tbs&&(e=t),null==e)return!1;var r=new ct.crypto.Signature({alg:e.sigalg});return r.init(e.sbjpubkey),r.updateHex(e.tbs),r.verify(e.sighex)}catch(t){return alert(t),!1}},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.ocsp&&ct.asn1.ocsp||(ct.asn1.ocsp={}),ct.asn1.ocsp.DEFAULT_HASH="sha1",ct.asn1.ocsp.OCSPResponse=function(t){ct.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);var e=ct.asn1.ASN1Util.newObject,r=ct.asn1.ocsp.ResponseBytes,n=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var t=this.params.resstatus;return"number"==typeof t?t:"string"!=typeof t?-1:n.indexOf(t)},this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params,n=this._getStatusCode();if(-1==n)throw new Error("responseStatus not supported: "+t.resstatus);if(0!=n)return e({seq:[{enum:{int:n}}]}).tohex();var i=new r(t);return e({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:i}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.ocsp.OCSPResponse,ct.asn1.ASN1Object),ct.asn1.ocsp.ResponseBytes=function(t){ct.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var e=ct.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.DEROctetString,s=e.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if("ocspBasic"!=t.restype)throw new Error("not supported responseType: "+t.restype);var e=new s(t),o=[];return o.push(new n({name:"ocspBasic"})),o.push(new i({hex:e.tohex()})),new r({array:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.ocsp.ResponseBytes,ct.asn1.ASN1Object),ct.asn1.ocsp.BasicOCSPResponse=function(t){ct.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var e=Error,r=ct.asn1,n=r.ASN1Object,i=r.DERSequence,s=r.DERTaggedObject,o=r.DERBitString,a=r.x509.AlgorithmIdentifier,u=r.ocsp;_SingleResponseList=u.SingleResponseList,_ResponseData=u.ResponseData,this.params=null,this.setByParam=function(t){this.params=t},this.sign=function(){var t=this.params,e=t.tbsresp.tohex(),r=new ct.crypto.Signature({alg:t.sigalg});r.init(t.reskey),r.updateHex(e),t.sighex=r.sign()},this.tohex=function(){var t=this.params;null==t.tbsresp&&(t.tbsresp=new _ResponseData(t)),null==t.sighex&&null!=t.reskey&&this.sign();var r=[];if(r.push(t.tbsresp),r.push(new a({name:t.sigalg})),r.push(new o({hex:"00"+t.sighex})),null!=t.certs&&null!=t.certs.length){for(var u=[],c=0;c<t.certs.length;c++){var h=t.certs[c],l=null;if(ft.isASN1HEX(h))l=h;else{if(!h.match(/-----BEGIN/))throw new e("certs["+c+"] not hex or PEM");l=At(h)}u.push(new n({tlv:l}))}var f=new i({array:u});r.push(new s({tag:"a0",explicit:!0,obj:f}))}return new i({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.ocsp.BasicOCSPResponse,ct.asn1.ASN1Object),ct.asn1.ocsp.ResponseData=function(t){ct.asn1.ocsp.ResponseData.superclass.constructor.call(this);var e=ct.asn1,r=e.DERSequence,n=e.DERGeneralizedTime,i=e.DERTaggedObject,s=e.x509.Extensions,o=e.ocsp,a=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.tohex=function(){var t=this.params,e=[];if(e.push(new a(t.respid)),e.push(new n(t.prodat)),e.push(new _SingleResponseList(t.array)),null!=t.ext){var o=new s(t.ext);e.push(new i({tag:"a1",explicit:!0,obj:o}))}return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.ocsp.ResponseData,ct.asn1.ASN1Object),ct.asn1.ocsp.ResponderID=function(t){ct.asn1.ocsp.ResponderID.superclass.constructor.call(this);var e=ct,r=e.asn1,n=r.ASN1Util.newObject,i=r.x509.X500Name,s=e.lang.String.isHex,o=Error;this.params=null,this.tohex=function(){var t=this.params;if(null!=t.key){var e,r=null;if("string"==typeof t.key){if(s(t.key)&&(r=t.key),t.key.match(/-----BEGIN CERTIFICATE/))null!=(e=new Zt(t.key).getExtSubjectKeyIdentifier())&&(r=e.kid.hex)}else if(t.key instanceof Zt)null!=(e=t.key.getExtSubjectKeyIdentifier())&&(r=e.kid.hex);if(null==r)throw new o("wrong key member value");return n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:r}}}}).tohex()}if(null!=t.name){var a=null;if("string"==typeof t.name&&t.name.match(/-----BEGIN CERTIFICATE/))a=new Zt(t.name).getSubject();else t.name instanceof Zt?a=t.name.getSubject():"object"!=typeof t.name||null==t.name.array&&null==t.name.str||(a=t.name);if(null==a)throw new o("wrong name member value");return n({tag:{tag:"a1",explicit:!0,obj:new i(a)}}).tohex()}throw new o("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.ocsp.ResponderID,ct.asn1.ASN1Object),ct.asn1.ocsp.SingleResponseList=function(t){ct.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var e=ct.asn1,r=e.DERSequence,n=e.ocsp.SingleResponse;this.params=null,this.tohex=function(){var t=this.params;if("object"!=typeof t||null==t.length)throw new Error("params not specified properly");for(var e=[],i=0;i<t.length;i++)e.push(new n(t[i]));return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.ocsp.SingleResponseList,ct.asn1.ASN1Object),ct.asn1.ocsp.SingleResponse=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.DERGeneralizedTime,s=r.DERTaggedObject,o=r.ocsp,a=o.CertID,u=o.CertStatus,c=r.x509.Extensions;o.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,r=[];if(null==t.certid)throw new e("certid unspecified");if(null==t.status)throw new e("status unspecified");if(null==t.thisupdate)throw new e("thisupdate unspecified");if(r.push(new a(t.certid)),r.push(new u(t.status)),r.push(new i(t.thisupdate)),null!=t.nextupdate){var o=new i(t.nextupdate);r.push(new s({tag:"a0",explicit:!0,obj:o}))}if(null!=t.ext){var h=new c(t.ext);r.push(new s({tag:"a1",explicit:!0,obj:h}))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.ocsp.SingleResponse,ct.asn1.ASN1Object),ct.asn1.ocsp.CertID=function(t){var e=ct,r=e.asn1,n=r.DEROctetString,i=r.DERInteger,s=r.DERSequence,o=r.x509.AlgorithmIdentifier,a=r.ocsp,u=e.crypto.Util.hashHex,c=Zt,h=ft.getVbyList;a.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(t,e,r,n){null==n&&(n=this.DEFAULT_HASH),this.params={alg:n,issname:t,isskey:e,sbjsn:r}},this.setByCert=function(t,e,r){null==r&&(r=this.DEFAULT_HASH),this.params={alg:r,issuerCert:t,subjectCert:e}},this.getParamByCerts=function(t,e,r){null==r&&(r=this.DEFAULT_HASH);var n=new c(t),i=new c(e),s=u(n.getSubjectHex(),r),o=n.getPublicKeyHex();return{alg:r,issname:s,isskey:u(h(o,0,[1],"03",!0),r),sbjsn:i.getSerialNumberHex()}},this.tohex=function(){if("object"!=typeof this.params)throw new Error("params not set");var t,e,r,a,u=this.params;if(a=null==u.alg?this.DEFAULT_HASH:u.alg,null!=u.issuerCert&&null!=u.subjectCert){var c=this.getParamByCerts(u.issuerCert,u.subjectCert,a);t=c.issname,e=c.isskey,r=c.sbjsn}else{if(null==u.issname||null==u.isskey||null==u.sbjsn)throw new Error("required param members not defined");t=u.issname,e=u.isskey,r=u.sbjsn}var h=new o({name:a}),l=new n({hex:t}),f=new n({hex:e}),p=new i({hex:r}),g=new s({array:[h,l,f,p]});return this.hTLV=g.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.ocsp.CertID,ct.asn1.ASN1Object),ct.asn1.ocsp.CertStatus=function(t){ct.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if("good"==t.status)return"8000";if("unknown"==t.status)return"8200";if("revoked"==t.status){var e=[{gentime:{str:t.time}}];null!=t.reason&&e.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:t.reason}}}});var r={tag:"a1",explicit:!1,obj:{seq:e}};return ct.asn1.ASN1Util.newObject({tag:r}).tohex()}throw new Error("bad status")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Gt(ct.asn1.ocsp.CertStatus,ct.asn1.ASN1Object),ct.asn1.ocsp.Request=function(t){var e=ct.asn1,r=e.DERSequence,n=e.ocsp;if(n.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.tohex=function(){var t=[];if(null===this.dReqCert)throw"reqCert not set";t.push(this.dReqCert);var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t){var i=new n.CertID(t);this.dReqCert=i}},Gt(ct.asn1.ocsp.Request,ct.asn1.ASN1Object),ct.asn1.ocsp.TBSRequest=function(t){var e=ct.asn1,r=e.DERSequence,n=e.ocsp;n.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(t){for(var e=[],r=0;r<t.length;r++){var i=new n.Request(t[0]);e.push(i)}this.dRequestList=e},this.tohex=function(){var t=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var e=new r({array:this.dRequestList});if(t.push(e),null!==this.dRequestExt)throw"requestExtensions not supported";var n=new r({array:t});return this.hTLV=n.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&void 0!==t.reqList&&this.setRequestListByParam(t.reqList)},Gt(ct.asn1.ocsp.TBSRequest,ct.asn1.ASN1Object),ct.asn1.ocsp.OCSPRequest=function(t){var e=ct.asn1,r=e.DERSequence,n=e.ocsp;if(n.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.tohex=function(){var t=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(t.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&void 0!==t.reqList){var i=new n.TBSRequest(t);this.dTbsRequest=i}},Gt(ct.asn1.ocsp.OCSPRequest,ct.asn1.ASN1Object),ct.asn1.ocsp.OCSPUtil={},ct.asn1.ocsp.OCSPUtil.getRequestHex=function(t,e,r){var n=ct.asn1.ocsp;void 0===r&&(r=n.DEFAULT_HASH);var i={alg:r,issuerCert:t,subjectCert:e};return new n.OCSPRequest({reqList:[i]}).tohex()},ct.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(t){var e=ft,r=e.getVbyList,n=e.getVbyListEx,i=e.getIdxbyList,s=e.getV,o={};try{var a=n(t,0,[0],"0a");o.responseStatus=parseInt(a,16)}catch(t){}if(0!==o.responseStatus)return o;try{var u=i(t,0,[1,0,1,0,0,2,0,1]);"80"===t.substr(u,2)?o.certStatus="good":"a1"===t.substr(u,2)?(o.certStatus="revoked",o.revocationTime=wt(r(t,u,[0]))):"82"===t.substr(u,2)&&(o.certStatus="unknown")}catch(t){}try{var c=i(t,0,[1,0,1,0,0,2,0,2]);o.thisUpdate=wt(s(t,c))}catch(t){}try{var h=i(t,0,[1,0,1,0,0,2,0,3]);"a0"===t.substr(h,2)&&(o.nextUpdate=wt(r(t,h,[0])))}catch(t){}return o},ct.asn1.ocsp.OCSPParser=function(){var t=Error,e=Zt,r=new e,n=ft,i=n.getV,s=n.getTLV,o=n.getIdxbyList,a=n.getVbyList,u=n.getTLVbyList,c=n.getVbyListEx,h=n.getTLVbyListEx,l=n.getChildIdx;this.getOCSPRequest=function(e){var r=l(e,0);if(1!=r.length&&2!=r.length)throw new t("wrong number elements: "+r.length);return this.getTBSRequest(s(e,r[0]))},this.getTBSRequest=function(t){var e={},n=h(t,0,[0],"30");e.array=this.getRequestList(n);var i=h(t,0,["[2]",0],"30");return null!=i&&(e.ext=r.getExtParamArray(i)),e},this.getRequestList=function(t){for(var e=[],r=l(t,0),n=0;n<r.length;n++){t=s(t,r[n]);e.push(this.getRequest(t))}return e},this.getRequest=function(e){var n=l(e,0);if(1!=n.length&&2!=n.length)throw new t("wrong number elements: "+n.length);var i=this.getCertID(s(e,n[0]));if(2==n.length){var a=o(e,0,[1,0]);i.ext=r.getExtParamArray(s(e,a))}return i},this.getCertID=function(r){var n=l(r,0);if(4!=n.length)throw new t("wrong number elements: "+n.length);var o=new e,a={};return a.alg=o.getAlgorithmIdentifierName(s(r,n[0])),a.issname=i(r,n[1]),a.isskey=i(r,n[2]),a.sbjsn=i(r,n[3]),a},this.getOCSPResponse=function(t){var e,r=l(t,0),n=i(t,r[0]),s=parseInt(n);if(1==r.length)return{resstatus:s};var o=u(t,0,[1,0]);return(e=this.getResponseBytes(o)).resstatus=s,e},this.getResponseBytes=function(t){var e,r=l(t,0),n=u(t,0,[1,0]);e=this.getBasicOCSPResponse(n);var s=i(t,r[0]);return e.restype=ct.asn1.x509.OID.oid2name(Mt(s)),e},this.getBasicOCSPResponse=function(t){var e,r=l(t,0);e=this.getResponseData(s(t,r[0]));var n=new Zt;e.alg=n.getAlgorithmIdentifierName(s(t,r[1]));var o=i(t,r[2]);e.sighex=o.substr(2);var a=c(t,0,["[0]"]);if(null!=a){for(var u=l(a,0),h=[],f=0;f<u.length;f++){var p=s(a,u[f]);h.push(p)}e.certs=h}return e},this.getResponseData=function(t){var e=l(t,0),r=e.length,n={},o=0;"a0"==t.substr(e[0],2)&&o++,n.respid=this.getResponderID(s(t,e[o++]));var a=i(t,e[o++]);if(n.prodat=wt(a),n.array=this.getSingleResponseList(s(t,e[o++])),"a1"==t.substr(e[r-1],2)){var c=u(t,e[r-1],[0]),h=new Zt;n.ext=h.getExtParamArray(c)}return n},this.getResponderID=function(t){var e={};if("a2"==t.substr(0,2)){var r=a(t,0,[0]);e.key=r}if("a1"==t.substr(0,2)){var n=u(t,0,[0]),i=new Zt;e.name=i.getX500Name(n)}return e},this.getSingleResponseList=function(t){for(var e=l(t,0),r=[],n=0;n<e.length;n++){var i=this.getSingleResponse(s(t,e[n]));r.push(i)}return r},this.getSingleResponse=function(t){var e=l(t,0),r={},n=this.getCertID(s(t,e[0]));r.certid=n;var o=this.getCertStatus(s(t,e[1]));if(r.status=o,"18"==t.substr(e[2],2)){var c=i(t,e[2]);r.thisupdate=wt(c)}for(var h=3;h<e.length;h++){if("a0"==t.substr(e[h],2)){var f=a(t,e[h],[0],"18");r.nextupdate=wt(f)}if("a1"==t.substr(e[h],2)){var p=new Zt,g=u(t,0,[h,0]);r.ext=p.getExtParamArray(g)}}return r},this.getCertStatus=function(t){var e={};if("8000"==t)return{status:"good"};if("8200"==t)return{status:"unknown"};if("a1"==t.substr(0,2)){e.status="revoked";var r=wt(a(t,0,[0]));e.time=r}return e}},void 0!==ct&&ct||(ct={}),void 0!==ct.lang&&ct.lang||(ct.lang={}),ct.lang.String=function(){},"function"==typeof Buffer?(ht=function(t){return dt(Buffer.from(t,"utf8").toString("base64"))},lt=function(t){return Buffer.from(vt(t),"base64").toString("utf8")}):(ht=function(t){return mt(Dt(jt(t)))},lt=function(t){return decodeURIComponent(Pt(yt(t)))}),ct.lang.String.isInteger=function(t){return!!t.match(/^[0-9]+$/)||!!t.match(/^-[0-9]+$/)},ct.lang.String.isHex=function(t){return Ht(t)},ct.lang.String.isBase64=function(t){return!(!(t=t.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||t.length%4!=0)},ct.lang.String.isBase64URL=function(t){return!t.match(/[+/=]/)&&(t=vt(t),ct.lang.String.isBase64(t))},ct.lang.String.isIntegerArray=function(t){return!!(t=t.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},ct.lang.String.isPrintable=function(t){return null!==t.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},ct.lang.String.isIA5=function(t){return null!==t.match(/^[\x20-\x21\x23-\x7f]*$/)},ct.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var Ut=function(t,e,r){return null==r&&(r="0"),t.length>=e?t:new Array(e-t.length+1).join(r)+t};function zt(t,e){for(var r=0,n=0;n<t.length;n++)r|=1<<e[t[n]];var i=r.toString(2),s="";for(n=i.length-1;n>=0;n--)s+=i[n];return s}function Wt(t,e,r){if("object"==typeof t){e=String(e).split(".");for(var n=0;n<e.length&&t;n++){var i=e[n];i.match(/^[0-9]+$/)&&(i=parseInt(i)),t=t[i]}return t||!1===t?t:r}}function Gt(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}void 0!==ct&&ct||(ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:v.algo.MD5,sha1:v.algo.SHA1,sha224:v.algo.SHA224,sha256:v.algo.SHA256,sha384:v.algo.SHA384,sha512:v.algo.SHA512,ripemd160:v.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="0001",o="00"+n,a="",u=i-4-o.length,c=0;c<u;c+=2)a+="ff";return s+a+o},this.hashString=function(t,e){return new ct.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new ct.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,"sha1")},this.sha256=function(t){return this.hashString(t,"sha256")},this.sha256Hex=function(t){return this.hashHex(t,"sha256")},this.sha512=function(t){return this.hashString(t,"sha512")},this.sha512Hex=function(t){return this.hashHex(t,"sha512")},this.isKey=function(t){return t instanceof it||t instanceof ct.crypto.DSA||t instanceof ct.crypto.ECDSA}},ct.crypto.Util.md5=function(t){return new ct.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(t)},ct.crypto.Util.ripemd160=function(t){return new ct.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(t)},ct.crypto.Util.SECURERANDOMGEN=new rt,ct.crypto.Util.getRandomHexOfNbytes=function(t){var e=new Array(t);return ct.crypto.Util.SECURERANDOMGEN.nextBytes(e),pt(e)},ct.crypto.Util.getRandomBigIntegerOfNbytes=function(t){return new S(ct.crypto.Util.getRandomHexOfNbytes(t),16)},ct.crypto.Util.getRandomHexOfNbits=function(t){var e=t%8,r=new Array((t-e)/8+1);return ct.crypto.Util.SECURERANDOMGEN.nextBytes(r),r[0]=(255<<e&255^255)&r[0],pt(r)},ct.crypto.Util.getRandomBigIntegerOfNbits=function(t){return new S(ct.crypto.Util.getRandomHexOfNbits(t),16)},ct.crypto.Util.getRandomBigIntegerZeroToMax=function(t){for(var e=t.bitLength();;){var r=ct.crypto.Util.getRandomBigIntegerOfNbits(e);if(t.compareTo(r)>=0)return r}},ct.crypto.Util.getRandomBigIntegerMinToMax=function(t,e){var r=t.compareTo(e);if(r>0)throw"biMin is greater than biMax";if(0==r)return t;var n=e.subtract(t);return ct.crypto.Util.getRandomBigIntegerZeroToMax(n).add(t)},ct.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=ct.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=ct.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=ct.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=v.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(v.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},ct.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},ct.crypto.MessageDigest.getHashLength=function(t){var e=ct.crypto.MessageDigest,r=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[r])throw"not supported algorithm: "+t;return e.HASHLENGTH[r]},ct.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},ct.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==(t=t.toLowerCase())&&(t="hmacsha1"),"hmac"!=(t=t.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=ct.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var r=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(r)&&"cryptojs"==e){try{var n=ct.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[r];this.mac=v.algo.HMAC.create(n,this.pass)}catch(t){throw"setAlgAndProvider hash alg set fail hashAlg="+r+"/"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=v.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(v.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=bt(t)),void(this.pass=v.enc.Hex.parse(e))}if("object"!=typeof t)throw"KJUR.crypto.Mac unsupported password type: "+t;e=null;if(void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=xt(t.utf8)),void 0!==t.rstr&&(e=bt(t.rstr)),void 0!==t.b64&&(e=w(t.b64)),void 0!==t.b64u&&(e=yt(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=v.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},ct.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw new Error("provider not supported: "+e);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new ct.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t)}this.init=function(t,e){var r=null;try{r=void 0===e?$t.getKey(t):$t.getKey(t,e)}catch(t){throw"init failed:"+t}if(!0===r.isPrivate)this.prvKey=r,this.state="SIGN";else{if(!0!==r.isPublic)throw"init failed.:"+r;this.pubKey=r,this.state="VERIFY"}},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==ct.crypto.ECDSA&&(this.prvKey=new ct.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof it&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof it&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof ct.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof ct.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==ct.crypto.ECDSA&&(this.pubKey=new ct.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof it&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof it&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ct.crypto.ECDSA&&this.pubKey instanceof ct.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ct.crypto.DSA&&this.pubKey instanceof ct.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(t){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(t){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=$t.getKey(t.prvkeypem);this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},ct.crypto.Cipher=function(t){},ct.crypto.Cipher.encrypt=function(t,e,r,n){if(null!=Wt(n,"enclag")&&(r=n.encalg),"string"==typeof r&&"-CBC"==r.substr(-4)){var i=e,s=t;null!=Wt(n,"key")&&(i=n.key),null!=Wt(n,"enc")&&(hEnc=n.enc);var o,a=v.enc.Hex.parse(i),u=v.enc.Hex.parse(s),c=v.enc.Hex.parse(n.iv);if("des-EDE3-CBC"==r)o=v.TripleDES.encrypt(u,a,{iv:c});else{if("aes128-CBC"!=r&&"aes256-CBC"!=r)throw new Error("unsupported algorithm: "+r);o=v.AES.encrypt(u,a,{iv:c})}return o+""}throw new Error("Cipher.encrypt: unsupported key or algorithm")},ct.crypto.Cipher.decrypt=function(t,e,r,n){if(null!=Wt(n,"enclag")&&(r=n.encalg),"string"==typeof r&&"-CBC"==r.substr(-4)){var i=e,s=t;null!=Wt(n,"key")&&(i=n.key),null!=Wt(n,"enc")&&(s=n.enc);var o,a=v.enc.Hex.parse(i),u=v.enc.Hex.parse(s),c=v.enc.Hex.parse(n.iv);if("des-EDE3-CBC"==r)o=v.TripleDES.decrypt({ciphertext:u},a,{iv:c});else{if("aes128-CBC"!=r&&"aes256-CBC"!=r)throw new Error("unsupported algorithm: "+r);o=v.AES.decrypt({ciphertext:u},a,{iv:c})}return v.enc.Hex.stringify(o)}throw new Error("Cipher.decrypt: unsupported key or algorithm")},ct.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040022":"secp384r1","2b81040023":"secp521r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==ct&&ct||(ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.ECDSA=function(t){var e=Error,r=S,n=ot,i=ct.crypto.ECDSA,s=ct.crypto.ECParameterDB,o=i.getName,a=ft,u=a.getVbyListEx,c=a.isASN1HEX,h=new rt;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(t){return new r(t.bitLength(),h).mod(t.subtract(r.ONE)).add(r.ONE)},this.setNamedCurve=function(t){this.ecparams=s.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.getPublicKeyXYHex=function(){var t=this.pubKeyHex;if("04"!==t.substr(0,2))throw"this method supports uncompressed format(04) only";var e=this.ecparams.keycharlen;if(t.length!==2+2*e)throw"malformed public key hex length";var r={};return r.x=t.substr(2,e),r.y=t.substr(2+e),r},this.getShortNISTPCurveName=function(){var t=this.curveName;return"secp256r1"===t||"NIST P-256"===t||"P-256"===t||"prime256v1"===t?"P-256":"secp384r1"===t||"NIST P-384"===t||"P-384"===t?"P-384":"secp521r1"===t||"NIST P-521"===t||"P-521"===t?"P-521":null},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),r=this.ecparams.keycharlen,n=("0000000000"+e.toString(16)).slice(-r);return this.setPrivateKeyHex(n),{ecprvhex:n,ecpubhex:this.generatePublicKeyHex()}},this.generatePublicKeyHex=function(){var t=new r(this.prvKeyHex,16),e=this.ecparams.G.multiply(t),n=e.getX().toBigInteger(),i=e.getY().toBigInteger(),s=this.ecparams.keycharlen,o="04"+("0000000000"+n.toString(16)).slice(-s)+("0000000000"+i.toString(16)).slice(-s);return this.setPublicKeyHex(o),o},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var n=new r(e,16),s=this.ecparams.n,o=new r(t.substring(0,this.ecparams.keycharlen),16);do{var a=this.getBigRandom(s),u=this.ecparams.G.multiply(a).getX().toBigInteger().mod(s)}while(u.compareTo(r.ZERO)<=0);var c=a.modInverse(s).multiply(o.add(n.multiply(u))).mod(s);return i.biRSSigToASN1Sig(u,c)},this.sign=function(t,e){var n=e,i=this.ecparams.n,s=r.fromByteArrayUnsigned(t);do{var o=this.getBigRandom(i),a=this.ecparams.G.multiply(o).getX().toBigInteger().mod(i)}while(a.compareTo(S.ZERO)<=0);var u=o.modInverse(i).multiply(s.add(n.multiply(a))).mod(i);return this.serializeSig(a,u)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,s){try{var o,a,u=i.parseSigHex(e);o=u.r,a=u.s;var c=n.decodeFromHex(this.ecparams.curve,s),h=new r(t.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(h,o,a,c)}catch(t){return!1}},this.verify=function(t,e,i){var s,o,a;if(Bitcoin.Util.isArray(e)){var u=this.parseSig(e);s=u.r,o=u.s}else{if("object"!=typeof e||!e.r||!e.s)throw"Invalid value for signature";s=e.r,o=e.s}if(i instanceof ot)a=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";a=n.decodeFrom(this.ecparams.curve,i)}var c=r.fromByteArrayUnsigned(t);return this.verifyRaw(c,s,o,a)},this.verifyRaw=function(t,e,n,i){var s=this.ecparams.n,o=this.ecparams.G;if(e.compareTo(r.ONE)<0||e.compareTo(s)>=0)return!1;if(n.compareTo(r.ONE)<0||n.compareTo(s)>=0)return!1;var a=n.modInverse(s),u=t.multiply(a).mod(s),c=e.multiply(a).mod(s);return o.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(s).equals(e)},this.serializeSig=function(t,e){var r=t.toByteArraySigned(),n=e.toByteArraySigned(),i=[];return i.push(2),i.push(r.length),(i=i.concat(r)).push(2),i.push(n.length),(i=i.concat(n)).unshift(i.length),i.unshift(48),i},this.parseSig=function(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(2!=t[e=2])throw new Error("First element in signature must be a DERInteger");var n=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error("Second element in signature must be a DERInteger");var i=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:r.fromByteArrayUnsigned(n),s:r.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(e<0||e>7)throw"Invalid signature type";var n=this.ecparams.n;return{r:r.fromByteArrayUnsigned(t.slice(1,33)).mod(n),s:r.fromByteArrayUnsigned(t.slice(33,65)).mod(n),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===c(t))throw new Error("not ASN.1 hex string");var e,r,n;try{e=u(t,0,["[0]",0],"06"),r=u(t,0,[1],"04");try{n=u(t,0,["[1]",0],"03")}catch(t){}}catch(t){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=o(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n,i;try{u(t,0,[1,0],"06"),r=u(t,0,[1,1],"06"),n=u(t,0,[2,0,1],"04");try{i=u(t,0,[2,0,"[1]",0],"03")}catch(t){}}catch(t){throw new e("malformed PKCS#8 plain ECC private key")}if(this.curveName=o(r),void 0===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n;try{u(t,0,[0,0],"06"),r=u(t,0,[0,1],"06"),n=u(t,0,[1],"03")}catch(t){throw new e("malformed PKCS#8 ECC public key")}if(this.curveName=o(r),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(t,r){if(!1===c(t))throw new e("not ASN.1 hex string");var n,i;try{n=u(t,0,[0,5,0,1],"06"),i=u(t,0,[0,5,1],"03")}catch(t){throw new e("malformed X.509 certificate ECC public key")}if(this.curveName=o(n),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},ct.crypto.ECDSA.parseSigHex=function(t){var e=ct.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new S(e.r,16),s:new S(e.s,16)}},ct.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=ft,r=e.getChildIdx,n=e.getV;if(e.checkStrictDER(t,0),"30"!=t.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=r(t,0);if(2!=i.length)throw new Error("signature shall have two elements");var s=i[0],o=i[1];if("02"!=t.substr(s,2))throw new Error("1st item not ASN.1 integer");if("02"!=t.substr(o,2))throw new Error("2nd item not ASN.1 integer");return{r:n(t,s),s:n(t,o)}},ct.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=ct.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");"00"==r.substr(0,2)&&(r=r.substr(2)),"00"==n.substr(0,2)&&(n=n.substr(2));var i=Math.max(r.length,n.length);return(r=("000000"+r).slice(-i))+(n=("000000"+n).slice(-i))}if("00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),"00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n},ct.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return ct.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},ct.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new S(t,16),n=new S(e,16);return ct.crypto.ECDSA.biRSSigToASN1Sig(r,n)},ct.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=ct.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e});return new r.DERSequence({array:[n,i]}).tohex()},ct.crypto.ECDSA.getName=function(t){return"2b8104001f"===t?"secp192k1":"2a8648ce3d030107"===t?"secp256r1":"2b8104000a"===t?"secp256k1":"2b81040021"===t?"secp224r1":"2b81040022"===t?"secp384r1":"2b81040023"===t?"secp521r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)?"secp256r1":-1!=="|secp256k1|".indexOf(t)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(t)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(t)?"secp384r1":-1!=="|secp521r1|NIST P-521|P-521|".indexOf(t)?"secp521r1":null},void 0!==ct&&ct||(ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new S(t,16)}this.getByName=function(r){var n=r;if(void 0!==e[n]&&(n=e[r]),void 0!==t[n])return t[n];throw"unregistered EC curve name: "+n},this.regist=function(n,i,s,o,a,u,c,h,l,f,p,g){t[n]={};var d=r(s),v=r(o),m=r(a),y=r(u),x=r(c),w=new at(d,v,m),S=w.decodePointHex("04"+h+l);t[n].name=n,t[n].keylen=i,t[n].keycharlen=2*Math.ceil(i/8),t[n].curve=w,t[n].G=S,t[n].n=y,t[n].h=x,t[n].oid=p,t[n].info=g;for(var E=0;E<f.length;E++)e[f[E]]=n}},ct.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),ct.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),ct.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),ct.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),ct.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),ct.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),ct.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),ct.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),ct.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),ct.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==ct&&ct||(ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.DSA=function(){var t=ft,e=t.getVbyListEx,r=t.isASN1HEX,n=S,i=S.ONE;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(t,e,r,n,i){this.isPrivate=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=i},this.setPrivateHex=function(t,e,r,n,i){var s,o,a,u,c;s=new S(t,16),o=new S(e,16),a=new S(r,16),u="string"==typeof n&&n.length>1?new S(n,16):null,c=new S(i,16),this.setPrivate(s,o,a,u,c)},this.setPublic=function(t,e,r,n){!function(t,e,r,n){if(null==t||null==e||null==r||null==n)throw new Error("invalid DSA public key");if(i.compareTo(e)>=0||e.compareTo(t)>=0)throw new Error("invalid DSA public key");if(i.compareTo(r)>=0||r.compareTo(t)>=0)throw new Error("invalid DSA public key");if(i.compareTo(n)>=0||n.compareTo(t)>=0)throw new Error("invalid DSA public key");if(0!=r.modPow(e,t).compareTo(i))throw new Error("invalid DSA public key")}(t,e,r,n),this.isPublic=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=null},this.setPublicHex=function(t,e,r,n){var i,s,o,a;i=new S(t,16),s=new S(e,16),o=new S(r,16),a=new S(n,16),this.setPublic(i,s,o,a)},this.signWithMessageHash=function(t){var e,r,n,i=this.p,s=this.q,o=this.g,a=this.x,u=new S(t.substr(0,s.bitLength()/4),16);do{e=ct.crypto.Util.getRandomBigIntegerMinToMax(S.ONE.add(S.ONE),s.subtract(S.ONE)),r=o.modPow(e,i).mod(s),n=e.modInverse(s).multiply(u.add(a.multiply(r))).mod(s)}while(0==r.compareTo(S.ZERO)||0==n.compareTo(S.ZERO));return ct.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:r}},{int:{bigint:n}}]})},this.verifyWithMessageHash=function(t,e){var r=this.p,n=this.q,i=this.g,s=this.y,o=this.parseASN1Signature(e),a=o[0],u=o[1],c=new S(t.substr(0,n.bitLength()/4),16);if(S.ZERO.compareTo(a)>=0||a.compareTo(n)>=0)throw"invalid DSA signature";if(S.ZERO.compareTo(u)>=0||u.compareTo(n)>=0)throw"invalid DSA signature";var h=u.modInverse(n),l=c.multiply(h).mod(n),f=a.multiply(h).mod(n);return 0==i.modPow(l,r).multiply(s.modPow(f,r)).mod(r).mod(n).compareTo(a)},this.parseASN1Signature=function(t){try{return[new n(e(t,0,[0],"02"),16),new n(e(t,0,[1],"02"),16)]}catch(t){throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(t){var n,i,s,o,a;if(!1===r(t))throw new Error("not ASN.1 hex string");try{n=e(t,0,[1],"02"),i=e(t,0,[2],"02"),s=e(t,0,[3],"02"),o=e(t,0,[4],"02"),a=e(t,0,[5],"02")}catch(t){throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(n,i,s,o,a)},this.readPKCS8PrvKeyHex=function(t){var n,i,s,o;if(!1===r(t))throw new Error("not ASN.1 hex string");try{n=e(t,0,[1,1,0],"02"),i=e(t,0,[1,1,1],"02"),s=e(t,0,[1,1,2],"02"),o=e(t,0,[2,0],"02")}catch(t){throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(n,i,s,null,o)},this.readPKCS8PubKeyHex=function(t){var n,i,s,o;if(!1===r(t))throw new Error("not ASN.1 hex string");try{n=e(t,0,[0,1,0],"02"),i=e(t,0,[0,1,1],"02"),s=e(t,0,[0,1,2],"02"),o=e(t,0,[1,0],"02")}catch(t){throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(n,i,s,o)},this.readCertPubKeyHex=function(t,n){var i,s,o,a;if(!1===r(t))throw new Error("not ASN.1 hex string");try{i=e(t,0,[0,5,0,1,0],"02"),s=e(t,0,[0,5,0,1,1],"02"),o=e(t,0,[0,5,0,1,2],"02"),a=e(t,0,[0,5,1,0],"02")}catch(t){throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(i,s,o,a)}};var $t=function(){var t=function(t,r,n){return e(v.AES,t,r,n)},e=function(t,e,r,n){var i=v.enc.Hex.parse(e),s=v.enc.Hex.parse(r),o=v.enc.Hex.parse(n),a={};a.key=s,a.iv=o,a.ciphertext=i;var u=t.decrypt(a,s,{iv:o});return v.enc.Hex.stringify(u)},r=function(t,e,r){return n(v.AES,t,e,r)},n=function(t,e,r,n){var i=v.enc.Hex.parse(e),s=v.enc.Hex.parse(r),o=v.enc.Hex.parse(n),a=t.encrypt(i,s,{iv:o}),u=v.enc.Hex.parse(a.toString());return v.enc.Base64.stringify(u)},i={"AES-256-CBC":{proc:t,eproc:r,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:r,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:r,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(t,r,n){return e(v.TripleDES,t,r,n)},eproc:function(t,e,r){return n(v.TripleDES,t,e,r)},keylen:24,ivlen:8},"DES-CBC":{proc:function(t,r,n){return e(v.DES,t,r,n)},eproc:function(t,e,r){return n(v.DES,t,e,r)},keylen:8,ivlen:8}},s=function(t){var e={},r=t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));r&&(e.cipher=r[1],e.ivsalt=r[2]);var n=t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(e.type=n[1]);var i=-1,s=0;-1!=t.indexOf("\r\n\r\n")&&(i=t.indexOf("\r\n\r\n"),s=2),-1!=t.indexOf("\n\n")&&(i=t.indexOf("\n\n"),s=1);var o=t.indexOf("-----END");if(-1!=i&&-1!=o){var a=t.substring(i+2*s,o-s);a=a.replace(/\s+/g,""),e.data=a}return e},o=function(t,e,r){for(var n=r.substring(0,16),s=v.enc.Hex.parse(n),o=v.enc.Utf8.parse(e),a=i[t].keylen+i[t].ivlen,u="",c=null;;){var h=v.algo.MD5.create();if(null!=c&&h.update(c),h.update(o),h.update(s),c=h.finalize(),(u+=v.enc.Hex.stringify(c)).length>=2*a)break}var l={};return l.keyhex=u.substr(0,2*i[t].keylen),l.ivhex=u.substr(2*i[t].keylen,2*i[t].ivlen),l},a=function(t,e,r,n){var s=v.enc.Base64.parse(t),o=v.enc.Hex.stringify(s);return(0,i[e].proc)(o,r,n)};return{version:"1.0.0",parsePKCS5PEM:function(t){return s(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return o(t,e,r)},decryptKeyB64:function(t,e,r,n){return a(t,e,r,n)},getDecryptedKeyHex:function(t,e){var r=s(t),n=r.cipher,i=r.ivsalt,u=r.data,c=o(n,e,i).keyhex;return a(u,n,c,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,n,s){var a="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===i[n])throw new Error("KEYUTIL unsupported algorithm: "+n);if(void 0===s||null==s){var u=function(t){var e=v.lib.WordArray.random(t);return v.enc.Hex.stringify(e)}(i[n].ivlen);s=u.toUpperCase()}var c=function(t,e,r,n){return(0,i[e].eproc)(t,r,n)}(e,n,o(n,r,s).keyhex,s);a="-----BEGIN "+t+" PRIVATE KEY-----\r\n";return a+="Proc-Type: 4,ENCRYPTED\r\n",a+="DEK-Info: "+n+","+s+"\r\n",a+="\r\n",a+=c.replace(/(.{64})/g,"$1\r\n"),a+="\r\n-----END "+t+" PRIVATE KEY-----\r\n"},getEncryptedPKCS8PEM:function(t,e,r){return Ft(this.getEncryptedPKCS8Hex(t,e,r),"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(t,e,r){var n;(n=null==r||null==r?{}:JSON.parse(JSON.stringify(r))).plain=t,this.initPBES2Param(n),this.encryptPBES2Param(n,e);var i=this.generatePBES2ASN1Param(n);return ct.asn1.ASN1Util.newObject(i).tohex()},initPBES2Param:function(t){var e;(null==Wt(t,"encalg")&&(t.encalg="aes256-CBC"),null==Wt(t,"iter")&&(t.iter=2048),null==Wt(t,"prf")&&(t.prf="hmacWithSHA256"),null==Wt(t,"salt")&&(t.salt=v.enc.Hex.stringify(v.lib.WordArray.random(8))),null==Wt(t,"enciv"))&&("des-EDE3-CBC"==t.encalg&&(e=8),"aes128-CBC"==t.encalg&&(e=16),"aes256-CBC"==t.encalg&&(e=16),t.enciv=v.enc.Hex.stringify(v.lib.WordArray.random(e)))},encryptPBES2Param:function(t,e){var r=$t.getDKFromPBES2Param(t,e);try{var n=ct.crypto.Cipher.encrypt(t.plain,r,t.encalg,{iv:t.enciv})}catch(e){throw new Error("encrypt error: "+t.plain+" "+r+" "+t.encalg+" "+t.enciv)}t.enc=n},generatePBES2ASN1Param:function(t){var e={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:t.salt}},{int:{hex:qt(t.iter)}}]}]},{seq:[{oid:t.encalg},{octstr:{hex:t.enciv}}]}]}]},{octstr:{hex:t.enc}}]};return"hmacWithSHA1"!=t.prf&&e.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:t.prf},{null:""}]}),e},parseHexOfEncryptedPKCS8:function(t){var e=ft,r=e.getChildIdx,n=e.getV,i={},s=r(t,0);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+s.length);i.ciphertext=n(t,s[1]);var o=r(t,s[0]);if(2!=o.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+o.length);if("2a864886f70d01050d"!=n(t,o[0]))throw new Error("this only supports pkcs5PBES2");var a=r(t,o[1]);if(2!=o.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+a.length);var u=r(t,a[1]);if(2!=u.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length);if("2a864886f70d0307"!=n(t,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=n(t,u[1]);var c=r(t,a[0]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+c.length);if("2a864886f70d01050c"!=n(t,c[0]))throw new Error("this only supports pkcs5PBKDF2");var h=r(t,c[1]);if(h.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+h.length);i.pbkdf2Salt=n(t,h[0]);var l=n(t,h[1]);try{i.pbkdf2Iter=parseInt(l,16)}catch(t){throw new Error("malformed format pbkdf2Iter: "+l)}return i},getPBKDF2KeyHexFromParam:function(t,e){var r=v.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,i=v.PBKDF2(e,r,{keySize:6,iterations:n});return v.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=At(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=$t.getPBKDF2KeyHexFromParam(n,e),s={};s.ciphertext=v.enc.Hex.parse(n.ciphertext);var o=v.enc.Hex.parse(i),a=v.enc.Hex.parse(n.encryptionSchemeIV),u=v.TripleDES.decrypt(s,o,{iv:a});return v.enc.Hex.stringify(u)},parsePBES2:function(t){var e=ft.parse(t);if("pkcs5PBES2"!=Wt(e,"seq.0.seq.0.oid")||"pkcs5PBKDF2"!=Wt(e,"seq.0.seq.1.seq.0.seq.0.oid"))throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var r=Wt(e,"seq.0.seq.1.seq.0.seq.1.seq");if(null==r)throw new Error("PBKDF2 parameter not found");var n=Wt(r,"0.octstr.hex"),i=Wt(r,"1.int.hex"),s=Wt(r,"2.seq.0.oid","hmacWithSHA1"),o=-1;try{o=parseInt(i,16)}catch(t){throw new Error("iter not proper value")}var a=Wt(e,"seq.0.seq.1.seq.1.seq.0.oid"),u=Wt(e,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),c=Wt(e,"seq.1.octstr.hex");if(null==a||null==u||null==c)throw new Error("encalg, enciv or enc is undefined");return{salt:n,iter:o,prf:s,encalg:a,enciv:u,enc:c}},getDKFromPBES2Param:function(t,e){var r={hmacWithSHA1:v.algo.SHA1,hmacWithSHA224:v.algo.SHA224,hmacWithSHA256:v.algo.SHA256,hmacWithSHA384:v.algo.SHA384,hmacWithSHA512:v.algo.SHA512}[t.prf];if(null==r)throw new Error("unsupported prf");var n={"des-EDE3-CBC":6,"aes128-CBC":4,"aes256-CBC":8}[t.encalg];if(null==n)throw new Error("unsupported encalg");var i=v.enc.Hex.parse(t.salt),s=t.iter;try{var o=v.PBKDF2(e,i,{keySize:n,iterations:s,hasher:r});return v.enc.Hex.stringify(o)}catch(r){throw new Error("PBKDF2 error: "+r+" "+JSON.stringify(t)+" "+e)}},getPlainHexFromEncryptedPKCS8PEM:function(t,e){if(-1==t.indexOf("BEGIN ENCRYPTED PRIVATE KEY"))throw new Error("not Encrypted PKCS#8 PEM string");var r,n=At(t);try{r=$t.parsePBES2(n)}catch(t){throw new Error("malformed PBES2 format: "+t.message)}var i=$t.getDKFromPBES2Param(r,e);return ct.crypto.Cipher.decrypt(r.enc,i,r.encalg,{iv:r.enciv})},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainHexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(r)},parsePlainPrivatePKCS8Hex:function(t){var e=ft,r=e.getChildIdx,n=e.getV,i={algparam:null};if("30"!=t.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var s=r(t,0);if(s.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=t.substr(s[1],2))throw new Error("malformed PKCS8 private key(code:003)");var o=r(t,s[1]);if(2!=o.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=t.substr(o[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=n(t,o[0]),"06"==t.substr(o[1],2)&&(i.algparam=n(t,o[1])),"04"!=t.substr(s[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=e.getVidx(t,s[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=At(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,r=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==r.algoid)e=new it;else if("2a8648ce380401"==r.algoid)e=new ct.crypto.DSA;else{if("2a8648ce3d0201"!=r.algoid)throw new Error("unsupported private key algorithm");e=new ct.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,r=ft.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===r)e=new it;else if("2a8648ce380401"===r)e=new ct.crypto.DSA;else{if("2a8648ce3d0201"!==r)throw new Error("unsupported PKCS#8 public key hex");e=new ct.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=ft,r=e.getChildIdx,n=e.getV,i={};if("30"!=t.substr(0,2))throw new Error("malformed RSA key(code:001)");var s=r(t,0);if(2!=s.length)throw new Error("malformed RSA key(code:002)");if("02"!=t.substr(s[0],2))throw new Error("malformed RSA key(code:003)");if(i.n=n(t,s[0]),"02"!=t.substr(s[1],2))throw new Error("malformed RSA key(code:004)");return i.e=n(t,s[1]),i},parsePublicPKCS8Hex:function(t){var e=ft,r=e.getChildIdx,n=e.getV,i={algparam:null},s=r(t,0);if(2!=s.length)throw new Error("outer DERSequence shall have 2 elements: "+s.length);var o=s[0];if("30"!=t.substr(o,2))throw new Error("malformed PKCS8 public key(code:001)");var a=r(t,o);if(2!=a.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=t.substr(a[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(i.algoid=n(t,a[0]),"06"==t.substr(a[1],2)?i.algparam=n(t,a[1]):"30"==t.substr(a[1],2)&&(i.algparam={},i.algparam.p=e.getVbyList(t,a[1],[0],"02"),i.algparam.q=e.getVbyList(t,a[1],[1],"02"),i.algparam.g=e.getVbyList(t,a[1],[2],"02")),"03"!=t.substr(s[1],2))throw new Error("malformed PKCS8 public key(code:004)");return i.key=n(t,s[1]).substr(2),i}}}();function Jt(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t}function Yt(t,e,r){for(var n="",i=0;n.length<e;)n+=Et(r(bt(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function Xt(t){for(var e in ct.crypto.Util.DIGESTINFOHEAD){var r=ct.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function Zt(t){var e,r=ft,n=r.getChildIdx,i=r.getV,s=r.parse,o=r.getTLV,a=r.getVbyList,u=r.getVbyListEx,c=r.getTLVbyList,h=r.getTLVbyListEx,l=r.getIdxbyList,f=r.getIdxbyListEx,p=r.getVidx,g=r.getInt,d=r.oidname,v=r.hextooidstr,m=At,y=Error;try{e=ct.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var t=c(this.hex,0,[0,0]);if("a0"==t.substr(0,2)){var e=c(t,0,[0]),r=g(e,0);if(r<0||2<r)throw new Error("malformed version field");return this.version=r+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var t=h(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var r in e)if(t===e[r])return r;return d(u(t,0,[0],"06"))},this.getIssuer=function(t,e){return this.getX500Name(this.getIssuerHex(),t,e)},this.getIssuerHex=function(){return c(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(t,e){return this.getX500Name(this.getSubjectHex(),t,e)},this.getSubjectHex=function(){return c(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var t=a(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=a(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return c(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var t=this.getSPKI();return null==t?null:a(t,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return l(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return $t.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var t=c(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),r=this.getSignatureValueHex(),n=c(this.hex,0,[0],"30"),i=new ct.crypto.Signature({alg:e});return i.init(t),i.updateHex(n),i.verify(r)},this.parseExt=function(t){var e,s,o;if(void 0===t){if(o=this.hex,3!==this.version)return-1;e=l(o,0,[0,7,0],"30"),s=n(o,e)}else{o=At(t);var u=l(o,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(o,u))return void(this.aExtInfo=new Array);e=l(o,0,[0,3,0,1,0],"30"),s=n(o,e),this.hex=o}this.aExtInfo=new Array;for(var c=0;c<s.length;c++){var h={critical:!1},f=0;3===n(o,s[c]).length&&(h.critical=!0,f=1),h.oid=r.hextooidstr(a(o,s[c],[0],"06"));var g=l(o,s[c],[1+f]);h.vidx=p(o,g),this.aExtInfo.push(h)}},this.getExtInfo=function(t){var e=this.aExtInfo,r=t;if(t.match(/^[0-9.]+$/)||(r=ct.asn1.x509.OID.name2oid(t)),""!==r)for(var n=0;n<e.length;n++)if(e[n].oid===r)return e[n]},this.getCriticalExtV=function(t,e,r){if(null!=e)return[e,r];var n=this.getExtInfo(t);return null==n?[null,null]:[o(this.hex,n.vidx),n.critical]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("basicConstraints");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"basicConstraints"};if(e&&(n.critical=!0),"3000"===t)return n;if("30030101ff"===t)return n.cA=!0,n;if("30060101ff02"===t.substr(0,12)){var s=i(t,10),a=parseInt(s,16);return n.cA=!0,n.pathLen=a,n}throw new Error("hExtV parse error: "+t)},this.getExtNameConstraints=function(t,e){var r=this.getCriticalExtV("nameConstraints",t,e);if(t=r[0],e=r[1],null!=t){var i={extname:"nameConstraints"};e&&(i.critical=!0);for(var s=n(t,0),a=0;a<s.length;a++){for(var u=[],c=n(t,s[a]),h=0;h<c.length;h++){var l=o(t,c[h]),f=this.getGeneralSubtree(l);u.push(f)}var p=t.substr(s[a],2);"a0"==p?i.permit=u:"a1"==p&&(i.exclude=u)}return i}},this.getGeneralSubtree=function(t){var e=n(t,0),r=e.length;if(r<1||2<r)throw new Error("wrong num elements");for(var s=this.getGeneralName(o(t,e[0])),a=1;a<r;a++){var u=t.substr(e[a],2),c=i(t,e[a]),h=parseInt(c,16);"80"==u&&(s.min=h),"81"==u&&(s.max=h)}return s},this.getExtKeyUsage=function(t,e){var r=this.getCriticalExtV("keyUsage",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"keyUsage"};return e&&(n.critical=!0),n.names=this.getExtKeyUsageString(t).split(","),n}},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo("keyUsage");if(void 0===e)return"";t=o(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error("malformed key usage value: "+t);var r="000000000000000"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(r=r.slice(-8)),10==t.length&&(r=r.slice(-16)),""==(r=r.replace(/0+$/,""))&&(r="0"),r},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),r=new Array,n=0;n<e.length;n++)"1"==e.substr(n,1)&&r.push(Zt.KEYUSAGE_NAME[n]);return r.join(",")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectKeyIdentifier");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"subjectKeyIdentifier"};e&&(n.critical=!0);var s=i(t,0);return n.kid={hex:s},n},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityKeyIdentifier");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var s={extname:"authorityKeyIdentifier"};e&&(s.critical=!0);for(var a=n(t,0),u=0;u<a.length;u++){var c=t.substr(a[u],2);if("80"===c&&(s.kid={hex:i(t,a[u])}),"a1"===c){var h=o(t,a[u]),l=this.getGeneralNames(h);s.issuer=l[0].dn}"82"===c&&(s.sn={hex:i(t,a[u])})}return s},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("extKeyUsage");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var s={extname:"extKeyUsage",array:[]};e&&(s.critical=!0);for(var a=n(t,0),u=0;u<a.length;u++)s.array.push(d(i(t,a[u])));return s},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var e=new Array,r=o(this.hex,t.vidx);if(""===r)return e;for(var s=n(r,0),a=0;a<s.length;a++)e.push(d(i(r,s[a])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectAltName");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"subjectAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("issuerAltName");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"issuerAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getGeneralNames=function(t){for(var e=n(t,0),r=[],i=0;i<e.length;i++){var s=this.getGeneralName(o(t,e[i]));void 0!==s&&r.push(s)}return r},this.getGeneralName=function(t){var e=t.substr(0,2),r=i(t,0),n=Et(r);return"81"==e?{rfc822:n}:"82"==e?{dns:n}:"86"==e?{uri:n}:"87"==e?{ip:Rt(r)}:"a4"==e?{dn:this.getX500Name(r)}:"a0"==e?{other:this.getOtherName(t)}:void 0},this.getExtSubjectAltName2=function(){var t,e,r,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var a=new Array,u=o(this.hex,s.vidx),c=n(u,0),h=0;h<c.length;h++)r=u.substr(c[h],2),t=i(u,c[h]),"81"===r&&(e=wt(t),a.push(["MAIL",e])),"82"===r&&(e=wt(t),a.push(["DNS",e])),"84"===r&&(e=Zt.hex2dn(t,0),a.push(["DN",e])),"86"===r&&(e=wt(t),a.push(["URI",e])),"87"===r&&(e=Rt(t),a.push(["IP",e]));return a},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("cRLDistributionPoints");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"cRLDistributionPoints",array:[]};e&&(i.critical=!0);for(var s=n(t,0),a=0;a<s.length;a++){var u=o(t,s[a]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),a=o(t,r[i]);"a0"==s&&(e.dpname=this.getDistributionPointName(a))}return e},this.getDistributionPointName=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),a=o(t,r[i]);"a0"==s&&(e.full=this.getGeneralNames(a))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtCRLDistributionPoints();if(null==t)return t;for(var e=t.array,r=[],n=0;n<e.length;n++)try{null!=e[n].dpname.full[0].uri&&r.push(e[n].dpname.full[0].uri)}catch(t){}return r},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},r=n(this.hex,t.vidx),i=0;i<r.length;i++){var s=a(this.hex,r[i],[0],"06"),o=a(this.hex,r[i],[1],"86");"2b06010505073001"===s&&e.ocsp.push(wt(o)),"2b06010505073002"===s&&e.caissuer.push(wt(o))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityInfoAccess");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"authorityInfoAccess",array:[]};e&&(i.critical=!0);for(var s=n(t,0),c=0;c<s.length;c++){var h=u(t,s[c],[0],"06"),l=wt(a(t,s[c],[1],"86"));if("2b06010505073001"==h)i.array.push({ocsp:l});else{if("2b06010505073002"!=h)throw new Error("unknown method: "+h);i.array.push({caissuer:l})}}return i},this.getExtCertificatePolicies=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("certificatePolicies");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"certificatePolicies",array:[]};e&&(i.critical=!0);for(var s=n(t,0),a=0;a<s.length;a++){var u=o(t,s[a]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(t){var e={},r=a(t,0,[0],"06");e.policyoid=d(r);var i=f(t,0,[1],"30");if(-1!=i){e.array=[];for(var s=n(t,i),u=0;u<s.length;u++){var c=o(t,s[u]),h=this.getPolicyQualifierInfo(c);e.array.push(h)}}return e},this.getOtherName=function(t){var e={},r=n(t,0),i=a(t,r[0],[],"06"),o=a(t,r[1],[]);return e.oid=d(i),e.value=s(o),e},this.getPolicyQualifierInfo=function(t){var e={},r=a(t,0,[0],"06");if("2b06010505070201"===r){var n=u(t,0,[1],"16");e.cps=Et(n)}else if("2b06010505070202"===r){var i=c(t,0,[1],"30");e.unotice=this.getUserNotice(i)}return e},this.getUserNotice=function(t){var e=null;try{return e=r.parse(t),this._asn1ToUnotice(e)}catch(t){return}},this._asn1ToUnotice=function(t){try{for(var e={},r=Wt(t,"seq"),n=0;n<r.length;n++){var i=this._asn1ToNoticeRef(r[n]);null!=i&&(e.noticeref=i);var s=this.asn1ToDisplayText(r[n]);null!=s&&(e.exptext=s)}return Object.keys(e).length>0?e:void 0}catch(t){return}},this._asn1ToNoticeRef=function(t){try{for(var e={},r=Wt(t,"seq"),n=0;n<r.length;n++){var i=this._asn1ToNoticeNum(r[n]);null!=i&&(e.noticenum=i);var s=this.asn1ToDisplayText(r[n]);null!=s&&(e.org=s)}return Object.keys(e).length>0?e:void 0}catch(t){return}},this._asn1ToNoticeNum=function(t){try{for(var e=Wt(t,"seq"),r=[],n=0;n<e.length;n++){var i=e[n];r.push(parseInt(Wt(i,"int.hex"),16))}return r}catch(t){return}},this.getDisplayText=function(t){var e={};return e.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[t.substr(0,2)],e.str=Et(i(t,0)),e},this.asn1ToDisplayText=function(t){return null!=t.utf8str?{type:"utf8",str:t.utf8str.str}:null!=t.ia5str?{type:"ia5",str:t.ia5str.str}:null!=t.visstr?{type:"vis",str:t.visstr.str}:null!=t.bmpstr?{type:"bmp",str:t.bmpstr.str}:null!=t.prnstr?{type:"prn",str:t.prnstr.str}:void 0},this.getExtPolicyMappings=function(t,e){var r=this.getCriticalExtV("policyMappings",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"policyMappings"};e&&(n.critical=!0);try{for(var i=s(t).seq,o=[],a=0;a<i.length;a++){var u=i[a].seq;o.push([u[0].oid,u[1].oid])}n.array=o}catch(t){throw new y("malformed policyMappings")}return n}},this.getExtPolicyConstraints=function(t,e){var r=this.getCriticalExtV("policyConstraints",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"policyConstraints"};e&&(n.critical=!0);var i=s(t);try{for(var o=i.seq,a=0;a<o.length;a++){var u=o[a].tag;0==u.explicit&&("80"==u.tag&&(n.reqexp=parseInt(u.hex,16)),"81"==u.tag&&(n.inhibit=parseInt(u.hex,16)))}}catch(t){return new y("malformed policyConstraints value")}return n}},this.getExtInhibitAnyPolicy=function(t,e){var r=this.getCriticalExtV("inhibitAnyPolicy",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"inhibitAnyPolicy"};e&&(n.critical=!0);var i=g(t,0);return-1==i?new y("wrong value"):(n.skip=i,n)}},this.getExtCRLNumber=function(t,e){var r={extname:"cRLNumber"};if(e&&(r.critical=!0),"02"==t.substr(0,2))return r.num={hex:i(t,0)},r;throw new y("hExtV parse error: "+t)},this.getExtCRLReason=function(t,e){var r={extname:"cRLReason"};if(e&&(r.critical=!0),"0a"==t.substr(0,2))return r.code=parseInt(i(t,0),16),r;throw new Error("hExtV parse error: "+t)},this.getExtOcspNonce=function(t,e){var r={extname:"ocspNonce"};e&&(r.critical=!0);var n=i(t,0);return r.hex=n,r},this.getExtOcspNoCheck=function(t,e){var r={extname:"ocspNoCheck"};return e&&(r.critical=!0),r},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("adobeTimeStamp");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var i={extname:"adobeTimeStamp"};e&&(i.critical=!0);var s=n(t,0);if(s.length>1){var a=o(t,s[1]),u=this.getGeneralName(a);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=o(t,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i},this.getExtSubjectDirectoryAttributes=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectDirectoryAttributes");if(void 0===r)return;t=o(this.hex,r.vidx),e=r.critical}var n={extname:"subjectDirectoryAttributes"};e&&(n.critical=!0);try{for(var i=s(t),a=[],u=0;u<i.seq.length;u++){var c=i.seq[u],h=Wt(c,"seq.0.oid"),l=Wt(c,"seq.1.set");if(null==h||null==l)throw"error";a.push({attr:h,array:l})}return n.array=a,n}catch(t){throw new Error("malformed subjectDirectoryAttributes extension value")}};var x=function(t){var e={};try{var r=t.seq[0].oid,n=ct.asn1.x509.OID.name2oid(r);e.type=ct.asn1.x509.OID.oid2atype(n);var i=t.seq[1];if(null!=i.utf8str)e.ds="utf8",e.value=i.utf8str.str;else if(null!=i.numstr)e.ds="num",e.value=i.numstr.str;else if(null!=i.telstr)e.ds="tel",e.value=i.telstr.str;else if(null!=i.prnstr)e.ds="prn",e.value=i.prnstr.str;else if(null!=i.ia5str)e.ds="ia5",e.value=i.ia5str.str;else if(null!=i.visstr)e.ds="vis",e.value=i.visstr.str;else{if(null==i.bmpstr)throw"error";e.ds="bmp",e.value=i.bmpstr.str}return e}catch(t){throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},w=function(t){try{return t.set.map(function(t){return x(t)})}catch(t){throw new Error("improper ASN.1 parsed RDN: "+t)}};this.getX500NameRule=function(t){for(var e=null,r=[],n=0;n<t.length;n++)for(var i=t[n],s=0;s<i.length;s++)r.push(i[s]);for(n=0;n<r.length;n++){var o=r[n],a=o.ds,u=o.value,c=o.type;if("prn"!=a&&"utf8"!=a&&"ia5"!=a)return"mixed";if("ia5"==a){if("CN"!=c)return"mixed";if(ct.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==a)continue;return"mixed"}if(null==e)e=a;else if(e!==a)return"mixed"}return null==e?"prn":e},this.getAttrTypeAndValue=function(t){var e=s(t);return x(e)},this.getRDN=function(t){var e=s(t);return w(e)},this.getX500NameArray=function(t){return function(t){try{return t.seq.map(function(t){return w(t)})}catch(t){throw new Error("improper ASN.1 parsed X500Name: "+t)}}(s(t))},this.getX500Name=function(t,e,r){var n=this.getX500NameArray(t),i={str:this.dnarraytostr(n)};return i.array=n,1==r&&(i.hex=t),1==e&&(i.canon=this.c14nRDNArray(n)),i},this.readCertPEM=function(t){this.readCertHex(m(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{l(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(t){var e={};return null==t&&(t={}),e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(t.dncanon,t.dnhex),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(t.dncanon,t.dnhex),e.sbjpubkey=Ft(this.getPublicKeyHex(),"PUBLIC KEY"),null!=this.aExtInfo&&this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),1==t.tbshex&&(e.tbshex=c(this.hex,0,[0])),1==t.nodnarray&&(delete e.issuer.array,delete e.subject.array),e},this.getExtParamArray=function(t){null==t&&(-1!=f(this.hex,0,[0,"[3]"])&&(t=h(this.hex,0,[0,"[3]",0],"30")));for(var e=[],r=n(t,0),i=0;i<r.length;i++){var s=o(t,r[i]),a=this.getExtParam(s);null!=a&&e.push(a)}return e},this.getExtParam=function(t){var e=n(t,0).length;if(2!=e&&3!=e)throw new Error("wrong number elements in Extension: "+e+" "+t);var r=v(a(t,0,[0],"06")),i=!1;3==e&&"0101ff"==c(t,0,[1])&&(i=!0);var o=c(t,0,[e-1,0]),u=void 0;if("2.5.29.14"==r?u=this.getExtSubjectKeyIdentifier(o,i):"2.5.29.15"==r?u=this.getExtKeyUsage(o,i):"2.5.29.17"==r?u=this.getExtSubjectAltName(o,i):"2.5.29.18"==r?u=this.getExtIssuerAltName(o,i):"2.5.29.19"==r?u=this.getExtBasicConstraints(o,i):"2.5.29.30"==r?u=this.getExtNameConstraints(o,i):"2.5.29.31"==r?u=this.getExtCRLDistributionPoints(o,i):"2.5.29.32"==r?u=this.getExtCertificatePolicies(o,i):"2.5.29.33"==r?u=this.getExtPolicyMappings(o,i):"2.5.29.35"==r?u=this.getExtAuthorityKeyIdentifier(o,i):"2.5.29.36"==r?u=this.getExtPolicyConstraints(o,i):"2.5.29.37"==r?u=this.getExtExtKeyUsage(o,i):"2.5.29.54"==r?u=this.getExtInhibitAnyPolicy(o,i):"1.3.6.1.5.5.7.1.1"==r?u=this.getExtAuthorityInfoAccess(o,i):"2.5.29.20"==r?u=this.getExtCRLNumber(o,i):"2.5.29.21"==r?u=this.getExtCRLReason(o,i):"2.5.29.9"==r?u=this.getExtSubjectDirectoryAttributes(o,i):"1.3.6.1.5.5.7.48.1.2"==r?u=this.getExtOcspNonce(o,i):"1.3.6.1.5.5.7.48.1.5"==r?u=this.getExtOcspNoCheck(o,i):"1.2.840.113583.1.1.9.1"==r?u=this.getExtAdobeTimeStamp(o,i):null!=Zt.EXT_PARSER[r]&&(u=Zt.EXT_PARSER[r](r,i,o)),null!=u)return u;var h={extname:r,extn:o};try{h.extn=s(o)}catch(t){}return i&&(h.critical=!0),h},this.findExt=function(t,e){for(var r=0;r<t.length;r++)if(t[r].extname==e)return t[r];return null},this.updateExtCDPFullURI=function(t,e){var r=this.findExt(t,"cRLDistributionPoints");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)if(null!=n[i].dpname&&null!=n[i].dpname.full)for(var s=n[i].dpname.full,o=0;o<s.length;o++){var a=s[i];null!=a.uri&&(a.uri=e)}},this.updateExtAIAOCSP=function(t,e){var r=this.findExt(t,"authorityInfoAccess");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].ocsp&&(n[i].ocsp=e)},this.updateExtAIACAIssuer=function(t,e){var r=this.findExt(t,"authorityInfoAccess");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].caissuer&&(n[i].caissuer=e)},this.dnarraytostr=function(t){return"/"+t.map(function(t){return function(t){return t.map(function(t){return function(t){return t.type+"="+t.value}(t).replace(/\+/,"\\+")}).join("+")}(t).replace(/\//,"\\/")}).join("/")},this.setCanonicalizedDN=function(t){var e;if(null!=t.str&&null==t.array){var r=new ct.asn1.x509.X500Name({str:t.str}).tohex();e=this.getX500NameArray(r)}else e=t.array;null==t.canon&&(t.canon=this.c14nRDNArray(e))},this.c14nRDNArray=function(t){for(var e=[],r=0;r<t.length;r++){for(var n=t[r],i=[],s=0;s<n.length;s++){var o=n[s],a=o.value;a=(a=(a=(a=a.replace(/^\s*/,"")).replace(/\s*$/,"")).replace(/\s+/g," ")).toLowerCase(),i.push(o.type.toLowerCase()+"="+a)}e.push(i.join("+"))}return"/"+e.join("/")},this.getInfo=function(){var t,e,r,n=function(t){for(var e="",r=" ",n="\n",i=t.array,s=0;s<i.length;s++){var o=i[s];if(null!=o.dn&&(e+=r+"dn: "+o.dn.str+n),null!=o.ip&&(e+=r+"ip: "+o.ip+n),null!=o.rfc822&&(e+=r+"rfc822: "+o.rfc822+n),null!=o.dns&&(e+=r+"dns: "+o.dns+n),null!=o.uri&&(e+=r+"uri: "+o.uri+n),null!=o.other)e+=r+"other: "+o.other.oid+"="+JSON.stringify(o.other.value).replace(/\"/g,"")+n}return e=e.replace(/\n$/,"")},i=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];if(e+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var s=0;s<i.array.length;s++){var o=i.array[s];void 0!==o.cps&&(e+=" cps: "+o.cps+"\n")}}return e},s=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];try{void 0!==i.dpname.full[0].uri&&(e+=" "+i.dpname.full[0].uri+"\n")}catch(t){}try{void 0!==i.dname.full[0].dn.hex&&(e+=" "+Zt.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(t){}}return e},o=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];void 0!==i.caissuer&&(e+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(e+=" ocsp: "+i.ocsp+"\n")}return e};if(t="Basic Fields\n",t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n",t+=" key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+=" n="+Lt(e.n.toString(16)).substr(0,16)+"...\n",t+=" e="+Lt(e.e.toString(16))+"\n"),null!=(r=this.aExtInfo)){t+="X509v3 Extensions:\n";for(var a=0;a<r.length;a++){var u=r[a],c=ct.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var h="";if(!0===u.critical&&(h="CRITICAL"),t+=" "+c+" "+h+":\n","basicConstraints"===c){var l=this.getExtBasicConstraints();void 0===l.cA?t+=" {}\n":(t+=" cA=true",void 0!==l.pathLen&&(t+=", pathLen="+l.pathLen),t+="\n")}else{var f;if("policyMappings"==c)t+=" "+this.getExtPolicyMappings().array.map(function(t){var e=t;return e[0]+":"+e[1]}).join(", ")+"\n";else if("policyConstraints"==c)t+=" ",null!=(f=this.getExtPolicyConstraints()).reqexp&&(t+=" reqexp="+f.reqexp),null!=f.inhibit&&(t+=" inhibit="+f.inhibit),t+="\n";else if("inhibitAnyPolicy"==c)t+=" skip="+(f=this.getExtInhibitAnyPolicy()).skip+"\n";else if("keyUsage"==c)t+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"==c)t+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"==c){var p=this.getExtAuthorityKeyIdentifier();void 0!==p.kid&&(t+=" kid="+p.kid.hex+"\n")}else{if("extKeyUsage"==c)t+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"==c)t+=n(this.getExtSubjectAltName())+"\n";else if("cRLDistributionPoints"==c)t+=s(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"==c)t+=o(this.getExtAuthorityInfoAccess());else"certificatePolicies"==c&&(t+=i(this.getExtCertificatePolicies()))}}}}return t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",t+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?this.readCertPEM(t):ct.lang.String.isHex(t)&&this.readCertHex(t))}$t.getKey=function(t,e,r){var n=(v=ft).getChildIdx,i=v.getVbyList,s=ct.crypto,o=s.ECDSA,a=s.DSA,u=it,c=At,h=$t;if(void 0!==u&&t instanceof u)return t;if(void 0!==o&&t instanceof o)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new o({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new o({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(P=new u).setPublic(t.n,t.e),P;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(P=new u).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),P;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(P=new u).setPrivate(t.n,t.e,t.d),P;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(P=new a).setPublic(t.p,t.q,t.g,t.y),P;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(P=new a).setPrivate(t.p,t.q,t.g,t.y,t.x),P;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(P=new u).setPublic(yt(t.n),yt(t.e)),P;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(P=new u).setPrivateEx(yt(t.n),yt(t.e),yt(t.d),yt(t.p),yt(t.q),yt(t.dp),yt(t.dq),yt(t.qi)),P;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(P=new u).setPrivate(yt(t.n),yt(t.e),yt(t.d)),P;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var l=(D=new o({curve:t.crv})).ecparams.keycharlen,f="04"+("0000000000"+yt(t.x)).slice(-l)+("0000000000"+yt(t.y)).slice(-l);return D.setPublicKeyHex(f),D}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){l=(D=new o({curve:t.crv})).ecparams.keycharlen,f="04"+("0000000000"+yt(t.x)).slice(-l)+("0000000000"+yt(t.y)).slice(-l);var p=("0000000000"+yt(t.d)).slice(-l);return D.setPublicKeyHex(f),D.setPrivateKeyHex(p),D}if("pkcs5prv"===r){var g,d=t,v=ft;if(9===(g=n(d,0)).length)(P=new u).readPKCS5PrvKeyHex(d);else if(6===g.length)(P=new a).readPKCS5PrvKeyHex(d);else{if(!(g.length>2&&"04"===d.substr(g[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(P=new o).readPKCS5PrvKeyHex(d)}return P}if("pkcs8prv"===r)return P=h.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===r)return h._getKeyFromPublicPKCS8Hex(t);if("x509pub"===r)return Zt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Zt.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var m=At(t,"PUBLIC KEY");return h._getKeyFromPublicPKCS8Hex(m)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var y=c(t,"RSA PRIVATE KEY");return h.getKey(y,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var x=i(R=c(t,"DSA PRIVATE KEY"),0,[1],"02"),w=i(R,0,[2],"02"),E=i(R,0,[3],"02"),b=i(R,0,[4],"02"),F=i(R,0,[5],"02");return(P=new a).setPrivate(new S(x,16),new S(w,16),new S(E,16),new S(b,16),new S(F,16)),P}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){y=c(t,"EC PRIVATE KEY");return h.getKey(y,null,"pkcs5prv")}if(-1!=t.indexOf("-END PRIVATE KEY-"))return h.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var A=h.getDecryptedKeyHex(t,e),C=new it;return C.readPKCS5PrvKeyHex(A),C}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var D,P=i(R=h.getDecryptedKeyHex(t,e),0,[1],"04"),I=i(R,0,[2,0],"06"),T=i(R,0,[3,0],"03").substr(2);if(void 0===ct.crypto.OID.oidhex2name[I])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+I);return(D=new o({curve:ct.crypto.OID.oidhex2name[I]})).setPublicKeyHex(T),D.setPrivateKeyHex(P),D.isPublic=!1,D}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var R;x=i(R=h.getDecryptedKeyHex(t,e),0,[1],"02"),w=i(R,0,[2],"02"),E=i(R,0,[3],"02"),b=i(R,0,[4],"02"),F=i(R,0,[5],"02");return(P=new a).setPrivate(new S(x,16),new S(w,16),new S(E,16),new S(b,16),new S(F,16)),P}if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return h.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},$t.generateKeypair=function(t,e){if("RSA"==t){var r=e;(o=new it).generate(r,"10001"),o.isPrivate=!0,o.isPublic=!0;var n=new it,i=o.n.toString(16),s=o.e.toString(16);return n.setPublic(i,s),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=o,a.pubKeyObj=n,a}if("EC"==t){var o,a,u=e,c=new ct.crypto.ECDSA({curve:u}).generateKeyPairHex();return(o=new ct.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),o.setPrivateKeyHex(c.ecprvhex),o.isPrivate=!0,o.isPublic=!1,(n=new ct.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=o,a.pubKeyObj=n,a}throw new Error("unknown algorithm: "+t)},$t.getPEM=function(t,e,r,n,i,s){var o=ct,a=o.asn1,u=a.DERObjectIdentifier,c=a.DERInteger,h=a.ASN1Util.newObject,l=a.x509.SubjectPublicKeyInfo,f=o.crypto,p=f.DSA,g=f.ECDSA,d=it;function v(t){return h({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function m(t){return h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function y(t){return h({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==d&&t instanceof d||void 0!==p&&t instanceof p||void 0!==g&&t instanceof g)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return Ft(E=new l(t).tohex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==d&&t instanceof d&&(void 0===r||null==r)&&1==t.isPrivate)return Ft(E=v(t).tohex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate){var x=new u({name:t.curveName}).tohex(),w=m(t).tohex(),S="";return S+=Ft(x,"EC PARAMETERS"),S+=Ft(w,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==p&&t instanceof p&&(void 0===r||null==r)&&1==t.isPrivate)return Ft(E=y(t).tohex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate){var E=v(t).tohex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,r,n,s)}if("PKCS5PRV"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate){E=m(t).tohex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,r,n,s)}if("PKCS5PRV"==e&&void 0!==p&&t instanceof p&&void 0!==r&&null!=r&&1==t.isPrivate){E=y(t).tohex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,r,n,s)}var b=function(t,e){if("string"==typeof e)return $t.getEncryptedPKCS8PEM(t,e);if("object"==typeof e&&null!=Wt(e,"passcode")){var r=JSON.parse(JSON.stringify(e)),n=r.passcode;return delete r.passcode,$t.getEncryptedPKCS8PEM(t,n,r)}};if("PKCS8PRV"==e&&null!=d&&t instanceof d&&1==t.isPrivate){var F=v(t).tohex();E=h({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:F}}]}).tohex();return void 0===r||null==r?Ft(E,"PRIVATE KEY"):b(E,r)}if("PKCS8PRV"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){var A={seq:[{int:1},{octstr:{hex:t.prvKeyHex}}]};"string"==typeof t.pubKeyHex&&A.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]});F=new h(A).tohex(),E=h({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:F}}]}).tohex();return void 0===r||null==r?Ft(E,"PRIVATE KEY"):b(E,r)}if("PKCS8PRV"==e&&void 0!==p&&t instanceof p&&1==t.isPrivate){F=new c({bigint:t.x}).tohex(),E=h({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:F}}]}).tohex();return void 0===r||null==r?Ft(E,"PRIVATE KEY"):b(E,r)}throw new Error("unsupported object nor format")},$t.getKeyFromCSRPEM=function(t){var e=At(t,"CERTIFICATE REQUEST");return $t.getKeyFromCSRHex(e)},$t.getKeyFromCSRHex=function(t){var e=$t.parseCSRHex(t);return $t.getKey(e.p8pubkeyhex,null,"pkcs8pub")},$t.parseCSRHex=function(t){var e=ft,r=e.getChildIdx,n=e.getTLV,i={},s=t;if("30"!=s.substr(0,2))throw new Error("malformed CSR(code:001)");var o=r(s,0);if(o.length<1)throw new Error("malformed CSR(code:002)");if("30"!=s.substr(o[0],2))throw new Error("malformed CSR(code:003)");var a=r(s,o[0]);if(a.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(s,a[2]),i},$t.getKeyID=function(t){var e=$t,r=ft;"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&(t=e.getKey(t));var n=At(e.getPEM(t)),i=r.getIdxbyList(n,0,[1]),s=r.getV(n,i).substring(2);return ct.crypto.Util.hashHex(s,"sha1")},$t.getJWK=function(t,e,r,n,i){var s,o,a={},u=ct.crypto.Util.hashHex;if("string"==typeof t)s=$t.getKey(t),-1!=t.indexOf("CERTIFICATE")&&(o=At(t));else{if("object"!=typeof t)throw new Error("unsupported keyinfo type");t instanceof Zt?(s=t.getPublicKey(),o=t.hex):s=t}if(s instanceof it&&s.isPrivate)a.kty="RSA",a.n=mt(s.n.toString(16)),a.e=mt(s.e.toString(16)),a.d=mt(s.d.toString(16)),a.p=mt(s.p.toString(16)),a.q=mt(s.q.toString(16)),a.dp=mt(s.dmp1.toString(16)),a.dq=mt(s.dmq1.toString(16)),a.qi=mt(s.coeff.toString(16));else if(s instanceof it&&s.isPublic)a.kty="RSA",a.n=mt(s.n.toString(16)),a.e=mt(s.e.toString(16));else if(s instanceof ct.crypto.ECDSA&&s.isPrivate){if("P-256"!==(h=s.getShortNISTPCurveName())&&"P-384"!==h&&"P-521"!==h)throw new Error("unsupported curve name for JWT: "+h);var c=s.getPublicKeyXYHex();a.kty="EC",a.crv=h,a.x=mt(c.x),a.y=mt(c.y),a.d=mt(s.prvKeyHex)}else if(s instanceof ct.crypto.ECDSA&&s.isPublic){var h;if("P-256"!==(h=s.getShortNISTPCurveName())&&"P-384"!==h&&"P-521"!==h)throw new Error("unsupported curve name for JWT: "+h);c=s.getPublicKeyXYHex();a.kty="EC",a.crv=h,a.x=mt(c.x),a.y=mt(c.y)}if(null==a.kty)throw new Error("unsupported keyinfo");return s.isPrivate||1==e||(a.kid=ct.jws.JWS.getJWKthumbprint(a)),null!=o&&1!=r&&(a.x5c=[x(o)]),null!=o&&1!=n&&(a.x5t=dt(x(u(o,"sha1")))),null!=o&&1!=i&&(a["x5t#S256"]=dt(x(u(o,"sha256")))),a},$t.getJWKFromKey=function(t){return $t.getJWK(t,!0,!0,!0,!0)},it.getPosArrayOfChildrenFromHex=function(t){return ft.getChildIdx(t,0)},it.getHexValueArrayOfChildrenFromHex=function(t){var e,r=ft.getV,n=r(t,(e=it.getPosArrayOfChildrenFromHex(t))[0]),i=r(t,e[1]),s=r(t,e[2]),o=r(t,e[3]),a=r(t,e[4]),u=r(t,e[5]),c=r(t,e[6]),h=r(t,e[7]),l=r(t,e[8]);return(e=new Array).push(n,i,s,o,a,u,c,h,l),e},it.prototype.readPrivateKeyFromPEMString=function(t){var e=At(t),r=it.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},it.prototype.readPKCS5PrvKeyHex=function(t){var e=it.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},it.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,s,o,a,u,c=ft,h=c.getVbyListEx;if(!1===c.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=h(t,0,[2,0,1],"02"),r=h(t,0,[2,0,2],"02"),n=h(t,0,[2,0,3],"02"),i=h(t,0,[2,0,4],"02"),s=h(t,0,[2,0,5],"02"),o=h(t,0,[2,0,6],"02"),a=h(t,0,[2,0,7],"02"),u=h(t,0,[2,0,8],"02")}catch(t){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,r,n,i,s,o,a,u)},it.prototype.readPKCS5PubKeyHex=function(t){var e=ft,r=e.getV;if(!1===e.isASN1HEX(t))throw new Error("keyHex is not ASN.1 hex string");var n=e.getChildIdx(t,0);if(2!==n.length||"02"!==t.substr(n[0],2)||"02"!==t.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=r(t,n[0]),s=r(t,n[1]);this.setPublic(i,s)},it.prototype.readPKCS8PubKeyHex=function(t){var e=ft;if(!1===e.isASN1HEX(t))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error("not PKCS8 RSA public key");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)},it.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new Zt).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},it.prototype.sign=function(t,e){var r=function(t){return ct.crypto.Util.hashString(t,e)}(t);return this.signWithMessageHash(r,e)},it.prototype.signWithMessageHash=function(t,e){var r=nt(ct.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return Jt(this.doPrivate(r).toString(16),this.n.bitLength())},it.prototype.signPSS=function(t,e,r){var n=function(t){return ct.crypto.Util.hashHex(t,e)}(bt(t));return void 0===r&&(r=-1),this.signWithMessageHashPSS(n,e,r)},it.prototype.signWithMessageHashPSS=function(t,e,r){var n,i=Et(t),s=i.length,o=this.n.bitLength()-1,a=Math.ceil(o/8),u=function(t){return ct.crypto.Util.hashHex(t,e)};if(-1===r||void 0===r)r=s;else if(-2===r)r=a-s-2;else if(r<-2)throw new Error("invalid salt length");if(a<s+r+2)throw new Error("data too long");var c="";r>0&&(c=new Array(r),(new rt).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=Et(u(bt("\0\0\0\0\0\0\0\0"+i+c))),l=[];for(n=0;n<a-r-s-2;n+=1)l[n]=0;var f=String.fromCharCode.apply(String,l)+""+c,p=Yt(h,f.length,u),g=[];for(n=0;n<f.length;n+=1)g[n]=f.charCodeAt(n)^p.charCodeAt(n);var d=65280>>8*a-o&255;for(g[0]&=~d,n=0;n<s;n++)g.push(h.charCodeAt(n));return g.push(188),Jt(this.doPrivate(new S(g)).toString(16),this.n.bitLength())},it.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var r=nt(e,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var s=Xt(i.replace(/^1f+00/,""));if(0==s.length)return!1;var o=s[0],a=s[1],u=function(t){return ct.crypto.Util.hashString(t,o)}(t);return a==u},it.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=nt(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=Xt(this.doPublic(r).toString(16).replace(/^1f+00/,""));return 0!=n.length&&n[1]==t},it.prototype.verifyPSS=function(t,e,r,n){var i,s=(i=bt(t),ct.crypto.Util.hashHex(i,r));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(s,e,r,n)},it.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,s=new S(e,16),o=function(t){return ct.crypto.Util.hashHex(t,r)},a=Et(t),u=a.length,c=this.n.bitLength()-1,h=Math.ceil(c/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=h-u-2;else if(n<-2)throw new Error("invalid salt length");if(h<u+n+2)throw new Error("data too long");var l=this.doPublic(s).toByteArray();for(i=0;i<l.length;i+=1)l[i]&=255;for(;l.length<h;)l.unshift(0);if(188!==l[h-1])throw new Error("encoded message does not end in 0xbc");var f=(l=String.fromCharCode.apply(String,l)).substr(0,h-u-1),p=l.substr(f.length,u),g=65280>>8*h-c&255;if(0!==(f.charCodeAt(0)&g))throw new Error("bits beyond keysize not zero");var d=Yt(p,f.length,o),v=[];for(i=0;i<f.length;i+=1)v[i]=f.charCodeAt(i)^d.charCodeAt(i);v[0]&=~g;var m=h-u-n-2;for(i=0;i<m;i+=1)if(0!==v[i])throw new Error("leftmost octets not zero");if(1!==v[m])throw new Error("0x01 marker not found");return p===Et(o(bt("\0\0\0\0\0\0\0\0"+a+String.fromCharCode.apply(String,v.slice(-n)))))},it.SALT_LEN_HLEN=-1,it.SALT_LEN_MAX=-2,it.SALT_LEN_RECOVER=-2,Zt.EXT_PARSER={},Zt.registExtParser=function(t,e){Zt.EXT_PARSER[t]=e},Zt.hex2dn=function(t,e){void 0===e&&(e=0);var r=new Zt;return ft.getTLV(t,e),r.getX500Name(t).str},Zt.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw new Error("malformed RDN");for(var r=new Array,n=ft.getChildIdx(t,e),i=0;i<n.length;i++)r.push(Zt.hex2attrTypeValue(t,n[i]));return r=r.map(function(t){return t.replace("+","\\+")}),r.join("+")},Zt.hex2attrTypeValue=function(t,e){var r=ft,n=r.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw new Error("malformed attribute type and value");var i=r.getChildIdx(t,e);2!==i.length||t.substr(i[0],2);var s=n(t,i[0]),o=ct.asn1.ASN1Util.oidHexToInt(s);return ct.asn1.x509.OID.oid2atype(o)+"="+Et(n(t,i[1]))},Zt.getPublicKeyFromCertHex=function(t){var e=new Zt;return e.readCertHex(t),e.getPublicKey()},Zt.getPublicKeyFromCertPEM=function(t){var e=new Zt;return e.readCertPEM(t),e.getPublicKey()},Zt.getPublicKeyInfoPropOfCertPEM=function(t){var e,r,n=ft.getVbyList,i={};return i.algparam=null,(e=new Zt).readCertPEM(t),r=e.getPublicKeyHex(),i.keyhex=n(r,0,[1],"03").substr(2),i.algoid=n(r,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=n(r,0,[0,1],"06")),i},Zt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],void 0!==ct&&ct||(ct={}),void 0!==ct.jws&&ct.jws||(ct.jws={}),ct.jws.JWS=function(){var t=ct.jws.JWS.isSafeJSONString;this.parseJWS=function(e,r){if(void 0===this.parsedJWS||!r&&void 0===this.parsedJWS.sigvalH){var n=e.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==n)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=n[1],s=n[2],o=n[3],a=i+"."+s;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=s,this.parsedJWS.sigvalB64U=o,this.parsedJWS.si=a,!r){var u=yt(o),c=nt(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var h=lt(i),l=lt(s);if(this.parsedJWS.headS=h,this.parsedJWS.payloadS=l,!t(h,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+h}}},ct.jws.JWS.sign=function(t,e,r,n,i){var s,o,a,u=ct,c=u.jws.JWS,h=c.readSafeJSONString,l=c.isSafeJSONString,f=u.crypto,p=f.Mac,g=f.Signature,d=JSON;if("string"!=typeof e&&"object"!=typeof e)throw"spHeader must be JSON string or object: "+e;if("object"==typeof e&&(o=e,s=d.stringify(o)),"string"==typeof e){if(!l(s=e))throw"JWS Head is not safe JSON string: "+s;o=h(s)}if(a=r,"object"==typeof r&&(a=d.stringify(r)),""!=t&&null!=t||void 0===o.alg||(t=o.alg),""!=t&&null!=t&&void 0===o.alg&&(o.alg=t,s=d.stringify(o)),t!==o.alg)throw"alg and sHeader.alg doesn't match: "+t+"!="+o.alg;var v=null;if(void 0===c.jwsalg2sigalg[t])throw"unsupported alg name: "+t;v=c.jwsalg2sigalg[t];var m=ht(s)+"."+ht(a),y="";if("Hmac"==v.substr(0,4)){if(void 0===n)throw"mac key shall be specified for HS* alg";var x=new p({alg:v,prov:"cryptojs",pass:n});x.updateString(m),y=x.doFinal()}else if(-1!=v.indexOf("withECDSA")){(S=new g({alg:v})).init(n,i),S.updateString(m);var w=S.sign();y=ct.crypto.ECDSA.asn1SigToConcatSig(w)}else{var S;if("none"!=v)(S=new g({alg:v})).init(n,i),S.updateString(m),y=S.sign()}return m+"."+mt(y)},ct.jws.JWS.verify=function(t,e,r){var n,i=ct,s=i.jws.JWS,o=s.readSafeJSONString,a=i.crypto,u=a.ECDSA,c=a.Mac,h=a.Signature;if(n=it,!kt(t))return!1;var l=t.split(".");if(3!==l.length)return!1;var f=l[0]+"."+l[1],p=yt(l[2]),g=o(lt(l[0])),d=null,v=null;if(void 0===g.alg)throw"algorithm not specified in header";if((v=(d=g.alg).substr(0,2),null!=r&&"[object Array]"===Object.prototype.toString.call(r)&&r.length>0)&&-1==(":"+r.join(":")+":").indexOf(":"+d+":"))throw"algorithm '"+d+"' not accepted in the list";if("none"!=d&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=$t.getKey(e)),!("RS"!=v&&"PS"!=v||e instanceof n))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==v&&!(e instanceof u))throw"key shall be a ECDSA obj for ES* algs";var m=null;if(void 0===s.jwsalg2sigalg[g.alg])throw new Error("unsupported alg name: "+d);if(m=s.jwsalg2sigalg[d],void 0!==g.crit){if(!Array.isArray(g.crit)||0===g.crit.length)throw new Error("wrong critical header");for(var y=0;y<g.crit.length;y++){var x=g.crit[y];if("string"!=typeof x||0===x.length)throw new Error("wrong critical header");if(void 0===g[x])throw new Error("critical header '"+x+"' missing")}}if("none"==m)throw new Error("not supported");if("Hmac"==m.substr(0,4)){if(void 0===e)throw new Error("hexadecimal key shall be specified for HMAC");var w=new c({alg:m,pass:e});return w.updateString(f),Vt(p,w.doFinal())}if(-1!=m.indexOf("withECDSA")){var S,E=null;try{E=u.concatSigToASN1Sig(p)}catch(t){return!1}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(E)}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(p)},ct.jws.JWS.parse=function(t){var e,r,n,i=t.split("."),s={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=i[0],r=i[1],3==i.length&&(n=i[2]),s.headerObj=ct.jws.JWS.readSafeJSONString(lt(e)),s.payloadObj=ct.jws.JWS.readSafeJSONString(lt(r)),s.headerPP=JSON.stringify(s.headerObj,null," "),null==s.payloadObj?s.payloadPP=lt(r):s.payloadPP=JSON.stringify(s.payloadObj,null," "),void 0!==n&&(s.sigHex=yt(n)),s},ct.jws.JWS.verifyJWT=function(t,e,r){var n=ct.jws,i=n.JWS,s=i.readSafeJSONString,o=i.inArray,a=i.includedArray;if(!kt(t))return!1;var u=t.split(".");if(3!=u.length)return!1;var c=u[0],h=u[1];yt(u[2]);var l=s(lt(c)),f=s(lt(h));if(void 0===l.alg)return!1;if(void 0===r.alg)throw"acceptField.alg shall be specified";if(!o(l.alg,r.alg))return!1;if(void 0!==f.iss&&"object"==typeof r.iss&&!o(f.iss,r.iss))return!1;if(void 0!==f.sub&&"object"==typeof r.sub&&!o(f.sub,r.sub))return!1;if(void 0!==f.aud&&"object"==typeof r.aud)if("string"==typeof f.aud){if(!o(f.aud,r.aud))return!1}else if("object"==typeof f.aud&&!a(f.aud,r.aud))return!1;var p=n.IntDate.getNow();return void 0!==r.verifyAt&&"number"==typeof r.verifyAt&&(p=r.verifyAt),void 0!==r.gracePeriod&&"number"==typeof r.gracePeriod||(r.gracePeriod=0),!(void 0!==f.exp&&"number"==typeof f.exp&&f.exp+r.gracePeriod<p)&&(!(void 0!==f.nbf&&"number"==typeof f.nbf&&p<f.nbf-r.gracePeriod)&&(!(void 0!==f.iat&&"number"==typeof f.iat&&p<f.iat-r.gracePeriod)&&((void 0===f.jti||void 0===r.jti||f.jti===r.jti)&&!!i.verify(t,e,r.alg))))},ct.jws.JWS.includedArray=function(t,e){var r=ct.jws.JWS.inArray;if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var n=0;n<t.length;n++)if(!r(t[n],e))return!1;return!0},ct.jws.JWS.inArray=function(t,e){if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(e[r]==t)return!0;return!1},ct.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",ES512:"SHA512withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},ct.jws.JWS.isSafeJSONString=function(t,e,r){var n=null;try{return"object"!=typeof(n=ut(t))||n.constructor===Array?0:(e&&(e[r]=n),1)}catch(t){return 0}},ct.jws.JWS.readSafeJSONString=function(t){var e=null;try{return"object"!=typeof(e=ut(t))||e.constructor===Array?null:e}catch(t){return null}},ct.jws.JWS.getEncodedSignatureValueFromJWS=function(t){var e=t.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==e)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return e[1]},ct.jws.JWS.getJWKthumbprint=function(t){if("RSA"!==t.kty&&"EC"!==t.kty&&"oct"!==t.kty)throw new Error("unsupported algorithm for JWK Thumprint");var e="{";if("RSA"===t.kty){if("string"!=typeof t.n||"string"!=typeof t.e)throw new Error("wrong n and e value for RSA key");e+='"e":"'+t.e+'",',e+='"kty":"'+t.kty+'",',e+='"n":"'+t.n+'"}'}else if("EC"===t.kty){if("string"!=typeof t.crv||"string"!=typeof t.x||"string"!=typeof t.y)throw new Error("wrong crv, x and y value for EC key");e+='"crv":"'+t.crv+'",',e+='"kty":"'+t.kty+'",',e+='"x":"'+t.x+'",',e+='"y":"'+t.y+'"}'}else if("oct"===t.kty){if("string"!=typeof t.k)throw new Error("wrong k value for oct(symmetric) key");e+='"k":"'+t.k+'",',e+='"kty":"'+t.kty+'"}'}var r=bt(e);return mt(ct.crypto.Util.hashHex(r,"sha256"))},ct.jws.IntDate={},ct.jws.IntDate.get=function(t){var e=ct.jws.IntDate,r=e.getNow,n=e.getZulu;if("now"==t)return r();if("now + 1hour"==t)return r()+3600;if("now + 1day"==t)return r()+86400;if("now + 1month"==t)return r()+2592e3;if("now + 1year"==t)return r()+31536e3;if(t.match(/Z$/))return n(t);if(t.match(/^[0-9]+$/))return parseInt(t);throw"unsupported format: "+t},ct.jws.IntDate.getZulu=function(t){return Ct(t)},ct.jws.IntDate.getNow=function(){return~~(new Date/1e3)},ct.jws.IntDate.intDate2UTCString=function(t){return new Date(1e3*t).toUTCString()},ct.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t);return("0000"+e.getUTCFullYear()).slice(-4)+("00"+(e.getUTCMonth()+1)).slice(-2)+("00"+e.getUTCDate()).slice(-2)+("00"+e.getUTCHours()).slice(-2)+("00"+e.getUTCMinutes()).slice(-2)+("00"+e.getUTCSeconds()).slice(-2)+"Z"},void 0!==ct&&ct||(ct={}),void 0!==ct.jws&&ct.jws||(ct.jws={}),ct.jws.JWSJS=function(){var t=ct.jws.JWS,e=t.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(t){this.init();var e=t.split(".");if(3!=e.length)throw"malformed input JWS";this.aHeader.push(e[0]),this.sPayload=e[1],this.aSignature.push(e[2])},this.addSignature=function(t,e,r,n){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var i=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var s=ct.jws.JWS.sign(t,e,this.sPayload,r,n).split(".");this.aHeader.push(s[0]),this.aSignature.push(s[2])}catch(t){throw this.aHeader.length>i&&this.aHeader.pop(),this.aSignature.length>i&&this.aSignature.pop(),"addSignature failed: "+t}},this.verifyAll=function(t){if(this.aHeader.length!==t.length||this.aSignature.length!==t.length)return!1;for(var e=0;e<t.length;e++){var r=t[e];if(2!==r.length)return!1;if(!1===this.verifyNth(e,r[0],r[1]))return!1}return!0},this.verifyNth=function(e,r,n){if(this.aHeader.length<=e||this.aSignature.length<=e)return!1;var i=this.aHeader[e],s=this.aSignature[e],o=i+"."+this.sPayload+"."+s,a=!1;try{a=t.verify(o,r,n)}catch(t){return!1}return a},this.readJWSJS=function(t){if("string"==typeof t){var r=e(t);if(null==r)throw"argument is not safe JSON object string";this.aHeader=r.headers,this.sPayload=r.payload,this.aSignature=r.signatures}else try{if(!(t.headers.length>0))throw"malformed header";if(this.aHeader=t.headers,"string"!=typeof t.payload)throw"malformed signatures";if(this.sPayload=t.payload,!(t.signatures.length>0))throw"malformed signatures";this.aSignature=t.signatures}catch(t){throw"malformed JWS-JS JSON object: "+t}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}};var Qt=ct;const te=(t,e=!1)=>t.map(t=>{const r={title:t.name};return t.url&&(r.path=t.url),t.icon&&(r.svgName=t.icon),t.type&&(r.type=t.type),t.code&&(r.code=t.code),e?t.children&&t.children.length>0&&0===t.type&&(r.children=te(t.children)):t.children&&t.children.length>0&&(r.children=te(t.children)),r});const ee={install(t,e={}){const{getPermissions:r,directiveName:n="permission"}=e;if("function"!=typeof r)return void console.error("[PermissionPlugin]: getPermissions 必须是一个返回数组的函数");const i=t=>{const e=r()||[];if(!t)return!0;return(Array.isArray(t)?t:[t]).some(t=>e.includes(t))};t.config.globalProperties.$hasPermission=i,t.provide("hasPermission",i),t.directive(n,{mounted(t,e){const{value:r}=e;if(!r)return void console.warn(`[PermissionPlugin]: 需要指定权限标识,例如 v-${n}="'USER_ADD'"`);const s=()=>{!i(r)&&t.parentNode&&t.parentNode.removeChild(t)};s(),t._permission_check=s},updated(t,e){t._permission_check&&t._permission_check()}})}};const re=t=>t<10?`0${t}`:t,ne=(t,e)=>{if(!e)return[...t];const r=[];return t.forEach(t=>{const n=((t,e)=>["code","name","openingBalance","debitTotal","creditTotal","yearTotal"].some(r=>String(t[r]||"").toLowerCase().includes(e)))(t,e),i=t.children?ne(t.children,e):[];if(n||i.length>0){const e={...t};t.children&&(e.children=i),r.push(e)}}),r},ie=(t,e,r="children")=>{for(const n of t){if(n[r]&&n[r].includes(e))return n;if(n[r]){const t=ie(n[r],e,r);if(t)return t}}return null},se=t=>{t.forEach(t=>{t.auxInitialList&&t.auxInitialList.length>0&&(t.children||(t.children=[]),t.auxInitialList.forEach(e=>{const r={...e};r.code_0=r.code,r.code=r.subjectAuxCode,r.name=r.subjectAuxName,t.children.push(r)})),t.children&&t.children.length>0&&se(t.children)})},oe=t=>{if(null==t||""===String(t).trim())return 0;const e=Number(String(t).replace(/,/g,""));return isNaN(e)?0:e},ae=t=>{t&&Array.isArray(t)&&t.forEach(t=>{t.auxInitialList&&t.auxInitialList.length>0&&(t.children||(t.children=[]),t.auxInitialList.forEach(e=>{const r={...e};r.code_0=r.code,r.code=r.subjectAuxCode,r.name=r.subjectAuxName,r.code||(r.code=r.code_0),t.children.push(r)})),t.children&&t.children.length>0&&ae(t.children)})},ue=t=>t&&Array.isArray(t)?t.filter(t=>!t.code_0).map(t=>{const e={...t},r=e.children||[],n=r.filter(t=>!t.code_0),i=r.filter(t=>t.code_0);return i.length>0?e.auxInitialItemList=i.map(t=>{const e={...t};return e.code=e.code_0,e.auxInstanceCode=e.subjectAuxCode,e.openingBalance=oe(e.openingBalance),e.debitTotal=oe(e.debitTotal),e.creditTotal=oe(e.creditTotal),e.yearTotal=oe(e.yearTotal),e.originalOpeningBalance=oe(e.originalOpeningBalance),e.originalDebitTotal=oe(e.originalDebitTotal),e.originalCreditTotal=oe(e.originalCreditTotal),e.originalYearTotal=oe(e.originalYearTotal),e.openingQuantity=oe(e.openingQuantity),e.debitQuantity=oe(e.debitQuantity),e.creditQuantity=oe(e.creditQuantity),e.yearQuantity=oe(e.yearQuantity),delete e.code_0,e}):e.auxInitialItemList=[],e.openingBalance=oe(e.openingBalance),e.debitTotal=oe(e.debitTotal),e.creditTotal=oe(e.creditTotal),e.yearTotal=oe(e.yearTotal),e.originalOpeningBalance=oe(e.originalOpeningBalance),e.originalDebitTotal=oe(e.originalDebitTotal),e.originalCreditTotal=oe(e.originalCreditTotal),e.originalYearTotal=oe(e.originalYearTotal),e.openingQuantity=oe(e.openingQuantity),e.debitQuantity=oe(e.debitQuantity),e.creditQuantity=oe(e.creditQuantity),e.yearQuantity=oe(e.yearQuantity),n.length>0?e.children=ue(n):e.children=[],delete e.auxInitialList,e}):[],ce=(t,e)=>{if(!Array.isArray(t))return!1;for(const r of t){if(e(r))return!0;if(r.children?.length&&ce(r.children,e))return!0}return!1};const he=[".el-input","input","textarea","button","a",'[contenteditable="true"]'];const le=t=>{if(null==t)return!1;const e=String(t).trim().replace(/,/g,"");if(!e)return!1;const r=Number(e);return Number.isFinite(r)&&0!==r},fe=(t,e)=>Array.isArray(t)?t.reduce((t,r)=>{const n=fe(r.children,e);if(e.some(t=>le(r[t]))||n.length>0){const e={...r};Array.isArray(r.children)&&(e.children=n),t.push(e)}return t},[]):[];
26
+ var ct=function(){var t=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),e=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),r={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function n(t,e,n){return e?r[e]:String.fromCharCode(parseInt(n,16))}var i=new String(""),s=Object.hasOwnProperty;return function(r,a){var o,u,c=r.match(t),h=c[0],l=!1;"{"===h?o={}:"["===h?o=[]:(o=[],l=!0);for(var f=[o],p=1-l,g=c.length;p<g;++p){var d;switch((h=c[p]).charCodeAt(0)){default:(d=f[0])[u||d.length]=+h,u=void 0;break;case 34:if(-1!==(h=h.substring(1,h.length-1)).indexOf("\\")&&(h=h.replace(e,n)),d=f[0],!u){if(!(d instanceof Array)){u=h||i;break}u=d.length}d[u]=h,u=void 0;break;case 91:d=f[0],f.unshift(d[u||d.length]=[]),u=void 0;break;case 93:case 125:f.shift();break;case 102:(d=f[0])[u||d.length]=!1,u=void 0;break;case 110:(d=f[0])[u||d.length]=null,u=void 0;break;case 116:(d=f[0])[u||d.length]=!0,u=void 0;break;case 123:d=f[0],f.unshift(d[u||d.length]={}),u=void 0}}if(l){if(1!==f.length)throw new Error;o=o[0]}else if(f.length)throw new Error;if(a){var v=function(t,e){var r=t[e];if(r&&"object"==typeof r){var n=null;for(var i in r)if(s.call(r,i)&&r!==t){var o=v(r,i);void 0!==o?r[i]=o:(n||(n=[]),n.push(i))}if(n)for(var u=n.length;--u>=0;)delete r[n[u]]}return a.call(t,e,r)};o=v({"":o},"")}return o}}();void 0!==ht&&ht||(ht={}),void 0!==ht.asn1&&ht.asn1||(ht.asn1={}),ht.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){return Ut(t)},this.getPEMStringFromHex=function(t,e){return At(t,e)},this.newObject=function(t){var e=ht.asn1,r=e.ASN1Object,n=e.DERBoolean,i=e.DERInteger,s=e.DERBitString,a=e.DEROctetString,o=e.DERNull,u=e.DERObjectIdentifier,c=e.DEREnumerated,h=e.DERUTF8String,l=e.DERNumericString,f=e.DERPrintableString,p=e.DERTeletexString,g=e.DERIA5String,d=e.DERUTCTime,v=e.DERGeneralizedTime,m=e.DERVisibleString,y=e.DERBMPString,x=e.DERSequence,w=e.DERSet,S=e.DERTaggedObject,E=e.ASN1Util.newObject;if(t instanceof e.ASN1Object)return t;var b=Object.keys(t);if(1!=b.length)throw new Error("key of param shall be only one.");var F=b[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+F+":"))throw new Error("undefined key: "+F);if("bool"==F)return new n(t[F]);if("int"==F)return new i(t[F]);if("bitstr"==F)return new s(t[F]);if("octstr"==F)return new a(t[F]);if("null"==F)return new o(t[F]);if("oid"==F)return new u(t[F]);if("enum"==F)return new c(t[F]);if("utf8str"==F)return new h(t[F]);if("numstr"==F)return new l(t[F]);if("prnstr"==F)return new f(t[F]);if("telstr"==F)return new p(t[F]);if("ia5str"==F)return new g(t[F]);if("utctime"==F)return new d(t[F]);if("gentime"==F)return new v(t[F]);if("visstr"==F)return new m(t[F]);if("bmpstr"==F)return new y(t[F]);if("asn1"==F)return new r(t[F]);if("seq"==F){for(var A=t[F],C=[],D=0;D<A.length;D++){var I=E(A[D]);C.push(I)}return new x({array:C})}if("set"==F){for(A=t[F],C=[],D=0;D<A.length;D++){I=E(A[D]);C.push(I)}return new w({array:C})}if("tag"==F){var P=t[F];if("[object Array]"===Object.prototype.toString.call(P)&&3==P.length){var T=E(P[2]);return new S({tag:P[0],explicit:P[1],obj:T})}return new S(P)}},this.jsonToASN1HEX=function(t){return this.newObject(t).tohex()}},ht.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var s=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);if(n+=s.substr(1,7),"0"==s.substr(0,1))e=e+"."+new E(n,2).toString(10),n=""}return e},ht.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new E(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";n=s+n;for(a=0;a<n.length-1;a+=7){var o=n.substr(a,7);a!=n.length-7&&(o="1"+o),r+=e(parseInt(o,2))}return r};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),s=40*parseInt(i[0])+parseInt(i[1]);n+=e(s),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n},ht.asn1.ASN1Object=function(t){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n=0,v="+this.hV);var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var r=e.length/2;if(r>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+t.toString(16));return(128+r).toString(16)+e},this.tohex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},ht.asn1.DERAbstractString=function(t){ht.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=wt(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},$t(ht.asn1.DERAbstractString,ht.asn1.ASN1Object),ht.asn1.DERAbstractTime=function(t){ht.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){var e=t.getTime()+6e4*t.getTimezoneOffset();return new Date(e)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),s=String(i.getFullYear());"utc"==e&&(s=s.substr(2,2));var a=s+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var o=i.getMilliseconds();if(0!=o){var u=n(String(o),3);a=a+"."+(u=u.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.setByParam=function(t){this.hV=null,this.hTLV=null,this.params=t},this.getString=function(){},this.setString=function(t){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.str=t},this.setByDate=function(t){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.date=t},this.setByDateValue=function(t,e,r,n,i,s){var a=new Date(Date.UTC(t,e-1,r,n,i,s,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},$t(ht.asn1.DERAbstractTime,ht.asn1.ASN1Object),ht.asn1.DERAbstractStructured=function(t){ht.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},$t(ht.asn1.DERAbstractStructured,ht.asn1.ASN1Object),ht.asn1.DERBoolean=function(t){ht.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==t?"010100":"0101ff"},$t(ht.asn1.DERBoolean,ht.asn1.ASN1Object),ht.asn1.DERInteger=function(t){ht.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var e=Ut;this.setByBigInteger=function(t){this.isModified=!0,this.params={bigint:t}},this.setByInteger=function(t){this.isModified=!0,this.params=t},this.setValueHex=function(t){this.isModified=!0,this.params={hex:t}},this.getFreshValueHex=function(){var t=this.params,r=null;if(null==t)throw new Error("value not set");if("object"==typeof t&&null!=t.hex)return this.hV=t.hex,this.hV;if("number"==typeof t)r=new E(String(t),10);else if(null!=t.int)r=new E(String(t.int),10);else{if(null==t.bigint)throw new Error("wrong parameter");r=t.bigint}return this.hV=e(r),this.hV},null!=t&&(this.params=t)},$t(ht.asn1.DERInteger,ht.asn1.ASN1Object),ht.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ht.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.tohex()}ht.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0),t+="0000000".substr(0,e);for(var r="",n=0;n<t.length-1;n+=8){var i=t.substr(n,8),s=parseInt(i,2).toString(16);1==s.length&&(s="0"+s),r+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",r=0;r<t.length;r++)1==t[r]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},$t(ht.asn1.DERBitString,ht.asn1.ASN1Object),ht.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ht.asn1.ASN1Util.newObject(t.obj);t.hex=e.tohex()}ht.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},$t(ht.asn1.DEROctetString,ht.asn1.DERAbstractString),ht.asn1.DERNull=function(){ht.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},$t(ht.asn1.DERNull,ht.asn1.ASN1Object),ht.asn1.DERObjectIdentifier=function(t){ht.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var e=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=parseInt(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";n=s+n;for(a=0;a<n.length-1;a+=7){var o=n.substr(a,7);a!=n.length-7&&(o="1"+o),r+=e(parseInt(o,2))}return r};try{if(!t.match(/^[0-9.]+$/))return null;var n="",i=t.split("."),s=40*parseInt(i[0],10)+parseInt(i[1],10);n+=e(s),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n}catch(t){return null}}(t);if(null==e)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){var e=ht.asn1.x509.OID.name2oid(t);if(""===e)throw new Error("DERObjectIdentifier oidName undefined: "+t);this.setValueOidString(e)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){"string"==typeof t?this.setValueNameOrOid(t):void 0!==t.oid?this.setValueNameOrOid(t.oid):void 0!==t.name?this.setValueNameOrOid(t.name):void 0!==t.hex&&this.setValueHex(t.hex)},void 0!==t&&this.setByParam(t)},$t(ht.asn1.DERObjectIdentifier,ht.asn1.ASN1Object),ht.asn1.DEREnumerated=function(t){ht.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Ut(t)},this.setByInteger=function(t){var e=new E(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},$t(ht.asn1.DEREnumerated,ht.asn1.ASN1Object),ht.asn1.DERUTF8String=function(t){ht.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},$t(ht.asn1.DERUTF8String,ht.asn1.DERAbstractString),ht.asn1.DERNumericString=function(t){ht.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},$t(ht.asn1.DERNumericString,ht.asn1.DERAbstractString),ht.asn1.DERPrintableString=function(t){ht.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},$t(ht.asn1.DERPrintableString,ht.asn1.DERAbstractString),ht.asn1.DERTeletexString=function(t){ht.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},$t(ht.asn1.DERTeletexString,ht.asn1.DERAbstractString),ht.asn1.DERIA5String=function(t){ht.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},$t(ht.asn1.DERIA5String,ht.asn1.DERAbstractString),ht.asn1.DERVisibleString=function(t){ht.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="1a"},$t(ht.asn1.DERVisibleString,ht.asn1.DERAbstractString),ht.asn1.DERBMPString=function(t){ht.asn1.DERBMPString.superclass.constructor.call(this,t),this.hT="1e"},$t(ht.asn1.DERBMPString,ht.asn1.DERAbstractString),ht.asn1.DERUTCTime=function(t){ht.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.params=void 0,this.getFreshValueHex=function(){var t=this.params;if(null==this.params&&(t={date:new Date}),"string"==typeof t){if(!t.match(/^[0-9]{12}Z$/)&&!t.match(/^[0-9]{12}\.[0-9]+Z$/))throw new Error("malformed string for UTCTime: "+t);this.hV=dt(t)}else if(null!=t.str)this.hV=dt(t.str);else if(null==t.date&&1==t.millis){var e=new Date;this.hV=dt(this.formatDate(e,"utc",!0))}else if(null!=t.date&&t.date instanceof Date){var r=!0===t.millis;this.hV=dt(this.formatDate(t.date,"utc",r))}else t instanceof Date&&(this.hV=dt(this.formatDate(t,"utc")));if(null==this.hV)throw new Error("parameter not specified properly for UTCTime");return this.hV},null!=t&&this.setByParam(t)},$t(ht.asn1.DERUTCTime,ht.asn1.DERAbstractTime),ht.asn1.DERGeneralizedTime=function(t){ht.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.params=t,this.getFreshValueHex=function(){var t=this.params;if(null==this.params&&(t={date:new Date}),"string"==typeof t){if(!t.match(/^[0-9]{14}Z$/)&&!t.match(/^[0-9]{14}\.[0-9]+Z$/))throw new Error("malformed string for GeneralizedTime: "+t);this.hV=dt(t)}else if(null!=t.str)this.hV=dt(t.str);else if(null==t.date&&1==t.millis){var e=new Date;this.hV=dt(this.formatDate(e,"gen",!0))}else if(null!=t.date&&t.date instanceof Date){var r=!0===t.millis;this.hV=dt(this.formatDate(t.date,"gen",r))}else t instanceof Date&&(this.hV=dt(this.formatDate(t,"gen")));if(null==this.hV)throw new Error("parameter not specified properly for GeneralizedTime");return this.hV},null!=t&&this.setByParam(t)},$t(ht.asn1.DERGeneralizedTime,ht.asn1.DERAbstractTime),ht.asn1.DERSequence=function(t){ht.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){t+=this.asn1Array[e].tohex()}return this.hV=t,this.hV}},$t(ht.asn1.DERSequence,ht.asn1.DERAbstractStructured),ht.asn1.DERSet=function(t){ht.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.tohex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},$t(ht.asn1.DERSet,ht.asn1.DERAbstractStructured),ht.asn1.DERTaggedObject=function(t){ht.asn1.DERTaggedObject.superclass.constructor.call(this);var e=ht.asn1,r=pt,n=r.getV;r.isASN1HEX;var i=e.ASN1Util.newObject;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(t,e,r){this.params={tag:e,explicit:t,obj:r}},this.getFreshValueHex=function(){var t=this.params;if(null==t.explicit&&(t.explicit=!0),null!=t.tage&&(t.tag=t.tage,t.explicit=!0),null!=t.tagi&&(t.tag=t.tagi,t.explicit=!1),null!=t.str)this.hV=wt(t.str);else if(null!=t.hex)this.hV=t.hex;else{if(null==t.obj)throw new Error("str, hex nor obj not specified");var r;t.obj instanceof e.ASN1Object?r=t.obj.tohex():"object"==typeof t.obj&&(r=i(t.obj).tohex()),t.explicit?this.hV=r:this.hV=n(r,0)}return null==t.tag&&(t.tag="a0"),this.hT=t.tag,this.hTLV=null,this.isModified=!0,this.hV},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},$t(ht.asn1.DERTaggedObject,ht.asn1.ASN1Object);var ht,lt,ft,pt=new function(){};function gt(t){for(var e="",r=0;r<t.length;r++){var n=t[r].toString(16);1==n.length&&(n="0"+n),e+=n}return e}function dt(t){return gt(function(t){for(var e=new Array,r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}(t))}function vt(t){return t=(t=(t=t.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function mt(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),t=(t=t.replace(/-/g,"+")).replace(/_/g,"/")}function yt(t){return t.length%2==1&&(t="0"+t),vt(w(t))}function xt(t){return S(mt(t))}function wt(t){return It(Ht(t)).toLowerCase()}function St(t){try{return decodeURIComponent(Pt(t))}catch(t){return null}}function Et(t){return St(function(t){for(var e=t.match(/.{1,2}/g),r=[],n=0;n<e.length;n++){var i=parseInt(e[n],16);161<=i&&i<=191?(r.push("c2"),r.push(e[n])):192<=i&&i<=255?(r.push("c3"),r.push((i-64).toString(16))):r.push(e[n])}return r.join("")}(t))}function bt(t){for(var e="",r=0;r<t.length-1;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e}function Ft(t){for(var e="",r=0;r<t.length;r++)e+=("0"+t.charCodeAt(r).toString(16)).slice(-2);return e}function At(t,e){return"-----BEGIN "+e+"-----\r\n"+function(t,e){return(t=t.replace(new RegExp("(.{"+e+"})","g"),"$1\r\n")).replace(/\s+$/,"")}(function(t){return w(t)}(t),64)+"\r\n-----END "+e+"-----\r\n"}function Ct(t,e){if(-1==t.indexOf("-----BEGIN "))throw new Error("can't find PEM header");return function(t){return S(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}(t=void 0!==e?(t=t.replace(new RegExp("^[^]*-----BEGIN "+e+"-----"),"")).replace(new RegExp("-----END "+e+"-----[^]*$"),""):(t=t.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Dt(t){return Math.round(function(t){var e,r,n,i,s,a,o,u,c,h;if(t=function(t){return t.match(/^[0-9]{12}Z$/)||t.match(/^[0-9]{12}[.][0-9]*Z$/)?t.match(/^[0-4]/)?"20"+t:"19"+t:t}(t),h=t.match(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return e=parseInt(h[1]),r=parseInt(h[2])-1,n=parseInt(h[3]),i=parseInt(h[4]),s=parseInt(h[5]),a=parseInt(h[6]),o=0,""!==(u=h[7])&&(c=(u.substr(1)+"00").substr(0,3),o=parseInt(c)),Date.UTC(e,r,n,i,s,a,o);throw new Error("unsupported zulu format: "+t)}(t)/1e3)}function It(t){return t.replace(/%/g,"")}function Pt(t){return t.replace(/(..)/g,"%$1")}function Tt(t){var e="malformed IPv6 address";if(!t.match(/^[0-9A-Fa-f:]+$/))throw e;var r=(t=t.toLowerCase()).split(":").length-1;if(r<2)throw e;var n=":".repeat(7-r+2),i=(t=t.replace("::",n)).split(":");if(8!=i.length)throw e;for(var s=0;s<8;s++)i[s]=("0000"+i[s]).slice(-4);return i.join("")}function Rt(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw new Error("malformed IPv6 address: "+t);var e=(t=t.toLowerCase()).match(/.{1,4}/g);e=e.map(function(t){return t.replace(/^0+/,"")}),e=e.map(function(t){return""==t?"0":t});var r=(t=":"+e.join(":")+":").match(/:(0:){2,}/g);if(null==r)return t.slice(1,-1);var n=r.sort().slice(-1)[0];return"::"!=(t=t.replace(n.substr(0,n.length-1),":")).substr(0,2)&&(t=t.substr(1)),"::"!=t.substr(-2,2)&&(t=t.substr(0,t.length-1)),t}function Nt(t){var e=new Error("malformed hex value");if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8==t.length){try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}}else{if(16!=t.length){if(32==t.length)return Rt(t);if(64==t.length){try{return Rt(t.substr(0,32))+"/"+Ot(t.substr(32))}catch(t){throw e}return}return t}try{return Nt(t.substr(0,8))+"/"+Ot(t.substr(8))}catch(t){throw e}}}function Ot(t){var e,r=new Error("malformed mask");try{e=new E(t,16).toString(2)}catch(t){throw r}if(!e.match(/^1*0*$/))throw r;return e.replace(/0+$/,"").length}function Bt(t){var e=new Error("malformed IP address");if(!(t=t.toLowerCase(t)).match(/^[0-9a-f.:/]+$/))throw e;if(!t.match(/^[0-9.]+$/)){var r;if(t.match(/^[0-9.]+\/[0-9]+$/))return Bt((r=t.split("/"))[0])+_t(parseInt(r[1]),32);if(t.match(/^[0-9a-f:]+$/)&&-1!==t.indexOf(":"))return Tt(t);if(t.match(/^[0-9a-f:]+\/[0-9]+$/)&&-1!==t.indexOf(":"))return Tt((r=t.split("/"))[0])+_t(parseInt(r[1]),128);throw e}var n=t.split(".");if(4!==n.length)throw e;var i="";try{for(var s=0;s<4;s++){i+=("0"+parseInt(n[s]).toString(16)).slice(-2)}return i}catch(t){throw e}}function _t(t,e){return 32==e&&0==t?"00000000":128==e&&0==t?"00000000000000000000000000000000":new E(Array(t+1).join("1")+Array(e-t+1).join("0"),2).toString(16)}function jt(t){var e=t.match(/.{4}/g).map(function(t){var e=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2),16);if(0==e&r<128)return String.fromCharCode(r);if(e<8){var n=128|63&r;return St((192|(7&e)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&r)>>6;var i=128|63&r;return St((224|(240&e)>>4).toString(16)+n.toString(16)+i.toString(16))});return e.join("")}function Ht(t){for(var e=encodeURIComponent(t),r="",n=0;n<e.length;n++)"%"==e[n]?(r+=e.substr(n,3),n+=2):r=r+"%"+dt(e[n]);return r}function kt(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))}function Lt(t){return!!t.match(/^[0-9A-Za-z-_.]+$/)}function Vt(t){return t.length%2==1?"0"+t:t.substr(0,1)>"7"?"00"+t:t}function Mt(t,e){if("string"!=typeof t||"string"!=typeof e)throw new Error("arguments shall be string");if(t.length!==e.length)throw new Error("input strings must have the same length");if("function"==typeof Buffer&&void 0!==Z){if(void 0!==Z.timingSafeEqual)return Z.timingSafeEqual(Buffer.from(t),Buffer.from(e));if(void 0!==Z.subtle&&Z.subtle.timingSafeEqual)return Z.subtle.timingSafeEqual(Buffer.from(t),Buffer.from(e))}return function(t,e){if("string"!=typeof t||"string"!=typeof e)throw new Error("arguments shall be string");if(t.length!==e.length)throw new Error("input strings must have the same length");const r=e.slice();for(var n=0,i=0;i<t.length;i++)n|=t.charCodeAt(i)^r.charCodeAt(i);return 0===n}(t,e)}function qt(t){if(!kt(t))return null;try{var e=[],r=t.substr(0,2),n=parseInt(r,16);e[0]=new String(Math.floor(n/40)),e[1]=new String(n%40);for(var i=t.substr(2),s=[],a=0;a<i.length/2;a++)s.push(parseInt(i.substr(2*a,2),16));var o=[],u="";for(a=0;a<s.length;a++)128&s[a]?u+=zt((127&s[a]).toString(2),7):(u+=zt((127&s[a]).toString(2),7),o.push(new String(parseInt(u,2))),u="");var c=e.join(".");return o.length>0&&(c=c+"."+o.join(".")),c}catch(t){return null}}function Kt(t){return Ut(new E(String(t),10))}function Ut(t){var e=t.toString(16);if("-"!=e.substr(0,1))return e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e),e;var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";return e=new E(n,16).xor(t).add(E.ONE).toString(16).replace(/^-/,"")}pt.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0<r&&r<10?r+1:-2},pt.getL=function(t,e){var r=pt.getLblen(t,e);return r<1?"":t.substr(e+2,2*r)},pt.getVblen=function(t,e){var r;return""==(r=pt.getL(t,e))?-1:("8"===r.substr(0,1)?new E(r.substr(2),16):new E(r,16)).intValue()},pt.getVidx=function(t,e){var r=pt.getLblen(t,e);return r<0?r:e+2*(r+1)},pt.getV=function(t,e){var r=pt.getVidx(t,e),n=pt.getVblen(t,e);return t.substr(r,2*n)},pt.getTLV=function(t,e){return t.substr(e,2)+pt.getL(t,e)+pt.getV(t,e)},pt.getTLVblen=function(t,e){return 2+2*pt.getLblen(t,e)+2*pt.getVblen(t,e)},pt.getNextSiblingIdx=function(t,e){return pt.getVidx(t,e)+2*pt.getVblen(t,e)},pt.getChildIdx=function(t,e){var r,n,i,s=pt,a=[];if((r=s.getVidx(t,e))+(n=2*s.getVblen(t,e))>t.length)throw new Error("too short ASN.1 value");"03"==t.substr(e,2)&&(r+=2,n-=2),i=0;for(var o=r;i<=n;){var u=s.getTLVblen(t,o);if(u<=0)throw new Error("malformed ASN.1: invalid TLV length");if((i+=u)<=n&&a.push(o),o+=u,i>=n)break}return a},pt.getNthChildIdx=function(t,e,r){return pt.getChildIdx(t,e)[r]},pt.getIdxbyList=function(t,e,r,n){var i,s,a=pt;return 0==r.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(i=r.shift())>=(s=a.getChildIdx(t,e)).length?-1:a.getIdxbyList(t,s[i],r,n)},pt.getIdxbyListEx=function(t,e,r,n){var i,s,a=pt;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),s=a.getChildIdx(t,e);for(var o=0,u=0;u<s.length;u++){var c=t.substr(s[u],2);if("number"==typeof i&&!a.isContextTag(c)&&o==i||"string"==typeof i&&a.isContextTag(c,i))return a.getIdxbyListEx(t,s[u],r,n);a.isContextTag(c)||o++}return-1},pt.getTLVbyList=function(t,e,r,n){var i=pt,s=i.getIdxbyList(t,e,r,n);return-1==s||s>=t.length?null:i.getTLV(t,s)},pt.getTLVbyListEx=function(t,e,r,n){var i=pt,s=i.getIdxbyListEx(t,e,r,n);return-1==s?null:i.getTLV(t,s)},pt.getVbyList=function(t,e,r,n,i){var s,a,o=pt;return-1==(s=o.getIdxbyList(t,e,r,n))||s>=t.length?null:(a=o.getV(t,s),!0===i&&(a=a.substr(2)),a)},pt.getVbyListEx=function(t,e,r,n,i){var s,a,o=pt;return-1==(s=o.getIdxbyListEx(t,e,r,n))?null:(a=o.getV(t,s),"03"==t.substr(s,2)&&!1!==i&&(a=a.substr(2)),a)},pt.getInt=function(t,e,r){null==r&&(r=-1);try{var n=t.substr(e,2);if("02"!=n&&"03"!=n)return r;var i=pt.getV(t,e);return"02"==n?parseInt(i,16):function(t){if(t.length%2!=0)return-1;if(t=t.toLowerCase(),null==t.match(/^[0-9a-f]+$/))return-1;try{var e=t.substr(0,2);if("00"==e)return parseInt(t.substr(2),16);var r=parseInt(e,16);if(r>7)return-1;var n=t.substr(2),i=parseInt(n,16).toString(2);"0"==i&&(i="00000000"),i=i.slice(0,0-r);var s=parseInt(i,2);return NaN==s?-1:s}catch(t){return-1}}(i)}catch(t){return r}},pt.getOID=function(t,e,r){null==r&&(r=null);try{return"06"!=t.substr(e,2)?r:qt(pt.getV(t,e))}catch(t){return r}},pt.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=pt.getOID(t,e,r);if(n==r)return r;var i=ht.asn1.x509.OID.oid2name(n);return""==i?n:i}catch(t){return r}},pt.getString=function(t,e,r){null==r&&(r=null);try{return bt(pt.getV(t,e))}catch(t){return r}},pt.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var s=t.substr(2),a=[],o=0;o<s.length/2;o++)a.push(parseInt(s.substr(2*o,2),16));var u=[],c="";for(o=0;o<a.length;o++)128&a[o]?c+=e((127&a[o]).toString(2),7):(c+=e((127&a[o]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var h=r.join(".");return u.length>0&&(h=h+"."+u.join(".")),h},pt.dump=function(t,e,r,n){var i=pt,s=i.getV,a=i.dump,o=i.getChildIdx,u=t;t instanceof ht.asn1.ASN1Object&&(u=t.tohex());var c=function(t,e){return t.length<=2*e?t:t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e)};void 0===e&&(e={ommit_long_octet:32}),void 0===r&&(r=0),void 0===n&&(n="");var h,l=e.ommit_long_octet;if("01"==(h=u.substr(r,2)))return"00"==(f=s(u,r))?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n";if("02"==h)return n+"INTEGER "+c(f=s(u,r),l)+"\n";if("03"==h){var f=s(u,r);if(i.isASN1HEX(f.substr(2))){var p=n+"BITSTRING, encapsulates\n";return p+=a(f.substr(2),e,0,n+" ")}return n+"BITSTRING "+c(f,l)+"\n"}if("04"==h){f=s(u,r);if(i.isASN1HEX(f)){p=n+"OCTETSTRING, encapsulates\n";return p+=a(f,e,0,n+" ")}return n+"OCTETSTRING "+c(f,l)+"\n"}if("05"==h)return n+"NULL\n";if("06"==h){var g=s(u,r),d=ht.asn1.ASN1Util.oidHexToInt(g),v=ht.asn1.x509.OID.oid2name(d),m=d.replace(/\./g," ");return""!=v?n+"ObjectIdentifier "+v+" ("+m+")\n":n+"ObjectIdentifier ("+m+")\n"}if("0a"==h)return n+"ENUMERATED "+parseInt(s(u,r))+"\n";if("0c"==h)return n+"UTF8String '"+St(s(u,r))+"'\n";if("13"==h)return n+"PrintableString '"+St(s(u,r))+"'\n";if("14"==h)return n+"TeletexString '"+St(s(u,r))+"'\n";if("16"==h)return n+"IA5String '"+St(s(u,r))+"'\n";if("17"==h)return n+"UTCTime "+St(s(u,r))+"\n";if("18"==h)return n+"GeneralizedTime "+St(s(u,r))+"\n";if("1a"==h)return n+"VisualString '"+St(s(u,r))+"'\n";if("1e"==h)return n+"BMPString '"+jt(s(u,r))+"'\n";if("30"==h){if("3000"==u.substr(r,4))return n+"SEQUENCE {}\n";p=n+"SEQUENCE\n";var y=e;if((2==(S=o(u,r)).length||3==S.length)&&"06"==u.substr(S[0],2)&&"04"==u.substr(S[S.length-1],2)){v=i.oidname(s(u,S[0]));var x=JSON.parse(JSON.stringify(e));x.x509ExtName=v,y=x}for(var w=0;w<S.length;w++)p+=a(u,y,S[w],n+" ");return p}if("31"==h){p=n+"SET\n";var S=o(u,r);for(w=0;w<S.length;w++)p+=a(u,e,S[w],n+" ");return p}if(128&(h=parseInt(h,16))){var E=31&h;if(32&h){for(p=n+"["+E+"]\n",S=o(u,r),w=0;w<S.length;w++)p+=a(u,e,S[w],n+" ");return p}f=s(u,r);if(pt.isASN1HEX(f)){var p=n+"["+E+"]\n";return p+=a(f,e,0,n+" ")}return("68747470"==f.substr(0,8)||"subjectAltName"===e.x509ExtName&&2==E)&&(f=St(f)),p=n+"["+E+"] "+f+"\n"}return n+"UNKNOWN("+h+") "+s(u,r)+"\n"},pt.parse=function(t){var e=pt,r=e.parse,n=e.isASN1HEX,i=e.getV,s=e.getTLV,a=e.getChildIdx,o=ht.asn1,u=o.ASN1Util.oidHexToInt,c=o.x509.OID.oid2name,h=St,l=jt,f=Et,p={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},g=t.substr(0,2),d={},v=i(t,0);if("01"==g)return"0101ff"==t?{bool:!0}:{bool:!1};if("02"==g)return{int:{hex:v}};if("03"==g)try{if("00"!=v.substr(0,2))throw"not encap";var m=v.substr(2);if(!n(m))throw"not encap";return{bitstr:{obj:r(m)}}}catch(t){var y=null;return v.length<=10&&(y=function(t){if("string"!=typeof t)return null;if(t.length%2!=0)return null;if(!t.match(/^[0-9a-f]+$/))return null;try{var e=parseInt(t.substr(0,2),16);if(e<0||7<e)return null;for(var r=t.substr(2),n="",i=0;i<r.length;i+=2){var s=r.substr(i,2),a=parseInt(s,16).toString(2);n+=a=("0000000"+a).slice(-8)}return n.substr(0,n.length-e)}catch(t){return null}}(v)),null==y?{bitstr:{hex:v}}:{bitstr:{bin:y}}}else if("04"==g)try{if(!n(v))throw"not encap";return{octstr:{obj:r(v)}}}catch(t){return{octstr:{hex:v}}}else{if("05"==g)return{null:""};if("06"==g){var x=u(v),w=c(x);return""==w?{oid:x}:{oid:w}}if("0a"==g)return v.length>4?{enum:{hex:v}}:{enum:parseInt(v,16)};if("30"==g||"31"==g)return d[p[g]]=function(t){for(var e=[],n=a(t,0),i=0;i<n.length;i++){var o=n[i],u=s(t,o),c=r(u);e.push(c)}return e}(t),d;if("14"==g){var S=f(v);return d[p[g]]={str:S},d}if("1e"==g){S=l(v);return d[p[g]]={str:S},d}if(-1!=":0c:12:13:16:17:18:1a:".indexOf(g)){S=h(v);return d[p[g]]={str:S},d}if(g.match(/^8[0-9]$/))return null==(S=h(v))|""==S||null!=S.match(/[\x00-\x1F\x7F-\x9F]/)||null!=S.match(/[\u0000-\u001F\u0080–\u009F]/)?{tag:{tag:g,explicit:!1,hex:v}}:{tag:{tag:g,explicit:!1,str:S}};if(!g.match(/^a[0-9]$/)){var E=new ht.asn1.ASN1Object;return E.hV=v,{asn1:{tlv:g+E.getLengthHexFromValue()+v}}}try{if(!n(v))throw new Error("not encap");return{tag:{tag:g,explicit:!0,obj:r(v)}}}catch(t){return{tag:{tag:g,explicit:!0,hex:v}}}}},pt.isContextTag=function(t,e){var r,n;t=t.toLowerCase();try{r=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&r);try{return null!=e.match(/^\[[0-9]+\]$/)&&(!((n=parseInt(e.substr(1,e.length-1),10))>31)&&(128==(192&r)&&(31&r)==n))}catch(t){return!1}},pt.isASN1HEX=function(t){var e=pt;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0);return t.length-n.length-i.length==2*r},pt.checkStrictDER=function(t,e,r,n,i){var s=pt;if(void 0===r){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!ht.lang.String.isHex(t))throw new Error("not hex string");r=t.length,i=(n=t.length/2)<128?1:Math.ceil(n.toString(16))+1}if(s.getL(t,e).length>2*i)throw new Error("L of TLV too long: idx="+e);var a=s.getVblen(t,e);if(a>n)throw new Error("value of L too long than hex: idx="+e);var o=s.getTLV(t,e),u=o.length-2-s.getL(t,e).length;if(u!==2*a)throw new Error("V string length and L's value not the same:"+u+"/"+2*a);if(0===e&&t.length!=o.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+o.length);var c=t.substr(e,2);if("02"===c){var h=s.getVidx(t,e);if("00"==t.substr(h,2)&&t.charCodeAt(h+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var l=s.getVblen(t,e),f=0,p=s.getChildIdx(t,e),g=0;g<p.length;g++){f+=s.getTLV(t,p[g]).length,s.checkStrictDER(t,p[g],r,n,i)}if(2*l!=f)throw new Error("sum of children's TLV length and L unmatch: "+2*l+"!="+f)}},pt.oidname=function(t){var e=ht.asn1;ht.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var r=e.x509.OID.oid2name(t);return""===r&&(r=t),r},void 0!==ht&&ht||(ht={}),void 0!==ht.asn1&&ht.asn1||(ht.asn1={}),void 0!==ht.asn1.x509&&ht.asn1.x509||(ht.asn1.x509={}),ht.asn1.x509.Certificate=function(t){ht.asn1.x509.Certificate.superclass.constructor.call(this);var e=ht.asn1,r=e.DERBitString,n=e.DERSequence,i=e.x509,s=i.TBSCertificate,a=i.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=this.params,e=t.sigalg;null!=t.sigalg.name&&(e=t.sigalg.name);var r=t.tbsobj.tohex(),n=new ht.crypto.Signature({alg:e});n.init(t.cakey),n.updateHex(r),t.sighex=n.sign()},this.getPEM=function(){return At(this.tohex(),"CERTIFICATE")},this.tohex=function(){var t=this.params;if(null!=t.tbsobj&&null!=t.tbsobj||(t.tbsobj=new s(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new a({name:t.sigalg})),e.push(new r({hex:"00"+t.sighex})),new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&(this.params=t)},$t(ht.asn1.x509.Certificate,ht.asn1.ASN1Object),ht.asn1.x509.TBSCertificate=function(t){ht.asn1.x509.TBSCertificate.superclass.constructor.call(this);var e=ht.asn1,r=e.x509,n=e.DERTaggedObject,i=e.DERInteger,s=e.DERSequence,a=r.AlgorithmIdentifier,o=r.Time,u=r.X500Name,c=r.Extensions,h=r.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=[],e=this.params;if(null!=e.version||1!=e.version){var r=2;null!=e.version&&(r=e.version-1);var l=new n({obj:new i({int:r})});t.push(l)}return t.push(new i(e.serial)),t.push(new a({name:e.sigalg})),t.push(new u(e.issuer)),t.push(new s({array:[new o(e.notbefore),new o(e.notafter)]})),t.push(new u(e.subject)),t.push(new h(Jt.getKey(e.sbjpubkey))),void 0!==e.ext&&e.ext.length>0&&t.push(new n({tag:"a3",obj:new c(e.ext)})),new ht.asn1.DERSequence({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.x509.TBSCertificate,ht.asn1.ASN1Object),ht.asn1.x509.Extensions=function(t){ht.asn1.x509.Extensions.superclass.constructor.call(this);var e=ht.asn1,r=e.DERSequence,n=e.x509;this.aParam=[],this.setByParam=function(t){this.aParam=t},this.tohex=function(){for(var t=[],e=0;e<this.aParam.length;e++){var i=this.aParam[e],s=i.extname,a=null;if(null!=i.extn)a=new n.PrivateExtension(i);else if("subjectKeyIdentifier"==s)a=new n.SubjectKeyIdentifier(i);else if("keyUsage"==s)a=new n.KeyUsage(i);else if("subjectAltName"==s)a=new n.SubjectAltName(i);else if("issuerAltName"==s)a=new n.IssuerAltName(i);else if("basicConstraints"==s)a=new n.BasicConstraints(i);else if("nameConstraints"==s)a=new n.NameConstraints(i);else if("cRLDistributionPoints"==s)a=new n.CRLDistributionPoints(i);else if("certificatePolicies"==s)a=new n.CertificatePolicies(i);else if("policyMappings"==s)a=new n.PolicyMappings(i);else if("policyConstraints"==s)a=new n.PolicyConstraints(i);else if("inhibitAnyPolicy"==s)a=new n.InhibitAnyPolicy(i);else if("authorityKeyIdentifier"==s)a=new n.AuthorityKeyIdentifier(i);else if("extKeyUsage"==s)a=new n.ExtKeyUsage(i);else if("authorityInfoAccess"==s)a=new n.AuthorityInfoAccess(i);else if("cRLNumber"==s)a=new n.CRLNumber(i);else if("cRLReason"==s)a=new n.CRLReason(i);else if("ocspNonce"==s)a=new n.OCSPNonce(i);else if("ocspNoCheck"==s)a=new n.OCSPNoCheck(i);else if("adobeTimeStamp"==s)a=new n.AdobeTimeStamp(i);else{if("subjectDirectoryAttributes"!=s)throw new Error("extension not supported:"+JSON.stringify(i));a=new n.SubjectDirectoryAttributes(i)}null!=a&&t.push(a)}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.x509.Extensions,ht.asn1.ASN1Object),ht.asn1.x509.Extension=function(t){ht.asn1.x509.Extension.superclass.constructor.call(this);var e=ht.asn1,r=e.DERObjectIdentifier,n=e.DEROctetString;e.DERBitString;var i=e.DERBoolean,s=e.DERSequence;this.tohex=function(){var t=new r({oid:this.oid}),e=new n({hex:this.getExtnValueHex()}),a=new Array;return a.push(t),this.critical&&a.push(new i),a.push(e),new s({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,void 0!==t&&void 0!==t.critical&&(this.critical=t.critical)},$t(ht.asn1.x509.Extension,ht.asn1.ASN1Object),ht.asn1.x509.KeyUsage=function(t){ht.asn1.x509.KeyUsage.superclass.constructor.call(this,t);var e=Error,r={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var t=this.getBinValue();return this.asn1ExtnValue=new ht.asn1.DERBitString({bin:t}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var t=this.params;if("object"!=typeof t||"object"!=typeof t.names&&"string"!=typeof t.bin)throw new e("parameter not yet set");if(null!=t.names)return Wt(t.names,r);if(null!=t.bin)return t.bin;throw new e("parameter not set properly")},this.oid="2.5.29.15",void 0!==t&&(this.params=t)},$t(ht.asn1.x509.KeyUsage,ht.asn1.x509.Extension),ht.asn1.x509.BasicConstraints=function(t){ht.asn1.x509.BasicConstraints.superclass.constructor.call(this,t);var e=ht.asn1,r=e.DERBoolean,n=e.DERInteger,i=e.DERSequence;this.getExtnValueHex=function(){var t=new Array;this.cA&&t.push(new r),this.pathLen>-1&&t.push(new n({int:this.pathLen}));var e=new i({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==t&&(void 0!==t.cA&&(this.cA=t.cA),void 0!==t.pathLen&&(this.pathLen=t.pathLen))},$t(ht.asn1.x509.BasicConstraints,ht.asn1.x509.Extension),ht.asn1.x509.CRLDistributionPoints=function(t){ht.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t);var e=ht.asn1,r=e.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(t){for(var n=[],i=0;i<t.length;i++)if(t[i]instanceof ht.asn1.ASN1Object)n.push(t[i]);else{var s=new r.DistributionPoint(t[i]);n.push(s)}this.asn1ExtnValue=new e.DERSequence({array:n})},this.setByOneURI=function(t){var e=new r.DistributionPoint({fulluri:t});this.setByDPArray([e])},this.oid="2.5.29.31",void 0!==t&&(void 0!==t.array?this.setByDPArray(t.array):void 0!==t.uri&&this.setByOneURI(t.uri))},$t(ht.asn1.x509.CRLDistributionPoints,ht.asn1.x509.Extension),ht.asn1.x509.DistributionPoint=function(t){ht.asn1.x509.DistributionPoint.superclass.constructor.call(this);var e=ht.asn1,r=e.x509.DistributionPointName;this.tohex=function(){var t=new e.DERSequence;if(null!=this.asn1DP){var r=new e.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});t.appendASN1Object(r)}return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.dpobj?this.asn1DP=t.dpobj:void 0!==t.dpname?this.asn1DP=new r(t.dpname):void 0!==t.fulluri&&(this.asn1DP=new r({full:[{uri:t.fulluri}]})))},$t(ht.asn1.x509.DistributionPoint,ht.asn1.ASN1Object),ht.asn1.x509.DistributionPointName=function(t){ht.asn1.x509.DistributionPointName.superclass.constructor.call(this);var e=ht.asn1,r=e.DERTaggedObject;if(this.tohex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new r({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t)if(e.x509.GeneralNames.prototype.isPrototypeOf(t))this.type="full",this.tag="a0",this.asn1V=t;else{if(void 0===t.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new e.x509.GeneralNames(t.full)}},$t(ht.asn1.x509.DistributionPointName,ht.asn1.ASN1Object),ht.asn1.x509.CertificatePolicies=function(t){ht.asn1.x509.CertificatePolicies.superclass.constructor.call(this,t);var e=ht.asn1,r=e.x509,n=e.DERSequence,i=r.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++)t.push(new i(this.params.array[e]));var r=new n({array:t});return this.asn1ExtnValue=r,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",void 0!==t&&(this.params=t)},$t(ht.asn1.x509.CertificatePolicies,ht.asn1.x509.Extension),ht.asn1.x509.PolicyInformation=function(t){ht.asn1.x509.PolicyInformation.superclass.constructor.call(this,t);var e=ht.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.x509.PolicyQualifierInfo;this.params=null,this.tohex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var t=[new n(this.params.policyoid)];if(void 0!==this.params.array){for(var e=[],s=0;s<this.params.array.length;s++)e.push(new i(this.params.array[s]));e.length>0&&t.push(new r({array:e}))}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},$t(ht.asn1.x509.PolicyInformation,ht.asn1.ASN1Object),ht.asn1.x509.PolicyQualifierInfo=function(t){ht.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,t);var e=ht.asn1,r=e.DERSequence,n=e.DERIA5String,i=e.DERObjectIdentifier,s=e.x509.UserNotice;this.params=null,this.tohex=function(){return void 0!==this.params.cps?new r({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]}).tohex():null!=this.params.unotice?new r({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new s(this.params.unotice)]}).tohex():void 0},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},$t(ht.asn1.x509.PolicyQualifierInfo,ht.asn1.ASN1Object),ht.asn1.x509.UserNotice=function(t){ht.asn1.x509.UserNotice.superclass.constructor.call(this,t);var e=ht.asn1.DERSequence;ht.asn1.DERInteger;var r=ht.asn1.x509.DisplayText,n=ht.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var t=[];return void 0!==this.params.noticeref&&t.push(new n(this.params.noticeref)),void 0!==this.params.exptext&&t.push(new r(this.params.exptext)),new e({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},$t(ht.asn1.x509.UserNotice,ht.asn1.ASN1Object),ht.asn1.x509.NoticeReference=function(t){ht.asn1.x509.NoticeReference.superclass.constructor.call(this,t);var e=ht.asn1.DERSequence,r=ht.asn1.DERInteger,n=ht.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var t=[];if(void 0!==this.params.org&&t.push(new n(this.params.org)),void 0!==this.params.noticenum){for(var i=[],s=this.params.noticenum,a=0;a<s.length;a++)i.push(new r(s[a]));t.push(new e({array:i}))}if(0==t.length)throw new Error("parameter is empty");return new e({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},$t(ht.asn1.x509.NoticeReference,ht.asn1.ASN1Object),ht.asn1.x509.DisplayText=function(t){ht.asn1.x509.DisplayText.superclass.constructor.call(this,t),this.hT="0c",void 0!==t&&("ia5"===t.type?this.hT="16":"vis"===t.type?this.hT="1a":"bmp"===t.type&&(this.hT="1e"))},$t(ht.asn1.x509.DisplayText,ht.asn1.DERAbstractString),ht.asn1.x509.PolicyMappings=function(t){ht.asn1.x509.PolicyMappings.superclass.constructor.call(this,t);var e=ht.asn1;e.x509;var r=e.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){for(var t=this.params,e=[],n=0;n<t.array.length;n++){var i=t.array[n];e.push({seq:[{oid:i[0]},{oid:i[1]}]})}return this.asn1ExtnValue=r({seq:e}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",void 0!==t&&(this.params=t)},$t(ht.asn1.x509.PolicyMappings,ht.asn1.x509.Extension),ht.asn1.x509.PolicyConstraints=function(t){ht.asn1.x509.PolicyConstraints.superclass.constructor.call(this,t);var e=ht.asn1;e.x509;var r=e.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[];return null!=t.reqexp&&e.push({tag:{tagi:"80",obj:{int:t.reqexp}}}),null!=t.inhibit&&e.push({tag:{tagi:"81",obj:{int:t.inhibit}}}),this.asn1ExtnValue=r({seq:e}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",void 0!==t&&(this.params=t)},$t(ht.asn1.x509.PolicyConstraints,ht.asn1.x509.Extension),ht.asn1.x509.InhibitAnyPolicy=function(t){ht.asn1.x509.InhibitAnyPolicy.superclass.constructor.call(this,t);var e=ht.asn1;e.x509;var r=e.ASN1Util.newObject;this.params=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=r({int:this.params.skip}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.54",void 0!==t&&(this.params=t)},$t(ht.asn1.x509.InhibitAnyPolicy,ht.asn1.x509.Extension),ht.asn1.x509.NameConstraints=function(t){ht.asn1.x509.NameConstraints.superclass.constructor.call(this,t);var e=ht.asn1,r=e.x509,n=e.ASN1Util.newObject,i=r.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[];if(null!=t.permit&&null!=t.permit.length){for(var r=[],s=0;s<t.permit.length;s++)r.push(new i(t.permit[s]));e.push({tag:{tagi:"a0",obj:{seq:r}}})}if(null!=t.exclude&&null!=t.exclude.length){var a=[];for(s=0;s<t.exclude.length;s++)a.push(new i(t.exclude[s]));e.push({tag:{tagi:"a1",obj:{seq:a}}})}return this.asn1ExtnValue=n({seq:e}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",void 0!==t&&(this.params=t)},$t(ht.asn1.x509.NameConstraints,ht.asn1.x509.Extension),ht.asn1.x509.GeneralSubtree=function(t){ht.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var e=ht.asn1,r=e.x509.GeneralName,n=e.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params,e=[new r(t)];return null!=t.min&&e.push({tag:{tagi:"80",obj:{int:t.min}}}),null!=t.max&&e.push({tag:{tagi:"81",obj:{int:t.max}}}),n({seq:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.x509.GeneralSubtree,ht.asn1.ASN1Object),ht.asn1.x509.ExtKeyUsage=function(t){ht.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,t);var e=ht.asn1;this.setPurposeArray=function(t){this.asn1ExtnValue=new e.DERSequence;for(var r=0;r<t.length;r++){var n=new e.DERObjectIdentifier(t[r]);this.asn1ExtnValue.appendASN1Object(n)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",void 0!==t&&void 0!==t.array&&this.setPurposeArray(t.array)},$t(ht.asn1.x509.ExtKeyUsage,ht.asn1.x509.Extension),ht.asn1.x509.AuthorityKeyIdentifier=function(t){ht.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,t);var e=ht,r=e.asn1,n=r.DERTaggedObject,i=r.x509.GeneralNames;e.crypto.Util.isKey,this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var t=new Array;this.asn1KID&&t.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&t.push(new n({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&t.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var e=new r.DERSequence({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new ht.asn1.DEROctetString(t);else if("object"==typeof t&&ht.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN ")){var e=t;"string"==typeof t&&(e=Jt.getKey(t));var r=Jt.getKeyID(e);this.asn1KID=new ht.asn1.DEROctetString({hex:r})}},this.setCertIssuerByParam=function(t){void 0!==t.str||void 0!==t.ldapstr||void 0!==t.hex||void 0!==t.certsubject||void 0!==t.certissuer?this.asn1CertIssuer=new ht.asn1.x509.X500Name(t):"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&-1!=t.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new ht.asn1.x509.X500Name({certissuer:t}))},this.setCertSNByParam=function(t){if(void 0!==t.str||void 0!==t.bigint||void 0!==t.hex)this.asn1CertSN=new ht.asn1.DERInteger(t);else if("string"==typeof t&&-1!=t.indexOf("BEGIN ")&&t.indexOf("CERTIFICATE")){var e=new Qt;e.readCertPEM(t);var r=e.getSerialNumberHex();this.asn1CertSN=new ht.asn1.DERInteger({hex:r})}},this.oid="2.5.29.35",void 0!==t&&(void 0!==t.kid&&this.setKIDByParam(t.kid),void 0!==t.issuer&&this.setCertIssuerByParam(t.issuer),void 0!==t.sn&&this.setCertSNByParam(t.sn),void 0!==t.issuersn&&"string"==typeof t.issuersn&&-1!=t.issuersn.indexOf("BEGIN ")&&t.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(t.issuersn),this.setCertIssuerByParam(t.issuersn)))},$t(ht.asn1.x509.AuthorityKeyIdentifier,ht.asn1.x509.Extension),ht.asn1.x509.SubjectKeyIdentifier=function(t){ht.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,t);var e=ht.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new e(t);else if("object"==typeof t&&ht.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN")){var r=t;"string"==typeof t&&(r=Jt.getKey(t));var n=Jt.getKeyID(r);this.asn1KID=new ht.asn1.DEROctetString({hex:n})}},this.oid="2.5.29.14",void 0!==t&&void 0!==t.kid&&this.setKIDByParam(t.kid)},$t(ht.asn1.x509.SubjectKeyIdentifier,ht.asn1.x509.Extension),ht.asn1.x509.AuthorityInfoAccess=function(t){ht.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,t),this.setAccessDescriptionArray=function(t){for(var e=new Array,r=ht.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,s=r.x509.GeneralName,a=0;a<t.length;a++){var o,u=t[a];if(void 0!==u.ocsp)o=new n({array:[new i({oid:"1.3.6.1.5.5.7.48.1"}),new s({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));o=new n({array:[new i({oid:"1.3.6.1.5.5.7.48.2"}),new s({uri:u.caissuer})]})}e.push(o)}this.asn1ExtnValue=new n({array:e})},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==t&&void 0!==t.array&&this.setAccessDescriptionArray(t.array)},$t(ht.asn1.x509.AuthorityInfoAccess,ht.asn1.x509.Extension),ht.asn1.x509.SubjectAltName=function(t){ht.asn1.x509.SubjectAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new ht.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.17",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},$t(ht.asn1.x509.SubjectAltName,ht.asn1.x509.Extension),ht.asn1.x509.IssuerAltName=function(t){ht.asn1.x509.IssuerAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new ht.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.18",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},$t(ht.asn1.x509.IssuerAltName,ht.asn1.x509.Extension),ht.asn1.x509.SubjectDirectoryAttributes=function(t){ht.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,t);var e=ht.asn1,r=e.DERSequence,n=e.ASN1Util.newObject,i=e.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++){var s=this.params.array[e];if(null==s.attr||null==s.array){var a={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={gentime:s.str};else if("placeOfBirth"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={utf8str:s.str};else if("gender"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={prnstr:s.str};else if("countryOfCitizenship"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={prnstr:s.str};else{if("countryOfResidence"!=s.attr)throw new Error("unsupported attribute: "+s.attr);a.seq[0].oid=i(s.attr),a.seq[1].set[0]={prnstr:s.str}}t.push(new n(a))}else{var o={seq:[{oid:s.attr},{set:s.array}]};t.push(n(o))}}var u=new r({array:t});return this.asn1ExtnValue=u,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",void 0!==t&&(this.params=t)},$t(ht.asn1.x509.SubjectDirectoryAttributes,ht.asn1.x509.Extension),ht.asn1.x509.PrivateExtension=function(t){ht.asn1.x509.PrivateExtension.superclass.constructor.call(this,t);var e=ht,r=e.lang.String.isHex,n=e.asn1,i=n.x509.OID.name2oid,s=n.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.oid=i(t.extname),this.params=t},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var t=this.params.extn;if("string"==typeof t&&r(t))return t;if("object"==typeof t)try{return s(t).tohex()}catch(t){}throw new Error("unsupported extn value")},null!=t&&this.setByParam(t)},$t(ht.asn1.x509.PrivateExtension,ht.asn1.x509.Extension),ht.asn1.x509.CRL=function(t){ht.asn1.x509.CRL.superclass.constructor.call(this);var e=ht.asn1,r=e.DERSequence,n=e.DERBitString,i=e.x509,s=i.AlgorithmIdentifier,a=i.TBSCertList;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=new a(this.params).tohex(),e=new ht.crypto.Signature({alg:this.params.sigalg});e.init(this.params.cakey),e.updateHex(t);var r=e.sign();this.params.sighex=r},this.getPEM=function(){return At(this.tohex(),"X509 CRL")},this.tohex=function(){var t=this.params;if(null==t.tbsobj&&(t.tbsobj=new a(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new s({name:t.sigalg})),e.push(new n({hex:"00"+t.sighex})),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&(this.params=t)},$t(ht.asn1.x509.CRL,ht.asn1.ASN1Object),ht.asn1.x509.TBSCertList=function(t){ht.asn1.x509.TBSCertList.superclass.constructor.call(this);var e=ht.asn1,r=e.DERInteger,n=e.DERSequence,i=e.DERTaggedObject;e.DERObjectIdentifier;var s=e.x509,a=s.AlgorithmIdentifier,o=s.Time,u=s.Extensions,c=s.X500Name;this.params=null,this.setByParam=function(t){this.params=t},this.getRevCertSequence=function(){for(var t=[],e=this.params.revcert,i=0;i<e.length;i++){var s=[new r(e[i].sn),new o(e[i].date)];null!=e[i].ext&&s.push(new u(e[i].ext)),t.push(new n({array:s}))}return new n({array:t})},this.tohex=function(){var t=[],e=this.params;if(null!=e.version){var s=e.version-1,h=new r({int:s});t.push(h)}if(t.push(new a({name:e.sigalg})),t.push(new c(e.issuer)),t.push(new o(e.thisupdate)),null!=e.nextupdate&&t.push(new o(e.nextupdate)),null!=e.revcert&&t.push(this.getRevCertSequence()),null!=e.ext){var l=new u(e.ext);t.push(new i({tag:"a0",explicit:!0,obj:l}))}return new n({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.x509.TBSCertList,ht.asn1.ASN1Object),ht.asn1.x509.CRLEntry=function(t){ht.asn1.x509.CRLEntry.superclass.constructor.call(this);var e=ht.asn1;this.setCertSerial=function(t){this.sn=new e.DERInteger(t)},this.setRevocationDate=function(t){this.time=new e.x509.Time(t)},this.tohex=function(){var t=new e.DERSequence({array:[this.sn,this.time]});return this.TLV=t.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.time&&this.setRevocationDate(t.time),void 0!==t.sn&&this.setCertSerial(t.sn))},$t(ht.asn1.x509.CRLEntry,ht.asn1.ASN1Object),ht.asn1.x509.CRLNumber=function(t){ht.asn1.x509.CRLNumber.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ht.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",null!=t&&(this.params=t)},$t(ht.asn1.x509.CRLNumber,ht.asn1.x509.Extension),ht.asn1.x509.CRLReason=function(t){ht.asn1.x509.CRLReason.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ht.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",null!=t&&(this.params=t)},$t(ht.asn1.x509.CRLReason,ht.asn1.x509.Extension),ht.asn1.x509.OCSPNonce=function(t){ht.asn1.x509.OCSPNonce.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ht.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=t&&(this.params=t)},$t(ht.asn1.x509.OCSPNonce,ht.asn1.x509.Extension),ht.asn1.x509.OCSPNoCheck=function(t){ht.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ht.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=t&&(this.params=t)},$t(ht.asn1.x509.OCSPNoCheck,ht.asn1.x509.Extension),ht.asn1.x509.AdobeTimeStamp=function(t){ht.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,t);var e=ht.asn1,r=e.DERInteger,n=e.DERBoolean,i=e.DERSequence,s=e.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[new r(1)];return e.push(new s({uri:t.uri})),null!=t.reqauth&&e.push(new n(t.reqauth)),this.asn1ExtnValue=new i({array:e}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==t&&this.setByParam(t)},$t(ht.asn1.x509.AdobeTimeStamp,ht.asn1.x509.Extension),ht.asn1.x509.X500Name=function(t){ht.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=ht.asn1,r=e.x509,n=r.RDN;this.setByString=function(t,e){void 0!==e&&(this.sRule=e);var r=t.split("/");r.shift();for(var i=[],s=0;s<r.length;s++)if(r[s].match(/^[^=]+=.+$/))i.push(r[s]);else{var a=i.length-1;i[a]=i[a]+"/"+r[s]}for(s=0;s<i.length;s++)this.asn1Array.push(new n({str:i[s],rule:this.sRule}))},this.setByLdapString=function(t,e){void 0!==e&&(this.sRule=e);var n=r.X500Name.ldapToCompat(t);this.setByString(n,e)},this.setByObject=function(t,e){for(var r in void 0!==e&&(this.sRule=e),t)if(t.hasOwnProperty(r)){var i=new n({str:r+"="+t[r],rule:this.sRule});this.asn1Array?this.asn1Array.push(i):this.asn1Array=[i]}},this.setByParam=function(t){var e;(void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.array)?this.paramArray=t.array:void 0!==t.str?this.setByString(t.str):void 0!==t.ldapstr?this.setByLdapString(t.ldapstr):void 0!==t.hex?this.hTLV=t.hex:void 0!==t.certissuer?((e=new Qt).readCertPEM(t.certissuer),this.hTLV=e.getIssuerHex()):void 0!==t.certsubject?((e=new Qt).readCertPEM(t.certsubject),this.hTLV=e.getSubjectHex()):"object"==typeof t&&void 0===t.certsubject&&void 0===t.certissuer&&this.setByObject(t)},this.tohex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var r={array:this.paramArray[t]};"utf8"!=this.sRule&&(r.rule=this.sRule);var i=new n(r);this.asn1Array.push(i)}var s=new e.DERSequence({array:this.asn1Array});return this.hTLV=s.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.x509.X500Name,ht.asn1.ASN1Object),ht.asn1.x509.X500Name.compatToLDAP=function(t){if("/"!==t.substr(0,1))throw"malformed input";var e=(t=t.substr(1)).split("/");return e.reverse(),e=e.map(function(t){return t.replace(/,/,"\\,")}),e.join(",")},ht.asn1.x509.X500Name.onelineToLDAP=function(t){return ht.asn1.x509.X500Name.compatToLDAP(t)},ht.asn1.x509.X500Name.ldapToCompat=function(t){for(var e=t.split(","),r=!1,n=[],i=0;e.length>0;i++){var s=e.shift();if(!0===r){var a=(n.pop()+","+s).replace(/\\,/g,",");n.push(a),r=!1}else n.push(s);"\\"===s.substr(-1,1)&&(r=!0)}return n=n.map(function(t){return t.replace("/","\\/")}),n.reverse(),"/"+n.join("/")},ht.asn1.x509.X500Name.ldapToOneline=function(t){return ht.asn1.x509.X500Name.ldapToCompat(t)},ht.asn1.x509.RDN=function(t){ht.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=ht.asn1.x509.AttributeTypeAndValue;this.setByParam=function(t){void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.str&&this.addByMultiValuedString(t.str),void 0!==t.array&&(this.paramArray=t.array)},this.addByString=function(t){this.asn1Array.push(new ht.asn1.x509.AttributeTypeAndValue({str:t,rule:this.sRule}))},this.addByMultiValuedString=function(t){for(var e=ht.asn1.x509.RDN.parseString(t),r=0;r<e.length;r++)this.addByString(e[r])},this.tohex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var r=this.paramArray[t];void 0!==r.rule&&"utf8"!=this.sRule&&(r.rule=this.sRule);var n=new e(r);this.asn1Array.push(n)}var i=new ht.asn1.DERSet({array:this.asn1Array});return this.TLV=i.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.x509.RDN,ht.asn1.ASN1Object),ht.asn1.x509.RDN.parseString=function(t){for(var e=t.split(/\+/),r=!1,n=[],i=0;e.length>0;i++){var s=e.shift();if(!0===r){var a=(n.pop()+"+"+s).replace(/\\\+/g,"+");n.push(a),r=!1}else n.push(s);"\\"===s.substr(-1,1)&&(r=!0)}var o=!1,u=[];for(i=0;n.length>0;i++){s=n.shift();if(!0===o){var c=u.pop();if(s.match(/"$/)){a=(c+"+"+s).replace(/^([^=]+)="(.*)"$/,"$1=$2");u.push(a),o=!1}else u.push(c+"+"+s)}else u.push(s);s.match(/^[^=]+="/)&&(o=!0)}return u},ht.asn1.x509.AttributeTypeAndValue=function(t){ht.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var e=ht,r=e.asn1,n=r.DERSequence,i=r.DERUTF8String,s=r.DERPrintableString,a=r.DERTeletexString,o=r.DERIA5String,u=r.DERVisibleString,c=r.DERBMPString,h=e.lang.String.isMail,l=e.lang.String.isPrintable;this.setByParam=function(t){if(void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.ds&&(this.dsType=t.ds),void 0===t.value&&void 0!==t.str){var e=t.str.match(/^([^=]+)=(.+)$/);if(!e)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=e[1],this.sValue=e[2]}else this.sType=t.type,this.sValue=t.value},this.setByString=function(t,e){void 0!==e&&(this.sRule=e);var r=t.match(/^([^=]+)=(.+)$/);if(!r)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(r[1],r[2])},this._getDsType=function(){var t=this.sType,e=this.sValue,r=this.sRule;return"prn"===r?"CN"==t&&h(e)?"ia5":l(e)?"prn":"utf8":"utf8"===r?"CN"==t&&h(e)?"ia5":"C"==t?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(t,e,r){void 0!==r&&(this.sRule=r),this.sType=t,this.sValue=e},this.getValueObj=function(t,e){if("utf8"==t)return new i({str:e});if("prn"==t)return new s({str:e});if("tel"==t)return new a({str:e});if("ia5"==t)return new o({str:e});if("vis"==t)return new u({str:e});if("bmp"==t)return new c({str:e});throw new Error("unsupported directory string type: type="+t+" value="+e)},this.tohex=function(){null==this.dsType&&(this.dsType=this._getDsType());var t=ht.asn1.x509.OID.atype2obj(this.sType),e=this.getValueObj(this.dsType,this.sValue),r=new n({array:[t,e]});return this.TLV=r.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.x509.AttributeTypeAndValue,ht.asn1.ASN1Object),ht.asn1.x509.SubjectPublicKeyInfo=function(t){ht.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var e=ht,r=e.asn1,n=r.DERInteger,i=r.DERBitString,s=r.DERObjectIdentifier,a=r.DERSequence,o=r.ASN1Util.newObject,u=r.x509.AlgorithmIdentifier,c=e.crypto;c.ECDSA,c.DSA,this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new a({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.tohex=function(){var t=this.getASN1Object();return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(t){try{if(t instanceof st){var e=o({seq:[{int:{bigint:t.n}},{int:{int:t.e}}]}).tohex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+e})}}catch(t){}try{if(t instanceof ht.crypto.ECDSA){var r=new s({name:t.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:r}),this.asn1SubjPKey=new i({hex:"00"+t.pubKeyHex})}}catch(t){}try{if(t instanceof ht.crypto.DSA){r=new o({seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:r});var a=new n({bigint:t.y});this.asn1SubjPKey=new i({hex:"00"+a.tohex()})}}catch(t){}},void 0!==t&&this.setPubKey(t)},$t(ht.asn1.x509.SubjectPublicKeyInfo,ht.asn1.ASN1Object),ht.asn1.x509.Time=function(t){ht.asn1.x509.Time.superclass.constructor.call(this);var e=ht.asn1,r=e.DERUTCTime,n=e.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(t){this.timeParams=t},this.setByParam=function(t){this.params=t},this.getType=function(t){return t.match(/^[0-9]{12}Z$/)?"utc":t.match(/^[0-9]{14}Z$/)?"gen":t.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":t.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var t=this.params,e=null;if("string"==typeof t&&(t={str:t}),null==t||!t.str||null!=t.type&&null!=t.type||(t.type=this.getType(t.str)),null!=t&&t.str?("utc"==t.type&&(e=new r(t.str)),"gen"==t.type&&(e=new n(t.str))):e="gen"==this.type?new n:new r,null==e)throw new Error("wrong setting for Time");return this.TLV=e.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},ht.asn1.x509.Time_bak=function(t){ht.asn1.x509.Time_bak.superclass.constructor.call(this);var e=ht.asn1,r=e.DERUTCTime,n=e.DERGeneralizedTime;this.setTimeParams=function(t){this.timeParams=t},this.tohex=function(){var t=null;return t=null!=this.timeParams?"utc"==this.type?new r(this.timeParams):new n(this.timeParams):"utc"==this.type?new r:new n,this.TLV=t.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",void 0!==t&&(void 0!==t.type?this.type=t.type:void 0!==t.str&&(t.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),t.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=t)},$t(ht.asn1.x509.Time,ht.asn1.ASN1Object),ht.asn1.x509.AlgorithmIdentifier=function(t){ht.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var e=ht.asn1,r=e.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var t=null;for(var n in r)n===this.nameAlg&&(t=r[n]);if(null!==t)return this.hTLV=t,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=e.x509.OID.name2obj(this.nameAlg));var i=[this.asn1Alg];null!==this.asn1Params&&i.push(this.asn1Params);var s=new e.DERSequence({array:i});return this.hTLV=s.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.name&&(this.nameAlg=t.name),void 0!==t.asn1params&&(this.asn1Params=t.asn1params),void 0!==t.paramempty&&(this.paramEmpty=t.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var n=this.nameAlg.toLowerCase();"withdsa"!==n.substr(-7,7)&&"withecdsa"!==n.substr(-9,9)&&(this.asn1Params=new e.DERNull)}},$t(ht.asn1.x509.AlgorithmIdentifier,ht.asn1.ASN1Object),ht.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},ht.asn1.x509.GeneralName=function(t){ht.asn1.x509.GeneralName.superclass.constructor.call(this);var e=ht.asn1,r=e.x509,n=r.X500Name,i=r.OtherName,s=e.DERIA5String;e.DERPrintableString;var a=e.DEROctetString,o=e.DERTaggedObject,u=e.ASN1Object,c=Error;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t,e,r=this.params,h=!1;if(void 0!==r.other)t="a0",e=new i(r.other);else if(void 0!==r.rfc822)t="81",e=new s({str:r.rfc822});else if(void 0!==r.dns)t="82",e=new s({str:r.dns});else if(void 0!==r.dn)t="a4",h=!0,e="string"==typeof r.dn?new n({str:r.dn}):r.dn instanceof ht.asn1.x509.X500Name?r.dn:new n(r.dn);else if(void 0!==r.ldapdn)t="a4",h=!0,e=new n({ldapstr:r.ldapdn});else if(void 0!==r.certissuer||void 0!==r.certsubj){var l,f;t="a4",h=!0;var p=null;if(void 0!==r.certsubj?(l=!1,f=r.certsubj):(l=!0,f=r.certissuer),f.match(/^[0-9A-Fa-f]+$/),-1!=f.indexOf("-----BEGIN ")&&(p=Ct(f)),null==p)throw new Error("certsubj/certissuer not cert");var g,d=new Qt;d.hex=p,g=l?d.getIssuerHex():d.getSubjectHex(),(e=new u).hTLV=g}else if(void 0!==r.uri)t="86",e=new s({str:r.uri});else{if(void 0===r.ip)throw new c("improper params");var v;t="87";var m=r.ip;try{if(m.match(/^[0-9a-f]+$/)){var y=m.length;if(8!=y&&16!=y&&32!=y&&64!=y)throw"err";v=m}else v=Bt(m)}catch(t){throw new c("malformed IP address: "+r.ip+":"+t.message)}e=new a({hex:v})}return new o({tag:t,explicit:h,obj:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.x509.GeneralName,ht.asn1.ASN1Object),ht.asn1.x509.GeneralNames=function(t){ht.asn1.x509.GeneralNames.superclass.constructor.call(this);var e=ht.asn1;this.setByParamArray=function(t){for(var r=0;r<t.length;r++){var n=new e.x509.GeneralName(t[r]);this.asn1Array.push(n)}},this.tohex=function(){return new e.DERSequence({array:this.asn1Array}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,void 0!==t&&this.setByParamArray(t)},$t(ht.asn1.x509.GeneralNames,ht.asn1.ASN1Object),ht.asn1.x509.OtherName=function(t){ht.asn1.x509.OtherName.superclass.constructor.call(this);var e=ht.asn1,r=e.DERObjectIdentifier,n=e.DERSequence,i=e.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if(null==t.oid||null==t.value)throw new Error("oid or value not specified");var e=new r({oid:t.oid}),s=i({tag:{tag:"a0",explicit:!0,obj:t.value}});return new n({array:[e,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.x509.OtherName,ht.asn1.ASN1Object),ht.asn1.x509.OID=new function(){var t=ht.asn1.DERObjectIdentifier;this.name2oidList={"aes128-CBC":"2.16.840.1.101.3.4.1.2","aes256-CBC":"2.16.840.1.101.3.4.1.42",sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",hmacWithSHA1:"1.2.840.113549.2.7",hmacWithSHA224:"1.2.840.113549.2.8",hmacWithSHA256:"1.2.840.113549.2.9",hmacWithSHA384:"1.2.840.113549.2.10",hmacWithSHA512:"1.2.840.113549.2.11",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",policyMappings:"2.5.29.33",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",inhibitAnyPolicy:"2.5.29.54",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",smtpUTF8Mailbox:"1.3.6.1.5.5.7.8.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1",smimeMailboxLegacy:"2.23.140.1.5.1.1",smimeMailboxMulti:"2.23.140.1.5.1.2",smimeMailboxStrict:"2.23.140.1.5.1.3",smimeOrganizationLegacy:"2.23.140.1.5.2.1",smimeOrganizationMulti:"2.23.140.1.5.2.2",smimeOrganizationStrict:"2.23.140.1.5.2.3",smimeSponsorLegacy:"2.23.140.1.5.3.1",smimeSponsorMulti:"2.23.140.1.5.3.2",smimeSponsorStrict:"2.23.140.1.5.3.3",smimeIndividualLegacy:"2.23.140.1.5.4.1",smimeIndividualMulti:"2.23.140.1.5.4.2",smimeIndividualStrict:"2.23.140.1.5.4.3"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",GN:"2.5.4.42",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var r=this.name2oidList[e],n=new t({oid:r});return this.objCache[e]=n,n},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var r;if(e.match(/^\d+\.\d+\.[0-9.]+$/))r=e;else if(void 0!==this.atype2oidList[e])r=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw new Error("AttributeType name undefined: "+e);r=this.name2oidList[e]}var n=new t({oid:r});return this.objCache[e]=n,n},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var e in t)this.name2oidList[e]=t[e]},this.checkOIDs=function(t){try{var e=Object.keys(t);return 0!=e.length&&(e.map(function(t,e,r){if(!this[t].match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")},t),!0)}catch(t){return!1}}},ht.asn1.x509.OID.oid2name=function(t){var e=ht.asn1.x509.OID.name2oidList;for(var r in e)if(e[r]==t)return r;return""},ht.asn1.x509.OID.oid2atype=function(t){var e=ht.asn1.x509.OID.atype2oidList;for(var r in e)if(e[r]==t)return r;return t},ht.asn1.x509.OID.name2oid=function(t){if(t.match(/^[0-9.]+$/))return t;var e=ht.asn1.x509.OID.name2oidList;return void 0===e[t]?"":e[t]},ht.asn1.x509.X509Util={},ht.asn1.x509.X509Util.newCertPEM=function(t){var e=ht.asn1.x509;return e.TBSCertificate,new(0,e.Certificate)(t).getPEM()},void 0!==ht&&ht||(ht={}),void 0!==ht.asn1&&ht.asn1||(ht.asn1={}),void 0!==ht.asn1.cms&&ht.asn1.cms||(ht.asn1.cms={}),ht.asn1.cms.Attribute=function(t){var e=Error,r=ht.asn1,n=r.DERSequence,i=r.DERSet,s=r.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(t){this.params=t},this.getValueArray=function(){throw new e("not yet implemented abstract")},this.tohex=function(){var t=new s({oid:this.typeOid}),e=new i({array:this.getValueArray()});return new n({array:[t,e]}).tohex()},this.getEncodedHex=function(){return this.tohex()}},$t(ht.asn1.cms.Attribute,ht.asn1.ASN1Object),ht.asn1.cms.ContentType=function(t){var e=ht.asn1;e.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new e.DERObjectIdentifier(this.params.type)]},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.ContentType,ht.asn1.cms.Attribute),ht.asn1.cms.MessageDigest=function(t){var e=ht.asn1,r=e.DEROctetString;e.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new r(this.params)]},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.MessageDigest,ht.asn1.cms.Attribute),ht.asn1.cms.SigningTime=function(t){var e=ht.asn1;e.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new e.x509.Time(this.params)]},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.SigningTime,ht.asn1.cms.Attribute),ht.asn1.cms.SigningCertificate=function(t){var e=Error,r=ht,n=r.asn1,i=n.DERSequence,s=n.cms,a=s.ESSCertID;r.crypto,s.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new e("parameter 'array' not specified");for(var r=this.params.array,n=[],s=0;s<r.length;s++){var o=r[s];0!=t.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!pt.isASN1HEX(o)||(o={cert:o}),0!=o.hasis&&0==t.hasis&&(o.hasis=!1),n.push(new a(o))}var u=new i({array:n});return[new i({array:[u]})]},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.SigningCertificate,ht.asn1.cms.Attribute),ht.asn1.cms.ESSCertID=function(t){ht.asn1.cms.ESSCertID.superclass.constructor.call(this);var e=Error,r=ht,n=r.asn1,i=n.DEROctetString,s=n.DERSequence,a=n.cms.IssuerSerial;this.params=null,this.getCertHash=function(t,n){if(null!=t.hash)return t.hash;if("string"==typeof t&&-1==t.indexOf("-----BEGIN")&&!pt.isASN1HEX(t))return t;var i,s,a;if("string"==typeof t)i=t;else{if(null==t.cert)throw new e("hash nor cert unspecified");i=t.cert}if(s=-1!=i.indexOf("-----BEGIN")?Ct(i):i,"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?s=Ct(t):pt.isASN1HEX(t)&&(s=t)),null!=t.alg)a=t.alg;else{if(null==n)throw new e("hash alg unspecified");a=n}return r.crypto.Util.hashHex(s,a)},this.tohex=function(){var t=this.params,e=this.getCertHash(t,"sha1"),r=[];return r.push(new i({hex:e})),("string"==typeof t&&-1!=t.indexOf("-----BEGIN")||null!=t.cert&&0!=t.hasis||null!=t.issuer&&null!=t.serial)&&r.push(new a(t)),new s({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.ESSCertID,ht.asn1.ASN1Object),ht.asn1.cms.SigningCertificateV2=function(t){var e=Error,r=ht,n=r.asn1,i=n.DERSequence;n.x509;var s=n.cms,a=s.ESSCertIDv2;r.crypto,s.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new e("parameter 'array' not specified");for(var r=this.params.array,n=[],s=0;s<r.length;s++){var o=r[s];null==t.alg&&0!=t.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!pt.isASN1HEX(o)||(o={cert:o}),null==o.alg&&null!=t.alg&&(o.alg=t.alg),0!=o.hasis&&0==t.hasis&&(o.hasis=!1),n.push(new a(o))}var u=new i({array:n});return[new i({array:[u]})]},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.SigningCertificateV2,ht.asn1.cms.Attribute),ht.asn1.cms.ESSCertIDv2=function(t){ht.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);var e=ht.asn1,r=e.DEROctetString,n=e.DERSequence,i=e.cms.IssuerSerial,s=e.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var t=this.params,e=this.getCertHash(t,"sha256"),a=[];return null!=t.alg&&"sha256"!=t.alg&&a.push(new s({name:t.alg})),a.push(new r({hex:e})),("string"==typeof t&&-1!=t.indexOf("-----BEGIN")||null!=t.cert&&0!=t.hasis||null!=t.issuer&&null!=t.serial)&&a.push(new i(t)),new n({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.ESSCertIDv2,ht.asn1.cms.ESSCertID),ht.asn1.cms.IssuerSerial=function(t){var e=Error,r=ht.asn1,n=r.DERInteger,i=r.DERSequence,s=r.cms,a=r.x509.GeneralNames,o=Qt;s.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(t){this.params=t},this.tohex=function(){var t,r,s=this.params;if("string"==typeof s&&-1!=s.indexOf("-----BEGIN")||null!=s.cert){var u;u=null!=s.cert?s.cert:s;var c=new o;c.readCertPEM(u),t=c.getIssuer(),r={hex:c.getSerialNumberHex()}}else{if(null==s.issuer||!s.serial)throw new e("cert or issuer and serial parameter not specified");t=s.issuer,r=s.serial}var h=new a([{dn:t}]),l=new n(r);return new i({array:[h,l]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.IssuerSerial,ht.asn1.ASN1Object),ht.asn1.cms.SignerIdentifier=function(t){var e=ht.asn1;e.DERInteger,e.DERSequence;var r=e.cms,n=r.IssuerAndSerialNumber,i=r.SubjectKeyIdentifier;e.x509.X500Name,r.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if("isssn"==t.type)return new n(t).tohex();if("skid"==t.type)return new i(t).tohex();throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.SignerIdentifier,ht.asn1.ASN1Object),ht.asn1.cms.IssuerAndSerialNumber=function(t){var e=ht.asn1,r=e.DERInteger,n=e.DERSequence,i=e.cms,s=e.x509.X500Name,a=Qt,o=Error;i.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t,e,i=this.params;if("string"==typeof i&&-1!=i.indexOf("-----BEGIN")||null!=i.cert){var u;u=null!=i.cert?i.cert:i;var c=new a;c.readCertPEM(u),t=c.getIssuer(),e={hex:c.getSerialNumberHex()}}else{if(null==i.issuer||!i.serial)throw new o("cert or issuer and serial parameter not specified");t=i.issuer,e=i.serial}var h=new s(t),l=new r(e);return new n({array:[h,l]}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.IssuerAndSerialNumber,ht.asn1.ASN1Object),ht.asn1.cms.SubjectKeyIdentifier=function(t){var e=ht.asn1;e.DERInteger,e.DERSequence;var r=e.ASN1Util.newObject,n=e.cms;n.IssuerAndSerialName,n.SubjectKeyIdentifier,e.x509.X500Name;var i=Qt,s=Error;n.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var t,e=this.params;if(null==e.cert&&null==e.skid)throw new s("property cert nor skid undefined");null!=e.cert?t=new i(e.cert).getExtSubjectKeyIdentifier().kid.hex:null!=e.skid&&(t=e.skid);return r({tag:{tage:"a0",obj:{octstr:{hex:t}}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.SubjectKeyIdentifier,ht.asn1.ASN1Object),ht.asn1.cms.AttributeList=function(t){var e=Error,r=ht.asn1,n=r.DERSet,i=r.cms;i.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if(null!=this.hTLV)return this.hTLV;var r=!0;null!=t.sortflag&&(r=t.sortflag);for(var s=t.array,a=[],o=0;o<s.length;o++){var u=s[o],c=u.attr;if("contentType"==c)a.push(new i.ContentType(u));else if("messageDigest"==c)a.push(new i.MessageDigest(u));else if("signingTime"==c)a.push(new i.SigningTime(u));else if("signingCertificate"==c)a.push(new i.SigningCertificate(u));else if("signingCertificateV2"==c)a.push(new i.SigningCertificateV2(u));else if("signaturePolicyIdentifier"==c)a.push(new ht.asn1.cades.SignaturePolicyIdentifier(u));else{if("signatureTimeStamp"!=c&&"timeStampToken"!=c)throw new e("unknown attr: "+c);a.push(new ht.asn1.cades.SignatureTimeStamp(u))}}var h=new n({array:a,sortflag:r});return this.hTLV=h.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.AttributeList,ht.asn1.ASN1Object),ht.asn1.cms.SignerInfo=function(t){var e=Error,r=ht,n=r.asn1,i=n.DERInteger,s=n.DEROctetString,a=n.DERSequence,o=n.DERTaggedObject,u=n.cms,c=u.SignerIdentifier,h=u.AttributeList;u.ContentType,u.EncapsulatedContentInfo,u.MessageDigest,u.SignedData;var l=n.x509.AlgorithmIdentifier,f=r.crypto,p=Jt;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var t=this.params,e=t.sigalg,r=new h(t.sattrs).tohex(),n=p.getKey(t.signkey),i=new f.Signature({alg:e});i.init(n),i.updateHex(r);var s=i.sign();t.sighex=s},this.tohex=function(){var t=this.params,r=[];if(r.push(new i({int:t.version})),r.push(new c(t.id)),r.push(new l({name:t.hashalg})),null!=t.sattrs){var n=new h(t.sattrs);try{r.push(new o({tag:"a0",explicit:!1,obj:n}))}catch(t){throw new e("si sattr error: "+t)}}if(null!=t.sigalgfield?r.push(new l({name:t.sigalgfield})):r.push(new l({name:t.sigalg})),null==t.sighex&&null!=t.signkey&&this.sign(),r.push(new s({hex:t.sighex})),null!=t.uattrs){n=new h(t.uattrs);try{r.push(new o({tag:"a1",explicit:!1,obj:n}))}catch(t){throw new e("si uattr error: "+t)}}return new a({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.SignerInfo,ht.asn1.ASN1Object),ht.asn1.cms.EncapsulatedContentInfo=function(t){var e=ht.asn1,r=e.DERTaggedObject,n=e.DERSequence,i=e.DERObjectIdentifier,s=e.DEROctetString;e.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];if(e.push(new i(t.type)),null!=t.content&&(null!=t.content.hex||null!=t.content.str)&&1!=t.isDetached){var a=new s(t.content),o=new r({tag:"a0",explicit:!0,obj:a});e.push(o)}return new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.EncapsulatedContentInfo,ht.asn1.ASN1Object),ht.asn1.cms.ContentInfo=function(t){var e=ht.asn1,r=e.DERTaggedObject,n=e.DERSequence,i=e.DERObjectIdentifier;e.x509.OID.name2obj,ht.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];e.push(new i(t.type));var s=new r({tag:"a0",explicit:!0,obj:t.obj});return e.push(s),new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.ContentInfo,ht.asn1.ASN1Object),ht.asn1.cms.SignedData=function(t){var e=ht.asn1;e.ASN1Object;var r=e.DERInteger,n=e.DERSet,i=e.DERSequence;e.DERTaggedObject;var s=e.cms,a=s.EncapsulatedContentInfo,o=s.SignerInfo,u=s.ContentInfo,c=s.CertificateSet,h=s.RevocationInfoChoices,l=e.x509.AlgorithmIdentifier;ht.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var t=this.params;this._setDigestAlgs(t),this._setContentTypeByEContent(t),this._setMessageDigestByEContent(t),this._setSignerInfoVersion(t),this._setSignedDataVersion(t)},this._setDigestAlgs=function(t){for(var e={},r=t.sinfos,n=0;n<r.length;n++){e[r[n].hashalg]=1}t.hashalgs=Object.keys(e).sort()},this._setContentTypeByEContent=function(t){for(var e=t.econtent.type,r=t.sinfos,n=0;n<r.length;n++){var i=r[n];this._getAttrParamByName(i,"contentType").type=e}},this._setMessageDigestByEContent=function(t){var e=t.econtent;t.econtent.type;var r=e.content.hex;null==r&&"data"==e.type&&null!=e.content.str&&(r=Ft(e.content.str));for(var n=t.sinfos,i=0;i<n.length;i++){var s=n[i],a=s.hashalg,o=this._getAttrParamByName(s,"messageDigest"),u=ht.crypto.Util.hashHex(r,a);o.hex=u}},this._getAttrParamByName=function(t,e){for(var r=t.sattrs.array,n=0;n<r.length;n++)if(r[n].attr==e)return r[n]},this._setSignerInfoVersion=function(t){for(var e=t.sinfos,r=0;r<e.length;r++){var n=e[r],i=1;"skid"==n.id.type&&(i=3),n.version=i}},this._setSignedDataVersion=function(t){var e=this._getSignedDataVersion(t);t.version=e},this._getSignedDataVersion=function(t){if(null!=t.revinfos)for(var e=t.revinfos,r=0;r<e.length;r++){if(null!=e[r].ocsp)return 5}var n=t.sinfos;for(r=0;r<n.length;r++){if(3==t.sinfos[r].version)return 3}return"data"!=t.econtent.type?3:1},this.tohex=function(){var t=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=t.fixed&&this.checkAndFixParam();var e=[];e.push(new r({int:t.version}));for(var s=[],u=0;u<t.hashalgs.length;u++){var f=t.hashalgs[u];s.push(new l({name:f}))}e.push(new n({array:s})),e.push(new a(t.econtent)),null!=t.certs&&e.push(new c(t.certs)),null!=t.revinfos&&e.push(new h(t.revinfos));var p=[];for(u=0;u<t.sinfos.length;u++){var g=t.sinfos[u];p.push(new o(g))}return e.push(new n({array:p})),new i({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){return new u({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.SignedData,ht.asn1.ASN1Object),ht.asn1.cms.CertificateSet=function(t){ht.asn1.cms.CertificateSet.superclass.constructor.call(this);var e=Error,r=ht.asn1,n=r.DERTaggedObject,i=r.DERSet,s=r.ASN1Object;this.params=null,this.tohex=function(){var t,r=this.params,a=[];if(r instanceof Array)t=r;else{if(null==r.array)throw new e("cert array not specified");t=r.array}for(var o=0;o<t.length;o++){var u=Ct(t[o]),c=new s;c.hTLV=u,a.push(c)}var h={array:a};0==r.sortflag&&(h.sortflag=!1);var l=new i(h);return new n({tag:"a0",explicit:!1,obj:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.CertificateSet,ht.asn1.ASN1Object),ht.asn1.cms.RevocationInfoChoices=function(t){ht.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new Error("params is not array");for(var e=[],r=0;r<t.length;r++)e.push(new ht.asn1.cms.RevocationInfoChoice(t[r]));return ht.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:e}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.RevocationInfoChoices,ht.asn1.ASN1Object),ht.asn1.cms.RevocationInfoChoice=function(t){ht.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(null!=t.crl&&"string"==typeof t.crl){var e=t.crl;return-1!=t.crl.indexOf("-----BEGIN")&&(e=Ct(t.crl)),e}if(null!=t.ocsp)return ht.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new ht.asn1.cms.OtherRevocationFormat(t)}}).tohex();throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.RevocationInfoChoice,ht.asn1.ASN1Object),ht.asn1.cms.OtherRevocationFormat=function(t){ht.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var e=Error,r=ht,n=r.asn1.ASN1Util.newObject,i=r.lang.String.isHex;this.params=null,this.tohex=function(){var t=this.params;if(null==t.ocsp)throw new e("property ocsp not specified");if(!i(t.ocsp)||!pt.isASN1HEX(t.ocsp))throw new e("ocsp value not ASN.1 hex string");return n({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:t.ocsp}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cms.OtherRevocationFormat,ht.asn1.ASN1Object),ht.asn1.cms.CMSUtil=new function(){},ht.asn1.cms.CMSUtil.newSignedData=function(t){return new ht.asn1.cms.SignedData(t)},ht.asn1.cms.CMSUtil.verifySignedData=function(t){var e=ht,r=e.asn1,n=r.cms;n.SignerInfo,n.SignedData,n.SigningTime,n.SigningCertificate,n.SigningCertificateV2,r.cades.SignaturePolicyIdentifier;var i=e.lang.String.isHex,s=pt,a=s.getVbyList,o=s.getTLVbyList,u=s.getIdxbyList,c=s.getChildIdx,h=s.getTLV,l=s.oidname,f=e.crypto.Util.hashHex;void 0===t.cms&&i(t.cms);var p=t.cms,g=function(t,e){var r=e.idx;e.signerid_issuer1=o(t,r,[1,0],"30"),e.signerid_serial1=a(t,r,[1,1],"02"),e.hashalg=l(a(t,r,[2,0],"06"));var n=u(t,r,[3],"a0");e.idxSignedAttrs=n,d(t,e,n);var i=c(t,r).length;if(i<6)throw"malformed SignerInfo";e.sigalg=l(a(t,r,[i-2,0],"06")),e.sigval=a(t,r,[i-1],"04")},d=function(t,e,r){var n=c(t,r);e.signedAttrIdxList=n;for(var i=0;i<n.length;i++){var s,o=n[i],u=a(t,o,[0],"06");"2a864886f70d010905"===u?(s=St(a(t,o,[1,0])),e.saSigningTime=s):"2a864886f70d010904"===u&&(s=a(t,o,[1,0],"04"),e.saMessageDigest=s)}},v=function(t,e,r,n){r.verifyDetail={};var i=r.verifyDetail,s=e.parse.econtent,a=r.hashalg,o=r.saMessageDigest;i.validMessageDigest=!1,f(s,a)===o&&(i.validMessageDigest=!0),function(t,e,r){var n,i=e.parse.certsIdx;if(void 0===e.certs){n=[],e.certkeys=[];for(var s=c(t,i),a=0;a<s.length;a++){var o=h(t,s[a]),u=new Qt;u.readCertHex(o),n[a]=u,e.certkeys[a]=u.getPublicKey()}e.certs=n}else n=e.certs;for(e.cccc=n.length,e.cccci=s.length,a=0;a<n.length;a++){var l=u.getIssuerHex(),f=u.getSerialNumberHex();r.signerid_issuer1===l&&r.signerid_serial1===f&&(r.certkey_idx=a)}}(t,e,r),i.validSignatureValue=!1;var u=r.sigalg,l="31"+h(t,r.idxSignedAttrs).substr(2);r.signedattrshex=l;var p=e.certs[r.certkey_idx].getPublicKey(),g=new ht.crypto.Signature({alg:u});g.init(p),g.updateHex(l);var d=g.verify(r.sigval);i.validSignatureValue_isValid=d,!0===d&&(i.validSignatureValue=!0),r.isValid=!1,i.validMessageDigest&&i.validSignatureValue&&(r.isValid=!0)},m={isValid:!1,parse:{}};return function(t,e){if("2a864886f70d010702"!==a(t,0,[0],"06"))return e;e.cmsType="signedData",e.econtent=a(t,0,[1,0,2,1,0]),function(t,e){for(var r,n=3;n<6;n++)if(void 0!==(r=u(t,0,[1,0,n]))){var i=t.substr(r,2);"a0"===i&&(e.certsIdx=r),"a1"===i&&(e.revinfosIdx=r),"31"===i&&(e.signerinfosIdx=r)}}(t,e),e.signerInfos=[],function(t,e){var r=e.signerinfosIdx;if(void 0!==r){var n=c(t,r);e.signerInfoIdxList=n;for(var i=0;i<n.length;i++){var s={idx:n[i]};g(t,s),e.signerInfos.push(s)}}}(t,e)}(p,m.parse),function(t,e){for(var r=e.parse.signerInfos,n=r.length,i=!0,s=0;s<n;s++){var a=r[s];v(t,e,a),a.isValid||(i=!1)}e.isValid=i}(p,m),m},ht.asn1.cms.CMSParser=function(){var t=Error,e=Qt,r=new e,n=pt,i=n.getV,s=n.getTLV;n.getIdxbyList;var a=n.getTLVbyList,o=n.getTLVbyListEx,u=n.getVbyList,c=n.getVbyListEx,h=n.getChildIdx;this.getCMSSignedData=function(t){var e=a(t,0,[1,0]);return this.getSignedData(e)},this.getSignedData=function(t){var e=h(t,0),r={},n=i(t,e[0]),a=parseInt(n,16);r.version=a;var u=s(t,e[1]);r.hashalgs=this.getHashAlgArray(u);var c=s(t,e[2]);r.econtent=this.getEContent(c);var l=o(t,0,["[0]"]);null!=l&&(r.certs=this.getCertificateSet(l)),o(t,0,["[1]"]);var f=o(t,0,[3]);return r.sinfos=this.getSignerInfos(f),r},this.getHashAlgArray=function(t){for(var r=h(t,0),n=new e,i=[],a=0;a<r.length;a++){var o=s(t,r[a]),u=n.getAlgorithmIdentifierName(o);i.push(u)}return i},this.getEContent=function(t){var e={},r=u(t,0,[0]),n=u(t,0,[1,0]);return e.type=ht.asn1.x509.OID.oid2name(pt.hextooidstr(r)),e.content={hex:n},e},this.getSignerInfos=function(t){for(var e=[],r=h(t,0),n=0;n<r.length;n++){var i=s(t,r[n]),a=this.getSignerInfo(i);e.push(a)}return e},this.getSignerInfo=function(t){var e={},i=h(t,0),a=n.getInt(t,i[0],-1);-1!=a&&(e.version=a);var u=s(t,i[1]),l=this.getIssuerAndSerialNumber(u);e.id=l;var f=s(t,i[2]),p=r.getAlgorithmIdentifierName(f);e.hashalg=p;var g=o(t,0,["[0]"]);if(null!=g){var d=this.getAttributeList(g);e.sattrs=d}var v=o(t,0,[3]),m=r.getAlgorithmIdentifierName(v);e.sigalg=m;var y=c(t,0,[4]);e.sighex=y;var x=o(t,0,["[1]"]);if(null!=x){var w=this.getAttributeList(x);e.uattrs=w}return e},this.getSignerIdentifier=function(t){if("30"==t.substr(0,2))return this.getIssuerAndSerialNumber(t);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(t){var e={type:"isssn"},n=h(t,0),a=s(t,n[0]);e.issuer=r.getX500Name(a);var o=i(t,n[1]);return e.serial={hex:o},e},this.getAttributeList=function(t){for(var e=[],r=h(t,0),n=0;n<r.length;n++){var i=s(t,r[n]),a=this.getAttribute(i);e.push(a)}return{array:e}},this.getAttribute=function(t){var e={},r=h(t,0),i=n.getOID(t,r[0]),a=ht.asn1.x509.OID.oid2name(i);e.attr=a;var o=s(t,r[1]),u=h(o,0);if(1==u.length)e.valhex=s(o,u[0]);else{for(var c=[],l=0;l<u.length;l++)c.push(s(o,u[l]));e.valhex=c}return"contentType"==a?this.setContentType(e):"messageDigest"==a?this.setMessageDigest(e):"signingTime"==a?this.setSigningTime(e):"signingCertificate"==a?this.setSigningCertificate(e):"signingCertificateV2"==a?this.setSigningCertificateV2(e):"signaturePolicyIdentifier"==a&&this.setSignaturePolicyIdentifier(e),e},this.setContentType=function(t){var e=n.getOIDName(t.valhex,0,null);null!=e&&(t.type=e,delete t.valhex)},this.setSigningTime=function(t){var e=St(i(t.valhex,0));t.str=e,delete t.valhex},this.setMessageDigest=function(t){var e=i(t.valhex,0);t.hex=e,delete t.valhex},this.setSigningCertificate=function(t){var e=h(t.valhex,0);if(e.length>0){for(var r=s(t.valhex,e[0]),n=h(r,0),i=[],a=0;a<n.length;a++){var o=s(r,n[a]),u=this.getESSCertID(o);i.push(u)}t.array=i}if(e.length>1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.setSignaturePolicyIdentifier=function(t){var r=h(t.valhex,0);if(r.length>0){var a=n.getOID(t.valhex,r[0]);t.oid=a}if(r.length>1){var o=new e,u=h(t.valhex,r[1]),c=s(t.valhex,u[0]),l=o.getAlgorithmIdentifierName(c);t.alg=l;var f=i(t.valhex,u[1]);t.hash=f}delete t.valhex},this.setSigningCertificateV2=function(t){var e=h(t.valhex,0);if(e.length>0){for(var r=s(t.valhex,e[0]),n=h(r,0),i=[],a=0;a<n.length;a++){var o=s(r,n[a]),u=this.getESSCertIDv2(o);i.push(u)}t.array=i}if(e.length>1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.getESSCertID=function(t){var e={},r=h(t,0);if(r.length>0){var n=i(t,r[0]);e.hash=n}if(r.length>1){var a=s(t,r[1]),o=this.getIssuerSerial(a);null!=o.serial&&(e.serial=o.serial),null!=o.issuer&&(e.issuer=o.issuer)}return e},this.getESSCertIDv2=function(e){var n={},a=h(e,0);if(a.length<1||3<a.length)throw new t("wrong number of elements");var o=0;if("30"==e.substr(a[0],2)){var u=s(e,a[0]);n.alg=r.getAlgorithmIdentifierName(u),o++}else n.alg="sha256";var c=i(e,a[o]);if(n.hash=c,a.length>o+1){var l=s(e,a[o+1]),f=this.getIssuerSerial(l);n.issuer=f.issuer,n.serial=f.serial}return n},this.getIssuerSerial=function(t){var e={},n=h(t,0),a=s(t,n[0]),o=r.getGeneralNames(a)[0].dn;e.issuer=o;var u=i(t,n[1]);return e.serial={hex:u},e},this.getCertificateSet=function(t){for(var e=h(t,0),r=[],n=0;n<e.length;n++){var i=s(t,e[n]);if("30"==i.substr(0,2)){var a=At(i,"CERTIFICATE");r.push(a)}}return{array:r,sortflag:!1}}},void 0!==ht&&ht||(ht={}),void 0!==ht.asn1&&ht.asn1||(ht.asn1={}),void 0!==ht.asn1.tsp&&ht.asn1.tsp||(ht.asn1.tsp={}),ht.asn1.tsp.TimeStampToken=function(t){var e=ht.asn1.tsp;e.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var t=new e.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=t.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.tsp.TimeStampToken,ht.asn1.cms.SignedData),ht.asn1.tsp.TSTInfo=function(t){var e=ht.asn1,r=e.DERSequence,n=e.DERInteger,i=e.DERBoolean,s=e.DERGeneralizedTime,a=e.DERObjectIdentifier,o=e.DERTaggedObject,u=e.tsp,c=u.MessageImprint,h=u.Accuracy;e.x509.X500Name;var l=e.x509.GeneralName;if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new n({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var t=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(t.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(t.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(t.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");t.push(this.dGenTime),null!=this.dAccuracy&&t.push(this.dAccuracy),null!=this.dOrdering&&t.push(this.dOrdering),null!=this.dNonce&&t.push(this.dNonce),null!=this.dTsa&&t.push(this.dTsa);var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t){if("string"==typeof t.policy){if(!t.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new a({oid:t.policy})}void 0!==t.messageImprint&&(this.dMessageImprint=new c(t.messageImprint)),void 0!==t.serial&&(this.dSerial=new n(t.serial)),void 0!==t.genTime&&(this.dGenTime=new s(t.genTime)),void 0!==t.accuracy&&(this.dAccuracy=new h(t.accuracy)),void 0!==t.ordering&&1==t.ordering&&(this.dOrdering=new i),void 0!==t.nonce&&(this.dNonce=new n(t.nonce)),void 0!==t.tsa&&(this.dTsa=new o({tag:"a0",explicit:!0,obj:new l({dn:t.tsa})}))}},$t(ht.asn1.tsp.TSTInfo,ht.asn1.ASN1Object),ht.asn1.tsp.Accuracy=function(t){var e=ht.asn1,r=e.ASN1Util.newObject;e.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return null!=t.seconds&&"number"==typeof t.seconds&&e.push({int:t.seconds}),null!=t.millis&&"number"==typeof t.millis&&e.push({tag:{tagi:"80",obj:{int:t.millis}}}),null!=t.micros&&"number"==typeof t.micros&&e.push({tag:{tagi:"81",obj:{int:t.micros}}}),r({seq:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.tsp.Accuracy,ht.asn1.ASN1Object),ht.asn1.tsp.MessageImprint=function(t){var e=ht.asn1,r=e.DERSequence,n=e.DEROctetString,i=e.x509.AlgorithmIdentifier;e.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=new i({name:t.alg}),s=new n({hex:t.hash});return new r({array:[e,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.tsp.MessageImprint,ht.asn1.ASN1Object),ht.asn1.tsp.TimeStampReq=function(t){var e=ht.asn1,r=e.DERSequence,n=e.DERInteger,i=e.DERBoolean;e.ASN1Object;var s=e.DERObjectIdentifier,a=e.tsp,o=a.MessageImprint;a.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return e.push(new n({int:1})),t.messageImprint instanceof ht.asn1.ASN1Object?e.push(t.messageImprint):e.push(new o(t.messageImprint)),null!=t.policy&&e.push(new s(t.policy)),null!=t.nonce&&e.push(new n(t.nonce)),1==t.certreq&&e.push(new i),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.tsp.TimeStampReq,ht.asn1.ASN1Object),ht.asn1.tsp.TimeStampResp=function(t){var e=ht.asn1,r=e.DERSequence;e.ASN1Object;var n=e.tsp,i=n.PKIStatusInfo;n.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,s=[];if(null!=t.econtent||null!=t.tst)if(null!=t.statusinfo?s.push(new i(t.statusinfo)):s.push(new i("granted")),null!=t.econtent)s.push(new n.TimeStampToken(t).getContentInfo());else{if(!(t.tst instanceof e.ASN1Object))throw new Error("improper member tst value");s.push(t.tst)}else{if(null==t.statusinfo)throw new Error("parameter for token nor statusinfo not specified");s.push(new i(t.statusinfo))}return new r({array:s}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.tsp.TimeStampResp,ht.asn1.ASN1Object),ht.asn1.tsp.PKIStatusInfo=function(t){var e=Error,r=ht.asn1,n=r.DERSequence,i=r.tsp,s=i.PKIStatus,a=i.PKIFreeText,o=i.PKIFailureInfo;i.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,r=[];if("string"==typeof t)r.push(new s(t));else{if(null==t.status)throw new e("property 'status' unspecified");r.push(new s(t.status)),null!=t.statusstr&&r.push(new a(t.statusstr)),null!=t.failinfo&&r.push(new o(t.failinfo))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.tsp.PKIStatusInfo,ht.asn1.ASN1Object),ht.asn1.tsp.PKIStatus=function(t){var e=Error,r=ht.asn1,n=r.DERInteger;r.tsp.PKIStatus.superclass.constructor.call(this);var i={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var t,r=this.params;if("string"==typeof r)try{t=i[r]}catch(t){throw new e("undefined name: "+r)}else{if("number"!=typeof r)throw new e("unsupported params");t=r}return new n({int:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.tsp.PKIStatus,ht.asn1.ASN1Object),ht.asn1.tsp.PKIFreeText=function(t){var e=Error,r=ht.asn1,n=r.DERSequence,i=r.DERUTF8String;r.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!(t instanceof Array))throw new e("wrong params: not array");for(var r=[],s=0;s<t.length;s++)r.push(new i({str:t[s]}));return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.tsp.PKIFreeText,ht.asn1.ASN1Object),ht.asn1.tsp.PKIFailureInfo=function(t){var e=Error,r=ht.asn1,n=r.DERBitString,i=r.tsp.PKIFailureInfo,s={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};i.superclass.constructor.call(this),this.params=null,this.getBinValue=function(){var t=this.params,r=0;if("number"==typeof t&&0<=t&&t<=25){for(var n=(r|=1<<t).toString(2),i="",a=n.length-1;a>=0;a--)i+=n[a];return i}if("string"==typeof t&&null!=s[t])return Wt([t],s);if("object"==typeof t&&null!=t.length)return Wt(t,s);throw new e("wrong params")},this.tohex=function(){this.params;var t=this.getBinValue();return new n({bin:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.tsp.PKIFailureInfo,ht.asn1.ASN1Object),ht.asn1.tsp.AbstractTSAAdapter=function(t){this.getTSTHex=function(t,e){throw"not implemented yet"}},ht.asn1.tsp.SimpleTSAAdapter=function(t){var e=ht,r=e.asn1.tsp,n=e.crypto.Util.hashHex;r.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(t,e){var i=n(t,e);this.params.econtent.content.messageImprint={alg:e,hash:i},this.params.econtent.content.serial={int:this.serial++};var s=Math.floor(1e9*Math.random());return this.params.econtent.content.nonce={int:s},new r.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==t&&(this.params=t)},$t(ht.asn1.tsp.SimpleTSAAdapter,ht.asn1.tsp.AbstractTSAAdapter),ht.asn1.tsp.FixedTSAAdapter=function(t){var e=ht,r=e.asn1.tsp,n=e.crypto.Util.hashHex;r.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(t,e){var i=n(t,e);return this.params.econtent.content.messageImprint={alg:e,hash:i},new r.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==t&&(this.params=t)},$t(ht.asn1.tsp.FixedTSAAdapter,ht.asn1.tsp.AbstractTSAAdapter),ht.asn1.tsp.TSPUtil=new function(){},ht.asn1.tsp.TSPUtil.newTimeStampToken=function(t){return new ht.asn1.tsp.TimeStampToken(t)},ht.asn1.tsp.TSPUtil.parseTimeStampReq=function(t){return(new ht.asn1.tsp.TSPParser).getTimeStampReq(t)},ht.asn1.tsp.TSPUtil.parseMessageImprint=function(t){return(new ht.asn1.tsp.TSPParser).getMessageImprint(t)},ht.asn1.tsp.TSPParser=function(){var t=new Qt,e=pt,r=e.getV,n=e.getTLV,i=e.getIdxbyList;e.getTLVbyListEx;var s=e.getChildIdx,a=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],o={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(t){var e=s(t,0);if(1==e.length)return this.getPKIStatusInfo(n(t,e[0]));if(e.length>1){var r=this.getPKIStatusInfo(n(t,e[0])),i=n(t,e[1]),a=this.getToken(i);return a.statusinfo=r,a}},this.getToken=function(t){var e=(new ht.asn1.cms.CMSParser).getCMSSignedData(t);return this.setTSTInfo(e),e},this.setTSTInfo=function(t){var e=t.econtent;if("tstinfo"==e.type){var r=e.content.hex,n=this.getTSTInfo(r);e.content=n}},this.getTSTInfo=function(e){var i={},a=s(e,0),o=r(e,a[1]);i.policy=qt(o);var u=n(e,a[2]);i.messageImprint=this.getMessageImprint(u);var c=r(e,a[3]);i.serial={hex:c};var h=r(e,a[4]);i.genTime={str:St(h)};var l=0;if(a.length>5&&"30"==e.substr(a[5],2)){var f=n(e,a[5]);i.accuracy=this.getAccuracy(f),l++}a.length>5+l&&"01"==e.substr(a[5+l],2)&&("ff"==r(e,a[5+l])&&(i.ordering=!0),l++);if(a.length>5+l&&"02"==e.substr(a[5+l],2)){var p=r(e,a[5+l]);i.nonce={hex:p},l++}if(a.length>5+l&&"a0"==e.substr(a[5+l],2)){var g=n(e,a[5+l]);g="30"+g.substr(2),pGeneralNames=t.getGeneralNames(g);var d=pGeneralNames[0].dn;i.tsa=d,l++}if(a.length>5+l&&"a1"==e.substr(a[5+l],2)){var v=n(e,a[5+l]);v="30"+v.substr(2);var m=t.getExtParamArray(v);i.ext=m,l++}return i},this.getAccuracy=function(t){for(var e={},n=s(t,0),i=0;i<n.length;i++){var a=t.substr(n[i],2),o=r(t,n[i]),u=parseInt(o,16);"02"==a?e.seconds=u:"80"==a?e.millis=u:"81"==a&&(e.micros=u)}return e},this.getMessageImprint=function(t){if("30"!=t.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var n={};s(t,0);var a=i(t,0,[0,0]),o=r(t,a),u=e.hextooidstr(o),c=ht.asn1.x509.OID.oid2name(u);if(""==c)throw new Error("hashAlg name undefined: "+u);var h=c,l=i(t,0,[1]);return n.alg=h,n.hash=r(t,l),n},this.getPKIStatusInfo=function(t){var e={},i=s(t,0),o=0;try{var u=r(t,i[0]),c=parseInt(u,16);e.status=a[c]}catch(t){}if(i.length>1&&"30"==t.substr(i[1],2)){var h=n(t,i[1]);e.statusstr=this.getPKIFreeText(h),o++}if(i.length>o&&"03"==t.substr(i[1+o],2)){var l=n(t,i[1+o]);e.failinfo=this.getPKIFailureInfo(l)}return e},this.getPKIFreeText=function(t){for(var r=[],n=s(t,0),i=0;i<n.length;i++)r.push(e.getString(t,n[i]));return r},this.getPKIFailureInfo=function(t){var r=e.getInt(t,0);return null!=o[r]?o[r]:r},this.getTimeStampReq=function(t){var i={certreq:!1},a=s(t,0);if(a.length<2)throw new Error("TimeStampReq must have at least 2 items");var o=n(t,a[1]);i.messageImprint=ht.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var u=2;u<a.length;u++){var c=a[u],h=t.substr(c,2);if("06"==h){var l=r(t,c);i.policy=e.hextooidstr(l)}"02"==h&&(i.nonce=r(t,c)),"01"==h&&(i.certreq=!0)}return i}},void 0!==ht&&ht||(ht={}),void 0!==ht.asn1&&ht.asn1||(ht.asn1={}),void 0!==ht.asn1.cades&&ht.asn1.cades||(ht.asn1.cades={}),ht.asn1.cades.SignaturePolicyIdentifier=function(t){var e=ht.asn1.cades,r=e.SignaturePolicyId;e.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new r(this.params)]},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},$t(ht.asn1.cades.SignaturePolicyIdentifier,ht.asn1.cms.Attribute),ht.asn1.cades.SignaturePolicyId=function(t){var e=ht.asn1,r=e.DERSequence,n=e.DERObjectIdentifier;e.x509.AlgorithmIdentifier;var i=e.cades,s=i.SignaturePolicyId,a=i.OtherHashAlgAndValue;s.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return e.push(new n(t.oid)),e.push(new a(t)),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},$t(ht.asn1.cades.SignaturePolicyId,ht.asn1.ASN1Object),ht.asn1.cades.OtherHashAlgAndValue=function(t){var e=Error,r=ht.asn1,n=r.DERSequence,i=r.DEROctetString,s=r.x509.AlgorithmIdentifier;r.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(null==t.alg)throw new e("property 'alg' not specified");if(null==t.hash&&null==t.cert)throw new e("property 'hash' nor 'cert' not specified");var r=null;if(null!=t.hash)r=t.hash;else if(null!=t.cert){if("string"!=typeof t.cert)throw new e("cert not string");var a=t.cert;-1!=t.cert.indexOf("-----BEGIN")&&(a=Ct(t.cert)),r=ht.crypto.Util.hashHex(a,t.alg)}var o=[];return o.push(new s({name:t.alg})),o.push(new i({hex:r})),new n({array:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cades.OtherHashAlgAndValue,ht.asn1.ASN1Object),ht.asn1.cades.OtherHashValue=function(t){ht.asn1.cades.OtherHashValue.superclass.constructor.call(this);var e=Error,r=ht;r.lang.String.isHex;var n=r.asn1.DEROctetString;r.crypto.Util.hashHex,this.params=null,this.tohex=function(){var t=this.params;if(null==t.hash&&null==t.cert)throw new e("hash or cert not specified");var r=null;if(null!=t.hash)r=t.hash;else if(null!=t.cert){if("string"!=typeof t.cert)throw new e("cert not string");var i=t.cert;-1!=t.cert.indexOf("-----BEGIN")&&(i=Ct(t.cert)),r=ht.crypto.Util.hashHex(i,"sha1")}return new n({hex:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cades.OtherHashValue,ht.asn1.ASN1Object),ht.asn1.cades.SignatureTimeStamp=function(t){var e=Error,r=ht,n=r.lang.String.isHex,i=r.asn1,s=i.ASN1Object;i.x509,i.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var t=this.params;if(null!=t.tst){if(n(t.tst))return(r=new s).hTLV=t.tst,[r];if(t.tst instanceof s)return[t.tst];throw new e("params.tst has wrong value")}if(null!=t.res){var r,i=t.res;if(i instanceof s&&(i=i.tohex()),"string"!=typeof i||!n(i))throw new e("params.res has wrong value");return pt.getTLVbyList(i,0,[1]),(r=new s).hTLV=t.tst,[r]}},null!=t&&this.setByParam(t)},$t(ht.asn1.cades.SignatureTimeStamp,ht.asn1.cms.Attribute),ht.asn1.cades.CompleteCertificateRefs=function(t){var e=Error,r=ht,n=r.asn1,i=n.DERSequence,s=n.cades,a=s.OtherCertID,o=r.lang.String.isHex;s.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var t=this.params,r=[],n=0;n<t.array.length;n++){var s=t.array[n];if("string"==typeof s)if(-1!=s.indexOf("-----BEGIN"))s={cert:s};else{if(!o(s))throw new e("unsupported value: "+s);s={hash:s}}null!=t.alg&&null==s.alg&&(s.alg=t.alg),null!=t.hasis&&null==s.hasis&&(s.hasis=t.hasis);var u=new a(s);r.push(u)}return[new i({array:r})]},null!=t&&this.setByParam(t)},$t(ht.asn1.cades.CompleteCertificateRefs,ht.asn1.cms.Attribute),ht.asn1.cades.OtherCertID=function(t){var e=ht.asn1,r=e.DERSequence,n=e.cms.IssuerSerial,i=e.cades,s=i.OtherHashValue,a=i.OtherHashAlgAndValue;i.OtherCertID.superclass.constructor.call(this),this.params=t,this.tohex=function(){var t=this.params;"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?t={cert:t}:_isHex(t)&&(t={hash:t}));var e=[],i=null;if(i=null!=t.alg?new a(t):new s(t),e.push(i),null!=t.cert&&1==t.hasis||null!=t.issuer&&null!=t.serial){var o=new n(t);e.push(o)}return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cades.OtherCertID,ht.asn1.ASN1Object),ht.asn1.cades.OtherHash=function(t){var e=ht,r=e.asn1;r.cms;var n=r.cades,i=n.OtherHashAlgAndValue,s=n.OtherHashValue;e.crypto.Util.hashHex;var a=e.lang.String.isHex;n.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?t={cert:t}:a(t)&&(t={hash:t}));return(null!=t.alg?new i(t):new s(t)).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.cades.OtherHash,ht.asn1.ASN1Object),ht.asn1.cades.CAdESUtil=new function(){},ht.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(t){return(new ht.asn1.cms.CMSParser).getCMSSignedData(t)},ht.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(t,e,r){var n=pt,i=n.getChildIdx,s=n.getTLV,a=n.getV,o=ht.asn1,u=o.ASN1Object,c=o.cms,h=c.AttributeList,l=c.SignerInfo,f={},p=i(t,e);if(6!=p.length)throw"not supported items for SignerInfo (!=6)";var g=p.shift();f.version=s(t,g);var d=p.shift();f.si=s(t,d);var v=p.shift();f.digalg=s(t,v);var m=p.shift();f.sattrs=s(t,m);var y=p.shift();f.sigalg=s(t,y);var x=p.shift();f.sig=s(t,x),f.sigval=a(t,x);var w=null;return f.obj=new l,(w=new u).hTLV=f.version,f.obj.dCMSVersion=w,(w=new u).hTLV=f.si,f.obj.dSignerIdentifier=w,(w=new u).hTLV=f.digalg,f.obj.dDigestAlgorithm=w,(w=new u).hTLV=f.sattrs,f.obj.dSignedAttrs=w,(w=new u).hTLV=f.sigalg,f.obj.dSigAlg=w,(w=new u).hTLV=f.sig,f.obj.dSig=w,f.obj.dUnsignedAttrs=new h,f},void 0!==ht.asn1.csr&&ht.asn1.csr||(ht.asn1.csr={}),ht.asn1.csr.CertificationRequest=function(t){var e=ht.asn1,r=e.DERBitString,n=e.DERSequence,i=e.csr;e.x509;var s=i.CertificationRequestInfo;i.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(t){this.params=t},this.sign=function(){var t=new s(this.params).tohex(),e=new ht.crypto.Signature({alg:this.params.sigalg});e.init(this.params.sbjprvkey),e.updateHex(t);var r=e.sign();this.params.sighex=r},this.getPEM=function(){return At(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var t=this.params,e=new ht.asn1.csr.CertificationRequestInfo(this.params),i=new ht.asn1.x509.AlgorithmIdentifier({name:t.sigalg});if(null==t.sighex&&null!=t.sbjprvkey&&this.sign(),null==t.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var s=new r({hex:"00"+t.sighex});return new n({array:[e,i,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.csr.CertificationRequest,ht.asn1.ASN1Object),ht.asn1.csr.CertificationRequestInfo=function(t){var e=ht.asn1;e.DERBitString;var r=e.DERSequence,n=e.DERInteger,i=e.DERUTF8String,s=e.DERTaggedObject,a=e.ASN1Util.newObject,o=e.csr,u=e.x509,c=u.X500Name,h=u.Extensions,l=u.SubjectPublicKeyInfo;o.AttributeList,o.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(t){null!=t&&(this.params=t)},this.tohex=function(){var t=this.params,e=[];if(e.push(new n({int:0})),e.push(new c(t.subject)),e.push(new l(Jt.getKey(t.sbjpubkey))),null!=t.attrs){var o=function(t){for(var e=Error,r=ht.asn1.x509.Extensions,n=[],i=0;i<t.length;i++){var s=t[i],a=s.attr;if("extensionRequest"==a){var o={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[new r(s.ext)]}]};n.push(o)}else if("unstructuredName"==a){o={seq:[{oid:"1.2.840.113549.1.9.2"},{set:s.names}]};n.push(o)}else{if("challengePassword"!=a)throw new e("unknown CSR attribute");o={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:s.password}]}]};n.push(o)}}return{set:n}}(t.attrs),u=a({tag:{tage:"a0",obj:o}});e.push(u)}else if(null!=t.extreq){var f=new h(t.extreq);u=a({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[f]}]}}});e.push(u)}else e.push(new s({tag:"a0",explicit:!1,obj:new i({str:""})}));return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},$t(ht.asn1.csr.CertificationRequestInfo,ht.asn1.ASN1Object),ht.asn1.csr.AttributeList=function(t){},$t(ht.asn1.csr.AttributeList,ht.asn1.ASN1Object),ht.asn1.csr.CSRUtil=new function(){},ht.asn1.csr.CSRUtil.newCSRPEM=function(t){return new ht.asn1.csr.CertificationRequest(t).getPEM()},ht.asn1.csr.CSRUtil.getParam=function(t,e){var r=pt,n=r.getV,i=r.getIdxbyList,s=r.getTLVbyList,a=r.getTLVbyListEx,o=r.getVbyListEx,u={};if(-1==t.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var c=Ct(t,"CERTIFICATE REQUEST");e&&(u.tbs=s(c,0,[0]));try{var h=a(c,0,[0,1]);if("3000"==h)u.subject={};else{var l=new Qt;u.subject=l.getX500Name(h)}}catch(t){}var f=a(c,0,[0,2]),p=Jt.getKey(f,null,"pkcs8pub");u.sbjpubkey=Jt.getPEM(p,"PKCS8PUB");var g=function(t){var e=i(t,0,[0,3,0,0],"06");return"2a864886f70d01090e"!=n(t,e)?null:s(t,0,[0,3,0,1,0],"30")}(c);l=new Qt;null!=g&&(u.extreq=l.getExtParamArray(g));try{var d=a(c,0,[1],"30");l=new Qt;u.sigalg=l.getAlgorithmIdentifierName(d)}catch(t){}try{var v=o(c,0,[2]);u.sighex=v}catch(t){}return u},ht.asn1.csr.CSRUtil.verifySignature=function(t){try{var e=null;if("string"==typeof t&&-1!=t.indexOf("-----BEGIN CERTIFICATE REQUEST")?e=ht.asn1.csr.CSRUtil.getParam(t,!0):"object"==typeof t&&null!=t.sbjpubkey&&null!=t.sigalg&&null!=t.sighex&&null!=t.tbs&&(e=t),null==e)return!1;var r=new ht.crypto.Signature({alg:e.sigalg});return r.init(e.sbjpubkey),r.updateHex(e.tbs),r.verify(e.sighex)}catch(t){return alert(t),!1}},void 0!==ht&&ht||(ht={}),void 0!==ht.asn1&&ht.asn1||(ht.asn1={}),void 0!==ht.asn1.ocsp&&ht.asn1.ocsp||(ht.asn1.ocsp={}),ht.asn1.ocsp.DEFAULT_HASH="sha1",ht.asn1.ocsp.OCSPResponse=function(t){ht.asn1.ocsp.OCSPResponse.superclass.constructor.call(this),ht.asn1.DEREnumerated;var e=ht.asn1.ASN1Util.newObject,r=ht.asn1.ocsp.ResponseBytes,n=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var t=this.params.resstatus;return"number"==typeof t?t:"string"!=typeof t?-1:n.indexOf(t)},this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params,n=this._getStatusCode();if(-1==n)throw new Error("responseStatus not supported: "+t.resstatus);if(0!=n)return e({seq:[{enum:{int:n}}]}).tohex();var i=new r(t);return e({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:i}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.ocsp.OCSPResponse,ht.asn1.ASN1Object),ht.asn1.ocsp.ResponseBytes=function(t){ht.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var e=ht.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.DEROctetString,s=e.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if("ocspBasic"!=t.restype)throw new Error("not supported responseType: "+t.restype);var e=new s(t),a=[];return a.push(new n({name:"ocspBasic"})),a.push(new i({hex:e.tohex()})),new r({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.ocsp.ResponseBytes,ht.asn1.ASN1Object),ht.asn1.ocsp.BasicOCSPResponse=function(t){ht.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var e=Error,r=ht.asn1,n=r.ASN1Object,i=r.DERSequence;r.DERGeneralizedTime;var s=r.DERTaggedObject,a=r.DERBitString;r.x509.Extensions;var o=r.x509.AlgorithmIdentifier,u=r.ocsp;u.ResponderID,_SingleResponseList=u.SingleResponseList,_ResponseData=u.ResponseData,this.params=null,this.setByParam=function(t){this.params=t},this.sign=function(){var t=this.params,e=t.tbsresp.tohex(),r=new ht.crypto.Signature({alg:t.sigalg});r.init(t.reskey),r.updateHex(e),t.sighex=r.sign()},this.tohex=function(){var t=this.params;null==t.tbsresp&&(t.tbsresp=new _ResponseData(t)),null==t.sighex&&null!=t.reskey&&this.sign();var r=[];if(r.push(t.tbsresp),r.push(new o({name:t.sigalg})),r.push(new a({hex:"00"+t.sighex})),null!=t.certs&&null!=t.certs.length){for(var u=[],c=0;c<t.certs.length;c++){var h=t.certs[c],l=null;if(pt.isASN1HEX(h))l=h;else{if(!h.match(/-----BEGIN/))throw new e("certs["+c+"] not hex or PEM");l=Ct(h)}u.push(new n({tlv:l}))}var f=new i({array:u});r.push(new s({tag:"a0",explicit:!0,obj:f}))}return new i({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.ocsp.BasicOCSPResponse,ht.asn1.ASN1Object),ht.asn1.ocsp.ResponseData=function(t){ht.asn1.ocsp.ResponseData.superclass.constructor.call(this);var e=ht.asn1,r=e.DERSequence,n=e.DERGeneralizedTime,i=e.DERTaggedObject,s=e.x509.Extensions,a=e.ocsp,o=a.ResponderID;_SingleResponseList=a.SingleResponseList,this.params=null,this.tohex=function(){var t=this.params;t.respid,t.prodat,t.array;var e=[];if(e.push(new o(t.respid)),e.push(new n(t.prodat)),e.push(new _SingleResponseList(t.array)),null!=t.ext){var a=new s(t.ext);e.push(new i({tag:"a1",explicit:!0,obj:a}))}return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},$t(ht.asn1.ocsp.ResponseData,ht.asn1.ASN1Object),ht.asn1.ocsp.ResponderID=function(t){ht.asn1.ocsp.ResponderID.superclass.constructor.call(this);var e=ht,r=e.asn1,n=r.ASN1Util.newObject,i=r.x509.X500Name,s=e.lang.String.isHex,a=Error;this.params=null,this.tohex=function(){var t=this.params;if(null!=t.key){var e,r=null;if("string"==typeof t.key){if(s(t.key)&&(r=t.key),t.key.match(/-----BEGIN CERTIFICATE/))null!=(e=new Qt(t.key).getExtSubjectKeyIdentifier())&&(r=e.kid.hex)}else if(t.key instanceof Qt)null!=(e=t.key.getExtSubjectKeyIdentifier())&&(r=e.kid.hex);if(null==r)throw new a("wrong key member value");return n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:r}}}}).tohex()}if(null!=t.name){var o=null;if("string"==typeof t.name&&t.name.match(/-----BEGIN CERTIFICATE/))o=new Qt(t.name).getSubject();else t.name instanceof Qt?o=t.name.getSubject():"object"!=typeof t.name||null==t.name.array&&null==t.name.str||(o=t.name);if(null==o)throw new a("wrong name member value");return n({tag:{tag:"a1",explicit:!0,obj:new i(o)}}).tohex()}throw new a("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},$t(ht.asn1.ocsp.ResponderID,ht.asn1.ASN1Object),ht.asn1.ocsp.SingleResponseList=function(t){ht.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var e=ht.asn1,r=e.DERSequence,n=e.ocsp.SingleResponse;this.params=null,this.tohex=function(){var t=this.params;if("object"!=typeof t||null==t.length)throw new Error("params not specified properly");for(var e=[],i=0;i<t.length;i++)e.push(new n(t[i]));return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},$t(ht.asn1.ocsp.SingleResponseList,ht.asn1.ASN1Object),ht.asn1.ocsp.SingleResponse=function(t){var e=Error,r=ht.asn1,n=r.DERSequence,i=r.DERGeneralizedTime,s=r.DERTaggedObject,a=r.ocsp,o=a.CertID,u=a.CertStatus,c=r.x509.Extensions;a.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,r=[];if(null==t.certid)throw new e("certid unspecified");if(null==t.status)throw new e("status unspecified");if(null==t.thisupdate)throw new e("thisupdate unspecified");if(r.push(new o(t.certid)),r.push(new u(t.status)),r.push(new i(t.thisupdate)),null!=t.nextupdate){var a=new i(t.nextupdate);r.push(new s({tag:"a0",explicit:!0,obj:a}))}if(null!=t.ext){var h=new c(t.ext);r.push(new s({tag:"a1",explicit:!0,obj:h}))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},$t(ht.asn1.ocsp.SingleResponse,ht.asn1.ASN1Object),ht.asn1.ocsp.CertID=function(t){var e=ht,r=e.asn1,n=r.DEROctetString,i=r.DERInteger,s=r.DERSequence,a=r.x509.AlgorithmIdentifier,o=r.ocsp;o.DEFAULT_HASH;var u=e.crypto.Util.hashHex,c=Qt,h=pt.getVbyList;o.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(t,e,r,n){null==n&&(n=this.DEFAULT_HASH),this.params={alg:n,issname:t,isskey:e,sbjsn:r}},this.setByCert=function(t,e,r){null==r&&(r=this.DEFAULT_HASH),this.params={alg:r,issuerCert:t,subjectCert:e}},this.getParamByCerts=function(t,e,r){null==r&&(r=this.DEFAULT_HASH);var n=new c(t),i=new c(e),s=u(n.getSubjectHex(),r),a=n.getPublicKeyHex();return{alg:r,issname:s,isskey:u(h(a,0,[1],"03",!0),r),sbjsn:i.getSerialNumberHex()}},this.tohex=function(){if("object"!=typeof this.params)throw new Error("params not set");var t,e,r,o,u=this.params;if(o=null==u.alg?this.DEFAULT_HASH:u.alg,null!=u.issuerCert&&null!=u.subjectCert){var c=this.getParamByCerts(u.issuerCert,u.subjectCert,o);t=c.issname,e=c.isskey,r=c.sbjsn}else{if(null==u.issname||null==u.isskey||null==u.sbjsn)throw new Error("required param members not defined");t=u.issname,e=u.isskey,r=u.sbjsn}var h=new a({name:o}),l=new n({hex:t}),f=new n({hex:e}),p=new i({hex:r}),g=new s({array:[h,l,f,p]});return this.hTLV=g.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},$t(ht.asn1.ocsp.CertID,ht.asn1.ASN1Object),ht.asn1.ocsp.CertStatus=function(t){ht.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if("good"==t.status)return"8000";if("unknown"==t.status)return"8200";if("revoked"==t.status){var e=[{gentime:{str:t.time}}];null!=t.reason&&e.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:t.reason}}}});var r={tag:"a1",explicit:!1,obj:{seq:e}};return ht.asn1.ASN1Util.newObject({tag:r}).tohex()}throw new Error("bad status")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},$t(ht.asn1.ocsp.CertStatus,ht.asn1.ASN1Object),ht.asn1.ocsp.Request=function(t){var e=ht.asn1,r=e.DERSequence,n=e.ocsp;if(n.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.tohex=function(){var t=[];if(null===this.dReqCert)throw"reqCert not set";t.push(this.dReqCert);var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t){var i=new n.CertID(t);this.dReqCert=i}},$t(ht.asn1.ocsp.Request,ht.asn1.ASN1Object),ht.asn1.ocsp.TBSRequest=function(t){var e=ht.asn1,r=e.DERSequence,n=e.ocsp;n.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(t){for(var e=[],r=0;r<t.length;r++){var i=new n.Request(t[0]);e.push(i)}this.dRequestList=e},this.tohex=function(){var t=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var e=new r({array:this.dRequestList});if(t.push(e),null!==this.dRequestExt)throw"requestExtensions not supported";var n=new r({array:t});return this.hTLV=n.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&void 0!==t.reqList&&this.setRequestListByParam(t.reqList)},$t(ht.asn1.ocsp.TBSRequest,ht.asn1.ASN1Object),ht.asn1.ocsp.OCSPRequest=function(t){var e=ht.asn1,r=e.DERSequence,n=e.ocsp;if(n.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.tohex=function(){var t=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(t.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&void 0!==t.reqList){var i=new n.TBSRequest(t);this.dTbsRequest=i}},$t(ht.asn1.ocsp.OCSPRequest,ht.asn1.ASN1Object),ht.asn1.ocsp.OCSPUtil={},ht.asn1.ocsp.OCSPUtil.getRequestHex=function(t,e,r){var n=ht.asn1.ocsp;void 0===r&&(r=n.DEFAULT_HASH);var i={alg:r,issuerCert:t,subjectCert:e};return new n.OCSPRequest({reqList:[i]}).tohex()},ht.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(t){var e=pt,r=e.getVbyList,n=e.getVbyListEx,i=e.getIdxbyList;e.getIdxbyListEx;var s=e.getV,a={};try{var o=n(t,0,[0],"0a");a.responseStatus=parseInt(o,16)}catch(t){}if(0!==a.responseStatus)return a;try{var u=i(t,0,[1,0,1,0,0,2,0,1]);"80"===t.substr(u,2)?a.certStatus="good":"a1"===t.substr(u,2)?(a.certStatus="revoked",a.revocationTime=St(r(t,u,[0]))):"82"===t.substr(u,2)&&(a.certStatus="unknown")}catch(t){}try{var c=i(t,0,[1,0,1,0,0,2,0,2]);a.thisUpdate=St(s(t,c))}catch(t){}try{var h=i(t,0,[1,0,1,0,0,2,0,3]);"a0"===t.substr(h,2)&&(a.nextUpdate=St(r(t,h,[0])))}catch(t){}return a},ht.asn1.ocsp.OCSPParser=function(){var t=Error,e=Qt,r=new e,n=pt,i=n.getV,s=n.getTLV,a=n.getIdxbyList,o=n.getVbyList,u=n.getTLVbyList,c=n.getVbyListEx,h=n.getTLVbyListEx,l=n.getChildIdx;this.getOCSPRequest=function(e){var r=l(e,0);if(1!=r.length&&2!=r.length)throw new t("wrong number elements: "+r.length);return this.getTBSRequest(s(e,r[0]))},this.getTBSRequest=function(t){var e={},n=h(t,0,[0],"30");e.array=this.getRequestList(n);var i=h(t,0,["[2]",0],"30");return null!=i&&(e.ext=r.getExtParamArray(i)),e},this.getRequestList=function(t){for(var e=[],r=l(t,0),n=0;n<r.length;n++){t=s(t,r[n]);e.push(this.getRequest(t))}return e},this.getRequest=function(e){var n=l(e,0);if(1!=n.length&&2!=n.length)throw new t("wrong number elements: "+n.length);var i=this.getCertID(s(e,n[0]));if(2==n.length){var o=a(e,0,[1,0]);i.ext=r.getExtParamArray(s(e,o))}return i},this.getCertID=function(r){var n=l(r,0);if(4!=n.length)throw new t("wrong number elements: "+n.length);var a=new e,o={};return o.alg=a.getAlgorithmIdentifierName(s(r,n[0])),o.issname=i(r,n[1]),o.isskey=i(r,n[2]),o.sbjsn=i(r,n[3]),o},this.getOCSPResponse=function(t){var e,r=l(t,0),n=i(t,r[0]),s=parseInt(n);if(1==r.length)return{resstatus:s};var a=u(t,0,[1,0]);return(e=this.getResponseBytes(a)).resstatus=s,e},this.getResponseBytes=function(t){var e,r=l(t,0),n=u(t,0,[1,0]);e=this.getBasicOCSPResponse(n);var s=i(t,r[0]);return e.restype=ht.asn1.x509.OID.oid2name(qt(s)),e},this.getBasicOCSPResponse=function(t){var e,r=l(t,0);e=this.getResponseData(s(t,r[0]));var n=new Qt;e.alg=n.getAlgorithmIdentifierName(s(t,r[1]));var a=i(t,r[2]);e.sighex=a.substr(2);var o=c(t,0,["[0]"]);if(null!=o){for(var u=l(o,0),h=[],f=0;f<u.length;f++){var p=s(o,u[f]);h.push(p)}e.certs=h}return e},this.getResponseData=function(t){var e=l(t,0),r=e.length,n={},a=0;"a0"==t.substr(e[0],2)&&a++,n.respid=this.getResponderID(s(t,e[a++]));var o=i(t,e[a++]);if(n.prodat=St(o),n.array=this.getSingleResponseList(s(t,e[a++])),"a1"==t.substr(e[r-1],2)){var c=u(t,e[r-1],[0]),h=new Qt;n.ext=h.getExtParamArray(c)}return n},this.getResponderID=function(t){var e={};if("a2"==t.substr(0,2)){var r=o(t,0,[0]);e.key=r}if("a1"==t.substr(0,2)){var n=u(t,0,[0]),i=new Qt;e.name=i.getX500Name(n)}return e},this.getSingleResponseList=function(t){for(var e=l(t,0),r=[],n=0;n<e.length;n++){var i=this.getSingleResponse(s(t,e[n]));r.push(i)}return r},this.getSingleResponse=function(t){var e=l(t,0),r={},n=this.getCertID(s(t,e[0]));r.certid=n;var a=this.getCertStatus(s(t,e[1]));if(r.status=a,"18"==t.substr(e[2],2)){var c=i(t,e[2]);r.thisupdate=St(c)}for(var h=3;h<e.length;h++){if("a0"==t.substr(e[h],2)){var f=o(t,e[h],[0],"18");r.nextupdate=St(f)}if("a1"==t.substr(e[h],2)){var p=new Qt,g=u(t,0,[h,0]);r.ext=p.getExtParamArray(g)}}return r},this.getCertStatus=function(t){var e={};if("8000"==t)return{status:"good"};if("8200"==t)return{status:"unknown"};if("a1"==t.substr(0,2)){e.status="revoked";var r=St(o(t,0,[0]));e.time=r}return e}},void 0!==ht&&ht||(ht={}),void 0!==ht.lang&&ht.lang||(ht.lang={}),ht.lang.String=function(){},"function"==typeof Buffer?(lt=function(t){return vt(Buffer.from(t,"utf8").toString("base64"))},ft=function(t){return Buffer.from(mt(t),"base64").toString("utf8")}):(lt=function(t){return yt(It(Ht(t)))},ft=function(t){return decodeURIComponent(Pt(xt(t)))}),ht.lang.String.isInteger=function(t){return!!t.match(/^[0-9]+$/)||!!t.match(/^-[0-9]+$/)},ht.lang.String.isHex=function(t){return kt(t)},ht.lang.String.isBase64=function(t){return!(!(t=t.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||t.length%4!=0)},ht.lang.String.isBase64URL=function(t){return!t.match(/[+/=]/)&&(t=mt(t),ht.lang.String.isBase64(t))},ht.lang.String.isIntegerArray=function(t){return!!(t=t.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},ht.lang.String.isPrintable=function(t){return null!==t.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},ht.lang.String.isIA5=function(t){return null!==t.match(/^[\x20-\x21\x23-\x7f]*$/)},ht.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var zt=function(t,e,r){return null==r&&(r="0"),t.length>=e?t:new Array(e-t.length+1).join(r)+t};function Wt(t,e){for(var r=0,n=0;n<t.length;n++)r|=1<<e[t[n]];var i=r.toString(2),s="";for(n=i.length-1;n>=0;n--)s+=i[n];return s}function Gt(t,e,r){if("object"==typeof t){e=String(e).split(".");for(var n=0;n<e.length&&t;n++){var i=e[n];i.match(/^[0-9]+$/)&&(i=parseInt(i)),t=t[i]}return t||!1===t?t:r}}function $t(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}void 0!==ht&&ht||(ht={}),void 0!==ht.crypto&&ht.crypto||(ht.crypto={}),ht.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:m.algo.MD5,sha1:m.algo.SHA1,sha224:m.algo.SHA224,sha256:m.algo.SHA256,sha384:m.algo.SHA384,sha512:m.algo.SHA512,ripemd160:m.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="0001",a="00"+n,o="",u=i-4-a.length,c=0;c<u;c+=2)o+="ff";return s+o+a},this.hashString=function(t,e){return new ht.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new ht.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,"sha1")},this.sha256=function(t){return this.hashString(t,"sha256")},this.sha256Hex=function(t){return this.hashHex(t,"sha256")},this.sha512=function(t){return this.hashString(t,"sha512")},this.sha512Hex=function(t){return this.hashHex(t,"sha512")},this.isKey=function(t){return t instanceof st||t instanceof ht.crypto.DSA||t instanceof ht.crypto.ECDSA}},ht.crypto.Util.md5=function(t){return new ht.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(t)},ht.crypto.Util.ripemd160=function(t){return new ht.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(t)},ht.crypto.Util.SECURERANDOMGEN=new nt,ht.crypto.Util.getRandomHexOfNbytes=function(t){var e=new Array(t);return ht.crypto.Util.SECURERANDOMGEN.nextBytes(e),gt(e)},ht.crypto.Util.getRandomBigIntegerOfNbytes=function(t){return new E(ht.crypto.Util.getRandomHexOfNbytes(t),16)},ht.crypto.Util.getRandomHexOfNbits=function(t){var e=t%8,r=new Array((t-e)/8+1);return ht.crypto.Util.SECURERANDOMGEN.nextBytes(r),r[0]=(255<<e&255^255)&r[0],gt(r)},ht.crypto.Util.getRandomBigIntegerOfNbits=function(t){return new E(ht.crypto.Util.getRandomHexOfNbits(t),16)},ht.crypto.Util.getRandomBigIntegerZeroToMax=function(t){for(var e=t.bitLength();;){var r=ht.crypto.Util.getRandomBigIntegerOfNbits(e);if(t.compareTo(r)>=0)return r}},ht.crypto.Util.getRandomBigIntegerMinToMax=function(t,e){var r=t.compareTo(e);if(r>0)throw"biMin is greater than biMax";if(0==r)return t;var n=e.subtract(t);return ht.crypto.Util.getRandomBigIntegerZeroToMax(n).add(t)},ht.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=ht.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=ht.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=ht.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=m.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(m.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ht.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},ht.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},ht.crypto.MessageDigest.getHashLength=function(t){var e=ht.crypto.MessageDigest,r=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[r])throw"not supported algorithm: "+t;return e.HASHLENGTH[r]},ht.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},ht.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==(t=t.toLowerCase())&&(t="hmacsha1"),"hmac"!=(t=t.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=ht.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var r=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(r)&&"cryptojs"==e){try{var n=ht.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[r];this.mac=m.algo.HMAC.create(n,this.pass)}catch(t){throw"setAlgAndProvider hash alg set fail hashAlg="+r+"/"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=m.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(m.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=Ft(t)),void(this.pass=m.enc.Hex.parse(e))}if("object"!=typeof t)throw"KJUR.crypto.Mac unsupported password type: "+t;e=null;if(void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=wt(t.utf8)),void 0!==t.rstr&&(e=Ft(t.rstr)),void 0!==t.b64&&(e=S(t.b64)),void 0!==t.b64u&&(e=xt(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=m.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ht.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},ht.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw new Error("provider not supported: "+e);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new ht.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t)}this.init=function(t,e){var r=null;try{r=void 0===e?Jt.getKey(t):Jt.getKey(t,e)}catch(t){throw"init failed:"+t}if(!0===r.isPrivate)this.prvKey=r,this.state="SIGN";else{if(!0!==r.isPublic)throw"init failed.:"+r;this.pubKey=r,this.state="VERIFY"}},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==ht.crypto.ECDSA&&(this.prvKey=new ht.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof st&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof st&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof ht.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof ht.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==ht.crypto.ECDSA&&(this.pubKey=new ht.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof st&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof st&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ht.crypto.ECDSA&&this.pubKey instanceof ht.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ht.crypto.DSA&&this.pubKey instanceof ht.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(t){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(t){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=ht.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=Jt.getKey(t.prvkeypem);this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},ht.crypto.Cipher=function(t){},ht.crypto.Cipher.encrypt=function(t,e,r,n){if(null!=Gt(n,"enclag")&&(r=n.encalg),"string"==typeof r&&"-CBC"==r.substr(-4)){var i=e,s=t;null!=Gt(n,"key")&&(i=n.key),null!=Gt(n,"enc")&&(hEnc=n.enc);var a,o=m.enc.Hex.parse(i),u=m.enc.Hex.parse(s),c=m.enc.Hex.parse(n.iv);if("des-EDE3-CBC"==r)a=m.TripleDES.encrypt(u,o,{iv:c});else{if("aes128-CBC"!=r&&"aes256-CBC"!=r)throw new Error("unsupported algorithm: "+r);a=m.AES.encrypt(u,o,{iv:c})}return a+""}throw new Error("Cipher.encrypt: unsupported key or algorithm")},ht.crypto.Cipher.decrypt=function(t,e,r,n){if(null!=Gt(n,"enclag")&&(r=n.encalg),"string"==typeof r&&"-CBC"==r.substr(-4)){var i=e,s=t;null!=Gt(n,"key")&&(i=n.key),null!=Gt(n,"enc")&&(s=n.enc);var a,o=m.enc.Hex.parse(i),u=m.enc.Hex.parse(s),c=m.enc.Hex.parse(n.iv);if("des-EDE3-CBC"==r)a=m.TripleDES.decrypt({ciphertext:u},o,{iv:c});else{if("aes128-CBC"!=r&&"aes256-CBC"!=r)throw new Error("unsupported algorithm: "+r);a=m.AES.decrypt({ciphertext:u},o,{iv:c})}return m.enc.Hex.stringify(a)}throw new Error("Cipher.decrypt: unsupported key or algorithm")},ht.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040022":"secp384r1","2b81040023":"secp521r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==ht&&ht||(ht={}),void 0!==ht.crypto&&ht.crypto||(ht.crypto={}),ht.crypto.ECDSA=function(t){var e=Error,r=E,n=ot,i=ht.crypto.ECDSA,s=ht.crypto.ECParameterDB,a=i.getName,o=pt,u=o.getVbyListEx,c=o.isASN1HEX,h=new nt;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(t){return new r(t.bitLength(),h).mod(t.subtract(r.ONE)).add(r.ONE)},this.setNamedCurve=function(t){this.ecparams=s.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.getPublicKeyXYHex=function(){var t=this.pubKeyHex;if("04"!==t.substr(0,2))throw"this method supports uncompressed format(04) only";var e=this.ecparams.keycharlen;if(t.length!==2+2*e)throw"malformed public key hex length";var r={};return r.x=t.substr(2,e),r.y=t.substr(2+e),r},this.getShortNISTPCurveName=function(){var t=this.curveName;return"secp256r1"===t||"NIST P-256"===t||"P-256"===t||"prime256v1"===t?"P-256":"secp384r1"===t||"NIST P-384"===t||"P-384"===t?"P-384":"secp521r1"===t||"NIST P-521"===t||"P-521"===t?"P-521":null},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),r=this.ecparams.keycharlen,n=("0000000000"+e.toString(16)).slice(-r);return this.setPrivateKeyHex(n),{ecprvhex:n,ecpubhex:this.generatePublicKeyHex()}},this.generatePublicKeyHex=function(){var t=new r(this.prvKeyHex,16),e=this.ecparams.G.multiply(t),n=e.getX().toBigInteger(),i=e.getY().toBigInteger(),s=this.ecparams.keycharlen,a="04"+("0000000000"+n.toString(16)).slice(-s)+("0000000000"+i.toString(16)).slice(-s);return this.setPublicKeyHex(a),a},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var n=new r(e,16),s=this.ecparams.n,a=new r(t.substring(0,this.ecparams.keycharlen),16);do{var o=this.getBigRandom(s),u=this.ecparams.G.multiply(o).getX().toBigInteger().mod(s)}while(u.compareTo(r.ZERO)<=0);var c=o.modInverse(s).multiply(a.add(n.multiply(u))).mod(s);return i.biRSSigToASN1Sig(u,c)},this.sign=function(t,e){var n=e,i=this.ecparams.n,s=r.fromByteArrayUnsigned(t);do{var a=this.getBigRandom(i),o=this.ecparams.G.multiply(a).getX().toBigInteger().mod(i)}while(o.compareTo(E.ZERO)<=0);var u=a.modInverse(i).multiply(s.add(n.multiply(o))).mod(i);return this.serializeSig(o,u)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,s){try{var a,o,u=i.parseSigHex(e);a=u.r,o=u.s;var c=n.decodeFromHex(this.ecparams.curve,s),h=new r(t.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(h,a,o,c)}catch(t){return!1}},this.verify=function(t,e,i){var s,a,o;if(Bitcoin.Util.isArray(e)){var u=this.parseSig(e);s=u.r,a=u.s}else{if("object"!=typeof e||!e.r||!e.s)throw"Invalid value for signature";s=e.r,a=e.s}if(i instanceof ot)o=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";o=n.decodeFrom(this.ecparams.curve,i)}var c=r.fromByteArrayUnsigned(t);return this.verifyRaw(c,s,a,o)},this.verifyRaw=function(t,e,n,i){var s=this.ecparams.n,a=this.ecparams.G;if(e.compareTo(r.ONE)<0||e.compareTo(s)>=0)return!1;if(n.compareTo(r.ONE)<0||n.compareTo(s)>=0)return!1;var o=n.modInverse(s),u=t.multiply(o).mod(s),c=e.multiply(o).mod(s);return a.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(s).equals(e)},this.serializeSig=function(t,e){var r=t.toByteArraySigned(),n=e.toByteArraySigned(),i=[];return i.push(2),i.push(r.length),(i=i.concat(r)).push(2),i.push(n.length),(i=i.concat(n)).unshift(i.length),i.unshift(48),i},this.parseSig=function(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(2!=t[e=2])throw new Error("First element in signature must be a DERInteger");var n=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error("Second element in signature must be a DERInteger");var i=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:r.fromByteArrayUnsigned(n),s:r.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(e<0||e>7)throw"Invalid signature type";var n=this.ecparams.n;return{r:r.fromByteArrayUnsigned(t.slice(1,33)).mod(n),s:r.fromByteArrayUnsigned(t.slice(33,65)).mod(n),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===c(t))throw new Error("not ASN.1 hex string");var e,r,n;try{e=u(t,0,["[0]",0],"06"),r=u(t,0,[1],"04");try{n=u(t,0,["[1]",0],"03")}catch(t){}}catch(t){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=a(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n,i;try{u(t,0,[1,0],"06"),r=u(t,0,[1,1],"06"),n=u(t,0,[2,0,1],"04");try{i=u(t,0,[2,0,"[1]",0],"03")}catch(t){}}catch(t){throw new e("malformed PKCS#8 plain ECC private key")}if(this.curveName=a(r),void 0===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n;try{u(t,0,[0,0],"06"),r=u(t,0,[0,1],"06"),n=u(t,0,[1],"03")}catch(t){throw new e("malformed PKCS#8 ECC public key")}if(this.curveName=a(r),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(t,r){if(!1===c(t))throw new e("not ASN.1 hex string");var n,i;try{n=u(t,0,[0,5,0,1],"06"),i=u(t,0,[0,5,1],"03")}catch(t){throw new e("malformed X.509 certificate ECC public key")}if(this.curveName=a(n),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},ht.crypto.ECDSA.parseSigHex=function(t){var e=ht.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new E(e.r,16),s:new E(e.s,16)}},ht.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=pt,r=e.getChildIdx,n=e.getV;if(e.checkStrictDER(t,0),"30"!=t.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=r(t,0);if(2!=i.length)throw new Error("signature shall have two elements");var s=i[0],a=i[1];if("02"!=t.substr(s,2))throw new Error("1st item not ASN.1 integer");if("02"!=t.substr(a,2))throw new Error("2nd item not ASN.1 integer");return{r:n(t,s),s:n(t,a)}},ht.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=ht.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");"00"==r.substr(0,2)&&(r=r.substr(2)),"00"==n.substr(0,2)&&(n=n.substr(2));var i=Math.max(r.length,n.length);return(r=("000000"+r).slice(-i))+(n=("000000"+n).slice(-i))}if("00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),"00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n},ht.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return ht.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},ht.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new E(t,16),n=new E(e,16);return ht.crypto.ECDSA.biRSSigToASN1Sig(r,n)},ht.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=ht.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e});return new r.DERSequence({array:[n,i]}).tohex()},ht.crypto.ECDSA.getName=function(t){return"2b8104001f"===t?"secp192k1":"2a8648ce3d030107"===t?"secp256r1":"2b8104000a"===t?"secp256k1":"2b81040021"===t?"secp224r1":"2b81040022"===t?"secp384r1":"2b81040023"===t?"secp521r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)?"secp256r1":-1!=="|secp256k1|".indexOf(t)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(t)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(t)?"secp384r1":-1!=="|secp521r1|NIST P-521|P-521|".indexOf(t)?"secp521r1":null},void 0!==ht&&ht||(ht={}),void 0!==ht.crypto&&ht.crypto||(ht.crypto={}),ht.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new E(t,16)}this.getByName=function(r){var n=r;if(void 0!==e[n]&&(n=e[r]),void 0!==t[n])return t[n];throw"unregistered EC curve name: "+n},this.regist=function(n,i,s,a,o,u,c,h,l,f,p,g){t[n]={};var d=r(s),v=r(a),m=r(o),y=r(u),x=r(c),w=new ut(d,v,m),S=w.decodePointHex("04"+h+l);t[n].name=n,t[n].keylen=i,t[n].keycharlen=2*Math.ceil(i/8),t[n].curve=w,t[n].G=S,t[n].n=y,t[n].h=x,t[n].oid=p,t[n].info=g;for(var E=0;E<f.length;E++)e[f[E]]=n}},ht.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),ht.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),ht.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),ht.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),ht.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),ht.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),ht.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),ht.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),ht.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),ht.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==ht&&ht||(ht={}),void 0!==ht.crypto&&ht.crypto||(ht.crypto={}),ht.crypto.DSA=function(){var t=pt;t.getVbyList;var e=t.getVbyListEx,r=t.isASN1HEX,n=E,i=E.ONE;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(t,e,r,n,i){this.isPrivate=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=i},this.setPrivateHex=function(t,e,r,n,i){var s,a,o,u,c;s=new E(t,16),a=new E(e,16),o=new E(r,16),u="string"==typeof n&&n.length>1?new E(n,16):null,c=new E(i,16),this.setPrivate(s,a,o,u,c)},this.setPublic=function(t,e,r,n){!function(t,e,r,n){if(null==t||null==e||null==r||null==n)throw new Error("invalid DSA public key");if(i.compareTo(e)>=0||e.compareTo(t)>=0)throw new Error("invalid DSA public key");if(i.compareTo(r)>=0||r.compareTo(t)>=0)throw new Error("invalid DSA public key");if(i.compareTo(n)>=0||n.compareTo(t)>=0)throw new Error("invalid DSA public key");if(0!=r.modPow(e,t).compareTo(i))throw new Error("invalid DSA public key")}(t,e,r,n),this.isPublic=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=null},this.setPublicHex=function(t,e,r,n){var i,s,a,o;i=new E(t,16),s=new E(e,16),a=new E(r,16),o=new E(n,16),this.setPublic(i,s,a,o)},this.signWithMessageHash=function(t){var e=this.p,r=this.q,n=this.g;this.y;var i,s,a,o=this.x,u=new E(t.substr(0,r.bitLength()/4),16);do{i=ht.crypto.Util.getRandomBigIntegerMinToMax(E.ONE.add(E.ONE),r.subtract(E.ONE)),s=n.modPow(i,e).mod(r),a=i.modInverse(r).multiply(u.add(o.multiply(s))).mod(r)}while(0==s.compareTo(E.ZERO)||0==a.compareTo(E.ZERO));return ht.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:s}},{int:{bigint:a}}]})},this.verifyWithMessageHash=function(t,e){var r=this.p,n=this.q,i=this.g,s=this.y,a=this.parseASN1Signature(e),o=a[0],u=a[1],c=new E(t.substr(0,n.bitLength()/4),16);if(E.ZERO.compareTo(o)>=0||o.compareTo(n)>=0)throw"invalid DSA signature";if(E.ZERO.compareTo(u)>=0||u.compareTo(n)>=0)throw"invalid DSA signature";var h=u.modInverse(n),l=c.multiply(h).mod(n),f=o.multiply(h).mod(n);return 0==i.modPow(l,r).multiply(s.modPow(f,r)).mod(r).mod(n).compareTo(o)},this.parseASN1Signature=function(t){try{return[new n(e(t,0,[0],"02"),16),new n(e(t,0,[1],"02"),16)]}catch(t){throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(t){var n,i,s,a,o;if(!1===r(t))throw new Error("not ASN.1 hex string");try{n=e(t,0,[1],"02"),i=e(t,0,[2],"02"),s=e(t,0,[3],"02"),a=e(t,0,[4],"02"),o=e(t,0,[5],"02")}catch(t){throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(n,i,s,a,o)},this.readPKCS8PrvKeyHex=function(t){var n,i,s,a;if(!1===r(t))throw new Error("not ASN.1 hex string");try{n=e(t,0,[1,1,0],"02"),i=e(t,0,[1,1,1],"02"),s=e(t,0,[1,1,2],"02"),a=e(t,0,[2,0],"02")}catch(t){throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(n,i,s,null,a)},this.readPKCS8PubKeyHex=function(t){var n,i,s,a;if(!1===r(t))throw new Error("not ASN.1 hex string");try{n=e(t,0,[0,1,0],"02"),i=e(t,0,[0,1,1],"02"),s=e(t,0,[0,1,2],"02"),a=e(t,0,[1,0],"02")}catch(t){throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(n,i,s,a)},this.readCertPubKeyHex=function(t,n){var i,s,a,o;if(!1===r(t))throw new Error("not ASN.1 hex string");try{i=e(t,0,[0,5,0,1,0],"02"),s=e(t,0,[0,5,0,1,1],"02"),a=e(t,0,[0,5,0,1,2],"02"),o=e(t,0,[0,5,1,0],"02")}catch(t){throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(i,s,a,o)}};var Jt=function(){var t=function(t,r,n){return e(m.AES,t,r,n)},e=function(t,e,r,n){var i=m.enc.Hex.parse(e),s=m.enc.Hex.parse(r),a=m.enc.Hex.parse(n),o={};o.key=s,o.iv=a,o.ciphertext=i;var u=t.decrypt(o,s,{iv:a});return m.enc.Hex.stringify(u)},r=function(t,e,r){return n(m.AES,t,e,r)},n=function(t,e,r,n){var i=m.enc.Hex.parse(e),s=m.enc.Hex.parse(r),a=m.enc.Hex.parse(n),o=t.encrypt(i,s,{iv:a}),u=m.enc.Hex.parse(o.toString());return m.enc.Base64.stringify(u)},i={"AES-256-CBC":{proc:t,eproc:r,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:r,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:r,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(t,r,n){return e(m.TripleDES,t,r,n)},eproc:function(t,e,r){return n(m.TripleDES,t,e,r)},keylen:24,ivlen:8},"DES-CBC":{proc:function(t,r,n){return e(m.DES,t,r,n)},eproc:function(t,e,r){return n(m.DES,t,e,r)},keylen:8,ivlen:8}},s=function(t){var e={},r=t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));r&&(e.cipher=r[1],e.ivsalt=r[2]);var n=t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(e.type=n[1]);var i=-1,s=0;-1!=t.indexOf("\r\n\r\n")&&(i=t.indexOf("\r\n\r\n"),s=2),-1!=t.indexOf("\n\n")&&(i=t.indexOf("\n\n"),s=1);var a=t.indexOf("-----END");if(-1!=i&&-1!=a){var o=t.substring(i+2*s,a-s);o=o.replace(/\s+/g,""),e.data=o}return e},a=function(t,e,r){for(var n=r.substring(0,16),s=m.enc.Hex.parse(n),a=m.enc.Utf8.parse(e),o=i[t].keylen+i[t].ivlen,u="",c=null;;){var h=m.algo.MD5.create();if(null!=c&&h.update(c),h.update(a),h.update(s),c=h.finalize(),(u+=m.enc.Hex.stringify(c)).length>=2*o)break}var l={};return l.keyhex=u.substr(0,2*i[t].keylen),l.ivhex=u.substr(2*i[t].keylen,2*i[t].ivlen),l},o=function(t,e,r,n){var s=m.enc.Base64.parse(t),a=m.enc.Hex.stringify(s);return(0,i[e].proc)(a,r,n)};return{version:"1.0.0",parsePKCS5PEM:function(t){return s(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return a(t,e,r)},decryptKeyB64:function(t,e,r,n){return o(t,e,r,n)},getDecryptedKeyHex:function(t,e){var r=s(t),n=r.cipher,i=r.ivsalt,u=r.data,c=a(n,e,i).keyhex;return o(u,n,c,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,n,s){var o="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===i[n])throw new Error("KEYUTIL unsupported algorithm: "+n);if(void 0===s||null==s){var u=function(t){var e=m.lib.WordArray.random(t);return m.enc.Hex.stringify(e)}(i[n].ivlen);s=u.toUpperCase()}var c=function(t,e,r,n){return(0,i[e].eproc)(t,r,n)}(e,n,a(n,r,s).keyhex,s);o="-----BEGIN "+t+" PRIVATE KEY-----\r\n";return o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+n+","+s+"\r\n",o+="\r\n",o+=c.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+t+" PRIVATE KEY-----\r\n"},getEncryptedPKCS8PEM:function(t,e,r){return At(this.getEncryptedPKCS8Hex(t,e,r),"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(t,e,r){var n;(n=null==r||null==r?{}:JSON.parse(JSON.stringify(r))).plain=t,this.initPBES2Param(n),this.encryptPBES2Param(n,e);var i=this.generatePBES2ASN1Param(n);return ht.asn1.ASN1Util.newObject(i).tohex()},initPBES2Param:function(t){var e;(null==Gt(t,"encalg")&&(t.encalg="aes256-CBC"),null==Gt(t,"iter")&&(t.iter=2048),null==Gt(t,"prf")&&(t.prf="hmacWithSHA256"),null==Gt(t,"salt")&&(t.salt=m.enc.Hex.stringify(m.lib.WordArray.random(8))),null==Gt(t,"enciv"))&&("des-EDE3-CBC"==t.encalg&&(e=8),"aes128-CBC"==t.encalg&&(e=16),"aes256-CBC"==t.encalg&&(e=16),t.enciv=m.enc.Hex.stringify(m.lib.WordArray.random(e)))},encryptPBES2Param:function(t,e){var r=Jt.getDKFromPBES2Param(t,e);try{var n=ht.crypto.Cipher.encrypt(t.plain,r,t.encalg,{iv:t.enciv})}catch(e){throw new Error("encrypt error: "+t.plain+" "+r+" "+t.encalg+" "+t.enciv)}t.enc=n},generatePBES2ASN1Param:function(t){var e={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:t.salt}},{int:{hex:Kt(t.iter)}}]}]},{seq:[{oid:t.encalg},{octstr:{hex:t.enciv}}]}]}]},{octstr:{hex:t.enc}}]};return"hmacWithSHA1"!=t.prf&&e.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:t.prf},{null:""}]}),e},parseHexOfEncryptedPKCS8:function(t){var e=pt,r=e.getChildIdx,n=e.getV,i={},s=r(t,0);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+s.length);i.ciphertext=n(t,s[1]);var a=r(t,s[0]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+a.length);if("2a864886f70d01050d"!=n(t,a[0]))throw new Error("this only supports pkcs5PBES2");var o=r(t,a[1]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+o.length);var u=r(t,o[1]);if(2!=u.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length);if("2a864886f70d0307"!=n(t,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=n(t,u[1]);var c=r(t,o[0]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+c.length);if("2a864886f70d01050c"!=n(t,c[0]))throw new Error("this only supports pkcs5PBKDF2");var h=r(t,c[1]);if(h.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+h.length);i.pbkdf2Salt=n(t,h[0]);var l=n(t,h[1]);try{i.pbkdf2Iter=parseInt(l,16)}catch(t){throw new Error("malformed format pbkdf2Iter: "+l)}return i},getPBKDF2KeyHexFromParam:function(t,e){var r=m.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,i=m.PBKDF2(e,r,{keySize:6,iterations:n});return m.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=Ct(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=Jt.getPBKDF2KeyHexFromParam(n,e),s={};s.ciphertext=m.enc.Hex.parse(n.ciphertext);var a=m.enc.Hex.parse(i),o=m.enc.Hex.parse(n.encryptionSchemeIV),u=m.TripleDES.decrypt(s,a,{iv:o});return m.enc.Hex.stringify(u)},parsePBES2:function(t){var e=pt.parse(t);if("pkcs5PBES2"!=Gt(e,"seq.0.seq.0.oid")||"pkcs5PBKDF2"!=Gt(e,"seq.0.seq.1.seq.0.seq.0.oid"))throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var r=Gt(e,"seq.0.seq.1.seq.0.seq.1.seq");if(null==r)throw new Error("PBKDF2 parameter not found");var n=Gt(r,"0.octstr.hex"),i=Gt(r,"1.int.hex"),s=Gt(r,"2.seq.0.oid","hmacWithSHA1"),a=-1;try{a=parseInt(i,16)}catch(t){throw new Error("iter not proper value")}var o=Gt(e,"seq.0.seq.1.seq.1.seq.0.oid"),u=Gt(e,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),c=Gt(e,"seq.1.octstr.hex");if(null==o||null==u||null==c)throw new Error("encalg, enciv or enc is undefined");return{salt:n,iter:a,prf:s,encalg:o,enciv:u,enc:c}},getDKFromPBES2Param:function(t,e){var r={hmacWithSHA1:m.algo.SHA1,hmacWithSHA224:m.algo.SHA224,hmacWithSHA256:m.algo.SHA256,hmacWithSHA384:m.algo.SHA384,hmacWithSHA512:m.algo.SHA512}[t.prf];if(null==r)throw new Error("unsupported prf");var n={"des-EDE3-CBC":6,"aes128-CBC":4,"aes256-CBC":8}[t.encalg];if(null==n)throw new Error("unsupported encalg");var i=m.enc.Hex.parse(t.salt),s=t.iter;try{var a=m.PBKDF2(e,i,{keySize:n,iterations:s,hasher:r});return m.enc.Hex.stringify(a)}catch(r){throw new Error("PBKDF2 error: "+r+" "+JSON.stringify(t)+" "+e)}},getPlainHexFromEncryptedPKCS8PEM:function(t,e){if(-1==t.indexOf("BEGIN ENCRYPTED PRIVATE KEY"))throw new Error("not Encrypted PKCS#8 PEM string");var r,n=Ct(t);try{r=Jt.parsePBES2(n)}catch(t){throw new Error("malformed PBES2 format: "+t.message)}var i=Jt.getDKFromPBES2Param(r,e);return ht.crypto.Cipher.decrypt(r.enc,i,r.encalg,{iv:r.enciv})},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainHexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(r)},parsePlainPrivatePKCS8Hex:function(t){var e=pt,r=e.getChildIdx,n=e.getV,i={algparam:null};if("30"!=t.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var s=r(t,0);if(s.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=t.substr(s[1],2))throw new Error("malformed PKCS8 private key(code:003)");var a=r(t,s[1]);if(2!=a.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=t.substr(a[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=n(t,a[0]),"06"==t.substr(a[1],2)&&(i.algparam=n(t,a[1])),"04"!=t.substr(s[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=e.getVidx(t,s[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=Ct(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,r=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==r.algoid)e=new st;else if("2a8648ce380401"==r.algoid)e=new ht.crypto.DSA;else{if("2a8648ce3d0201"!=r.algoid)throw new Error("unsupported private key algorithm");e=new ht.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,r=pt.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===r)e=new st;else if("2a8648ce380401"===r)e=new ht.crypto.DSA;else{if("2a8648ce3d0201"!==r)throw new Error("unsupported PKCS#8 public key hex");e=new ht.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=pt,r=e.getChildIdx,n=e.getV,i={};if("30"!=t.substr(0,2))throw new Error("malformed RSA key(code:001)");var s=r(t,0);if(2!=s.length)throw new Error("malformed RSA key(code:002)");if("02"!=t.substr(s[0],2))throw new Error("malformed RSA key(code:003)");if(i.n=n(t,s[0]),"02"!=t.substr(s[1],2))throw new Error("malformed RSA key(code:004)");return i.e=n(t,s[1]),i},parsePublicPKCS8Hex:function(t){var e=pt,r=e.getChildIdx,n=e.getV,i={algparam:null},s=r(t,0);if(2!=s.length)throw new Error("outer DERSequence shall have 2 elements: "+s.length);var a=s[0];if("30"!=t.substr(a,2))throw new Error("malformed PKCS8 public key(code:001)");var o=r(t,a);if(2!=o.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=t.substr(o[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(i.algoid=n(t,o[0]),"06"==t.substr(o[1],2)?i.algparam=n(t,o[1]):"30"==t.substr(o[1],2)&&(i.algparam={},i.algparam.p=e.getVbyList(t,o[1],[0],"02"),i.algparam.q=e.getVbyList(t,o[1],[1],"02"),i.algparam.g=e.getVbyList(t,o[1],[2],"02")),"03"!=t.substr(s[1],2))throw new Error("malformed PKCS8 public key(code:004)");return i.key=n(t,s[1]).substr(2),i}}}();function Yt(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t}function Xt(t,e,r){for(var n="",i=0;n.length<e;)n+=bt(r(Ft(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function Zt(t){for(var e in ht.crypto.Util.DIGESTINFOHEAD){var r=ht.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function Qt(t){var e=pt,r=e.getChildIdx,n=e.getV;e.dump;var i,s=e.parse,a=e.getTLV,o=e.getVbyList,u=e.getVbyListEx,c=e.getTLVbyList,h=e.getTLVbyListEx,l=e.getIdxbyList,f=e.getIdxbyListEx,p=e.getVidx,g=e.getInt,d=e.oidname,v=e.hextooidstr,m=Ct,y=Error;try{i=ht.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var t=c(this.hex,0,[0,0]);if("a0"==t.substr(0,2)){var e=c(t,0,[0]),r=g(e,0);if(r<0||2<r)throw new Error("malformed version field");return this.version=r+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var t=h(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var e in i)if(t===i[e])return e;return d(u(t,0,[0],"06"))},this.getIssuer=function(t,e){return this.getX500Name(this.getIssuerHex(),t,e)},this.getIssuerHex=function(){return c(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(t,e){return this.getX500Name(this.getSubjectHex(),t,e)},this.getSubjectHex=function(){return c(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var t=o(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=o(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return c(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var t=this.getSPKI();return null==t?null:o(t,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return l(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return Jt.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var t=c(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return o(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),r=this.getSignatureValueHex(),n=c(this.hex,0,[0],"30"),i=new ht.crypto.Signature({alg:e});return i.init(t),i.updateHex(n),i.verify(r)},this.parseExt=function(t){var i,s,a;if(void 0===t){if(a=this.hex,3!==this.version)return-1;i=l(a,0,[0,7,0],"30"),s=r(a,i)}else{a=Ct(t);var u=l(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=n(a,u))return void(this.aExtInfo=new Array);i=l(a,0,[0,3,0,1,0],"30"),s=r(a,i),this.hex=a}this.aExtInfo=new Array;for(var c=0;c<s.length;c++){var h={critical:!1},f=0;3===r(a,s[c]).length&&(h.critical=!0,f=1),h.oid=e.hextooidstr(o(a,s[c],[0],"06"));var g=l(a,s[c],[1+f]);h.vidx=p(a,g),this.aExtInfo.push(h)}},this.getExtInfo=function(t){var e=this.aExtInfo,r=t;if(t.match(/^[0-9.]+$/)||(r=ht.asn1.x509.OID.name2oid(t)),""!==r)for(var n=0;n<e.length;n++)if(e[n].oid===r)return e[n]},this.getCriticalExtV=function(t,e,r){if(null!=e)return[e,r];var n=this.getExtInfo(t);return null==n?[null,null]:[a(this.hex,n.vidx),n.critical]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("basicConstraints");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"basicConstraints"};if(e&&(i.critical=!0),"3000"===t)return i;if("30030101ff"===t)return i.cA=!0,i;if("30060101ff02"===t.substr(0,12)){var s=n(t,10),o=parseInt(s,16);return i.cA=!0,i.pathLen=o,i}throw new Error("hExtV parse error: "+t)},this.getExtNameConstraints=function(t,e){var n=this.getCriticalExtV("nameConstraints",t,e);if(t=n[0],e=n[1],null!=t){var i={extname:"nameConstraints"};e&&(i.critical=!0);for(var s=r(t,0),o=0;o<s.length;o++){for(var u=[],c=r(t,s[o]),h=0;h<c.length;h++){var l=a(t,c[h]),f=this.getGeneralSubtree(l);u.push(f)}var p=t.substr(s[o],2);"a0"==p?i.permit=u:"a1"==p&&(i.exclude=u)}return i}},this.getGeneralSubtree=function(t){var e=r(t,0),i=e.length;if(i<1||2<i)throw new Error("wrong num elements");for(var s=this.getGeneralName(a(t,e[0])),o=1;o<i;o++){var u=t.substr(e[o],2),c=n(t,e[o]),h=parseInt(c,16);"80"==u&&(s.min=h),"81"==u&&(s.max=h)}return s},this.getExtKeyUsage=function(t,e){var r=this.getCriticalExtV("keyUsage",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"keyUsage"};return e&&(n.critical=!0),n.names=this.getExtKeyUsageString(t).split(","),n}},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo("keyUsage");if(void 0===e)return"";t=a(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error("malformed key usage value: "+t);var r="000000000000000"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(r=r.slice(-8)),10==t.length&&(r=r.slice(-16)),""==(r=r.replace(/0+$/,""))&&(r="0"),r},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),r=new Array,n=0;n<e.length;n++)"1"==e.substr(n,1)&&r.push(Qt.KEYUSAGE_NAME[n]);return r.join(",")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectKeyIdentifier");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"subjectKeyIdentifier"};e&&(i.critical=!0);var s=n(t,0);return i.kid={hex:s},i},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("authorityKeyIdentifier");if(void 0===i)return;t=a(this.hex,i.vidx),e=i.critical}var s={extname:"authorityKeyIdentifier"};e&&(s.critical=!0);for(var o=r(t,0),u=0;u<o.length;u++){var c=t.substr(o[u],2);if("80"===c&&(s.kid={hex:n(t,o[u])}),"a1"===c){var h=a(t,o[u]),l=this.getGeneralNames(h);s.issuer=l[0].dn}"82"===c&&(s.sn={hex:n(t,o[u])})}return s},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var i=this.getExtInfo("extKeyUsage");if(void 0===i)return;t=a(this.hex,i.vidx),e=i.critical}var s={extname:"extKeyUsage",array:[]};e&&(s.critical=!0);for(var o=r(t,0),u=0;u<o.length;u++)s.array.push(d(n(t,o[u])));return s},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var e=new Array,i=a(this.hex,t.vidx);if(""===i)return e;for(var s=r(i,0),o=0;o<s.length;o++)e.push(d(n(i,s[o])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectAltName");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"subjectAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("issuerAltName");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"issuerAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getGeneralNames=function(t){for(var e=r(t,0),n=[],i=0;i<e.length;i++){var s=this.getGeneralName(a(t,e[i]));void 0!==s&&n.push(s)}return n},this.getGeneralName=function(t){var e=t.substr(0,2),r=n(t,0),i=bt(r);return"81"==e?{rfc822:i}:"82"==e?{dns:i}:"86"==e?{uri:i}:"87"==e?{ip:Nt(r)}:"a4"==e?{dn:this.getX500Name(r)}:"a0"==e?{other:this.getOtherName(t)}:void 0},this.getExtSubjectAltName2=function(){var t,e,i,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var o=new Array,u=a(this.hex,s.vidx),c=r(u,0),h=0;h<c.length;h++)i=u.substr(c[h],2),t=n(u,c[h]),"81"===i&&(e=St(t),o.push(["MAIL",e])),"82"===i&&(e=St(t),o.push(["DNS",e])),"84"===i&&(e=Qt.hex2dn(t,0),o.push(["DN",e])),"86"===i&&(e=St(t),o.push(["URI",e])),"87"===i&&(e=Nt(t),o.push(["IP",e]));return o},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("cRLDistributionPoints");if(void 0===n)return;t=a(this.hex,n.vidx),e=n.critical}var i={extname:"cRLDistributionPoints",array:[]};e&&(i.critical=!0);for(var s=r(t,0),o=0;o<s.length;o++){var u=a(t,s[o]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(t){for(var e={},n=r(t,0),i=0;i<n.length;i++){var s=t.substr(n[i],2),o=a(t,n[i]);"a0"==s&&(e.dpname=this.getDistributionPointName(o))}return e},this.getDistributionPointName=function(t){for(var e={},n=r(t,0),i=0;i<n.length;i++){var s=t.substr(n[i],2),o=a(t,n[i]);"a0"==s&&(e.full=this.getGeneralNames(o))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtCRLDistributionPoints();if(null==t)return t;for(var e=t.array,r=[],n=0;n<e.length;n++)try{null!=e[n].dpname.full[0].uri&&r.push(e[n].dpname.full[0].uri)}catch(t){}return r},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},n=r(this.hex,t.vidx),i=0;i<n.length;i++){var s=o(this.hex,n[i],[0],"06"),a=o(this.hex,n[i],[1],"86");"2b06010505073001"===s&&e.ocsp.push(St(a)),"2b06010505073002"===s&&e.caissuer.push(St(a))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("authorityInfoAccess");if(void 0===n)return;t=a(this.hex,n.vidx),e=n.critical}var i={extname:"authorityInfoAccess",array:[]};e&&(i.critical=!0);for(var s=r(t,0),c=0;c<s.length;c++){var h=u(t,s[c],[0],"06"),l=St(o(t,s[c],[1],"86"));if("2b06010505073001"==h)i.array.push({ocsp:l});else{if("2b06010505073002"!=h)throw new Error("unknown method: "+h);i.array.push({caissuer:l})}}return i},this.getExtCertificatePolicies=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("certificatePolicies");if(void 0===n)return;t=a(this.hex,n.vidx),e=n.critical}var i={extname:"certificatePolicies",array:[]};e&&(i.critical=!0);for(var s=r(t,0),o=0;o<s.length;o++){var u=a(t,s[o]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(t){var e={},n=o(t,0,[0],"06");e.policyoid=d(n);var i=f(t,0,[1],"30");if(-1!=i){e.array=[];for(var s=r(t,i),u=0;u<s.length;u++){var c=a(t,s[u]),h=this.getPolicyQualifierInfo(c);e.array.push(h)}}return e},this.getOtherName=function(t){var e={},n=r(t,0),i=o(t,n[0],[],"06"),a=o(t,n[1],[]);return e.oid=d(i),e.value=s(a),e},this.getPolicyQualifierInfo=function(t){var e={},r=o(t,0,[0],"06");if("2b06010505070201"===r){var n=u(t,0,[1],"16");e.cps=bt(n)}else if("2b06010505070202"===r){var i=c(t,0,[1],"30");e.unotice=this.getUserNotice(i)}return e},this.getUserNotice=function(t){var r=null;try{return r=e.parse(t),this._asn1ToUnotice(r)}catch(t){return}},this._asn1ToUnotice=function(t){try{for(var e={},r=Gt(t,"seq"),n=0;n<r.length;n++){var i=this._asn1ToNoticeRef(r[n]);null!=i&&(e.noticeref=i);var s=this.asn1ToDisplayText(r[n]);null!=s&&(e.exptext=s)}return Object.keys(e).length>0?e:void 0}catch(t){return}},this._asn1ToNoticeRef=function(t){try{for(var e={},r=Gt(t,"seq"),n=0;n<r.length;n++){var i=this._asn1ToNoticeNum(r[n]);null!=i&&(e.noticenum=i);var s=this.asn1ToDisplayText(r[n]);null!=s&&(e.org=s)}return Object.keys(e).length>0?e:void 0}catch(t){return}},this._asn1ToNoticeNum=function(t){try{for(var e=Gt(t,"seq"),r=[],n=0;n<e.length;n++){var i=e[n];r.push(parseInt(Gt(i,"int.hex"),16))}return r}catch(t){return}},this.getDisplayText=function(t){var e={};return e.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[t.substr(0,2)],e.str=bt(n(t,0)),e},this.asn1ToDisplayText=function(t){return null!=t.utf8str?{type:"utf8",str:t.utf8str.str}:null!=t.ia5str?{type:"ia5",str:t.ia5str.str}:null!=t.visstr?{type:"vis",str:t.visstr.str}:null!=t.bmpstr?{type:"bmp",str:t.bmpstr.str}:null!=t.prnstr?{type:"prn",str:t.prnstr.str}:void 0},this.getExtPolicyMappings=function(t,e){var r=this.getCriticalExtV("policyMappings",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"policyMappings"};e&&(n.critical=!0);try{for(var i=s(t).seq,a=[],o=0;o<i.length;o++){var u=i[o].seq;a.push([u[0].oid,u[1].oid])}n.array=a}catch(t){throw new y("malformed policyMappings")}return n}},this.getExtPolicyConstraints=function(t,e){var r=this.getCriticalExtV("policyConstraints",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"policyConstraints"};e&&(n.critical=!0);var i=s(t);try{for(var a=i.seq,o=0;o<a.length;o++){var u=a[o].tag;0==u.explicit&&("80"==u.tag&&(n.reqexp=parseInt(u.hex,16)),"81"==u.tag&&(n.inhibit=parseInt(u.hex,16)))}}catch(t){return new y("malformed policyConstraints value")}return n}},this.getExtInhibitAnyPolicy=function(t,e){var r=this.getCriticalExtV("inhibitAnyPolicy",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"inhibitAnyPolicy"};e&&(n.critical=!0);var i=g(t,0);return-1==i?new y("wrong value"):(n.skip=i,n)}},this.getExtCRLNumber=function(t,e){var r={extname:"cRLNumber"};if(e&&(r.critical=!0),"02"==t.substr(0,2))return r.num={hex:n(t,0)},r;throw new y("hExtV parse error: "+t)},this.getExtCRLReason=function(t,e){var r={extname:"cRLReason"};if(e&&(r.critical=!0),"0a"==t.substr(0,2))return r.code=parseInt(n(t,0),16),r;throw new Error("hExtV parse error: "+t)},this.getExtOcspNonce=function(t,e){var r={extname:"ocspNonce"};e&&(r.critical=!0);var i=n(t,0);return r.hex=i,r},this.getExtOcspNoCheck=function(t,e){var r={extname:"ocspNoCheck"};return e&&(r.critical=!0),r},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var n=this.getExtInfo("adobeTimeStamp");if(void 0===n)return;t=a(this.hex,n.vidx),e=n.critical}var i={extname:"adobeTimeStamp"};e&&(i.critical=!0);var s=r(t,0);if(s.length>1){var o=a(t,s[1]),u=this.getGeneralName(o);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=a(t,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i},this.getExtSubjectDirectoryAttributes=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectDirectoryAttributes");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"subjectDirectoryAttributes"};e&&(n.critical=!0);try{for(var i=s(t),o=[],u=0;u<i.seq.length;u++){var c=i.seq[u],h=Gt(c,"seq.0.oid"),l=Gt(c,"seq.1.set");if(null==h||null==l)throw"error";o.push({attr:h,array:l})}return n.array=o,n}catch(t){throw new Error("malformed subjectDirectoryAttributes extension value")}};var x=function(t){var e={};try{var r=t.seq[0].oid,n=ht.asn1.x509.OID.name2oid(r);e.type=ht.asn1.x509.OID.oid2atype(n);var i=t.seq[1];if(null!=i.utf8str)e.ds="utf8",e.value=i.utf8str.str;else if(null!=i.numstr)e.ds="num",e.value=i.numstr.str;else if(null!=i.telstr)e.ds="tel",e.value=i.telstr.str;else if(null!=i.prnstr)e.ds="prn",e.value=i.prnstr.str;else if(null!=i.ia5str)e.ds="ia5",e.value=i.ia5str.str;else if(null!=i.visstr)e.ds="vis",e.value=i.visstr.str;else{if(null==i.bmpstr)throw"error";e.ds="bmp",e.value=i.bmpstr.str}return e}catch(t){throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},w=function(t){try{return t.set.map(function(t){return x(t)})}catch(t){throw new Error("improper ASN.1 parsed RDN: "+t)}};this.getX500NameRule=function(t){for(var e=null,r=[],n=0;n<t.length;n++)for(var i=t[n],s=0;s<i.length;s++)r.push(i[s]);for(n=0;n<r.length;n++){var a=r[n],o=a.ds,u=a.value,c=a.type;if("prn"!=o&&"utf8"!=o&&"ia5"!=o)return"mixed";if("ia5"==o){if("CN"!=c)return"mixed";if(ht.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==o)continue;return"mixed"}if(null==e)e=o;else if(e!==o)return"mixed"}return null==e?"prn":e},this.getAttrTypeAndValue=function(t){var e=s(t);return x(e)},this.getRDN=function(t){var e=s(t);return w(e)},this.getX500NameArray=function(t){return function(t){try{return t.seq.map(function(t){return w(t)})}catch(t){throw new Error("improper ASN.1 parsed X500Name: "+t)}}(s(t))},this.getX500Name=function(t,e,r){var n=this.getX500NameArray(t),i={str:this.dnarraytostr(n)};return i.array=n,1==r&&(i.hex=t),1==e&&(i.canon=this.c14nRDNArray(n)),i},this.readCertPEM=function(t){this.readCertHex(m(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{l(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(t){var e={};return null==t&&(t={}),e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(t.dncanon,t.dnhex),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(t.dncanon,t.dnhex),e.sbjpubkey=At(this.getPublicKeyHex(),"PUBLIC KEY"),null!=this.aExtInfo&&this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),1==t.tbshex&&(e.tbshex=c(this.hex,0,[0])),1==t.nodnarray&&(delete e.issuer.array,delete e.subject.array),e},this.getExtParamArray=function(t){null==t&&(-1!=f(this.hex,0,[0,"[3]"])&&(t=h(this.hex,0,[0,"[3]",0],"30")));for(var e=[],n=r(t,0),i=0;i<n.length;i++){var s=a(t,n[i]),o=this.getExtParam(s);null!=o&&e.push(o)}return e},this.getExtParam=function(t){var e=r(t,0).length;if(2!=e&&3!=e)throw new Error("wrong number elements in Extension: "+e+" "+t);var n=v(o(t,0,[0],"06")),i=!1;3==e&&"0101ff"==c(t,0,[1])&&(i=!0);var a=c(t,0,[e-1,0]),u=void 0;if("2.5.29.14"==n?u=this.getExtSubjectKeyIdentifier(a,i):"2.5.29.15"==n?u=this.getExtKeyUsage(a,i):"2.5.29.17"==n?u=this.getExtSubjectAltName(a,i):"2.5.29.18"==n?u=this.getExtIssuerAltName(a,i):"2.5.29.19"==n?u=this.getExtBasicConstraints(a,i):"2.5.29.30"==n?u=this.getExtNameConstraints(a,i):"2.5.29.31"==n?u=this.getExtCRLDistributionPoints(a,i):"2.5.29.32"==n?u=this.getExtCertificatePolicies(a,i):"2.5.29.33"==n?u=this.getExtPolicyMappings(a,i):"2.5.29.35"==n?u=this.getExtAuthorityKeyIdentifier(a,i):"2.5.29.36"==n?u=this.getExtPolicyConstraints(a,i):"2.5.29.37"==n?u=this.getExtExtKeyUsage(a,i):"2.5.29.54"==n?u=this.getExtInhibitAnyPolicy(a,i):"1.3.6.1.5.5.7.1.1"==n?u=this.getExtAuthorityInfoAccess(a,i):"2.5.29.20"==n?u=this.getExtCRLNumber(a,i):"2.5.29.21"==n?u=this.getExtCRLReason(a,i):"2.5.29.9"==n?u=this.getExtSubjectDirectoryAttributes(a,i):"1.3.6.1.5.5.7.48.1.2"==n?u=this.getExtOcspNonce(a,i):"1.3.6.1.5.5.7.48.1.5"==n?u=this.getExtOcspNoCheck(a,i):"1.2.840.113583.1.1.9.1"==n?u=this.getExtAdobeTimeStamp(a,i):null!=Qt.EXT_PARSER[n]&&(u=Qt.EXT_PARSER[n](n,i,a)),null!=u)return u;var h={extname:n,extn:a};try{h.extn=s(a)}catch(t){}return i&&(h.critical=!0),h},this.findExt=function(t,e){for(var r=0;r<t.length;r++)if(t[r].extname==e)return t[r];return null},this.updateExtCDPFullURI=function(t,e){var r=this.findExt(t,"cRLDistributionPoints");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)if(null!=n[i].dpname&&null!=n[i].dpname.full)for(var s=n[i].dpname.full,a=0;a<s.length;a++){var o=s[i];null!=o.uri&&(o.uri=e)}},this.updateExtAIAOCSP=function(t,e){var r=this.findExt(t,"authorityInfoAccess");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].ocsp&&(n[i].ocsp=e)},this.updateExtAIACAIssuer=function(t,e){var r=this.findExt(t,"authorityInfoAccess");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].caissuer&&(n[i].caissuer=e)},this.dnarraytostr=function(t){return"/"+t.map(function(t){return function(t){return t.map(function(t){return function(t){return t.type+"="+t.value}(t).replace(/\+/,"\\+")}).join("+")}(t).replace(/\//,"\\/")}).join("/")},this.setCanonicalizedDN=function(t){var e;if(null!=t.str&&null==t.array){var r=new ht.asn1.x509.X500Name({str:t.str}).tohex();e=this.getX500NameArray(r)}else e=t.array;null==t.canon&&(t.canon=this.c14nRDNArray(e))},this.c14nRDNArray=function(t){for(var e=[],r=0;r<t.length;r++){for(var n=t[r],i=[],s=0;s<n.length;s++){var a=n[s],o=a.value;o=(o=(o=(o=o.replace(/^\s*/,"")).replace(/\s*$/,"")).replace(/\s+/g," ")).toLowerCase(),i.push(a.type.toLowerCase()+"="+o)}e.push(i.join("+"))}return"/"+e.join("/")},this.getInfo=function(){var t,e,r,n=function(t){for(var e="",r=" ",n="\n",i=t.array,s=0;s<i.length;s++){var a=i[s];if(null!=a.dn&&(e+=r+"dn: "+a.dn.str+n),null!=a.ip&&(e+=r+"ip: "+a.ip+n),null!=a.rfc822&&(e+=r+"rfc822: "+a.rfc822+n),null!=a.dns&&(e+=r+"dns: "+a.dns+n),null!=a.uri&&(e+=r+"uri: "+a.uri+n),null!=a.other)e+=r+"other: "+a.other.oid+"="+JSON.stringify(a.other.value).replace(/\"/g,"")+n}return e=e.replace(/\n$/,"")},i=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];if(e+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var s=0;s<i.array.length;s++){var a=i.array[s];void 0!==a.cps&&(e+=" cps: "+a.cps+"\n")}}return e},s=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];try{void 0!==i.dpname.full[0].uri&&(e+=" "+i.dpname.full[0].uri+"\n")}catch(t){}try{void 0!==i.dname.full[0].dn.hex&&(e+=" "+Qt.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(t){}}return e},a=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];void 0!==i.caissuer&&(e+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(e+=" ocsp: "+i.ocsp+"\n")}return e};if(t="Basic Fields\n",t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n",t+=" key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+=" n="+Vt(e.n.toString(16)).substr(0,16)+"...\n",t+=" e="+Vt(e.e.toString(16))+"\n"),null!=(r=this.aExtInfo)){t+="X509v3 Extensions:\n";for(var o=0;o<r.length;o++){var u=r[o],c=ht.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var h="";if(!0===u.critical&&(h="CRITICAL"),t+=" "+c+" "+h+":\n","basicConstraints"===c){var l=this.getExtBasicConstraints();void 0===l.cA?t+=" {}\n":(t+=" cA=true",void 0!==l.pathLen&&(t+=", pathLen="+l.pathLen),t+="\n")}else{var f;if("policyMappings"==c)t+=" "+this.getExtPolicyMappings().array.map(function(t){var e=t;return e[0]+":"+e[1]}).join(", ")+"\n";else if("policyConstraints"==c)t+=" ",null!=(f=this.getExtPolicyConstraints()).reqexp&&(t+=" reqexp="+f.reqexp),null!=f.inhibit&&(t+=" inhibit="+f.inhibit),t+="\n";else if("inhibitAnyPolicy"==c)t+=" skip="+(f=this.getExtInhibitAnyPolicy()).skip+"\n";else if("keyUsage"==c)t+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"==c)t+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"==c){var p=this.getExtAuthorityKeyIdentifier();void 0!==p.kid&&(t+=" kid="+p.kid.hex+"\n")}else{if("extKeyUsage"==c)t+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"==c)t+=n(this.getExtSubjectAltName())+"\n";else if("cRLDistributionPoints"==c)t+=s(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"==c)t+=a(this.getExtAuthorityInfoAccess());else"certificatePolicies"==c&&(t+=i(this.getExtCertificatePolicies()))}}}}return t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",t+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?this.readCertPEM(t):ht.lang.String.isHex(t)&&this.readCertHex(t))}Jt.getKey=function(t,e,r){var n=(v=pt).getChildIdx;v.getV;var i=v.getVbyList,s=ht.crypto,a=s.ECDSA,o=s.DSA,u=st,c=Ct,h=Jt;if(void 0!==u&&t instanceof u)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==o&&t instanceof o)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new a({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new a({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(I=new u).setPublic(t.n,t.e),I;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(I=new u).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),I;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(I=new u).setPrivate(t.n,t.e,t.d),I;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(I=new o).setPublic(t.p,t.q,t.g,t.y),I;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(I=new o).setPrivate(t.p,t.q,t.g,t.y,t.x),I;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(I=new u).setPublic(xt(t.n),xt(t.e)),I;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(I=new u).setPrivateEx(xt(t.n),xt(t.e),xt(t.d),xt(t.p),xt(t.q),xt(t.dp),xt(t.dq),xt(t.qi)),I;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(I=new u).setPrivate(xt(t.n),xt(t.e),xt(t.d)),I;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var l=(D=new a({curve:t.crv})).ecparams.keycharlen,f="04"+("0000000000"+xt(t.x)).slice(-l)+("0000000000"+xt(t.y)).slice(-l);return D.setPublicKeyHex(f),D}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){l=(D=new a({curve:t.crv})).ecparams.keycharlen,f="04"+("0000000000"+xt(t.x)).slice(-l)+("0000000000"+xt(t.y)).slice(-l);var p=("0000000000"+xt(t.d)).slice(-l);return D.setPublicKeyHex(f),D.setPrivateKeyHex(p),D}if("pkcs5prv"===r){var g,d=t,v=pt;if(9===(g=n(d,0)).length)(I=new u).readPKCS5PrvKeyHex(d);else if(6===g.length)(I=new o).readPKCS5PrvKeyHex(d);else{if(!(g.length>2&&"04"===d.substr(g[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(I=new a).readPKCS5PrvKeyHex(d)}return I}if("pkcs8prv"===r)return I=h.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===r)return h._getKeyFromPublicPKCS8Hex(t);if("x509pub"===r)return Qt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Qt.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var m=Ct(t,"PUBLIC KEY");return h._getKeyFromPublicPKCS8Hex(m)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var y=c(t,"RSA PRIVATE KEY");return h.getKey(y,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var x=i(R=c(t,"DSA PRIVATE KEY"),0,[1],"02"),w=i(R,0,[2],"02"),S=i(R,0,[3],"02"),b=i(R,0,[4],"02"),F=i(R,0,[5],"02");return(I=new o).setPrivate(new E(x,16),new E(w,16),new E(S,16),new E(b,16),new E(F,16)),I}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){y=c(t,"EC PRIVATE KEY");return h.getKey(y,null,"pkcs5prv")}if(-1!=t.indexOf("-END PRIVATE KEY-"))return h.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var A=h.getDecryptedKeyHex(t,e),C=new st;return C.readPKCS5PrvKeyHex(A),C}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var D,I=i(R=h.getDecryptedKeyHex(t,e),0,[1],"04"),P=i(R,0,[2,0],"06"),T=i(R,0,[3,0],"03").substr(2);if(void 0===ht.crypto.OID.oidhex2name[P])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+P);return(D=new a({curve:ht.crypto.OID.oidhex2name[P]})).setPublicKeyHex(T),D.setPrivateKeyHex(I),D.isPublic=!1,D}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var R;x=i(R=h.getDecryptedKeyHex(t,e),0,[1],"02"),w=i(R,0,[2],"02"),S=i(R,0,[3],"02"),b=i(R,0,[4],"02"),F=i(R,0,[5],"02");return(I=new o).setPrivate(new E(x,16),new E(w,16),new E(S,16),new E(b,16),new E(F,16)),I}if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return h.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},Jt.generateKeypair=function(t,e){if("RSA"==t){var r=e;(a=new st).generate(r,"10001"),a.isPrivate=!0,a.isPublic=!0;var n=new st,i=a.n.toString(16),s=a.e.toString(16);return n.setPublic(i,s),n.isPrivate=!1,n.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=n,o}if("EC"==t){var a,o,u=e,c=new ht.crypto.ECDSA({curve:u}).generateKeyPairHex();return(a=new ht.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),a.setPrivateKeyHex(c.ecprvhex),a.isPrivate=!0,a.isPublic=!1,(n=new ht.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=n,o}throw new Error("unknown algorithm: "+t)},Jt.getPEM=function(t,e,r,n,i,s){var a=ht,o=a.asn1,u=o.DERObjectIdentifier,c=o.DERInteger,h=o.ASN1Util.newObject,l=o.x509.SubjectPublicKeyInfo,f=a.crypto,p=f.DSA,g=f.ECDSA,d=st;function v(t){return h({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function m(t){return h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function y(t){return h({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==d&&t instanceof d||void 0!==p&&t instanceof p||void 0!==g&&t instanceof g)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return At(E=new l(t).tohex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==d&&t instanceof d&&(void 0===r||null==r)&&1==t.isPrivate)return At(E=v(t).tohex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate){var x=new u({name:t.curveName}).tohex(),w=m(t).tohex(),S="";return S+=At(x,"EC PARAMETERS"),S+=At(w,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==p&&t instanceof p&&(void 0===r||null==r)&&1==t.isPrivate)return At(E=y(t).tohex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate){var E=v(t).tohex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,r,n,s)}if("PKCS5PRV"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate){E=m(t).tohex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,r,n,s)}if("PKCS5PRV"==e&&void 0!==p&&t instanceof p&&void 0!==r&&null!=r&&1==t.isPrivate){E=y(t).tohex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,r,n,s)}var b=function(t,e){if("string"==typeof e)return Jt.getEncryptedPKCS8PEM(t,e);if("object"==typeof e&&null!=Gt(e,"passcode")){var r=JSON.parse(JSON.stringify(e)),n=r.passcode;return delete r.passcode,Jt.getEncryptedPKCS8PEM(t,n,r)}};if("PKCS8PRV"==e&&null!=d&&t instanceof d&&1==t.isPrivate){var F=v(t).tohex();E=h({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:F}}]}).tohex();return void 0===r||null==r?At(E,"PRIVATE KEY"):b(E,r)}if("PKCS8PRV"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){var A={seq:[{int:1},{octstr:{hex:t.prvKeyHex}}]};"string"==typeof t.pubKeyHex&&A.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]});F=new h(A).tohex(),E=h({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:F}}]}).tohex();return void 0===r||null==r?At(E,"PRIVATE KEY"):b(E,r)}if("PKCS8PRV"==e&&void 0!==p&&t instanceof p&&1==t.isPrivate){F=new c({bigint:t.x}).tohex(),E=h({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:F}}]}).tohex();return void 0===r||null==r?At(E,"PRIVATE KEY"):b(E,r)}throw new Error("unsupported object nor format")},Jt.getKeyFromCSRPEM=function(t){var e=Ct(t,"CERTIFICATE REQUEST");return Jt.getKeyFromCSRHex(e)},Jt.getKeyFromCSRHex=function(t){var e=Jt.parseCSRHex(t);return Jt.getKey(e.p8pubkeyhex,null,"pkcs8pub")},Jt.parseCSRHex=function(t){var e=pt,r=e.getChildIdx,n=e.getTLV,i={},s=t;if("30"!=s.substr(0,2))throw new Error("malformed CSR(code:001)");var a=r(s,0);if(a.length<1)throw new Error("malformed CSR(code:002)");if("30"!=s.substr(a[0],2))throw new Error("malformed CSR(code:003)");var o=r(s,a[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(s,o[2]),i},Jt.getKeyID=function(t){var e=Jt,r=pt;"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&(t=e.getKey(t));var n=Ct(e.getPEM(t)),i=r.getIdxbyList(n,0,[1]),s=r.getV(n,i).substring(2);return ht.crypto.Util.hashHex(s,"sha1")},Jt.getJWK=function(t,e,r,n,i){var s,a,o={},u=ht.crypto.Util.hashHex;if("string"==typeof t)s=Jt.getKey(t),-1!=t.indexOf("CERTIFICATE")&&(a=Ct(t));else{if("object"!=typeof t)throw new Error("unsupported keyinfo type");t instanceof Qt?(s=t.getPublicKey(),a=t.hex):s=t}if(s instanceof st&&s.isPrivate)o.kty="RSA",o.n=yt(s.n.toString(16)),o.e=yt(s.e.toString(16)),o.d=yt(s.d.toString(16)),o.p=yt(s.p.toString(16)),o.q=yt(s.q.toString(16)),o.dp=yt(s.dmp1.toString(16)),o.dq=yt(s.dmq1.toString(16)),o.qi=yt(s.coeff.toString(16));else if(s instanceof st&&s.isPublic)o.kty="RSA",o.n=yt(s.n.toString(16)),o.e=yt(s.e.toString(16));else if(s instanceof ht.crypto.ECDSA&&s.isPrivate){if("P-256"!==(h=s.getShortNISTPCurveName())&&"P-384"!==h&&"P-521"!==h)throw new Error("unsupported curve name for JWT: "+h);var c=s.getPublicKeyXYHex();o.kty="EC",o.crv=h,o.x=yt(c.x),o.y=yt(c.y),o.d=yt(s.prvKeyHex)}else if(s instanceof ht.crypto.ECDSA&&s.isPublic){var h;if("P-256"!==(h=s.getShortNISTPCurveName())&&"P-384"!==h&&"P-521"!==h)throw new Error("unsupported curve name for JWT: "+h);c=s.getPublicKeyXYHex();o.kty="EC",o.crv=h,o.x=yt(c.x),o.y=yt(c.y)}if(null==o.kty)throw new Error("unsupported keyinfo");return s.isPrivate||1==e||(o.kid=ht.jws.JWS.getJWKthumbprint(o)),null!=a&&1!=r&&(o.x5c=[w(a)]),null!=a&&1!=n&&(o.x5t=vt(w(u(a,"sha1")))),null!=a&&1!=i&&(o["x5t#S256"]=vt(w(u(a,"sha256")))),o},Jt.getJWKFromKey=function(t){return Jt.getJWK(t,!0,!0,!0,!0)},st.getPosArrayOfChildrenFromHex=function(t){return pt.getChildIdx(t,0)},st.getHexValueArrayOfChildrenFromHex=function(t){var e,r=pt.getV,n=r(t,(e=st.getPosArrayOfChildrenFromHex(t))[0]),i=r(t,e[1]),s=r(t,e[2]),a=r(t,e[3]),o=r(t,e[4]),u=r(t,e[5]),c=r(t,e[6]),h=r(t,e[7]),l=r(t,e[8]);return(e=new Array).push(n,i,s,a,o,u,c,h,l),e},st.prototype.readPrivateKeyFromPEMString=function(t){var e=Ct(t),r=st.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},st.prototype.readPKCS5PrvKeyHex=function(t){var e=st.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},st.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,s,a,o,u,c=pt,h=c.getVbyListEx;if(!1===c.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=h(t,0,[2,0,1],"02"),r=h(t,0,[2,0,2],"02"),n=h(t,0,[2,0,3],"02"),i=h(t,0,[2,0,4],"02"),s=h(t,0,[2,0,5],"02"),a=h(t,0,[2,0,6],"02"),o=h(t,0,[2,0,7],"02"),u=h(t,0,[2,0,8],"02")}catch(t){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,r,n,i,s,a,o,u)},st.prototype.readPKCS5PubKeyHex=function(t){var e=pt,r=e.getV;if(!1===e.isASN1HEX(t))throw new Error("keyHex is not ASN.1 hex string");var n=e.getChildIdx(t,0);if(2!==n.length||"02"!==t.substr(n[0],2)||"02"!==t.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=r(t,n[0]),s=r(t,n[1]);this.setPublic(i,s)},st.prototype.readPKCS8PubKeyHex=function(t){var e=pt;if(!1===e.isASN1HEX(t))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error("not PKCS8 RSA public key");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)},st.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new Qt).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},st.prototype.sign=function(t,e){var r=function(t){return ht.crypto.Util.hashString(t,e)}(t);return this.signWithMessageHash(r,e)},st.prototype.signWithMessageHash=function(t,e){var r=it(ht.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return Yt(this.doPrivate(r).toString(16),this.n.bitLength())},st.prototype.signPSS=function(t,e,r){var n=function(t){return ht.crypto.Util.hashHex(t,e)}(Ft(t));return void 0===r&&(r=-1),this.signWithMessageHashPSS(n,e,r)},st.prototype.signWithMessageHashPSS=function(t,e,r){var n,i=bt(t),s=i.length,a=this.n.bitLength()-1,o=Math.ceil(a/8),u=function(t){return ht.crypto.Util.hashHex(t,e)};if(-1===r||void 0===r)r=s;else if(-2===r)r=o-s-2;else if(r<-2)throw new Error("invalid salt length");if(o<s+r+2)throw new Error("data too long");var c="";r>0&&(c=new Array(r),(new nt).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=bt(u(Ft("\0\0\0\0\0\0\0\0"+i+c))),l=[];for(n=0;n<o-r-s-2;n+=1)l[n]=0;var f=String.fromCharCode.apply(String,l)+""+c,p=Xt(h,f.length,u),g=[];for(n=0;n<f.length;n+=1)g[n]=f.charCodeAt(n)^p.charCodeAt(n);var d=65280>>8*o-a&255;for(g[0]&=~d,n=0;n<s;n++)g.push(h.charCodeAt(n));return g.push(188),Yt(this.doPrivate(new E(g)).toString(16),this.n.bitLength())},st.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var r=it(e,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var s=Zt(i.replace(/^1f+00/,""));if(0==s.length)return!1;var a=s[0],o=s[1],u=function(t){return ht.crypto.Util.hashString(t,a)}(t);return o==u},st.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=it(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=Zt(this.doPublic(r).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==t)},st.prototype.verifyPSS=function(t,e,r,n){var i,s=(i=Ft(t),ht.crypto.Util.hashHex(i,r));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(s,e,r,n)},st.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,s=new E(e,16),a=function(t){return ht.crypto.Util.hashHex(t,r)},o=bt(t),u=o.length,c=this.n.bitLength()-1,h=Math.ceil(c/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=h-u-2;else if(n<-2)throw new Error("invalid salt length");if(h<u+n+2)throw new Error("data too long");var l=this.doPublic(s).toByteArray();for(i=0;i<l.length;i+=1)l[i]&=255;for(;l.length<h;)l.unshift(0);if(188!==l[h-1])throw new Error("encoded message does not end in 0xbc");var f=(l=String.fromCharCode.apply(String,l)).substr(0,h-u-1),p=l.substr(f.length,u),g=65280>>8*h-c&255;if(0!==(f.charCodeAt(0)&g))throw new Error("bits beyond keysize not zero");var d=Xt(p,f.length,a),v=[];for(i=0;i<f.length;i+=1)v[i]=f.charCodeAt(i)^d.charCodeAt(i);v[0]&=~g;var m=h-u-n-2;for(i=0;i<m;i+=1)if(0!==v[i])throw new Error("leftmost octets not zero");if(1!==v[m])throw new Error("0x01 marker not found");return p===bt(a(Ft("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,v.slice(-n)))))},st.SALT_LEN_HLEN=-1,st.SALT_LEN_MAX=-2,st.SALT_LEN_RECOVER=-2,Qt.EXT_PARSER={},Qt.registExtParser=function(t,e){Qt.EXT_PARSER[t]=e},Qt.hex2dn=function(t,e){void 0===e&&(e=0);var r=new Qt;return pt.getTLV(t,e),r.getX500Name(t).str},Qt.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw new Error("malformed RDN");for(var r=new Array,n=pt.getChildIdx(t,e),i=0;i<n.length;i++)r.push(Qt.hex2attrTypeValue(t,n[i]));return r=r.map(function(t){return t.replace("+","\\+")}),r.join("+")},Qt.hex2attrTypeValue=function(t,e){var r=pt,n=r.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw new Error("malformed attribute type and value");var i=r.getChildIdx(t,e);2!==i.length||t.substr(i[0],2);var s=n(t,i[0]),a=ht.asn1.ASN1Util.oidHexToInt(s);return ht.asn1.x509.OID.oid2atype(a)+"="+bt(n(t,i[1]))},Qt.getPublicKeyFromCertHex=function(t){var e=new Qt;return e.readCertHex(t),e.getPublicKey()},Qt.getPublicKeyFromCertPEM=function(t){var e=new Qt;return e.readCertPEM(t),e.getPublicKey()},Qt.getPublicKeyInfoPropOfCertPEM=function(t){var e,r,n=pt.getVbyList,i={};return i.algparam=null,(e=new Qt).readCertPEM(t),r=e.getPublicKeyHex(),i.keyhex=n(r,0,[1],"03").substr(2),i.algoid=n(r,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=n(r,0,[0,1],"06")),i},Qt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],void 0!==ht&&ht||(ht={}),void 0!==ht.jws&&ht.jws||(ht.jws={}),ht.jws.JWS=function(){var t=ht.jws.JWS.isSafeJSONString;this.parseJWS=function(e,r){if(void 0===this.parsedJWS||!r&&void 0===this.parsedJWS.sigvalH){var n=e.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==n)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=n[1],s=n[2],a=n[3],o=i+"."+s;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=s,this.parsedJWS.sigvalB64U=a,this.parsedJWS.si=o,!r){var u=xt(a),c=it(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var h=ft(i),l=ft(s);if(this.parsedJWS.headS=h,this.parsedJWS.payloadS=l,!t(h,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+h}}},ht.jws.JWS.sign=function(t,e,r,n,i){var s=ht,a=s.jws.JWS,o=a.readSafeJSONString,u=a.isSafeJSONString,c=s.crypto;c.ECDSA;var h,l,f,p=c.Mac,g=c.Signature,d=JSON;if("string"!=typeof e&&"object"!=typeof e)throw"spHeader must be JSON string or object: "+e;if("object"==typeof e&&(l=e,h=d.stringify(l)),"string"==typeof e){if(!u(h=e))throw"JWS Head is not safe JSON string: "+h;l=o(h)}if(f=r,"object"==typeof r&&(f=d.stringify(r)),""!=t&&null!=t||void 0===l.alg||(t=l.alg),""!=t&&null!=t&&void 0===l.alg&&(l.alg=t,h=d.stringify(l)),t!==l.alg)throw"alg and sHeader.alg doesn't match: "+t+"!="+l.alg;var v=null;if(void 0===a.jwsalg2sigalg[t])throw"unsupported alg name: "+t;v=a.jwsalg2sigalg[t];var m=lt(h)+"."+lt(f),y="";if("Hmac"==v.substr(0,4)){if(void 0===n)throw"mac key shall be specified for HS* alg";var x=new p({alg:v,prov:"cryptojs",pass:n});x.updateString(m),y=x.doFinal()}else if(-1!=v.indexOf("withECDSA")){(S=new g({alg:v})).init(n,i),S.updateString(m);var w=S.sign();y=ht.crypto.ECDSA.asn1SigToConcatSig(w)}else{var S;if("none"!=v)(S=new g({alg:v})).init(n,i),S.updateString(m),y=S.sign()}return m+"."+yt(y)},ht.jws.JWS.verify=function(t,e,r){var n,i=ht,s=i.jws.JWS,a=s.readSafeJSONString,o=i.crypto,u=o.ECDSA,c=o.Mac,h=o.Signature;if(n=st,!Lt(t))return!1;var l=t.split(".");if(3!==l.length)return!1;var f=l[0]+"."+l[1],p=xt(l[2]),g=a(ft(l[0])),d=null,v=null;if(void 0===g.alg)throw"algorithm not specified in header";if((v=(d=g.alg).substr(0,2),null!=r&&"[object Array]"===Object.prototype.toString.call(r)&&r.length>0)&&-1==(":"+r.join(":")+":").indexOf(":"+d+":"))throw"algorithm '"+d+"' not accepted in the list";if("none"!=d&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=Jt.getKey(e)),!("RS"!=v&&"PS"!=v||e instanceof n))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==v&&!(e instanceof u))throw"key shall be a ECDSA obj for ES* algs";var m=null;if(void 0===s.jwsalg2sigalg[g.alg])throw new Error("unsupported alg name: "+d);if(m=s.jwsalg2sigalg[d],void 0!==g.crit){if(!Array.isArray(g.crit)||0===g.crit.length)throw new Error("wrong critical header");for(var y=0;y<g.crit.length;y++){var x=g.crit[y];if("string"!=typeof x||0===x.length)throw new Error("wrong critical header");if(void 0===g[x])throw new Error("critical header '"+x+"' missing")}}if("none"==m)throw new Error("not supported");if("Hmac"==m.substr(0,4)){if(void 0===e)throw new Error("hexadecimal key shall be specified for HMAC");var w=new c({alg:m,pass:e});return w.updateString(f),Mt(p,w.doFinal())}if(-1!=m.indexOf("withECDSA")){var S,E=null;try{E=u.concatSigToASN1Sig(p)}catch(t){return!1}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(E)}return(S=new h({alg:m})).init(e),S.updateString(f),S.verify(p)},ht.jws.JWS.parse=function(t){var e,r,n,i=t.split("."),s={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=i[0],r=i[1],3==i.length&&(n=i[2]),s.headerObj=ht.jws.JWS.readSafeJSONString(ft(e)),s.payloadObj=ht.jws.JWS.readSafeJSONString(ft(r)),s.headerPP=JSON.stringify(s.headerObj,null," "),null==s.payloadObj?s.payloadPP=ft(r):s.payloadPP=JSON.stringify(s.payloadObj,null," "),void 0!==n&&(s.sigHex=xt(n)),s},ht.jws.JWS.verifyJWT=function(t,e,r){var n=ht.jws,i=n.JWS,s=i.readSafeJSONString,a=i.inArray,o=i.includedArray;if(!Lt(t))return!1;var u=t.split(".");if(3!=u.length)return!1;var c=u[0],h=u[1];xt(u[2]);var l=s(ft(c)),f=s(ft(h));if(void 0===l.alg)return!1;if(void 0===r.alg)throw"acceptField.alg shall be specified";if(!a(l.alg,r.alg))return!1;if(void 0!==f.iss&&"object"==typeof r.iss&&!a(f.iss,r.iss))return!1;if(void 0!==f.sub&&"object"==typeof r.sub&&!a(f.sub,r.sub))return!1;if(void 0!==f.aud&&"object"==typeof r.aud)if("string"==typeof f.aud){if(!a(f.aud,r.aud))return!1}else if("object"==typeof f.aud&&!o(f.aud,r.aud))return!1;var p=n.IntDate.getNow();return void 0!==r.verifyAt&&"number"==typeof r.verifyAt&&(p=r.verifyAt),void 0!==r.gracePeriod&&"number"==typeof r.gracePeriod||(r.gracePeriod=0),!(void 0!==f.exp&&"number"==typeof f.exp&&f.exp+r.gracePeriod<p)&&(!(void 0!==f.nbf&&"number"==typeof f.nbf&&p<f.nbf-r.gracePeriod)&&(!(void 0!==f.iat&&"number"==typeof f.iat&&p<f.iat-r.gracePeriod)&&((void 0===f.jti||void 0===r.jti||f.jti===r.jti)&&!!i.verify(t,e,r.alg))))},ht.jws.JWS.includedArray=function(t,e){var r=ht.jws.JWS.inArray;if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var n=0;n<t.length;n++)if(!r(t[n],e))return!1;return!0},ht.jws.JWS.inArray=function(t,e){if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(e[r]==t)return!0;return!1},ht.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",ES512:"SHA512withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},ht.jws.JWS.isSafeJSONString=function(t,e,r){var n=null;try{return"object"!=typeof(n=ct(t))||n.constructor===Array?0:(e&&(e[r]=n),1)}catch(t){return 0}},ht.jws.JWS.readSafeJSONString=function(t){var e=null;try{return"object"!=typeof(e=ct(t))||e.constructor===Array?null:e}catch(t){return null}},ht.jws.JWS.getEncodedSignatureValueFromJWS=function(t){var e=t.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==e)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return e[1]},ht.jws.JWS.getJWKthumbprint=function(t){if("RSA"!==t.kty&&"EC"!==t.kty&&"oct"!==t.kty)throw new Error("unsupported algorithm for JWK Thumprint");var e="{";if("RSA"===t.kty){if("string"!=typeof t.n||"string"!=typeof t.e)throw new Error("wrong n and e value for RSA key");e+='"e":"'+t.e+'",',e+='"kty":"'+t.kty+'",',e+='"n":"'+t.n+'"}'}else if("EC"===t.kty){if("string"!=typeof t.crv||"string"!=typeof t.x||"string"!=typeof t.y)throw new Error("wrong crv, x and y value for EC key");e+='"crv":"'+t.crv+'",',e+='"kty":"'+t.kty+'",',e+='"x":"'+t.x+'",',e+='"y":"'+t.y+'"}'}else if("oct"===t.kty){if("string"!=typeof t.k)throw new Error("wrong k value for oct(symmetric) key");e+='"k":"'+t.k+'",',e+='"kty":"'+t.kty+'"}'}var r=Ft(e);return yt(ht.crypto.Util.hashHex(r,"sha256"))},ht.jws.IntDate={},ht.jws.IntDate.get=function(t){var e=ht.jws.IntDate,r=e.getNow,n=e.getZulu;if("now"==t)return r();if("now + 1hour"==t)return r()+3600;if("now + 1day"==t)return r()+86400;if("now + 1month"==t)return r()+2592e3;if("now + 1year"==t)return r()+31536e3;if(t.match(/Z$/))return n(t);if(t.match(/^[0-9]+$/))return parseInt(t);throw"unsupported format: "+t},ht.jws.IntDate.getZulu=function(t){return Dt(t)},ht.jws.IntDate.getNow=function(){return~~(new Date/1e3)},ht.jws.IntDate.intDate2UTCString=function(t){return new Date(1e3*t).toUTCString()},ht.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t);return("0000"+e.getUTCFullYear()).slice(-4)+("00"+(e.getUTCMonth()+1)).slice(-2)+("00"+e.getUTCDate()).slice(-2)+("00"+e.getUTCHours()).slice(-2)+("00"+e.getUTCMinutes()).slice(-2)+("00"+e.getUTCSeconds()).slice(-2)+"Z"},void 0!==ht&&ht||(ht={}),void 0!==ht.jws&&ht.jws||(ht.jws={}),ht.jws.JWSJS=function(){var t=ht.jws.JWS,e=t.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(t){this.init();var e=t.split(".");if(3!=e.length)throw"malformed input JWS";this.aHeader.push(e[0]),this.sPayload=e[1],this.aSignature.push(e[2])},this.addSignature=function(t,e,r,n){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var i=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var s=ht.jws.JWS.sign(t,e,this.sPayload,r,n).split(".");s[0],s[2];this.aHeader.push(s[0]),this.aSignature.push(s[2])}catch(t){throw this.aHeader.length>i&&this.aHeader.pop(),this.aSignature.length>i&&this.aSignature.pop(),"addSignature failed: "+t}},this.verifyAll=function(t){if(this.aHeader.length!==t.length||this.aSignature.length!==t.length)return!1;for(var e=0;e<t.length;e++){var r=t[e];if(2!==r.length)return!1;if(!1===this.verifyNth(e,r[0],r[1]))return!1}return!0},this.verifyNth=function(e,r,n){if(this.aHeader.length<=e||this.aSignature.length<=e)return!1;var i=this.aHeader[e],s=this.aSignature[e],a=i+"."+this.sPayload+"."+s,o=!1;try{o=t.verify(a,r,n)}catch(t){return!1}return o},this.readJWSJS=function(t){if("string"==typeof t){var r=e(t);if(null==r)throw"argument is not safe JSON object string";this.aHeader=r.headers,this.sPayload=r.payload,this.aSignature=r.signatures}else try{if(!(t.headers.length>0))throw"malformed header";if(this.aHeader=t.headers,"string"!=typeof t.payload)throw"malformed signatures";if(this.sPayload=t.payload,!(t.signatures.length>0))throw"malformed signatures";this.aSignature=t.signatures}catch(t){throw"malformed JWS-JS JSON object: "+t}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},ht.crypto.ECDSA,ht.crypto.DSA,ht.crypto.Signature,ht.crypto.MessageDigest,ht.crypto.Mac;var te=ht;ht.crypto,ht.asn1,ht.jws,ht.lang;const ee=(t,e=!1)=>t.map(t=>{const r={title:t.name};return t.url&&(r.path=t.url),t.icon&&(r.svgName=t.icon),t.type&&(r.type=t.type),t.code&&(r.code=t.code),e?t.children&&t.children.length>0&&0===t.type&&(r.children=ee(t.children)):t.children&&t.children.length>0&&(r.children=ee(t.children)),r});const re={install(t,e={}){const{getPermissions:r,directiveName:n="permission"}=e;if("function"!=typeof r)return void console.error("[PermissionPlugin]: getPermissions 必须是一个返回数组的函数");const i=t=>{const e=r()||[];if(!t)return!0;return(Array.isArray(t)?t:[t]).some(t=>e.includes(t))};t.config.globalProperties.$hasPermission=i,t.provide("hasPermission",i),t.directive(n,{mounted(t,e){const{value:r}=e;if(!r)return void console.warn(`[PermissionPlugin]: 需要指定权限标识,例如 v-${n}="'USER_ADD'"`);const s=()=>{!i(r)&&t.parentNode&&t.parentNode.removeChild(t)};s(),t._permission_check=s},updated(t,e){t._permission_check&&t._permission_check()}})}};const ne=t=>t<10?`0${t}`:t,ie=(t,e)=>{if(!e)return[...t];const r=[];return t.forEach(t=>{const n=((t,e)=>["code","name","openingBalance","debitTotal","creditTotal","yearTotal"].some(r=>String(t[r]||"").toLowerCase().includes(e)))(t,e),i=t.children?ie(t.children,e):[];if(n||i.length>0){const e={...t};t.children&&(e.children=i),r.push(e)}}),r},se=(t,e,r="children")=>{for(const n of t){if(n[r]&&n[r].includes(e))return n;if(n[r]){const t=se(n[r],e,r);if(t)return t}}return null},ae=t=>{t.forEach(t=>{t.auxInitialList&&t.auxInitialList.length>0&&(t.children||(t.children=[]),t.auxInitialList.forEach(e=>{const r={...e};r.code_0=r.code,r.code=r.subjectAuxCode,r.name=r.subjectAuxName,t.children.push(r)})),t.children&&t.children.length>0&&ae(t.children)})},oe=t=>{if(null==t||""===String(t).trim())return 0;const e=Number(String(t).replace(/,/g,""));return isNaN(e)?0:e},ue=t=>{t&&Array.isArray(t)&&t.forEach(t=>{t.auxInitialList&&t.auxInitialList.length>0&&(t.children||(t.children=[]),t.auxInitialList.forEach(e=>{const r={...e};r.code_0=r.code,r.code=r.subjectAuxCode,r.name=r.subjectAuxName,r.code||(r.code=r.code_0),t.children.push(r)})),t.children&&t.children.length>0&&ue(t.children)})},ce=t=>t&&Array.isArray(t)?t.filter(t=>!t.code_0).map(t=>{const e={...t},r=e.children||[],n=r.filter(t=>!t.code_0),i=r.filter(t=>t.code_0);return i.length>0?e.auxInitialItemList=i.map(t=>{const e={...t};return e.code=e.code_0,e.auxInstanceCode=e.subjectAuxCode,e.openingBalance=oe(e.openingBalance),e.debitTotal=oe(e.debitTotal),e.creditTotal=oe(e.creditTotal),e.yearTotal=oe(e.yearTotal),e.originalOpeningBalance=oe(e.originalOpeningBalance),e.originalDebitTotal=oe(e.originalDebitTotal),e.originalCreditTotal=oe(e.originalCreditTotal),e.originalYearTotal=oe(e.originalYearTotal),e.openingQuantity=oe(e.openingQuantity),e.debitQuantity=oe(e.debitQuantity),e.creditQuantity=oe(e.creditQuantity),e.yearQuantity=oe(e.yearQuantity),delete e.code_0,e}):e.auxInitialItemList=[],e.openingBalance=oe(e.openingBalance),e.debitTotal=oe(e.debitTotal),e.creditTotal=oe(e.creditTotal),e.yearTotal=oe(e.yearTotal),e.originalOpeningBalance=oe(e.originalOpeningBalance),e.originalDebitTotal=oe(e.originalDebitTotal),e.originalCreditTotal=oe(e.originalCreditTotal),e.originalYearTotal=oe(e.originalYearTotal),e.openingQuantity=oe(e.openingQuantity),e.debitQuantity=oe(e.debitQuantity),e.creditQuantity=oe(e.creditQuantity),e.yearQuantity=oe(e.yearQuantity),n.length>0?e.children=ce(n):e.children=[],delete e.auxInitialList,e}):[],he=(t,e)=>{if(!Array.isArray(t))return!1;for(const r of t){if(e(r))return!0;if(r.children?.length&&he(r.children,e))return!0}return!1};const le=[".el-input","input","textarea","button","a",'[contenteditable="true"]'];const fe=t=>{if(null==t)return!1;const e=String(t).trim().replace(/,/g,"");if(!e)return!1;const r=Number(e);return Number.isFinite(r)&&0!==r},pe=(t,e)=>Array.isArray(t)?t.reduce((t,r)=>{const n=pe(r.children,e);if(e.some(t=>fe(r[t]))||n.length>0){const e={...r};Array.isArray(r.children)&&(e.children=n),t.push(e)}return t},[]):[];
27
27
  /*!
28
28
  * decimal.js v10.6.0
29
29
  * An arbitrary-precision Decimal type for JavaScript.
@@ -31,14 +31,5 @@ var ut=function(){var t=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?
31
31
  * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
32
32
  * MIT Licence
33
33
  */
34
- var pe,ge,de=9e15,ve=1e9,me="0123456789abcdef",ye="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",xe="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",we={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-de,maxE:de,crypto:!1},Se=!0,Ee="[DecimalError] ",be=Ee+"Invalid argument: ",Fe=Ee+"Precision limit exceeded",Ae=Ee+"crypto unavailable",Ce="[object Decimal]",De=Math.floor,Pe=Math.pow,Ie=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Te=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Re=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Ne=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,_e=1e7,Oe=ye.length-1,Be=xe.length-1,je={toStringTag:Ce};function He(t){var e,r,n,i=t.length-1,s="",o=t[0];if(i>0){for(s+=o,e=1;e<i;e++)(r=7-(n=t[e]+"").length)&&(s+=$e(r)),s+=n;(r=7-(n=(o=t[e])+"").length)&&(s+=$e(r))}else if(0===o)return"0";for(;o%10==0;)o/=10;return s+o}function ke(t,e,r){if(t!==~~t||t<e||t>r)throw Error(be+t)}function Le(t,e,r,n){var i,s,o,a;for(s=t[0];s>=10;s/=10)--e;return--e<0?(e+=7,i=0):(i=Math.ceil((e+1)/7),e%=7),s=Pe(10,7-e),a=t[i]%s|0,null==n?e<3?(0==e?a=a/100|0:1==e&&(a=a/10|0),o=r<4&&99999==a||r>3&&49999==a||5e4==a||0==a):o=(r<4&&a+1==s||r>3&&a+1==s/2)&&(t[i+1]/s/100|0)==Pe(10,e-2)-1||(a==s/2||0==a)&&!(t[i+1]/s/100|0):e<4?(0==e?a=a/1e3|0:1==e?a=a/100|0:2==e&&(a=a/10|0),o=(n||r<4)&&9999==a||!n&&r>3&&4999==a):o=((n||r<4)&&a+1==s||!n&&r>3&&a+1==s/2)&&(t[i+1]/s/1e3|0)==Pe(10,e-3)-1,o}function Ve(t,e,r){for(var n,i,s=[0],o=0,a=t.length;o<a;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=me.indexOf(t.charAt(o++)),n=0;n<s.length;n++)s[n]>r-1&&(void 0===s[n+1]&&(s[n+1]=0),s[n+1]+=s[n]/r|0,s[n]%=r)}return s.reverse()}je.absoluteValue=je.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),qe(t)},je.ceil=function(){return qe(new this.constructor(this),this.e+1,2)},je.clampedTo=je.clamp=function(t,e){var r=this,n=r.constructor;if(t=new n(t),e=new n(e),!t.s||!e.s)return new n(NaN);if(t.gt(e))throw Error(be+e);return r.cmp(t)<0?t:r.cmp(e)>0?e:new n(r)},je.comparedTo=je.cmp=function(t){var e,r,n,i,s=this,o=s.d,a=(t=new s.constructor(t)).d,u=s.s,c=t.s;if(!o||!a)return u&&c?u!==c?u:o===a?0:!o^u<0?1:-1:NaN;if(!o[0]||!a[0])return o[0]?u:a[0]?-c:0;if(u!==c)return u;if(s.e!==t.e)return s.e>t.e^u<0?1:-1;for(e=0,r=(n=o.length)<(i=a.length)?n:i;e<r;++e)if(o[e]!==a[e])return o[e]>a[e]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1},je.cosine=je.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(t,e){var r,n,i;if(e.isZero())return e;n=e.d.length,n<32?i=(1/ir(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10");t.precision+=r,e=nr(t,1,e.times(i),new t(1));for(var s=r;s--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return t.precision-=r,e}(n,sr(n,r)),n.precision=t,n.rounding=e,qe(2==ge||3==ge?r.neg():r,t,e,!0)):new n(1):new n(NaN)},je.cubeRoot=je.cbrt=function(){var t,e,r,n,i,s,o,a,u,c,h=this,l=h.constructor;if(!h.isFinite()||h.isZero())return new l(h);for(Se=!1,(s=h.s*Pe(h.s*h,1/3))&&Math.abs(s)!=1/0?n=new l(s.toString()):(r=He(h.d),(s=((t=h.e)-r.length+1)%3)&&(r+=1==s||-2==s?"0":"00"),s=Pe(r,1/3),t=De((t+1)/3)-(t%3==(t<0?-1:2)),(n=new l(r=s==1/0?"5e"+t:(r=s.toExponential()).slice(0,r.indexOf("e")+1)+t)).s=h.s),o=(t=l.precision)+3;;)if(c=(u=(a=n).times(a).times(a)).plus(h),n=Me(c.plus(h).times(a),c.plus(u),o+2,1),He(a.d).slice(0,o)===(r=He(n.d)).slice(0,o)){if("9999"!=(r=r.slice(o-3,o+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(qe(n,t+1,1),e=!n.times(n).times(n).eq(h));break}if(!i&&(qe(a,t+1,0),a.times(a).times(a).eq(h))){n=a;break}o+=4,i=1}return Se=!0,qe(n,t,l.rounding,e)},je.decimalPlaces=je.dp=function(){var t,e=this.d,r=NaN;if(e){if(r=7*((t=e.length-1)-De(this.e/7)),t=e[t])for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r},je.dividedBy=je.div=function(t){return Me(this,new this.constructor(t))},je.dividedToIntegerBy=je.divToInt=function(t){var e=this.constructor;return qe(Me(this,new e(t),0,1,1),e.precision,e.rounding)},je.equals=je.eq=function(t){return 0===this.cmp(t)},je.floor=function(){return qe(new this.constructor(this),this.e+1,3)},je.greaterThan=je.gt=function(t){return this.cmp(t)>0},je.greaterThanOrEqualTo=je.gte=function(t){var e=this.cmp(t);return 1==e||0===e},je.hyperbolicCosine=je.cosh=function(){var t,e,r,n,i,s=this,o=s.constructor,a=new o(1);if(!s.isFinite())return new o(s.s?1/0:NaN);if(s.isZero())return a;r=o.precision,n=o.rounding,o.precision=r+Math.max(s.e,s.sd())+4,o.rounding=1,(i=s.d.length)<32?e=(1/ir(4,t=Math.ceil(i/3))).toString():(t=16,e="2.3283064365386962890625e-10"),s=nr(o,1,s.times(e),new o(1),!0);for(var u,c=t,h=new o(8);c--;)u=s.times(s),s=a.minus(u.times(h.minus(u.times(h))));return qe(s,o.precision=r,o.rounding=n,!0)},je.hyperbolicSine=je.sinh=function(){var t,e,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(e=s.precision,r=s.rounding,s.precision=e+Math.max(i.e,i.sd())+4,s.rounding=1,(n=i.d.length)<3)i=nr(s,2,i,i,!0);else{t=(t=1.4*Math.sqrt(n))>16?16:0|t,i=nr(s,2,i=i.times(1/ir(5,t)),i,!0);for(var o,a=new s(5),u=new s(16),c=new s(20);t--;)o=i.times(i),i=i.times(a.plus(o.times(u.times(o).plus(c))))}return s.precision=e,s.rounding=r,qe(i,e,r,!0)},je.hyperbolicTangent=je.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,Me(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)},je.inverseCosine=je.acos=function(){var t=this,e=t.constructor,r=t.abs().cmp(1),n=e.precision,i=e.rounding;return-1!==r?0===r?t.isNeg()?We(e,n,i):new e(0):new e(NaN):t.isZero()?We(e,n+4,i).times(.5):(e.precision=n+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=n,e.rounding=i,t.times(2))},je.inverseHyperbolicCosine=je.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,Se=!1,r=r.times(r).minus(1).sqrt().plus(r),Se=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)},je.inverseHyperbolicSine=je.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,Se=!1,r=r.times(r).plus(1).sqrt().plus(r),Se=!0,n.precision=t,n.rounding=e,r.ln())},je.inverseHyperbolicTangent=je.atanh=function(){var t,e,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=s.precision,e=s.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?qe(new s(i),t,e,!0):(s.precision=r=n-i.e,i=Me(i.plus(1),new s(1).minus(i),r+t,1),s.precision=t+4,s.rounding=1,i=i.ln(),s.precision=t,s.rounding=e,i.times(.5))):new s(NaN)},je.inverseSine=je.asin=function(){var t,e,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(e=i.abs().cmp(1),r=s.precision,n=s.rounding,-1!==e?0===e?((t=We(s,r+4,n).times(.5)).s=i.s,t):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))},je.inverseTangent=je.atan=function(){var t,e,r,n,i,s,o,a,u,c=this,h=c.constructor,l=h.precision,f=h.rounding;if(c.isFinite()){if(c.isZero())return new h(c);if(c.abs().eq(1)&&l+4<=Be)return(o=We(h,l+4,f).times(.25)).s=c.s,o}else{if(!c.s)return new h(NaN);if(l+4<=Be)return(o=We(h,l+4,f).times(.5)).s=c.s,o}for(h.precision=a=l+10,h.rounding=1,t=r=Math.min(28,a/7+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Se=!1,e=Math.ceil(a/7),n=1,u=c.times(c),o=new h(c),i=c;-1!==t;)if(i=i.times(u),s=o.minus(i.div(n+=2)),i=i.times(u),void 0!==(o=s.plus(i.div(n+=2))).d[e])for(t=e;o.d[t]===s.d[t]&&t--;);return r&&(o=o.times(2<<r-1)),Se=!0,qe(o,h.precision=l,h.rounding=f,!0)},je.isFinite=function(){return!!this.d},je.isInteger=je.isInt=function(){return!!this.d&&De(this.e/7)>this.d.length-2},je.isNaN=function(){return!this.s},je.isNegative=je.isNeg=function(){return this.s<0},je.isPositive=je.isPos=function(){return this.s>0},je.isZero=function(){return!!this.d&&0===this.d[0]},je.lessThan=je.lt=function(t){return this.cmp(t)<0},je.lessThanOrEqualTo=je.lte=function(t){return this.cmp(t)<1},je.logarithm=je.log=function(t){var e,r,n,i,s,o,a,u,c=this,h=c.constructor,l=h.precision,f=h.rounding;if(null==t)t=new h(10),e=!0;else{if(r=(t=new h(t)).d,t.s<0||!r||!r[0]||t.eq(1))return new h(NaN);e=t.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new h(r&&!r[0]?-1/0:1!=c.s?NaN:r?0:1/0);if(e)if(r.length>1)s=!0;else{for(i=r[0];i%10==0;)i/=10;s=1!==i}if(Se=!1,o=Qe(c,a=l+5),n=e?ze(h,a+10):Qe(t,a),Le((u=Me(o,n,a,1)).d,i=l,f))do{if(o=Qe(c,a+=10),n=e?ze(h,a+10):Qe(t,a),u=Me(o,n,a,1),!s){+He(u.d).slice(i+1,i+15)+1==1e14&&(u=qe(u,l+1,0));break}}while(Le(u.d,i+=10,f));return Se=!0,qe(u,l,f)},je.minus=je.sub=function(t){var e,r,n,i,s,o,a,u,c,h,l,f,p=this,g=p.constructor;if(t=new g(t),!p.d||!t.d)return p.s&&t.s?p.d?t.s=-t.s:t=new g(t.d||p.s!==t.s?p:NaN):t=new g(NaN),t;if(p.s!=t.s)return t.s=-t.s,p.plus(t);if(c=p.d,f=t.d,a=g.precision,u=g.rounding,!c[0]||!f[0]){if(f[0])t.s=-t.s;else{if(!c[0])return new g(3===u?-0:0);t=new g(p)}return Se?qe(t,a,u):t}if(r=De(t.e/7),h=De(p.e/7),c=c.slice(),s=h-r){for((l=s<0)?(e=c,s=-s,o=f.length):(e=f,r=h,o=c.length),s>(n=Math.max(Math.ceil(a/7),o)+2)&&(s=n,e.length=1),e.reverse(),n=s;n--;)e.push(0);e.reverse()}else{for((l=(n=c.length)<(o=f.length))&&(o=n),n=0;n<o;n++)if(c[n]!=f[n]){l=c[n]<f[n];break}s=0}for(l&&(e=c,c=f,f=e,t.s=-t.s),o=c.length,n=f.length-o;n>0;--n)c[o++]=0;for(n=f.length;n>s;){if(c[--n]<f[n]){for(i=n;i&&0===c[--i];)c[i]=_e-1;--c[i],c[n]+=_e}c[n]-=f[n]}for(;0===c[--o];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(t.d=c,t.e=Ue(c,r),Se?qe(t,a,u):t):new g(3===u?-0:0)},je.modulo=je.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?qe(new n(r),n.precision,n.rounding):(Se=!1,9==n.modulo?(e=Me(r,t.abs(),0,3,1)).s*=t.s:e=Me(r,t,0,n.modulo,1),e=e.times(t),Se=!0,r.minus(e))},je.naturalExponential=je.exp=function(){return Ze(this)},je.naturalLogarithm=je.ln=function(){return Qe(this)},je.negated=je.neg=function(){var t=new this.constructor(this);return t.s=-t.s,qe(t)},je.plus=je.add=function(t){var e,r,n,i,s,o,a,u,c,h,l=this,f=l.constructor;if(t=new f(t),!l.d||!t.d)return l.s&&t.s?l.d||(t=new f(t.d||l.s===t.s?l:NaN)):t=new f(NaN),t;if(l.s!=t.s)return t.s=-t.s,l.minus(t);if(c=l.d,h=t.d,a=f.precision,u=f.rounding,!c[0]||!h[0])return h[0]||(t=new f(l)),Se?qe(t,a,u):t;if(s=De(l.e/7),n=De(t.e/7),c=c.slice(),i=s-n){for(i<0?(r=c,i=-i,o=h.length):(r=h,n=s,o=c.length),i>(o=(s=Math.ceil(a/7))>o?s+1:o+1)&&(i=o,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((o=c.length)-(i=h.length)<0&&(i=o,r=h,h=c,c=r),e=0;i;)e=(c[--i]=c[i]+h[i]+e)/_e|0,c[i]%=_e;for(e&&(c.unshift(e),++n),o=c.length;0==c[--o];)c.pop();return t.d=c,t.e=Ue(c,n),Se?qe(t,a,u):t},je.precision=je.sd=function(t){var e,r=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(be+t);return r.d?(e=Ge(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e},je.round=function(){var t=this,e=t.constructor;return qe(new e(t),t.e+1,e.rounding)},je.sine=je.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:nr(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:0|r,e=e.times(1/ir(5,r)),e=nr(t,2,e,e);for(var i,s=new t(5),o=new t(16),a=new t(20);r--;)i=e.times(e),e=e.times(s.plus(i.times(o.times(i).minus(a))));return e}(n,sr(n,r)),n.precision=t,n.rounding=e,qe(ge>2?r.neg():r,t,e,!0)):new n(NaN)},je.squareRoot=je.sqrt=function(){var t,e,r,n,i,s,o=this,a=o.d,u=o.e,c=o.s,h=o.constructor;if(1!==c||!a||!a[0])return new h(!c||c<0&&(!a||a[0])?NaN:a?o:1/0);for(Se=!1,0==(c=Math.sqrt(+o))||c==1/0?(((e=He(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=De((u+1)/2)-(u<0||u%2),n=new h(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):n=new h(c.toString()),r=(u=h.precision)+3;;)if(n=(s=n).plus(Me(o,s,r+2,1)).times(.5),He(s.d).slice(0,r)===(e=He(n.d)).slice(0,r)){if("9999"!=(e=e.slice(r-3,r+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(qe(n,u+1,1),t=!n.times(n).eq(o));break}if(!i&&(qe(s,u+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}return Se=!0,qe(n,u,h.rounding,t)},je.tangent=je.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,(r=r.sin()).s=1,r=Me(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,qe(2==ge||4==ge?r.neg():r,t,e,!0)):new n(NaN)},je.times=je.mul=function(t){var e,r,n,i,s,o,a,u,c,h=this,l=h.constructor,f=h.d,p=(t=new l(t)).d;if(t.s*=h.s,!(f&&f[0]&&p&&p[0]))return new l(!t.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:f&&p?0*t.s:t.s/0);for(r=De(h.e/7)+De(t.e/7),(u=f.length)<(c=p.length)&&(s=f,f=p,p=s,o=u,u=c,c=o),s=[],n=o=u+c;n--;)s.push(0);for(n=c;--n>=0;){for(e=0,i=u+n;i>n;)a=s[i]+p[n]*f[i-n-1]+e,s[i--]=a%_e|0,e=a/_e|0;s[i]=(s[i]+e)%_e|0}for(;!s[--o];)s.pop();return e?++r:s.shift(),t.d=s,t.e=Ue(s,r),Se?qe(t,l.precision,l.rounding):t},je.toBinary=function(t,e){return or(this,2,t,e)},je.toDecimalPlaces=je.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),void 0===t?r:(ke(t,0,ve),void 0===e?e=n.rounding:ke(e,0,8),qe(r,t+r.e+1,e))},je.toExponential=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=Ke(n,!0):(ke(t,0,ve),void 0===e?e=i.rounding:ke(e,0,8),r=Ke(n=qe(new i(n),t+1,e),!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r},je.toFixed=function(t,e){var r,n,i=this,s=i.constructor;return void 0===t?r=Ke(i):(ke(t,0,ve),void 0===e?e=s.rounding:ke(e,0,8),r=Ke(n=qe(new s(i),t+i.e+1,e),!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},je.toFraction=function(t){var e,r,n,i,s,o,a,u,c,h,l,f,p=this,g=p.d,d=p.constructor;if(!g)return new d(p);if(c=r=new d(1),n=u=new d(0),o=(s=(e=new d(n)).e=Ge(g)-p.e-1)%7,e.d[0]=Pe(10,o<0?7+o:o),null==t)t=s>0?e:c;else{if(!(a=new d(t)).isInt()||a.lt(c))throw Error(be+a);t=a.gt(e)?s>0?e:c:a}for(Se=!1,a=new d(He(g)),h=d.precision,d.precision=s=7*g.length*2;l=Me(a,e,0,1,1),1!=(i=r.plus(l.times(n))).cmp(t);)r=n,n=i,i=c,c=u.plus(l.times(i)),u=i,i=e,e=a.minus(l.times(i)),a=i;return i=Me(t.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=p.s,f=Me(c,n,s,1).minus(p).abs().cmp(Me(u,r,s,1).minus(p).abs())<1?[c,n]:[u,r],d.precision=h,Se=!0,f},je.toHexadecimal=je.toHex=function(t,e){return or(this,16,t,e)},je.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),null==t){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),void 0===e?e=n.rounding:ke(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(Se=!1,r=Me(r,t,0,e,1).times(t),Se=!0,qe(r)):(t.s=r.s,r=t),r},je.toNumber=function(){return+this},je.toOctal=function(t,e){return or(this,8,t,e)},je.toPower=je.pow=function(t){var e,r,n,i,s,o,a=this,u=a.constructor,c=+(t=new u(t));if(!(a.d&&t.d&&a.d[0]&&t.d[0]))return new u(Pe(+a,c));if((a=new u(a)).eq(1))return a;if(n=u.precision,s=u.rounding,t.eq(1))return qe(a,n,s);if((e=De(t.e/7))>=t.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=Je(u,a,r,n),t.s<0?new u(1).div(i):qe(i,n,s);if((o=a.s)<0){if(e<t.d.length-1)return new u(NaN);if(1&t.d[e]||(o=1),0==a.e&&1==a.d[0]&&1==a.d.length)return a.s=o,a}return(e=0!=(r=Pe(+a,c))&&isFinite(r)?new u(r+"").e:De(c*(Math.log("0."+He(a.d))/Math.LN10+a.e+1)))>u.maxE+1||e<u.minE-1?new u(e>0?o/0:0):(Se=!1,u.rounding=a.s=1,r=Math.min(12,(e+"").length),(i=Ze(t.times(Qe(a,n+r)),n)).d&&Le((i=qe(i,n+5,1)).d,n,s)&&(e=n+10,+He((i=qe(Ze(t.times(Qe(a,e+r)),e),e+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=qe(i,n+1,0))),i.s=o,Se=!0,u.rounding=s,qe(i,n,s))},je.toPrecision=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=Ke(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(ke(t,1,ve),void 0===e?e=i.rounding:ke(e,0,8),r=Ke(n=qe(new i(n),t,e),t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r},je.toSignificantDigits=je.toSD=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(ke(t,1,ve),void 0===e?e=r.rounding:ke(e,0,8)),qe(new r(this),t,e)},je.toString=function(){var t=this,e=t.constructor,r=Ke(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r},je.truncated=je.trunc=function(){return qe(new this.constructor(this),this.e+1,1)},je.valueOf=je.toJSON=function(){var t=this,e=t.constructor,r=Ke(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};var Me=function(){function t(t,e,r){var n,i=0,s=t.length;for(t=t.slice();s--;)n=t[s]*e+i,t[s]=n%r|0,i=n/r|0;return i&&t.unshift(i),t}function e(t,e,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(t[i]!=e[i]){s=t[i]>e[i]?1:-1;break}return s}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;)t.shift()}return function(n,i,s,o,a,u){var c,h,l,f,p,g,d,v,m,y,x,w,S,E,b,F,A,C,D,P,I=n.constructor,T=n.s==i.s?1:-1,R=n.d,N=i.d;if(!(R&&R[0]&&N&&N[0]))return new I(n.s&&i.s&&(R?!N||R[0]!=N[0]:N)?R&&0==R[0]||!N?0*T:T/0:NaN);for(u?(p=1,h=n.e-i.e):(u=_e,p=7,h=De(n.e/p)-De(i.e/p)),D=N.length,A=R.length,y=(m=new I(T)).d=[],l=0;N[l]==(R[l]||0);l++);if(N[l]>(R[l]||0)&&h--,null==s?(E=s=I.precision,o=I.rounding):E=a?s+(n.e-i.e)+1:s,E<0)y.push(1),g=!0;else{if(E=E/p+2|0,l=0,1==D){for(f=0,N=N[0],E++;(l<A||f)&&E--;l++)b=f*u+(R[l]||0),y[l]=b/N|0,f=b%N|0;g=f||l<A}else{for((f=u/(N[0]+1)|0)>1&&(N=t(N,f,u),R=t(R,f,u),D=N.length,A=R.length),F=D,w=(x=R.slice(0,D)).length;w<D;)x[w++]=0;(P=N.slice()).unshift(0),C=N[0],N[1]>=u/2&&++C;do{f=0,(c=e(N,x,D,w))<0?(S=x[0],D!=w&&(S=S*u+(x[1]||0)),(f=S/C|0)>1?(f>=u&&(f=u-1),1==(c=e(d=t(N,f,u),x,v=d.length,w=x.length))&&(f--,r(d,D<v?P:N,v,u))):(0==f&&(c=f=1),d=N.slice()),(v=d.length)<w&&d.unshift(0),r(x,d,w,u),-1==c&&(c=e(N,x,D,w=x.length))<1&&(f++,r(x,D<w?P:N,w,u)),w=x.length):0===c&&(f++,x=[0]),y[l++]=f,c&&x[0]?x[w++]=R[F]||0:(x=[R[F]],w=1)}while((F++<A||void 0!==x[0])&&E--);g=void 0!==x[0]}y[0]||y.shift()}if(1==p)m.e=h,pe=g;else{for(l=1,f=y[0];f>=10;f/=10)l++;m.e=l+h*p-1,qe(m,a?s+m.e+1:s,o,g)}return m}}();function qe(t,e,r,n){var i,s,o,a,u,c,h,l,f,p=t.constructor;t:if(null!=e){if(!(l=t.d))return t;for(i=1,a=l[0];a>=10;a/=10)i++;if((s=e-i)<0)s+=7,o=e,u=(h=l[f=0])/Pe(10,i-o-1)%10|0;else if((f=Math.ceil((s+1)/7))>=(a=l.length)){if(!n)break t;for(;a++<=f;)l.push(0);h=u=0,i=1,o=(s%=7)-7+1}else{for(h=a=l[f],i=1;a>=10;a/=10)i++;u=(o=(s%=7)-7+i)<0?0:h/Pe(10,i-o-1)%10|0}if(n=n||e<0||void 0!==l[f+1]||(o<0?h:h%Pe(10,i-o-1)),c=r<4?(u||n)&&(0==r||r==(t.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(s>0?o>0?h/Pe(10,i-o):0:l[f-1])%10&1||r==(t.s<0?8:7)),e<1||!l[0])return l.length=0,c?(e-=t.e+1,l[0]=Pe(10,(7-e%7)%7),t.e=-e||0):l[0]=t.e=0,t;if(0==s?(l.length=f,a=1,f--):(l.length=f+1,a=Pe(10,7-s),l[f]=o>0?(h/Pe(10,i-o)%Pe(10,o)|0)*a:0),c)for(;;){if(0==f){for(s=1,o=l[0];o>=10;o/=10)s++;for(o=l[0]+=a,a=1;o>=10;o/=10)a++;s!=a&&(t.e++,l[0]==_e&&(l[0]=1));break}if(l[f]+=a,l[f]!=_e)break;l[f--]=0,a=1}for(s=l.length;0===l[--s];)l.pop()}return Se&&(t.e>p.maxE?(t.d=null,t.e=NaN):t.e<p.minE&&(t.e=0,t.d=[0])),t}function Ke(t,e,r){if(!t.isFinite())return tr(t);var n,i=t.e,s=He(t.d),o=s.length;return e?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+$e(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(t.e<0?"e":"e+")+t.e):i<0?(s="0."+$e(-i-1)+s,r&&(n=r-o)>0&&(s+=$e(n))):i>=o?(s+=$e(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+$e(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=$e(n))),s}function Ue(t,e){var r=t[0];for(e*=7;r>=10;r/=10)e++;return e}function ze(t,e,r){if(e>Oe)throw Se=!0,r&&(t.precision=r),Error(Fe);return qe(new t(ye),e,1,!0)}function We(t,e,r){if(e>Be)throw Error(Fe);return qe(new t(xe),e,r,!0)}function Ge(t){var e=t.length-1,r=7*e+1;if(e=t[e]){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function $e(t){for(var e="";t--;)e+="0";return e}function Je(t,e,r,n){var i,s=new t(1),o=Math.ceil(n/7+4);for(Se=!1;;){if(r%2&&ar((s=s.times(e)).d,o)&&(i=!0),0===(r=De(r/2))){r=s.d.length-1,i&&0===s.d[r]&&++s.d[r];break}ar((e=e.times(e)).d,o)}return Se=!0,s}function Ye(t){return 1&t.d[t.d.length-1]}function Xe(t,e,r){for(var n,i,s=new t(e[0]),o=0;++o<e.length;){if(!(i=new t(e[o])).s){s=i;break}((n=s.cmp(i))===r||0===n&&s.s===r)&&(s=i)}return s}function Ze(t,e){var r,n,i,s,o,a,u,c=0,h=0,l=0,f=t.constructor,p=f.rounding,g=f.precision;if(!t.d||!t.d[0]||t.e>17)return new f(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==e?(Se=!1,u=g):u=e,a=new f(.03125);t.e>-2;)t=t.times(a),l+=5;for(u+=n=Math.log(Pe(2,l))/Math.LN10*2+5|0,r=s=o=new f(1),f.precision=u;;){if(s=qe(s.times(t),u,1),r=r.times(++h),He((a=o.plus(Me(s,r,u,1))).d).slice(0,u)===He(o.d).slice(0,u)){for(i=l;i--;)o=qe(o.times(o),u,1);if(null!=e)return f.precision=g,o;if(!(c<3&&Le(o.d,u-n,p,c)))return qe(o,f.precision=g,p,Se=!0);f.precision=u+=10,r=s=a=new f(1),h=0,c++}o=a}}function Qe(t,e){var r,n,i,s,o,a,u,c,h,l,f,p=1,g=t,d=g.d,v=g.constructor,m=v.rounding,y=v.precision;if(g.s<0||!d||!d[0]||!g.e&&1==d[0]&&1==d.length)return new v(d&&!d[0]?-1/0:1!=g.s?NaN:d?0:g);if(null==e?(Se=!1,h=y):h=e,v.precision=h+=10,n=(r=He(d)).charAt(0),!(Math.abs(s=g.e)<15e14))return c=ze(v,h+2,y).times(s+""),g=Qe(new v(n+"."+r.slice(1)),h-10).plus(c),v.precision=y,null==e?qe(g,y,m,Se=!0):g;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=He((g=g.times(t)).d)).charAt(0),p++;for(s=g.e,n>1?(g=new v("0."+r),s++):g=new v(n+"."+r.slice(1)),l=g,u=o=g=Me(g.minus(1),g.plus(1),h,1),f=qe(g.times(g),h,1),i=3;;){if(o=qe(o.times(f),h,1),He((c=u.plus(Me(o,new v(i),h,1))).d).slice(0,h)===He(u.d).slice(0,h)){if(u=u.times(2),0!==s&&(u=u.plus(ze(v,h+2,y).times(s+""))),u=Me(u,new v(p),h,1),null!=e)return v.precision=y,u;if(!Le(u.d,h-10,m,a))return qe(u,v.precision=y,m,Se=!0);v.precision=h+=10,c=o=g=Me(l.minus(1),l.plus(1),h,1),f=qe(g.times(g),h,1),i=a=1}u=c,i+=2}}function tr(t){return String(t.s*t.s/0)}function er(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);n++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(n,i)){if(i-=n,t.e=r=r-n-1,t.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=7;n<i;)t.d.push(+e.slice(n,n+=7));n=7-(e=e.slice(n)).length}else n-=i;for(;n--;)e+="0";t.d.push(+e),Se&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function rr(t,e){var r,n,i,s,o,a,u,c,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Ne.test(e))return er(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Te.test(e))r=16,e=e.toLowerCase();else if(Ie.test(e))r=2;else{if(!Re.test(e))throw Error(be+e);r=8}for((s=e.search(/p/i))>0?(u=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),o=(s=e.indexOf("."))>=0,n=t.constructor,o&&(s=(a=(e=e.replace(".","")).length)-s,i=Je(n,new n(r),s,2*s)),s=h=(c=Ve(e,r,_e)).length-1;0===c[s];--s)c.pop();return s<0?new n(0*t.s):(t.e=Ue(c,h),t.d=c,Se=!1,o&&(t=Me(t,i,4*a)),u&&(t=t.times(Math.abs(u)<54?Pe(2,u):$r.pow(2,u))),Se=!0,t)}function nr(t,e,r,n,i){var s,o,a,u,c=t.precision,h=Math.ceil(c/7);for(Se=!1,u=r.times(r),a=new t(n);;){if(o=Me(a.times(u),new t(e++*e++),c,1),a=i?n.plus(o):n.minus(o),n=Me(o.times(u),new t(e++*e++),c,1),void 0!==(o=a.plus(n)).d[h]){for(s=h;o.d[s]===a.d[s]&&s--;);if(-1==s)break}s=a,a=n,n=o,o=s}return Se=!0,o.d.length=h+1,o}function ir(t,e){for(var r=t;--e;)r*=t;return r}function sr(t,e){var r,n=e.s<0,i=We(t,t.precision,1),s=i.times(.5);if((e=e.abs()).lte(s))return ge=n?4:1,e;if((r=e.divToInt(i)).isZero())ge=n?3:2;else{if((e=e.minus(r.times(i))).lte(s))return ge=Ye(r)?n?2:3:n?4:1,e;ge=Ye(r)?n?1:4:n?3:2}return e.minus(i).abs()}function or(t,e,r,n){var i,s,o,a,u,c,h,l,f,p=t.constructor,g=void 0!==r;if(g?(ke(r,1,ve),void 0===n?n=p.rounding:ke(n,0,8)):(r=p.precision,n=p.rounding),t.isFinite()){for(g?(i=2,16==e?r=4*r-3:8==e&&(r=3*r-2)):i=e,(o=(h=Ke(t)).indexOf("."))>=0&&(h=h.replace(".",""),(f=new p(1)).e=h.length-o,f.d=Ve(Ke(f),10,i),f.e=f.d.length),s=u=(l=Ve(h,10,i)).length;0==l[--u];)l.pop();if(l[0]){if(o<0?s--:((t=new p(t)).d=l,t.e=s,l=(t=Me(t,f,r,n,0,i)).d,s=t.e,c=pe),o=l[r],a=i/2,c=c||void 0!==l[r+1],c=n<4?(void 0!==o||c)&&(0===n||n===(t.s<0?3:2)):o>a||o===a&&(4===n||c||6===n&&1&l[r-1]||n===(t.s<0?8:7)),l.length=r,c)for(;++l[--r]>i-1;)l[r]=0,r||(++s,l.unshift(1));for(u=l.length;!l[u-1];--u);for(o=0,h="";o<u;o++)h+=me.charAt(l[o]);if(g){if(u>1)if(16==e||8==e){for(o=16==e?4:3,--u;u%o;u++)h+="0";for(u=(l=Ve(h,i,e)).length;!l[u-1];--u);for(o=1,h="1.";o<u;o++)h+=me.charAt(l[o])}else h=h.charAt(0)+"."+h.slice(1);h=h+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)h="0"+h;h="0."+h}else if(++s>u)for(s-=u;s--;)h+="0";else s<u&&(h=h.slice(0,s)+"."+h.slice(s))}else h=g?"0p+0":"0";h=(16==e?"0x":2==e?"0b":8==e?"0o":"")+h}else h=tr(t);return t.s<0?"-"+h:h}function ar(t,e){if(t.length>e)return t.length=e,!0}function ur(t){return new this(t).abs()}function cr(t){return new this(t).acos()}function hr(t){return new this(t).acosh()}function lr(t,e){return new this(t).plus(e)}function fr(t){return new this(t).asin()}function pr(t){return new this(t).asinh()}function gr(t){return new this(t).atan()}function dr(t){return new this(t).atanh()}function vr(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,s=n+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(r=e.s<0?We(this,n,i):new this(0)).s=t.s:!t.d||e.isZero()?(r=We(this,s,1).times(.5)).s=t.s:e.s<0?(this.precision=s,this.rounding=1,r=this.atan(Me(t,e,s,1)),e=We(this,s,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(Me(t,e,s,1)):(r=We(this,s,1).times(e.s>0?.25:.75)).s=t.s:r=new this(NaN),r}function mr(t){return new this(t).cbrt()}function yr(t){return qe(t=new this(t),t.e+1,2)}function xr(t,e,r){return new this(t).clamp(e,r)}function wr(t){if(!t||"object"!=typeof t)throw Error(Ee+"Object expected");var e,r,n,i=!0===t.defaults,s=["precision",1,ve,"rounding",0,8,"toExpNeg",-de,0,"toExpPos",0,de,"maxE",0,de,"minE",-de,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(r=s[e],i&&(this[r]=we[r]),void 0!==(n=t[r])){if(!(De(n)===n&&n>=s[e+1]&&n<=s[e+2]))throw Error(be+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=we[r]),void 0!==(n=t[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(be+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(Ae);this[r]=!0}else this[r]=!1}return this}function Sr(t){return new this(t).cos()}function Er(t){return new this(t).cosh()}function br(t,e){return new this(t).div(e)}function Fr(t){return new this(t).exp()}function Ar(t){return qe(t=new this(t),t.e+1,3)}function Cr(){var t,e,r=new this(0);for(Se=!1,t=0;t<arguments.length;)if((e=new this(arguments[t++])).d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return Se=!0,new this(1/0);r=e}return Se=!0,r.sqrt()}function Dr(t){return t instanceof $r||t&&t.toStringTag===Ce||!1}function Pr(t){return new this(t).ln()}function Ir(t,e){return new this(t).log(e)}function Tr(t){return new this(t).log(2)}function Rr(t){return new this(t).log(10)}function Nr(){return Xe(this,arguments,-1)}function _r(){return Xe(this,arguments,1)}function Or(t,e){return new this(t).mod(e)}function Br(t,e){return new this(t).mul(e)}function jr(t,e){return new this(t).pow(e)}function Hr(t){var e,r,n,i,s=0,o=new this(1),a=[];if(void 0===t?t=this.precision:ke(t,1,ve),n=Math.ceil(t/7),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));s<n;)(i=e[s])>=429e7?e[s]=crypto.getRandomValues(new Uint32Array(1))[0]:a[s++]=i%1e7;else{if(!crypto.randomBytes)throw Error(Ae);for(e=crypto.randomBytes(n*=4);s<n;)(i=e[s]+(e[s+1]<<8)+(e[s+2]<<16)+((127&e[s+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,s):(a.push(i%1e7),s+=4);s=n/4}else for(;s<n;)a[s++]=1e7*Math.random()|0;for(t%=7,(n=a[--s])&&t&&(i=Pe(10,7-t),a[s]=(n/i|0)*i);0===a[s];s--)a.pop();if(s<0)r=0,a=[0];else{for(r=-1;0===a[0];r-=7)a.shift();for(n=1,i=a[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return o.e=r,o.d=a,o}function kr(t){return qe(t=new this(t),t.e+1,this.rounding)}function Lr(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function Vr(t){return new this(t).sin()}function Mr(t){return new this(t).sinh()}function qr(t){return new this(t).sqrt()}function Kr(t,e){return new this(t).sub(e)}function Ur(){var t=0,e=arguments,r=new this(e[t]);for(Se=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return Se=!0,qe(r,this.precision,this.rounding)}function zr(t){return new this(t).tan()}function Wr(t){return new this(t).tanh()}function Gr(t){return qe(t=new this(t),t.e+1,1)}je[Symbol.for("nodejs.util.inspect.custom")]=je.toString,je[Symbol.toStringTag]="Decimal";var $r=je.constructor=function t(e){var r,n,i;function s(t){var e,r,n,i=this;if(!(i instanceof s))return new s(t);if(i.constructor=s,Dr(t))return i.s=t.s,void(Se?!t.d||t.e>s.maxE?(i.e=NaN,i.d=null):t.e<s.minE?(i.e=0,i.d=[0]):(i.e=t.e,i.d=t.d.slice()):(i.e=t.e,i.d=t.d?t.d.slice():t.d));if("number"===(n=typeof t)){if(0===t)return i.s=1/t<0?-1:1,i.e=0,void(i.d=[0]);if(t<0?(t=-t,i.s=-1):i.s=1,t===~~t&&t<1e7){for(e=0,r=t;r>=10;r/=10)e++;return void(Se?e>s.maxE?(i.e=NaN,i.d=null):e<s.minE?(i.e=0,i.d=[0]):(i.e=e,i.d=[t]):(i.e=e,i.d=[t]))}return 0*t!=0?(t||(i.s=NaN),i.e=NaN,void(i.d=null)):er(i,t.toString())}if("string"===n)return 45===(r=t.charCodeAt(0))?(t=t.slice(1),i.s=-1):(43===r&&(t=t.slice(1)),i.s=1),Ne.test(t)?er(i,t):rr(i,t);if("bigint"===n)return t<0?(t=-t,i.s=-1):i.s=1,er(i,t.toString());throw Error(be+t)}if(s.prototype=je,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=wr,s.clone=t,s.isDecimal=Dr,s.abs=ur,s.acos=cr,s.acosh=hr,s.add=lr,s.asin=fr,s.asinh=pr,s.atan=gr,s.atanh=dr,s.atan2=vr,s.cbrt=mr,s.ceil=yr,s.clamp=xr,s.cos=Sr,s.cosh=Er,s.div=br,s.exp=Fr,s.floor=Ar,s.hypot=Cr,s.ln=Pr,s.log=Ir,s.log10=Rr,s.log2=Tr,s.max=Nr,s.min=_r,s.mod=Or,s.mul=Br,s.pow=jr,s.random=Hr,s.round=kr,s.sign=Lr,s.sin=Vr,s.sinh=Mr,s.sqrt=qr,s.sub=Kr,s.sum=Ur,s.tan=zr,s.tanh=Wr,s.trunc=Gr,void 0===e&&(e={}),e&&!0!==e.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<i.length;)e.hasOwnProperty(n=i[r++])||(e[n]=this[n]);return s.config(e),s}(we);ye=new $r(ye),xe=new $r(xe);var Jr=$r;const Yr=Jr.clone({precision:40,rounding:Jr.ROUND_HALF_UP});function Xr(t,e){return function(){return t.apply(e,arguments)}}const{toString:Zr}=Object.prototype,{getPrototypeOf:Qr}=Object,{iterator:tn,toStringTag:en}=Symbol,rn=(nn=Object.create(null),t=>{const e=Zr.call(t);return nn[e]||(nn[e]=e.slice(8,-1).toLowerCase())});var nn;const sn=t=>(t=t.toLowerCase(),e=>rn(e)===t),on=t=>e=>typeof e===t,{isArray:an}=Array,un=on("undefined");function cn(t){return null!==t&&!un(t)&&null!==t.constructor&&!un(t.constructor)&&fn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const hn=sn("ArrayBuffer");const ln=on("string"),fn=on("function"),pn=on("number"),gn=t=>null!==t&&"object"==typeof t,dn=t=>{if("object"!==rn(t))return!1;const e=Qr(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||en in t||tn in t)},vn=sn("Date"),mn=sn("File"),yn=sn("Blob"),xn=sn("FileList"),wn=sn("URLSearchParams"),[Sn,En,bn,Fn]=["ReadableStream","Request","Response","Headers"].map(sn);function An(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let n,i;if("object"!=typeof t&&(t=[t]),an(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{if(cn(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),s=i.length;let o;for(n=0;n<s;n++)o=i[n],e.call(null,t[o],o,t)}}function Cn(t,e){if(cn(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n,i=r.length;for(;i-- >0;)if(n=r[i],e===n.toLowerCase())return n;return null}const Dn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Pn=t=>!un(t)&&t!==Dn;const In=(Tn="undefined"!=typeof Uint8Array&&Qr(Uint8Array),t=>Tn&&t instanceof Tn);var Tn;const Rn=sn("HTMLFormElement"),Nn=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),_n=sn("RegExp"),On=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};An(r,(r,i)=>{let s;!1!==(s=e(r,i,t))&&(n[i]=s||r)}),Object.defineProperties(t,n)};const Bn=sn("AsyncFunction"),jn=(Hn="function"==typeof setImmediate,kn=fn(Dn.postMessage),Hn?setImmediate:kn?(Ln=`axios@${Math.random()}`,Vn=[],Dn.addEventListener("message",({source:t,data:e})=>{t===Dn&&e===Ln&&Vn.length&&Vn.shift()()},!1),t=>{Vn.push(t),Dn.postMessage(Ln,"*")}):t=>setTimeout(t));var Hn,kn,Ln,Vn;const Mn="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Dn):"undefined"!=typeof process&&process.nextTick||jn;var qn={isArray:an,isArrayBuffer:hn,isBuffer:cn,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||fn(t.append)&&("formdata"===(e=rn(t))||"object"===e&&fn(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&hn(t.buffer),e},isString:ln,isNumber:pn,isBoolean:t=>!0===t||!1===t,isObject:gn,isPlainObject:dn,isEmptyObject:t=>{if(!gn(t)||cn(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:Sn,isRequest:En,isResponse:bn,isHeaders:Fn,isUndefined:un,isDate:vn,isFile:mn,isBlob:yn,isRegExp:_n,isFunction:fn,isStream:t=>gn(t)&&fn(t.pipe),isURLSearchParams:wn,isTypedArray:In,isFileList:xn,forEach:An,merge:function t(){const{caseless:e}=Pn(this)&&this||{},r={},n=(n,i)=>{const s=e&&Cn(r,i)||i;dn(r[s])&&dn(n)?r[s]=t(r[s],n):dn(n)?r[s]=t({},n):an(n)?r[s]=n.slice():r[s]=n};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&An(arguments[t],n);return r},extend:(t,e,r,{allOwnKeys:n}={})=>(An(e,(e,n)=>{r&&fn(e)?t[n]=Xr(e,r):t[n]=e},{allOwnKeys:n}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,n)=>{let i,s,o;const a={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)o=i[s],n&&!n(o,t,e)||a[o]||(e[o]=t[o],a[o]=!0);t=!1!==r&&Qr(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:rn,kindOfTest:sn,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return-1!==n&&n===r},toArray:t=>{if(!t)return null;if(an(t))return t;let e=t.length;if(!pn(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[tn]).call(t);let n;for(;(n=r.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const n=[];for(;null!==(r=t.exec(e));)n.push(r);return n},isHTMLForm:Rn,hasOwnProperty:Nn,hasOwnProp:Nn,reduceDescriptors:On,freezeMethods:t=>{On(t,(e,r)=>{if(fn(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=t[r];fn(n)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(t,e)=>{const r={},n=t=>{t.forEach(t=>{r[t]=!0})};return an(t)?n(t):n(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,r){return e.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:Cn,global:Dn,isContextDefined:Pn,isSpecCompliantForm:function(t){return!!(t&&fn(t.append)&&"FormData"===t[en]&&t[tn])},toJSONObject:t=>{const e=new Array(10),r=(t,n)=>{if(gn(t)){if(e.indexOf(t)>=0)return;if(cn(t))return t;if(!("toJSON"in t)){e[n]=t;const i=an(t)?[]:{};return An(t,(t,e)=>{const s=r(t,n+1);!un(s)&&(i[e]=s)}),e[n]=void 0,i}}return t};return r(t,0)},isAsyncFn:Bn,isThenable:t=>t&&(gn(t)||fn(t))&&fn(t.then)&&fn(t.catch),setImmediate:jn,asap:Mn,isIterable:t=>null!=t&&fn(t[tn])};function Kn(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}qn.inherits(Kn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:qn.toJSONObject(this.config),code:this.code,status:this.status}}});const Un=Kn.prototype,zn={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{zn[t]={value:t}}),Object.defineProperties(Kn,zn),Object.defineProperty(Un,"isAxiosError",{value:!0}),Kn.from=(t,e,r,n,i,s)=>{const o=Object.create(Un);return qn.toFlatObject(t,o,function(t){return t!==Error.prototype},t=>"isAxiosError"!==t),Kn.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};function Wn(t){return qn.isPlainObject(t)||qn.isArray(t)}function Gn(t){return qn.endsWith(t,"[]")?t.slice(0,-2):t}function $n(t,e,r){return t?t.concat(e).map(function(t,e){return t=Gn(t),!r&&e?"["+t+"]":t}).join(r?".":""):e}const Jn=qn.toFlatObject(qn,{},null,function(t){return/^is[A-Z]/.test(t)});function Yn(t,e,r){if(!qn.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const n=(r=qn.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!qn.isUndefined(e[t])})).metaTokens,i=r.visitor||c,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&qn.isSpecCompliantForm(e);if(!qn.isFunction(i))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(qn.isDate(t))return t.toISOString();if(qn.isBoolean(t))return t.toString();if(!a&&qn.isBlob(t))throw new Kn("Blob is not supported. Use a Buffer instead.");return qn.isArrayBuffer(t)||qn.isTypedArray(t)?a&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function c(t,r,i){let a=t;if(t&&!i&&"object"==typeof t)if(qn.endsWith(r,"{}"))r=n?r:r.slice(0,-2),t=JSON.stringify(t);else if(qn.isArray(t)&&function(t){return qn.isArray(t)&&!t.some(Wn)}(t)||(qn.isFileList(t)||qn.endsWith(r,"[]"))&&(a=qn.toArray(t)))return r=Gn(r),a.forEach(function(t,n){!qn.isUndefined(t)&&null!==t&&e.append(!0===o?$n([r],n,s):null===o?r:r+"[]",u(t))}),!1;return!!Wn(t)||(e.append($n(i,r,s),u(t)),!1)}const h=[],l=Object.assign(Jn,{defaultVisitor:c,convertValue:u,isVisitable:Wn});if(!qn.isObject(t))throw new TypeError("data must be an object");return function t(r,n){if(!qn.isUndefined(r)){if(-1!==h.indexOf(r))throw Error("Circular reference detected in "+n.join("."));h.push(r),qn.forEach(r,function(r,s){!0===(!(qn.isUndefined(r)||null===r)&&i.call(e,r,qn.isString(s)?s.trim():s,n,l))&&t(r,n?n.concat(s):[s])}),h.pop()}}(t),e}function Xn(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function Zn(t,e){this._pairs=[],t&&Yn(t,this,e)}const Qn=Zn.prototype;function ti(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ei(t,e,r){if(!e)return t;const n=r&&r.encode||ti;qn.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(s=i?i(e,r):qn.isURLSearchParams(e)?e.toString():new Zn(e,r).toString(n),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}Qn.append=function(t,e){this._pairs.push([t,e])},Qn.toString=function(t){const e=t?function(e){return t.call(this,e,Xn)}:Xn;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};var ri=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){qn.forEach(this.handlers,function(e){null!==e&&t(e)})}},ni={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ii={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Zn,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const si="undefined"!=typeof window&&"undefined"!=typeof document,oi="object"==typeof navigator&&navigator||void 0,ai=si&&(!oi||["ReactNative","NativeScript","NS"].indexOf(oi.product)<0),ui="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ci=si&&window.location.href||"http://localhost";var hi={...Object.freeze({__proto__:null,hasBrowserEnv:si,hasStandardBrowserEnv:ai,hasStandardBrowserWebWorkerEnv:ui,navigator:oi,origin:ci}),...ii};function li(t){function e(t,r,n,i){let s=t[i++];if("__proto__"===s)return!0;const o=Number.isFinite(+s),a=i>=t.length;if(s=!s&&qn.isArray(n)?n.length:s,a)return qn.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&qn.isObject(n[s])||(n[s]=[]);return e(t,r,n[s],i)&&qn.isArray(n[s])&&(n[s]=function(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],e[s]=t[s];return e}(n[s])),!o}if(qn.isFormData(t)&&qn.isFunction(t.entries)){const r={};return qn.forEachEntry(t,(t,n)=>{e(function(t){return qn.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),n,r,0)}),r}return null}const fi={transitional:ni,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const r=e.getContentType()||"",n=r.indexOf("application/json")>-1,i=qn.isObject(t);i&&qn.isHTMLForm(t)&&(t=new FormData(t));if(qn.isFormData(t))return n?JSON.stringify(li(t)):t;if(qn.isArrayBuffer(t)||qn.isBuffer(t)||qn.isStream(t)||qn.isFile(t)||qn.isBlob(t)||qn.isReadableStream(t))return t;if(qn.isArrayBufferView(t))return t.buffer;if(qn.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Yn(t,new hi.classes.URLSearchParams,{visitor:function(t,e,r,n){return hi.isNode&&qn.isBuffer(t)?(this.append(e,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((s=qn.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Yn(s?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||n?(e.setContentType("application/json",!1),function(t,e,r){if(qn.isString(t))try{return(e||JSON.parse)(t),qn.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||fi.transitional,r=e&&e.forcedJSONParsing,n="json"===this.responseType;if(qn.isResponse(t)||qn.isReadableStream(t))return t;if(t&&qn.isString(t)&&(r&&!this.responseType||n)){const r=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw Kn.from(t,Kn.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:hi.classes.FormData,Blob:hi.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};qn.forEach(["delete","get","head","post","put","patch"],t=>{fi.headers[t]={}});var pi=fi;const gi=qn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const di=Symbol("internals");function vi(t){return t&&String(t).trim().toLowerCase()}function mi(t){return!1===t||null==t?t:qn.isArray(t)?t.map(mi):String(t)}function yi(t,e,r,n,i){return qn.isFunction(n)?n.call(this,e,r):(i&&(e=r),qn.isString(e)?qn.isString(n)?-1!==e.indexOf(n):qn.isRegExp(n)?n.test(e):void 0:void 0)}class xi{constructor(t){t&&this.set(t)}set(t,e,r){const n=this;function i(t,e,r){const i=vi(e);if(!i)throw new Error("header name must be a non-empty string");const s=qn.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||e]=mi(t))}const s=(t,e)=>qn.forEach(t,(t,r)=>i(t,r,e));if(qn.isPlainObject(t)||t instanceof this.constructor)s(t,e);else if(qn.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))s((t=>{const e={};let r,n,i;return t&&t.split("\n").forEach(function(t){i=t.indexOf(":"),r=t.substring(0,i).trim().toLowerCase(),n=t.substring(i+1).trim(),!r||e[r]&&gi[r]||("set-cookie"===r?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e})(t),e);else if(qn.isObject(t)&&qn.isIterable(t)){let r,n,i={};for(const e of t){if(!qn.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[n=e[0]]=(r=i[n])?qn.isArray(r)?[...r,e[1]]:[r,e[1]]:e[1]}s(i,e)}else null!=t&&i(e,t,r);return this}get(t,e){if(t=vi(t)){const r=qn.findKey(this,t);if(r){const t=this[r];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}(t);if(qn.isFunction(e))return e.call(this,t,r);if(qn.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=vi(t)){const r=qn.findKey(this,t);return!(!r||void 0===this[r]||e&&!yi(0,this[r],r,e))}return!1}delete(t,e){const r=this;let n=!1;function i(t){if(t=vi(t)){const i=qn.findKey(r,t);!i||e&&!yi(0,r[i],i,e)||(delete r[i],n=!0)}}return qn.isArray(t)?t.forEach(i):i(t),n}clear(t){const e=Object.keys(this);let r=e.length,n=!1;for(;r--;){const i=e[r];t&&!yi(0,this[i],i,t,!0)||(delete this[i],n=!0)}return n}normalize(t){const e=this,r={};return qn.forEach(this,(n,i)=>{const s=qn.findKey(r,i);if(s)return e[s]=mi(n),void delete e[i];const o=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,r)=>e.toUpperCase()+r)}(i):String(i).trim();o!==i&&delete e[i],e[o]=mi(n),r[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return qn.forEach(this,(r,n)=>{null!=r&&!1!==r&&(e[n]=t&&qn.isArray(r)?r.join(", "):r)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach(t=>r.set(t)),r}static accessor(t){const e=(this[di]=this[di]={accessors:{}}).accessors,r=this.prototype;function n(t){const n=vi(t);e[n]||(!function(t,e){const r=qn.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(t,r,i){return this[n].call(this,e,t,r,i)},configurable:!0})})}(r,t),e[n]=!0)}return qn.isArray(t)?t.forEach(n):n(t),this}}xi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),qn.reduceDescriptors(xi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}}),qn.freezeMethods(xi);var wi=xi;function Si(t,e){const r=this||pi,n=e||r,i=wi.from(n.headers);let s=n.data;return qn.forEach(t,function(t){s=t.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Ei(t){return!(!t||!t.__CANCEL__)}function bi(t,e,r){Kn.call(this,null==t?"canceled":t,Kn.ERR_CANCELED,e,r),this.name="CanceledError"}function Fi(t,e,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(new Kn("Request failed with status code "+r.status,[Kn.ERR_BAD_REQUEST,Kn.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}qn.inherits(bi,Kn,{__CANCEL__:!0});const Ai=(t,e,r=3)=>{let n=0;const i=function(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i,s=0,o=0;return e=void 0!==e?e:1e3,function(a){const u=Date.now(),c=n[o];i||(i=u),r[s]=a,n[s]=u;let h=o,l=0;for(;h!==s;)l+=r[h++],h%=t;if(s=(s+1)%t,s===o&&(o=(o+1)%t),u-i<e)return;const f=c&&u-c;return f?Math.round(1e3*l/f):void 0}}(50,250);return function(t,e){let r,n,i=0,s=1e3/e;const o=(e,s=Date.now())=>{i=s,r=null,n&&(clearTimeout(n),n=null),t(...e)};return[(...t)=>{const e=Date.now(),a=e-i;a>=s?o(t,e):(r=t,n||(n=setTimeout(()=>{n=null,o(r)},s-a)))},()=>r&&o(r)]}(r=>{const s=r.loaded,o=r.lengthComputable?r.total:void 0,a=s-n,u=i(a);n=s;t({loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:u||void 0,estimated:u&&o&&s<=o?(o-s)/u:void 0,event:r,lengthComputable:null!=o,[e?"download":"upload"]:!0})},r)},Ci=(t,e)=>{const r=null!=t;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Di=t=>(...e)=>qn.asap(()=>t(...e));var Pi=hi.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,hi.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(hi.origin),hi.navigator&&/(msie|trident)/i.test(hi.navigator.userAgent)):()=>!0,Ii=hi.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];qn.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),qn.isString(n)&&o.push("path="+n),qn.isString(i)&&o.push("domain="+i),!0===s&&o.push("secure"),document.cookie=o.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ti(t,e,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(n||0==r)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Ri=t=>t instanceof wi?{...t}:t;function Ni(t,e){e=e||{};const r={};function n(t,e,r,n){return qn.isPlainObject(t)&&qn.isPlainObject(e)?qn.merge.call({caseless:n},t,e):qn.isPlainObject(e)?qn.merge({},e):qn.isArray(e)?e.slice():e}function i(t,e,r,i){return qn.isUndefined(e)?qn.isUndefined(t)?void 0:n(void 0,t,0,i):n(t,e,0,i)}function s(t,e){if(!qn.isUndefined(e))return n(void 0,e)}function o(t,e){return qn.isUndefined(e)?qn.isUndefined(t)?void 0:n(void 0,t):n(void 0,e)}function a(r,i,s){return s in e?n(r,i):s in t?n(void 0,r):void 0}const u={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(t,e,r)=>i(Ri(t),Ri(e),0,!0)};return qn.forEach(Object.keys({...t,...e}),function(n){const s=u[n]||i,o=s(t[n],e[n],n);qn.isUndefined(o)&&s!==a||(r[n]=o)}),r}var _i=t=>{const e=Ni({},t);let r,{data:n,withXSRFToken:i,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:u}=e;if(e.headers=a=wi.from(a),e.url=ei(Ti(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),u&&a.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),qn.isFormData(n))if(hi.hasStandardBrowserEnv||hi.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(r=a.getContentType())){const[t,...e]=r?r.split(";").map(t=>t.trim()).filter(Boolean):[];a.setContentType([t||"multipart/form-data",...e].join("; "))}if(hi.hasStandardBrowserEnv&&(i&&qn.isFunction(i)&&(i=i(e)),i||!1!==i&&Pi(e.url))){const t=s&&o&&Ii.read(o);t&&a.set(s,t)}return e};var Oi="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,r){const n=_i(t);let i=n.data;const s=wi.from(n.headers).normalize();let o,a,u,c,h,{responseType:l,onUploadProgress:f,onDownloadProgress:p}=n;function g(){c&&c(),h&&h(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let d=new XMLHttpRequest;function v(){if(!d)return;const n=wi.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());Fi(function(t){e(t),g()},function(t){r(t),g()},{data:l&&"text"!==l&&"json"!==l?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:n,config:t,request:d}),d=null}d.open(n.method.toUpperCase(),n.url,!0),d.timeout=n.timeout,"onloadend"in d?d.onloadend=v:d.onreadystatechange=function(){d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))&&setTimeout(v)},d.onabort=function(){d&&(r(new Kn("Request aborted",Kn.ECONNABORTED,t,d)),d=null)},d.onerror=function(){r(new Kn("Network Error",Kn.ERR_NETWORK,t,d)),d=null},d.ontimeout=function(){let e=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||ni;n.timeoutErrorMessage&&(e=n.timeoutErrorMessage),r(new Kn(e,i.clarifyTimeoutError?Kn.ETIMEDOUT:Kn.ECONNABORTED,t,d)),d=null},void 0===i&&s.setContentType(null),"setRequestHeader"in d&&qn.forEach(s.toJSON(),function(t,e){d.setRequestHeader(e,t)}),qn.isUndefined(n.withCredentials)||(d.withCredentials=!!n.withCredentials),l&&"json"!==l&&(d.responseType=n.responseType),p&&([u,h]=Ai(p,!0),d.addEventListener("progress",u)),f&&d.upload&&([a,c]=Ai(f),d.upload.addEventListener("progress",a),d.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(o=e=>{d&&(r(!e||e.type?new bi(null,t,d):e),d.abort(),d=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));const m=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(n.url);m&&-1===hi.protocols.indexOf(m)?r(new Kn("Unsupported protocol "+m+":",Kn.ERR_BAD_REQUEST,t)):d.send(i||null)})};var Bi=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let r,n=new AbortController;const i=function(t){if(!r){r=!0,o();const e=t instanceof Error?t:this.reason;n.abort(e instanceof Kn?e:new bi(e instanceof Error?e.message:e))}};let s=e&&setTimeout(()=>{s=null,i(new Kn(`timeout ${e} of ms exceeded`,Kn.ETIMEDOUT))},e);const o=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(t=>{t.unsubscribe?t.unsubscribe(i):t.removeEventListener("abort",i)}),t=null)};t.forEach(t=>t.addEventListener("abort",i));const{signal:a}=n;return a.unsubscribe=()=>qn.asap(o),a}};const ji=function*(t,e){let r=t.byteLength;if(!e||r<e)return void(yield t);let n,i=0;for(;i<r;)n=i+e,yield t.slice(i,n),i=n},Hi=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},ki=(t,e,r,n)=>{const i=async function*(t,e){for await(const r of Hi(t))yield*ji(r,e)}(t,e);let s,o=0,a=t=>{s||(s=!0,n&&n(t))};return new ReadableStream({async pull(t){try{const{done:e,value:n}=await i.next();if(e)return a(),void t.close();let s=n.byteLength;if(r){let t=o+=s;r(t)}t.enqueue(new Uint8Array(n))}catch(t){throw a(t),t}},cancel:t=>(a(t),i.return())},{highWaterMark:2})},Li="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Vi=Li&&"function"==typeof ReadableStream,Mi=Li&&("function"==typeof TextEncoder?(qi=new TextEncoder,t=>qi.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var qi;const Ki=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},Ui=Vi&&Ki(()=>{let t=!1;const e=new Request(hi.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),zi=Vi&&Ki(()=>qn.isReadableStream(new Response("").body)),Wi={stream:zi&&(t=>t.body)};var Gi;Li&&(Gi=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Wi[t]&&(Wi[t]=qn.isFunction(Gi[t])?e=>e[t]():(e,r)=>{throw new Kn(`Response type '${t}' is not supported`,Kn.ERR_NOT_SUPPORT,r)})}));const $i=async(t,e)=>{const r=qn.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if(qn.isBlob(t))return t.size;if(qn.isSpecCompliantForm(t)){const e=new Request(hi.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return qn.isArrayBufferView(t)||qn.isArrayBuffer(t)?t.byteLength:(qn.isURLSearchParams(t)&&(t+=""),qn.isString(t)?(await Mi(t)).byteLength:void 0)})(e):r};var Ji=Li&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:u,responseType:c,headers:h,withCredentials:l="same-origin",fetchOptions:f}=_i(t);c=c?(c+"").toLowerCase():"text";let p,g=Bi([i,s&&s.toAbortSignal()],o);const d=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let v;try{if(u&&Ui&&"get"!==r&&"head"!==r&&0!==(v=await $i(h,n))){let t,r=new Request(e,{method:"POST",body:n,duplex:"half"});if(qn.isFormData(n)&&(t=r.headers.get("content-type"))&&h.setContentType(t),r.body){const[t,e]=Ci(v,Ai(Di(u)));n=ki(r.body,65536,t,e)}}qn.isString(l)||(l=l?"include":"omit");const i="credentials"in Request.prototype;p=new Request(e,{...f,signal:g,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:i?l:void 0});let s=await fetch(p,f);const o=zi&&("stream"===c||"response"===c);if(zi&&(a||o&&d)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=s[e]});const e=qn.toFiniteNumber(s.headers.get("content-length")),[r,n]=a&&Ci(e,Ai(Di(a),!0))||[];s=new Response(ki(s.body,65536,r,()=>{n&&n(),d&&d()}),t)}c=c||"text";let m=await Wi[qn.findKey(Wi,c)||"text"](s,t);return!o&&d&&d(),await new Promise((e,r)=>{Fi(e,r,{data:m,headers:wi.from(s.headers),status:s.status,statusText:s.statusText,config:t,request:p})})}catch(e){if(d&&d(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new Kn("Network Error",Kn.ERR_NETWORK,t,p),{cause:e.cause||e});throw Kn.from(e,e&&e.code,t,p)}});const Yi={http:null,xhr:Oi,fetch:Ji};qn.forEach(Yi,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const Xi=t=>`- ${t}`,Zi=t=>qn.isFunction(t)||null===t||!1===t;var Qi=t=>{t=qn.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s<e;s++){let e;if(r=t[s],n=r,!Zi(r)&&(n=Yi[(e=String(r)).toLowerCase()],void 0===n))throw new Kn(`Unknown adapter '${e}'`);if(n)break;i[e||"#"+s]=n}if(!n){const t=Object.entries(i).map(([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build"));throw new Kn("There is no suitable adapter to dispatch the request "+(e?t.length>1?"since :\n"+t.map(Xi).join("\n"):" "+Xi(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function ts(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bi(null,t)}function es(t){ts(t),t.headers=wi.from(t.headers),t.data=Si.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Qi(t.adapter||pi.adapter)(t).then(function(e){return ts(t),e.data=Si.call(t,t.transformResponse,e),e.headers=wi.from(e.headers),e},function(e){return Ei(e)||(ts(t),e&&e.response&&(e.response.data=Si.call(t,t.transformResponse,e.response),e.response.headers=wi.from(e.response.headers))),Promise.reject(e)})}const rs="1.11.0",ns={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ns[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const is={};ns.transitional=function(t,e,r){function n(t,e){return"[Axios v"+rs+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,i,s)=>{if(!1===t)throw new Kn(n(i," has been removed"+(e?" in "+e:"")),Kn.ERR_DEPRECATED);return e&&!is[i]&&(is[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,s)}},ns.spelling=function(t){return(e,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};var ss={assertOptions:function(t,e,r){if("object"!=typeof t)throw new Kn("options must be an object",Kn.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],o=e[s];if(o){const e=t[s],r=void 0===e||o(e,s,t);if(!0!==r)throw new Kn("option "+s+" must be "+r,Kn.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Kn("Unknown option "+s,Kn.ERR_BAD_OPTION)}},validators:ns};const os=ss.validators;class as{constructor(t){this.defaults=t||{},this.interceptors={request:new ri,response:new ri}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const r=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?r&&!String(t.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+r):t.stack=r}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Ni(this.defaults,e);const{transitional:r,paramsSerializer:n,headers:i}=e;void 0!==r&&ss.assertOptions(r,{silentJSONParsing:os.transitional(os.boolean),forcedJSONParsing:os.transitional(os.boolean),clarifyTimeoutError:os.transitional(os.boolean)},!1),null!=n&&(qn.isFunction(n)?e.paramsSerializer={serialize:n}:ss.assertOptions(n,{encode:os.function,serialize:os.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),ss.assertOptions(e,{baseUrl:os.spelling("baseURL"),withXsrfToken:os.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=i&&qn.merge(i.common,i[e.method]);i&&qn.forEach(["delete","get","head","post","put","patch","common"],t=>{delete i[t]}),e.headers=wi.concat(s,i);const o=[];let a=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(a=a&&t.synchronous,o.unshift(t.fulfilled,t.rejected))});const u=[];let c;this.interceptors.response.forEach(function(t){u.push(t.fulfilled,t.rejected)});let h,l=0;if(!a){const t=[es.bind(this),void 0];for(t.unshift(...o),t.push(...u),h=t.length,c=Promise.resolve(e);l<h;)c=c.then(t[l++],t[l++]);return c}h=o.length;let f=e;for(l=0;l<h;){const t=o[l++],e=o[l++];try{f=t(f)}catch(t){e.call(this,t);break}}try{c=es.call(this,f)}catch(t){return Promise.reject(t)}for(l=0,h=u.length;l<h;)c=c.then(u[l++],u[l++]);return c}getUri(t){return ei(Ti((t=Ni(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}qn.forEach(["delete","get","head","options"],function(t){as.prototype[t]=function(e,r){return this.request(Ni(r||{},{method:t,url:e,data:(r||{}).data}))}}),qn.forEach(["post","put","patch"],function(t){function e(e){return function(r,n,i){return this.request(Ni(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}as.prototype[t]=e(),as.prototype[t+"Form"]=e(!0)});var us=as;class cs{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(t){e=t});const r=this;this.promise.then(t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null}),this.promise.then=t=>{let e;const n=new Promise(t=>{r.subscribe(t),e=t}).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t(function(t,n,i){r.reason||(r.reason=new bi(t,n,i),e(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new cs(function(e){t=e}),cancel:t}}}var hs=cs;const ls={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ls).forEach(([t,e])=>{ls[e]=t});var fs=ls;const ps=function t(e){const r=new us(e),n=Xr(us.prototype.request,r);return qn.extend(n,us.prototype,r,{allOwnKeys:!0}),qn.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return t(Ni(e,r))},n}(pi);ps.Axios=us,ps.CanceledError=bi,ps.CancelToken=hs,ps.isCancel=Ei,ps.VERSION=rs,ps.toFormData=Yn,ps.AxiosError=Kn,ps.Cancel=ps.CanceledError,ps.all=function(t){return Promise.all(t)},ps.spread=function(t){return function(e){return t.apply(null,e)}},ps.isAxiosError=function(t){return qn.isObject(t)&&!0===t.isAxiosError},ps.mergeConfig=Ni,ps.AxiosHeaders=wi,ps.formToJSON=t=>li(qn.isHTMLForm(t)?new FormData(t):t),ps.getAdapter=Qi,ps.HttpStatusCode=fs,ps.default=ps;var gs=ps,ds={exports:{}};
35
- /**
36
- * @license
37
- * Lodash <https://lodash.com/>
38
- * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
39
- * Released under MIT license <https://lodash.com/license>
40
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
41
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
42
- */
43
- !function(t,e){(function(){var r,n="Expected a function",i="__lodash_hash_undefined__",s="__lodash_placeholder__",o=16,a=32,u=64,c=128,h=256,l=1/0,f=9007199254740991,g=NaN,d=4294967295,v=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",o],["flip",512],["partial",a],["partialRight",u],["rearg",h]],m="[object Arguments]",y="[object Array]",x="[object Boolean]",w="[object Date]",S="[object Error]",E="[object Function]",b="[object GeneratorFunction]",F="[object Map]",A="[object Number]",C="[object Object]",D="[object Promise]",P="[object RegExp]",I="[object Set]",T="[object String]",R="[object Symbol]",N="[object WeakMap]",_="[object ArrayBuffer]",O="[object DataView]",B="[object Float32Array]",j="[object Float64Array]",H="[object Int8Array]",k="[object Int16Array]",L="[object Int32Array]",V="[object Uint8Array]",M="[object Uint8ClampedArray]",q="[object Uint16Array]",K="[object Uint32Array]",U=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,$=/[&<>"']/g,J=RegExp(G.source),Y=RegExp($.source),X=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,tt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,et=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,it=RegExp(nt.source),st=/^\s+/,ot=/\s/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ut=/\{\n\/\* \[wrapped with (.+)\] \*/,ct=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lt=/[()=,{}\[\]\/\s]/,ft=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,gt=/\w*$/,dt=/^[-+]0x[0-9a-f]+$/i,vt=/^0b[01]+$/i,mt=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,xt=/^(?:0|[1-9]\d*)$/,wt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,St=/($^)/,Et=/['\n\r\u2028\u2029\\]/g,bt="\\ud800-\\udfff",Ft="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",At="\\u2700-\\u27bf",Ct="a-z\\xdf-\\xf6\\xf8-\\xff",Dt="A-Z\\xc0-\\xd6\\xd8-\\xde",Pt="\\ufe0e\\ufe0f",It="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Tt="['’]",Rt="["+bt+"]",Nt="["+It+"]",_t="["+Ft+"]",Ot="\\d+",Bt="["+At+"]",jt="["+Ct+"]",Ht="[^"+bt+It+Ot+At+Ct+Dt+"]",kt="\\ud83c[\\udffb-\\udfff]",Lt="[^"+bt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",qt="["+Dt+"]",Kt="\\u200d",Ut="(?:"+jt+"|"+Ht+")",zt="(?:"+qt+"|"+Ht+")",Wt="(?:['’](?:d|ll|m|re|s|t|ve))?",Gt="(?:['’](?:D|LL|M|RE|S|T|VE))?",$t="(?:"+_t+"|"+kt+")"+"?",Jt="["+Pt+"]?",Yt=Jt+$t+("(?:"+Kt+"(?:"+[Lt,Vt,Mt].join("|")+")"+Jt+$t+")*"),Xt="(?:"+[Bt,Vt,Mt].join("|")+")"+Yt,Zt="(?:"+[Lt+_t+"?",_t,Vt,Mt,Rt].join("|")+")",Qt=RegExp(Tt,"g"),te=RegExp(_t,"g"),ee=RegExp(kt+"(?="+kt+")|"+Zt+Yt,"g"),re=RegExp([qt+"?"+jt+"+"+Wt+"(?="+[Nt,qt,"$"].join("|")+")",zt+"+"+Gt+"(?="+[Nt,qt+Ut,"$"].join("|")+")",qt+"?"+Ut+"+"+Wt,qt+"+"+Gt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ot,Xt].join("|"),"g"),ne=RegExp("["+Kt+bt+Ft+Pt+"]"),ie=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],oe=-1,ae={};ae[B]=ae[j]=ae[H]=ae[k]=ae[L]=ae[V]=ae[M]=ae[q]=ae[K]=!0,ae[m]=ae[y]=ae[_]=ae[x]=ae[O]=ae[w]=ae[S]=ae[E]=ae[F]=ae[A]=ae[C]=ae[P]=ae[I]=ae[T]=ae[N]=!1;var ue={};ue[m]=ue[y]=ue[_]=ue[O]=ue[x]=ue[w]=ue[B]=ue[j]=ue[H]=ue[k]=ue[L]=ue[F]=ue[A]=ue[C]=ue[P]=ue[I]=ue[T]=ue[R]=ue[V]=ue[M]=ue[q]=ue[K]=!0,ue[S]=ue[E]=ue[N]=!1;var ce={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,le=parseInt,fe="object"==typeof p&&p&&p.Object===Object&&p,pe="object"==typeof self&&self&&self.Object===Object&&self,ge=fe||pe||Function("return this")(),de=e&&!e.nodeType&&e,ve=de&&t&&!t.nodeType&&t,me=ve&&ve.exports===de,ye=me&&fe.process,xe=function(){try{var t=ve&&ve.require&&ve.require("util").types;return t||ye&&ye.binding&&ye.binding("util")}catch(t){}}(),we=xe&&xe.isArrayBuffer,Se=xe&&xe.isDate,Ee=xe&&xe.isMap,be=xe&&xe.isRegExp,Fe=xe&&xe.isSet,Ae=xe&&xe.isTypedArray;function Ce(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function De(t,e,r,n){for(var i=-1,s=null==t?0:t.length;++i<s;){var o=t[i];e(n,o,r(o),t)}return n}function Pe(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}function Ie(t,e){for(var r=null==t?0:t.length;r--&&!1!==e(t[r],r,t););return t}function Te(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function Re(t,e){for(var r=-1,n=null==t?0:t.length,i=0,s=[];++r<n;){var o=t[r];e(o,r,t)&&(s[i++]=o)}return s}function Ne(t,e){return!!(null==t?0:t.length)&&qe(t,e,0)>-1}function _e(t,e,r){for(var n=-1,i=null==t?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function Oe(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function Be(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function je(t,e,r,n){var i=-1,s=null==t?0:t.length;for(n&&s&&(r=t[++i]);++i<s;)r=e(r,t[i],i,t);return r}function He(t,e,r,n){var i=null==t?0:t.length;for(n&&i&&(r=t[--i]);i--;)r=e(r,t[i],i,t);return r}function ke(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Le=We("length");function Ve(t,e,r){var n;return r(t,function(t,r,i){if(e(t,r,i))return n=r,!1}),n}function Me(t,e,r,n){for(var i=t.length,s=r+(n?1:-1);n?s--:++s<i;)if(e(t[s],s,t))return s;return-1}function qe(t,e,r){return e==e?function(t,e,r){var n=r-1,i=t.length;for(;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):Me(t,Ue,r)}function Ke(t,e,r,n){for(var i=r-1,s=t.length;++i<s;)if(n(t[i],e))return i;return-1}function Ue(t){return t!=t}function ze(t,e){var r=null==t?0:t.length;return r?Je(t,e)/r:g}function We(t){return function(e){return null==e?r:e[t]}}function Ge(t){return function(e){return null==t?r:t[e]}}function $e(t,e,r,n,i){return i(t,function(t,i,s){r=n?(n=!1,t):e(r,t,i,s)}),r}function Je(t,e){for(var n,i=-1,s=t.length;++i<s;){var o=e(t[i]);o!==r&&(n=n===r?o:n+o)}return n}function Ye(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function Xe(t){return t?t.slice(0,gr(t)+1).replace(st,""):t}function Ze(t){return function(e){return t(e)}}function Qe(t,e){return Oe(e,function(e){return t[e]})}function tr(t,e){return t.has(e)}function er(t,e){for(var r=-1,n=t.length;++r<n&&qe(e,t[r],0)>-1;);return r}function rr(t,e){for(var r=t.length;r--&&qe(e,t[r],0)>-1;);return r}var nr=Ge({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ir=Ge({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function sr(t){return"\\"+ce[t]}function or(t){return ne.test(t)}function ar(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}function ur(t,e){return function(r){return t(e(r))}}function cr(t,e){for(var r=-1,n=t.length,i=0,o=[];++r<n;){var a=t[r];a!==e&&a!==s||(t[r]=s,o[i++]=r)}return o}function hr(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}function lr(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=[t,t]}),r}function fr(t){return or(t)?function(t){var e=ee.lastIndex=0;for(;ee.test(t);)++e;return e}(t):Le(t)}function pr(t){return or(t)?function(t){return t.match(ee)||[]}(t):function(t){return t.split("")}(t)}function gr(t){for(var e=t.length;e--&&ot.test(t.charAt(e)););return e}var dr=Ge({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var vr=function t(e){var p,ot=(e=null==e?ge:vr.defaults(ge.Object(),e,vr.pick(ge,se))).Array,bt=e.Date,Ft=e.Error,At=e.Function,Ct=e.Math,Dt=e.Object,Pt=e.RegExp,It=e.String,Tt=e.TypeError,Rt=ot.prototype,Nt=At.prototype,_t=Dt.prototype,Ot=e["__core-js_shared__"],Bt=Nt.toString,jt=_t.hasOwnProperty,Ht=0,kt=(p=/[^.]+$/.exec(Ot&&Ot.keys&&Ot.keys.IE_PROTO||""))?"Symbol(src)_1."+p:"",Lt=_t.toString,Vt=Bt.call(Dt),Mt=ge._,qt=Pt("^"+Bt.call(jt).replace(nt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kt=me?e.Buffer:r,Ut=e.Symbol,zt=e.Uint8Array,Wt=Kt?Kt.allocUnsafe:r,Gt=ur(Dt.getPrototypeOf,Dt),$t=Dt.create,Jt=_t.propertyIsEnumerable,Yt=Rt.splice,Xt=Ut?Ut.isConcatSpreadable:r,Zt=Ut?Ut.iterator:r,ee=Ut?Ut.toStringTag:r,ne=function(){try{var t=fs(Dt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ce=e.clearTimeout!==ge.clearTimeout&&e.clearTimeout,fe=bt&&bt.now!==ge.Date.now&&bt.now,pe=e.setTimeout!==ge.setTimeout&&e.setTimeout,de=Ct.ceil,ve=Ct.floor,ye=Dt.getOwnPropertySymbols,xe=Kt?Kt.isBuffer:r,Le=e.isFinite,Ge=Rt.join,mr=ur(Dt.keys,Dt),yr=Ct.max,xr=Ct.min,wr=bt.now,Sr=e.parseInt,Er=Ct.random,br=Rt.reverse,Fr=fs(e,"DataView"),Ar=fs(e,"Map"),Cr=fs(e,"Promise"),Dr=fs(e,"Set"),Pr=fs(e,"WeakMap"),Ir=fs(Dt,"create"),Tr=Pr&&new Pr,Rr={},Nr=ks(Fr),_r=ks(Ar),Or=ks(Cr),Br=ks(Dr),jr=ks(Pr),Hr=Ut?Ut.prototype:r,kr=Hr?Hr.valueOf:r,Lr=Hr?Hr.toString:r;function Vr(t){if(ra(t)&&!zo(t)&&!(t instanceof Ur)){if(t instanceof Kr)return t;if(jt.call(t,"__wrapped__"))return Ls(t)}return new Kr(t)}var Mr=function(){function t(){}return function(e){if(!ea(e))return{};if($t)return $t(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function qr(){}function Kr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function Ur(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function zr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Wr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Gr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function $r(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Gr;++e<r;)this.add(t[e])}function Jr(t){var e=this.__data__=new Wr(t);this.size=e.size}function Yr(t,e){var r=zo(t),n=!r&&Uo(t),i=!r&&!n&&Jo(t),s=!r&&!n&&!i&&ha(t),o=r||n||i||s,a=o?Ye(t.length,It):[],u=a.length;for(var c in t)!e&&!jt.call(t,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||xs(c,u))||a.push(c);return a}function Xr(t){var e=t.length;return e?t[Jn(0,e-1)]:r}function Zr(t,e){return Bs(Ti(t),un(e,0,t.length))}function Qr(t){return Bs(Ti(t))}function tn(t,e,n){(n!==r&&!Mo(t[e],n)||n===r&&!(e in t))&&on(t,e,n)}function en(t,e,n){var i=t[e];jt.call(t,e)&&Mo(i,n)&&(n!==r||e in t)||on(t,e,n)}function rn(t,e){for(var r=t.length;r--;)if(Mo(t[r][0],e))return r;return-1}function nn(t,e,r,n){return pn(t,function(t,i,s){e(n,t,r(t),s)}),n}function sn(t,e){return t&&Ri(e,Na(e),t)}function on(t,e,r){"__proto__"==e&&ne?ne(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function an(t,e){for(var n=-1,i=e.length,s=ot(i),o=null==t;++n<i;)s[n]=o?r:Da(t,e[n]);return s}function un(t,e,n){return t==t&&(n!==r&&(t=t<=n?t:n),e!==r&&(t=t>=e?t:e)),t}function cn(t,e,n,i,s,o){var a,u=1&e,c=2&e,h=4&e;if(n&&(a=s?n(t,i,s,o):n(t)),a!==r)return a;if(!ea(t))return t;var l=zo(t);if(l){if(a=function(t){var e=t.length,r=new t.constructor(e);e&&"string"==typeof t[0]&&jt.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!u)return Ti(t,a)}else{var f=ds(t),p=f==E||f==b;if(Jo(t))return Fi(t,u);if(f==C||f==m||p&&!s){if(a=c||p?{}:ms(t),!u)return c?function(t,e){return Ri(t,gs(t),e)}(t,function(t,e){return t&&Ri(e,_a(e),t)}(a,t)):function(t,e){return Ri(t,ps(t),e)}(t,sn(a,t))}else{if(!ue[f])return s?t:{};a=function(t,e,r){var n=t.constructor;switch(e){case _:return Ai(t);case x:case w:return new n(+t);case O:return function(t,e){var r=e?Ai(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case B:case j:case H:case k:case L:case V:case M:case q:case K:return Ci(t,r);case F:return new n;case A:case T:return new n(t);case P:return function(t){var e=new t.constructor(t.source,gt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case I:return new n;case R:return i=t,kr?Dt(kr.call(i)):{}}var i}(t,f,u)}}o||(o=new Jr);var g=o.get(t);if(g)return g;o.set(t,a),aa(t)?t.forEach(function(r){a.add(cn(r,e,n,r,t,o))}):na(t)&&t.forEach(function(r,i){a.set(i,cn(r,e,n,i,t,o))});var d=l?r:(h?c?ss:is:c?_a:Na)(t);return Pe(d||t,function(r,i){d&&(r=t[i=r]),en(a,i,cn(r,e,n,i,t,o))}),a}function hn(t,e,n){var i=n.length;if(null==t)return!i;for(t=Dt(t);i--;){var s=n[i],o=e[s],a=t[s];if(a===r&&!(s in t)||!o(a))return!1}return!0}function ln(t,e,i){if("function"!=typeof t)throw new Tt(n);return Rs(function(){t.apply(r,i)},e)}function fn(t,e,r,n){var i=-1,s=Ne,o=!0,a=t.length,u=[],c=e.length;if(!a)return u;r&&(e=Oe(e,Ze(r))),n?(s=_e,o=!1):e.length>=200&&(s=tr,o=!1,e=new $r(e));t:for(;++i<a;){var h=t[i],l=null==r?h:r(h);if(h=n||0!==h?h:0,o&&l==l){for(var f=c;f--;)if(e[f]===l)continue t;u.push(h)}else s(e,l,n)||u.push(h)}return u}Vr.templateSettings={escape:X,evaluate:Z,interpolate:Q,variable:"",imports:{_:Vr}},Vr.prototype=qr.prototype,Vr.prototype.constructor=Vr,Kr.prototype=Mr(qr.prototype),Kr.prototype.constructor=Kr,Ur.prototype=Mr(qr.prototype),Ur.prototype.constructor=Ur,zr.prototype.clear=function(){this.__data__=Ir?Ir(null):{},this.size=0},zr.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},zr.prototype.get=function(t){var e=this.__data__;if(Ir){var n=e[t];return n===i?r:n}return jt.call(e,t)?e[t]:r},zr.prototype.has=function(t){var e=this.__data__;return Ir?e[t]!==r:jt.call(e,t)},zr.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Ir&&e===r?i:e,this},Wr.prototype.clear=function(){this.__data__=[],this.size=0},Wr.prototype.delete=function(t){var e=this.__data__,r=rn(e,t);return!(r<0)&&(r==e.length-1?e.pop():Yt.call(e,r,1),--this.size,!0)},Wr.prototype.get=function(t){var e=this.__data__,n=rn(e,t);return n<0?r:e[n][1]},Wr.prototype.has=function(t){return rn(this.__data__,t)>-1},Wr.prototype.set=function(t,e){var r=this.__data__,n=rn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},Gr.prototype.clear=function(){this.size=0,this.__data__={hash:new zr,map:new(Ar||Wr),string:new zr}},Gr.prototype.delete=function(t){var e=hs(this,t).delete(t);return this.size-=e?1:0,e},Gr.prototype.get=function(t){return hs(this,t).get(t)},Gr.prototype.has=function(t){return hs(this,t).has(t)},Gr.prototype.set=function(t,e){var r=hs(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},$r.prototype.add=$r.prototype.push=function(t){return this.__data__.set(t,i),this},$r.prototype.has=function(t){return this.__data__.has(t)},Jr.prototype.clear=function(){this.__data__=new Wr,this.size=0},Jr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Jr.prototype.get=function(t){return this.__data__.get(t)},Jr.prototype.has=function(t){return this.__data__.has(t)},Jr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Wr){var n=r.__data__;if(!Ar||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Gr(n)}return r.set(t,e),this.size=r.size,this};var pn=Oi(Sn),gn=Oi(En,!0);function dn(t,e){var r=!0;return pn(t,function(t,n,i){return r=!!e(t,n,i)}),r}function vn(t,e,n){for(var i=-1,s=t.length;++i<s;){var o=t[i],a=e(o);if(null!=a&&(u===r?a==a&&!ca(a):n(a,u)))var u=a,c=o}return c}function mn(t,e){var r=[];return pn(t,function(t,n,i){e(t,n,i)&&r.push(t)}),r}function yn(t,e,r,n,i){var s=-1,o=t.length;for(r||(r=ys),i||(i=[]);++s<o;){var a=t[s];e>0&&r(a)?e>1?yn(a,e-1,r,n,i):Be(i,a):n||(i[i.length]=a)}return i}var xn=Bi(),wn=Bi(!0);function Sn(t,e){return t&&xn(t,e,Na)}function En(t,e){return t&&wn(t,e,Na)}function bn(t,e){return Re(e,function(e){return Zo(t[e])})}function Fn(t,e){for(var n=0,i=(e=wi(e,t)).length;null!=t&&n<i;)t=t[Hs(e[n++])];return n&&n==i?t:r}function An(t,e,r){var n=e(t);return zo(t)?n:Be(n,r(t))}function Cn(t){return null==t?t===r?"[object Undefined]":"[object Null]":ee&&ee in Dt(t)?function(t){var e=jt.call(t,ee),n=t[ee];try{t[ee]=r;var i=!0}catch(t){}var s=Lt.call(t);i&&(e?t[ee]=n:delete t[ee]);return s}(t):function(t){return Lt.call(t)}(t)}function Dn(t,e){return t>e}function Pn(t,e){return null!=t&&jt.call(t,e)}function In(t,e){return null!=t&&e in Dt(t)}function Tn(t,e,n){for(var i=n?_e:Ne,s=t[0].length,o=t.length,a=o,u=ot(o),c=1/0,h=[];a--;){var l=t[a];a&&e&&(l=Oe(l,Ze(e))),c=xr(l.length,c),u[a]=!n&&(e||s>=120&&l.length>=120)?new $r(a&&l):r}l=t[0];var f=-1,p=u[0];t:for(;++f<s&&h.length<c;){var g=l[f],d=e?e(g):g;if(g=n||0!==g?g:0,!(p?tr(p,d):i(h,d,n))){for(a=o;--a;){var v=u[a];if(!(v?tr(v,d):i(t[a],d,n)))continue t}p&&p.push(d),h.push(g)}}return h}function Rn(t,e,n){var i=null==(t=Ps(t,e=wi(e,t)))?t:t[Hs(Ys(e))];return null==i?r:Ce(i,t,n)}function Nn(t){return ra(t)&&Cn(t)==m}function _n(t,e,n,i,s){return t===e||(null==t||null==e||!ra(t)&&!ra(e)?t!=t&&e!=e:function(t,e,n,i,s,o){var a=zo(t),u=zo(e),c=a?y:ds(t),h=u?y:ds(e),l=(c=c==m?C:c)==C,f=(h=h==m?C:h)==C,p=c==h;if(p&&Jo(t)){if(!Jo(e))return!1;a=!0,l=!1}if(p&&!l)return o||(o=new Jr),a||ha(t)?rs(t,e,n,i,s,o):function(t,e,r,n,i,s,o){switch(r){case O:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case _:return!(t.byteLength!=e.byteLength||!s(new zt(t),new zt(e)));case x:case w:case A:return Mo(+t,+e);case S:return t.name==e.name&&t.message==e.message;case P:case T:return t==e+"";case F:var a=ar;case I:var u=1&n;if(a||(a=hr),t.size!=e.size&&!u)return!1;var c=o.get(t);if(c)return c==e;n|=2,o.set(t,e);var h=rs(a(t),a(e),n,i,s,o);return o.delete(t),h;case R:if(kr)return kr.call(t)==kr.call(e)}return!1}(t,e,c,n,i,s,o);if(!(1&n)){var g=l&&jt.call(t,"__wrapped__"),d=f&&jt.call(e,"__wrapped__");if(g||d){var v=g?t.value():t,E=d?e.value():e;return o||(o=new Jr),s(v,E,n,i,o)}}if(!p)return!1;return o||(o=new Jr),function(t,e,n,i,s,o){var a=1&n,u=is(t),c=u.length,h=is(e),l=h.length;if(c!=l&&!a)return!1;var f=c;for(;f--;){var p=u[f];if(!(a?p in e:jt.call(e,p)))return!1}var g=o.get(t),d=o.get(e);if(g&&d)return g==e&&d==t;var v=!0;o.set(t,e),o.set(e,t);var m=a;for(;++f<c;){var y=t[p=u[f]],x=e[p];if(i)var w=a?i(x,y,p,e,t,o):i(y,x,p,t,e,o);if(!(w===r?y===x||s(y,x,n,i,o):w)){v=!1;break}m||(m="constructor"==p)}if(v&&!m){var S=t.constructor,E=e.constructor;S==E||!("constructor"in t)||!("constructor"in e)||"function"==typeof S&&S instanceof S&&"function"==typeof E&&E instanceof E||(v=!1)}return o.delete(t),o.delete(e),v}(t,e,n,i,s,o)}(t,e,n,i,_n,s))}function On(t,e,n,i){var s=n.length,o=s,a=!i;if(null==t)return!o;for(t=Dt(t);s--;){var u=n[s];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++s<o;){var c=(u=n[s])[0],h=t[c],l=u[1];if(a&&u[2]){if(h===r&&!(c in t))return!1}else{var f=new Jr;if(i)var p=i(h,l,c,t,e,f);if(!(p===r?_n(l,h,3,i,f):p))return!1}}return!0}function Bn(t){return!(!ea(t)||(e=t,kt&&kt in e))&&(Zo(t)?qt:mt).test(ks(t));var e}function jn(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?zo(t)?qn(t[0],t[1]):Mn(t):pu(t)}function Hn(t){if(!Fs(t))return mr(t);var e=[];for(var r in Dt(t))jt.call(t,r)&&"constructor"!=r&&e.push(r);return e}function kn(t){if(!ea(t))return function(t){var e=[];if(null!=t)for(var r in Dt(t))e.push(r);return e}(t);var e=Fs(t),r=[];for(var n in t)("constructor"!=n||!e&&jt.call(t,n))&&r.push(n);return r}function Ln(t,e){return t<e}function Vn(t,e){var r=-1,n=Go(t)?ot(t.length):[];return pn(t,function(t,i,s){n[++r]=e(t,i,s)}),n}function Mn(t){var e=ls(t);return 1==e.length&&e[0][2]?Cs(e[0][0],e[0][1]):function(r){return r===t||On(r,t,e)}}function qn(t,e){return Ss(t)&&As(e)?Cs(Hs(t),e):function(n){var i=Da(n,t);return i===r&&i===e?Pa(n,t):_n(e,i,3)}}function Kn(t,e,n,i,s){t!==e&&xn(e,function(o,a){if(s||(s=new Jr),ea(o))!function(t,e,n,i,s,o,a){var u=Is(t,n),c=Is(e,n),h=a.get(c);if(h)return void tn(t,n,h);var l=o?o(u,c,n+"",t,e,a):r,f=l===r;if(f){var p=zo(c),g=!p&&Jo(c),d=!p&&!g&&ha(c);l=c,p||g||d?zo(u)?l=u:$o(u)?l=Ti(u):g?(f=!1,l=Fi(c,!0)):d?(f=!1,l=Ci(c,!0)):l=[]:sa(c)||Uo(c)?(l=u,Uo(u)?l=ya(u):ea(u)&&!Zo(u)||(l=ms(c))):f=!1}f&&(a.set(c,l),s(l,c,i,o,a),a.delete(c));tn(t,n,l)}(t,e,a,n,Kn,i,s);else{var u=i?i(Is(t,a),o,a+"",t,e,s):r;u===r&&(u=o),tn(t,a,u)}},_a)}function Un(t,e){var n=t.length;if(n)return xs(e+=e<0?n:0,n)?t[e]:r}function zn(t,e,r){e=e.length?Oe(e,function(t){return zo(t)?function(e){return Fn(e,1===t.length?t[0]:t)}:t}):[iu];var n=-1;e=Oe(e,Ze(cs()));var i=Vn(t,function(t,r,i){var s=Oe(e,function(e){return e(t)});return{criteria:s,index:++n,value:t}});return function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}(i,function(t,e){return function(t,e,r){var n=-1,i=t.criteria,s=e.criteria,o=i.length,a=r.length;for(;++n<o;){var u=Di(i[n],s[n]);if(u)return n>=a?u:u*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)})}function Wn(t,e,r){for(var n=-1,i=e.length,s={};++n<i;){var o=e[n],a=Fn(t,o);r(a,o)&&ti(s,wi(o,t),a)}return s}function Gn(t,e,r,n){var i=n?Ke:qe,s=-1,o=e.length,a=t;for(t===e&&(e=Ti(e)),r&&(a=Oe(t,Ze(r)));++s<o;)for(var u=0,c=e[s],h=r?r(c):c;(u=i(a,h,u,n))>-1;)a!==t&&Yt.call(a,u,1),Yt.call(t,u,1);return t}function $n(t,e){for(var r=t?e.length:0,n=r-1;r--;){var i=e[r];if(r==n||i!==s){var s=i;xs(i)?Yt.call(t,i,1):fi(t,i)}}return t}function Jn(t,e){return t+ve(Er()*(e-t+1))}function Yn(t,e){var r="";if(!t||e<1||e>f)return r;do{e%2&&(r+=t),(e=ve(e/2))&&(t+=t)}while(e);return r}function Xn(t,e){return Ns(Ds(t,e,iu),t+"")}function Zn(t){return Xr(Ma(t))}function Qn(t,e){var r=Ma(t);return Bs(r,un(e,0,r.length))}function ti(t,e,n,i){if(!ea(t))return t;for(var s=-1,o=(e=wi(e,t)).length,a=o-1,u=t;null!=u&&++s<o;){var c=Hs(e[s]),h=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(s!=a){var l=u[c];(h=i?i(l,c,u):r)===r&&(h=ea(l)?l:xs(e[s+1])?[]:{})}en(u,c,h),u=u[c]}return t}var ei=Tr?function(t,e){return Tr.set(t,e),t}:iu,ri=ne?function(t,e){return ne(t,"toString",{configurable:!0,enumerable:!1,value:eu(e),writable:!0})}:iu;function ni(t){return Bs(Ma(t))}function ii(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var s=ot(i);++n<i;)s[n]=t[n+e];return s}function si(t,e){var r;return pn(t,function(t,n,i){return!(r=e(t,n,i))}),!!r}function oi(t,e,r){var n=0,i=null==t?n:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;n<i;){var s=n+i>>>1,o=t[s];null!==o&&!ca(o)&&(r?o<=e:o<e)?n=s+1:i=s}return i}return ai(t,e,iu,r)}function ai(t,e,n,i){var s=0,o=null==t?0:t.length;if(0===o)return 0;for(var a=(e=n(e))!=e,u=null===e,c=ca(e),h=e===r;s<o;){var l=ve((s+o)/2),f=n(t[l]),p=f!==r,g=null===f,d=f==f,v=ca(f);if(a)var m=i||d;else m=h?d&&(i||p):u?d&&p&&(i||!g):c?d&&p&&!g&&(i||!v):!g&&!v&&(i?f<=e:f<e);m?s=l+1:o=l}return xr(o,4294967294)}function ui(t,e){for(var r=-1,n=t.length,i=0,s=[];++r<n;){var o=t[r],a=e?e(o):o;if(!r||!Mo(a,u)){var u=a;s[i++]=0===o?0:o}}return s}function ci(t){return"number"==typeof t?t:ca(t)?g:+t}function hi(t){if("string"==typeof t)return t;if(zo(t))return Oe(t,hi)+"";if(ca(t))return Lr?Lr.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function li(t,e,r){var n=-1,i=Ne,s=t.length,o=!0,a=[],u=a;if(r)o=!1,i=_e;else if(s>=200){var c=e?null:Yi(t);if(c)return hr(c);o=!1,i=tr,u=new $r}else u=e?[]:a;t:for(;++n<s;){var h=t[n],l=e?e(h):h;if(h=r||0!==h?h:0,o&&l==l){for(var f=u.length;f--;)if(u[f]===l)continue t;e&&u.push(l),a.push(h)}else i(u,l,r)||(u!==a&&u.push(l),a.push(h))}return a}function fi(t,e){return null==(t=Ps(t,e=wi(e,t)))||delete t[Hs(Ys(e))]}function pi(t,e,r,n){return ti(t,e,r(Fn(t,e)),n)}function gi(t,e,r,n){for(var i=t.length,s=n?i:-1;(n?s--:++s<i)&&e(t[s],s,t););return r?ii(t,n?0:s,n?s+1:i):ii(t,n?s+1:0,n?i:s)}function di(t,e){var r=t;return r instanceof Ur&&(r=r.value()),je(e,function(t,e){return e.func.apply(e.thisArg,Be([t],e.args))},r)}function vi(t,e,r){var n=t.length;if(n<2)return n?li(t[0]):[];for(var i=-1,s=ot(n);++i<n;)for(var o=t[i],a=-1;++a<n;)a!=i&&(s[i]=fn(s[i]||o,t[a],e,r));return li(yn(s,1),e,r)}function mi(t,e,n){for(var i=-1,s=t.length,o=e.length,a={};++i<s;){var u=i<o?e[i]:r;n(a,t[i],u)}return a}function yi(t){return $o(t)?t:[]}function xi(t){return"function"==typeof t?t:iu}function wi(t,e){return zo(t)?t:Ss(t,e)?[t]:js(xa(t))}var Si=Xn;function Ei(t,e,n){var i=t.length;return n=n===r?i:n,!e&&n>=i?t:ii(t,e,n)}var bi=ce||function(t){return ge.clearTimeout(t)};function Fi(t,e){if(e)return t.slice();var r=t.length,n=Wt?Wt(r):new t.constructor(r);return t.copy(n),n}function Ai(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ci(t,e){var r=e?Ai(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Di(t,e){if(t!==e){var n=t!==r,i=null===t,s=t==t,o=ca(t),a=e!==r,u=null===e,c=e==e,h=ca(e);if(!u&&!h&&!o&&t>e||o&&a&&c&&!u&&!h||i&&a&&c||!n&&c||!s)return 1;if(!i&&!o&&!h&&t<e||h&&n&&s&&!i&&!o||u&&n&&s||!a&&s||!c)return-1}return 0}function Pi(t,e,r,n){for(var i=-1,s=t.length,o=r.length,a=-1,u=e.length,c=yr(s-o,0),h=ot(u+c),l=!n;++a<u;)h[a]=e[a];for(;++i<o;)(l||i<s)&&(h[r[i]]=t[i]);for(;c--;)h[a++]=t[i++];return h}function Ii(t,e,r,n){for(var i=-1,s=t.length,o=-1,a=r.length,u=-1,c=e.length,h=yr(s-a,0),l=ot(h+c),f=!n;++i<h;)l[i]=t[i];for(var p=i;++u<c;)l[p+u]=e[u];for(;++o<a;)(f||i<s)&&(l[p+r[o]]=t[i++]);return l}function Ti(t,e){var r=-1,n=t.length;for(e||(e=ot(n));++r<n;)e[r]=t[r];return e}function Ri(t,e,n,i){var s=!n;n||(n={});for(var o=-1,a=e.length;++o<a;){var u=e[o],c=i?i(n[u],t[u],u,n,t):r;c===r&&(c=t[u]),s?on(n,u,c):en(n,u,c)}return n}function Ni(t,e){return function(r,n){var i=zo(r)?De:nn,s=e?e():{};return i(r,t,cs(n,2),s)}}function _i(t){return Xn(function(e,n){var i=-1,s=n.length,o=s>1?n[s-1]:r,a=s>2?n[2]:r;for(o=t.length>3&&"function"==typeof o?(s--,o):r,a&&ws(n[0],n[1],a)&&(o=s<3?r:o,s=1),e=Dt(e);++i<s;){var u=n[i];u&&t(e,u,i,o)}return e})}function Oi(t,e){return function(r,n){if(null==r)return r;if(!Go(r))return t(r,n);for(var i=r.length,s=e?i:-1,o=Dt(r);(e?s--:++s<i)&&!1!==n(o[s],s,o););return r}}function Bi(t){return function(e,r,n){for(var i=-1,s=Dt(e),o=n(e),a=o.length;a--;){var u=o[t?a:++i];if(!1===r(s[u],u,s))break}return e}}function ji(t){return function(e){var n=or(e=xa(e))?pr(e):r,i=n?n[0]:e.charAt(0),s=n?Ei(n,1).join(""):e.slice(1);return i[t]()+s}}function Hi(t){return function(e){return je(Za(Ua(e).replace(Qt,"")),t,"")}}function ki(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=Mr(t.prototype),n=t.apply(r,e);return ea(n)?n:r}}function Li(t){return function(e,n,i){var s=Dt(e);if(!Go(e)){var o=cs(n,3);e=Na(e),n=function(t){return o(s[t],t,s)}}var a=t(e,n,i);return a>-1?s[o?e[a]:a]:r}}function Vi(t){return ns(function(e){var i=e.length,s=i,o=Kr.prototype.thru;for(t&&e.reverse();s--;){var a=e[s];if("function"!=typeof a)throw new Tt(n);if(o&&!u&&"wrapper"==as(a))var u=new Kr([],!0)}for(s=u?s:i;++s<i;){var c=as(a=e[s]),h="wrapper"==c?os(a):r;u=h&&Es(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?u[as(h[0])].apply(u,h[3]):1==a.length&&Es(a)?u[c]():u.thru(a)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&zo(r))return u.plant(r).value();for(var n=0,s=i?e[n].apply(this,t):r;++n<i;)s=e[n].call(this,s);return s}})}function Mi(t,e,n,i,s,o,a,u,h,l){var f=e&c,p=1&e,g=2&e,d=24&e,v=512&e,m=g?r:ki(t);return function c(){for(var y=arguments.length,x=ot(y),w=y;w--;)x[w]=arguments[w];if(d)var S=us(c),E=function(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&++n;return n}(x,S);if(i&&(x=Pi(x,i,s,d)),o&&(x=Ii(x,o,a,d)),y-=E,d&&y<l){var b=cr(x,S);return $i(t,e,Mi,c.placeholder,n,x,b,u,h,l-y)}var F=p?n:this,A=g?F[t]:t;return y=x.length,u?x=function(t,e){var n=t.length,i=xr(e.length,n),s=Ti(t);for(;i--;){var o=e[i];t[i]=xs(o,n)?s[o]:r}return t}(x,u):v&&y>1&&x.reverse(),f&&h<y&&(x.length=h),this&&this!==ge&&this instanceof c&&(A=m||ki(A)),A.apply(F,x)}}function qi(t,e){return function(r,n){return function(t,e,r,n){return Sn(t,function(t,i,s){e(n,r(t),i,s)}),n}(r,t,e(n),{})}}function Ki(t,e){return function(n,i){var s;if(n===r&&i===r)return e;if(n!==r&&(s=n),i!==r){if(s===r)return i;"string"==typeof n||"string"==typeof i?(n=hi(n),i=hi(i)):(n=ci(n),i=ci(i)),s=t(n,i)}return s}}function Ui(t){return ns(function(e){return e=Oe(e,Ze(cs())),Xn(function(r){var n=this;return t(e,function(t){return Ce(t,n,r)})})})}function zi(t,e){var n=(e=e===r?" ":hi(e)).length;if(n<2)return n?Yn(e,t):e;var i=Yn(e,de(t/fr(e)));return or(e)?Ei(pr(i),0,t).join(""):i.slice(0,t)}function Wi(t){return function(e,n,i){return i&&"number"!=typeof i&&ws(e,n,i)&&(n=i=r),e=ga(e),n===r?(n=e,e=0):n=ga(n),function(t,e,r,n){for(var i=-1,s=yr(de((e-t)/(r||1)),0),o=ot(s);s--;)o[n?s:++i]=t,t+=r;return o}(e,n,i=i===r?e<n?1:-1:ga(i),t)}}function Gi(t){return function(e,r){return"string"==typeof e&&"string"==typeof r||(e=ma(e),r=ma(r)),t(e,r)}}function $i(t,e,n,i,s,o,c,h,l,f){var p=8&e;e|=p?a:u,4&(e&=~(p?u:a))||(e&=-4);var g=[t,e,s,p?o:r,p?c:r,p?r:o,p?r:c,h,l,f],d=n.apply(r,g);return Es(t)&&Ts(d,g),d.placeholder=i,_s(d,t,e)}function Ji(t){var e=Ct[t];return function(t,r){if(t=ma(t),(r=null==r?0:xr(da(r),292))&&Le(t)){var n=(xa(t)+"e").split("e");return+((n=(xa(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}var Yi=Dr&&1/hr(new Dr([,-0]))[1]==l?function(t){return new Dr(t)}:cu;function Xi(t){return function(e){var r=ds(e);return r==F?ar(e):r==I?lr(e):function(t,e){return Oe(e,function(e){return[e,t[e]]})}(e,t(e))}}function Zi(t,e,i,l,f,p,g,d){var v=2&e;if(!v&&"function"!=typeof t)throw new Tt(n);var m=l?l.length:0;if(m||(e&=-97,l=f=r),g=g===r?g:yr(da(g),0),d=d===r?d:da(d),m-=f?f.length:0,e&u){var y=l,x=f;l=f=r}var w=v?r:os(t),S=[t,e,i,l,f,y,x,p,g,d];if(w&&function(t,e){var r=t[1],n=e[1],i=r|n,o=i<131,a=n==c&&8==r||n==c&&r==h&&t[7].length<=e[8]||384==n&&e[7].length<=e[8]&&8==r;if(!o&&!a)return t;1&n&&(t[2]=e[2],i|=1&r?0:4);var u=e[3];if(u){var l=t[3];t[3]=l?Pi(l,u,e[4]):u,t[4]=l?cr(t[3],s):e[4]}(u=e[5])&&(l=t[5],t[5]=l?Ii(l,u,e[6]):u,t[6]=l?cr(t[5],s):e[6]);(u=e[7])&&(t[7]=u);n&c&&(t[8]=null==t[8]?e[8]:xr(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(S,w),t=S[0],e=S[1],i=S[2],l=S[3],f=S[4],!(d=S[9]=S[9]===r?v?0:t.length:yr(S[9]-m,0))&&24&e&&(e&=-25),e&&1!=e)E=8==e||e==o?function(t,e,n){var i=ki(t);return function s(){for(var o=arguments.length,a=ot(o),u=o,c=us(s);u--;)a[u]=arguments[u];var h=o<3&&a[0]!==c&&a[o-1]!==c?[]:cr(a,c);return(o-=h.length)<n?$i(t,e,Mi,s.placeholder,r,a,h,r,r,n-o):Ce(this&&this!==ge&&this instanceof s?i:t,this,a)}}(t,e,d):e!=a&&33!=e||f.length?Mi.apply(r,S):function(t,e,r,n){var i=1&e,s=ki(t);return function e(){for(var o=-1,a=arguments.length,u=-1,c=n.length,h=ot(c+a),l=this&&this!==ge&&this instanceof e?s:t;++u<c;)h[u]=n[u];for(;a--;)h[u++]=arguments[++o];return Ce(l,i?r:this,h)}}(t,e,i,l);else var E=function(t,e,r){var n=1&e,i=ki(t);return function e(){return(this&&this!==ge&&this instanceof e?i:t).apply(n?r:this,arguments)}}(t,e,i);return _s((w?ei:Ts)(E,S),t,e)}function Qi(t,e,n,i){return t===r||Mo(t,_t[n])&&!jt.call(i,n)?e:t}function ts(t,e,n,i,s,o){return ea(t)&&ea(e)&&(o.set(e,t),Kn(t,e,r,ts,o),o.delete(e)),t}function es(t){return sa(t)?r:t}function rs(t,e,n,i,s,o){var a=1&n,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var h=o.get(t),l=o.get(e);if(h&&l)return h==e&&l==t;var f=-1,p=!0,g=2&n?new $r:r;for(o.set(t,e),o.set(e,t);++f<u;){var d=t[f],v=e[f];if(i)var m=a?i(v,d,f,e,t,o):i(d,v,f,t,e,o);if(m!==r){if(m)continue;p=!1;break}if(g){if(!ke(e,function(t,e){if(!tr(g,e)&&(d===t||s(d,t,n,i,o)))return g.push(e)})){p=!1;break}}else if(d!==v&&!s(d,v,n,i,o)){p=!1;break}}return o.delete(t),o.delete(e),p}function ns(t){return Ns(Ds(t,r,zs),t+"")}function is(t){return An(t,Na,ps)}function ss(t){return An(t,_a,gs)}var os=Tr?function(t){return Tr.get(t)}:cu;function as(t){for(var e=t.name+"",r=Rr[e],n=jt.call(Rr,e)?r.length:0;n--;){var i=r[n],s=i.func;if(null==s||s==t)return i.name}return e}function us(t){return(jt.call(Vr,"placeholder")?Vr:t).placeholder}function cs(){var t=Vr.iteratee||su;return t=t===su?jn:t,arguments.length?t(arguments[0],arguments[1]):t}function hs(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function ls(t){for(var e=Na(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,As(i)]}return e}function fs(t,e){var n=function(t,e){return null==t?r:t[e]}(t,e);return Bn(n)?n:r}var ps=ye?function(t){return null==t?[]:(t=Dt(t),Re(ye(t),function(e){return Jt.call(t,e)}))}:vu,gs=ye?function(t){for(var e=[];t;)Be(e,ps(t)),t=Gt(t);return e}:vu,ds=Cn;function vs(t,e,r){for(var n=-1,i=(e=wi(e,t)).length,s=!1;++n<i;){var o=Hs(e[n]);if(!(s=null!=t&&r(t,o)))break;t=t[o]}return s||++n!=i?s:!!(i=null==t?0:t.length)&&ta(i)&&xs(o,i)&&(zo(t)||Uo(t))}function ms(t){return"function"!=typeof t.constructor||Fs(t)?{}:Mr(Gt(t))}function ys(t){return zo(t)||Uo(t)||!!(Xt&&t&&t[Xt])}function xs(t,e){var r=typeof t;return!!(e=null==e?f:e)&&("number"==r||"symbol"!=r&&xt.test(t))&&t>-1&&t%1==0&&t<e}function ws(t,e,r){if(!ea(r))return!1;var n=typeof e;return!!("number"==n?Go(r)&&xs(e,r.length):"string"==n&&e in r)&&Mo(r[e],t)}function Ss(t,e){if(zo(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!ca(t))||(et.test(t)||!tt.test(t)||null!=e&&t in Dt(e))}function Es(t){var e=as(t),r=Vr[e];if("function"!=typeof r||!(e in Ur.prototype))return!1;if(t===r)return!0;var n=os(r);return!!n&&t===n[0]}(Fr&&ds(new Fr(new ArrayBuffer(1)))!=O||Ar&&ds(new Ar)!=F||Cr&&ds(Cr.resolve())!=D||Dr&&ds(new Dr)!=I||Pr&&ds(new Pr)!=N)&&(ds=function(t){var e=Cn(t),n=e==C?t.constructor:r,i=n?ks(n):"";if(i)switch(i){case Nr:return O;case _r:return F;case Or:return D;case Br:return I;case jr:return N}return e});var bs=Ot?Zo:mu;function Fs(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||_t)}function As(t){return t==t&&!ea(t)}function Cs(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==r||t in Dt(n)))}}function Ds(t,e,n){return e=yr(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=yr(r.length-e,0),o=ot(s);++i<s;)o[i]=r[e+i];i=-1;for(var a=ot(e+1);++i<e;)a[i]=r[i];return a[e]=n(o),Ce(t,this,a)}}function Ps(t,e){return e.length<2?t:Fn(t,ii(e,0,-1))}function Is(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ts=Os(ei),Rs=pe||function(t,e){return ge.setTimeout(t,e)},Ns=Os(ri);function _s(t,e,r){var n=e+"";return Ns(t,function(t,e){var r=e.length;if(!r)return t;var n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(at,"{\n/* [wrapped with "+e+"] */\n")}(n,function(t,e){return Pe(v,function(r){var n="_."+r[0];e&r[1]&&!Ne(t,n)&&t.push(n)}),t.sort()}(function(t){var e=t.match(ut);return e?e[1].split(ct):[]}(n),r)))}function Os(t){var e=0,n=0;return function(){var i=wr(),s=16-(i-n);if(n=i,s>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(r,arguments)}}function Bs(t,e){var n=-1,i=t.length,s=i-1;for(e=e===r?i:e;++n<e;){var o=Jn(n,s),a=t[o];t[o]=t[n],t[n]=a}return t.length=e,t}var js=function(t){var e=Bo(t,function(t){return 500===r.size&&r.clear(),t}),r=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,function(t,r,n,i){e.push(n?i.replace(ft,"$1"):r||t)}),e});function Hs(t){if("string"==typeof t||ca(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ks(t){if(null!=t){try{return Bt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ls(t){if(t instanceof Ur)return t.clone();var e=new Kr(t.__wrapped__,t.__chain__);return e.__actions__=Ti(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Vs=Xn(function(t,e){return $o(t)?fn(t,yn(e,1,$o,!0)):[]}),Ms=Xn(function(t,e){var n=Ys(e);return $o(n)&&(n=r),$o(t)?fn(t,yn(e,1,$o,!0),cs(n,2)):[]}),qs=Xn(function(t,e){var n=Ys(e);return $o(n)&&(n=r),$o(t)?fn(t,yn(e,1,$o,!0),r,n):[]});function Ks(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:da(r);return i<0&&(i=yr(n+i,0)),Me(t,cs(e,3),i)}function Us(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var s=i-1;return n!==r&&(s=da(n),s=n<0?yr(i+s,0):xr(s,i-1)),Me(t,cs(e,3),s,!0)}function zs(t){return(null==t?0:t.length)?yn(t,1):[]}function Ws(t){return t&&t.length?t[0]:r}var Gs=Xn(function(t){var e=Oe(t,yi);return e.length&&e[0]===t[0]?Tn(e):[]}),$s=Xn(function(t){var e=Ys(t),n=Oe(t,yi);return e===Ys(n)?e=r:n.pop(),n.length&&n[0]===t[0]?Tn(n,cs(e,2)):[]}),Js=Xn(function(t){var e=Ys(t),n=Oe(t,yi);return(e="function"==typeof e?e:r)&&n.pop(),n.length&&n[0]===t[0]?Tn(n,r,e):[]});function Ys(t){var e=null==t?0:t.length;return e?t[e-1]:r}var Xs=Xn(Zs);function Zs(t,e){return t&&t.length&&e&&e.length?Gn(t,e):t}var Qs=ns(function(t,e){var r=null==t?0:t.length,n=an(t,e);return $n(t,Oe(e,function(t){return xs(t,r)?+t:t}).sort(Di)),n});function to(t){return null==t?t:br.call(t)}var eo=Xn(function(t){return li(yn(t,1,$o,!0))}),ro=Xn(function(t){var e=Ys(t);return $o(e)&&(e=r),li(yn(t,1,$o,!0),cs(e,2))}),no=Xn(function(t){var e=Ys(t);return e="function"==typeof e?e:r,li(yn(t,1,$o,!0),r,e)});function io(t){if(!t||!t.length)return[];var e=0;return t=Re(t,function(t){if($o(t))return e=yr(t.length,e),!0}),Ye(e,function(e){return Oe(t,We(e))})}function so(t,e){if(!t||!t.length)return[];var n=io(t);return null==e?n:Oe(n,function(t){return Ce(e,r,t)})}var oo=Xn(function(t,e){return $o(t)?fn(t,e):[]}),ao=Xn(function(t){return vi(Re(t,$o))}),uo=Xn(function(t){var e=Ys(t);return $o(e)&&(e=r),vi(Re(t,$o),cs(e,2))}),co=Xn(function(t){var e=Ys(t);return e="function"==typeof e?e:r,vi(Re(t,$o),r,e)}),ho=Xn(io);var lo=Xn(function(t){var e=t.length,n=e>1?t[e-1]:r;return n="function"==typeof n?(t.pop(),n):r,so(t,n)});function fo(t){var e=Vr(t);return e.__chain__=!0,e}function po(t,e){return e(t)}var go=ns(function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,s=function(e){return an(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Ur&&xs(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:po,args:[s],thisArg:r}),new Kr(i,this.__chain__).thru(function(t){return e&&!t.length&&t.push(r),t})):this.thru(s)});var vo=Ni(function(t,e,r){jt.call(t,r)?++t[r]:on(t,r,1)});var mo=Li(Ks),yo=Li(Us);function xo(t,e){return(zo(t)?Pe:pn)(t,cs(e,3))}function wo(t,e){return(zo(t)?Ie:gn)(t,cs(e,3))}var So=Ni(function(t,e,r){jt.call(t,r)?t[r].push(e):on(t,r,[e])});var Eo=Xn(function(t,e,r){var n=-1,i="function"==typeof e,s=Go(t)?ot(t.length):[];return pn(t,function(t){s[++n]=i?Ce(e,t,r):Rn(t,e,r)}),s}),bo=Ni(function(t,e,r){on(t,r,e)});function Fo(t,e){return(zo(t)?Oe:Vn)(t,cs(e,3))}var Ao=Ni(function(t,e,r){t[r?0:1].push(e)},function(){return[[],[]]});var Co=Xn(function(t,e){if(null==t)return[];var r=e.length;return r>1&&ws(t,e[0],e[1])?e=[]:r>2&&ws(e[0],e[1],e[2])&&(e=[e[0]]),zn(t,yn(e,1),[])}),Do=fe||function(){return ge.Date.now()};function Po(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Zi(t,c,r,r,r,r,e)}function Io(t,e){var i;if("function"!=typeof e)throw new Tt(n);return t=da(t),function(){return--t>0&&(i=e.apply(this,arguments)),t<=1&&(e=r),i}}var To=Xn(function(t,e,r){var n=1;if(r.length){var i=cr(r,us(To));n|=a}return Zi(t,n,e,r,i)}),Ro=Xn(function(t,e,r){var n=3;if(r.length){var i=cr(r,us(Ro));n|=a}return Zi(e,n,t,r,i)});function No(t,e,i){var s,o,a,u,c,h,l=0,f=!1,p=!1,g=!0;if("function"!=typeof t)throw new Tt(n);function d(e){var n=s,i=o;return s=o=r,l=e,u=t.apply(i,n)}function v(t){var n=t-h;return h===r||n>=e||n<0||p&&t-l>=a}function m(){var t=Do();if(v(t))return y(t);c=Rs(m,function(t){var r=e-(t-h);return p?xr(r,a-(t-l)):r}(t))}function y(t){return c=r,g&&s?d(t):(s=o=r,u)}function x(){var t=Do(),n=v(t);if(s=arguments,o=this,h=t,n){if(c===r)return function(t){return l=t,c=Rs(m,e),f?d(t):u}(h);if(p)return bi(c),c=Rs(m,e),d(h)}return c===r&&(c=Rs(m,e)),u}return e=ma(e)||0,ea(i)&&(f=!!i.leading,a=(p="maxWait"in i)?yr(ma(i.maxWait)||0,e):a,g="trailing"in i?!!i.trailing:g),x.cancel=function(){c!==r&&bi(c),l=0,s=h=o=c=r},x.flush=function(){return c===r?u:y(Do())},x}var _o=Xn(function(t,e){return ln(t,1,e)}),Oo=Xn(function(t,e,r){return ln(t,ma(e)||0,r)});function Bo(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Tt(n);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var o=t.apply(this,n);return r.cache=s.set(i,o)||s,o};return r.cache=new(Bo.Cache||Gr),r}function jo(t){if("function"!=typeof t)throw new Tt(n);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Bo.Cache=Gr;var Ho=Si(function(t,e){var r=(e=1==e.length&&zo(e[0])?Oe(e[0],Ze(cs())):Oe(yn(e,1),Ze(cs()))).length;return Xn(function(n){for(var i=-1,s=xr(n.length,r);++i<s;)n[i]=e[i].call(this,n[i]);return Ce(t,this,n)})}),ko=Xn(function(t,e){var n=cr(e,us(ko));return Zi(t,a,r,e,n)}),Lo=Xn(function(t,e){var n=cr(e,us(Lo));return Zi(t,u,r,e,n)}),Vo=ns(function(t,e){return Zi(t,h,r,r,r,e)});function Mo(t,e){return t===e||t!=t&&e!=e}var qo=Gi(Dn),Ko=Gi(function(t,e){return t>=e}),Uo=Nn(function(){return arguments}())?Nn:function(t){return ra(t)&&jt.call(t,"callee")&&!Jt.call(t,"callee")},zo=ot.isArray,Wo=we?Ze(we):function(t){return ra(t)&&Cn(t)==_};function Go(t){return null!=t&&ta(t.length)&&!Zo(t)}function $o(t){return ra(t)&&Go(t)}var Jo=xe||mu,Yo=Se?Ze(Se):function(t){return ra(t)&&Cn(t)==w};function Xo(t){if(!ra(t))return!1;var e=Cn(t);return e==S||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!sa(t)}function Zo(t){if(!ea(t))return!1;var e=Cn(t);return e==E||e==b||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Qo(t){return"number"==typeof t&&t==da(t)}function ta(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function ea(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function ra(t){return null!=t&&"object"==typeof t}var na=Ee?Ze(Ee):function(t){return ra(t)&&ds(t)==F};function ia(t){return"number"==typeof t||ra(t)&&Cn(t)==A}function sa(t){if(!ra(t)||Cn(t)!=C)return!1;var e=Gt(t);if(null===e)return!0;var r=jt.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Bt.call(r)==Vt}var oa=be?Ze(be):function(t){return ra(t)&&Cn(t)==P};var aa=Fe?Ze(Fe):function(t){return ra(t)&&ds(t)==I};function ua(t){return"string"==typeof t||!zo(t)&&ra(t)&&Cn(t)==T}function ca(t){return"symbol"==typeof t||ra(t)&&Cn(t)==R}var ha=Ae?Ze(Ae):function(t){return ra(t)&&ta(t.length)&&!!ae[Cn(t)]};var la=Gi(Ln),fa=Gi(function(t,e){return t<=e});function pa(t){if(!t)return[];if(Go(t))return ua(t)?pr(t):Ti(t);if(Zt&&t[Zt])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[Zt]());var e=ds(t);return(e==F?ar:e==I?hr:Ma)(t)}function ga(t){return t?(t=ma(t))===l||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function da(t){var e=ga(t),r=e%1;return e==e?r?e-r:e:0}function va(t){return t?un(da(t),0,d):0}function ma(t){if("number"==typeof t)return t;if(ca(t))return g;if(ea(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=ea(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Xe(t);var r=vt.test(t);return r||yt.test(t)?le(t.slice(2),r?2:8):dt.test(t)?g:+t}function ya(t){return Ri(t,_a(t))}function xa(t){return null==t?"":hi(t)}var wa=_i(function(t,e){if(Fs(e)||Go(e))Ri(e,Na(e),t);else for(var r in e)jt.call(e,r)&&en(t,r,e[r])}),Sa=_i(function(t,e){Ri(e,_a(e),t)}),Ea=_i(function(t,e,r,n){Ri(e,_a(e),t,n)}),ba=_i(function(t,e,r,n){Ri(e,Na(e),t,n)}),Fa=ns(an);var Aa=Xn(function(t,e){t=Dt(t);var n=-1,i=e.length,s=i>2?e[2]:r;for(s&&ws(e[0],e[1],s)&&(i=1);++n<i;)for(var o=e[n],a=_a(o),u=-1,c=a.length;++u<c;){var h=a[u],l=t[h];(l===r||Mo(l,_t[h])&&!jt.call(t,h))&&(t[h]=o[h])}return t}),Ca=Xn(function(t){return t.push(r,ts),Ce(Ba,r,t)});function Da(t,e,n){var i=null==t?r:Fn(t,e);return i===r?n:i}function Pa(t,e){return null!=t&&vs(t,e,In)}var Ia=qi(function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Lt.call(e)),t[e]=r},eu(iu)),Ta=qi(function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Lt.call(e)),jt.call(t,e)?t[e].push(r):t[e]=[r]},cs),Ra=Xn(Rn);function Na(t){return Go(t)?Yr(t):Hn(t)}function _a(t){return Go(t)?Yr(t,!0):kn(t)}var Oa=_i(function(t,e,r){Kn(t,e,r)}),Ba=_i(function(t,e,r,n){Kn(t,e,r,n)}),ja=ns(function(t,e){var r={};if(null==t)return r;var n=!1;e=Oe(e,function(e){return e=wi(e,t),n||(n=e.length>1),e}),Ri(t,ss(t),r),n&&(r=cn(r,7,es));for(var i=e.length;i--;)fi(r,e[i]);return r});var Ha=ns(function(t,e){return null==t?{}:function(t,e){return Wn(t,e,function(e,r){return Pa(t,r)})}(t,e)});function ka(t,e){if(null==t)return{};var r=Oe(ss(t),function(t){return[t]});return e=cs(e),Wn(t,r,function(t,r){return e(t,r[0])})}var La=Xi(Na),Va=Xi(_a);function Ma(t){return null==t?[]:Qe(t,Na(t))}var qa=Hi(function(t,e,r){return e=e.toLowerCase(),t+(r?Ka(e):e)});function Ka(t){return Xa(xa(t).toLowerCase())}function Ua(t){return(t=xa(t))&&t.replace(wt,nr).replace(te,"")}var za=Hi(function(t,e,r){return t+(r?"-":"")+e.toLowerCase()}),Wa=Hi(function(t,e,r){return t+(r?" ":"")+e.toLowerCase()}),Ga=ji("toLowerCase");var $a=Hi(function(t,e,r){return t+(r?"_":"")+e.toLowerCase()});var Ja=Hi(function(t,e,r){return t+(r?" ":"")+Xa(e)});var Ya=Hi(function(t,e,r){return t+(r?" ":"")+e.toUpperCase()}),Xa=ji("toUpperCase");function Za(t,e,n){return t=xa(t),(e=n?r:e)===r?function(t){return ie.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Qa=Xn(function(t,e){try{return Ce(t,r,e)}catch(t){return Xo(t)?t:new Ft(t)}}),tu=ns(function(t,e){return Pe(e,function(e){e=Hs(e),on(t,e,To(t[e],t))}),t});function eu(t){return function(){return t}}var ru=Vi(),nu=Vi(!0);function iu(t){return t}function su(t){return jn("function"==typeof t?t:cn(t,1))}var ou=Xn(function(t,e){return function(r){return Rn(r,t,e)}}),au=Xn(function(t,e){return function(r){return Rn(t,r,e)}});function uu(t,e,r){var n=Na(e),i=bn(e,n);null!=r||ea(e)&&(i.length||!n.length)||(r=e,e=t,t=this,i=bn(e,Na(e)));var s=!(ea(r)&&"chain"in r&&!r.chain),o=Zo(t);return Pe(i,function(r){var n=e[r];t[r]=n,o&&(t.prototype[r]=function(){var e=this.__chain__;if(s||e){var r=t(this.__wrapped__);return(r.__actions__=Ti(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,Be([this.value()],arguments))})}),t}function cu(){}var hu=Ui(Oe),lu=Ui(Te),fu=Ui(ke);function pu(t){return Ss(t)?We(Hs(t)):function(t){return function(e){return Fn(e,t)}}(t)}var gu=Wi(),du=Wi(!0);function vu(){return[]}function mu(){return!1}var yu=Ki(function(t,e){return t+e},0),xu=Ji("ceil"),wu=Ki(function(t,e){return t/e},1),Su=Ji("floor");var Eu,bu=Ki(function(t,e){return t*e},1),Fu=Ji("round"),Au=Ki(function(t,e){return t-e},0);return Vr.after=function(t,e){if("function"!=typeof e)throw new Tt(n);return t=da(t),function(){if(--t<1)return e.apply(this,arguments)}},Vr.ary=Po,Vr.assign=wa,Vr.assignIn=Sa,Vr.assignInWith=Ea,Vr.assignWith=ba,Vr.at=Fa,Vr.before=Io,Vr.bind=To,Vr.bindAll=tu,Vr.bindKey=Ro,Vr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return zo(t)?t:[t]},Vr.chain=fo,Vr.chunk=function(t,e,n){e=(n?ws(t,e,n):e===r)?1:yr(da(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var s=0,o=0,a=ot(de(i/e));s<i;)a[o++]=ii(t,s,s+=e);return a},Vr.compact=function(t){for(var e=-1,r=null==t?0:t.length,n=0,i=[];++e<r;){var s=t[e];s&&(i[n++]=s)}return i},Vr.concat=function(){var t=arguments.length;if(!t)return[];for(var e=ot(t-1),r=arguments[0],n=t;n--;)e[n-1]=arguments[n];return Be(zo(r)?Ti(r):[r],yn(e,1))},Vr.cond=function(t){var e=null==t?0:t.length,r=cs();return t=e?Oe(t,function(t){if("function"!=typeof t[1])throw new Tt(n);return[r(t[0]),t[1]]}):[],Xn(function(r){for(var n=-1;++n<e;){var i=t[n];if(Ce(i[0],this,r))return Ce(i[1],this,r)}})},Vr.conforms=function(t){return function(t){var e=Na(t);return function(r){return hn(r,t,e)}}(cn(t,1))},Vr.constant=eu,Vr.countBy=vo,Vr.create=function(t,e){var r=Mr(t);return null==e?r:sn(r,e)},Vr.curry=function t(e,n,i){var s=Zi(e,8,r,r,r,r,r,n=i?r:n);return s.placeholder=t.placeholder,s},Vr.curryRight=function t(e,n,i){var s=Zi(e,o,r,r,r,r,r,n=i?r:n);return s.placeholder=t.placeholder,s},Vr.debounce=No,Vr.defaults=Aa,Vr.defaultsDeep=Ca,Vr.defer=_o,Vr.delay=Oo,Vr.difference=Vs,Vr.differenceBy=Ms,Vr.differenceWith=qs,Vr.drop=function(t,e,n){var i=null==t?0:t.length;return i?ii(t,(e=n||e===r?1:da(e))<0?0:e,i):[]},Vr.dropRight=function(t,e,n){var i=null==t?0:t.length;return i?ii(t,0,(e=i-(e=n||e===r?1:da(e)))<0?0:e):[]},Vr.dropRightWhile=function(t,e){return t&&t.length?gi(t,cs(e,3),!0,!0):[]},Vr.dropWhile=function(t,e){return t&&t.length?gi(t,cs(e,3),!0):[]},Vr.fill=function(t,e,n,i){var s=null==t?0:t.length;return s?(n&&"number"!=typeof n&&ws(t,e,n)&&(n=0,i=s),function(t,e,n,i){var s=t.length;for((n=da(n))<0&&(n=-n>s?0:s+n),(i=i===r||i>s?s:da(i))<0&&(i+=s),i=n>i?0:va(i);n<i;)t[n++]=e;return t}(t,e,n,i)):[]},Vr.filter=function(t,e){return(zo(t)?Re:mn)(t,cs(e,3))},Vr.flatMap=function(t,e){return yn(Fo(t,e),1)},Vr.flatMapDeep=function(t,e){return yn(Fo(t,e),l)},Vr.flatMapDepth=function(t,e,n){return n=n===r?1:da(n),yn(Fo(t,e),n)},Vr.flatten=zs,Vr.flattenDeep=function(t){return(null==t?0:t.length)?yn(t,l):[]},Vr.flattenDepth=function(t,e){return(null==t?0:t.length)?yn(t,e=e===r?1:da(e)):[]},Vr.flip=function(t){return Zi(t,512)},Vr.flow=ru,Vr.flowRight=nu,Vr.fromPairs=function(t){for(var e=-1,r=null==t?0:t.length,n={};++e<r;){var i=t[e];n[i[0]]=i[1]}return n},Vr.functions=function(t){return null==t?[]:bn(t,Na(t))},Vr.functionsIn=function(t){return null==t?[]:bn(t,_a(t))},Vr.groupBy=So,Vr.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},Vr.intersection=Gs,Vr.intersectionBy=$s,Vr.intersectionWith=Js,Vr.invert=Ia,Vr.invertBy=Ta,Vr.invokeMap=Eo,Vr.iteratee=su,Vr.keyBy=bo,Vr.keys=Na,Vr.keysIn=_a,Vr.map=Fo,Vr.mapKeys=function(t,e){var r={};return e=cs(e,3),Sn(t,function(t,n,i){on(r,e(t,n,i),t)}),r},Vr.mapValues=function(t,e){var r={};return e=cs(e,3),Sn(t,function(t,n,i){on(r,n,e(t,n,i))}),r},Vr.matches=function(t){return Mn(cn(t,1))},Vr.matchesProperty=function(t,e){return qn(t,cn(e,1))},Vr.memoize=Bo,Vr.merge=Oa,Vr.mergeWith=Ba,Vr.method=ou,Vr.methodOf=au,Vr.mixin=uu,Vr.negate=jo,Vr.nthArg=function(t){return t=da(t),Xn(function(e){return Un(e,t)})},Vr.omit=ja,Vr.omitBy=function(t,e){return ka(t,jo(cs(e)))},Vr.once=function(t){return Io(2,t)},Vr.orderBy=function(t,e,n,i){return null==t?[]:(zo(e)||(e=null==e?[]:[e]),zo(n=i?r:n)||(n=null==n?[]:[n]),zn(t,e,n))},Vr.over=hu,Vr.overArgs=Ho,Vr.overEvery=lu,Vr.overSome=fu,Vr.partial=ko,Vr.partialRight=Lo,Vr.partition=Ao,Vr.pick=Ha,Vr.pickBy=ka,Vr.property=pu,Vr.propertyOf=function(t){return function(e){return null==t?r:Fn(t,e)}},Vr.pull=Xs,Vr.pullAll=Zs,Vr.pullAllBy=function(t,e,r){return t&&t.length&&e&&e.length?Gn(t,e,cs(r,2)):t},Vr.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Gn(t,e,r,n):t},Vr.pullAt=Qs,Vr.range=gu,Vr.rangeRight=du,Vr.rearg=Vo,Vr.reject=function(t,e){return(zo(t)?Re:mn)(t,jo(cs(e,3)))},Vr.remove=function(t,e){var r=[];if(!t||!t.length)return r;var n=-1,i=[],s=t.length;for(e=cs(e,3);++n<s;){var o=t[n];e(o,n,t)&&(r.push(o),i.push(n))}return $n(t,i),r},Vr.rest=function(t,e){if("function"!=typeof t)throw new Tt(n);return Xn(t,e=e===r?e:da(e))},Vr.reverse=to,Vr.sampleSize=function(t,e,n){return e=(n?ws(t,e,n):e===r)?1:da(e),(zo(t)?Zr:Qn)(t,e)},Vr.set=function(t,e,r){return null==t?t:ti(t,e,r)},Vr.setWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ti(t,e,n,i)},Vr.shuffle=function(t){return(zo(t)?Qr:ni)(t)},Vr.slice=function(t,e,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&ws(t,e,n)?(e=0,n=i):(e=null==e?0:da(e),n=n===r?i:da(n)),ii(t,e,n)):[]},Vr.sortBy=Co,Vr.sortedUniq=function(t){return t&&t.length?ui(t):[]},Vr.sortedUniqBy=function(t,e){return t&&t.length?ui(t,cs(e,2)):[]},Vr.split=function(t,e,n){return n&&"number"!=typeof n&&ws(t,e,n)&&(e=n=r),(n=n===r?d:n>>>0)?(t=xa(t))&&("string"==typeof e||null!=e&&!oa(e))&&!(e=hi(e))&&or(t)?Ei(pr(t),0,n):t.split(e,n):[]},Vr.spread=function(t,e){if("function"!=typeof t)throw new Tt(n);return e=null==e?0:yr(da(e),0),Xn(function(r){var n=r[e],i=Ei(r,0,e);return n&&Be(i,n),Ce(t,this,i)})},Vr.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},Vr.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===r?1:da(e))<0?0:e):[]},Vr.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?ii(t,(e=i-(e=n||e===r?1:da(e)))<0?0:e,i):[]},Vr.takeRightWhile=function(t,e){return t&&t.length?gi(t,cs(e,3),!1,!0):[]},Vr.takeWhile=function(t,e){return t&&t.length?gi(t,cs(e,3)):[]},Vr.tap=function(t,e){return e(t),t},Vr.throttle=function(t,e,r){var i=!0,s=!0;if("function"!=typeof t)throw new Tt(n);return ea(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),No(t,e,{leading:i,maxWait:e,trailing:s})},Vr.thru=po,Vr.toArray=pa,Vr.toPairs=La,Vr.toPairsIn=Va,Vr.toPath=function(t){return zo(t)?Oe(t,Hs):ca(t)?[t]:Ti(js(xa(t)))},Vr.toPlainObject=ya,Vr.transform=function(t,e,r){var n=zo(t),i=n||Jo(t)||ha(t);if(e=cs(e,4),null==r){var s=t&&t.constructor;r=i?n?new s:[]:ea(t)&&Zo(s)?Mr(Gt(t)):{}}return(i?Pe:Sn)(t,function(t,n,i){return e(r,t,n,i)}),r},Vr.unary=function(t){return Po(t,1)},Vr.union=eo,Vr.unionBy=ro,Vr.unionWith=no,Vr.uniq=function(t){return t&&t.length?li(t):[]},Vr.uniqBy=function(t,e){return t&&t.length?li(t,cs(e,2)):[]},Vr.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?li(t,r,e):[]},Vr.unset=function(t,e){return null==t||fi(t,e)},Vr.unzip=io,Vr.unzipWith=so,Vr.update=function(t,e,r){return null==t?t:pi(t,e,xi(r))},Vr.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:pi(t,e,xi(n),i)},Vr.values=Ma,Vr.valuesIn=function(t){return null==t?[]:Qe(t,_a(t))},Vr.without=oo,Vr.words=Za,Vr.wrap=function(t,e){return ko(xi(e),t)},Vr.xor=ao,Vr.xorBy=uo,Vr.xorWith=co,Vr.zip=ho,Vr.zipObject=function(t,e){return mi(t||[],e||[],en)},Vr.zipObjectDeep=function(t,e){return mi(t||[],e||[],ti)},Vr.zipWith=lo,Vr.entries=La,Vr.entriesIn=Va,Vr.extend=Sa,Vr.extendWith=Ea,uu(Vr,Vr),Vr.add=yu,Vr.attempt=Qa,Vr.camelCase=qa,Vr.capitalize=Ka,Vr.ceil=xu,Vr.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=ma(n))==n?n:0),e!==r&&(e=(e=ma(e))==e?e:0),un(ma(t),e,n)},Vr.clone=function(t){return cn(t,4)},Vr.cloneDeep=function(t){return cn(t,5)},Vr.cloneDeepWith=function(t,e){return cn(t,5,e="function"==typeof e?e:r)},Vr.cloneWith=function(t,e){return cn(t,4,e="function"==typeof e?e:r)},Vr.conformsTo=function(t,e){return null==e||hn(t,e,Na(e))},Vr.deburr=Ua,Vr.defaultTo=function(t,e){return null==t||t!=t?e:t},Vr.divide=wu,Vr.endsWith=function(t,e,n){t=xa(t),e=hi(e);var i=t.length,s=n=n===r?i:un(da(n),0,i);return(n-=e.length)>=0&&t.slice(n,s)==e},Vr.eq=Mo,Vr.escape=function(t){return(t=xa(t))&&Y.test(t)?t.replace($,ir):t},Vr.escapeRegExp=function(t){return(t=xa(t))&&it.test(t)?t.replace(nt,"\\$&"):t},Vr.every=function(t,e,n){var i=zo(t)?Te:dn;return n&&ws(t,e,n)&&(e=r),i(t,cs(e,3))},Vr.find=mo,Vr.findIndex=Ks,Vr.findKey=function(t,e){return Ve(t,cs(e,3),Sn)},Vr.findLast=yo,Vr.findLastIndex=Us,Vr.findLastKey=function(t,e){return Ve(t,cs(e,3),En)},Vr.floor=Su,Vr.forEach=xo,Vr.forEachRight=wo,Vr.forIn=function(t,e){return null==t?t:xn(t,cs(e,3),_a)},Vr.forInRight=function(t,e){return null==t?t:wn(t,cs(e,3),_a)},Vr.forOwn=function(t,e){return t&&Sn(t,cs(e,3))},Vr.forOwnRight=function(t,e){return t&&En(t,cs(e,3))},Vr.get=Da,Vr.gt=qo,Vr.gte=Ko,Vr.has=function(t,e){return null!=t&&vs(t,e,Pn)},Vr.hasIn=Pa,Vr.head=Ws,Vr.identity=iu,Vr.includes=function(t,e,r,n){t=Go(t)?t:Ma(t),r=r&&!n?da(r):0;var i=t.length;return r<0&&(r=yr(i+r,0)),ua(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&qe(t,e,r)>-1},Vr.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:da(r);return i<0&&(i=yr(n+i,0)),qe(t,e,i)},Vr.inRange=function(t,e,n){return e=ga(e),n===r?(n=e,e=0):n=ga(n),function(t,e,r){return t>=xr(e,r)&&t<yr(e,r)}(t=ma(t),e,n)},Vr.invoke=Ra,Vr.isArguments=Uo,Vr.isArray=zo,Vr.isArrayBuffer=Wo,Vr.isArrayLike=Go,Vr.isArrayLikeObject=$o,Vr.isBoolean=function(t){return!0===t||!1===t||ra(t)&&Cn(t)==x},Vr.isBuffer=Jo,Vr.isDate=Yo,Vr.isElement=function(t){return ra(t)&&1===t.nodeType&&!sa(t)},Vr.isEmpty=function(t){if(null==t)return!0;if(Go(t)&&(zo(t)||"string"==typeof t||"function"==typeof t.splice||Jo(t)||ha(t)||Uo(t)))return!t.length;var e=ds(t);if(e==F||e==I)return!t.size;if(Fs(t))return!Hn(t).length;for(var r in t)if(jt.call(t,r))return!1;return!0},Vr.isEqual=function(t,e){return _n(t,e)},Vr.isEqualWith=function(t,e,n){var i=(n="function"==typeof n?n:r)?n(t,e):r;return i===r?_n(t,e,r,n):!!i},Vr.isError=Xo,Vr.isFinite=function(t){return"number"==typeof t&&Le(t)},Vr.isFunction=Zo,Vr.isInteger=Qo,Vr.isLength=ta,Vr.isMap=na,Vr.isMatch=function(t,e){return t===e||On(t,e,ls(e))},Vr.isMatchWith=function(t,e,n){return n="function"==typeof n?n:r,On(t,e,ls(e),n)},Vr.isNaN=function(t){return ia(t)&&t!=+t},Vr.isNative=function(t){if(bs(t))throw new Ft("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Bn(t)},Vr.isNil=function(t){return null==t},Vr.isNull=function(t){return null===t},Vr.isNumber=ia,Vr.isObject=ea,Vr.isObjectLike=ra,Vr.isPlainObject=sa,Vr.isRegExp=oa,Vr.isSafeInteger=function(t){return Qo(t)&&t>=-9007199254740991&&t<=f},Vr.isSet=aa,Vr.isString=ua,Vr.isSymbol=ca,Vr.isTypedArray=ha,Vr.isUndefined=function(t){return t===r},Vr.isWeakMap=function(t){return ra(t)&&ds(t)==N},Vr.isWeakSet=function(t){return ra(t)&&"[object WeakSet]"==Cn(t)},Vr.join=function(t,e){return null==t?"":Ge.call(t,e)},Vr.kebabCase=za,Vr.last=Ys,Vr.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var s=i;return n!==r&&(s=(s=da(n))<0?yr(i+s,0):xr(s,i-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,s):Me(t,Ue,s,!0)},Vr.lowerCase=Wa,Vr.lowerFirst=Ga,Vr.lt=la,Vr.lte=fa,Vr.max=function(t){return t&&t.length?vn(t,iu,Dn):r},Vr.maxBy=function(t,e){return t&&t.length?vn(t,cs(e,2),Dn):r},Vr.mean=function(t){return ze(t,iu)},Vr.meanBy=function(t,e){return ze(t,cs(e,2))},Vr.min=function(t){return t&&t.length?vn(t,iu,Ln):r},Vr.minBy=function(t,e){return t&&t.length?vn(t,cs(e,2),Ln):r},Vr.stubArray=vu,Vr.stubFalse=mu,Vr.stubObject=function(){return{}},Vr.stubString=function(){return""},Vr.stubTrue=function(){return!0},Vr.multiply=bu,Vr.nth=function(t,e){return t&&t.length?Un(t,da(e)):r},Vr.noConflict=function(){return ge._===this&&(ge._=Mt),this},Vr.noop=cu,Vr.now=Do,Vr.pad=function(t,e,r){t=xa(t);var n=(e=da(e))?fr(t):0;if(!e||n>=e)return t;var i=(e-n)/2;return zi(ve(i),r)+t+zi(de(i),r)},Vr.padEnd=function(t,e,r){t=xa(t);var n=(e=da(e))?fr(t):0;return e&&n<e?t+zi(e-n,r):t},Vr.padStart=function(t,e,r){t=xa(t);var n=(e=da(e))?fr(t):0;return e&&n<e?zi(e-n,r)+t:t},Vr.parseInt=function(t,e,r){return r||null==e?e=0:e&&(e=+e),Sr(xa(t).replace(st,""),e||0)},Vr.random=function(t,e,n){if(n&&"boolean"!=typeof n&&ws(t,e,n)&&(e=n=r),n===r&&("boolean"==typeof e?(n=e,e=r):"boolean"==typeof t&&(n=t,t=r)),t===r&&e===r?(t=0,e=1):(t=ga(t),e===r?(e=t,t=0):e=ga(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var s=Er();return xr(t+s*(e-t+he("1e-"+((s+"").length-1))),e)}return Jn(t,e)},Vr.reduce=function(t,e,r){var n=zo(t)?je:$e,i=arguments.length<3;return n(t,cs(e,4),r,i,pn)},Vr.reduceRight=function(t,e,r){var n=zo(t)?He:$e,i=arguments.length<3;return n(t,cs(e,4),r,i,gn)},Vr.repeat=function(t,e,n){return e=(n?ws(t,e,n):e===r)?1:da(e),Yn(xa(t),e)},Vr.replace=function(){var t=arguments,e=xa(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Vr.result=function(t,e,n){var i=-1,s=(e=wi(e,t)).length;for(s||(s=1,t=r);++i<s;){var o=null==t?r:t[Hs(e[i])];o===r&&(i=s,o=n),t=Zo(o)?o.call(t):o}return t},Vr.round=Fu,Vr.runInContext=t,Vr.sample=function(t){return(zo(t)?Xr:Zn)(t)},Vr.size=function(t){if(null==t)return 0;if(Go(t))return ua(t)?fr(t):t.length;var e=ds(t);return e==F||e==I?t.size:Hn(t).length},Vr.snakeCase=$a,Vr.some=function(t,e,n){var i=zo(t)?ke:si;return n&&ws(t,e,n)&&(e=r),i(t,cs(e,3))},Vr.sortedIndex=function(t,e){return oi(t,e)},Vr.sortedIndexBy=function(t,e,r){return ai(t,e,cs(r,2))},Vr.sortedIndexOf=function(t,e){var r=null==t?0:t.length;if(r){var n=oi(t,e);if(n<r&&Mo(t[n],e))return n}return-1},Vr.sortedLastIndex=function(t,e){return oi(t,e,!0)},Vr.sortedLastIndexBy=function(t,e,r){return ai(t,e,cs(r,2),!0)},Vr.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var r=oi(t,e,!0)-1;if(Mo(t[r],e))return r}return-1},Vr.startCase=Ja,Vr.startsWith=function(t,e,r){return t=xa(t),r=null==r?0:un(da(r),0,t.length),e=hi(e),t.slice(r,r+e.length)==e},Vr.subtract=Au,Vr.sum=function(t){return t&&t.length?Je(t,iu):0},Vr.sumBy=function(t,e){return t&&t.length?Je(t,cs(e,2)):0},Vr.template=function(t,e,n){var i=Vr.templateSettings;n&&ws(t,e,n)&&(e=r),t=xa(t),e=Ea({},e,i,Qi);var s,o,a=Ea({},e.imports,i.imports,Qi),u=Na(a),c=Qe(a,u),h=0,l=e.interpolate||St,f="__p += '",p=Pt((e.escape||St).source+"|"+l.source+"|"+(l===Q?pt:St).source+"|"+(e.evaluate||St).source+"|$","g"),g="//# sourceURL="+(jt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++oe+"]")+"\n";t.replace(p,function(e,r,n,i,a,u){return n||(n=i),f+=t.slice(h,u).replace(Et,sr),r&&(s=!0,f+="' +\n__e("+r+") +\n'"),a&&(o=!0,f+="';\n"+a+";\n__p += '"),n&&(f+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),h=u+e.length,e}),f+="';\n";var d=jt.call(e,"variable")&&e.variable;if(d){if(lt.test(d))throw new Ft("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(o?f.replace(U,""):f).replace(z,"$1").replace(W,"$1;"),f="function("+(d||"obj")+") {\n"+(d?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(o?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var v=Qa(function(){return At(u,g+"return "+f).apply(r,c)});if(v.source=f,Xo(v))throw v;return v},Vr.times=function(t,e){if((t=da(t))<1||t>f)return[];var r=d,n=xr(t,d);e=cs(e),t-=d;for(var i=Ye(n,e);++r<t;)e(r);return i},Vr.toFinite=ga,Vr.toInteger=da,Vr.toLength=va,Vr.toLower=function(t){return xa(t).toLowerCase()},Vr.toNumber=ma,Vr.toSafeInteger=function(t){return t?un(da(t),-9007199254740991,f):0===t?t:0},Vr.toString=xa,Vr.toUpper=function(t){return xa(t).toUpperCase()},Vr.trim=function(t,e,n){if((t=xa(t))&&(n||e===r))return Xe(t);if(!t||!(e=hi(e)))return t;var i=pr(t),s=pr(e);return Ei(i,er(i,s),rr(i,s)+1).join("")},Vr.trimEnd=function(t,e,n){if((t=xa(t))&&(n||e===r))return t.slice(0,gr(t)+1);if(!t||!(e=hi(e)))return t;var i=pr(t);return Ei(i,0,rr(i,pr(e))+1).join("")},Vr.trimStart=function(t,e,n){if((t=xa(t))&&(n||e===r))return t.replace(st,"");if(!t||!(e=hi(e)))return t;var i=pr(t);return Ei(i,er(i,pr(e))).join("")},Vr.truncate=function(t,e){var n=30,i="...";if(ea(e)){var s="separator"in e?e.separator:s;n="length"in e?da(e.length):n,i="omission"in e?hi(e.omission):i}var o=(t=xa(t)).length;if(or(t)){var a=pr(t);o=a.length}if(n>=o)return t;var u=n-fr(i);if(u<1)return i;var c=a?Ei(a,0,u).join(""):t.slice(0,u);if(s===r)return c+i;if(a&&(u+=c.length-u),oa(s)){if(t.slice(u).search(s)){var h,l=c;for(s.global||(s=Pt(s.source,xa(gt.exec(s))+"g")),s.lastIndex=0;h=s.exec(l);)var f=h.index;c=c.slice(0,f===r?u:f)}}else if(t.indexOf(hi(s),u)!=u){var p=c.lastIndexOf(s);p>-1&&(c=c.slice(0,p))}return c+i},Vr.unescape=function(t){return(t=xa(t))&&J.test(t)?t.replace(G,dr):t},Vr.uniqueId=function(t){var e=++Ht;return xa(t)+e},Vr.upperCase=Ya,Vr.upperFirst=Xa,Vr.each=xo,Vr.eachRight=wo,Vr.first=Ws,uu(Vr,(Eu={},Sn(Vr,function(t,e){jt.call(Vr.prototype,e)||(Eu[e]=t)}),Eu),{chain:!1}),Vr.VERSION="4.17.21",Pe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Vr[t].placeholder=Vr}),Pe(["drop","take"],function(t,e){Ur.prototype[t]=function(n){n=n===r?1:yr(da(n),0);var i=this.__filtered__&&!e?new Ur(this):this.clone();return i.__filtered__?i.__takeCount__=xr(n,i.__takeCount__):i.__views__.push({size:xr(n,d),type:t+(i.__dir__<0?"Right":"")}),i},Ur.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Pe(["filter","map","takeWhile"],function(t,e){var r=e+1,n=1==r||3==r;Ur.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:cs(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}}),Pe(["head","last"],function(t,e){var r="take"+(e?"Right":"");Ur.prototype[t]=function(){return this[r](1).value()[0]}}),Pe(["initial","tail"],function(t,e){var r="drop"+(e?"":"Right");Ur.prototype[t]=function(){return this.__filtered__?new Ur(this):this[r](1)}}),Ur.prototype.compact=function(){return this.filter(iu)},Ur.prototype.find=function(t){return this.filter(t).head()},Ur.prototype.findLast=function(t){return this.reverse().find(t)},Ur.prototype.invokeMap=Xn(function(t,e){return"function"==typeof t?new Ur(this):this.map(function(r){return Rn(r,t,e)})}),Ur.prototype.reject=function(t){return this.filter(jo(cs(t)))},Ur.prototype.slice=function(t,e){t=da(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Ur(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==r&&(n=(e=da(e))<0?n.dropRight(-e):n.take(e-t)),n)},Ur.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Ur.prototype.toArray=function(){return this.take(d)},Sn(Ur.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),s=Vr[i?"take"+("last"==e?"Right":""):e],o=i||/^find/.test(e);s&&(Vr.prototype[e]=function(){var e=this.__wrapped__,a=i?[1]:arguments,u=e instanceof Ur,c=a[0],h=u||zo(e),l=function(t){var e=s.apply(Vr,Be([t],a));return i&&f?e[0]:e};h&&n&&"function"==typeof c&&1!=c.length&&(u=h=!1);var f=this.__chain__,p=!!this.__actions__.length,g=o&&!f,d=u&&!p;if(!o&&h){e=d?e:new Ur(this);var v=t.apply(e,a);return v.__actions__.push({func:po,args:[l],thisArg:r}),new Kr(v,f)}return g&&d?t.apply(this,a):(v=this.thru(l),g?i?v.value()[0]:v.value():v)})}),Pe(["pop","push","shift","sort","splice","unshift"],function(t){var e=Rt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Vr.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(zo(i)?i:[],t)}return this[r](function(r){return e.apply(zo(r)?r:[],t)})}}),Sn(Ur.prototype,function(t,e){var r=Vr[e];if(r){var n=r.name+"";jt.call(Rr,n)||(Rr[n]=[]),Rr[n].push({name:e,func:r})}}),Rr[Mi(r,2).name]=[{name:"wrapper",func:r}],Ur.prototype.clone=function(){var t=new Ur(this.__wrapped__);return t.__actions__=Ti(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ti(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ti(this.__views__),t},Ur.prototype.reverse=function(){if(this.__filtered__){var t=new Ur(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Ur.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=zo(t),n=e<0,i=r?t.length:0,s=function(t,e,r){var n=-1,i=r.length;for(;++n<i;){var s=r[n],o=s.size;switch(s.type){case"drop":t+=o;break;case"dropRight":e-=o;break;case"take":e=xr(e,t+o);break;case"takeRight":t=yr(t,e-o)}}return{start:t,end:e}}(0,i,this.__views__),o=s.start,a=s.end,u=a-o,c=n?a:o-1,h=this.__iteratees__,l=h.length,f=0,p=xr(u,this.__takeCount__);if(!r||!n&&i==u&&p==u)return di(t,this.__actions__);var g=[];t:for(;u--&&f<p;){for(var d=-1,v=t[c+=e];++d<l;){var m=h[d],y=m.iteratee,x=m.type,w=y(v);if(2==x)v=w;else if(!w){if(1==x)continue t;break t}}g[f++]=v}return g},Vr.prototype.at=go,Vr.prototype.chain=function(){return fo(this)},Vr.prototype.commit=function(){return new Kr(this.value(),this.__chain__)},Vr.prototype.next=function(){this.__values__===r&&(this.__values__=pa(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},Vr.prototype.plant=function(t){for(var e,n=this;n instanceof qr;){var i=Ls(n);i.__index__=0,i.__values__=r,e?s.__wrapped__=i:e=i;var s=i;n=n.__wrapped__}return s.__wrapped__=t,e},Vr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Ur){var e=t;return this.__actions__.length&&(e=new Ur(this)),(e=e.reverse()).__actions__.push({func:po,args:[to],thisArg:r}),new Kr(e,this.__chain__)}return this.thru(to)},Vr.prototype.toJSON=Vr.prototype.valueOf=Vr.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Vr.prototype.first=Vr.prototype.head,Zt&&(Vr.prototype[Zt]=function(){return this}),Vr}();ve?((ve.exports=vr)._=vr,de._=vr):ge._=vr}).call(p)}(ds,ds.exports);var vs=ds.exports;exports.AUDIT_STATUS_INDEX={0:1,1:2,2:3,6:4,7:5,8:6,3:7},exports.AUDIT_WHITE_LIST=["/login","/404","/403","/register","/pay","/file-views","/iitc","/users/info"],exports.CLIENT_WHITE_LIST=["/login","/404","/403","/register","/file-views","/iitc","/account"],exports.CacheKey=r,exports.MENU_DATA_KEY="user_menu_data",exports.PermissionPlugin=ee,exports.VoucherDecimal=Yr,exports.WHITE_LIST=["/login","/404","/403","/register","/file-views","/iitc","/account"],exports.buildLinkedAmountSegments=t=>{if(t.isZero())return Array(11).fill("");const e=t.abs().times(100).toFixed(0);if(e.length>11)throw new Error("金额超出当前凭证金额栏可显示范围");return e.padStart(11," ").split("").map(t=>" "===t?"":t)},exports.buildTreeForSave=ue,exports.calculateXSum=(t,e)=>t.reduce((t,r)=>t+("number"!=typeof r[e]||isNaN(r[e])?0:r[e]),0),exports.checkCrossYear=t=>{if(t&&2===t.length){if(t[0].split("-")[0]!==t[1].split("-")[0])return!1}return!0},exports.companyPeriodDisabled=(t,e)=>{const r=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}`;return!e.map(t=>t.accountPeriod).includes(r)},exports.copyText=e=>{if(!e)return void t.ElMessage.warning("暂无可复制内容");const r=document.createElement("input");r.value=e,document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r),t.ElMessage.success("复制成功")},exports.createHttpClient=function(t={}){const{getToken:e=()=>"",onUnauthorized:r=()=>{},onError:n=t=>console.error(t),baseURL:i="",timeout:s=8e3}=t,o=gs.create();return o.interceptors.request.use(t=>t,t=>Promise.reject(t)),o.interceptors.response.use(t=>{console.log(t,"response xxx 888888888");const e=t.data,i=t.config.responseType;if("blob"===i||"arraybuffer"===i)return e;const s=e.code;if(void 0!==s)switch(s){case 200:case 201:return e;case 401:return r();default:return void n(e.msg||"Error")}else n("非本系统的接口")},t=>{if(console.log(t,"error xxx"),"ECONNABORTED"===t.code&&t.message.includes("timeout"))return n("请求超时,请稍后重试!"),Promise.reject(t);const e=vs.get(t,"response.status"),i=vs.get(t,"response.data.msg");switch(e){case 400:t.msg="请求错误";break;case 401:t.msg=i||"未授权",r();break;case 403:t.msg=i||"拒绝访问";break;case 404:t.msg="请求地址出错";break;case 408:t.msg="请求超时";break;case 500:t.msg="服务器内部错误";break;case 501:t.msg="服务未实现";break;case 502:t.msg="网关错误";break;case 503:t.msg="服务不可用";break;case 504:t.msg="网关超时";break;case 505:t.msg="HTTP 版本不受支持"}return t.msg&&n(t.msg),Promise.reject(t)}),t=>{const r=e(),n={baseURL:i,headers:{token:r?`${r}`:void 0,"Content-Type":"application/json"},data:{},timeout:s,withCredentials:!1},{signal:a,...u}=t||{},c=vs.merge({},n,u);return a&&(c.signal=a),o(c)}},exports.debounce=(t,e=300)=>{let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{t.apply(this,n)},e)}},exports.disabledDate=t=>{const e=new Date;return e.setHours(0,0,0,0),t.getTime()<e.getTime()},exports.downloadFile=(t,e)=>{const r=document.createElement("a");if(r.style.display="none","string"==typeof t)r.href=t;else{if(!(t instanceof Blob))return void console.error("不支持的文件源类型");r.href=URL.createObjectURL(t)}r.setAttribute("download",e),document.body.appendChild(r),r.click(),document.body.removeChild(r),t instanceof Blob&&window.URL.revokeObjectURL(r.href)},exports.exportFile=async(e,r,i)=>{try{const e=await fetch(r,{method:"get",headers:{token:n()||cookie.get("token")},responseType:"blob"});if(!e.ok)return t.ElMessage.error("请求失败"),!1;const s=await e.blob();if(s.type&&s.type.includes("application/json")){const e=await s.text();try{const r=JSON.parse(e);if(r&&r.msg)return t.ElMessage.error(r.msg),void(401===r.code&&setTimeout(()=>{window.location.href="/login?redirect="+encodeURIComponent(window.location.href)},2e3))}catch{console.warn("")}}const o=e.headers.get("content-disposition");let a=i;if(o){const t=o.match(/filename="?([^"]+)"?/);t&&t[1]&&(a=decodeURIComponent(t[1]))}const u=window.URL.createObjectURL(s),c=document.createElement("a");c.href=u,c.download=a,document.body.appendChild(c),c.click(),t.ElMessage.success("下载成功"),window.URL.revokeObjectURL(u),document.body.removeChild(c)}catch(e){console.error("下载Excel失败:",e),t.ElMessage.error("下载失败")}},exports.extractPermissions=function(t,e={}){const{typeKey:r="type",codeKey:n="code",targetType:i=2,childrenKey:s="children"}=e,o=[],a=t=>{Array.isArray(t)&&t.forEach(t=>{2!==t[r]&&1!==t[r]||!t[n]||o.push(t[n]),t[s]&&Array.isArray(t[s])&&t[s].length>0&&a(t[s])})};return a(t),o},exports.extractPropValues=(t=[],e="",{keepEmpty:r=!1}={})=>{if(!Array.isArray(t))return[];const n=e.split(".").filter(t=>t.trim());return t.map(t=>{let e=t;for(const t of n)if(e=e?.[t],null==e)break;return e}).filter(t=>r||null!=t)},exports.filterEmptyRows=fe,exports.filterTreeData=ne,exports.findParent=ie,exports.focusAndOpenSelectInCell=async function({cell:t,event:e,selectSelector:r,nextTick:n,canOpen:i=()=>!0,ignoreSelectors:s=[]}){if("undefined"==typeof window||"undefined"==typeof Element)return!1;if(!(t instanceof HTMLElement&&t.isConnected&&i()))return!1;const o=e?.target;if(!(o instanceof Element&&t.contains(o)))return!1;const a=t.querySelector(r);if(!(a instanceof HTMLElement))return!1;const u=o.closest(".el-select");if(u&&u!==a)return!1;const c=a.querySelector(".el-select__wrapper"),h=a.querySelector('input[role="combobox"]');if(!(c instanceof HTMLElement&&h instanceof HTMLInputElement))return!1;if(c.contains(o))return!1;const l=[...he,...s].join(", "),f=o.closest(l);if(f&&t.contains(f))return!1;const p=()=>i()&&t.isConnected&&a.isConnected&&t.querySelector(r)===a&&a.contains(h)&&a.contains(c)&&!h.disabled&&!a.classList.contains("is-disabled")&&!c.classList.contains("is-disabled");return await n(),!!p()&&(h.focus(),await n(),!(!p()||document.activeElement!==h)&&("false"===h.getAttribute("aria-expanded")&&c.click(),await n(),p()&&"true"===h.getAttribute("aria-expanded")))},exports.formatAmount=t=>null==t||isNaN(t)?"":Number(t).toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2}),exports.formatAmountToUnits=function(t){const e=["","","","","","","","","","",""];if("number"!=typeof t||isNaN(t)||!isFinite(t))return e;if(t>999999999.99)return console.warn("金额过大,最大支持999999999.99元"),e;if(t<0)return console.warn("金额不能为负数"),e;if(0===t)return e;const r=Math.abs(t).toFixed(2),[n,i]=r.split("."),s=n.length;for(let t=0;t<s;t++){const r=n[s-1-t],i=8-t;i>=0&&(e[i]=r)}return(parseInt(n)>0||parseInt(i)>0)&&(e[9]=i[0],e[10]=i[1]),e},exports.formatDateTime=(t,e=0,r=0)=>{const n=new Date(t);n.setHours(e,r,0,0);return`${n.getFullYear()}-${re(n.getMonth()+1)}-${re(n.getDate())} ${re(n.getHours())}:${re(n.getMinutes())}`},exports.formatMenuData=te,exports.formatMenuTree=function t(e){return Array.isArray(e)?e.filter(t=>1===t.type||void 0===t.type).map(e=>{const r={title:e.title,...e.path&&{path:e.path},...e.svgName&&{svgName:e.svgName},...e.code&&{code:e.code}};if(e.children&&e.children.length){const n=t(e.children);n.length&&(r.children=n)}return r}):[]},exports.formatMoney=(t,e,r,n=!1)=>{if(null==t||isNaN(Number(t)))return n?"0":"";let i=Number(t);if(0===i&&!n)return"";void 0!==r&&"number"==typeof r&&r>=0?i=i.toFixed(r):void 0!==e&&"number"==typeof e&&e>=0&&(i=i.toFixed(e));const s=i.toString().split("."),o=s[0],a=s[1]||"",u=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");return a?`${u}.${a}`:u},exports.formatToFirstDay=function(t){if(!t)return"";const[e,r]=t.split("-");return`${e}-${r}-01`},exports.generate32BitRandomString=function(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let e="";for(let r=0;r<32;r++)if("undefined"!=typeof crypto&&crypto.getRandomValues){const r=new Uint8Array(1);crypto.getRandomValues(r);const n=r[0]%62;e+=t.charAt(n)}else{const r=Math.floor(62*Math.random());e+=t.charAt(r)}return e},exports.generateCodeExample=function(t,e){return e.slice(0,t).map((t,e)=>t<=1?"1":2===t?0===e?"11":"01":0===e?"1"+"0".repeat(t-2)+"1":"0"+"0".repeat(t-2)+"1").join("-")},exports.generateTimestamp=function(t=13){if(10===t)return Math.floor(Date.now()/1e3);if(13===t)return Date.now();throw new Error("只支持10位或13位时间戳")},exports.getCompanyAccountPeriod=function(){return localStorage.getItem(r.COMPANYACCOUNTPERIOD)},exports.getCompanyAccountPeriodNow=function(){return localStorage.getItem(r.COMPANYACCOUNTPERIODNOW)},exports.getCompanyAuditStatusMsg=function(){return localStorage.getItem(r.COMPANYAUDITSTATUSMSG)},exports.getCompanyAuditStatusMsgNow=function(){return localStorage.getItem(r.COMPANYAUDITSTATUSMSGNOW)},exports.getCompanyCode=function(){return localStorage.getItem(r.COMPANYCODE)},exports.getCompanyName=function(){return localStorage.getItem(r.COMPANYNAME)},exports.getCompanyType=function(){return localStorage.getItem(r.COMPANYTYPE)},exports.getCurrentMonth=()=>{const t=new Date;return`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,"0")}`},exports.getDefaultDateTimeRange=(t="08:00",e="18:00")=>{const r=new Date,n=r.getFullYear(),i=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0");return[`${n}-${i}-${s} ${t}`,`${n}-${i}-${s} ${e}`]},exports.getFileType=function(t){if(!t||"string"!=typeof t)return null;const e=t.lastIndexOf(".");return e>0?t.slice(e+1).toLowerCase():null},exports.getFileTypeFromUrlRegex=t=>{if(!t||"string"!=typeof t)return"unknown";const e=t.split("?")[0].match(/\.([a-zA-Z0-9]+)$/);if(!e)return"unknown";const r=e[1].toLowerCase();return/^pdf$/i.test(r)?"pdf":/^(jpg|jpeg|png|gif|bmp|webp|svg|ico|tiff|tif|heic|heif)$/i.test(r)?"image":/^(xlsx|xls)$/i.test(r)?"xlsx":"unknown"},exports.getFinancialStandardDictType=function(){return localStorage.getItem(r.FINANCIALSTANDARDDICTTYPE)},exports.getFormattedDateTime=function(){const t=new Date;return`${t.getFullYear()}${String(t.getMonth()+1).padStart(2,"0")}${String(t.getDate()).padStart(2,"0")}${String(t.getHours()).padStart(2,"0")}${String(t.getMinutes()).padStart(2,"0")}${String(t.getSeconds()).padStart(2,"0")}`},exports.getGlobalProperties=function(){const t=e.getCurrentInstance();return t?t.appContext.config.globalProperties:(console.error("请在 setup 中使用 getGlobalProperties"),{})},exports.getLevelPadding=(t,e)=>((t??1)-1)*e+"px",exports.getMinValueItem=(t,e="key")=>{if(!t||0===t.length)return"";const r=t.reduce((t,e)=>e.value<t.value?e:t,t[0]);return r[e]},exports.getPrevMonth=function(t){const[e,r]=t.split("-").map(Number),n=new Date(e,r-1,1);return n.setMonth(n.getMonth()-1),`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}`},exports.getToken=n,exports.getUserInfo=function(){return localStorage.getItem(r.USER_INFO)},exports.handleBeforeUpload=(e,r=10)=>{const n=1024*r*1024;return e.size>n?(t.ElMessage.error(`文件 ${e.name} 太大,最大支持${r}MB`),!1):(console.log("准备上传文件:",e),!0)},exports.handleSubKeydown=(t,e)=>{["Backspace","Delete","Tab","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)||t.ctrlKey||t.metaKey||/^[0-9]$/.test(t.key)||"."!==t.key&&"-"!==t.key&&t.preventDefault()},exports.handleViewFile=function(t){if("string"!=typeof t){const e="文件地址必须是字符串,当前传入类型:"+typeof t;return console.error("[handleViewFile] 错误:",e),{success:!1,error:e}}if(!t.trim()){const t="文件地址不能为空或仅空格";return console.error("[handleViewFile] 错误:",t),{success:!1,error:t}}let e;try{e=new URL(t)}catch(e){const r=`无效的URL格式:${t}(请检查是否包含特殊字符或缺失协议)`;return console.error("[handleViewFile] URL解析错误:",e,"| 地址:",t),{success:!1,error:r}}if(!["http:","https:"].includes(e.protocol)){const t=`仅支持HTTP/HTTPS协议,当前协议:${e.protocol}`;return console.error("[handleViewFile] 协议错误:",t),{success:!1,error:t}}const r=e.pathname,n=r.lastIndexOf(".");if(-1===n){const e=`文件地址不含后缀名:${t}(需是jpg/png/pdf)`;return console.error("[handleViewFile] 格式错误:",e),{success:!1,error:e}}const i=r.slice(n+1).toLowerCase(),s=["jpg","jpeg","png","pdf"];if(!s.includes(i)){const t=`不支持的文件格式:.${i},仅支持${s.join("、")}`;return console.error("[handleViewFile] 格式错误:",t),{success:!1,error:t}}try{if(!window.open(t,"_blank","noopener,noreferrer,width=1000,height=800")){const t="文件窗口被浏览器拦截,请允许弹窗后重试(地址栏右侧查看拦截提示)";return console.warn("[handleViewFile] 弹窗被拦截:",t),{success:!1,error:t}}return console.log("[handleViewFile] 成功:文件已在新窗口打开,地址:",t),{success:!0,message:"文件已在新窗口打开"}}catch(e){const r=`打开文件失败:${e.message}(可能是浏览器安全设置或网络问题)`;return console.error("[handleViewFile] 打开失败:",e,"| 地址:",t),{success:!1,error:r}}},exports.hasNonZeroValue=le,exports.isAccountingEnabled=t=>!0===t||1===t||"1"===t,exports.isBeforeToday=t=>{const e=new Date(t);e.setHours(0,0,0,0);const r=new Date;return r.setHours(0,0,0,0),e.getTime()<r.getTime()},exports.isCnyCurrency=t=>"CNY"===String(t||"").trim().toUpperCase(),exports.isDateInRange=(t,e,r)=>{const n=new Date(t).setHours(0,0,0,0),i=new Date(e).setHours(0,0,0,0),s=new Date(r).setHours(0,0,0,0);return n>=i&&n<=s},exports.isTaskContinue=(t,e,r)=>{const n=new Date(t).setHours(0,0,0,0),i=new Date(e).setHours(0,0,0,0),s=new Date(r).setHours(0,0,0,0);return n>i&&n<=s},exports.isTaskStart=(t,e)=>new Date(t).setHours(0,0,0,0)===new Date(e).setHours(0,0,0,0),exports.openNewWindow=t=>{const e=document.createElement("a");e.href=t,e.target="_blank",e.rel="noopener noreferrer",document.body.appendChild(e),e.click(),document.body.removeChild(e)},exports.parseNum=oe,exports.percentToNumber=function(t){const e=String(t).replace(/%/g,""),r=Number(e);return isNaN(r)?0:r},exports.periodDisabledDate=t=>{const e=new Date,r=e.getFullYear(),n=e.getMonth(),i=t.getFullYear(),s=t.getMonth();if(0===n){return!(i===r-1&&11===s||i===r)}return i!==r},exports.periodDisabledDateAllAfter=t=>{const e=new Date,r=e.getFullYear(),n=e.getMonth(),i=t.getFullYear(),s=t.getMonth();return i>r||i===r&&s>=n},exports.phoneRegex=/^1[3-9]\d{9}$/,exports.positionMap=(t,e,r,n)=>{const i=t.querySelector(e);i&&i.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{r.value=""},n)},exports.postExportFile=async(e,r,i,s)=>{try{const e=await fetch(r,{method:"post",headers:{token:n(),"Content-Type":"application/json"},body:JSON.stringify(s)});if(!e.ok)return t.ElMessage.error("请求失败"),!1;const o=await e.blob();if(o.type&&o.type.includes("application/json")){const e=await o.text();try{const r=JSON.parse(e);if(r&&r.msg)return t.ElMessage.error(r.msg),401===r.code&&setTimeout(()=>{window.location.href="/login?redirect="+encodeURIComponent(window.location.href)},2e3),!1}catch{console.warn("解析JSON失败")}}const a=e.headers.get("content-disposition");let u=i;if(a){const t=a.match(/filename\*=UTF-8''([^;]+)/i);if(t&&t[1])u=decodeURIComponent(t[1]);else{const t=a.match(/filename=(?:"([^"]+)"|([^;]+))/i);if(t){let e=t[1]||t[2];try{u=decodeURIComponent(e)}catch(t){u=e}}}}const c=window.URL.createObjectURL(o),h=document.createElement("a");return h.style.display="none",h.href=c,h.download=u,document.body.appendChild(h),h.click(),t.ElMessage.success("下载成功"),setTimeout(()=>{window.URL.revokeObjectURL(c),document.body.removeChild(h)},1e3),!0}catch(e){return console.error("下载文件失败:",e),t.ElMessage.error("下载失败"),!1}},exports.processCode=se,exports.processList=ae,exports.processVoucherArrayEnhanced=function(t,e={}){const{emptyObject:r={},preserveOriginal:n=!1}=e;if(!Array.isArray(t))throw new Error("参数必须是数组");const i=[];return t.forEach((t,e)=>{if(!t||"object"!=typeof t)return;const s=t.voucherList;if(!Array.isArray(s)){const s=n?{...t}:{...t,_metadata:{originalIndex:e,isPadded:!0,originalLength:0}};return s.voucherList=[{...r},{...r},{...r},{...r},{...r}],s.page=1,s.pageCount=1,void i.push(s)}const o=Math.ceil(s.length/5);if(s.length>5)for(let a=0;a<s.length;a+=5){const u=s.slice(a,a+5),c=Math.floor(a/5)+1,h=[...u];for(;h.length<5;)h.push({...r});const l=n?{...t}:{...t,_metadata:{originalIndex:e,isSplit:a>0,chunkIndex:Math.floor(a/5),totalChunks:o}};l.voucherList=h,l.page=c,l.pageCount=o,i.push(l)}else if(s.length<5){const o=s.map(t=>({...t}));for(;o.length<5;)o.push({...r});const a=n?{...t}:{...t,_metadata:{originalIndex:e,isPadded:!0,originalLength:s.length}};a.voucherList=o,a.page=1,a.pageCount=1,i.push(a)}else{const r=n?{...t}:{...t,_metadata:{originalIndex:e,isOriginal:!0}};r.page=1,r.pageCount=1,i.push(r)}}),i},exports.publicKey="MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAL/EwnX/3BaH5gJXJiv7qKhuKKol5JSgayGyYMWDdRO8KKAtOFrniXp/iAGGoV6Y0GF9Z8iY3xHOiU3rHeSJ3G6wFDY87Qr4k2m48/6YRX+s/iMGJ5j5obdCFiDkFUzoR/EHTqC6PM3h6bhDNNIXQpqVbQrg28tW5Y57+yxqRrUjAgMBAAECgYAHlgB9S3xI1eJm6Eylw8RFuWnZZTtYF8p1IEnMtmkMuU5AG9nVWsBo/J+EM++xPslLefr/h/CXEz0CPJFHp551HucLlRA7EOXSPfwLGODlz5rMnXyM8jD3ZMACXsRLvLEiNt+0nP+G7M+Dxuf6SLkmvqYa/NdJACb5/16E2P+pNQJBAO0hgUcKYfvJSXVolonVQNpR8Hu/4LH+5bBVLef+D6JNP6x0hr9U/ce+nI7I5wIPbBgFknvCWfVbgz16tPZhmC0CQQDPBzLArfdUfMs2h/3cxQAeZnX0ybt3F6CR3K9dliDJRn1p3ovdK0OmyggpKfx94KH+VRcJSaWTHLeFvub8KgSPAkEAhUWcY7HZKeqSB5OVb7fT8B+3OcW4YjFxI+5rk4Q9gylJTQJcrPH2g6mEUddlxcmnJcUT88xiRLx/ATGSvRpSrQJAJSfTkgUm6IDlL8pEY4TvuoUFEoPKI1uYM9V5m8A/7h+6jm+khnMnVx3XTRv99tGEAVNgKQiQsNBsl5JlfkhEPQJBAJ2nPXpGolp/R5usP+LP314snwj93G54+HaZnuOoIB0ApusErnpWCSHXbQtvXKo1n6SE3ccp010CPJBnOm/LRaA=",exports.recalculateCashFlowData=t=>{if(!t||!t.length)return;t.forEach(t=>{1==t.draftCalType&&(t.currentAmount=0)});let e=null;t.forEach(t=>{if(1==t.draftCalType)e=t;else if((2==t.draftCalType||3==t.draftCalType)&&e){const r=Number(t.currentAmount)||0,n=-1===t.calDirection?-1:1;e.currentAmount=(e.currentAmount||0)+r*n}})},exports.removeCompanyAccountPeriod=function(){localStorage.removeItem(r.COMPANYACCOUNTPERIOD)},exports.removeCompanyAccountPeriodNow=function(){localStorage.removeItem(r.COMPANYACCOUNTPERIODNOW)},exports.removeCompanyAuditStatusMsg=function(){localStorage.removeItem(r.COMPANYAUDITSTATUSMSG)},exports.removeCompanyAuditStatusMsgNow=function(){localStorage.removeItem(r.COMPANYAUDITSTATUSMSGNOW)},exports.removeCompanyCode=function(){localStorage.removeItem(r.COMPANYCODE)},exports.removeCompanyName=function(){localStorage.removeItem(r.COMPANYNAME)},exports.removeCompanyType=function(){localStorage.removeItem(r.COMPANYTYPE)},exports.removeFinancialStandardDictType=function(){localStorage.removeItem(r.FINANCIALSTANDARDDICTTYPE)},exports.removeOperation=(t,e)=>{const r=t.operations.indexOf(e);r>-1&&t.operations.splice(r,1)},exports.removeToken=function(){localStorage.removeItem(r.TOKEN)},exports.removeUserInfo=function(){localStorage.removeItem(r.USER_INFO)},exports.roundMoneyDecimal=(t,e)=>t.toDecimalPlaces(e),exports.roundSubDecimal=(t,e)=>t.toDecimalPlaces(e),exports.scrollToId=function(t,e=0,r=500){if("string"!=typeof t||!t.trim())return console.error("[scrollToId] 错误:id必须是非空字符串"),!1;const n=document.getElementById(t);if(!n)return console.error(`[scrollToId] 错误:未找到ID为"${t}"的元素`),!1;const i=n.getBoundingClientRect().top+window.pageYOffset,s=window.pageYOffset,o=i-s-e;let a=null;return requestAnimationFrame(function t(e){null===a&&(a=e);const n=e-a,i=function(t,e,r,n){return t/=n/2,t<1?r/2*t*t+e:(t--,-r/2*(t*(t-2)-1)+e)}(n,s,o,r);window.scrollTo(0,i),n<r&&requestAnimationFrame(t)}),!0},exports.setCompanyAccountPeriod=function(t){localStorage.setItem(r.COMPANYACCOUNTPERIOD,t)},exports.setCompanyAccountPeriodNow=function(t){localStorage.setItem(r.COMPANYACCOUNTPERIODNOW,t)},exports.setCompanyAuditStatusMsg=function(t){localStorage.setItem(r.COMPANYAUDITSTATUSMSG,t)},exports.setCompanyAuditStatusMsgNow=function(t){localStorage.setItem(r.COMPANYAUDITSTATUSMSGNOW,t)},exports.setCompanyCode=function(t){localStorage.setItem(r.COMPANYCODE,t)},exports.setCompanyName=function(t){localStorage.setItem(r.COMPANYNAME,t)},exports.setCompanyType=function(t){localStorage.setItem(r.COMPANYTYPE,t)},exports.setFinancialStandardDictType=function(t){localStorage.setItem(r.FINANCIALSTANDARDDICTTYPE,t)},exports.setToken=function(t){localStorage.setItem(r.TOKEN,t)},exports.setUserInfo=function(t){localStorage.setItem(r.USER_INFO,t)},exports.signWithSHA256RSA=function(t,e){console.log(t,e);const r=new Qt.crypto.Signature({alg:"SHA256withRSA",prov:"cryptojs/jsrsa"});return r.init(e),r.updateString(t),r.sign()},exports.svgConst={viewBox:"0 0 1536 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},exports.svgSjPath={d:"M73.75498878 312.79929781L689.59344939 960.31767875A98.63975344 98.63975344 0 0 0 762.55326659 991.9976a98.63975344 98.63975344 0 0 0 72.71981813-31.67992125L1451.3515444 312.79929781a106.55973375 106.55973375 0 0 0 23.99994-114.23971406 113.75971594 113.75971594 0 0 0-96.95975719-70.55982375l-1231.19692219 0a113.27971688 113.27971688 0 0 0-97.19975718 70.31982375 106.55973375 106.55973375 0 0 0 23.75994094 114.47971406z",fill:"#001533"},exports.toVoucherDecimal=(t,e="数值")=>{const r=String(t??"").trim();if(""===r)return new Yr(0);if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(r))throw new Error(`${e}请输入有效数字`);const n=new Yr(r);if(!n.isFinite())throw new Error(`${e}请输入有效数字`);return n},exports.treeHas=ce,exports.truncateToTwoDecimals=function(t,e){if(!isFinite(t)||0===t)return t.toFixed(2);const r=Math.trunc(100*t)/100;return Object.is(r,-0)?"-0.00":r.toFixed(e)},exports.unclosablePaths=["/accounting/accounting-voucher-detail","/accounting/accounting-voucher-add","/accounting/accounting-voucher-red"],exports.useGlobalDragUpload=function(t={}){const{allowedExtensions:r=[],onDropFiles:n,enabled:i=e.ref(!0)}=t,s=e.ref(!1);let o=0;const a=t=>{e.unref(i)&&(t.preventDefault(),o++,1===o&&(s.value=!0))},u=t=>{e.unref(i)&&(t.preventDefault(),o--,0===o&&(s.value=!1))},c=t=>{e.unref(i)&&t.preventDefault()},h=t=>{if(!e.unref(i))return;t.preventDefault(),o=0,s.value=!1;const a=Array.from(t.dataTransfer.files);if(0===a.length)return;const u=[],c=[];a.forEach(t=>{const e="."+t.name.split(".").pop().toLowerCase();0===r.length||r.includes(e)?u.push(t):c.push(t)}),n&&n(u,c)};return e.onMounted(()=>{window.addEventListener("dragenter",a),window.addEventListener("dragleave",u),window.addEventListener("dragover",c),window.addEventListener("drop",h)}),e.onBeforeUnmount(()=>{window.removeEventListener("dragenter",a),window.removeEventListener("dragleave",u),window.removeEventListener("dragover",c),window.removeEventListener("drop",h)}),{isGlobalDragging:s}},exports.useTreeExpand=function(t,r={}){const{selfKey:n="itemCode",parentKey:i="parentItem",hasChildKey:s="hasChild",defaultExpanded:o=!0}=r,a=e.computed(()=>{const e=void 0!==t.value?t.value:t;return Array.isArray(e)?e:[]});e.computed(()=>{const t=new Map;for(const e of a.value){const r=e[i];r&&(t.has(r)||t.set(r,[]),t.get(r).push(e))}return t});const u=e.computed(()=>{const t=new Map;for(const e of a.value){const r=[],s=e[n];let o=e[i];const u=new Set;for(;o&&!u.has(o)&&o!==s;){u.add(o),r.push(o);const t=a.value.find(t=>t[n]===o);if(!t)break;o=t[i]}t.set(s,r)}return t}),c=e.ref(new Set);e.watch(()=>a.value,()=>(()=>{const t=new Set;if(o)for(const e of a.value)e[s]&&t.add(e[n]);c.value=t})(),{immediate:!0});const h=t=>{const e=u.value.get(t[n]);if(!e||0===e.length)return!0;for(const t of e){const e=a.value.find(e=>e[n]===t);if(e&&e[s]&&!c.value.has(t))return!1}return!0},l=e.computed(()=>a.value.filter(h));return{expandedKeys:c,toggle:t=>{const e=new Set(c.value);e.has(t)?e.delete(t):e.add(t),c.value=e},expandAll:()=>{const t=new Set;for(const e of a.value)e[s]&&t.add(e[n]);c.value=t},collapseAll:()=>{c.value=new Set},visibleList:l}},exports.version="0.3.10",exports.whiteList=["/login","/404","/403","/register","/pay","/file-views","/iitc","/users/info"];
34
+ var ge,de,ve=9e15,me=1e9,ye="0123456789abcdef",xe="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",we="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",Se={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-ve,maxE:ve,crypto:!1},Ee=!0,be="[DecimalError] ",Fe=be+"Invalid argument: ",Ae=be+"Precision limit exceeded",Ce=be+"crypto unavailable",De="[object Decimal]",Ie=Math.floor,Pe=Math.pow,Te=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Re=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Ne=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Oe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Be=1e7,_e=xe.length-1,je=we.length-1,He={toStringTag:De};function ke(t){var e,r,n,i=t.length-1,s="",a=t[0];if(i>0){for(s+=a,e=1;e<i;e++)(r=7-(n=t[e]+"").length)&&(s+=Je(r)),s+=n;(r=7-(n=(a=t[e])+"").length)&&(s+=Je(r))}else if(0===a)return"0";for(;a%10==0;)a/=10;return s+a}function Le(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Fe+t)}function Ve(t,e,r,n){var i,s,a,o;for(s=t[0];s>=10;s/=10)--e;return--e<0?(e+=7,i=0):(i=Math.ceil((e+1)/7),e%=7),s=Pe(10,7-e),o=t[i]%s|0,null==n?e<3?(0==e?o=o/100|0:1==e&&(o=o/10|0),a=r<4&&99999==o||r>3&&49999==o||5e4==o||0==o):a=(r<4&&o+1==s||r>3&&o+1==s/2)&&(t[i+1]/s/100|0)==Pe(10,e-2)-1||(o==s/2||0==o)&&!(t[i+1]/s/100|0):e<4?(0==e?o=o/1e3|0:1==e?o=o/100|0:2==e&&(o=o/10|0),a=(n||r<4)&&9999==o||!n&&r>3&&4999==o):a=((n||r<4)&&o+1==s||!n&&r>3&&o+1==s/2)&&(t[i+1]/s/1e3|0)==Pe(10,e-3)-1,a}function Me(t,e,r){for(var n,i,s=[0],a=0,o=t.length;a<o;){for(i=s.length;i--;)s[i]*=e;for(s[0]+=ye.indexOf(t.charAt(a++)),n=0;n<s.length;n++)s[n]>r-1&&(void 0===s[n+1]&&(s[n+1]=0),s[n+1]+=s[n]/r|0,s[n]%=r)}return s.reverse()}He.absoluteValue=He.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Ke(t)},He.ceil=function(){return Ke(new this.constructor(this),this.e+1,2)},He.clampedTo=He.clamp=function(t,e){var r=this,n=r.constructor;if(t=new n(t),e=new n(e),!t.s||!e.s)return new n(NaN);if(t.gt(e))throw Error(Fe+e);return r.cmp(t)<0?t:r.cmp(e)>0?e:new n(r)},He.comparedTo=He.cmp=function(t){var e,r,n,i,s=this,a=s.d,o=(t=new s.constructor(t)).d,u=s.s,c=t.s;if(!a||!o)return u&&c?u!==c?u:a===o?0:!a^u<0?1:-1:NaN;if(!a[0]||!o[0])return a[0]?u:o[0]?-c:0;if(u!==c)return u;if(s.e!==t.e)return s.e>t.e^u<0?1:-1;for(e=0,r=(n=a.length)<(i=o.length)?n:i;e<r;++e)if(a[e]!==o[e])return a[e]>o[e]^u<0?1:-1;return n===i?0:n>i^u<0?1:-1},He.cosine=He.cos=function(){var t,e,r=this,n=r.constructor;return r.d?r.d[0]?(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(t,e){var r,n,i;if(e.isZero())return e;n=e.d.length,n<32?i=(1/sr(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10");t.precision+=r,e=ir(t,1,e.times(i),new t(1));for(var s=r;s--;){var a=e.times(e);e=a.times(a).minus(a).times(8).plus(1)}return t.precision-=r,e}(n,ar(n,r)),n.precision=t,n.rounding=e,Ke(2==de||3==de?r.neg():r,t,e,!0)):new n(1):new n(NaN)},He.cubeRoot=He.cbrt=function(){var t,e,r,n,i,s,a,o,u,c,h=this,l=h.constructor;if(!h.isFinite()||h.isZero())return new l(h);for(Ee=!1,(s=h.s*Pe(h.s*h,1/3))&&Math.abs(s)!=1/0?n=new l(s.toString()):(r=ke(h.d),(s=((t=h.e)-r.length+1)%3)&&(r+=1==s||-2==s?"0":"00"),s=Pe(r,1/3),t=Ie((t+1)/3)-(t%3==(t<0?-1:2)),(n=new l(r=s==1/0?"5e"+t:(r=s.toExponential()).slice(0,r.indexOf("e")+1)+t)).s=h.s),a=(t=l.precision)+3;;)if(c=(u=(o=n).times(o).times(o)).plus(h),n=qe(c.plus(h).times(o),c.plus(u),a+2,1),ke(o.d).slice(0,a)===(r=ke(n.d)).slice(0,a)){if("9999"!=(r=r.slice(a-3,a+1))&&(i||"4999"!=r)){+r&&(+r.slice(1)||"5"!=r.charAt(0))||(Ke(n,t+1,1),e=!n.times(n).times(n).eq(h));break}if(!i&&(Ke(o,t+1,0),o.times(o).times(o).eq(h))){n=o;break}a+=4,i=1}return Ee=!0,Ke(n,t,l.rounding,e)},He.decimalPlaces=He.dp=function(){var t,e=this.d,r=NaN;if(e){if(r=7*((t=e.length-1)-Ie(this.e/7)),t=e[t])for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r},He.dividedBy=He.div=function(t){return qe(this,new this.constructor(t))},He.dividedToIntegerBy=He.divToInt=function(t){var e=this.constructor;return Ke(qe(this,new e(t),0,1,1),e.precision,e.rounding)},He.equals=He.eq=function(t){return 0===this.cmp(t)},He.floor=function(){return Ke(new this.constructor(this),this.e+1,3)},He.greaterThan=He.gt=function(t){return this.cmp(t)>0},He.greaterThanOrEqualTo=He.gte=function(t){var e=this.cmp(t);return 1==e||0===e},He.hyperbolicCosine=He.cosh=function(){var t,e,r,n,i,s=this,a=s.constructor,o=new a(1);if(!s.isFinite())return new a(s.s?1/0:NaN);if(s.isZero())return o;r=a.precision,n=a.rounding,a.precision=r+Math.max(s.e,s.sd())+4,a.rounding=1,(i=s.d.length)<32?e=(1/sr(4,t=Math.ceil(i/3))).toString():(t=16,e="2.3283064365386962890625e-10"),s=ir(a,1,s.times(e),new a(1),!0);for(var u,c=t,h=new a(8);c--;)u=s.times(s),s=o.minus(u.times(h.minus(u.times(h))));return Ke(s,a.precision=r,a.rounding=n,!0)},He.hyperbolicSine=He.sinh=function(){var t,e,r,n,i=this,s=i.constructor;if(!i.isFinite()||i.isZero())return new s(i);if(e=s.precision,r=s.rounding,s.precision=e+Math.max(i.e,i.sd())+4,s.rounding=1,(n=i.d.length)<3)i=ir(s,2,i,i,!0);else{t=(t=1.4*Math.sqrt(n))>16?16:0|t,i=ir(s,2,i=i.times(1/sr(5,t)),i,!0);for(var a,o=new s(5),u=new s(16),c=new s(20);t--;)a=i.times(i),i=i.times(o.plus(a.times(u.times(a).plus(c))))}return s.precision=e,s.rounding=r,Ke(i,e,r,!0)},He.hyperbolicTangent=He.tanh=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+7,n.rounding=1,qe(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)},He.inverseCosine=He.acos=function(){var t=this,e=t.constructor,r=t.abs().cmp(1),n=e.precision,i=e.rounding;return-1!==r?0===r?t.isNeg()?Ge(e,n,i):new e(0):new e(NaN):t.isZero()?Ge(e,n+4,i).times(.5):(e.precision=n+6,e.rounding=1,t=new e(1).minus(t).div(t.plus(1)).sqrt().atan(),e.precision=n,e.rounding=i,t.times(2))},He.inverseHyperbolicCosine=He.acosh=function(){var t,e,r=this,n=r.constructor;return r.lte(1)?new n(r.eq(1)?0:NaN):r.isFinite()?(t=n.precision,e=n.rounding,n.precision=t+Math.max(Math.abs(r.e),r.sd())+4,n.rounding=1,Ee=!1,r=r.times(r).minus(1).sqrt().plus(r),Ee=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)},He.inverseHyperbolicSine=He.asinh=function(){var t,e,r=this,n=r.constructor;return!r.isFinite()||r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+2*Math.max(Math.abs(r.e),r.sd())+6,n.rounding=1,Ee=!1,r=r.times(r).plus(1).sqrt().plus(r),Ee=!0,n.precision=t,n.rounding=e,r.ln())},He.inverseHyperbolicTangent=He.atanh=function(){var t,e,r,n,i=this,s=i.constructor;return i.isFinite()?i.e>=0?new s(i.abs().eq(1)?i.s/0:i.isZero()?i:NaN):(t=s.precision,e=s.rounding,n=i.sd(),Math.max(n,t)<2*-i.e-1?Ke(new s(i),t,e,!0):(s.precision=r=n-i.e,i=qe(i.plus(1),new s(1).minus(i),r+t,1),s.precision=t+4,s.rounding=1,i=i.ln(),s.precision=t,s.rounding=e,i.times(.5))):new s(NaN)},He.inverseSine=He.asin=function(){var t,e,r,n,i=this,s=i.constructor;return i.isZero()?new s(i):(e=i.abs().cmp(1),r=s.precision,n=s.rounding,-1!==e?0===e?((t=Ge(s,r+4,n).times(.5)).s=i.s,t):new s(NaN):(s.precision=r+6,s.rounding=1,i=i.div(new s(1).minus(i.times(i)).sqrt().plus(1)).atan(),s.precision=r,s.rounding=n,i.times(2)))},He.inverseTangent=He.atan=function(){var t,e,r,n,i,s,a,o,u,c=this,h=c.constructor,l=h.precision,f=h.rounding;if(c.isFinite()){if(c.isZero())return new h(c);if(c.abs().eq(1)&&l+4<=je)return(a=Ge(h,l+4,f).times(.25)).s=c.s,a}else{if(!c.s)return new h(NaN);if(l+4<=je)return(a=Ge(h,l+4,f).times(.5)).s=c.s,a}for(h.precision=o=l+10,h.rounding=1,t=r=Math.min(28,o/7+2|0);t;--t)c=c.div(c.times(c).plus(1).sqrt().plus(1));for(Ee=!1,e=Math.ceil(o/7),n=1,u=c.times(c),a=new h(c),i=c;-1!==t;)if(i=i.times(u),s=a.minus(i.div(n+=2)),i=i.times(u),void 0!==(a=s.plus(i.div(n+=2))).d[e])for(t=e;a.d[t]===s.d[t]&&t--;);return r&&(a=a.times(2<<r-1)),Ee=!0,Ke(a,h.precision=l,h.rounding=f,!0)},He.isFinite=function(){return!!this.d},He.isInteger=He.isInt=function(){return!!this.d&&Ie(this.e/7)>this.d.length-2},He.isNaN=function(){return!this.s},He.isNegative=He.isNeg=function(){return this.s<0},He.isPositive=He.isPos=function(){return this.s>0},He.isZero=function(){return!!this.d&&0===this.d[0]},He.lessThan=He.lt=function(t){return this.cmp(t)<0},He.lessThanOrEqualTo=He.lte=function(t){return this.cmp(t)<1},He.logarithm=He.log=function(t){var e,r,n,i,s,a,o,u,c=this,h=c.constructor,l=h.precision,f=h.rounding;if(null==t)t=new h(10),e=!0;else{if(r=(t=new h(t)).d,t.s<0||!r||!r[0]||t.eq(1))return new h(NaN);e=t.eq(10)}if(r=c.d,c.s<0||!r||!r[0]||c.eq(1))return new h(r&&!r[0]?-1/0:1!=c.s?NaN:r?0:1/0);if(e)if(r.length>1)s=!0;else{for(i=r[0];i%10==0;)i/=10;s=1!==i}if(Ee=!1,a=tr(c,o=l+5),n=e?We(h,o+10):tr(t,o),Ve((u=qe(a,n,o,1)).d,i=l,f))do{if(a=tr(c,o+=10),n=e?We(h,o+10):tr(t,o),u=qe(a,n,o,1),!s){+ke(u.d).slice(i+1,i+15)+1==1e14&&(u=Ke(u,l+1,0));break}}while(Ve(u.d,i+=10,f));return Ee=!0,Ke(u,l,f)},He.minus=He.sub=function(t){var e,r,n,i,s,a,o,u,c,h,l,f,p=this,g=p.constructor;if(t=new g(t),!p.d||!t.d)return p.s&&t.s?p.d?t.s=-t.s:t=new g(t.d||p.s!==t.s?p:NaN):t=new g(NaN),t;if(p.s!=t.s)return t.s=-t.s,p.plus(t);if(c=p.d,f=t.d,o=g.precision,u=g.rounding,!c[0]||!f[0]){if(f[0])t.s=-t.s;else{if(!c[0])return new g(3===u?-0:0);t=new g(p)}return Ee?Ke(t,o,u):t}if(r=Ie(t.e/7),h=Ie(p.e/7),c=c.slice(),s=h-r){for((l=s<0)?(e=c,s=-s,a=f.length):(e=f,r=h,a=c.length),s>(n=Math.max(Math.ceil(o/7),a)+2)&&(s=n,e.length=1),e.reverse(),n=s;n--;)e.push(0);e.reverse()}else{for((l=(n=c.length)<(a=f.length))&&(a=n),n=0;n<a;n++)if(c[n]!=f[n]){l=c[n]<f[n];break}s=0}for(l&&(e=c,c=f,f=e,t.s=-t.s),a=c.length,n=f.length-a;n>0;--n)c[a++]=0;for(n=f.length;n>s;){if(c[--n]<f[n]){for(i=n;i&&0===c[--i];)c[i]=Be-1;--c[i],c[n]+=Be}c[n]-=f[n]}for(;0===c[--a];)c.pop();for(;0===c[0];c.shift())--r;return c[0]?(t.d=c,t.e=ze(c,r),Ee?Ke(t,o,u):t):new g(3===u?-0:0)},He.modulo=He.mod=function(t){var e,r=this,n=r.constructor;return t=new n(t),!r.d||!t.s||t.d&&!t.d[0]?new n(NaN):!t.d||r.d&&!r.d[0]?Ke(new n(r),n.precision,n.rounding):(Ee=!1,9==n.modulo?(e=qe(r,t.abs(),0,3,1)).s*=t.s:e=qe(r,t,0,n.modulo,1),e=e.times(t),Ee=!0,r.minus(e))},He.naturalExponential=He.exp=function(){return Qe(this)},He.naturalLogarithm=He.ln=function(){return tr(this)},He.negated=He.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Ke(t)},He.plus=He.add=function(t){var e,r,n,i,s,a,o,u,c,h,l=this,f=l.constructor;if(t=new f(t),!l.d||!t.d)return l.s&&t.s?l.d||(t=new f(t.d||l.s===t.s?l:NaN)):t=new f(NaN),t;if(l.s!=t.s)return t.s=-t.s,l.minus(t);if(c=l.d,h=t.d,o=f.precision,u=f.rounding,!c[0]||!h[0])return h[0]||(t=new f(l)),Ee?Ke(t,o,u):t;if(s=Ie(l.e/7),n=Ie(t.e/7),c=c.slice(),i=s-n){for(i<0?(r=c,i=-i,a=h.length):(r=h,n=s,a=c.length),i>(a=(s=Math.ceil(o/7))>a?s+1:a+1)&&(i=a,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for((a=c.length)-(i=h.length)<0&&(i=a,r=h,h=c,c=r),e=0;i;)e=(c[--i]=c[i]+h[i]+e)/Be|0,c[i]%=Be;for(e&&(c.unshift(e),++n),a=c.length;0==c[--a];)c.pop();return t.d=c,t.e=ze(c,n),Ee?Ke(t,o,u):t},He.precision=He.sd=function(t){var e,r=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(Fe+t);return r.d?(e=$e(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e},He.round=function(){var t=this,e=t.constructor;return Ke(new e(t),t.e+1,e.rounding)},He.sine=He.sin=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+Math.max(r.e,r.sd())+7,n.rounding=1,r=function(t,e){var r,n=e.d.length;if(n<3)return e.isZero()?e:ir(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:0|r,e=e.times(1/sr(5,r)),e=ir(t,2,e,e);for(var i,s=new t(5),a=new t(16),o=new t(20);r--;)i=e.times(e),e=e.times(s.plus(i.times(a.times(i).minus(o))));return e}(n,ar(n,r)),n.precision=t,n.rounding=e,Ke(de>2?r.neg():r,t,e,!0)):new n(NaN)},He.squareRoot=He.sqrt=function(){var t,e,r,n,i,s,a=this,o=a.d,u=a.e,c=a.s,h=a.constructor;if(1!==c||!o||!o[0])return new h(!c||c<0&&(!o||o[0])?NaN:o?a:1/0);for(Ee=!1,0==(c=Math.sqrt(+a))||c==1/0?(((e=ke(o)).length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=Ie((u+1)/2)-(u<0||u%2),n=new h(e=c==1/0?"5e"+u:(e=c.toExponential()).slice(0,e.indexOf("e")+1)+u)):n=new h(c.toString()),r=(u=h.precision)+3;;)if(n=(s=n).plus(qe(a,s,r+2,1)).times(.5),ke(s.d).slice(0,r)===(e=ke(n.d)).slice(0,r)){if("9999"!=(e=e.slice(r-3,r+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Ke(n,u+1,1),t=!n.times(n).eq(a));break}if(!i&&(Ke(s,u+1,0),s.times(s).eq(a))){n=s;break}r+=4,i=1}return Ee=!0,Ke(n,u,h.rounding,t)},He.tangent=He.tan=function(){var t,e,r=this,n=r.constructor;return r.isFinite()?r.isZero()?new n(r):(t=n.precision,e=n.rounding,n.precision=t+10,n.rounding=1,(r=r.sin()).s=1,r=qe(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,Ke(2==de||4==de?r.neg():r,t,e,!0)):new n(NaN)},He.times=He.mul=function(t){var e,r,n,i,s,a,o,u,c,h=this,l=h.constructor,f=h.d,p=(t=new l(t)).d;if(t.s*=h.s,!(f&&f[0]&&p&&p[0]))return new l(!t.s||f&&!f[0]&&!p||p&&!p[0]&&!f?NaN:f&&p?0*t.s:t.s/0);for(r=Ie(h.e/7)+Ie(t.e/7),(u=f.length)<(c=p.length)&&(s=f,f=p,p=s,a=u,u=c,c=a),s=[],n=a=u+c;n--;)s.push(0);for(n=c;--n>=0;){for(e=0,i=u+n;i>n;)o=s[i]+p[n]*f[i-n-1]+e,s[i--]=o%Be|0,e=o/Be|0;s[i]=(s[i]+e)%Be|0}for(;!s[--a];)s.pop();return e?++r:s.shift(),t.d=s,t.e=ze(s,r),Ee?Ke(t,l.precision,l.rounding):t},He.toBinary=function(t,e){return or(this,2,t,e)},He.toDecimalPlaces=He.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),void 0===t?r:(Le(t,0,me),void 0===e?e=n.rounding:Le(e,0,8),Ke(r,t+r.e+1,e))},He.toExponential=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=Ue(n,!0):(Le(t,0,me),void 0===e?e=i.rounding:Le(e,0,8),r=Ue(n=Ke(new i(n),t+1,e),!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r},He.toFixed=function(t,e){var r,n,i=this,s=i.constructor;return void 0===t?r=Ue(i):(Le(t,0,me),void 0===e?e=s.rounding:Le(e,0,8),r=Ue(n=Ke(new s(i),t+i.e+1,e),!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},He.toFraction=function(t){var e,r,n,i,s,a,o,u,c,h,l,f,p=this,g=p.d,d=p.constructor;if(!g)return new d(p);if(c=r=new d(1),n=u=new d(0),a=(s=(e=new d(n)).e=$e(g)-p.e-1)%7,e.d[0]=Pe(10,a<0?7+a:a),null==t)t=s>0?e:c;else{if(!(o=new d(t)).isInt()||o.lt(c))throw Error(Fe+o);t=o.gt(e)?s>0?e:c:o}for(Ee=!1,o=new d(ke(g)),h=d.precision,d.precision=s=7*g.length*2;l=qe(o,e,0,1,1),1!=(i=r.plus(l.times(n))).cmp(t);)r=n,n=i,i=c,c=u.plus(l.times(i)),u=i,i=e,e=o.minus(l.times(i)),o=i;return i=qe(t.minus(r),n,0,1,1),u=u.plus(i.times(c)),r=r.plus(i.times(n)),u.s=c.s=p.s,f=qe(c,n,s,1).minus(p).abs().cmp(qe(u,r,s,1).minus(p).abs())<1?[c,n]:[u,r],d.precision=h,Ee=!0,f},He.toHexadecimal=He.toHex=function(t,e){return or(this,16,t,e)},He.toNearest=function(t,e){var r=this,n=r.constructor;if(r=new n(r),null==t){if(!r.d)return r;t=new n(1),e=n.rounding}else{if(t=new n(t),void 0===e?e=n.rounding:Le(e,0,8),!r.d)return t.s?r:t;if(!t.d)return t.s&&(t.s=r.s),t}return t.d[0]?(Ee=!1,r=qe(r,t,0,e,1).times(t),Ee=!0,Ke(r)):(t.s=r.s,r=t),r},He.toNumber=function(){return+this},He.toOctal=function(t,e){return or(this,8,t,e)},He.toPower=He.pow=function(t){var e,r,n,i,s,a,o=this,u=o.constructor,c=+(t=new u(t));if(!(o.d&&t.d&&o.d[0]&&t.d[0]))return new u(Pe(+o,c));if((o=new u(o)).eq(1))return o;if(n=u.precision,s=u.rounding,t.eq(1))return Ke(o,n,s);if((e=Ie(t.e/7))>=t.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=Ye(u,o,r,n),t.s<0?new u(1).div(i):Ke(i,n,s);if((a=o.s)<0){if(e<t.d.length-1)return new u(NaN);if(1&t.d[e]||(a=1),0==o.e&&1==o.d[0]&&1==o.d.length)return o.s=a,o}return(e=0!=(r=Pe(+o,c))&&isFinite(r)?new u(r+"").e:Ie(c*(Math.log("0."+ke(o.d))/Math.LN10+o.e+1)))>u.maxE+1||e<u.minE-1?new u(e>0?a/0:0):(Ee=!1,u.rounding=o.s=1,r=Math.min(12,(e+"").length),(i=Qe(t.times(tr(o,n+r)),n)).d&&Ve((i=Ke(i,n+5,1)).d,n,s)&&(e=n+10,+ke((i=Ke(Qe(t.times(tr(o,e+r)),e),e+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=Ke(i,n+1,0))),i.s=a,Ee=!0,u.rounding=s,Ke(i,n,s))},He.toPrecision=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=Ue(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(Le(t,1,me),void 0===e?e=i.rounding:Le(e,0,8),r=Ue(n=Ke(new i(n),t,e),t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r},He.toSignificantDigits=He.toSD=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(Le(t,1,me),void 0===e?e=r.rounding:Le(e,0,8)),Ke(new r(this),t,e)},He.toString=function(){var t=this,e=t.constructor,r=Ue(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r},He.truncated=He.trunc=function(){return Ke(new this.constructor(this),this.e+1,1)},He.valueOf=He.toJSON=function(){var t=this,e=t.constructor,r=Ue(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};var qe=function(){function t(t,e,r){var n,i=0,s=t.length;for(t=t.slice();s--;)n=t[s]*e+i,t[s]=n%r|0,i=n/r|0;return i&&t.unshift(i),t}function e(t,e,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(t[i]!=e[i]){s=t[i]>e[i]?1:-1;break}return s}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;)t.shift()}return function(n,i,s,a,o,u){var c,h,l,f,p,g,d,v,m,y,x,w,S,E,b,F,A,C,D,I,P=n.constructor,T=n.s==i.s?1:-1,R=n.d,N=i.d;if(!(R&&R[0]&&N&&N[0]))return new P(n.s&&i.s&&(R?!N||R[0]!=N[0]:N)?R&&0==R[0]||!N?0*T:T/0:NaN);for(u?(p=1,h=n.e-i.e):(u=Be,p=7,h=Ie(n.e/p)-Ie(i.e/p)),D=N.length,A=R.length,y=(m=new P(T)).d=[],l=0;N[l]==(R[l]||0);l++);if(N[l]>(R[l]||0)&&h--,null==s?(E=s=P.precision,a=P.rounding):E=o?s+(n.e-i.e)+1:s,E<0)y.push(1),g=!0;else{if(E=E/p+2|0,l=0,1==D){for(f=0,N=N[0],E++;(l<A||f)&&E--;l++)b=f*u+(R[l]||0),y[l]=b/N|0,f=b%N|0;g=f||l<A}else{for((f=u/(N[0]+1)|0)>1&&(N=t(N,f,u),R=t(R,f,u),D=N.length,A=R.length),F=D,w=(x=R.slice(0,D)).length;w<D;)x[w++]=0;(I=N.slice()).unshift(0),C=N[0],N[1]>=u/2&&++C;do{f=0,(c=e(N,x,D,w))<0?(S=x[0],D!=w&&(S=S*u+(x[1]||0)),(f=S/C|0)>1?(f>=u&&(f=u-1),1==(c=e(d=t(N,f,u),x,v=d.length,w=x.length))&&(f--,r(d,D<v?I:N,v,u))):(0==f&&(c=f=1),d=N.slice()),(v=d.length)<w&&d.unshift(0),r(x,d,w,u),-1==c&&(c=e(N,x,D,w=x.length))<1&&(f++,r(x,D<w?I:N,w,u)),w=x.length):0===c&&(f++,x=[0]),y[l++]=f,c&&x[0]?x[w++]=R[F]||0:(x=[R[F]],w=1)}while((F++<A||void 0!==x[0])&&E--);g=void 0!==x[0]}y[0]||y.shift()}if(1==p)m.e=h,ge=g;else{for(l=1,f=y[0];f>=10;f/=10)l++;m.e=l+h*p-1,Ke(m,o?s+m.e+1:s,a,g)}return m}}();function Ke(t,e,r,n){var i,s,a,o,u,c,h,l,f,p=t.constructor;t:if(null!=e){if(!(l=t.d))return t;for(i=1,o=l[0];o>=10;o/=10)i++;if((s=e-i)<0)s+=7,a=e,u=(h=l[f=0])/Pe(10,i-a-1)%10|0;else if((f=Math.ceil((s+1)/7))>=(o=l.length)){if(!n)break t;for(;o++<=f;)l.push(0);h=u=0,i=1,a=(s%=7)-7+1}else{for(h=o=l[f],i=1;o>=10;o/=10)i++;u=(a=(s%=7)-7+i)<0?0:h/Pe(10,i-a-1)%10|0}if(n=n||e<0||void 0!==l[f+1]||(a<0?h:h%Pe(10,i-a-1)),c=r<4?(u||n)&&(0==r||r==(t.s<0?3:2)):u>5||5==u&&(4==r||n||6==r&&(s>0?a>0?h/Pe(10,i-a):0:l[f-1])%10&1||r==(t.s<0?8:7)),e<1||!l[0])return l.length=0,c?(e-=t.e+1,l[0]=Pe(10,(7-e%7)%7),t.e=-e||0):l[0]=t.e=0,t;if(0==s?(l.length=f,o=1,f--):(l.length=f+1,o=Pe(10,7-s),l[f]=a>0?(h/Pe(10,i-a)%Pe(10,a)|0)*o:0),c)for(;;){if(0==f){for(s=1,a=l[0];a>=10;a/=10)s++;for(a=l[0]+=o,o=1;a>=10;a/=10)o++;s!=o&&(t.e++,l[0]==Be&&(l[0]=1));break}if(l[f]+=o,l[f]!=Be)break;l[f--]=0,o=1}for(s=l.length;0===l[--s];)l.pop()}return Ee&&(t.e>p.maxE?(t.d=null,t.e=NaN):t.e<p.minE&&(t.e=0,t.d=[0])),t}function Ue(t,e,r){if(!t.isFinite())return er(t);var n,i=t.e,s=ke(t.d),a=s.length;return e?(r&&(n=r-a)>0?s=s.charAt(0)+"."+s.slice(1)+Je(n):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(t.e<0?"e":"e+")+t.e):i<0?(s="0."+Je(-i-1)+s,r&&(n=r-a)>0&&(s+=Je(n))):i>=a?(s+=Je(i+1-a),r&&(n=r-i-1)>0&&(s=s+"."+Je(n))):((n=i+1)<a&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-a)>0&&(i+1===a&&(s+="."),s+=Je(n))),s}function ze(t,e){var r=t[0];for(e*=7;r>=10;r/=10)e++;return e}function We(t,e,r){if(e>_e)throw Ee=!0,r&&(t.precision=r),Error(Ae);return Ke(new t(xe),e,1,!0)}function Ge(t,e,r){if(e>je)throw Error(Ae);return Ke(new t(we),e,r,!0)}function $e(t){var e=t.length-1,r=7*e+1;if(e=t[e]){for(;e%10==0;e/=10)r--;for(e=t[0];e>=10;e/=10)r++}return r}function Je(t){for(var e="";t--;)e+="0";return e}function Ye(t,e,r,n){var i,s=new t(1),a=Math.ceil(n/7+4);for(Ee=!1;;){if(r%2&&ur((s=s.times(e)).d,a)&&(i=!0),0===(r=Ie(r/2))){r=s.d.length-1,i&&0===s.d[r]&&++s.d[r];break}ur((e=e.times(e)).d,a)}return Ee=!0,s}function Xe(t){return 1&t.d[t.d.length-1]}function Ze(t,e,r){for(var n,i,s=new t(e[0]),a=0;++a<e.length;){if(!(i=new t(e[a])).s){s=i;break}((n=s.cmp(i))===r||0===n&&s.s===r)&&(s=i)}return s}function Qe(t,e){var r,n,i,s,a,o,u,c=0,h=0,l=0,f=t.constructor,p=f.rounding,g=f.precision;if(!t.d||!t.d[0]||t.e>17)return new f(t.d?t.d[0]?t.s<0?0:1/0:1:t.s?t.s<0?0:t:NaN);for(null==e?(Ee=!1,u=g):u=e,o=new f(.03125);t.e>-2;)t=t.times(o),l+=5;for(u+=n=Math.log(Pe(2,l))/Math.LN10*2+5|0,r=s=a=new f(1),f.precision=u;;){if(s=Ke(s.times(t),u,1),r=r.times(++h),ke((o=a.plus(qe(s,r,u,1))).d).slice(0,u)===ke(a.d).slice(0,u)){for(i=l;i--;)a=Ke(a.times(a),u,1);if(null!=e)return f.precision=g,a;if(!(c<3&&Ve(a.d,u-n,p,c)))return Ke(a,f.precision=g,p,Ee=!0);f.precision=u+=10,r=s=o=new f(1),h=0,c++}a=o}}function tr(t,e){var r,n,i,s,a,o,u,c,h,l,f,p=1,g=t,d=g.d,v=g.constructor,m=v.rounding,y=v.precision;if(g.s<0||!d||!d[0]||!g.e&&1==d[0]&&1==d.length)return new v(d&&!d[0]?-1/0:1!=g.s?NaN:d?0:g);if(null==e?(Ee=!1,h=y):h=e,v.precision=h+=10,n=(r=ke(d)).charAt(0),!(Math.abs(s=g.e)<15e14))return c=We(v,h+2,y).times(s+""),g=tr(new v(n+"."+r.slice(1)),h-10).plus(c),v.precision=y,null==e?Ke(g,y,m,Ee=!0):g;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=ke((g=g.times(t)).d)).charAt(0),p++;for(s=g.e,n>1?(g=new v("0."+r),s++):g=new v(n+"."+r.slice(1)),l=g,u=a=g=qe(g.minus(1),g.plus(1),h,1),f=Ke(g.times(g),h,1),i=3;;){if(a=Ke(a.times(f),h,1),ke((c=u.plus(qe(a,new v(i),h,1))).d).slice(0,h)===ke(u.d).slice(0,h)){if(u=u.times(2),0!==s&&(u=u.plus(We(v,h+2,y).times(s+""))),u=qe(u,new v(p),h,1),null!=e)return v.precision=y,u;if(!Ve(u.d,h-10,m,o))return Ke(u,v.precision=y,m,Ee=!0);v.precision=h+=10,c=a=g=qe(l.minus(1),l.plus(1),h,1),f=Ke(g.times(g),h,1),i=o=1}u=c,i+=2}}function er(t){return String(t.s*t.s/0)}function rr(t,e){var r,n,i;for((r=e.indexOf("."))>-1&&(e=e.replace(".","")),(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length),n=0;48===e.charCodeAt(n);n++);for(i=e.length;48===e.charCodeAt(i-1);--i);if(e=e.slice(n,i)){if(i-=n,t.e=r=r-n-1,t.d=[],n=(r+1)%7,r<0&&(n+=7),n<i){for(n&&t.d.push(+e.slice(0,n)),i-=7;n<i;)t.d.push(+e.slice(n,n+=7));n=7-(e=e.slice(n)).length}else n-=i;for(;n--;)e+="0";t.d.push(+e),Ee&&(t.e>t.constructor.maxE?(t.d=null,t.e=NaN):t.e<t.constructor.minE&&(t.e=0,t.d=[0]))}else t.e=0,t.d=[0];return t}function nr(t,e){var r,n,i,s,a,o,u,c,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Oe.test(e))return rr(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Re.test(e))r=16,e=e.toLowerCase();else if(Te.test(e))r=2;else{if(!Ne.test(e))throw Error(Fe+e);r=8}for((s=e.search(/p/i))>0?(u=+e.slice(s+1),e=e.substring(2,s)):e=e.slice(2),a=(s=e.indexOf("."))>=0,n=t.constructor,a&&(s=(o=(e=e.replace(".","")).length)-s,i=Ye(n,new n(r),s,2*s)),s=h=(c=Me(e,r,Be)).length-1;0===c[s];--s)c.pop();return s<0?new n(0*t.s):(t.e=ze(c,h),t.d=c,Ee=!1,a&&(t=qe(t,i,4*o)),u&&(t=t.times(Math.abs(u)<54?Pe(2,u):Jr.pow(2,u))),Ee=!0,t)}function ir(t,e,r,n,i){var s,a,o,u,c=t.precision,h=Math.ceil(c/7);for(Ee=!1,u=r.times(r),o=new t(n);;){if(a=qe(o.times(u),new t(e++*e++),c,1),o=i?n.plus(a):n.minus(a),n=qe(a.times(u),new t(e++*e++),c,1),void 0!==(a=o.plus(n)).d[h]){for(s=h;a.d[s]===o.d[s]&&s--;);if(-1==s)break}s=o,o=n,n=a,a=s}return Ee=!0,a.d.length=h+1,a}function sr(t,e){for(var r=t;--e;)r*=t;return r}function ar(t,e){var r,n=e.s<0,i=Ge(t,t.precision,1),s=i.times(.5);if((e=e.abs()).lte(s))return de=n?4:1,e;if((r=e.divToInt(i)).isZero())de=n?3:2;else{if((e=e.minus(r.times(i))).lte(s))return de=Xe(r)?n?2:3:n?4:1,e;de=Xe(r)?n?1:4:n?3:2}return e.minus(i).abs()}function or(t,e,r,n){var i,s,a,o,u,c,h,l,f,p=t.constructor,g=void 0!==r;if(g?(Le(r,1,me),void 0===n?n=p.rounding:Le(n,0,8)):(r=p.precision,n=p.rounding),t.isFinite()){for(g?(i=2,16==e?r=4*r-3:8==e&&(r=3*r-2)):i=e,(a=(h=Ue(t)).indexOf("."))>=0&&(h=h.replace(".",""),(f=new p(1)).e=h.length-a,f.d=Me(Ue(f),10,i),f.e=f.d.length),s=u=(l=Me(h,10,i)).length;0==l[--u];)l.pop();if(l[0]){if(a<0?s--:((t=new p(t)).d=l,t.e=s,l=(t=qe(t,f,r,n,0,i)).d,s=t.e,c=ge),a=l[r],o=i/2,c=c||void 0!==l[r+1],c=n<4?(void 0!==a||c)&&(0===n||n===(t.s<0?3:2)):a>o||a===o&&(4===n||c||6===n&&1&l[r-1]||n===(t.s<0?8:7)),l.length=r,c)for(;++l[--r]>i-1;)l[r]=0,r||(++s,l.unshift(1));for(u=l.length;!l[u-1];--u);for(a=0,h="";a<u;a++)h+=ye.charAt(l[a]);if(g){if(u>1)if(16==e||8==e){for(a=16==e?4:3,--u;u%a;u++)h+="0";for(u=(l=Me(h,i,e)).length;!l[u-1];--u);for(a=1,h="1.";a<u;a++)h+=ye.charAt(l[a])}else h=h.charAt(0)+"."+h.slice(1);h=h+(s<0?"p":"p+")+s}else if(s<0){for(;++s;)h="0"+h;h="0."+h}else if(++s>u)for(s-=u;s--;)h+="0";else s<u&&(h=h.slice(0,s)+"."+h.slice(s))}else h=g?"0p+0":"0";h=(16==e?"0x":2==e?"0b":8==e?"0o":"")+h}else h=er(t);return t.s<0?"-"+h:h}function ur(t,e){if(t.length>e)return t.length=e,!0}function cr(t){return new this(t).abs()}function hr(t){return new this(t).acos()}function lr(t){return new this(t).acosh()}function fr(t,e){return new this(t).plus(e)}function pr(t){return new this(t).asin()}function gr(t){return new this(t).asinh()}function dr(t){return new this(t).atan()}function vr(t){return new this(t).atanh()}function mr(t,e){t=new this(t),e=new this(e);var r,n=this.precision,i=this.rounding,s=n+4;return t.s&&e.s?t.d||e.d?!e.d||t.isZero()?(r=e.s<0?Ge(this,n,i):new this(0)).s=t.s:!t.d||e.isZero()?(r=Ge(this,s,1).times(.5)).s=t.s:e.s<0?(this.precision=s,this.rounding=1,r=this.atan(qe(t,e,s,1)),e=Ge(this,s,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(qe(t,e,s,1)):(r=Ge(this,s,1).times(e.s>0?.25:.75)).s=t.s:r=new this(NaN),r}function yr(t){return new this(t).cbrt()}function xr(t){return Ke(t=new this(t),t.e+1,2)}function wr(t,e,r){return new this(t).clamp(e,r)}function Sr(t){if(!t||"object"!=typeof t)throw Error(be+"Object expected");var e,r,n,i=!0===t.defaults,s=["precision",1,me,"rounding",0,8,"toExpNeg",-ve,0,"toExpPos",0,ve,"maxE",0,ve,"minE",-ve,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(r=s[e],i&&(this[r]=Se[r]),void 0!==(n=t[r])){if(!(Ie(n)===n&&n>=s[e+1]&&n<=s[e+2]))throw Error(Fe+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=Se[r]),void 0!==(n=t[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(Fe+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(Ce);this[r]=!0}else this[r]=!1}return this}function Er(t){return new this(t).cos()}function br(t){return new this(t).cosh()}function Fr(t,e){return new this(t).div(e)}function Ar(t){return new this(t).exp()}function Cr(t){return Ke(t=new this(t),t.e+1,3)}function Dr(){var t,e,r=new this(0);for(Ee=!1,t=0;t<arguments.length;)if((e=new this(arguments[t++])).d)r.d&&(r=r.plus(e.times(e)));else{if(e.s)return Ee=!0,new this(1/0);r=e}return Ee=!0,r.sqrt()}function Ir(t){return t instanceof Jr||t&&t.toStringTag===De||!1}function Pr(t){return new this(t).ln()}function Tr(t,e){return new this(t).log(e)}function Rr(t){return new this(t).log(2)}function Nr(t){return new this(t).log(10)}function Or(){return Ze(this,arguments,-1)}function Br(){return Ze(this,arguments,1)}function _r(t,e){return new this(t).mod(e)}function jr(t,e){return new this(t).mul(e)}function Hr(t,e){return new this(t).pow(e)}function kr(t){var e,r,n,i,s=0,a=new this(1),o=[];if(void 0===t?t=this.precision:Le(t,1,me),n=Math.ceil(t/7),this.crypto)if(crypto.getRandomValues)for(e=crypto.getRandomValues(new Uint32Array(n));s<n;)(i=e[s])>=429e7?e[s]=crypto.getRandomValues(new Uint32Array(1))[0]:o[s++]=i%1e7;else{if(!crypto.randomBytes)throw Error(Ce);for(e=crypto.randomBytes(n*=4);s<n;)(i=e[s]+(e[s+1]<<8)+(e[s+2]<<16)+((127&e[s+3])<<24))>=214e7?crypto.randomBytes(4).copy(e,s):(o.push(i%1e7),s+=4);s=n/4}else for(;s<n;)o[s++]=1e7*Math.random()|0;for(t%=7,(n=o[--s])&&t&&(i=Pe(10,7-t),o[s]=(n/i|0)*i);0===o[s];s--)o.pop();if(s<0)r=0,o=[0];else{for(r=-1;0===o[0];r-=7)o.shift();for(n=1,i=o[0];i>=10;i/=10)n++;n<7&&(r-=7-n)}return a.e=r,a.d=o,a}function Lr(t){return Ke(t=new this(t),t.e+1,this.rounding)}function Vr(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function Mr(t){return new this(t).sin()}function qr(t){return new this(t).sinh()}function Kr(t){return new this(t).sqrt()}function Ur(t,e){return new this(t).sub(e)}function zr(){var t=0,e=arguments,r=new this(e[t]);for(Ee=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return Ee=!0,Ke(r,this.precision,this.rounding)}function Wr(t){return new this(t).tan()}function Gr(t){return new this(t).tanh()}function $r(t){return Ke(t=new this(t),t.e+1,1)}He[Symbol.for("nodejs.util.inspect.custom")]=He.toString,He[Symbol.toStringTag]="Decimal";var Jr=He.constructor=function t(e){var r,n,i;function s(t){var e,r,n,i=this;if(!(i instanceof s))return new s(t);if(i.constructor=s,Ir(t))return i.s=t.s,void(Ee?!t.d||t.e>s.maxE?(i.e=NaN,i.d=null):t.e<s.minE?(i.e=0,i.d=[0]):(i.e=t.e,i.d=t.d.slice()):(i.e=t.e,i.d=t.d?t.d.slice():t.d));if("number"===(n=typeof t)){if(0===t)return i.s=1/t<0?-1:1,i.e=0,void(i.d=[0]);if(t<0?(t=-t,i.s=-1):i.s=1,t===~~t&&t<1e7){for(e=0,r=t;r>=10;r/=10)e++;return void(Ee?e>s.maxE?(i.e=NaN,i.d=null):e<s.minE?(i.e=0,i.d=[0]):(i.e=e,i.d=[t]):(i.e=e,i.d=[t]))}return 0*t!=0?(t||(i.s=NaN),i.e=NaN,void(i.d=null)):rr(i,t.toString())}if("string"===n)return 45===(r=t.charCodeAt(0))?(t=t.slice(1),i.s=-1):(43===r&&(t=t.slice(1)),i.s=1),Oe.test(t)?rr(i,t):nr(i,t);if("bigint"===n)return t<0?(t=-t,i.s=-1):i.s=1,rr(i,t.toString());throw Error(Fe+t)}if(s.prototype=He,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=Sr,s.clone=t,s.isDecimal=Ir,s.abs=cr,s.acos=hr,s.acosh=lr,s.add=fr,s.asin=pr,s.asinh=gr,s.atan=dr,s.atanh=vr,s.atan2=mr,s.cbrt=yr,s.ceil=xr,s.clamp=wr,s.cos=Er,s.cosh=br,s.div=Fr,s.exp=Ar,s.floor=Cr,s.hypot=Dr,s.ln=Pr,s.log=Tr,s.log10=Nr,s.log2=Rr,s.max=Or,s.min=Br,s.mod=_r,s.mul=jr,s.pow=Hr,s.random=kr,s.round=Lr,s.sign=Vr,s.sin=Mr,s.sinh=qr,s.sqrt=Kr,s.sub=Ur,s.sum=zr,s.tan=Wr,s.tanh=Gr,s.trunc=$r,void 0===e&&(e={}),e&&!0!==e.defaults)for(i=["precision","rounding","toExpNeg","toExpPos","maxE","minE","modulo","crypto"],r=0;r<i.length;)e.hasOwnProperty(n=i[r++])||(e[n]=this[n]);return s.config(e),s}(Se);xe=new Jr(xe),we=new Jr(we);const Yr=Jr.clone({precision:40,rounding:Jr.ROUND_HALF_UP});function Xr(t,e){return function(){return t.apply(e,arguments)}}const{toString:Zr}=Object.prototype,{getPrototypeOf:Qr}=Object,{iterator:tn,toStringTag:en}=Symbol,rn=(nn=Object.create(null),t=>{const e=Zr.call(t);return nn[e]||(nn[e]=e.slice(8,-1).toLowerCase())});var nn;const sn=t=>(t=t.toLowerCase(),e=>rn(e)===t),an=t=>e=>typeof e===t,{isArray:on}=Array,un=an("undefined");function cn(t){return null!==t&&!un(t)&&null!==t.constructor&&!un(t.constructor)&&fn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const hn=sn("ArrayBuffer");const ln=an("string"),fn=an("function"),pn=an("number"),gn=t=>null!==t&&"object"==typeof t,dn=t=>{if("object"!==rn(t))return!1;const e=Qr(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||en in t||tn in t)},vn=sn("Date"),mn=sn("File"),yn=sn("Blob"),xn=sn("FileList"),wn=sn("URLSearchParams"),[Sn,En,bn,Fn]=["ReadableStream","Request","Response","Headers"].map(sn);function An(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let n,i;if("object"!=typeof t&&(t=[t]),on(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{if(cn(t))return;const i=r?Object.getOwnPropertyNames(t):Object.keys(t),s=i.length;let a;for(n=0;n<s;n++)a=i[n],e.call(null,t[a],a,t)}}function Cn(t,e){if(cn(t))return null;e=e.toLowerCase();const r=Object.keys(t);let n,i=r.length;for(;i-- >0;)if(n=r[i],e===n.toLowerCase())return n;return null}const Dn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,In=t=>!un(t)&&t!==Dn;const Pn=(Tn="undefined"!=typeof Uint8Array&&Qr(Uint8Array),t=>Tn&&t instanceof Tn);var Tn;const Rn=sn("HTMLFormElement"),Nn=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),On=sn("RegExp"),Bn=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};An(r,(r,i)=>{let s;!1!==(s=e(r,i,t))&&(n[i]=s||r)}),Object.defineProperties(t,n)};const _n=sn("AsyncFunction"),jn=(Hn="function"==typeof setImmediate,kn=fn(Dn.postMessage),Hn?setImmediate:kn?(Ln=`axios@${Math.random()}`,Vn=[],Dn.addEventListener("message",({source:t,data:e})=>{t===Dn&&e===Ln&&Vn.length&&Vn.shift()()},!1),t=>{Vn.push(t),Dn.postMessage(Ln,"*")}):t=>setTimeout(t));var Hn,kn,Ln,Vn;const Mn="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Dn):"undefined"!=typeof process&&process.nextTick||jn;var qn={isArray:on,isArrayBuffer:hn,isBuffer:cn,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||fn(t.append)&&("formdata"===(e=rn(t))||"object"===e&&fn(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&hn(t.buffer),e},isString:ln,isNumber:pn,isBoolean:t=>!0===t||!1===t,isObject:gn,isPlainObject:dn,isEmptyObject:t=>{if(!gn(t)||cn(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:Sn,isRequest:En,isResponse:bn,isHeaders:Fn,isUndefined:un,isDate:vn,isFile:mn,isBlob:yn,isRegExp:On,isFunction:fn,isStream:t=>gn(t)&&fn(t.pipe),isURLSearchParams:wn,isTypedArray:Pn,isFileList:xn,forEach:An,merge:function t(){const{caseless:e}=In(this)&&this||{},r={},n=(n,i)=>{const s=e&&Cn(r,i)||i;dn(r[s])&&dn(n)?r[s]=t(r[s],n):dn(n)?r[s]=t({},n):on(n)?r[s]=n.slice():r[s]=n};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&An(arguments[t],n);return r},extend:(t,e,r,{allOwnKeys:n}={})=>(An(e,(e,n)=>{r&&fn(e)?t[n]=Xr(e,r):t[n]=e},{allOwnKeys:n}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,n)=>{let i,s,a;const o={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)a=i[s],n&&!n(a,t,e)||o[a]||(e[a]=t[a],o[a]=!0);t=!1!==r&&Qr(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:rn,kindOfTest:sn,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return-1!==n&&n===r},toArray:t=>{if(!t)return null;if(on(t))return t;let e=t.length;if(!pn(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[tn]).call(t);let n;for(;(n=r.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const n=[];for(;null!==(r=t.exec(e));)n.push(r);return n},isHTMLForm:Rn,hasOwnProperty:Nn,hasOwnProp:Nn,reduceDescriptors:Bn,freezeMethods:t=>{Bn(t,(e,r)=>{if(fn(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=t[r];fn(n)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))})},toObjectSet:(t,e)=>{const r={},n=t=>{t.forEach(t=>{r[t]=!0})};return on(t)?n(t):n(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,e,r){return e.toUpperCase()+r}),noop:()=>{},toFiniteNumber:(t,e)=>null!=t&&Number.isFinite(t=+t)?t:e,findKey:Cn,global:Dn,isContextDefined:In,isSpecCompliantForm:function(t){return!!(t&&fn(t.append)&&"FormData"===t[en]&&t[tn])},toJSONObject:t=>{const e=new Array(10),r=(t,n)=>{if(gn(t)){if(e.indexOf(t)>=0)return;if(cn(t))return t;if(!("toJSON"in t)){e[n]=t;const i=on(t)?[]:{};return An(t,(t,e)=>{const s=r(t,n+1);!un(s)&&(i[e]=s)}),e[n]=void 0,i}}return t};return r(t,0)},isAsyncFn:_n,isThenable:t=>t&&(gn(t)||fn(t))&&fn(t.then)&&fn(t.catch),setImmediate:jn,asap:Mn,isIterable:t=>null!=t&&fn(t[tn])};function Kn(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}qn.inherits(Kn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:qn.toJSONObject(this.config),code:this.code,status:this.status}}});const Un=Kn.prototype,zn={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{zn[t]={value:t}}),Object.defineProperties(Kn,zn),Object.defineProperty(Un,"isAxiosError",{value:!0}),Kn.from=(t,e,r,n,i,s)=>{const a=Object.create(Un);return qn.toFlatObject(t,a,function(t){return t!==Error.prototype},t=>"isAxiosError"!==t),Kn.call(a,t.message,e,r,n,i),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};function Wn(t){return qn.isPlainObject(t)||qn.isArray(t)}function Gn(t){return qn.endsWith(t,"[]")?t.slice(0,-2):t}function $n(t,e,r){return t?t.concat(e).map(function(t,e){return t=Gn(t),!r&&e?"["+t+"]":t}).join(r?".":""):e}const Jn=qn.toFlatObject(qn,{},null,function(t){return/^is[A-Z]/.test(t)});function Yn(t,e,r){if(!qn.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const n=(r=qn.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!qn.isUndefined(e[t])})).metaTokens,i=r.visitor||c,s=r.dots,a=r.indexes,o=(r.Blob||"undefined"!=typeof Blob&&Blob)&&qn.isSpecCompliantForm(e);if(!qn.isFunction(i))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(qn.isDate(t))return t.toISOString();if(qn.isBoolean(t))return t.toString();if(!o&&qn.isBlob(t))throw new Kn("Blob is not supported. Use a Buffer instead.");return qn.isArrayBuffer(t)||qn.isTypedArray(t)?o&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function c(t,r,i){let o=t;if(t&&!i&&"object"==typeof t)if(qn.endsWith(r,"{}"))r=n?r:r.slice(0,-2),t=JSON.stringify(t);else if(qn.isArray(t)&&function(t){return qn.isArray(t)&&!t.some(Wn)}(t)||(qn.isFileList(t)||qn.endsWith(r,"[]"))&&(o=qn.toArray(t)))return r=Gn(r),o.forEach(function(t,n){!qn.isUndefined(t)&&null!==t&&e.append(!0===a?$n([r],n,s):null===a?r:r+"[]",u(t))}),!1;return!!Wn(t)||(e.append($n(i,r,s),u(t)),!1)}const h=[],l=Object.assign(Jn,{defaultVisitor:c,convertValue:u,isVisitable:Wn});if(!qn.isObject(t))throw new TypeError("data must be an object");return function t(r,n){if(!qn.isUndefined(r)){if(-1!==h.indexOf(r))throw Error("Circular reference detected in "+n.join("."));h.push(r),qn.forEach(r,function(r,s){!0===(!(qn.isUndefined(r)||null===r)&&i.call(e,r,qn.isString(s)?s.trim():s,n,l))&&t(r,n?n.concat(s):[s])}),h.pop()}}(t),e}function Xn(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function Zn(t,e){this._pairs=[],t&&Yn(t,this,e)}const Qn=Zn.prototype;function ti(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ei(t,e,r){if(!e)return t;const n=r&&r.encode||ti;qn.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(s=i?i(e,r):qn.isURLSearchParams(e)?e.toString():new Zn(e,r).toString(n),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}Qn.append=function(t,e){this._pairs.push([t,e])},Qn.toString=function(t){const e=t?function(e){return t.call(this,e,Xn)}:Xn;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};var ri=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){qn.forEach(this.handlers,function(e){null!==e&&t(e)})}},ni={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ii={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Zn,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const si="undefined"!=typeof window&&"undefined"!=typeof document,ai="object"==typeof navigator&&navigator||void 0,oi=si&&(!ai||["ReactNative","NativeScript","NS"].indexOf(ai.product)<0),ui="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ci=si&&window.location.href||"http://localhost";var hi={...Object.freeze({__proto__:null,hasBrowserEnv:si,hasStandardBrowserEnv:oi,hasStandardBrowserWebWorkerEnv:ui,navigator:ai,origin:ci}),...ii};function li(t){function e(t,r,n,i){let s=t[i++];if("__proto__"===s)return!0;const a=Number.isFinite(+s),o=i>=t.length;if(s=!s&&qn.isArray(n)?n.length:s,o)return qn.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!a;n[s]&&qn.isObject(n[s])||(n[s]=[]);return e(t,r,n[s],i)&&qn.isArray(n[s])&&(n[s]=function(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],e[s]=t[s];return e}(n[s])),!a}if(qn.isFormData(t)&&qn.isFunction(t.entries)){const r={};return qn.forEachEntry(t,(t,n)=>{e(function(t){return qn.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),n,r,0)}),r}return null}const fi={transitional:ni,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const r=e.getContentType()||"",n=r.indexOf("application/json")>-1,i=qn.isObject(t);i&&qn.isHTMLForm(t)&&(t=new FormData(t));if(qn.isFormData(t))return n?JSON.stringify(li(t)):t;if(qn.isArrayBuffer(t)||qn.isBuffer(t)||qn.isStream(t)||qn.isFile(t)||qn.isBlob(t)||qn.isReadableStream(t))return t;if(qn.isArrayBufferView(t))return t.buffer;if(qn.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return Yn(t,new hi.classes.URLSearchParams,{visitor:function(t,e,r,n){return hi.isNode&&qn.isBuffer(t)?(this.append(e,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((s=qn.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return Yn(s?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||n?(e.setContentType("application/json",!1),function(t,e,r){if(qn.isString(t))try{return(e||JSON.parse)(t),qn.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||fi.transitional,r=e&&e.forcedJSONParsing,n="json"===this.responseType;if(qn.isResponse(t)||qn.isReadableStream(t))return t;if(t&&qn.isString(t)&&(r&&!this.responseType||n)){const r=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw Kn.from(t,Kn.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:hi.classes.FormData,Blob:hi.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};qn.forEach(["delete","get","head","post","put","patch"],t=>{fi.headers[t]={}});var pi=fi;const gi=qn.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const di=Symbol("internals");function vi(t){return t&&String(t).trim().toLowerCase()}function mi(t){return!1===t||null==t?t:qn.isArray(t)?t.map(mi):String(t)}function yi(t,e,r,n,i){return qn.isFunction(n)?n.call(this,e,r):(i&&(e=r),qn.isString(e)?qn.isString(n)?-1!==e.indexOf(n):qn.isRegExp(n)?n.test(e):void 0:void 0)}class xi{constructor(t){t&&this.set(t)}set(t,e,r){const n=this;function i(t,e,r){const i=vi(e);if(!i)throw new Error("header name must be a non-empty string");const s=qn.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||e]=mi(t))}const s=(t,e)=>qn.forEach(t,(t,r)=>i(t,r,e));if(qn.isPlainObject(t)||t instanceof this.constructor)s(t,e);else if(qn.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim()))s((t=>{const e={};let r,n,i;return t&&t.split("\n").forEach(function(t){i=t.indexOf(":"),r=t.substring(0,i).trim().toLowerCase(),n=t.substring(i+1).trim(),!r||e[r]&&gi[r]||("set-cookie"===r?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)}),e})(t),e);else if(qn.isObject(t)&&qn.isIterable(t)){let r,n,i={};for(const e of t){if(!qn.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[n=e[0]]=(r=i[n])?qn.isArray(r)?[...r,e[1]]:[r,e[1]]:e[1]}s(i,e)}else null!=t&&i(e,t,r);return this}get(t,e){if(t=vi(t)){const r=qn.findKey(this,t);if(r){const t=this[r];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}(t);if(qn.isFunction(e))return e.call(this,t,r);if(qn.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=vi(t)){const r=qn.findKey(this,t);return!(!r||void 0===this[r]||e&&!yi(0,this[r],r,e))}return!1}delete(t,e){const r=this;let n=!1;function i(t){if(t=vi(t)){const i=qn.findKey(r,t);!i||e&&!yi(0,r[i],i,e)||(delete r[i],n=!0)}}return qn.isArray(t)?t.forEach(i):i(t),n}clear(t){const e=Object.keys(this);let r=e.length,n=!1;for(;r--;){const i=e[r];t&&!yi(0,this[i],i,t,!0)||(delete this[i],n=!0)}return n}normalize(t){const e=this,r={};return qn.forEach(this,(n,i)=>{const s=qn.findKey(r,i);if(s)return e[s]=mi(n),void delete e[i];const a=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,e,r)=>e.toUpperCase()+r)}(i):String(i).trim();a!==i&&delete e[i],e[a]=mi(n),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return qn.forEach(this,(r,n)=>{null!=r&&!1!==r&&(e[n]=t&&qn.isArray(r)?r.join(", "):r)}),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,e])=>t+": "+e).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach(t=>r.set(t)),r}static accessor(t){const e=(this[di]=this[di]={accessors:{}}).accessors,r=this.prototype;function n(t){const n=vi(t);e[n]||(!function(t,e){const r=qn.toCamelCase(" "+e);["get","set","has"].forEach(n=>{Object.defineProperty(t,n+r,{value:function(t,r,i){return this[n].call(this,e,t,r,i)},configurable:!0})})}(r,t),e[n]=!0)}return qn.isArray(t)?t.forEach(n):n(t),this}}xi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),qn.reduceDescriptors(xi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}}),qn.freezeMethods(xi);var wi=xi;function Si(t,e){const r=this||pi,n=e||r,i=wi.from(n.headers);let s=n.data;return qn.forEach(t,function(t){s=t.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Ei(t){return!(!t||!t.__CANCEL__)}function bi(t,e,r){Kn.call(this,null==t?"canceled":t,Kn.ERR_CANCELED,e,r),this.name="CanceledError"}function Fi(t,e,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(new Kn("Request failed with status code "+r.status,[Kn.ERR_BAD_REQUEST,Kn.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}qn.inherits(bi,Kn,{__CANCEL__:!0});const Ai=(t,e,r=3)=>{let n=0;const i=function(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i,s=0,a=0;return e=void 0!==e?e:1e3,function(o){const u=Date.now(),c=n[a];i||(i=u),r[s]=o,n[s]=u;let h=a,l=0;for(;h!==s;)l+=r[h++],h%=t;if(s=(s+1)%t,s===a&&(a=(a+1)%t),u-i<e)return;const f=c&&u-c;return f?Math.round(1e3*l/f):void 0}}(50,250);return function(t,e){let r,n,i=0,s=1e3/e;const a=(e,s=Date.now())=>{i=s,r=null,n&&(clearTimeout(n),n=null),t(...e)};return[(...t)=>{const e=Date.now(),o=e-i;o>=s?a(t,e):(r=t,n||(n=setTimeout(()=>{n=null,a(r)},s-o)))},()=>r&&a(r)]}(r=>{const s=r.loaded,a=r.lengthComputable?r.total:void 0,o=s-n,u=i(o);n=s;t({loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:u||void 0,estimated:u&&a&&s<=a?(a-s)/u:void 0,event:r,lengthComputable:null!=a,[e?"download":"upload"]:!0})},r)},Ci=(t,e)=>{const r=null!=t;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Di=t=>(...e)=>qn.asap(()=>t(...e));var Ii=hi.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,hi.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(hi.origin),hi.navigator&&/(msie|trident)/i.test(hi.navigator.userAgent)):()=>!0,Pi=hi.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const a=[t+"="+encodeURIComponent(e)];qn.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),qn.isString(n)&&a.push("path="+n),qn.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Ti(t,e,r){let n=!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e);return t&&(n||0==r)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Ri=t=>t instanceof wi?{...t}:t;function Ni(t,e){e=e||{};const r={};function n(t,e,r,n){return qn.isPlainObject(t)&&qn.isPlainObject(e)?qn.merge.call({caseless:n},t,e):qn.isPlainObject(e)?qn.merge({},e):qn.isArray(e)?e.slice():e}function i(t,e,r,i){return qn.isUndefined(e)?qn.isUndefined(t)?void 0:n(void 0,t,0,i):n(t,e,0,i)}function s(t,e){if(!qn.isUndefined(e))return n(void 0,e)}function a(t,e){return qn.isUndefined(e)?qn.isUndefined(t)?void 0:n(void 0,t):n(void 0,e)}function o(r,i,s){return s in e?n(r,i):s in t?n(void 0,r):void 0}const u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(t,e,r)=>i(Ri(t),Ri(e),0,!0)};return qn.forEach(Object.keys({...t,...e}),function(n){const s=u[n]||i,a=s(t[n],e[n],n);qn.isUndefined(a)&&s!==o||(r[n]=a)}),r}var Oi=t=>{const e=Ni({},t);let r,{data:n,withXSRFToken:i,xsrfHeaderName:s,xsrfCookieName:a,headers:o,auth:u}=e;if(e.headers=o=wi.from(o),e.url=ei(Ti(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),u&&o.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),qn.isFormData(n))if(hi.hasStandardBrowserEnv||hi.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(!1!==(r=o.getContentType())){const[t,...e]=r?r.split(";").map(t=>t.trim()).filter(Boolean):[];o.setContentType([t||"multipart/form-data",...e].join("; "))}if(hi.hasStandardBrowserEnv&&(i&&qn.isFunction(i)&&(i=i(e)),i||!1!==i&&Ii(e.url))){const t=s&&a&&Pi.read(a);t&&o.set(s,t)}return e};var Bi="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,r){const n=Oi(t);let i=n.data;const s=wi.from(n.headers).normalize();let a,o,u,c,h,{responseType:l,onUploadProgress:f,onDownloadProgress:p}=n;function g(){c&&c(),h&&h(),n.cancelToken&&n.cancelToken.unsubscribe(a),n.signal&&n.signal.removeEventListener("abort",a)}let d=new XMLHttpRequest;function v(){if(!d)return;const n=wi.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());Fi(function(t){e(t),g()},function(t){r(t),g()},{data:l&&"text"!==l&&"json"!==l?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:n,config:t,request:d}),d=null}d.open(n.method.toUpperCase(),n.url,!0),d.timeout=n.timeout,"onloadend"in d?d.onloadend=v:d.onreadystatechange=function(){d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))&&setTimeout(v)},d.onabort=function(){d&&(r(new Kn("Request aborted",Kn.ECONNABORTED,t,d)),d=null)},d.onerror=function(){r(new Kn("Network Error",Kn.ERR_NETWORK,t,d)),d=null},d.ontimeout=function(){let e=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||ni;n.timeoutErrorMessage&&(e=n.timeoutErrorMessage),r(new Kn(e,i.clarifyTimeoutError?Kn.ETIMEDOUT:Kn.ECONNABORTED,t,d)),d=null},void 0===i&&s.setContentType(null),"setRequestHeader"in d&&qn.forEach(s.toJSON(),function(t,e){d.setRequestHeader(e,t)}),qn.isUndefined(n.withCredentials)||(d.withCredentials=!!n.withCredentials),l&&"json"!==l&&(d.responseType=n.responseType),p&&([u,h]=Ai(p,!0),d.addEventListener("progress",u)),f&&d.upload&&([o,c]=Ai(f),d.upload.addEventListener("progress",o),d.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(a=e=>{d&&(r(!e||e.type?new bi(null,t,d):e),d.abort(),d=null)},n.cancelToken&&n.cancelToken.subscribe(a),n.signal&&(n.signal.aborted?a():n.signal.addEventListener("abort",a)));const m=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(n.url);m&&-1===hi.protocols.indexOf(m)?r(new Kn("Unsupported protocol "+m+":",Kn.ERR_BAD_REQUEST,t)):d.send(i||null)})};var _i=(t,e)=>{const{length:r}=t=t?t.filter(Boolean):[];if(e||r){let r,n=new AbortController;const i=function(t){if(!r){r=!0,a();const e=t instanceof Error?t:this.reason;n.abort(e instanceof Kn?e:new bi(e instanceof Error?e.message:e))}};let s=e&&setTimeout(()=>{s=null,i(new Kn(`timeout ${e} of ms exceeded`,Kn.ETIMEDOUT))},e);const a=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(t=>{t.unsubscribe?t.unsubscribe(i):t.removeEventListener("abort",i)}),t=null)};t.forEach(t=>t.addEventListener("abort",i));const{signal:o}=n;return o.unsubscribe=()=>qn.asap(a),o}};const ji=function*(t,e){let r=t.byteLength;if(!e||r<e)return void(yield t);let n,i=0;for(;i<r;)n=i+e,yield t.slice(i,n),i=n},Hi=async function*(t){if(t[Symbol.asyncIterator])return void(yield*t);const e=t.getReader();try{for(;;){const{done:t,value:r}=await e.read();if(t)break;yield r}}finally{await e.cancel()}},ki=(t,e,r,n)=>{const i=async function*(t,e){for await(const r of Hi(t))yield*ji(r,e)}(t,e);let s,a=0,o=t=>{s||(s=!0,n&&n(t))};return new ReadableStream({async pull(t){try{const{done:e,value:n}=await i.next();if(e)return o(),void t.close();let s=n.byteLength;if(r){let t=a+=s;r(t)}t.enqueue(new Uint8Array(n))}catch(t){throw o(t),t}},cancel:t=>(o(t),i.return())},{highWaterMark:2})},Li="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Vi=Li&&"function"==typeof ReadableStream,Mi=Li&&("function"==typeof TextEncoder?(qi=new TextEncoder,t=>qi.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var qi;const Ki=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},Ui=Vi&&Ki(()=>{let t=!1;const e=new Request(hi.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),zi=Vi&&Ki(()=>qn.isReadableStream(new Response("").body)),Wi={stream:zi&&(t=>t.body)};var Gi;Li&&(Gi=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Wi[t]&&(Wi[t]=qn.isFunction(Gi[t])?e=>e[t]():(e,r)=>{throw new Kn(`Response type '${t}' is not supported`,Kn.ERR_NOT_SUPPORT,r)})}));const $i=async(t,e)=>{const r=qn.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if(qn.isBlob(t))return t.size;if(qn.isSpecCompliantForm(t)){const e=new Request(hi.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return qn.isArrayBufferView(t)||qn.isArrayBuffer(t)?t.byteLength:(qn.isURLSearchParams(t)&&(t+=""),qn.isString(t)?(await Mi(t)).byteLength:void 0)})(e):r};var Ji=Li&&(async t=>{let{url:e,method:r,data:n,signal:i,cancelToken:s,timeout:a,onDownloadProgress:o,onUploadProgress:u,responseType:c,headers:h,withCredentials:l="same-origin",fetchOptions:f}=Oi(t);c=c?(c+"").toLowerCase():"text";let p,g=_i([i,s&&s.toAbortSignal()],a);const d=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let v;try{if(u&&Ui&&"get"!==r&&"head"!==r&&0!==(v=await $i(h,n))){let t,r=new Request(e,{method:"POST",body:n,duplex:"half"});if(qn.isFormData(n)&&(t=r.headers.get("content-type"))&&h.setContentType(t),r.body){const[t,e]=Ci(v,Ai(Di(u)));n=ki(r.body,65536,t,e)}}qn.isString(l)||(l=l?"include":"omit");const i="credentials"in Request.prototype;p=new Request(e,{...f,signal:g,method:r.toUpperCase(),headers:h.normalize().toJSON(),body:n,duplex:"half",credentials:i?l:void 0});let s=await fetch(p,f);const a=zi&&("stream"===c||"response"===c);if(zi&&(o||a&&d)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=s[e]});const e=qn.toFiniteNumber(s.headers.get("content-length")),[r,n]=o&&Ci(e,Ai(Di(o),!0))||[];s=new Response(ki(s.body,65536,r,()=>{n&&n(),d&&d()}),t)}c=c||"text";let m=await Wi[qn.findKey(Wi,c)||"text"](s,t);return!a&&d&&d(),await new Promise((e,r)=>{Fi(e,r,{data:m,headers:wi.from(s.headers),status:s.status,statusText:s.statusText,config:t,request:p})})}catch(e){if(d&&d(),e&&"TypeError"===e.name&&/Load failed|fetch/i.test(e.message))throw Object.assign(new Kn("Network Error",Kn.ERR_NETWORK,t,p),{cause:e.cause||e});throw Kn.from(e,e&&e.code,t,p)}});const Yi={http:null,xhr:Bi,fetch:Ji};qn.forEach(Yi,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const Xi=t=>`- ${t}`,Zi=t=>qn.isFunction(t)||null===t||!1===t;var Qi=t=>{t=qn.isArray(t)?t:[t];const{length:e}=t;let r,n;const i={};for(let s=0;s<e;s++){let e;if(r=t[s],n=r,!Zi(r)&&(n=Yi[(e=String(r)).toLowerCase()],void 0===n))throw new Kn(`Unknown adapter '${e}'`);if(n)break;i[e||"#"+s]=n}if(!n){const t=Object.entries(i).map(([t,e])=>`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build"));throw new Kn("There is no suitable adapter to dispatch the request "+(e?t.length>1?"since :\n"+t.map(Xi).join("\n"):" "+Xi(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function ts(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new bi(null,t)}function es(t){ts(t),t.headers=wi.from(t.headers),t.data=Si.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Qi(t.adapter||pi.adapter)(t).then(function(e){return ts(t),e.data=Si.call(t,t.transformResponse,e),e.headers=wi.from(e.headers),e},function(e){return Ei(e)||(ts(t),e&&e.response&&(e.response.data=Si.call(t,t.transformResponse,e.response),e.response.headers=wi.from(e.response.headers))),Promise.reject(e)})}const rs="1.11.0",ns={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ns[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const is={};ns.transitional=function(t,e,r){function n(t,e){return"[Axios v"+rs+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,i,s)=>{if(!1===t)throw new Kn(n(i," has been removed"+(e?" in "+e:"")),Kn.ERR_DEPRECATED);return e&&!is[i]&&(is[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,s)}},ns.spelling=function(t){return(e,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};var ss={assertOptions:function(t,e,r){if("object"!=typeof t)throw new Kn("options must be an object",Kn.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],a=e[s];if(a){const e=t[s],r=void 0===e||a(e,s,t);if(!0!==r)throw new Kn("option "+s+" must be "+r,Kn.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Kn("Unknown option "+s,Kn.ERR_BAD_OPTION)}},validators:ns};const as=ss.validators;class os{constructor(t){this.defaults=t||{},this.interceptors={request:new ri,response:new ri}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e={};Error.captureStackTrace?Error.captureStackTrace(e):e=new Error;const r=e.stack?e.stack.replace(/^.+\n/,""):"";try{t.stack?r&&!String(t.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+r):t.stack=r}catch(t){}}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Ni(this.defaults,e);const{transitional:r,paramsSerializer:n,headers:i}=e;void 0!==r&&ss.assertOptions(r,{silentJSONParsing:as.transitional(as.boolean),forcedJSONParsing:as.transitional(as.boolean),clarifyTimeoutError:as.transitional(as.boolean)},!1),null!=n&&(qn.isFunction(n)?e.paramsSerializer={serialize:n}:ss.assertOptions(n,{encode:as.function,serialize:as.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),ss.assertOptions(e,{baseUrl:as.spelling("baseURL"),withXsrfToken:as.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=i&&qn.merge(i.common,i[e.method]);i&&qn.forEach(["delete","get","head","post","put","patch","common"],t=>{delete i[t]}),e.headers=wi.concat(s,i);const a=[];let o=!0;this.interceptors.request.forEach(function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(o=o&&t.synchronous,a.unshift(t.fulfilled,t.rejected))});const u=[];let c;this.interceptors.response.forEach(function(t){u.push(t.fulfilled,t.rejected)});let h,l=0;if(!o){const t=[es.bind(this),void 0];for(t.unshift(...a),t.push(...u),h=t.length,c=Promise.resolve(e);l<h;)c=c.then(t[l++],t[l++]);return c}h=a.length;let f=e;for(l=0;l<h;){const t=a[l++],e=a[l++];try{f=t(f)}catch(t){e.call(this,t);break}}try{c=es.call(this,f)}catch(t){return Promise.reject(t)}for(l=0,h=u.length;l<h;)c=c.then(u[l++],u[l++]);return c}getUri(t){return ei(Ti((t=Ni(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}qn.forEach(["delete","get","head","options"],function(t){os.prototype[t]=function(e,r){return this.request(Ni(r||{},{method:t,url:e,data:(r||{}).data}))}}),qn.forEach(["post","put","patch"],function(t){function e(e){return function(r,n,i){return this.request(Ni(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}os.prototype[t]=e(),os.prototype[t+"Form"]=e(!0)});var us=os;class cs{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise(function(t){e=t});const r=this;this.promise.then(t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null}),this.promise.then=t=>{let e;const n=new Promise(t=>{r.subscribe(t),e=t}).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t(function(t,n,i){r.reason||(r.reason=new bi(t,n,i),e(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}toAbortSignal(){const t=new AbortController,e=e=>{t.abort(e)};return this.subscribe(e),t.signal.unsubscribe=()=>this.unsubscribe(e),t.signal}static source(){let t;return{token:new cs(function(e){t=e}),cancel:t}}}var hs=cs;const ls={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ls).forEach(([t,e])=>{ls[e]=t});var fs=ls;const ps=function t(e){const r=new us(e),n=Xr(us.prototype.request,r);return qn.extend(n,us.prototype,r,{allOwnKeys:!0}),qn.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return t(Ni(e,r))},n}(pi);ps.Axios=us,ps.CanceledError=bi,ps.CancelToken=hs,ps.isCancel=Ei,ps.VERSION=rs,ps.toFormData=Yn,ps.AxiosError=Kn,ps.Cancel=ps.CanceledError,ps.all=function(t){return Promise.all(t)},ps.spread=function(t){return function(e){return t.apply(null,e)}},ps.isAxiosError=function(t){return qn.isObject(t)&&!0===t.isAxiosError},ps.mergeConfig=Ni,ps.AxiosHeaders=wi,ps.formToJSON=t=>li(qn.isHTMLForm(t)?new FormData(t):t),ps.getAdapter=Qi,ps.HttpStatusCode=fs,ps.default=ps;var gs=ps,ds={exports:{}};!function(t,e){(function(){var r,n="Expected a function",i="__lodash_hash_undefined__",s="__lodash_placeholder__",a=16,o=32,u=64,c=128,h=256,l=1/0,f=9007199254740991,p=NaN,d=4294967295,v=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",a],["flip",512],["partial",o],["partialRight",u],["rearg",h]],m="[object Arguments]",y="[object Array]",x="[object Boolean]",w="[object Date]",S="[object Error]",E="[object Function]",b="[object GeneratorFunction]",F="[object Map]",A="[object Number]",C="[object Object]",D="[object Promise]",I="[object RegExp]",P="[object Set]",T="[object String]",R="[object Symbol]",N="[object WeakMap]",O="[object ArrayBuffer]",B="[object DataView]",_="[object Float32Array]",j="[object Float64Array]",H="[object Int8Array]",k="[object Int16Array]",L="[object Int32Array]",V="[object Uint8Array]",M="[object Uint8ClampedArray]",q="[object Uint16Array]",K="[object Uint32Array]",U=/\b__p \+= '';/g,z=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,$=/[&<>"']/g,J=RegExp(G.source),Y=RegExp($.source),X=/<%-([\s\S]+?)%>/g,Z=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,tt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,et=/^\w*$/,rt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,nt=/[\\^$.*+?()[\]{}|]/g,it=RegExp(nt.source),st=/^\s+/,at=/\s/,ot=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ut=/\{\n\/\* \[wrapped with (.+)\] \*/,ct=/,? & /,ht=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,lt=/[()=,{}\[\]\/\s]/,ft=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,gt=/\w*$/,dt=/^[-+]0x[0-9a-f]+$/i,vt=/^0b[01]+$/i,mt=/^\[object .+?Constructor\]$/,yt=/^0o[0-7]+$/i,xt=/^(?:0|[1-9]\d*)$/,wt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,St=/($^)/,Et=/['\n\r\u2028\u2029\\]/g,bt="\\ud800-\\udfff",Ft="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",At="\\u2700-\\u27bf",Ct="a-z\\xdf-\\xf6\\xf8-\\xff",Dt="A-Z\\xc0-\\xd6\\xd8-\\xde",It="\\ufe0e\\ufe0f",Pt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Tt="['’]",Rt="["+bt+"]",Nt="["+Pt+"]",Ot="["+Ft+"]",Bt="\\d+",_t="["+At+"]",jt="["+Ct+"]",Ht="[^"+bt+Pt+Bt+At+Ct+Dt+"]",kt="\\ud83c[\\udffb-\\udfff]",Lt="[^"+bt+"]",Vt="(?:\\ud83c[\\udde6-\\uddff]){2}",Mt="[\\ud800-\\udbff][\\udc00-\\udfff]",qt="["+Dt+"]",Kt="\\u200d",Ut="(?:"+jt+"|"+Ht+")",zt="(?:"+qt+"|"+Ht+")",Wt="(?:['’](?:d|ll|m|re|s|t|ve))?",Gt="(?:['’](?:D|LL|M|RE|S|T|VE))?",$t="(?:"+Ot+"|"+kt+")"+"?",Jt="["+It+"]?",Yt=Jt+$t+("(?:"+Kt+"(?:"+[Lt,Vt,Mt].join("|")+")"+Jt+$t+")*"),Xt="(?:"+[_t,Vt,Mt].join("|")+")"+Yt,Zt="(?:"+[Lt+Ot+"?",Ot,Vt,Mt,Rt].join("|")+")",Qt=RegExp(Tt,"g"),te=RegExp(Ot,"g"),ee=RegExp(kt+"(?="+kt+")|"+Zt+Yt,"g"),re=RegExp([qt+"?"+jt+"+"+Wt+"(?="+[Nt,qt,"$"].join("|")+")",zt+"+"+Gt+"(?="+[Nt,qt+Ut,"$"].join("|")+")",qt+"?"+Ut+"+"+Wt,qt+"+"+Gt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bt,Xt].join("|"),"g"),ne=RegExp("["+Kt+bt+Ft+It+"]"),ie=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,se=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ae=-1,oe={};oe[_]=oe[j]=oe[H]=oe[k]=oe[L]=oe[V]=oe[M]=oe[q]=oe[K]=!0,oe[m]=oe[y]=oe[O]=oe[x]=oe[B]=oe[w]=oe[S]=oe[E]=oe[F]=oe[A]=oe[C]=oe[I]=oe[P]=oe[T]=oe[N]=!1;var ue={};ue[m]=ue[y]=ue[O]=ue[B]=ue[x]=ue[w]=ue[_]=ue[j]=ue[H]=ue[k]=ue[L]=ue[F]=ue[A]=ue[C]=ue[I]=ue[P]=ue[T]=ue[R]=ue[V]=ue[M]=ue[q]=ue[K]=!0,ue[S]=ue[E]=ue[N]=!1;var ce={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},he=parseFloat,le=parseInt,fe="object"==typeof g&&g&&g.Object===Object&&g,pe="object"==typeof self&&self&&self.Object===Object&&self,ge=fe||pe||Function("return this")(),de=e&&!e.nodeType&&e,ve=de&&t&&!t.nodeType&&t,me=ve&&ve.exports===de,ye=me&&fe.process,xe=function(){try{var t=ve&&ve.require&&ve.require("util").types;return t||ye&&ye.binding&&ye.binding("util")}catch(t){}}(),we=xe&&xe.isArrayBuffer,Se=xe&&xe.isDate,Ee=xe&&xe.isMap,be=xe&&xe.isRegExp,Fe=xe&&xe.isSet,Ae=xe&&xe.isTypedArray;function Ce(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function De(t,e,r,n){for(var i=-1,s=null==t?0:t.length;++i<s;){var a=t[i];e(n,a,r(a),t)}return n}function Ie(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}function Pe(t,e){for(var r=null==t?0:t.length;r--&&!1!==e(t[r],r,t););return t}function Te(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function Re(t,e){for(var r=-1,n=null==t?0:t.length,i=0,s=[];++r<n;){var a=t[r];e(a,r,t)&&(s[i++]=a)}return s}function Ne(t,e){return!!(null==t?0:t.length)&&qe(t,e,0)>-1}function Oe(t,e,r){for(var n=-1,i=null==t?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function Be(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function _e(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function je(t,e,r,n){var i=-1,s=null==t?0:t.length;for(n&&s&&(r=t[++i]);++i<s;)r=e(r,t[i],i,t);return r}function He(t,e,r,n){var i=null==t?0:t.length;for(n&&i&&(r=t[--i]);i--;)r=e(r,t[i],i,t);return r}function ke(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Le=We("length");function Ve(t,e,r){var n;return r(t,function(t,r,i){if(e(t,r,i))return n=r,!1}),n}function Me(t,e,r,n){for(var i=t.length,s=r+(n?1:-1);n?s--:++s<i;)if(e(t[s],s,t))return s;return-1}function qe(t,e,r){return e==e?function(t,e,r){var n=r-1,i=t.length;for(;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):Me(t,Ue,r)}function Ke(t,e,r,n){for(var i=r-1,s=t.length;++i<s;)if(n(t[i],e))return i;return-1}function Ue(t){return t!=t}function ze(t,e){var r=null==t?0:t.length;return r?Je(t,e)/r:p}function We(t){return function(e){return null==e?r:e[t]}}function Ge(t){return function(e){return null==t?r:t[e]}}function $e(t,e,r,n,i){return i(t,function(t,i,s){r=n?(n=!1,t):e(r,t,i,s)}),r}function Je(t,e){for(var n,i=-1,s=t.length;++i<s;){var a=e(t[i]);a!==r&&(n=n===r?a:n+a)}return n}function Ye(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function Xe(t){return t?t.slice(0,gr(t)+1).replace(st,""):t}function Ze(t){return function(e){return t(e)}}function Qe(t,e){return Be(e,function(e){return t[e]})}function tr(t,e){return t.has(e)}function er(t,e){for(var r=-1,n=t.length;++r<n&&qe(e,t[r],0)>-1;);return r}function rr(t,e){for(var r=t.length;r--&&qe(e,t[r],0)>-1;);return r}var nr=Ge({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ir=Ge({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function sr(t){return"\\"+ce[t]}function ar(t){return ne.test(t)}function or(t){var e=-1,r=Array(t.size);return t.forEach(function(t,n){r[++e]=[n,t]}),r}function ur(t,e){return function(r){return t(e(r))}}function cr(t,e){for(var r=-1,n=t.length,i=0,a=[];++r<n;){var o=t[r];o!==e&&o!==s||(t[r]=s,a[i++]=r)}return a}function hr(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=t}),r}function lr(t){var e=-1,r=Array(t.size);return t.forEach(function(t){r[++e]=[t,t]}),r}function fr(t){return ar(t)?function(t){var e=ee.lastIndex=0;for(;ee.test(t);)++e;return e}(t):Le(t)}function pr(t){return ar(t)?function(t){return t.match(ee)||[]}(t):function(t){return t.split("")}(t)}function gr(t){for(var e=t.length;e--&&at.test(t.charAt(e)););return e}var dr=Ge({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"});var vr=function t(e){var g,at=(e=null==e?ge:vr.defaults(ge.Object(),e,vr.pick(ge,se))).Array,bt=e.Date,Ft=e.Error,At=e.Function,Ct=e.Math,Dt=e.Object,It=e.RegExp,Pt=e.String,Tt=e.TypeError,Rt=at.prototype,Nt=At.prototype,Ot=Dt.prototype,Bt=e["__core-js_shared__"],_t=Nt.toString,jt=Ot.hasOwnProperty,Ht=0,kt=(g=/[^.]+$/.exec(Bt&&Bt.keys&&Bt.keys.IE_PROTO||""))?"Symbol(src)_1."+g:"",Lt=Ot.toString,Vt=_t.call(Dt),Mt=ge._,qt=It("^"+_t.call(jt).replace(nt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Kt=me?e.Buffer:r,Ut=e.Symbol,zt=e.Uint8Array,Wt=Kt?Kt.allocUnsafe:r,Gt=ur(Dt.getPrototypeOf,Dt),$t=Dt.create,Jt=Ot.propertyIsEnumerable,Yt=Rt.splice,Xt=Ut?Ut.isConcatSpreadable:r,Zt=Ut?Ut.iterator:r,ee=Ut?Ut.toStringTag:r,ne=function(){try{var t=fs(Dt,"defineProperty");return t({},"",{}),t}catch(t){}}(),ce=e.clearTimeout!==ge.clearTimeout&&e.clearTimeout,fe=bt&&bt.now!==ge.Date.now&&bt.now,pe=e.setTimeout!==ge.setTimeout&&e.setTimeout,de=Ct.ceil,ve=Ct.floor,ye=Dt.getOwnPropertySymbols,xe=Kt?Kt.isBuffer:r,Le=e.isFinite,Ge=Rt.join,mr=ur(Dt.keys,Dt),yr=Ct.max,xr=Ct.min,wr=bt.now,Sr=e.parseInt,Er=Ct.random,br=Rt.reverse,Fr=fs(e,"DataView"),Ar=fs(e,"Map"),Cr=fs(e,"Promise"),Dr=fs(e,"Set"),Ir=fs(e,"WeakMap"),Pr=fs(Dt,"create"),Tr=Ir&&new Ir,Rr={},Nr=ks(Fr),Or=ks(Ar),Br=ks(Cr),_r=ks(Dr),jr=ks(Ir),Hr=Ut?Ut.prototype:r,kr=Hr?Hr.valueOf:r,Lr=Hr?Hr.toString:r;function Vr(t){if(eo(t)&&!Ua(t)&&!(t instanceof Ur)){if(t instanceof Kr)return t;if(jt.call(t,"__wrapped__"))return Ls(t)}return new Kr(t)}var Mr=function(){function t(){}return function(e){if(!to(e))return{};if($t)return $t(e);t.prototype=e;var n=new t;return t.prototype=r,n}}();function qr(){}function Kr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=r}function Ur(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function zr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Wr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Gr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function $r(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Gr;++e<r;)this.add(t[e])}function Jr(t){var e=this.__data__=new Wr(t);this.size=e.size}function Yr(t,e){var r=Ua(t),n=!r&&Ka(t),i=!r&&!n&&$a(t),s=!r&&!n&&!i&&co(t),a=r||n||i||s,o=a?Ye(t.length,Pt):[],u=o.length;for(var c in t)!e&&!jt.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||s&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||xs(c,u))||o.push(c);return o}function Xr(t){var e=t.length;return e?t[Jn(0,e-1)]:r}function Zr(t,e){return _s(Ti(t),un(e,0,t.length))}function Qr(t){return _s(Ti(t))}function tn(t,e,n){(n!==r&&!Va(t[e],n)||n===r&&!(e in t))&&an(t,e,n)}function en(t,e,n){var i=t[e];jt.call(t,e)&&Va(i,n)&&(n!==r||e in t)||an(t,e,n)}function rn(t,e){for(var r=t.length;r--;)if(Va(t[r][0],e))return r;return-1}function nn(t,e,r,n){return pn(t,function(t,i,s){e(n,t,r(t),s)}),n}function sn(t,e){return t&&Ri(e,No(e),t)}function an(t,e,r){"__proto__"==e&&ne?ne(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function on(t,e){for(var n=-1,i=e.length,s=at(i),a=null==t;++n<i;)s[n]=a?r:Do(t,e[n]);return s}function un(t,e,n){return t==t&&(n!==r&&(t=t<=n?t:n),e!==r&&(t=t>=e?t:e)),t}function cn(t,e,n,i,s,a){var o,u=1&e,c=2&e,h=4&e;if(n&&(o=s?n(t,i,s,a):n(t)),o!==r)return o;if(!to(t))return t;var l=Ua(t);if(l){if(o=function(t){var e=t.length,r=new t.constructor(e);e&&"string"==typeof t[0]&&jt.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!u)return Ti(t,o)}else{var f=ds(t),p=f==E||f==b;if($a(t))return Fi(t,u);if(f==C||f==m||p&&!s){if(o=c||p?{}:ms(t),!u)return c?function(t,e){return Ri(t,gs(t),e)}(t,function(t,e){return t&&Ri(e,Oo(e),t)}(o,t)):function(t,e){return Ri(t,ps(t),e)}(t,sn(o,t))}else{if(!ue[f])return s?t:{};o=function(t,e,r){var n=t.constructor;switch(e){case O:return Ai(t);case x:case w:return new n(+t);case B:return function(t,e){var r=e?Ai(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case _:case j:case H:case k:case L:case V:case M:case q:case K:return Ci(t,r);case F:return new n;case A:case T:return new n(t);case I:return function(t){var e=new t.constructor(t.source,gt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case P:return new n;case R:return i=t,kr?Dt(kr.call(i)):{}}var i}(t,f,u)}}a||(a=new Jr);var g=a.get(t);if(g)return g;a.set(t,o),ao(t)?t.forEach(function(r){o.add(cn(r,e,n,r,t,a))}):ro(t)&&t.forEach(function(r,i){o.set(i,cn(r,e,n,i,t,a))});var d=l?r:(h?c?ss:is:c?Oo:No)(t);return Ie(d||t,function(r,i){d&&(r=t[i=r]),en(o,i,cn(r,e,n,i,t,a))}),o}function hn(t,e,n){var i=n.length;if(null==t)return!i;for(t=Dt(t);i--;){var s=n[i],a=e[s],o=t[s];if(o===r&&!(s in t)||!a(o))return!1}return!0}function ln(t,e,i){if("function"!=typeof t)throw new Tt(n);return Rs(function(){t.apply(r,i)},e)}function fn(t,e,r,n){var i=-1,s=Ne,a=!0,o=t.length,u=[],c=e.length;if(!o)return u;r&&(e=Be(e,Ze(r))),n?(s=Oe,a=!1):e.length>=200&&(s=tr,a=!1,e=new $r(e));t:for(;++i<o;){var h=t[i],l=null==r?h:r(h);if(h=n||0!==h?h:0,a&&l==l){for(var f=c;f--;)if(e[f]===l)continue t;u.push(h)}else s(e,l,n)||u.push(h)}return u}Vr.templateSettings={escape:X,evaluate:Z,interpolate:Q,variable:"",imports:{_:Vr}},Vr.prototype=qr.prototype,Vr.prototype.constructor=Vr,Kr.prototype=Mr(qr.prototype),Kr.prototype.constructor=Kr,Ur.prototype=Mr(qr.prototype),Ur.prototype.constructor=Ur,zr.prototype.clear=function(){this.__data__=Pr?Pr(null):{},this.size=0},zr.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},zr.prototype.get=function(t){var e=this.__data__;if(Pr){var n=e[t];return n===i?r:n}return jt.call(e,t)?e[t]:r},zr.prototype.has=function(t){var e=this.__data__;return Pr?e[t]!==r:jt.call(e,t)},zr.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=Pr&&e===r?i:e,this},Wr.prototype.clear=function(){this.__data__=[],this.size=0},Wr.prototype.delete=function(t){var e=this.__data__,r=rn(e,t);return!(r<0)&&(r==e.length-1?e.pop():Yt.call(e,r,1),--this.size,!0)},Wr.prototype.get=function(t){var e=this.__data__,n=rn(e,t);return n<0?r:e[n][1]},Wr.prototype.has=function(t){return rn(this.__data__,t)>-1},Wr.prototype.set=function(t,e){var r=this.__data__,n=rn(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},Gr.prototype.clear=function(){this.size=0,this.__data__={hash:new zr,map:new(Ar||Wr),string:new zr}},Gr.prototype.delete=function(t){var e=hs(this,t).delete(t);return this.size-=e?1:0,e},Gr.prototype.get=function(t){return hs(this,t).get(t)},Gr.prototype.has=function(t){return hs(this,t).has(t)},Gr.prototype.set=function(t,e){var r=hs(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},$r.prototype.add=$r.prototype.push=function(t){return this.__data__.set(t,i),this},$r.prototype.has=function(t){return this.__data__.has(t)},Jr.prototype.clear=function(){this.__data__=new Wr,this.size=0},Jr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Jr.prototype.get=function(t){return this.__data__.get(t)},Jr.prototype.has=function(t){return this.__data__.has(t)},Jr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Wr){var n=r.__data__;if(!Ar||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Gr(n)}return r.set(t,e),this.size=r.size,this};var pn=Bi(Sn),gn=Bi(En,!0);function dn(t,e){var r=!0;return pn(t,function(t,n,i){return r=!!e(t,n,i)}),r}function vn(t,e,n){for(var i=-1,s=t.length;++i<s;){var a=t[i],o=e(a);if(null!=o&&(u===r?o==o&&!uo(o):n(o,u)))var u=o,c=a}return c}function mn(t,e){var r=[];return pn(t,function(t,n,i){e(t,n,i)&&r.push(t)}),r}function yn(t,e,r,n,i){var s=-1,a=t.length;for(r||(r=ys),i||(i=[]);++s<a;){var o=t[s];e>0&&r(o)?e>1?yn(o,e-1,r,n,i):_e(i,o):n||(i[i.length]=o)}return i}var xn=_i(),wn=_i(!0);function Sn(t,e){return t&&xn(t,e,No)}function En(t,e){return t&&wn(t,e,No)}function bn(t,e){return Re(e,function(e){return Xa(t[e])})}function Fn(t,e){for(var n=0,i=(e=wi(e,t)).length;null!=t&&n<i;)t=t[Hs(e[n++])];return n&&n==i?t:r}function An(t,e,r){var n=e(t);return Ua(t)?n:_e(n,r(t))}function Cn(t){return null==t?t===r?"[object Undefined]":"[object Null]":ee&&ee in Dt(t)?function(t){var e=jt.call(t,ee),n=t[ee];try{t[ee]=r;var i=!0}catch(t){}var s=Lt.call(t);i&&(e?t[ee]=n:delete t[ee]);return s}(t):function(t){return Lt.call(t)}(t)}function Dn(t,e){return t>e}function In(t,e){return null!=t&&jt.call(t,e)}function Pn(t,e){return null!=t&&e in Dt(t)}function Tn(t,e,n){for(var i=n?Oe:Ne,s=t[0].length,a=t.length,o=a,u=at(a),c=1/0,h=[];o--;){var l=t[o];o&&e&&(l=Be(l,Ze(e))),c=xr(l.length,c),u[o]=!n&&(e||s>=120&&l.length>=120)?new $r(o&&l):r}l=t[0];var f=-1,p=u[0];t:for(;++f<s&&h.length<c;){var g=l[f],d=e?e(g):g;if(g=n||0!==g?g:0,!(p?tr(p,d):i(h,d,n))){for(o=a;--o;){var v=u[o];if(!(v?tr(v,d):i(t[o],d,n)))continue t}p&&p.push(d),h.push(g)}}return h}function Rn(t,e,n){var i=null==(t=Is(t,e=wi(e,t)))?t:t[Hs(Ys(e))];return null==i?r:Ce(i,t,n)}function Nn(t){return eo(t)&&Cn(t)==m}function On(t,e,n,i,s){return t===e||(null==t||null==e||!eo(t)&&!eo(e)?t!=t&&e!=e:function(t,e,n,i,s,a){var o=Ua(t),u=Ua(e),c=o?y:ds(t),h=u?y:ds(e),l=(c=c==m?C:c)==C,f=(h=h==m?C:h)==C,p=c==h;if(p&&$a(t)){if(!$a(e))return!1;o=!0,l=!1}if(p&&!l)return a||(a=new Jr),o||co(t)?rs(t,e,n,i,s,a):function(t,e,r,n,i,s,a){switch(r){case B:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case O:return!(t.byteLength!=e.byteLength||!s(new zt(t),new zt(e)));case x:case w:case A:return Va(+t,+e);case S:return t.name==e.name&&t.message==e.message;case I:case T:return t==e+"";case F:var o=or;case P:var u=1&n;if(o||(o=hr),t.size!=e.size&&!u)return!1;var c=a.get(t);if(c)return c==e;n|=2,a.set(t,e);var h=rs(o(t),o(e),n,i,s,a);return a.delete(t),h;case R:if(kr)return kr.call(t)==kr.call(e)}return!1}(t,e,c,n,i,s,a);if(!(1&n)){var g=l&&jt.call(t,"__wrapped__"),d=f&&jt.call(e,"__wrapped__");if(g||d){var v=g?t.value():t,E=d?e.value():e;return a||(a=new Jr),s(v,E,n,i,a)}}if(!p)return!1;return a||(a=new Jr),function(t,e,n,i,s,a){var o=1&n,u=is(t),c=u.length,h=is(e),l=h.length;if(c!=l&&!o)return!1;var f=c;for(;f--;){var p=u[f];if(!(o?p in e:jt.call(e,p)))return!1}var g=a.get(t),d=a.get(e);if(g&&d)return g==e&&d==t;var v=!0;a.set(t,e),a.set(e,t);var m=o;for(;++f<c;){var y=t[p=u[f]],x=e[p];if(i)var w=o?i(x,y,p,e,t,a):i(y,x,p,t,e,a);if(!(w===r?y===x||s(y,x,n,i,a):w)){v=!1;break}m||(m="constructor"==p)}if(v&&!m){var S=t.constructor,E=e.constructor;S==E||!("constructor"in t)||!("constructor"in e)||"function"==typeof S&&S instanceof S&&"function"==typeof E&&E instanceof E||(v=!1)}return a.delete(t),a.delete(e),v}(t,e,n,i,s,a)}(t,e,n,i,On,s))}function Bn(t,e,n,i){var s=n.length,a=s,o=!i;if(null==t)return!a;for(t=Dt(t);s--;){var u=n[s];if(o&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++s<a;){var c=(u=n[s])[0],h=t[c],l=u[1];if(o&&u[2]){if(h===r&&!(c in t))return!1}else{var f=new Jr;if(i)var p=i(h,l,c,t,e,f);if(!(p===r?On(l,h,3,i,f):p))return!1}}return!0}function _n(t){return!(!to(t)||(e=t,kt&&kt in e))&&(Xa(t)?qt:mt).test(ks(t));var e}function jn(t){return"function"==typeof t?t:null==t?iu:"object"==typeof t?Ua(t)?qn(t[0],t[1]):Mn(t):pu(t)}function Hn(t){if(!Fs(t))return mr(t);var e=[];for(var r in Dt(t))jt.call(t,r)&&"constructor"!=r&&e.push(r);return e}function kn(t){if(!to(t))return function(t){var e=[];if(null!=t)for(var r in Dt(t))e.push(r);return e}(t);var e=Fs(t),r=[];for(var n in t)("constructor"!=n||!e&&jt.call(t,n))&&r.push(n);return r}function Ln(t,e){return t<e}function Vn(t,e){var r=-1,n=Wa(t)?at(t.length):[];return pn(t,function(t,i,s){n[++r]=e(t,i,s)}),n}function Mn(t){var e=ls(t);return 1==e.length&&e[0][2]?Cs(e[0][0],e[0][1]):function(r){return r===t||Bn(r,t,e)}}function qn(t,e){return Ss(t)&&As(e)?Cs(Hs(t),e):function(n){var i=Do(n,t);return i===r&&i===e?Io(n,t):On(e,i,3)}}function Kn(t,e,n,i,s){t!==e&&xn(e,function(a,o){if(s||(s=new Jr),to(a))!function(t,e,n,i,s,a,o){var u=Ps(t,n),c=Ps(e,n),h=o.get(c);if(h)return void tn(t,n,h);var l=a?a(u,c,n+"",t,e,o):r,f=l===r;if(f){var p=Ua(c),g=!p&&$a(c),d=!p&&!g&&co(c);l=c,p||g||d?Ua(u)?l=u:Ga(u)?l=Ti(u):g?(f=!1,l=Fi(c,!0)):d?(f=!1,l=Ci(c,!0)):l=[]:io(c)||Ka(c)?(l=u,Ka(u)?l=yo(u):to(u)&&!Xa(u)||(l=ms(c))):f=!1}f&&(o.set(c,l),s(l,c,i,a,o),o.delete(c));tn(t,n,l)}(t,e,o,n,Kn,i,s);else{var u=i?i(Ps(t,o),a,o+"",t,e,s):r;u===r&&(u=a),tn(t,o,u)}},Oo)}function Un(t,e){var n=t.length;if(n)return xs(e+=e<0?n:0,n)?t[e]:r}function zn(t,e,r){e=e.length?Be(e,function(t){return Ua(t)?function(e){return Fn(e,1===t.length?t[0]:t)}:t}):[iu];var n=-1;e=Be(e,Ze(cs()));var i=Vn(t,function(t,r,i){var s=Be(e,function(e){return e(t)});return{criteria:s,index:++n,value:t}});return function(t,e){var r=t.length;for(t.sort(e);r--;)t[r]=t[r].value;return t}(i,function(t,e){return function(t,e,r){var n=-1,i=t.criteria,s=e.criteria,a=i.length,o=r.length;for(;++n<a;){var u=Di(i[n],s[n]);if(u)return n>=o?u:u*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)})}function Wn(t,e,r){for(var n=-1,i=e.length,s={};++n<i;){var a=e[n],o=Fn(t,a);r(o,a)&&ti(s,wi(a,t),o)}return s}function Gn(t,e,r,n){var i=n?Ke:qe,s=-1,a=e.length,o=t;for(t===e&&(e=Ti(e)),r&&(o=Be(t,Ze(r)));++s<a;)for(var u=0,c=e[s],h=r?r(c):c;(u=i(o,h,u,n))>-1;)o!==t&&Yt.call(o,u,1),Yt.call(t,u,1);return t}function $n(t,e){for(var r=t?e.length:0,n=r-1;r--;){var i=e[r];if(r==n||i!==s){var s=i;xs(i)?Yt.call(t,i,1):fi(t,i)}}return t}function Jn(t,e){return t+ve(Er()*(e-t+1))}function Yn(t,e){var r="";if(!t||e<1||e>f)return r;do{e%2&&(r+=t),(e=ve(e/2))&&(t+=t)}while(e);return r}function Xn(t,e){return Ns(Ds(t,e,iu),t+"")}function Zn(t){return Xr(Mo(t))}function Qn(t,e){var r=Mo(t);return _s(r,un(e,0,r.length))}function ti(t,e,n,i){if(!to(t))return t;for(var s=-1,a=(e=wi(e,t)).length,o=a-1,u=t;null!=u&&++s<a;){var c=Hs(e[s]),h=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return t;if(s!=o){var l=u[c];(h=i?i(l,c,u):r)===r&&(h=to(l)?l:xs(e[s+1])?[]:{})}en(u,c,h),u=u[c]}return t}var ei=Tr?function(t,e){return Tr.set(t,e),t}:iu,ri=ne?function(t,e){return ne(t,"toString",{configurable:!0,enumerable:!1,value:eu(e),writable:!0})}:iu;function ni(t){return _s(Mo(t))}function ii(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var s=at(i);++n<i;)s[n]=t[n+e];return s}function si(t,e){var r;return pn(t,function(t,n,i){return!(r=e(t,n,i))}),!!r}function ai(t,e,r){var n=0,i=null==t?n:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;n<i;){var s=n+i>>>1,a=t[s];null!==a&&!uo(a)&&(r?a<=e:a<e)?n=s+1:i=s}return i}return oi(t,e,iu,r)}function oi(t,e,n,i){var s=0,a=null==t?0:t.length;if(0===a)return 0;for(var o=(e=n(e))!=e,u=null===e,c=uo(e),h=e===r;s<a;){var l=ve((s+a)/2),f=n(t[l]),p=f!==r,g=null===f,d=f==f,v=uo(f);if(o)var m=i||d;else m=h?d&&(i||p):u?d&&p&&(i||!g):c?d&&p&&!g&&(i||!v):!g&&!v&&(i?f<=e:f<e);m?s=l+1:a=l}return xr(a,4294967294)}function ui(t,e){for(var r=-1,n=t.length,i=0,s=[];++r<n;){var a=t[r],o=e?e(a):a;if(!r||!Va(o,u)){var u=o;s[i++]=0===a?0:a}}return s}function ci(t){return"number"==typeof t?t:uo(t)?p:+t}function hi(t){if("string"==typeof t)return t;if(Ua(t))return Be(t,hi)+"";if(uo(t))return Lr?Lr.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function li(t,e,r){var n=-1,i=Ne,s=t.length,a=!0,o=[],u=o;if(r)a=!1,i=Oe;else if(s>=200){var c=e?null:Yi(t);if(c)return hr(c);a=!1,i=tr,u=new $r}else u=e?[]:o;t:for(;++n<s;){var h=t[n],l=e?e(h):h;if(h=r||0!==h?h:0,a&&l==l){for(var f=u.length;f--;)if(u[f]===l)continue t;e&&u.push(l),o.push(h)}else i(u,l,r)||(u!==o&&u.push(l),o.push(h))}return o}function fi(t,e){return null==(t=Is(t,e=wi(e,t)))||delete t[Hs(Ys(e))]}function pi(t,e,r,n){return ti(t,e,r(Fn(t,e)),n)}function gi(t,e,r,n){for(var i=t.length,s=n?i:-1;(n?s--:++s<i)&&e(t[s],s,t););return r?ii(t,n?0:s,n?s+1:i):ii(t,n?s+1:0,n?i:s)}function di(t,e){var r=t;return r instanceof Ur&&(r=r.value()),je(e,function(t,e){return e.func.apply(e.thisArg,_e([t],e.args))},r)}function vi(t,e,r){var n=t.length;if(n<2)return n?li(t[0]):[];for(var i=-1,s=at(n);++i<n;)for(var a=t[i],o=-1;++o<n;)o!=i&&(s[i]=fn(s[i]||a,t[o],e,r));return li(yn(s,1),e,r)}function mi(t,e,n){for(var i=-1,s=t.length,a=e.length,o={};++i<s;){var u=i<a?e[i]:r;n(o,t[i],u)}return o}function yi(t){return Ga(t)?t:[]}function xi(t){return"function"==typeof t?t:iu}function wi(t,e){return Ua(t)?t:Ss(t,e)?[t]:js(xo(t))}var Si=Xn;function Ei(t,e,n){var i=t.length;return n=n===r?i:n,!e&&n>=i?t:ii(t,e,n)}var bi=ce||function(t){return ge.clearTimeout(t)};function Fi(t,e){if(e)return t.slice();var r=t.length,n=Wt?Wt(r):new t.constructor(r);return t.copy(n),n}function Ai(t){var e=new t.constructor(t.byteLength);return new zt(e).set(new zt(t)),e}function Ci(t,e){var r=e?Ai(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function Di(t,e){if(t!==e){var n=t!==r,i=null===t,s=t==t,a=uo(t),o=e!==r,u=null===e,c=e==e,h=uo(e);if(!u&&!h&&!a&&t>e||a&&o&&c&&!u&&!h||i&&o&&c||!n&&c||!s)return 1;if(!i&&!a&&!h&&t<e||h&&n&&s&&!i&&!a||u&&n&&s||!o&&s||!c)return-1}return 0}function Ii(t,e,r,n){for(var i=-1,s=t.length,a=r.length,o=-1,u=e.length,c=yr(s-a,0),h=at(u+c),l=!n;++o<u;)h[o]=e[o];for(;++i<a;)(l||i<s)&&(h[r[i]]=t[i]);for(;c--;)h[o++]=t[i++];return h}function Pi(t,e,r,n){for(var i=-1,s=t.length,a=-1,o=r.length,u=-1,c=e.length,h=yr(s-o,0),l=at(h+c),f=!n;++i<h;)l[i]=t[i];for(var p=i;++u<c;)l[p+u]=e[u];for(;++a<o;)(f||i<s)&&(l[p+r[a]]=t[i++]);return l}function Ti(t,e){var r=-1,n=t.length;for(e||(e=at(n));++r<n;)e[r]=t[r];return e}function Ri(t,e,n,i){var s=!n;n||(n={});for(var a=-1,o=e.length;++a<o;){var u=e[a],c=i?i(n[u],t[u],u,n,t):r;c===r&&(c=t[u]),s?an(n,u,c):en(n,u,c)}return n}function Ni(t,e){return function(r,n){var i=Ua(r)?De:nn,s=e?e():{};return i(r,t,cs(n,2),s)}}function Oi(t){return Xn(function(e,n){var i=-1,s=n.length,a=s>1?n[s-1]:r,o=s>2?n[2]:r;for(a=t.length>3&&"function"==typeof a?(s--,a):r,o&&ws(n[0],n[1],o)&&(a=s<3?r:a,s=1),e=Dt(e);++i<s;){var u=n[i];u&&t(e,u,i,a)}return e})}function Bi(t,e){return function(r,n){if(null==r)return r;if(!Wa(r))return t(r,n);for(var i=r.length,s=e?i:-1,a=Dt(r);(e?s--:++s<i)&&!1!==n(a[s],s,a););return r}}function _i(t){return function(e,r,n){for(var i=-1,s=Dt(e),a=n(e),o=a.length;o--;){var u=a[t?o:++i];if(!1===r(s[u],u,s))break}return e}}function ji(t){return function(e){var n=ar(e=xo(e))?pr(e):r,i=n?n[0]:e.charAt(0),s=n?Ei(n,1).join(""):e.slice(1);return i[t]()+s}}function Hi(t){return function(e){return je(Zo(Uo(e).replace(Qt,"")),t,"")}}function ki(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=Mr(t.prototype),n=t.apply(r,e);return to(n)?n:r}}function Li(t){return function(e,n,i){var s=Dt(e);if(!Wa(e)){var a=cs(n,3);e=No(e),n=function(t){return a(s[t],t,s)}}var o=t(e,n,i);return o>-1?s[a?e[o]:o]:r}}function Vi(t){return ns(function(e){var i=e.length,s=i,a=Kr.prototype.thru;for(t&&e.reverse();s--;){var o=e[s];if("function"!=typeof o)throw new Tt(n);if(a&&!u&&"wrapper"==os(o))var u=new Kr([],!0)}for(s=u?s:i;++s<i;){var c=os(o=e[s]),h="wrapper"==c?as(o):r;u=h&&Es(h[0])&&424==h[1]&&!h[4].length&&1==h[9]?u[os(h[0])].apply(u,h[3]):1==o.length&&Es(o)?u[c]():u.thru(o)}return function(){var t=arguments,r=t[0];if(u&&1==t.length&&Ua(r))return u.plant(r).value();for(var n=0,s=i?e[n].apply(this,t):r;++n<i;)s=e[n].call(this,s);return s}})}function Mi(t,e,n,i,s,a,o,u,h,l){var f=e&c,p=1&e,g=2&e,d=24&e,v=512&e,m=g?r:ki(t);return function c(){for(var y=arguments.length,x=at(y),w=y;w--;)x[w]=arguments[w];if(d)var S=us(c),E=function(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&++n;return n}(x,S);if(i&&(x=Ii(x,i,s,d)),a&&(x=Pi(x,a,o,d)),y-=E,d&&y<l){var b=cr(x,S);return $i(t,e,Mi,c.placeholder,n,x,b,u,h,l-y)}var F=p?n:this,A=g?F[t]:t;return y=x.length,u?x=function(t,e){var n=t.length,i=xr(e.length,n),s=Ti(t);for(;i--;){var a=e[i];t[i]=xs(a,n)?s[a]:r}return t}(x,u):v&&y>1&&x.reverse(),f&&h<y&&(x.length=h),this&&this!==ge&&this instanceof c&&(A=m||ki(A)),A.apply(F,x)}}function qi(t,e){return function(r,n){return function(t,e,r,n){return Sn(t,function(t,i,s){e(n,r(t),i,s)}),n}(r,t,e(n),{})}}function Ki(t,e){return function(n,i){var s;if(n===r&&i===r)return e;if(n!==r&&(s=n),i!==r){if(s===r)return i;"string"==typeof n||"string"==typeof i?(n=hi(n),i=hi(i)):(n=ci(n),i=ci(i)),s=t(n,i)}return s}}function Ui(t){return ns(function(e){return e=Be(e,Ze(cs())),Xn(function(r){var n=this;return t(e,function(t){return Ce(t,n,r)})})})}function zi(t,e){var n=(e=e===r?" ":hi(e)).length;if(n<2)return n?Yn(e,t):e;var i=Yn(e,de(t/fr(e)));return ar(e)?Ei(pr(i),0,t).join(""):i.slice(0,t)}function Wi(t){return function(e,n,i){return i&&"number"!=typeof i&&ws(e,n,i)&&(n=i=r),e=po(e),n===r?(n=e,e=0):n=po(n),function(t,e,r,n){for(var i=-1,s=yr(de((e-t)/(r||1)),0),a=at(s);s--;)a[n?s:++i]=t,t+=r;return a}(e,n,i=i===r?e<n?1:-1:po(i),t)}}function Gi(t){return function(e,r){return"string"==typeof e&&"string"==typeof r||(e=mo(e),r=mo(r)),t(e,r)}}function $i(t,e,n,i,s,a,c,h,l,f){var p=8&e;e|=p?o:u,4&(e&=~(p?u:o))||(e&=-4);var g=[t,e,s,p?a:r,p?c:r,p?r:a,p?r:c,h,l,f],d=n.apply(r,g);return Es(t)&&Ts(d,g),d.placeholder=i,Os(d,t,e)}function Ji(t){var e=Ct[t];return function(t,r){if(t=mo(t),(r=null==r?0:xr(go(r),292))&&Le(t)){var n=(xo(t)+"e").split("e");return+((n=(xo(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}var Yi=Dr&&1/hr(new Dr([,-0]))[1]==l?function(t){return new Dr(t)}:cu;function Xi(t){return function(e){var r=ds(e);return r==F?or(e):r==P?lr(e):function(t,e){return Be(e,function(e){return[e,t[e]]})}(e,t(e))}}function Zi(t,e,i,l,f,p,g,d){var v=2&e;if(!v&&"function"!=typeof t)throw new Tt(n);var m=l?l.length:0;if(m||(e&=-97,l=f=r),g=g===r?g:yr(go(g),0),d=d===r?d:go(d),m-=f?f.length:0,e&u){var y=l,x=f;l=f=r}var w=v?r:as(t),S=[t,e,i,l,f,y,x,p,g,d];if(w&&function(t,e){var r=t[1],n=e[1],i=r|n,a=i<131,o=n==c&&8==r||n==c&&r==h&&t[7].length<=e[8]||384==n&&e[7].length<=e[8]&&8==r;if(!a&&!o)return t;1&n&&(t[2]=e[2],i|=1&r?0:4);var u=e[3];if(u){var l=t[3];t[3]=l?Ii(l,u,e[4]):u,t[4]=l?cr(t[3],s):e[4]}(u=e[5])&&(l=t[5],t[5]=l?Pi(l,u,e[6]):u,t[6]=l?cr(t[5],s):e[6]);(u=e[7])&&(t[7]=u);n&c&&(t[8]=null==t[8]?e[8]:xr(t[8],e[8]));null==t[9]&&(t[9]=e[9]);t[0]=e[0],t[1]=i}(S,w),t=S[0],e=S[1],i=S[2],l=S[3],f=S[4],!(d=S[9]=S[9]===r?v?0:t.length:yr(S[9]-m,0))&&24&e&&(e&=-25),e&&1!=e)E=8==e||e==a?function(t,e,n){var i=ki(t);return function s(){for(var a=arguments.length,o=at(a),u=a,c=us(s);u--;)o[u]=arguments[u];var h=a<3&&o[0]!==c&&o[a-1]!==c?[]:cr(o,c);return(a-=h.length)<n?$i(t,e,Mi,s.placeholder,r,o,h,r,r,n-a):Ce(this&&this!==ge&&this instanceof s?i:t,this,o)}}(t,e,d):e!=o&&33!=e||f.length?Mi.apply(r,S):function(t,e,r,n){var i=1&e,s=ki(t);return function e(){for(var a=-1,o=arguments.length,u=-1,c=n.length,h=at(c+o),l=this&&this!==ge&&this instanceof e?s:t;++u<c;)h[u]=n[u];for(;o--;)h[u++]=arguments[++a];return Ce(l,i?r:this,h)}}(t,e,i,l);else var E=function(t,e,r){var n=1&e,i=ki(t);return function e(){return(this&&this!==ge&&this instanceof e?i:t).apply(n?r:this,arguments)}}(t,e,i);return Os((w?ei:Ts)(E,S),t,e)}function Qi(t,e,n,i){return t===r||Va(t,Ot[n])&&!jt.call(i,n)?e:t}function ts(t,e,n,i,s,a){return to(t)&&to(e)&&(a.set(e,t),Kn(t,e,r,ts,a),a.delete(e)),t}function es(t){return io(t)?r:t}function rs(t,e,n,i,s,a){var o=1&n,u=t.length,c=e.length;if(u!=c&&!(o&&c>u))return!1;var h=a.get(t),l=a.get(e);if(h&&l)return h==e&&l==t;var f=-1,p=!0,g=2&n?new $r:r;for(a.set(t,e),a.set(e,t);++f<u;){var d=t[f],v=e[f];if(i)var m=o?i(v,d,f,e,t,a):i(d,v,f,t,e,a);if(m!==r){if(m)continue;p=!1;break}if(g){if(!ke(e,function(t,e){if(!tr(g,e)&&(d===t||s(d,t,n,i,a)))return g.push(e)})){p=!1;break}}else if(d!==v&&!s(d,v,n,i,a)){p=!1;break}}return a.delete(t),a.delete(e),p}function ns(t){return Ns(Ds(t,r,zs),t+"")}function is(t){return An(t,No,ps)}function ss(t){return An(t,Oo,gs)}var as=Tr?function(t){return Tr.get(t)}:cu;function os(t){for(var e=t.name+"",r=Rr[e],n=jt.call(Rr,e)?r.length:0;n--;){var i=r[n],s=i.func;if(null==s||s==t)return i.name}return e}function us(t){return(jt.call(Vr,"placeholder")?Vr:t).placeholder}function cs(){var t=Vr.iteratee||su;return t=t===su?jn:t,arguments.length?t(arguments[0],arguments[1]):t}function hs(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function ls(t){for(var e=No(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,As(i)]}return e}function fs(t,e){var n=function(t,e){return null==t?r:t[e]}(t,e);return _n(n)?n:r}var ps=ye?function(t){return null==t?[]:(t=Dt(t),Re(ye(t),function(e){return Jt.call(t,e)}))}:vu,gs=ye?function(t){for(var e=[];t;)_e(e,ps(t)),t=Gt(t);return e}:vu,ds=Cn;function vs(t,e,r){for(var n=-1,i=(e=wi(e,t)).length,s=!1;++n<i;){var a=Hs(e[n]);if(!(s=null!=t&&r(t,a)))break;t=t[a]}return s||++n!=i?s:!!(i=null==t?0:t.length)&&Qa(i)&&xs(a,i)&&(Ua(t)||Ka(t))}function ms(t){return"function"!=typeof t.constructor||Fs(t)?{}:Mr(Gt(t))}function ys(t){return Ua(t)||Ka(t)||!!(Xt&&t&&t[Xt])}function xs(t,e){var r=typeof t;return!!(e=null==e?f:e)&&("number"==r||"symbol"!=r&&xt.test(t))&&t>-1&&t%1==0&&t<e}function ws(t,e,r){if(!to(r))return!1;var n=typeof e;return!!("number"==n?Wa(r)&&xs(e,r.length):"string"==n&&e in r)&&Va(r[e],t)}function Ss(t,e){if(Ua(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!uo(t))||(et.test(t)||!tt.test(t)||null!=e&&t in Dt(e))}function Es(t){var e=os(t),r=Vr[e];if("function"!=typeof r||!(e in Ur.prototype))return!1;if(t===r)return!0;var n=as(r);return!!n&&t===n[0]}(Fr&&ds(new Fr(new ArrayBuffer(1)))!=B||Ar&&ds(new Ar)!=F||Cr&&ds(Cr.resolve())!=D||Dr&&ds(new Dr)!=P||Ir&&ds(new Ir)!=N)&&(ds=function(t){var e=Cn(t),n=e==C?t.constructor:r,i=n?ks(n):"";if(i)switch(i){case Nr:return B;case Or:return F;case Br:return D;case _r:return P;case jr:return N}return e});var bs=Bt?Xa:mu;function Fs(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Ot)}function As(t){return t==t&&!to(t)}function Cs(t,e){return function(n){return null!=n&&(n[t]===e&&(e!==r||t in Dt(n)))}}function Ds(t,e,n){return e=yr(e===r?t.length-1:e,0),function(){for(var r=arguments,i=-1,s=yr(r.length-e,0),a=at(s);++i<s;)a[i]=r[e+i];i=-1;for(var o=at(e+1);++i<e;)o[i]=r[i];return o[e]=n(a),Ce(t,this,o)}}function Is(t,e){return e.length<2?t:Fn(t,ii(e,0,-1))}function Ps(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var Ts=Bs(ei),Rs=pe||function(t,e){return ge.setTimeout(t,e)},Ns=Bs(ri);function Os(t,e,r){var n=e+"";return Ns(t,function(t,e){var r=e.length;if(!r)return t;var n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(ot,"{\n/* [wrapped with "+e+"] */\n")}(n,function(t,e){return Ie(v,function(r){var n="_."+r[0];e&r[1]&&!Ne(t,n)&&t.push(n)}),t.sort()}(function(t){var e=t.match(ut);return e?e[1].split(ct):[]}(n),r)))}function Bs(t){var e=0,n=0;return function(){var i=wr(),s=16-(i-n);if(n=i,s>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(r,arguments)}}function _s(t,e){var n=-1,i=t.length,s=i-1;for(e=e===r?i:e;++n<e;){var a=Jn(n,s),o=t[a];t[a]=t[n],t[n]=o}return t.length=e,t}var js=function(t){var e=Ba(t,function(t){return 500===r.size&&r.clear(),t}),r=e.cache;return e}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(rt,function(t,r,n,i){e.push(n?i.replace(ft,"$1"):r||t)}),e});function Hs(t){if("string"==typeof t||uo(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function ks(t){if(null!=t){try{return _t.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ls(t){if(t instanceof Ur)return t.clone();var e=new Kr(t.__wrapped__,t.__chain__);return e.__actions__=Ti(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Vs=Xn(function(t,e){return Ga(t)?fn(t,yn(e,1,Ga,!0)):[]}),Ms=Xn(function(t,e){var n=Ys(e);return Ga(n)&&(n=r),Ga(t)?fn(t,yn(e,1,Ga,!0),cs(n,2)):[]}),qs=Xn(function(t,e){var n=Ys(e);return Ga(n)&&(n=r),Ga(t)?fn(t,yn(e,1,Ga,!0),r,n):[]});function Ks(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:go(r);return i<0&&(i=yr(n+i,0)),Me(t,cs(e,3),i)}function Us(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var s=i-1;return n!==r&&(s=go(n),s=n<0?yr(i+s,0):xr(s,i-1)),Me(t,cs(e,3),s,!0)}function zs(t){return(null==t?0:t.length)?yn(t,1):[]}function Ws(t){return t&&t.length?t[0]:r}var Gs=Xn(function(t){var e=Be(t,yi);return e.length&&e[0]===t[0]?Tn(e):[]}),$s=Xn(function(t){var e=Ys(t),n=Be(t,yi);return e===Ys(n)?e=r:n.pop(),n.length&&n[0]===t[0]?Tn(n,cs(e,2)):[]}),Js=Xn(function(t){var e=Ys(t),n=Be(t,yi);return(e="function"==typeof e?e:r)&&n.pop(),n.length&&n[0]===t[0]?Tn(n,r,e):[]});function Ys(t){var e=null==t?0:t.length;return e?t[e-1]:r}var Xs=Xn(Zs);function Zs(t,e){return t&&t.length&&e&&e.length?Gn(t,e):t}var Qs=ns(function(t,e){var r=null==t?0:t.length,n=on(t,e);return $n(t,Be(e,function(t){return xs(t,r)?+t:t}).sort(Di)),n});function ta(t){return null==t?t:br.call(t)}var ea=Xn(function(t){return li(yn(t,1,Ga,!0))}),ra=Xn(function(t){var e=Ys(t);return Ga(e)&&(e=r),li(yn(t,1,Ga,!0),cs(e,2))}),na=Xn(function(t){var e=Ys(t);return e="function"==typeof e?e:r,li(yn(t,1,Ga,!0),r,e)});function ia(t){if(!t||!t.length)return[];var e=0;return t=Re(t,function(t){if(Ga(t))return e=yr(t.length,e),!0}),Ye(e,function(e){return Be(t,We(e))})}function sa(t,e){if(!t||!t.length)return[];var n=ia(t);return null==e?n:Be(n,function(t){return Ce(e,r,t)})}var aa=Xn(function(t,e){return Ga(t)?fn(t,e):[]}),oa=Xn(function(t){return vi(Re(t,Ga))}),ua=Xn(function(t){var e=Ys(t);return Ga(e)&&(e=r),vi(Re(t,Ga),cs(e,2))}),ca=Xn(function(t){var e=Ys(t);return e="function"==typeof e?e:r,vi(Re(t,Ga),r,e)}),ha=Xn(ia);var la=Xn(function(t){var e=t.length,n=e>1?t[e-1]:r;return n="function"==typeof n?(t.pop(),n):r,sa(t,n)});function fa(t){var e=Vr(t);return e.__chain__=!0,e}function pa(t,e){return e(t)}var ga=ns(function(t){var e=t.length,n=e?t[0]:0,i=this.__wrapped__,s=function(e){return on(e,t)};return!(e>1||this.__actions__.length)&&i instanceof Ur&&xs(n)?((i=i.slice(n,+n+(e?1:0))).__actions__.push({func:pa,args:[s],thisArg:r}),new Kr(i,this.__chain__).thru(function(t){return e&&!t.length&&t.push(r),t})):this.thru(s)});var da=Ni(function(t,e,r){jt.call(t,r)?++t[r]:an(t,r,1)});var va=Li(Ks),ma=Li(Us);function ya(t,e){return(Ua(t)?Ie:pn)(t,cs(e,3))}function xa(t,e){return(Ua(t)?Pe:gn)(t,cs(e,3))}var wa=Ni(function(t,e,r){jt.call(t,r)?t[r].push(e):an(t,r,[e])});var Sa=Xn(function(t,e,r){var n=-1,i="function"==typeof e,s=Wa(t)?at(t.length):[];return pn(t,function(t){s[++n]=i?Ce(e,t,r):Rn(t,e,r)}),s}),Ea=Ni(function(t,e,r){an(t,r,e)});function ba(t,e){return(Ua(t)?Be:Vn)(t,cs(e,3))}var Fa=Ni(function(t,e,r){t[r?0:1].push(e)},function(){return[[],[]]});var Aa=Xn(function(t,e){if(null==t)return[];var r=e.length;return r>1&&ws(t,e[0],e[1])?e=[]:r>2&&ws(e[0],e[1],e[2])&&(e=[e[0]]),zn(t,yn(e,1),[])}),Ca=fe||function(){return ge.Date.now()};function Da(t,e,n){return e=n?r:e,e=t&&null==e?t.length:e,Zi(t,c,r,r,r,r,e)}function Ia(t,e){var i;if("function"!=typeof e)throw new Tt(n);return t=go(t),function(){return--t>0&&(i=e.apply(this,arguments)),t<=1&&(e=r),i}}var Pa=Xn(function(t,e,r){var n=1;if(r.length){var i=cr(r,us(Pa));n|=o}return Zi(t,n,e,r,i)}),Ta=Xn(function(t,e,r){var n=3;if(r.length){var i=cr(r,us(Ta));n|=o}return Zi(e,n,t,r,i)});function Ra(t,e,i){var s,a,o,u,c,h,l=0,f=!1,p=!1,g=!0;if("function"!=typeof t)throw new Tt(n);function d(e){var n=s,i=a;return s=a=r,l=e,u=t.apply(i,n)}function v(t){var n=t-h;return h===r||n>=e||n<0||p&&t-l>=o}function m(){var t=Ca();if(v(t))return y(t);c=Rs(m,function(t){var r=e-(t-h);return p?xr(r,o-(t-l)):r}(t))}function y(t){return c=r,g&&s?d(t):(s=a=r,u)}function x(){var t=Ca(),n=v(t);if(s=arguments,a=this,h=t,n){if(c===r)return function(t){return l=t,c=Rs(m,e),f?d(t):u}(h);if(p)return bi(c),c=Rs(m,e),d(h)}return c===r&&(c=Rs(m,e)),u}return e=mo(e)||0,to(i)&&(f=!!i.leading,o=(p="maxWait"in i)?yr(mo(i.maxWait)||0,e):o,g="trailing"in i?!!i.trailing:g),x.cancel=function(){c!==r&&bi(c),l=0,s=h=a=c=r},x.flush=function(){return c===r?u:y(Ca())},x}var Na=Xn(function(t,e){return ln(t,1,e)}),Oa=Xn(function(t,e,r){return ln(t,mo(e)||0,r)});function Ba(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Tt(n);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,n);return r.cache=s.set(i,a)||s,a};return r.cache=new(Ba.Cache||Gr),r}function _a(t){if("function"!=typeof t)throw new Tt(n);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ba.Cache=Gr;var ja=Si(function(t,e){var r=(e=1==e.length&&Ua(e[0])?Be(e[0],Ze(cs())):Be(yn(e,1),Ze(cs()))).length;return Xn(function(n){for(var i=-1,s=xr(n.length,r);++i<s;)n[i]=e[i].call(this,n[i]);return Ce(t,this,n)})}),Ha=Xn(function(t,e){var n=cr(e,us(Ha));return Zi(t,o,r,e,n)}),ka=Xn(function(t,e){var n=cr(e,us(ka));return Zi(t,u,r,e,n)}),La=ns(function(t,e){return Zi(t,h,r,r,r,e)});function Va(t,e){return t===e||t!=t&&e!=e}var Ma=Gi(Dn),qa=Gi(function(t,e){return t>=e}),Ka=Nn(function(){return arguments}())?Nn:function(t){return eo(t)&&jt.call(t,"callee")&&!Jt.call(t,"callee")},Ua=at.isArray,za=we?Ze(we):function(t){return eo(t)&&Cn(t)==O};function Wa(t){return null!=t&&Qa(t.length)&&!Xa(t)}function Ga(t){return eo(t)&&Wa(t)}var $a=xe||mu,Ja=Se?Ze(Se):function(t){return eo(t)&&Cn(t)==w};function Ya(t){if(!eo(t))return!1;var e=Cn(t);return e==S||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!io(t)}function Xa(t){if(!to(t))return!1;var e=Cn(t);return e==E||e==b||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Za(t){return"number"==typeof t&&t==go(t)}function Qa(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=f}function to(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function eo(t){return null!=t&&"object"==typeof t}var ro=Ee?Ze(Ee):function(t){return eo(t)&&ds(t)==F};function no(t){return"number"==typeof t||eo(t)&&Cn(t)==A}function io(t){if(!eo(t)||Cn(t)!=C)return!1;var e=Gt(t);if(null===e)return!0;var r=jt.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&_t.call(r)==Vt}var so=be?Ze(be):function(t){return eo(t)&&Cn(t)==I};var ao=Fe?Ze(Fe):function(t){return eo(t)&&ds(t)==P};function oo(t){return"string"==typeof t||!Ua(t)&&eo(t)&&Cn(t)==T}function uo(t){return"symbol"==typeof t||eo(t)&&Cn(t)==R}var co=Ae?Ze(Ae):function(t){return eo(t)&&Qa(t.length)&&!!oe[Cn(t)]};var ho=Gi(Ln),lo=Gi(function(t,e){return t<=e});function fo(t){if(!t)return[];if(Wa(t))return oo(t)?pr(t):Ti(t);if(Zt&&t[Zt])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[Zt]());var e=ds(t);return(e==F?or:e==P?hr:Mo)(t)}function po(t){return t?(t=mo(t))===l||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function go(t){var e=po(t),r=e%1;return e==e?r?e-r:e:0}function vo(t){return t?un(go(t),0,d):0}function mo(t){if("number"==typeof t)return t;if(uo(t))return p;if(to(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=to(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Xe(t);var r=vt.test(t);return r||yt.test(t)?le(t.slice(2),r?2:8):dt.test(t)?p:+t}function yo(t){return Ri(t,Oo(t))}function xo(t){return null==t?"":hi(t)}var wo=Oi(function(t,e){if(Fs(e)||Wa(e))Ri(e,No(e),t);else for(var r in e)jt.call(e,r)&&en(t,r,e[r])}),So=Oi(function(t,e){Ri(e,Oo(e),t)}),Eo=Oi(function(t,e,r,n){Ri(e,Oo(e),t,n)}),bo=Oi(function(t,e,r,n){Ri(e,No(e),t,n)}),Fo=ns(on);var Ao=Xn(function(t,e){t=Dt(t);var n=-1,i=e.length,s=i>2?e[2]:r;for(s&&ws(e[0],e[1],s)&&(i=1);++n<i;)for(var a=e[n],o=Oo(a),u=-1,c=o.length;++u<c;){var h=o[u],l=t[h];(l===r||Va(l,Ot[h])&&!jt.call(t,h))&&(t[h]=a[h])}return t}),Co=Xn(function(t){return t.push(r,ts),Ce(_o,r,t)});function Do(t,e,n){var i=null==t?r:Fn(t,e);return i===r?n:i}function Io(t,e){return null!=t&&vs(t,e,Pn)}var Po=qi(function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Lt.call(e)),t[e]=r},eu(iu)),To=qi(function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Lt.call(e)),jt.call(t,e)?t[e].push(r):t[e]=[r]},cs),Ro=Xn(Rn);function No(t){return Wa(t)?Yr(t):Hn(t)}function Oo(t){return Wa(t)?Yr(t,!0):kn(t)}var Bo=Oi(function(t,e,r){Kn(t,e,r)}),_o=Oi(function(t,e,r,n){Kn(t,e,r,n)}),jo=ns(function(t,e){var r={};if(null==t)return r;var n=!1;e=Be(e,function(e){return e=wi(e,t),n||(n=e.length>1),e}),Ri(t,ss(t),r),n&&(r=cn(r,7,es));for(var i=e.length;i--;)fi(r,e[i]);return r});var Ho=ns(function(t,e){return null==t?{}:function(t,e){return Wn(t,e,function(e,r){return Io(t,r)})}(t,e)});function ko(t,e){if(null==t)return{};var r=Be(ss(t),function(t){return[t]});return e=cs(e),Wn(t,r,function(t,r){return e(t,r[0])})}var Lo=Xi(No),Vo=Xi(Oo);function Mo(t){return null==t?[]:Qe(t,No(t))}var qo=Hi(function(t,e,r){return e=e.toLowerCase(),t+(r?Ko(e):e)});function Ko(t){return Xo(xo(t).toLowerCase())}function Uo(t){return(t=xo(t))&&t.replace(wt,nr).replace(te,"")}var zo=Hi(function(t,e,r){return t+(r?"-":"")+e.toLowerCase()}),Wo=Hi(function(t,e,r){return t+(r?" ":"")+e.toLowerCase()}),Go=ji("toLowerCase");var $o=Hi(function(t,e,r){return t+(r?"_":"")+e.toLowerCase()});var Jo=Hi(function(t,e,r){return t+(r?" ":"")+Xo(e)});var Yo=Hi(function(t,e,r){return t+(r?" ":"")+e.toUpperCase()}),Xo=ji("toUpperCase");function Zo(t,e,n){return t=xo(t),(e=n?r:e)===r?function(t){return ie.test(t)}(t)?function(t){return t.match(re)||[]}(t):function(t){return t.match(ht)||[]}(t):t.match(e)||[]}var Qo=Xn(function(t,e){try{return Ce(t,r,e)}catch(t){return Ya(t)?t:new Ft(t)}}),tu=ns(function(t,e){return Ie(e,function(e){e=Hs(e),an(t,e,Pa(t[e],t))}),t});function eu(t){return function(){return t}}var ru=Vi(),nu=Vi(!0);function iu(t){return t}function su(t){return jn("function"==typeof t?t:cn(t,1))}var au=Xn(function(t,e){return function(r){return Rn(r,t,e)}}),ou=Xn(function(t,e){return function(r){return Rn(t,r,e)}});function uu(t,e,r){var n=No(e),i=bn(e,n);null!=r||to(e)&&(i.length||!n.length)||(r=e,e=t,t=this,i=bn(e,No(e)));var s=!(to(r)&&"chain"in r&&!r.chain),a=Xa(t);return Ie(i,function(r){var n=e[r];t[r]=n,a&&(t.prototype[r]=function(){var e=this.__chain__;if(s||e){var r=t(this.__wrapped__);return(r.__actions__=Ti(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,_e([this.value()],arguments))})}),t}function cu(){}var hu=Ui(Be),lu=Ui(Te),fu=Ui(ke);function pu(t){return Ss(t)?We(Hs(t)):function(t){return function(e){return Fn(e,t)}}(t)}var gu=Wi(),du=Wi(!0);function vu(){return[]}function mu(){return!1}var yu=Ki(function(t,e){return t+e},0),xu=Ji("ceil"),wu=Ki(function(t,e){return t/e},1),Su=Ji("floor");var Eu,bu=Ki(function(t,e){return t*e},1),Fu=Ji("round"),Au=Ki(function(t,e){return t-e},0);return Vr.after=function(t,e){if("function"!=typeof e)throw new Tt(n);return t=go(t),function(){if(--t<1)return e.apply(this,arguments)}},Vr.ary=Da,Vr.assign=wo,Vr.assignIn=So,Vr.assignInWith=Eo,Vr.assignWith=bo,Vr.at=Fo,Vr.before=Ia,Vr.bind=Pa,Vr.bindAll=tu,Vr.bindKey=Ta,Vr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ua(t)?t:[t]},Vr.chain=fa,Vr.chunk=function(t,e,n){e=(n?ws(t,e,n):e===r)?1:yr(go(e),0);var i=null==t?0:t.length;if(!i||e<1)return[];for(var s=0,a=0,o=at(de(i/e));s<i;)o[a++]=ii(t,s,s+=e);return o},Vr.compact=function(t){for(var e=-1,r=null==t?0:t.length,n=0,i=[];++e<r;){var s=t[e];s&&(i[n++]=s)}return i},Vr.concat=function(){var t=arguments.length;if(!t)return[];for(var e=at(t-1),r=arguments[0],n=t;n--;)e[n-1]=arguments[n];return _e(Ua(r)?Ti(r):[r],yn(e,1))},Vr.cond=function(t){var e=null==t?0:t.length,r=cs();return t=e?Be(t,function(t){if("function"!=typeof t[1])throw new Tt(n);return[r(t[0]),t[1]]}):[],Xn(function(r){for(var n=-1;++n<e;){var i=t[n];if(Ce(i[0],this,r))return Ce(i[1],this,r)}})},Vr.conforms=function(t){return function(t){var e=No(t);return function(r){return hn(r,t,e)}}(cn(t,1))},Vr.constant=eu,Vr.countBy=da,Vr.create=function(t,e){var r=Mr(t);return null==e?r:sn(r,e)},Vr.curry=function t(e,n,i){var s=Zi(e,8,r,r,r,r,r,n=i?r:n);return s.placeholder=t.placeholder,s},Vr.curryRight=function t(e,n,i){var s=Zi(e,a,r,r,r,r,r,n=i?r:n);return s.placeholder=t.placeholder,s},Vr.debounce=Ra,Vr.defaults=Ao,Vr.defaultsDeep=Co,Vr.defer=Na,Vr.delay=Oa,Vr.difference=Vs,Vr.differenceBy=Ms,Vr.differenceWith=qs,Vr.drop=function(t,e,n){var i=null==t?0:t.length;return i?ii(t,(e=n||e===r?1:go(e))<0?0:e,i):[]},Vr.dropRight=function(t,e,n){var i=null==t?0:t.length;return i?ii(t,0,(e=i-(e=n||e===r?1:go(e)))<0?0:e):[]},Vr.dropRightWhile=function(t,e){return t&&t.length?gi(t,cs(e,3),!0,!0):[]},Vr.dropWhile=function(t,e){return t&&t.length?gi(t,cs(e,3),!0):[]},Vr.fill=function(t,e,n,i){var s=null==t?0:t.length;return s?(n&&"number"!=typeof n&&ws(t,e,n)&&(n=0,i=s),function(t,e,n,i){var s=t.length;for((n=go(n))<0&&(n=-n>s?0:s+n),(i=i===r||i>s?s:go(i))<0&&(i+=s),i=n>i?0:vo(i);n<i;)t[n++]=e;return t}(t,e,n,i)):[]},Vr.filter=function(t,e){return(Ua(t)?Re:mn)(t,cs(e,3))},Vr.flatMap=function(t,e){return yn(ba(t,e),1)},Vr.flatMapDeep=function(t,e){return yn(ba(t,e),l)},Vr.flatMapDepth=function(t,e,n){return n=n===r?1:go(n),yn(ba(t,e),n)},Vr.flatten=zs,Vr.flattenDeep=function(t){return(null==t?0:t.length)?yn(t,l):[]},Vr.flattenDepth=function(t,e){return(null==t?0:t.length)?yn(t,e=e===r?1:go(e)):[]},Vr.flip=function(t){return Zi(t,512)},Vr.flow=ru,Vr.flowRight=nu,Vr.fromPairs=function(t){for(var e=-1,r=null==t?0:t.length,n={};++e<r;){var i=t[e];n[i[0]]=i[1]}return n},Vr.functions=function(t){return null==t?[]:bn(t,No(t))},Vr.functionsIn=function(t){return null==t?[]:bn(t,Oo(t))},Vr.groupBy=wa,Vr.initial=function(t){return(null==t?0:t.length)?ii(t,0,-1):[]},Vr.intersection=Gs,Vr.intersectionBy=$s,Vr.intersectionWith=Js,Vr.invert=Po,Vr.invertBy=To,Vr.invokeMap=Sa,Vr.iteratee=su,Vr.keyBy=Ea,Vr.keys=No,Vr.keysIn=Oo,Vr.map=ba,Vr.mapKeys=function(t,e){var r={};return e=cs(e,3),Sn(t,function(t,n,i){an(r,e(t,n,i),t)}),r},Vr.mapValues=function(t,e){var r={};return e=cs(e,3),Sn(t,function(t,n,i){an(r,n,e(t,n,i))}),r},Vr.matches=function(t){return Mn(cn(t,1))},Vr.matchesProperty=function(t,e){return qn(t,cn(e,1))},Vr.memoize=Ba,Vr.merge=Bo,Vr.mergeWith=_o,Vr.method=au,Vr.methodOf=ou,Vr.mixin=uu,Vr.negate=_a,Vr.nthArg=function(t){return t=go(t),Xn(function(e){return Un(e,t)})},Vr.omit=jo,Vr.omitBy=function(t,e){return ko(t,_a(cs(e)))},Vr.once=function(t){return Ia(2,t)},Vr.orderBy=function(t,e,n,i){return null==t?[]:(Ua(e)||(e=null==e?[]:[e]),Ua(n=i?r:n)||(n=null==n?[]:[n]),zn(t,e,n))},Vr.over=hu,Vr.overArgs=ja,Vr.overEvery=lu,Vr.overSome=fu,Vr.partial=Ha,Vr.partialRight=ka,Vr.partition=Fa,Vr.pick=Ho,Vr.pickBy=ko,Vr.property=pu,Vr.propertyOf=function(t){return function(e){return null==t?r:Fn(t,e)}},Vr.pull=Xs,Vr.pullAll=Zs,Vr.pullAllBy=function(t,e,r){return t&&t.length&&e&&e.length?Gn(t,e,cs(r,2)):t},Vr.pullAllWith=function(t,e,n){return t&&t.length&&e&&e.length?Gn(t,e,r,n):t},Vr.pullAt=Qs,Vr.range=gu,Vr.rangeRight=du,Vr.rearg=La,Vr.reject=function(t,e){return(Ua(t)?Re:mn)(t,_a(cs(e,3)))},Vr.remove=function(t,e){var r=[];if(!t||!t.length)return r;var n=-1,i=[],s=t.length;for(e=cs(e,3);++n<s;){var a=t[n];e(a,n,t)&&(r.push(a),i.push(n))}return $n(t,i),r},Vr.rest=function(t,e){if("function"!=typeof t)throw new Tt(n);return Xn(t,e=e===r?e:go(e))},Vr.reverse=ta,Vr.sampleSize=function(t,e,n){return e=(n?ws(t,e,n):e===r)?1:go(e),(Ua(t)?Zr:Qn)(t,e)},Vr.set=function(t,e,r){return null==t?t:ti(t,e,r)},Vr.setWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:ti(t,e,n,i)},Vr.shuffle=function(t){return(Ua(t)?Qr:ni)(t)},Vr.slice=function(t,e,n){var i=null==t?0:t.length;return i?(n&&"number"!=typeof n&&ws(t,e,n)?(e=0,n=i):(e=null==e?0:go(e),n=n===r?i:go(n)),ii(t,e,n)):[]},Vr.sortBy=Aa,Vr.sortedUniq=function(t){return t&&t.length?ui(t):[]},Vr.sortedUniqBy=function(t,e){return t&&t.length?ui(t,cs(e,2)):[]},Vr.split=function(t,e,n){return n&&"number"!=typeof n&&ws(t,e,n)&&(e=n=r),(n=n===r?d:n>>>0)?(t=xo(t))&&("string"==typeof e||null!=e&&!so(e))&&!(e=hi(e))&&ar(t)?Ei(pr(t),0,n):t.split(e,n):[]},Vr.spread=function(t,e){if("function"!=typeof t)throw new Tt(n);return e=null==e?0:yr(go(e),0),Xn(function(r){var n=r[e],i=Ei(r,0,e);return n&&_e(i,n),Ce(t,this,i)})},Vr.tail=function(t){var e=null==t?0:t.length;return e?ii(t,1,e):[]},Vr.take=function(t,e,n){return t&&t.length?ii(t,0,(e=n||e===r?1:go(e))<0?0:e):[]},Vr.takeRight=function(t,e,n){var i=null==t?0:t.length;return i?ii(t,(e=i-(e=n||e===r?1:go(e)))<0?0:e,i):[]},Vr.takeRightWhile=function(t,e){return t&&t.length?gi(t,cs(e,3),!1,!0):[]},Vr.takeWhile=function(t,e){return t&&t.length?gi(t,cs(e,3)):[]},Vr.tap=function(t,e){return e(t),t},Vr.throttle=function(t,e,r){var i=!0,s=!0;if("function"!=typeof t)throw new Tt(n);return to(r)&&(i="leading"in r?!!r.leading:i,s="trailing"in r?!!r.trailing:s),Ra(t,e,{leading:i,maxWait:e,trailing:s})},Vr.thru=pa,Vr.toArray=fo,Vr.toPairs=Lo,Vr.toPairsIn=Vo,Vr.toPath=function(t){return Ua(t)?Be(t,Hs):uo(t)?[t]:Ti(js(xo(t)))},Vr.toPlainObject=yo,Vr.transform=function(t,e,r){var n=Ua(t),i=n||$a(t)||co(t);if(e=cs(e,4),null==r){var s=t&&t.constructor;r=i?n?new s:[]:to(t)&&Xa(s)?Mr(Gt(t)):{}}return(i?Ie:Sn)(t,function(t,n,i){return e(r,t,n,i)}),r},Vr.unary=function(t){return Da(t,1)},Vr.union=ea,Vr.unionBy=ra,Vr.unionWith=na,Vr.uniq=function(t){return t&&t.length?li(t):[]},Vr.uniqBy=function(t,e){return t&&t.length?li(t,cs(e,2)):[]},Vr.uniqWith=function(t,e){return e="function"==typeof e?e:r,t&&t.length?li(t,r,e):[]},Vr.unset=function(t,e){return null==t||fi(t,e)},Vr.unzip=ia,Vr.unzipWith=sa,Vr.update=function(t,e,r){return null==t?t:pi(t,e,xi(r))},Vr.updateWith=function(t,e,n,i){return i="function"==typeof i?i:r,null==t?t:pi(t,e,xi(n),i)},Vr.values=Mo,Vr.valuesIn=function(t){return null==t?[]:Qe(t,Oo(t))},Vr.without=aa,Vr.words=Zo,Vr.wrap=function(t,e){return Ha(xi(e),t)},Vr.xor=oa,Vr.xorBy=ua,Vr.xorWith=ca,Vr.zip=ha,Vr.zipObject=function(t,e){return mi(t||[],e||[],en)},Vr.zipObjectDeep=function(t,e){return mi(t||[],e||[],ti)},Vr.zipWith=la,Vr.entries=Lo,Vr.entriesIn=Vo,Vr.extend=So,Vr.extendWith=Eo,uu(Vr,Vr),Vr.add=yu,Vr.attempt=Qo,Vr.camelCase=qo,Vr.capitalize=Ko,Vr.ceil=xu,Vr.clamp=function(t,e,n){return n===r&&(n=e,e=r),n!==r&&(n=(n=mo(n))==n?n:0),e!==r&&(e=(e=mo(e))==e?e:0),un(mo(t),e,n)},Vr.clone=function(t){return cn(t,4)},Vr.cloneDeep=function(t){return cn(t,5)},Vr.cloneDeepWith=function(t,e){return cn(t,5,e="function"==typeof e?e:r)},Vr.cloneWith=function(t,e){return cn(t,4,e="function"==typeof e?e:r)},Vr.conformsTo=function(t,e){return null==e||hn(t,e,No(e))},Vr.deburr=Uo,Vr.defaultTo=function(t,e){return null==t||t!=t?e:t},Vr.divide=wu,Vr.endsWith=function(t,e,n){t=xo(t),e=hi(e);var i=t.length,s=n=n===r?i:un(go(n),0,i);return(n-=e.length)>=0&&t.slice(n,s)==e},Vr.eq=Va,Vr.escape=function(t){return(t=xo(t))&&Y.test(t)?t.replace($,ir):t},Vr.escapeRegExp=function(t){return(t=xo(t))&&it.test(t)?t.replace(nt,"\\$&"):t},Vr.every=function(t,e,n){var i=Ua(t)?Te:dn;return n&&ws(t,e,n)&&(e=r),i(t,cs(e,3))},Vr.find=va,Vr.findIndex=Ks,Vr.findKey=function(t,e){return Ve(t,cs(e,3),Sn)},Vr.findLast=ma,Vr.findLastIndex=Us,Vr.findLastKey=function(t,e){return Ve(t,cs(e,3),En)},Vr.floor=Su,Vr.forEach=ya,Vr.forEachRight=xa,Vr.forIn=function(t,e){return null==t?t:xn(t,cs(e,3),Oo)},Vr.forInRight=function(t,e){return null==t?t:wn(t,cs(e,3),Oo)},Vr.forOwn=function(t,e){return t&&Sn(t,cs(e,3))},Vr.forOwnRight=function(t,e){return t&&En(t,cs(e,3))},Vr.get=Do,Vr.gt=Ma,Vr.gte=qa,Vr.has=function(t,e){return null!=t&&vs(t,e,In)},Vr.hasIn=Io,Vr.head=Ws,Vr.identity=iu,Vr.includes=function(t,e,r,n){t=Wa(t)?t:Mo(t),r=r&&!n?go(r):0;var i=t.length;return r<0&&(r=yr(i+r,0)),oo(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&qe(t,e,r)>-1},Vr.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:go(r);return i<0&&(i=yr(n+i,0)),qe(t,e,i)},Vr.inRange=function(t,e,n){return e=po(e),n===r?(n=e,e=0):n=po(n),function(t,e,r){return t>=xr(e,r)&&t<yr(e,r)}(t=mo(t),e,n)},Vr.invoke=Ro,Vr.isArguments=Ka,Vr.isArray=Ua,Vr.isArrayBuffer=za,Vr.isArrayLike=Wa,Vr.isArrayLikeObject=Ga,Vr.isBoolean=function(t){return!0===t||!1===t||eo(t)&&Cn(t)==x},Vr.isBuffer=$a,Vr.isDate=Ja,Vr.isElement=function(t){return eo(t)&&1===t.nodeType&&!io(t)},Vr.isEmpty=function(t){if(null==t)return!0;if(Wa(t)&&(Ua(t)||"string"==typeof t||"function"==typeof t.splice||$a(t)||co(t)||Ka(t)))return!t.length;var e=ds(t);if(e==F||e==P)return!t.size;if(Fs(t))return!Hn(t).length;for(var r in t)if(jt.call(t,r))return!1;return!0},Vr.isEqual=function(t,e){return On(t,e)},Vr.isEqualWith=function(t,e,n){var i=(n="function"==typeof n?n:r)?n(t,e):r;return i===r?On(t,e,r,n):!!i},Vr.isError=Ya,Vr.isFinite=function(t){return"number"==typeof t&&Le(t)},Vr.isFunction=Xa,Vr.isInteger=Za,Vr.isLength=Qa,Vr.isMap=ro,Vr.isMatch=function(t,e){return t===e||Bn(t,e,ls(e))},Vr.isMatchWith=function(t,e,n){return n="function"==typeof n?n:r,Bn(t,e,ls(e),n)},Vr.isNaN=function(t){return no(t)&&t!=+t},Vr.isNative=function(t){if(bs(t))throw new Ft("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return _n(t)},Vr.isNil=function(t){return null==t},Vr.isNull=function(t){return null===t},Vr.isNumber=no,Vr.isObject=to,Vr.isObjectLike=eo,Vr.isPlainObject=io,Vr.isRegExp=so,Vr.isSafeInteger=function(t){return Za(t)&&t>=-9007199254740991&&t<=f},Vr.isSet=ao,Vr.isString=oo,Vr.isSymbol=uo,Vr.isTypedArray=co,Vr.isUndefined=function(t){return t===r},Vr.isWeakMap=function(t){return eo(t)&&ds(t)==N},Vr.isWeakSet=function(t){return eo(t)&&"[object WeakSet]"==Cn(t)},Vr.join=function(t,e){return null==t?"":Ge.call(t,e)},Vr.kebabCase=zo,Vr.last=Ys,Vr.lastIndexOf=function(t,e,n){var i=null==t?0:t.length;if(!i)return-1;var s=i;return n!==r&&(s=(s=go(n))<0?yr(i+s,0):xr(s,i-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,s):Me(t,Ue,s,!0)},Vr.lowerCase=Wo,Vr.lowerFirst=Go,Vr.lt=ho,Vr.lte=lo,Vr.max=function(t){return t&&t.length?vn(t,iu,Dn):r},Vr.maxBy=function(t,e){return t&&t.length?vn(t,cs(e,2),Dn):r},Vr.mean=function(t){return ze(t,iu)},Vr.meanBy=function(t,e){return ze(t,cs(e,2))},Vr.min=function(t){return t&&t.length?vn(t,iu,Ln):r},Vr.minBy=function(t,e){return t&&t.length?vn(t,cs(e,2),Ln):r},Vr.stubArray=vu,Vr.stubFalse=mu,Vr.stubObject=function(){return{}},Vr.stubString=function(){return""},Vr.stubTrue=function(){return!0},Vr.multiply=bu,Vr.nth=function(t,e){return t&&t.length?Un(t,go(e)):r},Vr.noConflict=function(){return ge._===this&&(ge._=Mt),this},Vr.noop=cu,Vr.now=Ca,Vr.pad=function(t,e,r){t=xo(t);var n=(e=go(e))?fr(t):0;if(!e||n>=e)return t;var i=(e-n)/2;return zi(ve(i),r)+t+zi(de(i),r)},Vr.padEnd=function(t,e,r){t=xo(t);var n=(e=go(e))?fr(t):0;return e&&n<e?t+zi(e-n,r):t},Vr.padStart=function(t,e,r){t=xo(t);var n=(e=go(e))?fr(t):0;return e&&n<e?zi(e-n,r)+t:t},Vr.parseInt=function(t,e,r){return r||null==e?e=0:e&&(e=+e),Sr(xo(t).replace(st,""),e||0)},Vr.random=function(t,e,n){if(n&&"boolean"!=typeof n&&ws(t,e,n)&&(e=n=r),n===r&&("boolean"==typeof e?(n=e,e=r):"boolean"==typeof t&&(n=t,t=r)),t===r&&e===r?(t=0,e=1):(t=po(t),e===r?(e=t,t=0):e=po(e)),t>e){var i=t;t=e,e=i}if(n||t%1||e%1){var s=Er();return xr(t+s*(e-t+he("1e-"+((s+"").length-1))),e)}return Jn(t,e)},Vr.reduce=function(t,e,r){var n=Ua(t)?je:$e,i=arguments.length<3;return n(t,cs(e,4),r,i,pn)},Vr.reduceRight=function(t,e,r){var n=Ua(t)?He:$e,i=arguments.length<3;return n(t,cs(e,4),r,i,gn)},Vr.repeat=function(t,e,n){return e=(n?ws(t,e,n):e===r)?1:go(e),Yn(xo(t),e)},Vr.replace=function(){var t=arguments,e=xo(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Vr.result=function(t,e,n){var i=-1,s=(e=wi(e,t)).length;for(s||(s=1,t=r);++i<s;){var a=null==t?r:t[Hs(e[i])];a===r&&(i=s,a=n),t=Xa(a)?a.call(t):a}return t},Vr.round=Fu,Vr.runInContext=t,Vr.sample=function(t){return(Ua(t)?Xr:Zn)(t)},Vr.size=function(t){if(null==t)return 0;if(Wa(t))return oo(t)?fr(t):t.length;var e=ds(t);return e==F||e==P?t.size:Hn(t).length},Vr.snakeCase=$o,Vr.some=function(t,e,n){var i=Ua(t)?ke:si;return n&&ws(t,e,n)&&(e=r),i(t,cs(e,3))},Vr.sortedIndex=function(t,e){return ai(t,e)},Vr.sortedIndexBy=function(t,e,r){return oi(t,e,cs(r,2))},Vr.sortedIndexOf=function(t,e){var r=null==t?0:t.length;if(r){var n=ai(t,e);if(n<r&&Va(t[n],e))return n}return-1},Vr.sortedLastIndex=function(t,e){return ai(t,e,!0)},Vr.sortedLastIndexBy=function(t,e,r){return oi(t,e,cs(r,2),!0)},Vr.sortedLastIndexOf=function(t,e){if(null==t?0:t.length){var r=ai(t,e,!0)-1;if(Va(t[r],e))return r}return-1},Vr.startCase=Jo,Vr.startsWith=function(t,e,r){return t=xo(t),r=null==r?0:un(go(r),0,t.length),e=hi(e),t.slice(r,r+e.length)==e},Vr.subtract=Au,Vr.sum=function(t){return t&&t.length?Je(t,iu):0},Vr.sumBy=function(t,e){return t&&t.length?Je(t,cs(e,2)):0},Vr.template=function(t,e,n){var i=Vr.templateSettings;n&&ws(t,e,n)&&(e=r),t=xo(t),e=Eo({},e,i,Qi);var s,a,o=Eo({},e.imports,i.imports,Qi),u=No(o),c=Qe(o,u),h=0,l=e.interpolate||St,f="__p += '",p=It((e.escape||St).source+"|"+l.source+"|"+(l===Q?pt:St).source+"|"+(e.evaluate||St).source+"|$","g"),g="//# sourceURL="+(jt.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ae+"]")+"\n";t.replace(p,function(e,r,n,i,o,u){return n||(n=i),f+=t.slice(h,u).replace(Et,sr),r&&(s=!0,f+="' +\n__e("+r+") +\n'"),o&&(a=!0,f+="';\n"+o+";\n__p += '"),n&&(f+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),h=u+e.length,e}),f+="';\n";var d=jt.call(e,"variable")&&e.variable;if(d){if(lt.test(d))throw new Ft("Invalid `variable` option passed into `_.template`")}else f="with (obj) {\n"+f+"\n}\n";f=(a?f.replace(U,""):f).replace(z,"$1").replace(W,"$1;"),f="function("+(d||"obj")+") {\n"+(d?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+f+"return __p\n}";var v=Qo(function(){return At(u,g+"return "+f).apply(r,c)});if(v.source=f,Ya(v))throw v;return v},Vr.times=function(t,e){if((t=go(t))<1||t>f)return[];var r=d,n=xr(t,d);e=cs(e),t-=d;for(var i=Ye(n,e);++r<t;)e(r);return i},Vr.toFinite=po,Vr.toInteger=go,Vr.toLength=vo,Vr.toLower=function(t){return xo(t).toLowerCase()},Vr.toNumber=mo,Vr.toSafeInteger=function(t){return t?un(go(t),-9007199254740991,f):0===t?t:0},Vr.toString=xo,Vr.toUpper=function(t){return xo(t).toUpperCase()},Vr.trim=function(t,e,n){if((t=xo(t))&&(n||e===r))return Xe(t);if(!t||!(e=hi(e)))return t;var i=pr(t),s=pr(e);return Ei(i,er(i,s),rr(i,s)+1).join("")},Vr.trimEnd=function(t,e,n){if((t=xo(t))&&(n||e===r))return t.slice(0,gr(t)+1);if(!t||!(e=hi(e)))return t;var i=pr(t);return Ei(i,0,rr(i,pr(e))+1).join("")},Vr.trimStart=function(t,e,n){if((t=xo(t))&&(n||e===r))return t.replace(st,"");if(!t||!(e=hi(e)))return t;var i=pr(t);return Ei(i,er(i,pr(e))).join("")},Vr.truncate=function(t,e){var n=30,i="...";if(to(e)){var s="separator"in e?e.separator:s;n="length"in e?go(e.length):n,i="omission"in e?hi(e.omission):i}var a=(t=xo(t)).length;if(ar(t)){var o=pr(t);a=o.length}if(n>=a)return t;var u=n-fr(i);if(u<1)return i;var c=o?Ei(o,0,u).join(""):t.slice(0,u);if(s===r)return c+i;if(o&&(u+=c.length-u),so(s)){if(t.slice(u).search(s)){var h,l=c;for(s.global||(s=It(s.source,xo(gt.exec(s))+"g")),s.lastIndex=0;h=s.exec(l);)var f=h.index;c=c.slice(0,f===r?u:f)}}else if(t.indexOf(hi(s),u)!=u){var p=c.lastIndexOf(s);p>-1&&(c=c.slice(0,p))}return c+i},Vr.unescape=function(t){return(t=xo(t))&&J.test(t)?t.replace(G,dr):t},Vr.uniqueId=function(t){var e=++Ht;return xo(t)+e},Vr.upperCase=Yo,Vr.upperFirst=Xo,Vr.each=ya,Vr.eachRight=xa,Vr.first=Ws,uu(Vr,(Eu={},Sn(Vr,function(t,e){jt.call(Vr.prototype,e)||(Eu[e]=t)}),Eu),{chain:!1}),Vr.VERSION="4.17.21",Ie(["bind","bindKey","curry","curryRight","partial","partialRight"],function(t){Vr[t].placeholder=Vr}),Ie(["drop","take"],function(t,e){Ur.prototype[t]=function(n){n=n===r?1:yr(go(n),0);var i=this.__filtered__&&!e?new Ur(this):this.clone();return i.__filtered__?i.__takeCount__=xr(n,i.__takeCount__):i.__views__.push({size:xr(n,d),type:t+(i.__dir__<0?"Right":"")}),i},Ur.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),Ie(["filter","map","takeWhile"],function(t,e){var r=e+1,n=1==r||3==r;Ur.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:cs(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}}),Ie(["head","last"],function(t,e){var r="take"+(e?"Right":"");Ur.prototype[t]=function(){return this[r](1).value()[0]}}),Ie(["initial","tail"],function(t,e){var r="drop"+(e?"":"Right");Ur.prototype[t]=function(){return this.__filtered__?new Ur(this):this[r](1)}}),Ur.prototype.compact=function(){return this.filter(iu)},Ur.prototype.find=function(t){return this.filter(t).head()},Ur.prototype.findLast=function(t){return this.reverse().find(t)},Ur.prototype.invokeMap=Xn(function(t,e){return"function"==typeof t?new Ur(this):this.map(function(r){return Rn(r,t,e)})}),Ur.prototype.reject=function(t){return this.filter(_a(cs(t)))},Ur.prototype.slice=function(t,e){t=go(t);var n=this;return n.__filtered__&&(t>0||e<0)?new Ur(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==r&&(n=(e=go(e))<0?n.dropRight(-e):n.take(e-t)),n)},Ur.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Ur.prototype.toArray=function(){return this.take(d)},Sn(Ur.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),i=/^(?:head|last)$/.test(e),s=Vr[i?"take"+("last"==e?"Right":""):e],a=i||/^find/.test(e);s&&(Vr.prototype[e]=function(){var e=this.__wrapped__,o=i?[1]:arguments,u=e instanceof Ur,c=o[0],h=u||Ua(e),l=function(t){var e=s.apply(Vr,_e([t],o));return i&&f?e[0]:e};h&&n&&"function"==typeof c&&1!=c.length&&(u=h=!1);var f=this.__chain__,p=!!this.__actions__.length,g=a&&!f,d=u&&!p;if(!a&&h){e=d?e:new Ur(this);var v=t.apply(e,o);return v.__actions__.push({func:pa,args:[l],thisArg:r}),new Kr(v,f)}return g&&d?t.apply(this,o):(v=this.thru(l),g?i?v.value()[0]:v.value():v)})}),Ie(["pop","push","shift","sort","splice","unshift"],function(t){var e=Rt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Vr.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(Ua(i)?i:[],t)}return this[r](function(r){return e.apply(Ua(r)?r:[],t)})}}),Sn(Ur.prototype,function(t,e){var r=Vr[e];if(r){var n=r.name+"";jt.call(Rr,n)||(Rr[n]=[]),Rr[n].push({name:e,func:r})}}),Rr[Mi(r,2).name]=[{name:"wrapper",func:r}],Ur.prototype.clone=function(){var t=new Ur(this.__wrapped__);return t.__actions__=Ti(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=Ti(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=Ti(this.__views__),t},Ur.prototype.reverse=function(){if(this.__filtered__){var t=new Ur(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Ur.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=Ua(t),n=e<0,i=r?t.length:0,s=function(t,e,r){var n=-1,i=r.length;for(;++n<i;){var s=r[n],a=s.size;switch(s.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=xr(e,t+a);break;case"takeRight":t=yr(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=s.start,o=s.end,u=o-a,c=n?o:a-1,h=this.__iteratees__,l=h.length,f=0,p=xr(u,this.__takeCount__);if(!r||!n&&i==u&&p==u)return di(t,this.__actions__);var g=[];t:for(;u--&&f<p;){for(var d=-1,v=t[c+=e];++d<l;){var m=h[d],y=m.iteratee,x=m.type,w=y(v);if(2==x)v=w;else if(!w){if(1==x)continue t;break t}}g[f++]=v}return g},Vr.prototype.at=ga,Vr.prototype.chain=function(){return fa(this)},Vr.prototype.commit=function(){return new Kr(this.value(),this.__chain__)},Vr.prototype.next=function(){this.__values__===r&&(this.__values__=fo(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?r:this.__values__[this.__index__++]}},Vr.prototype.plant=function(t){for(var e,n=this;n instanceof qr;){var i=Ls(n);i.__index__=0,i.__values__=r,e?s.__wrapped__=i:e=i;var s=i;n=n.__wrapped__}return s.__wrapped__=t,e},Vr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Ur){var e=t;return this.__actions__.length&&(e=new Ur(this)),(e=e.reverse()).__actions__.push({func:pa,args:[ta],thisArg:r}),new Kr(e,this.__chain__)}return this.thru(ta)},Vr.prototype.toJSON=Vr.prototype.valueOf=Vr.prototype.value=function(){return di(this.__wrapped__,this.__actions__)},Vr.prototype.first=Vr.prototype.head,Zt&&(Vr.prototype[Zt]=function(){return this}),Vr}();ve?((ve.exports=vr)._=vr,de._=vr):ge._=vr}).call(g)}(ds,ds.exports);var vs=ds.exports;exports.AUDIT_STATUS_INDEX={0:1,1:2,2:3,6:4,7:5,8:6,3:7},exports.AUDIT_WHITE_LIST=["/login","/404","/403","/register","/pay","/file-views","/iitc","/users/info"],exports.CLIENT_WHITE_LIST=["/login","/404","/403","/register","/file-views","/iitc","/account"],exports.CacheKey=n,exports.MENU_DATA_KEY="user_menu_data",exports.PermissionPlugin=re,exports.VoucherDecimal=Yr,exports.WHITE_LIST=["/login","/404","/403","/register","/file-views","/iitc","/account"],exports.aesGcmDecryptForge=function(t,e,n="AESGCM:"){if(!t?.startsWith(n))return null;try{const i=r.util.decode64(t.substring(n.length)),s=r.util.decode64(e);if(32!==s.length)return console.error("密钥不是 32 字节"),null;i.substring(0,8);const a=i.substring(8,20),o=i.substring(i.length-16),u=i.substring(20,i.length-16),c=r.cipher.createDecipher("AES-GCM",s);return c.start({iv:a,tagLength:128,tag:o}),c.update(r.util.createBuffer(u)),c.finish()?c.output.toString():(console.error("GCM Tag 校验失败:密钥错误 / 结构不对 / 需要 AAD"),null)}catch(t){return console.error("AES-GCM 解密失败",t),null}},exports.buildLinkedAmountSegments=t=>{if(t.isZero())return Array(11).fill("");const e=t.abs().times(100).toFixed(0);if(e.length>11)throw new Error("金额超出当前凭证金额栏可显示范围");return e.padStart(11," ").split("").map(t=>" "===t?"":t)},exports.buildTreeForSave=ce,exports.calculateXSum=(t,e)=>t.reduce((t,r)=>t+("number"!=typeof r[e]||isNaN(r[e])?0:r[e]),0),exports.checkCrossYear=t=>{if(t&&2===t.length){if(t[0].split("-")[0]!==t[1].split("-")[0])return!1}return!0},exports.companyPeriodDisabled=(t,e)=>{const r=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}`;return!e.map(t=>t.accountPeriod).includes(r)},exports.copyText=e=>{if(!e)return void t.ElMessage.warning("暂无可复制内容");const r=document.createElement("input");r.value=e,document.body.appendChild(r),r.select(),document.execCommand("copy"),document.body.removeChild(r),t.ElMessage.success("复制成功")},exports.createHttpClient=function(t={}){const{getToken:e=()=>"",onUnauthorized:r=()=>{},onError:n=t=>console.error(t),baseURL:i="",timeout:s=8e3}=t,a=gs.create();return a.interceptors.request.use(t=>t,t=>Promise.reject(t)),a.interceptors.response.use(t=>{console.log(t,"response xxx 888888888");const e=t.data,i=t.config.responseType;if("blob"===i||"arraybuffer"===i)return e;const s=e.code;if(void 0!==s)switch(s){case 200:case 201:return e;case 401:return r();default:return void n(e.msg||"Error")}else n("非本系统的接口")},t=>{if(console.log(t,"error xxx"),"ECONNABORTED"===t.code&&t.message.includes("timeout"))return n("请求超时,请稍后重试!"),Promise.reject(t);const e=vs.get(t,"response.status"),i=vs.get(t,"response.data.msg");switch(e){case 400:t.msg="请求错误";break;case 401:t.msg=i||"未授权",r();break;case 403:t.msg=i||"拒绝访问";break;case 404:t.msg="请求地址出错";break;case 408:t.msg="请求超时";break;case 500:t.msg="服务器内部错误";break;case 501:t.msg="服务未实现";break;case 502:t.msg="网关错误";break;case 503:t.msg="服务不可用";break;case 504:t.msg="网关超时";break;case 505:t.msg="HTTP 版本不受支持"}return t.msg&&n(t.msg),Promise.reject(t)}),t=>{const r=e(),n={baseURL:i,headers:{token:r?`${r}`:void 0,"Content-Type":"application/json"},data:{},timeout:s,withCredentials:!1},{signal:o,...u}=t||{},c=vs.merge({},n,u);return o&&(c.signal=o),a(c)}},exports.debounce=(t,e=300)=>{let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{t.apply(this,n)},e)}},exports.disabledDate=t=>{const e=new Date;return e.setHours(0,0,0,0),t.getTime()<e.getTime()},exports.downloadFile=(t,e)=>{const r=document.createElement("a");if(r.style.display="none","string"==typeof t)r.href=t;else{if(!(t instanceof Blob))return void console.error("不支持的文件源类型");r.href=URL.createObjectURL(t)}r.setAttribute("download",e),document.body.appendChild(r),r.click(),document.body.removeChild(r),t instanceof Blob&&window.URL.revokeObjectURL(r.href)},exports.exportFile=async(e,r,n)=>{try{0;const e=await fetch(r,{method:"get",headers:{token:i()||cookie.get("token")},responseType:"blob"});if(!e.ok)return t.ElMessage.error("请求失败"),!1;const s=await e.blob();if(s.type&&s.type.includes("application/json")){const e=await s.text();try{const r=JSON.parse(e);if(r&&r.msg)return t.ElMessage.error(r.msg),void(401===r.code&&setTimeout(()=>{window.location.href="/login?redirect="+encodeURIComponent(window.location.href)},2e3))}catch{console.warn("")}}const a=e.headers.get("content-disposition");let o=n;if(a){const t=a.match(/filename="?([^"]+)"?/);t&&t[1]&&(o=decodeURIComponent(t[1]))}const u=window.URL.createObjectURL(s),c=document.createElement("a");c.href=u,c.download=o,document.body.appendChild(c),c.click(),t.ElMessage.success("下载成功"),window.URL.revokeObjectURL(u),document.body.removeChild(c)}catch(e){console.error("下载Excel失败:",e),t.ElMessage.error("下载失败")}},exports.extractPermissions=function(t,e={}){const{typeKey:r="type",codeKey:n="code",targetType:i=2,childrenKey:s="children"}=e,a=[],o=t=>{Array.isArray(t)&&t.forEach(t=>{2!==t[r]&&1!==t[r]||!t[n]||a.push(t[n]),t[s]&&Array.isArray(t[s])&&t[s].length>0&&o(t[s])})};return o(t),a},exports.extractPropValues=(t=[],e="",{keepEmpty:r=!1}={})=>{if(!Array.isArray(t))return[];const n=e.split(".").filter(t=>t.trim());return t.map(t=>{let e=t;for(const t of n)if(e=e?.[t],null==e)break;return e}).filter(t=>r||null!=t)},exports.filterEmptyRows=pe,exports.filterTreeData=ie,exports.findParent=se,exports.focusAndOpenSelectInCell=async function({cell:t,event:e,selectSelector:r,nextTick:n,canOpen:i=()=>!0,ignoreSelectors:s=[]}){if("undefined"==typeof window||"undefined"==typeof Element)return!1;if(!(t instanceof HTMLElement&&t.isConnected&&i()))return!1;const a=e?.target;if(!(a instanceof Element&&t.contains(a)))return!1;const o=t.querySelector(r);if(!(o instanceof HTMLElement))return!1;const u=a.closest(".el-select");if(u&&u!==o)return!1;const c=o.querySelector(".el-select__wrapper"),h=o.querySelector('input[role="combobox"]');if(!(c instanceof HTMLElement&&h instanceof HTMLInputElement))return!1;if(c.contains(a))return!1;const l=[...le,...s].join(", "),f=a.closest(l);if(f&&t.contains(f))return!1;const p=()=>i()&&t.isConnected&&o.isConnected&&t.querySelector(r)===o&&o.contains(h)&&o.contains(c)&&!h.disabled&&!o.classList.contains("is-disabled")&&!c.classList.contains("is-disabled");return await n(),!!p()&&(h.focus(),await n(),!(!p()||document.activeElement!==h)&&("false"===h.getAttribute("aria-expanded")&&c.click(),await n(),p()&&"true"===h.getAttribute("aria-expanded")))},exports.formatAmount=t=>null==t||isNaN(t)?"":Number(t).toLocaleString("zh-CN",{minimumFractionDigits:2,maximumFractionDigits:2}),exports.formatAmountToUnits=function(t){const e=["","","","","","","","","","",""];if("number"!=typeof t||isNaN(t)||!isFinite(t))return e;if(t>999999999.99)return console.warn("金额过大,最大支持999999999.99元"),e;if(t<0)return console.warn("金额不能为负数"),e;if(0===t)return e;const r=Math.abs(t).toFixed(2),[n,i]=r.split("."),s=n.length;for(let t=0;t<s;t++){const r=n[s-1-t],i=8-t;i>=0&&(e[i]=r)}return(parseInt(n)>0||parseInt(i)>0)&&(e[9]=i[0],e[10]=i[1]),e},exports.formatDateTime=(t,e=0,r=0)=>{const n=new Date(t);n.setHours(e,r,0,0);return`${n.getFullYear()}-${ne(n.getMonth()+1)}-${ne(n.getDate())} ${ne(n.getHours())}:${ne(n.getMinutes())}`},exports.formatMenuData=ee,exports.formatMenuTree=function t(e){return Array.isArray(e)?e.filter(t=>1===t.type||void 0===t.type).map(e=>{const r={title:e.title,...e.path&&{path:e.path},...e.svgName&&{svgName:e.svgName},...e.code&&{code:e.code}};if(e.children&&e.children.length){const n=t(e.children);n.length&&(r.children=n)}return r}):[]},exports.formatMoney=(t,e,r,n=!1)=>{if(null==t||isNaN(Number(t)))return n?"0":"";let i=Number(t);if(0===i&&!n)return"";void 0!==r&&"number"==typeof r&&r>=0?i=i.toFixed(r):void 0!==e&&"number"==typeof e&&e>=0&&(i=i.toFixed(e));const s=i.toString().split("."),a=s[0],o=s[1]||"",u=a.replace(/\B(?=(\d{3})+(?!\d))/g,",");return o?`${u}.${o}`:u},exports.formatToFirstDay=function(t){if(!t)return"";const[e,r]=t.split("-");return`${e}-${r}-01`},exports.generate32BitRandomString=function(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let e="";for(let r=0;r<32;r++)if("undefined"!=typeof crypto&&crypto.getRandomValues){const r=new Uint8Array(1);crypto.getRandomValues(r);const n=r[0]%62;e+=t.charAt(n)}else{const r=Math.floor(62*Math.random());e+=t.charAt(r)}return e},exports.generateCodeExample=function(t,e){return e.slice(0,t).map((t,e)=>t<=1?"1":2===t?0===e?"11":"01":0===e?"1"+"0".repeat(t-2)+"1":"0"+"0".repeat(t-2)+"1").join("-")},exports.generateTimestamp=function(t=13){if(10===t)return Math.floor(Date.now()/1e3);if(13===t)return Date.now();throw new Error("只支持10位或13位时间戳")},exports.getCompanyAccountPeriod=function(){return localStorage.getItem(n.COMPANYACCOUNTPERIOD)},exports.getCompanyAccountPeriodNow=function(){return localStorage.getItem(n.COMPANYACCOUNTPERIODNOW)},exports.getCompanyAuditStatusMsg=function(){return localStorage.getItem(n.COMPANYAUDITSTATUSMSG)},exports.getCompanyAuditStatusMsgNow=function(){return localStorage.getItem(n.COMPANYAUDITSTATUSMSGNOW)},exports.getCompanyCode=function(){return localStorage.getItem(n.COMPANYCODE)},exports.getCompanyName=function(){return localStorage.getItem(n.COMPANYNAME)},exports.getCompanyType=function(){return localStorage.getItem(n.COMPANYTYPE)},exports.getCurrentMonth=()=>{const t=new Date;return`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,"0")}`},exports.getDefaultDateTimeRange=(t="08:00",e="18:00")=>{const r=new Date,n=r.getFullYear(),i=String(r.getMonth()+1).padStart(2,"0"),s=String(r.getDate()).padStart(2,"0");return[`${n}-${i}-${s} ${t}`,`${n}-${i}-${s} ${e}`]},exports.getFileType=function(t){if(!t||"string"!=typeof t)return null;const e=t.lastIndexOf(".");return e>0?t.slice(e+1).toLowerCase():null},exports.getFileTypeFromUrlRegex=t=>{if(!t||"string"!=typeof t)return"unknown";const e=t.split("?")[0].match(/\.([a-zA-Z0-9]+)$/);if(!e)return"unknown";const r=e[1].toLowerCase();return/^pdf$/i.test(r)?"pdf":/^(jpg|jpeg|png|gif|bmp|webp|svg|ico|tiff|tif|heic|heif)$/i.test(r)?"image":/^(xlsx|xls)$/i.test(r)?"xlsx":"unknown"},exports.getFinancialStandardDictType=function(){return localStorage.getItem(n.FINANCIALSTANDARDDICTTYPE)},exports.getFormattedDateTime=function(){const t=new Date;return`${t.getFullYear()}${String(t.getMonth()+1).padStart(2,"0")}${String(t.getDate()).padStart(2,"0")}${String(t.getHours()).padStart(2,"0")}${String(t.getMinutes()).padStart(2,"0")}${String(t.getSeconds()).padStart(2,"0")}`},exports.getGlobalProperties=function(){const t=e.getCurrentInstance();return t?t.appContext.config.globalProperties:(console.error("请在 setup 中使用 getGlobalProperties"),{})},exports.getLevelPadding=(t,e)=>((t??1)-1)*e+"px",exports.getMinValueItem=(t,e="key")=>{if(!t||0===t.length)return"";const r=t.reduce((t,e)=>e.value<t.value?e:t,t[0]);return r[e]},exports.getPrevMonth=function(t){const[e,r]=t.split("-").map(Number),n=new Date(e,r-1,1);return n.setMonth(n.getMonth()-1),`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}`},exports.getToken=i,exports.getUserInfo=function(){return localStorage.getItem(n.USER_INFO)},exports.handleBeforeUpload=(e,r=10)=>{const n=1024*r*1024;return e.size>n?(t.ElMessage.error(`文件 ${e.name} 太大,最大支持${r}MB`),!1):(console.log("准备上传文件:",e),!0)},exports.handleSubKeydown=(t,e)=>{["Backspace","Delete","Tab","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(t.key)||t.ctrlKey||t.metaKey||/^[0-9]$/.test(t.key)||"."!==t.key&&"-"!==t.key&&t.preventDefault()},exports.handleViewFile=function(t){if("string"!=typeof t){const e="文件地址必须是字符串,当前传入类型:"+typeof t;return console.error("[handleViewFile] 错误:",e),{success:!1,error:e}}if(!t.trim()){const t="文件地址不能为空或仅空格";return console.error("[handleViewFile] 错误:",t),{success:!1,error:t}}let e;try{e=new URL(t)}catch(e){const r=`无效的URL格式:${t}(请检查是否包含特殊字符或缺失协议)`;return console.error("[handleViewFile] URL解析错误:",e,"| 地址:",t),{success:!1,error:r}}if(!["http:","https:"].includes(e.protocol)){const t=`仅支持HTTP/HTTPS协议,当前协议:${e.protocol}`;return console.error("[handleViewFile] 协议错误:",t),{success:!1,error:t}}const r=e.pathname,n=r.lastIndexOf(".");if(-1===n){const e=`文件地址不含后缀名:${t}(需是jpg/png/pdf)`;return console.error("[handleViewFile] 格式错误:",e),{success:!1,error:e}}const i=r.slice(n+1).toLowerCase(),s=["jpg","jpeg","png","pdf"];if(!s.includes(i)){const t=`不支持的文件格式:.${i},仅支持${s.join("、")}`;return console.error("[handleViewFile] 格式错误:",t),{success:!1,error:t}}try{if(!window.open(t,"_blank","noopener,noreferrer,width=1000,height=800")){const t="文件窗口被浏览器拦截,请允许弹窗后重试(地址栏右侧查看拦截提示)";return console.warn("[handleViewFile] 弹窗被拦截:",t),{success:!1,error:t}}return console.log("[handleViewFile] 成功:文件已在新窗口打开,地址:",t),{success:!0,message:"文件已在新窗口打开"}}catch(e){const r=`打开文件失败:${e.message}(可能是浏览器安全设置或网络问题)`;return console.error("[handleViewFile] 打开失败:",e,"| 地址:",t),{success:!1,error:r}}},exports.hasNonZeroValue=fe,exports.isAccountingEnabled=t=>!0===t||1===t||"1"===t,exports.isBeforeToday=t=>{const e=new Date(t);e.setHours(0,0,0,0);const r=new Date;return r.setHours(0,0,0,0),e.getTime()<r.getTime()},exports.isCnyCurrency=t=>"CNY"===String(t||"").trim().toUpperCase(),exports.isDateInRange=(t,e,r)=>{const n=new Date(t).setHours(0,0,0,0),i=new Date(e).setHours(0,0,0,0),s=new Date(r).setHours(0,0,0,0);return n>=i&&n<=s},exports.isTaskContinue=(t,e,r)=>{const n=new Date(t).setHours(0,0,0,0),i=new Date(e).setHours(0,0,0,0),s=new Date(r).setHours(0,0,0,0);return n>i&&n<=s},exports.isTaskStart=(t,e)=>new Date(t).setHours(0,0,0,0)===new Date(e).setHours(0,0,0,0),exports.openNewWindow=t=>{const e=document.createElement("a");e.href=t,e.target="_blank",e.rel="noopener noreferrer",document.body.appendChild(e),e.click(),document.body.removeChild(e)},exports.parseNum=oe,exports.percentToNumber=function(t){const e=String(t).replace(/%/g,""),r=Number(e);return isNaN(r)?0:r},exports.periodDisabledDate=t=>{const e=new Date,r=e.getFullYear(),n=e.getMonth(),i=t.getFullYear(),s=t.getMonth();if(0===n){return!(i===r-1&&11===s||i===r)}return i!==r},exports.periodDisabledDateAllAfter=t=>{const e=new Date,r=e.getFullYear(),n=e.getMonth(),i=t.getFullYear(),s=t.getMonth();return i>r||i===r&&s>=n},exports.phoneRegex=/^1[3-9]\d{9}$/,exports.positionMap=(t,e,r,n)=>{const i=t.querySelector(e);i&&i.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{r.value=""},n)},exports.postExportFile=async(e,r,n,s)=>{try{0;const e=await fetch(r,{method:"post",headers:{token:i(),"Content-Type":"application/json"},body:JSON.stringify(s)});if(!e.ok)return t.ElMessage.error("请求失败"),!1;const a=await e.blob();if(a.type&&a.type.includes("application/json")){const e=await a.text();try{const r=JSON.parse(e);if(r&&r.msg)return t.ElMessage.error(r.msg),401===r.code&&setTimeout(()=>{window.location.href="/login?redirect="+encodeURIComponent(window.location.href)},2e3),!1}catch{console.warn("解析JSON失败")}}const o=e.headers.get("content-disposition");let u=n;if(o){const t=o.match(/filename\*=UTF-8''([^;]+)/i);if(t&&t[1])u=decodeURIComponent(t[1]);else{const t=o.match(/filename=(?:"([^"]+)"|([^;]+))/i);if(t){let e=t[1]||t[2];try{u=decodeURIComponent(e)}catch(t){u=e}}}}const c=window.URL.createObjectURL(a),h=document.createElement("a");return h.style.display="none",h.href=c,h.download=u,document.body.appendChild(h),h.click(),t.ElMessage.success("下载成功"),setTimeout(()=>{window.URL.revokeObjectURL(c),document.body.removeChild(h)},1e3),!0}catch(e){return console.error("下载文件失败:",e),t.ElMessage.error("下载失败"),!1}},exports.processCode=ae,exports.processList=ue,exports.processVoucherArrayEnhanced=function(t,e={}){const{emptyObject:r={},preserveOriginal:n=!1}=e;if(!Array.isArray(t))throw new Error("参数必须是数组");const i=[];return t.forEach((t,e)=>{if(!t||"object"!=typeof t)return;const s=t.voucherList;if(!Array.isArray(s)){const s=n?{...t}:{...t,_metadata:{originalIndex:e,isPadded:!0,originalLength:0}};return s.voucherList=[{...r},{...r},{...r},{...r},{...r}],s.page=1,s.pageCount=1,void i.push(s)}const a=Math.ceil(s.length/5);if(s.length>5)for(let o=0;o<s.length;o+=5){const u=s.slice(o,o+5),c=Math.floor(o/5)+1,h=[...u];for(;h.length<5;)h.push({...r});const l=n?{...t}:{...t,_metadata:{originalIndex:e,isSplit:o>0,chunkIndex:Math.floor(o/5),totalChunks:a}};l.voucherList=h,l.page=c,l.pageCount=a,i.push(l)}else if(s.length<5){const a=s.map(t=>({...t}));for(;a.length<5;)a.push({...r});const o=n?{...t}:{...t,_metadata:{originalIndex:e,isPadded:!0,originalLength:s.length}};o.voucherList=a,o.page=1,o.pageCount=1,i.push(o)}else{const r=n?{...t}:{...t,_metadata:{originalIndex:e,isOriginal:!0}};r.page=1,r.pageCount=1,i.push(r)}}),i},exports.publicKey="MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAL/EwnX/3BaH5gJXJiv7qKhuKKol5JSgayGyYMWDdRO8KKAtOFrniXp/iAGGoV6Y0GF9Z8iY3xHOiU3rHeSJ3G6wFDY87Qr4k2m48/6YRX+s/iMGJ5j5obdCFiDkFUzoR/EHTqC6PM3h6bhDNNIXQpqVbQrg28tW5Y57+yxqRrUjAgMBAAECgYAHlgB9S3xI1eJm6Eylw8RFuWnZZTtYF8p1IEnMtmkMuU5AG9nVWsBo/J+EM++xPslLefr/h/CXEz0CPJFHp551HucLlRA7EOXSPfwLGODlz5rMnXyM8jD3ZMACXsRLvLEiNt+0nP+G7M+Dxuf6SLkmvqYa/NdJACb5/16E2P+pNQJBAO0hgUcKYfvJSXVolonVQNpR8Hu/4LH+5bBVLef+D6JNP6x0hr9U/ce+nI7I5wIPbBgFknvCWfVbgz16tPZhmC0CQQDPBzLArfdUfMs2h/3cxQAeZnX0ybt3F6CR3K9dliDJRn1p3ovdK0OmyggpKfx94KH+VRcJSaWTHLeFvub8KgSPAkEAhUWcY7HZKeqSB5OVb7fT8B+3OcW4YjFxI+5rk4Q9gylJTQJcrPH2g6mEUddlxcmnJcUT88xiRLx/ATGSvRpSrQJAJSfTkgUm6IDlL8pEY4TvuoUFEoPKI1uYM9V5m8A/7h+6jm+khnMnVx3XTRv99tGEAVNgKQiQsNBsl5JlfkhEPQJBAJ2nPXpGolp/R5usP+LP314snwj93G54+HaZnuOoIB0ApusErnpWCSHXbQtvXKo1n6SE3ccp010CPJBnOm/LRaA=",exports.recalculateCashFlowData=t=>{if(!t||!t.length)return;t.forEach(t=>{1==t.draftCalType&&(t.currentAmount=0)});let e=null;t.forEach(t=>{if(1==t.draftCalType)e=t;else if((2==t.draftCalType||3==t.draftCalType)&&e){const r=Number(t.currentAmount)||0,n=-1===t.calDirection?-1:1;e.currentAmount=(e.currentAmount||0)+r*n}})},exports.removeCompanyAccountPeriod=function(){localStorage.removeItem(n.COMPANYACCOUNTPERIOD)},exports.removeCompanyAccountPeriodNow=function(){localStorage.removeItem(n.COMPANYACCOUNTPERIODNOW)},exports.removeCompanyAuditStatusMsg=function(){localStorage.removeItem(n.COMPANYAUDITSTATUSMSG)},exports.removeCompanyAuditStatusMsgNow=function(){localStorage.removeItem(n.COMPANYAUDITSTATUSMSGNOW)},exports.removeCompanyCode=function(){localStorage.removeItem(n.COMPANYCODE)},exports.removeCompanyName=function(){localStorage.removeItem(n.COMPANYNAME)},exports.removeCompanyType=function(){localStorage.removeItem(n.COMPANYTYPE)},exports.removeFinancialStandardDictType=function(){localStorage.removeItem(n.FINANCIALSTANDARDDICTTYPE)},exports.removeOperation=(t,e)=>{const r=t.operations.indexOf(e);r>-1&&t.operations.splice(r,1)},exports.removeToken=function(){localStorage.removeItem(n.TOKEN)},exports.removeUserInfo=function(){localStorage.removeItem(n.USER_INFO)},exports.roundMoneyDecimal=(t,e)=>t.toDecimalPlaces(e),exports.roundSubDecimal=(t,e)=>t.toDecimalPlaces(e),exports.rsaEncrypt=function(t,e){if(!t||!e)return"";const n=r.pki.publicKeyFromPem(`-----BEGIN PUBLIC KEY-----\n${e.replace(/\s/g,"").match(/.{1,64}/g).join("\n")}\n-----END PUBLIC KEY-----`),i=(new TextEncoder).encode(t);let s="";for(let t=0;t<i.length;t++)s+=String.fromCharCode(i[t]);const a=n.encrypt(s,"RSA-OAEP",{md:r.md.sha256.create(),mgf1:{md:r.md.sha1.create()}});return r.util.encode64(a)},exports.scrollToId=function(t,e=0,r=500){if("string"!=typeof t||!t.trim())return console.error("[scrollToId] 错误:id必须是非空字符串"),!1;const n=document.getElementById(t);if(!n)return console.error(`[scrollToId] 错误:未找到ID为"${t}"的元素`),!1;const i=n.getBoundingClientRect().top+window.pageYOffset,s=window.pageYOffset,a=i-s-e;let o=null;return requestAnimationFrame(function t(e){null===o&&(o=e);const n=e-o,i=function(t,e,r,n){return t/=n/2,t<1?r/2*t*t+e:(t--,-r/2*(t*(t-2)-1)+e)}(n,s,a,r);window.scrollTo(0,i),n<r&&requestAnimationFrame(t)}),!0},exports.setCompanyAccountPeriod=function(t){localStorage.setItem(n.COMPANYACCOUNTPERIOD,t)},exports.setCompanyAccountPeriodNow=function(t){localStorage.setItem(n.COMPANYACCOUNTPERIODNOW,t)},exports.setCompanyAuditStatusMsg=function(t){localStorage.setItem(n.COMPANYAUDITSTATUSMSG,t)},exports.setCompanyAuditStatusMsgNow=function(t){localStorage.setItem(n.COMPANYAUDITSTATUSMSGNOW,t)},exports.setCompanyCode=function(t){localStorage.setItem(n.COMPANYCODE,t)},exports.setCompanyName=function(t){localStorage.setItem(n.COMPANYNAME,t)},exports.setCompanyType=function(t){localStorage.setItem(n.COMPANYTYPE,t)},exports.setFinancialStandardDictType=function(t){localStorage.setItem(n.FINANCIALSTANDARDDICTTYPE,t)},exports.setToken=function(t){localStorage.setItem(n.TOKEN,t)},exports.setUserInfo=function(t){localStorage.setItem(n.USER_INFO,t)},exports.signWithSHA256RSA=function(t,e){console.log(t,e);const r=new te.crypto.Signature({alg:"SHA256withRSA",prov:"cryptojs/jsrsa"});return r.init(e),r.updateString(t),r.sign()},exports.svgConst={viewBox:"0 0 1536 1024",version:"1.1",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em"},exports.svgSjPath={d:"M73.75498878 312.79929781L689.59344939 960.31767875A98.63975344 98.63975344 0 0 0 762.55326659 991.9976a98.63975344 98.63975344 0 0 0 72.71981813-31.67992125L1451.3515444 312.79929781a106.55973375 106.55973375 0 0 0 23.99994-114.23971406 113.75971594 113.75971594 0 0 0-96.95975719-70.55982375l-1231.19692219 0a113.27971688 113.27971688 0 0 0-97.19975718 70.31982375 106.55973375 106.55973375 0 0 0 23.75994094 114.47971406z",fill:"#001533"},exports.toVoucherDecimal=(t,e="数值")=>{const r=String(t??"").trim();if(""===r)return new Yr(0);if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(r))throw new Error(`${e}请输入有效数字`);const n=new Yr(r);if(!n.isFinite())throw new Error(`${e}请输入有效数字`);return n},exports.treeHas=he,exports.truncateToTwoDecimals=function(t,e){if(!isFinite(t)||0===t)return t.toFixed(2);const r=Math.trunc(100*t)/100;return Object.is(r,-0)?"-0.00":r.toFixed(e)},exports.unclosablePaths=["/accounting/accounting-voucher-detail","/accounting/accounting-voucher-add","/accounting/accounting-voucher-red"],exports.useGlobalDragUpload=function(t={}){const{allowedExtensions:r=[],onDropFiles:n,enabled:i=e.ref(!0)}=t,s=e.ref(!1);let a=0;const o=t=>{e.unref(i)&&(t.preventDefault(),a++,1===a&&(s.value=!0))},u=t=>{e.unref(i)&&(t.preventDefault(),a--,0===a&&(s.value=!1))},c=t=>{e.unref(i)&&t.preventDefault()},h=t=>{if(!e.unref(i))return;t.preventDefault(),a=0,s.value=!1;const o=Array.from(t.dataTransfer.files);if(0===o.length)return;const u=[],c=[];o.forEach(t=>{const e="."+t.name.split(".").pop().toLowerCase();0===r.length||r.includes(e)?u.push(t):c.push(t)}),n&&n(u,c)};return e.onMounted(()=>{window.addEventListener("dragenter",o),window.addEventListener("dragleave",u),window.addEventListener("dragover",c),window.addEventListener("drop",h)}),e.onBeforeUnmount(()=>{window.removeEventListener("dragenter",o),window.removeEventListener("dragleave",u),window.removeEventListener("dragover",c),window.removeEventListener("drop",h)}),{isGlobalDragging:s}},exports.useTreeExpand=function(t,r={}){const{selfKey:n="itemCode",parentKey:i="parentItem",hasChildKey:s="hasChild",defaultExpanded:a=!0}=r,o=e.computed(()=>{const e=void 0!==t.value?t.value:t;return Array.isArray(e)?e:[]});e.computed(()=>{const t=new Map;for(const e of o.value){const r=e[i];r&&(t.has(r)||t.set(r,[]),t.get(r).push(e))}return t});const u=e.computed(()=>{const t=new Map;for(const e of o.value){const r=[],s=e[n];let a=e[i];const u=new Set;for(;a&&!u.has(a)&&a!==s;){u.add(a),r.push(a);const t=o.value.find(t=>t[n]===a);if(!t)break;a=t[i]}t.set(s,r)}return t}),c=e.ref(new Set);e.watch(()=>o.value,()=>(()=>{const t=new Set;if(a)for(const e of o.value)e[s]&&t.add(e[n]);c.value=t})(),{immediate:!0});const h=t=>{const e=u.value.get(t[n]);if(!e||0===e.length)return!0;for(const t of e){const e=o.value.find(e=>e[n]===t);if(e&&e[s]&&!c.value.has(t))return!1}return!0},l=e.computed(()=>o.value.filter(h));return{expandedKeys:c,toggle:t=>{const e=new Set(c.value);e.has(t)?e.delete(t):e.add(t),c.value=e},expandAll:()=>{const t=new Set;for(const e of o.value)e[s]&&t.add(e[n]);c.value=t},collapseAll:()=>{c.value=new Set},visibleList:l}},exports.version="0.3.10",exports.whiteList=["/login","/404","/403","/register","/pay","/file-views","/iitc","/users/info"];
44
35
  //# sourceMappingURL=jiezhangxin-utils.cjs.js.map