@cloudbase/js-sdk
Version:
cloudbase javascript sdk
2 lines • 247 kB
JavaScript
/*! For license information please see index.esm.js.LICENSE.txt */
import*as t from"@cloudbase/adapter-interface";import*as e from"jwt-decode";import*as r from"@cloudbase/adapter-wx_mp";var n={171:(t,e,r)=>{var n;if(r.r(e),r.d(e,{getEncryptInfo:()=>q}),!globalThis.IS_MP_BUILD){var i="undefined"!=typeof globalThis?globalThis.navigator:window.globalThis;function B(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function j(t,e){return t&e}function V(t,e){return t|e}function W(t,e){return t^e}function F(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 G(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function K(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=o.charAt(r>>6)+o.charAt(63&r);for(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=o.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=o.charAt(r>>2)+o.charAt((3&r)<<4));(3&n.length)>0;)n+="=";return n}function Y(t){var e,r="",n=0,i=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e){var s=o.indexOf(t.charAt(e));s<0||(0==n?(r+=B(s>>2),i=3&s,n=1):1==n?(r+=B(i<<2|s>>4),i=15&s,n=2):2==n?(r+=B(i),r+=B(s>>2),i=3&s,n=3):(r+=B(i<<2|s>>4),r+=B(15&s),n=0))}return 1==n&&(r+=B(i<<2)),r}var s,a,u={decode:function(t){var e;if(void 0===s){var r="0123456789ABCDEF";for(s={},e=0;e<16;++e)s[r.charAt(e)]=e;for(r=r.toLowerCase(),e=10;e<16;++e)s[r.charAt(e)]=e;for(e=0;e<8;++e)s[" \f\n\r\t \u2028\u2029".charAt(e)]=-1}var n=[],i=0,o=0;for(e=0;e<t.length;++e){var a=t.charAt(e);if("="==a)break;if(-1!=(a=s[a])){if(void 0===a)throw new Error("Illegal character at offset "+e);i|=a,++o>=2?(n[n.length]=i,i=0,o=0):i<<=4}}if(o)throw new Error("Hex encoding incomplete: 4 bits missing");return n}},c={decode:function(t){var e;if(void 0===a){for(a=Object.create(null),e=0;e<64;++e)a["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)]=e;for(e=0;e<9;++e)a["= \f\n\r\t \u2028\u2029".charAt(e)]=-1}var r=[],n=0,i=0;for(e=0;e<t.length;++e){var o=t.charAt(e);if("="==o)break;if(-1!=(o=a[o])){if(void 0===o)throw new Error("Illegal character at offset "+e);n|=o,++i>=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,i=0):n<<=6}}switch(i){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=c.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new Error("RegExp out of sync");t=e[2]}return c.decode(t)}},h=1e13;class z{constructor(t){this.buf=[+t||0]}mulAdd(t,e){var r,n,i=this.buf,o=i.length;for(r=0;r<o;++r)(n=i[r]*t+e)<h?e=0:n-=(e=0|n/h)*h,i[r]=n;e>0&&(i[r]=e)}sub(t){var e,r,n=this.buf,i=n.length;for(e=0;e<i;++e)(r=n[e]-t)<0?(r+=h,t=1):t=0,n[e]=r;for(;0===n[n.length-1];)n.pop()}toString(t){if(10!=(t||10))throw new Error("only base 10 is supported");for(var e=this.buf,r=e[e.length-1].toString(),n=e.length-2;n>=0;--n)r+=(h+e[n]).toString().substring(1);return r}valueOf(){for(var t=this.buf,e=0,r=t.length-1;r>=0;--r)e=e*h+t[r];return e}simplify(){var t=this.buf;return 1==t.length?t[0]:this}}var l,d=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,f=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function Q(t,e){return t.length>e&&(t=t.substring(0,e)+"…"),t}class J{constructor(t,e){this.hexDigits="0123456789ABCDEF",t instanceof J?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=e)}get(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new Error("Requesting byte offset "+t+" on a stream of length "+this.enc.length);return"string"==typeof this.enc?this.enc.charCodeAt(t):this.enc[t]}hexByte(t){return this.hexDigits.charAt(t>>4&15)+this.hexDigits.charAt(15&t)}hexDump(t,e,r){for(var n="",i=t;i<e;++i)if(n+=this.hexByte(this.get(i)),!0!==r)switch(15&i){case 7:n+=" ";break;case 15:n+="\n";break;default:n+=" "}return n}isASCII(t,e){for(var r=t;r<e;++r){var n=this.get(r);if(n<32||n>176)return!1}return!0}parseStringISO(t,e){for(var r="",n=t;n<e;++n)r+=String.fromCharCode(this.get(n));return r}parseStringUTF(t,e){for(var r="",n=t;n<e;){var i=this.get(n++);r+=i<128?String.fromCharCode(i):i>191&&i<224?String.fromCharCode((31&i)<<6|63&this.get(n++)):String.fromCharCode((15&i)<<12|(63&this.get(n++))<<6|63&this.get(n++))}return r}parseStringBMP(t,e){for(var r,n,i="",o=t;o<e;)r=this.get(o++),n=this.get(o++),i+=String.fromCharCode(r<<8|n);return i}parseTime(t,e,r){var n=this.parseStringISO(t,e),i=(r?d:f).exec(n);return i?(r&&(i[1]=+i[1],i[1]+=+i[1]<70?2e3:1900),n=i[1]+"-"+i[2]+"-"+i[3]+" "+i[4],i[5]&&(n+=":"+i[5],i[6]&&(n+=":"+i[6],i[7]&&(n+="."+i[7]))),i[8]&&(n+=" UTC","Z"!=i[8]&&(n+=i[8],i[9]&&(n+=":"+i[9]))),n):"Unrecognized time: "+n}parseInteger(t,e){for(var r,n=this.get(t),i=n>127,o=i?255:0,s="";n==o&&++t<e;)n=this.get(t);if(0===(r=e-t))return i?-1:0;if(r>4){for(s=n,r<<=3;!(128&(+s^o));)s=+s<<1,--r;s="("+r+" bit)\n"}i&&(n-=256);for(var a=new z(n),u=t+1;u<e;++u)a.mulAdd(256,this.get(u));return s+a.toString()}parseBitString(t,e,r){for(var n=this.get(t),i="("+((e-t-1<<3)-n)+" bit)\n",o="",s=t+1;s<e;++s){for(var a=this.get(s),u=s==e-1?n:0,c=7;c>=u;--c)o+=a>>c&1?"1":"0";if(o.length>r)return i+Q(o,r)}return i+o}parseOctetString(t,e,r){if(this.isASCII(t,e))return Q(this.parseStringISO(t,e),r);var n=e-t,i="("+n+" byte)\n";n>(r/=2)&&(e=t+r);for(var o=t;o<e;++o)i+=this.hexByte(this.get(o));return n>r&&(i+="…"),i}parseOID(t,e,r){for(var n="",i=new z,o=0,s=t;s<e;++s){var a=this.get(s);if(i.mulAdd(128,127&a),o+=7,!(128&a)){if(""===n)if((i=i.simplify())instanceof z)i.sub(80),n="2."+i.toString();else{var u=i<80?i<40?0:1:2;n=u+"."+(i-40*u)}else n+="."+i.toString();if(n.length>r)return Q(n,r);i=new z,o=0}}return o>0&&(n+=".incomplete"),n}}class Z{constructor(t,e,r,n,i){if(!(n instanceof X))throw new Error("Invalid tag value.");this.stream=t,this.header=e,this.length=r,this.tag=n,this.sub=i}typeName(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}}content(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.posContent(),r=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseInteger(e,e+r);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(e,e+r,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(e,e+r,t);case 6:return this.stream.parseOID(e,e+r,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return Q(this.stream.parseStringUTF(e,e+r),t);case 18:case 19:case 20:case 21:case 22:case 26:return Q(this.stream.parseStringISO(e,e+r),t);case 30:return Q(this.stream.parseStringBMP(e,e+r),t);case 23:case 24:return this.stream.parseTime(e,e+r,23==this.tag.tagNumber)}return null}toString(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"}toPrettyString(t){void 0===t&&(t="");var e=t+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagConstructed?e+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var r=0,n=this.sub.length;r<n;++r)e+=this.sub[r].toPrettyString(t)}return e}posStart(){return this.stream.pos}posContent(){return this.stream.pos+this.header}posEnd(){return this.stream.pos+this.header+Math.abs(this.length)}toHexString(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)}static decodeLength(t){var e=t.get(),r=127&e;if(r==e)return r;if(r>6)throw new Error("Length over 48 bits not supported at position "+(t.pos-1));if(0===r)return null;e=0;for(var n=0;n<r;++n)e=256*e+t.get();return e}getHexStringValue(){var t=this.toHexString(),e=2*this.header,r=2*this.length;return t.substr(e,r)}static decode(t){var e;e=t instanceof J?t:new J(t,0);var r=new J(e),n=new X(e),i=Z.decodeLength(e),o=e.pos,s=o-r.pos,a=null,u=function(){var t=[];if(null!==i){for(var r=o+i;e.pos<r;)t[t.length]=Z.decode(e);if(e.pos!=r)throw new Error("Content size is not correct for container starting at offset "+o)}else try{for(;;){var n=Z.decode(e);if(n.tag.isEOC())break;t[t.length]=n}i=o-e.pos}catch(t){throw new Error("Exception while decoding undefined length content: "+t)}return t};if(n.tagConstructed)a=u();else if(n.isUniversal()&&(3==n.tagNumber||4==n.tagNumber))try{if(3==n.tagNumber&&0!=e.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");a=u();for(var c=0;c<a.length;++c)if(a[c].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(t){a=null}if(null===a){if(null===i)throw new Error("We can't skip over an invalid tag with undefined length at offset "+o);e.pos=o+Math.abs(i)}return new Z(r,s,i,n,a)}}class X{constructor(t){var e=t.get();if(this.tagClass=e>>6,this.tagConstructed=!!(32&e),this.tagNumber=31&e,31==this.tagNumber){var r=new z;do{e=t.get(),r.mulAdd(128,127&e)}while(128&e);this.tagNumber=r.simplify()}}isUniversal(){return 0===this.tagClass}isEOC(){return 0===this.tagClass&&0===this.tagNumber}}var p=[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],v=(1<<26)/p[p.length-1];class ${constructor(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))}toString(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,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(i=!0,o=B(r));s>=0;)a<e?(r=(this[s]&(1<<a)-1)<<e-a,r|=this[--s]>>(a+=this.DB-e)):(r=this[s]>>(a-=e)&n,a<=0&&(a+=this.DB,--s)),r>0&&(i=!0),i&&(o+=B(r));return i?o:"0"}negate(){var t=tt();return $.ZERO.subTo(this,t),t}abs(){return this.s<0?this.negate():this}compareTo(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}bitLength(){return this.t<=0?0:this.DB*(this.t-1)+at(this[this.t-1]^this.s&this.DM)}mod(t){var e=tt();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo($.ZERO)>0&&t.subTo(e,e),e}modPowInt(t,e){var r;return r=t<256||e.isEven()?new m(e):new y(e),this.exp(t,r)}clone(){var t=tt();return this.copyTo(t),t}intValue(){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]}byteValue(){return 0==this.t?this.s:this[0]<<24>>24}shortValue(){return 0==this.t?this.s:this[0]<<16>>16}signum(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}toByteArray(){var t=this.t,e=[];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}equals(t){return 0==this.compareTo(t)}min(t){return this.compareTo(t)<0?this:t}max(t){return this.compareTo(t)>0?this:t}and(t){var e=tt();return this.bitwiseTo(t,j,e),e}or(t){var e=tt();return this.bitwiseTo(t,V,e),e}xor(t){var e=tt();return this.bitwiseTo(t,W,e),e}andNot(t){var e=tt();return this.bitwiseTo(t,F,e),e}not(){for(var t=tt(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}shiftLeft(t){var e=tt();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}shiftRight(t){var e=tt();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}getLowestSetBit(){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}bitCount(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=G(this[r]^e);return t}testBit(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:!!(this[e]&1<<t%this.DB)}setBit(t){return this.changeBit(t,V)}clearBit(t){return this.changeBit(t,F)}flipBit(t){return this.changeBit(t,W)}add(t){var e=tt();return this.addTo(t,e),e}subtract(t){var e=tt();return this.subTo(t,e),e}multiply(t){var e=tt();return this.multiplyTo(t,e),e}divide(t){var e=tt();return this.divRemTo(t,e,null),e}remainder(t){var e=tt();return this.divRemTo(t,null,e),e}divideAndRemainder(t){var e=tt(),r=tt();return this.divRemTo(t,e,r),[e,r]}modPow(t,e){var r,n,i=t.bitLength(),o=st(1);if(i<=0)return o;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new m(e):e.isEven()?new _(e):new y(e);var s=[],a=3,u=r-1,c=(1<<r)-1;if(s[1]=n.convert(this),r>1){var h=tt();for(n.sqrTo(s[1],h);a<=c;)s[a]=tt(),n.mulTo(h,s[a-2],s[a]),a+=2}var l,d,f=t.t-1,p=!0,v=tt();for(i=at(t[f])-1;f>=0;){for(i>=u?l=t[f]>>i-u&c:(l=(t[f]&(1<<i+1)-1)<<u-i,f>0&&(l|=t[f-1]>>this.DB+i-u)),a=r;!(1&l);)l>>=1,--a;if((i-=a)<0&&(i+=this.DB,--f),p)s[l].copyTo(o),p=!1;else{for(;a>1;)n.sqrTo(o,v),n.sqrTo(v,o),a-=2;a>0?n.sqrTo(o,v):(d=o,o=v,v=d),n.mulTo(v,s[l],o)}for(;f>=0&&!(t[f]&1<<i);)n.sqrTo(o,v),d=o,o=v,v=d,--i<0&&(i=this.DB-1,--f)}return n.revert(o)}modInverse(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return $.ZERO;for(var r=t.clone(),n=this.clone(),i=st(1),o=st(0),s=st(0),a=st(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(i.isEven()&&o.isEven()||(i.addTo(this,i),o.subTo(t,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;n.isEven();)n.rShiftTo(1,n),e?(s.isEven()&&a.isEven()||(s.addTo(this,s),a.subTo(t,a)),s.rShiftTo(1,s)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(s,i),o.subTo(a,o)):(n.subTo(r,n),e&&s.subTo(i,s),a.subTo(o,a))}return 0!=n.compareTo($.ONE)?$.ZERO:a.compareTo(t)>=0?a.subtract(t):a.signum()<0?(a.addTo(t,a),a.signum()<0?a.add(t):a):a}pow(t){return this.exp(t,new g)}gcd(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(),o=r.getLowestSetBit();if(o<0)return e;for(i<o&&(o=i),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,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 o>0&&r.lShiftTo(o,r),r}isProbablePrime(t){var e,r=this.abs();if(1==r.t&&r[0]<=p[p.length-1]){for(e=0;e<p.length;++e)if(r[0]==p[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<p.length;){for(var n=p[e],i=e+1;i<p.length&&n<v;)n*=p[i++];for(n=r.modInt(n);e<i;)if(n%p[e++]==0)return!1}return r.millerRabin(t)}copyTo(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}fromInt(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}fromString(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,o=0;--n>=0;){var s=8==r?255&+t[n]:ot(t,n);s<0?"-"==t.charAt(n)&&(i=!0):(i=!1,0==o?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,(o+=r)>=this.DB&&(o-=this.DB))}8==r&&128&+t[0]&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),i&&$.ZERO.subTo(this,this)}clamp(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}dlShiftTo(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}drShiftTo(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}lShiftTo(t,e){for(var r=t%this.DB,n=this.DB-r,i=(1<<n)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,a=this.t-1;a>=0;--a)e[a+o+1]=this[a]>>n|s,s=(this[a]&i)<<r;for(a=o-1;a>=0;--a)e[a]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()}rShiftTo(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,o=(1<<n)-1;e[0]=this[r]>>n;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<i,e[s-r]=this[s]>>n;n>0&&(e[this.t-r-1]|=(this.s&o)<<i),e.t=this.t-r,e.clamp()}}subTo(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()}multiplyTo(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&&$.ZERO.subTo(e,e)}squareTo(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()}divRemTo(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=tt());var o=tt(),s=this.s,a=t.s,u=this.DB-at(n[n.t-1]);u>0?(n.lShiftTo(u,o),i.lShiftTo(u,r)):(n.copyTo(o),i.copyTo(r));var c=o.t,h=o[c-1];if(0!=h){var l=h*(1<<this.F1)+(c>1?o[c-2]>>this.F2:0),d=this.FV/l,f=(1<<this.F1)/l,p=1<<this.F2,v=r.t,g=v-c,m=e??tt();for(o.dlShiftTo(g,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),$.ONE.dlShiftTo(c,m),m.subTo(o,o);o.t<c;)o[o.t++]=0;for(;--g>=0;){var y=r[--v]==h?this.DM:Math.floor(r[v]*d+(r[v-1]+p)*f);if((r[v]+=o.am(0,y,r,g,0,c))<y)for(o.dlShiftTo(g,m),r.subTo(m,r);r[v]<--y;)r.subTo(m,r)}null!=e&&(r.drShiftTo(c,e),s!=a&&$.ZERO.subTo(e,e)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&$.ZERO.subTo(r,r)}}}invDigit(){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}isEven(){return 0==(this.t>0?1&this[0]:this.s)}exp(t,e){if(t>4294967295||t<1)return $.ONE;var r=tt(),n=tt(),i=e.convert(this),o=at(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var s=r;r=n,n=s}return e.revert(r)}chunkSize(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}toRadix(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=st(r),i=tt(),o=tt(),s="";for(this.divRemTo(n,i,o);i.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,i.divRemTo(n,i,o);return o.intValue().toString(t)+s}fromRadix(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,o=0,s=0,a=0;a<t.length;++a){var u=ot(t,a);u<0?"-"==t.charAt(a)&&0==this.signum()&&(i=!0):(s=e*s+u,++o>=r&&(this.dMultiply(n),this.dAddOffset(s,0),o=0,s=0))}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),i&&$.ZERO.subTo(this,this)}fromNumber(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($.ONE.shiftLeft(t-1),V,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo($.ONE.shiftLeft(t-1),this);else{var n=[],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)}}bitwiseTo(t,e,r){var n,i,o=Math.min(t.t,this.t);for(n=0;n<o;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=o;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=o;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}changeBit(t,e){var r=$.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}addTo(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()}dMultiply(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}dAddOffset(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]}}multiplyLowerTo(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;for(var i=r.t-this.t;n<i;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);n<i;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()}multiplyUpperTo(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)}modInt(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}millerRabin(t){var e=this.subtract($.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>p.length&&(t=p.length);for(var i=tt(),o=0;o<t;++o){i.fromInt(p[Math.floor(Math.random()*p.length)]);var s=i.modPow(n,this);if(0!=s.compareTo($.ONE)&&0!=s.compareTo(e)){for(var a=1;a++<r&&0!=s.compareTo(e);)if(0==(s=s.modPowInt(2,this)).compareTo($.ONE))return!1;if(0!=s.compareTo(e))return!1}}return!0}square(){var t=tt();return this.squareTo(t),t}gcda(t,e){var r=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(r.compareTo(n)<0){var i=r;r=n,n=i}var o=r.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)e(r);else{o<s&&(s=o),s>0&&(r.rShiftTo(s,r),n.rShiftTo(s,n));var a=()=>{(o=r.getLowestSetBit())>0&&r.rShiftTo(o,r),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),r.compareTo(n)>=0?(r.subTo(n,r),r.rShiftTo(1,r)):(n.subTo(r,n),n.rShiftTo(1,n)),r.signum()>0?setTimeout(a,0):(s>0&&n.lShiftTo(s,n),setTimeout(function(){e(n)},0))};setTimeout(a,10)}}fromNumberAsync(t,e,r,n){if("number"==typeof e)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo($.ONE.shiftLeft(t-1),V,this),this.isEven()&&this.dAddOffset(1,0);var i=this,o=function(){i.dAddOffset(2,0),i.bitLength()>t&&i.subTo($.ONE.shiftLeft(t-1),i),i.isProbablePrime(e)?setTimeout(function(){n()},0):setTimeout(o,0)};setTimeout(o,0)}else{var s=[],a=7&t;s.length=1+(t>>3),e.nextBytes(s),a>0?s[0]&=(1<<a)-1:s[0]=0,this.fromString(s,256)}}}var g=function(){function t(){}return t.prototype.convert=function(t){return t},t.prototype.revert=function(t){return t},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},t.prototype.sqrTo=function(t,e){t.squareTo(e)},t}(),m=function(){function t(t){this.m=t}return t.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),y=function(){function t(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}return t.prototype.convert=function(t){var e=tt();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo($.ZERO)>0&&this.m.subTo(e,e),e},t.prototype.revert=function(t){var e=tt();return t.copyTo(e),this.reduce(e),e},t.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)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}(),_=function(){function t(t){this.m=t,this.r2=tt(),this.q3=tt(),$.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.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=tt();return t.copyTo(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.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)},t.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},t.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},t}();function tt(){return new $(null)}function et(t,e){return new $(t,e)}function rt(t,e,r,n,i,o){for(;--o>=0;){var s=e*this[t++]+r[n]+i;i=Math.floor(s/67108864),r[n++]=67108863&s}return i}function nt(t,e,r,n,i,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;i=((u=s*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+a*c+(i>>>30),r[n++]=1073741823&u}return i}function it(t,e,r,n,i,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;i=((u=s*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+a*c,r[n++]=268435455&u}return i}void 0!==i&&"Microsoft Internet Explorer"==(null==i?void 0:i.appName)?($.prototype.am=nt,l=30):"Netscape"!=(null==i?void 0:i.appName)?($.prototype.am=rt,l=26):($.prototype.am=it,l=28),$.prototype.DB=l,$.prototype.DM=(1<<l)-1,$.prototype.DV=1<<l,$.prototype.FV=Math.pow(2,52),$.prototype.F1=52-l,$.prototype.F2=2*l-52;var I,b,w=[];for(I="0".charCodeAt(0),b=0;b<=9;++b)w[I++]=b;for(I="a".charCodeAt(0),b=10;b<36;++b)w[I++]=b;for(I="A".charCodeAt(0),b=10;b<36;++b)w[I++]=b;function ot(t,e){return w[t.charCodeAt(e)]??-1}function st(t){var e=tt();return e.fromInt(t),e}function at(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}$.ZERO=st(0),$.ONE=st(1);class ut{constructor(){this.i=0,this.j=0,this.S=[]}init(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}next(){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 E,S,A=null;if(null==A){A=[],S=0;var P,O,T=void 0;if("undefined"!=typeof window&&null!==(P=window)&&void 0!==P&&P.crypto&&null!==(O=window)&&void 0!==O&&O.crypto.getRandomValues){var R,C=new Uint32Array(256);for(null===(R=window)||void 0===R||R.crypto.getRandomValues(C),T=0;T<C.length;++T)A[S++]=255&C[T]}var U,N,L,D=function(t){var e,r,n;if(this.count=this.count||0,this.count>=256||S>=256){if("undefined"!=typeof window)if(null!==(e=window)&&void 0!==e&&e.removeEventListener)null===(n=window)||void 0===n||n.removeEventListener("mousemove",D,!1);else if(null!==(r=window)&&void 0!==r&&r.detachEvent){var i;null===(i=window)||void 0===i||i.detachEvent("onmousemove",D)}}else try{var o=t.x+t.y;A[S++]=255&o,this.count+=1}catch(t){}};if("undefined"!=typeof window)if(null!==(U=window)&&void 0!==U&&U.addEventListener)null===(L=window)||void 0===L||L.addEventListener("mousemove",D,!1);else if(null!==(N=window)&&void 0!==N&&N.attachEvent){var k;null===(k=window)||void 0===k||k.attachEvent("onmousemove",D)}}function ct(){if(null==E){for(E=new ut;S<256;){var t=Math.floor(65536*Math.random());A[S++]=255&t}for(E.init(A),S=0;S<A.length;++S)A[S]=0;S=0}return E.next()}class ht{constructor(){}nextBytes(t){for(var e=0;e<t.length;++e)t[e]=ct()}}function lt(t,e){if(e<t.length+11)return console.error("Message too long for RSA"),null;for(var r=[],n=t.length-1;n>=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var o=new ht,s=[];e>2;){for(s[0]=0;0==s[0];)o.nextBytes(s);r[--e]=s[0]}return r[--e]=2,r[--e]=0,new $(r)}class dt{constructor(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}doPublic(t){return t.modPowInt(this.e,this.n)}doPrivate(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)}setPublic(t,e){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=et(t,16),this.e=parseInt(e,16)):console.error("Invalid RSA public key")}encrypt(t){var e=lt(t,this.n.bitLength()+7>>3);if(null==e)return null;var r=this.doPublic(e);if(null==r)return null;var n=r.toString(16);return 1&n.length?"0"+n:n}encryptLong(t){var e=this,r=(this.n.bitLength()+7>>3)-11;try{var n="";return t.length>r?(t.match(/.{1,117}/g).forEach(function(t){var r=e.encrypt(t);n+=r}),K(n)):K(this.encrypt(t))}catch(t){return!1}}decryptLong(t){var e=this,r=this.n.bitLength()+7>>3;t=Y(t);try{if(t.length>r){var n="";return t.match(/.{1,256}/g).forEach(function(t){var r=e.decrypt(t);n+=r}),n}return this.decrypt(t)}catch(t){return!1}}setPrivate(t,e,r){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=et(t,16),this.e=parseInt(e,16),this.d=et(r,16)):console.error("Invalid RSA private key")}setPrivateEx(t,e,r,n,i,o,s,a){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=et(t,16),this.e=parseInt(e,16),this.d=et(r,16),this.p=et(n,16),this.q=et(i,16),this.dmp1=et(o,16),this.dmq1=et(s,16),this.coeff=et(a,16)):console.error("Invalid RSA private key")}generate(t,e){var r=new ht,n=t>>1;this.e=parseInt(e,16);for(var i=new $(e,16);;){for(;this.p=new $(t-n,1,r),0!=this.p.subtract($.ONE).gcd(i).compareTo($.ONE)||!this.p.isProbablePrime(10););for(;this.q=new $(n,1,r),0!=this.q.subtract($.ONE).gcd(i).compareTo($.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var s=this.p.subtract($.ONE),a=this.q.subtract($.ONE),u=s.multiply(a);if(0==u.gcd(i).compareTo($.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}}decrypt(t){var e=et(t,16),r=this.doPrivate(e);return null==r?null:ft(r,this.n.bitLength()+7>>3)}generateAsync(t,e,r){var n=new ht,i=t>>1;this.e=parseInt(e,16);var o=new $(e,16),s=this,a=()=>{var e=()=>{if(s.p.compareTo(s.q)<=0){var t=s.p;s.p=s.q,s.q=t}var e=s.p.subtract($.ONE),n=s.q.subtract($.ONE),i=e.multiply(n);0==i.gcd(o).compareTo($.ONE)?(s.n=s.p.multiply(s.q),s.d=o.modInverse(i),s.dmp1=s.d.mod(e),s.dmq1=s.d.mod(n),s.coeff=s.q.modInverse(s.p),setTimeout(function(){r()},0)):setTimeout(a,0)},u=()=>{s.q=tt(),s.q.fromNumberAsync(i,1,n,function(){s.q.subtract($.ONE).gcda(o,function(t){0==t.compareTo($.ONE)&&s.q.isProbablePrime(10)?setTimeout(e,0):setTimeout(u,0)})})},c=()=>{s.p=tt(),s.p.fromNumberAsync(t-i,1,n,function(){s.p.subtract($.ONE).gcda(o,function(t){0==t.compareTo($.ONE)&&s.p.isProbablePrime(10)?setTimeout(u,0):setTimeout(c,0)})})};setTimeout(c,0)};setTimeout(a,0)}}function ft(t,e){for(var r=t.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=e-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var i="";++n<r.length;){var o=255&r[n];o<128?i+=String.fromCharCode(o):o>191&&o<224?(i+=String.fromCharCode((31&o)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&o)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}class pt extends dt{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";super(),t&&("string"==typeof t?this.parseKey(t):(this.hasPrivateKeyProperty(t)||this.hasPublicKeyProperty(t))&&this.parsePropertiesFrom(t))}parseKey(t){try{var e=0,r=0,n=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(t)?u.decode(t):c.unarmor(t),i=Z.decode(n);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){e=i.sub[1].getHexStringValue(),this.n=et(e,16),r=i.sub[2].getHexStringValue(),this.e=parseInt(r,16);var o=i.sub[3].getHexStringValue();this.d=et(o,16);var s=i.sub[4].getHexStringValue();this.p=et(s,16);var a=i.sub[5].getHexStringValue();this.q=et(a,16);var h=i.sub[6].getHexStringValue();this.dmp1=et(h,16);var l=i.sub[7].getHexStringValue();this.dmq1=et(l,16);var d=i.sub[8].getHexStringValue();this.coeff=et(d,16)}else{if(2!==i.sub.length)return!1;var f=i.sub[1].sub[0];e=f.sub[0].getHexStringValue(),this.n=et(e,16),r=f.sub[1].getHexStringValue(),this.e=parseInt(r,16)}return!0}catch(t){return!1}}hasPublicKeyProperty(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")}hasPrivateKeyProperty(t){return(t=t||{}).hasOwnProperty("n")&&t.hasOwnProperty("e")&&t.hasOwnProperty("d")&&t.hasOwnProperty("p")&&t.hasOwnProperty("q")&&t.hasOwnProperty("dmp1")&&t.hasOwnProperty("dmq1")&&t.hasOwnProperty("coeff")}parsePropertiesFrom(t){this.n=t.n,this.e=t.e,t.hasOwnProperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)}}(n=function(t){t=t||{},this.default_key_size=parseInt(t.default_key_size,10)||1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}).prototype.setKey=function(t){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new pt(t)},n.prototype.setPrivateKey=function(t){this.setKey(t)},n.prototype.setPublicKey=function(t){this.setKey(t)},n.prototype.decrypt=function(t){try{return this.getKey().decrypt(Y(t))}catch(t){return!1}},n.prototype.encrypt=function(t){try{return K(this.getKey().encrypt(t))}catch(t){return!1}},n.prototype.encryptLong=function(t){try{for(var e=this.getKey().encryptLong(t)||"",r=this.getKey().decryptLong(e)||"",n=0,i=/null$/g;i.test(r)&&(n++,e=this.getKey().encryptLong(t)||"",r=this.getKey().decryptLong(e)||"",!(n>10)););return e}catch(t){return!1}},n.prototype.getKey=function(t){if(!this.key){if(this.key=new pt,t&&"[object Function]"==={}.toString.call(t))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},n.version="3.1.4"}const x=n;var M=r(631),q=function(t){var e=void 0===t?{}:t,r=e.publicKey,n=void 0===r?"":r,i=e.payload,o=void 0===i?{}:i;if(!n)return"";try{var s=(0,M.I)(o),a=new x;return a.setPublicKey(n),a.encryptLong("object"==typeof s?JSON.stringify(s):s)}catch(t){console.error("encrypt error:",t)}return""}},631:(t,e,r)=>{r.d(e,{I:()=>n,y:()=>i});var n=function(t){var e=function(e){for(var r in t)t.hasOwnProperty(r)&&(e[r]=n(t[r]));return e},r=null==t?"NullOrUndefined":Object.prototype.toString.call(t).slice(8,-1);if(["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"].includes(r))return t.slice();switch(r){case"Object":return e(Object.create(Object.getPrototypeOf(t)));case"Array":return e([]);case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":""));default:return t}},i=function(t){var e=t.match(/^(?:http(s)?:\/\/[^\/]+)?(\/[^\?#]*)/);return e&&e[2]||""}},182:function(t,e,r){var n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},n.apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),o=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&i(e,t,r);return o(e,t),e};Object.defineProperty(e,"__esModule",{value:!0}),e.useDefaultAdapter=e.useAdapters=e.RUNTIME=void 0;var a,u=s(r(274)),c=r(616);!function(t){t.WEB="web",t.WX_MP="wx_mp"}(a=e.RUNTIME||(e.RUNTIME={})),e.useAdapters=function(t,e){for(var r=0,i=(0,c.isArray)(t)?t:[t];r<i.length;r++){var o=i[r],s=o.isMatch,a=o.genAdapter,u=o.runtime;if(s())return{adapter:n({isMatch:s},a(e)),runtime:u}}},e.useDefaultAdapter=function(){return{adapter:n({},u.genAdapter()),runtime:a.WEB}}},274:function(t,e,r){var n,i=this&&this.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),o=this&&this.__assign||function(){return o=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var i in e=arguments[r])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},o.apply(this,arguments)},s=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})},a=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.WebRequest=e.genAdapter=void 0;var u=r(149),c=r(616),h=r(946),l=function(t){function e(e){var r=t.call(this)||this,n=e.timeout,i=e.timeoutMsg,o=e.restrictedMethods;return r.timeout=n||0,r.timeoutMsg=i||"请求超时",r.restrictedMethods=o||["get","post","upload","download"],r}return i(e,t),e.prototype.get=function(t){return this.request(o(o({},t),{method:"get"}),this.restrictedMethods.includes("get"))},e.prototype.post=function(t){return this.request(o(o({},t),{method:"post"}),this.restrictedMethods.includes("post"))},e.prototype.put=function(t){return this.request(o(o({},t),{method:"put"}))},e.prototype.upload=function(t){var e=t.data,r=t.file,n=t.name,i=t.method,s=t.headers,a=void 0===s?{}:s,u={post:"post",put:"put"}[null==i?void 0:i.toLowerCase()]||"put",c=new FormData;return"post"===u?(Object.keys(e).forEach(function(t){c.append(t,e[t])}),c.append("key",n),c.append("file",r),this.request(o(o({},t),{data:c,method:u}),this.restrictedMethods.includes("upload"))):this.request(o(o({},t),{method:"put",headers:a,body:r}),this.restrictedMethods.includes("upload"))},e.prototype.download=function(t){return s(this,void 0,void 0,function(){var e,r,n,i;return a(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.get(o(o({},t),{headers:{},responseType:"blob"}))];case 1:return e=s.sent().data,r=window.URL.createObjectURL(new Blob([e])),n=decodeURIComponent(new URL(t.url).pathname.split("/").pop()||""),(i=document.createElement("a")).href=r,i.setAttribute("download",n),i.style.display="none",document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(r),document.body.removeChild(i),[3,3];case 2:return s.sent(),[3,3];case 3:return[2,new Promise(function(e){e({statusCode:200,tempFilePath:t.url})})]}})})},e.prototype.fetch=function(t){var e;return s(this,void 0,void 0,function(){var r,n,i,u,c,h,l,d,f,p,v,g,m,y=this;return a(this,function(_){switch(_.label){case 0:return r=new AbortController,n=t.url,i=t.enableAbort,u=void 0!==i&&i,c=t.stream,h=void 0!==c&&c,l=t.signal,d=t.timeout,f=t.shouldThrowOnError,p=void 0===f||f,v=null!=d?d:this.timeout,l&&(l.aborted&&r.abort(),l.addEventListener("abort",function(){return r.abort()})),g=null,u&&v&&(g=setTimeout(function(){console.warn(y.timeoutMsg),r.abort(new Error(y.timeoutMsg))},v)),[4,fetch(n,o(o({},t),{signal:r.signal})).then(function(t){return s(y,void 0,void 0,function(){var e,r,n;return a(this,function(i){switch(i.label){case 0:return clearTimeout(g),p?t.ok?(e=t,[3,3]):[3,1]:[3,4];case 1:return n=(r=Promise).reject,[4,t.json()];case 2:e=n.apply(r,[i.sent()]),i.label=3;case 3:return[2,e];case 4:return[2,t]}})})}).catch(function(t){return clearTimeout(g),Promise.reject(t)})];case 1:return m=_.sent(),[2,{data:h?m.body:(null===(e=m.headers.get("content-type"))||void 0===e?void 0:e.includes("application/json"))?m.json():m.text(),statusCode:m.status,header:m.headers,response:m}]}})})},e.prototype.request=function(t,e){var r=this;void 0===e&&(e=!1);var n=String(t.method).toLowerCase()||"get";return new Promise(function(i){var o=t.url,s=t.headers,a=void 0===s?{}:s,u=t.data,l=t.responseType,d=t.withCredentials,f=t.body,p=t.onUploadProgress,v=(0,c.formatUrl)((0,h.getProtocol)(),o,"get"===n?u:{}),g=new XMLHttpRequest;g.open(n,v),l&&(g.responseType=l);var m,y,_=t.signal;_&&(_.aborted?g.abort():_.addEventListener("abort",function(){return g.abort()},{once:!0})),Object.keys(a).forEach(function(t){g.setRequestHeader(t,a[t])}),p&&g.upload.addEventListener("progress",p),g.onreadystatechange=function(){var t={};if(4===g.readyState){var e=g.getAllResponseHeaders().trim().split(/[\r\n]+/),r={};e.forEach(function(t){var e=t.split(": "),n=e.shift().toLowerCase(),i=e.join(": ");r[n]=i}),t.header=r,t.statusCode=g.status;try{t.data="blob"===l?g.response:JSON.parse(g.responseText)}catch(e){t.data="blob"===l?g.response:g.responseText}clearTimeout(m),i(t)}},e&&r.timeout&&(m=setTimeout(function(){console.warn(r.timeoutMsg),g.abort()},r.timeout)),y=(0,c.isFormData)(u)?u:"application/x-www-form-urlencoded"===a["content-type"]?(0,c.toQueryString)(u):f||(u?JSON.stringify(u):void 0),d&&(g.withCredentials=!0),g.send(y)})},e}(u.AbstractSDKRequest);e.WebRequest=l,e.genAdapter=function(){return{type:"default",root:window,reqClass:l,wsClass:WebSocket,localStorage}}},946:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.COMMUNITY_SITE_URL=e.IS_DEBUG_MODE=e.getProtocol=e.setProtocol=e.getSdkName=e.setSdkName=void 0;var r="@cloudbase/js-sdk";e.setSdkName=function(t){r=t},e.getSdkName=function(){return r};var n="https:";e.setProtocol=function(t){n=t},e.getProtocol=function(){return n},e.IS_DEBUG_MODE=!1,e.COMMUNITY_SITE_URL="https://support.qq.com/products/148793"},205:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ERRORS=void 0,e.ERRORS={INVALID_PARAMS:"INVALID_PARAMS",INVALID_SYNTAX:"INVALID_SYNTAX",INVALID_OPERATION:"INVALID_OPERATION",OPERATION_FAIL:"OPERATION_FAIL",NETWORK_ERROR:"NETWORK_ERROR",UNKOWN_ERROR:"UNKOWN_ERROR"}},794:function(t,e,r){var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);i&&!("get"in i?!e.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.OATUH_LOGINTYPE=void 0,i(r(946),e),i(r(205),e),e.OATUH_LOGINTYPE="constants"},718:function(t,e,r){var n=this&&this.__awaiter||function(t,e,r,n){return new(r||(r=Promise))(function(i,o){function s(t){try{u(n.next(t))}catch(t){o(t)}}function a(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof r?e:new r(function(t){t(e)})).then(s,a)}u((n=n.apply(t,e||[])).next())})},i=this&&this.__generator||function(t,e){var r,n,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,n=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!((i=(i=s.trys).length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.catchErrorsDecorator=void 0;var o=r(616),s=r(794),a=!1;"undefined"!=typeof navigator&&navigator.userAgent&&(a=-1!==navigator.userAgent.indexOf("Firefox"));var u=a?/(\.js\/)?__decorate(\$\d+)?<@.*\d$/:/(\/\w+\.js\.)?__decorate(\$\d+)?\s*\(.*\)$/,c=/https?:\/\/.+:\d*\/.*\.js:\d+:\d+/;function h(t){var e=t.err,r=t.className,n=t.methodName,i=t.sourceLink;if(!i)return null;var o,s=e.stack.split("\n"),u=a?/^catchErrorsDecorator\/<\/descriptor.value@.*\d$/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]\\s*\\(.*\\)$")),h=a?/^catchErrorsDecorator\/<\/descriptor.value/:new RegExp("".concat(r,"\\.descriptor.value\\s*\\[as\\s").concat(n,"\\]")),l=s.findIndex(function(t){return u.test(t)});if(-1!==l){var d=s.filter(function(t,e){return e>l});d.unshift(s[l].replace(h,"".concat(r,".").concat(n)).replace(c,i)),(o=new Error).stack="".concat(a?"@debugger":"Error","\n").concat(d.join("\n"))}return o}e.catchErrorsDecorator=function(t){var e=t.mode,r=void 0===e?"async":e,a=t.customInfo,l=void 0===a?{}:a,d=t.title,f=t.messages,p=void 0===f?[]:f;return function(t,e,a){if(s.IS_DEBUG_MODE){var f=l.className||t.constructor.name,v=l.methodName||e,g=a.value,m=function(){var t="",e=(new Error).stack.split("\n"),r=e.findIndex(function(t){return u.test(t)});if(-1!==r){var n=c.exec(e[r+1]||"");t=n?n[0]:""}return t}();a.value="sync"===r?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=h({err:new Error,className:f,methodName:v,sourceLink:m});try{return g.apply(this,t)}catch(t){var n=t,i=t.message,s=t.error,a=t.error_description,u={title:d||"".concat(f,".").concat(v," failed"),content:[{type:"error",body:t}]};if(i&&/^\{.*\}$/.test(i)){var c=JSON.parse(i);u.subtitle=i,c.code&&(r?(r.code=c.code,r.msg=c.msg):(t.code=c.code,t.message=c.msg),n=r||t,u.content=p.map(function(t){return{type:"info",body:t}}))}throw s&&a&&(u.subtitle=a,r?(r.code=s,r.msg=a):(t.code=s,t.message=a),n=r||t,u.content=p.map(function(t){return{type:"info",body:t}})),(0,o.printGroupLog)(u),n}}:function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return n(this,void 0,void 0,function(){var e,r,n,s,a,u,c,l;return i(this,function(i){switch(i.label){case 0:e=h({err:new Error,className:f,methodName:v,sourceLink:m}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,g.apply(this,t)];case 2:return[2,i.sent()];case 3:throw r=i.sent(),n=r,s=r.message,a=r.error,u=r.error_description,c={title:d||"".concat(f,".").concat(v," failed"),content:[{type:"error",body:r}]},s&&/^\{.*\}$/.test(s)&&(l=JSON.parse(s),c.subtitle=l,l.code&&(e?(e.code=l.code,e.message=l.msg):(r.code=l.code,r.message=l.msg),n=e||r,c.content=p.map(function(t){return{type:"info",body:t}}))),a&&u&&(c.subtitle=u,e?(e.code