>3,e,r);if(null==n)return null;var o=this.doPublic(n);if(null==o)return null;var s=o.toString(16);return 0==(1&s.length)?s:\"0\"+s},He.prototype.type=\"RSA\",Ve.prototype.equals=function Xe(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},Ve.prototype.toBigInteger=function $e(){return this.x},Ve.prototype.negate=function Qe(){return new Ve(this.q,this.x.negate().mod(this.q))},Ve.prototype.add=function Ze(t){return new Ve(this.q,this.x.add(t.toBigInteger()).mod(this.q))},Ve.prototype.subtract=function tr(t){return new Ve(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},Ve.prototype.multiply=function er(t){return new Ve(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},Ve.prototype.square=function rr(){return new Ve(this.q,this.x.square().mod(this.q))},Ve.prototype.divide=function nr(t){return new Ve(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},Ke.prototype.getX=function ir(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Ke.prototype.getY=function or(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},Ke.prototype.equals=function sr(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(F.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(F.ZERO))},Ke.prototype.isInfinity=function ar(){return null==this.x&&null==this.y||this.z.equals(F.ZERO)&&!this.y.toBigInteger().equals(F.ZERO)},Ke.prototype.negate=function ur(){return new Ke(this.curve,this.x,this.y.negate(),this.z)},Ke.prototype.add=function cr(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(F.ZERO.equals(r))return F.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new F(\"3\"),i=this.x.toBigInteger(),o=this.y.toBigInteger(),s=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),a=s.multiply(r),u=i.multiply(s),c=e.square().multiply(this.z),h=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(a).multiply(r).mod(this.curve.q),l=u.multiply(n).multiply(e).subtract(o.multiply(a)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(a)).mod(this.curve.q),f=a.multiply(this.z).multiply(t.z).mod(this.curve.q);return new Ke(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(l),f)},Ke.prototype.twice=function hr(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new F(\"3\"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),o=this.curve.a.toBigInteger(),s=e.square().multiply(t);F.ZERO.equals(o)||(s=s.add(this.z.square().multiply(o)));var a=(s=s.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=s.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(s.square().multiply(s)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new Ke(this.curve,this.curve.fromBigInteger(a),this.curve.fromBigInteger(u),c)},Ke.prototype.multiply=function lr(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new F(\"3\")),i=this.negate(),o=this,s=this.curve.q.subtract(t),a=s.multiply(new F(\"3\")),u=new Ke(this.curve,this.x,this.y),c=u.negate();for(e=n.bitLength()-2;e>0;--e){o=o.twice();var h=n.testBit(e);h!=r.testBit(e)&&(o=o.add(h?this:i))}for(e=a.bitLength()-2;e>0;--e){u=u.twice();var l=a.testBit(e);l!=s.testBit(e)&&(u=u.add(l?u:c))}return o},Ke.prototype.multiplyTwo=function fr(t,e,r){var n;n=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),o=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?i=r.testBit(n)?i.add(o):i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i},qe.prototype.getQ=function gr(){return this.q},qe.prototype.getA=function dr(){return this.a},qe.prototype.getB=function pr(){return this.b},qe.prototype.equals=function vr(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},qe.prototype.getInfinity=function yr(){return this.infinity},qe.prototype.fromBigInteger=function mr(t){return new Ve(this.q,t)},qe.prototype.decodePointHex=function _r(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var e=(t.length-2)/2,r=t.substr(2,e),n=t.substr(e+2,e);return new Ke(this,this.fromBigInteger(new F(r,16)),this.fromBigInteger(new F(n,16)));default:return null}},\n/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib\n */\nVe.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},Ke.prototype.getEncoded=function(t){var e=function t(e,r){var n=e.toByteArrayUnsigned();if(rn.length;)n.unshift(0);return n},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},Ke.decodeFrom=function(t,e){e[0];var r=e.length-1,n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var o=new F(n),s=new F(i);return new Ke(t,t.fromBigInteger(o),t.fromBigInteger(s))},Ke.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),o=new F(n,16),s=new F(i,16);return new Ke(t,t.fromBigInteger(o),t.fromBigInteger(s))},Ke.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 Ke(this.curve,n,i)},Ke.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(F.valueOf(2)),e=this.curve.fromBigInteger(F.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 Ke(this.curve,n,i)},Ke.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 F(\"3\")),i=this.negate(),o=this;for(e=n.bitLength()-2;e>0;--e){o=o.twice();var s=n.testBit(e);s!=r.testBit(e)&&(o=o.add2D(s?this:i))}return o},Ke.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(),o=e.multiply(e).mod(i),s=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return o.equals(s)},Ke.prototype.toString=function(){return\"(\"+this.getX().toBigInteger().toString()+\",\"+this.getY().toBigInteger().toString()+\")\"},Ke.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(F.ONE)<0||e.compareTo(t.subtract(F.ONE))>0)throw new Error(\"x coordinate out of bounds\");if(r.compareTo(F.ONE)<0||r.compareTo(t.subtract(F.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};\n/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval\n */\nvar Sr=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\"),n={'\"':'\"',\"/\":\"/\",\"\\\\\":\"\\\\\",b:\"\\b\",f:\"\\f\",n:\"\\n\",r:\"\\r\",t:\"\\t\"};function i(t,e,r){return e?n[e]:String.fromCharCode(parseInt(r,16))}var o=new String(\"\"),s=Object.hasOwnProperty;return function(n,a){var u,c,h=n.match(t),l=h[0],f=!1;\"{\"===l?u={}:\"[\"===l?u=[]:(u=[],f=!0);for(var g=[u],d=1-f,p=h.length;d=0;)delete i[o[h]]}return a.call(e,n,i)}({\"\":u},\"\")}return u}}();void 0!==br&&br||(e.KJUR=br={}),void 0!==br.asn1&&br.asn1||(br.asn1={}),br.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){var e=t.toString(16);if(\"-\"!=e.substr(0,1))e.length%2==1?e=\"0\"+e:e.match(/^[0-7]/)||(e=\"00\"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n=\"\",i=0;i15)throw\"ASN.1 length too long to represent by 8x: n = \"+t.toString(16);return(128+r).toString(16)+e},this.getEncodedHex=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.getValueHex=function(){return this.getEncodedHex(),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)},br.asn1.DERAbstractString=function(t){br.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=Dr(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))},o.lang.extend(br.asn1.DERAbstractString,br.asn1.ASN1Object),br.asn1.DERAbstractTime=function(t){br.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),o=String(i.getFullYear());\"utc\"==e&&(o=o.substr(2,2));var s=o+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);s=s+\".\"+(u=u.replace(/[0]+$/,\"\"))}}return s+\"Z\"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join(\"0\")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=Pr(t)},this.setByDateValue=function(t,e,r,n,i,o){var s=new Date(Date.UTC(t,e-1,r,n,i,o,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},o.lang.extend(br.asn1.DERAbstractTime,br.asn1.ASN1Object),br.asn1.DERAbstractStructured=function(t){br.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)},o.lang.extend(br.asn1.DERAbstractStructured,br.asn1.ASN1Object),br.asn1.DERBoolean=function(t){br.asn1.DERBoolean.superclass.constructor.call(this),this.hT=\"01\",this.hTLV=0==t?\"010100\":\"0101ff\"},o.lang.extend(br.asn1.DERBoolean,br.asn1.ASN1Object),br.asn1.DERInteger=function(t){br.asn1.DERInteger.superclass.constructor.call(this),this.hT=\"02\",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=br.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new F(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.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):\"number\"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},o.lang.extend(br.asn1.DERInteger,br.asn1.ASN1Object),br.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=br.asn1.ASN1Util.newObject(t.obj);t.hex=\"00\"+e.getEncodedHex()}br.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||7i.length&&(i=n[r]);return(t=t.replace(i,\"::\")).slice(1,-1)}function Yr(t){var e=\"malformed hex value\";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?zr(t):t;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}}function Gr(t){for(var e=encodeURIComponent(t),r=\"\",n=0;n\"7\"?\"00\"+t:t}Er.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=n)break}return s},Er.getNthChildIdx=function(t,e,r){return Er.getChildIdx(t,e)[r]},Er.getIdxbyList=function(t,e,r,n){var i,o,s=Er;return 0==r.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(i=r.shift())>=(o=s.getChildIdx(t,e)).length?-1:s.getIdxbyList(t,o[i],r,n)},Er.getIdxbyListEx=function(t,e,r,n){var i,o,s=Er;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),o=s.getChildIdx(t,e);for(var a=0,u=0;u=t.length?null:i.getTLV(t,o)},Er.getTLVbyListEx=function(t,e,r,n){var i=Er,o=i.getIdxbyListEx(t,e,r,n);return-1==o?null:i.getTLV(t,o)},Er.getVbyList=function(t,e,r,n,i){var o,s,a=Er;return-1==(o=a.getIdxbyList(t,e,r,n))||o>=t.length?null:(s=a.getV(t,o),!0===i&&(s=s.substr(2)),s)},Er.getVbyListEx=function(t,e,r,n,i){var o,s,a=Er;return-1==(o=a.getIdxbyListEx(t,e,r,n))?null:(s=a.getV(t,o),\"03\"==t.substr(o,2)&&!1!==i&&(s=s.substr(2)),s)},Er.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=Er.getV(t,e);return\"02\"==n?parseInt(i,16):function o(t){try{var e=t.substr(0,2);if(\"00\"==e)return parseInt(t.substr(2),16);var r=parseInt(e,16),n=t.substr(2),i=parseInt(n,16).toString(2);return\"0\"==i&&(i=\"00000000\"),i=i.slice(0,0-r),parseInt(i,2)}catch(t){return-1}}(i)}catch(t){return r}},Er.getOID=function(t,e,r){null==r&&(r=null);try{return\"06\"!=t.substr(e,2)?r:function n(t){if(!Xr(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),o=[],s=0;s0&&(c=c+\".\"+a.join(\".\")),c}catch(t){return null}}(Er.getV(t,e))}catch(t){return r}},Er.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=Er.getOID(t,e,r);if(n==r)return r;var i=br.asn1.x509.OID.oid2name(n);return\"\"==i?n:i}catch(t){return r}},Er.getString=function(t,e,r){null==r&&(r=null);try{return Nr(Er.getV(t,e))}catch(t){return r}},Er.hextooidstr=function(t){var e=function t(e,r){return e.length>=r?e:new Array(r-e.length+1).join(\"0\")+e},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 o=t.substr(2),s=[],a=0;a0&&(h=h+\".\"+u.join(\".\")),h},Er.dump=function(t,e,r,n){var i=Er,o=i.getV,s=i.dump,a=i.getChildIdx,u=t;t instanceof br.asn1.ASN1Object&&(u=t.getEncodedHex());var c=function t(e,r){return e.length<=2*r?e:e.substr(0,r)+\"..(total \"+e.length/2+\"bytes)..\"+e.substr(e.length-r,r)};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=o(u,r))?n+\"BOOLEAN FALSE\\n\":n+\"BOOLEAN TRUE\\n\";if(\"02\"==h)return n+\"INTEGER \"+c(f=o(u,r),l)+\"\\n\";if(\"03\"==h){var f=o(u,r);if(i.isASN1HEX(f.substr(2))){var g=n+\"BITSTRING, encapsulates\\n\";return g+=s(f.substr(2),e,0,n+\" \")}return n+\"BITSTRING \"+c(f,l)+\"\\n\"}if(\"04\"==h){f=o(u,r);if(i.isASN1HEX(f)){g=n+\"OCTETSTRING, encapsulates\\n\";return g+=s(f,e,0,n+\" \")}return n+\"OCTETSTRING \"+c(f,l)+\"\\n\"}if(\"05\"==h)return n+\"NULL\\n\";if(\"06\"==h){var d=o(u,r),p=br.asn1.ASN1Util.oidHexToInt(d),v=br.asn1.x509.OID.oid2name(p),y=p.replace(/\\./g,\" \");return\"\"!=v?n+\"ObjectIdentifier \"+v+\" (\"+y+\")\\n\":n+\"ObjectIdentifier (\"+y+\")\\n\"}if(\"0a\"==h)return n+\"ENUMERATED \"+parseInt(o(u,r))+\"\\n\";if(\"0c\"==h)return n+\"UTF8String '\"+Lr(o(u,r))+\"'\\n\";if(\"13\"==h)return n+\"PrintableString '\"+Lr(o(u,r))+\"'\\n\";if(\"14\"==h)return n+\"TeletexString '\"+Lr(o(u,r))+\"'\\n\";if(\"16\"==h)return n+\"IA5String '\"+Lr(o(u,r))+\"'\\n\";if(\"17\"==h)return n+\"UTCTime \"+Lr(o(u,r))+\"\\n\";if(\"18\"==h)return n+\"GeneralizedTime \"+Lr(o(u,r))+\"\\n\";if(\"1a\"==h)return n+\"VisualString '\"+Lr(o(u,r))+\"'\\n\";if(\"1e\"==h)return n+\"BMPString '\"+Lr(o(u,r))+\"'\\n\";if(\"30\"==h){if(\"3000\"==u.substr(r,4))return n+\"SEQUENCE {}\\n\";g=n+\"SEQUENCE\\n\";var m=e;if((2==(b=a(u,r)).length||3==b.length)&&\"06\"==u.substr(b[0],2)&&\"04\"==u.substr(b[b.length-1],2)){v=i.oidname(o(u,b[0]));var _=JSON.parse(JSON.stringify(e));_.x509ExtName=v,m=_}for(var S=0;S31)&&(128==(192&r)&&(31&r)==n))}catch(t){return!1}},Er.isASN1HEX=function(t){var e=Er;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},Er.checkStrictDER=function(t,e,r,n,i){var o=Er;if(void 0===r){if(\"string\"!=typeof t)throw new Error(\"not hex string\");if(t=t.toLowerCase(),!br.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(o.getL(t,e).length>2*i)throw new Error(\"L of TLV too long: idx=\"+e);var s=o.getVblen(t,e);if(s>n)throw new Error(\"value of L too long than hex: idx=\"+e);var a=o.getTLV(t,e),u=a.length-2-o.getL(t,e).length;if(u!==2*s)throw new Error(\"V string length and L's value not the same:\"+u+\"/\"+2*s);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=o.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=o.getVblen(t,e),f=0,g=o.getChildIdx(t,e),d=0;d=r?e:new Array(r-e.length+1).join(n)+e};void 0!==br&&br||(e.KJUR=br={}),void 0!==br.crypto&&br.crypto||(br.crypto={}),br.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:y.algo.MD5,sha1:y.algo.SHA1,sha224:y.algo.SHA224,sha256:y.algo.SHA256,sha384:y.algo.SHA384,sha512:y.algo.SHA512,ripemd160:y.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 o=\"0001\",s=\"00\"+n,a=\"\",u=i-o.length-s.length,c=0;c=0)return!1;if(r.compareTo(n.ONE)<0||r.compareTo(o)>=0)return!1;var a=r.modInverse(o),u=t.multiply(a).mod(o),c=e.multiply(a).mod(o);return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(o).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 r=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:n.fromByteArrayUnsigned(r),s:n.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 r=this.ecparams.n;return{r:n.fromByteArrayUnsigned(t.slice(1,33)).mod(r),s:n.fromByteArrayUnsigned(t.slice(33,65)).mod(r),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===h(t))throw new Error(\"not ASN.1 hex string\");var e,r,n;try{e=c(t,0,[\"[0]\",0],\"06\"),r=c(t,0,[1],\"04\");try{n=c(t,0,[\"[1]\",0],\"03\")}catch(t){}}catch(t){throw new Error(\"malformed PKCS#1/5 plain ECC private key\")}if(this.curveName=a(e),void 0===this.curveName)throw\"unsupported curve name\";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===h(t))throw new e(\"not ASN.1 hex string\");var r,n,i;try{c(t,0,[1,0],\"06\"),r=c(t,0,[1,1],\"06\"),n=c(t,0,[2,0,1],\"04\");try{i=c(t,0,[2,0,\"[1]\",0],\"03\")}catch(t){}}catch(t){throw new e(\"malformed PKCS#8 plain ECC private key\")}if(this.curveName=a(r),void 0===this.curveName)throw new e(\"unsupported curve name\");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===h(t))throw new e(\"not ASN.1 hex string\");var r,n;try{c(t,0,[0,0],\"06\"),r=c(t,0,[0,1],\"06\"),n=c(t,0,[1],\"03\")}catch(t){throw new e(\"malformed PKCS#8 ECC public key\")}if(this.curveName=a(r),null===this.curveName)throw new e(\"unsupported curve name\");this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(t,r){if(!1===h(t))throw new e(\"not ASN.1 hex string\");var n,i;try{n=c(t,0,[0,5,0,1],\"06\"),i=c(t,0,[0,5,1],\"03\")}catch(t){throw new e(\"malformed X.509 certificate ECC public key\")}if(this.curveName=a(n),null===this.curveName)throw new e(\"unsupported curve name\");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName=\"secp256r1\"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},br.crypto.ECDSA.parseSigHex=function(t){var e=br.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new F(e.r,16),s:new F(e.s,16)}},br.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=Er,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 o=i[0],s=i[1];if(\"02\"!=t.substr(o,2))throw new Error(\"1st item not ASN.1 integer\");if(\"02\"!=t.substr(s,2))throw new Error(\"2nd item not ASN.1 integer\");return{r:n(t,o),s:n(t,s)}},br.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=br.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;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\"unknown ECDSA sig r length error\";if(n.length%32!=0)throw\"unknown ECDSA sig s length error\";return r+n},br.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length/2*8%128!=0)throw\"unknown ECDSA concatinated r-s sig length error\";var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return br.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},br.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new F(t,16),n=new F(e,16);return br.crypto.ECDSA.biRSSigToASN1Sig(r,n)},br.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=br.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e});return new r.DERSequence({array:[n,i]}).getEncodedHex()},br.crypto.ECDSA.getName=function(t){return\"2b8104001f\"===t?\"secp192k1\":\"2a8648ce3d030107\"===t?\"secp256r1\":\"2b8104000a\"===t?\"secp256k1\":\"2b81040021\"===t?\"secp224r1\":\"2b81040022\"===t?\"secp384r1\":-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\":null},void 0!==br&&br||(e.KJUR=br={}),void 0!==br.crypto&&br.crypto||(br.crypto={}),br.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new F(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,o,s,a,u,c,h,l,f,g,d){t[n]={};var p=r(o),v=r(s),y=r(a),m=r(u),_=r(c),S=new qe(p,v,y),b=S.decodePointHex(\"04\"+h+l);t[n].name=n,t[n].keylen=i,t[n].curve=S,t[n].G=b,t[n].n=m,t[n].h=_,t[n].oid=g,t[n].info=d;for(var w=0;w=2*u)break}var f={};return f.keyhex=c.substr(0,2*i[e].keylen),f.ivhex=c.substr(2*i[e].keylen,2*i[e].ivlen),f},a=function t(e,r,n,o){var s=y.enc.Base64.parse(e),a=y.enc.Hex.stringify(s);return(0,i[r].proc)(a,n,o)};return{version:\"1.0.0\",parsePKCS5PEM:function t(e){return o(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function t(e,r,n){return s(e,r,n)},decryptKeyB64:function t(e,r,n,i){return a(e,r,n,i)},getDecryptedKeyHex:function t(e,r){var n=o(e),i=(n.type,n.cipher),u=n.ivsalt,c=n.data,h=s(i,r,u).keyhex;return a(c,i,h,u)},getEncryptedPKCS5PEMFromPrvKeyHex:function t(e,r,n,o,a){var u=\"\";if(void 0!==o&&null!=o||(o=\"AES-256-CBC\"),void 0===i[o])throw\"KEYUTIL unsupported algorithm: \"+o;void 0!==a&&null!=a||(a=function t(e){var r=y.lib.WordArray.random(e);return y.enc.Hex.stringify(r)}(i[o].ivlen).toUpperCase());var c=function t(e,r,n,o){return(0,i[r].eproc)(e,n,o)}(r,o,s(o,n,a).keyhex,a);u=\"-----BEGIN \"+e+\" PRIVATE KEY-----\\r\\n\";return u+=\"Proc-Type: 4,ENCRYPTED\\r\\n\",u+=\"DEK-Info: \"+o+\",\"+a+\"\\r\\n\",u+=\"\\r\\n\",u+=c.replace(/(.{64})/g,\"$1\\r\\n\"),u+=\"\\r\\n-----END \"+e+\" PRIVATE KEY-----\\r\\n\"},parseHexOfEncryptedPKCS8:function t(e){var r=Er,n=r.getChildIdx,i=r.getV,o={},s=n(e,0);if(2!=s.length)throw\"malformed format: SEQUENCE(0).items != 2: \"+s.length;o.ciphertext=i(e,s[1]);var a=n(e,s[0]);if(2!=a.length)throw\"malformed format: SEQUENCE(0.0).items != 2: \"+a.length;if(\"2a864886f70d01050d\"!=i(e,a[0]))throw\"this only supports pkcs5PBES2\";var u=n(e,a[1]);if(2!=a.length)throw\"malformed format: SEQUENCE(0.0.1).items != 2: \"+u.length;var c=n(e,u[1]);if(2!=c.length)throw\"malformed format: SEQUENCE(0.0.1.1).items != 2: \"+c.length;if(\"2a864886f70d0307\"!=i(e,c[0]))throw\"this only supports TripleDES\";o.encryptionSchemeAlg=\"TripleDES\",o.encryptionSchemeIV=i(e,c[1]);var h=n(e,u[0]);if(2!=h.length)throw\"malformed format: SEQUENCE(0.0.1.0).items != 2: \"+h.length;if(\"2a864886f70d01050c\"!=i(e,h[0]))throw\"this only supports pkcs5PBKDF2\";var l=n(e,h[1]);if(l.length<2)throw\"malformed format: SEQUENCE(0.0.1.0.1).items < 2: \"+l.length;o.pbkdf2Salt=i(e,l[0]);var f=i(e,l[1]);try{o.pbkdf2Iter=parseInt(f,16)}catch(t){throw\"malformed format pbkdf2Iter: \"+f}return o},getPBKDF2KeyHexFromParam:function t(e,r){var n=y.enc.Hex.parse(e.pbkdf2Salt),i=e.pbkdf2Iter,o=y.PBKDF2(r,n,{keySize:6,iterations:i});return y.enc.Hex.stringify(o)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function t(e,r){var n=Hr(e,\"ENCRYPTED PRIVATE KEY\"),i=this.parseHexOfEncryptedPKCS8(n),o=Zr.getPBKDF2KeyHexFromParam(i,r),s={};s.ciphertext=y.enc.Hex.parse(i.ciphertext);var a=y.enc.Hex.parse(o),u=y.enc.Hex.parse(i.encryptionSchemeIV),c=y.TripleDES.decrypt(s,a,{iv:u});return y.enc.Hex.stringify(c)},getKeyFromEncryptedPKCS8PEM:function t(e,r){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,r);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function t(e){var r=Er,n=r.getChildIdx,i=r.getV,o={algparam:null};if(\"30\"!=e.substr(0,2))throw\"malformed plain PKCS8 private key(code:001)\";var s=n(e,0);if(3!=s.length)throw\"malformed plain PKCS8 private key(code:002)\";if(\"30\"!=e.substr(s[1],2))throw\"malformed PKCS8 private key(code:003)\";var a=n(e,s[1]);if(2!=a.length)throw\"malformed PKCS8 private key(code:004)\";if(\"06\"!=e.substr(a[0],2))throw\"malformed PKCS8 private key(code:005)\";if(o.algoid=i(e,a[0]),\"06\"==e.substr(a[1],2)&&(o.algparam=i(e,a[1])),\"04\"!=e.substr(s[2],2))throw\"malformed PKCS8 private key(code:006)\";return o.keyidx=r.getVidx(e,s[2]),o},getKeyFromPlainPrivatePKCS8PEM:function t(e){var r=Hr(e,\"PRIVATE KEY\");return this.getKeyFromPlainPrivatePKCS8Hex(r)},getKeyFromPlainPrivatePKCS8Hex:function t(e){var r,n=this.parsePlainPrivatePKCS8Hex(e);if(\"2a864886f70d010101\"==n.algoid)r=new He;else if(\"2a8648ce380401\"==n.algoid)r=new br.crypto.DSA;else{if(\"2a8648ce3d0201\"!=n.algoid)throw\"unsupported private key algorithm\";r=new br.crypto.ECDSA}return r.readPKCS8PrvKeyHex(e),r},_getKeyFromPublicPKCS8Hex:function t(e){var r,n=Er.getVbyList(e,0,[0,0],\"06\");if(\"2a864886f70d010101\"===n)r=new He;else if(\"2a8648ce380401\"===n)r=new br.crypto.DSA;else{if(\"2a8648ce3d0201\"!==n)throw\"unsupported PKCS#8 public key hex\";r=new br.crypto.ECDSA}return r.readPKCS8PubKeyHex(e),r},parsePublicRawRSAKeyHex:function t(e){var r=Er,n=r.getChildIdx,i=r.getV,o={};if(\"30\"!=e.substr(0,2))throw\"malformed RSA key(code:001)\";var s=n(e,0);if(2!=s.length)throw\"malformed RSA key(code:002)\";if(\"02\"!=e.substr(s[0],2))throw\"malformed RSA key(code:003)\";if(o.n=i(e,s[0]),\"02\"!=e.substr(s[1],2))throw\"malformed RSA key(code:004)\";return o.e=i(e,s[1]),o},parsePublicPKCS8Hex:function t(e){var r=Er,n=r.getChildIdx,i=r.getV,o={algparam:null},s=n(e,0);if(2!=s.length)throw\"outer DERSequence shall have 2 elements: \"+s.length;var a=s[0];if(\"30\"!=e.substr(a,2))throw\"malformed PKCS8 public key(code:001)\";var u=n(e,a);if(2!=u.length)throw\"malformed PKCS8 public key(code:002)\";if(\"06\"!=e.substr(u[0],2))throw\"malformed PKCS8 public key(code:003)\";if(o.algoid=i(e,u[0]),\"06\"==e.substr(u[1],2)?o.algparam=i(e,u[1]):\"30\"==e.substr(u[1],2)&&(o.algparam={},o.algparam.p=r.getVbyList(e,u[1],[0],\"02\"),o.algparam.q=r.getVbyList(e,u[1],[1],\"02\"),o.algparam.g=r.getVbyList(e,u[1],[2],\"02\")),\"03\"!=e.substr(s[1],2))throw\"malformed PKCS8 public key(code:004)\";return o.key=i(e,s[1]).substr(2),o}}}();Zr.getKey=function(t,e,r){var n=(v=Er).getChildIdx,i=(v.getV,v.getVbyList),o=br.crypto,s=o.ECDSA,a=o.DSA,u=He,c=Hr,h=Zr;if(void 0!==u&&t instanceof u)return t;if(void 0!==s&&t instanceof s)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 s({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new s({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(Ir(t.n),Ir(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(Ir(t.n),Ir(t.e),Ir(t.d),Ir(t.p),Ir(t.q),Ir(t.dp),Ir(t.dq),Ir(t.qi)),P;if(\"RSA\"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(P=new u).setPrivate(Ir(t.n),Ir(t.e),Ir(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=(k=new s({curve:t.crv})).ecparams.keylen/4,f=\"04\"+(\"0000000000\"+Ir(t.x)).slice(-l)+(\"0000000000\"+Ir(t.y)).slice(-l);return k.setPublicKeyHex(f),k}if(\"EC\"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){l=(k=new s({curve:t.crv})).ecparams.keylen/4,f=\"04\"+(\"0000000000\"+Ir(t.x)).slice(-l)+(\"0000000000\"+Ir(t.y)).slice(-l);var g=(\"0000000000\"+Ir(t.d)).slice(-l);return k.setPublicKeyHex(f),k.setPrivateKeyHex(g),k}if(\"pkcs5prv\"===r){var d,p=t,v=Er;if(9===(d=n(p,0)).length)(P=new u).readPKCS5PrvKeyHex(p);else if(6===d.length)(P=new a).readPKCS5PrvKeyHex(p);else{if(!(d.length>2&&\"04\"===p.substr(d[1],2)))throw\"unsupported PKCS#1/5 hexadecimal key\";(P=new s).readPKCS5PrvKeyHex(p)}return P}if(\"pkcs8prv\"===r)return P=h.getKeyFromPlainPrivatePKCS8Hex(t);if(\"pkcs8pub\"===r)return h._getKeyFromPublicPKCS8Hex(t);if(\"x509pub\"===r)return on.getPublicKeyFromCertHex(t);if(-1!=t.indexOf(\"-END CERTIFICATE-\",0)||-1!=t.indexOf(\"-END X509 CERTIFICATE-\",0)||-1!=t.indexOf(\"-END TRUSTED CERTIFICATE-\",0))return on.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf(\"-END PUBLIC KEY-\")){var y=Hr(t,\"PUBLIC KEY\");return h._getKeyFromPublicPKCS8Hex(y)}if(-1!=t.indexOf(\"-END RSA PRIVATE KEY-\")&&-1==t.indexOf(\"4,ENCRYPTED\")){var m=c(t,\"RSA PRIVATE KEY\");return h.getKey(m,null,\"pkcs5prv\")}if(-1!=t.indexOf(\"-END DSA PRIVATE KEY-\")&&-1==t.indexOf(\"4,ENCRYPTED\")){var _=i(R=c(t,\"DSA PRIVATE KEY\"),0,[1],\"02\"),S=i(R,0,[2],\"02\"),b=i(R,0,[3],\"02\"),w=i(R,0,[4],\"02\"),E=i(R,0,[5],\"02\");return(P=new a).setPrivate(new F(_,16),new F(S,16),new F(b,16),new F(w,16),new F(E,16)),P}if(-1!=t.indexOf(\"-END EC PRIVATE KEY-\")&&-1==t.indexOf(\"4,ENCRYPTED\")){m=c(t,\"EC PRIVATE KEY\");return h.getKey(m,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 x=h.getDecryptedKeyHex(t,e),A=new He;return A.readPKCS5PrvKeyHex(x),A}if(-1!=t.indexOf(\"-END EC PRIVATE KEY-\")&&-1!=t.indexOf(\"4,ENCRYPTED\")){var k,P=i(R=h.getDecryptedKeyHex(t,e),0,[1],\"04\"),C=i(R,0,[2,0],\"06\"),T=i(R,0,[3,0],\"03\").substr(2);if(void 0===br.crypto.OID.oidhex2name[C])throw\"undefined OID(hex) in KJUR.crypto.OID: \"+C;return(k=new s({curve:br.crypto.OID.oidhex2name[C]})).setPublicKeyHex(T),k.setPrivateKeyHex(P),k.isPublic=!1,k}if(-1!=t.indexOf(\"-END DSA PRIVATE KEY-\")&&-1!=t.indexOf(\"4,ENCRYPTED\")){var R;_=i(R=h.getDecryptedKeyHex(t,e),0,[1],\"02\"),S=i(R,0,[2],\"02\"),b=i(R,0,[3],\"02\"),w=i(R,0,[4],\"02\"),E=i(R,0,[5],\"02\");return(P=new a).setPrivate(new F(_,16),new F(S,16),new F(b,16),new F(w,16),new F(E,16)),P}if(-1!=t.indexOf(\"-END ENCRYPTED PRIVATE KEY-\"))return h.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error(\"not supported argument\")},Zr.generateKeypair=function(t,e){if(\"RSA\"==t){var r=e;(s=new He).generate(r,\"10001\"),s.isPrivate=!0,s.isPublic=!0;var n=new He,i=s.n.toString(16),o=s.e.toString(16);return n.setPublic(i,o),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}if(\"EC\"==t){var s,a,u=e,c=new br.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new br.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(n=new br.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(a={}).prvKeyObj=s,a.pubKeyObj=n,a}throw\"unknown algorithm: \"+t},Zr.getPEM=function(t,e,r,n,i,o){var s=br,a=s.asn1,u=a.DERObjectIdentifier,c=a.DERInteger,h=a.ASN1Util.newObject,l=a.x509.SubjectPublicKeyInfo,f=s.crypto,g=f.DSA,d=f.ECDSA,p=He;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 _(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!==p&&t instanceof p||void 0!==g&&t instanceof g||void 0!==d&&t instanceof d)&&1==t.isPublic&&(void 0===e||\"PKCS8PUB\"==e))return Mr(F=new l(t).getEncodedHex(),\"PUBLIC KEY\");if(\"PKCS1PRV\"==e&&void 0!==p&&t instanceof p&&(void 0===r||null==r)&&1==t.isPrivate)return Mr(F=v(t).getEncodedHex(),\"RSA PRIVATE KEY\");if(\"PKCS1PRV\"==e&&void 0!==d&&t instanceof d&&(void 0===r||null==r)&&1==t.isPrivate){var S=new u({name:t.curveName}).getEncodedHex(),b=m(t).getEncodedHex(),w=\"\";return w+=Mr(S,\"EC PARAMETERS\"),w+=Mr(b,\"EC PRIVATE KEY\")}if(\"PKCS1PRV\"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate)return Mr(F=_(t).getEncodedHex(),\"DSA PRIVATE KEY\");if(\"PKCS5PRV\"==e&&void 0!==p&&t instanceof p&&void 0!==r&&null!=r&&1==t.isPrivate){var F=v(t).getEncodedHex();return void 0===n&&(n=\"DES-EDE3-CBC\"),this.getEncryptedPKCS5PEMFromPrvKeyHex(\"RSA\",F,r,n,o)}if(\"PKCS5PRV\"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate){F=m(t).getEncodedHex();return void 0===n&&(n=\"DES-EDE3-CBC\"),this.getEncryptedPKCS5PEMFromPrvKeyHex(\"EC\",F,r,n,o)}if(\"PKCS5PRV\"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate){F=_(t).getEncodedHex();return void 0===n&&(n=\"DES-EDE3-CBC\"),this.getEncryptedPKCS5PEMFromPrvKeyHex(\"DSA\",F,r,n,o)}var E=function t(e,r){var n=x(e,r);return new h({seq:[{seq:[{oid:{name:\"pkcs5PBES2\"}},{seq:[{seq:[{oid:{name:\"pkcs5PBKDF2\"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:\"des-EDE3-CBC\"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},x=function t(e,r){var n=y.lib.WordArray.random(8),i=y.lib.WordArray.random(8),o=y.PBKDF2(r,n,{keySize:6,iterations:100}),s=y.enc.Hex.parse(e),a=y.TripleDES.encrypt(s,o,{iv:i})+\"\",u={};return u.ciphertext=a,u.pbkdf2Salt=y.enc.Hex.stringify(n),u.pbkdf2Iter=100,u.encryptionSchemeAlg=\"DES-EDE3-CBC\",u.encryptionSchemeIV=y.enc.Hex.stringify(i),u};if(\"PKCS8PRV\"==e&&null!=p&&t instanceof p&&1==t.isPrivate){var A=v(t).getEncodedHex();F=h({seq:[{int:0},{seq:[{oid:{name:\"rsaEncryption\"}},{null:!0}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?Mr(F,\"PRIVATE KEY\"):Mr(b=E(F,r),\"ENCRYPTED PRIVATE KEY\")}if(\"PKCS8PRV\"==e&&void 0!==d&&t instanceof d&&1==t.isPrivate){A=new h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:[\"a1\",!0,{bitstr:{hex:\"00\"+t.pubKeyHex}}]}]}).getEncodedHex(),F=h({seq:[{int:0},{seq:[{oid:{name:\"ecPublicKey\"}},{oid:{name:t.curveName}}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?Mr(F,\"PRIVATE KEY\"):Mr(b=E(F,r),\"ENCRYPTED PRIVATE KEY\")}if(\"PKCS8PRV\"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){A=new c({bigint:t.x}).getEncodedHex(),F=h({seq:[{int:0},{seq:[{oid:{name:\"dsa\"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:A}}]}).getEncodedHex();return void 0===r||null==r?Mr(F,\"PRIVATE KEY\"):Mr(b=E(F,r),\"ENCRYPTED PRIVATE KEY\")}throw new Error(\"unsupported object nor format\")},Zr.getKeyFromCSRPEM=function(t){var e=Hr(t,\"CERTIFICATE REQUEST\");return Zr.getKeyFromCSRHex(e)},Zr.getKeyFromCSRHex=function(t){var e=Zr.parseCSRHex(t);return Zr.getKey(e.p8pubkeyhex,null,\"pkcs8pub\")},Zr.parseCSRHex=function(t){var e=Er,r=e.getChildIdx,n=e.getTLV,i={},o=t;if(\"30\"!=o.substr(0,2))throw\"malformed CSR(code:001)\";var s=r(o,0);if(s.length<1)throw\"malformed CSR(code:002)\";if(\"30\"!=o.substr(s[0],2))throw\"malformed CSR(code:003)\";var a=r(o,s[0]);if(a.length<3)throw\"malformed CSR(code:004)\";return i.p8pubkeyhex=n(o,a[2]),i},Zr.getKeyID=function(t){var e=Zr,r=Er;\"string\"==typeof t&&-1!=t.indexOf(\"BEGIN \")&&(t=e.getKey(t));var n=Hr(e.getPEM(t)),i=r.getIdxbyList(n,0,[1]),o=r.getV(n,i).substring(2);return br.crypto.Util.hashHex(o,\"sha1\")},Zr.getJWKFromKey=function(t){var e={};if(t instanceof He&&t.isPrivate)return e.kty=\"RSA\",e.n=Rr(t.n.toString(16)),e.e=Rr(t.e.toString(16)),e.d=Rr(t.d.toString(16)),e.p=Rr(t.p.toString(16)),e.q=Rr(t.q.toString(16)),e.dp=Rr(t.dmp1.toString(16)),e.dq=Rr(t.dmq1.toString(16)),e.qi=Rr(t.coeff.toString(16)),e;if(t instanceof He&&t.isPublic)return e.kty=\"RSA\",e.n=Rr(t.n.toString(16)),e.e=Rr(t.e.toString(16)),e;if(t instanceof br.crypto.ECDSA&&t.isPrivate){if(\"P-256\"!==(n=t.getShortNISTPCurveName())&&\"P-384\"!==n)throw\"unsupported curve name for JWT: \"+n;var r=t.getPublicKeyXYHex();return e.kty=\"EC\",e.crv=n,e.x=Rr(r.x),e.y=Rr(r.y),e.d=Rr(t.prvKeyHex),e}if(t instanceof br.crypto.ECDSA&&t.isPublic){var n;if(\"P-256\"!==(n=t.getShortNISTPCurveName())&&\"P-384\"!==n)throw\"unsupported curve name for JWT: \"+n;r=t.getPublicKeyXYHex();return e.kty=\"EC\",e.crv=n,e.x=Rr(r.x),e.y=Rr(r.y),e}throw\"not supported key object\"},He.getPosArrayOfChildrenFromHex=function(t){return Er.getChildIdx(t,0)},He.getHexValueArrayOfChildrenFromHex=function(t){var e,r=Er.getV,n=r(t,(e=He.getPosArrayOfChildrenFromHex(t))[0]),i=r(t,e[1]),o=r(t,e[2]),s=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,o,s,a,u,c,h,l),e},He.prototype.readPrivateKeyFromPEMString=function(t){var e=Hr(t),r=He.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},He.prototype.readPKCS5PrvKeyHex=function(t){var e=He.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},He.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,o,s,a,u,c=Er,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\"),o=h(t,0,[2,0,5],\"02\"),s=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,o,s,a,u)},He.prototype.readPKCS5PubKeyHex=function(t){var e=Er,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]),o=r(t,n[1]);this.setPublic(i,o)},He.prototype.readPKCS8PubKeyHex=function(t){var e=Er;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)},He.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new on).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)};var tn=new RegExp(\"[^0-9a-f]\",\"gi\");function en(t,e){for(var r=\"\",n=e/4-t.length,i=0;i>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function nn(t){for(var e in br.crypto.Util.DIGESTINFOHEAD){var r=br.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function on(t){var e,r=Er,n=r.getChildIdx,i=r.getV,o=r.getTLV,s=r.getVbyList,a=r.getVbyListEx,u=r.getTLVbyList,c=r.getTLVbyListEx,h=r.getIdxbyList,l=r.getIdxbyListEx,f=r.getVidx,g=r.oidname,d=r.hextooidstr,p=on,v=Hr;try{e=br.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(){return null===this.hex||0!==this.version?this.version:\"a003020102\"!==u(this.hex,0,[0,0])?(this.version=1,this.foffset=-1,1):(this.version=3,3)},this.getSerialNumberHex=function(){return a(this.hex,0,[0,0],\"02\")},this.getSignatureAlgorithmField=function(){var t=c(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 g(a(t,0,[0],\"06\"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],\"30\")},this.getIssuerString=function(){return p.hex2dn(this.getIssuerHex())},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],\"30\")},this.getSubjectString=function(){return p.hex2dn(this.getSubjectHex())},this.getNotBefore=function(){var t=s(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,\"%$1\"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=s(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,\"%$1\"),t=decodeURIComponent(t)},this.getPublicKeyHex=function(){return r.getTLVbyList(this.hex,0,[0,6+this.foffset],\"30\")},this.getPublicKeyIdx=function(){return h(this.hex,0,[0,6+this.foffset],\"30\")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return h(this.hex,t,[1,0],\"30\")},this.getPublicKey=function(){return Zr.getKey(this.getPublicKeyHex(),null,\"pkcs8pub\")},this.getSignatureAlgorithmName=function(){var t=u(this.hex,0,[1],\"30\");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],\"03\",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),r=this.getSignatureValueHex(),n=u(this.hex,0,[0],\"30\"),i=new br.crypto.Signature({alg:e});return i.init(t),i.updateHex(n),i.verify(r)},this.parseExt=function(t){var e,o,a;if(void 0===t){if(a=this.hex,3!==this.version)return-1;e=h(a,0,[0,7,0],\"30\"),o=n(a,e)}else{a=Hr(t);var u=h(a,0,[0,3,0,0],\"06\");if(\"2a864886f70d01090e\"!=i(a,u))return void(this.aExtInfo=new Array);e=h(a,0,[0,3,0,1,0],\"30\"),o=n(a,e),this.hex=a}this.aExtInfo=new Array;for(var c=0;c1){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.getX500NameRule=function(t){for(var e=null,r=[],n=0;n0&&(t.ext=this.getExtParamArray()),t.sighex=this.getSignatureValueHex(),t},this.getExtParamArray=function(t){null==t&&(-1!=l(this.hex,0,[0,\"[3]\"])&&(t=c(this.hex,0,[0,\"[3]\",0],\"30\")));for(var e=[],r=n(t,0),i=0;i0&&(c=new Array(r),(new Oe).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=Nr(u(Ur(\"\\0\\0\\0\\0\\0\\0\\0\\0\"+i+c))),l=[];for(n=0;n>8*a-s&255;for(d[0]&=~p,n=0;nthis.n.bitLength())return 0;var n=nn(this.doPublic(r).toString(16).replace(/^1f+00/,\"\"));if(0==n.length)return!1;var i=n[0];return n[1]==function t(e){return br.crypto.Util.hashString(e,i)}(t)},He.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=je(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=nn(this.doPublic(r).toString(16).replace(/^1f+00/,\"\"));if(0==n.length)return!1;n[0];return n[1]==t},He.prototype.verifyPSS=function(t,e,r,n){var i=function t(e){return br.crypto.Util.hashHex(e,r)}(Ur(t));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(i,e,r,n)},He.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,o=new F(e,16),s=function t(e){return br.crypto.Util.hashHex(e,r)},a=Nr(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>8*h-c&255;if(0!=(f.charCodeAt(0)&d))throw new Error(\"bits beyond keysize not zero\");var p=rn(g,f.length,s),v=[];for(i=0;i0)&&-1==(\":\"+n.join(\":\")+\":\").indexOf(\":\"+v+\":\"))throw\"algorithm '\"+v+\"' not accepted in the list\";if(\"none\"!=v&&null===e)throw\"key shall be specified to verify.\";if(\"string\"==typeof e&&-1!=e.indexOf(\"-----BEGIN \")&&(e=Zr.getKey(e)),!(\"RS\"!=y&&\"PS\"!=y||e instanceof i))throw\"key shall be a RSAKey obj for RS* and PS* algs\";if(\"ES\"==y&&!(e instanceof c))throw\"key shall be a ECDSA obj for ES* algs\";var m=null;if(void 0===s.jwsalg2sigalg[p.alg])throw\"unsupported alg name: \"+v;if(\"none\"==(m=s.jwsalg2sigalg[v]))throw\"not supported\";if(\"Hmac\"==m.substr(0,4)){if(void 0===e)throw\"hexadecimal key shall be specified for HMAC\";var _=new h({alg:m,pass:e});return _.updateString(g),d==_.doFinal()}if(-1!=m.indexOf(\"withECDSA\")){var S,b=null;try{b=c.concatSigToASN1Sig(d)}catch(t){return!1}return(S=new l({alg:m})).init(e),S.updateString(g),S.verify(b)}return(S=new l({alg:m})).init(e),S.updateString(g),S.verify(d)},br.jws.JWS.parse=function(t){var e,r,n,i=t.split(\".\"),o={};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]),o.headerObj=br.jws.JWS.readSafeJSONString(Fr(e)),o.payloadObj=br.jws.JWS.readSafeJSONString(Fr(r)),o.headerPP=JSON.stringify(o.headerObj,null,\" \"),null==o.payloadObj?o.payloadPP=Fr(r):o.payloadPP=JSON.stringify(o.payloadObj,null,\" \"),void 0!==n&&(o.sigHex=Ir(n)),o},br.jws.JWS.verifyJWT=function(t,e,n){var i=br.jws,o=i.JWS,s=o.readSafeJSONString,a=o.inArray,u=o.includedArray,c=t.split(\".\"),h=c[0],l=c[1],f=(Ir(c[2]),s(Fr(h))),g=s(Fr(l));if(void 0===f.alg)return!1;if(void 0===n.alg)throw\"acceptField.alg shall be specified\";if(!a(f.alg,n.alg))return!1;if(void 0!==g.iss&&\"object\"===r(n.iss)&&!a(g.iss,n.iss))return!1;if(void 0!==g.sub&&\"object\"===r(n.sub)&&!a(g.sub,n.sub))return!1;if(void 0!==g.aud&&\"object\"===r(n.aud))if(\"string\"==typeof g.aud){if(!a(g.aud,n.aud))return!1}else if(\"object\"==r(g.aud)&&!u(g.aud,n.aud))return!1;var d=i.IntDate.getNow();return void 0!==n.verifyAt&&\"number\"==typeof n.verifyAt&&(d=n.verifyAt),void 0!==n.gracePeriod&&\"number\"==typeof n.gracePeriod||(n.gracePeriod=0),!(void 0!==g.exp&&\"number\"==typeof g.exp&&g.exp+n.gracePeriodr.length&&(n=r.length);for(var i=0;i\n * @license MIT\n */\nvar n=r(30),i=r(31),o=r(32);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError(\"Attempt to allocate Buffer larger than maximum size: 0x\"+s().toString(16)+\" bytes\");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if(\"undefined\"!=typeof ArrayBuffer&&\"function\"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;\"string\"!=typeof t&&(t=\"\"+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case\"ascii\":case\"latin1\":case\"binary\":return r;case\"utf8\":case\"utf-8\":case void 0:return K(t).length;case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return 2*r;case\"hex\":return r>>>1;case\"base64\":return q(t).length;default:if(n)return K(t).length;e=(\"\"+e).toLowerCase(),n=!0}}function p(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return\"\";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return\"\";if((r>>>=0)<=(e>>>=0))return\"\";for(t||(t=\"utf8\");;)switch(t){case\"hex\":return I(this,e,r);case\"utf8\":case\"utf-8\":return A(this,e,r);case\"ascii\":return T(this,e,r);case\"latin1\":case\"binary\":return R(this,e,r);case\"base64\":return x(this,e,r);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return D(this,e,r);default:if(n)throw new TypeError(\"Unknown encoding: \"+t);t=(t+\"\").toLowerCase(),n=!0}}function v(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function y(t,e,r,n,i){if(0===t.length)return-1;if(\"string\"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if(\"string\"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:m(t,e,r,n,i);if(\"number\"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&\"function\"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):m(t,[e],r,n,i);throw new TypeError(\"val must be string, number or Buffer\")}function m(t,e,r,n,i){var o,s=1,a=t.length,u=e.length;if(void 0!==n&&(\"ucs2\"===(n=String(n).toLowerCase())||\"ucs-2\"===n||\"utf16le\"===n||\"utf-16le\"===n)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,r/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var h=-1;for(o=r;oa&&(r=a-u),o=r;o>=0;o--){for(var l=!0,f=0;fi&&(n=i):n=i;var o=e.length;if(o%2!=0)throw new TypeError(\"Invalid hex string\");n>o/2&&(n=o/2);for(var s=0;s>8,i=r%256,o.push(i),o.push(n);return o}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function A(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:c>223?3:c>191?2:1;if(i+l<=r)switch(l){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[i+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,l=1):h>65535&&(h-=65536,n.push(h>>>10&1023|55296),h=56320|1023&h),n.push(h),i+=l}return function f(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);var r=\"\",n=0;for(;n0&&(r=this.toString(\"hex\",0,n).match(/.{2}/g).join(\" \"),this.length>n&&(r+=\" ... \")),\"\"},u.prototype.compare=function t(e,r,n,i,o){if(!u.isBuffer(e))throw new TypeError(\"Argument must be a Buffer\");if(void 0===r&&(r=0),void 0===n&&(n=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError(\"out of range index\");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(i>>>=0),a=(n>>>=0)-(r>>>=0),c=Math.min(s,a),h=this.slice(i,o),l=e.slice(r,n),f=0;fo)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError(\"Attempt to write outside buffer bounds\");i||(i=\"utf8\");for(var s=!1;;)switch(i){case\"hex\":return _(this,e,r,n);case\"utf8\":case\"utf-8\":return S(this,e,r,n);case\"ascii\":return b(this,e,r,n);case\"latin1\":case\"binary\":return w(this,e,r,n);case\"base64\":return F(this,e,r,n);case\"ucs2\":case\"ucs-2\":case\"utf16le\":case\"utf-16le\":return E(this,e,r,n);default:if(s)throw new TypeError(\"Unknown encoding: \"+i);i=(\"\"+i).toLowerCase(),s=!0}},u.prototype.toJSON=function t(){return{type:\"Buffer\",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function T(t,e,r){var n=\"\";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i=\"\",o=e;or)throw new RangeError(\"Trying to access beyond buffer length\")}function N(t,e,r,n,i,o){if(!u.isBuffer(t))throw new TypeError('\"buffer\" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError(\"Index out of range\")}function U(t,e,r,n){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-r,2);i>>8*(n?i:1-i)}function B(t,e,r,n){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-r,4);i>>8*(n?i:3-i)&255}function O(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError(\"Index out of range\");if(r<0)throw new RangeError(\"Index out of range\")}function j(t,e,r,n,o){return o||O(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function M(t,e,r,n,o){return o||O(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function t(e,r){var n,i=this.length;if((e=~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),(r=void 0===r?i:~~r)<0?(r+=i)<0&&(r=0):r>i&&(r=i),r0&&(o*=256);)i+=this[e+--r]*o;return i},u.prototype.readUInt8=function t(e,r){return r||L(e,1,this.length),this[e]},u.prototype.readUInt16LE=function t(e,r){return r||L(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function t(e,r){return r||L(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function t(e,r){return r||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function t(e,r){return r||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=this[e],o=1,s=0;++s=(o*=128)&&(i-=Math.pow(2,8*r)),i},u.prototype.readIntBE=function t(e,r,n){e|=0,r|=0,n||L(e,r,this.length);for(var i=r,o=1,s=this[e+--i];i>0&&(o*=256);)s+=this[e+--i]*o;return s>=(o*=128)&&(s-=Math.pow(2,8*r)),s},u.prototype.readInt8=function t(e,r){return r||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function t(e,r){r||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function t(e,r){r||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function t(e,r){return r||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function t(e,r){return r||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function t(e,r){return r||L(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function t(e,r){return r||L(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function t(e,r){return r||L(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function t(e,r){return r||L(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function t(e,r,n,i){(e=+e,r|=0,n|=0,i)||N(this,e,r,n,Math.pow(2,8*n)-1,0);var o=1,s=0;for(this[r]=255&e;++s=0&&(s*=256);)this[r+o]=e/s&255;return r+n},u.prototype.writeUInt8=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},u.prototype.writeUInt16LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},u.prototype.writeUInt16BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},u.prototype.writeUInt32LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):B(this,e,r,!0),r+4},u.prototype.writeUInt32BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):B(this,e,r,!1),r+4},u.prototype.writeIntLE=function t(e,r,n,i){if(e=+e,r|=0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=0,a=1,u=0;for(this[r]=255&e;++s>0)-u&255;return r+n},u.prototype.writeIntBE=function t(e,r,n,i){if(e=+e,r|=0,!i){var o=Math.pow(2,8*n-1);N(this,e,r,n,o-1,-o)}var s=n-1,a=1,u=0;for(this[r+s]=255&e;--s>=0&&(a*=256);)e<0&&0===u&&0!==this[r+s+1]&&(u=1),this[r+s]=(e/a>>0)-u&255;return r+n},u.prototype.writeInt8=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[r]=255&e,r+1},u.prototype.writeInt16LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):U(this,e,r,!0),r+2},u.prototype.writeInt16BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):U(this,e,r,!1),r+2},u.prototype.writeInt32LE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):B(this,e,r,!0),r+4},u.prototype.writeInt32BE=function t(e,r,n){return e=+e,r|=0,n||N(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):B(this,e,r,!1),r+4},u.prototype.writeFloatLE=function t(e,r,n){return j(this,e,r,!0,n)},u.prototype.writeFloatBE=function t(e,r,n){return j(this,e,r,!1,n)},u.prototype.writeDoubleLE=function t(e,r,n){return M(this,e,r,!0,n)},u.prototype.writeDoubleBE=function t(e,r,n){return M(this,e,r,!1,n)},u.prototype.copy=function t(e,r,n,i){if(n||(n=0),i||0===i||(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i=this.length)throw new RangeError(\"sourceStart out of bounds\");if(i<0)throw new RangeError(\"sourceEnd out of bounds\");i>this.length&&(i=this.length),e.length-r=0;--o)e[o+r]=this[o+n];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),\"number\"==typeof e)for(s=r;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error(\"Invalid code point\");if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function q(t){return n.toByteArray(function e(t){if((t=function e(t){return t.trim?t.trim():t.replace(/^\\s+|\\s+$/g,\"\")}(t).replace(H,\"\")).length<2)return\"\";for(;t.length%4!=0;)t+=\"=\";return t}(t))}function J(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}}).call(this,r(29))},function(t,e){var r;r=function(){return this}();try{r=r||new Function(\"return this\")()}catch(t){\"object\"==typeof window&&(r=window)}t.exports=r},function(t,e,r){\"use strict\";e.byteLength=function n(t){var e=f(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function i(t){var e,r,n=f(t),i=n[0],o=n[1],s=new u(function c(t,e,r){return 3*(e+r)/4-r}(0,i,o)),h=0,l=o>0?i-4:i;for(r=0;r>16&255,s[h++]=e>>8&255,s[h++]=255&e;2===o&&(e=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,s[h++]=255&e);1===o&&(e=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,s[h++]=e>>8&255,s[h++]=255&e);return s},e.fromByteArray=function o(t){for(var e,r=t.length,n=r%3,i=[],o=16383,a=0,u=r-n;au?u:a+o));1===n?(e=t[r-1],i.push(s[e>>2]+s[e<<4&63]+\"==\")):2===n&&(e=(t[r-2]<<8)+t[r-1],i.push(s[e>>10]+s[e>>4&63]+s[e<<2&63]+\"=\"));return i.join(\"\")};for(var s=[],a=[],u=\"undefined\"!=typeof Uint8Array?Uint8Array:Array,c=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\",h=0,l=c.length;h0)throw new Error(\"Invalid string. Length must be a multiple of 4\");var r=t.indexOf(\"=\");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function g(t,e,r){for(var n,i,o=[],a=e;a>18&63]+s[i>>12&63]+s[i>>6&63]+s[63&i]);return o.join(\"\")}a[\"-\".charCodeAt(0)]=62,a[\"_\".charCodeAt(0)]=63},function(t,e){\n/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\ne.read=function(t,e,r,n,i){var o,s,a=8*i-n-1,u=(1<>1,h=-7,l=r?i-1:0,f=r?-1:1,g=t[e+l];for(l+=f,o=g&(1<<-h)-1,g>>=-h,h+=a;h>0;o=256*o+t[e+l],l+=f,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=n;h>0;s=256*s+t[e+l],l+=f,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(g?-1:1);s+=Math.pow(2,n),o-=c}return(g?-1:1)*s*Math.pow(2,o-n)},e.write=function(t,e,r,n,i,o){var s,a,u,c=8*o-i-1,h=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,g=n?0:o-1,d=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(s++,u/=2),s+l>=h?(a=0,s=h):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+g]=255&a,g+=d,a/=256,i-=8);for(s=s<0;t[r+g]=255&s,g+=d,s/=256,c-=8);t[r+g-d]|=128*p}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return\"[object Array]\"==r.call(t)}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.default=function n(t){var e=t.jws,r=t.KeyUtil,n=t.X509,o=t.crypto,s=t.hextob64u,a=t.b64tohex,u=t.AllowedSigningAlgs;return function(){function t(){!function e(t,r){if(!(t instanceof r))throw new TypeError(\"Cannot call a class as a function\")}(this,t)}return t.parseJwt=function t(r){i.Log.debug(\"JoseUtil.parseJwt\");try{var n=e.JWS.parse(r);return{header:n.headerObj,payload:n.payloadObj}}catch(t){i.Log.error(t)}},t.validateJwt=function e(o,s,u,c,h,l,f){i.Log.debug(\"JoseUtil.validateJwt\");try{if(\"RSA\"===s.kty)if(s.e&&s.n)s=r.getKey(s);else{if(!s.x5c||!s.x5c.length)return i.Log.error(\"JoseUtil.validateJwt: RSA key missing key material\",s),Promise.reject(new Error(\"RSA key missing key material\"));var g=a(s.x5c[0]);s=n.getPublicKeyFromCertHex(g)}else{if(\"EC\"!==s.kty)return i.Log.error(\"JoseUtil.validateJwt: Unsupported key type\",s&&s.kty),Promise.reject(new Error(s.kty));if(!(s.crv&&s.x&&s.y))return i.Log.error(\"JoseUtil.validateJwt: EC key missing key material\",s),Promise.reject(new Error(\"EC key missing key material\"));s=r.getKey(s)}return t._validateJwt(o,s,u,c,h,l,f)}catch(t){return i.Log.error(t&&t.message||t),Promise.reject(\"JWT validation failed\")}},t.validateJwtAttributes=function e(r,n,o,s,a,u){s||(s=0),a||(a=parseInt(Date.now()/1e3));var c=t.parseJwt(r).payload;if(!c.iss)return i.Log.error(\"JoseUtil._validateJwt: issuer was not provided\"),Promise.reject(new Error(\"issuer was not provided\"));if(c.iss!==n)return i.Log.error(\"JoseUtil._validateJwt: Invalid issuer in token\",c.iss),Promise.reject(new Error(\"Invalid issuer in token: \"+c.iss));if(!c.aud)return i.Log.error(\"JoseUtil._validateJwt: aud was not provided\"),Promise.reject(new Error(\"aud was not provided\"));if(!(c.aud===o||Array.isArray(c.aud)&&c.aud.indexOf(o)>=0))return i.Log.error(\"JoseUtil._validateJwt: Invalid audience in token\",c.aud),Promise.reject(new Error(\"Invalid audience in token: \"+c.aud));if(c.azp&&c.azp!==o)return i.Log.error(\"JoseUtil._validateJwt: Invalid azp in token\",c.azp),Promise.reject(new Error(\"Invalid azp in token: \"+c.azp));if(!u){var h=a+s,l=a-s;if(!c.iat)return i.Log.error(\"JoseUtil._validateJwt: iat was not provided\"),Promise.reject(new Error(\"iat was not provided\"));if(h1&&void 0!==arguments[1]?arguments[1]:\"#\";o(this,t);var n=i.UrlUtility.parseUrlFragment(e,r);this.error=n.error,this.error_description=n.error_description,this.error_uri=n.error_uri,this.code=n.code,this.state=n.state,this.id_token=n.id_token,this.session_state=n.session_state,this.access_token=n.access_token,this.token_type=n.token_type,this.scope=n.scope,this.profile=void 0,this.expires_in=n.expires_in}return n(t,[{key:\"expires_in\",get:function t(){if(this.expires_at){var e=parseInt(Date.now()/1e3);return this.expires_at-e}},set:function t(e){var r=parseInt(e);if(\"number\"==typeof r&&r>0){var n=parseInt(Date.now()/1e3);this.expires_at=n+r}}},{key:\"expired\",get:function t(){var e=this.expires_in;if(void 0!==e)return e<=0}},{key:\"scopes\",get:function t(){return(this.scope||\"\").split(\" \")}},{key:\"isOpenIdConnect\",get:function t(){return this.scopes.indexOf(\"openid\")>=0||!!this.id_token}}]),t}()},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SignoutRequest=void 0;var n=r(0),i=r(3),o=r(9);e.SignoutRequest=function t(e){var r=e.url,s=e.id_token_hint,a=e.post_logout_redirect_uri,u=e.data,c=e.extraQueryParams,h=e.request_type;if(function l(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t),!r)throw n.Log.error(\"SignoutRequest.ctor: No url passed\"),new Error(\"url\");for(var f in s&&(r=i.UrlUtility.addQueryParam(r,\"id_token_hint\",s)),a&&(r=i.UrlUtility.addQueryParam(r,\"post_logout_redirect_uri\",a),u&&(this.state=new o.State({data:u,request_type:h}),r=i.UrlUtility.addQueryParam(r,\"state\",this.state.id))),c)r=i.UrlUtility.addQueryParam(r,f,c[f]);this.url=r}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.SignoutResponse=void 0;var n=r(3);e.SignoutResponse=function t(e){!function r(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}(this,t);var i=n.UrlUtility.parseUrlFragment(e,\"?\");this.error=i.error,this.error_description=i.error_description,this.error_uri=i.error_uri,this.state=i.state}},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.InMemoryWebStorage=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c.SilentRenewService,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:h.SessionMonitor,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:f.TokenRevocationClient,l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:g.TokenClient,y=arguments.length>5&&void 0!==arguments[5]?arguments[5]:d.JoseUtil;p(this,e),r instanceof s.UserManagerSettings||(r=new s.UserManagerSettings(r));var m=v(this,t.call(this,r));return m._events=new u.UserManagerEvents(r),m._silentRenewService=new n(m),m.settings.automaticSilentRenew&&(i.Log.debug(\"UserManager.ctor: automaticSilentRenew is configured, setting up silent renew\"),m.startSilentRenew()),m.settings.monitorSession&&(i.Log.debug(\"UserManager.ctor: monitorSession is configured, setting up session monitor\"),m._sessionMonitor=new o(m)),m._tokenRevocationClient=new a(m._settings),m._tokenClient=new l(m._settings),m._joseUtil=y,m}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.getUser=function t(){var e=this;return this._loadUser().then((function(t){return t?(i.Log.info(\"UserManager.getUser: user loaded\"),e._events.load(t,!1),t):(i.Log.info(\"UserManager.getUser: user not found in storage\"),null)}))},e.prototype.removeUser=function t(){var e=this;return this.storeUser(null).then((function(){i.Log.info(\"UserManager.removeUser: user removed from storage\"),e._events.unload()}))},e.prototype.signinRedirect=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"si:r\";var r={useReplaceToNavigate:e.useReplaceToNavigate};return this._signinStart(e,this._redirectNavigator,r).then((function(){i.Log.info(\"UserManager.signinRedirect: successful\")}))},e.prototype.signinRedirectCallback=function t(e){return this._signinEnd(e||this._redirectNavigator.url).then((function(t){return t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinRedirectCallback: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinRedirectCallback: no sub\"),t}))},e.prototype.signinPopup=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"si:p\";var r=e.redirect_uri||this.settings.popup_redirect_uri||this.settings.redirect_uri;return r?(e.redirect_uri=r,e.display=\"popup\",this._signin(e,this._popupNavigator,{startUrl:r,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinPopup: signinPopup successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinPopup: no sub\")),t}))):(i.Log.error(\"UserManager.signinPopup: No popup_redirect_uri or redirect_uri configured\"),Promise.reject(new Error(\"No popup_redirect_uri or redirect_uri configured\")))},e.prototype.signinPopupCallback=function t(e){return this._signinCallback(e,this._popupNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinPopupCallback: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinPopupCallback: no sub\")),t})).catch((function(t){i.Log.error(t.message)}))},e.prototype.signinSilent=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return r=Object.assign({},r),this._loadUser().then((function(t){return t&&t.refresh_token?(r.refresh_token=t.refresh_token,e._useRefreshToken(r)):(r.request_type=\"si:s\",r.id_token_hint=r.id_token_hint||e.settings.includeIdTokenInSilentRenew&&t&&t.id_token,t&&e._settings.validateSubOnSilentRenew&&(i.Log.debug(\"UserManager.signinSilent, subject prior to silent renew: \",t.profile.sub),r.current_sub=t.profile.sub),e._signinSilentIframe(r))}))},e.prototype._useRefreshToken=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._tokenClient.exchangeRefreshToken(r).then((function(t){return t?t.access_token?e._loadUser().then((function(r){if(r){var n=Promise.resolve();return t.id_token&&(n=e._validateIdTokenFromTokenRefreshToken(r.profile,t.id_token)),n.then((function(){return i.Log.debug(\"UserManager._useRefreshToken: refresh token response success\"),r.id_token=t.id_token||r.id_token,r.access_token=t.access_token,r.refresh_token=t.refresh_token||r.refresh_token,r.expires_in=t.expires_in,e.storeUser(r).then((function(){return e._events.load(r),r}))}))}return null})):(i.Log.error(\"UserManager._useRefreshToken: No access token returned from token endpoint\"),Promise.reject(\"No access token returned from token endpoint\")):(i.Log.error(\"UserManager._useRefreshToken: No response returned from token endpoint\"),Promise.reject(\"No response returned from token endpoint\"))}))},e.prototype._validateIdTokenFromTokenRefreshToken=function t(e,r){var n=this;return this._metadataService.getIssuer().then((function(t){return n.settings.getEpochTime().then((function(o){return n._joseUtil.validateJwtAttributes(r,t,n._settings.client_id,n._settings.clockSkew,o).then((function(t){return t?t.sub!==e.sub?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: sub in id_token does not match current sub\"),Promise.reject(new Error(\"sub in id_token does not match current sub\"))):t.auth_time&&t.auth_time!==e.auth_time?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: auth_time in id_token does not match original auth_time\"),Promise.reject(new Error(\"auth_time in id_token does not match original auth_time\"))):t.azp&&t.azp!==e.azp?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: azp in id_token does not match original azp\"),Promise.reject(new Error(\"azp in id_token does not match original azp\"))):!t.azp&&e.azp?(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: azp not in id_token, but present in original id_token\"),Promise.reject(new Error(\"azp not in id_token, but present in original id_token\"))):void 0:(i.Log.error(\"UserManager._validateIdTokenFromTokenRefreshToken: Failed to validate id_token\"),Promise.reject(new Error(\"Failed to validate id_token\")))}))}))}))},e.prototype._signinSilentIframe=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return r?(e.redirect_uri=r,e.prompt=e.prompt||\"none\",this._signin(e,this._iframeNavigator,{startUrl:r,silentRequestTimeout:e.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinSilent: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinSilent: no sub\")),t}))):(i.Log.error(\"UserManager.signinSilent: No silent_redirect_uri configured\"),Promise.reject(new Error(\"No silent_redirect_uri configured\")))},e.prototype.signinSilentCallback=function t(e){return this._signinCallback(e,this._iframeNavigator).then((function(t){return t&&(t.profile&&t.profile.sub?i.Log.info(\"UserManager.signinSilentCallback: successful, signed in sub: \",t.profile.sub):i.Log.info(\"UserManager.signinSilentCallback: no sub\")),t}))},e.prototype.signinCallback=function t(e){var r=this;return this.readSigninResponseState(e).then((function(t){var n=t.state;t.response;return\"si:r\"===n.request_type?r.signinRedirectCallback(e):\"si:p\"===n.request_type?r.signinPopupCallback(e):\"si:s\"===n.request_type?r.signinSilentCallback(e):Promise.reject(new Error(\"invalid response_type in state\"))}))},e.prototype.signoutCallback=function t(e,r){var n=this;return this.readSignoutResponseState(e).then((function(t){var i=t.state,o=t.response;return i?\"so:r\"===i.request_type?n.signoutRedirectCallback(e):\"so:p\"===i.request_type?n.signoutPopupCallback(e,r):Promise.reject(new Error(\"invalid response_type in state\")):o}))},e.prototype.querySessionStatus=function t(){var e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(r=Object.assign({},r)).request_type=\"si:s\";var n=r.redirect_uri||this.settings.silent_redirect_uri||this.settings.redirect_uri;return n?(r.redirect_uri=n,r.prompt=\"none\",r.response_type=r.response_type||this.settings.query_status_response_type,r.scope=r.scope||\"openid\",r.skipUserInfo=!0,this._signinStart(r,this._iframeNavigator,{startUrl:n,silentRequestTimeout:r.silentRequestTimeout||this.settings.silentRequestTimeout}).then((function(t){return e.processSigninResponse(t.url).then((function(t){if(i.Log.debug(\"UserManager.querySessionStatus: got signin response\"),t.session_state&&t.profile.sub)return i.Log.info(\"UserManager.querySessionStatus: querySessionStatus success for sub: \",t.profile.sub),{session_state:t.session_state,sub:t.profile.sub,sid:t.profile.sid};i.Log.info(\"querySessionStatus successful, user not authenticated\")})).catch((function(t){if(t.session_state&&e.settings.monitorAnonymousSession&&(\"login_required\"==t.message||\"consent_required\"==t.message||\"interaction_required\"==t.message||\"account_selection_required\"==t.message))return i.Log.info(\"UserManager.querySessionStatus: querySessionStatus success for anonymous user\"),{session_state:t.session_state};throw t}))}))):(i.Log.error(\"UserManager.querySessionStatus: No silent_redirect_uri configured\"),Promise.reject(new Error(\"No silent_redirect_uri configured\")))},e.prototype._signin=function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signinStart(e,r,i).then((function(t){return n._signinEnd(t.url,e)}))},e.prototype._signinStart=function t(e,r){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.prepare(o).then((function(t){return i.Log.debug(\"UserManager._signinStart: got navigator window handle\"),n.createSigninRequest(e).then((function(e){return i.Log.debug(\"UserManager._signinStart: got signin request\"),o.url=e.url,o.id=e.state.id,t.navigate(o)})).catch((function(e){throw t.close&&(i.Log.debug(\"UserManager._signinStart: Error after preparing navigator, closing navigator window\"),t.close()),e}))}))},e.prototype._signinEnd=function t(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.processSigninResponse(e).then((function(t){i.Log.debug(\"UserManager._signinEnd: got signin response\");var e=new a.User(t);if(n.current_sub){if(n.current_sub!==e.profile.sub)return i.Log.debug(\"UserManager._signinEnd: current user does not match user returned from signin. sub from signin: \",e.profile.sub),Promise.reject(new Error(\"login_required\"));i.Log.debug(\"UserManager._signinEnd: current user matches user returned from signin\")}return r.storeUser(e).then((function(){return i.Log.debug(\"UserManager._signinEnd: user stored\"),r._events.load(e),e}))}))},e.prototype._signinCallback=function t(e,r){i.Log.debug(\"UserManager._signinCallback\");var n=\"query\"===this._settings.response_mode||!this._settings.response_mode&&l.SigninRequest.isCode(this._settings.response_type)?\"?\":\"#\";return r.callback(e,void 0,n)},e.prototype.signoutRedirect=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"so:r\";var r=e.post_logout_redirect_uri||this.settings.post_logout_redirect_uri;r&&(e.post_logout_redirect_uri=r);var n={useReplaceToNavigate:e.useReplaceToNavigate};return this._signoutStart(e,this._redirectNavigator,n).then((function(){i.Log.info(\"UserManager.signoutRedirect: successful\")}))},e.prototype.signoutRedirectCallback=function t(e){return this._signoutEnd(e||this._redirectNavigator.url).then((function(t){return i.Log.info(\"UserManager.signoutRedirectCallback: successful\"),t}))},e.prototype.signoutPopup=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(e=Object.assign({},e)).request_type=\"so:p\";var r=e.post_logout_redirect_uri||this.settings.popup_post_logout_redirect_uri||this.settings.post_logout_redirect_uri;return e.post_logout_redirect_uri=r,e.display=\"popup\",e.post_logout_redirect_uri&&(e.state=e.state||{}),this._signout(e,this._popupNavigator,{startUrl:r,popupWindowFeatures:e.popupWindowFeatures||this.settings.popupWindowFeatures,popupWindowTarget:e.popupWindowTarget||this.settings.popupWindowTarget}).then((function(){i.Log.info(\"UserManager.signoutPopup: successful\")}))},e.prototype.signoutPopupCallback=function t(e,r){void 0===r&&\"boolean\"==typeof e&&(r=e,e=null);return this._popupNavigator.callback(e,r,\"?\").then((function(){i.Log.info(\"UserManager.signoutPopupCallback: successful\")}))},e.prototype._signout=function t(e,r){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this._signoutStart(e,r,i).then((function(t){return n._signoutEnd(t.url)}))},e.prototype._signoutStart=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=this,n=arguments[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.prepare(o).then((function(t){return i.Log.debug(\"UserManager._signoutStart: got navigator window handle\"),r._loadUser().then((function(n){return i.Log.debug(\"UserManager._signoutStart: loaded current user from storage\"),(r._settings.revokeAccessTokenOnSignout?r._revokeInternal(n):Promise.resolve()).then((function(){var s=e.id_token_hint||n&&n.id_token;return s&&(i.Log.debug(\"UserManager._signoutStart: Setting id_token into signout request\"),e.id_token_hint=s),r.removeUser().then((function(){return i.Log.debug(\"UserManager._signoutStart: user removed, creating signout request\"),r.createSignoutRequest(e).then((function(e){return i.Log.debug(\"UserManager._signoutStart: got signout request\"),o.url=e.url,e.state&&(o.id=e.state.id),t.navigate(o)}))}))}))})).catch((function(e){throw t.close&&(i.Log.debug(\"UserManager._signoutStart: Error after preparing navigator, closing navigator window\"),t.close()),e}))}))},e.prototype._signoutEnd=function t(e){return this.processSignoutResponse(e).then((function(t){return i.Log.debug(\"UserManager._signoutEnd: got signout response\"),t}))},e.prototype.revokeAccessToken=function t(){var e=this;return this._loadUser().then((function(t){return e._revokeInternal(t,!0).then((function(r){if(r)return i.Log.debug(\"UserManager.revokeAccessToken: removing token properties from user and re-storing\"),t.access_token=null,t.refresh_token=null,t.expires_at=null,t.token_type=null,e.storeUser(t).then((function(){i.Log.debug(\"UserManager.revokeAccessToken: user stored\"),e._events.load(t)}))}))})).then((function(){i.Log.info(\"UserManager.revokeAccessToken: access token revoked successfully\")}))},e.prototype._revokeInternal=function t(e,r){var n=this;if(e){var o=e.access_token,s=e.refresh_token;return this._revokeAccessTokenInternal(o,r).then((function(t){return n._revokeRefreshTokenInternal(s,r).then((function(e){return t||e||i.Log.debug(\"UserManager.revokeAccessToken: no need to revoke due to no token(s), or JWT format\"),t||e}))}))}return Promise.resolve(!1)},e.prototype._revokeAccessTokenInternal=function t(e,r){return!e||e.indexOf(\".\")>=0?Promise.resolve(!1):this._tokenRevocationClient.revoke(e,r).then((function(){return!0}))},e.prototype._revokeRefreshTokenInternal=function t(e,r){return e?this._tokenRevocationClient.revoke(e,r,\"refresh_token\").then((function(){return!0})):Promise.resolve(!1)},e.prototype.startSilentRenew=function t(){this._silentRenewService.start()},e.prototype.stopSilentRenew=function t(){this._silentRenewService.stop()},e.prototype._loadUser=function t(){return this._userStore.get(this._userStoreKey).then((function(t){return t?(i.Log.debug(\"UserManager._loadUser: user storageString loaded\"),a.User.fromStorageString(t)):(i.Log.debug(\"UserManager._loadUser: no user storageString\"),null)}))},e.prototype.storeUser=function t(e){if(e){i.Log.debug(\"UserManager.storeUser: storing user\");var r=e.toStorageString();return this._userStore.set(this._userStoreKey,r)}return i.Log.debug(\"storeUser.storeUser: removing user\"),this._userStore.remove(this._userStoreKey)},n(e,[{key:\"_redirectNavigator\",get:function t(){return this.settings.redirectNavigator}},{key:\"_popupNavigator\",get:function t(){return this.settings.popupNavigator}},{key:\"_iframeNavigator\",get:function t(){return this.settings.iframeNavigator}},{key:\"_userStore\",get:function t(){return this.settings.userStore}},{key:\"events\",get:function t(){return this._events}},{key:\"_userStoreKey\",get:function t(){return\"user:\"+this.settings.authority+\":\"+this.settings.client_id}}]),e}(o.OidcClient)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.UserManagerSettings=void 0;var n=function(){function t(t,e){for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{},n=r.popup_redirect_uri,i=r.popup_post_logout_redirect_uri,g=r.popupWindowFeatures,d=r.popupWindowTarget,p=r.silent_redirect_uri,v=r.silentRequestTimeout,y=r.automaticSilentRenew,m=void 0!==y&&y,_=r.validateSubOnSilentRenew,S=void 0!==_&&_,b=r.includeIdTokenInSilentRenew,w=void 0===b||b,F=r.monitorSession,E=void 0===F||F,x=r.monitorAnonymousSession,A=void 0!==x&&x,k=r.checkSessionInterval,P=void 0===k?2e3:k,C=r.stopCheckSessionOnError,T=void 0===C||C,R=r.query_status_response_type,I=r.revokeAccessTokenOnSignout,D=void 0!==I&&I,L=r.accessTokenExpiringNotificationTime,N=void 0===L?60:L,U=r.redirectNavigator,B=void 0===U?new o.RedirectNavigator:U,O=r.popupNavigator,j=void 0===O?new s.PopupNavigator:O,M=r.iframeNavigator,H=void 0===M?new a.IFrameNavigator:M,V=r.userStore,K=void 0===V?new u.WebStorageStateStore({store:c.Global.sessionStorage}):V;l(this,e);var q=f(this,t.call(this,arguments[0]));return q._popup_redirect_uri=n,q._popup_post_logout_redirect_uri=i,q._popupWindowFeatures=g,q._popupWindowTarget=d,q._silent_redirect_uri=p,q._silentRequestTimeout=v,q._automaticSilentRenew=m,q._validateSubOnSilentRenew=S,q._includeIdTokenInSilentRenew=w,q._accessTokenExpiringNotificationTime=N,q._monitorSession=E,q._monitorAnonymousSession=A,q._checkSessionInterval=P,q._stopCheckSessionOnError=T,R?q._query_status_response_type=R:arguments[0]&&arguments[0].response_type?q._query_status_response_type=h.SigninRequest.isOidc(arguments[0].response_type)?\"id_token\":\"code\":q._query_status_response_type=\"id_token\",q._revokeAccessTokenOnSignout=D,q._redirectNavigator=B,q._popupNavigator=j,q._iframeNavigator=H,q._userStore=K,q}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),n(e,[{key:\"popup_redirect_uri\",get:function t(){return this._popup_redirect_uri}},{key:\"popup_post_logout_redirect_uri\",get:function t(){return this._popup_post_logout_redirect_uri}},{key:\"popupWindowFeatures\",get:function t(){return this._popupWindowFeatures}},{key:\"popupWindowTarget\",get:function t(){return this._popupWindowTarget}},{key:\"silent_redirect_uri\",get:function t(){return this._silent_redirect_uri}},{key:\"silentRequestTimeout\",get:function t(){return this._silentRequestTimeout}},{key:\"automaticSilentRenew\",get:function t(){return this._automaticSilentRenew}},{key:\"validateSubOnSilentRenew\",get:function t(){return this._validateSubOnSilentRenew}},{key:\"includeIdTokenInSilentRenew\",get:function t(){return this._includeIdTokenInSilentRenew}},{key:\"accessTokenExpiringNotificationTime\",get:function t(){return this._accessTokenExpiringNotificationTime}},{key:\"monitorSession\",get:function t(){return this._monitorSession}},{key:\"monitorAnonymousSession\",get:function t(){return this._monitorAnonymousSession}},{key:\"checkSessionInterval\",get:function t(){return this._checkSessionInterval}},{key:\"stopCheckSessionOnError\",get:function t(){return this._stopCheckSessionOnError}},{key:\"query_status_response_type\",get:function t(){return this._query_status_response_type}},{key:\"revokeAccessTokenOnSignout\",get:function t(){return this._revokeAccessTokenOnSignout}},{key:\"redirectNavigator\",get:function t(){return this._redirectNavigator}},{key:\"popupNavigator\",get:function t(){return this._popupNavigator}},{key:\"iframeNavigator\",get:function t(){return this._iframeNavigator}},{key:\"userStore\",get:function t(){return this._userStore}}]),e}(i.OidcClientSettings)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.RedirectNavigator=void 0;var n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1])||arguments[1];n.Log.debug(\"UserManagerEvents.load\"),t.prototype.load.call(this,r),i&&this._userLoaded.raise(r)},e.prototype.unload=function e(){n.Log.debug(\"UserManagerEvents.unload\"),t.prototype.unload.call(this),this._userUnloaded.raise()},e.prototype.addUserLoaded=function t(e){this._userLoaded.addHandler(e)},e.prototype.removeUserLoaded=function t(e){this._userLoaded.removeHandler(e)},e.prototype.addUserUnloaded=function t(e){this._userUnloaded.addHandler(e)},e.prototype.removeUserUnloaded=function t(e){this._userUnloaded.removeHandler(e)},e.prototype.addSilentRenewError=function t(e){this._silentRenewError.addHandler(e)},e.prototype.removeSilentRenewError=function t(e){this._silentRenewError.removeHandler(e)},e.prototype._raiseSilentRenewError=function t(e){n.Log.debug(\"UserManagerEvents._raiseSilentRenewError\",e.message),this._silentRenewError.raise(e)},e.prototype.addUserSignedIn=function t(e){this._userSignedIn.addHandler(e)},e.prototype.removeUserSignedIn=function t(e){this._userSignedIn.removeHandler(e)},e.prototype._raiseUserSignedIn=function t(){n.Log.debug(\"UserManagerEvents._raiseUserSignedIn\"),this._userSignedIn.raise()},e.prototype.addUserSignedOut=function t(e){this._userSignedOut.addHandler(e)},e.prototype.removeUserSignedOut=function t(e){this._userSignedOut.removeHandler(e)},e.prototype._raiseUserSignedOut=function t(){n.Log.debug(\"UserManagerEvents._raiseUserSignedOut\"),this._userSignedOut.raise()},e.prototype.addUserSessionChanged=function t(e){this._userSessionChanged.addHandler(e)},e.prototype.removeUserSessionChanged=function t(e){this._userSessionChanged.removeHandler(e)},e.prototype._raiseUserSessionChanged=function t(){n.Log.debug(\"UserManagerEvents._raiseUserSessionChanged\"),this._userSessionChanged.raise()},e}(i.AccessTokenEvents)},function(t,e,r){\"use strict\";Object.defineProperty(e,\"__esModule\",{value:!0}),e.Timer=void 0;var n=function(){function t(t,e){for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:o.Global.timer,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;a(this,e);var s=u(this,t.call(this,r));return s._timer=n,s._nowFunc=i||function(){return Date.now()/1e3},s}return function r(t,e){if(\"function\"!=typeof e&&null!==e)throw new TypeError(\"Super expression must either be null or a function, not \"+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),e.prototype.init=function t(e){e<=0&&(e=1),e=parseInt(e);var r=this.now+e;if(this.expiration===r&&this._timerHandle)i.Log.debug(\"Timer.init timer \"+this._name+\" skipping initialization since already initialized for expiration:\",this.expiration);else{this.cancel(),i.Log.debug(\"Timer.init timer \"+this._name+\" for duration:\",e),this._expiration=r;var n=5;e\r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n \r\n \r\n
\r\n
\r\n
\r\n \r\n
\r\n\r\n\r\n\r\n\r\n\r\n","import mod from \"-!../../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LayoutContentRendererLeft.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./LayoutContentRendererLeft.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./LayoutContentRendererLeft.vue?vue&type=template&id=9786c78a&\"\nimport script from \"./LayoutContentRendererLeft.vue?vue&type=script&lang=js&\"\nexport * from \"./LayoutContentRendererLeft.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-nav-item-dropdown',{staticClass:\"dropdown-language\",attrs:{\"id\":\"dropdown-grouped\",\"variant\":\"link\",\"right\":\"\"},scopedSlots:_vm._u([{key:\"button-content\",fn:function(){return [_c('b-img',{attrs:{\"src\":_vm.currentLocale.img,\"height\":\"14px\",\"width\":\"22px\",\"alt\":_vm.currentLocale.locale}}),_c('span',{staticClass:\"ml-50 text-body\"},[_vm._v(_vm._s(_vm.currentLocale.name))])]},proxy:true}])},_vm._l((_vm.locales),function(localeObj){return _c('b-dropdown-item',{key:localeObj.locale,on:{\"click\":function($event){return _vm.changeLocale(localeObj)}}},[_c('b-img',{attrs:{\"src\":localeObj.img,\"height\":\"14px\",\"width\":\"22px\",\"alt\":localeObj.locale}}),_c('span',{staticClass:\"ml-50\"},[_vm._v(_vm._s(localeObj.name))])],1)}),1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\n \r\n \r\n \r\n {{ currentLocale.name }}\r\n \r\n \r\n \r\n {{ localeObj.name }}\r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n","import mod from \"-!../../../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Locale.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./Locale.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Locale.vue?vue&type=template&id=3d9eb919&\"\nimport script from \"./Locale.vue?vue&type=script&lang=js&\"\nexport * from \"./Locale.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Vue, mergeData } from '../../vue';\nimport { NAME_BADGE } from '../../constants/components';\nimport { PROP_TYPE_BOOLEAN, PROP_TYPE_STRING } from '../../constants/props';\nimport { omit, sortKeys } from '../../utils/object';\nimport { makeProp, makePropsConfigurable, pluckProps } from '../../utils/props';\nimport { isLink } from '../../utils/router';\nimport { BLink, props as BLinkProps } from '../link/link'; // --- Props ---\n\nvar linkProps = omit(BLinkProps, ['event', 'routerTag']);\ndelete linkProps.href.default;\ndelete linkProps.to.default;\nexport var props = makePropsConfigurable(sortKeys(_objectSpread(_objectSpread({}, linkProps), {}, {\n pill: makeProp(PROP_TYPE_BOOLEAN, false),\n tag: makeProp(PROP_TYPE_STRING, 'span'),\n variant: makeProp(PROP_TYPE_STRING, 'secondary')\n})), NAME_BADGE); // --- Main component ---\n// @vue/component\n\nexport var BBadge = /*#__PURE__*/Vue.extend({\n name: NAME_BADGE,\n functional: true,\n props: props,\n render: function render(h, _ref) {\n var props = _ref.props,\n data = _ref.data,\n children = _ref.children;\n var active = props.active,\n disabled = props.disabled;\n var link = isLink(props);\n var tag = link ? BLink : props.tag;\n var variant = props.variant || 'secondary';\n return h(tag, mergeData(data, {\n staticClass: 'badge',\n class: [\"badge-\".concat(variant), {\n 'badge-pill': props.pill,\n active: active,\n disabled: disabled\n }],\n props: link ? pluckProps(linkProps, props) : {}\n }), children);\n }\n});","function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && Symbol.iterator in Object(iter)) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport { Vue } from '../../vue';\nimport { NAME_NAV_ITEM_DROPDOWN } from '../../constants/components';\nimport { SLOT_NAME_BUTTON_CONTENT, SLOT_NAME_DEFAULT, SLOT_NAME_TEXT } from '../../constants/slots';\nimport { htmlOrText } from '../../utils/html';\nimport { keys, pick, sortKeys } from '../../utils/object';\nimport { makePropsConfigurable } from '../../utils/props';\nimport { dropdownMixin, props as dropdownProps } from '../../mixins/dropdown';\nimport { idMixin, props as idProps } from '../../mixins/id';\nimport { normalizeSlotMixin } from '../../mixins/normalize-slot';\nimport { props as BDropdownProps } from '../dropdown/dropdown';\nimport { BLink } from '../link/link'; // --- Props ---\n\nexport var props = makePropsConfigurable(sortKeys(_objectSpread(_objectSpread({}, idProps), pick(BDropdownProps, [].concat(_toConsumableArray(keys(dropdownProps)), ['html', 'lazy', 'menuClass', 'noCaret', 'role', 'text', 'toggleClass'])))), NAME_NAV_ITEM_DROPDOWN); // --- Main component ---\n// @vue/component\n\nexport var BNavItemDropdown = /*#__PURE__*/Vue.extend({\n name: NAME_NAV_ITEM_DROPDOWN,\n mixins: [idMixin, dropdownMixin, normalizeSlotMixin],\n props: props,\n computed: {\n toggleId: function toggleId() {\n return this.safeId('_BV_toggle_');\n },\n dropdownClasses: function dropdownClasses() {\n return [this.directionClass, this.boundaryClass, {\n show: this.visible\n }];\n },\n menuClasses: function menuClasses() {\n return [this.menuClass, {\n 'dropdown-menu-right': this.right,\n show: this.visible\n }];\n },\n toggleClasses: function toggleClasses() {\n return [this.toggleClass, {\n 'dropdown-toggle-no-caret': this.noCaret\n }];\n }\n },\n render: function render(h) {\n var toggleId = this.toggleId,\n visible = this.visible,\n hide = this.hide;\n var $toggle = h(BLink, {\n staticClass: 'nav-link dropdown-toggle',\n class: this.toggleClasses,\n props: {\n href: \"#\".concat(this.id || ''),\n disabled: this.disabled\n },\n attrs: {\n id: toggleId,\n role: 'button',\n 'aria-haspopup': 'true',\n 'aria-expanded': visible ? 'true' : 'false'\n },\n on: {\n mousedown: this.onMousedown,\n click: this.toggle,\n keydown: this.toggle // Handle ENTER, SPACE and DOWN\n\n },\n ref: 'toggle'\n }, [// TODO: The `text` slot is deprecated in favor of the `button-content` slot\n this.normalizeSlot([SLOT_NAME_BUTTON_CONTENT, SLOT_NAME_TEXT]) || h('span', {\n domProps: htmlOrText(this.html, this.text)\n })]);\n var $menu = h('ul', {\n staticClass: 'dropdown-menu',\n class: this.menuClasses,\n attrs: {\n tabindex: '-1',\n 'aria-labelledby': toggleId\n },\n on: {\n keydown: this.onKeydown // Handle UP, DOWN and ESC\n\n },\n ref: 'menu'\n }, !this.lazy || visible ? this.normalizeSlot(SLOT_NAME_DEFAULT, {\n hide: hide\n }) : [h()]);\n return h('li', {\n staticClass: 'nav-item b-nav-dropdown dropdown',\n class: this.dropdownClasses,\n attrs: {\n id: this.safeId()\n }\n }, [$toggle, $menu]);\n }\n});","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('b-nav-item-dropdown',{staticClass:\"dropdown-user\",attrs:{\"right\":\"\",\"toggle-class\":\"d-flex align-items-center dropdown-user-link\"},scopedSlots:_vm._u([{key:\"button-content\",fn:function(){return [_c('div',{staticClass:\"d-sm-flex d-none user-nav\"},[_c('p',{staticClass:\"user-name font-weight-bolder mb-0\"},[_vm._v(\" \"+_vm._s(_vm.userData.fullName || _vm.userData.username)+\" \")]),_c('span',{staticClass:\"user-status\"},[_vm._v(_vm._s(_vm.userData.role))])]),_c('b-avatar',{staticClass:\"badge-minimal\",attrs:{\"size\":\"40\",\"src\":_vm.userData.avatar,\"variant\":\"light-primary\",\"badge\":\"\",\"badge-variant\":\"success\"}},[(!_vm.userData.fullName)?_c('feather-icon',{attrs:{\"icon\":\"UserIcon\",\"size\":\"22\"}}):_vm._e()],1)]},proxy:true}])},[_c('b-dropdown-item',{attrs:{\"to\":{ name: 'pages-account-setting' },\"link-class\":\"d-flex align-items-center\"}},[_c('feather-icon',{staticClass:\"mr-50\",attrs:{\"size\":\"16\",\"icon\":\"SettingsIcon\"}}),_c('span',[_vm._v(_vm._s(_vm.$t('Settings')))])],1),_c('b-dropdown-item',{attrs:{\"link-class\":\"d-flex align-items-center\"},on:{\"click\":_vm.logout}},[_c('feather-icon',{staticClass:\"mr-50\",attrs:{\"size\":\"16\",\"icon\":\"LogOutIcon\"}}),_c('span',[_vm._v(_vm._s(_vm.$t('Logout')))])],1)],1)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\r\n \r\n \r\n \r\n
\r\n {{ userData.fullName || userData.username }}\r\n
\r\n
{{ userData.role }}\r\n
\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n {{ $t('Settings') }}\r\n \r\n \r\n \r\n \r\n {{ $t('Logout') }}\r\n \r\n\r\n\r\n\r\n","import mod from \"-!../../../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./UserDropdown.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../../node_modules/babel-loader/lib/index.js!../../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./UserDropdown.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./UserDropdown.vue?vue&type=template&id=96b3300a&\"\nimport script from \"./UserDropdown.vue?vue&type=script&lang=js&\"\nexport * from \"./UserDropdown.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","var hiddenKeys = require('../internals/hidden-keys');\nvar isObject = require('../internals/is-object');\nvar has = require('../internals/has');\nvar defineProperty = require('../internals/object-define-property').f;\nvar uid = require('../internals/uid');\nvar FREEZING = require('../internals/freezing');\n\nvar METADATA = uid('meta');\nvar id = 0;\n\nvar isExtensible = Object.isExtensible || function () {\n return true;\n};\n\nvar setMetadata = function (it) {\n defineProperty(it, METADATA, { value: {\n objectID: 'O' + ++id, // object ID\n weakData: {} // weak collections IDs\n } });\n};\n\nvar fastKey = function (it, create) {\n // return a primitive with prefix\n if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return 'F';\n // not necessary to add metadata\n if (!create) return 'E';\n // add missing metadata\n setMetadata(it);\n // return object ID\n } return it[METADATA].objectID;\n};\n\nvar getWeakData = function (it, create) {\n if (!has(it, METADATA)) {\n // can't set metadata to uncaught frozen object\n if (!isExtensible(it)) return true;\n // not necessary to add metadata\n if (!create) return false;\n // add missing metadata\n setMetadata(it);\n // return the store of weak collections IDs\n } return it[METADATA].weakData;\n};\n\n// add metadata on freeze-family methods calling\nvar onFreeze = function (it) {\n if (FREEZING && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it);\n return it;\n};\n\nvar meta = module.exports = {\n REQUIRED: false,\n fastKey: fastKey,\n getWeakData: getWeakData,\n onFreeze: onFreeze\n};\n\nhiddenKeys[METADATA] = true;\n","export * from \"-!../../../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--8-oneOf-1-0!../../../../../../node_modules/css-loader/dist/cjs.js??ref--8-oneOf-1-1!../../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../../node_modules/postcss-loader/src/index.js??ref--8-oneOf-1-2!../../../../../../node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!../../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./SearchBar.vue?vue&type=style&index=0&id=f76e6e3a&lang=scss&scoped=true&\""],"sourceRoot":""}