jiezhangxin-utils 0.3.9 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/jiezhangxin-utils.cjs.js +3 -3
- package/dist/jiezhangxin-utils.cjs.js.map +1 -1
- package/dist/jiezhangxin-utils.esm.js +12 -12
- package/dist/jiezhangxin-utils.esm.js.map +1 -1
- package/dist/jiezhangxin-utils.umd.js +4 -4
- package/dist/jiezhangxin-utils.umd.js.map +1 -1
- package/package.json +3 -2
|
@@ -23,7 +23,7 @@ function st(t,e){this.x=e,this.q=t}function ot(t,e,r,n){this.curve=t,this.x=e,th
|
|
|
23
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};
|
|
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"]'];
|
|
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},[]):[];
|
|
27
27
|
/*!
|
|
28
28
|
* decimal.js v10.6.0
|
|
29
29
|
* An arbitrary-precision Decimal type for JavaScript.
|
|
@@ -31,7 +31,7 @@ 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 le,fe,pe=9e15,ge=1e9,de="0123456789abcdef",ve="2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058",me="3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789",ye={precision:20,rounding:4,modulo:1,toExpNeg:-7,toExpPos:21,minE:-pe,maxE:pe,crypto:!1},xe=!0,we="[DecimalError] ",Se=we+"Invalid argument: ",Ee=we+"Precision limit exceeded",be=we+"crypto unavailable",Fe="[object Decimal]",Ae=Math.floor,Ce=Math.pow,De=/^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,Pe=/^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,Ie=/^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,Te=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Re=1e7,Ne=ve.length-1,_e=me.length-1,Oe={toStringTag:Fe};function Be(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+=We(r)),s+=n;(r=7-(n=(o=t[e])+"").length)&&(s+=We(r))}else if(0===o)return"0";for(;o%10==0;)o/=10;return s+o}function je(t,e,r){if(t!==~~t||t<e||t>r)throw Error(Se+t)}function He(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=Ce(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)==Ce(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)==Ce(10,e-3)-1,o}function ke(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]+=de.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()}Oe.absoluteValue=Oe.abs=function(){var t=new this.constructor(this);return t.s<0&&(t.s=1),Ve(t)},Oe.ceil=function(){return Ve(new this.constructor(this),this.e+1,2)},Oe.clampedTo=Oe.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(Se+e);return r.cmp(t)<0?t:r.cmp(e)>0?e:new n(r)},Oe.comparedTo=Oe.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},Oe.cosine=Oe.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/rr(4,r=Math.ceil(n/3))).toString():(r=16,i="2.3283064365386962890625e-10");t.precision+=r,e=er(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,nr(n,r)),n.precision=t,n.rounding=e,Ve(2==fe||3==fe?r.neg():r,t,e,!0)):new n(1):new n(NaN)},Oe.cubeRoot=Oe.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(xe=!1,(s=h.s*Ce(h.s*h,1/3))&&Math.abs(s)!=1/0?n=new l(s.toString()):(r=Be(h.d),(s=((t=h.e)-r.length+1)%3)&&(r+=1==s||-2==s?"0":"00"),s=Ce(r,1/3),t=Ae((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=Le(c.plus(h).times(a),c.plus(u),o+2,1),Be(a.d).slice(0,o)===(r=Be(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))||(Ve(n,t+1,1),e=!n.times(n).times(n).eq(h));break}if(!i&&(Ve(a,t+1,0),a.times(a).times(a).eq(h))){n=a;break}o+=4,i=1}return xe=!0,Ve(n,t,l.rounding,e)},Oe.decimalPlaces=Oe.dp=function(){var t,e=this.d,r=NaN;if(e){if(r=7*((t=e.length-1)-Ae(this.e/7)),t=e[t])for(;t%10==0;t/=10)r--;r<0&&(r=0)}return r},Oe.dividedBy=Oe.div=function(t){return Le(this,new this.constructor(t))},Oe.dividedToIntegerBy=Oe.divToInt=function(t){var e=this.constructor;return Ve(Le(this,new e(t),0,1,1),e.precision,e.rounding)},Oe.equals=Oe.eq=function(t){return 0===this.cmp(t)},Oe.floor=function(){return Ve(new this.constructor(this),this.e+1,3)},Oe.greaterThan=Oe.gt=function(t){return this.cmp(t)>0},Oe.greaterThanOrEqualTo=Oe.gte=function(t){var e=this.cmp(t);return 1==e||0===e},Oe.hyperbolicCosine=Oe.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/rr(4,t=Math.ceil(i/3))).toString():(t=16,e="2.3283064365386962890625e-10"),s=er(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 Ve(s,o.precision=r,o.rounding=n,!0)},Oe.hyperbolicSine=Oe.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=er(s,2,i,i,!0);else{t=(t=1.4*Math.sqrt(n))>16?16:0|t,i=er(s,2,i=i.times(1/rr(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,Ve(i,e,r,!0)},Oe.hyperbolicTangent=Oe.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,Le(r.sinh(),r.cosh(),n.precision=t,n.rounding=e)):new n(r.s)},Oe.inverseCosine=Oe.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()?Ue(e,n,i):new e(0):new e(NaN):t.isZero()?Ue(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))},Oe.inverseHyperbolicCosine=Oe.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,xe=!1,r=r.times(r).minus(1).sqrt().plus(r),xe=!0,n.precision=t,n.rounding=e,r.ln()):new n(r)},Oe.inverseHyperbolicSine=Oe.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,xe=!1,r=r.times(r).plus(1).sqrt().plus(r),xe=!0,n.precision=t,n.rounding=e,r.ln())},Oe.inverseHyperbolicTangent=Oe.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?Ve(new s(i),t,e,!0):(s.precision=r=n-i.e,i=Le(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)},Oe.inverseSine=Oe.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=Ue(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)))},Oe.inverseTangent=Oe.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<=_e)return(o=Ue(h,l+4,f).times(.25)).s=c.s,o}else{if(!c.s)return new h(NaN);if(l+4<=_e)return(o=Ue(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(xe=!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)),xe=!0,Ve(o,h.precision=l,h.rounding=f,!0)},Oe.isFinite=function(){return!!this.d},Oe.isInteger=Oe.isInt=function(){return!!this.d&&Ae(this.e/7)>this.d.length-2},Oe.isNaN=function(){return!this.s},Oe.isNegative=Oe.isNeg=function(){return this.s<0},Oe.isPositive=Oe.isPos=function(){return this.s>0},Oe.isZero=function(){return!!this.d&&0===this.d[0]},Oe.lessThan=Oe.lt=function(t){return this.cmp(t)<0},Oe.lessThanOrEqualTo=Oe.lte=function(t){return this.cmp(t)<1},Oe.logarithm=Oe.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(xe=!1,o=Xe(c,a=l+5),n=e?Ke(h,a+10):Xe(t,a),He((u=Le(o,n,a,1)).d,i=l,f))do{if(o=Xe(c,a+=10),n=e?Ke(h,a+10):Xe(t,a),u=Le(o,n,a,1),!s){+Be(u.d).slice(i+1,i+15)+1==1e14&&(u=Ve(u,l+1,0));break}}while(He(u.d,i+=10,f));return xe=!0,Ve(u,l,f)},Oe.minus=Oe.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 xe?Ve(t,a,u):t}if(r=Ae(t.e/7),h=Ae(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]=Re-1;--c[i],c[n]+=Re}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=qe(c,r),xe?Ve(t,a,u):t):new g(3===u?-0:0)},Oe.modulo=Oe.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]?Ve(new n(r),n.precision,n.rounding):(xe=!1,9==n.modulo?(e=Le(r,t.abs(),0,3,1)).s*=t.s:e=Le(r,t,0,n.modulo,1),e=e.times(t),xe=!0,r.minus(e))},Oe.naturalExponential=Oe.exp=function(){return Ye(this)},Oe.naturalLogarithm=Oe.ln=function(){return Xe(this)},Oe.negated=Oe.neg=function(){var t=new this.constructor(this);return t.s=-t.s,Ve(t)},Oe.plus=Oe.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)),xe?Ve(t,a,u):t;if(s=Ae(l.e/7),n=Ae(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)/Re|0,c[i]%=Re;for(e&&(c.unshift(e),++n),o=c.length;0==c[--o];)c.pop();return t.d=c,t.e=qe(c,n),xe?Ve(t,a,u):t},Oe.precision=Oe.sd=function(t){var e,r=this;if(void 0!==t&&t!==!!t&&1!==t&&0!==t)throw Error(Se+t);return r.d?(e=ze(r.d),t&&r.e+1>e&&(e=r.e+1)):e=NaN,e},Oe.round=function(){var t=this,e=t.constructor;return Ve(new e(t),t.e+1,e.rounding)},Oe.sine=Oe.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:er(t,2,e,e);r=1.4*Math.sqrt(n),r=r>16?16:0|r,e=e.times(1/rr(5,r)),e=er(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,nr(n,r)),n.precision=t,n.rounding=e,Ve(fe>2?r.neg():r,t,e,!0)):new n(NaN)},Oe.squareRoot=Oe.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(xe=!1,0==(c=Math.sqrt(+o))||c==1/0?(((e=Be(a)).length+u)%2==0&&(e+="0"),c=Math.sqrt(e),u=Ae((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(Le(o,s,r+2,1)).times(.5),Be(s.d).slice(0,r)===(e=Be(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))||(Ve(n,u+1,1),t=!n.times(n).eq(o));break}if(!i&&(Ve(s,u+1,0),s.times(s).eq(o))){n=s;break}r+=4,i=1}return xe=!0,Ve(n,u,h.rounding,t)},Oe.tangent=Oe.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=Le(r,new n(1).minus(r.times(r)).sqrt(),t+10,0),n.precision=t,n.rounding=e,Ve(2==fe||4==fe?r.neg():r,t,e,!0)):new n(NaN)},Oe.times=Oe.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=Ae(h.e/7)+Ae(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%Re|0,e=a/Re|0;s[i]=(s[i]+e)%Re|0}for(;!s[--o];)s.pop();return e?++r:s.shift(),t.d=s,t.e=qe(s,r),xe?Ve(t,l.precision,l.rounding):t},Oe.toBinary=function(t,e){return ir(this,2,t,e)},Oe.toDecimalPlaces=Oe.toDP=function(t,e){var r=this,n=r.constructor;return r=new n(r),void 0===t?r:(je(t,0,ge),void 0===e?e=n.rounding:je(e,0,8),Ve(r,t+r.e+1,e))},Oe.toExponential=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=Me(n,!0):(je(t,0,ge),void 0===e?e=i.rounding:je(e,0,8),r=Me(n=Ve(new i(n),t+1,e),!0,t+1)),n.isNeg()&&!n.isZero()?"-"+r:r},Oe.toFixed=function(t,e){var r,n,i=this,s=i.constructor;return void 0===t?r=Me(i):(je(t,0,ge),void 0===e?e=s.rounding:je(e,0,8),r=Me(n=Ve(new s(i),t+i.e+1,e),!1,t+n.e+1)),i.isNeg()&&!i.isZero()?"-"+r:r},Oe.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=ze(g)-p.e-1)%7,e.d[0]=Ce(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(Se+a);t=a.gt(e)?s>0?e:c:a}for(xe=!1,a=new d(Be(g)),h=d.precision,d.precision=s=7*g.length*2;l=Le(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=Le(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=Le(c,n,s,1).minus(p).abs().cmp(Le(u,r,s,1).minus(p).abs())<1?[c,n]:[u,r],d.precision=h,xe=!0,f},Oe.toHexadecimal=Oe.toHex=function(t,e){return ir(this,16,t,e)},Oe.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:je(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]?(xe=!1,r=Le(r,t,0,e,1).times(t),xe=!0,Ve(r)):(t.s=r.s,r=t),r},Oe.toNumber=function(){return+this},Oe.toOctal=function(t,e){return ir(this,8,t,e)},Oe.toPower=Oe.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(Ce(+a,c));if((a=new u(a)).eq(1))return a;if(n=u.precision,s=u.rounding,t.eq(1))return Ve(a,n,s);if((e=Ae(t.e/7))>=t.d.length-1&&(r=c<0?-c:c)<=9007199254740991)return i=Ge(u,a,r,n),t.s<0?new u(1).div(i):Ve(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=Ce(+a,c))&&isFinite(r)?new u(r+"").e:Ae(c*(Math.log("0."+Be(a.d))/Math.LN10+a.e+1)))>u.maxE+1||e<u.minE-1?new u(e>0?o/0:0):(xe=!1,u.rounding=a.s=1,r=Math.min(12,(e+"").length),(i=Ye(t.times(Xe(a,n+r)),n)).d&&He((i=Ve(i,n+5,1)).d,n,s)&&(e=n+10,+Be((i=Ve(Ye(t.times(Xe(a,e+r)),e),e+5,1)).d).slice(n+1,n+15)+1==1e14&&(i=Ve(i,n+1,0))),i.s=o,xe=!0,u.rounding=s,Ve(i,n,s))},Oe.toPrecision=function(t,e){var r,n=this,i=n.constructor;return void 0===t?r=Me(n,n.e<=i.toExpNeg||n.e>=i.toExpPos):(je(t,1,ge),void 0===e?e=i.rounding:je(e,0,8),r=Me(n=Ve(new i(n),t,e),t<=n.e||n.e<=i.toExpNeg,t)),n.isNeg()&&!n.isZero()?"-"+r:r},Oe.toSignificantDigits=Oe.toSD=function(t,e){var r=this.constructor;return void 0===t?(t=r.precision,e=r.rounding):(je(t,1,ge),void 0===e?e=r.rounding:je(e,0,8)),Ve(new r(this),t,e)},Oe.toString=function(){var t=this,e=t.constructor,r=Me(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()&&!t.isZero()?"-"+r:r},Oe.truncated=Oe.trunc=function(){return Ve(new this.constructor(this),this.e+1,1)},Oe.valueOf=Oe.toJSON=function(){var t=this,e=t.constructor,r=Me(t,t.e<=e.toExpNeg||t.e>=e.toExpPos);return t.isNeg()?"-"+r:r};var Le=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=Re,p=7,h=Ae(n.e/p)-Ae(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,le=g;else{for(l=1,f=y[0];f>=10;f/=10)l++;m.e=l+h*p-1,Ve(m,a?s+m.e+1:s,o,g)}return m}}();function Ve(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])/Ce(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/Ce(10,i-o-1)%10|0}if(n=n||e<0||void 0!==l[f+1]||(o<0?h:h%Ce(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/Ce(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]=Ce(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=Ce(10,7-s),l[f]=o>0?(h/Ce(10,i-o)%Ce(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]==Re&&(l[0]=1));break}if(l[f]+=a,l[f]!=Re)break;l[f--]=0,a=1}for(s=l.length;0===l[--s];)l.pop()}return xe&&(t.e>p.maxE?(t.d=null,t.e=NaN):t.e<p.minE&&(t.e=0,t.d=[0])),t}function Me(t,e,r){if(!t.isFinite())return Ze(t);var n,i=t.e,s=Be(t.d),o=s.length;return e?(r&&(n=r-o)>0?s=s.charAt(0)+"."+s.slice(1)+We(n):o>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(t.e<0?"e":"e+")+t.e):i<0?(s="0."+We(-i-1)+s,r&&(n=r-o)>0&&(s+=We(n))):i>=o?(s+=We(i+1-o),r&&(n=r-i-1)>0&&(s=s+"."+We(n))):((n=i+1)<o&&(s=s.slice(0,n)+"."+s.slice(n)),r&&(n=r-o)>0&&(i+1===o&&(s+="."),s+=We(n))),s}function qe(t,e){var r=t[0];for(e*=7;r>=10;r/=10)e++;return e}function Ke(t,e,r){if(e>Ne)throw xe=!0,r&&(t.precision=r),Error(Ee);return Ve(new t(ve),e,1,!0)}function Ue(t,e,r){if(e>_e)throw Error(Ee);return Ve(new t(me),e,r,!0)}function ze(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 We(t){for(var e="";t--;)e+="0";return e}function Ge(t,e,r,n){var i,s=new t(1),o=Math.ceil(n/7+4);for(xe=!1;;){if(r%2&&sr((s=s.times(e)).d,o)&&(i=!0),0===(r=Ae(r/2))){r=s.d.length-1,i&&0===s.d[r]&&++s.d[r];break}sr((e=e.times(e)).d,o)}return xe=!0,s}function $e(t){return 1&t.d[t.d.length-1]}function Je(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 Ye(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?(xe=!1,u=g):u=e,a=new f(.03125);t.e>-2;)t=t.times(a),l+=5;for(u+=n=Math.log(Ce(2,l))/Math.LN10*2+5|0,r=s=o=new f(1),f.precision=u;;){if(s=Ve(s.times(t),u,1),r=r.times(++h),Be((a=o.plus(Le(s,r,u,1))).d).slice(0,u)===Be(o.d).slice(0,u)){for(i=l;i--;)o=Ve(o.times(o),u,1);if(null!=e)return f.precision=g,o;if(!(c<3&&He(o.d,u-n,p,c)))return Ve(o,f.precision=g,p,xe=!0);f.precision=u+=10,r=s=a=new f(1),h=0,c++}o=a}}function Xe(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?(xe=!1,h=y):h=e,v.precision=h+=10,n=(r=Be(d)).charAt(0),!(Math.abs(s=g.e)<15e14))return c=Ke(v,h+2,y).times(s+""),g=Xe(new v(n+"."+r.slice(1)),h-10).plus(c),v.precision=y,null==e?Ve(g,y,m,xe=!0):g;for(;n<7&&1!=n||1==n&&r.charAt(1)>3;)n=(r=Be((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=Le(g.minus(1),g.plus(1),h,1),f=Ve(g.times(g),h,1),i=3;;){if(o=Ve(o.times(f),h,1),Be((c=u.plus(Le(o,new v(i),h,1))).d).slice(0,h)===Be(u.d).slice(0,h)){if(u=u.times(2),0!==s&&(u=u.plus(Ke(v,h+2,y).times(s+""))),u=Le(u,new v(p),h,1),null!=e)return v.precision=y,u;if(!He(u.d,h-10,m,a))return Ve(u,v.precision=y,m,xe=!0);v.precision=h+=10,c=o=g=Le(l.minus(1),l.plus(1),h,1),f=Ve(g.times(g),h,1),i=a=1}u=c,i+=2}}function Ze(t){return String(t.s*t.s/0)}function Qe(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),xe&&(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 tr(t,e){var r,n,i,s,o,a,u,c,h;if(e.indexOf("_")>-1){if(e=e.replace(/(\d)_(?=\d)/g,"$1"),Te.test(e))return Qe(t,e)}else if("Infinity"===e||"NaN"===e)return+e||(t.s=NaN),t.e=NaN,t.d=null,t;if(Pe.test(e))r=16,e=e.toLowerCase();else if(De.test(e))r=2;else{if(!Ie.test(e))throw Error(Se+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=Ge(n,new n(r),s,2*s)),s=h=(c=ke(e,r,Re)).length-1;0===c[s];--s)c.pop();return s<0?new n(0*t.s):(t.e=qe(c,h),t.d=c,xe=!1,o&&(t=Le(t,i,4*a)),u&&(t=t.times(Math.abs(u)<54?Ce(2,u):Wr.pow(2,u))),xe=!0,t)}function er(t,e,r,n,i){var s,o,a,u,c=t.precision,h=Math.ceil(c/7);for(xe=!1,u=r.times(r),a=new t(n);;){if(o=Le(a.times(u),new t(e++*e++),c,1),a=i?n.plus(o):n.minus(o),n=Le(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 xe=!0,o.d.length=h+1,o}function rr(t,e){for(var r=t;--e;)r*=t;return r}function nr(t,e){var r,n=e.s<0,i=Ue(t,t.precision,1),s=i.times(.5);if((e=e.abs()).lte(s))return fe=n?4:1,e;if((r=e.divToInt(i)).isZero())fe=n?3:2;else{if((e=e.minus(r.times(i))).lte(s))return fe=$e(r)?n?2:3:n?4:1,e;fe=$e(r)?n?1:4:n?3:2}return e.minus(i).abs()}function ir(t,e,r,n){var i,s,o,a,u,c,h,l,f,p=t.constructor,g=void 0!==r;if(g?(je(r,1,ge),void 0===n?n=p.rounding:je(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=Me(t)).indexOf("."))>=0&&(h=h.replace(".",""),(f=new p(1)).e=h.length-o,f.d=ke(Me(f),10,i),f.e=f.d.length),s=u=(l=ke(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=Le(t,f,r,n,0,i)).d,s=t.e,c=le),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+=de.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=ke(h,i,e)).length;!l[u-1];--u);for(o=1,h="1.";o<u;o++)h+=de.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=Ze(t);return t.s<0?"-"+h:h}function sr(t,e){if(t.length>e)return t.length=e,!0}function or(t){return new this(t).abs()}function ar(t){return new this(t).acos()}function ur(t){return new this(t).acosh()}function cr(t,e){return new this(t).plus(e)}function hr(t){return new this(t).asin()}function lr(t){return new this(t).asinh()}function fr(t){return new this(t).atan()}function pr(t){return new this(t).atanh()}function gr(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?Ue(this,n,i):new this(0)).s=t.s:!t.d||e.isZero()?(r=Ue(this,s,1).times(.5)).s=t.s:e.s<0?(this.precision=s,this.rounding=1,r=this.atan(Le(t,e,s,1)),e=Ue(this,s,1),this.precision=n,this.rounding=i,r=t.s<0?r.minus(e):r.plus(e)):r=this.atan(Le(t,e,s,1)):(r=Ue(this,s,1).times(e.s>0?.25:.75)).s=t.s:r=new this(NaN),r}function dr(t){return new this(t).cbrt()}function vr(t){return Ve(t=new this(t),t.e+1,2)}function mr(t,e,r){return new this(t).clamp(e,r)}function yr(t){if(!t||"object"!=typeof t)throw Error(we+"Object expected");var e,r,n,i=!0===t.defaults,s=["precision",1,ge,"rounding",0,8,"toExpNeg",-pe,0,"toExpPos",0,pe,"maxE",0,pe,"minE",-pe,0,"modulo",0,9];for(e=0;e<s.length;e+=3)if(r=s[e],i&&(this[r]=ye[r]),void 0!==(n=t[r])){if(!(Ae(n)===n&&n>=s[e+1]&&n<=s[e+2]))throw Error(Se+r+": "+n);this[r]=n}if(r="crypto",i&&(this[r]=ye[r]),void 0!==(n=t[r])){if(!0!==n&&!1!==n&&0!==n&&1!==n)throw Error(Se+r+": "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw Error(be);this[r]=!0}else this[r]=!1}return this}function xr(t){return new this(t).cos()}function wr(t){return new this(t).cosh()}function Sr(t,e){return new this(t).div(e)}function Er(t){return new this(t).exp()}function br(t){return Ve(t=new this(t),t.e+1,3)}function Fr(){var t,e,r=new this(0);for(xe=!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 xe=!0,new this(1/0);r=e}return xe=!0,r.sqrt()}function Ar(t){return t instanceof Wr||t&&t.toStringTag===Fe||!1}function Cr(t){return new this(t).ln()}function Dr(t,e){return new this(t).log(e)}function Pr(t){return new this(t).log(2)}function Ir(t){return new this(t).log(10)}function Tr(){return Je(this,arguments,-1)}function Rr(){return Je(this,arguments,1)}function Nr(t,e){return new this(t).mod(e)}function _r(t,e){return new this(t).mul(e)}function Or(t,e){return new this(t).pow(e)}function Br(t){var e,r,n,i,s=0,o=new this(1),a=[];if(void 0===t?t=this.precision:je(t,1,ge),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(be);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=Ce(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 jr(t){return Ve(t=new this(t),t.e+1,this.rounding)}function Hr(t){return(t=new this(t)).d?t.d[0]?t.s:0*t.s:t.s||NaN}function kr(t){return new this(t).sin()}function Lr(t){return new this(t).sinh()}function Vr(t){return new this(t).sqrt()}function Mr(t,e){return new this(t).sub(e)}function qr(){var t=0,e=arguments,r=new this(e[t]);for(xe=!1;r.s&&++t<e.length;)r=r.plus(e[t]);return xe=!0,Ve(r,this.precision,this.rounding)}function Kr(t){return new this(t).tan()}function Ur(t){return new this(t).tanh()}function zr(t){return Ve(t=new this(t),t.e+1,1)}Oe[Symbol.for("nodejs.util.inspect.custom")]=Oe.toString,Oe[Symbol.toStringTag]="Decimal";var Wr=Oe.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,Ar(t))return i.s=t.s,void(xe?!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(xe?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)):Qe(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),Te.test(t)?Qe(i,t):tr(i,t);if("bigint"===n)return t<0?(t=-t,i.s=-1):i.s=1,Qe(i,t.toString());throw Error(Se+t)}if(s.prototype=Oe,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.EUCLID=9,s.config=s.set=yr,s.clone=t,s.isDecimal=Ar,s.abs=or,s.acos=ar,s.acosh=ur,s.add=cr,s.asin=hr,s.asinh=lr,s.atan=fr,s.atanh=pr,s.atan2=gr,s.cbrt=dr,s.ceil=vr,s.clamp=mr,s.cos=xr,s.cosh=wr,s.div=Sr,s.exp=Er,s.floor=br,s.hypot=Fr,s.ln=Cr,s.log=Dr,s.log10=Ir,s.log2=Pr,s.max=Tr,s.min=Rr,s.mod=Nr,s.mul=_r,s.pow=Or,s.random=Br,s.round=jr,s.sign=Hr,s.sin=kr,s.sinh=Lr,s.sqrt=Vr,s.sub=Mr,s.sum=qr,s.tan=Kr,s.tanh=Ur,s.trunc=zr,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}(ye);ve=new Wr(ve),me=new Wr(me);var Gr=Wr;const $r=Gr.clone({precision:40,rounding:Gr.ROUND_HALF_UP});function Jr(t,e){return function(){return t.apply(e,arguments)}}const{toString:Yr}=Object.prototype,{getPrototypeOf:Xr}=Object,{iterator:Zr,toStringTag:Qr}=Symbol,tn=(en=Object.create(null),t=>{const e=Yr.call(t);return en[e]||(en[e]=e.slice(8,-1).toLowerCase())});var en;const rn=t=>(t=t.toLowerCase(),e=>tn(e)===t),nn=t=>e=>typeof e===t,{isArray:sn}=Array,on=nn("undefined");function an(t){return null!==t&&!on(t)&&null!==t.constructor&&!on(t.constructor)&&hn(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const un=rn("ArrayBuffer");const cn=nn("string"),hn=nn("function"),ln=nn("number"),fn=t=>null!==t&&"object"==typeof t,pn=t=>{if("object"!==tn(t))return!1;const e=Xr(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Qr in t||Zr in t)},gn=rn("Date"),dn=rn("File"),vn=rn("Blob"),mn=rn("FileList"),yn=rn("URLSearchParams"),[xn,wn,Sn,En]=["ReadableStream","Request","Response","Headers"].map(rn);function bn(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let n,i;if("object"!=typeof t&&(t=[t]),sn(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{if(an(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 Fn(t,e){if(an(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 An="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Cn=t=>!on(t)&&t!==An;const Dn=(Pn="undefined"!=typeof Uint8Array&&Xr(Uint8Array),t=>Pn&&t instanceof Pn);var Pn;const In=rn("HTMLFormElement"),Tn=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Rn=rn("RegExp"),Nn=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};bn(r,(r,i)=>{let s;!1!==(s=e(r,i,t))&&(n[i]=s||r)}),Object.defineProperties(t,n)};const _n=rn("AsyncFunction"),On=(Bn="function"==typeof setImmediate,jn=hn(An.postMessage),Bn?setImmediate:jn?(Hn=`axios@${Math.random()}`,kn=[],An.addEventListener("message",({source:t,data:e})=>{t===An&&e===Hn&&kn.length&&kn.shift()()},!1),t=>{kn.push(t),An.postMessage(Hn,"*")}):t=>setTimeout(t));var Bn,jn,Hn,kn;const Ln="undefined"!=typeof queueMicrotask?queueMicrotask.bind(An):"undefined"!=typeof process&&process.nextTick||On;var Vn={isArray:sn,isArrayBuffer:un,isBuffer:an,isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||hn(t.append)&&("formdata"===(e=tn(t))||"object"===e&&hn(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&un(t.buffer),e},isString:cn,isNumber:ln,isBoolean:t=>!0===t||!1===t,isObject:fn,isPlainObject:pn,isEmptyObject:t=>{if(!fn(t)||an(t))return!1;try{return 0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype}catch(t){return!1}},isReadableStream:xn,isRequest:wn,isResponse:Sn,isHeaders:En,isUndefined:on,isDate:gn,isFile:dn,isBlob:vn,isRegExp:Rn,isFunction:hn,isStream:t=>fn(t)&&hn(t.pipe),isURLSearchParams:yn,isTypedArray:Dn,isFileList:mn,forEach:bn,merge:function t(){const{caseless:e}=Cn(this)&&this||{},r={},n=(n,i)=>{const s=e&&Fn(r,i)||i;pn(r[s])&&pn(n)?r[s]=t(r[s],n):pn(n)?r[s]=t({},n):sn(n)?r[s]=n.slice():r[s]=n};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&bn(arguments[t],n);return r},extend:(t,e,r,{allOwnKeys:n}={})=>(bn(e,(e,n)=>{r&&hn(e)?t[n]=Jr(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&&Xr(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:tn,kindOfTest:rn,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(sn(t))return t;let e=t.length;if(!ln(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[Zr]).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:In,hasOwnProperty:Tn,hasOwnProp:Tn,reduceDescriptors:Nn,freezeMethods:t=>{Nn(t,(e,r)=>{if(hn(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=t[r];hn(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 sn(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:Fn,global:An,isContextDefined:Cn,isSpecCompliantForm:function(t){return!!(t&&hn(t.append)&&"FormData"===t[Qr]&&t[Zr])},toJSONObject:t=>{const e=new Array(10),r=(t,n)=>{if(fn(t)){if(e.indexOf(t)>=0)return;if(an(t))return t;if(!("toJSON"in t)){e[n]=t;const i=sn(t)?[]:{};return bn(t,(t,e)=>{const s=r(t,n+1);!on(s)&&(i[e]=s)}),e[n]=void 0,i}}return t};return r(t,0)},isAsyncFn:_n,isThenable:t=>t&&(fn(t)||hn(t))&&hn(t.then)&&hn(t.catch),setImmediate:On,asap:Ln,isIterable:t=>null!=t&&hn(t[Zr])};function Mn(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)}Vn.inherits(Mn,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:Vn.toJSONObject(this.config),code:this.code,status:this.status}}});const qn=Mn.prototype,Kn={};["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=>{Kn[t]={value:t}}),Object.defineProperties(Mn,Kn),Object.defineProperty(qn,"isAxiosError",{value:!0}),Mn.from=(t,e,r,n,i,s)=>{const o=Object.create(qn);return Vn.toFlatObject(t,o,function(t){return t!==Error.prototype},t=>"isAxiosError"!==t),Mn.call(o,t.message,e,r,n,i),o.cause=t,o.name=t.name,s&&Object.assign(o,s),o};function Un(t){return Vn.isPlainObject(t)||Vn.isArray(t)}function zn(t){return Vn.endsWith(t,"[]")?t.slice(0,-2):t}function Wn(t,e,r){return t?t.concat(e).map(function(t,e){return t=zn(t),!r&&e?"["+t+"]":t}).join(r?".":""):e}const Gn=Vn.toFlatObject(Vn,{},null,function(t){return/^is[A-Z]/.test(t)});function $n(t,e,r){if(!Vn.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const n=(r=Vn.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(t,e){return!Vn.isUndefined(e[t])})).metaTokens,i=r.visitor||c,s=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Vn.isSpecCompliantForm(e);if(!Vn.isFunction(i))throw new TypeError("visitor must be a function");function u(t){if(null===t)return"";if(Vn.isDate(t))return t.toISOString();if(Vn.isBoolean(t))return t.toString();if(!a&&Vn.isBlob(t))throw new Mn("Blob is not supported. Use a Buffer instead.");return Vn.isArrayBuffer(t)||Vn.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(Vn.endsWith(r,"{}"))r=n?r:r.slice(0,-2),t=JSON.stringify(t);else if(Vn.isArray(t)&&function(t){return Vn.isArray(t)&&!t.some(Un)}(t)||(Vn.isFileList(t)||Vn.endsWith(r,"[]"))&&(a=Vn.toArray(t)))return r=zn(r),a.forEach(function(t,n){!Vn.isUndefined(t)&&null!==t&&e.append(!0===o?Wn([r],n,s):null===o?r:r+"[]",u(t))}),!1;return!!Un(t)||(e.append(Wn(i,r,s),u(t)),!1)}const h=[],l=Object.assign(Gn,{defaultVisitor:c,convertValue:u,isVisitable:Un});if(!Vn.isObject(t))throw new TypeError("data must be an object");return function t(r,n){if(!Vn.isUndefined(r)){if(-1!==h.indexOf(r))throw Error("Circular reference detected in "+n.join("."));h.push(r),Vn.forEach(r,function(r,s){!0===(!(Vn.isUndefined(r)||null===r)&&i.call(e,r,Vn.isString(s)?s.trim():s,n,l))&&t(r,n?n.concat(s):[s])}),h.pop()}}(t),e}function Jn(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(t){return e[t]})}function Yn(t,e){this._pairs=[],t&&$n(t,this,e)}const Xn=Yn.prototype;function Zn(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Qn(t,e,r){if(!e)return t;const n=r&&r.encode||Zn;Vn.isFunction(r)&&(r={serialize:r});const i=r&&r.serialize;let s;if(s=i?i(e,r):Vn.isURLSearchParams(e)?e.toString():new Yn(e,r).toString(n),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}Xn.append=function(t,e){this._pairs.push([t,e])},Xn.toString=function(t){const e=t?function(e){return t.call(this,e,Jn)}:Jn;return this._pairs.map(function(t){return e(t[0])+"="+e(t[1])},"").join("&")};var ti=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){Vn.forEach(this.handlers,function(e){null!==e&&t(e)})}},ei={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ri={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Yn,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const ni="undefined"!=typeof window&&"undefined"!=typeof document,ii="object"==typeof navigator&&navigator||void 0,si=ni&&(!ii||["ReactNative","NativeScript","NS"].indexOf(ii.product)<0),oi="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,ai=ni&&window.location.href||"http://localhost";var ui={...Object.freeze({__proto__:null,hasBrowserEnv:ni,hasStandardBrowserEnv:si,hasStandardBrowserWebWorkerEnv:oi,navigator:ii,origin:ai}),...ri};function ci(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&&Vn.isArray(n)?n.length:s,a)return Vn.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!o;n[s]&&Vn.isObject(n[s])||(n[s]=[]);return e(t,r,n[s],i)&&Vn.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(Vn.isFormData(t)&&Vn.isFunction(t.entries)){const r={};return Vn.forEachEntry(t,(t,n)=>{e(function(t){return Vn.matchAll(/\w+|\[(\w*)]/g,t).map(t=>"[]"===t[0]?"":t[1]||t[0])}(t),n,r,0)}),r}return null}const hi={transitional:ei,adapter:["xhr","http","fetch"],transformRequest:[function(t,e){const r=e.getContentType()||"",n=r.indexOf("application/json")>-1,i=Vn.isObject(t);i&&Vn.isHTMLForm(t)&&(t=new FormData(t));if(Vn.isFormData(t))return n?JSON.stringify(ci(t)):t;if(Vn.isArrayBuffer(t)||Vn.isBuffer(t)||Vn.isStream(t)||Vn.isFile(t)||Vn.isBlob(t)||Vn.isReadableStream(t))return t;if(Vn.isArrayBufferView(t))return t.buffer;if(Vn.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 $n(t,new ui.classes.URLSearchParams,{visitor:function(t,e,r,n){return ui.isNode&&Vn.isBuffer(t)?(this.append(e,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...e})}(t,this.formSerializer).toString();if((s=Vn.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return $n(s?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||n?(e.setContentType("application/json",!1),function(t,e,r){if(Vn.isString(t))try{return(e||JSON.parse)(t),Vn.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(r||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||hi.transitional,r=e&&e.forcedJSONParsing,n="json"===this.responseType;if(Vn.isResponse(t)||Vn.isReadableStream(t))return t;if(t&&Vn.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 Mn.from(t,Mn.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:ui.classes.FormData,Blob:ui.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Vn.forEach(["delete","get","head","post","put","patch"],t=>{hi.headers[t]={}});var li=hi;const fi=Vn.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 pi=Symbol("internals");function gi(t){return t&&String(t).trim().toLowerCase()}function di(t){return!1===t||null==t?t:Vn.isArray(t)?t.map(di):String(t)}function vi(t,e,r,n,i){return Vn.isFunction(n)?n.call(this,e,r):(i&&(e=r),Vn.isString(e)?Vn.isString(n)?-1!==e.indexOf(n):Vn.isRegExp(n)?n.test(e):void 0:void 0)}class mi{constructor(t){t&&this.set(t)}set(t,e,r){const n=this;function i(t,e,r){const i=gi(e);if(!i)throw new Error("header name must be a non-empty string");const s=Vn.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||e]=di(t))}const s=(t,e)=>Vn.forEach(t,(t,r)=>i(t,r,e));if(Vn.isPlainObject(t)||t instanceof this.constructor)s(t,e);else if(Vn.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]&&fi[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(Vn.isObject(t)&&Vn.isIterable(t)){let r,n,i={};for(const e of t){if(!Vn.isArray(e))throw TypeError("Object iterator must return a key-value pair");i[n=e[0]]=(r=i[n])?Vn.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=gi(t)){const r=Vn.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(Vn.isFunction(e))return e.call(this,t,r);if(Vn.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=gi(t)){const r=Vn.findKey(this,t);return!(!r||void 0===this[r]||e&&!vi(0,this[r],r,e))}return!1}delete(t,e){const r=this;let n=!1;function i(t){if(t=gi(t)){const i=Vn.findKey(r,t);!i||e&&!vi(0,r[i],i,e)||(delete r[i],n=!0)}}return Vn.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&&!vi(0,this[i],i,t,!0)||(delete this[i],n=!0)}return n}normalize(t){const e=this,r={};return Vn.forEach(this,(n,i)=>{const s=Vn.findKey(r,i);if(s)return e[s]=di(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]=di(n),r[o]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Vn.forEach(this,(r,n)=>{null!=r&&!1!==r&&(e[n]=t&&Vn.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[pi]=this[pi]={accessors:{}}).accessors,r=this.prototype;function n(t){const n=gi(t);e[n]||(!function(t,e){const r=Vn.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 Vn.isArray(t)?t.forEach(n):n(t),this}}mi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Vn.reduceDescriptors(mi.prototype,({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}}),Vn.freezeMethods(mi);var yi=mi;function xi(t,e){const r=this||li,n=e||r,i=yi.from(n.headers);let s=n.data;return Vn.forEach(t,function(t){s=t.call(r,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function wi(t){return!(!t||!t.__CANCEL__)}function Si(t,e,r){Mn.call(this,null==t?"canceled":t,Mn.ERR_CANCELED,e,r),this.name="CanceledError"}function Ei(t,e,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(new Mn("Request failed with status code "+r.status,[Mn.ERR_BAD_REQUEST,Mn.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}Vn.inherits(Si,Mn,{__CANCEL__:!0});const bi=(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)},Fi=(t,e)=>{const r=null!=t;return[n=>e[0]({lengthComputable:r,total:t,loaded:n}),e[1]]},Ai=t=>(...e)=>Vn.asap(()=>t(...e));var Ci=ui.hasStandardBrowserEnv?((t,e)=>r=>(r=new URL(r,ui.origin),t.protocol===r.protocol&&t.host===r.host&&(e||t.port===r.port)))(new URL(ui.origin),ui.navigator&&/(msie|trident)/i.test(ui.navigator.userAgent)):()=>!0,Di=ui.hasStandardBrowserEnv?{write(t,e,r,n,i,s){const o=[t+"="+encodeURIComponent(e)];Vn.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Vn.isString(n)&&o.push("path="+n),Vn.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 Pi(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 Ii=t=>t instanceof yi?{...t}:t;function Ti(t,e){e=e||{};const r={};function n(t,e,r,n){return Vn.isPlainObject(t)&&Vn.isPlainObject(e)?Vn.merge.call({caseless:n},t,e):Vn.isPlainObject(e)?Vn.merge({},e):Vn.isArray(e)?e.slice():e}function i(t,e,r,i){return Vn.isUndefined(e)?Vn.isUndefined(t)?void 0:n(void 0,t,0,i):n(t,e,0,i)}function s(t,e){if(!Vn.isUndefined(e))return n(void 0,e)}function o(t,e){return Vn.isUndefined(e)?Vn.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(Ii(t),Ii(e),0,!0)};return Vn.forEach(Object.keys({...t,...e}),function(n){const s=u[n]||i,o=s(t[n],e[n],n);Vn.isUndefined(o)&&s!==a||(r[n]=o)}),r}var Ri=t=>{const e=Ti({},t);let r,{data:n,withXSRFToken:i,xsrfHeaderName:s,xsrfCookieName:o,headers:a,auth:u}=e;if(e.headers=a=yi.from(a),e.url=Qn(Pi(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),u&&a.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),Vn.isFormData(n))if(ui.hasStandardBrowserEnv||ui.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(ui.hasStandardBrowserEnv&&(i&&Vn.isFunction(i)&&(i=i(e)),i||!1!==i&&Ci(e.url))){const t=s&&o&&Di.read(o);t&&a.set(s,t)}return e};var Ni="undefined"!=typeof XMLHttpRequest&&function(t){return new Promise(function(e,r){const n=Ri(t);let i=n.data;const s=yi.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=yi.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());Ei(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 Mn("Request aborted",Mn.ECONNABORTED,t,d)),d=null)},d.onerror=function(){r(new Mn("Network Error",Mn.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||ei;n.timeoutErrorMessage&&(e=n.timeoutErrorMessage),r(new Mn(e,i.clarifyTimeoutError?Mn.ETIMEDOUT:Mn.ECONNABORTED,t,d)),d=null},void 0===i&&s.setContentType(null),"setRequestHeader"in d&&Vn.forEach(s.toJSON(),function(t,e){d.setRequestHeader(e,t)}),Vn.isUndefined(n.withCredentials)||(d.withCredentials=!!n.withCredentials),l&&"json"!==l&&(d.responseType=n.responseType),p&&([u,h]=bi(p,!0),d.addEventListener("progress",u)),f&&d.upload&&([a,c]=bi(f),d.upload.addEventListener("progress",a),d.upload.addEventListener("loadend",c)),(n.cancelToken||n.signal)&&(o=e=>{d&&(r(!e||e.type?new Si(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===ui.protocols.indexOf(m)?r(new Mn("Unsupported protocol "+m+":",Mn.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,o();const e=t instanceof Error?t:this.reason;n.abort(e instanceof Mn?e:new Si(e instanceof Error?e.message:e))}};let s=e&&setTimeout(()=>{s=null,i(new Mn(`timeout ${e} of ms exceeded`,Mn.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=()=>Vn.asap(o),a}};const Oi=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},Bi=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()}},ji=(t,e,r,n)=>{const i=async function*(t,e){for await(const r of Bi(t))yield*Oi(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})},Hi="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,ki=Hi&&"function"==typeof ReadableStream,Li=Hi&&("function"==typeof TextEncoder?(Vi=new TextEncoder,t=>Vi.encode(t)):async t=>new Uint8Array(await new Response(t).arrayBuffer()));var Vi;const Mi=(t,...e)=>{try{return!!t(...e)}catch(t){return!1}},qi=ki&&Mi(()=>{let t=!1;const e=new Request(ui.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),Ki=ki&&Mi(()=>Vn.isReadableStream(new Response("").body)),Ui={stream:Ki&&(t=>t.body)};var zi;Hi&&(zi=new Response,["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Ui[t]&&(Ui[t]=Vn.isFunction(zi[t])?e=>e[t]():(e,r)=>{throw new Mn(`Response type '${t}' is not supported`,Mn.ERR_NOT_SUPPORT,r)})}));const Wi=async(t,e)=>{const r=Vn.toFiniteNumber(t.getContentLength());return null==r?(async t=>{if(null==t)return 0;if(Vn.isBlob(t))return t.size;if(Vn.isSpecCompliantForm(t)){const e=new Request(ui.origin,{method:"POST",body:t});return(await e.arrayBuffer()).byteLength}return Vn.isArrayBufferView(t)||Vn.isArrayBuffer(t)?t.byteLength:(Vn.isURLSearchParams(t)&&(t+=""),Vn.isString(t)?(await Li(t)).byteLength:void 0)})(e):r};var Gi=Hi&&(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}=Ri(t);c=c?(c+"").toLowerCase():"text";let p,g=_i([i,s&&s.toAbortSignal()],o);const d=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let v;try{if(u&&qi&&"get"!==r&&"head"!==r&&0!==(v=await Wi(h,n))){let t,r=new Request(e,{method:"POST",body:n,duplex:"half"});if(Vn.isFormData(n)&&(t=r.headers.get("content-type"))&&h.setContentType(t),r.body){const[t,e]=Fi(v,bi(Ai(u)));n=ji(r.body,65536,t,e)}}Vn.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=Ki&&("stream"===c||"response"===c);if(Ki&&(a||o&&d)){const t={};["status","statusText","headers"].forEach(e=>{t[e]=s[e]});const e=Vn.toFiniteNumber(s.headers.get("content-length")),[r,n]=a&&Fi(e,bi(Ai(a),!0))||[];s=new Response(ji(s.body,65536,r,()=>{n&&n(),d&&d()}),t)}c=c||"text";let m=await Ui[Vn.findKey(Ui,c)||"text"](s,t);return!o&&d&&d(),await new Promise((e,r)=>{Ei(e,r,{data:m,headers:yi.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 Mn("Network Error",Mn.ERR_NETWORK,t,p),{cause:e.cause||e});throw Mn.from(e,e&&e.code,t,p)}});const $i={http:null,xhr:Ni,fetch:Gi};Vn.forEach($i,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}});const Ji=t=>`- ${t}`,Yi=t=>Vn.isFunction(t)||null===t||!1===t;var Xi=t=>{t=Vn.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,!Yi(r)&&(n=$i[(e=String(r)).toLowerCase()],void 0===n))throw new Mn(`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 Mn("There is no suitable adapter to dispatch the request "+(e?t.length>1?"since :\n"+t.map(Ji).join("\n"):" "+Ji(t[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n};function Zi(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Si(null,t)}function Qi(t){Zi(t),t.headers=yi.from(t.headers),t.data=xi.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Xi(t.adapter||li.adapter)(t).then(function(e){return Zi(t),e.data=xi.call(t,t.transformResponse,e),e.headers=yi.from(e.headers),e},function(e){return wi(e)||(Zi(t),e&&e.response&&(e.response.data=xi.call(t,t.transformResponse,e.response),e.response.headers=yi.from(e.response.headers))),Promise.reject(e)})}const ts="1.11.0",es={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{es[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const rs={};es.transitional=function(t,e,r){function n(t,e){return"[Axios v"+ts+"] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,i,s)=>{if(!1===t)throw new Mn(n(i," has been removed"+(e?" in "+e:"")),Mn.ERR_DEPRECATED);return e&&!rs[i]&&(rs[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)}},es.spelling=function(t){return(e,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};var ns={assertOptions:function(t,e,r){if("object"!=typeof t)throw new Mn("options must be an object",Mn.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 Mn("option "+s+" must be "+r,Mn.ERR_BAD_OPTION_VALUE);continue}if(!0!==r)throw new Mn("Unknown option "+s,Mn.ERR_BAD_OPTION)}},validators:es};const is=ns.validators;class ss{constructor(t){this.defaults=t||{},this.interceptors={request:new ti,response:new ti}}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=Ti(this.defaults,e);const{transitional:r,paramsSerializer:n,headers:i}=e;void 0!==r&&ns.assertOptions(r,{silentJSONParsing:is.transitional(is.boolean),forcedJSONParsing:is.transitional(is.boolean),clarifyTimeoutError:is.transitional(is.boolean)},!1),null!=n&&(Vn.isFunction(n)?e.paramsSerializer={serialize:n}:ns.assertOptions(n,{encode:is.function,serialize:is.function},!0)),void 0!==e.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?e.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:e.allowAbsoluteUrls=!0),ns.assertOptions(e,{baseUrl:is.spelling("baseURL"),withXsrfToken:is.spelling("withXSRFToken")},!0),e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=i&&Vn.merge(i.common,i[e.method]);i&&Vn.forEach(["delete","get","head","post","put","patch","common"],t=>{delete i[t]}),e.headers=yi.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=[Qi.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=Qi.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 Qn(Pi((t=Ti(this.defaults,t)).baseURL,t.url,t.allowAbsoluteUrls),t.params,t.paramsSerializer)}}Vn.forEach(["delete","get","head","options"],function(t){ss.prototype[t]=function(e,r){return this.request(Ti(r||{},{method:t,url:e,data:(r||{}).data}))}}),Vn.forEach(["post","put","patch"],function(t){function e(e){return function(r,n,i){return this.request(Ti(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}ss.prototype[t]=e(),ss.prototype[t+"Form"]=e(!0)});var os=ss;class as{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 Si(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 as(function(e){t=e}),cancel:t}}}var us=as;const cs={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(cs).forEach(([t,e])=>{cs[e]=t});var hs=cs;const ls=function t(e){const r=new os(e),n=Jr(os.prototype.request,r);return Vn.extend(n,os.prototype,r,{allOwnKeys:!0}),Vn.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return t(Ti(e,r))},n}(li);ls.Axios=os,ls.CanceledError=Si,ls.CancelToken=us,ls.isCancel=wi,ls.VERSION=ts,ls.toFormData=$n,ls.AxiosError=Mn,ls.Cancel=ls.CanceledError,ls.all=function(t){return Promise.all(t)},ls.spread=function(t){return function(e){return t.apply(null,e)}},ls.isAxiosError=function(t){return Vn.isObject(t)&&!0===t.isAxiosError},ls.mergeConfig=Ti,ls.AxiosHeaders=yi,ls.formToJSON=t=>ci(Vn.isHTMLForm(t)?new FormData(t):t),ls.getAdapter=Xi,ls.HttpStatusCode=hs,ls.default=ls;var fs=ls,ps={exports:{}};
|
|
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
35
|
/**
|
|
36
36
|
* @license
|
|
37
37
|
* Lodash <https://lodash.com/>
|
|
@@ -40,5 +40,5 @@ var le,fe,pe=9e15,ge=1e9,de="0123456789abcdef",ve="2.302585092994045684017991454
|
|
|
40
40
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
41
41
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
42
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({"&":"&","<":"<",">":">",'"':""","'":"'"});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({"&":"&","<":"<",">":">",""":'"',"'":"'"});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)}(ps,ps.exports);var gs=ps.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=$r,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=fs.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=gs.get(t,"response.status"),i=gs.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=gs.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.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.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 $r(0);if(!/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(r))throw new Error(`${e}请输入有效数字`);const n=new $r(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.version="0.3.9",exports.whiteList=["/login","/404","/403","/register","/pay","/file-views","/iitc","/users/info"];
|
|
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({"&":"&","<":"<",">":">",'"':""","'":"'"});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({"&":"&","<":"<",">":">",""":'"',"'":"'"});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"];
|
|
44
44
|
//# sourceMappingURL=jiezhangxin-utils.cjs.js.map
|