From ef76bce17ea6b2edb7fca9e8a60c10814cffecb5 Mon Sep 17 00:00:00 2001 From: Maximilian Mantz Date: Mon, 30 May 2016 12:59:13 +0200 Subject: [PATCH] v2.0.1 - fixed an issue where userExpired got dispatched twice on successful redirection --- dist/redux-oidc.js | 22 +++++++++++----------- package.json | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dist/redux-oidc.js b/dist/redux-oidc.js index a884ac4..d0ad5b3 100644 --- a/dist/redux-oidc.js +++ b/dist/redux-oidc.js @@ -1,13 +1,13 @@ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("react"));else if("function"==typeof define&&define.amd)define(["react"],e);else{var r=e("object"==typeof exports?require("react"):t.react);for(var n in r)("object"==typeof exports?exports:t)[n]=r[n]}}(this,function(t){return function(t){function e(n){if(r[n])return r[n].exports;var i=r[n]={exports:{},id:n,loaded:!1};return t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){t.exports=r(8)},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.STORAGE_KEY="oidc.expired",e.USER_EXPIRED="redux-oidc/USER_EXPIRED",e.REDIRECT_SUCCESS="redux-oidc/REDIRECT_SUCCESS",e.USER_LOADED="redux-oidc/USER_LOADED",e.SILENT_RENEW_ERROR="redux-oidc/SILENT_RENEW_ERROR",e.SESSION_TERMINATED="redux-oidc/SESSION_TERMINATED",e.USER_EXPIRING="redux-oidc/USER_EXPIRING",e.USER_FOUND="redux-oidc/USER_FOUND"},function(t,e,r){"use strict";function n(){return{type:h.USER_EXPIRED}}function i(t){return{type:h.REDIRECT_SUCCESS,payload:t}}function s(t){return{type:h.USER_FOUND,payload:t}}function o(t){return{type:h.SILENT_RENEW_ERROR,payload:t}}function a(){return{type:h.SESSION_TERMINATED}}function u(){return{type:h.USER_EXPIRING}}Object.defineProperty(e,"__esModule",{value:!0}),e.userExpired=n,e.redirectSuccess=i,e.userFound=s,e.silentRenewError=o,e.sessionTerminated=a,e.userExpiring=u;var h=r(1)},function(t,e,r){"use strict";function n(t){return new i.UserManager(t)}Object.defineProperty(e,"__esModule",{value:!0}),e["default"]=n;var i=r(13)},function(e,r){e.exports=t},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var r=0;rh;h++)u[h]=arguments[h];return r=n=s(this,(t=Object.getPrototypeOf(e)).call.apply(t,[this].concat(u))),n.onRedirectSuccess=function(t){localStorage.removeItem(c.STORAGE_KEY),n.props.successCallback(t)},n.onRedirectError=function(t){throw localStorage.removeItem(c.STORAGE_KEY),new Error("Error handling redirect callback: "+t.message)},o=r,s(n,o)}return o(e,t),a(e,[{key:"componentDidMount",value:function(){var t=this;this.context.userManager.signinRedirectCallback().then(function(e){return t.onRedirectSuccess(e)})["catch"](function(e){return t.onRedirectError(e)})}},{key:"render",value:function(){return h["default"].createElement("div",null,this.props.children||this.defaultContent)}},{key:"defaultContent",get:function(){return h["default"].createElement("div",null,"Redirecting...")}}]),e}(h["default"].Component));f.propTypes={successCallback:u.PropTypes.func.isRequired},f.contextTypes={userManager:u.PropTypes.object},e["default"]=f},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var r=0;ri;i++)n[i]=t[i+e];return n}function p(t){return void 0===t.size&&(t.size=t.__iterate(y)),t.size}function g(t,e){if("number"!=typeof e){var r=e>>>0;if(""+r!==e||4294967295===r)return NaN;e=r}return 0>e?p(t)+e:e}function y(){return!0}function v(t,e,r){return(0===t||void 0!==r&&-r>=t)&&(void 0===e||void 0!==r&&e>=r)}function m(t,e){return _(t,e,0)}function S(t,e){return _(t,e,e)}function _(t,e,r){return void 0===t?r:0>t?Math.max(0,e+t):void 0===e?t:Math.min(e,t)}function E(t){this.next=t}function b(t,e,r,n){var i=0===t?e:1===t?r:[e,r];return n?n.value=i:n={value:i,done:!1},n}function w(){return{value:void 0,done:!0}}function R(t){return!!F(t)}function x(t){return t&&"function"==typeof t.next}function A(t){var e=F(t);return e&&e.call(t)}function F(t){var e=t&&(br&&t[br]||t[wr]);return"function"==typeof e?e:void 0}function K(t){return t&&"number"==typeof t.length}function U(t){return null===t||void 0===t?H():s(t)?t.toSeq():N(t)}function O(t){return null===t||void 0===t?H().toKeyedSeq():s(t)?o(t)?t.toSeq():t.fromEntrySeq():B(t)}function P(t){return null===t||void 0===t?H():s(t)?o(t)?t.entrySeq():t.toIndexedSeq():k(t)}function I(t){return(null===t||void 0===t?H():s(t)?o(t)?t.entrySeq():t:k(t)).toSetSeq()}function D(t){this._array=t,this.size=t.length}function C(t){var e=Object.keys(t);this._object=t,this._keys=e,this.size=e.length}function T(t){this._iterable=t,this.size=t.length||t.size}function j(t){this._iterator=t,this._iteratorCache=[]}function J(t){return!(!t||!t[xr])}function H(){return Ar||(Ar=new D([]))}function B(t){var e=Array.isArray(t)?new D(t).fromEntrySeq():x(t)?new j(t).fromEntrySeq():R(t)?new T(t).fromEntrySeq():"object"==typeof t?new C(t):void 0;if(!e)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+t);return e}function k(t){var e=M(t);if(!e)throw new TypeError("Expected Array or iterable object of values: "+t);return e}function N(t){var e=M(t)||"object"==typeof t&&new C(t);if(!e)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+t);return e}function M(t){return K(t)?new D(t):x(t)?new j(t):R(t)?new T(t):void 0}function V(t,e,r,n){var i=t._cache;if(i){for(var s=i.length-1,o=0;s>=o;o++){var a=i[r?s-o:o];if(e(a[1],n?a[0]:o,t)===!1)return o+1}return o}return t.__iterateUncached(e,r)}function L(t,e,r,n){var i=t._cache;if(i){var s=i.length-1,o=0;return new E(function(){var t=i[r?s-o:o];return o++>s?w():b(e,n?t[0]:o-1,t[1])})}return t.__iteratorUncached(e,r)}function q(t,e){return e?z(e,t,"",{"":t}):W(t)}function z(t,e,r,n){return Array.isArray(e)?t.call(n,r,P(e).map(function(r,n){return z(t,r,n,e)})):Y(e)?t.call(n,r,O(e).map(function(r,n){return z(t,r,n,e)})):e}function W(t){return Array.isArray(t)?P(t).map(W).toList():Y(t)?O(t).map(W).toMap():t}function Y(t){return t&&(t.constructor===Object||void 0===t.constructor)}function G(t,e){if(t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1;if("function"==typeof t.valueOf&&"function"==typeof e.valueOf){if(t=t.valueOf(),e=e.valueOf(),t===e||t!==t&&e!==e)return!0;if(!t||!e)return!1}return!("function"!=typeof t.equals||"function"!=typeof e.equals||!t.equals(e))}function X(t,e){if(t===e)return!0;if(!s(e)||void 0!==t.size&&void 0!==e.size&&t.size!==e.size||void 0!==t.__hash&&void 0!==e.__hash&&t.__hash!==e.__hash||o(t)!==o(e)||a(t)!==a(e)||h(t)!==h(e))return!1;if(0===t.size&&0===e.size)return!0;var r=!u(t);if(h(t)){var n=t.entries();return e.every(function(t,e){var i=n.next().value;return i&&G(i[1],t)&&(r||G(i[0],e))})&&n.next().done}var i=!1;if(void 0===t.size)if(void 0===e.size)"function"==typeof t.cacheResult&&t.cacheResult();else{i=!0;var c=t;t=e,e=c}var f=!0,l=e.__iterate(function(e,n){return(r?t.has(e):i?G(e,t.get(n,yr)):G(t.get(n,yr),e))?void 0:(f=!1,!1)});return f&&t.size===l}function $(t,e){if(!(this instanceof $))return new $(t,e);if(this._value=t,this.size=void 0===e?1/0:Math.max(0,e),0===this.size){if(Fr)return Fr;Fr=this}}function Z(t,e){if(!t)throw new Error(e)}function Q(t,e,r){if(!(this instanceof Q))return new Q(t,e,r);if(Z(0!==r,"Cannot step a Range by 0"),t=t||0,void 0===e&&(e=1/0),r=void 0===r?1:Math.abs(r),t>e&&(r=-r),this._start=t,this._end=e,this._step=r,this.size=Math.max(0,Math.ceil((e-t)/r-1)+1),0===this.size){if(Kr)return Kr;Kr=this}}function tt(){throw TypeError("Abstract")}function et(){}function rt(){}function nt(){}function it(t){return t>>>1&1073741824|3221225471&t}function st(t){if(t===!1||null===t||void 0===t)return 0;if("function"==typeof t.valueOf&&(t=t.valueOf(),t===!1||null===t||void 0===t))return 0;if(t===!0)return 1;var e=typeof t;if("number"===e){if(t!==t||t===1/0)return 0;var r=0|t;for(r!==t&&(r^=4294967295*t);t>4294967295;)t/=4294967295,r^=t;return it(r)}if("string"===e)return t.length>jr?ot(t):at(t);if("function"==typeof t.hashCode)return t.hashCode();if("object"===e)return ut(t);if("function"==typeof t.toString)return at(t.toString());throw new Error("Value type "+e+" cannot be hashed.")}function ot(t){var e=Br[t];return void 0===e&&(e=at(t),Hr===Jr&&(Hr=0,Br={}),Hr++,Br[t]=e),e}function at(t){for(var e=0,r=0;r0)switch(t.nodeType){case 1:return t.uniqueID;case 9:return t.documentElement&&t.documentElement.uniqueID}}function ct(t){Z(t!==1/0,"Cannot perform this action with an infinite size.")}function ft(t){return null===t||void 0===t?bt():lt(t)&&!h(t)?t:bt().withMutations(function(e){var n=r(t);ct(n.size),n.forEach(function(t,r){return e.set(r,t)})})}function lt(t){return!(!t||!t[kr])}function dt(t,e){this.ownerID=t,this.entries=e}function pt(t,e,r){this.ownerID=t,this.bitmap=e,this.nodes=r}function gt(t,e,r){this.ownerID=t,this.count=e,this.nodes=r}function yt(t,e,r){this.ownerID=t,this.keyHash=e,this.entries=r}function vt(t,e,r){this.ownerID=t,this.keyHash=e,this.entry=r}function mt(t,e,r){this._type=e,this._reverse=r,this._stack=t._root&&_t(t._root)}function St(t,e){return b(t,e[0],e[1])}function _t(t,e){return{node:t,index:0,__prev:e}}function Et(t,e,r,n){var i=Object.create(Nr);return i.size=t,i._root=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function bt(){return Mr||(Mr=Et(0))}function wt(t,e,r){var n,i;if(t._root){var s=c(vr),o=c(mr);if(n=Rt(t._root,t.__ownerID,0,void 0,e,r,s,o),!o.value)return t;i=t.size+(s.value?r===yr?-1:1:0)}else{if(r===yr)return t;i=1,n=new dt(t.__ownerID,[[e,r]])}return t.__ownerID?(t.size=i,t._root=n,t.__hash=void 0,t.__altered=!0,t):n?Et(i,n):bt()}function Rt(t,e,r,n,i,s,o,a){return t?t.update(e,r,n,i,s,o,a):s===yr?t:(f(a),f(o),new vt(e,n,[i,s]))}function xt(t){return t.constructor===vt||t.constructor===yt}function At(t,e,r,n,i){if(t.keyHash===n)return new yt(e,n,[t.entry,i]);var s,o=(0===r?t.keyHash:t.keyHash>>>r)&gr,a=(0===r?n:n>>>r)&gr,u=o===a?[At(t,e,r+dr,n,i)]:(s=new vt(e,n,i),a>o?[t,s]:[s,t]);return new pt(e,1<a;a++,u<<=1){var c=e[a];void 0!==c&&a!==n&&(i|=u,o[s++]=c)}return new pt(t,i,o)}function Ut(t,e,r,n,i){for(var s=0,o=new Array(pr),a=0;0!==r;a++,r>>>=1)o[a]=1&r?e[s++]:void 0;return o[n]=i,new gt(t,s+1,o)}function Ot(t,e,n){for(var i=[],o=0;o>1&1431655765,t=(858993459&t)+(t>>2&858993459),t=t+(t>>4)&252645135,t+=t>>8,t+=t>>16,127&t}function jt(t,e,r,n){var i=n?t:d(t);return i[e]=r,i}function Jt(t,e,r,n){var i=t.length+1;if(n&&e+1===i)return t[e]=r,t;for(var s=new Array(i),o=0,a=0;i>a;a++)a===e?(s[a]=r,o=-1):s[a]=t[a+o];return s}function Ht(t,e,r){var n=t.length-1;if(r&&e===n)return t.pop(),t;for(var i=new Array(n),s=0,o=0;n>o;o++)o===e&&(s=1),i[o]=t[o+s];return i}function Bt(t){var e=Lt();if(null===t||void 0===t)return e;if(kt(t))return t;var r=n(t),i=r.size;return 0===i?e:(ct(i),i>0&&pr>i?Vt(0,i,dr,null,new Nt(r.toArray())):e.withMutations(function(t){t.setSize(i),r.forEach(function(e,r){return t.set(r,e)})}))}function kt(t){return!(!t||!t[zr])}function Nt(t,e){this.array=t,this.ownerID=e}function Mt(t,e){function r(t,e,r){return 0===e?n(t,r):i(t,e,r)}function n(t,r){var n=r===a?u&&u.array:t&&t.array,i=r>s?0:s-r,h=o-r;return h>pr&&(h=pr),function(){if(i===h)return Gr;var t=e?--h:i++;return n&&n[t]}}function i(t,n,i){var a,u=t&&t.array,h=i>s?0:s-i>>n,c=(o-i>>n)+1;return c>pr&&(c=pr),function(){for(;;){if(a){var t=a();if(t!==Gr)return t;a=null}if(h===c)return Gr;var s=e?--c:h++;a=r(u&&u[s],n-dr,i+(s<=t.size||0>e)return t.withMutations(function(t){0>e?Gt(t,e).set(0,r):Gt(t,0,e+1).set(e,r)});e+=t._origin;var n=t._tail,i=t._root,s=c(mr);return e>=$t(t._capacity)?n=zt(n,t.__ownerID,0,e,r,s):i=zt(i,t.__ownerID,t._level,e,r,s),s.value?t.__ownerID?(t._root=i,t._tail=n,t.__hash=void 0,t.__altered=!0,t):Vt(t._origin,t._capacity,t._level,i,n):t}function zt(t,e,r,n,i,s){var o=n>>>r&gr,a=t&&o0){var h=t&&t.array[o],c=zt(h,e,r-dr,n,i,s);return c===h?t:(u=Wt(t,e),u.array[o]=c,u)}return a&&t.array[o]===i?t:(f(s),u=Wt(t,e),void 0===i&&o===u.array.length-1?u.array.pop():u.array[o]=i,u)}function Wt(t,e){return e&&t&&e===t.ownerID?t:new Nt(t?t.array.slice():[],e)}function Yt(t,e){if(e>=$t(t._capacity))return t._tail;if(e<1<0;)r=r.array[e>>>n&gr],n-=dr;return r}}function Gt(t,e,r){void 0!==e&&(e=0|e),void 0!==r&&(r=0|r);var n=t.__ownerID||new l,i=t._origin,s=t._capacity,o=i+e,a=void 0===r?s:0>r?s+r:i+r;if(o===i&&a===s)return t;if(o>=a)return t.clear();for(var u=t._level,h=t._root,c=0;0>o+c;)h=new Nt(h&&h.array.length?[void 0,h]:[],n),u+=dr,c+=1<=1<d?Yt(t,a-1):d>f?new Nt([],n):p;if(p&&d>f&&s>o&&p.array.length){h=Wt(h,n);for(var y=h,v=u;v>dr;v-=dr){var m=f>>>v&gr;y=y.array[m]=Wt(y.array[m],n)}y.array[f>>>dr&gr]=p}if(s>a&&(g=g&&g.removeAfter(n,0,a)),o>=d)o-=d,a-=d,u=dr,h=null,g=g&&g.removeBefore(n,0,o);else if(o>i||f>d){for(c=0;h;){var S=o>>>u&gr;if(S!==d>>>u&gr)break;S&&(c+=(1<i&&(h=h.removeBefore(n,u,o-c)),h&&f>d&&(h=h.removeAfter(n,u,d-c)),c&&(o-=c,a-=c)}return t.__ownerID?(t.size=a-o,t._origin=o,t._capacity=a,t._level=u,t._root=h,t._tail=g,t.__hash=void 0,t.__altered=!0,t):Vt(o,a,u,h,g)}function Xt(t,e,r){for(var i=[],o=0,a=0;ao&&(o=h.size),s(u)||(h=h.map(function(t){return q(t)})),i.push(h)}return o>t.size&&(t=t.setSize(o)),Dt(t,e,i)}function $t(t){return pr>t?0:t-1>>>dr<=pr&&o.size>=2*s.size?(i=o.filter(function(t,e){return void 0!==t&&a!==e}),n=i.toKeyedSeq().map(function(t){return t[0]}).flip().toMap(),t.__ownerID&&(n.__ownerID=i.__ownerID=t.__ownerID)):(n=s.remove(e),i=a===o.size-1?o.pop():o.set(a,void 0))}else if(u){if(r===o.get(a)[1])return t;n=s,i=o.set(a,[e,r])}else n=s.set(e,o.size),i=o.set(o.size,[e,r]);return t.__ownerID?(t.size=n.size,t._map=n,t._list=i,t.__hash=void 0,t):te(n,i)}function ne(t,e){this._iter=t,this._useKeys=e,this.size=t.size}function ie(t){this._iter=t,this.size=t.size}function se(t){this._iter=t,this.size=t.size}function oe(t){this._iter=t,this.size=t.size}function ae(t){var e=Ke(t);return e._iter=t,e.size=t.size,e.flip=function(){return t},e.reverse=function(){var e=t.reverse.apply(this);return e.flip=function(){return t.reverse()},e},e.has=function(e){return t.includes(e)},e.includes=function(e){return t.has(e)},e.cacheResult=Ue,e.__iterateUncached=function(e,r){var n=this;return t.__iterate(function(t,r){return e(r,t,n)!==!1},r)},e.__iteratorUncached=function(e,r){if(e===Er){var n=t.__iterator(e,r);return new E(function(){var t=n.next();if(!t.done){var e=t.value[0];t.value[0]=t.value[1],t.value[1]=e}return t})}return t.__iterator(e===_r?Sr:_r,r)},e}function ue(t,e,r){var n=Ke(t);return n.size=t.size,n.has=function(e){return t.has(e)},n.get=function(n,i){var s=t.get(n,yr);return s===yr?i:e.call(r,s,n,t)},n.__iterateUncached=function(n,i){var s=this;return t.__iterate(function(t,i,o){return n(e.call(r,t,i,o),i,s)!==!1},i)},n.__iteratorUncached=function(n,i){var s=t.__iterator(Er,i);return new E(function(){var i=s.next();if(i.done)return i;var o=i.value,a=o[0];return b(n,a,e.call(r,o[1],a,t),i)})},n}function he(t,e){var r=Ke(t);return r._iter=t,r.size=t.size,r.reverse=function(){return t},t.flip&&(r.flip=function(){var e=ae(t);return e.reverse=function(){return t.flip()},e}),r.get=function(r,n){return t.get(e?r:-1-r,n)},r.has=function(r){return t.has(e?r:-1-r)},r.includes=function(e){return t.includes(e)},r.cacheResult=Ue,r.__iterate=function(e,r){var n=this;return t.__iterate(function(t,r){return e(t,r,n)},!r)},r.__iterator=function(e,r){return t.__iterator(e,!r)},r}function ce(t,e,r,n){var i=Ke(t);return n&&(i.has=function(n){var i=t.get(n,yr);return i!==yr&&!!e.call(r,i,n,t)},i.get=function(n,i){var s=t.get(n,yr);return s!==yr&&e.call(r,s,n,t)?s:i}),i.__iterateUncached=function(i,s){var o=this,a=0;return t.__iterate(function(t,s,u){return e.call(r,t,s,u)?(a++,i(t,n?s:a-1,o)):void 0},s),a},i.__iteratorUncached=function(i,s){var o=t.__iterator(Er,s),a=0;return new E(function(){for(;;){var s=o.next();if(s.done)return s;var u=s.value,h=u[0],c=u[1];if(e.call(r,c,h,t))return b(i,n?h:a++,c,s)}})},i}function fe(t,e,r){var n=ft().asMutable();return t.__iterate(function(i,s){n.update(e.call(r,i,s,t),0,function(t){return t+1})}),n.asImmutable()}function le(t,e,r){var n=o(t),i=(h(t)?Zt():ft()).asMutable();t.__iterate(function(s,o){i.update(e.call(r,s,o,t),function(t){return t=t||[],t.push(n?[o,s]:s),t})});var s=Fe(t);return i.map(function(e){return Re(t,s(e))})}function de(t,e,r,n){var i=t.size;if(void 0!==e&&(e=0|e),void 0!==r&&(r=r===1/0?i:0|r),v(e,r,i))return t;var s=m(e,i),o=S(r,i);if(s!==s||o!==o)return de(t.toSeq().cacheResult(),e,r,n);var a,u=o-s;u===u&&(a=0>u?0:u);var h=Ke(t);return h.size=0===a?a:t.size&&a||void 0,!n&&J(t)&&a>=0&&(h.get=function(e,r){return e=g(this,e),e>=0&&a>e?t.get(e+s,r):r}),h.__iterateUncached=function(e,r){var i=this;if(0===a)return 0;if(r)return this.cacheResult().__iterate(e,r);var o=0,u=!0,h=0;return t.__iterate(function(t,r){return u&&(u=o++a)return w();var t=i.next();return n||e===_r?t:e===Sr?b(e,u-1,void 0,t):b(e,u-1,t.value[1],t)})},h}function pe(t,e,r){var n=Ke(t);return n.__iterateUncached=function(n,i){var s=this;if(i)return this.cacheResult().__iterate(n,i);var o=0;return t.__iterate(function(t,i,a){return e.call(r,t,i,a)&&++o&&n(t,i,s)}),o},n.__iteratorUncached=function(n,i){var s=this;if(i)return this.cacheResult().__iterator(n,i);var o=t.__iterator(Er,i),a=!0;return new E(function(){if(!a)return w();var t=o.next();if(t.done)return t;var i=t.value,u=i[0],h=i[1];return e.call(r,h,u,s)?n===Er?t:b(n,u,h,t):(a=!1,w())})},n}function ge(t,e,r,n){var i=Ke(t);return i.__iterateUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterate(i,s);var a=!0,u=0;return t.__iterate(function(t,s,h){return a&&(a=e.call(r,t,s,h))?void 0:(u++,i(t,n?s:u-1,o))}),u},i.__iteratorUncached=function(i,s){var o=this;if(s)return this.cacheResult().__iterator(i,s);var a=t.__iterator(Er,s),u=!0,h=0;return new E(function(){var t,s,c;do{if(t=a.next(),t.done)return n||i===_r?t:i===Sr?b(i,h++,void 0,t):b(i,h++,t.value[1],t);var f=t.value;s=f[0],c=f[1],u&&(u=e.call(r,c,s,o))}while(u);return i===Er?t:b(i,s,c,t)})},i}function ye(t,e){var n=o(t),i=[t].concat(e).map(function(t){return s(t)?n&&(t=r(t)):t=n?B(t):k(Array.isArray(t)?t:[t]),t}).filter(function(t){return 0!==t.size});if(0===i.length)return t;if(1===i.length){var u=i[0];if(u===t||n&&o(u)||a(t)&&a(u))return u}var h=new D(i);return n?h=h.toKeyedSeq():a(t)||(h=h.toSetSeq()),h=h.flatten(!0),h.size=i.reduce(function(t,e){if(void 0!==t){var r=e.size;if(void 0!==r)return t+r}},0),h}function ve(t,e,r){var n=Ke(t);return n.__iterateUncached=function(n,i){function o(t,h){var c=this;t.__iterate(function(t,i){return(!e||e>h)&&s(t)?o(t,h+1):n(t,r?i:a++,c)===!1&&(u=!0),!u},i)}var a=0,u=!1;return o(t,0),a},n.__iteratorUncached=function(n,i){var o=t.__iterator(n,i),a=[],u=0;return new E(function(){for(;o;){var t=o.next();if(t.done===!1){var h=t.value;if(n===Er&&(h=h[1]),e&&!(a.length0}function we(t,r,n){var i=Ke(t);return i.size=new D(n).map(function(t){return t.size}).min(),i.__iterate=function(t,e){for(var r,n=this.__iterator(_r,e),i=0;!(r=n.next()).done&&t(r.value,i++,this)!==!1;);return i},i.__iteratorUncached=function(t,i){var s=n.map(function(t){return t=e(t),A(i?t.reverse():t)}),o=0,a=!1;return new E(function(){var e;return a||(e=s.map(function(t){return t.next()}),a=e.some(function(t){return t.done})),a?w():b(t,o++,r.apply(null,e.map(function(t){return t.value})))})},i}function Re(t,e){return J(t)?e:t.constructor(e)}function xe(t){if(t!==Object(t))throw new TypeError("Expected [K, V] tuple: "+t)}function Ae(t){return ct(t.size),p(t)}function Fe(t){return o(t)?r:a(t)?n:i}function Ke(t){return Object.create((o(t)?O:a(t)?P:I).prototype)}function Ue(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):U.prototype.cacheResult.call(this)}function Oe(t,e){return t>e?1:e>t?-1:0}function Pe(t){var r=A(t);if(!r){if(!K(t))throw new TypeError("Expected iterable or array-like: "+t);r=A(e(t))}return r}function Ie(t,e){var r,n=function(s){if(s instanceof n)return s;if(!(this instanceof n))return new n(s);if(!r){r=!0;var o=Object.keys(t);Te(i,o),i.size=o.length,i._name=e,i._keys=o,i._defaultValues=t}this._map=ft(s)},i=n.prototype=Object.create($r);return i.constructor=n,n}function De(t,e,r){var n=Object.create(Object.getPrototypeOf(t));return n._map=e,n.__ownerID=r,n}function Ce(t){return t._name||t.constructor.name||"Record"}function Te(t,e){try{e.forEach(je.bind(void 0,t))}catch(r){}}function je(t,e){Object.defineProperty(t,e,{ get:function(){return this.get(e)},set:function(t){Z(this.__ownerID,"Cannot set on an immutable record."),this.set(e,t)}})}function Je(t){return null===t||void 0===t?Ne():He(t)&&!h(t)?t:Ne().withMutations(function(e){var r=i(t);ct(r.size),r.forEach(function(t){return e.add(t)})})}function He(t){return!(!t||!t[Zr])}function Be(t,e){return t.__ownerID?(t.size=e.size,t._map=e,t):e===t._map?t:0===e.size?t.__empty():t.__make(e)}function ke(t,e){var r=Object.create(Qr);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function Ne(){return tn||(tn=ke(bt()))}function Me(t){return null===t||void 0===t?qe():Ve(t)?t:qe().withMutations(function(e){var r=i(t);ct(r.size),r.forEach(function(t){return e.add(t)})})}function Ve(t){return He(t)&&h(t)}function Le(t,e){var r=Object.create(en);return r.size=t?t.size:0,r._map=t,r.__ownerID=e,r}function qe(){return rn||(rn=Le(ee()))}function ze(t){return null===t||void 0===t?Ge():We(t)?t:Ge().unshiftAll(t)}function We(t){return!(!t||!t[nn])}function Ye(t,e,r,n){var i=Object.create(sn);return i.size=t,i._head=e,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Ge(){return on||(on=Ye(0))}function Xe(t,e){var r=function(r){t.prototype[r]=e[r]};return Object.keys(e).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(e).forEach(r),t}function $e(t,e){return e}function Ze(t,e){return[e,t]}function Qe(t){return function(){return!t.apply(this,arguments)}}function tr(t){return function(){return-t.apply(this,arguments)}}function er(t){return"string"==typeof t?JSON.stringify(t):String(t)}function rr(){return d(arguments)}function nr(t,e){return e>t?1:t>e?-1:0}function ir(t){if(t.size===1/0)return 0;var e=h(t),r=o(t),n=e?1:0,i=t.__iterate(r?e?function(t,e){n=31*n+or(st(t),st(e))|0}:function(t,e){n=n+or(st(t),st(e))|0}:e?function(t){n=31*n+st(t)|0}:function(t){n=n+st(t)|0});return sr(i,n)}function sr(t,e){return e=Or(e,3432918353),e=Or(e<<15|e>>>-15,461845907),e=Or(e<<13|e>>>-13,5),e=(e+3864292196|0)^t,e=Or(e^e>>>16,2246822507),e=Or(e^e>>>13,3266489909),e=it(e^e>>>16)}function or(t,e){return t^e+2654435769+(t<<6)+(t>>2)|0}var ar=Array.prototype.slice;t(r,e),t(n,e),t(i,e),e.isIterable=s,e.isKeyed=o,e.isIndexed=a,e.isAssociative=u,e.isOrdered=h,e.Keyed=r,e.Indexed=n,e.Set=i;var ur="@@__IMMUTABLE_ITERABLE__@@",hr="@@__IMMUTABLE_KEYED__@@",cr="@@__IMMUTABLE_INDEXED__@@",fr="@@__IMMUTABLE_ORDERED__@@",lr="delete",dr=5,pr=1<=i;i++)if(t(r[e?n-i:i],i,this)===!1)return i+1;return i},D.prototype.__iterator=function(t,e){var r=this._array,n=r.length-1,i=0;return new E(function(){return i>n?w():b(t,i,r[e?n-i++:i++])})},t(C,O),C.prototype.get=function(t,e){return void 0===e||this.has(t)?this._object[t]:e},C.prototype.has=function(t){return this._object.hasOwnProperty(t)},C.prototype.__iterate=function(t,e){for(var r=this._object,n=this._keys,i=n.length-1,s=0;i>=s;s++){var o=n[e?i-s:s];if(t(r[o],o,this)===!1)return s+1}return s},C.prototype.__iterator=function(t,e){var r=this._object,n=this._keys,i=n.length-1,s=0;return new E(function(){var o=n[e?i-s:s];return s++>i?w():b(t,o,r[o])})},C.prototype[fr]=!0,t(T,P),T.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);var r=this._iterable,n=A(r),i=0;if(x(n))for(var s;!(s=n.next()).done&&t(s.value,i++,this)!==!1;);return i},T.prototype.__iteratorUncached=function(t,e){if(e)return this.cacheResult().__iterator(t,e);var r=this._iterable,n=A(r);if(!x(n))return new E(w);var i=0;return new E(function(){var e=n.next();return e.done?e:b(t,i++,e.value)})},t(j,P),j.prototype.__iterateUncached=function(t,e){if(e)return this.cacheResult().__iterate(t,e);for(var r=this._iterator,n=this._iteratorCache,i=0;i=n.length){var e=r.next();if(e.done)return e;n[i]=e.value}return b(t,i,n[i++])})};var Ar;t($,P),$.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},$.prototype.get=function(t,e){return this.has(t)?this._value:e},$.prototype.includes=function(t){return G(this._value,t)},$.prototype.slice=function(t,e){var r=this.size;return v(t,e,r)?this:new $(this._value,S(e,r)-m(t,r))},$.prototype.reverse=function(){return this},$.prototype.indexOf=function(t){return G(this._value,t)?0:-1},$.prototype.lastIndexOf=function(t){return G(this._value,t)?this.size:-1},$.prototype.__iterate=function(t,e){for(var r=0;r=0&&e=e?new Q(0,0):new Q(this.get(t,this._end),this.get(e,this._end),this._step))},Q.prototype.indexOf=function(t){var e=t-this._start;if(e%this._step===0){var r=e/this._step;if(r>=0&&r=s;s++){if(t(i,s,this)===!1)return s+1;i+=e?-n:n}return s},Q.prototype.__iterator=function(t,e){var r=this.size-1,n=this._step,i=e?this._start+r*n:this._start,s=0;return new E(function(){var o=i;return i+=e?-n:n,s>r?w():b(t,s++,o)})},Q.prototype.equals=function(t){return t instanceof Q?this._start===t._start&&this._end===t._end&&this._step===t._step:X(this,t)};var Kr;t(tt,e),t(et,tt),t(rt,tt),t(nt,tt),tt.Keyed=et,tt.Indexed=rt,tt.Set=nt;var Ur,Or="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(t,e){t=0|t,e=0|e;var r=65535&t,n=65535&e;return r*n+((t>>>16)*n+r*(e>>>16)<<16>>>0)|0},Pr=Object.isExtensible,Ir=function(){try{return Object.defineProperty({},"@",{}),!0}catch(t){return!1}}(),Dr="function"==typeof WeakMap;Dr&&(Ur=new WeakMap);var Cr=0,Tr="__immutablehash__";"function"==typeof Symbol&&(Tr=Symbol(Tr));var jr=16,Jr=255,Hr=0,Br={};t(ft,et),ft.of=function(){var t=ar.call(arguments,0);return bt().withMutations(function(e){for(var r=0;r=t.length)throw new Error("Missing value for key: "+t[r]);e.set(t[r],t[r+1])}})},ft.prototype.toString=function(){return this.__toString("Map {","}")},ft.prototype.get=function(t,e){return this._root?this._root.get(0,void 0,t,e):e},ft.prototype.set=function(t,e){return wt(this,t,e)},ft.prototype.setIn=function(t,e){return this.updateIn(t,yr,function(){return e})},ft.prototype.remove=function(t){return wt(this,t,yr)},ft.prototype.deleteIn=function(t){return this.updateIn(t,function(){return yr})},ft.prototype.update=function(t,e,r){return 1===arguments.length?t(this):this.updateIn([t],e,r)},ft.prototype.updateIn=function(t,e,r){r||(r=e,e=void 0);var n=Ct(this,Pe(t),e,r);return n===yr?void 0:n},ft.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):bt()},ft.prototype.merge=function(){return Ot(this,void 0,arguments)},ft.prototype.mergeWith=function(t){var e=ar.call(arguments,1);return Ot(this,t,e)},ft.prototype.mergeIn=function(t){var e=ar.call(arguments,1);return this.updateIn(t,bt(),function(t){return"function"==typeof t.merge?t.merge.apply(t,e):e[e.length-1]})},ft.prototype.mergeDeep=function(){return Ot(this,Pt,arguments)},ft.prototype.mergeDeepWith=function(t){var e=ar.call(arguments,1);return Ot(this,It(t),e)},ft.prototype.mergeDeepIn=function(t){var e=ar.call(arguments,1);return this.updateIn(t,bt(),function(t){return"function"==typeof t.mergeDeep?t.mergeDeep.apply(t,e):e[e.length-1]})},ft.prototype.sort=function(t){return Zt(_e(this,t))},ft.prototype.sortBy=function(t,e){return Zt(_e(this,e,t))},ft.prototype.withMutations=function(t){var e=this.asMutable();return t(e),e.wasAltered()?e.__ensureOwner(this.__ownerID):this},ft.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new l)},ft.prototype.asImmutable=function(){return this.__ensureOwner()},ft.prototype.wasAltered=function(){return this.__altered},ft.prototype.__iterator=function(t,e){return new mt(this,t,e)},ft.prototype.__iterate=function(t,e){var r=this,n=0;return this._root&&this._root.iterate(function(e){return n++,t(e[1],e[0],r)},e),n},ft.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Et(this.size,this._root,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},ft.isMap=lt;var kr="@@__IMMUTABLE_MAP__@@",Nr=ft.prototype;Nr[kr]=!0,Nr[lr]=Nr.remove,Nr.removeIn=Nr.deleteIn,dt.prototype.get=function(t,e,r,n){for(var i=this.entries,s=0,o=i.length;o>s;s++)if(G(r,i[s][0]))return i[s][1];return n},dt.prototype.update=function(t,e,r,n,i,s,o){for(var a=i===yr,u=this.entries,h=0,c=u.length;c>h&&!G(n,u[h][0]);h++);var l=c>h;if(l?u[h][1]===i:a)return this;if(f(o),(a||!l)&&f(s),!a||1!==u.length){if(!l&&!a&&u.length>=Vr)return Ft(t,u,n,i);var p=t&&t===this.ownerID,g=p?u:d(u);return l?a?h===c-1?g.pop():g[h]=g.pop():g[h]=[n,i]:g.push([n,i]),p?(this.entries=g,this):new dt(t,g)}},pt.prototype.get=function(t,e,r,n){void 0===e&&(e=st(r));var i=1<<((0===t?e:e>>>t)&gr),s=this.bitmap;return 0===(s&i)?n:this.nodes[Tt(s&i-1)].get(t+dr,e,r,n)},pt.prototype.update=function(t,e,r,n,i,s,o){void 0===r&&(r=st(n));var a=(0===e?r:r>>>e)&gr,u=1<=Lr)return Ut(t,l,h,a,p);if(c&&!p&&2===l.length&&xt(l[1^f]))return l[1^f];if(c&&p&&1===l.length&&xt(p))return p;var g=t&&t===this.ownerID,y=c?p?h:h^u:h|u,v=c?p?jt(l,f,p,g):Ht(l,f,g):Jt(l,f,p,g);return g?(this.bitmap=y,this.nodes=v,this):new pt(t,y,v)},gt.prototype.get=function(t,e,r,n){void 0===e&&(e=st(r));var i=(0===t?e:e>>>t)&gr,s=this.nodes[i];return s?s.get(t+dr,e,r,n):n},gt.prototype.update=function(t,e,r,n,i,s,o){void 0===r&&(r=st(n));var a=(0===e?r:r>>>e)&gr,u=i===yr,h=this.nodes,c=h[a];if(u&&!c)return this;var f=Rt(c,t,e+dr,r,n,i,s,o);if(f===c)return this;var l=this.count;if(c){if(!f&&(l--,qr>l))return Kt(t,h,l,a)}else l++;var d=t&&t===this.ownerID,p=jt(h,a,f,d);return d?(this.count=l,this.nodes=p,this):new gt(t,l,p)},yt.prototype.get=function(t,e,r,n){for(var i=this.entries,s=0,o=i.length;o>s;s++)if(G(r,i[s][0]))return i[s][1];return n},yt.prototype.update=function(t,e,r,n,i,s,o){void 0===r&&(r=st(n));var a=i===yr;if(r!==this.keyHash)return a?this:(f(o),f(s),At(this,t,e,r,[n,i]));for(var u=this.entries,h=0,c=u.length;c>h&&!G(n,u[h][0]);h++);var l=c>h;if(l?u[h][1]===i:a)return this;if(f(o),(a||!l)&&f(s),a&&2===c)return new vt(t,this.keyHash,u[1^h]);var p=t&&t===this.ownerID,g=p?u:d(u);return l?a?h===c-1?g.pop():g[h]=g.pop():g[h]=[n,i]:g.push([n,i]),p?(this.entries=g,this):new yt(t,this.keyHash,g)},vt.prototype.get=function(t,e,r,n){return G(r,this.entry[0])?this.entry[1]:n},vt.prototype.update=function(t,e,r,n,i,s,o){var a=i===yr,u=G(n,this.entry[0]);return(u?i===this.entry[1]:a)?this:(f(o),a?void f(s):u?t&&t===this.ownerID?(this.entry[1]=i,this):new vt(t,this.keyHash,[n,i]):(f(s),At(this,t,e,st(n),[n,i])))},dt.prototype.iterate=yt.prototype.iterate=function(t,e){for(var r=this.entries,n=0,i=r.length-1;i>=n;n++)if(t(r[e?i-n:n])===!1)return!1},pt.prototype.iterate=gt.prototype.iterate=function(t,e){for(var r=this.nodes,n=0,i=r.length-1;i>=n;n++){var s=r[e?i-n:n];if(s&&s.iterate(t,e)===!1)return!1}},vt.prototype.iterate=function(t,e){return t(this.entry)},t(mt,E),mt.prototype.next=function(){for(var t=this._type,e=this._stack;e;){var r,n=e.node,i=e.index++;if(n.entry){if(0===i)return St(t,n.entry)}else if(n.entries){if(r=n.entries.length-1,r>=i)return St(t,n.entries[this._reverse?r-i:i])}else if(r=n.nodes.length-1,r>=i){var s=n.nodes[this._reverse?r-i:i];if(s){if(s.entry)return St(t,s.entry);e=this._stack=_t(s,e)}continue}e=this._stack=this._stack.__prev}return w()};var Mr,Vr=pr/4,Lr=pr/2,qr=pr/4;t(Bt,rt),Bt.of=function(){return this(arguments)},Bt.prototype.toString=function(){return this.__toString("List [","]")},Bt.prototype.get=function(t,e){if(t=g(this,t),t>=0&&t>>e&gr;if(n>=this.array.length)return new Nt([],t);var i,s=0===n;if(e>0){var o=this.array[n];if(i=o&&o.removeBefore(t,e-dr,r),i===o&&s)return this}if(s&&!i)return this;var a=Wt(this,t);if(!s)for(var u=0;n>u;u++)a.array[u]=void 0;return i&&(a.array[n]=i),a},Nt.prototype.removeAfter=function(t,e,r){if(r===(e?1<>>e&gr;if(n>=this.array.length)return this;var i;if(e>0){var s=this.array[n];if(i=s&&s.removeAfter(t,e-dr,r),i===s&&n===this.array.length-1)return this}var o=Wt(this,t);return o.array.splice(n+1),i&&(o.array[n]=i),o};var Yr,Gr={};t(Zt,ft),Zt.of=function(){return this(arguments)},Zt.prototype.toString=function(){return this.__toString("OrderedMap {","}")},Zt.prototype.get=function(t,e){var r=this._map.get(t);return void 0!==r?this._list.get(r)[1]:e},Zt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):ee()},Zt.prototype.set=function(t,e){return re(this,t,e)},Zt.prototype.remove=function(t){return re(this,t,yr)},Zt.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},Zt.prototype.__iterate=function(t,e){var r=this;return this._list.__iterate(function(e){return e&&t(e[1],e[0],r)},e)},Zt.prototype.__iterator=function(t,e){return this._list.fromEntrySeq().__iterator(t,e)},Zt.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map.__ensureOwner(t),r=this._list.__ensureOwner(t);return t?te(e,r,t,this.__hash):(this.__ownerID=t,this._map=e,this._list=r,this)},Zt.isOrderedMap=Qt,Zt.prototype[fr]=!0,Zt.prototype[lr]=Zt.prototype.remove;var Xr;t(ne,O),ne.prototype.get=function(t,e){return this._iter.get(t,e)},ne.prototype.has=function(t){return this._iter.has(t)},ne.prototype.valueSeq=function(){return this._iter.valueSeq()},ne.prototype.reverse=function(){var t=this,e=he(this,!0);return this._useKeys||(e.valueSeq=function(){return t._iter.toSeq().reverse()}),e},ne.prototype.map=function(t,e){var r=this,n=ue(this,t,e);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(t,e)}),n},ne.prototype.__iterate=function(t,e){var r,n=this;return this._iter.__iterate(this._useKeys?function(e,r){return t(e,r,n)}:(r=e?Ae(this):0,function(i){return t(i,e?--r:r++,n)}),e)},ne.prototype.__iterator=function(t,e){if(this._useKeys)return this._iter.__iterator(t,e);var r=this._iter.__iterator(_r,e),n=e?Ae(this):0;return new E(function(){var i=r.next();return i.done?i:b(t,e?--n:n++,i.value,i)})},ne.prototype[fr]=!0,t(ie,P),ie.prototype.includes=function(t){return this._iter.includes(t)},ie.prototype.__iterate=function(t,e){var r=this,n=0;return this._iter.__iterate(function(e){return t(e,n++,r)},e)},ie.prototype.__iterator=function(t,e){var r=this._iter.__iterator(_r,e),n=0;return new E(function(){var e=r.next();return e.done?e:b(t,n++,e.value,e)})},t(se,I),se.prototype.has=function(t){return this._iter.includes(t)},se.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){return t(e,e,r)},e)},se.prototype.__iterator=function(t,e){var r=this._iter.__iterator(_r,e);return new E(function(){var e=r.next();return e.done?e:b(t,e.value,e.value,e)})},t(oe,O),oe.prototype.entrySeq=function(){return this._iter.toSeq()},oe.prototype.__iterate=function(t,e){var r=this;return this._iter.__iterate(function(e){if(e){xe(e);var n=s(e);return t(n?e.get(1):e[1],n?e.get(0):e[0],r)}},e)},oe.prototype.__iterator=function(t,e){var r=this._iter.__iterator(_r,e);return new E(function(){for(;;){var e=r.next();if(e.done)return e;var n=e.value;if(n){xe(n);var i=s(n);return b(t,i?n.get(0):n[0],i?n.get(1):n[1],e)}}})},ie.prototype.cacheResult=ne.prototype.cacheResult=se.prototype.cacheResult=oe.prototype.cacheResult=Ue,t(Ie,et),Ie.prototype.toString=function(){return this.__toString(Ce(this)+" {","}")},Ie.prototype.has=function(t){return this._defaultValues.hasOwnProperty(t)},Ie.prototype.get=function(t,e){if(!this.has(t))return e;var r=this._defaultValues[t];return this._map?this._map.get(t,r):r},Ie.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var t=this.constructor;return t._empty||(t._empty=De(this,bt()))},Ie.prototype.set=function(t,e){if(!this.has(t))throw new Error('Cannot set unknown key "'+t+'" on '+Ce(this));if(this._map&&!this._map.has(t)){var r=this._defaultValues[t];if(e===r)return this}var n=this._map&&this._map.set(t,e);return this.__ownerID||n===this._map?this:De(this,n)},Ie.prototype.remove=function(t){if(!this.has(t))return this;var e=this._map&&this._map.remove(t);return this.__ownerID||e===this._map?this:De(this,e)},Ie.prototype.wasAltered=function(){return this._map.wasAltered()},Ie.prototype.__iterator=function(t,e){var n=this;return r(this._defaultValues).map(function(t,e){return n.get(e)}).__iterator(t,e)},Ie.prototype.__iterate=function(t,e){var n=this;return r(this._defaultValues).map(function(t,e){return n.get(e)}).__iterate(t,e)},Ie.prototype.__ensureOwner=function(t){if(t===this.__ownerID)return this;var e=this._map&&this._map.__ensureOwner(t);return t?De(this,e,t):(this.__ownerID=t,this._map=e,this)};var $r=Ie.prototype;$r[lr]=$r.remove,$r.deleteIn=$r.removeIn=Nr.removeIn,$r.merge=Nr.merge,$r.mergeWith=Nr.mergeWith,$r.mergeIn=Nr.mergeIn,$r.mergeDeep=Nr.mergeDeep,$r.mergeDeepWith=Nr.mergeDeepWith,$r.mergeDeepIn=Nr.mergeDeepIn,$r.setIn=Nr.setIn,$r.update=Nr.update,$r.updateIn=Nr.updateIn,$r.withMutations=Nr.withMutations,$r.asMutable=Nr.asMutable,$r.asImmutable=Nr.asImmutable,t(Je,nt),Je.of=function(){return this(arguments)},Je.fromKeys=function(t){return this(r(t).keySeq())},Je.prototype.toString=function(){return this.__toString("Set {","}")},Je.prototype.has=function(t){return this._map.has(t)},Je.prototype.add=function(t){return Be(this,this._map.set(t,!0))},Je.prototype.remove=function(t){return Be(this,this._map.remove(t))},Je.prototype.clear=function(){return Be(this,this._map.clear())},Je.prototype.union=function(){var t=ar.call(arguments,0);return t=t.filter(function(t){return 0!==t.size}),0===t.length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations(function(e){for(var r=0;r=0;r--)e={value:arguments[r],next:e};return this.__ownerID?(this.size=t,this._head=e,this.__hash=void 0,this.__altered=!0,this):Ye(t,e)},ze.prototype.pushAll=function(t){if(t=n(t),0===t.size)return this;ct(t.size);var e=this.size,r=this._head;return t.reverse().forEach(function(t){e++,r={value:t,next:r}}),this.__ownerID?(this.size=e,this._head=r,this.__hash=void 0,this.__altered=!0,this):Ye(e,r)},ze.prototype.pop=function(){return this.slice(1)},ze.prototype.unshift=function(){return this.push.apply(this,arguments)},ze.prototype.unshiftAll=function(t){return this.pushAll(t)},ze.prototype.shift=function(){return this.pop.apply(this,arguments)},ze.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Ge()},ze.prototype.slice=function(t,e){if(v(t,e,this.size))return this;var r=m(t,this.size),n=S(e,this.size);if(n!==this.size)return rt.prototype.slice.call(this,t,e);for(var i=this.size-r,s=this._head;r--;)s=s.next;return this.__ownerID?(this.size=i,this._head=s,this.__hash=void 0,this.__altered=!0,this):Ye(i,s)},ze.prototype.__ensureOwner=function(t){return t===this.__ownerID?this:t?Ye(this.size,this._head,t,this.__hash):(this.__ownerID=t,this.__altered=!1,this)},ze.prototype.__iterate=function(t,e){if(e)return this.reverse().__iterate(t);for(var r=0,n=this._head;n&&t(n.value,r++,this)!==!1;)n=n.next;return r},ze.prototype.__iterator=function(t,e){if(e)return this.reverse().__iterator(t);var r=0,n=this._head;return new E(function(){if(n){var e=n.value;return n=n.next,b(t,r++,e)}return w()})},ze.isStack=We;var nn="@@__IMMUTABLE_STACK__@@",sn=ze.prototype;sn[nn]=!0,sn.withMutations=Nr.withMutations,sn.asMutable=Nr.asMutable,sn.asImmutable=Nr.asImmutable,sn.wasAltered=Nr.wasAltered;var on;e.Iterator=E,Xe(e,{toArray:function(){ct(this.size);var t=new Array(this.size||0);return this.valueSeq().__iterate(function(e,r){t[r]=e}),t},toIndexedSeq:function(){return new ie(this)},toJS:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJS?t.toJS():t}).__toJS()},toJSON:function(){return this.toSeq().map(function(t){return t&&"function"==typeof t.toJSON?t.toJSON():t}).__toJS()},toKeyedSeq:function(){return new ne(this,!0)},toMap:function(){return ft(this.toKeyedSeq())},toObject:function(){ct(this.size);var t={};return this.__iterate(function(e,r){t[r]=e}),t},toOrderedMap:function(){return Zt(this.toKeyedSeq())},toOrderedSet:function(){return Me(o(this)?this.valueSeq():this)},toSet:function(){return Je(o(this)?this.valueSeq():this)},toSetSeq:function(){return new se(this)},toSeq:function(){return a(this)?this.toIndexedSeq():o(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return ze(o(this)?this.valueSeq():this)},toList:function(){return Bt(o(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(t,e){return 0===this.size?t+e:t+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+e},concat:function(){var t=ar.call(arguments,0);return Re(this,ye(this,t))},includes:function(t){return this.some(function(e){return G(e,t)})},entries:function(){return this.__iterator(Er)},every:function(t,e){ct(this.size);var r=!0;return this.__iterate(function(n,i,s){return t.call(e,n,i,s)?void 0:(r=!1,!1)}),r},filter:function(t,e){return Re(this,ce(this,t,e,!0))},find:function(t,e,r){var n=this.findEntry(t,e);return n?n[1]:r},forEach:function(t,e){return ct(this.size),this.__iterate(e?t.bind(e):t)},join:function(t){ct(this.size),t=void 0!==t?""+t:",";var e="",r=!0;return this.__iterate(function(n){r?r=!1:e+=t,e+=null!==n&&void 0!==n?n.toString():""}),e},keys:function(){return this.__iterator(Sr)},map:function(t,e){return Re(this,ue(this,t,e))},reduce:function(t,e,r){ct(this.size);var n,i;return arguments.length<2?i=!0:n=e,this.__iterate(function(e,s,o){i?(i=!1,n=e):n=t.call(r,n,e,s,o)}),n},reduceRight:function(t,e,r){var n=this.toKeyedSeq().reverse();return n.reduce.apply(n,arguments)},reverse:function(){return Re(this,he(this,!0))},slice:function(t,e){return Re(this,de(this,t,e,!0))},some:function(t,e){return!this.every(Qe(t),e)},sort:function(t){return Re(this,_e(this,t))},values:function(){return this.__iterator(_r)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(t,e){return p(t?this.toSeq().filter(t,e):this)},countBy:function(t,e){return fe(this,t,e)},equals:function(t){return X(this,t)},entrySeq:function(){var t=this;if(t._cache)return new D(t._cache);var e=t.toSeq().map(Ze).toIndexedSeq();return e.fromEntrySeq=function(){return t.toSeq()},e},filterNot:function(t,e){return this.filter(Qe(t),e)},findEntry:function(t,e,r){var n=r;return this.__iterate(function(r,i,s){return t.call(e,r,i,s)?(n=[i,r],!1):void 0}),n},findKey:function(t,e){var r=this.findEntry(t,e);return r&&r[0]},findLast:function(t,e,r){return this.toKeyedSeq().reverse().find(t,e,r)},findLastEntry:function(t,e,r){return this.toKeyedSeq().reverse().findEntry(t,e,r)},findLastKey:function(t,e){return this.toKeyedSeq().reverse().findKey(t,e)},first:function(){return this.find(y)},flatMap:function(t,e){return Re(this,me(this,t,e))},flatten:function(t){return Re(this,ve(this,t,!0))},fromEntrySeq:function(){return new oe(this)},get:function(t,e){return this.find(function(e,r){return G(r,t)},void 0,e)},getIn:function(t,e){for(var r,n=this,i=Pe(t);!(r=i.next()).done;){var s=r.value;if(n=n&&n.get?n.get(s,yr):yr,n===yr)return e}return n},groupBy:function(t,e){return le(this,t,e)},has:function(t){return this.get(t,yr)!==yr},hasIn:function(t){return this.getIn(t,yr)!==yr},isSubset:function(t){return t="function"==typeof t.includes?t:e(t),this.every(function(e){return t.includes(e)})},isSuperset:function(t){return t="function"==typeof t.isSubset?t:e(t),t.isSubset(this)},keyOf:function(t){return this.findKey(function(e){return G(e,t)})},keySeq:function(){return this.toSeq().map($e).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(t){return this.toKeyedSeq().reverse().keyOf(t)},max:function(t){return Ee(this,t)},maxBy:function(t,e){return Ee(this,e,t)},min:function(t){return Ee(this,t?tr(t):nr)},minBy:function(t,e){return Ee(this,e?tr(e):nr,t)},rest:function(){return this.slice(1)},skip:function(t){return this.slice(Math.max(0,t))},skipLast:function(t){return Re(this,this.toSeq().reverse().skip(t).reverse())},skipWhile:function(t,e){return Re(this,ge(this,t,e,!0))},skipUntil:function(t,e){return this.skipWhile(Qe(t),e)},sortBy:function(t,e){return Re(this,_e(this,e,t))},take:function(t){return this.slice(0,Math.max(0,t))},takeLast:function(t){return Re(this,this.toSeq().reverse().take(t).reverse())},takeWhile:function(t,e){return Re(this,pe(this,t,e))},takeUntil:function(t,e){return this.takeWhile(Qe(t),e)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=ir(this))}});var an=e.prototype;an[ur]=!0,an[Rr]=an.values,an.__toJS=an.toArray,an.__toStringMapper=er,an.inspect=an.toSource=function(){return this.toString()},an.chain=an.flatMap,an.contains=an.includes,Xe(r,{flip:function(){return Re(this,ae(this))}, -mapEntries:function(t,e){var r=this,n=0;return Re(this,this.toSeq().map(function(i,s){return t.call(e,[s,i],n++,r)}).fromEntrySeq())},mapKeys:function(t,e){var r=this;return Re(this,this.toSeq().flip().map(function(n,i){return t.call(e,n,i,r)}).flip())}});var un=r.prototype;un[hr]=!0,un[Rr]=an.entries,un.__toJS=an.toObject,un.__toStringMapper=function(t,e){return JSON.stringify(e)+": "+er(t)},Xe(n,{toKeyedSeq:function(){return new ne(this,!1)},filter:function(t,e){return Re(this,ce(this,t,e,!1))},findIndex:function(t,e){var r=this.findEntry(t,e);return r?r[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return Re(this,he(this,!1))},slice:function(t,e){return Re(this,de(this,t,e,!1))},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=m(t,0>t?this.count():this.size);var n=this.slice(0,t);return Re(this,1===r?n:n.concat(d(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var r=this.findLastEntry(t,e);return r?r[0]:-1},first:function(){return this.get(0)},flatten:function(t){return Re(this,ve(this,t,!1))},get:function(t,e){return t=g(this,t),0>t||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,r){return r===t},void 0,e)},has:function(t){return t=g(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t=u){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];h.info.apply(h,Array.from(e))}},t.warn=function(){if(c>=a){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];h.warn.apply(h,Array.from(e))}},t.error=function(){if(c>=o){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];h.error.apply(h,Array.from(e))}},n(t,null,[{key:"NONE",get:function(){return s}},{key:"ERROR",get:function(){return o}},{key:"WARN",get:function(){return a}},{key:"INFO",get:function(){return u}},{key:"level",get:function(){return c},set:function(t){if(!(t>=s&&u>=t))throw new Error("Invalid log level");c=t}},{key:"logger",get:function(){return h},set:function(t){if(!(t.info&&t.warn&&t.error))throw new Error("Invalid logger");h=t}}]),t}();e["default"]=f,f.reset(),t.exports=e["default"]},function(t,e){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;r=0&&(t=t.substr(n+1));for(var i,s={},a=/([^&=]+)=([^&]*)/g,h=0;i=a.exec(t);)if(s[decodeURIComponent(i[1])]=decodeURIComponent(i[2]),h++>50)return o["default"].error("response exceeded expected number of parameters",t),{error:"Response exceeded expected number of parameters"};for(var c in s)return s;return{}},t}();e["default"]=h,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var r=0;r0?this._created=s:this._created=parseInt(Date.now()/1e3)}return t.prototype.toStorageString=function(){return a["default"].info("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created})},t.fromStorageString=function(e){return a["default"].info("State.fromStorageString"),new t(JSON.parse(e))},t.clearStaleState=function(e,r){a["default"].info("State.clearStaleState");var n=Date.now()/1e3-r;return e.getAllKeys().then(function(r){a["default"].info("got keys",r);var i=[],s=!0,o=!1,u=void 0;try{for(var h,c=function(){var r=h.value;l=e.get(r).then(function(i){var s=!1;if(i)try{var o=t.fromStorageString(i);a["default"].info("got item from key: ",r,o.created),o.created<=n&&(s=!0)}catch(u){a["default"].error("Error parsing state for key",r,u.message),s=!0}else a["default"].info("no item in storage for key: ",r),s=!0;return s?(a["default"].info("removed item for key: ",r),e.remove(r)):void 0}),i.push(l)},f=r[Symbol.iterator]();!(s=(h=f.next()).done);s=!0){var l;c()}}catch(d){o=!0,u=d}finally{try{!s&&f["return"]&&f["return"]()}finally{if(o)throw u}}return a["default"].info("waiting on promise count:",i.length),Promise.all(i)})},s(t,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"created",get:function(){return this._created}}]),t}();e["default"]=c,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=r(2),u=n(a),h=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=e.prefix,n=void 0===r?"oidc.":r,s=e.store,o=void 0===s?u["default"].localStorage:s;i(this,t),this._store=o,this._prefix=n}return t.prototype.set=function(t,e){return o["default"].info("WebStorageStateStore.set",t),t=this._prefix+t,this._store.setItem(t,e),Promise.resolve()},t.prototype.get=function(t){o["default"].info("WebStorageStateStore.get",t),t=this._prefix+t;var e=this._store.getItem(t);return Promise.resolve(e)},t.prototype.remove=function(t){o["default"].info("WebStorageStateStore.remove",t),t=this._prefix+t;var e=this._store.getItem(t);return this._store.removeItem(t),Promise.resolve(e)},t.prototype.getAllKeys=function(){o["default"].info("WebStorageStateStore.getAllKeys");for(var t=[],e=0;e>6)+an.charAt(63&r);if(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=an.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=an.charAt(r>>2)+an.charAt((3&r)<<4)),un)for(;(3&n.length)>0;)n+=un;return n}function i(t){var e,r,n,i="",s=0;for(e=0;en||(0==s?(i+=f(n>>2),r=3&n,s=1):1==s?(i+=f(r<<2|n>>4),r=15&n,s=2):2==s?(i+=f(r),i+=f(n>>2),r=3&n,s=3):(i+=f(r<<2|n>>4),i+=f(15&n),s=0));return 1==s&&(i+=f(r<<2)),i}function s(t){var e,r=i(t),n=new Array;for(e=0;2*e=0;){var o=e*this[t++]+r[n]+i;i=Math.floor(o/67108864),r[n++]=67108863&o}return i}function h(t,e,r,n,i,s){for(var o=32767&e,a=e>>15;--s>=0;){var u=32767&this[t],h=this[t++]>>15,c=a*u+h*o;u=o*u+((32767&c)<<15)+r[n]+(1073741823&i),i=(u>>>30)+(c>>>15)+a*h+(i>>>30),r[n++]=1073741823&u}return i}function c(t,e,r,n,i,s){for(var o=16383&e,a=e>>14;--s>=0;){var u=16383&this[t],h=this[t++]>>14,c=a*u+h*o;u=o*u+((16383&c)<<14)+r[n]+i,i=(u>>28)+(c>>14)+a*h,r[n++]=268435455&u}return i}function f(t){return pn.charAt(t)}function l(t,e){var r=gn[t.charCodeAt(e)];return null==r?-1:r}function d(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function p(t){this.t=1,this.s=0>t?-1:0,t>0?this[0]=t:-1>t?this[0]=t+this.DV:this.t=0}function g(t){var e=a();return e.fromInt(t),e}function y(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var a=8==r?255&t[n]:l(t,n);0>a?"-"==t.charAt(n)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function m(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<0)for(a>a)>0&&(i=!0,s=f(r));o>=0;)e>a?(r=(this[o]&(1<>(a+=this.DB-e)):(r=this[o]>>(a-=e)&n,0>=a&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=f(r));return i?s:"0"}function S(){var t=a();return o.ZERO.subTo(this,t),t}function _(){return this.s<0?this.negate():this}function E(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(e=r-t.t,0!=e)return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0}function b(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function w(){return this.t<=0?0:this.DB*(this.t-1)+b(this[this.t-1]^this.s&this.DM)}function R(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}function x(t,e){for(var r=t;r=0;--r)e[r+o+1]=this[r]>>i|a,a=(this[r]&s)<=0;--r)e[r]=0;e[o]=a,e.t=this.t+o+1,e.s=this.s,e.clamp()}function F(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)return void(e.t=0);var n=t%this.DB,i=this.DB-n,s=(1<>n;for(var o=r+1;o>n;n>0&&(e[this.t-r-1]|=(this.s&s)<r;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=0>n?-1:0,-1>n?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()}function U(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}function P(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(c,s),i.lShiftTo(c,r)):(n.copyTo(s),i.copyTo(r));var f=s.t,l=s[f-1];if(0!=l){var d=l*(1<1?s[f-2]>>this.F2:0),p=this.FV/d,g=(1<=0&&(r[r.t++]=1,r.subTo(S,r)),o.ONE.dlShiftTo(f,S),S.subTo(s,s);s.t=0;){var _=r[--v]==l?this.DM:Math.floor(r[v]*p+(r[v-1]+y)*g);if((r[v]+=s.am(0,_,r,m,0,f))<_)for(s.dlShiftTo(m,S),r.subTo(S,r);r[v]<--_;)r.subTo(S,r)}null!=e&&(r.drShiftTo(f,e),u!=h&&o.ZERO.subTo(e,e)),r.t=f,r.clamp(),c>0&&r.rShiftTo(c,r),0>u&&o.ZERO.subTo(r,r)}}}function I(t){var e=a();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(o.ZERO)>0&&t.subTo(e,e),e}function D(t){this.m=t}function C(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function T(t){return t}function j(t){t.divRemTo(this.m,null,t)}function J(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function H(t,e){t.squareTo(e),this.reduce(e)}function B(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return e=e*(2-(15&t)*e)&15,e=e*(2-(255&t)*e)&255,e=e*(2-((65535&t)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function k(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}function M(t){var e=a();return t.copyTo(e),this.reduce(e),e}function V(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function L(t,e){t.squareTo(e),this.reduce(e)}function q(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function z(){return 0==(this.t>0?1&this[0]:this.s)}function W(t,e){if(t>4294967295||1>t)return o.ONE;var r=a(),n=a(),i=e.convert(this),s=b(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var u=r;r=n,n=u}return e.revert(r)}function Y(t,e){var r;return r=256>t||e.isEven()?new D(e):new k(e),this.exp(t,r)}function G(){var t=a();return this.copyTo(t),t}function X(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function Z(){return 0==this.t?this.s:this[0]<<16>>16}function Q(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function tt(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function et(t){if(null==t&&(t=10),0==this.signum()||2>t||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=g(r),i=a(),s=a(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(t).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(t)+o}function rt(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,a=0,u=0;uh?"-"==t.charAt(u)&&0==this.signum()&&(i=!0):(a=e*a+h,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)}function nt(t,e,r){if("number"==typeof e)if(2>t)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(o.ONE.shiftLeft(t-1),ft,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(o.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<=0;)8>n?(r=(this[t]&(1<>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,0>=n&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e}function st(t){return 0==this.compareTo(t)}function ot(t){return this.compareTo(t)<0?this:t}function at(t){return this.compareTo(t)>0?this:t}function ut(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;s>n;++n)r[n]=e(this[n],t[n]);if(t.tt?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function St(t){var e=a();return 0>t?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function _t(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function Et(){for(var t=0;t=this.t?0!=this.s:0!=(this[e]&1<r;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=0>n?-1:0,n>0?e[r++]=n:-1>n&&(e[r++]=this.DV+n),e.t=r,e.clamp()}function Ot(t){var e=a();return this.addTo(t,e),e}function Pt(t){var e=a();return this.subTo(t,e),e}function It(t){var e=a();return this.multiplyTo(t,e),e}function Dt(){var t=a();return this.squareTo(t),t}function Ct(t){var e=a();return this.divRemTo(t,e,null),e}function Tt(t){var e=a();return this.divRemTo(t,null,e),e}function jt(t){var e=a(),r=a();return this.divRemTo(t,e,r),new Array(e,r)}function Jt(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Ht(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function Bt(){}function kt(t){return t}function Nt(t,e,r){t.multiplyTo(e,r)}function Mt(t,e){t.squareTo(e)}function Vt(t){return this.exp(t,new Bt)}function Lt(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;i>n;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);i>n;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()}function qt(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=a();return t.copyTo(e),this.reduce(e),e}function Yt(t){return t}function Gt(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function Xt(t,e){t.squareTo(e),this.reduce(e)}function $t(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function Zt(t,e){var r,n,i=t.bitLength(),s=g(1);if(0>=i)return s;r=18>i?1:48>i?3:144>i?4:768>i?5:6,n=8>i?new D(e):e.isEven()?new zt(e):new k(e);var o=new Array,u=3,h=r-1,c=(1<1){var f=a();for(n.sqrTo(o[1],f);c>=u;)o[u]=a(),n.mulTo(f,o[u-2],o[u]),u+=2}var l,d,p=t.t-1,y=!0,v=a();for(i=b(t[p])-1;p>=0;){for(i>=h?l=t[p]>>i-h&c:(l=(t[p]&(1<0&&(l|=t[p-1]>>this.DB+i-h)),u=r;0==(1&l);)l>>=1,--u;if((i-=u)<0&&(i+=this.DB,--p),y)o[l].copyTo(s),y=!1;else{for(;u>1;)n.sqrTo(s,v),n.sqrTo(v,s),u-=2;u>0?n.sqrTo(s,v):(d=s,s=v,v=d),n.mulTo(v,o[l],s)}for(;p>=0&&0==(t[p]&1<s)return e;for(s>i&&(s=i),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function te(t){if(0>=t)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r}function ee(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return o.ZERO;for(var r=t.clone(),n=this.clone(),i=g(1),s=g(0),a=g(0),u=g(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(t,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(a,i),s.subTo(u,s)):(n.subTo(r,n),e&&a.subTo(i,a),u.subTo(s,u))}return 0!=n.compareTo(o.ONE)?o.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u}function re(t){var e,r=this.abs();if(1==r.t&&r[0]<=yn[yn.length-1]){for(e=0;en;)n*=yn[i++];for(n=r.modInt(n);i>e;)if(n%yn[e++]==0)return!1}return r.millerRabin(t)}function ne(t){var e=this.subtract(o.ONE),r=e.getLowestSetBit();if(0>=r)return!1;var n=e.shiftRight(r);t=t+1>>1,t>yn.length&&(t=yn.length);for(var i=a(),s=0;t>s;++s){i.fromInt(yn[Math.floor(Math.random()*yn.length)]);var u=i.modPow(n,this);if(0!=u.compareTo(o.ONE)&&0!=u.compareTo(e)){for(var h=1;h++e;++e)this.S[e]=e;for(r=0,e=0;256>e;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0}function oe(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}function ae(){return new ie}function ue(t){Sn[_n++]^=255&t,Sn[_n++]^=t>>8&255,Sn[_n++]^=t>>16&255,Sn[_n++]^=t>>24&255,_n>=En&&(_n-=En)}function he(){ue((new Date).getTime())}function ce(){if(null==mn){for(he(),mn=ae(),mn.init(Sn),_n=0;_n=0&&e>0;){var i=t.charCodeAt(n--);128>i?r[--e]=i:i>127&&2048>i?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var s=new le,a=new Array;e>2;){for(a[0]=0;0==a[0];)s.nextBytes(a);r[--e]=a[0]}return r[--e]=2,r[--e]=0,new o(r)}function ge(t,e,r){for(var n="",i=0;n.length>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function ye(t,e,r){if(t.length+2*xn+2>e)throw"Message too long for RSA";var n,i="";for(n=0;n0&&e.length>0?(this.n=de(t,16),this.e=parseInt(e,16)):alert("Invalid RSA public key")}function Se(t){return t.modPowInt(this.e,this.n)}function _e(t){var e=pe(t,this.n.bitLength()+7>>3);if(null==e)return null;var r=this.doPublic(e);if(null==r)return null;var n=r.toString(16);return 0==(1&n.length)?n:"0"+n}function Ee(t,e){var r=ye(t,this.n.bitLength()+7>>3,e);if(null==r)return null;var n=this.doPublic(r);if(null==n)return null;var i=n.toString(16);return 0==(1&i.length)?i:"0"+i}function be(t,e){for(var r=t.toByteArray(),n=0;n=r.length)return null;for(var i="";++ns?i+=String.fromCharCode(s):s>191&&224>s?(i+=String.fromCharCode((31&s)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&s)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}function we(t,e,r){for(var n="",i=0;n.length>24,(16711680&i)>>16,(65280&i)>>8,255&i])),i+=1;return n}function Re(t,e,r){t=t.toByteArray();var n;for(n=0;n0&&e.length>0?(this.n=de(t,16),this.e=parseInt(e,16),this.d=de(r,16)):alert("Invalid RSA private key")}function Ae(t,e,r,n,i,s,o,a){if(this.isPrivate=!0,null==t)throw"RSASetPrivateEx N == null";if(null==e)throw"RSASetPrivateEx E == null";if(0==t.length)throw"RSASetPrivateEx N.length == 0";if(0==e.length)throw"RSASetPrivateEx E.length == 0";null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=de(t,16),this.e=parseInt(e,16),this.d=de(r,16),this.p=de(n,16),this.q=de(i,16),this.dmp1=de(s,16),this.dmq1=de(o,16),this.coeff=de(a,16)):alert("Invalid RSA private key in RSASetPrivateEx")}function Fe(t,e){var r=new le,n=t>>1;this.e=parseInt(e,16);for(var i=new o(e,16);;){for(;this.p=new o(t-n,1,r),0!=this.p.subtract(o.ONE).gcd(i).compareTo(o.ONE)||!this.p.isProbablePrime(10););for(;this.q=new o(n,1,r),0!=this.q.subtract(o.ONE).gcd(i).compareTo(o.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var a=this.p.subtract(o.ONE),u=this.q.subtract(o.ONE),h=a.multiply(u);if(0==h.gcd(i).compareTo(o.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(h),this.dmp1=this.d.mod(a),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}}function Ke(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}function Ue(t){var e=de(t,16),r=this.doPrivate(e);return null==r?null:be(r,this.n.bitLength()+7>>3)}function Oe(t,e){var r=de(t,16),n=this.doPrivate(r);return null==n?null:Re(n,this.n.bitLength()+7>>3,e)}function Pe(t,e){this.x=e,this.q=t}function Ie(t){return t==this?!0:this.q.equals(t.q)&&this.x.equals(t.x)}function De(){return this.x}function Ce(){return new Pe(this.q,this.x.negate().mod(this.q))}function Te(t){return new Pe(this.q,this.x.add(t.toBigInteger()).mod(this.q))}function je(t){return new Pe(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}function Je(t){return new Pe(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}function He(){return new Pe(this.q,this.x.square().mod(this.q))}function Be(t){return new Pe(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}function ke(t,e,r,n){this.curve=t,this.x=e,this.y=r,null==n?this.z=o.ONE:this.z=n,this.zinv=null}function Ne(){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))}function Me(){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))}function Ve(t){if(t==this)return!0;if(this.isInfinity())return t.isInfinity();if(t.isInfinity())return this.isInfinity();var e,r;return e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),e.equals(o.ZERO)?(r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q),r.equals(o.ZERO)):!1}function Le(){return null==this.x&&null==this.y?!0:this.z.equals(o.ZERO)&&!this.y.toBigInteger().equals(o.ZERO)}function qe(){return new ke(this.curve,this.x,this.y.negate(),this.z)}function ze(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(o.ZERO.equals(r))return o.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new o("3"),i=this.x.toBigInteger(),s=this.y.toBigInteger(),a=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),u=a.multiply(r),h=i.multiply(a),c=e.square().multiply(this.z),f=c.subtract(h.shiftLeft(1)).multiply(t.z).subtract(u).multiply(r).mod(this.curve.q),l=h.multiply(n).multiply(e).subtract(s.multiply(u)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(u)).mod(this.curve.q),d=u.multiply(this.z).multiply(t.z).mod(this.curve.q);return new ke(this.curve,this.curve.fromBigInteger(f),this.curve.fromBigInteger(l),d)}function We(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new o("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),s=this.curve.a.toBigInteger(),a=e.square().multiply(t);o.ZERO.equals(s)||(a=a.add(this.z.square().multiply(s))),a=a.mod(this.curve.q);var u=a.square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),h=a.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(a.square().multiply(a)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new ke(this.curve,this.curve.fromBigInteger(u),this.curve.fromBigInteger(h),c)}function Ye(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new o("3")),i=this.negate(),s=this;for(e=n.bitLength()-2;e>0;--e){s=s.twice();var a=n.testBit(e),u=r.testBit(e);a!=u&&(s=s.add(a?this:i))}return s}function Ge(t,e,r){var n;n=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),s=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?i=r.testBit(n)?i.add(s):i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i}function Xe(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new ke(this,null,null)}function $e(){return this.q}function Ze(){return this.a}function Qe(){return this.b}function tr(t){return t==this?!0:this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}function er(){return this.infinity}function rr(t){return new Pe(this.q,t)}function nr(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 o(r,16)),this.fromBigInteger(new o(n,16)));default:return null}}function ir(t){for(var e=new Array,r=0;rn||n>255)throw"integer not in range 0-255";var i=("00"+n.toString(16)).slice(-2);return i}).join("");return e}catch(r){throw"malformed integer array string: "+r}}function Fr(t){var e=t;return e=e.replace("-----BEGIN RSA PRIVATE KEY-----",""),e=e.replace("-----END RSA PRIVATE KEY-----",""),e=e.replace(/[ \n]+/g,"")}function Kr(t){var e=new Array,r=Fn.getStartPosOfV_AtObj(t,0),n=Fn.getPosOfNextSibling_AtObj(t,r),i=Fn.getPosOfNextSibling_AtObj(t,n),s=Fn.getPosOfNextSibling_AtObj(t,i),o=Fn.getPosOfNextSibling_AtObj(t,s),a=Fn.getPosOfNextSibling_AtObj(t,o),u=Fn.getPosOfNextSibling_AtObj(t,a),h=Fn.getPosOfNextSibling_AtObj(t,u),c=Fn.getPosOfNextSibling_AtObj(t,h);return e.push(r,n,i,s,o,a,u,h,c),e}function Ur(t){var e=Kr(t),r=Fn.getHexOfV_AtObj(t,e[0]),n=Fn.getHexOfV_AtObj(t,e[1]),i=Fn.getHexOfV_AtObj(t,e[2]),s=Fn.getHexOfV_AtObj(t,e[3]),o=Fn.getHexOfV_AtObj(t,e[4]),a=Fn.getHexOfV_AtObj(t,e[5]),u=Fn.getHexOfV_AtObj(t,e[6]),h=Fn.getHexOfV_AtObj(t,e[7]),c=Fn.getHexOfV_AtObj(t,e[8]),f=new Array;return f.push(r,n,i,s,o,a,u,h,c),f}function Or(t){var e=Ur(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Pr(t){var e=Fr(t),r=i(e),n=Ur(r);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])}function Ir(t,e){for(var r="",n=e/4-t.length,i=0;n>i;i++)r+="0";return r+t}function Dr(t,e){var r=function(t){return KJUR.crypto.Util.hashString(t,e)},n=r(t);return this.signWithMessageHash(n,e)}function Cr(t,e){var r=KJUR.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),n=de(r,16),i=this.doPrivate(n),s=i.toString(16);return Ir(s,this.n.bitLength())}function Tr(t){return Dr.call(this,t,"sha1")}function jr(t){return Dr.call(this,t,"sha256")}function Jr(t,e,r){for(var n="",i=0;n.length>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function Hr(t,e,r){var n=function(t){return KJUR.crypto.Util.hashHex(t,e)},i=n(_r(t));return void 0===r&&(r=-1),this.signWithMessageHashPSS(i,e,r)}function Br(t,e,r){var n,i=Sr(t),s=i.length,a=this.n.bitLength()-1,u=Math.ceil(a/8),h=function(t){return KJUR.crypto.Util.hashHex(t,e)};if(-1===r||void 0===r)r=s;else if(-2===r)r=u-s-2;else if(-2>r)throw"invalid salt length";if(s+r+2>u)throw"data too long";var c="";r>0&&(c=new Array(r),(new le).nextBytes(c),c=String.fromCharCode.apply(String,c));var f=Sr(h(_r("\x00\x00\x00\x00\x00\x00\x00\x00"+i+c))),l=[];for(n=0;u-r-s-2>n;n+=1)l[n]=0;var d=String.fromCharCode.apply(String,l)+""+c,p=Jr(f,d.length,h),g=[];for(n=0;n>8*u-a&255;for(g[0]&=~y,n=0;s>n;n++)g.push(f.charCodeAt(n));return g.push(188),Ir(this.doPrivate(new o(g)).toString(16),this.n.bitLength())}function kr(t,e,r){var n=new ve;n.setPublic(e,r);var i=n.doPublic(t);return i}function Nr(t,e,r){var n=kr(t,e,r),i=n.toString(16).replace(/^1f+00/,"");return i}function Mr(t){for(var e in KJUR.crypto.Util.DIGESTINFOHEAD){var r=KJUR.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r){var i=[e,t.substring(n)];return i}}return[]}function Vr(t,e,r,n){var i=Nr(e,r,n),s=Mr(i);if(0==s.length)return!1;var o=s[0],a=s[1],u=function(t){return KJUR.crypto.Util.hashString(t,o)},h=u(t);return a==h}function Lr(t,e){var r=de(t,16),n=Vr(e,r,this.n.toString(16),this.e.toString(16));return n}function qr(t,e){e=e.replace(Dn,""),e=e.replace(/[ \n]+/g,"");var r=de(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),s=Mr(i);if(0==s.length)return!1;var o=s[0],a=s[1],u=function(t){return KJUR.crypto.Util.hashString(t,o)},h=u(t);return a==h}function zr(t,e){e=e.replace(Dn,""),e=e.replace(/[ \n]+/g,"");var r=de(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),s=Mr(i);if(0==s.length)return!1;var o=(s[0],s[1]);return o==t}function Wr(t,e,r,n){var i=function(t){return KJUR.crypto.Util.hashHex(t,r)},s=i(_r(t));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(s,e,r,n)}function Yr(t,e,r,n){var i=new o(e,16);if(i.bitLength()>this.n.bitLength())return!1;var s,a=function(t){return KJUR.crypto.Util.hashHex(t,r)},u=Sr(t),h=u.length,c=this.n.bitLength()-1,f=Math.ceil(c/8);if(-1===n||void 0===n)n=h;else if(-2===n)n=f-h-2;else if(-2>n)throw"invalid salt length";if(h+n+2>f)throw"data too long";var l=this.doPublic(i).toByteArray();for(s=0;s>8*f-c&255;if(0!==(d.charCodeAt(0)&g))throw"bits beyond keysize not zero";var y=Jr(p,d.length,a),v=[];for(s=0;ss;s+=1)if(0!==v[s])throw"leftmost octets not zero";if(1!==v[m])throw"0x01 marker not found";return p===Sr(a(_r("\x00\x00\x00\x00\x00\x00\x00\x00"+u+String.fromCharCode.apply(String,v.slice(-n)))))}function Gr(){this.subjectPublicKeyRSA=null,this.subjectPublicKeyRSA_hN=null,this.subjectPublicKeyRSA_hE=null,this.hex=null,this.getSerialNumberHex=function(){return Fn.getDecendantHexVByNthList(this.hex,0,[0,1])},this.getSignatureAlgorithmField=function(){var t=Fn.getDecendantHexVByNthList(this.hex,0,[0,2,0]),e=KJUR.asn1.ASN1Util.oidHexToInt(t),r=KJUR.asn1.x509.OID.oid2name(e);return r},this.getIssuerHex=function(){return Fn.getDecendantHexTLVByNthList(this.hex,0,[0,3])},this.getIssuerString=function(){return Gr.hex2dn(Fn.getDecendantHexTLVByNthList(this.hex,0,[0,3]))},this.getSubjectHex=function(){return Fn.getDecendantHexTLVByNthList(this.hex,0,[0,5])},this.getSubjectString=function(){return Gr.hex2dn(Fn.getDecendantHexTLVByNthList(this.hex,0,[0,5]))},this.getNotBefore=function(){var t=Fn.getDecendantHexVByNthList(this.hex,0,[0,4,0]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=Fn.getDecendantHexVByNthList(this.hex,0,[0,4,1]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.readCertPEM=function(t){var e=Gr.pemToHex(t),r=Gr.getPublicKeyHexArrayFromCertHex(e),n=new ve;n.setPublic(r[0],r[1]),this.subjectPublicKeyRSA=n,this.subjectPublicKeyRSA_hN=r[0],this.subjectPublicKeyRSA_hE=r[1],this.hex=e},this.readCertPEMWithoutRSAInit=function(t){var e=Gr.pemToHex(t),r=Gr.getPublicKeyHexArrayFromCertHex(e);this.subjectPublicKeyRSA.setPublic(r[0],r[1]),this.subjectPublicKeyRSA_hN=r[0],this.subjectPublicKeyRSA_hE=r[1],this.hex=e},this.getInfo=function(){var t="Basic Fields\n";t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n";var e=Gr.getSubjectPublicKeyInfoPosFromCertHex(this.hex),r=Fn.getHexOfTLV_AtObj(this.hex,e),n=In.getKey(r,null,"pkcs8pub");n instanceof ve&&(t+=" key algorithm: RSA\n",t+=" n="+n.n.toString(16).substr(0,16)+"...\n",t+=" e="+n.e.toString(16)+"\n"),t+="X509v3 Extensions:\n";for(var i=Gr.getV3ExtInfoListOfCertHex(this.hex),s=0;s":">",'"':""","'":"'","/":"/","`":"`"},a=["toString","valueOf"],u={isArray:function(t){return e.toString.apply(t)===r},isBoolean:function(t){return"boolean"==typeof t},isFunction:function(t){return"function"==typeof t||e.toString.apply(t)===n},isNull:function(t){return null===t},isNumber:function(t){return"number"==typeof t&&isFinite(t)},isObject:function(e){return e&&("object"==typeof e||t.isFunction(e))||!1},isString:function(t){return"string"==typeof t},isUndefined:function(t){return"undefined"==typeof t},_IEEnumFix:nn.env.ua.ie?function(r,n){var i,s,o;for(i=0;i"'\/`]/g,function(t){return o[t]})},extend:function(r,n,i){if(!n||!r)throw new Error("extend failed, please check that all dependencies are included.");var s,o=function(){};if(o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r,r.superclass=n.prototype,n.prototype.constructor==e.constructor&&(n.prototype.constructor=n),i){for(s in i)t.hasOwnProperty(i,s)&&(r.prototype[s]=i[s]);t._IEEnumFix(r.prototype,i)}},augmentObject:function(e,r){if(!r||!e)throw new Error("Absorb failed, verify dependencies.");var n,i,s=arguments,o=s[2];if(o&&o!==!0)for(n=2;nn;n+=1)t.isObject(e[n])?s.push(r>0?t.dump(e[n],r-1):o):s.push(e[n]),s.push(u);s.length>1&&s.pop(),s.push("]")}else{s.push("{");for(n in e)t.hasOwnProperty(e,n)&&(s.push(n+h),t.isObject(e[n])?s.push(r>0?t.dump(e[n],r-1):o):s.push(e[n]),s.push(u));s.length>1&&s.pop(),s.push("}")}return s.join("")},substitute:function(e,r,n,s){for(var o,a,u,h,c,f,l,d,p,g=[],y=e.length,v="dump",m=" ",S="{",_="}";o=e.lastIndexOf(S,y),!(0>o||(a=e.indexOf(_,o),o+1>a));)l=e.substring(o+1,a),h=l,f=null,u=h.indexOf(m),u>-1&&(f=h.substring(u+1),h=h.substring(0,u)),c=r[h],n&&(c=n(h,c,f)),t.isObject(c)?t.isArray(c)?c=t.dump(c,parseInt(f,10)):(f=f||"",d=f.indexOf(v),d>-1&&(f=f.substring(4)),p=c.toString(),c=p===i||d>-1?t.dump(c,parseInt(f,10)):p):t.isString(c)||t.isNumber(c)||(c="~-"+g.length+"-~",g[g.length]=l),e=e.substring(0,o)+c+e.substring(a+1),s===!1&&(y=o-1);for(o=g.length-1;o>=0;o-=1)e=e.replace(new RegExp("~-"+o+"-~"),"{"+g[o]+"}","g");return e},trim:function(t){try{return t.replace(/^\s+|\s+$/g,"")}catch(e){return t}},merge:function(){var e,r={},n=arguments,i=n.length;for(e=0;i>e;e+=1)t.augmentObject(r,n[e],!0);return r},later:function(e,r,n,i,o){e=e||0,r=r||{};var a,u,h=n,c=i;if(t.isString(n)&&(h=r[n]),!h)throw new TypeError("method undefined");return t.isUndefined(i)||t.isArray(c)||(c=[i]),a=function(){h.apply(r,c||s)},u=o?setInterval(a,e):setTimeout(a,e),{interval:o,cancel:function(){this.interval?clearInterval(u):clearTimeout(u)}}},isValue:function(e){return t.isObject(e)||t.isString(e)||t.isNumber(e)||t.isBoolean(e)}};t.hasOwnProperty=e.hasOwnProperty?function(t,e){return t&&t.hasOwnProperty&&t.hasOwnProperty(e)}:function(e,r){return!t.isUndefined(e[r])&&e.constructor.prototype[r]!==e[r]},u.augmentObject(t,u,!0),nn.util.Lang=t,t.augment=t.augmentProto,nn.augment=t.augmentProto,nn.extend=t.extend}(),nn.register("yahoo",nn,{version:"2.9.0",build:"2800"});var sn=sn||function(t,e){var r={},n=r.lib={},i=n.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var r=new t;return e&&r.mixIn(e),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=n.WordArray=i.extend({init:function(t,r){t=this.words=t||[],r!=e?this.sigBytes=r:this.sigBytes=4*t.length},toString:function(t){return(t||a).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var s=0;i>s;s++){var o=r[s>>>2]>>>24-s%4*8&255;e[n+s>>>2]|=o<<24-(n+s)%4*8}else for(var s=0;i>s;s+=4)e[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r=[],n=0;e>n;n+=4)r.push(4294967296*t.random()|0);return new s.init(r,e)}}),o=r.enc={},a=o.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;r>i;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;e>n;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new s.init(r,e/2)}},u=o.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;r>i;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;e>n;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new s.init(r,e)}},h=o.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},c=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=h.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,i=r.sigBytes,o=this.blockSize,a=4*o,u=i/a;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var h=u*o,c=t.min(4*h,i);if(h){for(var f=0;h>f;f+=o)this._doProcessBlock(n,f);var l=n.splice(0,h);r.sigBytes-=c}return new s.init(l,c)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(n.Hasher=c.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new f.HMAC.init(t,r).finalize(e)}}}),r.algo={});return r}(Math);!function(t){var e=sn,r=e.lib,n=r.Base,i=r.WordArray,e=e.x64={};e.Word=n.extend({init:function(t,e){this.high=t,this.low=e}}),e.WordArray=n.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var t=this.words,e=t.length,r=[],n=0;e>n;n++){var s=t[n];r.push(s.high),r.push(s.low)}return i.create(r,this.sigBytes)},clone:function(){for(var t=n.clone.call(this),e=t.words=this.words.slice(0),r=e.length,i=0;r>i;i++)e[i]=e[i].clone();return t}})}(),sn.lib.Cipher||function(t){var e=sn,r=e.lib,n=r.Base,i=r.WordArray,s=r.BufferedBlockAlgorithm,o=e.enc.Base64,a=e.algo.EvpKDF,u=r.Cipher=s.extend({cfg:n.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(t){return{encrypt:function(e,r,n){return("string"==typeof r?p:d).encrypt(t,e,r,n)},decrypt:function(e,r,n){return("string"==typeof r?p:d).decrypt(t,e,r,n)}}}});r.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=e.mode={},c=function(e,r,n){var i=this._iv;i?this._iv=t:i=this._prevBlock;for(var s=0;n>s;s++)e[r+s]^=i[s]},f=(r.BlockCipherMode=n.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}})).extend();f.Encryptor=f.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize;c.call(this,t,e,n),r.encryptBlock(t,e),this._prevBlock=t.slice(e,e+n)}}),f.Decryptor=f.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=t.slice(e,e+n);r.decryptBlock(t,e),c.call(this,t,e,n),this._prevBlock=i}}),h=h.CBC=f,f=(e.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,r=r-t.sigBytes%r,n=r<<24|r<<16|r<<8|r,s=[],o=0;r>o;o+=4)s.push(n);r=i.create(s,r),t.concat(r)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}},r.BlockCipher=u.extend({cfg:u.cfg.extend({mode:h,padding:f}),reset:function(){u.reset.call(this);var t=this.cfg,e=t.iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=t.createEncryptor;else r=t.createDecryptor,this._minBufferSize=1;this._mode=r.call(t,this,e&&e.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var l=r.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),h=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext;return t=t.salt,(t?i.create([1398893684,1701076831]).concat(t).concat(e):e).toString(o)},parse:function(t){t=o.parse(t);var e=t.words;if(1398893684==e[0]&&1701076831==e[1]){var r=i.create(e.slice(2,4));e.splice(0,4),t.sigBytes-=16}return l.create({ciphertext:t,salt:r})}},d=r.SerializableCipher=n.extend({cfg:n.extend({format:h}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n);return e=i.finalize(e),i=i.cfg,l.create({ciphertext:e,key:r,iv:i.iv,algorithm:t,mode:i.mode,padding:i.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),e=(e.kdf={}).OpenSSL={execute:function(t,e,r,n){return n||(n=i.random(8)),t=a.create({keySize:e+r}).compute(t,n),r=i.create(t.words.slice(e),4*r),t.sigBytes=4*e,l.create({key:t,iv:r,salt:n})}},p=r.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:e}),encrypt:function(t,e,r,n){return n=this.cfg.extend(n),r=n.kdf.execute(r,t.keySize,t.ivSize),n.iv=r.iv,t=d.encrypt.call(this,t,e,r.key,n),t.mixIn(r),t},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),r=n.kdf.execute(r,t.keySize,t.ivSize,e.salt),n.iv=r.iv,d.decrypt.call(this,t,e,r.key,n)}})}(),function(){for(var t=sn,e=t.lib.BlockCipher,r=t.algo,n=[],i=[],s=[],o=[],a=[],u=[],h=[],c=[],f=[],l=[],d=[],p=0;256>p;p++)d[p]=128>p?p<<1:p<<1^283;for(var g=0,y=0,p=0;256>p;p++){var v=y^y<<1^y<<2^y<<3^y<<4,v=v>>>8^255&v^99;n[g]=v,i[v]=g;var m=d[g],S=d[m],_=d[S],E=257*d[v]^16843008*v;s[g]=E<<24|E>>>8,o[g]=E<<16|E>>>16,a[g]=E<<8|E>>>24,u[g]=E,E=16843009*_^65537*S^257*m^16843008*g,h[v]=E<<24|E>>>8,c[v]=E<<16|E>>>16,f[v]=E<<8|E>>>24,l[v]=E,g?(g=m^d[d[d[_^m]]],y^=d[d[y]]):g=y=1}var b=[0,1,2,4,8,16,32,64,128,27,54],r=r.AES=e.extend({_doReset:function(){for(var t=this._key,e=t.words,r=t.sigBytes/4,t=4*((this._nRounds=r+6)+1),i=this._keySchedule=[],s=0;t>s;s++)if(r>s)i[s]=e[s];else{var o=i[s-1];s%r?r>6&&4==s%r&&(o=n[o>>>24]<<24|n[o>>>16&255]<<16|n[o>>>8&255]<<8|n[255&o]):(o=o<<8|o>>>24,o=n[o>>>24]<<24|n[o>>>16&255]<<16|n[o>>>8&255]<<8|n[255&o],o^=b[s/r|0]<<24),i[s]=i[s-r]^o}for(e=this._invKeySchedule=[],r=0;t>r;r++)s=t-r,o=r%4?i[s]:i[s-4],e[r]=4>r||4>=s?o:h[n[o>>>24]]^c[n[o>>>16&255]]^f[n[o>>>8&255]]^l[n[255&o]]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,o,a,u,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,h,c,f,l,i),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,n,i,s,o,a){for(var u=this._nRounds,h=t[e]^r[0],c=t[e+1]^r[1],f=t[e+2]^r[2],l=t[e+3]^r[3],d=4,p=1;u>p;p++)var g=n[h>>>24]^i[c>>>16&255]^s[f>>>8&255]^o[255&l]^r[d++],y=n[c>>>24]^i[f>>>16&255]^s[l>>>8&255]^o[255&h]^r[d++],v=n[f>>>24]^i[l>>>16&255]^s[h>>>8&255]^o[255&c]^r[d++],l=n[l>>>24]^i[h>>>16&255]^s[c>>>8&255]^o[255&f]^r[d++],h=g,c=y,f=v; -g=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[f>>>8&255]<<8|a[255&l])^r[d++],y=(a[c>>>24]<<24|a[f>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^r[d++],v=(a[f>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^r[d++],l=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&f])^r[d++],t[e]=g,t[e+1]=y,t[e+2]=v,t[e+3]=l},keySize:8});t.AES=e._createHelper(r)}(),function(){function t(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<r;r++){var n=o[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(t=this._subKeys=[],n=0;16>n;n++){for(var i=t[n]=[],s=u[n],r=0;24>r;r++)i[r/6|0]|=e[(a[r]-1+s)%28]<<31-r%6,i[4+(r/6|0)]|=e[28+(a[r+24]-1+s)%28]<<31-r%6;for(i[0]=i[0]<<1|i[0]>>>31,r=1;7>r;r++)i[r]>>>=4*(r-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(e=this._invSubKeys=[],r=0;16>r;r++)e[r]=t[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(r,n,i){this._lBlock=r[n],this._rBlock=r[n+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var s=0;16>s;s++){for(var o=i[s],a=this._lBlock,u=this._rBlock,f=0,l=0;8>l;l++)f|=h[l][((u^o[l])&c[l])>>>0];this._lBlock=u,this._rBlock=a^f}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,t.call(this,1,1431655765),e.call(this,8,16711935),e.call(this,2,858993459),t.call(this,16,65535),t.call(this,4,252645135),r[n]=this._lBlock,r[n+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=n._createHelper(f),s=s.TripleDES=n.extend({_doReset:function(){var t=this._key.words;this._des1=f.createEncryptor(i.create(t.slice(0,2))),this._des2=f.createEncryptor(i.create(t.slice(2,4))),this._des3=f.createEncryptor(i.create(t.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=n._createHelper(s)}(),function(){var t=sn,e=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp(),t=[];for(var i=0;r>i;i+=3)for(var s=(e[i>>>2]>>>24-8*(i%4)&255)<<16|(e[i+1>>>2]>>>24-8*((i+1)%4)&255)<<8|e[i+2>>>2]>>>24-8*((i+2)%4)&255,o=0;4>o&&r>i+.75*o;o++)t.push(n.charAt(s>>>6*(3-o)&63));if(e=n.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var r=t.length,n=this._map,i=n.charAt(64);i&&(i=t.indexOf(i),-1!=i&&(r=i));for(var i=[],s=0,o=0;r>o;o++)if(o%4){var a=n.indexOf(t.charAt(o-1))<<2*(o%4),u=n.indexOf(t.charAt(o))>>>6-2*(o%4);i[s>>>2]|=(a|u)<<24-8*(s%4),s++}return e.create(i,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){function e(t,e,r,n,i,s,o){return t=t+(e&r|~e&n)+i+o,(t<>>32-s)+e}function r(t,e,r,n,i,s,o){return t=t+(e&n|r&~n)+i+o,(t<>>32-s)+e}function n(t,e,r,n,i,s,o){return t=t+(e^r^n)+i+o,(t<>>32-s)+e}function i(t,e,r,n,i,s,o){return t=t+(r^(e|~n))+i+o,(t<>>32-s)+e}for(var s=sn,o=s.lib,a=o.WordArray,u=o.Hasher,o=s.algo,h=[],c=0;64>c;c++)h[c]=4294967296*t.abs(t.sin(c+1))|0;o=o.MD5=u.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,s){for(var o=0;16>o;o++){var a=s+o,u=t[a];t[a]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}var o=this._hash.words,a=t[s+0],u=t[s+1],c=t[s+2],f=t[s+3],l=t[s+4],d=t[s+5],p=t[s+6],g=t[s+7],y=t[s+8],v=t[s+9],m=t[s+10],S=t[s+11],_=t[s+12],E=t[s+13],b=t[s+14],w=t[s+15],R=o[0],x=o[1],A=o[2],F=o[3],R=e(R,x,A,F,a,7,h[0]),F=e(F,R,x,A,u,12,h[1]),A=e(A,F,R,x,c,17,h[2]),x=e(x,A,F,R,f,22,h[3]),R=e(R,x,A,F,l,7,h[4]),F=e(F,R,x,A,d,12,h[5]),A=e(A,F,R,x,p,17,h[6]),x=e(x,A,F,R,g,22,h[7]),R=e(R,x,A,F,y,7,h[8]),F=e(F,R,x,A,v,12,h[9]),A=e(A,F,R,x,m,17,h[10]),x=e(x,A,F,R,S,22,h[11]),R=e(R,x,A,F,_,7,h[12]),F=e(F,R,x,A,E,12,h[13]),A=e(A,F,R,x,b,17,h[14]),x=e(x,A,F,R,w,22,h[15]),R=r(R,x,A,F,u,5,h[16]),F=r(F,R,x,A,p,9,h[17]),A=r(A,F,R,x,S,14,h[18]),x=r(x,A,F,R,a,20,h[19]),R=r(R,x,A,F,d,5,h[20]),F=r(F,R,x,A,m,9,h[21]),A=r(A,F,R,x,w,14,h[22]),x=r(x,A,F,R,l,20,h[23]),R=r(R,x,A,F,v,5,h[24]),F=r(F,R,x,A,b,9,h[25]),A=r(A,F,R,x,f,14,h[26]),x=r(x,A,F,R,y,20,h[27]),R=r(R,x,A,F,E,5,h[28]),F=r(F,R,x,A,c,9,h[29]),A=r(A,F,R,x,g,14,h[30]),x=r(x,A,F,R,_,20,h[31]),R=n(R,x,A,F,d,4,h[32]),F=n(F,R,x,A,y,11,h[33]),A=n(A,F,R,x,S,16,h[34]),x=n(x,A,F,R,b,23,h[35]),R=n(R,x,A,F,u,4,h[36]),F=n(F,R,x,A,l,11,h[37]),A=n(A,F,R,x,g,16,h[38]),x=n(x,A,F,R,m,23,h[39]),R=n(R,x,A,F,E,4,h[40]),F=n(F,R,x,A,a,11,h[41]),A=n(A,F,R,x,f,16,h[42]),x=n(x,A,F,R,p,23,h[43]),R=n(R,x,A,F,v,4,h[44]),F=n(F,R,x,A,_,11,h[45]),A=n(A,F,R,x,w,16,h[46]),x=n(x,A,F,R,c,23,h[47]),R=i(R,x,A,F,a,6,h[48]),F=i(F,R,x,A,g,10,h[49]),A=i(A,F,R,x,b,15,h[50]),x=i(x,A,F,R,d,21,h[51]),R=i(R,x,A,F,_,6,h[52]),F=i(F,R,x,A,f,10,h[53]),A=i(A,F,R,x,m,15,h[54]),x=i(x,A,F,R,u,21,h[55]),R=i(R,x,A,F,y,6,h[56]),F=i(F,R,x,A,w,10,h[57]),A=i(A,F,R,x,p,15,h[58]),x=i(x,A,F,R,E,21,h[59]),R=i(R,x,A,F,l,6,h[60]),F=i(F,R,x,A,S,10,h[61]),A=i(A,F,R,x,c,15,h[62]),x=i(x,A,F,R,v,21,h[63]);o[0]=o[0]+R|0,o[1]=o[1]+x|0,o[2]=o[2]+A|0,o[3]=o[3]+F|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var s=t.floor(n/4294967296);for(r[(i+64>>>9<<4)+15]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[(i+64>>>9<<4)+14]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(r.length+1),this._process(),e=this._hash,r=e.words,n=0;4>n;n++)i=r[n],r[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return e},clone:function(){var t=u.clone.call(this);return t._hash=this._hash.clone(),t}}),s.MD5=u._createHelper(o),s.HmacMD5=u._createHmacHelper(o)}(Math),function(){var t=sn,e=t.lib,r=e.WordArray,n=e.Hasher,i=[],e=t.algo.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],s=r[1],o=r[2],a=r[3],u=r[4],h=0;80>h;h++){if(16>h)i[h]=0|t[e+h];else{var c=i[h-3]^i[h-8]^i[h-14]^i[h-16];i[h]=c<<1|c>>>31}c=(n<<5|n>>>27)+u+i[h],c=20>h?c+((s&o|~s&a)+1518500249):40>h?c+((s^o^a)+1859775393):60>h?c+((s&o|s&a|o&a)-1894007588):c+((s^o^a)-899497514),u=a,a=o,o=s<<30|s>>>2,s=n,n=c}r[0]=r[0]+n|0,r[1]=r[1]+s|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[(n+64>>>9<<4)+14]=Math.floor(r/4294967296),e[(n+64>>>9<<4)+15]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});t.SHA1=n._createHelper(e),t.HmacSHA1=n._createHmacHelper(e)}(),function(t){for(var e=sn,r=e.lib,n=r.WordArray,i=r.Hasher,r=e.algo,s=[],o=[],a=function(t){return 4294967296*(t-(0|t))|0},u=2,h=0;64>h;){var c;t:{c=u;for(var f=t.sqrt(c),l=2;f>=l;l++)if(!(c%l)){c=!1;break t}c=!0}c&&(8>h&&(s[h]=a(t.pow(u,.5))),o[h]=a(t.pow(u,1/3)),h++),u++}var d=[],r=r.SHA256=i.extend({_doReset:function(){this._hash=new n.init(s.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],u=r[4],h=r[5],c=r[6],f=r[7],l=0;64>l;l++){if(16>l)d[l]=0|t[e+l];else{var p=d[l-15],g=d[l-2];d[l]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+d[l-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+d[l-16]}p=f+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&h^~u&c)+o[l]+d[l],g=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&s^i&s),f=c,c=h,h=u,u=a+p|0,a=s,s=i,i=n,n=p+g|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+u|0,r[5]=r[5]+h|0,r[6]=r[6]+c|0,r[7]=r[7]+f|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[(i+64>>>9<<4)+14]=t.floor(n/4294967296),r[(i+64>>>9<<4)+15]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(r),e.HmacSHA256=i._createHmacHelper(r)}(Math),function(){var t=sn,e=t.lib.WordArray,r=t.algo,n=r.SHA256,r=r.SHA224=n.extend({_doReset:function(){this._hash=new e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=4,t}});t.SHA224=n._createHelper(r),t.HmacSHA224=n._createHmacHelper(r)}(),function(){function t(){return i.create.apply(i,arguments)}for(var e=sn,r=e.lib.Hasher,n=e.x64,i=n.Word,s=n.WordArray,n=e.algo,o=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=t();n=n.SHA512=r.extend({_doReset:function(){this._hash=new s.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],u=r[3],h=r[4],c=r[5],f=r[6],r=r[7],l=n.high,d=n.low,p=i.high,g=i.low,y=s.high,v=s.low,m=u.high,S=u.low,_=h.high,E=h.low,b=c.high,w=c.low,R=f.high,x=f.low,A=r.high,F=r.low,K=l,U=d,O=p,P=g,I=y,D=v,C=m,T=S,j=_,J=E,H=b,B=w,k=R,N=x,M=A,V=F,L=0;80>L;L++){var q=a[L];if(16>L)var z=q.high=0|t[e+2*L],W=q.low=0|t[e+2*L+1];else{var z=a[L-15],W=z.high,Y=z.low,z=(W>>>1|Y<<31)^(W>>>8|Y<<24)^W>>>7,Y=(Y>>>1|W<<31)^(Y>>>8|W<<24)^(Y>>>7|W<<25),G=a[L-2],W=G.high,X=G.low,G=(W>>>19|X<<13)^(W<<3|X>>>29)^W>>>6,X=(X>>>19|W<<13)^(X<<3|W>>>29)^(X>>>6|W<<26),W=a[L-7],$=W.high,Z=a[L-16],Q=Z.high,Z=Z.low,W=Y+W.low,z=z+$+(Y>>>0>W>>>0?1:0),W=W+X,z=z+G+(X>>>0>W>>>0?1:0),W=W+Z,z=z+Q+(Z>>>0>W>>>0?1:0);q.high=z,q.low=W}var $=j&H^~j&k,Z=J&B^~J&N,q=K&O^K&I^O&I,tt=U&P^U&D^P&D,Y=(K>>>28|U<<4)^(K<<30|U>>>2)^(K<<25|U>>>7),G=(U>>>28|K<<4)^(U<<30|K>>>2)^(U<<25|K>>>7),X=o[L],et=X.high,rt=X.low,X=V+((J>>>14|j<<18)^(J>>>18|j<<14)^(J<<23|j>>>9)),Q=M+((j>>>14|J<<18)^(j>>>18|J<<14)^(j<<23|J>>>9))+(V>>>0>X>>>0?1:0),X=X+Z,Q=Q+$+(Z>>>0>X>>>0?1:0),X=X+rt,Q=Q+et+(rt>>>0>X>>>0?1:0),X=X+W,Q=Q+z+(W>>>0>X>>>0?1:0),W=G+tt,q=Y+q+(G>>>0>W>>>0?1:0),M=k,V=N,k=H,N=B,H=j,B=J,J=T+X|0,j=C+Q+(T>>>0>J>>>0?1:0)|0,C=I,T=D,I=O,D=P,O=K,P=U,U=X+W|0,K=Q+q+(X>>>0>U>>>0?1:0)|0}d=n.low=d+U,n.high=l+K+(U>>>0>d>>>0?1:0),g=i.low=g+P,i.high=p+O+(P>>>0>g>>>0?1:0),v=s.low=v+D,s.high=y+I+(D>>>0>v>>>0?1:0),S=u.low=S+T,u.high=m+C+(T>>>0>S>>>0?1:0),E=h.low=E+J,h.high=_+j+(J>>>0>E>>>0?1:0),w=c.low=w+B,c.high=b+H+(B>>>0>w>>>0?1:0),x=f.low=x+N,f.high=R+k+(N>>>0>x>>>0?1:0),F=r.low=F+V,r.high=A+M+(V>>>0>F>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[(n+128>>>10<<5)+30]=Math.floor(r/4294967296),e[(n+128>>>10<<5)+31]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32}),e.SHA512=r._createHelper(n),e.HmacSHA512=r._createHmacHelper(n)}(),function(){var t=sn,e=t.x64,r=e.Word,n=e.WordArray,e=t.algo,i=e.SHA512,e=e.SHA384=i.extend({_doReset:function(){this._hash=new n.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var t=i._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=i._createHelper(e),t.HmacSHA384=i._createHmacHelper(e)}(),function(){var t=sn,e=t.lib,r=e.WordArray,n=e.Hasher,e=t.algo,i=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),o=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),a=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=r.create([0,1518500249,1859775393,2400959708,2840853838]),h=r.create([1352829926,1548603684,1836072691,2053994217,0]),e=e.RIPEMD160=n.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;16>r;r++){var n=e+r,c=t[n];t[n]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}var f,l,d,p,g,y,v,m,S,_,n=this._hash.words,c=u.words,E=h.words,b=i.words,w=s.words,R=o.words,x=a.words;y=f=n[0],v=l=n[1],m=d=n[2],S=p=n[3],_=g=n[4];for(var A,r=0;80>r;r+=1)A=f+t[e+b[r]]|0,A=16>r?A+((l^d^p)+c[0]):32>r?A+((l&d|~l&p)+c[1]):48>r?A+(((l|~d)^p)+c[2]):64>r?A+((l&p|d&~p)+c[3]):A+((l^(d|~p))+c[4]),A|=0,A=A<>>32-R[r],A=A+g|0,f=g,g=p,p=d<<10|d>>>22,d=l,l=A,A=y+t[e+w[r]]|0,A=16>r?A+((v^(m|~S))+E[0]):32>r?A+((v&S|m&~S)+E[1]):48>r?A+(((v|~m)^S)+E[2]):64>r?A+((v&m|~v&S)+E[3]):A+((v^m^S)+E[4]),A|=0,A=A<>>32-x[r],A=A+_|0,y=_,_=S,S=m<<10|m>>>22,m=v,v=A;A=n[1]+d+S|0,n[1]=n[2]+p+_|0,n[2]=n[3]+g+y|0,n[3]=n[4]+f+v|0,n[4]=n[0]+l+m|0,n[0]=A},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;for(e[n>>>5]|=128<<24-n%32,e[(n+64>>>9<<4)+14]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process(),t=this._hash,e=t.words,r=0;5>r;r++)n=e[r],e[r]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8);return t},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});t.RIPEMD160=n._createHelper(e),t.HmacRIPEMD160=n._createHmacHelper(e)}(Math),function(){var t=sn,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(t,r){t=this._hasher=new t.init,"string"==typeof r&&(r=e.parse(r));var n=t.blockSize,i=4*n;r.sigBytes>i&&(r=t.finalize(r)),r.clamp();for(var s=this._oKey=r.clone(),o=this._iKey=r.clone(),a=s.words,u=o.words,h=0;n>h;h++)a[h]^=1549556828,u[h]^=909522486;s.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher;return t=e.finalize(t),e.reset(),e.finalize(this._oKey.clone().concat(t))}})}(),function(){var t=sn,e=t.lib,r=e.Base,n=e.WordArray,e=t.algo,i=e.HMAC,s=e.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:e.SHA1,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r=this.cfg,s=i.create(r.hasher,t),o=n.create(),a=n.create([1]),u=o.words,h=a.words,c=r.keySize,r=r.iterations;u.lengthg;g++){p=s.finalize(p),s.reset();for(var y=p.words,v=0;d>v;v++)l[v]^=y[v]}o.concat(f),h[0]++}return o.sigBytes=4*c,o}});t.PBKDF2=function(t,e,r){return s.create(r).compute(t,e)}}();var on,an="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",un="=",hn=0xdeadbeefcafe,cn=15715070==(16777215&hn);cn&&"Microsoft Internet Explorer"==en.appName?(o.prototype.am=h,on=30):cn&&"Netscape"!=en.appName?(o.prototype.am=u,on=26):(o.prototype.am=c,on=28),o.prototype.DB=on,o.prototype.DM=(1<=dn;++dn)gn[ln++]=dn;for(ln="a".charCodeAt(0),dn=10;36>dn;++dn)gn[ln++]=dn;for(ln="A".charCodeAt(0),dn=10;36>dn;++dn)gn[ln++]=dn;D.prototype.convert=C,D.prototype.revert=T,D.prototype.reduce=j,D.prototype.mulTo=J,D.prototype.sqrTo=H,k.prototype.convert=N,k.prototype.revert=M,k.prototype.reduce=V,k.prototype.mulTo=q,k.prototype.sqrTo=L,o.prototype.copyTo=d,o.prototype.fromInt=p,o.prototype.fromString=y,o.prototype.clamp=v,o.prototype.dlShiftTo=R,o.prototype.drShiftTo=x,o.prototype.lShiftTo=A,o.prototype.rShiftTo=F,o.prototype.subTo=K,o.prototype.multiplyTo=U,o.prototype.squareTo=O,o.prototype.divRemTo=P,o.prototype.invDigit=B,o.prototype.isEven=z,o.prototype.exp=W,o.prototype.toString=m,o.prototype.negate=S,o.prototype.abs=_,o.prototype.compareTo=E,o.prototype.bitLength=w,o.prototype.mod=I,o.prototype.modPowInt=Y,o.ZERO=g(0),o.ONE=g(1),Bt.prototype.convert=kt,Bt.prototype.revert=kt,Bt.prototype.mulTo=Nt,Bt.prototype.sqrTo=Mt,zt.prototype.convert=Wt,zt.prototype.revert=Yt,zt.prototype.reduce=Gt,zt.prototype.mulTo=$t,zt.prototype.sqrTo=Xt;var yn=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],vn=(1<<26)/yn[yn.length-1];o.prototype.chunkSize=Q,o.prototype.toRadix=et,o.prototype.fromRadix=rt,o.prototype.fromNumber=nt,o.prototype.bitwiseTo=ut,o.prototype.changeBit=xt,o.prototype.addTo=Ut,o.prototype.dMultiply=Jt,o.prototype.dAddOffset=Ht,o.prototype.multiplyLowerTo=Lt,o.prototype.multiplyUpperTo=qt,o.prototype.modInt=te,o.prototype.millerRabin=ne,o.prototype.clone=G,o.prototype.intValue=X,o.prototype.byteValue=$,o.prototype.shortValue=Z,o.prototype.signum=tt,o.prototype.toByteArray=it,o.prototype.equals=st,o.prototype.min=ot,o.prototype.max=at,o.prototype.and=ct,o.prototype.or=lt,o.prototype.xor=pt,o.prototype.andNot=yt,o.prototype.not=vt,o.prototype.shiftLeft=mt,o.prototype.shiftRight=St,o.prototype.getLowestSetBit=Et,o.prototype.bitCount=wt,o.prototype.testBit=Rt,o.prototype.setBit=At,o.prototype.clearBit=Ft,o.prototype.flipBit=Kt,o.prototype.add=Ot,o.prototype.subtract=Pt,o.prototype.multiply=It,o.prototype.divide=Ct,o.prototype.remainder=Tt,o.prototype.divideAndRemainder=jt,o.prototype.modPow=Zt,o.prototype.modInverse=ee,o.prototype.pow=Vt,o.prototype.gcd=Qt,o.prototype.isProbablePrime=re,o.prototype.square=Dt,ie.prototype.init=se,ie.prototype.next=oe;var mn,Sn,_n,En=256;if(null==Sn){Sn=new Array,_n=0;var bn;if(rn.crypto&&rn.crypto.getRandomValues){var wn=new Uint8Array(32);for(rn.crypto.getRandomValues(wn),bn=0;32>bn;++bn)Sn[_n++]=wn[bn]}if("Netscape"==en.appName&&en.appVersion<"5"&&rn.crypto){var Rn=rn.crypto.random(32);for(bn=0;bn_n;)bn=Math.floor(65536*Math.random()),Sn[_n++]=bn>>>8,Sn[_n++]=255&bn;_n=0,he()}le.prototype.nextBytes=fe;var xn=20;ve.prototype.doPublic=Se,ve.prototype.setPublic=me,ve.prototype.encrypt=_e,ve.prototype.encryptOAEP=Ee,ve.prototype.type="RSA";var xn=20;ve.prototype.doPrivate=Ke,ve.prototype.setPrivate=xe,ve.prototype.setPrivateEx=Ae,ve.prototype.generate=Fe,ve.prototype.decrypt=Ue,ve.prototype.decryptOAEP=Oe,Pe.prototype.equals=Ie,Pe.prototype.toBigInteger=De,Pe.prototype.negate=Ce,Pe.prototype.add=Te,Pe.prototype.subtract=je,Pe.prototype.multiply=Je,Pe.prototype.square=He,Pe.prototype.divide=Be,ke.prototype.getX=Ne,ke.prototype.getY=Me,ke.prototype.equals=Ve,ke.prototype.isInfinity=Le,ke.prototype.negate=qe,ke.prototype.add=ze,ke.prototype.twice=We,ke.prototype.multiply=Ye,ke.prototype.multiplyTwo=Ge,Xe.prototype.getQ=$e,Xe.prototype.getA=Ze,Xe.prototype.getB=Qe,Xe.prototype.equals=tr,Xe.prototype.getInfinity=er,Xe.prototype.fromBigInteger=rr,Xe.prototype.decodePointHex=nr,Pe.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ke.prototype.getEncoded=function(t){var e=function(t,e){var r=t.toByteArrayUnsigned();if(er.length;)r.unshift(0);return r},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i},ke.decodeFrom=function(t,e){var r=(e[0],e.length-1),n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var s=new o(n),a=new o(i);return new ke(t,t.fromBigInteger(s),t.fromBigInteger(a))},ke.decodeFromHex=function(t,e){var r=(e.substr(0,2),e.length-2),n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),s=new o(n,16),a=new o(i,16);return new ke(t,t.fromBigInteger(s),t.fromBigInteger(a))},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),n=r.divide(e),i=n.square().subtract(this.x).subtract(t.x),s=n.multiply(this.x.subtract(i)).subtract(this.y);return new ke(this.curve,i,s)},ke.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(o.valueOf(2)),e=this.curve.fromBigInteger(o.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 o("3")),i=this.negate(),s=this;for(e=n.bitLength()-2;e>0;--e){s=s.twice();var a=n.testBit(e),u=r.testBit(e);a!=u&&(s=s.add2D(a?this:i))}return s},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(),s=e.multiply(e).mod(i),o=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i); -return s.equals(o)},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(o.ONE)<0||e.compareTo(t.subtract(o.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(o.ONE)<0||r.compareTo(t.subtract(o.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};var An=function(){function t(t,e,r){return e?o[e]:String.fromCharCode(parseInt(r,16))}var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",r='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))',n='(?:"'+r+'*")',i=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+n+")","g"),s=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),o={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},a=new String(""),u="\\",h=({"{":Object,"[":Array},Object.hasOwnProperty);return function(e,r){var n,o=e.match(i),c=o[0],f=!1;"{"===c?n={}:"["===c?n=[]:(n=[],f=!0);for(var l,d=[n],p=1-f,g=o.length;g>p;++p){c=o[p];var y;switch(c.charCodeAt(0)){default:y=d[0],y[l||y.length]=+c,l=void 0;break;case 34:if(c=c.substring(1,c.length-1),-1!==c.indexOf(u)&&(c=c.replace(s,t)),y=d[0],!l){if(!(y instanceof Array)){l=c||a;break}l=y.length}y[l]=c,l=void 0;break;case 91:y=d[0],d.unshift(y[l||y.length]=[]),l=void 0;break;case 93:d.shift();break;case 102:y=d[0],y[l||y.length]=!1,l=void 0;break;case 110:y=d[0],y[l||y.length]=null,l=void 0;break;case 116:y=d[0],y[l||y.length]=!0,l=void 0;break;case 123:y=d[0],d.unshift(y[l||y.length]={}),l=void 0;break;case 125:d.shift()}}if(f){if(1!==d.length)throw new Error;n=n[0]}else if(d.length)throw new Error;if(r){var v=function(t,e){var n=t[e];if(n&&"object"==typeof n){var i=null;for(var s in n)if(h.call(n,s)&&n!==t){var o=v(n,s);void 0!==o?n[s]=o:(i||(i=[]),i.push(s))}if(i)for(var a=i.length;--a>=0;)delete n[i[a]]}return r.call(t,e,n)};n=v({"":n},"")}return n}}();"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.asn1&&KJUR.asn1||(KJUR.asn1={}),KJUR.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),n=r.length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var i="",s=0;n>s;s++)i+="f";var a=new o(i,16),u=a.xor(t).add(o.ONE);e=u.toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){var r=(KJUR.asn1,sn.enc.Hex.parse(t)),n=sn.enc.Base64.stringify(r),i=n.replace(/(.{64})/g,"$1\r\n");return i=i.replace(/\r\n$/,""),"-----BEGIN "+e+"-----\r\n"+i+"\r\n-----END "+e+"-----\r\n"},this.newObject=function(t){var e=KJUR.asn1,r=Object.keys(t);if(1!=r.length)throw"key of param shall be only one.";var n=r[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+n+":"))throw"undefined key: "+n;if("bool"==n)return new e.DERBoolean(t[n]);if("int"==n)return new e.DERInteger(t[n]);if("bitstr"==n)return new e.DERBitString(t[n]);if("octstr"==n)return new e.DEROctetString(t[n]);if("null"==n)return new e.DERNull(t[n]);if("oid"==n)return new e.DERObjectIdentifier(t[n]);if("enum"==n)return new e.DEREnumerated(t[n]);if("utf8str"==n)return new e.DERUTF8String(t[n]);if("numstr"==n)return new e.DERNumericString(t[n]);if("prnstr"==n)return new e.DERPrintableString(t[n]);if("telstr"==n)return new e.DERTeletexString(t[n]);if("ia5str"==n)return new e.DERIA5String(t[n]);if("utctime"==n)return new e.DERUTCTime(t[n]);if("gentime"==n)return new e.DERGeneralizedTime(t[n]);if("seq"==n){for(var i=t[n],s=[],o=0;ou;u++)a+="0";i=a+i;for(var u=0;ue)return r;var n=r.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);var i=128+n;return i.toString(16)+r},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""}},KJUR.asn1.DERAbstractString=function(t){KJUR.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=ar(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("string"==typeof t?this.setString(t):"undefined"!=typeof t.str?this.setString(t.str):"undefined"!=typeof t.hex&&this.setStringHex(t.hex))},nn.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractTime=function(t){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){utc=t.getTime()+6e4*t.getTimezoneOffset();var e=new Date(utc);return e},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),s=String(i.getFullYear());"utc"==e&&(s=s.substr(2,2));var o=n(String(i.getMonth()+1),2),a=n(String(i.getDate()),2),u=n(String(i.getHours()),2),h=n(String(i.getMinutes()),2),c=n(String(i.getSeconds()),2),f=s+o+a+u+h+c;if(r===!0){var l=i.getMilliseconds();if(0!=l){var d=n(String(l),3);d=d.replace(/[0]+$/,""),f=f+"."+d}}return f+"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=ar(t)},this.setByDateValue=function(t,e,r,n,i,s){var o=new Date(Date.UTC(t,e-1,r,n,i,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},nn.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractStructured=function(t){KJUR.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,"undefined"!=typeof t&&"undefined"!=typeof t.array&&(this.asn1Array=t.array)},nn.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object),KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},nn.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object),KJUR.asn1.DERInteger=function(t){KJUR.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new o(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.bigint?this.setByBigInteger(t.bigint):"undefined"!=typeof t["int"]?this.setByInteger(t["int"]):"number"==typeof t?this.setByInteger(t):"undefined"!=typeof t.hex&&this.setValueHex(t.hex))},nn.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object),KJUR.asn1.DERBitString=function(t){KJUR.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(0>t||t>7)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){t=t.replace(/0+$/,"");var e=8-t.length%8;8==e&&(e=0);for(var r=0;e>=r;r++)t+="0";for(var n="",r=0;rr;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):"undefined"!=typeof t.hex?this.setHexValueIncludingUnusedBits(t.hex):"undefined"!=typeof t.bin?this.setByBinaryString(t.bin):"undefined"!=typeof t.array&&this.setByBooleanArray(t.array))},nn.lang.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object),KJUR.asn1.DEROctetString=function(t){KJUR.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},nn.lang.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},nn.lang.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object),KJUR.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new o(t,10),i=n.toString(2),s=7-i.length%7;7==s&&(s=0);for(var a="",u=0;s>u;u++)a+="0";i=a+i;for(var u=0;u0&&10>r?r+1:-2},this.getHexOfL_AtObj=function(t,e){var r=this.getByteLengthOfL_AtObj(t,e);return 1>r?"":t.substring(e+2,e+2+2*r)},this.getIntOfL_AtObj=function(t,e){var r=this.getHexOfL_AtObj(t,e);if(""==r)return-1;var n;return n=parseInt(r.substring(0,1))<8?new o(r,16):new o(r.substring(2),16),n.intValue()},this.getStartPosOfV_AtObj=function(t,e){var r=this.getByteLengthOfL_AtObj(t,e);return 0>r?r:e+2*(r+1)},this.getHexOfV_AtObj=function(t,e){var r=this.getStartPosOfV_AtObj(t,e),n=this.getIntOfL_AtObj(t,e);return t.substring(r,r+2*n)},this.getHexOfTLV_AtObj=function(t,e){var r=t.substr(e,2),n=this.getHexOfL_AtObj(t,e),i=this.getHexOfV_AtObj(t,e);return r+n+i},this.getPosOfNextSibling_AtObj=function(t,e){var r=this.getStartPosOfV_AtObj(t,e),n=this.getIntOfL_AtObj(t,e);return r+2*n},this.getPosArrayOfChildren_AtObj=function(t,e){var r=new Array,n=this.getStartPosOfV_AtObj(t,e);r.push(n);for(var i=this.getIntOfL_AtObj(t,e),s=n,o=0;;){var a=this.getPosOfNextSibling_AtObj(t,s);if(null==a||a-n>=2*i)break;if(o>=200)break;r.push(a),s=a,o++}return r},this.getNthChildIndex_AtObj=function(t,e,r){var n=this.getPosArrayOfChildren_AtObj(t,e);return n[r]},this.getDecendantIndexByNthList=function(t,e,r){if(0==r.length)return e;var n=r.shift(),i=this.getPosArrayOfChildren_AtObj(t,e);return this.getDecendantIndexByNthList(t,i[n],r)},this.getDecendantHexTLVByNthList=function(t,e,r){var n=this.getDecendantIndexByNthList(t,e,r);return this.getHexOfTLV_AtObj(t,n)},this.getDecendantHexVByNthList=function(t,e,r){var n=this.getDecendantIndexByNthList(t,e,r);return this.getHexOfV_AtObj(t,n)}};Fn.getVbyList=function(t,e,r,n){var i=this.getDecendantIndexByNthList(t,e,r);if(void 0===i)throw"can't find nthList object";if(void 0!==n&&t.substr(i,2)!=n)throw"checking tag doesn't match: "+t.substr(i,2)+"!="+n;return this.getHexOfV_AtObj(t,i)},Fn.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var s=t.substr(2),o=[],a=0;a0&&(c=c+"."+u.join(".")),c},Fn.dump=function(t,e,r,n){var i=function(t,e){if(t.length<=2*e)return t;var r=t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e);return r};void 0===e&&(e={ommit_long_octet:32}),void 0===r&&(r=0),void 0===n&&(n="");var s=e.ommit_long_octet;if("01"==t.substr(r,2)){var o=Fn.getHexOfV_AtObj(t,r);return"00"==o?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n"}if("02"==t.substr(r,2)){var o=Fn.getHexOfV_AtObj(t,r);return n+"INTEGER "+i(o,s)+"\n"}if("03"==t.substr(r,2)){var o=Fn.getHexOfV_AtObj(t,r);return n+"BITSTRING "+i(o,s)+"\n"}if("04"==t.substr(r,2)){var o=Fn.getHexOfV_AtObj(t,r);if(Fn.isASN1HEX(o)){var a=n+"OCTETSTRING, encapsulates\n";return a+=Fn.dump(o,e,0,n+" ")}return n+"OCTETSTRING "+i(o,s)+"\n"}if("05"==t.substr(r,2))return n+"NULL\n";if("06"==t.substr(r,2)){var u=Fn.getHexOfV_AtObj(t,r),h=KJUR.asn1.ASN1Util.oidHexToInt(u),c=KJUR.asn1.x509.OID.oid2name(h),f=h.replace(/\./g," ");return""!=c?n+"ObjectIdentifier "+c+" ("+f+")\n":n+"ObjectIdentifier ("+f+")\n"}if("0c"==t.substr(r,2))return n+"UTF8String '"+mr(Fn.getHexOfV_AtObj(t,r))+"'\n";if("13"==t.substr(r,2))return n+"PrintableString '"+mr(Fn.getHexOfV_AtObj(t,r))+"'\n";if("14"==t.substr(r,2))return n+"TeletexString '"+mr(Fn.getHexOfV_AtObj(t,r))+"'\n";if("16"==t.substr(r,2))return n+"IA5String '"+mr(Fn.getHexOfV_AtObj(t,r))+"'\n";if("17"==t.substr(r,2))return n+"UTCTime "+mr(Fn.getHexOfV_AtObj(t,r))+"\n";if("18"==t.substr(r,2))return n+"GeneralizedTime "+mr(Fn.getHexOfV_AtObj(t,r))+"\n";if("30"==t.substr(r,2)){if("3000"==t.substr(r,4))return n+"SEQUENCE {}\n";var a=n+"SEQUENCE\n",l=Fn.getPosArrayOfChildren_AtObj(t,r),d=e;if((2==l.length||3==l.length)&&"06"==t.substr(l[0],2)&&"04"==t.substr(l[l.length-1],2)){var p=Fn.getHexOfV_AtObj(t,l[0]),h=KJUR.asn1.ASN1Util.oidHexToInt(p),c=KJUR.asn1.x509.OID.oid2name(h),g=JSON.parse(JSON.stringify(e));g.x509ExtName=c,d=g}for(var y=0;y0){var e=new KJUR.asn1.DERSequence({array:this.extensionsArray}),r=new KJUR.asn1.DERTaggedObject({explicit:!0,tag:"a3",obj:e});this.asn1Array.push(r)}var n=new KJUR.asn1.DERSequence({array:this.asn1Array});return this.hTLV=n.getEncodedHex(),this.isModified=!1,this.hTLV},this._initialize()},nn.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object),KJUR.asn1.x509.Extension=function(t){KJUR.asn1.x509.Extension.superclass.constructor.call(this),this.getEncodedHex=function(){var t=new KJUR.asn1.DERObjectIdentifier({oid:this.oid}),e=new KJUR.asn1.DEROctetString({hex:this.getExtnValueHex()}),r=new Array;r.push(t),this.critical&&r.push(new KJUR.asn1.DERBoolean),r.push(e);var n=new KJUR.asn1.DERSequence({array:r});return n.getEncodedHex()},this.critical=!1,"undefined"!=typeof t&&"undefined"!=typeof t.critical&&(this.critical=t.critical)},nn.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object),KJUR.asn1.x509.KeyUsage=function(t){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,t),this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15","undefined"!=typeof t&&"undefined"!=typeof t.bin&&(this.asn1ExtnValue=new KJUR.asn1.DERBitString(t))},nn.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension),KJUR.asn1.x509.BasicConstraints=function(t){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,t),this.getExtnValueHex=function(){var t=new Array;this.cA&&t.push(new KJUR.asn1.DERBoolean),this.pathLen>-1&&t.push(new KJUR.asn1.DERInteger({"int":this.pathLen}));var e=new KJUR.asn1.DERSequence({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,"undefined"!=typeof t&&("undefined"!=typeof t.cA&&(this.cA=t.cA),"undefined"!=typeof t.pathLen&&(this.pathLen=t.pathLen))},nn.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension),KJUR.asn1.x509.CRLDistributionPoints=function(t){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t),this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(t){this.asn1ExtnValue=new KJUR.asn1.DERSequence({array:t})},this.setByOneURI=function(t){var e=new KJUR.asn1.x509.GeneralNames([{uri:t}]),r=new KJUR.asn1.x509.DistributionPointName(e),n=new KJUR.asn1.x509.DistributionPoint({dpobj:r});this.setByDPArray([n])},this.oid="2.5.29.31","undefined"!=typeof t&&("undefined"!=typeof t.array?this.setByDPArray(t.array):"undefined"!=typeof t.uri&&this.setByOneURI(t.uri))},nn.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension),KJUR.asn1.x509.ExtKeyUsage=function(t){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,t),this.setPurposeArray=function(t){this.asn1ExtnValue=new KJUR.asn1.DERSequence;for(var e=0;e0){var t=new KJUR.asn1.DERSequence({array:this.aRevokedCert});this.asn1Array.push(t)}var e=new KJUR.asn1.DERSequence({array:this.asn1Array});return this.hTLV=e.getEncodedHex(),this.isModified=!1,this.hTLV},this._initialize=function(){this.asn1Version=null,this.asn1SignatureAlg=null,this.asn1Issuer=null,this.asn1ThisUpdate=null,this.asn1NextUpdate=null,this.aRevokedCert=new Array},this._initialize()},nn.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object),KJUR.asn1.x509.CRLEntry=function(t){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this),this.setCertSerial=function(t){this.sn=new KJUR.asn1.DERInteger(t)},this.setRevocationDate=function(t){this.time=new KJUR.asn1.x509.Time(t)},this.getEncodedHex=function(){var t=new KJUR.asn1.DERSequence({array:[this.sn,this.time]});return this.TLV=t.getEncodedHex(),this.TLV},"undefined"!=typeof t&&("undefined"!=typeof t.time&&this.setRevocationDate(t.time),"undefined"!=typeof t.sn&&this.setCertSerial(t.sn))},nn.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object),KJUR.asn1.x509.X500Name=function(t){if(KJUR.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=new Array,this.setByString=function(t){var e=t.split("/");e.shift();for(var r=0;r0&&(r=new e.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:!1}));var n=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,t,this.dSigAlg,this.dSig];null!=r&&n.push(r);var i=new e.DERSequence({array:n});return this.hTLV=i.getEncodedHex(),this.hTLV}},nn.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object),KJUR.asn1.cms.EncapsulatedContentInfo=function(t){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var e=KJUR.asn1;KJUR.asn1.cms,KJUR.asn1.x509,this.dEContentType=new e.DERObjectIdentifier({name:"data"}),this.dEContent=null,this.isDetached=!1,this.eContentValueHex=null,this.setContentType=function(t){t.match(/^[0-2][.][0-9.]+$/)?this.dEContentType=new e.DERObjectIdentifier({oid:t}):this.dEContentType=new e.DERObjectIdentifier({name:t})},this.setContentValue=function(t){"undefined"!=typeof t&&("string"==typeof t.hex?this.eContentValueHex=t.hex:"string"==typeof t.str&&(this.eContentValueHex=vr(t.str)))},this.setContentValueHex=function(t){this.eContentValueHex=t},this.setContentValueStr=function(t){this.eContentValueHex=vr(t)},this.getEncodedHex=function(){if("string"!=typeof this.eContentValueHex)throw"eContentValue not yet set";var t=new e.DEROctetString({hex:this.eContentValueHex});this.dEContent=new e.DERTaggedObject({obj:t,tag:"a0",explicit:!0});var r=[this.dEContentType];this.isDetached||r.push(this.dEContent);var n=new e.DERSequence({array:r});return this.hTLV=n.getEncodedHex(),this.hTLV}},nn.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object),KJUR.asn1.cms.ContentInfo=function(t){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var e=KJUR.asn1,r=(KJUR.asn1.cms,KJUR.asn1.x509);this.dContentType=null,this.dContent=null,this.setContentType=function(t){"string"==typeof t&&(this.dContentType=r.OID.name2obj(t))},this.getEncodedHex=function(){var t=new e.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:!0}),r=new e.DERSequence({array:[this.dContentType,t]});return this.hTLV=r.getEncodedHex(),this.hTLV},"undefined"!=typeof t&&(t.type&&this.setContentType(t.type),t.obj&&t.obj instanceof e.ASN1Object&&(this.dContent=t.obj))},nn.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object),KJUR.asn1.cms.SignedData=function(t){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var e=KJUR.asn1,r=KJUR.asn1.cms,n=KJUR.asn1.x509;this.dCMSVersion=new e.DERInteger({"int":1}),this.dDigestAlgs=null,this.digestAlgNameList=[],this.dEncapContentInfo=new r.EncapsulatedContentInfo,this.dCerts=null,this.certificateList=[],this.crlList=[],this.signerInfoList=[new r.SignerInfo],this.addCertificatesByPEM=function(t){var r=In.getHexFromPEM(t),n=new e.ASN1Object;n.hTLV=r,this.certificateList.push(n)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(null==this.dDigestAlgs){for(var t=[],r=0;r0){var a=new e.DERSet({array:this.certificateList});this.dCerts=new e.DERTaggedObject({obj:a,tag:"a0",explicit:!1})}null!=this.dCerts&&o.push(this.dCerts);var u=new e.DERSet({array:this.signerInfoList});o.push(u);var h=new e.DERSequence({array:o});return this.hTLV=h.getEncodedHex(),this.hTLV},this.getContentInfo=function(){this.getEncodedHex();var t=new r.ContentInfo({type:"signed-data",obj:this});return t},this.getContentInfoEncodedHex=function(){var t=this.getContentInfo(),e=t.getEncodedHex();return e},this.getPEM=function(){var t=this.getContentInfoEncodedHex(),r=e.ASN1Util.getPEMStringFromHex(t,"CMS");return r}},nn.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object),KJUR.asn1.cms.CMSUtil=new function(){},KJUR.asn1.cms.CMSUtil.newSignedData=function(t){var e=KJUR.asn1.cms,r=KJUR.asn1.cades,n=new e.SignedData;if(n.dEncapContentInfo.setContentValue(t.content),"object"==typeof t.certs)for(var i=0;ie.length&&(r=e.length);for(var n=0;r>n;n++)if(t.charCodeAt(n)!=e.charCodeAt(n))return n;return t.length!=e.length?r:-1};"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.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",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:sn.algo.MD5,sha1:sn.algo.SHA1,sha224:sn.algo.SHA224,sha256:sn.algo.SHA256,sha384:sn.algo.SHA384,sha512:sn.algo.SHA512,ripemd160:sn.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if("undefined"==typeof this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="0001",o="00"+n,a="",u=i-s.length-o.length,h=0;u>h;h+=2)a+="ff";var c=s+a+o;return c},this.hashString=function(t,e){var r=new KJUR.crypto.MessageDigest({alg:e});return r.digestString(t)},this.hashHex=function(t,e){var r=new KJUR.crypto.MessageDigest({alg:e});return r.digestHex(t)},this.sha1=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha1",prov:"cryptojs"});return e.digestString(t)},this.sha256=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return e.digestString(t)},this.sha256Hex=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return e.digestHex(t)},this.sha512=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return e.digestString(t)},this.sha512Hex=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return e.digestHex(t)},this.md5=function(t){var e=new KJUR.crypto.MessageDigest({alg:"md5",prov:"cryptojs"});return e.digestString(t)},this.ripemd160=function(t){var e=new KJUR.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"});return e.digestString(t)},this.getCryptoJSMDByName=function(t){}},KJUR.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!=t&&void 0===e&&(e=KJUR.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(r){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+r}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sn.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return t.toString(sn.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(r){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+r}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},KJUR.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(t=t.toLowerCase(),null==t&&(t="hmacsha1"),t=t.toLowerCase(),"hmac"!=t.substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=KJUR.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var r=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(r)&&"cryptojs"==e){try{var n=KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[r];this.mac=sn.algo.HMAC.create(n,this.pass)}catch(i){throw"setAlgAndProvider hash alg set fail hashAlg="+r+"/"+i}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=sn.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){var t=this.mac.finalize();return t.toString(sn.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=_r(t)),void(this.pass=sn.enc.Hex.parse(e))}if("object"!=typeof t)throw"KJUR.crypto.Mac unsupported password type: "+t;var e=null;if(void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=vr(t.utf8)),void 0!==t.rstr&&(e=_r(t.rstr)),void 0!==t.b64&&(e=i(t.b64)),void 0!==t.b64u&&(e=pr(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=sn.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},KJUR.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){this.algName.match(/^(.+)with(.+)$/)&&(this.mdAlgName=RegExp.$1.toLowerCase(),this.pubkeyAlgName=RegExp.$2.toLowerCase())},this._zeroPaddingOfSignature=function(t,e){for(var r="",n=e/4-t.length,i=0;n>i;i++)r+="0";return r+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw"provider not supported: "+e;if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new KJUR.crypto.MessageDigest({alg:this.mdAlgName})}catch(r){throw"setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+r}this.init=function(t,e){var r=null;try{r=void 0===e?In.getKey(t):In.getKey(t,e)}catch(n){throw"init failed:"+n}if(r.isPrivate===!0)this.prvKey=r,this.state="SIGN";else{if(r.isPublic!==!0)throw"init failed.:"+r;this.pubKey=r,this.state="VERIFY"}},this.initSign=function(t){"string"==typeof t.ecprvhex&&"string"==typeof t.eccurvename?(this.ecprvhex=t.ecprvhex,this.eccurvename=t.eccurvename):this.prvKey=t,this.state="SIGN"},this.initVerifyByPublicKey=function(t){"string"==typeof t.ecpubhex&&"string"==typeof t.eccurvename?(this.ecpubhex=t.ecpubhex,this.eccurvename=t.eccurvename):t instanceof KJUR.crypto.ECDSA?this.pubKey=t:t instanceof ve&&(this.pubKey=t),this.state="VERIFY"},this.initVerifyByCertificatePEM=function(t){var e=new Gr;e.readCertPEM(t),this.pubKey=e.subjectPublicKeyRSA,this.state="VERIFY"},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),"undefined"!=typeof this.ecprvhex&&"undefined"!=typeof this.eccurvename){var t=new KJUR.crypto.ECDSA({curve:this.eccurvename});this.hSign=t.signHex(this.sHashHex,this.ecprvhex)}else if(this.prvKey instanceof ve&&"rsaandmgf1"==this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ve&&"rsa"==this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof KJUR.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof KJUR.crypto.DSA))throw"Signature: unsupported public key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),"undefined"!=typeof this.ecpubhex&&"undefined"!=typeof this.eccurvename){var e=new KJUR.crypto.ECDSA({curve:this.eccurvename});return e.verifyHex(this.sHashHex,t,this.ecpubhex)}if(this.pubKey instanceof ve&&"rsaandmgf1"==this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ve&&"rsa"==this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(this.pubKey instanceof KJUR.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(this.pubKey instanceof KJUR.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.initVerifyByPublicKey=function(t){throw"initVerifyByPublicKey(rsaPubKeyy) not supported for this alg:prov="+this.algProvName},this.initVerifyByCertificatePEM=function(t){throw"initVerifyByCertificatePEM(certPEM) not supported for this alg:prov="+this.algProvName},this.initSign=function(t){throw"initSign(prvKey) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(t){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(t){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{var e=new ve;e.readPrivateKeyFromPEMString(t.prvkeypem),this.initSign(e)}catch(r){throw"fatal error to load pem private key: "+r}}},KJUR.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.crypto.ECDSA=function(t){var e="secp256r1",r=new le;this.type="EC",this.getBigRandom=function(t){return new o(t.bitLength(),r).mod(t.subtract(o.ONE)).add(o.ONE)},this.setNamedCurve=function(t){this.ecparams=KJUR.crypto.ECParameterDB.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),r=this.ecparams.G.multiply(e),n=r.getX().toBigInteger(),i=r.getY().toBigInteger(),s=this.ecparams.keylen/4,o=("0000000000"+e.toString(16)).slice(-s),a=("0000000000"+n.toString(16)).slice(-s),u=("0000000000"+i.toString(16)).slice(-s),h="04"+a+u;return this.setPrivateKeyHex(o),this.setPublicKeyHex(h),{ecprvhex:o,ecpubhex:h}},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var r=new o(e,16),n=this.ecparams.n,i=new o(t,16);do var s=this.getBigRandom(n),a=this.ecparams.G,u=a.multiply(s),h=u.getX().toBigInteger().mod(n);while(h.compareTo(o.ZERO)<=0);var c=s.modInverse(n).multiply(i.add(r.multiply(h))).mod(n);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(h,c)},this.sign=function(t,e){var r=e,n=this.ecparams.n,i=o.fromByteArrayUnsigned(t);do var s=this.getBigRandom(n),a=this.ecparams.G,u=a.multiply(s),h=u.getX().toBigInteger().mod(n);while(h.compareTo(o.ZERO)<=0);var c=s.modInverse(n).multiply(i.add(r.multiply(h))).mod(n);return this.serializeSig(h,c)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,r){var n,i,s=KJUR.crypto.ECDSA.parseSigHex(e);n=s.r,i=s.s;var a;a=ke.decodeFromHex(this.ecparams.curve,r);var u=new o(t,16);return this.verifyRaw(u,n,i,a)},this.verify=function(t,e,r){var n,i;if(Bitcoin.Util.isArray(e)){var s=this.parseSig(e);n=s.r,i=s.s}else{if("object"!=typeof e||!e.r||!e.s)throw"Invalid value for signature";n=e.r,i=e.s}var a;if(r instanceof ke)a=r;else{if(!Bitcoin.Util.isArray(r))throw"Invalid format for pubkey value, must be byte array or ECPointFp";a=ke.decodeFrom(this.ecparams.curve,r)}var u=o.fromByteArrayUnsigned(t);return this.verifyRaw(u,n,i,a)},this.verifyRaw=function(t,e,r,n){var i=this.ecparams.n,s=this.ecparams.G;if(e.compareTo(o.ONE)<0||e.compareTo(i)>=0)return!1;if(r.compareTo(o.ONE)<0||r.compareTo(i)>=0)return!1;var a=r.modInverse(i),u=t.multiply(a).mod(i),h=e.multiply(a).mod(i),c=s.multiply(u).add(n.multiply(h)),f=c.getX().toBigInteger().mod(i);return f.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),i.push(2),i.push(n.length),i=i.concat(n),i.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(e=2,2!=t[e])throw new Error("First element in signature must be a DERInteger");var r=t.slice(e+2,e+2+t[e+1]);if(e+=2+t[e+1],2!=t[e])throw new Error("Second element in signature must be a DERInteger");var n=t.slice(e+2,e+2+t[e+1]);e+=2+t[e+1];var i=o.fromByteArrayUnsigned(r),s=o.fromByteArrayUnsigned(n);return{r:i,s:s}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(0>e||e>7)throw"Invalid signature type";var r=this.ecparams.n,n=o.fromByteArrayUnsigned(t.slice(1,33)).mod(r),i=o.fromByteArrayUnsigned(t.slice(33,65)).mod(r);return{r:n,s:i,i:e}},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName=e),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},KJUR.crypto.ECDSA.parseSigHex=function(t){var e=KJUR.crypto.ECDSA.parseSigHexInHexRS(t),r=new o(e.r,16),n=new o(e.s,16);return{r:r,s:n}},KJUR.crypto.ECDSA.parseSigHexInHexRS=function(t){if("30"!=t.substr(0,2))throw"signature is not a ASN.1 sequence";var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=e.length)throw"number of signature ASN.1 sequence elements seem wrong";var r=e[0],n=e[1];if("02"!=t.substr(r,2))throw"1st item of sequene of signature is not ASN.1 integer";if("02"!=t.substr(n,2))throw"2nd item of sequene of signature is not ASN.1 integer";var i=Fn.getHexOfV_AtObj(t,r),s=Fn.getHexOfV_AtObj(t,n);return{r:i,s:s}},KJUR.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=KJUR.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if("00"==r.substr(0,2)&&r.length/2*8%128==8&&(r=r.substr(2)),"00"==n.substr(0,2)&&n.length/2*8%128==8&&(n=n.substr(2)),r.length/2*8%128!=0)throw"unknown ECDSA sig r length error";if(n.length/2*8%128!=0)throw"unknown ECDSA sig s length error";return r+n},KJUR.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 KJUR.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new o(t,16),n=new o(e,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(r,n)},KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=new KJUR.asn1.DERInteger({bigint:t}),n=new KJUR.asn1.DERInteger({bigint:e}),i=new KJUR.asn1.DERSequence({array:[r,n]});return i.getEncodedHex()},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.crypto.ECParameterDB=new function(){function t(t){return new o(t,16)}var e={},r={};this.getByName=function(t){var n=t;if("undefined"!=typeof r[n]&&(n=r[t]),"undefined"!=typeof e[n])return e[n];throw"unregistered EC curve name: "+n},this.regist=function(n,i,s,o,a,u,h,c,f,l,d,p){e[n]={};var g=t(s),y=t(o),v=t(a),m=t(u),S=t(h),_=new Xe(g,y,v),E=_.decodePointHex("04"+c+f);e[n].name=n,e[n].keylen=i,e[n].curve=_,e[n].G=E,e[n].n=m,e[n].h=S,e[n].oid=d,e[n].info=p;for(var b=0;b11&&10!=e&&8>e?2:e;case 28:return e>11&&8>e?11:e;case 32:return e>10&&8>e?8:e;default:return util.print_debug("DSA select hash algorithm: returning null for an unknown length of q"),null}}function r(t,e,r,n,i,s,a,u){var h=KJUR.crypto.Util.hashString(n,t.toLowerCase()),h=h.substr(0,s.bitLength()/4),c=new o(h,16);if(o.ZERO.compareTo(e)>0||e.compareTo(s)>0||o.ZERO.compareTo(r)>0||r.compareTo(s)>0)return util.print_error("invalid DSA Signature"),null;var f=r.modInverse(s),l=c.multiply(f).mod(s),d=e.multiply(f).mod(s),p=a.modPow(l,i).multiply(u.modPow(d,i)).mod(i).mod(s);return 0==p.compareTo(e)}function n(t,e){if(!(e.compareTo(t)<=0)){for(var r=e.subtract(t),n=i(r.bitLength());n>r;)n=i(r.bitLength());return t.add(n)}}function i(t){if(0>t)return null;var e=Math.floor((t+7)/8),r=s(e);return t%8>0&&(r=String.fromCharCode(Math.pow(2,t%8)-1&r.charCodeAt(0))+r.substring(1)),new o(u(r),16)}function s(t){for(var e="",r=0;t>r;r++)e+=String.fromCharCode(a());return e}function a(){var t=new Uint32Array(1);return rn.crypto.getRandomValues(t),255&t[0]}function u(t){if(null==t)return"";for(var e,r=[],n=t.length,i=0;n>i;){for(e=t[i++].charCodeAt().toString(16);e.length<2;)e="0"+e;r.push(""+e)}return r.join("")}this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.setPrivate=function(t,e,r,n,i){this.isPrivate=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=i},this.setPublic=function(t,e,r,n){this.isPublic=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=null},this.signWithMessageHash=function(t){var e=this.p,r=this.q,i=this.g,s=(this.y,this.x),a=(t.substr(0,r.bitLength()/4),new o(t,16)),u=n(o.ONE.add(o.ONE),r.subtract(o.ONE)),h=i.modPow(u,e).mod(r),c=u.modInverse(r).multiply(a.add(s.multiply(h))).mod(r),f=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:h}},{"int":{bigint:c}}]});return f},this.verifyWithMessageHash=function(t,e){var r=this.p,n=this.q,i=this.g,s=this.y,a=this.parseASN1Signature(e),u=a[0],h=a[1],t=t.substr(0,n.bitLength()/4),c=new o(t,16);if(o.ZERO.compareTo(u)>0||u.compareTo(n)>0||o.ZERO.compareTo(h)>0||h.compareTo(n)>0)throw"invalid DSA signature";var f=h.modInverse(n),l=c.multiply(f).mod(n),d=u.multiply(f).mod(n),p=i.modPow(l,r).multiply(s.modPow(d,r)).mod(r).mod(n);return 0==p.compareTo(u)},this.parseASN1Signature=function(t){try{var e=new o(Fn.getVbyList(t,0,[0],"02"),16),r=new o(Fn.getVbyList(t,0,[1],"02"),16);return[e,r]}catch(n){throw"malformed DSA signature"}},this.select_hash_algorithm=e,this.sign=t,this.verify=r,this.getRandomBigIntegerInRange=n,this.getRandomBigInteger=i,this.getRandomBytes=s};var Pn=function(){var t=function(t,e,n){return r(sn.AES,t,e,n)},e=function(t,e,n){return r(sn.TripleDES,t,e,n)},r=function(t,e,r,n){var i=sn.enc.Hex.parse(e),s=sn.enc.Hex.parse(r),o=sn.enc.Hex.parse(n),a={};a.key=s,a.iv=o,a.ciphertext=i;var u=t.decrypt(a,s,{iv:o});return sn.enc.Hex.stringify(u)},n=function(t,e,r){return o(sn.AES,t,e,r)},s=function(t,e,r){return o(sn.TripleDES,t,e,r)},o=function(t,e,r,n){var i=sn.enc.Hex.parse(e),s=sn.enc.Hex.parse(r),o=sn.enc.Hex.parse(n),a=t.encrypt(i,s,{iv:o}),u=sn.enc.Hex.parse(a.toString()),h=sn.enc.Base64.stringify(u);return h},a={"AES-256-CBC":{proc:t,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:s,keylen:24,ivlen:8}},u=function(t){return a[t].proc},h=function(t){var e=sn.lib.WordArray.random(t),r=sn.enc.Hex.stringify(e);return r},c=function(t){var e={};t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))&&(e.cipher=RegExp.$1,e.ivsalt=RegExp.$2),t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))&&(e.type=RegExp.$1);var r=-1,n=0;-1!=t.indexOf("\r\n\r\n")&&(r=t.indexOf("\r\n\r\n"),n=2),-1!=t.indexOf("\n\n")&&(r=t.indexOf("\n\n"),n=1);var i=t.indexOf("-----END");if(-1!=r&&-1!=i){var s=t.substring(r+2*n,i-n);s=s.replace(/\s+/g,""),e.data=s}return e},f=function(t,e,r){for(var n=r.substring(0,16),i=sn.enc.Hex.parse(n),s=sn.enc.Utf8.parse(e),o=a[t].keylen+a[t].ivlen,u="",h=null;;){var c=sn.algo.MD5.create();if(null!=h&&c.update(h),c.update(s),c.update(i),h=c.finalize(),u+=sn.enc.Hex.stringify(h),u.length>=2*o)break}var f={};return f.keyhex=u.substr(0,2*a[t].keylen),f.ivhex=u.substr(2*a[t].keylen,2*a[t].ivlen),f},l=function(t,e,r,n){var i=sn.enc.Base64.parse(t),s=sn.enc.Hex.stringify(i),o=a[e].proc,u=o(s,r,n);return u},d=function(t,e,r,n){var i=a[e].eproc,s=i(t,r,n);return s};return{version:"1.0.5",getHexFromPEM:function(t,e){var r=t;if(-1==r.indexOf("BEGIN "+e))throw"can't find PEM header: "+e;r=r.replace("-----BEGIN "+e+"-----",""),r=r.replace("-----END "+e+"-----","");var n=r.replace(/\s+/g,""),s=i(n);return s},getDecryptedKeyHexByKeyIV:function(t,e,r,n){var i=u(e);return i(t,r,n)},parsePKCS5PEM:function(t){return c(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return f(t,e,r)},decryptKeyB64:function(t,e,r,n){return l(t,e,r,n)},getDecryptedKeyHex:function(t,e){var r=c(t),n=(r.type,r.cipher),i=r.ivsalt,s=r.data,o=f(n,e,i),a=o.keyhex,u=l(s,n,a,i);return u},getRSAKeyFromEncryptedPKCS5PEM:function(t,e){var r=this.getDecryptedKeyHex(t,e),n=new ve;return n.readPrivateKeyFromASN1HexString(r),n},getEryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,n){var i="";if("undefined"!=typeof r&&null!=r||(r="AES-256-CBC"),"undefined"==typeof a[r])throw"PKCS5PKEY unsupported algorithm: "+r;if("undefined"==typeof n||null==n){var s=a[r].ivlen,o=h(s);n=o.toUpperCase()}var u=f(r,e,n),c=u.keyhex,l=d(t,r,c,n),p=l.replace(/(.{64})/g,"$1\r\n"),i="-----BEGIN RSA PRIVATE KEY-----\r\n";return i+="Proc-Type: 4,ENCRYPTED\r\n",i+="DEK-Info: "+r+","+n+"\r\n",i+="\r\n",i+=p,i+="\r\n-----END RSA PRIVATE KEY-----\r\n"},getEryptedPKCS5PEMFromRSAKey:function(t,e,r,n){var i=new KJUR.asn1.DERInteger({"int":0}),s=new KJUR.asn1.DERInteger({bigint:t.n}),o=new KJUR.asn1.DERInteger({"int":t.e}),a=new KJUR.asn1.DERInteger({bigint:t.d}),u=new KJUR.asn1.DERInteger({bigint:t.p}),h=new KJUR.asn1.DERInteger({bigint:t.q}),c=new KJUR.asn1.DERInteger({bigint:t.dmp1}),f=new KJUR.asn1.DERInteger({bigint:t.dmq1}),l=new KJUR.asn1.DERInteger({bigint:t.coeff}),d=new KJUR.asn1.DERSequence({array:[i,s,o,a,u,h,c,f,l]}),p=d.getEncodedHex();return this.getEryptedPKCS5PEMFromPrvKeyHex(p,e,r,n)},newEncryptedPKCS5PEM:function(t,e,r,n){"undefined"!=typeof e&&null!=e||(e=1024),"undefined"!=typeof r&&null!=r||(r="10001");var i=new ve;i.generate(e,r);var s=null;return s="undefined"==typeof n||null==n?this.getEncryptedPKCS5PEMFromRSAKey(pkey,t):this.getEncryptedPKCS5PEMFromRSAKey(pkey,t,n)},getRSAKeyFromPlainPKCS8PEM:function(t){if(t.match(/ENCRYPTED/))throw"pem shall be not ENCRYPTED";var e=this.getHexFromPEM(t,"PRIVATE KEY"),r=this.getRSAKeyFromPlainPKCS8Hex(e);return r},getRSAKeyFromPlainPKCS8Hex:function(t){var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(3!=e.length)throw"outer DERSequence shall have 3 elements: "+e.length;var r=Fn.getHexOfTLV_AtObj(t,e[1]);if("300d06092a864886f70d0101010500"!=r)throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+r;var r=Fn.getHexOfTLV_AtObj(t,e[1]),n=Fn.getHexOfTLV_AtObj(t,e[2]),i=Fn.getHexOfV_AtObj(n,0),s=new ve;return s.readPrivateKeyFromASN1HexString(i),s},parseHexOfEncryptedPKCS8:function(t){var e={},r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"malformed format: SEQUENCE(0).items != 2: "+r.length;e.ciphertext=Fn.getHexOfV_AtObj(t,r[1]);var n=Fn.getPosArrayOfChildren_AtObj(t,r[0]);if(2!=n.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+n.length;if("2a864886f70d01050d"!=Fn.getHexOfV_AtObj(t,n[0]))throw"this only supports pkcs5PBES2";var i=Fn.getPosArrayOfChildren_AtObj(t,n[1]);if(2!=n.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+i.length;var s=Fn.getPosArrayOfChildren_AtObj(t,i[1]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+s.length;if("2a864886f70d0307"!=Fn.getHexOfV_AtObj(t,s[0]))throw"this only supports TripleDES";e.encryptionSchemeAlg="TripleDES",e.encryptionSchemeIV=Fn.getHexOfV_AtObj(t,s[1]);var o=Fn.getPosArrayOfChildren_AtObj(t,i[0]);if(2!=o.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+o.length;if("2a864886f70d01050c"!=Fn.getHexOfV_AtObj(t,o[0]))throw"this only supports pkcs5PBKDF2";var a=Fn.getPosArrayOfChildren_AtObj(t,o[1]);if(a.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+a.length;e.pbkdf2Salt=Fn.getHexOfV_AtObj(t,a[0]);var u=Fn.getHexOfV_AtObj(t,a[1]);try{e.pbkdf2Iter=parseInt(u,16)}catch(h){throw"malformed format pbkdf2Iter: "+u}return e},getPBKDF2KeyHexFromParam:function(t,e){var r=sn.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,i=sn.PBKDF2(e,r,{keySize:6,iterations:n}),s=sn.enc.Hex.stringify(i);return s},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=this.getHexFromPEM(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=Pn.getPBKDF2KeyHexFromParam(n,e),s={};s.ciphertext=sn.enc.Hex.parse(n.ciphertext);var o=sn.enc.Hex.parse(i),a=sn.enc.Hex.parse(n.encryptionSchemeIV),u=sn.TripleDES.decrypt(s,o,{iv:a}),h=sn.enc.Hex.stringify(u);return h},getRSAKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e),n=this.getRSAKeyFromPlainPKCS8Hex(r);return n},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e),n=this.getKeyFromPlainPrivatePKCS8Hex(r);return n},parsePlainPrivatePKCS8Hex:function(t){var e={};if(e.algparam=null,"30"!=t.substr(0,2))throw"malformed plain PKCS8 private key(code:001)";var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(3!=r.length)throw"malformed plain PKCS8 private key(code:002)";if("30"!=t.substr(r[1],2))throw"malformed PKCS8 private key(code:003)";var n=Fn.getPosArrayOfChildren_AtObj(t,r[1]);if(2!=n.length)throw"malformed PKCS8 private key(code:004)";if("06"!=t.substr(n[0],2))throw"malformed PKCS8 private key(code:005)";if(e.algoid=Fn.getHexOfV_AtObj(t,n[0]),"06"==t.substr(n[1],2)&&(e.algparam=Fn.getHexOfV_AtObj(t,n[1])),"04"!=t.substr(r[2],2))throw"malformed PKCS8 private key(code:006)";return e.keyidx=Fn.getStartPosOfV_AtObj(t,r[2]),e},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PRIVATE KEY"),r=this.getKeyFromPlainPrivatePKCS8Hex(e);return r},getKeyFromPlainPrivatePKCS8Hex:function(t){var e=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==e.algoid){this.parsePrivateRawRSAKeyHexAtObj(t,e);var r=e.key,n=new ve;return n.setPrivateEx(r.n,r.e,r.d,r.p,r.q,r.dp,r.dq,r.co),n}if("2a8648ce3d0201"==e.algoid){if(this.parsePrivateRawECKeyHexAtObj(t,e),void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var i=KJUR.crypto.OID.oidhex2name[e.algparam],n=new KJUR.crypto.ECDSA({curve:i,prv:e.key});return n}throw"unsupported private key algorithm"},getRSAKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getRSAKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8Hex:function(t){var e=this.parsePublicPKCS8Hex(t);if("2a864886f70d010101"==e.algoid){var r=this.parsePublicRawRSAKeyHex(e.key),n=new ve;return n.setPublic(r.n,r.e),n}if("2a8648ce3d0201"==e.algoid){if(void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var i=KJUR.crypto.OID.oidhex2name[e.algparam],n=new KJUR.crypto.ECDSA({curve:i,pub:e.key});return n}throw"unsupported public key algorithm"},parsePublicRawRSAKeyHex:function(t){var e={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"malformed RSA key(code:002)";if("02"!=t.substr(r[0],2))throw"malformed RSA key(code:003)";if(e.n=Fn.getHexOfV_AtObj(t,r[0]),"02"!=t.substr(r[1],2))throw"malformed RSA key(code:004)";return e.e=Fn.getHexOfV_AtObj(t,r[1]),e},parsePrivateRawRSAKeyHexAtObj:function(t,e){var r=e.keyidx;if("30"!=t.substr(r,2))throw"malformed RSA private key(code:001)";var n=Fn.getPosArrayOfChildren_AtObj(t,r);if(9!=n.length)throw"malformed RSA private key(code:002)";e.key={},e.key.n=Fn.getHexOfV_AtObj(t,n[1]),e.key.e=Fn.getHexOfV_AtObj(t,n[2]),e.key.d=Fn.getHexOfV_AtObj(t,n[3]),e.key.p=Fn.getHexOfV_AtObj(t,n[4]),e.key.q=Fn.getHexOfV_AtObj(t,n[5]),e.key.dp=Fn.getHexOfV_AtObj(t,n[6]),e.key.dq=Fn.getHexOfV_AtObj(t,n[7]),e.key.co=Fn.getHexOfV_AtObj(t,n[8])},parsePrivateRawECKeyHexAtObj:function(t,e){var r=e.keyidx;if("30"!=t.substr(r,2))throw"malformed ECC private key(code:001)";var n=Fn.getPosArrayOfChildren_AtObj(t,r);if(3!=n.length)throw"malformed ECC private key(code:002)";if("04"!=t.substr(n[1],2))throw"malformed ECC private key(code:003)";e.key=Fn.getHexOfV_AtObj(t,n[1])},parsePublicPKCS8Hex:function(t){var e={};e.algparam=null;var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"outer DERSequence shall have 2 elements: "+r.length;var n=r[0];if("30"!=t.substr(n,2))throw"malformed PKCS8 public key(code:001)";var i=Fn.getPosArrayOfChildren_AtObj(t,n);if(2!=i.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(i[0],2))throw"malformed PKCS8 public key(code:003)";if(e.algoid=Fn.getHexOfV_AtObj(t,i[0]),"06"==t.substr(i[1],2)&&(e.algparam=Fn.getHexOfV_AtObj(t,i[1])),"03"!=t.substr(r[1],2))throw"malformed PKCS8 public key(code:004)";return e.key=Fn.getHexOfV_AtObj(t,r[1]).substr(2),e},getRSAKeyFromPublicPKCS8Hex:function(t){var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=e.length)throw"outer DERSequence shall have 2 elements: "+e.length;var r=Fn.getHexOfTLV_AtObj(t,e[0]);if("300d06092a864886f70d0101010500"!=r)throw"PKCS8 AlgorithmId is not rsaEncryption";if("03"!=t.substr(e[1],2))throw"PKCS8 Public Key is not BITSTRING encapslated.";var n=Fn.getStartPosOfV_AtObj(t,e[1])+2;if("30"!=t.substr(n,2))throw"PKCS8 Public Key is not SEQUENCE.";var i=Fn.getPosArrayOfChildren_AtObj(t,n);if(2!=i.length)throw"inner DERSequence shall have 2 elements: "+i.length;if("02"!=t.substr(i[0],2))throw"N is not ASN.1 INTEGER";if("02"!=t.substr(i[1],2))throw"E is not ASN.1 INTEGER";var s=Fn.getHexOfV_AtObj(t,i[0]),o=Fn.getHexOfV_AtObj(t,i[1]),a=new ve;return a.setPublic(s,o),a}}}(),In=function(){var t=function(t,e,r){return n(sn.AES,t,e,r)},e=function(t,e,r){return n(sn.TripleDES,t,e,r)},r=function(t,e,r){return n(sn.DES,t,e,r)},n=function(t,e,r,n){var i=sn.enc.Hex.parse(e),s=sn.enc.Hex.parse(r),o=sn.enc.Hex.parse(n),a={};a.key=s,a.iv=o,a.ciphertext=i;var u=t.decrypt(a,s,{iv:o});return sn.enc.Hex.stringify(u)},s=function(t,e,r){return h(sn.AES,t,e,r)},a=function(t,e,r){return h(sn.TripleDES,t,e,r)},u=function(t,e,r){return h(sn.DES,t,e,r)},h=function(t,e,r,n){var i=sn.enc.Hex.parse(e),s=sn.enc.Hex.parse(r),o=sn.enc.Hex.parse(n),a=t.encrypt(i,s,{iv:o}),u=sn.enc.Hex.parse(a.toString()),h=sn.enc.Base64.stringify(u);return h},c={"AES-256-CBC":{proc:t,eproc:s,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:s,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:s,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:a,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:u,keylen:8,ivlen:8}},f=function(t){return c[t].proc},l=function(t){var e=sn.lib.WordArray.random(t),r=sn.enc.Hex.stringify(e);return r},d=function(t){var e={};t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))&&(e.cipher=RegExp.$1,e.ivsalt=RegExp.$2),t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))&&(e.type=RegExp.$1);var r=-1,n=0;-1!=t.indexOf("\r\n\r\n")&&(r=t.indexOf("\r\n\r\n"),n=2),-1!=t.indexOf("\n\n")&&(r=t.indexOf("\n\n"),n=1);var i=t.indexOf("-----END");if(-1!=r&&-1!=i){var s=t.substring(r+2*n,i-n);s=s.replace(/\s+/g,""),e.data=s}return e},p=function(t,e,r){for(var n=r.substring(0,16),i=sn.enc.Hex.parse(n),s=sn.enc.Utf8.parse(e),o=c[t].keylen+c[t].ivlen,a="",u=null;;){var h=sn.algo.MD5.create();if(null!=u&&h.update(u),h.update(s),h.update(i),u=h.finalize(),a+=sn.enc.Hex.stringify(u),a.length>=2*o)break}var f={};return f.keyhex=a.substr(0,2*c[t].keylen),f.ivhex=a.substr(2*c[t].keylen,2*c[t].ivlen),f},g=function(t,e,r,n){var i=sn.enc.Base64.parse(t),s=sn.enc.Hex.stringify(i),o=c[e].proc,a=o(s,r,n);return a},y=function(t,e,r,n){var i=c[e].eproc,s=i(t,r,n);return s};return{version:"1.0.0",getHexFromPEM:function(t,e){var r=t;if(-1==r.indexOf("-----BEGIN "))throw"can't find PEM header: "+e;"string"==typeof e&&""!=e?(r=r.replace("-----BEGIN "+e+"-----",""),r=r.replace("-----END "+e+"-----","")):(r=r.replace(/-----BEGIN [^-]+-----/,""),r=r.replace(/-----END [^-]+-----/,""));var n=r.replace(/\s+/g,""),s=i(n);return s},getDecryptedKeyHexByKeyIV:function(t,e,r,n){var i=f(e);return i(t,r,n)},parsePKCS5PEM:function(t){return d(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return p(t,e,r)},decryptKeyB64:function(t,e,r,n){return g(t,e,r,n)},getDecryptedKeyHex:function(t,e){var r=d(t),n=(r.type,r.cipher),i=r.ivsalt,s=r.data,o=p(n,e,i),a=o.keyhex,u=g(s,n,a,i);return u},getRSAKeyFromEncryptedPKCS5PEM:function(t,e){var r=this.getDecryptedKeyHex(t,e),n=new ve;return n.readPrivateKeyFromASN1HexString(r),n},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,n,i){var s="";if("undefined"!=typeof n&&null!=n||(n="AES-256-CBC"),"undefined"==typeof c[n])throw"KEYUTIL unsupported algorithm: "+n;if("undefined"==typeof i||null==i){var o=c[n].ivlen,a=l(o);i=a.toUpperCase()}var u=p(n,r,i),h=u.keyhex,f=y(e,n,h,i),d=f.replace(/(.{64})/g,"$1\r\n"),s="-----BEGIN "+t+" PRIVATE KEY-----\r\n";return s+="Proc-Type: 4,ENCRYPTED\r\n",s+="DEK-Info: "+n+","+i+"\r\n",s+="\r\n",s+=d,s+="\r\n-----END "+t+" PRIVATE KEY-----\r\n"},getEncryptedPKCS5PEMFromRSAKey:function(t,e,r,n){var i=new KJUR.asn1.DERInteger({"int":0}),s=new KJUR.asn1.DERInteger({bigint:t.n}),o=new KJUR.asn1.DERInteger({"int":t.e}),a=new KJUR.asn1.DERInteger({bigint:t.d}),u=new KJUR.asn1.DERInteger({bigint:t.p}),h=new KJUR.asn1.DERInteger({bigint:t.q}),c=new KJUR.asn1.DERInteger({bigint:t.dmp1}),f=new KJUR.asn1.DERInteger({bigint:t.dmq1}),l=new KJUR.asn1.DERInteger({bigint:t.coeff}),d=new KJUR.asn1.DERSequence({array:[i,s,o,a,u,h,c,f,l]}),p=d.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",p,e,r,n)},newEncryptedPKCS5PEM:function(t,e,r,n){"undefined"!=typeof e&&null!=e||(e=1024),"undefined"!=typeof r&&null!=r||(r="10001");var i=new ve;i.generate(e,r);var s=null;return s="undefined"==typeof n||null==n?this.getEncryptedPKCS5PEMFromRSAKey(i,t):this.getEncryptedPKCS5PEMFromRSAKey(i,t,n)},getRSAKeyFromPlainPKCS8PEM:function(t){if(t.match(/ENCRYPTED/))throw"pem shall be not ENCRYPTED";var e=this.getHexFromPEM(t,"PRIVATE KEY"),r=this.getRSAKeyFromPlainPKCS8Hex(e);return r},getRSAKeyFromPlainPKCS8Hex:function(t){var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(3!=e.length)throw"outer DERSequence shall have 3 elements: "+e.length;var r=Fn.getHexOfTLV_AtObj(t,e[1]);if("300d06092a864886f70d0101010500"!=r)throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+r;var r=Fn.getHexOfTLV_AtObj(t,e[1]),n=Fn.getHexOfTLV_AtObj(t,e[2]),i=Fn.getHexOfV_AtObj(n,0),s=new ve;return s.readPrivateKeyFromASN1HexString(i),s},parseHexOfEncryptedPKCS8:function(t){var e={},r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"malformed format: SEQUENCE(0).items != 2: "+r.length;e.ciphertext=Fn.getHexOfV_AtObj(t,r[1]);var n=Fn.getPosArrayOfChildren_AtObj(t,r[0]);if(2!=n.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+n.length;if("2a864886f70d01050d"!=Fn.getHexOfV_AtObj(t,n[0]))throw"this only supports pkcs5PBES2";var i=Fn.getPosArrayOfChildren_AtObj(t,n[1]);if(2!=n.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+i.length;var s=Fn.getPosArrayOfChildren_AtObj(t,i[1]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+s.length;if("2a864886f70d0307"!=Fn.getHexOfV_AtObj(t,s[0]))throw"this only supports TripleDES";e.encryptionSchemeAlg="TripleDES",e.encryptionSchemeIV=Fn.getHexOfV_AtObj(t,s[1]);var o=Fn.getPosArrayOfChildren_AtObj(t,i[0]);if(2!=o.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+o.length;if("2a864886f70d01050c"!=Fn.getHexOfV_AtObj(t,o[0]))throw"this only supports pkcs5PBKDF2";var a=Fn.getPosArrayOfChildren_AtObj(t,o[1]);if(a.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+a.length;e.pbkdf2Salt=Fn.getHexOfV_AtObj(t,a[0]);var u=Fn.getHexOfV_AtObj(t,a[1]);try{e.pbkdf2Iter=parseInt(u,16)}catch(h){throw"malformed format pbkdf2Iter: "+u}return e},getPBKDF2KeyHexFromParam:function(t,e){var r=sn.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,i=sn.PBKDF2(e,r,{keySize:6,iterations:n}),s=sn.enc.Hex.stringify(i);return s},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=this.getHexFromPEM(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=In.getPBKDF2KeyHexFromParam(n,e),s={};s.ciphertext=sn.enc.Hex.parse(n.ciphertext);var o=sn.enc.Hex.parse(i),a=sn.enc.Hex.parse(n.encryptionSchemeIV),u=sn.TripleDES.decrypt(s,o,{iv:a}),h=sn.enc.Hex.stringify(u);return h},getRSAKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e),n=this.getRSAKeyFromPlainPKCS8Hex(r);return n},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e),n=this.getKeyFromPlainPrivatePKCS8Hex(r);return n},parsePlainPrivatePKCS8Hex:function(t){var e={};if(e.algparam=null,"30"!=t.substr(0,2))throw"malformed plain PKCS8 private key(code:001)";var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(3!=r.length)throw"malformed plain PKCS8 private key(code:002)";if("30"!=t.substr(r[1],2))throw"malformed PKCS8 private key(code:003)";var n=Fn.getPosArrayOfChildren_AtObj(t,r[1]);if(2!=n.length)throw"malformed PKCS8 private key(code:004)";if("06"!=t.substr(n[0],2))throw"malformed PKCS8 private key(code:005)";if(e.algoid=Fn.getHexOfV_AtObj(t,n[0]),"06"==t.substr(n[1],2)&&(e.algparam=Fn.getHexOfV_AtObj(t,n[1])),"04"!=t.substr(r[2],2))throw"malformed PKCS8 private key(code:006)";return e.keyidx=Fn.getStartPosOfV_AtObj(t,r[2]),e},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PRIVATE KEY"),r=this.getKeyFromPlainPrivatePKCS8Hex(e);return r},getKeyFromPlainPrivatePKCS8Hex:function(t){var e=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==e.algoid){this.parsePrivateRawRSAKeyHexAtObj(t,e);var r=e.key,n=new ve;return n.setPrivateEx(r.n,r.e,r.d,r.p,r.q,r.dp,r.dq,r.co),n}if("2a8648ce3d0201"==e.algoid){if(this.parsePrivateRawECKeyHexAtObj(t,e),void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var i=KJUR.crypto.OID.oidhex2name[e.algparam],n=new KJUR.crypto.ECDSA({curve:i});return n.setPublicKeyHex(e.pubkey),n.setPrivateKeyHex(e.key),n.isPublic=!1,n}if("2a8648ce380401"==e.algoid){var s=Fn.getVbyList(t,0,[1,1,0],"02"),a=Fn.getVbyList(t,0,[1,1,1],"02"),u=Fn.getVbyList(t,0,[1,1,2],"02"),h=Fn.getVbyList(t,0,[2,0],"02"),c=new o(s,16),f=new o(a,16),l=new o(u,16),d=new o(h,16),n=new KJUR.crypto.DSA;return n.setPrivate(c,f,l,null,d),n}throw"unsupported private key algorithm"},getRSAKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getRSAKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8Hex:function(t){var e=this.parsePublicPKCS8Hex(t);if("2a864886f70d010101"==e.algoid){var r=this.parsePublicRawRSAKeyHex(e.key),n=new ve;return n.setPublic(r.n,r.e),n}if("2a8648ce3d0201"==e.algoid){if(void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var i=KJUR.crypto.OID.oidhex2name[e.algparam],n=new KJUR.crypto.ECDSA({curve:i,pub:e.key});return n}if("2a8648ce380401"==e.algoid){var s=e.algparam,a=Fn.getHexOfV_AtObj(e.key,0),n=new KJUR.crypto.DSA;return n.setPublic(new o(s.p,16),new o(s.q,16),new o(s.g,16),new o(a,16)),n}throw"unsupported public key algorithm"},parsePublicRawRSAKeyHex:function(t){var e={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"malformed RSA key(code:002)"; -if("02"!=t.substr(r[0],2))throw"malformed RSA key(code:003)";if(e.n=Fn.getHexOfV_AtObj(t,r[0]),"02"!=t.substr(r[1],2))throw"malformed RSA key(code:004)";return e.e=Fn.getHexOfV_AtObj(t,r[1]),e},parsePrivateRawRSAKeyHexAtObj:function(t,e){var r=e.keyidx;if("30"!=t.substr(r,2))throw"malformed RSA private key(code:001)";var n=Fn.getPosArrayOfChildren_AtObj(t,r);if(9!=n.length)throw"malformed RSA private key(code:002)";e.key={},e.key.n=Fn.getHexOfV_AtObj(t,n[1]),e.key.e=Fn.getHexOfV_AtObj(t,n[2]),e.key.d=Fn.getHexOfV_AtObj(t,n[3]),e.key.p=Fn.getHexOfV_AtObj(t,n[4]),e.key.q=Fn.getHexOfV_AtObj(t,n[5]),e.key.dp=Fn.getHexOfV_AtObj(t,n[6]),e.key.dq=Fn.getHexOfV_AtObj(t,n[7]),e.key.co=Fn.getHexOfV_AtObj(t,n[8])},parsePrivateRawECKeyHexAtObj:function(t,e){var r=e.keyidx,n=Fn.getVbyList(t,r,[1],"04"),i=Fn.getVbyList(t,r,[2,0],"03").substr(2);e.key=n,e.pubkey=i},parsePublicPKCS8Hex:function(t){var e={};e.algparam=null;var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"outer DERSequence shall have 2 elements: "+r.length;var n=r[0];if("30"!=t.substr(n,2))throw"malformed PKCS8 public key(code:001)";var i=Fn.getPosArrayOfChildren_AtObj(t,n);if(2!=i.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(i[0],2))throw"malformed PKCS8 public key(code:003)";if(e.algoid=Fn.getHexOfV_AtObj(t,i[0]),"06"==t.substr(i[1],2)?e.algparam=Fn.getHexOfV_AtObj(t,i[1]):"30"==t.substr(i[1],2)&&(e.algparam={},e.algparam.p=Fn.getVbyList(t,i[1],[0],"02"),e.algparam.q=Fn.getVbyList(t,i[1],[1],"02"),e.algparam.g=Fn.getVbyList(t,i[1],[2],"02")),"03"!=t.substr(r[1],2))throw"malformed PKCS8 public key(code:004)";return e.key=Fn.getHexOfV_AtObj(t,r[1]).substr(2),e},getRSAKeyFromPublicPKCS8Hex:function(t){var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=e.length)throw"outer DERSequence shall have 2 elements: "+e.length;var r=Fn.getHexOfTLV_AtObj(t,e[0]);if("300d06092a864886f70d0101010500"!=r)throw"PKCS8 AlgorithmId is not rsaEncryption";if("03"!=t.substr(e[1],2))throw"PKCS8 Public Key is not BITSTRING encapslated.";var n=Fn.getStartPosOfV_AtObj(t,e[1])+2;if("30"!=t.substr(n,2))throw"PKCS8 Public Key is not SEQUENCE.";var i=Fn.getPosArrayOfChildren_AtObj(t,n);if(2!=i.length)throw"inner DERSequence shall have 2 elements: "+i.length;if("02"!=t.substr(i[0],2))throw"N is not ASN.1 INTEGER";if("02"!=t.substr(i[1],2))throw"E is not ASN.1 INTEGER";var s=Fn.getHexOfV_AtObj(t,i[0]),o=Fn.getHexOfV_AtObj(t,i[1]),a=new ve;return a.setPublic(s,o),a}}}();In.getKey=function(t,e,r){if("undefined"!=typeof ve&&t instanceof ve)return t;if("undefined"!=typeof KJUR.crypto.ECDSA&&t instanceof KJUR.crypto.ECDSA)return t;if("undefined"!=typeof KJUR.crypto.DSA&&t instanceof KJUR.crypto.DSA)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new KJUR.crypto.ECDSA({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new KJUR.crypto.ECDSA({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d){var n=new ve;return n.setPublic(t.n,t.e),n}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){var n=new ve;return n.setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),n}if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p){var n=new ve;return n.setPrivate(t.n,t.e,t.d),n}if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x){var n=new KJUR.crypto.DSA;return n.setPublic(t.p,t.q,t.g,t.y),n}if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x){var n=new KJUR.crypto.DSA;return n.setPrivate(t.p,t.q,t.g,t.y,t.x),n}if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d){var n=new ve;return n.setPublic(pr(t.n),pr(t.e)),n}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){var n=new ve;return n.setPrivateEx(pr(t.n),pr(t.e),pr(t.d),pr(t.p),pr(t.q),pr(t.dp),pr(t.dq),pr(t.qi)),n}if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d){var n=new ve;return n.setPrivate(pr(t.n),pr(t.e),pr(t.d)),n}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var i=new KJUR.crypto.ECDSA({curve:t.crv}),s=i.ecparams.keylen/4,a=("0000000000"+pr(t.x)).slice(-s),u=("0000000000"+pr(t.y)).slice(-s),h="04"+a+u;return i.setPublicKeyHex(h),i}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){var i=new KJUR.crypto.ECDSA({curve:t.crv}),s=i.ecparams.keylen/4,c=("0000000000"+pr(t.d)).slice(-s);return i.setPrivateKeyHex(c),i}if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Gr.getPublicKeyFromCertPEM(t);if("pkcs8pub"===r)return In.getKeyFromPublicPKCS8Hex(t);if(-1!=t.indexOf("-END PUBLIC KEY-"))return In.getKeyFromPublicPKCS8PEM(t);if("pkcs5prv"===r){var n=new ve;return n.readPrivateKeyFromASN1HexString(t),n}if("pkcs5prv"===r){var n=new ve;return n.readPrivateKeyFromASN1HexString(t),n}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var f=In.getHexFromPEM(t,"RSA PRIVATE KEY");return In.getKey(f,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var l=this.getHexFromPEM(t,"DSA PRIVATE KEY"),d=Fn.getVbyList(l,0,[1],"02"),p=Fn.getVbyList(l,0,[2],"02"),g=Fn.getVbyList(l,0,[3],"02"),y=Fn.getVbyList(l,0,[4],"02"),v=Fn.getVbyList(l,0,[5],"02"),n=new KJUR.crypto.DSA;return n.setPrivate(new o(d,16),new o(p,16),new o(g,16),new o(y,16),new o(v,16)),n}if(-1!=t.indexOf("-END PRIVATE KEY-"))return In.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED"))return In.getRSAKeyFromEncryptedPKCS5PEM(t,e);if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var l=In.getDecryptedKeyHex(t,e),n=Fn.getVbyList(l,0,[1],"04"),m=Fn.getVbyList(l,0,[2,0],"06"),S=Fn.getVbyList(l,0,[3,0],"03").substr(2),_="";if(void 0===KJUR.crypto.OID.oidhex2name[m])throw"undefined OID(hex) in KJUR.crypto.OID: "+m;_=KJUR.crypto.OID.oidhex2name[m];var i=new KJUR.crypto.ECDSA({name:_});return i.setPublicKeyHex(S),i.setPrivateKeyHex(n),i.isPublic=!1,i}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var l=In.getDecryptedKeyHex(t,e),d=Fn.getVbyList(l,0,[1],"02"),p=Fn.getVbyList(l,0,[2],"02"),g=Fn.getVbyList(l,0,[3],"02"),y=Fn.getVbyList(l,0,[4],"02"),v=Fn.getVbyList(l,0,[5],"02"),n=new KJUR.crypto.DSA;return n.setPrivate(new o(d,16),new o(p,16),new o(g,16),new o(y,16),new o(v,16)),n}if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return In.getKeyFromEncryptedPKCS8PEM(t,e);throw"not supported argument"},In.generateKeypair=function(t,e){if("RSA"==t){var r=e,n=new ve;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new ve,s=n.n.toString(16),o=n.e.toString(16);i.setPublic(s,o),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=i,a}if("EC"==t){var u=e,h=new KJUR.crypto.ECDSA({curve:u}),c=h.generateKeyPairHex(),n=new KJUR.crypto.ECDSA({curve:u});n.setPrivateKeyHex(c.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new KJUR.crypto.ECDSA({curve:u});i.setPublicKeyHex(c.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=i,a}throw"unknown algorithm: "+t},In.getPEM=function(t,e,r,n,i){function s(t){var e=KJUR.asn1.ASN1Util.newObject({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}}]});return e}function o(t){var e=KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]});return e}function a(t){var e=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:t.p}},{"int":{bigint:t.q}},{"int":{bigint:t.g}},{"int":{bigint:t.y}},{"int":{bigint:t.x}}]});return e}var u=KJUR.asn1,h=KJUR.crypto;if(("undefined"!=typeof ve&&t instanceof ve||"undefined"!=typeof h.DSA&&t instanceof h.DSA||"undefined"!=typeof h.ECDSA&&t instanceof h.ECDSA)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e)){var c=new KJUR.asn1.x509.SubjectPublicKeyInfo(t),f=c.getEncodedHex();return u.ASN1Util.getPEMStringFromHex(f,"PUBLIC KEY")}if("PKCS1PRV"==e&&"undefined"!=typeof ve&&t instanceof ve&&(void 0===r||null==r)&&1==t.isPrivate){var c=s(t),f=c.getEncodedHex();return u.ASN1Util.getPEMStringFromHex(f,"RSA PRIVATE KEY")}if("PKCS1PRV"==e&&"undefined"!=typeof ve&&t instanceof KJUR.crypto.ECDSA&&(void 0===r||null==r)&&1==t.isPrivate){var l=new KJUR.asn1.DERObjectIdentifier({name:t.curveName}),d=l.getEncodedHex(),p=o(t),g=p.getEncodedHex(),y="";return y+=u.ASN1Util.getPEMStringFromHex(d,"EC PARAMETERS"),y+=u.ASN1Util.getPEMStringFromHex(g,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&"undefined"!=typeof KJUR.crypto.DSA&&t instanceof KJUR.crypto.DSA&&(void 0===r||null==r)&&1==t.isPrivate){var c=a(t),f=c.getEncodedHex();return u.ASN1Util.getPEMStringFromHex(f,"DSA PRIVATE KEY")}if("PKCS5PRV"==e&&"undefined"!=typeof ve&&t instanceof ve&&void 0!==r&&null!=r&&1==t.isPrivate){var c=s(t),f=c.getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",f,r,n)}if("PKCS5PRV"==e&&"undefined"!=typeof KJUR.crypto.ECDSA&&t instanceof KJUR.crypto.ECDSA&&void 0!==r&&null!=r&&1==t.isPrivate){var c=o(t),f=c.getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",f,r,n)}if("PKCS5PRV"==e&&"undefined"!=typeof KJUR.crypto.DSA&&t instanceof KJUR.crypto.DSA&&void 0!==r&&null!=r&&1==t.isPrivate){var c=a(t),f=c.getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",f,r,n)}var v=function(t,e){var r=m(t,e),n=new KJUR.asn1.ASN1Util.newObject({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:r.pbkdf2Salt}},{"int":r.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:r.encryptionSchemeIV}}]}]}]},{octstr:{hex:r.ciphertext}}]});return n.getEncodedHex()},m=function(t,e){var r=100,n=sn.lib.WordArray.random(8),i="DES-EDE3-CBC",s=sn.lib.WordArray.random(8),o=sn.PBKDF2(e,n,{keySize:6,iterations:r}),a=sn.enc.Hex.parse(t),u=sn.TripleDES.encrypt(a,o,{iv:s})+"",h={};return h.ciphertext=u,h.pbkdf2Salt=sn.enc.Hex.stringify(n),h.pbkdf2Iter=r,h.encryptionSchemeAlg=i,h.encryptionSchemeIV=sn.enc.Hex.stringify(s),h};if("PKCS8PRV"==e&&"undefined"!=typeof ve&&t instanceof ve&&1==t.isPrivate){var S=s(t),_=S.getEncodedHex(),c=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":!0}]},{octstr:{hex:_}}]}),f=c.getEncodedHex();if(void 0===r||null==r)return u.ASN1Util.getPEMStringFromHex(f,"PRIVATE KEY");var g=v(f,r);return u.ASN1Util.getPEMStringFromHex(g,"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&"undefined"!=typeof KJUR.crypto.ECDSA&&t instanceof KJUR.crypto.ECDSA&&1==t.isPrivate){var S=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:t.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]}),_=S.getEncodedHex(),c=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:_}}]}),f=c.getEncodedHex();if(void 0===r||null==r)return u.ASN1Util.getPEMStringFromHex(f,"PRIVATE KEY");var g=v(f,r);return u.ASN1Util.getPEMStringFromHex(g,"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&"undefined"!=typeof KJUR.crypto.DSA&&t instanceof KJUR.crypto.DSA&&1==t.isPrivate){var S=new KJUR.asn1.DERInteger({bigint:t.x}),_=S.getEncodedHex(),c=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:t.p}},{"int":{bigint:t.q}},{"int":{bigint:t.g}}]}]},{octstr:{hex:_}}]}),f=c.getEncodedHex();if(void 0===r||null==r)return u.ASN1Util.getPEMStringFromHex(f,"PRIVATE KEY");var g=v(f,r);return u.ASN1Util.getPEMStringFromHex(g,"ENCRYPTED PRIVATE KEY")}throw"unsupported object nor format"},In.getKeyFromCSRPEM=function(t){var e=In.getHexFromPEM(t,"CERTIFICATE REQUEST"),r=In.getKeyFromCSRHex(e);return r},In.getKeyFromCSRHex=function(t){var e=In.parseCSRHex(t),r=In.getKey(e.p8pubkeyhex,null,"pkcs8pub");return r},In.parseCSRHex=function(t){var e={},r=t;if("30"!=r.substr(0,2))throw"malformed CSR(code:001)";var n=Fn.getPosArrayOfChildren_AtObj(r,0);if(n.length<1)throw"malformed CSR(code:002)";if("30"!=r.substr(n[0],2))throw"malformed CSR(code:003)";var i=Fn.getPosArrayOfChildren_AtObj(r,n[0]);if(i.length<3)throw"malformed CSR(code:004)";return e.p8pubkeyhex=Fn.getHexOfTLV_AtObj(r,i[2]),e},ve.prototype.readPrivateKeyFromPEMString=Pr,ve.prototype.readPrivateKeyFromASN1HexString=Or;var Dn=new RegExp("");Dn.compile("[^0-9a-f]","gi"),ve.prototype.signWithMessageHash=Cr,ve.prototype.signString=Dr,ve.prototype.signStringWithSHA1=Tr,ve.prototype.signStringWithSHA256=jr,ve.prototype.sign=Dr,ve.prototype.signWithSHA1=Tr,ve.prototype.signWithSHA256=jr,ve.prototype.signWithMessageHashPSS=Br,ve.prototype.signStringPSS=Hr,ve.prototype.signPSS=Hr,ve.SALT_LEN_HLEN=-1,ve.SALT_LEN_MAX=-2,ve.prototype.verifyWithMessageHash=zr,ve.prototype.verifyString=qr,ve.prototype.verifyHexSignatureForMessage=Lr,ve.prototype.verify=qr,ve.prototype.verifyHexSignatureForByteArrayMessage=Lr,ve.prototype.verifyWithMessageHashPSS=Yr,ve.prototype.verifyStringPSS=Wr,ve.prototype.verifyPSS=Wr,ve.SALT_LEN_RECOVER=-2,Gr.pemToBase64=function(t){var e=t;return e=e.replace("-----BEGIN CERTIFICATE-----",""),e=e.replace("-----END CERTIFICATE-----",""),e=e.replace(/[ \n]+/g,"")},Gr.pemToHex=function(t){var e=Gr.pemToBase64(t),r=i(e);return r},Gr.getSubjectPublicKeyPosFromCertHex=function(t){var e=Gr.getSubjectPublicKeyInfoPosFromCertHex(t);if(-1==e)return-1;var r=Fn.getPosArrayOfChildren_AtObj(t,e);if(2!=r.length)return-1;var n=r[1];if("03"!=t.substring(n,n+2))return-1;var i=Fn.getStartPosOfV_AtObj(t,n);return"00"!=t.substring(i,i+2)?-1:i+2},Gr.getSubjectPublicKeyInfoPosFromCertHex=function(t){var e=Fn.getStartPosOfV_AtObj(t,0),r=Fn.getPosArrayOfChildren_AtObj(t,e);return r.length<1?-1:"a003020102"==t.substring(r[0],r[0]+10)?r.length<6?-1:r[6]:r.length<5?-1:r[5]},Gr.getPublicKeyHexArrayFromCertHex=function(t){var e=Gr.getSubjectPublicKeyPosFromCertHex(t),r=Fn.getPosArrayOfChildren_AtObj(t,e);if(2!=r.length)return[];var n=Fn.getHexOfV_AtObj(t,r[0]),i=Fn.getHexOfV_AtObj(t,r[1]);return null!=n&&null!=i?[n,i]:[]},Gr.getHexTbsCertificateFromCert=function(t){var e=Fn.getStartPosOfV_AtObj(t,0);return e},Gr.getPublicKeyHexArrayFromCertPEM=function(t){var e=Gr.pemToHex(t),r=Gr.getPublicKeyHexArrayFromCertHex(e);return r},Gr.hex2dn=function(t){for(var e="",r=Fn.getPosArrayOfChildren_AtObj(t,0),n=0;na;a++)o[a]=Gr.getV3ExtItemInfo_AtObj(t,i[a]);return o},Gr.getV3ExtItemInfo_AtObj=function(t,e){var r={};r.posTLV=e;var n=Fn.getPosArrayOfChildren_AtObj(t,e);if(2!=n.length&&3!=n.length)throw"malformed X.509v3 Ext (code:001)";if("06"!=t.substr(n[0],2))throw"malformed X.509v3 Ext (code:002)";var i=Fn.getHexOfV_AtObj(t,n[0]);r.oid=Fn.hextooidstr(i),r.critical=!1,3==n.length&&(r.critical=!0);var s=n[n.length-1];if("04"!=t.substr(s,2))throw"malformed X.509v3 Ext (code:003)";return r.posV=Fn.getStartPosOfV_AtObj(t,s),r},Gr.getHexOfTLV_V3ExtValue=function(t,e){var r=Gr.getPosOfTLV_V3ExtValue(t,e);return-1==r?null:Fn.getHexOfTLV_AtObj(t,r)},Gr.getHexOfV_V3ExtValue=function(t,e){var r=Gr.getPosOfTLV_V3ExtValue(t,e);return-1==r?null:Fn.getHexOfV_AtObj(t,r)},Gr.getPosOfTLV_V3ExtValue=function(t,e){var r=e;if(e.match(/^[0-9.]+$/)||(r=KJUR.asn1.x509.OID.name2oid(e)),""==r)return-1;for(var n=Gr.getV3ExtInfoListOfCertHex(t),i=0;i0){var l=":"+r.join(":")+":";if(-1==l.indexOf(":"+c+":"))throw"algorithm '"+c+"' not accepted in the list"}if("none"!=c&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=In.getKey(e)),!("RS"!=f&&"PS"!=f||e instanceof ve))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==f&&!(e instanceof KJUR.crypto.ECDSA))throw"key shall be a ECDSA obj for ES* algs";var d=null;if(void 0===n.jwsalg2sigalg[h.alg])throw"unsupported alg name: "+c;if(d=n.jwsalg2sigalg[c],"none"==d)throw"not supported";if("Hmac"==d.substr(0,4)){var p=null;if(void 0===e)throw"hexadecimal key shall be specified for HMAC";var g=new KJUR.crypto.Mac({alg:d,pass:e});return g.updateString(a),p=g.doFinal(),u==p}if(-1!=d.indexOf("withECDSA")){var y=null;try{y=KJUR.crypto.ECDSA.concatSigToASN1Sig(u)}catch(v){return!1}var m=new KJUR.crypto.Signature({alg:d});return m.init(e),m.updateString(a),m.verify(y)}var m=new KJUR.crypto.Signature({alg:d});return m.init(e),m.updateString(a),m.verify(u)},KJUR.jws.JWS.parse=function(t){var e,r,n,i=t.split("."),s={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=i[0],r=i[1],3==i.length&&(n=i[2]),s.headerObj=KJUR.jws.JWS.readSafeJSONString(Un(e)),s.payloadObj=KJUR.jws.JWS.readSafeJSONString(Un(r)),s.headerPP=JSON.stringify(s.headerObj,null," "),null==s.payloadObj?s.payloadPP=Un(r):s.payloadPP=JSON.stringify(s.payloadObj,null," "),void 0!==n&&(s.sigHex=pr(n)),s},KJUR.jws.JWS.verifyJWT=function(t,e,r){var n=KJUR.jws.JWS,i=t.split("."),s=i[0],o=i[1],a=(pr(i[2]),n.readSafeJSONString(Un(s))),u=n.readSafeJSONString(Un(o));if(void 0===a.alg)return!1;if(void 0===r.alg)throw"acceptField.alg shall be specified";if(!n.inArray(a.alg,r.alg))return!1;if(void 0!==u.iss&&"object"==typeof r.iss&&!n.inArray(u.iss,r.iss))return!1;if(void 0!==u.sub&&"object"==typeof r.sub&&!n.inArray(u.sub,r.sub))return!1;if(void 0!==u.aud&&"object"==typeof r.aud)if("string"==typeof u.aud){if(!n.inArray(u.aud,r.aud))return!1}else if("object"==typeof u.aud&&!n.includedArray(u.aud,r.aud))return!1;var h=KJUR.jws.IntDate.getNow();return void 0!==r.verifyAt&&"number"==typeof r.verifyAt&&(h=r.verifyAt),void 0!==u.exp&&"number"==typeof u.exp&&u.exp=50&&100>n)n=1900+n;else{if(!(n>=0&&50>n))throw"malformed year string for UTCTime";n=2e3+n}}var i=parseInt(RegExp.$2)-1,s=parseInt(RegExp.$3),o=parseInt(RegExp.$4),a=parseInt(RegExp.$5),u=parseInt(RegExp.$6),h=new Date(Date.UTC(n,i,s,o,a,u));return~~(h/1e3)}throw"unsupported format: "+t},KJUR.jws.IntDate.getNow=function(){var t=~~(new Date/1e3);return t},KJUR.jws.IntDate.intDate2UTCString=function(t){var e=new Date(1e3*t);return e.toUTCString()},KJUR.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t),r=("0000"+e.getUTCFullYear()).slice(-4),n=("00"+(e.getUTCMonth()+1)).slice(-2),i=("00"+e.getUTCDate()).slice(-2),s=("00"+e.getUTCHours()).slice(-2),o=("00"+e.getUTCMinutes()).slice(-2),a=("00"+e.getUTCSeconds()).slice(-2);return r+n+i+s+o+a+"Z"},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.jws&&KJUR.jws||(KJUR.jws={}),KJUR.jws.JWSJS=function(){var t=KJUR.jws.JWS;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload="",this.aSignature=[]},this.initWithJWS=function(t){this.init();var e=new KJUR.jws.JWS;e.parseJWS(t),this.aHeader.push(e.parsedJWS.headB64U),this.sPayload=e.parsedJWS.payloadB64U,this.aSignature.push(e.parsedJWS.sigvalB64U)},this.addSignatureByHeaderKey=function(t,e){var r=Un(this.sPayload),n=new KJUR.jws.JWS;n.generateJWSByP1PrvKey(t,r,e),this.aHeader.push(n.parsedJWS.headB64U),this.aSignature.push(n.parsedJWS.sigvalB64U)},this.addSignatureByHeaderPayloadKey=function(t,e,r){var n=new KJUR.jws.JWS;n.generateJWSByP1PrvKey(t,e,r),this.aHeader.push(n.parsedJWS.headB64U),this.sPayload=n.parsedJWS.payloadB64U,this.aSignature.push(n.parsedJWS.sigvalB64U)},this.verifyWithCerts=function(t){if(this.aHeader.length!=t.length)throw"num headers does not match with num certs";if(this.aSignature.length!=t.length)throw"num signatures does not match with num certs";for(var e=this.sPayload,r="",n=0;n0){var r=e-this._accessTokenExpiringNotificationTime;0>=r&&(r=1),o["default"].info("registering expiring timer in:",r),this._accessTokenExpiring.init(r)}var n=e+1;o["default"].info("registering expired timer in:",n),this._accessTokenExpired.init(n)}},t.prototype.unload=function(){o["default"].info("AccessTokenEvents.unload"),this._cancelTimers()},t.prototype._cancelTimers=function(){o["default"].info("canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function(t){this._accessTokenExpiring.addHandler(t)},t.prototype.removeAccessTokenExpiring=function(t){this._accessTokenExpiring.removeHandler(t)},t.prototype.addAccessTokenExpired=function(t){this._accessTokenExpired.addHandler(t)},t.prototype.removeAccessTokenExpired=function(t){this._accessTokenExpired.removeHandler(t)},t}();e["default"]=c,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=r(1),u=n(a),h=function(t){function e(){var r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=r.error,o=r.error_description,a=r.error_uri,h=r.state;if(i(this,e),!n)throw u["default"].error("No error passed to ErrorResponse"),new Error("error");var c=s(this,t.call(this,o||n));return c.name="ErrorResponse",c.error=n,c.error_description=o,c.error_uri=a,c.state=h,c}return o(e,t),e}(Error);e["default"]=h,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=function(){function t(e){i(this,t),this._name=e,this._callbacks=[]}return t.prototype.addHandler=function(t){this._callbacks.push(t)},t.prototype.removeHandler=function(t){var e=this._callbacks.findIndex(function(e){return e===t});e>=0&&this._callbacks.splice(e,1)},t.prototype.raise=function(){o["default"].info("Raising event: "+this._name);var t=!0,e=!1,r=void 0;try{for(var n,i=this._callbacks[Symbol.iterator]();!(t=(n=i.next()).done);t=!0){var s=n.value;s.apply(void 0,arguments)}}catch(a){e=!0,r=a}finally{try{!t&&i["return"]&&i["return"]()}finally{if(e)throw r}}},t}();e["default"]=a,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=r(2),u=n(a),h=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?u["default"].XMLHttpRequest:arguments[0];i(this,t),this._XMLHttpRequest=e}return t.prototype.getJson=function(t,e){var r=this;if(o["default"].info("JsonService.getJson",t),!t)throw o["default"].error("No url passed"),new Error("url");return new Promise(function(n,i){var s=new r._XMLHttpRequest;s.open("GET",t),s.onload=function(){o["default"].info("HTTP response received, status",s.status),200===s.status?n(JSON.parse(s.responseText)):i(Error(s.statusText+" ("+s.status+")"))},s.onerror=function(){o["default"].error("network error"),i(Error("Network Error"))},e&&(o["default"].info("token passed, setting Authorization header"),s.setRequestHeader("Authorization","Bearer "+e)),s.send()})},t}();e["default"]=h,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var r=0;r1?arguments[1]:"utf8"):u(this,e)):arguments.length>1?new t(e,arguments[1]):new t(e)}function o(e,r){if(e=g(e,0>r?0:0|y(r)),!t.TYPED_ARRAY_SUPPORT)for(var n=0;r>n;n++)e[n]=0;return e}function a(t,e,r){"string"==typeof r&&""!==r||(r="utf8");var n=0|m(e,r);return t=g(t,n),t.write(e,r),t}function u(e,r){if(t.isBuffer(r))return h(e,r);if(X(r))return c(e,r);if(null==r)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(r.buffer instanceof ArrayBuffer)return f(e,r);if(r instanceof ArrayBuffer)return l(e,r)}return r.length?d(e,r):p(e,r)}function h(t,e){var r=0|y(e.length);return t=g(t,r),e.copy(t,0,0,r),t}function c(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function f(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function l(e,r){return t.TYPED_ARRAY_SUPPORT?(r.byteLength,e=t._augment(new Uint8Array(r))):e=f(e,new Uint8Array(r)),e}function d(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function p(t,e){var r,n=0;"Buffer"===e.type&&X(e.data)&&(r=e.data,n=0|y(r.length)),t=g(t,n);for(var i=0;n>i;i+=1)t[i]=255&r[i];return t}function g(e,r){t.TYPED_ARRAY_SUPPORT?(e=t._augment(new Uint8Array(r)),e.__proto__=t.prototype):(e.length=r,e._isBuffer=!0);var n=0!==r&&r<=t.poolSize>>>1;return n&&(e.parent=$),e}function y(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function v(e,r){if(!(this instanceof v))return new v(e,r);var n=new t(e,r);return delete n.parent,n}function m(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(n)return V(t).length;e=(""+e).toLowerCase(),n=!0}}function S(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return F(this,e,r);case"ascii":return U(this,e,r);case"binary":return O(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function _(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var s=e.length;if(s%2!==0)throw new Error("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;n>o;o++){var a=parseInt(e.substr(2*o,2),16);if(isNaN(a))throw new Error("Invalid hex string");t[r+o]=a}return o}function E(t,e,r,n){return W(V(e,t.length-r),t,r,n)}function b(t,e,r,n){return W(L(e),t,r,n)}function w(t,e,r,n){return b(t,e,r,n)}function R(t,e,r,n){return W(z(e),t,r,n)}function x(t,e,r,n){return W(q(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?Y.fromByteArray(t):Y.fromByteArray(t.slice(e,r))}function F(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;r>i;){var s=t[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(r>=i+a){var u,h,c,f;switch(a){case 1:128>s&&(o=s);break;case 2:u=t[i+1],128===(192&u)&&(f=(31&s)<<6|63&u,f>127&&(o=f));break;case 3:u=t[i+1],h=t[i+2],128===(192&u)&&128===(192&h)&&(f=(15&s)<<12|(63&u)<<6|63&h,f>2047&&(55296>f||f>57343)&&(o=f));break;case 4:u=t[i+1],h=t[i+2],c=t[i+3],128===(192&u)&&128===(192&h)&&128===(192&c)&&(f=(15&s)<<18|(63&u)<<12|(63&h)<<6|63&c,f>65535&&1114112>f&&(o=f))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return K(n)}function K(t){var e=t.length;if(Z>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Z));return r}function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(127&t[i]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(t[i]);return n}function P(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",s=e;r>s;s++)i+=M(t[s]);return i}function I(t,e,r){for(var n=t.slice(e,r),i="",s=0;st)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function C(e,r,n,i,s,o){if(!t.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(r>s||o>r)throw new RangeError("value is out of bounds");if(n+i>e.length)throw new RangeError("index out of range")}function T(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-r,2);s>i;i++)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-r,4);s>i;i++)t[r+i]=e>>>8*(n?i:3-i)&255}function J(t,e,r,n,i,s){if(e>i||s>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function H(t,e,r,n,i){return i||J(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),G.write(t,e,r,n,23,4),r+4}function B(t,e,r,n,i){return i||J(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),G.write(t,e,r,n,52,8),r+8}function k(t){if(t=N(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function N(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function M(t){return 16>t?"0"+t.toString(16):t.toString(16)}function V(t,e){e=e||1/0;for(var r,n=t.length,i=null,s=[],o=0;n>o;o++){if(r=t.charCodeAt(o),r>55295&&57344>r){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(56320>r){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,128>r){if((e-=1)<0)break;s.push(r)}else if(2048>r){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function L(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function z(t){return Y.toByteArray(k(t))}function W(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);i++)e[i+r]=t[i];return i}var Y=r(38),G=r(39),X=r(40);e.Buffer=t,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50,t.poolSize=8192;var $={};t.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:i(),t.TYPED_ARRAY_SUPPORT?(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array):(t.prototype.length=void 0,t.prototype.parent=void 0),t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);o>s&&e[s]===r[s];)++s;return s!==o&&(n=e[s],i=r[s]),i>n?-1:n>i?1:0},t.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,r){if(!X(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new t(0);var n;if(void 0===r)for(r=0,n=0;n0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},t.prototype.compare=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:t.compare(this,e)},t.prototype.indexOf=function(e,r){function n(t,e,r){for(var n=-1,i=0;r+i2147483647?r=2147483647:-2147483648>r&&(r=-2147483648),r>>=0,0===this.length)return-1;if(r>=this.length)return-1;if(0>r&&(r=Math.max(this.length+r,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,r);if(t.isBuffer(e))return n(this,e,r);if("number"==typeof e)return t.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,r):n(this,[e],r);throw new TypeError("val must be string, number or Buffer")},t.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},t.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},t.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=e,e=0|r,r=i}var s=this.length-e;if((void 0===r||r>s)&&(r=s),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":return b(this,t,e,r);case"binary":return w(this,t,e,r);case"base64":return R(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),e>r&&(r=e);var i;if(t.TYPED_ARRAY_SUPPORT)i=t._augment(this.subarray(e,r));else{var s=r-e;i=new t(s,void 0);for(var o=0;s>o;o++)i[o]=this[o+e]}return i.length&&(i.parent=this.parent||this),i},t.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||D(t,e,this.length);for(var n=this[t],i=1,s=0;++s0&&(i*=256);)n+=this[t+--e]*i;return n},t.prototype.readUInt8=function(t,e){return e||D(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||D(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||D(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||D(t,e,this.length);for(var n=this[t],i=1,s=0;++s=i&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||D(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},t.prototype.readInt8=function(t,e){return e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},t.prototype.readInt16LE=function(t,e){e||D(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||D(t,4,this.length),G.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||D(t,4,this.length),G.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||D(t,8,this.length),G.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||D(t,8,this.length),G.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||C(this,t,e,r,Math.pow(2,8*r),0);var i=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+i]=t/s&255;return e+r},t.prototype.writeUInt8=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},t.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):T(this,e,r,!0),r+2},t.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):T(this,e,r,!1),r+2},t.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):j(this,e,r,!0),r+4},t.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):j(this,e,r,!1),r+4},t.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var s=0,o=1,a=0>t?1:0;for(this[e]=255&t;++s>0)-a&255;return e+r},t.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0>t?1:0;for(this[e+s]=255&t;--s>=0&&(o*=256);)this[e+s]=(t/o>>0)-a&255;return e+r},t.prototype.writeInt8=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[r]=255&e,r+1},t.prototype.writeInt16LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):T(this,e,r,!0),r+2},t.prototype.writeInt16BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):T(this,e,r,!1),r+2},t.prototype.writeInt32LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):j(this,e,r,!0),r+4},t.prototype.writeInt32BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):j(this,e,r,!1),r+4},t.prototype.writeFloatLE=function(t,e,r){return H(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return H(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return B(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return B(this,t,e,!1,r)},t.prototype.copy=function(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&&n>i&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(0>r)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>i)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-rn&&i>r)for(s=o-1;s>=0;s--)e[s+r]=this[s+n];else if(1e3>o||!t.TYPED_ARRAY_SUPPORT)for(s=0;o>s;s++)e[s+r]=this[s+n];else e._set(this.subarray(n,n+o),r);return o},t.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length), -e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var i=V(t.toString()),s=i.length;for(n=e;r>n;n++)this[n]=i[n%s]}return this}},t.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(t.TYPED_ARRAY_SUPPORT)return new t(this).buffer;for(var e=new Uint8Array(this.length),r=0,n=e.length;n>r;r+=1)e[r]=this[r];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Q=t.prototype;t._augment=function(e){return e.constructor=t,e._isBuffer=!0,e._set=e.set,e.get=Q.get,e.set=Q.set,e.write=Q.write,e.toString=Q.toString,e.toLocaleString=Q.toString,e.toJSON=Q.toJSON,e.equals=Q.equals,e.compare=Q.compare,e.indexOf=Q.indexOf,e.copy=Q.copy,e.slice=Q.slice,e.readUIntLE=Q.readUIntLE,e.readUIntBE=Q.readUIntBE,e.readUInt8=Q.readUInt8,e.readUInt16LE=Q.readUInt16LE,e.readUInt16BE=Q.readUInt16BE,e.readUInt32LE=Q.readUInt32LE,e.readUInt32BE=Q.readUInt32BE,e.readIntLE=Q.readIntLE,e.readIntBE=Q.readIntBE,e.readInt8=Q.readInt8,e.readInt16LE=Q.readInt16LE,e.readInt16BE=Q.readInt16BE,e.readInt32LE=Q.readInt32LE,e.readInt32BE=Q.readInt32BE,e.readFloatLE=Q.readFloatLE,e.readFloatBE=Q.readFloatBE,e.readDoubleLE=Q.readDoubleLE,e.readDoubleBE=Q.readDoubleBE,e.writeUInt8=Q.writeUInt8,e.writeUIntLE=Q.writeUIntLE,e.writeUIntBE=Q.writeUIntBE,e.writeUInt16LE=Q.writeUInt16LE,e.writeUInt16BE=Q.writeUInt16BE,e.writeUInt32LE=Q.writeUInt32LE,e.writeUInt32BE=Q.writeUInt32BE,e.writeIntLE=Q.writeIntLE,e.writeIntBE=Q.writeIntBE,e.writeInt8=Q.writeInt8,e.writeInt16LE=Q.writeInt16LE,e.writeInt16BE=Q.writeInt16BE,e.writeInt32LE=Q.writeInt32LE,e.writeInt32BE=Q.writeInt32BE,e.writeFloatLE=Q.writeFloatLE,e.writeFloatBE=Q.writeFloatBE,e.writeDoubleLE=Q.writeDoubleLE,e.writeDoubleBE=Q.writeDoubleBE,e.fill=Q.fill,e.inspect=Q.inspect,e.toArrayBuffer=Q.toArrayBuffer,e};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,r(17).Buffer,function(){return this}())},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=e.Log=r(1),i=e.OidcClient=r(13),s=e.WebStorageStateStore=r(7),o=e.InMemoryWebStorage=r(21),a=e.UserManager=r(35),u=e.AccessTokenEvents=r(9),h=e.MetadataService=r(4);e["default"]={Log:n,OidcClient:i,WebStorageStateStore:s,InMemoryWebStorage:o,UserManager:a,AccessTokenEvents:u,MetadataService:h}},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=r(20),u=n(a),h=function(){function t(){i(this,t)}return t.prototype.prepare=function(){var t=new u["default"];return Promise.resolve(t)},t.prototype.callback=function(t){o["default"].info("IFrameNavigator.callback");try{return u["default"].notifyParent(t),Promise.resolve()}catch(e){return Promise.reject(e)}},t}();e["default"]=h,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var r=0;r0){var s=parseInt(Date.now()/1e3);this.expires_at=s+n}}return s(t,[{key:"expires_in",get:function(){if(this.expires_at){var t=parseInt(Date.now()/1e3);return this.expires_at-t}}},{key:"expired",get:function(){var t=this.expires_in;return void 0!==t?0>=t:void 0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}},{key:"isOpenIdConnect",get:function(){return this.scopes.indexOf(u)>=0}}]),t}();e["default"]=h,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=r(5),u=n(a),h=r(6),c=n(h),f=function l(t){var e=t.url,r=t.id_token_hint,n=t.post_logout_redirect_uri,s=t.data;if(i(this,l),!e)throw o["default"].error("No url passed to SignoutRequest"),new Error("url");r&&(e=u["default"].addQueryParam(e,"id_token_hint",r),n&&(e=u["default"].addQueryParam(e,"post_logout_redirect_uri",n),s&&(this.state=new c["default"]({data:s}),e=u["default"].addQueryParam(e,"state",this.state.id)))),this.url=e};e["default"]=f,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(5),o=n(s),a=function u(t){i(this,u);var e=o["default"].parseUrlFragment(t,"?");this.error=e.error,this.error_description=e.error_description,this.error_uri=e.error_uri,this.state=e.state};e["default"]=a,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=function(){function t(e){i(this,t),this._userManager=e,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring.bind(this))}return t.prototype._tokenExpiring=function(){var t=this;o["default"].info("SilentRenewService automatically renewing access token"),this._userManager.signinSilent().then(function(t){o["default"].info("Silent token renewal successful")},function(e){o["default"].error("Error from signinSilent:",e.message),t._userManager.events._raiseSilentRenewError(e)})},t}();e["default"]=a,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=r(1),u=(n(a),r(2)),h=n(u),c=r(11),f=n(c),l=function(t){function e(r){var n=arguments.length<=1||void 0===arguments[1]?h["default"].timer:arguments[1];i(this,e);var o=s(this,t.call(this,r));return o._timer=n,o}return o(e,t),e.prototype.init=function(t){this.cancel(),0>=t&&(t=1),this._timerHandle=this._timer.setTimeout(this._callback.bind(this),1e3*t)},e.prototype.cancel=function(){this._timerHandle&&(this._timer.clearTimeout(this._timerHandle),this._timerHandle=null)},e.prototype._callback=function(){this._timerHandle=null,t.prototype.raise.call(this)},e}(f["default"]);e["default"]=l,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var r=0;r=t:void 0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),t}();e["default"]=u,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(12),o=n(s),a=r(4),u=n(a),h=r(1),c=n(h),f=function(){function t(e){var r=arguments.length<=1||void 0===arguments[1]?o["default"]:arguments[1],n=arguments.length<=2||void 0===arguments[2]?u["default"]:arguments[2];if(i(this,t),!e)throw c["default"].error("No settings passed to UserInfoService"),new Error("settings");this._settings=e,this._jsonService=new r,this._metadataService=new n(this._settings)}return t.prototype.getClaims=function(t){var e=this;return c["default"].info("UserInfoService.getClaims"),t?this._metadataService.getUserInfoEndpoint().then(function(r){return c["default"].info("received userinfo url",r),e._jsonService.getJson(r,t).then(function(t){return c["default"].info("claims received",t),t})}):(c["default"].error("No token passed"),Promise.reject(new Error("A token is required")))},t}();e["default"]=f,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var r=0;re?-1:u+10>e?e-u+26+26:c+26>e?e-c:h+26>e?e-h+26:void 0}function r(t){function r(t){h[f++]=t}var n,i,o,a,u,h;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=t.length;u="="===t.charAt(c-2)?2:"="===t.charAt(c-1)?1:0,h=new s(3*t.length/4-u),o=u>0?t.length-4:t.length;var f=0;for(n=0,i=0;o>n;n+=4,i+=3)a=e(t.charAt(n))<<18|e(t.charAt(n+1))<<12|e(t.charAt(n+2))<<6|e(t.charAt(n+3)),r((16711680&a)>>16),r((65280&a)>>8),r(255&a);return 2===u?(a=e(t.charAt(n))<<2|e(t.charAt(n+1))>>4,r(255&a)):1===u&&(a=e(t.charAt(n))<<10|e(t.charAt(n+1))<<4|e(t.charAt(n+2))>>2,r(a>>8&255),r(255&a)),h}function i(t){function e(t){return n.charAt(t)}function r(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var i,s,o,a=t.length%3,u="";for(i=0,o=t.length-a;o>i;i+=3)s=(t[i]<<16)+(t[i+1]<<8)+t[i+2],u+=r(s);switch(a){case 1:s=t[t.length-1],u+=e(s>>2),u+=e(s<<4&63),u+="==";break;case 2:s=(t[t.length-2]<<8)+t[t.length-1],u+=e(s>>10),u+=e(s>>4&63),u+=e(s<<2&63),u+="="}return u}var s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="+".charCodeAt(0),a="/".charCodeAt(0),u="0".charCodeAt(0),h="a".charCodeAt(0),c="A".charCodeAt(0),f="-".charCodeAt(0),l="_".charCodeAt(0);t.toByteArray=r,t.fromByteArray=i}(e)},function(t,e){e.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,u=(1<>1,c=-7,f=r?i-1:0,l=r?-1:1,d=t[e+f];for(f+=l,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=256*s+t[e+f],f+=l,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=l,c-=8);if(0===s)s=1-h;else{if(s===u)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),s-=h}return(d?-1:1)*o*Math.pow(2,s-n)},e.write=function(t,e,r,n,i,s){var o,a,u,h=8*s-i-1,c=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,p=n?1:-1,g=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),e+=o+f>=1?l/u:l*Math.pow(2,1-f),e*u>=2&&(o++,u/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(e*u-1)*Math.pow(2,i),o+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,h-=8);t[r+d-p]|=128*g}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}}])})}])}); \ No newline at end of file +mapEntries:function(t,e){var r=this,n=0;return Re(this,this.toSeq().map(function(i,s){return t.call(e,[s,i],n++,r)}).fromEntrySeq())},mapKeys:function(t,e){var r=this;return Re(this,this.toSeq().flip().map(function(n,i){return t.call(e,n,i,r)}).flip())}});var un=r.prototype;un[hr]=!0,un[Rr]=an.entries,un.__toJS=an.toObject,un.__toStringMapper=function(t,e){return JSON.stringify(e)+": "+er(t)},Xe(n,{toKeyedSeq:function(){return new ne(this,!1)},filter:function(t,e){return Re(this,ce(this,t,e,!1))},findIndex:function(t,e){var r=this.findEntry(t,e);return r?r[0]:-1},indexOf:function(t){var e=this.keyOf(t);return void 0===e?-1:e},lastIndexOf:function(t){var e=this.lastKeyOf(t);return void 0===e?-1:e},reverse:function(){return Re(this,he(this,!1))},slice:function(t,e){return Re(this,de(this,t,e,!1))},splice:function(t,e){var r=arguments.length;if(e=Math.max(0|e,0),0===r||2===r&&!e)return this;t=m(t,0>t?this.count():this.size);var n=this.slice(0,t);return Re(this,1===r?n:n.concat(d(arguments,2),this.slice(t+e)))},findLastIndex:function(t,e){var r=this.findLastEntry(t,e);return r?r[0]:-1},first:function(){return this.get(0)},flatten:function(t){return Re(this,ve(this,t,!1))},get:function(t,e){return t=g(this,t),0>t||this.size===1/0||void 0!==this.size&&t>this.size?e:this.find(function(e,r){return r===t},void 0,e)},has:function(t){return t=g(this,t),t>=0&&(void 0!==this.size?this.size===1/0||t=u){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];h.info.apply(h,Array.from(e))}},t.warn=function(){if(c>=a){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];h.warn.apply(h,Array.from(e))}},t.error=function(){if(c>=o){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];h.error.apply(h,Array.from(e))}},n(t,null,[{key:"NONE",get:function(){return s}},{key:"ERROR",get:function(){return o}},{key:"WARN",get:function(){return a}},{key:"INFO",get:function(){return u}},{key:"level",get:function(){return c},set:function(t){if(!(t>=s&&u>=t))throw new Error("Invalid log level");c=t}},{key:"logger",get:function(){return h},set:function(t){if(!(t.info&&t.warn&&t.error))throw new Error("Invalid logger");h=t}}]),t}();e["default"]=f,f.reset(),t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var r=0;r>6)+an.charAt(63&r);if(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=an.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=an.charAt(r>>2)+an.charAt((3&r)<<4)),un)for(;(3&n.length)>0;)n+=un;return n}function i(t){var e,r,n,i="",s=0;for(e=0;en||(0==s?(i+=f(n>>2),r=3&n,s=1):1==s?(i+=f(r<<2|n>>4),r=15&n,s=2):2==s?(i+=f(r),i+=f(n>>2),r=3&n,s=3):(i+=f(r<<2|n>>4),i+=f(15&n),s=0));return 1==s&&(i+=f(r<<2)),i}function s(t){var e,r=i(t),n=new Array;for(e=0;2*e=0;){var o=e*this[t++]+r[n]+i;i=Math.floor(o/67108864),r[n++]=67108863&o}return i}function h(t,e,r,n,i,s){for(var o=32767&e,a=e>>15;--s>=0;){var u=32767&this[t],h=this[t++]>>15,c=a*u+h*o;u=o*u+((32767&c)<<15)+r[n]+(1073741823&i),i=(u>>>30)+(c>>>15)+a*h+(i>>>30),r[n++]=1073741823&u}return i}function c(t,e,r,n,i,s){for(var o=16383&e,a=e>>14;--s>=0;){var u=16383&this[t],h=this[t++]>>14,c=a*u+h*o;u=o*u+((16383&c)<<14)+r[n]+i,i=(u>>28)+(c>>14)+a*h,r[n++]=268435455&u}return i}function f(t){return pn.charAt(t)}function l(t,e){var r=gn[t.charCodeAt(e)];return null==r?-1:r}function d(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function p(t){this.t=1,this.s=0>t?-1:0,t>0?this[0]=t:-1>t?this[0]=t+this.DV:this.t=0}function g(t){var e=a();return e.fromInt(t),e}function y(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var a=8==r?255&t[n]:l(t,n);0>a?"-"==t.charAt(n)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<>this.DB-s):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}function m(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<0)for(a>a)>0&&(i=!0,s=f(r));o>=0;)e>a?(r=(this[o]&(1<>(a+=this.DB-e)):(r=this[o]>>(a-=e)&n,0>=a&&(a+=this.DB,--o)),r>0&&(i=!0),i&&(s+=f(r));return i?s:"0"}function S(){var t=a();return o.ZERO.subTo(this,t),t}function _(){return this.s<0?this.negate():this}function E(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(e=r-t.t,0!=e)return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0}function b(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function w(){return this.t<=0?0:this.DB*(this.t-1)+b(this[this.t-1]^this.s&this.DM)}function R(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}function x(t,e){for(var r=t;r=0;--r)e[r+o+1]=this[r]>>i|a,a=(this[r]&s)<=0;--r)e[r]=0;e[o]=a,e.t=this.t+o+1,e.s=this.s,e.clamp()}function F(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)return void(e.t=0);var n=t%this.DB,i=this.DB-n,s=(1<>n;for(var o=r+1;o>n;n>0&&(e[this.t-r-1]|=(this.s&s)<r;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=0>n?-1:0,-1>n?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()}function U(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}function P(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(c,s),i.lShiftTo(c,r)):(n.copyTo(s),i.copyTo(r));var f=s.t,l=s[f-1];if(0!=l){var d=l*(1<1?s[f-2]>>this.F2:0),p=this.FV/d,g=(1<=0&&(r[r.t++]=1,r.subTo(S,r)),o.ONE.dlShiftTo(f,S),S.subTo(s,s);s.t=0;){var _=r[--v]==l?this.DM:Math.floor(r[v]*p+(r[v-1]+y)*g);if((r[v]+=s.am(0,_,r,m,0,f))<_)for(s.dlShiftTo(m,S),r.subTo(S,r);r[v]<--_;)r.subTo(S,r)}null!=e&&(r.drShiftTo(f,e),u!=h&&o.ZERO.subTo(e,e)),r.t=f,r.clamp(),c>0&&r.rShiftTo(c,r),0>u&&o.ZERO.subTo(r,r)}}}function I(t){var e=a();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(o.ZERO)>0&&t.subTo(e,e),e}function D(t){this.m=t}function C(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function T(t){return t}function j(t){t.divRemTo(this.m,null,t)}function J(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function H(t,e){t.squareTo(e),this.reduce(e)}function B(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return e=e*(2-(15&t)*e)&15,e=e*(2-(255&t)*e)&255,e=e*(2-((65535&t)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function k(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}function M(t){var e=a();return t.copyTo(e),this.reduce(e),e}function V(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function L(t,e){t.squareTo(e),this.reduce(e)}function q(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function z(){return 0==(this.t>0?1&this[0]:this.s)}function W(t,e){if(t>4294967295||1>t)return o.ONE;var r=a(),n=a(),i=e.convert(this),s=b(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var u=r;r=n,n=u}return e.revert(r)}function Y(t,e){var r;return r=256>t||e.isEven()?new D(e):new k(e),this.exp(t,r)}function G(){var t=a();return this.copyTo(t),t}function X(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}function Z(){return 0==this.t?this.s:this[0]<<16>>16}function Q(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function tt(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1}function et(t){if(null==t&&(t=10),0==this.signum()||2>t||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=g(r),i=a(),s=a(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(t).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(t)+o}function rt(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,a=0,u=0;uh?"-"==t.charAt(u)&&0==this.signum()&&(i=!0):(a=e*a+h,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&o.ZERO.subTo(this,this)}function nt(t,e,r){if("number"==typeof e)if(2>t)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(o.ONE.shiftLeft(t-1),ft,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(o.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<0)for(n>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<=0;)8>n?(r=(this[t]&(1<>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,0>=n&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e}function st(t){return 0==this.compareTo(t)}function ot(t){return this.compareTo(t)<0?this:t}function at(t){return this.compareTo(t)>0?this:t}function ut(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;s>n;++n)r[n]=e(this[n],t[n]);if(t.tt?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function St(t){var e=a();return 0>t?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function _t(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function Et(){for(var t=0;t=this.t?0!=this.s:0!=(this[e]&1<r;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=0>n?-1:0,n>0?e[r++]=n:-1>n&&(e[r++]=this.DV+n),e.t=r,e.clamp()}function Ot(t){var e=a();return this.addTo(t,e),e}function Pt(t){var e=a();return this.subTo(t,e),e}function It(t){var e=a();return this.multiplyTo(t,e),e}function Dt(){var t=a();return this.squareTo(t),t}function Ct(t){var e=a();return this.divRemTo(t,e,null),e}function Tt(t){var e=a();return this.divRemTo(t,null,e),e}function jt(t){var e=a(),r=a();return this.divRemTo(t,e,r),new Array(e,r)}function Jt(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function Ht(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function Bt(){}function kt(t){return t}function Nt(t,e,r){t.multiplyTo(e,r)}function Mt(t,e){t.squareTo(e)}function Vt(t){return this.exp(t,new Bt)}function Lt(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;i>n;++n)r[n+this.t]=this.am(0,t[n],r,n,0,this.t);for(i=Math.min(t.t,e);i>n;++n)this.am(0,t[n],r,n,0,e-n);r.clamp()}function qt(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=a();return t.copyTo(e),this.reduce(e),e}function Yt(t){return t}function Gt(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function Xt(t,e){t.squareTo(e),this.reduce(e)}function $t(t,e,r){t.multiplyTo(e,r),this.reduce(r)}function Zt(t,e){var r,n,i=t.bitLength(),s=g(1);if(0>=i)return s;r=18>i?1:48>i?3:144>i?4:768>i?5:6,n=8>i?new D(e):e.isEven()?new zt(e):new k(e);var o=new Array,u=3,h=r-1,c=(1<1){var f=a();for(n.sqrTo(o[1],f);c>=u;)o[u]=a(),n.mulTo(f,o[u-2],o[u]),u+=2}var l,d,p=t.t-1,y=!0,v=a();for(i=b(t[p])-1;p>=0;){for(i>=h?l=t[p]>>i-h&c:(l=(t[p]&(1<0&&(l|=t[p-1]>>this.DB+i-h)),u=r;0==(1&l);)l>>=1,--u;if((i-=u)<0&&(i+=this.DB,--p),y)o[l].copyTo(s),y=!1;else{for(;u>1;)n.sqrTo(s,v),n.sqrTo(v,s),u-=2;u>0?n.sqrTo(s,v):(d=s,s=v,v=d),n.mulTo(v,o[l],s)}for(;p>=0&&0==(t[p]&1<s)return e;for(s>i&&(s=i),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}function te(t){if(0>=t)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r}function ee(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return o.ZERO;for(var r=t.clone(),n=this.clone(),i=g(1),s=g(0),a=g(0),u=g(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(t,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(a,i),s.subTo(u,s)):(n.subTo(r,n),e&&a.subTo(i,a),u.subTo(s,u))}return 0!=n.compareTo(o.ONE)?o.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u}function re(t){var e,r=this.abs();if(1==r.t&&r[0]<=yn[yn.length-1]){for(e=0;en;)n*=yn[i++];for(n=r.modInt(n);i>e;)if(n%yn[e++]==0)return!1}return r.millerRabin(t)}function ne(t){var e=this.subtract(o.ONE),r=e.getLowestSetBit();if(0>=r)return!1;var n=e.shiftRight(r);t=t+1>>1,t>yn.length&&(t=yn.length);for(var i=a(),s=0;t>s;++s){i.fromInt(yn[Math.floor(Math.random()*yn.length)]);var u=i.modPow(n,this);if(0!=u.compareTo(o.ONE)&&0!=u.compareTo(e)){for(var h=1;h++e;++e)this.S[e]=e;for(r=0,e=0;256>e;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0}function oe(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}function ae(){return new ie}function ue(t){Sn[_n++]^=255&t,Sn[_n++]^=t>>8&255,Sn[_n++]^=t>>16&255,Sn[_n++]^=t>>24&255,_n>=En&&(_n-=En)}function he(){ue((new Date).getTime())}function ce(){if(null==mn){for(he(),mn=ae(),mn.init(Sn),_n=0;_n=0&&e>0;){var i=t.charCodeAt(n--);128>i?r[--e]=i:i>127&&2048>i?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var s=new le,a=new Array;e>2;){for(a[0]=0;0==a[0];)s.nextBytes(a);r[--e]=a[0]}return r[--e]=2,r[--e]=0,new o(r)}function ge(t,e,r){for(var n="",i=0;n.length>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function ye(t,e,r){if(t.length+2*xn+2>e)throw"Message too long for RSA";var n,i="";for(n=0;n0&&e.length>0?(this.n=de(t,16),this.e=parseInt(e,16)):alert("Invalid RSA public key")}function Se(t){return t.modPowInt(this.e,this.n)}function _e(t){var e=pe(t,this.n.bitLength()+7>>3);if(null==e)return null;var r=this.doPublic(e);if(null==r)return null;var n=r.toString(16);return 0==(1&n.length)?n:"0"+n}function Ee(t,e){var r=ye(t,this.n.bitLength()+7>>3,e);if(null==r)return null;var n=this.doPublic(r);if(null==n)return null;var i=n.toString(16);return 0==(1&i.length)?i:"0"+i}function be(t,e){for(var r=t.toByteArray(),n=0;n=r.length)return null;for(var i="";++ns?i+=String.fromCharCode(s):s>191&&224>s?(i+=String.fromCharCode((31&s)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&s)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}function we(t,e,r){for(var n="",i=0;n.length>24,(16711680&i)>>16,(65280&i)>>8,255&i])),i+=1;return n}function Re(t,e,r){t=t.toByteArray();var n;for(n=0;n0&&e.length>0?(this.n=de(t,16),this.e=parseInt(e,16),this.d=de(r,16)):alert("Invalid RSA private key")}function Ae(t,e,r,n,i,s,o,a){if(this.isPrivate=!0,null==t)throw"RSASetPrivateEx N == null";if(null==e)throw"RSASetPrivateEx E == null";if(0==t.length)throw"RSASetPrivateEx N.length == 0";if(0==e.length)throw"RSASetPrivateEx E.length == 0";null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=de(t,16),this.e=parseInt(e,16),this.d=de(r,16),this.p=de(n,16),this.q=de(i,16),this.dmp1=de(s,16),this.dmq1=de(o,16),this.coeff=de(a,16)):alert("Invalid RSA private key in RSASetPrivateEx")}function Fe(t,e){var r=new le,n=t>>1;this.e=parseInt(e,16);for(var i=new o(e,16);;){for(;this.p=new o(t-n,1,r),0!=this.p.subtract(o.ONE).gcd(i).compareTo(o.ONE)||!this.p.isProbablePrime(10););for(;this.q=new o(n,1,r),0!=this.q.subtract(o.ONE).gcd(i).compareTo(o.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var a=this.p.subtract(o.ONE),u=this.q.subtract(o.ONE),h=a.multiply(u);if(0==h.gcd(i).compareTo(o.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(h),this.dmp1=this.d.mod(a),this.dmq1=this.d.mod(u),this.coeff=this.q.modInverse(this.p);break}}}function Ke(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)}function Ue(t){var e=de(t,16),r=this.doPrivate(e);return null==r?null:be(r,this.n.bitLength()+7>>3)}function Oe(t,e){var r=de(t,16),n=this.doPrivate(r);return null==n?null:Re(n,this.n.bitLength()+7>>3,e)}function Pe(t,e){this.x=e,this.q=t}function Ie(t){return t==this?!0:this.q.equals(t.q)&&this.x.equals(t.x)}function De(){return this.x}function Ce(){return new Pe(this.q,this.x.negate().mod(this.q))}function Te(t){return new Pe(this.q,this.x.add(t.toBigInteger()).mod(this.q))}function je(t){return new Pe(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}function Je(t){return new Pe(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}function He(){return new Pe(this.q,this.x.square().mod(this.q))}function Be(t){return new Pe(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}function ke(t,e,r,n){this.curve=t,this.x=e,this.y=r,null==n?this.z=o.ONE:this.z=n,this.zinv=null}function Ne(){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))}function Me(){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))}function Ve(t){if(t==this)return!0;if(this.isInfinity())return t.isInfinity();if(t.isInfinity())return this.isInfinity();var e,r;return e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),e.equals(o.ZERO)?(r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q),r.equals(o.ZERO)):!1}function Le(){return null==this.x&&null==this.y?!0:this.z.equals(o.ZERO)&&!this.y.toBigInteger().equals(o.ZERO)}function qe(){return new ke(this.curve,this.x,this.y.negate(),this.z)}function ze(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(o.ZERO.equals(r))return o.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new o("3"),i=this.x.toBigInteger(),s=this.y.toBigInteger(),a=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),u=a.multiply(r),h=i.multiply(a),c=e.square().multiply(this.z),f=c.subtract(h.shiftLeft(1)).multiply(t.z).subtract(u).multiply(r).mod(this.curve.q),l=h.multiply(n).multiply(e).subtract(s.multiply(u)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(u)).mod(this.curve.q),d=u.multiply(this.z).multiply(t.z).mod(this.curve.q);return new ke(this.curve,this.curve.fromBigInteger(f),this.curve.fromBigInteger(l),d)}function We(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new o("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),s=this.curve.a.toBigInteger(),a=e.square().multiply(t);o.ZERO.equals(s)||(a=a.add(this.z.square().multiply(s))),a=a.mod(this.curve.q);var u=a.square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),h=a.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(a.square().multiply(a)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new ke(this.curve,this.curve.fromBigInteger(u),this.curve.fromBigInteger(h),c)}function Ye(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new o("3")),i=this.negate(),s=this;for(e=n.bitLength()-2;e>0;--e){s=s.twice();var a=n.testBit(e),u=r.testBit(e);a!=u&&(s=s.add(a?this:i))}return s}function Ge(t,e,r){var n;n=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),s=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?i=r.testBit(n)?i.add(s):i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i}function Xe(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new ke(this,null,null)}function $e(){return this.q}function Ze(){return this.a}function Qe(){return this.b}function tr(t){return t==this?!0:this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}function er(){return this.infinity}function rr(t){return new Pe(this.q,t)}function nr(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 o(r,16)),this.fromBigInteger(new o(n,16)));default:return null}}function ir(t){for(var e=new Array,r=0;rn||n>255)throw"integer not in range 0-255";var i=("00"+n.toString(16)).slice(-2);return i}).join("");return e}catch(r){throw"malformed integer array string: "+r}}function Fr(t){var e=t;return e=e.replace("-----BEGIN RSA PRIVATE KEY-----",""),e=e.replace("-----END RSA PRIVATE KEY-----",""),e=e.replace(/[ \n]+/g,"")}function Kr(t){var e=new Array,r=Fn.getStartPosOfV_AtObj(t,0),n=Fn.getPosOfNextSibling_AtObj(t,r),i=Fn.getPosOfNextSibling_AtObj(t,n),s=Fn.getPosOfNextSibling_AtObj(t,i),o=Fn.getPosOfNextSibling_AtObj(t,s),a=Fn.getPosOfNextSibling_AtObj(t,o),u=Fn.getPosOfNextSibling_AtObj(t,a),h=Fn.getPosOfNextSibling_AtObj(t,u),c=Fn.getPosOfNextSibling_AtObj(t,h);return e.push(r,n,i,s,o,a,u,h,c),e}function Ur(t){var e=Kr(t),r=Fn.getHexOfV_AtObj(t,e[0]),n=Fn.getHexOfV_AtObj(t,e[1]),i=Fn.getHexOfV_AtObj(t,e[2]),s=Fn.getHexOfV_AtObj(t,e[3]),o=Fn.getHexOfV_AtObj(t,e[4]),a=Fn.getHexOfV_AtObj(t,e[5]),u=Fn.getHexOfV_AtObj(t,e[6]),h=Fn.getHexOfV_AtObj(t,e[7]),c=Fn.getHexOfV_AtObj(t,e[8]),f=new Array;return f.push(r,n,i,s,o,a,u,h,c),f}function Or(t){var e=Ur(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}function Pr(t){var e=Fr(t),r=i(e),n=Ur(r);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])}function Ir(t,e){for(var r="",n=e/4-t.length,i=0;n>i;i++)r+="0";return r+t}function Dr(t,e){var r=function(t){return KJUR.crypto.Util.hashString(t,e)},n=r(t);return this.signWithMessageHash(n,e)}function Cr(t,e){var r=KJUR.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),n=de(r,16),i=this.doPrivate(n),s=i.toString(16);return Ir(s,this.n.bitLength())}function Tr(t){return Dr.call(this,t,"sha1")}function jr(t){return Dr.call(this,t,"sha256")}function Jr(t,e,r){for(var n="",i=0;n.length>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function Hr(t,e,r){var n=function(t){return KJUR.crypto.Util.hashHex(t,e)},i=n(_r(t));return void 0===r&&(r=-1),this.signWithMessageHashPSS(i,e,r)}function Br(t,e,r){var n,i=Sr(t),s=i.length,a=this.n.bitLength()-1,u=Math.ceil(a/8),h=function(t){return KJUR.crypto.Util.hashHex(t,e)};if(-1===r||void 0===r)r=s;else if(-2===r)r=u-s-2;else if(-2>r)throw"invalid salt length";if(s+r+2>u)throw"data too long";var c="";r>0&&(c=new Array(r),(new le).nextBytes(c),c=String.fromCharCode.apply(String,c));var f=Sr(h(_r("\x00\x00\x00\x00\x00\x00\x00\x00"+i+c))),l=[];for(n=0;u-r-s-2>n;n+=1)l[n]=0;var d=String.fromCharCode.apply(String,l)+""+c,p=Jr(f,d.length,h),g=[];for(n=0;n>8*u-a&255;for(g[0]&=~y,n=0;s>n;n++)g.push(f.charCodeAt(n));return g.push(188),Ir(this.doPrivate(new o(g)).toString(16),this.n.bitLength())}function kr(t,e,r){var n=new ve;n.setPublic(e,r);var i=n.doPublic(t);return i}function Nr(t,e,r){var n=kr(t,e,r),i=n.toString(16).replace(/^1f+00/,"");return i}function Mr(t){for(var e in KJUR.crypto.Util.DIGESTINFOHEAD){var r=KJUR.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r){var i=[e,t.substring(n)];return i}}return[]}function Vr(t,e,r,n){var i=Nr(e,r,n),s=Mr(i);if(0==s.length)return!1;var o=s[0],a=s[1],u=function(t){return KJUR.crypto.Util.hashString(t,o)},h=u(t);return a==h}function Lr(t,e){var r=de(t,16),n=Vr(e,r,this.n.toString(16),this.e.toString(16));return n}function qr(t,e){e=e.replace(Dn,""),e=e.replace(/[ \n]+/g,"");var r=de(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),s=Mr(i);if(0==s.length)return!1;var o=s[0],a=s[1],u=function(t){return KJUR.crypto.Util.hashString(t,o)},h=u(t);return a==h}function zr(t,e){e=e.replace(Dn,""),e=e.replace(/[ \n]+/g,"");var r=de(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=this.doPublic(r),i=n.toString(16).replace(/^1f+00/,""),s=Mr(i);if(0==s.length)return!1;var o=(s[0],s[1]);return o==t}function Wr(t,e,r,n){var i=function(t){return KJUR.crypto.Util.hashHex(t,r)},s=i(_r(t));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(s,e,r,n)}function Yr(t,e,r,n){var i=new o(e,16);if(i.bitLength()>this.n.bitLength())return!1;var s,a=function(t){return KJUR.crypto.Util.hashHex(t,r)},u=Sr(t),h=u.length,c=this.n.bitLength()-1,f=Math.ceil(c/8);if(-1===n||void 0===n)n=h;else if(-2===n)n=f-h-2;else if(-2>n)throw"invalid salt length";if(h+n+2>f)throw"data too long";var l=this.doPublic(i).toByteArray();for(s=0;s>8*f-c&255;if(0!==(d.charCodeAt(0)&g))throw"bits beyond keysize not zero";var y=Jr(p,d.length,a),v=[];for(s=0;ss;s+=1)if(0!==v[s])throw"leftmost octets not zero";if(1!==v[m])throw"0x01 marker not found";return p===Sr(a(_r("\x00\x00\x00\x00\x00\x00\x00\x00"+u+String.fromCharCode.apply(String,v.slice(-n))))); +}function Gr(){this.subjectPublicKeyRSA=null,this.subjectPublicKeyRSA_hN=null,this.subjectPublicKeyRSA_hE=null,this.hex=null,this.getSerialNumberHex=function(){return Fn.getDecendantHexVByNthList(this.hex,0,[0,1])},this.getSignatureAlgorithmField=function(){var t=Fn.getDecendantHexVByNthList(this.hex,0,[0,2,0]),e=KJUR.asn1.ASN1Util.oidHexToInt(t),r=KJUR.asn1.x509.OID.oid2name(e);return r},this.getIssuerHex=function(){return Fn.getDecendantHexTLVByNthList(this.hex,0,[0,3])},this.getIssuerString=function(){return Gr.hex2dn(Fn.getDecendantHexTLVByNthList(this.hex,0,[0,3]))},this.getSubjectHex=function(){return Fn.getDecendantHexTLVByNthList(this.hex,0,[0,5])},this.getSubjectString=function(){return Gr.hex2dn(Fn.getDecendantHexTLVByNthList(this.hex,0,[0,5]))},this.getNotBefore=function(){var t=Fn.getDecendantHexVByNthList(this.hex,0,[0,4,0]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=Fn.getDecendantHexVByNthList(this.hex,0,[0,4,1]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.readCertPEM=function(t){var e=Gr.pemToHex(t),r=Gr.getPublicKeyHexArrayFromCertHex(e),n=new ve;n.setPublic(r[0],r[1]),this.subjectPublicKeyRSA=n,this.subjectPublicKeyRSA_hN=r[0],this.subjectPublicKeyRSA_hE=r[1],this.hex=e},this.readCertPEMWithoutRSAInit=function(t){var e=Gr.pemToHex(t),r=Gr.getPublicKeyHexArrayFromCertHex(e);this.subjectPublicKeyRSA.setPublic(r[0],r[1]),this.subjectPublicKeyRSA_hN=r[0],this.subjectPublicKeyRSA_hE=r[1],this.hex=e},this.getInfo=function(){var t="Basic Fields\n";t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n";var e=Gr.getSubjectPublicKeyInfoPosFromCertHex(this.hex),r=Fn.getHexOfTLV_AtObj(this.hex,e),n=In.getKey(r,null,"pkcs8pub");n instanceof ve&&(t+=" key algorithm: RSA\n",t+=" n="+n.n.toString(16).substr(0,16)+"...\n",t+=" e="+n.e.toString(16)+"\n"),t+="X509v3 Extensions:\n";for(var i=Gr.getV3ExtInfoListOfCertHex(this.hex),s=0;s":">",'"':""","'":"'","/":"/","`":"`"},a=["toString","valueOf"],u={isArray:function(t){return e.toString.apply(t)===r},isBoolean:function(t){return"boolean"==typeof t},isFunction:function(t){return"function"==typeof t||e.toString.apply(t)===n},isNull:function(t){return null===t},isNumber:function(t){return"number"==typeof t&&isFinite(t)},isObject:function(e){return e&&("object"==typeof e||t.isFunction(e))||!1},isString:function(t){return"string"==typeof t},isUndefined:function(t){return"undefined"==typeof t},_IEEnumFix:nn.env.ua.ie?function(r,n){var i,s,o;for(i=0;i"'\/`]/g,function(t){return o[t]})},extend:function(r,n,i){if(!n||!r)throw new Error("extend failed, please check that all dependencies are included.");var s,o=function(){};if(o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r,r.superclass=n.prototype,n.prototype.constructor==e.constructor&&(n.prototype.constructor=n),i){for(s in i)t.hasOwnProperty(i,s)&&(r.prototype[s]=i[s]);t._IEEnumFix(r.prototype,i)}},augmentObject:function(e,r){if(!r||!e)throw new Error("Absorb failed, verify dependencies.");var n,i,s=arguments,o=s[2];if(o&&o!==!0)for(n=2;nn;n+=1)t.isObject(e[n])?s.push(r>0?t.dump(e[n],r-1):o):s.push(e[n]),s.push(u);s.length>1&&s.pop(),s.push("]")}else{s.push("{");for(n in e)t.hasOwnProperty(e,n)&&(s.push(n+h),t.isObject(e[n])?s.push(r>0?t.dump(e[n],r-1):o):s.push(e[n]),s.push(u));s.length>1&&s.pop(),s.push("}")}return s.join("")},substitute:function(e,r,n,s){for(var o,a,u,h,c,f,l,d,p,g=[],y=e.length,v="dump",m=" ",S="{",_="}";o=e.lastIndexOf(S,y),!(0>o||(a=e.indexOf(_,o),o+1>a));)l=e.substring(o+1,a),h=l,f=null,u=h.indexOf(m),u>-1&&(f=h.substring(u+1),h=h.substring(0,u)),c=r[h],n&&(c=n(h,c,f)),t.isObject(c)?t.isArray(c)?c=t.dump(c,parseInt(f,10)):(f=f||"",d=f.indexOf(v),d>-1&&(f=f.substring(4)),p=c.toString(),c=p===i||d>-1?t.dump(c,parseInt(f,10)):p):t.isString(c)||t.isNumber(c)||(c="~-"+g.length+"-~",g[g.length]=l),e=e.substring(0,o)+c+e.substring(a+1),s===!1&&(y=o-1);for(o=g.length-1;o>=0;o-=1)e=e.replace(new RegExp("~-"+o+"-~"),"{"+g[o]+"}","g");return e},trim:function(t){try{return t.replace(/^\s+|\s+$/g,"")}catch(e){return t}},merge:function(){var e,r={},n=arguments,i=n.length;for(e=0;i>e;e+=1)t.augmentObject(r,n[e],!0);return r},later:function(e,r,n,i,o){e=e||0,r=r||{};var a,u,h=n,c=i;if(t.isString(n)&&(h=r[n]),!h)throw new TypeError("method undefined");return t.isUndefined(i)||t.isArray(c)||(c=[i]),a=function(){h.apply(r,c||s)},u=o?setInterval(a,e):setTimeout(a,e),{interval:o,cancel:function(){this.interval?clearInterval(u):clearTimeout(u)}}},isValue:function(e){return t.isObject(e)||t.isString(e)||t.isNumber(e)||t.isBoolean(e)}};t.hasOwnProperty=e.hasOwnProperty?function(t,e){return t&&t.hasOwnProperty&&t.hasOwnProperty(e)}:function(e,r){return!t.isUndefined(e[r])&&e.constructor.prototype[r]!==e[r]},u.augmentObject(t,u,!0),nn.util.Lang=t,t.augment=t.augmentProto,nn.augment=t.augmentProto,nn.extend=t.extend}(),nn.register("yahoo",nn,{version:"2.9.0",build:"2800"});var sn=sn||function(t,e){var r={},n=r.lib={},i=n.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var r=new t;return e&&r.mixIn(e),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=n.WordArray=i.extend({init:function(t,r){t=this.words=t||[],r!=e?this.sigBytes=r:this.sigBytes=4*t.length},toString:function(t){return(t||a).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var s=0;i>s;s++){var o=r[s>>>2]>>>24-s%4*8&255;e[n+s>>>2]|=o<<24-(n+s)%4*8}else for(var s=0;i>s;s+=4)e[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r=[],n=0;e>n;n+=4)r.push(4294967296*t.random()|0);return new s.init(r,e)}}),o=r.enc={},a=o.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;r>i;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;e>n;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new s.init(r,e/2)}},u=o.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;r>i;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;e>n;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new s.init(r,e)}},h=o.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},c=n.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=h.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,i=r.sigBytes,o=this.blockSize,a=4*o,u=i/a;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var h=u*o,c=t.min(4*h,i);if(h){for(var f=0;h>f;f+=o)this._doProcessBlock(n,f);var l=n.splice(0,h);r.sigBytes-=c}return new s.init(l,c)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(n.Hasher=c.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){c.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new f.HMAC.init(t,r).finalize(e)}}}),r.algo={});return r}(Math);!function(t){var e=sn,r=e.lib,n=r.Base,i=r.WordArray,e=e.x64={};e.Word=n.extend({init:function(t,e){this.high=t,this.low=e}}),e.WordArray=n.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var t=this.words,e=t.length,r=[],n=0;e>n;n++){var s=t[n];r.push(s.high),r.push(s.low)}return i.create(r,this.sigBytes)},clone:function(){for(var t=n.clone.call(this),e=t.words=this.words.slice(0),r=e.length,i=0;r>i;i++)e[i]=e[i].clone();return t}})}(),sn.lib.Cipher||function(t){var e=sn,r=e.lib,n=r.Base,i=r.WordArray,s=r.BufferedBlockAlgorithm,o=e.enc.Base64,a=e.algo.EvpKDF,u=r.Cipher=s.extend({cfg:n.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(t){return{encrypt:function(e,r,n){return("string"==typeof r?p:d).encrypt(t,e,r,n)},decrypt:function(e,r,n){return("string"==typeof r?p:d).decrypt(t,e,r,n)}}}});r.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=e.mode={},c=function(e,r,n){var i=this._iv;i?this._iv=t:i=this._prevBlock;for(var s=0;n>s;s++)e[r+s]^=i[s]},f=(r.BlockCipherMode=n.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}})).extend();f.Encryptor=f.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize;c.call(this,t,e,n),r.encryptBlock(t,e),this._prevBlock=t.slice(e,e+n)}}),f.Decryptor=f.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=t.slice(e,e+n);r.decryptBlock(t,e),c.call(this,t,e,n),this._prevBlock=i}}),h=h.CBC=f,f=(e.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,r=r-t.sigBytes%r,n=r<<24|r<<16|r<<8|r,s=[],o=0;r>o;o+=4)s.push(n);r=i.create(s,r),t.concat(r)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}},r.BlockCipher=u.extend({cfg:u.cfg.extend({mode:h,padding:f}),reset:function(){u.reset.call(this);var t=this.cfg,e=t.iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=t.createEncryptor;else r=t.createDecryptor,this._minBufferSize=1;this._mode=r.call(t,this,e&&e.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var l=r.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),h=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext;return t=t.salt,(t?i.create([1398893684,1701076831]).concat(t).concat(e):e).toString(o)},parse:function(t){t=o.parse(t);var e=t.words;if(1398893684==e[0]&&1701076831==e[1]){var r=i.create(e.slice(2,4));e.splice(0,4),t.sigBytes-=16}return l.create({ciphertext:t,salt:r})}},d=r.SerializableCipher=n.extend({cfg:n.extend({format:h}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n);return e=i.finalize(e),i=i.cfg,l.create({ciphertext:e,key:r,iv:i.iv,algorithm:t,mode:i.mode,padding:i.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),e=(e.kdf={}).OpenSSL={execute:function(t,e,r,n){return n||(n=i.random(8)),t=a.create({keySize:e+r}).compute(t,n),r=i.create(t.words.slice(e),4*r),t.sigBytes=4*e,l.create({key:t,iv:r,salt:n})}},p=r.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:e}),encrypt:function(t,e,r,n){return n=this.cfg.extend(n),r=n.kdf.execute(r,t.keySize,t.ivSize),n.iv=r.iv,t=d.encrypt.call(this,t,e,r.key,n),t.mixIn(r),t},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),r=n.kdf.execute(r,t.keySize,t.ivSize,e.salt),n.iv=r.iv,d.decrypt.call(this,t,e,r.key,n)}})}(),function(){for(var t=sn,e=t.lib.BlockCipher,r=t.algo,n=[],i=[],s=[],o=[],a=[],u=[],h=[],c=[],f=[],l=[],d=[],p=0;256>p;p++)d[p]=128>p?p<<1:p<<1^283;for(var g=0,y=0,p=0;256>p;p++){var v=y^y<<1^y<<2^y<<3^y<<4,v=v>>>8^255&v^99;n[g]=v,i[v]=g;var m=d[g],S=d[m],_=d[S],E=257*d[v]^16843008*v;s[g]=E<<24|E>>>8,o[g]=E<<16|E>>>16,a[g]=E<<8|E>>>24,u[g]=E,E=16843009*_^65537*S^257*m^16843008*g,h[v]=E<<24|E>>>8,c[v]=E<<16|E>>>16,f[v]=E<<8|E>>>24,l[v]=E,g?(g=m^d[d[d[_^m]]],y^=d[d[y]]):g=y=1}var b=[0,1,2,4,8,16,32,64,128,27,54],r=r.AES=e.extend({_doReset:function(){for(var t=this._key,e=t.words,r=t.sigBytes/4,t=4*((this._nRounds=r+6)+1),i=this._keySchedule=[],s=0;t>s;s++)if(r>s)i[s]=e[s];else{var o=i[s-1];s%r?r>6&&4==s%r&&(o=n[o>>>24]<<24|n[o>>>16&255]<<16|n[o>>>8&255]<<8|n[255&o]):(o=o<<8|o>>>24,o=n[o>>>24]<<24|n[o>>>16&255]<<16|n[o>>>8&255]<<8|n[255&o],o^=b[s/r|0]<<24),i[s]=i[s-r]^o}for(e=this._invKeySchedule=[],r=0;t>r;r++)s=t-r,o=r%4?i[s]:i[s-4],e[r]=4>r||4>=s?o:h[n[o>>>24]]^c[n[o>>>16&255]]^f[n[o>>>8&255]]^l[n[255&o]]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,o,a,u,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,h,c,f,l,i),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,n,i,s,o,a){for(var u=this._nRounds,h=t[e]^r[0],c=t[e+1]^r[1],f=t[e+2]^r[2],l=t[e+3]^r[3],d=4,p=1;u>p;p++)var g=n[h>>>24]^i[c>>>16&255]^s[f>>>8&255]^o[255&l]^r[d++],y=n[c>>>24]^i[f>>>16&255]^s[l>>>8&255]^o[255&h]^r[d++],v=n[f>>>24]^i[l>>>16&255]^s[h>>>8&255]^o[255&c]^r[d++],l=n[l>>>24]^i[h>>>16&255]^s[c>>>8&255]^o[255&f]^r[d++],h=g,c=y,f=v;g=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[f>>>8&255]<<8|a[255&l])^r[d++],y=(a[c>>>24]<<24|a[f>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^r[d++],v=(a[f>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^r[d++],l=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&f])^r[d++],t[e]=g,t[e+1]=y,t[e+2]=v,t[e+3]=l},keySize:8});t.AES=e._createHelper(r)}(),function(){function t(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<r;r++){var n=o[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(t=this._subKeys=[],n=0;16>n;n++){for(var i=t[n]=[],s=u[n],r=0;24>r;r++)i[r/6|0]|=e[(a[r]-1+s)%28]<<31-r%6,i[4+(r/6|0)]|=e[28+(a[r+24]-1+s)%28]<<31-r%6;for(i[0]=i[0]<<1|i[0]>>>31,r=1;7>r;r++)i[r]>>>=4*(r-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(e=this._invSubKeys=[],r=0;16>r;r++)e[r]=t[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(r,n,i){this._lBlock=r[n],this._rBlock=r[n+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var s=0;16>s;s++){for(var o=i[s],a=this._lBlock,u=this._rBlock,f=0,l=0;8>l;l++)f|=h[l][((u^o[l])&c[l])>>>0];this._lBlock=u,this._rBlock=a^f}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,t.call(this,1,1431655765),e.call(this,8,16711935),e.call(this,2,858993459),t.call(this,16,65535),t.call(this,4,252645135),r[n]=this._lBlock,r[n+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=n._createHelper(f),s=s.TripleDES=n.extend({_doReset:function(){var t=this._key.words;this._des1=f.createEncryptor(i.create(t.slice(0,2))),this._des2=f.createEncryptor(i.create(t.slice(2,4))),this._des3=f.createEncryptor(i.create(t.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=n._createHelper(s)}(),function(){var t=sn,e=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp(),t=[];for(var i=0;r>i;i+=3)for(var s=(e[i>>>2]>>>24-8*(i%4)&255)<<16|(e[i+1>>>2]>>>24-8*((i+1)%4)&255)<<8|e[i+2>>>2]>>>24-8*((i+2)%4)&255,o=0;4>o&&r>i+.75*o;o++)t.push(n.charAt(s>>>6*(3-o)&63));if(e=n.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var r=t.length,n=this._map,i=n.charAt(64);i&&(i=t.indexOf(i),-1!=i&&(r=i));for(var i=[],s=0,o=0;r>o;o++)if(o%4){var a=n.indexOf(t.charAt(o-1))<<2*(o%4),u=n.indexOf(t.charAt(o))>>>6-2*(o%4);i[s>>>2]|=(a|u)<<24-8*(s%4),s++}return e.create(i,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){function e(t,e,r,n,i,s,o){return t=t+(e&r|~e&n)+i+o,(t<>>32-s)+e}function r(t,e,r,n,i,s,o){return t=t+(e&n|r&~n)+i+o,(t<>>32-s)+e}function n(t,e,r,n,i,s,o){return t=t+(e^r^n)+i+o,(t<>>32-s)+e}function i(t,e,r,n,i,s,o){return t=t+(r^(e|~n))+i+o,(t<>>32-s)+e}for(var s=sn,o=s.lib,a=o.WordArray,u=o.Hasher,o=s.algo,h=[],c=0;64>c;c++)h[c]=4294967296*t.abs(t.sin(c+1))|0;o=o.MD5=u.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,s){for(var o=0;16>o;o++){var a=s+o,u=t[a];t[a]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}var o=this._hash.words,a=t[s+0],u=t[s+1],c=t[s+2],f=t[s+3],l=t[s+4],d=t[s+5],p=t[s+6],g=t[s+7],y=t[s+8],v=t[s+9],m=t[s+10],S=t[s+11],_=t[s+12],E=t[s+13],b=t[s+14],w=t[s+15],R=o[0],x=o[1],A=o[2],F=o[3],R=e(R,x,A,F,a,7,h[0]),F=e(F,R,x,A,u,12,h[1]),A=e(A,F,R,x,c,17,h[2]),x=e(x,A,F,R,f,22,h[3]),R=e(R,x,A,F,l,7,h[4]),F=e(F,R,x,A,d,12,h[5]),A=e(A,F,R,x,p,17,h[6]),x=e(x,A,F,R,g,22,h[7]),R=e(R,x,A,F,y,7,h[8]),F=e(F,R,x,A,v,12,h[9]),A=e(A,F,R,x,m,17,h[10]),x=e(x,A,F,R,S,22,h[11]),R=e(R,x,A,F,_,7,h[12]),F=e(F,R,x,A,E,12,h[13]),A=e(A,F,R,x,b,17,h[14]),x=e(x,A,F,R,w,22,h[15]),R=r(R,x,A,F,u,5,h[16]),F=r(F,R,x,A,p,9,h[17]),A=r(A,F,R,x,S,14,h[18]),x=r(x,A,F,R,a,20,h[19]),R=r(R,x,A,F,d,5,h[20]),F=r(F,R,x,A,m,9,h[21]),A=r(A,F,R,x,w,14,h[22]),x=r(x,A,F,R,l,20,h[23]),R=r(R,x,A,F,v,5,h[24]),F=r(F,R,x,A,b,9,h[25]),A=r(A,F,R,x,f,14,h[26]),x=r(x,A,F,R,y,20,h[27]),R=r(R,x,A,F,E,5,h[28]),F=r(F,R,x,A,c,9,h[29]),A=r(A,F,R,x,g,14,h[30]),x=r(x,A,F,R,_,20,h[31]),R=n(R,x,A,F,d,4,h[32]),F=n(F,R,x,A,y,11,h[33]),A=n(A,F,R,x,S,16,h[34]),x=n(x,A,F,R,b,23,h[35]),R=n(R,x,A,F,u,4,h[36]),F=n(F,R,x,A,l,11,h[37]),A=n(A,F,R,x,g,16,h[38]),x=n(x,A,F,R,m,23,h[39]),R=n(R,x,A,F,E,4,h[40]),F=n(F,R,x,A,a,11,h[41]),A=n(A,F,R,x,f,16,h[42]),x=n(x,A,F,R,p,23,h[43]),R=n(R,x,A,F,v,4,h[44]),F=n(F,R,x,A,_,11,h[45]),A=n(A,F,R,x,w,16,h[46]),x=n(x,A,F,R,c,23,h[47]),R=i(R,x,A,F,a,6,h[48]),F=i(F,R,x,A,g,10,h[49]),A=i(A,F,R,x,b,15,h[50]),x=i(x,A,F,R,d,21,h[51]),R=i(R,x,A,F,_,6,h[52]),F=i(F,R,x,A,f,10,h[53]),A=i(A,F,R,x,m,15,h[54]),x=i(x,A,F,R,u,21,h[55]),R=i(R,x,A,F,y,6,h[56]),F=i(F,R,x,A,w,10,h[57]),A=i(A,F,R,x,p,15,h[58]),x=i(x,A,F,R,E,21,h[59]),R=i(R,x,A,F,l,6,h[60]),F=i(F,R,x,A,S,10,h[61]),A=i(A,F,R,x,c,15,h[62]),x=i(x,A,F,R,v,21,h[63]); +o[0]=o[0]+R|0,o[1]=o[1]+x|0,o[2]=o[2]+A|0,o[3]=o[3]+F|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var s=t.floor(n/4294967296);for(r[(i+64>>>9<<4)+15]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[(i+64>>>9<<4)+14]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(r.length+1),this._process(),e=this._hash,r=e.words,n=0;4>n;n++)i=r[n],r[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return e},clone:function(){var t=u.clone.call(this);return t._hash=this._hash.clone(),t}}),s.MD5=u._createHelper(o),s.HmacMD5=u._createHmacHelper(o)}(Math),function(){var t=sn,e=t.lib,r=e.WordArray,n=e.Hasher,i=[],e=t.algo.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],s=r[1],o=r[2],a=r[3],u=r[4],h=0;80>h;h++){if(16>h)i[h]=0|t[e+h];else{var c=i[h-3]^i[h-8]^i[h-14]^i[h-16];i[h]=c<<1|c>>>31}c=(n<<5|n>>>27)+u+i[h],c=20>h?c+((s&o|~s&a)+1518500249):40>h?c+((s^o^a)+1859775393):60>h?c+((s&o|s&a|o&a)-1894007588):c+((s^o^a)-899497514),u=a,a=o,o=s<<30|s>>>2,s=n,n=c}r[0]=r[0]+n|0,r[1]=r[1]+s|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[(n+64>>>9<<4)+14]=Math.floor(r/4294967296),e[(n+64>>>9<<4)+15]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});t.SHA1=n._createHelper(e),t.HmacSHA1=n._createHmacHelper(e)}(),function(t){for(var e=sn,r=e.lib,n=r.WordArray,i=r.Hasher,r=e.algo,s=[],o=[],a=function(t){return 4294967296*(t-(0|t))|0},u=2,h=0;64>h;){var c;t:{c=u;for(var f=t.sqrt(c),l=2;f>=l;l++)if(!(c%l)){c=!1;break t}c=!0}c&&(8>h&&(s[h]=a(t.pow(u,.5))),o[h]=a(t.pow(u,1/3)),h++),u++}var d=[],r=r.SHA256=i.extend({_doReset:function(){this._hash=new n.init(s.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],u=r[4],h=r[5],c=r[6],f=r[7],l=0;64>l;l++){if(16>l)d[l]=0|t[e+l];else{var p=d[l-15],g=d[l-2];d[l]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+d[l-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+d[l-16]}p=f+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&h^~u&c)+o[l]+d[l],g=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&s^i&s),f=c,c=h,h=u,u=a+p|0,a=s,s=i,i=n,n=p+g|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+u|0,r[5]=r[5]+h|0,r[6]=r[6]+c|0,r[7]=r[7]+f|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[(i+64>>>9<<4)+14]=t.floor(n/4294967296),r[(i+64>>>9<<4)+15]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(r),e.HmacSHA256=i._createHmacHelper(r)}(Math),function(){var t=sn,e=t.lib.WordArray,r=t.algo,n=r.SHA256,r=r.SHA224=n.extend({_doReset:function(){this._hash=new e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=4,t}});t.SHA224=n._createHelper(r),t.HmacSHA224=n._createHmacHelper(r)}(),function(){function t(){return i.create.apply(i,arguments)}for(var e=sn,r=e.lib.Hasher,n=e.x64,i=n.Word,s=n.WordArray,n=e.algo,o=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],a=[],u=0;80>u;u++)a[u]=t();n=n.SHA512=r.extend({_doReset:function(){this._hash=new s.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],u=r[3],h=r[4],c=r[5],f=r[6],r=r[7],l=n.high,d=n.low,p=i.high,g=i.low,y=s.high,v=s.low,m=u.high,S=u.low,_=h.high,E=h.low,b=c.high,w=c.low,R=f.high,x=f.low,A=r.high,F=r.low,K=l,U=d,O=p,P=g,I=y,D=v,C=m,T=S,j=_,J=E,H=b,B=w,k=R,N=x,M=A,V=F,L=0;80>L;L++){var q=a[L];if(16>L)var z=q.high=0|t[e+2*L],W=q.low=0|t[e+2*L+1];else{var z=a[L-15],W=z.high,Y=z.low,z=(W>>>1|Y<<31)^(W>>>8|Y<<24)^W>>>7,Y=(Y>>>1|W<<31)^(Y>>>8|W<<24)^(Y>>>7|W<<25),G=a[L-2],W=G.high,X=G.low,G=(W>>>19|X<<13)^(W<<3|X>>>29)^W>>>6,X=(X>>>19|W<<13)^(X<<3|W>>>29)^(X>>>6|W<<26),W=a[L-7],$=W.high,Z=a[L-16],Q=Z.high,Z=Z.low,W=Y+W.low,z=z+$+(Y>>>0>W>>>0?1:0),W=W+X,z=z+G+(X>>>0>W>>>0?1:0),W=W+Z,z=z+Q+(Z>>>0>W>>>0?1:0);q.high=z,q.low=W}var $=j&H^~j&k,Z=J&B^~J&N,q=K&O^K&I^O&I,tt=U&P^U&D^P&D,Y=(K>>>28|U<<4)^(K<<30|U>>>2)^(K<<25|U>>>7),G=(U>>>28|K<<4)^(U<<30|K>>>2)^(U<<25|K>>>7),X=o[L],et=X.high,rt=X.low,X=V+((J>>>14|j<<18)^(J>>>18|j<<14)^(J<<23|j>>>9)),Q=M+((j>>>14|J<<18)^(j>>>18|J<<14)^(j<<23|J>>>9))+(V>>>0>X>>>0?1:0),X=X+Z,Q=Q+$+(Z>>>0>X>>>0?1:0),X=X+rt,Q=Q+et+(rt>>>0>X>>>0?1:0),X=X+W,Q=Q+z+(W>>>0>X>>>0?1:0),W=G+tt,q=Y+q+(G>>>0>W>>>0?1:0),M=k,V=N,k=H,N=B,H=j,B=J,J=T+X|0,j=C+Q+(T>>>0>J>>>0?1:0)|0,C=I,T=D,I=O,D=P,O=K,P=U,U=X+W|0,K=Q+q+(X>>>0>U>>>0?1:0)|0}d=n.low=d+U,n.high=l+K+(U>>>0>d>>>0?1:0),g=i.low=g+P,i.high=p+O+(P>>>0>g>>>0?1:0),v=s.low=v+D,s.high=y+I+(D>>>0>v>>>0?1:0),S=u.low=S+T,u.high=m+C+(T>>>0>S>>>0?1:0),E=h.low=E+J,h.high=_+j+(J>>>0>E>>>0?1:0),w=c.low=w+B,c.high=b+H+(B>>>0>w>>>0?1:0),x=f.low=x+N,f.high=R+k+(N>>>0>x>>>0?1:0),F=r.low=F+V,r.high=A+M+(V>>>0>F>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[(n+128>>>10<<5)+30]=Math.floor(r/4294967296),e[(n+128>>>10<<5)+31]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32}),e.SHA512=r._createHelper(n),e.HmacSHA512=r._createHmacHelper(n)}(),function(){var t=sn,e=t.x64,r=e.Word,n=e.WordArray,e=t.algo,i=e.SHA512,e=e.SHA384=i.extend({_doReset:function(){this._hash=new n.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var t=i._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=i._createHelper(e),t.HmacSHA384=i._createHmacHelper(e)}(),function(){var t=sn,e=t.lib,r=e.WordArray,n=e.Hasher,e=t.algo,i=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),o=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),a=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=r.create([0,1518500249,1859775393,2400959708,2840853838]),h=r.create([1352829926,1548603684,1836072691,2053994217,0]),e=e.RIPEMD160=n.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;16>r;r++){var n=e+r,c=t[n];t[n]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}var f,l,d,p,g,y,v,m,S,_,n=this._hash.words,c=u.words,E=h.words,b=i.words,w=s.words,R=o.words,x=a.words;y=f=n[0],v=l=n[1],m=d=n[2],S=p=n[3],_=g=n[4];for(var A,r=0;80>r;r+=1)A=f+t[e+b[r]]|0,A=16>r?A+((l^d^p)+c[0]):32>r?A+((l&d|~l&p)+c[1]):48>r?A+(((l|~d)^p)+c[2]):64>r?A+((l&p|d&~p)+c[3]):A+((l^(d|~p))+c[4]),A|=0,A=A<>>32-R[r],A=A+g|0,f=g,g=p,p=d<<10|d>>>22,d=l,l=A,A=y+t[e+w[r]]|0,A=16>r?A+((v^(m|~S))+E[0]):32>r?A+((v&S|m&~S)+E[1]):48>r?A+(((v|~m)^S)+E[2]):64>r?A+((v&m|~v&S)+E[3]):A+((v^m^S)+E[4]),A|=0,A=A<>>32-x[r],A=A+_|0,y=_,_=S,S=m<<10|m>>>22,m=v,v=A;A=n[1]+d+S|0,n[1]=n[2]+p+_|0,n[2]=n[3]+g+y|0,n[3]=n[4]+f+v|0,n[4]=n[0]+l+m|0,n[0]=A},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;for(e[n>>>5]|=128<<24-n%32,e[(n+64>>>9<<4)+14]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process(),t=this._hash,e=t.words,r=0;5>r;r++)n=e[r],e[r]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8);return t},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});t.RIPEMD160=n._createHelper(e),t.HmacRIPEMD160=n._createHmacHelper(e)}(Math),function(){var t=sn,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(t,r){t=this._hasher=new t.init,"string"==typeof r&&(r=e.parse(r));var n=t.blockSize,i=4*n;r.sigBytes>i&&(r=t.finalize(r)),r.clamp();for(var s=this._oKey=r.clone(),o=this._iKey=r.clone(),a=s.words,u=o.words,h=0;n>h;h++)a[h]^=1549556828,u[h]^=909522486;s.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher;return t=e.finalize(t),e.reset(),e.finalize(this._oKey.clone().concat(t))}})}(),function(){var t=sn,e=t.lib,r=e.Base,n=e.WordArray,e=t.algo,i=e.HMAC,s=e.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:e.SHA1,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r=this.cfg,s=i.create(r.hasher,t),o=n.create(),a=n.create([1]),u=o.words,h=a.words,c=r.keySize,r=r.iterations;u.lengthg;g++){p=s.finalize(p),s.reset();for(var y=p.words,v=0;d>v;v++)l[v]^=y[v]}o.concat(f),h[0]++}return o.sigBytes=4*c,o}});t.PBKDF2=function(t,e,r){return s.create(r).compute(t,e)}}();var on,an="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",un="=",hn=0xdeadbeefcafe,cn=15715070==(16777215&hn);cn&&"Microsoft Internet Explorer"==en.appName?(o.prototype.am=h,on=30):cn&&"Netscape"!=en.appName?(o.prototype.am=u,on=26):(o.prototype.am=c,on=28),o.prototype.DB=on,o.prototype.DM=(1<=dn;++dn)gn[ln++]=dn;for(ln="a".charCodeAt(0),dn=10;36>dn;++dn)gn[ln++]=dn;for(ln="A".charCodeAt(0),dn=10;36>dn;++dn)gn[ln++]=dn;D.prototype.convert=C,D.prototype.revert=T,D.prototype.reduce=j,D.prototype.mulTo=J,D.prototype.sqrTo=H,k.prototype.convert=N,k.prototype.revert=M,k.prototype.reduce=V,k.prototype.mulTo=q,k.prototype.sqrTo=L,o.prototype.copyTo=d,o.prototype.fromInt=p,o.prototype.fromString=y,o.prototype.clamp=v,o.prototype.dlShiftTo=R,o.prototype.drShiftTo=x,o.prototype.lShiftTo=A,o.prototype.rShiftTo=F,o.prototype.subTo=K,o.prototype.multiplyTo=U,o.prototype.squareTo=O,o.prototype.divRemTo=P,o.prototype.invDigit=B,o.prototype.isEven=z,o.prototype.exp=W,o.prototype.toString=m,o.prototype.negate=S,o.prototype.abs=_,o.prototype.compareTo=E,o.prototype.bitLength=w,o.prototype.mod=I,o.prototype.modPowInt=Y,o.ZERO=g(0),o.ONE=g(1),Bt.prototype.convert=kt,Bt.prototype.revert=kt,Bt.prototype.mulTo=Nt,Bt.prototype.sqrTo=Mt,zt.prototype.convert=Wt,zt.prototype.revert=Yt,zt.prototype.reduce=Gt,zt.prototype.mulTo=$t,zt.prototype.sqrTo=Xt;var yn=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],vn=(1<<26)/yn[yn.length-1];o.prototype.chunkSize=Q,o.prototype.toRadix=et,o.prototype.fromRadix=rt,o.prototype.fromNumber=nt,o.prototype.bitwiseTo=ut,o.prototype.changeBit=xt,o.prototype.addTo=Ut,o.prototype.dMultiply=Jt,o.prototype.dAddOffset=Ht,o.prototype.multiplyLowerTo=Lt,o.prototype.multiplyUpperTo=qt,o.prototype.modInt=te,o.prototype.millerRabin=ne,o.prototype.clone=G,o.prototype.intValue=X,o.prototype.byteValue=$,o.prototype.shortValue=Z,o.prototype.signum=tt,o.prototype.toByteArray=it,o.prototype.equals=st,o.prototype.min=ot,o.prototype.max=at,o.prototype.and=ct,o.prototype.or=lt,o.prototype.xor=pt,o.prototype.andNot=yt,o.prototype.not=vt,o.prototype.shiftLeft=mt,o.prototype.shiftRight=St,o.prototype.getLowestSetBit=Et,o.prototype.bitCount=wt,o.prototype.testBit=Rt,o.prototype.setBit=At,o.prototype.clearBit=Ft,o.prototype.flipBit=Kt,o.prototype.add=Ot,o.prototype.subtract=Pt,o.prototype.multiply=It,o.prototype.divide=Ct,o.prototype.remainder=Tt,o.prototype.divideAndRemainder=jt,o.prototype.modPow=Zt,o.prototype.modInverse=ee,o.prototype.pow=Vt,o.prototype.gcd=Qt,o.prototype.isProbablePrime=re,o.prototype.square=Dt,ie.prototype.init=se,ie.prototype.next=oe;var mn,Sn,_n,En=256;if(null==Sn){Sn=new Array,_n=0;var bn;if(rn.crypto&&rn.crypto.getRandomValues){var wn=new Uint8Array(32);for(rn.crypto.getRandomValues(wn),bn=0;32>bn;++bn)Sn[_n++]=wn[bn]}if("Netscape"==en.appName&&en.appVersion<"5"&&rn.crypto){var Rn=rn.crypto.random(32);for(bn=0;bn_n;)bn=Math.floor(65536*Math.random()),Sn[_n++]=bn>>>8,Sn[_n++]=255&bn;_n=0,he()}le.prototype.nextBytes=fe;var xn=20;ve.prototype.doPublic=Se,ve.prototype.setPublic=me,ve.prototype.encrypt=_e,ve.prototype.encryptOAEP=Ee,ve.prototype.type="RSA";var xn=20;ve.prototype.doPrivate=Ke,ve.prototype.setPrivate=xe,ve.prototype.setPrivateEx=Ae,ve.prototype.generate=Fe,ve.prototype.decrypt=Ue,ve.prototype.decryptOAEP=Oe,Pe.prototype.equals=Ie,Pe.prototype.toBigInteger=De,Pe.prototype.negate=Ce,Pe.prototype.add=Te,Pe.prototype.subtract=je,Pe.prototype.multiply=Je,Pe.prototype.square=He,Pe.prototype.divide=Be,ke.prototype.getX=Ne,ke.prototype.getY=Me,ke.prototype.equals=Ve,ke.prototype.isInfinity=Le,ke.prototype.negate=qe,ke.prototype.add=ze,ke.prototype.twice=We,ke.prototype.multiply=Ye,ke.prototype.multiplyTwo=Ge,Xe.prototype.getQ=$e,Xe.prototype.getA=Ze,Xe.prototype.getB=Qe,Xe.prototype.equals=tr,Xe.prototype.getInfinity=er,Xe.prototype.fromBigInteger=rr,Xe.prototype.decodePointHex=nr,Pe.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ke.prototype.getEncoded=function(t){var e=function(t,e){var r=t.toByteArrayUnsigned();if(er.length;)r.unshift(0);return r},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i},ke.decodeFrom=function(t,e){var r=(e[0],e.length-1),n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var s=new o(n),a=new o(i);return new ke(t,t.fromBigInteger(s),t.fromBigInteger(a))},ke.decodeFromHex=function(t,e){var r=(e.substr(0,2),e.length-2),n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),s=new o(n,16),a=new o(i,16);return new ke(t,t.fromBigInteger(s),t.fromBigInteger(a))},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),n=r.divide(e),i=n.square().subtract(this.x).subtract(t.x),s=n.multiply(this.x.subtract(i)).subtract(this.y);return new ke(this.curve,i,s)},ke.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(o.valueOf(2)),e=this.curve.fromBigInteger(o.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 o("3")),i=this.negate(),s=this;for(e=n.bitLength()-2;e>0;--e){s=s.twice();var a=n.testBit(e),u=r.testBit(e);a!=u&&(s=s.add2D(a?this:i))}return s},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(),s=e.multiply(e).mod(i),o=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return s.equals(o)},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(o.ONE)<0||e.compareTo(t.subtract(o.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(o.ONE)<0||r.compareTo(t.subtract(o.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};var An=function(){function t(t,e,r){return e?o[e]:String.fromCharCode(parseInt(r,16))}var e="(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)",r='(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))',n='(?:"'+r+'*")',i=new RegExp("(?:false|true|null|[\\{\\}\\[\\]]|"+e+"|"+n+")","g"),s=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),o={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},a=new String(""),u="\\",h=({"{":Object,"[":Array},Object.hasOwnProperty);return function(e,r){var n,o=e.match(i),c=o[0],f=!1;"{"===c?n={}:"["===c?n=[]:(n=[],f=!0);for(var l,d=[n],p=1-f,g=o.length;g>p;++p){c=o[p];var y;switch(c.charCodeAt(0)){default:y=d[0],y[l||y.length]=+c,l=void 0;break;case 34:if(c=c.substring(1,c.length-1),-1!==c.indexOf(u)&&(c=c.replace(s,t)),y=d[0],!l){if(!(y instanceof Array)){l=c||a;break}l=y.length}y[l]=c,l=void 0;break;case 91:y=d[0],d.unshift(y[l||y.length]=[]),l=void 0;break;case 93:d.shift();break;case 102:y=d[0],y[l||y.length]=!1,l=void 0;break;case 110:y=d[0],y[l||y.length]=null,l=void 0;break;case 116:y=d[0],y[l||y.length]=!0,l=void 0;break;case 123:y=d[0],d.unshift(y[l||y.length]={}),l=void 0;break;case 125:d.shift()}}if(f){if(1!==d.length)throw new Error;n=n[0]}else if(d.length)throw new Error;if(r){var v=function(t,e){var n=t[e];if(n&&"object"==typeof n){var i=null;for(var s in n)if(h.call(n,s)&&n!==t){var o=v(n,s);void 0!==o?n[s]=o:(i||(i=[]),i.push(s))}if(i)for(var a=i.length;--a>=0;)delete n[i[a]]}return r.call(t,e,n)};n=v({"":n},"")}return n}}();"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.asn1&&KJUR.asn1||(KJUR.asn1={}),KJUR.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),n=r.length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var i="",s=0;n>s;s++)i+="f";var a=new o(i,16),u=a.xor(t).add(o.ONE);e=u.toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){var r=(KJUR.asn1,sn.enc.Hex.parse(t)),n=sn.enc.Base64.stringify(r),i=n.replace(/(.{64})/g,"$1\r\n");return i=i.replace(/\r\n$/,""),"-----BEGIN "+e+"-----\r\n"+i+"\r\n-----END "+e+"-----\r\n"},this.newObject=function(t){var e=KJUR.asn1,r=Object.keys(t);if(1!=r.length)throw"key of param shall be only one.";var n=r[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+n+":"))throw"undefined key: "+n;if("bool"==n)return new e.DERBoolean(t[n]);if("int"==n)return new e.DERInteger(t[n]);if("bitstr"==n)return new e.DERBitString(t[n]);if("octstr"==n)return new e.DEROctetString(t[n]);if("null"==n)return new e.DERNull(t[n]);if("oid"==n)return new e.DERObjectIdentifier(t[n]);if("enum"==n)return new e.DEREnumerated(t[n]);if("utf8str"==n)return new e.DERUTF8String(t[n]);if("numstr"==n)return new e.DERNumericString(t[n]);if("prnstr"==n)return new e.DERPrintableString(t[n]);if("telstr"==n)return new e.DERTeletexString(t[n]);if("ia5str"==n)return new e.DERIA5String(t[n]);if("utctime"==n)return new e.DERUTCTime(t[n]);if("gentime"==n)return new e.DERGeneralizedTime(t[n]);if("seq"==n){for(var i=t[n],s=[],o=0;ou;u++)a+="0";i=a+i;for(var u=0;ue)return r;var n=r.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);var i=128+n;return i.toString(16)+r},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""}},KJUR.asn1.DERAbstractString=function(t){KJUR.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=ar(this.s)},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("string"==typeof t?this.setString(t):"undefined"!=typeof t.str?this.setString(t.str):"undefined"!=typeof t.hex&&this.setStringHex(t.hex))},nn.lang.extend(KJUR.asn1.DERAbstractString,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractTime=function(t){KJUR.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){utc=t.getTime()+6e4*t.getTimezoneOffset();var e=new Date(utc);return e},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),s=String(i.getFullYear());"utc"==e&&(s=s.substr(2,2));var o=n(String(i.getMonth()+1),2),a=n(String(i.getDate()),2),u=n(String(i.getHours()),2),h=n(String(i.getMinutes()),2),c=n(String(i.getSeconds()),2),f=s+o+a+u+h+c;if(r===!0){var l=i.getMilliseconds();if(0!=l){var d=n(String(l),3);d=d.replace(/[0]+$/,""),f=f+"."+d}}return f+"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=ar(t)},this.setByDateValue=function(t,e,r,n,i,s){var o=new Date(Date.UTC(t,e-1,r,n,i,s,0));this.setByDate(o)},this.getFreshValueHex=function(){return this.hV}},nn.lang.extend(KJUR.asn1.DERAbstractTime,KJUR.asn1.ASN1Object),KJUR.asn1.DERAbstractStructured=function(t){KJUR.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,"undefined"!=typeof t&&"undefined"!=typeof t.array&&(this.asn1Array=t.array)},nn.lang.extend(KJUR.asn1.DERAbstractStructured,KJUR.asn1.ASN1Object),KJUR.asn1.DERBoolean=function(){KJUR.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},nn.lang.extend(KJUR.asn1.DERBoolean,KJUR.asn1.ASN1Object),KJUR.asn1.DERInteger=function(t){KJUR.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new o(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("undefined"!=typeof t.bigint?this.setByBigInteger(t.bigint):"undefined"!=typeof t["int"]?this.setByInteger(t["int"]):"number"==typeof t?this.setByInteger(t):"undefined"!=typeof t.hex&&this.setValueHex(t.hex))},nn.lang.extend(KJUR.asn1.DERInteger,KJUR.asn1.ASN1Object),KJUR.asn1.DERBitString=function(t){KJUR.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(0>t||t>7)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){t=t.replace(/0+$/,"");var e=8-t.length%8;8==e&&(e=0);for(var r=0;e>=r;r++)t+="0";for(var n="",r=0;rr;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):"undefined"!=typeof t.hex?this.setHexValueIncludingUnusedBits(t.hex):"undefined"!=typeof t.bin?this.setByBinaryString(t.bin):"undefined"!=typeof t.array&&this.setByBooleanArray(t.array))},nn.lang.extend(KJUR.asn1.DERBitString,KJUR.asn1.ASN1Object),KJUR.asn1.DEROctetString=function(t){KJUR.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},nn.lang.extend(KJUR.asn1.DEROctetString,KJUR.asn1.DERAbstractString),KJUR.asn1.DERNull=function(){KJUR.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},nn.lang.extend(KJUR.asn1.DERNull,KJUR.asn1.ASN1Object),KJUR.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new o(t,10),i=n.toString(2),s=7-i.length%7;7==s&&(s=0);for(var a="",u=0;s>u;u++)a+="0";i=a+i;for(var u=0;u0&&10>r?r+1:-2},this.getHexOfL_AtObj=function(t,e){var r=this.getByteLengthOfL_AtObj(t,e);return 1>r?"":t.substring(e+2,e+2+2*r)},this.getIntOfL_AtObj=function(t,e){var r=this.getHexOfL_AtObj(t,e);if(""==r)return-1;var n;return n=parseInt(r.substring(0,1))<8?new o(r,16):new o(r.substring(2),16),n.intValue()},this.getStartPosOfV_AtObj=function(t,e){var r=this.getByteLengthOfL_AtObj(t,e);return 0>r?r:e+2*(r+1)},this.getHexOfV_AtObj=function(t,e){var r=this.getStartPosOfV_AtObj(t,e),n=this.getIntOfL_AtObj(t,e);return t.substring(r,r+2*n)},this.getHexOfTLV_AtObj=function(t,e){var r=t.substr(e,2),n=this.getHexOfL_AtObj(t,e),i=this.getHexOfV_AtObj(t,e);return r+n+i},this.getPosOfNextSibling_AtObj=function(t,e){var r=this.getStartPosOfV_AtObj(t,e),n=this.getIntOfL_AtObj(t,e);return r+2*n},this.getPosArrayOfChildren_AtObj=function(t,e){var r=new Array,n=this.getStartPosOfV_AtObj(t,e);r.push(n);for(var i=this.getIntOfL_AtObj(t,e),s=n,o=0;;){var a=this.getPosOfNextSibling_AtObj(t,s);if(null==a||a-n>=2*i)break;if(o>=200)break;r.push(a),s=a,o++}return r},this.getNthChildIndex_AtObj=function(t,e,r){var n=this.getPosArrayOfChildren_AtObj(t,e);return n[r]},this.getDecendantIndexByNthList=function(t,e,r){if(0==r.length)return e;var n=r.shift(),i=this.getPosArrayOfChildren_AtObj(t,e);return this.getDecendantIndexByNthList(t,i[n],r)},this.getDecendantHexTLVByNthList=function(t,e,r){var n=this.getDecendantIndexByNthList(t,e,r);return this.getHexOfTLV_AtObj(t,n)},this.getDecendantHexVByNthList=function(t,e,r){var n=this.getDecendantIndexByNthList(t,e,r);return this.getHexOfV_AtObj(t,n)}};Fn.getVbyList=function(t,e,r,n){var i=this.getDecendantIndexByNthList(t,e,r);if(void 0===i)throw"can't find nthList object";if(void 0!==n&&t.substr(i,2)!=n)throw"checking tag doesn't match: "+t.substr(i,2)+"!="+n;return this.getHexOfV_AtObj(t,i)},Fn.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var s=t.substr(2),o=[],a=0;a0&&(c=c+"."+u.join(".")),c},Fn.dump=function(t,e,r,n){var i=function(t,e){if(t.length<=2*e)return t;var r=t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e);return r};void 0===e&&(e={ommit_long_octet:32}),void 0===r&&(r=0),void 0===n&&(n="");var s=e.ommit_long_octet;if("01"==t.substr(r,2)){var o=Fn.getHexOfV_AtObj(t,r);return"00"==o?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n"}if("02"==t.substr(r,2)){var o=Fn.getHexOfV_AtObj(t,r);return n+"INTEGER "+i(o,s)+"\n"}if("03"==t.substr(r,2)){var o=Fn.getHexOfV_AtObj(t,r);return n+"BITSTRING "+i(o,s)+"\n"}if("04"==t.substr(r,2)){var o=Fn.getHexOfV_AtObj(t,r);if(Fn.isASN1HEX(o)){var a=n+"OCTETSTRING, encapsulates\n";return a+=Fn.dump(o,e,0,n+" ")}return n+"OCTETSTRING "+i(o,s)+"\n"}if("05"==t.substr(r,2))return n+"NULL\n";if("06"==t.substr(r,2)){var u=Fn.getHexOfV_AtObj(t,r),h=KJUR.asn1.ASN1Util.oidHexToInt(u),c=KJUR.asn1.x509.OID.oid2name(h),f=h.replace(/\./g," ");return""!=c?n+"ObjectIdentifier "+c+" ("+f+")\n":n+"ObjectIdentifier ("+f+")\n"}if("0c"==t.substr(r,2))return n+"UTF8String '"+mr(Fn.getHexOfV_AtObj(t,r))+"'\n";if("13"==t.substr(r,2))return n+"PrintableString '"+mr(Fn.getHexOfV_AtObj(t,r))+"'\n";if("14"==t.substr(r,2))return n+"TeletexString '"+mr(Fn.getHexOfV_AtObj(t,r))+"'\n";if("16"==t.substr(r,2))return n+"IA5String '"+mr(Fn.getHexOfV_AtObj(t,r))+"'\n";if("17"==t.substr(r,2))return n+"UTCTime "+mr(Fn.getHexOfV_AtObj(t,r))+"\n";if("18"==t.substr(r,2))return n+"GeneralizedTime "+mr(Fn.getHexOfV_AtObj(t,r))+"\n";if("30"==t.substr(r,2)){if("3000"==t.substr(r,4))return n+"SEQUENCE {}\n";var a=n+"SEQUENCE\n",l=Fn.getPosArrayOfChildren_AtObj(t,r),d=e;if((2==l.length||3==l.length)&&"06"==t.substr(l[0],2)&&"04"==t.substr(l[l.length-1],2)){var p=Fn.getHexOfV_AtObj(t,l[0]),h=KJUR.asn1.ASN1Util.oidHexToInt(p),c=KJUR.asn1.x509.OID.oid2name(h),g=JSON.parse(JSON.stringify(e));g.x509ExtName=c,d=g}for(var y=0;y0){var e=new KJUR.asn1.DERSequence({array:this.extensionsArray}),r=new KJUR.asn1.DERTaggedObject({explicit:!0,tag:"a3",obj:e});this.asn1Array.push(r)}var n=new KJUR.asn1.DERSequence({array:this.asn1Array});return this.hTLV=n.getEncodedHex(),this.isModified=!1,this.hTLV},this._initialize()},nn.lang.extend(KJUR.asn1.x509.TBSCertificate,KJUR.asn1.ASN1Object),KJUR.asn1.x509.Extension=function(t){KJUR.asn1.x509.Extension.superclass.constructor.call(this),this.getEncodedHex=function(){var t=new KJUR.asn1.DERObjectIdentifier({oid:this.oid}),e=new KJUR.asn1.DEROctetString({hex:this.getExtnValueHex()}),r=new Array;r.push(t),this.critical&&r.push(new KJUR.asn1.DERBoolean),r.push(e);var n=new KJUR.asn1.DERSequence({array:r});return n.getEncodedHex()},this.critical=!1,"undefined"!=typeof t&&"undefined"!=typeof t.critical&&(this.critical=t.critical)},nn.lang.extend(KJUR.asn1.x509.Extension,KJUR.asn1.ASN1Object),KJUR.asn1.x509.KeyUsage=function(t){KJUR.asn1.x509.KeyUsage.superclass.constructor.call(this,t),this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15","undefined"!=typeof t&&"undefined"!=typeof t.bin&&(this.asn1ExtnValue=new KJUR.asn1.DERBitString(t))},nn.lang.extend(KJUR.asn1.x509.KeyUsage,KJUR.asn1.x509.Extension),KJUR.asn1.x509.BasicConstraints=function(t){KJUR.asn1.x509.BasicConstraints.superclass.constructor.call(this,t),this.getExtnValueHex=function(){var t=new Array;this.cA&&t.push(new KJUR.asn1.DERBoolean),this.pathLen>-1&&t.push(new KJUR.asn1.DERInteger({"int":this.pathLen}));var e=new KJUR.asn1.DERSequence({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,"undefined"!=typeof t&&("undefined"!=typeof t.cA&&(this.cA=t.cA),"undefined"!=typeof t.pathLen&&(this.pathLen=t.pathLen))},nn.lang.extend(KJUR.asn1.x509.BasicConstraints,KJUR.asn1.x509.Extension),KJUR.asn1.x509.CRLDistributionPoints=function(t){KJUR.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t),this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(t){this.asn1ExtnValue=new KJUR.asn1.DERSequence({array:t})},this.setByOneURI=function(t){var e=new KJUR.asn1.x509.GeneralNames([{uri:t}]),r=new KJUR.asn1.x509.DistributionPointName(e),n=new KJUR.asn1.x509.DistributionPoint({dpobj:r});this.setByDPArray([n])},this.oid="2.5.29.31","undefined"!=typeof t&&("undefined"!=typeof t.array?this.setByDPArray(t.array):"undefined"!=typeof t.uri&&this.setByOneURI(t.uri))},nn.lang.extend(KJUR.asn1.x509.CRLDistributionPoints,KJUR.asn1.x509.Extension),KJUR.asn1.x509.ExtKeyUsage=function(t){KJUR.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,t),this.setPurposeArray=function(t){this.asn1ExtnValue=new KJUR.asn1.DERSequence;for(var e=0;e0){var t=new KJUR.asn1.DERSequence({array:this.aRevokedCert});this.asn1Array.push(t)}var e=new KJUR.asn1.DERSequence({array:this.asn1Array});return this.hTLV=e.getEncodedHex(),this.isModified=!1,this.hTLV},this._initialize=function(){this.asn1Version=null,this.asn1SignatureAlg=null,this.asn1Issuer=null,this.asn1ThisUpdate=null,this.asn1NextUpdate=null,this.aRevokedCert=new Array},this._initialize()},nn.lang.extend(KJUR.asn1.x509.TBSCertList,KJUR.asn1.ASN1Object),KJUR.asn1.x509.CRLEntry=function(t){KJUR.asn1.x509.CRLEntry.superclass.constructor.call(this),this.setCertSerial=function(t){this.sn=new KJUR.asn1.DERInteger(t)},this.setRevocationDate=function(t){this.time=new KJUR.asn1.x509.Time(t)},this.getEncodedHex=function(){var t=new KJUR.asn1.DERSequence({array:[this.sn,this.time]});return this.TLV=t.getEncodedHex(),this.TLV},"undefined"!=typeof t&&("undefined"!=typeof t.time&&this.setRevocationDate(t.time),"undefined"!=typeof t.sn&&this.setCertSerial(t.sn))},nn.lang.extend(KJUR.asn1.x509.CRLEntry,KJUR.asn1.ASN1Object),KJUR.asn1.x509.X500Name=function(t){if(KJUR.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=new Array,this.setByString=function(t){var e=t.split("/");e.shift();for(var r=0;r0&&(r=new e.DERTaggedObject({obj:this.dUnsignedAttrs,tag:"a1",explicit:!1}));var n=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,t,this.dSigAlg,this.dSig];null!=r&&n.push(r);var i=new e.DERSequence({array:n});return this.hTLV=i.getEncodedHex(),this.hTLV}},nn.lang.extend(KJUR.asn1.cms.SignerInfo,KJUR.asn1.ASN1Object),KJUR.asn1.cms.EncapsulatedContentInfo=function(t){KJUR.asn1.cms.EncapsulatedContentInfo.superclass.constructor.call(this);var e=KJUR.asn1;KJUR.asn1.cms,KJUR.asn1.x509,this.dEContentType=new e.DERObjectIdentifier({name:"data"}),this.dEContent=null,this.isDetached=!1,this.eContentValueHex=null,this.setContentType=function(t){t.match(/^[0-2][.][0-9.]+$/)?this.dEContentType=new e.DERObjectIdentifier({oid:t}):this.dEContentType=new e.DERObjectIdentifier({name:t})},this.setContentValue=function(t){"undefined"!=typeof t&&("string"==typeof t.hex?this.eContentValueHex=t.hex:"string"==typeof t.str&&(this.eContentValueHex=vr(t.str)))},this.setContentValueHex=function(t){this.eContentValueHex=t},this.setContentValueStr=function(t){this.eContentValueHex=vr(t)},this.getEncodedHex=function(){if("string"!=typeof this.eContentValueHex)throw"eContentValue not yet set";var t=new e.DEROctetString({hex:this.eContentValueHex});this.dEContent=new e.DERTaggedObject({obj:t,tag:"a0",explicit:!0});var r=[this.dEContentType];this.isDetached||r.push(this.dEContent);var n=new e.DERSequence({array:r});return this.hTLV=n.getEncodedHex(),this.hTLV}},nn.lang.extend(KJUR.asn1.cms.EncapsulatedContentInfo,KJUR.asn1.ASN1Object),KJUR.asn1.cms.ContentInfo=function(t){KJUR.asn1.cms.ContentInfo.superclass.constructor.call(this);var e=KJUR.asn1,r=(KJUR.asn1.cms,KJUR.asn1.x509);this.dContentType=null,this.dContent=null,this.setContentType=function(t){"string"==typeof t&&(this.dContentType=r.OID.name2obj(t))},this.getEncodedHex=function(){var t=new e.DERTaggedObject({obj:this.dContent,tag:"a0",explicit:!0}),r=new e.DERSequence({array:[this.dContentType,t]});return this.hTLV=r.getEncodedHex(),this.hTLV},"undefined"!=typeof t&&(t.type&&this.setContentType(t.type),t.obj&&t.obj instanceof e.ASN1Object&&(this.dContent=t.obj))},nn.lang.extend(KJUR.asn1.cms.ContentInfo,KJUR.asn1.ASN1Object),KJUR.asn1.cms.SignedData=function(t){KJUR.asn1.cms.SignedData.superclass.constructor.call(this);var e=KJUR.asn1,r=KJUR.asn1.cms,n=KJUR.asn1.x509;this.dCMSVersion=new e.DERInteger({"int":1}),this.dDigestAlgs=null,this.digestAlgNameList=[],this.dEncapContentInfo=new r.EncapsulatedContentInfo,this.dCerts=null,this.certificateList=[],this.crlList=[],this.signerInfoList=[new r.SignerInfo],this.addCertificatesByPEM=function(t){var r=In.getHexFromPEM(t),n=new e.ASN1Object;n.hTLV=r,this.certificateList.push(n)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(null==this.dDigestAlgs){for(var t=[],r=0;r0){var a=new e.DERSet({array:this.certificateList});this.dCerts=new e.DERTaggedObject({obj:a,tag:"a0",explicit:!1})}null!=this.dCerts&&o.push(this.dCerts);var u=new e.DERSet({array:this.signerInfoList});o.push(u);var h=new e.DERSequence({array:o});return this.hTLV=h.getEncodedHex(),this.hTLV},this.getContentInfo=function(){this.getEncodedHex();var t=new r.ContentInfo({type:"signed-data",obj:this});return t},this.getContentInfoEncodedHex=function(){var t=this.getContentInfo(),e=t.getEncodedHex();return e},this.getPEM=function(){var t=this.getContentInfoEncodedHex(),r=e.ASN1Util.getPEMStringFromHex(t,"CMS");return r}},nn.lang.extend(KJUR.asn1.cms.SignedData,KJUR.asn1.ASN1Object),KJUR.asn1.cms.CMSUtil=new function(){},KJUR.asn1.cms.CMSUtil.newSignedData=function(t){var e=KJUR.asn1.cms,r=KJUR.asn1.cades,n=new e.SignedData;if(n.dEncapContentInfo.setContentValue(t.content),"object"==typeof t.certs)for(var i=0;ie.length&&(r=e.length);for(var n=0;r>n;n++)if(t.charCodeAt(n)!=e.charCodeAt(n))return n;return t.length!=e.length?r:-1};"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.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",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:sn.algo.MD5,sha1:sn.algo.SHA1,sha224:sn.algo.SHA224,sha256:sn.algo.SHA256,sha384:sn.algo.SHA384,sha512:sn.algo.SHA512,ripemd160:sn.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if("undefined"==typeof this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="0001",o="00"+n,a="",u=i-s.length-o.length,h=0;u>h;h+=2)a+="ff";var c=s+a+o;return c},this.hashString=function(t,e){var r=new KJUR.crypto.MessageDigest({alg:e});return r.digestString(t)},this.hashHex=function(t,e){var r=new KJUR.crypto.MessageDigest({alg:e});return r.digestHex(t)},this.sha1=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha1",prov:"cryptojs"});return e.digestString(t)},this.sha256=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return e.digestString(t)},this.sha256Hex=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return e.digestHex(t)},this.sha512=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return e.digestString(t)},this.sha512Hex=function(t){var e=new KJUR.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"});return e.digestHex(t)},this.md5=function(t){var e=new KJUR.crypto.MessageDigest({alg:"md5",prov:"cryptojs"});return e.digestString(t)},this.ripemd160=function(t){var e=new KJUR.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"});return e.digestString(t)},this.getCryptoJSMDByName=function(t){}},KJUR.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!=t&&void 0===e&&(e=KJUR.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(r){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+r}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sn.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return t.toString(sn.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(r){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+r}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},KJUR.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(t=t.toLowerCase(),null==t&&(t="hmacsha1"),t=t.toLowerCase(),"hmac"!=t.substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=KJUR.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var r=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(r)&&"cryptojs"==e){try{var n=KJUR.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[r];this.mac=sn.algo.HMAC.create(n,this.pass)}catch(i){throw"setAlgAndProvider hash alg set fail hashAlg="+r+"/"+i}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=sn.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){var t=this.mac.finalize();return t.toString(sn.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=_r(t)),void(this.pass=sn.enc.Hex.parse(e))}if("object"!=typeof t)throw"KJUR.crypto.Mac unsupported password type: "+t;var e=null;if(void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=vr(t.utf8)),void 0!==t.rstr&&(e=_r(t.rstr)),void 0!==t.b64&&(e=i(t.b64)),void 0!==t.b64u&&(e=pr(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=sn.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},KJUR.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){this.algName.match(/^(.+)with(.+)$/)&&(this.mdAlgName=RegExp.$1.toLowerCase(),this.pubkeyAlgName=RegExp.$2.toLowerCase())},this._zeroPaddingOfSignature=function(t,e){for(var r="",n=e/4-t.length,i=0;n>i;i++)r+="0";return r+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw"provider not supported: "+e;if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new KJUR.crypto.MessageDigest({alg:this.mdAlgName})}catch(r){throw"setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+r}this.init=function(t,e){var r=null;try{r=void 0===e?In.getKey(t):In.getKey(t,e)}catch(n){throw"init failed:"+n}if(r.isPrivate===!0)this.prvKey=r,this.state="SIGN";else{if(r.isPublic!==!0)throw"init failed.:"+r;this.pubKey=r,this.state="VERIFY"}},this.initSign=function(t){"string"==typeof t.ecprvhex&&"string"==typeof t.eccurvename?(this.ecprvhex=t.ecprvhex,this.eccurvename=t.eccurvename):this.prvKey=t,this.state="SIGN"},this.initVerifyByPublicKey=function(t){"string"==typeof t.ecpubhex&&"string"==typeof t.eccurvename?(this.ecpubhex=t.ecpubhex,this.eccurvename=t.eccurvename):t instanceof KJUR.crypto.ECDSA?this.pubKey=t:t instanceof ve&&(this.pubKey=t),this.state="VERIFY"},this.initVerifyByCertificatePEM=function(t){var e=new Gr;e.readCertPEM(t),this.pubKey=e.subjectPublicKeyRSA,this.state="VERIFY"},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),"undefined"!=typeof this.ecprvhex&&"undefined"!=typeof this.eccurvename){var t=new KJUR.crypto.ECDSA({curve:this.eccurvename});this.hSign=t.signHex(this.sHashHex,this.ecprvhex)}else if(this.prvKey instanceof ve&&"rsaandmgf1"==this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ve&&"rsa"==this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof KJUR.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof KJUR.crypto.DSA))throw"Signature: unsupported public key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),"undefined"!=typeof this.ecpubhex&&"undefined"!=typeof this.eccurvename){var e=new KJUR.crypto.ECDSA({curve:this.eccurvename});return e.verifyHex(this.sHashHex,t,this.ecpubhex)}if(this.pubKey instanceof ve&&"rsaandmgf1"==this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ve&&"rsa"==this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(this.pubKey instanceof KJUR.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(this.pubKey instanceof KJUR.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.initVerifyByPublicKey=function(t){throw"initVerifyByPublicKey(rsaPubKeyy) not supported for this alg:prov="+this.algProvName},this.initVerifyByCertificatePEM=function(t){throw"initVerifyByCertificatePEM(certPEM) not supported for this alg:prov="+this.algProvName},this.initSign=function(t){throw"initSign(prvKey) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(t){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(t){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=KJUR.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{var e=new ve;e.readPrivateKeyFromPEMString(t.prvkeypem),this.initSign(e)}catch(r){throw"fatal error to load pem private key: "+r}}},KJUR.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.crypto.ECDSA=function(t){var e="secp256r1",r=new le;this.type="EC",this.getBigRandom=function(t){return new o(t.bitLength(),r).mod(t.subtract(o.ONE)).add(o.ONE)},this.setNamedCurve=function(t){this.ecparams=KJUR.crypto.ECParameterDB.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),r=this.ecparams.G.multiply(e),n=r.getX().toBigInteger(),i=r.getY().toBigInteger(),s=this.ecparams.keylen/4,o=("0000000000"+e.toString(16)).slice(-s),a=("0000000000"+n.toString(16)).slice(-s),u=("0000000000"+i.toString(16)).slice(-s),h="04"+a+u;return this.setPrivateKeyHex(o),this.setPublicKeyHex(h),{ecprvhex:o,ecpubhex:h}},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var r=new o(e,16),n=this.ecparams.n,i=new o(t,16);do var s=this.getBigRandom(n),a=this.ecparams.G,u=a.multiply(s),h=u.getX().toBigInteger().mod(n);while(h.compareTo(o.ZERO)<=0);var c=s.modInverse(n).multiply(i.add(r.multiply(h))).mod(n);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(h,c)},this.sign=function(t,e){var r=e,n=this.ecparams.n,i=o.fromByteArrayUnsigned(t);do var s=this.getBigRandom(n),a=this.ecparams.G,u=a.multiply(s),h=u.getX().toBigInteger().mod(n);while(h.compareTo(o.ZERO)<=0);var c=s.modInverse(n).multiply(i.add(r.multiply(h))).mod(n);return this.serializeSig(h,c)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,r){var n,i,s=KJUR.crypto.ECDSA.parseSigHex(e);n=s.r,i=s.s;var a;a=ke.decodeFromHex(this.ecparams.curve,r);var u=new o(t,16);return this.verifyRaw(u,n,i,a)},this.verify=function(t,e,r){var n,i;if(Bitcoin.Util.isArray(e)){var s=this.parseSig(e);n=s.r,i=s.s}else{if("object"!=typeof e||!e.r||!e.s)throw"Invalid value for signature";n=e.r,i=e.s}var a;if(r instanceof ke)a=r;else{if(!Bitcoin.Util.isArray(r))throw"Invalid format for pubkey value, must be byte array or ECPointFp";a=ke.decodeFrom(this.ecparams.curve,r)}var u=o.fromByteArrayUnsigned(t);return this.verifyRaw(u,n,i,a)},this.verifyRaw=function(t,e,r,n){var i=this.ecparams.n,s=this.ecparams.G;if(e.compareTo(o.ONE)<0||e.compareTo(i)>=0)return!1;if(r.compareTo(o.ONE)<0||r.compareTo(i)>=0)return!1;var a=r.modInverse(i),u=t.multiply(a).mod(i),h=e.multiply(a).mod(i),c=s.multiply(u).add(n.multiply(h)),f=c.getX().toBigInteger().mod(i);return f.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),i.push(2),i.push(n.length),i=i.concat(n),i.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(e=2,2!=t[e])throw new Error("First element in signature must be a DERInteger");var r=t.slice(e+2,e+2+t[e+1]);if(e+=2+t[e+1],2!=t[e])throw new Error("Second element in signature must be a DERInteger");var n=t.slice(e+2,e+2+t[e+1]);e+=2+t[e+1];var i=o.fromByteArrayUnsigned(r),s=o.fromByteArrayUnsigned(n);return{r:i,s:s}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(0>e||e>7)throw"Invalid signature type";var r=this.ecparams.n,n=o.fromByteArrayUnsigned(t.slice(1,33)).mod(r),i=o.fromByteArrayUnsigned(t.slice(33,65)).mod(r);return{r:n,s:i,i:e}},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName=e),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},KJUR.crypto.ECDSA.parseSigHex=function(t){var e=KJUR.crypto.ECDSA.parseSigHexInHexRS(t),r=new o(e.r,16),n=new o(e.s,16);return{r:r,s:n}},KJUR.crypto.ECDSA.parseSigHexInHexRS=function(t){if("30"!=t.substr(0,2))throw"signature is not a ASN.1 sequence";var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=e.length)throw"number of signature ASN.1 sequence elements seem wrong";var r=e[0],n=e[1];if("02"!=t.substr(r,2))throw"1st item of sequene of signature is not ASN.1 integer";if("02"!=t.substr(n,2))throw"2nd item of sequene of signature is not ASN.1 integer";var i=Fn.getHexOfV_AtObj(t,r),s=Fn.getHexOfV_AtObj(t,n);return{r:i,s:s}},KJUR.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=KJUR.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if("00"==r.substr(0,2)&&r.length/2*8%128==8&&(r=r.substr(2)),"00"==n.substr(0,2)&&n.length/2*8%128==8&&(n=n.substr(2)),r.length/2*8%128!=0)throw"unknown ECDSA sig r length error";if(n.length/2*8%128!=0)throw"unknown ECDSA sig s length error";return r+n},KJUR.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 KJUR.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},KJUR.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new o(t,16),n=new o(e,16);return KJUR.crypto.ECDSA.biRSSigToASN1Sig(r,n)},KJUR.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=new KJUR.asn1.DERInteger({bigint:t}),n=new KJUR.asn1.DERInteger({bigint:e}),i=new KJUR.asn1.DERSequence({array:[r,n]});return i.getEncodedHex()},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.crypto&&KJUR.crypto||(KJUR.crypto={}),KJUR.crypto.ECParameterDB=new function(){function t(t){return new o(t,16)}var e={},r={};this.getByName=function(t){var n=t;if("undefined"!=typeof r[n]&&(n=r[t]),"undefined"!=typeof e[n])return e[n];throw"unregistered EC curve name: "+n},this.regist=function(n,i,s,o,a,u,h,c,f,l,d,p){e[n]={};var g=t(s),y=t(o),v=t(a),m=t(u),S=t(h),_=new Xe(g,y,v),E=_.decodePointHex("04"+c+f);e[n].name=n,e[n].keylen=i,e[n].curve=_,e[n].G=E,e[n].n=m,e[n].h=S,e[n].oid=d,e[n].info=p;for(var b=0;b11&&10!=e&&8>e?2:e;case 28:return e>11&&8>e?11:e;case 32:return e>10&&8>e?8:e;default:return util.print_debug("DSA select hash algorithm: returning null for an unknown length of q"),null}}function r(t,e,r,n,i,s,a,u){var h=KJUR.crypto.Util.hashString(n,t.toLowerCase()),h=h.substr(0,s.bitLength()/4),c=new o(h,16);if(o.ZERO.compareTo(e)>0||e.compareTo(s)>0||o.ZERO.compareTo(r)>0||r.compareTo(s)>0)return util.print_error("invalid DSA Signature"),null;var f=r.modInverse(s),l=c.multiply(f).mod(s),d=e.multiply(f).mod(s),p=a.modPow(l,i).multiply(u.modPow(d,i)).mod(i).mod(s);return 0==p.compareTo(e)}function n(t,e){if(!(e.compareTo(t)<=0)){for(var r=e.subtract(t),n=i(r.bitLength());n>r;)n=i(r.bitLength());return t.add(n)}}function i(t){if(0>t)return null;var e=Math.floor((t+7)/8),r=s(e);return t%8>0&&(r=String.fromCharCode(Math.pow(2,t%8)-1&r.charCodeAt(0))+r.substring(1)),new o(u(r),16)}function s(t){for(var e="",r=0;t>r;r++)e+=String.fromCharCode(a());return e}function a(){var t=new Uint32Array(1);return rn.crypto.getRandomValues(t),255&t[0]}function u(t){if(null==t)return"";for(var e,r=[],n=t.length,i=0;n>i;){for(e=t[i++].charCodeAt().toString(16);e.length<2;)e="0"+e;r.push(""+e)}return r.join("")}this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.setPrivate=function(t,e,r,n,i){this.isPrivate=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=i},this.setPublic=function(t,e,r,n){this.isPublic=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=null},this.signWithMessageHash=function(t){var e=this.p,r=this.q,i=this.g,s=(this.y,this.x),a=(t.substr(0,r.bitLength()/4),new o(t,16)),u=n(o.ONE.add(o.ONE),r.subtract(o.ONE)),h=i.modPow(u,e).mod(r),c=u.modInverse(r).multiply(a.add(s.multiply(h))).mod(r),f=KJUR.asn1.ASN1Util.jsonToASN1HEX({seq:[{"int":{bigint:h}},{"int":{bigint:c}}]});return f},this.verifyWithMessageHash=function(t,e){var r=this.p,n=this.q,i=this.g,s=this.y,a=this.parseASN1Signature(e),u=a[0],h=a[1],t=t.substr(0,n.bitLength()/4),c=new o(t,16);if(o.ZERO.compareTo(u)>0||u.compareTo(n)>0||o.ZERO.compareTo(h)>0||h.compareTo(n)>0)throw"invalid DSA signature";var f=h.modInverse(n),l=c.multiply(f).mod(n),d=u.multiply(f).mod(n),p=i.modPow(l,r).multiply(s.modPow(d,r)).mod(r).mod(n);return 0==p.compareTo(u)},this.parseASN1Signature=function(t){try{var e=new o(Fn.getVbyList(t,0,[0],"02"),16),r=new o(Fn.getVbyList(t,0,[1],"02"),16);return[e,r]}catch(n){throw"malformed DSA signature"}},this.select_hash_algorithm=e,this.sign=t,this.verify=r,this.getRandomBigIntegerInRange=n,this.getRandomBigInteger=i,this.getRandomBytes=s};var Pn=function(){var t=function(t,e,n){return r(sn.AES,t,e,n)},e=function(t,e,n){return r(sn.TripleDES,t,e,n)},r=function(t,e,r,n){var i=sn.enc.Hex.parse(e),s=sn.enc.Hex.parse(r),o=sn.enc.Hex.parse(n),a={};a.key=s,a.iv=o,a.ciphertext=i;var u=t.decrypt(a,s,{iv:o});return sn.enc.Hex.stringify(u)},n=function(t,e,r){return o(sn.AES,t,e,r)},s=function(t,e,r){return o(sn.TripleDES,t,e,r)},o=function(t,e,r,n){var i=sn.enc.Hex.parse(e),s=sn.enc.Hex.parse(r),o=sn.enc.Hex.parse(n),a=t.encrypt(i,s,{iv:o}),u=sn.enc.Hex.parse(a.toString()),h=sn.enc.Base64.stringify(u);return h},a={"AES-256-CBC":{proc:t,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:s,keylen:24,ivlen:8}},u=function(t){return a[t].proc},h=function(t){var e=sn.lib.WordArray.random(t),r=sn.enc.Hex.stringify(e);return r},c=function(t){var e={};t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))&&(e.cipher=RegExp.$1,e.ivsalt=RegExp.$2),t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))&&(e.type=RegExp.$1);var r=-1,n=0;-1!=t.indexOf("\r\n\r\n")&&(r=t.indexOf("\r\n\r\n"),n=2),-1!=t.indexOf("\n\n")&&(r=t.indexOf("\n\n"),n=1);var i=t.indexOf("-----END");if(-1!=r&&-1!=i){var s=t.substring(r+2*n,i-n);s=s.replace(/\s+/g,""),e.data=s}return e},f=function(t,e,r){for(var n=r.substring(0,16),i=sn.enc.Hex.parse(n),s=sn.enc.Utf8.parse(e),o=a[t].keylen+a[t].ivlen,u="",h=null;;){var c=sn.algo.MD5.create();if(null!=h&&c.update(h),c.update(s),c.update(i),h=c.finalize(),u+=sn.enc.Hex.stringify(h),u.length>=2*o)break}var f={};return f.keyhex=u.substr(0,2*a[t].keylen),f.ivhex=u.substr(2*a[t].keylen,2*a[t].ivlen),f},l=function(t,e,r,n){var i=sn.enc.Base64.parse(t),s=sn.enc.Hex.stringify(i),o=a[e].proc,u=o(s,r,n);return u},d=function(t,e,r,n){var i=a[e].eproc,s=i(t,r,n);return s};return{version:"1.0.5",getHexFromPEM:function(t,e){var r=t;if(-1==r.indexOf("BEGIN "+e))throw"can't find PEM header: "+e;r=r.replace("-----BEGIN "+e+"-----",""),r=r.replace("-----END "+e+"-----","");var n=r.replace(/\s+/g,""),s=i(n);return s},getDecryptedKeyHexByKeyIV:function(t,e,r,n){var i=u(e);return i(t,r,n)},parsePKCS5PEM:function(t){return c(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return f(t,e,r)},decryptKeyB64:function(t,e,r,n){return l(t,e,r,n)},getDecryptedKeyHex:function(t,e){var r=c(t),n=(r.type, +r.cipher),i=r.ivsalt,s=r.data,o=f(n,e,i),a=o.keyhex,u=l(s,n,a,i);return u},getRSAKeyFromEncryptedPKCS5PEM:function(t,e){var r=this.getDecryptedKeyHex(t,e),n=new ve;return n.readPrivateKeyFromASN1HexString(r),n},getEryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,n){var i="";if("undefined"!=typeof r&&null!=r||(r="AES-256-CBC"),"undefined"==typeof a[r])throw"PKCS5PKEY unsupported algorithm: "+r;if("undefined"==typeof n||null==n){var s=a[r].ivlen,o=h(s);n=o.toUpperCase()}var u=f(r,e,n),c=u.keyhex,l=d(t,r,c,n),p=l.replace(/(.{64})/g,"$1\r\n"),i="-----BEGIN RSA PRIVATE KEY-----\r\n";return i+="Proc-Type: 4,ENCRYPTED\r\n",i+="DEK-Info: "+r+","+n+"\r\n",i+="\r\n",i+=p,i+="\r\n-----END RSA PRIVATE KEY-----\r\n"},getEryptedPKCS5PEMFromRSAKey:function(t,e,r,n){var i=new KJUR.asn1.DERInteger({"int":0}),s=new KJUR.asn1.DERInteger({bigint:t.n}),o=new KJUR.asn1.DERInteger({"int":t.e}),a=new KJUR.asn1.DERInteger({bigint:t.d}),u=new KJUR.asn1.DERInteger({bigint:t.p}),h=new KJUR.asn1.DERInteger({bigint:t.q}),c=new KJUR.asn1.DERInteger({bigint:t.dmp1}),f=new KJUR.asn1.DERInteger({bigint:t.dmq1}),l=new KJUR.asn1.DERInteger({bigint:t.coeff}),d=new KJUR.asn1.DERSequence({array:[i,s,o,a,u,h,c,f,l]}),p=d.getEncodedHex();return this.getEryptedPKCS5PEMFromPrvKeyHex(p,e,r,n)},newEncryptedPKCS5PEM:function(t,e,r,n){"undefined"!=typeof e&&null!=e||(e=1024),"undefined"!=typeof r&&null!=r||(r="10001");var i=new ve;i.generate(e,r);var s=null;return s="undefined"==typeof n||null==n?this.getEncryptedPKCS5PEMFromRSAKey(pkey,t):this.getEncryptedPKCS5PEMFromRSAKey(pkey,t,n)},getRSAKeyFromPlainPKCS8PEM:function(t){if(t.match(/ENCRYPTED/))throw"pem shall be not ENCRYPTED";var e=this.getHexFromPEM(t,"PRIVATE KEY"),r=this.getRSAKeyFromPlainPKCS8Hex(e);return r},getRSAKeyFromPlainPKCS8Hex:function(t){var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(3!=e.length)throw"outer DERSequence shall have 3 elements: "+e.length;var r=Fn.getHexOfTLV_AtObj(t,e[1]);if("300d06092a864886f70d0101010500"!=r)throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+r;var r=Fn.getHexOfTLV_AtObj(t,e[1]),n=Fn.getHexOfTLV_AtObj(t,e[2]),i=Fn.getHexOfV_AtObj(n,0),s=new ve;return s.readPrivateKeyFromASN1HexString(i),s},parseHexOfEncryptedPKCS8:function(t){var e={},r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"malformed format: SEQUENCE(0).items != 2: "+r.length;e.ciphertext=Fn.getHexOfV_AtObj(t,r[1]);var n=Fn.getPosArrayOfChildren_AtObj(t,r[0]);if(2!=n.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+n.length;if("2a864886f70d01050d"!=Fn.getHexOfV_AtObj(t,n[0]))throw"this only supports pkcs5PBES2";var i=Fn.getPosArrayOfChildren_AtObj(t,n[1]);if(2!=n.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+i.length;var s=Fn.getPosArrayOfChildren_AtObj(t,i[1]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+s.length;if("2a864886f70d0307"!=Fn.getHexOfV_AtObj(t,s[0]))throw"this only supports TripleDES";e.encryptionSchemeAlg="TripleDES",e.encryptionSchemeIV=Fn.getHexOfV_AtObj(t,s[1]);var o=Fn.getPosArrayOfChildren_AtObj(t,i[0]);if(2!=o.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+o.length;if("2a864886f70d01050c"!=Fn.getHexOfV_AtObj(t,o[0]))throw"this only supports pkcs5PBKDF2";var a=Fn.getPosArrayOfChildren_AtObj(t,o[1]);if(a.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+a.length;e.pbkdf2Salt=Fn.getHexOfV_AtObj(t,a[0]);var u=Fn.getHexOfV_AtObj(t,a[1]);try{e.pbkdf2Iter=parseInt(u,16)}catch(h){throw"malformed format pbkdf2Iter: "+u}return e},getPBKDF2KeyHexFromParam:function(t,e){var r=sn.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,i=sn.PBKDF2(e,r,{keySize:6,iterations:n}),s=sn.enc.Hex.stringify(i);return s},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=this.getHexFromPEM(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=Pn.getPBKDF2KeyHexFromParam(n,e),s={};s.ciphertext=sn.enc.Hex.parse(n.ciphertext);var o=sn.enc.Hex.parse(i),a=sn.enc.Hex.parse(n.encryptionSchemeIV),u=sn.TripleDES.decrypt(s,o,{iv:a}),h=sn.enc.Hex.stringify(u);return h},getRSAKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e),n=this.getRSAKeyFromPlainPKCS8Hex(r);return n},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e),n=this.getKeyFromPlainPrivatePKCS8Hex(r);return n},parsePlainPrivatePKCS8Hex:function(t){var e={};if(e.algparam=null,"30"!=t.substr(0,2))throw"malformed plain PKCS8 private key(code:001)";var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(3!=r.length)throw"malformed plain PKCS8 private key(code:002)";if("30"!=t.substr(r[1],2))throw"malformed PKCS8 private key(code:003)";var n=Fn.getPosArrayOfChildren_AtObj(t,r[1]);if(2!=n.length)throw"malformed PKCS8 private key(code:004)";if("06"!=t.substr(n[0],2))throw"malformed PKCS8 private key(code:005)";if(e.algoid=Fn.getHexOfV_AtObj(t,n[0]),"06"==t.substr(n[1],2)&&(e.algparam=Fn.getHexOfV_AtObj(t,n[1])),"04"!=t.substr(r[2],2))throw"malformed PKCS8 private key(code:006)";return e.keyidx=Fn.getStartPosOfV_AtObj(t,r[2]),e},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PRIVATE KEY"),r=this.getKeyFromPlainPrivatePKCS8Hex(e);return r},getKeyFromPlainPrivatePKCS8Hex:function(t){var e=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==e.algoid){this.parsePrivateRawRSAKeyHexAtObj(t,e);var r=e.key,n=new ve;return n.setPrivateEx(r.n,r.e,r.d,r.p,r.q,r.dp,r.dq,r.co),n}if("2a8648ce3d0201"==e.algoid){if(this.parsePrivateRawECKeyHexAtObj(t,e),void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var i=KJUR.crypto.OID.oidhex2name[e.algparam],n=new KJUR.crypto.ECDSA({curve:i,prv:e.key});return n}throw"unsupported private key algorithm"},getRSAKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getRSAKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8Hex:function(t){var e=this.parsePublicPKCS8Hex(t);if("2a864886f70d010101"==e.algoid){var r=this.parsePublicRawRSAKeyHex(e.key),n=new ve;return n.setPublic(r.n,r.e),n}if("2a8648ce3d0201"==e.algoid){if(void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var i=KJUR.crypto.OID.oidhex2name[e.algparam],n=new KJUR.crypto.ECDSA({curve:i,pub:e.key});return n}throw"unsupported public key algorithm"},parsePublicRawRSAKeyHex:function(t){var e={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"malformed RSA key(code:002)";if("02"!=t.substr(r[0],2))throw"malformed RSA key(code:003)";if(e.n=Fn.getHexOfV_AtObj(t,r[0]),"02"!=t.substr(r[1],2))throw"malformed RSA key(code:004)";return e.e=Fn.getHexOfV_AtObj(t,r[1]),e},parsePrivateRawRSAKeyHexAtObj:function(t,e){var r=e.keyidx;if("30"!=t.substr(r,2))throw"malformed RSA private key(code:001)";var n=Fn.getPosArrayOfChildren_AtObj(t,r);if(9!=n.length)throw"malformed RSA private key(code:002)";e.key={},e.key.n=Fn.getHexOfV_AtObj(t,n[1]),e.key.e=Fn.getHexOfV_AtObj(t,n[2]),e.key.d=Fn.getHexOfV_AtObj(t,n[3]),e.key.p=Fn.getHexOfV_AtObj(t,n[4]),e.key.q=Fn.getHexOfV_AtObj(t,n[5]),e.key.dp=Fn.getHexOfV_AtObj(t,n[6]),e.key.dq=Fn.getHexOfV_AtObj(t,n[7]),e.key.co=Fn.getHexOfV_AtObj(t,n[8])},parsePrivateRawECKeyHexAtObj:function(t,e){var r=e.keyidx;if("30"!=t.substr(r,2))throw"malformed ECC private key(code:001)";var n=Fn.getPosArrayOfChildren_AtObj(t,r);if(3!=n.length)throw"malformed ECC private key(code:002)";if("04"!=t.substr(n[1],2))throw"malformed ECC private key(code:003)";e.key=Fn.getHexOfV_AtObj(t,n[1])},parsePublicPKCS8Hex:function(t){var e={};e.algparam=null;var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"outer DERSequence shall have 2 elements: "+r.length;var n=r[0];if("30"!=t.substr(n,2))throw"malformed PKCS8 public key(code:001)";var i=Fn.getPosArrayOfChildren_AtObj(t,n);if(2!=i.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(i[0],2))throw"malformed PKCS8 public key(code:003)";if(e.algoid=Fn.getHexOfV_AtObj(t,i[0]),"06"==t.substr(i[1],2)&&(e.algparam=Fn.getHexOfV_AtObj(t,i[1])),"03"!=t.substr(r[1],2))throw"malformed PKCS8 public key(code:004)";return e.key=Fn.getHexOfV_AtObj(t,r[1]).substr(2),e},getRSAKeyFromPublicPKCS8Hex:function(t){var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=e.length)throw"outer DERSequence shall have 2 elements: "+e.length;var r=Fn.getHexOfTLV_AtObj(t,e[0]);if("300d06092a864886f70d0101010500"!=r)throw"PKCS8 AlgorithmId is not rsaEncryption";if("03"!=t.substr(e[1],2))throw"PKCS8 Public Key is not BITSTRING encapslated.";var n=Fn.getStartPosOfV_AtObj(t,e[1])+2;if("30"!=t.substr(n,2))throw"PKCS8 Public Key is not SEQUENCE.";var i=Fn.getPosArrayOfChildren_AtObj(t,n);if(2!=i.length)throw"inner DERSequence shall have 2 elements: "+i.length;if("02"!=t.substr(i[0],2))throw"N is not ASN.1 INTEGER";if("02"!=t.substr(i[1],2))throw"E is not ASN.1 INTEGER";var s=Fn.getHexOfV_AtObj(t,i[0]),o=Fn.getHexOfV_AtObj(t,i[1]),a=new ve;return a.setPublic(s,o),a}}}(),In=function(){var t=function(t,e,r){return n(sn.AES,t,e,r)},e=function(t,e,r){return n(sn.TripleDES,t,e,r)},r=function(t,e,r){return n(sn.DES,t,e,r)},n=function(t,e,r,n){var i=sn.enc.Hex.parse(e),s=sn.enc.Hex.parse(r),o=sn.enc.Hex.parse(n),a={};a.key=s,a.iv=o,a.ciphertext=i;var u=t.decrypt(a,s,{iv:o});return sn.enc.Hex.stringify(u)},s=function(t,e,r){return h(sn.AES,t,e,r)},a=function(t,e,r){return h(sn.TripleDES,t,e,r)},u=function(t,e,r){return h(sn.DES,t,e,r)},h=function(t,e,r,n){var i=sn.enc.Hex.parse(e),s=sn.enc.Hex.parse(r),o=sn.enc.Hex.parse(n),a=t.encrypt(i,s,{iv:o}),u=sn.enc.Hex.parse(a.toString()),h=sn.enc.Base64.stringify(u);return h},c={"AES-256-CBC":{proc:t,eproc:s,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:s,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:s,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:e,eproc:a,keylen:24,ivlen:8},"DES-CBC":{proc:r,eproc:u,keylen:8,ivlen:8}},f=function(t){return c[t].proc},l=function(t){var e=sn.lib.WordArray.random(t),r=sn.enc.Hex.stringify(e);return r},d=function(t){var e={};t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"))&&(e.cipher=RegExp.$1,e.ivsalt=RegExp.$2),t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"))&&(e.type=RegExp.$1);var r=-1,n=0;-1!=t.indexOf("\r\n\r\n")&&(r=t.indexOf("\r\n\r\n"),n=2),-1!=t.indexOf("\n\n")&&(r=t.indexOf("\n\n"),n=1);var i=t.indexOf("-----END");if(-1!=r&&-1!=i){var s=t.substring(r+2*n,i-n);s=s.replace(/\s+/g,""),e.data=s}return e},p=function(t,e,r){for(var n=r.substring(0,16),i=sn.enc.Hex.parse(n),s=sn.enc.Utf8.parse(e),o=c[t].keylen+c[t].ivlen,a="",u=null;;){var h=sn.algo.MD5.create();if(null!=u&&h.update(u),h.update(s),h.update(i),u=h.finalize(),a+=sn.enc.Hex.stringify(u),a.length>=2*o)break}var f={};return f.keyhex=a.substr(0,2*c[t].keylen),f.ivhex=a.substr(2*c[t].keylen,2*c[t].ivlen),f},g=function(t,e,r,n){var i=sn.enc.Base64.parse(t),s=sn.enc.Hex.stringify(i),o=c[e].proc,a=o(s,r,n);return a},y=function(t,e,r,n){var i=c[e].eproc,s=i(t,r,n);return s};return{version:"1.0.0",getHexFromPEM:function(t,e){var r=t;if(-1==r.indexOf("-----BEGIN "))throw"can't find PEM header: "+e;"string"==typeof e&&""!=e?(r=r.replace("-----BEGIN "+e+"-----",""),r=r.replace("-----END "+e+"-----","")):(r=r.replace(/-----BEGIN [^-]+-----/,""),r=r.replace(/-----END [^-]+-----/,""));var n=r.replace(/\s+/g,""),s=i(n);return s},getDecryptedKeyHexByKeyIV:function(t,e,r,n){var i=f(e);return i(t,r,n)},parsePKCS5PEM:function(t){return d(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return p(t,e,r)},decryptKeyB64:function(t,e,r,n){return g(t,e,r,n)},getDecryptedKeyHex:function(t,e){var r=d(t),n=(r.type,r.cipher),i=r.ivsalt,s=r.data,o=p(n,e,i),a=o.keyhex,u=g(s,n,a,i);return u},getRSAKeyFromEncryptedPKCS5PEM:function(t,e){var r=this.getDecryptedKeyHex(t,e),n=new ve;return n.readPrivateKeyFromASN1HexString(r),n},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,n,i){var s="";if("undefined"!=typeof n&&null!=n||(n="AES-256-CBC"),"undefined"==typeof c[n])throw"KEYUTIL unsupported algorithm: "+n;if("undefined"==typeof i||null==i){var o=c[n].ivlen,a=l(o);i=a.toUpperCase()}var u=p(n,r,i),h=u.keyhex,f=y(e,n,h,i),d=f.replace(/(.{64})/g,"$1\r\n"),s="-----BEGIN "+t+" PRIVATE KEY-----\r\n";return s+="Proc-Type: 4,ENCRYPTED\r\n",s+="DEK-Info: "+n+","+i+"\r\n",s+="\r\n",s+=d,s+="\r\n-----END "+t+" PRIVATE KEY-----\r\n"},getEncryptedPKCS5PEMFromRSAKey:function(t,e,r,n){var i=new KJUR.asn1.DERInteger({"int":0}),s=new KJUR.asn1.DERInteger({bigint:t.n}),o=new KJUR.asn1.DERInteger({"int":t.e}),a=new KJUR.asn1.DERInteger({bigint:t.d}),u=new KJUR.asn1.DERInteger({bigint:t.p}),h=new KJUR.asn1.DERInteger({bigint:t.q}),c=new KJUR.asn1.DERInteger({bigint:t.dmp1}),f=new KJUR.asn1.DERInteger({bigint:t.dmq1}),l=new KJUR.asn1.DERInteger({bigint:t.coeff}),d=new KJUR.asn1.DERSequence({array:[i,s,o,a,u,h,c,f,l]}),p=d.getEncodedHex();return this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",p,e,r,n)},newEncryptedPKCS5PEM:function(t,e,r,n){"undefined"!=typeof e&&null!=e||(e=1024),"undefined"!=typeof r&&null!=r||(r="10001");var i=new ve;i.generate(e,r);var s=null;return s="undefined"==typeof n||null==n?this.getEncryptedPKCS5PEMFromRSAKey(i,t):this.getEncryptedPKCS5PEMFromRSAKey(i,t,n)},getRSAKeyFromPlainPKCS8PEM:function(t){if(t.match(/ENCRYPTED/))throw"pem shall be not ENCRYPTED";var e=this.getHexFromPEM(t,"PRIVATE KEY"),r=this.getRSAKeyFromPlainPKCS8Hex(e);return r},getRSAKeyFromPlainPKCS8Hex:function(t){var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(3!=e.length)throw"outer DERSequence shall have 3 elements: "+e.length;var r=Fn.getHexOfTLV_AtObj(t,e[1]);if("300d06092a864886f70d0101010500"!=r)throw"PKCS8 AlgorithmIdentifier is not rsaEnc: "+r;var r=Fn.getHexOfTLV_AtObj(t,e[1]),n=Fn.getHexOfTLV_AtObj(t,e[2]),i=Fn.getHexOfV_AtObj(n,0),s=new ve;return s.readPrivateKeyFromASN1HexString(i),s},parseHexOfEncryptedPKCS8:function(t){var e={},r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"malformed format: SEQUENCE(0).items != 2: "+r.length;e.ciphertext=Fn.getHexOfV_AtObj(t,r[1]);var n=Fn.getPosArrayOfChildren_AtObj(t,r[0]);if(2!=n.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+n.length;if("2a864886f70d01050d"!=Fn.getHexOfV_AtObj(t,n[0]))throw"this only supports pkcs5PBES2";var i=Fn.getPosArrayOfChildren_AtObj(t,n[1]);if(2!=n.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+i.length;var s=Fn.getPosArrayOfChildren_AtObj(t,i[1]);if(2!=s.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+s.length;if("2a864886f70d0307"!=Fn.getHexOfV_AtObj(t,s[0]))throw"this only supports TripleDES";e.encryptionSchemeAlg="TripleDES",e.encryptionSchemeIV=Fn.getHexOfV_AtObj(t,s[1]);var o=Fn.getPosArrayOfChildren_AtObj(t,i[0]);if(2!=o.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+o.length;if("2a864886f70d01050c"!=Fn.getHexOfV_AtObj(t,o[0]))throw"this only supports pkcs5PBKDF2";var a=Fn.getPosArrayOfChildren_AtObj(t,o[1]);if(a.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+a.length;e.pbkdf2Salt=Fn.getHexOfV_AtObj(t,a[0]);var u=Fn.getHexOfV_AtObj(t,a[1]);try{e.pbkdf2Iter=parseInt(u,16)}catch(h){throw"malformed format pbkdf2Iter: "+u}return e},getPBKDF2KeyHexFromParam:function(t,e){var r=sn.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,i=sn.PBKDF2(e,r,{keySize:6,iterations:n}),s=sn.enc.Hex.stringify(i);return s},getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=this.getHexFromPEM(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=In.getPBKDF2KeyHexFromParam(n,e),s={};s.ciphertext=sn.enc.Hex.parse(n.ciphertext);var o=sn.enc.Hex.parse(i),a=sn.enc.Hex.parse(n.encryptionSchemeIV),u=sn.TripleDES.decrypt(s,o,{iv:a}),h=sn.enc.Hex.stringify(u);return h},getRSAKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e),n=this.getRSAKeyFromPlainPKCS8Hex(r);return n},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e),n=this.getKeyFromPlainPrivatePKCS8Hex(r);return n},parsePlainPrivatePKCS8Hex:function(t){var e={};if(e.algparam=null,"30"!=t.substr(0,2))throw"malformed plain PKCS8 private key(code:001)";var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(3!=r.length)throw"malformed plain PKCS8 private key(code:002)";if("30"!=t.substr(r[1],2))throw"malformed PKCS8 private key(code:003)";var n=Fn.getPosArrayOfChildren_AtObj(t,r[1]);if(2!=n.length)throw"malformed PKCS8 private key(code:004)";if("06"!=t.substr(n[0],2))throw"malformed PKCS8 private key(code:005)";if(e.algoid=Fn.getHexOfV_AtObj(t,n[0]),"06"==t.substr(n[1],2)&&(e.algparam=Fn.getHexOfV_AtObj(t,n[1])),"04"!=t.substr(r[2],2))throw"malformed PKCS8 private key(code:006)";return e.keyidx=Fn.getStartPosOfV_AtObj(t,r[2]),e},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PRIVATE KEY"),r=this.getKeyFromPlainPrivatePKCS8Hex(e);return r},getKeyFromPlainPrivatePKCS8Hex:function(t){var e=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==e.algoid){this.parsePrivateRawRSAKeyHexAtObj(t,e);var r=e.key,n=new ve;return n.setPrivateEx(r.n,r.e,r.d,r.p,r.q,r.dp,r.dq,r.co),n}if("2a8648ce3d0201"==e.algoid){if(this.parsePrivateRawECKeyHexAtObj(t,e),void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var i=KJUR.crypto.OID.oidhex2name[e.algparam],n=new KJUR.crypto.ECDSA({curve:i});return n.setPublicKeyHex(e.pubkey),n.setPrivateKeyHex(e.key),n.isPublic=!1,n}if("2a8648ce380401"==e.algoid){var s=Fn.getVbyList(t,0,[1,1,0],"02"),a=Fn.getVbyList(t,0,[1,1,1],"02"),u=Fn.getVbyList(t,0,[1,1,2],"02"),h=Fn.getVbyList(t,0,[2,0],"02"),c=new o(s,16),f=new o(a,16),l=new o(u,16),d=new o(h,16),n=new KJUR.crypto.DSA;return n.setPrivate(c,f,l,null,d),n}throw"unsupported private key algorithm"},getRSAKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getRSAKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8PEM:function(t){var e=this.getHexFromPEM(t,"PUBLIC KEY"),r=this.getKeyFromPublicPKCS8Hex(e);return r},getKeyFromPublicPKCS8Hex:function(t){var e=this.parsePublicPKCS8Hex(t);if("2a864886f70d010101"==e.algoid){var r=this.parsePublicRawRSAKeyHex(e.key),n=new ve;return n.setPublic(r.n,r.e),n}if("2a8648ce3d0201"==e.algoid){if(void 0===KJUR.crypto.OID.oidhex2name[e.algparam])throw"KJUR.crypto.OID.oidhex2name undefined: "+e.algparam;var i=KJUR.crypto.OID.oidhex2name[e.algparam],n=new KJUR.crypto.ECDSA({curve:i,pub:e.key});return n}if("2a8648ce380401"==e.algoid){var s=e.algparam,a=Fn.getHexOfV_AtObj(e.key,0),n=new KJUR.crypto.DSA;return n.setPublic(new o(s.p,16),new o(s.q,16),new o(s.g,16),new o(a,16)),n}throw"unsupported public key algorithm"},parsePublicRawRSAKeyHex:function(t){var e={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"malformed RSA key(code:002)";if("02"!=t.substr(r[0],2))throw"malformed RSA key(code:003)";if(e.n=Fn.getHexOfV_AtObj(t,r[0]),"02"!=t.substr(r[1],2))throw"malformed RSA key(code:004)";return e.e=Fn.getHexOfV_AtObj(t,r[1]),e},parsePrivateRawRSAKeyHexAtObj:function(t,e){var r=e.keyidx;if("30"!=t.substr(r,2))throw"malformed RSA private key(code:001)";var n=Fn.getPosArrayOfChildren_AtObj(t,r);if(9!=n.length)throw"malformed RSA private key(code:002)";e.key={},e.key.n=Fn.getHexOfV_AtObj(t,n[1]),e.key.e=Fn.getHexOfV_AtObj(t,n[2]),e.key.d=Fn.getHexOfV_AtObj(t,n[3]),e.key.p=Fn.getHexOfV_AtObj(t,n[4]),e.key.q=Fn.getHexOfV_AtObj(t,n[5]),e.key.dp=Fn.getHexOfV_AtObj(t,n[6]),e.key.dq=Fn.getHexOfV_AtObj(t,n[7]),e.key.co=Fn.getHexOfV_AtObj(t,n[8])},parsePrivateRawECKeyHexAtObj:function(t,e){var r=e.keyidx,n=Fn.getVbyList(t,r,[1],"04"),i=Fn.getVbyList(t,r,[2,0],"03").substr(2);e.key=n,e.pubkey=i},parsePublicPKCS8Hex:function(t){var e={};e.algparam=null;var r=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=r.length)throw"outer DERSequence shall have 2 elements: "+r.length;var n=r[0];if("30"!=t.substr(n,2))throw"malformed PKCS8 public key(code:001)";var i=Fn.getPosArrayOfChildren_AtObj(t,n);if(2!=i.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(i[0],2))throw"malformed PKCS8 public key(code:003)";if(e.algoid=Fn.getHexOfV_AtObj(t,i[0]),"06"==t.substr(i[1],2)?e.algparam=Fn.getHexOfV_AtObj(t,i[1]):"30"==t.substr(i[1],2)&&(e.algparam={},e.algparam.p=Fn.getVbyList(t,i[1],[0],"02"),e.algparam.q=Fn.getVbyList(t,i[1],[1],"02"),e.algparam.g=Fn.getVbyList(t,i[1],[2],"02")),"03"!=t.substr(r[1],2))throw"malformed PKCS8 public key(code:004)";return e.key=Fn.getHexOfV_AtObj(t,r[1]).substr(2),e},getRSAKeyFromPublicPKCS8Hex:function(t){var e=Fn.getPosArrayOfChildren_AtObj(t,0);if(2!=e.length)throw"outer DERSequence shall have 2 elements: "+e.length;var r=Fn.getHexOfTLV_AtObj(t,e[0]);if("300d06092a864886f70d0101010500"!=r)throw"PKCS8 AlgorithmId is not rsaEncryption";if("03"!=t.substr(e[1],2))throw"PKCS8 Public Key is not BITSTRING encapslated.";var n=Fn.getStartPosOfV_AtObj(t,e[1])+2;if("30"!=t.substr(n,2))throw"PKCS8 Public Key is not SEQUENCE.";var i=Fn.getPosArrayOfChildren_AtObj(t,n);if(2!=i.length)throw"inner DERSequence shall have 2 elements: "+i.length;if("02"!=t.substr(i[0],2))throw"N is not ASN.1 INTEGER";if("02"!=t.substr(i[1],2))throw"E is not ASN.1 INTEGER";var s=Fn.getHexOfV_AtObj(t,i[0]),o=Fn.getHexOfV_AtObj(t,i[1]),a=new ve;return a.setPublic(s,o),a}}}();In.getKey=function(t,e,r){if("undefined"!=typeof ve&&t instanceof ve)return t;if("undefined"!=typeof KJUR.crypto.ECDSA&&t instanceof KJUR.crypto.ECDSA)return t;if("undefined"!=typeof KJUR.crypto.DSA&&t instanceof KJUR.crypto.DSA)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new KJUR.crypto.ECDSA({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new KJUR.crypto.ECDSA({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d){var n=new ve;return n.setPublic(t.n,t.e),n}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){var n=new ve;return n.setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),n}if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p){var n=new ve;return n.setPrivate(t.n,t.e,t.d),n}if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x){var n=new KJUR.crypto.DSA;return n.setPublic(t.p,t.q,t.g,t.y),n}if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x){var n=new KJUR.crypto.DSA;return n.setPrivate(t.p,t.q,t.g,t.y,t.x),n}if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d){var n=new ve;return n.setPublic(pr(t.n),pr(t.e)),n}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){var n=new ve;return n.setPrivateEx(pr(t.n),pr(t.e),pr(t.d),pr(t.p),pr(t.q),pr(t.dp),pr(t.dq),pr(t.qi)),n}if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d){var n=new ve;return n.setPrivate(pr(t.n),pr(t.e),pr(t.d)),n}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var i=new KJUR.crypto.ECDSA({curve:t.crv}),s=i.ecparams.keylen/4,a=("0000000000"+pr(t.x)).slice(-s),u=("0000000000"+pr(t.y)).slice(-s),h="04"+a+u;return i.setPublicKeyHex(h),i}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){var i=new KJUR.crypto.ECDSA({curve:t.crv}),s=i.ecparams.keylen/4,c=("0000000000"+pr(t.d)).slice(-s);return i.setPrivateKeyHex(c),i}if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Gr.getPublicKeyFromCertPEM(t);if("pkcs8pub"===r)return In.getKeyFromPublicPKCS8Hex(t);if(-1!=t.indexOf("-END PUBLIC KEY-"))return In.getKeyFromPublicPKCS8PEM(t);if("pkcs5prv"===r){var n=new ve;return n.readPrivateKeyFromASN1HexString(t),n}if("pkcs5prv"===r){var n=new ve;return n.readPrivateKeyFromASN1HexString(t),n}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var f=In.getHexFromPEM(t,"RSA PRIVATE KEY");return In.getKey(f,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var l=this.getHexFromPEM(t,"DSA PRIVATE KEY"),d=Fn.getVbyList(l,0,[1],"02"),p=Fn.getVbyList(l,0,[2],"02"),g=Fn.getVbyList(l,0,[3],"02"),y=Fn.getVbyList(l,0,[4],"02"),v=Fn.getVbyList(l,0,[5],"02"),n=new KJUR.crypto.DSA;return n.setPrivate(new o(d,16),new o(p,16),new o(g,16),new o(y,16),new o(v,16)),n}if(-1!=t.indexOf("-END PRIVATE KEY-"))return In.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED"))return In.getRSAKeyFromEncryptedPKCS5PEM(t,e);if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var l=In.getDecryptedKeyHex(t,e),n=Fn.getVbyList(l,0,[1],"04"),m=Fn.getVbyList(l,0,[2,0],"06"),S=Fn.getVbyList(l,0,[3,0],"03").substr(2),_="";if(void 0===KJUR.crypto.OID.oidhex2name[m])throw"undefined OID(hex) in KJUR.crypto.OID: "+m;_=KJUR.crypto.OID.oidhex2name[m];var i=new KJUR.crypto.ECDSA({name:_});return i.setPublicKeyHex(S),i.setPrivateKeyHex(n),i.isPublic=!1,i}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var l=In.getDecryptedKeyHex(t,e),d=Fn.getVbyList(l,0,[1],"02"),p=Fn.getVbyList(l,0,[2],"02"),g=Fn.getVbyList(l,0,[3],"02"),y=Fn.getVbyList(l,0,[4],"02"),v=Fn.getVbyList(l,0,[5],"02"),n=new KJUR.crypto.DSA;return n.setPrivate(new o(d,16),new o(p,16),new o(g,16),new o(y,16),new o(v,16)),n}if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return In.getKeyFromEncryptedPKCS8PEM(t,e);throw"not supported argument"},In.generateKeypair=function(t,e){if("RSA"==t){var r=e,n=new ve;n.generate(r,"10001"),n.isPrivate=!0,n.isPublic=!0;var i=new ve,s=n.n.toString(16),o=n.e.toString(16);i.setPublic(s,o),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=i,a}if("EC"==t){var u=e,h=new KJUR.crypto.ECDSA({curve:u}),c=h.generateKeyPairHex(),n=new KJUR.crypto.ECDSA({curve:u});n.setPrivateKeyHex(c.ecprvhex),n.isPrivate=!0,n.isPublic=!1;var i=new KJUR.crypto.ECDSA({curve:u});i.setPublicKeyHex(c.ecpubhex),i.isPrivate=!1,i.isPublic=!0;var a={};return a.prvKeyObj=n,a.pubKeyObj=i,a}throw"unknown algorithm: "+t},In.getPEM=function(t,e,r,n,i){function s(t){var e=KJUR.asn1.ASN1Util.newObject({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}}]});return e}function o(t){var e=KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]});return e}function a(t){var e=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{"int":{bigint:t.p}},{"int":{bigint:t.q}},{"int":{bigint:t.g}},{"int":{bigint:t.y}},{"int":{bigint:t.x}}]});return e}var u=KJUR.asn1,h=KJUR.crypto;if(("undefined"!=typeof ve&&t instanceof ve||"undefined"!=typeof h.DSA&&t instanceof h.DSA||"undefined"!=typeof h.ECDSA&&t instanceof h.ECDSA)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e)){var c=new KJUR.asn1.x509.SubjectPublicKeyInfo(t),f=c.getEncodedHex();return u.ASN1Util.getPEMStringFromHex(f,"PUBLIC KEY")}if("PKCS1PRV"==e&&"undefined"!=typeof ve&&t instanceof ve&&(void 0===r||null==r)&&1==t.isPrivate){var c=s(t),f=c.getEncodedHex();return u.ASN1Util.getPEMStringFromHex(f,"RSA PRIVATE KEY")}if("PKCS1PRV"==e&&"undefined"!=typeof ve&&t instanceof KJUR.crypto.ECDSA&&(void 0===r||null==r)&&1==t.isPrivate){var l=new KJUR.asn1.DERObjectIdentifier({name:t.curveName}),d=l.getEncodedHex(),p=o(t),g=p.getEncodedHex(),y="";return y+=u.ASN1Util.getPEMStringFromHex(d,"EC PARAMETERS"),y+=u.ASN1Util.getPEMStringFromHex(g,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&"undefined"!=typeof KJUR.crypto.DSA&&t instanceof KJUR.crypto.DSA&&(void 0===r||null==r)&&1==t.isPrivate){var c=a(t),f=c.getEncodedHex();return u.ASN1Util.getPEMStringFromHex(f,"DSA PRIVATE KEY")}if("PKCS5PRV"==e&&"undefined"!=typeof ve&&t instanceof ve&&void 0!==r&&null!=r&&1==t.isPrivate){var c=s(t),f=c.getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",f,r,n)}if("PKCS5PRV"==e&&"undefined"!=typeof KJUR.crypto.ECDSA&&t instanceof KJUR.crypto.ECDSA&&void 0!==r&&null!=r&&1==t.isPrivate){var c=o(t),f=c.getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",f,r,n)}if("PKCS5PRV"==e&&"undefined"!=typeof KJUR.crypto.DSA&&t instanceof KJUR.crypto.DSA&&void 0!==r&&null!=r&&1==t.isPrivate){var c=a(t),f=c.getEncodedHex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",f,r,n)}var v=function(t,e){var r=m(t,e),n=new KJUR.asn1.ASN1Util.newObject({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:r.pbkdf2Salt}},{"int":r.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:r.encryptionSchemeIV}}]}]}]},{octstr:{hex:r.ciphertext}}]});return n.getEncodedHex()},m=function(t,e){var r=100,n=sn.lib.WordArray.random(8),i="DES-EDE3-CBC",s=sn.lib.WordArray.random(8),o=sn.PBKDF2(e,n,{keySize:6,iterations:r}),a=sn.enc.Hex.parse(t),u=sn.TripleDES.encrypt(a,o,{iv:s})+"",h={};return h.ciphertext=u,h.pbkdf2Salt=sn.enc.Hex.stringify(n),h.pbkdf2Iter=r,h.encryptionSchemeAlg=i,h.encryptionSchemeIV=sn.enc.Hex.stringify(s),h};if("PKCS8PRV"==e&&"undefined"!=typeof ve&&t instanceof ve&&1==t.isPrivate){var S=s(t),_=S.getEncodedHex(),c=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"rsaEncryption"}},{"null":!0}]},{octstr:{hex:_}}]}),f=c.getEncodedHex();if(void 0===r||null==r)return u.ASN1Util.getPEMStringFromHex(f,"PRIVATE KEY");var g=v(f,r);return u.ASN1Util.getPEMStringFromHex(g,"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&"undefined"!=typeof KJUR.crypto.ECDSA&&t instanceof KJUR.crypto.ECDSA&&1==t.isPrivate){var S=new KJUR.asn1.ASN1Util.newObject({seq:[{"int":1},{octstr:{hex:t.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]}),_=S.getEncodedHex(),c=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:_}}]}),f=c.getEncodedHex();if(void 0===r||null==r)return u.ASN1Util.getPEMStringFromHex(f,"PRIVATE KEY");var g=v(f,r);return u.ASN1Util.getPEMStringFromHex(g,"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&"undefined"!=typeof KJUR.crypto.DSA&&t instanceof KJUR.crypto.DSA&&1==t.isPrivate){var S=new KJUR.asn1.DERInteger({bigint:t.x}),_=S.getEncodedHex(),c=KJUR.asn1.ASN1Util.newObject({seq:[{"int":0},{seq:[{oid:{name:"dsa"}},{seq:[{"int":{bigint:t.p}},{"int":{bigint:t.q}},{"int":{bigint:t.g}}]}]},{octstr:{hex:_}}]}),f=c.getEncodedHex();if(void 0===r||null==r)return u.ASN1Util.getPEMStringFromHex(f,"PRIVATE KEY");var g=v(f,r);return u.ASN1Util.getPEMStringFromHex(g,"ENCRYPTED PRIVATE KEY")}throw"unsupported object nor format"},In.getKeyFromCSRPEM=function(t){var e=In.getHexFromPEM(t,"CERTIFICATE REQUEST"),r=In.getKeyFromCSRHex(e);return r},In.getKeyFromCSRHex=function(t){var e=In.parseCSRHex(t),r=In.getKey(e.p8pubkeyhex,null,"pkcs8pub");return r},In.parseCSRHex=function(t){var e={},r=t;if("30"!=r.substr(0,2))throw"malformed CSR(code:001)";var n=Fn.getPosArrayOfChildren_AtObj(r,0);if(n.length<1)throw"malformed CSR(code:002)";if("30"!=r.substr(n[0],2))throw"malformed CSR(code:003)";var i=Fn.getPosArrayOfChildren_AtObj(r,n[0]);if(i.length<3)throw"malformed CSR(code:004)";return e.p8pubkeyhex=Fn.getHexOfTLV_AtObj(r,i[2]),e},ve.prototype.readPrivateKeyFromPEMString=Pr,ve.prototype.readPrivateKeyFromASN1HexString=Or;var Dn=new RegExp("");Dn.compile("[^0-9a-f]","gi"),ve.prototype.signWithMessageHash=Cr,ve.prototype.signString=Dr,ve.prototype.signStringWithSHA1=Tr,ve.prototype.signStringWithSHA256=jr,ve.prototype.sign=Dr,ve.prototype.signWithSHA1=Tr,ve.prototype.signWithSHA256=jr,ve.prototype.signWithMessageHashPSS=Br,ve.prototype.signStringPSS=Hr,ve.prototype.signPSS=Hr,ve.SALT_LEN_HLEN=-1,ve.SALT_LEN_MAX=-2,ve.prototype.verifyWithMessageHash=zr,ve.prototype.verifyString=qr,ve.prototype.verifyHexSignatureForMessage=Lr, +ve.prototype.verify=qr,ve.prototype.verifyHexSignatureForByteArrayMessage=Lr,ve.prototype.verifyWithMessageHashPSS=Yr,ve.prototype.verifyStringPSS=Wr,ve.prototype.verifyPSS=Wr,ve.SALT_LEN_RECOVER=-2,Gr.pemToBase64=function(t){var e=t;return e=e.replace("-----BEGIN CERTIFICATE-----",""),e=e.replace("-----END CERTIFICATE-----",""),e=e.replace(/[ \n]+/g,"")},Gr.pemToHex=function(t){var e=Gr.pemToBase64(t),r=i(e);return r},Gr.getSubjectPublicKeyPosFromCertHex=function(t){var e=Gr.getSubjectPublicKeyInfoPosFromCertHex(t);if(-1==e)return-1;var r=Fn.getPosArrayOfChildren_AtObj(t,e);if(2!=r.length)return-1;var n=r[1];if("03"!=t.substring(n,n+2))return-1;var i=Fn.getStartPosOfV_AtObj(t,n);return"00"!=t.substring(i,i+2)?-1:i+2},Gr.getSubjectPublicKeyInfoPosFromCertHex=function(t){var e=Fn.getStartPosOfV_AtObj(t,0),r=Fn.getPosArrayOfChildren_AtObj(t,e);return r.length<1?-1:"a003020102"==t.substring(r[0],r[0]+10)?r.length<6?-1:r[6]:r.length<5?-1:r[5]},Gr.getPublicKeyHexArrayFromCertHex=function(t){var e=Gr.getSubjectPublicKeyPosFromCertHex(t),r=Fn.getPosArrayOfChildren_AtObj(t,e);if(2!=r.length)return[];var n=Fn.getHexOfV_AtObj(t,r[0]),i=Fn.getHexOfV_AtObj(t,r[1]);return null!=n&&null!=i?[n,i]:[]},Gr.getHexTbsCertificateFromCert=function(t){var e=Fn.getStartPosOfV_AtObj(t,0);return e},Gr.getPublicKeyHexArrayFromCertPEM=function(t){var e=Gr.pemToHex(t),r=Gr.getPublicKeyHexArrayFromCertHex(e);return r},Gr.hex2dn=function(t){for(var e="",r=Fn.getPosArrayOfChildren_AtObj(t,0),n=0;na;a++)o[a]=Gr.getV3ExtItemInfo_AtObj(t,i[a]);return o},Gr.getV3ExtItemInfo_AtObj=function(t,e){var r={};r.posTLV=e;var n=Fn.getPosArrayOfChildren_AtObj(t,e);if(2!=n.length&&3!=n.length)throw"malformed X.509v3 Ext (code:001)";if("06"!=t.substr(n[0],2))throw"malformed X.509v3 Ext (code:002)";var i=Fn.getHexOfV_AtObj(t,n[0]);r.oid=Fn.hextooidstr(i),r.critical=!1,3==n.length&&(r.critical=!0);var s=n[n.length-1];if("04"!=t.substr(s,2))throw"malformed X.509v3 Ext (code:003)";return r.posV=Fn.getStartPosOfV_AtObj(t,s),r},Gr.getHexOfTLV_V3ExtValue=function(t,e){var r=Gr.getPosOfTLV_V3ExtValue(t,e);return-1==r?null:Fn.getHexOfTLV_AtObj(t,r)},Gr.getHexOfV_V3ExtValue=function(t,e){var r=Gr.getPosOfTLV_V3ExtValue(t,e);return-1==r?null:Fn.getHexOfV_AtObj(t,r)},Gr.getPosOfTLV_V3ExtValue=function(t,e){var r=e;if(e.match(/^[0-9.]+$/)||(r=KJUR.asn1.x509.OID.name2oid(e)),""==r)return-1;for(var n=Gr.getV3ExtInfoListOfCertHex(t),i=0;i0){var l=":"+r.join(":")+":";if(-1==l.indexOf(":"+c+":"))throw"algorithm '"+c+"' not accepted in the list"}if("none"!=c&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=In.getKey(e)),!("RS"!=f&&"PS"!=f||e instanceof ve))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==f&&!(e instanceof KJUR.crypto.ECDSA))throw"key shall be a ECDSA obj for ES* algs";var d=null;if(void 0===n.jwsalg2sigalg[h.alg])throw"unsupported alg name: "+c;if(d=n.jwsalg2sigalg[c],"none"==d)throw"not supported";if("Hmac"==d.substr(0,4)){var p=null;if(void 0===e)throw"hexadecimal key shall be specified for HMAC";var g=new KJUR.crypto.Mac({alg:d,pass:e});return g.updateString(a),p=g.doFinal(),u==p}if(-1!=d.indexOf("withECDSA")){var y=null;try{y=KJUR.crypto.ECDSA.concatSigToASN1Sig(u)}catch(v){return!1}var m=new KJUR.crypto.Signature({alg:d});return m.init(e),m.updateString(a),m.verify(y)}var m=new KJUR.crypto.Signature({alg:d});return m.init(e),m.updateString(a),m.verify(u)},KJUR.jws.JWS.parse=function(t){var e,r,n,i=t.split("."),s={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=i[0],r=i[1],3==i.length&&(n=i[2]),s.headerObj=KJUR.jws.JWS.readSafeJSONString(Un(e)),s.payloadObj=KJUR.jws.JWS.readSafeJSONString(Un(r)),s.headerPP=JSON.stringify(s.headerObj,null," "),null==s.payloadObj?s.payloadPP=Un(r):s.payloadPP=JSON.stringify(s.payloadObj,null," "),void 0!==n&&(s.sigHex=pr(n)),s},KJUR.jws.JWS.verifyJWT=function(t,e,r){var n=KJUR.jws.JWS,i=t.split("."),s=i[0],o=i[1],a=(pr(i[2]),n.readSafeJSONString(Un(s))),u=n.readSafeJSONString(Un(o));if(void 0===a.alg)return!1;if(void 0===r.alg)throw"acceptField.alg shall be specified";if(!n.inArray(a.alg,r.alg))return!1;if(void 0!==u.iss&&"object"==typeof r.iss&&!n.inArray(u.iss,r.iss))return!1;if(void 0!==u.sub&&"object"==typeof r.sub&&!n.inArray(u.sub,r.sub))return!1;if(void 0!==u.aud&&"object"==typeof r.aud)if("string"==typeof u.aud){if(!n.inArray(u.aud,r.aud))return!1}else if("object"==typeof u.aud&&!n.includedArray(u.aud,r.aud))return!1;var h=KJUR.jws.IntDate.getNow();return void 0!==r.verifyAt&&"number"==typeof r.verifyAt&&(h=r.verifyAt),void 0!==r.gracePeriod&&"number"==typeof r.gracePeriod||(r.gracePeriod=0),void 0!==u.exp&&"number"==typeof u.exp&&u.exp+r.gracePeriod=50&&100>n)n=1900+n;else{if(!(n>=0&&50>n))throw"malformed year string for UTCTime";n=2e3+n}}var i=parseInt(RegExp.$2)-1,s=parseInt(RegExp.$3),o=parseInt(RegExp.$4),a=parseInt(RegExp.$5),u=parseInt(RegExp.$6),h=new Date(Date.UTC(n,i,s,o,a,u));return~~(h/1e3)}throw"unsupported format: "+t},KJUR.jws.IntDate.getNow=function(){var t=~~(new Date/1e3);return t},KJUR.jws.IntDate.intDate2UTCString=function(t){var e=new Date(1e3*t);return e.toUTCString()},KJUR.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t),r=("0000"+e.getUTCFullYear()).slice(-4),n=("00"+(e.getUTCMonth()+1)).slice(-2),i=("00"+e.getUTCDate()).slice(-2),s=("00"+e.getUTCHours()).slice(-2),o=("00"+e.getUTCMinutes()).slice(-2),a=("00"+e.getUTCSeconds()).slice(-2);return r+n+i+s+o+a+"Z"},"undefined"!=typeof KJUR&&KJUR||(KJUR={}),"undefined"!=typeof KJUR.jws&&KJUR.jws||(KJUR.jws={}),KJUR.jws.JWSJS=function(){var t=KJUR.jws.JWS;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload="",this.aSignature=[]},this.initWithJWS=function(t){this.init();var e=new KJUR.jws.JWS;e.parseJWS(t),this.aHeader.push(e.parsedJWS.headB64U),this.sPayload=e.parsedJWS.payloadB64U,this.aSignature.push(e.parsedJWS.sigvalB64U)},this.addSignatureByHeaderKey=function(t,e){var r=Un(this.sPayload),n=new KJUR.jws.JWS;n.generateJWSByP1PrvKey(t,r,e),this.aHeader.push(n.parsedJWS.headB64U),this.aSignature.push(n.parsedJWS.sigvalB64U)},this.addSignatureByHeaderPayloadKey=function(t,e,r){var n=new KJUR.jws.JWS;n.generateJWSByP1PrvKey(t,e,r),this.aHeader.push(n.parsedJWS.headB64U),this.sPayload=n.parsedJWS.payloadB64U,this.aSignature.push(n.parsedJWS.sigvalB64U)},this.verifyWithCerts=function(t){if(this.aHeader.length!=t.length)throw"num headers does not match with num certs";if(this.aSignature.length!=t.length)throw"num signatures does not match with num certs";for(var e=this.sPayload,r="",n=0;n1?arguments[1]:"utf8"):u(this,e)):arguments.length>1?new t(e,arguments[1]):new t(e)}function o(e,r){if(e=g(e,0>r?0:0|y(r)),!t.TYPED_ARRAY_SUPPORT)for(var n=0;r>n;n++)e[n]=0;return e}function a(t,e,r){"string"==typeof r&&""!==r||(r="utf8");var n=0|m(e,r);return t=g(t,n),t.write(e,r),t}function u(e,r){if(t.isBuffer(r))return h(e,r);if(X(r))return c(e,r);if(null==r)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(r.buffer instanceof ArrayBuffer)return f(e,r);if(r instanceof ArrayBuffer)return l(e,r)}return r.length?d(e,r):p(e,r)}function h(t,e){var r=0|y(e.length);return t=g(t,r),e.copy(t,0,0,r),t}function c(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function f(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function l(e,r){return t.TYPED_ARRAY_SUPPORT?(r.byteLength,e=t._augment(new Uint8Array(r))):e=f(e,new Uint8Array(r)),e}function d(t,e){var r=0|y(e.length);t=g(t,r);for(var n=0;r>n;n+=1)t[n]=255&e[n];return t}function p(t,e){var r,n=0;"Buffer"===e.type&&X(e.data)&&(r=e.data,n=0|y(r.length)),t=g(t,n);for(var i=0;n>i;i+=1)t[i]=255&r[i];return t}function g(e,r){t.TYPED_ARRAY_SUPPORT?(e=t._augment(new Uint8Array(r)),e.__proto__=t.prototype):(e.length=r,e._isBuffer=!0);var n=0!==r&&r<=t.poolSize>>>1;return n&&(e.parent=$),e}function y(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function v(e,r){if(!(this instanceof v))return new v(e,r);var n=new t(e,r);return delete n.parent,n}function m(t,e){"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(n)return V(t).length;e=(""+e).toLowerCase(),n=!0}}function S(t,e,r){var n=!1;if(e=0|e,r=void 0===r||r===1/0?this.length:0|r,t||(t="utf8"),0>e&&(e=0),r>this.length&&(r=this.length),e>=r)return"";for(;;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return F(this,e,r);case"ascii":return U(this,e,r);case"binary":return O(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function _(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var s=e.length;if(s%2!==0)throw new Error("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;n>o;o++){var a=parseInt(e.substr(2*o,2),16);if(isNaN(a))throw new Error("Invalid hex string");t[r+o]=a}return o}function E(t,e,r,n){return W(V(e,t.length-r),t,r,n)}function b(t,e,r,n){return W(L(e),t,r,n)}function w(t,e,r,n){return b(t,e,r,n)}function R(t,e,r,n){return W(z(e),t,r,n)}function x(t,e,r,n){return W(q(e,t.length-r),t,r,n)}function A(t,e,r){return 0===e&&r===t.length?Y.fromByteArray(t):Y.fromByteArray(t.slice(e,r))}function F(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;r>i;){var s=t[i],o=null,a=s>239?4:s>223?3:s>191?2:1;if(r>=i+a){var u,h,c,f;switch(a){case 1:128>s&&(o=s);break;case 2:u=t[i+1],128===(192&u)&&(f=(31&s)<<6|63&u,f>127&&(o=f));break;case 3:u=t[i+1],h=t[i+2],128===(192&u)&&128===(192&h)&&(f=(15&s)<<12|(63&u)<<6|63&h,f>2047&&(55296>f||f>57343)&&(o=f));break;case 4:u=t[i+1],h=t[i+2],c=t[i+3],128===(192&u)&&128===(192&h)&&128===(192&c)&&(f=(15&s)<<18|(63&u)<<12|(63&h)<<6|63&c,f>65535&&1114112>f&&(o=f))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return K(n)}function K(t){var e=t.length;if(Z>=e)return String.fromCharCode.apply(String,t);for(var r="",n=0;e>n;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Z));return r}function U(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(127&t[i]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;r>i;i++)n+=String.fromCharCode(t[i]);return n}function P(t,e,r){var n=t.length;(!e||0>e)&&(e=0),(!r||0>r||r>n)&&(r=n);for(var i="",s=e;r>s;s++)i+=M(t[s]);return i}function I(t,e,r){for(var n=t.slice(e,r),i="",s=0;st)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function C(e,r,n,i,s,o){if(!t.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(r>s||o>r)throw new RangeError("value is out of bounds");if(n+i>e.length)throw new RangeError("index out of range")}function T(t,e,r,n){0>e&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-r,2);s>i;i++)t[r+i]=(e&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(t,e,r,n){0>e&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-r,4);s>i;i++)t[r+i]=e>>>8*(n?i:3-i)&255}function J(t,e,r,n,i,s){if(e>i||s>e)throw new RangeError("value is out of bounds");if(r+n>t.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function H(t,e,r,n,i){return i||J(t,e,r,4,3.4028234663852886e38,-3.4028234663852886e38),G.write(t,e,r,n,23,4),r+4}function B(t,e,r,n,i){return i||J(t,e,r,8,1.7976931348623157e308,-1.7976931348623157e308),G.write(t,e,r,n,52,8),r+8}function k(t){if(t=N(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function N(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function M(t){return 16>t?"0"+t.toString(16):t.toString(16)}function V(t,e){e=e||1/0;for(var r,n=t.length,i=null,s=[],o=0;n>o;o++){if(r=t.charCodeAt(o),r>55295&&57344>r){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(56320>r){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,128>r){if((e-=1)<0)break;s.push(r)}else if(2048>r){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(65536>r){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function L(t){for(var e=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function z(t){return Y.toByteArray(k(t))}function W(t,e,r,n){for(var i=0;n>i&&!(i+r>=e.length||i>=t.length);i++)e[i+r]=t[i];return i}var Y=r(14),G=r(15),X=r(16);e.Buffer=t,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50,t.poolSize=8192;var $={};t.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:i(),t.TYPED_ARRAY_SUPPORT?(t.prototype.__proto__=Uint8Array.prototype,t.__proto__=Uint8Array):(t.prototype.length=void 0,t.prototype.parent=void 0),t.isBuffer=function(t){return!(null==t||!t._isBuffer)},t.compare=function(e,r){if(!t.isBuffer(e)||!t.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(e===r)return 0;for(var n=e.length,i=r.length,s=0,o=Math.min(n,i);o>s&&e[s]===r[s];)++s;return s!==o&&(n=e[s],i=r[s]),i>n?-1:n>i?1:0},t.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(e,r){if(!X(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new t(0);var n;if(void 0===r)for(r=0,n=0;n0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},t.prototype.compare=function(e){if(!t.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:t.compare(this,e)},t.prototype.indexOf=function(e,r){function n(t,e,r){for(var n=-1,i=0;r+i2147483647?r=2147483647:-2147483648>r&&(r=-2147483648),r>>=0,0===this.length)return-1;if(r>=this.length)return-1;if(0>r&&(r=Math.max(this.length+r,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,r);if(t.isBuffer(e))return n(this,e,r);if("number"==typeof e)return t.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,r):n(this,[e],r);throw new TypeError("val must be string, number or Buffer")},t.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},t.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},t.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=e,e=0|r,r=i}var s=this.length-e;if((void 0===r||r>s)&&(r=s),t.length>0&&(0>r||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,e,r);case"utf8":case"utf-8":return E(this,t,e,r);case"ascii":return b(this,t,e,r);case"binary":return w(this,t,e,r);case"base64":return R(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;t.prototype.slice=function(e,r){var n=this.length;e=~~e,r=void 0===r?n:~~r,0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),e>r&&(r=e);var i;if(t.TYPED_ARRAY_SUPPORT)i=t._augment(this.subarray(e,r));else{var s=r-e;i=new t(s,void 0);for(var o=0;s>o;o++)i[o]=this[o+e]}return i.length&&(i.parent=this.parent||this),i},t.prototype.readUIntLE=function(t,e,r){t=0|t,e=0|e,r||D(t,e,this.length);for(var n=this[t],i=1,s=0;++s0&&(i*=256);)n+=this[t+--e]*i;return n},t.prototype.readUInt8=function(t,e){return e||D(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,e){return e||D(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,e){return e||D(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,e){return e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,e){return e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,e,r){t=0|t,e=0|e,r||D(t,e,this.length);for(var n=this[t],i=1,s=0;++s=i&&(n-=Math.pow(2,8*e)),n},t.prototype.readIntBE=function(t,e,r){t=0|t,e=0|e,r||D(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},t.prototype.readInt8=function(t,e){return e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},t.prototype.readInt16LE=function(t,e){e||D(t,2,this.length); +var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt16BE=function(t,e){e||D(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},t.prototype.readInt32LE=function(t,e){return e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,e){return e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,e){return e||D(t,4,this.length),G.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,e){return e||D(t,4,this.length),G.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,e){return e||D(t,8,this.length),G.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,e){return e||D(t,8,this.length),G.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,e,r,n){t=+t,e=0|e,r=0|r,n||C(this,t,e,r,Math.pow(2,8*r),0);var i=1,s=0;for(this[e]=255&t;++s=0&&(s*=256);)this[e+i]=t/s&255;return e+r},t.prototype.writeUInt8=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,1,255,0),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[r]=255&e,r+1},t.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):T(this,e,r,!0),r+2},t.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):T(this,e,r,!1),r+2},t.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=255&e):j(this,e,r,!0),r+4},t.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):j(this,e,r,!1),r+4},t.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var s=0,o=1,a=0>t?1:0;for(this[e]=255&t;++s>0)-a&255;return e+r},t.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e=0|e,!n){var i=Math.pow(2,8*r-1);C(this,t,e,r,i-1,-i)}var s=r-1,o=1,a=0>t?1:0;for(this[e+s]=255&t;--s>=0&&(o*=256);)this[e+s]=(t/o>>0)-a&255;return e+r},t.prototype.writeInt8=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,1,127,-128),t.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[r]=255&e,r+1},t.prototype.writeInt16LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8):T(this,e,r,!0),r+2},t.prototype.writeInt16BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>8,this[r+1]=255&e):T(this,e,r,!1),r+2},t.prototype.writeInt32LE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[r]=255&e,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24):j(this,e,r,!0),r+4},t.prototype.writeInt32BE=function(e,r,n){return e=+e,r=0|r,n||C(this,e,r,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),t.TYPED_ARRAY_SUPPORT?(this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=255&e):j(this,e,r,!1),r+4},t.prototype.writeFloatLE=function(t,e,r){return H(this,t,e,!0,r)},t.prototype.writeFloatBE=function(t,e,r){return H(this,t,e,!1,r)},t.prototype.writeDoubleLE=function(t,e,r){return B(this,t,e,!0,r)},t.prototype.writeDoubleBE=function(t,e,r){return B(this,t,e,!1,r)},t.prototype.copy=function(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&&n>i&&(i=n),i===n)return 0;if(0===e.length||0===this.length)return 0;if(0>r)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>i)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-rn&&i>r)for(s=o-1;s>=0;s--)e[s+r]=this[s+n];else if(1e3>o||!t.TYPED_ARRAY_SUPPORT)for(s=0;o>s;s++)e[s+r]=this[s+n];else e._set(this.subarray(n,n+o),r);return o},t.prototype.fill=function(t,e,r){if(t||(t=0),e||(e=0),r||(r=this.length),e>r)throw new RangeError("end < start");if(r!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof t)for(n=e;r>n;n++)this[n]=t;else{var i=V(t.toString()),s=i.length;for(n=e;r>n;n++)this[n]=i[n%s]}return this}},t.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(t.TYPED_ARRAY_SUPPORT)return new t(this).buffer;for(var e=new Uint8Array(this.length),r=0,n=e.length;n>r;r+=1)e[r]=this[r];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Q=t.prototype;t._augment=function(e){return e.constructor=t,e._isBuffer=!0,e._set=e.set,e.get=Q.get,e.set=Q.set,e.write=Q.write,e.toString=Q.toString,e.toLocaleString=Q.toString,e.toJSON=Q.toJSON,e.equals=Q.equals,e.compare=Q.compare,e.indexOf=Q.indexOf,e.copy=Q.copy,e.slice=Q.slice,e.readUIntLE=Q.readUIntLE,e.readUIntBE=Q.readUIntBE,e.readUInt8=Q.readUInt8,e.readUInt16LE=Q.readUInt16LE,e.readUInt16BE=Q.readUInt16BE,e.readUInt32LE=Q.readUInt32LE,e.readUInt32BE=Q.readUInt32BE,e.readIntLE=Q.readIntLE,e.readIntBE=Q.readIntBE,e.readInt8=Q.readInt8,e.readInt16LE=Q.readInt16LE,e.readInt16BE=Q.readInt16BE,e.readInt32LE=Q.readInt32LE,e.readInt32BE=Q.readInt32BE,e.readFloatLE=Q.readFloatLE,e.readFloatBE=Q.readFloatBE,e.readDoubleLE=Q.readDoubleLE,e.readDoubleBE=Q.readDoubleBE,e.writeUInt8=Q.writeUInt8,e.writeUIntLE=Q.writeUIntLE,e.writeUIntBE=Q.writeUIntBE,e.writeUInt16LE=Q.writeUInt16LE,e.writeUInt16BE=Q.writeUInt16BE,e.writeUInt32LE=Q.writeUInt32LE,e.writeUInt32BE=Q.writeUInt32BE,e.writeIntLE=Q.writeIntLE,e.writeIntBE=Q.writeIntBE,e.writeInt8=Q.writeInt8,e.writeInt16LE=Q.writeInt16LE,e.writeInt16BE=Q.writeInt16BE,e.writeInt32LE=Q.writeInt32LE,e.writeInt32BE=Q.writeInt32BE,e.writeFloatLE=Q.writeFloatLE,e.writeFloatBE=Q.writeFloatBE,e.writeDoubleLE=Q.writeDoubleLE,e.writeDoubleBE=Q.writeDoubleBE,e.fill=Q.fill,e.inspect=Q.inspect,e.toArrayBuffer=Q.toArrayBuffer,e};var tt=/[^+\/0-9A-Za-z-_]/g}).call(e,r(13).Buffer,function(){return this}())},function(t,e,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===o||e===f?62:e===a||e===l?63:u>e?-1:u+10>e?e-u+26+26:c+26>e?e-c:h+26>e?e-h+26:void 0}function r(t){function r(t){h[f++]=t}var n,i,o,a,u,h;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=t.length;u="="===t.charAt(c-2)?2:"="===t.charAt(c-1)?1:0,h=new s(3*t.length/4-u),o=u>0?t.length-4:t.length;var f=0;for(n=0,i=0;o>n;n+=4,i+=3)a=e(t.charAt(n))<<18|e(t.charAt(n+1))<<12|e(t.charAt(n+2))<<6|e(t.charAt(n+3)),r((16711680&a)>>16),r((65280&a)>>8),r(255&a);return 2===u?(a=e(t.charAt(n))<<2|e(t.charAt(n+1))>>4,r(255&a)):1===u&&(a=e(t.charAt(n))<<10|e(t.charAt(n+1))<<4|e(t.charAt(n+2))>>2,r(a>>8&255),r(255&a)),h}function i(t){function e(t){return n.charAt(t)}function r(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var i,s,o,a=t.length%3,u="";for(i=0,o=t.length-a;o>i;i+=3)s=(t[i]<<16)+(t[i+1]<<8)+t[i+2],u+=r(s);switch(a){case 1:s=t[t.length-1],u+=e(s>>2),u+=e(s<<4&63),u+="==";break;case 2:s=(t[t.length-2]<<8)+t[t.length-1],u+=e(s>>10),u+=e(s>>4&63),u+=e(s<<2&63),u+="="}return u}var s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="+".charCodeAt(0),a="/".charCodeAt(0),u="0".charCodeAt(0),h="a".charCodeAt(0),c="A".charCodeAt(0),f="-".charCodeAt(0),l="_".charCodeAt(0);t.toByteArray=r,t.fromByteArray=i}(e)},function(t,e){e.read=function(t,e,r,n,i){var s,o,a=8*i-n-1,u=(1<>1,c=-7,f=r?i-1:0,l=r?-1:1,d=t[e+f];for(f+=l,s=d&(1<<-c)-1,d>>=-c,c+=a;c>0;s=256*s+t[e+f],f+=l,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=n;c>0;o=256*o+t[e+f],f+=l,c-=8);if(0===s)s=1-h;else{if(s===u)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),s-=h}return(d?-1:1)*o*Math.pow(2,s-n)},e.write=function(t,e,r,n,i,s){var o,a,u,h=8*s-i-1,c=(1<>1,l=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,p=n?1:-1,g=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),e+=o+f>=1?l/u:l*Math.pow(2,1-f),e*u>=2&&(o++,u/=2),o+f>=c?(a=0,o=c):o+f>=1?(a=(e*u-1)*Math.pow(2,i),o+=f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&a,d+=p,a/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,h-=8);t[r+d-p]|=128*g}},function(t,e){var r={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},function(t,e){},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=r(19),u=n(a),h=r(20),c=n(h),f=function(){function t(e){var r=e.url,n=e.client_id,s=e.redirect_uri,a=e.response_type,h=e.scope,f=e.authority,l=e.data,d=e.prompt,p=e.display,g=e.max_age,y=e.ui_locales,v=e.id_token_hint,m=e.login_hint,S=e.acr_values;if(i(this,t),!r)throw o["default"].error("No url passed to SigninRequest"),new Error("url");if(!n)throw o["default"].error("No client_id passed to SigninRequest"),new Error("client_id");if(!s)throw o["default"].error("No redirect_uri passed to SigninRequest"),new Error("redirect_uri");if(!a)throw o["default"].error("No response_type passed to SigninRequest"),new Error("response_type");if(!h)throw o["default"].error("No scope passed to SigninRequest"),new Error("scope");if(!f)throw o["default"].error("No authority passed to SigninRequest"),new Error("authority");var _=t.isOidc(a);this.state=new c["default"]({nonce:_,data:l,client_id:n,authority:f}),r=u["default"].addQueryParam(r,"client_id",n),r=u["default"].addQueryParam(r,"redirect_uri",s),r=u["default"].addQueryParam(r,"response_type",a),r=u["default"].addQueryParam(r,"scope",h),r=u["default"].addQueryParam(r,"state",this.state.id),_&&(r=u["default"].addQueryParam(r,"nonce",this.state.nonce));var E={prompt:d,display:p,max_age:g,ui_locales:y,id_token_hint:v,login_hint:m,acr_values:S};for(var b in E)E[b]&&(r=u["default"].addQueryParam(r,b,E[b]));this.url=r}return t.isOidc=function(t){var e=t.split(/\s+/g).filter(function(t){return"id_token"===t});return!!e[0]},t.isOAuth=function(t){var e=t.split(/\s+/g).filter(function(t){return"token"===t});return!!e[0]},t}();e["default"]=f,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=r(5),u=n(a),h=function(){function t(){i(this,t)}return t.addQueryParam=function(t,e,r){return t.indexOf("?")<0&&(t+="?"),"?"!==t[t.length-1]&&(t+="&"),t+=encodeURIComponent(e),t+="=",t+=encodeURIComponent(r)},t.parseUrlFragment=function(t){var e=arguments.length<=1||void 0===arguments[1]?"#":arguments[1],r=arguments.length<=2||void 0===arguments[2]?u["default"]:arguments[2];o["default"].info("UrlUtility.parseUrlFragment"),"string"!=typeof t&&(t=r.location.href);var n=t.lastIndexOf(e);n>=0&&(t=t.substr(n+1));for(var i,s={},a=/([^&=]+)=([^&]*)/g,h=0;i=a.exec(t);)if(s[decodeURIComponent(i[1])]=decodeURIComponent(i[2]),h++>50)return o["default"].error("response exceeded expected number of parameters",t),{error:"Response exceeded expected number of parameters"};for(var c in s)return s;return{}},t}();e["default"]=h,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function t(t,e){for(var r=0;r0?this._created=s:this._created=parseInt(Date.now()/1e3)}return t.prototype.toStorageString=function(){return a["default"].info("State.toStorageString"),JSON.stringify({id:this.id,data:this.data,created:this.created})},t.fromStorageString=function(e){return a["default"].info("State.fromStorageString"),new t(JSON.parse(e))},t.clearStaleState=function(e,r){a["default"].info("State.clearStaleState");var n=Date.now()/1e3-r;return e.getAllKeys().then(function(r){a["default"].info("got keys",r);var i=[],s=!0,o=!1,u=void 0;try{for(var h,c=function(){var r=h.value;l=e.get(r).then(function(i){var s=!1;if(i)try{var o=t.fromStorageString(i);a["default"].info("got item from key: ",r,o.created),o.created<=n&&(s=!0)}catch(u){a["default"].error("Error parsing state for key",r,u.message),s=!0}else a["default"].info("no item in storage for key: ",r),s=!0;return s?(a["default"].info("removed item for key: ",r),e.remove(r)):void 0}),i.push(l)},f=r[Symbol.iterator]();!(s=(h=f.next()).done);s=!0){var l;c()}}catch(d){o=!0,u=d}finally{try{!s&&f["return"]&&f["return"]()}finally{if(o)throw u}}return a["default"].info("waiting on promise count:",i.length),Promise.all(i)})},s(t,[{key:"id",get:function(){return this._id}},{key:"data",get:function(){return this._data}},{key:"created",get:function(){return this._created}}]),t}();e["default"]=c,t.exports=e["default"]},function(t,e){"use strict";function r(){for(var t="xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx",e="0123456789abcdef",r=0,n="",i=0;i0){var s=parseInt(Date.now()/1e3);this.expires_at=s+n}}return s(t,[{key:"expires_in",get:function(){if(this.expires_at){var t=parseInt(Date.now()/1e3);return this.expires_at-t}}},{key:"expired",get:function(){var t=this.expires_in;return void 0!==t?0>=t:void 0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}},{key:"isOpenIdConnect",get:function(){return this.scopes.indexOf(u)>=0}}]),t}();e["default"]=h,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=r(19),u=n(a),h=r(21),c=n(h),f=function l(t){var e=t.url,r=t.id_token_hint,n=t.post_logout_redirect_uri,s=t.data;if(i(this,l),!e)throw o["default"].error("No url passed to SignoutRequest"),new Error("url");r&&(e=u["default"].addQueryParam(e,"id_token_hint",r),n&&(e=u["default"].addQueryParam(e,"post_logout_redirect_uri",n),s&&(this.state=new c["default"]({data:s}),e=u["default"].addQueryParam(e,"state",this.state.id)))),this.url=e};e["default"]=f,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(19),o=n(s),a=function u(t){i(this,u);var e=o["default"].parseUrlFragment(t,"?");this.error=e.error,this.error_description=e.error_description,this.error_uri=e.error_uri,this.state=e.state};e["default"]=a,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var r=0;r=t:void 0}},{key:"scopes",get:function(){return(this.scope||"").split(" ")}}]),t}();e["default"]=u,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=r(1),u=n(a),h=r(36),c=n(h),f=r(38),l=n(f),d=function(t){function e(r){i(this,e);var n=s(this,t.call(this,r));return n._userLoaded=new l["default"]("User loaded"),n._userUnloaded=new l["default"]("User unloaded"),n._silentRenewError=new l["default"]("Silent renew error"),n}return o(e,t),e.prototype.load=function(e){u["default"].info("UserManagerEvents.load"),t.prototype.load.call(this,e),this._userLoaded.raise(e)},e.prototype.unload=function(){u["default"].info("UserManagerEvents.unload"),t.prototype.unload.call(this),this._userUnloaded.raise()},e.prototype.addUserLoaded=function(t){this._userLoaded.addHandler(t)},e.prototype.removeUserLoaded=function(t){this._userLoaded.removeHandler(t)},e.prototype.addUserUnloaded=function(t){this._userUnloaded.addHandler(t)},e.prototype.removeUserUnloaded=function(t){this._userUnloaded.removeHandler(t)},e.prototype.addSilentRenewError=function(t){this._silentRenewError.addHandler(t)},e.prototype.removeSilentRenewError=function(t){this._silentRenewError.removeHandler(t)},e.prototype._raiseSilentRenewError=function(t){u["default"].info("UserManagerEvents._raiseSilentRenewError",t.message),this._silentRenewError.raise(t)},e}(c["default"]);e["default"]=d,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=r(37),u=n(a),h=60,c=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=e.accessTokenExpiringNotificationTime,n=void 0===r?h:r,s=e.accessTokenExpiringTimer,o=void 0===s?new u["default"]("Access token expiring"):s,a=e.accessTokenExpiredTimer,c=void 0===a?new u["default"]("Access token expired"):a;i(this,t),this._accessTokenExpiringNotificationTime=n,this._accessTokenExpiring=o,this._accessTokenExpired=c}return t.prototype.load=function(t){if(o["default"].info("AccessTokenEvents.load"),this._cancelTimers(),t.access_token){var e=t.expires_in;if(o["default"].info("access token present, remaining duration:",e),e>0){var r=e-this._accessTokenExpiringNotificationTime;0>=r&&(r=1),o["default"].info("registering expiring timer in:",r),this._accessTokenExpiring.init(r)}var n=e+1;o["default"].info("registering expired timer in:",n),this._accessTokenExpired.init(n)}},t.prototype.unload=function(){o["default"].info("AccessTokenEvents.unload"),this._cancelTimers()},t.prototype._cancelTimers=function(){o["default"].info("canceling existing access token timers"),this._accessTokenExpiring.cancel(),this._accessTokenExpired.cancel()},t.prototype.addAccessTokenExpiring=function(t){this._accessTokenExpiring.addHandler(t)},t.prototype.removeAccessTokenExpiring=function(t){this._accessTokenExpiring.removeHandler(t)},t.prototype.addAccessTokenExpired=function(t){this._accessTokenExpired.addHandler(t)},t.prototype.removeAccessTokenExpired=function(t){this._accessTokenExpired.removeHandler(t)},t}();e["default"]=c,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(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)}Object.defineProperty(e,"__esModule",{value:!0});var a=r(1),u=(n(a),r(5)),h=n(u),c=r(38),f=n(c),l=function(t){function e(r){var n=arguments.length<=1||void 0===arguments[1]?h["default"].timer:arguments[1];i(this,e);var o=s(this,t.call(this,r));return o._timer=n,o}return o(e,t),e.prototype.init=function(t){this.cancel(),0>=t&&(t=1),this._timerHandle=this._timer.setTimeout(this._callback.bind(this),1e3*t)},e.prototype.cancel=function(){this._timerHandle&&(this._timer.clearTimeout(this._timerHandle),this._timerHandle=null)},e.prototype._callback=function(){this._timerHandle=null,t.prototype.raise.call(this)},e}(f["default"]);e["default"]=l,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=function(){function t(e){i(this,t),this._name=e,this._callbacks=[]}return t.prototype.addHandler=function(t){this._callbacks.push(t)},t.prototype.removeHandler=function(t){var e=this._callbacks.findIndex(function(e){return e===t});e>=0&&this._callbacks.splice(e,1)},t.prototype.raise=function(){o["default"].info("Raising event: "+this._name);var t=!0,e=!1,r=void 0;try{for(var n,i=this._callbacks[Symbol.iterator]();!(t=(n=i.next()).done);t=!0){var s=n.value;s.apply(void 0,arguments)}}catch(a){e=!0,r=a}finally{try{!t&&i["return"]&&i["return"]()}finally{if(e)throw r}}},t}();e["default"]=a,t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var s=r(1),o=n(s),a=function(){function t(e){i(this,t),this._userManager=e,this._userManager.events.addAccessTokenExpiring(this._tokenExpiring.bind(this))}return t.prototype._tokenExpiring=function(){var t=this;o["default"].info("SilentRenewService automatically renewing access token"),this._userManager.signinSilent().then(function(t){o["default"].info("Silent token renewal successful")},function(e){o["default"].error("Error from signinSilent:",e.message),t._userManager.events._raiseSilentRenewError(e)})},t}();e["default"]=a,t.exports=e["default"]}])})}])}); \ No newline at end of file diff --git a/package.json b/package.json index 03b822c..d9954cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redux-oidc", - "version": "2.0.0", + "version": "2.0.1", "description": "A package for managing OpenID Connect authentication in redux apps", "main": "dist/redux-oidc.js", "scripts": {