graphdb-workbench 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/10.f63a9f9189528238aa8f.bundle.js +2 -0
- package/dist/10.f63a9f9189528238aa8f.bundle.js.map +1 -0
- package/dist/11.3957302d7a301df30dd1.bundle.js +1 -1
- package/dist/11.3957302d7a301df30dd1.bundle.js.map +1 -1
- package/dist/120.80843604737b7c260788.bundle.js +1 -1
- package/dist/120.80843604737b7c260788.bundle.js.map +1 -1
- package/dist/18.44723ea06155c72f46ae.bundle.js +1 -1
- package/dist/18.44723ea06155c72f46ae.bundle.js.map +1 -1
- package/dist/25.9e0925889b3a3f79c7fe.bundle.js +1 -1
- package/dist/25.9e0925889b3a3f79c7fe.bundle.js.map +1 -1
- package/dist/29.9bdb27c21d6eacac1341.bundle.js +1 -1
- package/dist/29.9bdb27c21d6eacac1341.bundle.js.map +1 -1
- package/dist/30.34b74ada583b1b0af913.bundle.js +1 -1
- package/dist/30.34b74ada583b1b0af913.bundle.js.map +1 -1
- package/dist/68.e25480b7770a679a9654.bundle.js +1 -1
- package/dist/68.e25480b7770a679a9654.bundle.js.map +1 -1
- package/dist/{bundle.a8677c75aad1ad7b3b6a.bundle.js → bundle.7d5dd8e4d7cb8ed01086.bundle.js} +3 -3
- package/dist/bundle.7d5dd8e4d7cb8ed01086.bundle.js.map +1 -0
- package/dist/index.html +3 -3
- package/dist/js/angular/core/directives/rdfresourcesearch/templates/rdfResourceSearchTemplate.html +1 -1
- package/dist/pages/autocomplete.html +1 -1
- package/dist/pages/choose-repository-type.html +1 -1
- package/dist/pages/cluster-management/clusterInfo.html +3 -3
- package/dist/pages/create-index.html +4 -4
- package/dist/pages/dependencies.html +1 -1
- package/dist/pages/domainRangeInfo.html +2 -2
- package/dist/pages/edit.html +1 -1
- package/dist/pages/explore.html +1 -1
- package/dist/pages/export.html +1 -1
- package/dist/pages/find.html +1 -1
- package/dist/pages/graph-config/saveGraphConfig.html +11 -11
- package/dist/pages/graphs-visualizations.html +7 -7
- package/dist/pages/import.html +1 -1
- package/dist/pages/jdbc-create.html +5 -5
- package/dist/pages/monitor/queries.html +1 -1
- package/dist/pages/monitor/resources.html +2 -2
- package/dist/pages/namespaces.html +2 -2
- package/dist/pages/plugins.html +1 -1
- package/dist/pages/rdfClassHierarchyInfo.html +7 -7
- package/dist/pages/rdfrank.html +2 -2
- package/dist/pages/repositories.html +2 -2
- package/dist/pages/repository.html +2 -2
- package/dist/pages/similarity-indexes.html +1 -1
- package/dist/pages/sparql-template-create.html +5 -5
- package/dist/pages/sparql.html +3 -3
- package/dist/pages/webapi.html +2 -2
- package/dist/res/swagger/index.html +27 -27
- package/package.json +1 -1
- package/dist/10.eab0a417fa2f2831905e.bundle.js +0 -2
- package/dist/10.eab0a417fa2f2831905e.bundle.js.map +0 -1
- package/dist/bundle.a8677c75aad1ad7b3b6a.bundle.js.map +0 -1
package/dist/{bundle.a8677c75aad1ad7b3b6a.bundle.js → bundle.7d5dd8e4d7cb8ed01086.bundle.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(e){function t(t){for(var n,i,a=t[0],s=t[1],o=0,c=[];o<a.length;o++)i=a[o],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&c.push(r[i][0]),r[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);c.length;)c.shift()()}var n={},r={108:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=a);var s,o=document.createElement("script");o.charset="utf-8",o.timeout=120,i.nc&&o.setAttribute("nonce",i.nc),o.src=function(e){return i.p+""+({}[e]||e)+"."+{0:"55459f1b86b8bff8d22d",1:"3e91e44e3b7a65bfb142",2:"6e340067f6eae14345cd",3:"a1815b0ddb1630938d40",4:"383c0f0caa85d0643fa2",5:"768be5dd0364773b2622",6:"30a736d9630e4284bcda",7:"4da3fb0d398f61c3e669",8:"5abe78e9d72cdbc2607f",9:"39453c3d10a4fdcbf5d3",10:"eab0a417fa2f2831905e",11:"3957302d7a301df30dd1",12:"89eaa31b83a37581228e",13:"8b63226f432395060e6e",14:"4bd3da38ed5564f7941b",15:"03cfea74ead91ce00443",16:"a4554f91939de88fffa9",17:"ce0c68024c009a07ac5b",18:"44723ea06155c72f46ae",19:"50d07be48e86feaaa2a8",20:"5e907673579feec554d1",21:"64fbe234fee75c83dda3",22:"f5e4a79e14294b9154e5",23:"acf56e52417b0fbca9f4",24:"ded7d2fdeb597458cbb5",25:"9e0925889b3a3f79c7fe",26:"fd9455a416116da91440",27:"a53481ccfa58fbd0c801",28:"e7f1fb11de224aad53b0",29:"9bdb27c21d6eacac1341",30:"34b74ada583b1b0af913",31:"080c7b47d08b8ee2aa16",32:"258e7546207fb47ecb06",33:"dd00c0bbb922d9a0fb4b",34:"67b71c88d32338a06a0e",35:"c81d9b4217bb096551d8",36:"5b779a8b0475759cb32e",37:"a00e07ab7ce145b4e6e7",38:"aad28b0933902cd4c369",39:"8233405fc51663cdbb58",40:"836c4dc97054e8811ea3",41:"96a57231eb06a241bb7e",42:"479f3757b5439d0c3ba4",43:"764e1979a046e69e4e53",44:"082e83be1a2eda5f197b",45:"aeaf458b550b10285398",46:"e2012694a5f1575748d0",47:"51d062e8b9d951b9d257",48:"f047a5ea62690543f8ad",49:"bff5e3b9bfe7dbea984a",50:"ad4f45093cadde57e100",51:"0086885cd6299455d4ea",52:"abc1dddb6742763bee0c",53:"defb11e3530090f4ad49",54:"2518d2bf69349095ca10",55:"52954a18a410f69f3f43",56:"42ec984c204eee717134",57:"25cc9844eb61b578153d",58:"dc5dd4f17ba4cc51e83a",59:"1cf34af4ab5eefce881c",60:"6b5d2638a05a216323b9",61:"e88df1d7c75be886b5cb",62:"1f03ac2749baeaa8d343",63:"270271d648fa8886d286",64:"064a357eff0005820dfc",65:"f6f440565f21f089f3a7",66:"e3fcb383cbbad4336175",67:"3f75109fb8b71d88f6c7",68:"e25480b7770a679a9654",69:"975bda90c4485af62ef8",70:"67eb180ea5904fe954ba",71:"fad51ebaf61548668e8e",72:"b94250c41eb2c60c3156",73:"57973ac64fcbd4275efc",74:"d0bea72c7e786e249855",75:"f5fdd7a21a6bf01d655d",76:"efa22b1d0730c2ab0346",77:"db4606be13489b66512b",78:"5f028a4c3d30e692991d",79:"5e55cf62411f6762bb4d",80:"4191cc5e6be3caeebe83",81:"ac034878ee85ba00f2f0",82:"6f82f4ca0efec1b20486",83:"30939207cd53bedd8db7",84:"3f45443deb1bede3bbde",85:"682bf218ed7b094a7eb8",86:"691c7f84d8e13723d305",87:"0e11dc24452074ef4f19",88:"fe4d45bf1aa861b6159b",89:"8991deac519cc0c1206d",90:"462a7dc71f93456c4a6d",91:"f9489d6893d3fac72b3a",92:"771946fddaeaf65b90da",93:"4a8181b96654a67085a8",94:"71cc464c3c148d59bb98",95:"e5d387d932be32268be9",96:"2fc59311bc0661874141",97:"f47f7247770e14fe5152",98:"761ee5ef70e2c6b75b6c",99:"2014636896f4e7acf259",100:"ff8c44ac0be1b584e45c",101:"bd8aecd85e8eb82b3f11",102:"ce602adb524fa1252cf9",103:"8c5f7a05bcf07567a7dc",104:"7e16b2863108db706fe7",105:"cd7a6d951df8c568fde5",106:"17b8172aafccc937ad1c",107:"0b5f4ff7ce21b3ac55b5",111:"ceb781497f3c5dfd1446",112:"e34c26d9d3b4b6deae17",113:"733877f9f73d3283f528",114:"0e270e77a2a557167988",115:"732830fed3ff34691def",116:"7e8b202c5d712bddaaec",117:"c5cc6be87a403debe859",118:"ea82f3600adac55cc658",119:"2d6b15bc87de2533599c",120:"80843604737b7c260788",121:"e714a5873d760c588e64",122:"0c05df13bea34baad3d1",123:"51ad0d8338eda5a93b06",124:"bb076ec8716bdf91b743",125:"e32c48f9180e31bd1a2a",126:"534779e2f9d221cab674",127:"bfe5271bf6d10e6abd16",128:"7dae6369a26090e10276",129:"ed98e69bc798bd011577",130:"ecb7509cb6324abf4071",131:"b177961cd4dc3336dd7a",132:"044a5aa6a76d6842c3a8",133:"3eca60c1cd4ae4f29d91",134:"adb0ec8f7a9fcd2dc038",135:"7981dfdbfc95f3afd85b",136:"bf37f55d695d98bc7901",137:"5bf3c572ea202e7c0ee3",138:"5375ebd499e5c4977038",139:"67fca2b2af241bbb1334",140:"7441e0b058d1b82290fe",141:"e5c872fb6092c3beee39",142:"0cf828281c657ffb27a8",143:"ac3bfd55f8d0ce5b77f1",144:"f91cd836854b5f011190",145:"95b8e66fb775596e028d",146:"1c2fc08a3114736f1037",147:"38ebd6acf3465eec6c1a",148:"7f53c12ff877c4984e32",149:"7089a654a1902207a2c8",150:"b33994beae0db217828b",151:"2104ac0782ac43e2e7d2",152:"78baa98e298c18358c55",153:"fd957ea6d6ea34d3feb2",154:"8cc50542d00602c2911b",155:"ae10cd21a63cc139e0f2",156:"1dc2d86b52be74a8582f",157:"b9faadda272bdc2fd9f2",158:"51206ab595e2995d2f06",159:"13109ec058647372102c"}[e]+".bundle.js"}(e);var u=new Error;s=function(t){o.onerror=o.onload=null,clearTimeout(c);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}r[e]=void 0}};var c=setTimeout((function(){s({type:"timeout",target:o})}),12e4);o.onerror=o.onload=s,document.head.appendChild(o)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var o=0;o<a.length;o++)t(a[o]);var u=s;i(i.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"decodeHTML",(function(){return r}));n(3),n(23),n(27),n(168),n(33),n(169),n(18),n(28),n(29);const r=function(e){let t=document.createElement("textarea");return t.innerHTML=e,t.value},i=["ngRoute","graphdb.workbench.se.controllers","graphdb.framework.core","angularCancelOnNavigateModule","oc.lazyLoad","pascalprecht.translate","graphdb.framework.core.interceptors.unauthorized","graphdb.framework.core.directives.rdfresourcesearch.rdfresourcesearch","graphdb.framework.core.directives.languageselector.languageselector"],a=["$routeProvider","$locationProvider","$menuItemsProvider","toastrConfig","localStorageServiceProvider","$tooltipProvider","$httpProvider","$templateRequestProvider","$translateProvider"];$.get("rest/info/version?local=1",(function(e){const t=e.productVersion.match(/^(\d+\.\d+)/);t.length?e.productShortVersion=t[1]:e.productShortVersion=e.productVersion;const s=e.productVersion.match(/(-.*?)(-|$)/);s.length&&(e.productShortVersion=e.productShortVersion+s[1]),function(e){const t=angular.module("graphdb.workbench",i);t.config([...a,function(t,r,i,a,s,o,u,c,l){l.useStaticFilesLoader({prefix:"i18n/locale-",suffix:".json?v=2.0.0"}),l.preferredLanguage("en"),l.useSanitizeValueStrategy("escape"),angular.extend(a,{timeOut:5e3,positionClass:"toast-bottom-right"}),s.setStorageType("localStorage").setNotify(!0,!0);var h=t.$get[t.$get.length-1]({$on:function(){}});t.when("_openid_implicit_",{controller:function(){},template:"<div></div>"}),h.routes._openid_implicit_.regexp=/[&/](?:id_token=.*&access_token=|access_token=.*&id_token=)/,PluginRegistry.get("route").forEach((function(e){t.when(e.url,{controller:e.controller,templateUrl:e.templateUrl,title:e.title,helpInfo:e.helpInfo,reloadOnSearch:void 0===e.reloadOnSearch||e.reloadOnSearch,resolve:{preload:["$ocLazyLoad","$q",function(t,r){return e.path?n(170)(`./${e.path}`).then(n=>{t.inject(e.module)}):r.defer().resolve()}]}})})),t.otherwise({templateUrl:"pages/not_found.html"}),r.html5Mode(!0),o.setTriggers({show:"hide"}),o.options({appendToBody:!0}),i.setProductInfo(e),PluginRegistry.get("main.menu").forEach((function(e){e.items.forEach((function(e){i.addItem(e)}))})),u.interceptors.push("$unauthorizedInterceptor");const f=c.$get[3];"function"==typeof f&&(c.$get[3]=function(e,t,n){const r=f(e,t,n);return function(t,n){return e.get(t)||(t+="?v=2.0.0"),r(t,n)}})}]),t.constant("productInfo",e),t.run(["$rootScope","$route","toastr","$sce","$translate","LocalStorageAdapter","LSKeys",function(e,t,n,i,a,s,o){function u(){t.current.title?document.title=r(a.instant(t.current.title))+" | GraphDB Workbench":document.title="GraphDB Workbench",e.helpInfo=i.trustAsHtml(r(a.instant(t.current.helpInfo))),e.title=r(a.instant(t.current.title))}e.$on("$routeChangeSuccess",(function(){u(),n.clear()})),e.$on("$translateChangeSuccess",(function(){u()}));const c=s.get(o.WORKBENCH_SETTINGS);if(c&&c.theme){const e=document.querySelector(":root");"dark"===c.theme&&e.classList.add("dark")}}]),t.filter("titlecase",(function(){return function(e){var t=""+e;return t.charAt(0).toUpperCase()+t.slice(1)}})),angular.bootstrap(document,["graphdb.workbench"])}(e)}))},function(e,t,n){"use strict";n.r(t),n.d(t,"UserType",(function(){return i})),n.d(t,"UserRole",(function(){return r})),n.d(t,"UserUtils",(function(){return a}));const r=Object.freeze({ROLE_ADMIN:"ROLE_ADMIN",ROLE_USER:"ROLE_USER",ROLE_REPO_MANAGER:"ROLE_REPO_MANAGER"}),i=Object.freeze({ADMIN:"admin",USER:"user",REPO_MANAGER:"repoManager"}),a={getUserRoleName:function(e){switch(e){case i.USER:return"User";case i.REPO_MANAGER:return"Repository manager";case i.ADMIN:return"Administrator";default:return"Unknown"}}}},function(e,t,n){(function(e){var n,r,i,a,s,o,u,c,l,h,f,p={userAgent:!1},d={},g=g||(n=Math,i=(r={}).lib={},a=i.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=i.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var a=0;a<i;a++){var s=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=s<<24-(r+a)%4*8}else for(a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=n.ceil(t/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(4294967296*n.random()|0);return new s.init(t,e)}}),o=r.enc={},u=o.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},c=o.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},l=o.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},h=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,r=t.words,i=t.sigBytes,a=this.blockSize,o=i/(4*a),u=(o=e?n.ceil(o):n.max((0|o)-this._minBufferSize,0))*a,c=n.min(4*u,i);if(u){for(var l=0;l<u;l+=a)this._doProcessBlock(r,l);var h=r.splice(0,u);t.sigBytes-=c}return new s.init(h,c)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),i.Hasher=h.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new f.HMAC.init(e,n).finalize(t)}}}),f=r.algo={},r);!function(e){var t,n=(t=g).lib,r=n.Base,i=n.WordArray;(t=t.x64={}).Word=r.extend({init:function(e,t){this.high=e,this.low=t}}),t.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],r=0;r<t;r++){var a=e[r];n.push(a.high),n.push(a.low)}return i.create(n,this.sigBytes)},clone:function(){for(var e=r.clone.call(this),t=e.words=this.words.slice(0),n=t.length,i=0;i<n;i++)t[i]=t[i].clone();return e}})}(),g.lib.Cipher||function(e){var t=(p=g).lib,n=t.Base,r=t.WordArray,i=t.BufferedBlockAlgorithm,a=p.enc.Base64,s=p.algo.EvpKDF,o=t.Cipher=i.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,r){return("string"==typeof n?d:f).encrypt(e,t,n,r)},decrypt:function(t,n,r){return("string"==typeof n?d:f).decrypt(e,t,n,r)}}}});t.StreamCipher=o.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=p.mode={},c=function(e,t,n){var r=this._iv;r?this._iv=void 0:r=this._prevBlock;for(var i=0;i<n;i++)e[t+i]^=r[i]},l=(t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();l.Encryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize;c.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),l.Decryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=e.slice(t,t+r);n.decryptBlock(e,t),c.call(this,e,t,r),this._prevBlock=i}}),u=u.CBC=l,l=(p.pad={}).Pkcs7={pad:function(e,t){for(var n,i=(n=(n=4*t)-e.sigBytes%n)<<24|n<<16|n<<8|n,a=[],s=0;s<n;s+=4)a.push(i);n=r.create(a,n),e.concat(n)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=o.extend({cfg:o.cfg.extend({mode:u,padding:l}),reset:function(){o.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var h=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),f=(u=(p.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){var t=(e=a.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=r.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return h.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:u}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,h.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),p=(p.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=s.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,h.create({key:e,iv:n,salt:i})}},d=t.PasswordBasedCipher=f.extend({cfg:f.cfg.extend({kdf:p}),encrypt:function(e,t,n,r){return n=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,(e=f.encrypt.call(this,e,t,n.key,r)).mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,f.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=g,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],a=[],s=[],o=[],u=[],c=[],l=[],h=[],f=[],p=[],d=0;256>d;d++)p[d]=128>d?d<<1:d<<1^283;var m=0,v=0;for(d=0;256>d;d++){var y=(y=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&y^99;r[m]=y,i[y]=m;var b=p[m],w=p[b],x=p[w],S=257*p[y]^16843008*y;a[m]=S<<24|S>>>8,s[m]=S<<16|S>>>16,o[m]=S<<8|S>>>24,u[m]=S,S=16843009*x^65537*w^257*b^16843008*m,c[y]=S<<24|S>>>8,l[y]=S<<16|S>>>16,h[y]=S<<8|S>>>24,f[y]=S,m?(m=b^p[p[p[x^b]]],v^=p[p[v]]):m=v=1}var E=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),i=this._keySchedule=[],a=0;a<n;a++)if(a<t)i[a]=e[a];else{var s=i[a-1];a%t?6<t&&4==a%t&&(s=r[s>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s]):(s=r[(s=s<<8|s>>>24)>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s],s^=E[a/t|0]<<24),i[a]=i[a-t]^s}for(e=this._invKeySchedule=[],t=0;t<n;t++)a=n-t,s=t%4?i[a]:i[a-4],e[t]=4>t||4>=a?s:c[r[s>>>24]]^l[r[s>>>16&255]]^h[r[s>>>8&255]]^f[r[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,o,u,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,c,l,h,f,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,s,o){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],h=e[t+2]^n[2],f=e[t+3]^n[3],p=4,d=1;d<u;d++){var g=r[c>>>24]^i[l>>>16&255]^a[h>>>8&255]^s[255&f]^n[p++],m=r[l>>>24]^i[h>>>16&255]^a[f>>>8&255]^s[255&c]^n[p++],v=r[h>>>24]^i[f>>>16&255]^a[c>>>8&255]^s[255&l]^n[p++];f=r[f>>>24]^i[c>>>16&255]^a[l>>>8&255]^s[255&h]^n[p++],c=g,l=m,h=v}g=(o[c>>>24]<<24|o[l>>>16&255]<<16|o[h>>>8&255]<<8|o[255&f])^n[p++],m=(o[l>>>24]<<24|o[h>>>16&255]<<16|o[f>>>8&255]<<8|o[255&c])^n[p++],v=(o[h>>>24]<<24|o[f>>>16&255]<<16|o[c>>>8&255]<<8|o[255&l])^n[p++],f=(o[f>>>24]<<24|o[c>>>16&255]<<16|o[l>>>8&255]<<8|o[255&h])^n[p++],e[t]=g,e[t+1]=m,e[t+2]=v,e[t+3]=f},keySize:8});e.AES=t._createHelper(n)}(),function(){function e(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<<e}function t(e,t){var n=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<<e}var n=g,r=(i=n.lib).WordArray,i=i.BlockCipher,a=n.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=a.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;56>n;n++){var r=s[n]-1;t[n]=e[r>>>5]>>>31-r%32&1}for(e=this._subKeys=[],r=0;16>r;r++){var i=e[r]=[],a=u[r];for(n=0;24>n;n++)i[n/6|0]|=t[(o[n]-1+a)%28]<<31-n%6,i[4+(n/6|0)]|=t[28+(o[n+24]-1+a)%28]<<31-n%6;for(i[0]=i[0]<<1|i[0]>>>31,n=1;7>n;n++)i[n]>>>=4*(n-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(t=this._invSubKeys=[],n=0;16>n;n++)t[n]=e[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(n,r,i){this._lBlock=n[r],this._rBlock=n[r+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var a=0;16>a;a++){for(var s=i[a],o=this._lBlock,u=this._rBlock,h=0,f=0;8>f;f++)h|=c[f][((u^s[f])&l[f])>>>0];this._lBlock=u,this._rBlock=o^h}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),n[r]=this._lBlock,n[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});n.DES=i._createHelper(h),a=a.TripleDES=i.extend({_doReset:function(){var e=this._key.words;this._des1=h.createEncryptor(r.create(e.slice(0,2))),this._des2=h.createEncryptor(r.create(e.slice(2,4))),this._des3=h.createEncryptor(r.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2}),n.TripleDES=i._createHelper(a)}(),function(){var e=g,t=e.lib.WordArray;e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp(),e=[];for(var i=0;i<n;i+=3)for(var a=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s<n;s++)e.push(r.charAt(a>>>6*(3-s)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var n=e.length,r=this._map;(i=r.charAt(64))&&(-1!=(i=e.indexOf(i))&&(n=i));for(var i=[],a=0,s=0;s<n;s++)if(s%4){var o=r.indexOf(e.charAt(s-1))<<s%4*2,u=r.indexOf(e.charAt(s))>>>6-s%4*2;i[a>>>2]|=(o|u)<<24-a%4*8,a++}return t.create(i,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,n,r,i,a,s){return((e=e+(t&n|~t&r)+i+s)<<a|e>>>32-a)+t}function n(e,t,n,r,i,a,s){return((e=e+(t&r|n&~r)+i+s)<<a|e>>>32-a)+t}function r(e,t,n,r,i,a,s){return((e=e+(t^n^r)+i+s)<<a|e>>>32-a)+t}function i(e,t,n,r,i,a,s){return((e=e+(n^(t|~r))+i+s)<<a|e>>>32-a)+t}for(var a=g,s=(u=a.lib).WordArray,o=u.Hasher,u=a.algo,c=[],l=0;64>l;l++)c[l]=4294967296*e.abs(e.sin(l+1))|0;u=u.MD5=o.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,a){for(var s=0;16>s;s++){var o=e[u=a+s];e[u]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}s=this._hash.words;var u=e[a+0],l=(o=e[a+1],e[a+2]),h=e[a+3],f=e[a+4],p=e[a+5],d=e[a+6],g=e[a+7],m=e[a+8],v=e[a+9],y=e[a+10],b=e[a+11],w=e[a+12],x=e[a+13],S=e[a+14],E=e[a+15],F=t(F=s[0],C=s[1],D=s[2],A=s[3],u,7,c[0]),A=t(A,F,C,D,o,12,c[1]),D=t(D,A,F,C,l,17,c[2]),C=t(C,D,A,F,h,22,c[3]);F=t(F,C,D,A,f,7,c[4]),A=t(A,F,C,D,p,12,c[5]),D=t(D,A,F,C,d,17,c[6]),C=t(C,D,A,F,g,22,c[7]),F=t(F,C,D,A,m,7,c[8]),A=t(A,F,C,D,v,12,c[9]),D=t(D,A,F,C,y,17,c[10]),C=t(C,D,A,F,b,22,c[11]),F=t(F,C,D,A,w,7,c[12]),A=t(A,F,C,D,x,12,c[13]),D=t(D,A,F,C,S,17,c[14]),F=n(F,C=t(C,D,A,F,E,22,c[15]),D,A,o,5,c[16]),A=n(A,F,C,D,d,9,c[17]),D=n(D,A,F,C,b,14,c[18]),C=n(C,D,A,F,u,20,c[19]),F=n(F,C,D,A,p,5,c[20]),A=n(A,F,C,D,y,9,c[21]),D=n(D,A,F,C,E,14,c[22]),C=n(C,D,A,F,f,20,c[23]),F=n(F,C,D,A,v,5,c[24]),A=n(A,F,C,D,S,9,c[25]),D=n(D,A,F,C,h,14,c[26]),C=n(C,D,A,F,m,20,c[27]),F=n(F,C,D,A,x,5,c[28]),A=n(A,F,C,D,l,9,c[29]),D=n(D,A,F,C,g,14,c[30]),F=r(F,C=n(C,D,A,F,w,20,c[31]),D,A,p,4,c[32]),A=r(A,F,C,D,m,11,c[33]),D=r(D,A,F,C,b,16,c[34]),C=r(C,D,A,F,S,23,c[35]),F=r(F,C,D,A,o,4,c[36]),A=r(A,F,C,D,f,11,c[37]),D=r(D,A,F,C,g,16,c[38]),C=r(C,D,A,F,y,23,c[39]),F=r(F,C,D,A,x,4,c[40]),A=r(A,F,C,D,u,11,c[41]),D=r(D,A,F,C,h,16,c[42]),C=r(C,D,A,F,d,23,c[43]),F=r(F,C,D,A,v,4,c[44]),A=r(A,F,C,D,w,11,c[45]),D=r(D,A,F,C,E,16,c[46]),F=i(F,C=r(C,D,A,F,l,23,c[47]),D,A,u,6,c[48]),A=i(A,F,C,D,g,10,c[49]),D=i(D,A,F,C,S,15,c[50]),C=i(C,D,A,F,p,21,c[51]),F=i(F,C,D,A,w,6,c[52]),A=i(A,F,C,D,h,10,c[53]),D=i(D,A,F,C,y,15,c[54]),C=i(C,D,A,F,o,21,c[55]),F=i(F,C,D,A,m,6,c[56]),A=i(A,F,C,D,E,10,c[57]),D=i(D,A,F,C,d,15,c[58]),C=i(C,D,A,F,x,21,c[59]),F=i(F,C,D,A,f,6,c[60]),A=i(A,F,C,D,b,10,c[61]),D=i(D,A,F,C,l,15,c[62]),C=i(C,D,A,F,v,21,c[63]);s[0]=s[0]+F|0,s[1]=s[1]+C|0,s[2]=s[2]+D|0,s[3]=s[3]+A|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var a=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),n=(t=this._hash).words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),a.MD5=o._createHelper(u),a.HmacMD5=o._createHmacHelper(u)}(Math),function(){var e=g,t=(i=e.lib).WordArray,n=i.Hasher,r=[],i=e.algo.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],a=n[1],s=n[2],o=n[3],u=n[4],c=0;80>c;c++){if(16>c)r[c]=0|e[t+c];else{var l=r[c-3]^r[c-8]^r[c-14]^r[c-16];r[c]=l<<1|l>>>31}l=(i<<5|i>>>27)+u+r[c],l=20>c?l+(1518500249+(a&s|~a&o)):40>c?l+(1859775393+(a^s^o)):60>c?l+((a&s|a&o|s&o)-1894007588):l+((a^s^o)-899497514),u=o,o=s,s=a<<30|a>>>2,a=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+a|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=n._createHelper(i),e.HmacSHA1=n._createHmacHelper(i)}(),function(e){for(var t=g,n=(i=t.lib).WordArray,r=i.Hasher,i=t.algo,a=[],s=[],o=function(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var l;e:{l=u;for(var h=e.sqrt(l),f=2;f<=h;f++)if(!(l%f)){l=!1;break e}l=!0}l&&(8>c&&(a[c]=o(e.pow(u,.5))),s[c]=o(e.pow(u,1/3)),c++),u++}var p=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],u=n[4],c=n[5],l=n[6],h=n[7],f=0;64>f;f++){if(16>f)p[f]=0|e[t+f];else{var d=p[f-15],g=p[f-2];p[f]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+p[f-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+p[f-16]}d=h+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+s[f]+p[f],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&a^i&a),h=l,l=c,c=u,u=o+d|0,o=a,a=i,i=r,r=d+g|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+h|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(i),t.HmacSHA256=r._createHmacHelper(i)}(Math),function(){var e=g,t=e.lib.WordArray,n=(r=e.algo).SHA256,r=r.SHA224=n.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}});e.SHA224=n._createHelper(r),e.HmacSHA224=n._createHmacHelper(r)}(),function(){function e(){return r.create.apply(r,arguments)}for(var t=g,n=t.lib.Hasher,r=(a=t.x64).Word,i=a.WordArray,a=t.algo,s=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],o=[],u=0;80>u;u++)o[u]=e();a=a.SHA512=n.extend({_doReset:function(){this._hash=new i.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=(h=this._hash.words)[0],r=h[1],i=h[2],a=h[3],u=h[4],c=h[5],l=h[6],h=h[7],f=n.high,p=n.low,d=r.high,g=r.low,m=i.high,v=i.low,y=a.high,b=a.low,w=u.high,x=u.low,S=c.high,E=c.low,F=l.high,A=l.low,D=h.high,C=h.low,R=f,$=p,I=d,T=g,P=m,_=v,k=y,O=b,j=w,N=x,B=S,H=E,L=F,M=A,U=D,V=C,q=0;80>q;q++){var K=o[q];if(16>q)var z=K.high=0|e[t+2*q],G=K.low=0|e[t+2*q+1];else{z=((G=(z=o[q-15]).high)>>>1|(W=z.low)<<31)^(G>>>8|W<<24)^G>>>7;var W=(W>>>1|G<<31)^(W>>>8|G<<24)^(W>>>7|G<<25),Y=((G=(Y=o[q-2]).high)>>>19|(X=Y.low)<<13)^(G<<3|X>>>29)^G>>>6,X=(X>>>19|G<<13)^(X<<3|G>>>29)^(X>>>6|G<<26),J=(G=o[q-7]).high,Q=(Z=o[q-16]).high,Z=Z.low;z=(z=(z=z+J+((G=W+G.low)>>>0<W>>>0?1:0))+Y+((G=G+X)>>>0<X>>>0?1:0))+Q+((G=G+Z)>>>0<Z>>>0?1:0);K.high=z,K.low=G}J=j&B^~j&L,Z=N&H^~N&M,K=R&I^R&P^I&P;var ee=$&T^$&_^T&_,te=(W=(R>>>28|$<<4)^(R<<30|$>>>2)^(R<<25|$>>>7),Y=($>>>28|R<<4)^($<<30|R>>>2)^($<<25|R>>>7),(X=s[q]).high),ne=X.low;Q=U+((j>>>14|N<<18)^(j>>>18|N<<14)^(j<<23|N>>>9))+((X=V+((N>>>14|j<<18)^(N>>>18|j<<14)^(N<<23|j>>>9)))>>>0<V>>>0?1:0),U=L,V=M,L=B,M=H,B=j,H=N,j=k+(Q=(Q=(Q=Q+J+((X=X+Z)>>>0<Z>>>0?1:0))+te+((X=X+ne)>>>0<ne>>>0?1:0))+z+((X=X+G)>>>0<G>>>0?1:0))+((N=O+X|0)>>>0<O>>>0?1:0)|0,k=P,O=_,P=I,_=T,I=R,T=$,R=Q+(K=W+K+((G=Y+ee)>>>0<Y>>>0?1:0))+(($=X+G|0)>>>0<X>>>0?1:0)|0}p=n.low=p+$,n.high=f+R+(p>>>0<$>>>0?1:0),g=r.low=g+T,r.high=d+I+(g>>>0<T>>>0?1:0),v=i.low=v+_,i.high=m+P+(v>>>0<_>>>0?1:0),b=a.low=b+O,a.high=y+k+(b>>>0<O>>>0?1:0),x=u.low=x+N,u.high=w+j+(x>>>0<N>>>0?1:0),E=c.low=E+H,c.high=S+B+(E>>>0<H>>>0?1:0),A=l.low=A+M,l.high=F+L+(A>>>0<M>>>0?1:0),C=h.low=C+V,h.high=D+U+(C>>>0<V>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(r+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),t.SHA512=n._createHelper(a),t.HmacSHA512=n._createHmacHelper(a)}(),function(){var e=g,t=(i=e.x64).Word,n=i.WordArray,r=(i=e.algo).SHA512,i=i.SHA384=r.extend({_doReset:function(){this._hash=new n.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var e=r._doFinalize.call(this);return e.sigBytes-=16,e}});e.SHA384=r._createHelper(i),e.HmacSHA384=r._createHmacHelper(i)}(),function(){var e=g,t=(r=e.lib).WordArray,n=r.Hasher,r=e.algo,i=t.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]),a=t.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]),s=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),o=t.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=t.create([0,1518500249,1859775393,2400959708,2840853838]),c=t.create([1352829926,1548603684,1836072691,2053994217,0]);r=r.RIPEMD160=n.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;16>n;n++){var r=e[w=t+n];e[w]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var l,h,f,p,d,g,m,v,y,b,w=this._hash.words,x=(r=u.words,c.words),S=i.words,E=a.words,F=s.words,A=o.words;g=l=w[0],m=h=w[1],v=f=w[2],y=p=w[3],b=d=w[4];var D;for(n=0;80>n;n+=1)D=l+e[t+S[n]]|0,D=16>n?D+((h^f^p)+r[0]):32>n?D+((h&f|~h&p)+r[1]):48>n?D+(((h|~f)^p)+r[2]):64>n?D+((h&p|f&~p)+r[3]):D+((h^(f|~p))+r[4]),D=(D=(D|=0)<<F[n]|D>>>32-F[n])+d|0,l=d,d=p,p=f<<10|f>>>22,f=h,h=D,D=g+e[t+E[n]]|0,D=16>n?D+((m^(v|~y))+x[0]):32>n?D+((m&y|v&~y)+x[1]):48>n?D+(((m|~v)^y)+x[2]):64>n?D+((m&v|~m&y)+x[3]):D+((m^v^y)+x[4]),D=(D=(D|=0)<<A[n]|D>>>32-A[n])+b|0,g=b,b=y,y=v<<10|v>>>22,v=m,m=D;D=w[1]+f+y|0,w[1]=w[2]+p+b|0,w[2]=w[3]+d+g|0,w[3]=w[4]+l+m|0,w[4]=w[0]+h+v|0,w[0]=D},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;for(t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),t=(e=this._hash).words,n=0;5>n;n++)r=t[n],t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return e},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.RIPEMD160=n._createHelper(r),e.HmacRIPEMD160=n._createHmacHelper(r)}(Math),function(){var e=g,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var a=this._oKey=n.clone(),s=this._iKey=n.clone(),o=a.words,u=s.words,c=0;c<r;c++)o[c]^=1549556828,u[c]^=909522486;a.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}(),function(){var e,t=g,n=(e=t.lib).Base,r=e.WordArray,i=(e=t.algo).HMAC,a=e.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:e.SHA1,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){var n=this.cfg,a=i.create(n.hasher,e),s=r.create(),o=r.create([1]),u=s.words,c=o.words,l=n.keySize;for(n=n.iterations;u.length<l;){var h=a.update(t).finalize(o);a.reset();for(var f=h.words,p=f.length,d=h,g=1;g<n;g++){d=a.finalize(d),a.reset();for(var m=d.words,v=0;v<p;v++)f[v]^=m[v]}s.concat(h),c[0]++}return s.sigBytes=4*l,s}});t.PBKDF2=function(e,t,n){return a.create(n).compute(e,t)}}();
|
|
1
|
+
!function(e){function t(t){for(var n,i,a=t[0],s=t[1],o=0,c=[];o<a.length;o++)i=a[o],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&c.push(r[i][0]),r[i]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);c.length;)c.shift()()}var n={},r={108:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var a=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=a);var s,o=document.createElement("script");o.charset="utf-8",o.timeout=120,i.nc&&o.setAttribute("nonce",i.nc),o.src=function(e){return i.p+""+({}[e]||e)+"."+{0:"55459f1b86b8bff8d22d",1:"3e91e44e3b7a65bfb142",2:"6e340067f6eae14345cd",3:"a1815b0ddb1630938d40",4:"383c0f0caa85d0643fa2",5:"768be5dd0364773b2622",6:"30a736d9630e4284bcda",7:"4da3fb0d398f61c3e669",8:"5abe78e9d72cdbc2607f",9:"39453c3d10a4fdcbf5d3",10:"f63a9f9189528238aa8f",11:"3957302d7a301df30dd1",12:"89eaa31b83a37581228e",13:"8b63226f432395060e6e",14:"4bd3da38ed5564f7941b",15:"03cfea74ead91ce00443",16:"a4554f91939de88fffa9",17:"ce0c68024c009a07ac5b",18:"44723ea06155c72f46ae",19:"50d07be48e86feaaa2a8",20:"5e907673579feec554d1",21:"64fbe234fee75c83dda3",22:"f5e4a79e14294b9154e5",23:"acf56e52417b0fbca9f4",24:"ded7d2fdeb597458cbb5",25:"9e0925889b3a3f79c7fe",26:"fd9455a416116da91440",27:"a53481ccfa58fbd0c801",28:"e7f1fb11de224aad53b0",29:"9bdb27c21d6eacac1341",30:"34b74ada583b1b0af913",31:"080c7b47d08b8ee2aa16",32:"258e7546207fb47ecb06",33:"dd00c0bbb922d9a0fb4b",34:"67b71c88d32338a06a0e",35:"c81d9b4217bb096551d8",36:"5b779a8b0475759cb32e",37:"a00e07ab7ce145b4e6e7",38:"aad28b0933902cd4c369",39:"8233405fc51663cdbb58",40:"836c4dc97054e8811ea3",41:"96a57231eb06a241bb7e",42:"479f3757b5439d0c3ba4",43:"764e1979a046e69e4e53",44:"082e83be1a2eda5f197b",45:"aeaf458b550b10285398",46:"e2012694a5f1575748d0",47:"51d062e8b9d951b9d257",48:"f047a5ea62690543f8ad",49:"bff5e3b9bfe7dbea984a",50:"ad4f45093cadde57e100",51:"0086885cd6299455d4ea",52:"abc1dddb6742763bee0c",53:"defb11e3530090f4ad49",54:"2518d2bf69349095ca10",55:"52954a18a410f69f3f43",56:"42ec984c204eee717134",57:"25cc9844eb61b578153d",58:"dc5dd4f17ba4cc51e83a",59:"1cf34af4ab5eefce881c",60:"6b5d2638a05a216323b9",61:"e88df1d7c75be886b5cb",62:"1f03ac2749baeaa8d343",63:"270271d648fa8886d286",64:"064a357eff0005820dfc",65:"f6f440565f21f089f3a7",66:"e3fcb383cbbad4336175",67:"3f75109fb8b71d88f6c7",68:"e25480b7770a679a9654",69:"975bda90c4485af62ef8",70:"67eb180ea5904fe954ba",71:"fad51ebaf61548668e8e",72:"b94250c41eb2c60c3156",73:"57973ac64fcbd4275efc",74:"d0bea72c7e786e249855",75:"f5fdd7a21a6bf01d655d",76:"efa22b1d0730c2ab0346",77:"db4606be13489b66512b",78:"5f028a4c3d30e692991d",79:"5e55cf62411f6762bb4d",80:"4191cc5e6be3caeebe83",81:"ac034878ee85ba00f2f0",82:"6f82f4ca0efec1b20486",83:"30939207cd53bedd8db7",84:"3f45443deb1bede3bbde",85:"682bf218ed7b094a7eb8",86:"691c7f84d8e13723d305",87:"0e11dc24452074ef4f19",88:"fe4d45bf1aa861b6159b",89:"8991deac519cc0c1206d",90:"462a7dc71f93456c4a6d",91:"f9489d6893d3fac72b3a",92:"771946fddaeaf65b90da",93:"4a8181b96654a67085a8",94:"71cc464c3c148d59bb98",95:"e5d387d932be32268be9",96:"2fc59311bc0661874141",97:"f47f7247770e14fe5152",98:"761ee5ef70e2c6b75b6c",99:"2014636896f4e7acf259",100:"ff8c44ac0be1b584e45c",101:"bd8aecd85e8eb82b3f11",102:"ce602adb524fa1252cf9",103:"8c5f7a05bcf07567a7dc",104:"7e16b2863108db706fe7",105:"cd7a6d951df8c568fde5",106:"17b8172aafccc937ad1c",107:"0b5f4ff7ce21b3ac55b5",111:"ceb781497f3c5dfd1446",112:"e34c26d9d3b4b6deae17",113:"733877f9f73d3283f528",114:"0e270e77a2a557167988",115:"732830fed3ff34691def",116:"7e8b202c5d712bddaaec",117:"c5cc6be87a403debe859",118:"ea82f3600adac55cc658",119:"2d6b15bc87de2533599c",120:"80843604737b7c260788",121:"e714a5873d760c588e64",122:"0c05df13bea34baad3d1",123:"51ad0d8338eda5a93b06",124:"bb076ec8716bdf91b743",125:"e32c48f9180e31bd1a2a",126:"534779e2f9d221cab674",127:"bfe5271bf6d10e6abd16",128:"7dae6369a26090e10276",129:"ed98e69bc798bd011577",130:"ecb7509cb6324abf4071",131:"b177961cd4dc3336dd7a",132:"044a5aa6a76d6842c3a8",133:"3eca60c1cd4ae4f29d91",134:"adb0ec8f7a9fcd2dc038",135:"7981dfdbfc95f3afd85b",136:"bf37f55d695d98bc7901",137:"5bf3c572ea202e7c0ee3",138:"5375ebd499e5c4977038",139:"67fca2b2af241bbb1334",140:"7441e0b058d1b82290fe",141:"e5c872fb6092c3beee39",142:"0cf828281c657ffb27a8",143:"ac3bfd55f8d0ce5b77f1",144:"f91cd836854b5f011190",145:"95b8e66fb775596e028d",146:"1c2fc08a3114736f1037",147:"38ebd6acf3465eec6c1a",148:"7f53c12ff877c4984e32",149:"7089a654a1902207a2c8",150:"b33994beae0db217828b",151:"2104ac0782ac43e2e7d2",152:"78baa98e298c18358c55",153:"fd957ea6d6ea34d3feb2",154:"8cc50542d00602c2911b",155:"ae10cd21a63cc139e0f2",156:"1dc2d86b52be74a8582f",157:"b9faadda272bdc2fd9f2",158:"51206ab595e2995d2f06",159:"13109ec058647372102c"}[e]+".bundle.js"}(e);var u=new Error;s=function(t){o.onerror=o.onload=null,clearTimeout(c);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;u.message="Loading chunk "+e+" failed.\n("+i+": "+a+")",u.name="ChunkLoadError",u.type=i,u.request=a,n[1](u)}r[e]=void 0}};var c=setTimeout((function(){s({type:"timeout",target:o})}),12e4);o.onerror=o.onload=s,document.head.appendChild(o)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i.oe=function(e){throw console.error(e),e};var a=window.webpackJsonp=window.webpackJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var o=0;o<a.length;o++)t(a[o]);var u=s;i(i.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"decodeHTML",(function(){return r}));n(3),n(23),n(27),n(168),n(33),n(169),n(18),n(28),n(29);const r=function(e){let t=document.createElement("textarea");return t.innerHTML=e,t.value},i=["ngRoute","graphdb.workbench.se.controllers","graphdb.framework.core","angularCancelOnNavigateModule","oc.lazyLoad","pascalprecht.translate","graphdb.framework.core.interceptors.unauthorized","graphdb.framework.core.directives.rdfresourcesearch.rdfresourcesearch","graphdb.framework.core.directives.languageselector.languageselector"],a=["$routeProvider","$locationProvider","$menuItemsProvider","toastrConfig","localStorageServiceProvider","$tooltipProvider","$httpProvider","$templateRequestProvider","$translateProvider"];$.get("rest/info/version?local=1",(function(e){const t=e.productVersion.match(/^(\d+\.\d+)/);t.length?e.productShortVersion=t[1]:e.productShortVersion=e.productVersion;const s=e.productVersion.match(/(-.*?)(-|$)/);s&&s.length&&(e.productShortVersion=e.productShortVersion+s[1]),function(e){const t=angular.module("graphdb.workbench",i);t.config([...a,function(t,r,i,a,s,o,u,c,l){l.useStaticFilesLoader({prefix:"i18n/locale-",suffix:".json?v=2.0.2"}),l.preferredLanguage("en"),l.useSanitizeValueStrategy("escape"),angular.extend(a,{timeOut:5e3,positionClass:"toast-bottom-right"}),s.setStorageType("localStorage").setNotify(!0,!0);var h=t.$get[t.$get.length-1]({$on:function(){}});t.when("_openid_implicit_",{controller:function(){},template:"<div></div>"}),h.routes._openid_implicit_.regexp=/[&/](?:id_token=.*&access_token=|access_token=.*&id_token=)/,PluginRegistry.get("route").forEach((function(e){t.when(e.url,{controller:e.controller,templateUrl:e.templateUrl,title:e.title,helpInfo:e.helpInfo,reloadOnSearch:void 0===e.reloadOnSearch||e.reloadOnSearch,resolve:{preload:["$ocLazyLoad","$q",function(t,r){return e.path?n(170)(`./${e.path}`).then(n=>{t.inject(e.module)}):r.defer().resolve()}]}})})),t.otherwise({templateUrl:"pages/not_found.html"}),r.html5Mode(!0),o.setTriggers({show:"hide"}),o.options({appendToBody:!0}),i.setProductInfo(e),PluginRegistry.get("main.menu").forEach((function(e){e.items.forEach((function(e){i.addItem(e)}))})),u.interceptors.push("$unauthorizedInterceptor");const f=c.$get[3];"function"==typeof f&&(c.$get[3]=function(e,t,n){const r=f(e,t,n);return function(t,n){return e.get(t)||(t+="?v=2.0.2"),r(t,n)}})}]),t.constant("productInfo",e),t.run(["$rootScope","$route","toastr","$sce","$translate","LocalStorageAdapter","LSKeys",function(e,t,n,i,a,s,o){function u(){t.current.title?document.title=r(a.instant(t.current.title))+" | GraphDB Workbench":document.title="GraphDB Workbench",e.helpInfo=i.trustAsHtml(r(a.instant(t.current.helpInfo))),e.title=r(a.instant(t.current.title))}e.$on("$routeChangeSuccess",(function(){u(),n.clear()})),e.$on("$translateChangeSuccess",(function(){u()}));const c=s.get(o.WORKBENCH_SETTINGS);if(c&&c.theme){const e=document.querySelector(":root");"dark"===c.theme&&e.classList.add("dark")}}]),t.filter("titlecase",(function(){return function(e){var t=""+e;return t.charAt(0).toUpperCase()+t.slice(1)}})),angular.bootstrap(document,["graphdb.workbench"])}(e)}))},function(e,t,n){"use strict";n.r(t),n.d(t,"UserType",(function(){return i})),n.d(t,"UserRole",(function(){return r})),n.d(t,"UserUtils",(function(){return a}));const r=Object.freeze({ROLE_ADMIN:"ROLE_ADMIN",ROLE_USER:"ROLE_USER",ROLE_REPO_MANAGER:"ROLE_REPO_MANAGER"}),i=Object.freeze({ADMIN:"admin",USER:"user",REPO_MANAGER:"repoManager"}),a={getUserRoleName:function(e){switch(e){case i.USER:return"User";case i.REPO_MANAGER:return"Repository manager";case i.ADMIN:return"Administrator";default:return"Unknown"}}}},function(e,t,n){(function(e){var n,r,i,a,s,o,u,c,l,h,f,p={userAgent:!1},d={},g=g||(n=Math,i=(r={}).lib={},a=i.Base=function(){function e(){}return{extend:function(t){e.prototype=this;var n=new e;return t&&n.mixIn(t),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),s=i.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var a=0;a<i;a++){var s=n[a>>>2]>>>24-a%4*8&255;t[r+a>>>2]|=s<<24-(r+a)%4*8}else for(a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,t=this.sigBytes;e[t>>>2]&=4294967295<<32-t%4*8,e.length=n.ceil(t/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(4294967296*n.random()|0);return new s.init(t,e)}}),o=r.enc={},u=o.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push((a>>>4).toString(16)),r.push((15&a).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},c=o.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var a=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(a))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},l=o.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},h=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(e){var t=this._data,r=t.words,i=t.sigBytes,a=this.blockSize,o=i/(4*a),u=(o=e?n.ceil(o):n.max((0|o)-this._minBufferSize,0))*a,c=n.min(4*u,i);if(u){for(var l=0;l<u;l+=a)this._doProcessBlock(r,l);var h=r.splice(0,u);t.sigBytes-=c}return new s.init(h,c)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),i.Hasher=h.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){h.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new f.HMAC.init(e,n).finalize(t)}}}),f=r.algo={},r);!function(e){var t,n=(t=g).lib,r=n.Base,i=n.WordArray;(t=t.x64={}).Word=r.extend({init:function(e,t){this.high=e,this.low=t}}),t.WordArray=r.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,n=[],r=0;r<t;r++){var a=e[r];n.push(a.high),n.push(a.low)}return i.create(n,this.sigBytes)},clone:function(){for(var e=r.clone.call(this),t=e.words=this.words.slice(0),n=t.length,i=0;i<n;i++)t[i]=t[i].clone();return e}})}(),g.lib.Cipher||function(e){var t=(p=g).lib,n=t.Base,r=t.WordArray,i=t.BufferedBlockAlgorithm,a=p.enc.Base64,s=p.algo.EvpKDF,o=t.Cipher=i.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,r){return("string"==typeof n?d:f).encrypt(e,t,n,r)},decrypt:function(t,n,r){return("string"==typeof n?d:f).decrypt(e,t,n,r)}}}});t.StreamCipher=o.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=p.mode={},c=function(e,t,n){var r=this._iv;r?this._iv=void 0:r=this._prevBlock;for(var i=0;i<n;i++)e[t+i]^=r[i]},l=(t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();l.Encryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize;c.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),l.Decryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=e.slice(t,t+r);n.decryptBlock(e,t),c.call(this,e,t,r),this._prevBlock=i}}),u=u.CBC=l,l=(p.pad={}).Pkcs7={pad:function(e,t){for(var n,i=(n=(n=4*t)-e.sigBytes%n)<<24|n<<16|n<<8|n,a=[],s=0;s<n;s+=4)a.push(i);n=r.create(a,n),e.concat(n)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=o.extend({cfg:o.cfg.extend({mode:u,padding:l}),reset:function(){o.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var h=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),f=(u=(p.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){var t=(e=a.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=r.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return h.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:u}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,h.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),p=(p.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=s.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,h.create({key:e,iv:n,salt:i})}},d=t.PasswordBasedCipher=f.extend({cfg:f.cfg.extend({kdf:p}),encrypt:function(e,t,n,r){return n=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,(e=f.encrypt.call(this,e,t,n.key,r)).mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,f.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=g,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],a=[],s=[],o=[],u=[],c=[],l=[],h=[],f=[],p=[],d=0;256>d;d++)p[d]=128>d?d<<1:d<<1^283;var m=0,v=0;for(d=0;256>d;d++){var y=(y=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&y^99;r[m]=y,i[y]=m;var b=p[m],w=p[b],x=p[w],S=257*p[y]^16843008*y;a[m]=S<<24|S>>>8,s[m]=S<<16|S>>>16,o[m]=S<<8|S>>>24,u[m]=S,S=16843009*x^65537*w^257*b^16843008*m,c[y]=S<<24|S>>>8,l[y]=S<<16|S>>>16,h[y]=S<<8|S>>>24,f[y]=S,m?(m=b^p[p[p[x^b]]],v^=p[p[v]]):m=v=1}var E=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),i=this._keySchedule=[],a=0;a<n;a++)if(a<t)i[a]=e[a];else{var s=i[a-1];a%t?6<t&&4==a%t&&(s=r[s>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s]):(s=r[(s=s<<8|s>>>24)>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s],s^=E[a/t|0]<<24),i[a]=i[a-t]^s}for(e=this._invKeySchedule=[],t=0;t<n;t++)a=n-t,s=t%4?i[a]:i[a-4],e[t]=4>t||4>=a?s:c[r[s>>>24]]^l[r[s>>>16&255]]^h[r[s>>>8&255]]^f[r[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,o,u,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,c,l,h,f,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,s,o){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],h=e[t+2]^n[2],f=e[t+3]^n[3],p=4,d=1;d<u;d++){var g=r[c>>>24]^i[l>>>16&255]^a[h>>>8&255]^s[255&f]^n[p++],m=r[l>>>24]^i[h>>>16&255]^a[f>>>8&255]^s[255&c]^n[p++],v=r[h>>>24]^i[f>>>16&255]^a[c>>>8&255]^s[255&l]^n[p++];f=r[f>>>24]^i[c>>>16&255]^a[l>>>8&255]^s[255&h]^n[p++],c=g,l=m,h=v}g=(o[c>>>24]<<24|o[l>>>16&255]<<16|o[h>>>8&255]<<8|o[255&f])^n[p++],m=(o[l>>>24]<<24|o[h>>>16&255]<<16|o[f>>>8&255]<<8|o[255&c])^n[p++],v=(o[h>>>24]<<24|o[f>>>16&255]<<16|o[c>>>8&255]<<8|o[255&l])^n[p++],f=(o[f>>>24]<<24|o[c>>>16&255]<<16|o[l>>>8&255]<<8|o[255&h])^n[p++],e[t]=g,e[t+1]=m,e[t+2]=v,e[t+3]=f},keySize:8});e.AES=t._createHelper(n)}(),function(){function e(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<<e}function t(e,t){var n=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<<e}var n=g,r=(i=n.lib).WordArray,i=i.BlockCipher,a=n.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=a.DES=i.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;56>n;n++){var r=s[n]-1;t[n]=e[r>>>5]>>>31-r%32&1}for(e=this._subKeys=[],r=0;16>r;r++){var i=e[r]=[],a=u[r];for(n=0;24>n;n++)i[n/6|0]|=t[(o[n]-1+a)%28]<<31-n%6,i[4+(n/6|0)]|=t[28+(o[n+24]-1+a)%28]<<31-n%6;for(i[0]=i[0]<<1|i[0]>>>31,n=1;7>n;n++)i[n]>>>=4*(n-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(t=this._invSubKeys=[],n=0;16>n;n++)t[n]=e[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(n,r,i){this._lBlock=n[r],this._rBlock=n[r+1],e.call(this,4,252645135),e.call(this,16,65535),t.call(this,2,858993459),t.call(this,8,16711935),e.call(this,1,1431655765);for(var a=0;16>a;a++){for(var s=i[a],o=this._lBlock,u=this._rBlock,h=0,f=0;8>f;f++)h|=c[f][((u^s[f])&l[f])>>>0];this._lBlock=u,this._rBlock=o^h}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,e.call(this,1,1431655765),t.call(this,8,16711935),t.call(this,2,858993459),e.call(this,16,65535),e.call(this,4,252645135),n[r]=this._lBlock,n[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});n.DES=i._createHelper(h),a=a.TripleDES=i.extend({_doReset:function(){var e=this._key.words;this._des1=h.createEncryptor(r.create(e.slice(0,2))),this._des2=h.createEncryptor(r.create(e.slice(2,4))),this._des3=h.createEncryptor(r.create(e.slice(4,6)))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2}),n.TripleDES=i._createHelper(a)}(),function(){var e=g,t=e.lib.WordArray;e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp(),e=[];for(var i=0;i<n;i+=3)for(var a=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s<n;s++)e.push(r.charAt(a>>>6*(3-s)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var n=e.length,r=this._map;(i=r.charAt(64))&&(-1!=(i=e.indexOf(i))&&(n=i));for(var i=[],a=0,s=0;s<n;s++)if(s%4){var o=r.indexOf(e.charAt(s-1))<<s%4*2,u=r.indexOf(e.charAt(s))>>>6-s%4*2;i[a>>>2]|=(o|u)<<24-a%4*8,a++}return t.create(i,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(e){function t(e,t,n,r,i,a,s){return((e=e+(t&n|~t&r)+i+s)<<a|e>>>32-a)+t}function n(e,t,n,r,i,a,s){return((e=e+(t&r|n&~r)+i+s)<<a|e>>>32-a)+t}function r(e,t,n,r,i,a,s){return((e=e+(t^n^r)+i+s)<<a|e>>>32-a)+t}function i(e,t,n,r,i,a,s){return((e=e+(n^(t|~r))+i+s)<<a|e>>>32-a)+t}for(var a=g,s=(u=a.lib).WordArray,o=u.Hasher,u=a.algo,c=[],l=0;64>l;l++)c[l]=4294967296*e.abs(e.sin(l+1))|0;u=u.MD5=o.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,a){for(var s=0;16>s;s++){var o=e[u=a+s];e[u]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}s=this._hash.words;var u=e[a+0],l=(o=e[a+1],e[a+2]),h=e[a+3],f=e[a+4],p=e[a+5],d=e[a+6],g=e[a+7],m=e[a+8],v=e[a+9],y=e[a+10],b=e[a+11],w=e[a+12],x=e[a+13],S=e[a+14],E=e[a+15],F=t(F=s[0],C=s[1],D=s[2],A=s[3],u,7,c[0]),A=t(A,F,C,D,o,12,c[1]),D=t(D,A,F,C,l,17,c[2]),C=t(C,D,A,F,h,22,c[3]);F=t(F,C,D,A,f,7,c[4]),A=t(A,F,C,D,p,12,c[5]),D=t(D,A,F,C,d,17,c[6]),C=t(C,D,A,F,g,22,c[7]),F=t(F,C,D,A,m,7,c[8]),A=t(A,F,C,D,v,12,c[9]),D=t(D,A,F,C,y,17,c[10]),C=t(C,D,A,F,b,22,c[11]),F=t(F,C,D,A,w,7,c[12]),A=t(A,F,C,D,x,12,c[13]),D=t(D,A,F,C,S,17,c[14]),F=n(F,C=t(C,D,A,F,E,22,c[15]),D,A,o,5,c[16]),A=n(A,F,C,D,d,9,c[17]),D=n(D,A,F,C,b,14,c[18]),C=n(C,D,A,F,u,20,c[19]),F=n(F,C,D,A,p,5,c[20]),A=n(A,F,C,D,y,9,c[21]),D=n(D,A,F,C,E,14,c[22]),C=n(C,D,A,F,f,20,c[23]),F=n(F,C,D,A,v,5,c[24]),A=n(A,F,C,D,S,9,c[25]),D=n(D,A,F,C,h,14,c[26]),C=n(C,D,A,F,m,20,c[27]),F=n(F,C,D,A,x,5,c[28]),A=n(A,F,C,D,l,9,c[29]),D=n(D,A,F,C,g,14,c[30]),F=r(F,C=n(C,D,A,F,w,20,c[31]),D,A,p,4,c[32]),A=r(A,F,C,D,m,11,c[33]),D=r(D,A,F,C,b,16,c[34]),C=r(C,D,A,F,S,23,c[35]),F=r(F,C,D,A,o,4,c[36]),A=r(A,F,C,D,f,11,c[37]),D=r(D,A,F,C,g,16,c[38]),C=r(C,D,A,F,y,23,c[39]),F=r(F,C,D,A,x,4,c[40]),A=r(A,F,C,D,u,11,c[41]),D=r(D,A,F,C,h,16,c[42]),C=r(C,D,A,F,d,23,c[43]),F=r(F,C,D,A,v,4,c[44]),A=r(A,F,C,D,w,11,c[45]),D=r(D,A,F,C,E,16,c[46]),F=i(F,C=r(C,D,A,F,l,23,c[47]),D,A,u,6,c[48]),A=i(A,F,C,D,g,10,c[49]),D=i(D,A,F,C,S,15,c[50]),C=i(C,D,A,F,p,21,c[51]),F=i(F,C,D,A,w,6,c[52]),A=i(A,F,C,D,h,10,c[53]),D=i(D,A,F,C,y,15,c[54]),C=i(C,D,A,F,o,21,c[55]),F=i(F,C,D,A,m,6,c[56]),A=i(A,F,C,D,E,10,c[57]),D=i(D,A,F,C,d,15,c[58]),C=i(C,D,A,F,x,21,c[59]),F=i(F,C,D,A,f,6,c[60]),A=i(A,F,C,D,b,10,c[61]),D=i(D,A,F,C,l,15,c[62]),C=i(C,D,A,F,v,21,c[63]);s[0]=s[0]+F|0,s[1]=s[1]+C|0,s[2]=s[2]+D|0,s[3]=s[3]+A|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var a=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),n=(t=this._hash).words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),a.MD5=o._createHelper(u),a.HmacMD5=o._createHmacHelper(u)}(Math),function(){var e=g,t=(i=e.lib).WordArray,n=i.Hasher,r=[],i=e.algo.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],a=n[1],s=n[2],o=n[3],u=n[4],c=0;80>c;c++){if(16>c)r[c]=0|e[t+c];else{var l=r[c-3]^r[c-8]^r[c-14]^r[c-16];r[c]=l<<1|l>>>31}l=(i<<5|i>>>27)+u+r[c],l=20>c?l+(1518500249+(a&s|~a&o)):40>c?l+(1859775393+(a^s^o)):60>c?l+((a&s|a&o|s&o)-1894007588):l+((a^s^o)-899497514),u=o,o=s,s=a<<30|a>>>2,a=i,i=l}n[0]=n[0]+i|0,n[1]=n[1]+a|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=n._createHelper(i),e.HmacSHA1=n._createHmacHelper(i)}(),function(e){for(var t=g,n=(i=t.lib).WordArray,r=i.Hasher,i=t.algo,a=[],s=[],o=function(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var l;e:{l=u;for(var h=e.sqrt(l),f=2;f<=h;f++)if(!(l%f)){l=!1;break e}l=!0}l&&(8>c&&(a[c]=o(e.pow(u,.5))),s[c]=o(e.pow(u,1/3)),c++),u++}var p=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],o=n[3],u=n[4],c=n[5],l=n[6],h=n[7],f=0;64>f;f++){if(16>f)p[f]=0|e[t+f];else{var d=p[f-15],g=p[f-2];p[f]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+p[f-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+p[f-16]}d=h+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+s[f]+p[f],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&a^i&a),h=l,l=c,c=u,u=o+d|0,o=a,a=i,i=r,r=d+g|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+h|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(i),t.HmacSHA256=r._createHmacHelper(i)}(Math),function(){var e=g,t=e.lib.WordArray,n=(r=e.algo).SHA256,r=r.SHA224=n.extend({_doReset:function(){this._hash=new t.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=n._doFinalize.call(this);return e.sigBytes-=4,e}});e.SHA224=n._createHelper(r),e.HmacSHA224=n._createHmacHelper(r)}(),function(){function e(){return r.create.apply(r,arguments)}for(var t=g,n=t.lib.Hasher,r=(a=t.x64).Word,i=a.WordArray,a=t.algo,s=[e(1116352408,3609767458),e(1899447441,602891725),e(3049323471,3964484399),e(3921009573,2173295548),e(961987163,4081628472),e(1508970993,3053834265),e(2453635748,2937671579),e(2870763221,3664609560),e(3624381080,2734883394),e(310598401,1164996542),e(607225278,1323610764),e(1426881987,3590304994),e(1925078388,4068182383),e(2162078206,991336113),e(2614888103,633803317),e(3248222580,3479774868),e(3835390401,2666613458),e(4022224774,944711139),e(264347078,2341262773),e(604807628,2007800933),e(770255983,1495990901),e(1249150122,1856431235),e(1555081692,3175218132),e(1996064986,2198950837),e(2554220882,3999719339),e(2821834349,766784016),e(2952996808,2566594879),e(3210313671,3203337956),e(3336571891,1034457026),e(3584528711,2466948901),e(113926993,3758326383),e(338241895,168717936),e(666307205,1188179964),e(773529912,1546045734),e(1294757372,1522805485),e(1396182291,2643833823),e(1695183700,2343527390),e(1986661051,1014477480),e(2177026350,1206759142),e(2456956037,344077627),e(2730485921,1290863460),e(2820302411,3158454273),e(3259730800,3505952657),e(3345764771,106217008),e(3516065817,3606008344),e(3600352804,1432725776),e(4094571909,1467031594),e(275423344,851169720),e(430227734,3100823752),e(506948616,1363258195),e(659060556,3750685593),e(883997877,3785050280),e(958139571,3318307427),e(1322822218,3812723403),e(1537002063,2003034995),e(1747873779,3602036899),e(1955562222,1575990012),e(2024104815,1125592928),e(2227730452,2716904306),e(2361852424,442776044),e(2428436474,593698344),e(2756734187,3733110249),e(3204031479,2999351573),e(3329325298,3815920427),e(3391569614,3928383900),e(3515267271,566280711),e(3940187606,3454069534),e(4118630271,4000239992),e(116418474,1914138554),e(174292421,2731055270),e(289380356,3203993006),e(460393269,320620315),e(685471733,587496836),e(852142971,1086792851),e(1017036298,365543100),e(1126000580,2618297676),e(1288033470,3409855158),e(1501505948,4234509866),e(1607167915,987167468),e(1816402316,1246189591)],o=[],u=0;80>u;u++)o[u]=e();a=a.SHA512=n.extend({_doReset:function(){this._hash=new i.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=(h=this._hash.words)[0],r=h[1],i=h[2],a=h[3],u=h[4],c=h[5],l=h[6],h=h[7],f=n.high,p=n.low,d=r.high,g=r.low,m=i.high,v=i.low,y=a.high,b=a.low,w=u.high,x=u.low,S=c.high,E=c.low,F=l.high,A=l.low,D=h.high,C=h.low,R=f,$=p,I=d,T=g,P=m,_=v,k=y,O=b,j=w,N=x,B=S,H=E,L=F,M=A,U=D,V=C,q=0;80>q;q++){var K=o[q];if(16>q)var z=K.high=0|e[t+2*q],G=K.low=0|e[t+2*q+1];else{z=((G=(z=o[q-15]).high)>>>1|(W=z.low)<<31)^(G>>>8|W<<24)^G>>>7;var W=(W>>>1|G<<31)^(W>>>8|G<<24)^(W>>>7|G<<25),Y=((G=(Y=o[q-2]).high)>>>19|(X=Y.low)<<13)^(G<<3|X>>>29)^G>>>6,X=(X>>>19|G<<13)^(X<<3|G>>>29)^(X>>>6|G<<26),J=(G=o[q-7]).high,Q=(Z=o[q-16]).high,Z=Z.low;z=(z=(z=z+J+((G=W+G.low)>>>0<W>>>0?1:0))+Y+((G=G+X)>>>0<X>>>0?1:0))+Q+((G=G+Z)>>>0<Z>>>0?1:0);K.high=z,K.low=G}J=j&B^~j&L,Z=N&H^~N&M,K=R&I^R&P^I&P;var ee=$&T^$&_^T&_,te=(W=(R>>>28|$<<4)^(R<<30|$>>>2)^(R<<25|$>>>7),Y=($>>>28|R<<4)^($<<30|R>>>2)^($<<25|R>>>7),(X=s[q]).high),ne=X.low;Q=U+((j>>>14|N<<18)^(j>>>18|N<<14)^(j<<23|N>>>9))+((X=V+((N>>>14|j<<18)^(N>>>18|j<<14)^(N<<23|j>>>9)))>>>0<V>>>0?1:0),U=L,V=M,L=B,M=H,B=j,H=N,j=k+(Q=(Q=(Q=Q+J+((X=X+Z)>>>0<Z>>>0?1:0))+te+((X=X+ne)>>>0<ne>>>0?1:0))+z+((X=X+G)>>>0<G>>>0?1:0))+((N=O+X|0)>>>0<O>>>0?1:0)|0,k=P,O=_,P=I,_=T,I=R,T=$,R=Q+(K=W+K+((G=Y+ee)>>>0<Y>>>0?1:0))+(($=X+G|0)>>>0<X>>>0?1:0)|0}p=n.low=p+$,n.high=f+R+(p>>>0<$>>>0?1:0),g=r.low=g+T,r.high=d+I+(g>>>0<T>>>0?1:0),v=i.low=v+_,i.high=m+P+(v>>>0<_>>>0?1:0),b=a.low=b+O,a.high=y+k+(b>>>0<O>>>0?1:0),x=u.low=x+N,u.high=w+j+(x>>>0<N>>>0?1:0),E=c.low=E+H,c.high=S+B+(E>>>0<H>>>0?1:0),A=l.low=A+M,l.high=F+L+(A>>>0<M>>>0?1:0),C=h.low=C+V,h.high=D+U+(C>>>0<V>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(r+128>>>10<<5)]=n,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32}),t.SHA512=n._createHelper(a),t.HmacSHA512=n._createHmacHelper(a)}(),function(){var e=g,t=(i=e.x64).Word,n=i.WordArray,r=(i=e.algo).SHA512,i=i.SHA384=r.extend({_doReset:function(){this._hash=new n.init([new t.init(3418070365,3238371032),new t.init(1654270250,914150663),new t.init(2438529370,812702999),new t.init(355462360,4144912697),new t.init(1731405415,4290775857),new t.init(2394180231,1750603025),new t.init(3675008525,1694076839),new t.init(1203062813,3204075428)])},_doFinalize:function(){var e=r._doFinalize.call(this);return e.sigBytes-=16,e}});e.SHA384=r._createHelper(i),e.HmacSHA384=r._createHmacHelper(i)}(),function(){var e=g,t=(r=e.lib).WordArray,n=r.Hasher,r=e.algo,i=t.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]),a=t.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]),s=t.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),o=t.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=t.create([0,1518500249,1859775393,2400959708,2840853838]),c=t.create([1352829926,1548603684,1836072691,2053994217,0]);r=r.RIPEMD160=n.extend({_doReset:function(){this._hash=t.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;16>n;n++){var r=e[w=t+n];e[w]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var l,h,f,p,d,g,m,v,y,b,w=this._hash.words,x=(r=u.words,c.words),S=i.words,E=a.words,F=s.words,A=o.words;g=l=w[0],m=h=w[1],v=f=w[2],y=p=w[3],b=d=w[4];var D;for(n=0;80>n;n+=1)D=l+e[t+S[n]]|0,D=16>n?D+((h^f^p)+r[0]):32>n?D+((h&f|~h&p)+r[1]):48>n?D+(((h|~f)^p)+r[2]):64>n?D+((h&p|f&~p)+r[3]):D+((h^(f|~p))+r[4]),D=(D=(D|=0)<<F[n]|D>>>32-F[n])+d|0,l=d,d=p,p=f<<10|f>>>22,f=h,h=D,D=g+e[t+E[n]]|0,D=16>n?D+((m^(v|~y))+x[0]):32>n?D+((m&y|v&~y)+x[1]):48>n?D+(((m|~v)^y)+x[2]):64>n?D+((m&v|~m&y)+x[3]):D+((m^v^y)+x[4]),D=(D=(D|=0)<<A[n]|D>>>32-A[n])+b|0,g=b,b=y,y=v<<10|v>>>22,v=m,m=D;D=w[1]+f+y|0,w[1]=w[2]+p+b|0,w[2]=w[3]+d+g|0,w[3]=w[4]+l+m|0,w[4]=w[0]+h+v|0,w[0]=D},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;for(t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process(),t=(e=this._hash).words,n=0;5>n;n++)r=t[n],t[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return e},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.RIPEMD160=n._createHelper(r),e.HmacRIPEMD160=n._createHmacHelper(r)}(Math),function(){var e=g,t=e.enc.Utf8;e.algo.HMAC=e.lib.Base.extend({init:function(e,n){e=this._hasher=new e.init,"string"==typeof n&&(n=t.parse(n));var r=e.blockSize,i=4*r;n.sigBytes>i&&(n=e.finalize(n)),n.clamp();for(var a=this._oKey=n.clone(),s=this._iKey=n.clone(),o=a.words,u=s.words,c=0;c<r;c++)o[c]^=1549556828,u[c]^=909522486;a.sigBytes=s.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}})}(),function(){var e,t=g,n=(e=t.lib).Base,r=e.WordArray,i=(e=t.algo).HMAC,a=e.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:e.SHA1,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){var n=this.cfg,a=i.create(n.hasher,e),s=r.create(),o=r.create([1]),u=s.words,c=o.words,l=n.keySize;for(n=n.iterations;u.length<l;){var h=a.update(t).finalize(o);a.reset();for(var f=h.words,p=f.length,d=h,g=1;g<n;g++){d=a.finalize(d),a.reset();for(var m=d.words,v=0;v<p;v++)f[v]^=m[v]}s.concat(h),c[0]++}return s.sigBytes=4*l,s}});t.PBKDF2=function(e,t,n){return a.create(n).compute(e,t)}}();
|
|
2
2
|
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
|
|
3
3
|
*/
|
|
4
4
|
var m,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",y="=";function b(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=v.charAt(n>>6)+v.charAt(63&n);if(t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=v.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=v.charAt(n>>2)+v.charAt((3&n)<<4)),y)for(;(3&r.length)>0;)r+=y;return r}function w(e){var t,n,r,i="",a=0;for(t=0;t<e.length&&e.charAt(t)!=y;++t)(r=v.indexOf(e.charAt(t)))<0||(0==a?(i+=R(r>>2),n=3&r,a=1):1==a?(i+=R(n<<2|r>>4),n=15&r,a=2):2==a?(i+=R(n),i+=R(r>>2),n=3&r,a=3):(i+=R(n<<2|r>>4),i+=R(15&r),a=0));return 1==a&&(i+=R(n<<2)),i}function x(e){var t,n=w(e),r=new Array;for(t=0;2*t<n.length;++t)r[t]=parseInt(n.substring(2*t,2*t+2),16);return r}function S(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function E(){return new S(null)}"Microsoft Internet Explorer"==p.appName?(S.prototype.am=function(e,t,n,r,i,a){for(var s=32767&t,o=t>>15;--a>=0;){var u=32767&this[e],c=this[e++]>>15,l=o*u+c*s;i=((u=s*u+((32767&l)<<15)+n[r]+(1073741823&i))>>>30)+(l>>>15)+o*c+(i>>>30),n[r++]=1073741823&u}return i},m=30):"Netscape"!=p.appName?(S.prototype.am=function(e,t,n,r,i,a){for(;--a>=0;){var s=t*this[e++]+n[r]+i;i=Math.floor(s/67108864),n[r++]=67108863&s}return i},m=26):(S.prototype.am=function(e,t,n,r,i,a){for(var s=16383&t,o=t>>14;--a>=0;){var u=16383&this[e],c=this[e++]>>14,l=o*u+c*s;i=((u=s*u+((16383&l)<<14)+n[r]+i)>>28)+(l>>14)+o*c,n[r++]=268435455&u}return i},m=28),S.prototype.DB=m,S.prototype.DM=(1<<m)-1,S.prototype.DV=1<<m;S.prototype.FV=Math.pow(2,52),S.prototype.F1=52-m,S.prototype.F2=2*m-52;var F,A,D="0123456789abcdefghijklmnopqrstuvwxyz",C=new Array;for(F="0".charCodeAt(0),A=0;A<=9;++A)C[F++]=A;for(F="a".charCodeAt(0),A=10;A<36;++A)C[F++]=A;for(F="A".charCodeAt(0),A=10;A<36;++A)C[F++]=A;function R(e){return D.charAt(e)}function $(e,t){var n=C[e.charCodeAt(t)];return null==n?-1:n}function I(e){var t=E();return t.fromInt(e),t}function T(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function P(e){this.m=e}function _(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function k(e,t){return e&t}function O(e,t){return e|t}function j(e,t){return e^t}function N(e,t){return e&~t}function B(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function H(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function L(){}function M(e){return e}function U(e){this.r2=E(),this.q3=E(),S.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}P.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},P.prototype.revert=function(e){return e},P.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},P.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},P.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},_.prototype.convert=function(e){var t=E();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(S.ZERO)>0&&this.m.subTo(t,t),t},_.prototype.revert=function(e){var t=E();return e.copyTo(t),this.reduce(t),t},_.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(e[n=t+this.m.t]+=this.m.am(0,r,e,t,0,this.m.t);e[n]>=e.DV;)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},_.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},_.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},S.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},S.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},S.prototype.fromString=function(e,t){var n;if(16==t)n=4;else if(8==t)n=3;else if(256==t)n=8;else if(2==t)n=1;else if(32==t)n=5;else{if(4!=t)return void this.fromRadix(e,t);n=2}this.t=0,this.s=0;for(var r=e.length,i=!1,a=0;--r>=0;){var s=8==n?255&e[r]:$(e,r);s<0?"-"==e.charAt(r)&&(i=!0):(i=!1,0==a?this[this.t++]=s:a+n>this.DB?(this[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,(a+=n)>=this.DB&&(a-=this.DB))}8==n&&0!=(128&e[0])&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&S.ZERO.subTo(this,this)},S.prototype.clamp=function(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t},S.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},S.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},S.prototype.lShiftTo=function(e,t){var n,r=e%this.DB,i=this.DB-r,a=(1<<i)-1,s=Math.floor(e/this.DB),o=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)t[n+s+1]=this[n]>>i|o,o=(this[n]&a)<<r;for(n=s-1;n>=0;--n)t[n]=0;t[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},S.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,i=this.DB-r,a=(1<<r)-1;t[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)t[s-n-1]|=(this[s]&a)<<i,t[s-n]=this[s]>>r;r>0&&(t[this.t-n-1]|=(this.s&a)<<i),t.t=this.t-n,t.clamp()}},S.prototype.subTo=function(e,t){for(var n=0,r=0,i=Math.min(e.t,this.t);n<i;)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;n<this.t;)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<e.t;)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},S.prototype.multiplyTo=function(e,t){var n=this.abs(),r=e.abs(),i=n.t;for(t.t=i+r.t;--i>=0;)t[i]=0;for(i=0;i<r.t;++i)t[i+n.t]=n.am(0,r[i],t,i,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&S.ZERO.subTo(t,t)},S.prototype.squareTo=function(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},S.prototype.divRemTo=function(e,t,n){var r=e.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=t&&t.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=E());var a=E(),s=this.s,o=e.s,u=this.DB-T(r[r.t-1]);u>0?(r.lShiftTo(u,a),i.lShiftTo(u,n)):(r.copyTo(a),i.copyTo(n));var c=a.t,l=a[c-1];if(0!=l){var h=l*(1<<this.F1)+(c>1?a[c-2]>>this.F2:0),f=this.FV/h,p=(1<<this.F1)/h,d=1<<this.F2,g=n.t,m=g-c,v=null==t?E():t;for(a.dlShiftTo(m,v),n.compareTo(v)>=0&&(n[n.t++]=1,n.subTo(v,n)),S.ONE.dlShiftTo(c,v),v.subTo(a,a);a.t<c;)a[a.t++]=0;for(;--m>=0;){var y=n[--g]==l?this.DM:Math.floor(n[g]*f+(n[g-1]+d)*p);if((n[g]+=a.am(0,y,n,m,0,c))<y)for(a.dlShiftTo(m,v),n.subTo(v,n);n[g]<--y;)n.subTo(v,n)}null!=t&&(n.drShiftTo(c,t),s!=o&&S.ZERO.subTo(t,t)),n.t=c,n.clamp(),u>0&&n.rShiftTo(u,n),s<0&&S.ZERO.subTo(n,n)}}},S.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},S.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},S.prototype.exp=function(e,t){if(e>4294967295||e<1)return S.ONE;var n=E(),r=E(),i=t.convert(this),a=T(e)-1;for(i.copyTo(n);--a>=0;)if(t.sqrTo(n,r),(e&1<<a)>0)t.mulTo(r,i,n);else{var s=n;n=r,r=s}return t.revert(n)},S.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<<t)-1,i=!1,a="",s=this.t,o=this.DB-s*this.DB%t;if(s-- >0)for(o<this.DB&&(n=this[s]>>o)>0&&(i=!0,a=R(n));s>=0;)o<t?(n=(this[s]&(1<<o)-1)<<t-o,n|=this[--s]>>(o+=this.DB-t)):(n=this[s]>>(o-=t)&r,o<=0&&(o+=this.DB,--s)),n>0&&(i=!0),i&&(a+=R(n));return i?a:"0"},S.prototype.negate=function(){var e=E();return S.ZERO.subTo(this,e),e},S.prototype.abs=function(){return this.s<0?this.negate():this},S.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(0!=(t=n-e.t))return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0},S.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+T(this[this.t-1]^this.s&this.DM)},S.prototype.mod=function(e){var t=E();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(S.ZERO)>0&&e.subTo(t,t),t},S.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new P(t):new _(t),this.exp(e,n)},S.ZERO=I(0),S.ONE=I(1),L.prototype.convert=M,L.prototype.revert=M,L.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},L.prototype.sqrTo=function(e,t){e.squareTo(t)},U.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=E();return e.copyTo(t),this.reduce(t),t},U.prototype.revert=function(e){return e},U.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},U.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},U.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var V=[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],q=(1<<26)/V[V.length-1];
|
|
@@ -24,7 +24,7 @@ function(e,t){for(var n=e.toByteArray(),r=0;r<n.length&&0==n[r];)++r;if(n.length
|
|
|
24
24
|
oe.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ue.prototype.getEncoded=function(e){var t=function(e,t){var n=e.toByteArrayUnsigned();if(t<n.length)n=n.slice(n.length-t);else for(;t>n.length;)n.unshift(0);return n},n=this.getX().toBigInteger(),r=this.getY().toBigInteger(),i=t(n,32);return e?r.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(t(r,32))),i},ue.decodeFrom=function(e,t){t[0];var n=t.length-1,r=t.slice(1,1+n/2),i=t.slice(1+n/2,1+n);r.unshift(0),i.unshift(0);var a=new S(r),s=new S(i);return new ue(e,e.fromBigInteger(a),e.fromBigInteger(s))},ue.decodeFromHex=function(e,t){t.substr(0,2);var n=t.length-2,r=t.substr(2,n/2),i=t.substr(2+n/2,n/2),a=new S(r,16),s=new S(i,16);return new ue(e,e.fromBigInteger(a),e.fromBigInteger(s))},ue.prototype.add2D=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;if(this.x.equals(e.x))return this.y.equals(e.y)?this.twice():this.curve.getInfinity();var t=e.x.subtract(this.x),n=e.y.subtract(this.y).divide(t),r=n.square().subtract(this.x).subtract(e.x),i=n.multiply(this.x.subtract(r)).subtract(this.y);return new ue(this.curve,r,i)},ue.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var e=this.curve.fromBigInteger(S.valueOf(2)),t=this.curve.fromBigInteger(S.valueOf(3)),n=this.x.square().multiply(t).add(this.curve.a).divide(this.y.multiply(e)),r=n.square().subtract(this.x.multiply(e)),i=n.multiply(this.x.subtract(r)).subtract(this.y);return new ue(this.curve,r,i)},ue.prototype.multiply2D=function(e){if(this.isInfinity())return this;if(0==e.signum())return this.curve.getInfinity();var t,n=e,r=n.multiply(new S("3")),i=this.negate(),a=this;for(t=r.bitLength()-2;t>0;--t){a=a.twice();var s=r.testBit(t);s!=n.testBit(t)&&(a=a.add2D(s?this:i))}return a},ue.prototype.isOnCurve=function(){var e=this.getX().toBigInteger(),t=this.getY().toBigInteger(),n=this.curve.getA().toBigInteger(),r=this.curve.getB().toBigInteger(),i=this.curve.getQ(),a=t.multiply(t).mod(i),s=e.multiply(e).multiply(e).add(n.multiply(e)).add(r).mod(i);return a.equals(s)},ue.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ue.prototype.validate=function(){var e=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var t=this.getX().toBigInteger(),n=this.getY().toBigInteger();if(t.compareTo(S.ONE)<0||t.compareTo(e.subtract(S.ONE))>0)throw new Error("x coordinate out of bounds");if(n.compareTo(S.ONE)<0||n.compareTo(e.subtract(S.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(e).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};
|
|
25
25
|
/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
|
|
26
26
|
*/
|
|
27
|
-
var le=function(){var e=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),n={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function r(e,t,r){return t?n[t]:String.fromCharCode(parseInt(r,16))}var i=new String(""),a=Object.hasOwnProperty;return function(n,s){var o,u,c=n.match(e),l=c[0],h=!1;"{"===l?o={}:"["===l?o=[]:(o=[],h=!0);for(var f=[o],p=1-h,d=c.length;p<d;++p){var g;switch((l=c[p]).charCodeAt(0)){default:(g=f[0])[u||g.length]=+l,u=void 0;break;case 34:if(-1!==(l=l.substring(1,l.length-1)).indexOf("\\")&&(l=l.replace(t,r)),g=f[0],!u){if(!(g instanceof Array)){u=l||i;break}u=g.length}g[u]=l,u=void 0;break;case 91:g=f[0],f.unshift(g[u||g.length]=[]),u=void 0;break;case 93:f.shift();break;case 102:(g=f[0])[u||g.length]=!1,u=void 0;break;case 110:(g=f[0])[u||g.length]=null,u=void 0;break;case 116:(g=f[0])[u||g.length]=!0,u=void 0;break;case 123:g=f[0],f.unshift(g[u||g.length]={}),u=void 0;break;case 125:f.shift()}}if(h){if(1!==f.length)throw new Error;o=o[0]}else if(f.length)throw new Error;if(s){var m=function(e,t){var n=e[t];if(n&&"object"==typeof n){var r=null;for(var i in n)if(a.call(n,i)&&n!==e){var o=m(n,i);void 0!==o?n[i]=o:(r||(r=[]),r.push(i))}if(r)for(var u=r.length;--u>=0;)delete n[r[u]]}return s.call(e,t,n)};o=m({"":o},"")}return o}}();void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),he.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r="",i=0;i<n;i++)r+="f";t=new S(r,16).xor(e).add(S.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return Ie(e,t)},this.newObject=function(e){var t=he.asn1,n=t.ASN1Object,r=t.DERBoolean,i=t.DERInteger,a=t.DERBitString,s=t.DEROctetString,o=t.DERNull,u=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,h=t.DERNumericString,f=t.DERPrintableString,p=t.DERTeletexString,d=t.DERIA5String,g=t.DERUTCTime,m=t.DERGeneralizedTime,v=t.DERVisibleString,y=t.DERBMPString,b=t.DERSequence,w=t.DERSet,x=t.DERTaggedObject,S=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var E=Object.keys(e);if(1!=E.length)throw new Error("key of param shall be only one.");var F=E[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+F+":"))throw new Error("undefined key: "+F);if("bool"==F)return new r(e[F]);if("int"==F)return new i(e[F]);if("bitstr"==F)return new a(e[F]);if("octstr"==F)return new s(e[F]);if("null"==F)return new o(e[F]);if("oid"==F)return new u(e[F]);if("enum"==F)return new c(e[F]);if("utf8str"==F)return new l(e[F]);if("numstr"==F)return new h(e[F]);if("prnstr"==F)return new f(e[F]);if("telstr"==F)return new p(e[F]);if("ia5str"==F)return new d(e[F]);if("utctime"==F)return new g(e[F]);if("gentime"==F)return new m(e[F]);if("visstr"==F)return new v(e[F]);if("bmpstr"==F)return new y(e[F]);if("asn1"==F)return new n(e[F]);if("seq"==F){for(var A=e[F],D=[],C=0;C<A.length;C++){var R=S(A[C]);D.push(R)}return new b({array:D})}if("set"==F){for(A=e[F],D=[],C=0;C<A.length;C++){R=S(A[C]);D.push(R)}return new w({array:D})}if("tag"==F){var $=e[F];if("[object Array]"===Object.prototype.toString.call($)&&3==$.length){var I=S($[2]);return new x({tag:$[0],explicit:$[1],obj:I})}return new x($)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},he.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),r=(t=Math.floor(n/40)+"."+n%40,""),i=2;i<e.length;i+=2){var a=("00000000"+parseInt(e.substr(i,2),16).toString(2)).slice(-8);if(r+=a.substr(1,7),"0"==a.substr(0,1))t=t+"."+new S(r,2).toString(10),r=""}return t},he.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=new S(e,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var a="",s=0;s<i;s++)a+="0";r=a+r;for(s=0;s<r.length-1;s+=7){var o=r.substr(s,7);s!=r.length-7&&(o="1"+o),n+=t(parseInt(o,2))}return n};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",i=e.split("."),a=40*parseInt(i[0])+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r},he.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+"".length+",v="+this.hV);var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var n=t.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},he.asn1.DERAbstractString=function(e){he.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=Ee(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},We(he.asn1.DERAbstractString,he.asn1.ASN1Object),he.asn1.DERAbstractTime=function(e){he.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,n){var r=this.zeroPadding,i=this.localDateToUTC(e),a=String(i.getFullYear());"utc"==t&&(a=a.substr(2,2));var s=a+r(String(i.getMonth()+1),2)+r(String(i.getDate()),2)+r(String(i.getHours()),2)+r(String(i.getMinutes()),2)+r(String(i.getSeconds()),2);if(!0===n){var o=i.getMilliseconds();if(0!=o){var u=r(String(o),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=ye(e)},this.setByDateValue=function(e,t,n,r,i,a){var s=new Date(Date.UTC(e,t-1,n,r,i,a,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},We(he.asn1.DERAbstractTime,he.asn1.ASN1Object),he.asn1.DERAbstractStructured=function(e){he.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},We(he.asn1.DERAbstractStructured,he.asn1.ASN1Object),he.asn1.DERBoolean=function(e){he.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},We(he.asn1.DERBoolean,he.asn1.ASN1Object),he.asn1.DERInteger=function(e){he.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=he.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new S(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},We(he.asn1.DERInteger,he.asn1.ASN1Object),he.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=he.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}he.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var n=0;n<=t;n++)e+="0";var r="";for(n=0;n<e.length-1;n+=8){var i=e.substr(n,8),a=parseInt(i,2).toString(16);1==a.length&&(a="0"+a),r+=a}this.hTLV=null,this.isModified=!0,this.hV="0"+t+r},this.setByBooleanArray=function(e){for(var t="",n=0;n<e.length;n++)1==e[n]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},We(he.asn1.DERBitString,he.asn1.ASN1Object),he.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=he.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}he.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},We(he.asn1.DEROctetString,he.asn1.DERAbstractString),he.asn1.DERNull=function(){he.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},We(he.asn1.DERNull,he.asn1.ASN1Object),he.asn1.DERObjectIdentifier=function(e){he.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var t=qe(e);if(null==t)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueName=function(e){var t=he.asn1.x509.OID.name2oid(e);if(""===t)throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(t)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){"string"==typeof e?this.setValueNameOrOid(e):void 0!==e.oid?this.setValueNameOrOid(e.oid):void 0!==e.name?this.setValueNameOrOid(e.name):void 0!==e.hex&&this.setValueHex(e.hex)},void 0!==e&&this.setByParam(e)},We(he.asn1.DERObjectIdentifier,he.asn1.ASN1Object),he.asn1.DEREnumerated=function(e){he.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=he.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new S(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},We(he.asn1.DEREnumerated,he.asn1.ASN1Object),he.asn1.DERUTF8String=function(e){he.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},We(he.asn1.DERUTF8String,he.asn1.DERAbstractString),he.asn1.DERNumericString=function(e){he.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},We(he.asn1.DERNumericString,he.asn1.DERAbstractString),he.asn1.DERPrintableString=function(e){he.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},We(he.asn1.DERPrintableString,he.asn1.DERAbstractString),he.asn1.DERTeletexString=function(e){he.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},We(he.asn1.DERTeletexString,he.asn1.DERAbstractString),he.asn1.DERIA5String=function(e){he.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},We(he.asn1.DERIA5String,he.asn1.DERAbstractString),he.asn1.DERVisibleString=function(e){he.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},We(he.asn1.DERVisibleString,he.asn1.DERAbstractString),he.asn1.DERBMPString=function(e){he.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},We(he.asn1.DERBMPString,he.asn1.DERAbstractString),he.asn1.DERUTCTime=function(e){he.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=ye(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=ye(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},We(he.asn1.DERUTCTime,he.asn1.DERAbstractTime),he.asn1.DERGeneralizedTime=function(e){he.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=ye(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=ye(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},We(he.asn1.DERGeneralizedTime,he.asn1.DERAbstractTime),he.asn1.DERSequence=function(e){he.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},We(he.asn1.DERSequence,he.asn1.DERAbstractStructured),he.asn1.DERSet=function(e){he.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},We(he.asn1.DERSet,he.asn1.DERAbstractStructured),he.asn1.DERTaggedObject=function(e){he.asn1.DERTaggedObject.superclass.constructor.call(this);var t=he.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){null!=e.tag&&(this.hT=e.tag),null!=e.explicit&&(this.isExplicit=e.explicit),null!=e.tage&&(this.hT=e.tage,this.isExplicit=!0),null!=e.tagi&&(this.hT=e.tagi,this.isExplicit=!1),null!=e.obj&&(e.obj instanceof t.ASN1Object?(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==typeof e.obj&&(this.asn1Object=t.ASN1Util.newObject(e.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=e&&this.setByParam(e)},We(he.asn1.DERTaggedObject,he.asn1.ASN1Object);var he,fe,pe,de=new function(){};function ge(e){for(var t=new Array,n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function me(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function ve(e){for(var t="",n=0;n<e.length;n++){var r=e[n].toString(16);1==r.length&&(r="0"+r),t+=r}return t}function ye(e){return ve(ge(e))}function be(e){return e=(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function we(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function xe(e){return e.length%2==1&&(e="0"+e),be(b(e))}function Se(e){return w(we(e))}function Ee(e){return ke(Le(e))}function Fe(e){return decodeURIComponent(Oe(e))}function Ae(e){for(var t="",n=0;n<e.length-1;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t}function De(e){for(var t="",n=0;n<e.length;n++)t+=("0"+e.charCodeAt(n).toString(16)).slice(-2);return t}function Ce(e){return b(e)}function Re(e){var t=Ce(e).replace(/(.{64})/g,"$1\r\n");return t=t.replace(/\r\n$/,"")}function $e(e){return w(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}function Ie(e,t){return"-----BEGIN "+t+"-----\r\n"+Re(e)+"\r\n-----END "+t+"-----\r\n"}function Te(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return $e(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Pe(e){var t,n,r,i,a,s,o,u,c,l,h;if(h=e.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return u=h[1],t=parseInt(u),2===u.length&&(50<=t&&t<100?t=1900+t:0<=t&&t<50&&(t=2e3+t)),n=parseInt(h[2])-1,r=parseInt(h[3]),i=parseInt(h[4]),a=parseInt(h[5]),s=parseInt(h[6]),o=0,""!==(c=h[7])&&(l=(c.substr(1)+"00").substr(0,3),o=parseInt(l)),Date.UTC(t,n,r,i,a,s,o);throw"unsupported zulu format: "+e}function _e(e){return~~(Pe(e)/1e3)}function ke(e){return e.replace(/%/g,"")}function Oe(e){return e.replace(/(..)/g,"%$1")}function je(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;var n=(e=e.toLowerCase()).split(":").length-1;if(n<2)throw t;var r=":".repeat(7-n+2),i=(e=e.replace("::",r)).split(":");if(8!=i.length)throw t;for(var a=0;a<8;a++)i[a]=("0000"+i[a]).slice(-4);return i.join("")}function Ne(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var t=(e=e.toLowerCase()).match(/.{1,4}/g),n=0;n<8;n++)t[n]=t[n].replace(/^0+/,""),""==t[n]&&(t[n]="0");var r=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===r)return e.slice(1,-1);var i="";for(n=0;n<r.length;n++)r[n].length>i.length&&(i=r[n]);return(e=e.replace(i,"::")).slice(1,-1)}function Be(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?Ne(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}function He(e){return e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2),16);if(0==t&n<128)return String.fromCharCode(n);if(t<8){var r=128|63&n;return Fe((192|(7&t)<<3|(192&n)>>6).toString(16)+r.toString(16))}r=128|(15&t)<<2|(192&n)>>6;var i=128|63&n;return Fe((224|(240&t)>>4).toString(16)+r.toString(16)+i.toString(16))})).join("")}function Le(e){for(var t=encodeURIComponent(e),n="",r=0;r<t.length;r++)"%"==t[r]?(n+=t.substr(r,3),r+=2):n=n+"%"+ye(t[r]);return n}function Me(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function Ue(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function Ve(e){e=(e=(e=e.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return e.split(/,/).map((function(e,t,n){var r=parseInt(e);if(r<0||255<r)throw"integer not in range 0-255";return("00"+r.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}}de.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var n=parseInt(e.substr(t+3,1));return 0==n?-1:0<n&&n<10?n+1:-2},de.getL=function(e,t){var n=de.getLblen(e,t);return n<1?"":e.substr(t+2,2*n)},de.getVblen=function(e,t){var n;return""==(n=de.getL(e,t))?-1:("8"===n.substr(0,1)?new S(n.substr(2),16):new S(n,16)).intValue()},de.getVidx=function(e,t){var n=de.getLblen(e,t);return n<0?n:t+2*(n+1)},de.getV=function(e,t){var n=de.getVidx(e,t),r=de.getVblen(e,t);return e.substr(n,2*r)},de.getTLV=function(e,t){return e.substr(t,2)+de.getL(e,t)+de.getV(e,t)},de.getTLVblen=function(e,t){return 2+2*de.getLblen(e,t)+2*de.getVblen(e,t)},de.getNextSiblingIdx=function(e,t){return de.getVidx(e,t)+2*de.getVblen(e,t)},de.getChildIdx=function(e,t){var n,r,i,a=de,s=[];n=a.getVidx(e,t),r=2*a.getVblen(e,t),"03"==e.substr(t,2)&&(n+=2,r-=2),i=0;for(var o=n;i<=r;){var u=a.getTLVblen(e,o);if((i+=u)<=r&&s.push(o),o+=u,i>=r)break}return s},de.getNthChildIdx=function(e,t,n){return de.getChildIdx(e,t)[n]},de.getIdxbyList=function(e,t,n,r){var i,a,s=de;return 0==n.length?void 0!==r&&e.substr(t,2)!==r?-1:t:(i=n.shift())>=(a=s.getChildIdx(e,t)).length?-1:s.getIdxbyList(e,a[i],n,r)},de.getIdxbyListEx=function(e,t,n,r){var i,a,s=de;if(0==n.length)return void 0!==r&&e.substr(t,2)!==r?-1:t;i=n.shift(),a=s.getChildIdx(e,t);for(var o=0,u=0;u<a.length;u++){var c=e.substr(a[u],2);if("number"==typeof i&&!s.isContextTag(c)&&o==i||"string"==typeof i&&s.isContextTag(c,i))return s.getIdxbyListEx(e,a[u],n,r);s.isContextTag(c)||o++}return-1},de.getTLVbyList=function(e,t,n,r){var i=de,a=i.getIdxbyList(e,t,n,r);return-1==a?null:a>=e.length?null:i.getTLV(e,a)},de.getTLVbyListEx=function(e,t,n,r){var i=de,a=i.getIdxbyListEx(e,t,n,r);return-1==a?null:i.getTLV(e,a)},de.getVbyList=function(e,t,n,r,i){var a,s,o=de;return-1==(a=o.getIdxbyList(e,t,n,r))?null:a>=e.length?null:(s=o.getV(e,a),!0===i&&(s=s.substr(2)),s)},de.getVbyListEx=function(e,t,n,r,i){var a,s,o=de;return-1==(a=o.getIdxbyListEx(e,t,n,r))?null:(s=o.getV(e,a),"03"==e.substr(a,2)&&!1!==i&&(s=s.substr(2)),s)},de.getInt=function(e,t,n){null==n&&(n=-1);try{var r=e.substr(t,2);if("02"!=r&&"03"!=r)return n;var i=de.getV(e,t);return"02"==r?parseInt(i,16):Ge(i)}catch(e){return n}},de.getOID=function(e,t,n){null==n&&(n=null);try{return"06"!=e.substr(t,2)?n:Ke(de.getV(e,t))}catch(e){return n}},de.getOIDName=function(e,t,n){null==n&&(n=null);try{var r=de.getOID(e,t,n);if(r==n)return n;var i=he.asn1.x509.OID.oid2name(r);return""==i?r:i}catch(e){return n}},de.getString=function(e,t,n){null==n&&(n=null);try{return Ae(de.getV(e,t))}catch(e){return n}},de.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},n=[],r=e.substr(0,2),i=parseInt(r,16);n[0]=new String(Math.floor(i/40)),n[1]=new String(i%40);for(var a=e.substr(2),s=[],o=0;o<a.length/2;o++)s.push(parseInt(a.substr(2*o,2),16));var u=[],c="";for(o=0;o<s.length;o++)128&s[o]?c+=t((127&s[o]).toString(2),7):(c+=t((127&s[o]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var l=n.join(".");return u.length>0&&(l=l+"."+u.join(".")),l},de.dump=function(e,t,n,r){var i=de,a=i.getV,s=i.dump,o=i.getChildIdx,u=e;e instanceof he.asn1.ASN1Object&&(u=e.getEncodedHex());var c=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===n&&(n=0),void 0===r&&(r="");var l,h=t.ommit_long_octet;if("01"==(l=u.substr(n,2)))return"00"==(f=a(u,n))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==l)return r+"INTEGER "+c(f=a(u,n),h)+"\n";if("03"==l){var f=a(u,n);if(i.isASN1HEX(f.substr(2))){var p=r+"BITSTRING, encapsulates\n";return p+=s(f.substr(2),t,0,r+" ")}return r+"BITSTRING "+c(f,h)+"\n"}if("04"==l){f=a(u,n);if(i.isASN1HEX(f)){p=r+"OCTETSTRING, encapsulates\n";return p+=s(f,t,0,r+" ")}return r+"OCTETSTRING "+c(f,h)+"\n"}if("05"==l)return r+"NULL\n";if("06"==l){var d=a(u,n),g=he.asn1.ASN1Util.oidHexToInt(d),m=he.asn1.x509.OID.oid2name(g),v=g.replace(/\./g," ");return""!=m?r+"ObjectIdentifier "+m+" ("+v+")\n":r+"ObjectIdentifier ("+v+")\n"}if("0a"==l)return r+"ENUMERATED "+parseInt(a(u,n))+"\n";if("0c"==l)return r+"UTF8String '"+Fe(a(u,n))+"'\n";if("13"==l)return r+"PrintableString '"+Fe(a(u,n))+"'\n";if("14"==l)return r+"TeletexString '"+Fe(a(u,n))+"'\n";if("16"==l)return r+"IA5String '"+Fe(a(u,n))+"'\n";if("17"==l)return r+"UTCTime "+Fe(a(u,n))+"\n";if("18"==l)return r+"GeneralizedTime "+Fe(a(u,n))+"\n";if("1a"==l)return r+"VisualString '"+Fe(a(u,n))+"'\n";if("1e"==l)return r+"BMPString '"+He(a(u,n))+"'\n";if("30"==l){if("3000"==u.substr(n,4))return r+"SEQUENCE {}\n";p=r+"SEQUENCE\n";var y=t;if((2==(x=o(u,n)).length||3==x.length)&&"06"==u.substr(x[0],2)&&"04"==u.substr(x[x.length-1],2)){m=i.oidname(a(u,x[0]));var b=JSON.parse(JSON.stringify(t));b.x509ExtName=m,y=b}for(var w=0;w<x.length;w++)p+=s(u,y,x[w],r+" ");return p}if("31"==l){p=r+"SET\n";var x=o(u,n);for(w=0;w<x.length;w++)p+=s(u,t,x[w],r+" ");return p}if(0!=(128&(l=parseInt(l,16)))){var S=31&l;if(0!=(32&l)){for(p=r+"["+S+"]\n",x=o(u,n),w=0;w<x.length;w++)p+=s(u,t,x[w],r+" ");return p}f=a(u,n);if(de.isASN1HEX(f)){var p=r+"["+S+"]\n";return p+=s(f,t,0,r+" ")}return"68747470"==f.substr(0,8)?f=Fe(f):"subjectAltName"===t.x509ExtName&&2==S&&(f=Fe(f)),p=r+"["+S+"] "+f+"\n"}return r+"UNKNOWN("+l+") "+a(u,n)+"\n"},de.isContextTag=function(e,t){var n,r;e=e.toLowerCase();try{n=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&n);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((r=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&n)&&(31&n)==r))}catch(e){return!1}},de.isASN1HEX=function(e){var t=de;if(e.length%2==1)return!1;var n=t.getVblen(e,0),r=e.substr(0,2),i=t.getL(e,0);return e.length-r.length-i.length==2*n},de.checkStrictDER=function(e,t,n,r,i){var a=de;if(void 0===n){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!he.lang.String.isHex(e))throw new Error("not hex string");n=e.length,i=(r=e.length/2)<128?1:Math.ceil(r.toString(16))+1}if(a.getL(e,t).length>2*i)throw new Error("L of TLV too long: idx="+t);var s=a.getVblen(e,t);if(s>r)throw new Error("value of L too long than hex: idx="+t);var o=a.getTLV(e,t),u=o.length-2-a.getL(e,t).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===t&&e.length!=o.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+o.length);var c=e.substr(t,2);if("02"===c){var l=a.getVidx(e,t);if("00"==e.substr(l,2)&&e.charCodeAt(l+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var h=a.getVblen(e,t),f=0,p=a.getChildIdx(e,t),d=0;d<p.length;d++){f+=a.getTLV(e,p[d]).length,a.checkStrictDER(e,p[d],n,r,i)}if(2*h!=f)throw new Error("sum of children's TLV length and L unmatch: "+2*h+"!="+f)}},de.oidname=function(e){var t=he.asn1;he.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var n=t.x509.OID.oid2name(e);return""===n&&(n=e),n},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.x509&&he.asn1.x509||(he.asn1.x509={}),he.asn1.x509.Certificate=function(e){he.asn1.x509.Certificate.superclass.constructor.call(this);var t=he.asn1,n=t.DERBitString,r=t.DERSequence,i=t.x509,a=i.TBSCertificate,s=i.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.sigalg;null!=e.sigalg.name&&(t=e.sigalg.name);var n=e.tbsobj.getEncodedHex(),r=new he.crypto.Signature({alg:t});r.init(e.cakey),r.updateHex(n),e.sighex=r.sign()},this.getPEM=function(){return Ie(this.getEncodedHex(),"CERTIFICATE")},this.getEncodedHex=function(){var e=this.params;if(null!=e.tbsobj&&null!=e.tbsobj||(e.tbsobj=new a(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new s({name:e.sigalg})),t.push(new n({hex:"00"+e.sighex})),new r({array:t}).getEncodedHex()},null!=e&&(this.params=e)},We(he.asn1.x509.Certificate,he.asn1.ASN1Object),he.asn1.x509.TBSCertificate=function(e){he.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=he.asn1,n=t.x509,r=t.DERTaggedObject,i=t.DERInteger,a=t.DERSequence,s=n.AlgorithmIdentifier,o=n.Time,u=n.X500Name,c=n.Extensions,l=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version||1!=t.version){var n=2;null!=t.version&&(n=t.version-1);var h=new r({obj:new i({int:n})});e.push(h)}return e.push(new i(t.serial)),e.push(new s({name:t.sigalg})),e.push(new u(t.issuer)),e.push(new a({array:[new o(t.notbefore),new o(t.notafter)]})),e.push(new u(t.subject)),e.push(new l(Ye.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new r({tag:"a3",obj:new c(t.ext)})),new he.asn1.DERSequence({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.TBSCertificate,he.asn1.ASN1Object),he.asn1.x509.Extensions=function(e){he.asn1.x509.Extensions.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.x509;this.aParam=[],this.setByParam=function(e){this.aParam=e},this.getEncodedHex=function(){for(var e=[],t=0;t<this.aParam.length;t++){var i=this.aParam[t],a=i.extname,s=null;if(null!=i.extn)s=new r.PrivateExtension(i);else if("subjectKeyIdentifier"==a)s=new r.SubjectKeyIdentifier(i);else if("keyUsage"==a)s=new r.KeyUsage(i);else if("subjectAltName"==a)s=new r.SubjectAltName(i);else if("issuerAltName"==a)s=new r.IssuerAltName(i);else if("basicConstraints"==a)s=new r.BasicConstraints(i);else if("cRLDistributionPoints"==a)s=new r.CRLDistributionPoints(i);else if("certificatePolicies"==a)s=new r.CertificatePolicies(i);else if("authorityKeyIdentifier"==a)s=new r.AuthorityKeyIdentifier(i);else if("extKeyUsage"==a)s=new r.ExtKeyUsage(i);else if("authorityInfoAccess"==a)s=new r.AuthorityInfoAccess(i);else if("cRLNumber"==a)s=new r.CRLNumber(i);else if("cRLReason"==a)s=new r.CRLReason(i);else if("ocspNonce"==a)s=new r.OCSPNonce(i);else if("ocspNoCheck"==a)s=new r.OCSPNoCheck(i);else if("adobeTimeStamp"==a)s=new r.AdobeTimeStamp(i);else{if("subjectDirectoryAttributes"!=a)throw new Error("extension not supported:"+JSON.stringify(i));s=new r.SubjectDirectoryAttributes(i)}null!=s&&e.push(s)}return new n({array:e}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.x509.Extensions,he.asn1.ASN1Object),he.asn1.x509.Extension=function(e){he.asn1.x509.Extension.superclass.constructor.call(this);var t=he.asn1,n=t.DERObjectIdentifier,r=t.DEROctetString,i=(t.DERBitString,t.DERBoolean),a=t.DERSequence;this.getEncodedHex=function(){var e=new n({oid:this.oid}),t=new r({hex:this.getExtnValueHex()}),s=new Array;return s.push(e),this.critical&&s.push(new i),s.push(t),new a({array:s}).getEncodedHex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},We(he.asn1.x509.Extension,he.asn1.ASN1Object),he.asn1.x509.KeyUsage=function(e){he.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Ze.KEYUSAGE_NAME;if(this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15",void 0!==e&&(void 0!==e.bin&&(this.asn1ExtnValue=new he.asn1.DERBitString(e)),void 0!==e.names&&void 0!==e.names.length)){for(var n=e.names,r="000000000",i=0;i<n.length;i++)for(var a=0;a<t.length;a++)n[i]===t[a]&&(r=r.substring(0,a)+"1"+r.substring(a+1,r.length));this.asn1ExtnValue=new he.asn1.DERBitString({bin:r})}},We(he.asn1.x509.KeyUsage,he.asn1.x509.Extension),he.asn1.x509.BasicConstraints=function(e){he.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERBoolean,r=t.DERInteger,i=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new n),this.pathLen>-1&&e.push(new r({int:this.pathLen}));var t=new i({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==e&&(void 0!==e.cA&&(this.cA=e.cA),void 0!==e.pathLen&&(this.pathLen=e.pathLen))},We(he.asn1.x509.BasicConstraints,he.asn1.x509.Extension),he.asn1.x509.CRLDistributionPoints=function(e){he.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=he.asn1,n=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(e){for(var r=[],i=0;i<e.length;i++)if(e[i]instanceof he.asn1.ASN1Object)r.push(e[i]);else{var a=new n.DistributionPoint(e[i]);r.push(a)}this.asn1ExtnValue=new t.DERSequence({array:r})},this.setByOneURI=function(e){var t=new n.DistributionPoint({fulluri:e});this.setByDPArray([t])},this.oid="2.5.29.31",void 0!==e&&(void 0!==e.array?this.setByDPArray(e.array):void 0!==e.uri&&this.setByOneURI(e.uri))},We(he.asn1.x509.CRLDistributionPoints,he.asn1.x509.Extension),he.asn1.x509.DistributionPoint=function(e){he.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=he.asn1,n=t.x509.DistributionPointName;this.getEncodedHex=function(){var e=new t.DERSequence;if(null!=this.asn1DP){var n=new t.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});e.appendASN1Object(n)}return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.dpobj?this.asn1DP=e.dpobj:void 0!==e.dpname?this.asn1DP=new n(e.dpname):void 0!==e.fulluri&&(this.asn1DP=new n({full:[{uri:e.fulluri}]})))},We(he.asn1.x509.DistributionPoint,he.asn1.ASN1Object),he.asn1.x509.DistributionPointName=function(e){he.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=he.asn1,n=t.DERTaggedObject;if(this.getEncodedHex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new n({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.getEncodedHex(),this.hTLV},void 0!==e)if(t.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else{if(void 0===e.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new t.x509.GeneralNames(e.full)}},We(he.asn1.x509.DistributionPointName,he.asn1.ASN1Object),he.asn1.x509.CertificatePolicies=function(e){he.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=he.asn1,n=t.x509,r=t.DERSequence,i=n.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new i(this.params.array[t]));var n=new r({array:e});return this.asn1ExtnValue=n,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},We(he.asn1.x509.CertificatePolicies,he.asn1.x509.Extension),he.asn1.x509.PolicyInformation=function(e){he.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=t.x509.PolicyQualifierInfo;this.params=null,this.getEncodedHex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var e=[new r(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],a=0;a<this.params.array.length;a++)t.push(new i(this.params.array[a]));t.length>0&&e.push(new n({array:t}))}return new n({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.PolicyInformation,he.asn1.ASN1Object),he.asn1.x509.PolicyQualifierInfo=function(e){he.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.DERIA5String,i=t.DERObjectIdentifier,a=t.x509.UserNotice;this.params=null,this.getEncodedHex=function(){return void 0!==this.params.cps?new n({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new r({str:this.params.cps})]}).getEncodedHex():null!=this.params.unotice?new n({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new a(this.params.unotice)]}).getEncodedHex():void 0},void 0!==e&&(this.params=e)},We(he.asn1.x509.PolicyQualifierInfo,he.asn1.ASN1Object),he.asn1.x509.UserNotice=function(e){he.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=he.asn1.DERSequence,n=(he.asn1.DERInteger,he.asn1.x509.DisplayText),r=he.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new r(this.params.noticeref)),void 0!==this.params.exptext&&e.push(new n(this.params.exptext)),new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.UserNotice,he.asn1.ASN1Object),he.asn1.x509.NoticeReference=function(e){he.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=he.asn1.DERSequence,n=he.asn1.DERInteger,r=he.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var e=[];if(void 0!==this.params.org&&e.push(new r(this.params.org)),void 0!==this.params.noticenum){for(var i=[],a=this.params.noticenum,s=0;s<a.length;s++)i.push(new n(a[s]));e.push(new t({array:i}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.NoticeReference,he.asn1.ASN1Object),he.asn1.x509.DisplayText=function(e){he.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",void 0!==e&&("ia5"===e.type?this.hT="16":"vis"===e.type?this.hT="1a":"bmp"===e.type&&(this.hT="1e"))},We(he.asn1.x509.DisplayText,he.asn1.DERAbstractString),he.asn1.x509.ExtKeyUsage=function(e){he.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=he.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var n=0;n<e.length;n++){var r=new t.DERObjectIdentifier(e[n]);this.asn1ExtnValue.appendASN1Object(r)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},We(he.asn1.x509.ExtKeyUsage,he.asn1.x509.Extension),he.asn1.x509.AuthorityKeyIdentifier=function(e){he.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=he,n=t.asn1,r=n.DERTaggedObject,i=n.x509.GeneralNames;t.crypto.Util.isKey;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var e=new Array;this.asn1KID&&e.push(new r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new r({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new r({explicit:!1,tag:"82",obj:this.asn1CertSN}));var t=new n.DERSequence({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new he.asn1.DEROctetString(e);else if("object"==typeof e&&he.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=Ye.getKey(e));var n=Ye.getKeyID(t);this.asn1KID=new he.asn1.DEROctetString({hex:n})}},this.setCertIssuerByParam=function(e){void 0!==e.str||void 0!==e.ldapstr||void 0!==e.hex||void 0!==e.certsubject||void 0!==e.certissuer?this.asn1CertIssuer=new he.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new he.asn1.x509.X500Name({certissuer:e}))},this.setCertSNByParam=function(e){if(void 0!==e.str||void 0!==e.bigint||void 0!==e.hex)this.asn1CertSN=new he.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new Ze;t.readCertPEM(e);var n=t.getSerialNumberHex();this.asn1CertSN=new he.asn1.DERInteger({hex:n})}},this.oid="2.5.29.35",void 0!==e&&(void 0!==e.kid&&this.setKIDByParam(e.kid),void 0!==e.issuer&&this.setCertIssuerByParam(e.issuer),void 0!==e.sn&&this.setCertSNByParam(e.sn),void 0!==e.issuersn&&"string"==typeof e.issuersn&&-1!=e.issuersn.indexOf("BEGIN ")&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))},We(he.asn1.x509.AuthorityKeyIdentifier,he.asn1.x509.Extension),he.asn1.x509.SubjectKeyIdentifier=function(e){he.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=he.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new t(e);else if("object"==typeof e&&he.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var n=e;"string"==typeof e&&(n=Ye.getKey(e));var r=Ye.getKeyID(n);this.asn1KID=new he.asn1.DEROctetString({hex:r})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},We(he.asn1.x509.SubjectKeyIdentifier,he.asn1.x509.Extension),he.asn1.x509.AuthorityInfoAccess=function(e){he.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,n=he.asn1,r=n.DERSequence,i=n.DERObjectIdentifier,a=n.x509.GeneralName,s=0;s<e.length;s++){var o,u=e[s];if(void 0!==u.ocsp)o=new r({array:[new i({oid:"1.3.6.1.5.5.7.48.1"}),new a({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));o=new r({array:[new i({oid:"1.3.6.1.5.5.7.48.2"}),new a({uri:u.caissuer})]})}t.push(o)}this.asn1ExtnValue=new r({array:t})},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==e&&void 0!==e.array&&this.setAccessDescriptionArray(e.array)},We(he.asn1.x509.AuthorityInfoAccess,he.asn1.x509.Extension),he.asn1.x509.SubjectAltName=function(e){he.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new he.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.17",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},We(he.asn1.x509.SubjectAltName,he.asn1.x509.Extension),he.asn1.x509.IssuerAltName=function(e){he.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new he.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.18",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},We(he.asn1.x509.IssuerAltName,he.asn1.x509.Extension),he.asn1.x509.SubjectDirectoryAttributes=function(e){he.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.ASN1Util.newObject,i=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++){var a=this.params.array[t],s={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={gentime:a.str};else if("placeOfBirth"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={utf8str:a.str};else if("gender"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str};else if("countryOfCitizenship"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str};else{if("countryOfResidence"!=a.attr)throw new Error("unsupported attribute: "+a.attr);s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str}}e.push(new r(s))}var o=new n({array:e});return this.asn1ExtnValue=o,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.9",void 0!==e&&(this.params=e)},We(he.asn1.x509.SubjectDirectoryAttributes,he.asn1.x509.Extension),he.asn1.x509.PrivateExtension=function(e){he.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=he,n=t.lang.String.isHex,r=t.asn1,i=r.x509.OID.name2oid,a=r.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=i(e.extname),this.params=e},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var e=this.params.extn;if("string"==typeof e&&n(e))return e;if("object"==typeof e)try{return a(e).getEncodedHex()}catch(e){}throw new Error("unsupported extn value")},null!=e&&this.setByParam(e)},We(he.asn1.x509.PrivateExtension,he.asn1.x509.Extension),he.asn1.x509.CRL=function(e){he.asn1.x509.CRL.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.DERBitString,i=t.x509,a=i.AlgorithmIdentifier,s=i.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new s(this.params).getEncodedHex(),t=new he.crypto.Signature({alg:this.params.sigalg});t.init(this.params.cakey),t.updateHex(e);var n=t.sign();this.params.sighex=n},this.getPEM=function(){return Ie(this.getEncodedHex(),"X509 CRL")},this.getEncodedHex=function(){var e=this.params;if(null==e.tbsobj&&(e.tbsobj=new s(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new a({name:e.sigalg})),t.push(new r({hex:"00"+e.sighex})),new n({array:t}).getEncodedHex()},null!=e&&(this.params=e)},We(he.asn1.x509.CRL,he.asn1.ASN1Object),he.asn1.x509.TBSCertList=function(e){he.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=he.asn1,n=t.DERInteger,r=t.DERSequence,i=t.DERTaggedObject,a=(t.DERObjectIdentifier,t.x509),s=a.AlgorithmIdentifier,o=a.Time,u=a.Extensions,c=a.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,i=0;i<t.length;i++){var a=[new n(t[i].sn),new o(t[i].date)];null!=t[i].ext&&a.push(new u(t[i].ext)),e.push(new r({array:a}))}return new r({array:e})},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version){var a=t.version-1,l=new n({int:a});e.push(l)}if(e.push(new s({name:t.sigalg})),e.push(new c(t.issuer)),e.push(new o(t.thisupdate)),null!=t.nextupdate&&e.push(new o(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var h=new u(t.ext);e.push(new i({tag:"a0",explicit:!0,obj:h}))}return new r({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.TBSCertList,he.asn1.ASN1Object),he.asn1.x509.CRLEntry=function(e){he.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=he.asn1;this.setCertSerial=function(e){this.sn=new t.DERInteger(e)},this.setRevocationDate=function(e){this.time=new t.x509.Time(e)},this.getEncodedHex=function(){var e=new t.DERSequence({array:[this.sn,this.time]});return this.TLV=e.getEncodedHex(),this.TLV},void 0!==e&&(void 0!==e.time&&this.setRevocationDate(e.time),void 0!==e.sn&&this.setCertSerial(e.sn))},We(he.asn1.x509.CRLEntry,he.asn1.ASN1Object),he.asn1.x509.CRLNumber=function(e){he.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DERInteger(this.params.num),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},We(he.asn1.x509.CRLNumber,he.asn1.x509.Extension),he.asn1.x509.CRLReason=function(e){he.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},We(he.asn1.x509.CRLReason,he.asn1.x509.Extension),he.asn1.x509.OCSPNonce=function(e){he.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DEROctetString(this.params),this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},We(he.asn1.x509.OCSPNonce,he.asn1.x509.Extension),he.asn1.x509.OCSPNoCheck=function(e){he.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DERNull,this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},We(he.asn1.x509.OCSPNoCheck,he.asn1.x509.Extension),he.asn1.x509.AdobeTimeStamp=function(e){he.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERInteger,r=t.DERBoolean,i=t.DERSequence,a=t.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[new n(1)];return t.push(new a({uri:e.uri})),null!=e.reqauth&&t.push(new r(e.reqauth)),this.asn1ExtnValue=new i({array:t}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},We(he.asn1.x509.AdobeTimeStamp,he.asn1.x509.Extension),he.asn1.x509.X500Name=function(e){he.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=he.asn1,n=t.x509,r=n.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var n=e.split("/");n.shift();for(var i=[],a=0;a<n.length;a++)if(n[a].match(/^[^=]+=.+$/))i.push(n[a]);else{var s=i.length-1;i[s]=i[s]+"/"+n[a]}for(a=0;a<i.length;a++)this.asn1Array.push(new r({str:i[a],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var r=n.X500Name.ldapToCompat(e);this.setByString(r,t)},this.setByObject=function(e,t){for(var n in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(n)){var i=new r({str:n+"="+e[n],rule:this.sRule});this.asn1Array?this.asn1Array.push(i):this.asn1Array=[i]}},this.setByParam=function(e){var t;(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.array)?this.paramArray=e.array:void 0!==e.str?this.setByString(e.str):void 0!==e.ldapstr?this.setByLdapString(e.ldapstr):void 0!==e.hex?this.hTLV=e.hex:void 0!==e.certissuer?((t=new Ze).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new Ze).readCertPEM(e.certsubject),this.hTLV=t.getSubjectHex()):"object"==typeof e&&void 0===e.certsubject&&void 0===e.certissuer&&this.setByObject(e)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var n={array:this.paramArray[e]};"utf8"!=this.sRule&&(n.rule=this.sRule);var i=new r(n);this.asn1Array.push(i)}var a=new t.DERSequence({array:this.asn1Array});return this.hTLV=a.getEncodedHex(),this.hTLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.X500Name,he.asn1.ASN1Object),he.asn1.x509.X500Name.compatToLDAP=function(e){if("/"!==e.substr(0,1))throw"malformed input";var t=(e=e.substr(1)).split("/");return t.reverse(),(t=t.map((function(e){return e.replace(/,/,"\\,")}))).join(",")},he.asn1.x509.X500Name.onelineToLDAP=function(e){return he.asn1.x509.X500Name.compatToLDAP(e)},he.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),n=!1,r=[],i=0;t.length>0;i++){var a=t.shift();if(!0===n){var s=(r.pop()+","+a).replace(/\\,/g,",");r.push(s),n=!1}else r.push(a);"\\"===a.substr(-1,1)&&(n=!0)}return(r=r.map((function(e){return e.replace("/","\\/")}))).reverse(),"/"+r.join("/")},he.asn1.x509.X500Name.ldapToOneline=function(e){return he.asn1.x509.X500Name.ldapToCompat(e)},he.asn1.x509.RDN=function(e){he.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=he.asn1.x509.AttributeTypeAndValue;this.setByParam=function(e){void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.str&&this.addByMultiValuedString(e.str),void 0!==e.array&&(this.paramArray=e.array)},this.addByString=function(e){this.asn1Array.push(new he.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=he.asn1.x509.RDN.parseString(e),n=0;n<t.length;n++)this.addByString(t[n])},this.getEncodedHex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var n=this.paramArray[e];void 0!==n.rule&&"utf8"!=this.sRule&&(n.rule=this.sRule);var r=new t(n);this.asn1Array.push(r)}var i=new he.asn1.DERSet({array:this.asn1Array});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.RDN,he.asn1.ASN1Object),he.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),n=!1,r=[],i=0;t.length>0;i++){var a=t.shift();if(!0===n){var s=(r.pop()+"+"+a).replace(/\\\+/g,"+");r.push(s),n=!1}else r.push(a);"\\"===a.substr(-1,1)&&(n=!0)}var o=!1,u=[];for(i=0;r.length>0;i++){a=r.shift();if(!0===o){var c=u.pop();if(a.match(/"$/)){s=(c+"+"+a).replace(/^([^=]+)="(.*)"$/,"$1=$2");u.push(s),o=!1}else u.push(c+"+"+a)}else u.push(a);a.match(/^[^=]+="/)&&(o=!0)}return u},he.asn1.x509.AttributeTypeAndValue=function(e){he.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=he,n=t.asn1,r=n.DERSequence,i=n.DERUTF8String,a=n.DERPrintableString,s=n.DERTeletexString,o=n.DERIA5String,u=n.DERVisibleString,c=n.DERBMPString,l=t.lang.String.isMail,h=t.lang.String.isPrintable;this.setByParam=function(e){if(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.ds&&(this.dsType=e.ds),void 0===e.value&&void 0!==e.str){var t=e.str.match(/^([^=]+)=(.+)$/);if(!t)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=t[1],this.sValue=t[2]}else this.sType=e.type,this.sValue=e.value},this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var n=e.match(/^([^=]+)=(.+)$/);if(!n)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(n[1],n[2])},this._getDsType=function(){var e=this.sType,t=this.sValue,n=this.sRule;return"prn"===n?"CN"==e&&l(t)?"ia5":h(t)?"prn":"utf8":"utf8"===n?"CN"==e&&l(t)?"ia5":"C"==e?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(e,t,n){void 0!==n&&(this.sRule=n),this.sType=e,this.sValue=t},this.getValueObj=function(e,t){if("utf8"==e)return new i({str:t});if("prn"==e)return new a({str:t});if("tel"==e)return new s({str:t});if("ia5"==e)return new o({str:t});if("vis"==e)return new u({str:t});if("bmp"==e)return new c({str:t});throw new Error("unsupported directory string type: type="+e+" value="+t)},this.getEncodedHex=function(){null==this.dsType&&(this.dsType=this._getDsType());var e=he.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),n=new r({array:[e,t]});return this.TLV=n.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.AttributeTypeAndValue,he.asn1.ASN1Object),he.asn1.x509.SubjectPublicKeyInfo=function(e){he.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=he,n=t.asn1,r=n.DERInteger,i=n.DERBitString,a=n.DERObjectIdentifier,s=n.DERSequence,o=n.ASN1Util.newObject,u=n.x509.AlgorithmIdentifier,c=t.crypto;c.ECDSA,c.DSA;this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new s({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.getEncodedHex=function(){var e=this.getASN1Object();return this.hTLV=e.getEncodedHex(),this.hTLV},this.setPubKey=function(e){try{if(e instanceof ae){var t=o({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).getEncodedHex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+t})}}catch(e){}try{if(e instanceof he.crypto.ECDSA){var n=new a({name:e.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:n}),this.asn1SubjPKey=new i({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof he.crypto.DSA){n=new o({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:n});var s=new r({bigint:e.y});this.asn1SubjPKey=new i({hex:"00"+s.getEncodedHex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},We(he.asn1.x509.SubjectPublicKeyInfo,he.asn1.ASN1Object),he.asn1.x509.Time=function(e){he.asn1.x509.Time.superclass.constructor.call(this);var t=he.asn1,n=t.DERUTCTime,r=t.DERGeneralizedTime;this.setTimeParams=function(e){this.timeParams=e},this.getEncodedHex=function(){var e=null;return e=null!=this.timeParams?"utc"==this.type?new n(this.timeParams):new r(this.timeParams):"utc"==this.type?new n:new r,this.TLV=e.getEncodedHex(),this.TLV},this.type="utc",void 0!==e&&(void 0!==e.type?this.type=e.type:void 0!==e.str&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)},We(he.asn1.x509.Time,he.asn1.ASN1Object),he.asn1.x509.AlgorithmIdentifier=function(e){he.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=he.asn1,n=t.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.getEncodedHex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var e=null;for(var r in n)r===this.nameAlg&&(e=n[r]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var i=[this.asn1Alg];null!==this.asn1Params&&i.push(this.asn1Params);var a=new t.DERSequence({array:i});return this.hTLV=a.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.name&&(this.nameAlg=e.name),void 0!==e.asn1params&&(this.asn1Params=e.asn1params),void 0!==e.paramempty&&(this.paramEmpty=e.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var r=this.nameAlg.toLowerCase();"withdsa"!==r.substr(-7,7)&&"withecdsa"!==r.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},We(he.asn1.x509.AlgorithmIdentifier,he.asn1.ASN1Object),he.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},he.asn1.x509.GeneralName=function(e){he.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},n=he.asn1,r=(n.DERSequence,n.DEROctetString),i=n.DERIA5String,a=n.DERTaggedObject,s=n.ASN1Object,o=n.x509.X500Name,u=Te;this.explicit=!1,this.setByParam=function(e){var n=null;if(void 0!==e){if(void 0!==e.rfc822&&(this.type="rfc822",n=new i({str:e[this.type]})),void 0!==e.dns&&(this.type="dns",n=new i({str:e[this.type]})),void 0!==e.uri&&(this.type="uri",n=new i({str:e[this.type]})),void 0!==e.dn&&(this.type="dn",this.explicit=!0,n="string"==typeof e.dn?new o({str:e.dn}):e.dn instanceof he.asn1.x509.X500Name?e.dn:new o(e.dn)),void 0!==e.ldapdn&&(this.type="dn",this.explicit=!0,n=new o({ldapstr:e.ldapdn})),void 0!==e.certissuer){this.type="dn",this.explicit=!0;var c=null;if((h=e.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(c=u(h)),null==c)throw"certissuer param not cert";(f=new Ze).hex=c;var l=f.getIssuerHex();(n=new s).hTLV=l}if(void 0!==e.certsubj){this.type="dn",this.explicit=!0;var h,f;c=null;if((h=e.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(c=u(h)),null==c)throw"certsubj param not cert";(f=new Ze).hex=c;l=f.getSubjectHex();(n=new s).hTLV=l}if(void 0!==e.ip){this.type="ip",this.explicit=!1;var p,d=e.ip,g="malformed IP address";if(d.match(/^[0-9.]+[.][0-9.]+$/)){if(8!==(p=Ve("["+d.split(".").join(",")+"]")).length)throw g}else if(d.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))p=je(d);else{if(!d.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw g;p=d}n=new r({hex:p})}if(null==this.type)throw"unsupported type in params="+e;this.asn1Obj=new a({explicit:this.explicit,tag:t[this.type],obj:n})}},this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.GeneralName,he.asn1.ASN1Object),he.asn1.x509.GeneralNames=function(e){he.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=he.asn1;this.setByParamArray=function(e){for(var n=0;n<e.length;n++){var r=new t.x509.GeneralName(e[n]);this.asn1Array.push(r)}},this.getEncodedHex=function(){return new t.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},We(he.asn1.x509.GeneralNames,he.asn1.ASN1Object),he.asn1.x509.OID=new function(e){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var t=this.name2oidList[e],n=new he.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(void 0!==this.atype2oidList[e])t=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw"AttributeType name undefined: "+e;t=this.name2oidList[e]}var n=new he.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n}},he.asn1.x509.OID.oid2name=function(e){var t=he.asn1.x509.OID.name2oidList;for(var n in t)if(t[n]==e)return n;return""},he.asn1.x509.OID.oid2atype=function(e){var t=he.asn1.x509.OID.atype2oidList;for(var n in t)if(t[n]==e)return n;return e},he.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=he.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},he.asn1.x509.X509Util={},he.asn1.x509.X509Util.newCertPEM=function(e){var t=he.asn1.x509;t.TBSCertificate;return new(0,t.Certificate)(e).getPEM()},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.cms&&he.asn1.cms||(he.asn1.cms={}),he.asn1.cms.Attribute=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERSet,a=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(e){this.params=e},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.getEncodedHex=function(){var e=new a({oid:this.typeOid}),t=new i({array:this.getValueArray()});return new r({array:[e,t]}).getEncodedHex()}},We(he.asn1.cms.Attribute,he.asn1.ASN1Object),he.asn1.cms.ContentType=function(e){var t=he.asn1;t.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new t.DERObjectIdentifier(this.params.type)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.ContentType,he.asn1.cms.Attribute),he.asn1.cms.MessageDigest=function(e){var t=he.asn1,n=t.DEROctetString;t.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new n(this.params)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.MessageDigest,he.asn1.cms.Attribute),he.asn1.cms.SigningTime=function(e){var t=he.asn1;t.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new t.x509.Time(this.params)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningTime,he.asn1.cms.Attribute),he.asn1.cms.SigningCertificate=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=r.cms,s=a.ESSCertID;n.crypto;a.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var n=this.params.array,r=[],a=0;a<n.length;a++){var o=n[a];0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!de.isASN1HEX(o)||(o={cert:o}),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new s(o))}var u=new i({array:r});return[new i({array:[u]})]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningCertificate,he.asn1.cms.Attribute),he.asn1.cms.ESSCertID=function(e){he.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,n=he,r=n.asn1,i=r.DEROctetString,a=r.DERSequence,s=r.cms.IssuerSerial;this.params=null,this.getCertHash=function(e,r){if(null!=e.hash)return e.hash;if("string"==typeof e&&-1==e.indexOf("-----BEGIN")&&!de.isASN1HEX(e))return e;var i,a,s;if("string"==typeof e)i=e;else{if(null==e.cert)throw new t("hash nor cert unspecified");i=e.cert}if(a=-1!=i.indexOf("-----BEGIN")?Te(i):i,"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?a=Te(e):de.isASN1HEX(e)&&(a=e)),null!=e.alg)s=e.alg;else{if(null==r)throw new t("hash alg unspecified");s=r}return n.crypto.Util.hashHex(a,s)},this.getEncodedHex=function(){var e=this.params,t=this.getCertHash(e,"sha1"),n=[];return n.push(new i({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&n.push(new s(e)),new a({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.ESSCertID,he.asn1.ASN1Object),he.asn1.cms.SigningCertificateV2=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=(r.x509,r.cms),s=a.ESSCertIDv2;n.crypto;a.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var n=this.params.array,r=[],a=0;a<n.length;a++){var o=n[a];null==e.alg&&0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!de.isASN1HEX(o)||(o={cert:o}),null==o.alg&&null!=e.alg&&(o.alg=e.alg),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new s(o))}var u=new i({array:r});return[new i({array:[u]})]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningCertificateV2,he.asn1.cms.Attribute),he.asn1.cms.ESSCertIDv2=function(e){he.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);Error;var t=he.asn1,n=t.DEROctetString,r=t.DERSequence,i=t.cms.IssuerSerial,a=t.x509.AlgorithmIdentifier;this.params=null,this.getEncodedHex=function(){var e=this.params,t=this.getCertHash(e,"sha256"),s=[];return null!=e.alg&&"sha256"!=e.alg&&s.push(new a({name:e.alg})),s.push(new n({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&s.push(new i(e)),new r({array:s}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.ESSCertIDv2,he.asn1.cms.ESSCertID),he.asn1.cms.IssuerSerial=function(e){var t=Error,n=he.asn1,r=n.DERInteger,i=n.DERSequence,a=n.cms,s=n.x509.GeneralNames,o=Ze;a.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e,n,a=this.params;if("string"==typeof a&&-1!=a.indexOf("-----BEGIN")||null!=a.cert){var u;u=null!=a.cert?a.cert:a;var c=new o;c.readCertPEM(u),e=c.getIssuer(),n={hex:c.getSerialNumberHex()}}else{if(null==a.issuer||!a.serial)throw new t("cert or issuer and serial parameter not specified");e=a.issuer,n=a.serial}var l=new s([{dn:e}]),h=new r(n);return new i({array:[l,h]}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.IssuerSerial,he.asn1.ASN1Object),he.asn1.cms.SignerIdentifier=function(e){var t=he.asn1,n=(t.DERInteger,t.DERSequence,t.cms),r=n.IssuerAndSerialNumber,i=n.SubjectKeyIdentifier;t.x509.X500Name,Error;n.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if("isssn"==e.type)return new r(e).getEncodedHex();if("skid"==e.type)return new i(e).getEncodedHex();throw new Error("wrong property for isssn or skid")},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignerIdentifier,he.asn1.ASN1Object),he.asn1.cms.IssuerAndSerialNumber=function(e){var t=he.asn1,n=t.DERInteger,r=t.DERSequence,i=t.cms,a=t.x509.X500Name,s=Ze,o=Error;i.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e,t,i=this.params;if("string"==typeof i&&-1!=i.indexOf("-----BEGIN")||null!=i.cert){var u;u=null!=i.cert?i.cert:i;var c=new s;c.readCertPEM(u),e=c.getIssuer(),t={hex:c.getSerialNumberHex()}}else{if(null==i.issuer||!i.serial)throw new o("cert or issuer and serial parameter not specified");e=i.issuer,t=i.serial}var l=new a(e),h=new n(t);return new r({array:[l,h]}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.IssuerAndSerialNumber,he.asn1.ASN1Object),he.asn1.cms.SubjectKeyIdentifier=function(e){var t=he.asn1,n=(t.DERInteger,t.DERSequence,t.ASN1Util.newObject),r=t.cms,i=(r.IssuerAndSerialName,r.SubjectKeyIdentifier,t.x509.X500Name,Ze),a=Error;r.SubjectKeyIdentifier.superclass.constructor.call(this),this.getEncodedHex=function(){var e,t=this.params;if(null==t.cert&&null==t.skid)throw new a("property cert nor skid undefined");null!=t.cert?e=new i(t.cert).getExtSubjectKeyIdentifier().kid.hex:null!=t.skid&&(e=t.skid);return n({tag:{tage:"a0",obj:{octstr:{hex:e}}}}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SubjectKeyIdentifier,he.asn1.ASN1Object),he.asn1.cms.AttributeList=function(e){var t=Error,n=he.asn1,r=n.DERSet,i=n.cms;i.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params;if(null!=this.hTLV)return this.hTLV;var n=!0;null!=e.sortflag&&(n=e.sortflag);for(var a=e.array,s=[],o=0;o<a.length;o++){var u=a[o],c=u.attr;if("contentType"==c)s.push(new i.ContentType(u));else if("messageDigest"==c)s.push(new i.MessageDigest(u));else if("signingTime"==c)s.push(new i.SigningTime(u));else if("signingCertificate"==c)s.push(new i.SigningCertificate(u));else if("signingCertificateV2"==c)s.push(new i.SigningCertificateV2(u));else if("signaturePolicyIdentifier"==c)s.push(new he.asn1.cades.SignaturePolicyIdentifier(u));else{if("signatureTimeStamp"!=c&&"timeStampToken"!=c)throw new t("unknown attr: "+c);s.push(new he.asn1.cades.SignatureTimeStamp(u))}}var l=new r({array:s,sortflag:n});return this.hTLV=l.getEncodedHex(),this.hTLV},null!=e&&this.setByParam(e)},We(he.asn1.cms.AttributeList,he.asn1.ASN1Object),he.asn1.cms.SignerInfo=function(e){var t=Error,n=he,r=n.asn1,i=r.DERInteger,a=r.DEROctetString,s=r.DERSequence,o=r.DERTaggedObject,u=r.cms,c=u.SignerIdentifier,l=u.AttributeList,h=(u.ContentType,u.EncapsulatedContentInfo,u.MessageDigest,u.SignedData,r.x509.AlgorithmIdentifier),f=n.crypto,p=Ye;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var e=this.params,t=e.sigalg,n=new l(e.sattrs).getEncodedHex(),r=p.getKey(e.signkey),i=new f.Signature({alg:t});i.init(r),i.updateHex(n);var a=i.sign();e.sighex=a},this.getEncodedHex=function(){var e=this.params,n=[];if(n.push(new i({int:e.version})),n.push(new c(e.id)),n.push(new h({name:e.hashalg})),null!=e.sattrs){var r=new l(e.sattrs);try{n.push(new o({tag:"a0",explicit:!1,obj:r}))}catch(e){throw new t("si sattr error: "+e)}}if(null!=e.sigalgfield?n.push(new h({name:e.sigalgfield})):n.push(new h({name:e.sigalg})),null==e.sighex&&null!=e.signkey&&this.sign(),n.push(new a({hex:e.sighex})),null!=e.uattrs){r=new l(e.uattrs);try{n.push(new o({tag:"a1",explicit:!1,obj:r}))}catch(e){throw new t("si uattr error: "+e)}}return new s({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignerInfo,he.asn1.ASN1Object),he.asn1.cms.EncapsulatedContentInfo=function(e){var t=he.asn1,n=t.DERTaggedObject,r=t.DERSequence,i=t.DERObjectIdentifier,a=t.DEROctetString;t.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];if(t.push(new i(e.type)),null!=e.content&&(null!=e.content.hex||null!=e.content.str)&&1!=e.isDetached){var s=new a(e.content),o=new n({tag:"a0",explicit:!0,obj:s});t.push(o)}return new r({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.EncapsulatedContentInfo,he.asn1.ASN1Object),he.asn1.cms.ContentInfo=function(e){var t=he.asn1,n=t.DERTaggedObject,r=t.DERSequence,i=t.DERObjectIdentifier;t.x509.OID.name2obj;he.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];t.push(new i(e.type));var a=new n({tag:"a0",explicit:!0,obj:e.obj});return t.push(a),new r({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.ContentInfo,he.asn1.ASN1Object),he.asn1.cms.SignedData=function(e){Error;var t=he.asn1,n=(t.ASN1Object,t.DERInteger),r=t.DERSet,i=t.DERSequence,a=(t.DERTaggedObject,t.cms),s=a.EncapsulatedContentInfo,o=a.SignerInfo,u=a.ContentInfo,c=a.CertificateSet,l=a.RevocationInfoChoices,h=t.x509.AlgorithmIdentifier;he.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var e=this.params;this._setDigestAlgs(e),this._setContentTypeByEContent(e),this._setMessageDigestByEContent(e),this._setSignerInfoVersion(e),this._setSignedDataVersion(e)},this._setDigestAlgs=function(e){for(var t={},n=e.sinfos,r=0;r<n.length;r++){t[n[r].hashalg]=1}e.hashalgs=Object.keys(t).sort()},this._setContentTypeByEContent=function(e){for(var t=e.econtent.type,n=e.sinfos,r=0;r<n.length;r++){var i=n[r];this._getAttrParamByName(i,"contentType").type=t}},this._setMessageDigestByEContent=function(e){var t=e.econtent,n=(e.econtent.type,t.content.hex);null==n&&"data"==t.type&&null!=t.content.str&&(n=De(t.content.str));for(var r=e.sinfos,i=0;i<r.length;i++){var a=r[i],s=a.hashalg,o=this._getAttrParamByName(a,"messageDigest"),u=he.crypto.Util.hashHex(n,s);o.hex=u}},this._getAttrParamByName=function(e,t){for(var n=e.sattrs.array,r=0;r<n.length;r++)if(n[r].attr==t)return n[r]},this._setSignerInfoVersion=function(e){for(var t=e.sinfos,n=0;n<t.length;n++){var r=t[n],i=1;"skid"==r.id.type&&(i=3),r.version=i}},this._setSignedDataVersion=function(e){var t=this._getSignedDataVersion(e);e.version=t},this._getSignedDataVersion=function(e){if(null!=e.revinfos)for(var t=e.revinfos,n=0;n<t.length;n++){if(null!=t[n].ocsp)return 5}var r=e.sinfos;for(n=0;n<r.length;n++){if(3==e.sinfos[n].version)return 3}return"data"!=e.econtent.type?3:1},this.getEncodedHex=function(){var e=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=e.fixed&&this.checkAndFixParam();var t=[];t.push(new n({int:e.version}));for(var a=[],u=0;u<e.hashalgs.length;u++){var f=e.hashalgs[u];a.push(new h({name:f}))}t.push(new r({array:a})),t.push(new s(e.econtent)),null!=e.certs&&t.push(new c(e.certs)),null!=e.revinfos&&t.push(new l(e.revinfos));var p=[];for(u=0;u<e.sinfos.length;u++){var d=e.sinfos[u];p.push(new o(d))}return t.push(new r({array:p})),new i({array:t}).getEncodedHex()},this.getContentInfo=function(){return new u({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignedData,he.asn1.ASN1Object),he.asn1.cms.CertificateSet=function(e){he.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.DERTaggedObject,i=n.DERSet,a=n.ASN1Object;this.params=null,this.getEncodedHex=function(){var e,n=this.params,s=[];if(n instanceof Array)e=n;else{if(null==n.array)throw new t("cert array not specified");e=n.array}for(var o=0;o<e.length;o++){var u=Te(e[o]),c=new a;c.hTLV=u,s.push(c)}var l={array:s};0==n.sortflag&&(l.sortflag=!1);var h=new i(l);return new r({tag:"a0",explicit:!1,obj:h}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.CertificateSet,he.asn1.ASN1Object),he.asn1.cms.RevocationInfoChoices=function(e){he.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(!e instanceof Array)throw new Error("params is not array");for(var t=[],n=0;n<e.length;n++)t.push(new he.asn1.cms.RevocationInfoChoice(e[n]));return he.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:t}}}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.RevocationInfoChoices,he.asn1.ASN1Object),he.asn1.cms.RevocationInfoChoice=function(e){he.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(null!=e.crl&&"string"==typeof e.crl){var t=e.crl;return-1!=e.crl.indexOf("-----BEGIN")&&(t=Te(e.crl)),t}if(null!=e.ocsp)return he.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new he.asn1.cms.OtherRevocationFormat(e)}}).getEncodedHex();throw new Error("property crl or ocsp undefined")},null!=e&&this.setByParam(e)},We(he.asn1.cms.RevocationInfoChoice,he.asn1.ASN1Object),he.asn1.cms.OtherRevocationFormat=function(e){he.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,n=he,r=n.asn1.ASN1Util.newObject,i=n.lang.String.isHex;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.ocsp)throw new t("property ocsp not specified");if(!i(e.ocsp)||!de.isASN1HEX(e.ocsp))throw new t("ocsp value not ASN.1 hex string");return r({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:e.ocsp}}]}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.OtherRevocationFormat,he.asn1.ASN1Object),he.asn1.cms.CMSUtil=new function(){},he.asn1.cms.CMSUtil.newSignedData=function(e){return new he.asn1.cms.SignedData(e)},he.asn1.cms.CMSUtil.verifySignedData=function(e){var t=he,n=t.asn1,r=n.cms,i=(r.SignerInfo,r.SignedData,r.SigningTime,r.SigningCertificate,r.SigningCertificateV2,n.cades.SignaturePolicyIdentifier,t.lang.String.isHex),a=de,s=a.getVbyList,o=a.getTLVbyList,u=a.getIdxbyList,c=a.getChildIdx,l=a.getTLV,h=a.oidname,f=t.crypto.Util.hashHex;void 0===e.cms&&i(e.cms);var p=e.cms,d=function(e,t){var n=t.idx;t.signerid_issuer1=o(e,n,[1,0],"30"),t.signerid_serial1=s(e,n,[1,1],"02"),t.hashalg=h(s(e,n,[2,0],"06"));var r=u(e,n,[3],"a0");t.idxSignedAttrs=r,g(e,t,r);var i=c(e,n).length;if(i<6)throw"malformed SignerInfo";t.sigalg=h(s(e,n,[i-2,0],"06")),t.sigval=s(e,n,[i-1],"04")},g=function(e,t,n){var r=c(e,n);t.signedAttrIdxList=r;for(var i=0;i<r.length;i++){var a,o=r[i],u=s(e,o,[0],"06");"2a864886f70d010905"===u?(a=Fe(s(e,o,[1,0])),t.saSigningTime=a):"2a864886f70d010904"===u&&(a=s(e,o,[1,0],"04"),t.saMessageDigest=a)}},m=function(e,t,n,r){n.verifyDetail={};var i=n.verifyDetail,a=t.parse.econtent,s=n.hashalg,o=n.saMessageDigest;i.validMessageDigest=!1,f(a,s)===o&&(i.validMessageDigest=!0),function(e,t,n,r){var i,a=t.parse.certsIdx;if(void 0===t.certs){i=[],t.certkeys=[];for(var s=c(e,a),o=0;o<s.length;o++){var u=l(e,s[o]),h=new Ze;h.readCertHex(u),i[o]=h,t.certkeys[o]=h.getPublicKey()}t.certs=i}else i=t.certs;t.cccc=i.length,t.cccci=s.length;for(o=0;o<i.length;o++){var f=h.getIssuerHex(),p=h.getSerialNumberHex();n.signerid_issuer1===f&&n.signerid_serial1===p&&(n.certkey_idx=o)}}(e,t,n),i.validSignatureValue=!1;var u=n.sigalg,h="31"+l(e,n.idxSignedAttrs).substr(2);n.signedattrshex=h;var p=t.certs[n.certkey_idx].getPublicKey(),d=new he.crypto.Signature({alg:u});d.init(p),d.updateHex(h);var g=d.verify(n.sigval);i.validSignatureValue_isValid=g,!0===g&&(i.validSignatureValue=!0),n.isValid=!1,i.validMessageDigest&&i.validSignatureValue&&(n.isValid=!0)},v={isValid:!1,parse:{}};return function(e,t){if("2a864886f70d010702"!==s(e,0,[0],"06"))return t;t.cmsType="signedData",t.econtent=s(e,0,[1,0,2,1,0]),function(e,t){for(var n,r=3;r<6;r++)if(void 0!==(n=u(e,0,[1,0,r]))){var i=e.substr(n,2);"a0"===i&&(t.certsIdx=n),"a1"===i&&(t.revinfosIdx=n),"31"===i&&(t.signerinfosIdx=n)}}(e,t),t.signerInfos=[],function(e,t){var n=t.signerinfosIdx;if(void 0!==n){var r=c(e,n);t.signerInfoIdxList=r;for(var i=0;i<r.length;i++){var a={idx:r[i]};d(e,a),t.signerInfos.push(a)}}}(e,t)}(p,v.parse),function(e,t){for(var n=t.parse.signerInfos,r=n.length,i=!0,a=0;a<r;a++){var s=n[a];m(e,t,s,a),s.isValid||(i=!1)}t.isValid=i}(p,v),v},he.asn1.cms.CMSParser=function(){var e=Error,t=Ze,n=new t,r=de,i=r.getV,a=r.getTLV,s=(r.getIdxbyList,r.getTLVbyList),o=r.getTLVbyListEx,u=r.getVbyList,c=r.getVbyListEx,l=r.getChildIdx;this.getCMSSignedData=function(e){var t=s(e,0,[1,0]);return this.getSignedData(t)},this.getSignedData=function(e){var t=l(e,0),n={},r=i(e,t[0]),s=parseInt(r,16);n.version=s;var u=a(e,t[1]);n.hashalgs=this.getHashAlgArray(u);var c=a(e,t[2]);n.econtent=this.getEContent(c);var h=o(e,0,["[0]"]);null!=h&&(n.certs=this.getCertificateSet(h));o(e,0,["[1]"]);var f=o(e,0,[3]);return n.sinfos=this.getSignerInfos(f),n},this.getHashAlgArray=function(e){for(var n=l(e,0),r=new t,i=[],s=0;s<n.length;s++){var o=a(e,n[s]),u=r.getAlgorithmIdentifierName(o);i.push(u)}return i},this.getEContent=function(e){var t={},n=u(e,0,[0]),r=u(e,0,[1,0]);return t.type=he.asn1.x509.OID.oid2name(de.hextooidstr(n)),t.content={hex:r},t},this.getSignerInfos=function(e){for(var t=[],n=l(e,0),r=0;r<n.length;r++){var i=a(e,n[r]),s=this.getSignerInfo(i);t.push(s)}return t},this.getSignerInfo=function(e){var t={},i=l(e,0),s=r.getInt(e,i[0],-1);-1!=s&&(t.version=s);var u=a(e,i[1]),h=this.getIssuerAndSerialNumber(u);t.id=h;var f=a(e,i[2]),p=n.getAlgorithmIdentifierName(f);t.hashalg=p;var d=o(e,0,["[0]"]);if(null!=d){var g=this.getAttributeList(d);t.sattrs=g}var m=o(e,0,[3]),v=n.getAlgorithmIdentifierName(m);t.sigalg=v;var y=c(e,0,[4]);t.sighex=y;var b=o(e,0,["[1]"]);if(null!=b){var w=this.getAttributeList(b);t.uattrs=w}return t},this.getSignerIdentifier=function(e){if("30"==e.substr(0,2))return this.getIssuerAndSerialNumber(e);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(e){var t={type:"isssn"},r=l(e,0),s=a(e,r[0]);t.issuer=n.getX500Name(s);var o=i(e,r[1]);return t.serial={hex:o},t},this.getAttributeList=function(e){for(var t=[],n=l(e,0),r=0;r<n.length;r++){var i=a(e,n[r]),s=this.getAttribute(i);t.push(s)}return{array:t}},this.getAttribute=function(e){var t={},n=l(e,0),i=r.getOID(e,n[0]),s=he.asn1.x509.OID.oid2name(i);t.attr=s;var o=a(e,n[1]),u=l(o,0);if(1==u.length)t.valhex=a(o,u[0]);else{for(var c=[],h=0;h<u.length;h++)c.push(a(o,u[h]));t.valhex=c}return"contentType"==s?this.setContentType(t):"messageDigest"==s?this.setMessageDigest(t):"signingTime"==s?this.setSigningTime(t):"signingCertificate"==s?this.setSigningCertificate(t):"signingCertificateV2"==s?this.setSigningCertificateV2(t):"signaturePolicyIdentifier"==s&&this.setSignaturePolicyIdentifier(t),t},this.setContentType=function(e){var t=r.getOIDName(e.valhex,0,null);null!=t&&(e.type=t,delete e.valhex)},this.setSigningTime=function(e){var t=Fe(i(e.valhex,0));e.str=t,delete e.valhex},this.setMessageDigest=function(e){var t=i(e.valhex,0);e.hex=t,delete e.valhex},this.setSigningCertificate=function(e){var t=l(e.valhex,0);if(t.length>0){for(var n=a(e.valhex,t[0]),r=l(n,0),i=[],s=0;s<r.length;s++){var o=a(n,r[s]),u=this.getESSCertID(o);i.push(u)}e.array=i}if(t.length>1){var c=a(e.valhex,t[1]);e.polhex=c}delete e.valhex},this.setSignaturePolicyIdentifier=function(e){var n=l(e.valhex,0);if(n.length>0){var s=r.getOID(e.valhex,n[0]);e.oid=s}if(n.length>1){var o=new t,u=l(e.valhex,n[1]),c=a(e.valhex,u[0]),h=o.getAlgorithmIdentifierName(c);e.alg=h;var f=i(e.valhex,u[1]);e.hash=f}delete e.valhex},this.setSigningCertificateV2=function(e){var t=l(e.valhex,0);if(t.length>0){for(var n=a(e.valhex,t[0]),r=l(n,0),i=[],s=0;s<r.length;s++){var o=a(n,r[s]),u=this.getESSCertIDv2(o);i.push(u)}e.array=i}if(t.length>1){var c=a(e.valhex,t[1]);e.polhex=c}delete e.valhex},this.getESSCertID=function(e){var t={},n=l(e,0);if(n.length>0){var r=i(e,n[0]);t.hash=r}if(n.length>1){var s=a(e,n[1]),o=this.getIssuerSerial(s);null!=o.serial&&(t.serial=o.serial),null!=o.issuer&&(t.issuer=o.issuer)}return t},this.getESSCertIDv2=function(t){var r={},s=l(t,0);if(s.length<1||3<s.length)throw new e("wrong number of elements");var o=0;if("30"==t.substr(s[0],2)){var u=a(t,s[0]);r.alg=n.getAlgorithmIdentifierName(u),o++}else r.alg="sha256";var c=i(t,s[o]);if(r.hash=c,s.length>o+1){var h=a(t,s[o+1]),f=this.getIssuerSerial(h);r.issuer=f.issuer,r.serial=f.serial}return r},this.getIssuerSerial=function(e){var t={},r=l(e,0),s=a(e,r[0]),o=n.getGeneralNames(s)[0].dn;t.issuer=o;var u=i(e,r[1]);return t.serial={hex:u},t},this.getCertificateSet=function(e){for(var t=l(e,0),n=[],r=0;r<t.length;r++){var i=a(e,t[r]);if("30"==i.substr(0,2)){var s=Ie(i,"CERTIFICATE");n.push(s)}}return{array:n,sortflag:!1}}},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.tsp&&he.asn1.tsp||(he.asn1.tsp={}),he.asn1.tsp.TimeStampToken=function(e){var t=he.asn1.tsp;t.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var e=new t.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=e.getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampToken,he.asn1.cms.SignedData),he.asn1.tsp.TSTInfo=function(e){Error;var t=he.asn1,n=t.DERSequence,r=t.DERInteger,i=t.DERBoolean,a=t.DERGeneralizedTime,s=t.DERObjectIdentifier,o=t.DERTaggedObject,u=t.tsp,c=u.MessageImprint,l=u.Accuracy,h=(t.x509.X500Name,t.x509.GeneralName);if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new r({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.getEncodedHex=function(){var e=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(e.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(e.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(e.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");e.push(this.dGenTime),null!=this.dAccuracy&&e.push(this.dAccuracy),null!=this.dOrdering&&e.push(this.dOrdering),null!=this.dNonce&&e.push(this.dNonce),null!=this.dTsa&&e.push(this.dTsa);var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){if("string"==typeof e.policy){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new s({oid:e.policy})}void 0!==e.messageImprint&&(this.dMessageImprint=new c(e.messageImprint)),void 0!==e.serial&&(this.dSerial=new r(e.serial)),void 0!==e.genTime&&(this.dGenTime=new a(e.genTime)),void 0!==e.accuracy&&(this.dAccuracy=new l(e.accuracy)),void 0!==e.ordering&&1==e.ordering&&(this.dOrdering=new i),void 0!==e.nonce&&(this.dNonce=new r(e.nonce)),void 0!==e.tsa&&(this.dTsa=new o({tag:"a0",explicit:!0,obj:new h({dn:e.tsa})}))}},We(he.asn1.tsp.TSTInfo,he.asn1.ASN1Object),he.asn1.tsp.Accuracy=function(e){var t=he.asn1,n=t.ASN1Util.newObject;t.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return null!=e.seconds&&"number"==typeof e.seconds&&t.push({int:e.seconds}),null!=e.millis&&"number"==typeof e.millis&&t.push({tag:{tagi:"80",obj:{int:e.millis}}}),null!=e.micros&&"number"==typeof e.micros&&t.push({tag:{tagi:"81",obj:{int:e.micros}}}),n({seq:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.Accuracy,he.asn1.ASN1Object),he.asn1.tsp.MessageImprint=function(e){var t=he.asn1,n=t.DERSequence,r=t.DEROctetString,i=t.x509.AlgorithmIdentifier;t.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=new i({name:e.alg}),a=new r({hex:e.hash});return new n({array:[t,a]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.tsp.MessageImprint,he.asn1.ASN1Object),he.asn1.tsp.TimeStampReq=function(e){var t=he.asn1,n=t.DERSequence,r=t.DERInteger,i=t.DERBoolean,a=(t.ASN1Object,t.DERObjectIdentifier),s=t.tsp,o=s.MessageImprint;s.TimeStampReq.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return t.push(new r({int:1})),e.messageImprint instanceof he.asn1.ASN1Object?t.push(e.messageImprint):t.push(new o(e.messageImprint)),null!=e.policy&&t.push(new a(e.policy)),null!=e.nonce&&t.push(new r(e.nonce)),1==e.certreq&&t.push(new i),new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampReq,he.asn1.ASN1Object),he.asn1.tsp.TimeStampResp=function(e){var t=he.asn1,n=t.DERSequence,r=(t.ASN1Object,t.tsp),i=r.PKIStatusInfo;r.TimeStampResp.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,a=[new i(e.statusinfo)];return null!=e.econtent&&a.push(new r.TimeStampToken(e).getContentInfo()),null!=e.tst&&e.tst instanceof t.ASN1Object&&a.push(e.tst),new n({array:a}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampResp,he.asn1.ASN1Object),he.asn1.tsp.PKIStatusInfo=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.tsp,a=i.PKIStatus,s=i.PKIFreeText,o=i.PKIFailureInfo;i.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,n=[];if("string"==typeof e)n.push(new a(e));else{if(null==e.status)throw new t("property 'status' unspecified");n.push(new a(e.status)),null!=e.statusstr&&n.push(new s(e.statusstr)),null!=e.failinfo&&n.push(new o(e.failinfo))}return new r({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIStatusInfo,he.asn1.ASN1Object),he.asn1.tsp.PKIStatus=function(e){var t=Error,n=he.asn1,r=n.DERInteger;n.tsp.PKIStatus.superclass.constructor.call(this);var i={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.getEncodedHex=function(){var e,n=this.params;if("string"==typeof n)try{e=i[n]}catch(e){throw new t("undefined name: "+n)}else{if("number"!=typeof n)throw new t("unsupported params");e=n}return new r({int:e}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIStatus,he.asn1.ASN1Object),he.asn1.tsp.PKIFreeText=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERUTF8String;n.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(!e instanceof Array)throw new t("wrong params: not array");for(var n=[],a=0;a<e.length;a++)n.push(new i({str:e[a]}));return new r({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIFreeText,he.asn1.ASN1Object),he.asn1.tsp.PKIFailureInfo=function(e){var t=Error,n=he.asn1,r=n.DERBitString,i=n.tsp.PKIFailureInfo,a={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};i.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e,n=this.params;if("string"==typeof n)try{e=a[n]}catch(e){throw new t("undefined name: "+n)}else{if("number"!=typeof n)throw new t("wrong params");e=n}return new r({bin:e.toString(2)}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIFailureInfo,he.asn1.ASN1Object),he.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(e,t){throw"not implemented yet"}},he.asn1.tsp.SimpleTSAAdapter=function(e){var t=he,n=t.asn1.tsp,r=t.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(e,t){var i=r(e,t);this.params.econtent.content.messageImprint={alg:t,hash:i},this.params.econtent.content.serial={int:this.serial++};var a=Math.floor(1e9*Math.random());return this.params.econtent.content.nonce={int:a},new n.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.tsp.SimpleTSAAdapter,he.asn1.tsp.AbstractTSAAdapter),he.asn1.tsp.FixedTSAAdapter=function(e){var t=he,n=t.asn1.tsp,r=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(e,t){var i=r(e,t);return this.params.econtent.content.messageImprint={alg:t,hash:i},new n.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.tsp.FixedTSAAdapter,he.asn1.tsp.AbstractTSAAdapter),he.asn1.tsp.TSPUtil=new function(){},he.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new he.asn1.tsp.TimeStampToken(e)},he.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=de,n=t.getChildIdx,r=t.getV,i=t.getTLV,a={certreq:!1},s=n(e,0);if(s.length<2)throw"TimeStampReq must have at least 2 items";var o=i(e,s[1]);a.messageImprint=he.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var u=2;u<s.length;u++){var c=s[u],l=e.substr(c,2);if("06"==l){var h=r(e,c);a.policy=t.hextooidstr(h)}"02"==l&&(a.nonce=r(e,c)),"01"==l&&(a.certreq=!0)}return a},he.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=de,n=t.getChildIdx,r=t.getV,i=t.getIdxbyList,a={};if("30"!=e.substr(0,2))throw"head of messageImprint hex shall be '30'";n(e,0);var s=r(e,i(e,0,[0,0])),o=t.hextooidstr(s),u=he.asn1.x509.OID.oid2name(o);if(""==u)throw"hashAlg name undefined: "+o;var c=u,l=i(e,0,[1]);return a.alg=c,a.hash=r(e,l),a},he.asn1.tsp.TSPParser=function(){Error;var e=new Ze,t=de,n=t.getV,r=t.getTLV,i=t.getIdxbyList,a=(t.getTLVbyListEx,t.getChildIdx),s=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],o={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(e){var t=a(e,0);if(1==t.length)return this.getPKIStatusInfo(r(e,t[0]));if(t.length>1){var n=this.getPKIStatusInfo(r(e,t[0])),i=r(e,t[1]),s=this.getToken(i);return s.statusinfo=n,s}},this.getToken=function(e){var t=(new he.asn1.cms.CMSParser).getCMSSignedData(e);return this.setTSTInfo(t),t},this.setTSTInfo=function(e){var t=e.econtent;if("tstinfo"==t.type){var n=t.content.hex,r=this.getTSTInfo(n);t.content=r}},this.getTSTInfo=function(t){var i={},s=a(t,0),o=n(t,s[1]);i.policy=Ke(o);var u=r(t,s[2]);i.messageImprint=this.getMessageImprint(u);var c=n(t,s[3]);i.serial={hex:c};var l=n(t,s[4]);i.genTime={str:Fe(l)};var h=0;if(s.length>5&&"30"==t.substr(s[5],2)){var f=r(t,s[5]);i.accuracy=this.getAccuracy(f),h++}s.length>5+h&&"01"==t.substr(s[5+h],2)&&("ff"==n(t,s[5+h])&&(i.ordering=!0),h++);if(s.length>5+h&&"02"==t.substr(s[5+h],2)){var p=n(t,s[5+h]);i.nonce={hex:p},h++}if(s.length>5+h&&"a0"==t.substr(s[5+h],2)){var d=r(t,s[5+h]);d="30"+d.substr(2),pGeneralNames=e.getGeneralNames(d);var g=pGeneralNames[0].dn;i.tsa=g,h++}if(s.length>5+h&&"a1"==t.substr(s[5+h],2)){var m=r(t,s[5+h]);m="30"+m.substr(2);var v=e.getExtParamArray(m);i.ext=v,h++}return i},this.getAccuracy=function(e){for(var t={},r=a(e,0),i=0;i<r.length;i++){var s=e.substr(r[i],2),o=n(e,r[i]),u=parseInt(o,16);"02"==s?t.seconds=u:"80"==s?t.millis=u:"81"==s&&(t.micros=u)}return t},this.getMessageImprint=function(e){if("30"!=e.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var r={},s=(a(e,0),i(e,0,[0,0])),o=n(e,s),u=t.hextooidstr(o),c=he.asn1.x509.OID.oid2name(u);if(""==c)throw new Error("hashAlg name undefined: "+u);var l=c,h=i(e,0,[1]);return r.alg=l,r.hash=n(e,h),r},this.getPKIStatusInfo=function(e){var t={},i=a(e,0),o=0;try{var u=n(e,i[0]),c=parseInt(u,16);t.status=s[c]}catch(e){}if(i.length>1&&"30"==e.substr(i[1],2)){var l=r(e,i[1]);t.statusstr=this.getPKIFreeText(l),o++}if(i.length>o&&"03"==e.substr(i[1+o],2)){var h=r(e,i[1+o]);t.failinfo=this.getPKIFailureInfo(h)}return t},this.getPKIFreeText=function(e){for(var n=[],r=a(e,0),i=0;i<r.length;i++)n.push(t.getString(e,r[i]));return n},this.getPKIFailureInfo=function(e){var n=t.getInt(e,0);return null!=o[n]?o[n]:n}},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.cades&&he.asn1.cades||(he.asn1.cades={}),he.asn1.cades.SignaturePolicyIdentifier=function(e){var t=he.asn1.cades,n=t.SignaturePolicyId;t.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new n(this.params)]},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignaturePolicyIdentifier,he.asn1.cms.Attribute),he.asn1.cades.SignaturePolicyId=function(e){var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=(t.x509.AlgorithmIdentifier,t.cades),a=i.SignaturePolicyId,s=i.OtherHashAlgAndValue;a.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return t.push(new r(e.oid)),t.push(new s(e)),new n({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignaturePolicyId,he.asn1.ASN1Object),he.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DEROctetString,a=n.x509.AlgorithmIdentifier;n.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.alg)throw new t("property 'alg' not specified");if(null==e.hash&&null==e.cert)throw new t("property 'hash' nor 'cert' not specified");var n=null;if(null!=e.hash)n=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var s=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(s=Te(e.cert)),n=he.crypto.Util.hashHex(s,e.alg)}var o=[];return o.push(new a({name:e.alg})),o.push(new i({hex:n})),new r({array:o}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHashAlgAndValue,he.asn1.ASN1Object),he.asn1.cades.OtherHashValue=function(e){he.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,n=he,r=(n.lang.String.isHex,n.asn1.DEROctetString);n.crypto.Util.hashHex;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.hash&&null==e.cert)throw new t("hash or cert not specified");var n=null;if(null!=e.hash)n=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var i=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(i=Te(e.cert)),n=he.crypto.Util.hashHex(i,"sha1")}return new r({hex:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHashValue,he.asn1.ASN1Object),he.asn1.cades.SignatureTimeStamp=function(e){var t=Error,n=he,r=n.lang.String.isHex,i=n.asn1,a=i.ASN1Object;i.x509;i.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var e=this.params;if(null!=e.tst){if(r(e.tst))return(i=new a).hTLV=e.tst,[i];if(e.tst instanceof a)return[e.tst];throw new t("params.tst has wrong value")}if(null!=e.res){var n=e.res;if(n instanceof a&&(n=n.getEncodedHex()),"string"!=typeof n||!r(n))throw new t("params.res has wrong value");var i;de.getTLVbyList(n,0,[1]);return(i=new a).hTLV=e.tst,[i]}},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignatureTimeStamp,he.asn1.cms.Attribute),he.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=r.cades,s=a.OtherCertID,o=n.lang.String.isHex;a.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var e=this.params,n=[],r=0;r<e.array.length;r++){var a=e.array[r];if("string"==typeof a)if(-1!=a.indexOf("-----BEGIN"))a={cert:a};else{if(!o(a))throw new t("unsupported value: "+a);a={hash:a}}null!=e.alg&&null==a.alg&&(a.alg=e.alg),null!=e.hasis&&null==a.hasis&&(a.hasis=e.hasis);var u=new s(a);n.push(u)}return[new i({array:n})]},null!=e&&this.setByParam(e)},We(he.asn1.cades.CompleteCertificateRefs,he.asn1.cms.Attribute),he.asn1.cades.OtherCertID=function(e){var t=he.asn1,n=t.DERSequence,r=t.cms.IssuerSerial,i=t.cades,a=i.OtherHashValue,s=i.OtherHashAlgAndValue;i.OtherCertID.superclass.constructor.call(this),this.params=e,this.getEncodedHex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:_isHex(e)&&(e={hash:e}));var t=[],i=null;if(i=null!=e.alg?new s(e):new a(e),t.push(i),null!=e.cert&&1==e.hasis||null!=e.issuer&&null!=e.serial){var o=new r(e);t.push(o)}return new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherCertID,he.asn1.ASN1Object),he.asn1.cades.OtherHash=function(e){Error;var t=he,n=t.asn1,r=(n.cms,n.cades),i=r.OtherHashAlgAndValue,a=r.OtherHashValue,s=(t.crypto.Util.hashHex,t.lang.String.isHex);r.OtherHash.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:s(e)&&(e={hash:e}));return(null!=e.alg?new i(e):new a(e)).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHash,he.asn1.ASN1Object),he.asn1.cades.CAdESUtil=new function(){},he.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){return(new he.asn1.cms.CMSParser).getCMSSignedData(e)},he.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,n){var r=de,i=r.getChildIdx,a=r.getTLV,s=r.getV,o=he.asn1,u=o.ASN1Object,c=o.cms,l=c.AttributeList,h=c.SignerInfo,f={},p=i(e,t);if(6!=p.length)throw"not supported items for SignerInfo (!=6)";var d=p.shift();f.version=a(e,d);var g=p.shift();f.si=a(e,g);var m=p.shift();f.digalg=a(e,m);var v=p.shift();f.sattrs=a(e,v);var y=p.shift();f.sigalg=a(e,y);var b=p.shift();f.sig=a(e,b),f.sigval=s(e,b);var w=null;return f.obj=new h,(w=new u).hTLV=f.version,f.obj.dCMSVersion=w,(w=new u).hTLV=f.si,f.obj.dSignerIdentifier=w,(w=new u).hTLV=f.digalg,f.obj.dDigestAlgorithm=w,(w=new u).hTLV=f.sattrs,f.obj.dSignedAttrs=w,(w=new u).hTLV=f.sigalg,f.obj.dSigAlg=w,(w=new u).hTLV=f.sig,f.obj.dSig=w,f.obj.dUnsignedAttrs=new l,f},void 0!==he.asn1.csr&&he.asn1.csr||(he.asn1.csr={}),he.asn1.csr.CertificationRequest=function(e){var t=he.asn1,n=t.DERBitString,r=t.DERSequence,i=t.csr,a=(t.x509,i.CertificationRequestInfo);i.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.sign=function(){var e=new a(this.params).getEncodedHex(),t=new he.crypto.Signature({alg:this.params.sigalg});t.init(this.params.sbjprvkey),t.updateHex(e);var n=t.sign();this.params.sighex=n},this.getPEM=function(){return Ie(this.getEncodedHex(),"CERTIFICATE REQUEST")},this.getEncodedHex=function(){var e=this.params,t=new he.asn1.csr.CertificationRequestInfo(this.params),i=new he.asn1.x509.AlgorithmIdentifier({name:e.sigalg});if(null==e.sighex&&null!=e.sbjprvkey&&this.sign(),null==e.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var a=new n({hex:"00"+e.sighex});return new r({array:[t,i,a]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.csr.CertificationRequest,he.asn1.ASN1Object),he.asn1.csr.CertificationRequestInfo=function(e){var t=he.asn1,n=(t.DERBitString,t.DERSequence),r=t.DERInteger,i=t.DERUTF8String,a=t.DERTaggedObject,s=t.ASN1Util.newObject,o=t.csr,u=t.x509,c=u.X500Name,l=u.Extensions,h=u.SubjectPublicKeyInfo;o.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(e){null!=e&&(this.params=e)},this.getEncodedHex=function(){var e=this.params,t=[];if(t.push(new r({int:0})),t.push(new c(e.subject)),t.push(new h(Ye.getKey(e.sbjpubkey))),null!=e.extreq){var o=new l(e.extreq),u=s({tag:{tag:"a0",explict:!0,obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[o]}]}}});t.push(u)}else t.push(new a({tag:"a0",explicit:!1,obj:new i({str:""})}));return new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.csr.CertificationRequestInfo,he.asn1.ASN1Object),he.asn1.csr.CSRUtil=new function(){},he.asn1.csr.CSRUtil.newCSRPEM=function(e){return new he.asn1.csr.CertificationRequest(e).getPEM()},he.asn1.csr.CSRUtil.getParam=function(e){var t=de,n=t.getV;_getIdxbyList=t.getIdxbyList,_getTLVbyList=t.getTLVbyList,_getTLVbyListEx=t.getTLVbyListEx,_getVbyListEx=t.getVbyListEx;var r={};if(-1==e.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var i=Te(e,"CERTIFICATE REQUEST");try{var a=_getTLVbyListEx(i,0,[0,1]);if("3000"==a)r.subject={};else{var s=new Ze;r.subject=s.getX500Name(a)}}catch(e){}var o=_getTLVbyListEx(i,0,[0,2]),u=Ye.getKey(o,null,"pkcs8pub");r.sbjpubkey=Ye.getPEM(u,"PKCS8PUB");var c,l,h=(c=i,l=_getIdxbyList(c,0,[0,3,0,0],"06"),"2a864886f70d01090e"!=n(c,l)?null:_getTLVbyList(c,0,[0,3,0,1,0],"30"));s=new Ze;null!=h&&(r.extreq=s.getExtParamArray(h));try{var f=_getTLVbyListEx(i,0,[1],"30");s=new Ze;r.sigalg=s.getAlgorithmIdentifierName(f)}catch(e){}try{var p=_getVbyListEx(i,0,[2]);r.sighex=p}catch(e){}return r},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.ocsp&&he.asn1.ocsp||(he.asn1.ocsp={}),he.asn1.ocsp.DEFAULT_HASH="sha1",he.asn1.ocsp.OCSPResponse=function(e){he.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);he.asn1.DEREnumerated;var t=he.asn1.ASN1Util.newObject,n=he.asn1.ocsp.ResponseBytes,r=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var e=this.params.resstatus;return"number"==typeof e?e:"string"!=typeof e?-1:r.indexOf(e)},this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params,r=this._getStatusCode();if(-1==r)throw new Error("responseStatus not supported: "+e.resstatus);if(0!=r)return t({seq:[{enum:{int:r}}]}).getEncodedHex();var i=new n(e);return t({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:i}}]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.OCSPResponse,he.asn1.ASN1Object),he.asn1.ocsp.ResponseBytes=function(e){he.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=t.DEROctetString,a=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params;if("ocspBasic"!=e.restype)throw new Error("not supported responseType: "+e.restype);var t=new a(e),s=[];return s.push(new r({name:"ocspBasic"})),s.push(new i({hex:t.getEncodedHex()})),new n({array:s}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponseBytes,he.asn1.ASN1Object),he.asn1.ocsp.BasicOCSPResponse=function(e){he.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.ASN1Object,i=n.DERSequence,a=(n.DERGeneralizedTime,n.DERTaggedObject),s=n.DERBitString,o=(n.x509.Extensions,n.x509.AlgorithmIdentifier),u=n.ocsp;u.ResponderID;_SingleResponseList=u.SingleResponseList,_ResponseData=u.ResponseData,this.params=null,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.tbsresp.getEncodedHex(),n=new he.crypto.Signature({alg:e.sigalg});n.init(e.reskey),n.updateHex(t),e.sighex=n.sign()},this.getEncodedHex=function(){var e=this.params;null==e.tbsresp&&(e.tbsresp=new _ResponseData(e)),null==e.sighex&&null!=e.reskey&&this.sign();var n=[];if(n.push(e.tbsresp),n.push(new o({name:e.sigalg})),n.push(new s({hex:"00"+e.sighex})),null!=e.certs&&null!=e.certs.length){for(var u=[],c=0;c<e.certs.length;c++){var l=e.certs[c],h=null;if(de.isASN1HEX(l))h=l;else{if(!l.match(/-----BEGIN/))throw new t("certs["+c+"] not hex or PEM");h=Te(l)}u.push(new r({tlv:h}))}var f=new i({array:u});n.push(new a({tag:"a0",explicit:!0,obj:f}))}return new i({array:n}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.BasicOCSPResponse,he.asn1.ASN1Object),he.asn1.ocsp.ResponseData=function(e){he.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERGeneralizedTime,a=n.DERTaggedObject,s=n.x509.Extensions,o=n.ocsp,u=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.getEncodedHex=function(){var e=this.params;null!=e.respid&&new t("respid not specified"),null!=e.prodat&&new t("prodat not specified"),null!=e.array&&new t("array not specified");var n=[];if(n.push(new u(e.respid)),n.push(new i(e.prodat)),n.push(new _SingleResponseList(e.array)),null!=e.ext){var o=new s(e.ext);n.push(new a({tag:"a1",explicit:!0,obj:o}))}return new r({array:n}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponseData,he.asn1.ASN1Object),he.asn1.ocsp.ResponderID=function(e){he.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=he.asn1,n=t.ASN1Util.newObject,r=t.x509.X500Name;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null!=e.key)return n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:e.key}}}}).getEncodedHex();if(null!=e.name)return n({tag:{tag:"a1",explicit:!0,obj:new r(e.name)}}).getEncodedHex();throw new Error("key or name not specified")},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponderID,he.asn1.ASN1Object),he.asn1.ocsp.SingleResponseList=function(e){he.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.ocsp.SingleResponse;this.params=null,this.getEncodedHex=function(){var e=this.params;if("object"!=typeof e||null==e.length)throw new Error("params not specified properly");for(var t=[],i=0;i<e.length;i++)t.push(new r(e[i]));return new n({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.SingleResponseList,he.asn1.ASN1Object),he.asn1.ocsp.SingleResponse=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERGeneralizedTime,a=n.DERTaggedObject,s=n.ocsp,o=s.CertID,u=s.CertStatus,c=n.x509.Extensions;s.SingleResponse.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,n=[];if(null==e.certid)throw new t("certid unspecified");if(null==e.status)throw new t("status unspecified");if(null==e.thisupdate)throw new t("thisupdate unspecified");if(n.push(new o(e.certid)),n.push(new u(e.status)),n.push(new i(e.thisupdate)),null!=e.nextupdate){var s=new i(e.nextupdate);n.push(new a({tag:"a0",explicit:!0,obj:s}))}if(null!=e.ext){var l=new c(e.ext);n.push(new a({tag:"a1",explicit:!0,obj:l}))}return new r({array:n}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.SingleResponse,he.asn1.ASN1Object),he.asn1.ocsp.CertID=function(e){var t=he,n=t.asn1,r=n.DEROctetString,i=n.DERInteger,a=n.DERSequence,s=n.x509.AlgorithmIdentifier,o=n.ocsp,u=o.DEFAULT_HASH,c=t.crypto.Util.hashHex,l=Ze,h=de;if(o.CertID.superclass.constructor.call(this),this.dHashAlg=null,this.dIssuerNameHash=null,this.dIssuerKeyHash=null,this.dSerialNumber=null,this.setByValue=function(e,t,n,a){void 0===a&&(a=u),this.dHashAlg=new s({name:a}),this.dIssuerNameHash=new r({hex:e}),this.dIssuerKeyHash=new r({hex:t}),this.dSerialNumber=new i({hex:n})},this.setByCert=function(e,t,n){void 0===n&&(n=u);var r=new l;r.readCertPEM(t);var i=new l;i.readCertPEM(e);var a=i.getPublicKeyHex(),s=h.getTLVbyList(a,0,[1,0],"30"),o=r.getSerialNumberHex(),f=c(i.getSubjectHex(),n),p=c(s,n);this.setByValue(f,p,o,n),this.hoge=r.getSerialNumberHex()},this.getEncodedHex=function(){if(null===this.dHashAlg&&null===this.dIssuerNameHash&&null===this.dIssuerKeyHash&&null===this.dSerialNumber)throw"not yet set values";var e=[this.dHashAlg,this.dIssuerNameHash,this.dIssuerKeyHash,this.dSerialNumber],t=new a({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){var f=e;if(void 0!==f.issuerCert&&void 0!==f.subjectCert){var p=u;void 0===f.alg&&(p=void 0),this.setByCert(f.issuerCert,f.subjectCert,p)}else{if(void 0===f.issname||void 0===f.isskey||void 0===f.sbjsn)throw new Error("invalid constructor arguments");p=u;void 0===f.alg&&(p=void 0),this.setByValue(f.issname,f.isskey,f.sbjsn,p)}}},We(he.asn1.ocsp.CertID,he.asn1.ASN1Object),he.asn1.ocsp.CertStatus=function(e){he.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if("good"==e.status)return"8000";if("unknown"==e.status)return"8200";if("revoked"==e.status){var t=[{gentime:{str:e.time}}];null!=e.reason&&t.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:e.reason}}}});var n={tag:"a1",explicit:!1,obj:{seq:t}};return he.asn1.ASN1Util.newObject({tag:n}).getEncodedHex()}throw new Error("bad status")},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.CertStatus,he.asn1.ASN1Object),he.asn1.ocsp.Request=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;if(r.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.getEncodedHex=function(){var e=[];if(null===this.dReqCert)throw"reqCert not set";e.push(this.dReqCert);var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){var i=new r.CertID(e);this.dReqCert=i}},We(he.asn1.ocsp.Request,he.asn1.ASN1Object),he.asn1.ocsp.TBSRequest=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;r.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(e){for(var t=[],n=0;n<e.length;n++){var i=new r.Request(e[0]);t.push(i)}this.dRequestList=t},this.getEncodedHex=function(){var e=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var t=new n({array:this.dRequestList});if(e.push(t),null!==this.dRequestExt)throw"requestExtensions not supported";var r=new n({array:e});return this.hTLV=r.getEncodedHex(),this.hTLV},void 0!==e&&void 0!==e.reqList&&this.setRequestListByParam(e.reqList)},We(he.asn1.ocsp.TBSRequest,he.asn1.ASN1Object),he.asn1.ocsp.OCSPRequest=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;if(r.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.getEncodedHex=function(){var e=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(e.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e&&void 0!==e.reqList){var i=new r.TBSRequest(e);this.dTbsRequest=i}},We(he.asn1.ocsp.OCSPRequest,he.asn1.ASN1Object),he.asn1.ocsp.OCSPUtil={},he.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,n){var r=he.asn1.ocsp;void 0===n&&(n=r.DEFAULT_HASH);var i={alg:n,issuerCert:e,subjectCert:t};return new r.OCSPRequest({reqList:[i]}).getEncodedHex()},he.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=de,n=t.getVbyList,r=t.getVbyListEx,i=t.getIdxbyList,a=(t.getIdxbyListEx,t.getV),s={};try{var o=r(e,0,[0],"0a");s.responseStatus=parseInt(o,16)}catch(e){}if(0!==s.responseStatus)return s;try{var u=i(e,0,[1,0,1,0,0,2,0,1]);"80"===e.substr(u,2)?s.certStatus="good":"a1"===e.substr(u,2)?(s.certStatus="revoked",s.revocationTime=Fe(n(e,u,[0]))):"82"===e.substr(u,2)&&(s.certStatus="unknown")}catch(e){}try{var c=i(e,0,[1,0,1,0,0,2,0,2]);s.thisUpdate=Fe(a(e,c))}catch(e){}try{var l=i(e,0,[1,0,1,0,0,2,0,3]);"a0"===e.substr(l,2)&&(s.nextUpdate=Fe(n(e,l,[0])))}catch(e){}return s},he.asn1.ocsp.OCSPParser=function(){var e=Error,t=Ze,n=new t,r=de,i=r.getV,a=r.getTLV,s=r.getIdxbyList,o=r.getTLVbyListEx,u=r.getChildIdx;this.getOCSPRequest=function(t){var n=u(t,0);if(1!=n.length&&2!=n.length)throw new e("wrong number elements: "+n.length);return this.getTBSRequest(a(t,n[0]))},this.getTBSRequest=function(e){var t={},r=o(e,0,[0],"30");t.array=this.getRequestList(r);var i=o(e,0,["[2]",0],"30");return null!=i&&(t.ext=n.getExtParamArray(i)),t},this.getRequestList=function(e){for(var t=[],n=u(e,0),r=0;r<n.length;r++){e=a(e,n[r]);t.push(this.getRequest(e))}return t},this.getRequest=function(t){var r=u(t,0);if(1!=r.length&&2!=r.length)throw new e("wrong number elements: "+r.length);var i=this.getCertID(a(t,r[0]));if(2==r.length){var o=s(t,0,[1,0]);i.ext=n.getExtParamArray(a(t,o))}return i},this.getCertID=function(n){var r=u(n,0);if(4!=r.length)throw new e("wrong number elements: "+r.length);var s=new t,o={};return o.alg=s.getAlgorithmIdentifierName(a(n,r[0])),o.issname=i(n,r[1]),o.isskey=i(n,r[2]),o.sbjsn=i(n,r[3]),o}},void 0!==he&&he||(he={}),void 0!==he.lang&&he.lang||(he.lang={}),he.lang.String=function(){},"function"==typeof e?(fe=function(t){return be(e.from(t,"utf8").toString("base64"))},pe=function(t){return e.from(we(t),"base64").toString("utf8")}):(fe=function(e){return xe(ke(Le(e)))},pe=function(e){return decodeURIComponent(Oe(Se(e)))}),he.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},he.lang.String.isHex=function(e){return Me(e)},he.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},he.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=we(e),he.lang.String.isBase64(e))},he.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},he.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},he.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},he.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};function qe(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=parseInt(e,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var a="",s=0;s<i;s++)a+="0";r=a+r;for(s=0;s<r.length-1;s+=7){var o=r.substr(s,7);s!=r.length-7&&(o="1"+o),n+=t(parseInt(o,2))}return n};try{if(!e.match(/^[0-9.]+$/))return null;var r="",i=e.split("."),a=40*parseInt(i[0],10)+parseInt(i[1],10);r+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r}catch(e){return null}}function Ke(e){if(!Me(e))return null;try{var t=[],n=e.substr(0,2),r=parseInt(n,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var i=e.substr(2),a=[],s=0;s<i.length/2;s++)a.push(parseInt(i.substr(2*s,2),16));var o=[],u="";for(s=0;s<a.length;s++)128&a[s]?u+=ze((127&a[s]).toString(2),7):(u+=ze((127&a[s]).toString(2),7),o.push(new String(parseInt(u,2))),u="");var c=t.join(".");return o.length>0&&(c=c+"."+o.join(".")),c}catch(e){return null}}var ze=function(e,t,n){return null==n&&(n="0"),e.length>=t?e:new Array(t-e.length+1).join(n)+e};function Ge(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var n=parseInt(t,16),r=e.substr(2),i=parseInt(r,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-n),parseInt(i,2)}catch(e){return-1}}function We(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:g.algo.MD5,sha1:g.algo.SHA1,sha224:g.algo.SHA224,sha256:g.algo.SHA256,sha384:g.algo.SHA384,sha512:g.algo.SHA512,ripemd160:g.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,n){var r=this.getDigestInfoHex(e,t),i=n/4;if(r.length+22>i)throw"key is too short for SigAlg: keylen="+n+","+t;for(var a="0001",s="00"+r,o="",u=i-a.length-s.length,c=0;c<u;c+=2)o+="ff";return a+o+s},this.hashString=function(e,t){return new he.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new he.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof ae||e instanceof he.crypto.DSA||e instanceof he.crypto.ECDSA}},he.crypto.Util.md5=function(e){return new he.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},he.crypto.Util.ripemd160=function(e){return new he.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},he.crypto.Util.SECURERANDOMGEN=new ne,he.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return he.crypto.Util.SECURERANDOMGEN.nextBytes(t),ve(t)},he.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new S(he.crypto.Util.getRandomHexOfNbytes(e),16)},he.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,n=new Array((e-t)/8+1);return he.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<t&255^255)&n[0],ve(n)},he.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new S(he.crypto.Util.getRandomHexOfNbits(e),16)},he.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var n=he.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(n))return n}},he.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var n=e.compareTo(t);if(1==n)throw"biMin is greater than biMax";if(0==n)return e;var r=t.subtract(e);return he.crypto.Util.getRandomBigIntegerZeroToMax(r).add(e)},he.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=he.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=he.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=he.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=g.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(g.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){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(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},he.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},he.crypto.MessageDigest.getHashLength=function(e){var t=he.crypto.MessageDigest,n=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[n])throw"not supported algorithm: "+e;return t.HASHLENGTH[n]},he.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},he.crypto.Mac=function(e){this.setAlgAndProvider=function(e,t){if(null==(e=e.toLowerCase())&&(e="hmacsha1"),"hmac"!=(e=e.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===t&&(t=he.crypto.Util.DEFAULTPROVIDER[e]),this.algProv=e+"/"+t;var n=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(n)&&"cryptojs"==t){try{var r=he.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[n];this.mac=g.algo.HMAC.create(r,this.pass)}catch(e){throw"setAlgAndProvider hash alg set fail hashAlg="+n+"/"+e}this.updateString=function(e){this.mac.update(e)},this.updateHex=function(e){var t=g.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(g.enc.Hex)},this.doFinalString=function(e){return this.updateString(e),this.doFinal()},this.doFinalHex=function(e){return this.updateHex(e),this.doFinal()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(e){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(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(e){if("string"==typeof e){var t=e;return e.length%2!=1&&e.match(/^[0-9A-Fa-f]+$/)||(t=De(e)),void(this.pass=g.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;t=null;if(void 0!==e.hex){if(e.hex.length%2!=0||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;t=e.hex}if(void 0!==e.utf8&&(t=Ee(e.utf8)),void 0!==e.rstr&&(t=De(e.rstr)),void 0!==e.b64&&(t=w(e.b64)),void 0!==e.b64u&&(t=Se(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=g.enc.Hex.parse(t)},void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass),void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},he.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n+="0";return n+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new he.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var n=null;try{n=void 0===t?Ye.getKey(e):Ye.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===n.isPrivate)this.prvKey=n,this.state="SIGN";else{if(!0!==n.isPublic)throw"init failed.:"+n;this.pubKey=n,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==he.crypto.ECDSA&&(this.prvKey=new he.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof ae&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ae&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof he.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof he.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(e){return this.updateString(e),this.sign()},this.signHex=function(e){return this.updateHex(e),this.sign()},this.verify=function(e){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==he.crypto.ECDSA&&(this.pubKey=new he.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof ae&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ae&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==he.crypto.ECDSA&&this.pubKey instanceof he.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==he.crypto.DSA&&this.pubKey instanceof he.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){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(e){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(e){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=Ye.getKey(e.prvkeypem);this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},he.crypto.Cipher=function(e){},he.crypto.Cipher.encrypt=function(e,t,n){if(t instanceof ae&&t.isPublic){var r=he.crypto.Cipher.getAlgByKeyAndName(t,n);if("RSA"===r)return t.encrypt(e);if("RSAOAEP"===r)return t.encryptOAEP(e,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return t.encryptOAEP(e,"sha"+i[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.encrypt: unsupported key or algorithm"},he.crypto.Cipher.decrypt=function(e,t,n){if(t instanceof ae&&t.isPrivate){var r=he.crypto.Cipher.getAlgByKeyAndName(t,n);if("RSA"===r)return t.decrypt(e);if("RSAOAEP"===r)return t.decryptOAEP(e,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return t.decryptOAEP(e,"sha"+i[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.decrypt: unsupported key or algorithm"},he.crypto.Cipher.getAlgByKeyAndName=function(e,t){if(e instanceof ae){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(t))return t;if(null==t)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+t}throw"getAlgByKeyAndName: not supported algorithm name: "+t},he.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"}},void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.ECDSA=function(e){var t=Error,n=S,r=ue,i=he.crypto.ECDSA,a=he.crypto.ECParameterDB,s=i.getName,o=de,u=o.getVbyListEx,c=o.isASN1HEX,l=new ne;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(e){return new n(e.bitLength(),l).mod(e.subtract(n.ONE)).add(n.ONE)},this.setNamedCurve=function(e){this.ecparams=a.getByName(e),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=e},this.setPrivateKeyHex=function(e){this.isPrivate=!0,this.prvKeyHex=e},this.setPublicKeyHex=function(e){this.isPublic=!0,this.pubKeyHex=e},this.getPublicKeyXYHex=function(){var e=this.pubKeyHex;if("04"!==e.substr(0,2))throw"this method supports uncompressed format(04) only";var t=this.ecparams.keylen/4;if(e.length!==2+2*t)throw"malformed public key hex length";var n={};return n.x=e.substr(2,t),n.y=e.substr(2+t),n},this.getShortNISTPCurveName=function(){var e=this.curveName;return"secp256r1"===e||"NIST P-256"===e||"P-256"===e||"prime256v1"===e?"P-256":"secp384r1"===e||"NIST P-384"===e||"P-384"===e?"P-384":null},this.generateKeyPairHex=function(){var e=this.ecparams.n,t=this.getBigRandom(e),n=this.ecparams.G.multiply(t),r=n.getX().toBigInteger(),i=n.getY().toBigInteger(),a=this.ecparams.keylen/4,s=("0000000000"+t.toString(16)).slice(-a),o="04"+("0000000000"+r.toString(16)).slice(-a)+("0000000000"+i.toString(16)).slice(-a);return this.setPrivateKeyHex(s),this.setPublicKeyHex(o),{ecprvhex:s,ecpubhex:o}},this.signWithMessageHash=function(e){return this.signHex(e,this.prvKeyHex)},this.signHex=function(e,t){var r=new n(t,16),a=this.ecparams.n,s=new n(e.substring(0,this.ecparams.keylen/4),16);do{var o=this.getBigRandom(a),u=this.ecparams.G.multiply(o).getX().toBigInteger().mod(a)}while(u.compareTo(n.ZERO)<=0);var c=o.modInverse(a).multiply(s.add(r.multiply(u))).mod(a);return i.biRSSigToASN1Sig(u,c)},this.sign=function(e,t){var r=t,i=this.ecparams.n,a=n.fromByteArrayUnsigned(e);do{var s=this.getBigRandom(i),o=this.ecparams.G.multiply(s).getX().toBigInteger().mod(i)}while(o.compareTo(S.ZERO)<=0);var u=s.modInverse(i).multiply(a.add(r.multiply(o))).mod(i);return this.serializeSig(o,u)},this.verifyWithMessageHash=function(e,t){return this.verifyHex(e,t,this.pubKeyHex)},this.verifyHex=function(e,t,a){try{var s,o,u=i.parseSigHex(t);s=u.r,o=u.s;var c=r.decodeFromHex(this.ecparams.curve,a),l=new n(e.substring(0,this.ecparams.keylen/4),16);return this.verifyRaw(l,s,o,c)}catch(e){return!1}},this.verify=function(e,t,i){var a,s,o;if(Bitcoin.Util.isArray(t)){var u=this.parseSig(t);a=u.r,s=u.s}else{if("object"!=typeof t||!t.r||!t.s)throw"Invalid value for signature";a=t.r,s=t.s}if(i instanceof ue)o=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";o=r.decodeFrom(this.ecparams.curve,i)}var c=n.fromByteArrayUnsigned(e);return this.verifyRaw(c,a,s,o)},this.verifyRaw=function(e,t,r,i){var a=this.ecparams.n,s=this.ecparams.G;if(t.compareTo(n.ONE)<0||t.compareTo(a)>=0)return!1;if(r.compareTo(n.ONE)<0||r.compareTo(a)>=0)return!1;var o=r.modInverse(a),u=e.multiply(o).mod(a),c=t.multiply(o).mod(a);return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(a).equals(t)},this.serializeSig=function(e,t){var n=e.toByteArraySigned(),r=t.toByteArraySigned(),i=[];return i.push(2),i.push(n.length),(i=i.concat(n)).push(2),i.push(r.length),(i=i.concat(r)).unshift(i.length),i.unshift(48),i},this.parseSig=function(e){var t;if(48!=e[0])throw new Error("Signature not a valid DERSequence");if(2!=e[t=2])throw new Error("First element in signature must be a DERInteger");var r=e.slice(t+2,t+2+e[t+1]);if(2!=e[t+=2+e[t+1]])throw new Error("Second element in signature must be a DERInteger");var i=e.slice(t+2,t+2+e[t+1]);return t+=2+e[t+1],{r:n.fromByteArrayUnsigned(r),s:n.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(e){if(65!==e.length)throw"Signature has the wrong length";var t=e[0]-27;if(t<0||t>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:n.fromByteArrayUnsigned(e.slice(1,33)).mod(r),s:n.fromByteArrayUnsigned(e.slice(33,65)).mod(r),i:t}},this.readPKCS5PrvKeyHex=function(e){if(!1===c(e))throw new Error("not ASN.1 hex string");var t,n,r;try{t=u(e,0,["[0]",0],"06"),n=u(e,0,[1],"04");try{r=u(e,0,["[1]",0],"03")}catch(e){}}catch(e){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=s(t),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(e){if(!1===c(e))throw new t("not ASN.1 hex string");var n,r,i;try{u(e,0,[1,0],"06"),n=u(e,0,[1,1],"06"),r=u(e,0,[2,0,1],"04");try{i=u(e,0,[2,0,"[1]",0],"03")}catch(e){}}catch(e){throw new t("malformed PKCS#8 plain ECC private key")}if(this.curveName=s(n),void 0===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PubKeyHex=function(e){if(!1===c(e))throw new t("not ASN.1 hex string");var n,r;try{u(e,0,[0,0],"06"),n=u(e,0,[0,1],"06"),r=u(e,0,[1],"03")}catch(e){throw new t("malformed PKCS#8 ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},this.readCertPubKeyHex=function(e,n){if(!1===c(e))throw new t("not ASN.1 hex string");var r,i;try{r=u(e,0,[0,5,0,1],"06"),i=u(e,0,[0,5,1],"03")}catch(e){throw new t("malformed X.509 certificate ECC public key")}if(this.curveName=s(r),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))},he.crypto.ECDSA.parseSigHex=function(e){var t=he.crypto.ECDSA.parseSigHexInHexRS(e);return{r:new S(t.r,16),s:new S(t.s,16)}},he.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=de,n=t.getChildIdx,r=t.getV;if(t.checkStrictDER(e,0),"30"!=e.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=n(e,0);if(2!=i.length)throw new Error("signature shall have two elements");var a=i[0],s=i[1];if("02"!=e.substr(a,2))throw new Error("1st item not ASN.1 integer");if("02"!=e.substr(s,2))throw new Error("2nd item not ASN.1 integer");return{r:r(e,a),s:r(e,s)}},he.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=he.crypto.ECDSA.parseSigHexInHexRS(e),n=t.r,r=t.s;if("00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),"00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),n.length%32==30&&(n="00"+n),r.length%32==30&&(r="00"+r),n.length%32!=0)throw"unknown ECDSA sig r length error";if(r.length%32!=0)throw"unknown ECDSA sig s length error";return n+r},he.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var t=e.substr(0,e.length/2),n=e.substr(e.length/2);return he.crypto.ECDSA.hexRSSigToASN1Sig(t,n)},he.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var n=new S(e,16),r=new S(t,16);return he.crypto.ECDSA.biRSSigToASN1Sig(n,r)},he.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var n=he.asn1,r=new n.DERInteger({bigint:e}),i=new n.DERInteger({bigint:t});return new n.DERSequence({array:[r,i]}).getEncodedHex()},he.crypto.ECDSA.getName=function(e){return"2b8104001f"===e?"secp192k1":"2a8648ce3d030107"===e?"secp256r1":"2b8104000a"===e?"secp256k1":"2b81040021"===e?"secp224r1":"2b81040022"===e?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)?"secp256r1":-1!=="|secp256k1|".indexOf(e)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(e)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(e)?"secp384r1":null},void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.ECParameterDB=new function(){var e={},t={};function n(e){return new S(e,16)}this.getByName=function(n){var r=n;if(void 0!==t[r]&&(r=t[n]),void 0!==e[r])return e[r];throw"unregistered EC curve name: "+r},this.regist=function(r,i,a,s,o,u,c,l,h,f,p,d){e[r]={};var g=n(a),m=n(s),v=n(o),y=n(u),b=n(c),w=new ce(g,m,v),x=w.decodePointHex("04"+l+h);e[r].name=r,e[r].keylen=i,e[r].curve=w,e[r].G=x,e[r].n=y,e[r].h=b,e[r].oid=p,e[r].info=d;for(var S=0;S<f.length;S++)t[f[S]]=r}},he.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),he.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),he.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),he.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),he.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),he.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),he.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),he.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),he.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),he.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.DSA=function(){var e=de,t=(e.getVbyList,e.getVbyListEx),n=e.isASN1HEX,r=S;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(e,t,n,r,i){this.isPrivate=!0,this.p=e,this.q=t,this.g=n,this.y=r,this.x=i},this.setPrivateHex=function(e,t,n,r,i){var a,s,o,u,c;a=new S(e,16),s=new S(t,16),o=new S(n,16),u="string"==typeof r&&r.length>1?new S(r,16):null,c=new S(i,16),this.setPrivate(a,s,o,u,c)},this.setPublic=function(e,t,n,r){this.isPublic=!0,this.p=e,this.q=t,this.g=n,this.y=r,this.x=null},this.setPublicHex=function(e,t,n,r){var i,a,s,o;i=new S(e,16),a=new S(t,16),s=new S(n,16),o=new S(r,16),this.setPublic(i,a,s,o)},this.signWithMessageHash=function(e){var t=this.p,n=this.q,r=this.g,i=(this.y,this.x),a=he.crypto.Util.getRandomBigIntegerMinToMax(S.ONE.add(S.ONE),n.subtract(S.ONE)),s=new S(e.substr(0,n.bitLength()/4),16),o=r.modPow(a,t).mod(n),u=a.modInverse(n).multiply(s.add(i.multiply(o))).mod(n);return he.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:o}},{int:{bigint:u}}]})},this.verifyWithMessageHash=function(e,t){var n=this.p,r=this.q,i=this.g,a=this.y,s=this.parseASN1Signature(t),o=s[0],u=s[1],c=new S(e.substr(0,r.bitLength()/4),16);if(S.ZERO.compareTo(o)>0||o.compareTo(r)>0)throw"invalid DSA signature";if(S.ZERO.compareTo(u)>=0||u.compareTo(r)>0)throw"invalid DSA signature";var l=u.modInverse(r),h=c.multiply(l).mod(r),f=o.multiply(l).mod(r);return 0==i.modPow(h,n).multiply(a.modPow(f,n)).mod(n).mod(r).compareTo(o)},this.parseASN1Signature=function(e){try{return[new r(t(e,0,[0],"02"),16),new r(t(e,0,[1],"02"),16)]}catch(e){throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(e){var r,i,a,s,o;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1],"02"),i=t(e,0,[2],"02"),a=t(e,0,[3],"02"),s=t(e,0,[4],"02"),o=t(e,0,[5],"02")}catch(e){throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(r,i,a,s,o)},this.readPKCS8PrvKeyHex=function(e){var r,i,a,s;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1,1,0],"02"),i=t(e,0,[1,1,1],"02"),a=t(e,0,[1,1,2],"02"),s=t(e,0,[2,0],"02")}catch(e){throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(r,i,a,null,s)},this.readPKCS8PubKeyHex=function(e){var r,i,a,s;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[0,1,0],"02"),i=t(e,0,[0,1,1],"02"),a=t(e,0,[0,1,2],"02"),s=t(e,0,[1,0],"02")}catch(e){throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(r,i,a,s)},this.readCertPubKeyHex=function(e,r){var i,a,s,o;if(!1===n(e))throw new Error("not ASN.1 hex string");try{i=t(e,0,[0,5,0,1,0],"02"),a=t(e,0,[0,5,0,1,1],"02"),s=t(e,0,[0,5,0,1,2],"02"),o=t(e,0,[0,5,1,0],"02")}catch(e){throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(i,a,s,o)}};var Ye=function(){var e=function(e,n,r){return t(g.AES,e,n,r)},t=function(e,t,n,r){var i=g.enc.Hex.parse(t),a=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),o={};o.key=a,o.iv=s,o.ciphertext=i;var u=e.decrypt(o,a,{iv:s});return g.enc.Hex.stringify(u)},n=function(e,t,n){return r(g.AES,e,t,n)},r=function(e,t,n,r){var i=g.enc.Hex.parse(t),a=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),o=e.encrypt(i,a,{iv:s}),u=g.enc.Hex.parse(o.toString());return g.enc.Base64.stringify(u)},i={"AES-256-CBC":{proc:e,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,n,r){return t(g.TripleDES,e,n,r)},eproc:function(e,t,n){return r(g.TripleDES,e,t,n)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,n,r){return t(g.DES,e,n,r)},eproc:function(e,t,n){return r(g.DES,e,t,n)},keylen:8,ivlen:8}},a=function(e){var t={},n=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));n&&(t.cipher=n[1],t.ivsalt=n[2]);var r=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(t.type=r[1]);var i=-1,a=0;-1!=e.indexOf("\r\n\r\n")&&(i=e.indexOf("\r\n\r\n"),a=2),-1!=e.indexOf("\n\n")&&(i=e.indexOf("\n\n"),a=1);var s=e.indexOf("-----END");if(-1!=i&&-1!=s){var o=e.substring(i+2*a,s-a);o=o.replace(/\s+/g,""),t.data=o}return t},s=function(e,t,n){for(var r=n.substring(0,16),a=g.enc.Hex.parse(r),s=g.enc.Utf8.parse(t),o=i[e].keylen+i[e].ivlen,u="",c=null;;){var l=g.algo.MD5.create();if(null!=c&&l.update(c),l.update(s),l.update(a),c=l.finalize(),(u+=g.enc.Hex.stringify(c)).length>=2*o)break}var h={};return h.keyhex=u.substr(0,2*i[e].keylen),h.ivhex=u.substr(2*i[e].keylen,2*i[e].ivlen),h},o=function(e,t,n,r){var a=g.enc.Base64.parse(e),s=g.enc.Hex.stringify(a);return(0,i[t].proc)(s,n,r)};return{version:"1.0.0",parsePKCS5PEM:function(e){return a(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,n){return s(e,t,n)},decryptKeyB64:function(e,t,n,r){return o(e,t,n,r)},getDecryptedKeyHex:function(e,t){var n=a(e),r=(n.type,n.cipher),i=n.ivsalt,u=n.data,c=s(r,t,i).keyhex;return o(u,r,c,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,n,r,a){var o="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===i[r])throw new Error("KEYUTIL unsupported algorithm: "+r);void 0!==a&&null!=a||(a=function(e){var t=g.lib.WordArray.random(e);return g.enc.Hex.stringify(t)}(i[r].ivlen).toUpperCase());var u=function(e,t,n,r){return(0,i[t].eproc)(e,n,r)}(t,r,s(r,n,a).keyhex,a);o="-----BEGIN "+e+" PRIVATE KEY-----\r\n";return o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+r+","+a+"\r\n",o+="\r\n",o+=u.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=de,n=t.getChildIdx,r=t.getV,i={},a=n(e,0);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+a.length);i.ciphertext=r(e,a[1]);var s=n(e,a[0]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+s.length);if("2a864886f70d01050d"!=r(e,s[0]))throw new Error("this only supports pkcs5PBES2");var o=n(e,s[1]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+o.length);var u=n(e,o[1]);if(2!=u.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length);if("2a864886f70d0307"!=r(e,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=r(e,u[1]);var c=n(e,o[0]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+c.length);if("2a864886f70d01050c"!=r(e,c[0]))throw new Error("this only supports pkcs5PBKDF2");var l=n(e,c[1]);if(l.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+l.length);i.pbkdf2Salt=r(e,l[0]);var h=r(e,l[1]);try{i.pbkdf2Iter=parseInt(h,16)}catch(e){throw new Error("malformed format pbkdf2Iter: "+h)}return i},getPBKDF2KeyHexFromParam:function(e,t){var n=g.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,i=g.PBKDF2(t,n,{keySize:6,iterations:r});return g.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var n=Te(e,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(n),i=Ye.getPBKDF2KeyHexFromParam(r,t),a={};a.ciphertext=g.enc.Hex.parse(r.ciphertext);var s=g.enc.Hex.parse(i),o=g.enc.Hex.parse(r.encryptionSchemeIV),u=g.TripleDES.decrypt(a,s,{iv:o});return g.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(e,t){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function(e){var t=de,n=t.getChildIdx,r=t.getV,i={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var a=n(e,0);if(a.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(a[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=n(e,a[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=r(e,s[0]),"06"==e.substr(s[1],2)&&(i.algparam=r(e,s[1])),"04"!=e.substr(a[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=t.getVidx(e,a[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=Te(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,n=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==n.algoid)t=new ae;else if("2a8648ce380401"==n.algoid)t=new he.crypto.DSA;else{if("2a8648ce3d0201"!=n.algoid)throw new Error("unsupported private key algorithm");t=new he.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,n=de.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===n)t=new ae;else if("2a8648ce380401"===n)t=new he.crypto.DSA;else{if("2a8648ce3d0201"!==n)throw new Error("unsupported PKCS#8 public key hex");t=new he.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=de,n=t.getChildIdx,r=t.getV,i={};if("30"!=e.substr(0,2))throw new Error("malformed RSA key(code:001)");var a=n(e,0);if(2!=a.length)throw new Error("malformed RSA key(code:002)");if("02"!=e.substr(a[0],2))throw new Error("malformed RSA key(code:003)");if(i.n=r(e,a[0]),"02"!=e.substr(a[1],2))throw new Error("malformed RSA key(code:004)");return i.e=r(e,a[1]),i},parsePublicPKCS8Hex:function(e){var t=de,n=t.getChildIdx,r=t.getV,i={algparam:null},a=n(e,0);if(2!=a.length)throw new Error("outer DERSequence shall have 2 elements: "+a.length);var s=a[0];if("30"!=e.substr(s,2))throw new Error("malformed PKCS8 public key(code:001)");var o=n(e,s);if(2!=o.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=e.substr(o[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(i.algoid=r(e,o[0]),"06"==e.substr(o[1],2)?i.algparam=r(e,o[1]):"30"==e.substr(o[1],2)&&(i.algparam={},i.algparam.p=t.getVbyList(e,o[1],[0],"02"),i.algparam.q=t.getVbyList(e,o[1],[1],"02"),i.algparam.g=t.getVbyList(e,o[1],[2],"02")),"03"!=e.substr(a[1],2))throw new Error("malformed PKCS8 public key(code:004)");return i.key=r(e,a[1]).substr(2),i}}}();Ye.getKey=function(e,t,n){var r=(m=de).getChildIdx,i=(m.getV,m.getVbyList),a=he.crypto,s=a.ECDSA,o=a.DSA,u=ae,c=Te,l=Ye;if(void 0!==u&&e instanceof u)return e;if(void 0!==s&&e instanceof s)return e;if(void 0!==o&&e instanceof o)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new s({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new s({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(R=new u).setPublic(e.n,e.e),R;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(R=new u).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),R;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(R=new u).setPrivate(e.n,e.e,e.d),R;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(R=new o).setPublic(e.p,e.q,e.g,e.y),R;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(R=new o).setPrivate(e.p,e.q,e.g,e.y,e.x),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(R=new u).setPublic(Se(e.n),Se(e.e)),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(R=new u).setPrivateEx(Se(e.n),Se(e.e),Se(e.d),Se(e.p),Se(e.q),Se(e.dp),Se(e.dq),Se(e.qi)),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(R=new u).setPrivate(Se(e.n),Se(e.e),Se(e.d)),R;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var h=(C=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+Se(e.x)).slice(-h)+("0000000000"+Se(e.y)).slice(-h);return C.setPublicKeyHex(f),C}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){h=(C=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+Se(e.x)).slice(-h)+("0000000000"+Se(e.y)).slice(-h);var p=("0000000000"+Se(e.d)).slice(-h);return C.setPublicKeyHex(f),C.setPrivateKeyHex(p),C}if("pkcs5prv"===n){var d,g=e,m=de;if(9===(d=r(g,0)).length)(R=new u).readPKCS5PrvKeyHex(g);else if(6===d.length)(R=new o).readPKCS5PrvKeyHex(g);else{if(!(d.length>2&&"04"===g.substr(d[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(R=new s).readPKCS5PrvKeyHex(g)}return R}if("pkcs8prv"===n)return R=l.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===n)return l._getKeyFromPublicPKCS8Hex(e);if("x509pub"===n)return Ze.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return Ze.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var v=Te(e,"PUBLIC KEY");return l._getKeyFromPublicPKCS8Hex(v)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var y=c(e,"RSA PRIVATE KEY");return l.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=i(T=c(e,"DSA PRIVATE KEY"),0,[1],"02"),w=i(T,0,[2],"02"),x=i(T,0,[3],"02"),E=i(T,0,[4],"02"),F=i(T,0,[5],"02");return(R=new o).setPrivate(new S(b,16),new S(w,16),new S(x,16),new S(E,16),new S(F,16)),R}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){y=c(e,"EC PRIVATE KEY");return l.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return l.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var A=l.getDecryptedKeyHex(e,t),D=new ae;return D.readPKCS5PrvKeyHex(A),D}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var C,R=i(T=l.getDecryptedKeyHex(e,t),0,[1],"04"),$=i(T,0,[2,0],"06"),I=i(T,0,[3,0],"03").substr(2);if(void 0===he.crypto.OID.oidhex2name[$])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+$);return(C=new s({curve:he.crypto.OID.oidhex2name[$]})).setPublicKeyHex(I),C.setPrivateKeyHex(R),C.isPublic=!1,C}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var T;b=i(T=l.getDecryptedKeyHex(e,t),0,[1],"02"),w=i(T,0,[2],"02"),x=i(T,0,[3],"02"),E=i(T,0,[4],"02"),F=i(T,0,[5],"02");return(R=new o).setPrivate(new S(b,16),new S(w,16),new S(x,16),new S(E,16),new S(F,16)),R}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return l.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},Ye.generateKeypair=function(e,t){if("RSA"==e){var n=t;(s=new ae).generate(n,"10001"),s.isPrivate=!0,s.isPublic=!0;var r=new ae,i=s.n.toString(16),a=s.e.toString(16);return r.setPublic(i,a),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=s,o.pubKeyObj=r,o}if("EC"==e){var s,o,u=t,c=new he.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new he.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(r=new he.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=s,o.pubKeyObj=r,o}throw new Error("unknown algorithm: "+e)},Ye.getPEM=function(e,t,n,r,i,a){var s=he,o=s.asn1,u=o.DERObjectIdentifier,c=o.DERInteger,l=o.ASN1Util.newObject,h=o.x509.SubjectPublicKeyInfo,f=s.crypto,p=f.DSA,d=f.ECDSA,m=ae;function v(e){return l({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function y(e){return l({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function b(e){return l({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==m&&e instanceof m||void 0!==p&&e instanceof p||void 0!==d&&e instanceof d)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return Ie(E=new h(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===n||null==n)&&1==e.isPrivate)return Ie(E=v(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==d&&e instanceof d&&(void 0===n||null==n)&&1==e.isPrivate){var w=new u({name:e.curveName}).getEncodedHex(),x=y(e).getEncodedHex(),S="";return S+=Ie(w,"EC PARAMETERS"),S+=Ie(x,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==p&&e instanceof p&&(void 0===n||null==n)&&1==e.isPrivate)return Ie(E=b(e).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==n&&null!=n&&1==e.isPrivate){var E=v(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,n,r,a)}if("PKCS5PRV"==t&&void 0!==d&&e instanceof d&&void 0!==n&&null!=n&&1==e.isPrivate){E=y(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,n,r,a)}if("PKCS5PRV"==t&&void 0!==p&&e instanceof p&&void 0!==n&&null!=n&&1==e.isPrivate){E=b(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,n,r,a)}var F=function(e,t){var n=A(e,t);return new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},A=function(e,t){var n=g.lib.WordArray.random(8),r=g.lib.WordArray.random(8),i=g.PBKDF2(t,n,{keySize:6,iterations:100}),a=g.enc.Hex.parse(e),s=g.TripleDES.encrypt(a,i,{iv:r})+"",o={};return o.ciphertext=s,o.pbkdf2Salt=g.enc.Hex.stringify(n),o.pbkdf2Iter=100,o.encryptionSchemeAlg="DES-EDE3-CBC",o.encryptionSchemeIV=g.enc.Hex.stringify(r),o};if("PKCS8PRV"==t&&null!=m&&e instanceof m&&1==e.isPrivate){var D=v(e).getEncodedHex();E=l({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:D}}]}).getEncodedHex();return void 0===n||null==n?Ie(E,"PRIVATE KEY"):Ie(x=F(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==d&&e instanceof d&&1==e.isPrivate){D=new l({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),E=l({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:D}}]}).getEncodedHex();return void 0===n||null==n?Ie(E,"PRIVATE KEY"):Ie(x=F(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==p&&e instanceof p&&1==e.isPrivate){D=new c({bigint:e.x}).getEncodedHex(),E=l({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:D}}]}).getEncodedHex();return void 0===n||null==n?Ie(E,"PRIVATE KEY"):Ie(x=F(E,n),"ENCRYPTED PRIVATE KEY")}throw new Error("unsupported object nor format")},Ye.getKeyFromCSRPEM=function(e){var t=Te(e,"CERTIFICATE REQUEST");return Ye.getKeyFromCSRHex(t)},Ye.getKeyFromCSRHex=function(e){var t=Ye.parseCSRHex(e);return Ye.getKey(t.p8pubkeyhex,null,"pkcs8pub")},Ye.parseCSRHex=function(e){var t=de,n=t.getChildIdx,r=t.getTLV,i={},a=e;if("30"!=a.substr(0,2))throw new Error("malformed CSR(code:001)");var s=n(a,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if("30"!=a.substr(s[0],2))throw new Error("malformed CSR(code:003)");var o=n(a,s[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=r(a,o[2]),i},Ye.getKeyID=function(e){var t=Ye,n=de;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var r=Te(t.getPEM(e)),i=n.getIdxbyList(r,0,[1]),a=n.getV(r,i).substring(2);return he.crypto.Util.hashHex(a,"sha1")},Ye.getJWKFromKey=function(e){var t={};if(e instanceof ae&&e.isPrivate)return t.kty="RSA",t.n=xe(e.n.toString(16)),t.e=xe(e.e.toString(16)),t.d=xe(e.d.toString(16)),t.p=xe(e.p.toString(16)),t.q=xe(e.q.toString(16)),t.dp=xe(e.dmp1.toString(16)),t.dq=xe(e.dmq1.toString(16)),t.qi=xe(e.coeff.toString(16)),t;if(e instanceof ae&&e.isPublic)return t.kty="RSA",t.n=xe(e.n.toString(16)),t.e=xe(e.e.toString(16)),t;if(e instanceof he.crypto.ECDSA&&e.isPrivate){if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);var n=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=xe(n.x),t.y=xe(n.y),t.d=xe(e.prvKeyHex),t}if(e instanceof he.crypto.ECDSA&&e.isPublic){var r;if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);n=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=xe(n.x),t.y=xe(n.y),t}throw new Error("not supported key object")},ae.getPosArrayOfChildrenFromHex=function(e){return de.getChildIdx(e,0)},ae.getHexValueArrayOfChildrenFromHex=function(e){var t,n=de.getV,r=n(e,(t=ae.getPosArrayOfChildrenFromHex(e))[0]),i=n(e,t[1]),a=n(e,t[2]),s=n(e,t[3]),o=n(e,t[4]),u=n(e,t[5]),c=n(e,t[6]),l=n(e,t[7]),h=n(e,t[8]);return(t=new Array).push(r,i,a,s,o,u,c,l,h),t},ae.prototype.readPrivateKeyFromPEMString=function(e){var t=Te(e),n=ae.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},ae.prototype.readPKCS5PrvKeyHex=function(e){var t=ae.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},ae.prototype.readPKCS8PrvKeyHex=function(e){var t,n,r,i,a,s,o,u,c=de,l=c.getVbyListEx;if(!1===c.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=l(e,0,[2,0,1],"02"),n=l(e,0,[2,0,2],"02"),r=l(e,0,[2,0,3],"02"),i=l(e,0,[2,0,4],"02"),a=l(e,0,[2,0,5],"02"),s=l(e,0,[2,0,6],"02"),o=l(e,0,[2,0,7],"02"),u=l(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,n,r,i,a,s,o,u)},ae.prototype.readPKCS5PubKeyHex=function(e){var t=de,n=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(e,0);if(2!==r.length||"02"!==e.substr(r[0],2)||"02"!==e.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=n(e,r[0]),a=n(e,r[1]);this.setPublic(i,a)},ae.prototype.readPKCS8PubKeyHex=function(e){var t=de;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var n=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(n)},ae.prototype.readCertPubKeyHex=function(e,t){var n,r;(n=new Ze).readCertHex(e),r=n.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};new RegExp("[^0-9a-f]","gi");function Xe(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n+="0";return n+e}function Je(e,t,n){for(var r="",i=0;r.length<t;)r+=Ae(n(De(e+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return r}function Qe(e){for(var t in he.crypto.Util.DIGESTINFOHEAD){var n=he.crypto.Util.DIGESTINFOHEAD[t],r=n.length;if(e.substring(0,r)==n)return[t,e.substring(r)]}return[]}function Ze(e){var t,n=de,r=n.getChildIdx,i=n.getV,a=n.getTLV,s=n.getVbyList,o=n.getVbyListEx,u=n.getTLVbyList,c=n.getTLVbyListEx,l=n.getIdxbyList,h=n.getIdxbyListEx,f=n.getVidx,p=n.getInt,d=n.oidname,g=n.hextooidstr,m=Te;try{t=he.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=u(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=u(e,0,[0]),n=p(t,0);if(n<0||2<n)throw new Error("malformed version field");return this.version=n+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return o(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var n in t)if(e===t[n])return n;return d(o(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=s(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=s(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return n.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return l(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return Ye.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=u(this.hex,0,[0],"30"),i=new he.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.parseExt=function(e){var t,a,o;if(void 0===e){if(o=this.hex,3!==this.version)return-1;t=l(o,0,[0,7,0],"30"),a=r(o,t)}else{o=Te(e);var u=l(o,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(o,u))return void(this.aExtInfo=new Array);t=l(o,0,[0,3,0,1,0],"30"),a=r(o,t),this.hex=o}this.aExtInfo=new Array;for(var c=0;c<a.length;c++){var h={critical:!1},p=0;3===r(o,a[c]).length&&(h.critical=!0,p=1),h.oid=n.hextooidstr(s(o,a[c],[0],"06"));var d=l(o,a[c],[1+p]);h.vidx=f(o,d),this.aExtInfo.push(h)}},this.getExtInfo=function(e){var t=this.aExtInfo,n=e;if(e.match(/^[0-9.]+$/)||(n=he.asn1.x509.OID.name2oid(e)),""!==n)for(var r=0;r<t.length;r++)if(t[r].oid===n)return t[r]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("basicConstraints");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"basicConstraints"};if(t&&(r.critical=!0),"3000"===e)return r;if("30030101ff"===e)return r.cA=!0,r;if("30060101ff02"===e.substr(0,12)){var s=i(e,10),o=parseInt(s,16);return r.cA=!0,r.pathLen=o,r}throw new Error("hExtV parse error: "+e)},this.getExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("keyUsage");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"keyUsage"};return t&&(r.critical=!0),r.names=this.getExtKeyUsageString(e).split(","),r},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=a(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var n="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(n=n.slice(-8)),10==e.length&&(n=n.slice(-16)),""==(n=n.replace(/0+$/,""))&&(n="0"),n},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),n=new Array,r=0;r<t.length;r++)"1"==t.substr(r,1)&&n.push(Ze.KEYUSAGE_NAME[r]);return n.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectKeyIdentifier");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"subjectKeyIdentifier"};t&&(r.critical=!0);var s=i(e,0);return r.kid={hex:s},r},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityKeyIdentifier");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var s={extname:"authorityKeyIdentifier"};t&&(s.critical=!0);for(var o=r(e,0),u=0;u<o.length;u++){var c=e.substr(o[u],2);if("80"===c&&(s.kid={hex:i(e,o[u])}),"a1"===c){var l=a(e,o[u]),h=this.getGeneralNames(l);s.issuer=h[0].dn}"82"===c&&(s.sn={hex:i(e,o[u])})}return s},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("extKeyUsage");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var s={extname:"extKeyUsage",array:[]};t&&(s.critical=!0);for(var o=r(e,0),u=0;u<o.length;u++)s.array.push(d(i(e,o[u])));return s},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,n=a(this.hex,e.vidx);if(""===n)return t;for(var s=r(n,0),o=0;o<s.length;o++)t.push(d(i(n,s[o])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectAltName");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"subjectAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("issuerAltName");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"issuerAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getGeneralNames=function(e){for(var t=r(e,0),n=[],i=0;i<t.length;i++){var s=this.getGeneralName(a(e,t[i]));void 0!==s&&n.push(s)}return n},this.getGeneralName=function(e){var t=e.substr(0,2),n=i(e,0),r=Ae(n);return"81"==t?{rfc822:r}:"82"==t?{dns:r}:"86"==t?{uri:r}:"87"==t?{ip:Be(n)}:"a4"==t?{dn:this.getX500Name(n)}:void 0},this.getExtSubjectAltName2=function(){var e,t,n,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var o=new Array,u=a(this.hex,s.vidx),c=r(u,0),l=0;l<c.length;l++)n=u.substr(c[l],2),e=i(u,c[l]),"81"===n&&(t=Fe(e),o.push(["MAIL",t])),"82"===n&&(t=Fe(e),o.push(["DNS",t])),"84"===n&&(t=Ze.hex2dn(e,0),o.push(["DN",t])),"86"===n&&(t=Fe(e),o.push(["URI",t])),"87"===n&&(t=Be(e),o.push(["IP",t]));return o},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("cRLDistributionPoints");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"cRLDistributionPoints",array:[]};t&&(i.critical=!0);for(var s=r(e,0),o=0;o<s.length;o++){var u=a(e,s[o]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=e.substr(n[i],2),o=a(e,n[i]);"a0"==s&&(t.dpname=this.getDistributionPointName(o))}return t},this.getDistributionPointName=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=e.substr(n[i],2),o=a(e,n[i]);"a0"==s&&(t.full=this.getGeneralNames(o))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo("cRLDistributionPoints");if(void 0===e)return e;for(var t=new Array,n=r(this.hex,e.vidx),i=0;i<n.length;i++)try{var a=Fe(s(this.hex,n[i],[0,0,0],"86"));t.push(a)}catch(e){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},n=r(this.hex,e.vidx),i=0;i<n.length;i++){var a=s(this.hex,n[i],[0],"06"),o=s(this.hex,n[i],[1],"86");"2b06010505073001"===a&&t.ocsp.push(Fe(o)),"2b06010505073002"===a&&t.caissuer.push(Fe(o))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityInfoAccess");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"authorityInfoAccess",array:[]};t&&(i.critical=!0);for(var u=r(e,0),c=0;c<u.length;c++){var l=o(e,u[c],[0],"06"),h=Fe(s(e,u[c],[1],"86"));if("2b06010505073001"==l)i.array.push({ocsp:h});else{if("2b06010505073002"!=l)throw new Error("unknown method: "+l);i.array.push({caissuer:h})}}return i},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("certificatePolicies");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"certificatePolicies",array:[]};t&&(i.critical=!0);for(var s=r(e,0),o=0;o<s.length;o++){var u=a(e,s[o]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(e){var t={},n=s(e,0,[0],"06");t.policyoid=d(n);var i=h(e,0,[1],"30");if(-1!=i){t.array=[];for(var o=r(e,i),u=0;u<o.length;u++){var c=a(e,o[u]),l=this.getPolicyQualifierInfo(c);t.array.push(l)}}return t},this.getPolicyQualifierInfo=function(e){var t={},n=s(e,0,[0],"06");if("2b06010505070201"===n){var r=o(e,0,[1],"16");t.cps=Ae(r)}else if("2b06010505070202"===n){var i=u(e,0,[1],"30");t.unotice=this.getUserNotice(i)}return t},this.getUserNotice=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=a(e,n[i]);"30"!=s.substr(0,2)&&(t.exptext=this.getDisplayText(s))}return t},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=Ae(i(e,0)),t},this.getExtCRLNumber=function(e,t){var n={extname:"cRLNumber"};if(t&&(n.critical=!0),"02"==e.substr(0,2))return n.num={hex:i(e,0)},n;throw new Error("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var n={extname:"cRLReason"};if(t&&(n.critical=!0),"0a"==e.substr(0,2))return n.code=parseInt(i(e,0),16),n;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var n={extname:"ocspNonce"};t&&(n.critical=!0);var r=i(e,0);return n.hex=r,n},this.getExtOcspNoCheck=function(e,t){var n={extname:"ocspNoCheck"};return t&&(n.critical=!0),n},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("adobeTimeStamp");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"adobeTimeStamp"};t&&(i.critical=!0);var s=r(e,0);if(s.length>1){var o=a(e,s[1]),u=this.getGeneralName(o);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=a(e,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i},this.getX500NameRule=function(e){for(var t=null,n=[],r=0;r<e.length;r++)for(var i=e[r],a=0;a<i.length;a++)n.push(i[a]);for(r=0;r<n.length;r++){var s=n[r],o=s.ds,u=s.value,c=s.type;if(":"+o,"prn"!=o&&"utf8"!=o&&"ia5"!=o)return"mixed";if("ia5"==o){if("CN"!=c)return"mixed";if(he.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==o)continue;return"mixed"}if(":"+o,null==t)t=o;else if(t!==o)return"mixed"}return null==t?"prn":t},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getRDN(a(e,n[i])));return t},this.getRDN=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getAttrTypeAndValue(a(e,n[i])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},n=r(e,0),i=s(e,n[0],[],"06"),a=s(e,n[1],[]),o=he.asn1.ASN1Util.oidHexToInt(i);return t.type=he.asn1.x509.OID.oid2atype(o),t.ds=this.HEX2STAG[e.substr(n[1],2)],"bmp"!=t.ds?t.value=Fe(a):t.value=He(a),t},this.readCertPEM=function(e){this.readCertHex(m(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{l(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=Ie(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&(-1!=h(this.hex,0,[0,"[3]"])&&(e=c(this.hex,0,[0,"[3]",0],"30")));for(var t=[],n=r(e,0),i=0;i<n.length;i++){var s=a(e,n[i]),o=this.getExtParam(s);null!=o&&t.push(o)}return t},this.getExtParam=function(e){var t=r(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var n=g(s(e,0,[0],"06")),i=!1;3==t&&"0101ff"==u(e,0,[1])&&(i=!0);var a=u(e,0,[t-1,0]),o=void 0;if("2.5.29.14"==n?o=this.getExtSubjectKeyIdentifier(a,i):"2.5.29.15"==n?o=this.getExtKeyUsage(a,i):"2.5.29.17"==n?o=this.getExtSubjectAltName(a,i):"2.5.29.18"==n?o=this.getExtIssuerAltName(a,i):"2.5.29.19"==n?o=this.getExtBasicConstraints(a,i):"2.5.29.31"==n?o=this.getExtCRLDistributionPoints(a,i):"2.5.29.32"==n?o=this.getExtCertificatePolicies(a,i):"2.5.29.35"==n?o=this.getExtAuthorityKeyIdentifier(a,i):"2.5.29.37"==n?o=this.getExtExtKeyUsage(a,i):"1.3.6.1.5.5.7.1.1"==n?o=this.getExtAuthorityInfoAccess(a,i):"2.5.29.20"==n?o=this.getExtCRLNumber(a,i):"2.5.29.21"==n?o=this.getExtCRLReason(a,i):"1.3.6.1.5.5.7.48.1.2"==n?o=this.getExtOcspNonce(a,i):"1.3.6.1.5.5.7.48.1.5"==n?o=this.getExtOcspNoCheck(a,i):"1.2.840.113583.1.1.9.1"==n&&(o=this.getExtAdobeTimeStamp(a,i)),null!=o)return o;var c={extname:n,extn:a};return i&&(c.critical=!0),c},this.findExt=function(e,t){for(var n=0;n<e.length;n++)if(e[n].extname==t)return e[n];return null},this.updateExtCDPFullURI=function(e,t){var n=this.findExt(e,"cRLDistributionPoints");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)if(null!=r[i].dpname&&null!=r[i].dpname.full)for(var a=r[i].dpname.full,s=0;s<a.length;s++){var o=a[i];null!=o.uri&&(o.uri=t)}},this.updateExtAIAOCSP=function(e,t){var n=this.findExt(e,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)null!=r[i].ocsp&&(r[i].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var n=this.findExt(e,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)null!=r[i].caissuer&&(r[i].caissuer=t)},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var e,t,n,r,i=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];if(t+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var a=0;a<i.array.length;a++){var s=i.array[a];void 0!==s.cps&&(t+=" cps: "+s.cps+"\n")}}return t},a=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];try{void 0!==i.dpname.full[0].uri&&(t+=" "+i.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==i.dname.full[0].dn.hex&&(t+=" "+Ze.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},s=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];void 0!==i.caissuer&&(t+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(t+=" ocsp: "+i.ocsp+"\n")}return t};if(e="Basic Fields\n",e+=" serial number: "+this.getSerialNumberHex()+"\n",e+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+=" issuer: "+this.getIssuerString()+"\n",e+=" notBefore: "+this.getNotBefore()+"\n",e+=" notAfter: "+this.getNotAfter()+"\n",e+=" subject: "+this.getSubjectString()+"\n",e+=" subject public key info: \n",e+=" key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+=" n="+Ue(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+Ue(t.e.toString(16))+"\n"),null!=(n=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var o=0;o<n.length;o++){var u=n[o],c=he.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var l="";if(!0===u.critical&&(l="CRITICAL"),e+=" "+c+" "+l+":\n","basicConstraints"===c){var h=this.getExtBasicConstraints();void 0===h.cA?e+=" {}\n":(e+=" cA=true",void 0!==h.pathLen&&(e+=", pathLen="+h.pathLen),e+="\n")}else if("keyUsage"===c)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var f=this.getExtAuthorityKeyIdentifier();void 0!==f.kid&&(e+=" kid="+f.kid.hex+"\n")}else{if("extKeyUsage"===c)e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===c)e+=" "+(r=this.getExtSubjectAltName(),JSON.stringify(r.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===c)e+=a(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===c)e+=s(this.getExtAuthorityInfoAccess());else"certificatePolicies"===c&&(e+=i(this.getExtCertificatePolicies()))}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):he.lang.String.isHex(e)&&this.readCertHex(e))}ae.prototype.sign=function(e,t){var n=function(e){return he.crypto.Util.hashString(e,t)}(e);return this.signWithMessageHash(n,t)},ae.prototype.signWithMessageHash=function(e,t){var n=re(he.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return Xe(this.doPrivate(n).toString(16),this.n.bitLength())},ae.prototype.signPSS=function(e,t,n){var r,i=(r=De(e),he.crypto.Util.hashHex(r,t));return void 0===n&&(n=-1),this.signWithMessageHashPSS(i,t,n)},ae.prototype.signWithMessageHashPSS=function(e,t,n){var r,i=Ae(e),a=i.length,s=this.n.bitLength()-1,o=Math.ceil(s/8),u=function(e){return he.crypto.Util.hashHex(e,t)};if(-1===n||void 0===n)n=a;else if(-2===n)n=o-a-2;else if(n<-2)throw new Error("invalid salt length");if(o<a+n+2)throw new Error("data too long");var c="";n>0&&(c=new Array(n),(new ne).nextBytes(c),c=String.fromCharCode.apply(String,c));var l=Ae(u(De("\0\0\0\0\0\0\0\0"+i+c))),h=[];for(r=0;r<o-n-a-2;r+=1)h[r]=0;var f=String.fromCharCode.apply(String,h)+""+c,p=Je(l,f.length,u),d=[];for(r=0;r<f.length;r+=1)d[r]=f.charCodeAt(r)^p.charCodeAt(r);var g=65280>>8*o-s&255;for(d[0]&=~g,r=0;r<a;r++)d.push(l.charCodeAt(r));return d.push(188),Xe(this.doPrivate(new S(d)).toString(16),this.n.bitLength())},ae.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var n=re(t,16),r=this.n.bitLength();if(n.bitLength()>r)return!1;var i=this.doPublic(n).toString(16);if(i.length+3!=r/4)return!1;var a=Qe(i.replace(/^1f+00/,""));if(0==a.length)return!1;var s=a[0];return a[1]==function(e){return he.crypto.Util.hashString(e,s)}(e)},ae.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var n=re(t,16);if(n.bitLength()>this.n.bitLength())return 0;var r=Qe(this.doPublic(n).toString(16).replace(/^1f+00/,""));if(0==r.length)return!1;r[0];return r[1]==e},ae.prototype.verifyPSS=function(e,t,n,r){var i,a=(i=De(e),he.crypto.Util.hashHex(i,n));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(a,t,n,r)},ae.prototype.verifyWithMessageHashPSS=function(e,t,n,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,a=new S(t,16),s=function(e){return he.crypto.Util.hashHex(e,n)},o=Ae(e),u=o.length,c=this.n.bitLength()-1,l=Math.ceil(c/8);if(-1===r||void 0===r)r=u;else if(-2===r)r=l-u-2;else if(r<-2)throw new Error("invalid salt length");if(l<u+r+2)throw new Error("data too long");var h=this.doPublic(a).toByteArray();for(i=0;i<h.length;i+=1)h[i]&=255;for(;h.length<l;)h.unshift(0);if(188!==h[l-1])throw new Error("encoded message does not end in 0xbc");var f=(h=String.fromCharCode.apply(String,h)).substr(0,l-u-1),p=h.substr(f.length,u),d=65280>>8*l-c&255;if(0!=(f.charCodeAt(0)&d))throw new Error("bits beyond keysize not zero");var g=Je(p,f.length,s),m=[];for(i=0;i<f.length;i+=1)m[i]=f.charCodeAt(i)^g.charCodeAt(i);m[0]&=~d;var v=l-u-r-2;for(i=0;i<v;i+=1)if(0!==m[i])throw new Error("leftmost octets not zero");if(1!==m[v])throw new Error("0x01 marker not found");return p===Ae(s(De("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,m.slice(-r)))))},ae.SALT_LEN_HLEN=-1,ae.SALT_LEN_MAX=-2,ae.SALT_LEN_RECOVER=-2,Ze.hex2dn=function(e,t){void 0===t&&(t=0);var n=new Ze;de.getTLV(e,t);return n.getX500Name(e).str},Ze.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var n=new Array,r=de.getChildIdx(e,t),i=0;i<r.length;i++)n.push(Ze.hex2attrTypeValue(e,r[i]));return(n=n.map((function(e){return e.replace("+","\\+")}))).join("+")},Ze.hex2attrTypeValue=function(e,t){var n=de,r=n.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var i=n.getChildIdx(e,t);2!==i.length||e.substr(i[0],2);var a=r(e,i[0]),s=he.asn1.ASN1Util.oidHexToInt(a);return he.asn1.x509.OID.oid2atype(s)+"="+Ae(r(e,i[1]))},Ze.getPublicKeyFromCertHex=function(e){var t=new Ze;return t.readCertHex(e),t.getPublicKey()},Ze.getPublicKeyFromCertPEM=function(e){var t=new Ze;return t.readCertPEM(e),t.getPublicKey()},Ze.getPublicKeyInfoPropOfCertPEM=function(e){var t,n,r=de.getVbyList,i={};return i.algparam=null,(t=new Ze).readCertPEM(e),n=t.getPublicKeyHex(),i.keyhex=r(n,0,[1],"03").substr(2),i.algoid=r(n,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=r(n,0,[0,1],"06")),i},Ze.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];void 0!==he&&he||(he={}),void 0!==he.jws&&he.jws||(he.jws={}),he.jws.JWS=function(){var e=he.jws.JWS.isSafeJSONString;this.parseJWS=function(t,n){if(void 0===this.parsedJWS||!n&&void 0===this.parsedJWS.sigvalH){var r=t.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==r)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=r[1],a=r[2],s=r[3],o=i+"."+a;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=a,this.parsedJWS.sigvalB64U=s,this.parsedJWS.si=o,!n){var u=Se(s),c=re(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var l=pe(i),h=pe(a);if(this.parsedJWS.headS=l,this.parsedJWS.payloadS=h,!e(l,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+l}}},he.jws.JWS.sign=function(e,t,n,r,i){var a,s,o,u=he,c=u.jws.JWS,l=c.readSafeJSONString,h=c.isSafeJSONString,f=u.crypto,p=(f.ECDSA,f.Mac),d=f.Signature,g=JSON;if("string"!=typeof t&&"object"!=typeof t)throw"spHeader must be JSON string or object: "+t;if("object"==typeof t&&(s=t,a=g.stringify(s)),"string"==typeof t){if(!h(a=t))throw"JWS Head is not safe JSON string: "+a;s=l(a)}if(o=n,"object"==typeof n&&(o=g.stringify(n)),""!=e&&null!=e||void 0===s.alg||(e=s.alg),""!=e&&null!=e&&void 0===s.alg&&(s.alg=e,a=g.stringify(s)),e!==s.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+s.alg;var m=null;if(void 0===c.jwsalg2sigalg[e])throw"unsupported alg name: "+e;m=c.jwsalg2sigalg[e];var v=fe(a)+"."+fe(o),y="";if("Hmac"==m.substr(0,4)){if(void 0===r)throw"mac key shall be specified for HS* alg";var b=new p({alg:m,prov:"cryptojs",pass:r});b.updateString(v),y=b.doFinal()}else if(-1!=m.indexOf("withECDSA")){(x=new d({alg:m})).init(r,i),x.updateString(v);var w=x.sign();y=he.crypto.ECDSA.asn1SigToConcatSig(w)}else{var x;if("none"!=m)(x=new d({alg:m})).init(r,i),x.updateString(v),y=x.sign()}return v+"."+xe(y)},he.jws.JWS.verify=function(e,t,n){var r,i=he,a=i.jws.JWS,s=a.readSafeJSONString,o=i.crypto,u=o.ECDSA,c=o.Mac,l=o.Signature;r=ae;var h=e.split(".");if(3!==h.length)return!1;var f=h[0]+"."+h[1],p=Se(h[2]),d=s(pe(h[0])),g=null,m=null;if(void 0===d.alg)throw"algorithm not specified in header";if((m=(g=d.alg).substr(0,2),null!=n&&"[object Array]"===Object.prototype.toString.call(n)&&n.length>0)&&-1==(":"+n.join(":")+":").indexOf(":"+g+":"))throw"algorithm '"+g+"' not accepted in the list";if("none"!=g&&null===t)throw"key shall be specified to verify.";if("string"==typeof t&&-1!=t.indexOf("-----BEGIN ")&&(t=Ye.getKey(t)),!("RS"!=m&&"PS"!=m||t instanceof r))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==m&&!(t instanceof u))throw"key shall be a ECDSA obj for ES* algs";var v=null;if(void 0===a.jwsalg2sigalg[d.alg])throw"unsupported alg name: "+g;if("none"==(v=a.jwsalg2sigalg[g]))throw"not supported";if("Hmac"==v.substr(0,4)){if(void 0===t)throw"hexadecimal key shall be specified for HMAC";var y=new c({alg:v,pass:t});return y.updateString(f),p==y.doFinal()}if(-1!=v.indexOf("withECDSA")){var b,w=null;try{w=u.concatSigToASN1Sig(p)}catch(e){return!1}return(b=new l({alg:v})).init(t),b.updateString(f),b.verify(w)}return(b=new l({alg:v})).init(t),b.updateString(f),b.verify(p)},he.jws.JWS.parse=function(e){var t,n,r,i=e.split("."),a={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return t=i[0],n=i[1],3==i.length&&(r=i[2]),a.headerObj=he.jws.JWS.readSafeJSONString(pe(t)),a.payloadObj=he.jws.JWS.readSafeJSONString(pe(n)),a.headerPP=JSON.stringify(a.headerObj,null," "),null==a.payloadObj?a.payloadPP=pe(n):a.payloadPP=JSON.stringify(a.payloadObj,null," "),void 0!==r&&(a.sigHex=Se(r)),a},he.jws.JWS.verifyJWT=function(e,t,n){var r=he.jws,i=r.JWS,a=i.readSafeJSONString,s=i.inArray,o=i.includedArray,u=e.split("."),c=u[0],l=u[1],h=(Se(u[2]),a(pe(c))),f=a(pe(l));if(void 0===h.alg)return!1;if(void 0===n.alg)throw"acceptField.alg shall be specified";if(!s(h.alg,n.alg))return!1;if(void 0!==f.iss&&"object"==typeof n.iss&&!s(f.iss,n.iss))return!1;if(void 0!==f.sub&&"object"==typeof n.sub&&!s(f.sub,n.sub))return!1;if(void 0!==f.aud&&"object"==typeof n.aud)if("string"==typeof f.aud){if(!s(f.aud,n.aud))return!1}else if("object"==typeof f.aud&&!o(f.aud,n.aud))return!1;var p=r.IntDate.getNow();return void 0!==n.verifyAt&&"number"==typeof n.verifyAt&&(p=n.verifyAt),void 0!==n.gracePeriod&&"number"==typeof n.gracePeriod||(n.gracePeriod=0),!(void 0!==f.exp&&"number"==typeof f.exp&&f.exp+n.gracePeriod<p)&&(!(void 0!==f.nbf&&"number"==typeof f.nbf&&p<f.nbf-n.gracePeriod)&&(!(void 0!==f.iat&&"number"==typeof f.iat&&p<f.iat-n.gracePeriod)&&((void 0===f.jti||void 0===n.jti||f.jti===n.jti)&&!!i.verify(e,t,n.alg))))},he.jws.JWS.includedArray=function(e,t){var n=he.jws.JWS.inArray;if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(!n(e[r],t))return!1;return!0},he.jws.JWS.inArray=function(e,t){if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1},he.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},he.jws.JWS.isSafeJSONString=function(e,t,n){var r=null;try{return"object"!=typeof(r=le(e))?0:r.constructor===Array?0:(t&&(t[n]=r),1)}catch(e){return 0}},he.jws.JWS.readSafeJSONString=function(e){var t=null;try{return"object"!=typeof(t=le(e))?null:t.constructor===Array?null:t}catch(e){return null}},he.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==t)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]},he.jws.JWS.getJWKthumbprint=function(e){if("RSA"!==e.kty&&"EC"!==e.kty&&"oct"!==e.kty)throw"unsupported algorithm for JWK Thumprint";var t="{";if("RSA"===e.kty){if("string"!=typeof e.n||"string"!=typeof e.e)throw"wrong n and e value for RSA key";t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if("EC"===e.kty){if("string"!=typeof e.crv||"string"!=typeof e.x||"string"!=typeof e.y)throw"wrong crv, x and y value for EC key";t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if("oct"===e.kty){if("string"!=typeof e.k)throw"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var n=De(t);return xe(he.crypto.Util.hashHex(n,"sha256"))},he.jws.IntDate={},he.jws.IntDate.get=function(e){var t=he.jws.IntDate,n=t.getNow,r=t.getZulu;if("now"==e)return n();if("now + 1hour"==e)return n()+3600;if("now + 1day"==e)return n()+86400;if("now + 1month"==e)return n()+2592e3;if("now + 1year"==e)return n()+31536e3;if(e.match(/Z$/))return r(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e},he.jws.IntDate.getZulu=function(e){return _e(e)},he.jws.IntDate.getNow=function(){return~~(new Date/1e3)},he.jws.IntDate.intDate2UTCString=function(e){return new Date(1e3*e).toUTCString()},he.jws.IntDate.intDate2Zulu=function(e){var t=new Date(1e3*e);return("0000"+t.getUTCFullYear()).slice(-4)+("00"+(t.getUTCMonth()+1)).slice(-2)+("00"+t.getUTCDate()).slice(-2)+("00"+t.getUTCHours()).slice(-2)+("00"+t.getUTCMinutes()).slice(-2)+("00"+t.getUTCSeconds()).slice(-2)+"Z"},void 0!==he&&he||(he={}),void 0!==he.jws&&he.jws||(he.jws={}),he.jws.JWSJS=function(){var e=he.jws.JWS,t=e.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(e){this.init();var t=e.split(".");if(3!=t.length)throw"malformed input JWS";this.aHeader.push(t[0]),this.sPayload=t[1],this.aSignature.push(t[2])},this.addSignature=function(e,t,n,r){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var i=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var a=he.jws.JWS.sign(e,t,this.sPayload,n,r).split(".");a[0],a[2];this.aHeader.push(a[0]),this.aSignature.push(a[2])}catch(e){throw this.aHeader.length>i&&this.aHeader.pop(),this.aSignature.length>i&&this.aSignature.pop(),"addSignature failed: "+e}},this.verifyAll=function(e){if(this.aHeader.length!==e.length||this.aSignature.length!==e.length)return!1;for(var t=0;t<e.length;t++){var n=e[t];if(2!==n.length)return!1;if(!1===this.verifyNth(t,n[0],n[1]))return!1}return!0},this.verifyNth=function(t,n,r){if(this.aHeader.length<=t||this.aSignature.length<=t)return!1;var i=this.aHeader[t],a=this.aSignature[t],s=i+"."+this.sPayload+"."+a,o=!1;try{o=e.verify(s,n,r)}catch(e){return!1}return o},this.readJWSJS=function(e){if("string"==typeof e){var n=t(e);if(null==n)throw"argument is not safe JSON object string";this.aHeader=n.headers,this.sPayload=n.payload,this.aSignature=n.signatures}else try{if(!(e.headers.length>0))throw"malformed header";if(this.aHeader=e.headers,"string"!=typeof e.payload)throw"malformed signatures";if(this.sPayload=e.payload,!(e.signatures.length>0))throw"malformed signatures";this.aSignature=e.signatures}catch(e){throw"malformed JWS-JS JSON object: "+e}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},t.SecureRandom=ne,t.rng_seed_time=X,t.BigInteger=S,t.RSAKey=ae,t.ECDSA=he.crypto.ECDSA,t.DSA=he.crypto.DSA,t.Signature=he.crypto.Signature,t.MessageDigest=he.crypto.MessageDigest,t.Mac=he.crypto.Mac,t.Cipher=he.crypto.Cipher,t.KEYUTIL=Ye,t.ASN1HEX=de,t.X509=Ze,t.X509CRL=function(e){var t=he.lang.String.isHex,n=de,r=n.getV,i=n.getTLV,a=n.getVbyList,s=n.getTLVbyList,o=n.getTLVbyListEx,u=n.getIdxbyList,c=n.getIdxbyListEx,l=n.getChildIdx,h=new Ze;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this._setPos=function(){var e=u(this.hex,0,[0,0]),t=this.hex.substr(e,2);if("02"==t)this.posSigAlg=1;else{if("30"!=t)throw new Error("malformed 1st item of TBSCertList: "+t);this.posSigAlg=0}var n,r=u(this.hex,0,[0,this.posSigAlg+3]),i=this.hex.substr(r,2);if("17"==i||"18"==i)n=u(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,-1!=n&&"30"==this.hex.substr(n,2)&&(this.posRevCert=this.posSigAlg+4);else if("30"==i)this.posRevCert=this.posSigAlg+3;else{if("a0"!=i)throw new Error("malformed nextUpdate or revCert tag: "+i);this.posRevCert=null}},this.getVersion=function(){return 0==this.posSigAlg?null:parseInt(a(this.hex,0,[0,0],"02"),16)+1},this.getSignatureAlgorithmField=function(){var e=s(this.hex,0,[0,this.posSigAlg],"30");return h.getAlgorithmIdentifierName(e)},this.getIssuer=function(){var e=s(this.hex,0,[0,this.posSigAlg+1],"30");return h.getX500Name(e)},this.getThisUpdate=function(){var e=a(this.hex,0,[0,this.posSigAlg+2]);return result=Ae(e)},this.getNextUpdate=function(){var e=u(this.hex,0,[0,this.posSigAlg+3]),t=this.hex.substr(e,2);return"17"!=t&&"18"!=t?null:Ae(r(this.hex,e))},this.getRevCertArray=function(){if(null==this.posRevCert)return null;for(var e=[],t=u(this.hex,0,[0,this.posRevCert]),n=l(this.hex,t),r=0;r<n.length;r++){var a=i(this.hex,n[r]);e.push(this.getRevCert(a))}return e},this.getRevCert=function(e){var t={},n=l(e,0);return t.sn={hex:a(e,0,[0],"02")},t.date=Ae(a(e,0,[1])),3==n.length&&(t.ext=h.getExtParamArray(s(e,0,[2]))),t},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=s(this.hex,0,[0],"30"),i=new he.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.getParam=function(){var e={},t=this.getVersion();null!=t&&(e.version=t),e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.thisupdate=this.getThisUpdate();var n=this.getNextUpdate();null!=n&&(e.nextupdate=n);var r=this.getRevCertArray();if(null!=r&&(e.revcert=r),-1!=c(this.hex,0,[0,"[0]"])){var i=o(this.hex,0,[0,"[0]",0]);e.ext=h.getExtParamArray(i)}return e.sighex=this.getSignatureValueHex(),e},"string"==typeof e&&(t(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=Te(e)),this._setPos())},t.CryptoJS=g,t.b64tohex=w,t.b64toBA=x,t.ECFieldElementFp=oe,t.ECPointFp=ue,t.ECCurveFp=ce,t.stoBA=ge,t.BAtos=me,t.BAtohex=ve,t.stohex=ye,t.stob64=function(e){return b(ye(e))},t.stob64u=function(e){return be(b(ye(e)))},t.b64utos=function(e){return me(x(we(e)))},t.b64tob64u=be,t.b64utob64=we,t.hex2b64=b,t.hextob64u=xe,t.b64utohex=Se,t.utf8tob64u=fe,t.b64utoutf8=pe,t.utf8tob64=function(e){return b(ke(Le(e)))},t.b64toutf8=function(e){return decodeURIComponent(Oe(w(e)))},t.utf8tohex=Ee,t.hextoutf8=Fe,t.hextorstr=Ae,t.rstrtohex=De,t.hextob64=Ce,t.hextob64nl=Re,t.b64nltohex=$e,t.hextopem=Ie,t.pemtohex=Te,t.hextoArrayBuffer=function(e){if(e.length%2!=0)throw"input is not even length";if(null==e.match(/^[0-9A-Fa-f]+$/))throw"input is not hexadecimal";for(var t=new ArrayBuffer(e.length/2),n=new DataView(t),r=0;r<e.length/2;r++)n.setUint8(r,parseInt(e.substr(2*r,2),16));return t},t.ArrayBuffertohex=function(e){for(var t="",n=new DataView(e),r=0;r<e.byteLength;r++)t+=("00"+n.getUint8(r).toString(16)).slice(-2);return t},t.zulutomsec=Pe,t.zulutosec=_e,t.zulutodate=function(e){return new Date(Pe(e))},t.datetozulu=function(e,t,n){var r,i=e.getUTCFullYear();if(t){if(i<1950||2049<i)throw"not proper year for UTCTime: "+i;r=(""+i).slice(-2)}else r=("000"+i).slice(-4);if(r+=("0"+(e.getUTCMonth()+1)).slice(-2),r+=("0"+e.getUTCDate()).slice(-2),r+=("0"+e.getUTCHours()).slice(-2),r+=("0"+e.getUTCMinutes()).slice(-2),r+=("0"+e.getUTCSeconds()).slice(-2),n){var a=e.getUTCMilliseconds();0!==a&&(r+="."+(a=(a=("00"+a).slice(-3)).replace(/0+$/g,"")))}return r+="Z"},t.uricmptohex=ke,t.hextouricmp=Oe,t.ipv6tohex=je,t.hextoipv6=Ne,t.hextoip=Be,t.iptohex=function(e){var t="malformed IP address";if(!(e=e.toLowerCase(e)).match(/^[0-9.]+$/)){if(e.match(/^[0-9a-f:]+$/)&&-1!==e.indexOf(":"))return je(e);throw t}var n=e.split(".");if(4!==n.length)throw t;var r="";try{for(var i=0;i<4;i++){r+=("0"+parseInt(n[i]).toString(16)).slice(-2)}return r}catch(e){throw t}},t.ucs2hextoutf8=He,t.encodeURIComponentAll=Le,t.newline_toUnix=function(e){return e=e.replace(/\r\n/gm,"\n")},t.newline_toDos=function(e){return e=(e=e.replace(/\r\n/gm,"\n")).replace(/\n/gm,"\r\n")},t.hextoposhex=Ue,t.intarystrtohex=Ve,t.strdiffidx=function(e,t){var n=e.length;e.length>t.length&&(n=t.length);for(var r=0;r<n;r++)if(e.charCodeAt(r)!=t.charCodeAt(r))return r;return e.length!=t.length?n:-1},t.oidtohex=qe,t.hextooid=Ke,t.strpad=ze,t.bitstrtoint=Ge,t.inttobitstr=function(e){var t=Number(e).toString(2),n=8-t.length%8;8==n&&(n=0),t+=ze("",n,"0");var r=parseInt(t,2).toString(16);return r.length%2==1&&(r="0"+r),"0"+n+r},t.KJUR=he,t.crypto=he.crypto,t.asn1=he.asn1,t.jws=he.jws,t.lang=he.lang}).call(this,n(164).Buffer)},function(e,t,n){"use strict";n.r(t);n(152),n(153),n(154),n(155),n(156),n(157),n(159),n(161),n(162),n(22),n(163),n(9),n(14),n(33);function r(e,t,n){return{openSimpleModal:function(t){return e.open({templateUrl:t.warning?"js/angular/core/templates/modal/modal-warning.html":"js/angular/core/templates/modal/modal-simple.html",controller:"SimpleModalCtrl",size:t.size,resolve:{title:function(){return t.title},message:function(){return n.trustAsHtml(t.message)}}})},openCopyToClipboardModal:function(n){const r=e.open({templateUrl:"js/angular/core/templates/modal/copy-to-clipboard-modal.html",controller:"CopyToClipboardModalCtrl",resolve:{uri:function(){return n}}});return r.opened.then((function(){t((function(){$("#clipboardURI")[0].select()}),100)})),r}}}function i(e){return{getDetails:function(t){return e.get("rest/explore/details",{params:{uri:t},headers:{Accept:"application/json"}})},getGraph:function(t){const n=encodeURIComponent(t);return e.get("rest/explore/graph?uri="+n+"&role=subject",{headers:{Accept:"application/rdf+json"}})},getNamespaceUriForPrefix:function(e,t){let n="";for(let r=0;r<e.length;r++)if(e[r].prefix===t){n=e[r].uri;break}return n},getNamespacePrefixForUri:function(e,t){let n="";for(let r=0;r<e.length;r++)if(e[r].uri===t){n=e[r].prefix;break}return n},getLocalName:function(e){if(angular.isUndefined(e))return e;{let t;const n=e.length-1;let r=e.toString().lastIndexOf("/");r===n&&(t=e.substr(0,n),r=t.lastIndexOf("/"));let i=e.toString().lastIndexOf("#");return i===n&&(t=e.substr(0,n),i=t.lastIndexOf("/")),e.toString().substring(Math.max(i,r)+1)}}}}angular.module("graphdb.framework.core",["ui.bootstrap","jlareau.bowser","LocalStorageModule","graphdb.framework.core.controllers","pascalprecht.translate"]).provider("$menuItems",(function(){const e=function(t,n){for(let r=0;r<t.length;r++){const i=t[r];if(i.label===n)return i;const a=e(i.children,n);if(!angular.isUndefined(a))return a}},t=function(e,t){for(let n=0;n<e.length;n++){if(e[n].label===t)return!0}return!1},n=function(e,t){return e.order<t.order?-1:e.order>t.order?1:0},r=function(e,t){return{label:e.label,labelKey:e.labelKey,href:e.href,hrefFun:e.hrefFun,order:e.order,role:e.role,editions:e.editions,icon:e.icon,children:t}};let i;const a=[];this.addItem=function(n){if(angular.isUndefined(n.parent))t(a,n.label)||a.push(r(n,[]));else{const i=e(a,n.parent);angular.isUndefined(i)||t(i.children,n.label)||i.children.push(r(n,n.children?n.children:[]))}},this.$get=function(){a.sort(n);for(let e=0;e<a.length;e++){a[e].children.sort(n)}return a},this.setProductInfo=function(e){i=e},this.getProductInfo=function(){return i}})).factory("ModalService",r).factory("ClassInstanceDetailsService",i),r.$inject=["$modal","$timeout","$sce"],i.$inject=["$http"]},function(e,t){function n(e,t){return{get:function(t){return e.get(t)},set:function(t,n){e.set(t,n)},keys:n,remove:r,clearAll:function(){e.clearAll()},clearClassHieararchyState:function(){n().forEach((function(e){0!==e.indexOf("classHierarchy-")||e===t.CLASS_HIERARCHY_HIDE_PREFIXES||e.startsWith("classHierarchy-selectedGraph-")||r(e)}))}};function n(){return e.keys()}function r(t){e.remove(t)}}angular.module("graphdb.framework.utils.localstorageadapter",[]).factory("LocalStorageAdapter",n).value("LSKeys",{TABS_STATE:"tabs-state",TABS_STATE_CURRENT_ID:"tabs-state-currentid",TABS_STATE_MAXID:"tabs-state-maxid",VIEW_MODE:"viewMode",CLASS_HIERARCHY_HIDE_PREFIXES:"classHierarchy-hidePrefixes",CLASS_HIERARCHY_CURRENT_SLIDER_VALUE:"classHierarchy-currentSliderValue",CLASS_HIERARCHY_SWITCH_PREFIXES:"classHierarchy-switchPrefixes",CLASS_HIERARCHY_LAST_SELECTED_CLASS:"classHierarchy-lastSelectedClass",DOMAIN_RANGE_WENT_BACK:"domainRange-wentBack",DOMAIN_RANGE_COLLAPSE_EDGES:"domainRange-collapseEdges",HIDE_SIMILARITY_HELP:"hide-similarity-help",TUTORIAL_STATE:"tutorial-state",MENU_STATE:"menu-state",HIDE_GRAPH_CONFIG_HELP:"hide-graph-config-help",GRAPHS_VIZ:"graphs-viz",AUTOCOMPLETE_ENABLED:"autocomplete.enabled",RDF_SEARCH_TYPE:"rdf-search.search-type",RDF_SEARCH_INPUT:"rdf-search.search-input",RDF_SEARCH_EXPANDED_URI:"rdf-search.search-expanded-uri",RDF_RESOURCE_DESCRIPTION:"rdf-search.resource-description",PREFERRED_LANG:"preferred-language",WORKBENCH_SETTINGS:"workbench-settings"}),n.$inject=["localStorageService","LSKeys"]},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){angular.module("graphdb.framework.rest.license.service",["ngFileUpload"]).factory("LicenseRestService",i),i.$inject=["$http","Upload"];const n="rest/graphdb-settings/license",r="rest/info/license/";function i(e,t){return{getLicenseInfo:function(){return e.get(n)},getHardcodedLicense:function(){return e.get(`${n}/hardcoded`)},sendLicenseToValidate:function(t){return e.post(`${r}validate`,t,{headers:{Accept:"application/json","Content-Type":"text/plain"}})},extractFromLicenseFile:function(e){return t.upload({url:`${r}to-base-64`,file:e,headers:{Accept:"text/plain"}})},checkLicenseHardcoded:function(){return e.get(`${n}/hardcoded`)},registerLicense:function(t){const r=new Uint8Array(t.length);for(let e=0;e<r.length;e++)r[e]=t.charCodeAt(e);return e({method:"POST",url:n,headers:{"Content-Type":"application/octet-stream"},data:r,transformRequest:[]})},unregisterLicense:function(){return e({method:"DELETE",url:"rest/graphdb-settings/license"})},getInfo:function(){return e.get("rest/info/properties")},getVersion:function(t){return e.get("rest/info/version",{headers:{"X-GraphDB-Repository-Location":t}})},getStatistics:function(){return e.get("rest/graphdb-settings/statistics")},toggleStatistics:function(t){return e({method:"POST",url:"rest/graphdb-settings/statistics",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:`enabled=${t}`})}}}},function(e,t){angular.module("graphdb.framework.rest.repositories.service",[]).factory("RepositoriesRestService",r),r.$inject=["$http"];const n="rest/repositories";function r(e){return{getRepositories:function(t){return e.get(`${n}/all`,{params:{location:t}})},getRepository:function(t){return e.get(`${n}/${t.id}`,{params:{location:t.location}})},deleteRepository:function(t){return e.delete(`${n}/${t.id}`,{params:{location:t.location}})},createRepository:function(t){return e.post(n,t)},editRepository:function(t,r){return e.put(`${n}/${t}`,r)},getRepositoryConfiguration:function(t){return e.get(`${n}/default-config/${t}`)},getSize:function(t){return e.get(`${n}/${t.id}/size`,{params:{location:t.location}})},getPrefix:function(t,r){return e.post(`${n}/${t}/prefix`,null,{params:r})},getCluster:function(){return e.get(`${n}/cluster`)},getRepositoryFileContent:function(t){return e.get(`${n}/file`,{params:{fileLocation:t}})},updateRepositoryFileContent:function(t,r,i){return e.post(`${n}/file/update`,JSON.stringify(r),{params:{fileLocation:t,location:i}})},validateOntopPropertiesConnection:function(t){return e.post(`${n}/ontop/test-connection`,t.params.propertiesFile,{params:{location:t.location}})},restartRepository:function(t){return e.post(`${n}/${t.id}/restart`,null,{params:{location:t.location}})},getSupportedDriversData:function(t){return e.get(`${n}/ontop/drivers`,{params:{location:t.location}})},updatePropertiesFile:function(t,r,i){return e.post(`${n}/ontop/jdbc-properties`,JSON.stringify(r),{params:{fileLocation:t,location:i}})},loadPropertiesFile:function(t,r){return e.get(`${n}/ontop/jdbc-properties`,{params:{fileLocation:t,location:r}})},getRepositoriesFromKnownLocation:function(t){return e.get(`${n}?location=${t}`)}}}},function(e,t,n){"use strict";n.r(t);n(3),n(7),n(24),n(6),n(30),n(31);angular.module("graphdb.framework.core.services.repositories",["ngCookies","graphdb.framework.rest.repositories.service","graphdb.framework.rest.locations.service","graphdb.framework.rest.license.service","toastr"]).service("$repositories",["$http","toastr","$rootScope","$timeout","$location","productInfo","$jwtAuth","RepositoriesRestService","LocationsRestService","LicenseRestService","$translate","$q",function(e,t,n,r,i,a,s,o,u,c,l,h){this.repositoryStorageName="com.ontotext.graphdb.repository",this.repositoryStorageLocationName="com.ontotext.graphdb.repository.location",this.location={uri:"",label:"Local",local:!0},this.locationError="",this.loading=!0,this.repository={id:localStorage.getItem(this.repositoryStorageName)||"",location:localStorage.getItem(this.repositoryStorageLocationName)||""},this.locations=[this.location],this.repositories=new Map,this.locationsShouldReload=!0;const f=this,p=function(e,n){f.loading=!1,e&&(f.location={},f.locationError=n,f.repositories=new Map,f.setRepository(""),e.statusText?t.error(e.statusText,l.instant("repositories.service.error.loading.location")):t.error(l.instant("repositories.service.error.loading.location")))};let d;this.resetActiveRepository=function(){let e=f.repositories.get(this.repository.location),t=!1;e&&(t=e.find(e=>this.repository&&e.id===this.repository.id)),t?s.canReadRepo(this.repository)?n.$broadcast("repositoryIsSet",{newRepo:!1}):this.setRepository(""):this.setRepository(this.location.defaultRepository?{id:this.location.defaultRepository,location:this.location.uri}:"")},this.checkLocationsDegraded=function(e){this.locations.forEach(t=>{t.local||(t.errorMsg&&f.repositories.delete(t.uri)&&f.resetActiveRepository(),c.getVersion(t.uri).success((function(e){"object"==typeof e?e.productVersion!==a.productVersion&&(t.degradedReason=l.instant("repositories.service.different.gdb.version",{location:t.name})):t.degradedReason=l.instant("repositories.service.different.gdb.version",{location:t.name})})).error((function(n){t.errorMsg=n,e||(f.locationsShouldReload=!0)})))})},this.getDegradedReason=function(){let e=this.locations.find(e=>e.uri===this.repository.location);return e?e.degradedReason:""},this.clearLocationErrorMsg=function(e){let t=this.locations.find(t=>t.uri===e);t&&t.errorMsg&&(t.errorMsg=null)},this.initQuick=function(){this.hasActiveLocation()&&this.init(null,null,!0)},this.init=function(e,t,r){return this.loading=!0,r||(this.locationsShouldReload=!0),u.getActiveLocation().then((function(i){if(i.data){const a=i.data;if(a.active)return o.getRepositories().then((function(t){f.location=a,Object.entries(t.data).forEach(([e,t])=>{f.clearLocationErrorMsg(e),f.repositories.set(e,t)}),f.resetActiveRepository(),p(),f.checkLocationsDegraded(r),n.globalLocation=f.location,n.globalRepositories=f.getRepositories(),e&&e()})).catch((function(e){p(e),t&&t()}))}else p(),r&&(f.locationsShouldReload=!0),f.location="",f.repositories=new Map,f.setRepository("");n.globalLocation=f.location,n.globalRepositories=f.getRepositories()})).catch((function(e){p(e),t&&t()}))},this.getLocations=function(e){if(this.locationsShouldReload||d)return d||(this.locationsShouldReload=!1,this.locations=[this.location],d=u.getLocations(e).then(e=>(f.locations=e.data,this.locations)).catch((function(){r((function(){f.locationsShouldReload=!0}),2e3)})).finally(()=>{d=null})),d;const t=h.defer();return t.resolve(this.locations),t.promise},this.getActiveLocation=function(){return this.location},this.hasActiveLocation=function(){return!_.isEmpty(this.location)},this.getLocationError=function(){return this.locationError?this.locationError:l.instant("repositories.service.no.active.location")},this.isLoadingLocation=function(){return this.loading},this.getRepositories=function(){let e=[];return this.repositories.forEach(t=>e.push.apply(e,t)),e},this.getReadableRepositories=function(){return _.filter(this.getRepositories(),(function(e){return s.canReadRepo(e)}))},this.getWritableRepositories=function(){const e=this;return _.filter(this.getRepositories(),(function(t){return s.canWriteRepo(t)&&!e.isActiveRepoOntopType(t)}))},this.getActiveRepository=function(){return this.repository.id},this.getActiveRepositoryObject=function(){const e=this;let t=e.repositories.get(e.repository.location);return t?t.find(t=>t.id===e.repository.id):null},this.isSystemRepository=function(){return"SYSTEM"===this.repository.id},this.isActiveRepoOntopType=function(e){const t=this;let n;return e||(e=t.getActiveRepositoryObject()),e&&(n=t.repositories.get(e.location).find(t=>t.id===e.id),n)?"graphdb:OntopRepository"===n.sesameType:void 0===n},this.isActiveRepoFedXType=function(){const e=this;let t,n=e.getActiveRepositoryObject();return n&&(t=e.repositories.get(n.location).find(e=>e.id===n.id),t)?"graphdb:FedXRepository"===t.sesameType:void 0===t},this.getLocationFromUri=function(e){return this.locations.find(t=>t.uri===e)},this.setRepositoryHeaders=function(){e.defaults.headers.common["X-GraphDB-Repository"]=this.repository?this.repository.id:void 0,$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers["X-GraphDB-Repository"]=this.repository?this.repository.id:void 0,e.defaults.headers.common["X-GraphDB-Repository-Location"]=this.repository?this.repository.location:void 0,$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers["X-GraphDB-Repository-Location"]=this.repository?this.repository.location:void 0},f.setRepositoryHeaders(),this.setRepository=function(e){this.repository=e,e?(localStorage.setItem(f.repositoryStorageName,this.repository.id),localStorage.setItem(f.repositoryStorageLocationName,this.repository.location)):(localStorage.removeItem(f.repositoryStorageName),localStorage.removeItem(f.repositoryStorageLocationName)),f.setRepositoryHeaders(),n.$broadcast("repositoryIsSet",{newRepo:!0}),e&&!s.canReadRepo(e)&&this.setRepository(""),n.deniedPermissions={}},this.getDefaultRepository=function(){return this.hasActiveLocation()?this.location.defaultRepository:""},this.setDefaultRepository=function(e){if(!this.hasActiveLocation())return void t.error(l.instant("repositories.service.no.active.location"),l.instant("common.error"));const n=this;u.setDefaultRepository(e).success((function(){n.location.defaultRepository=e})).error((function(e){const n=getError(e);t.error(n,l.instant("common.error"))}))},this.deleteLocation=function(e){return u.deleteLocation(encodeURIComponent(e)).success((function(){let t=f.getActiveRepositoryObject();t&&t.location===e&&(f.location="",f.setRepository("")),f.init()})).error((function(e){const n=getError(e);t.error(n,l.instant("common.error"))}))},this.deleteRepository=function(e){return o.deleteRepository(e).success((function(){f.init()})).error((function(e){const n=getError(e);t.error(n,l.instant("common.error"))})).finally(()=>{const t=f.getActiveRepositoryObject();t&&t.id===e.id&&t.location===e.location&&f.setRepository("")})},this.restartRepository=function(e){return o.restartRepository(e).success((function(){t.success(l.instant("repositories.service.restarting.repo",{repositoryId:e.id})),f.initQuick()})).error((function(e){const n=getError(e);t.error(n,l.instant("common.error"))}))},this.getRepositoryTurtleConfig=function(t){return e.get("rest/repositories/"+t.id,{headers:{Accept:"text/turtle"}})},this.isRepoActive=function(e){return!!this.repository&&(e.id===this.repository.id&&e.location===this.repository.location)},this.getRepositoriesFromLocation=function(e){return this.repositories.get(e)},n.$on("securityInit",(function(e,t,n,r){(!t||n||r)&&f.init()}))}])},function(e,t,n){"use strict";n.r(t);n(4);var r=n(0);function i(){return{template:function(e,t){return'<object width="'+t.size+'" height="'+t.size+'" data="js/angular/templates/loader/ot-loader.svg?v=2.0.0">{{\'common.loading\' | translate}}</object>'}}}function a(){return{template:function(e,t){return'<object width="'+t.size+'" height="'+t.size+'" data="js/angular/templates/loader/ot-loader.svg?v=2.0.0"></object><div>{{\'common.loading\' | translate}}<div>'}}}function s(e){const t=function(e,n){n.timer=void 0,n.currentMessage=n.getMessage();const r=n.timeout[n.index%n.timeout.length];r&&(n.timer=e((function(){(n.index+1<n.message.length||0===n.message.length)&&(n.index++,t(e,n))}),1e3*r))};return{restrict:"EA",scope:{size:"@",trigger:"@",messageAttr:"=*message",timeoutAttr:"=*timeout",ngShow:"=",ngHide:"="},link:function(n){n.message=n.messageAttr,n.getMessage=function(){return n.message[n.index]},void 0===n.message?n.message=[""]:"function"==typeof n.message?(n.getMessage=n.message,n.message=[]):"object"!=typeof n.message&&(n.message=[n.message]),n.timeout=n.timeoutAttr,void 0===n.timeout?n.timeout=[0]:"object"!=typeof n.timeout&&(n.timeout=[n.timeout]),n.index=0,t(e,n);const r=function(r){n.timer&&e.cancel(n.timer),r&&(n.index=0,t(e,n))};n.$watch("ngShow",(function(e){r(e)})),n.$watch("ngHide",(function(e){r(!e)})),n.$on("$destroy",(function(){n.timer&&e.cancel(n.timer)}))},template:'<div class="ot-loader-new-content"><img width="{{size}}" height="{{size}}" src="js/angular/templates/loader/ot-loader.svg?v=2.0.0"/><div style="font-size: {{size/4}}px">{{currentMessage}}<div></div>'}}function o(e){return{restrict:"EA",transclude:!0,templateUrl:"js/angular/core/templates/core-errors.html",link:function(t,n,r){let i;t.setAttrs(r),t.setRestricted(),t.showRemoteLocations=!1,t.toggleShowRemoteLocations=()=>{t.showRemoteLocations=!t.showRemoteLocations},t.getAccessibleRepositories=function(){let e=e=>!0;return t.showRemoteLocations||(e=e=>e.local),t.isRestricted?t.getWritableRepositories().filter(e):t.getReadableRepositories().filter(e)},t.showPopoverForRepo=function(n,r){t.hidePopoverForRepo(),t.setPopoverRepo(r),e((function(){const e=$(n.toElement).find(".popover-anchor")[0];i=e,e&&!t.getActiveRepository()&&e.dispatchEvent(new Event("show"))})),n.stopPropagation()},t.hidePopoverForRepo=function(t){if(t){let e=t.relatedTarget;for(;e;){if(0===e.className.indexOf("popover"))return;e=e.parentElement}}i&&e((function(){i&&(i.dispatchEvent(new Event("hide")),i=null)})),t&&t.stopPropagation()}}}}function u(){return function(e,t){$(t).click((function(e){e.preventDefault(),e.stopPropagation()}))}}function c(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){e.multiRequired||(e.multiRequired=[]);const i=n.multiRequireElement,a=function(t){i&&i%1==0&&(e.multiRequired[i-1]=t)},s=function(){let t=!1,n=!1;for(let r=0;r<e.multiRequired.length;r++)e.multiRequired[r]?t=!0:n=!0;r.$setValidity("multiRequire",!(t&&n))};r.$parsers.unshift((function(e){return a(e),s(),e})),r.$formatters.unshift((function(e){return a(e),s(),e})),$("[multi-required]").on("blur keyup change focusout",(function(){s()}))}}}angular.module("graphdb.framework.core.directives",["graphdb.framework.core.services.repositories","graphdb.framework.utils.localstorageadapter"]).directive("ontoLoader",i).directive("ontoLoaderFancy",a).directive("ontoLoaderNew",s).directive("coreErrors",o).directive("eatClick",u).directive("multiRequired",c).directive("searchResourceInput",h).directive("keyboardShortcuts",f).directive("inactivePluginDirective",p),i.$inject=[],a.$inject=[],s.$inject=["$timeout"],o.$inject=["$timeout"],u.$inject=[],c.$inject=[];const l={table:"table",visual:"visual"};function h(e,t,n,i,a,s,o,u,c,h,f){return{restrict:"EA",scope:{namespacespromise:"=",autocompletepromisestatus:"=",textButton:"@",visualButton:"@",textCallback:"&",visualCallback:"&",placeholder:"@",uriValidation:"@",preserveInput:"@",empty:"=",clear:"=?clear",openInNewTab:"@",preserveSearch:"@",radioButtons:"@",clearInputIcon:"@"},templateUrl:"js/angular/core/templates/search-resource-input.html",link:function(p,d,g){d.autoCompleteStatus=void 0,d.autoCompleteWarning=!1,p.empty=!1,p.clear=!1,p.searchDisplayType=l;const m="true"===p.preserveSearch,v=d.find(".view-res-input");let y,b;p.textButtonLabel=p.textButton||"query.editor.table.btn",p.visualButtonLabel=p.visualButton||"query.editor.visual.btn",p.showClearInputIcon=!1,p.searchType=u.get(c.RDF_SEARCH_TYPE)||l.table,p.searchInput="",p.changeSearchType=function(e){p.searchType=e,u.set(c.RDF_SEARCH_TYPE,p.searchType)},p.$on("addStartFixedNodeAutomatically",(function(e,t){p.searchInput||!t.startIRI?p.checkIfValidAndSearchText():p.visualCallback({uri:t.startIRI,label:""})})),p.clearInput=function(){p.searchInput="",p.selectedElementIndex=-1,p.autoCompleteUriResults=[],p.showClearInputIcon=!1,u.remove(c.RDF_SEARCH_INPUT),u.remove(c.RDF_SEARCH_EXPANDED_URI),u.remove(c.RDF_RESOURCE_DESCRIPTION)},p.$watch("namespacespromise",(function(){angular.isDefined(p.namespacespromise)&&p.namespacespromise.success((function(e){d.namespaces=e.results.bindings.map((function(e){return{prefix:e.prefix.value,uri:e.namespace.value}}))})).error((function(e){const n=getError(e);t.error(n,f.instant("error.getting.namespaces.for.repo"))}))})),p.$watch("autocompletepromisestatus",(function(){!h.isActiveRepoFedXType()&&angular.isDefined(p.autocompletepromisestatus)&&p.autocompletepromisestatus.success((function(e){d.autoCompleteStatus=!!e,""!==p.searchInput&&p.onChange()})).error((function(){t.error(f.instant("explore.error.autocomplete"))}))})),p.$watch("empty",(function(){m||(p.searchInput="",p.empty=!1)})),p.$watch("clear",(function(){p.clear&&(p.clearInput(),p.clear=!1)})),a.$on("$translateChangeSuccess",(function(){g.$attr.placeholder?p.placeholder=g.$attr.placeholder:p.placeholder=`${f.instant("search.resources.msg")}...`}));const w=function(t){const n=t.type||"uri";"true"===p.openInNewTab?S(!1,t):e.path("resource").search(n,t.uri)},x=function(t){const n=t.type||"uri";"true"===p.openInNewTab?S(!0,t):e.path("graphs-visualizations").search(n,t.uri)},S=function(e,t){const n=e?"graphs-visualizations":"resource";window.open(`${n}?uri=${encodeURIComponent(t.uri)}`)};angular.isUndefined(g.$attr.textCallback)&&(p.textCallback=w),angular.isUndefined(g.$attr.visualCallback)&&(p.visualCallback=x),g.$attr.textButton&&!p.textButton?p.textCallback=p.visualCallback:g.$attr.visualButton&&!p.visualButton&&(p.visualCallback=p.textCallback),g.$attr.placeholder?p.placeholder=g.$attr.placeholder:p.placeholder=`${f.instant("search.resources.msg")}...`,angular.isDefined(g.$attr.uriValidation)?p.uriValidation=g.$attr.uriValidation:p.uriValidation="true",angular.isDefined(g.$attr.preserveInput)&&(p.preserveInput=g.$attr.preserveInput),p.getResultItemHtml=function(e){return o.trustAsHtml(e.description)},p.searchRdfResource=function(e,t){if("prefix"===e.type)p.searchInput=D(e.value+":"),v.focus(),p.onChange();else{let n;n=angular.isUndefined(e)?p.searchInput:"object"==typeof e?e.value:e;let r="";if(e.description){const t=e.description.indexOf("<"+n+">");t>0&&(r=e.description.substring(0,t).replace(/<\/?b>/g,""))}t({uri:n,description:e.description,label:r,type:e.type}),m?(p.selectedElementIndex=p.activeSearchElm,u.set(c.RDF_SEARCH_EXPANDED_URI,y),u.set(c.RDF_SEARCH_INPUT,p.searchInput),u.set(c.RDF_RESOURCE_DESCRIPTION,e.description)):"true"===p.preserveInput?(p.searchInput=n,p.autoCompleteUriResults=[]):(p.searchInput="",p.autoCompleteUriResults=[])}},p.searchRdfResourceByEvent=function(e,t){p.searchType===l.visual||t.ctrlKey||t.metaKey?p.searchRdfResource(e,p.visualCallback):p.searchRdfResource(e,p.textCallback)};const E=function(e){const n=p.searchInput;""!==n?"false"!==p.uriValidation?d.autoCompleteStatus&&p.autoCompleteUriResults&&p.autoCompleteUriResults.length>0?"prefix"===p.autoCompleteUriResults[p.activeSearchElm].type?(p.searchInput=D(p.autoCompleteUriResults[p.activeSearchElm].value+":"),p.autoCompleteUriResults=[]):p.searchRdfResource(p.autoCompleteUriResults[p.activeSearchElm],e):A(n)?p.searchRdfResource(n,e):t.error(f.instant("invalid.uri.msg")):p.searchRdfResource(n,e):t.error(f.instant("fill.input.field.msg"))};function F(){let e=-1;const n=u.get(c.RDF_RESOURCE_DESCRIPTION);n&&p.autoCompleteUriResults&&(e=p.autoCompleteUriResults.findIndex(e=>e.description===n),p.selectedElementIndex=e,new Promise(e=>{const t=document.getElementById("auto-complete-results-wrapper").getBoundingClientRect();setTimeout(()=>{e(t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth))})}).then((function(){!function(){const e=$("#auto-complete-results-wrapper"),t=$("#auto_"+p.selectedElementIndex);e.animate({scrollTop:t.offset().top-e.offset().top+e.scrollTop()})}()})).catch((function(e){t.error(getError(e),f.instant("no.prev.search.element"))}))),p.activeSearchElm=-1===e?0:e}function A(e){const t=e.indexOf("<")>=0&&e.indexOf(">")>=0,n=-1===e.indexOf("<")&&-1===e.lastIndexOf(">"),r=/^<?(http|urn).*>?/.test(e)&&(t||n);let i=!1;if(r)if(e.indexOf("http")>=0){const t=e.indexOf("//");i=t>4&&e.substring(t+2).length>0}else e.indexOf("urn")>=0&&(i=e.substring(4).length>0);return r&&i}function D(e){if(!/^<?(http|urn).*>?/.test(e)){const t=e.split(":"),r=t[0],i=t[1];if(!angular.isUndefined(i)){const e=n.getNamespaceUriForPrefix(d.namespaces,r);if(y=e!==y?e:y,y)return v.val(y),y+i}}return e}p.checkIfValidAndSearchText=function(){E(p.textCallback)},p.checkIfValidAndSearchVisual=function(){E(p.visualCallback)},p.checkIfValidAndSearchEvent=function(e){p.searchType===l.visual||e.ctrlKey||e.metaKey?E(p.visualCallback):E(p.textCallback)},p.onChange=function(){return p.showClearInputIcon=p.clearInputIcon,m&&u.set(c.RDF_SEARCH_INPUT,p.searchInput),"false"!==p.uriValidation&&(p.searchInput=D(p.searchInput),d.autoCompleteStatus)?function(e){let t=e.replace(y,y+";");if(d.autoCompleteStatus)return";"===t.charAt(0)&&(t=t.slice(1)),t=function(e){let t=e;if(-1===t.indexOf(";")&&A(t)){t=t.replace(/<|>/g,"");const e=/[^/^#]*$/.exec(t)[0];return t.split(e)[0]+";"+e}return t}(t),b&&b.resolve(),b=s.defer(),i.getAutocompleteSuggestions(t,b.promise).then((function(e){b=null,p.autoCompleteUriResults=e.data.suggestions,p.activeSearchElm=0}));return Promise.resolve()}(p.searchInput):Promise.resolve()},p.onKeyDown=function(e){if(13===e.keyCode)e.preventDefault(),"false"!==p.uriValidation?d.autoCompleteStatus?p.checkIfValidAndSearchEvent(e):A(e.target.value)?p.searchRdfResourceByEvent(e.target.value,e):t.error(f.instant("invalid.uri.msg")):p.searchRdfResourceByEvent(e.target.value,e);else if(p.searchInput.length>0&&!d.autoCompleteWarning&&!d.autoCompleteStatus){d.autoCompleteWarning=!0;const e=Object(r.decodeHTML)(f.instant("explore.autocomplete.warning.msg"));t.warning("",`<div class="autocomplete-toast"><a href="autocomplete">${e}</a></div>`,{allowHtml:!0})}if(d.autoCompleteStatus&&!angular.isUndefined(p.autoCompleteUriResults)){if(40===e.keyCode&&p.activeSearchElm<p.autoCompleteUriResults.length-1&&(p.activeSearchElm++,p.searchInput=p.autoCompleteUriResults[p.activeSearchElm].value,function(){const e=$("#auto-complete-results-wrapper"),t=e.children("div"),n=e.children("div.active");void 0!==n[0]&&n[0].offsetTop-t.height()-6-e.scrollTop()>170&&e.scrollTop(n[0].offsetTop-t.height()-6-170)}()),38===e.keyCode&&p.activeSearchElm>0&&(e.preventDefault(),p.activeSearchElm--,p.searchInput=p.autoCompleteUriResults[p.activeSearchElm].value,function(){const e=$("#auto-complete-results-wrapper"),t=e.children("div"),n=e.children("div.active");void 0!==n[0]&&n[0].offsetTop-t.height()-40<=e.scrollTop()&&e.scrollTop(e.scrollTop()-34)}()),27===e.keyCode){if(m)return;p.searchInput="",p.autoCompleteUriResults=[]}p.searchInput||p.clearInput()}},p.$on("rdfResourceSearchExpanded",(function(){(m?(p.preserveInput="true",p.searchInput=u.get(c.RDF_SEARCH_INPUT)||"",y=u.get(c.RDF_SEARCH_EXPANDED_URI),p.onChange()):Promise.resolve()).then((function(){F()}))})),p.setActiveClassOnMouseMove=function(e){d.autoCompleteStatus&&(p.activeSearchElm=e)}}}}function f(e){return{restrict:"AE",link:function(t,n,r){function i(e){27===e.keyCode&&(t.toggleCheatSheet(),t.$apply())}t.getTemplateUrl=function(){return r.templateUrl},t.shortcutsVisible=!1,t.toggleCheatSheet=function(){t.shortcutsVisible=!t.shortcutsVisible,t.shortcutsVisible?e.on("keydown",i):e.off("keydown",i)}},template:'<ng-include src="getTemplateUrl()" />'}}function p(e,t,n,i,a,s){return{restrict:"E",transclude:!0,scope:{loadSaved:"&",setPluginActive:"&",pluginName:"@",humanReadablePluginName:"@"},templateUrl:"js/angular/core/templates/inactive-plugin-warning-page.html",link:function(o){function u(){if(a.isLicenseValid()&&i.getActiveRepository()&&!i.isActiveRepoOntopType()&&!i.isActiveRepoFedXType())return t.checkPluginIsActive(o.pluginName).done((function(e){o.pluginIsActive=e.indexOf("true")>0,o.setPluginActive({isPluginActive:o.pluginIsActive})})).fail((function(t){e.error(getError(t),s.instant("check.active.plugin.failure"))}))}o.pluginIsActive=!0,o.activatePlugin=function(){const i=Object(r.decodeHTML)(s.instant("activate.plugin.warning.msg",{humanReadablePluginName:o.humanReadablePluginName}));n.openSimpleModal({title:s.instant("activate.plugin.confirmation"),message:`<p>${i}</p>`,warning:!0}).result.then((function(){t.activatePlugin(o.pluginName).done((function(){o.pluginIsActive=!0,o.setPluginActive({isPluginActive:o.pluginIsActive}),o.loadSaved()})).fail((function(t){e.error(getError(t),s.instant("activate.plugin.failure"))}))}))};const c=o.$on("repositoryIsSet",(function(){u()}));window.addEventListener("beforeunload",(function e(){c(),window.removeEventListener("beforeunload",e)})),o.$on("checkIsActive",u),u()}}}h.$inject=["$location","toastr","ClassInstanceDetailsService","AutocompleteRestService","$rootScope","$q","$sce","LocalStorageAdapter","LSKeys","$repositories","$translate"],f.$inject=["$document"],p.$inject=["toastr","RDF4JRepositoriesRestService","ModalService","$repositories","$licenseService","$translate"]},function(e,t,n){"use strict";n.r(t);n(3),n(20),n(21);var r=n(1);angular.module("graphdb.framework.core.services.jwtauth",["toastr","graphdb.framework.rest.security.service","graphdb.framework.core.services.openIDService"]).service("$jwtAuth",["$http","toastr","$location","$rootScope","SecurityRestService","$openIDAuth","$translate","$q",function(e,t,n,i,a,s,o,u){const c=this;i.deniedPermissions={},i.setPermissionDenied=function(e){return!("/"===e||"/login"===e||!c.isAuthenticated())&&(i.deniedPermissions[e]=!0,!0)},i.hasPermission=function(){const e=n.path();return!i.deniedPermissions[e]},i.redirectToLogin=function(e,t){return c.authTokenIsType("Bearer")&&(e=!0),c.clearAuthenticationInternal(),0!==n.url().indexOf("/login")&&(i.returnToUrl=n.url()),n.path("/login"),t?n.search("noaccess"):e&&n.search("expired"),new Promise(e=>{setTimeout(()=>{e(!0)},100)})},i.hasExternalAuthUser=function(){return c.hasExternalAuthUser()},this.authStorageName="com.ontotext.graphdb.auth",this.securityEnabled=!0,this.freeAccess=!1,this.hasOverrideAuth=!1,this.externalAuthUser=!1,this.securityInitialized=!1;const l=this;let h;this.clearStorage=function(){localStorage.removeItem(l.authStorageName)},this.getAuthenticatedUserFromBackend=function(e,t){a.getAuthenticatedUser().success((function(e,t,n){l.auth&&l.auth.startsWith("GDB")?(l.externalAuthUser=!1,l.principal=e,i.$broadcast("securityInit",l.securityEnabled,!0,l.freeAccess)):l.openIDEnabled&&l.auth&&l.auth.startsWith("Bearer")?l.authenticate(e,l.auth):(l.externalAuthUser=!0,l.authenticate(e,""))})).error((function(){e||!l.freeAccess?i.redirectToLogin(!1,t):(l.securityInitialized=!0,l.hasExplicitAuthentication()||l.clearAuthentication())}))},this.initSecurity=function(){this.securityInitialized=!1,this.auth=localStorage.getItem(this.authStorageName),h=a.getSecurityConfig().then((function(e){if(l.securityEnabled=e.data.enabled,l.externalAuth=e.data.hasExternalAuth,l.authImplementation=e.data.authImplementation,l.openIDEnabled=e.data.openIdEnabled,l.passwordLoginEnabled=e.data.passwordLoginEnabled,l.securityEnabled){const t=e.data.freeAccess;l.freeAccess=t.enabled,l.freeAccess&&(l.freeAccessPrincipal={authorities:t.authorities,appSettings:t.appSettings}),l.openIDEnabled?(l.openIDConfig=e.data.methodSettings.openid,l.gdbUrl=n.absUrl().replace(n.url().substr(1),""),s.initOpenId(l.openIDConfig,l.gdbUrl,(function(e){l.auth=s.authHeaderGraphDB(),c.setAuthHeaders(),console.log("oidc: set id/access token as GraphDB auth"),l.getAuthenticatedUserFromBackend(!0,e)}),(function(){console.log("oidc: not logged or login error"),l.authTokenIsType("Bearer")?setTimeout(()=>{i.redirectToLogin(!0)},0):l.getAuthenticatedUserFromBackend()}))):l.getAuthenticatedUserFromBackend()}else{l.clearStorage();const t=e.data.overrideAuth;if(l.hasOverrideAuth=t.enabled,!l.hasOverrideAuth)return a.getAdminUser().then((function(e){l.principal={username:"admin",appSettings:e.data.appSettings,authorities:e.data.grantedAuthorities},i.$broadcast("securityInit",l.securityEnabled,!0,l.hasOverrideAuth)}));l.principal={username:"overrideauth",authorities:t.authorities,appSettings:t.appSettings},i.$broadcast("securityInit",l.securityEnabled,!0,l.hasOverrideAuth)}})).finally(()=>h=null)},this.initSecurity(),this.isSecurityEnabled=function(){return this.securityEnabled},this.hasExternalAuth=function(){return this.externalAuth},this.getAuthImplementation=function(){return this.authImplementation},this.isFreeAccessEnabled=function(){return this.freeAccess},this.isDefaultAuthEnabled=function(){return this.hasOverrideAuth&&this.principal&&"overrideauth"===this.principal.username},this.getAuthToken=function(){return this.auth},this.authTokenIsType=function(e){return this.auth&&this.auth.startsWith(e)},this.loginOpenID=function(){s.login(this.openIDConfig,this.gdbUrl)},this.toggleSecurity=function(e){e!==this.securityEnabled&&(this.securityEnabled=e,a.toggleSecurity(e).then((function(){t.success(o.instant("jwt.auth.security.status",{status:o.instant(e?"enabled.status":"disabled.status")})),l.clearStorage(),l.initSecurity()}),(function(e){t.error(e.data.error.message,o.instant("common.error"))})))},this.toggleFreeAccess=function(e,n,r,s){(e!==this.freeAccess||s)&&(this.freeAccess=e,this.freeAccessPrincipal=e?{authorities:n,appSettings:r}:void 0,a.setFreeAccess({enabled:e?"true":"false",authorities:n,appSettings:r}).then((function(){s?t.success(o.instant("jwt.auth.free.access.updated.msg")):t.success(o.instant("jwt.auth.free.access.status",{status:o.instant(e?"enabled.status":"disabled.status")}))}),(function(e){t.error(e.data.error.message,o.instant("common.error"))})),i.$broadcast("securityInit",this.securityEnabled,this.hasExplicitAuthentication(),this.freeAccess))},this.setAuthHeaders=function(){return new Promise(t=>{const n=this.auth?this.auth:void 0;e.defaults.headers.common.Authorization=n,e.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers.Authorization=n,$.ajaxSetup().headers["X-Requested-With"]="XMLHttpRequest",setTimeout(()=>{t(!0)})})},this.setAuthHeaders(),this.authenticate=function(e,t){return new Promise(n=>{l.clearStorage(),t&&(this.auth=t,localStorage.setItem(l.authStorageName,this.auth),this.externalAuthUser=!1),this.principal=e,i.deniedPermissions={},this.securityInitialized=!0,l.setAuthHeaders().then(()=>{i.$broadcast("securityInit",this.securityEnabled,l.hasExplicitAuthentication(),this.freeAccess)}),setTimeout(()=>{n(!0)})})},this.authenticateOpenID=function(e){this.clearStorage(),e&&(this.auth=e,localStorage.setItem(this.authStorageName,this.auth),this.externalAuthUser=!1)},this.hasExternalAuthUser=function(){return this.externalAuthUser},this.hasExplicitAuthentication=function(){return null!=this.auth||this.externalAuthUser},this.getPrincipal=function(){if(this.principal)return Promise.resolve(this.principal);const e=u.defer();return i.$on("securityInit",()=>{e.resolve(this.principal)}),e.promise},this.clearAuthenticationInternal=function(){s.softLogout(),this.auth=null,this.principal=this.freeAccessPrincipal,this.clearStorage(),this.setAuthHeaders()},this.clearAuthentication=function(){this.clearAuthenticationInternal(),i.$broadcast("securityInit",this.securityEnabled,!1,this.freeAccess)},this.isAuthenticated=function(){return!this.securityEnabled||this.hasExplicitAuthentication()},this.hasPermission=function(){},this.hasRole=function(e){if(void 0!==e&&(this.securityEnabled||this.hasOverrideAuth)){"string"==typeof e&&(e=[e]);const t=!_.isEmpty(this.principal);return!!t&&("IS_AUTHENTICATED_FULLY"===e[0]?t:_.intersection(e,this.principal.authorities).length>0)}return!0},this.isAdmin=function(){return this.hasRole(r.UserRole.ROLE_ADMIN)},this.checkForWrite=function(e,t){return"WRITE_REPO"===e?this.canWriteRepo(t):this.hasRole(e)},this.hasAdminRole=function(){return this.isAdmin()||this.hasRole(r.UserRole.ROLE_REPO_MANAGER)},this.canWriteRepo=function(e){return!!e&&(!this.securityEnabled&&!this.hasOverrideAuth||!_.isEmpty(this.principal)&&(!!this.hasAdminRole()||this.checkRights(e,"WRITE")))},this.canReadRepo=function(e){return!!e&&(!this.securityEnabled||!_.isEmpty(this.principal)&&(!!this.hasAdminRole()||this.checkRights(e,"READ")))},this.checkRights=function(e,t){if(e)for(let n=0;n<this.principal.authorities.length;n++){const r=this.principal.authorities[n],i=r.split("_",2),a=r.slice(i[0].length+i[1].length+2),s=e.location?`${e.id}@${e.location}`:e.id;if(i[0]===t&&(s===a||"SYSTEM"!==e.id&&"*"===a))return!0}return!1}}])},function(e,t){let n;angular.module("graphdb.framework.utils.uriutils",[]).factory("UriUtils",(function(){return{isValidIri:function(e){return void 0!==e&&!!e.match(n)},validateRdfUri:function(e){const t=e.indexOf("<")>=0&&e.indexOf(">")>=0,n=-1===e.indexOf("<")&&-1===e.lastIndexOf(">"),r=/^<?(http|urn).*>?/.test(e)&&(t||n);let i=!1;if(r)if(e.indexOf("http")>=0){const t=e.indexOf("//");i=t>4&&e.substring(t+2).length>0}else e.indexOf("urn")>=0&&(i=e.substring(4).length>0);return r&&i},shortenIri:function(e){const t=document.createElement("a");t.href=e;let n=t.hostname;return function(e){const t=e.split(".");for(let e=0,n=0;e<t.length;e++)if(parseInt(t[e],10)>=0&&parseInt(t[e],10)<=255?n++:n=0,4===n)return!0;return!1}(t.hostname)||(n=t.hostname.split(".")[0]),n+":"+t.port}}}));try{n=new RegExp("^[a-z](?:[-a-z0-9\\+\\.])*:(?:\\/\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:])*@)?(?:\\[(?:(?:(?:[0-9a-f]{1,4}:){6}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|::(?:[0-9a-f]{1,4}:){5}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4}:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+[-a-z0-9\\._~!\\$&'\\(\\)\\*\\+,;=:]+)\\]|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}|(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=@])*)(?::[0-9]*)?(?:\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))*)*|\\/(?:(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))+)(?:\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))*)*)?|(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))+)(?:\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))*)*|(?!(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@])))(?:\\?(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@])|[\\u{E000}-\\u{F8FF}\\u{F0000}-\\u{FFFFD}\\u{100000}-\\u{10FFFD}\\/\\?])*)?(?:#(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@])|[\\/\\?])*)?$","ui")}catch(e){n=new RegExp("^[a-z](?:[-a-z0-9\\+\\.])*:","i")}},function(e,t){angular.module("graphdb.framework.rest.monitoring.service",[]).factory("MonitoringRestService",i),i.$inject=["$http"];const n="rest/monitor",r=`${n}/query`;function i(e){return{monitorResources:function(){return e.get(`${n}/resource`)},monitorGC:function(){return e.post(`${n}/resource/gc`)},monitorQuery:function(){return e.get(r)},abortQueryByAlias:function(t){return e.delete(`${r}?queryAlias=${encodeURIComponent(t)}`)},deleteQuery:function(t){return e.delete(`${r}?queryId=${encodeURIComponent(t)}`)},getQueryCount:function(){return e({url:`${r}/count`,method:"GET",timeout:1e4})},checkAutocompleteStatus:function(){return e.get("rest/autocomplete/enabled")}}}},function(e,t){angular.module("graphdb.framework.rest.rdf4j.repositories.service",[]).factory("RDF4JRepositoriesRestService",a),a.$inject=["$http","$repositories","$translate"];const n="INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#startplugin> '{{pluginName}}' .}",r="select ?o where {\n?s <http://www.ontotext.com/owlim/system#listplugins> ?o .\nfilter(str(?s) = '{{pluginName}}')\n} ",i="repositories";function a(e,t,a){return{getNamespaces:function(t){return e.get(`${i}/${t}/namespaces`)},getRepositoryNamespaces:function(){return e.get(`${i}/${t.getActiveRepository()}/namespaces`)},updateNamespacePrefix:function(t,n,r){return e({url:`${i}/${t}/namespaces/${r}`,method:"PUT",data:n})},deleteNamespacePrefix:function(t,n){return e({url:`${i}/${t}/namespaces/${n}`,method:"DELETE"})},addStatements:function(t,n){return e({url:`${i}/${t}/statements`,method:"POST",data:n,headers:{"Content-Type":"application/x-www-form-urlencoded"}})},activatePlugin:function(e){return $.ajax({method:"POST",url:`${i}/${t.getActiveRepository()}/statements`,data:{update:n.replace("{{pluginName}}",e)}})},checkPluginIsActive:function(e){return $.ajax({method:"GET",url:`${i}/${t.getActiveRepository()}`,data:{query:r.replace("{{pluginName}}",e)}})},getRepositorySize:function(){return e.get(`${i}/${t.getActiveRepository()}/size`)},getGraphs:s,resolveGraphs:function(){const e=t.getActiveRepository();let n=[];if(e)return s(e).success((function(e){e.results.bindings.unshift({contextID:{type:"default",value:"import.default.graph"}}),Object.keys(e.results.bindings).forEach((function(t){const n=e.results.bindings[t];"bnode"===n.contextID.type?n.contextID.value=`_:${n.contextID.value}`:"default"===n.contextID.type?n.contextID.uri="http://www.openrdf.org/schema/sesame#nil":n.contextID.uri=n.contextID.value})),e.results.bindings.unshift(allGraphs),n=e.results.bindings}));return n}};function s(t){return e.get(`${i}/${t}/contexts`)}}},function(e,t){function n(e,t,n,r){e.title=n,e.message=r,e.ok=function(){t.close()},e.cancel=function(){t.dismiss("cancel")}}function r(e,t,n,r,i){e.clipboardURI=n,e.ok=function(){try{document.getElementById("clipboardURI").select(),document.execCommand("copy"),r.success(i.instant("modal.ctr.copy.url.success"))}catch(e){r.error(i.instant("modal.ctr.copy.not.supported.warning"))}t.close()},e.cancel=function(){t.dismiss("cancel")}}function i(e,t,n,r,i){e.query=n,e.cancel=function(){t.dismiss("cancel")},e.selectQuery=function(){e.selectElement($("#create-query"))},e.copyQueryToClipboard=function(){try{e.selectQuery(),document.execCommand("copy"),t.close(),r.success(i.instant("modal.ctr.copy.query.success"))}catch(e){r.error(i.instant("modal.ctr.copy.not.supported.warning"))}},e.selectElement=function(e){if(e.length>0)if(window.getSelection){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.selectNodeContents(e[0].firstChild),t.addRange(n)}else if(document.selection){const t=document.body.createTextRange();t.moveToElementText(e[0]),t.select()}}}angular.module("graphdb.framework.core.controllers",[]).controller("CopyToClipboardModalCtrl",r).controller("SimpleModalCtrl",n).controller("ViewQueryCtrl",i),n.$inject=["$scope","$modalInstance","title","message"],r.$inject=["$scope","$modalInstance","uri","toastr","$translate"],i.$inject=["$scope","$modalInstance","query","toastr","$translate"]},function(e,t){angular.module("graphdb.framework.rest.sparql.service",[]).factory("SparqlRestService",i),i.$inject=["$http"];const n="rest/sparql",r=`${n}/saved-queries`;function i(e){return{getSavedQueries:function(){return e.get(r)},getSavedQuery:function(t,n){let i="";null!=n&&(i=`&owner=${encodeURIComponent(n)}`);return e.get(`${r}?name=${encodeURIComponent(t)}${i}`)},addKnownPrefixes:function(t){return e.post(`${n}/add-known-prefixes`,t)},editSavedQuery:function(t){return e.put(r,t)},deleteSavedQuery:function(t){return e.delete(`${r}?name=${encodeURIComponent(t)}`)},addNewSavedQuery:function(t){return e.post(r,t)}}}},function(e,t){angular.module("graphdb.framework.rest.autocomplete.service",[]).factory("AutocompleteRestService",s);const n="rest/autocomplete/",r=`${n}labels`,i=`${n}enabled`,a=`${n}iris`;function s(e){return{checkAutocompleteStatus:function(){return e.get(i)},refreshIndexStatus:function(){return e.get(`${n}status`)},refreshLabelConfig:function(){return e.get(r)},addLabelConfig:function(t){return e.put(r,t)},removeLabelConfig:function(t){return e.delete(r,{data:t,headers:{"Content-Type":"application/json;charset=utf-8"}})},toggleAutocomplete:function(t){return e.post(`${i}?enabled=${t}`)},refreshIndexIRIs:function(){return e.get(a)},toggleIndexIRIs:function(t){return e.post(`${a}?enabled=${t}`)},buildIndex:function(){return e.post(`${n}reindex`)},interruptIndexing:function(){return e.post(`${n}interrupt`)},checkForPlugin:function(){return e.get(`${n}plugin-found`)},getAutocompleteSuggestions:function(t,r){return e.get(`${n}query`,{params:{q:t},timeout:r})}}}s.$inject=["$http"]},function(e,t){angular.module("graphdb.framework.rest.plugins.service",[]).factory("PluginsRestService",s);const n="repositories/",r="INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#stopplugin>",i="INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#startplugin>",a="select ?s ?o where { ?s <http://www.ontotext.com/owlim/system#listplugins> ?o .}";function s(e){return{togglePlugin:function(t,a,s){return a?e.post(`${n}${t}/statements`,void 0,{params:{update:`${r} "${s}".}`}}):e.post(`${n}${t}/statements`,void 0,{params:{update:`${i} "${s}".}`}})},getPlugins:function(t){return e.get(`${n}${t}`,{params:{query:a}})}}}s.$inject=["$http"]},function(e,t,n){"use strict";n.r(t);n(3);angular.module("graphdb.framework.core.interceptors.unauthorized",["ngCookies"]).factory("$unauthorizedInterceptor",["$q","$location","$rootScope","$translate",function(e,t,n,r){return{responseError:function(i){let a=!1;return 401===i.status?i.config.url.indexOf("rest/security/authenticated-user")<0&&!n.hasExternalAuthUser()&&(a=!0):403===i.status&&(n.setPermissionDenied(t.path())?console.log(r.instant("unauthorized.console.warning")):a=!0),a?Promise.resolve(n.redirectToLogin()).then(()=>e.reject(i)):e.reject(i)}}}])},,function(e,t,n){"use strict";n.r(t);var r=n(2);const i={headers:{"X-GraphDB-Repository-Location":void 0,"X-GraphDB-Repository":void 0,"X-Requested-With":void 0,Authorization:void 0}};angular.module("graphdb.framework.core.services.openIDService",["toastr"]).service("$openIDAuth",["$http","$location","$window","toastr","$translate",function(e,t,n,a,s){const o="com.ontotext.graphdb.openid.",u=this;function c(e){const t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(`${n}=${encodeURIComponent(e[n])}`);return t.join("&")}this.login=function(e,t){const r=u.generateRandomString(),i=e.authFlow;if("code"===i){u.setStorageItem("pkce_state",r);const i=u.generateRandomString();u.setStorageItem("pkce_code_verifier",i);const a=u.pkceChallengeFromVerifier(i);n.location.href=u.getLoginUrl(r,a,t,e)}else"code_no_pkce"===i?(u.removeStorageItem("pkce_code_verifier"),n.location.href=u.getLoginUrl(r,"",t,e)):"implicit"===i?(u.setStorageItem("nonce",r),n.location.href=u.getLoginUrl(r,"",t,e)):(console.log("oidc: unknown auth flow: "+i),a.error(s.instant("openid.auth.unknown.flow",{authFlow:i})))},this.getLoginUrl=function(e,t,n,r){const i=[];let a="";switch(r.authFlow){case"code":a="code",i.push("state="+encodeURIComponent(e)),i.push("code_challenge="+encodeURIComponent(t)),i.push("code_challenge_method=S256");break;case"code_no_pkce":a="code";break;case"implicit":a="token id_token",i.push("nonce="+encodeURIComponent(e));break;default:throw new Error(s.instant("openid.auth.unknown.flow",{authFlow:r.authFlow}))}return i.unshift(`response_type=${encodeURIComponent(a)}`,`scope=${encodeURIComponent(u.getScope(r.extraScopes))}`,`client_id=${encodeURIComponent(r.clientId)}`,`redirect_uri=${encodeURIComponent(n)}`),r.oracleDomain&&i.push(`domain=${encodeURIComponent(r.oracleDomain)}`),r.authorizeParameters&&i.push(r.authorizeParameters),`${r.oidcAuthorizationEndpoint}?${i.join("&")}`},this.withOpenIdKeys=function(t,n){e.get(t,i).success((function(e){u.openIdKeys={},e.keys.forEach((function(e){u.openIdKeys[e.kid]=e})),n()}))},this.initOpenId=function(e,t,r,o){u.clientId=e.clientId,u.tokenType=e.tokenType,u.idTokenAudience=e.clientId,u.idTokenIssuer=e.issuer,u.accessTokenAudience=e.tokenAudience,u.accessTokenIssuer=e.tokenIssuer,u.openIdTokenUrl=e.oidcTokenEndpoint;let c=e.oidcJwksUri;e.proxyOidc&&(c="rest/openid/jwks",u.openIdTokenUrl="rest/openid/token"),u.openIdEndSessionUrl=e.oidcEndSessionEndpoint,u.supportsOfflineAccess=e.oidcScopesSupported.includes("offline_access"),e.oracleDomain&&(i.headers["X-OAuth-Identity-Domain-Name"]=e.oracleDomain),u.withOpenIdKeys(c,(function(){if(u.isLoggedIn=u.hasValidIdToken(),u.isLoggedIn)u.setupTokensRefresh(!1,r,o);else if(u.hasValidRefreshToken())u.refreshTokens(r,o);else{const i=r;r=function(){u.isLoggedIn=!0,i(!0)},u.softLogout();const c=u.parseQueryString(n.location.search.substring(1));if(c.code)"code"===e.authFlow?u.getStorageItem("pkce_state")!==c.state?(a.error(s.instant("openid.auth.invalid.pkce.state")),console.log("oidc: PKCE state mismatch "+u.getStorageItem("pkce_state")+" != "+c.state),o()):u.retrieveTokensByCode(c.code,t,r,o):"code_no_pkce"===e.authFlow&&u.retrieveTokensByCode(c.code,t,r,o);else{const e=u.parseQueryString(n.location.pathname.substring(1));e.id_token?u.saveTokens(e,!0,!1,r):o()}}}))},this.authHeaderGraphDB=function(){return"id"===u.getStorageItem("token_type")?"Bearer "+u.getToken("id"):"Bearer "+u.getToken("access")},this.softLogout=function(){u.isLoggedIn=!1,u.setToken("id",null),u.setToken("access",null),u.setToken("refresh",null)},this.hardLogout=function(e){u.softLogout(),u.openIdEndSessionUrl&&(n.location.href=`${u.openIdEndSessionUrl}?client_id=${encodeURIComponent(u.clientId)}&post_logout_redirect_uri=${encodeURIComponent(e)}`)},this.getToken=function(e){return u.getStorageItem(e+"_token")},this.setToken=function(e,t){t?u.setStorageItem(e+"_token",t):u.removeStorageItem(e+"_token")},this.tokenHeader=function(e){const t=u.getToken(e);if(t){try{const e=r.KJUR.jws.JWS.readSafeJSONString(Object(r.b64utoutf8)(t.split(".")[0]));if(e)return e}catch(e){}return{error:s.instant("openid.auth.not.jwt.token",{token:t})}}return{}},this.verifyToken=function(e){const t=u.getToken(e),n=u.tokenHeader(e);if(!n.kid)return"id"!==e?n.error?(console.log(`oidc: token ${e} is not a JWT token (token considered valid)`),!0):(console.log(`oidc: invalid token ${e} (token is empty)`),!1):(console.log("oidc: invalid token id (not a JWT token)"),!1);const i=u.openIdKeys[n.kid];if(!i)return console.log("oidc: no key to verify JWT token (token considered invalid)"),!1;const a=r.KEYUTIL.getKey(i),s={alg:[n.alg],iss:[u.idTokenIssuer]};return"id"===e?(s.aud=[u.idTokenAudience,u.idTokenIssuer],s.nonce=[u.getStorageItem("nonce")]):"access"===e&&(s.aud=[u.accessTokenAudience],s.iss=[u.accessTokenIssuer]),r.KJUR.jws.JWS.verifyJWT(t,a,s)},this.hasValidIdToken=function(){return u.getToken("id")?u.verifyToken("id")?(console.log("oidc: valid id token found"),!0):(console.log("oidc: stale id token"),!1):(console.log("oidc: no id token"),!1)},this.tokenPayload=function(e){const t=u.getToken(e);if(t){try{const e=r.KJUR.jws.JWS.readSafeJSONString(Object(r.b64utoutf8)(t.split(".")[1]));if(e)return e}catch(e){}return{error:s.instant("openid.auth.not.jwt.token",{token:t})}}return{}},this.saveTokens=function(e,n,r,i){(n||e.refresh_token)&&u.setToken("refresh",e.refresh_token),u.setToken("access",e.access_token),u.setToken("id",e.id_token),u.setStorageItem("token_type",u.tokenType),console.log("oidc: saved tokens"),u.setupTokensRefresh(n||r,i),u.removeStorageItem("pkce_state"),u.removeStorageItem("pkce_code_verifier"),n&&t.url("/")},this.retrieveTokensByCode=function(t,n,r,o){const l={grant_type:"authorization_code",client_id:u.clientId,redirect_uri:n,code:t},h=u.getStorageItem("pkce_code_verifier");h&&(l.code_verifier=h);const f={...i.headers,"Content-type":"application/x-www-form-urlencoded; charset=utf-8"};e({method:"POST",url:u.openIdTokenUrl,headers:f,transformRequest:c,data:l}).success((function(e){u.saveTokens(e,!0,!1,r)})).error((function(e){a.error(s.instant("openid.auth.cannot.retrieve.token.msg",{error:getError(e)})),o()}))},this.refreshTokens=function(t,n){if(u.hasValidRefreshToken()){const r={grant_type:"refresh_token",client_id:u.clientId,refresh_token:u.getToken("refresh")},o={...i.headers,"Content-type":"application/x-www-form-urlencoded; charset=utf-8"};e({method:"POST",url:u.openIdTokenUrl,headers:o,transformRequest:c,data:r}).success((function(e){console.log("oidc: refreshed tokens"),u.saveTokens(e,!1,!0,t),u.isLoggedIn=!0})).error((function(e){console.log("oidc: could not refresh tokens"),a.error(s.instant("openid.auth.cannot.refresh.token.msg",{error:getError(e)})),n&&n()}))}else console.log("oidc: refresh requested without a valid refresh token")},this.hasValidRefreshToken=function(){const e=u.tokenPayload("refresh");return!(e.nbf&&1e3*e.nbf-Date.now()>5e3)&&(!(e.exp&&Date.now()-1e3*e.exp>5e3)&&!(!e.iat&&!e.error))},this.setupTokensRefresh=function(e,t,n){if(u.hasValidRefreshToken()){clearTimeout(u.previousTimer);const r=u.tokenPayload("id");if(r.exp>0){const i=1e3*r.exp-Date.now()-6e4;if(!(e||i>1e3))return u.previousTimer=null,console.log("oidc: tokens will refresh now, "+i+"; "+e),void u.refreshTokens(t,n);u.previousTimer=setTimeout((function(){u.refreshTokens(t)}),i),console.log("oidc: tokens will refresh in "+i/1e3+" seconds at "+new Date(Date.now()+i))}}else console.log("oidc: no valid refresh token");t()},this.parseQueryString=function(e){const t={access_token:null,code:null,id_token:null,state:null};return""===e?t:(e.split("&").map((function(e){return e.split("=")})).forEach((function(e){t[e[0]]=decodeURIComponent(e[1])})),t)},this.generateRandomString=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(function(e){return("0"+e.toString(16)).substr(-2)})).join("")},this.pkceChallengeFromVerifier=function(e){const t=new r.KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return Object(r.hextob64u)(t.digestString(e))},this.getScope=function(e){let t="openid"+(u.supportsOfflineAccess?" offline_access":"");return e&&(t+=" "+e),console.log(`oidc: requesting scopes '${t}'`),t},this.setStorageItem=function(e,t){localStorage.setItem(o+e,t)},this.getStorageItem=function(e){return localStorage.getItem(o+e)},this.removeStorageItem=function(e){localStorage.removeItem(o+e)}}])},function(e,t){angular.module("graphdb.framework.rest.security.service",[]).factory("SecurityRestService",o),o.$inject=["$http"];const n="rest/security",r=`${n}/users`,i=`${n}/authenticated-user`,a=`${n}/free-access`,s="rest/roles";function o(e){return{getUser:function(n){return e.get(`${r}/${t(n)}`)},getAdminUser:function(){return e.get(`${r}/admin`)},getUsers:function(){return e.get(r)},createUser:function(n){return e({method:"POST",url:`${r}/${t(n.username)}`,data:{password:n.pass,appSettings:n.appSettings,grantedAuthorities:n.grantedAuthorities}})},updateUser:function(n){return e({method:"PUT",url:`${r}/${t(n.username)}`,data:{password:n.pass,appSettings:n.appSettings,grantedAuthorities:n.grantedAuthorities}})},updateUserData:function(n){return e({method:"PATCH",url:`${r}/${t(n.username)}`,data:{password:n.pass,appSettings:n.appSettings}})},deleteUser:function(n){return e.delete(`${r}/${t(n)}`)},getFreeAccess:function(){return e.get(a)},setFreeAccess:function(t){return e.post(a,t)},getSecurityConfig:function(){return e.get(`${n}/all`)},toggleSecurity:function(t){return e.post(n,t?"true":"false")},getRoles:function(){return e.get(s)},getRolesMapping:function(t){return e.get(`${s}/mapping`,{params:t})},getAuthenticatedUser:function(){return e.get(`${i}`)}};function t(e){return encodeURIComponent(e).replace(/[.!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16)}))}}},function(e,t){!function(e){e.getError=function(e,t,n){if(angular.isObject(e)&&e.status&&e.data)return getError(e.data,t,n);if(t&&403===t)return"Access is restricted";if(e){let r="Generic error";if(angular.isString(e))-1===e.indexOf("<html>")&&(r=e,r=r.replace(/^(([a-z0-9_]+\.)+[a-zA-Z0-9_]+: )+/,""));else if(angular.isObject(e)){if("message"in e&&(r=e.message),"error"in e&&(r=e.error.message),"responseJSON"in e&&"message"in e.responseJSON)return getError(e.responseJSON,t,n);"responseText"in e&&(r=e.responseText)}return n>0&&r.length>n&&(r=r.substr(0,n)+"..."),r}return"There is an error"}}(window)},function(e,t,n){"use strict";n.r(t);n(3),n(15),n(16),n(17),n(12),n(6),n(7),n(13),n(30),n(31),n(10),n(8),n(25);var r=n(1),i=(n(4),n(11),n(26),n(0));function a(e,t,n,r,i,a,s,o,u,c){function l(){e.getActiveRepository()&&(e.getNamespacesPromise=c.getNamespaces(e.getActiveRepository()).success((function(){h()})),e.getActiveRepositorySize())}function h(){a.isLicenseValid()&&(e.getAutocompletePromise=s.checkAutocompleteStatus())}e.doClear=!1,e.getActiveRepositorySize=function(){const t=r.getActiveRepositoryObject();t&&(e.activeRepositorySizeError=void 0,u.getSize(t).then((function(t){e.activeRepositorySize=t.data})).catch((function(t){e.activeRepositorySizeError=t.data.message})))},e.$on("autocompleteStatus",(function(){h()})),e.$on("repositoryIsSet",l),e.$on("$routeChangeSuccess",(function(e,n,r){r&&(i.isAuthenticated()||i.isFreeAccessEnabled()?l():t.redirectToLogin())})),e.onKeyDown=function(t){27===t.keyCode&&(e.doClear=!0)}}function s(e,t,n,a,s,o,u,c,l,h,f,p,d,g,m,v,y,b,w,x,S,E,F,A){e.descr=E.instant("main.gdb.description"),e.documentation="",e.menu=t,e.tutorialState=1!==x.get(S.TUTORIAL_STATE),e.userLoggedIn=!1,e.embedded=o.search().embedded,e.productInfo=h;function D(){$(window).width()<=720?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right"),$(".toggle-menu").hide()):$(window).width()>720&&"collapsedMenu"===x.get(S.MENU_STATE)?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right")):($(".container-fluid.main-container").removeClass("expanded"),$(".main-menu").removeClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left"))}!function(){const t=new Date;e.currentYear=t.getFullYear(),e.previousYear=2002}(),e.$on("$routeChangeSuccess",(function(t,n,r){e.clicked=!1,$(".menu-element-root").removeClass("active"),f((function(){$(".menu-element.open a.menu-element-root").addClass("active"),$(".main-menu.collapsed .menu-element.open .menu-element-root").addClass("active")}),400),r&&c.checkLicenseStatus()})),l.$on("$translateChangeSuccess",(function(){e.menu.forEach((function(e){e.label=E.instant(e.labelKey),e.children&&e.children.forEach((function(e){e.label=E.instant(e.labelKey)}))})),l.helpInfo=w.trustAsHtml(Object(i.decodeHTML)(E.instant(l.helpInfo))),l.title=Object(i.decodeHTML)(E.instant(l.title)),e.initTutorial()})),e.checkMenu=function(){return $(".main-menu").hasClass("collapsed")},e.copyToClipboard=function(e){p.openCopyToClipboardModal(e)},e.goToAddRepo=function(){o.path("/repository/create").search({previous:"home"})},e.goToEditRepo=function(e){o.path(`repository/edit/${e.id}`).search({previous:"home",location:e.location})},e.getLocationFromUri=function(e){return u.getLocationFromUri(e)},e.$on("$locationChangeSuccess",(function(){e.showFooter="/"===o.url()})),e.$on("repositoryIsSet",(function(){e.setRestricted(),x.clearClassHieararchyState()})),e.graphdbVersion=e.engineVersion=h.productVersion,e.workbenchVersion=h.Workbench,e.connectorsVersion=h.connectors,e.sesameVersion=h.sesame,e.select=function(t,n,r){$(".main-menu").hasClass("collapsed")?$(n.target).parents(".menu-element").children(".menu-element-root").hasClass("active")?(e.selected=t,e.clicked=!r):(!$(n.target).parents(".menu-element").hasClass("open")&&r?e.clicked=!0:e.clicked=!r,e.selected===t?e.selected=-1:e.selected=t):(!$(n.target).parents(".menu-element").hasClass("open")&&r?e.clicked=!0:e.clicked=!r,0!==$(n.target).parent(".menu-element").find(".sub-menu").length?($(n.target).parents(".menu-element").children(".menu-element-root").hasClass("active")?$(".sub-menu li.active").parents(".menu-element").children(".menu-element-root").removeClass("active"):$(".sub-menu li.active").parents(".menu-element").children(".menu-element-root").addClass("active"),e.selected===t?e.selected=-1:e.selected=t):(f((function(){$(n.target).parents(".menu-element").children(".menu-element-root").addClass("active")}),50),e.selected=t))},$("body").bind("click",(function(t){!$(t.target).parents(".main-menu").length&&$(".main-menu").hasClass("collapsed")&&(e.clicked=!1,e.selected=-1)})),e.isCurrentPath=function(e){return o.path()==="/"+e},e.isCurrentSubmenuChildPath=function(t){return 0!==t.children.length&&t.children.some((function(t){return e.isCurrentPath(t.href)}))},"/"===o.path()?e.selected=-1:(f((function(){const t=o.path().replace("/",""),n=$('a[href^="'+t+'"]');e.selected=n.closest(".menu-element").index()-1}),200),e.isCurrentPath(o.path())),e.popoverTemplate="js/angular/templates/repositorySize.html",e.securityEnabled=!0,e.isSecurityEnabled=function(){return n.isSecurityEnabled()},e.isFreeAccessEnabled=function(){return n.isFreeAccessEnabled()},e.hasExternalAuthUser=function(){return n.hasExternalAuthUser()},e.isDefaultAuthEnabled=function(){return n.isDefaultAuthEnabled()},e.isUserLoggedIn=function(){return e.userLoggedIn},e.hasActiveLocation=function(){return u.hasActiveLocation()},e.getActiveLocation=function(){return u.getActiveLocation()},e.isLoadingLocation=function(){return u.isLoadingLocation()},e.getRepositories=function(){return u.getRepositories()},e.getReadableRepositories=function(){return u.getReadableRepositories()},e.getWritableRepositories=function(){return u.getWritableRepositories()},e.getActiveRepository=function(){return u.getActiveRepository()},e.canWriteRepoInLocation=function(e){return n.canWriteRepo(e)},e.canWriteActiveRepo=function(e){const t=u.getActiveRepositoryObject();return!!t&&(n.canWriteRepo(t)&&("SYSTEM"!==t.id||!e))},e.getActiveRepositoryObject=function(){return u.getActiveRepositoryObject()},e.getActiveRepositoryShortLocation=function(){const e=u.getActiveRepositoryObject();if(e){const t=e.location;if(t)return"@"+F.shortenIri(t)}return""},e.isActiveRepoOntopType=function(){return u.isActiveRepoOntopType()},e.isActiveRepoFedXType=function(){return u.isActiveRepoFedXType()},e.isLicenseValid=function(){return c.isLicenseValid()},e.setAttrs=function(t){e.attrs=t},e.setRestricted=function(){e.attrs&&(e.isRestricted=e.attrs.hasOwnProperty("license")&&!c.isLicenseValid()||e.attrs.hasOwnProperty("write")&&e.isSecurityEnabled()&&!e.canWriteActiveRepo()||e.attrs.hasOwnProperty("ontop")&&e.isActiveRepoOntopType()||e.attrs.hasOwnProperty("fedx")&&e.isActiveRepoFedXType())},e.toHumanReadableType=function(e){switch(e){case"graphdb":return"Graphdb";case"system":return"System";case"ontop":return"Ontop";case"fedx":return"FedX";default:return"Unknown"}},e.setRepository=function(e){u.setRepository(e)},A.when(n.getPrincipal()).then(t=>{e.principal=t,e.isIgnoreSharedQueries=t&&t.appSettings.IGNORE_SHARED_QUERIES}),e.logout=function(){n.clearAuthentication(),s.success("Signed out"),n.freeAccess?u.resetActiveRepository():n.isSecurityEnabled()&&l.redirectToLogin()},e.isAdmin=function(){return e.hasRole(r.UserRole.ROLE_ADMIN)},e.isUser=function(){return e.hasRole(r.UserRole.ROLE_USER)},e.hasRole=function(e){return!!angular.isUndefined(e)||n.hasRole(e)},e.hasPermission=function(){return l.hasPermission()},e.canReadRepo=function(e){return n.canReadRepo(e)},e.checkForWrite=function(e,t){return n.checkForWrite(e,t)},e.setPopoverRepo=function(t){e.popoverRepo=t},e.isRepoActive=function(e){return u.isRepoActive(e)},e.getRepositorySize=function(){e.repositorySize={},e.popoverRepo&&(e.repositorySize.loading=!0,v.getSize(e.popoverRepo).then((function(t){e.repositorySize=t.data})))},e.getDegradedReason=function(){return u.getDegradedReason()},e.canManageRepositories=function(){return n.hasRole(r.UserRole.ROLE_REPO_MANAGER)&&!u.getDegradedReason()},e.getSavedQueries=function(){b.getSavedQueries().success((function(t){e.sampleQueries=t})).error((function(e){const t=getError(e);s.error(t,E.instant("query.editor.get.saved.queries.error"))}))},e.goToSparqlEditor=function(e){o.path("/sparql").search({savedQueryName:e.name,owner:e.owner,execute:!0})},e.declineTutorial=function(){$(".tutorial-container").slideUp("slow",(function(){x.set(S.TUTORIAL_STATE,1),e.tutorialState=!1}))},e.initTutorial=function(){if(!e.tutorialState&&"/"!==o.path())return;e.tutorialInfo=[{title:E.instant("main.info.title.welcome.page"),info:Object(i.decodeHTML)(E.instant("main.info.welcome.page"))},{title:E.instant("main.info.title.create.repo.page"),info:Object(i.decodeHTML)(E.instant("main.info.create.repo.page",{link:'<a href="https://graphdb.ontotext.com/documentation/'+h.productShortVersion+'/configuring-a-repository.html" target="_blank">'}))},{title:E.instant("main.info.title.load.sample.dataset"),info:E.instant("main.info.load.sample.dataset")},{title:E.instant("main.info.title.run.sparql.query"),info:Object(i.decodeHTML)(E.instant("main.info.run.sparql.query"))},{title:E.instant("menu.rest.api.label"),info:Object(i.decodeHTML)(E.instant("main.info.rest.api"))}],e.activePage=0,$(".pages-wrapper .page-slide").css("opacity",100);const t=$(".main-container")[0].offsetWidth+200;f((function(){const n=$(".pages-wrapper .page-slide");n.css("left",t+"px"),$(n[e.activePage]).css("left","0px"),$($(".btn-toolbar.pull-right .btn-group .btn")[0]).focus()}),50)},e.getTutorialPageHtml=function(e){return w.trustAsHtml(e.info)},e.checkSubMenuPosition=function(e){0===e?$(".main-menu.collapsed .sub-menu").removeClass("align-bottom"):$(window).height()<735?$(".main-menu.collapsed .sub-menu").addClass("align-bottom"):$(".main-menu.collapsed .sub-menu").removeClass("align-bottom")},D(),$(window).resize((function(){angular.isDefined(e.menuState)?$(window).width()<=720?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".toggle-menu").hide(),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right")):$(window).width()>720&&e.menuState?$(".toggle-menu").show():($(".container-fluid.main-container").removeClass("expanded"),$(".main-menu").removeClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left")):D(),e.tutorialState&&"/"===o.path()&&e.initTutorial(),$(window).height()<735?($(".sub-menu").addClass("align-bottom"),$(".main-menu.collapsed li:nth-child(2) .sub-menu").removeClass("align-bottom")):$(".sub-menu").removeClass("align-bottom")})),e.slideToPage=function(t){const n=$(".main-container")[0].offsetWidth,r=$(".pages-wrapper .page-slide");r.css("opacity","0").delay(200).css("left",n+"px"),e.activePage=t,$(r[e.activePage]).css("opacity","100").css("left","0px")},e.slideNext=function(){let t=++e.activePage;t>=e.tutorialInfo.length&&(t=0),e.slideToPage(t),$($(".btn-toolbar.pull-right .btn-group .btn")[e.activePage]).focus()},e.toggleNavigation=function(){const t=$(".main-menu"),n=$(".sub-menu li.active");if(t.hasClass("collapsed"))n.parents(".menu-element").hasClass("open")?n.parents(".menu-element").children(".menu-element-root").removeClass("active"):n.parents(".menu-element").children(".menu-element-root").addClass("active"),$(".container-fluid.main-container").removeClass("expanded"),t.removeClass("collapsed"),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left"),l.$broadcast("onToggleNavWidth",!1);else{n.parents(".menu-element").children(".menu-element-root").addClass("active");const r=$(".menu-element");r.hasClass("open")&&(r.removeClass("open"),e.clicked=!1,e.selected=-1),$(".container-fluid.main-container").addClass("expanded"),t.addClass("collapsed"),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right"),$(".main-menu.collapsed .menu-element.clicked").removeClass("clicked"),l.$broadcast("onToggleNavWidth",!0)}},e.$on("onToggleNavWidth",(function(t,n){if(e.menuState=n,n?x.set(S.MENU_STATE,"collapsedMenu"):x.set(S.MENU_STATE,"expandedMenu"),e.tutorialState&&"/"===o.path()){const t=$(".pages-wrapper")[0].offsetWidth+200;f((function(){const n=$(".pages-wrapper .page-slide");n.css("left",t+"px"),$(n[e.activePage]).css("left","0px")}),50)}})),e.numberOfActiveImports=0,e.getNumberOfActiveImportsRunning=!1,e.getNumberOfActiveImports=function(){e.getNumberOfActiveImportsRunning||e.canWriteActiveRepo()&&"SYSTEM"!==e.getActiveRepository()&&(e.getNumberOfActiveImportsRunning=!0,a({method:"GET",url:"rest/repositories/"+e.getActiveRepository()+"/import/active",timeout:1e4}).success((function(t){e.numberOfActiveImports=t})).finally((function(){e.getNumberOfActiveImportsRunning=!1})))},e.getQueriesRunning=!1,e.skipGetQueriesTimes=0;const C=function(){let e=0,t=1;return{next:function(){const n=t;return t=e+t,e=n,n},reset:function(){e=0,t=1}}}();e.getQueries=function(){e.getQueriesRunning||(e.skipGetQueriesTimes>0?e.skipGetQueriesTimes--:u.getActiveRepository()&&"SYSTEM"!==u.getActiveRepository()&&!u.isActiveRepoOntopType()&&e.hasRole(r.UserRole.ROLE_USER)?(e.getQueriesRunning=!0,y.getQueryCount().success((function(t){e.queryCount=t,C.reset()})).error((function(){e.queryCount=0,e.skipGetQueriesTimes=C.next()})).finally((function(){e.getQueriesRunning=!1}))):e.queryCount=0)};const R=d((function(){e.getDegradedReason()||(e.getQueries(),e.getNumberOfActiveImports())}),2e3);e.$on("$destroy",(function(){d.cancel(R)})),n.securityInitialized&&e.getSavedQueries(),e.$on("securityInit",(function(t,n,r,i){e.securityEnabled=n,e.userLoggedIn=r,!n||r||i?(c.checkLicenseStatus(),e.getSavedQueries()):"/login"!==o.path()&&l.redirectToLogin()})),e.isEnterprise=function(){return"enterprise"===e.getProductType()},e.isFreeEdition=function(){return"free"===e.getProductType()},e.checkEdition=function(t){return null==t||_.indexOf(t,e.getProductType())>=0},e.showLicense=function(){return c.showLicense},e.getLicense=function(){return c.license},e.isLicenseHardcoded=function(){return c.isLicenseHardcoded},e.getProductType=function(){return c.productType},e.getProductTypeHuman=function(){return c.productTypeHuman},e.getHumanReadableSeconds=function(e,t){const n=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60);let a;a=t&&e<10?e<1?_.ceil(e%60,1):_.round(e%60,1):_.round(e%60,0);let s="";return n&&(s+=n+"d "),(n||r)&&(s+=r+"h "),(n||r||i)&&(s+=i+"m "),s+=a+"s",s.replace(/( 0[a-z])+$/,"")},e.getHumanReadableTimestamp=function(e){const t=Date.now(),n=(t-e)/1e3;if(n<60)return E.instant("timestamp.moments.ago");if(n<600)return E.instant("timestamp.minutes.ago");{const r=new Date(t),i=new Date(e);if(r.getYear()===i.getYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate())return g("date")(e,"'"+E.instant("timestamp.today.at")+"' HH:mm");if(n<86400)return g("date")(e,"'"+E.instant("timestamp.yesterday.at")+"' HH:mm")}return g("date")(e,"'"+E.instant("timestamp.on")+"' yyyy-MM-dd '"+E.instant("timestamp.at")+"' HH:mm")}}function o(e,t,n){e.getRepositorySize=function(t){n.getSize(t).then((function(t){e.size=t.data}))}}angular.module("graphdb.workbench.se.controllers",["graphdb.framework.core.services.jwtauth","graphdb.framework.core.services.repositories","graphdb.framework.core.services.licenseService","ngCookies","ngFileUpload","graphdb.framework.core","graphdb.framework.core.controllers","graphdb.framework.core.directives","graphdb.framework.rest.license.service","graphdb.framework.rest.autocomplete.service","graphdb.framework.rest.repositories.service","graphdb.framework.rest.sparql.service","graphdb.framework.rest.autocomplete.service","graphdb.framework.rest.plugins.service","graphdb.framework.rest.monitoring.service","graphdb.framework.rest.rdf4j.repositories.service","graphdb.framework.utils.localstorageadapter","graphdb.framework.core.services.autocompleteStatus","graphdb.framework.utils.uriutils"]).controller("mainCtrl",s).controller("homeCtrl",a).controller("repositorySizeCtrl",o),a.$inject=["$scope","$rootScope","$http","$repositories","$jwtAuth","$licenseService","AutocompleteRestService","LicenseRestService","RepositoriesRestService","RDF4JRepositoriesRestService"],s.$inject=["$scope","$menuItems","$jwtAuth","$http","toastr","$location","$repositories","$licenseService","$rootScope","productInfo","$timeout","ModalService","$interval","$filter","LicenseRestService","RepositoriesRestService","MonitoringRestService","SparqlRestService","$sce","LocalStorageAdapter","LSKeys","$translate","UriUtils","$q"],o.$inject=["$scope","$http","RepositoriesRestService"]},function(e,t){angular.module("graphdb.framework.rest.locations.service",[]).factory("LocationsRestService",a),a.$inject=["$http"];const n="rest/locations",r=`${n}/active`,i="rest/info/rpc-address";function a(e){return{getLocations:function(t){return e.get(n,{timeout:t?t.promise:null})},addLocation:function(t){return e.post(n,t)},editLocation:function(t){return e.put(n,t)},deleteLocation:function(t){return e.delete(`${n}?uri=${t}`)},getActiveLocation:function(){return e({method:"GET",url:`${r}`,noCancelOnRouteChange:!0})},setDefaultRepository:function(t){return e({url:`${r}/default-repository`,method:"POST",data:{defaultRepository:t}})},getLocationRpcAddress:function(t){return e.get(`${i}`,{params:{location:t}})}}}},function(e,t){angular.module("graphdb.framework.core.services.licenseService",[]).service("$licenseService",["$rootScope","LicenseRestService","$translate",function(e,t,n){const r=this;this.checkLicenseStatus=function(){r.loadingLicense=!0,t.getHardcodedLicense().success((function(e){r.isLicenseHardcoded="true"===e})).error((function(){r.isLicenseHardcoded=!0})).then((function(){t.getLicenseInfo().then((function(e){r.license=e.data,r.showLicense=!0,r.loadingLicense=!1,i(r.license)}),(function(){r.license={message:n.instant("no.license.set.msg"),valid:!1},r.showLicense=!0,r.loadingLicense=!1,i(r.license)}))}))};const i=function(e){r.productType=e.productType,"standard"===r.productType?r.productTypeHuman="Standard":"enterprise"===r.productType?r.productTypeHuman="Enterprise":"free"===r.productType?r.productTypeHuman="Free":"graphdb"===r.productType&&(r.productTypeHuman="GraphDB")};this.checkLicenseStatus(),this.isLicenseValid=function(){return r.license&&r.license.valid}}])},function(e,t){angular.module("graphdb.framework.core.services.autocompleteStatus",[]).service("$autocompleteStatus",["$rootScope","AutocompleteRestService","LocalStorageAdapter","LSKeys","$repositories",function(e,t,n,r,i){const a=this;this.setAutocompleteStatus=function(t){n.set(r.AUTOCOMPLETE_ENABLED,t),e.$broadcast("autocompleteStatus",t)},e.$watch((function(){return n.get(r.AUTOCOMPLETE_ENABLED)}),(function(e){a.setAutocompleteStatus(e)}),!0),e.$on("repositoryIsSet",(function(){!i.getActiveRepository()||i.isActiveRepoOntopType()||i.isActiveRepoFedXType()||t.checkAutocompleteStatus().success((function(e){a.setAutocompleteStatus(e)}))}))}])},function(e,t){
|
|
27
|
+
var le=function(){var e=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),t=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),n={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function r(e,t,r){return t?n[t]:String.fromCharCode(parseInt(r,16))}var i=new String(""),a=Object.hasOwnProperty;return function(n,s){var o,u,c=n.match(e),l=c[0],h=!1;"{"===l?o={}:"["===l?o=[]:(o=[],h=!0);for(var f=[o],p=1-h,d=c.length;p<d;++p){var g;switch((l=c[p]).charCodeAt(0)){default:(g=f[0])[u||g.length]=+l,u=void 0;break;case 34:if(-1!==(l=l.substring(1,l.length-1)).indexOf("\\")&&(l=l.replace(t,r)),g=f[0],!u){if(!(g instanceof Array)){u=l||i;break}u=g.length}g[u]=l,u=void 0;break;case 91:g=f[0],f.unshift(g[u||g.length]=[]),u=void 0;break;case 93:f.shift();break;case 102:(g=f[0])[u||g.length]=!1,u=void 0;break;case 110:(g=f[0])[u||g.length]=null,u=void 0;break;case 116:(g=f[0])[u||g.length]=!0,u=void 0;break;case 123:g=f[0],f.unshift(g[u||g.length]={}),u=void 0;break;case 125:f.shift()}}if(h){if(1!==f.length)throw new Error;o=o[0]}else if(f.length)throw new Error;if(s){var m=function(e,t){var n=e[t];if(n&&"object"==typeof n){var r=null;for(var i in n)if(a.call(n,i)&&n!==e){var o=m(n,i);void 0!==o?n[i]=o:(r||(r=[]),r.push(i))}if(r)for(var u=r.length;--u>=0;)delete n[r[u]]}return s.call(e,t,n)};o=m({"":o},"")}return o}}();void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),he.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var n=t.substr(1).length;n%2==1?n+=1:t.match(/^[0-7]/)||(n+=2);for(var r="",i=0;i<n;i++)r+="f";t=new S(r,16).xor(e).add(S.ONE).toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return Ie(e,t)},this.newObject=function(e){var t=he.asn1,n=t.ASN1Object,r=t.DERBoolean,i=t.DERInteger,a=t.DERBitString,s=t.DEROctetString,o=t.DERNull,u=t.DERObjectIdentifier,c=t.DEREnumerated,l=t.DERUTF8String,h=t.DERNumericString,f=t.DERPrintableString,p=t.DERTeletexString,d=t.DERIA5String,g=t.DERUTCTime,m=t.DERGeneralizedTime,v=t.DERVisibleString,y=t.DERBMPString,b=t.DERSequence,w=t.DERSet,x=t.DERTaggedObject,S=t.ASN1Util.newObject;if(e instanceof t.ASN1Object)return e;var E=Object.keys(e);if(1!=E.length)throw new Error("key of param shall be only one.");var F=E[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+F+":"))throw new Error("undefined key: "+F);if("bool"==F)return new r(e[F]);if("int"==F)return new i(e[F]);if("bitstr"==F)return new a(e[F]);if("octstr"==F)return new s(e[F]);if("null"==F)return new o(e[F]);if("oid"==F)return new u(e[F]);if("enum"==F)return new c(e[F]);if("utf8str"==F)return new l(e[F]);if("numstr"==F)return new h(e[F]);if("prnstr"==F)return new f(e[F]);if("telstr"==F)return new p(e[F]);if("ia5str"==F)return new d(e[F]);if("utctime"==F)return new g(e[F]);if("gentime"==F)return new m(e[F]);if("visstr"==F)return new v(e[F]);if("bmpstr"==F)return new y(e[F]);if("asn1"==F)return new n(e[F]);if("seq"==F){for(var A=e[F],D=[],C=0;C<A.length;C++){var R=S(A[C]);D.push(R)}return new b({array:D})}if("set"==F){for(A=e[F],D=[],C=0;C<A.length;C++){R=S(A[C]);D.push(R)}return new w({array:D})}if("tag"==F){var $=e[F];if("[object Array]"===Object.prototype.toString.call($)&&3==$.length){var I=S($[2]);return new x({tag:$[0],explicit:$[1],obj:I})}return new x($)}},this.jsonToASN1HEX=function(e){return this.newObject(e).getEncodedHex()}},he.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),r=(t=Math.floor(n/40)+"."+n%40,""),i=2;i<e.length;i+=2){var a=("00000000"+parseInt(e.substr(i,2),16).toString(2)).slice(-8);if(r+=a.substr(1,7),"0"==a.substr(0,1))t=t+"."+new S(r,2).toString(10),r=""}return t},he.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=new S(e,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var a="",s=0;s<i;s++)a+="0";r=a+r;for(s=0;s<r.length-1;s+=7){var o=r.substr(s,7);s!=r.length-7&&(o="1"+o),n+=t(parseInt(o,2))}return n};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",i=e.split("."),a=40*parseInt(i[0])+parseInt(i[1]);r+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r},he.asn1.ASN1Object=function(e){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+"".length+",v="+this.hV);var e=this.hV.length/2,t=e.toString(16);if(t.length%2==1&&(t="0"+t),e<128)return t;var n=t.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+e.toString(16);return(128+n).toString(16)+t},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(e){this.params=e},null!=e&&null!=e.tlv&&(this.hTLV=e.tlv,this.isModified=!1)},he.asn1.DERAbstractString=function(e){he.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=Ee(this.s).toLowerCase()},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e?this.setString(e):void 0!==e.str?this.setString(e.str):void 0!==e.hex&&this.setStringHex(e.hex))},We(he.asn1.DERAbstractString,he.asn1.ASN1Object),he.asn1.DERAbstractTime=function(e){he.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(e){var t=e.getTime()+6e4*e.getTimezoneOffset();return new Date(t)},this.formatDate=function(e,t,n){var r=this.zeroPadding,i=this.localDateToUTC(e),a=String(i.getFullYear());"utc"==t&&(a=a.substr(2,2));var s=a+r(String(i.getMonth()+1),2)+r(String(i.getDate()),2)+r(String(i.getHours()),2)+r(String(i.getMinutes()),2)+r(String(i.getSeconds()),2);if(!0===n){var o=i.getMilliseconds();if(0!=o){var u=r(String(o),3);s=s+"."+(u=u.replace(/[0]+$/,""))}}return s+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=ye(e)},this.setByDateValue=function(e,t,n,r,i,a){var s=new Date(Date.UTC(e,t-1,n,r,i,a,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},We(he.asn1.DERAbstractTime,he.asn1.ASN1Object),he.asn1.DERAbstractStructured=function(e){he.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,void 0!==e&&void 0!==e.array&&(this.asn1Array=e.array)},We(he.asn1.DERAbstractStructured,he.asn1.ASN1Object),he.asn1.DERBoolean=function(e){he.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==e?"010100":"0101ff"},We(he.asn1.DERBoolean,he.asn1.ASN1Object),he.asn1.DERInteger=function(e){he.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=he.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new S(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.bigint?this.setByBigInteger(e.bigint):void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},We(he.asn1.DERInteger,he.asn1.ASN1Object),he.asn1.DERBitString=function(e){if(void 0!==e&&void 0!==e.obj){var t=he.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}he.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){var t=8-(e=e.replace(/0+$/,"")).length%8;8==t&&(t=0);for(var n=0;n<=t;n++)e+="0";var r="";for(n=0;n<e.length-1;n+=8){var i=e.substr(n,8),a=parseInt(i,2).toString(16);1==a.length&&(a="0"+a),r+=a}this.hTLV=null,this.isModified=!0,this.hV="0"+t+r},this.setByBooleanArray=function(e){for(var t="",n=0;n<e.length;n++)1==e[n]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):void 0!==e.hex?this.setHexValueIncludingUnusedBits(e.hex):void 0!==e.bin?this.setByBinaryString(e.bin):void 0!==e.array&&this.setByBooleanArray(e.array))},We(he.asn1.DERBitString,he.asn1.ASN1Object),he.asn1.DEROctetString=function(e){if(void 0!==e&&void 0!==e.obj){var t=he.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}he.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},We(he.asn1.DEROctetString,he.asn1.DERAbstractString),he.asn1.DERNull=function(){he.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},We(he.asn1.DERNull,he.asn1.ASN1Object),he.asn1.DERObjectIdentifier=function(e){he.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){var t=qe(e);if(null==t)throw new Error("malformed oid string: "+e);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueName=function(e){var t=he.asn1.x509.OID.name2oid(e);if(""===t)throw new Error("DERObjectIdentifier oidName undefined: "+e);this.setValueOidString(t)},this.setValueNameOrOid=function(e){e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){"string"==typeof e?this.setValueNameOrOid(e):void 0!==e.oid?this.setValueNameOrOid(e.oid):void 0!==e.name?this.setValueNameOrOid(e.name):void 0!==e.hex&&this.setValueHex(e.hex)},void 0!==e&&this.setByParam(e)},We(he.asn1.DERObjectIdentifier,he.asn1.ASN1Object),he.asn1.DEREnumerated=function(e){he.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=he.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new S(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},void 0!==e&&(void 0!==e.int?this.setByInteger(e.int):"number"==typeof e?this.setByInteger(e):void 0!==e.hex&&this.setValueHex(e.hex))},We(he.asn1.DEREnumerated,he.asn1.ASN1Object),he.asn1.DERUTF8String=function(e){he.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},We(he.asn1.DERUTF8String,he.asn1.DERAbstractString),he.asn1.DERNumericString=function(e){he.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},We(he.asn1.DERNumericString,he.asn1.DERAbstractString),he.asn1.DERPrintableString=function(e){he.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},We(he.asn1.DERPrintableString,he.asn1.DERAbstractString),he.asn1.DERTeletexString=function(e){he.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},We(he.asn1.DERTeletexString,he.asn1.DERAbstractString),he.asn1.DERIA5String=function(e){he.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},We(he.asn1.DERIA5String,he.asn1.DERAbstractString),he.asn1.DERVisibleString=function(e){he.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="1a"},We(he.asn1.DERVisibleString,he.asn1.DERAbstractString),he.asn1.DERBMPString=function(e){he.asn1.DERBMPString.superclass.constructor.call(this,e),this.hT="1e"},We(he.asn1.DERBMPString,he.asn1.DERAbstractString),he.asn1.DERUTCTime=function(e){he.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=ye(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=ye(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},We(he.asn1.DERUTCTime,he.asn1.DERAbstractTime),he.asn1.DERGeneralizedTime=function(e){he.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=ye(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=ye(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},We(he.asn1.DERGeneralizedTime,he.asn1.DERAbstractTime),he.asn1.DERSequence=function(e){he.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){e+=this.asn1Array[t].getEncodedHex()}return this.hV=e,this.hV}},We(he.asn1.DERSequence,he.asn1.DERAbstractStructured),he.asn1.DERSet=function(e){he.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},void 0!==e&&void 0!==e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},We(he.asn1.DERSet,he.asn1.DERAbstractStructured),he.asn1.DERTaggedObject=function(e){he.asn1.DERTaggedObject.superclass.constructor.call(this);var t=he.asn1;this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(e){null!=e.tag&&(this.hT=e.tag),null!=e.explicit&&(this.isExplicit=e.explicit),null!=e.tage&&(this.hT=e.tage,this.isExplicit=!0),null!=e.tagi&&(this.hT=e.tagi,this.isExplicit=!1),null!=e.obj&&(e.obj instanceof t.ASN1Object?(this.asn1Object=e.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)):"object"==typeof e.obj&&(this.asn1Object=t.ASN1Util.newObject(e.obj),this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},null!=e&&this.setByParam(e)},We(he.asn1.DERTaggedObject,he.asn1.ASN1Object);var he,fe,pe,de=new function(){};function ge(e){for(var t=new Array,n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}function me(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}function ve(e){for(var t="",n=0;n<e.length;n++){var r=e[n].toString(16);1==r.length&&(r="0"+r),t+=r}return t}function ye(e){return ve(ge(e))}function be(e){return e=(e=(e=e.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function we(e){return e.length%4==2?e+="==":e.length%4==3&&(e+="="),e=(e=e.replace(/-/g,"+")).replace(/_/g,"/")}function xe(e){return e.length%2==1&&(e="0"+e),be(b(e))}function Se(e){return w(we(e))}function Ee(e){return ke(Le(e))}function Fe(e){return decodeURIComponent(Oe(e))}function Ae(e){for(var t="",n=0;n<e.length-1;n+=2)t+=String.fromCharCode(parseInt(e.substr(n,2),16));return t}function De(e){for(var t="",n=0;n<e.length;n++)t+=("0"+e.charCodeAt(n).toString(16)).slice(-2);return t}function Ce(e){return b(e)}function Re(e){var t=Ce(e).replace(/(.{64})/g,"$1\r\n");return t=t.replace(/\r\n$/,"")}function $e(e){return w(e.replace(/[^0-9A-Za-z\/+=]*/g,""))}function Ie(e,t){return"-----BEGIN "+t+"-----\r\n"+Re(e)+"\r\n-----END "+t+"-----\r\n"}function Te(e,t){if(-1==e.indexOf("-----BEGIN "))throw"can't find PEM header: "+t;return $e(e=void 0!==t?(e=e.replace(new RegExp("^[^]*-----BEGIN "+t+"-----"),"")).replace(new RegExp("-----END "+t+"-----[^]*$"),""):(e=e.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function Pe(e){var t,n,r,i,a,s,o,u,c,l,h;if(h=e.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return u=h[1],t=parseInt(u),2===u.length&&(50<=t&&t<100?t=1900+t:0<=t&&t<50&&(t=2e3+t)),n=parseInt(h[2])-1,r=parseInt(h[3]),i=parseInt(h[4]),a=parseInt(h[5]),s=parseInt(h[6]),o=0,""!==(c=h[7])&&(l=(c.substr(1)+"00").substr(0,3),o=parseInt(l)),Date.UTC(t,n,r,i,a,s,o);throw"unsupported zulu format: "+e}function _e(e){return~~(Pe(e)/1e3)}function ke(e){return e.replace(/%/g,"")}function Oe(e){return e.replace(/(..)/g,"%$1")}function je(e){var t="malformed IPv6 address";if(!e.match(/^[0-9A-Fa-f:]+$/))throw t;var n=(e=e.toLowerCase()).split(":").length-1;if(n<2)throw t;var r=":".repeat(7-n+2),i=(e=e.replace("::",r)).split(":");if(8!=i.length)throw t;for(var a=0;a<8;a++)i[a]=("0000"+i[a]).slice(-4);return i.join("")}function Ne(e){if(!e.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var t=(e=e.toLowerCase()).match(/.{1,4}/g),n=0;n<8;n++)t[n]=t[n].replace(/^0+/,""),""==t[n]&&(t[n]="0");var r=(e=":"+t.join(":")+":").match(/:(0:){2,}/g);if(null===r)return e.slice(1,-1);var i="";for(n=0;n<r.length;n++)r[n].length>i.length&&(i=r[n]);return(e=e.replace(i,"::")).slice(1,-1)}function Be(e){var t="malformed hex value";if(!e.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw t;if(8!=e.length)return 32==e.length?Ne(e):e;try{return parseInt(e.substr(0,2),16)+"."+parseInt(e.substr(2,2),16)+"."+parseInt(e.substr(4,2),16)+"."+parseInt(e.substr(6,2),16)}catch(e){throw t}}function He(e){return e.match(/.{4}/g).map((function(e){var t=parseInt(e.substr(0,2),16),n=parseInt(e.substr(2),16);if(0==t&n<128)return String.fromCharCode(n);if(t<8){var r=128|63&n;return Fe((192|(7&t)<<3|(192&n)>>6).toString(16)+r.toString(16))}r=128|(15&t)<<2|(192&n)>>6;var i=128|63&n;return Fe((224|(240&t)>>4).toString(16)+r.toString(16)+i.toString(16))})).join("")}function Le(e){for(var t=encodeURIComponent(e),n="",r=0;r<t.length;r++)"%"==t[r]?(n+=t.substr(r,3),r+=2):n=n+"%"+ye(t[r]);return n}function Me(e){return!(e.length%2!=0||!e.match(/^[0-9a-f]+$/)&&!e.match(/^[0-9A-F]+$/))}function Ue(e){return e.length%2==1?"0"+e:e.substr(0,1)>"7"?"00"+e:e}function Ve(e){e=(e=(e=e.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return e.split(/,/).map((function(e,t,n){var r=parseInt(e);if(r<0||255<r)throw"integer not in range 0-255";return("00"+r.toString(16)).slice(-2)})).join("")}catch(e){throw"malformed integer array string: "+e}}de.getLblen=function(e,t){if("8"!=e.substr(t+2,1))return 1;var n=parseInt(e.substr(t+3,1));return 0==n?-1:0<n&&n<10?n+1:-2},de.getL=function(e,t){var n=de.getLblen(e,t);return n<1?"":e.substr(t+2,2*n)},de.getVblen=function(e,t){var n;return""==(n=de.getL(e,t))?-1:("8"===n.substr(0,1)?new S(n.substr(2),16):new S(n,16)).intValue()},de.getVidx=function(e,t){var n=de.getLblen(e,t);return n<0?n:t+2*(n+1)},de.getV=function(e,t){var n=de.getVidx(e,t),r=de.getVblen(e,t);return e.substr(n,2*r)},de.getTLV=function(e,t){return e.substr(t,2)+de.getL(e,t)+de.getV(e,t)},de.getTLVblen=function(e,t){return 2+2*de.getLblen(e,t)+2*de.getVblen(e,t)},de.getNextSiblingIdx=function(e,t){return de.getVidx(e,t)+2*de.getVblen(e,t)},de.getChildIdx=function(e,t){var n,r,i,a=de,s=[];n=a.getVidx(e,t),r=2*a.getVblen(e,t),"03"==e.substr(t,2)&&(n+=2,r-=2),i=0;for(var o=n;i<=r;){var u=a.getTLVblen(e,o);if((i+=u)<=r&&s.push(o),o+=u,i>=r)break}return s},de.getNthChildIdx=function(e,t,n){return de.getChildIdx(e,t)[n]},de.getIdxbyList=function(e,t,n,r){var i,a,s=de;return 0==n.length?void 0!==r&&e.substr(t,2)!==r?-1:t:(i=n.shift())>=(a=s.getChildIdx(e,t)).length?-1:s.getIdxbyList(e,a[i],n,r)},de.getIdxbyListEx=function(e,t,n,r){var i,a,s=de;if(0==n.length)return void 0!==r&&e.substr(t,2)!==r?-1:t;i=n.shift(),a=s.getChildIdx(e,t);for(var o=0,u=0;u<a.length;u++){var c=e.substr(a[u],2);if("number"==typeof i&&!s.isContextTag(c)&&o==i||"string"==typeof i&&s.isContextTag(c,i))return s.getIdxbyListEx(e,a[u],n,r);s.isContextTag(c)||o++}return-1},de.getTLVbyList=function(e,t,n,r){var i=de,a=i.getIdxbyList(e,t,n,r);return-1==a?null:a>=e.length?null:i.getTLV(e,a)},de.getTLVbyListEx=function(e,t,n,r){var i=de,a=i.getIdxbyListEx(e,t,n,r);return-1==a?null:i.getTLV(e,a)},de.getVbyList=function(e,t,n,r,i){var a,s,o=de;return-1==(a=o.getIdxbyList(e,t,n,r))?null:a>=e.length?null:(s=o.getV(e,a),!0===i&&(s=s.substr(2)),s)},de.getVbyListEx=function(e,t,n,r,i){var a,s,o=de;return-1==(a=o.getIdxbyListEx(e,t,n,r))?null:(s=o.getV(e,a),"03"==e.substr(a,2)&&!1!==i&&(s=s.substr(2)),s)},de.getInt=function(e,t,n){null==n&&(n=-1);try{var r=e.substr(t,2);if("02"!=r&&"03"!=r)return n;var i=de.getV(e,t);return"02"==r?parseInt(i,16):Ge(i)}catch(e){return n}},de.getOID=function(e,t,n){null==n&&(n=null);try{return"06"!=e.substr(t,2)?n:Ke(de.getV(e,t))}catch(e){return n}},de.getOIDName=function(e,t,n){null==n&&(n=null);try{var r=de.getOID(e,t,n);if(r==n)return n;var i=he.asn1.x509.OID.oid2name(r);return""==i?r:i}catch(e){return n}},de.getString=function(e,t,n){null==n&&(n=null);try{return Ae(de.getV(e,t))}catch(e){return n}},de.hextooidstr=function(e){var t=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},n=[],r=e.substr(0,2),i=parseInt(r,16);n[0]=new String(Math.floor(i/40)),n[1]=new String(i%40);for(var a=e.substr(2),s=[],o=0;o<a.length/2;o++)s.push(parseInt(a.substr(2*o,2),16));var u=[],c="";for(o=0;o<s.length;o++)128&s[o]?c+=t((127&s[o]).toString(2),7):(c+=t((127&s[o]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var l=n.join(".");return u.length>0&&(l=l+"."+u.join(".")),l},de.dump=function(e,t,n,r){var i=de,a=i.getV,s=i.dump,o=i.getChildIdx,u=e;e instanceof he.asn1.ASN1Object&&(u=e.getEncodedHex());var c=function(e,t){return e.length<=2*t?e:e.substr(0,t)+"..(total "+e.length/2+"bytes).."+e.substr(e.length-t,t)};void 0===t&&(t={ommit_long_octet:32}),void 0===n&&(n=0),void 0===r&&(r="");var l,h=t.ommit_long_octet;if("01"==(l=u.substr(n,2)))return"00"==(f=a(u,n))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==l)return r+"INTEGER "+c(f=a(u,n),h)+"\n";if("03"==l){var f=a(u,n);if(i.isASN1HEX(f.substr(2))){var p=r+"BITSTRING, encapsulates\n";return p+=s(f.substr(2),t,0,r+" ")}return r+"BITSTRING "+c(f,h)+"\n"}if("04"==l){f=a(u,n);if(i.isASN1HEX(f)){p=r+"OCTETSTRING, encapsulates\n";return p+=s(f,t,0,r+" ")}return r+"OCTETSTRING "+c(f,h)+"\n"}if("05"==l)return r+"NULL\n";if("06"==l){var d=a(u,n),g=he.asn1.ASN1Util.oidHexToInt(d),m=he.asn1.x509.OID.oid2name(g),v=g.replace(/\./g," ");return""!=m?r+"ObjectIdentifier "+m+" ("+v+")\n":r+"ObjectIdentifier ("+v+")\n"}if("0a"==l)return r+"ENUMERATED "+parseInt(a(u,n))+"\n";if("0c"==l)return r+"UTF8String '"+Fe(a(u,n))+"'\n";if("13"==l)return r+"PrintableString '"+Fe(a(u,n))+"'\n";if("14"==l)return r+"TeletexString '"+Fe(a(u,n))+"'\n";if("16"==l)return r+"IA5String '"+Fe(a(u,n))+"'\n";if("17"==l)return r+"UTCTime "+Fe(a(u,n))+"\n";if("18"==l)return r+"GeneralizedTime "+Fe(a(u,n))+"\n";if("1a"==l)return r+"VisualString '"+Fe(a(u,n))+"'\n";if("1e"==l)return r+"BMPString '"+He(a(u,n))+"'\n";if("30"==l){if("3000"==u.substr(n,4))return r+"SEQUENCE {}\n";p=r+"SEQUENCE\n";var y=t;if((2==(x=o(u,n)).length||3==x.length)&&"06"==u.substr(x[0],2)&&"04"==u.substr(x[x.length-1],2)){m=i.oidname(a(u,x[0]));var b=JSON.parse(JSON.stringify(t));b.x509ExtName=m,y=b}for(var w=0;w<x.length;w++)p+=s(u,y,x[w],r+" ");return p}if("31"==l){p=r+"SET\n";var x=o(u,n);for(w=0;w<x.length;w++)p+=s(u,t,x[w],r+" ");return p}if(0!=(128&(l=parseInt(l,16)))){var S=31&l;if(0!=(32&l)){for(p=r+"["+S+"]\n",x=o(u,n),w=0;w<x.length;w++)p+=s(u,t,x[w],r+" ");return p}f=a(u,n);if(de.isASN1HEX(f)){var p=r+"["+S+"]\n";return p+=s(f,t,0,r+" ")}return"68747470"==f.substr(0,8)?f=Fe(f):"subjectAltName"===t.x509ExtName&&2==S&&(f=Fe(f)),p=r+"["+S+"] "+f+"\n"}return r+"UNKNOWN("+l+") "+a(u,n)+"\n"},de.isContextTag=function(e,t){var n,r;e=e.toLowerCase();try{n=parseInt(e,16)}catch(e){return-1}if(void 0===t)return 128==(192&n);try{return null!=t.match(/^\[[0-9]+\]$/)&&(!((r=parseInt(t.substr(1,t.length-1),10))>31)&&(128==(192&n)&&(31&n)==r))}catch(e){return!1}},de.isASN1HEX=function(e){var t=de;if(e.length%2==1)return!1;var n=t.getVblen(e,0),r=e.substr(0,2),i=t.getL(e,0);return e.length-r.length-i.length==2*n},de.checkStrictDER=function(e,t,n,r,i){var a=de;if(void 0===n){if("string"!=typeof e)throw new Error("not hex string");if(e=e.toLowerCase(),!he.lang.String.isHex(e))throw new Error("not hex string");n=e.length,i=(r=e.length/2)<128?1:Math.ceil(r.toString(16))+1}if(a.getL(e,t).length>2*i)throw new Error("L of TLV too long: idx="+t);var s=a.getVblen(e,t);if(s>r)throw new Error("value of L too long than hex: idx="+t);var o=a.getTLV(e,t),u=o.length-2-a.getL(e,t).length;if(u!==2*s)throw new Error("V string length and L's value not the same:"+u+"/"+2*s);if(0===t&&e.length!=o.length)throw new Error("total length and TLV length unmatch:"+e.length+"!="+o.length);var c=e.substr(t,2);if("02"===c){var l=a.getVidx(e,t);if("00"==e.substr(l,2)&&e.charCodeAt(l+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var h=a.getVblen(e,t),f=0,p=a.getChildIdx(e,t),d=0;d<p.length;d++){f+=a.getTLV(e,p[d]).length,a.checkStrictDER(e,p[d],n,r,i)}if(2*h!=f)throw new Error("sum of children's TLV length and L unmatch: "+2*h+"!="+f)}},de.oidname=function(e){var t=he.asn1;he.lang.String.isHex(e)&&(e=t.ASN1Util.oidHexToInt(e));var n=t.x509.OID.oid2name(e);return""===n&&(n=e),n},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.x509&&he.asn1.x509||(he.asn1.x509={}),he.asn1.x509.Certificate=function(e){he.asn1.x509.Certificate.superclass.constructor.call(this);var t=he.asn1,n=t.DERBitString,r=t.DERSequence,i=t.x509,a=i.TBSCertificate,s=i.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.sigalg;null!=e.sigalg.name&&(t=e.sigalg.name);var n=e.tbsobj.getEncodedHex(),r=new he.crypto.Signature({alg:t});r.init(e.cakey),r.updateHex(n),e.sighex=r.sign()},this.getPEM=function(){return Ie(this.getEncodedHex(),"CERTIFICATE")},this.getEncodedHex=function(){var e=this.params;if(null!=e.tbsobj&&null!=e.tbsobj||(e.tbsobj=new a(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new s({name:e.sigalg})),t.push(new n({hex:"00"+e.sighex})),new r({array:t}).getEncodedHex()},null!=e&&(this.params=e)},We(he.asn1.x509.Certificate,he.asn1.ASN1Object),he.asn1.x509.TBSCertificate=function(e){he.asn1.x509.TBSCertificate.superclass.constructor.call(this);var t=he.asn1,n=t.x509,r=t.DERTaggedObject,i=t.DERInteger,a=t.DERSequence,s=n.AlgorithmIdentifier,o=n.Time,u=n.X500Name,c=n.Extensions,l=n.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version||1!=t.version){var n=2;null!=t.version&&(n=t.version-1);var h=new r({obj:new i({int:n})});e.push(h)}return e.push(new i(t.serial)),e.push(new s({name:t.sigalg})),e.push(new u(t.issuer)),e.push(new a({array:[new o(t.notbefore),new o(t.notafter)]})),e.push(new u(t.subject)),e.push(new l(Ye.getKey(t.sbjpubkey))),void 0!==t.ext&&t.ext.length>0&&e.push(new r({tag:"a3",obj:new c(t.ext)})),new he.asn1.DERSequence({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.TBSCertificate,he.asn1.ASN1Object),he.asn1.x509.Extensions=function(e){he.asn1.x509.Extensions.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.x509;this.aParam=[],this.setByParam=function(e){this.aParam=e},this.getEncodedHex=function(){for(var e=[],t=0;t<this.aParam.length;t++){var i=this.aParam[t],a=i.extname,s=null;if(null!=i.extn)s=new r.PrivateExtension(i);else if("subjectKeyIdentifier"==a)s=new r.SubjectKeyIdentifier(i);else if("keyUsage"==a)s=new r.KeyUsage(i);else if("subjectAltName"==a)s=new r.SubjectAltName(i);else if("issuerAltName"==a)s=new r.IssuerAltName(i);else if("basicConstraints"==a)s=new r.BasicConstraints(i);else if("cRLDistributionPoints"==a)s=new r.CRLDistributionPoints(i);else if("certificatePolicies"==a)s=new r.CertificatePolicies(i);else if("authorityKeyIdentifier"==a)s=new r.AuthorityKeyIdentifier(i);else if("extKeyUsage"==a)s=new r.ExtKeyUsage(i);else if("authorityInfoAccess"==a)s=new r.AuthorityInfoAccess(i);else if("cRLNumber"==a)s=new r.CRLNumber(i);else if("cRLReason"==a)s=new r.CRLReason(i);else if("ocspNonce"==a)s=new r.OCSPNonce(i);else if("ocspNoCheck"==a)s=new r.OCSPNoCheck(i);else if("adobeTimeStamp"==a)s=new r.AdobeTimeStamp(i);else{if("subjectDirectoryAttributes"!=a)throw new Error("extension not supported:"+JSON.stringify(i));s=new r.SubjectDirectoryAttributes(i)}null!=s&&e.push(s)}return new n({array:e}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.x509.Extensions,he.asn1.ASN1Object),he.asn1.x509.Extension=function(e){he.asn1.x509.Extension.superclass.constructor.call(this);var t=he.asn1,n=t.DERObjectIdentifier,r=t.DEROctetString,i=(t.DERBitString,t.DERBoolean),a=t.DERSequence;this.getEncodedHex=function(){var e=new n({oid:this.oid}),t=new r({hex:this.getExtnValueHex()}),s=new Array;return s.push(e),this.critical&&s.push(new i),s.push(t),new a({array:s}).getEncodedHex()},this.critical=!1,void 0!==e&&void 0!==e.critical&&(this.critical=e.critical)},We(he.asn1.x509.Extension,he.asn1.ASN1Object),he.asn1.x509.KeyUsage=function(e){he.asn1.x509.KeyUsage.superclass.constructor.call(this,e);var t=Ze.KEYUSAGE_NAME;if(this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15",void 0!==e&&(void 0!==e.bin&&(this.asn1ExtnValue=new he.asn1.DERBitString(e)),void 0!==e.names&&void 0!==e.names.length)){for(var n=e.names,r="000000000",i=0;i<n.length;i++)for(var a=0;a<t.length;a++)n[i]===t[a]&&(r=r.substring(0,a)+"1"+r.substring(a+1,r.length));this.asn1ExtnValue=new he.asn1.DERBitString({bin:r})}},We(he.asn1.x509.KeyUsage,he.asn1.x509.Extension),he.asn1.x509.BasicConstraints=function(e){he.asn1.x509.BasicConstraints.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERBoolean,r=t.DERInteger,i=t.DERSequence;this.getExtnValueHex=function(){var e=new Array;this.cA&&e.push(new n),this.pathLen>-1&&e.push(new r({int:this.pathLen}));var t=new i({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==e&&(void 0!==e.cA&&(this.cA=e.cA),void 0!==e.pathLen&&(this.pathLen=e.pathLen))},We(he.asn1.x509.BasicConstraints,he.asn1.x509.Extension),he.asn1.x509.CRLDistributionPoints=function(e){he.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,e);var t=he.asn1,n=t.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(e){for(var r=[],i=0;i<e.length;i++)if(e[i]instanceof he.asn1.ASN1Object)r.push(e[i]);else{var a=new n.DistributionPoint(e[i]);r.push(a)}this.asn1ExtnValue=new t.DERSequence({array:r})},this.setByOneURI=function(e){var t=new n.DistributionPoint({fulluri:e});this.setByDPArray([t])},this.oid="2.5.29.31",void 0!==e&&(void 0!==e.array?this.setByDPArray(e.array):void 0!==e.uri&&this.setByOneURI(e.uri))},We(he.asn1.x509.CRLDistributionPoints,he.asn1.x509.Extension),he.asn1.x509.DistributionPoint=function(e){he.asn1.x509.DistributionPoint.superclass.constructor.call(this);var t=he.asn1,n=t.x509.DistributionPointName;this.getEncodedHex=function(){var e=new t.DERSequence;if(null!=this.asn1DP){var n=new t.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});e.appendASN1Object(n)}return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.dpobj?this.asn1DP=e.dpobj:void 0!==e.dpname?this.asn1DP=new n(e.dpname):void 0!==e.fulluri&&(this.asn1DP=new n({full:[{uri:e.fulluri}]})))},We(he.asn1.x509.DistributionPoint,he.asn1.ASN1Object),he.asn1.x509.DistributionPointName=function(e){he.asn1.x509.DistributionPointName.superclass.constructor.call(this);var t=he.asn1,n=t.DERTaggedObject;if(this.getEncodedHex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new n({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.getEncodedHex(),this.hTLV},void 0!==e)if(t.x509.GeneralNames.prototype.isPrototypeOf(e))this.type="full",this.tag="a0",this.asn1V=e;else{if(void 0===e.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new t.x509.GeneralNames(e.full)}},We(he.asn1.x509.DistributionPointName,he.asn1.ASN1Object),he.asn1.x509.CertificatePolicies=function(e){he.asn1.x509.CertificatePolicies.superclass.constructor.call(this,e);var t=he.asn1,n=t.x509,r=t.DERSequence,i=n.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++)e.push(new i(this.params.array[t]));var n=new r({array:e});return this.asn1ExtnValue=n,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.32",void 0!==e&&(this.params=e)},We(he.asn1.x509.CertificatePolicies,he.asn1.x509.Extension),he.asn1.x509.PolicyInformation=function(e){he.asn1.x509.PolicyInformation.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=t.x509.PolicyQualifierInfo;this.params=null,this.getEncodedHex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var e=[new r(this.params.policyoid)];if(void 0!==this.params.array){for(var t=[],a=0;a<this.params.array.length;a++)t.push(new i(this.params.array[a]));t.length>0&&e.push(new n({array:t}))}return new n({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.PolicyInformation,he.asn1.ASN1Object),he.asn1.x509.PolicyQualifierInfo=function(e){he.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.DERIA5String,i=t.DERObjectIdentifier,a=t.x509.UserNotice;this.params=null,this.getEncodedHex=function(){return void 0!==this.params.cps?new n({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new r({str:this.params.cps})]}).getEncodedHex():null!=this.params.unotice?new n({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new a(this.params.unotice)]}).getEncodedHex():void 0},void 0!==e&&(this.params=e)},We(he.asn1.x509.PolicyQualifierInfo,he.asn1.ASN1Object),he.asn1.x509.UserNotice=function(e){he.asn1.x509.UserNotice.superclass.constructor.call(this,e);var t=he.asn1.DERSequence,n=(he.asn1.DERInteger,he.asn1.x509.DisplayText),r=he.asn1.x509.NoticeReference;this.params=null,this.getEncodedHex=function(){var e=[];return void 0!==this.params.noticeref&&e.push(new r(this.params.noticeref)),void 0!==this.params.exptext&&e.push(new n(this.params.exptext)),new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.UserNotice,he.asn1.ASN1Object),he.asn1.x509.NoticeReference=function(e){he.asn1.x509.NoticeReference.superclass.constructor.call(this,e);var t=he.asn1.DERSequence,n=he.asn1.DERInteger,r=he.asn1.x509.DisplayText;this.params=null,this.getEncodedHex=function(){var e=[];if(void 0!==this.params.org&&e.push(new r(this.params.org)),void 0!==this.params.noticenum){for(var i=[],a=this.params.noticenum,s=0;s<a.length;s++)i.push(new n(a[s]));e.push(new t({array:i}))}if(0==e.length)throw new Error("parameter is empty");return new t({array:e}).getEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.x509.NoticeReference,he.asn1.ASN1Object),he.asn1.x509.DisplayText=function(e){he.asn1.x509.DisplayText.superclass.constructor.call(this,e),this.hT="0c",void 0!==e&&("ia5"===e.type?this.hT="16":"vis"===e.type?this.hT="1a":"bmp"===e.type&&(this.hT="1e"))},We(he.asn1.x509.DisplayText,he.asn1.DERAbstractString),he.asn1.x509.ExtKeyUsage=function(e){he.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,e);var t=he.asn1;this.setPurposeArray=function(e){this.asn1ExtnValue=new t.DERSequence;for(var n=0;n<e.length;n++){var r=new t.DERObjectIdentifier(e[n]);this.asn1ExtnValue.appendASN1Object(r)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==e&&void 0!==e.array&&this.setPurposeArray(e.array)},We(he.asn1.x509.ExtKeyUsage,he.asn1.x509.Extension),he.asn1.x509.AuthorityKeyIdentifier=function(e){he.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,e);var t=he,n=t.asn1,r=n.DERTaggedObject,i=n.x509.GeneralNames;t.crypto.Util.isKey;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var e=new Array;this.asn1KID&&e.push(new r({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&e.push(new r({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&e.push(new r({explicit:!1,tag:"82",obj:this.asn1CertSN}));var t=new n.DERSequence({array:e});return this.asn1ExtnValue=t,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new he.asn1.DEROctetString(e);else if("object"==typeof e&&he.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN ")){var t=e;"string"==typeof e&&(t=Ye.getKey(e));var n=Ye.getKeyID(t);this.asn1KID=new he.asn1.DEROctetString({hex:n})}},this.setCertIssuerByParam=function(e){void 0!==e.str||void 0!==e.ldapstr||void 0!==e.hex||void 0!==e.certsubject||void 0!==e.certissuer?this.asn1CertIssuer=new he.asn1.x509.X500Name(e):"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&-1!=e.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new he.asn1.x509.X500Name({certissuer:e}))},this.setCertSNByParam=function(e){if(void 0!==e.str||void 0!==e.bigint||void 0!==e.hex)this.asn1CertSN=new he.asn1.DERInteger(e);else if("string"==typeof e&&-1!=e.indexOf("BEGIN ")&&e.indexOf("CERTIFICATE")){var t=new Ze;t.readCertPEM(e);var n=t.getSerialNumberHex();this.asn1CertSN=new he.asn1.DERInteger({hex:n})}},this.oid="2.5.29.35",void 0!==e&&(void 0!==e.kid&&this.setKIDByParam(e.kid),void 0!==e.issuer&&this.setCertIssuerByParam(e.issuer),void 0!==e.sn&&this.setCertSNByParam(e.sn),void 0!==e.issuersn&&"string"==typeof e.issuersn&&-1!=e.issuersn.indexOf("BEGIN ")&&e.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(e.issuersn),this.setCertIssuerByParam(e.issuersn)))},We(he.asn1.x509.AuthorityKeyIdentifier,he.asn1.x509.Extension),he.asn1.x509.SubjectKeyIdentifier=function(e){he.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,e);var t=he.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(e){if(void 0!==e.str||void 0!==e.hex)this.asn1KID=new t(e);else if("object"==typeof e&&he.crypto.Util.isKey(e)||"string"==typeof e&&-1!=e.indexOf("BEGIN")){var n=e;"string"==typeof e&&(n=Ye.getKey(e));var r=Ye.getKeyID(n);this.asn1KID=new he.asn1.DEROctetString({hex:r})}},this.oid="2.5.29.14",void 0!==e&&void 0!==e.kid&&this.setKIDByParam(e.kid)},We(he.asn1.x509.SubjectKeyIdentifier,he.asn1.x509.Extension),he.asn1.x509.AuthorityInfoAccess=function(e){he.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,e),this.setAccessDescriptionArray=function(e){for(var t=new Array,n=he.asn1,r=n.DERSequence,i=n.DERObjectIdentifier,a=n.x509.GeneralName,s=0;s<e.length;s++){var o,u=e[s];if(void 0!==u.ocsp)o=new r({array:[new i({oid:"1.3.6.1.5.5.7.48.1"}),new a({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));o=new r({array:[new i({oid:"1.3.6.1.5.5.7.48.2"}),new a({uri:u.caissuer})]})}t.push(o)}this.asn1ExtnValue=new r({array:t})},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==e&&void 0!==e.array&&this.setAccessDescriptionArray(e.array)},We(he.asn1.x509.AuthorityInfoAccess,he.asn1.x509.Extension),he.asn1.x509.SubjectAltName=function(e){he.asn1.x509.SubjectAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new he.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.17",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},We(he.asn1.x509.SubjectAltName,he.asn1.x509.Extension),he.asn1.x509.IssuerAltName=function(e){he.asn1.x509.IssuerAltName.superclass.constructor.call(this,e),this.setNameArray=function(e){this.asn1ExtnValue=new he.asn1.x509.GeneralNames(e)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.18",void 0!==e&&void 0!==e.array&&this.setNameArray(e.array)},We(he.asn1.x509.IssuerAltName,he.asn1.x509.Extension),he.asn1.x509.SubjectDirectoryAttributes=function(e){he.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERSequence,r=t.ASN1Util.newObject,i=t.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var e=[],t=0;t<this.params.array.length;t++){var a=this.params.array[t],s={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={gentime:a.str};else if("placeOfBirth"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={utf8str:a.str};else if("gender"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str};else if("countryOfCitizenship"==a.attr)s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str};else{if("countryOfResidence"!=a.attr)throw new Error("unsupported attribute: "+a.attr);s.seq[0].oid=i(a.attr),s.seq[1].set[0]={prnstr:a.str}}e.push(new r(s))}var o=new n({array:e});return this.asn1ExtnValue=o,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.9",void 0!==e&&(this.params=e)},We(he.asn1.x509.SubjectDirectoryAttributes,he.asn1.x509.Extension),he.asn1.x509.PrivateExtension=function(e){he.asn1.x509.PrivateExtension.superclass.constructor.call(this,e);var t=he,n=t.lang.String.isHex,r=t.asn1,i=r.x509.OID.name2oid,a=r.ASN1Util.newObject;this.params=null,this.setByParam=function(e){this.oid=i(e.extname),this.params=e},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var e=this.params.extn;if("string"==typeof e&&n(e))return e;if("object"==typeof e)try{return a(e).getEncodedHex()}catch(e){}throw new Error("unsupported extn value")},null!=e&&this.setByParam(e)},We(he.asn1.x509.PrivateExtension,he.asn1.x509.Extension),he.asn1.x509.CRL=function(e){he.asn1.x509.CRL.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.DERBitString,i=t.x509,a=i.AlgorithmIdentifier,s=i.TBSCertList;this.params=void 0,this.setByParam=function(e){this.params=e},this.sign=function(){var e=new s(this.params).getEncodedHex(),t=new he.crypto.Signature({alg:this.params.sigalg});t.init(this.params.cakey),t.updateHex(e);var n=t.sign();this.params.sighex=n},this.getPEM=function(){return Ie(this.getEncodedHex(),"X509 CRL")},this.getEncodedHex=function(){var e=this.params;if(null==e.tbsobj&&(e.tbsobj=new s(e)),null==e.sighex&&null!=e.cakey&&this.sign(),null==e.sighex)throw new Error("sighex or cakey parameter not defined");var t=[];return t.push(e.tbsobj),t.push(new a({name:e.sigalg})),t.push(new r({hex:"00"+e.sighex})),new n({array:t}).getEncodedHex()},null!=e&&(this.params=e)},We(he.asn1.x509.CRL,he.asn1.ASN1Object),he.asn1.x509.TBSCertList=function(e){he.asn1.x509.TBSCertList.superclass.constructor.call(this);var t=he.asn1,n=t.DERInteger,r=t.DERSequence,i=t.DERTaggedObject,a=(t.DERObjectIdentifier,t.x509),s=a.AlgorithmIdentifier,o=a.Time,u=a.Extensions,c=a.X500Name;this.params=null,this.setByParam=function(e){this.params=e},this.getRevCertSequence=function(){for(var e=[],t=this.params.revcert,i=0;i<t.length;i++){var a=[new n(t[i].sn),new o(t[i].date)];null!=t[i].ext&&a.push(new u(t[i].ext)),e.push(new r({array:a}))}return new r({array:e})},this.getEncodedHex=function(){var e=[],t=this.params;if(null!=t.version){var a=t.version-1,l=new n({int:a});e.push(l)}if(e.push(new s({name:t.sigalg})),e.push(new c(t.issuer)),e.push(new o(t.thisupdate)),null!=t.nextupdate&&e.push(new o(t.nextupdate)),null!=t.revcert&&e.push(this.getRevCertSequence()),null!=t.ext){var h=new u(t.ext);e.push(new i({tag:"a0",explicit:!0,obj:h}))}return new r({array:e}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.TBSCertList,he.asn1.ASN1Object),he.asn1.x509.CRLEntry=function(e){he.asn1.x509.CRLEntry.superclass.constructor.call(this);var t=he.asn1;this.setCertSerial=function(e){this.sn=new t.DERInteger(e)},this.setRevocationDate=function(e){this.time=new t.x509.Time(e)},this.getEncodedHex=function(){var e=new t.DERSequence({array:[this.sn,this.time]});return this.TLV=e.getEncodedHex(),this.TLV},void 0!==e&&(void 0!==e.time&&this.setRevocationDate(e.time),void 0!==e.sn&&this.setCertSerial(e.sn))},We(he.asn1.x509.CRLEntry,he.asn1.ASN1Object),he.asn1.x509.CRLNumber=function(e){he.asn1.x509.CRLNumber.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DERInteger(this.params.num),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.20",null!=e&&(this.params=e)},We(he.asn1.x509.CRLNumber,he.asn1.x509.Extension),he.asn1.x509.CRLReason=function(e){he.asn1.x509.CRLReason.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.21",null!=e&&(this.params=e)},We(he.asn1.x509.CRLReason,he.asn1.x509.Extension),he.asn1.x509.OCSPNonce=function(e){he.asn1.x509.OCSPNonce.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DEROctetString(this.params),this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=e&&(this.params=e)},We(he.asn1.x509.OCSPNonce,he.asn1.x509.Extension),he.asn1.x509.OCSPNoCheck=function(e){he.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,e),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new he.asn1.DERNull,this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=e&&(this.params=e)},We(he.asn1.x509.OCSPNoCheck,he.asn1.x509.Extension),he.asn1.x509.AdobeTimeStamp=function(e){he.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,e);var t=he.asn1,n=t.DERInteger,r=t.DERBoolean,i=t.DERSequence,a=t.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var e=this.params,t=[new n(1)];return t.push(new a({uri:e.uri})),null!=e.reqauth&&t.push(new r(e.reqauth)),this.asn1ExtnValue=new i({array:t}),this.asn1ExtnValue.getEncodedHex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==e&&this.setByParam(e)},We(he.asn1.x509.AdobeTimeStamp,he.asn1.x509.Extension),he.asn1.x509.X500Name=function(e){he.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=he.asn1,n=t.x509,r=n.RDN;this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var n=e.split("/");n.shift();for(var i=[],a=0;a<n.length;a++)if(n[a].match(/^[^=]+=.+$/))i.push(n[a]);else{var s=i.length-1;i[s]=i[s]+"/"+n[a]}for(a=0;a<i.length;a++)this.asn1Array.push(new r({str:i[a],rule:this.sRule}))},this.setByLdapString=function(e,t){void 0!==t&&(this.sRule=t);var r=n.X500Name.ldapToCompat(e);this.setByString(r,t)},this.setByObject=function(e,t){for(var n in void 0!==t&&(this.sRule=t),e)if(e.hasOwnProperty(n)){var i=new r({str:n+"="+e[n],rule:this.sRule});this.asn1Array?this.asn1Array.push(i):this.asn1Array=[i]}},this.setByParam=function(e){var t;(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.array)?this.paramArray=e.array:void 0!==e.str?this.setByString(e.str):void 0!==e.ldapstr?this.setByLdapString(e.ldapstr):void 0!==e.hex?this.hTLV=e.hex:void 0!==e.certissuer?((t=new Ze).readCertPEM(e.certissuer),this.hTLV=t.getIssuerHex()):void 0!==e.certsubject?((t=new Ze).readCertPEM(e.certsubject),this.hTLV=t.getSubjectHex()):"object"==typeof e&&void 0===e.certsubject&&void 0===e.certissuer&&this.setByObject(e)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var n={array:this.paramArray[e]};"utf8"!=this.sRule&&(n.rule=this.sRule);var i=new r(n);this.asn1Array.push(i)}var a=new t.DERSequence({array:this.asn1Array});return this.hTLV=a.getEncodedHex(),this.hTLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.X500Name,he.asn1.ASN1Object),he.asn1.x509.X500Name.compatToLDAP=function(e){if("/"!==e.substr(0,1))throw"malformed input";var t=(e=e.substr(1)).split("/");return t.reverse(),(t=t.map((function(e){return e.replace(/,/,"\\,")}))).join(",")},he.asn1.x509.X500Name.onelineToLDAP=function(e){return he.asn1.x509.X500Name.compatToLDAP(e)},he.asn1.x509.X500Name.ldapToCompat=function(e){for(var t=e.split(","),n=!1,r=[],i=0;t.length>0;i++){var a=t.shift();if(!0===n){var s=(r.pop()+","+a).replace(/\\,/g,",");r.push(s),n=!1}else r.push(a);"\\"===a.substr(-1,1)&&(n=!0)}return(r=r.map((function(e){return e.replace("/","\\/")}))).reverse(),"/"+r.join("/")},he.asn1.x509.X500Name.ldapToOneline=function(e){return he.asn1.x509.X500Name.ldapToCompat(e)},he.asn1.x509.RDN=function(e){he.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var t=he.asn1.x509.AttributeTypeAndValue;this.setByParam=function(e){void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.str&&this.addByMultiValuedString(e.str),void 0!==e.array&&(this.paramArray=e.array)},this.addByString=function(e){this.asn1Array.push(new he.asn1.x509.AttributeTypeAndValue({str:e,rule:this.sRule}))},this.addByMultiValuedString=function(e){for(var t=he.asn1.x509.RDN.parseString(e),n=0;n<t.length;n++)this.addByString(t[n])},this.getEncodedHex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var e=0;e<this.paramArray.length;e++){var n=this.paramArray[e];void 0!==n.rule&&"utf8"!=this.sRule&&(n.rule=this.sRule);var r=new t(n);this.asn1Array.push(r)}var i=new he.asn1.DERSet({array:this.asn1Array});return this.TLV=i.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.RDN,he.asn1.ASN1Object),he.asn1.x509.RDN.parseString=function(e){for(var t=e.split(/\+/),n=!1,r=[],i=0;t.length>0;i++){var a=t.shift();if(!0===n){var s=(r.pop()+"+"+a).replace(/\\\+/g,"+");r.push(s),n=!1}else r.push(a);"\\"===a.substr(-1,1)&&(n=!0)}var o=!1,u=[];for(i=0;r.length>0;i++){a=r.shift();if(!0===o){var c=u.pop();if(a.match(/"$/)){s=(c+"+"+a).replace(/^([^=]+)="(.*)"$/,"$1=$2");u.push(s),o=!1}else u.push(c+"+"+a)}else u.push(a);a.match(/^[^=]+="/)&&(o=!0)}return u},he.asn1.x509.AttributeTypeAndValue=function(e){he.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var t=he,n=t.asn1,r=n.DERSequence,i=n.DERUTF8String,a=n.DERPrintableString,s=n.DERTeletexString,o=n.DERIA5String,u=n.DERVisibleString,c=n.DERBMPString,l=t.lang.String.isMail,h=t.lang.String.isPrintable;this.setByParam=function(e){if(void 0!==e.rule&&(this.sRule=e.rule),void 0!==e.ds&&(this.dsType=e.ds),void 0===e.value&&void 0!==e.str){var t=e.str.match(/^([^=]+)=(.+)$/);if(!t)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=t[1],this.sValue=t[2]}else this.sType=e.type,this.sValue=e.value},this.setByString=function(e,t){void 0!==t&&(this.sRule=t);var n=e.match(/^([^=]+)=(.+)$/);if(!n)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(n[1],n[2])},this._getDsType=function(){var e=this.sType,t=this.sValue,n=this.sRule;return"prn"===n?"CN"==e&&l(t)?"ia5":h(t)?"prn":"utf8":"utf8"===n?"CN"==e&&l(t)?"ia5":"C"==e?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(e,t,n){void 0!==n&&(this.sRule=n),this.sType=e,this.sValue=t},this.getValueObj=function(e,t){if("utf8"==e)return new i({str:t});if("prn"==e)return new a({str:t});if("tel"==e)return new s({str:t});if("ia5"==e)return new o({str:t});if("vis"==e)return new u({str:t});if("bmp"==e)return new c({str:t});throw new Error("unsupported directory string type: type="+e+" value="+t)},this.getEncodedHex=function(){null==this.dsType&&(this.dsType=this._getDsType());var e=he.asn1.x509.OID.atype2obj(this.sType),t=this.getValueObj(this.dsType,this.sValue),n=new r({array:[e,t]});return this.TLV=n.getEncodedHex(),this.TLV},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.AttributeTypeAndValue,he.asn1.ASN1Object),he.asn1.x509.SubjectPublicKeyInfo=function(e){he.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var t=he,n=t.asn1,r=n.DERInteger,i=n.DERBitString,a=n.DERObjectIdentifier,s=n.DERSequence,o=n.ASN1Util.newObject,u=n.x509.AlgorithmIdentifier,c=t.crypto;c.ECDSA,c.DSA;this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new s({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.getEncodedHex=function(){var e=this.getASN1Object();return this.hTLV=e.getEncodedHex(),this.hTLV},this.setPubKey=function(e){try{if(e instanceof ae){var t=o({seq:[{int:{bigint:e.n}},{int:{int:e.e}}]}).getEncodedHex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+t})}}catch(e){}try{if(e instanceof he.crypto.ECDSA){var n=new a({name:e.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:n}),this.asn1SubjPKey=new i({hex:"00"+e.pubKeyHex})}}catch(e){}try{if(e instanceof he.crypto.DSA){n=new o({seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:n});var s=new r({bigint:e.y});this.asn1SubjPKey=new i({hex:"00"+s.getEncodedHex()})}}catch(e){}},void 0!==e&&this.setPubKey(e)},We(he.asn1.x509.SubjectPublicKeyInfo,he.asn1.ASN1Object),he.asn1.x509.Time=function(e){he.asn1.x509.Time.superclass.constructor.call(this);var t=he.asn1,n=t.DERUTCTime,r=t.DERGeneralizedTime;this.setTimeParams=function(e){this.timeParams=e},this.getEncodedHex=function(){var e=null;return e=null!=this.timeParams?"utc"==this.type?new n(this.timeParams):new r(this.timeParams):"utc"==this.type?new n:new r,this.TLV=e.getEncodedHex(),this.TLV},this.type="utc",void 0!==e&&(void 0!==e.type?this.type=e.type:void 0!==e.str&&(e.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),e.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=e)},We(he.asn1.x509.Time,he.asn1.ASN1Object),he.asn1.x509.AlgorithmIdentifier=function(e){he.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var t=he.asn1,n=t.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.getEncodedHex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var e=null;for(var r in n)r===this.nameAlg&&(e=n[r]);if(null!==e)return this.hTLV=e,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=t.x509.OID.name2obj(this.nameAlg));var i=[this.asn1Alg];null!==this.asn1Params&&i.push(this.asn1Params);var a=new t.DERSequence({array:i});return this.hTLV=a.getEncodedHex(),this.hTLV},void 0!==e&&(void 0!==e.name&&(this.nameAlg=e.name),void 0!==e.asn1params&&(this.asn1Params=e.asn1params),void 0!==e.paramempty&&(this.paramEmpty=e.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var r=this.nameAlg.toLowerCase();"withdsa"!==r.substr(-7,7)&&"withecdsa"!==r.substr(-9,9)&&(this.asn1Params=new t.DERNull)}},We(he.asn1.x509.AlgorithmIdentifier,he.asn1.ASN1Object),he.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},he.asn1.x509.GeneralName=function(e){he.asn1.x509.GeneralName.superclass.constructor.call(this);var t={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},n=he.asn1,r=(n.DERSequence,n.DEROctetString),i=n.DERIA5String,a=n.DERTaggedObject,s=n.ASN1Object,o=n.x509.X500Name,u=Te;this.explicit=!1,this.setByParam=function(e){var n=null;if(void 0!==e){if(void 0!==e.rfc822&&(this.type="rfc822",n=new i({str:e[this.type]})),void 0!==e.dns&&(this.type="dns",n=new i({str:e[this.type]})),void 0!==e.uri&&(this.type="uri",n=new i({str:e[this.type]})),void 0!==e.dn&&(this.type="dn",this.explicit=!0,n="string"==typeof e.dn?new o({str:e.dn}):e.dn instanceof he.asn1.x509.X500Name?e.dn:new o(e.dn)),void 0!==e.ldapdn&&(this.type="dn",this.explicit=!0,n=new o({ldapstr:e.ldapdn})),void 0!==e.certissuer){this.type="dn",this.explicit=!0;var c=null;if((h=e.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(c=u(h)),null==c)throw"certissuer param not cert";(f=new Ze).hex=c;var l=f.getIssuerHex();(n=new s).hTLV=l}if(void 0!==e.certsubj){this.type="dn",this.explicit=!0;var h,f;c=null;if((h=e.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=h.indexOf("-----BEGIN ")&&(c=u(h)),null==c)throw"certsubj param not cert";(f=new Ze).hex=c;l=f.getSubjectHex();(n=new s).hTLV=l}if(void 0!==e.ip){this.type="ip",this.explicit=!1;var p,d=e.ip,g="malformed IP address";if(d.match(/^[0-9.]+[.][0-9.]+$/)){if(8!==(p=Ve("["+d.split(".").join(",")+"]")).length)throw g}else if(d.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))p=je(d);else{if(!d.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw g;p=d}n=new r({hex:p})}if(null==this.type)throw"unsupported type in params="+e;this.asn1Obj=new a({explicit:this.explicit,tag:t[this.type],obj:n})}},this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.x509.GeneralName,he.asn1.ASN1Object),he.asn1.x509.GeneralNames=function(e){he.asn1.x509.GeneralNames.superclass.constructor.call(this);var t=he.asn1;this.setByParamArray=function(e){for(var n=0;n<e.length;n++){var r=new t.x509.GeneralName(e[n]);this.asn1Array.push(r)}},this.getEncodedHex=function(){return new t.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==e&&this.setByParamArray(e)},We(he.asn1.x509.GeneralNames,he.asn1.ASN1Object),he.asn1.x509.OID=new function(e){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var t=this.name2oidList[e],n=new he.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var t;if(e.match(/^\d+\.\d+\.[0-9.]+$/))t=e;else if(void 0!==this.atype2oidList[e])t=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw"AttributeType name undefined: "+e;t=this.name2oidList[e]}var n=new he.asn1.DERObjectIdentifier({oid:t});return this.objCache[e]=n,n}},he.asn1.x509.OID.oid2name=function(e){var t=he.asn1.x509.OID.name2oidList;for(var n in t)if(t[n]==e)return n;return""},he.asn1.x509.OID.oid2atype=function(e){var t=he.asn1.x509.OID.atype2oidList;for(var n in t)if(t[n]==e)return n;return e},he.asn1.x509.OID.name2oid=function(e){if(e.match(/^[0-9.]+$/))return e;var t=he.asn1.x509.OID.name2oidList;return void 0===t[e]?"":t[e]},he.asn1.x509.X509Util={},he.asn1.x509.X509Util.newCertPEM=function(e){var t=he.asn1.x509;t.TBSCertificate;return new(0,t.Certificate)(e).getPEM()},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.cms&&he.asn1.cms||(he.asn1.cms={}),he.asn1.cms.Attribute=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERSet,a=n.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(e){this.params=e},this.getValueArray=function(){throw new t("not yet implemented abstract")},this.getEncodedHex=function(){var e=new a({oid:this.typeOid}),t=new i({array:this.getValueArray()});return new r({array:[e,t]}).getEncodedHex()}},We(he.asn1.cms.Attribute,he.asn1.ASN1Object),he.asn1.cms.ContentType=function(e){var t=he.asn1;t.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new t.DERObjectIdentifier(this.params.type)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.ContentType,he.asn1.cms.Attribute),he.asn1.cms.MessageDigest=function(e){var t=he.asn1,n=t.DEROctetString;t.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new n(this.params)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.MessageDigest,he.asn1.cms.Attribute),he.asn1.cms.SigningTime=function(e){var t=he.asn1;t.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new t.x509.Time(this.params)]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningTime,he.asn1.cms.Attribute),he.asn1.cms.SigningCertificate=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=r.cms,s=a.ESSCertID;n.crypto;a.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var n=this.params.array,r=[],a=0;a<n.length;a++){var o=n[a];0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!de.isASN1HEX(o)||(o={cert:o}),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new s(o))}var u=new i({array:r});return[new i({array:[u]})]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningCertificate,he.asn1.cms.Attribute),he.asn1.cms.ESSCertID=function(e){he.asn1.cms.ESSCertID.superclass.constructor.call(this);var t=Error,n=he,r=n.asn1,i=r.DEROctetString,a=r.DERSequence,s=r.cms.IssuerSerial;this.params=null,this.getCertHash=function(e,r){if(null!=e.hash)return e.hash;if("string"==typeof e&&-1==e.indexOf("-----BEGIN")&&!de.isASN1HEX(e))return e;var i,a,s;if("string"==typeof e)i=e;else{if(null==e.cert)throw new t("hash nor cert unspecified");i=e.cert}if(a=-1!=i.indexOf("-----BEGIN")?Te(i):i,"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?a=Te(e):de.isASN1HEX(e)&&(a=e)),null!=e.alg)s=e.alg;else{if(null==r)throw new t("hash alg unspecified");s=r}return n.crypto.Util.hashHex(a,s)},this.getEncodedHex=function(){var e=this.params,t=this.getCertHash(e,"sha1"),n=[];return n.push(new i({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&n.push(new s(e)),new a({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.ESSCertID,he.asn1.ASN1Object),he.asn1.cms.SigningCertificateV2=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=(r.x509,r.cms),s=a.ESSCertIDv2;n.crypto;a.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new t("parameter 'array' not specified");for(var n=this.params.array,r=[],a=0;a<n.length;a++){var o=n[a];null==e.alg&&0!=e.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!de.isASN1HEX(o)||(o={cert:o}),null==o.alg&&null!=e.alg&&(o.alg=e.alg),0!=o.hasis&&0==e.hasis&&(o.hasis=!1),r.push(new s(o))}var u=new i({array:r});return[new i({array:[u]})]},null!=e&&this.setByParam(e)},We(he.asn1.cms.SigningCertificateV2,he.asn1.cms.Attribute),he.asn1.cms.ESSCertIDv2=function(e){he.asn1.cms.ESSCertIDv2.superclass.constructor.call(this);Error;var t=he.asn1,n=t.DEROctetString,r=t.DERSequence,i=t.cms.IssuerSerial,a=t.x509.AlgorithmIdentifier;this.params=null,this.getEncodedHex=function(){var e=this.params,t=this.getCertHash(e,"sha256"),s=[];return null!=e.alg&&"sha256"!=e.alg&&s.push(new a({name:e.alg})),s.push(new n({hex:t})),("string"==typeof e&&-1!=e.indexOf("-----BEGIN")||null!=e.cert&&0!=e.hasis||null!=e.issuer&&null!=e.serial)&&s.push(new i(e)),new r({array:s}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.ESSCertIDv2,he.asn1.cms.ESSCertID),he.asn1.cms.IssuerSerial=function(e){var t=Error,n=he.asn1,r=n.DERInteger,i=n.DERSequence,a=n.cms,s=n.x509.GeneralNames,o=Ze;a.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e,n,a=this.params;if("string"==typeof a&&-1!=a.indexOf("-----BEGIN")||null!=a.cert){var u;u=null!=a.cert?a.cert:a;var c=new o;c.readCertPEM(u),e=c.getIssuer(),n={hex:c.getSerialNumberHex()}}else{if(null==a.issuer||!a.serial)throw new t("cert or issuer and serial parameter not specified");e=a.issuer,n=a.serial}var l=new s([{dn:e}]),h=new r(n);return new i({array:[l,h]}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.IssuerSerial,he.asn1.ASN1Object),he.asn1.cms.SignerIdentifier=function(e){var t=he.asn1,n=(t.DERInteger,t.DERSequence,t.cms),r=n.IssuerAndSerialNumber,i=n.SubjectKeyIdentifier;t.x509.X500Name,Error;n.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if("isssn"==e.type)return new r(e).getEncodedHex();if("skid"==e.type)return new i(e).getEncodedHex();throw new Error("wrong property for isssn or skid")},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignerIdentifier,he.asn1.ASN1Object),he.asn1.cms.IssuerAndSerialNumber=function(e){var t=he.asn1,n=t.DERInteger,r=t.DERSequence,i=t.cms,a=t.x509.X500Name,s=Ze,o=Error;i.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e,t,i=this.params;if("string"==typeof i&&-1!=i.indexOf("-----BEGIN")||null!=i.cert){var u;u=null!=i.cert?i.cert:i;var c=new s;c.readCertPEM(u),e=c.getIssuer(),t={hex:c.getSerialNumberHex()}}else{if(null==i.issuer||!i.serial)throw new o("cert or issuer and serial parameter not specified");e=i.issuer,t=i.serial}var l=new a(e),h=new n(t);return new r({array:[l,h]}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.IssuerAndSerialNumber,he.asn1.ASN1Object),he.asn1.cms.SubjectKeyIdentifier=function(e){var t=he.asn1,n=(t.DERInteger,t.DERSequence,t.ASN1Util.newObject),r=t.cms,i=(r.IssuerAndSerialName,r.SubjectKeyIdentifier,t.x509.X500Name,Ze),a=Error;r.SubjectKeyIdentifier.superclass.constructor.call(this),this.getEncodedHex=function(){var e,t=this.params;if(null==t.cert&&null==t.skid)throw new a("property cert nor skid undefined");null!=t.cert?e=new i(t.cert).getExtSubjectKeyIdentifier().kid.hex:null!=t.skid&&(e=t.skid);return n({tag:{tage:"a0",obj:{octstr:{hex:e}}}}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SubjectKeyIdentifier,he.asn1.ASN1Object),he.asn1.cms.AttributeList=function(e){var t=Error,n=he.asn1,r=n.DERSet,i=n.cms;i.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params;if(null!=this.hTLV)return this.hTLV;var n=!0;null!=e.sortflag&&(n=e.sortflag);for(var a=e.array,s=[],o=0;o<a.length;o++){var u=a[o],c=u.attr;if("contentType"==c)s.push(new i.ContentType(u));else if("messageDigest"==c)s.push(new i.MessageDigest(u));else if("signingTime"==c)s.push(new i.SigningTime(u));else if("signingCertificate"==c)s.push(new i.SigningCertificate(u));else if("signingCertificateV2"==c)s.push(new i.SigningCertificateV2(u));else if("signaturePolicyIdentifier"==c)s.push(new he.asn1.cades.SignaturePolicyIdentifier(u));else{if("signatureTimeStamp"!=c&&"timeStampToken"!=c)throw new t("unknown attr: "+c);s.push(new he.asn1.cades.SignatureTimeStamp(u))}}var l=new r({array:s,sortflag:n});return this.hTLV=l.getEncodedHex(),this.hTLV},null!=e&&this.setByParam(e)},We(he.asn1.cms.AttributeList,he.asn1.ASN1Object),he.asn1.cms.SignerInfo=function(e){var t=Error,n=he,r=n.asn1,i=r.DERInteger,a=r.DEROctetString,s=r.DERSequence,o=r.DERTaggedObject,u=r.cms,c=u.SignerIdentifier,l=u.AttributeList,h=(u.ContentType,u.EncapsulatedContentInfo,u.MessageDigest,u.SignedData,r.x509.AlgorithmIdentifier),f=n.crypto,p=Ye;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var e=this.params,t=e.sigalg,n=new l(e.sattrs).getEncodedHex(),r=p.getKey(e.signkey),i=new f.Signature({alg:t});i.init(r),i.updateHex(n);var a=i.sign();e.sighex=a},this.getEncodedHex=function(){var e=this.params,n=[];if(n.push(new i({int:e.version})),n.push(new c(e.id)),n.push(new h({name:e.hashalg})),null!=e.sattrs){var r=new l(e.sattrs);try{n.push(new o({tag:"a0",explicit:!1,obj:r}))}catch(e){throw new t("si sattr error: "+e)}}if(null!=e.sigalgfield?n.push(new h({name:e.sigalgfield})):n.push(new h({name:e.sigalg})),null==e.sighex&&null!=e.signkey&&this.sign(),n.push(new a({hex:e.sighex})),null!=e.uattrs){r=new l(e.uattrs);try{n.push(new o({tag:"a1",explicit:!1,obj:r}))}catch(e){throw new t("si uattr error: "+e)}}return new s({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignerInfo,he.asn1.ASN1Object),he.asn1.cms.EncapsulatedContentInfo=function(e){var t=he.asn1,n=t.DERTaggedObject,r=t.DERSequence,i=t.DERObjectIdentifier,a=t.DEROctetString;t.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];if(t.push(new i(e.type)),null!=e.content&&(null!=e.content.hex||null!=e.content.str)&&1!=e.isDetached){var s=new a(e.content),o=new n({tag:"a0",explicit:!0,obj:s});t.push(o)}return new r({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.EncapsulatedContentInfo,he.asn1.ASN1Object),he.asn1.cms.ContentInfo=function(e){var t=he.asn1,n=t.DERTaggedObject,r=t.DERSequence,i=t.DERObjectIdentifier;t.x509.OID.name2obj;he.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];t.push(new i(e.type));var a=new n({tag:"a0",explicit:!0,obj:e.obj});return t.push(a),new r({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cms.ContentInfo,he.asn1.ASN1Object),he.asn1.cms.SignedData=function(e){Error;var t=he.asn1,n=(t.ASN1Object,t.DERInteger),r=t.DERSet,i=t.DERSequence,a=(t.DERTaggedObject,t.cms),s=a.EncapsulatedContentInfo,o=a.SignerInfo,u=a.ContentInfo,c=a.CertificateSet,l=a.RevocationInfoChoices,h=t.x509.AlgorithmIdentifier;he.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var e=this.params;this._setDigestAlgs(e),this._setContentTypeByEContent(e),this._setMessageDigestByEContent(e),this._setSignerInfoVersion(e),this._setSignedDataVersion(e)},this._setDigestAlgs=function(e){for(var t={},n=e.sinfos,r=0;r<n.length;r++){t[n[r].hashalg]=1}e.hashalgs=Object.keys(t).sort()},this._setContentTypeByEContent=function(e){for(var t=e.econtent.type,n=e.sinfos,r=0;r<n.length;r++){var i=n[r];this._getAttrParamByName(i,"contentType").type=t}},this._setMessageDigestByEContent=function(e){var t=e.econtent,n=(e.econtent.type,t.content.hex);null==n&&"data"==t.type&&null!=t.content.str&&(n=De(t.content.str));for(var r=e.sinfos,i=0;i<r.length;i++){var a=r[i],s=a.hashalg,o=this._getAttrParamByName(a,"messageDigest"),u=he.crypto.Util.hashHex(n,s);o.hex=u}},this._getAttrParamByName=function(e,t){for(var n=e.sattrs.array,r=0;r<n.length;r++)if(n[r].attr==t)return n[r]},this._setSignerInfoVersion=function(e){for(var t=e.sinfos,n=0;n<t.length;n++){var r=t[n],i=1;"skid"==r.id.type&&(i=3),r.version=i}},this._setSignedDataVersion=function(e){var t=this._getSignedDataVersion(e);e.version=t},this._getSignedDataVersion=function(e){if(null!=e.revinfos)for(var t=e.revinfos,n=0;n<t.length;n++){if(null!=t[n].ocsp)return 5}var r=e.sinfos;for(n=0;n<r.length;n++){if(3==e.sinfos[n].version)return 3}return"data"!=e.econtent.type?3:1},this.getEncodedHex=function(){var e=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=e.fixed&&this.checkAndFixParam();var t=[];t.push(new n({int:e.version}));for(var a=[],u=0;u<e.hashalgs.length;u++){var f=e.hashalgs[u];a.push(new h({name:f}))}t.push(new r({array:a})),t.push(new s(e.econtent)),null!=e.certs&&t.push(new c(e.certs)),null!=e.revinfos&&t.push(new l(e.revinfos));var p=[];for(u=0;u<e.sinfos.length;u++){var d=e.sinfos[u];p.push(new o(d))}return t.push(new r({array:p})),new i({array:t}).getEncodedHex()},this.getContentInfo=function(){return new u({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.SignedData,he.asn1.ASN1Object),he.asn1.cms.CertificateSet=function(e){he.asn1.cms.CertificateSet.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.DERTaggedObject,i=n.DERSet,a=n.ASN1Object;this.params=null,this.getEncodedHex=function(){var e,n=this.params,s=[];if(n instanceof Array)e=n;else{if(null==n.array)throw new t("cert array not specified");e=n.array}for(var o=0;o<e.length;o++){var u=Te(e[o]),c=new a;c.hTLV=u,s.push(c)}var l={array:s};0==n.sortflag&&(l.sortflag=!1);var h=new i(l);return new r({tag:"a0",explicit:!1,obj:h}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.CertificateSet,he.asn1.ASN1Object),he.asn1.cms.RevocationInfoChoices=function(e){he.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(!e instanceof Array)throw new Error("params is not array");for(var t=[],n=0;n<e.length;n++)t.push(new he.asn1.cms.RevocationInfoChoice(e[n]));return he.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:t}}}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.RevocationInfoChoices,he.asn1.ASN1Object),he.asn1.cms.RevocationInfoChoice=function(e){he.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(null!=e.crl&&"string"==typeof e.crl){var t=e.crl;return-1!=e.crl.indexOf("-----BEGIN")&&(t=Te(e.crl)),t}if(null!=e.ocsp)return he.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new he.asn1.cms.OtherRevocationFormat(e)}}).getEncodedHex();throw new Error("property crl or ocsp undefined")},null!=e&&this.setByParam(e)},We(he.asn1.cms.RevocationInfoChoice,he.asn1.ASN1Object),he.asn1.cms.OtherRevocationFormat=function(e){he.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var t=Error,n=he,r=n.asn1.ASN1Util.newObject,i=n.lang.String.isHex;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.ocsp)throw new t("property ocsp not specified");if(!i(e.ocsp)||!de.isASN1HEX(e.ocsp))throw new t("ocsp value not ASN.1 hex string");return r({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:e.ocsp}}]}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cms.OtherRevocationFormat,he.asn1.ASN1Object),he.asn1.cms.CMSUtil=new function(){},he.asn1.cms.CMSUtil.newSignedData=function(e){return new he.asn1.cms.SignedData(e)},he.asn1.cms.CMSUtil.verifySignedData=function(e){var t=he,n=t.asn1,r=n.cms,i=(r.SignerInfo,r.SignedData,r.SigningTime,r.SigningCertificate,r.SigningCertificateV2,n.cades.SignaturePolicyIdentifier,t.lang.String.isHex),a=de,s=a.getVbyList,o=a.getTLVbyList,u=a.getIdxbyList,c=a.getChildIdx,l=a.getTLV,h=a.oidname,f=t.crypto.Util.hashHex;void 0===e.cms&&i(e.cms);var p=e.cms,d=function(e,t){var n=t.idx;t.signerid_issuer1=o(e,n,[1,0],"30"),t.signerid_serial1=s(e,n,[1,1],"02"),t.hashalg=h(s(e,n,[2,0],"06"));var r=u(e,n,[3],"a0");t.idxSignedAttrs=r,g(e,t,r);var i=c(e,n).length;if(i<6)throw"malformed SignerInfo";t.sigalg=h(s(e,n,[i-2,0],"06")),t.sigval=s(e,n,[i-1],"04")},g=function(e,t,n){var r=c(e,n);t.signedAttrIdxList=r;for(var i=0;i<r.length;i++){var a,o=r[i],u=s(e,o,[0],"06");"2a864886f70d010905"===u?(a=Fe(s(e,o,[1,0])),t.saSigningTime=a):"2a864886f70d010904"===u&&(a=s(e,o,[1,0],"04"),t.saMessageDigest=a)}},m=function(e,t,n,r){n.verifyDetail={};var i=n.verifyDetail,a=t.parse.econtent,s=n.hashalg,o=n.saMessageDigest;i.validMessageDigest=!1,f(a,s)===o&&(i.validMessageDigest=!0),function(e,t,n,r){var i,a=t.parse.certsIdx;if(void 0===t.certs){i=[],t.certkeys=[];for(var s=c(e,a),o=0;o<s.length;o++){var u=l(e,s[o]),h=new Ze;h.readCertHex(u),i[o]=h,t.certkeys[o]=h.getPublicKey()}t.certs=i}else i=t.certs;t.cccc=i.length,t.cccci=s.length;for(o=0;o<i.length;o++){var f=h.getIssuerHex(),p=h.getSerialNumberHex();n.signerid_issuer1===f&&n.signerid_serial1===p&&(n.certkey_idx=o)}}(e,t,n),i.validSignatureValue=!1;var u=n.sigalg,h="31"+l(e,n.idxSignedAttrs).substr(2);n.signedattrshex=h;var p=t.certs[n.certkey_idx].getPublicKey(),d=new he.crypto.Signature({alg:u});d.init(p),d.updateHex(h);var g=d.verify(n.sigval);i.validSignatureValue_isValid=g,!0===g&&(i.validSignatureValue=!0),n.isValid=!1,i.validMessageDigest&&i.validSignatureValue&&(n.isValid=!0)},v={isValid:!1,parse:{}};return function(e,t){if("2a864886f70d010702"!==s(e,0,[0],"06"))return t;t.cmsType="signedData",t.econtent=s(e,0,[1,0,2,1,0]),function(e,t){for(var n,r=3;r<6;r++)if(void 0!==(n=u(e,0,[1,0,r]))){var i=e.substr(n,2);"a0"===i&&(t.certsIdx=n),"a1"===i&&(t.revinfosIdx=n),"31"===i&&(t.signerinfosIdx=n)}}(e,t),t.signerInfos=[],function(e,t){var n=t.signerinfosIdx;if(void 0!==n){var r=c(e,n);t.signerInfoIdxList=r;for(var i=0;i<r.length;i++){var a={idx:r[i]};d(e,a),t.signerInfos.push(a)}}}(e,t)}(p,v.parse),function(e,t){for(var n=t.parse.signerInfos,r=n.length,i=!0,a=0;a<r;a++){var s=n[a];m(e,t,s,a),s.isValid||(i=!1)}t.isValid=i}(p,v),v},he.asn1.cms.CMSParser=function(){var e=Error,t=Ze,n=new t,r=de,i=r.getV,a=r.getTLV,s=(r.getIdxbyList,r.getTLVbyList),o=r.getTLVbyListEx,u=r.getVbyList,c=r.getVbyListEx,l=r.getChildIdx;this.getCMSSignedData=function(e){var t=s(e,0,[1,0]);return this.getSignedData(t)},this.getSignedData=function(e){var t=l(e,0),n={},r=i(e,t[0]),s=parseInt(r,16);n.version=s;var u=a(e,t[1]);n.hashalgs=this.getHashAlgArray(u);var c=a(e,t[2]);n.econtent=this.getEContent(c);var h=o(e,0,["[0]"]);null!=h&&(n.certs=this.getCertificateSet(h));o(e,0,["[1]"]);var f=o(e,0,[3]);return n.sinfos=this.getSignerInfos(f),n},this.getHashAlgArray=function(e){for(var n=l(e,0),r=new t,i=[],s=0;s<n.length;s++){var o=a(e,n[s]),u=r.getAlgorithmIdentifierName(o);i.push(u)}return i},this.getEContent=function(e){var t={},n=u(e,0,[0]),r=u(e,0,[1,0]);return t.type=he.asn1.x509.OID.oid2name(de.hextooidstr(n)),t.content={hex:r},t},this.getSignerInfos=function(e){for(var t=[],n=l(e,0),r=0;r<n.length;r++){var i=a(e,n[r]),s=this.getSignerInfo(i);t.push(s)}return t},this.getSignerInfo=function(e){var t={},i=l(e,0),s=r.getInt(e,i[0],-1);-1!=s&&(t.version=s);var u=a(e,i[1]),h=this.getIssuerAndSerialNumber(u);t.id=h;var f=a(e,i[2]),p=n.getAlgorithmIdentifierName(f);t.hashalg=p;var d=o(e,0,["[0]"]);if(null!=d){var g=this.getAttributeList(d);t.sattrs=g}var m=o(e,0,[3]),v=n.getAlgorithmIdentifierName(m);t.sigalg=v;var y=c(e,0,[4]);t.sighex=y;var b=o(e,0,["[1]"]);if(null!=b){var w=this.getAttributeList(b);t.uattrs=w}return t},this.getSignerIdentifier=function(e){if("30"==e.substr(0,2))return this.getIssuerAndSerialNumber(e);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(e){var t={type:"isssn"},r=l(e,0),s=a(e,r[0]);t.issuer=n.getX500Name(s);var o=i(e,r[1]);return t.serial={hex:o},t},this.getAttributeList=function(e){for(var t=[],n=l(e,0),r=0;r<n.length;r++){var i=a(e,n[r]),s=this.getAttribute(i);t.push(s)}return{array:t}},this.getAttribute=function(e){var t={},n=l(e,0),i=r.getOID(e,n[0]),s=he.asn1.x509.OID.oid2name(i);t.attr=s;var o=a(e,n[1]),u=l(o,0);if(1==u.length)t.valhex=a(o,u[0]);else{for(var c=[],h=0;h<u.length;h++)c.push(a(o,u[h]));t.valhex=c}return"contentType"==s?this.setContentType(t):"messageDigest"==s?this.setMessageDigest(t):"signingTime"==s?this.setSigningTime(t):"signingCertificate"==s?this.setSigningCertificate(t):"signingCertificateV2"==s?this.setSigningCertificateV2(t):"signaturePolicyIdentifier"==s&&this.setSignaturePolicyIdentifier(t),t},this.setContentType=function(e){var t=r.getOIDName(e.valhex,0,null);null!=t&&(e.type=t,delete e.valhex)},this.setSigningTime=function(e){var t=Fe(i(e.valhex,0));e.str=t,delete e.valhex},this.setMessageDigest=function(e){var t=i(e.valhex,0);e.hex=t,delete e.valhex},this.setSigningCertificate=function(e){var t=l(e.valhex,0);if(t.length>0){for(var n=a(e.valhex,t[0]),r=l(n,0),i=[],s=0;s<r.length;s++){var o=a(n,r[s]),u=this.getESSCertID(o);i.push(u)}e.array=i}if(t.length>1){var c=a(e.valhex,t[1]);e.polhex=c}delete e.valhex},this.setSignaturePolicyIdentifier=function(e){var n=l(e.valhex,0);if(n.length>0){var s=r.getOID(e.valhex,n[0]);e.oid=s}if(n.length>1){var o=new t,u=l(e.valhex,n[1]),c=a(e.valhex,u[0]),h=o.getAlgorithmIdentifierName(c);e.alg=h;var f=i(e.valhex,u[1]);e.hash=f}delete e.valhex},this.setSigningCertificateV2=function(e){var t=l(e.valhex,0);if(t.length>0){for(var n=a(e.valhex,t[0]),r=l(n,0),i=[],s=0;s<r.length;s++){var o=a(n,r[s]),u=this.getESSCertIDv2(o);i.push(u)}e.array=i}if(t.length>1){var c=a(e.valhex,t[1]);e.polhex=c}delete e.valhex},this.getESSCertID=function(e){var t={},n=l(e,0);if(n.length>0){var r=i(e,n[0]);t.hash=r}if(n.length>1){var s=a(e,n[1]),o=this.getIssuerSerial(s);null!=o.serial&&(t.serial=o.serial),null!=o.issuer&&(t.issuer=o.issuer)}return t},this.getESSCertIDv2=function(t){var r={},s=l(t,0);if(s.length<1||3<s.length)throw new e("wrong number of elements");var o=0;if("30"==t.substr(s[0],2)){var u=a(t,s[0]);r.alg=n.getAlgorithmIdentifierName(u),o++}else r.alg="sha256";var c=i(t,s[o]);if(r.hash=c,s.length>o+1){var h=a(t,s[o+1]),f=this.getIssuerSerial(h);r.issuer=f.issuer,r.serial=f.serial}return r},this.getIssuerSerial=function(e){var t={},r=l(e,0),s=a(e,r[0]),o=n.getGeneralNames(s)[0].dn;t.issuer=o;var u=i(e,r[1]);return t.serial={hex:u},t},this.getCertificateSet=function(e){for(var t=l(e,0),n=[],r=0;r<t.length;r++){var i=a(e,t[r]);if("30"==i.substr(0,2)){var s=Ie(i,"CERTIFICATE");n.push(s)}}return{array:n,sortflag:!1}}},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.tsp&&he.asn1.tsp||(he.asn1.tsp={}),he.asn1.tsp.TimeStampToken=function(e){var t=he.asn1.tsp;t.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var e=new t.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=e.getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampToken,he.asn1.cms.SignedData),he.asn1.tsp.TSTInfo=function(e){Error;var t=he.asn1,n=t.DERSequence,r=t.DERInteger,i=t.DERBoolean,a=t.DERGeneralizedTime,s=t.DERObjectIdentifier,o=t.DERTaggedObject,u=t.tsp,c=u.MessageImprint,l=u.Accuracy,h=(t.x509.X500Name,t.x509.GeneralName);if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new r({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.getEncodedHex=function(){var e=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(e.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(e.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(e.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");e.push(this.dGenTime),null!=this.dAccuracy&&e.push(this.dAccuracy),null!=this.dOrdering&&e.push(this.dOrdering),null!=this.dNonce&&e.push(this.dNonce),null!=this.dTsa&&e.push(this.dTsa);var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){if("string"==typeof e.policy){if(!e.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new s({oid:e.policy})}void 0!==e.messageImprint&&(this.dMessageImprint=new c(e.messageImprint)),void 0!==e.serial&&(this.dSerial=new r(e.serial)),void 0!==e.genTime&&(this.dGenTime=new a(e.genTime)),void 0!==e.accuracy&&(this.dAccuracy=new l(e.accuracy)),void 0!==e.ordering&&1==e.ordering&&(this.dOrdering=new i),void 0!==e.nonce&&(this.dNonce=new r(e.nonce)),void 0!==e.tsa&&(this.dTsa=new o({tag:"a0",explicit:!0,obj:new h({dn:e.tsa})}))}},We(he.asn1.tsp.TSTInfo,he.asn1.ASN1Object),he.asn1.tsp.Accuracy=function(e){var t=he.asn1,n=t.ASN1Util.newObject;t.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return null!=e.seconds&&"number"==typeof e.seconds&&t.push({int:e.seconds}),null!=e.millis&&"number"==typeof e.millis&&t.push({tag:{tagi:"80",obj:{int:e.millis}}}),null!=e.micros&&"number"==typeof e.micros&&t.push({tag:{tagi:"81",obj:{int:e.micros}}}),n({seq:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.Accuracy,he.asn1.ASN1Object),he.asn1.tsp.MessageImprint=function(e){var t=he.asn1,n=t.DERSequence,r=t.DEROctetString,i=t.x509.AlgorithmIdentifier;t.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=new i({name:e.alg}),a=new r({hex:e.hash});return new n({array:[t,a]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.tsp.MessageImprint,he.asn1.ASN1Object),he.asn1.tsp.TimeStampReq=function(e){var t=he.asn1,n=t.DERSequence,r=t.DERInteger,i=t.DERBoolean,a=(t.ASN1Object,t.DERObjectIdentifier),s=t.tsp,o=s.MessageImprint;s.TimeStampReq.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return t.push(new r({int:1})),e.messageImprint instanceof he.asn1.ASN1Object?t.push(e.messageImprint):t.push(new o(e.messageImprint)),null!=e.policy&&t.push(new a(e.policy)),null!=e.nonce&&t.push(new r(e.nonce)),1==e.certreq&&t.push(new i),new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampReq,he.asn1.ASN1Object),he.asn1.tsp.TimeStampResp=function(e){var t=he.asn1,n=t.DERSequence,r=(t.ASN1Object,t.tsp),i=r.PKIStatusInfo;r.TimeStampResp.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,a=[new i(e.statusinfo)];return null!=e.econtent&&a.push(new r.TimeStampToken(e).getContentInfo()),null!=e.tst&&e.tst instanceof t.ASN1Object&&a.push(e.tst),new n({array:a}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.TimeStampResp,he.asn1.ASN1Object),he.asn1.tsp.PKIStatusInfo=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.tsp,a=i.PKIStatus,s=i.PKIFreeText,o=i.PKIFailureInfo;i.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,n=[];if("string"==typeof e)n.push(new a(e));else{if(null==e.status)throw new t("property 'status' unspecified");n.push(new a(e.status)),null!=e.statusstr&&n.push(new s(e.statusstr)),null!=e.failinfo&&n.push(new o(e.failinfo))}return new r({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIStatusInfo,he.asn1.ASN1Object),he.asn1.tsp.PKIStatus=function(e){var t=Error,n=he.asn1,r=n.DERInteger;n.tsp.PKIStatus.superclass.constructor.call(this);var i={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.getEncodedHex=function(){var e,n=this.params;if("string"==typeof n)try{e=i[n]}catch(e){throw new t("undefined name: "+n)}else{if("number"!=typeof n)throw new t("unsupported params");e=n}return new r({int:e}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIStatus,he.asn1.ASN1Object),he.asn1.tsp.PKIFreeText=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERUTF8String;n.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(!e instanceof Array)throw new t("wrong params: not array");for(var n=[],a=0;a<e.length;a++)n.push(new i({str:e[a]}));return new r({array:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIFreeText,he.asn1.ASN1Object),he.asn1.tsp.PKIFailureInfo=function(e){var t=Error,n=he.asn1,r=n.DERBitString,i=n.tsp.PKIFailureInfo,a={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};i.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e,n=this.params;if("string"==typeof n)try{e=a[n]}catch(e){throw new t("undefined name: "+n)}else{if("number"!=typeof n)throw new t("wrong params");e=n}return new r({bin:e.toString(2)}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.tsp.PKIFailureInfo,he.asn1.ASN1Object),he.asn1.tsp.AbstractTSAAdapter=function(e){this.getTSTHex=function(e,t){throw"not implemented yet"}},he.asn1.tsp.SimpleTSAAdapter=function(e){var t=he,n=t.asn1.tsp,r=t.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(e,t){var i=r(e,t);this.params.econtent.content.messageImprint={alg:t,hash:i},this.params.econtent.content.serial={int:this.serial++};var a=Math.floor(1e9*Math.random());return this.params.econtent.content.nonce={int:a},new n.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.tsp.SimpleTSAAdapter,he.asn1.tsp.AbstractTSAAdapter),he.asn1.tsp.FixedTSAAdapter=function(e){var t=he,n=t.asn1.tsp,r=t.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(e,t){var i=r(e,t);return this.params.econtent.content.messageImprint={alg:t,hash:i},new n.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==e&&(this.params=e)},We(he.asn1.tsp.FixedTSAAdapter,he.asn1.tsp.AbstractTSAAdapter),he.asn1.tsp.TSPUtil=new function(){},he.asn1.tsp.TSPUtil.newTimeStampToken=function(e){return new he.asn1.tsp.TimeStampToken(e)},he.asn1.tsp.TSPUtil.parseTimeStampReq=function(e){var t=de,n=t.getChildIdx,r=t.getV,i=t.getTLV,a={certreq:!1},s=n(e,0);if(s.length<2)throw"TimeStampReq must have at least 2 items";var o=i(e,s[1]);a.messageImprint=he.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var u=2;u<s.length;u++){var c=s[u],l=e.substr(c,2);if("06"==l){var h=r(e,c);a.policy=t.hextooidstr(h)}"02"==l&&(a.nonce=r(e,c)),"01"==l&&(a.certreq=!0)}return a},he.asn1.tsp.TSPUtil.parseMessageImprint=function(e){var t=de,n=t.getChildIdx,r=t.getV,i=t.getIdxbyList,a={};if("30"!=e.substr(0,2))throw"head of messageImprint hex shall be '30'";n(e,0);var s=r(e,i(e,0,[0,0])),o=t.hextooidstr(s),u=he.asn1.x509.OID.oid2name(o);if(""==u)throw"hashAlg name undefined: "+o;var c=u,l=i(e,0,[1]);return a.alg=c,a.hash=r(e,l),a},he.asn1.tsp.TSPParser=function(){Error;var e=new Ze,t=de,n=t.getV,r=t.getTLV,i=t.getIdxbyList,a=(t.getTLVbyListEx,t.getChildIdx),s=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],o={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(e){var t=a(e,0);if(1==t.length)return this.getPKIStatusInfo(r(e,t[0]));if(t.length>1){var n=this.getPKIStatusInfo(r(e,t[0])),i=r(e,t[1]),s=this.getToken(i);return s.statusinfo=n,s}},this.getToken=function(e){var t=(new he.asn1.cms.CMSParser).getCMSSignedData(e);return this.setTSTInfo(t),t},this.setTSTInfo=function(e){var t=e.econtent;if("tstinfo"==t.type){var n=t.content.hex,r=this.getTSTInfo(n);t.content=r}},this.getTSTInfo=function(t){var i={},s=a(t,0),o=n(t,s[1]);i.policy=Ke(o);var u=r(t,s[2]);i.messageImprint=this.getMessageImprint(u);var c=n(t,s[3]);i.serial={hex:c};var l=n(t,s[4]);i.genTime={str:Fe(l)};var h=0;if(s.length>5&&"30"==t.substr(s[5],2)){var f=r(t,s[5]);i.accuracy=this.getAccuracy(f),h++}s.length>5+h&&"01"==t.substr(s[5+h],2)&&("ff"==n(t,s[5+h])&&(i.ordering=!0),h++);if(s.length>5+h&&"02"==t.substr(s[5+h],2)){var p=n(t,s[5+h]);i.nonce={hex:p},h++}if(s.length>5+h&&"a0"==t.substr(s[5+h],2)){var d=r(t,s[5+h]);d="30"+d.substr(2),pGeneralNames=e.getGeneralNames(d);var g=pGeneralNames[0].dn;i.tsa=g,h++}if(s.length>5+h&&"a1"==t.substr(s[5+h],2)){var m=r(t,s[5+h]);m="30"+m.substr(2);var v=e.getExtParamArray(m);i.ext=v,h++}return i},this.getAccuracy=function(e){for(var t={},r=a(e,0),i=0;i<r.length;i++){var s=e.substr(r[i],2),o=n(e,r[i]),u=parseInt(o,16);"02"==s?t.seconds=u:"80"==s?t.millis=u:"81"==s&&(t.micros=u)}return t},this.getMessageImprint=function(e){if("30"!=e.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var r={},s=(a(e,0),i(e,0,[0,0])),o=n(e,s),u=t.hextooidstr(o),c=he.asn1.x509.OID.oid2name(u);if(""==c)throw new Error("hashAlg name undefined: "+u);var l=c,h=i(e,0,[1]);return r.alg=l,r.hash=n(e,h),r},this.getPKIStatusInfo=function(e){var t={},i=a(e,0),o=0;try{var u=n(e,i[0]),c=parseInt(u,16);t.status=s[c]}catch(e){}if(i.length>1&&"30"==e.substr(i[1],2)){var l=r(e,i[1]);t.statusstr=this.getPKIFreeText(l),o++}if(i.length>o&&"03"==e.substr(i[1+o],2)){var h=r(e,i[1+o]);t.failinfo=this.getPKIFailureInfo(h)}return t},this.getPKIFreeText=function(e){for(var n=[],r=a(e,0),i=0;i<r.length;i++)n.push(t.getString(e,r[i]));return n},this.getPKIFailureInfo=function(e){var n=t.getInt(e,0);return null!=o[n]?o[n]:n}},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.cades&&he.asn1.cades||(he.asn1.cades={}),he.asn1.cades.SignaturePolicyIdentifier=function(e){var t=he.asn1.cades,n=t.SignaturePolicyId;t.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new n(this.params)]},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignaturePolicyIdentifier,he.asn1.cms.Attribute),he.asn1.cades.SignaturePolicyId=function(e){var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=(t.x509.AlgorithmIdentifier,t.cades),a=i.SignaturePolicyId,s=i.OtherHashAlgAndValue;a.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,t=[];return t.push(new r(e.oid)),t.push(new s(e)),new n({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignaturePolicyId,he.asn1.ASN1Object),he.asn1.cades.OtherHashAlgAndValue=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DEROctetString,a=n.x509.AlgorithmIdentifier;n.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.alg)throw new t("property 'alg' not specified");if(null==e.hash&&null==e.cert)throw new t("property 'hash' nor 'cert' not specified");var n=null;if(null!=e.hash)n=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var s=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(s=Te(e.cert)),n=he.crypto.Util.hashHex(s,e.alg)}var o=[];return o.push(new a({name:e.alg})),o.push(new i({hex:n})),new r({array:o}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHashAlgAndValue,he.asn1.ASN1Object),he.asn1.cades.OtherHashValue=function(e){he.asn1.cades.OtherHashValue.superclass.constructor.call(this);var t=Error,n=he,r=(n.lang.String.isHex,n.asn1.DEROctetString);n.crypto.Util.hashHex;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null==e.hash&&null==e.cert)throw new t("hash or cert not specified");var n=null;if(null!=e.hash)n=e.hash;else if(null!=e.cert){if("string"!=typeof e.cert)throw new t("cert not string");var i=e.cert;-1!=e.cert.indexOf("-----BEGIN")&&(i=Te(e.cert)),n=he.crypto.Util.hashHex(i,"sha1")}return new r({hex:n}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHashValue,he.asn1.ASN1Object),he.asn1.cades.SignatureTimeStamp=function(e){var t=Error,n=he,r=n.lang.String.isHex,i=n.asn1,a=i.ASN1Object;i.x509;i.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var e=this.params;if(null!=e.tst){if(r(e.tst))return(i=new a).hTLV=e.tst,[i];if(e.tst instanceof a)return[e.tst];throw new t("params.tst has wrong value")}if(null!=e.res){var n=e.res;if(n instanceof a&&(n=n.getEncodedHex()),"string"!=typeof n||!r(n))throw new t("params.res has wrong value");var i;de.getTLVbyList(n,0,[1]);return(i=new a).hTLV=e.tst,[i]}},null!=e&&this.setByParam(e)},We(he.asn1.cades.SignatureTimeStamp,he.asn1.cms.Attribute),he.asn1.cades.CompleteCertificateRefs=function(e){var t=Error,n=he,r=n.asn1,i=r.DERSequence,a=r.cades,s=a.OtherCertID,o=n.lang.String.isHex;a.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var e=this.params,n=[],r=0;r<e.array.length;r++){var a=e.array[r];if("string"==typeof a)if(-1!=a.indexOf("-----BEGIN"))a={cert:a};else{if(!o(a))throw new t("unsupported value: "+a);a={hash:a}}null!=e.alg&&null==a.alg&&(a.alg=e.alg),null!=e.hasis&&null==a.hasis&&(a.hasis=e.hasis);var u=new s(a);n.push(u)}return[new i({array:n})]},null!=e&&this.setByParam(e)},We(he.asn1.cades.CompleteCertificateRefs,he.asn1.cms.Attribute),he.asn1.cades.OtherCertID=function(e){var t=he.asn1,n=t.DERSequence,r=t.cms.IssuerSerial,i=t.cades,a=i.OtherHashValue,s=i.OtherHashAlgAndValue;i.OtherCertID.superclass.constructor.call(this),this.params=e,this.getEncodedHex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:_isHex(e)&&(e={hash:e}));var t=[],i=null;if(i=null!=e.alg?new s(e):new a(e),t.push(i),null!=e.cert&&1==e.hasis||null!=e.issuer&&null!=e.serial){var o=new r(e);t.push(o)}return new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherCertID,he.asn1.ASN1Object),he.asn1.cades.OtherHash=function(e){Error;var t=he,n=t.asn1,r=(n.cms,n.cades),i=r.OtherHashAlgAndValue,a=r.OtherHashValue,s=(t.crypto.Util.hashHex,t.lang.String.isHex);r.OtherHash.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?e={cert:e}:s(e)&&(e={hash:e}));return(null!=e.alg?new i(e):new a(e)).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.cades.OtherHash,he.asn1.ASN1Object),he.asn1.cades.CAdESUtil=new function(){},he.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(e){return(new he.asn1.cms.CMSParser).getCMSSignedData(e)},he.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(e,t,n){var r=de,i=r.getChildIdx,a=r.getTLV,s=r.getV,o=he.asn1,u=o.ASN1Object,c=o.cms,l=c.AttributeList,h=c.SignerInfo,f={},p=i(e,t);if(6!=p.length)throw"not supported items for SignerInfo (!=6)";var d=p.shift();f.version=a(e,d);var g=p.shift();f.si=a(e,g);var m=p.shift();f.digalg=a(e,m);var v=p.shift();f.sattrs=a(e,v);var y=p.shift();f.sigalg=a(e,y);var b=p.shift();f.sig=a(e,b),f.sigval=s(e,b);var w=null;return f.obj=new h,(w=new u).hTLV=f.version,f.obj.dCMSVersion=w,(w=new u).hTLV=f.si,f.obj.dSignerIdentifier=w,(w=new u).hTLV=f.digalg,f.obj.dDigestAlgorithm=w,(w=new u).hTLV=f.sattrs,f.obj.dSignedAttrs=w,(w=new u).hTLV=f.sigalg,f.obj.dSigAlg=w,(w=new u).hTLV=f.sig,f.obj.dSig=w,f.obj.dUnsignedAttrs=new l,f},void 0!==he.asn1.csr&&he.asn1.csr||(he.asn1.csr={}),he.asn1.csr.CertificationRequest=function(e){var t=he.asn1,n=t.DERBitString,r=t.DERSequence,i=t.csr,a=(t.x509,i.CertificationRequestInfo);i.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(e){this.params=e},this.sign=function(){var e=new a(this.params).getEncodedHex(),t=new he.crypto.Signature({alg:this.params.sigalg});t.init(this.params.sbjprvkey),t.updateHex(e);var n=t.sign();this.params.sighex=n},this.getPEM=function(){return Ie(this.getEncodedHex(),"CERTIFICATE REQUEST")},this.getEncodedHex=function(){var e=this.params,t=new he.asn1.csr.CertificationRequestInfo(this.params),i=new he.asn1.x509.AlgorithmIdentifier({name:e.sigalg});if(null==e.sighex&&null!=e.sbjprvkey&&this.sign(),null==e.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var a=new n({hex:"00"+e.sighex});return new r({array:[t,i,a]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.csr.CertificationRequest,he.asn1.ASN1Object),he.asn1.csr.CertificationRequestInfo=function(e){var t=he.asn1,n=(t.DERBitString,t.DERSequence),r=t.DERInteger,i=t.DERUTF8String,a=t.DERTaggedObject,s=t.ASN1Util.newObject,o=t.csr,u=t.x509,c=u.X500Name,l=u.Extensions,h=u.SubjectPublicKeyInfo;o.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(e){null!=e&&(this.params=e)},this.getEncodedHex=function(){var e=this.params,t=[];if(t.push(new r({int:0})),t.push(new c(e.subject)),t.push(new h(Ye.getKey(e.sbjpubkey))),null!=e.extreq){var o=new l(e.extreq),u=s({tag:{tag:"a0",explict:!0,obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[o]}]}}});t.push(u)}else t.push(new a({tag:"a0",explicit:!1,obj:new i({str:""})}));return new n({array:t}).getEncodedHex()},null!=e&&this.setByParam(e)},We(he.asn1.csr.CertificationRequestInfo,he.asn1.ASN1Object),he.asn1.csr.CSRUtil=new function(){},he.asn1.csr.CSRUtil.newCSRPEM=function(e){return new he.asn1.csr.CertificationRequest(e).getPEM()},he.asn1.csr.CSRUtil.getParam=function(e){var t=de,n=t.getV;_getIdxbyList=t.getIdxbyList,_getTLVbyList=t.getTLVbyList,_getTLVbyListEx=t.getTLVbyListEx,_getVbyListEx=t.getVbyListEx;var r={};if(-1==e.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var i=Te(e,"CERTIFICATE REQUEST");try{var a=_getTLVbyListEx(i,0,[0,1]);if("3000"==a)r.subject={};else{var s=new Ze;r.subject=s.getX500Name(a)}}catch(e){}var o=_getTLVbyListEx(i,0,[0,2]),u=Ye.getKey(o,null,"pkcs8pub");r.sbjpubkey=Ye.getPEM(u,"PKCS8PUB");var c,l,h=(c=i,l=_getIdxbyList(c,0,[0,3,0,0],"06"),"2a864886f70d01090e"!=n(c,l)?null:_getTLVbyList(c,0,[0,3,0,1,0],"30"));s=new Ze;null!=h&&(r.extreq=s.getExtParamArray(h));try{var f=_getTLVbyListEx(i,0,[1],"30");s=new Ze;r.sigalg=s.getAlgorithmIdentifierName(f)}catch(e){}try{var p=_getVbyListEx(i,0,[2]);r.sighex=p}catch(e){}return r},void 0!==he&&he||(he={}),void 0!==he.asn1&&he.asn1||(he.asn1={}),void 0!==he.asn1.ocsp&&he.asn1.ocsp||(he.asn1.ocsp={}),he.asn1.ocsp.DEFAULT_HASH="sha1",he.asn1.ocsp.OCSPResponse=function(e){he.asn1.ocsp.OCSPResponse.superclass.constructor.call(this);he.asn1.DEREnumerated;var t=he.asn1.ASN1Util.newObject,n=he.asn1.ocsp.ResponseBytes,r=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var e=this.params.resstatus;return"number"==typeof e?e:"string"!=typeof e?-1:r.indexOf(e)},this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params,r=this._getStatusCode();if(-1==r)throw new Error("responseStatus not supported: "+e.resstatus);if(0!=r)return t({seq:[{enum:{int:r}}]}).getEncodedHex();var i=new n(e);return t({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:i}}]}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.OCSPResponse,he.asn1.ASN1Object),he.asn1.ocsp.ResponseBytes=function(e){he.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.DERObjectIdentifier,i=t.DEROctetString,a=t.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(e){this.params=e},this.getEncodedHex=function(){var e=this.params;if("ocspBasic"!=e.restype)throw new Error("not supported responseType: "+e.restype);var t=new a(e),s=[];return s.push(new r({name:"ocspBasic"})),s.push(new i({hex:t.getEncodedHex()})),new n({array:s}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponseBytes,he.asn1.ASN1Object),he.asn1.ocsp.BasicOCSPResponse=function(e){he.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.ASN1Object,i=n.DERSequence,a=(n.DERGeneralizedTime,n.DERTaggedObject),s=n.DERBitString,o=(n.x509.Extensions,n.x509.AlgorithmIdentifier),u=n.ocsp;u.ResponderID;_SingleResponseList=u.SingleResponseList,_ResponseData=u.ResponseData,this.params=null,this.setByParam=function(e){this.params=e},this.sign=function(){var e=this.params,t=e.tbsresp.getEncodedHex(),n=new he.crypto.Signature({alg:e.sigalg});n.init(e.reskey),n.updateHex(t),e.sighex=n.sign()},this.getEncodedHex=function(){var e=this.params;null==e.tbsresp&&(e.tbsresp=new _ResponseData(e)),null==e.sighex&&null!=e.reskey&&this.sign();var n=[];if(n.push(e.tbsresp),n.push(new o({name:e.sigalg})),n.push(new s({hex:"00"+e.sighex})),null!=e.certs&&null!=e.certs.length){for(var u=[],c=0;c<e.certs.length;c++){var l=e.certs[c],h=null;if(de.isASN1HEX(l))h=l;else{if(!l.match(/-----BEGIN/))throw new t("certs["+c+"] not hex or PEM");h=Te(l)}u.push(new r({tlv:h}))}var f=new i({array:u});n.push(new a({tag:"a0",explicit:!0,obj:f}))}return new i({array:n}).getEncodedHex()},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.BasicOCSPResponse,he.asn1.ASN1Object),he.asn1.ocsp.ResponseData=function(e){he.asn1.ocsp.ResponseData.superclass.constructor.call(this);var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERGeneralizedTime,a=n.DERTaggedObject,s=n.x509.Extensions,o=n.ocsp,u=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.getEncodedHex=function(){var e=this.params;null!=e.respid&&new t("respid not specified"),null!=e.prodat&&new t("prodat not specified"),null!=e.array&&new t("array not specified");var n=[];if(n.push(new u(e.respid)),n.push(new i(e.prodat)),n.push(new _SingleResponseList(e.array)),null!=e.ext){var o=new s(e.ext);n.push(new a({tag:"a1",explicit:!0,obj:o}))}return new r({array:n}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponseData,he.asn1.ASN1Object),he.asn1.ocsp.ResponderID=function(e){he.asn1.ocsp.ResponderID.superclass.constructor.call(this);var t=he.asn1,n=t.ASN1Util.newObject,r=t.x509.X500Name;this.params=null,this.getEncodedHex=function(){var e=this.params;if(null!=e.key)return n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:e.key}}}}).getEncodedHex();if(null!=e.name)return n({tag:{tag:"a1",explicit:!0,obj:new r(e.name)}}).getEncodedHex();throw new Error("key or name not specified")},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.ResponderID,he.asn1.ASN1Object),he.asn1.ocsp.SingleResponseList=function(e){he.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var t=he.asn1,n=t.DERSequence,r=t.ocsp.SingleResponse;this.params=null,this.getEncodedHex=function(){var e=this.params;if("object"!=typeof e||null==e.length)throw new Error("params not specified properly");for(var t=[],i=0;i<e.length;i++)t.push(new r(e[i]));return new n({array:t}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.SingleResponseList,he.asn1.ASN1Object),he.asn1.ocsp.SingleResponse=function(e){var t=Error,n=he.asn1,r=n.DERSequence,i=n.DERGeneralizedTime,a=n.DERTaggedObject,s=n.ocsp,o=s.CertID,u=s.CertStatus,c=n.x509.Extensions;s.SingleResponse.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params,n=[];if(null==e.certid)throw new t("certid unspecified");if(null==e.status)throw new t("status unspecified");if(null==e.thisupdate)throw new t("thisupdate unspecified");if(n.push(new o(e.certid)),n.push(new u(e.status)),n.push(new i(e.thisupdate)),null!=e.nextupdate){var s=new i(e.nextupdate);n.push(new a({tag:"a0",explicit:!0,obj:s}))}if(null!=e.ext){var l=new c(e.ext);n.push(new a({tag:"a1",explicit:!0,obj:l}))}return new r({array:n}).getEncodedHex()},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.SingleResponse,he.asn1.ASN1Object),he.asn1.ocsp.CertID=function(e){var t=he,n=t.asn1,r=n.DEROctetString,i=n.DERInteger,a=n.DERSequence,s=n.x509.AlgorithmIdentifier,o=n.ocsp,u=o.DEFAULT_HASH,c=t.crypto.Util.hashHex,l=Ze,h=de;if(o.CertID.superclass.constructor.call(this),this.dHashAlg=null,this.dIssuerNameHash=null,this.dIssuerKeyHash=null,this.dSerialNumber=null,this.setByValue=function(e,t,n,a){void 0===a&&(a=u),this.dHashAlg=new s({name:a}),this.dIssuerNameHash=new r({hex:e}),this.dIssuerKeyHash=new r({hex:t}),this.dSerialNumber=new i({hex:n})},this.setByCert=function(e,t,n){void 0===n&&(n=u);var r=new l;r.readCertPEM(t);var i=new l;i.readCertPEM(e);var a=i.getPublicKeyHex(),s=h.getTLVbyList(a,0,[1,0],"30"),o=r.getSerialNumberHex(),f=c(i.getSubjectHex(),n),p=c(s,n);this.setByValue(f,p,o,n),this.hoge=r.getSerialNumberHex()},this.getEncodedHex=function(){if(null===this.dHashAlg&&null===this.dIssuerNameHash&&null===this.dIssuerKeyHash&&null===this.dSerialNumber)throw"not yet set values";var e=[this.dHashAlg,this.dIssuerNameHash,this.dIssuerKeyHash,this.dSerialNumber],t=new a({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){var f=e;if(void 0!==f.issuerCert&&void 0!==f.subjectCert){var p=u;void 0===f.alg&&(p=void 0),this.setByCert(f.issuerCert,f.subjectCert,p)}else{if(void 0===f.issname||void 0===f.isskey||void 0===f.sbjsn)throw new Error("invalid constructor arguments");p=u;void 0===f.alg&&(p=void 0),this.setByValue(f.issname,f.isskey,f.sbjsn,p)}}},We(he.asn1.ocsp.CertID,he.asn1.ASN1Object),he.asn1.ocsp.CertStatus=function(e){he.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.getEncodedHex=function(){var e=this.params;if("good"==e.status)return"8000";if("unknown"==e.status)return"8200";if("revoked"==e.status){var t=[{gentime:{str:e.time}}];null!=e.reason&&t.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:e.reason}}}});var n={tag:"a1",explicit:!1,obj:{seq:t}};return he.asn1.ASN1Util.newObject({tag:n}).getEncodedHex()}throw new Error("bad status")},this.setByParam=function(e){this.params=e},void 0!==e&&this.setByParam(e)},We(he.asn1.ocsp.CertStatus,he.asn1.ASN1Object),he.asn1.ocsp.Request=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;if(r.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.getEncodedHex=function(){var e=[];if(null===this.dReqCert)throw"reqCert not set";e.push(this.dReqCert);var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e){var i=new r.CertID(e);this.dReqCert=i}},We(he.asn1.ocsp.Request,he.asn1.ASN1Object),he.asn1.ocsp.TBSRequest=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;r.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(e){for(var t=[],n=0;n<e.length;n++){var i=new r.Request(e[0]);t.push(i)}this.dRequestList=t},this.getEncodedHex=function(){var e=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var t=new n({array:this.dRequestList});if(e.push(t),null!==this.dRequestExt)throw"requestExtensions not supported";var r=new n({array:e});return this.hTLV=r.getEncodedHex(),this.hTLV},void 0!==e&&void 0!==e.reqList&&this.setRequestListByParam(e.reqList)},We(he.asn1.ocsp.TBSRequest,he.asn1.ASN1Object),he.asn1.ocsp.OCSPRequest=function(e){var t=he.asn1,n=t.DERSequence,r=t.ocsp;if(r.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.getEncodedHex=function(){var e=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(e.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var t=new n({array:e});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==e&&void 0!==e.reqList){var i=new r.TBSRequest(e);this.dTbsRequest=i}},We(he.asn1.ocsp.OCSPRequest,he.asn1.ASN1Object),he.asn1.ocsp.OCSPUtil={},he.asn1.ocsp.OCSPUtil.getRequestHex=function(e,t,n){var r=he.asn1.ocsp;void 0===n&&(n=r.DEFAULT_HASH);var i={alg:n,issuerCert:e,subjectCert:t};return new r.OCSPRequest({reqList:[i]}).getEncodedHex()},he.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(e){var t=de,n=t.getVbyList,r=t.getVbyListEx,i=t.getIdxbyList,a=(t.getIdxbyListEx,t.getV),s={};try{var o=r(e,0,[0],"0a");s.responseStatus=parseInt(o,16)}catch(e){}if(0!==s.responseStatus)return s;try{var u=i(e,0,[1,0,1,0,0,2,0,1]);"80"===e.substr(u,2)?s.certStatus="good":"a1"===e.substr(u,2)?(s.certStatus="revoked",s.revocationTime=Fe(n(e,u,[0]))):"82"===e.substr(u,2)&&(s.certStatus="unknown")}catch(e){}try{var c=i(e,0,[1,0,1,0,0,2,0,2]);s.thisUpdate=Fe(a(e,c))}catch(e){}try{var l=i(e,0,[1,0,1,0,0,2,0,3]);"a0"===e.substr(l,2)&&(s.nextUpdate=Fe(n(e,l,[0])))}catch(e){}return s},he.asn1.ocsp.OCSPParser=function(){var e=Error,t=Ze,n=new t,r=de,i=r.getV,a=r.getTLV,s=r.getIdxbyList,o=r.getTLVbyListEx,u=r.getChildIdx;this.getOCSPRequest=function(t){var n=u(t,0);if(1!=n.length&&2!=n.length)throw new e("wrong number elements: "+n.length);return this.getTBSRequest(a(t,n[0]))},this.getTBSRequest=function(e){var t={},r=o(e,0,[0],"30");t.array=this.getRequestList(r);var i=o(e,0,["[2]",0],"30");return null!=i&&(t.ext=n.getExtParamArray(i)),t},this.getRequestList=function(e){for(var t=[],n=u(e,0),r=0;r<n.length;r++){e=a(e,n[r]);t.push(this.getRequest(e))}return t},this.getRequest=function(t){var r=u(t,0);if(1!=r.length&&2!=r.length)throw new e("wrong number elements: "+r.length);var i=this.getCertID(a(t,r[0]));if(2==r.length){var o=s(t,0,[1,0]);i.ext=n.getExtParamArray(a(t,o))}return i},this.getCertID=function(n){var r=u(n,0);if(4!=r.length)throw new e("wrong number elements: "+r.length);var s=new t,o={};return o.alg=s.getAlgorithmIdentifierName(a(n,r[0])),o.issname=i(n,r[1]),o.isskey=i(n,r[2]),o.sbjsn=i(n,r[3]),o}},void 0!==he&&he||(he={}),void 0!==he.lang&&he.lang||(he.lang={}),he.lang.String=function(){},"function"==typeof e?(fe=function(t){return be(e.from(t,"utf8").toString("base64"))},pe=function(t){return e.from(we(t),"base64").toString("utf8")}):(fe=function(e){return xe(ke(Le(e)))},pe=function(e){return decodeURIComponent(Oe(Se(e)))}),he.lang.String.isInteger=function(e){return!!e.match(/^[0-9]+$/)||!!e.match(/^-[0-9]+$/)},he.lang.String.isHex=function(e){return Me(e)},he.lang.String.isBase64=function(e){return!(!(e=e.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||e.length%4!=0)},he.lang.String.isBase64URL=function(e){return!e.match(/[+/=]/)&&(e=we(e),he.lang.String.isBase64(e))},he.lang.String.isIntegerArray=function(e){return!!(e=e.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},he.lang.String.isPrintable=function(e){return null!==e.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},he.lang.String.isIA5=function(e){return null!==e.match(/^[\x20-\x21\x23-\x7f]*$/)},he.lang.String.isMail=function(e){return null!==e.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};function qe(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=parseInt(e,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var a="",s=0;s<i;s++)a+="0";r=a+r;for(s=0;s<r.length-1;s+=7){var o=r.substr(s,7);s!=r.length-7&&(o="1"+o),n+=t(parseInt(o,2))}return n};try{if(!e.match(/^[0-9.]+$/))return null;var r="",i=e.split("."),a=40*parseInt(i[0],10)+parseInt(i[1],10);r+=t(a),i.splice(0,2);for(var s=0;s<i.length;s++)r+=n(i[s]);return r}catch(e){return null}}function Ke(e){if(!Me(e))return null;try{var t=[],n=e.substr(0,2),r=parseInt(n,16);t[0]=new String(Math.floor(r/40)),t[1]=new String(r%40);for(var i=e.substr(2),a=[],s=0;s<i.length/2;s++)a.push(parseInt(i.substr(2*s,2),16));var o=[],u="";for(s=0;s<a.length;s++)128&a[s]?u+=ze((127&a[s]).toString(2),7):(u+=ze((127&a[s]).toString(2),7),o.push(new String(parseInt(u,2))),u="");var c=t.join(".");return o.length>0&&(c=c+"."+o.join(".")),c}catch(e){return null}}var ze=function(e,t,n){return null==n&&(n="0"),e.length>=t?e:new Array(t-e.length+1).join(n)+e};function Ge(e){try{var t=e.substr(0,2);if("00"==t)return parseInt(e.substr(2),16);var n=parseInt(t,16),r=e.substr(2),i=parseInt(r,16).toString(2);return"0"==i&&(i="00000000"),i=i.slice(0,0-n),parseInt(i,2)}catch(e){return-1}}function We(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t)}void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:g.algo.MD5,sha1:g.algo.SHA1,sha224:g.algo.SHA224,sha256:g.algo.SHA256,sha384:g.algo.SHA384,sha512:g.algo.SHA512,ripemd160:g.algo.RIPEMD160},this.getDigestInfoHex=function(e,t){if(void 0===this.DIGESTINFOHEAD[t])throw"alg not supported in Util.DIGESTINFOHEAD: "+t;return this.DIGESTINFOHEAD[t]+e},this.getPaddedDigestInfoHex=function(e,t,n){var r=this.getDigestInfoHex(e,t),i=n/4;if(r.length+22>i)throw"key is too short for SigAlg: keylen="+n+","+t;for(var a="0001",s="00"+r,o="",u=i-a.length-s.length,c=0;c<u;c+=2)o+="ff";return a+o+s},this.hashString=function(e,t){return new he.crypto.MessageDigest({alg:t}).digestString(e)},this.hashHex=function(e,t){return new he.crypto.MessageDigest({alg:t}).digestHex(e)},this.sha1=function(e){return this.hashString(e,"sha1")},this.sha256=function(e){return this.hashString(e,"sha256")},this.sha256Hex=function(e){return this.hashHex(e,"sha256")},this.sha512=function(e){return this.hashString(e,"sha512")},this.sha512Hex=function(e){return this.hashHex(e,"sha512")},this.isKey=function(e){return e instanceof ae||e instanceof he.crypto.DSA||e instanceof he.crypto.ECDSA}},he.crypto.Util.md5=function(e){return new he.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(e)},he.crypto.Util.ripemd160=function(e){return new he.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(e)},he.crypto.Util.SECURERANDOMGEN=new ne,he.crypto.Util.getRandomHexOfNbytes=function(e){var t=new Array(e);return he.crypto.Util.SECURERANDOMGEN.nextBytes(t),ve(t)},he.crypto.Util.getRandomBigIntegerOfNbytes=function(e){return new S(he.crypto.Util.getRandomHexOfNbytes(e),16)},he.crypto.Util.getRandomHexOfNbits=function(e){var t=e%8,n=new Array((e-t)/8+1);return he.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<t&255^255)&n[0],ve(n)},he.crypto.Util.getRandomBigIntegerOfNbits=function(e){return new S(he.crypto.Util.getRandomHexOfNbits(e),16)},he.crypto.Util.getRandomBigIntegerZeroToMax=function(e){for(var t=e.bitLength();;){var n=he.crypto.Util.getRandomBigIntegerOfNbits(t);if(-1!=e.compareTo(n))return n}},he.crypto.Util.getRandomBigIntegerMinToMax=function(e,t){var n=e.compareTo(t);if(1==n)throw"biMin is greater than biMax";if(0==n)return e;var r=t.subtract(e);return he.crypto.Util.getRandomBigIntegerZeroToMax(r).add(e)},he.crypto.MessageDigest=function(e){this.setAlgAndProvider=function(e,t){if(null!==(e=he.crypto.MessageDigest.getCanonicalAlgName(e))&&void 0===t&&(t=he.crypto.Util.DEFAULTPROVIDER[e]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(e)&&"cryptojs"==t){try{this.md=he.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[e].create()}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=g.enc.Hex.parse(e);this.md.update(t)},this.digest=function(){return this.md.finalize().toString(g.enc.Hex)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}if(-1!=":sha256:".indexOf(e)&&"sjcl"==t){try{this.md=new sjcl.hash.sha256}catch(t){throw"setAlgAndProvider hash alg set fail alg="+e+"/"+t}this.updateString=function(e){this.md.update(e)},this.updateHex=function(e){var t=sjcl.codec.hex.toBits(e);this.md.update(t)},this.digest=function(){var e=this.md.finalize();return sjcl.codec.hex.fromBits(e)},this.digestString=function(e){return this.updateString(e),this.digest()},this.digestHex=function(e){return this.updateHex(e),this.digest()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(e){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(e){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==e&&void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},he.crypto.MessageDigest.getCanonicalAlgName=function(e){return"string"==typeof e&&(e=(e=e.toLowerCase()).replace(/-/,"")),e},he.crypto.MessageDigest.getHashLength=function(e){var t=he.crypto.MessageDigest,n=t.getCanonicalAlgName(e);if(void 0===t.HASHLENGTH[n])throw"not supported algorithm: "+e;return t.HASHLENGTH[n]},he.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},he.crypto.Mac=function(e){this.setAlgAndProvider=function(e,t){if(null==(e=e.toLowerCase())&&(e="hmacsha1"),"hmac"!=(e=e.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+e;void 0===t&&(t=he.crypto.Util.DEFAULTPROVIDER[e]),this.algProv=e+"/"+t;var n=e.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(n)&&"cryptojs"==t){try{var r=he.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[n];this.mac=g.algo.HMAC.create(r,this.pass)}catch(e){throw"setAlgAndProvider hash alg set fail hashAlg="+n+"/"+e}this.updateString=function(e){this.mac.update(e)},this.updateHex=function(e){var t=g.enc.Hex.parse(e);this.mac.update(t)},this.doFinal=function(){return this.mac.finalize().toString(g.enc.Hex)},this.doFinalString=function(e){return this.updateString(e),this.doFinal()},this.doFinalHex=function(e){return this.updateHex(e),this.doFinal()}}},this.updateString=function(e){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(e){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(e){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(e){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(e){if("string"==typeof e){var t=e;return e.length%2!=1&&e.match(/^[0-9A-Fa-f]+$/)||(t=De(e)),void(this.pass=g.enc.Hex.parse(t))}if("object"!=typeof e)throw"KJUR.crypto.Mac unsupported password type: "+e;t=null;if(void 0!==e.hex){if(e.hex.length%2!=0||!e.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+e.hex;t=e.hex}if(void 0!==e.utf8&&(t=Ee(e.utf8)),void 0!==e.rstr&&(t=De(e.rstr)),void 0!==e.b64&&(t=w(e.b64)),void 0!==e.b64u&&(t=Se(e.b64u)),null==t)throw"KJUR.crypto.Mac unsupported password type: "+e;this.pass=g.enc.Hex.parse(t)},void 0!==e&&(void 0!==e.pass&&this.setPassword(e.pass),void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov&&(this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},he.crypto.Signature=function(e){var t=null;if(this._setAlgNames=function(){var e=this.algName.match(/^(.+)with(.+)$/);e&&(this.mdAlgName=e[1].toLowerCase(),this.pubkeyAlgName=e[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n+="0";return n+e},this.setAlgAndProvider=function(e,t){if(this._setAlgNames(),"cryptojs/jsrsa"!=t)throw new Error("provider not supported: "+t);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new he.crypto.MessageDigest({alg:this.mdAlgName})}catch(e){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+e)}this.init=function(e,t){var n=null;try{n=void 0===t?Ye.getKey(e):Ye.getKey(e,t)}catch(e){throw"init failed:"+e}if(!0===n.isPrivate)this.prvKey=n,this.state="SIGN";else{if(!0!==n.isPublic)throw"init failed.:"+n;this.pubKey=n,this.state="VERIFY"}},this.updateString=function(e){this.md.updateString(e)},this.updateHex=function(e){this.md.updateHex(e)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==he.crypto.ECDSA&&(this.prvKey=new he.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof ae&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof ae&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof he.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof he.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(e){return this.updateString(e),this.sign()},this.signHex=function(e){return this.updateHex(e),this.sign()},this.verify=function(e){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==he.crypto.ECDSA&&(this.pubKey=new he.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof ae&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,e,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof ae&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==he.crypto.ECDSA&&this.pubKey instanceof he.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);if(void 0!==he.crypto.DSA&&this.pubKey instanceof he.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,e);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(e,t){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(e){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(e){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(e){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(e){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(e){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=e,void 0!==e&&(void 0!==e.alg&&(this.algName=e.alg,void 0===e.prov?this.provName=he.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=e.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==e.psssaltlen&&(this.pssSaltLen=e.psssaltlen),void 0!==e.prvkeypem)){if(void 0!==e.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{t=Ye.getKey(e.prvkeypem);this.init(t)}catch(e){throw"fatal error to load pem private key: "+e}}},he.crypto.Cipher=function(e){},he.crypto.Cipher.encrypt=function(e,t,n){if(t instanceof ae&&t.isPublic){var r=he.crypto.Cipher.getAlgByKeyAndName(t,n);if("RSA"===r)return t.encrypt(e);if("RSAOAEP"===r)return t.encryptOAEP(e,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return t.encryptOAEP(e,"sha"+i[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.encrypt: unsupported key or algorithm"},he.crypto.Cipher.decrypt=function(e,t,n){if(t instanceof ae&&t.isPrivate){var r=he.crypto.Cipher.getAlgByKeyAndName(t,n);if("RSA"===r)return t.decrypt(e);if("RSAOAEP"===r)return t.decryptOAEP(e,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return t.decryptOAEP(e,"sha"+i[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.decrypt: unsupported key or algorithm"},he.crypto.Cipher.getAlgByKeyAndName=function(e,t){if(e instanceof ae){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(t))return t;if(null==t)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+t}throw"getAlgByKeyAndName: not supported algorithm name: "+t},he.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"}},void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.ECDSA=function(e){var t=Error,n=S,r=ue,i=he.crypto.ECDSA,a=he.crypto.ECParameterDB,s=i.getName,o=de,u=o.getVbyListEx,c=o.isASN1HEX,l=new ne;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(e){return new n(e.bitLength(),l).mod(e.subtract(n.ONE)).add(n.ONE)},this.setNamedCurve=function(e){this.ecparams=a.getByName(e),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=e},this.setPrivateKeyHex=function(e){this.isPrivate=!0,this.prvKeyHex=e},this.setPublicKeyHex=function(e){this.isPublic=!0,this.pubKeyHex=e},this.getPublicKeyXYHex=function(){var e=this.pubKeyHex;if("04"!==e.substr(0,2))throw"this method supports uncompressed format(04) only";var t=this.ecparams.keylen/4;if(e.length!==2+2*t)throw"malformed public key hex length";var n={};return n.x=e.substr(2,t),n.y=e.substr(2+t),n},this.getShortNISTPCurveName=function(){var e=this.curveName;return"secp256r1"===e||"NIST P-256"===e||"P-256"===e||"prime256v1"===e?"P-256":"secp384r1"===e||"NIST P-384"===e||"P-384"===e?"P-384":null},this.generateKeyPairHex=function(){var e=this.ecparams.n,t=this.getBigRandom(e),n=this.ecparams.G.multiply(t),r=n.getX().toBigInteger(),i=n.getY().toBigInteger(),a=this.ecparams.keylen/4,s=("0000000000"+t.toString(16)).slice(-a),o="04"+("0000000000"+r.toString(16)).slice(-a)+("0000000000"+i.toString(16)).slice(-a);return this.setPrivateKeyHex(s),this.setPublicKeyHex(o),{ecprvhex:s,ecpubhex:o}},this.signWithMessageHash=function(e){return this.signHex(e,this.prvKeyHex)},this.signHex=function(e,t){var r=new n(t,16),a=this.ecparams.n,s=new n(e.substring(0,this.ecparams.keylen/4),16);do{var o=this.getBigRandom(a),u=this.ecparams.G.multiply(o).getX().toBigInteger().mod(a)}while(u.compareTo(n.ZERO)<=0);var c=o.modInverse(a).multiply(s.add(r.multiply(u))).mod(a);return i.biRSSigToASN1Sig(u,c)},this.sign=function(e,t){var r=t,i=this.ecparams.n,a=n.fromByteArrayUnsigned(e);do{var s=this.getBigRandom(i),o=this.ecparams.G.multiply(s).getX().toBigInteger().mod(i)}while(o.compareTo(S.ZERO)<=0);var u=s.modInverse(i).multiply(a.add(r.multiply(o))).mod(i);return this.serializeSig(o,u)},this.verifyWithMessageHash=function(e,t){return this.verifyHex(e,t,this.pubKeyHex)},this.verifyHex=function(e,t,a){try{var s,o,u=i.parseSigHex(t);s=u.r,o=u.s;var c=r.decodeFromHex(this.ecparams.curve,a),l=new n(e.substring(0,this.ecparams.keylen/4),16);return this.verifyRaw(l,s,o,c)}catch(e){return!1}},this.verify=function(e,t,i){var a,s,o;if(Bitcoin.Util.isArray(t)){var u=this.parseSig(t);a=u.r,s=u.s}else{if("object"!=typeof t||!t.r||!t.s)throw"Invalid value for signature";a=t.r,s=t.s}if(i instanceof ue)o=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";o=r.decodeFrom(this.ecparams.curve,i)}var c=n.fromByteArrayUnsigned(e);return this.verifyRaw(c,a,s,o)},this.verifyRaw=function(e,t,r,i){var a=this.ecparams.n,s=this.ecparams.G;if(t.compareTo(n.ONE)<0||t.compareTo(a)>=0)return!1;if(r.compareTo(n.ONE)<0||r.compareTo(a)>=0)return!1;var o=r.modInverse(a),u=e.multiply(o).mod(a),c=t.multiply(o).mod(a);return s.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(a).equals(t)},this.serializeSig=function(e,t){var n=e.toByteArraySigned(),r=t.toByteArraySigned(),i=[];return i.push(2),i.push(n.length),(i=i.concat(n)).push(2),i.push(r.length),(i=i.concat(r)).unshift(i.length),i.unshift(48),i},this.parseSig=function(e){var t;if(48!=e[0])throw new Error("Signature not a valid DERSequence");if(2!=e[t=2])throw new Error("First element in signature must be a DERInteger");var r=e.slice(t+2,t+2+e[t+1]);if(2!=e[t+=2+e[t+1]])throw new Error("Second element in signature must be a DERInteger");var i=e.slice(t+2,t+2+e[t+1]);return t+=2+e[t+1],{r:n.fromByteArrayUnsigned(r),s:n.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(e){if(65!==e.length)throw"Signature has the wrong length";var t=e[0]-27;if(t<0||t>7)throw"Invalid signature type";var r=this.ecparams.n;return{r:n.fromByteArrayUnsigned(e.slice(1,33)).mod(r),s:n.fromByteArrayUnsigned(e.slice(33,65)).mod(r),i:t}},this.readPKCS5PrvKeyHex=function(e){if(!1===c(e))throw new Error("not ASN.1 hex string");var t,n,r;try{t=u(e,0,["[0]",0],"06"),n=u(e,0,[1],"04");try{r=u(e,0,["[1]",0],"03")}catch(e){}}catch(e){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=s(t),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(e){if(!1===c(e))throw new t("not ASN.1 hex string");var n,r,i;try{u(e,0,[1,0],"06"),n=u(e,0,[1,1],"06"),r=u(e,0,[2,0,1],"04");try{i=u(e,0,[2,0,"[1]",0],"03")}catch(e){}}catch(e){throw new t("malformed PKCS#8 plain ECC private key")}if(this.curveName=s(n),void 0===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PubKeyHex=function(e){if(!1===c(e))throw new t("not ASN.1 hex string");var n,r;try{u(e,0,[0,0],"06"),n=u(e,0,[0,1],"06"),r=u(e,0,[1],"03")}catch(e){throw new t("malformed PKCS#8 ECC public key")}if(this.curveName=s(n),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},this.readCertPubKeyHex=function(e,n){if(!1===c(e))throw new t("not ASN.1 hex string");var r,i;try{r=u(e,0,[0,5,0,1],"06"),i=u(e,0,[0,5,1],"03")}catch(e){throw new t("malformed X.509 certificate ECC public key")}if(this.curveName=s(r),null===this.curveName)throw new t("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==e&&void 0!==e.curve&&(this.curveName=e.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==e&&(void 0!==e.prv&&this.setPrivateKeyHex(e.prv),void 0!==e.pub&&this.setPublicKeyHex(e.pub))},he.crypto.ECDSA.parseSigHex=function(e){var t=he.crypto.ECDSA.parseSigHexInHexRS(e);return{r:new S(t.r,16),s:new S(t.s,16)}},he.crypto.ECDSA.parseSigHexInHexRS=function(e){var t=de,n=t.getChildIdx,r=t.getV;if(t.checkStrictDER(e,0),"30"!=e.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=n(e,0);if(2!=i.length)throw new Error("signature shall have two elements");var a=i[0],s=i[1];if("02"!=e.substr(a,2))throw new Error("1st item not ASN.1 integer");if("02"!=e.substr(s,2))throw new Error("2nd item not ASN.1 integer");return{r:r(e,a),s:r(e,s)}},he.crypto.ECDSA.asn1SigToConcatSig=function(e){var t=he.crypto.ECDSA.parseSigHexInHexRS(e),n=t.r,r=t.s;if("00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),"00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),n.length%32==30&&(n="00"+n),r.length%32==30&&(r="00"+r),n.length%32!=0)throw"unknown ECDSA sig r length error";if(r.length%32!=0)throw"unknown ECDSA sig s length error";return n+r},he.crypto.ECDSA.concatSigToASN1Sig=function(e){if(e.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var t=e.substr(0,e.length/2),n=e.substr(e.length/2);return he.crypto.ECDSA.hexRSSigToASN1Sig(t,n)},he.crypto.ECDSA.hexRSSigToASN1Sig=function(e,t){var n=new S(e,16),r=new S(t,16);return he.crypto.ECDSA.biRSSigToASN1Sig(n,r)},he.crypto.ECDSA.biRSSigToASN1Sig=function(e,t){var n=he.asn1,r=new n.DERInteger({bigint:e}),i=new n.DERInteger({bigint:t});return new n.DERSequence({array:[r,i]}).getEncodedHex()},he.crypto.ECDSA.getName=function(e){return"2b8104001f"===e?"secp192k1":"2a8648ce3d030107"===e?"secp256r1":"2b8104000a"===e?"secp256k1":"2b81040021"===e?"secp224r1":"2b81040022"===e?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(e)?"secp256r1":-1!=="|secp256k1|".indexOf(e)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(e)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(e)?"secp384r1":null},void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.ECParameterDB=new function(){var e={},t={};function n(e){return new S(e,16)}this.getByName=function(n){var r=n;if(void 0!==t[r]&&(r=t[n]),void 0!==e[r])return e[r];throw"unregistered EC curve name: "+r},this.regist=function(r,i,a,s,o,u,c,l,h,f,p,d){e[r]={};var g=n(a),m=n(s),v=n(o),y=n(u),b=n(c),w=new ce(g,m,v),x=w.decodePointHex("04"+l+h);e[r].name=r,e[r].keylen=i,e[r].curve=w,e[r].G=x,e[r].n=y,e[r].h=b,e[r].oid=p,e[r].info=d;for(var S=0;S<f.length;S++)t[f[S]]=r}},he.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),he.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),he.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),he.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),he.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),he.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),he.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),he.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),he.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),he.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==he&&he||(he={}),void 0!==he.crypto&&he.crypto||(he.crypto={}),he.crypto.DSA=function(){var e=de,t=(e.getVbyList,e.getVbyListEx),n=e.isASN1HEX,r=S;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(e,t,n,r,i){this.isPrivate=!0,this.p=e,this.q=t,this.g=n,this.y=r,this.x=i},this.setPrivateHex=function(e,t,n,r,i){var a,s,o,u,c;a=new S(e,16),s=new S(t,16),o=new S(n,16),u="string"==typeof r&&r.length>1?new S(r,16):null,c=new S(i,16),this.setPrivate(a,s,o,u,c)},this.setPublic=function(e,t,n,r){this.isPublic=!0,this.p=e,this.q=t,this.g=n,this.y=r,this.x=null},this.setPublicHex=function(e,t,n,r){var i,a,s,o;i=new S(e,16),a=new S(t,16),s=new S(n,16),o=new S(r,16),this.setPublic(i,a,s,o)},this.signWithMessageHash=function(e){var t=this.p,n=this.q,r=this.g,i=(this.y,this.x),a=he.crypto.Util.getRandomBigIntegerMinToMax(S.ONE.add(S.ONE),n.subtract(S.ONE)),s=new S(e.substr(0,n.bitLength()/4),16),o=r.modPow(a,t).mod(n),u=a.modInverse(n).multiply(s.add(i.multiply(o))).mod(n);return he.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:o}},{int:{bigint:u}}]})},this.verifyWithMessageHash=function(e,t){var n=this.p,r=this.q,i=this.g,a=this.y,s=this.parseASN1Signature(t),o=s[0],u=s[1],c=new S(e.substr(0,r.bitLength()/4),16);if(S.ZERO.compareTo(o)>0||o.compareTo(r)>0)throw"invalid DSA signature";if(S.ZERO.compareTo(u)>=0||u.compareTo(r)>0)throw"invalid DSA signature";var l=u.modInverse(r),h=c.multiply(l).mod(r),f=o.multiply(l).mod(r);return 0==i.modPow(h,n).multiply(a.modPow(f,n)).mod(n).mod(r).compareTo(o)},this.parseASN1Signature=function(e){try{return[new r(t(e,0,[0],"02"),16),new r(t(e,0,[1],"02"),16)]}catch(e){throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(e){var r,i,a,s,o;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1],"02"),i=t(e,0,[2],"02"),a=t(e,0,[3],"02"),s=t(e,0,[4],"02"),o=t(e,0,[5],"02")}catch(e){throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(r,i,a,s,o)},this.readPKCS8PrvKeyHex=function(e){var r,i,a,s;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[1,1,0],"02"),i=t(e,0,[1,1,1],"02"),a=t(e,0,[1,1,2],"02"),s=t(e,0,[2,0],"02")}catch(e){throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(r,i,a,null,s)},this.readPKCS8PubKeyHex=function(e){var r,i,a,s;if(!1===n(e))throw new Error("not ASN.1 hex string");try{r=t(e,0,[0,1,0],"02"),i=t(e,0,[0,1,1],"02"),a=t(e,0,[0,1,2],"02"),s=t(e,0,[1,0],"02")}catch(e){throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(r,i,a,s)},this.readCertPubKeyHex=function(e,r){var i,a,s,o;if(!1===n(e))throw new Error("not ASN.1 hex string");try{i=t(e,0,[0,5,0,1,0],"02"),a=t(e,0,[0,5,0,1,1],"02"),s=t(e,0,[0,5,0,1,2],"02"),o=t(e,0,[0,5,1,0],"02")}catch(e){throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(i,a,s,o)}};var Ye=function(){var e=function(e,n,r){return t(g.AES,e,n,r)},t=function(e,t,n,r){var i=g.enc.Hex.parse(t),a=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),o={};o.key=a,o.iv=s,o.ciphertext=i;var u=e.decrypt(o,a,{iv:s});return g.enc.Hex.stringify(u)},n=function(e,t,n){return r(g.AES,e,t,n)},r=function(e,t,n,r){var i=g.enc.Hex.parse(t),a=g.enc.Hex.parse(n),s=g.enc.Hex.parse(r),o=e.encrypt(i,a,{iv:s}),u=g.enc.Hex.parse(o.toString());return g.enc.Base64.stringify(u)},i={"AES-256-CBC":{proc:e,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:e,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:e,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(e,n,r){return t(g.TripleDES,e,n,r)},eproc:function(e,t,n){return r(g.TripleDES,e,t,n)},keylen:24,ivlen:8},"DES-CBC":{proc:function(e,n,r){return t(g.DES,e,n,r)},eproc:function(e,t,n){return r(g.DES,e,t,n)},keylen:8,ivlen:8}},a=function(e){var t={},n=e.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));n&&(t.cipher=n[1],t.ivsalt=n[2]);var r=e.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(t.type=r[1]);var i=-1,a=0;-1!=e.indexOf("\r\n\r\n")&&(i=e.indexOf("\r\n\r\n"),a=2),-1!=e.indexOf("\n\n")&&(i=e.indexOf("\n\n"),a=1);var s=e.indexOf("-----END");if(-1!=i&&-1!=s){var o=e.substring(i+2*a,s-a);o=o.replace(/\s+/g,""),t.data=o}return t},s=function(e,t,n){for(var r=n.substring(0,16),a=g.enc.Hex.parse(r),s=g.enc.Utf8.parse(t),o=i[e].keylen+i[e].ivlen,u="",c=null;;){var l=g.algo.MD5.create();if(null!=c&&l.update(c),l.update(s),l.update(a),c=l.finalize(),(u+=g.enc.Hex.stringify(c)).length>=2*o)break}var h={};return h.keyhex=u.substr(0,2*i[e].keylen),h.ivhex=u.substr(2*i[e].keylen,2*i[e].ivlen),h},o=function(e,t,n,r){var a=g.enc.Base64.parse(e),s=g.enc.Hex.stringify(a);return(0,i[t].proc)(s,n,r)};return{version:"1.0.0",parsePKCS5PEM:function(e){return a(e)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(e,t,n){return s(e,t,n)},decryptKeyB64:function(e,t,n,r){return o(e,t,n,r)},getDecryptedKeyHex:function(e,t){var n=a(e),r=(n.type,n.cipher),i=n.ivsalt,u=n.data,c=s(r,t,i).keyhex;return o(u,r,c,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(e,t,n,r,a){var o="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===i[r])throw new Error("KEYUTIL unsupported algorithm: "+r);void 0!==a&&null!=a||(a=function(e){var t=g.lib.WordArray.random(e);return g.enc.Hex.stringify(t)}(i[r].ivlen).toUpperCase());var u=function(e,t,n,r){return(0,i[t].eproc)(e,n,r)}(t,r,s(r,n,a).keyhex,a);o="-----BEGIN "+e+" PRIVATE KEY-----\r\n";return o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+r+","+a+"\r\n",o+="\r\n",o+=u.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+e+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(e){var t=de,n=t.getChildIdx,r=t.getV,i={},a=n(e,0);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+a.length);i.ciphertext=r(e,a[1]);var s=n(e,a[0]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+s.length);if("2a864886f70d01050d"!=r(e,s[0]))throw new Error("this only supports pkcs5PBES2");var o=n(e,s[1]);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+o.length);var u=n(e,o[1]);if(2!=u.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length);if("2a864886f70d0307"!=r(e,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=r(e,u[1]);var c=n(e,o[0]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+c.length);if("2a864886f70d01050c"!=r(e,c[0]))throw new Error("this only supports pkcs5PBKDF2");var l=n(e,c[1]);if(l.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+l.length);i.pbkdf2Salt=r(e,l[0]);var h=r(e,l[1]);try{i.pbkdf2Iter=parseInt(h,16)}catch(e){throw new Error("malformed format pbkdf2Iter: "+h)}return i},getPBKDF2KeyHexFromParam:function(e,t){var n=g.enc.Hex.parse(e.pbkdf2Salt),r=e.pbkdf2Iter,i=g.PBKDF2(t,n,{keySize:6,iterations:r});return g.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(e,t){var n=Te(e,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(n),i=Ye.getPBKDF2KeyHexFromParam(r,t),a={};a.ciphertext=g.enc.Hex.parse(r.ciphertext);var s=g.enc.Hex.parse(i),o=g.enc.Hex.parse(r.encryptionSchemeIV),u=g.TripleDES.decrypt(a,s,{iv:o});return g.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(e,t){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(e,t);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function(e){var t=de,n=t.getChildIdx,r=t.getV,i={algparam:null};if("30"!=e.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var a=n(e,0);if(a.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=e.substr(a[1],2))throw new Error("malformed PKCS8 private key(code:003)");var s=n(e,a[1]);if(2!=s.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=e.substr(s[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=r(e,s[0]),"06"==e.substr(s[1],2)&&(i.algparam=r(e,s[1])),"04"!=e.substr(a[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=t.getVidx(e,a[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(e){var t=Te(e,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(t)},getKeyFromPlainPrivatePKCS8Hex:function(e){var t,n=this.parsePlainPrivatePKCS8Hex(e);if("2a864886f70d010101"==n.algoid)t=new ae;else if("2a8648ce380401"==n.algoid)t=new he.crypto.DSA;else{if("2a8648ce3d0201"!=n.algoid)throw new Error("unsupported private key algorithm");t=new he.crypto.ECDSA}return t.readPKCS8PrvKeyHex(e),t},_getKeyFromPublicPKCS8Hex:function(e){var t,n=de.getVbyList(e,0,[0,0],"06");if("2a864886f70d010101"===n)t=new ae;else if("2a8648ce380401"===n)t=new he.crypto.DSA;else{if("2a8648ce3d0201"!==n)throw new Error("unsupported PKCS#8 public key hex");t=new he.crypto.ECDSA}return t.readPKCS8PubKeyHex(e),t},parsePublicRawRSAKeyHex:function(e){var t=de,n=t.getChildIdx,r=t.getV,i={};if("30"!=e.substr(0,2))throw new Error("malformed RSA key(code:001)");var a=n(e,0);if(2!=a.length)throw new Error("malformed RSA key(code:002)");if("02"!=e.substr(a[0],2))throw new Error("malformed RSA key(code:003)");if(i.n=r(e,a[0]),"02"!=e.substr(a[1],2))throw new Error("malformed RSA key(code:004)");return i.e=r(e,a[1]),i},parsePublicPKCS8Hex:function(e){var t=de,n=t.getChildIdx,r=t.getV,i={algparam:null},a=n(e,0);if(2!=a.length)throw new Error("outer DERSequence shall have 2 elements: "+a.length);var s=a[0];if("30"!=e.substr(s,2))throw new Error("malformed PKCS8 public key(code:001)");var o=n(e,s);if(2!=o.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=e.substr(o[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(i.algoid=r(e,o[0]),"06"==e.substr(o[1],2)?i.algparam=r(e,o[1]):"30"==e.substr(o[1],2)&&(i.algparam={},i.algparam.p=t.getVbyList(e,o[1],[0],"02"),i.algparam.q=t.getVbyList(e,o[1],[1],"02"),i.algparam.g=t.getVbyList(e,o[1],[2],"02")),"03"!=e.substr(a[1],2))throw new Error("malformed PKCS8 public key(code:004)");return i.key=r(e,a[1]).substr(2),i}}}();Ye.getKey=function(e,t,n){var r=(m=de).getChildIdx,i=(m.getV,m.getVbyList),a=he.crypto,s=a.ECDSA,o=a.DSA,u=ae,c=Te,l=Ye;if(void 0!==u&&e instanceof u)return e;if(void 0!==s&&e instanceof s)return e;if(void 0!==o&&e instanceof o)return e;if(void 0!==e.curve&&void 0!==e.xy&&void 0===e.d)return new s({pub:e.xy,curve:e.curve});if(void 0!==e.curve&&void 0!==e.d)return new s({prv:e.d,curve:e.curve});if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(R=new u).setPublic(e.n,e.e),R;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.co&&void 0===e.qi)return(R=new u).setPrivateEx(e.n,e.e,e.d,e.p,e.q,e.dp,e.dq,e.co),R;if(void 0===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0===e.p)return(R=new u).setPrivate(e.n,e.e,e.d),R;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0===e.x)return(R=new o).setPublic(e.p,e.q,e.g,e.y),R;if(void 0!==e.p&&void 0!==e.q&&void 0!==e.g&&void 0!==e.y&&void 0!==e.x)return(R=new o).setPrivate(e.p,e.q,e.g,e.y,e.x),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0===e.d)return(R=new u).setPublic(Se(e.n),Se(e.e)),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d&&void 0!==e.p&&void 0!==e.q&&void 0!==e.dp&&void 0!==e.dq&&void 0!==e.qi)return(R=new u).setPrivateEx(Se(e.n),Se(e.e),Se(e.d),Se(e.p),Se(e.q),Se(e.dp),Se(e.dq),Se(e.qi)),R;if("RSA"===e.kty&&void 0!==e.n&&void 0!==e.e&&void 0!==e.d)return(R=new u).setPrivate(Se(e.n),Se(e.e),Se(e.d)),R;if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0===e.d){var h=(C=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+Se(e.x)).slice(-h)+("0000000000"+Se(e.y)).slice(-h);return C.setPublicKeyHex(f),C}if("EC"===e.kty&&void 0!==e.crv&&void 0!==e.x&&void 0!==e.y&&void 0!==e.d){h=(C=new s({curve:e.crv})).ecparams.keylen/4,f="04"+("0000000000"+Se(e.x)).slice(-h)+("0000000000"+Se(e.y)).slice(-h);var p=("0000000000"+Se(e.d)).slice(-h);return C.setPublicKeyHex(f),C.setPrivateKeyHex(p),C}if("pkcs5prv"===n){var d,g=e,m=de;if(9===(d=r(g,0)).length)(R=new u).readPKCS5PrvKeyHex(g);else if(6===d.length)(R=new o).readPKCS5PrvKeyHex(g);else{if(!(d.length>2&&"04"===g.substr(d[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(R=new s).readPKCS5PrvKeyHex(g)}return R}if("pkcs8prv"===n)return R=l.getKeyFromPlainPrivatePKCS8Hex(e);if("pkcs8pub"===n)return l._getKeyFromPublicPKCS8Hex(e);if("x509pub"===n)return Ze.getPublicKeyFromCertHex(e);if(-1!=e.indexOf("-END CERTIFICATE-",0)||-1!=e.indexOf("-END X509 CERTIFICATE-",0)||-1!=e.indexOf("-END TRUSTED CERTIFICATE-",0))return Ze.getPublicKeyFromCertPEM(e);if(-1!=e.indexOf("-END PUBLIC KEY-")){var v=Te(e,"PUBLIC KEY");return l._getKeyFromPublicPKCS8Hex(v)}if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var y=c(e,"RSA PRIVATE KEY");return l.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){var b=i(T=c(e,"DSA PRIVATE KEY"),0,[1],"02"),w=i(T,0,[2],"02"),x=i(T,0,[3],"02"),E=i(T,0,[4],"02"),F=i(T,0,[5],"02");return(R=new o).setPrivate(new S(b,16),new S(w,16),new S(x,16),new S(E,16),new S(F,16)),R}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1==e.indexOf("4,ENCRYPTED")){y=c(e,"EC PRIVATE KEY");return l.getKey(y,null,"pkcs5prv")}if(-1!=e.indexOf("-END PRIVATE KEY-"))return l.getKeyFromPlainPrivatePKCS8PEM(e);if(-1!=e.indexOf("-END RSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var A=l.getDecryptedKeyHex(e,t),D=new ae;return D.readPKCS5PrvKeyHex(A),D}if(-1!=e.indexOf("-END EC PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var C,R=i(T=l.getDecryptedKeyHex(e,t),0,[1],"04"),$=i(T,0,[2,0],"06"),I=i(T,0,[3,0],"03").substr(2);if(void 0===he.crypto.OID.oidhex2name[$])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+$);return(C=new s({curve:he.crypto.OID.oidhex2name[$]})).setPublicKeyHex(I),C.setPrivateKeyHex(R),C.isPublic=!1,C}if(-1!=e.indexOf("-END DSA PRIVATE KEY-")&&-1!=e.indexOf("4,ENCRYPTED")){var T;b=i(T=l.getDecryptedKeyHex(e,t),0,[1],"02"),w=i(T,0,[2],"02"),x=i(T,0,[3],"02"),E=i(T,0,[4],"02"),F=i(T,0,[5],"02");return(R=new o).setPrivate(new S(b,16),new S(w,16),new S(x,16),new S(E,16),new S(F,16)),R}if(-1!=e.indexOf("-END ENCRYPTED PRIVATE KEY-"))return l.getKeyFromEncryptedPKCS8PEM(e,t);throw new Error("not supported argument")},Ye.generateKeypair=function(e,t){if("RSA"==e){var n=t;(s=new ae).generate(n,"10001"),s.isPrivate=!0,s.isPublic=!0;var r=new ae,i=s.n.toString(16),a=s.e.toString(16);return r.setPublic(i,a),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=s,o.pubKeyObj=r,o}if("EC"==e){var s,o,u=t,c=new he.crypto.ECDSA({curve:u}).generateKeyPairHex();return(s=new he.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),s.setPrivateKeyHex(c.ecprvhex),s.isPrivate=!0,s.isPublic=!1,(r=new he.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=s,o.pubKeyObj=r,o}throw new Error("unknown algorithm: "+e)},Ye.getPEM=function(e,t,n,r,i,a){var s=he,o=s.asn1,u=o.DERObjectIdentifier,c=o.DERInteger,l=o.ASN1Util.newObject,h=o.x509.SubjectPublicKeyInfo,f=s.crypto,p=f.DSA,d=f.ECDSA,m=ae;function v(e){return l({seq:[{int:0},{int:{bigint:e.n}},{int:e.e},{int:{bigint:e.d}},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.dmp1}},{int:{bigint:e.dmq1}},{int:{bigint:e.coeff}}]})}function y(e){return l({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a0",!0,{oid:{name:e.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]})}function b(e){return l({seq:[{int:0},{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}},{int:{bigint:e.y}},{int:{bigint:e.x}}]})}if((void 0!==m&&e instanceof m||void 0!==p&&e instanceof p||void 0!==d&&e instanceof d)&&1==e.isPublic&&(void 0===t||"PKCS8PUB"==t))return Ie(E=new h(e).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==t&&void 0!==m&&e instanceof m&&(void 0===n||null==n)&&1==e.isPrivate)return Ie(E=v(e).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==t&&void 0!==d&&e instanceof d&&(void 0===n||null==n)&&1==e.isPrivate){var w=new u({name:e.curveName}).getEncodedHex(),x=y(e).getEncodedHex(),S="";return S+=Ie(w,"EC PARAMETERS"),S+=Ie(x,"EC PRIVATE KEY")}if("PKCS1PRV"==t&&void 0!==p&&e instanceof p&&(void 0===n||null==n)&&1==e.isPrivate)return Ie(E=b(e).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==t&&void 0!==m&&e instanceof m&&void 0!==n&&null!=n&&1==e.isPrivate){var E=v(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,n,r,a)}if("PKCS5PRV"==t&&void 0!==d&&e instanceof d&&void 0!==n&&null!=n&&1==e.isPrivate){E=y(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,n,r,a)}if("PKCS5PRV"==t&&void 0!==p&&e instanceof p&&void 0!==n&&null!=n&&1==e.isPrivate){E=b(e).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,n,r,a)}var F=function(e,t){var n=A(e,t);return new l({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},A=function(e,t){var n=g.lib.WordArray.random(8),r=g.lib.WordArray.random(8),i=g.PBKDF2(t,n,{keySize:6,iterations:100}),a=g.enc.Hex.parse(e),s=g.TripleDES.encrypt(a,i,{iv:r})+"",o={};return o.ciphertext=s,o.pbkdf2Salt=g.enc.Hex.stringify(n),o.pbkdf2Iter=100,o.encryptionSchemeAlg="DES-EDE3-CBC",o.encryptionSchemeIV=g.enc.Hex.stringify(r),o};if("PKCS8PRV"==t&&null!=m&&e instanceof m&&1==e.isPrivate){var D=v(e).getEncodedHex();E=l({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:D}}]}).getEncodedHex();return void 0===n||null==n?Ie(E,"PRIVATE KEY"):Ie(x=F(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==d&&e instanceof d&&1==e.isPrivate){D=new l({seq:[{int:1},{octstr:{hex:e.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+e.pubKeyHex}}]}]}).getEncodedHex(),E=l({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:e.curveName}}]},{octstr:{hex:D}}]}).getEncodedHex();return void 0===n||null==n?Ie(E,"PRIVATE KEY"):Ie(x=F(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==t&&void 0!==p&&e instanceof p&&1==e.isPrivate){D=new c({bigint:e.x}).getEncodedHex(),E=l({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:e.p}},{int:{bigint:e.q}},{int:{bigint:e.g}}]}]},{octstr:{hex:D}}]}).getEncodedHex();return void 0===n||null==n?Ie(E,"PRIVATE KEY"):Ie(x=F(E,n),"ENCRYPTED PRIVATE KEY")}throw new Error("unsupported object nor format")},Ye.getKeyFromCSRPEM=function(e){var t=Te(e,"CERTIFICATE REQUEST");return Ye.getKeyFromCSRHex(t)},Ye.getKeyFromCSRHex=function(e){var t=Ye.parseCSRHex(e);return Ye.getKey(t.p8pubkeyhex,null,"pkcs8pub")},Ye.parseCSRHex=function(e){var t=de,n=t.getChildIdx,r=t.getTLV,i={},a=e;if("30"!=a.substr(0,2))throw new Error("malformed CSR(code:001)");var s=n(a,0);if(s.length<1)throw new Error("malformed CSR(code:002)");if("30"!=a.substr(s[0],2))throw new Error("malformed CSR(code:003)");var o=n(a,s[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=r(a,o[2]),i},Ye.getKeyID=function(e){var t=Ye,n=de;"string"==typeof e&&-1!=e.indexOf("BEGIN ")&&(e=t.getKey(e));var r=Te(t.getPEM(e)),i=n.getIdxbyList(r,0,[1]),a=n.getV(r,i).substring(2);return he.crypto.Util.hashHex(a,"sha1")},Ye.getJWKFromKey=function(e){var t={};if(e instanceof ae&&e.isPrivate)return t.kty="RSA",t.n=xe(e.n.toString(16)),t.e=xe(e.e.toString(16)),t.d=xe(e.d.toString(16)),t.p=xe(e.p.toString(16)),t.q=xe(e.q.toString(16)),t.dp=xe(e.dmp1.toString(16)),t.dq=xe(e.dmq1.toString(16)),t.qi=xe(e.coeff.toString(16)),t;if(e instanceof ae&&e.isPublic)return t.kty="RSA",t.n=xe(e.n.toString(16)),t.e=xe(e.e.toString(16)),t;if(e instanceof he.crypto.ECDSA&&e.isPrivate){if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);var n=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=xe(n.x),t.y=xe(n.y),t.d=xe(e.prvKeyHex),t}if(e instanceof he.crypto.ECDSA&&e.isPublic){var r;if("P-256"!==(r=e.getShortNISTPCurveName())&&"P-384"!==r)throw new Error("unsupported curve name for JWT: "+r);n=e.getPublicKeyXYHex();return t.kty="EC",t.crv=r,t.x=xe(n.x),t.y=xe(n.y),t}throw new Error("not supported key object")},ae.getPosArrayOfChildrenFromHex=function(e){return de.getChildIdx(e,0)},ae.getHexValueArrayOfChildrenFromHex=function(e){var t,n=de.getV,r=n(e,(t=ae.getPosArrayOfChildrenFromHex(e))[0]),i=n(e,t[1]),a=n(e,t[2]),s=n(e,t[3]),o=n(e,t[4]),u=n(e,t[5]),c=n(e,t[6]),l=n(e,t[7]),h=n(e,t[8]);return(t=new Array).push(r,i,a,s,o,u,c,l,h),t},ae.prototype.readPrivateKeyFromPEMString=function(e){var t=Te(e),n=ae.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},ae.prototype.readPKCS5PrvKeyHex=function(e){var t=ae.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},ae.prototype.readPKCS8PrvKeyHex=function(e){var t,n,r,i,a,s,o,u,c=de,l=c.getVbyListEx;if(!1===c.isASN1HEX(e))throw new Error("not ASN.1 hex string");try{t=l(e,0,[2,0,1],"02"),n=l(e,0,[2,0,2],"02"),r=l(e,0,[2,0,3],"02"),i=l(e,0,[2,0,4],"02"),a=l(e,0,[2,0,5],"02"),s=l(e,0,[2,0,6],"02"),o=l(e,0,[2,0,7],"02"),u=l(e,0,[2,0,8],"02")}catch(e){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(t,n,r,i,a,s,o,u)},ae.prototype.readPKCS5PubKeyHex=function(e){var t=de,n=t.getV;if(!1===t.isASN1HEX(e))throw new Error("keyHex is not ASN.1 hex string");var r=t.getChildIdx(e,0);if(2!==r.length||"02"!==e.substr(r[0],2)||"02"!==e.substr(r[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=n(e,r[0]),a=n(e,r[1]);this.setPublic(i,a)},ae.prototype.readPKCS8PubKeyHex=function(e){var t=de;if(!1===t.isASN1HEX(e))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==t.getTLVbyListEx(e,0,[0,0]))throw new Error("not PKCS8 RSA public key");var n=t.getTLVbyListEx(e,0,[1,0]);this.readPKCS5PubKeyHex(n)},ae.prototype.readCertPubKeyHex=function(e,t){var n,r;(n=new Ze).readCertHex(e),r=n.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};new RegExp("[^0-9a-f]","gi");function Xe(e,t){for(var n="",r=t/4-e.length,i=0;i<r;i++)n+="0";return n+e}function Je(e,t,n){for(var r="",i=0;r.length<t;)r+=Ae(n(De(e+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return r}function Qe(e){for(var t in he.crypto.Util.DIGESTINFOHEAD){var n=he.crypto.Util.DIGESTINFOHEAD[t],r=n.length;if(e.substring(0,r)==n)return[t,e.substring(r)]}return[]}function Ze(e){var t,n=de,r=n.getChildIdx,i=n.getV,a=n.getTLV,s=n.getVbyList,o=n.getVbyListEx,u=n.getTLVbyList,c=n.getTLVbyListEx,l=n.getIdxbyList,h=n.getIdxbyListEx,f=n.getVidx,p=n.getInt,d=n.oidname,g=n.hextooidstr,m=Te;try{t=he.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(e){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var e=u(this.hex,0,[0,0]);if("a0"==e.substr(0,2)){var t=u(e,0,[0]),n=p(t,0);if(n<0||2<n)throw new Error("malformed version field");return this.version=n+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return o(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var e=c(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(e)},this.getAlgorithmIdentifierName=function(e){for(var n in t)if(e===t[n])return n;return d(o(e,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return u(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return u(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var e=s(this.hex,0,[0,4+this.foffset,0]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getNotAfter=function(){var e=s(this.hex,0,[0,4+this.foffset,1]);return e=e.replace(/(..)/g,"%$1"),e=decodeURIComponent(e)},this.getPublicKeyHex=function(){return n.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var e=this.getPublicKeyIdx();return l(this.hex,e,[1,0],"30")},this.getPublicKey=function(){return Ye.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var e=u(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(e)},this.getSignatureValueHex=function(){return s(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=u(this.hex,0,[0],"30"),i=new he.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.parseExt=function(e){var t,a,o;if(void 0===e){if(o=this.hex,3!==this.version)return-1;t=l(o,0,[0,7,0],"30"),a=r(o,t)}else{o=Te(e);var u=l(o,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(o,u))return void(this.aExtInfo=new Array);t=l(o,0,[0,3,0,1,0],"30"),a=r(o,t),this.hex=o}this.aExtInfo=new Array;for(var c=0;c<a.length;c++){var h={critical:!1},p=0;3===r(o,a[c]).length&&(h.critical=!0,p=1),h.oid=n.hextooidstr(s(o,a[c],[0],"06"));var d=l(o,a[c],[1+p]);h.vidx=f(o,d),this.aExtInfo.push(h)}},this.getExtInfo=function(e){var t=this.aExtInfo,n=e;if(e.match(/^[0-9.]+$/)||(n=he.asn1.x509.OID.name2oid(e)),""!==n)for(var r=0;r<t.length;r++)if(t[r].oid===n)return t[r]},this.getExtBasicConstraints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("basicConstraints");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"basicConstraints"};if(t&&(r.critical=!0),"3000"===e)return r;if("30030101ff"===e)return r.cA=!0,r;if("30060101ff02"===e.substr(0,12)){var s=i(e,10),o=parseInt(s,16);return r.cA=!0,r.pathLen=o,r}throw new Error("hExtV parse error: "+e)},this.getExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("keyUsage");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"keyUsage"};return t&&(r.critical=!0),r.names=this.getExtKeyUsageString(e).split(","),r},this.getExtKeyUsageBin=function(e){if(void 0===e){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";e=a(this.hex,t.vidx)}if(8!=e.length&&10!=e.length)throw new Error("malformed key usage value: "+e);var n="000000000000000"+parseInt(e.substr(6),16).toString(2);return 8==e.length&&(n=n.slice(-8)),10==e.length&&(n=n.slice(-16)),""==(n=n.replace(/0+$/,""))&&(n="0"),n},this.getExtKeyUsageString=function(e){for(var t=this.getExtKeyUsageBin(e),n=new Array,r=0;r<t.length;r++)"1"==t.substr(r,1)&&n.push(Ze.KEYUSAGE_NAME[r]);return n.join(",")},this.getExtSubjectKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectKeyIdentifier");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"subjectKeyIdentifier"};t&&(r.critical=!0);var s=i(e,0);return r.kid={hex:s},r},this.getExtAuthorityKeyIdentifier=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityKeyIdentifier");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var s={extname:"authorityKeyIdentifier"};t&&(s.critical=!0);for(var o=r(e,0),u=0;u<o.length;u++){var c=e.substr(o[u],2);if("80"===c&&(s.kid={hex:i(e,o[u])}),"a1"===c){var l=a(e,o[u]),h=this.getGeneralNames(l);s.issuer=h[0].dn}"82"===c&&(s.sn={hex:i(e,o[u])})}return s},this.getExtExtKeyUsage=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("extKeyUsage");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var s={extname:"extKeyUsage",array:[]};t&&(s.critical=!0);for(var o=r(e,0),u=0;u<o.length;u++)s.array.push(d(i(e,o[u])));return s},this.getExtExtKeyUsageName=function(){var e=this.getExtInfo("extKeyUsage");if(void 0===e)return e;var t=new Array,n=a(this.hex,e.vidx);if(""===n)return t;for(var s=r(n,0),o=0;o<s.length;o++)t.push(d(i(n,s[o])));return t},this.getExtSubjectAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("subjectAltName");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"subjectAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getExtIssuerAltName=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("issuerAltName");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var r={extname:"issuerAltName",array:[]};return t&&(r.critical=!0),r.array=this.getGeneralNames(e),r},this.getGeneralNames=function(e){for(var t=r(e,0),n=[],i=0;i<t.length;i++){var s=this.getGeneralName(a(e,t[i]));void 0!==s&&n.push(s)}return n},this.getGeneralName=function(e){var t=e.substr(0,2),n=i(e,0),r=Ae(n);return"81"==t?{rfc822:r}:"82"==t?{dns:r}:"86"==t?{uri:r}:"87"==t?{ip:Be(n)}:"a4"==t?{dn:this.getX500Name(n)}:void 0},this.getExtSubjectAltName2=function(){var e,t,n,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var o=new Array,u=a(this.hex,s.vidx),c=r(u,0),l=0;l<c.length;l++)n=u.substr(c[l],2),e=i(u,c[l]),"81"===n&&(t=Fe(e),o.push(["MAIL",t])),"82"===n&&(t=Fe(e),o.push(["DNS",t])),"84"===n&&(t=Ze.hex2dn(e,0),o.push(["DN",t])),"86"===n&&(t=Fe(e),o.push(["URI",t])),"87"===n&&(t=Be(e),o.push(["IP",t]));return o},this.getExtCRLDistributionPoints=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("cRLDistributionPoints");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"cRLDistributionPoints",array:[]};t&&(i.critical=!0);for(var s=r(e,0),o=0;o<s.length;o++){var u=a(e,s[o]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=e.substr(n[i],2),o=a(e,n[i]);"a0"==s&&(t.dpname=this.getDistributionPointName(o))}return t},this.getDistributionPointName=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=e.substr(n[i],2),o=a(e,n[i]);"a0"==s&&(t.full=this.getGeneralNames(o))}return t},this.getExtCRLDistributionPointsURI=function(){var e=this.getExtInfo("cRLDistributionPoints");if(void 0===e)return e;for(var t=new Array,n=r(this.hex,e.vidx),i=0;i<n.length;i++)try{var a=Fe(s(this.hex,n[i],[0,0,0],"86"));t.push(a)}catch(e){}return t},this.getExtAIAInfo=function(){var e=this.getExtInfo("authorityInfoAccess");if(void 0===e)return e;for(var t={ocsp:[],caissuer:[]},n=r(this.hex,e.vidx),i=0;i<n.length;i++){var a=s(this.hex,n[i],[0],"06"),o=s(this.hex,n[i],[1],"86");"2b06010505073001"===a&&t.ocsp.push(Fe(o)),"2b06010505073002"===a&&t.caissuer.push(Fe(o))}return t},this.getExtAuthorityInfoAccess=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("authorityInfoAccess");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"authorityInfoAccess",array:[]};t&&(i.critical=!0);for(var u=r(e,0),c=0;c<u.length;c++){var l=o(e,u[c],[0],"06"),h=Fe(s(e,u[c],[1],"86"));if("2b06010505073001"==l)i.array.push({ocsp:h});else{if("2b06010505073002"!=l)throw new Error("unknown method: "+l);i.array.push({caissuer:h})}}return i},this.getExtCertificatePolicies=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("certificatePolicies");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"certificatePolicies",array:[]};t&&(i.critical=!0);for(var s=r(e,0),o=0;o<s.length;o++){var u=a(e,s[o]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(e){var t={},n=s(e,0,[0],"06");t.policyoid=d(n);var i=h(e,0,[1],"30");if(-1!=i){t.array=[];for(var o=r(e,i),u=0;u<o.length;u++){var c=a(e,o[u]),l=this.getPolicyQualifierInfo(c);t.array.push(l)}}return t},this.getPolicyQualifierInfo=function(e){var t={},n=s(e,0,[0],"06");if("2b06010505070201"===n){var r=o(e,0,[1],"16");t.cps=Ae(r)}else if("2b06010505070202"===n){var i=u(e,0,[1],"30");t.unotice=this.getUserNotice(i)}return t},this.getUserNotice=function(e){for(var t={},n=r(e,0),i=0;i<n.length;i++){var s=a(e,n[i]);"30"!=s.substr(0,2)&&(t.exptext=this.getDisplayText(s))}return t},this.getDisplayText=function(e){var t={};return t.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[e.substr(0,2)],t.str=Ae(i(e,0)),t},this.getExtCRLNumber=function(e,t){var n={extname:"cRLNumber"};if(t&&(n.critical=!0),"02"==e.substr(0,2))return n.num={hex:i(e,0)},n;throw new Error("hExtV parse error: "+e)},this.getExtCRLReason=function(e,t){var n={extname:"cRLReason"};if(t&&(n.critical=!0),"0a"==e.substr(0,2))return n.code=parseInt(i(e,0),16),n;throw new Error("hExtV parse error: "+e)},this.getExtOcspNonce=function(e,t){var n={extname:"ocspNonce"};t&&(n.critical=!0);var r=i(e,0);return n.hex=r,n},this.getExtOcspNoCheck=function(e,t){var n={extname:"ocspNoCheck"};return t&&(n.critical=!0),n},this.getExtAdobeTimeStamp=function(e,t){if(void 0===e&&void 0===t){var n=this.getExtInfo("adobeTimeStamp");if(void 0===n)return;e=a(this.hex,n.vidx),t=n.critical}var i={extname:"adobeTimeStamp"};t&&(i.critical=!0);var s=r(e,0);if(s.length>1){var o=a(e,s[1]),u=this.getGeneralName(o);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=a(e,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i},this.getX500NameRule=function(e){for(var t=null,n=[],r=0;r<e.length;r++)for(var i=e[r],a=0;a<i.length;a++)n.push(i[a]);for(r=0;r<n.length;r++){var s=n[r],o=s.ds,u=s.value,c=s.type;if(":"+o,"prn"!=o&&"utf8"!=o&&"ia5"!=o)return"mixed";if("ia5"==o){if("CN"!=c)return"mixed";if(he.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==o)continue;return"mixed"}if(":"+o,null==t)t=o;else if(t!==o)return"mixed"}return null==t?"prn":t},this.getX500Name=function(e){var t=this.getX500NameArray(e);return{array:t,str:this.dnarraytostr(t)}},this.getX500NameArray=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getRDN(a(e,n[i])));return t},this.getRDN=function(e){for(var t=[],n=r(e,0),i=0;i<n.length;i++)t.push(this.getAttrTypeAndValue(a(e,n[i])));return t},this.getAttrTypeAndValue=function(e){var t={type:null,value:null,ds:null},n=r(e,0),i=s(e,n[0],[],"06"),a=s(e,n[1],[]),o=he.asn1.ASN1Util.oidHexToInt(i);return t.type=he.asn1.x509.OID.oid2atype(o),t.ds=this.HEX2STAG[e.substr(n[1],2)],"bmp"!=t.ds?t.value=Fe(a):t.value=He(a),t},this.readCertPEM=function(e){this.readCertHex(m(e))},this.readCertHex=function(e){this.hex=e,this.getVersion();try{l(this.hex,0,[0,7],"a3"),this.parseExt()}catch(e){}},this.getParam=function(){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=Ie(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),e},this.getExtParamArray=function(e){null==e&&(-1!=h(this.hex,0,[0,"[3]"])&&(e=c(this.hex,0,[0,"[3]",0],"30")));for(var t=[],n=r(e,0),i=0;i<n.length;i++){var s=a(e,n[i]),o=this.getExtParam(s);null!=o&&t.push(o)}return t},this.getExtParam=function(e){var t=r(e,0).length;if(2!=t&&3!=t)throw new Error("wrong number elements in Extension: "+t+" "+e);var n=g(s(e,0,[0],"06")),i=!1;3==t&&"0101ff"==u(e,0,[1])&&(i=!0);var a=u(e,0,[t-1,0]),o=void 0;if("2.5.29.14"==n?o=this.getExtSubjectKeyIdentifier(a,i):"2.5.29.15"==n?o=this.getExtKeyUsage(a,i):"2.5.29.17"==n?o=this.getExtSubjectAltName(a,i):"2.5.29.18"==n?o=this.getExtIssuerAltName(a,i):"2.5.29.19"==n?o=this.getExtBasicConstraints(a,i):"2.5.29.31"==n?o=this.getExtCRLDistributionPoints(a,i):"2.5.29.32"==n?o=this.getExtCertificatePolicies(a,i):"2.5.29.35"==n?o=this.getExtAuthorityKeyIdentifier(a,i):"2.5.29.37"==n?o=this.getExtExtKeyUsage(a,i):"1.3.6.1.5.5.7.1.1"==n?o=this.getExtAuthorityInfoAccess(a,i):"2.5.29.20"==n?o=this.getExtCRLNumber(a,i):"2.5.29.21"==n?o=this.getExtCRLReason(a,i):"1.3.6.1.5.5.7.48.1.2"==n?o=this.getExtOcspNonce(a,i):"1.3.6.1.5.5.7.48.1.5"==n?o=this.getExtOcspNoCheck(a,i):"1.2.840.113583.1.1.9.1"==n&&(o=this.getExtAdobeTimeStamp(a,i)),null!=o)return o;var c={extname:n,extn:a};return i&&(c.critical=!0),c},this.findExt=function(e,t){for(var n=0;n<e.length;n++)if(e[n].extname==t)return e[n];return null},this.updateExtCDPFullURI=function(e,t){var n=this.findExt(e,"cRLDistributionPoints");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)if(null!=r[i].dpname&&null!=r[i].dpname.full)for(var a=r[i].dpname.full,s=0;s<a.length;s++){var o=a[i];null!=o.uri&&(o.uri=t)}},this.updateExtAIAOCSP=function(e,t){var n=this.findExt(e,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)null!=r[i].ocsp&&(r[i].ocsp=t)},this.updateExtAIACAIssuer=function(e,t){var n=this.findExt(e,"authorityInfoAccess");if(null!=n&&null!=n.array)for(var r=n.array,i=0;i<r.length;i++)null!=r[i].caissuer&&(r[i].caissuer=t)},this.dnarraytostr=function(e){return"/"+e.map((function(e){return function(e){return e.map((function(e){return function(e){return e.type+"="+e.value}(e).replace(/\+/,"\\+")})).join("+")}(e).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var e,t,n,r,i=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];if(t+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var a=0;a<i.array.length;a++){var s=i.array[a];void 0!==s.cps&&(t+=" cps: "+s.cps+"\n")}}return t},a=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];try{void 0!==i.dpname.full[0].uri&&(t+=" "+i.dpname.full[0].uri+"\n")}catch(e){}try{void 0!==i.dname.full[0].dn.hex&&(t+=" "+Ze.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(e){}}return t},s=function(e){for(var t="",n=e.array,r=0;r<n.length;r++){var i=n[r];void 0!==i.caissuer&&(t+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(t+=" ocsp: "+i.ocsp+"\n")}return t};if(e="Basic Fields\n",e+=" serial number: "+this.getSerialNumberHex()+"\n",e+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",e+=" issuer: "+this.getIssuerString()+"\n",e+=" notBefore: "+this.getNotBefore()+"\n",e+=" notAfter: "+this.getNotAfter()+"\n",e+=" subject: "+this.getSubjectString()+"\n",e+=" subject public key info: \n",e+=" key algorithm: "+(t=this.getPublicKey()).type+"\n","RSA"===t.type&&(e+=" n="+Ue(t.n.toString(16)).substr(0,16)+"...\n",e+=" e="+Ue(t.e.toString(16))+"\n"),null!=(n=this.aExtInfo)){e+="X509v3 Extensions:\n";for(var o=0;o<n.length;o++){var u=n[o],c=he.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var l="";if(!0===u.critical&&(l="CRITICAL"),e+=" "+c+" "+l+":\n","basicConstraints"===c){var h=this.getExtBasicConstraints();void 0===h.cA?e+=" {}\n":(e+=" cA=true",void 0!==h.pathLen&&(e+=", pathLen="+h.pathLen),e+="\n")}else if("keyUsage"===c)e+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)e+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var f=this.getExtAuthorityKeyIdentifier();void 0!==f.kid&&(e+=" kid="+f.kid.hex+"\n")}else{if("extKeyUsage"===c)e+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n";else if("subjectAltName"===c)e+=" "+(r=this.getExtSubjectAltName(),JSON.stringify(r.array).replace(/[\[\]\{\}\"]/g,""))+"\n";else if("cRLDistributionPoints"===c)e+=a(this.getExtCRLDistributionPoints());else if("authorityInfoAccess"===c)e+=s(this.getExtAuthorityInfoAccess());else"certificatePolicies"===c&&(e+=i(this.getExtCertificatePolicies()))}}}return e+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",e+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof e&&(-1!=e.indexOf("-----BEGIN")?this.readCertPEM(e):he.lang.String.isHex(e)&&this.readCertHex(e))}ae.prototype.sign=function(e,t){var n=function(e){return he.crypto.Util.hashString(e,t)}(e);return this.signWithMessageHash(n,t)},ae.prototype.signWithMessageHash=function(e,t){var n=re(he.crypto.Util.getPaddedDigestInfoHex(e,t,this.n.bitLength()),16);return Xe(this.doPrivate(n).toString(16),this.n.bitLength())},ae.prototype.signPSS=function(e,t,n){var r,i=(r=De(e),he.crypto.Util.hashHex(r,t));return void 0===n&&(n=-1),this.signWithMessageHashPSS(i,t,n)},ae.prototype.signWithMessageHashPSS=function(e,t,n){var r,i=Ae(e),a=i.length,s=this.n.bitLength()-1,o=Math.ceil(s/8),u=function(e){return he.crypto.Util.hashHex(e,t)};if(-1===n||void 0===n)n=a;else if(-2===n)n=o-a-2;else if(n<-2)throw new Error("invalid salt length");if(o<a+n+2)throw new Error("data too long");var c="";n>0&&(c=new Array(n),(new ne).nextBytes(c),c=String.fromCharCode.apply(String,c));var l=Ae(u(De("\0\0\0\0\0\0\0\0"+i+c))),h=[];for(r=0;r<o-n-a-2;r+=1)h[r]=0;var f=String.fromCharCode.apply(String,h)+""+c,p=Je(l,f.length,u),d=[];for(r=0;r<f.length;r+=1)d[r]=f.charCodeAt(r)^p.charCodeAt(r);var g=65280>>8*o-s&255;for(d[0]&=~g,r=0;r<a;r++)d.push(l.charCodeAt(r));return d.push(188),Xe(this.doPrivate(new S(d)).toString(16),this.n.bitLength())},ae.prototype.verify=function(e,t){if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var n=re(t,16),r=this.n.bitLength();if(n.bitLength()>r)return!1;var i=this.doPublic(n).toString(16);if(i.length+3!=r/4)return!1;var a=Qe(i.replace(/^1f+00/,""));if(0==a.length)return!1;var s=a[0];return a[1]==function(e){return he.crypto.Util.hashString(e,s)}(e)},ae.prototype.verifyWithMessageHash=function(e,t){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var n=re(t,16);if(n.bitLength()>this.n.bitLength())return 0;var r=Qe(this.doPublic(n).toString(16).replace(/^1f+00/,""));if(0==r.length)return!1;r[0];return r[1]==e},ae.prototype.verifyPSS=function(e,t,n,r){var i,a=(i=De(e),he.crypto.Util.hashHex(i,n));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(a,t,n,r)},ae.prototype.verifyWithMessageHashPSS=function(e,t,n,r){if(t.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,a=new S(t,16),s=function(e){return he.crypto.Util.hashHex(e,n)},o=Ae(e),u=o.length,c=this.n.bitLength()-1,l=Math.ceil(c/8);if(-1===r||void 0===r)r=u;else if(-2===r)r=l-u-2;else if(r<-2)throw new Error("invalid salt length");if(l<u+r+2)throw new Error("data too long");var h=this.doPublic(a).toByteArray();for(i=0;i<h.length;i+=1)h[i]&=255;for(;h.length<l;)h.unshift(0);if(188!==h[l-1])throw new Error("encoded message does not end in 0xbc");var f=(h=String.fromCharCode.apply(String,h)).substr(0,l-u-1),p=h.substr(f.length,u),d=65280>>8*l-c&255;if(0!=(f.charCodeAt(0)&d))throw new Error("bits beyond keysize not zero");var g=Je(p,f.length,s),m=[];for(i=0;i<f.length;i+=1)m[i]=f.charCodeAt(i)^g.charCodeAt(i);m[0]&=~d;var v=l-u-r-2;for(i=0;i<v;i+=1)if(0!==m[i])throw new Error("leftmost octets not zero");if(1!==m[v])throw new Error("0x01 marker not found");return p===Ae(s(De("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,m.slice(-r)))))},ae.SALT_LEN_HLEN=-1,ae.SALT_LEN_MAX=-2,ae.SALT_LEN_RECOVER=-2,Ze.hex2dn=function(e,t){void 0===t&&(t=0);var n=new Ze;de.getTLV(e,t);return n.getX500Name(e).str},Ze.hex2rdn=function(e,t){if(void 0===t&&(t=0),"31"!==e.substr(t,2))throw new Error("malformed RDN");for(var n=new Array,r=de.getChildIdx(e,t),i=0;i<r.length;i++)n.push(Ze.hex2attrTypeValue(e,r[i]));return(n=n.map((function(e){return e.replace("+","\\+")}))).join("+")},Ze.hex2attrTypeValue=function(e,t){var n=de,r=n.getV;if(void 0===t&&(t=0),"30"!==e.substr(t,2))throw new Error("malformed attribute type and value");var i=n.getChildIdx(e,t);2!==i.length||e.substr(i[0],2);var a=r(e,i[0]),s=he.asn1.ASN1Util.oidHexToInt(a);return he.asn1.x509.OID.oid2atype(s)+"="+Ae(r(e,i[1]))},Ze.getPublicKeyFromCertHex=function(e){var t=new Ze;return t.readCertHex(e),t.getPublicKey()},Ze.getPublicKeyFromCertPEM=function(e){var t=new Ze;return t.readCertPEM(e),t.getPublicKey()},Ze.getPublicKeyInfoPropOfCertPEM=function(e){var t,n,r=de.getVbyList,i={};return i.algparam=null,(t=new Ze).readCertPEM(e),n=t.getPublicKeyHex(),i.keyhex=r(n,0,[1],"03").substr(2),i.algoid=r(n,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=r(n,0,[0,1],"06")),i},Ze.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"];void 0!==he&&he||(he={}),void 0!==he.jws&&he.jws||(he.jws={}),he.jws.JWS=function(){var e=he.jws.JWS.isSafeJSONString;this.parseJWS=function(t,n){if(void 0===this.parsedJWS||!n&&void 0===this.parsedJWS.sigvalH){var r=t.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==r)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=r[1],a=r[2],s=r[3],o=i+"."+a;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=a,this.parsedJWS.sigvalB64U=s,this.parsedJWS.si=o,!n){var u=Se(s),c=re(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var l=pe(i),h=pe(a);if(this.parsedJWS.headS=l,this.parsedJWS.payloadS=h,!e(l,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+l}}},he.jws.JWS.sign=function(e,t,n,r,i){var a,s,o,u=he,c=u.jws.JWS,l=c.readSafeJSONString,h=c.isSafeJSONString,f=u.crypto,p=(f.ECDSA,f.Mac),d=f.Signature,g=JSON;if("string"!=typeof t&&"object"!=typeof t)throw"spHeader must be JSON string or object: "+t;if("object"==typeof t&&(s=t,a=g.stringify(s)),"string"==typeof t){if(!h(a=t))throw"JWS Head is not safe JSON string: "+a;s=l(a)}if(o=n,"object"==typeof n&&(o=g.stringify(n)),""!=e&&null!=e||void 0===s.alg||(e=s.alg),""!=e&&null!=e&&void 0===s.alg&&(s.alg=e,a=g.stringify(s)),e!==s.alg)throw"alg and sHeader.alg doesn't match: "+e+"!="+s.alg;var m=null;if(void 0===c.jwsalg2sigalg[e])throw"unsupported alg name: "+e;m=c.jwsalg2sigalg[e];var v=fe(a)+"."+fe(o),y="";if("Hmac"==m.substr(0,4)){if(void 0===r)throw"mac key shall be specified for HS* alg";var b=new p({alg:m,prov:"cryptojs",pass:r});b.updateString(v),y=b.doFinal()}else if(-1!=m.indexOf("withECDSA")){(x=new d({alg:m})).init(r,i),x.updateString(v);var w=x.sign();y=he.crypto.ECDSA.asn1SigToConcatSig(w)}else{var x;if("none"!=m)(x=new d({alg:m})).init(r,i),x.updateString(v),y=x.sign()}return v+"."+xe(y)},he.jws.JWS.verify=function(e,t,n){var r,i=he,a=i.jws.JWS,s=a.readSafeJSONString,o=i.crypto,u=o.ECDSA,c=o.Mac,l=o.Signature;r=ae;var h=e.split(".");if(3!==h.length)return!1;var f=h[0]+"."+h[1],p=Se(h[2]),d=s(pe(h[0])),g=null,m=null;if(void 0===d.alg)throw"algorithm not specified in header";if((m=(g=d.alg).substr(0,2),null!=n&&"[object Array]"===Object.prototype.toString.call(n)&&n.length>0)&&-1==(":"+n.join(":")+":").indexOf(":"+g+":"))throw"algorithm '"+g+"' not accepted in the list";if("none"!=g&&null===t)throw"key shall be specified to verify.";if("string"==typeof t&&-1!=t.indexOf("-----BEGIN ")&&(t=Ye.getKey(t)),!("RS"!=m&&"PS"!=m||t instanceof r))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==m&&!(t instanceof u))throw"key shall be a ECDSA obj for ES* algs";var v=null;if(void 0===a.jwsalg2sigalg[d.alg])throw"unsupported alg name: "+g;if("none"==(v=a.jwsalg2sigalg[g]))throw"not supported";if("Hmac"==v.substr(0,4)){if(void 0===t)throw"hexadecimal key shall be specified for HMAC";var y=new c({alg:v,pass:t});return y.updateString(f),p==y.doFinal()}if(-1!=v.indexOf("withECDSA")){var b,w=null;try{w=u.concatSigToASN1Sig(p)}catch(e){return!1}return(b=new l({alg:v})).init(t),b.updateString(f),b.verify(w)}return(b=new l({alg:v})).init(t),b.updateString(f),b.verify(p)},he.jws.JWS.parse=function(e){var t,n,r,i=e.split("."),a={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return t=i[0],n=i[1],3==i.length&&(r=i[2]),a.headerObj=he.jws.JWS.readSafeJSONString(pe(t)),a.payloadObj=he.jws.JWS.readSafeJSONString(pe(n)),a.headerPP=JSON.stringify(a.headerObj,null," "),null==a.payloadObj?a.payloadPP=pe(n):a.payloadPP=JSON.stringify(a.payloadObj,null," "),void 0!==r&&(a.sigHex=Se(r)),a},he.jws.JWS.verifyJWT=function(e,t,n){var r=he.jws,i=r.JWS,a=i.readSafeJSONString,s=i.inArray,o=i.includedArray,u=e.split("."),c=u[0],l=u[1],h=(Se(u[2]),a(pe(c))),f=a(pe(l));if(void 0===h.alg)return!1;if(void 0===n.alg)throw"acceptField.alg shall be specified";if(!s(h.alg,n.alg))return!1;if(void 0!==f.iss&&"object"==typeof n.iss&&!s(f.iss,n.iss))return!1;if(void 0!==f.sub&&"object"==typeof n.sub&&!s(f.sub,n.sub))return!1;if(void 0!==f.aud&&"object"==typeof n.aud)if("string"==typeof f.aud){if(!s(f.aud,n.aud))return!1}else if("object"==typeof f.aud&&!o(f.aud,n.aud))return!1;var p=r.IntDate.getNow();return void 0!==n.verifyAt&&"number"==typeof n.verifyAt&&(p=n.verifyAt),void 0!==n.gracePeriod&&"number"==typeof n.gracePeriod||(n.gracePeriod=0),!(void 0!==f.exp&&"number"==typeof f.exp&&f.exp+n.gracePeriod<p)&&(!(void 0!==f.nbf&&"number"==typeof f.nbf&&p<f.nbf-n.gracePeriod)&&(!(void 0!==f.iat&&"number"==typeof f.iat&&p<f.iat-n.gracePeriod)&&((void 0===f.jti||void 0===n.jti||f.jti===n.jti)&&!!i.verify(e,t,n.alg))))},he.jws.JWS.includedArray=function(e,t){var n=he.jws.JWS.inArray;if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(!n(e[r],t))return!1;return!0},he.jws.JWS.inArray=function(e,t){if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1},he.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},he.jws.JWS.isSafeJSONString=function(e,t,n){var r=null;try{return"object"!=typeof(r=le(e))?0:r.constructor===Array?0:(t&&(t[n]=r),1)}catch(e){return 0}},he.jws.JWS.readSafeJSONString=function(e){var t=null;try{return"object"!=typeof(t=le(e))?null:t.constructor===Array?null:t}catch(e){return null}},he.jws.JWS.getEncodedSignatureValueFromJWS=function(e){var t=e.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==t)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return t[1]},he.jws.JWS.getJWKthumbprint=function(e){if("RSA"!==e.kty&&"EC"!==e.kty&&"oct"!==e.kty)throw"unsupported algorithm for JWK Thumprint";var t="{";if("RSA"===e.kty){if("string"!=typeof e.n||"string"!=typeof e.e)throw"wrong n and e value for RSA key";t+='"e":"'+e.e+'",',t+='"kty":"'+e.kty+'",',t+='"n":"'+e.n+'"}'}else if("EC"===e.kty){if("string"!=typeof e.crv||"string"!=typeof e.x||"string"!=typeof e.y)throw"wrong crv, x and y value for EC key";t+='"crv":"'+e.crv+'",',t+='"kty":"'+e.kty+'",',t+='"x":"'+e.x+'",',t+='"y":"'+e.y+'"}'}else if("oct"===e.kty){if("string"!=typeof e.k)throw"wrong k value for oct(symmetric) key";t+='"kty":"'+e.kty+'",',t+='"k":"'+e.k+'"}'}var n=De(t);return xe(he.crypto.Util.hashHex(n,"sha256"))},he.jws.IntDate={},he.jws.IntDate.get=function(e){var t=he.jws.IntDate,n=t.getNow,r=t.getZulu;if("now"==e)return n();if("now + 1hour"==e)return n()+3600;if("now + 1day"==e)return n()+86400;if("now + 1month"==e)return n()+2592e3;if("now + 1year"==e)return n()+31536e3;if(e.match(/Z$/))return r(e);if(e.match(/^[0-9]+$/))return parseInt(e);throw"unsupported format: "+e},he.jws.IntDate.getZulu=function(e){return _e(e)},he.jws.IntDate.getNow=function(){return~~(new Date/1e3)},he.jws.IntDate.intDate2UTCString=function(e){return new Date(1e3*e).toUTCString()},he.jws.IntDate.intDate2Zulu=function(e){var t=new Date(1e3*e);return("0000"+t.getUTCFullYear()).slice(-4)+("00"+(t.getUTCMonth()+1)).slice(-2)+("00"+t.getUTCDate()).slice(-2)+("00"+t.getUTCHours()).slice(-2)+("00"+t.getUTCMinutes()).slice(-2)+("00"+t.getUTCSeconds()).slice(-2)+"Z"},void 0!==he&&he||(he={}),void 0!==he.jws&&he.jws||(he.jws={}),he.jws.JWSJS=function(){var e=he.jws.JWS,t=e.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(e){this.init();var t=e.split(".");if(3!=t.length)throw"malformed input JWS";this.aHeader.push(t[0]),this.sPayload=t[1],this.aSignature.push(t[2])},this.addSignature=function(e,t,n,r){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var i=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var a=he.jws.JWS.sign(e,t,this.sPayload,n,r).split(".");a[0],a[2];this.aHeader.push(a[0]),this.aSignature.push(a[2])}catch(e){throw this.aHeader.length>i&&this.aHeader.pop(),this.aSignature.length>i&&this.aSignature.pop(),"addSignature failed: "+e}},this.verifyAll=function(e){if(this.aHeader.length!==e.length||this.aSignature.length!==e.length)return!1;for(var t=0;t<e.length;t++){var n=e[t];if(2!==n.length)return!1;if(!1===this.verifyNth(t,n[0],n[1]))return!1}return!0},this.verifyNth=function(t,n,r){if(this.aHeader.length<=t||this.aSignature.length<=t)return!1;var i=this.aHeader[t],a=this.aSignature[t],s=i+"."+this.sPayload+"."+a,o=!1;try{o=e.verify(s,n,r)}catch(e){return!1}return o},this.readJWSJS=function(e){if("string"==typeof e){var n=t(e);if(null==n)throw"argument is not safe JSON object string";this.aHeader=n.headers,this.sPayload=n.payload,this.aSignature=n.signatures}else try{if(!(e.headers.length>0))throw"malformed header";if(this.aHeader=e.headers,"string"!=typeof e.payload)throw"malformed signatures";if(this.sPayload=e.payload,!(e.signatures.length>0))throw"malformed signatures";this.aSignature=e.signatures}catch(e){throw"malformed JWS-JS JSON object: "+e}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},t.SecureRandom=ne,t.rng_seed_time=X,t.BigInteger=S,t.RSAKey=ae,t.ECDSA=he.crypto.ECDSA,t.DSA=he.crypto.DSA,t.Signature=he.crypto.Signature,t.MessageDigest=he.crypto.MessageDigest,t.Mac=he.crypto.Mac,t.Cipher=he.crypto.Cipher,t.KEYUTIL=Ye,t.ASN1HEX=de,t.X509=Ze,t.X509CRL=function(e){var t=he.lang.String.isHex,n=de,r=n.getV,i=n.getTLV,a=n.getVbyList,s=n.getTLVbyList,o=n.getTLVbyListEx,u=n.getIdxbyList,c=n.getIdxbyListEx,l=n.getChildIdx,h=new Ze;this.hex=null,this.posSigAlg=null,this.posRevCert=null,this._setPos=function(){var e=u(this.hex,0,[0,0]),t=this.hex.substr(e,2);if("02"==t)this.posSigAlg=1;else{if("30"!=t)throw new Error("malformed 1st item of TBSCertList: "+t);this.posSigAlg=0}var n,r=u(this.hex,0,[0,this.posSigAlg+3]),i=this.hex.substr(r,2);if("17"==i||"18"==i)n=u(this.hex,0,[0,this.posSigAlg+4]),this.posRevCert=null,-1!=n&&"30"==this.hex.substr(n,2)&&(this.posRevCert=this.posSigAlg+4);else if("30"==i)this.posRevCert=this.posSigAlg+3;else{if("a0"!=i)throw new Error("malformed nextUpdate or revCert tag: "+i);this.posRevCert=null}},this.getVersion=function(){return 0==this.posSigAlg?null:parseInt(a(this.hex,0,[0,0],"02"),16)+1},this.getSignatureAlgorithmField=function(){var e=s(this.hex,0,[0,this.posSigAlg],"30");return h.getAlgorithmIdentifierName(e)},this.getIssuer=function(){var e=s(this.hex,0,[0,this.posSigAlg+1],"30");return h.getX500Name(e)},this.getThisUpdate=function(){var e=a(this.hex,0,[0,this.posSigAlg+2]);return result=Ae(e)},this.getNextUpdate=function(){var e=u(this.hex,0,[0,this.posSigAlg+3]),t=this.hex.substr(e,2);return"17"!=t&&"18"!=t?null:Ae(r(this.hex,e))},this.getRevCertArray=function(){if(null==this.posRevCert)return null;for(var e=[],t=u(this.hex,0,[0,this.posRevCert]),n=l(this.hex,t),r=0;r<n.length;r++){var a=i(this.hex,n[r]);e.push(this.getRevCert(a))}return e},this.getRevCert=function(e){var t={},n=l(e,0);return t.sn={hex:a(e,0,[0],"02")},t.date=Ae(a(e,0,[1])),3==n.length&&(t.ext=h.getExtParamArray(s(e,0,[2]))),t},this.getSignatureValueHex=function(){return a(this.hex,0,[2],"03",!0)},this.verifySignature=function(e){var t=this.getSignatureAlgorithmField(),n=this.getSignatureValueHex(),r=s(this.hex,0,[0],"30"),i=new he.crypto.Signature({alg:t});return i.init(e),i.updateHex(r),i.verify(n)},this.getParam=function(){var e={},t=this.getVersion();null!=t&&(e.version=t),e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.thisupdate=this.getThisUpdate();var n=this.getNextUpdate();null!=n&&(e.nextupdate=n);var r=this.getRevCertArray();if(null!=r&&(e.revcert=r),-1!=c(this.hex,0,[0,"[0]"])){var i=o(this.hex,0,[0,"[0]",0]);e.ext=h.getExtParamArray(i)}return e.sighex=this.getSignatureValueHex(),e},"string"==typeof e&&(t(e)?this.hex=e:e.match(/-----BEGIN X509 CRL/)&&(this.hex=Te(e)),this._setPos())},t.CryptoJS=g,t.b64tohex=w,t.b64toBA=x,t.ECFieldElementFp=oe,t.ECPointFp=ue,t.ECCurveFp=ce,t.stoBA=ge,t.BAtos=me,t.BAtohex=ve,t.stohex=ye,t.stob64=function(e){return b(ye(e))},t.stob64u=function(e){return be(b(ye(e)))},t.b64utos=function(e){return me(x(we(e)))},t.b64tob64u=be,t.b64utob64=we,t.hex2b64=b,t.hextob64u=xe,t.b64utohex=Se,t.utf8tob64u=fe,t.b64utoutf8=pe,t.utf8tob64=function(e){return b(ke(Le(e)))},t.b64toutf8=function(e){return decodeURIComponent(Oe(w(e)))},t.utf8tohex=Ee,t.hextoutf8=Fe,t.hextorstr=Ae,t.rstrtohex=De,t.hextob64=Ce,t.hextob64nl=Re,t.b64nltohex=$e,t.hextopem=Ie,t.pemtohex=Te,t.hextoArrayBuffer=function(e){if(e.length%2!=0)throw"input is not even length";if(null==e.match(/^[0-9A-Fa-f]+$/))throw"input is not hexadecimal";for(var t=new ArrayBuffer(e.length/2),n=new DataView(t),r=0;r<e.length/2;r++)n.setUint8(r,parseInt(e.substr(2*r,2),16));return t},t.ArrayBuffertohex=function(e){for(var t="",n=new DataView(e),r=0;r<e.byteLength;r++)t+=("00"+n.getUint8(r).toString(16)).slice(-2);return t},t.zulutomsec=Pe,t.zulutosec=_e,t.zulutodate=function(e){return new Date(Pe(e))},t.datetozulu=function(e,t,n){var r,i=e.getUTCFullYear();if(t){if(i<1950||2049<i)throw"not proper year for UTCTime: "+i;r=(""+i).slice(-2)}else r=("000"+i).slice(-4);if(r+=("0"+(e.getUTCMonth()+1)).slice(-2),r+=("0"+e.getUTCDate()).slice(-2),r+=("0"+e.getUTCHours()).slice(-2),r+=("0"+e.getUTCMinutes()).slice(-2),r+=("0"+e.getUTCSeconds()).slice(-2),n){var a=e.getUTCMilliseconds();0!==a&&(r+="."+(a=(a=("00"+a).slice(-3)).replace(/0+$/g,"")))}return r+="Z"},t.uricmptohex=ke,t.hextouricmp=Oe,t.ipv6tohex=je,t.hextoipv6=Ne,t.hextoip=Be,t.iptohex=function(e){var t="malformed IP address";if(!(e=e.toLowerCase(e)).match(/^[0-9.]+$/)){if(e.match(/^[0-9a-f:]+$/)&&-1!==e.indexOf(":"))return je(e);throw t}var n=e.split(".");if(4!==n.length)throw t;var r="";try{for(var i=0;i<4;i++){r+=("0"+parseInt(n[i]).toString(16)).slice(-2)}return r}catch(e){throw t}},t.ucs2hextoutf8=He,t.encodeURIComponentAll=Le,t.newline_toUnix=function(e){return e=e.replace(/\r\n/gm,"\n")},t.newline_toDos=function(e){return e=(e=e.replace(/\r\n/gm,"\n")).replace(/\n/gm,"\r\n")},t.hextoposhex=Ue,t.intarystrtohex=Ve,t.strdiffidx=function(e,t){var n=e.length;e.length>t.length&&(n=t.length);for(var r=0;r<n;r++)if(e.charCodeAt(r)!=t.charCodeAt(r))return r;return e.length!=t.length?n:-1},t.oidtohex=qe,t.hextooid=Ke,t.strpad=ze,t.bitstrtoint=Ge,t.inttobitstr=function(e){var t=Number(e).toString(2),n=8-t.length%8;8==n&&(n=0),t+=ze("",n,"0");var r=parseInt(t,2).toString(16);return r.length%2==1&&(r="0"+r),"0"+n+r},t.KJUR=he,t.crypto=he.crypto,t.asn1=he.asn1,t.jws=he.jws,t.lang=he.lang}).call(this,n(164).Buffer)},function(e,t,n){"use strict";n.r(t);n(152),n(153),n(154),n(155),n(156),n(157),n(159),n(161),n(162),n(22),n(163),n(9),n(14),n(33);function r(e,t,n){return{openSimpleModal:function(t){return e.open({templateUrl:t.warning?"js/angular/core/templates/modal/modal-warning.html":"js/angular/core/templates/modal/modal-simple.html",controller:"SimpleModalCtrl",size:t.size,resolve:{title:function(){return t.title},message:function(){return n.trustAsHtml(t.message)}}})},openCopyToClipboardModal:function(n){const r=e.open({templateUrl:"js/angular/core/templates/modal/copy-to-clipboard-modal.html",controller:"CopyToClipboardModalCtrl",resolve:{uri:function(){return n}}});return r.opened.then((function(){t((function(){$("#clipboardURI")[0].select()}),100)})),r}}}function i(e){return{getDetails:function(t){return e.get("rest/explore/details",{params:{uri:t},headers:{Accept:"application/json"}})},getGraph:function(t){const n=encodeURIComponent(t);return e.get("rest/explore/graph?uri="+n+"&role=subject",{headers:{Accept:"application/rdf+json"}})},getNamespaceUriForPrefix:function(e,t){let n="";for(let r=0;r<e.length;r++)if(e[r].prefix===t){n=e[r].uri;break}return n},getNamespacePrefixForUri:function(e,t){let n="";for(let r=0;r<e.length;r++)if(e[r].uri===t){n=e[r].prefix;break}return n},getLocalName:function(e){if(angular.isUndefined(e))return e;{let t;const n=e.length-1;let r=e.toString().lastIndexOf("/");r===n&&(t=e.substr(0,n),r=t.lastIndexOf("/"));let i=e.toString().lastIndexOf("#");return i===n&&(t=e.substr(0,n),i=t.lastIndexOf("/")),e.toString().substring(Math.max(i,r)+1)}}}}angular.module("graphdb.framework.core",["ui.bootstrap","jlareau.bowser","LocalStorageModule","graphdb.framework.core.controllers","pascalprecht.translate"]).provider("$menuItems",(function(){const e=function(t,n){for(let r=0;r<t.length;r++){const i=t[r];if(i.label===n)return i;const a=e(i.children,n);if(!angular.isUndefined(a))return a}},t=function(e,t){for(let n=0;n<e.length;n++){if(e[n].label===t)return!0}return!1},n=function(e,t){return e.order<t.order?-1:e.order>t.order?1:0},r=function(e,t){return{label:e.label,labelKey:e.labelKey,href:e.href,hrefFun:e.hrefFun,order:e.order,role:e.role,editions:e.editions,icon:e.icon,children:t}};let i;const a=[];this.addItem=function(n){if(angular.isUndefined(n.parent))t(a,n.label)||a.push(r(n,[]));else{const i=e(a,n.parent);angular.isUndefined(i)||t(i.children,n.label)||i.children.push(r(n,n.children?n.children:[]))}},this.$get=function(){a.sort(n);for(let e=0;e<a.length;e++){a[e].children.sort(n)}return a},this.setProductInfo=function(e){i=e},this.getProductInfo=function(){return i}})).factory("ModalService",r).factory("ClassInstanceDetailsService",i),r.$inject=["$modal","$timeout","$sce"],i.$inject=["$http"]},function(e,t){function n(e,t){return{get:function(t){return e.get(t)},set:function(t,n){e.set(t,n)},keys:n,remove:r,clearAll:function(){e.clearAll()},clearClassHieararchyState:function(){n().forEach((function(e){0!==e.indexOf("classHierarchy-")||e===t.CLASS_HIERARCHY_HIDE_PREFIXES||e.startsWith("classHierarchy-selectedGraph-")||r(e)}))}};function n(){return e.keys()}function r(t){e.remove(t)}}angular.module("graphdb.framework.utils.localstorageadapter",[]).factory("LocalStorageAdapter",n).value("LSKeys",{TABS_STATE:"tabs-state",TABS_STATE_CURRENT_ID:"tabs-state-currentid",TABS_STATE_MAXID:"tabs-state-maxid",VIEW_MODE:"viewMode",CLASS_HIERARCHY_HIDE_PREFIXES:"classHierarchy-hidePrefixes",CLASS_HIERARCHY_CURRENT_SLIDER_VALUE:"classHierarchy-currentSliderValue",CLASS_HIERARCHY_SWITCH_PREFIXES:"classHierarchy-switchPrefixes",CLASS_HIERARCHY_LAST_SELECTED_CLASS:"classHierarchy-lastSelectedClass",DOMAIN_RANGE_WENT_BACK:"domainRange-wentBack",DOMAIN_RANGE_COLLAPSE_EDGES:"domainRange-collapseEdges",HIDE_SIMILARITY_HELP:"hide-similarity-help",TUTORIAL_STATE:"tutorial-state",MENU_STATE:"menu-state",HIDE_GRAPH_CONFIG_HELP:"hide-graph-config-help",GRAPHS_VIZ:"graphs-viz",AUTOCOMPLETE_ENABLED:"autocomplete.enabled",RDF_SEARCH_TYPE:"rdf-search.search-type",RDF_SEARCH_INPUT:"rdf-search.search-input",RDF_SEARCH_EXPANDED_URI:"rdf-search.search-expanded-uri",RDF_RESOURCE_DESCRIPTION:"rdf-search.resource-description",PREFERRED_LANG:"preferred-language",WORKBENCH_SETTINGS:"workbench-settings"}),n.$inject=["localStorageService","LSKeys"]},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){angular.module("graphdb.framework.rest.license.service",["ngFileUpload"]).factory("LicenseRestService",i),i.$inject=["$http","Upload"];const n="rest/graphdb-settings/license",r="rest/info/license/";function i(e,t){return{getLicenseInfo:function(){return e.get(n)},getHardcodedLicense:function(){return e.get(`${n}/hardcoded`)},sendLicenseToValidate:function(t){return e.post(`${r}validate`,t,{headers:{Accept:"application/json","Content-Type":"text/plain"}})},extractFromLicenseFile:function(e){return t.upload({url:`${r}to-base-64`,file:e,headers:{Accept:"text/plain"}})},checkLicenseHardcoded:function(){return e.get(`${n}/hardcoded`)},registerLicense:function(t){const r=new Uint8Array(t.length);for(let e=0;e<r.length;e++)r[e]=t.charCodeAt(e);return e({method:"POST",url:n,headers:{"Content-Type":"application/octet-stream"},data:r,transformRequest:[]})},unregisterLicense:function(){return e({method:"DELETE",url:"rest/graphdb-settings/license"})},getInfo:function(){return e.get("rest/info/properties")},getVersion:function(t){return e.get("rest/info/version",{headers:{"X-GraphDB-Repository-Location":t}})},getStatistics:function(){return e.get("rest/graphdb-settings/statistics")},toggleStatistics:function(t){return e({method:"POST",url:"rest/graphdb-settings/statistics",headers:{"Content-Type":"application/x-www-form-urlencoded"},data:`enabled=${t}`})}}}},function(e,t){angular.module("graphdb.framework.rest.repositories.service",[]).factory("RepositoriesRestService",r),r.$inject=["$http"];const n="rest/repositories";function r(e){return{getRepositories:function(t){return e.get(`${n}/all`,{params:{location:t}})},getRepository:function(t){return e.get(`${n}/${t.id}`,{params:{location:t.location}})},deleteRepository:function(t){return e.delete(`${n}/${t.id}`,{params:{location:t.location}})},createRepository:function(t){return e.post(n,t)},editRepository:function(t,r){return e.put(`${n}/${t}`,r)},getRepositoryConfiguration:function(t){return e.get(`${n}/default-config/${t}`)},getSize:function(t){return e.get(`${n}/${t.id}/size`,{params:{location:t.location}})},getPrefix:function(t,r){return e.post(`${n}/${t}/prefix`,null,{params:r})},getCluster:function(){return e.get(`${n}/cluster`)},getRepositoryFileContent:function(t){return e.get(`${n}/file`,{params:{fileLocation:t}})},updateRepositoryFileContent:function(t,r,i){return e.post(`${n}/file/update`,JSON.stringify(r),{params:{fileLocation:t,location:i}})},validateOntopPropertiesConnection:function(t){return e.post(`${n}/ontop/test-connection`,t.params.propertiesFile,{params:{location:t.location}})},restartRepository:function(t){return e.post(`${n}/${t.id}/restart`,null,{params:{location:t.location}})},getSupportedDriversData:function(t){return e.get(`${n}/ontop/drivers`,{params:{location:t.location}})},updatePropertiesFile:function(t,r,i){return e.post(`${n}/ontop/jdbc-properties`,JSON.stringify(r),{params:{fileLocation:t,location:i}})},loadPropertiesFile:function(t,r){return e.get(`${n}/ontop/jdbc-properties`,{params:{fileLocation:t,location:r}})},getRepositoriesFromKnownLocation:function(t){return e.get(`${n}?location=${t}`)}}}},function(e,t,n){"use strict";n.r(t);n(3),n(7),n(24),n(6),n(30),n(31);angular.module("graphdb.framework.core.services.repositories",["ngCookies","graphdb.framework.rest.repositories.service","graphdb.framework.rest.locations.service","graphdb.framework.rest.license.service","toastr"]).service("$repositories",["$http","toastr","$rootScope","$timeout","$location","productInfo","$jwtAuth","RepositoriesRestService","LocationsRestService","LicenseRestService","$translate","$q",function(e,t,n,r,i,a,s,o,u,c,l,h){this.repositoryStorageName="com.ontotext.graphdb.repository",this.repositoryStorageLocationName="com.ontotext.graphdb.repository.location",this.location={uri:"",label:"Local",local:!0},this.locationError="",this.loading=!0,this.repository={id:localStorage.getItem(this.repositoryStorageName)||"",location:localStorage.getItem(this.repositoryStorageLocationName)||""},this.locations=[this.location],this.repositories=new Map,this.locationsShouldReload=!0;const f=this,p=function(e,n){f.loading=!1,e&&(f.location={},f.locationError=n,f.repositories=new Map,f.setRepository(""),e.statusText?t.error(e.statusText,l.instant("repositories.service.error.loading.location")):t.error(l.instant("repositories.service.error.loading.location")))};let d;this.resetActiveRepository=function(){let e=f.repositories.get(this.repository.location),t=!1;e&&(t=e.find(e=>this.repository&&e.id===this.repository.id)),t?s.canReadRepo(this.repository)?n.$broadcast("repositoryIsSet",{newRepo:!1}):this.setRepository(""):this.setRepository(this.location.defaultRepository?{id:this.location.defaultRepository,location:this.location.uri}:"")},this.checkLocationsDegraded=function(e){this.locations.forEach(t=>{t.local||(t.errorMsg&&f.repositories.delete(t.uri)&&f.resetActiveRepository(),c.getVersion(t.uri).success((function(e){"object"==typeof e?e.productVersion!==a.productVersion&&(t.degradedReason=l.instant("repositories.service.different.gdb.version",{location:t.name})):t.degradedReason=l.instant("repositories.service.different.gdb.version",{location:t.name})})).error((function(n){t.errorMsg=n,e||(f.locationsShouldReload=!0)})))})},this.getDegradedReason=function(){let e=this.locations.find(e=>e.uri===this.repository.location);return e?e.degradedReason:""},this.clearLocationErrorMsg=function(e){let t=this.locations.find(t=>t.uri===e);t&&t.errorMsg&&(t.errorMsg=null)},this.initQuick=function(){this.hasActiveLocation()&&this.init(null,null,!0)},this.init=function(e,t,r){return this.loading=!0,r||(this.locationsShouldReload=!0),u.getActiveLocation().then((function(i){if(i.data){const a=i.data;if(a.active)return o.getRepositories().then((function(t){f.location=a,Object.entries(t.data).forEach(([e,t])=>{f.clearLocationErrorMsg(e),f.repositories.set(e,t)}),f.resetActiveRepository(),p(),f.checkLocationsDegraded(r),n.globalLocation=f.location,n.globalRepositories=f.getRepositories(),e&&e()})).catch((function(e){p(e),t&&t()}))}else p(),r&&(f.locationsShouldReload=!0),f.location="",f.repositories=new Map,f.setRepository("");n.globalLocation=f.location,n.globalRepositories=f.getRepositories()})).catch((function(e){p(e),t&&t()}))},this.getLocations=function(e){if(this.locationsShouldReload||d)return d||(this.locationsShouldReload=!1,this.locations=[this.location],d=u.getLocations(e).then(e=>(f.locations=e.data,this.locations)).catch((function(){r((function(){f.locationsShouldReload=!0}),2e3)})).finally(()=>{d=null})),d;const t=h.defer();return t.resolve(this.locations),t.promise},this.getActiveLocation=function(){return this.location},this.hasActiveLocation=function(){return!_.isEmpty(this.location)},this.getLocationError=function(){return this.locationError?this.locationError:l.instant("repositories.service.no.active.location")},this.isLoadingLocation=function(){return this.loading},this.getRepositories=function(){let e=[];return this.repositories.forEach(t=>e.push.apply(e,t)),e},this.getReadableRepositories=function(){return _.filter(this.getRepositories(),(function(e){return s.canReadRepo(e)}))},this.getWritableRepositories=function(){const e=this;return _.filter(this.getRepositories(),(function(t){return s.canWriteRepo(t)&&!e.isActiveRepoOntopType(t)}))},this.getActiveRepository=function(){return this.repository.id},this.getActiveRepositoryObject=function(){const e=this;let t=e.repositories.get(e.repository.location);return t?t.find(t=>t.id===e.repository.id):null},this.isSystemRepository=function(){return"SYSTEM"===this.repository.id},this.isActiveRepoOntopType=function(e){const t=this;let n;return e||(e=t.getActiveRepositoryObject()),e&&(n=t.repositories.get(e.location).find(t=>t.id===e.id),n)?"graphdb:OntopRepository"===n.sesameType:void 0===n},this.isActiveRepoFedXType=function(){const e=this;let t,n=e.getActiveRepositoryObject();return n&&(t=e.repositories.get(n.location).find(e=>e.id===n.id),t)?"graphdb:FedXRepository"===t.sesameType:void 0===t},this.getLocationFromUri=function(e){return this.locations.find(t=>t.uri===e)},this.setRepositoryHeaders=function(){e.defaults.headers.common["X-GraphDB-Repository"]=this.repository?this.repository.id:void 0,$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers["X-GraphDB-Repository"]=this.repository?this.repository.id:void 0,e.defaults.headers.common["X-GraphDB-Repository-Location"]=this.repository?this.repository.location:void 0,$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers["X-GraphDB-Repository-Location"]=this.repository?this.repository.location:void 0},f.setRepositoryHeaders(),this.setRepository=function(e){this.repository=e,e?(localStorage.setItem(f.repositoryStorageName,this.repository.id),localStorage.setItem(f.repositoryStorageLocationName,this.repository.location)):(localStorage.removeItem(f.repositoryStorageName),localStorage.removeItem(f.repositoryStorageLocationName)),f.setRepositoryHeaders(),n.$broadcast("repositoryIsSet",{newRepo:!0}),e&&!s.canReadRepo(e)&&this.setRepository(""),n.deniedPermissions={}},this.getDefaultRepository=function(){return this.hasActiveLocation()?this.location.defaultRepository:""},this.setDefaultRepository=function(e){if(!this.hasActiveLocation())return void t.error(l.instant("repositories.service.no.active.location"),l.instant("common.error"));const n=this;u.setDefaultRepository(e).success((function(){n.location.defaultRepository=e})).error((function(e){const n=getError(e);t.error(n,l.instant("common.error"))}))},this.deleteLocation=function(e){return u.deleteLocation(encodeURIComponent(e)).success((function(){let t=f.getActiveRepositoryObject();t&&t.location===e&&(f.location="",f.setRepository("")),f.init()})).error((function(e){const n=getError(e);t.error(n,l.instant("common.error"))}))},this.deleteRepository=function(e){return o.deleteRepository(e).success((function(){f.init()})).error((function(e){const n=getError(e);t.error(n,l.instant("common.error"))})).finally(()=>{const t=f.getActiveRepositoryObject();t&&t.id===e.id&&t.location===e.location&&f.setRepository("")})},this.restartRepository=function(e){return o.restartRepository(e).success((function(){t.success(l.instant("repositories.service.restarting.repo",{repositoryId:e.id})),f.initQuick()})).error((function(e){const n=getError(e);t.error(n,l.instant("common.error"))}))},this.getRepositoryTurtleConfig=function(t){return e.get("rest/repositories/"+t.id,{headers:{Accept:"text/turtle"}})},this.isRepoActive=function(e){return!!this.repository&&(e.id===this.repository.id&&e.location===this.repository.location)},this.getRepositoriesFromLocation=function(e){return this.repositories.get(e)},n.$on("securityInit",(function(e,t,n,r){(!t||n||r)&&f.init()}))}])},function(e,t,n){"use strict";n.r(t);n(4);var r=n(0);function i(){return{template:function(e,t){return'<object width="'+t.size+'" height="'+t.size+'" data="js/angular/templates/loader/ot-loader.svg?v=2.0.2">{{\'common.loading\' | translate}}</object>'}}}function a(){return{template:function(e,t){return'<object width="'+t.size+'" height="'+t.size+'" data="js/angular/templates/loader/ot-loader.svg?v=2.0.2"></object><div>{{\'common.loading\' | translate}}<div>'}}}function s(e){const t=function(e,n){n.timer=void 0,n.currentMessage=n.getMessage();const r=n.timeout[n.index%n.timeout.length];r&&(n.timer=e((function(){(n.index+1<n.message.length||0===n.message.length)&&(n.index++,t(e,n))}),1e3*r))};return{restrict:"EA",scope:{size:"@",trigger:"@",messageAttr:"=*message",timeoutAttr:"=*timeout",ngShow:"=",ngHide:"="},link:function(n){n.message=n.messageAttr,n.getMessage=function(){return n.message[n.index]},void 0===n.message?n.message=[""]:"function"==typeof n.message?(n.getMessage=n.message,n.message=[]):"object"!=typeof n.message&&(n.message=[n.message]),n.timeout=n.timeoutAttr,void 0===n.timeout?n.timeout=[0]:"object"!=typeof n.timeout&&(n.timeout=[n.timeout]),n.index=0,t(e,n);const r=function(r){n.timer&&e.cancel(n.timer),r&&(n.index=0,t(e,n))};n.$watch("ngShow",(function(e){r(e)})),n.$watch("ngHide",(function(e){r(!e)})),n.$on("$destroy",(function(){n.timer&&e.cancel(n.timer)}))},template:'<div class="ot-loader-new-content"><img width="{{size}}" height="{{size}}" src="js/angular/templates/loader/ot-loader.svg?v=2.0.2"/><div style="font-size: {{size/4}}px">{{currentMessage}}<div></div>'}}function o(e){return{restrict:"EA",transclude:!0,templateUrl:"js/angular/core/templates/core-errors.html",link:function(t,n,r){let i;t.setAttrs(r),t.setRestricted(),t.showRemoteLocations=!1,t.toggleShowRemoteLocations=()=>{t.showRemoteLocations=!t.showRemoteLocations},t.getAccessibleRepositories=function(){let e=e=>!0;return t.showRemoteLocations||(e=e=>e.local),t.isRestricted?t.getWritableRepositories().filter(e):t.getReadableRepositories().filter(e)},t.showPopoverForRepo=function(n,r){t.hidePopoverForRepo(),t.setPopoverRepo(r),e((function(){const e=$(n.toElement).find(".popover-anchor")[0];i=e,e&&!t.getActiveRepository()&&e.dispatchEvent(new Event("show"))})),n.stopPropagation()},t.hidePopoverForRepo=function(t){if(t){let e=t.relatedTarget;for(;e;){if(0===e.className.indexOf("popover"))return;e=e.parentElement}}i&&e((function(){i&&(i.dispatchEvent(new Event("hide")),i=null)})),t&&t.stopPropagation()}}}}function u(){return function(e,t){$(t).click((function(e){e.preventDefault(),e.stopPropagation()}))}}function c(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){e.multiRequired||(e.multiRequired=[]);const i=n.multiRequireElement,a=function(t){i&&i%1==0&&(e.multiRequired[i-1]=t)},s=function(){let t=!1,n=!1;for(let r=0;r<e.multiRequired.length;r++)e.multiRequired[r]?t=!0:n=!0;r.$setValidity("multiRequire",!(t&&n))};r.$parsers.unshift((function(e){return a(e),s(),e})),r.$formatters.unshift((function(e){return a(e),s(),e})),$("[multi-required]").on("blur keyup change focusout",(function(){s()}))}}}angular.module("graphdb.framework.core.directives",["graphdb.framework.core.services.repositories","graphdb.framework.utils.localstorageadapter"]).directive("ontoLoader",i).directive("ontoLoaderFancy",a).directive("ontoLoaderNew",s).directive("coreErrors",o).directive("eatClick",u).directive("multiRequired",c).directive("searchResourceInput",h).directive("keyboardShortcuts",f).directive("inactivePluginDirective",p),i.$inject=[],a.$inject=[],s.$inject=["$timeout"],o.$inject=["$timeout"],u.$inject=[],c.$inject=[];const l={table:"table",visual:"visual"};function h(e,t,n,i,a,s,o,u,c,h,f){return{restrict:"EA",scope:{namespacespromise:"=",autocompletepromisestatus:"=",textButton:"@",visualButton:"@",textCallback:"&",visualCallback:"&",placeholder:"@",uriValidation:"@",preserveInput:"@",empty:"=",clear:"=?clear",openInNewTab:"@",preserveSearch:"@",radioButtons:"@",clearInputIcon:"@"},templateUrl:"js/angular/core/templates/search-resource-input.html",link:function(p,d,g){d.autoCompleteStatus=void 0,d.autoCompleteWarning=!1,p.empty=!1,p.clear=!1,p.searchDisplayType=l;const m="true"===p.preserveSearch,v=d.find(".view-res-input");let y,b;p.textButtonLabel=p.textButton||"query.editor.table.btn",p.visualButtonLabel=p.visualButton||"query.editor.visual.btn",p.showClearInputIcon=!1,p.searchType=u.get(c.RDF_SEARCH_TYPE)||l.table,p.searchInput="",p.changeSearchType=function(e){p.searchType=e,u.set(c.RDF_SEARCH_TYPE,p.searchType)},p.$on("addStartFixedNodeAutomatically",(function(e,t){p.searchInput||!t.startIRI?p.checkIfValidAndSearchText():p.visualCallback({uri:t.startIRI,label:""})})),p.clearInput=function(){p.searchInput="",p.selectedElementIndex=-1,p.autoCompleteUriResults=[],p.showClearInputIcon=!1,u.remove(c.RDF_SEARCH_INPUT),u.remove(c.RDF_SEARCH_EXPANDED_URI),u.remove(c.RDF_RESOURCE_DESCRIPTION)},p.$watch("namespacespromise",(function(){angular.isDefined(p.namespacespromise)&&p.namespacespromise.success((function(e){d.namespaces=e.results.bindings.map((function(e){return{prefix:e.prefix.value,uri:e.namespace.value}}))})).error((function(e){const n=getError(e);t.error(n,f.instant("error.getting.namespaces.for.repo"))}))})),p.$watch("autocompletepromisestatus",(function(){!h.isActiveRepoFedXType()&&angular.isDefined(p.autocompletepromisestatus)&&p.autocompletepromisestatus.success((function(e){d.autoCompleteStatus=!!e,""!==p.searchInput&&p.onChange()})).error((function(){t.error(f.instant("explore.error.autocomplete"))}))})),p.$watch("empty",(function(){m||(p.searchInput="",p.empty=!1)})),p.$watch("clear",(function(){p.clear&&(p.clearInput(),p.clear=!1)})),a.$on("$translateChangeSuccess",(function(){g.$attr.placeholder?p.placeholder=g.$attr.placeholder:p.placeholder=`${f.instant("search.resources.msg")}...`}));const w=function(t){const n=t.type||"uri";"true"===p.openInNewTab?S(!1,t):e.path("resource").search(n,t.uri)},x=function(t){const n=t.type||"uri";"true"===p.openInNewTab?S(!0,t):e.path("graphs-visualizations").search(n,t.uri)},S=function(e,t){const n=e?"graphs-visualizations":"resource";window.open(`${n}?uri=${encodeURIComponent(t.uri)}`)};angular.isUndefined(g.$attr.textCallback)&&(p.textCallback=w),angular.isUndefined(g.$attr.visualCallback)&&(p.visualCallback=x),g.$attr.textButton&&!p.textButton?p.textCallback=p.visualCallback:g.$attr.visualButton&&!p.visualButton&&(p.visualCallback=p.textCallback),g.$attr.placeholder?p.placeholder=g.$attr.placeholder:p.placeholder=`${f.instant("search.resources.msg")}...`,angular.isDefined(g.$attr.uriValidation)?p.uriValidation=g.$attr.uriValidation:p.uriValidation="true",angular.isDefined(g.$attr.preserveInput)&&(p.preserveInput=g.$attr.preserveInput),p.getResultItemHtml=function(e){return o.trustAsHtml(e.description)},p.searchRdfResource=function(e,t){if("prefix"===e.type)p.searchInput=D(e.value+":"),v.focus(),p.onChange();else{let n;n=angular.isUndefined(e)?p.searchInput:"object"==typeof e?e.value:e;let r="";if(e.description){const t=e.description.indexOf("<"+n+">");t>0&&(r=e.description.substring(0,t).replace(/<\/?b>/g,""))}t({uri:n,description:e.description,label:r,type:e.type}),m?(p.selectedElementIndex=p.activeSearchElm,u.set(c.RDF_SEARCH_EXPANDED_URI,y),u.set(c.RDF_SEARCH_INPUT,p.searchInput),u.set(c.RDF_RESOURCE_DESCRIPTION,e.description)):"true"===p.preserveInput?(p.searchInput=n,p.autoCompleteUriResults=[]):(p.searchInput="",p.autoCompleteUriResults=[])}},p.searchRdfResourceByEvent=function(e,t){p.searchType===l.visual||t.ctrlKey||t.metaKey?p.searchRdfResource(e,p.visualCallback):p.searchRdfResource(e,p.textCallback)};const E=function(e){const n=p.searchInput;""!==n?"false"!==p.uriValidation?d.autoCompleteStatus&&p.autoCompleteUriResults&&p.autoCompleteUriResults.length>0?"prefix"===p.autoCompleteUriResults[p.activeSearchElm].type?(p.searchInput=D(p.autoCompleteUriResults[p.activeSearchElm].value+":"),p.autoCompleteUriResults=[]):p.searchRdfResource(p.autoCompleteUriResults[p.activeSearchElm],e):A(n)?p.searchRdfResource(n,e):t.error(f.instant("invalid.uri.msg")):p.searchRdfResource(n,e):t.error(f.instant("fill.input.field.msg"))};function F(){let e=-1;const n=u.get(c.RDF_RESOURCE_DESCRIPTION);n&&p.autoCompleteUriResults&&(e=p.autoCompleteUriResults.findIndex(e=>e.description===n),p.selectedElementIndex=e,new Promise(e=>{const t=document.getElementById("auto-complete-results-wrapper").getBoundingClientRect();setTimeout(()=>{e(t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth))})}).then((function(){!function(){const e=$("#auto-complete-results-wrapper"),t=$("#auto_"+p.selectedElementIndex);e.animate({scrollTop:t.offset().top-e.offset().top+e.scrollTop()})}()})).catch((function(e){t.error(getError(e),f.instant("no.prev.search.element"))}))),p.activeSearchElm=-1===e?0:e}function A(e){const t=e.indexOf("<")>=0&&e.indexOf(">")>=0,n=-1===e.indexOf("<")&&-1===e.lastIndexOf(">"),r=/^<?(http|urn).*>?/.test(e)&&(t||n);let i=!1;if(r)if(e.indexOf("http")>=0){const t=e.indexOf("//");i=t>4&&e.substring(t+2).length>0}else e.indexOf("urn")>=0&&(i=e.substring(4).length>0);return r&&i}function D(e){if(!/^<?(http|urn).*>?/.test(e)){const t=e.split(":"),r=t[0],i=t[1];if(!angular.isUndefined(i)){const e=n.getNamespaceUriForPrefix(d.namespaces,r);if(y=e!==y?e:y,y)return v.val(y),y+i}}return e}p.checkIfValidAndSearchText=function(){E(p.textCallback)},p.checkIfValidAndSearchVisual=function(){E(p.visualCallback)},p.checkIfValidAndSearchEvent=function(e){p.searchType===l.visual||e.ctrlKey||e.metaKey?E(p.visualCallback):E(p.textCallback)},p.onChange=function(){return p.showClearInputIcon=p.clearInputIcon,m&&u.set(c.RDF_SEARCH_INPUT,p.searchInput),"false"!==p.uriValidation&&(p.searchInput=D(p.searchInput),d.autoCompleteStatus)?function(e){let t=e.replace(y,y+";");if(d.autoCompleteStatus)return";"===t.charAt(0)&&(t=t.slice(1)),t=function(e){let t=e;if(-1===t.indexOf(";")&&A(t)){t=t.replace(/<|>/g,"");const e=/[^/^#]*$/.exec(t)[0];return t.split(e)[0]+";"+e}return t}(t),b&&b.resolve(),b=s.defer(),i.getAutocompleteSuggestions(t,b.promise).then((function(e){b=null,p.autoCompleteUriResults=e.data.suggestions,p.activeSearchElm=0}));return Promise.resolve()}(p.searchInput):Promise.resolve()},p.onKeyDown=function(e){if(13===e.keyCode)e.preventDefault(),"false"!==p.uriValidation?d.autoCompleteStatus?p.checkIfValidAndSearchEvent(e):A(e.target.value)?p.searchRdfResourceByEvent(e.target.value,e):t.error(f.instant("invalid.uri.msg")):p.searchRdfResourceByEvent(e.target.value,e);else if(p.searchInput.length>0&&!d.autoCompleteWarning&&!d.autoCompleteStatus){d.autoCompleteWarning=!0;const e=Object(r.decodeHTML)(f.instant("explore.autocomplete.warning.msg"));t.warning("",`<div class="autocomplete-toast"><a href="autocomplete">${e}</a></div>`,{allowHtml:!0})}if(d.autoCompleteStatus&&!angular.isUndefined(p.autoCompleteUriResults)){if(40===e.keyCode&&p.activeSearchElm<p.autoCompleteUriResults.length-1&&(p.activeSearchElm++,p.searchInput=p.autoCompleteUriResults[p.activeSearchElm].value,function(){const e=$("#auto-complete-results-wrapper"),t=e.children("div"),n=e.children("div.active");void 0!==n[0]&&n[0].offsetTop-t.height()-6-e.scrollTop()>170&&e.scrollTop(n[0].offsetTop-t.height()-6-170)}()),38===e.keyCode&&p.activeSearchElm>0&&(e.preventDefault(),p.activeSearchElm--,p.searchInput=p.autoCompleteUriResults[p.activeSearchElm].value,function(){const e=$("#auto-complete-results-wrapper"),t=e.children("div"),n=e.children("div.active");void 0!==n[0]&&n[0].offsetTop-t.height()-40<=e.scrollTop()&&e.scrollTop(e.scrollTop()-34)}()),27===e.keyCode){if(m)return;p.searchInput="",p.autoCompleteUriResults=[]}p.searchInput||p.clearInput()}},p.$on("rdfResourceSearchExpanded",(function(){(m?(p.preserveInput="true",p.searchInput=u.get(c.RDF_SEARCH_INPUT)||"",y=u.get(c.RDF_SEARCH_EXPANDED_URI),p.onChange()):Promise.resolve()).then((function(){F()}))})),p.setActiveClassOnMouseMove=function(e){d.autoCompleteStatus&&(p.activeSearchElm=e)}}}}function f(e){return{restrict:"AE",link:function(t,n,r){function i(e){27===e.keyCode&&(t.toggleCheatSheet(),t.$apply())}t.getTemplateUrl=function(){return r.templateUrl},t.shortcutsVisible=!1,t.toggleCheatSheet=function(){t.shortcutsVisible=!t.shortcutsVisible,t.shortcutsVisible?e.on("keydown",i):e.off("keydown",i)}},template:'<ng-include src="getTemplateUrl()" />'}}function p(e,t,n,i,a,s){return{restrict:"E",transclude:!0,scope:{loadSaved:"&",setPluginActive:"&",pluginName:"@",humanReadablePluginName:"@"},templateUrl:"js/angular/core/templates/inactive-plugin-warning-page.html",link:function(o){function u(){if(a.isLicenseValid()&&i.getActiveRepository()&&!i.isActiveRepoOntopType()&&!i.isActiveRepoFedXType())return t.checkPluginIsActive(o.pluginName).done((function(e){o.pluginIsActive=e.indexOf("true")>0,o.setPluginActive({isPluginActive:o.pluginIsActive})})).fail((function(t){e.error(getError(t),s.instant("check.active.plugin.failure"))}))}o.pluginIsActive=!0,o.activatePlugin=function(){const i=Object(r.decodeHTML)(s.instant("activate.plugin.warning.msg",{humanReadablePluginName:o.humanReadablePluginName}));n.openSimpleModal({title:s.instant("activate.plugin.confirmation"),message:`<p>${i}</p>`,warning:!0}).result.then((function(){t.activatePlugin(o.pluginName).done((function(){o.pluginIsActive=!0,o.setPluginActive({isPluginActive:o.pluginIsActive}),o.loadSaved()})).fail((function(t){e.error(getError(t),s.instant("activate.plugin.failure"))}))}))};const c=o.$on("repositoryIsSet",(function(){u()}));window.addEventListener("beforeunload",(function e(){c(),window.removeEventListener("beforeunload",e)})),o.$on("checkIsActive",u),u()}}}h.$inject=["$location","toastr","ClassInstanceDetailsService","AutocompleteRestService","$rootScope","$q","$sce","LocalStorageAdapter","LSKeys","$repositories","$translate"],f.$inject=["$document"],p.$inject=["toastr","RDF4JRepositoriesRestService","ModalService","$repositories","$licenseService","$translate"]},function(e,t,n){"use strict";n.r(t);n(3),n(20),n(21);var r=n(1);angular.module("graphdb.framework.core.services.jwtauth",["toastr","graphdb.framework.rest.security.service","graphdb.framework.core.services.openIDService"]).service("$jwtAuth",["$http","toastr","$location","$rootScope","SecurityRestService","$openIDAuth","$translate","$q",function(e,t,n,i,a,s,o,u){const c=this;i.deniedPermissions={},i.setPermissionDenied=function(e){return!("/"===e||"/login"===e||!c.isAuthenticated())&&(i.deniedPermissions[e]=!0,!0)},i.hasPermission=function(){const e=n.path();return!i.deniedPermissions[e]},i.redirectToLogin=function(e,t){return c.authTokenIsType("Bearer")&&(e=!0),c.clearAuthenticationInternal(),0!==n.url().indexOf("/login")&&(i.returnToUrl=n.url()),n.path("/login"),t?n.search("noaccess"):e&&n.search("expired"),new Promise(e=>{setTimeout(()=>{e(!0)},100)})},i.hasExternalAuthUser=function(){return c.hasExternalAuthUser()},this.authStorageName="com.ontotext.graphdb.auth",this.securityEnabled=!0,this.freeAccess=!1,this.hasOverrideAuth=!1,this.externalAuthUser=!1,this.securityInitialized=!1;const l=this;this.clearStorage=function(){localStorage.removeItem(l.authStorageName)},this.getAuthenticatedUserFromBackend=function(e,t){a.getAuthenticatedUser().success((function(e,t,n){l.auth&&l.auth.startsWith("GDB")?(l.externalAuthUser=!1,l.principal=e,i.$broadcast("securityInit",l.securityEnabled,!0,l.freeAccess)):l.openIDEnabled&&l.auth&&l.auth.startsWith("Bearer")?l.authenticate(e,l.auth):(l.externalAuthUser=!0,l.authenticate(e,""))})).error((function(){e||!l.freeAccess?i.redirectToLogin(!1,t):(l.securityInitialized=!0,l.hasExplicitAuthentication()||l.clearAuthentication())}))},this.initSecurity=function(){this.securityInitialized=!1,this.auth=localStorage.getItem(this.authStorageName),a.getSecurityConfig().then((function(e){if(l.securityEnabled=e.data.enabled,l.externalAuth=e.data.hasExternalAuth,l.authImplementation=e.data.authImplementation,l.openIDEnabled=e.data.openIdEnabled,l.passwordLoginEnabled=e.data.passwordLoginEnabled,l.securityEnabled){const t=e.data.freeAccess;l.freeAccess=t.enabled,l.freeAccess&&(l.freeAccessPrincipal={authorities:t.authorities,appSettings:t.appSettings}),l.openIDEnabled?(l.openIDConfig=e.data.methodSettings.openid,l.gdbUrl=n.absUrl().replace(n.url().substr(1),""),s.initOpenId(l.openIDConfig,l.gdbUrl,(function(e){l.auth=s.authHeaderGraphDB(),c.setAuthHeaders(),console.log("oidc: set id/access token as GraphDB auth"),l.getAuthenticatedUserFromBackend(!0,e)}),(function(){console.log("oidc: not logged or login error"),l.authTokenIsType("Bearer")?setTimeout(()=>{i.redirectToLogin(!0)},0):l.getAuthenticatedUserFromBackend()}))):l.getAuthenticatedUserFromBackend()}else{l.clearStorage();const t=e.data.overrideAuth;if(l.hasOverrideAuth=t.enabled,!l.hasOverrideAuth)return a.getAdminUser().then((function(e){l.principal={username:"admin",appSettings:e.data.appSettings,authorities:e.data.grantedAuthorities},i.$broadcast("securityInit",l.securityEnabled,!0,l.hasOverrideAuth)}));l.principal={username:"overrideauth",authorities:t.authorities,appSettings:t.appSettings},i.$broadcast("securityInit",l.securityEnabled,!0,l.hasOverrideAuth)}}))},this.initSecurity(),this.reinitializeSecurity=function(){this.securityInitialized||this.initSecurity()},this.isSecurityEnabled=function(){return this.securityEnabled},this.hasExternalAuth=function(){return this.externalAuth},this.getAuthImplementation=function(){return this.authImplementation},this.isFreeAccessEnabled=function(){return this.freeAccess},this.isDefaultAuthEnabled=function(){return this.hasOverrideAuth&&this.principal&&"overrideauth"===this.principal.username},this.getAuthToken=function(){return this.auth},this.authTokenIsType=function(e){return this.auth&&this.auth.startsWith(e)},this.loginOpenID=function(){s.login(this.openIDConfig,this.gdbUrl)},this.toggleSecurity=function(e){e!==this.securityEnabled&&(this.securityEnabled=e,a.toggleSecurity(e).then((function(){t.success(o.instant("jwt.auth.security.status",{status:o.instant(e?"enabled.status":"disabled.status")})),l.clearStorage(),l.initSecurity()}),(function(e){t.error(e.data.error.message,o.instant("common.error"))})))},this.toggleFreeAccess=function(e,n,r,s){(e!==this.freeAccess||s)&&(this.freeAccess=e,this.freeAccessPrincipal=e?{authorities:n,appSettings:r}:void 0,a.setFreeAccess({enabled:e?"true":"false",authorities:n,appSettings:r}).then((function(){s?t.success(o.instant("jwt.auth.free.access.updated.msg")):t.success(o.instant("jwt.auth.free.access.status",{status:o.instant(e?"enabled.status":"disabled.status")}))}),(function(e){t.error(e.data.error.message,o.instant("common.error"))})),i.$broadcast("securityInit",this.securityEnabled,this.hasExplicitAuthentication(),this.freeAccess))},this.setAuthHeaders=function(){return new Promise(t=>{const n=this.auth?this.auth:void 0;e.defaults.headers.common.Authorization=n,e.defaults.headers.common["X-Requested-With"]="XMLHttpRequest",$.ajaxSetup().headers=$.ajaxSetup().headers||{},$.ajaxSetup().headers.Authorization=n,$.ajaxSetup().headers["X-Requested-With"]="XMLHttpRequest",setTimeout(()=>{t(!0)})})},this.setAuthHeaders(),this.authenticate=function(e,t){return new Promise(n=>{l.clearStorage(),t&&(this.auth=t,localStorage.setItem(l.authStorageName,this.auth),this.externalAuthUser=!1),this.principal=e,i.deniedPermissions={},this.securityInitialized=!0,l.setAuthHeaders().then(()=>{i.$broadcast("securityInit",this.securityEnabled,l.hasExplicitAuthentication(),this.freeAccess)}),setTimeout(()=>{n(!0)})})},this.authenticateOpenID=function(e){this.clearStorage(),e&&(this.auth=e,localStorage.setItem(this.authStorageName,this.auth),this.externalAuthUser=!1)},this.hasExternalAuthUser=function(){return this.externalAuthUser},this.hasExplicitAuthentication=function(){return null!=this.auth||this.externalAuthUser},this.getPrincipal=function(){if(this.principal)return Promise.resolve(this.principal);const e=u.defer();return i.$on("securityInit",()=>{e.resolve(this.principal)}),e.promise},this.clearAuthenticationInternal=function(){s.softLogout(),this.auth=null,this.principal=this.freeAccessPrincipal,this.clearStorage(),this.setAuthHeaders()},this.clearAuthentication=function(){this.clearAuthenticationInternal(),i.$broadcast("securityInit",this.securityEnabled,!1,this.freeAccess)},this.isAuthenticated=function(){return!this.securityEnabled||this.hasExplicitAuthentication()},this.hasPermission=function(){},this.hasRole=function(e){if(void 0!==e&&(this.securityEnabled||this.hasOverrideAuth)){"string"==typeof e&&(e=[e]);const t=!_.isEmpty(this.principal);return!!t&&("IS_AUTHENTICATED_FULLY"===e[0]?t:_.intersection(e,this.principal.authorities).length>0)}return!0},this.isAdmin=function(){return this.hasRole(r.UserRole.ROLE_ADMIN)},this.checkForWrite=function(e,t){return"WRITE_REPO"===e?this.canWriteRepo(t):this.hasRole(e)},this.hasAdminRole=function(){return this.isAdmin()||this.hasRole(r.UserRole.ROLE_REPO_MANAGER)},this.canWriteRepo=function(e){return!!e&&(!this.securityEnabled&&!this.hasOverrideAuth||!_.isEmpty(this.principal)&&(!!this.hasAdminRole()||this.checkRights(e,"WRITE")))},this.canReadRepo=function(e){return!!e&&(!this.securityEnabled||!_.isEmpty(this.principal)&&(!!this.hasAdminRole()||this.checkRights(e,"READ")))},this.checkRights=function(e,t){if(e)for(let n=0;n<this.principal.authorities.length;n++){const r=this.principal.authorities[n],i=r.split("_",2),a=r.slice(i[0].length+i[1].length+2),s=e.location?`${e.id}@${e.location}`:e.id;if(i[0]===t&&(s===a||"SYSTEM"!==e.id&&"*"===a))return!0}return!1}}])},function(e,t){let n;angular.module("graphdb.framework.utils.uriutils",[]).factory("UriUtils",(function(){return{isValidIri:function(e){return void 0!==e&&!!e.match(n)},validateRdfUri:function(e){const t=e.indexOf("<")>=0&&e.indexOf(">")>=0,n=-1===e.indexOf("<")&&-1===e.lastIndexOf(">"),r=/^<?(http|urn).*>?/.test(e)&&(t||n);let i=!1;if(r)if(e.indexOf("http")>=0){const t=e.indexOf("//");i=t>4&&e.substring(t+2).length>0}else e.indexOf("urn")>=0&&(i=e.substring(4).length>0);return r&&i},shortenIri:function(e){const t=document.createElement("a");t.href=e;let n=t.hostname;return function(e){const t=e.split(".");for(let e=0,n=0;e<t.length;e++)if(parseInt(t[e],10)>=0&&parseInt(t[e],10)<=255?n++:n=0,4===n)return!0;return!1}(t.hostname)||(n=t.hostname.split(".")[0]),n+":"+t.port}}}));try{n=new RegExp("^[a-z](?:[-a-z0-9\\+\\.])*:(?:\\/\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:])*@)?(?:\\[(?:(?:(?:[0-9a-f]{1,4}:){6}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|::(?:[0-9a-f]{1,4}:){5}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:[0-9a-f]{1,4}:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3})|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+[-a-z0-9\\._~!\\$&'\\(\\)\\*\\+,;=:]+)\\]|(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(?:\\.(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])){3}|(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=@])*)(?::[0-9]*)?(?:\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))*)*|\\/(?:(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))+)(?:\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))*)*)?|(?:(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))+)(?:\\/(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@]))*)*|(?!(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@])))(?:\\?(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@])|[\\u{E000}-\\u{F8FF}\\u{F0000}-\\u{FFFFD}\\u{100000}-\\u{10FFFD}\\/\\?])*)?(?:#(?:(?:%[0-9a-f][0-9a-f]|[-a-z0-9\\._~\\u{A0}-\\u{D7FF}\\u{F900}-\\u{FDCF}\\u{FDF0}-\\u{FFEF}\\u{10000}-\\u{1FFFD}\\u{20000}-\\u{2FFFD}\\u{30000}-\\u{3FFFD}\\u{40000}-\\u{4FFFD}\\u{50000}-\\u{5FFFD}\\u{60000}-\\u{6FFFD}\\u{70000}-\\u{7FFFD}\\u{80000}-\\u{8FFFD}\\u{90000}-\\u{9FFFD}\\u{A0000}-\\u{AFFFD}\\u{B0000}-\\u{BFFFD}\\u{C0000}-\\u{CFFFD}\\u{D0000}-\\u{DFFFD}\\u{E1000}-\\u{EFFFD}!\\$&'\\(\\)\\*\\+,;=:@])|[\\/\\?])*)?$","ui")}catch(e){n=new RegExp("^[a-z](?:[-a-z0-9\\+\\.])*:","i")}},function(e,t){angular.module("graphdb.framework.rest.monitoring.service",[]).factory("MonitoringRestService",i),i.$inject=["$http"];const n="rest/monitor",r=`${n}/query`;function i(e){return{monitorResources:function(){return e.get(`${n}/resource`)},monitorGC:function(){return e.post(`${n}/resource/gc`)},monitorQuery:function(){return e.get(r)},abortQueryByAlias:function(t){return e.delete(`${r}?queryAlias=${encodeURIComponent(t)}`)},deleteQuery:function(t){return e.delete(`${r}?queryId=${encodeURIComponent(t)}`)},getQueryCount:function(){return e({url:`${r}/count`,method:"GET",timeout:1e4})},checkAutocompleteStatus:function(){return e.get("rest/autocomplete/enabled")}}}},function(e,t){angular.module("graphdb.framework.rest.rdf4j.repositories.service",[]).factory("RDF4JRepositoriesRestService",a),a.$inject=["$http","$repositories","$translate"];const n="INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#startplugin> '{{pluginName}}' .}",r="select ?o where {\n?s <http://www.ontotext.com/owlim/system#listplugins> ?o .\nfilter(str(?s) = '{{pluginName}}')\n} ",i="repositories";function a(e,t,a){return{getNamespaces:function(t){return e.get(`${i}/${t}/namespaces`)},getRepositoryNamespaces:function(){return e.get(`${i}/${t.getActiveRepository()}/namespaces`)},updateNamespacePrefix:function(t,n,r){return e({url:`${i}/${t}/namespaces/${r}`,method:"PUT",data:n})},deleteNamespacePrefix:function(t,n){return e({url:`${i}/${t}/namespaces/${n}`,method:"DELETE"})},addStatements:function(t,n){return e({url:`${i}/${t}/statements`,method:"POST",data:n,headers:{"Content-Type":"application/x-www-form-urlencoded"}})},activatePlugin:function(e){return $.ajax({method:"POST",url:`${i}/${t.getActiveRepository()}/statements`,data:{update:n.replace("{{pluginName}}",e)}})},checkPluginIsActive:function(e){return $.ajax({method:"GET",url:`${i}/${t.getActiveRepository()}`,data:{query:r.replace("{{pluginName}}",e)}})},getRepositorySize:function(){return e.get(`${i}/${t.getActiveRepository()}/size`)},getGraphs:s,resolveGraphs:function(){const e=t.getActiveRepository();let n=[];if(e)return s(e).success((function(e){e.results.bindings.unshift({contextID:{type:"default",value:"import.default.graph"}}),Object.keys(e.results.bindings).forEach((function(t){const n=e.results.bindings[t];"bnode"===n.contextID.type?n.contextID.value=`_:${n.contextID.value}`:"default"===n.contextID.type?n.contextID.uri="http://www.openrdf.org/schema/sesame#nil":n.contextID.uri=n.contextID.value})),e.results.bindings.unshift(allGraphs),n=e.results.bindings}));return n}};function s(t){return e.get(`${i}/${t}/contexts`)}}},function(e,t){function n(e,t,n,r){e.title=n,e.message=r,e.ok=function(){t.close()},e.cancel=function(){t.dismiss("cancel")}}function r(e,t,n,r,i){e.clipboardURI=n,e.ok=function(){try{document.getElementById("clipboardURI").select(),document.execCommand("copy"),r.success(i.instant("modal.ctr.copy.url.success"))}catch(e){r.error(i.instant("modal.ctr.copy.not.supported.warning"))}t.close()},e.cancel=function(){t.dismiss("cancel")}}function i(e,t,n,r,i){e.query=n,e.cancel=function(){t.dismiss("cancel")},e.selectQuery=function(){e.selectElement($("#create-query"))},e.copyQueryToClipboard=function(){try{e.selectQuery(),document.execCommand("copy"),t.close(),r.success(i.instant("modal.ctr.copy.query.success"))}catch(e){r.error(i.instant("modal.ctr.copy.not.supported.warning"))}},e.selectElement=function(e){if(e.length>0)if(window.getSelection){const t=window.getSelection();t.removeAllRanges();const n=document.createRange();n.selectNodeContents(e[0].firstChild),t.addRange(n)}else if(document.selection){const t=document.body.createTextRange();t.moveToElementText(e[0]),t.select()}}}angular.module("graphdb.framework.core.controllers",[]).controller("CopyToClipboardModalCtrl",r).controller("SimpleModalCtrl",n).controller("ViewQueryCtrl",i),n.$inject=["$scope","$modalInstance","title","message"],r.$inject=["$scope","$modalInstance","uri","toastr","$translate"],i.$inject=["$scope","$modalInstance","query","toastr","$translate"]},function(e,t){angular.module("graphdb.framework.rest.sparql.service",[]).factory("SparqlRestService",i),i.$inject=["$http"];const n="rest/sparql",r=`${n}/saved-queries`;function i(e){return{getSavedQueries:function(){return e.get(r)},getSavedQuery:function(t,n){let i="";null!=n&&(i=`&owner=${encodeURIComponent(n)}`);return e.get(`${r}?name=${encodeURIComponent(t)}${i}`)},addKnownPrefixes:function(t){return e.post(`${n}/add-known-prefixes`,t)},editSavedQuery:function(t){return e.put(r,t)},deleteSavedQuery:function(t){return e.delete(`${r}?name=${encodeURIComponent(t)}`)},addNewSavedQuery:function(t){return e.post(r,t)}}}},function(e,t){angular.module("graphdb.framework.rest.autocomplete.service",[]).factory("AutocompleteRestService",s);const n="rest/autocomplete/",r=`${n}labels`,i=`${n}enabled`,a=`${n}iris`;function s(e){return{checkAutocompleteStatus:function(){return e.get(i)},refreshIndexStatus:function(){return e.get(`${n}status`)},refreshLabelConfig:function(){return e.get(r)},addLabelConfig:function(t){return e.put(r,t)},removeLabelConfig:function(t){return e.delete(r,{data:t,headers:{"Content-Type":"application/json;charset=utf-8"}})},toggleAutocomplete:function(t){return e.post(`${i}?enabled=${t}`)},refreshIndexIRIs:function(){return e.get(a)},toggleIndexIRIs:function(t){return e.post(`${a}?enabled=${t}`)},buildIndex:function(){return e.post(`${n}reindex`)},interruptIndexing:function(){return e.post(`${n}interrupt`)},checkForPlugin:function(){return e.get(`${n}plugin-found`)},getAutocompleteSuggestions:function(t,r){return e.get(`${n}query`,{params:{q:t},timeout:r})}}}s.$inject=["$http"]},function(e,t){angular.module("graphdb.framework.rest.plugins.service",[]).factory("PluginsRestService",s);const n="repositories/",r="INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#stopplugin>",i="INSERT DATA { <u:a> <http://www.ontotext.com/owlim/system#startplugin>",a="select ?s ?o where { ?s <http://www.ontotext.com/owlim/system#listplugins> ?o .}";function s(e){return{togglePlugin:function(t,a,s){return a?e.post(`${n}${t}/statements`,void 0,{params:{update:`${r} "${s}".}`}}):e.post(`${n}${t}/statements`,void 0,{params:{update:`${i} "${s}".}`}})},getPlugins:function(t){return e.get(`${n}${t}`,{params:{query:a}})}}}s.$inject=["$http"]},function(e,t,n){"use strict";n.r(t);n(3);angular.module("graphdb.framework.core.interceptors.unauthorized",["ngCookies"]).factory("$unauthorizedInterceptor",["$q","$location","$rootScope","$translate",function(e,t,n,r){return{responseError:function(i){let a=!1;return 401===i.status?i.config.url.indexOf("rest/security/authenticated-user")<0&&!n.hasExternalAuthUser()&&(a=!0):403===i.status&&(n.setPermissionDenied(t.path())?console.log(r.instant("unauthorized.console.warning")):a=!0),a?Promise.resolve(n.redirectToLogin()).then(()=>e.reject(i)):e.reject(i)}}}])},,function(e,t,n){"use strict";n.r(t);var r=n(2);const i={headers:{"X-GraphDB-Repository-Location":void 0,"X-GraphDB-Repository":void 0,"X-Requested-With":void 0,Authorization:void 0}};angular.module("graphdb.framework.core.services.openIDService",["toastr"]).service("$openIDAuth",["$http","$location","$window","toastr","$translate",function(e,t,n,a,s){const o="com.ontotext.graphdb.openid.",u=this;function c(e){const t=[];for(let n in e)e.hasOwnProperty(n)&&t.push(`${n}=${encodeURIComponent(e[n])}`);return t.join("&")}this.login=function(e,t){const r=u.generateRandomString(),i=e.authFlow;if("code"===i){u.setStorageItem("pkce_state",r);const i=u.generateRandomString();u.setStorageItem("pkce_code_verifier",i);const a=u.pkceChallengeFromVerifier(i);n.location.href=u.getLoginUrl(r,a,t,e)}else"code_no_pkce"===i?(u.removeStorageItem("pkce_code_verifier"),n.location.href=u.getLoginUrl(r,"",t,e)):"implicit"===i?(u.setStorageItem("nonce",r),n.location.href=u.getLoginUrl(r,"",t,e)):(console.log("oidc: unknown auth flow: "+i),a.error(s.instant("openid.auth.unknown.flow",{authFlow:i})))},this.getLoginUrl=function(e,t,n,r){const i=[];let a="";switch(r.authFlow){case"code":a="code",i.push("state="+encodeURIComponent(e)),i.push("code_challenge="+encodeURIComponent(t)),i.push("code_challenge_method=S256");break;case"code_no_pkce":a="code";break;case"implicit":a="token id_token",i.push("nonce="+encodeURIComponent(e));break;default:throw new Error(s.instant("openid.auth.unknown.flow",{authFlow:r.authFlow}))}return i.unshift(`response_type=${encodeURIComponent(a)}`,`scope=${encodeURIComponent(u.getScope(r.extraScopes))}`,`client_id=${encodeURIComponent(r.clientId)}`,`redirect_uri=${encodeURIComponent(n)}`),r.oracleDomain&&i.push(`domain=${encodeURIComponent(r.oracleDomain)}`),r.authorizeParameters&&i.push(r.authorizeParameters),`${r.oidcAuthorizationEndpoint}?${i.join("&")}`},this.withOpenIdKeys=function(t,n){e.get(t,i).success((function(e){u.openIdKeys={},e.keys.forEach((function(e){u.openIdKeys[e.kid]=e})),n()}))},this.initOpenId=function(e,t,r,o){u.clientId=e.clientId,u.tokenType=e.tokenType,u.idTokenAudience=e.clientId,u.idTokenIssuer=e.issuer,u.accessTokenAudience=e.tokenAudience,u.accessTokenIssuer=e.tokenIssuer,u.openIdTokenUrl=e.oidcTokenEndpoint;let c=e.oidcJwksUri;e.proxyOidc&&(c="rest/openid/jwks",u.openIdTokenUrl="rest/openid/token"),u.openIdEndSessionUrl=e.oidcEndSessionEndpoint,u.supportsOfflineAccess=e.oidcScopesSupported.includes("offline_access"),e.oracleDomain&&(i.headers["X-OAuth-Identity-Domain-Name"]=e.oracleDomain),u.withOpenIdKeys(c,(function(){if(u.isLoggedIn=u.hasValidIdToken(),u.isLoggedIn)u.setupTokensRefresh(!1,r,o);else if(u.hasValidRefreshToken())u.refreshTokens(r,o);else{const i=r;r=function(){u.isLoggedIn=!0,i(!0)},u.softLogout();const c=u.parseQueryString(n.location.search.substring(1));if(c.code)"code"===e.authFlow?u.getStorageItem("pkce_state")!==c.state?(a.error(s.instant("openid.auth.invalid.pkce.state")),console.log("oidc: PKCE state mismatch "+u.getStorageItem("pkce_state")+" != "+c.state),o()):u.retrieveTokensByCode(c.code,t,r,o):"code_no_pkce"===e.authFlow&&u.retrieveTokensByCode(c.code,t,r,o);else{const e=u.parseQueryString(n.location.pathname.substring(1));e.id_token?u.saveTokens(e,!0,!1,r):o()}}}))},this.authHeaderGraphDB=function(){return"id"===u.getStorageItem("token_type")?"Bearer "+u.getToken("id"):"Bearer "+u.getToken("access")},this.softLogout=function(){u.isLoggedIn=!1,u.setToken("id",null),u.setToken("access",null),u.setToken("refresh",null)},this.hardLogout=function(e){u.softLogout(),u.openIdEndSessionUrl&&(n.location.href=`${u.openIdEndSessionUrl}?client_id=${encodeURIComponent(u.clientId)}&post_logout_redirect_uri=${encodeURIComponent(e)}`)},this.getToken=function(e){return u.getStorageItem(e+"_token")},this.setToken=function(e,t){t?u.setStorageItem(e+"_token",t):u.removeStorageItem(e+"_token")},this.tokenHeader=function(e){const t=u.getToken(e);if(t){try{const e=r.KJUR.jws.JWS.readSafeJSONString(Object(r.b64utoutf8)(t.split(".")[0]));if(e)return e}catch(e){}return{error:s.instant("openid.auth.not.jwt.token",{token:t})}}return{}},this.verifyToken=function(e){const t=u.getToken(e),n=u.tokenHeader(e);if(!n.kid)return"id"!==e?n.error?(console.log(`oidc: token ${e} is not a JWT token (token considered valid)`),!0):(console.log(`oidc: invalid token ${e} (token is empty)`),!1):(console.log("oidc: invalid token id (not a JWT token)"),!1);const i=u.openIdKeys[n.kid];if(!i)return console.log("oidc: no key to verify JWT token (token considered invalid)"),!1;const a=r.KEYUTIL.getKey(i),s={alg:[n.alg],iss:[u.idTokenIssuer]};return"id"===e?(s.aud=[u.idTokenAudience,u.idTokenIssuer],s.nonce=[u.getStorageItem("nonce")]):"access"===e&&(s.aud=[u.accessTokenAudience],s.iss=[u.accessTokenIssuer]),r.KJUR.jws.JWS.verifyJWT(t,a,s)},this.hasValidIdToken=function(){return u.getToken("id")?u.verifyToken("id")?(console.log("oidc: valid id token found"),!0):(console.log("oidc: stale id token"),!1):(console.log("oidc: no id token"),!1)},this.tokenPayload=function(e){const t=u.getToken(e);if(t){try{const e=r.KJUR.jws.JWS.readSafeJSONString(Object(r.b64utoutf8)(t.split(".")[1]));if(e)return e}catch(e){}return{error:s.instant("openid.auth.not.jwt.token",{token:t})}}return{}},this.saveTokens=function(e,n,r,i){(n||e.refresh_token)&&u.setToken("refresh",e.refresh_token),u.setToken("access",e.access_token),u.setToken("id",e.id_token),u.setStorageItem("token_type",u.tokenType),console.log("oidc: saved tokens"),u.setupTokensRefresh(n||r,i),u.removeStorageItem("pkce_state"),u.removeStorageItem("pkce_code_verifier"),n&&t.url("/")},this.retrieveTokensByCode=function(t,n,r,o){const l={grant_type:"authorization_code",client_id:u.clientId,redirect_uri:n,code:t},h=u.getStorageItem("pkce_code_verifier");h&&(l.code_verifier=h);const f={...i.headers,"Content-type":"application/x-www-form-urlencoded; charset=utf-8"};e({method:"POST",url:u.openIdTokenUrl,headers:f,transformRequest:c,data:l}).success((function(e){u.saveTokens(e,!0,!1,r)})).error((function(e){a.error(s.instant("openid.auth.cannot.retrieve.token.msg",{error:getError(e)})),o()}))},this.refreshTokens=function(t,n){if(u.hasValidRefreshToken()){const r={grant_type:"refresh_token",client_id:u.clientId,refresh_token:u.getToken("refresh")},o={...i.headers,"Content-type":"application/x-www-form-urlencoded; charset=utf-8"};e({method:"POST",url:u.openIdTokenUrl,headers:o,transformRequest:c,data:r}).success((function(e){console.log("oidc: refreshed tokens"),u.saveTokens(e,!1,!0,t),u.isLoggedIn=!0})).error((function(e){console.log("oidc: could not refresh tokens"),a.error(s.instant("openid.auth.cannot.refresh.token.msg",{error:getError(e)})),n&&n()}))}else console.log("oidc: refresh requested without a valid refresh token")},this.hasValidRefreshToken=function(){const e=u.tokenPayload("refresh");return!(e.nbf&&1e3*e.nbf-Date.now()>5e3)&&(!(e.exp&&Date.now()-1e3*e.exp>5e3)&&!(!e.iat&&!e.error))},this.setupTokensRefresh=function(e,t,n){if(u.hasValidRefreshToken()){clearTimeout(u.previousTimer);const r=u.tokenPayload("id");if(r.exp>0){const i=1e3*r.exp-Date.now()-6e4;if(!(e||i>1e3))return u.previousTimer=null,console.log("oidc: tokens will refresh now, "+i+"; "+e),void u.refreshTokens(t,n);u.previousTimer=setTimeout((function(){u.refreshTokens(t)}),i),console.log("oidc: tokens will refresh in "+i/1e3+" seconds at "+new Date(Date.now()+i))}}else console.log("oidc: no valid refresh token");t()},this.parseQueryString=function(e){const t={access_token:null,code:null,id_token:null,state:null};return""===e?t:(e.split("&").map((function(e){return e.split("=")})).forEach((function(e){t[e[0]]=decodeURIComponent(e[1])})),t)},this.generateRandomString=function(){const e=new Uint32Array(28);return window.crypto.getRandomValues(e),Array.from(e,(function(e){return("0"+e.toString(16)).substr(-2)})).join("")},this.pkceChallengeFromVerifier=function(e){const t=new r.KJUR.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"});return Object(r.hextob64u)(t.digestString(e))},this.getScope=function(e){let t="openid"+(u.supportsOfflineAccess?" offline_access":"");return e&&(t+=" "+e),console.log(`oidc: requesting scopes '${t}'`),t},this.setStorageItem=function(e,t){localStorage.setItem(o+e,t)},this.getStorageItem=function(e){return localStorage.getItem(o+e)},this.removeStorageItem=function(e){localStorage.removeItem(o+e)}}])},function(e,t){angular.module("graphdb.framework.rest.security.service",[]).factory("SecurityRestService",o),o.$inject=["$http"];const n="rest/security",r=`${n}/users`,i=`${n}/authenticated-user`,a=`${n}/free-access`,s="rest/roles";function o(e){return{getUser:function(n){return e.get(`${r}/${t(n)}`)},getAdminUser:function(){return e.get(`${r}/admin`)},getUsers:function(){return e.get(r)},createUser:function(n){return e({method:"POST",url:`${r}/${t(n.username)}`,data:{password:n.pass,appSettings:n.appSettings,grantedAuthorities:n.grantedAuthorities}})},updateUser:function(n){return e({method:"PUT",url:`${r}/${t(n.username)}`,data:{password:n.pass,appSettings:n.appSettings,grantedAuthorities:n.grantedAuthorities}})},updateUserData:function(n){return e({method:"PATCH",url:`${r}/${t(n.username)}`,data:{password:n.pass,appSettings:n.appSettings}})},deleteUser:function(n){return e.delete(`${r}/${t(n)}`)},getFreeAccess:function(){return e.get(a)},setFreeAccess:function(t){return e.post(a,t)},getSecurityConfig:function(){return e.get(`${n}/all`)},toggleSecurity:function(t){return e.post(n,t?"true":"false")},getRoles:function(){return e.get(s)},getRolesMapping:function(t){return e.get(`${s}/mapping`,{params:t})},getAuthenticatedUser:function(){return e.get(`${i}`)}};function t(e){return encodeURIComponent(e).replace(/[.!'()*]/g,(function(e){return"%"+e.charCodeAt(0).toString(16)}))}}},function(e,t){!function(e){e.getError=function(e,t,n){if(angular.isObject(e)&&e.status&&e.data)return getError(e.data,t,n);if(t&&403===t)return"Access is restricted";if(e){let r="Generic error";if(angular.isString(e))-1===e.indexOf("<html>")&&(r=e,r=r.replace(/^(([a-z0-9_]+\.)+[a-zA-Z0-9_]+: )+/,""));else if(angular.isObject(e)){if("message"in e&&(r=e.message),"error"in e&&(r=e.error.message),"responseJSON"in e&&"message"in e.responseJSON)return getError(e.responseJSON,t,n);"responseText"in e&&(r=e.responseText)}return n>0&&r.length>n&&(r=r.substr(0,n)+"..."),r}return"There is an error"}}(window)},function(e,t,n){"use strict";n.r(t);n(3),n(15),n(16),n(17),n(12),n(6),n(7),n(13),n(30),n(31),n(10),n(8),n(25);var r=n(1),i=(n(4),n(11),n(26),n(0));function a(e,t,n,r,i,a,s,o,u,c){function l(){e.getActiveRepository()&&(e.getNamespacesPromise=c.getNamespaces(e.getActiveRepository()).success((function(){h()})),e.getActiveRepositorySize())}function h(){a.isLicenseValid()&&(e.getAutocompletePromise=s.checkAutocompleteStatus())}e.doClear=!1,e.getActiveRepositorySize=function(){const t=r.getActiveRepositoryObject();t&&(e.activeRepositorySizeError=void 0,u.getSize(t).then((function(t){e.activeRepositorySize=t.data})).catch((function(t){e.activeRepositorySizeError=t.data.message})))},e.$on("autocompleteStatus",(function(){h()})),e.$on("repositoryIsSet",l),e.$on("$routeChangeSuccess",(function(e,n,r){r&&(i.isAuthenticated()||i.isFreeAccessEnabled()?l():t.redirectToLogin())})),e.onKeyDown=function(t){27===t.keyCode&&(e.doClear=!0)}}function s(e,t,n,a,s,o,u,c,l,h,f,p,d,g,m,v,y,b,w,x,S,E,F,A){e.descr=E.instant("main.gdb.description"),e.documentation="",e.menu=t,e.tutorialState=1!==x.get(S.TUTORIAL_STATE),e.userLoggedIn=!1,e.embedded=o.search().embedded,e.productInfo=h;function D(){$(window).width()<=720?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right"),$(".toggle-menu").hide()):$(window).width()>720&&"collapsedMenu"===x.get(S.MENU_STATE)?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right")):($(".container-fluid.main-container").removeClass("expanded"),$(".main-menu").removeClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left"))}!function(){const t=new Date;e.currentYear=t.getFullYear(),e.previousYear=2002}(),e.$on("$routeChangeSuccess",(function(t,n,r){e.clicked=!1,$(".menu-element-root").removeClass("active"),f((function(){$(".menu-element.open a.menu-element-root").addClass("active"),$(".main-menu.collapsed .menu-element.open .menu-element-root").addClass("active")}),400),r&&c.checkLicenseStatus()})),l.$on("$translateChangeSuccess",(function(){e.menu.forEach((function(e){e.label=E.instant(e.labelKey),e.children&&e.children.forEach((function(e){e.label=E.instant(e.labelKey)}))})),l.helpInfo=w.trustAsHtml(Object(i.decodeHTML)(E.instant(l.helpInfo))),l.title=Object(i.decodeHTML)(E.instant(l.title)),e.initTutorial()})),e.checkMenu=function(){return $(".main-menu").hasClass("collapsed")},e.copyToClipboard=function(e){p.openCopyToClipboardModal(e)},e.goToAddRepo=function(){o.path("/repository/create").search({previous:"home"})},e.goToEditRepo=function(e){o.path(`repository/edit/${e.id}`).search({previous:"home",location:e.location})},e.getLocationFromUri=function(e){return u.getLocationFromUri(e)},e.$on("$locationChangeSuccess",(function(){e.showFooter="/"===o.url()})),e.$on("repositoryIsSet",(function(){e.setRestricted(),x.clearClassHieararchyState()})),e.graphdbVersion=e.engineVersion=h.productVersion,e.workbenchVersion=h.Workbench,e.connectorsVersion=h.connectors,e.sesameVersion=h.sesame,e.select=function(t,n,r){$(".main-menu").hasClass("collapsed")?$(n.target).parents(".menu-element").children(".menu-element-root").hasClass("active")?(e.selected=t,e.clicked=!r):(!$(n.target).parents(".menu-element").hasClass("open")&&r?e.clicked=!0:e.clicked=!r,e.selected===t?e.selected=-1:e.selected=t):(!$(n.target).parents(".menu-element").hasClass("open")&&r?e.clicked=!0:e.clicked=!r,0!==$(n.target).parent(".menu-element").find(".sub-menu").length?($(n.target).parents(".menu-element").children(".menu-element-root").hasClass("active")?$(".sub-menu li.active").parents(".menu-element").children(".menu-element-root").removeClass("active"):$(".sub-menu li.active").parents(".menu-element").children(".menu-element-root").addClass("active"),e.selected===t?e.selected=-1:e.selected=t):(f((function(){$(n.target).parents(".menu-element").children(".menu-element-root").addClass("active")}),50),e.selected=t))},$("body").bind("click",(function(t){!$(t.target).parents(".main-menu").length&&$(".main-menu").hasClass("collapsed")&&(e.clicked=!1,e.selected=-1)})),e.isCurrentPath=function(e){return o.path()==="/"+e},e.isCurrentSubmenuChildPath=function(t){return 0!==t.children.length&&t.children.some((function(t){return e.isCurrentPath(t.href)}))},"/"===o.path()?e.selected=-1:(f((function(){const t=o.path().replace("/",""),n=$('a[href^="'+t+'"]');e.selected=n.closest(".menu-element").index()-1}),200),e.isCurrentPath(o.path())),e.popoverTemplate="js/angular/templates/repositorySize.html",e.securityEnabled=!0,e.isSecurityEnabled=function(){return n.isSecurityEnabled()},e.isFreeAccessEnabled=function(){return n.isFreeAccessEnabled()},e.hasExternalAuthUser=function(){return n.hasExternalAuthUser()},e.isDefaultAuthEnabled=function(){return n.isDefaultAuthEnabled()},e.isUserLoggedIn=function(){return e.userLoggedIn},e.hasActiveLocation=function(){return u.hasActiveLocation()},e.getActiveLocation=function(){return u.getActiveLocation()},e.isLoadingLocation=function(){return u.isLoadingLocation()},e.getRepositories=function(){return u.getRepositories()},e.getReadableRepositories=function(){return u.getReadableRepositories()},e.getWritableRepositories=function(){return u.getWritableRepositories()},e.getActiveRepository=function(){return u.getActiveRepository()},e.canWriteRepoInLocation=function(e){return n.canWriteRepo(e)},e.canWriteActiveRepo=function(e){const t=u.getActiveRepositoryObject();return!!t&&(n.canWriteRepo(t)&&("SYSTEM"!==t.id||!e))},e.getActiveRepositoryObject=function(){return u.getActiveRepositoryObject()},e.getActiveRepositoryShortLocation=function(){const e=u.getActiveRepositoryObject();if(e){const t=e.location;if(t)return"@"+F.shortenIri(t)}return""},e.isActiveRepoOntopType=function(){return u.isActiveRepoOntopType()},e.isActiveRepoFedXType=function(){return u.isActiveRepoFedXType()},e.isLicenseValid=function(){return c.isLicenseValid()},e.setAttrs=function(t){e.attrs=t},e.setRestricted=function(){e.attrs&&(e.isRestricted=e.attrs.hasOwnProperty("license")&&!c.isLicenseValid()||e.attrs.hasOwnProperty("write")&&e.isSecurityEnabled()&&!e.canWriteActiveRepo()||e.attrs.hasOwnProperty("ontop")&&e.isActiveRepoOntopType()||e.attrs.hasOwnProperty("fedx")&&e.isActiveRepoFedXType())},e.toHumanReadableType=function(e){switch(e){case"graphdb":return"Graphdb";case"system":return"System";case"ontop":return"Ontop";case"fedx":return"FedX";default:return"Unknown"}},e.setRepository=function(e){u.setRepository(e)},e.logout=function(){n.clearAuthentication(),s.success("Signed out"),n.freeAccess?u.resetActiveRepository():n.isSecurityEnabled()&&l.redirectToLogin()},e.isAdmin=function(){return e.hasRole(r.UserRole.ROLE_ADMIN)},e.isUser=function(){return e.hasRole(r.UserRole.ROLE_USER)},e.hasRole=function(e){return!!angular.isUndefined(e)||n.hasRole(e)},e.hasPermission=function(){return l.hasPermission()},e.canReadRepo=function(e){return n.canReadRepo(e)},e.checkForWrite=function(e,t){return n.checkForWrite(e,t)},e.setPopoverRepo=function(t){e.popoverRepo=t},e.isRepoActive=function(e){return u.isRepoActive(e)},e.getRepositorySize=function(){e.repositorySize={},e.popoverRepo&&(e.repositorySize.loading=!0,v.getSize(e.popoverRepo).then((function(t){e.repositorySize=t.data})))},e.getDegradedReason=function(){return u.getDegradedReason()},e.canManageRepositories=function(){return n.hasRole(r.UserRole.ROLE_REPO_MANAGER)&&!u.getDegradedReason()},e.getSavedQueries=function(){b.getSavedQueries().success((function(t){e.sampleQueries=t})).error((function(e){const t=getError(e);s.error(t,E.instant("query.editor.get.saved.queries.error"))}))},e.goToSparqlEditor=function(e){o.path("/sparql").search({savedQueryName:e.name,owner:e.owner,execute:!0})},e.declineTutorial=function(){$(".tutorial-container").slideUp("slow",(function(){x.set(S.TUTORIAL_STATE,1),e.tutorialState=!1}))},e.initTutorial=function(){if(!e.tutorialState&&"/"!==o.path())return;e.tutorialInfo=[{title:E.instant("main.info.title.welcome.page"),info:Object(i.decodeHTML)(E.instant("main.info.welcome.page"))},{title:E.instant("main.info.title.create.repo.page"),info:Object(i.decodeHTML)(E.instant("main.info.create.repo.page",{link:'<a href="https://graphdb.ontotext.com/documentation/'+h.productShortVersion+'/configuring-a-repository.html" target="_blank">'}))},{title:E.instant("main.info.title.load.sample.dataset"),info:E.instant("main.info.load.sample.dataset")},{title:E.instant("main.info.title.run.sparql.query"),info:Object(i.decodeHTML)(E.instant("main.info.run.sparql.query"))},{title:E.instant("menu.rest.api.label"),info:Object(i.decodeHTML)(E.instant("main.info.rest.api"))}],e.activePage=0,$(".pages-wrapper .page-slide").css("opacity",100);const t=$(".main-container")[0].offsetWidth+200;f((function(){const n=$(".pages-wrapper .page-slide");n.css("left",t+"px"),$(n[e.activePage]).css("left","0px"),$($(".btn-toolbar.pull-right .btn-group .btn")[0]).focus()}),50)},e.getTutorialPageHtml=function(e){return w.trustAsHtml(e.info)},e.checkSubMenuPosition=function(e){0===e?$(".main-menu.collapsed .sub-menu").removeClass("align-bottom"):$(window).height()<735?$(".main-menu.collapsed .sub-menu").addClass("align-bottom"):$(".main-menu.collapsed .sub-menu").removeClass("align-bottom")},D(),$(window).resize((function(){angular.isDefined(e.menuState)?$(window).width()<=720?($(".container-fluid.main-container").addClass("expanded"),$(".main-menu").addClass("collapsed"),$(".toggle-menu").hide(),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right")):$(window).width()>720&&e.menuState?$(".toggle-menu").show():($(".container-fluid.main-container").removeClass("expanded"),$(".main-menu").removeClass("collapsed"),$(".toggle-menu").show(),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left")):D(),e.tutorialState&&"/"===o.path()&&e.initTutorial(),$(window).height()<735?($(".sub-menu").addClass("align-bottom"),$(".main-menu.collapsed li:nth-child(2) .sub-menu").removeClass("align-bottom")):$(".sub-menu").removeClass("align-bottom")})),e.slideToPage=function(t){const n=$(".main-container")[0].offsetWidth,r=$(".pages-wrapper .page-slide");r.css("opacity","0").delay(200).css("left",n+"px"),e.activePage=t,$(r[e.activePage]).css("opacity","100").css("left","0px")},e.slideNext=function(){let t=++e.activePage;t>=e.tutorialInfo.length&&(t=0),e.slideToPage(t),$($(".btn-toolbar.pull-right .btn-group .btn")[e.activePage]).focus()},e.toggleNavigation=function(){const t=$(".main-menu"),n=$(".sub-menu li.active");if(t.hasClass("collapsed"))n.parents(".menu-element").hasClass("open")?n.parents(".menu-element").children(".menu-element-root").removeClass("active"):n.parents(".menu-element").children(".menu-element-root").addClass("active"),$(".container-fluid.main-container").removeClass("expanded"),t.removeClass("collapsed"),$(".main-menu .icon-caret-right").toggleClass("icon-caret-right").toggleClass("icon-caret-left"),l.$broadcast("onToggleNavWidth",!1);else{n.parents(".menu-element").children(".menu-element-root").addClass("active");const r=$(".menu-element");r.hasClass("open")&&(r.removeClass("open"),e.clicked=!1,e.selected=-1),$(".container-fluid.main-container").addClass("expanded"),t.addClass("collapsed"),$(".main-menu .icon-caret-left").toggleClass("icon-caret-left").toggleClass("icon-caret-right"),$(".main-menu.collapsed .menu-element.clicked").removeClass("clicked"),l.$broadcast("onToggleNavWidth",!0)}},e.$on("onToggleNavWidth",(function(t,n){if(e.menuState=n,n?x.set(S.MENU_STATE,"collapsedMenu"):x.set(S.MENU_STATE,"expandedMenu"),e.tutorialState&&"/"===o.path()){const t=$(".pages-wrapper")[0].offsetWidth+200;f((function(){const n=$(".pages-wrapper .page-slide");n.css("left",t+"px"),$(n[e.activePage]).css("left","0px")}),50)}})),e.numberOfActiveImports=0,e.getNumberOfActiveImportsRunning=!1,e.getNumberOfActiveImports=function(){e.getNumberOfActiveImportsRunning||e.canWriteActiveRepo()&&"SYSTEM"!==e.getActiveRepository()&&(e.getNumberOfActiveImportsRunning=!0,a({method:"GET",url:"rest/repositories/"+e.getActiveRepository()+"/import/active",timeout:1e4}).success((function(t){e.numberOfActiveImports=t})).finally((function(){e.getNumberOfActiveImportsRunning=!1})))},e.getQueriesRunning=!1,e.skipGetQueriesTimes=0;const C=function(){let e=0,t=1;return{next:function(){const n=t;return t=e+t,e=n,n},reset:function(){e=0,t=1}}}();e.getQueries=function(){e.getQueriesRunning||(e.skipGetQueriesTimes>0?e.skipGetQueriesTimes--:u.getActiveRepository()&&"SYSTEM"!==u.getActiveRepository()&&!u.isActiveRepoOntopType()&&e.hasRole(r.UserRole.ROLE_USER)?(e.getQueriesRunning=!0,y.getQueryCount().success((function(t){e.queryCount=t,C.reset()})).error((function(){e.queryCount=0,e.skipGetQueriesTimes=C.next()})).finally((function(){e.getQueriesRunning=!1}))):e.queryCount=0)};const R=d((function(){e.getDegradedReason()||(e.getQueries(),e.getNumberOfActiveImports())}),2e3);e.$on("$destroy",(function(){d.cancel(R)})),n.securityInitialized&&e.getSavedQueries(),e.$on("securityInit",(function(t,r,i,a){e.securityEnabled=r,e.userLoggedIn=i,!r||i||a?(A.when(n.getPrincipal()).then(t=>{e.principal=t,e.isIgnoreSharedQueries=t&&t.appSettings.IGNORE_SHARED_QUERIES}),c.checkLicenseStatus(),e.getSavedQueries()):"/login"!==o.path()&&l.redirectToLogin()})),e.isEnterprise=function(){return"enterprise"===e.getProductType()},e.isFreeEdition=function(){return"free"===e.getProductType()},e.checkEdition=function(t){return null==t||_.indexOf(t,e.getProductType())>=0},e.showLicense=function(){return c.showLicense},e.getLicense=function(){return c.license},e.isLicenseHardcoded=function(){return c.isLicenseHardcoded},e.getProductType=function(){return c.productType},e.getProductTypeHuman=function(){return c.productTypeHuman},e.getHumanReadableSeconds=function(e,t){const n=Math.floor(e/86400),r=Math.floor(e%86400/3600),i=Math.floor(e%3600/60);let a;a=t&&e<10?e<1?_.ceil(e%60,1):_.round(e%60,1):_.round(e%60,0);let s="";return n&&(s+=n+"d "),(n||r)&&(s+=r+"h "),(n||r||i)&&(s+=i+"m "),s+=a+"s",s.replace(/( 0[a-z])+$/,"")},e.getHumanReadableTimestamp=function(e){const t=Date.now(),n=(t-e)/1e3;if(n<60)return E.instant("timestamp.moments.ago");if(n<600)return E.instant("timestamp.minutes.ago");{const r=new Date(t),i=new Date(e);if(r.getYear()===i.getYear()&&r.getMonth()===i.getMonth()&&r.getDate()===i.getDate())return g("date")(e,"'"+E.instant("timestamp.today.at")+"' HH:mm");if(n<86400)return g("date")(e,"'"+E.instant("timestamp.yesterday.at")+"' HH:mm")}return g("date")(e,"'"+E.instant("timestamp.on")+"' yyyy-MM-dd '"+E.instant("timestamp.at")+"' HH:mm")}}function o(e,t,n){e.getRepositorySize=function(t){n.getSize(t).then((function(t){e.size=t.data}))}}angular.module("graphdb.workbench.se.controllers",["graphdb.framework.core.services.jwtauth","graphdb.framework.core.services.repositories","graphdb.framework.core.services.licenseService","ngCookies","ngFileUpload","graphdb.framework.core","graphdb.framework.core.controllers","graphdb.framework.core.directives","graphdb.framework.rest.license.service","graphdb.framework.rest.autocomplete.service","graphdb.framework.rest.repositories.service","graphdb.framework.rest.sparql.service","graphdb.framework.rest.autocomplete.service","graphdb.framework.rest.plugins.service","graphdb.framework.rest.monitoring.service","graphdb.framework.rest.rdf4j.repositories.service","graphdb.framework.utils.localstorageadapter","graphdb.framework.core.services.autocompleteStatus","graphdb.framework.utils.uriutils"]).controller("mainCtrl",s).controller("homeCtrl",a).controller("repositorySizeCtrl",o),a.$inject=["$scope","$rootScope","$http","$repositories","$jwtAuth","$licenseService","AutocompleteRestService","LicenseRestService","RepositoriesRestService","RDF4JRepositoriesRestService"],s.$inject=["$scope","$menuItems","$jwtAuth","$http","toastr","$location","$repositories","$licenseService","$rootScope","productInfo","$timeout","ModalService","$interval","$filter","LicenseRestService","RepositoriesRestService","MonitoringRestService","SparqlRestService","$sce","LocalStorageAdapter","LSKeys","$translate","UriUtils","$q"],o.$inject=["$scope","$http","RepositoriesRestService"]},function(e,t){angular.module("graphdb.framework.rest.locations.service",[]).factory("LocationsRestService",a),a.$inject=["$http"];const n="rest/locations",r=`${n}/active`,i="rest/info/rpc-address";function a(e){return{getLocations:function(t){return e.get(n,{timeout:t?t.promise:null})},addLocation:function(t){return e.post(n,t)},editLocation:function(t){return e.put(n,t)},deleteLocation:function(t){return e.delete(`${n}?uri=${t}`)},getActiveLocation:function(){return e({method:"GET",url:`${r}`,noCancelOnRouteChange:!0})},setDefaultRepository:function(t){return e({url:`${r}/default-repository`,method:"POST",data:{defaultRepository:t}})},getLocationRpcAddress:function(t){return e.get(`${i}`,{params:{location:t}})}}}},function(e,t){angular.module("graphdb.framework.core.services.licenseService",[]).service("$licenseService",["$rootScope","LicenseRestService","$translate",function(e,t,n){const r=this;this.checkLicenseStatus=function(){r.loadingLicense=!0,t.getHardcodedLicense().success((function(e){r.isLicenseHardcoded="true"===e})).error((function(){r.isLicenseHardcoded=!0})).then((function(){t.getLicenseInfo().then((function(e){r.license=e.data,r.showLicense=!0,r.loadingLicense=!1,i(r.license)}),(function(){r.license={message:n.instant("no.license.set.msg"),valid:!1},r.showLicense=!0,r.loadingLicense=!1,i(r.license)}))}))};const i=function(e){r.productType=e.productType,"standard"===r.productType?r.productTypeHuman="Standard":"enterprise"===r.productType?r.productTypeHuman="Enterprise":"free"===r.productType?r.productTypeHuman="Free":"graphdb"===r.productType&&(r.productTypeHuman="GraphDB")};this.checkLicenseStatus(),this.isLicenseValid=function(){return r.license&&r.license.valid}}])},function(e,t){angular.module("graphdb.framework.core.services.autocompleteStatus",[]).service("$autocompleteStatus",["$rootScope","AutocompleteRestService","LocalStorageAdapter","LSKeys","$repositories",function(e,t,n,r,i){const a=this;this.setAutocompleteStatus=function(t){n.set(r.AUTOCOMPLETE_ENABLED,t),e.$broadcast("autocompleteStatus",t)},e.$watch((function(){return n.get(r.AUTOCOMPLETE_ENABLED)}),(function(e){a.setAutocompleteStatus(e)}),!0),e.$on("repositoryIsSet",(function(){!i.getActiveRepository()||i.isActiveRepoOntopType()||i.isActiveRepoFedXType()||t.checkAutocompleteStatus().success((function(e){a.setAutocompleteStatus(e)}))}))}])},function(e,t){
|
|
28
28
|
/**
|
|
29
29
|
* angular-cancel-on-navigate - AngularJS module that cancels HTTP requests on location change (navigation)
|
|
30
30
|
* @version v0.1.0
|
|
@@ -86,4 +86,4 @@ var r=n(165),i=n(166),a=n(167);function s(){return u.TYPED_ARRAY_SUPPORT?2147483
|
|
|
86
86
|
*
|
|
87
87
|
* Copyright (c) 2021 The angular-translate team, Pascal Precht; Licensed MIT
|
|
88
88
|
*/void 0===(r=function(){return function(){function e(e,t){"use strict";return function(n){if(!n||!(angular.isArray(n.files)||angular.isString(n.prefix)&&angular.isString(n.suffix)))throw new Error("Couldn't load static files, no files and prefix or suffix specified!");n.files||(n.files=[{prefix:n.prefix,suffix:n.suffix}]);for(var r=function(r){if(!r||!angular.isString(r.prefix)||!angular.isString(r.suffix))throw new Error("Couldn't load static file, no prefix or suffix specified!");var i=[r.prefix,n.key,r.suffix].join("");return angular.isObject(n.fileMap)&&n.fileMap[i]&&(i=n.fileMap[i]),t(angular.extend({url:i,method:"GET"},n.$http)).then((function(e){return e.data}),(function(){return e.reject(n.key)}))},i=[],a=n.files.length,s=0;s<a;s++)i.push(r({prefix:n.files[s].prefix,key:n.key,suffix:n.files[s].suffix}));return e.all(i).then((function(e){for(var t=e.length,n={},r=0;r<t;r++)for(var i in e[r])n[i]=e[r][i];return n}))}}return e.$inject=["$q","$http"],angular.module("pascalprecht.translate").factory("$translateStaticFilesLoader",e),e.displayName="$translateStaticFilesLoader","pascalprecht.translate"}()}.apply(t,[]))||(e.exports=r)},function(e,t,n){var r={"./autocomplete/app":[92,9,31],"./autocomplete/app.js":[92,9,31],"./autocomplete/controllers":[49,9,42],"./autocomplete/controllers.js":[49,9,42],"./autocomplete/plugin":[93,7,43],"./autocomplete/plugin.js":[93,7,43],"./autocomplete/templates/modal/add-label.html":[171,7,111],"./clustermanagement/app":[94,9,7,9,1,3,21],"./clustermanagement/app.js":[94,9,7,9,1,3,21],"./clustermanagement/cluster-drawing.service":[44,9,3,44],"./clustermanagement/cluster-drawing.service.js":[44,9,3,44],"./clustermanagement/controllers":[40,9,3],"./clustermanagement/controllers.js":[40,9,3],"./clustermanagement/directives":[51,9,3,27],"./clustermanagement/directives.js":[51,9,3,27],"./clustermanagement/plugin":[95,7,45],"./clustermanagement/plugin.js":[95,7,45],"./clustermanagement/templates/modal/add-nodes-dialog.html":[172,7,112],"./clustermanagement/templates/modal/cluster-create-dialog.html":[173,7,113],"./clustermanagement/templates/modal/cluster-delete-dialog.html":[174,7,114],"./clustermanagement/templates/modal/cluster-edit-dialog.html":[175,7,115],"./clustermanagement/templates/modal/remove-nodes-dialog.html":[176,7,116],"./controllers":[23,9],"./controllers.js":[23,9],"./core/angularCancelOnNavigateModule":[27,7],"./core/angularCancelOnNavigateModule.js":[27,7],"./core/controllers":[14,7],"./core/controllers.js":[14,7],"./core/directives":[9,9],"./core/directives.js":[9,9],"./core/directives/fit-text.directive":[52,7,46],"./core/directives/fit-text.directive.js":[52,7,46],"./core/directives/languageselector/language-selector.directive":[29,9],"./core/directives/languageselector/language-selector.directive.js":[29,9],"./core/directives/languageselector/templates/languageSelector.html":[177,7,117],"./core/directives/paginations":[45,7,47],"./core/directives/paginations.js":[45,7,47],"./core/directives/queryeditor/query-editor.controller":[38,9,48],"./core/directives/queryeditor/query-editor.controller.js":[38,9,48],"./core/directives/queryeditor/query-editor.directive":[39,9,0,23],"./core/directives/queryeditor/query-editor.directive.js":[39,9,0,23],"./core/directives/queryeditor/sparql-tab.directive":[37,9,49],"./core/directives/queryeditor/sparql-tab.directive.js":[37,9,49],"./core/directives/queryeditor/templates/query-editor.html":[178,7,118],"./core/directives/queryeditor/templates/query-sample.html":[179,7,119],"./core/directives/rdfresourcesearch/rdf-resource-search.directive":[28,9],"./core/directives/rdfresourcesearch/rdf-resource-search.directive.js":[28,9],"./core/directives/rdfresourcesearch/templates/rdfResourceSearchTemplate.html":[180,7,120],"./core/interceptors/unauthorized.interceptor":[18,9],"./core/interceptors/unauthorized.interceptor.js":[18,9],"./core/loading-hint":[19,7,50],"./core/loading-hint.js":[19,7,50],"./core/services":[3,9],"./core/services.js":[3,9],"./core/services/autocomplete-status.service":[26,7],"./core/services/autocomplete-status.service.js":[26,7],"./core/services/jwt-auth.service":[10,9],"./core/services/jwt-auth.service.js":[10,9],"./core/services/license.service":[25,7],"./core/services/license.service.js":[25,7],"./core/services/openid-auth.service":[20,9],"./core/services/openid-auth.service.js":[20,9],"./core/services/repositories.service":[8,9],"./core/services/repositories.service.js":[8,9],"./core/templates/core-errors.html":[181,7,121],"./core/templates/inactive-plugin-warning-page.html":[182,7,122],"./core/templates/modal/copy-to-clipboard-modal.html":[183,7,123],"./core/templates/modal/modal-simple.html":[184,7,124],"./core/templates/modal/modal-warning.html":[185,7,125],"./core/templates/search-resource-input.html":[186,7,126],"./explore/app":[96,9,6,0,8,15],"./explore/app.js":[96,9,6,0,8,15],"./explore/controllers":[90,9,0,8],"./explore/controllers.js":[90,9,0,8],"./explore/directives":[54,9,51],"./explore/directives.js":[54,9,51],"./explore/plugin":[97,7,52],"./explore/plugin.js":[97,7,52],"./explore/statements.service":[53,7,53],"./explore/statements.service.js":[53,7,53],"./explore/templates/viewTrig.html":[187,7,127],"./export/app":[98,9,12],"./export/app.js":[98,9,12],"./export/controllers":[55,9,32],"./export/controllers.js":[55,9,32],"./export/plugin":[99,7,54],"./export/plugin.js":[99,7,54],"./externalsync/app":[100,9,24],"./externalsync/app.js":[100,9,24],"./externalsync/controllers":[36,9,33],"./externalsync/controllers.js":[36,9,33],"./externalsync/directives":[56,9,55],"./externalsync/directives.js":[56,9,55],"./externalsync/plugin":[101,7,56],"./externalsync/plugin.js":[101,7,56],"./externalsync/templates/deleteConnector.html":[188,7,128],"./graphexplore/app":[102,9,7,9,20,0,11],"./graphexplore/app.js":[102,9,7,9,20,0,11],"./graphexplore/controllers/dependencies-chord.controller":[63,7,57],"./graphexplore/controllers/dependencies-chord.controller.js":[63,7,57],"./graphexplore/controllers/domain-range-graph.controller":[62,9,58],"./graphexplore/controllers/domain-range-graph.controller.js":[62,9,58],"./graphexplore/controllers/graphs-config.controller":[65,9,34],"./graphexplore/controllers/graphs-config.controller.js":[65,9,34],"./graphexplore/controllers/graphs-visualizations.controller":[64,9,25],"./graphexplore/controllers/graphs-visualizations.controller.js":[64,9,25],"./graphexplore/controllers/rdf-class-hierarchy.controller":[61,9,59],"./graphexplore/controllers/rdf-class-hierarchy.controller.js":[61,9,59],"./graphexplore/directives/dependencies-chord.directive":[70,9,28],"./graphexplore/directives/dependencies-chord.directive.js":[70,9,28],"./graphexplore/directives/domain-range-graph.directive":[67,9,29],"./graphexplore/directives/domain-range-graph.directive.js":[67,9,29],"./graphexplore/directives/list-items-search-filter.directive":[71,7,60],"./graphexplore/directives/list-items-search-filter.directive.js":[71,7,60],"./graphexplore/directives/rdf-class-hierarchy.directive":[66,9,18],"./graphexplore/directives/rdf-class-hierarchy.directive.js":[66,9,18],"./graphexplore/directives/rdfs-comment-label.directive":[69,7,61],"./graphexplore/directives/rdfs-comment-label.directive.js":[69,7,61],"./graphexplore/directives/search-icon-input.directive":[72,7,62],"./graphexplore/directives/search-icon-input.directive.js":[72,7,62],"./graphexplore/directives/system-repo-warning.directive":[68,7,63],"./graphexplore/directives/system-repo-warning.directive.js":[68,7,63],"./graphexplore/plugin":[103,7,64],"./graphexplore/plugin.js":[103,7,64],"./graphexplore/services/rdfs-label-comment.service":[58,7,65],"./graphexplore/services/rdfs-label-comment.service.js":[58,7,65],"./graphexplore/services/ui-scroll.service":[57,7,66],"./graphexplore/services/ui-scroll.service.js":[57,7,66],"./graphexplore/templates/listItemsSearchFilterTemplate.html":[189,7,129],"./graphexplore/templates/modal/save-graph.html":[190,7,130],"./graphexplore/templates/rdfClassHierarchyClassCountSliderHelpTemplate.html":[191,7,131],"./graphexplore/templates/rdfsCommentLabelTemplate.html":[192,7,132],"./graphexplore/templates/searchIconInputTemplate.html":[193,7,133],"./graphexplore/templates/systemRepoWarningTemplate.html":[194,7,134],"./import/app":[104,9,30],"./import/app.js":[104,9,30],"./import/controllers":[73,9,67],"./import/controllers.js":[73,9,67],"./import/directives":[74,9,68],"./import/directives.js":[74,9,68],"./import/plugin":[105,7,69],"./import/plugin.js":[105,7,69],"./import/templates/commonInfo.html":[195,7,135],"./import/templates/filesTable.html":[196,7,136],"./import/templates/importInfo.html":[197,7,137],"./import/templates/settingsModal.html":[198,7,138],"./import/templates/textSnippet.html":[199,7,139],"./import/templates/uploadInfo.html":[200,7,140],"./import/templates/urlImport.html":[201,7,141],"./jdbc/app":[106,9,0,1,2,4,16],"./jdbc/app.js":[106,9,0,1,2,4,16],"./jdbc/controllers":[75,9,35],"./jdbc/controllers.js":[75,9,35],"./jdbc/plugin":[107,7,70],"./jdbc/plugin.js":[107,7,70],"./namespaces/app":[108,9,6,22],"./namespaces/app.js":[108,9,6,22],"./namespaces/controllers":[77,9,71],"./namespaces/controllers.js":[77,9,71],"./namespaces/directives":[78,7,72],"./namespaces/directives.js":[78,7,72],"./namespaces/plugin":[109,7,73],"./namespaces/plugin.js":[109,7,73],"./plugin":[111,7,75],"./plugin-registry":[110,7,74],"./plugin-registry.js":[110,7,74],"./plugin.js":[111,7,75],"./plugins/app":[112,9,36],"./plugins/app.js":[112,9,36],"./plugins/controllers":[79,9,76],"./plugins/controllers.js":[79,9,76],"./plugins/plugin":[113,7,77],"./plugins/plugin.js":[113,7,77],"./queries/app":[114,9,37],"./queries/app.js":[114,9,37],"./queries/controllers":[80,9,78],"./queries/controllers.js":[80,9,78],"./queries/plugin":[115,7,79],"./queries/plugin.js":[115,7,79],"./rdfrank/app":[116,9,26],"./rdfrank/app.js":[116,9,26],"./rdfrank/plugin":[117,7,80],"./rdfrank/plugin.js":[117,7,80],"./rdfrank/templates/filter-list.html":[202,7,142],"./repositories/app":[118,9,5,19],"./repositories/app.js":[118,9,5,19],"./repositories/controllers":[48,9,5],"./repositories/controllers.js":[48,9,5],"./repositories/fedx-repo.directive":[83,7,81],"./repositories/fedx-repo.directive.js":[83,7,81],"./repositories/ontop-repo.directive":[82,9,5,82],"./repositories/ontop-repo.directive.js":[82,9,5,82],"./repositories/plugin":[119,7,83],"./repositories/plugin.js":[119,7,83],"./repositories/repository.constants":[42,9,84],"./repositories/repository.constants.js":[42,9,84],"./repositories/templates/fedx-repo.html":[203,7,143],"./repositories/templates/ontop-repo.html":[204,7,144],"./resources/app":[120,9,7,1,4,38],"./resources/app.js":[120,9,7,1,4,38],"./resources/controllers":[47,9,1,4],"./resources/controllers.js":[47,9,1,4],"./resources/plugin":[121,7,85],"./resources/plugin.js":[121,7,85],"./rest/autocomplete.rest.service":[16,7],"./rest/autocomplete.rest.service.js":[16,7],"./rest/cluster.rest.service":[50,7,86],"./rest/cluster.rest.service.js":[50,7,86],"./rest/connectors.rest.service":[35,7,87],"./rest/connectors.rest.service.js":[35,7,87],"./rest/graph-config.rest.service":[60,7,88],"./rest/graph-config.rest.service.js":[60,7,88],"./rest/graph-data.rest.service":[43,7,89],"./rest/graph-data.rest.service.js":[43,7,89],"./rest/jdbc.rest.service":[76,7,90],"./rest/jdbc.rest.service.js":[76,7,90],"./rest/license.rest.service":[6,7],"./rest/license.rest.service.js":[6,7],"./rest/locations.rest.service":[24,7],"./rest/locations.rest.service.js":[24,7],"./rest/monitoring.rest.service":[12,7],"./rest/monitoring.rest.service.js":[12,7],"./rest/plugins.rest.service":[17,7],"./rest/plugins.rest.service.js":[17,7],"./rest/rdf4j.repositories.rest.service":[13,7],"./rest/rdf4j.repositories.rest.service.js":[13,7],"./rest/rdfrank.rest.service":[81,7,91],"./rest/rdfrank.rest.service.js":[81,7,91],"./rest/repositories.rest.service":[7,7],"./rest/repositories.rest.service.js":[7,7],"./rest/saved-graphs.rest.service":[59,7,92],"./rest/saved-graphs.rest.service.js":[59,7,92],"./rest/security.rest.service":[21,7],"./rest/security.rest.service.js":[21,7],"./rest/similarity.rest.service":[85,7,93],"./rest/similarity.rest.service.js":[85,7,93],"./rest/sparql-templates.rest.service":[86,7,94],"./rest/sparql-templates.rest.service.js":[86,7,94],"./rest/sparql.rest.service":[15,7],"./rest/sparql.rest.service.js":[15,7],"./security/app":[122,9,10,95],"./security/app.js":[122,9,10,95],"./security/controllers":[91,9,10],"./security/controllers.js":[91,9,10],"./security/plugin":[123,7,96],"./security/plugin.js":[123,7,96],"./security/templates/modal/default-authorities.html":[205,7,145],"./security/templates/roles.html":[206,7,146],"./security/templates/user.html":[207,7,147],"./security/templates/users.html":[208,7,148],"./settings/app":[84,9,39],"./settings/app.js":[84,9,39],"./settings/controllers":[46,9,97],"./settings/controllers.js":[46,9,97],"./settings/modal/location-settings.html":[209,7,149],"./settings/modal/validate-license.html":[210,7,150],"./settings/plugin":[124,7,98],"./settings/plugin.js":[124,7,98],"./similarity/app":[125,9,0,2,13],"./similarity/app.js":[125,9,0,2,13],"./similarity/controllers/create-index.controller":[88,9,40],"./similarity/controllers/create-index.controller.js":[88,9,40],"./similarity/controllers/similarity-list.controller":[87,9,0,99],"./similarity/controllers/similarity-list.controller.js":[87,9,0,99],"./similarity/plugin":[126,7,100],"./similarity/plugin.js":[126,7,100],"./sparql-template/app":[129,9,0,1,2,4,17],"./sparql-template/app.js":[129,9,0,1,2,4,17],"./sparql-template/controllers":[89,9,41],"./sparql-template/controllers.js":[89,9,41],"./sparql-template/plugin":[130,7,101],"./sparql-template/plugin.js":[130,7,101],"./sparql/app":[127,9,6,0,2,14],"./sparql/app.js":[127,9,6,0,2,14],"./sparql/plugin":[128,7,102],"./sparql/plugin.js":[128,7,102],"./stats/app":[131,9,103],"./stats/app.js":[131,9,103],"./stats/plugin":[132,7,104],"./stats/plugin.js":[132,7,104],"./templates/graphdb-small.svg":[211,7,158],"./templates/loader/ot-loader.svg":[212,7,159],"./templates/modal/add-fedx-remote-repo.html":[213,7,151],"./templates/modal/add-location.html":[214,7,152],"./templates/modal/edit-location.html":[215,7,153],"./templates/modal/editRepoFile.html":[216,7,154],"./templates/modal/upload-repository-config.html":[217,7,155],"./templates/repositorySize.html":[218,7,156],"./templates/titlePopoverTemplate.html":[219,7,157],"./treeview/ng-tree":[133,7,105],"./treeview/ng-tree.js":[133,7,105],"./utils/error-utils":[22,7],"./utils/error-utils.js":[22,7],"./utils/file-types":[41,7,106],"./utils/file-types.js":[41,7,106],"./utils/local-storage-adapter":[4,7],"./utils/local-storage-adapter.js":[4,7],"./utils/notifications":[34,7,107],"./utils/notifications.js":[34,7,107],"./utils/uri-utils":[11,7],"./utils/uri-utils.js":[11,7],"./utils/user-utils":[1,9],"./utils/user-utils.js":[1,9]};function i(e){if(!n.o(r,e))return Promise.resolve().then((function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}));var t=r[e],i=t[0];return Promise.all(t.slice(2).map(n.e)).then((function(){return n.t(i,t[1])}))}i.keys=function(){return Object.keys(r)},i.id=170,e.exports=i}]);
|
|
89
|
-
//# sourceMappingURL=bundle.
|
|
89
|
+
//# sourceMappingURL=bundle.7d5dd8e4d7cb8ed01086.bundle.js.map
|