@it-enterprise/digital-signature 1.5.0 → 1.5.1

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.
@@ -1,2 +1,2 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ItDigitalSignature={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},u=(e,r,i)=>(i=e==null?{}:t(a(e)),l(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),d=s(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(e,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&typeof e==`object`&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&typeof e!=`string`)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=4)}([function(e,t,n){"use strict";n.r(t),n.d(t,`EU_LIBRARY_TYPE_JS`,function(){return i}),n.d(t,`EU_LIBRARY_TYPE_SW`,function(){return a}),n.d(t,`EU_LIBRARY_TYPE_MS`,function(){return o}),n.d(t,`EndUserLibraryType`,function(){return r}),n.d(t,`EU_SUBJECT_TYPE_UNDIFFERENCED`,function(){return c}),n.d(t,`EU_SUBJECT_TYPE_CA`,function(){return l}),n.d(t,`EU_SUBJECT_TYPE_CA_SERVER`,function(){return u}),n.d(t,`EU_SUBJECT_TYPE_RA_ADMINISTRATOR`,function(){return d}),n.d(t,`EU_SUBJECT_TYPE_END_USER`,function(){return f}),n.d(t,`EndUserSubjectType`,function(){return s}),n.d(t,`EU_SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED`,function(){return m}),n.d(t,`EU_SUBJECT_CA_SERVER_SUB_TYPE_CMP`,function(){return h}),n.d(t,`EU_SUBJECT_CA_SERVER_SUB_TYPE_TSP`,function(){return g}),n.d(t,`EU_SUBJECT_CA_SERVER_SUB_TYPE_OCSP`,function(){return _}),n.d(t,`EndUserSubjectCAServerSubType`,function(){return p}),n.d(t,`EU_CERT_KEY_TYPE_UNKNOWN`,function(){return y}),n.d(t,`EU_CERT_KEY_TYPE_DSTU4145`,function(){return b}),n.d(t,`EU_CERT_KEY_TYPE_RSA`,function(){return x}),n.d(t,`EU_CERT_KEY_TYPE_ECDSA`,function(){return S}),n.d(t,`EndUserCertKeyType`,function(){return v}),n.d(t,`EU_CERT_HASH_TYPE_UNKNOWN`,function(){return w}),n.d(t,`EU_CERT_HASH_TYPE_GOST34311`,function(){return T}),n.d(t,`EU_CERT_HASH_TYPE_SHA1`,function(){return E}),n.d(t,`EU_CERT_HASH_TYPE_SHA224`,function(){return D}),n.d(t,`EU_CERT_HASH_TYPE_SHA256`,function(){return O}),n.d(t,`EU_CERT_HASH_TYPE_SHA384`,function(){return k}),n.d(t,`EU_CERT_HASH_TYPE_SHA512`,function(){return A}),n.d(t,`EU_CERT_HASH_TYPE_DSTU7564_256`,function(){return j}),n.d(t,`EU_CERT_HASH_TYPE_DSTU7564_384`,function(){return M}),n.d(t,`EU_CERT_HASH_TYPE_DSTU7564_512`,function(){return N}),n.d(t,`EndUserCertHashType`,function(){return C}),n.d(t,`EU_KEY_USAGE_UNKNOWN`,function(){return F}),n.d(t,`EU_KEY_USAGE_DIGITAL_SIGNATURE`,function(){return I}),n.d(t,`EU_KEY_USAGE_NON_REPUDATION`,function(){return L}),n.d(t,`EU_KEY_USAGE_KEY_AGREEMENT`,function(){return R}),n.d(t,`EndUserKeyUsage`,function(){return P}),n.d(t,`EU_CCS_TYPE_REVOKE`,function(){return B}),n.d(t,`EU_CCS_TYPE_HOLD`,function(){return V}),n.d(t,`EndUserCCSType`,function(){return z}),n.d(t,`EU_REVOCATION_REASON_UNKNOWN`,function(){return ee}),n.d(t,`EU_REVOCATION_REASON_KEY_COMPROMISE`,function(){return U}),n.d(t,`EU_REVOCATION_REASON_NEW_ISSUED`,function(){return W}),n.d(t,`EndUserRevocationReason`,function(){return H}),n.d(t,`EU_KEYS_TYPE_NONE`,function(){return K}),n.d(t,`EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_GOST`,function(){return q}),n.d(t,`EU_KEYS_TYPE_RSA_WITH_SHA`,function(){return J}),n.d(t,`EU_KEYS_TYPE_ECDSA_WITH_SHA`,function(){return te}),n.d(t,`EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_DSTU`,function(){return ne}),n.d(t,`EndUserKeysType`,function(){return G}),n.d(t,`EU_KEYS_LENGTH_DS_UA_191`,function(){return re}),n.d(t,`EU_KEYS_LENGTH_DS_UA_257`,function(){return ie}),n.d(t,`EU_KEYS_LENGTH_DS_UA_307`,function(){return X}),n.d(t,`EU_KEYS_LENGTH_DS_UA_FILE`,function(){return Z}),n.d(t,`EU_KEYS_LENGTH_DS_UA_CERT`,function(){return Q}),n.d(t,`EndUserKeysLengthDSUA`,function(){return Y}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_257`,function(){return ae}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_431`,function(){return oe}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_571`,function(){return se}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_FILE`,function(){return ce}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_CERT`,function(){return le}),n.d(t,`EndUserKeysLengthKEPUA`,function(){return $}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_1024`,function(){return de}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_2048`,function(){return fe}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_3072`,function(){return pe}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_4096`,function(){return me}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_FILE`,function(){return he}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_CERT`,function(){return ge}),n.d(t,`EndUserKeysLengthDSRSA`,function(){return ue}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_192`,function(){return ve}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_256`,function(){return ye}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_384`,function(){return be}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_521`,function(){return xe}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_FILE`,function(){return Se}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_CERT`,function(){return Ce}),n.d(t,`EndUserKeysLengthDSECDSA`,function(){return _e}),n.d(t,`EU_KEYS_REQUEST_TYPE_UA_DS`,function(){return Te}),n.d(t,`EU_KEYS_REQUEST_TYPE_UA_KEP`,function(){return Ee}),n.d(t,`EU_KEYS_REQUEST_TYPE_INT_RSA`,function(){return De}),n.d(t,`EndUserRequestTypes`,function(){return we}),n.d(t,`EU_MOBILE_OPERATOR_ID_KYIVSTAR`,function(){return ke}),n.d(t,`EU_MOBILE_OPERATOR_ID_VODAFONE`,function(){return Ae}),n.d(t,`EU_MOBILE_OPERATOR_ID_LIFECELL`,function(){return je}),n.d(t,`EndUserMobileOperatorID`,function(){return Oe}),n.d(t,`EU_KSP_IIT`,function(){return Pe}),n.d(t,`EU_KSP_UKEY`,function(){return Fe}),n.d(t,`EU_KSP_PB`,function(){return Ie}),n.d(t,`EU_KSP_DIIA`,function(){return Le}),n.d(t,`EndUserKSP`,function(){return Me}),n.d(t,`EndUserKSPClientIdType`,function(){return Ne}),n.d(t,`EU_SIGN_TYPE_UNKNOWN`,function(){return ze}),n.d(t,`EU_SIGN_TYPE_CADES_BES`,function(){return Be}),n.d(t,`EU_SIGN_TYPE_CADES_T`,function(){return Ve}),n.d(t,`EU_SIGN_TYPE_CADES_C`,function(){return He}),n.d(t,`EU_SIGN_TYPE_CADES_X_LONG`,function(){return Ue}),n.d(t,`EU_SIGN_TYPE_CADES_X_LONG_TRUSTED`,function(){return We}),n.d(t,`EndUserSignType`,function(){return Re}),n.d(t,`EU_CADES_TYPE_UNKNOWN`,function(){return Ke}),n.d(t,`EU_CADES_TYPE_DETACHED`,function(){return qe}),n.d(t,`EU_CADES_TYPE_ENVELOPED`,function(){return Je}),n.d(t,`EndUserCAdESType`,function(){return Ge}),n.d(t,`EU_CTX_SIGN_UNKNOWN`,function(){return Xe}),n.d(t,`EU_CTX_SIGN_DSTU4145_WITH_GOST34311`,function(){return Ze}),n.d(t,`EU_CTX_SIGN_RSA_WITH_SHA`,function(){return Qe}),n.d(t,`EU_CTX_SIGN_ECDSA_WITH_SHA`,function(){return $e}),n.d(t,`EU_CTX_SIGN_DSTU4145_WITH_DSTU7564`,function(){return et}),n.d(t,`EndUserSignAlgo`,function(){return Ye}),n.d(t,`EU_SIGN_TYPE_PARAMETER`,function(){return nt}),n.d(t,`EU_USE_SLOGIN_PRIVATE_KEY`,function(){return rt}),n.d(t,`EU_FS_CALCULATE_FINGERPRINT`,function(){return it}),n.d(t,`EU_CHECK_PRIVATE_KEY_CONTEXT_PARAMETER`,function(){return at}),n.d(t,`EU_USE_SLOGIN_PRIVATE_KEY_CONTEXT_PARAMETER`,function(){return ot}),n.d(t,`EU_UA_OID_EXT_KEY_USAGE_STAMP`,function(){return st}),n.d(t,`EU_USER_INFO_VERSION`,function(){return ct}),n.d(t,`EndUserCMPCompatibility`,function(){return tt}),n.d(t,`EU_CTX_HASH_ALGO_UNKNOWN`,function(){return ut}),n.d(t,`EU_CTX_HASH_ALGO_GOST34311`,function(){return dt}),n.d(t,`EU_CTX_HASH_ALGO_SHA160`,function(){return ft}),n.d(t,`EU_CTX_HASH_ALGO_SHA224`,function(){return pt}),n.d(t,`EU_CTX_HASH_ALGO_SHA256`,function(){return mt}),n.d(t,`EU_CTX_HASH_ALGO_SHA384`,function(){return ht}),n.d(t,`EU_CTX_HASH_ALGO_SHA512`,function(){return gt}),n.d(t,`EU_CTX_HASH_ALGO_DSTU7564_256`,function(){return _t}),n.d(t,`EU_CTX_HASH_ALGO_DSTU7564_384`,function(){return vt}),n.d(t,`EU_CTX_HASH_ALGO_DSTU7564_512`,function(){return yt}),n.d(t,`EndUserHashAlgo`,function(){return lt}),n.d(t,`EU_ASIC_TYPE_UNKNOWN`,function(){return xt}),n.d(t,`EU_ASIC_TYPE_S`,function(){return St}),n.d(t,`EU_ASIC_TYPE_E`,function(){return Ct}),n.d(t,`EndUserASiCType`,function(){return bt}),n.d(t,`EU_ASIC_SIGN_TYPE_UNKNOWN`,function(){return Tt}),n.d(t,`EU_ASIC_SIGN_TYPE_CADES`,function(){return Et}),n.d(t,`EU_ASIC_SIGN_TYPE_XADES`,function(){return Dt}),n.d(t,`EndUserASiCSignType`,function(){return wt}),n.d(t,`EU_XADES_TYPE_UNKNOWN`,function(){return kt}),n.d(t,`EU_XADES_TYPE_DETACHED`,function(){return At}),n.d(t,`EU_XADES_TYPE_ENVELOPING`,function(){return jt}),n.d(t,`EU_XADES_TYPE_ENVELOPED`,function(){return Mt}),n.d(t,`EndUserXAdESType`,function(){return Ot}),n.d(t,`EU_XADES_SIGN_LEVEL_UNKNOWN`,function(){return Pt}),n.d(t,`EU_XADES_SIGN_LEVEL_B_B`,function(){return Ft}),n.d(t,`EU_XADES_SIGN_LEVEL_B_T`,function(){return It}),n.d(t,`EU_XADES_SIGN_LEVEL_B_LT`,function(){return Lt}),n.d(t,`EU_XADES_SIGN_LEVEL_B_LTA`,function(){return Rt}),n.d(t,`EndUserXAdESSignLevel`,function(){return Nt}),n.d(t,`EU_PADES_SIGN_LEVEL_UNKNOWN`,function(){return Vt}),n.d(t,`EU_PADES_SIGN_LEVEL_B_B`,function(){return Ht}),n.d(t,`EU_PADES_SIGN_LEVEL_B_T`,function(){return Ut}),n.d(t,`EU_PADES_SIGN_LEVEL_B_LT`,function(){return Wt}),n.d(t,`EU_PADES_SIGN_LEVEL_B_LTA`,function(){return Gt}),n.d(t,`EndUserPAdESSignLevel`,function(){return zt}),n.d(t,`EndUserEventType`,function(){return Bt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_UNKNOWN`,function(){return qt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_CADES`,function(){return Jt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_XADES`,function(){return Yt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_PADES`,function(){return Xt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_ASIC`,function(){return Zt}),n.d(t,`EndUserSignContainerType`,function(){return Kt});var r,i=1,a=2,o=3;(function(e){e[e.JS=i]=`JS`,e[e.SW=a]=`SW`,e[e.MS=o]=`MS`})(r||={});var s,c=0,l=1,u=2,d=3,f=4;(function(e){e[e.Undifferenced=c]=`Undifferenced`,e[e.CA=l]=`CA`,e[e.CAServer=u]=`CAServer`,e[e.RAAdministrator=d]=`RAAdministrator`,e[e.EndUser=f]=`EndUser`})(s||={});var p,m=0,h=1,g=2,_=3;(function(e){e[e.Undifferenced=m]=`Undifferenced`,e[e.CMP=h]=`CMP`,e[e.TSP=g]=`TSP`,e[e.OCSP=_]=`OCSP`})(p||={});var v,y=0,b=1,x=2,S=4;(function(e){e[e.Unknown=y]=`Unknown`,e[e.DSTU4145=b]=`DSTU4145`,e[e.RSA=x]=`RSA`,e[e.ECDSA=S]=`ECDSA`})(v||={});var C,w=0,T=1,E=2,D=3,O=4,k=5,A=6,j=7,M=8,N=9;(function(e){e[e.Unknown=w]=`Unknown`,e[e.GOST34311=T]=`GOST34311`,e[e.SHA1=E]=`SHA1`,e[e.SHA224=D]=`SHA224`,e[e.SHA256=O]=`SHA256`,e[e.SHA384=k]=`SHA384`,e[e.SHA512=A]=`SHA512`,e[e.DSTU7564_256=j]=`DSTU7564_256`,e[e.DSTU7564_384=M]=`DSTU7564_384`,e[e.DSTU7564_512=N]=`DSTU7564_512`})(C||={});var P,F=0,I=1,L=2,R=16;(function(e){e[e.Unknown=y]=`Unknown`,e[e.DigitalSignature=I]=`DigitalSignature`,e[e.NonRepudation=L]=`NonRepudation`,e[e.KeyAgreement=R]=`KeyAgreement`})(P||={});var z,B=1,V=2;(function(e){e[e.Revoke=B]=`Revoke`,e[e.Hold=V]=`Hold`})(z||={});var H,ee=0,U=1,W=2;(function(e){e[e.Unknown=ee]=`Unknown`,e[e.KeyCompromise=U]=`KeyCompromise`,e[e.NewIssued=W]=`NewIssued`})(H||={});var G,K=0,q=1,J=2,te=4,ne=8;(function(e){e[e.None=K]=`None`,e[e.DSTUAndECDHWithGOST=q]=`DSTUAndECDHWithGOST`,e[e.RSAWithSHA=J]=`RSAWithSHA`,e[e.ECDSAWithSHA=te]=`ECDSAWithSHA`,e[e.DSTUAndECDHWithDSTU=ne]=`DSTUAndECDHWithDSTU`})(G||={});var Y,re=1,ie=2,X=3,Z=4,Q=5;(function(e){e[e.EC_191=re]=`EC_191`,e[e.EC_257=ie]=`EC_257`,e[e.EC_307=X]=`EC_307`,e[e.File=Z]=`File`,e[e.Cert=Q]=`Cert`})(Y||={});var $,ae=1,oe=2,se=3,ce=4,le=5;(function(e){e[e.EC_257=ae]=`EC_257`,e[e.EC_431=oe]=`EC_431`,e[e.EC_571=se]=`EC_571`,e[e.File=Z]=`File`,e[e.Cert=Q]=`Cert`})($||={});var ue,de=1,fe=2,pe=3,me=4,he=5,ge=6;(function(e){e[e.N_1024=de]=`N_1024`,e[e.N_2048=fe]=`N_2048`,e[e.N_3072=pe]=`N_3072`,e[e.N_4096=me]=`N_4096`,e[e.File=Z]=`File`,e[e.Cert=Q]=`Cert`})(ue||={});var _e,ve=1,ye=2,be=3,xe=4,Se=5,Ce=6;(function(e){e[e.EC_192=ve]=`EC_192`,e[e.EC_256=ye]=`EC_256`,e[e.EC_384=be]=`EC_384`,e[e.EC_521=xe]=`EC_521`,e[e.File=Se]=`File`,e[e.Cert=Ce]=`Cert`})(_e||={});var we,Te=1,Ee=2,De=3;(function(e){e[e.uaDS=Te]=`uaDS`,e[e.uaKEP=Ee]=`uaKEP`,e[e.intRSA=De]=`intRSA`})(we||={});var Oe,ke=1,Ae=2,je=3;(function(e){e[e.Kyivstar=ke]=`Kyivstar`,e[e.Vodafone=Ae]=`Vodafone`,e[e.Lifecell=je]=`Lifecell`})(Oe||={});var Me,Ne,Pe=4,Fe=5,Ie=6,Le=7;(function(e){e[e.Kyivstar=ke]=`Kyivstar`,e[e.Vodafone=Ae]=`Vodafone`,e[e.Lifecell=je]=`Lifecell`,e[e.IIT=Pe]=`IIT`,e[e.UKey=Fe]=`UKey`,e[e.PB=Ie]=`PB`,e[e.DIIA=Le]=`DIIA`})(Me||={}),function(e){e[e.Default=0]=`Default`,e[e.Name=1]=`Name`,e[e.Phone=2]=`Phone`,e[e.Email=3]=`Email`}(Ne||={});var Re,ze=0,Be=1,Ve=4,He=8,Ue=16,We=128;(function(e){e[e.Unknown=ze]=`Unknown`,e[e.CAdES_BES=Be]=`CAdES_BES`,e[e.CAdES_T=Ve]=`CAdES_T`,e[e.CAdES_C=He]=`CAdES_C`,e[e.CAdES_X_Long=Ue]=`CAdES_X_Long`,e[e.CAdES_X_Long_Trusted=We]=`CAdES_X_Long_Trusted`})(Re||={});var Ge,Ke=0,qe=1,Je=3;(function(e){e[e.Unknown=Ke]=`Unknown`,e[e.Detached=qe]=`Detached`,e[e.Enveloped=Je]=`Enveloped`})(Ge||={});var Ye,Xe=0,Ze=1,Qe=2,$e=3,et=4;(function(e){e[e.Unknown=Xe]=`Unknown`,e[e.DSTU4145WithGOST34311=Ze]=`DSTU4145WithGOST34311`,e[e.RSAWithSHA=Qe]=`RSAWithSHA`,e[e.ECDSAWithSHA=$e]=`ECDSAWithSHA`,e[e.DSTU4145WithDSTU7564=et]=`DSTU4145WithDSTU7564`})(Ye||={});var tt,nt=`SignType`,rt=`UseSLoginPrivateKey`,it=`FSCalculateFingerprint`,at=`CheckPrivateKey`,ot=`UseSLoginPrivateKey`,st=`1.2.804.2.1.1.1.3.9`,ct=3;(function(e){e[e.None=0]=`None`,e[e.DownloadEUCerts=1]=`DownloadEUCerts`,e[e.SearchEUCerts=2]=`SearchEUCerts`})(tt||={});var lt,ut=0,dt=1,ft=2,pt=3,mt=4,ht=5,gt=6,_t=7,vt=8,yt=9;(function(e){e[e.Unknown=ut]=`Unknown`,e[e.GOST34311=dt]=`GOST34311`,e[e.SHA160=ft]=`SHA160`,e[e.SHA224=pt]=`SHA224`,e[e.SHA256=mt]=`SHA256`,e[e.SHA384=ht]=`SHA384`,e[e.SHA512=gt]=`SHA512`,e[e.DSTU7564_256=_t]=`DSTU7564_256`,e[e.DSTU7564_384=vt]=`DSTU7564_384`,e[e.DSTU7564_512=yt]=`DSTU7564_512`})(lt||={});var bt,xt=0,St=1,Ct=2;(function(e){e[e.Unknown=xt]=`Unknown`,e[e.S=St]=`S`,e[e.E=Ct]=`E`})(bt||={});var wt,Tt=0,Et=1,Dt=2;(function(e){e[e.Unknown=Tt]=`Unknown`,e[e.CAdES=Et]=`CAdES`,e[e.XAdES=Dt]=`XAdES`})(wt||={});var Ot,kt=0,At=1,jt=2,Mt=3;(function(e){e[e.Unknown=kt]=`Unknown`,e[e.Detached=At]=`Detached`,e[e.Enveloping=jt]=`Enveloping`,e[e.Enveloped=Mt]=`Enveloped`})(Ot||={});var Nt,Pt=0,Ft=1,It=4,Lt=16,Rt=32;(function(e){e[e.Unknown=Pt]=`Unknown`,e[e.B_B=Ft]=`B_B`,e[e.B_T=It]=`B_T`,e[e.B_LT=Lt]=`B_LT`,e[e.B_LTA=Rt]=`B_LTA`})(Nt||={});var zt,Bt,Vt=0,Ht=1,Ut=4,Wt=16,Gt=32;(function(e){e[e.Unknown=Pt]=`Unknown`,e[e.B_B=Ht]=`B_B`,e[e.B_T=Ut]=`B_T`,e[e.B_LT=Wt]=`B_LT`,e[e.B_LTA=Gt]=`B_LTA`})(zt||={}),function(e){e[e.None=0]=`None`,e[e.All=1]=`All`,e[e.ConfirmKSPOperation=2]=`ConfirmKSPOperation`}(Bt||={});var Kt,qt=0,Jt=1,Yt=2,Xt=3,Zt=4;(function(e){e[e.Unknown=qt]=`Unknown`,e[e.CAdES=Jt]=`CAdES`,e[e.XAdES=Yt]=`XAdES`,e[e.PAdES=Xt]=`PAdES`,e[e.ASiC=Zt]=`ASiC`})(Kt||={})},function(e,t,n){"use strict";n.r(t),n.d(t,`EU_ERROR_NONE`,function(){return r}),n.d(t,`EU_ERROR_UNKNOWN`,function(){return i}),n.d(t,`EU_ERROR_NOT_SUPPORTED`,function(){return a}),n.d(t,`EU_ERROR_NOT_INITIALIZED`,function(){return o}),n.d(t,`EU_ERROR_BAD_PARAMETER`,function(){return s}),n.d(t,`EU_ERROR_LIBRARY_LOAD`,function(){return c}),n.d(t,`EU_ERROR_READ_SETTINGS`,function(){return l}),n.d(t,`EU_ERROR_TRANSMIT_REQUEST`,function(){return u}),n.d(t,`EU_ERROR_MEMORY_ALLOCATION`,function(){return d}),n.d(t,`EU_WARNING_END_OF_ENUM`,function(){return f}),n.d(t,`EU_ERROR_PROXY_NOT_AUTHORIZED`,function(){return p}),n.d(t,`EU_ERROR_NO_GUI_DIALOGS`,function(){return m}),n.d(t,`EU_ERROR_DOWNLOAD_FILE`,function(){return h}),n.d(t,`EU_ERROR_WRITE_SETTINGS`,function(){return g}),n.d(t,`EU_ERROR_CANCELED_BY_GUI`,function(){return _}),n.d(t,`EU_ERROR_OFFLINE_MODE`,function(){return v}),n.d(t,`EU_ERROR_KEY_MEDIAS_FAILED`,function(){return y}),n.d(t,`EU_ERROR_KEY_MEDIAS_ACCESS_FAILED`,function(){return b}),n.d(t,`EU_ERROR_KEY_MEDIAS_READ_FAILED`,function(){return x}),n.d(t,`EU_ERROR_KEY_MEDIAS_WRITE_FAILED`,function(){return S}),n.d(t,`EU_WARNING_KEY_MEDIAS_READ_ONLY`,function(){return C}),n.d(t,`EU_ERROR_KEY_MEDIAS_DELETE`,function(){return w}),n.d(t,`EU_ERROR_KEY_MEDIAS_CLEAR`,function(){return T}),n.d(t,`EU_ERROR_BAD_PRIVATE_KEY`,function(){return E}),n.d(t,`EU_ERROR_PKI_FORMATS_FAILED`,function(){return D}),n.d(t,`EU_ERROR_CSP_FAILED`,function(){return O}),n.d(t,`EU_ERROR_BAD_SIGNATURE`,function(){return k}),n.d(t,`EU_ERROR_AUTH_FAILED`,function(){return A}),n.d(t,`EU_ERROR_NOT_RECEIVER`,function(){return j}),n.d(t,`EU_ERROR_STORAGE_FAILED`,function(){return M}),n.d(t,`EU_ERROR_BAD_CERT`,function(){return N}),n.d(t,`EU_ERROR_CERT_NOT_FOUND`,function(){return P}),n.d(t,`EU_ERROR_INVALID_CERT_TIME`,function(){return F}),n.d(t,`EU_ERROR_CERT_IN_CRL`,function(){return I}),n.d(t,`EU_ERROR_BAD_CRL`,function(){return L}),n.d(t,`EU_ERROR_NO_VALID_CRLS`,function(){return R}),n.d(t,`EU_ERROR_GET_TIME_STAMP`,function(){return z}),n.d(t,`EU_ERROR_BAD_TSP_RESPONSE`,function(){return B}),n.d(t,`EU_ERROR_TSP_SERVER_CERT_NOT_FOUND`,function(){return V}),n.d(t,`EU_ERROR_TSP_SERVER_CERT_INVALID`,function(){return H}),n.d(t,`EU_ERROR_GET_OCSP_STATUS`,function(){return ee}),n.d(t,`EU_ERROR_BAD_OCSP_RESPONSE`,function(){return U}),n.d(t,`EU_ERROR_CERT_BAD_BY_OCSP`,function(){return W}),n.d(t,`EU_ERROR_OCSP_SERVER_CERT_NOT_FOUND`,function(){return G}),n.d(t,`EU_ERROR_OCSP_SERVER_CERT_INVALID`,function(){return K}),n.d(t,`EU_ERROR_LDAP_ERROR`,function(){return q}),n.d(t,`EndUserError`,function(){return J});var r=0,i=65535,a=65534,o=1,s=2,c=3,l=4,u=5,d=6,f=7,p=8,m=9,h=10,g=11,_=12,v=13,y=17,b=18,x=19,S=20,C=21,w=22,T=23,E=24,D=33,O=34,k=35,A=36,j=37,M=49,N=50,P=51,F=52,I=53,L=54,R=55,z=65,B=66,V=67,H=68,ee=81,U=82,W=83,G=84,K=85,q=97,J=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return o});var r=n(8),i=n(10),a=n(4),o=function(){function e(){}return e.MapFromKeyMedia=function(e,t){return t.SetTypeIndex(e.typeIndex),t.SetDevIndex(e.devIndex),t.SetPassword(e.user?`##`+e.user+`##`+e.password:e.password),t},e.MapToProxySettings=function(e,t){return t.useProxy=e.GetUseProxy(),t.address=e.GetAddress(),t.port=e.GetPort(),t.anonymous=e.GetAnonymous(),t.user=e.GetUser(),t.password=e.GetPassword(),t.savePassword=e.GetSavePassword(),t},e.MapFromProxySettings=function(e,t){return t.SetUseProxy(e.useProxy),t.SetAddress(e.address),t.SetPort(e.port),t.SetAnonymous(e.anonymous),t.SetUser(e.user),t.SetPassword(e.password),t.SetSavePassword(e.savePassword),t},e.MapEndUserOwnerInfo=function(e,t){return t.isFilled=e.IsFilled(),t.issuer=e.GetIssuer(),t.issuerCN=e.GetIssuerCN(),t.serial=e.GetSerial(),t.subject=e.GetSubject(),t.subjCN=e.GetSubjCN(),t.subjOrg=e.GetSubjOrg(),t.subjOrgUnit=e.GetSubjOrgUnit(),t.subjTitle=e.GetSubjTitle(),t.subjState=e.GetSubjState(),t.subjLocality=e.GetSubjLocality(),t.subjFullName=e.GetSubjFullName(),t.subjAddress=e.GetSubjAddress(),t.subjPhone=e.GetSubjPhone(),t.subjEMail=e.GetSubjEMail(),t.subjDNS=e.GetSubjDNS(),t.subjEDRPOUCode=e.GetSubjEDRPOUCode(),t.subjDRFOCode=e.GetSubjDRFOCode(),t},e.MapToEndUserCertificateInfoEx=function(e,t){return t.isFilled=e.IsFilled(),t.version=e.GetVersion(),t.issuer=e.GetIssuer(),t.issuerCN=e.GetIssuerCN(),t.serial=e.GetSerial(),t.subject=e.GetSubject(),t.subjCN=e.GetSubjCN(),t.subjOrg=e.GetSubjOrg(),t.subjOrgUnit=e.GetSubjOrgUnit(),t.subjTitle=e.GetSubjTitle(),t.subjState=e.GetSubjState(),t.subjLocality=e.GetSubjLocality(),t.subjFullName=e.GetSubjFullName(),t.subjAddress=e.GetSubjAddress(),t.subjPhone=e.GetSubjPhone(),t.subjEMail=e.GetSubjEMail(),t.subjDNS=e.GetSubjDNS(),t.subjEDRPOUCode=e.GetSubjEDRPOUCode(),t.subjDRFOCode=e.GetSubjDRFOCode(),t.subjNBUCode=e.GetSubjNBUCode(),t.subjSPFMCode=e.GetSubjSPFMCode(),t.subjOCode=e.GetSubjOCode(),t.subjOUCode=e.GetSubjOUCode(),t.subjUserCode=e.GetSubjUserCode(),t.certBeginTime=e.GetCertBeginTime(),t.certEndTime=e.GetCertEndTime(),t.isPrivKeyTimesAvail=e.IsPrivKeyTimesAvail(),t.privKeyBeginTime=e.GetPrivKeyBeginTime(),t.privKeyEndTime=e.GetPrivKeyEndTime(),t.publicKeyBits=e.GetPublicKeyBits(),t.publicKey=e.GetPublicKey(),t.publicKeyID=e.GetPublicKeyID(),t.issuerPublicKeyID=e.GetIssuerPublicKeyID(),t.keyUsage=e.GetKeyUsage(),t.extKeyUsages=e.GetExtKeyUsages(),t.policies=e.GetPolicies(),t.crlDistribPoint1=e.GetCRLDistribPoint1(),t.crlDistribPoint2=e.GetCRLDistribPoint2(),t.isPowerCert=e.IsPowerCert(),t.isSubjTypeAvail=e.IsSubjTypeAvail(),t.isSubjCA=e.IsSubjCA(),t.chainLength=e.GetChainLength(),t.UPN=e.GetUPN(),t.publicKeyType=e.GetPublicKeyType(),t.keyUsageType=e.GetKeyUsageType(),t.RSAModul=e.GetRSAModul(),t.RSAExponent=e.GetRSAExponent(),t.OCSPAccessInfo=e.GetOCSPAccessInfo(),t.issuerAccessInfo=e.GetIssuerAccessInfo(),t.TSPAccessInfo=e.GetTSPAccessInfo(),t.isLimitValueAvailable=e.IsLimitValueAvail(),t.limitValue=e.GetLimitValue(),t.limitValueCurrency=e.GetLimitValueCurrency(),t.subjType=e.GetSubjType(),t.subjSubType=e.GetSubjSubType(),t.subjUNZR=e.GetSubjUNZR(),t.subjCountry=e.GetSubjCountry(),t.fingerprint=e.GetFingerprint(),t.isQSCD=e.IsQSCD(),t.subjUserID=e.GetSubjUserID(),t.certHashType=e.GetCertHashType(),t},e.MapToEndUserParams=function(e,t){return t.SN=e.GetSN(),t.commonName=e.GetCommonName(),t.locality=e.GetLocality(),t.state=e.GetState(),t.organization=e.GetOrganization(),t.orgUnit=e.GetOrgUnit(),t.title=e.GetTitle(),t.street=e.GetStreet(),t.phone=e.GetPhone(),t.surname=e.GetSurname(),t.givenname=e.GetGivenname(),t.EMail=e.GetEMail(),t.DNS=e.GetDNS(),t.EDRPOUCode=e.GetEDRPOUCode(),t.DRFOCode=e.GetDRFOCode(),t.NBUCode=e.GetNBUCode(),t.SPFMCode=e.GetSPFMCode(),t.information=e.GetInformation(),t.passPhrase=e.GetPassPhrase(),t.isPublishCertificate=e.GetIsPublishCertificate(),t.RAAdminSN=e.GetRAAdminSN(),t},e.MapToEndUserTimeInfo=function(e,t){return t.version=e.GetVersion(),t.isTimeAvail=e.IsTimeAvail(),t.isTimeStamp=e.IsTimeStamp(),t.time=e.GetTime(),t.isSignTimeStampAvail=e.IsSignTimeStampAvail(),t.signTimeStamp=e.GetSignTimeStamp(),t},e.MapToEndUserSignInfo=function(t,n){return n.ownerInfo=e.MapEndUserOwnerInfo(t.GetOwnerInfo(),new i.a),n.timeInfo=e.MapToEndUserTimeInfo(t.GetTimeInfo(),new a.EndUserTimeInfo),n.data=t.GetData(),n.signLevel=0,n},e.MapToEndUserSenderInfo=function(t,n){return n.ownerInfo=e.MapEndUserOwnerInfo(t.GetOwnerInfo(),new i.a),n.timeInfo=e.MapToEndUserTimeInfo(t.GetTimeInfo(),new a.EndUserTimeInfo),n.data=t.GetData(),n},e.MapToEndUserCertificate=function(t,n){return n.data=t.GetData(),n.infoEx=e.MapToEndUserCertificateInfoEx(t.GetInfoEx(),new r.a),n},e.MapFromEndUserInfo=function(e,t){return t.SetCommonName(e.commonName),t.SetLocality(e.locality),t.SetState(e.state),t.SetOrganization(e.organization),t.SetOrgUnit(e.orgUnit),t.SetTitle(e.title),t.SetStreet(e.street),t.SetPhone(e.phone),t.SetSurname(e.surname),t.SetGivenname(e.givenname),t.SetEMail(e.EMail),t.SetDNS(e.DNS),t.SetEDRPOUCode(e.EDRPOUCode),t.SetDRFOCode(e.DRFOCode),t.SetNBUCode(e.NBUCode),t.SetSPFMCode(e.SPFMCode),t.SetOCode(e.OCode),t.SetOUCode(e.OUCode),t.SetUserCode(e.userCode),t.SetUPN(e.UPN),t.SetUNZR(e.UNZR),t.SetCountry(e.country),t},e.MapToEndUserRequestInfo=function(e,t){return t.isFilled=!0,t.data=e.GetRequest(),t.type=e.GetRequestType(),t.fileName=e.GetDefaultRequestFileName(),t.isSimple=e.IsSimple(),t.subject=e.GetSubject(),t.subjCN=e.GetSubjCN(),t.subjOrg=e.GetSubjOrg(),t.subjOrgUnit=e.GetSubjOrgUnit(),t.subjTitle=e.GetSubjTitle(),t.subjState=e.GetSubjState(),t.subjLocality=e.GetSubjLocality(),t.subjFullName=e.GetSubjFullName(),t.subjAddress=e.GetSubjAddress(),t.subjPhone=e.GetSubjPhone(),t.subjEMail=e.GetSubjEMail(),t.subjDNS=e.GetSubjDNS(),t.subjEDRPOUCode=e.GetSubjEDRPOUCode(),t.subjDRFOCode=e.GetSubjDRFOCode(),t.subjNBUCode=e.GetSubjNBUCode(),t.subjSPFMCode=e.GetSubjSPFMCode(),t.subjOCode=e.GetSubjOCode(),t.subjOUCode=e.GetSubjOUCode(),t.subjUserCode=e.GetSubjUserCode(),t.certBeginTime=e.GetCertBeginTime(),t.certEndTime=e.GetCertEndTime(),t.isPrivKeyTimesAvail=e.IsPrivKeyTimesAvail(),t.privKeyBeginTime=e.GetPrivKeyBeginTime(),t.privKeyEndTime=e.GetPrivKeyEndTime(),t.publicKeyType=e.GetPublicKeyType(),t.publicKeyBits=e.GetPublicKeyBits(),t.RSAModul=e.GetRSAModul(),t.RSAExponent=e.GetRSAExponent(),t.publicKey=e.GetPublicKey(),t.publicKeyID=e.GetPublicKeyID(),t.extKeyUsages=e.GetExtKeyUsages(),t.crlDistribPoint1=e.GetCRLDistribPoint1(),t.crlDistribPoint2=e.GetCRLDistribPoint2(),t.isSubjTypeAvail=e.IsSubjTypeAvail(),t.subjType=e.GetSubjType(),t.subjSubType=e.GetSubjSubType(),t.isSelfSigned=e.IsSelfSigned(),t.signIssuer=e.GetSignIssuer(),t.signSerial=e.GetSignSerial(),t.subjUNZR=e.GetSubjUNZR(),t.subjCountry=e.GetSubjCountry(),t.isQSCD=e.IsQSCD(),t},e.MapToEndUserReference=function(e,t){return t.name=e.GetName(),t.val=e.GetData(),t},e.MapFromEndUserReference=function(e,t){return t.SetName(e.name),t.SetData(e.val),t},e.MapToEndUserSession=function(e,t){return t.handle=e.GetHandle(),t.data=e.GetData(),t},e.MapFromEndUserSession=function(e,t){return t.SetHandle(e.handle),t.SetData(e.data),t},e}()},function(e,t,n){var r,i=[],a;(a=typeof(r=function(){var e=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserUTF8Coder`};e.prototype.encode=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},e.prototype.decode=function(e){for(var t,n,r,i=[],a=0,o=0;a<e.length;)(t=e[a++])<128?i[o++]=String.fromCharCode(t):t>191&&t<224?(n=e[a++],i[o++]=String.fromCharCode((31&t)<<6|63&n)):(n=e[a++],r=e[a++],i[o++]=String.fromCharCode((15&t)<<12|(63&n)<<6|63&r));return i.join(``)};var t=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserUTF16LECoder`};t.prototype.encode=function(e){for(var t,n=[],r=0;r<e.length;r++)t=e.charCodeAt(r),n.push(255&t),n.push((65280&t)>>8);return n},t.prototype.decode=function(e){var t,n=0,r=``;if(e.length%2!=0)return null;for((t=e.length)>0&&e[t-2]==0&&e[t-1]==0&&(t-=2);n<t;)r+=String.fromCharCode(e[n]|e[n+1]<<8),n+=2;return r};var n=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserCP1251Coder`,this.m_cp1251_table={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,10:10,11:11,12:12,13:13,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},this.m_ut8_table=unescape(`%u0402%u0403%u201A%u0453%u201E%u2026%u2020%u2021%u20AC%u2030%u0409%u2039%u040A%u040C%u040B%u040F%u0452%u2018%u2019%u201C%u201D%u2022%u2013%u2014%u0000%u2122%u0459%u203A%u045A%u045C%u045B%u045F%u00A0%u040E%u045E%u0408%u00A4%u0490%u00A6%u00A7%u0401%u00A9%u0404%u00AB%u00AC%u00AD%u00AE%u0407%u00B0%u00B1%u0406%u0456%u0491%u00B5%u00B6%u00B7%u0451%u2116%u0454%u00BB%u0458%u0405%u0455%u0457`)};n.prototype.encode=function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(!(r in this.m_cp1251_table))throw`Character `+e.charAt(n)+` isn't supported by win1251!`;t.push(this.m_cp1251_table[r])}return t},n.prototype.decode=function(e){for(var t,n=``,r=0;r<e.length;r++)n+=(t=e[r])>=192&&t<=255?String.fromCharCode(t-192+1040):t>=128&&t<=191?this.m_ut8_table.charAt(t-128):String.fromCharCode(t);return n};var r={GetCoder:function(r){switch(r=r.toUpperCase()){case`UTF-8`:return new e;case`UTF-16LE`:return new t;case`WINDOWS-1251`:return new n;default:return null}},ArrayToString:function(e,t){var n,i;if(e===void 0&&(e=`UTF-8`),(n=r.GetCoder(e))==null)throw new Q(i=Z.ERROR_BAD_PARAMETER,Z.getErrorDescriptionEx(i,0));return n.decode(t)}},i=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserDateCoder`,this.dateDelimeter=`.`,this.timeDelimeter=`:`,this.dateTimeDelimeter=` `,this.format=`dd.MM.yyyy HH:mm:ss`};i.prototype.encode=function(e){var t=e.getDate(),n=e.getMonth()+1,r=e.getFullYear(),i=e.getHours(),a=e.getMinutes(),o=e.getSeconds();return t+this.dateDelimeter+n+this.dateDelimeter+r+this.dateTimeDelimeter+i+this.timeDelimeter+a+this.timeDelimeter+o},i.prototype.decode=function(e){try{var t=e.split(this.dateTimeDelimeter),n=t[0].split(this.dateDelimeter),r=t[1].split(this.timeDelimeter),i=parseInt(n[0]),a=parseInt(n[1])-1,o=parseInt(n[2]);if(i<0||i>31||a<0||a>12||o<0)return null;var s=parseInt(r[0]),c=parseInt(r[1]),l=parseInt(r[2]);return s<0||s>23||c<0||c>59||l<0||l>59?null:new Date(o,a,i,s,c,l,0)}catch{return null}};var a=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserBase64Coder`,this.m_map=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,this.m_codes=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47]};a.prototype._getTextDecoder=function(){try{if(typeof TextDecoder>`u`)return null;var e=new TextDecoder(`utf-8`);return e.encoding==`utf-8`?e:null}catch{return null}},a.prototype._encodePart=function(e,t,n){for(var r,i,a=[],o=t;o<n;o+=3)r=e[o]<<16|e[o+1]<<8|e[o+2],i=this.m_map[r>>18&63]+this.m_map[r>>12&63]+this.m_map[r>>6&63]+this.m_map[63&r],a.push(i);return a.join(``)},a.prototype.encode=function(e){var t,n,r,i,a,o,s=``;if((a=(t=typeof Uint8Array>`u`?p===void 0?e.slice(0):new p(e):new Uint8Array(e)).length)==0)return``;var c=this._getTextDecoder();if(c!=null){for(o=new Uint8Array(4*parseInt((a+2)/3)),n=0,r=0;n<a-a%3;n+=3,r+=4)i=t[n]<<16|t[n+1]<<8|t[n+2],o[r]=this.m_codes[i>>18&63],o[r+1]=this.m_codes[i>>12&63],o[r+2]=this.m_codes[i>>6&63],o[r+3]=this.m_codes[63&i];switch(a%3){case 1:i=t[n]<<16,o[r]=this.m_codes[i>>18&63],o[r+1]=this.m_codes[i>>12&63],o[r+2]=61,o[r+3]=61;break;case 2:i=t[n]<<16|t[n+1]<<8,o[r]=this.m_codes[i>>18&63],o[r+1]=this.m_codes[i>>12&63],o[r+2]=this.m_codes[i>>6&63],o[r+3]=61}s=c.decode(o)}else{var l,u=null,d=a-a%3,f=parseInt(d/15360);for(o=[],n=0;n<f;n++)u=this._encodePart(t,15360*n,15360*n+15360),o.push(u);switch(15360*f<d&&(u=this._encodePart(t,15360*n,d),o.push(u)),a%3){case 1:i=t[a-1]<<16,l=this.m_map[i>>18&63],l+=this.m_map[i>>12&63],l+=`=`,l+=`=`,o.push(l);break;case 2:i=t[a-2]<<16|t[a-1]<<8,l=this.m_map[i>>18&63],l+=this.m_map[i>>12&63],l+=this.m_map[i>>6&63],l+=`=`,o.push(l)}s=o.join(``)}return s},a.prototype.decode=function(e){var t,n,r,i,a,o,s,c,l,u,d;if(e==``||(3&e.length)>0)return typeof Uint8Array>`u`?p===void 0?[]:new p(0):new Uint8Array;for(n=(o=e.length)/4*3-(s=e[o-1]==`=`?e[o-2]==`=`?2:1:0),t=typeof Uint8Array>`u`?p===void 0?[]:new p(n):new Uint8Array(n),r=0,i=0,a=0;r<Math.floor((o-s)/4);r++)c=this.m_map.indexOf(e[i++]),l=this.m_map.indexOf(e[i++]),u=this.m_map.indexOf(e[i++]),d=this.m_map.indexOf(e[i++]),t[a++]=c<<2|l>>4,t[a++]=(15&l)<<4|u>>2,t[a++]=(3&u)<<6|63&d;switch(s){case 2:c=this.m_map.indexOf(e[i]),l=this.m_map.indexOf(e[i+1]),t[a++]=c<<2|l>>4;break;case 1:c=this.m_map.indexOf(e[i]),l=this.m_map.indexOf(e[i+1]),u=this.m_map.indexOf(e[i+2]),t[a++]=c<<2|l>>4,t[a++]=(15&l)<<4|u>>2}return t};var o=function(e){return new function(){var t=this,n=function(){var e;t.deferred.length&&((e=[].slice.call(arguments)).unshift(n),t.deferred[0].apply(t,e),t.deferred.shift())};this.deferred=[],this.eu_wait=function(e){return this.deferred.push(e),t},e(n)}},s=function(){var e=this._getBrowserInfo();this.m_name=e.name,this.m_version=e.version,this.m_arch=this._getArch(),this.m_os_name=this._getOSName()};s.BROWSER_NAME_IE=`IE`,s.BROWSER_NAME_OPERA=`Opera`,s.BROWSER_NAME_CHROME=`Chrome`,s.BROWSER_NAME_FIREFOX=`Firefox`,s.BROWSER_NAME_SAFARI=`Safari`,s.BROWSER_NAME_EDGE=`Edge`,s.BROWSER_NAME_EU_SIGN_AGENT=`EUSignAgent`,s.BROWSER_NAME_UNKNOWN=`Unknown`,s.OS_NAME_WINDOWS=`Windows`,s.OS_NAME_LINUX=`Linux`,s.OS_NAME_UNIX=`Unix`,s.OS_NAME_MAC=`Mac OS X`,s.OS_NAME_ANDROID=`Android`,s.OS_NAME_IOS=`iOS`,s.OS_NAME_UNKNOWN=`Unknown`,s.BROWSER_ARCH_NAME_X86=`x86`,s.BROWSER_ARCH_NAME_X64=`x64`,s.BROWSER_ARCH_NAME_ARM=`arm`,s.BROWSER_ARCH_NAME_UNKNOWN=`Unknown`,s.prototype._getBrowserInfo=function(){var e,t={name:s.BROWSER_NAME_UNKNOWN,version:``},n=navigator.userAgent,r=n.match(/(opera|chrome|safari|firefox|msie|trident|eusignagent(?=\/))\/?\s*(\d+)/i)||[];return/msie/i.test(r[1])||/trident/i.test(r[1])?(t.name=s.BROWSER_NAME_IE,/msie/i.test(r[1])?t.version=parseInt(r[2]):(e=/\brv[ :]+(\d+)/g.exec(n)||[],t.version=parseInt(e[1])),t):r[1]===`Chrome`&&(e=n.match(/\b(OPR|Edge)\/(\d+)/))!=null?(t.name=e[1].replace(`OPR`,s.BROWSER_NAME_OPERA),t.version=parseInt(e[2]),t):(r=r[2]?[r[1],r[2]]:[navigator.appName,navigator.appVersion,`-?`],(e=n.match(/version\/(\d+)/i))!=null&&r.splice(1,1,e[1]),t.name=r[0],t.version=parseInt(r[1]),t)},s.prototype._getOSName=function(){var e=navigator.platform||``,t=(navigator.userAgent||``).toLowerCase(),n=navigator.userAgentData||[];return e.indexOf(`Win`)==-1?e.indexOf(`iPad`)!=-1||e.indexOf(`iPhone`)!=-1||e.indexOf(`iPod`)!=-1||e.indexOf(`Android`)!=-1||t.includes(`Mac`)&&`ontouchend`in document?s.OS_NAME_IOS:e.indexOf(`Mac`)==-1?e.indexOf(`Android`)!=-1||t.indexOf(`android`)!=-1||n.platform==`Android`||e.indexOf(`Linux`)!=-1&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1?s.OS_NAME_ANDROID:e.indexOf(`Linux`)==-1?e.indexOf(`FreeBSD`)==-1?s.OS_NAME_UNKNOWN:s.OS_NAME_UNIX:s.OS_NAME_LINUX:s.OS_NAME_MAC:s.OS_NAME_WINDOWS},s.prototype._getArch=function(){var e,t=navigator.platform||``;switch(this._getOSName()){case s.OS_NAME_WINDOWS:e=t.indexOf(`Win32`)==-1?s.BROWSER_ARCH_NAME_X64:s.BROWSER_ARCH_NAME_X86;break;case s.OS_NAME_MAC:e=t.indexOf(`MacIntel`)==-1?s.BROWSER_ARCH_NAME_X64:s.BROWSER_ARCH_NAME_X86;break;case s.OS_NAME_IOS:e=s.BROWSER_ARCH_NAME_ARM;break;case s.OS_NAME_UNIX:case s.OS_NAME_LINUX:case s.OS_NAME_ANDROID:e=t.indexOf(`armv`)==-1?t.indexOf(`x86_64`)==-1?s.BROWSER_ARCH_NAME_X86:s.BROWSER_ARCH_NAME_X64:s.BROWSER_ARCH_NAME_ARM;break;default:e=s.BROWSER_ARCH_NAME_UNKNOWN}return e},s.prototype.GetName=function(){return this.m_name},s.prototype.GetVersion=function(){return this.m_version},s.prototype.GetArch=function(){return this.m_arch},s.prototype.GetOSName=function(){return this.m_os_name};var c=[];c[0]=`Executed successfully`,c[-1]=`Unknown error`,c[-32300]=`Transport error`,c[-32400]=`System error`,c[-32500]=`Application error`,c[-32510]=`Application error. Invalid session`,c[-32600]=`Server error. Invalid rpc. Not conforming to spec`,c[-32601]=`Server error. Requested method not found`,c[-32602]=`Server error. Invalid method parameters`,c[-32603]=`Server error. Internal rpc error`,c[-32700]=`Parse error. Not well formed`,c[-32701]=`Parse error. Unsupported encoding`,c[-32702]=`Parse error. Invalid character for encoding`;var l=function(e,t,n,r){switch(this.Vendor=`JSC IIT`,this.ClassVersion=`1.0.2`,this.ClassName=`JSONRPCClient`,this.m_type=e,this.m_log=!1,this._logFunction(`Initialize`,arguments,[`type`,`address`,`port`,`useHttps`]),e){case 2:this.m_uri=t,this.m_callbacks=[],this._registerOnExtensionRecieveEventHandler();break;case 3:case 4:this.m_uri=t,this.m_callbacks=[];break;default:this.m_uri=``,r&&t.indexOf(`https://`)?this.m_uri+=`https://`:t.indexOf(`http://`)!=0&&(this.m_uri+=`http://`),this.m_uri+=t+`:`+n}this.m_requests=0,this.m_session_id=this._loadSessionId()};l.prototype._logFunction=function(e,t,n){if(this.m_log){for(var r=`(`,i=0;i<t.length;i++)r+=n[i]+`: `+t[i].toString(),i!=t.length-1&&(r+=`, `);r+=`)`,this._log(e,r)}},l.prototype._log=function(e,t){this.m_log&&console.log(e+`: `+t)},l.prototype._loadSessionId=function(){try{var e=sessionStorage.getItem(this.ClassName+`session_id`);return e===void 0||e==null||e==``?null:e}catch{return null}},l.prototype._saveSessionId=function(e){try{sessionStorage.setItem(this.ClassName+`session_id`,e)}catch{}},l.prototype._removeSessionId=function(){try{sessionStorage.removeItem(this.ClassName+`session_id`)}catch{}},l.prototype.createXMLHttpRequest=function(){return typeof XMLHttpRequest>`u`&&(XMLHttpRequest=function(){try{return new ActiveXObject(`Msxml2.XMLHTTP.6.0`)}catch{}try{return new ActiveXObject(`Msxml2.XMLHTTP.3.0`)}catch{}try{return new ActiveXObject(`Msxml2.XMLHTTP`)}catch{}try{return new ActiveXObject(`Microsoft.XMLHTTP`)}catch{}throw c[-32300]}),new XMLHttpRequest},l.prototype.makeRequest=function(e,t,n){var r=null;try{(r={}).jsonrpc=`2.0`,r.id=n,r.method=e,r.params=t,r.session_id=this.m_session_id,r=JSON.stringify(r)}catch{}return r},l.prototype.verifyResponse=function(e,t){try{if(t.jsonrpc!=`2.0`)return!1;var n=t.error;if(n===void 0){if(t.id!=e||t.result===void 0)return!1}else if(n.code===void 0||n.message===void 0||n.code!=0)return!1;if(t.session_id!==void 0){if(this.m_session_id!=null&&t.session_id!=null){if(this.m_session_id!=t.session_id)return!1}else this.m_session_id=t.session_id,this._saveSessionId(this.m_session_id)}return!0}catch{return!1}},l.prototype.handleResponse=function(e,t){try{return t=JSON.parse(t),this.verifyResponse(e,t)?t:(this.m_session_id=null,this._removeSessionId(),null)}catch{return null}},l.prototype._sendHttp=function(e,t,n){var r,i,a=this;try{return(r=this.createXMLHttpRequest()).open(`POST`,this.m_uri,n!=null),r.setRequestHeader(`Content-Type`,`application/json-rpc`),n!=null&&(r.onload=function(){r.status==200?(i=a.handleResponse(t,r.response),n(i==null?null:i.result)):n(null)},r.onerror=function(){n(null)}),r.send(e),n==null?r.status!=200||(i=this.handleResponse(t,r.response))==null?null:i.result:void 0}catch{if(n==null)return null;n(null)}},l.prototype._registerOnExtensionRecieveEventHandler=function(){var e=this;window.addEventListener(`message`,function(t){if(t.data.sender==e.m_uri)try{var n=t.data.callback_id,r=e.m_callbacks[n-1];delete e.m_callbacks[n-1],e._logFunction(`_registerOnExtensionRecieveEventHandler`,[r.request_id,t.data.data],[`request_id`,`data`]);var i=e.handleResponse(r.request_id,t.data.data);if(i==null)return void r.callback(null);r.callback(i.result)}catch{}},!1)},l.prototype._sendExtension=function(e,t,n){var r=this;if(r._logFunction(`_sendExtension`,[arguments[0],arguments[1]],[`request`,`request_id`]),!n)throw`Synchronous calls for web extensions not supported`;if(document.getElementsByClassName(r.m_uri).length==1)try{var i={request_id:t,callback:n},a=r.m_callbacks.push(i),o={sender:r.ClassName,request:e,callback_id:a};window.postMessage(o,`*`)}catch{n(null)}else n(null)},l.prototype._getPluginObject=function(){try{for(var e=document.getElementsByTagName(`object`),t=0;t<e.length;t++){var n=e[t].classid;if(!n&&e[t].attributes&&e[t].attributes.classid&&(n=e[t].attributes.classid.value),n===this.m_uri)return e[t]}return null}catch{return null}},l.prototype._sendPlugin=function(e,t,n){var i,o=this;o._logFunction(`_sendPlugin`,[arguments[0],arguments[1]],[`request`,`request_id`]);var s=o._getPluginObject();if(s==null)return n?.(null),null;var c=function(e){try{for(var t=new a,n=new p(0);;){var i=s.ProcessData(e),o=i.slice(0,5),c=i.slice(5,i.length-1);if(c!=null||c!=``){var l=t.decode(c),u=new p(n.length+l.length);u.set(n),u.set(l,n.length),n=u}switch(o){case`"part`:e=`"next"`;continue;case`"last`:return r.ArrayToString(`UTF-8`,n);default:return null}}}catch{return null}};try{return n==null?(i=c(e),(i=o.handleResponse(t,i))==null?null:i.result):void setTimeout(function(){i=c(e),o._logFunction(`_sendPlugin`,[t,i],[`request_id`,`response`]),(i=o.handleResponse(t,i))==null?n(null):n(i.result)},1)}catch{n(null)}},l.prototype.send=function(e,t,n){switch(this.m_type){case 1:return this._sendHttp(e,t,n);case 2:return this._sendExtension(e,t,n);case 3:case 4:return this._sendPlugin(e,t,n)}},l.prototype.execute=function(e,t,n){var r,i;return r=this.m_requests,this.m_requests++,(i=this.makeRequest(e,t,r))==null?n==null?null:void n(null):n==null?this.send(i,r,n):void this.send(i,r,n)};var u=function(){};u.WEB_LIBRARY_OS_NOT_SUPPORTED=131072,u.WEB_LIBRARY_NOT_INSTALLED_OR_RUN=131073,u.WEB_LIBRARY_JAVA_APPLET_NOT_LOADED=131074,u.WEB_LIBRARY_INSTALLED_VERSION_NOT_SUPPORTED=131075,u.WEB_LIBRARY_INSTALL_PACKAGE=131076,u.WEB_LIBRARY_UPDATE_PACKAGE=131077,u.WEB_LIBRARY_USER_MANUAL=131078,u.WEB_LIBRARY_WEB_EXTENSION_INSTALL_PACKAGE=131079,u.WEB_LIBRARY_CHECK_JRE_VERSION=131080,u.WEB_LIBRARY_WEB_EXTENSION_NOT_INSTALLED_OR_RUN=131081,(u.DESCRIPTIONS=[])[u.WEB_LIBRARY_OS_NOT_SUPPORTED]=[`Інсталяційний пакет web-бібліотеки підпису для вашої системи відсутній`,`Инсталяционный пакет web-библиотеки подписи для вашей системы отсутствует`,`The installation package of the library for the web signature for your system is absent`],u.DESCRIPTIONS[u.WEB_LIBRARY_NOT_INSTALLED_OR_RUN]=[`Бібліотеку web-підпису не запущено або не інстальовано у системі. Для продовження необхідно запустити або інсталювати бібліотеку web-підпису.`,`Библиотеку web-подписи не запущено или не установлено в системе. Для продолжения необходимо запустить или установить библиотеку web-подписи.`,`The library for the web signature isn't started or not installed in system. To continue, it is necessary to start or install library for the web signature.`],u.DESCRIPTIONS[u.WEB_LIBRARY_INSTALLED_VERSION_NOT_SUPPORTED]=[`Інстальована версія web-бібліотеки підпису більше не підтримується. Для продовження необхідно інсталювати оновлену версію web-бібліотеки підпису.`,`Инсталированная версия web-библиотеки подписи больше не поддерживается. Для продолжения необходимо установить обновленную версию web-библиотеки подписи.`,`The installed version of library for the web signature isn't supported any more. To continue, it is necessary to install the updated version of the library for the web signature.`],u.DESCRIPTIONS[u.WEB_LIBRARY_JAVA_APPLET_NOT_LOADED]=[`Java-апплет не завантажено. Необхідно перевірити версію JRE`,`Java-апплет не загружен. Необходимо проверить версию JRE`,`Java applet isn't loaded. It is necessary to check the version of JRE`],u.DESCRIPTIONS[u.WEB_LIBRARY_INSTALL_PACKAGE]=[`Інсталяційний пакет web-бібліотеки підпису`,`Инсталяционный пакет web-библиотеки подписи`,`Install package of library for the web signature`],u.DESCRIPTIONS[u.WEB_LIBRARY_UPDATE_PACKAGE]=[`Оновлення web-бібліотеки підпису`,`Обновление web-библиотеки подписи`,`Update of library for the web signature`],u.DESCRIPTIONS[u.WEB_LIBRARY_USER_MANUAL]=[`Настанова користувача`,`Руководство пользователя`,`User manual`],u.DESCRIPTIONS[u.WEB_LIBRARY_WEB_EXTENSION_INSTALL_PACKAGE]=[`Інсталяційний пакет бібліотеки підпису (web-розширення)`,`Инсталяционный пакет библиотеки подписи (web-расширение)`,`Install package of library for the web signature (web-extension)`],u.DESCRIPTIONS[u.WEB_LIBRARY_CHECK_JRE_VERSION]=[`Перевірити версію JRE`,`Проверить версию JRE`,`Check JRE version`],u.DESCRIPTIONS[u.WEB_LIBRARY_WEB_EXTENSION_NOT_INSTALLED_OR_RUN]=[`Веб-розширення для роботи бібліотеки web-підпису не запущено або не інстальовано в браузері. Для продовження необхідно запустити або інсталювати веб-розширення.`,`Веб-расширение для работы библиотеки web-подписи не запущено или не установлено в браузере. Для продолжения необходимо запустить или установить веб-расширение.`,`The web extension for the web signature library is not running or installed in the browser. To continue, you need to run or install the web extension.`],u.getString=function(e,t){var n,r;return(n=u.DESCRIPTIONS[e])===void 0&&(n=``),(r=n[t-1])===void 0?n[0]:r};var d=function(e,t,n,r,i){switch(this.m_id=t,this.m_library=null,this.m_language=n,this.m_supportedLibraryTypes=[],this.m_supportedLibraryTypesIndex=0,this.m_noJavaApplet=!1|r,this.m_webExtensionFirst=!1|i,this.m_errorResult=null,e){case d.LIBRARY_TYPE_JAVA_APPLET:case d.LIBRARY_TYPE_SIGN_AGENT:case d.LIBRARY_TYPE_WEB_EXTENSION:case d.LIBRARY_TYPE_NPAPI:case d.LIBRARY_TYPE_ACTIVE_X:this.m_libraryType=e;break;default:this.m_libraryType=d.LIBRARY_TYPE_DEFAULT}this.m_libraryType==d.LIBRARY_TYPE_DEFAULT?(this.m_webExtensionFirst&&d.isWebExtensionSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_WEB_EXTENSION),d.isSignAgentSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_SIGN_AGENT),!this.m_webExtensionFirst&&d.isWebExtensionSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_WEB_EXTENSION),d.isNPAPISupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_NPAPI),d.isActiveXSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_ACTIVE_X),!this.m_noJavaApplet&&d.isJavaAppletSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_JAVA_APPLET)):this.m_supportedLibraryTypes.push(this.m_libraryType),this.onload=function(e){},this.onerror=function(e,t,n){},this.getLibraryType=function(){return this.m_libraryType}};d.LIBRARY_TYPE_DEFAULT=0,d.LIBRARY_TYPE_JAVA_APPLET=1,d.LIBRARY_TYPE_SIGN_AGENT=2,d.LIBRARY_TYPE_WEB_EXTENSION=3,d.LIBRARY_TYPE_NPAPI=4,d.LIBRARY_TYPE_ACTIVE_X=5,d.EU_DEFAULT_LANG=0,d.EU_UA_LANG=1,d.EU_RU_LANG=2,d.EU_EN_LANG=3,d.isJavaAppletSupported=function(){var e=new s;if(this.m_noJavaApplet)return!1;switch(e.GetName()){case s.BROWSER_NAME_FIREFOX:case s.BROWSER_NAME_CHROME:return!(e.GetVersion()>44);case s.BROWSER_NAME_OPERA:return!(e.GetVersion()>30);case s.BROWSER_NAME_EDGE:case s.BROWSER_NAME_UNKNOWN:return!1;default:return!0}},d.isSignAgentSupported=function(){var e=new s;switch(e.GetName()){case s.BROWSER_NAME_IE:if(e.GetVersion()<10)return!1;break;case s.BROWSER_NAME_SAFARI:if(e.GetVersion()<7)return!1;break;case s.BROWSER_NAME_UNKNOWN:return!1}switch(e.GetOSName()){case s.OS_NAME_WINDOWS:case s.OS_NAME_MAC:break;case s.OS_NAME_IOS:return e.GetName()==s.BROWSER_NAME_EU_SIGN_AGENT;case s.OS_NAME_ANDROID:case s.OS_NAME_LINUX:break;case s.OS_NAME_UNKNOWN:default:return!1}return!0},d.isWebExtensionSupported=function(){var e=new s;switch(e.GetName()){case s.BROWSER_NAME_CHROME:break;case s.BROWSER_NAME_OPERA:if(e.GetVersion()<35)return!1;break;case s.BROWSER_NAME_FIREFOX:if(e.GetVersion()<50)return!1;break;case s.BROWSER_NAME_UNKNOWN:default:return!1}switch(e.GetOSName()){case s.OS_NAME_ANDROID:case s.OS_NAME_UNKNOWN:return!1}return!0},d.isNPAPISupported=function(){var e=new s;switch(e.GetName()){case s.BROWSER_NAME_FIREFOX:if(e.GetVersion()>51)return!1;break;default:return!1}return!0},d.isActiveXSupported=function(){var e=new s;switch(e.GetName()){case s.BROWSER_NAME_IE:if(e.GetVersion()<9||e.GetArch()==s.BROWSER_ARCH_NAME_X64)return!1;break;default:return!1}return!0},d.isWebExtensionInstalled=function(){var e=new s().GetName()==s.BROWSER_NAME_FIREFOX?`eusw@iit.com.ua`:`chrome-extension://jffafkigfgmjafhpkoibhfefeaebmccg/`;return document.getElementsByClassName(e).length==1},d.prototype.getLibraryType=function(){return this.m_libraryType},d.prototype.load=function(){var e=this;setTimeout(function(){e._load(e.m_supportedLibraryTypes[e.m_supportedLibraryTypesIndex])},1)},d.prototype.unload=function(){var e=document.getElementById(this.m_id);e&&e.parentNode&&e.parentNode.removeChild(e)},d.prototype._load=function(e){switch(e){case d.LIBRARY_TYPE_JAVA_APPLET:this._loadSignApplet();return;case d.LIBRARY_TYPE_SIGN_AGENT:this._loadSignAgent();return;case d.LIBRARY_TYPE_WEB_EXTENSION:this._loadWebExtension();return;case d.LIBRARY_TYPE_NPAPI:this._loadNPAPI();return;case d.LIBRARY_TYPE_ACTIVE_X:this._loadActiveX();return}},d.prototype._onLoad=function(){this.m_libraryType=this.m_supportedLibraryTypes[this.m_supportedLibraryTypesIndex];try{this.onload(this.m_library)}catch(e){console.log(e)}},d.prototype._onLoadError=function(e,t,n,r){this.m_errorResult??={msg:t,code:n,library:r};var i=document.getElementById(this.m_id);if(i&&i.parentNode&&i.parentNode.removeChild(i),e){if(this.m_supportedLibraryTypesIndex++,this.m_supportedLibraryTypesIndex>=this.m_supportedLibraryTypes.length)try{this.onerror(this.m_errorResult.msg,this.m_errorResult.code,this.m_errorResult.library)}catch(e){console.log(e)}else this.load()}else try{this.onerror(this.m_errorResult.msg,this.m_errorResult.code,this.m_errorResult.library)}catch(e){console.log(e)}},d.prototype._loadSignApplet=function(){var e=document.createElement(`applet`);e.setAttribute(`codebase`,`https://sign.eu.iit.com.ua`),e.setAttribute(`code`,`com.iit.certificateAuthority.endUser.libraries.signJava.EndUser.class`),e.setAttribute(`archive`,`EUSignJava.jar`),e.setAttribute(`cache_archive`,`EUSignJava.jar`),e.setAttribute(`cache_version`,`1.3.102`),e.setAttribute(`separate_jvm`,!0),e.setAttribute(`id`,this.m_id),e.setAttribute(`width`,`100%`),e.setAttribute(`height`,`1`),document.body.appendChild(e),this.m_library=document.getElementById(this.m_id),this._waitForSignAppletLoad(this,100,1200)},d.prototype._waitForSignAppletLoad=function(e,t,n){try{e.m_library.SetUIMode(!1)}catch{if(n!=0)return void setTimeout(function(){e._waitForSignAppletLoad(e,t,n-1)},t,n);var r=``;r=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,e.m_language)+`. `,r+=u.getString(u.WEB_LIBRARY_JAVA_APPLET_NOT_LOADED,e.m_language),r+=`<br><br>`,r+=`<a style="text-indent:18px" href="https://www.java.com/ru/download/installed.jsp">`+u.getString(u.WEB_LIBRARY_CHECK_JRE_VERSION,e.m_language)+`</a>`,e._onLoadError(!0,r,Z.ERROR_LIBRARY_COMUNICATION_FAILED,null);return}e._onLoad(e.m_library)},d.prototype._appendWebWrapperObject=function(e,t,n,r){try{var i=new $(e,t),a=document.createElement(`object`);for(var o in a.setAttribute(`id`,this.m_id),n?r?(a.setAttribute(`classid`,e),a.setAttribute(`height`,`1px`)):(a.type=e,a.classid=e,a.height=`1px`):(a.classid=`EUSignCP.class`,a.style=`display:none`,a.style.visibility=`hidden`),document.body.appendChild(a),i)a[o]=i[o];return this.m_library=document.getElementById(this.m_id),!0}catch{return!1}},d.prototype._onLoadWebLibraryError=function(e){var t,n=this.m_library,r=!0,i=``;switch(t=d.isWebExtensionSupported()&&!d.isWebExtensionInstalled()&&this.m_webExtensionFirst,i+=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,this.m_language),i+=`. `,e.GetErrorCode()){case Z.ERROR_LIBRARY_COMUNICATION_FAILED:i+=u.getString(t?u.WEB_LIBRARY_WEB_EXTENSION_NOT_INSTALLED_OR_RUN:u.WEB_LIBRARY_NOT_INSTALLED_OR_RUN,this.m_language);break;case Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED:i+=u.getString(u.WEB_LIBRARY_INSTALLED_VERSION_NOT_SUPPORTED,this.m_language),r=!1,this.m_errorResult=null;break;default:i+=Z.getErrorDescriptionEx(e.GetErrorCode(),this.m_language)+`.`}i+=`<br><br>`,n.GetInstallURL()==null?i+=`<div>`+u.getString(u.WEB_LIBRARY_OS_NOT_SUPPORTED,this.m_language)+`</div>`:(e.GetErrorCode()==Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED?i+=`<div><a style="text-indent:18px" href="`+n.GetUpdateURL()+`">`+u.getString(u.WEB_LIBRARY_UPDATE_PACKAGE,this.m_language)+`</a></div>`:i+=t?`<div><a style="text-indent:18px" href="`+n.GetWebExtensionInstallURL()+`">`+u.getString(u.WEB_LIBRARY_WEB_EXTENSION_INSTALL_PACKAGE,this.m_language)+`</a></div>`:`<div><a style="text-indent:18px" href="`+n.GetInstallURL()+`">`+u.getString(u.WEB_LIBRARY_INSTALL_PACKAGE,this.m_language)+`</a></div>`,i+=`<div><a style="text-indent:18px" href="`+n.GetHelpURL()+`">`+u.getString(u.WEB_LIBRARY_USER_MANUAL,this.m_language)+`</a></div>`),this._onLoadError(r,i,e.GetErrorCode(),n)},d.prototype._loadWebLibrary=function(){var e=this;e.m_library.Load(function(){e._onLoad()},function(t){e._onLoadWebLibraryError(t)})},d.prototype._loadSignAgent=function(){if(this._appendWebWrapperObject(`localhost`,window.location.protocol==`http:`?`8081`:`8083`,!1,!1))this._loadWebLibrary();else{var e=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,this.m_language);this._onLoadError(!0,e,Z.ERROR_LIBRARY_COMUNICATION_FAILED,null)}},d.prototype._loadWebExtension=function(){if(this._appendWebWrapperObject(`chrome-extension://jffafkigfgmjafhpkoibhfefeaebmccg/`,``,!1,!1))this._loadWebLibrary();else{var e=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,this.m_language);this._onLoadError(!0,e,Z.ERROR_LIBRARY_COMUNICATION_FAILED,null)}},d.prototype._loadPlugin=function(e,t,n,r){if(this._appendWebWrapperObject(e,``,!0,r))this._waitForPluginLoad(this,t,n);else{var i=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,this.m_language);this._onLoadError(!0,i,Z.ERROR_LIBRARY_COMUNICATION_FAILED,null)}},d.prototype._waitForPluginLoad=function(e,t,n){e.m_library.Load(function(){e._onLoad()},function(r){r.GetErrorCode()!=Z.ERROR_LIBRARY_COMUNICATION_FAILED||n==0?e._onLoadWebLibraryError(r):setTimeout(function(){e._waitForPluginLoad(e,t,n-1)},t,n)})},d.prototype._loadNPAPI=function(){this._loadPlugin(`application/x-eusign-cp`,100,50,!1)},d.prototype._loadActiveX=function(){this._loadPlugin(`clsid:B7E24C75-E343-4DA2-A8D3-C80970FB7D7B`,100,50,!0)};var f=function(){this.vendor=`JSC IIT`,this.parentClassName=`Object`,this.className=`EndUserArrayList`,this.classVersion=1,this.m_array=[]};f.prototype.add=function(e){return this.m_array.push(e),!0},f.prototype.clear=function(){this.m_array=[]},f.prototype.get=function(e){return this.m_array[e]},f.prototype.size=function(){return this.m_array.length},Object.create||(Object.create=function(e,t){if(typeof e!=`object`&&typeof e!=`function`||e===null||t!==void 0)throw Error(`Invalid arguments`);function n(){}return n.prototype=e,new n}),Uint8Array.prototype.slice||(Uint8Array.prototype.slice=Uint8Array.prototype.subarray);var p=null;function m(e){return typeof e==`object`&&!!e&&(e.className==`EndUserTransferableObject`||e.parentClassName==`EndUserTransferableObject`)}p=typeof Uint8Array>`u`?function(e){var t;if(typeof e==`number`){t=Array(e);for(var n=0;n<e;++n)t[n]=0}else t=e.slice(0);return t.buffer=t,t.subarray=function(e,n){return t.slice(e,n)},t.set=function(e,n){arguments.length<2&&(n=0);for(var r=0,i=e.length;r<i;++r,++n)t[n]=255&e[r]},t.byteLength=t.length,typeof e==`object`&&e.buffer&&(t.buffer=e.buffer),t}:Uint8Array;var h=function(){this.vendor=`JSC IIT`,this.parentClassName=`Object`,this.className=`EndUserTransferableObject`,this.classVersion=1,this.isFilled=!1,this.fields={}};h.makeTransferable=function(e){var t,n=h;(t=e).prototype=Object.create(n.prototype),t.prototype.constructor=t,h[new e().className]=e},h.prototype.base64Coder=new a,h.prototype.dateCoder=new i,h.prototype.setClassInfo=function(e,t){this.parentClassName=`EndUserTransferableObject`,this.className=e,this.classVersion=t},h.prototype.initializeFields=function(){for(var e in this.fields)switch(this.fields[e]){case`boolean`:this[e]=!1;break;case`int`:case`long`:case`number`:this[e]=0;break;case`string`:this[e]=``;break;case`EndUserKeyMedia`:this[e]=new _;break;default:this[e]=null}},h.prototype.set=function(e){if(this.className!=e.className)throw`invalid class`;for(var t in this.fields)this[t]=e[t]},h.prototype.encode=function(){var e,t;for(var n in t={},e={},this.fields)this[n]==null?t[n]=null:m(this[n])?t[n]=this[n].encode():this.fields[n]==`byteArray`?t[n]=this.base64Coder.encode(this[n]):this.fields[n]==`time`?t[n]=this.dateCoder.encode(this[n]):t[n]=this[n];return e.className=this.className,e.classVersion=this.classVersion,e.classFields=t,e},h.prototype.decode=function(e){try{if(e.classVersion==null||e.classFields==null)return!1;var t=e.classFields;for(var n in this.fields)if(this.fields[n]==`time`)this[n]=this.dateCoder.decode(t[n]);else if(this.fields[n]==`EndUserOwnerInfo`)this[n]=new k,this[n].decode(t[n]);else if(this.fields[n]==`EndUserTimeInfo`)this[n]=new A,this[n].decode(t[n]);else if(this.fields[n]==`EndUserKeyMedia`)this[n]=new _,this[n].decode(t[n]);else if(this.fields[n]==`EndUserCertificateInfoEx`)this[n]=new P,this[n].decode(t[n]);else if(this.fields[n]==`byteArray`)t[n]!=null&&(this[n]=this.base64Coder.decode(t[n]));else if(this.fields[n]==`array`){this[n]=[];for(var r=t[n],i=0;i<r.length;i++){var a=new h[r[i].className];if(a!==void 0){if(!a.decode(r[i]))throw`invalid class`;a.className==`EndUserByteArray`&&(a=a.GetData()),this[n].push(a)}else this[n].push(r[i])}}else this[n]=t[n];return!0}catch{return this.isFilled=!1,!1}};var g=function(e){this.setClassInfo(`EndUserByteArray`,1),this.fields={data:`byteArray`},this.initializeFields(),this.data=e};h.makeTransferable(g),g.prototype.GetData=function(){return this.data},g.prototype.SetData=function(e){this.data=e};var _=function(){this.setClassInfo(`EndUserKeyMedia`,1),this.fields={typeIndex:`long`,devIndex:`long`,password:`string`},this.initializeFields()};h.makeTransferable(_),_.prototype.GetTypeIndex=function(){return this.typeIndex},_.prototype.SetTypeIndex=function(e){this.typeIndex=e},_.prototype.GetDevIndex=function(){return this.devIndex},_.prototype.SetDevIndex=function(e){this.devIndex=e},_.prototype.GetPassword=function(){return this.password},_.prototype.SetPassword=function(e){this.password=e};var v=function(){this.setClassInfo(`EndUserFileStoreSettings`,1),this.fields={path:`string`,checkCRLs:`boolean`,autoRefresh:`boolean`,ownCRLsOnly:`boolean`,fullAndDeltaCRLs:`boolean`,autoDownloadCRLs:`boolean`,saveLoadedCerts:`boolean`,expireTime:`long`},this.initializeFields(),this.expireTime=3600};h.makeTransferable(v),v.prototype.GetPath=function(){return this.path},v.prototype.SetPath=function(e){this.path=e},v.prototype.GetCheckCRLs=function(){return this.checkCRLs},v.prototype.SetCheckCRLs=function(e){this.checkCRLs=e},v.prototype.GetAutoRefresh=function(){return this.autoRefresh},v.prototype.SetAutoRefresh=function(e){this.autoRefresh=e},v.prototype.GetOwnCRLsOnly=function(){return this.ownCRLsOnly},v.prototype.SetOwnCRLsOnly=function(e){this.ownCRLsOnly=e},v.prototype.GetFullAndDeltaCRLs=function(){return this.fullAndDeltaCRLs},v.prototype.SetFullAndDeltaCRLs=function(e){this.fullAndDeltaCRLs=e},v.prototype.GetAutoDownloadCRLs=function(){return this.autoDownloadCRLs},v.prototype.SetAutoDownloadCRLs=function(e){this.autoDownloadCRLs=e},v.prototype.GetSaveLoadedCerts=function(){return this.saveLoadedCerts},v.prototype.SetSaveLoadedCerts=function(e){this.saveLoadedCerts=e},v.prototype.GetExpireTime=function(){return this.expireTime},v.prototype.SetExpireTime=function(e){this.expireTime=e};var y=function(){this.setClassInfo(`EndUserProxySettings`,1),this.fields={useProxy:`boolean`,anonymous:`boolean`,address:`string`,port:`string`,user:`string`,password:`string`,savePassword:`boolean`},this.initializeFields(),this.port=`80`};h.makeTransferable(y),y.prototype.GetUseProxy=function(){return this.useProxy},y.prototype.SetUseProxy=function(e){this.useProxy=e},y.prototype.GetAnonymous=function(){return this.anonymous},y.prototype.SetAnonymous=function(e){this.anonymous=e},y.prototype.GetAddress=function(){return this.address},y.prototype.SetAddress=function(e){this.address=e},y.prototype.GetPort=function(){return this.port},y.prototype.SetPort=function(e){this.port=e},y.prototype.GetUser=function(){return this.user},y.prototype.SetUser=function(e){this.user=e},y.prototype.GetPassword=function(){return this.password},y.prototype.SetPassword=function(e){this.password=e},y.prototype.GetSavePassword=function(){return this.savePassword},y.prototype.SetSavePassword=function(e){this.savePassword=e};var b=function(){this.setClassInfo(`EndUserTSPSettings`,1),this.fields={getStamps:`boolean`,address:`string`,port:`string`},this.initializeFields(),this.port=`80`};h.makeTransferable(b),b.prototype.GetGetStamps=function(){return this.getStamps},b.prototype.SetGetStamps=function(e){this.getStamps=e},b.prototype.GetAddress=function(){return this.address},b.prototype.SetAddress=function(e){this.address=e},b.prototype.GetPort=function(){return this.port},b.prototype.SetPort=function(e){this.port=e};var x=function(){this.setClassInfo(`EndUserOCSPSettings`,1),this.fields={useOCSP:`boolean`,beforeStore:`boolean`,address:`string`,port:`string`},this.initializeFields(),this.port=`80`};h.makeTransferable(x),x.prototype.GetUseOCSP=function(){return this.useOCSP},x.prototype.SetUseOCSP=function(e){this.useOCSP=e},x.prototype.GetBeforeStore=function(){return this.beforeStore},x.prototype.SetBeforeStore=function(e){this.beforeStore=e},x.prototype.GetAddress=function(){return this.address},x.prototype.SetAddress=function(e){this.address=e},x.prototype.GetPort=function(){return this.port},x.prototype.SetPort=function(e){this.port=e};var S=function(){this.setClassInfo(`EndUserLDAPSettings`,1),this.fields={useLDAP:`boolean`,address:`string`,port:`string`,anonymous:`boolean`,user:`string`,password:`string`},this.initializeFields(),this.port=`389`};h.makeTransferable(S),S.prototype.GetUseLDAP=function(){return this.useLDAP},S.prototype.SetUseLDAP=function(e){this.useLDAP=e},S.prototype.GetAddress=function(){return this.address},S.prototype.SetAddress=function(e){this.address=e},S.prototype.GetPort=function(){return this.port},S.prototype.SetPort=function(e){this.port=e},S.prototype.GetAnonymous=function(){return this.anonymous},S.prototype.SetAnonymous=function(e){this.anonymous=e},S.prototype.GetUser=function(){return this.user},S.prototype.SetUser=function(e){this.user=e},S.prototype.GetPassword=function(){return this.password},S.prototype.SetPassword=function(e){this.password=e};var C=function(){this.setClassInfo(`EndUserCMPSettings`,1),this.fields={useCMP:`boolean`,address:`string`,port:`string`,commonName:`string`},this.initializeFields(),this.port=`80`};h.makeTransferable(C),C.prototype.GetUseCMP=function(){return this.useCMP},C.prototype.SetUseCMP=function(e){this.useCMP=e},C.prototype.GetAddress=function(){return this.address},C.prototype.SetAddress=function(e){this.address=e},C.prototype.GetPort=function(){return this.port},C.prototype.SetPort=function(e){this.port=e},C.prototype.GetCommonName=function(){return this.commonName},C.prototype.SetCommonName=function(e){this.commonName=e};var w=function(){this.setClassInfo(`EndUserModeSettings`,1),this.fields={offlineMode:`boolean`},this.initializeFields()};h.makeTransferable(w),w.prototype.GetOfflineMode=function(){return this.offlineMode},w.prototype.SetOfflineMode=function(e){this.offlineMode=e};var T=function(){this.setClassInfo(`EndUserOCSPAccessInfoModeSettings`,1),this.fields={enabled:`boolean`},this.initializeFields()};h.makeTransferable(T),T.prototype.GetEnabled=function(){return this.enabled},T.prototype.SetEnabled=function(e){this.enabled=e};var E=function(){this.setClassInfo(`EndUserOCSPAccessInfoSettings`,1),this.fields={issuerCN:`string`,address:`string`,port:`string`},this.initializeFields()};h.makeTransferable(E),E.prototype.GetIssuerCN=function(){return this.issuerCN},E.prototype.SetIssuerCN=function(e){this.issuerCN=e},E.prototype.GetAddress=function(){return this.address},E.prototype.SetAddress=function(e){this.address=e},E.prototype.GetPort=function(){return this.port},E.prototype.SetPort=function(e){this.port=e};var D=function(){this.setClassInfo(`EndUserKeyMediaSettings`,1),this.fields={sourceType:`long`,showErrors:`boolean`,keyMedia:`EndUserKeyMedia`},this.initializeFields(),this.sourceType=1,this.showErrors=!0};h.makeTransferable(D),D.prototype.GetSourceType=function(){return this.sourceType},D.prototype.SetSourceType=function(e){this.sourceType=e},D.prototype.GetShowErrors=function(){return this.showErrors},D.prototype.SetShowErrors=function(e){this.showErrors=e},D.prototype.GetKeyMedia=function(){return this.keyMedia},D.prototype.SetKeyMedia=function(e){this.keyMedia=e};var O=function(){this.setClassInfo(`EndUserTSLSettings`,1),this.fields={useTSL:`boolean`,autoDownloadTSL:`boolean`,tslAddress:`string`},this.initializeFields()};h.makeTransferable(O),O.prototype.GetUseTSL=function(){return this.useTSL},O.prototype.SetUseTSL=function(e){this.useTSL=e},O.prototype.GetAutoDownloadTSL=function(){return this.autoDownloadTSL},O.prototype.SetAutoDownloadTSL=function(e){this.autoDownloadTSL=e},O.prototype.GetTSLAddress=function(){return this.tslAddress},O.prototype.SetTSLAddress=function(e){this.tslAddress=e};var k=function(){this.setClassInfo(`EndUserOwnerInfo`,1),this.fields={isFilled:`boolean`,issuer:`string`,issuerCN:`string`,serial:`string`,subject:`string`,subjCN:`string`,subjOrg:`string`,subjOrgUnit:`string`,subjTitle:`string`,subjState:`string`,subjLocality:`string`,subjFullName:`string`,subjAddress:`string`,subjPhone:`string`,subjEMail:`string`,subjDNS:`string`,subjEDRPOUCode:`string`,subjDRFOCode:`string`},this.initializeFields()};h.makeTransferable(k),k.prototype.IsFilled=function(){return this.isFilled},k.prototype.GetIssuer=function(){return this.issuer},k.prototype.GetIssuerCN=function(){return this.issuerCN},k.prototype.GetSerial=function(){return this.serial},k.prototype.GetSubject=function(){return this.subject},k.prototype.GetSubjCN=function(){return this.subjCN},k.prototype.GetSubjOrg=function(){return this.subjOrg},k.prototype.GetSubjOrgUnit=function(){return this.subjOrgUnit},k.prototype.GetSubjTitle=function(){return this.subjTitle},k.prototype.GetSubjState=function(){return this.subjState},k.prototype.GetSubjLocality=function(){return this.subjLocality},k.prototype.GetSubjFullName=function(){return this.subjFullName},k.prototype.GetSubjAddress=function(){return this.subjAddress},k.prototype.GetSubjPhone=function(){return this.subjPhone},k.prototype.GetSubjEMail=function(){return this.subjEMail},k.prototype.GetSubjDNS=function(){return this.subjDNS},k.prototype.GetSubjEDRPOUCode=function(){return this.subjEDRPOUCode},k.prototype.GetSubjDRFOCode=function(){return this.subjDRFOCode};var A=function(){this.setClassInfo(`EndUserTimeInfo`,2),this.fields={version:`number`,isTimeAvail:`boolean`,isTimeStamp:`boolean`,time:`time`,isSignTimeStampAvail:`boolean`,signTimeStamp:`time`},this.initializeFields()};h.makeTransferable(A),A.prototype.GetVersion=function(){return this.version},A.prototype.IsTimeAvail=function(){return this.isTimeAvail},A.prototype.IsTimeStamp=function(){return this.isTimeStamp},A.prototype.GetTime=function(){return this.time},A.prototype.IsSignTimeStampAvail=function(){return this.isSignTimeStampAvail},A.prototype.GetSignTimeStamp=function(){return this.signTimeStamp};var j=function(){this.setClassInfo(`EndUserSignInfo`,1),this.fields={ownerInfo:`EndUserOwnerInfo`,timeInfo:`EndUserTimeInfo`,data:`byteArray`},this.initializeFields()};h.makeTransferable(j),j.prototype.GetOwnerInfo=function(){return this.ownerInfo},j.prototype.GetTimeInfo=function(){return this.timeInfo},j.prototype.GetData=function(){return this.data},j.prototype.GetDataString=function(e){return r.ArrayToString(e,this.data)};var M=function(){this.setClassInfo(`EndUserSenderInfo`,1),this.fields={ownerInfo:`EndUserOwnerInfo`,timeInfo:`EndUserTimeInfo`,data:`byteArray`},this.initializeFields()};h.makeTransferable(M),M.prototype.GetOwnerInfo=function(){return this.ownerInfo},M.prototype.GetTimeInfo=function(){return this.timeInfo},M.prototype.GetData=function(){return this.data},M.prototype.GetDataString=function(e){return r.ArrayToString(e,this.data)};var N=function(){this.setClassInfo(`EndUserCertificateInfo`,1),this.fields={isFilled:`boolean`,version:`long`,issuer:`string`,issuerCN:`string`,serial:`string`,subject:`string`,subjCN:`string`,subjOrg:`string`,subjOrgUnit:`string`,subjTitle:`string`,subjState:`string`,subjLocality:`string`,subjFullName:`string`,subjAddress:`string`,subjPhone:`string`,subjEMail:`string`,subjDNS:`string`,subjEDRPOUCode:`string`,subjDRFOCode:`string`,subjNBUCode:`string`,subjSPFMCode:`string`,subjOCode:`string`,subjOUCode:`string`,subjUserCode:`string`,certBeginTime:`time`,certEndTime:`time`,isPrivKeyTimesAvail:`boolean`,privKeyBeginTime:`time`,privKeyEndTime:`time`,publicKeyBits:`long`,publicKey:`string`,publicKeyID:`string`,isECDHPublicKeyAvail:`boolean`,ECDHPublicKeyBits:`long`,ECDHPublicKey:`string`,ECDHPublicKeyID:`string`,issuerPublicKeyID:`string`,keyUsage:`string`,extKeyUsages:`string`,policies:`string`,crlDistribPoint1:`string`,crlDistribPoint2:`string`,isPowerCert:`boolean`,isSubjTypeAvail:`boolean`,isSubjCA:`boolean`},this.initializeFields()};h.makeTransferable(N),N.prototype.IsFilled=function(){return this.isFilled},N.prototype.GetVersion=function(){return this.version},N.prototype.GetIssuer=function(){return this.issuer},N.prototype.GetIssuerCN=function(){return this.issuerCN},N.prototype.GetSerial=function(){return this.serial},N.prototype.GetSubject=function(){return this.subject},N.prototype.GetSubjCN=function(){return this.subjCN},N.prototype.GetSubjOrg=function(){return this.subjOrg},N.prototype.GetSubjOrgUnit=function(){return this.subjOrgUnit},N.prototype.GetSubjTitle=function(){return this.subjTitle},N.prototype.GetSubjState=function(){return this.subjState},N.prototype.GetSubjLocality=function(){return this.subjLocality},N.prototype.GetSubjFullName=function(){return this.subjFullName},N.prototype.GetSubjAddress=function(){return this.subjAddress},N.prototype.GetSubjPhone=function(){return this.subjPhone},N.prototype.GetSubjEMail=function(){return this.subjEMail},N.prototype.GetSubjDNS=function(){return this.subjDNS},N.prototype.GetSubjEDRPOUCode=function(){return this.subjEDRPOUCode},N.prototype.GetSubjDRFOCode=function(){return this.subjDRFOCode},N.prototype.GetSubjNBUCode=function(){return this.subjNBUCode},N.prototype.GetSubjSPFMCode=function(){return this.subjSPFMCode},N.prototype.GetSubjOCode=function(){return this.subjOCode},N.prototype.GetSubjOUCode=function(){return this.subjOUCode},N.prototype.GetSubjUserCode=function(){return this.subjUserCode},N.prototype.GetCertBeginTime=function(){return this.certBeginTime},N.prototype.GetCertEndTime=function(){return this.certEndTime},N.prototype.IsPrivKeyTimesAvail=function(){return this.isPrivKeyTimesAvail},N.prototype.GetPrivKeyBeginTime=function(){return this.privKeyBeginTime},N.prototype.GetPrivKeyEndTime=function(){return this.privKeyEndTime},N.prototype.GetPublicKeyBits=function(){return this.publicKeyBits},N.prototype.GetPublicKey=function(){return this.publicKey},N.prototype.GetPublicKeyID=function(){return this.publicKeyID},N.prototype.IsECDHPublicKeyAvail=function(){return this.isECDHPublicKeyAvail},N.prototype.GetECDHPublicKeyBits=function(){return this.ECDHPublicKeyBits},N.prototype.GetECDHPublicKey=function(){return this.ECDHPublicKey},N.prototype.GetECDHPublicKeyID=function(){return this.ECDHPublicKeyID},N.prototype.GetIssuerPublicKeyID=function(){return this.issuerPublicKeyID},N.prototype.GetKeyUsage=function(){return this.keyUsage},N.prototype.GetExtKeyUsages=function(){return this.extKeyUsages},N.prototype.GetPolicies=function(){return this.policies},N.prototype.GetCRLDistribPoint1=function(){return this.crlDistribPoint1},N.prototype.GetCRLDistribPoint2=function(){return this.crlDistribPoint2},N.prototype.IsPowerCert=function(){return this.isPowerCert},N.prototype.IsSubjTypeAvail=function(){return this.isSubjTypeAvail},N.prototype.IsSubjCA=function(){return this.isSubjCA};var P=function(){this.setClassInfo(`EndUserCertificateInfoEx`,8),this.fields={isFilled:`boolean`,version:`long`,issuer:`string`,issuerCN:`string`,serial:`string`,subject:`string`,subjCN:`string`,subjOrg:`string`,subjOrgUnit:`string`,subjTitle:`string`,subjState:`string`,subjLocality:`string`,subjFullName:`string`,subjAddress:`string`,subjPhone:`string`,subjEMail:`string`,subjDNS:`string`,subjEDRPOUCode:`string`,subjDRFOCode:`string`,subjNBUCode:`string`,subjSPFMCode:`string`,subjOCode:`string`,subjOUCode:`string`,subjUserCode:`string`,certBeginTime:`time`,certEndTime:`time`,isPrivKeyTimesAvail:`boolean`,privKeyBeginTime:`time`,privKeyEndTime:`time`,publicKeyBits:`long`,publicKey:`string`,publicKeyID:`string`,issuerPublicKeyID:`string`,keyUsage:`string`,extKeyUsages:`string`,policies:`string`,crlDistribPoint1:`string`,crlDistribPoint2:`string`,isPowerCert:`boolean`,isSubjTypeAvail:`boolean`,isSubjCA:`boolean`,chainLength:`int`,UPN:`string`,publicKeyType:`long`,keyUsageType:`long`,RSAModul:`string`,RSAExponent:`string`,OCSPAccessInfo:`string`,issuerAccessInfo:`string`,TSPAccessInfo:`string`,isLimitValueAvailable:`boolean`,limitValue:`long`,limitValueCurrency:`string`,subjType:`long`,subjSubType:`long`,subjUNZR:`string`,subjCountry:`string`,fingerprint:`string`,isQSCD:`boolean`,subjUserID:`string`,certHashType:`number`},this.initializeFields();var e=this;this.IsLimitValueAvailable=function(){return e.isLimitValueAvailable}};h.makeTransferable(P),P.prototype.IsFilled=function(){return this.isFilled},P.prototype.GetVersion=function(){return this.version},P.prototype.GetIssuer=function(){return this.issuer},P.prototype.GetIssuerCN=function(){return this.issuerCN},P.prototype.GetSerial=function(){return this.serial},P.prototype.GetSubject=function(){return this.subject},P.prototype.GetSubjCN=function(){return this.subjCN},P.prototype.GetSubjOrg=function(){return this.subjOrg},P.prototype.GetSubjOrgUnit=function(){return this.subjOrgUnit},P.prototype.GetSubjTitle=function(){return this.subjTitle},P.prototype.GetSubjState=function(){return this.subjState},P.prototype.GetSubjLocality=function(){return this.subjLocality},P.prototype.GetSubjFullName=function(){return this.subjFullName},P.prototype.GetSubjAddress=function(){return this.subjAddress},P.prototype.GetSubjPhone=function(){return this.subjPhone},P.prototype.GetSubjEMail=function(){return this.subjEMail},P.prototype.GetSubjDNS=function(){return this.subjDNS},P.prototype.GetSubjEDRPOUCode=function(){return this.subjEDRPOUCode},P.prototype.GetSubjDRFOCode=function(){return this.subjDRFOCode},P.prototype.GetSubjNBUCode=function(){return this.subjNBUCode},P.prototype.GetSubjSPFMCode=function(){return this.subjSPFMCode},P.prototype.GetSubjOCode=function(){return this.subjOCode},P.prototype.GetSubjOUCode=function(){return this.subjOUCode},P.prototype.GetSubjUserCode=function(){return this.subjUserCode},P.prototype.GetCertBeginTime=function(){return this.certBeginTime},P.prototype.GetCertEndTime=function(){return this.certEndTime},P.prototype.IsPrivKeyTimesAvail=function(){return this.isPrivKeyTimesAvail},P.prototype.GetPrivKeyBeginTime=function(){return this.privKeyBeginTime},P.prototype.GetPrivKeyEndTime=function(){return this.privKeyEndTime},P.prototype.GetPublicKeyBits=function(){return this.publicKeyBits},P.prototype.GetPublicKey=function(){return this.publicKey},P.prototype.GetPublicKeyID=function(){return this.publicKeyID},P.prototype.GetIssuerPublicKeyID=function(){return this.issuerPublicKeyID},P.prototype.GetKeyUsage=function(){return this.keyUsage},P.prototype.GetExtKeyUsages=function(){return this.extKeyUsages},P.prototype.GetPolicies=function(){return this.policies},P.prototype.GetCRLDistribPoint1=function(){return this.crlDistribPoint1},P.prototype.GetCRLDistribPoint2=function(){return this.crlDistribPoint2},P.prototype.IsPowerCert=function(){return this.isPowerCert},P.prototype.IsSubjTypeAvail=function(){return this.isSubjTypeAvail},P.prototype.IsSubjCA=function(){return this.isSubjCA},P.prototype.GetChainLength=function(){return this.chainLength},P.prototype.GetUPN=function(){return this.UPN},P.prototype.GetPublicKeyType=function(){return this.publicKeyType},P.prototype.GetKeyUsageType=function(){return this.keyUsageType},P.prototype.GetRSAModul=function(){return this.RSAModul},P.prototype.GetRSAExponent=function(){return this.RSAExponent},P.prototype.GetOCSPAccessInfo=function(){return this.OCSPAccessInfo},P.prototype.GetIssuerAccessInfo=function(){return this.issuerAccessInfo},P.prototype.GetTSPAccessInfo=function(){return this.TSPAccessInfo},P.prototype.IsLimitValueAvail=function(){return this.isLimitValueAvailable},P.prototype.GetLimitValue=function(){return this.limitValue},P.prototype.GetLimitValueCurrency=function(){return this.limitValueCurrency},P.prototype.GetSubjType=function(){return this.subjType},P.prototype.GetSubjSubType=function(){return this.subjSubType},P.prototype.GetSubjUNZR=function(){return this.subjUNZR},P.prototype.GetSubjCountry=function(){return this.subjCountry},P.prototype.GetFingerprint=function(){return this.fingerprint},P.prototype.IsQSCD=function(){return this.isQSCD},P.prototype.GetSubjUserID=function(){return this.subjUserID},P.prototype.GetCertHashType=function(){return this.certHashType};var F=function(){this.setClassInfo(`EndUserCertificate`,1),this.fields={infoEx:`EndUserCertificateInfoEx`,data:`byteArray`},this.initializeFields()};h.makeTransferable(F),F.prototype.GetInfoEx=function(){return this.infoEx},F.prototype.SetInfoEx=function(e){this.infoEx=e},F.prototype.GetData=function(){return this.data},F.prototype.SetData=function(e){this.data=e};var I=function(){this.setClassInfo(`EndUserCRLInfo`,1,!0,!1),this.fields={isFilled:`boolean`,issuer:`string`,issuerCN:`string`,crlNumber:`long`,thisUpdate:`time`,nextUpdate:`time`},this.initializeFields()};h.makeTransferable(I),I.prototype.IsFilled=function(){return this.isFilled},I.prototype.GetIssuer=function(){return this.issuer},I.prototype.GetIssuerCN=function(){return this.issuerCN},I.prototype.GetCRLNumber=function(){return this.crlNumber},I.prototype.GetThisUpdate=function(){return this.thisUpdate},I.prototype.GetNextUpdate=function(){return this.nextUpdate};var L=function(){this.setClassInfo(`EndUserCRLDetailedInfo`,1),this.fields={isFilled:`boolean`,version:`long`,issuer:`string`,issuerCN:`string`,issuerPublicKeyID:`string`,crlNumber:`long`,thisUpdate:`time`,nextUpdate:`time`,revokedItemsCount:`long`},this.initializeFields()};h.makeTransferable(L),L.prototype.IsFilled=function(){return this.isFilled},L.prototype.GetVersion=function(){return this.version},L.prototype.GetIssuer=function(){return this.issuer},L.prototype.GetIssuerCN=function(){return this.issuerCN},L.prototype.GetIssuerPublicKeyID=function(){return this.issuerPublicKeyID},L.prototype.GetCRLNumber=function(){return this.crlNumber},L.prototype.GetThisUpdate=function(){return this.thisUpdate},L.prototype.GetNextUpdate=function(){return this.nextUpdate},L.prototype.GetRevokedItemsCount=function(){return this.revokedItemsCount};var R=function(){this.setClassInfo(`EndUserPrivateKeyInfo`,1),this.fields={privateKey:`byteArray`,privateKeyInfo:`byteArray`},this.initializeFields()};h.makeTransferable(R),R.prototype.GetPrivateKey=function(){return this.privateKey},R.prototype.SetPrivateKey=function(e){this.privateKey=e},R.prototype.GetPrivateKeyInfo=function(){return this.privateKeyInfo},R.prototype.SetPrivateKeyInfo=function(e){this.privateKeyInfo=e};var z=function(){this.setClassInfo(`EndUserJKSPrivateKey`,1),this.fields={privateKey:`byteArray`,certificates:`array`},this.initializeFields()};h.makeTransferable(z),z.prototype.GetPrivateKey=function(){return this.privateKey},z.prototype.GetCertificate=function(e){return e<0||e>=this.certificates.length?null:this.certificates[e]},z.prototype.GetCertificatesCount=function(){return this.certificates.length},z.prototype.GetCertificates=function(){return this.certificates};var B=function(){this.setClassInfo(`EndUserRequestInfo`,4),this.fields={request:`byteArray`,requestType:`number`,defaultRequestFileName:`string`,isSimple:`boolean`,subject:`string`,subjCN:`string`,subjOrg:`string`,subjOrgUnit:`string`,subjTitle:`string`,subjState:`string`,subjLocality:`string`,subjFullName:`string`,subjAddress:`string`,subjPhone:`string`,subjEMail:`string`,subjDNS:`string`,subjEDRPOUCode:`string`,subjDRFOCode:`string`,subjNBUCode:`string`,subjSPFMCode:`string`,subjOCode:`string`,subjOUCode:` string`,subjUserCode:`string`,certBeginTime:`time`,certEndTime:`time`,isPrivKeyTimesAvail:`boolean`,privKeyBeginTime:`time`,privKeyEndTime:`time`,publicKeyType:`number`,publicKeyBits:`number`,RSAModul:`string`,RSAExponent:`string`,publicKey:`string`,publicKeyID:`string`,extKeyUsages:`string`,crlDistribPoint1:`string`,crlDistribPoint2:`string`,isSubjTypeAvail:`boolean`,subjType:`number`,subjSubType:`number`,isSelfSigned:`boolean`,signIssuer:`string`,signSerial:`string`,subjUNZR:`string`,subjCountry:`string`,isQSCD:`boolean`},this.initializeFields()};h.makeTransferable(B),B.prototype.GetRequest=function(){return this.request},B.prototype.GetRequestType=function(){return this.requestType},B.prototype.GetDefaultRequestFileName=function(){return this.defaultRequestFileName},B.prototype.IsSimple=function(){return this.isSimple},B.prototype.GetSubject=function(){return this.subject},B.prototype.GetSubjCN=function(){return this.subjCN},B.prototype.GetSubjOrg=function(){return this.subjOrg},B.prototype.GetSubjOrgUnit=function(){return this.subjOrgUnit},B.prototype.GetSubjTitle=function(){return this.subjTitle},B.prototype.GetSubjState=function(){return this.subjState},B.prototype.GetSubjLocality=function(){return this.subjLocality},B.prototype.GetSubjFullName=function(){return this.subjFullName},B.prototype.GetSubjAddress=function(){return this.subjAddress},B.prototype.GetSubjPhone=function(){return this.subjPhone},B.prototype.GetSubjEMail=function(){return this.subjEMail},B.prototype.GetSubjDNS=function(){return this.subjDNS},B.prototype.GetSubjEDRPOUCode=function(){return this.subjEDRPOUCode},B.prototype.GetSubjDRFOCode=function(){return this.subjDRFOCode},B.prototype.GetSubjNBUCode=function(){return this.subjNBUCode},B.prototype.GetSubjSPFMCode=function(){return this.subjSPFMCode},B.prototype.GetSubjOCode=function(){return this.subjOCode},B.prototype.GetSubjOUCode=function(){return this.subjOUCode},B.prototype.GetSubjUserCode=function(){return this.subjUserCode},B.prototype.GetCertBeginTime=function(){return this.certBeginTime},B.prototype.GetCertEndTime=function(){return this.certEndTime},B.prototype.IsPrivKeyTimesAvail=function(){return this.isPrivKeyTimesAvail},B.prototype.GetPrivKeyBeginTime=function(){return this.privKeyBeginTime},B.prototype.GetPrivKeyEndTime=function(){return this.privKeyEndTime},B.prototype.GetPublicKeyType=function(){return this.publicKeyType},B.prototype.GetPublicKeyBits=function(){return this.publicKeyBits},B.prototype.GetRSAModul=function(){return this.RSAModul},B.prototype.GetRSAExponent=function(){return this.RSAExponent},B.prototype.GetPublicKey=function(){return this.publicKey},B.prototype.GetPublicKeyID=function(){return this.publicKeyID},B.prototype.GetExtKeyUsages=function(){return this.extKeyUsages},B.prototype.GetCRLDistribPoint1=function(){return this.crlDistribPoint1},B.prototype.GetCRLDistribPoint2=function(){return this.crlDistribPoint2},B.prototype.IsSubjTypeAvail=function(){return this.isSubjTypeAvail},B.prototype.GetSubjType=function(){return this.subjType},B.prototype.GetSubjSubType=function(){return this.subjSubType},B.prototype.IsSelfSigned=function(){return this.isSelfSigned},B.prototype.GetSignIssuer=function(){return this.signIssuer},B.prototype.GetSignSerial=function(){return this.signSerial},B.prototype.GetSubjUNZR=function(){return this.subjUNZR},B.prototype.GetSubjCountry=function(){return this.subjCountry},B.prototype.IsQSCD=function(){return this.isQSCD};var V=function(){this.setClassInfo(`EndUserInfo`,3),this.fields={commonName:`string`,locality:`string`,state:`string`,organization:`string`,orgUnit:`string`,title:`string`,street:`string`,phone:`string`,surname:`string`,givenname:`string`,EMail:`string`,DNS:`string`,EDRPOUCode:`string`,DRFOCode:`string`,NBUCode:`string`,SPFMCode:`string`,OCode:`string`,OUCode:`string`,userCode:`string`,UPN:`string`,UNZR:`string`,country:`string`},this.initializeFields()};h.makeTransferable(V),V.prototype.GetCommonName=function(){return this.commonName},V.prototype.SetCommonName=function(e){this.commonName=e},V.prototype.GetLocality=function(){return this.locality},V.prototype.SetLocality=function(e){this.locality=e},V.prototype.GetState=function(){return this.state},V.prototype.SetState=function(e){this.state=e},V.prototype.GetOrganization=function(){return this.organization},V.prototype.SetOrganization=function(e){this.organization=e},V.prototype.GetOrgUnit=function(){return this.orgUnit},V.prototype.SetOrgUnit=function(e){this.orgUnit=e},V.prototype.GetTitle=function(){return this.title},V.prototype.SetTitle=function(e){this.title=e},V.prototype.GetStreet=function(){return this.street},V.prototype.SetStreet=function(e){this.street=e},V.prototype.GetPhone=function(){return this.phone},V.prototype.SetPhone=function(e){this.phone=e},V.prototype.GetSurname=function(){return this.surname},V.prototype.SetSurname=function(e){this.surname=e},V.prototype.GetGivenname=function(){return this.givenname},V.prototype.SetGivenname=function(e){this.givenname=e},V.prototype.GetEMail=function(){return this.EMail},V.prototype.SetEMail=function(e){this.EMail=e},V.prototype.GetDNS=function(){return this.DNS},V.prototype.SetDNS=function(e){this.DNS=e},V.prototype.GetEDRPOUCode=function(){return this.EDRPOUCode},V.prototype.SetEDRPOUCode=function(e){this.EDRPOUCode=e},V.prototype.GetDRFOCode=function(){return this.DRFOCode},V.prototype.SetDRFOCode=function(e){this.DRFOCode=e},V.prototype.GetNBUCode=function(){return this.NBUCode},V.prototype.SetNBUCode=function(e){this.NBUCode=e},V.prototype.GetSPFMCode=function(){return this.SPFMCode},V.prototype.SetSPFMCode=function(e){this.SPFMCode=e},V.prototype.GetOCode=function(){return this.OCode},V.prototype.SetOCode=function(e){this.OCode=e},V.prototype.GetOUCode=function(){return this.OUCode},V.prototype.SetOUCode=function(e){this.OUCode=e},V.prototype.GetUserCode=function(){return this.userCode},V.prototype.SetUserCode=function(e){this.userCode=e},V.prototype.GetUPN=function(){return this.UPN},V.prototype.SetUPN=function(e){this.UPN=e},V.prototype.GetUNZR=function(){return this.UNZR},V.prototype.SetUNZR=function(e){this.UNZR=e},V.prototype.GetCountry=function(){return this.country},V.prototype.SetCountry=function(e){this.country=e};var H=function(){this.setClassInfo(`EndUserParams`,1),this.fields={SN:`number`,commonName:`string`,locality:`string`,state:`string`,organization:`string`,orgUnit:`string`,title:`string`,street:`string`,phone:`string`,surname:`string`,givenname:`string`,EMail:`string`,DNS:`string`,EDRPOUCode:`string`,DRFOCode:`string`,NBUCode:`string`,SPFMCode:`string`,information:`string`,passPhrase:`string`,isPublishCertificate:`boolean`,RAAdminSN:`number`},this.initializeFields()};h.makeTransferable(H),H.prototype.GetSN=function(){return this.SN},H.prototype.SetSN=function(e){this.SN=e},H.prototype.GetCommonName=function(){return this.commonName},H.prototype.SetCommonName=function(e){this.commonName=e},H.prototype.GetLocality=function(){return this.locality},H.prototype.SetLocality=function(e){this.locality=e},H.prototype.GetState=function(){return this.state},H.prototype.SetState=function(e){this.state=e},H.prototype.GetOrganization=function(){return this.organization},H.prototype.SetOrganization=function(e){this.organization=e},H.prototype.GetOrgUnit=function(){return this.orgUnit},H.prototype.SetOrgUnit=function(e){this.orgUnit=e},H.prototype.GetTitle=function(){return this.title},H.prototype.SetTitle=function(e){this.title=e},H.prototype.GetStreet=function(){return this.street},H.prototype.SetStreet=function(e){this.street=e},H.prototype.GetPhone=function(){return this.phone},H.prototype.SetPhone=function(e){this.phone=e},H.prototype.GetSurname=function(){return this.surname},H.prototype.SetSurname=function(e){this.surname=e},H.prototype.GetGivenname=function(){return this.givenname},H.prototype.SetGivenname=function(e){this.givenname=e},H.prototype.GetEMail=function(){return this.EMail},H.prototype.SetEMail=function(e){this.EMail=e},H.prototype.GetDNS=function(){return this.DNS},H.prototype.SetDNS=function(e){this.DNS=e},H.prototype.GetEDRPOUCode=function(){return this.EDRPOUCode},H.prototype.SetEDRPOUCode=function(e){this.EDRPOUCode=e},H.prototype.GetDRFOCode=function(){return this.DRFOCode},H.prototype.SetDRFOCode=function(e){this.DRFOCode=e},H.prototype.GetNBUCode=function(){return this.NBUCode},H.prototype.SetNBUCode=function(e){this.NBUCode=e},H.prototype.GetSPFMCode=function(){return this.SPFMCode},H.prototype.SetSPFMCode=function(e){this.SPFMCode=e},H.prototype.GetInformation=function(){return this.information},H.prototype.SetInformation=function(e){this.information=e},H.prototype.GetPassPhrase=function(){return this.passPhrase},H.prototype.SetPassPhrase=function(e){this.passPhrase=e},H.prototype.GetIsPublishCertificate=function(){return this.isPublishCertificate},H.prototype.SetIsPublishCertificate=function(e){this.isPublishCertificate=e},H.prototype.GetRAAdminSN=function(){return this.RAAdminSN},H.prototype.SetRAAdminSN=function(e){this.RAAdminSN=e};var ee=function(){this.setClassInfo(`EndUserOperationContext`,1),this.fields={handle:`string`},this.initializeFields(),this.handle=null};h.makeTransferable(ee),ee.prototype.GetHandle=function(){return this.handle};var U=function(){this.setClassInfo(`EndUserSession`,1),this.fields={handle:`string`,data:`byteArray`},this.initializeFields()};h.makeTransferable(U),U.prototype.GetHandle=function(){return this.handle},U.prototype.SetHandle=function(e){this.handle=e},U.prototype.GetData=function(){return this.data},U.prototype.SetData=function(e){this.data=e};var W=function(){this.setClassInfo(`EndUserSCClientStatistic`,1),this.fields={activeSessions:`number`,gatedSessions:`number`,unprotectedData:`number`,protectedData:`number`},this.initializeFields()};h.makeTransferable(W),W.prototype.GetActiveSessions=function(){return this.activeSessions},W.prototype.GetGatedSessions=function(){return this.gatedSessions},W.prototype.GetUnprotectedData=function(){return this.unprotectedData},W.prototype.GetProtectedData=function(){return this.protectedData};var G=function(){this.setClassInfo(`EndUserDeviceContext`,1),this.fields={handle:`string`},this.initializeFields(),this.handle=null};h.makeTransferable(G),G.prototype.GetHandle=function(){return this.handle};var K=function(){this.setClassInfo(`EndUserTransportHeader`,1),this.fields={receiptNumber:`number`,cryptoData:`byteArray`},this.initializeFields()};h.makeTransferable(K),K.prototype.GetReceiptNumber=function(){return this.receiptNumber},K.prototype.GetCryptoData=function(){return this.cryptoData};var q=function(){this.setClassInfo(`EndUserCryptoHeader`,1),this.fields={caType:`string`,headerType:`number`,headerSize:`number`,cryptoData:`byteArray`},this.initializeFields()};h.makeTransferable(q),q.prototype.GetCAType=function(){return this.caType},q.prototype.GetHeaderType=function(){return this.headerType},q.prototype.GetHeaderSize=function(){return this.headerSize},q.prototype.GetCryptoData=function(){return this.cryptoData};var J=function(){this.setClassInfo(`EndUserContext`,1),this.fields={handle:`string`},this.initializeFields()};h.makeTransferable(J),J.prototype.GetHandle=function(){return this.handle};var te=function(){this.setClassInfo(`EndUserHashContext`,1),this.fields={handle:`string`},this.initializeFields()};h.makeTransferable(te),te.prototype.GetHandle=function(){return this.handle};var ne=function(){this.setClassInfo(`EndUserPrivateKeyContext`,1),this.fields={handle:`string`,ownerInfo:`EndUserOwnerInfo`},this.initializeFields()};h.makeTransferable(ne),ne.prototype.GetHandle=function(){return this.handle},ne.prototype.GetOwnerInfo=function(){return this.ownerInfo};var Y=function(e,t){this.setClassInfo(`EndUserReference`,1),this.fields={name:`string`,data:`byteArray`},this.initializeFields(),this.name=e,this.data=t};h.makeTransferable(Y),Y.prototype.GetName=function(){return this.name},Y.prototype.SetName=function(e){this.name=e},Y.prototype.GetData=function(){return this.data},Y.prototype.SetData=function(e){this.data=e};var re=function(e,t,n,r,i){this.setClassInfo(`EndUserSSSignHashResult`,1),this.fields={error:`number`,hash:`string`,signature:`string`,statusCode:`number`,status:`string`},this.initializeFields(),this.error=e,this.hash=t,this.signature=n,this.statusCode=r,this.status=i};h.makeTransferable(re),re.prototype.GetError=function(){return this.error},re.prototype.GetHash=function(){return this.hash},re.prototype.GetSignature=function(){return this.signature},re.prototype.GetStatusCode=function(){return this.statusCode},re.prototype.GetStatus=function(){return this.status};var ie=function(){this.setClassInfo(`EndUserMakeCertificateResult`,1),this.fields={privateKey:`byteArray`,certificates:`array`,cmpRequest:`byteArray`},this.initializeFields()};h.makeTransferable(ie),ie.prototype.GetPrivateKey=function(){return this.privateKey},ie.prototype.GetCertificate=function(e){return e<0||e>=this.certificates.length?null:this.certificates[e]},ie.prototype.GetCertificatesCount=function(){return this.certificates.length},ie.prototype.GetCertificates=function(){return this.certificates},ie.prototype.GetCMPRequest=function(){return this.cmpRequest};var X=function(){this.setClassInfo(`EndUserKeyMediaDeviceInfo`,1),this.fields={version:`number`,deviceNameAlias:`string`,isDeviceNameAliasAvailable:`boolean`,isPasswordAttemptsAvailable:`boolean`,leftPasswordAttempts:`number`,maxPasswordAttempts:`number`,isUAKeysAvailable:`boolean`,isUAKeysExists:`boolean`},this.initializeFields()};h.makeTransferable(X),X.prototype.GetVersion=function(){return this.version},X.prototype.GetDeviceNameAlias=function(){return this.deviceNameAlias},X.prototype.IsDeviceNameAliasAvailable=function(){return this.isDeviceNameAliasAvailable},X.prototype.IsPasswordAttemptsAvailable=function(){return this.isPasswordAttemptsAvailable},X.prototype.GetLeftPasswordAttempts=function(){return this.leftPasswordAttempts},X.prototype.GetMaxPasswordAttempts=function(){return this.maxPasswordAttempts},X.prototype.IsUAKeysAvailable=function(){return this.isUAKeysAvailable},X.prototype.IsUAKeysExists=function(){return this.isUAKeysExists};var Z=function(e,t){this.errorCode=e,this.message=t,this.toString=function(){return this.message+` (`+this.errorCode+`)`},this.GetErrorCode=function(){return this.errorCode},this.GetMessage=function(){return this.message}};function Q(e,t){this.errorCode=e,this.message=t,this.toString=function(){return this.message+` (`+this.errorCode+`)`},this.GetErrorCode=function(){return this.errorCode},this.GetMessage=function(){return this.message}}Z.ERROR_NONE=0,Z.ERROR_UNKNOWN=65535,Z.ERROR_NOT_SUPPORTED=65534,Z.ERROR_NOT_INITIALIZED=1,Z.ERROR_BAD_PARAMETER=2,Z.ERROR_LIBRARY_LOAD=3,Z.ERROR_READ_SETTINGS=4,Z.ERROR_TRANSMIT_REQUEST=5,Z.ERROR_MEMORY_ALLOCATION=6,Z.WARNING_END_OF_ENUM=7,Z.ERROR_PROXY_NOT_AUTHORIZED=8,Z.ERROR_NO_GUI_DIALOGS=9,Z.ERROR_DOWNLOAD_FILE=10,Z.ERROR_WRITE_SETTINGS=11,Z.ERROR_CANCELED_BY_GUI=12,Z.ERROR_OFFLINE_MODE=13,Z.ERROR_KEY_MEDIAS_FAILED=17,Z.ERROR_KEY_MEDIAS_ACCESS_FAILED=18,Z.ERROR_KEY_MEDIAS_READ_FAILED=19,Z.ERROR_KEY_MEDIAS_WRITE_FAILED=20,Z.WARNING_KEY_MEDIAS_READ_ONLY=21,Z.ERROR_KEY_MEDIAS_DELETE=22,Z.ERROR_KEY_MEDIAS_CLEAR=23,Z.ERROR_BAD_PRIVATE_KEY=24,Z.ERROR_PKI_FORMATS_FAILED=33,Z.ERROR_CSP_FAILED=34,Z.ERROR_BAD_SIGNATURE=35,Z.ERROR_AUTH_FAILED=36,Z.ERROR_NOT_RECEIVER=37,Z.ERROR_STORAGE_FAILED=49,Z.ERROR_BAD_CERT=50,Z.ERROR_CERT_NOT_FOUND=51,Z.ERROR_INVALID_CERT_TIME=52,Z.ERROR_CERT_IN_CRL=53,Z.ERROR_BAD_CRL=54,Z.ERROR_NO_VALID_CRLS=55,Z.ERROR_GET_TIME_STAMP=65,Z.ERROR_BAD_TSP_RESPONSE=66,Z.ERROR_TSP_SERVER_CERT_NOT_FOUND=67,Z.ERROR_TSP_SERVER_CERT_INVALID=68,Z.ERROR_GET_OCSP_STATUS=81,Z.ERROR_BAD_OCSP_RESPONSE=82,Z.ERROR_CERT_BAD_BY_OCSP=83,Z.ERROR_OCSP_SERVER_CERT_NOT_FOUND=84,Z.ERROR_OCSP_SERVER_CERT_INVALID=85,Z.ERROR_LDAP_ERROR=97,Z.ERROR_LIBRARY_COMUNICATION_FAILED=4097,Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED=4098,Z.ERROR_BROWSER_NOT_SUPPORTED=65537,Z.ERROR_OPEN_FILE=65552,Z.ERROR_READ_FILE=65553,Z.ERROR_WRITE_FILE=65554,Z.ERROR_DESCRIPTIONS_EX=[],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_NONE]=[`Виконано успішно`,`Выполнено успешно`,`Executed successfully`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_NOT_SUPPORTED]=[`Операція не підтримується`,`Операция не поддерживается`,`Operation is not supported`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_UNKNOWN]=[`Невідома помилка`,`Неизвестная ошибка`,`Unknown error`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_LIBRARY_LOAD]=[`Виникла помилка при завантаженні криптографічної бібліотеки`,`Возникла ошибка при загрузке криптографической библиотеки`,`Error at load crypto library`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_NOT_INITIALIZED]=[`Бібліотека не ініціалізована`,`Библиотека не инициализирована`,`Library is not initialized`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_BAD_PARAMETER]=[`Невірний параметр`,`Неверный параметр`,`Incorrect parameter`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_BAD_CERT]=[`Сертифікат пошкоджений або не може бути використаний`,`Сертификат поврежден или не может быть использован`,`Certificate corrupted or cannot be used`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_CERT_NOT_FOUND]=[`Сертифікат не знайдено`,`Сертификат не найден`,`Certificate not found`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_TRANSMIT_REQUEST]=[`Виникла помилка при передачі запиту на сервер ЦСК за протоколом HTTP`,`Возникла ошибка при передаче запроса на сервер ЦСК по протоколу HTTP`,`Error at request transfer to CA's server by HTTP protocol`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_DOWNLOAD_FILE]=[`Виникла помилка при завантаженні файлу з HTTP-сервера`,`Возникла ошибка при загрузке файла с HTTP-сервера`,`Error at the load of file from a HTTP-server`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_WRITE_SETTINGS]=[`Виникла помилка при записі параметрів`,`Возникла ошибка при записи параметров`,`Error at the writing settings`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_PKI_FORMATS_FAILED]=[`Виникла помилка при розборі чи формуванні даних (пошкоджені дані чи невірний формат)`,`Возникла ошибка при разборе или формировании данных (поврежденные данные или неверный формат)`,`Error at parsing or generating data (data corrupted or wrong format)`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_LIBRARY_COMUNICATION_FAILED]=[`Виникла помилка при взаємодії з криптографічною бібліотекою`,`Возникла ошибка при взаимодействии с криптографической библиотекой`,`Error at comunication with crypto library`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED]=[`Встановлена версія бібліотеки не підтримується`,`Установленная версия библиотеки не поддерживается`,`The installed version of the library is not supported`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_BROWSER_NOT_SUPPORTED]=[`Ваш браузер не підтримується`,`Ваш браузер не поддерживается`,`Your browser is not supported`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_OPEN_FILE]=[`Виникла помилка при відкритті файлу`,`Возникла ошибка при открытии файла`,`Error at open file`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_READ_FILE]=[`Виникла помилка при зчитуванні файлу`,`Возникла ошибка при чтении файла`,`Error at read file`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_WRITE_FILE]=[`Виникла помилка при записі файлу`,`Возникла ошибка при записи файла`,`Error at write file`],Z.isError=function(e){return e!=Z.ERROR_NONE},Z.isSuccess=function(e){return e==Z.ERROR_NONE},Z.getErrorDescriptionEx=function(e,t){var n,r;return(n=Z.ERROR_DESCRIPTIONS_EX[e])===void 0&&(n=Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_UNKNOWN]),(r=n[t-1])===void 0?n[0]:r};var $=function(t,n){this.vendor=`JSC IIT`,this.classVersion=`1.3.99`,this.className=`EUSignCP`,this.SUBJECT_TYPE_UNDIFFERENCED=0,this.SUBJECT_TYPE_CA=1,this.SUBJECT_TYPE_CA_SERVER=2,this.SUBJECT_TYPE_RA_ADMINISTRATOR=3,this.SUBJECT_TYPE_END_USER=4,this.EU_SUBJECT_TYPE_UNDIFFERENCED=this.SUBJECT_TYPE_UNDIFFERENCED,this.EU_SUBJECT_TYPE_CA=this.SUBJECT_TYPE_CA,this.EU_SUBJECT_TYPE_CA_SERVER=this.SUBJECT_TYPE_CA_SERVER,this.EU_SUBJECT_TYPE_RA_ADMINISTRATOR=this.SUBJECT_TYPE_RA_ADMINISTRATOR,this.EU_SUBJECT_TYPE_END_USER=this.SUBJECT_TYPE_END_USER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED=0,this.SUBJECT_CA_SERVER_SUB_TYPE_CMP=1,this.SUBJECT_CA_SERVER_SUB_TYPE_TSP=2,this.SUBJECT_CA_SERVER_SUB_TYPE_OCSP=3,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED=this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_CMP=this.SUBJECT_CA_SERVER_SUB_TYPE_CMP,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_TSP=this.SUBJECT_CA_SERVER_SUB_TYPE_TSP,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_OCSP=this.SUBJECT_CA_SERVER_SUB_TYPE_OCSP,this.CERT_KEY_TYPE_UNKNOWN=0,this.CERT_KEY_TYPE_DSTU4145=1,this.CERT_KEY_TYPE_RSA=2,this.CERT_KEY_TYPE_ECDSA=4,this.EU_CERT_KEY_TYPE_UNKNOWN=this.CERT_KEY_TYPE_UNKNOWN,this.EU_CERT_KEY_TYPE_DSTU4145=this.CERT_KEY_TYPE_DSTU4145,this.EU_CERT_KEY_TYPE_RSA=this.CERT_KEY_TYPE_RSA,this.EU_CERT_KEY_TYPE_ECDSA=this.CERT_KEY_TYPE_ECDSA,this.EU_CERT_HASH_TYPE_UNKNOWN=0,this.EU_CERT_HASH_TYPE_GOST34311=1,this.EU_CERT_HASH_TYPE_SHA1=2,this.EU_CERT_HASH_TYPE_SHA224=3,this.EU_CERT_HASH_TYPE_SHA256=4,this.EU_CERT_HASH_TYPE_SHA384=5,this.EU_CERT_HASH_TYPE_SHA512=6,this.EU_CERT_HASH_TYPE_DSTU7564_256=7,this.EU_CERT_HASH_TYPE_DSTU7564_384=8,this.EU_CERT_HASH_TYPE_DSTU7564_512=9,this.KEY_USAGE_UNKNOWN=0,this.KEY_USAGE_DIGITAL_SIGNATUR=1,this.KEY_KEY_USAGE_KEY_AGREEMENT=16,this.EU_KEY_USAGE_UNKNOWN=this.KEY_USAGE_UNKNOWN,this.EU_KEY_USAGE_DIGITAL_SIGNATURE=this.KEY_USAGE_DIGITAL_SIGNATUR,this.EU_KEY_USAGE_NON_REPUDATION=2,this.EU_KEY_USAGE_KEY_AGREEMENT=this.KEY_KEY_USAGE_KEY_AGREEMENT,this.EU_KEYS_REQUEST_TYPE_UA_DS=1,this.EU_KEYS_REQUEST_TYPE_UA_KEP=2,this.EU_KEYS_REQUEST_TYPE_INTERNATIONAL=3,this.EU_KEYS_TYPE_NONE=0,this.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_GOSTS=1,this.EU_KEYS_TYPE_RSA_WITH_SHA=2,this.EU_KEYS_TYPE_ECDSA_WITH_SHA=4,this.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_DSTU=8,this.EU_KEYS_LENGTH_DS_UA_191=1,this.EU_KEYS_LENGTH_DS_UA_257=2,this.EU_KEYS_LENGTH_DS_UA_307=3,this.EU_KEYS_LENGTH_DS_UA_FILE=4,this.EU_KEYS_LENGTH_DS_UA_CERT=5,this.EU_KEYS_LENGTH_KEP_UA_257=1,this.EU_KEYS_LENGTH_KEP_UA_431=2,this.EU_KEYS_LENGTH_KEP_UA_571=3,this.EU_KEYS_LENGTH_KEP_UA_FILE=4,this.EU_KEYS_LENGTH_KEP_UA_CERT=5,this.EU_KEYS_LENGTH_DS_RSA_1024=1,this.EU_KEYS_LENGTH_DS_RSA_2048=2,this.EU_KEYS_LENGTH_DS_RSA_3072=3,this.EU_KEYS_LENGTH_DS_RSA_4096=4,this.EU_KEYS_LENGTH_DS_RSA_FILE=5,this.EU_KEYS_LENGTH_DS_RSA_CERT=6,this.EU_KEYS_LENGTH_DS_ECDSA_192=1,this.EU_KEYS_LENGTH_DS_ECDSA_256=2,this.EU_KEYS_LENGTH_DS_ECDSA_384=3,this.EU_KEYS_LENGTH_DS_ECDSA_521=4,this.EU_KEYS_LENGTH_DS_ECDSA_FILE=5,this.EU_KEYS_LENGTH_DS_ECDSA_CERT=6,this.EU_RECIPIENT_APPEND_ISSUER_AND_SERIAL=1,this.EU_RECIPIENT_APPEND_KEY_ID=2,this.EU_RECIPIENT_APPEND_KEY_ID_USC_COMPAT=3,this.EU_SAVE_SETTINGS_PARAMETER=`SaveSettings`,this.EU_RESOLVE_OIDS_PARAMETER=`ResolveOIDs`,this.EU_MAKE_PKEY_PFX_CONTAINER_PARAMETER=`MakePKeyPFXContainer`,this.EU_SIGN_INCLUDE_CONTENT_TIME_STAMP_PARAMETER=`SignIncludeContentTimeStamp`,this.EU_SIGN_TYPE_PARAMETER=`SignType`,this.EU_SIGN_INCLUDE_CA_CERTIFICATES_PARAMETER=`SignIncludeCACertificates`,this.EU_FS_CALCULATE_FINGERPRINT=`FSCalculateFingerprint`,this.EU_FORCE_USE_TSP_FROM_SETTINGS_PARAMETER=`ForceUseTSPFromSettings`,this.EU_STRING_ENCODING_PARAMETER=`StringEncoding`,this.EU_CHECK_CERT_CHAIN_ON_SIGN_TIME_PARAMETER=`CheckCertChainOnSignTime`,this.EU_CONNECTIONS_TIMEOUT_PARAMETER=`ConnectionsTimeout`,this.EU_LOG_EVENTS_THRESHOLD_PARAMETER=`LogEventsThreshold`,this.EU_USE_SLOGIN_PRIVATE_KEY=`UseSLoginPrivateKey`,this.EU_SETTINGS_ID_NONE=0,this.EU_SETTINGS_ID_MANDATORY=31,this.EU_SETTINGS_ID_ALL=1023,this.EU_SETTINGS_ID_FSTORE=1,this.EU_SETTINGS_ID_PROXY=2,this.EU_SETTINGS_ID_TSP=4,this.EU_SETTINGS_ID_OCSP=8,this.EU_SETTINGS_ID_LDAP=16,this.EU_SETTINGS_ID_MODE=32,this.EU_SETTINGS_ID_CMP=64,this.EU_SETTINGS_ID_KM=128,this.EU_SETTINGS_ID_OCSP_ACCESS_INFO_MODE=256,this.EU_SETTINGS_ID_OCSP_ACCESS_INFO=512,this.EU_SETTINGS_ID_TSL=1024,this.EU_SETTINGS_ID_LOG=2048,this.EU_HEADER_CA_TYPE=`UA1`,this.EU_HEADER_PART_TYPE_SIGNED=1,this.EU_HEADER_PART_TYPE_ENCRYPTED=2,this.EU_HEADER_PART_TYPE_STAMPED=3,this.EU_HEADER_PART_TYPE_CERTCRYPT=4,this.EU_HEADER_MAX_CA_TYPE_SIZE=3,this.EU_SIGNED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_SIGNED,this.EU_ENCRYPTED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_ENCRYPTED,this.EU_TIMESTAMPED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_STAMPED,this.EU_CERTCRYPT_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_CERTCRYPT,this.EU_DEFAULT_LANG=0,this.EU_UA_LANG=1,this.EU_RU_LANG=2,this.EU_EN_LANG=3,this.EU_CONTENT_ENC_ALGO_DEFAULT=0,this.EU_CONTENT_ENC_ALGO_GOST28147_CFB=2,this.EU_CONTENT_ENC_ALGO_TDES_CBC=4,this.EU_CONTENT_ENC_ALGO_AES_128_CBC=5,this.EU_CONTENT_ENC_ALGO_AES_192_CBC=6,this.EU_CONTENT_ENC_ALGO_AES_256_CBC=7,this.EU_CONTENT_ENC_ALGO_DSTU7624_256_OFB=8,this.EU_CONTENT_ENC_ALGO_DSTU7624_256_CFB=9,this.EU_DEV_CTX_MIN_PUBLIC_DATA_ID=16,this.EU_DEV_CTX_MAX_PRIVATE_DATA_ID=175,this.EU_UA_OID_EXT_KEY_USAGE_STAMP=`1.2.804.2.1.1.1.3.9`,this.EU_CCS_TYPE_REVOKE=1,this.EU_CCS_TYPE_HOLD=2,this.EU_REVOCATION_REASON_UNKNOWN=0,this.EU_REVOCATION_REASON_KEY_COMPROMISE=1,this.EU_REVOCATION_REASON_NEW_ISSURED=2,this.EU_SIGN_TYPE_UNKNOWN=0,this.EU_SIGN_TYPE_CADES_BES=1,this.EU_SIGN_TYPE_CADES_T=4,this.EU_SIGN_TYPE_CADES_C=8,this.EU_SIGN_TYPE_CADES_X_LONG=16,this.EU_SIGN_TYPE_CADES_X_LONG_TRUSTED=128,this.EU_CHECK_PRIVATE_KEY_CONTEXT_PARAMETER=`CheckPrivateKey`,this.EU_RESOLVE_OIDS_CONTEXT_PARAMETER=`ResolveOIDs`,this.EU_EXPORATABLE_CONTEXT_CONTEXT_PARAMETER=`ExportableContext`,this.EU_ENCODE_ECDSA_SIGN_VALUE_CONTEXT_PARAMETER=`EncodeECDSASignValue`,this.EU_USE_SLOGIN_PRIVATE_KEY_CONTEXT_PARAMETER=`UseSLoginPrivateKey`,this.EU_RECIPIENT_APPEND_TYPE_BY_ISSUER_SERIAL=1,this.EU_RECIPIENT_APPEND_TYPE_BY_KEY_ID=2,this.EU_CTX_HASH_ALGO_UNKNOWN=0,this.EU_CTX_HASH_ALGO_GOST34311=1,this.EU_CTX_HASH_ALGO_SHA160=2,this.EU_CTX_HASH_ALGO_SHA224=3,this.EU_CTX_HASH_ALGO_SHA256=4,this.EU_CTX_HASH_ALGO_SHA384=5,this.EU_CTX_HASH_ALGO_SHA512=6,this.EU_CTX_HASH_ALGO_DSTU7564_256=7,this.EU_CTX_HASH_ALGO_DSTU7564_384=8,this.EU_CTX_HASH_ALGO_DSTU7564_512=9,this.EU_CTX_SIGN_UNKNOWN=0,this.EU_CTX_SIGN_DSTU4145_WITH_GOST34311=1,this.EU_CTX_SIGN_RSA_WITH_SHA=2,this.EU_CTX_SIGN_ECDSA_WITH_SHA=3,this.EU_CTX_SIGN_DSTU4145_WITH_DSTU7564=4,this.EU_FILE_PROCESS_CHUNK_SIZE=1048576,this.EU_ASIC_TYPE_UNKNOWN=0,this.EU_ASIC_TYPE_S=1,this.EU_ASIC_TYPE_E=2,this.EU_ASIC_SIGN_TYPE_UNKNOWN=0,this.EU_ASIC_SIGN_TYPE_CADES=1,this.EU_ASIC_SIGN_TYPE_XADES=2,this.EU_ASIC_SIGN_LEVEL_BES=1,this.EU_ASIC_SIGN_LEVEL_T=4,this.EU_ASIC_SIGN_LEVEL_C=8,this.EU_ASIC_SIGN_LEVEL_X_LONG=16,this.EU_ASIC_SIGN_LEVEL_X_LONG_TRUSTED=128,this.EU_XADES_SIGN_TYPE_UNKNOWN=0,this.EU_XADES_TYPE_DETACHED=1,this.EU_XADES_TYPE_ENVELOPING=2,this.EU_XADES_TYPE_ENVELOPED=3,this.EU_XADES_SIGN_LEVEL_BES=1,this.EU_XADES_SIGN_LEVEL_T=4,this.EU_XADES_SIGN_LEVEL_B_LT=16,this.EU_XADES_SIGN_LEVEL_B_LTA=32,this.EU_PADES_SIGN_LEVEL_B_B=1,this.EU_PADES_SIGN_LEVEL_B_T=4,this.EU_PADES_SIGN_LEVEL_B_LT=16,this.EU_PADES_SIGN_LEVEL_B_LTA=32,this.EU_CP_ACP_ENCODING=0,this.EU_CP_1251_ENCODING=1251,this.EU_UTF8_ENCODING=65001,this.m_language=this.EU_DEFAULT_LANG,this.m_lastErrorCode=Z.ERROR_NONE,this.m_lastError=``,this.m_charset=`UTF-8`,this.m_stringCoder=new e,this.m_base64Coder=new a,this.m_dateCoder=new i,this.m_browserInfo=new s;var r=1;switch(t){case`chrome-extension://jffafkigfgmjafhpkoibhfefeaebmccg/`:r=2,this.m_browserInfo.GetName()==s.BROWSER_NAME_FIREFOX&&(t=`eusw@iit.com.ua`);break;case`clsid:B7E24C75-E343-4DA2-A8D3-C80970FB7D7B`:r=4;break;case`application/x-eusign-cp`:r=3}this.m_jsonRpcClient=new l(r,t,n,window.location.protocol!=`http:`),this.m_monitorLibraryTimer=null};return $.prototype._funcMakeParams=function(e){var t=[];e??=[];for(var n=function(e){if(m(e))return e.encode();if(Array.isArray(e)){for(var t=e.length,r=[],i=0;i<t;i++)r[i]=n(e[i]);return r}return e},r=e.length,i=0;i<r;i++)t[i]=n(e[i]);return t},$.prototype._funcCall=function(e,t,n,r,i){var a;if(!this.IsAsync(n,r))return a=this.m_jsonRpcClient.execute(e,t,null),a=this._funcHandleResult(a),i?i(a):a;var o=i==null?n:function(e){i(e,n,r)},s=this;this.m_jsonRpcClient.execute(e,t,function(e){s._funcHandleResult(e,o,r)})},$.prototype._funcHandleResult=function(e,t,n){var r,i,a=this.IsAsync(t,n);if(e==null){if(r=this.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``),a)return void n(r);throw new Q(r.errorCode,r.message)}if(i=(r=e.error).code,Z.isError(i)){if(i==Z.WARNING_END_OF_ENUM)return a?void t(null):null;if(r=this.MakeError(i,r.message),a)return void n(r);throw new Q(r.errorCode,r.message)}try{e=this._funcDecodeResult(e.result)}catch{if(r=this.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``),a)return void n(r);throw new Q(r.errorCode,r.message)}if(!a)return e;t(e)},$.prototype._funcDecodeResult=function(e){if(e==null)return null;var t=function(e){if(Array.isArray(e)){for(var n=[],r=e.length,i=0;i<r;i++)n[i]=t(e[i]);return n}if(typeof e==`object`){var a;return(a=new h[e.className]).decode(e)?a.className==`EndUserByteArray`?a.GetData():a:null}return e};return t(e)},$.prototype._checkVersion=function(e){try{var t=this.classVersion;if(t==e)return!0;if(t=t.split(`.`),e=e.split(`.`),t.length!=e.length)return!1;for(var n=0;n<e.length;n++)if(parseInt(t[n])>parseInt(e[n]))return!1}catch{return!1}return!0},$.prototype._stringToBytes=function(e,t){try{return this.m_stringCoder.encode(e)}catch{var n=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(t!==void 0)return setTimeout(function(){t(n)},1),null;throw new Q(n.errorCode,n.message)}},$.prototype._bytesToString=function(e,t){try{return this.m_stringCoder.decode(e)}catch{var n=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(t!==void 0)return setTimeout(function(){t(n)},1),null;throw new Q(n.errorCode,n.message)}},$.prototype._base64Encode=function(e,t){try{return this.m_base64Coder.encode(e)}catch{var n=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(t!==void 0)return setTimeout(function(){t(n)},1),null;throw new Q(n.errorCode,n.message)}},$.prototype._base64Decode=function(e,t){try{return this.m_base64Coder.decode(e)}catch{var n=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(t!==void 0)return setTimeout(function(){t(n)},1),null;throw new Q(n.errorCode,n.message)}},$.prototype._copyArrayData=function(e,t){try{if(e.length!=t.length)return!1;if(Array.isArray(t)||Array.isArray(e))for(var n=0;n<t.length;n++)e[n]=t[n];else e.set(t);return!0}catch{return!1}},$.prototype._startMonitorLibraryStatus=function(){var e=this;try{e.m_monitorLibraryTimer=setInterval(function(){e.IsInitialized(function(t){t||e._stopMonitorLibraryStatus()},function(t){e._stopMonitorLibraryStatus()})},6e5)}catch{}},$.prototype._stopMonitorLibraryStatus=function(){try{if(this.m_monitorLibraryTimer==null)return;clearInterval(this.m_monitorLibraryTimer),this.m_monitorLibraryTimer=null}catch{}},$.prototype._getAndroidAppIntentURL=function(e,t){var n=`intent://addurlandstart?url={URL_LOCATION}#Intent;scheme=saclient;package=ua.com.iit.signagentmanagement;S.browser_fallback_url={URL_INSTALL};end;`;return n=(n=n.replace(`{URL_LOCATION}`,encodeURIComponent(location.origin))).replace(`{URL_INSTALL}`,encodeURIComponent(e+`/`+t))},$.prototype.IsAsync=function(e,t){return e!==void 0&&t!==void 0},$.prototype.MakeError=function(e,t){return t==``&&(t=Z.getErrorDescriptionEx(e,this.m_language)),this.m_lastErrorCode=e,this.m_lastError=t,new Z(e,t)},$.prototype.RaiseError=function(e,t){var n;throw new Q((n=this.MakeError(e,t)).errorCode,n.message)},$.prototype.GetInstallURL=function(e,t){var n=this,r=n.m_browserInfo.GetOSName(),i=n.m_browserInfo.GetArch(),a=[];t||=`https://iit.com.ua/download/productfiles`;var o,c=function(e){a.push(t+`/`+e)};switch(r){case s.OS_NAME_WINDOWS:c(`EUSignWebInstall.exe`);break;case s.OS_NAME_MAC:c(`EUSignWebInstall.pkg`);break;case s.OS_NAME_LINUX:i==s.BROWSER_ARCH_NAME_X86?(c(`euswi.deb`),c(`euswi.rpm`),c(`euswi.tar`)):(c(`euswi.64.deb`),c(`euswi.64.rpm`),c(`euswi.64.tar`));break;case s.OS_NAME_ANDROID:o=`EUSignWebInstall.apk`,a.push(n._getAndroidAppIntentURL(t,o));break;case s.OS_NAME_IOS:c(`EUSignWebInstall.app`);break;default:return null}return e?a:a[0]},$.prototype.GetUpdateURL=function(e,t){var n=this,r=n.m_browserInfo.GetOSName(),i=n.m_browserInfo.GetArch(),a=[];t||=`https://iit.com.ua/download/productfiles`;var o,c=function(e){a.push(t+`/`+e)};switch(r){case s.OS_NAME_WINDOWS:c(`EUSignWebUpdate.exe`);break;case s.OS_NAME_MAC:c(`EUSignWebInstall.pkg`);break;case s.OS_NAME_LINUX:i==s.BROWSER_ARCH_NAME_X86?(c(`euswi.deb`),c(`euswi.rpm`),c(`euswi.tar`)):(c(`euswi.64.deb`),c(`euswi.64.rpm`),c(`euswi.64.tar`));break;case s.OS_NAME_ANDROID:o=`EUSignWebInstall.apk`,a.push(n._getAndroidAppIntentURL(t,o));break;case s.OS_NAME_IOS:c(`EUSignWebInstall.app`);break;default:return null}return e?a:a[0]},$.prototype.GetHelpURL=function(e){switch(e||=`https://iit.com.ua/download/productfiles`,this.m_browserInfo.GetOSName()){case s.OS_NAME_WINDOWS:case s.OS_NAME_MAC:case s.OS_NAME_LINUX:return e+`/EUSignWebOManual.pdf`;default:return null}},$.prototype.GetWebExtensionInstallURL=function(){switch(this.m_browserInfo.GetName()){case s.BROWSER_NAME_CHROME:return`https://chrome.google.com/webstore/detail/%D1%96%D1%96%D1%82-%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D1%83%D0%B2%D0%B0%D1%87-%D1%86%D1%81%D0%BA-1-%D0%B1%D1%96%D0%B1%D0%BB/jffafkigfgmjafhpkoibhfefeaebmccg?utm_source=chrome-app-launcher-info-dialog`;case s.BROWSER_NAME_FIREFOX:return`https://eu.iit.com.ua/download/productfiles/eusw@iit.com.ua.xpi`;case s.BROWSER_NAME_OPERA:return`https://chrome.google.com/webstore/detail/%D1%96%D1%96%D1%82-%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D1%83%D0%B2%D0%B0%D1%87-%D1%86%D1%81%D0%BA-1-%D0%B1%D1%96%D0%B1%D0%BB/jffafkigfgmjafhpkoibhfefeaebmccg?utm_source=chrome-app-launcher-info-dialog`;default:return null}},$.prototype.GetInstallPath=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetInstallPath`,n,e,t,null)},$.prototype.SelectFile=function(e,t,n,r){return this.SelectFileEx(e,t,null,null,null,null,n,r)},$.prototype.SelectFileEx=function(e,t,n,r,i,a,o,s){var c;return c=this._funcMakeParams([e,t,n,r,i,a]),this._funcCall(`SelectFile`,c,o,s,null)},$.prototype.SelectFolder=function(e,t){return this.SelectFolderEx(null,null,null,e,t)},$.prototype.SelectFolderEx=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`SelectFolder`,a,r,i,null)},$.prototype.CreateFolder=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`CreateFolder`,r,t,n,null)},$.prototype.ReadFile=function(e,t,n){var r=this.IsAsync(t,n),i=this,a=i.EU_FILE_PROCESS_CHUNK_SIZE;if(!r){for(var o,s=i.GetFileSize(e),c=Math.floor(s/a),l=s%a,u=new Uint8Array(s),d=0;d<c;d++)o=i.ReadFileWithOffset(e,d*a,a),u.set(o,d*a,o.length);return l!=0&&(o=i.ReadFileWithOffset(e,c*a,l),u.set(o,c*a,o.length)),u}var f={buf:null,length:0,curLength:0},p=function(r){if(r.curLength!=r.length){var o=r.length-r.curLength;o>a&&(o=a),i.ReadFileWithOffset(e,r.curLength,o,function(e){r.buf.set(e,r.curLength,e.length),r.curLength+=e.length,p(r)},n)}else t(r.buf)};i.GetFileSize(e,function(e){f.buf=new Uint8Array(e),f.length=e,p(f)},n)},$.prototype.WriteFile=function(e,t,n,r){var i=this.IsAsync(n,r),a=this,o=a.EU_FILE_PROCESS_CHUNK_SIZE;if(i){var s={buf:null,length:0,curLength:0},c=function(t,i){if(i||t.curLength!=t.length){var s=t.length-t.curLength;s>o&&(s=o),a.WriteFileWithOffset(e,t.curLength,a.Copy(t.buf,t.curLength,o),function(){t.curLength+=s,c(t,!1)},r)}else n()};s.buf=t,s.length=t.length,c(s,!0)}else{for(var l=t.length,u=Math.floor(l/o),d=l%o,f=0;f<u;f++)a.WriteFileWithOffset(e,f*o,a.Copy(t,f*o,o));d==0&&t.length!=0||a.WriteFileWithOffset(e,u*o,a.Copy(t,u*o,d))}},$.prototype.GetFileSize=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetFileSize`,r,t,n,null)},$.prototype.ReadFileWithOffset=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`ReadFileWithOffset`,a,r,i,null)},$.prototype.WriteFileWithOffset=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`WriteFileWithOffset`,a,r,i,null)},$.prototype.DeleteFile=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`DeleteFile`,r,t,n,null)},$.prototype.AppendFile=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`AppendFile`,i,n,r,null)},$.prototype.CopyFileWithOffset=function(e,t,n,r,i,a){var o=this._funcMakeParams([e,t,n,r]);this._funcCall(`CopyFileWithOffset`,o,i,a,null)},$.prototype.Load=function(e,t){var n=this.IsAsync(e,t),r=this;if(n)this.GetVersion(function(n){r._checkVersion(n)?e():t(r.MakeError(Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED,``))},function(e){e=r.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``),t(e)});else{var i;try{i=this._checkVersion(this.GetVersion())}catch{this.RaiseError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``)}i||this.RaiseError(Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED,``)}},$.prototype.GetVersion=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetVersion`,n,e,t,null)},$.prototype.IsInitialized=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`IsInitialized`,n,e,t,null)},$.prototype.Initialize=function(e,t){var n,r=this,i=this.IsAsync(e,t);n=this._funcMakeParams(null),this._funcCall(`Initialize`,n,i?function(){r._startMonitorLibraryStatus(),e()}:e,t,null),i||r._startMonitorLibraryStatus()},$.prototype.Finalize=function(e,t){var n;this._stopMonitorLibraryStatus(),n=this._funcMakeParams(null),this._funcCall(`Finalize`,n,e,t,null)},$.prototype.ResetOperation=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ResetOperation`,n,e,t,null)},$.prototype.SetUIMode=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetUIMode`,r,t,n,null)},$.prototype.SetLanguage=function(e,t,n){var r,i=this,a=this.IsAsync(t,n);r=this._funcMakeParams([e]),this._funcCall(`SetLanguage`,r,a?function(){i.m_language=e,t()}:t,n,null),a||(this.m_language=e)},$.prototype.SetCharset=function(e,t,n){var i,a=this.IsAsync(t,n);if((i=r.GetCoder(e))==null){var o=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(a)return void setTimeout(function(){n(o)},1);throw new Q(o.errorCode,o.message)}this.m_stringCoder=i,this.m_charset=e,a&&setTimeout(function(){t()},1)},$.prototype.SetRuntimeParameter=function(e,t,n,r){var i;typeof t==`boolean`&&(t=+!!t),i=this._funcMakeParams([e,t]),this._funcCall(`SetRuntimeParameter`,i,n,r,null)},$.prototype.GetStorageParameter=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetStorageParameter`,i,n,r,null)},$.prototype.SetStorageParameter=function(e,t,n,r,i){var a=this._funcMakeParams([e,t,n]);this._funcCall(`SetStorageParameter`,a,r,i,null)},$.prototype.CreateArrayList=function(){return new f},$.prototype.GetLastError=function(){return this.m_lastError},$.prototype.GetLastErrorCode=function(){return this.m_lastErrorCode},$.prototype.BASE64Encode=function(e,t,n){var r=this._base64Encode(e,n);if(!this.IsAsync(t,n))return r;setTimeout(function(){t(r)},1)},$.prototype.BASE64Decode=function(e,t,n){var r=this._base64Decode(e,n);if(!this.IsAsync(t,n))return r;setTimeout(function(){t(r)},1)},$.prototype.StringToBytes=function(e,t,n){var r=this._stringToBytes(e,n);if(!this.IsAsync(t,n))return r;setTimeout(function(){t(r)},1)},$.prototype.BytesToString=function(e,t,n){var r=this._bytesToString(e,n);if(!this.IsAsync(t,n))return r;setTimeout(function(){t(r)},1)},$.prototype.Concatenate=function(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.concat(t);var n,r=e.length+t.length;if(Array.isArray(e)||Array.isArray(t)){var i,a;for(n=Array(r),i=0;i<e.length;i++)n[i]=e[i];for(a=0;a<t.length;i++,a++)n[i]=t[a]}else(n=new p(r)).set(e),n.set(t,e.length);return n},$.prototype.Copy=function(e,t,n){return e.slice(t,t+n)},$.prototype.SetSettings=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`SetSettings`,n,e,t,null)},$.prototype.DoesNeedSetSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`DoesNeedSetSettings`,n,e,t,null)},$.prototype.InitializeMandatorySettings=function(e,t){var n=this;if(this.IsAsync(e,t))o(function(e){var r=n.CreateFileStoreSettings();n.SetFileStoreSettings(r,e,t)}).eu_wait(function(e){n.GetProxySettings(function(t){e()},function(r){n.GetSystemProxySettings(function(r){n.SetProxySettings(r,e,t)},function(r){var i=n.CreateProxySettings();n.SetProxySettings(i,e,t)})})}).eu_wait(function(e){var r=n.CreateTSPSettings();n.SetTSPSettings(r,e,t)}).eu_wait(function(e){var r=n.CreateLDAPSettings();n.SetLDAPSettings(r,e,t)}).eu_wait(function(){var r=n.CreateOCSPSettings();n.SetOCSPSettings(r,e,t)});else{var r,i=n.CreateFileStoreSettings();n.SetFileStoreSettings(i);try{r=n.GetProxySettings()}catch{r=n.CreateProxySettings();try{r=n.GetSystemProxySettings()}catch{}n.SetProxySettings(r)}var a=n.CreateTSPSettings();n.SetTSPSettings(a);var s=n.CreateLDAPSettings();n.SetLDAPSettings(s);var c=n.CreateOCSPSettings();n.SetOCSPSettings(c)}},$.prototype.CreateModeSettings=function(){return new w},$.prototype.GetModeSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetModeSettings`,n,e,t,null)},$.prototype.SetModeSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetModeSettings`,r,t,n,null)},$.prototype.CreateKeyMediaSettings=function(){return new D},$.prototype.GetKeyMediaSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetKeyMediaSettings`,n,e,t,null)},$.prototype.SetKeyMediaSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetKeyMediaSettings`,r,t,n,null)},$.prototype.CreateFileStoreSettings=function(){return new v},$.prototype.GetFileStoreSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetFileStoreSettings`,n,e,t,null)},$.prototype.SetFileStoreSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetFileStoreSettings`,r,t,n,null)},$.prototype.CreateProxySettings=function(){return new y},$.prototype.GetProxySettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetProxySettings`,n,e,t,null)},$.prototype.SetProxySettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetProxySettings`,r,t,n,null)},$.prototype.CreateOCSPSettings=function(){return new x},$.prototype.GetOCSPSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetOCSPSettings`,n,e,t,null)},$.prototype.SetOCSPSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetOCSPSettings`,r,t,n,null)},$.prototype.CreateOCSPAccessInfoModeSettings=function(){return new T},$.prototype.GetOCSPAccessInfoModeSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetOCSPAccessInfoModeSettings`,n,e,t,null)},$.prototype.SetOCSPAccessInfoModeSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetOCSPAccessInfoModeSettings`,r,t,n,null)},$.prototype.CreateOCSPAccessInfoSettings=function(){return new E},$.prototype.EnumOCSPAccessInfoSettings=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EnumOCSPAccessInfoSettings`,r,t,n,null)},$.prototype.GetOCSPAccessInfoSettings=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetOCSPAccessInfoSettings`,r,t,n,null)},$.prototype.SetOCSPAccessInfoSettings=function(e,t,n){var r,i=this,a=i.IsAsync(t,n);if(e=Array.isArray(e)?e:[e],a){var o=function(a){a>=e.length?t():(r=i._funcMakeParams([e[a]]),i._funcCall(`SetOCSPAccessInfoSettings`,r,function(){o(a+1)},n,null))};o(0)}else for(var s=0;s<e.length;s++)r=i._funcMakeParams([e[s]]),i._funcCall(`SetOCSPAccessInfoSettings`,r,t,n,null)},$.prototype.DeleteOCSPAccessInfoSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`DeleteOCSPAccessInfoSettings`,r,t,n,null)},$.prototype.CreateTSPSettings=function(){return new b},$.prototype.GetTSPSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetTSPSettings`,n,e,t,null)},$.prototype.SetTSPSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetTSPSettings`,r,t,n,null)},$.prototype.CreateLDAPSettings=function(){return new S},$.prototype.GetLDAPSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetLDAPSettings`,n,e,t,null)},$.prototype.SetLDAPSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetLDAPSettings`,r,t,n,null)},$.prototype.CreateCMPSettings=function(){return new C},$.prototype.GetCMPSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetCMPSettings`,n,e,t,null)},$.prototype.SetCMPSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetCMPSettings`,r,t,n,null)},$.prototype.GetSystemProxySettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetSystemProxySettings`,n,e,t,null)},$.prototype.SetOCSPResponseExpireTime=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetOCSPResponseExpireTime`,r,t,n,null)},$.prototype.CreateTSLSettings=function(){return new O},$.prototype.GetTSLSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetTSLSettings`,n,e,t,null)},$.prototype.SetTSLSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetTSLSettings`,r,t,n,null)},$.prototype.RefreshFileStore=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`RefreshFileStore`,r,t,n,null)},$.prototype.ShowCertificates=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ShowCertificates`,n,e,t,null)},$.prototype.SelectCertificateInfo=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`SelectCertificateInfo`,n,e,t,null)},$.prototype.GetCertificatesCount=function(e,t,n,r){var i;return typeof e==`number`&&typeof t==`number`||(n=e,r=t,e=this.SUBJECT_TYPE_UNDIFFERENCED,t=this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED),i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificatesCount`,i,n,r,null)},$.prototype.GetCACertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,e,t)},$.prototype.GetCAServerCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,e,t)},$.prototype.GetCMPServerCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_CMP,e,t)},$.prototype.GetOCSPServerCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_OCSP,e,t)},$.prototype.GetTSPServerCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_TSP,e,t)},$.prototype.GetRAAdministratorCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_RA_ADMINISTRATOR,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,e,t)},$.prototype.GetEndUserCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_END_USER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,e,t)},$.prototype.EnumCertificates=function(e,t,n,r,i){var a;return typeof t==`number`&&typeof n==`number`||(r=t,i=n,n=e,e=this.SUBJECT_TYPE_UNDIFFERENCED,t=this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED),a=this._funcMakeParams([e,t,n]),this._funcCall(`EnumCertificates`,a,r,i,null)},$.prototype.EnumCACertificates=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,t,n)},$.prototype.EnumCAServerCertificates=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,t,n)},$.prototype.EnumCMPServerCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_CMP,t,n)},$.prototype.EnumOCSPServerCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_OCSP,t,n)},$.prototype.EnumTSPServerCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_TSP,t,n)},$.prototype.EnumRAAdministratorCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_RA_ADMINISTRATOR,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,t,n)},$.prototype.EnumEndUserCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_END_USER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,t,n)},$.prototype.GetCertificateInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificateInfo`,i,n,r,null)},$.prototype.GetCertificateInfoEx=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificateInfoEx`,i,n,r,null)},$.prototype.GetCertificate=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificate`,i,n,r,null)},$.prototype.CheckCertificateByIssuerAndSerial=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`CheckCertificateByIssuerAndSerial`,i,n,r,null)},$.prototype.CheckCertificate=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`CheckCertificate`,r,t,n,null)},$.prototype.ParseCertificate=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ParseCertificate`,r,t,n,null)},$.prototype.ParseCertificateEx=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ParseCertificateEx`,r,t,n,null)},$.prototype.SaveCertificate=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`SaveCertificate`,r,t,n,null)},$.prototype.SaveCertificates=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`SaveCertificates`,r,t,n,null)},$.prototype.SaveCertificatesEx=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t?new g(t):null]),this._funcCall(`SaveCertificatesEx`,i,n,r,null)},$.prototype.GetCertificatesFromLDAPByEDRPOUCode=function(e,t,n,r,i,a,o){var s;return r!=null&&i!=null?(r.className==`EndUserArrayList`&&(r=r.m_array),i.className==`EndUserArrayList`&&(i=i.m_array)):(r=null,i=null),s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`GetCertificatesFromLDAPByEDRPOUCode`,s,a,o,null)},$.prototype.GetCertificateByEmail=function(e,t,n,r,i,a){var o;return typeof r!=`string`&&(r=this.m_dateCoder.encode(r)),o=this._funcMakeParams([e,t,n,r]),this._funcCall(`GetCertificateByEmail`,o,i,a,null)},$.prototype.GetCertificateByNBUCode=function(e,t,n,r,i,a){var o;return typeof r!=`string`&&(r=this.m_dateCoder.encode(r)),o=this._funcMakeParams([e,t,n,r]),this._funcCall(`GetCertificateByNBUCode`,o,i,a,null)},$.prototype.GetReceiversCertificates=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetReceiversCertificates`,n,e,t,null)},$.prototype.GetReceiversCertificatesInArrayList=function(e,t){var n,r=this;return n=this._funcMakeParams(null),this._funcCall(`GetReceiversCertificates`,n,e,t,function(e,t,n){var i=r.IsAsync(t,n);try{for(var a=new f,o=0;o<e.length;o++)a.add(e[o]);if(!i)return a;t(a)}catch{var s=r.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(i)return void n(s);throw new Q(s.errorCode,s.message)}})},$.prototype.GetCertificates=function(e,t,n,r){var i,a=this;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificates`,i,n,r,function(e,t,n){var r=a.IsAsync(t,n);try{for(var i=new f,o=0;o<e.length;o++)i.add(e[o]);if(!r)return i;t(i)}catch{var s=a.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(s);throw new Q(s.errorCode,s.message)}})},$.prototype.GetCertificateByFingerprint=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetCertificateByFingerprint`,r,t,n,null)},$.prototype.GetCertificatesByEDRPOUAndDRFOCode=function(e,t,n,r){var i,a=this;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificatesByEDRPOUAndDRFOCode`,i,n,r,function(e,t,n){var r=a.IsAsync(t,n);try{for(var i=new f,o=0;o<e.length;o++)i.add(e[o]);if(!r)return i;t(i)}catch{var s=a.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(s);throw new Q(s.errorCode,s.message)}})},$.prototype.ShowCRLs=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ShowCRLs`,n,e,t,null)},$.prototype.GetCRLsCount=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetCRLsCount`,n,e,t,null)},$.prototype.EnumCRLs=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EnumCRLs`,r,t,n,null)},$.prototype.GetCRLDetailedInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,parseInt(t)]),this._funcCall(`GetCRLDetailedInfo`,i,n,r,null)},$.prototype.SaveCRL=function(e,t,n,r){var i;return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SaveCRL`,i,n,r,null)},$.prototype.GetTSPByAccessInfo=function(e,t,n,r,i,a){var o;if(typeof t==`string`||(t=this._base64Encode(t,a))!=null)return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`GetTSPByAccessInfo`,o,i,a,null)},$.prototype.CheckTSP=function(e,t,n,r,i){var a;typeof e==`string`&&(e=this._base64Decode(e,i))==null||n!=null&&typeof n!=`string`&&(n=this._base64Encode(n,i))==null||(a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`CheckTSP`,a,r,i,null))},$.prototype.GetOCSPResponseByAccessInfo=function(e,t,n,r,i){var a;return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`GetOCSPResponseByAccessInfo`,a,r,i,null)},$.prototype.CheckOCSPResponse=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._base64Decode(e,r))!=null)return t!=null&&typeof t!=`string`&&(t=this.m_dateCoder.encode(t)),i=this._funcMakeParams([new g(e),t]),this._funcCall(`CheckOCSPResponse`,i,n,r,null)},$.prototype.CreateKeyMedia=function(){return new _},$.prototype.GetPrivateKeyMedia=function(e,t,n){var r;return typeof e!=`string`&&(e=null),r=this._funcMakeParams([e]),this._funcCall(`GetPrivateKeyMedia`,r,t,n,null)},$.prototype.EnumKeyMediaTypes=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EnumKeyMediaTypes`,r,t,n,null)},$.prototype.EnumKeyMediaDevices=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`EnumKeyMediaDevices`,i,n,r,null)},$.prototype.GetKeyMediaTypes=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetKeyMediaTypes`,n,e,t,null)},$.prototype.GetKeyMediaDevices=function(e,t,n){var r;return typeof e==`number`&&(e=[e]),e&&=new g(e),r=this._funcMakeParams([e]),this._funcCall(`GetKeyMediaDevices`,r,t,n,null)},$.prototype.GetKeyMediaDeviceInfo=function(e,t,n,r){var i,a;return typeof e==`number`?((a=new _).typeIndex=e,a.devIndex=t,a.password=``):(a=e,r=n,n=t),i=this._funcMakeParams([a]),this._funcCall(`GetKeyMediaDeviceInfo`,i,n,r,null)},$.prototype.IsPrivateKeyReaded=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`IsPrivateKeyReaded`,n,e,t,null)},$.prototype.ReadPrivateKey=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ReadPrivateKey`,n,e,t,null)},$.prototype.ReadPrivateKeySilently=function(e,t,n,r,i){var a,o;typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=e,r=t,i=n),a=this._funcMakeParams([o]),this._funcCall(`ReadPrivateKeySilently`,a,r,i,null)},$.prototype.ReadPrivateKeyBinary=function(e,t,n,r){var i=this._funcMakeParams([new g(e),t]);this._funcCall(`ReadPrivateKeyBinary`,i,n,r,null)},$.prototype.ReadPrivateKeyFile=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`ReadPrivateKeyFile`,i,n,r,null)},$.prototype.CtxReadPrivateKey=function(e,t,n,r,i,a){var o,s;return typeof t==`number`?((s=new _).typeIndex=t,s.devIndex=n,s.password=r):(s=t,i=n,a=r),o=this._funcMakeParams([e,s]),this._funcCall(`CtxReadPrivateKey`,o,i,a,null)},$.prototype.CtxReadPrivateKeyBinary=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,new g(t),n]),this._funcCall(`CtxReadPrivateKeyBinary`,a,r,i,null)},$.prototype.ResetPrivateKey=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ResetPrivateKey`,n,e,t,null)},$.prototype.CtxFreePrivateKey=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`CtxFreePrivateKey`,r,t,n,null)},$.prototype.ShowOwnCertificate=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ShowOwnCertificate`,n,e,t,null)},$.prototype.GetOwnCertificate=function(e,t,n,r){var i;return typeof e==`number`&&typeof t==`number`||(n=e,r=t,e=null,t=null),i=this._funcMakeParams([e,t]),this._funcCall(`GetOwnCertificate`,i,n,r,null)},$.prototype.EnumOwnCertificates=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EnumOwnCertificates`,r,t,n,null)},$.prototype.GetPrivateKeyOwnerInfo=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetPrivateKeyOwnerInfo`,n,e,t,null)},$.prototype.CtxEnumOwnCertificates=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`CtxEnumOwnCertificates`,i,n,r,null)},$.prototype.CtxGetOwnCertificate=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxGetOwnCertificate`,a,r,i,null)},$.prototype.GetKeyInfo=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetKeyInfo`,r,t,n,null)},$.prototype.GetKeyInfoSilently=function(e,t,n,r,i){var a;return(a=new _).typeIndex=e,a.devIndex=t,a.password=n,this.GetKeyInfo(a,r,i)},$.prototype.GetKeyInfoBinary=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`GetKeyInfoBinary`,i,n,r,null)},$.prototype.GetKeyInfoFile=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetKeyInfoFile`,i,n,r,null)},$.prototype.GetCertificateByKeyInfo=function(e,t,n,r){var i,a=[];return typeof e==`number`&&typeof t==`number`||(r=n,n=t),typeof e==`number`&&typeof t==`number`?(a.push(e),a.push(t),a.push(null)):(a.push(null),a.push(null),a.push(new g(e))),i=this._funcMakeParams(a),this._funcCall(`GetCertificateByKeyInfo`,i,n,r,null)},$.prototype.GetCertificatesByKeyInfo=function(e,t,n,r,i){var a;return e.className==`EndUserPrivateKeyInfo`&&(e=e.GetPrivateKeyInfo()),t!=null&&n!=null?(t.className==`EndUserArrayList`&&(t=t.m_array),n.className==`EndUserArrayList`&&(n=n.m_array)):(t=null,n=null),a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`GetCertificatesByKeyInfo`,a,r,i,null)},$.prototype.ChangeSoftwarePrivateKeyPassword=function(e,t,n,r,i){var a;return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`ChangeSoftwarePrivateKeyPassword`,a,r,i,null)},$.prototype.EnumJKSPrivateKeys=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`EnumJKSPrivateKeys`,i,n,r,null)},$.prototype.EnumJKSPrivateKeysFile=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`EnumJKSPrivateKeysFile`,i,n,r,null)},$.prototype.GetJKSPrivateKey=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`GetJKSPrivateKey`,i,n,r,null)},$.prototype.GetJKSPrivateKeyFile=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetJKSPrivateKeyFile`,i,n,r,null)},$.prototype.CreatePrivateKeyInfo=function(){return new R},$.prototype.CreateEndUserInfo=function(){return new V},$.prototype._generatePrivateKey=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){if(!this.IsAsync(m,h))return this.GeneratePrivateKeyEx(e,t,n,r,!1,i,a,o,s,c,l,u,d,null,null,f,p,m,h).m_array;this.GeneratePrivateKeyEx(e,t,n,r,!1,i,a,o,s,c,l,u,d,null,null,f,p,function(e){m(e.m_array)},h)},$.prototype.GeneratePrivateKey=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){if(typeof e==`boolean`)return this._generatePrivateKeyEx(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h);if(typeof n==`boolean`)return this._generatePrivateKey(!0,0,0,``,e,t,n,r,i,a,o,s,null,!1,c,l);if(typeof n==`string`)return this._generatePrivateKey(!1,e,t,n,r,i,a,o,s,c,l,u,null,!1,d,f);if(typeof n==`number`)return this._generatePrivateKey(!1,0,0,e,t,n,r,i,a,o,s,c,l,!0,u,d);var g=this.MakeError(Z.ERROR_BAD_PARAMETER,``);throw new Q(g.errorCode,g.message)},$.prototype._generatePrivateKeyEx=function(e,t,n,r,i,a,o,s,c,l,u,d,p,m,h,g,v,y,b){var x,S,C=this;return e?S=null:((S=new _).typeIndex=t,S.devIndex=n,S.password=typeof r==`string`?r:``),g??(v=!1),x=this._funcMakeParams([e,S,i,a,o,s,c,l,u,d,p,m,h,g!=null,v]),this._funcCall(`GeneratePrivateKeyEx`,x,y,b,function(e,t,n){var r=C.IsAsync(t,n);try{for(var i=e[0],a=new f,o=0;o<i.length;o++)a.add(i[o]);if(g?.set(e[1]),!r)return a;t(a)}catch{var s=C.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(s);throw new Q(s.errorCode,s.message)}})},$.prototype.GeneratePrivateKeyEx=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){if(typeof e==`boolean`)return typeof i==`boolean`?this._generatePrivateKeyEx(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v):this._generatePrivateKeyEx(e,t,n,r,!1,i,a,o,s,c,l,u,d,null,null,f,p,m,h);if(typeof n==`boolean`)return l!==void 0&&l==null||typeof l==`string`?this._generatePrivateKeyEx(!0,0,0,``,!1,e,t,n,r,i,a,o,s,c,l,null,!1,u,d):this._generatePrivateKeyEx(!0,0,0,``,!1,e,t,n,r,i,a,o,s,null,null,null,!1,c,l);if(typeof e==`number`)return typeof r==`boolean`?this._generatePrivateKeyEx(!1,e,t,n,r,i,a,o,s,c,l,u,d,f,p,null,!1,m,h):this._generatePrivateKeyEx(!1,e,t,n,!1,r,i,a,o,s,c,l,u,null,null,null,!1,d,f);if(typeof e==`string`)return u!==void 0&&u==null||typeof u==`string`?this._generatePrivateKeyEx(!1,0,0,e,!1,t,n,r,i,a,o,s,c,l,u,d,!0,f,p):this._generatePrivateKeyEx(!1,0,0,e,!1,t,n,r,i,a,o,s,c,null,null,l,!0,u,d);var y=this.MakeError(Z.ERROR_BAD_PARAMETER,``);throw new Q(y.errorCode,y.message)},$.prototype.GetCRInfo=function(e,t,n,r,i){var a;return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`GetCRInfo`,a,r,i,null)},$.prototype.IsHardwareKeyMedia=function(e,t,n,r,i){var a,o;return typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=null,r=e,i=t),a=this._funcMakeParams([o]),this._funcCall(`IsHardwareKeyMedia`,a,r,i,null)},$.prototype.IsPrivateKeyExists=function(e,t,n,r,i){var a,o;return typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=null,r=e,i=t),a=this._funcMakeParams([o]),this._funcCall(`IsPrivateKeyExists`,a,r,i,null)},$.prototype.ChangePrivateKeyPassword=function(e,t,n,r,i,a){var o,s;typeof e==`number`?((s=new _).typeIndex=e,s.devIndex=t,s.password=n):(s=null,r=null,i=e,a=t),o=this._funcMakeParams([s,r]),this._funcCall(`ChangePrivateKeyPassword`,o,i,a,null)},$.prototype.BackupPrivateKey=function(e,t,n,r,i,a,o,s){var c,l,u;typeof e==`number`?((l=new _).typeIndex=e,l.devIndex=t,l.password=n,(u=new _).typeIndex=r,u.devIndex=i,u.password=a):(l=null,u=null,o=e,s=t),c=this._funcMakeParams([l,u]),this._funcCall(`BackupPrivateKey`,c,o,s,null)},$.prototype.DestroyPrivateKey=function(e,t,n,r,i){var a,o;typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=null,r=e,i=t),a=this._funcMakeParams([o]),this._funcCall(`DestroyPrivateKey`,a,r,i,null)},$.prototype.SetKeyMediaPassword=function(e,t,n,r,i){var a,o;typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=null,r=e,i=t),a=this._funcMakeParams([o]),this._funcCall(`SetKeyMediaPassword`,a,r,i,null)},$.prototype.SetKeyMediaUserPassword=function(e,t,n,r,i,a){var o,s;typeof t==`number`?((s=new _).typeIndex=t,s.devIndex=n,s.password=r):(s=null,i=t,a=n),o=this._funcMakeParams([e,s]),this._funcCall(`SetKeyMediaUserPassword`,o,i,a,null)},$.prototype.ChangeOwnCertificatesStatus=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`ChangeOwnCertificatesStatus`,i,n,r,null)},$.prototype.CtxChangeOwnCertificatesStatus=function(e,t,n,r,i){var a=this._funcMakeParams([e,t,n]);this._funcCall(`CtxChangeOwnCertificatesStatus`,a,r,i,null)},$.prototype.MakeNewCertificate=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){var h;return t!=null&&(t=new g(t)),h=this._funcMakeParams([e,t,n,r,i,a,o,s,c,l,u,d,f]),this._funcCall(`MakeNewCertificate`,h,p,m,null)},$.prototype.MakeNewCertificateEx=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,_){var v;return t!=null&&(t=new g(t)),v=this._funcMakeParams([e,t,n,r,i,a,o,s,c,l,u,d,f,p,m]),this._funcCall(`MakeNewCertificateEx`,v,h,_,null)},$.prototype.MakeNewOwnCertificate=function(e,t,n,r,i,a,o,s,c,l){var u;return u=this._funcMakeParams([e,t,n,r,i,a,o,s]),this._funcCall(`MakeNewOwnCertificate`,u,c,l,null)},$.prototype.CtxMakeNewOwnCertificate=function(e,t,n,r,i,a,o,s,c,l,u){var d;return d=this._funcMakeParams([e,t,n,r,i,a,o,s,c]),this._funcCall(`CtxMakeNewOwnCertificate`,d,l,u,null)},$.prototype.CtxMakeNewOwnCertificateEx=function(e,t,n,r,i,a,o,s,c,l,u,d,f){var p;return p=this._funcMakeParams([e,t,n,r,i,a,o,s,c,l,u]),this._funcCall(`CtxMakeNewOwnCertificateEx`,p,d,f,null)},$.prototype.CtxMakeNewOwnCertificateWithCR=function(e,t,n,r,i,a,o){var s;return t!=null&&(t=new g(t)),n!=null&&(n=new g(n)),r!=null&&(r=new g(r)),i!=null&&(i=new g(i)),s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`CtxMakeNewOwnCertificateWithCR`,s,a,o,null)},$.prototype.CtxMakeDeviceCertificate=function(e,t,n,r,i,a,o,s,c,l){var u;return n!=null&&(n=new g(n)),r!=null&&(r=new g(r)),i!=null&&(i=new g(i)),a!=null&&(a=new g(a)),u=this._funcMakeParams([e,t,n,r,i,a,o,s]),this._funcCall(`CtxMakeDeviceCertificate`,u,c,l,null)},$.prototype.GetOwnEUserParams=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetOwnEUserParams`,n,e,t,null)},$.prototype.ModifyOwnEUserParams=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`ModifyOwnEUserParams`,i,n,r,null)},$.prototype.CtxGetOwnEUserParams=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`CtxGetOwnEUserParams`,r,t,n,null)},$.prototype.CtxModifyOwnEUserParams=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxModifyOwnEUserParams`,a,r,i,null)},$.prototype.Hash=function(e,t,n){var r;if(typeof e!=`string`||(e=this._stringToBytes(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`Hash`,r,t,n,null)},$.prototype.ContinueHash=function(e,t,n,r,i){var a;typeof t==`number`&&typeof n==`number`||(r=t,i=n),typeof e==`string`&&(e=this._stringToBytes(e,i))==null||(typeof t==`number`&&typeof n==`number`&&(e=e.slice(t,t+n)),a=this._funcMakeParams([new g(e)]),this._funcCall(`ContinueHash`,a,r,i,null))},$.prototype.EndHash=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`EndHash`,n,e,t,null)},$.prototype.HashWithParams=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([new g(e),new g(t)]),this._funcCall(`HashWithParams`,i,n,r,null)},$.prototype.HashBeginWithParams=function(e,t,n){var r=this._funcMakeParams([new g(e)]);this._funcCall(`HashBeginWithParams`,r,t,n,null)},$.prototype.HashFile=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`HashFile`,r,t,n,null)},$.prototype.HashFileWithParams=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`HashFileWithParams`,i,n,r,null)},$.prototype.CtxHash=function(e,t,n,r,i,a){var s=this,c=this.IsAsync(i,a),l=s.EU_FILE_PROCESS_CHUNK_SIZE;if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null){if(c){var u={hashContext:null,hash:null},d=function(e){u.hashContext==null?a(e):s.CtxHashFree(u.hashContext,function(){a(e)},function(){a(e)})};o(function(r){s.CtxHashBegin(e,t,n,r,d)}).eu_wait(function(e,t){u.hashContext=t;var n=function(i){if(i>=r.length)s.CtxHashEnd(t,e,d);else{var a=r.length-i;a>l&&(a=l);var o=r.slice(i,i+a);s.CtxHashContinue(t,o,function(){n(i+a)},d)}};n(0)}).eu_wait(function(e,t){u.hash=t,s.CtxHashFree(u.hashContext,e,a)}).eu_wait(function(){i(u.hash)})}else{var f=null;try{var p,m=0;for(f=s.CtxHashBegin(e,t,n);;){var h=r.length-m;h>l&&(h=l);var g=r.slice(m,m+h);if(s.CtxHashContinue(f,g),!((m+=h)<r.length))break}return p=s.CtxHashEnd(f),s.CtxHashFree(f),f=null,p}catch(e){throw f!=null&&s.CtxHashFree(f),e}}}},$.prototype.CtxHashBegin=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n?new g(n):null]),this._funcCall(`CtxHashBegin`,a,r,i,null)},$.prototype.CtxHashContinue=function(e,t,n,r){var i=this._funcMakeParams([e,new g(t)]);this._funcCall(`CtxHashContinue`,i,n,r,null)},$.prototype.CtxHashEnd=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`CtxHashEnd`,r,t,n,null)},$.prototype.CtxHashFree=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`CtxHashFree`,r,t,n,null)},$.prototype.ShowSignInfo=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`ShowSignInfo`,r,t,n,null)},$.prototype.IsSigned=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`IsSigned`,r,t,n,null)},$.prototype.IsSignedFile=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsSignedFile`,r,t,n,null)},$.prototype.GetSignType=function(e,t,n,r){var i;if(typeof t==`string`||(t=this._base64Encode(t,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`GetSignType`,i,n,r,null)},$.prototype.GetFileSignType=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetFileSignType`,i,n,r,null)},$.prototype.GetSignsCount=function(e,t,n){var r;if(typeof e==`string`||(e=this._base64Encode(e,n))!=null)return r=this._funcMakeParams([e]),this._funcCall(`GetSignsCount`,r,t,n,null)},$.prototype.GetSignerInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetSignerInfo`,i,n,r,null)},$.prototype.GetSignerCertificate=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetSignerCertificate`,i,n,r,null)},$.prototype.GetFileSignsCount=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetFileSignsCount`,r,t,n,null)},$.prototype.GetFileSignerInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetFileSignerInfo`,i,n,r,null)},$.prototype.GetFileSignerCertificate=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetFileSignerCertificate`,i,n,r,null)},$.prototype.CtxGetSignerInfo=function(e,t,n,r,i){var a;if(typeof n==`string`||(n=this._base64Encode(n,i))!=null)return a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxGetSignerInfo`,a,r,i,null)},$.prototype.Sign=function(e,t,n){var r;if(typeof e!=`string`||(e=this._stringToBytes(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`Sign`,r,t,n,null)},$.prototype.Verify=function(e,t,n,r,i){var a,o=[];if(typeof n!=`boolean`&&(i=r,r=n),typeof t!=`string`||(t=this._stringToBytes(t,i))!=null)return o.push(e),o.push(new g(t)),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`Verify`,a,r,i,null)},$.prototype.ContinueSign=function(e,t,n,r,i){var a;typeof t==`number`&&typeof n==`number`||(r=t,i=n),typeof e==`string`&&(e=this._stringToBytes(e,i))==null||(typeof t==`number`&&typeof n==`number`&&(e=e.slice(t,t+n)),a=this._funcMakeParams([new g(e)]),this._funcCall(`ContinueSign`,a,r,i,null))},$.prototype.EndSign=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`EndSign`,n,e,t,null)},$.prototype.BeginVerify=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`BeginVerify`,r,t,n,null)},$.prototype.ContinueVerify=function(e,t,n,r,i){var a;typeof t==`number`&&typeof n==`number`||(r=t,i=n),typeof e==`string`&&(e=this._stringToBytes(e,i))==null||(typeof t==`number`&&typeof n==`number`&&(e=e.slice(t,t+n)),a=this._funcMakeParams([new g(e)]),this._funcCall(`ContinueVerify`,a,r,i,null))},$.prototype.EndVerify=function(e,t,n){var r,i=[];return typeof e!=`boolean`&&(n=t,t=e),typeof e==`boolean`?i.push(null):i.push(e),r=this._funcMakeParams(i),this._funcCall(`EndVerify`,r,t,n,null)},$.prototype.SignHash=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`SignHash`,r,t,n,null)},$.prototype.VerifyHash=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`VerifyHash`,a,r,i,null)},$.prototype.SignInternal=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SignInternal`,i,n,r,null)},$.prototype.VerifyInternal=function(e,t,n,r){var i,a=[];return typeof t!=`boolean`&&(r=n,n=t),a.push(e),typeof t==`boolean`?a.push(t):a.push(null),i=this._funcMakeParams(a),this._funcCall(`VerifyInternal`,i,n,r,null)},$.prototype.VerifyInternalString=function(e,t,n,r){var i=this;if(typeof t!=`boolean`&&(r=n,n=t),!this.IsAsync(n,r)){var a=this.VerifyInternal(e,t);return this.BytesToString(a)}this.VerifyInternal(e,t,function(e){i.BytesToString(e,n,r)},r)},$.prototype.SignFile=function(e,t,n,r,i){var a=this._funcMakeParams([e,t,n]);this._funcCall(`SignFile`,a,r,i,null)},$.prototype.VerifyFile=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`VerifyFile`,a,r,i,null)},$.prototype.VerifyFileWithExternalSign=function(e,t,n,r,i){return this.VerifyFile(t,e,n,r,i)},$.prototype.VerifyFileWithInternalSign=function(e,t,n,r,i){return this.VerifyFile(e,t,n,r,i)},$.prototype.IsAlreadySigned=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsAlreadySigned`,r,t,n,null)},$.prototype.IsFileAlreadySigned=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsFileAlreadySigned`,r,t,n,null)},$.prototype.AppendSign=function(e,t,n,r){var i;if(!(typeof e==`string`&&(e=this._stringToBytes(e,r))==null||typeof t!=`string`&&(t=this._base64Encode(t,r))==null))return i=this._funcMakeParams([new g(e),t]),this._funcCall(`AppendSign`,i,n,r,null)},$.prototype.VerifySpecific=function(e,t,n,r,i,a){var o,s=[];if(typeof r!=`boolean`&&(a=i,i=r),typeof t!=`string`||(t=this._stringToBytes(t,a))!=null)return s.push(e),s.push(new g(t)),s.push(n),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`VerifySpecific`,o,i,a,null)},$.prototype.AppendSignBegin=function(e,t,n){var r;typeof e!=`string`&&(e=this._base64Encode(e,n))==null||(r=this._funcMakeParams([e]),this._funcCall(`AppendSignBegin`,r,t,n,null))},$.prototype.VerifyDataSpecificBegin=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`VerifyDataSpecificBegin`,i,n,r,null)},$.prototype.AppendSignHash=function(e,t,n,r){var i;if(!(typeof e!=`string`&&(e=this._base64Encode(e,r))==null||typeof t!=`string`&&(t=this._base64Encode(t,r))==null))return i=this._funcMakeParams([e,t]),this._funcCall(`AppendSignHash`,i,n,r,null)},$.prototype.VerifyHashSpecific=function(e,t,n,r,i,a){var o,s=[];return typeof r!=`boolean`&&(a=i,i=r),s.push(e),s.push(t),s.push(n),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`VerifyHashSpecific`,o,i,a,null)},$.prototype.AppendSignInternal=function(e,t,n,r){var i;if(typeof t==`string`||(t=this._base64Encode(t,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`AppendSignInternal`,i,n,r,null)},$.prototype.VerifySpecificInternal=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`VerifySpecificInternal`,a,r,i,null)},$.prototype.VerifySpecificInternalString=function(e,t,n,r,i){var a=this;if(typeof n!=`boolean`&&(i=r,r=n),!this.IsAsync(r,i)){var o=this.VerifySpecificInternal(e,t,n);return this.BytesToString(o)}this.VerifySpecificInternal(e,t,n,function(e){a.BytesToString(e,r,i)},i)},$.prototype.AppendSignFile=function(e,t,n,r,i,a){var o;return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`AppendSignFile`,o,i,a,null)},$.prototype.VerifyFileSpecific=function(e,t,n,r,i,a){var o,s=[];return typeof r!=`boolean`&&(a=i,i=r),s.push(e),s.push(t),s.push(n),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`VerifyFileSpecific`,o,i,a,null)},$.prototype.VerifyFileWithExternalSignSpecific=function(e,t,n,r,i,a){return this.VerifyFileSpecific(e,t,n,r,i,a)},$.prototype.VerifyFileWithInternalSignSpecific=function(e,t,n,r,i,a){return this.VerifyFileSpecific(e,t,n,r,i,a)},$.prototype.CreateEmptySign=function(e,t,n){var r,i=[];if(arguments.length==2&&(n=t,t=e),typeof e!=`string`||(e=this._stringToBytes(e,n))!=null)return arguments.length==1||arguments.length==3?i.push(new g(e)):i.push(null),r=this._funcMakeParams(i),this._funcCall(`CreateEmptySign`,r,t,n,null)},$.prototype.CreateSigner=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`CreateSigner`,r,t,n,null)},$.prototype.CreateSignerEx=function(e,t,n,r,i){var a;if(typeof e==`string`||(e=this._base64Encode(e,i))!=null)return a=this._funcMakeParams([e,t,n]),this._funcCall(`CreateSignerEx`,a,r,i,null)},$.prototype.AppendSigner=function(e,t,n,r,i){var a,o=[];return o.push(e),t==null?o.push(null):o.push(new g(t)),o.push(n),a=this._funcMakeParams(o),this._funcCall(`AppendSigner`,a,r,i,null)},$.prototype.AppendValidationDataToSignerEx=function(e,t,n,r,i){var a,o=[];if(typeof e==`string`||(e=this._base64Encode(e,i))!=null)return o.push(e),t==null?o.push(null):o.push(new g(t)),o.push(n),a=this._funcMakeParams(o),this._funcCall(`AppendValidationDataToSignerEx`,a,r,i,null)},$.prototype.IsDataInSignedDataAvailable=function(e,t,n){var r;if(typeof e==`string`||(e=this._base64Encode(e,n))!=null)return r=this._funcMakeParams([e]),this._funcCall(`IsDataInSignedDataAvailable`,r,t,n,null)},$.prototype.IsDataInSignedFileAvailable=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsDataInSignedFileAvailable`,r,t,n,null)},$.prototype.GetDataFromSignedData=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetDataFromSignedData`,r,t,n,null)},$.prototype.GetDataFromSignedFile=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`GetDataFromSignedFile`,i,n,r,null)},$.prototype.GetCertificateFromSignedData=function(e,t,n,r){var i;if(typeof t==`string`||(t=this._base64Encode(t,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificateFromSignedData`,i,n,r,null)},$.prototype.GetCertificateFromSignedFile=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificateFromSignedFile`,i,n,r,null)},$.prototype.GetSignTimeInfo=function(e,t,n,r){var i;if(typeof t==`string`||(t=this._base64Encode(t,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`GetSignTimeInfo`,i,n,r,null)},$.prototype.GetFileSignTimeInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetFileSignTimeInfo`,i,n,r,null)},$.prototype.VerifyHashOnTime=function(e,t,n,r,i,a,o){return this.VerifyHashOnTimeEx(e,t,n,r,r!=null,!1,i,a,o)},$.prototype.VerifyHashOnTimeEx=function(e,t,n,r,i,a,o,s,c){var l,u=[];if(typeof o!=`boolean`&&(c=s,s=o),!(typeof e!=`string`&&(e=this._base64Encode(e,c))==null||typeof n!=`string`&&(n=this._base64Encode(n,c))==null))return u=[e,t,n,r,i,a],typeof o==`boolean`?u.push(o):u.push(null),l=this._funcMakeParams(u),this._funcCall(`VerifyHashOnTimeEx`,l,s,c,null)},$.prototype.VerifyDataOnTime=function(e,t,n,r,i,a,o){return this.VerifyDataOnTimeEx(e,t,n,r,r!=null,!1,i,a,o)},$.prototype.VerifyDataOnTimeEx=function(e,t,n,r,i,a,o,s,c){var l,u=[];if(typeof o!=`boolean`&&(c=s,s=o),!(typeof e==`string`&&(e=this._stringToBytes(e,c))==null||typeof n!=`string`&&(n=this._base64Encode(n,c))==null))return u=[new g(e),t,n,r,i,a],typeof o==`boolean`?u.push(o):u.push(null),l=this._funcMakeParams(u),this._funcCall(`VerifyDataOnTimeEx`,l,s,c,null)},$.prototype.VerifyDataInternalOnTime=function(e,t,n,r,i,a){return this.VerifyDataInternalOnTimeEx(e,t,n,n!=null,!1,r,i,a)},$.prototype.VerifyDataInternalOnTimeEx=function(e,t,n,r,i,a,o,s){var c,l=[];if(typeof a!=`boolean`&&(s=o,o=a),typeof e==`string`||(e=this._base64Encode(e,s))!=null)return l=[e,t,n,r,i],typeof a==`boolean`?l.push(a):l.push(null),c=this._funcMakeParams(l),this._funcCall(`VerifyDataInternalOnTimeEx`,c,o,s,null)},$.prototype.VerifyDataInternalOnTimeString=function(e,t,n,r,i,a){return this.VerifyDataInternalOnTimeStringEx(e,t,n,n!=null,!1,r,i,a)},$.prototype.VerifyDataInternalOnTimeStringEx=function(e,t,n,r,i,a,o,s){var c=this;if(typeof a!=`boolean`&&(s=o,o=a),!this.IsAsync(o,s)){var l=this.VerifyDataInternalOnTimeEx(e,t,n,r,i,a);return this.BytesToString(l)}this.VerifyDataInternalOnTimeEx(e,t,n,r,i,a,function(e){c.BytesToString(e,o,s)},s)},$.prototype.VerifyDataOnTimeBegin=function(e,t,n,r,i){this.VerifyDataOnTimeBeginEx(e,t,n,n!=null,!1,r,i)},$.prototype.VerifyDataOnTimeBeginEx=function(e,t,n,r,i,a,o){var s=this._funcMakeParams([e,t,n,r,i]);this._funcCall(`VerifyDataOnTimeBeginEx`,s,a,o,null)},$.prototype.VerifyFileOnTime=function(e,t,n,r,i,a,o,s,c){var l,u=[];return typeof o!=`boolean`&&(c=s,s=o),u=[e,t,n,r,i,a],typeof o==`boolean`?u.push(o):u.push(null),l=this._funcMakeParams(u),this._funcCall(`VerifyFileOnTimeEx`,l,s,c,null)},$.prototype.VerifyFileWithExternalSignOnTime=function(e,t,n,r,i,a,o){return this.VerifyFileOnTime(e,n,t,r,r!=null,!1,i,a,o)},$.prototype.VerifyFileWithExternalSignOnTimeEx=function(e,t,n,r,i,a,o,s,c){return this.VerifyFileOnTime(e,n,t,r,i,a,o,s,c)},$.prototype.VerifyFileWithInternalSignOnTime=function(e,t,n,r,i,a,o){return this.VerifyFileOnTime(e,t,n,r,r!=null,!1,i,a,o)},$.prototype.VerifyFileWithInternalSignOnTimeEx=function(e,t,n,r,i,a,o,s,c){return this.VerifyFileOnTime(e,n,t,r,i,a,o,s,c)},$.prototype.ContinueSignCtx=function(e,t,n,r){var i;if(e??=new ee,typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ContinueSignCtx`,i,n,r,null)},$.prototype.ContinueSignCtxWithOffset=function(e,t,n,r,i,a){return t=t.slice(n,n+r),this.ContinueSignCtx(e,t,i,a)},$.prototype.EndSignCtx=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`EndSignCtx`,i,n,r,null)},$.prototype.BeginVerifyCtx=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`BeginVerifyCtx`,r,t,n,null)},$.prototype.ContinueVerifyCtx=function(e,t,n,r,i,a){var o;typeof n==`number`&&typeof r==`number`||(i=n,a=r),typeof t==`string`&&(t=this._stringToBytes(t,a))==null||(typeof n==`number`&&typeof r==`number`&&(t=t.slice(n,n+r)),o=this._funcMakeParams([e,new g(t)]),this._funcCall(`ContinueVerifyCtx`,o,i,a,null))},$.prototype.EndVerifyCtx=function(e,t,n,r){var i,a=[];return typeof t!=`boolean`&&(r=n=t),a.push(e),typeof t==`boolean`?a.push(t):a.push(null),i=this._funcMakeParams(a),this._funcCall(`EndVerifyCtx`,i,n,r,null)},$.prototype.ResetOperationCtx=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`ResetOperationCtx`,r,t,n,null)},$.prototype.SignHashRSA=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`SignHashRSA`,r,t,n,null)},$.prototype.SignRSA=function(e,t,n,r,i){var a;if(typeof e!=`string`||(e=this._stringToBytes(e,i))!=null)return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`SignRSA`,a,r,i,null)},$.prototype.ContinueRSASign=function(e,t,n){var r;typeof e==`string`&&(e=this._stringToBytes(e,n))==null||(r=this._funcMakeParams([new g(e)]),this._funcCall(`ContinueRSASign`,r,t,n,null))},$.prototype.ContinueRSASignWithOffset=function(e,t,n,r,i){return e=e.slice(t,t+n),this.ContinueRSASign(e,r,i)},$.prototype.EndRSASign=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EndRSASign`,r,t,n,null)},$.prototype.SignRSAFile=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`SignRSAFile`,a,r,i,null)},$.prototype.ContinueRSASignCtx=function(e,t,n,r){var i;if(e??=new ee,typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ContinueRSASignCtx`,i,n,r,null)},$.prototype.ContinueRSASignCtxWithOffset=function(e,t,n,r,i,a){return t=t.slice(n,n+r),this.ContinueRSASignCtx(t,i,a)},$.prototype.EndRSASignCtx=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`EndRSASignCtx`,i,n,r,null)},$.prototype.SignECDSA=function(e,t,n,r,i){var a;if(typeof e!=`string`||(e=this._stringToBytes(e,i))!=null)return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`SignECDSA`,a,r,i,null)},$.prototype.RawSign=function(e,t,n){var r;if(typeof e!=`string`||(e=this._stringToBytes(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`RawSign`,r,t,n,null)},$.prototype.RawVerify=function(e,t,n,r,i){var a,o=[];if(typeof n!=`boolean`&&(i=r,r=n),typeof t!=`string`||(t=this._stringToBytes(t,i))!=null)return o.push(e),o.push(new g(t)),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`RawVerify`,a,r,i,null)},$.prototype.RawSignHash=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`RawSignHash`,r,t,n,null)},$.prototype.RawVerifyHash=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`RawVerifyHash`,a,r,i,null)},$.prototype.RawSignFile=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`RawSignFile`,i,n,r,null)},$.prototype.RawVerifyFile=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`RawVerifyFile`,a,r,i,null)},$.prototype.NBUSign=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._stringToBytes(e,r))!=null)return i=this._funcMakeParams([new g(e),t]),this._funcCall(`NBUSign`,i,n,r,null)},$.prototype.NBUVerify=function(e,t,n,r,i,a,o){var s,c=[];if(typeof i!=`boolean`&&(o=a,a=i),typeof n!=`string`||(n=this._stringToBytes(n,o))!=null)return c.push(e),c.push(t),c.push(new g(n)),c.push(r),typeof i==`boolean`?c.push(i):c.push(null),s=this._funcMakeParams(c),this._funcCall(`NBUVerify`,s,a,o,null)},$.prototype.CtxSignHash=function(e,t,n,r,i,a){var o;if(typeof n==`string`||(n=this._base64Encode(n,a))!=null)return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`CtxSignHash`,o,i,a,null)},$.prototype.CtxSign=function(e,t,n,r,i,a,o){var s;if(typeof n!=`string`||(n=this._stringToBytes(n,o))!=null)return s=this._funcMakeParams([e,t,new g(n),r,i]),this._funcCall(`CtxSign`,s,a,o,null)},$.prototype.CtxSignFile=function(e,t,n,r,i,a,o,s){var c=this._funcMakeParams([e,t,n,r,i,a]);this._funcCall(`CtxSignFile`,c,o,s,null)},$.prototype.CtxAppendSignHash=function(e,t,n,r,i,a,o){var s;if(!(typeof n!=`string`&&(n=this._base64Encode(n,o))==null||typeof r!=`string`&&(r=this._base64Encode(r,o))==null))return s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`CtxAppendSignHash`,s,a,o,null)},$.prototype.CtxAppendSign=function(e,t,n,r,i,a,o){var s;if(!(n!=null&&typeof n==`string`&&(n=this._stringToBytes(n,o))==null||typeof r!=`string`&&(r=this._base64Encode(r,o))==null))return s=this._funcMakeParams([e,t,n?new g(n):null,r,i]),this._funcCall(`CtxAppendSign`,s,a,o,null)},$.prototype.CtxAppendSignFile=function(e,t,n,r,i,a,o,s){var c=this._funcMakeParams([e,t,n,r,i,a]);this._funcCall(`CtxAppendSignFile`,c,o,s,null)},$.prototype.CtxGetSignValue=function(e,t,n,r,i){var a;if(typeof n==`string`||(n=this._base64Encode(n,i))!=null)return a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxGetSignValue`,a,r,i,null)},$.prototype.CtxCreateSignerEx=function(e,t,n,r,i,a,o){var s;if(typeof n==`string`||(n=this._base64Encode(n,o))!=null)return s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`CtxCreateSignerEx`,s,a,o,null)},$.prototype.ShowSenderInfo=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`ShowSenderInfo`,r,t,n,null)},$.prototype.IsEnveloped=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`IsEnveloped`,r,t,n,null)},$.prototype.IsEnvelopedFile=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsEnvelopedFile`,r,t,n,null)},$.prototype.Envelop=function(e,t,n,r,i,a){var o;if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([e,t,n,new g(r)]),this._funcCall(`Envelop`,o,i,a,null)},$.prototype.Develop=function(e,t,n,r){var i,a=[];if(typeof t!=`boolean`&&(r=n,n=t),typeof e==`string`||(e=this._base64Encode(e,r))!=null)return a.push(e),typeof t==`boolean`?a.push(t):a.push(null),i=this._funcMakeParams(a),this._funcCall(`Develop`,i,n,r,null)},$.prototype.EnvelopFile=function(e,t,n,r,i,a,o){var s=this._funcMakeParams([e,t,n,r,i]);this._funcCall(`EnvelopFile`,s,a,o,null)},$.prototype.DevelopFile=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`DevelopFile`,a,r,i,null)},$.prototype.EnvelopEx=function(e,t,n,r,i,a){var o;if(e.className==`EndUserArrayList`&&(e=e.m_array),t.className==`EndUserArrayList`&&(t=t.m_array),typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([e,t,n,new g(r)]),this._funcCall(`EnvelopEx`,o,i,a,null)},$.prototype.DevelopEx=function(e,t,n,r,i){var a,o=[];if(typeof n!=`boolean`&&(i=r,r=n),typeof e==`string`||(e=this._base64Encode(e,i))!=null)return o.push(e),o.push(t?new g(t):null),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`DevelopEx`,a,r,i,null)},$.prototype.EnvelopFileEx=function(e,t,n,r,i,a,o){var s;e.className==`EndUserArrayList`&&(e=e.m_array),t.className==`EndUserArrayList`&&(t=t.m_array),s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`EnvelopFileEx`,s,a,o,null)},$.prototype.EnvelopToRecipients=function(e,t,n,r,i){var a;e.className==`EndUserArrayList`&&(e=e.m_array);for(var o=[],s=0;s<e.length;s++)o.push(new g(e[s]));if(typeof n!=`string`||(n=this._stringToBytes(n,i))!=null)return a=this._funcMakeParams([o,t,new g(n)]),this._funcCall(`EnvelopToRecipients`,a,r,i,null)},$.prototype.EnvelopFileToRecipients=function(e,t,n,r,i,a){var o;e.className==`EndUserArrayList`&&(e=e.m_array);for(var s=[],c=0;c<e.length;c++)s.push(new g(e[c]));o=this._funcMakeParams([s,t,n,r]),this._funcCall(`EnvelopFileToRecipients`,o,i,a,null)},$.prototype.EnvelopToRecipientsEx=function(e,t,n,r,i,a){var o;e.className==`EndUserArrayList`&&(e=e.m_array);for(var s=[],c=0;c<e.length;c++)s.push(new g(e[c]));if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([s,t,n,new g(r)]),this._funcCall(`EnvelopToRecipientsEx`,o,i,a,null)},$.prototype.EnvelopFileToRecipientsEx=function(e,t,n,r,i,a,o){var s;e.className==`EndUserArrayList`&&(e=e.m_array);for(var c=[],l=0;l<e.length;l++)c.push(new g(e[l]));s=this._funcMakeParams([c,t,n,r,i]),this._funcCall(`EnvelopFileToRecipientsEx`,s,a,o,null)},$.prototype.EnvelopToRecipientsWithOCode=function(e,t,n,r,i,a){var o;if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([e,t,n,new g(r)]),this._funcCall(`EnvelopToRecipientsWithOCode`,o,i,a,null)},$.prototype.EnvelopExWithDynamicKey=function(e,t,n,r,i,a,o){var s;if(e.className==`EndUserArrayList`&&(e=e.m_array),t.className==`EndUserArrayList`&&(t=t.m_array),typeof i!=`string`||(i=this._stringToBytes(i,o))!=null)return s=this._funcMakeParams([e,t,n,r,new g(i)]),this._funcCall(`EnvelopExWithDynamicKey`,s,a,o,null)},$.prototype.EnvelopFileExWithDynamicKey=function(e,t,n,r,i,a,o,s){var c;e.className==`EndUserArrayList`&&(e=e.m_array),t.className==`EndUserArrayList`&&(t=t.m_array),c=this._funcMakeParams([e,t,n,r,i,a]),this._funcCall(`EnvelopFileExWithDynamicKey`,c,o,s,null)},$.prototype.EnvelopToRecipientsWithDynamicKey=function(e,t,n,r,i,a){var o;e.className==`EndUserArrayList`&&(e=e.m_array);for(var s=[],c=0;c<e.length;c++)s.push(new g(e[c]));if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([s,t,n,new g(r)]),this._funcCall(`EnvelopToRecipientsWithDynamicKey`,o,i,a,null)},$.prototype.EnvelopFileToRecipientsWithDynamicKey=function(e,t,n,r,i,a,o){var s;e.className==`EndUserArrayList`&&(e=e.m_array);for(var c=[],l=0;l<e.length;l++)c.push(new g(e[l]));s=this._funcMakeParams([c,t,n,r,i]),this._funcCall(`EnvelopFileToRecipientsWithDynamicKey`,s,a,o,null)},$.prototype.EnvelopToRecipientsWithSettings=function(e,t,n,r,i,a,o,s,c){var l;if(typeof n!=`string`||(n=this._stringToBytes(n,c))!=null){e.className==`EndUserArrayList`&&(e=e.m_array);for(var u=[],d=0;d<e.length;d++)u.push(new g(e[d]));return l=this._funcMakeParams([u,t,new g(n),r,i,a,o]),this._funcCall(`EnvelopToRecipientsWithSettings`,l,s,c,null)}},$.prototype.RawEnvelop=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([new g(e),new g(t)]),this._funcCall(`RawEnvelop`,i,n,r,null)},$.prototype.RawDevelop=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`RawDevelop`,i,n,r,null)},$.prototype.EnvelopRSA=function(e,t,n,r,i,a,o){return this.EnvelopRSAEx(e,[t],[n],r,i,a,o)},$.prototype.EnvelopFileRSA=function(e,t,n,r,i,a,o,s){this.EnvelopFileRSAEx(e,[t],[n],r,i,a,o,s)},$.prototype.EnvelopRSAEx=function(e,t,n,r,i,a,o){var s;if(t.className==`EndUserArrayList`&&(t=t.m_array),n.className==`EndUserArrayList`&&(n=n.m_array),typeof i!=`string`||(i=this._stringToBytes(i,o))!=null)return s=this._funcMakeParams([e,t,n,r,new g(i)]),this._funcCall(`EnvelopRSAEx`,s,a,o,null)},$.prototype.EnvelopFileRSAEx=function(e,t,n,r,i,a,o,s){var c;t.className==`EndUserArrayList`&&(t=t.m_array),n.className==`EndUserArrayList`&&(n=n.m_array),c=this._funcMakeParams([e,t,n,r,i,a]),this._funcCall(`EnvelopFileRSAEx`,c,o,s,null)},$.prototype.EnvelopToRecipientsRSA=function(e,t,n,r,i,a){var o;t.className==`EndUserArrayList`&&(t=t.m_array);for(var s=[],c=0;c<t.length;c++)s.push(new g(t[c]));if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([e,s,n,new g(r)]),this._funcCall(`EnvelopToRecipientsRSA`,o,i,a,null)},$.prototype.EnvelopFileToRecipientsRSA=function(e,t,n,r,i,a,o){var s;t.className==`EndUserArrayList`&&(t=t.m_array);for(var c=[],l=0;l<t.length;l++)c.push(new g(t[l]));s=this._funcMakeParams([e,c,n,r,i]),this._funcCall(`EnvelopFileToRecipientsRSA`,s,a,o,null)},$.prototype.CtxEnvelop=function(e,t,n,r,i,a,o,s){var c;if(typeof a!=`string`||(a=this._stringToBytes(a,s))!=null){t.className==`EndUserArrayList`&&(t=t.m_array);for(var l=[],u=0;u<t.length;u++)l.push(new g(t[u]));return c=this._funcMakeParams([e,l,n,r,i,new g(a)]),this._funcCall(`CtxEnvelop`,c,o,s,null)}},$.prototype.CtxEnvelopFile=function(e,t,n,r,i,a,o,s,c){var l;t.className==`EndUserArrayList`&&(t=t.m_array);for(var u=[],d=0;d<t.length;d++)u.push(new g(t[d]));l=this._funcMakeParams([e,u,n,r,i,a,o]),this._funcCall(`CtxEnvelopFile`,l,s,c,null)},$.prototype.CtxEnvelopWithDynamicKey=function(e,t,n,r,i,a,o,s){var c;if(typeof a!=`string`||(a=this._stringToBytes(a,s))!=null){t.className==`EndUserArrayList`&&(t=t.m_array);for(var l=[],u=0;u<t.length;u++)l.push(new g(t[u]));return c=this._funcMakeParams([e,l,n,r,i,new g(a)]),this._funcCall(`CtxEnvelopWithDynamicKey`,c,o,s,null)}},$.prototype.CtxEnvelopFileWithDynamicKey=function(e,t,n,r,i,a,o,s,c){var l;t.className==`EndUserArrayList`&&(t=t.m_array);for(var u=[],d=0;d<t.length;d++)u.push(new g(t[d]));l=this._funcMakeParams([e,u,n,r,i,a,o]),this._funcCall(`CtxEnvelopFileWithDynamicKey`,l,s,c,null)},$.prototype.CtxDevelop=function(e,t,n,r,i,a){var o,s=[];if(typeof r!=`boolean`&&(a=i,i=r),typeof t==`string`||(t=this._base64Encode(t,a))!=null)return s.push(e),s.push(t),s.push(n?new g(n):null),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`CtxDevelop`,o,i,a,null)},$.prototype.CtxDevelopFile=function(e,t,n,r,i,a,o){var s,c=[];return typeof i!=`boolean`&&(o=a,a=i),c.push(e),c.push(t),c.push(n?new g(n):null),c.push(r),typeof i==`boolean`?c.push(i):c.push(null),s=this._funcMakeParams(c),this._funcCall(`CtxDevelopFile`,s,a,o,null)},$.prototype.CtxCreateAuthData=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._stringToBytes(n,i))!=null)return a=this._funcMakeParams([e,new g(t),new g(n)]),this._funcCall(`CtxCreateAuthData`,a,r,i,null)},$.prototype.ProtectDataByPassword=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._stringToBytes(e,r))!=null)return i=this._funcMakeParams([new g(e),t]),this._funcCall(`ProtectDataByPassword`,i,n,r,null)},$.prototype.UnprotectDataByPassword=function(e,t,n,r){var i;if(typeof e==`string`||(e=this._base64Encode(e,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`UnprotectDataByPassword`,i,n,r,null)},$.prototype.CreateEndUserSession=function(){return new U},$.prototype.SessionIsInitialized=function(e,t,n){var r;return e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionIsInitialized`,r,t,n,null)},$.prototype.SessionClose=function(e,t,n){var r;e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionClose`,r,t,n,null)},$.prototype.ClientSessionCreateStep1=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`ClientSessionCreateStep1`,r,t,n,null)},$.prototype.ServerSessionCreateStep1=function(e,t,n,r){var i;return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ServerSessionCreateStep1`,i,n,r,null)},$.prototype.ClientSessionCreateStep2=function(e,t,n,r){var i,a=this;e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ClientSessionCreateStep2`,i,n,r,function(t,n,r){e.SetData(t.GetData()),a.IsAsync(n,r)&&n()})},$.prototype.ServerSessionCreateStep2=function(e,t,n,r){var i;e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ServerSessionCreateStep2`,i,n,r,null)},$.prototype.SessionSave=function(e,t,n){var r;return e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionSave`,r,t,n,null)},$.prototype.SessionLoad=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`SessionLoad`,r,t,n,null)},$.prototype.SessionCheckCertificates=function(e,t,n){var r;return e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionCheckCertificates`,r,t,n,null)},$.prototype.SessionEncrypt=function(e,t,n,r){var i,a=!1,o=this;if(typeof t!=`string`||(a=!0,(t=this._stringToBytes(t,r))!=null))return e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SessionEncrypt`,i,n,r,a?function(e,t,n){return o.BASE64Encode(e,t,n)}:null)},$.prototype.SessionDecrypt=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SessionDecrypt`,i,n,r,null)},$.prototype.SessionEncryptContinue=function(e,t,n,r){var i,a=this,o=!1;if(typeof t!=`string`||(o=!0,(t=this._stringToBytes(t,r))!=null))return e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SessionEncryptContinue`,i,n,r,function(e,n,r){if(o)return a.BASE64Encode(e,n,r);var i=a.IsAsync(n,r);if(!a._copyArrayData(t,e)){var s=a.MakeError(Z.ERROR_BAD_PARAMETER,``);if(i)return void r(s);throw new Q(s.errorCode,s.message)}if(!i)return t;n(t)})},$.prototype.SessionDecryptContinue=function(e,t,n,r){var i,a=this;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SessionDecryptContinue`,i,n,r,function(e,n,r){var i=a.IsAsync(n,r);if(!a._copyArrayData(t,e)){var o=a.MakeError(Z.ERROR_BAD_PARAMETER,``);if(i)return void r(o);throw new Q(o.errorCode,o.message)}if(!i)return t;n(t)})},$.prototype.SessionGetPeerCertificateInfo=function(e,t,n){var r;return e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionGetPeerCertificateInfo`,r,t,n,null)},$.prototype.ClientDynamicKeySessionCreate=function(e,t,n,r,i){var a,o=[];return typeof t==`string`&&typeof n==`string`||(i=r,r=n),o.push(e),typeof t==`string`&&typeof n==`string`?(o.push(t),o.push(n),o.push(null)):(o.push(null),o.push(null),o.push(new g(t))),a=this._funcMakeParams(o),this._funcCall(`ClientDynamicKeySessionCreate`,a,r,i,null)},$.prototype.ServerDynamicKeySessionCreate=function(e,t,n,r){var i;return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ServerDynamicKeySessionCreate`,i,n,r,null)},$.prototype.ClientDynamicKeySessionLoad=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ClientDynamicKeySessionLoad`,r,t,n,null)},$.prototype.SCClientIsRunning=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`SCClientIsRunning`,n,e,t,null)},$.prototype.SCClientStart=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`SCClientStart`,n,e,t,null)},$.prototype.SCClientStop=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`SCClientStop`,n,e,t,null)},$.prototype.SCClientAddGate=function(e,t,n,r,i,a,o,s){var c;typeof i!=`string`&&(o=i,s=a,i=null,a=null),c=this._funcMakeParams([e,t,n,r,i,a]),this._funcCall(`SCClientAddGate`,c,o,s,null)},$.prototype.SCClientRemoveGate=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SCClientRemoveGate`,r,t,n,null)},$.prototype.SCClientGetStatistic=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`SCClientGetStatistic`,n,e,t,null)},$.prototype.AppendTransportHeader=function(e,t,n,r,i,a,o){var s;return s=this._funcMakeParams([e,t,n,new g(r),new g(i)]),this._funcCall(`AppendTransportHeader`,s,a,o,null)},$.prototype.ParseTransportHeader=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ParseTransportHeader`,r,t,n,null)},$.prototype.AppendCryptoHeader=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`AppendCryptoHeader`,a,r,i,null)},$.prototype.ParseCryptoHeader=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ParseCryptoHeader`,r,t,n,null)},$.prototype.AppendFileTransportHeader=function(e,t,n,r,i,a,o,s){var c=this._funcMakeParams([e,t,n,new g(r),i,a]);this._funcCall(`AppendFileTransportHeader`,c,o,s,null)},$.prototype.ParseFileTransportHeader=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`ParseFileTransportHeader`,i,n,r,null)},$.prototype.AppendFileCryptoHeader=function(e,t,n,r,i,a){var o=this._funcMakeParams([e,t,n,r]);this._funcCall(`AppendFileCryptoHeader`,o,i,a,null)},$.prototype.ParseFileCryptoHeader=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`ParseFileCryptoHeader`,i,n,r,null)},$.prototype.DevCtxEnum=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`DevCtxEnum`,r,t,n,null)},$.prototype.DevCtxOpen=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`DevCtxOpen`,a,r,i,null)},$.prototype.CreateDeviceContext=function(){return new G},$.prototype.DevCtxEnumVirtual=function(e,t,n){var r,i=this;return r=this._funcMakeParams([e]),this._funcCall(`DevCtxEnumVirtual`,r,t,n,function(t,n,r){var a=i.IsAsync(n,r);try{if(t==null){if(!a)return null;n(null)}if(e.set(t[1]),!a)return t[0];n(t[0])}catch{var o=i.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(a)return void r(o);throw new Q(o.errorCode,o.message)}})},$.prototype.DevCtxClose=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`DevCtxClose`,r,t,n,null)},$.prototype.DevCtxGetData=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`DevCtxGetData`,i,n,r,null)},$.prototype.DevCtxChangePassword=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`DevCtxChangePassword`,i,n,r,null)},$.prototype.GetHostInfo=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetHostInfo`,n,e,t,null)},$.prototype.IsRemotelyControlled=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`IsRemotelyControlled`,n,e,t,null)},$.prototype.CtxCreate=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`CtxCreate`,n,e,t,null)},$.prototype.CtxFree=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`CtxFree`,r,t,n,null)},$.prototype.CtxSetParameter=function(e,t,n,r,i){var a;typeof n==`boolean`&&(n=+!!n),a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxSetParameter`,a,r,i,null)},$.prototype.CreateReference=function(e,t){return new Y(e,t)},$.prototype.ASiCGetASiCType=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`ASiCGetASiCType`,r,t,n,null)},$.prototype.ASiCGetSignType=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`ASiCGetSignType`,r,t,n,null)},$.prototype.ASiCGetSignsCount=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`ASiCGetSignsCount`,r,t,n,null)},$.prototype.ASiCGetSignerInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCGetSignerInfo`,i,n,r,null)},$.prototype.ASiCGetSignTimeInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCGetSignTimeInfo`,i,n,r,null)},$.prototype.ASiCGetSignReferences=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCGetSignReferences`,i,n,r,null)},$.prototype.ASiCGetReference=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._base64Decode(e,r))!=null)return i=this._funcMakeParams([new g(e),t]),this._funcCall(`ASiCGetReference`,i,n,r,null)},$.prototype.ASiCSign=function(e,t,n,r,i,a){for(var o,s=[],c=[],l=0;l<r.length;l++)s.push(r[l].GetName()),c.push(new g(r[l].GetData()));return o=this._funcMakeParams([e,t,n,s,c]),this._funcCall(`ASiCSign`,o,i,a,null)},$.prototype.ASiCAppendSign=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._base64Decode(n,i))!=null)return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`ASiCAppendSign`,a,r,i,null)},$.prototype.ASiCVerify=function(e,t,n,r,i){var a,o=[];if(typeof t!=`string`||(t=this._base64Decode(t,i))!=null)return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(new g(t)),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`ASiCVerify`,a,r,i,null)},$.prototype.CtxASiCSign=function(e,t,n,r,i,a,o,s){for(var c,l=[],u=[],d=0;d<a.length;d++)l.push(a[d].GetName()),u.push(new g(a[d].GetData()));return c=this._funcMakeParams([e,t,n,r,i,l,u]),this._funcCall(`CtxASiCSign`,c,o,s,null)},$.prototype.CtxASiCAppendSign=function(e,t,n,r,i,a,o){var s;if(typeof i!=`string`||(i=this._base64Decode(i,o))!=null)return s=this._funcMakeParams([e,t,n,r,new g(i)]),this._funcCall(`CtxASiCAppendSign`,s,a,o,null)},$.prototype.CtxASiCGetSignerInfo=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._base64Decode(n,i))!=null)return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`CtxASiCGetSignerInfo`,a,r,i,null)},$.prototype.ASiCGetSignLevel=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCGetSignLevel`,i,n,r,null)},$.prototype.ASiCIsAllContentCovered=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCIsAllContentCovered`,i,n,r,null)},$.prototype.PDFGetSignType=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`PDFGetSignType`,i,n,r,null)},$.prototype.PDFGetSignsCount=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`PDFGetSignsCount`,r,t,n,null)},$.prototype.PDFGetSignerInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`PDFGetSignerInfo`,i,n,r,null)},$.prototype.PDFGetSignTimeInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`PDFGetSignTimeInfo`,i,n,r,null)},$.prototype.PDFSign=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`PDFSign`,i,n,r,null)},$.prototype.PDFVerify=function(e,t,n,r,i){var a,o=[];if(typeof t!=`string`||(t=this._base64Decode(t,i))!=null)return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(new g(t)),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`PDFVerify`,a,r,i,null)},$.prototype.CtxPDFSign=function(e,t,n,r,i,a){var o;return o=this._funcMakeParams([e,t,new g(n),r]),this._funcCall(`CtxPDFSign`,o,i,a,null)},$.prototype.CtxPDFGetSignerInfo=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._base64Decode(n,i))!=null)return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`CtxPDFGetSignerInfo`,a,r,i,null)},$.prototype.XAdESGetType=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`XAdESGetType`,r,t,n,null)},$.prototype.XAdESGetSignsCount=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`XAdESGetSignsCount`,r,t,n,null)},$.prototype.XAdESGetSignLevel=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`XAdESGetSignLevel`,i,n,r,null)},$.prototype.XAdESGetSignerInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`XAdESGetSignerInfo`,i,n,r,null)},$.prototype.XAdESGetSignTimeInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`XAdESGetSignTimeInfo`,i,n,r,null)},$.prototype.XAdESGetSignReferences=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`XAdESGetSignReferences`,i,n,r,null)},$.prototype.XAdESGetReference=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._base64Decode(e,r))!=null)return i=this._funcMakeParams([new g(e),t]),this._funcCall(`XAdESGetReference`,i,n,r,null)},$.prototype.XAdESSign=function(e,t,n,r,i){for(var a,o=[],s=[],c=0;c<n.length;c++)o.push(n[c].GetName()),s.push(new g(n[c].GetData()));return a=this._funcMakeParams([e,t,o,s]),this._funcCall(`XAdESSign`,a,r,i,null)},$.prototype.XAdESVerify=function(e,t,n,r,i,a){var o,s=[],c=null,l=null;if(e!=null){c=[],l=[];for(var u=0;u<e.length;u++)c.push(e[u].GetName()),l.push(new g(e[u].GetData()))}if(typeof n!=`string`||(n=this._base64Decode(n,a))!=null)return typeof r!=`boolean`&&(a=i,i=r),s.push(c),s.push(l),s.push(t),s.push(new g(n)),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`XAdESVerify`,o,i,a,null)},$.prototype.CtxXAdESSign=function(e,t,n,r,i,a,o){for(var s,c=[],l=[],u=0;u<i.length;u++)c.push(i[u].GetName()),l.push(new g(i[u].GetData()));return s=this._funcMakeParams([e,t,n,r,c,l]),this._funcCall(`CtxXAdESSign`,s,a,o,null)},$.prototype.CtxXAdESGetSignerInfo=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._base64Decode(n,i))!=null)return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`CtxXAdESGetSignerInfo`,a,r,i,null)},$.prototype.SServerClientGeneratePrivateKeyAsync=function(e,t,n,r,i,a,o,s,c,l,u,d,f){var p;return p=this._funcMakeParams([e,t,n,r,i,a,o,s,c,l,u]),this._funcCall(`SServerClientGeneratePrivateKeyAsync`,p,d,f,null)},$.prototype.SServerClientCheckGeneratePrivateKeyStatus=function(e,t,n,r,i,a){var o,s=this;return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`SServerClientCheckGeneratePrivateKeyStatus`,o,i,a,function(e,t,n){var r=s.IsAsync(t,n);try{for(var i=new f,a=0;a<e.length;a++)i.add(e[a]);if(i.size()==0&&(i=null),!r)return i;t(i)}catch{var o=s.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(o);throw new Q(o.errorCode,o.message)}})},$.prototype.SServerClientSignHashAsync=function(e,t,n,r,i,a,o,s,c){var l;if(typeof a==`string`||(a=this._base64Encode(a,c))!=null)return l=this._funcMakeParams([e,t,n,r,i,a,o]),this._funcCall(`SServerClientSignHashAsync`,l,s,c,null)},$.prototype.SServerClientCheckSignHashStatus=function(e,t,n,r,i,a){var o;return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`SServerClientCheckSignHashStatus`,o,i,a,null)},$.prototype.SServerClientSignHashesAsync=function(e,t,n,r,i,a,o,s,c,l){var u;return a.className==`EndUserArrayList`&&(a=a.m_array),o.className==`EndUserArrayList`&&(o=o.m_array),u=this._funcMakeParams([e,t,n,r,i,a,o,s]),this._funcCall(`SServerClientSignHashesAsync`,u,c,l,null)},$.prototype.SServerClientCheckSignHashesStatus=function(e,t,n,r,i,a){var o,s=this;return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`SServerClientCheckSignHashesStatus`,o,i,a,function(e,t,n){var r=s.IsAsync(t,n);try{for(var i=new f,a=0;a<e.length;a++)i.add(e[a]);if(i.size()==0&&(i=null),!r)return i;t(i)}catch{var o=s.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(o);throw new Q(o.errorCode,o.message)}})},{EndUserLibraryLoader:d,EUSignCP:$,EndUserError:Z}})==`function`?r.apply(t,i):r)===void 0||(e.exports=a)},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,`EndUser`,function(){return T});var r=n(1);n.d(t,`EndUserError`,function(){return r});var i=n(14);n.d(t,`EndUserLibraryInfoJS`,function(){return i.a}),n.d(t,`EndUserLibraryInfoSW`,function(){return i.b});var a=n(9);n.d(t,`CASettings`,function(){return a.a}),n.d(t,`KSPSettings`,function(){return a.d}),n.d(t,`EndUserSettings`,function(){return a.c}),n.d(t,`EndUserProxySettings`,function(){return a.b});var o=n(10);n.d(t,`EndUserOwnerInfo`,function(){return o.a});var s=n(8);n.d(t,`EndUserCertificateInfoEx`,function(){return s.a});var c=n(20);n.d(t,`EndUserCertificate`,function(){return c.a});var l=n(21);n.d(t,`EndUserKeyMedia`,function(){return l.a});var u=n(15);n.d(t,`EndUserJKSPrivateKeyInfo`,function(){return u.a});var d=n(18);n.d(t,`EndUserContext`,function(){return d.a}),n.d(t,`EndUserPrivateKeyContext`,function(){return d.b});var f=n(0);n.d(t,`EndUserConstants`,function(){return f});var p=n(11);n.d(t,`EndUserTaxReport`,function(){return p.b}),n.d(t,`EndUserTaxReceipt`,function(){return p.a});var m=n(6);n.d(t,`EndUserTimeInfo`,function(){return m.a});var h=n(7);n.d(t,`EndUserSignContainerInfo`,function(){return h.a});var g=n(5);n.d(t,`EndUserSignInfo`,function(){return g.a});var _=n(12);n.d(t,`EndUserSenderInfo`,function(){return _.a});var v=n(16);n.d(t,`EndUserParams`,function(){return v.a});var y=n(22);n.d(t,`EndUserInfo`,function(){return y.a});var b=n(17);n.d(t,`EndUserRequestInfo`,function(){return b.a});var x=n(19);n.d(t,`EndUserClientRegistrationParameters`,function(){return x.a}),n.d(t,`EndUserClientRegistrationToken`,function(){return x.b});var S=n(23);n.d(t,`EndUserEvents`,function(){return S});var C=n(24),w=n(26),T=function(){function t(e,t,n){switch(t===void 0&&(t=f.EndUserLibraryType.JS),n===void 0&&(n=5),t){case f.EndUserLibraryType.SW:this.m_library=new w.a;break;case f.EndUserLibraryType.JS:case f.EndUserLibraryType.MS:default:this.m_library=new C.a(e,n)}}return t.prototype.Destroy=function(){var t=this;return new e(function(e,n){t.m_library.Finalize(),t.m_library=null,e()})},t.prototype.AddEventListener=function(e,t){return this.m_library.AddEventListener(e,t)},t.prototype.GetLibraryInfo=function(e){return this.m_library.GetLibraryInfo(e)},t.prototype.IsInitialized=function(){return this.m_library.IsInitialized()},t.prototype.Initialize=function(e){return this.m_library.Initialize(e)},t.prototype.SetLanguage=function(e){return this.m_library.SetLanguage(e)},t.prototype.SetRuntimeParameter=function(e,t){return this.m_library.SetRuntimeParameter(e,t)},t.prototype.GetStorageParameter=function(e,t){return t===void 0&&(t=!1),this.m_library.GetStorageParameter(e,t)},t.prototype.SetStorageParameter=function(e,t,n){return n===void 0&&(n=!1),this.m_library.SetStorageParameter(e,t,n)},t.prototype.GetCAs=function(){return this.m_library.GetCAs()},t.prototype.GetProxySettings=function(){return this.m_library.GetProxySettings()},t.prototype.SetProxySettings=function(e){return this.m_library.SetProxySettings(e)},t.prototype.GetHostInfo=function(){return this.m_library.GetHostInfo()},t.prototype.GetKeyMedias=function(){return this.m_library.GetKeyMedias()},t.prototype.GetJKSPrivateKeys=function(e){return this.m_library.GetJKSPrivateKeys(e)},t.prototype.IsPrivateKeyReaded=function(){return this.m_library.IsPrivateKeyReaded()},t.prototype.ResetPrivateKey=function(){return this.m_library.ResetPrivateKey()},t.prototype.ResetOperationKSP=function(){return this.m_library.ResetOperationKSP()},t.prototype.ReadPrivateKey=function(e,t,n){return this.m_library.ReadPrivateKey(e,t,n)},t.prototype.ReadPrivateKeyBinary=function(e,t,n,r){return this.m_library.ReadPrivateKeyBinary(e,t,n,r)},t.prototype.ReadPrivateKeySIM=function(e,t,n,r){return n===void 0&&(n=!0),r===void 0&&(r=0),this.m_library.ReadPrivateKeySIM(e,t,n,r)},t.prototype.ReadPrivateKeyKSP=function(e,t,n,r,i,a,o){return n===void 0&&(n=!0),r===void 0&&(r=0),i===void 0&&(i=null),a===void 0&&(a=null),o===void 0&&(o=null),this.m_library.ReadPrivateKeyKSP(e,t,n,r,i,a,o)},t.prototype.GetOwnCertificates=function(){return this.m_library.GetOwnCertificates()},t.prototype.GetOwnEUserParams=function(){return this.m_library.GetOwnEUserParams()},t.prototype.ChangeOwnCertificatesStatus=function(e,t){return this.m_library.ChangeOwnCertificatesStatus(e,t)},t.prototype.MakeNewCertificate=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){return h===void 0&&(h=!1),g===void 0&&(g=null),_===void 0&&(_=null),v===void 0&&(v=0),y===void 0&&(y=null),this.m_library.MakeNewCertificate(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y)},t.prototype.MakeDeviceCertificate=function(e,t,n,r,i){return this.m_library.MakeDeviceCertificate(e,t,n,r,i)},t.prototype.SetKeyMediaUserPassword=function(e,t){return this.m_library.SetKeyMediaUserPassword(e,t)},t.prototype.ChangePrivateKeyPassword=function(e,t){return this.m_library.ChangePrivateKeyPassword(e,t)},t.prototype.ChangePrivateKeyPasswordBinary=function(e,t,n){return this.m_library.ChangePrivateKeyPasswordBinary(e,t,n)},t.prototype.GeneratePrivateKey=function(e,t,n,r,i,a,o,s,c,l,u,d){return this.m_library.GeneratePrivateKey(e,t,n,r,i,a,o,s,c,l,u,d)},t.prototype.GeneratePrivateKeyBinary=function(e,t,n,r,i,a,o,s,c,l,u){return this.m_library.GeneratePrivateKeyBinary(e,t,n,r,i,a,o,s,c,l,u)},t.prototype.GetKeyInfo=function(e){return this.m_library.GetKeyInfo(e)},t.prototype.GetKeyInfoBinary=function(e,t){return this.m_library.GetKeyInfoBinary(e,t)},t.prototype.GetClientRegistrationTokenKSP=function(e,t){return this.m_library.GetClientRegistrationTokenKSP(e,t)},t.prototype.HashData=function(e,t,n){return this.m_library.HashData(e,t,n)},t.prototype.GetSigner=function(e,t,n){return this.m_library.GetSigner(e,t,n)},t.prototype.SignData=function(e,t){return t===void 0&&(t=!1),this.m_library.SignData(e,t)},t.prototype.SignDataInternal=function(e,t,n){return n===void 0&&(n=!1),this.m_library.SignDataInternal(e,t,n)},t.prototype.SignHash=function(e,t,n,r){return r===void 0&&(r=!1),this.m_library.SignHash(e,t,n,r)},t.prototype.SignDataEx=function(e,t,n,r,i){return i===void 0&&(i=!1),this.m_library.SignDataEx(e,t,n,r,i)},t.prototype.AppendSign=function(e,t,n,r,i){return i===void 0&&(i=!1),this.m_library.AppendSign(e,t,n,r,i)},t.prototype.AppendSignHash=function(e,t,n,r,i){return this.m_library.AppendSignHash(e,t,n,r,i)},t.prototype.GetSignValue=function(e,t,n,r){return r===void 0&&(r=!1),this.m_library.GetSignValue(e,t,n,r)},t.prototype.VerifyHash=function(e,t,n){return n===void 0&&(n=-1),this.m_library.VerifyHash(e,t,n)},t.prototype.VerifyData=function(e,t,n){return n===void 0&&(n=-1),this.m_library.VerifyData(e,t,n)},t.prototype.VerifyDataInternal=function(e,t){return t===void 0&&(t=-1),this.m_library.VerifyDataInternal(e,t)},t.prototype.EnvelopData=function(e,t,n,r,i,a){return a===void 0&&(a=!1),this.m_library.EnvelopData(e,t,n,r,i,a)},t.prototype.DevelopData=function(e,t){return this.m_library.DevelopData(e,t)},t.prototype.ProtectDataByPassword=function(e,t,n){return this.m_library.ProtectDataByPassword(e,t,n)},t.prototype.UnprotectDataByPassword=function(e,t,n){return this.m_library.UnprotectDataByPassword(e,t,n)},t.prototype.CreateAuthData=function(e,t,n){return this.m_library.CreateAuthData(e,t,n)},t.prototype.GetTSPByAccessInfo=function(e,t,n,r,i){return this.m_library.GetTSPByAccessInfo(e,t,n,r,i)},t.prototype.CheckTSP=function(e,t,n){return this.m_library.CheckTSP(e,t,n)},t.prototype.ClientDynamicKeySessionCreate=function(e){return this.m_library.ClientDynamicKeySessionCreate(e)},t.prototype.SessionClose=function(e){return this.m_library.SessionClose(e)},t.prototype.SessionEncrypt=function(e,t,n){return this.m_library.SessionEncrypt(e,t,n)},t.prototype.SessionDecrypt=function(e,t){return this.m_library.SessionDecrypt(e,t)},t.prototype.CtxCreate=function(){return this.m_library.CtxCreate()},t.prototype.CtxFree=function(e){return this.m_library.CtxFree(e)},t.prototype.CtxSetParameter=function(e,t,n){return this.m_library.CtxSetParameter(e,t,n)},t.prototype.CtxReadPrivateKey=function(e,t,n,r){return e===void 0&&(e=null),this.m_library.CtxReadPrivateKey(e,t,n,r)},t.prototype.CtxReadPrivateKeyBinary=function(e,t,n,r,i){return e===void 0&&(e=null),this.m_library.CtxReadPrivateKeyBinary(e,t,n,r,i)},t.prototype.CtxFreePrivateKey=function(e){return this.m_library.CtxFreePrivateKey(e)},t.prototype.CtxGetOwnCertificates=function(e){return this.m_library.CtxGetOwnCertificates(e)},t.prototype.CtxSignHash=function(e,t,n,r,i){return this.m_library.CtxSignHash(e,t,n,r,i)},t.prototype.CtxSignData=function(e,t,n,r,i,a){return this.m_library.CtxSignData(e,t,n,r,i,a)},t.prototype.CtxAppendSignHash=function(e,t,n,r,i,a){return this.m_library.CtxAppendSignHash(e,t,n,r,i,a)},t.prototype.CtxAppendSign=function(e,t,n,r,i,a){return this.m_library.CtxAppendSign(e,t,n,r,i,a)},t.prototype.CtxGetSignValue=function(e,t,n,r,i){return i===void 0&&(i=!1),this.m_library.CtxGetSignValue(e,t,n,r,i)},t.prototype.CtxEnvelopData=function(e,t,n,r,i,a,o){return this.m_library.CtxEnvelopData(e,t,n,r,i,a,o)},t.prototype.CtxDevelopData=function(e,t,n){return this.m_library.CtxDevelopData(e,t,n)},t.prototype.ProtectTaxReports=function(e,t,n,r,i,a,o){return e===void 0&&(e=null),t===void 0&&(t=null),n===void 0&&(n=null),this.m_library.ProtectTaxReports(e,t,n,r,i,a,o)},t.prototype.UnprotectTaxReceipts=function(e,t){return this.m_library.UnprotectTaxReceipts(e,t)},t.prototype.ASiCGetSigner=function(e,t,n){return this.m_library.ASiCGetSigner(e,t,n)},t.prototype.ASiCSignData=function(e,t,n,r,i,a){return this.m_library.ASiCSignData(e,t,n,r,i,a)},t.prototype.ASiCAppendSign=function(e,t,n,r,i){return this.m_library.ASiCAppendSign(e,t,n,r,i)},t.prototype.ASiCVerifyData=function(e,t){return this.m_library.ASiCVerifyData(e,t)},t.prototype.PDFGetSigner=function(e,t,n){return this.m_library.PDFGetSigner(e,t,n)},t.prototype.PDFSignData=function(e,t,n,r){return this.m_library.PDFSignData(e,t,n,r)},t.prototype.PDFVerifyData=function(e,t){return this.m_library.PDFVerifyData(e,t)},t.prototype.XAdESGetSigner=function(e,t,n){return this.m_library.XAdESGetSigner(e,t,n)},t.prototype.XAdESSignData=function(e,t,n,r,i){return this.m_library.XAdESSignData(e,t,n,r,i)},t.prototype.XAdESVerifyData=function(e,t,n){return this.m_library.XAdESVerifyData(e,t,n)},t.prototype.GetSignContainerInfo=function(e){return this.m_library.GetSignContainerInfo(e)},t}()}.call(this,n(13).Promise)},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return i});var r=n(0),i=function(){this.type=r.EndUserSignContainerType.Unknown,this.subType=r.EndUserCAdESType.Unknown,this.asicSignType=r.EndUserASiCSignType.Unknown}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r}),n.d(t,`d`,function(){return i}),n.d(t,`c`,function(){return a}),n.d(t,`b`,function(){return o});var r=function(){},i=function(){},a=function(){},o=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`b`,function(){return r}),n.d(t,`a`,function(){return i});var r=function(){},i=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){(function(t,r){e.exports=function(){"use strict";function e(e){return typeof e==`function`}var i=Array.isArray?Array.isArray:function(e){return Object.prototype.toString.call(e)===`[object Array]`},a=0,o=void 0,s=void 0,c=function(e,t){h[a]=e,h[a+1]=t,(a+=2)===2&&(s?s(g):x())},l=typeof window<`u`?window:void 0,u=l||{},d=u.MutationObserver||u.WebKitMutationObserver,f=typeof self>`u`&&t!==void 0&&{}.toString.call(t)===`[object process]`,p=typeof Uint8ClampedArray<`u`&&typeof importScripts<`u`&&typeof MessageChannel<`u`;function m(){var e=setTimeout;return function(){return e(g,1)}}var h=Array(1e3);function g(){for(var e=0;e<a;e+=2)(0,h[e])(h[e+1]),h[e]=void 0,h[e+1]=void 0;a=0}var _,v,y,b,x=void 0;function S(e,t){var n=arguments,r=this,i=new this.constructor(T);i[w]===void 0&&z(i);var a,o=r._state;return o?(a=n[o-1],c(function(){return L(o,i,a,r._result)})):N(r,i,e,t),i}function C(e){if(e&&typeof e==`object`&&e.constructor===this)return e;var t=new this(T);return k(t,e),t}f?x=function(){return t.nextTick(g)}:d?(v=0,y=new d(g),b=document.createTextNode(``),y.observe(b,{characterData:!0}),x=function(){b.data=v=++v%2}):p?((_=new MessageChannel).port1.onmessage=g,x=function(){return _.port2.postMessage(0)}):x=l===void 0?function(){try{var e=n(31);return o=e.runOnLoop||e.runOnContext,function(){o(g)}}catch{return m()}}():m();var w=(crypto.getRandomValues(new Uint32Array(1))[0]/4294967295).toString(36).substring(16);function T(){}var E=new F;function D(e){try{return e.then}catch(e){return E.error=e,E}}function O(t,n,r){n.constructor===t.constructor&&r===S&&n.constructor.resolve===C?function(e,t){t._state===1?j(e,t._result):t._state===2?M(e,t._result):N(t,void 0,function(t){return k(e,t)},function(t){return M(e,t)})}(t,n):r===E?M(t,E.error):r===void 0?j(t,n):e(r)?function(e,t,n){c(function(e){var r=!1,i=function(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}(n,t,function(n){r||(r=!0,t===n?j(e,n):k(e,n))},function(t){r||(r=!0,M(e,t))},e._label);!r&&i&&(r=!0,M(e,i))},e)}(t,n,r):j(t,n)}function k(e,t){var n;e===t?M(e,TypeError(`You cannot resolve a promise with itself`)):typeof(n=t)==`function`||typeof n==`object`&&n?O(e,t,D(t)):j(e,t)}function A(e){e._onerror&&e._onerror(e._result),P(e)}function j(e,t){e._state===void 0&&(e._result=t,e._state=1,e._subscribers.length!==0&&c(P,e))}function M(e,t){e._state===void 0&&(e._state=2,e._result=t,c(A,e))}function N(e,t,n,r){var i=e._subscribers,a=i.length;e._onerror=null,i[a]=t,i[a+1]=n,i[a+2]=r,a===0&&e._state&&c(P,e)}function P(e){var t=e._subscribers,n=e._state;if(t.length!==0){for(var r=void 0,i=void 0,a=e._result,o=0;o<t.length;o+=3)r=t[o],i=t[o+n],r?L(n,r,i,a):i(a);e._subscribers.length=0}}function F(){this.error=null}var I=new F;function L(t,n,r,i){var a=e(r),o=void 0,s=void 0,c=void 0,l=void 0;if(a){if((o=function(e,t){try{return e(t)}catch(e){return I.error=e,I}}(r,i))===I?(l=!0,s=o.error,o=null):c=!0,n===o)return void M(n,TypeError(`A promises callback cannot return that same promise.`))}else o=i,c=!0;n._state!==void 0||(a&&c?k(n,o):l?M(n,s):t===1?j(n,o):t===2&&M(n,o))}var R=0;function z(e){e[w]=R++,e._state=void 0,e._result=void 0,e._subscribers=[]}function B(e,t){this._instanceConstructor=e,this.promise=new e(T),this.promise[w]||z(this.promise),i(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=Array(this.length),this.length===0?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(),this._remaining===0&&j(this.promise,this._result))):M(this.promise,Error(`Array Methods must be provided an Array`))}function V(e){this[w]=R++,this._result=this._state=void 0,this._subscribers=[],T!==e&&(typeof e!=`function`&&function(){throw TypeError(`You must pass a resolver function as the first argument to the promise constructor`)}(),this instanceof V?function(e,t){try{t(function(t){k(e,t)},function(t){M(e,t)})}catch(t){M(e,t)}}(this,e):function(){throw TypeError(`Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.`)}())}function H(){var e=void 0;if(r!==void 0)e=r;else if(typeof self<`u`)e=self;else try{e=Function(`return this`)()}catch{throw Error(`polyfill failed because global object is unavailable in this environment`)}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch{}if(n===`[object Promise]`&&!t.cast)return}e.Promise=V}return B.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===void 0&&n<e;n++)this._eachEntry(t[n],n)},B.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===C){var i=D(e);if(i===S&&e._state!==void 0)this._settledAt(e._state,t,e._result);else if(typeof i!=`function`)this._remaining--,this._result[t]=e;else if(n===V){var a=new n(T);O(a,e,i),this._willSettleAt(a,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},B.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===void 0&&(this._remaining--,e===2?M(r,n):this._result[t]=n),this._remaining===0&&j(r,this._result)},B.prototype._willSettleAt=function(e,t){var n=this;N(e,void 0,function(e){return n._settledAt(1,t,e)},function(e){return n._settledAt(2,t,e)})},V.all=function(e){return new B(this,e).promise},V.race=function(e){var t=this;return i(e)?new t(function(n,r){for(var i=e.length,a=0;a<i;a++)t.resolve(e[a]).then(n,r)}):new t(function(e,t){return t(TypeError(`You must pass an array to race.`))})},V.resolve=C,V.reject=function(e){var t=new this(T);return M(t,e),t},V._setScheduler=function(e){s=e},V._setAsap=function(e){c=e},V._asap=c,V.prototype={constructor:V,then:S,catch:function(e){return this.then(null,e)}},H(),V.polyfill=H,V.Promise=V,V}()}).call(this,n(29),n(30))},function(e,t,n){"use strict";n.d(t,`a`,function(){return r}),n.d(t,`b`,function(){return i});var r=function(){this.version=null,this.supported=!1,this.loaded=!1},i=function(){this.version=null,this.supported=!1,this.loaded=!1,this.isSignAgentSupported=!1,this.isWebExtensionSupported=!1,this.isNPAPISupported=!1,this.isActiveXSupported=!1,this.isWebExtensionInstalled=!1,this.isNativeLibraryNeedUpdate=!1,this.nativeLibraryInstallURL=null,this.nativeLibraryUpdateURL=null,this.webExtensionInstallURL=null,this.helpURL=null}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r}),n.d(t,`b`,function(){return i});var r=function(){},i=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r}),n.d(t,`b`,function(){return i});var r=function(){},i=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(e){this.type=e?e.type:``,this.device=e?e.device:``,this.visibleName=e?e.visibleName:``,this.typeIndex=e?e.typeIndex:-1,this.devIndex=e?e.devIndex:-1,this.password=e?e.password:``,this.user=e?e.user:``}},function(e,t,n){"use strict";n.d(t,`a`,function(){return i});var r=n(0),i=function(){this.version=r.EU_USER_INFO_VERSION,this.commonName=``,this.locality=``,this.state=``,this.organization=``,this.orgUnit=``,this.title=``,this.street=``,this.phone=``,this.surname=``,this.givenname=``,this.EMail=``,this.DNS=``,this.EDRPOUCode=``,this.DRFOCode=``,this.NBUCode=``,this.SPFMCode=``,this.OCode=``,this.OUCode=``,this.userCode=``,this.UPN=``,this.UNZR=``,this.country=`UA`}},function(e,t,n){"use strict";n.r(t),n.d(t,`EndUserConfirmKSPOperationEvent`,function(){return i});var r=n(0),i=function(){this.type=r.EndUserEventType.ConfirmKSPOperation}},function(e,t,n){"use strict";(function(e){var r=n(25),i=n(0);t.a=function(){function t(e,t){var n=this,i=``;typeof t==`number`&&t>0&&(typeof i==`string`&&i.length>0&&(i=`var EU_MAX_DATA_SIZE_MB = `+t+`;`+i),typeof e==`string`&&e.length>0&&(e+=(e.includes(`?`)?`&`:`?`)+`maxDataSize=`+t)),this.m_worker=new r.a(i,e,function(e){n.OnEvent(e)}),this.m_eventListeners=[]}return t.prototype.OnEvent=function(e){try{var t=this.m_eventListeners[e.type]||this.m_eventListeners[i.EndUserEventType.All];t&&t(e)}catch{}},t.prototype.AddEventListener=function(e,t){switch(e){case i.EndUserEventType.None:this.m_eventListeners=[];break;case i.EndUserEventType.All:this.m_eventListeners=[],this.m_eventListeners[e]=t;break;default:this.m_eventListeners[e]=t}return this.m_worker.postMessage(`AddEventListener`,[e])},t.prototype.GetLibraryInfo=function(e){return this.m_worker.postMessage(`GetLibraryInfo`,Array.prototype.slice.call(arguments))},t.prototype.IsInitialized=function(){return this.m_worker.postMessage(`IsInitialized`,Array.prototype.slice.call(arguments))},t.prototype.Initialize=function(e){return this.m_worker.postMessage(`Initialize`,Array.prototype.slice.call(arguments))},t.prototype.Finalize=function(){var t=this;return new e(function(e,n){t.m_worker.terminate(),t.m_worker=null,t.m_eventListeners=[],e()})},t.prototype.SetLanguage=function(e){return this.m_worker.postMessage(`SetLanguage`,Array.prototype.slice.call(arguments))},t.prototype.SetRuntimeParameter=function(e,t){return this.m_worker.postMessage(`SetRuntimeParameter`,Array.prototype.slice.call(arguments))},t.prototype.GetStorageParameter=function(e,t){return this.m_worker.postMessage(`GetStorageParameter`,Array.prototype.slice.call(arguments))},t.prototype.SetStorageParameter=function(e,t,n){return this.m_worker.postMessage(`SetStorageParameter`,Array.prototype.slice.call(arguments))},t.prototype.GetCAs=function(){return this.m_worker.postMessage(`GetCAs`,Array.prototype.slice.call(arguments))},t.prototype.GetProxySettings=function(){return this.m_worker.postMessage(`GetProxySettings`,Array.prototype.slice.call(arguments))},t.prototype.SetProxySettings=function(e){return this.m_worker.postMessage(`SetProxySettings`,Array.prototype.slice.call(arguments))},t.prototype.GetHostInfo=function(){return this.m_worker.postMessage(`GetHostInfo`,Array.prototype.slice.call(arguments))},t.prototype.GetKeyMedias=function(){return this.m_worker.postMessage(`GetKeyMedias`,Array.prototype.slice.call(arguments))},t.prototype.GetJKSPrivateKeys=function(e){return this.m_worker.postMessage(`GetJKSPrivateKeys`,Array.prototype.slice.call(arguments))},t.prototype.IsPrivateKeyReaded=function(){return this.m_worker.postMessage(`IsPrivateKeyReaded`,Array.prototype.slice.call(arguments))},t.prototype.ResetPrivateKey=function(){return this.m_worker.postMessage(`ResetPrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.ResetOperationKSP=function(){return this.m_worker.postMessage(`ResetOperationKSP`,Array.prototype.slice.call(arguments))},t.prototype.ReadPrivateKey=function(e,t,n){return this.m_worker.postMessage(`ReadPrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.ReadPrivateKeyBinary=function(e,t,n,r){return this.m_worker.postMessage(`ReadPrivateKeyBinary`,Array.prototype.slice.call(arguments))},t.prototype.ReadPrivateKeySIM=function(e,t,n,r){return this.m_worker.postMessage(`ReadPrivateKeySIM`,Array.prototype.slice.call(arguments))},t.prototype.ReadPrivateKeyKSP=function(e,t,n,r,i,a,o){return this.m_worker.postMessage(`ReadPrivateKeyKSP`,Array.prototype.slice.call(arguments))},t.prototype.GetOwnCertificates=function(){return this.m_worker.postMessage(`GetOwnCertificates`,Array.prototype.slice.call(arguments))},t.prototype.GetOwnEUserParams=function(){return this.m_worker.postMessage(`GetOwnEUserParams`,Array.prototype.slice.call(arguments))},t.prototype.ChangeOwnCertificatesStatus=function(e,t){return this.m_worker.postMessage(`ChangeOwnCertificatesStatus`,Array.prototype.slice.call(arguments))},t.prototype.MakeNewCertificate=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){return h===void 0&&(h=!1),g===void 0&&(g=null),_===void 0&&(_=null),v===void 0&&(v=0),y===void 0&&(y=null),this.m_worker.postMessage(`MakeNewCertificate`,Array.prototype.slice.call(arguments))},t.prototype.MakeDeviceCertificate=function(e,t,n,r,i){return this.m_worker.postMessage(`MakeDeviceCertificate`,Array.prototype.slice.call(arguments))},t.prototype.SetKeyMediaUserPassword=function(e,t){return this.m_worker.postMessage(`SetKeyMediaUserPassword`,Array.prototype.slice.call(arguments))},t.prototype.ChangePrivateKeyPassword=function(e,t){return this.m_worker.postMessage(`ChangePrivateKeyPassword`,Array.prototype.slice.call(arguments))},t.prototype.ChangePrivateKeyPasswordBinary=function(e,t,n){return this.m_worker.postMessage(`ChangePrivateKeyPasswordBinary`,Array.prototype.slice.call(arguments))},t.prototype.GeneratePrivateKey=function(e,t,n,r,i,a,o,s,c,l,u,d){return this.m_worker.postMessage(`GeneratePrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.GeneratePrivateKeyBinary=function(e,t,n,r,i,a,o,s,c,l,u){return this.m_worker.postMessage(`GeneratePrivateKeyBinary`,Array.prototype.slice.call(arguments))},t.prototype.GetKeyInfo=function(e){return this.m_worker.postMessage(`GetKeyInfo`,Array.prototype.slice.call(arguments))},t.prototype.GetKeyInfoBinary=function(e,t){return this.m_worker.postMessage(`GetKeyInfoBinary`,Array.prototype.slice.call(arguments))},t.prototype.GetClientRegistrationTokenKSP=function(e,t){return t===void 0&&(t=null),this.m_worker.postMessage(`GetClientRegistrationTokenKSP`,Array.prototype.slice.call(arguments))},t.prototype.HashData=function(e,t,n){return this.m_worker.postMessage(`HashData`,Array.prototype.slice.call(arguments))},t.prototype.GetSigner=function(e,t,n){return t===void 0&&(t=-1),n===void 0&&(n=!1),this.m_worker.postMessage(`GetSigner`,Array.prototype.slice.call(arguments))},t.prototype.SignData=function(e,t){return t===void 0&&(t=!1),this.m_worker.postMessage(`SignData`,Array.prototype.slice.call(arguments))},t.prototype.SignDataInternal=function(e,t,n){return n===void 0&&(n=!1),this.m_worker.postMessage(`SignDataInternal`,Array.prototype.slice.call(arguments))},t.prototype.SignHash=function(e,t,n,r){return this.m_worker.postMessage(`SignHash`,Array.prototype.slice.call(arguments))},t.prototype.SignDataEx=function(e,t,n,r,i){return this.m_worker.postMessage(`SignDataEx`,Array.prototype.slice.call(arguments))},t.prototype.AppendSign=function(e,t,n,r,i){return this.m_worker.postMessage(`AppendSign`,Array.prototype.slice.call(arguments))},t.prototype.AppendSignHash=function(e,t,n,r,i){return this.m_worker.postMessage(`AppendSignHash`,Array.prototype.slice.call(arguments))},t.prototype.GetSignValue=function(e,t,n,r){return r===void 0&&(r=!1),this.m_worker.postMessage(`GetSignValue`,Array.prototype.slice.call(arguments))},t.prototype.VerifyHash=function(e,t,n){return n===void 0&&(n=-1),this.m_worker.postMessage(`VerifyHash`,Array.prototype.slice.call(arguments))},t.prototype.VerifyData=function(e,t,n){return n===void 0&&(n=-1),this.m_worker.postMessage(`VerifyData`,Array.prototype.slice.call(arguments))},t.prototype.VerifyDataInternal=function(e,t){return t===void 0&&(t=-1),this.m_worker.postMessage(`VerifyDataInternal`,Array.prototype.slice.call(arguments))},t.prototype.EnvelopData=function(e,t,n,r,i,a){return a===void 0&&(a=!1),this.m_worker.postMessage(`EnvelopData`,Array.prototype.slice.call(arguments))},t.prototype.DevelopData=function(e,t){return this.m_worker.postMessage(`DevelopData`,Array.prototype.slice.call(arguments))},t.prototype.CreateAuthData=function(e,t,n){return this.m_worker.postMessage(`CreateAuthData`,Array.prototype.slice.call(arguments))},t.prototype.ProtectDataByPassword=function(e,t,n){return this.m_worker.postMessage(`ProtectDataByPassword`,Array.prototype.slice.call(arguments))},t.prototype.UnprotectDataByPassword=function(e,t,n){return this.m_worker.postMessage(`UnprotectDataByPassword`,Array.prototype.slice.call(arguments))},t.prototype.GetTSPByAccessInfo=function(e,t,n,r,i){return this.m_worker.postMessage(`GetTSPByAccessInfo`,Array.prototype.slice.call(arguments))},t.prototype.CheckTSP=function(e,t,n){return this.m_worker.postMessage(`CheckTSP`,Array.prototype.slice.call(arguments))},t.prototype.ClientDynamicKeySessionCreate=function(e){return this.m_worker.postMessage(`ClientDynamicKeySessionCreate`,Array.prototype.slice.call(arguments))},t.prototype.SessionClose=function(e){return this.m_worker.postMessage(`SessionClose`,Array.prototype.slice.call(arguments))},t.prototype.SessionEncrypt=function(e,t,n){return this.m_worker.postMessage(`SessionEncrypt`,Array.prototype.slice.call(arguments))},t.prototype.SessionDecrypt=function(e,t){return this.m_worker.postMessage(`SessionDecrypt`,Array.prototype.slice.call(arguments))},t.prototype.CtxCreate=function(){return this.m_worker.postMessage(`CtxCreate`,Array.prototype.slice.call(arguments))},t.prototype.CtxFree=function(e){return this.m_worker.postMessage(`CtxFree`,Array.prototype.slice.call(arguments))},t.prototype.CtxSetParameter=function(e,t,n){return this.m_worker.postMessage(`CtxSetParameter`,Array.prototype.slice.call(arguments))},t.prototype.CtxReadPrivateKey=function(e,t,n,r){return this.m_worker.postMessage(`CtxReadPrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.CtxReadPrivateKeyBinary=function(e,t,n,r,i){return this.m_worker.postMessage(`CtxReadPrivateKeyBinary`,Array.prototype.slice.call(arguments))},t.prototype.CtxFreePrivateKey=function(e){return this.m_worker.postMessage(`CtxFreePrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.CtxGetOwnCertificates=function(e){return this.m_worker.postMessage(`CtxGetOwnCertificates`,Array.prototype.slice.call(arguments))},t.prototype.CtxSignHash=function(e,t,n,r,i){return this.m_worker.postMessage(`CtxSignHash`,Array.prototype.slice.call(arguments))},t.prototype.CtxSignData=function(e,t,n,r,i,a){return this.m_worker.postMessage(`CtxSignData`,Array.prototype.slice.call(arguments))},t.prototype.CtxAppendSignHash=function(e,t,n,r,i,a){return this.m_worker.postMessage(`CtxAppendSignHash`,Array.prototype.slice.call(arguments))},t.prototype.CtxAppendSign=function(e,t,n,r,i,a){return this.m_worker.postMessage(`CtxAppendSign`,Array.prototype.slice.call(arguments))},t.prototype.CtxGetSignValue=function(e,t,n,r,i){return i===void 0&&(i=!1),this.m_worker.postMessage(`CtxGetSignValue`,Array.prototype.slice.call(arguments))},t.prototype.CtxEnvelopData=function(e,t,n,r,i,a,o){return this.m_worker.postMessage(`CtxEnvelopData`,Array.prototype.slice.call(arguments))},t.prototype.CtxDevelopData=function(e,t,n){return this.m_worker.postMessage(`CtxDevelopData`,Array.prototype.slice.call(arguments))},t.prototype.ProtectTaxReports=function(e,t,n,r,i,a,o){return e===void 0&&(e=null),t===void 0&&(t=null),n===void 0&&(n=null),o===void 0&&(o=!1),this.m_worker.postMessage(`ProtectTaxReports`,Array.prototype.slice.call(arguments))},t.prototype.UnprotectTaxReceipts=function(e,t){return this.m_worker.postMessage(`UnprotectTaxReceipts`,Array.prototype.slice.call(arguments))},t.prototype.ASiCGetSigner=function(e,t,n){return this.m_worker.postMessage(`ASiCGetSigner`,Array.prototype.slice.call(arguments))},t.prototype.ASiCSignData=function(e,t,n,r,i,a){return this.m_worker.postMessage(`ASiCSignData`,Array.prototype.slice.call(arguments))},t.prototype.ASiCAppendSign=function(e,t,n,r,i){return this.m_worker.postMessage(`ASiCAppendSign`,Array.prototype.slice.call(arguments))},t.prototype.ASiCVerifyData=function(e,t){return t===void 0&&(t=-1),this.m_worker.postMessage(`ASiCVerifyData`,Array.prototype.slice.call(arguments))},t.prototype.PDFSignData=function(e,t,n,r){return this.m_worker.postMessage(`PDFSignData`,Array.prototype.slice.call(arguments))},t.prototype.PDFVerifyData=function(e,t){return t===void 0&&(t=-1),this.m_worker.postMessage(`PDFVerifyData`,Array.prototype.slice.call(arguments))},t.prototype.PDFGetSigner=function(e,t,n){return t===void 0&&(t=-1),n===void 0&&(n=!1),this.m_worker.postMessage(`PDFGetSigner`,Array.prototype.slice.call(arguments))},t.prototype.XAdESGetSigner=function(e,t,n){return t===void 0&&(t=-1),n===void 0&&(n=!1),this.m_worker.postMessage(`XAdESGetSigner`,Array.prototype.slice.call(arguments))},t.prototype.XAdESSignData=function(e,t,n,r,i){return this.m_worker.postMessage(`XAdESSignData`,Array.prototype.slice.call(arguments))},t.prototype.XAdESVerifyData=function(e,t,n){return n===void 0&&(n=-1),this.m_worker.postMessage(`XAdESVerifyData`,Array.prototype.slice.call(arguments))},t.prototype.GetSignContainerInfo=function(e){return this.m_worker.postMessage(`GetSignContainerInfo`,Array.prototype.slice.call(arguments))},t}()}).call(this,n(13).Promise)},function(e,t,n){"use strict";(function(e){var n=function(e,t,n){this.id=e,this.cmd=t,this.params=n,this.origin=window.location.origin?window.location.origin:window.location.protocol+`//`+window.location.hostname+(window.location.port?`:`+window.location.port:``),this.pathname=window.location.pathname},r=function(e,t,n,r){this.id=e,this.cmd=t,this.result=n,this.error=r};t.a=function(){function t(e,t,n){var r=this;this.m_worker=this.loadWorker(e,t),this.m_worker.onmessage=function(e){var t=e.data;if(t.id!=-2){var i=r.m_promises[t.id-1];i&&(delete r.m_promises[t.id-1],t.error?i.reject(t.error):i.resolve(t.result))}else n(t.result)},this.m_worker.onerror=function(e){r.m_promises.forEach(function(t){t.reject(e.error)}),r.m_promises=[]},this.m_promises=[]}return t.prototype.terminate=function(){try{this.m_worker.terminate()}catch{this.m_worker=null,this.m_promises=[]}},t.prototype.loadWorker=function(e,t){try{if(!e)throw`No worker content`;try{var n,r=window,i=r.URL||r.webkitURL;try{(n=new(r.BlobBuilder||r.WebKitBlobBuilder||r.MozBlobBuilder||r.MSBlobBuilder)).append(e),n=n.getBlob()}catch{n=new Blob([e])}return new Worker(i.createObjectURL(n))}catch{return new Worker(`data:application/javascript,`+encodeURIComponent(e))}}catch{if(!t)throw Error(`Inline worker is not supported`);return new Worker(t)}},t.prototype.postMessage=function(t,r){var i=this,a=new n(-1,t,r),o=new e(function(e,t){a.id=i.m_promises.push({resolve:e,reject:t})});return this.m_worker.postMessage(a),o},t}(),(function(){function e(e){this.m_context=e,this.m_initialized=!1;var t=this;self.onmessage=function(e){t.onMessage(e.data)}}e.prototype.postMessage=function(e,t,n,i){var a=new r(e,t,n,i);self.postMessage(a)},e.prototype.onMessage=function(e){var t=this;this.m_initialized?this.m_context[e.cmd].apply(this.m_context,e.params).then(function(n){t.postMessage(e.id,e.cmd,n)},function(n){t.postMessage(e.id,e.cmd,null,n)}):setTimeout(function(){t.onMessage(e)},50)},e.prototype.initialize=function(){this.m_initialized=!0}})()}).call(this,n(13).Promise)},function(e,t,n){"use strict";(function(e){var r=n(1),i=n(9),a=n(10),o=n(15),s=n(27),c=n(4),l=n(14),u=n(2),d=n(8),f=n(0),p=n(11),m=n(16),h=n(17),g=n(7),_=n(5),v=n(12),y=n(6),b=n(28),x=function(){};t.a=function(){function t(){this.MakeExpireDate=function(e){e||=300;var t=new Date;return t.setTime(t.getTime()+1e3*e),t},this.m_library=new s.a,this.m_settings=null,this.m_initialized=!1,this.m_kmTypes=null,this.m_kmActiveOperation=!1,this.m_context=null,this.m_pkContext=null,this.m_eventListeners=[],this.m_resolveOIDs=!1,this.m_origin=window.location.origin?window.location.origin:window.location.protocol+`//`+window.location.hostname+(window.location.port?`:`+window.location.port:``)}return t.prototype.MapError=function(e){var t=new r.EndUserError;return e.GetErrorCode!==void 0&&e.GetMessage!==void 0?(t.code=e.GetErrorCode(),t.message=e.GetMessage()):e.code!==void 0&&e.message!==void 0?(t.code=e.code,t.message=e.message):(t.code=r.EU_ERROR_UNKNOWN,t.message=e.toString()),t},t.prototype.ProcessArray=function(t,n){var r=this;return new e(function(e,i){var a=[],o=0,s=function(){o>=t.length?e(a):(n(t[o]).then(function(e){a.push(e),s()}).catch(function(e){return i(r.MapError(e))}),o++)};s()})},t.prototype.DataToNamedDataArray=function(e){e??=[],e=Array.isArray(e)?e:[e];for(var t=[],n=0;n<e.length;n++){var r=e[n].name!==void 0&&e[n].val!==void 0;t.push({name:r?e[n].name:`Ім'я відсутнє`,val:r?e[n].val:e[n]})}return t},t.prototype.DataToResult=function(e,t){for(var n=[],r=!Array.isArray(e),i=r?[e]:e,a=0;a<i.length;a++){var o=i[a].name!==void 0&&i[a].val!==void 0?{name:i[a].name,val:t[a]}:t[a];n.push(o)}return r?n[0]:n},t.prototype.NamedDataToReference=function(t){var n=this,r=n.m_library;return new e(function(e,i){typeof t.val==`string`?r.StringToBytes(t.val).then(function(n){e(r.CreateReference(t.name,n))}).catch(function(e){return i(n.MapError(e))}):setTimeout(function(){e(r.CreateReference(t.name,t.val))},1)})},t.prototype.OnEvent=function(e){try{var t=this.m_eventListeners[e.type]||this.m_eventListeners[f.EndUserEventType.All];t&&t(e)}catch{}},t.prototype.CheckInitialize=function(){var t=this,n=t.m_library;return new e(function(e,i){t.m_initialized?e():n.Load().then(function(){throw n.MakeError(r.EU_ERROR_NOT_INITIALIZED,``)}).catch(function(e){return i(t.MapError(e))})})},t.prototype.BeginKMOperation=function(){var t=this;return new e(function(e,n){var r=function(){t.m_kmActiveOperation?setTimeout(r,10):(t.m_kmActiveOperation=!0,e())};r()})},t.prototype.EndKMOperation=function(){this.m_kmActiveOperation=!1},t.prototype.GetCASettings=function(e){if(!e)return null;for(var t=this.m_settings.CAs,n=0;n<t.length;n++)for(var r=t[n].issuerCNs,i=0;i<r.length;i++)if(r[i]==e)return t[n];return null},t.prototype.GetDefaultTSPSettings=function(e){var t=null;if(e.TSPServer)t=e.TSPServer;else{for(var n=null,r=e.CAs,i=0;i<r.length&&(!r[i].tspAddress||!r[i].tspAddressPort||(n&&r[i].tspAddressPort!=`80`||(n=r[i]),n.tspAddressPort!=`80`));i++);n&&(t={address:n.tspAddress,port:n.tspAddressPort})}return t},t.prototype.IsCMPCompatible=function(e,t){return!!e.cmpAddress&&(e.cmpCompatibility===void 0||(e.cmpCompatibility&t)==t)},t.prototype.IsCMPsAvailable=function(e){for(var t=e.CAs,n=0;n<t.length;n++)if(this.IsCMPCompatible(t[n],f.EndUserCMPCompatibility.DownloadEUCerts))return!0;return!1},t.prototype.SetCMPSettings=function(t){var n=this,i=n.m_library,a=this.GetCASettings(t);return new e(function(e,o){if(t&&a==null&&!n.m_settings.allowForeignCAs)throw i.MakeError(r.EU_ERROR_WRITE_SETTINGS,``);var s=!(!a||!a.cmpAddress),c=i.CreateCMPSettings();c.SetUseCMP(s),s&&(c.SetAddress(a.cmpAddress),c.SetPort(`80`)),i.SetCMPSettings(c).then(function(){e()}).catch(function(e){o(n.MapError(e))})})},t.prototype.GetJKSPrivateKey=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){var s={alias:null,info:null};i.EnumJKSPrivateKeys(t,n).then(function(n){if(n!=null)return s.alias=n,i.GetJKSPrivateKey(t,n);e(null)}).then(function(e){s.info=e;for(var t=[],n=0;n<e.GetCertificatesCount();n++)t.push(e.GetCertificate(n));return r.ProcessArray(t,function(e){return i.ParseCertificateEx(e)})}).then(function(t){var n=new o.a;n.alias=s.alias,n.privateKey=s.info.GetPrivateKey(),n.certificates=[],n.digitalStamp=!1;for(var r=0;r<t.length;r++){var a=t[r];if(a.GetSubjType()==i.EU_SUBJECT_TYPE_END_USER){a.GetPublicKeyType()==i.EU_CERT_KEY_TYPE_DSTU4145&&(a.GetKeyUsageType()&i.EU_KEY_USAGE_DIGITAL_SIGNATURE)==i.EU_KEY_USAGE_DIGITAL_SIGNATURE&&(n.digitalStamp=a.GetExtKeyUsages().indexOf(i.EU_UA_OID_EXT_KEY_USAGE_STAMP)>-1);var l=new c.EndUserCertificate;l.data=s.info.GetCertificate(r),l.infoEx=u.a.MapToEndUserCertificateInfoEx(a,new d.a),n.certificates.push(l)}}n.digitalStamp=!1,e(n)}).catch(function(e){return a(r.MapError(e))})})},t.prototype.SaveCertificatesInternal=function(t){var n=this,r=this.m_library;return new e(function(e,i){t?Array.isArray(t)?n.ProcessArray(t,function(e){return r.SaveCertificate(e)}).then(function(){return e()}).catch(function(e){return i(e)}):r.SaveCertificates(t).then(function(){return e()}).catch(function(e){return i(e)}):e()})},t.prototype.CtxReadPrivateKeyInternal=function(t,n,i,a,o,s,c){c===void 0&&(c=!0);var l=this,u=this.m_library,d={pkContext:null};return t||=l.m_context,new e(function(e,f){l.SaveCertificatesInternal(o).then(function(){return l.SetCMPSettings(s)}).then(function(){return n!=null&&i!=null?u.CtxReadPrivateKeyBinary(t,n,i):u.CtxReadPrivateKey(t,a)}).then(function(e){d.pkContext=e;var t=e.GetOwnerInfo();if(!s)return l.SetCMPSettings(t.GetIssuerCN());var n=l.GetCASettings(t.GetIssuerCN());if(!n||n.issuerCNs.indexOf(s)==-1)throw u.MakeError(r.EU_ERROR_CERT_NOT_FOUND,``)}).then(function(){e(d.pkContext)}).catch(function(o){d.pkContext==null?l.MapError(o).code==r.EU_ERROR_CERT_NOT_FOUND&&!s&&c?l.SearchPrivateKeyCertificatesWithCMP(n,i,a).then(function(e){return l.CtxReadPrivateKeyInternal(t,n,i,a,e.certs,null,!1)}).then(function(t){e(t)}).catch(function(e){return f(l.MapError(e))}):f(l.MapError(o)):u.CtxFreePrivateKey(d.pkContext).then(function(){f(l.MapError(o))}).catch(function(){f(l.MapError(o))})})})},t.prototype.ReadPrivateKeyInternal=function(t,n,r,i,o){var s=this;return new e(function(e,c){s.ResetPrivateKeyInternal().then(function(){return s.CtxReadPrivateKeyInternal(s.m_context,t,n,r,i,o,!0)}).then(function(t){s.m_pkContext=t,e(u.a.MapEndUserOwnerInfo(t.GetOwnerInfo(),new a.a))}).catch(function(e){c(s.MapError(e))})})},t.prototype.ResetPrivateKeyInternal=function(){var t=this,n=this.m_library;return new e(function(e,r){t.m_pkContext==null?e():n.CtxFreePrivateKey(t.m_pkContext).then(function(){t.m_pkContext=null,e()}).catch(function(e){return r(t.MapError(e))})})},t.prototype.SearchPrivateKeyCertificatesWithCMP=function(t,n,i,a){var o=this,s=o.m_library,c=o.m_settings.CAs;return new e(function(e,l){if(o.IsCMPsAvailable(o.m_settings))(t!=null&&n!=null?s.GetKeyInfoBinary(t,n):s.GetKeyInfo(i)).then(function(t){var n=function(i,u){if(i>=c.length){var d=s.MakeError(u?r.EU_ERROR_CERT_NOT_FOUND:r.EU_ERROR_TRANSMIT_REQUEST,``);l(o.MapError(d))}else{var p=a?f.EndUserCMPCompatibility.DownloadEUCerts:f.EndUserCMPCompatibility.SearchEUCerts;o.IsCMPCompatible(c[i],p)?a&&c[i].issuerCNs.indexOf(a)==-1?n(i+1,u):s.GetCertificatesByKeyInfo(t,[c[i].cmpAddress],[`80`]).then(function(t){e({certs:t,CACommonName:c[i].issuerCNs[0]})}).catch(function(e){var t=e.GetErrorCode();t!=r.EU_ERROR_CERT_NOT_FOUND&&t!=r.EU_ERROR_TRANSMIT_REQUEST||(u||=t==r.EU_ERROR_CERT_NOT_FOUND),n(i+1,u)}):n(i+1,u)}};n(0,!1)}).catch(function(e){return l(o.MapError(e))});else{var u=s.MakeError(r.EU_ERROR_CERT_NOT_FOUND,``);l(o.MapError(u))}})},t.prototype.GetUserCertificatesFromCertificates=function(t){var n=this,r=n.m_library;return new e(function(e,i){var a=[],o=function(s){r.GetCertificateFromSignedData(s,t).then(function(t){if(t!=null){var n=new c.EndUserCertificate;return n.data=t,a.push(n),r.ParseCertificateEx(t)}for(var i=[],o=0;o<a.length;o++)a[o].infoEx.subjType==r.EU_SUBJECT_TYPE_END_USER&&i.push(a[o]);e(i)}).then(function(e){a[s].infoEx=u.a.MapToEndUserCertificateInfoEx(e,new d.a),o(s+1)}).catch(function(e){return i(n.MapError(e))})};o(0)})},t.prototype.GeneratePrivateKeyInternal=function(t,n,r,i,a,o,s,c,l,d,f,p,m){var g=this,_=this.m_library;return new e(function(e,v){var y=t==null&&r==null,b=r!=null,x=_.CreatePrivateKeyInfo(),S=null;p!=null&&(S=u.a.MapFromEndUserInfo(p,_.CreateEndUserInfo())),_.GeneratePrivateKeyEx(y,t?t.GetTypeIndex():-1,t?t.GetDevIndex():-1,t?t.GetPassword():r,n,i,a,o,s,c,l,d,f,S,m,x,r!=null).then(function(t){for(var n=[],r=0;r<t.size();r++){var i=t.get(r);i=u.a.MapToEndUserRequestInfo(i,new h.a),n.push(i)}e({key:b?x.GetPrivateKey():null,requests:n})}).catch(function(e){return v(g.MapError(e))})})},t.prototype.GetSignAlgoByCertificate=function(e){switch(e.GetInfoEx().GetPublicKeyType()){case f.EndUserCertKeyType.DSTU4145:return e.GetInfoEx().GetCertHashType()==f.EndUserCertHashType.GOST34311?f.EndUserSignAlgo.DSTU4145WithGOST34311:f.EndUserSignAlgo.DSTU4145WithDSTU7564;case f.EndUserCertKeyType.RSA:return f.EndUserSignAlgo.RSAWithSHA;case f.EndUserCertKeyType.ECDSA:return f.EndUserSignAlgo.ECDSAWithSHA;default:return f.EndUserSignAlgo.Unknown}},t.prototype.GetHashAlgoBySignAlgo=function(e){var t=this.m_library;switch(e){case f.EndUserSignAlgo.DSTU4145WithGOST34311:return f.EndUserHashAlgo.GOST34311;case f.EndUserSignAlgo.RSAWithSHA:case f.EndUserSignAlgo.ECDSAWithSHA:return f.EndUserHashAlgo.SHA256;case f.EndUserSignAlgo.DSTU4145WithDSTU7564:return f.EndUserHashAlgo.DSTU7564_256;default:throw t.MakeError(r.EU_ERROR_BAD_PARAMETER,``)}},t.prototype.CtxSignHashInternal=function(t,n,i,a,o,s){var c=this,l=this.m_library,u=a!=null,d=c.DataToNamedDataArray(i),f=c.DataToNamedDataArray(a);return new e(function(a,p){c.CheckInitialize().then(function(){if(t==null)throw l.MakeError(r.EU_ERROR_BAD_CERT,``);if(u&&d.length!=f.length)throw l.MakeError(r.EU_ERROR_BAD_PARAMETER,``);for(var i=[],a=0;a<d.length;a++)i.push({hash:d[a],previousSign:u?f[a]:null});return c.ProcessArray(i,function(r){return new e(function(e,i){(u?l.CtxAppendSignHash(t,n,r.hash.val,r.previousSign.val,o):l.CtxSignHash(t,n,r.hash.val,o)).then(function(e){return s?e:l.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return i(e)})})})}).then(function(e){a(c.DataToResult(i,e))}).catch(function(e){return p(c.MapError(e))})})},t.prototype.CtxSignDataInternal=function(t,n,i,a,o,s,c){var l=this,u=this,d=this.m_library,p=a!=null,m=u.DataToNamedDataArray(i),h=u.DataToNamedDataArray(a);return new e(function(g,_){u.CheckInitialize().then(function(){if(t==null)throw d.MakeError(r.EU_ERROR_BAD_CERT,``);if(p&&o&&m.length!=h.length)throw d.MakeError(r.EU_ERROR_BAD_PARAMETER,``);return n==f.EndUserSignAlgo.Unknown?d.CtxEnumOwnCertificates(t,0):null}).then(function(e){if(n==f.EndUserSignAlgo.Unknown&&e!=null&&(n=u.GetSignAlgoByCertificate(e)),!o)return m;var t=u.GetHashAlgoBySignAlgo(n);return u.HashData(t,m,!0)}).then(function(r){for(var i=[],a=p?h.length:r.length,l=0;l<a;l++)i.push({dataOrHash:r==null?null:r[l],previousSign:p?h[l]:null});return u.ProcessArray(i,function(r){return new e(function(e,i){(p?o?d.CtxAppendSignHash(t,n,r.dataOrHash.val,r.previousSign.val,s):d.CtxAppendSign(t,n,null,r.previousSign.val,s):o?d.CtxSignHash(t,n,r.dataOrHash.val,s):d.CtxSign(t,n,r.dataOrHash.val,!1,s)).then(function(e){return c?e:d.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return i(e)})})})}).then(function(e){g(l.DataToResult(p&&!o?a:i,e))}).catch(function(e){return _(u.MapError(e))})})},t.prototype.LoadTaxReportPKey=function(t,n,i){var a=this,o=this.m_library;return new e(function(e,s){var c=new x;if(Array.isArray(t)||(t=[t]),t.length>2)s(a.MapError(o.MakeError(r.EU_ERROR_BAD_PARAMETER,``)));else{var l=function(u,d){var p=n[u],m=t[d];o.CtxGetOwnCertificate(m,f.EndUserCertKeyType.DSTU4145,p).then(function(t){if(i&&p&f.EndUserKeyUsage.DigitalSignature&&!(t.GetInfoEx().GetExtKeyUsages().indexOf(o.EU_UA_OID_EXT_KEY_USAGE_STAMP)>-1))throw o.MakeError(r.EU_ERROR_BAD_PARAMETER,``);if(p&f.EndUserKeyUsage.DigitalSignature)c.signPKCtx=m,c.signCert=t;else{if(!(p&f.EndUserKeyUsage.KeyAgreement))throw o.MakeError(r.EU_ERROR_BAD_PARAMETER,``);c.envelopPKCtx=m,c.envelopCert=t}u+1<n.length?l(u+1,0):e(c)}).catch(function(e){if(e.GetErrorCode()==r.EU_ERROR_CERT_NOT_FOUND){if(d+1<t.length)return void l(u,d+1);e=o.MakeError(r.EU_ERROR_BAD_PARAMETER,``)}s(a.MapError(e))})};l(0,0)}})},t.prototype.ProtectTaxReport=function(t,n,i,a,o,s,c){var l=this,u=this.m_library,d=new p.b;d.name=s.name;var f=function(t,n){return new e(function(e,r){return u.CtxSign(t.signPKCtx,l.GetSignAlgoByCertificate(t.signCert),n,!1,!0).then(function(e){return u.BASE64Decode(e)}).then(function(e){return u.AppendCryptoHeader(u.EU_HEADER_CA_TYPE,u.EU_HEADER_PART_TYPE_SIGNED,e)}).then(function(t){e(t)}).catch(function(e){return r(l.MapError(e))})})},m=function(t,n){return new e(function(r,i){return u.CtxEnvelop(t.envelopPKCtx,[o],u.EU_RECIPIENT_APPEND_ISSUER_AND_SERIAL,!1,!1,n).then(function(e){return u.BASE64Decode(e)}).then(function(e){return u.AppendCryptoHeader(u.EU_HEADER_CA_TYPE,u.EU_HEADER_PART_TYPE_ENCRYPTED,e)}).then(function(n){var r=t.envelopCert,i=u.EU_KEY_USAGE_DIGITAL_SIGNATURE|u.EU_KEY_USAGE_KEY_AGREEMENT;return i==(r.GetInfoEx().GetKeyUsageType()&i)?n:function(t,n){return new e(function(e,r){return u.AppendCryptoHeader(u.EU_HEADER_CA_TYPE,u.EU_HEADER_PART_TYPE_CERTCRYPT,t).then(function(t){var r=new Uint8Array(t.byteLength+n.byteLength);r.set(new Uint8Array(t),0),r.set(new Uint8Array(n),t.byteLength),e(r)}).catch(function(e){return r(l.MapError(e))})})}(r.GetData(),n)}).then(function(e){return f(t,e)}).then(function(e){r({reportData:e,ownCert:t.envelopCert.GetData()})}).catch(function(e){return i(l.MapError(e))})})};return new e(function(o,p){new e(function(e,t){e(s.data)}).then(function(e){return t==null?e:f(t,e)}).then(function(e){return n==null?e:f(n,e)}).then(function(e){return i==null?e:f(i,e)}).then(function(e){return c&&(d.signedData=e),n!=null||i!=null?m(i??n,e):{reportData:e,ownCert:t.signCert.GetData()}}).then(function(e){return u.AppendTransportHeader(u.EU_HEADER_CA_TYPE,s.name,a,e.ownCert,e.reportData)}).then(function(e){d.data=e,d.error=l.MapError(u.MakeError(r.EU_ERROR_NONE,``)),o(d)}).catch(function(e){d.error=l.MapError(e),o(d)})})},t.prototype.UnprotectTaxReceipt=function(t,n){var i=this,a=this.m_library,o=new p.a;return o.data=null,o.receiptNumber=0,o.initiators=[],o.error=null,new e(function(s,c){var l;(l=n.data,new e(function(e,t){a.ParseTransportHeader(l).then(function(t){o.receiptNumber=t.GetReceiptNumber(),e(t.GetCryptoData())}).catch(function(n){n.GetErrorCode()==r.EU_ERROR_PKI_FORMATS_FAILED?e(l):t(i.MapError(n))})})).then(function(n){var l=function(n){(function(n){var s={headerInfo:null};return new e(function(e,c){a.ParseCryptoHeader(n).then(function(e){s.headerInfo=e;var n=e.GetCryptoData();switch(e.GetHeaderType()){case a.EU_HEADER_PART_TYPE_SIGNED:return a.VerifyDataInternalOnTimeEx(n,0,null,!1,!1);case a.EU_HEADER_PART_TYPE_ENCRYPTED:return a.CtxDevelop(t,n);case a.EU_HEADER_PART_TYPE_STAMPED:case a.EU_HEADER_PART_TYPE_CERTCRYPT:return null;default:throw a.MakeError(r.EU_ERROR_PKI_FORMATS_FAILED,``)}}).then(function(t){if(t!=null){var r=s.headerInfo.GetHeaderType()==a.EU_HEADER_PART_TYPE_SIGNED?u.a.MapToEndUserSignInfo(t,new _.a):u.a.MapToEndUserSenderInfo(t,new v.a);o.initiators.push(r),n=t.GetData()}else n=n.slice(s.headerInfo.GetHeaderSize()+s.headerInfo.GetCryptoData().length,n.length);e(n)}).catch(function(t){t.GetErrorCode()==r.EU_ERROR_BAD_PARAMETER?e(null):c(i.MapError(t))})})})(n).then(function(e){if(e==null)return o.data=n,o.error=i.MapError(a.MakeError(r.EU_ERROR_NONE,``)),void s(o);l(e)}).catch(function(e){return c(i.MapError(e))})};l(n)}).catch(function(e){return c(i.MapError(e))})})},t.prototype.GetKSPSettings=function(e){var t;if(!this.m_settings.KSPs)return null;if(typeof e==`string`){for(t=0;t<this.m_settings.KSPs.length;t++)if(this.m_settings.KSPs[t].name==e)return this.m_settings.KSPs[t];return null}if(typeof e==`number`){for(t=0;t<this.m_settings.KSPs.length;t++)if(this.m_settings.KSPs[t].ksp==e)return this.m_settings.KSPs[t];return null}return null},t.prototype.GetPollingInterval=function(e){return e&&typeof e.pollingInterval==`number`?1e3*e.pollingInterval:1e3},t.prototype.MakeNewCertificateKSP=function(t,n,i,a,o,s,l,d,f,p,m,h,g,_,v,y,b,x,S,C){x===void 0&&(x=!1),S===void 0&&(S=null),C===void 0&&(C=null);var w=this,T=w.m_library,E={kspSettings:null,userId:null,operationId:null},D={key:null,certs:null,cmpRequest:null};return new e(function(d,m){w.CheckInitialize().then(function(){return w.BeginKMOperation()}).then(function(){var e=null;return t!=null&&(e=u.a.MapFromKeyMedia(t,T.CreateKeyMedia())),x?null:w.ReadPrivateKeyInternal(n,i,e,null,y)}).then(function(e){return b&&!x?T.CtxGetOwnEUserParams(w.m_pkContext):null}).then(function(e){return b?T.CtxModifyOwnEUserParams(w.m_pkContext,b.phone,b.EMail):null}).then(function(){if(E.userId=S,E.kspSettings=w.GetKSPSettings(C),!E.kspSettings||!E.kspSettings.address||f!=T.EU_KEYS_TYPE_NONE&&f!=T.EU_KEYS_TYPE_RSA_WITH_SHA&&f!=T.EU_KEYS_TYPE_ECDSA_WITH_SHA)throw T.MakeError(r.EU_ERROR_BAD_PARAMETER,``);var e=[];e[T.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_GOSTS]=`DSTU4145`,e[T.EU_KEYS_TYPE_RSA_WITH_SHA]=`RSA`,e[T.EU_KEYS_TYPE_ECDSA_WITH_SHA]=`ECDSA`,e[T.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_DSTU]=`DSTU4145-DSTU7564`,o!=T.EU_KEYS_LENGTH_DS_UA_FILE&&o!=T.EU_KEYS_LENGTH_DS_UA_CERT||(o=T.EU_KEYS_LENGTH_DS_UA_257),l!=T.EU_KEYS_LENGTH_KEP_UA_FILE&&l!=T.EU_KEYS_LENGTH_KEP_UA_CERT||(l=T.EU_KEYS_LENGTH_KEP_UA_431),p!=T.EU_KEYS_LENGTH_DS_RSA_FILE&&p!=T.EU_KEYS_LENGTH_DS_RSA_CERT||(p=T.EU_KEYS_LENGTH_DS_RSA_2048),h!=T.EU_KEYS_LENGTH_DS_ECDSA_FILE&&h!=T.EU_KEYS_LENGTH_DS_ECDSA_CERT||(h=T.EU_KEYS_LENGTH_DS_ECDSA_256);var t=[];t[T.EU_KEYS_LENGTH_DS_UA_191]=191,t[T.EU_KEYS_LENGTH_DS_UA_257]=257,t[T.EU_KEYS_LENGTH_DS_UA_307]=307;var n=[];n[T.EU_KEYS_LENGTH_KEP_UA_257]=257,n[T.EU_KEYS_LENGTH_KEP_UA_431]=431,n[T.EU_KEYS_LENGTH_KEP_UA_571]=571;var i=[];i[T.EU_KEYS_LENGTH_DS_RSA_1024]=1024,i[T.EU_KEYS_LENGTH_DS_RSA_2048]=2048,i[T.EU_KEYS_LENGTH_DS_RSA_3072]=3072,i[T.EU_KEYS_LENGTH_DS_RSA_4096]=4096;var c=[];c[T.EU_KEYS_LENGTH_DS_ECDSA_192]=192,c[T.EU_KEYS_LENGTH_DS_ECDSA_256]=256,c[T.EU_KEYS_LENGTH_DS_ECDSA_384]=384,c[T.EU_KEYS_LENGTH_DS_ECDSA_521]=521;var u=e[a]||null,d=t[o]||0,m=n[l]||0,g=null,_=0;f&T.EU_KEYS_TYPE_RSA_WITH_SHA?(g=`RSA`,_=i[p]||0):f&T.EU_KEYS_TYPE_ECDSA_WITH_SHA&&(g=`ECDSA`,_=c[h]||0);var v=`Веб-сайт: %s`.replace(`%s`,E.kspSettings.systemId||w.m_origin),y=`Генерація ос. ключа у системі %s`.replace(`%s`,E.kspSettings.systemId||w.m_origin);return T.SServerClientGeneratePrivateKeyAsync(E.kspSettings.address,E.kspSettings.port,E.userId,v,y,u,d,s,m,g,_)}).then(function(t){E.operationId=t;var n=w.GetPollingInterval(E.kspSettings),i=w.MakeExpireDate(300);return new e(function(e,t){var a=function(i){new Date>i?t(T.MakeError(r.EU_ERROR_TRANSMIT_REQUEST,``)):w.m_library.SServerClientCheckGeneratePrivateKeyStatus(E.kspSettings.address,E.kspSettings.port,E.userId,E.operationId).then(function(t){t==null?setTimeout(function(){a(i)},n):e(t)}).catch(function(e){t(w.MapError(e))})};a(i)})}).then(function(e){for(var t=null,n=null,r=null,i=null,a=0;a<e.size();a++){var o=e.get(a);switch(o.GetRequestType()){case T.EU_KEYS_REQUEST_TYPE_UA_DS:t=o.GetRequest();break;case T.EU_KEYS_REQUEST_TYPE_UA_KEP:n=o.GetRequest();break;case T.EU_KEYS_REQUEST_TYPE_INTERNATIONAL:f&T.EU_KEYS_TYPE_RSA_WITH_SHA?r=o.GetRequest():f&T.EU_KEYS_TYPE_ECDSA_WITH_SHA&&(i=o.GetRequest())}}return w.m_library.CtxMakeNewOwnCertificateWithCR(w.m_pkContext,t,n,r,i)}).then(function(){var e=`Веб-сайт: %s`.replace(`%s`,E.kspSettings.systemId||w.m_origin),t=`Ідентифікація клієнта у системі %s`.replace(`%s`,E.kspSettings.systemId||w.m_origin),n=E.kspSettings.signAlgos&&E.kspSettings.signAlgos.indexOf(T.EU_CTX_SIGN_DSTU4145_WITH_DSTU7564)>=0?`DSTU4145-DSTU7564`:`DSTU4145`;return T.SServerClientSignHashesAsync(E.kspSettings.address,E.kspSettings.port,E.userId,e,t,[`Зчитування ос. ключа`],[`AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=`],n)}).then(function(t){E.operationId=t;var n=w.GetPollingInterval(E.kspSettings),i=w.MakeExpireDate(300);return new e(function(e,t){var a=function(i){new Date>i?t(T.MakeError(r.EU_ERROR_TRANSMIT_REQUEST,``)):T.SServerClientCheckSignHashesStatus(E.kspSettings.address,E.kspSettings.port,E.userId,E.operationId).then(function(o){if(o!=null){if(o.size()==1){var s=o.get(0);if(s.GetError()==r.EU_ERROR_NONE){var l=s.GetSignature(),d=new c.EndUserCertificate;T.CtxGetSignerInfo(w.m_context,0,l).then(function(t){u.a.MapToEndUserCertificate(t,d),e([d])}).catch(function(e){return t(w.MapError(e))})}else t(T.MakeError(s.GetError(),s.GetStatus()))}else t(T.MakeError(r.EU_ERROR_PKI_FORMATS_FAILED,``))}else setTimeout(function(){a(i)},n)}).catch(function(e){t(w.MapError(e))})};a(i)})}).then(function(e){w.EndKMOperation(),D.certs=e,d(D)}).catch(function(e){w.ResetPrivateKeyInternal().then(function(){w.EndKMOperation(),m(w.MapError(e))}).catch(function(){w.EndKMOperation(),m(w.MapError(e))})})})},t.prototype.AddEventListener=function(t,n){var i=this,a=i.m_library;return new e(function(e,o){if([f.EndUserEventType.None,f.EndUserEventType.All,f.EndUserEventType.ConfirmKSPOperation].indexOf(t)<0)o(i.MapError(a.MakeError(r.EU_ERROR_BAD_PARAMETER,``)));else{switch(t){case f.EndUserEventType.None:i.m_eventListeners=[];break;case f.EndUserEventType.All:i.m_eventListeners=[],i.m_eventListeners[t]=n;break;default:i.m_eventListeners[t]=n}e()}})},t.prototype.GetLibraryInfo=function(t){var n=this,r=this.m_library;return new e(function(e,i){var a=new l.b;a.supported=r.IsSupported(),a.isSignAgentSupported=r.IsSignAgentSupported(),a.isWebExtensionSupported=r.IsWebExtensionSupported(),a.isNPAPISupported=r.IsNPAPISupported(),a.isActiveXSupported=r.IsActiveXSupported(),a.isWebExtensionInstalled=r.IsWebExtensionInstalled(),a.nativeLibraryInstallURLs=r.GetInstallURL(!0,t),a.nativeLibraryInstallURL=a.nativeLibraryInstallURLs?a.nativeLibraryInstallURLs[0]:null,a.nativeLibraryUpdateURLs=r.GetUpdateURL(!0,t),a.nativeLibraryUpdateURL=a.nativeLibraryUpdateURLs?a.nativeLibraryUpdateURLs[0]:null,a.webExtensionInstallURL=r.GetWebExtensionInstallURL(),a.helpURL=r.GetHelpURL(t),a.supported?r.Load().then(function(){a.loaded=!0,r.GetVersion().then(function(t){a.version=t,e(a)}).catch(function(e){return i(n.MapError(e))})}).catch(function(t){var i=n.MapError(t);a.loaded=!1,a.isNativeLibraryNeedUpdate=r.IsLibraryVersionNotSupportedError(i.code),e(a)}):e(a)})},t.prototype.IsInitialized=function(){var t=this;return new e(function(e,n){e(t.m_initialized)})},t.prototype.Initialize=function(t){var n=this,r=n.m_library;n.m_settings=t;var i={offline:!0,tspSettings:null,useOCSP:!1,useCMP:!1};return new e(function(e,a){r.Load().then(function(){return r.SetRuntimeParameter(r.EU_SAVE_SETTINGS_PARAMETER,r.EU_SETTINGS_ID_PROXY)}).then(function(){return r.SetUIMode(!1)}).then(function(){return r.Initialize()}).then(function(){return r.SetUIMode(!1)}).then(function(){return r.SetCharset(n.m_settings.encoding)}).then(function(){return r.SetLanguage(n.m_settings.language)}).then(function(){return r.InitializeMandatorySettings()}).then(function(){var e=r.CreateFileStoreSettings();return e.SetPath(``),e.SetSaveLoadedCerts(!0),r.SetFileStoreSettings(e)}).then(function(){return n.m_settings.CAs!=null&&typeof n.m_settings.CAs==`string`?r.DownloadData(n.m_settings.CAs,`json`):n.m_settings.CAs}).then(function(e){n.m_settings.CAs=e,i.tspSettings=n.GetDefaultTSPSettings(n.m_settings);for(var t=0;t<e.length;t++)if(e[t].ocspAccessPointAddress&&e[t].ocspAccessPointPort){i.useOCSP=!0;break}i.useCMP=n.IsCMPsAvailable(n.m_settings),i.offline=!i.tspSettings&&!i.useOCSP&&!i.useCMP;var a=r.CreateModeSettings();return a.SetOfflineMode(i.offline),r.SetModeSettings(a)}).then(function(){var e=r.CreateTSPSettings();return e.SetGetStamps(!!i.tspSettings),i.tspSettings&&(e.SetAddress(i.tspSettings.address),e.SetPort(i.tspSettings.port)),r.SetTSPSettings(e)}).then(function(){var e=r.CreateOCSPSettings();return e.SetUseOCSP(i.useOCSP),i.useOCSP&&(e.SetBeforeStore(!0),e.SetAddress(`czo.gov.ua`),e.SetPort(`80`)),r.SetOCSPSettings(e)}).then(function(){var e=r.CreateOCSPAccessInfoModeSettings();return e.SetEnabled(i.useOCSP),r.SetOCSPAccessInfoModeSettings(e)}).then(function(){if(i.useOCSP){for(var e=[],t=n.m_settings.CAs,a=0;a<t.length;a++)for(var o=0;o<t[a].issuerCNs.length;o++){var s=r.CreateOCSPAccessInfoSettings();s.SetAddress(t[a].ocspAccessPointAddress),s.SetPort(t[a].ocspAccessPointPort),s.SetIssuerCN(t[a].issuerCNs[o]),e.push(s)}return r.SetOCSPAccessInfoSettings(e)}}).then(function(){return t.CACertificates!=null&&typeof t.CACertificates==`string`?r.DownloadData(t.CACertificates,`binary`):t.CACertificates}).then(function(e){if(t.CACertificates!=null)return r.SaveCertificates(e)}).then(function(){var e=!!t.TSLAddress,n=r.CreateTSLSettings();return n.SetUseTSL(e),n.SetAutoDownloadTSL(!!e),n.SetTSLAddress(e?t.TSLAddress:``),r.SetTSLSettings(n)}).then(function(){return r.SetRuntimeParameter(r.EU_RESOLVE_OIDS_PARAMETER,n.m_resolveOIDs)}).then(function(){if(typeof n.m_settings.connectionTimeout==`number`)return r.SetRuntimeParameter(r.EU_CONNECTIONS_TIMEOUT_PARAMETER,n.m_settings.connectionTimeout)}).then(function(){if(typeof t.ocspResponseExpireTime==`number`)return r.SetOCSPResponseExpireTime(n.m_settings.ocspResponseExpireTime)}).then(function(){return r.CtxCreate()}).then(function(e){return n.m_context=e,r.CtxSetParameter(e,r.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,n.m_resolveOIDs)}).then(function(){if(n.m_settings.useSLoginPrivateKey)return r.CtxSetParameter(n.m_context,r.EU_USE_SLOGIN_PRIVATE_KEY_CONTEXT_PARAMETER,!0)}).then(function(){return r.SetRuntimeParameter(r.EU_CHECK_CERT_CHAIN_ON_SIGN_TIME_PARAMETER,!0)}).then(function(){return n.m_settings.signInfoTmpl!=null&&typeof n.m_settings.signInfoTmpl==`string`?r.DownloadData(n.m_settings.signInfoTmpl,``):n.m_settings.signInfoTmpl}).then(function(t){n.m_settings.signInfoTmpl=t,n.m_initialized=!0,e()}).catch(function(e){return a(n.MapError(e))})})},t.prototype.Finalize=function(){var t=this,n=t.m_library;return new e(function(e,r){t.CheckInitialize().then(function(){if(t.m_pkContext!=null)return n.CtxFreePrivateKey(t.m_pkContext)}).then(function(){if(t.m_pkContext=null,t.m_context!=null)return n.CtxFree(t.m_context)}).then(function(){return t.m_context=null,n.Finalize()}).then(function(){t.m_initialized=!1,t.m_settings=null,t.m_kmTypes=null,t.m_kmActiveOperation=!1,t.m_eventListeners=[],t.m_resolveOIDs=!1,e()}).then(function(){e()}).catch(function(e){return r(t.MapError(e))})})},t.prototype.SetLanguage=function(t){var n=this,r=n.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return r.SetLanguage(t)}).then(function(){n.m_settings.language=t}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.SetRuntimeParameter=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return i.SetRuntimeParameter(t,n)}).then(function(){return t==i.EU_USE_SLOGIN_PRIVATE_KEY?i.CtxSetParameter(r.m_context,t,n):null}).then(function(){e()}).catch(function(e){return a(r.MapError(e))})})},t.prototype.GetStorageParameter=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return i.GetStorageParameter(n,t)}).then(function(t){e(t)}).catch(function(e){return a(r.MapError(e))})})},t.prototype.SetStorageParameter=function(t,n,r){var i=this,a=i.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.SetStorageParameter(r,t,n)}).then(function(){e()}).catch(function(e){return o(i.MapError(e))})})},t.prototype.GetCAs=function(){var t=this;return new e(function(e,n){t.CheckInitialize().then(function(){e(t.m_settings.CAs)}).catch(function(e){return n(t.MapError(e))})})},t.prototype.GetProxySettings=function(){var t=this,n=t.m_library;return new e(function(e,r){t.CheckInitialize().then(function(){return n.GetProxySettings()}).then(function(t){e(u.a.MapToProxySettings(t,new i.b))}).catch(function(e){return r(t.MapError(e))})})},t.prototype.SetProxySettings=function(t){var n=this,r=n.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){var e=u.a.MapFromProxySettings(t,r.CreateProxySettings());return r.SetProxySettings(e)}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.GetHostInfo=function(){var t=this,n=t.m_library;return new e(function(e,r){t.CheckInitialize().then(function(){return n.GetHostInfo()}).then(function(t){e(t)}).catch(function(e){return r(t.MapError(e))})})},t.prototype.GetKeyMedias=function(){var t=this,n=t.m_library,r=[],i=null;return t.m_settings.allowedKeyMediaDevices&&(i={},t.m_settings.allowedKeyMediaDevices.forEach(function(e){i[e.type]=e.devices})),new e(function(e,a){t.CheckInitialize().then(function(){return t.BeginKMOperation()}).then(function(){return t.m_kmTypes?t.m_kmTypes:n.GetKeyMediaTypes()}).then(function(e){t.m_kmTypes=e;var i=t.m_settings.allowedKeyMediaTypes;r=[];for(var a=0;a<e.length;a++){var o=e[a];(!i||i.indexOf(o)>=0)&&r.push(a)}return n.GetKeyMediaDevices(r)}).then(function(n){for(var a=[],o=0;o<n.length;o++)for(var s=r[o],l=t.m_kmTypes[s],u=n[o],d=i&&i[l]?i[l]:null,f=0;f<u.length;f++)if(!d||d.indexOf(u[f])!=-1){var p=new c.EndUserKeyMedia;p.typeIndex=s,p.devIndex=f,p.password=null,p.type=l,p.device=u[f],p.visibleName=p.device+`(`+p.type+`)`,a.push(p)}t.EndKMOperation(),e(a)}).catch(function(e){t.EndKMOperation(),a(t.MapError(e))})})},t.prototype.GetJKSPrivateKeys=function(t){var n=this;return new e(function(e,r){n.CheckInitialize().then(function(){var i=[],a=function(o){n.GetJKSPrivateKey(t,o).then(function(t){t?(i.push(t),a(o+1)):e(i)}).catch(function(e){return r(n.MapError(e))})};a(0)}).catch(function(e){return r(n.MapError(e))})})},t.prototype.IsPrivateKeyReaded=function(){var t=this;return new e(function(e,n){t.CheckInitialize().then(function(){e(t.m_pkContext!=null)}).catch(function(e){return n(t.MapError(e))})})},t.prototype.ResetPrivateKey=function(){var t=this;return new e(function(e,n){t.CheckInitialize().then(function(){return t.ResetPrivateKeyInternal()}).then(function(){e()}).catch(function(e){return n(t.MapError(e))})})},t.prototype.ResetOperationKSP=function(){var t=this,n=this.m_library;return new e(function(e,i){t.CheckInitialize().then(function(){throw n.MakeError(r.EU_ERROR_NOT_SUPPORTED,``)}).catch(function(e){return i(t.MapError(e))})})},t.prototype.ReadPrivateKey=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){i.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(t,a.CreateKeyMedia());return i.ReadPrivateKeyInternal(null,null,e,n,r)}).then(function(t){i.EndKMOperation(),e(t)}).catch(function(e){i.EndKMOperation(),o(i.MapError(e))})})},t.prototype.ReadPrivateKeyBinary=function(t,n,r,i){var a=this;return new e(function(e,o){a.CheckInitialize().then(function(){return a.ReadPrivateKeyInternal(t,n,null,r,i)}).then(function(t){e(t)}).catch(function(e){return o(a.MapError(e))})})},t.prototype.ReadPrivateKeySIM=function(t,n,i,a){var o=this,s=this.m_library;return new e(function(e,t){o.CheckInitialize().then(function(){throw s.MakeError(r.EU_ERROR_NOT_SUPPORTED,``)}).catch(function(e){return t(o.MapError(e))})})},t.prototype.ReadPrivateKeyKSP=function(t,n,i,a,o,s,c){var l=this,u=this.m_library;return new e(function(e,t){l.CheckInitialize().then(function(){throw u.MakeError(r.EU_ERROR_NOT_SUPPORTED,``)}).catch(function(e){return t(l.MapError(e))})})},t.prototype.GetOwnCertificates=function(){return this.CtxGetOwnCertificates(this.m_pkContext)},t.prototype.GetOwnEUserParams=function(){var t=this,n=t.m_library;return new e(function(e,i){t.CheckInitialize().then(function(){if(t.m_pkContext==null)throw n.MakeError(r.EU_ERROR_BAD_CERT,``);return n.CtxGetOwnEUserParams(t.m_pkContext)}).then(function(t){e(u.a.MapToEndUserParams(t,new m.a))}).catch(function(e){return i(t.MapError(e))})})},t.prototype.ChangeOwnCertificatesStatus=function(t,n){var i=this,a=i.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){if(i.m_pkContext==null)throw a.MakeError(r.EU_ERROR_BAD_CERT,``);return a.CtxChangeOwnCertificatesStatus(i.m_pkContext,t,n)}).then(function(){e()}).catch(function(e){return o(i.MapError(e))})})},t.prototype.MakeNewCertificate=function(t,n,r,i,a,o,s,c,l,d,f,p,m,h,g,_,v,y,b,x){_===void 0&&(_=!1),v===void 0&&(v=null),y===void 0&&(y=null),b===void 0&&(b=0),x===void 0&&(x=null);var S=this,C=S.m_library,w={key:null,certs:null,cmpRequest:null};return v!=null||y!=null?S.MakeNewCertificateKSP(t,n,r,i,a,o,s,c,l,d,f,b,x,p,m,h,g,_,v,y):new e(function(v,y){S.CheckInitialize().then(function(){return S.BeginKMOperation()}).then(function(){var e=null;return t!=null&&(e=u.a.MapFromKeyMedia(t,C.CreateKeyMedia())),_?null:S.ReadPrivateKeyInternal(n,r,e,null,h)}).then(function(e){return g&&!_?C.CtxGetOwnEUserParams(S.m_pkContext):null}).then(function(e){return g?C.CtxModifyOwnEUserParams(S.m_pkContext,g.phone,g.EMail):null}).then(function(){return _?null:S.ResetPrivateKeyInternal()}).then(function(){if(_)return new e(function(e,n){var r={makeCertResult:null};C.CtxMakeNewOwnCertificateEx(S.m_pkContext,i,a,o,s,c,l,d,f,b,x).then(function(e){return r.makeCertResult=e,S.ResetPrivateKeyInternal()}).then(function(){var e=u.a.MapFromKeyMedia(t,C.CreateKeyMedia());return p&&p.password!=t.password?C.ChangePrivateKeyPassword(e,p.password):null}).then(function(){e(r.makeCertResult)}).catch(function(e){n(S.MapError(e))})});var h=null,g=null;return t&&(h=u.a.MapFromKeyMedia(t,C.CreateKeyMedia())),p&&(g=u.a.MapFromKeyMedia(p,C.CreateKeyMedia())),C.MakeNewCertificateEx(h,n,r,i,a,o,s,c,l,d,f,b,x,g,m)}).then(function(e){w.key=e.GetPrivateKey(),w.cmpRequest=e.GetCMPRequest();var n=null;return(_&&t||p)&&(n=u.a.MapFromKeyMedia(p||t,C.CreateKeyMedia())),S.SearchPrivateKeyCertificatesWithCMP(w.key,m,n,h)}).then(function(e){return S.GetUserCertificatesFromCertificates(e.certs)}).then(function(e){S.EndKMOperation(),w.certs=e,v(w)}).catch(function(e){S.EndKMOperation(),y(S.MapError(e))})})},t.prototype.MakeDeviceCertificate=function(t,n,i,a,o){var s=this,l=s.m_library;return new e(function(f,p){s.CheckInitialize().then(function(){if(s.m_pkContext==null)throw l.MakeError(r.EU_ERROR_BAD_CERT,``);var e=s.m_pkContext.GetOwnerInfo(),c=s.GetCASettings(e.GetIssuerCN());if(!c||!c.cmpAddress||c.cmpAddress==``)throw l.MakeError(r.EU_ERROR_BAD_PARAMETER,``);return l.CtxMakeDeviceCertificate(s.m_pkContext,t,n,i,a,o,c.cmpAddress,`80`)}).then(function(t){return s.ProcessArray(t,function(t){return new e(function(e,n){l.ParseCertificateEx(t).then(function(n){var r=new c.EndUserCertificate;r.data=t,r.infoEx=u.a.MapToEndUserCertificateInfoEx(n,new d.a),e(r)}).catch(function(e){return n(e)})})})}).then(function(e){f(e)}).catch(function(e){s.EndKMOperation(),p(s.MapError(e))})})},t.prototype.SetKeyMediaUserPassword=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return r.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(n,i.CreateKeyMedia());return r.m_library.SetKeyMediaUserPassword(t,e)}).then(function(){r.EndKMOperation(),e()}).catch(function(e){r.EndKMOperation(),a(r.MapError(e))})})},t.prototype.ChangePrivateKeyPassword=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return r.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(t,i.CreateKeyMedia());return r.m_library.ChangePrivateKeyPassword(e,n)}).then(function(){r.EndKMOperation(),e()}).catch(function(e){r.EndKMOperation(),a(r.MapError(e))})})},t.prototype.ChangePrivateKeyPasswordBinary=function(t,n,r){var i=this,a=i.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.ChangeSoftwarePrivateKeyPassword(t,n,r)}).then(function(t){e(t),e()}).catch(function(e){o(i.MapError(e))})})},t.prototype.GeneratePrivateKey=function(t,n,r,i,a,o,s,c,l,d,f,p){var m=this,h=m.m_library;return new e(function(e,g){m.CheckInitialize().then(function(){return m.BeginKMOperation()}).then(function(){var e=null;return t&&(e=u.a.MapFromKeyMedia(t,h.CreateKeyMedia())),m.GeneratePrivateKeyInternal(e,n,null,r,i,a,o,s,c,l,d,f,p)}).then(function(t){m.EndKMOperation(),e(t)}).catch(function(e){m.EndKMOperation(),g(m.MapError(e))})})},t.prototype.GeneratePrivateKeyBinary=function(t,n,r,i,a,o,s,c,l,u,d){var f=this;return new e(function(e,p){f.CheckInitialize().then(function(){return f.BeginKMOperation()}).then(function(){return f.GeneratePrivateKeyInternal(null,!1,t,n,r,i,a,o,s,c,l,u,d)}).then(function(t){f.EndKMOperation(),e(t)}).catch(function(e){f.EndKMOperation(),p(f.MapError(e))})})},t.prototype.GetKeyInfo=function(t){var n=this,r=n.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return n.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(t,r.CreateKeyMedia());return r.GetKeyInfo(e)}).then(function(t){n.EndKMOperation(),e(t.GetPrivateKeyInfo())}).catch(function(e){n.EndKMOperation(),i(n.MapError(e))})})},t.prototype.GetKeyInfoBinary=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return i.GetKeyInfoBinary(t,n)}).then(function(t){e(t.GetPrivateKeyInfo())}).catch(function(e){a(r.MapError(e))})})},t.prototype.GetClientRegistrationTokenKSP=function(t,n){var i=this,a=i.m_library;return new e(function(e,t){i.CheckInitialize().then(function(){throw a.MakeError(r.EU_ERROR_NOT_SUPPORTED,``)}).catch(function(e){t(i.MapError(e))})})},t.prototype.HashData=function(t,n,r){var i=this,a=this.m_library,o=i.DataToNamedDataArray(n);return new e(function(s,c){i.CheckInitialize().then(function(){return i.ProcessArray(o,function(n){return new e(function(e,o){a.CtxHash(i.m_context,t,null,n.val).then(function(e){return r?e:a.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return o(e)})})})}).then(function(e){s(i.DataToResult(n,e))}).catch(function(e){c(i.MapError(e))})})},t.prototype.GetSigner=function(t,n,r){n===void 0&&(n=-1),r===void 0&&(r=!1);var i=this,a=this.m_library,o={context:null,signersInfo:null};return new e(function(s,l){i.CheckInitialize().then(function(){return a.CtxCreate()}).then(function(e){return o.context=e,a.CtxSetParameter(e,a.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,r)}).then(function(){return n==-1?a.GetSignsCount(t):1}).then(function(r){var s=[];if(n!=-1)s.push(n);else for(var l=0;l<r;l++)s.push(l);return i.ProcessArray(s,function(n){return new e(function(e,r){var s=new c.EndUserCertificate;a.CtxGetSignerInfo(o.context,n,t).then(function(t){u.a.MapToEndUserCertificate(t,s),e(s)}).catch(function(e){return r(i.MapError(e))})})})}).then(function(e){return o.signersInfo=e,a.CtxFree(o.context)}).then(function(){o.context=null,s(n==-1?o.signersInfo:o.signersInfo[0])}).catch(function(e){o.context?a.CtxFree(o.context).then(function(){l(i.MapError(e))}).catch(function(){l(i.MapError(e))}):l(i.MapError(e))})})},t.prototype.SignData=function(e,t){return t===void 0&&(t=!1),this.SignDataEx(f.EndUserSignAlgo.Unknown,e,!0,!0,t)},t.prototype.SignDataInternal=function(e,t,n){return n===void 0&&(n=!1),this.SignDataEx(f.EndUserSignAlgo.Unknown,t,!1,e,n)},t.prototype.SignHash=function(e,t,n,r){return this.CtxSignHashInternal(this.m_pkContext,e,t,null,n,r)},t.prototype.SignDataEx=function(e,t,n,r,i){return this.CtxSignDataInternal(this.m_pkContext,e,t,null,n,r,i)},t.prototype.AppendSign=function(e,t,n,r,i){return this.CtxSignDataInternal(this.m_pkContext,e,t,n,t!=null,r,i)},t.prototype.AppendSignHash=function(e,t,n,r,i){return this.CtxSignHashInternal(this.m_pkContext,e,t,n,r,i)},t.prototype.GetSignValue=function(e,t,n,r){return r===void 0&&(r=!1),this.CtxGetSignValue(this.m_pkContext,e,t,n,r)},t.prototype.VerifyHash=function(t,n,r){r===void 0&&(r=-1);var i=this,a=this.m_library;return new e(function(o,s){i.CheckInitialize().then(function(){return r==-1?a.GetSignsCount(n):1}).then(function(o){var s=[];if(r!=-1)s.push(r);else for(var c=0;c<o;c++)s.push(c);return i.ProcessArray(s,function(r){return new e(function(e,o){var s=new _.a;a.VerifyHashOnTimeEx(t,r,n,null,!1,!1).then(function(e){return u.a.MapToEndUserSignInfo(e,s),a.GetSignTimeInfo(r,n)}).then(function(e){return s.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),a.GetSignType(r,n)}).then(function(t){s.signLevel=t,e(s)}).catch(function(e){return o(i.MapError(e))})})})}).then(function(e){o(r==-1?e:e[0])}).catch(function(e){return s(i.MapError(e))})})},t.prototype.VerifyData=function(t,n,r){r===void 0&&(r=-1);var i=this,a=this.m_library;return new e(function(o,s){i.CheckInitialize().then(function(){return r==-1?a.GetSignsCount(n):1}).then(function(o){var s=[];if(r!=-1)s.push(r);else for(var c=0;c<o;c++)s.push(c);return i.ProcessArray(s,function(r){return new e(function(e,o){var s=new _.a;a.VerifyDataOnTimeEx(t,r,n,null,!1,!1).then(function(e){return u.a.MapToEndUserSignInfo(e,s),a.GetSignTimeInfo(r,n)}).then(function(e){return s.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),a.GetSignType(r,n)}).then(function(t){s.signLevel=t,e(s)}).catch(function(e){return o(i.MapError(e))})})})}).then(function(e){o(r==-1?e:e[0])}).catch(function(e){return s(i.MapError(e))})})},t.prototype.VerifyDataInternal=function(t,n){n===void 0&&(n=-1);var r=this,i=this.m_library;return new e(function(a,o){r.CheckInitialize().then(function(){return n==-1?i.GetSignsCount(t):1}).then(function(a){var o=[];if(n!=-1)o.push(n);else for(var s=0;s<a;s++)o.push(s);return r.ProcessArray(o,function(n){return new e(function(e,a){var o=new _.a;i.VerifyDataInternalOnTimeEx(t,n,null,!1,!1).then(function(e){return u.a.MapToEndUserSignInfo(e,o),i.GetSignTimeInfo(n,t)}).then(function(e){return o.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),i.GetSignType(n,t)}).then(function(t){o.signLevel=t,e(o)}).catch(function(e){return a(r.MapError(e))})})})}).then(function(e){a(n==-1?e:e[0])}).catch(function(e){return o(r.MapError(e))})})},t.prototype.EnvelopData=function(t,n,i,a,o,s){s===void 0&&(s=!1);var c=this,l=this.m_library;return new e(function(e,u){c.CheckInitialize().then(function(){if(c.m_pkContext==null&&(!s||i))throw l.MakeError(r.EU_ERROR_BAD_CERT,``);var e=l.EU_RECIPIENT_APPEND_TYPE_BY_ISSUER_SERIAL;return s?i?l.CtxEnvelopWithDynamicKey(c.m_pkContext,t,e,i,a,n):l.EnvelopToRecipientsWithDynamicKey(t,i,a,n):l.CtxEnvelop(c.m_pkContext,t,e,i,a,n)}).then(function(e){return o?e:l.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return u(c.MapError(e))})})},t.prototype.DevelopData=function(t,n){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){if(i.m_pkContext==null)throw a.MakeError(r.EU_ERROR_BAD_CERT,``);return a.CtxDevelop(i.m_pkContext,t,n)}).then(function(t){e(u.a.MapToEndUserSenderInfo(t,new v.a))}).catch(function(e){return o(i.MapError(e))})})},t.prototype.ProtectDataByPassword=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.ProtectDataByPassword(t,n)}).then(function(e){return r?e:a.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return o(i.MapError(e))})})},t.prototype.UnprotectDataByPassword=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.UnprotectDataByPassword(t,n)}).then(function(e){return r?a.BytesToString(e):e}).then(function(t){e(t)}).catch(function(e){return o(i.MapError(e))})})},t.prototype.CreateAuthData=function(t,n,i){var a=this,o=this.m_library;return new e(function(e,s){a.CheckInitialize().then(function(){if(a.m_pkContext==null)throw o.MakeError(r.EU_ERROR_BAD_CERT,``);return o.CtxCreateAuthData(a.m_pkContext,t,n)}).then(function(e){return i?e:o.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return s(a.MapError(e))})})},t.prototype.GetTSPByAccessInfo=function(t,n,r,i,a){var o=this,s=this.m_library;return new e(function(e,c){o.CheckInitialize().then(function(){return s.GetTSPByAccessInfo(t,n,r,i)}).then(function(e){return a?s.BASE64Encode(e):e}).then(function(t){e(t)}).catch(function(e){return c(o.MapError(e))})})},t.prototype.CheckTSP=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.CheckTSP(t,n,r)}).then(function(){e()}).catch(function(e){return o(i.MapError(e))})})},t.prototype.ClientDynamicKeySessionCreate=function(t){var n=this,r=this.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return r.ClientDynamicKeySessionCreate(3600,t)}).then(function(t){e(u.a.MapToEndUserSession(t,new b.a))}).catch(function(e){return i(n.MapError(e))})})},t.prototype.SessionClose=function(t){var n=this,r=this.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return r.SessionClose(u.a.MapFromEndUserSession(t,r.CreateEndUserSession()))}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.SessionEncrypt=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return typeof n==`string`?a.StringToBytes(n):n}).then(function(e){return a.SessionEncrypt(u.a.MapFromEndUserSession(t,a.CreateEndUserSession()),e)}).then(function(t){return r?a.BASE64Encode(t).then(function(t){e(t)}).catch(function(e){o(i.MapError(e))}):e(t)}).catch(function(e){return o(i.MapError(e))})})},t.prototype.SessionDecrypt=function(t,n){var r=this,i=this.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return i.SessionDecrypt(u.a.MapFromEndUserSession(t,i.CreateEndUserSession()),n)}).then(function(t){e(t)}).catch(function(e){return a(r.MapError(e))})})},t.prototype.CtxCreate=function(){var t=this,n=this.m_library,r={context:null};return new e(function(e,i){t.CheckInitialize().then(function(){return n.CtxCreate()}).then(function(e){return r.context=e,n.CtxSetParameter(e,n.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,t.m_resolveOIDs)}).then(function(){e(r.context)}).catch(function(e){return i(t.MapError(e))})})},t.prototype.CtxFree=function(t){var n=this,r=this.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){r.CtxFree(t)}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.CtxSetParameter=function(t,n,r){var i=this,a=i.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return t??=i.m_context,a.CtxSetParameter(t,n,r)}).then(function(){e()}).catch(function(e){i.EndKMOperation(),o(i.MapError(e))})})},t.prototype.CtxReadPrivateKey=function(t,n,r,i){var a=this,o=a.m_library;return new e(function(e,s){a.CheckInitialize().then(function(){return a.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(n,o.CreateKeyMedia());return a.CtxReadPrivateKeyInternal(t,null,null,e,r,i,!0)}).then(function(t){a.EndKMOperation(),e(t)}).catch(function(e){a.EndKMOperation(),s(a.MapError(e))})})},t.prototype.CtxReadPrivateKeyBinary=function(t,n,r,i,a){var o=this;return new e(function(e,s){o.CheckInitialize().then(function(){return o.CtxReadPrivateKeyInternal(t,n,r,null,i,a,!0)}).then(function(t){e(t)}).catch(function(e){return s(o.MapError(e))})})},t.prototype.CtxFreePrivateKey=function(t){var n=this,r=this.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return r.CtxFreePrivateKey(t)}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.CtxGetOwnCertificates=function(t){var n=this,i=this.m_library;return new e(function(e,a){n.CheckInitialize().then(function(){if(t==null)throw i.MakeError(r.EU_ERROR_BAD_CERT,``);var o=[],s=function(r){i.CtxEnumOwnCertificates(t,r).then(function(t){if(t){var n=u.a.MapToEndUserCertificate(t,new c.EndUserCertificate);o.push(n),s(r+1)}else e(o)}).catch(function(e){return a(n.MapError(e))})};s(0)}).catch(function(e){return a(n.MapError(e))})})},t.prototype.CtxSignHash=function(e,t,n,r,i){return this.CtxSignHashInternal(e,t,n,null,r,i)},t.prototype.CtxSignData=function(e,t,n,r,i,a){return this.CtxSignDataInternal(e,t,n,null,r,i,a)},t.prototype.CtxAppendSignHash=function(e,t,n,r,i,a){return this.CtxSignHashInternal(e,t,n,r,i,a)},t.prototype.CtxAppendSign=function(e,t,n,r,i,a){return this.CtxSignDataInternal(e,t,n,r,n!=null,i,a)},t.prototype.CtxGetSignValue=function(t,n,i,a,o){o===void 0&&(o=!1);var s=this,c=this.m_library,l=s.DataToNamedDataArray(i);return new e(function(u,d){s.CheckInitialize().then(function(){if(t==null)throw c.MakeError(r.EU_ERROR_BAD_CERT,``);return n==f.EndUserSignAlgo.ECDSAWithSHA?c.CtxSetParameter(s.m_context,c.EU_ENCODE_ECDSA_SIGN_VALUE_CONTEXT_PARAMETER,o):null}).then(function(){return s.ProcessArray(l,function(r){return new e(function(e,i){c.CtxGetSignValue(t,n,r.val).then(function(e){return a?e:c.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return i(e)})})})}).then(function(e){u(s.DataToResult(i,e))}).catch(function(e){return d(s.MapError(e))})})},t.prototype.CtxEnvelopData=function(t,n,i,a,o,s,c){var l=this,u=this.m_library;return new e(function(e,d){l.CheckInitialize().then(function(){if(t==null&&(!c||a))throw u.MakeError(r.EU_ERROR_BAD_CERT,``);var e=u.EU_RECIPIENT_APPEND_TYPE_BY_ISSUER_SERIAL;return c?a?u.CtxEnvelopWithDynamicKey(t,n,e,a,o,i):u.EnvelopToRecipientsWithDynamicKey(n,a,o,i):u.CtxEnvelop(t,n,e,a,o,i)}).then(function(e){return s?e:u.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return d(l.MapError(e))})})},t.prototype.CtxDevelopData=function(t,n,i){var a=this,o=this.m_library;return new e(function(e,s){a.CheckInitialize().then(function(){if(t==null)throw o.MakeError(r.EU_ERROR_BAD_CERT,``);return o.CtxDevelop(t,n,i)}).then(function(t){e(u.a.MapToEndUserSenderInfo(t,new v.a))}).catch(function(e){return s(a.MapError(e))})})},t.prototype.ProtectTaxReports=function(t,n,r,i,a,o,s){t===void 0&&(t=null),n===void 0&&(n=null),r===void 0&&(r=null),s===void 0&&(s=!1);var c=this;return new e(function(e,l){var u={accountant:null,director:null,stamp:null};c.CheckInitialize().then(function(){var e=[f.EndUserKeyUsage.DigitalSignature];return t==null?null:c.LoadTaxReportPKey(t,e,!1)}).then(function(e){u.accountant=e;var t=[f.EndUserKeyUsage.DigitalSignature];return r||t.push(f.EndUserKeyUsage.KeyAgreement),n==null?null:c.LoadTaxReportPKey(n,t,!1)}).then(function(e){u.director=e;var t=[f.EndUserKeyUsage.DigitalSignature,f.EndUserKeyUsage.KeyAgreement];return r==null?null:c.LoadTaxReportPKey(r,t,!0)}).then(function(e){return u.stamp=e,c.ProcessArray(o,function(e){return c.ProtectTaxReport(u.accountant,u.director,u.stamp,i,a,e,s)})}).then(function(t){e(t)}).catch(function(e){return l(c.MapError(e))})})},t.prototype.UnprotectTaxReceipts=function(t,n){var r=this;return new e(function(e,i){r.CheckInitialize().then(function(){return r.ProcessArray(n,function(e){return r.UnprotectTaxReceipt(t,e)})}).then(function(t){e(t)}).catch(function(e){return i(r.MapError(e))})})},t.prototype.ASiCGetSigner=function(t,n,r){n===void 0&&(n=-1),r===void 0&&(r=!1);var i=this,a=this.m_library,o={context:null,signersInfo:null};return new e(function(s,l){i.CheckInitialize().then(function(){return a.CtxCreate()}).then(function(e){return o.context=e,a.CtxSetParameter(e,a.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,r)}).then(function(){return n==-1?a.ASiCGetSignsCount(t):1}).then(function(r){var s=[];if(n!=-1)s.push(n);else for(var l=0;l<r;l++)s.push(l);return i.ProcessArray(s,function(n){return new e(function(e,r){var s=new c.EndUserCertificate;a.CtxASiCGetSignerInfo(o.context,n,t).then(function(t){u.a.MapToEndUserCertificate(t,s),e(s)}).catch(function(e){return r(i.MapError(e))})})})}).then(function(e){return o.signersInfo=e,a.CtxFree(o.context)}).then(function(){s(n==-1?o.signersInfo:o.signersInfo[0])}).catch(function(e){o.context&&a.CtxFree(o.context).then(function(){l(i.MapError(e))}).catch(function(){l(i.MapError(e))})})})},t.prototype.ASiCSignData=function(t,n,i,a,o,s){var c=this,l=this,u=this.m_library;return new e(function(e,d){l.CheckInitialize().then(function(){if(c.m_pkContext==null)throw u.MakeError(r.EU_ERROR_BAD_CERT,``);return l.ProcessArray(o,function(e){return l.NamedDataToReference(e)})}).then(function(e){return u.CtxASiCSign(c.m_pkContext,t,n,i,a,e)}).then(function(e){return s?e:u.BASE64Decode(e)}).then(function(t){e({name:o[0].name+(n==f.EndUserASiCType.S?`.asics`:`.asice`),val:t})}).catch(function(e){return d(l.MapError(e))})})},t.prototype.ASiCAppendSign=function(t,n,i,a,o){var s=this,c=this,l=this.m_library,u=c.DataToNamedDataArray(a);return new e(function(e,a){c.CheckInitialize().then(function(){if(s.m_pkContext==null)throw l.MakeError(r.EU_ERROR_BAD_CERT,``);return l.CtxASiCAppendSign(s.m_pkContext,t,n,i,u[0].val)}).then(function(e){return o?e:l.BASE64Decode(e)}).then(function(t){e({name:u[0].name,val:t})}).catch(function(e){return a(c.MapError(e))})})},t.prototype.ASiCVerifyData=function(t,n){n===void 0&&(n=-1);var r=this,i=this.m_library;return new e(function(a,o){r.CheckInitialize().then(function(){return n==-1?i.ASiCGetSignsCount(t):1}).then(function(a){var o=[];if(n!=-1)o.push(n);else for(var s=0;s<a;s++)o.push(s);return r.ProcessArray(o,function(n){return new e(function(e,a){var o=new _.a;i.ASiCVerify(n,t).then(function(e){return u.a.MapToEndUserSignInfo(e,o),i.ASiCGetSignTimeInfo(n,t)}).then(function(e){return o.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),i.ASiCGetSignLevel(n,t)}).then(function(t){o.signLevel=t,e(o)}).catch(function(e){return a(r.MapError(e))})})})}).then(function(e){a(n==-1?e:e[0])}).catch(function(e){return o(r.MapError(e))})})},t.prototype.PDFGetSigner=function(t,n,r){n===void 0&&(n=-1),r===void 0&&(r=!1);var i=this,a=this.m_library,o={context:null,signersInfo:null};return new e(function(s,l){i.CheckInitialize().then(function(){return a.CtxCreate()}).then(function(e){return o.context=e,a.CtxSetParameter(e,a.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,r)}).then(function(){return n==-1?a.PDFGetSignsCount(t):1}).then(function(r){var s=[];if(n!=-1)s.push(n);else for(var l=0;l<r;l++)s.push(l);return i.ProcessArray(s,function(n){return new e(function(e,r){var s=new c.EndUserCertificate;a.CtxPDFGetSignerInfo(o.context,n,t).then(function(t){u.a.MapToEndUserCertificate(t,s),e(s)}).catch(function(e){return r(i.MapError(e))})})})}).then(function(e){return o.signersInfo=e,a.CtxFree(o.context)}).then(function(){s(n==-1?o.signersInfo:o.signersInfo[0])}).catch(function(e){o.context&&a.CtxFree(o.context).then(function(){l(i.MapError(e))}).catch(function(){l(i.MapError(e))})})})},t.prototype.PDFSignData=function(t,n,i,a){var o=this,s=this,c=this.m_library,l=s.DataToNamedDataArray(n);return new e(function(u,d){s.CheckInitialize().then(function(){if(o.m_pkContext==null)throw c.MakeError(r.EU_ERROR_BAD_CERT,``);return s.ProcessArray(l,function(n){return new e(function(e,r){return c.CtxPDFSign(o.m_pkContext,t,n.val,i).then(function(e){return a?e:c.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return r(e)})})})}).then(function(e){u(o.DataToResult(n,e))}).catch(function(e){return d(s.MapError(e))})})},t.prototype.PDFVerifyData=function(t,n){n===void 0&&(n=-1);var r=this,i=this.m_library;return new e(function(a,o){r.CheckInitialize().then(function(){return n==-1?i.PDFGetSignsCount(t):1}).then(function(a){var o=[];if(n!=-1)o.push(n);else for(var s=0;s<a;s++)o.push(s);return r.ProcessArray(o,function(n){return new e(function(e,a){var o=new _.a;i.PDFVerify(n,t).then(function(e){return u.a.MapToEndUserSignInfo(e,o),i.PDFGetSignTimeInfo(n,t)}).then(function(e){return o.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),i.PDFGetSignType(n,t)}).then(function(t){o.signLevel=t,e(o)}).catch(function(e){return a(r.MapError(e))})})})}).then(function(e){a(n==-1?e:e[0])}).catch(function(e){return o(r.MapError(e))})})},t.prototype.XAdESGetSigner=function(t,n,r){n===void 0&&(n=-1),r===void 0&&(r=!1);var i=this,a=this.m_library,o={context:null,signersInfo:null};return new e(function(s,l){i.CheckInitialize().then(function(){return a.CtxCreate()}).then(function(e){return o.context=e,a.CtxSetParameter(e,a.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,r)}).then(function(){return n==-1?a.XAdESGetSignsCount(t):1}).then(function(r){var s=[];if(n!=-1)s.push(n);else for(var l=0;l<r;l++)s.push(l);return i.ProcessArray(s,function(n){return new e(function(e,r){var s=new c.EndUserCertificate;a.CtxXAdESGetSignerInfo(o.context,n,t).then(function(t){u.a.MapToEndUserCertificate(t,s),e(s)}).catch(function(e){return r(i.MapError(e))})})})}).then(function(e){return o.signersInfo=e,a.CtxFree(o.context)}).then(function(){s(n==-1?o.signersInfo:o.signersInfo[0])}).catch(function(e){o.context&&a.CtxFree(o.context).then(function(){l(i.MapError(e))}).catch(function(){l(i.MapError(e))})})})},t.prototype.XAdESSignData=function(t,n,i,a,o){var s=this,c=this,l=this.m_library;return new e(function(e,u){c.CheckInitialize().then(function(){if(s.m_pkContext==null)throw l.MakeError(r.EU_ERROR_BAD_CERT,``);return c.ProcessArray(a,function(e){return c.NamedDataToReference(e)})}).then(function(e){return l.CtxXAdESSign(s.m_pkContext,t,n,i,e)}).then(function(e){return o?e:l.BASE64Decode(e)}).then(function(t){e({name:a[0].name+(a[0].name.endsWith(`.xml`)?``:`.xml`),val:t})}).catch(function(e){return u(c.MapError(e))})})},t.prototype.XAdESVerifyData=function(t,n,r){r===void 0&&(r=-1);var i=this,a=this.m_library,o=[];return new e(function(s,c){i.CheckInitialize().then(function(){return r==-1?a.XAdESGetSignsCount(n):1}).then(function(e){if(r!=-1)o.push(r);else for(var n=0;n<e;n++)o.push(n);return t==null?null:i.ProcessArray(t,function(e){return i.NamedDataToReference(e)})}).then(function(t){return i.ProcessArray(o,function(r){return new e(function(e,o){var s=new _.a;a.XAdESVerify(t,r,n).then(function(e){return u.a.MapToEndUserSignInfo(e,s),a.XAdESGetSignTimeInfo(r,n)}).then(function(e){return s.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),a.XAdESGetSignLevel(r,n)}).then(function(t){s.signLevel=t,e(s)}).catch(function(e){return o(i.MapError(e))})})})}).then(function(e){s(r==-1?e:e[0])}).catch(function(e){return c(i.MapError(e))})})},t.prototype.GetSignContainerInfo=function(t){var n=this,r=this.m_library,i=(new g.a,function(t){var n=new g.a;return new e(function(e,i){r.IsDataInSignedDataAvailable(t).then(function(t){n.type=f.EndUserSignContainerType.CAdES,n.subType=t?f.EndUserCAdESType.Enveloped:f.EndUserCAdESType.Detached,e(n)}).catch(function(t){e(null)})})}),a=function(t){var n=new g.a;return new e(function(e,i){r.XAdESGetType(t).then(function(t){n.type=f.EndUserSignContainerType.XAdES,n.subType=t,e(n)}).catch(function(t){e(null)})})},o=function(t){var n=new g.a;return new e(function(e,i){r.PDFGetSignsCount(t).then(function(t){n.type=f.EndUserSignContainerType.PAdES,e(n)}).catch(function(t){e(null)})})},s=function(t){var n=new g.a;return new e(function(e,i){r.ASiCGetASiCType(t).then(function(e){return n.type=f.EndUserSignContainerType.ASiC,n.subType=e,r.ASiCGetSignType(t)}).then(function(t){n.asicSignType=t,e(n)}).catch(function(t){e(null)})})};return new e(function(c,l){n.CheckInitialize().then(function(){return typeof t==`string`?r.BASE64Decode(t):t}).then(function(t){var n=[],r=function(e,t){if(e.length<t.length)return!1;for(var n=0;n<t.length;n++)if(e[n]!=t[n])return!1;return!0};return n=r(t,[60,63,120,109,108])?[a,i,o,s]:r(t,[37,80,68,70])?[o,i,a,s]:r(t,[80,75])?[s,i,a,o]:[i,a,o,s],new e(function(e,r){var i=function(a){a>=n.length?e(new g.a):n[a](t).then(function(t){t==null?i(a+1):e(t)}).catch(function(e){return r(e)})};i(0)})}).then(function(e){c(e)}).catch(function(e){return l(n.MapError(e))})})},t}()}).call(this,n(13).Promise)},function(e,t,n){"use strict";(function(e){var r=n(3);t.a=function(){function t(){this.EU_SUBJECT_TYPE_UNDIFFERENCED=0,this.EU_SUBJECT_TYPE_CA=1,this.EU_SUBJECT_TYPE_CA_SERVER=2,this.EU_SUBJECT_TYPE_RA_ADMINISTRATOR=3,this.EU_SUBJECT_TYPE_END_USER=4,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED=0,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_CMP=1,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_TSP=2,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_OCSP=3,this.EU_CERT_KEY_TYPE_UNKNOWN=0,this.EU_CERT_KEY_TYPE_DSTU4145=1,this.EU_CERT_KEY_TYPE_RSA=2,this.EU_CERT_KEY_TYPE_ECDSA=4,this.EU_KEY_USAGE_UNKNOWN=0,this.EU_KEY_USAGE_DIGITAL_SIGNATURE=1,this.EU_KEY_USAGE_KEY_AGREEMENT=16,this.EU_KEYS_REQUEST_TYPE_UA_DS=1,this.EU_KEYS_REQUEST_TYPE_UA_KEP=2,this.EU_KEYS_REQUEST_TYPE_INTERNATIONAL=3,this.EU_KEYS_TYPE_NONE=0,this.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_GOSTS=1,this.EU_KEYS_TYPE_RSA_WITH_SHA=2,this.EU_KEYS_TYPE_ECDSA_WITH_SHA=4,this.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_DSTU=8,this.EU_KEYS_LENGTH_DS_UA_191=1,this.EU_KEYS_LENGTH_DS_UA_257=2,this.EU_KEYS_LENGTH_DS_UA_307=3,this.EU_KEYS_LENGTH_DS_UA_FILE=4,this.EU_KEYS_LENGTH_DS_UA_CERT=5,this.EU_KEYS_LENGTH_KEP_UA_257=1,this.EU_KEYS_LENGTH_KEP_UA_431=2,this.EU_KEYS_LENGTH_KEP_UA_571=3,this.EU_KEYS_LENGTH_KEP_UA_FILE=4,this.EU_KEYS_LENGTH_KEP_UA_CERT=5,this.EU_KEYS_LENGTH_DS_RSA_1024=1,this.EU_KEYS_LENGTH_DS_RSA_2048=2,this.EU_KEYS_LENGTH_DS_RSA_3072=3,this.EU_KEYS_LENGTH_DS_RSA_4096=4,this.EU_KEYS_LENGTH_DS_RSA_FILE=5,this.EU_KEYS_LENGTH_DS_RSA_CERT=6,this.EU_KEYS_LENGTH_DS_ECDSA_192=1,this.EU_KEYS_LENGTH_DS_ECDSA_256=2,this.EU_KEYS_LENGTH_DS_ECDSA_384=3,this.EU_KEYS_LENGTH_DS_ECDSA_521=4,this.EU_KEYS_LENGTH_DS_ECDSA_FILE=5,this.EU_KEYS_LENGTH_DS_ECDSA_CERT=6,this.EU_RECIPIENT_APPEND_ISSUER_AND_SERIAL=1,this.EU_RECIPIENT_APPEND_KEY_ID=2,this.EU_RECIPIENT_APPEND_KEY_ID_USC_COMPAT=3,this.EU_SAVE_SETTINGS_PARAMETER=`SaveSettings`,this.EU_RESOLVE_OIDS_PARAMETER=`ResolveOIDs`,this.EU_MAKE_PKEY_PFX_CONTAINER_PARAMETER=`MakePKeyPFXContainer`,this.EU_SIGN_INCLUDE_CONTENT_TIME_STAMP_PARAMETER=`SignIncludeContentTimeStamp`,this.EU_SIGN_TYPE_PARAMETER=`SignType`,this.EU_SIGN_INCLUDE_CA_CERTIFICATES_PARAMETER=`SignIncludeCACertificates`,this.EU_FS_CALCULATE_FINGERPRINT=`FSCalculateFingerprint`,this.EU_CHECK_CERT_CHAIN_ON_SIGN_TIME_PARAMETER=`CheckCertChainOnSignTime`,this.EU_CONNECTIONS_TIMEOUT_PARAMETER=`ConnectionsTimeout`,this.EU_LOG_EVENTS_THRESHOLD_PARAMETER=`LogEventsThreshold`,this.EU_USE_SLOGIN_PRIVATE_KEY=`UseSLoginPrivateKey`,this.EU_SETTINGS_ID_NONE=0,this.EU_SETTINGS_ID_MANDATORY=31,this.EU_SETTINGS_ID_ALL=4095,this.EU_SETTINGS_ID_FSTORE=1,this.EU_SETTINGS_ID_PROXY=2,this.EU_SETTINGS_ID_TSP=4,this.EU_SETTINGS_ID_OCSP=8,this.EU_SETTINGS_ID_LDAP=16,this.EU_SETTINGS_ID_MODE=32,this.EU_SETTINGS_ID_CMP=64,this.EU_SETTINGS_ID_KM=128,this.EU_SETTINGS_ID_OCSP_ACCESS_INFO_MODE=256,this.EU_SETTINGS_ID_OCSP_ACCESS_INFO=512,this.EU_SETTINGS_ID_TSL=1024,this.EU_SETTINGS_ID_LOG=2048,this.EU_HEADER_CA_TYPE=`UA1`,this.EU_HEADER_PART_TYPE_SIGNED=1,this.EU_HEADER_PART_TYPE_ENCRYPTED=2,this.EU_HEADER_PART_TYPE_STAMPED=3,this.EU_HEADER_PART_TYPE_CERTCRYPT=4,this.EU_HEADER_MAX_CA_TYPE_SIZE=3,this.EU_SIGNED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_SIGNED,this.EU_ENCRYPTED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_ENCRYPTED,this.EU_TIMESTAMPED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_STAMPED,this.EU_CERTCRYPT_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_CERTCRYPT,this.EU_DEFAULT_LANG=0,this.EU_UA_LANG=1,this.EU_RU_LANG=2,this.EU_EN_LANG=3,this.EU_CONTENT_ENC_ALGO_TDES_CBC=4,this.EU_CONTENT_ENC_ALGO_AES_128_CBC=5,this.EU_CONTENT_ENC_ALGO_AES_192_CBC=6,this.EU_CONTENT_ENC_ALGO_AES_256_CBC=7,this.EU_DEV_CTX_MIN_PUBLIC_DATA_ID=16,this.EU_DEV_CTX_MAX_PRIVATE_DATA_ID=175,this.EU_UA_OID_EXT_KEY_USAGE_STAMP=`1.2.804.2.1.1.1.3.9`,this.EU_CCS_TYPE_REVOKE=1,this.EU_CCS_TYPE_HOLD=2,this.EU_REVOCATION_REASON_UNKNOWN=0,this.EU_REVOCATION_REASON_KEY_COMPROMISE=1,this.EU_REVOCATION_REASON_NEW_ISSURED=2,this.EU_SIGN_TYPE_UNKNOWN=0,this.EU_SIGN_TYPE_CADES_BES=1,this.EU_SIGN_TYPE_CADES_T=4,this.EU_SIGN_TYPE_CADES_C=8,this.EU_SIGN_TYPE_CADES_X_LONG=16,this.EU_CHECK_PRIVATE_KEY_CONTEXT_PARAMETER=`CheckPrivateKey`,this.EU_RESOLVE_OIDS_CONTEXT_PARAMETER=`ResolveOIDs`,this.EU_EXPORATABLE_CONTEXT_CONTEXT_PARAMETER=`ExportableContext`,this.EU_ENCODE_ECDSA_SIGN_VALUE_CONTEXT_PARAMETER=`EncodeECDSASignValue`,this.EU_USE_SLOGIN_PRIVATE_KEY_CONTEXT_PARAMETER=`UseSLoginPrivateKey`,this.EU_RECIPIENT_APPEND_TYPE_BY_ISSUER_SERIAL=1,this.EU_RECIPIENT_APPEND_TYPE_BY_KEY_ID=2,this.EU_CTX_HASH_ALGO_UNKNOWN=0,this.EU_CTX_HASH_ALGO_GOST34311=1,this.EU_CTX_HASH_ALGO_SHA160=2,this.EU_CTX_HASH_ALGO_SHA224=3,this.EU_CTX_HASH_ALGO_SHA256=4,this.EU_CTX_HASH_ALGO_SHA384=5,this.EU_CTX_HASH_ALGO_SHA512=6,this.EU_CTX_HASH_ALGO_DSTU7564_256=7,this.EU_CTX_HASH_ALGO_DSTU7564_384=8,this.EU_CTX_HASH_ALGO_DSTU7564_512=9,this.EU_CTX_SIGN_UNKNOWN=0,this.EU_CTX_SIGN_DSTU4145_WITH_GOST34311=1,this.EU_CTX_SIGN_RSA_WITH_SHA=2,this.EU_CTX_SIGN_ECDSA_WITH_SHA=3,this.EU_CTX_SIGN_DSTU4145_WITH_DSTU7564=4,this.EU_FILE_PROCESS_CHUNK_SIZE=1048576,this.EU_ASIC_TYPE_UNKNOWN=0,this.EU_ASIC_TYPE_S=1,this.EU_ASIC_TYPE_E=2,this.EU_ASIC_SIGN_TYPE_UNKNOWN=0,this.EU_ASIC_SIGN_TYPE_CADES=1,this.EU_ASIC_SIGN_TYPE_XADES=2,this.EU_ASIC_SIGN_LEVEL_BES=1,this.CtxCreateEmptySign=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.CtxCreateEmptySign(t,n,r,i,e,o)})},this.EnvelopToRecipientsEx=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.EnvelopToRecipientsEx(t,n,r,i,e,o)})},this.EnvelopToRecipientsWithDynamicKey=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.EnvelopToRecipientsWithDynamicKey(t,n,r,i,e,o)})},this.EnvelopToRecipientsWithSettings=function(t,n,r,i,a,o,s){var c=this.m_library;return new e(function(e,l){c.EnvelopToRecipientsWithSettings(t,n,r,i,a,o,s,e,l)})},this.CtxEnvelop=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxEnvelop(t,n,r,i,a,o,e,c)})},this.CtxEnvelopWithDynamicKey=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxEnvelopWithDynamicKey(t,n,r,i,a,o,e,c)})},this.DevelopEx=function(t,n){n===void 0&&(n=null);var r=this.m_library;return new e(function(e,i){r.DevelopEx(t,n,e,i)})},this.CtxDevelop=function(t,n,r){r===void 0&&(r=null);var i=this.m_library;return new e(function(e,a){i.CtxDevelop(t,n,r,e,a)})},this.CtxCreateAuthData=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxCreateAuthData(t,n,r,e,a)})},this.ProtectDataByPassword=function(t,n){var r=this.m_library;return new e(function(e,i){r.ProtectDataByPassword(t,n,e,i)})},this.UnprotectDataByPassword=function(t,n){var r=this.m_library;return new e(function(e,i){r.UnprotectDataByPassword(t,n,e,i)})},this.ClientDynamicKeySessionCreate=function(t,n){var r=this.m_library;return new e(function(e,i){r.ClientDynamicKeySessionCreate(t,n,e,i)})},this.SessionClose=function(t){var n=this.m_library;return new e(function(e,r){n.SessionClose(t,e,r)})},this.SessionEncrypt=function(t,n){var r=this.m_library;return new e(function(e,i){r.SessionEncrypt(t,n,e,i)})},this.SessionDecrypt=function(t,n){var r=this.m_library;return new e(function(e,i){r.SessionDecrypt(t,n,e,i)})},this.AppendTransportHeader=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.AppendTransportHeader(t,n,r,i,a,e,s)})},this.ParseTransportHeader=function(t){var n=this.m_library;return new e(function(e,r){n.ParseTransportHeader(t,e,r)})},this.AppendCryptoHeader=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.AppendCryptoHeader(t,n,r,e,a)})},this.ParseCryptoHeader=function(t){var n=this.m_library;return new e(function(e,r){n.ParseCryptoHeader(t,e,r)})},this.GetHostInfo=function(){var t=this.m_library;return new e(function(e,n){t.GetHostInfo(e,n)})},this.CtxCreate=function(){var t=this.m_library;return new e(function(e,n){t.CtxCreate(e,n)})},this.CtxFree=function(t){var n=this.m_library;return new e(function(e,r){n.CtxFree(t,e,r)})},this.CtxSetParameter=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxSetParameter(t,n,r,e,a)})},this.ASiCGetASiCType=function(t){var n=this.m_library;return new e(function(e,r){n.ASiCGetASiCType(t,e,r)})},this.ASiCGetSignType=function(t){var n=this.m_library;return new e(function(e,r){n.ASiCGetSignType(t,e,r)})},this.ASiCGetSignsCount=function(t){var n=this.m_library;return new e(function(e,r){n.ASiCGetSignsCount(t,e,r)})},this.ASiCGetSignerInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.ASiCGetSignerInfo(t,n,e,i)})},this.ASiCGetSignTimeInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.ASiCGetSignTimeInfo(t,n,e,i)})},this.CtxASiCSign=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxASiCSign(t,n,r,i,a,o,e,c)})},this.CtxASiCAppendSign=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxASiCAppendSign(t,n,r,i,a,e,s)})},this.ASiCVerify=function(t,n){var r=this.m_library;return new e(function(e,i){r.ASiCVerify(t,n,e,i)})},this.CtxASiCGetSignerInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxASiCGetSignerInfo(t,n,r,e,a)})},this.ASiCGetSignLevel=function(t,n){var r=this.m_library;return new e(function(e,i){r.ASiCGetSignLevel(t,n,e,i)})},this.PDFGetSignType=function(t,n){var r=this.m_library;return new e(function(e,i){r.PDFGetSignType(t,n,e,i)})},this.PDFGetSignsCount=function(t){var n=this.m_library;return new e(function(e,r){n.PDFGetSignsCount(t,e,r)})},this.PDFGetSignerInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.PDFGetSignerInfo(t,n,e,i)})},this.PDFGetSignTimeInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.PDFGetSignTimeInfo(t,n,e,i)})},this.CtxPDFSign=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.CtxPDFSign(t,n,r,i,e,o)})},this.PDFVerify=function(t,n){var r=this.m_library;return new e(function(e,i){r.PDFVerify(t,n,e,i)})},this.CtxPDFGetSignerInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxPDFGetSignerInfo(t,n,r,e,a)})},this.XAdESGetType=function(t){var n=this.m_library;return new e(function(e,r){n.XAdESGetType(t,e,r)})},this.XAdESGetSignsCount=function(t){var n=this.m_library;return new e(function(e,r){n.XAdESGetSignsCount(t,e,r)})},this.XAdESGetSignLevel=function(t,n){var r=this.m_library;return new e(function(e,i){r.XAdESGetSignLevel(t,n,e,i)})},this.XAdESGetSignerInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.XAdESGetSignerInfo(t,n,e,i)})},this.XAdESGetSignTimeInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.XAdESGetSignTimeInfo(t,n,e,i)})},this.CtxXAdESSign=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxXAdESSign(t,n,r,i,a,e,s)})},this.XAdESVerify=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.XAdESVerify(t,n,r,e,a)})},this.CtxXAdESGetSignerInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxXAdESGetSignerInfo(t,n,r,e,a)})},this.SServerClientGeneratePrivateKeyAsync=function(t,n,r,i,a,o,s,c,l,u,d){var f=this.m_library;return new e(function(e,p){f.SServerClientGeneratePrivateKeyAsync(t,n,r,i,a,o,s,c,l,u,d,e,p)})},this.SServerClientCheckGeneratePrivateKeyStatus=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.SServerClientCheckGeneratePrivateKeyStatus(t,n,r,i,e,o)})},this.SServerClientSignHashAsync=function(t,n,r,i,a,o,s){var c=this.m_library;return new e(function(e,l){c.SServerClientSignHashAsync(t,n,r,i,a,o,s,e,l)})},this.SServerClientCheckSignHashStatus=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.SServerClientCheckSignHashStatus(t,n,r,i,e,o)})},this.SServerClientSignHashesAsync=function(t,n,r,i,a,o,s,c){var l=this.m_library;return new e(function(e,u){l.SServerClientSignHashesAsync(t,n,r,i,a,o,s,c,e,u)})},this.SServerClientCheckSignHashesStatus=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.SServerClientCheckSignHashesStatus(t,n,r,i,e,o)})},this.m_language=0,this.m_library=null}return t.prototype.MakeURL=function(e){var t=location.origin,n=location.pathname;return e.indexOf(`http://`)==0||e.indexOf(`https://`)==0?e:e.indexOf(`/`)==0&&t?t+e:t&&n?t+n.substr(0,n.lastIndexOf(`/`))+`/`+e:e},t.prototype.MakeError=function(e,t){return this.m_library.MakeError(e,t)},t.prototype.IsLibraryLoadError=function(e){return e==r.EndUserError.ERROR_LIBRARY_COMUNICATION_FAILED},t.prototype.IsLibraryVersionNotSupportedError=function(e){return e==r.EndUserError.ERROR_LIBRARY_VERSION_NOT_SUPPORTED},t.prototype.Load=function(){var t=this;return new e(function(e,n){if(t.m_library==null){var i=new r.EndUserLibraryLoader(r.EndUserLibraryLoader.LIBRARY_TYPE_DEFAULT,`euSign`,t.m_language,!0,!0);i.onload=function(n){t.m_library=n,e()},i.onerror=function(e,t,i){i??=new r.EUSignCP(``,``),n(i.MakeError(t,``))},i.load()}else e()})},t.prototype.IsSupported=function(){return r.EndUserLibraryLoader.isWebExtensionSupported()||r.EndUserLibraryLoader.isSignAgentSupported()||r.EndUserLibraryLoader.isNPAPISupported()||r.EndUserLibraryLoader.isActiveXSupported()},t.prototype.IsSignAgentSupported=function(){return r.EndUserLibraryLoader.isSignAgentSupported()},t.prototype.IsWebExtensionSupported=function(){return r.EndUserLibraryLoader.isWebExtensionSupported()},t.prototype.IsNPAPISupported=function(){return r.EndUserLibraryLoader.isNPAPISupported()},t.prototype.IsActiveXSupported=function(){return r.EndUserLibraryLoader.isActiveXSupported()},t.prototype.IsWebExtensionInstalled=function(){return r.EndUserLibraryLoader.isWebExtensionInstalled()},t.prototype.GetInstallURL=function(e,t){return e===void 0&&(e=!1),new r.EUSignCP(``,``).GetInstallURL(e,t)},t.prototype.GetUpdateURL=function(e,t){return e===void 0&&(e=!1),new r.EUSignCP(``,``).GetUpdateURL(e,t)},t.prototype.GetHelpURL=function(e){return new r.EUSignCP(``,``).GetHelpURL(e)},t.prototype.GetWebExtensionInstallURL=function(){return new r.EUSignCP(``,``).GetWebExtensionInstallURL()},t.prototype.GetVersion=function(){var t=this.m_library;return new e(function(e,n){t.GetVersion(e,n)})},t.prototype.IsInitialized=function(){var t=this.m_library;return new e(function(e,n){t.IsInitialized(e,n)})},t.prototype.Initialize=function(){var t=this.m_library;return new e(function(e,n){t.Initialize(e,n)})},t.prototype.Finalize=function(){var t=this.m_library;return new e(function(e,n){t.Finalize(e,n)})},t.prototype.ResetOperation=function(){var t=this.m_library;return new e(function(e,n){t.ResetOperation(e,n)})},t.prototype.SetUIMode=function(t){var n=this.m_library;return new e(function(e,r){n.SetUIMode(t,e,r)})},t.prototype.SetLanguage=function(t){var n=this.m_library;if(typeof t==`string`)switch(t=t.toLocaleLowerCase()){case`en`:t=this.EU_EN_LANG;break;case`ru`:t=this.EU_RU_LANG;break;case`uk`:case`ua`:default:t=this.EU_UA_LANG}return this.m_language=t,new e(function(e,r){n.SetLanguage(t,e,r)})},t.prototype.SetCharset=function(t){var n=this.m_library;return new e(function(e,r){n.SetCharset(t,e,r)})},t.prototype.SetRuntimeParameter=function(t,n){var r=this.m_library;return new e(function(e,i){r.SetRuntimeParameter(t,n,e,i)})},t.prototype.GetStorageParameter=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetStorageParameter(t,n,e,i)})},t.prototype.SetStorageParameter=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.SetStorageParameter(t,n,r,e,a)})},t.prototype.BASE64Encode=function(t){var n=this.m_library;return new e(function(e,r){n.BASE64Encode(t,e,r)})},t.prototype.BASE64Decode=function(t){var n=this.m_library;return new e(function(e,r){n.BASE64Decode(t,e,r)})},t.prototype.StringToBytes=function(t){var n=this.m_library;return new e(function(e,r){n.StringToBytes(t,e,r)})},t.prototype.BytesToString=function(t){var n=this.m_library;return new e(function(e,r){n.BytesToString(t,e,r)})},t.prototype.DoesNeedSetSettings=function(){var t=this.m_library;return new e(function(e,n){t.DoesNeedSetSettings(e,n)})},t.prototype.InitializeMandatorySettings=function(){var t=this.m_library;return new e(function(e,n){t.InitializeMandatorySettings(e,n)})},t.prototype.CreateModeSettings=function(){return this.m_library.CreateModeSettings()},t.prototype.GetModeSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetModeSettings(e,n)})},t.prototype.SetModeSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetModeSettings(t,e,r)})},t.prototype.CreateKeyMediaSettings=function(){return this.m_library.CreateKeyMediaSettings()},t.prototype.GetKeyMediaSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetKeyMediaSettings(e,n)})},t.prototype.SetKeyMediaSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetKeyMediaSettings(t,e,r)})},t.prototype.CreateFileStoreSettings=function(){return this.m_library.CreateFileStoreSettings()},t.prototype.GetFileStoreSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetFileStoreSettings(e,n)})},t.prototype.SetFileStoreSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetFileStoreSettings(t,e,r)})},t.prototype.CreateProxySettings=function(){return this.m_library.CreateProxySettings()},t.prototype.GetProxySettings=function(){var t=this.m_library;return new e(function(e,n){t.GetProxySettings(e,n)})},t.prototype.SetProxySettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetProxySettings(t,e,r)})},t.prototype.CreateOCSPSettings=function(){return this.m_library.CreateOCSPSettings()},t.prototype.GetOCSPSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetOCSPSettings(e,n)})},t.prototype.SetOCSPSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetOCSPSettings(t,e,r)})},t.prototype.CreateOCSPAccessInfoModeSettings=function(){return this.m_library.CreateOCSPAccessInfoModeSettings()},t.prototype.GetOCSPAccessInfoModeSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetOCSPAccessInfoModeSettings(e,n)})},t.prototype.SetOCSPAccessInfoModeSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetOCSPAccessInfoModeSettings(t,e,r)})},t.prototype.CreateOCSPAccessInfoSettings=function(){return this.m_library.CreateOCSPAccessInfoSettings()},t.prototype.EnumOCSPAccessInfoSettings=function(t){var n=this.m_library;return new e(function(e,r){n.EnumOCSPAccessInfoSettings(t,e,r)})},t.prototype.GetOCSPAccessInfoSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetOCSPAccessInfoSettings(e,n)})},t.prototype.SetOCSPAccessInfoSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetOCSPAccessInfoSettings(t,e,r)})},t.prototype.DeleteOCSPAccessInfoSettings=function(t){var n=this.m_library;return new e(function(e,r){n.DeleteOCSPAccessInfoSettings(t,e,r)})},t.prototype.CreateTSPSettings=function(){return this.m_library.CreateTSPSettings()},t.prototype.GetTSPSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetTSPSettings(e,n)})},t.prototype.SetTSPSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetTSPSettings(t,e,r)})},t.prototype.CreateLDAPSettings=function(){return this.m_library.CreateLDAPSettings()},t.prototype.GetLDAPSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetLDAPSettings(e,n)})},t.prototype.SetLDAPSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetLDAPSettings(t,e,r)})},t.prototype.CreateCMPSettings=function(){return this.m_library.CreateCMPSettings()},t.prototype.GetCMPSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetCMPSettings(e,n)})},t.prototype.SetCMPSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetCMPSettings(t,e,r)})},t.prototype.GetSystemProxySettings=function(){var t=this.m_library;return new e(function(e,n){t.GetSystemProxySettings(e,n)})},t.prototype.CreateTSLSettings=function(){return this.m_library.CreateTSLSettings()},t.prototype.GetTSLSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetTSLSettings(e,n)})},t.prototype.SetTSLSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetTSLSettings(t,e,r)})},t.prototype.SetOCSPResponseExpireTime=function(t){var n=this.m_library;return new e(function(e,r){n.SetOCSPResponseExpireTime(t,e,r)})},t.prototype.GetCertificate=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetCertificate(t,n,e,i)})},t.prototype.ParseCertificateEx=function(t){var n=this.m_library;return new e(function(e,r){n.ParseCertificateEx(t,e,r)})},t.prototype.SaveCertificate=function(t){var n=this.m_library;return new e(function(e,r){n.SaveCertificate(t,e,r)})},t.prototype.SaveCertificates=function(t){var n=this.m_library;return new e(function(e,r){n.SaveCertificates(t,e,r)})},t.prototype.GetTSPByAccessInfo=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.GetTSPByAccessInfo(t,n,r,i,e,o)})},t.prototype.CheckTSP=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CheckTSP(t,n,r,e,a)})},t.prototype.DownloadData=function(t,n){var i=this;return new e(function(e,a){try{var o=new XMLHttpRequest;o.onload=function(){if(o.readyState==4){var s=null;try{if(o.status!=200)throw`Download data error. URL - `+t+`, status - `+o.status;switch(n){case`binary`:s=new Uint8Array(o.response);break;case`json`:s=JSON.parse(o.responseText.replace(/\\'/g,`'`));break;default:s=o.responseText}}catch(e){console.log(`EndUser.DowloadData error: `+e),a(i.MakeError(r.EndUserError.ERROR_DOWNLOAD_FILE,``));return}e(s)}},o.onerror=function(){a(i.MakeError(r.EndUserError.ERROR_DOWNLOAD_FILE,``))},t=i.MakeURL(t),o.open(`GET`,t,!0),n==`binary`&&(o.responseType=`arraybuffer`),o.send()}catch{a(i.MakeError(r.EndUserError.ERROR_DOWNLOAD_FILE,``))}})},t.prototype.CreateKeyMedia=function(){return this.m_library.CreateKeyMedia()},t.prototype.GetPrivateKeyMedia=function(t){var n=this.m_library;return new e(function(e,r){n.GetPrivateKeyMedia(t,e,r)})},t.prototype.EnumKeyMediaTypes=function(t){var n=this.m_library;return new e(function(e,r){n.EnumKeyMediaTypes(t,e,r)})},t.prototype.EnumKeyMediaDevices=function(t,n){var r=this.m_library;return new e(function(e,i){r.EnumKeyMediaDevices(t,n,e,i)})},t.prototype.GetKeyMediaTypes=function(){var t=this.m_library;return new e(function(e,n){t.GetKeyMediaTypes(e,n)})},t.prototype.GetKeyMediaDevices=function(t){var n=this.m_library;return new e(function(e,r){n.GetKeyMediaDevices(t,e,r)})},t.prototype.IsPrivateKeyReaded=function(){var t=this.m_library;return new e(function(e,n){t.IsPrivateKeyReaded(e,n)})},t.prototype.ReadPrivateKey=function(){var t=this.m_library;return new e(function(e,n){t.ReadPrivateKey(e,n)})},t.prototype.ReadPrivateKeySilently=function(t,n,r){var i=this.m_library;return new e(function(e,a){typeof t==`number`?i.ReadPrivateKeySilently(t,n,r,e,a):i.ReadPrivateKeySilently(t,e,a)})},t.prototype.ReadPrivateKeyBinary=function(t,n){var r=this.m_library;return new e(function(e,i){r.ReadPrivateKeyBinary(t,n,e,i)})},t.prototype.ReadPrivateKeyFile=function(t,n){var r=this.m_library;return new e(function(e,i){r.ReadPrivateKeyFile(t,n,e,i)})},t.prototype.ResetPrivateKey=function(){var t=this.m_library;return new e(function(e,n){t.ResetPrivateKey(e,n)})},t.prototype.CtxReadPrivateKey=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){typeof n==`number`?a.CtxReadPrivateKey(t,n,r,i,e,o):a.CtxReadPrivateKey(t,n,e,o)})},t.prototype.CtxReadPrivateKeyBinary=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxReadPrivateKeyBinary(t,n,r,e,a)})},t.prototype.CtxFreePrivateKey=function(t){var n=this.m_library;return new e(function(e,r){n.CtxFreePrivateKey(t,e,r)})},t.prototype.ShowOwnCertificate=function(){var t=this.m_library;return new e(function(e,n){t.ShowOwnCertificate(e,n)})},t.prototype.GetOwnCertificate=function(t,n){var r=this.m_library;return new e(function(e,i){typeof t==`number`||typeof n==`number`?r.GetOwnCertificate(t,n,e,i):r.GetOwnCertificate(e,i)})},t.prototype.GetOwnEUserParams=function(){var t=this.m_library;return new e(function(e,n){t.GetOwnEUserParams(e,n)})},t.prototype.CtxGetOwnEUserParams=function(t){var n=this.m_library;return new e(function(e,r){n.CtxGetOwnEUserParams(t,e,r)})},t.prototype.ModifyOwnEUserParams=function(t,n){var r=this.m_library;return new e(function(e,i){r.ModifyOwnEUserParams(t,n,e,i)})},t.prototype.CtxModifyOwnEUserParams=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxModifyOwnEUserParams(t,n,r,e,a)})},t.prototype.EnumOwnCertificates=function(t){var n=this.m_library;return new e(function(e,r){n.EnumOwnCertificates(t,e,r)})},t.prototype.GetPrivateKeyOwnerInfo=function(){var t=this.m_library;return new e(function(e,n){t.GetPrivateKeyOwnerInfo(e,n)})},t.prototype.CtxEnumOwnCertificates=function(t,n){var r=this.m_library;return new e(function(e,i){r.CtxEnumOwnCertificates(t,n,e,i)})},t.prototype.CtxGetOwnCertificate=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxGetOwnCertificate(t,n,r,e,a)})},t.prototype.GetKeyInfo=function(t){var n=this.m_library;return new e(function(e,r){n.GetKeyInfo(t,e,r)})},t.prototype.GetKeyInfoBinary=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetKeyInfoBinary(t,n,e,i)})},t.prototype.GetKeyInfoFile=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetKeyInfoFile(t,n,e,i)})},t.prototype.GetCertificatesByKeyInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.GetCertificatesByKeyInfo(t,n,r,e,a)})},t.prototype.EnumJKSPrivateKeys=function(t,n){var r=this.m_library;return new e(function(e,i){r.EnumJKSPrivateKeys(t,n,e,i)})},t.prototype.GetJKSPrivateKey=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetJKSPrivateKey(t,n,e,i)})},t.prototype.CreatePrivateKeyInfo=function(){return this.m_library.CreatePrivateKeyInfo()},t.prototype.CreateEndUserInfo=function(){return this.m_library.CreateEndUserInfo()},t.prototype.GeneratePrivateKeyEx=function(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){var v=this.m_library;return new e(function(e,y){v.GeneratePrivateKeyEx(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,e,y)})},t.prototype.ChangePrivateKeyPassword=function(t,n){var r=this.m_library;return new e(function(e,i){t==null?r.ChangePrivateKeyPassword(e,i):r.ChangePrivateKeyPassword(t.GetTypeIndex(),t.GetDevIndex(),t.GetPassword(),n,e,i)})},t.prototype.ChangeSoftwarePrivateKeyPassword=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.ChangeSoftwarePrivateKeyPassword(t,n,r,e,a)})},t.prototype.SetKeyMediaUserPassword=function(t,n){var r=this.m_library;return new e(function(e,i){n==null?r.SetKeyMediaUserPassword(t,e,i):r.SetKeyMediaUserPassword(t,n.GetTypeIndex(),n.GetDevIndex(),n.GetPassword(),e,i)})},t.prototype.ChangeOwnCertificatesStatus=function(t,n){var r=this.m_library;return new e(function(e,i){r.ChangeOwnCertificatesStatus(t,n,e,i)})},t.prototype.CtxChangeOwnCertificatesStatus=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxChangeOwnCertificatesStatus(t,n,r,e,a)})},t.prototype.MakeNewCertificate=function(t,n,r,i,a,o,s,c,l,u,d,f,p){var m=this.m_library;return new e(function(e,h){m.MakeNewCertificate(t,n,r,i,a,o,s,c,l,u,d,f,p,e,h)})},t.prototype.MakeNewCertificateEx=function(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=this.m_library;return new e(function(e,_){g.MakeNewCertificateEx(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,e,_)})},t.prototype.MakeNewOwnCertificate=function(t,n,r,i,a,o,s,c){var l=this.m_library;return new e(function(e,u){l.MakeNewOwnCertificate(t,n,r,i,a,o,s,c,e,u)})},t.prototype.CtxMakeNewOwnCertificate=function(t,n,r,i,a,o,s,c,l){var u=this.m_library;return new e(function(e,d){u.CtxMakeNewOwnCertificate(t,n,r,i,a,o,s,c,l,e,d)})},t.prototype.CtxMakeNewOwnCertificateEx=function(t,n,r,i,a,o,s,c,l,u,d){var f=this.m_library;return new e(function(e,p){f.CtxMakeNewOwnCertificateEx(t,n,r,i,a,o,s,c,l,u,d,e,p)})},t.prototype.CtxMakeNewOwnCertificateWithCR=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxMakeNewOwnCertificateWithCR(t,n,r,i,a,e,s)})},t.prototype.CtxMakeDeviceCertificate=function(t,n,r,i,a,o,s,c){var l=this.m_library;return new e(function(e,u){l.CtxMakeDeviceCertificate(t,n,r,i,a,o,s,c,e,u)})},t.prototype.CtxHash=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.CtxHash(t,n,r,i,e,o)})},t.prototype.CtxHashBegin=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxHashBegin(t,n,r,e,a)})},t.prototype.CtxHashContinue=function(t,n){var r=this.m_library;return new e(function(e,i){r.CtxHashContinue(t,n,e,i)})},t.prototype.CtxHashEnd=function(t){var n=this.m_library;return new e(function(e,r){n.CtxHashEnd(t,e,r)})},t.prototype.CtxHashFree=function(t){var n=this.m_library;return new e(function(e,r){n.CtxHashFree(t,e,r)})},t.prototype.GetSignType=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetSignType(t,n,e,i)})},t.prototype.GetSigner=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetSigner(t,n,e,i)})},t.prototype.CtxGetSignerInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxGetSignerInfo(t,n,r,e,a)})},t.prototype.SignHash=function(t){var n=this.m_library;return new e(function(e,r){n.SignHash(t,e,r)})},t.prototype.Sign=function(t){var n=this.m_library;return new e(function(e,r){n.Sign(t,e,r)})},t.prototype.SignInternal=function(t,n){var r=this.m_library;return new e(function(e,i){r.SignInternal(t,n,e,i)})},t.prototype.SignHashRSA=function(t){var n=this.m_library;return new e(function(e,r){n.SignHashRSA(t,e,r)})},t.prototype.SignRSA=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.SignRSA(t,n,r,e,a)})},t.prototype.CtxSignHash=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.CtxSignHash(t,n,r,i,e,o)})},t.prototype.CtxSign=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxSign(t,n,r,i,a,e,s)})},t.prototype.CtxSignFile=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxSignFile(t,n,r,i,a,o,e,c)})},t.prototype.CtxGetSignValue=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxGetSignValue(t,n,r,e,a)})},t.prototype.AppendSignHash=function(t,n){var r=this.m_library;return new e(function(e,i){r.AppendSignHash(t,n,e,i)})},t.prototype.AppendSign=function(t,n){var r=this.m_library;return new e(function(e,i){r.AppendSign(t,n,e,i)})},t.prototype.AppendSignInternal=function(t,n){var r=this.m_library;return new e(function(e,i){r.AppendSignInternal(t,n,e,i)})},t.prototype.CtxAppendSignHash=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxAppendSignHash(t,n,r,i,a,e,s)})},t.prototype.CtxAppendSign=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxAppendSign(t,n,r,i,a,e,s)})},t.prototype.CtxAppendSignFile=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxAppendSignFile(t,n,r,i,a,o,e,c)})},t.prototype.AppendSigner=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.AppendSigner(t,n,r,e,a)})},t.prototype.AppendValidationDataToSignerEx=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.AppendValidationDataToSignerEx(t,n,r,e,a)})},t.prototype.IsDataInSignedDataAvailable=function(t){var n=this.m_library;return new e(function(e,r){n.IsDataInSignedDataAvailable(t,e,r)})},t.prototype.GetDataFromSignedData=function(t){var n=this.m_library;return new e(function(e,r){n.GetDataFromSignedData(t,e,r)})},t.prototype.GetCertificateFromSignedData=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetCertificateFromSignedData(t,n,e,i)})},t.prototype.GetSignsCount=function(t){var n=this.m_library;return new e(function(e,r){n.GetSignsCount(t,e,r)})},t.prototype.GetSignTimeInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetSignTimeInfo(t,n,e,i)})},t.prototype.VerifyHashOnTimeEx=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.VerifyHashOnTimeEx(t,n,r,i,a,o,e,c)})},t.prototype.VerifyDataOnTimeEx=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.VerifyDataOnTimeEx(t,n,r,i,a,o,e,c)})},t.prototype.VerifyDataInternalOnTimeEx=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.VerifyDataInternalOnTimeEx(t,n,r,i,a,e,s)})},t.prototype.CreateEndUserSession=function(){return this.m_library.CreateEndUserSession()},t.prototype.CreateReference=function(e,t){return this.m_library.CreateReference(e,t)},t}()}).call(this,n(13).Promise)},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t){var n,r,i=e.exports={};function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch{try{return n.call(null,e,0)}catch{return n.call(this,e,0)}}}(function(){try{n=typeof setTimeout==`function`?setTimeout:a}catch{n=a}try{r=typeof clearTimeout==`function`?clearTimeout:o}catch{r=o}})();var c,l=[],u=!1,d=-1;function f(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&p())}function p(){if(!u){var e=s(f);u=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch{try{return r.call(null,e)}catch{return r.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function h(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new m(e,t)),l.length!==1||u||s(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title=`browser`,i.browser=!0,i.env={},i.argv=[],i.version=``,i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(e){return[]},i.binding=function(e){throw Error(`process.binding is not supported`)},i.cwd=function(){return`/`},i.chdir=function(e){throw Error(`process.chdir is not supported`)},i.umask=function(){return 0}},function(e,t){var n=function(){return this}();try{n||=Function(`return this`)()}catch{typeof window==`object`&&(n=window)}e.exports=n},function(e,t){}])})})),f=c({EndUserBase64Coder:()=>M,EndUserUTF16LECoder:()=>P,EndUserUTF8Coder:()=>N,IS_DSTU_7564_DAY:()=>A,arrayToBase64:()=>v,arrayToString:()=>x,base64ToArray:()=>y,convertFromBase64:()=>C,convertToBase64:()=>S,dateWithoutTimezone:()=>j,downloadAndSignFiles:()=>O,downloadData:()=>m,format:()=>g,getFileNameFromUrl:()=>D,getSupportedSignAlgos:()=>T,isDefaultValue:()=>k,isUrlValid:()=>E,makeUrl:()=>h,readFile:()=>_,signAlgoToHashAlgo:()=>w,stringToArray:()=>b}),p=u(d());function m(e,t,n,r){return new Promise((i,a)=>{e=h(e);let o=new XMLHttpRequest;if(o.onerror=function(t){console.error(t),a(`Download data error. URL - `+e+`, status - `+o.status)},o.onload=function(){if(o.readyState!=XMLHttpRequest.DONE)return;if(o.status!=200){a(`Download data error. URL - `+e+`, status - `+o.status);return}let n;switch(t){case`binary`:i(new Uint8Array(o.response));break;case`json`:i(JSON.parse(o.responseText.replace(/\\'/g,`'`)));break;case`xml`:i(o.responseXML);break;case`blob`:try{n=new Blob([o.responseText],{type:`application/javascript`})}catch{n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder),n.append(o.responseText),n=n.getBlob()}i(n);break;default:i(o.responseText)}},t===`binary`?o.responseType=`arraybuffer`:t==`xml`&&(o.responseType=`document`),o.open(r?`POST`:`GET`,e,!0),typeof n==`string`&&o.setRequestHeader(`Authorization`,`Bearer `+n),r){let e=JSON.stringify(r);o.setRequestHeader(`Content-Type`,`application/json`),o.send(e)}else o.send()})}function h(e){let t=location.origin,n=location.pathname;return e.indexOf(`http://`)===0||e.indexOf(`https://`)===0?e:e.indexOf(`/`)===0&&t?t+e:t&&n?t+n.substring(0,n.lastIndexOf(`/`))+`/`+e:e}function g(e){let t=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,n){return t[n]===void 0?e:t[n]})}function _(e){return new Promise((t,n)=>{let r=new FileReader;r.onloadend=function(){this.readyState==this.DONE?t(new Uint8Array(this.result)):n(this.error)},r.readAsArrayBuffer(e)})}function v(e){return typeof e.toBase64==`function`?e.toBase64():new M().encode(e)}function y(e){return typeof Uint8Array.fromBase64==`function`?Uint8Array.fromBase64(e):new M().decode(e)}function b(e){return new Uint8Array(new P().encode(e))}function x(e){return new P().decode(e)}function S(e){return v(b(e))}function C(e){return x(y(e))}function w(e){switch(e){case p.EndUserConstants.EndUserSignAlgo.RSAWithSHA:case p.EndUserConstants.EndUserSignAlgo.ECDSAWithSHA:return p.EndUserConstants.EndUserHashAlgo.SHA256;case p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311:return p.EndUserConstants.EndUserHashAlgo.GOST34311;case p.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564:return p.EndUserConstants.EndUserHashAlgo.DSTU7564_256;default:return p.EndUserConstants.EndUserHashAlgo.Unknown}}function T(e,t=null){let n=[];return e.forEach(e=>{if((e.infoEx.keyUsageType&p.EndUserConstants.EndUserKeyUsage.DigitalSignature)===p.EndUserConstants.EndUserKeyUsage.DigitalSignature)switch(e.infoEx.publicKeyType){case p.EndUserConstants.EndUserCertKeyType.DSTU4145:(e.infoEx.certHashType===p.EndUserConstants.EU_CERT_HASH_TYPE_GOST34311||e.infoEx.certHashType===p.EndUserConstants.EU_CERT_HASH_TYPE_DSTU7564_256)&&t?.HashAlgorithm===`GOST34311`?n.push(p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311):n.push(p.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564);break;case p.EndUserConstants.EndUserCertKeyType.RSA:n.push(p.EndUserConstants.EndUserSignAlgo.RSAWithSHA);break;case p.EndUserConstants.EndUserCertKeyType.ECDSA:n.push(p.EndUserConstants.EndUserSignAlgo.ECDSAWithSHA)}}),n}function E(e){try{return!!new URL(e)}catch{return!1}}function D(e){return e=new URL(e),e.searchParams.get(`file`)||e.searchParams.get(`name`)||e.pathname.split(`/`).pop()}async function O(e,t){let n=e=>typeof e==`string`&&E(e)||typeof e==`object`&&typeof e.name==`string`&&typeof e.val==`string`&&E(e.val);if(Array.isArray(e)){if(!e.every(n)||!(e.every(e=>typeof e==`string`)||e.every(e=>typeof e==`object`)))throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:`Bad parameter fileUrl`};let r=e.every(e=>typeof e==`object`);e=await Promise.all(e.map(async e=>typeof e==`object`?{name:e.name,val:await m(e.val,`binary`)}:{name:D(e),val:await m(e,`binary`)}));let i=await t(e);return r?i:i.map(e=>e.val||e)}{if(!n(e))throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:`Bad parameter fileUrl`};let r=typeof e==`object`;e=typeof e==`object`?{name:e.name,val:await m(e.val,`binary`)}:{name:D(e),val:await m(e,`binary`)};let i=await t(e);return r?i:i.val||i}}function k(e){return e===!1||e==null}var A=()=>Date.now()>=new Date(2026,6,1);function j(e){let t=e.getTimezoneOffset()*6e4;return new Date(e.valueOf()-t).toISOString().slice(0,-1)}var M=class{constructor(){this.m_map=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,this.m_codes=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47]}_getTextDecoder(){try{if(typeof TextDecoder>`u`)return null;let e=new TextDecoder(`utf-8`);return e.encoding==`utf-8`?e:null}catch{return null}}_encodePart(e,t,n){let r=[],i,a;for(let o=t;o<n;o+=3)i=e[o]<<16|e[o+1]<<8|e[o+2],a=this.m_map[i>>18&63]+this.m_map[i>>12&63]+this.m_map[i>>6&63]+this.m_map[i&63],r.push(a);return r.join(``)}encode(e){let t,n,r,i,a,o=``,s;if(t=typeof Uint8Array>`u`?typeof EndUserUint8Array>`u`?e.slice(0):new EndUserUint8Array(e):new Uint8Array(e),a=t.length,a==0)return``;let c=this._getTextDecoder();if(c!=null){for(s=new Uint8Array(parseInt((a+2)/3)*4),n=0,r=0;n<a-a%3;n+=3,r+=4)i=t[n]<<16|t[n+1]<<8|t[n+2],s[r]=this.m_codes[i>>18&63],s[r+1]=this.m_codes[i>>12&63],s[r+2]=this.m_codes[i>>6&63],s[r+3]=this.m_codes[i&63];switch(a%3){case 1:i=t[n]<<16,s[r]=this.m_codes[i>>18&63],s[r+1]=this.m_codes[i>>12&63],s[r+2]=61,s[r+3]=61;break;case 2:i=t[n]<<16|t[n+1]<<8,s[r]=this.m_codes[i>>18&63],s[r+1]=this.m_codes[i>>12&63],s[r+2]=this.m_codes[i>>6&63],s[r+3]=61}o=c.decode(s)}else{let e=null,r=15360,c=a-a%3,l=parseInt(c/r),u;for(s=[],n=0;n<l;n++)e=this._encodePart(t,n*r,n*r+r),s.push(e);switch(l*r<c&&(e=this._encodePart(t,n*r,c),s.push(e)),a%3){case 1:i=t[a-1]<<16,u=this.m_map[i>>18&63],u+=this.m_map[i>>12&63],u+=`=`,u+=`=`,s.push(u);break;case 2:i=t[a-2]<<16|t[a-1]<<8,u=this.m_map[i>>18&63],u+=this.m_map[i>>12&63],u+=this.m_map[i>>6&63],u+=`=`,s.push(u)}o=s.join(``)}return o}decode(e){let t,n,r,i,a,o,s,c,l,u,d;if(e==``||(e.length&3)>0)return typeof Uint8Array>`u`?typeof EndUserUint8Array>`u`?[]:new EndUserUint8Array(0):new Uint8Array;for(o=e.length,s=e[o-1]==`=`?e[o-2]==`=`?2:1:0,n=o/4*3-s,t=typeof Uint8Array>`u`?typeof EndUserUint8Array>`u`?[]:new EndUserUint8Array(n):new Uint8Array(n),r=0,i=0,a=0;r<Math.floor((o-s)/4);r++)c=this.m_map.indexOf(e[i++]),l=this.m_map.indexOf(e[i++]),u=this.m_map.indexOf(e[i++]),d=this.m_map.indexOf(e[i++]),t[a++]=c<<2|l>>4,t[a++]=(l&15)<<4|u>>2,t[a++]=(u&3)<<6|d&63;switch(s){case 2:c=this.m_map.indexOf(e[i]),l=this.m_map.indexOf(e[i+1]),t[a++]=c<<2|l>>4;break;case 1:c=this.m_map.indexOf(e[i]),l=this.m_map.indexOf(e[i+1]),u=this.m_map.indexOf(e[i+2]),t[a++]=c<<2|l>>4,t[a++]=(l&15)<<4|u>>2}return t}},N=class{encode(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}decode(e){for(var t=[],n=0,r=0,i,a,o;n<e.length;)i=e[n++],i<128?t[r++]=String.fromCharCode(i):i>191&&i<224?(a=e[n++],t[r++]=String.fromCharCode((i&31)<<6|a&63)):(a=e[n++],o=e[n++],t[r++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63));return t.join(``)}},P=class{encode(e){for(var t=[],n,r=0;r<e.length;r++)n=e.charCodeAt(r),t.push(n&255),t.push((n&65280)>>8);return t}decode(e){var t=0,n=``,r;if(e.length%2!=0)return null;for(r=e.length,r>0&&e[r-2]==0&&e[r-1]==0&&(r-=2);t<r;)n+=String.fromCharCode(e[t]|e[t+1]<<8),t+=2;return n}},F=class{constructor(e){e||=``;let t=e.split(`;`);this.AllowSavePassword=this._getZoneValue(t,1)!==`1`,this.AutoSetParams=this._getSubZoneValue(t,2,`,`,1)===`+`,this.ProviderName=this._getSubZoneValue(t,2,`,`,2),this.SaveCert=this._getZoneValue(t,3)===`+`,this.CheckCrls=this._getSubZoneValue(t,4,`,`,1)===`+`,this.OwnCrlsOnly=this._getSubZoneValue(t,4,`,`,2)===`+`,this.FullAndDeltaCrls=this._getSubZoneValue(t,4,`,`,3)===`+`,this.AutoDownloadCrls=this._getSubZoneValue(t,4,`,`,4)===`+`,this.UseTsp=this._getSubZoneValue(t,5,`,`,1)===`+`,this.TspAddress=this._getSubZoneValue(t,5,`,`,2),this.TspPort=parseInt(this._getSubZoneValue(t,5,`,`,3)),this.UseOcsp=this._getSubZoneValue(t,6,`,`,1)===`+`,this.OcspAddress=this._getSubZoneValue(t,6,`,`,2),this.OcspPort=parseInt(this._getSubZoneValue(t,6,`,`,3)),this.OcspBeforeStore=this._getSubZoneValue(t,6,`,`,4)===`+`,this.UseOcspAccess=this._getSubZoneValue(t,6,`,`,5)===`+`,this.UseCmp=this._getSubZoneValue(t,7,`,`,1)===`+`,this.CmpAddress=this._getSubZoneValue(t,7,`,`,2),this.CmpPort=parseInt(this._getSubZoneValue(t,7,`,`,3)),this.UseLdap=this._getSubZoneValue(t,8,`,`,1)===`+`,this.LdapAddress=this._getSubZoneValue(t,8,`,`,2),this.LdapPort=parseInt(this._getSubZoneValue(t,8,`,`,3)),this.ValidateOwner=this._getZoneValue(t,9)===`+`,this.StrongCheck=this._getZoneValue(t,10)===`+`,this.DontEraseKey=this._getZoneValue(t,11)===`+`,this.IdleTimeout=parseInt(this._getZoneValue(t,12)),this.DeviceType=this._getZoneValue(t,13),this.MainCrl=this._getZoneValue(t,14),this.HashAlgorithm=this._getZoneValue(t,15),this.PreferHarware=this._getZoneValue(t,16),this.HideMobileId=!0,this.UseProxy=this._getSubZoneValue(t,19,`,`,1)===`+`,this.ProxyAddress=this._getSubZoneValue(t,19,`,`,2),this.ProxyPort=this._getSubZoneValue(t,19,`,`,3),this.ProxyUser=this._getSubZoneValue(t,19,`,`,4),this.ProxyPassword=this._getSubZoneValue(t,19,`,`,5);let n=this._getSubZoneValue(t,19,`,`,6);this.ApplyProxySettings=!n||!n.trim()?this.UseProxy:n===`+`,this.AllowTestKeys=this._getZoneValue(t,20)===`+`,this.AgentSignWeb=this._getZoneValue(t,21)===`+`,this.TestCAConnection=this._getZoneValue(t,22)===`+`,this.DontSaveToRegistry=this._getZoneValue(t,23)===`+`;let r=this._getZoneValue(t,24),i=this._getZoneValue(t,25)===`+`||this._getZoneValue(t,25)!==`-`&&null;this.DirectAccess=i===!0||i!==!1&&!this.ApplyProxySettings&&!this.UseProxy,this.PreLoadClientLibraries=this._getZoneValue(t,26)===`+`;let a=parseInt(this._getZoneValue(t,27));if(this.WebClientFileSize=a<5?5:a>127?127:a,this.UseTSL=this._getZoneValue(t,28)===`+`,this.UmcaservicePort=this._getZoneValue(t,29),!r)this.KSPs=Y(this.AllowTestKeys);else{try{r=C(r),this.KSPs=JSON.parse(r)}catch(e){console.error(`error parsing KSPs from GlSign`),console.error(e)}(!this.KSPs||this.KSPs.length===0)&&(this.KSPs=Y(this.AllowTestKeys)),this.KSPs.forEach(e=>{if(e.ksp===G.DIIA||e.ksp===G.IIT||e.ksp===G.PB||e.ksp===G.VTOKEN){if(e.address.includes(`cabinet.e-life.com.ua`)||e.address.includes(`sserver.amokey.com`)||e.address.includes(`smart-sign.dpsu.gov.ua`)||e.address.includes(`sign-ca.mvs.gov.ua`)||e.address.includes(`id.edin.ua`)||e.address.includes(`business.ukrsibbank.com`))return;(!Array.isArray(e.signAlgos)||e.signAlgos.length==0)&&(e.signAlgos=[p.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564,p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311])}})}}_getZoneValue(e,t){return e.length>=t&&e[t-1]||``}_getSubZoneValue(e,t,n,r){let i=this._getZoneValue(e,t);if(!i)return``;let a=i.split(n);return this._getZoneValue(a,r)}},I=c({CertificatesProvider:()=>V,DefaultCertificatesProvider:()=>H,DefaultSettingProvider:()=>R,DigitalSignatureKeyType:()=>W,DigitalSignatureKeyTypeFile:()=>0,DigitalSignatureKeyTypeKSP:()=>2,DigitalSignatureKeyTypeToken:()=>1,DigitalSignatureKeyTypeUmCAService:()=>4,DigitalSignatureKeyTypeWindowsCertStore:()=>3,DigitalSignatureLibraryType:()=>U,DigitalSignatureLibraryTypeJS:()=>0,DigitalSignatureLibraryTypeSW:()=>1,DigitalSignatureSettings:()=>L,EU_KSP_ClientIdType:()=>-1,EU_KSP_DIIA:()=>7,EU_KSP_GRYADA:()=>-1,EU_KSP_IIT:()=>4,EU_KSP_PB:()=>6,EU_KSP_VTOKEN:()=>-2,EndUserKSP:()=>G,EndUserKSPClientIdType:()=>K,FilePrivateKeyInfo:()=>J,HardwarePrivateKeyInfo:()=>te,KSPKeyMedia:()=>ie,KSPKeyMediasResponse:()=>re,KSPPrivateKeyAuthData:()=>Z,KSPUserAuthData:()=>X,KspPrivateKeyInfo:()=>ne,LegacyCertificatesProvider:()=>ee,LegacySettingsProvider:()=>B,PrivateKeyInfo:()=>q,ProtectTaxReportParams:()=>Q,WebserviceSettingProvider:()=>z,getDefaultKSPs:()=>Y}),L=class{constructor(e,t,n,r,i){this.language=e||`en`,this.userId=t,this.httpProxyServiceURL=n,this.certificatesProvider=r,this.libraryUrl=i}},R=class{constructor(e,t,n,r){if(typeof n!=`string`)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:`basePath is not a string`};n.endsWith(`/`)&&(n=n.substring(0,n.length-1)),this.language=e,this.userId=t,this.apiPath=n,this.workerPath=r}async getGlSign(){return new F(await m(this.apiPath+`/files?name=glsign`,`string`))}async getSettings(){return this._settings||=new L(this.language,this.userId,this.apiPath+`/ProxyHandler`,new H(this.apiPath+`/files?name=CAs.json`,this.apiPath+`/files?name=CACertificates.p7b`),this.workerPath||`/euscp.worker.js`),this._settings}},z=class{constructor(e,t,n,r){this.language=e,this.userId=t,this.apiPath=n,this.workerPath=r}async getGlSign(){return new F(await m(`${this.apiPath}/webservice.asmx/ExecuteEx?pureJSON=`,void 0,void 0,{calcId:`GETGLSIGNBEFORELOGIN`,args:``,ticket:``}))}async getSettings(){if(this._settings)return this._settings;let e=await m(`${this.apiPath}/webservice.asmx/ExecuteEx?pureJSON=`,`json`,void 0,{calcId:`GETCASANDCERTIFICATEFILES`,args:``,ticket:``});return this._settings=new L(this.language,this.userId,`${this.apiPath}/ProxyHandler`,new H(`${this.apiPath}/GetFile.ashx?file=${e.FILECAS}`,`${this.apiPath}/GetFile.ashx?file=${e.FILECERT}`),this.workerPath||`/euscp.worker.js`),this._settings}},B=class{constructor(e,t,n,r,i){if(typeof n!=`string`)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:`basePath is not a string`};n.endsWith(`/`)&&(n=n.substring(0,n.length-1)),this.language=e,this.userId=t,this.basePath=n,this.glsign=r,this.workerPath=i}getGlSign(){return typeof this.glsign==`string`?new F(this.glsign):this.glsign}getSettings(e){return new L(this.language,this.userId,this.basePath+`/ProxyHandler.ashx`,new ee(e,this.basePath+`/Data/version.txt`,this.basePath+(e?`/Data/CAs.Test.json`:`/Data/CAs.json`),this.basePath+(e?`/Data/CACertificates.Test.p7b`:`/Data/CACertificates.p7b`)),this.workerPath||`/euscp.worker.js`)}},V=class{constructor(e){this.testMode=e}async loadCertificates(){throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:`Not implemented`}}get _storagePrefix(){return this.testMode?`Test`:``}_getItem(e){return localStorage.getItem(this._storagePrefix+e)}_setItem(e,t){localStorage.setItem(this._storagePrefix+e,t)}_removeItem(e){localStorage.removeItem(this._storagePrefix+e)}},H=class extends V{constructor(e,t){super(!1),this.CAsUri=e,this.CACertificatesUri=t}async loadCertificates(){try{let[e,t]=await Promise.all([m(this.CAsUri,`json`),m(this.CACertificatesUri,`binary`)]);return{CAs:e,CACertificates:t}}catch(e){throw console.error(e),{code:p.EndUserError.EU_ERROR_DOWNLOAD_FILE,message:`Error downloading root certificates`}}}},ee=class extends V{constructor(e,t,n,r){super(e),this.versionUri=t,this.CAsUri=n,this.CACertificatesUri=r}async loadCertificates(){let e=this._getItem(`CA`),t=this._getItem(`Certificates`),n=this._getItem(`CAVersion`);try{let r=await m(this.versionUri);if(r!=n&&(n=r,e=null,t=null),e)try{e=JSON.parse(e)}catch(t){console.error(t),e=null}if(e||(e=await m(this.CAsUri,`json`),this._setItem(`CA`,JSON.stringify(e))),t)try{t=y(t)}catch(e){console.error(e),t=null}return t||(t=await m(this.CACertificatesUri,`binary`),this._setItem(`Certificates`,v(t))),this._setItem(`CAVersion`,n),{CAs:e,CACertificates:t}}catch(e){throw this._removeItem(`CA`),this._removeItem(`CAVersion`),this._removeItem(`Certificates`),console.error(e),{code:p.EndUserError.EU_ERROR_DOWNLOAD_FILE,message:`Error downloading root certificates`}}}},U={JS:0,SW:1},W={File:0,Token:1,KSP:2,WindowsCertStore:3,UmCAService:4},G={IIT:4,PB:6,DIIA:7,GRYADA:-1,VTOKEN:-2},K={Default:p.EndUserConstants.EndUserKSPClientIdType.Default,Name:p.EndUserConstants.EndUserKSPClientIdType.Name,Phone:p.EndUserConstants.EndUserKSPClientIdType.Phone,Email:p.EndUserConstants.EndUserKSPClientIdType.Email,NamePassword:-1},q=class{constructor(e,t,n,r,i){this.keyType=e,this.ownerInfo=t,this.certificates=n,this.visibleName=r,this.id=i}isDigitalStamp(){if(!Array.isArray(this.certificates)||this.certificates.length===0)return!1;let e=this.certificates;for(let t=0;t<e.length;t++){let n=e[t].infoEx;if(n.publicKeyType==p.EndUserConstants.EndUserCertKeyType.DSTU4145&&(n.keyUsageType&p.EndUserConstants.EndUserKeyUsage.DigitalSignature)==p.EndUserConstants.EndUserKeyUsage.DigitalSignature)return!(n.extKeyUsages.indexOf(p.EndUserConstants.EU_UA_OID_EXT_KEY_USAGE_STAMP)<0&&n.extKeyUsages.indexOf(`Цифрова печатка`)<0)}return!1}supportSigning(){if(this.keyType===2)return!0;let e=this.certificates;for(let t=0;t<e.length;t++)if((e[t].infoEx.keyUsageType&p.EndUserConstants.EndUserKeyUsage.DigitalSignature)==p.EndUserConstants.EndUserKeyUsage.DigitalSignature)return!0;return!1}supportEncryption(){if(this.keyType===2)return!1;let e=this.certificates;for(let t=0;t<e.length;t++)if((e[t].infoEx.keyUsageType&p.EndUserConstants.EndUserKeyUsage.KeyAgreement)==p.EndUserConstants.EndUserKeyUsage.KeyAgreement)return!0;return!1}getSignAlgo(){let e=this.certificates;if(this.keyType===2){let e=this.ksp;if(Array.isArray(e.signAlgos)&&e.signAlgos.length>0){let t=e.signAlgos[0];return t===p.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564&&this._glsign?.HashAlgorithm===`GOST34311`&&e.signAlgos.includes(p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311)?p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311:t}return p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311}return e.length>0?T(e,this._glsign)[0]:p.EndUserConstants.EndUserSignAlgo.Unknown}getHashAlgo(){if(this.keyType===2)return w(this.getSignAlgo());let e=this.certificates;if(e.length>0&&e[0]?.infoEx?.certHashType){let t=e[0].infoEx.certHashType;return t==p.EndUserConstants.EndUserHashAlgo.GOST34311&&this._glsign?.HashAlgorithm!==`GOST34311`?p.EndUserConstants.EndUserHashAlgo.DSTU7564_256:t==p.EndUserConstants.EndUserHashAlgo.DSTU7564_256&&this._glsign?.HashAlgorithm===`GOST34311`?p.EndUserConstants.EndUserHashAlgo.GOST34311:t}return w(this.getSignAlgo())}},J=class extends q{constructor(e,t,n,r,i){super(e,t,n,n[0].infoEx.subjCN,n[0].infoEx.serial),this.privateKey=r,this.password=i}},te=class extends q{constructor(e,t,n,r){super(e,t,n,n[0].infoEx.subjCN,n[0].infoEx.serial),this.keyMedia=r}},ne=class extends q{constructor(e,t,n,r,i,a){super(e,t,n,r,r),this.userId=r,this.ksp=i,this.keyId=a}};function Y(e){let t=new p.KSPSettings;t.id=`DEPOSITSIGN`,t.name=`DepositSign`,t.ksp=p.EndUserConstants.EU_KSP_PB,t.address=`https://depositsign.com/api/v1/it-enterprise/sign-server`,t.clientIdPrefix=``,t.directAccess=!0,t.needQRCode=!1;let n=new p.KSPSettings;n.id=`DIIA-SIGN`,n.name=`Дія.Підпис`,n.ksp=p.EndUserConstants.EU_KSP_DIIA,n.directAccess=!1,n.mobileAppName=`Дія`,n.address=`https://diia-sign.it.ua/KSPSign`,n.systemId=`diia-sign-it-ent`,n.needQRCode=!0,n.signAlgos=[1];let r=new p.KSPSettings;r.id=`PB-SMARTID`,r.name=`Приватбанк - хмарний підпис "SmartID"`,r.ksp=p.EndUserConstants.EU_KSP_PB,r.directAccess=!0,r.mobileAppName=`Приват24`,r.address=`https://acsk.privatbank.ua/cloud/api/back/`,r.clientIdPrefix=`IEIS_`,r.confirmationURL=`https://www.privat24.ua/rd/kep`,r.needQRCode=!0;let i=new p.KSPSettings;i.id=`VCHASNO`,i.name=`Вчасно - хмарний підпис`,i.ksp=p.EndUserConstants.EU_KSP_PB,i.address=`https://cs.vchasno.ua/ss/`,i.clientIdPrefix=``,i.directAccess=!1,i.needQRCode=!1;let a=new p.KSPSettings;a.id=`VCHASNOQR`,a.name=`Вчасно - хмарний підпис (QR)`,a.ksp=p.EndUserConstants.EU_KSP_PB,a.address=`https://cs.vchasno.ua/ss/`,a.clientIdPrefix=`vchasno_`,a.confirmationURL=`https://cs.vchasno.ua/rd/`,a.mobileAppName=`Вчасно.КЕП`,a.directAccess=!1,a.needQRCode=!0;let o=new p.KSPSettings;o.id=`CLOUDKEY`,o.name=`ТОВ «ЦСК «Україна» - хмарний підпис CloudKey`,o.ksp=p.EndUserConstants.EU_KSP_PB,o.directAccess=!0,o.mobileAppName=`CloudKey`,o.address=`https://sid.uakey.com.ua/smartid/iit/`,o.clientIdPrefix=`DIIA_2`,o.confirmationURL=`https://sid.uakey.com.ua/kep?hash=rd/kep`,o.needQRCode=!0;let s=new p.KSPSettings;s.id=`ESIGN`,s.name=`ESign - хмарний підпис`,s.ksp=p.EndUserConstants.EU_KSP_PB,s.address=`https://cabinet.e-life.com.ua/api/EDG/Sign`,s.clientIdPrefix=``,s.directAccess=!0,s.needQRCode=!1;let c=new p.KSPSettings;c.id=`SMARTSIGNTAX`,c.name=`ДПС - хмарний підпис`,c.ksp=p.EndUserConstants.EU_KSP_PB,c.address=`https://smart-sign.tax.gov.ua/`,c.port=`443`,c.directAccess=!0,c.clientIdType=K.Name,c.needQRCode=!1;let l=new p.KSPSettings;l.id=`PUMB`,l.name=`ПУМБ - хмарний підпис`,l.ksp=p.EndUserConstants.EU_KSP_PB,l.address=`https://apiext.pumb.ua/hogsmeade/striga/v1`,l.directAccess=!1,l.clientIdPrefix=`SMARTTENDER_`,l.confirmationURL=`https://www.pumb.ua/qes`,l.mobileAppName=``,l.needQRCode=!0;let u=new p.KSPSettings;u.id=`UGB`,u.name=`Укргазбанк - хмарний підпис «EcoSign»`,u.ksp=G.VTOKEN,u.address=`https://vtms-api-qca.ukrgasbank.com/vtco/api/v1`,u.systemId=`cihsmVtcoServiceClientSmartTender`,u.directAccess=!0,u.clientIdType=K.NamePassword,u.needQRCode=!1;let d=new p.KSPSettings;d.id=`ALLIANCE`,d.name=`Банк Альянс - хмарний підпис`,d.ksp=G.VTOKEN,d.address=`https://cihsm-api.bankalliance.ua/vtco/api/v1`,d.systemId=`cihsmVtcoServiceClientSmartTender`,d.directAccess=!0,d.clientIdType=K.NamePassword,d.needQRCode=!1;let f=new p.KSPSettings;f.id=`VTOKEN`,f.name=`Хмарний сервіс Шифр-vToken (тестовий)`,f.ksp=G.VTOKEN,f.address=`https://cihsm-dev-api.cipher.com.ua/vtco/api/v1`,f.systemId=`cipherVTokenIntegrationClient`,f.directAccess=!0,f.clientIdType=K.NamePassword,f.needQRCode=!1;let m=new p.KSPSettings;m.id=`AMOKEY`,m.name=`АМО ФІНТЕХ – хмарний підпис AMOKEY`,m.ksp=G.PB,m.address=`https://sserver.amokey.com`,m.port=`443`,m.clientIdPrefix=``,m.directAccess=!0,m.clientIdType=K.Name,m.needQRCode=!1;let h=new p.KSPSettings;h.id=`TASCOMBANK`,h.name=`Сервер підпису КНЕДП АТ "ТАСКОМБАНК"`,h.ksp=G.PB,h.address=`https://smartsign.tascombank.ua`,h.port=`443`,h.clientIdPrefix=``,h.directAccess=!0,h.clientIdType=K.Name,h.needQRCode=!1;let g=new p.KSPSettings;g.id=`EDINQR`,g.name=`EDIN ID - хмарний підпис (QR)`,g.ksp=G.PB,g.address=`https://id.edin.ua/api/ess/v1/`,g.confirmationURL=`https://id.edin.ua/mobile/sign`,g.port=``,g.clientIdPrefix=`EDIN_`,g.directAccess=!0,g.mobileAppName=`edinid`,g.needQRCode=!0;let _=new p.KSPSettings;_.id=`EDIN`,_.name=`EDIN ID - хмарний підпис`,_.ksp=G.PB,_.address=`https://id.edin.ua/api/ess/v1/`,_.port=``,_.clientIdPrefix=``,_.directAccess=!0,_.clientIdType=K.Name,_.needQRCode=!1;let v=new p.KSPSettings;v.id=`UKRSIBBANK`,v.name=`УКРСИББАНК - хмарний підпис`,v.ksp=G.PB,v.address=`https://business.ukrsibbank.com/morpheus/smart-sign/`,v.confirmationURL=`https://business.ukrsibbank.com/smartsign`,v.port=``,v.clientIdPrefix=`USB_`,v.directAccess=!0,v.mobileAppName=`UKRSIB business`,v.needQRCode=!0;let y=[t,n,r,i,a,o,s,c,l,u,d,m,h,g,_,v];return e&&y.push(f),y}var re=class{constructor(e,t,n){this.token=e,this.isTwoFactor=t,this.keys=n}},ie=class{constructor(e,t,n,r,i){this.keyId=e,this.visibleName=t,this.subject=n,this.issuer=r,this.isStamp=i}},X=class{constructor(e,t){this.userName=e,this.password=t}},Z=class{constructor(e,t,n){this.pin=e,this.token=t,this.twoFactorCode=n}},Q=class{constructor(e,t,n,r,i,a,o){this.accountantPrivateKeyContext=e,this.directorPrivateKeyContext=t,this.stampPrivateKeyContext=n,this.senderEMail=r,this.recipientCertificate=i,this.reports=a,this.returnIntermediateSign=o}},$=class{constructor(e){e||=`25989`,typeof e!=`string`&&(e=String(e)),this.baseUrl=`https://localhost:${e.trim()}/`}async tryConnect(){try{let e=await fetch(this.baseUrl+`about`);return e.ok&&typeof(await e.json()).AppID==`string`}catch{return!1}}async getKeys(){let e=await fetch(this.baseUrl+`keystores?ReadCertificates=true&KeyParams=true`);if(!e.ok){let t=await e.json();throw{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:t.Message}}return(await e.json()).map(e=>{let t=e.Description,n=e.Description.indexOf(`KeyStores`);return n>0&&(t=t.substring(n)),{alias:e.Certs[0].CertificateSerialNumber,visibleName:t,certificates:e.Certs.map(e=>e.Base64),password:null}})}async signData(e,t,n,r){let i;n.type===p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES?i=`pdf-attached`:(i=n.signLevel>=p.EndUserConstants.EU_SIGN_TYPE_CADES_C?`cades-x-ts-signtime-ocsp-stdua`:`cms-ts-signtime`,n.subType===p.EndUserConstants.EU_CADES_TYPE_ENVELOPED&&(i+=`-attached`));let a=!0;Array.isArray(t)?t=[...t]:(a=!1,t=[t]);for(let e=0;e<t.length;e++){let n=t[e];n.val?(typeof n.val==`string`&&(n.val=S(n.val)),t[e]={name:n.name,val:ae(n.val,!0)}):(typeof n==`string`&&(n=S(n)),t[e]=ae(n,!0))}let o=[];for(let n of t){let t=new Request(this.baseUrl+`sign`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({Data:n.val?n.val:n,Certificate:e.certificates[0],Pin:e.password,SigType:i,AsBlob:!1,AsResource:!1,DataAsLink:!1})}),r=await fetch(t);if(!r.ok){let e=await r.json();throw{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:e.Message}}let a=await r.json();o.push(n.name?{name:n.name,val:a}:a)}for(let e=0;e<o.length;e++){let t=o[e];t.val?o[e]={name:t.name,val:ae(t.val,!r)}:o[e]=ae(t,!r)}return a?o:o[0]}},ae=(e,t)=>t&&typeof e!=`string`?v(e):!t&&typeof e==`string`?y(e):e,oe={uk:{LibraryNotSupported:`Бібліотека web-підпису не підтримується в вашому браузері або ОС.`,LibraryNeedsInstall:`Бібліотека web-підпису не запущена або потребує встановлення. Будь ласка, запустіть або встановіть бібліотеку за посиланням та оновіть сторінку.`,LibraryNeedsUpdate:`Бібліотека web-підпису потребує оновлення. Будь ласка, встановіть оновлення за посиланням та оновіть сторінку.`,LibraryNeedsExtensionInstall:`Бібліотека web-підпису потребує встановлення веб-розширення. Будь ласка, встановіть веб-розширення за посиланням та оновіть сторінку.`,LibraryUserManual:`Настанова користувача`,WebExtensionInstall:`Інсталяційний пакет бібліотеки підпису (web-розширення)`,LibraryInstall:`Інсталяційний пакет web-бібліотеки підпису`,LibraryUpdate:`Оновлення web-бібліотеки підпису`,PrivateKeyNotReaded:`Особистий ключ не считано.`,DiiaError:`Дія.Підпис – сервіс для накладання кваліфікованого електронного підпису за допомогою смартфону і додатку «Дія».<br/>Для можливості використання «Дія.Підпис» у даній інсталяції системи вам необхідно звернутися до свого постачальника.<br/>У зверненні вкажіть наступну інформацію:<br/><ul><li>Посилання: `,DiiaHealthCheckError:`Сервіс Дія.Підпис недоступний.`,XadesError:"Перевірка кваліфікованого електронного підпису, який сформовано у вигляді окремого файлу з розширенням .xml виконується за умов наявності файлу з даними, на які накладено кваліфікований електронний підпис. Ім`я такого файлу зазвичай ідентичне з іменем файлу файлу з розширенням .xml. Оберіть цей файл разом з файлом кваліфікованого електронного підпису.",KSPSignFormatError:`Хмарні сервіси підтримують тільки підписи типу CAdES або PAdES`,KSPSignPAdESError:`Створення підписів в форматі PAdES підтримується тільки для Серверу підпису`,BadSignatureType:`Невірний тип підпису`,DownloadingRootCertificatesError:`Помилка при завантаженні сертифікатів ЦСК або списку ЦСК. Перевірте наявність налаштувань ЦСК в функції "Інструменти і налаштування → Електронний підпис → Налаштування ЦСК" та виконання задачі планувальника UPDATECASCERTIFICATES.`,BadParameter:`Невірний параметр`,PasswordNotSet:`Не вказано пароль до особистого ключа`,ReadPrivateKeyCAAutoDetectError:`Надавач не підтримує автоматичний пошук сертифіката за ос. ключем. Необхідно обрати надавача самостійно.`,ReadPrivateKeyInvalidCAError:`Ваш сертифікат виданий іншим надавачем та не обслуговується в {0}. Необхідно обрати надавача Вашого сертифіката.`,ReadPrivateKeyNeedCertificateError:`Надавач {0} не підтримує автоматичний пошук сертифіката за ос. ключем. Необхідно обрати сертифікат(и) ос. ключа.`,UmCAServiceConnectError:`Не вдалося підключитися до UmCAService. Перевірте чи сервіс запущений. В разі використання нестандартного порту, вкажіть його в глобальному параметрі GlSign.`,UmCAServiceWrongPassword:`Невірний пароль`},ru:{LibraryNotSupported:`Библиотека web-подписи не поддерживается в вашем браузере или ОС.`,LibraryNeedsInstall:`Библиотека web-подписи не установлена или не запущена. Для продолжения запустите или установите библиотеку по ссылке и обновите страницу.`,LibraryNeedsUpdate:`Библиотеке web-подписи требуется обновление. Для продолжения установите обновление по ссылке и обновите страницу.`,LibraryNeedsExtensionInstall:`Библиотеке web-подписи требуется устрановка веб-расширения. Для продолжения утсановите веб-расширение по ссылке и обновите страницу.`,LibraryUserManual:`Руководство пользователя`,WebExtensionInstall:`Установочный пакет библиотеки подписи (web-розширення)`,LibraryInstall:`Установочный пакет web-библиотеки подписи`,LibraryUpdate:`Обновление web-библиотеки подписи`,PrivateKeyNotReaded:`Приватный ключ не считан.`,DiiaError:`Дія.Підпис – сервис для наложения квалифицированной электронной подписи с помощью смартфона и приложения «Дія».<br/>Для возможности использования «Дія.Підпис» в данной инсталляции системы вам необходимо обратиться к своему поставщику.<br/>В обращении укажите следующую информацию:<br/><ul><li>Ссылка: `,DiiaHealthCheckError:`Сервис Дія.Підпис недоступен.`,XadesError:`Проверка квалифицированной электронной подписи, которая сформирована в виде отдельного файла с расширением .xml, выполняется при наличии файла с данными, на которые наложена квалифицированная электронная подпись. Имя такого файла обычно идентично с именем файла с расширением .xml. Выберите этот файл вместе с квалифицированной электронной подписью.`,KSPSignFormatError:`Облачные сервисы поддерживают только подписи типа CAdES или PAdES`,KSPSignPAdESError:`Создание подписей в формате PAdES поддерживается только для Сервера подписи`,BadSignatureType:`Неверный тип подписи`,DownloadingRootCertificatesError:`Ошибка при загрузке корневых сертификатов ЦСК, либо списка ЦСК. Проверьте наличие настроек ЦСК в функции "Инструменты и настройки → Электронная подпись → Настройки ЦСК" и выполнение задачи планировщика UPDATECASCERTIFICATES.`,BadParameter:`Неверный параметр`,PasswordNotSet:`Не указан пароль к приватному ключу`,ReadPrivateKeyCAAutoDetectError:`Центр сертификации не поддерживает автоматический поиск сертификата по приватному ключу. Необходимо выбрать центр сертификации самостоятельно.`,ReadPrivateKeyInvalidCAError:`Ваш сертификат выдан в другом центре сертификации и не обслуживается в {0}. Необходимо выбрать центр сертификации Вашего сертификата.`,ReadPrivateKeyNeedCertificateError:`Центр сертификации {0} не поддерживает автоматический поиск сертификата по приватному ключу. Нобходимо указать сертификат(ы) приватного ключа.`,UmCAServiceConnectError:`Не удалось подключиться к UmCAService. Проверьте, запущен ли сервис. В случае использования нестандартного порта, укажите его в глобальном параметре GlSign.`,UmCAServiceWrongPassword:`Неправильный пароль`},en:{LibraryNotSupported:`Web-signature library is not supported in your browser or OS.`,LibraryNeedsInstall:`Web-signature library not installed or not launched. Please, launch or install library by link and reload page.`,LibraryNeedsUpdate:`Web-signature library requires update. Please, install update by link and reload page.`,LibraryNeedsExtensionInstall:`Web-signature library requires installation of web-extension. Please, install web-extension by link and reload page.`,LibraryUserManual:`User manual`,WebExtensionInstall:`Signature library installation package (web-extension)`,LibraryInstall:`Web-signature library installation package`,LibraryUpdate:`Web-signature library update package`,PrivateKeyNotReaded:`Private key not readed.`,DiiaError:`Diia.Sign - a service for applying a qualified digital signature using a smartphone and the application "Diia". <br/> To be able to use "Diia.Sign" in this system, you need to contact your provider. <br/> Please include the following information in your request: <br/> <ul> <li> Link: `,DiiaHealthCheckError:`Diia.Sign service is unavailable.`,XadesError:`The verification of a qualified digital signature, which is formed as a separate file with the extension .xml, is performed under the conditions of the file with the data on which the qualified digital signature is affixed. The name of such a file is usually identical to the filename of the .xml file. Select this file along with the qualified digital signature file.`,KSPSignFormatError:`Cloud services only supports CAdES or PAdES signatures`,KSPSignPAdESError:`PAdES signatures are supported only by SignServer`,BadSignatureType:`Invalid signature type`,DownloadingRootCertificatesError:`Error occured while downloading root CA certificates or CA list. Check for CA setting in function "Tools and settings → Electronic signature → CA settings" and execution of task scheduler UPDATECASCERTIFICATES.`,BadParameter:`Invalid parameter`,PasswordNotSet:`Private key password not specified.`,ReadPrivateKeyCAAutoDetectError:`Certification authority does not support automatic search for a certificate by private key. You need to choose a certification authority yourself.`,ReadPrivateKeyInvalidCAError:`Your certificate was issued by a different CA and is not being serviced in {0}. You need to select a certification authority for your certificate.`,ReadPrivateKeyNeedCertificateError:`Certification authority {0} does not support automatic search for a certificate by private key. You must specify the certificates of the private key.`,UmCAServiceConnectError:`Unable to connect to UmCAService. Check if the service is running. If using a non-standard port, specify it in the global parameter GlSign.`,UmCAServiceWrongPassword:`Wrong password`}},se=`PKType`,ce=`PKInfo`;e.DigitalSignature=class{constructor(e){this._settingsProvider=e,this._glSign=null,this._settings=null,this._euSignFile,this._euSignKeyMedia,this._euSign=null,this._selectedCA=null,this._KSPs=[],this._readedKey=null,this._isInitializing=!1,this._initializationPromise=Promise.resolve(W.File)}get readedKey(){return this._readedKey}get _selectedIssuerCN(){return this._selectedCA?this._selectedCA.issuerCNs[0]:null}getLibraryType(){return this.keyType}async setLibraryType(e){switch(e){case W.Token:if(this._euSign===this._euSignKeyMedia&&await this._euSign.IsInitialized())return;this._euSign=this._euSignKeyMedia;break;case W.UmCAService:this._euSign=this._euSignFile;break;default:if(this._euSign===this._euSignFile)return;this._euSign=this._euSignFile}e!=null&&e!=null&&(this._preferredKeyType=e),this.keyType=e,await this.initialise()}initialise(){return this.initialize()}initialize(){return this._isInitializing?this._initializationPromise:(this._isInitializing=!0,this._initializationPromise=new Promise(async(e,t)=>{try{e(await this._initialize())}catch(e){t(e)}finally{this._isInitializing=!1}}),this._initializationPromise)}async _initialize(){if(this._glSign||=await Promise.resolve(this._settingsProvider.getGlSign()),this._settings||=await Promise.resolve(this._settingsProvider.getSettings(this._glSign.AllowTestKeys)),this._euSignFile||=new p.EndUser(this._settings.libraryUrl,p.EndUserConstants.EndUserLibraryType.JS,this._glSign.WebClientFileSize),this._euSignKeyMedia||=new p.EndUser(this._settings.libraryUrl,p.EndUserConstants.EndUserLibraryType.SW,this._glSign.WebClientFileSize),this._euSign||(this._euSign=this._glSign.PreferHarware?this._euSignKeyMedia:this._euSignFile,this.keyType=this._glSign.PreferHarware?W.Token:this._preferredKeyType),this.keyType===W.UmCAService&&(this.UmCAService||=new $(this.glSign.UmcaservicePort),!await this.UmCAService.tryConnect()))throw{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.UmCAServiceConnectError};let e=this._euSign;if(await e.IsInitialized())return this.getLibraryType();if(e===this._euSignKeyMedia){let t=await e.GetLibraryInfo();if(!t.supported)throw{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.LibraryNotSupported};if(!t.loaded)throw t.isNativeLibraryNeedUpdate?{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.LibraryNeedsUpdate,reload:!0,urls:[{href:t.nativeLibraryUpdateURL,caption:this._resourses.LibraryUpdate},{href:t.helpURL,caption:this._resourses.LibraryUserManual}]}:t.isWebExtensionSupported&&!t.isWebExtensionInstalled?{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.LibraryNeedsExtensionInstall,reload:!0,urls:[{href:t.webExtensionInstallURL,caption:this._resourses.WebExtensionInstall},{href:t.helpURL,caption:this._resourses.LibraryUserManual}]}:{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.LibraryNeedsInstall,reload:!0,urls:[{href:t.nativeLibraryInstallURL,caption:this._resourses.LibraryInstall},{href:t.helpURL,caption:this._resourses.LibraryUserManual}]}}if(!this._euSettings){let e;try{e=await this._settings.certificatesProvider.loadCertificates()}catch(e){throw e&&e.code===p.EndUserError.EU_ERROR_DOWNLOAD_FILE?{code:p.EndUserError.EU_ERROR_DOWNLOAD_FILE,message:this._resourses.DownloadingRootCertificatesError}:e}this._euSettings={language:this._language,encoding:`UTF-16LE`,httpProxyServiceURL:this._settings.httpProxyServiceURL,directAccess:this._glSign.DirectAccess,CAs:e.CAs,CACertificates:e.CACertificates,KSPs:this.KSPs,allowedKeyMediaTypes:[`е.ключ BIFIT iToken`,`криптомод. ІІТ Гряда-61`,`е.ключ ІІТ Алмаз-1К`,`е.ключ ІІТ Алмаз-1К (Bluetooth)`,`е.ключ ІІТ Кристал-1`,`криптомод. ІІТ Гряда-301`,`ID-карта громадянина (БЕН)`,`е.ключ ІІТ Алмаз-1К (PKCS#11)`,`е.ключ ІІТ Кристал-1 (PKCS#11)`,`е.ключ чи смарт-карта Avest (PKCS#11)`,`е.ключ Ефіт Key (PKCS#11)`,`е.ключ чи смарт-карта Автор (PKCS#11)`,`е.ключ чи смарт-карта Автор 338 (PKCS#11)`,`смарт-карта Техноконс. TEllipse3 (PKCS#11)`,`смарт-карта Техноконс. TEllipse`,`смарт-карта Техноконс. TEllipse2/3`,`е.ключ SIS DIAMOND`,`е.ключ SafeNet iKey (PKCS#11, RSA)`,`е.ключ Aruba Key (PKCS#11, RSA)`]}}if(await e.Initialize(this._euSettings),e===this._euSignKeyMedia&&!await this._euSignFile.IsInitialized()&&this._euSignFile.Initialize(this._euSettings),this._glSign.ApplyProxySettings){let{UseProxy:t,ProxyAddress:n,ProxyPort:r,ProxyUser:i,ProxyPassword:a}=this._glSign,o=new p.EndUserProxySettings;o.useProxy=t,o.address=n,o.port=r,o.anonymous=!i||!a,o.user=i,o.password=a,o.savePassword=!0,await e.SetProxySettings(o),e===this._euSignKeyMedia&&!await this._euSignFile.IsInitialized()&&this._euSignFile.SetProxySettings(o)}return await e.SetRuntimeParameter(p.EndUserConstants.EU_SIGN_TYPE_PARAMETER,p.EndUserConstants.EndUserSignType.CAdES_X_Long),e===this._euSignKeyMedia&&!await this._euSignFile.IsInitialized()&&this._euSignFile.SetRuntimeParameter(p.EndUserConstants.EU_SIGN_TYPE_PARAMETER,p.EndUserConstants.EndUserSignType.CAdES_X_Long),this.getLibraryType()}get glSign(){return this._glSign}async setLanguage(e){await this._euSignFile.SetLanguage(e),await this._euSignKeyMedia.IsInitialized()&&await this._euSignKeyMedia.SetLanguage(e)}async parseCertificate(e){await this.setLibraryType(W.File),typeof e==`string`&&(e=y(e));let t=new p.EndUserCertificate;return t.data=e,t.infoEx=await this._euSign.m_library.m_worker.postMessage(`ParseCertificateEx`,[e]),t}async getKeyMedias(){return await this.setLibraryType(W.Token),this._euSignKeyMedia.GetKeyMedias()}async readPrivateKeyByInfo(e){if(!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyInfo`};switch(await this.setLibraryType(e.keyType),e.keyType){case W.File:return await this.readFileKey(e.privateKey,e.password,e.certificates);case W.Token:return await this.readHardwareKey(e.keyMedia,e.certificates);case W.KSP:return await this.readPrivateKeyKSP(e.ksp,e.userId,!1,e.keyId);case W.UmCAService:return await this.readPrivateKeyUmCAService(e.keyMedia);case W.WindowsCertStore:return await this.readWindowsCertStorePrivateKey();default:return null}}async readHardwareKey(e,t){if(await this.setLibraryType(W.Token),!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyMedia`};if(!e.password)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.PasswordNotSet};t=Array.isArray(t)&&t.length>0?await Promise.all(t.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)):null;try{let n=await this._euSign.ReadPrivateKey(e,t,this._selectedIssuerCN);return this._readedKey=new te(W.Token,n,await this._euSign.GetOwnCertificates(),e),this._readedKey._glSign=this._glSign,this._readedKey}catch(e){if(e&&e.code===p.EndUserError.EU_ERROR_CERT_NOT_FOUND){if(!this._selectedIssuerCN)throw{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:this._resourses.ReadPrivateKeyCAAutoDetectError};if(this._selectedIssuerCN)throw this._selectedCA.cmpAddress?{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyInvalidCAError,this._selectedIssuerCN)}:{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyNeedCertificateError,this._selectedIssuerCN)}}throw e}}async readFileKey(e,t,n){if(await this.setLibraryType(W.File),!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyMedia`};if(!t)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.PasswordNotSet};(e instanceof File||e instanceof Blob)&&(e=await _(e)),n=Array.isArray(n)&&n.length>0?await Promise.all(n.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)):null;try{let r;try{r=await this._euSign.ReadPrivateKeyBinary(e,t,n,this._selectedIssuerCN)}catch(n){if(n&&n.code===p.EndUserError.EU_ERROR_CERT_BAD_BY_OCSP){let{certs:n}=await this._searchPrivateKeyCertificatesWithCMP_JS(e,t,this._selectedIssuerCN);r=await this._euSign.ReadPrivateKeyBinary(e,t,n,this._selectedIssuerCN)}else throw n}let i=await this._euSign.GetOwnCertificates();return this._readedKey=new J(W.File,r,i,e,t),this._readedKey._glSign=this._glSign,this._readedKey}catch(e){if(e&&e.code===p.EndUserError.EU_ERROR_CERT_NOT_FOUND){if(!this._selectedIssuerCN)throw{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:this._resourses.ReadPrivateKeyCAAutoDetectError};if(this._selectedIssuerCN)throw this._selectedCA.cmpAddress?{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyInvalidCAError,this._selectedIssuerCN)}:{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyNeedCertificateError,this._selectedIssuerCN)}}throw e}}async getJKSPrivateKeys(e){return await this.setLibraryType(W.File),(e instanceof File||e instanceof Blob)&&(e=await _(e)),await this._euSign.GetJKSPrivateKeys(e)}isJKSContainer(e){return e.name.endsWith(`.jks`)}async _searchPrivateKeyCertificatesWithCMP_JS(e,t,n){return await this._euSignFile.m_library.m_worker.postMessage(`CallSearchPrivateKeyCertificatesWithCMP`,[e,t,n])}async readPrivateKeyDepositsign(e,t=!1){let n=this.KSPs.find(e=>e.id===`DEPOSITSIGN`);return await this.readPrivateKeyKSP(n,e,t)}async readPrivateKeyDiia(e=!1){let t=this.KSPs.find(e=>e.id===`DIIA-SIGN`);return await this.readPrivateKeyKSP(t,null,e)}async readPrivateKeyKSP(e,t,n=!1,r,i,a){await this.setLibraryType(W.KSP),e.ksp===p.EndUserConstants.EU_KSP_DIIA&&await this._diiaCheckAccess(e),a=Array.isArray(a)&&a.length>0?await Promise.all(a.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)):null;let o=await this._euSign.ReadPrivateKeyKSP(t,e.name,n,r,null,i,a);if((n||a)&&!o)throw{code:p.EndUserError.EU_ERROR_KEY_MEDIAS_READ_FAILED,message:this._resourses.PrivateKeyNotReaded};return this._readedKey=new ne(W.KSP,o,n||a?await this._euSign.GetOwnCertificates():[],t,e,r),this._readedKey._glSign=this._glSign,this._readedKey}async getKeyMediasKSP(e,t){return await this.setLibraryType(W.KSP),this._euSign.m_library.m_worker.postMessage(`GetKeyMediasKSP`,[e,t])}async setTwoFactorCodeKSP(e){return await this.setLibraryType(W.KSP),this._euSign.m_library.m_worker.postMessage(`SetTwoFactorCodeKSP`,[e])}async addConfirmKSPOperationEventListener(e){await this._euSignFile.AddEventListener(p.EndUserConstants.EndUserEventType.ConfirmKSPOperation,function(t){t.qrCode=`data:image/bmp;base64,`+t.qrCode,e(t)})}async readPrivateKeyUmCAService(e){await this.setLibraryType(W.UmCAService);let t=[];for(let n of e.certificates){let e=await this.parseCertificate(n);t.push(e)}try{let n=new p.EndUserSignContainerInfo;n.type=p.EndUserConstants.EndUserSignContainerType.CAdES,n.subType=p.EndUserConstants.EndUserCAdESType.Enveloped,n.signLevel=p.EndUserConstants.EndUserSignType.CAdES_BES;let r=await this.UmCAService.signData(e,`AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=`,n),i=await this._euSignFile.VerifyDataInternal(r);return this._readedKey=new q(W.UmCAService,i[0].ownerInfo,t,e.visibleName,e.alias),this._readedKey.glSign=this.glSign,this._readedKey.keyMedia=e,this._readedKey}catch(e){throw e.message&&e.message==`KeyStoreException: KSE_INVALID_PASSWORD`?{code:p.EndUserError.EU_ERROR_BAD_PRIVATE_KEY,message:this._resourses.UmCAServiceWrongPassword}:e}}async getKeyMediasUmCAService(){return await this.setLibraryType(W.UmCAService),this.UmCAService.getKeys()}async readWindowsCertStorePrivateKey(){await this.setLibraryType(W.File);let e;try{e=await SignerDigital.getSelectedCertificate()}catch(e){throw{code:p.EndUserError.EU_ERROR_BAD_PRIVATE_KEY,message:String(e)}}e=JSON.parse(e);let t=await this.parseCertificate(e.Cert);return this._readedKey=new q(W.WindowsCertStore,t.infoEx,[t],t.infoEx.subjCN,e.CertThumbPrint),this._readedKey._glSign=this._glSign,this._readedKey}get KSPs(){return this._glSign.KSPs}async isPrivateKeyReaded(){if(!this._readedKey)return!1;if(this._readedKey.keyType===W.WindowsCertStore||this._readedKey.keyType===W.UmCAService)return!0;try{return await this._euSign.IsPrivateKeyReaded()}catch{return!1}}async resetPrivateKey(){await this._euSign.ResetPrivateKey(),this._readedKey=null}async resetKSPOperation(){await this._euSignFile.ResetOperationKSP()}async getCAs(){return await this._euSignFile.GetCAs()}async setCA(e){typeof e==`string`&&(e=(await this.getCAs()).find(t=>t.issuerCNs.find(t=>t===e))),this._selectedCA=e}needPrivateKeyCertificates(){return this._selectedCA&&!this._selectedCA.cmpAddress}async signData(e,t,n){if(t===!0?(t=new p.EndUserSignContainerInfo,t.type=p.EndUserConstants.EndUserSignContainerType.CAdES,t.subType=p.EndUserConstants.EndUserCAdESType.Enveloped,t.signLevel=p.EndUserConstants.EndUserSignType.CAdES_X_Long):k(t)&&(t=new p.EndUserSignContainerInfo,t.type=p.EndUserConstants.EndUserSignContainerType.CAdES,t.subType=p.EndUserConstants.EndUserCAdESType.Detached,t.signLevel=p.EndUserConstants.EndUserSignType.CAdES_X_Long),typeof n!=`boolean`&&(n=!1),this.readedKey.keyType===W.KSP){if(t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES&&t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};if(t.type===p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES&&(typeof this.readedKey.ksp==`object`?this.readedKey.ksp.ksp:this.readedKey.ksp)!=G.GRYADA)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignPAdESError}}if(this.readedKey.keyType===W.WindowsCertStore){if(t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};let r=await this._euSign.HashData(this._readedKey.getHashAlgo(),e,!0),i=await this._signHashWindowsCertificateStore(r,t,n);return this._euSign.m_library.m_worker.postMessage(`AppendDataToSignedData`,[i,e,!n])}if(this.readedKey.keyType===W.UmCAService){if(t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES&&t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};return await this.UmCAService.signData(this._readedKey.keyMedia,e,t,n)}let r=this._readedKey.getSignAlgo();if(t.type===p.EndUserConstants.EndUserSignContainerType.ASiC){let i=t.signLevel||t.asicSignType===p.EndUserConstants.EndUserASiCSignType.CAdES?p.EndUserConstants.EndUserSignType.CAdES_X_Long:p.EndUserConstants.EndUserXAdESSignLevel.B_LT;return await this._euSign.ASiCSignData(r,t.subType,t.asicSignType,i,e,!n)}if(t.type===p.EndUserConstants.EndUserSignContainerType.XAdES){let i=!0;Array.isArray(e)||(e=[e],i=!1),e=e.map((e,t)=>!e.name&&!e.val?{name:`data`+t,val:e}:e);let a=t.signLevel||p.EndUserConstants.EndUserXAdESSignLevel.B_LT,o=[];for(let i=0;i<e.length;i++){let s=await this._euSign.XAdESSignData(r,t.subType,a,e[i],!n);o[i]=s}return i?o:o[0]}if(t.type===p.EndUserConstants.EndUserSignContainerType.PAdES){let i=t.signLevel||p.EndUserConstants.EndUserPAdESSignLevel.B_T;return await this._euSign.PDFSignData(r,e,i,!n)}if(t.type===p.EndUserConstants.EndUserSignContainerType.CAdES){let i=t.signLevel||p.EndUserConstants.EndUserSignType.CAdES_X_Long;if(await this._euSign.SetRuntimeParameter(p.EndUserConstants.EU_SIGN_TYPE_PARAMETER,i),t.subType===p.EndUserConstants.EndUserCAdESType.Detached){let i=await this._euSign.HashData(this._readedKey.getHashAlgo(),e,!n);return this._readedKey.keyType==3?this._signHashWindowsCertificateStore(i,t,n):await this._euSign.SignHash(r,i,!0,!n)}return await this._euSign.SignDataEx(r,e,!1,!0,!n)}throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadSignatureType}}async signFile(e,t,n){return await O(e,async e=>await this.signData(e,t,n))}async signHash(e,t){if(typeof t!=`boolean`&&(t=!1),this._readedKey.keyType==W.WindowsCertStore)return this._signHashWindowsCertificateStore(e,!1,t);if(this._readedKey.keyType==W.UmCAService)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};return await this._euSign.SignHash(this._readedKey.getSignAlgo(),e,!0,!t)}async signFileHash(e,t){return await O(e,async e=>await this.signHash(e,t))}async getSignContainerInfo(e){return await this._euSign.GetSignContainerInfo(e)}async verifyData(e,t,n){Number.isInteger(n)||(n=-1);let r=await this._euSign.GetSignContainerInfo(t.val||t);if(r.type===p.EndUserConstants.EndUserSignContainerType.ASiC)return await this._euSign.ASiCVerifyData(t.val||t,n);if(r.type===p.EndUserConstants.EndUserSignContainerType.PAdES)return await this._euSign.PDFVerifyData(t.val||t,n);if(r.type===p.EndUserConstants.EndUserSignContainerType.XAdES)return await this._euSign.XAdESVerifyData(e,t.val||t,n);if(r.type===p.EndUserConstants.EndUserSignContainerType.CAdES){if(r.subType===p.EndUserConstants.EndUserCAdESType.Enveloped)return await this._euSign.VerifyDataInternal(t.val||t,n);if(!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` data`}}return await this._euSign.VerifyData(e.val||e,t.val||t,n)}async verifyFile(e,t,n){let[r,i]=await Promise.all([m(e,`binary`),m(t,`binary`)]);return await this.verifyData(r,i,n)}async verifyDataInternal(e,t){return await this.verifyData(null,e,t)}async verifyFileInternal(e,t){let n=await m(e);return await this.verifyDataInternal(n,t)}async verifyHash(e,t,n){return Number.isInteger(n)||(n=-1),await this._euSign.VerifyHash(e.val||e,t.val||t,n)}async verifyFileHash(e,t,n){let[r,i]=await Promise.all([m(e,`binary`),m(t,`binary`)]);return await this.verifyData(r,i,n)}async signDataEx(e,t){let n=await this.signData(e,t);if(Array.isArray(e)){let t=[];for(let r=0;r<n.length;r++)t[r]=await this._formatSignInfo(e[r],n[r],!1);return t}return await this._formatSignInfo(e,n)}async signFileEx(e,t){return await O(e,async e=>await this.signDataEx(e,t))}async signHashEx(e){let t=await this.signHash(e);if(Array.isArray(e)){let n=[];for(let r=0;r<t.length;r++)n[r]=await this._formatSignInfo(e[r],t[r],!0);return n}return await this._formatSignInfo(e,t,!0)}async _formatSignInfo(e,t,n){let r=this;return await i(e.val||e,t.val||t);async function i(e,t){let i;i=n?await r.verifyHash(e,t):await r.verifyData(e,t),Array.isArray(i)&&(i=i.pop());let o=await a(t);i.ownerInfo.certBeginTime=j(o.certBeginTime),i.ownerInfo.certEndTime=j(o.certEndTime),i.ownerInfo.publicKeyType=o.publicKeyType,i.ownerInfo.keyUsageType=o.keyUsageType,i.ownerInfo.certHashType=r._readedKey.getHashAlgo();let s=i.timeInfo,c=j(s.isSignTimeStampAvail?s.signTimeStamp:s.time);switch((s.isSignTimeStampAvail||s.isTimeStamp)&&(i.ownerInfo.timestamp=j(s.isSignTimeStampAvail?s.signTimeStamp:s.time)),r._readedKey.keyType){case W.File:i.ownerInfo.privateKeyType=`FileKey`;break;case W.Token:i.ownerInfo.privateKeyType=`HardwareKey`;break;case W.UmCAService:i.ownerInfo.privateKeyType=`UmCAService`;break;case W.WindowsCertStore:i.ownerInfo.privateKeyType=`WindowsCertStore`;break;case W.KSP:i.ownerInfo.privateKeyType=r._readedKey.ksp.ksp==G.GRYADA?`GRYADA`:r._readedKey.ksp.id}return{Success:!0,Sign:t,SignatureInfo:{Success:!0,DateTimeStr:c,Signer:i.ownerInfo.subjCN,OwnerInfo:i.ownerInfo}}}async function a(e){let t=await r._euSign.GetSignContainerInfo(e),n;switch(t.type){case p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES:n=await r._euSign.GetSigner(e);break;case p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_XADES:n=await r._euSign.XAdESGetSigner(e);break;case p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES:n=await r._euSign.PDFGetSigner(e);break;case p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_ASIC:n=await r._euSign.ASiCGetSigner(e)}return Array.isArray(n)&&(n=n.pop()),n.infoEx}}async _signHashWindowsCertificateStore(e,t,n){if(typeof n!=`boolean`&&(n=!1),t===!0?(t=new p.EndUserSignContainerInfo,t.type=p.EndUserConstants.EndUserSignContainerType.CAdES,t.subType=p.EndUserConstants.EndUserCAdESType.Enveloped,t.signLevel=p.EndUserConstants.EndUserSignType.CAdES_X_Long):k(t)&&(t=new p.EndUserSignContainerInfo,t.type=p.EndUserConstants.EndUserSignContainerType.CAdES,t.subType=p.EndUserConstants.EndUserCAdESType.Detached,t.signLevel=p.EndUserConstants.EndUserSignType.CAdES_X_Long),t.type!=p.EndUserConstants.EndUserSignContainerType.CAdES)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};let r=`SHA256`;switch(this._readedKey.getHashAlgo()){case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA512:r=`SHA512`;break;case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA384:r=`SHA384`;break;case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA256:r=`SHA256`;break;case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA224:r=`SHA224`;break;case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA160:r=`SHA160`}let i=this;async function a(e){typeof e!=`string`&&(e=v(e));let t;try{t=await SignerDigital.signHashCms(e,r,2,i._readedKey.id)}catch(e){throw{code:p.EndUserError.EU_ERROR_BAD_CERT,message:String(e)}}return await i._euSign.m_library.m_worker.postMessage(`AppendValidationData`,[t,i._readedKey.certificates[0].data,i._readedKey.getSignAlgo(),!n])}async function o(e){return e.val?{name:e.name,val:await a(e.val)}:await a(e)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=e[n];t[n]=await o(r)}return t}return await o(e)}async envelopData(e,t,n){return typeof n!=`boolean`&&(n=!1),Array.isArray(e)?await Promise.all(e.map(e=>this._euSign.EnvelopData(t,e,!1,!0,!n,!1))):await this._euSign.EnvelopData(t,e,!1,!0,!n,!1)}async developData(e,t){return await this._euSign.DevelopData(e,t)}async envelopFile(e,t,n){let r;return r=Array.isArray(e)?await Promise.all(e.map(e=>m(e,`binary`))):await m(e,`binary`),await this.envelopData(r,t,n)}async developFile(e,t){let n=await m(e,`binary`);return await this.developData(n,t)}async protectTaxReports(e){return await this._euSign.ProtectTaxReports(e.accountantPrivateKeyContext?.keyContext,Array.isArray(e.directorPrivateKeyContext)?e.directorPrivateKeyContext.map(e=>e.keyContext):e.directorPrivateKeyContext?.keyContext,Array.isArray(e.stampPrivateKeyContext)?e.stampPrivateKeyContext.map(e=>e.keyContext):e.stampPrivateKeyContext?.keyContext,e.senderEMail,e.recipientCertificate,e.reports,e.returnIntermediateSign)}async ctxReadHardwareKey(e,t){if(await this.setLibraryType(W.Token),!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyMedia`};if(!e.password)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.PasswordNotSet};Array.isArray(t)&&t.length>0&&(t=await Promise.all(t.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)));try{let n=await this._euSign.CtxCreate(),r=await this._euSign.CtxReadPrivateKey(n,e,t,this._selectedIssuerCN),i=new te(W.Token,r.ownerInfo,await this._euSign.CtxGetOwnCertificates(r),e);return i.context=n,i.keyContext=r,i._glSign=this._glSign,i}catch(e){if(e&&e.code===p.EndUserError.EU_ERROR_CERT_NOT_FOUND){if(!this._selectedIssuerCN)throw{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:this._resourses.ReadPrivateKeyCAAutoDetectError};if(this._selectedIssuerCN)throw this._selectedCA.cmpAddress?{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyInvalidCAError,this._selectedIssuerCN)}:{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyNeedCertificateError,this._selectedIssuerCN)}}throw e}}async ctxReadFileKey(e,t,n){if(await this.setLibraryType(W.File),!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyMedia`};if(!t)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.PasswordNotSet};(e instanceof File||e instanceof Blob)&&(e=await _(e)),Array.isArray(n)&&n.length>0&&(n=await Promise.all(n.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)));try{let r=await this._euSign.CtxCreate(),i=await this._euSign.CtxReadPrivateKeyBinary(r,e,t,n,this._selectedIssuerCN),a=new J(W.File,i.ownerInfo,await this._euSign.CtxGetOwnCertificates(i),e,t);return a.context=r,a.keyContext=i,a._glSign=this._glSign,a}catch(e){if(e&&e.code===p.EndUserError.EU_ERROR_CERT_NOT_FOUND){if(!this._selectedIssuerCN)throw{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:this._resourses.ReadPrivateKeyCAAutoDetectError};if(this._selectedIssuerCN)throw this._selectedCA.cmpAddress?{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyInvalidCAError,this._selectedIssuerCN)}:{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyNeedCertificateError,this._selectedIssuerCN)}}throw e}}async ctxFreePrivateKey(e){e.keyType===W.Token?await this.setLibraryType(W.Token):await this.setLibraryType(W.File),await this._euSign.CtxFreePrivateKey(e.keyContext),await this._euSign.CtxFree(e.context)}async getPrivateKeyInfoFromStorage(e,t){let n=(e?localStorage:sessionStorage)[this._userId+ce],r,i=[];if(!n)return i;let a=await this._euSignFile.UnprotectDataByPassword(n,``,!0);try{r=JSON.parse(a),t>=0&&(r=r.filter(e=>e.keyType==t))}catch{r=[]}return r.forEach(e=>{let t=e.password;if(e.keyType==W.File)e.privateKey=new Uint8Array(Object.assign([],e.privateKey)),e=new J(e.keyType,e.ownerInfo,e.certificates,e.privateKey,e.password);else if(e.keyType==W.Token)e=new te(e.keyType,e.ownerInfo,e.certificates,e.keyMedia);else if(e.keyType==W.KSP)e=new ne(e.keyType,e.ownerInfo,e.certificates,e.userId,e.ksp,e.keyId);else if(e.keyType==W.UmCAService){let t=e.keyMedia;e=new q(e.keyType,e.ownerInfo,e.certificates,e.visibleName,e.id),e.keyMedia=t}else e.keyType==W.WindowsCertStore&&(e=new q(e.keyType,e.ownerInfo,e.certificates,e.visibleName,e.id));let n=[];e.certificates.forEach(e=>{let t=Object.assign(new p.EndUserCertificate,e);t.data=new Uint8Array(Object.assign([],e.data)),n.push(t)}),e.certificates=n,e.password=t,e._glSign=this._glSign,i.push(e)}),i}async storePrivateKeyInfo(e,t){if(e.ksp&&e.ksp.needQRCode)return;let n=t?localStorage:sessionStorage,r=await this.getStoredPrivateKeyInfo();if(r.length==0||r.filter(t=>t.id==e.id).length<1){let r=await this.getPrivateKeyInfoFromStorage(t);r.push(e);let i=await this._euSignFile.ProtectDataByPassword(JSON.stringify(r),``,!0);n[this._userId+ce]=i}}async getStoredPrivateKeyInfo(e){let t=await this.getPrivateKeyInfoFromStorage(!0,e),n=await this.getPrivateKeyInfoFromStorage(!1,e);return t.concat(n)}async removeStoredPrivateKeyInfo(e){if(e===void 0)localStorage.removeItem(this._userId+ce),sessionStorage.removeItem(this._userId+ce);else{let t=await this.getPrivateKeyInfoFromStorage(!0),n=await this.getPrivateKeyInfoFromStorage(!1),r=t.filter(t=>t.id==e).length>0?localStorage:sessionStorage,i=r==localStorage?t:n,a=i.findIndex(t=>t.id==e);if(a>-1){i.splice(a,1);let e=await this._euSignFile.ProtectDataByPassword(JSON.stringify(i),``,!0);r[this._userId+ce]=e}}}get _preferredKeyType(){let e=parseInt(localStorage[this._userId+se]);return typeof e==`number`&&e>-1?e:(localStorage[this._userId+se]=W.File,W.File)}set _preferredKeyType(e){typeof e==`number`&&e>-1&&(localStorage[this._userId+se]=e)}get _resourses(){return oe[this._language]}get _userId(){return typeof this._settingsProvider.userId==`function`?this._settingsProvider.userId():this._settingsProvider.userId}get _language(){return typeof this._settingsProvider.language==`function`?this._settingsProvider.language():this._settingsProvider.language}async _diiaCheckAccess(e){let t=`DIIA`;if(sessionStorage[t]!=`+`)try{sessionStorage[t]=await m(e.address.replace(`KSPSign`,`DIIA`))}catch{throw{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:this._resourses.DiiaError+`<a target="_blank" href="${window.origin}">${window.origin}</a></li><ul>`}}try{if((await m(e.address.replace(`KSPSign`,`health`))).trim().toLowerCase()!=`healthy`)throw{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:this._resourses.DiiaHealthCheckError}}catch(e){throw console.error(e),{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:this._resourses.DiiaHealthCheckError}}}},Object.defineProperty(e,"EUSignCP",{enumerable:!0,get:function(){return p}}),e.GlSign=F,Object.defineProperty(e,"Models",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return f}})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ItDigitalSignature={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t||n(r,Symbol.toStringTag,{value:`Module`}),r},l=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},u=(e,r,i)=>(i=e==null?{}:t(a(e)),l(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),d=s(((e,t)=>{(function(n,r){if(typeof e==`object`&&typeof t==`object`)t.exports=r();else if(typeof define==`function`&&define.amd)define([],r);else{var i=r();for(var a in i)(typeof e==`object`?e:n)[a]=i[a]}})(e,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){typeof Symbol<`u`&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:`Module`}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&typeof e==`object`&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&typeof e!=`string`)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=4)}([function(e,t,n){"use strict";n.r(t),n.d(t,`EU_LIBRARY_TYPE_JS`,function(){return i}),n.d(t,`EU_LIBRARY_TYPE_SW`,function(){return a}),n.d(t,`EU_LIBRARY_TYPE_MS`,function(){return o}),n.d(t,`EndUserLibraryType`,function(){return r}),n.d(t,`EU_SUBJECT_TYPE_UNDIFFERENCED`,function(){return c}),n.d(t,`EU_SUBJECT_TYPE_CA`,function(){return l}),n.d(t,`EU_SUBJECT_TYPE_CA_SERVER`,function(){return u}),n.d(t,`EU_SUBJECT_TYPE_RA_ADMINISTRATOR`,function(){return d}),n.d(t,`EU_SUBJECT_TYPE_END_USER`,function(){return f}),n.d(t,`EndUserSubjectType`,function(){return s}),n.d(t,`EU_SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED`,function(){return m}),n.d(t,`EU_SUBJECT_CA_SERVER_SUB_TYPE_CMP`,function(){return h}),n.d(t,`EU_SUBJECT_CA_SERVER_SUB_TYPE_TSP`,function(){return g}),n.d(t,`EU_SUBJECT_CA_SERVER_SUB_TYPE_OCSP`,function(){return _}),n.d(t,`EndUserSubjectCAServerSubType`,function(){return p}),n.d(t,`EU_CERT_KEY_TYPE_UNKNOWN`,function(){return y}),n.d(t,`EU_CERT_KEY_TYPE_DSTU4145`,function(){return b}),n.d(t,`EU_CERT_KEY_TYPE_RSA`,function(){return x}),n.d(t,`EU_CERT_KEY_TYPE_ECDSA`,function(){return S}),n.d(t,`EndUserCertKeyType`,function(){return v}),n.d(t,`EU_CERT_HASH_TYPE_UNKNOWN`,function(){return w}),n.d(t,`EU_CERT_HASH_TYPE_GOST34311`,function(){return T}),n.d(t,`EU_CERT_HASH_TYPE_SHA1`,function(){return E}),n.d(t,`EU_CERT_HASH_TYPE_SHA224`,function(){return D}),n.d(t,`EU_CERT_HASH_TYPE_SHA256`,function(){return O}),n.d(t,`EU_CERT_HASH_TYPE_SHA384`,function(){return k}),n.d(t,`EU_CERT_HASH_TYPE_SHA512`,function(){return A}),n.d(t,`EU_CERT_HASH_TYPE_DSTU7564_256`,function(){return j}),n.d(t,`EU_CERT_HASH_TYPE_DSTU7564_384`,function(){return M}),n.d(t,`EU_CERT_HASH_TYPE_DSTU7564_512`,function(){return N}),n.d(t,`EndUserCertHashType`,function(){return C}),n.d(t,`EU_KEY_USAGE_UNKNOWN`,function(){return F}),n.d(t,`EU_KEY_USAGE_DIGITAL_SIGNATURE`,function(){return I}),n.d(t,`EU_KEY_USAGE_NON_REPUDATION`,function(){return L}),n.d(t,`EU_KEY_USAGE_KEY_AGREEMENT`,function(){return R}),n.d(t,`EndUserKeyUsage`,function(){return P}),n.d(t,`EU_CCS_TYPE_REVOKE`,function(){return B}),n.d(t,`EU_CCS_TYPE_HOLD`,function(){return V}),n.d(t,`EndUserCCSType`,function(){return z}),n.d(t,`EU_REVOCATION_REASON_UNKNOWN`,function(){return U}),n.d(t,`EU_REVOCATION_REASON_KEY_COMPROMISE`,function(){return W}),n.d(t,`EU_REVOCATION_REASON_NEW_ISSUED`,function(){return G}),n.d(t,`EndUserRevocationReason`,function(){return H}),n.d(t,`EU_KEYS_TYPE_NONE`,function(){return q}),n.d(t,`EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_GOST`,function(){return J}),n.d(t,`EU_KEYS_TYPE_RSA_WITH_SHA`,function(){return ee}),n.d(t,`EU_KEYS_TYPE_ECDSA_WITH_SHA`,function(){return te}),n.d(t,`EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_DSTU`,function(){return ne}),n.d(t,`EndUserKeysType`,function(){return K}),n.d(t,`EU_KEYS_LENGTH_DS_UA_191`,function(){return re}),n.d(t,`EU_KEYS_LENGTH_DS_UA_257`,function(){return ie}),n.d(t,`EU_KEYS_LENGTH_DS_UA_307`,function(){return X}),n.d(t,`EU_KEYS_LENGTH_DS_UA_FILE`,function(){return Z}),n.d(t,`EU_KEYS_LENGTH_DS_UA_CERT`,function(){return Q}),n.d(t,`EndUserKeysLengthDSUA`,function(){return Y}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_257`,function(){return ae}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_431`,function(){return oe}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_571`,function(){return se}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_FILE`,function(){return ce}),n.d(t,`EU_KEYS_LENGTH_KEP_UA_CERT`,function(){return le}),n.d(t,`EndUserKeysLengthKEPUA`,function(){return $}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_1024`,function(){return de}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_2048`,function(){return fe}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_3072`,function(){return pe}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_4096`,function(){return me}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_FILE`,function(){return he}),n.d(t,`EU_KEYS_LENGTH_DS_RSA_CERT`,function(){return ge}),n.d(t,`EndUserKeysLengthDSRSA`,function(){return ue}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_192`,function(){return ve}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_256`,function(){return ye}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_384`,function(){return be}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_521`,function(){return xe}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_FILE`,function(){return Se}),n.d(t,`EU_KEYS_LENGTH_DS_ECDSA_CERT`,function(){return Ce}),n.d(t,`EndUserKeysLengthDSECDSA`,function(){return _e}),n.d(t,`EU_KEYS_REQUEST_TYPE_UA_DS`,function(){return Te}),n.d(t,`EU_KEYS_REQUEST_TYPE_UA_KEP`,function(){return Ee}),n.d(t,`EU_KEYS_REQUEST_TYPE_INT_RSA`,function(){return De}),n.d(t,`EndUserRequestTypes`,function(){return we}),n.d(t,`EU_MOBILE_OPERATOR_ID_KYIVSTAR`,function(){return ke}),n.d(t,`EU_MOBILE_OPERATOR_ID_VODAFONE`,function(){return Ae}),n.d(t,`EU_MOBILE_OPERATOR_ID_LIFECELL`,function(){return je}),n.d(t,`EndUserMobileOperatorID`,function(){return Oe}),n.d(t,`EU_KSP_IIT`,function(){return Pe}),n.d(t,`EU_KSP_UKEY`,function(){return Fe}),n.d(t,`EU_KSP_PB`,function(){return Ie}),n.d(t,`EU_KSP_DIIA`,function(){return Le}),n.d(t,`EndUserKSP`,function(){return Me}),n.d(t,`EndUserKSPClientIdType`,function(){return Ne}),n.d(t,`EU_SIGN_TYPE_UNKNOWN`,function(){return ze}),n.d(t,`EU_SIGN_TYPE_CADES_BES`,function(){return Be}),n.d(t,`EU_SIGN_TYPE_CADES_T`,function(){return Ve}),n.d(t,`EU_SIGN_TYPE_CADES_C`,function(){return He}),n.d(t,`EU_SIGN_TYPE_CADES_X_LONG`,function(){return Ue}),n.d(t,`EU_SIGN_TYPE_CADES_X_LONG_TRUSTED`,function(){return We}),n.d(t,`EndUserSignType`,function(){return Re}),n.d(t,`EU_CADES_TYPE_UNKNOWN`,function(){return Ke}),n.d(t,`EU_CADES_TYPE_DETACHED`,function(){return qe}),n.d(t,`EU_CADES_TYPE_ENVELOPED`,function(){return Je}),n.d(t,`EndUserCAdESType`,function(){return Ge}),n.d(t,`EU_CTX_SIGN_UNKNOWN`,function(){return Xe}),n.d(t,`EU_CTX_SIGN_DSTU4145_WITH_GOST34311`,function(){return Ze}),n.d(t,`EU_CTX_SIGN_RSA_WITH_SHA`,function(){return Qe}),n.d(t,`EU_CTX_SIGN_ECDSA_WITH_SHA`,function(){return $e}),n.d(t,`EU_CTX_SIGN_DSTU4145_WITH_DSTU7564`,function(){return et}),n.d(t,`EndUserSignAlgo`,function(){return Ye}),n.d(t,`EU_SIGN_TYPE_PARAMETER`,function(){return nt}),n.d(t,`EU_USE_SLOGIN_PRIVATE_KEY`,function(){return rt}),n.d(t,`EU_FS_CALCULATE_FINGERPRINT`,function(){return it}),n.d(t,`EU_CHECK_PRIVATE_KEY_CONTEXT_PARAMETER`,function(){return at}),n.d(t,`EU_USE_SLOGIN_PRIVATE_KEY_CONTEXT_PARAMETER`,function(){return ot}),n.d(t,`EU_UA_OID_EXT_KEY_USAGE_STAMP`,function(){return st}),n.d(t,`EU_USER_INFO_VERSION`,function(){return ct}),n.d(t,`EndUserCMPCompatibility`,function(){return tt}),n.d(t,`EU_CTX_HASH_ALGO_UNKNOWN`,function(){return ut}),n.d(t,`EU_CTX_HASH_ALGO_GOST34311`,function(){return dt}),n.d(t,`EU_CTX_HASH_ALGO_SHA160`,function(){return ft}),n.d(t,`EU_CTX_HASH_ALGO_SHA224`,function(){return pt}),n.d(t,`EU_CTX_HASH_ALGO_SHA256`,function(){return mt}),n.d(t,`EU_CTX_HASH_ALGO_SHA384`,function(){return ht}),n.d(t,`EU_CTX_HASH_ALGO_SHA512`,function(){return gt}),n.d(t,`EU_CTX_HASH_ALGO_DSTU7564_256`,function(){return _t}),n.d(t,`EU_CTX_HASH_ALGO_DSTU7564_384`,function(){return vt}),n.d(t,`EU_CTX_HASH_ALGO_DSTU7564_512`,function(){return yt}),n.d(t,`EndUserHashAlgo`,function(){return lt}),n.d(t,`EU_ASIC_TYPE_UNKNOWN`,function(){return xt}),n.d(t,`EU_ASIC_TYPE_S`,function(){return St}),n.d(t,`EU_ASIC_TYPE_E`,function(){return Ct}),n.d(t,`EndUserASiCType`,function(){return bt}),n.d(t,`EU_ASIC_SIGN_TYPE_UNKNOWN`,function(){return Tt}),n.d(t,`EU_ASIC_SIGN_TYPE_CADES`,function(){return Et}),n.d(t,`EU_ASIC_SIGN_TYPE_XADES`,function(){return Dt}),n.d(t,`EndUserASiCSignType`,function(){return wt}),n.d(t,`EU_XADES_TYPE_UNKNOWN`,function(){return kt}),n.d(t,`EU_XADES_TYPE_DETACHED`,function(){return At}),n.d(t,`EU_XADES_TYPE_ENVELOPING`,function(){return jt}),n.d(t,`EU_XADES_TYPE_ENVELOPED`,function(){return Mt}),n.d(t,`EndUserXAdESType`,function(){return Ot}),n.d(t,`EU_XADES_SIGN_LEVEL_UNKNOWN`,function(){return Pt}),n.d(t,`EU_XADES_SIGN_LEVEL_B_B`,function(){return Ft}),n.d(t,`EU_XADES_SIGN_LEVEL_B_T`,function(){return It}),n.d(t,`EU_XADES_SIGN_LEVEL_B_LT`,function(){return Lt}),n.d(t,`EU_XADES_SIGN_LEVEL_B_LTA`,function(){return Rt}),n.d(t,`EndUserXAdESSignLevel`,function(){return Nt}),n.d(t,`EU_PADES_SIGN_LEVEL_UNKNOWN`,function(){return Vt}),n.d(t,`EU_PADES_SIGN_LEVEL_B_B`,function(){return Ht}),n.d(t,`EU_PADES_SIGN_LEVEL_B_T`,function(){return Ut}),n.d(t,`EU_PADES_SIGN_LEVEL_B_LT`,function(){return Wt}),n.d(t,`EU_PADES_SIGN_LEVEL_B_LTA`,function(){return Gt}),n.d(t,`EndUserPAdESSignLevel`,function(){return zt}),n.d(t,`EndUserEventType`,function(){return Bt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_UNKNOWN`,function(){return qt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_CADES`,function(){return Jt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_XADES`,function(){return Yt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_PADES`,function(){return Xt}),n.d(t,`EU_SIGN_CONTAINER_TYPE_ASIC`,function(){return Zt}),n.d(t,`EndUserSignContainerType`,function(){return Kt});var r,i=1,a=2,o=3;(function(e){e[e.JS=i]=`JS`,e[e.SW=a]=`SW`,e[e.MS=o]=`MS`})(r||={});var s,c=0,l=1,u=2,d=3,f=4;(function(e){e[e.Undifferenced=c]=`Undifferenced`,e[e.CA=l]=`CA`,e[e.CAServer=u]=`CAServer`,e[e.RAAdministrator=d]=`RAAdministrator`,e[e.EndUser=f]=`EndUser`})(s||={});var p,m=0,h=1,g=2,_=3;(function(e){e[e.Undifferenced=m]=`Undifferenced`,e[e.CMP=h]=`CMP`,e[e.TSP=g]=`TSP`,e[e.OCSP=_]=`OCSP`})(p||={});var v,y=0,b=1,x=2,S=4;(function(e){e[e.Unknown=y]=`Unknown`,e[e.DSTU4145=b]=`DSTU4145`,e[e.RSA=x]=`RSA`,e[e.ECDSA=S]=`ECDSA`})(v||={});var C,w=0,T=1,E=2,D=3,O=4,k=5,A=6,j=7,M=8,N=9;(function(e){e[e.Unknown=w]=`Unknown`,e[e.GOST34311=T]=`GOST34311`,e[e.SHA1=E]=`SHA1`,e[e.SHA224=D]=`SHA224`,e[e.SHA256=O]=`SHA256`,e[e.SHA384=k]=`SHA384`,e[e.SHA512=A]=`SHA512`,e[e.DSTU7564_256=j]=`DSTU7564_256`,e[e.DSTU7564_384=M]=`DSTU7564_384`,e[e.DSTU7564_512=N]=`DSTU7564_512`})(C||={});var P,F=0,I=1,L=2,R=16;(function(e){e[e.Unknown=y]=`Unknown`,e[e.DigitalSignature=I]=`DigitalSignature`,e[e.NonRepudation=L]=`NonRepudation`,e[e.KeyAgreement=R]=`KeyAgreement`})(P||={});var z,B=1,V=2;(function(e){e[e.Revoke=B]=`Revoke`,e[e.Hold=V]=`Hold`})(z||={});var H,U=0,W=1,G=2;(function(e){e[e.Unknown=U]=`Unknown`,e[e.KeyCompromise=W]=`KeyCompromise`,e[e.NewIssued=G]=`NewIssued`})(H||={});var K,q=0,J=1,ee=2,te=4,ne=8;(function(e){e[e.None=q]=`None`,e[e.DSTUAndECDHWithGOST=J]=`DSTUAndECDHWithGOST`,e[e.RSAWithSHA=ee]=`RSAWithSHA`,e[e.ECDSAWithSHA=te]=`ECDSAWithSHA`,e[e.DSTUAndECDHWithDSTU=ne]=`DSTUAndECDHWithDSTU`})(K||={});var Y,re=1,ie=2,X=3,Z=4,Q=5;(function(e){e[e.EC_191=re]=`EC_191`,e[e.EC_257=ie]=`EC_257`,e[e.EC_307=X]=`EC_307`,e[e.File=Z]=`File`,e[e.Cert=Q]=`Cert`})(Y||={});var $,ae=1,oe=2,se=3,ce=4,le=5;(function(e){e[e.EC_257=ae]=`EC_257`,e[e.EC_431=oe]=`EC_431`,e[e.EC_571=se]=`EC_571`,e[e.File=Z]=`File`,e[e.Cert=Q]=`Cert`})($||={});var ue,de=1,fe=2,pe=3,me=4,he=5,ge=6;(function(e){e[e.N_1024=de]=`N_1024`,e[e.N_2048=fe]=`N_2048`,e[e.N_3072=pe]=`N_3072`,e[e.N_4096=me]=`N_4096`,e[e.File=Z]=`File`,e[e.Cert=Q]=`Cert`})(ue||={});var _e,ve=1,ye=2,be=3,xe=4,Se=5,Ce=6;(function(e){e[e.EC_192=ve]=`EC_192`,e[e.EC_256=ye]=`EC_256`,e[e.EC_384=be]=`EC_384`,e[e.EC_521=xe]=`EC_521`,e[e.File=Se]=`File`,e[e.Cert=Ce]=`Cert`})(_e||={});var we,Te=1,Ee=2,De=3;(function(e){e[e.uaDS=Te]=`uaDS`,e[e.uaKEP=Ee]=`uaKEP`,e[e.intRSA=De]=`intRSA`})(we||={});var Oe,ke=1,Ae=2,je=3;(function(e){e[e.Kyivstar=ke]=`Kyivstar`,e[e.Vodafone=Ae]=`Vodafone`,e[e.Lifecell=je]=`Lifecell`})(Oe||={});var Me,Ne,Pe=4,Fe=5,Ie=6,Le=7;(function(e){e[e.Kyivstar=ke]=`Kyivstar`,e[e.Vodafone=Ae]=`Vodafone`,e[e.Lifecell=je]=`Lifecell`,e[e.IIT=Pe]=`IIT`,e[e.UKey=Fe]=`UKey`,e[e.PB=Ie]=`PB`,e[e.DIIA=Le]=`DIIA`})(Me||={}),function(e){e[e.Default=0]=`Default`,e[e.Name=1]=`Name`,e[e.Phone=2]=`Phone`,e[e.Email=3]=`Email`}(Ne||={});var Re,ze=0,Be=1,Ve=4,He=8,Ue=16,We=128;(function(e){e[e.Unknown=ze]=`Unknown`,e[e.CAdES_BES=Be]=`CAdES_BES`,e[e.CAdES_T=Ve]=`CAdES_T`,e[e.CAdES_C=He]=`CAdES_C`,e[e.CAdES_X_Long=Ue]=`CAdES_X_Long`,e[e.CAdES_X_Long_Trusted=We]=`CAdES_X_Long_Trusted`})(Re||={});var Ge,Ke=0,qe=1,Je=3;(function(e){e[e.Unknown=Ke]=`Unknown`,e[e.Detached=qe]=`Detached`,e[e.Enveloped=Je]=`Enveloped`})(Ge||={});var Ye,Xe=0,Ze=1,Qe=2,$e=3,et=4;(function(e){e[e.Unknown=Xe]=`Unknown`,e[e.DSTU4145WithGOST34311=Ze]=`DSTU4145WithGOST34311`,e[e.RSAWithSHA=Qe]=`RSAWithSHA`,e[e.ECDSAWithSHA=$e]=`ECDSAWithSHA`,e[e.DSTU4145WithDSTU7564=et]=`DSTU4145WithDSTU7564`})(Ye||={});var tt,nt=`SignType`,rt=`UseSLoginPrivateKey`,it=`FSCalculateFingerprint`,at=`CheckPrivateKey`,ot=`UseSLoginPrivateKey`,st=`1.2.804.2.1.1.1.3.9`,ct=3;(function(e){e[e.None=0]=`None`,e[e.DownloadEUCerts=1]=`DownloadEUCerts`,e[e.SearchEUCerts=2]=`SearchEUCerts`})(tt||={});var lt,ut=0,dt=1,ft=2,pt=3,mt=4,ht=5,gt=6,_t=7,vt=8,yt=9;(function(e){e[e.Unknown=ut]=`Unknown`,e[e.GOST34311=dt]=`GOST34311`,e[e.SHA160=ft]=`SHA160`,e[e.SHA224=pt]=`SHA224`,e[e.SHA256=mt]=`SHA256`,e[e.SHA384=ht]=`SHA384`,e[e.SHA512=gt]=`SHA512`,e[e.DSTU7564_256=_t]=`DSTU7564_256`,e[e.DSTU7564_384=vt]=`DSTU7564_384`,e[e.DSTU7564_512=yt]=`DSTU7564_512`})(lt||={});var bt,xt=0,St=1,Ct=2;(function(e){e[e.Unknown=xt]=`Unknown`,e[e.S=St]=`S`,e[e.E=Ct]=`E`})(bt||={});var wt,Tt=0,Et=1,Dt=2;(function(e){e[e.Unknown=Tt]=`Unknown`,e[e.CAdES=Et]=`CAdES`,e[e.XAdES=Dt]=`XAdES`})(wt||={});var Ot,kt=0,At=1,jt=2,Mt=3;(function(e){e[e.Unknown=kt]=`Unknown`,e[e.Detached=At]=`Detached`,e[e.Enveloping=jt]=`Enveloping`,e[e.Enveloped=Mt]=`Enveloped`})(Ot||={});var Nt,Pt=0,Ft=1,It=4,Lt=16,Rt=32;(function(e){e[e.Unknown=Pt]=`Unknown`,e[e.B_B=Ft]=`B_B`,e[e.B_T=It]=`B_T`,e[e.B_LT=Lt]=`B_LT`,e[e.B_LTA=Rt]=`B_LTA`})(Nt||={});var zt,Bt,Vt=0,Ht=1,Ut=4,Wt=16,Gt=32;(function(e){e[e.Unknown=Pt]=`Unknown`,e[e.B_B=Ht]=`B_B`,e[e.B_T=Ut]=`B_T`,e[e.B_LT=Wt]=`B_LT`,e[e.B_LTA=Gt]=`B_LTA`})(zt||={}),function(e){e[e.None=0]=`None`,e[e.All=1]=`All`,e[e.ConfirmKSPOperation=2]=`ConfirmKSPOperation`}(Bt||={});var Kt,qt=0,Jt=1,Yt=2,Xt=3,Zt=4;(function(e){e[e.Unknown=qt]=`Unknown`,e[e.CAdES=Jt]=`CAdES`,e[e.XAdES=Yt]=`XAdES`,e[e.PAdES=Xt]=`PAdES`,e[e.ASiC=Zt]=`ASiC`})(Kt||={})},function(e,t,n){"use strict";n.r(t),n.d(t,`EU_ERROR_NONE`,function(){return r}),n.d(t,`EU_ERROR_UNKNOWN`,function(){return i}),n.d(t,`EU_ERROR_NOT_SUPPORTED`,function(){return a}),n.d(t,`EU_ERROR_NOT_INITIALIZED`,function(){return o}),n.d(t,`EU_ERROR_BAD_PARAMETER`,function(){return s}),n.d(t,`EU_ERROR_LIBRARY_LOAD`,function(){return c}),n.d(t,`EU_ERROR_READ_SETTINGS`,function(){return l}),n.d(t,`EU_ERROR_TRANSMIT_REQUEST`,function(){return u}),n.d(t,`EU_ERROR_MEMORY_ALLOCATION`,function(){return d}),n.d(t,`EU_WARNING_END_OF_ENUM`,function(){return f}),n.d(t,`EU_ERROR_PROXY_NOT_AUTHORIZED`,function(){return p}),n.d(t,`EU_ERROR_NO_GUI_DIALOGS`,function(){return m}),n.d(t,`EU_ERROR_DOWNLOAD_FILE`,function(){return h}),n.d(t,`EU_ERROR_WRITE_SETTINGS`,function(){return g}),n.d(t,`EU_ERROR_CANCELED_BY_GUI`,function(){return _}),n.d(t,`EU_ERROR_OFFLINE_MODE`,function(){return v}),n.d(t,`EU_ERROR_KEY_MEDIAS_FAILED`,function(){return y}),n.d(t,`EU_ERROR_KEY_MEDIAS_ACCESS_FAILED`,function(){return b}),n.d(t,`EU_ERROR_KEY_MEDIAS_READ_FAILED`,function(){return x}),n.d(t,`EU_ERROR_KEY_MEDIAS_WRITE_FAILED`,function(){return S}),n.d(t,`EU_WARNING_KEY_MEDIAS_READ_ONLY`,function(){return C}),n.d(t,`EU_ERROR_KEY_MEDIAS_DELETE`,function(){return w}),n.d(t,`EU_ERROR_KEY_MEDIAS_CLEAR`,function(){return T}),n.d(t,`EU_ERROR_BAD_PRIVATE_KEY`,function(){return E}),n.d(t,`EU_ERROR_PKI_FORMATS_FAILED`,function(){return D}),n.d(t,`EU_ERROR_CSP_FAILED`,function(){return O}),n.d(t,`EU_ERROR_BAD_SIGNATURE`,function(){return k}),n.d(t,`EU_ERROR_AUTH_FAILED`,function(){return A}),n.d(t,`EU_ERROR_NOT_RECEIVER`,function(){return j}),n.d(t,`EU_ERROR_STORAGE_FAILED`,function(){return M}),n.d(t,`EU_ERROR_BAD_CERT`,function(){return N}),n.d(t,`EU_ERROR_CERT_NOT_FOUND`,function(){return P}),n.d(t,`EU_ERROR_INVALID_CERT_TIME`,function(){return F}),n.d(t,`EU_ERROR_CERT_IN_CRL`,function(){return I}),n.d(t,`EU_ERROR_BAD_CRL`,function(){return L}),n.d(t,`EU_ERROR_NO_VALID_CRLS`,function(){return R}),n.d(t,`EU_ERROR_GET_TIME_STAMP`,function(){return z}),n.d(t,`EU_ERROR_BAD_TSP_RESPONSE`,function(){return B}),n.d(t,`EU_ERROR_TSP_SERVER_CERT_NOT_FOUND`,function(){return V}),n.d(t,`EU_ERROR_TSP_SERVER_CERT_INVALID`,function(){return H}),n.d(t,`EU_ERROR_GET_OCSP_STATUS`,function(){return U}),n.d(t,`EU_ERROR_BAD_OCSP_RESPONSE`,function(){return W}),n.d(t,`EU_ERROR_CERT_BAD_BY_OCSP`,function(){return G}),n.d(t,`EU_ERROR_OCSP_SERVER_CERT_NOT_FOUND`,function(){return K}),n.d(t,`EU_ERROR_OCSP_SERVER_CERT_INVALID`,function(){return q}),n.d(t,`EU_ERROR_LDAP_ERROR`,function(){return J}),n.d(t,`EndUserError`,function(){return ee});var r=0,i=65535,a=65534,o=1,s=2,c=3,l=4,u=5,d=6,f=7,p=8,m=9,h=10,g=11,_=12,v=13,y=17,b=18,x=19,S=20,C=21,w=22,T=23,E=24,D=33,O=34,k=35,A=36,j=37,M=49,N=50,P=51,F=52,I=53,L=54,R=55,z=65,B=66,V=67,H=68,U=81,W=82,G=83,K=84,q=85,J=97,ee=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return o});var r=n(8),i=n(10),a=n(4),o=function(){function e(){}return e.MapFromKeyMedia=function(e,t){return t.SetTypeIndex(e.typeIndex),t.SetDevIndex(e.devIndex),t.SetPassword(e.user?`##`+e.user+`##`+e.password:e.password),t},e.MapToProxySettings=function(e,t){return t.useProxy=e.GetUseProxy(),t.address=e.GetAddress(),t.port=e.GetPort(),t.anonymous=e.GetAnonymous(),t.user=e.GetUser(),t.password=e.GetPassword(),t.savePassword=e.GetSavePassword(),t},e.MapFromProxySettings=function(e,t){return t.SetUseProxy(e.useProxy),t.SetAddress(e.address),t.SetPort(e.port),t.SetAnonymous(e.anonymous),t.SetUser(e.user),t.SetPassword(e.password),t.SetSavePassword(e.savePassword),t},e.MapEndUserOwnerInfo=function(e,t){return t.isFilled=e.IsFilled(),t.issuer=e.GetIssuer(),t.issuerCN=e.GetIssuerCN(),t.serial=e.GetSerial(),t.subject=e.GetSubject(),t.subjCN=e.GetSubjCN(),t.subjOrg=e.GetSubjOrg(),t.subjOrgUnit=e.GetSubjOrgUnit(),t.subjTitle=e.GetSubjTitle(),t.subjState=e.GetSubjState(),t.subjLocality=e.GetSubjLocality(),t.subjFullName=e.GetSubjFullName(),t.subjAddress=e.GetSubjAddress(),t.subjPhone=e.GetSubjPhone(),t.subjEMail=e.GetSubjEMail(),t.subjDNS=e.GetSubjDNS(),t.subjEDRPOUCode=e.GetSubjEDRPOUCode(),t.subjDRFOCode=e.GetSubjDRFOCode(),t},e.MapToEndUserCertificateInfoEx=function(e,t){return t.isFilled=e.IsFilled(),t.version=e.GetVersion(),t.issuer=e.GetIssuer(),t.issuerCN=e.GetIssuerCN(),t.serial=e.GetSerial(),t.subject=e.GetSubject(),t.subjCN=e.GetSubjCN(),t.subjOrg=e.GetSubjOrg(),t.subjOrgUnit=e.GetSubjOrgUnit(),t.subjTitle=e.GetSubjTitle(),t.subjState=e.GetSubjState(),t.subjLocality=e.GetSubjLocality(),t.subjFullName=e.GetSubjFullName(),t.subjAddress=e.GetSubjAddress(),t.subjPhone=e.GetSubjPhone(),t.subjEMail=e.GetSubjEMail(),t.subjDNS=e.GetSubjDNS(),t.subjEDRPOUCode=e.GetSubjEDRPOUCode(),t.subjDRFOCode=e.GetSubjDRFOCode(),t.subjNBUCode=e.GetSubjNBUCode(),t.subjSPFMCode=e.GetSubjSPFMCode(),t.subjOCode=e.GetSubjOCode(),t.subjOUCode=e.GetSubjOUCode(),t.subjUserCode=e.GetSubjUserCode(),t.certBeginTime=e.GetCertBeginTime(),t.certEndTime=e.GetCertEndTime(),t.isPrivKeyTimesAvail=e.IsPrivKeyTimesAvail(),t.privKeyBeginTime=e.GetPrivKeyBeginTime(),t.privKeyEndTime=e.GetPrivKeyEndTime(),t.publicKeyBits=e.GetPublicKeyBits(),t.publicKey=e.GetPublicKey(),t.publicKeyID=e.GetPublicKeyID(),t.issuerPublicKeyID=e.GetIssuerPublicKeyID(),t.keyUsage=e.GetKeyUsage(),t.extKeyUsages=e.GetExtKeyUsages(),t.policies=e.GetPolicies(),t.crlDistribPoint1=e.GetCRLDistribPoint1(),t.crlDistribPoint2=e.GetCRLDistribPoint2(),t.isPowerCert=e.IsPowerCert(),t.isSubjTypeAvail=e.IsSubjTypeAvail(),t.isSubjCA=e.IsSubjCA(),t.chainLength=e.GetChainLength(),t.UPN=e.GetUPN(),t.publicKeyType=e.GetPublicKeyType(),t.keyUsageType=e.GetKeyUsageType(),t.RSAModul=e.GetRSAModul(),t.RSAExponent=e.GetRSAExponent(),t.OCSPAccessInfo=e.GetOCSPAccessInfo(),t.issuerAccessInfo=e.GetIssuerAccessInfo(),t.TSPAccessInfo=e.GetTSPAccessInfo(),t.isLimitValueAvailable=e.IsLimitValueAvail(),t.limitValue=e.GetLimitValue(),t.limitValueCurrency=e.GetLimitValueCurrency(),t.subjType=e.GetSubjType(),t.subjSubType=e.GetSubjSubType(),t.subjUNZR=e.GetSubjUNZR(),t.subjCountry=e.GetSubjCountry(),t.fingerprint=e.GetFingerprint(),t.isQSCD=e.IsQSCD(),t.subjUserID=e.GetSubjUserID(),t.certHashType=e.GetCertHashType(),t},e.MapToEndUserParams=function(e,t){return t.SN=e.GetSN(),t.commonName=e.GetCommonName(),t.locality=e.GetLocality(),t.state=e.GetState(),t.organization=e.GetOrganization(),t.orgUnit=e.GetOrgUnit(),t.title=e.GetTitle(),t.street=e.GetStreet(),t.phone=e.GetPhone(),t.surname=e.GetSurname(),t.givenname=e.GetGivenname(),t.EMail=e.GetEMail(),t.DNS=e.GetDNS(),t.EDRPOUCode=e.GetEDRPOUCode(),t.DRFOCode=e.GetDRFOCode(),t.NBUCode=e.GetNBUCode(),t.SPFMCode=e.GetSPFMCode(),t.information=e.GetInformation(),t.passPhrase=e.GetPassPhrase(),t.isPublishCertificate=e.GetIsPublishCertificate(),t.RAAdminSN=e.GetRAAdminSN(),t},e.MapToEndUserTimeInfo=function(e,t){return t.version=e.GetVersion(),t.isTimeAvail=e.IsTimeAvail(),t.isTimeStamp=e.IsTimeStamp(),t.time=e.GetTime(),t.isSignTimeStampAvail=e.IsSignTimeStampAvail(),t.signTimeStamp=e.GetSignTimeStamp(),t},e.MapToEndUserSignInfo=function(t,n){return n.ownerInfo=e.MapEndUserOwnerInfo(t.GetOwnerInfo(),new i.a),n.timeInfo=e.MapToEndUserTimeInfo(t.GetTimeInfo(),new a.EndUserTimeInfo),n.data=t.GetData(),n.signLevel=0,n},e.MapToEndUserSenderInfo=function(t,n){return n.ownerInfo=e.MapEndUserOwnerInfo(t.GetOwnerInfo(),new i.a),n.timeInfo=e.MapToEndUserTimeInfo(t.GetTimeInfo(),new a.EndUserTimeInfo),n.data=t.GetData(),n},e.MapToEndUserCertificate=function(t,n){return n.data=t.GetData(),n.infoEx=e.MapToEndUserCertificateInfoEx(t.GetInfoEx(),new r.a),n},e.MapFromEndUserInfo=function(e,t){return t.SetCommonName(e.commonName),t.SetLocality(e.locality),t.SetState(e.state),t.SetOrganization(e.organization),t.SetOrgUnit(e.orgUnit),t.SetTitle(e.title),t.SetStreet(e.street),t.SetPhone(e.phone),t.SetSurname(e.surname),t.SetGivenname(e.givenname),t.SetEMail(e.EMail),t.SetDNS(e.DNS),t.SetEDRPOUCode(e.EDRPOUCode),t.SetDRFOCode(e.DRFOCode),t.SetNBUCode(e.NBUCode),t.SetSPFMCode(e.SPFMCode),t.SetOCode(e.OCode),t.SetOUCode(e.OUCode),t.SetUserCode(e.userCode),t.SetUPN(e.UPN),t.SetUNZR(e.UNZR),t.SetCountry(e.country),t},e.MapToEndUserRequestInfo=function(e,t){return t.isFilled=!0,t.data=e.GetRequest(),t.type=e.GetRequestType(),t.fileName=e.GetDefaultRequestFileName(),t.isSimple=e.IsSimple(),t.subject=e.GetSubject(),t.subjCN=e.GetSubjCN(),t.subjOrg=e.GetSubjOrg(),t.subjOrgUnit=e.GetSubjOrgUnit(),t.subjTitle=e.GetSubjTitle(),t.subjState=e.GetSubjState(),t.subjLocality=e.GetSubjLocality(),t.subjFullName=e.GetSubjFullName(),t.subjAddress=e.GetSubjAddress(),t.subjPhone=e.GetSubjPhone(),t.subjEMail=e.GetSubjEMail(),t.subjDNS=e.GetSubjDNS(),t.subjEDRPOUCode=e.GetSubjEDRPOUCode(),t.subjDRFOCode=e.GetSubjDRFOCode(),t.subjNBUCode=e.GetSubjNBUCode(),t.subjSPFMCode=e.GetSubjSPFMCode(),t.subjOCode=e.GetSubjOCode(),t.subjOUCode=e.GetSubjOUCode(),t.subjUserCode=e.GetSubjUserCode(),t.certBeginTime=e.GetCertBeginTime(),t.certEndTime=e.GetCertEndTime(),t.isPrivKeyTimesAvail=e.IsPrivKeyTimesAvail(),t.privKeyBeginTime=e.GetPrivKeyBeginTime(),t.privKeyEndTime=e.GetPrivKeyEndTime(),t.publicKeyType=e.GetPublicKeyType(),t.publicKeyBits=e.GetPublicKeyBits(),t.RSAModul=e.GetRSAModul(),t.RSAExponent=e.GetRSAExponent(),t.publicKey=e.GetPublicKey(),t.publicKeyID=e.GetPublicKeyID(),t.extKeyUsages=e.GetExtKeyUsages(),t.crlDistribPoint1=e.GetCRLDistribPoint1(),t.crlDistribPoint2=e.GetCRLDistribPoint2(),t.isSubjTypeAvail=e.IsSubjTypeAvail(),t.subjType=e.GetSubjType(),t.subjSubType=e.GetSubjSubType(),t.isSelfSigned=e.IsSelfSigned(),t.signIssuer=e.GetSignIssuer(),t.signSerial=e.GetSignSerial(),t.subjUNZR=e.GetSubjUNZR(),t.subjCountry=e.GetSubjCountry(),t.isQSCD=e.IsQSCD(),t},e.MapToEndUserReference=function(e,t){return t.name=e.GetName(),t.val=e.GetData(),t},e.MapFromEndUserReference=function(e,t){return t.SetName(e.name),t.SetData(e.val),t},e.MapToEndUserSession=function(e,t){return t.handle=e.GetHandle(),t.data=e.GetData(),t},e.MapFromEndUserSession=function(e,t){return t.SetHandle(e.handle),t.SetData(e.data),t},e}()},function(e,t,n){var r,i=[],a;(a=typeof(r=function(){var e=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserUTF8Coder`};e.prototype.encode=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},e.prototype.decode=function(e){for(var t,n,r,i=[],a=0,o=0;a<e.length;)(t=e[a++])<128?i[o++]=String.fromCharCode(t):t>191&&t<224?(n=e[a++],i[o++]=String.fromCharCode((31&t)<<6|63&n)):(n=e[a++],r=e[a++],i[o++]=String.fromCharCode((15&t)<<12|(63&n)<<6|63&r));return i.join(``)};var t=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserUTF16LECoder`};t.prototype.encode=function(e){for(var t,n=[],r=0;r<e.length;r++)t=e.charCodeAt(r),n.push(255&t),n.push((65280&t)>>8);return n},t.prototype.decode=function(e){var t,n=0,r=``;if(e.length%2!=0)return null;for((t=e.length)>0&&e[t-2]==0&&e[t-1]==0&&(t-=2);n<t;)r+=String.fromCharCode(e[n]|e[n+1]<<8),n+=2;return r};var n=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserCP1251Coder`,this.m_cp1251_table={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,10:10,11:11,12:12,13:13,14:14,15:15,16:16,17:17,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,30:30,31:31,32:32,33:33,34:34,35:35,36:36,37:37,38:38,39:39,40:40,41:41,42:42,43:43,44:44,45:45,46:46,47:47,48:48,49:49,50:50,51:51,52:52,53:53,54:54,55:55,56:56,57:57,58:58,59:59,60:60,61:61,62:62,63:63,64:64,65:65,66:66,67:67,68:68,69:69,70:70,71:71,72:72,73:73,74:74,75:75,76:76,77:77,78:78,79:79,80:80,81:81,82:82,83:83,84:84,85:85,86:86,87:87,88:88,89:89,90:90,91:91,92:92,93:93,94:94,95:95,96:96,97:97,98:98,99:99,100:100,101:101,102:102,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,125:125,126:126,127:127,1027:129,8225:135,1046:198,8222:132,1047:199,1168:165,1048:200,1113:154,1049:201,1045:197,1050:202,1028:170,160:160,1040:192,1051:203,164:164,166:166,167:167,169:169,171:171,172:172,173:173,174:174,1053:205,176:176,177:177,1114:156,181:181,182:182,183:183,8221:148,187:187,1029:189,1056:208,1057:209,1058:210,8364:136,1112:188,1115:158,1059:211,1060:212,1030:178,1061:213,1062:214,1063:215,1116:157,1064:216,1065:217,1031:175,1066:218,1067:219,1068:220,1069:221,1070:222,1032:163,8226:149,1071:223,1072:224,8482:153,1073:225,8240:137,1118:162,1074:226,1110:179,8230:133,1075:227,1033:138,1076:228,1077:229,8211:150,1078:230,1119:159,1079:231,1042:194,1080:232,1034:140,1025:168,1081:233,1082:234,8212:151,1083:235,1169:180,1084:236,1052:204,1085:237,1035:142,1086:238,1087:239,1088:240,1089:241,1090:242,1036:141,1041:193,1091:243,1092:244,8224:134,1093:245,8470:185,1094:246,1054:206,1095:247,1096:248,8249:139,1097:249,1098:250,1044:196,1099:251,1111:191,1055:207,1100:252,1038:161,8220:147,1101:253,8250:155,1102:254,8216:145,1103:255,1043:195,1105:184,1039:143,1026:128,1106:144,8218:130,1107:131,8217:146,1108:186,1109:190},this.m_ut8_table=unescape(`%u0402%u0403%u201A%u0453%u201E%u2026%u2020%u2021%u20AC%u2030%u0409%u2039%u040A%u040C%u040B%u040F%u0452%u2018%u2019%u201C%u201D%u2022%u2013%u2014%u0000%u2122%u0459%u203A%u045A%u045C%u045B%u045F%u00A0%u040E%u045E%u0408%u00A4%u0490%u00A6%u00A7%u0401%u00A9%u0404%u00AB%u00AC%u00AD%u00AE%u0407%u00B0%u00B1%u0406%u0456%u0491%u00B5%u00B6%u00B7%u0451%u2116%u0454%u00BB%u0458%u0405%u0455%u0457`)};n.prototype.encode=function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(!(r in this.m_cp1251_table))throw`Character `+e.charAt(n)+` isn't supported by win1251!`;t.push(this.m_cp1251_table[r])}return t},n.prototype.decode=function(e){for(var t,n=``,r=0;r<e.length;r++)n+=(t=e[r])>=192&&t<=255?String.fromCharCode(t-192+1040):t>=128&&t<=191?this.m_ut8_table.charAt(t-128):String.fromCharCode(t);return n};var r={GetCoder:function(r){switch(r=r.toUpperCase()){case`UTF-8`:return new e;case`UTF-16LE`:return new t;case`WINDOWS-1251`:return new n;default:return null}},ArrayToString:function(e,t){var n,i;if(e===void 0&&(e=`UTF-8`),(n=r.GetCoder(e))==null)throw new Q(i=Z.ERROR_BAD_PARAMETER,Z.getErrorDescriptionEx(i,0));return n.decode(t)}},i=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserDateCoder`,this.dateDelimeter=`.`,this.timeDelimeter=`:`,this.dateTimeDelimeter=` `,this.format=`dd.MM.yyyy HH:mm:ss`};i.prototype.encode=function(e){var t=e.getDate(),n=e.getMonth()+1,r=e.getFullYear(),i=e.getHours(),a=e.getMinutes(),o=e.getSeconds();return t+this.dateDelimeter+n+this.dateDelimeter+r+this.dateTimeDelimeter+i+this.timeDelimeter+a+this.timeDelimeter+o},i.prototype.decode=function(e){try{var t=e.split(this.dateTimeDelimeter),n=t[0].split(this.dateDelimeter),r=t[1].split(this.timeDelimeter),i=parseInt(n[0]),a=parseInt(n[1])-1,o=parseInt(n[2]);if(i<0||i>31||a<0||a>12||o<0)return null;var s=parseInt(r[0]),c=parseInt(r[1]),l=parseInt(r[2]);return s<0||s>23||c<0||c>59||l<0||l>59?null:new Date(o,a,i,s,c,l,0)}catch{return null}};var a=function(){this.vendor=`JSC IIT`,this.classVersion=1,this.className=`EndUserBase64Coder`,this.m_map=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,this.m_codes=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47]};a.prototype._getTextDecoder=function(){try{if(typeof TextDecoder>`u`)return null;var e=new TextDecoder(`utf-8`);return e.encoding==`utf-8`?e:null}catch{return null}},a.prototype._encodePart=function(e,t,n){for(var r,i,a=[],o=t;o<n;o+=3)r=e[o]<<16|e[o+1]<<8|e[o+2],i=this.m_map[r>>18&63]+this.m_map[r>>12&63]+this.m_map[r>>6&63]+this.m_map[63&r],a.push(i);return a.join(``)},a.prototype.encode=function(e){var t,n,r,i,a,o,s=``;if((a=(t=typeof Uint8Array>`u`?p===void 0?e.slice(0):new p(e):new Uint8Array(e)).length)==0)return``;var c=this._getTextDecoder();if(c!=null){for(o=new Uint8Array(4*parseInt((a+2)/3)),n=0,r=0;n<a-a%3;n+=3,r+=4)i=t[n]<<16|t[n+1]<<8|t[n+2],o[r]=this.m_codes[i>>18&63],o[r+1]=this.m_codes[i>>12&63],o[r+2]=this.m_codes[i>>6&63],o[r+3]=this.m_codes[63&i];switch(a%3){case 1:i=t[n]<<16,o[r]=this.m_codes[i>>18&63],o[r+1]=this.m_codes[i>>12&63],o[r+2]=61,o[r+3]=61;break;case 2:i=t[n]<<16|t[n+1]<<8,o[r]=this.m_codes[i>>18&63],o[r+1]=this.m_codes[i>>12&63],o[r+2]=this.m_codes[i>>6&63],o[r+3]=61}s=c.decode(o)}else{var l,u=null,d=a-a%3,f=parseInt(d/15360);for(o=[],n=0;n<f;n++)u=this._encodePart(t,15360*n,15360*n+15360),o.push(u);switch(15360*f<d&&(u=this._encodePart(t,15360*n,d),o.push(u)),a%3){case 1:i=t[a-1]<<16,l=this.m_map[i>>18&63],l+=this.m_map[i>>12&63],l+=`=`,l+=`=`,o.push(l);break;case 2:i=t[a-2]<<16|t[a-1]<<8,l=this.m_map[i>>18&63],l+=this.m_map[i>>12&63],l+=this.m_map[i>>6&63],l+=`=`,o.push(l)}s=o.join(``)}return s},a.prototype.decode=function(e){var t,n,r,i,a,o,s,c,l,u,d;if(e==``||(3&e.length)>0)return typeof Uint8Array>`u`?p===void 0?[]:new p(0):new Uint8Array;for(n=(o=e.length)/4*3-(s=e[o-1]==`=`?e[o-2]==`=`?2:1:0),t=typeof Uint8Array>`u`?p===void 0?[]:new p(n):new Uint8Array(n),r=0,i=0,a=0;r<Math.floor((o-s)/4);r++)c=this.m_map.indexOf(e[i++]),l=this.m_map.indexOf(e[i++]),u=this.m_map.indexOf(e[i++]),d=this.m_map.indexOf(e[i++]),t[a++]=c<<2|l>>4,t[a++]=(15&l)<<4|u>>2,t[a++]=(3&u)<<6|63&d;switch(s){case 2:c=this.m_map.indexOf(e[i]),l=this.m_map.indexOf(e[i+1]),t[a++]=c<<2|l>>4;break;case 1:c=this.m_map.indexOf(e[i]),l=this.m_map.indexOf(e[i+1]),u=this.m_map.indexOf(e[i+2]),t[a++]=c<<2|l>>4,t[a++]=(15&l)<<4|u>>2}return t};var o=function(e){return new function(){var t=this,n=function(){var e;t.deferred.length&&((e=[].slice.call(arguments)).unshift(n),t.deferred[0].apply(t,e),t.deferred.shift())};this.deferred=[],this.eu_wait=function(e){return this.deferred.push(e),t},e(n)}},s=function(){var e=this._getBrowserInfo();this.m_name=e.name,this.m_version=e.version,this.m_arch=this._getArch(),this.m_os_name=this._getOSName()};s.BROWSER_NAME_IE=`IE`,s.BROWSER_NAME_OPERA=`Opera`,s.BROWSER_NAME_CHROME=`Chrome`,s.BROWSER_NAME_FIREFOX=`Firefox`,s.BROWSER_NAME_SAFARI=`Safari`,s.BROWSER_NAME_EDGE=`Edge`,s.BROWSER_NAME_EU_SIGN_AGENT=`EUSignAgent`,s.BROWSER_NAME_UNKNOWN=`Unknown`,s.OS_NAME_WINDOWS=`Windows`,s.OS_NAME_LINUX=`Linux`,s.OS_NAME_UNIX=`Unix`,s.OS_NAME_MAC=`Mac OS X`,s.OS_NAME_ANDROID=`Android`,s.OS_NAME_IOS=`iOS`,s.OS_NAME_UNKNOWN=`Unknown`,s.BROWSER_ARCH_NAME_X86=`x86`,s.BROWSER_ARCH_NAME_X64=`x64`,s.BROWSER_ARCH_NAME_ARM=`arm`,s.BROWSER_ARCH_NAME_UNKNOWN=`Unknown`,s.prototype._getBrowserInfo=function(){var e,t={name:s.BROWSER_NAME_UNKNOWN,version:``},n=navigator.userAgent,r=n.match(/(opera|chrome|safari|firefox|msie|trident|eusignagent(?=\/))\/?\s*(\d+)/i)||[];return/msie/i.test(r[1])||/trident/i.test(r[1])?(t.name=s.BROWSER_NAME_IE,/msie/i.test(r[1])?t.version=parseInt(r[2]):(e=/\brv[ :]+(\d+)/g.exec(n)||[],t.version=parseInt(e[1])),t):r[1]===`Chrome`&&(e=n.match(/\b(OPR|Edge)\/(\d+)/))!=null?(t.name=e[1].replace(`OPR`,s.BROWSER_NAME_OPERA),t.version=parseInt(e[2]),t):(r=r[2]?[r[1],r[2]]:[navigator.appName,navigator.appVersion,`-?`],(e=n.match(/version\/(\d+)/i))!=null&&r.splice(1,1,e[1]),t.name=r[0],t.version=parseInt(r[1]),t)},s.prototype._getOSName=function(){var e=navigator.platform||``,t=(navigator.userAgent||``).toLowerCase(),n=navigator.userAgentData||[];return e.indexOf(`Win`)==-1?e.indexOf(`iPad`)!=-1||e.indexOf(`iPhone`)!=-1||e.indexOf(`iPod`)!=-1||e.indexOf(`Android`)!=-1||t.includes(`Mac`)&&`ontouchend`in document?s.OS_NAME_IOS:e.indexOf(`Mac`)==-1?e.indexOf(`Android`)!=-1||t.indexOf(`android`)!=-1||n.platform==`Android`||e.indexOf(`Linux`)!=-1&&navigator.maxTouchPoints&&navigator.maxTouchPoints>1?s.OS_NAME_ANDROID:e.indexOf(`Linux`)==-1?e.indexOf(`FreeBSD`)==-1?s.OS_NAME_UNKNOWN:s.OS_NAME_UNIX:s.OS_NAME_LINUX:s.OS_NAME_MAC:s.OS_NAME_WINDOWS},s.prototype._getArch=function(){var e,t=navigator.platform||``;switch(this._getOSName()){case s.OS_NAME_WINDOWS:e=t.indexOf(`Win32`)==-1?s.BROWSER_ARCH_NAME_X64:s.BROWSER_ARCH_NAME_X86;break;case s.OS_NAME_MAC:e=t.indexOf(`MacIntel`)==-1?s.BROWSER_ARCH_NAME_X64:s.BROWSER_ARCH_NAME_X86;break;case s.OS_NAME_IOS:e=s.BROWSER_ARCH_NAME_ARM;break;case s.OS_NAME_UNIX:case s.OS_NAME_LINUX:case s.OS_NAME_ANDROID:e=t.indexOf(`armv`)==-1?t.indexOf(`x86_64`)==-1?s.BROWSER_ARCH_NAME_X86:s.BROWSER_ARCH_NAME_X64:s.BROWSER_ARCH_NAME_ARM;break;default:e=s.BROWSER_ARCH_NAME_UNKNOWN}return e},s.prototype.GetName=function(){return this.m_name},s.prototype.GetVersion=function(){return this.m_version},s.prototype.GetArch=function(){return this.m_arch},s.prototype.GetOSName=function(){return this.m_os_name};var c=[];c[0]=`Executed successfully`,c[-1]=`Unknown error`,c[-32300]=`Transport error`,c[-32400]=`System error`,c[-32500]=`Application error`,c[-32510]=`Application error. Invalid session`,c[-32600]=`Server error. Invalid rpc. Not conforming to spec`,c[-32601]=`Server error. Requested method not found`,c[-32602]=`Server error. Invalid method parameters`,c[-32603]=`Server error. Internal rpc error`,c[-32700]=`Parse error. Not well formed`,c[-32701]=`Parse error. Unsupported encoding`,c[-32702]=`Parse error. Invalid character for encoding`;var l=function(e,t,n,r){switch(this.Vendor=`JSC IIT`,this.ClassVersion=`1.0.2`,this.ClassName=`JSONRPCClient`,this.m_type=e,this.m_log=!1,this._logFunction(`Initialize`,arguments,[`type`,`address`,`port`,`useHttps`]),e){case 2:this.m_uri=t,this.m_callbacks=[],this._registerOnExtensionRecieveEventHandler();break;case 3:case 4:this.m_uri=t,this.m_callbacks=[];break;default:this.m_uri=``,r&&t.indexOf(`https://`)?this.m_uri+=`https://`:t.indexOf(`http://`)!=0&&(this.m_uri+=`http://`),this.m_uri+=t+`:`+n}this.m_requests=0,this.m_session_id=this._loadSessionId()};l.prototype._logFunction=function(e,t,n){if(this.m_log){for(var r=`(`,i=0;i<t.length;i++)r+=n[i]+`: `+t[i].toString(),i!=t.length-1&&(r+=`, `);r+=`)`,this._log(e,r)}},l.prototype._log=function(e,t){this.m_log&&console.log(e+`: `+t)},l.prototype._loadSessionId=function(){try{var e=sessionStorage.getItem(this.ClassName+`session_id`);return e===void 0||e==null||e==``?null:e}catch{return null}},l.prototype._saveSessionId=function(e){try{sessionStorage.setItem(this.ClassName+`session_id`,e)}catch{}},l.prototype._removeSessionId=function(){try{sessionStorage.removeItem(this.ClassName+`session_id`)}catch{}},l.prototype.createXMLHttpRequest=function(){return typeof XMLHttpRequest>`u`&&(XMLHttpRequest=function(){try{return new ActiveXObject(`Msxml2.XMLHTTP.6.0`)}catch{}try{return new ActiveXObject(`Msxml2.XMLHTTP.3.0`)}catch{}try{return new ActiveXObject(`Msxml2.XMLHTTP`)}catch{}try{return new ActiveXObject(`Microsoft.XMLHTTP`)}catch{}throw c[-32300]}),new XMLHttpRequest},l.prototype.makeRequest=function(e,t,n){var r=null;try{(r={}).jsonrpc=`2.0`,r.id=n,r.method=e,r.params=t,r.session_id=this.m_session_id,r=JSON.stringify(r)}catch{}return r},l.prototype.verifyResponse=function(e,t){try{if(t.jsonrpc!=`2.0`)return!1;var n=t.error;if(n===void 0){if(t.id!=e||t.result===void 0)return!1}else if(n.code===void 0||n.message===void 0||n.code!=0)return!1;if(t.session_id!==void 0){if(this.m_session_id!=null&&t.session_id!=null){if(this.m_session_id!=t.session_id)return!1}else this.m_session_id=t.session_id,this._saveSessionId(this.m_session_id)}return!0}catch{return!1}},l.prototype.handleResponse=function(e,t){try{return t=JSON.parse(t),this.verifyResponse(e,t)?t:(this.m_session_id=null,this._removeSessionId(),null)}catch{return null}},l.prototype._sendHttp=function(e,t,n){var r,i,a=this;try{return(r=this.createXMLHttpRequest()).open(`POST`,this.m_uri,n!=null),r.setRequestHeader(`Content-Type`,`application/json-rpc`),n!=null&&(r.onload=function(){r.status==200?(i=a.handleResponse(t,r.response),n(i==null?null:i.result)):n(null)},r.onerror=function(){n(null)}),r.send(e),n==null?r.status!=200||(i=this.handleResponse(t,r.response))==null?null:i.result:void 0}catch{if(n==null)return null;n(null)}},l.prototype._registerOnExtensionRecieveEventHandler=function(){var e=this;window.addEventListener(`message`,function(t){if(t.data.sender==e.m_uri)try{var n=t.data.callback_id,r=e.m_callbacks[n-1];delete e.m_callbacks[n-1],e._logFunction(`_registerOnExtensionRecieveEventHandler`,[r.request_id,t.data.data],[`request_id`,`data`]);var i=e.handleResponse(r.request_id,t.data.data);if(i==null)return void r.callback(null);r.callback(i.result)}catch{}},!1)},l.prototype._sendExtension=function(e,t,n){var r=this;if(r._logFunction(`_sendExtension`,[arguments[0],arguments[1]],[`request`,`request_id`]),!n)throw`Synchronous calls for web extensions not supported`;if(document.getElementsByClassName(r.m_uri).length==1)try{var i={request_id:t,callback:n},a=r.m_callbacks.push(i),o={sender:r.ClassName,request:e,callback_id:a};window.postMessage(o,`*`)}catch{n(null)}else n(null)},l.prototype._getPluginObject=function(){try{for(var e=document.getElementsByTagName(`object`),t=0;t<e.length;t++){var n=e[t].classid;if(!n&&e[t].attributes&&e[t].attributes.classid&&(n=e[t].attributes.classid.value),n===this.m_uri)return e[t]}return null}catch{return null}},l.prototype._sendPlugin=function(e,t,n){var i,o=this;o._logFunction(`_sendPlugin`,[arguments[0],arguments[1]],[`request`,`request_id`]);var s=o._getPluginObject();if(s==null)return n?.(null),null;var c=function(e){try{for(var t=new a,n=new p(0);;){var i=s.ProcessData(e),o=i.slice(0,5),c=i.slice(5,i.length-1);if(c!=null||c!=``){var l=t.decode(c),u=new p(n.length+l.length);u.set(n),u.set(l,n.length),n=u}switch(o){case`"part`:e=`"next"`;continue;case`"last`:return r.ArrayToString(`UTF-8`,n);default:return null}}}catch{return null}};try{return n==null?(i=c(e),(i=o.handleResponse(t,i))==null?null:i.result):void setTimeout(function(){i=c(e),o._logFunction(`_sendPlugin`,[t,i],[`request_id`,`response`]),(i=o.handleResponse(t,i))==null?n(null):n(i.result)},1)}catch{n(null)}},l.prototype.send=function(e,t,n){switch(this.m_type){case 1:return this._sendHttp(e,t,n);case 2:return this._sendExtension(e,t,n);case 3:case 4:return this._sendPlugin(e,t,n)}},l.prototype.execute=function(e,t,n){var r,i;return r=this.m_requests,this.m_requests++,(i=this.makeRequest(e,t,r))==null?n==null?null:void n(null):n==null?this.send(i,r,n):void this.send(i,r,n)};var u=function(){};u.WEB_LIBRARY_OS_NOT_SUPPORTED=131072,u.WEB_LIBRARY_NOT_INSTALLED_OR_RUN=131073,u.WEB_LIBRARY_JAVA_APPLET_NOT_LOADED=131074,u.WEB_LIBRARY_INSTALLED_VERSION_NOT_SUPPORTED=131075,u.WEB_LIBRARY_INSTALL_PACKAGE=131076,u.WEB_LIBRARY_UPDATE_PACKAGE=131077,u.WEB_LIBRARY_USER_MANUAL=131078,u.WEB_LIBRARY_WEB_EXTENSION_INSTALL_PACKAGE=131079,u.WEB_LIBRARY_CHECK_JRE_VERSION=131080,u.WEB_LIBRARY_WEB_EXTENSION_NOT_INSTALLED_OR_RUN=131081,(u.DESCRIPTIONS=[])[u.WEB_LIBRARY_OS_NOT_SUPPORTED]=[`Інсталяційний пакет web-бібліотеки підпису для вашої системи відсутній`,`Инсталяционный пакет web-библиотеки подписи для вашей системы отсутствует`,`The installation package of the library for the web signature for your system is absent`],u.DESCRIPTIONS[u.WEB_LIBRARY_NOT_INSTALLED_OR_RUN]=[`Бібліотеку web-підпису не запущено або не інстальовано у системі. Для продовження необхідно запустити або інсталювати бібліотеку web-підпису.`,`Библиотеку web-подписи не запущено или не установлено в системе. Для продолжения необходимо запустить или установить библиотеку web-подписи.`,`The library for the web signature isn't started or not installed in system. To continue, it is necessary to start or install library for the web signature.`],u.DESCRIPTIONS[u.WEB_LIBRARY_INSTALLED_VERSION_NOT_SUPPORTED]=[`Інстальована версія web-бібліотеки підпису більше не підтримується. Для продовження необхідно інсталювати оновлену версію web-бібліотеки підпису.`,`Инсталированная версия web-библиотеки подписи больше не поддерживается. Для продолжения необходимо установить обновленную версию web-библиотеки подписи.`,`The installed version of library for the web signature isn't supported any more. To continue, it is necessary to install the updated version of the library for the web signature.`],u.DESCRIPTIONS[u.WEB_LIBRARY_JAVA_APPLET_NOT_LOADED]=[`Java-апплет не завантажено. Необхідно перевірити версію JRE`,`Java-апплет не загружен. Необходимо проверить версию JRE`,`Java applet isn't loaded. It is necessary to check the version of JRE`],u.DESCRIPTIONS[u.WEB_LIBRARY_INSTALL_PACKAGE]=[`Інсталяційний пакет web-бібліотеки підпису`,`Инсталяционный пакет web-библиотеки подписи`,`Install package of library for the web signature`],u.DESCRIPTIONS[u.WEB_LIBRARY_UPDATE_PACKAGE]=[`Оновлення web-бібліотеки підпису`,`Обновление web-библиотеки подписи`,`Update of library for the web signature`],u.DESCRIPTIONS[u.WEB_LIBRARY_USER_MANUAL]=[`Настанова користувача`,`Руководство пользователя`,`User manual`],u.DESCRIPTIONS[u.WEB_LIBRARY_WEB_EXTENSION_INSTALL_PACKAGE]=[`Інсталяційний пакет бібліотеки підпису (web-розширення)`,`Инсталяционный пакет библиотеки подписи (web-расширение)`,`Install package of library for the web signature (web-extension)`],u.DESCRIPTIONS[u.WEB_LIBRARY_CHECK_JRE_VERSION]=[`Перевірити версію JRE`,`Проверить версию JRE`,`Check JRE version`],u.DESCRIPTIONS[u.WEB_LIBRARY_WEB_EXTENSION_NOT_INSTALLED_OR_RUN]=[`Веб-розширення для роботи бібліотеки web-підпису не запущено або не інстальовано в браузері. Для продовження необхідно запустити або інсталювати веб-розширення.`,`Веб-расширение для работы библиотеки web-подписи не запущено или не установлено в браузере. Для продолжения необходимо запустить или установить веб-расширение.`,`The web extension for the web signature library is not running or installed in the browser. To continue, you need to run or install the web extension.`],u.getString=function(e,t){var n,r;return(n=u.DESCRIPTIONS[e])===void 0&&(n=``),(r=n[t-1])===void 0?n[0]:r};var d=function(e,t,n,r,i){switch(this.m_id=t,this.m_library=null,this.m_language=n,this.m_supportedLibraryTypes=[],this.m_supportedLibraryTypesIndex=0,this.m_noJavaApplet=!1|r,this.m_webExtensionFirst=!1|i,this.m_errorResult=null,e){case d.LIBRARY_TYPE_JAVA_APPLET:case d.LIBRARY_TYPE_SIGN_AGENT:case d.LIBRARY_TYPE_WEB_EXTENSION:case d.LIBRARY_TYPE_NPAPI:case d.LIBRARY_TYPE_ACTIVE_X:this.m_libraryType=e;break;default:this.m_libraryType=d.LIBRARY_TYPE_DEFAULT}this.m_libraryType==d.LIBRARY_TYPE_DEFAULT?(this.m_webExtensionFirst&&d.isWebExtensionSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_WEB_EXTENSION),d.isSignAgentSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_SIGN_AGENT),!this.m_webExtensionFirst&&d.isWebExtensionSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_WEB_EXTENSION),d.isNPAPISupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_NPAPI),d.isActiveXSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_ACTIVE_X),!this.m_noJavaApplet&&d.isJavaAppletSupported()&&this.m_supportedLibraryTypes.push(d.LIBRARY_TYPE_JAVA_APPLET)):this.m_supportedLibraryTypes.push(this.m_libraryType),this.onload=function(e){},this.onerror=function(e,t,n){},this.getLibraryType=function(){return this.m_libraryType}};d.LIBRARY_TYPE_DEFAULT=0,d.LIBRARY_TYPE_JAVA_APPLET=1,d.LIBRARY_TYPE_SIGN_AGENT=2,d.LIBRARY_TYPE_WEB_EXTENSION=3,d.LIBRARY_TYPE_NPAPI=4,d.LIBRARY_TYPE_ACTIVE_X=5,d.EU_DEFAULT_LANG=0,d.EU_UA_LANG=1,d.EU_RU_LANG=2,d.EU_EN_LANG=3,d.isJavaAppletSupported=function(){var e=new s;if(this.m_noJavaApplet)return!1;switch(e.GetName()){case s.BROWSER_NAME_FIREFOX:case s.BROWSER_NAME_CHROME:return!(e.GetVersion()>44);case s.BROWSER_NAME_OPERA:return!(e.GetVersion()>30);case s.BROWSER_NAME_EDGE:case s.BROWSER_NAME_UNKNOWN:return!1;default:return!0}},d.isSignAgentSupported=function(){var e=new s;switch(e.GetName()){case s.BROWSER_NAME_IE:if(e.GetVersion()<10)return!1;break;case s.BROWSER_NAME_SAFARI:if(e.GetVersion()<7)return!1;break;case s.BROWSER_NAME_UNKNOWN:return!1}switch(e.GetOSName()){case s.OS_NAME_WINDOWS:case s.OS_NAME_MAC:break;case s.OS_NAME_IOS:return e.GetName()==s.BROWSER_NAME_EU_SIGN_AGENT;case s.OS_NAME_ANDROID:case s.OS_NAME_LINUX:break;case s.OS_NAME_UNKNOWN:default:return!1}return!0},d.isWebExtensionSupported=function(){var e=new s;switch(e.GetName()){case s.BROWSER_NAME_CHROME:break;case s.BROWSER_NAME_OPERA:if(e.GetVersion()<35)return!1;break;case s.BROWSER_NAME_FIREFOX:if(e.GetVersion()<50)return!1;break;case s.BROWSER_NAME_UNKNOWN:default:return!1}switch(e.GetOSName()){case s.OS_NAME_ANDROID:case s.OS_NAME_UNKNOWN:return!1}return!0},d.isNPAPISupported=function(){var e=new s;switch(e.GetName()){case s.BROWSER_NAME_FIREFOX:if(e.GetVersion()>51)return!1;break;default:return!1}return!0},d.isActiveXSupported=function(){var e=new s;switch(e.GetName()){case s.BROWSER_NAME_IE:if(e.GetVersion()<9||e.GetArch()==s.BROWSER_ARCH_NAME_X64)return!1;break;default:return!1}return!0},d.isWebExtensionInstalled=function(){var e=new s().GetName()==s.BROWSER_NAME_FIREFOX?`eusw@iit.com.ua`:`chrome-extension://jffafkigfgmjafhpkoibhfefeaebmccg/`;return document.getElementsByClassName(e).length==1},d.prototype.getLibraryType=function(){return this.m_libraryType},d.prototype.load=function(){var e=this;setTimeout(function(){e._load(e.m_supportedLibraryTypes[e.m_supportedLibraryTypesIndex])},1)},d.prototype.unload=function(){var e=document.getElementById(this.m_id);e&&e.parentNode&&e.parentNode.removeChild(e)},d.prototype._load=function(e){switch(e){case d.LIBRARY_TYPE_JAVA_APPLET:this._loadSignApplet();return;case d.LIBRARY_TYPE_SIGN_AGENT:this._loadSignAgent();return;case d.LIBRARY_TYPE_WEB_EXTENSION:this._loadWebExtension();return;case d.LIBRARY_TYPE_NPAPI:this._loadNPAPI();return;case d.LIBRARY_TYPE_ACTIVE_X:this._loadActiveX();return}},d.prototype._onLoad=function(){this.m_libraryType=this.m_supportedLibraryTypes[this.m_supportedLibraryTypesIndex];try{this.onload(this.m_library)}catch(e){console.log(e)}},d.prototype._onLoadError=function(e,t,n,r){this.m_errorResult??={msg:t,code:n,library:r};var i=document.getElementById(this.m_id);if(i&&i.parentNode&&i.parentNode.removeChild(i),e){if(this.m_supportedLibraryTypesIndex++,this.m_supportedLibraryTypesIndex>=this.m_supportedLibraryTypes.length)try{this.onerror(this.m_errorResult.msg,this.m_errorResult.code,this.m_errorResult.library)}catch(e){console.log(e)}else this.load()}else try{this.onerror(this.m_errorResult.msg,this.m_errorResult.code,this.m_errorResult.library)}catch(e){console.log(e)}},d.prototype._loadSignApplet=function(){var e=document.createElement(`applet`);e.setAttribute(`codebase`,`https://sign.eu.iit.com.ua`),e.setAttribute(`code`,`com.iit.certificateAuthority.endUser.libraries.signJava.EndUser.class`),e.setAttribute(`archive`,`EUSignJava.jar`),e.setAttribute(`cache_archive`,`EUSignJava.jar`),e.setAttribute(`cache_version`,`1.3.102`),e.setAttribute(`separate_jvm`,!0),e.setAttribute(`id`,this.m_id),e.setAttribute(`width`,`100%`),e.setAttribute(`height`,`1`),document.body.appendChild(e),this.m_library=document.getElementById(this.m_id),this._waitForSignAppletLoad(this,100,1200)},d.prototype._waitForSignAppletLoad=function(e,t,n){try{e.m_library.SetUIMode(!1)}catch{if(n!=0)return void setTimeout(function(){e._waitForSignAppletLoad(e,t,n-1)},t,n);var r=``;r=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,e.m_language)+`. `,r+=u.getString(u.WEB_LIBRARY_JAVA_APPLET_NOT_LOADED,e.m_language),r+=`<br><br>`,r+=`<a style="text-indent:18px" href="https://www.java.com/ru/download/installed.jsp">`+u.getString(u.WEB_LIBRARY_CHECK_JRE_VERSION,e.m_language)+`</a>`,e._onLoadError(!0,r,Z.ERROR_LIBRARY_COMUNICATION_FAILED,null);return}e._onLoad(e.m_library)},d.prototype._appendWebWrapperObject=function(e,t,n,r){try{var i=new $(e,t),a=document.createElement(`object`);for(var o in a.setAttribute(`id`,this.m_id),n?r?(a.setAttribute(`classid`,e),a.setAttribute(`height`,`1px`)):(a.type=e,a.classid=e,a.height=`1px`):(a.classid=`EUSignCP.class`,a.style=`display:none`,a.style.visibility=`hidden`),document.body.appendChild(a),i)a[o]=i[o];return this.m_library=document.getElementById(this.m_id),!0}catch{return!1}},d.prototype._onLoadWebLibraryError=function(e){var t,n=this.m_library,r=!0,i=``;switch(t=d.isWebExtensionSupported()&&!d.isWebExtensionInstalled()&&this.m_webExtensionFirst,i+=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,this.m_language),i+=`. `,e.GetErrorCode()){case Z.ERROR_LIBRARY_COMUNICATION_FAILED:i+=u.getString(t?u.WEB_LIBRARY_WEB_EXTENSION_NOT_INSTALLED_OR_RUN:u.WEB_LIBRARY_NOT_INSTALLED_OR_RUN,this.m_language);break;case Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED:i+=u.getString(u.WEB_LIBRARY_INSTALLED_VERSION_NOT_SUPPORTED,this.m_language),r=!1,this.m_errorResult=null;break;default:i+=Z.getErrorDescriptionEx(e.GetErrorCode(),this.m_language)+`.`}i+=`<br><br>`,n.GetInstallURL()==null?i+=`<div>`+u.getString(u.WEB_LIBRARY_OS_NOT_SUPPORTED,this.m_language)+`</div>`:(e.GetErrorCode()==Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED?i+=`<div><a style="text-indent:18px" href="`+n.GetUpdateURL()+`">`+u.getString(u.WEB_LIBRARY_UPDATE_PACKAGE,this.m_language)+`</a></div>`:i+=t?`<div><a style="text-indent:18px" href="`+n.GetWebExtensionInstallURL()+`">`+u.getString(u.WEB_LIBRARY_WEB_EXTENSION_INSTALL_PACKAGE,this.m_language)+`</a></div>`:`<div><a style="text-indent:18px" href="`+n.GetInstallURL()+`">`+u.getString(u.WEB_LIBRARY_INSTALL_PACKAGE,this.m_language)+`</a></div>`,i+=`<div><a style="text-indent:18px" href="`+n.GetHelpURL()+`">`+u.getString(u.WEB_LIBRARY_USER_MANUAL,this.m_language)+`</a></div>`),this._onLoadError(r,i,e.GetErrorCode(),n)},d.prototype._loadWebLibrary=function(){var e=this;e.m_library.Load(function(){e._onLoad()},function(t){e._onLoadWebLibraryError(t)})},d.prototype._loadSignAgent=function(){if(this._appendWebWrapperObject(`localhost`,window.location.protocol==`http:`?`8081`:`8083`,!1,!1))this._loadWebLibrary();else{var e=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,this.m_language);this._onLoadError(!0,e,Z.ERROR_LIBRARY_COMUNICATION_FAILED,null)}},d.prototype._loadWebExtension=function(){if(this._appendWebWrapperObject(`chrome-extension://jffafkigfgmjafhpkoibhfefeaebmccg/`,``,!1,!1))this._loadWebLibrary();else{var e=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,this.m_language);this._onLoadError(!0,e,Z.ERROR_LIBRARY_COMUNICATION_FAILED,null)}},d.prototype._loadPlugin=function(e,t,n,r){if(this._appendWebWrapperObject(e,``,!0,r))this._waitForPluginLoad(this,t,n);else{var i=Z.getErrorDescriptionEx(Z.ERROR_LIBRARY_COMUNICATION_FAILED,this.m_language);this._onLoadError(!0,i,Z.ERROR_LIBRARY_COMUNICATION_FAILED,null)}},d.prototype._waitForPluginLoad=function(e,t,n){e.m_library.Load(function(){e._onLoad()},function(r){r.GetErrorCode()!=Z.ERROR_LIBRARY_COMUNICATION_FAILED||n==0?e._onLoadWebLibraryError(r):setTimeout(function(){e._waitForPluginLoad(e,t,n-1)},t,n)})},d.prototype._loadNPAPI=function(){this._loadPlugin(`application/x-eusign-cp`,100,50,!1)},d.prototype._loadActiveX=function(){this._loadPlugin(`clsid:B7E24C75-E343-4DA2-A8D3-C80970FB7D7B`,100,50,!0)};var f=function(){this.vendor=`JSC IIT`,this.parentClassName=`Object`,this.className=`EndUserArrayList`,this.classVersion=1,this.m_array=[]};f.prototype.add=function(e){return this.m_array.push(e),!0},f.prototype.clear=function(){this.m_array=[]},f.prototype.get=function(e){return this.m_array[e]},f.prototype.size=function(){return this.m_array.length},Object.create||(Object.create=function(e,t){if(typeof e!=`object`&&typeof e!=`function`||e===null||t!==void 0)throw Error(`Invalid arguments`);function n(){}return n.prototype=e,new n}),Uint8Array.prototype.slice||(Uint8Array.prototype.slice=Uint8Array.prototype.subarray);var p=null;function m(e){return typeof e==`object`&&!!e&&(e.className==`EndUserTransferableObject`||e.parentClassName==`EndUserTransferableObject`)}p=typeof Uint8Array>`u`?function(e){var t;if(typeof e==`number`){t=Array(e);for(var n=0;n<e;++n)t[n]=0}else t=e.slice(0);return t.buffer=t,t.subarray=function(e,n){return t.slice(e,n)},t.set=function(e,n){arguments.length<2&&(n=0);for(var r=0,i=e.length;r<i;++r,++n)t[n]=255&e[r]},t.byteLength=t.length,typeof e==`object`&&e.buffer&&(t.buffer=e.buffer),t}:Uint8Array;var h=function(){this.vendor=`JSC IIT`,this.parentClassName=`Object`,this.className=`EndUserTransferableObject`,this.classVersion=1,this.isFilled=!1,this.fields={}};h.makeTransferable=function(e){var t,n=h;(t=e).prototype=Object.create(n.prototype),t.prototype.constructor=t,h[new e().className]=e},h.prototype.base64Coder=new a,h.prototype.dateCoder=new i,h.prototype.setClassInfo=function(e,t){this.parentClassName=`EndUserTransferableObject`,this.className=e,this.classVersion=t},h.prototype.initializeFields=function(){for(var e in this.fields)switch(this.fields[e]){case`boolean`:this[e]=!1;break;case`int`:case`long`:case`number`:this[e]=0;break;case`string`:this[e]=``;break;case`EndUserKeyMedia`:this[e]=new _;break;default:this[e]=null}},h.prototype.set=function(e){if(this.className!=e.className)throw`invalid class`;for(var t in this.fields)this[t]=e[t]},h.prototype.encode=function(){var e,t;for(var n in t={},e={},this.fields)this[n]==null?t[n]=null:m(this[n])?t[n]=this[n].encode():this.fields[n]==`byteArray`?t[n]=this.base64Coder.encode(this[n]):this.fields[n]==`time`?t[n]=this.dateCoder.encode(this[n]):t[n]=this[n];return e.className=this.className,e.classVersion=this.classVersion,e.classFields=t,e},h.prototype.decode=function(e){try{if(e.classVersion==null||e.classFields==null)return!1;var t=e.classFields;for(var n in this.fields)if(this.fields[n]==`time`)this[n]=this.dateCoder.decode(t[n]);else if(this.fields[n]==`EndUserOwnerInfo`)this[n]=new k,this[n].decode(t[n]);else if(this.fields[n]==`EndUserTimeInfo`)this[n]=new A,this[n].decode(t[n]);else if(this.fields[n]==`EndUserKeyMedia`)this[n]=new _,this[n].decode(t[n]);else if(this.fields[n]==`EndUserCertificateInfoEx`)this[n]=new P,this[n].decode(t[n]);else if(this.fields[n]==`byteArray`)t[n]!=null&&(this[n]=this.base64Coder.decode(t[n]));else if(this.fields[n]==`array`){this[n]=[];for(var r=t[n],i=0;i<r.length;i++){var a=new h[r[i].className];if(a!==void 0){if(!a.decode(r[i]))throw`invalid class`;a.className==`EndUserByteArray`&&(a=a.GetData()),this[n].push(a)}else this[n].push(r[i])}}else this[n]=t[n];return!0}catch{return this.isFilled=!1,!1}};var g=function(e){this.setClassInfo(`EndUserByteArray`,1),this.fields={data:`byteArray`},this.initializeFields(),this.data=e};h.makeTransferable(g),g.prototype.GetData=function(){return this.data},g.prototype.SetData=function(e){this.data=e};var _=function(){this.setClassInfo(`EndUserKeyMedia`,1),this.fields={typeIndex:`long`,devIndex:`long`,password:`string`},this.initializeFields()};h.makeTransferable(_),_.prototype.GetTypeIndex=function(){return this.typeIndex},_.prototype.SetTypeIndex=function(e){this.typeIndex=e},_.prototype.GetDevIndex=function(){return this.devIndex},_.prototype.SetDevIndex=function(e){this.devIndex=e},_.prototype.GetPassword=function(){return this.password},_.prototype.SetPassword=function(e){this.password=e};var v=function(){this.setClassInfo(`EndUserFileStoreSettings`,1),this.fields={path:`string`,checkCRLs:`boolean`,autoRefresh:`boolean`,ownCRLsOnly:`boolean`,fullAndDeltaCRLs:`boolean`,autoDownloadCRLs:`boolean`,saveLoadedCerts:`boolean`,expireTime:`long`},this.initializeFields(),this.expireTime=3600};h.makeTransferable(v),v.prototype.GetPath=function(){return this.path},v.prototype.SetPath=function(e){this.path=e},v.prototype.GetCheckCRLs=function(){return this.checkCRLs},v.prototype.SetCheckCRLs=function(e){this.checkCRLs=e},v.prototype.GetAutoRefresh=function(){return this.autoRefresh},v.prototype.SetAutoRefresh=function(e){this.autoRefresh=e},v.prototype.GetOwnCRLsOnly=function(){return this.ownCRLsOnly},v.prototype.SetOwnCRLsOnly=function(e){this.ownCRLsOnly=e},v.prototype.GetFullAndDeltaCRLs=function(){return this.fullAndDeltaCRLs},v.prototype.SetFullAndDeltaCRLs=function(e){this.fullAndDeltaCRLs=e},v.prototype.GetAutoDownloadCRLs=function(){return this.autoDownloadCRLs},v.prototype.SetAutoDownloadCRLs=function(e){this.autoDownloadCRLs=e},v.prototype.GetSaveLoadedCerts=function(){return this.saveLoadedCerts},v.prototype.SetSaveLoadedCerts=function(e){this.saveLoadedCerts=e},v.prototype.GetExpireTime=function(){return this.expireTime},v.prototype.SetExpireTime=function(e){this.expireTime=e};var y=function(){this.setClassInfo(`EndUserProxySettings`,1),this.fields={useProxy:`boolean`,anonymous:`boolean`,address:`string`,port:`string`,user:`string`,password:`string`,savePassword:`boolean`},this.initializeFields(),this.port=`80`};h.makeTransferable(y),y.prototype.GetUseProxy=function(){return this.useProxy},y.prototype.SetUseProxy=function(e){this.useProxy=e},y.prototype.GetAnonymous=function(){return this.anonymous},y.prototype.SetAnonymous=function(e){this.anonymous=e},y.prototype.GetAddress=function(){return this.address},y.prototype.SetAddress=function(e){this.address=e},y.prototype.GetPort=function(){return this.port},y.prototype.SetPort=function(e){this.port=e},y.prototype.GetUser=function(){return this.user},y.prototype.SetUser=function(e){this.user=e},y.prototype.GetPassword=function(){return this.password},y.prototype.SetPassword=function(e){this.password=e},y.prototype.GetSavePassword=function(){return this.savePassword},y.prototype.SetSavePassword=function(e){this.savePassword=e};var b=function(){this.setClassInfo(`EndUserTSPSettings`,1),this.fields={getStamps:`boolean`,address:`string`,port:`string`},this.initializeFields(),this.port=`80`};h.makeTransferable(b),b.prototype.GetGetStamps=function(){return this.getStamps},b.prototype.SetGetStamps=function(e){this.getStamps=e},b.prototype.GetAddress=function(){return this.address},b.prototype.SetAddress=function(e){this.address=e},b.prototype.GetPort=function(){return this.port},b.prototype.SetPort=function(e){this.port=e};var x=function(){this.setClassInfo(`EndUserOCSPSettings`,1),this.fields={useOCSP:`boolean`,beforeStore:`boolean`,address:`string`,port:`string`},this.initializeFields(),this.port=`80`};h.makeTransferable(x),x.prototype.GetUseOCSP=function(){return this.useOCSP},x.prototype.SetUseOCSP=function(e){this.useOCSP=e},x.prototype.GetBeforeStore=function(){return this.beforeStore},x.prototype.SetBeforeStore=function(e){this.beforeStore=e},x.prototype.GetAddress=function(){return this.address},x.prototype.SetAddress=function(e){this.address=e},x.prototype.GetPort=function(){return this.port},x.prototype.SetPort=function(e){this.port=e};var S=function(){this.setClassInfo(`EndUserLDAPSettings`,1),this.fields={useLDAP:`boolean`,address:`string`,port:`string`,anonymous:`boolean`,user:`string`,password:`string`},this.initializeFields(),this.port=`389`};h.makeTransferable(S),S.prototype.GetUseLDAP=function(){return this.useLDAP},S.prototype.SetUseLDAP=function(e){this.useLDAP=e},S.prototype.GetAddress=function(){return this.address},S.prototype.SetAddress=function(e){this.address=e},S.prototype.GetPort=function(){return this.port},S.prototype.SetPort=function(e){this.port=e},S.prototype.GetAnonymous=function(){return this.anonymous},S.prototype.SetAnonymous=function(e){this.anonymous=e},S.prototype.GetUser=function(){return this.user},S.prototype.SetUser=function(e){this.user=e},S.prototype.GetPassword=function(){return this.password},S.prototype.SetPassword=function(e){this.password=e};var C=function(){this.setClassInfo(`EndUserCMPSettings`,1),this.fields={useCMP:`boolean`,address:`string`,port:`string`,commonName:`string`},this.initializeFields(),this.port=`80`};h.makeTransferable(C),C.prototype.GetUseCMP=function(){return this.useCMP},C.prototype.SetUseCMP=function(e){this.useCMP=e},C.prototype.GetAddress=function(){return this.address},C.prototype.SetAddress=function(e){this.address=e},C.prototype.GetPort=function(){return this.port},C.prototype.SetPort=function(e){this.port=e},C.prototype.GetCommonName=function(){return this.commonName},C.prototype.SetCommonName=function(e){this.commonName=e};var w=function(){this.setClassInfo(`EndUserModeSettings`,1),this.fields={offlineMode:`boolean`},this.initializeFields()};h.makeTransferable(w),w.prototype.GetOfflineMode=function(){return this.offlineMode},w.prototype.SetOfflineMode=function(e){this.offlineMode=e};var T=function(){this.setClassInfo(`EndUserOCSPAccessInfoModeSettings`,1),this.fields={enabled:`boolean`},this.initializeFields()};h.makeTransferable(T),T.prototype.GetEnabled=function(){return this.enabled},T.prototype.SetEnabled=function(e){this.enabled=e};var E=function(){this.setClassInfo(`EndUserOCSPAccessInfoSettings`,1),this.fields={issuerCN:`string`,address:`string`,port:`string`},this.initializeFields()};h.makeTransferable(E),E.prototype.GetIssuerCN=function(){return this.issuerCN},E.prototype.SetIssuerCN=function(e){this.issuerCN=e},E.prototype.GetAddress=function(){return this.address},E.prototype.SetAddress=function(e){this.address=e},E.prototype.GetPort=function(){return this.port},E.prototype.SetPort=function(e){this.port=e};var D=function(){this.setClassInfo(`EndUserKeyMediaSettings`,1),this.fields={sourceType:`long`,showErrors:`boolean`,keyMedia:`EndUserKeyMedia`},this.initializeFields(),this.sourceType=1,this.showErrors=!0};h.makeTransferable(D),D.prototype.GetSourceType=function(){return this.sourceType},D.prototype.SetSourceType=function(e){this.sourceType=e},D.prototype.GetShowErrors=function(){return this.showErrors},D.prototype.SetShowErrors=function(e){this.showErrors=e},D.prototype.GetKeyMedia=function(){return this.keyMedia},D.prototype.SetKeyMedia=function(e){this.keyMedia=e};var O=function(){this.setClassInfo(`EndUserTSLSettings`,1),this.fields={useTSL:`boolean`,autoDownloadTSL:`boolean`,tslAddress:`string`},this.initializeFields()};h.makeTransferable(O),O.prototype.GetUseTSL=function(){return this.useTSL},O.prototype.SetUseTSL=function(e){this.useTSL=e},O.prototype.GetAutoDownloadTSL=function(){return this.autoDownloadTSL},O.prototype.SetAutoDownloadTSL=function(e){this.autoDownloadTSL=e},O.prototype.GetTSLAddress=function(){return this.tslAddress},O.prototype.SetTSLAddress=function(e){this.tslAddress=e};var k=function(){this.setClassInfo(`EndUserOwnerInfo`,1),this.fields={isFilled:`boolean`,issuer:`string`,issuerCN:`string`,serial:`string`,subject:`string`,subjCN:`string`,subjOrg:`string`,subjOrgUnit:`string`,subjTitle:`string`,subjState:`string`,subjLocality:`string`,subjFullName:`string`,subjAddress:`string`,subjPhone:`string`,subjEMail:`string`,subjDNS:`string`,subjEDRPOUCode:`string`,subjDRFOCode:`string`},this.initializeFields()};h.makeTransferable(k),k.prototype.IsFilled=function(){return this.isFilled},k.prototype.GetIssuer=function(){return this.issuer},k.prototype.GetIssuerCN=function(){return this.issuerCN},k.prototype.GetSerial=function(){return this.serial},k.prototype.GetSubject=function(){return this.subject},k.prototype.GetSubjCN=function(){return this.subjCN},k.prototype.GetSubjOrg=function(){return this.subjOrg},k.prototype.GetSubjOrgUnit=function(){return this.subjOrgUnit},k.prototype.GetSubjTitle=function(){return this.subjTitle},k.prototype.GetSubjState=function(){return this.subjState},k.prototype.GetSubjLocality=function(){return this.subjLocality},k.prototype.GetSubjFullName=function(){return this.subjFullName},k.prototype.GetSubjAddress=function(){return this.subjAddress},k.prototype.GetSubjPhone=function(){return this.subjPhone},k.prototype.GetSubjEMail=function(){return this.subjEMail},k.prototype.GetSubjDNS=function(){return this.subjDNS},k.prototype.GetSubjEDRPOUCode=function(){return this.subjEDRPOUCode},k.prototype.GetSubjDRFOCode=function(){return this.subjDRFOCode};var A=function(){this.setClassInfo(`EndUserTimeInfo`,2),this.fields={version:`number`,isTimeAvail:`boolean`,isTimeStamp:`boolean`,time:`time`,isSignTimeStampAvail:`boolean`,signTimeStamp:`time`},this.initializeFields()};h.makeTransferable(A),A.prototype.GetVersion=function(){return this.version},A.prototype.IsTimeAvail=function(){return this.isTimeAvail},A.prototype.IsTimeStamp=function(){return this.isTimeStamp},A.prototype.GetTime=function(){return this.time},A.prototype.IsSignTimeStampAvail=function(){return this.isSignTimeStampAvail},A.prototype.GetSignTimeStamp=function(){return this.signTimeStamp};var j=function(){this.setClassInfo(`EndUserSignInfo`,1),this.fields={ownerInfo:`EndUserOwnerInfo`,timeInfo:`EndUserTimeInfo`,data:`byteArray`},this.initializeFields()};h.makeTransferable(j),j.prototype.GetOwnerInfo=function(){return this.ownerInfo},j.prototype.GetTimeInfo=function(){return this.timeInfo},j.prototype.GetData=function(){return this.data},j.prototype.GetDataString=function(e){return r.ArrayToString(e,this.data)};var M=function(){this.setClassInfo(`EndUserSenderInfo`,1),this.fields={ownerInfo:`EndUserOwnerInfo`,timeInfo:`EndUserTimeInfo`,data:`byteArray`},this.initializeFields()};h.makeTransferable(M),M.prototype.GetOwnerInfo=function(){return this.ownerInfo},M.prototype.GetTimeInfo=function(){return this.timeInfo},M.prototype.GetData=function(){return this.data},M.prototype.GetDataString=function(e){return r.ArrayToString(e,this.data)};var N=function(){this.setClassInfo(`EndUserCertificateInfo`,1),this.fields={isFilled:`boolean`,version:`long`,issuer:`string`,issuerCN:`string`,serial:`string`,subject:`string`,subjCN:`string`,subjOrg:`string`,subjOrgUnit:`string`,subjTitle:`string`,subjState:`string`,subjLocality:`string`,subjFullName:`string`,subjAddress:`string`,subjPhone:`string`,subjEMail:`string`,subjDNS:`string`,subjEDRPOUCode:`string`,subjDRFOCode:`string`,subjNBUCode:`string`,subjSPFMCode:`string`,subjOCode:`string`,subjOUCode:`string`,subjUserCode:`string`,certBeginTime:`time`,certEndTime:`time`,isPrivKeyTimesAvail:`boolean`,privKeyBeginTime:`time`,privKeyEndTime:`time`,publicKeyBits:`long`,publicKey:`string`,publicKeyID:`string`,isECDHPublicKeyAvail:`boolean`,ECDHPublicKeyBits:`long`,ECDHPublicKey:`string`,ECDHPublicKeyID:`string`,issuerPublicKeyID:`string`,keyUsage:`string`,extKeyUsages:`string`,policies:`string`,crlDistribPoint1:`string`,crlDistribPoint2:`string`,isPowerCert:`boolean`,isSubjTypeAvail:`boolean`,isSubjCA:`boolean`},this.initializeFields()};h.makeTransferable(N),N.prototype.IsFilled=function(){return this.isFilled},N.prototype.GetVersion=function(){return this.version},N.prototype.GetIssuer=function(){return this.issuer},N.prototype.GetIssuerCN=function(){return this.issuerCN},N.prototype.GetSerial=function(){return this.serial},N.prototype.GetSubject=function(){return this.subject},N.prototype.GetSubjCN=function(){return this.subjCN},N.prototype.GetSubjOrg=function(){return this.subjOrg},N.prototype.GetSubjOrgUnit=function(){return this.subjOrgUnit},N.prototype.GetSubjTitle=function(){return this.subjTitle},N.prototype.GetSubjState=function(){return this.subjState},N.prototype.GetSubjLocality=function(){return this.subjLocality},N.prototype.GetSubjFullName=function(){return this.subjFullName},N.prototype.GetSubjAddress=function(){return this.subjAddress},N.prototype.GetSubjPhone=function(){return this.subjPhone},N.prototype.GetSubjEMail=function(){return this.subjEMail},N.prototype.GetSubjDNS=function(){return this.subjDNS},N.prototype.GetSubjEDRPOUCode=function(){return this.subjEDRPOUCode},N.prototype.GetSubjDRFOCode=function(){return this.subjDRFOCode},N.prototype.GetSubjNBUCode=function(){return this.subjNBUCode},N.prototype.GetSubjSPFMCode=function(){return this.subjSPFMCode},N.prototype.GetSubjOCode=function(){return this.subjOCode},N.prototype.GetSubjOUCode=function(){return this.subjOUCode},N.prototype.GetSubjUserCode=function(){return this.subjUserCode},N.prototype.GetCertBeginTime=function(){return this.certBeginTime},N.prototype.GetCertEndTime=function(){return this.certEndTime},N.prototype.IsPrivKeyTimesAvail=function(){return this.isPrivKeyTimesAvail},N.prototype.GetPrivKeyBeginTime=function(){return this.privKeyBeginTime},N.prototype.GetPrivKeyEndTime=function(){return this.privKeyEndTime},N.prototype.GetPublicKeyBits=function(){return this.publicKeyBits},N.prototype.GetPublicKey=function(){return this.publicKey},N.prototype.GetPublicKeyID=function(){return this.publicKeyID},N.prototype.IsECDHPublicKeyAvail=function(){return this.isECDHPublicKeyAvail},N.prototype.GetECDHPublicKeyBits=function(){return this.ECDHPublicKeyBits},N.prototype.GetECDHPublicKey=function(){return this.ECDHPublicKey},N.prototype.GetECDHPublicKeyID=function(){return this.ECDHPublicKeyID},N.prototype.GetIssuerPublicKeyID=function(){return this.issuerPublicKeyID},N.prototype.GetKeyUsage=function(){return this.keyUsage},N.prototype.GetExtKeyUsages=function(){return this.extKeyUsages},N.prototype.GetPolicies=function(){return this.policies},N.prototype.GetCRLDistribPoint1=function(){return this.crlDistribPoint1},N.prototype.GetCRLDistribPoint2=function(){return this.crlDistribPoint2},N.prototype.IsPowerCert=function(){return this.isPowerCert},N.prototype.IsSubjTypeAvail=function(){return this.isSubjTypeAvail},N.prototype.IsSubjCA=function(){return this.isSubjCA};var P=function(){this.setClassInfo(`EndUserCertificateInfoEx`,8),this.fields={isFilled:`boolean`,version:`long`,issuer:`string`,issuerCN:`string`,serial:`string`,subject:`string`,subjCN:`string`,subjOrg:`string`,subjOrgUnit:`string`,subjTitle:`string`,subjState:`string`,subjLocality:`string`,subjFullName:`string`,subjAddress:`string`,subjPhone:`string`,subjEMail:`string`,subjDNS:`string`,subjEDRPOUCode:`string`,subjDRFOCode:`string`,subjNBUCode:`string`,subjSPFMCode:`string`,subjOCode:`string`,subjOUCode:`string`,subjUserCode:`string`,certBeginTime:`time`,certEndTime:`time`,isPrivKeyTimesAvail:`boolean`,privKeyBeginTime:`time`,privKeyEndTime:`time`,publicKeyBits:`long`,publicKey:`string`,publicKeyID:`string`,issuerPublicKeyID:`string`,keyUsage:`string`,extKeyUsages:`string`,policies:`string`,crlDistribPoint1:`string`,crlDistribPoint2:`string`,isPowerCert:`boolean`,isSubjTypeAvail:`boolean`,isSubjCA:`boolean`,chainLength:`int`,UPN:`string`,publicKeyType:`long`,keyUsageType:`long`,RSAModul:`string`,RSAExponent:`string`,OCSPAccessInfo:`string`,issuerAccessInfo:`string`,TSPAccessInfo:`string`,isLimitValueAvailable:`boolean`,limitValue:`long`,limitValueCurrency:`string`,subjType:`long`,subjSubType:`long`,subjUNZR:`string`,subjCountry:`string`,fingerprint:`string`,isQSCD:`boolean`,subjUserID:`string`,certHashType:`number`},this.initializeFields();var e=this;this.IsLimitValueAvailable=function(){return e.isLimitValueAvailable}};h.makeTransferable(P),P.prototype.IsFilled=function(){return this.isFilled},P.prototype.GetVersion=function(){return this.version},P.prototype.GetIssuer=function(){return this.issuer},P.prototype.GetIssuerCN=function(){return this.issuerCN},P.prototype.GetSerial=function(){return this.serial},P.prototype.GetSubject=function(){return this.subject},P.prototype.GetSubjCN=function(){return this.subjCN},P.prototype.GetSubjOrg=function(){return this.subjOrg},P.prototype.GetSubjOrgUnit=function(){return this.subjOrgUnit},P.prototype.GetSubjTitle=function(){return this.subjTitle},P.prototype.GetSubjState=function(){return this.subjState},P.prototype.GetSubjLocality=function(){return this.subjLocality},P.prototype.GetSubjFullName=function(){return this.subjFullName},P.prototype.GetSubjAddress=function(){return this.subjAddress},P.prototype.GetSubjPhone=function(){return this.subjPhone},P.prototype.GetSubjEMail=function(){return this.subjEMail},P.prototype.GetSubjDNS=function(){return this.subjDNS},P.prototype.GetSubjEDRPOUCode=function(){return this.subjEDRPOUCode},P.prototype.GetSubjDRFOCode=function(){return this.subjDRFOCode},P.prototype.GetSubjNBUCode=function(){return this.subjNBUCode},P.prototype.GetSubjSPFMCode=function(){return this.subjSPFMCode},P.prototype.GetSubjOCode=function(){return this.subjOCode},P.prototype.GetSubjOUCode=function(){return this.subjOUCode},P.prototype.GetSubjUserCode=function(){return this.subjUserCode},P.prototype.GetCertBeginTime=function(){return this.certBeginTime},P.prototype.GetCertEndTime=function(){return this.certEndTime},P.prototype.IsPrivKeyTimesAvail=function(){return this.isPrivKeyTimesAvail},P.prototype.GetPrivKeyBeginTime=function(){return this.privKeyBeginTime},P.prototype.GetPrivKeyEndTime=function(){return this.privKeyEndTime},P.prototype.GetPublicKeyBits=function(){return this.publicKeyBits},P.prototype.GetPublicKey=function(){return this.publicKey},P.prototype.GetPublicKeyID=function(){return this.publicKeyID},P.prototype.GetIssuerPublicKeyID=function(){return this.issuerPublicKeyID},P.prototype.GetKeyUsage=function(){return this.keyUsage},P.prototype.GetExtKeyUsages=function(){return this.extKeyUsages},P.prototype.GetPolicies=function(){return this.policies},P.prototype.GetCRLDistribPoint1=function(){return this.crlDistribPoint1},P.prototype.GetCRLDistribPoint2=function(){return this.crlDistribPoint2},P.prototype.IsPowerCert=function(){return this.isPowerCert},P.prototype.IsSubjTypeAvail=function(){return this.isSubjTypeAvail},P.prototype.IsSubjCA=function(){return this.isSubjCA},P.prototype.GetChainLength=function(){return this.chainLength},P.prototype.GetUPN=function(){return this.UPN},P.prototype.GetPublicKeyType=function(){return this.publicKeyType},P.prototype.GetKeyUsageType=function(){return this.keyUsageType},P.prototype.GetRSAModul=function(){return this.RSAModul},P.prototype.GetRSAExponent=function(){return this.RSAExponent},P.prototype.GetOCSPAccessInfo=function(){return this.OCSPAccessInfo},P.prototype.GetIssuerAccessInfo=function(){return this.issuerAccessInfo},P.prototype.GetTSPAccessInfo=function(){return this.TSPAccessInfo},P.prototype.IsLimitValueAvail=function(){return this.isLimitValueAvailable},P.prototype.GetLimitValue=function(){return this.limitValue},P.prototype.GetLimitValueCurrency=function(){return this.limitValueCurrency},P.prototype.GetSubjType=function(){return this.subjType},P.prototype.GetSubjSubType=function(){return this.subjSubType},P.prototype.GetSubjUNZR=function(){return this.subjUNZR},P.prototype.GetSubjCountry=function(){return this.subjCountry},P.prototype.GetFingerprint=function(){return this.fingerprint},P.prototype.IsQSCD=function(){return this.isQSCD},P.prototype.GetSubjUserID=function(){return this.subjUserID},P.prototype.GetCertHashType=function(){return this.certHashType};var F=function(){this.setClassInfo(`EndUserCertificate`,1),this.fields={infoEx:`EndUserCertificateInfoEx`,data:`byteArray`},this.initializeFields()};h.makeTransferable(F),F.prototype.GetInfoEx=function(){return this.infoEx},F.prototype.SetInfoEx=function(e){this.infoEx=e},F.prototype.GetData=function(){return this.data},F.prototype.SetData=function(e){this.data=e};var I=function(){this.setClassInfo(`EndUserCRLInfo`,1,!0,!1),this.fields={isFilled:`boolean`,issuer:`string`,issuerCN:`string`,crlNumber:`long`,thisUpdate:`time`,nextUpdate:`time`},this.initializeFields()};h.makeTransferable(I),I.prototype.IsFilled=function(){return this.isFilled},I.prototype.GetIssuer=function(){return this.issuer},I.prototype.GetIssuerCN=function(){return this.issuerCN},I.prototype.GetCRLNumber=function(){return this.crlNumber},I.prototype.GetThisUpdate=function(){return this.thisUpdate},I.prototype.GetNextUpdate=function(){return this.nextUpdate};var L=function(){this.setClassInfo(`EndUserCRLDetailedInfo`,1),this.fields={isFilled:`boolean`,version:`long`,issuer:`string`,issuerCN:`string`,issuerPublicKeyID:`string`,crlNumber:`long`,thisUpdate:`time`,nextUpdate:`time`,revokedItemsCount:`long`},this.initializeFields()};h.makeTransferable(L),L.prototype.IsFilled=function(){return this.isFilled},L.prototype.GetVersion=function(){return this.version},L.prototype.GetIssuer=function(){return this.issuer},L.prototype.GetIssuerCN=function(){return this.issuerCN},L.prototype.GetIssuerPublicKeyID=function(){return this.issuerPublicKeyID},L.prototype.GetCRLNumber=function(){return this.crlNumber},L.prototype.GetThisUpdate=function(){return this.thisUpdate},L.prototype.GetNextUpdate=function(){return this.nextUpdate},L.prototype.GetRevokedItemsCount=function(){return this.revokedItemsCount};var R=function(){this.setClassInfo(`EndUserPrivateKeyInfo`,1),this.fields={privateKey:`byteArray`,privateKeyInfo:`byteArray`},this.initializeFields()};h.makeTransferable(R),R.prototype.GetPrivateKey=function(){return this.privateKey},R.prototype.SetPrivateKey=function(e){this.privateKey=e},R.prototype.GetPrivateKeyInfo=function(){return this.privateKeyInfo},R.prototype.SetPrivateKeyInfo=function(e){this.privateKeyInfo=e};var z=function(){this.setClassInfo(`EndUserJKSPrivateKey`,1),this.fields={privateKey:`byteArray`,certificates:`array`},this.initializeFields()};h.makeTransferable(z),z.prototype.GetPrivateKey=function(){return this.privateKey},z.prototype.GetCertificate=function(e){return e<0||e>=this.certificates.length?null:this.certificates[e]},z.prototype.GetCertificatesCount=function(){return this.certificates.length},z.prototype.GetCertificates=function(){return this.certificates};var B=function(){this.setClassInfo(`EndUserRequestInfo`,4),this.fields={request:`byteArray`,requestType:`number`,defaultRequestFileName:`string`,isSimple:`boolean`,subject:`string`,subjCN:`string`,subjOrg:`string`,subjOrgUnit:`string`,subjTitle:`string`,subjState:`string`,subjLocality:`string`,subjFullName:`string`,subjAddress:`string`,subjPhone:`string`,subjEMail:`string`,subjDNS:`string`,subjEDRPOUCode:`string`,subjDRFOCode:`string`,subjNBUCode:`string`,subjSPFMCode:`string`,subjOCode:`string`,subjOUCode:` string`,subjUserCode:`string`,certBeginTime:`time`,certEndTime:`time`,isPrivKeyTimesAvail:`boolean`,privKeyBeginTime:`time`,privKeyEndTime:`time`,publicKeyType:`number`,publicKeyBits:`number`,RSAModul:`string`,RSAExponent:`string`,publicKey:`string`,publicKeyID:`string`,extKeyUsages:`string`,crlDistribPoint1:`string`,crlDistribPoint2:`string`,isSubjTypeAvail:`boolean`,subjType:`number`,subjSubType:`number`,isSelfSigned:`boolean`,signIssuer:`string`,signSerial:`string`,subjUNZR:`string`,subjCountry:`string`,isQSCD:`boolean`},this.initializeFields()};h.makeTransferable(B),B.prototype.GetRequest=function(){return this.request},B.prototype.GetRequestType=function(){return this.requestType},B.prototype.GetDefaultRequestFileName=function(){return this.defaultRequestFileName},B.prototype.IsSimple=function(){return this.isSimple},B.prototype.GetSubject=function(){return this.subject},B.prototype.GetSubjCN=function(){return this.subjCN},B.prototype.GetSubjOrg=function(){return this.subjOrg},B.prototype.GetSubjOrgUnit=function(){return this.subjOrgUnit},B.prototype.GetSubjTitle=function(){return this.subjTitle},B.prototype.GetSubjState=function(){return this.subjState},B.prototype.GetSubjLocality=function(){return this.subjLocality},B.prototype.GetSubjFullName=function(){return this.subjFullName},B.prototype.GetSubjAddress=function(){return this.subjAddress},B.prototype.GetSubjPhone=function(){return this.subjPhone},B.prototype.GetSubjEMail=function(){return this.subjEMail},B.prototype.GetSubjDNS=function(){return this.subjDNS},B.prototype.GetSubjEDRPOUCode=function(){return this.subjEDRPOUCode},B.prototype.GetSubjDRFOCode=function(){return this.subjDRFOCode},B.prototype.GetSubjNBUCode=function(){return this.subjNBUCode},B.prototype.GetSubjSPFMCode=function(){return this.subjSPFMCode},B.prototype.GetSubjOCode=function(){return this.subjOCode},B.prototype.GetSubjOUCode=function(){return this.subjOUCode},B.prototype.GetSubjUserCode=function(){return this.subjUserCode},B.prototype.GetCertBeginTime=function(){return this.certBeginTime},B.prototype.GetCertEndTime=function(){return this.certEndTime},B.prototype.IsPrivKeyTimesAvail=function(){return this.isPrivKeyTimesAvail},B.prototype.GetPrivKeyBeginTime=function(){return this.privKeyBeginTime},B.prototype.GetPrivKeyEndTime=function(){return this.privKeyEndTime},B.prototype.GetPublicKeyType=function(){return this.publicKeyType},B.prototype.GetPublicKeyBits=function(){return this.publicKeyBits},B.prototype.GetRSAModul=function(){return this.RSAModul},B.prototype.GetRSAExponent=function(){return this.RSAExponent},B.prototype.GetPublicKey=function(){return this.publicKey},B.prototype.GetPublicKeyID=function(){return this.publicKeyID},B.prototype.GetExtKeyUsages=function(){return this.extKeyUsages},B.prototype.GetCRLDistribPoint1=function(){return this.crlDistribPoint1},B.prototype.GetCRLDistribPoint2=function(){return this.crlDistribPoint2},B.prototype.IsSubjTypeAvail=function(){return this.isSubjTypeAvail},B.prototype.GetSubjType=function(){return this.subjType},B.prototype.GetSubjSubType=function(){return this.subjSubType},B.prototype.IsSelfSigned=function(){return this.isSelfSigned},B.prototype.GetSignIssuer=function(){return this.signIssuer},B.prototype.GetSignSerial=function(){return this.signSerial},B.prototype.GetSubjUNZR=function(){return this.subjUNZR},B.prototype.GetSubjCountry=function(){return this.subjCountry},B.prototype.IsQSCD=function(){return this.isQSCD};var V=function(){this.setClassInfo(`EndUserInfo`,3),this.fields={commonName:`string`,locality:`string`,state:`string`,organization:`string`,orgUnit:`string`,title:`string`,street:`string`,phone:`string`,surname:`string`,givenname:`string`,EMail:`string`,DNS:`string`,EDRPOUCode:`string`,DRFOCode:`string`,NBUCode:`string`,SPFMCode:`string`,OCode:`string`,OUCode:`string`,userCode:`string`,UPN:`string`,UNZR:`string`,country:`string`},this.initializeFields()};h.makeTransferable(V),V.prototype.GetCommonName=function(){return this.commonName},V.prototype.SetCommonName=function(e){this.commonName=e},V.prototype.GetLocality=function(){return this.locality},V.prototype.SetLocality=function(e){this.locality=e},V.prototype.GetState=function(){return this.state},V.prototype.SetState=function(e){this.state=e},V.prototype.GetOrganization=function(){return this.organization},V.prototype.SetOrganization=function(e){this.organization=e},V.prototype.GetOrgUnit=function(){return this.orgUnit},V.prototype.SetOrgUnit=function(e){this.orgUnit=e},V.prototype.GetTitle=function(){return this.title},V.prototype.SetTitle=function(e){this.title=e},V.prototype.GetStreet=function(){return this.street},V.prototype.SetStreet=function(e){this.street=e},V.prototype.GetPhone=function(){return this.phone},V.prototype.SetPhone=function(e){this.phone=e},V.prototype.GetSurname=function(){return this.surname},V.prototype.SetSurname=function(e){this.surname=e},V.prototype.GetGivenname=function(){return this.givenname},V.prototype.SetGivenname=function(e){this.givenname=e},V.prototype.GetEMail=function(){return this.EMail},V.prototype.SetEMail=function(e){this.EMail=e},V.prototype.GetDNS=function(){return this.DNS},V.prototype.SetDNS=function(e){this.DNS=e},V.prototype.GetEDRPOUCode=function(){return this.EDRPOUCode},V.prototype.SetEDRPOUCode=function(e){this.EDRPOUCode=e},V.prototype.GetDRFOCode=function(){return this.DRFOCode},V.prototype.SetDRFOCode=function(e){this.DRFOCode=e},V.prototype.GetNBUCode=function(){return this.NBUCode},V.prototype.SetNBUCode=function(e){this.NBUCode=e},V.prototype.GetSPFMCode=function(){return this.SPFMCode},V.prototype.SetSPFMCode=function(e){this.SPFMCode=e},V.prototype.GetOCode=function(){return this.OCode},V.prototype.SetOCode=function(e){this.OCode=e},V.prototype.GetOUCode=function(){return this.OUCode},V.prototype.SetOUCode=function(e){this.OUCode=e},V.prototype.GetUserCode=function(){return this.userCode},V.prototype.SetUserCode=function(e){this.userCode=e},V.prototype.GetUPN=function(){return this.UPN},V.prototype.SetUPN=function(e){this.UPN=e},V.prototype.GetUNZR=function(){return this.UNZR},V.prototype.SetUNZR=function(e){this.UNZR=e},V.prototype.GetCountry=function(){return this.country},V.prototype.SetCountry=function(e){this.country=e};var H=function(){this.setClassInfo(`EndUserParams`,1),this.fields={SN:`number`,commonName:`string`,locality:`string`,state:`string`,organization:`string`,orgUnit:`string`,title:`string`,street:`string`,phone:`string`,surname:`string`,givenname:`string`,EMail:`string`,DNS:`string`,EDRPOUCode:`string`,DRFOCode:`string`,NBUCode:`string`,SPFMCode:`string`,information:`string`,passPhrase:`string`,isPublishCertificate:`boolean`,RAAdminSN:`number`},this.initializeFields()};h.makeTransferable(H),H.prototype.GetSN=function(){return this.SN},H.prototype.SetSN=function(e){this.SN=e},H.prototype.GetCommonName=function(){return this.commonName},H.prototype.SetCommonName=function(e){this.commonName=e},H.prototype.GetLocality=function(){return this.locality},H.prototype.SetLocality=function(e){this.locality=e},H.prototype.GetState=function(){return this.state},H.prototype.SetState=function(e){this.state=e},H.prototype.GetOrganization=function(){return this.organization},H.prototype.SetOrganization=function(e){this.organization=e},H.prototype.GetOrgUnit=function(){return this.orgUnit},H.prototype.SetOrgUnit=function(e){this.orgUnit=e},H.prototype.GetTitle=function(){return this.title},H.prototype.SetTitle=function(e){this.title=e},H.prototype.GetStreet=function(){return this.street},H.prototype.SetStreet=function(e){this.street=e},H.prototype.GetPhone=function(){return this.phone},H.prototype.SetPhone=function(e){this.phone=e},H.prototype.GetSurname=function(){return this.surname},H.prototype.SetSurname=function(e){this.surname=e},H.prototype.GetGivenname=function(){return this.givenname},H.prototype.SetGivenname=function(e){this.givenname=e},H.prototype.GetEMail=function(){return this.EMail},H.prototype.SetEMail=function(e){this.EMail=e},H.prototype.GetDNS=function(){return this.DNS},H.prototype.SetDNS=function(e){this.DNS=e},H.prototype.GetEDRPOUCode=function(){return this.EDRPOUCode},H.prototype.SetEDRPOUCode=function(e){this.EDRPOUCode=e},H.prototype.GetDRFOCode=function(){return this.DRFOCode},H.prototype.SetDRFOCode=function(e){this.DRFOCode=e},H.prototype.GetNBUCode=function(){return this.NBUCode},H.prototype.SetNBUCode=function(e){this.NBUCode=e},H.prototype.GetSPFMCode=function(){return this.SPFMCode},H.prototype.SetSPFMCode=function(e){this.SPFMCode=e},H.prototype.GetInformation=function(){return this.information},H.prototype.SetInformation=function(e){this.information=e},H.prototype.GetPassPhrase=function(){return this.passPhrase},H.prototype.SetPassPhrase=function(e){this.passPhrase=e},H.prototype.GetIsPublishCertificate=function(){return this.isPublishCertificate},H.prototype.SetIsPublishCertificate=function(e){this.isPublishCertificate=e},H.prototype.GetRAAdminSN=function(){return this.RAAdminSN},H.prototype.SetRAAdminSN=function(e){this.RAAdminSN=e};var U=function(){this.setClassInfo(`EndUserOperationContext`,1),this.fields={handle:`string`},this.initializeFields(),this.handle=null};h.makeTransferable(U),U.prototype.GetHandle=function(){return this.handle};var W=function(){this.setClassInfo(`EndUserSession`,1),this.fields={handle:`string`,data:`byteArray`},this.initializeFields()};h.makeTransferable(W),W.prototype.GetHandle=function(){return this.handle},W.prototype.SetHandle=function(e){this.handle=e},W.prototype.GetData=function(){return this.data},W.prototype.SetData=function(e){this.data=e};var G=function(){this.setClassInfo(`EndUserSCClientStatistic`,1),this.fields={activeSessions:`number`,gatedSessions:`number`,unprotectedData:`number`,protectedData:`number`},this.initializeFields()};h.makeTransferable(G),G.prototype.GetActiveSessions=function(){return this.activeSessions},G.prototype.GetGatedSessions=function(){return this.gatedSessions},G.prototype.GetUnprotectedData=function(){return this.unprotectedData},G.prototype.GetProtectedData=function(){return this.protectedData};var K=function(){this.setClassInfo(`EndUserDeviceContext`,1),this.fields={handle:`string`},this.initializeFields(),this.handle=null};h.makeTransferable(K),K.prototype.GetHandle=function(){return this.handle};var q=function(){this.setClassInfo(`EndUserTransportHeader`,1),this.fields={receiptNumber:`number`,cryptoData:`byteArray`},this.initializeFields()};h.makeTransferable(q),q.prototype.GetReceiptNumber=function(){return this.receiptNumber},q.prototype.GetCryptoData=function(){return this.cryptoData};var J=function(){this.setClassInfo(`EndUserCryptoHeader`,1),this.fields={caType:`string`,headerType:`number`,headerSize:`number`,cryptoData:`byteArray`},this.initializeFields()};h.makeTransferable(J),J.prototype.GetCAType=function(){return this.caType},J.prototype.GetHeaderType=function(){return this.headerType},J.prototype.GetHeaderSize=function(){return this.headerSize},J.prototype.GetCryptoData=function(){return this.cryptoData};var ee=function(){this.setClassInfo(`EndUserContext`,1),this.fields={handle:`string`},this.initializeFields()};h.makeTransferable(ee),ee.prototype.GetHandle=function(){return this.handle};var te=function(){this.setClassInfo(`EndUserHashContext`,1),this.fields={handle:`string`},this.initializeFields()};h.makeTransferable(te),te.prototype.GetHandle=function(){return this.handle};var ne=function(){this.setClassInfo(`EndUserPrivateKeyContext`,1),this.fields={handle:`string`,ownerInfo:`EndUserOwnerInfo`},this.initializeFields()};h.makeTransferable(ne),ne.prototype.GetHandle=function(){return this.handle},ne.prototype.GetOwnerInfo=function(){return this.ownerInfo};var Y=function(e,t){this.setClassInfo(`EndUserReference`,1),this.fields={name:`string`,data:`byteArray`},this.initializeFields(),this.name=e,this.data=t};h.makeTransferable(Y),Y.prototype.GetName=function(){return this.name},Y.prototype.SetName=function(e){this.name=e},Y.prototype.GetData=function(){return this.data},Y.prototype.SetData=function(e){this.data=e};var re=function(e,t,n,r,i){this.setClassInfo(`EndUserSSSignHashResult`,1),this.fields={error:`number`,hash:`string`,signature:`string`,statusCode:`number`,status:`string`},this.initializeFields(),this.error=e,this.hash=t,this.signature=n,this.statusCode=r,this.status=i};h.makeTransferable(re),re.prototype.GetError=function(){return this.error},re.prototype.GetHash=function(){return this.hash},re.prototype.GetSignature=function(){return this.signature},re.prototype.GetStatusCode=function(){return this.statusCode},re.prototype.GetStatus=function(){return this.status};var ie=function(){this.setClassInfo(`EndUserMakeCertificateResult`,1),this.fields={privateKey:`byteArray`,certificates:`array`,cmpRequest:`byteArray`},this.initializeFields()};h.makeTransferable(ie),ie.prototype.GetPrivateKey=function(){return this.privateKey},ie.prototype.GetCertificate=function(e){return e<0||e>=this.certificates.length?null:this.certificates[e]},ie.prototype.GetCertificatesCount=function(){return this.certificates.length},ie.prototype.GetCertificates=function(){return this.certificates},ie.prototype.GetCMPRequest=function(){return this.cmpRequest};var X=function(){this.setClassInfo(`EndUserKeyMediaDeviceInfo`,1),this.fields={version:`number`,deviceNameAlias:`string`,isDeviceNameAliasAvailable:`boolean`,isPasswordAttemptsAvailable:`boolean`,leftPasswordAttempts:`number`,maxPasswordAttempts:`number`,isUAKeysAvailable:`boolean`,isUAKeysExists:`boolean`},this.initializeFields()};h.makeTransferable(X),X.prototype.GetVersion=function(){return this.version},X.prototype.GetDeviceNameAlias=function(){return this.deviceNameAlias},X.prototype.IsDeviceNameAliasAvailable=function(){return this.isDeviceNameAliasAvailable},X.prototype.IsPasswordAttemptsAvailable=function(){return this.isPasswordAttemptsAvailable},X.prototype.GetLeftPasswordAttempts=function(){return this.leftPasswordAttempts},X.prototype.GetMaxPasswordAttempts=function(){return this.maxPasswordAttempts},X.prototype.IsUAKeysAvailable=function(){return this.isUAKeysAvailable},X.prototype.IsUAKeysExists=function(){return this.isUAKeysExists};var Z=function(e,t){this.errorCode=e,this.message=t,this.toString=function(){return this.message+` (`+this.errorCode+`)`},this.GetErrorCode=function(){return this.errorCode},this.GetMessage=function(){return this.message}};function Q(e,t){this.errorCode=e,this.message=t,this.toString=function(){return this.message+` (`+this.errorCode+`)`},this.GetErrorCode=function(){return this.errorCode},this.GetMessage=function(){return this.message}}Z.ERROR_NONE=0,Z.ERROR_UNKNOWN=65535,Z.ERROR_NOT_SUPPORTED=65534,Z.ERROR_NOT_INITIALIZED=1,Z.ERROR_BAD_PARAMETER=2,Z.ERROR_LIBRARY_LOAD=3,Z.ERROR_READ_SETTINGS=4,Z.ERROR_TRANSMIT_REQUEST=5,Z.ERROR_MEMORY_ALLOCATION=6,Z.WARNING_END_OF_ENUM=7,Z.ERROR_PROXY_NOT_AUTHORIZED=8,Z.ERROR_NO_GUI_DIALOGS=9,Z.ERROR_DOWNLOAD_FILE=10,Z.ERROR_WRITE_SETTINGS=11,Z.ERROR_CANCELED_BY_GUI=12,Z.ERROR_OFFLINE_MODE=13,Z.ERROR_KEY_MEDIAS_FAILED=17,Z.ERROR_KEY_MEDIAS_ACCESS_FAILED=18,Z.ERROR_KEY_MEDIAS_READ_FAILED=19,Z.ERROR_KEY_MEDIAS_WRITE_FAILED=20,Z.WARNING_KEY_MEDIAS_READ_ONLY=21,Z.ERROR_KEY_MEDIAS_DELETE=22,Z.ERROR_KEY_MEDIAS_CLEAR=23,Z.ERROR_BAD_PRIVATE_KEY=24,Z.ERROR_PKI_FORMATS_FAILED=33,Z.ERROR_CSP_FAILED=34,Z.ERROR_BAD_SIGNATURE=35,Z.ERROR_AUTH_FAILED=36,Z.ERROR_NOT_RECEIVER=37,Z.ERROR_STORAGE_FAILED=49,Z.ERROR_BAD_CERT=50,Z.ERROR_CERT_NOT_FOUND=51,Z.ERROR_INVALID_CERT_TIME=52,Z.ERROR_CERT_IN_CRL=53,Z.ERROR_BAD_CRL=54,Z.ERROR_NO_VALID_CRLS=55,Z.ERROR_GET_TIME_STAMP=65,Z.ERROR_BAD_TSP_RESPONSE=66,Z.ERROR_TSP_SERVER_CERT_NOT_FOUND=67,Z.ERROR_TSP_SERVER_CERT_INVALID=68,Z.ERROR_GET_OCSP_STATUS=81,Z.ERROR_BAD_OCSP_RESPONSE=82,Z.ERROR_CERT_BAD_BY_OCSP=83,Z.ERROR_OCSP_SERVER_CERT_NOT_FOUND=84,Z.ERROR_OCSP_SERVER_CERT_INVALID=85,Z.ERROR_LDAP_ERROR=97,Z.ERROR_LIBRARY_COMUNICATION_FAILED=4097,Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED=4098,Z.ERROR_BROWSER_NOT_SUPPORTED=65537,Z.ERROR_OPEN_FILE=65552,Z.ERROR_READ_FILE=65553,Z.ERROR_WRITE_FILE=65554,Z.ERROR_DESCRIPTIONS_EX=[],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_NONE]=[`Виконано успішно`,`Выполнено успешно`,`Executed successfully`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_NOT_SUPPORTED]=[`Операція не підтримується`,`Операция не поддерживается`,`Operation is not supported`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_UNKNOWN]=[`Невідома помилка`,`Неизвестная ошибка`,`Unknown error`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_LIBRARY_LOAD]=[`Виникла помилка при завантаженні криптографічної бібліотеки`,`Возникла ошибка при загрузке криптографической библиотеки`,`Error at load crypto library`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_NOT_INITIALIZED]=[`Бібліотека не ініціалізована`,`Библиотека не инициализирована`,`Library is not initialized`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_BAD_PARAMETER]=[`Невірний параметр`,`Неверный параметр`,`Incorrect parameter`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_BAD_CERT]=[`Сертифікат пошкоджений або не може бути використаний`,`Сертификат поврежден или не может быть использован`,`Certificate corrupted or cannot be used`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_CERT_NOT_FOUND]=[`Сертифікат не знайдено`,`Сертификат не найден`,`Certificate not found`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_TRANSMIT_REQUEST]=[`Виникла помилка при передачі запиту на сервер ЦСК за протоколом HTTP`,`Возникла ошибка при передаче запроса на сервер ЦСК по протоколу HTTP`,`Error at request transfer to CA's server by HTTP protocol`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_DOWNLOAD_FILE]=[`Виникла помилка при завантаженні файлу з HTTP-сервера`,`Возникла ошибка при загрузке файла с HTTP-сервера`,`Error at the load of file from a HTTP-server`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_WRITE_SETTINGS]=[`Виникла помилка при записі параметрів`,`Возникла ошибка при записи параметров`,`Error at the writing settings`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_PKI_FORMATS_FAILED]=[`Виникла помилка при розборі чи формуванні даних (пошкоджені дані чи невірний формат)`,`Возникла ошибка при разборе или формировании данных (поврежденные данные или неверный формат)`,`Error at parsing or generating data (data corrupted or wrong format)`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_LIBRARY_COMUNICATION_FAILED]=[`Виникла помилка при взаємодії з криптографічною бібліотекою`,`Возникла ошибка при взаимодействии с криптографической библиотекой`,`Error at comunication with crypto library`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED]=[`Встановлена версія бібліотеки не підтримується`,`Установленная версия библиотеки не поддерживается`,`The installed version of the library is not supported`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_BROWSER_NOT_SUPPORTED]=[`Ваш браузер не підтримується`,`Ваш браузер не поддерживается`,`Your browser is not supported`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_OPEN_FILE]=[`Виникла помилка при відкритті файлу`,`Возникла ошибка при открытии файла`,`Error at open file`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_READ_FILE]=[`Виникла помилка при зчитуванні файлу`,`Возникла ошибка при чтении файла`,`Error at read file`],Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_WRITE_FILE]=[`Виникла помилка при записі файлу`,`Возникла ошибка при записи файла`,`Error at write file`],Z.isError=function(e){return e!=Z.ERROR_NONE},Z.isSuccess=function(e){return e==Z.ERROR_NONE},Z.getErrorDescriptionEx=function(e,t){var n,r;return(n=Z.ERROR_DESCRIPTIONS_EX[e])===void 0&&(n=Z.ERROR_DESCRIPTIONS_EX[Z.ERROR_UNKNOWN]),(r=n[t-1])===void 0?n[0]:r};var $=function(t,n){this.vendor=`JSC IIT`,this.classVersion=`1.3.99`,this.className=`EUSignCP`,this.SUBJECT_TYPE_UNDIFFERENCED=0,this.SUBJECT_TYPE_CA=1,this.SUBJECT_TYPE_CA_SERVER=2,this.SUBJECT_TYPE_RA_ADMINISTRATOR=3,this.SUBJECT_TYPE_END_USER=4,this.EU_SUBJECT_TYPE_UNDIFFERENCED=this.SUBJECT_TYPE_UNDIFFERENCED,this.EU_SUBJECT_TYPE_CA=this.SUBJECT_TYPE_CA,this.EU_SUBJECT_TYPE_CA_SERVER=this.SUBJECT_TYPE_CA_SERVER,this.EU_SUBJECT_TYPE_RA_ADMINISTRATOR=this.SUBJECT_TYPE_RA_ADMINISTRATOR,this.EU_SUBJECT_TYPE_END_USER=this.SUBJECT_TYPE_END_USER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED=0,this.SUBJECT_CA_SERVER_SUB_TYPE_CMP=1,this.SUBJECT_CA_SERVER_SUB_TYPE_TSP=2,this.SUBJECT_CA_SERVER_SUB_TYPE_OCSP=3,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED=this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_CMP=this.SUBJECT_CA_SERVER_SUB_TYPE_CMP,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_TSP=this.SUBJECT_CA_SERVER_SUB_TYPE_TSP,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_OCSP=this.SUBJECT_CA_SERVER_SUB_TYPE_OCSP,this.CERT_KEY_TYPE_UNKNOWN=0,this.CERT_KEY_TYPE_DSTU4145=1,this.CERT_KEY_TYPE_RSA=2,this.CERT_KEY_TYPE_ECDSA=4,this.EU_CERT_KEY_TYPE_UNKNOWN=this.CERT_KEY_TYPE_UNKNOWN,this.EU_CERT_KEY_TYPE_DSTU4145=this.CERT_KEY_TYPE_DSTU4145,this.EU_CERT_KEY_TYPE_RSA=this.CERT_KEY_TYPE_RSA,this.EU_CERT_KEY_TYPE_ECDSA=this.CERT_KEY_TYPE_ECDSA,this.EU_CERT_HASH_TYPE_UNKNOWN=0,this.EU_CERT_HASH_TYPE_GOST34311=1,this.EU_CERT_HASH_TYPE_SHA1=2,this.EU_CERT_HASH_TYPE_SHA224=3,this.EU_CERT_HASH_TYPE_SHA256=4,this.EU_CERT_HASH_TYPE_SHA384=5,this.EU_CERT_HASH_TYPE_SHA512=6,this.EU_CERT_HASH_TYPE_DSTU7564_256=7,this.EU_CERT_HASH_TYPE_DSTU7564_384=8,this.EU_CERT_HASH_TYPE_DSTU7564_512=9,this.KEY_USAGE_UNKNOWN=0,this.KEY_USAGE_DIGITAL_SIGNATUR=1,this.KEY_KEY_USAGE_KEY_AGREEMENT=16,this.EU_KEY_USAGE_UNKNOWN=this.KEY_USAGE_UNKNOWN,this.EU_KEY_USAGE_DIGITAL_SIGNATURE=this.KEY_USAGE_DIGITAL_SIGNATUR,this.EU_KEY_USAGE_NON_REPUDATION=2,this.EU_KEY_USAGE_KEY_AGREEMENT=this.KEY_KEY_USAGE_KEY_AGREEMENT,this.EU_KEYS_REQUEST_TYPE_UA_DS=1,this.EU_KEYS_REQUEST_TYPE_UA_KEP=2,this.EU_KEYS_REQUEST_TYPE_INTERNATIONAL=3,this.EU_KEYS_TYPE_NONE=0,this.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_GOSTS=1,this.EU_KEYS_TYPE_RSA_WITH_SHA=2,this.EU_KEYS_TYPE_ECDSA_WITH_SHA=4,this.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_DSTU=8,this.EU_KEYS_LENGTH_DS_UA_191=1,this.EU_KEYS_LENGTH_DS_UA_257=2,this.EU_KEYS_LENGTH_DS_UA_307=3,this.EU_KEYS_LENGTH_DS_UA_FILE=4,this.EU_KEYS_LENGTH_DS_UA_CERT=5,this.EU_KEYS_LENGTH_KEP_UA_257=1,this.EU_KEYS_LENGTH_KEP_UA_431=2,this.EU_KEYS_LENGTH_KEP_UA_571=3,this.EU_KEYS_LENGTH_KEP_UA_FILE=4,this.EU_KEYS_LENGTH_KEP_UA_CERT=5,this.EU_KEYS_LENGTH_DS_RSA_1024=1,this.EU_KEYS_LENGTH_DS_RSA_2048=2,this.EU_KEYS_LENGTH_DS_RSA_3072=3,this.EU_KEYS_LENGTH_DS_RSA_4096=4,this.EU_KEYS_LENGTH_DS_RSA_FILE=5,this.EU_KEYS_LENGTH_DS_RSA_CERT=6,this.EU_KEYS_LENGTH_DS_ECDSA_192=1,this.EU_KEYS_LENGTH_DS_ECDSA_256=2,this.EU_KEYS_LENGTH_DS_ECDSA_384=3,this.EU_KEYS_LENGTH_DS_ECDSA_521=4,this.EU_KEYS_LENGTH_DS_ECDSA_FILE=5,this.EU_KEYS_LENGTH_DS_ECDSA_CERT=6,this.EU_RECIPIENT_APPEND_ISSUER_AND_SERIAL=1,this.EU_RECIPIENT_APPEND_KEY_ID=2,this.EU_RECIPIENT_APPEND_KEY_ID_USC_COMPAT=3,this.EU_SAVE_SETTINGS_PARAMETER=`SaveSettings`,this.EU_RESOLVE_OIDS_PARAMETER=`ResolveOIDs`,this.EU_MAKE_PKEY_PFX_CONTAINER_PARAMETER=`MakePKeyPFXContainer`,this.EU_SIGN_INCLUDE_CONTENT_TIME_STAMP_PARAMETER=`SignIncludeContentTimeStamp`,this.EU_SIGN_TYPE_PARAMETER=`SignType`,this.EU_SIGN_INCLUDE_CA_CERTIFICATES_PARAMETER=`SignIncludeCACertificates`,this.EU_FS_CALCULATE_FINGERPRINT=`FSCalculateFingerprint`,this.EU_FORCE_USE_TSP_FROM_SETTINGS_PARAMETER=`ForceUseTSPFromSettings`,this.EU_STRING_ENCODING_PARAMETER=`StringEncoding`,this.EU_CHECK_CERT_CHAIN_ON_SIGN_TIME_PARAMETER=`CheckCertChainOnSignTime`,this.EU_CONNECTIONS_TIMEOUT_PARAMETER=`ConnectionsTimeout`,this.EU_LOG_EVENTS_THRESHOLD_PARAMETER=`LogEventsThreshold`,this.EU_USE_SLOGIN_PRIVATE_KEY=`UseSLoginPrivateKey`,this.EU_SETTINGS_ID_NONE=0,this.EU_SETTINGS_ID_MANDATORY=31,this.EU_SETTINGS_ID_ALL=1023,this.EU_SETTINGS_ID_FSTORE=1,this.EU_SETTINGS_ID_PROXY=2,this.EU_SETTINGS_ID_TSP=4,this.EU_SETTINGS_ID_OCSP=8,this.EU_SETTINGS_ID_LDAP=16,this.EU_SETTINGS_ID_MODE=32,this.EU_SETTINGS_ID_CMP=64,this.EU_SETTINGS_ID_KM=128,this.EU_SETTINGS_ID_OCSP_ACCESS_INFO_MODE=256,this.EU_SETTINGS_ID_OCSP_ACCESS_INFO=512,this.EU_SETTINGS_ID_TSL=1024,this.EU_SETTINGS_ID_LOG=2048,this.EU_HEADER_CA_TYPE=`UA1`,this.EU_HEADER_PART_TYPE_SIGNED=1,this.EU_HEADER_PART_TYPE_ENCRYPTED=2,this.EU_HEADER_PART_TYPE_STAMPED=3,this.EU_HEADER_PART_TYPE_CERTCRYPT=4,this.EU_HEADER_MAX_CA_TYPE_SIZE=3,this.EU_SIGNED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_SIGNED,this.EU_ENCRYPTED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_ENCRYPTED,this.EU_TIMESTAMPED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_STAMPED,this.EU_CERTCRYPT_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_CERTCRYPT,this.EU_DEFAULT_LANG=0,this.EU_UA_LANG=1,this.EU_RU_LANG=2,this.EU_EN_LANG=3,this.EU_CONTENT_ENC_ALGO_DEFAULT=0,this.EU_CONTENT_ENC_ALGO_GOST28147_CFB=2,this.EU_CONTENT_ENC_ALGO_TDES_CBC=4,this.EU_CONTENT_ENC_ALGO_AES_128_CBC=5,this.EU_CONTENT_ENC_ALGO_AES_192_CBC=6,this.EU_CONTENT_ENC_ALGO_AES_256_CBC=7,this.EU_CONTENT_ENC_ALGO_DSTU7624_256_OFB=8,this.EU_CONTENT_ENC_ALGO_DSTU7624_256_CFB=9,this.EU_DEV_CTX_MIN_PUBLIC_DATA_ID=16,this.EU_DEV_CTX_MAX_PRIVATE_DATA_ID=175,this.EU_UA_OID_EXT_KEY_USAGE_STAMP=`1.2.804.2.1.1.1.3.9`,this.EU_CCS_TYPE_REVOKE=1,this.EU_CCS_TYPE_HOLD=2,this.EU_REVOCATION_REASON_UNKNOWN=0,this.EU_REVOCATION_REASON_KEY_COMPROMISE=1,this.EU_REVOCATION_REASON_NEW_ISSURED=2,this.EU_SIGN_TYPE_UNKNOWN=0,this.EU_SIGN_TYPE_CADES_BES=1,this.EU_SIGN_TYPE_CADES_T=4,this.EU_SIGN_TYPE_CADES_C=8,this.EU_SIGN_TYPE_CADES_X_LONG=16,this.EU_SIGN_TYPE_CADES_X_LONG_TRUSTED=128,this.EU_CHECK_PRIVATE_KEY_CONTEXT_PARAMETER=`CheckPrivateKey`,this.EU_RESOLVE_OIDS_CONTEXT_PARAMETER=`ResolveOIDs`,this.EU_EXPORATABLE_CONTEXT_CONTEXT_PARAMETER=`ExportableContext`,this.EU_ENCODE_ECDSA_SIGN_VALUE_CONTEXT_PARAMETER=`EncodeECDSASignValue`,this.EU_USE_SLOGIN_PRIVATE_KEY_CONTEXT_PARAMETER=`UseSLoginPrivateKey`,this.EU_RECIPIENT_APPEND_TYPE_BY_ISSUER_SERIAL=1,this.EU_RECIPIENT_APPEND_TYPE_BY_KEY_ID=2,this.EU_CTX_HASH_ALGO_UNKNOWN=0,this.EU_CTX_HASH_ALGO_GOST34311=1,this.EU_CTX_HASH_ALGO_SHA160=2,this.EU_CTX_HASH_ALGO_SHA224=3,this.EU_CTX_HASH_ALGO_SHA256=4,this.EU_CTX_HASH_ALGO_SHA384=5,this.EU_CTX_HASH_ALGO_SHA512=6,this.EU_CTX_HASH_ALGO_DSTU7564_256=7,this.EU_CTX_HASH_ALGO_DSTU7564_384=8,this.EU_CTX_HASH_ALGO_DSTU7564_512=9,this.EU_CTX_SIGN_UNKNOWN=0,this.EU_CTX_SIGN_DSTU4145_WITH_GOST34311=1,this.EU_CTX_SIGN_RSA_WITH_SHA=2,this.EU_CTX_SIGN_ECDSA_WITH_SHA=3,this.EU_CTX_SIGN_DSTU4145_WITH_DSTU7564=4,this.EU_FILE_PROCESS_CHUNK_SIZE=1048576,this.EU_ASIC_TYPE_UNKNOWN=0,this.EU_ASIC_TYPE_S=1,this.EU_ASIC_TYPE_E=2,this.EU_ASIC_SIGN_TYPE_UNKNOWN=0,this.EU_ASIC_SIGN_TYPE_CADES=1,this.EU_ASIC_SIGN_TYPE_XADES=2,this.EU_ASIC_SIGN_LEVEL_BES=1,this.EU_ASIC_SIGN_LEVEL_T=4,this.EU_ASIC_SIGN_LEVEL_C=8,this.EU_ASIC_SIGN_LEVEL_X_LONG=16,this.EU_ASIC_SIGN_LEVEL_X_LONG_TRUSTED=128,this.EU_XADES_SIGN_TYPE_UNKNOWN=0,this.EU_XADES_TYPE_DETACHED=1,this.EU_XADES_TYPE_ENVELOPING=2,this.EU_XADES_TYPE_ENVELOPED=3,this.EU_XADES_SIGN_LEVEL_BES=1,this.EU_XADES_SIGN_LEVEL_T=4,this.EU_XADES_SIGN_LEVEL_B_LT=16,this.EU_XADES_SIGN_LEVEL_B_LTA=32,this.EU_PADES_SIGN_LEVEL_B_B=1,this.EU_PADES_SIGN_LEVEL_B_T=4,this.EU_PADES_SIGN_LEVEL_B_LT=16,this.EU_PADES_SIGN_LEVEL_B_LTA=32,this.EU_CP_ACP_ENCODING=0,this.EU_CP_1251_ENCODING=1251,this.EU_UTF8_ENCODING=65001,this.m_language=this.EU_DEFAULT_LANG,this.m_lastErrorCode=Z.ERROR_NONE,this.m_lastError=``,this.m_charset=`UTF-8`,this.m_stringCoder=new e,this.m_base64Coder=new a,this.m_dateCoder=new i,this.m_browserInfo=new s;var r=1;switch(t){case`chrome-extension://jffafkigfgmjafhpkoibhfefeaebmccg/`:r=2,this.m_browserInfo.GetName()==s.BROWSER_NAME_FIREFOX&&(t=`eusw@iit.com.ua`);break;case`clsid:B7E24C75-E343-4DA2-A8D3-C80970FB7D7B`:r=4;break;case`application/x-eusign-cp`:r=3}this.m_jsonRpcClient=new l(r,t,n,window.location.protocol!=`http:`),this.m_monitorLibraryTimer=null};return $.prototype._funcMakeParams=function(e){var t=[];e??=[];for(var n=function(e){if(m(e))return e.encode();if(Array.isArray(e)){for(var t=e.length,r=[],i=0;i<t;i++)r[i]=n(e[i]);return r}return e},r=e.length,i=0;i<r;i++)t[i]=n(e[i]);return t},$.prototype._funcCall=function(e,t,n,r,i){var a;if(!this.IsAsync(n,r))return a=this.m_jsonRpcClient.execute(e,t,null),a=this._funcHandleResult(a),i?i(a):a;var o=i==null?n:function(e){i(e,n,r)},s=this;this.m_jsonRpcClient.execute(e,t,function(e){s._funcHandleResult(e,o,r)})},$.prototype._funcHandleResult=function(e,t,n){var r,i,a=this.IsAsync(t,n);if(e==null){if(r=this.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``),a)return void n(r);throw new Q(r.errorCode,r.message)}if(i=(r=e.error).code,Z.isError(i)){if(i==Z.WARNING_END_OF_ENUM)return a?void t(null):null;if(r=this.MakeError(i,r.message),a)return void n(r);throw new Q(r.errorCode,r.message)}try{e=this._funcDecodeResult(e.result)}catch{if(r=this.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``),a)return void n(r);throw new Q(r.errorCode,r.message)}if(!a)return e;t(e)},$.prototype._funcDecodeResult=function(e){if(e==null)return null;var t=function(e){if(Array.isArray(e)){for(var n=[],r=e.length,i=0;i<r;i++)n[i]=t(e[i]);return n}if(typeof e==`object`){var a;return(a=new h[e.className]).decode(e)?a.className==`EndUserByteArray`?a.GetData():a:null}return e};return t(e)},$.prototype._checkVersion=function(e){try{var t=this.classVersion;if(t==e)return!0;if(t=t.split(`.`),e=e.split(`.`),t.length!=e.length)return!1;for(var n=0;n<e.length;n++)if(parseInt(t[n])>parseInt(e[n]))return!1}catch{return!1}return!0},$.prototype._stringToBytes=function(e,t){try{return this.m_stringCoder.encode(e)}catch{var n=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(t!==void 0)return setTimeout(function(){t(n)},1),null;throw new Q(n.errorCode,n.message)}},$.prototype._bytesToString=function(e,t){try{return this.m_stringCoder.decode(e)}catch{var n=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(t!==void 0)return setTimeout(function(){t(n)},1),null;throw new Q(n.errorCode,n.message)}},$.prototype._base64Encode=function(e,t){try{return this.m_base64Coder.encode(e)}catch{var n=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(t!==void 0)return setTimeout(function(){t(n)},1),null;throw new Q(n.errorCode,n.message)}},$.prototype._base64Decode=function(e,t){try{return this.m_base64Coder.decode(e)}catch{var n=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(t!==void 0)return setTimeout(function(){t(n)},1),null;throw new Q(n.errorCode,n.message)}},$.prototype._copyArrayData=function(e,t){try{if(e.length!=t.length)return!1;if(Array.isArray(t)||Array.isArray(e))for(var n=0;n<t.length;n++)e[n]=t[n];else e.set(t);return!0}catch{return!1}},$.prototype._startMonitorLibraryStatus=function(){var e=this;try{e.m_monitorLibraryTimer=setInterval(function(){e.IsInitialized(function(t){t||e._stopMonitorLibraryStatus()},function(t){e._stopMonitorLibraryStatus()})},6e5)}catch{}},$.prototype._stopMonitorLibraryStatus=function(){try{if(this.m_monitorLibraryTimer==null)return;clearInterval(this.m_monitorLibraryTimer),this.m_monitorLibraryTimer=null}catch{}},$.prototype._getAndroidAppIntentURL=function(e,t){var n=`intent://addurlandstart?url={URL_LOCATION}#Intent;scheme=saclient;package=ua.com.iit.signagentmanagement;S.browser_fallback_url={URL_INSTALL};end;`;return n=(n=n.replace(`{URL_LOCATION}`,encodeURIComponent(location.origin))).replace(`{URL_INSTALL}`,encodeURIComponent(e+`/`+t))},$.prototype.IsAsync=function(e,t){return e!==void 0&&t!==void 0},$.prototype.MakeError=function(e,t){return t==``&&(t=Z.getErrorDescriptionEx(e,this.m_language)),this.m_lastErrorCode=e,this.m_lastError=t,new Z(e,t)},$.prototype.RaiseError=function(e,t){var n;throw new Q((n=this.MakeError(e,t)).errorCode,n.message)},$.prototype.GetInstallURL=function(e,t){var n=this,r=n.m_browserInfo.GetOSName(),i=n.m_browserInfo.GetArch(),a=[];t||=`https://iit.com.ua/download/productfiles`;var o,c=function(e){a.push(t+`/`+e)};switch(r){case s.OS_NAME_WINDOWS:c(`EUSignWebInstall.exe`);break;case s.OS_NAME_MAC:c(`EUSignWebInstall.pkg`);break;case s.OS_NAME_LINUX:i==s.BROWSER_ARCH_NAME_X86?(c(`euswi.deb`),c(`euswi.rpm`),c(`euswi.tar`)):(c(`euswi.64.deb`),c(`euswi.64.rpm`),c(`euswi.64.tar`));break;case s.OS_NAME_ANDROID:o=`EUSignWebInstall.apk`,a.push(n._getAndroidAppIntentURL(t,o));break;case s.OS_NAME_IOS:c(`EUSignWebInstall.app`);break;default:return null}return e?a:a[0]},$.prototype.GetUpdateURL=function(e,t){var n=this,r=n.m_browserInfo.GetOSName(),i=n.m_browserInfo.GetArch(),a=[];t||=`https://iit.com.ua/download/productfiles`;var o,c=function(e){a.push(t+`/`+e)};switch(r){case s.OS_NAME_WINDOWS:c(`EUSignWebUpdate.exe`);break;case s.OS_NAME_MAC:c(`EUSignWebInstall.pkg`);break;case s.OS_NAME_LINUX:i==s.BROWSER_ARCH_NAME_X86?(c(`euswi.deb`),c(`euswi.rpm`),c(`euswi.tar`)):(c(`euswi.64.deb`),c(`euswi.64.rpm`),c(`euswi.64.tar`));break;case s.OS_NAME_ANDROID:o=`EUSignWebInstall.apk`,a.push(n._getAndroidAppIntentURL(t,o));break;case s.OS_NAME_IOS:c(`EUSignWebInstall.app`);break;default:return null}return e?a:a[0]},$.prototype.GetHelpURL=function(e){switch(e||=`https://iit.com.ua/download/productfiles`,this.m_browserInfo.GetOSName()){case s.OS_NAME_WINDOWS:case s.OS_NAME_MAC:case s.OS_NAME_LINUX:return e+`/EUSignWebOManual.pdf`;default:return null}},$.prototype.GetWebExtensionInstallURL=function(){switch(this.m_browserInfo.GetName()){case s.BROWSER_NAME_CHROME:return`https://chrome.google.com/webstore/detail/%D1%96%D1%96%D1%82-%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D1%83%D0%B2%D0%B0%D1%87-%D1%86%D1%81%D0%BA-1-%D0%B1%D1%96%D0%B1%D0%BB/jffafkigfgmjafhpkoibhfefeaebmccg?utm_source=chrome-app-launcher-info-dialog`;case s.BROWSER_NAME_FIREFOX:return`https://eu.iit.com.ua/download/productfiles/eusw@iit.com.ua.xpi`;case s.BROWSER_NAME_OPERA:return`https://chrome.google.com/webstore/detail/%D1%96%D1%96%D1%82-%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D1%83%D0%B2%D0%B0%D1%87-%D1%86%D1%81%D0%BA-1-%D0%B1%D1%96%D0%B1%D0%BB/jffafkigfgmjafhpkoibhfefeaebmccg?utm_source=chrome-app-launcher-info-dialog`;default:return null}},$.prototype.GetInstallPath=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetInstallPath`,n,e,t,null)},$.prototype.SelectFile=function(e,t,n,r){return this.SelectFileEx(e,t,null,null,null,null,n,r)},$.prototype.SelectFileEx=function(e,t,n,r,i,a,o,s){var c;return c=this._funcMakeParams([e,t,n,r,i,a]),this._funcCall(`SelectFile`,c,o,s,null)},$.prototype.SelectFolder=function(e,t){return this.SelectFolderEx(null,null,null,e,t)},$.prototype.SelectFolderEx=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`SelectFolder`,a,r,i,null)},$.prototype.CreateFolder=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`CreateFolder`,r,t,n,null)},$.prototype.ReadFile=function(e,t,n){var r=this.IsAsync(t,n),i=this,a=i.EU_FILE_PROCESS_CHUNK_SIZE;if(!r){for(var o,s=i.GetFileSize(e),c=Math.floor(s/a),l=s%a,u=new Uint8Array(s),d=0;d<c;d++)o=i.ReadFileWithOffset(e,d*a,a),u.set(o,d*a,o.length);return l!=0&&(o=i.ReadFileWithOffset(e,c*a,l),u.set(o,c*a,o.length)),u}var f={buf:null,length:0,curLength:0},p=function(r){if(r.curLength!=r.length){var o=r.length-r.curLength;o>a&&(o=a),i.ReadFileWithOffset(e,r.curLength,o,function(e){r.buf.set(e,r.curLength,e.length),r.curLength+=e.length,p(r)},n)}else t(r.buf)};i.GetFileSize(e,function(e){f.buf=new Uint8Array(e),f.length=e,p(f)},n)},$.prototype.WriteFile=function(e,t,n,r){var i=this.IsAsync(n,r),a=this,o=a.EU_FILE_PROCESS_CHUNK_SIZE;if(i){var s={buf:null,length:0,curLength:0},c=function(t,i){if(i||t.curLength!=t.length){var s=t.length-t.curLength;s>o&&(s=o),a.WriteFileWithOffset(e,t.curLength,a.Copy(t.buf,t.curLength,o),function(){t.curLength+=s,c(t,!1)},r)}else n()};s.buf=t,s.length=t.length,c(s,!0)}else{for(var l=t.length,u=Math.floor(l/o),d=l%o,f=0;f<u;f++)a.WriteFileWithOffset(e,f*o,a.Copy(t,f*o,o));d==0&&t.length!=0||a.WriteFileWithOffset(e,u*o,a.Copy(t,u*o,d))}},$.prototype.GetFileSize=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetFileSize`,r,t,n,null)},$.prototype.ReadFileWithOffset=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`ReadFileWithOffset`,a,r,i,null)},$.prototype.WriteFileWithOffset=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`WriteFileWithOffset`,a,r,i,null)},$.prototype.DeleteFile=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`DeleteFile`,r,t,n,null)},$.prototype.AppendFile=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`AppendFile`,i,n,r,null)},$.prototype.CopyFileWithOffset=function(e,t,n,r,i,a){var o=this._funcMakeParams([e,t,n,r]);this._funcCall(`CopyFileWithOffset`,o,i,a,null)},$.prototype.Load=function(e,t){var n=this.IsAsync(e,t),r=this;if(n)this.GetVersion(function(n){r._checkVersion(n)?e():t(r.MakeError(Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED,``))},function(e){e=r.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``),t(e)});else{var i;try{i=this._checkVersion(this.GetVersion())}catch{this.RaiseError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``)}i||this.RaiseError(Z.ERROR_LIBRARY_VERSION_NOT_SUPPORTED,``)}},$.prototype.GetVersion=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetVersion`,n,e,t,null)},$.prototype.IsInitialized=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`IsInitialized`,n,e,t,null)},$.prototype.Initialize=function(e,t){var n,r=this,i=this.IsAsync(e,t);n=this._funcMakeParams(null),this._funcCall(`Initialize`,n,i?function(){r._startMonitorLibraryStatus(),e()}:e,t,null),i||r._startMonitorLibraryStatus()},$.prototype.Finalize=function(e,t){var n;this._stopMonitorLibraryStatus(),n=this._funcMakeParams(null),this._funcCall(`Finalize`,n,e,t,null)},$.prototype.ResetOperation=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ResetOperation`,n,e,t,null)},$.prototype.SetUIMode=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetUIMode`,r,t,n,null)},$.prototype.SetLanguage=function(e,t,n){var r,i=this,a=this.IsAsync(t,n);r=this._funcMakeParams([e]),this._funcCall(`SetLanguage`,r,a?function(){i.m_language=e,t()}:t,n,null),a||(this.m_language=e)},$.prototype.SetCharset=function(e,t,n){var i,a=this.IsAsync(t,n);if((i=r.GetCoder(e))==null){var o=this.MakeError(Z.ERROR_BAD_PARAMETER,``);if(a)return void setTimeout(function(){n(o)},1);throw new Q(o.errorCode,o.message)}this.m_stringCoder=i,this.m_charset=e,a&&setTimeout(function(){t()},1)},$.prototype.SetRuntimeParameter=function(e,t,n,r){var i;typeof t==`boolean`&&(t=+!!t),i=this._funcMakeParams([e,t]),this._funcCall(`SetRuntimeParameter`,i,n,r,null)},$.prototype.GetStorageParameter=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetStorageParameter`,i,n,r,null)},$.prototype.SetStorageParameter=function(e,t,n,r,i){var a=this._funcMakeParams([e,t,n]);this._funcCall(`SetStorageParameter`,a,r,i,null)},$.prototype.CreateArrayList=function(){return new f},$.prototype.GetLastError=function(){return this.m_lastError},$.prototype.GetLastErrorCode=function(){return this.m_lastErrorCode},$.prototype.BASE64Encode=function(e,t,n){var r=this._base64Encode(e,n);if(!this.IsAsync(t,n))return r;setTimeout(function(){t(r)},1)},$.prototype.BASE64Decode=function(e,t,n){var r=this._base64Decode(e,n);if(!this.IsAsync(t,n))return r;setTimeout(function(){t(r)},1)},$.prototype.StringToBytes=function(e,t,n){var r=this._stringToBytes(e,n);if(!this.IsAsync(t,n))return r;setTimeout(function(){t(r)},1)},$.prototype.BytesToString=function(e,t,n){var r=this._bytesToString(e,n);if(!this.IsAsync(t,n))return r;setTimeout(function(){t(r)},1)},$.prototype.Concatenate=function(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.concat(t);var n,r=e.length+t.length;if(Array.isArray(e)||Array.isArray(t)){var i,a;for(n=Array(r),i=0;i<e.length;i++)n[i]=e[i];for(a=0;a<t.length;i++,a++)n[i]=t[a]}else(n=new p(r)).set(e),n.set(t,e.length);return n},$.prototype.Copy=function(e,t,n){return e.slice(t,t+n)},$.prototype.SetSettings=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`SetSettings`,n,e,t,null)},$.prototype.DoesNeedSetSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`DoesNeedSetSettings`,n,e,t,null)},$.prototype.InitializeMandatorySettings=function(e,t){var n=this;if(this.IsAsync(e,t))o(function(e){var r=n.CreateFileStoreSettings();n.SetFileStoreSettings(r,e,t)}).eu_wait(function(e){n.GetProxySettings(function(t){e()},function(r){n.GetSystemProxySettings(function(r){n.SetProxySettings(r,e,t)},function(r){var i=n.CreateProxySettings();n.SetProxySettings(i,e,t)})})}).eu_wait(function(e){var r=n.CreateTSPSettings();n.SetTSPSettings(r,e,t)}).eu_wait(function(e){var r=n.CreateLDAPSettings();n.SetLDAPSettings(r,e,t)}).eu_wait(function(){var r=n.CreateOCSPSettings();n.SetOCSPSettings(r,e,t)});else{var r,i=n.CreateFileStoreSettings();n.SetFileStoreSettings(i);try{r=n.GetProxySettings()}catch{r=n.CreateProxySettings();try{r=n.GetSystemProxySettings()}catch{}n.SetProxySettings(r)}var a=n.CreateTSPSettings();n.SetTSPSettings(a);var s=n.CreateLDAPSettings();n.SetLDAPSettings(s);var c=n.CreateOCSPSettings();n.SetOCSPSettings(c)}},$.prototype.CreateModeSettings=function(){return new w},$.prototype.GetModeSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetModeSettings`,n,e,t,null)},$.prototype.SetModeSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetModeSettings`,r,t,n,null)},$.prototype.CreateKeyMediaSettings=function(){return new D},$.prototype.GetKeyMediaSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetKeyMediaSettings`,n,e,t,null)},$.prototype.SetKeyMediaSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetKeyMediaSettings`,r,t,n,null)},$.prototype.CreateFileStoreSettings=function(){return new v},$.prototype.GetFileStoreSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetFileStoreSettings`,n,e,t,null)},$.prototype.SetFileStoreSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetFileStoreSettings`,r,t,n,null)},$.prototype.CreateProxySettings=function(){return new y},$.prototype.GetProxySettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetProxySettings`,n,e,t,null)},$.prototype.SetProxySettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetProxySettings`,r,t,n,null)},$.prototype.CreateOCSPSettings=function(){return new x},$.prototype.GetOCSPSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetOCSPSettings`,n,e,t,null)},$.prototype.SetOCSPSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetOCSPSettings`,r,t,n,null)},$.prototype.CreateOCSPAccessInfoModeSettings=function(){return new T},$.prototype.GetOCSPAccessInfoModeSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetOCSPAccessInfoModeSettings`,n,e,t,null)},$.prototype.SetOCSPAccessInfoModeSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetOCSPAccessInfoModeSettings`,r,t,n,null)},$.prototype.CreateOCSPAccessInfoSettings=function(){return new E},$.prototype.EnumOCSPAccessInfoSettings=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EnumOCSPAccessInfoSettings`,r,t,n,null)},$.prototype.GetOCSPAccessInfoSettings=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetOCSPAccessInfoSettings`,r,t,n,null)},$.prototype.SetOCSPAccessInfoSettings=function(e,t,n){var r,i=this,a=i.IsAsync(t,n);if(e=Array.isArray(e)?e:[e],a){var o=function(a){a>=e.length?t():(r=i._funcMakeParams([e[a]]),i._funcCall(`SetOCSPAccessInfoSettings`,r,function(){o(a+1)},n,null))};o(0)}else for(var s=0;s<e.length;s++)r=i._funcMakeParams([e[s]]),i._funcCall(`SetOCSPAccessInfoSettings`,r,t,n,null)},$.prototype.DeleteOCSPAccessInfoSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`DeleteOCSPAccessInfoSettings`,r,t,n,null)},$.prototype.CreateTSPSettings=function(){return new b},$.prototype.GetTSPSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetTSPSettings`,n,e,t,null)},$.prototype.SetTSPSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetTSPSettings`,r,t,n,null)},$.prototype.CreateLDAPSettings=function(){return new S},$.prototype.GetLDAPSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetLDAPSettings`,n,e,t,null)},$.prototype.SetLDAPSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetLDAPSettings`,r,t,n,null)},$.prototype.CreateCMPSettings=function(){return new C},$.prototype.GetCMPSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetCMPSettings`,n,e,t,null)},$.prototype.SetCMPSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetCMPSettings`,r,t,n,null)},$.prototype.GetSystemProxySettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetSystemProxySettings`,n,e,t,null)},$.prototype.SetOCSPResponseExpireTime=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetOCSPResponseExpireTime`,r,t,n,null)},$.prototype.CreateTSLSettings=function(){return new O},$.prototype.GetTSLSettings=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetTSLSettings`,n,e,t,null)},$.prototype.SetTSLSettings=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SetTSLSettings`,r,t,n,null)},$.prototype.RefreshFileStore=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`RefreshFileStore`,r,t,n,null)},$.prototype.ShowCertificates=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ShowCertificates`,n,e,t,null)},$.prototype.SelectCertificateInfo=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`SelectCertificateInfo`,n,e,t,null)},$.prototype.GetCertificatesCount=function(e,t,n,r){var i;return typeof e==`number`&&typeof t==`number`||(n=e,r=t,e=this.SUBJECT_TYPE_UNDIFFERENCED,t=this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED),i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificatesCount`,i,n,r,null)},$.prototype.GetCACertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,e,t)},$.prototype.GetCAServerCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,e,t)},$.prototype.GetCMPServerCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_CMP,e,t)},$.prototype.GetOCSPServerCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_OCSP,e,t)},$.prototype.GetTSPServerCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_TSP,e,t)},$.prototype.GetRAAdministratorCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_RA_ADMINISTRATOR,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,e,t)},$.prototype.GetEndUserCertificatesCount=function(e,t){return this.GetCertificatesCount(this.SUBJECT_TYPE_END_USER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,e,t)},$.prototype.EnumCertificates=function(e,t,n,r,i){var a;return typeof t==`number`&&typeof n==`number`||(r=t,i=n,n=e,e=this.SUBJECT_TYPE_UNDIFFERENCED,t=this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED),a=this._funcMakeParams([e,t,n]),this._funcCall(`EnumCertificates`,a,r,i,null)},$.prototype.EnumCACertificates=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,t,n)},$.prototype.EnumCAServerCertificates=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,t,n)},$.prototype.EnumCMPServerCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_CMP,t,n)},$.prototype.EnumOCSPServerCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_OCSP,t,n)},$.prototype.EnumTSPServerCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_CA_SERVER,this.SUBJECT_CA_SERVER_SUB_TYPE_TSP,t,n)},$.prototype.EnumRAAdministratorCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_RA_ADMINISTRATOR,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,t,n)},$.prototype.EnumEndUserCertificatesCount=function(e,t,n){return this.EnumCertificates(e,this.SUBJECT_TYPE_END_USER,this.SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED,t,n)},$.prototype.GetCertificateInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificateInfo`,i,n,r,null)},$.prototype.GetCertificateInfoEx=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificateInfoEx`,i,n,r,null)},$.prototype.GetCertificate=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificate`,i,n,r,null)},$.prototype.CheckCertificateByIssuerAndSerial=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`CheckCertificateByIssuerAndSerial`,i,n,r,null)},$.prototype.CheckCertificate=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`CheckCertificate`,r,t,n,null)},$.prototype.ParseCertificate=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ParseCertificate`,r,t,n,null)},$.prototype.ParseCertificateEx=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ParseCertificateEx`,r,t,n,null)},$.prototype.SaveCertificate=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`SaveCertificate`,r,t,n,null)},$.prototype.SaveCertificates=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`SaveCertificates`,r,t,n,null)},$.prototype.SaveCertificatesEx=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t?new g(t):null]),this._funcCall(`SaveCertificatesEx`,i,n,r,null)},$.prototype.GetCertificatesFromLDAPByEDRPOUCode=function(e,t,n,r,i,a,o){var s;return r!=null&&i!=null?(r.className==`EndUserArrayList`&&(r=r.m_array),i.className==`EndUserArrayList`&&(i=i.m_array)):(r=null,i=null),s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`GetCertificatesFromLDAPByEDRPOUCode`,s,a,o,null)},$.prototype.GetCertificateByEmail=function(e,t,n,r,i,a){var o;return typeof r!=`string`&&(r=this.m_dateCoder.encode(r)),o=this._funcMakeParams([e,t,n,r]),this._funcCall(`GetCertificateByEmail`,o,i,a,null)},$.prototype.GetCertificateByNBUCode=function(e,t,n,r,i,a){var o;return typeof r!=`string`&&(r=this.m_dateCoder.encode(r)),o=this._funcMakeParams([e,t,n,r]),this._funcCall(`GetCertificateByNBUCode`,o,i,a,null)},$.prototype.GetReceiversCertificates=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetReceiversCertificates`,n,e,t,null)},$.prototype.GetReceiversCertificatesInArrayList=function(e,t){var n,r=this;return n=this._funcMakeParams(null),this._funcCall(`GetReceiversCertificates`,n,e,t,function(e,t,n){var i=r.IsAsync(t,n);try{for(var a=new f,o=0;o<e.length;o++)a.add(e[o]);if(!i)return a;t(a)}catch{var s=r.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(i)return void n(s);throw new Q(s.errorCode,s.message)}})},$.prototype.GetCertificates=function(e,t,n,r){var i,a=this;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificates`,i,n,r,function(e,t,n){var r=a.IsAsync(t,n);try{for(var i=new f,o=0;o<e.length;o++)i.add(e[o]);if(!r)return i;t(i)}catch{var s=a.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(s);throw new Q(s.errorCode,s.message)}})},$.prototype.GetCertificateByFingerprint=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetCertificateByFingerprint`,r,t,n,null)},$.prototype.GetCertificatesByEDRPOUAndDRFOCode=function(e,t,n,r){var i,a=this;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificatesByEDRPOUAndDRFOCode`,i,n,r,function(e,t,n){var r=a.IsAsync(t,n);try{for(var i=new f,o=0;o<e.length;o++)i.add(e[o]);if(!r)return i;t(i)}catch{var s=a.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(s);throw new Q(s.errorCode,s.message)}})},$.prototype.ShowCRLs=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ShowCRLs`,n,e,t,null)},$.prototype.GetCRLsCount=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetCRLsCount`,n,e,t,null)},$.prototype.EnumCRLs=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EnumCRLs`,r,t,n,null)},$.prototype.GetCRLDetailedInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,parseInt(t)]),this._funcCall(`GetCRLDetailedInfo`,i,n,r,null)},$.prototype.SaveCRL=function(e,t,n,r){var i;return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SaveCRL`,i,n,r,null)},$.prototype.GetTSPByAccessInfo=function(e,t,n,r,i,a){var o;if(typeof t==`string`||(t=this._base64Encode(t,a))!=null)return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`GetTSPByAccessInfo`,o,i,a,null)},$.prototype.CheckTSP=function(e,t,n,r,i){var a;typeof e==`string`&&(e=this._base64Decode(e,i))==null||n!=null&&typeof n!=`string`&&(n=this._base64Encode(n,i))==null||(a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`CheckTSP`,a,r,i,null))},$.prototype.GetOCSPResponseByAccessInfo=function(e,t,n,r,i){var a;return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`GetOCSPResponseByAccessInfo`,a,r,i,null)},$.prototype.CheckOCSPResponse=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._base64Decode(e,r))!=null)return t!=null&&typeof t!=`string`&&(t=this.m_dateCoder.encode(t)),i=this._funcMakeParams([new g(e),t]),this._funcCall(`CheckOCSPResponse`,i,n,r,null)},$.prototype.CreateKeyMedia=function(){return new _},$.prototype.GetPrivateKeyMedia=function(e,t,n){var r;return typeof e!=`string`&&(e=null),r=this._funcMakeParams([e]),this._funcCall(`GetPrivateKeyMedia`,r,t,n,null)},$.prototype.EnumKeyMediaTypes=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EnumKeyMediaTypes`,r,t,n,null)},$.prototype.EnumKeyMediaDevices=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`EnumKeyMediaDevices`,i,n,r,null)},$.prototype.GetKeyMediaTypes=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetKeyMediaTypes`,n,e,t,null)},$.prototype.GetKeyMediaDevices=function(e,t,n){var r;return typeof e==`number`&&(e=[e]),e&&=new g(e),r=this._funcMakeParams([e]),this._funcCall(`GetKeyMediaDevices`,r,t,n,null)},$.prototype.GetKeyMediaDeviceInfo=function(e,t,n,r){var i,a;return typeof e==`number`?((a=new _).typeIndex=e,a.devIndex=t,a.password=``):(a=e,r=n,n=t),i=this._funcMakeParams([a]),this._funcCall(`GetKeyMediaDeviceInfo`,i,n,r,null)},$.prototype.IsPrivateKeyReaded=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`IsPrivateKeyReaded`,n,e,t,null)},$.prototype.ReadPrivateKey=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ReadPrivateKey`,n,e,t,null)},$.prototype.ReadPrivateKeySilently=function(e,t,n,r,i){var a,o;typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=e,r=t,i=n),a=this._funcMakeParams([o]),this._funcCall(`ReadPrivateKeySilently`,a,r,i,null)},$.prototype.ReadPrivateKeyBinary=function(e,t,n,r){var i=this._funcMakeParams([new g(e),t]);this._funcCall(`ReadPrivateKeyBinary`,i,n,r,null)},$.prototype.ReadPrivateKeyFile=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`ReadPrivateKeyFile`,i,n,r,null)},$.prototype.CtxReadPrivateKey=function(e,t,n,r,i,a){var o,s;return typeof t==`number`?((s=new _).typeIndex=t,s.devIndex=n,s.password=r):(s=t,i=n,a=r),o=this._funcMakeParams([e,s]),this._funcCall(`CtxReadPrivateKey`,o,i,a,null)},$.prototype.CtxReadPrivateKeyBinary=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,new g(t),n]),this._funcCall(`CtxReadPrivateKeyBinary`,a,r,i,null)},$.prototype.ResetPrivateKey=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ResetPrivateKey`,n,e,t,null)},$.prototype.CtxFreePrivateKey=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`CtxFreePrivateKey`,r,t,n,null)},$.prototype.ShowOwnCertificate=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`ShowOwnCertificate`,n,e,t,null)},$.prototype.GetOwnCertificate=function(e,t,n,r){var i;return typeof e==`number`&&typeof t==`number`||(n=e,r=t,e=null,t=null),i=this._funcMakeParams([e,t]),this._funcCall(`GetOwnCertificate`,i,n,r,null)},$.prototype.EnumOwnCertificates=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EnumOwnCertificates`,r,t,n,null)},$.prototype.GetPrivateKeyOwnerInfo=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetPrivateKeyOwnerInfo`,n,e,t,null)},$.prototype.CtxEnumOwnCertificates=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`CtxEnumOwnCertificates`,i,n,r,null)},$.prototype.CtxGetOwnCertificate=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxGetOwnCertificate`,a,r,i,null)},$.prototype.GetKeyInfo=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetKeyInfo`,r,t,n,null)},$.prototype.GetKeyInfoSilently=function(e,t,n,r,i){var a;return(a=new _).typeIndex=e,a.devIndex=t,a.password=n,this.GetKeyInfo(a,r,i)},$.prototype.GetKeyInfoBinary=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`GetKeyInfoBinary`,i,n,r,null)},$.prototype.GetKeyInfoFile=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetKeyInfoFile`,i,n,r,null)},$.prototype.GetCertificateByKeyInfo=function(e,t,n,r){var i,a=[];return typeof e==`number`&&typeof t==`number`||(r=n,n=t),typeof e==`number`&&typeof t==`number`?(a.push(e),a.push(t),a.push(null)):(a.push(null),a.push(null),a.push(new g(e))),i=this._funcMakeParams(a),this._funcCall(`GetCertificateByKeyInfo`,i,n,r,null)},$.prototype.GetCertificatesByKeyInfo=function(e,t,n,r,i){var a;return e.className==`EndUserPrivateKeyInfo`&&(e=e.GetPrivateKeyInfo()),t!=null&&n!=null?(t.className==`EndUserArrayList`&&(t=t.m_array),n.className==`EndUserArrayList`&&(n=n.m_array)):(t=null,n=null),a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`GetCertificatesByKeyInfo`,a,r,i,null)},$.prototype.ChangeSoftwarePrivateKeyPassword=function(e,t,n,r,i){var a;return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`ChangeSoftwarePrivateKeyPassword`,a,r,i,null)},$.prototype.EnumJKSPrivateKeys=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`EnumJKSPrivateKeys`,i,n,r,null)},$.prototype.EnumJKSPrivateKeysFile=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`EnumJKSPrivateKeysFile`,i,n,r,null)},$.prototype.GetJKSPrivateKey=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`GetJKSPrivateKey`,i,n,r,null)},$.prototype.GetJKSPrivateKeyFile=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetJKSPrivateKeyFile`,i,n,r,null)},$.prototype.CreatePrivateKeyInfo=function(){return new R},$.prototype.CreateEndUserInfo=function(){return new V},$.prototype._generatePrivateKey=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){if(!this.IsAsync(m,h))return this.GeneratePrivateKeyEx(e,t,n,r,!1,i,a,o,s,c,l,u,d,null,null,f,p,m,h).m_array;this.GeneratePrivateKeyEx(e,t,n,r,!1,i,a,o,s,c,l,u,d,null,null,f,p,function(e){m(e.m_array)},h)},$.prototype.GeneratePrivateKey=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){if(typeof e==`boolean`)return this._generatePrivateKeyEx(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h);if(typeof n==`boolean`)return this._generatePrivateKey(!0,0,0,``,e,t,n,r,i,a,o,s,null,!1,c,l);if(typeof n==`string`)return this._generatePrivateKey(!1,e,t,n,r,i,a,o,s,c,l,u,null,!1,d,f);if(typeof n==`number`)return this._generatePrivateKey(!1,0,0,e,t,n,r,i,a,o,s,c,l,!0,u,d);var g=this.MakeError(Z.ERROR_BAD_PARAMETER,``);throw new Q(g.errorCode,g.message)},$.prototype._generatePrivateKeyEx=function(e,t,n,r,i,a,o,s,c,l,u,d,p,m,h,g,v,y,b){var x,S,C=this;return e?S=null:((S=new _).typeIndex=t,S.devIndex=n,S.password=typeof r==`string`?r:``),g??(v=!1),x=this._funcMakeParams([e,S,i,a,o,s,c,l,u,d,p,m,h,g!=null,v]),this._funcCall(`GeneratePrivateKeyEx`,x,y,b,function(e,t,n){var r=C.IsAsync(t,n);try{for(var i=e[0],a=new f,o=0;o<i.length;o++)a.add(i[o]);if(g?.set(e[1]),!r)return a;t(a)}catch{var s=C.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(s);throw new Q(s.errorCode,s.message)}})},$.prototype.GeneratePrivateKeyEx=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v){if(typeof e==`boolean`)return typeof i==`boolean`?this._generatePrivateKeyEx(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v):this._generatePrivateKeyEx(e,t,n,r,!1,i,a,o,s,c,l,u,d,null,null,f,p,m,h);if(typeof n==`boolean`)return l!==void 0&&l==null||typeof l==`string`?this._generatePrivateKeyEx(!0,0,0,``,!1,e,t,n,r,i,a,o,s,c,l,null,!1,u,d):this._generatePrivateKeyEx(!0,0,0,``,!1,e,t,n,r,i,a,o,s,null,null,null,!1,c,l);if(typeof e==`number`)return typeof r==`boolean`?this._generatePrivateKeyEx(!1,e,t,n,r,i,a,o,s,c,l,u,d,f,p,null,!1,m,h):this._generatePrivateKeyEx(!1,e,t,n,!1,r,i,a,o,s,c,l,u,null,null,null,!1,d,f);if(typeof e==`string`)return u!==void 0&&u==null||typeof u==`string`?this._generatePrivateKeyEx(!1,0,0,e,!1,t,n,r,i,a,o,s,c,l,u,d,!0,f,p):this._generatePrivateKeyEx(!1,0,0,e,!1,t,n,r,i,a,o,s,c,null,null,l,!0,u,d);var y=this.MakeError(Z.ERROR_BAD_PARAMETER,``);throw new Q(y.errorCode,y.message)},$.prototype.GetCRInfo=function(e,t,n,r,i){var a;return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`GetCRInfo`,a,r,i,null)},$.prototype.IsHardwareKeyMedia=function(e,t,n,r,i){var a,o;return typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=null,r=e,i=t),a=this._funcMakeParams([o]),this._funcCall(`IsHardwareKeyMedia`,a,r,i,null)},$.prototype.IsPrivateKeyExists=function(e,t,n,r,i){var a,o;return typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=null,r=e,i=t),a=this._funcMakeParams([o]),this._funcCall(`IsPrivateKeyExists`,a,r,i,null)},$.prototype.ChangePrivateKeyPassword=function(e,t,n,r,i,a){var o,s;typeof e==`number`?((s=new _).typeIndex=e,s.devIndex=t,s.password=n):(s=null,r=null,i=e,a=t),o=this._funcMakeParams([s,r]),this._funcCall(`ChangePrivateKeyPassword`,o,i,a,null)},$.prototype.BackupPrivateKey=function(e,t,n,r,i,a,o,s){var c,l,u;typeof e==`number`?((l=new _).typeIndex=e,l.devIndex=t,l.password=n,(u=new _).typeIndex=r,u.devIndex=i,u.password=a):(l=null,u=null,o=e,s=t),c=this._funcMakeParams([l,u]),this._funcCall(`BackupPrivateKey`,c,o,s,null)},$.prototype.DestroyPrivateKey=function(e,t,n,r,i){var a,o;typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=null,r=e,i=t),a=this._funcMakeParams([o]),this._funcCall(`DestroyPrivateKey`,a,r,i,null)},$.prototype.SetKeyMediaPassword=function(e,t,n,r,i){var a,o;typeof e==`number`?((o=new _).typeIndex=e,o.devIndex=t,o.password=n):(o=null,r=e,i=t),a=this._funcMakeParams([o]),this._funcCall(`SetKeyMediaPassword`,a,r,i,null)},$.prototype.SetKeyMediaUserPassword=function(e,t,n,r,i,a){var o,s;typeof t==`number`?((s=new _).typeIndex=t,s.devIndex=n,s.password=r):(s=null,i=t,a=n),o=this._funcMakeParams([e,s]),this._funcCall(`SetKeyMediaUserPassword`,o,i,a,null)},$.prototype.ChangeOwnCertificatesStatus=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`ChangeOwnCertificatesStatus`,i,n,r,null)},$.prototype.CtxChangeOwnCertificatesStatus=function(e,t,n,r,i){var a=this._funcMakeParams([e,t,n]);this._funcCall(`CtxChangeOwnCertificatesStatus`,a,r,i,null)},$.prototype.MakeNewCertificate=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){var h;return t!=null&&(t=new g(t)),h=this._funcMakeParams([e,t,n,r,i,a,o,s,c,l,u,d,f]),this._funcCall(`MakeNewCertificate`,h,p,m,null)},$.prototype.MakeNewCertificateEx=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,_){var v;return t!=null&&(t=new g(t)),v=this._funcMakeParams([e,t,n,r,i,a,o,s,c,l,u,d,f,p,m]),this._funcCall(`MakeNewCertificateEx`,v,h,_,null)},$.prototype.MakeNewOwnCertificate=function(e,t,n,r,i,a,o,s,c,l){var u;return u=this._funcMakeParams([e,t,n,r,i,a,o,s]),this._funcCall(`MakeNewOwnCertificate`,u,c,l,null)},$.prototype.CtxMakeNewOwnCertificate=function(e,t,n,r,i,a,o,s,c,l,u){var d;return d=this._funcMakeParams([e,t,n,r,i,a,o,s,c]),this._funcCall(`CtxMakeNewOwnCertificate`,d,l,u,null)},$.prototype.CtxMakeNewOwnCertificateEx=function(e,t,n,r,i,a,o,s,c,l,u,d,f){var p;return p=this._funcMakeParams([e,t,n,r,i,a,o,s,c,l,u]),this._funcCall(`CtxMakeNewOwnCertificateEx`,p,d,f,null)},$.prototype.CtxMakeNewOwnCertificateWithCR=function(e,t,n,r,i,a,o){var s;return t!=null&&(t=new g(t)),n!=null&&(n=new g(n)),r!=null&&(r=new g(r)),i!=null&&(i=new g(i)),s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`CtxMakeNewOwnCertificateWithCR`,s,a,o,null)},$.prototype.CtxMakeDeviceCertificate=function(e,t,n,r,i,a,o,s,c,l){var u;return n!=null&&(n=new g(n)),r!=null&&(r=new g(r)),i!=null&&(i=new g(i)),a!=null&&(a=new g(a)),u=this._funcMakeParams([e,t,n,r,i,a,o,s]),this._funcCall(`CtxMakeDeviceCertificate`,u,c,l,null)},$.prototype.GetOwnEUserParams=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetOwnEUserParams`,n,e,t,null)},$.prototype.ModifyOwnEUserParams=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`ModifyOwnEUserParams`,i,n,r,null)},$.prototype.CtxGetOwnEUserParams=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`CtxGetOwnEUserParams`,r,t,n,null)},$.prototype.CtxModifyOwnEUserParams=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxModifyOwnEUserParams`,a,r,i,null)},$.prototype.Hash=function(e,t,n){var r;if(typeof e!=`string`||(e=this._stringToBytes(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`Hash`,r,t,n,null)},$.prototype.ContinueHash=function(e,t,n,r,i){var a;typeof t==`number`&&typeof n==`number`||(r=t,i=n),typeof e==`string`&&(e=this._stringToBytes(e,i))==null||(typeof t==`number`&&typeof n==`number`&&(e=e.slice(t,t+n)),a=this._funcMakeParams([new g(e)]),this._funcCall(`ContinueHash`,a,r,i,null))},$.prototype.EndHash=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`EndHash`,n,e,t,null)},$.prototype.HashWithParams=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([new g(e),new g(t)]),this._funcCall(`HashWithParams`,i,n,r,null)},$.prototype.HashBeginWithParams=function(e,t,n){var r=this._funcMakeParams([new g(e)]);this._funcCall(`HashBeginWithParams`,r,t,n,null)},$.prototype.HashFile=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`HashFile`,r,t,n,null)},$.prototype.HashFileWithParams=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`HashFileWithParams`,i,n,r,null)},$.prototype.CtxHash=function(e,t,n,r,i,a){var s=this,c=this.IsAsync(i,a),l=s.EU_FILE_PROCESS_CHUNK_SIZE;if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null){if(c){var u={hashContext:null,hash:null},d=function(e){u.hashContext==null?a(e):s.CtxHashFree(u.hashContext,function(){a(e)},function(){a(e)})};o(function(r){s.CtxHashBegin(e,t,n,r,d)}).eu_wait(function(e,t){u.hashContext=t;var n=function(i){if(i>=r.length)s.CtxHashEnd(t,e,d);else{var a=r.length-i;a>l&&(a=l);var o=r.slice(i,i+a);s.CtxHashContinue(t,o,function(){n(i+a)},d)}};n(0)}).eu_wait(function(e,t){u.hash=t,s.CtxHashFree(u.hashContext,e,a)}).eu_wait(function(){i(u.hash)})}else{var f=null;try{var p,m=0;for(f=s.CtxHashBegin(e,t,n);;){var h=r.length-m;h>l&&(h=l);var g=r.slice(m,m+h);if(s.CtxHashContinue(f,g),!((m+=h)<r.length))break}return p=s.CtxHashEnd(f),s.CtxHashFree(f),f=null,p}catch(e){throw f!=null&&s.CtxHashFree(f),e}}}},$.prototype.CtxHashBegin=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n?new g(n):null]),this._funcCall(`CtxHashBegin`,a,r,i,null)},$.prototype.CtxHashContinue=function(e,t,n,r){var i=this._funcMakeParams([e,new g(t)]);this._funcCall(`CtxHashContinue`,i,n,r,null)},$.prototype.CtxHashEnd=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`CtxHashEnd`,r,t,n,null)},$.prototype.CtxHashFree=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`CtxHashFree`,r,t,n,null)},$.prototype.ShowSignInfo=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`ShowSignInfo`,r,t,n,null)},$.prototype.IsSigned=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`IsSigned`,r,t,n,null)},$.prototype.IsSignedFile=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsSignedFile`,r,t,n,null)},$.prototype.GetSignType=function(e,t,n,r){var i;if(typeof t==`string`||(t=this._base64Encode(t,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`GetSignType`,i,n,r,null)},$.prototype.GetFileSignType=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetFileSignType`,i,n,r,null)},$.prototype.GetSignsCount=function(e,t,n){var r;if(typeof e==`string`||(e=this._base64Encode(e,n))!=null)return r=this._funcMakeParams([e]),this._funcCall(`GetSignsCount`,r,t,n,null)},$.prototype.GetSignerInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetSignerInfo`,i,n,r,null)},$.prototype.GetSignerCertificate=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetSignerCertificate`,i,n,r,null)},$.prototype.GetFileSignsCount=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetFileSignsCount`,r,t,n,null)},$.prototype.GetFileSignerInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetFileSignerInfo`,i,n,r,null)},$.prototype.GetFileSignerCertificate=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetFileSignerCertificate`,i,n,r,null)},$.prototype.CtxGetSignerInfo=function(e,t,n,r,i){var a;if(typeof n==`string`||(n=this._base64Encode(n,i))!=null)return a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxGetSignerInfo`,a,r,i,null)},$.prototype.Sign=function(e,t,n){var r;if(typeof e!=`string`||(e=this._stringToBytes(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`Sign`,r,t,n,null)},$.prototype.Verify=function(e,t,n,r,i){var a,o=[];if(typeof n!=`boolean`&&(i=r,r=n),typeof t!=`string`||(t=this._stringToBytes(t,i))!=null)return o.push(e),o.push(new g(t)),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`Verify`,a,r,i,null)},$.prototype.ContinueSign=function(e,t,n,r,i){var a;typeof t==`number`&&typeof n==`number`||(r=t,i=n),typeof e==`string`&&(e=this._stringToBytes(e,i))==null||(typeof t==`number`&&typeof n==`number`&&(e=e.slice(t,t+n)),a=this._funcMakeParams([new g(e)]),this._funcCall(`ContinueSign`,a,r,i,null))},$.prototype.EndSign=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`EndSign`,n,e,t,null)},$.prototype.BeginVerify=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`BeginVerify`,r,t,n,null)},$.prototype.ContinueVerify=function(e,t,n,r,i){var a;typeof t==`number`&&typeof n==`number`||(r=t,i=n),typeof e==`string`&&(e=this._stringToBytes(e,i))==null||(typeof t==`number`&&typeof n==`number`&&(e=e.slice(t,t+n)),a=this._funcMakeParams([new g(e)]),this._funcCall(`ContinueVerify`,a,r,i,null))},$.prototype.EndVerify=function(e,t,n){var r,i=[];return typeof e!=`boolean`&&(n=t,t=e),typeof e==`boolean`?i.push(null):i.push(e),r=this._funcMakeParams(i),this._funcCall(`EndVerify`,r,t,n,null)},$.prototype.SignHash=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`SignHash`,r,t,n,null)},$.prototype.VerifyHash=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`VerifyHash`,a,r,i,null)},$.prototype.SignInternal=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SignInternal`,i,n,r,null)},$.prototype.VerifyInternal=function(e,t,n,r){var i,a=[];return typeof t!=`boolean`&&(r=n,n=t),a.push(e),typeof t==`boolean`?a.push(t):a.push(null),i=this._funcMakeParams(a),this._funcCall(`VerifyInternal`,i,n,r,null)},$.prototype.VerifyInternalString=function(e,t,n,r){var i=this;if(typeof t!=`boolean`&&(r=n,n=t),!this.IsAsync(n,r)){var a=this.VerifyInternal(e,t);return this.BytesToString(a)}this.VerifyInternal(e,t,function(e){i.BytesToString(e,n,r)},r)},$.prototype.SignFile=function(e,t,n,r,i){var a=this._funcMakeParams([e,t,n]);this._funcCall(`SignFile`,a,r,i,null)},$.prototype.VerifyFile=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`VerifyFile`,a,r,i,null)},$.prototype.VerifyFileWithExternalSign=function(e,t,n,r,i){return this.VerifyFile(t,e,n,r,i)},$.prototype.VerifyFileWithInternalSign=function(e,t,n,r,i){return this.VerifyFile(e,t,n,r,i)},$.prototype.IsAlreadySigned=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsAlreadySigned`,r,t,n,null)},$.prototype.IsFileAlreadySigned=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsFileAlreadySigned`,r,t,n,null)},$.prototype.AppendSign=function(e,t,n,r){var i;if(!(typeof e==`string`&&(e=this._stringToBytes(e,r))==null||typeof t!=`string`&&(t=this._base64Encode(t,r))==null))return i=this._funcMakeParams([new g(e),t]),this._funcCall(`AppendSign`,i,n,r,null)},$.prototype.VerifySpecific=function(e,t,n,r,i,a){var o,s=[];if(typeof r!=`boolean`&&(a=i,i=r),typeof t!=`string`||(t=this._stringToBytes(t,a))!=null)return s.push(e),s.push(new g(t)),s.push(n),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`VerifySpecific`,o,i,a,null)},$.prototype.AppendSignBegin=function(e,t,n){var r;typeof e!=`string`&&(e=this._base64Encode(e,n))==null||(r=this._funcMakeParams([e]),this._funcCall(`AppendSignBegin`,r,t,n,null))},$.prototype.VerifyDataSpecificBegin=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`VerifyDataSpecificBegin`,i,n,r,null)},$.prototype.AppendSignHash=function(e,t,n,r){var i;if(!(typeof e!=`string`&&(e=this._base64Encode(e,r))==null||typeof t!=`string`&&(t=this._base64Encode(t,r))==null))return i=this._funcMakeParams([e,t]),this._funcCall(`AppendSignHash`,i,n,r,null)},$.prototype.VerifyHashSpecific=function(e,t,n,r,i,a){var o,s=[];return typeof r!=`boolean`&&(a=i,i=r),s.push(e),s.push(t),s.push(n),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`VerifyHashSpecific`,o,i,a,null)},$.prototype.AppendSignInternal=function(e,t,n,r){var i;if(typeof t==`string`||(t=this._base64Encode(t,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`AppendSignInternal`,i,n,r,null)},$.prototype.VerifySpecificInternal=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`VerifySpecificInternal`,a,r,i,null)},$.prototype.VerifySpecificInternalString=function(e,t,n,r,i){var a=this;if(typeof n!=`boolean`&&(i=r,r=n),!this.IsAsync(r,i)){var o=this.VerifySpecificInternal(e,t,n);return this.BytesToString(o)}this.VerifySpecificInternal(e,t,n,function(e){a.BytesToString(e,r,i)},i)},$.prototype.AppendSignFile=function(e,t,n,r,i,a){var o;return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`AppendSignFile`,o,i,a,null)},$.prototype.VerifyFileSpecific=function(e,t,n,r,i,a){var o,s=[];return typeof r!=`boolean`&&(a=i,i=r),s.push(e),s.push(t),s.push(n),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`VerifyFileSpecific`,o,i,a,null)},$.prototype.VerifyFileWithExternalSignSpecific=function(e,t,n,r,i,a){return this.VerifyFileSpecific(e,t,n,r,i,a)},$.prototype.VerifyFileWithInternalSignSpecific=function(e,t,n,r,i,a){return this.VerifyFileSpecific(e,t,n,r,i,a)},$.prototype.CreateEmptySign=function(e,t,n){var r,i=[];if(arguments.length==2&&(n=t,t=e),typeof e!=`string`||(e=this._stringToBytes(e,n))!=null)return arguments.length==1||arguments.length==3?i.push(new g(e)):i.push(null),r=this._funcMakeParams(i),this._funcCall(`CreateEmptySign`,r,t,n,null)},$.prototype.CreateSigner=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`CreateSigner`,r,t,n,null)},$.prototype.CreateSignerEx=function(e,t,n,r,i){var a;if(typeof e==`string`||(e=this._base64Encode(e,i))!=null)return a=this._funcMakeParams([e,t,n]),this._funcCall(`CreateSignerEx`,a,r,i,null)},$.prototype.AppendSigner=function(e,t,n,r,i){var a,o=[];return o.push(e),t==null?o.push(null):o.push(new g(t)),o.push(n),a=this._funcMakeParams(o),this._funcCall(`AppendSigner`,a,r,i,null)},$.prototype.AppendValidationDataToSignerEx=function(e,t,n,r,i){var a,o=[];if(typeof e==`string`||(e=this._base64Encode(e,i))!=null)return o.push(e),t==null?o.push(null):o.push(new g(t)),o.push(n),a=this._funcMakeParams(o),this._funcCall(`AppendValidationDataToSignerEx`,a,r,i,null)},$.prototype.IsDataInSignedDataAvailable=function(e,t,n){var r;if(typeof e==`string`||(e=this._base64Encode(e,n))!=null)return r=this._funcMakeParams([e]),this._funcCall(`IsDataInSignedDataAvailable`,r,t,n,null)},$.prototype.IsDataInSignedFileAvailable=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsDataInSignedFileAvailable`,r,t,n,null)},$.prototype.GetDataFromSignedData=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`GetDataFromSignedData`,r,t,n,null)},$.prototype.GetDataFromSignedFile=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`GetDataFromSignedFile`,i,n,r,null)},$.prototype.GetCertificateFromSignedData=function(e,t,n,r){var i;if(typeof t==`string`||(t=this._base64Encode(t,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificateFromSignedData`,i,n,r,null)},$.prototype.GetCertificateFromSignedFile=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetCertificateFromSignedFile`,i,n,r,null)},$.prototype.GetSignTimeInfo=function(e,t,n,r){var i;if(typeof t==`string`||(t=this._base64Encode(t,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`GetSignTimeInfo`,i,n,r,null)},$.prototype.GetFileSignTimeInfo=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`GetFileSignTimeInfo`,i,n,r,null)},$.prototype.VerifyHashOnTime=function(e,t,n,r,i,a,o){return this.VerifyHashOnTimeEx(e,t,n,r,r!=null,!1,i,a,o)},$.prototype.VerifyHashOnTimeEx=function(e,t,n,r,i,a,o,s,c){var l,u=[];if(typeof o!=`boolean`&&(c=s,s=o),!(typeof e!=`string`&&(e=this._base64Encode(e,c))==null||typeof n!=`string`&&(n=this._base64Encode(n,c))==null))return u=[e,t,n,r,i,a],typeof o==`boolean`?u.push(o):u.push(null),l=this._funcMakeParams(u),this._funcCall(`VerifyHashOnTimeEx`,l,s,c,null)},$.prototype.VerifyDataOnTime=function(e,t,n,r,i,a,o){return this.VerifyDataOnTimeEx(e,t,n,r,r!=null,!1,i,a,o)},$.prototype.VerifyDataOnTimeEx=function(e,t,n,r,i,a,o,s,c){var l,u=[];if(typeof o!=`boolean`&&(c=s,s=o),!(typeof e==`string`&&(e=this._stringToBytes(e,c))==null||typeof n!=`string`&&(n=this._base64Encode(n,c))==null))return u=[new g(e),t,n,r,i,a],typeof o==`boolean`?u.push(o):u.push(null),l=this._funcMakeParams(u),this._funcCall(`VerifyDataOnTimeEx`,l,s,c,null)},$.prototype.VerifyDataInternalOnTime=function(e,t,n,r,i,a){return this.VerifyDataInternalOnTimeEx(e,t,n,n!=null,!1,r,i,a)},$.prototype.VerifyDataInternalOnTimeEx=function(e,t,n,r,i,a,o,s){var c,l=[];if(typeof a!=`boolean`&&(s=o,o=a),typeof e==`string`||(e=this._base64Encode(e,s))!=null)return l=[e,t,n,r,i],typeof a==`boolean`?l.push(a):l.push(null),c=this._funcMakeParams(l),this._funcCall(`VerifyDataInternalOnTimeEx`,c,o,s,null)},$.prototype.VerifyDataInternalOnTimeString=function(e,t,n,r,i,a){return this.VerifyDataInternalOnTimeStringEx(e,t,n,n!=null,!1,r,i,a)},$.prototype.VerifyDataInternalOnTimeStringEx=function(e,t,n,r,i,a,o,s){var c=this;if(typeof a!=`boolean`&&(s=o,o=a),!this.IsAsync(o,s)){var l=this.VerifyDataInternalOnTimeEx(e,t,n,r,i,a);return this.BytesToString(l)}this.VerifyDataInternalOnTimeEx(e,t,n,r,i,a,function(e){c.BytesToString(e,o,s)},s)},$.prototype.VerifyDataOnTimeBegin=function(e,t,n,r,i){this.VerifyDataOnTimeBeginEx(e,t,n,n!=null,!1,r,i)},$.prototype.VerifyDataOnTimeBeginEx=function(e,t,n,r,i,a,o){var s=this._funcMakeParams([e,t,n,r,i]);this._funcCall(`VerifyDataOnTimeBeginEx`,s,a,o,null)},$.prototype.VerifyFileOnTime=function(e,t,n,r,i,a,o,s,c){var l,u=[];return typeof o!=`boolean`&&(c=s,s=o),u=[e,t,n,r,i,a],typeof o==`boolean`?u.push(o):u.push(null),l=this._funcMakeParams(u),this._funcCall(`VerifyFileOnTimeEx`,l,s,c,null)},$.prototype.VerifyFileWithExternalSignOnTime=function(e,t,n,r,i,a,o){return this.VerifyFileOnTime(e,n,t,r,r!=null,!1,i,a,o)},$.prototype.VerifyFileWithExternalSignOnTimeEx=function(e,t,n,r,i,a,o,s,c){return this.VerifyFileOnTime(e,n,t,r,i,a,o,s,c)},$.prototype.VerifyFileWithInternalSignOnTime=function(e,t,n,r,i,a,o){return this.VerifyFileOnTime(e,t,n,r,r!=null,!1,i,a,o)},$.prototype.VerifyFileWithInternalSignOnTimeEx=function(e,t,n,r,i,a,o,s,c){return this.VerifyFileOnTime(e,n,t,r,i,a,o,s,c)},$.prototype.ContinueSignCtx=function(e,t,n,r){var i;if(e??=new U,typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ContinueSignCtx`,i,n,r,null)},$.prototype.ContinueSignCtxWithOffset=function(e,t,n,r,i,a){return t=t.slice(n,n+r),this.ContinueSignCtx(e,t,i,a)},$.prototype.EndSignCtx=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`EndSignCtx`,i,n,r,null)},$.prototype.BeginVerifyCtx=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`BeginVerifyCtx`,r,t,n,null)},$.prototype.ContinueVerifyCtx=function(e,t,n,r,i,a){var o;typeof n==`number`&&typeof r==`number`||(i=n,a=r),typeof t==`string`&&(t=this._stringToBytes(t,a))==null||(typeof n==`number`&&typeof r==`number`&&(t=t.slice(n,n+r)),o=this._funcMakeParams([e,new g(t)]),this._funcCall(`ContinueVerifyCtx`,o,i,a,null))},$.prototype.EndVerifyCtx=function(e,t,n,r){var i,a=[];return typeof t!=`boolean`&&(r=n=t),a.push(e),typeof t==`boolean`?a.push(t):a.push(null),i=this._funcMakeParams(a),this._funcCall(`EndVerifyCtx`,i,n,r,null)},$.prototype.ResetOperationCtx=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`ResetOperationCtx`,r,t,n,null)},$.prototype.SignHashRSA=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`SignHashRSA`,r,t,n,null)},$.prototype.SignRSA=function(e,t,n,r,i){var a;if(typeof e!=`string`||(e=this._stringToBytes(e,i))!=null)return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`SignRSA`,a,r,i,null)},$.prototype.ContinueRSASign=function(e,t,n){var r;typeof e==`string`&&(e=this._stringToBytes(e,n))==null||(r=this._funcMakeParams([new g(e)]),this._funcCall(`ContinueRSASign`,r,t,n,null))},$.prototype.ContinueRSASignWithOffset=function(e,t,n,r,i){return e=e.slice(t,t+n),this.ContinueRSASign(e,r,i)},$.prototype.EndRSASign=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`EndRSASign`,r,t,n,null)},$.prototype.SignRSAFile=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`SignRSAFile`,a,r,i,null)},$.prototype.ContinueRSASignCtx=function(e,t,n,r){var i;if(e??=new U,typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ContinueRSASignCtx`,i,n,r,null)},$.prototype.ContinueRSASignCtxWithOffset=function(e,t,n,r,i,a){return t=t.slice(n,n+r),this.ContinueRSASignCtx(t,i,a)},$.prototype.EndRSASignCtx=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`EndRSASignCtx`,i,n,r,null)},$.prototype.SignECDSA=function(e,t,n,r,i){var a;if(typeof e!=`string`||(e=this._stringToBytes(e,i))!=null)return a=this._funcMakeParams([new g(e),t,n]),this._funcCall(`SignECDSA`,a,r,i,null)},$.prototype.RawSign=function(e,t,n){var r;if(typeof e!=`string`||(e=this._stringToBytes(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`RawSign`,r,t,n,null)},$.prototype.RawVerify=function(e,t,n,r,i){var a,o=[];if(typeof n!=`boolean`&&(i=r,r=n),typeof t!=`string`||(t=this._stringToBytes(t,i))!=null)return o.push(e),o.push(new g(t)),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`RawVerify`,a,r,i,null)},$.prototype.RawSignHash=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`RawSignHash`,r,t,n,null)},$.prototype.RawVerifyHash=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`RawVerifyHash`,a,r,i,null)},$.prototype.RawSignFile=function(e,t,n,r){var i=this._funcMakeParams([e,t]);this._funcCall(`RawSignFile`,i,n,r,null)},$.prototype.RawVerifyFile=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`RawVerifyFile`,a,r,i,null)},$.prototype.NBUSign=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._stringToBytes(e,r))!=null)return i=this._funcMakeParams([new g(e),t]),this._funcCall(`NBUSign`,i,n,r,null)},$.prototype.NBUVerify=function(e,t,n,r,i,a,o){var s,c=[];if(typeof i!=`boolean`&&(o=a,a=i),typeof n!=`string`||(n=this._stringToBytes(n,o))!=null)return c.push(e),c.push(t),c.push(new g(n)),c.push(r),typeof i==`boolean`?c.push(i):c.push(null),s=this._funcMakeParams(c),this._funcCall(`NBUVerify`,s,a,o,null)},$.prototype.CtxSignHash=function(e,t,n,r,i,a){var o;if(typeof n==`string`||(n=this._base64Encode(n,a))!=null)return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`CtxSignHash`,o,i,a,null)},$.prototype.CtxSign=function(e,t,n,r,i,a,o){var s;if(typeof n!=`string`||(n=this._stringToBytes(n,o))!=null)return s=this._funcMakeParams([e,t,new g(n),r,i]),this._funcCall(`CtxSign`,s,a,o,null)},$.prototype.CtxSignFile=function(e,t,n,r,i,a,o,s){var c=this._funcMakeParams([e,t,n,r,i,a]);this._funcCall(`CtxSignFile`,c,o,s,null)},$.prototype.CtxAppendSignHash=function(e,t,n,r,i,a,o){var s;if(!(typeof n!=`string`&&(n=this._base64Encode(n,o))==null||typeof r!=`string`&&(r=this._base64Encode(r,o))==null))return s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`CtxAppendSignHash`,s,a,o,null)},$.prototype.CtxAppendSign=function(e,t,n,r,i,a,o){var s;if(!(n!=null&&typeof n==`string`&&(n=this._stringToBytes(n,o))==null||typeof r!=`string`&&(r=this._base64Encode(r,o))==null))return s=this._funcMakeParams([e,t,n?new g(n):null,r,i]),this._funcCall(`CtxAppendSign`,s,a,o,null)},$.prototype.CtxAppendSignFile=function(e,t,n,r,i,a,o,s){var c=this._funcMakeParams([e,t,n,r,i,a]);this._funcCall(`CtxAppendSignFile`,c,o,s,null)},$.prototype.CtxGetSignValue=function(e,t,n,r,i){var a;if(typeof n==`string`||(n=this._base64Encode(n,i))!=null)return a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxGetSignValue`,a,r,i,null)},$.prototype.CtxCreateSignerEx=function(e,t,n,r,i,a,o){var s;if(typeof n==`string`||(n=this._base64Encode(n,o))!=null)return s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`CtxCreateSignerEx`,s,a,o,null)},$.prototype.ShowSenderInfo=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`ShowSenderInfo`,r,t,n,null)},$.prototype.IsEnveloped=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`IsEnveloped`,r,t,n,null)},$.prototype.IsEnvelopedFile=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`IsEnvelopedFile`,r,t,n,null)},$.prototype.Envelop=function(e,t,n,r,i,a){var o;if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([e,t,n,new g(r)]),this._funcCall(`Envelop`,o,i,a,null)},$.prototype.Develop=function(e,t,n,r){var i,a=[];if(typeof t!=`boolean`&&(r=n,n=t),typeof e==`string`||(e=this._base64Encode(e,r))!=null)return a.push(e),typeof t==`boolean`?a.push(t):a.push(null),i=this._funcMakeParams(a),this._funcCall(`Develop`,i,n,r,null)},$.prototype.EnvelopFile=function(e,t,n,r,i,a,o){var s=this._funcMakeParams([e,t,n,r,i]);this._funcCall(`EnvelopFile`,s,a,o,null)},$.prototype.DevelopFile=function(e,t,n,r,i){var a,o=[];return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(t),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`DevelopFile`,a,r,i,null)},$.prototype.EnvelopEx=function(e,t,n,r,i,a){var o;if(e.className==`EndUserArrayList`&&(e=e.m_array),t.className==`EndUserArrayList`&&(t=t.m_array),typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([e,t,n,new g(r)]),this._funcCall(`EnvelopEx`,o,i,a,null)},$.prototype.DevelopEx=function(e,t,n,r,i){var a,o=[];if(typeof n!=`boolean`&&(i=r,r=n),typeof e==`string`||(e=this._base64Encode(e,i))!=null)return o.push(e),o.push(t?new g(t):null),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`DevelopEx`,a,r,i,null)},$.prototype.EnvelopFileEx=function(e,t,n,r,i,a,o){var s;e.className==`EndUserArrayList`&&(e=e.m_array),t.className==`EndUserArrayList`&&(t=t.m_array),s=this._funcMakeParams([e,t,n,r,i]),this._funcCall(`EnvelopFileEx`,s,a,o,null)},$.prototype.EnvelopToRecipients=function(e,t,n,r,i){var a;e.className==`EndUserArrayList`&&(e=e.m_array);for(var o=[],s=0;s<e.length;s++)o.push(new g(e[s]));if(typeof n!=`string`||(n=this._stringToBytes(n,i))!=null)return a=this._funcMakeParams([o,t,new g(n)]),this._funcCall(`EnvelopToRecipients`,a,r,i,null)},$.prototype.EnvelopFileToRecipients=function(e,t,n,r,i,a){var o;e.className==`EndUserArrayList`&&(e=e.m_array);for(var s=[],c=0;c<e.length;c++)s.push(new g(e[c]));o=this._funcMakeParams([s,t,n,r]),this._funcCall(`EnvelopFileToRecipients`,o,i,a,null)},$.prototype.EnvelopToRecipientsEx=function(e,t,n,r,i,a){var o;e.className==`EndUserArrayList`&&(e=e.m_array);for(var s=[],c=0;c<e.length;c++)s.push(new g(e[c]));if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([s,t,n,new g(r)]),this._funcCall(`EnvelopToRecipientsEx`,o,i,a,null)},$.prototype.EnvelopFileToRecipientsEx=function(e,t,n,r,i,a,o){var s;e.className==`EndUserArrayList`&&(e=e.m_array);for(var c=[],l=0;l<e.length;l++)c.push(new g(e[l]));s=this._funcMakeParams([c,t,n,r,i]),this._funcCall(`EnvelopFileToRecipientsEx`,s,a,o,null)},$.prototype.EnvelopToRecipientsWithOCode=function(e,t,n,r,i,a){var o;if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([e,t,n,new g(r)]),this._funcCall(`EnvelopToRecipientsWithOCode`,o,i,a,null)},$.prototype.EnvelopExWithDynamicKey=function(e,t,n,r,i,a,o){var s;if(e.className==`EndUserArrayList`&&(e=e.m_array),t.className==`EndUserArrayList`&&(t=t.m_array),typeof i!=`string`||(i=this._stringToBytes(i,o))!=null)return s=this._funcMakeParams([e,t,n,r,new g(i)]),this._funcCall(`EnvelopExWithDynamicKey`,s,a,o,null)},$.prototype.EnvelopFileExWithDynamicKey=function(e,t,n,r,i,a,o,s){var c;e.className==`EndUserArrayList`&&(e=e.m_array),t.className==`EndUserArrayList`&&(t=t.m_array),c=this._funcMakeParams([e,t,n,r,i,a]),this._funcCall(`EnvelopFileExWithDynamicKey`,c,o,s,null)},$.prototype.EnvelopToRecipientsWithDynamicKey=function(e,t,n,r,i,a){var o;e.className==`EndUserArrayList`&&(e=e.m_array);for(var s=[],c=0;c<e.length;c++)s.push(new g(e[c]));if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([s,t,n,new g(r)]),this._funcCall(`EnvelopToRecipientsWithDynamicKey`,o,i,a,null)},$.prototype.EnvelopFileToRecipientsWithDynamicKey=function(e,t,n,r,i,a,o){var s;e.className==`EndUserArrayList`&&(e=e.m_array);for(var c=[],l=0;l<e.length;l++)c.push(new g(e[l]));s=this._funcMakeParams([c,t,n,r,i]),this._funcCall(`EnvelopFileToRecipientsWithDynamicKey`,s,a,o,null)},$.prototype.EnvelopToRecipientsWithSettings=function(e,t,n,r,i,a,o,s,c){var l;if(typeof n!=`string`||(n=this._stringToBytes(n,c))!=null){e.className==`EndUserArrayList`&&(e=e.m_array);for(var u=[],d=0;d<e.length;d++)u.push(new g(e[d]));return l=this._funcMakeParams([u,t,new g(n),r,i,a,o]),this._funcCall(`EnvelopToRecipientsWithSettings`,l,s,c,null)}},$.prototype.RawEnvelop=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._stringToBytes(t,r))!=null)return i=this._funcMakeParams([new g(e),new g(t)]),this._funcCall(`RawEnvelop`,i,n,r,null)},$.prototype.RawDevelop=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`RawDevelop`,i,n,r,null)},$.prototype.EnvelopRSA=function(e,t,n,r,i,a,o){return this.EnvelopRSAEx(e,[t],[n],r,i,a,o)},$.prototype.EnvelopFileRSA=function(e,t,n,r,i,a,o,s){this.EnvelopFileRSAEx(e,[t],[n],r,i,a,o,s)},$.prototype.EnvelopRSAEx=function(e,t,n,r,i,a,o){var s;if(t.className==`EndUserArrayList`&&(t=t.m_array),n.className==`EndUserArrayList`&&(n=n.m_array),typeof i!=`string`||(i=this._stringToBytes(i,o))!=null)return s=this._funcMakeParams([e,t,n,r,new g(i)]),this._funcCall(`EnvelopRSAEx`,s,a,o,null)},$.prototype.EnvelopFileRSAEx=function(e,t,n,r,i,a,o,s){var c;t.className==`EndUserArrayList`&&(t=t.m_array),n.className==`EndUserArrayList`&&(n=n.m_array),c=this._funcMakeParams([e,t,n,r,i,a]),this._funcCall(`EnvelopFileRSAEx`,c,o,s,null)},$.prototype.EnvelopToRecipientsRSA=function(e,t,n,r,i,a){var o;t.className==`EndUserArrayList`&&(t=t.m_array);for(var s=[],c=0;c<t.length;c++)s.push(new g(t[c]));if(typeof r!=`string`||(r=this._stringToBytes(r,a))!=null)return o=this._funcMakeParams([e,s,n,new g(r)]),this._funcCall(`EnvelopToRecipientsRSA`,o,i,a,null)},$.prototype.EnvelopFileToRecipientsRSA=function(e,t,n,r,i,a,o){var s;t.className==`EndUserArrayList`&&(t=t.m_array);for(var c=[],l=0;l<t.length;l++)c.push(new g(t[l]));s=this._funcMakeParams([e,c,n,r,i]),this._funcCall(`EnvelopFileToRecipientsRSA`,s,a,o,null)},$.prototype.CtxEnvelop=function(e,t,n,r,i,a,o,s){var c;if(typeof a!=`string`||(a=this._stringToBytes(a,s))!=null){t.className==`EndUserArrayList`&&(t=t.m_array);for(var l=[],u=0;u<t.length;u++)l.push(new g(t[u]));return c=this._funcMakeParams([e,l,n,r,i,new g(a)]),this._funcCall(`CtxEnvelop`,c,o,s,null)}},$.prototype.CtxEnvelopFile=function(e,t,n,r,i,a,o,s,c){var l;t.className==`EndUserArrayList`&&(t=t.m_array);for(var u=[],d=0;d<t.length;d++)u.push(new g(t[d]));l=this._funcMakeParams([e,u,n,r,i,a,o]),this._funcCall(`CtxEnvelopFile`,l,s,c,null)},$.prototype.CtxEnvelopWithDynamicKey=function(e,t,n,r,i,a,o,s){var c;if(typeof a!=`string`||(a=this._stringToBytes(a,s))!=null){t.className==`EndUserArrayList`&&(t=t.m_array);for(var l=[],u=0;u<t.length;u++)l.push(new g(t[u]));return c=this._funcMakeParams([e,l,n,r,i,new g(a)]),this._funcCall(`CtxEnvelopWithDynamicKey`,c,o,s,null)}},$.prototype.CtxEnvelopFileWithDynamicKey=function(e,t,n,r,i,a,o,s,c){var l;t.className==`EndUserArrayList`&&(t=t.m_array);for(var u=[],d=0;d<t.length;d++)u.push(new g(t[d]));l=this._funcMakeParams([e,u,n,r,i,a,o]),this._funcCall(`CtxEnvelopFileWithDynamicKey`,l,s,c,null)},$.prototype.CtxDevelop=function(e,t,n,r,i,a){var o,s=[];if(typeof r!=`boolean`&&(a=i,i=r),typeof t==`string`||(t=this._base64Encode(t,a))!=null)return s.push(e),s.push(t),s.push(n?new g(n):null),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`CtxDevelop`,o,i,a,null)},$.prototype.CtxDevelopFile=function(e,t,n,r,i,a,o){var s,c=[];return typeof i!=`boolean`&&(o=a,a=i),c.push(e),c.push(t),c.push(n?new g(n):null),c.push(r),typeof i==`boolean`?c.push(i):c.push(null),s=this._funcMakeParams(c),this._funcCall(`CtxDevelopFile`,s,a,o,null)},$.prototype.CtxCreateAuthData=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._stringToBytes(n,i))!=null)return a=this._funcMakeParams([e,new g(t),new g(n)]),this._funcCall(`CtxCreateAuthData`,a,r,i,null)},$.prototype.ProtectDataByPassword=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._stringToBytes(e,r))!=null)return i=this._funcMakeParams([new g(e),t]),this._funcCall(`ProtectDataByPassword`,i,n,r,null)},$.prototype.UnprotectDataByPassword=function(e,t,n,r){var i;if(typeof e==`string`||(e=this._base64Encode(e,r))!=null)return i=this._funcMakeParams([e,t]),this._funcCall(`UnprotectDataByPassword`,i,n,r,null)},$.prototype.CreateEndUserSession=function(){return new W},$.prototype.SessionIsInitialized=function(e,t,n){var r;return e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionIsInitialized`,r,t,n,null)},$.prototype.SessionClose=function(e,t,n){var r;e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionClose`,r,t,n,null)},$.prototype.ClientSessionCreateStep1=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`ClientSessionCreateStep1`,r,t,n,null)},$.prototype.ServerSessionCreateStep1=function(e,t,n,r){var i;return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ServerSessionCreateStep1`,i,n,r,null)},$.prototype.ClientSessionCreateStep2=function(e,t,n,r){var i,a=this;e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ClientSessionCreateStep2`,i,n,r,function(t,n,r){e.SetData(t.GetData()),a.IsAsync(n,r)&&n()})},$.prototype.ServerSessionCreateStep2=function(e,t,n,r){var i;e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ServerSessionCreateStep2`,i,n,r,null)},$.prototype.SessionSave=function(e,t,n){var r;return e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionSave`,r,t,n,null)},$.prototype.SessionLoad=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`SessionLoad`,r,t,n,null)},$.prototype.SessionCheckCertificates=function(e,t,n){var r;return e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionCheckCertificates`,r,t,n,null)},$.prototype.SessionEncrypt=function(e,t,n,r){var i,a=!1,o=this;if(typeof t!=`string`||(a=!0,(t=this._stringToBytes(t,r))!=null))return e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SessionEncrypt`,i,n,r,a?function(e,t,n){return o.BASE64Encode(e,t,n)}:null)},$.prototype.SessionDecrypt=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SessionDecrypt`,i,n,r,null)},$.prototype.SessionEncryptContinue=function(e,t,n,r){var i,a=this,o=!1;if(typeof t!=`string`||(o=!0,(t=this._stringToBytes(t,r))!=null))return e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SessionEncryptContinue`,i,n,r,function(e,n,r){if(o)return a.BASE64Encode(e,n,r);var i=a.IsAsync(n,r);if(!a._copyArrayData(t,e)){var s=a.MakeError(Z.ERROR_BAD_PARAMETER,``);if(i)return void r(s);throw new Q(s.errorCode,s.message)}if(!i)return t;n(t)})},$.prototype.SessionDecryptContinue=function(e,t,n,r){var i,a=this;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return e.SetData(null),i=this._funcMakeParams([e,new g(t)]),this._funcCall(`SessionDecryptContinue`,i,n,r,function(e,n,r){var i=a.IsAsync(n,r);if(!a._copyArrayData(t,e)){var o=a.MakeError(Z.ERROR_BAD_PARAMETER,``);if(i)return void r(o);throw new Q(o.errorCode,o.message)}if(!i)return t;n(t)})},$.prototype.SessionGetPeerCertificateInfo=function(e,t,n){var r;return e.SetData(null),r=this._funcMakeParams([e]),this._funcCall(`SessionGetPeerCertificateInfo`,r,t,n,null)},$.prototype.ClientDynamicKeySessionCreate=function(e,t,n,r,i){var a,o=[];return typeof t==`string`&&typeof n==`string`||(i=r,r=n),o.push(e),typeof t==`string`&&typeof n==`string`?(o.push(t),o.push(n),o.push(null)):(o.push(null),o.push(null),o.push(new g(t))),a=this._funcMakeParams(o),this._funcCall(`ClientDynamicKeySessionCreate`,a,r,i,null)},$.prototype.ServerDynamicKeySessionCreate=function(e,t,n,r){var i;return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ServerDynamicKeySessionCreate`,i,n,r,null)},$.prototype.ClientDynamicKeySessionLoad=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ClientDynamicKeySessionLoad`,r,t,n,null)},$.prototype.SCClientIsRunning=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`SCClientIsRunning`,n,e,t,null)},$.prototype.SCClientStart=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`SCClientStart`,n,e,t,null)},$.prototype.SCClientStop=function(e,t){var n=this._funcMakeParams(null);this._funcCall(`SCClientStop`,n,e,t,null)},$.prototype.SCClientAddGate=function(e,t,n,r,i,a,o,s){var c;typeof i!=`string`&&(o=i,s=a,i=null,a=null),c=this._funcMakeParams([e,t,n,r,i,a]),this._funcCall(`SCClientAddGate`,c,o,s,null)},$.prototype.SCClientRemoveGate=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`SCClientRemoveGate`,r,t,n,null)},$.prototype.SCClientGetStatistic=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`SCClientGetStatistic`,n,e,t,null)},$.prototype.AppendTransportHeader=function(e,t,n,r,i,a,o){var s;return s=this._funcMakeParams([e,t,n,new g(r),new g(i)]),this._funcCall(`AppendTransportHeader`,s,a,o,null)},$.prototype.ParseTransportHeader=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ParseTransportHeader`,r,t,n,null)},$.prototype.AppendCryptoHeader=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`AppendCryptoHeader`,a,r,i,null)},$.prototype.ParseCryptoHeader=function(e,t,n){var r;return r=this._funcMakeParams([new g(e)]),this._funcCall(`ParseCryptoHeader`,r,t,n,null)},$.prototype.AppendFileTransportHeader=function(e,t,n,r,i,a,o,s){var c=this._funcMakeParams([e,t,n,new g(r),i,a]);this._funcCall(`AppendFileTransportHeader`,c,o,s,null)},$.prototype.ParseFileTransportHeader=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`ParseFileTransportHeader`,i,n,r,null)},$.prototype.AppendFileCryptoHeader=function(e,t,n,r,i,a){var o=this._funcMakeParams([e,t,n,r]);this._funcCall(`AppendFileCryptoHeader`,o,i,a,null)},$.prototype.ParseFileCryptoHeader=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`ParseFileCryptoHeader`,i,n,r,null)},$.prototype.DevCtxEnum=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`DevCtxEnum`,r,t,n,null)},$.prototype.DevCtxOpen=function(e,t,n,r,i){var a;return a=this._funcMakeParams([e,t,n]),this._funcCall(`DevCtxOpen`,a,r,i,null)},$.prototype.CreateDeviceContext=function(){return new K},$.prototype.DevCtxEnumVirtual=function(e,t,n){var r,i=this;return r=this._funcMakeParams([e]),this._funcCall(`DevCtxEnumVirtual`,r,t,n,function(t,n,r){var a=i.IsAsync(n,r);try{if(t==null){if(!a)return null;n(null)}if(e.set(t[1]),!a)return t[0];n(t[0])}catch{var o=i.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(a)return void r(o);throw new Q(o.errorCode,o.message)}})},$.prototype.DevCtxClose=function(e,t,n){var r;return r=this._funcMakeParams([e]),this._funcCall(`DevCtxClose`,r,t,n,null)},$.prototype.DevCtxGetData=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`DevCtxGetData`,i,n,r,null)},$.prototype.DevCtxChangePassword=function(e,t,n,r){var i;return i=this._funcMakeParams([e,t]),this._funcCall(`DevCtxChangePassword`,i,n,r,null)},$.prototype.GetHostInfo=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`GetHostInfo`,n,e,t,null)},$.prototype.IsRemotelyControlled=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`IsRemotelyControlled`,n,e,t,null)},$.prototype.CtxCreate=function(e,t){var n;return n=this._funcMakeParams(null),this._funcCall(`CtxCreate`,n,e,t,null)},$.prototype.CtxFree=function(e,t,n){var r=this._funcMakeParams([e]);this._funcCall(`CtxFree`,r,t,n,null)},$.prototype.CtxSetParameter=function(e,t,n,r,i){var a;typeof n==`boolean`&&(n=+!!n),a=this._funcMakeParams([e,t,n]),this._funcCall(`CtxSetParameter`,a,r,i,null)},$.prototype.CreateReference=function(e,t){return new Y(e,t)},$.prototype.ASiCGetASiCType=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`ASiCGetASiCType`,r,t,n,null)},$.prototype.ASiCGetSignType=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`ASiCGetSignType`,r,t,n,null)},$.prototype.ASiCGetSignsCount=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`ASiCGetSignsCount`,r,t,n,null)},$.prototype.ASiCGetSignerInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCGetSignerInfo`,i,n,r,null)},$.prototype.ASiCGetSignTimeInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCGetSignTimeInfo`,i,n,r,null)},$.prototype.ASiCGetSignReferences=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCGetSignReferences`,i,n,r,null)},$.prototype.ASiCGetReference=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._base64Decode(e,r))!=null)return i=this._funcMakeParams([new g(e),t]),this._funcCall(`ASiCGetReference`,i,n,r,null)},$.prototype.ASiCSign=function(e,t,n,r,i,a){for(var o,s=[],c=[],l=0;l<r.length;l++)s.push(r[l].GetName()),c.push(new g(r[l].GetData()));return o=this._funcMakeParams([e,t,n,s,c]),this._funcCall(`ASiCSign`,o,i,a,null)},$.prototype.ASiCAppendSign=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._base64Decode(n,i))!=null)return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`ASiCAppendSign`,a,r,i,null)},$.prototype.ASiCVerify=function(e,t,n,r,i){var a,o=[];if(typeof t!=`string`||(t=this._base64Decode(t,i))!=null)return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(new g(t)),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`ASiCVerify`,a,r,i,null)},$.prototype.CtxASiCSign=function(e,t,n,r,i,a,o,s){for(var c,l=[],u=[],d=0;d<a.length;d++)l.push(a[d].GetName()),u.push(new g(a[d].GetData()));return c=this._funcMakeParams([e,t,n,r,i,l,u]),this._funcCall(`CtxASiCSign`,c,o,s,null)},$.prototype.CtxASiCAppendSign=function(e,t,n,r,i,a,o){var s;if(typeof i!=`string`||(i=this._base64Decode(i,o))!=null)return s=this._funcMakeParams([e,t,n,r,new g(i)]),this._funcCall(`CtxASiCAppendSign`,s,a,o,null)},$.prototype.CtxASiCGetSignerInfo=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._base64Decode(n,i))!=null)return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`CtxASiCGetSignerInfo`,a,r,i,null)},$.prototype.ASiCGetSignLevel=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCGetSignLevel`,i,n,r,null)},$.prototype.ASiCIsAllContentCovered=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`ASiCIsAllContentCovered`,i,n,r,null)},$.prototype.PDFGetSignType=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`PDFGetSignType`,i,n,r,null)},$.prototype.PDFGetSignsCount=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`PDFGetSignsCount`,r,t,n,null)},$.prototype.PDFGetSignerInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`PDFGetSignerInfo`,i,n,r,null)},$.prototype.PDFGetSignTimeInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`PDFGetSignTimeInfo`,i,n,r,null)},$.prototype.PDFSign=function(e,t,n,r){var i;return i=this._funcMakeParams([new g(e),t]),this._funcCall(`PDFSign`,i,n,r,null)},$.prototype.PDFVerify=function(e,t,n,r,i){var a,o=[];if(typeof t!=`string`||(t=this._base64Decode(t,i))!=null)return typeof n!=`boolean`&&(i=r,r=n),o.push(e),o.push(new g(t)),typeof n==`boolean`?o.push(n):o.push(null),a=this._funcMakeParams(o),this._funcCall(`PDFVerify`,a,r,i,null)},$.prototype.CtxPDFSign=function(e,t,n,r,i,a){var o;return o=this._funcMakeParams([e,t,new g(n),r]),this._funcCall(`CtxPDFSign`,o,i,a,null)},$.prototype.CtxPDFGetSignerInfo=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._base64Decode(n,i))!=null)return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`CtxPDFGetSignerInfo`,a,r,i,null)},$.prototype.XAdESGetType=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`XAdESGetType`,r,t,n,null)},$.prototype.XAdESGetSignsCount=function(e,t,n){var r;if(typeof e!=`string`||(e=this._base64Decode(e,n))!=null)return r=this._funcMakeParams([new g(e)]),this._funcCall(`XAdESGetSignsCount`,r,t,n,null)},$.prototype.XAdESGetSignLevel=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`XAdESGetSignLevel`,i,n,r,null)},$.prototype.XAdESGetSignerInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`XAdESGetSignerInfo`,i,n,r,null)},$.prototype.XAdESGetSignTimeInfo=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`XAdESGetSignTimeInfo`,i,n,r,null)},$.prototype.XAdESGetSignReferences=function(e,t,n,r){var i;if(typeof t!=`string`||(t=this._base64Decode(t,r))!=null)return i=this._funcMakeParams([e,new g(t)]),this._funcCall(`XAdESGetSignReferences`,i,n,r,null)},$.prototype.XAdESGetReference=function(e,t,n,r){var i;if(typeof e!=`string`||(e=this._base64Decode(e,r))!=null)return i=this._funcMakeParams([new g(e),t]),this._funcCall(`XAdESGetReference`,i,n,r,null)},$.prototype.XAdESSign=function(e,t,n,r,i){for(var a,o=[],s=[],c=0;c<n.length;c++)o.push(n[c].GetName()),s.push(new g(n[c].GetData()));return a=this._funcMakeParams([e,t,o,s]),this._funcCall(`XAdESSign`,a,r,i,null)},$.prototype.XAdESVerify=function(e,t,n,r,i,a){var o,s=[],c=null,l=null;if(e!=null){c=[],l=[];for(var u=0;u<e.length;u++)c.push(e[u].GetName()),l.push(new g(e[u].GetData()))}if(typeof n!=`string`||(n=this._base64Decode(n,a))!=null)return typeof r!=`boolean`&&(a=i,i=r),s.push(c),s.push(l),s.push(t),s.push(new g(n)),typeof r==`boolean`?s.push(r):s.push(null),o=this._funcMakeParams(s),this._funcCall(`XAdESVerify`,o,i,a,null)},$.prototype.CtxXAdESSign=function(e,t,n,r,i,a,o){for(var s,c=[],l=[],u=0;u<i.length;u++)c.push(i[u].GetName()),l.push(new g(i[u].GetData()));return s=this._funcMakeParams([e,t,n,r,c,l]),this._funcCall(`CtxXAdESSign`,s,a,o,null)},$.prototype.CtxXAdESGetSignerInfo=function(e,t,n,r,i){var a;if(typeof n!=`string`||(n=this._base64Decode(n,i))!=null)return a=this._funcMakeParams([e,t,new g(n)]),this._funcCall(`CtxXAdESGetSignerInfo`,a,r,i,null)},$.prototype.SServerClientGeneratePrivateKeyAsync=function(e,t,n,r,i,a,o,s,c,l,u,d,f){var p;return p=this._funcMakeParams([e,t,n,r,i,a,o,s,c,l,u]),this._funcCall(`SServerClientGeneratePrivateKeyAsync`,p,d,f,null)},$.prototype.SServerClientCheckGeneratePrivateKeyStatus=function(e,t,n,r,i,a){var o,s=this;return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`SServerClientCheckGeneratePrivateKeyStatus`,o,i,a,function(e,t,n){var r=s.IsAsync(t,n);try{for(var i=new f,a=0;a<e.length;a++)i.add(e[a]);if(i.size()==0&&(i=null),!r)return i;t(i)}catch{var o=s.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(o);throw new Q(o.errorCode,o.message)}})},$.prototype.SServerClientSignHashAsync=function(e,t,n,r,i,a,o,s,c){var l;if(typeof a==`string`||(a=this._base64Encode(a,c))!=null)return l=this._funcMakeParams([e,t,n,r,i,a,o]),this._funcCall(`SServerClientSignHashAsync`,l,s,c,null)},$.prototype.SServerClientCheckSignHashStatus=function(e,t,n,r,i,a){var o;return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`SServerClientCheckSignHashStatus`,o,i,a,null)},$.prototype.SServerClientSignHashesAsync=function(e,t,n,r,i,a,o,s,c,l){var u;return a.className==`EndUserArrayList`&&(a=a.m_array),o.className==`EndUserArrayList`&&(o=o.m_array),u=this._funcMakeParams([e,t,n,r,i,a,o,s]),this._funcCall(`SServerClientSignHashesAsync`,u,c,l,null)},$.prototype.SServerClientCheckSignHashesStatus=function(e,t,n,r,i,a){var o,s=this;return o=this._funcMakeParams([e,t,n,r]),this._funcCall(`SServerClientCheckSignHashesStatus`,o,i,a,function(e,t,n){var r=s.IsAsync(t,n);try{for(var i=new f,a=0;a<e.length;a++)i.add(e[a]);if(i.size()==0&&(i=null),!r)return i;t(i)}catch{var o=s.MakeError(Z.ERROR_LIBRARY_COMUNICATION_FAILED,``);if(r)return void n(o);throw new Q(o.errorCode,o.message)}})},{EndUserLibraryLoader:d,EUSignCP:$,EndUserError:Z}})==`function`?r.apply(t,i):r)===void 0||(e.exports=a)},function(e,t,n){"use strict";n.r(t),function(e){n.d(t,`EndUser`,function(){return T});var r=n(1);n.d(t,`EndUserError`,function(){return r});var i=n(14);n.d(t,`EndUserLibraryInfoJS`,function(){return i.a}),n.d(t,`EndUserLibraryInfoSW`,function(){return i.b});var a=n(9);n.d(t,`CASettings`,function(){return a.a}),n.d(t,`KSPSettings`,function(){return a.d}),n.d(t,`EndUserSettings`,function(){return a.c}),n.d(t,`EndUserProxySettings`,function(){return a.b});var o=n(10);n.d(t,`EndUserOwnerInfo`,function(){return o.a});var s=n(8);n.d(t,`EndUserCertificateInfoEx`,function(){return s.a});var c=n(20);n.d(t,`EndUserCertificate`,function(){return c.a});var l=n(21);n.d(t,`EndUserKeyMedia`,function(){return l.a});var u=n(15);n.d(t,`EndUserJKSPrivateKeyInfo`,function(){return u.a});var d=n(18);n.d(t,`EndUserContext`,function(){return d.a}),n.d(t,`EndUserPrivateKeyContext`,function(){return d.b});var f=n(0);n.d(t,`EndUserConstants`,function(){return f});var p=n(11);n.d(t,`EndUserTaxReport`,function(){return p.b}),n.d(t,`EndUserTaxReceipt`,function(){return p.a});var m=n(6);n.d(t,`EndUserTimeInfo`,function(){return m.a});var h=n(7);n.d(t,`EndUserSignContainerInfo`,function(){return h.a});var g=n(5);n.d(t,`EndUserSignInfo`,function(){return g.a});var _=n(12);n.d(t,`EndUserSenderInfo`,function(){return _.a});var v=n(16);n.d(t,`EndUserParams`,function(){return v.a});var y=n(22);n.d(t,`EndUserInfo`,function(){return y.a});var b=n(17);n.d(t,`EndUserRequestInfo`,function(){return b.a});var x=n(19);n.d(t,`EndUserClientRegistrationParameters`,function(){return x.a}),n.d(t,`EndUserClientRegistrationToken`,function(){return x.b});var S=n(23);n.d(t,`EndUserEvents`,function(){return S});var C=n(24),w=n(26),T=function(){function t(e,t,n){switch(t===void 0&&(t=f.EndUserLibraryType.JS),n===void 0&&(n=5),t){case f.EndUserLibraryType.SW:this.m_library=new w.a;break;case f.EndUserLibraryType.JS:case f.EndUserLibraryType.MS:default:this.m_library=new C.a(e,n)}}return t.prototype.Destroy=function(){var t=this;return new e(function(e,n){t.m_library.Finalize(),t.m_library=null,e()})},t.prototype.AddEventListener=function(e,t){return this.m_library.AddEventListener(e,t)},t.prototype.GetLibraryInfo=function(e){return this.m_library.GetLibraryInfo(e)},t.prototype.IsInitialized=function(){return this.m_library.IsInitialized()},t.prototype.Initialize=function(e){return this.m_library.Initialize(e)},t.prototype.SetLanguage=function(e){return this.m_library.SetLanguage(e)},t.prototype.SetRuntimeParameter=function(e,t){return this.m_library.SetRuntimeParameter(e,t)},t.prototype.GetStorageParameter=function(e,t){return t===void 0&&(t=!1),this.m_library.GetStorageParameter(e,t)},t.prototype.SetStorageParameter=function(e,t,n){return n===void 0&&(n=!1),this.m_library.SetStorageParameter(e,t,n)},t.prototype.GetCAs=function(){return this.m_library.GetCAs()},t.prototype.GetProxySettings=function(){return this.m_library.GetProxySettings()},t.prototype.SetProxySettings=function(e){return this.m_library.SetProxySettings(e)},t.prototype.GetHostInfo=function(){return this.m_library.GetHostInfo()},t.prototype.GetKeyMedias=function(){return this.m_library.GetKeyMedias()},t.prototype.GetJKSPrivateKeys=function(e){return this.m_library.GetJKSPrivateKeys(e)},t.prototype.IsPrivateKeyReaded=function(){return this.m_library.IsPrivateKeyReaded()},t.prototype.ResetPrivateKey=function(){return this.m_library.ResetPrivateKey()},t.prototype.ResetOperationKSP=function(){return this.m_library.ResetOperationKSP()},t.prototype.ReadPrivateKey=function(e,t,n){return this.m_library.ReadPrivateKey(e,t,n)},t.prototype.ReadPrivateKeyBinary=function(e,t,n,r){return this.m_library.ReadPrivateKeyBinary(e,t,n,r)},t.prototype.ReadPrivateKeySIM=function(e,t,n,r){return n===void 0&&(n=!0),r===void 0&&(r=0),this.m_library.ReadPrivateKeySIM(e,t,n,r)},t.prototype.ReadPrivateKeyKSP=function(e,t,n,r,i,a,o){return n===void 0&&(n=!0),r===void 0&&(r=0),i===void 0&&(i=null),a===void 0&&(a=null),o===void 0&&(o=null),this.m_library.ReadPrivateKeyKSP(e,t,n,r,i,a,o)},t.prototype.GetOwnCertificates=function(){return this.m_library.GetOwnCertificates()},t.prototype.GetOwnEUserParams=function(){return this.m_library.GetOwnEUserParams()},t.prototype.ChangeOwnCertificatesStatus=function(e,t){return this.m_library.ChangeOwnCertificatesStatus(e,t)},t.prototype.MakeNewCertificate=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){return h===void 0&&(h=!1),g===void 0&&(g=null),_===void 0&&(_=null),v===void 0&&(v=0),y===void 0&&(y=null),this.m_library.MakeNewCertificate(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y)},t.prototype.MakeDeviceCertificate=function(e,t,n,r,i){return this.m_library.MakeDeviceCertificate(e,t,n,r,i)},t.prototype.SetKeyMediaUserPassword=function(e,t){return this.m_library.SetKeyMediaUserPassword(e,t)},t.prototype.ChangePrivateKeyPassword=function(e,t){return this.m_library.ChangePrivateKeyPassword(e,t)},t.prototype.ChangePrivateKeyPasswordBinary=function(e,t,n){return this.m_library.ChangePrivateKeyPasswordBinary(e,t,n)},t.prototype.GeneratePrivateKey=function(e,t,n,r,i,a,o,s,c,l,u,d){return this.m_library.GeneratePrivateKey(e,t,n,r,i,a,o,s,c,l,u,d)},t.prototype.GeneratePrivateKeyBinary=function(e,t,n,r,i,a,o,s,c,l,u){return this.m_library.GeneratePrivateKeyBinary(e,t,n,r,i,a,o,s,c,l,u)},t.prototype.GetKeyInfo=function(e){return this.m_library.GetKeyInfo(e)},t.prototype.GetKeyInfoBinary=function(e,t){return this.m_library.GetKeyInfoBinary(e,t)},t.prototype.GetClientRegistrationTokenKSP=function(e,t){return this.m_library.GetClientRegistrationTokenKSP(e,t)},t.prototype.HashData=function(e,t,n){return this.m_library.HashData(e,t,n)},t.prototype.GetSigner=function(e,t,n){return this.m_library.GetSigner(e,t,n)},t.prototype.SignData=function(e,t){return t===void 0&&(t=!1),this.m_library.SignData(e,t)},t.prototype.SignDataInternal=function(e,t,n){return n===void 0&&(n=!1),this.m_library.SignDataInternal(e,t,n)},t.prototype.SignHash=function(e,t,n,r){return r===void 0&&(r=!1),this.m_library.SignHash(e,t,n,r)},t.prototype.SignDataEx=function(e,t,n,r,i){return i===void 0&&(i=!1),this.m_library.SignDataEx(e,t,n,r,i)},t.prototype.AppendSign=function(e,t,n,r,i){return i===void 0&&(i=!1),this.m_library.AppendSign(e,t,n,r,i)},t.prototype.AppendSignHash=function(e,t,n,r,i){return this.m_library.AppendSignHash(e,t,n,r,i)},t.prototype.GetSignValue=function(e,t,n,r){return r===void 0&&(r=!1),this.m_library.GetSignValue(e,t,n,r)},t.prototype.VerifyHash=function(e,t,n){return n===void 0&&(n=-1),this.m_library.VerifyHash(e,t,n)},t.prototype.VerifyData=function(e,t,n){return n===void 0&&(n=-1),this.m_library.VerifyData(e,t,n)},t.prototype.VerifyDataInternal=function(e,t){return t===void 0&&(t=-1),this.m_library.VerifyDataInternal(e,t)},t.prototype.EnvelopData=function(e,t,n,r,i,a){return a===void 0&&(a=!1),this.m_library.EnvelopData(e,t,n,r,i,a)},t.prototype.DevelopData=function(e,t){return this.m_library.DevelopData(e,t)},t.prototype.ProtectDataByPassword=function(e,t,n){return this.m_library.ProtectDataByPassword(e,t,n)},t.prototype.UnprotectDataByPassword=function(e,t,n){return this.m_library.UnprotectDataByPassword(e,t,n)},t.prototype.CreateAuthData=function(e,t,n){return this.m_library.CreateAuthData(e,t,n)},t.prototype.GetTSPByAccessInfo=function(e,t,n,r,i){return this.m_library.GetTSPByAccessInfo(e,t,n,r,i)},t.prototype.CheckTSP=function(e,t,n){return this.m_library.CheckTSP(e,t,n)},t.prototype.ClientDynamicKeySessionCreate=function(e){return this.m_library.ClientDynamicKeySessionCreate(e)},t.prototype.SessionClose=function(e){return this.m_library.SessionClose(e)},t.prototype.SessionEncrypt=function(e,t,n){return this.m_library.SessionEncrypt(e,t,n)},t.prototype.SessionDecrypt=function(e,t){return this.m_library.SessionDecrypt(e,t)},t.prototype.CtxCreate=function(){return this.m_library.CtxCreate()},t.prototype.CtxFree=function(e){return this.m_library.CtxFree(e)},t.prototype.CtxSetParameter=function(e,t,n){return this.m_library.CtxSetParameter(e,t,n)},t.prototype.CtxReadPrivateKey=function(e,t,n,r){return e===void 0&&(e=null),this.m_library.CtxReadPrivateKey(e,t,n,r)},t.prototype.CtxReadPrivateKeyBinary=function(e,t,n,r,i){return e===void 0&&(e=null),this.m_library.CtxReadPrivateKeyBinary(e,t,n,r,i)},t.prototype.CtxFreePrivateKey=function(e){return this.m_library.CtxFreePrivateKey(e)},t.prototype.CtxGetOwnCertificates=function(e){return this.m_library.CtxGetOwnCertificates(e)},t.prototype.CtxSignHash=function(e,t,n,r,i){return this.m_library.CtxSignHash(e,t,n,r,i)},t.prototype.CtxSignData=function(e,t,n,r,i,a){return this.m_library.CtxSignData(e,t,n,r,i,a)},t.prototype.CtxAppendSignHash=function(e,t,n,r,i,a){return this.m_library.CtxAppendSignHash(e,t,n,r,i,a)},t.prototype.CtxAppendSign=function(e,t,n,r,i,a){return this.m_library.CtxAppendSign(e,t,n,r,i,a)},t.prototype.CtxGetSignValue=function(e,t,n,r,i){return i===void 0&&(i=!1),this.m_library.CtxGetSignValue(e,t,n,r,i)},t.prototype.CtxEnvelopData=function(e,t,n,r,i,a,o){return this.m_library.CtxEnvelopData(e,t,n,r,i,a,o)},t.prototype.CtxDevelopData=function(e,t,n){return this.m_library.CtxDevelopData(e,t,n)},t.prototype.ProtectTaxReports=function(e,t,n,r,i,a,o){return e===void 0&&(e=null),t===void 0&&(t=null),n===void 0&&(n=null),this.m_library.ProtectTaxReports(e,t,n,r,i,a,o)},t.prototype.UnprotectTaxReceipts=function(e,t){return this.m_library.UnprotectTaxReceipts(e,t)},t.prototype.ASiCGetSigner=function(e,t,n){return this.m_library.ASiCGetSigner(e,t,n)},t.prototype.ASiCSignData=function(e,t,n,r,i,a){return this.m_library.ASiCSignData(e,t,n,r,i,a)},t.prototype.ASiCAppendSign=function(e,t,n,r,i){return this.m_library.ASiCAppendSign(e,t,n,r,i)},t.prototype.ASiCVerifyData=function(e,t){return this.m_library.ASiCVerifyData(e,t)},t.prototype.PDFGetSigner=function(e,t,n){return this.m_library.PDFGetSigner(e,t,n)},t.prototype.PDFSignData=function(e,t,n,r){return this.m_library.PDFSignData(e,t,n,r)},t.prototype.PDFVerifyData=function(e,t){return this.m_library.PDFVerifyData(e,t)},t.prototype.XAdESGetSigner=function(e,t,n){return this.m_library.XAdESGetSigner(e,t,n)},t.prototype.XAdESSignData=function(e,t,n,r,i){return this.m_library.XAdESSignData(e,t,n,r,i)},t.prototype.XAdESVerifyData=function(e,t,n){return this.m_library.XAdESVerifyData(e,t,n)},t.prototype.GetSignContainerInfo=function(e){return this.m_library.GetSignContainerInfo(e)},t}()}.call(this,n(13).Promise)},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return i});var r=n(0),i=function(){this.type=r.EndUserSignContainerType.Unknown,this.subType=r.EndUserCAdESType.Unknown,this.asicSignType=r.EndUserASiCSignType.Unknown}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r}),n.d(t,`d`,function(){return i}),n.d(t,`c`,function(){return a}),n.d(t,`b`,function(){return o});var r=function(){},i=function(){},a=function(){},o=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`b`,function(){return r}),n.d(t,`a`,function(){return i});var r=function(){},i=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){(function(t,r){e.exports=function(){"use strict";function e(e){return typeof e==`function`}var i=Array.isArray?Array.isArray:function(e){return Object.prototype.toString.call(e)===`[object Array]`},a=0,o=void 0,s=void 0,c=function(e,t){h[a]=e,h[a+1]=t,(a+=2)===2&&(s?s(g):x())},l=typeof window<`u`?window:void 0,u=l||{},d=u.MutationObserver||u.WebKitMutationObserver,f=typeof self>`u`&&t!==void 0&&{}.toString.call(t)===`[object process]`,p=typeof Uint8ClampedArray<`u`&&typeof importScripts<`u`&&typeof MessageChannel<`u`;function m(){var e=setTimeout;return function(){return e(g,1)}}var h=Array(1e3);function g(){for(var e=0;e<a;e+=2)(0,h[e])(h[e+1]),h[e]=void 0,h[e+1]=void 0;a=0}var _,v,y,b,x=void 0;function S(e,t){var n=arguments,r=this,i=new this.constructor(T);i[w]===void 0&&z(i);var a,o=r._state;return o?(a=n[o-1],c(function(){return L(o,i,a,r._result)})):N(r,i,e,t),i}function C(e){if(e&&typeof e==`object`&&e.constructor===this)return e;var t=new this(T);return k(t,e),t}f?x=function(){return t.nextTick(g)}:d?(v=0,y=new d(g),b=document.createTextNode(``),y.observe(b,{characterData:!0}),x=function(){b.data=v=++v%2}):p?((_=new MessageChannel).port1.onmessage=g,x=function(){return _.port2.postMessage(0)}):x=l===void 0?function(){try{var e=n(31);return o=e.runOnLoop||e.runOnContext,function(){o(g)}}catch{return m()}}():m();var w=(crypto.getRandomValues(new Uint32Array(1))[0]/4294967295).toString(36).substring(16);function T(){}var E=new F;function D(e){try{return e.then}catch(e){return E.error=e,E}}function O(t,n,r){n.constructor===t.constructor&&r===S&&n.constructor.resolve===C?function(e,t){t._state===1?j(e,t._result):t._state===2?M(e,t._result):N(t,void 0,function(t){return k(e,t)},function(t){return M(e,t)})}(t,n):r===E?M(t,E.error):r===void 0?j(t,n):e(r)?function(e,t,n){c(function(e){var r=!1,i=function(e,t,n,r){try{e.call(t,n,r)}catch(e){return e}}(n,t,function(n){r||(r=!0,t===n?j(e,n):k(e,n))},function(t){r||(r=!0,M(e,t))},e._label);!r&&i&&(r=!0,M(e,i))},e)}(t,n,r):j(t,n)}function k(e,t){var n;e===t?M(e,TypeError(`You cannot resolve a promise with itself`)):typeof(n=t)==`function`||typeof n==`object`&&n?O(e,t,D(t)):j(e,t)}function A(e){e._onerror&&e._onerror(e._result),P(e)}function j(e,t){e._state===void 0&&(e._result=t,e._state=1,e._subscribers.length!==0&&c(P,e))}function M(e,t){e._state===void 0&&(e._state=2,e._result=t,c(A,e))}function N(e,t,n,r){var i=e._subscribers,a=i.length;e._onerror=null,i[a]=t,i[a+1]=n,i[a+2]=r,a===0&&e._state&&c(P,e)}function P(e){var t=e._subscribers,n=e._state;if(t.length!==0){for(var r=void 0,i=void 0,a=e._result,o=0;o<t.length;o+=3)r=t[o],i=t[o+n],r?L(n,r,i,a):i(a);e._subscribers.length=0}}function F(){this.error=null}var I=new F;function L(t,n,r,i){var a=e(r),o=void 0,s=void 0,c=void 0,l=void 0;if(a){if((o=function(e,t){try{return e(t)}catch(e){return I.error=e,I}}(r,i))===I?(l=!0,s=o.error,o=null):c=!0,n===o)return void M(n,TypeError(`A promises callback cannot return that same promise.`))}else o=i,c=!0;n._state!==void 0||(a&&c?k(n,o):l?M(n,s):t===1?j(n,o):t===2&&M(n,o))}var R=0;function z(e){e[w]=R++,e._state=void 0,e._result=void 0,e._subscribers=[]}function B(e,t){this._instanceConstructor=e,this.promise=new e(T),this.promise[w]||z(this.promise),i(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=Array(this.length),this.length===0?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(),this._remaining===0&&j(this.promise,this._result))):M(this.promise,Error(`Array Methods must be provided an Array`))}function V(e){this[w]=R++,this._result=this._state=void 0,this._subscribers=[],T!==e&&(typeof e!=`function`&&function(){throw TypeError(`You must pass a resolver function as the first argument to the promise constructor`)}(),this instanceof V?function(e,t){try{t(function(t){k(e,t)},function(t){M(e,t)})}catch(t){M(e,t)}}(this,e):function(){throw TypeError(`Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.`)}())}function H(){var e=void 0;if(r!==void 0)e=r;else if(typeof self<`u`)e=self;else try{e=Function(`return this`)()}catch{throw Error(`polyfill failed because global object is unavailable in this environment`)}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch{}if(n===`[object Promise]`&&!t.cast)return}e.Promise=V}return B.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===void 0&&n<e;n++)this._eachEntry(t[n],n)},B.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===C){var i=D(e);if(i===S&&e._state!==void 0)this._settledAt(e._state,t,e._result);else if(typeof i!=`function`)this._remaining--,this._result[t]=e;else if(n===V){var a=new n(T);O(a,e,i),this._willSettleAt(a,t)}else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(r(e),t)},B.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===void 0&&(this._remaining--,e===2?M(r,n):this._result[t]=n),this._remaining===0&&j(r,this._result)},B.prototype._willSettleAt=function(e,t){var n=this;N(e,void 0,function(e){return n._settledAt(1,t,e)},function(e){return n._settledAt(2,t,e)})},V.all=function(e){return new B(this,e).promise},V.race=function(e){var t=this;return i(e)?new t(function(n,r){for(var i=e.length,a=0;a<i;a++)t.resolve(e[a]).then(n,r)}):new t(function(e,t){return t(TypeError(`You must pass an array to race.`))})},V.resolve=C,V.reject=function(e){var t=new this(T);return M(t,e),t},V._setScheduler=function(e){s=e},V._setAsap=function(e){c=e},V._asap=c,V.prototype={constructor:V,then:S,catch:function(e){return this.then(null,e)}},H(),V.polyfill=H,V.Promise=V,V}()}).call(this,n(29),n(30))},function(e,t,n){"use strict";n.d(t,`a`,function(){return r}),n.d(t,`b`,function(){return i});var r=function(){this.version=null,this.supported=!1,this.loaded=!1},i=function(){this.version=null,this.supported=!1,this.loaded=!1,this.isSignAgentSupported=!1,this.isWebExtensionSupported=!1,this.isNPAPISupported=!1,this.isActiveXSupported=!1,this.isWebExtensionInstalled=!1,this.isNativeLibraryNeedUpdate=!1,this.nativeLibraryInstallURL=null,this.nativeLibraryUpdateURL=null,this.webExtensionInstallURL=null,this.helpURL=null}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r}),n.d(t,`b`,function(){return i});var r=function(){},i=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r}),n.d(t,`b`,function(){return i});var r=function(){},i=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(e){this.type=e?e.type:``,this.device=e?e.device:``,this.visibleName=e?e.visibleName:``,this.typeIndex=e?e.typeIndex:-1,this.devIndex=e?e.devIndex:-1,this.password=e?e.password:``,this.user=e?e.user:``}},function(e,t,n){"use strict";n.d(t,`a`,function(){return i});var r=n(0),i=function(){this.version=r.EU_USER_INFO_VERSION,this.commonName=``,this.locality=``,this.state=``,this.organization=``,this.orgUnit=``,this.title=``,this.street=``,this.phone=``,this.surname=``,this.givenname=``,this.EMail=``,this.DNS=``,this.EDRPOUCode=``,this.DRFOCode=``,this.NBUCode=``,this.SPFMCode=``,this.OCode=``,this.OUCode=``,this.userCode=``,this.UPN=``,this.UNZR=``,this.country=`UA`}},function(e,t,n){"use strict";n.r(t),n.d(t,`EndUserConfirmKSPOperationEvent`,function(){return i});var r=n(0),i=function(){this.type=r.EndUserEventType.ConfirmKSPOperation}},function(e,t,n){"use strict";(function(e){var r=n(25),i=n(0);t.a=function(){function t(e,t){var n=this,i=``;typeof t==`number`&&t>0&&(typeof i==`string`&&i.length>0&&(i=`var EU_MAX_DATA_SIZE_MB = `+t+`;`+i),typeof e==`string`&&e.length>0&&(e+=(e.includes(`?`)?`&`:`?`)+`maxDataSize=`+t)),this.m_worker=new r.a(i,e,function(e){n.OnEvent(e)}),this.m_eventListeners=[]}return t.prototype.OnEvent=function(e){try{var t=this.m_eventListeners[e.type]||this.m_eventListeners[i.EndUserEventType.All];t&&t(e)}catch{}},t.prototype.AddEventListener=function(e,t){switch(e){case i.EndUserEventType.None:this.m_eventListeners=[];break;case i.EndUserEventType.All:this.m_eventListeners=[],this.m_eventListeners[e]=t;break;default:this.m_eventListeners[e]=t}return this.m_worker.postMessage(`AddEventListener`,[e])},t.prototype.GetLibraryInfo=function(e){return this.m_worker.postMessage(`GetLibraryInfo`,Array.prototype.slice.call(arguments))},t.prototype.IsInitialized=function(){return this.m_worker.postMessage(`IsInitialized`,Array.prototype.slice.call(arguments))},t.prototype.Initialize=function(e){return this.m_worker.postMessage(`Initialize`,Array.prototype.slice.call(arguments))},t.prototype.Finalize=function(){var t=this;return new e(function(e,n){t.m_worker.terminate(),t.m_worker=null,t.m_eventListeners=[],e()})},t.prototype.SetLanguage=function(e){return this.m_worker.postMessage(`SetLanguage`,Array.prototype.slice.call(arguments))},t.prototype.SetRuntimeParameter=function(e,t){return this.m_worker.postMessage(`SetRuntimeParameter`,Array.prototype.slice.call(arguments))},t.prototype.GetStorageParameter=function(e,t){return this.m_worker.postMessage(`GetStorageParameter`,Array.prototype.slice.call(arguments))},t.prototype.SetStorageParameter=function(e,t,n){return this.m_worker.postMessage(`SetStorageParameter`,Array.prototype.slice.call(arguments))},t.prototype.GetCAs=function(){return this.m_worker.postMessage(`GetCAs`,Array.prototype.slice.call(arguments))},t.prototype.GetProxySettings=function(){return this.m_worker.postMessage(`GetProxySettings`,Array.prototype.slice.call(arguments))},t.prototype.SetProxySettings=function(e){return this.m_worker.postMessage(`SetProxySettings`,Array.prototype.slice.call(arguments))},t.prototype.GetHostInfo=function(){return this.m_worker.postMessage(`GetHostInfo`,Array.prototype.slice.call(arguments))},t.prototype.GetKeyMedias=function(){return this.m_worker.postMessage(`GetKeyMedias`,Array.prototype.slice.call(arguments))},t.prototype.GetJKSPrivateKeys=function(e){return this.m_worker.postMessage(`GetJKSPrivateKeys`,Array.prototype.slice.call(arguments))},t.prototype.IsPrivateKeyReaded=function(){return this.m_worker.postMessage(`IsPrivateKeyReaded`,Array.prototype.slice.call(arguments))},t.prototype.ResetPrivateKey=function(){return this.m_worker.postMessage(`ResetPrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.ResetOperationKSP=function(){return this.m_worker.postMessage(`ResetOperationKSP`,Array.prototype.slice.call(arguments))},t.prototype.ReadPrivateKey=function(e,t,n){return this.m_worker.postMessage(`ReadPrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.ReadPrivateKeyBinary=function(e,t,n,r){return this.m_worker.postMessage(`ReadPrivateKeyBinary`,Array.prototype.slice.call(arguments))},t.prototype.ReadPrivateKeySIM=function(e,t,n,r){return this.m_worker.postMessage(`ReadPrivateKeySIM`,Array.prototype.slice.call(arguments))},t.prototype.ReadPrivateKeyKSP=function(e,t,n,r,i,a,o){return this.m_worker.postMessage(`ReadPrivateKeyKSP`,Array.prototype.slice.call(arguments))},t.prototype.GetOwnCertificates=function(){return this.m_worker.postMessage(`GetOwnCertificates`,Array.prototype.slice.call(arguments))},t.prototype.GetOwnEUserParams=function(){return this.m_worker.postMessage(`GetOwnEUserParams`,Array.prototype.slice.call(arguments))},t.prototype.ChangeOwnCertificatesStatus=function(e,t){return this.m_worker.postMessage(`ChangeOwnCertificatesStatus`,Array.prototype.slice.call(arguments))},t.prototype.MakeNewCertificate=function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y){return h===void 0&&(h=!1),g===void 0&&(g=null),_===void 0&&(_=null),v===void 0&&(v=0),y===void 0&&(y=null),this.m_worker.postMessage(`MakeNewCertificate`,Array.prototype.slice.call(arguments))},t.prototype.MakeDeviceCertificate=function(e,t,n,r,i){return this.m_worker.postMessage(`MakeDeviceCertificate`,Array.prototype.slice.call(arguments))},t.prototype.SetKeyMediaUserPassword=function(e,t){return this.m_worker.postMessage(`SetKeyMediaUserPassword`,Array.prototype.slice.call(arguments))},t.prototype.ChangePrivateKeyPassword=function(e,t){return this.m_worker.postMessage(`ChangePrivateKeyPassword`,Array.prototype.slice.call(arguments))},t.prototype.ChangePrivateKeyPasswordBinary=function(e,t,n){return this.m_worker.postMessage(`ChangePrivateKeyPasswordBinary`,Array.prototype.slice.call(arguments))},t.prototype.GeneratePrivateKey=function(e,t,n,r,i,a,o,s,c,l,u,d){return this.m_worker.postMessage(`GeneratePrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.GeneratePrivateKeyBinary=function(e,t,n,r,i,a,o,s,c,l,u){return this.m_worker.postMessage(`GeneratePrivateKeyBinary`,Array.prototype.slice.call(arguments))},t.prototype.GetKeyInfo=function(e){return this.m_worker.postMessage(`GetKeyInfo`,Array.prototype.slice.call(arguments))},t.prototype.GetKeyInfoBinary=function(e,t){return this.m_worker.postMessage(`GetKeyInfoBinary`,Array.prototype.slice.call(arguments))},t.prototype.GetClientRegistrationTokenKSP=function(e,t){return t===void 0&&(t=null),this.m_worker.postMessage(`GetClientRegistrationTokenKSP`,Array.prototype.slice.call(arguments))},t.prototype.HashData=function(e,t,n){return this.m_worker.postMessage(`HashData`,Array.prototype.slice.call(arguments))},t.prototype.GetSigner=function(e,t,n){return t===void 0&&(t=-1),n===void 0&&(n=!1),this.m_worker.postMessage(`GetSigner`,Array.prototype.slice.call(arguments))},t.prototype.SignData=function(e,t){return t===void 0&&(t=!1),this.m_worker.postMessage(`SignData`,Array.prototype.slice.call(arguments))},t.prototype.SignDataInternal=function(e,t,n){return n===void 0&&(n=!1),this.m_worker.postMessage(`SignDataInternal`,Array.prototype.slice.call(arguments))},t.prototype.SignHash=function(e,t,n,r){return this.m_worker.postMessage(`SignHash`,Array.prototype.slice.call(arguments))},t.prototype.SignDataEx=function(e,t,n,r,i){return this.m_worker.postMessage(`SignDataEx`,Array.prototype.slice.call(arguments))},t.prototype.AppendSign=function(e,t,n,r,i){return this.m_worker.postMessage(`AppendSign`,Array.prototype.slice.call(arguments))},t.prototype.AppendSignHash=function(e,t,n,r,i){return this.m_worker.postMessage(`AppendSignHash`,Array.prototype.slice.call(arguments))},t.prototype.GetSignValue=function(e,t,n,r){return r===void 0&&(r=!1),this.m_worker.postMessage(`GetSignValue`,Array.prototype.slice.call(arguments))},t.prototype.VerifyHash=function(e,t,n){return n===void 0&&(n=-1),this.m_worker.postMessage(`VerifyHash`,Array.prototype.slice.call(arguments))},t.prototype.VerifyData=function(e,t,n){return n===void 0&&(n=-1),this.m_worker.postMessage(`VerifyData`,Array.prototype.slice.call(arguments))},t.prototype.VerifyDataInternal=function(e,t){return t===void 0&&(t=-1),this.m_worker.postMessage(`VerifyDataInternal`,Array.prototype.slice.call(arguments))},t.prototype.EnvelopData=function(e,t,n,r,i,a){return a===void 0&&(a=!1),this.m_worker.postMessage(`EnvelopData`,Array.prototype.slice.call(arguments))},t.prototype.DevelopData=function(e,t){return this.m_worker.postMessage(`DevelopData`,Array.prototype.slice.call(arguments))},t.prototype.CreateAuthData=function(e,t,n){return this.m_worker.postMessage(`CreateAuthData`,Array.prototype.slice.call(arguments))},t.prototype.ProtectDataByPassword=function(e,t,n){return this.m_worker.postMessage(`ProtectDataByPassword`,Array.prototype.slice.call(arguments))},t.prototype.UnprotectDataByPassword=function(e,t,n){return this.m_worker.postMessage(`UnprotectDataByPassword`,Array.prototype.slice.call(arguments))},t.prototype.GetTSPByAccessInfo=function(e,t,n,r,i){return this.m_worker.postMessage(`GetTSPByAccessInfo`,Array.prototype.slice.call(arguments))},t.prototype.CheckTSP=function(e,t,n){return this.m_worker.postMessage(`CheckTSP`,Array.prototype.slice.call(arguments))},t.prototype.ClientDynamicKeySessionCreate=function(e){return this.m_worker.postMessage(`ClientDynamicKeySessionCreate`,Array.prototype.slice.call(arguments))},t.prototype.SessionClose=function(e){return this.m_worker.postMessage(`SessionClose`,Array.prototype.slice.call(arguments))},t.prototype.SessionEncrypt=function(e,t,n){return this.m_worker.postMessage(`SessionEncrypt`,Array.prototype.slice.call(arguments))},t.prototype.SessionDecrypt=function(e,t){return this.m_worker.postMessage(`SessionDecrypt`,Array.prototype.slice.call(arguments))},t.prototype.CtxCreate=function(){return this.m_worker.postMessage(`CtxCreate`,Array.prototype.slice.call(arguments))},t.prototype.CtxFree=function(e){return this.m_worker.postMessage(`CtxFree`,Array.prototype.slice.call(arguments))},t.prototype.CtxSetParameter=function(e,t,n){return this.m_worker.postMessage(`CtxSetParameter`,Array.prototype.slice.call(arguments))},t.prototype.CtxReadPrivateKey=function(e,t,n,r){return this.m_worker.postMessage(`CtxReadPrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.CtxReadPrivateKeyBinary=function(e,t,n,r,i){return this.m_worker.postMessage(`CtxReadPrivateKeyBinary`,Array.prototype.slice.call(arguments))},t.prototype.CtxFreePrivateKey=function(e){return this.m_worker.postMessage(`CtxFreePrivateKey`,Array.prototype.slice.call(arguments))},t.prototype.CtxGetOwnCertificates=function(e){return this.m_worker.postMessage(`CtxGetOwnCertificates`,Array.prototype.slice.call(arguments))},t.prototype.CtxSignHash=function(e,t,n,r,i){return this.m_worker.postMessage(`CtxSignHash`,Array.prototype.slice.call(arguments))},t.prototype.CtxSignData=function(e,t,n,r,i,a){return this.m_worker.postMessage(`CtxSignData`,Array.prototype.slice.call(arguments))},t.prototype.CtxAppendSignHash=function(e,t,n,r,i,a){return this.m_worker.postMessage(`CtxAppendSignHash`,Array.prototype.slice.call(arguments))},t.prototype.CtxAppendSign=function(e,t,n,r,i,a){return this.m_worker.postMessage(`CtxAppendSign`,Array.prototype.slice.call(arguments))},t.prototype.CtxGetSignValue=function(e,t,n,r,i){return i===void 0&&(i=!1),this.m_worker.postMessage(`CtxGetSignValue`,Array.prototype.slice.call(arguments))},t.prototype.CtxEnvelopData=function(e,t,n,r,i,a,o){return this.m_worker.postMessage(`CtxEnvelopData`,Array.prototype.slice.call(arguments))},t.prototype.CtxDevelopData=function(e,t,n){return this.m_worker.postMessage(`CtxDevelopData`,Array.prototype.slice.call(arguments))},t.prototype.ProtectTaxReports=function(e,t,n,r,i,a,o){return e===void 0&&(e=null),t===void 0&&(t=null),n===void 0&&(n=null),o===void 0&&(o=!1),this.m_worker.postMessage(`ProtectTaxReports`,Array.prototype.slice.call(arguments))},t.prototype.UnprotectTaxReceipts=function(e,t){return this.m_worker.postMessage(`UnprotectTaxReceipts`,Array.prototype.slice.call(arguments))},t.prototype.ASiCGetSigner=function(e,t,n){return this.m_worker.postMessage(`ASiCGetSigner`,Array.prototype.slice.call(arguments))},t.prototype.ASiCSignData=function(e,t,n,r,i,a){return this.m_worker.postMessage(`ASiCSignData`,Array.prototype.slice.call(arguments))},t.prototype.ASiCAppendSign=function(e,t,n,r,i){return this.m_worker.postMessage(`ASiCAppendSign`,Array.prototype.slice.call(arguments))},t.prototype.ASiCVerifyData=function(e,t){return t===void 0&&(t=-1),this.m_worker.postMessage(`ASiCVerifyData`,Array.prototype.slice.call(arguments))},t.prototype.PDFSignData=function(e,t,n,r){return this.m_worker.postMessage(`PDFSignData`,Array.prototype.slice.call(arguments))},t.prototype.PDFVerifyData=function(e,t){return t===void 0&&(t=-1),this.m_worker.postMessage(`PDFVerifyData`,Array.prototype.slice.call(arguments))},t.prototype.PDFGetSigner=function(e,t,n){return t===void 0&&(t=-1),n===void 0&&(n=!1),this.m_worker.postMessage(`PDFGetSigner`,Array.prototype.slice.call(arguments))},t.prototype.XAdESGetSigner=function(e,t,n){return t===void 0&&(t=-1),n===void 0&&(n=!1),this.m_worker.postMessage(`XAdESGetSigner`,Array.prototype.slice.call(arguments))},t.prototype.XAdESSignData=function(e,t,n,r,i){return this.m_worker.postMessage(`XAdESSignData`,Array.prototype.slice.call(arguments))},t.prototype.XAdESVerifyData=function(e,t,n){return n===void 0&&(n=-1),this.m_worker.postMessage(`XAdESVerifyData`,Array.prototype.slice.call(arguments))},t.prototype.GetSignContainerInfo=function(e){return this.m_worker.postMessage(`GetSignContainerInfo`,Array.prototype.slice.call(arguments))},t}()}).call(this,n(13).Promise)},function(e,t,n){"use strict";(function(e){var n=function(e,t,n){this.id=e,this.cmd=t,this.params=n,this.origin=window.location.origin?window.location.origin:window.location.protocol+`//`+window.location.hostname+(window.location.port?`:`+window.location.port:``),this.pathname=window.location.pathname},r=function(e,t,n,r){this.id=e,this.cmd=t,this.result=n,this.error=r};t.a=function(){function t(e,t,n){var r=this;this.m_worker=this.loadWorker(e,t),this.m_worker.onmessage=function(e){var t=e.data;if(t.id!=-2){var i=r.m_promises[t.id-1];i&&(delete r.m_promises[t.id-1],t.error?i.reject(t.error):i.resolve(t.result))}else n(t.result)},this.m_worker.onerror=function(e){r.m_promises.forEach(function(t){t.reject(e.error)}),r.m_promises=[]},this.m_promises=[]}return t.prototype.terminate=function(){try{this.m_worker.terminate()}catch{this.m_worker=null,this.m_promises=[]}},t.prototype.loadWorker=function(e,t){try{if(!e)throw`No worker content`;try{var n,r=window,i=r.URL||r.webkitURL;try{(n=new(r.BlobBuilder||r.WebKitBlobBuilder||r.MozBlobBuilder||r.MSBlobBuilder)).append(e),n=n.getBlob()}catch{n=new Blob([e])}return new Worker(i.createObjectURL(n))}catch{return new Worker(`data:application/javascript,`+encodeURIComponent(e))}}catch{if(!t)throw Error(`Inline worker is not supported`);return new Worker(t)}},t.prototype.postMessage=function(t,r){var i=this,a=new n(-1,t,r),o=new e(function(e,t){a.id=i.m_promises.push({resolve:e,reject:t})});return this.m_worker.postMessage(a),o},t}(),(function(){function e(e){this.m_context=e,this.m_initialized=!1;var t=this;self.onmessage=function(e){t.onMessage(e.data)}}e.prototype.postMessage=function(e,t,n,i){var a=new r(e,t,n,i);self.postMessage(a)},e.prototype.onMessage=function(e){var t=this;this.m_initialized?this.m_context[e.cmd].apply(this.m_context,e.params).then(function(n){t.postMessage(e.id,e.cmd,n)},function(n){t.postMessage(e.id,e.cmd,null,n)}):setTimeout(function(){t.onMessage(e)},50)},e.prototype.initialize=function(){this.m_initialized=!0}})()}).call(this,n(13).Promise)},function(e,t,n){"use strict";(function(e){var r=n(1),i=n(9),a=n(10),o=n(15),s=n(27),c=n(4),l=n(14),u=n(2),d=n(8),f=n(0),p=n(11),m=n(16),h=n(17),g=n(7),_=n(5),v=n(12),y=n(6),b=n(28),x=function(){};t.a=function(){function t(){this.MakeExpireDate=function(e){e||=300;var t=new Date;return t.setTime(t.getTime()+1e3*e),t},this.m_library=new s.a,this.m_settings=null,this.m_initialized=!1,this.m_kmTypes=null,this.m_kmActiveOperation=!1,this.m_context=null,this.m_pkContext=null,this.m_eventListeners=[],this.m_resolveOIDs=!1,this.m_origin=window.location.origin?window.location.origin:window.location.protocol+`//`+window.location.hostname+(window.location.port?`:`+window.location.port:``)}return t.prototype.MapError=function(e){var t=new r.EndUserError;return e.GetErrorCode!==void 0&&e.GetMessage!==void 0?(t.code=e.GetErrorCode(),t.message=e.GetMessage()):e.code!==void 0&&e.message!==void 0?(t.code=e.code,t.message=e.message):(t.code=r.EU_ERROR_UNKNOWN,t.message=e.toString()),t},t.prototype.ProcessArray=function(t,n){var r=this;return new e(function(e,i){var a=[],o=0,s=function(){o>=t.length?e(a):(n(t[o]).then(function(e){a.push(e),s()}).catch(function(e){return i(r.MapError(e))}),o++)};s()})},t.prototype.DataToNamedDataArray=function(e){e??=[],e=Array.isArray(e)?e:[e];for(var t=[],n=0;n<e.length;n++){var r=e[n].name!==void 0&&e[n].val!==void 0;t.push({name:r?e[n].name:`Ім'я відсутнє`,val:r?e[n].val:e[n]})}return t},t.prototype.DataToResult=function(e,t){for(var n=[],r=!Array.isArray(e),i=r?[e]:e,a=0;a<i.length;a++){var o=i[a].name!==void 0&&i[a].val!==void 0?{name:i[a].name,val:t[a]}:t[a];n.push(o)}return r?n[0]:n},t.prototype.NamedDataToReference=function(t){var n=this,r=n.m_library;return new e(function(e,i){typeof t.val==`string`?r.StringToBytes(t.val).then(function(n){e(r.CreateReference(t.name,n))}).catch(function(e){return i(n.MapError(e))}):setTimeout(function(){e(r.CreateReference(t.name,t.val))},1)})},t.prototype.OnEvent=function(e){try{var t=this.m_eventListeners[e.type]||this.m_eventListeners[f.EndUserEventType.All];t&&t(e)}catch{}},t.prototype.CheckInitialize=function(){var t=this,n=t.m_library;return new e(function(e,i){t.m_initialized?e():n.Load().then(function(){throw n.MakeError(r.EU_ERROR_NOT_INITIALIZED,``)}).catch(function(e){return i(t.MapError(e))})})},t.prototype.BeginKMOperation=function(){var t=this;return new e(function(e,n){var r=function(){t.m_kmActiveOperation?setTimeout(r,10):(t.m_kmActiveOperation=!0,e())};r()})},t.prototype.EndKMOperation=function(){this.m_kmActiveOperation=!1},t.prototype.GetCASettings=function(e){if(!e)return null;for(var t=this.m_settings.CAs,n=0;n<t.length;n++)for(var r=t[n].issuerCNs,i=0;i<r.length;i++)if(r[i]==e)return t[n];return null},t.prototype.GetDefaultTSPSettings=function(e){var t=null;if(e.TSPServer)t=e.TSPServer;else{for(var n=null,r=e.CAs,i=0;i<r.length&&(!r[i].tspAddress||!r[i].tspAddressPort||(n&&r[i].tspAddressPort!=`80`||(n=r[i]),n.tspAddressPort!=`80`));i++);n&&(t={address:n.tspAddress,port:n.tspAddressPort})}return t},t.prototype.IsCMPCompatible=function(e,t){return!!e.cmpAddress&&(e.cmpCompatibility===void 0||(e.cmpCompatibility&t)==t)},t.prototype.IsCMPsAvailable=function(e){for(var t=e.CAs,n=0;n<t.length;n++)if(this.IsCMPCompatible(t[n],f.EndUserCMPCompatibility.DownloadEUCerts))return!0;return!1},t.prototype.SetCMPSettings=function(t){var n=this,i=n.m_library,a=this.GetCASettings(t);return new e(function(e,o){if(t&&a==null&&!n.m_settings.allowForeignCAs)throw i.MakeError(r.EU_ERROR_WRITE_SETTINGS,``);var s=!(!a||!a.cmpAddress),c=i.CreateCMPSettings();c.SetUseCMP(s),s&&(c.SetAddress(a.cmpAddress),c.SetPort(`80`)),i.SetCMPSettings(c).then(function(){e()}).catch(function(e){o(n.MapError(e))})})},t.prototype.GetJKSPrivateKey=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){var s={alias:null,info:null};i.EnumJKSPrivateKeys(t,n).then(function(n){if(n!=null)return s.alias=n,i.GetJKSPrivateKey(t,n);e(null)}).then(function(e){s.info=e;for(var t=[],n=0;n<e.GetCertificatesCount();n++)t.push(e.GetCertificate(n));return r.ProcessArray(t,function(e){return i.ParseCertificateEx(e)})}).then(function(t){var n=new o.a;n.alias=s.alias,n.privateKey=s.info.GetPrivateKey(),n.certificates=[],n.digitalStamp=!1;for(var r=0;r<t.length;r++){var a=t[r];if(a.GetSubjType()==i.EU_SUBJECT_TYPE_END_USER){a.GetPublicKeyType()==i.EU_CERT_KEY_TYPE_DSTU4145&&(a.GetKeyUsageType()&i.EU_KEY_USAGE_DIGITAL_SIGNATURE)==i.EU_KEY_USAGE_DIGITAL_SIGNATURE&&(n.digitalStamp=a.GetExtKeyUsages().indexOf(i.EU_UA_OID_EXT_KEY_USAGE_STAMP)>-1);var l=new c.EndUserCertificate;l.data=s.info.GetCertificate(r),l.infoEx=u.a.MapToEndUserCertificateInfoEx(a,new d.a),n.certificates.push(l)}}n.digitalStamp=!1,e(n)}).catch(function(e){return a(r.MapError(e))})})},t.prototype.SaveCertificatesInternal=function(t){var n=this,r=this.m_library;return new e(function(e,i){t?Array.isArray(t)?n.ProcessArray(t,function(e){return r.SaveCertificate(e)}).then(function(){return e()}).catch(function(e){return i(e)}):r.SaveCertificates(t).then(function(){return e()}).catch(function(e){return i(e)}):e()})},t.prototype.CtxReadPrivateKeyInternal=function(t,n,i,a,o,s,c){c===void 0&&(c=!0);var l=this,u=this.m_library,d={pkContext:null};return t||=l.m_context,new e(function(e,f){l.SaveCertificatesInternal(o).then(function(){return l.SetCMPSettings(s)}).then(function(){return n!=null&&i!=null?u.CtxReadPrivateKeyBinary(t,n,i):u.CtxReadPrivateKey(t,a)}).then(function(e){d.pkContext=e;var t=e.GetOwnerInfo();if(!s)return l.SetCMPSettings(t.GetIssuerCN());var n=l.GetCASettings(t.GetIssuerCN());if(!n||n.issuerCNs.indexOf(s)==-1)throw u.MakeError(r.EU_ERROR_CERT_NOT_FOUND,``)}).then(function(){e(d.pkContext)}).catch(function(o){d.pkContext==null?l.MapError(o).code==r.EU_ERROR_CERT_NOT_FOUND&&!s&&c?l.SearchPrivateKeyCertificatesWithCMP(n,i,a).then(function(e){return l.CtxReadPrivateKeyInternal(t,n,i,a,e.certs,null,!1)}).then(function(t){e(t)}).catch(function(e){return f(l.MapError(e))}):f(l.MapError(o)):u.CtxFreePrivateKey(d.pkContext).then(function(){f(l.MapError(o))}).catch(function(){f(l.MapError(o))})})})},t.prototype.ReadPrivateKeyInternal=function(t,n,r,i,o){var s=this;return new e(function(e,c){s.ResetPrivateKeyInternal().then(function(){return s.CtxReadPrivateKeyInternal(s.m_context,t,n,r,i,o,!0)}).then(function(t){s.m_pkContext=t,e(u.a.MapEndUserOwnerInfo(t.GetOwnerInfo(),new a.a))}).catch(function(e){c(s.MapError(e))})})},t.prototype.ResetPrivateKeyInternal=function(){var t=this,n=this.m_library;return new e(function(e,r){t.m_pkContext==null?e():n.CtxFreePrivateKey(t.m_pkContext).then(function(){t.m_pkContext=null,e()}).catch(function(e){return r(t.MapError(e))})})},t.prototype.SearchPrivateKeyCertificatesWithCMP=function(t,n,i,a){var o=this,s=o.m_library,c=o.m_settings.CAs;return new e(function(e,l){if(o.IsCMPsAvailable(o.m_settings))(t!=null&&n!=null?s.GetKeyInfoBinary(t,n):s.GetKeyInfo(i)).then(function(t){var n=function(i,u){if(i>=c.length){var d=s.MakeError(u?r.EU_ERROR_CERT_NOT_FOUND:r.EU_ERROR_TRANSMIT_REQUEST,``);l(o.MapError(d))}else{var p=a?f.EndUserCMPCompatibility.DownloadEUCerts:f.EndUserCMPCompatibility.SearchEUCerts;o.IsCMPCompatible(c[i],p)?a&&c[i].issuerCNs.indexOf(a)==-1?n(i+1,u):s.GetCertificatesByKeyInfo(t,[c[i].cmpAddress],[`80`]).then(function(t){e({certs:t,CACommonName:c[i].issuerCNs[0]})}).catch(function(e){var t=e.GetErrorCode();t!=r.EU_ERROR_CERT_NOT_FOUND&&t!=r.EU_ERROR_TRANSMIT_REQUEST||(u||=t==r.EU_ERROR_CERT_NOT_FOUND),n(i+1,u)}):n(i+1,u)}};n(0,!1)}).catch(function(e){return l(o.MapError(e))});else{var u=s.MakeError(r.EU_ERROR_CERT_NOT_FOUND,``);l(o.MapError(u))}})},t.prototype.GetUserCertificatesFromCertificates=function(t){var n=this,r=n.m_library;return new e(function(e,i){var a=[],o=function(s){r.GetCertificateFromSignedData(s,t).then(function(t){if(t!=null){var n=new c.EndUserCertificate;return n.data=t,a.push(n),r.ParseCertificateEx(t)}for(var i=[],o=0;o<a.length;o++)a[o].infoEx.subjType==r.EU_SUBJECT_TYPE_END_USER&&i.push(a[o]);e(i)}).then(function(e){a[s].infoEx=u.a.MapToEndUserCertificateInfoEx(e,new d.a),o(s+1)}).catch(function(e){return i(n.MapError(e))})};o(0)})},t.prototype.GeneratePrivateKeyInternal=function(t,n,r,i,a,o,s,c,l,d,f,p,m){var g=this,_=this.m_library;return new e(function(e,v){var y=t==null&&r==null,b=r!=null,x=_.CreatePrivateKeyInfo(),S=null;p!=null&&(S=u.a.MapFromEndUserInfo(p,_.CreateEndUserInfo())),_.GeneratePrivateKeyEx(y,t?t.GetTypeIndex():-1,t?t.GetDevIndex():-1,t?t.GetPassword():r,n,i,a,o,s,c,l,d,f,S,m,x,r!=null).then(function(t){for(var n=[],r=0;r<t.size();r++){var i=t.get(r);i=u.a.MapToEndUserRequestInfo(i,new h.a),n.push(i)}e({key:b?x.GetPrivateKey():null,requests:n})}).catch(function(e){return v(g.MapError(e))})})},t.prototype.GetSignAlgoByCertificate=function(e){switch(e.GetInfoEx().GetPublicKeyType()){case f.EndUserCertKeyType.DSTU4145:return e.GetInfoEx().GetCertHashType()==f.EndUserCertHashType.GOST34311?f.EndUserSignAlgo.DSTU4145WithGOST34311:f.EndUserSignAlgo.DSTU4145WithDSTU7564;case f.EndUserCertKeyType.RSA:return f.EndUserSignAlgo.RSAWithSHA;case f.EndUserCertKeyType.ECDSA:return f.EndUserSignAlgo.ECDSAWithSHA;default:return f.EndUserSignAlgo.Unknown}},t.prototype.GetHashAlgoBySignAlgo=function(e){var t=this.m_library;switch(e){case f.EndUserSignAlgo.DSTU4145WithGOST34311:return f.EndUserHashAlgo.GOST34311;case f.EndUserSignAlgo.RSAWithSHA:case f.EndUserSignAlgo.ECDSAWithSHA:return f.EndUserHashAlgo.SHA256;case f.EndUserSignAlgo.DSTU4145WithDSTU7564:return f.EndUserHashAlgo.DSTU7564_256;default:throw t.MakeError(r.EU_ERROR_BAD_PARAMETER,``)}},t.prototype.CtxSignHashInternal=function(t,n,i,a,o,s){var c=this,l=this.m_library,u=a!=null,d=c.DataToNamedDataArray(i),f=c.DataToNamedDataArray(a);return new e(function(a,p){c.CheckInitialize().then(function(){if(t==null)throw l.MakeError(r.EU_ERROR_BAD_CERT,``);if(u&&d.length!=f.length)throw l.MakeError(r.EU_ERROR_BAD_PARAMETER,``);for(var i=[],a=0;a<d.length;a++)i.push({hash:d[a],previousSign:u?f[a]:null});return c.ProcessArray(i,function(r){return new e(function(e,i){(u?l.CtxAppendSignHash(t,n,r.hash.val,r.previousSign.val,o):l.CtxSignHash(t,n,r.hash.val,o)).then(function(e){return s?e:l.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return i(e)})})})}).then(function(e){a(c.DataToResult(i,e))}).catch(function(e){return p(c.MapError(e))})})},t.prototype.CtxSignDataInternal=function(t,n,i,a,o,s,c){var l=this,u=this,d=this.m_library,p=a!=null,m=u.DataToNamedDataArray(i),h=u.DataToNamedDataArray(a);return new e(function(g,_){u.CheckInitialize().then(function(){if(t==null)throw d.MakeError(r.EU_ERROR_BAD_CERT,``);if(p&&o&&m.length!=h.length)throw d.MakeError(r.EU_ERROR_BAD_PARAMETER,``);return n==f.EndUserSignAlgo.Unknown?d.CtxEnumOwnCertificates(t,0):null}).then(function(e){if(n==f.EndUserSignAlgo.Unknown&&e!=null&&(n=u.GetSignAlgoByCertificate(e)),!o)return m;var t=u.GetHashAlgoBySignAlgo(n);return u.HashData(t,m,!0)}).then(function(r){for(var i=[],a=p?h.length:r.length,l=0;l<a;l++)i.push({dataOrHash:r==null?null:r[l],previousSign:p?h[l]:null});return u.ProcessArray(i,function(r){return new e(function(e,i){(p?o?d.CtxAppendSignHash(t,n,r.dataOrHash.val,r.previousSign.val,s):d.CtxAppendSign(t,n,null,r.previousSign.val,s):o?d.CtxSignHash(t,n,r.dataOrHash.val,s):d.CtxSign(t,n,r.dataOrHash.val,!1,s)).then(function(e){return c?e:d.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return i(e)})})})}).then(function(e){g(l.DataToResult(p&&!o?a:i,e))}).catch(function(e){return _(u.MapError(e))})})},t.prototype.LoadTaxReportPKey=function(t,n,i){var a=this,o=this.m_library;return new e(function(e,s){var c=new x;if(Array.isArray(t)||(t=[t]),t.length>2)s(a.MapError(o.MakeError(r.EU_ERROR_BAD_PARAMETER,``)));else{var l=function(u,d){var p=n[u],m=t[d];o.CtxGetOwnCertificate(m,f.EndUserCertKeyType.DSTU4145,p).then(function(t){if(i&&p&f.EndUserKeyUsage.DigitalSignature&&!(t.GetInfoEx().GetExtKeyUsages().indexOf(o.EU_UA_OID_EXT_KEY_USAGE_STAMP)>-1))throw o.MakeError(r.EU_ERROR_BAD_PARAMETER,``);if(p&f.EndUserKeyUsage.DigitalSignature)c.signPKCtx=m,c.signCert=t;else{if(!(p&f.EndUserKeyUsage.KeyAgreement))throw o.MakeError(r.EU_ERROR_BAD_PARAMETER,``);c.envelopPKCtx=m,c.envelopCert=t}u+1<n.length?l(u+1,0):e(c)}).catch(function(e){if(e.GetErrorCode()==r.EU_ERROR_CERT_NOT_FOUND){if(d+1<t.length)return void l(u,d+1);e=o.MakeError(r.EU_ERROR_BAD_PARAMETER,``)}s(a.MapError(e))})};l(0,0)}})},t.prototype.ProtectTaxReport=function(t,n,i,a,o,s,c){var l=this,u=this.m_library,d=new p.b;d.name=s.name;var f=function(t,n){return new e(function(e,r){return u.CtxSign(t.signPKCtx,l.GetSignAlgoByCertificate(t.signCert),n,!1,!0).then(function(e){return u.BASE64Decode(e)}).then(function(e){return u.AppendCryptoHeader(u.EU_HEADER_CA_TYPE,u.EU_HEADER_PART_TYPE_SIGNED,e)}).then(function(t){e(t)}).catch(function(e){return r(l.MapError(e))})})},m=function(t,n){return new e(function(r,i){return u.CtxEnvelop(t.envelopPKCtx,[o],u.EU_RECIPIENT_APPEND_ISSUER_AND_SERIAL,!1,!1,n).then(function(e){return u.BASE64Decode(e)}).then(function(e){return u.AppendCryptoHeader(u.EU_HEADER_CA_TYPE,u.EU_HEADER_PART_TYPE_ENCRYPTED,e)}).then(function(n){var r=t.envelopCert,i=u.EU_KEY_USAGE_DIGITAL_SIGNATURE|u.EU_KEY_USAGE_KEY_AGREEMENT;return i==(r.GetInfoEx().GetKeyUsageType()&i)?n:function(t,n){return new e(function(e,r){return u.AppendCryptoHeader(u.EU_HEADER_CA_TYPE,u.EU_HEADER_PART_TYPE_CERTCRYPT,t).then(function(t){var r=new Uint8Array(t.byteLength+n.byteLength);r.set(new Uint8Array(t),0),r.set(new Uint8Array(n),t.byteLength),e(r)}).catch(function(e){return r(l.MapError(e))})})}(r.GetData(),n)}).then(function(e){return f(t,e)}).then(function(e){r({reportData:e,ownCert:t.envelopCert.GetData()})}).catch(function(e){return i(l.MapError(e))})})};return new e(function(o,p){new e(function(e,t){e(s.data)}).then(function(e){return t==null?e:f(t,e)}).then(function(e){return n==null?e:f(n,e)}).then(function(e){return i==null?e:f(i,e)}).then(function(e){return c&&(d.signedData=e),n!=null||i!=null?m(i??n,e):{reportData:e,ownCert:t.signCert.GetData()}}).then(function(e){return u.AppendTransportHeader(u.EU_HEADER_CA_TYPE,s.name,a,e.ownCert,e.reportData)}).then(function(e){d.data=e,d.error=l.MapError(u.MakeError(r.EU_ERROR_NONE,``)),o(d)}).catch(function(e){d.error=l.MapError(e),o(d)})})},t.prototype.UnprotectTaxReceipt=function(t,n){var i=this,a=this.m_library,o=new p.a;return o.data=null,o.receiptNumber=0,o.initiators=[],o.error=null,new e(function(s,c){var l;(l=n.data,new e(function(e,t){a.ParseTransportHeader(l).then(function(t){o.receiptNumber=t.GetReceiptNumber(),e(t.GetCryptoData())}).catch(function(n){n.GetErrorCode()==r.EU_ERROR_PKI_FORMATS_FAILED?e(l):t(i.MapError(n))})})).then(function(n){var l=function(n){(function(n){var s={headerInfo:null};return new e(function(e,c){a.ParseCryptoHeader(n).then(function(e){s.headerInfo=e;var n=e.GetCryptoData();switch(e.GetHeaderType()){case a.EU_HEADER_PART_TYPE_SIGNED:return a.VerifyDataInternalOnTimeEx(n,0,null,!1,!1);case a.EU_HEADER_PART_TYPE_ENCRYPTED:return a.CtxDevelop(t,n);case a.EU_HEADER_PART_TYPE_STAMPED:case a.EU_HEADER_PART_TYPE_CERTCRYPT:return null;default:throw a.MakeError(r.EU_ERROR_PKI_FORMATS_FAILED,``)}}).then(function(t){if(t!=null){var r=s.headerInfo.GetHeaderType()==a.EU_HEADER_PART_TYPE_SIGNED?u.a.MapToEndUserSignInfo(t,new _.a):u.a.MapToEndUserSenderInfo(t,new v.a);o.initiators.push(r),n=t.GetData()}else n=n.slice(s.headerInfo.GetHeaderSize()+s.headerInfo.GetCryptoData().length,n.length);e(n)}).catch(function(t){t.GetErrorCode()==r.EU_ERROR_BAD_PARAMETER?e(null):c(i.MapError(t))})})})(n).then(function(e){if(e==null)return o.data=n,o.error=i.MapError(a.MakeError(r.EU_ERROR_NONE,``)),void s(o);l(e)}).catch(function(e){return c(i.MapError(e))})};l(n)}).catch(function(e){return c(i.MapError(e))})})},t.prototype.GetKSPSettings=function(e){var t;if(!this.m_settings.KSPs)return null;if(typeof e==`string`){for(t=0;t<this.m_settings.KSPs.length;t++)if(this.m_settings.KSPs[t].name==e)return this.m_settings.KSPs[t];return null}if(typeof e==`number`){for(t=0;t<this.m_settings.KSPs.length;t++)if(this.m_settings.KSPs[t].ksp==e)return this.m_settings.KSPs[t];return null}return null},t.prototype.GetPollingInterval=function(e){return e&&typeof e.pollingInterval==`number`?1e3*e.pollingInterval:1e3},t.prototype.MakeNewCertificateKSP=function(t,n,i,a,o,s,l,d,f,p,m,h,g,_,v,y,b,x,S,C){x===void 0&&(x=!1),S===void 0&&(S=null),C===void 0&&(C=null);var w=this,T=w.m_library,E={kspSettings:null,userId:null,operationId:null},D={key:null,certs:null,cmpRequest:null};return new e(function(d,m){w.CheckInitialize().then(function(){return w.BeginKMOperation()}).then(function(){var e=null;return t!=null&&(e=u.a.MapFromKeyMedia(t,T.CreateKeyMedia())),x?null:w.ReadPrivateKeyInternal(n,i,e,null,y)}).then(function(e){return b&&!x?T.CtxGetOwnEUserParams(w.m_pkContext):null}).then(function(e){return b?T.CtxModifyOwnEUserParams(w.m_pkContext,b.phone,b.EMail):null}).then(function(){if(E.userId=S,E.kspSettings=w.GetKSPSettings(C),!E.kspSettings||!E.kspSettings.address||f!=T.EU_KEYS_TYPE_NONE&&f!=T.EU_KEYS_TYPE_RSA_WITH_SHA&&f!=T.EU_KEYS_TYPE_ECDSA_WITH_SHA)throw T.MakeError(r.EU_ERROR_BAD_PARAMETER,``);var e=[];e[T.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_GOSTS]=`DSTU4145`,e[T.EU_KEYS_TYPE_RSA_WITH_SHA]=`RSA`,e[T.EU_KEYS_TYPE_ECDSA_WITH_SHA]=`ECDSA`,e[T.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_DSTU]=`DSTU4145-DSTU7564`,o!=T.EU_KEYS_LENGTH_DS_UA_FILE&&o!=T.EU_KEYS_LENGTH_DS_UA_CERT||(o=T.EU_KEYS_LENGTH_DS_UA_257),l!=T.EU_KEYS_LENGTH_KEP_UA_FILE&&l!=T.EU_KEYS_LENGTH_KEP_UA_CERT||(l=T.EU_KEYS_LENGTH_KEP_UA_431),p!=T.EU_KEYS_LENGTH_DS_RSA_FILE&&p!=T.EU_KEYS_LENGTH_DS_RSA_CERT||(p=T.EU_KEYS_LENGTH_DS_RSA_2048),h!=T.EU_KEYS_LENGTH_DS_ECDSA_FILE&&h!=T.EU_KEYS_LENGTH_DS_ECDSA_CERT||(h=T.EU_KEYS_LENGTH_DS_ECDSA_256);var t=[];t[T.EU_KEYS_LENGTH_DS_UA_191]=191,t[T.EU_KEYS_LENGTH_DS_UA_257]=257,t[T.EU_KEYS_LENGTH_DS_UA_307]=307;var n=[];n[T.EU_KEYS_LENGTH_KEP_UA_257]=257,n[T.EU_KEYS_LENGTH_KEP_UA_431]=431,n[T.EU_KEYS_LENGTH_KEP_UA_571]=571;var i=[];i[T.EU_KEYS_LENGTH_DS_RSA_1024]=1024,i[T.EU_KEYS_LENGTH_DS_RSA_2048]=2048,i[T.EU_KEYS_LENGTH_DS_RSA_3072]=3072,i[T.EU_KEYS_LENGTH_DS_RSA_4096]=4096;var c=[];c[T.EU_KEYS_LENGTH_DS_ECDSA_192]=192,c[T.EU_KEYS_LENGTH_DS_ECDSA_256]=256,c[T.EU_KEYS_LENGTH_DS_ECDSA_384]=384,c[T.EU_KEYS_LENGTH_DS_ECDSA_521]=521;var u=e[a]||null,d=t[o]||0,m=n[l]||0,g=null,_=0;f&T.EU_KEYS_TYPE_RSA_WITH_SHA?(g=`RSA`,_=i[p]||0):f&T.EU_KEYS_TYPE_ECDSA_WITH_SHA&&(g=`ECDSA`,_=c[h]||0);var v=`Веб-сайт: %s`.replace(`%s`,E.kspSettings.systemId||w.m_origin),y=`Генерація ос. ключа у системі %s`.replace(`%s`,E.kspSettings.systemId||w.m_origin);return T.SServerClientGeneratePrivateKeyAsync(E.kspSettings.address,E.kspSettings.port,E.userId,v,y,u,d,s,m,g,_)}).then(function(t){E.operationId=t;var n=w.GetPollingInterval(E.kspSettings),i=w.MakeExpireDate(300);return new e(function(e,t){var a=function(i){new Date>i?t(T.MakeError(r.EU_ERROR_TRANSMIT_REQUEST,``)):w.m_library.SServerClientCheckGeneratePrivateKeyStatus(E.kspSettings.address,E.kspSettings.port,E.userId,E.operationId).then(function(t){t==null?setTimeout(function(){a(i)},n):e(t)}).catch(function(e){t(w.MapError(e))})};a(i)})}).then(function(e){for(var t=null,n=null,r=null,i=null,a=0;a<e.size();a++){var o=e.get(a);switch(o.GetRequestType()){case T.EU_KEYS_REQUEST_TYPE_UA_DS:t=o.GetRequest();break;case T.EU_KEYS_REQUEST_TYPE_UA_KEP:n=o.GetRequest();break;case T.EU_KEYS_REQUEST_TYPE_INTERNATIONAL:f&T.EU_KEYS_TYPE_RSA_WITH_SHA?r=o.GetRequest():f&T.EU_KEYS_TYPE_ECDSA_WITH_SHA&&(i=o.GetRequest())}}return w.m_library.CtxMakeNewOwnCertificateWithCR(w.m_pkContext,t,n,r,i)}).then(function(){var e=`Веб-сайт: %s`.replace(`%s`,E.kspSettings.systemId||w.m_origin),t=`Ідентифікація клієнта у системі %s`.replace(`%s`,E.kspSettings.systemId||w.m_origin),n=E.kspSettings.signAlgos&&E.kspSettings.signAlgos.indexOf(T.EU_CTX_SIGN_DSTU4145_WITH_DSTU7564)>=0?`DSTU4145-DSTU7564`:`DSTU4145`;return T.SServerClientSignHashesAsync(E.kspSettings.address,E.kspSettings.port,E.userId,e,t,[`Зчитування ос. ключа`],[`AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=`],n)}).then(function(t){E.operationId=t;var n=w.GetPollingInterval(E.kspSettings),i=w.MakeExpireDate(300);return new e(function(e,t){var a=function(i){new Date>i?t(T.MakeError(r.EU_ERROR_TRANSMIT_REQUEST,``)):T.SServerClientCheckSignHashesStatus(E.kspSettings.address,E.kspSettings.port,E.userId,E.operationId).then(function(o){if(o!=null){if(o.size()==1){var s=o.get(0);if(s.GetError()==r.EU_ERROR_NONE){var l=s.GetSignature(),d=new c.EndUserCertificate;T.CtxGetSignerInfo(w.m_context,0,l).then(function(t){u.a.MapToEndUserCertificate(t,d),e([d])}).catch(function(e){return t(w.MapError(e))})}else t(T.MakeError(s.GetError(),s.GetStatus()))}else t(T.MakeError(r.EU_ERROR_PKI_FORMATS_FAILED,``))}else setTimeout(function(){a(i)},n)}).catch(function(e){t(w.MapError(e))})};a(i)})}).then(function(e){w.EndKMOperation(),D.certs=e,d(D)}).catch(function(e){w.ResetPrivateKeyInternal().then(function(){w.EndKMOperation(),m(w.MapError(e))}).catch(function(){w.EndKMOperation(),m(w.MapError(e))})})})},t.prototype.AddEventListener=function(t,n){var i=this,a=i.m_library;return new e(function(e,o){if([f.EndUserEventType.None,f.EndUserEventType.All,f.EndUserEventType.ConfirmKSPOperation].indexOf(t)<0)o(i.MapError(a.MakeError(r.EU_ERROR_BAD_PARAMETER,``)));else{switch(t){case f.EndUserEventType.None:i.m_eventListeners=[];break;case f.EndUserEventType.All:i.m_eventListeners=[],i.m_eventListeners[t]=n;break;default:i.m_eventListeners[t]=n}e()}})},t.prototype.GetLibraryInfo=function(t){var n=this,r=this.m_library;return new e(function(e,i){var a=new l.b;a.supported=r.IsSupported(),a.isSignAgentSupported=r.IsSignAgentSupported(),a.isWebExtensionSupported=r.IsWebExtensionSupported(),a.isNPAPISupported=r.IsNPAPISupported(),a.isActiveXSupported=r.IsActiveXSupported(),a.isWebExtensionInstalled=r.IsWebExtensionInstalled(),a.nativeLibraryInstallURLs=r.GetInstallURL(!0,t),a.nativeLibraryInstallURL=a.nativeLibraryInstallURLs?a.nativeLibraryInstallURLs[0]:null,a.nativeLibraryUpdateURLs=r.GetUpdateURL(!0,t),a.nativeLibraryUpdateURL=a.nativeLibraryUpdateURLs?a.nativeLibraryUpdateURLs[0]:null,a.webExtensionInstallURL=r.GetWebExtensionInstallURL(),a.helpURL=r.GetHelpURL(t),a.supported?r.Load().then(function(){a.loaded=!0,r.GetVersion().then(function(t){a.version=t,e(a)}).catch(function(e){return i(n.MapError(e))})}).catch(function(t){var i=n.MapError(t);a.loaded=!1,a.isNativeLibraryNeedUpdate=r.IsLibraryVersionNotSupportedError(i.code),e(a)}):e(a)})},t.prototype.IsInitialized=function(){var t=this;return new e(function(e,n){e(t.m_initialized)})},t.prototype.Initialize=function(t){var n=this,r=n.m_library;n.m_settings=t;var i={offline:!0,tspSettings:null,useOCSP:!1,useCMP:!1};return new e(function(e,a){r.Load().then(function(){return r.SetRuntimeParameter(r.EU_SAVE_SETTINGS_PARAMETER,r.EU_SETTINGS_ID_PROXY)}).then(function(){return r.SetUIMode(!1)}).then(function(){return r.Initialize()}).then(function(){return r.SetUIMode(!1)}).then(function(){return r.SetCharset(n.m_settings.encoding)}).then(function(){return r.SetLanguage(n.m_settings.language)}).then(function(){return r.InitializeMandatorySettings()}).then(function(){var e=r.CreateFileStoreSettings();return e.SetPath(``),e.SetSaveLoadedCerts(!0),r.SetFileStoreSettings(e)}).then(function(){return n.m_settings.CAs!=null&&typeof n.m_settings.CAs==`string`?r.DownloadData(n.m_settings.CAs,`json`):n.m_settings.CAs}).then(function(e){n.m_settings.CAs=e,i.tspSettings=n.GetDefaultTSPSettings(n.m_settings);for(var t=0;t<e.length;t++)if(e[t].ocspAccessPointAddress&&e[t].ocspAccessPointPort){i.useOCSP=!0;break}i.useCMP=n.IsCMPsAvailable(n.m_settings),i.offline=!i.tspSettings&&!i.useOCSP&&!i.useCMP;var a=r.CreateModeSettings();return a.SetOfflineMode(i.offline),r.SetModeSettings(a)}).then(function(){var e=r.CreateTSPSettings();return e.SetGetStamps(!!i.tspSettings),i.tspSettings&&(e.SetAddress(i.tspSettings.address),e.SetPort(i.tspSettings.port)),r.SetTSPSettings(e)}).then(function(){var e=r.CreateOCSPSettings();return e.SetUseOCSP(i.useOCSP),i.useOCSP&&(e.SetBeforeStore(!0),e.SetAddress(`czo.gov.ua`),e.SetPort(`80`)),r.SetOCSPSettings(e)}).then(function(){var e=r.CreateOCSPAccessInfoModeSettings();return e.SetEnabled(i.useOCSP),r.SetOCSPAccessInfoModeSettings(e)}).then(function(){if(i.useOCSP){for(var e=[],t=n.m_settings.CAs,a=0;a<t.length;a++)for(var o=0;o<t[a].issuerCNs.length;o++){var s=r.CreateOCSPAccessInfoSettings();s.SetAddress(t[a].ocspAccessPointAddress),s.SetPort(t[a].ocspAccessPointPort),s.SetIssuerCN(t[a].issuerCNs[o]),e.push(s)}return r.SetOCSPAccessInfoSettings(e)}}).then(function(){return t.CACertificates!=null&&typeof t.CACertificates==`string`?r.DownloadData(t.CACertificates,`binary`):t.CACertificates}).then(function(e){if(t.CACertificates!=null)return r.SaveCertificates(e)}).then(function(){var e=!!t.TSLAddress,n=r.CreateTSLSettings();return n.SetUseTSL(e),n.SetAutoDownloadTSL(!!e),n.SetTSLAddress(e?t.TSLAddress:``),r.SetTSLSettings(n)}).then(function(){return r.SetRuntimeParameter(r.EU_RESOLVE_OIDS_PARAMETER,n.m_resolveOIDs)}).then(function(){if(typeof n.m_settings.connectionTimeout==`number`)return r.SetRuntimeParameter(r.EU_CONNECTIONS_TIMEOUT_PARAMETER,n.m_settings.connectionTimeout)}).then(function(){if(typeof t.ocspResponseExpireTime==`number`)return r.SetOCSPResponseExpireTime(n.m_settings.ocspResponseExpireTime)}).then(function(){return r.CtxCreate()}).then(function(e){return n.m_context=e,r.CtxSetParameter(e,r.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,n.m_resolveOIDs)}).then(function(){if(n.m_settings.useSLoginPrivateKey)return r.CtxSetParameter(n.m_context,r.EU_USE_SLOGIN_PRIVATE_KEY_CONTEXT_PARAMETER,!0)}).then(function(){return r.SetRuntimeParameter(r.EU_CHECK_CERT_CHAIN_ON_SIGN_TIME_PARAMETER,!0)}).then(function(){return n.m_settings.signInfoTmpl!=null&&typeof n.m_settings.signInfoTmpl==`string`?r.DownloadData(n.m_settings.signInfoTmpl,``):n.m_settings.signInfoTmpl}).then(function(t){n.m_settings.signInfoTmpl=t,n.m_initialized=!0,e()}).catch(function(e){return a(n.MapError(e))})})},t.prototype.Finalize=function(){var t=this,n=t.m_library;return new e(function(e,r){t.CheckInitialize().then(function(){if(t.m_pkContext!=null)return n.CtxFreePrivateKey(t.m_pkContext)}).then(function(){if(t.m_pkContext=null,t.m_context!=null)return n.CtxFree(t.m_context)}).then(function(){return t.m_context=null,n.Finalize()}).then(function(){t.m_initialized=!1,t.m_settings=null,t.m_kmTypes=null,t.m_kmActiveOperation=!1,t.m_eventListeners=[],t.m_resolveOIDs=!1,e()}).then(function(){e()}).catch(function(e){return r(t.MapError(e))})})},t.prototype.SetLanguage=function(t){var n=this,r=n.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return r.SetLanguage(t)}).then(function(){n.m_settings.language=t}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.SetRuntimeParameter=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return i.SetRuntimeParameter(t,n)}).then(function(){return t==i.EU_USE_SLOGIN_PRIVATE_KEY?i.CtxSetParameter(r.m_context,t,n):null}).then(function(){e()}).catch(function(e){return a(r.MapError(e))})})},t.prototype.GetStorageParameter=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return i.GetStorageParameter(n,t)}).then(function(t){e(t)}).catch(function(e){return a(r.MapError(e))})})},t.prototype.SetStorageParameter=function(t,n,r){var i=this,a=i.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.SetStorageParameter(r,t,n)}).then(function(){e()}).catch(function(e){return o(i.MapError(e))})})},t.prototype.GetCAs=function(){var t=this;return new e(function(e,n){t.CheckInitialize().then(function(){e(t.m_settings.CAs)}).catch(function(e){return n(t.MapError(e))})})},t.prototype.GetProxySettings=function(){var t=this,n=t.m_library;return new e(function(e,r){t.CheckInitialize().then(function(){return n.GetProxySettings()}).then(function(t){e(u.a.MapToProxySettings(t,new i.b))}).catch(function(e){return r(t.MapError(e))})})},t.prototype.SetProxySettings=function(t){var n=this,r=n.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){var e=u.a.MapFromProxySettings(t,r.CreateProxySettings());return r.SetProxySettings(e)}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.GetHostInfo=function(){var t=this,n=t.m_library;return new e(function(e,r){t.CheckInitialize().then(function(){return n.GetHostInfo()}).then(function(t){e(t)}).catch(function(e){return r(t.MapError(e))})})},t.prototype.GetKeyMedias=function(){var t=this,n=t.m_library,r=[],i=null;return t.m_settings.allowedKeyMediaDevices&&(i={},t.m_settings.allowedKeyMediaDevices.forEach(function(e){i[e.type]=e.devices})),new e(function(e,a){t.CheckInitialize().then(function(){return t.BeginKMOperation()}).then(function(){return t.m_kmTypes?t.m_kmTypes:n.GetKeyMediaTypes()}).then(function(e){t.m_kmTypes=e;var i=t.m_settings.allowedKeyMediaTypes;r=[];for(var a=0;a<e.length;a++){var o=e[a];(!i||i.indexOf(o)>=0)&&r.push(a)}return n.GetKeyMediaDevices(r)}).then(function(n){for(var a=[],o=0;o<n.length;o++)for(var s=r[o],l=t.m_kmTypes[s],u=n[o],d=i&&i[l]?i[l]:null,f=0;f<u.length;f++)if(!d||d.indexOf(u[f])!=-1){var p=new c.EndUserKeyMedia;p.typeIndex=s,p.devIndex=f,p.password=null,p.type=l,p.device=u[f],p.visibleName=p.device+`(`+p.type+`)`,a.push(p)}t.EndKMOperation(),e(a)}).catch(function(e){t.EndKMOperation(),a(t.MapError(e))})})},t.prototype.GetJKSPrivateKeys=function(t){var n=this;return new e(function(e,r){n.CheckInitialize().then(function(){var i=[],a=function(o){n.GetJKSPrivateKey(t,o).then(function(t){t?(i.push(t),a(o+1)):e(i)}).catch(function(e){return r(n.MapError(e))})};a(0)}).catch(function(e){return r(n.MapError(e))})})},t.prototype.IsPrivateKeyReaded=function(){var t=this;return new e(function(e,n){t.CheckInitialize().then(function(){e(t.m_pkContext!=null)}).catch(function(e){return n(t.MapError(e))})})},t.prototype.ResetPrivateKey=function(){var t=this;return new e(function(e,n){t.CheckInitialize().then(function(){return t.ResetPrivateKeyInternal()}).then(function(){e()}).catch(function(e){return n(t.MapError(e))})})},t.prototype.ResetOperationKSP=function(){var t=this,n=this.m_library;return new e(function(e,i){t.CheckInitialize().then(function(){throw n.MakeError(r.EU_ERROR_NOT_SUPPORTED,``)}).catch(function(e){return i(t.MapError(e))})})},t.prototype.ReadPrivateKey=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){i.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(t,a.CreateKeyMedia());return i.ReadPrivateKeyInternal(null,null,e,n,r)}).then(function(t){i.EndKMOperation(),e(t)}).catch(function(e){i.EndKMOperation(),o(i.MapError(e))})})},t.prototype.ReadPrivateKeyBinary=function(t,n,r,i){var a=this;return new e(function(e,o){a.CheckInitialize().then(function(){return a.ReadPrivateKeyInternal(t,n,null,r,i)}).then(function(t){e(t)}).catch(function(e){return o(a.MapError(e))})})},t.prototype.ReadPrivateKeySIM=function(t,n,i,a){var o=this,s=this.m_library;return new e(function(e,t){o.CheckInitialize().then(function(){throw s.MakeError(r.EU_ERROR_NOT_SUPPORTED,``)}).catch(function(e){return t(o.MapError(e))})})},t.prototype.ReadPrivateKeyKSP=function(t,n,i,a,o,s,c){var l=this,u=this.m_library;return new e(function(e,t){l.CheckInitialize().then(function(){throw u.MakeError(r.EU_ERROR_NOT_SUPPORTED,``)}).catch(function(e){return t(l.MapError(e))})})},t.prototype.GetOwnCertificates=function(){return this.CtxGetOwnCertificates(this.m_pkContext)},t.prototype.GetOwnEUserParams=function(){var t=this,n=t.m_library;return new e(function(e,i){t.CheckInitialize().then(function(){if(t.m_pkContext==null)throw n.MakeError(r.EU_ERROR_BAD_CERT,``);return n.CtxGetOwnEUserParams(t.m_pkContext)}).then(function(t){e(u.a.MapToEndUserParams(t,new m.a))}).catch(function(e){return i(t.MapError(e))})})},t.prototype.ChangeOwnCertificatesStatus=function(t,n){var i=this,a=i.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){if(i.m_pkContext==null)throw a.MakeError(r.EU_ERROR_BAD_CERT,``);return a.CtxChangeOwnCertificatesStatus(i.m_pkContext,t,n)}).then(function(){e()}).catch(function(e){return o(i.MapError(e))})})},t.prototype.MakeNewCertificate=function(t,n,r,i,a,o,s,c,l,d,f,p,m,h,g,_,v,y,b,x){_===void 0&&(_=!1),v===void 0&&(v=null),y===void 0&&(y=null),b===void 0&&(b=0),x===void 0&&(x=null);var S=this,C=S.m_library,w={key:null,certs:null,cmpRequest:null};return v!=null||y!=null?S.MakeNewCertificateKSP(t,n,r,i,a,o,s,c,l,d,f,b,x,p,m,h,g,_,v,y):new e(function(v,y){S.CheckInitialize().then(function(){return S.BeginKMOperation()}).then(function(){var e=null;return t!=null&&(e=u.a.MapFromKeyMedia(t,C.CreateKeyMedia())),_?null:S.ReadPrivateKeyInternal(n,r,e,null,h)}).then(function(e){return g&&!_?C.CtxGetOwnEUserParams(S.m_pkContext):null}).then(function(e){return g?C.CtxModifyOwnEUserParams(S.m_pkContext,g.phone,g.EMail):null}).then(function(){return _?null:S.ResetPrivateKeyInternal()}).then(function(){if(_)return new e(function(e,n){var r={makeCertResult:null};C.CtxMakeNewOwnCertificateEx(S.m_pkContext,i,a,o,s,c,l,d,f,b,x).then(function(e){return r.makeCertResult=e,S.ResetPrivateKeyInternal()}).then(function(){var e=u.a.MapFromKeyMedia(t,C.CreateKeyMedia());return p&&p.password!=t.password?C.ChangePrivateKeyPassword(e,p.password):null}).then(function(){e(r.makeCertResult)}).catch(function(e){n(S.MapError(e))})});var h=null,g=null;return t&&(h=u.a.MapFromKeyMedia(t,C.CreateKeyMedia())),p&&(g=u.a.MapFromKeyMedia(p,C.CreateKeyMedia())),C.MakeNewCertificateEx(h,n,r,i,a,o,s,c,l,d,f,b,x,g,m)}).then(function(e){w.key=e.GetPrivateKey(),w.cmpRequest=e.GetCMPRequest();var n=null;return(_&&t||p)&&(n=u.a.MapFromKeyMedia(p||t,C.CreateKeyMedia())),S.SearchPrivateKeyCertificatesWithCMP(w.key,m,n,h)}).then(function(e){return S.GetUserCertificatesFromCertificates(e.certs)}).then(function(e){S.EndKMOperation(),w.certs=e,v(w)}).catch(function(e){S.EndKMOperation(),y(S.MapError(e))})})},t.prototype.MakeDeviceCertificate=function(t,n,i,a,o){var s=this,l=s.m_library;return new e(function(f,p){s.CheckInitialize().then(function(){if(s.m_pkContext==null)throw l.MakeError(r.EU_ERROR_BAD_CERT,``);var e=s.m_pkContext.GetOwnerInfo(),c=s.GetCASettings(e.GetIssuerCN());if(!c||!c.cmpAddress||c.cmpAddress==``)throw l.MakeError(r.EU_ERROR_BAD_PARAMETER,``);return l.CtxMakeDeviceCertificate(s.m_pkContext,t,n,i,a,o,c.cmpAddress,`80`)}).then(function(t){return s.ProcessArray(t,function(t){return new e(function(e,n){l.ParseCertificateEx(t).then(function(n){var r=new c.EndUserCertificate;r.data=t,r.infoEx=u.a.MapToEndUserCertificateInfoEx(n,new d.a),e(r)}).catch(function(e){return n(e)})})})}).then(function(e){f(e)}).catch(function(e){s.EndKMOperation(),p(s.MapError(e))})})},t.prototype.SetKeyMediaUserPassword=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return r.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(n,i.CreateKeyMedia());return r.m_library.SetKeyMediaUserPassword(t,e)}).then(function(){r.EndKMOperation(),e()}).catch(function(e){r.EndKMOperation(),a(r.MapError(e))})})},t.prototype.ChangePrivateKeyPassword=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return r.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(t,i.CreateKeyMedia());return r.m_library.ChangePrivateKeyPassword(e,n)}).then(function(){r.EndKMOperation(),e()}).catch(function(e){r.EndKMOperation(),a(r.MapError(e))})})},t.prototype.ChangePrivateKeyPasswordBinary=function(t,n,r){var i=this,a=i.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.ChangeSoftwarePrivateKeyPassword(t,n,r)}).then(function(t){e(t),e()}).catch(function(e){o(i.MapError(e))})})},t.prototype.GeneratePrivateKey=function(t,n,r,i,a,o,s,c,l,d,f,p){var m=this,h=m.m_library;return new e(function(e,g){m.CheckInitialize().then(function(){return m.BeginKMOperation()}).then(function(){var e=null;return t&&(e=u.a.MapFromKeyMedia(t,h.CreateKeyMedia())),m.GeneratePrivateKeyInternal(e,n,null,r,i,a,o,s,c,l,d,f,p)}).then(function(t){m.EndKMOperation(),e(t)}).catch(function(e){m.EndKMOperation(),g(m.MapError(e))})})},t.prototype.GeneratePrivateKeyBinary=function(t,n,r,i,a,o,s,c,l,u,d){var f=this;return new e(function(e,p){f.CheckInitialize().then(function(){return f.BeginKMOperation()}).then(function(){return f.GeneratePrivateKeyInternal(null,!1,t,n,r,i,a,o,s,c,l,u,d)}).then(function(t){f.EndKMOperation(),e(t)}).catch(function(e){f.EndKMOperation(),p(f.MapError(e))})})},t.prototype.GetKeyInfo=function(t){var n=this,r=n.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return n.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(t,r.CreateKeyMedia());return r.GetKeyInfo(e)}).then(function(t){n.EndKMOperation(),e(t.GetPrivateKeyInfo())}).catch(function(e){n.EndKMOperation(),i(n.MapError(e))})})},t.prototype.GetKeyInfoBinary=function(t,n){var r=this,i=r.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return i.GetKeyInfoBinary(t,n)}).then(function(t){e(t.GetPrivateKeyInfo())}).catch(function(e){a(r.MapError(e))})})},t.prototype.GetClientRegistrationTokenKSP=function(t,n){var i=this,a=i.m_library;return new e(function(e,t){i.CheckInitialize().then(function(){throw a.MakeError(r.EU_ERROR_NOT_SUPPORTED,``)}).catch(function(e){t(i.MapError(e))})})},t.prototype.HashData=function(t,n,r){var i=this,a=this.m_library,o=i.DataToNamedDataArray(n);return new e(function(s,c){i.CheckInitialize().then(function(){return i.ProcessArray(o,function(n){return new e(function(e,o){a.CtxHash(i.m_context,t,null,n.val).then(function(e){return r?e:a.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return o(e)})})})}).then(function(e){s(i.DataToResult(n,e))}).catch(function(e){c(i.MapError(e))})})},t.prototype.GetSigner=function(t,n,r){n===void 0&&(n=-1),r===void 0&&(r=!1);var i=this,a=this.m_library,o={context:null,signersInfo:null};return new e(function(s,l){i.CheckInitialize().then(function(){return a.CtxCreate()}).then(function(e){return o.context=e,a.CtxSetParameter(e,a.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,r)}).then(function(){return n==-1?a.GetSignsCount(t):1}).then(function(r){var s=[];if(n!=-1)s.push(n);else for(var l=0;l<r;l++)s.push(l);return i.ProcessArray(s,function(n){return new e(function(e,r){var s=new c.EndUserCertificate;a.CtxGetSignerInfo(o.context,n,t).then(function(t){u.a.MapToEndUserCertificate(t,s),e(s)}).catch(function(e){return r(i.MapError(e))})})})}).then(function(e){return o.signersInfo=e,a.CtxFree(o.context)}).then(function(){o.context=null,s(n==-1?o.signersInfo:o.signersInfo[0])}).catch(function(e){o.context?a.CtxFree(o.context).then(function(){l(i.MapError(e))}).catch(function(){l(i.MapError(e))}):l(i.MapError(e))})})},t.prototype.SignData=function(e,t){return t===void 0&&(t=!1),this.SignDataEx(f.EndUserSignAlgo.Unknown,e,!0,!0,t)},t.prototype.SignDataInternal=function(e,t,n){return n===void 0&&(n=!1),this.SignDataEx(f.EndUserSignAlgo.Unknown,t,!1,e,n)},t.prototype.SignHash=function(e,t,n,r){return this.CtxSignHashInternal(this.m_pkContext,e,t,null,n,r)},t.prototype.SignDataEx=function(e,t,n,r,i){return this.CtxSignDataInternal(this.m_pkContext,e,t,null,n,r,i)},t.prototype.AppendSign=function(e,t,n,r,i){return this.CtxSignDataInternal(this.m_pkContext,e,t,n,t!=null,r,i)},t.prototype.AppendSignHash=function(e,t,n,r,i){return this.CtxSignHashInternal(this.m_pkContext,e,t,n,r,i)},t.prototype.GetSignValue=function(e,t,n,r){return r===void 0&&(r=!1),this.CtxGetSignValue(this.m_pkContext,e,t,n,r)},t.prototype.VerifyHash=function(t,n,r){r===void 0&&(r=-1);var i=this,a=this.m_library;return new e(function(o,s){i.CheckInitialize().then(function(){return r==-1?a.GetSignsCount(n):1}).then(function(o){var s=[];if(r!=-1)s.push(r);else for(var c=0;c<o;c++)s.push(c);return i.ProcessArray(s,function(r){return new e(function(e,o){var s=new _.a;a.VerifyHashOnTimeEx(t,r,n,null,!1,!1).then(function(e){return u.a.MapToEndUserSignInfo(e,s),a.GetSignTimeInfo(r,n)}).then(function(e){return s.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),a.GetSignType(r,n)}).then(function(t){s.signLevel=t,e(s)}).catch(function(e){return o(i.MapError(e))})})})}).then(function(e){o(r==-1?e:e[0])}).catch(function(e){return s(i.MapError(e))})})},t.prototype.VerifyData=function(t,n,r){r===void 0&&(r=-1);var i=this,a=this.m_library;return new e(function(o,s){i.CheckInitialize().then(function(){return r==-1?a.GetSignsCount(n):1}).then(function(o){var s=[];if(r!=-1)s.push(r);else for(var c=0;c<o;c++)s.push(c);return i.ProcessArray(s,function(r){return new e(function(e,o){var s=new _.a;a.VerifyDataOnTimeEx(t,r,n,null,!1,!1).then(function(e){return u.a.MapToEndUserSignInfo(e,s),a.GetSignTimeInfo(r,n)}).then(function(e){return s.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),a.GetSignType(r,n)}).then(function(t){s.signLevel=t,e(s)}).catch(function(e){return o(i.MapError(e))})})})}).then(function(e){o(r==-1?e:e[0])}).catch(function(e){return s(i.MapError(e))})})},t.prototype.VerifyDataInternal=function(t,n){n===void 0&&(n=-1);var r=this,i=this.m_library;return new e(function(a,o){r.CheckInitialize().then(function(){return n==-1?i.GetSignsCount(t):1}).then(function(a){var o=[];if(n!=-1)o.push(n);else for(var s=0;s<a;s++)o.push(s);return r.ProcessArray(o,function(n){return new e(function(e,a){var o=new _.a;i.VerifyDataInternalOnTimeEx(t,n,null,!1,!1).then(function(e){return u.a.MapToEndUserSignInfo(e,o),i.GetSignTimeInfo(n,t)}).then(function(e){return o.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),i.GetSignType(n,t)}).then(function(t){o.signLevel=t,e(o)}).catch(function(e){return a(r.MapError(e))})})})}).then(function(e){a(n==-1?e:e[0])}).catch(function(e){return o(r.MapError(e))})})},t.prototype.EnvelopData=function(t,n,i,a,o,s){s===void 0&&(s=!1);var c=this,l=this.m_library;return new e(function(e,u){c.CheckInitialize().then(function(){if(c.m_pkContext==null&&(!s||i))throw l.MakeError(r.EU_ERROR_BAD_CERT,``);var e=l.EU_RECIPIENT_APPEND_TYPE_BY_ISSUER_SERIAL;return s?i?l.CtxEnvelopWithDynamicKey(c.m_pkContext,t,e,i,a,n):l.EnvelopToRecipientsWithDynamicKey(t,i,a,n):l.CtxEnvelop(c.m_pkContext,t,e,i,a,n)}).then(function(e){return o?e:l.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return u(c.MapError(e))})})},t.prototype.DevelopData=function(t,n){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){if(i.m_pkContext==null)throw a.MakeError(r.EU_ERROR_BAD_CERT,``);return a.CtxDevelop(i.m_pkContext,t,n)}).then(function(t){e(u.a.MapToEndUserSenderInfo(t,new v.a))}).catch(function(e){return o(i.MapError(e))})})},t.prototype.ProtectDataByPassword=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.ProtectDataByPassword(t,n)}).then(function(e){return r?e:a.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return o(i.MapError(e))})})},t.prototype.UnprotectDataByPassword=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.UnprotectDataByPassword(t,n)}).then(function(e){return r?a.BytesToString(e):e}).then(function(t){e(t)}).catch(function(e){return o(i.MapError(e))})})},t.prototype.CreateAuthData=function(t,n,i){var a=this,o=this.m_library;return new e(function(e,s){a.CheckInitialize().then(function(){if(a.m_pkContext==null)throw o.MakeError(r.EU_ERROR_BAD_CERT,``);return o.CtxCreateAuthData(a.m_pkContext,t,n)}).then(function(e){return i?e:o.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return s(a.MapError(e))})})},t.prototype.GetTSPByAccessInfo=function(t,n,r,i,a){var o=this,s=this.m_library;return new e(function(e,c){o.CheckInitialize().then(function(){return s.GetTSPByAccessInfo(t,n,r,i)}).then(function(e){return a?s.BASE64Encode(e):e}).then(function(t){e(t)}).catch(function(e){return c(o.MapError(e))})})},t.prototype.CheckTSP=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return a.CheckTSP(t,n,r)}).then(function(){e()}).catch(function(e){return o(i.MapError(e))})})},t.prototype.ClientDynamicKeySessionCreate=function(t){var n=this,r=this.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return r.ClientDynamicKeySessionCreate(3600,t)}).then(function(t){e(u.a.MapToEndUserSession(t,new b.a))}).catch(function(e){return i(n.MapError(e))})})},t.prototype.SessionClose=function(t){var n=this,r=this.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return r.SessionClose(u.a.MapFromEndUserSession(t,r.CreateEndUserSession()))}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.SessionEncrypt=function(t,n,r){var i=this,a=this.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return typeof n==`string`?a.StringToBytes(n):n}).then(function(e){return a.SessionEncrypt(u.a.MapFromEndUserSession(t,a.CreateEndUserSession()),e)}).then(function(t){return r?a.BASE64Encode(t).then(function(t){e(t)}).catch(function(e){o(i.MapError(e))}):e(t)}).catch(function(e){return o(i.MapError(e))})})},t.prototype.SessionDecrypt=function(t,n){var r=this,i=this.m_library;return new e(function(e,a){r.CheckInitialize().then(function(){return i.SessionDecrypt(u.a.MapFromEndUserSession(t,i.CreateEndUserSession()),n)}).then(function(t){e(t)}).catch(function(e){return a(r.MapError(e))})})},t.prototype.CtxCreate=function(){var t=this,n=this.m_library,r={context:null};return new e(function(e,i){t.CheckInitialize().then(function(){return n.CtxCreate()}).then(function(e){return r.context=e,n.CtxSetParameter(e,n.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,t.m_resolveOIDs)}).then(function(){e(r.context)}).catch(function(e){return i(t.MapError(e))})})},t.prototype.CtxFree=function(t){var n=this,r=this.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){r.CtxFree(t)}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.CtxSetParameter=function(t,n,r){var i=this,a=i.m_library;return new e(function(e,o){i.CheckInitialize().then(function(){return t??=i.m_context,a.CtxSetParameter(t,n,r)}).then(function(){e()}).catch(function(e){i.EndKMOperation(),o(i.MapError(e))})})},t.prototype.CtxReadPrivateKey=function(t,n,r,i){var a=this,o=a.m_library;return new e(function(e,s){a.CheckInitialize().then(function(){return a.BeginKMOperation()}).then(function(){var e=u.a.MapFromKeyMedia(n,o.CreateKeyMedia());return a.CtxReadPrivateKeyInternal(t,null,null,e,r,i,!0)}).then(function(t){a.EndKMOperation(),e(t)}).catch(function(e){a.EndKMOperation(),s(a.MapError(e))})})},t.prototype.CtxReadPrivateKeyBinary=function(t,n,r,i,a){var o=this;return new e(function(e,s){o.CheckInitialize().then(function(){return o.CtxReadPrivateKeyInternal(t,n,r,null,i,a,!0)}).then(function(t){e(t)}).catch(function(e){return s(o.MapError(e))})})},t.prototype.CtxFreePrivateKey=function(t){var n=this,r=this.m_library;return new e(function(e,i){n.CheckInitialize().then(function(){return r.CtxFreePrivateKey(t)}).then(function(){e()}).catch(function(e){return i(n.MapError(e))})})},t.prototype.CtxGetOwnCertificates=function(t){var n=this,i=this.m_library;return new e(function(e,a){n.CheckInitialize().then(function(){if(t==null)throw i.MakeError(r.EU_ERROR_BAD_CERT,``);var o=[],s=function(r){i.CtxEnumOwnCertificates(t,r).then(function(t){if(t){var n=u.a.MapToEndUserCertificate(t,new c.EndUserCertificate);o.push(n),s(r+1)}else e(o)}).catch(function(e){return a(n.MapError(e))})};s(0)}).catch(function(e){return a(n.MapError(e))})})},t.prototype.CtxSignHash=function(e,t,n,r,i){return this.CtxSignHashInternal(e,t,n,null,r,i)},t.prototype.CtxSignData=function(e,t,n,r,i,a){return this.CtxSignDataInternal(e,t,n,null,r,i,a)},t.prototype.CtxAppendSignHash=function(e,t,n,r,i,a){return this.CtxSignHashInternal(e,t,n,r,i,a)},t.prototype.CtxAppendSign=function(e,t,n,r,i,a){return this.CtxSignDataInternal(e,t,n,r,n!=null,i,a)},t.prototype.CtxGetSignValue=function(t,n,i,a,o){o===void 0&&(o=!1);var s=this,c=this.m_library,l=s.DataToNamedDataArray(i);return new e(function(u,d){s.CheckInitialize().then(function(){if(t==null)throw c.MakeError(r.EU_ERROR_BAD_CERT,``);return n==f.EndUserSignAlgo.ECDSAWithSHA?c.CtxSetParameter(s.m_context,c.EU_ENCODE_ECDSA_SIGN_VALUE_CONTEXT_PARAMETER,o):null}).then(function(){return s.ProcessArray(l,function(r){return new e(function(e,i){c.CtxGetSignValue(t,n,r.val).then(function(e){return a?e:c.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return i(e)})})})}).then(function(e){u(s.DataToResult(i,e))}).catch(function(e){return d(s.MapError(e))})})},t.prototype.CtxEnvelopData=function(t,n,i,a,o,s,c){var l=this,u=this.m_library;return new e(function(e,d){l.CheckInitialize().then(function(){if(t==null&&(!c||a))throw u.MakeError(r.EU_ERROR_BAD_CERT,``);var e=u.EU_RECIPIENT_APPEND_TYPE_BY_ISSUER_SERIAL;return c?a?u.CtxEnvelopWithDynamicKey(t,n,e,a,o,i):u.EnvelopToRecipientsWithDynamicKey(n,a,o,i):u.CtxEnvelop(t,n,e,a,o,i)}).then(function(e){return s?e:u.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return d(l.MapError(e))})})},t.prototype.CtxDevelopData=function(t,n,i){var a=this,o=this.m_library;return new e(function(e,s){a.CheckInitialize().then(function(){if(t==null)throw o.MakeError(r.EU_ERROR_BAD_CERT,``);return o.CtxDevelop(t,n,i)}).then(function(t){e(u.a.MapToEndUserSenderInfo(t,new v.a))}).catch(function(e){return s(a.MapError(e))})})},t.prototype.ProtectTaxReports=function(t,n,r,i,a,o,s){t===void 0&&(t=null),n===void 0&&(n=null),r===void 0&&(r=null),s===void 0&&(s=!1);var c=this;return new e(function(e,l){var u={accountant:null,director:null,stamp:null};c.CheckInitialize().then(function(){var e=[f.EndUserKeyUsage.DigitalSignature];return t==null?null:c.LoadTaxReportPKey(t,e,!1)}).then(function(e){u.accountant=e;var t=[f.EndUserKeyUsage.DigitalSignature];return r||t.push(f.EndUserKeyUsage.KeyAgreement),n==null?null:c.LoadTaxReportPKey(n,t,!1)}).then(function(e){u.director=e;var t=[f.EndUserKeyUsage.DigitalSignature,f.EndUserKeyUsage.KeyAgreement];return r==null?null:c.LoadTaxReportPKey(r,t,!0)}).then(function(e){return u.stamp=e,c.ProcessArray(o,function(e){return c.ProtectTaxReport(u.accountant,u.director,u.stamp,i,a,e,s)})}).then(function(t){e(t)}).catch(function(e){return l(c.MapError(e))})})},t.prototype.UnprotectTaxReceipts=function(t,n){var r=this;return new e(function(e,i){r.CheckInitialize().then(function(){return r.ProcessArray(n,function(e){return r.UnprotectTaxReceipt(t,e)})}).then(function(t){e(t)}).catch(function(e){return i(r.MapError(e))})})},t.prototype.ASiCGetSigner=function(t,n,r){n===void 0&&(n=-1),r===void 0&&(r=!1);var i=this,a=this.m_library,o={context:null,signersInfo:null};return new e(function(s,l){i.CheckInitialize().then(function(){return a.CtxCreate()}).then(function(e){return o.context=e,a.CtxSetParameter(e,a.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,r)}).then(function(){return n==-1?a.ASiCGetSignsCount(t):1}).then(function(r){var s=[];if(n!=-1)s.push(n);else for(var l=0;l<r;l++)s.push(l);return i.ProcessArray(s,function(n){return new e(function(e,r){var s=new c.EndUserCertificate;a.CtxASiCGetSignerInfo(o.context,n,t).then(function(t){u.a.MapToEndUserCertificate(t,s),e(s)}).catch(function(e){return r(i.MapError(e))})})})}).then(function(e){return o.signersInfo=e,a.CtxFree(o.context)}).then(function(){s(n==-1?o.signersInfo:o.signersInfo[0])}).catch(function(e){o.context&&a.CtxFree(o.context).then(function(){l(i.MapError(e))}).catch(function(){l(i.MapError(e))})})})},t.prototype.ASiCSignData=function(t,n,i,a,o,s){var c=this,l=this,u=this.m_library;return new e(function(e,d){l.CheckInitialize().then(function(){if(c.m_pkContext==null)throw u.MakeError(r.EU_ERROR_BAD_CERT,``);return l.ProcessArray(o,function(e){return l.NamedDataToReference(e)})}).then(function(e){return u.CtxASiCSign(c.m_pkContext,t,n,i,a,e)}).then(function(e){return s?e:u.BASE64Decode(e)}).then(function(t){e({name:o[0].name+(n==f.EndUserASiCType.S?`.asics`:`.asice`),val:t})}).catch(function(e){return d(l.MapError(e))})})},t.prototype.ASiCAppendSign=function(t,n,i,a,o){var s=this,c=this,l=this.m_library,u=c.DataToNamedDataArray(a);return new e(function(e,a){c.CheckInitialize().then(function(){if(s.m_pkContext==null)throw l.MakeError(r.EU_ERROR_BAD_CERT,``);return l.CtxASiCAppendSign(s.m_pkContext,t,n,i,u[0].val)}).then(function(e){return o?e:l.BASE64Decode(e)}).then(function(t){e({name:u[0].name,val:t})}).catch(function(e){return a(c.MapError(e))})})},t.prototype.ASiCVerifyData=function(t,n){n===void 0&&(n=-1);var r=this,i=this.m_library;return new e(function(a,o){r.CheckInitialize().then(function(){return n==-1?i.ASiCGetSignsCount(t):1}).then(function(a){var o=[];if(n!=-1)o.push(n);else for(var s=0;s<a;s++)o.push(s);return r.ProcessArray(o,function(n){return new e(function(e,a){var o=new _.a;i.ASiCVerify(n,t).then(function(e){return u.a.MapToEndUserSignInfo(e,o),i.ASiCGetSignTimeInfo(n,t)}).then(function(e){return o.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),i.ASiCGetSignLevel(n,t)}).then(function(t){o.signLevel=t,e(o)}).catch(function(e){return a(r.MapError(e))})})})}).then(function(e){a(n==-1?e:e[0])}).catch(function(e){return o(r.MapError(e))})})},t.prototype.PDFGetSigner=function(t,n,r){n===void 0&&(n=-1),r===void 0&&(r=!1);var i=this,a=this.m_library,o={context:null,signersInfo:null};return new e(function(s,l){i.CheckInitialize().then(function(){return a.CtxCreate()}).then(function(e){return o.context=e,a.CtxSetParameter(e,a.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,r)}).then(function(){return n==-1?a.PDFGetSignsCount(t):1}).then(function(r){var s=[];if(n!=-1)s.push(n);else for(var l=0;l<r;l++)s.push(l);return i.ProcessArray(s,function(n){return new e(function(e,r){var s=new c.EndUserCertificate;a.CtxPDFGetSignerInfo(o.context,n,t).then(function(t){u.a.MapToEndUserCertificate(t,s),e(s)}).catch(function(e){return r(i.MapError(e))})})})}).then(function(e){return o.signersInfo=e,a.CtxFree(o.context)}).then(function(){s(n==-1?o.signersInfo:o.signersInfo[0])}).catch(function(e){o.context&&a.CtxFree(o.context).then(function(){l(i.MapError(e))}).catch(function(){l(i.MapError(e))})})})},t.prototype.PDFSignData=function(t,n,i,a){var o=this,s=this,c=this.m_library,l=s.DataToNamedDataArray(n);return new e(function(u,d){s.CheckInitialize().then(function(){if(o.m_pkContext==null)throw c.MakeError(r.EU_ERROR_BAD_CERT,``);return s.ProcessArray(l,function(n){return new e(function(e,r){return c.CtxPDFSign(o.m_pkContext,t,n.val,i).then(function(e){return a?e:c.BASE64Decode(e)}).then(function(t){e(t)}).catch(function(e){return r(e)})})})}).then(function(e){u(o.DataToResult(n,e))}).catch(function(e){return d(s.MapError(e))})})},t.prototype.PDFVerifyData=function(t,n){n===void 0&&(n=-1);var r=this,i=this.m_library;return new e(function(a,o){r.CheckInitialize().then(function(){return n==-1?i.PDFGetSignsCount(t):1}).then(function(a){var o=[];if(n!=-1)o.push(n);else for(var s=0;s<a;s++)o.push(s);return r.ProcessArray(o,function(n){return new e(function(e,a){var o=new _.a;i.PDFVerify(n,t).then(function(e){return u.a.MapToEndUserSignInfo(e,o),i.PDFGetSignTimeInfo(n,t)}).then(function(e){return o.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),i.PDFGetSignType(n,t)}).then(function(t){o.signLevel=t,e(o)}).catch(function(e){return a(r.MapError(e))})})})}).then(function(e){a(n==-1?e:e[0])}).catch(function(e){return o(r.MapError(e))})})},t.prototype.XAdESGetSigner=function(t,n,r){n===void 0&&(n=-1),r===void 0&&(r=!1);var i=this,a=this.m_library,o={context:null,signersInfo:null};return new e(function(s,l){i.CheckInitialize().then(function(){return a.CtxCreate()}).then(function(e){return o.context=e,a.CtxSetParameter(e,a.EU_RESOLVE_OIDS_CONTEXT_PARAMETER,r)}).then(function(){return n==-1?a.XAdESGetSignsCount(t):1}).then(function(r){var s=[];if(n!=-1)s.push(n);else for(var l=0;l<r;l++)s.push(l);return i.ProcessArray(s,function(n){return new e(function(e,r){var s=new c.EndUserCertificate;a.CtxXAdESGetSignerInfo(o.context,n,t).then(function(t){u.a.MapToEndUserCertificate(t,s),e(s)}).catch(function(e){return r(i.MapError(e))})})})}).then(function(e){return o.signersInfo=e,a.CtxFree(o.context)}).then(function(){s(n==-1?o.signersInfo:o.signersInfo[0])}).catch(function(e){o.context&&a.CtxFree(o.context).then(function(){l(i.MapError(e))}).catch(function(){l(i.MapError(e))})})})},t.prototype.XAdESSignData=function(t,n,i,a,o){var s=this,c=this,l=this.m_library;return new e(function(e,u){c.CheckInitialize().then(function(){if(s.m_pkContext==null)throw l.MakeError(r.EU_ERROR_BAD_CERT,``);return c.ProcessArray(a,function(e){return c.NamedDataToReference(e)})}).then(function(e){return l.CtxXAdESSign(s.m_pkContext,t,n,i,e)}).then(function(e){return o?e:l.BASE64Decode(e)}).then(function(t){e({name:a[0].name+(a[0].name.endsWith(`.xml`)?``:`.xml`),val:t})}).catch(function(e){return u(c.MapError(e))})})},t.prototype.XAdESVerifyData=function(t,n,r){r===void 0&&(r=-1);var i=this,a=this.m_library,o=[];return new e(function(s,c){i.CheckInitialize().then(function(){return r==-1?a.XAdESGetSignsCount(n):1}).then(function(e){if(r!=-1)o.push(r);else for(var n=0;n<e;n++)o.push(n);return t==null?null:i.ProcessArray(t,function(e){return i.NamedDataToReference(e)})}).then(function(t){return i.ProcessArray(o,function(r){return new e(function(e,o){var s=new _.a;a.XAdESVerify(t,r,n).then(function(e){return u.a.MapToEndUserSignInfo(e,s),a.XAdESGetSignTimeInfo(r,n)}).then(function(e){return s.timeInfo=u.a.MapToEndUserTimeInfo(e,new y.a),a.XAdESGetSignLevel(r,n)}).then(function(t){s.signLevel=t,e(s)}).catch(function(e){return o(i.MapError(e))})})})}).then(function(e){s(r==-1?e:e[0])}).catch(function(e){return c(i.MapError(e))})})},t.prototype.GetSignContainerInfo=function(t){var n=this,r=this.m_library,i=(new g.a,function(t){var n=new g.a;return new e(function(e,i){r.IsDataInSignedDataAvailable(t).then(function(t){n.type=f.EndUserSignContainerType.CAdES,n.subType=t?f.EndUserCAdESType.Enveloped:f.EndUserCAdESType.Detached,e(n)}).catch(function(t){e(null)})})}),a=function(t){var n=new g.a;return new e(function(e,i){r.XAdESGetType(t).then(function(t){n.type=f.EndUserSignContainerType.XAdES,n.subType=t,e(n)}).catch(function(t){e(null)})})},o=function(t){var n=new g.a;return new e(function(e,i){r.PDFGetSignsCount(t).then(function(t){n.type=f.EndUserSignContainerType.PAdES,e(n)}).catch(function(t){e(null)})})},s=function(t){var n=new g.a;return new e(function(e,i){r.ASiCGetASiCType(t).then(function(e){return n.type=f.EndUserSignContainerType.ASiC,n.subType=e,r.ASiCGetSignType(t)}).then(function(t){n.asicSignType=t,e(n)}).catch(function(t){e(null)})})};return new e(function(c,l){n.CheckInitialize().then(function(){return typeof t==`string`?r.BASE64Decode(t):t}).then(function(t){var n=[],r=function(e,t){if(e.length<t.length)return!1;for(var n=0;n<t.length;n++)if(e[n]!=t[n])return!1;return!0};return n=r(t,[60,63,120,109,108])?[a,i,o,s]:r(t,[37,80,68,70])?[o,i,a,s]:r(t,[80,75])?[s,i,a,o]:[i,a,o,s],new e(function(e,r){var i=function(a){a>=n.length?e(new g.a):n[a](t).then(function(t){t==null?i(a+1):e(t)}).catch(function(e){return r(e)})};i(0)})}).then(function(e){c(e)}).catch(function(e){return l(n.MapError(e))})})},t}()}).call(this,n(13).Promise)},function(e,t,n){"use strict";(function(e){var r=n(3);t.a=function(){function t(){this.EU_SUBJECT_TYPE_UNDIFFERENCED=0,this.EU_SUBJECT_TYPE_CA=1,this.EU_SUBJECT_TYPE_CA_SERVER=2,this.EU_SUBJECT_TYPE_RA_ADMINISTRATOR=3,this.EU_SUBJECT_TYPE_END_USER=4,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_UNDIFFERENCED=0,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_CMP=1,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_TSP=2,this.EU_SUBJECT_CA_SERVER_SUB_TYPE_OCSP=3,this.EU_CERT_KEY_TYPE_UNKNOWN=0,this.EU_CERT_KEY_TYPE_DSTU4145=1,this.EU_CERT_KEY_TYPE_RSA=2,this.EU_CERT_KEY_TYPE_ECDSA=4,this.EU_KEY_USAGE_UNKNOWN=0,this.EU_KEY_USAGE_DIGITAL_SIGNATURE=1,this.EU_KEY_USAGE_KEY_AGREEMENT=16,this.EU_KEYS_REQUEST_TYPE_UA_DS=1,this.EU_KEYS_REQUEST_TYPE_UA_KEP=2,this.EU_KEYS_REQUEST_TYPE_INTERNATIONAL=3,this.EU_KEYS_TYPE_NONE=0,this.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_GOSTS=1,this.EU_KEYS_TYPE_RSA_WITH_SHA=2,this.EU_KEYS_TYPE_ECDSA_WITH_SHA=4,this.EU_KEYS_TYPE_DSTU_AND_ECDH_WITH_DSTU=8,this.EU_KEYS_LENGTH_DS_UA_191=1,this.EU_KEYS_LENGTH_DS_UA_257=2,this.EU_KEYS_LENGTH_DS_UA_307=3,this.EU_KEYS_LENGTH_DS_UA_FILE=4,this.EU_KEYS_LENGTH_DS_UA_CERT=5,this.EU_KEYS_LENGTH_KEP_UA_257=1,this.EU_KEYS_LENGTH_KEP_UA_431=2,this.EU_KEYS_LENGTH_KEP_UA_571=3,this.EU_KEYS_LENGTH_KEP_UA_FILE=4,this.EU_KEYS_LENGTH_KEP_UA_CERT=5,this.EU_KEYS_LENGTH_DS_RSA_1024=1,this.EU_KEYS_LENGTH_DS_RSA_2048=2,this.EU_KEYS_LENGTH_DS_RSA_3072=3,this.EU_KEYS_LENGTH_DS_RSA_4096=4,this.EU_KEYS_LENGTH_DS_RSA_FILE=5,this.EU_KEYS_LENGTH_DS_RSA_CERT=6,this.EU_KEYS_LENGTH_DS_ECDSA_192=1,this.EU_KEYS_LENGTH_DS_ECDSA_256=2,this.EU_KEYS_LENGTH_DS_ECDSA_384=3,this.EU_KEYS_LENGTH_DS_ECDSA_521=4,this.EU_KEYS_LENGTH_DS_ECDSA_FILE=5,this.EU_KEYS_LENGTH_DS_ECDSA_CERT=6,this.EU_RECIPIENT_APPEND_ISSUER_AND_SERIAL=1,this.EU_RECIPIENT_APPEND_KEY_ID=2,this.EU_RECIPIENT_APPEND_KEY_ID_USC_COMPAT=3,this.EU_SAVE_SETTINGS_PARAMETER=`SaveSettings`,this.EU_RESOLVE_OIDS_PARAMETER=`ResolveOIDs`,this.EU_MAKE_PKEY_PFX_CONTAINER_PARAMETER=`MakePKeyPFXContainer`,this.EU_SIGN_INCLUDE_CONTENT_TIME_STAMP_PARAMETER=`SignIncludeContentTimeStamp`,this.EU_SIGN_TYPE_PARAMETER=`SignType`,this.EU_SIGN_INCLUDE_CA_CERTIFICATES_PARAMETER=`SignIncludeCACertificates`,this.EU_FS_CALCULATE_FINGERPRINT=`FSCalculateFingerprint`,this.EU_CHECK_CERT_CHAIN_ON_SIGN_TIME_PARAMETER=`CheckCertChainOnSignTime`,this.EU_CONNECTIONS_TIMEOUT_PARAMETER=`ConnectionsTimeout`,this.EU_LOG_EVENTS_THRESHOLD_PARAMETER=`LogEventsThreshold`,this.EU_USE_SLOGIN_PRIVATE_KEY=`UseSLoginPrivateKey`,this.EU_SETTINGS_ID_NONE=0,this.EU_SETTINGS_ID_MANDATORY=31,this.EU_SETTINGS_ID_ALL=4095,this.EU_SETTINGS_ID_FSTORE=1,this.EU_SETTINGS_ID_PROXY=2,this.EU_SETTINGS_ID_TSP=4,this.EU_SETTINGS_ID_OCSP=8,this.EU_SETTINGS_ID_LDAP=16,this.EU_SETTINGS_ID_MODE=32,this.EU_SETTINGS_ID_CMP=64,this.EU_SETTINGS_ID_KM=128,this.EU_SETTINGS_ID_OCSP_ACCESS_INFO_MODE=256,this.EU_SETTINGS_ID_OCSP_ACCESS_INFO=512,this.EU_SETTINGS_ID_TSL=1024,this.EU_SETTINGS_ID_LOG=2048,this.EU_HEADER_CA_TYPE=`UA1`,this.EU_HEADER_PART_TYPE_SIGNED=1,this.EU_HEADER_PART_TYPE_ENCRYPTED=2,this.EU_HEADER_PART_TYPE_STAMPED=3,this.EU_HEADER_PART_TYPE_CERTCRYPT=4,this.EU_HEADER_MAX_CA_TYPE_SIZE=3,this.EU_SIGNED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_SIGNED,this.EU_ENCRYPTED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_ENCRYPTED,this.EU_TIMESTAMPED_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_STAMPED,this.EU_CERTCRYPT_CRYPTO_HEADER=this.EU_HEADER_PART_TYPE_CERTCRYPT,this.EU_DEFAULT_LANG=0,this.EU_UA_LANG=1,this.EU_RU_LANG=2,this.EU_EN_LANG=3,this.EU_CONTENT_ENC_ALGO_TDES_CBC=4,this.EU_CONTENT_ENC_ALGO_AES_128_CBC=5,this.EU_CONTENT_ENC_ALGO_AES_192_CBC=6,this.EU_CONTENT_ENC_ALGO_AES_256_CBC=7,this.EU_DEV_CTX_MIN_PUBLIC_DATA_ID=16,this.EU_DEV_CTX_MAX_PRIVATE_DATA_ID=175,this.EU_UA_OID_EXT_KEY_USAGE_STAMP=`1.2.804.2.1.1.1.3.9`,this.EU_CCS_TYPE_REVOKE=1,this.EU_CCS_TYPE_HOLD=2,this.EU_REVOCATION_REASON_UNKNOWN=0,this.EU_REVOCATION_REASON_KEY_COMPROMISE=1,this.EU_REVOCATION_REASON_NEW_ISSURED=2,this.EU_SIGN_TYPE_UNKNOWN=0,this.EU_SIGN_TYPE_CADES_BES=1,this.EU_SIGN_TYPE_CADES_T=4,this.EU_SIGN_TYPE_CADES_C=8,this.EU_SIGN_TYPE_CADES_X_LONG=16,this.EU_CHECK_PRIVATE_KEY_CONTEXT_PARAMETER=`CheckPrivateKey`,this.EU_RESOLVE_OIDS_CONTEXT_PARAMETER=`ResolveOIDs`,this.EU_EXPORATABLE_CONTEXT_CONTEXT_PARAMETER=`ExportableContext`,this.EU_ENCODE_ECDSA_SIGN_VALUE_CONTEXT_PARAMETER=`EncodeECDSASignValue`,this.EU_USE_SLOGIN_PRIVATE_KEY_CONTEXT_PARAMETER=`UseSLoginPrivateKey`,this.EU_RECIPIENT_APPEND_TYPE_BY_ISSUER_SERIAL=1,this.EU_RECIPIENT_APPEND_TYPE_BY_KEY_ID=2,this.EU_CTX_HASH_ALGO_UNKNOWN=0,this.EU_CTX_HASH_ALGO_GOST34311=1,this.EU_CTX_HASH_ALGO_SHA160=2,this.EU_CTX_HASH_ALGO_SHA224=3,this.EU_CTX_HASH_ALGO_SHA256=4,this.EU_CTX_HASH_ALGO_SHA384=5,this.EU_CTX_HASH_ALGO_SHA512=6,this.EU_CTX_HASH_ALGO_DSTU7564_256=7,this.EU_CTX_HASH_ALGO_DSTU7564_384=8,this.EU_CTX_HASH_ALGO_DSTU7564_512=9,this.EU_CTX_SIGN_UNKNOWN=0,this.EU_CTX_SIGN_DSTU4145_WITH_GOST34311=1,this.EU_CTX_SIGN_RSA_WITH_SHA=2,this.EU_CTX_SIGN_ECDSA_WITH_SHA=3,this.EU_CTX_SIGN_DSTU4145_WITH_DSTU7564=4,this.EU_FILE_PROCESS_CHUNK_SIZE=1048576,this.EU_ASIC_TYPE_UNKNOWN=0,this.EU_ASIC_TYPE_S=1,this.EU_ASIC_TYPE_E=2,this.EU_ASIC_SIGN_TYPE_UNKNOWN=0,this.EU_ASIC_SIGN_TYPE_CADES=1,this.EU_ASIC_SIGN_TYPE_XADES=2,this.EU_ASIC_SIGN_LEVEL_BES=1,this.CtxCreateEmptySign=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.CtxCreateEmptySign(t,n,r,i,e,o)})},this.EnvelopToRecipientsEx=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.EnvelopToRecipientsEx(t,n,r,i,e,o)})},this.EnvelopToRecipientsWithDynamicKey=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.EnvelopToRecipientsWithDynamicKey(t,n,r,i,e,o)})},this.EnvelopToRecipientsWithSettings=function(t,n,r,i,a,o,s){var c=this.m_library;return new e(function(e,l){c.EnvelopToRecipientsWithSettings(t,n,r,i,a,o,s,e,l)})},this.CtxEnvelop=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxEnvelop(t,n,r,i,a,o,e,c)})},this.CtxEnvelopWithDynamicKey=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxEnvelopWithDynamicKey(t,n,r,i,a,o,e,c)})},this.DevelopEx=function(t,n){n===void 0&&(n=null);var r=this.m_library;return new e(function(e,i){r.DevelopEx(t,n,e,i)})},this.CtxDevelop=function(t,n,r){r===void 0&&(r=null);var i=this.m_library;return new e(function(e,a){i.CtxDevelop(t,n,r,e,a)})},this.CtxCreateAuthData=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxCreateAuthData(t,n,r,e,a)})},this.ProtectDataByPassword=function(t,n){var r=this.m_library;return new e(function(e,i){r.ProtectDataByPassword(t,n,e,i)})},this.UnprotectDataByPassword=function(t,n){var r=this.m_library;return new e(function(e,i){r.UnprotectDataByPassword(t,n,e,i)})},this.ClientDynamicKeySessionCreate=function(t,n){var r=this.m_library;return new e(function(e,i){r.ClientDynamicKeySessionCreate(t,n,e,i)})},this.SessionClose=function(t){var n=this.m_library;return new e(function(e,r){n.SessionClose(t,e,r)})},this.SessionEncrypt=function(t,n){var r=this.m_library;return new e(function(e,i){r.SessionEncrypt(t,n,e,i)})},this.SessionDecrypt=function(t,n){var r=this.m_library;return new e(function(e,i){r.SessionDecrypt(t,n,e,i)})},this.AppendTransportHeader=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.AppendTransportHeader(t,n,r,i,a,e,s)})},this.ParseTransportHeader=function(t){var n=this.m_library;return new e(function(e,r){n.ParseTransportHeader(t,e,r)})},this.AppendCryptoHeader=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.AppendCryptoHeader(t,n,r,e,a)})},this.ParseCryptoHeader=function(t){var n=this.m_library;return new e(function(e,r){n.ParseCryptoHeader(t,e,r)})},this.GetHostInfo=function(){var t=this.m_library;return new e(function(e,n){t.GetHostInfo(e,n)})},this.CtxCreate=function(){var t=this.m_library;return new e(function(e,n){t.CtxCreate(e,n)})},this.CtxFree=function(t){var n=this.m_library;return new e(function(e,r){n.CtxFree(t,e,r)})},this.CtxSetParameter=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxSetParameter(t,n,r,e,a)})},this.ASiCGetASiCType=function(t){var n=this.m_library;return new e(function(e,r){n.ASiCGetASiCType(t,e,r)})},this.ASiCGetSignType=function(t){var n=this.m_library;return new e(function(e,r){n.ASiCGetSignType(t,e,r)})},this.ASiCGetSignsCount=function(t){var n=this.m_library;return new e(function(e,r){n.ASiCGetSignsCount(t,e,r)})},this.ASiCGetSignerInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.ASiCGetSignerInfo(t,n,e,i)})},this.ASiCGetSignTimeInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.ASiCGetSignTimeInfo(t,n,e,i)})},this.CtxASiCSign=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxASiCSign(t,n,r,i,a,o,e,c)})},this.CtxASiCAppendSign=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxASiCAppendSign(t,n,r,i,a,e,s)})},this.ASiCVerify=function(t,n){var r=this.m_library;return new e(function(e,i){r.ASiCVerify(t,n,e,i)})},this.CtxASiCGetSignerInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxASiCGetSignerInfo(t,n,r,e,a)})},this.ASiCGetSignLevel=function(t,n){var r=this.m_library;return new e(function(e,i){r.ASiCGetSignLevel(t,n,e,i)})},this.PDFGetSignType=function(t,n){var r=this.m_library;return new e(function(e,i){r.PDFGetSignType(t,n,e,i)})},this.PDFGetSignsCount=function(t){var n=this.m_library;return new e(function(e,r){n.PDFGetSignsCount(t,e,r)})},this.PDFGetSignerInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.PDFGetSignerInfo(t,n,e,i)})},this.PDFGetSignTimeInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.PDFGetSignTimeInfo(t,n,e,i)})},this.CtxPDFSign=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.CtxPDFSign(t,n,r,i,e,o)})},this.PDFVerify=function(t,n){var r=this.m_library;return new e(function(e,i){r.PDFVerify(t,n,e,i)})},this.CtxPDFGetSignerInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxPDFGetSignerInfo(t,n,r,e,a)})},this.XAdESGetType=function(t){var n=this.m_library;return new e(function(e,r){n.XAdESGetType(t,e,r)})},this.XAdESGetSignsCount=function(t){var n=this.m_library;return new e(function(e,r){n.XAdESGetSignsCount(t,e,r)})},this.XAdESGetSignLevel=function(t,n){var r=this.m_library;return new e(function(e,i){r.XAdESGetSignLevel(t,n,e,i)})},this.XAdESGetSignerInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.XAdESGetSignerInfo(t,n,e,i)})},this.XAdESGetSignTimeInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.XAdESGetSignTimeInfo(t,n,e,i)})},this.CtxXAdESSign=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxXAdESSign(t,n,r,i,a,e,s)})},this.XAdESVerify=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.XAdESVerify(t,n,r,e,a)})},this.CtxXAdESGetSignerInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxXAdESGetSignerInfo(t,n,r,e,a)})},this.SServerClientGeneratePrivateKeyAsync=function(t,n,r,i,a,o,s,c,l,u,d){var f=this.m_library;return new e(function(e,p){f.SServerClientGeneratePrivateKeyAsync(t,n,r,i,a,o,s,c,l,u,d,e,p)})},this.SServerClientCheckGeneratePrivateKeyStatus=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.SServerClientCheckGeneratePrivateKeyStatus(t,n,r,i,e,o)})},this.SServerClientSignHashAsync=function(t,n,r,i,a,o,s){var c=this.m_library;return new e(function(e,l){c.SServerClientSignHashAsync(t,n,r,i,a,o,s,e,l)})},this.SServerClientCheckSignHashStatus=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.SServerClientCheckSignHashStatus(t,n,r,i,e,o)})},this.SServerClientSignHashesAsync=function(t,n,r,i,a,o,s,c){var l=this.m_library;return new e(function(e,u){l.SServerClientSignHashesAsync(t,n,r,i,a,o,s,c,e,u)})},this.SServerClientCheckSignHashesStatus=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.SServerClientCheckSignHashesStatus(t,n,r,i,e,o)})},this.m_language=0,this.m_library=null}return t.prototype.MakeURL=function(e){var t=location.origin,n=location.pathname;return e.indexOf(`http://`)==0||e.indexOf(`https://`)==0?e:e.indexOf(`/`)==0&&t?t+e:t&&n?t+n.substr(0,n.lastIndexOf(`/`))+`/`+e:e},t.prototype.MakeError=function(e,t){return this.m_library.MakeError(e,t)},t.prototype.IsLibraryLoadError=function(e){return e==r.EndUserError.ERROR_LIBRARY_COMUNICATION_FAILED},t.prototype.IsLibraryVersionNotSupportedError=function(e){return e==r.EndUserError.ERROR_LIBRARY_VERSION_NOT_SUPPORTED},t.prototype.Load=function(){var t=this;return new e(function(e,n){if(t.m_library==null){var i=new r.EndUserLibraryLoader(r.EndUserLibraryLoader.LIBRARY_TYPE_DEFAULT,`euSign`,t.m_language,!0,!0);i.onload=function(n){t.m_library=n,e()},i.onerror=function(e,t,i){i??=new r.EUSignCP(``,``),n(i.MakeError(t,``))},i.load()}else e()})},t.prototype.IsSupported=function(){return r.EndUserLibraryLoader.isWebExtensionSupported()||r.EndUserLibraryLoader.isSignAgentSupported()||r.EndUserLibraryLoader.isNPAPISupported()||r.EndUserLibraryLoader.isActiveXSupported()},t.prototype.IsSignAgentSupported=function(){return r.EndUserLibraryLoader.isSignAgentSupported()},t.prototype.IsWebExtensionSupported=function(){return r.EndUserLibraryLoader.isWebExtensionSupported()},t.prototype.IsNPAPISupported=function(){return r.EndUserLibraryLoader.isNPAPISupported()},t.prototype.IsActiveXSupported=function(){return r.EndUserLibraryLoader.isActiveXSupported()},t.prototype.IsWebExtensionInstalled=function(){return r.EndUserLibraryLoader.isWebExtensionInstalled()},t.prototype.GetInstallURL=function(e,t){return e===void 0&&(e=!1),new r.EUSignCP(``,``).GetInstallURL(e,t)},t.prototype.GetUpdateURL=function(e,t){return e===void 0&&(e=!1),new r.EUSignCP(``,``).GetUpdateURL(e,t)},t.prototype.GetHelpURL=function(e){return new r.EUSignCP(``,``).GetHelpURL(e)},t.prototype.GetWebExtensionInstallURL=function(){return new r.EUSignCP(``,``).GetWebExtensionInstallURL()},t.prototype.GetVersion=function(){var t=this.m_library;return new e(function(e,n){t.GetVersion(e,n)})},t.prototype.IsInitialized=function(){var t=this.m_library;return new e(function(e,n){t.IsInitialized(e,n)})},t.prototype.Initialize=function(){var t=this.m_library;return new e(function(e,n){t.Initialize(e,n)})},t.prototype.Finalize=function(){var t=this.m_library;return new e(function(e,n){t.Finalize(e,n)})},t.prototype.ResetOperation=function(){var t=this.m_library;return new e(function(e,n){t.ResetOperation(e,n)})},t.prototype.SetUIMode=function(t){var n=this.m_library;return new e(function(e,r){n.SetUIMode(t,e,r)})},t.prototype.SetLanguage=function(t){var n=this.m_library;if(typeof t==`string`)switch(t=t.toLocaleLowerCase()){case`en`:t=this.EU_EN_LANG;break;case`ru`:t=this.EU_RU_LANG;break;case`uk`:case`ua`:default:t=this.EU_UA_LANG}return this.m_language=t,new e(function(e,r){n.SetLanguage(t,e,r)})},t.prototype.SetCharset=function(t){var n=this.m_library;return new e(function(e,r){n.SetCharset(t,e,r)})},t.prototype.SetRuntimeParameter=function(t,n){var r=this.m_library;return new e(function(e,i){r.SetRuntimeParameter(t,n,e,i)})},t.prototype.GetStorageParameter=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetStorageParameter(t,n,e,i)})},t.prototype.SetStorageParameter=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.SetStorageParameter(t,n,r,e,a)})},t.prototype.BASE64Encode=function(t){var n=this.m_library;return new e(function(e,r){n.BASE64Encode(t,e,r)})},t.prototype.BASE64Decode=function(t){var n=this.m_library;return new e(function(e,r){n.BASE64Decode(t,e,r)})},t.prototype.StringToBytes=function(t){var n=this.m_library;return new e(function(e,r){n.StringToBytes(t,e,r)})},t.prototype.BytesToString=function(t){var n=this.m_library;return new e(function(e,r){n.BytesToString(t,e,r)})},t.prototype.DoesNeedSetSettings=function(){var t=this.m_library;return new e(function(e,n){t.DoesNeedSetSettings(e,n)})},t.prototype.InitializeMandatorySettings=function(){var t=this.m_library;return new e(function(e,n){t.InitializeMandatorySettings(e,n)})},t.prototype.CreateModeSettings=function(){return this.m_library.CreateModeSettings()},t.prototype.GetModeSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetModeSettings(e,n)})},t.prototype.SetModeSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetModeSettings(t,e,r)})},t.prototype.CreateKeyMediaSettings=function(){return this.m_library.CreateKeyMediaSettings()},t.prototype.GetKeyMediaSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetKeyMediaSettings(e,n)})},t.prototype.SetKeyMediaSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetKeyMediaSettings(t,e,r)})},t.prototype.CreateFileStoreSettings=function(){return this.m_library.CreateFileStoreSettings()},t.prototype.GetFileStoreSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetFileStoreSettings(e,n)})},t.prototype.SetFileStoreSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetFileStoreSettings(t,e,r)})},t.prototype.CreateProxySettings=function(){return this.m_library.CreateProxySettings()},t.prototype.GetProxySettings=function(){var t=this.m_library;return new e(function(e,n){t.GetProxySettings(e,n)})},t.prototype.SetProxySettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetProxySettings(t,e,r)})},t.prototype.CreateOCSPSettings=function(){return this.m_library.CreateOCSPSettings()},t.prototype.GetOCSPSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetOCSPSettings(e,n)})},t.prototype.SetOCSPSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetOCSPSettings(t,e,r)})},t.prototype.CreateOCSPAccessInfoModeSettings=function(){return this.m_library.CreateOCSPAccessInfoModeSettings()},t.prototype.GetOCSPAccessInfoModeSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetOCSPAccessInfoModeSettings(e,n)})},t.prototype.SetOCSPAccessInfoModeSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetOCSPAccessInfoModeSettings(t,e,r)})},t.prototype.CreateOCSPAccessInfoSettings=function(){return this.m_library.CreateOCSPAccessInfoSettings()},t.prototype.EnumOCSPAccessInfoSettings=function(t){var n=this.m_library;return new e(function(e,r){n.EnumOCSPAccessInfoSettings(t,e,r)})},t.prototype.GetOCSPAccessInfoSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetOCSPAccessInfoSettings(e,n)})},t.prototype.SetOCSPAccessInfoSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetOCSPAccessInfoSettings(t,e,r)})},t.prototype.DeleteOCSPAccessInfoSettings=function(t){var n=this.m_library;return new e(function(e,r){n.DeleteOCSPAccessInfoSettings(t,e,r)})},t.prototype.CreateTSPSettings=function(){return this.m_library.CreateTSPSettings()},t.prototype.GetTSPSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetTSPSettings(e,n)})},t.prototype.SetTSPSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetTSPSettings(t,e,r)})},t.prototype.CreateLDAPSettings=function(){return this.m_library.CreateLDAPSettings()},t.prototype.GetLDAPSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetLDAPSettings(e,n)})},t.prototype.SetLDAPSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetLDAPSettings(t,e,r)})},t.prototype.CreateCMPSettings=function(){return this.m_library.CreateCMPSettings()},t.prototype.GetCMPSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetCMPSettings(e,n)})},t.prototype.SetCMPSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetCMPSettings(t,e,r)})},t.prototype.GetSystemProxySettings=function(){var t=this.m_library;return new e(function(e,n){t.GetSystemProxySettings(e,n)})},t.prototype.CreateTSLSettings=function(){return this.m_library.CreateTSLSettings()},t.prototype.GetTSLSettings=function(){var t=this.m_library;return new e(function(e,n){t.GetTSLSettings(e,n)})},t.prototype.SetTSLSettings=function(t){var n=this.m_library;return new e(function(e,r){n.SetTSLSettings(t,e,r)})},t.prototype.SetOCSPResponseExpireTime=function(t){var n=this.m_library;return new e(function(e,r){n.SetOCSPResponseExpireTime(t,e,r)})},t.prototype.GetCertificate=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetCertificate(t,n,e,i)})},t.prototype.ParseCertificateEx=function(t){var n=this.m_library;return new e(function(e,r){n.ParseCertificateEx(t,e,r)})},t.prototype.SaveCertificate=function(t){var n=this.m_library;return new e(function(e,r){n.SaveCertificate(t,e,r)})},t.prototype.SaveCertificates=function(t){var n=this.m_library;return new e(function(e,r){n.SaveCertificates(t,e,r)})},t.prototype.GetTSPByAccessInfo=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.GetTSPByAccessInfo(t,n,r,i,e,o)})},t.prototype.CheckTSP=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CheckTSP(t,n,r,e,a)})},t.prototype.DownloadData=function(t,n){var i=this;return new e(function(e,a){try{var o=new XMLHttpRequest;o.onload=function(){if(o.readyState==4){var s=null;try{if(o.status!=200)throw`Download data error. URL - `+t+`, status - `+o.status;switch(n){case`binary`:s=new Uint8Array(o.response);break;case`json`:s=JSON.parse(o.responseText.replace(/\\'/g,`'`));break;default:s=o.responseText}}catch(e){console.log(`EndUser.DowloadData error: `+e),a(i.MakeError(r.EndUserError.ERROR_DOWNLOAD_FILE,``));return}e(s)}},o.onerror=function(){a(i.MakeError(r.EndUserError.ERROR_DOWNLOAD_FILE,``))},t=i.MakeURL(t),o.open(`GET`,t,!0),n==`binary`&&(o.responseType=`arraybuffer`),o.send()}catch{a(i.MakeError(r.EndUserError.ERROR_DOWNLOAD_FILE,``))}})},t.prototype.CreateKeyMedia=function(){return this.m_library.CreateKeyMedia()},t.prototype.GetPrivateKeyMedia=function(t){var n=this.m_library;return new e(function(e,r){n.GetPrivateKeyMedia(t,e,r)})},t.prototype.EnumKeyMediaTypes=function(t){var n=this.m_library;return new e(function(e,r){n.EnumKeyMediaTypes(t,e,r)})},t.prototype.EnumKeyMediaDevices=function(t,n){var r=this.m_library;return new e(function(e,i){r.EnumKeyMediaDevices(t,n,e,i)})},t.prototype.GetKeyMediaTypes=function(){var t=this.m_library;return new e(function(e,n){t.GetKeyMediaTypes(e,n)})},t.prototype.GetKeyMediaDevices=function(t){var n=this.m_library;return new e(function(e,r){n.GetKeyMediaDevices(t,e,r)})},t.prototype.IsPrivateKeyReaded=function(){var t=this.m_library;return new e(function(e,n){t.IsPrivateKeyReaded(e,n)})},t.prototype.ReadPrivateKey=function(){var t=this.m_library;return new e(function(e,n){t.ReadPrivateKey(e,n)})},t.prototype.ReadPrivateKeySilently=function(t,n,r){var i=this.m_library;return new e(function(e,a){typeof t==`number`?i.ReadPrivateKeySilently(t,n,r,e,a):i.ReadPrivateKeySilently(t,e,a)})},t.prototype.ReadPrivateKeyBinary=function(t,n){var r=this.m_library;return new e(function(e,i){r.ReadPrivateKeyBinary(t,n,e,i)})},t.prototype.ReadPrivateKeyFile=function(t,n){var r=this.m_library;return new e(function(e,i){r.ReadPrivateKeyFile(t,n,e,i)})},t.prototype.ResetPrivateKey=function(){var t=this.m_library;return new e(function(e,n){t.ResetPrivateKey(e,n)})},t.prototype.CtxReadPrivateKey=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){typeof n==`number`?a.CtxReadPrivateKey(t,n,r,i,e,o):a.CtxReadPrivateKey(t,n,e,o)})},t.prototype.CtxReadPrivateKeyBinary=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxReadPrivateKeyBinary(t,n,r,e,a)})},t.prototype.CtxFreePrivateKey=function(t){var n=this.m_library;return new e(function(e,r){n.CtxFreePrivateKey(t,e,r)})},t.prototype.ShowOwnCertificate=function(){var t=this.m_library;return new e(function(e,n){t.ShowOwnCertificate(e,n)})},t.prototype.GetOwnCertificate=function(t,n){var r=this.m_library;return new e(function(e,i){typeof t==`number`||typeof n==`number`?r.GetOwnCertificate(t,n,e,i):r.GetOwnCertificate(e,i)})},t.prototype.GetOwnEUserParams=function(){var t=this.m_library;return new e(function(e,n){t.GetOwnEUserParams(e,n)})},t.prototype.CtxGetOwnEUserParams=function(t){var n=this.m_library;return new e(function(e,r){n.CtxGetOwnEUserParams(t,e,r)})},t.prototype.ModifyOwnEUserParams=function(t,n){var r=this.m_library;return new e(function(e,i){r.ModifyOwnEUserParams(t,n,e,i)})},t.prototype.CtxModifyOwnEUserParams=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxModifyOwnEUserParams(t,n,r,e,a)})},t.prototype.EnumOwnCertificates=function(t){var n=this.m_library;return new e(function(e,r){n.EnumOwnCertificates(t,e,r)})},t.prototype.GetPrivateKeyOwnerInfo=function(){var t=this.m_library;return new e(function(e,n){t.GetPrivateKeyOwnerInfo(e,n)})},t.prototype.CtxEnumOwnCertificates=function(t,n){var r=this.m_library;return new e(function(e,i){r.CtxEnumOwnCertificates(t,n,e,i)})},t.prototype.CtxGetOwnCertificate=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxGetOwnCertificate(t,n,r,e,a)})},t.prototype.GetKeyInfo=function(t){var n=this.m_library;return new e(function(e,r){n.GetKeyInfo(t,e,r)})},t.prototype.GetKeyInfoBinary=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetKeyInfoBinary(t,n,e,i)})},t.prototype.GetKeyInfoFile=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetKeyInfoFile(t,n,e,i)})},t.prototype.GetCertificatesByKeyInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.GetCertificatesByKeyInfo(t,n,r,e,a)})},t.prototype.EnumJKSPrivateKeys=function(t,n){var r=this.m_library;return new e(function(e,i){r.EnumJKSPrivateKeys(t,n,e,i)})},t.prototype.GetJKSPrivateKey=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetJKSPrivateKey(t,n,e,i)})},t.prototype.CreatePrivateKeyInfo=function(){return this.m_library.CreatePrivateKeyInfo()},t.prototype.CreateEndUserInfo=function(){return this.m_library.CreateEndUserInfo()},t.prototype.GeneratePrivateKeyEx=function(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_){var v=this.m_library;return new e(function(e,y){v.GeneratePrivateKeyEx(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,e,y)})},t.prototype.ChangePrivateKeyPassword=function(t,n){var r=this.m_library;return new e(function(e,i){t==null?r.ChangePrivateKeyPassword(e,i):r.ChangePrivateKeyPassword(t.GetTypeIndex(),t.GetDevIndex(),t.GetPassword(),n,e,i)})},t.prototype.ChangeSoftwarePrivateKeyPassword=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.ChangeSoftwarePrivateKeyPassword(t,n,r,e,a)})},t.prototype.SetKeyMediaUserPassword=function(t,n){var r=this.m_library;return new e(function(e,i){n==null?r.SetKeyMediaUserPassword(t,e,i):r.SetKeyMediaUserPassword(t,n.GetTypeIndex(),n.GetDevIndex(),n.GetPassword(),e,i)})},t.prototype.ChangeOwnCertificatesStatus=function(t,n){var r=this.m_library;return new e(function(e,i){r.ChangeOwnCertificatesStatus(t,n,e,i)})},t.prototype.CtxChangeOwnCertificatesStatus=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxChangeOwnCertificatesStatus(t,n,r,e,a)})},t.prototype.MakeNewCertificate=function(t,n,r,i,a,o,s,c,l,u,d,f,p){var m=this.m_library;return new e(function(e,h){m.MakeNewCertificate(t,n,r,i,a,o,s,c,l,u,d,f,p,e,h)})},t.prototype.MakeNewCertificateEx=function(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){var g=this.m_library;return new e(function(e,_){g.MakeNewCertificateEx(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,e,_)})},t.prototype.MakeNewOwnCertificate=function(t,n,r,i,a,o,s,c){var l=this.m_library;return new e(function(e,u){l.MakeNewOwnCertificate(t,n,r,i,a,o,s,c,e,u)})},t.prototype.CtxMakeNewOwnCertificate=function(t,n,r,i,a,o,s,c,l){var u=this.m_library;return new e(function(e,d){u.CtxMakeNewOwnCertificate(t,n,r,i,a,o,s,c,l,e,d)})},t.prototype.CtxMakeNewOwnCertificateEx=function(t,n,r,i,a,o,s,c,l,u,d){var f=this.m_library;return new e(function(e,p){f.CtxMakeNewOwnCertificateEx(t,n,r,i,a,o,s,c,l,u,d,e,p)})},t.prototype.CtxMakeNewOwnCertificateWithCR=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxMakeNewOwnCertificateWithCR(t,n,r,i,a,e,s)})},t.prototype.CtxMakeDeviceCertificate=function(t,n,r,i,a,o,s,c){var l=this.m_library;return new e(function(e,u){l.CtxMakeDeviceCertificate(t,n,r,i,a,o,s,c,e,u)})},t.prototype.CtxHash=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.CtxHash(t,n,r,i,e,o)})},t.prototype.CtxHashBegin=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxHashBegin(t,n,r,e,a)})},t.prototype.CtxHashContinue=function(t,n){var r=this.m_library;return new e(function(e,i){r.CtxHashContinue(t,n,e,i)})},t.prototype.CtxHashEnd=function(t){var n=this.m_library;return new e(function(e,r){n.CtxHashEnd(t,e,r)})},t.prototype.CtxHashFree=function(t){var n=this.m_library;return new e(function(e,r){n.CtxHashFree(t,e,r)})},t.prototype.GetSignType=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetSignType(t,n,e,i)})},t.prototype.GetSigner=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetSigner(t,n,e,i)})},t.prototype.CtxGetSignerInfo=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxGetSignerInfo(t,n,r,e,a)})},t.prototype.SignHash=function(t){var n=this.m_library;return new e(function(e,r){n.SignHash(t,e,r)})},t.prototype.Sign=function(t){var n=this.m_library;return new e(function(e,r){n.Sign(t,e,r)})},t.prototype.SignInternal=function(t,n){var r=this.m_library;return new e(function(e,i){r.SignInternal(t,n,e,i)})},t.prototype.SignHashRSA=function(t){var n=this.m_library;return new e(function(e,r){n.SignHashRSA(t,e,r)})},t.prototype.SignRSA=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.SignRSA(t,n,r,e,a)})},t.prototype.CtxSignHash=function(t,n,r,i){var a=this.m_library;return new e(function(e,o){a.CtxSignHash(t,n,r,i,e,o)})},t.prototype.CtxSign=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxSign(t,n,r,i,a,e,s)})},t.prototype.CtxSignFile=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxSignFile(t,n,r,i,a,o,e,c)})},t.prototype.CtxGetSignValue=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.CtxGetSignValue(t,n,r,e,a)})},t.prototype.AppendSignHash=function(t,n){var r=this.m_library;return new e(function(e,i){r.AppendSignHash(t,n,e,i)})},t.prototype.AppendSign=function(t,n){var r=this.m_library;return new e(function(e,i){r.AppendSign(t,n,e,i)})},t.prototype.AppendSignInternal=function(t,n){var r=this.m_library;return new e(function(e,i){r.AppendSignInternal(t,n,e,i)})},t.prototype.CtxAppendSignHash=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxAppendSignHash(t,n,r,i,a,e,s)})},t.prototype.CtxAppendSign=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.CtxAppendSign(t,n,r,i,a,e,s)})},t.prototype.CtxAppendSignFile=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.CtxAppendSignFile(t,n,r,i,a,o,e,c)})},t.prototype.AppendSigner=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.AppendSigner(t,n,r,e,a)})},t.prototype.AppendValidationDataToSignerEx=function(t,n,r){var i=this.m_library;return new e(function(e,a){i.AppendValidationDataToSignerEx(t,n,r,e,a)})},t.prototype.IsDataInSignedDataAvailable=function(t){var n=this.m_library;return new e(function(e,r){n.IsDataInSignedDataAvailable(t,e,r)})},t.prototype.GetDataFromSignedData=function(t){var n=this.m_library;return new e(function(e,r){n.GetDataFromSignedData(t,e,r)})},t.prototype.GetCertificateFromSignedData=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetCertificateFromSignedData(t,n,e,i)})},t.prototype.GetSignsCount=function(t){var n=this.m_library;return new e(function(e,r){n.GetSignsCount(t,e,r)})},t.prototype.GetSignTimeInfo=function(t,n){var r=this.m_library;return new e(function(e,i){r.GetSignTimeInfo(t,n,e,i)})},t.prototype.VerifyHashOnTimeEx=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.VerifyHashOnTimeEx(t,n,r,i,a,o,e,c)})},t.prototype.VerifyDataOnTimeEx=function(t,n,r,i,a,o){var s=this.m_library;return new e(function(e,c){s.VerifyDataOnTimeEx(t,n,r,i,a,o,e,c)})},t.prototype.VerifyDataInternalOnTimeEx=function(t,n,r,i,a){var o=this.m_library;return new e(function(e,s){o.VerifyDataInternalOnTimeEx(t,n,r,i,a,e,s)})},t.prototype.CreateEndUserSession=function(){return this.m_library.CreateEndUserSession()},t.prototype.CreateReference=function(e,t){return this.m_library.CreateReference(e,t)},t}()}).call(this,n(13).Promise)},function(e,t,n){"use strict";n.d(t,`a`,function(){return r});var r=function(){}},function(e,t){var n,r,i=e.exports={};function a(){throw Error(`setTimeout has not been defined`)}function o(){throw Error(`clearTimeout has not been defined`)}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch{try{return n.call(null,e,0)}catch{return n.call(this,e,0)}}}(function(){try{n=typeof setTimeout==`function`?setTimeout:a}catch{n=a}try{r=typeof clearTimeout==`function`?clearTimeout:o}catch{r=o}})();var c,l=[],u=!1,d=-1;function f(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&p())}function p(){if(!u){var e=s(f);u=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch{try{return r.call(null,e)}catch{return r.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function h(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new m(e,t)),l.length!==1||u||s(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title=`browser`,i.browser=!0,i.env={},i.argv=[],i.version=``,i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(e){return[]},i.binding=function(e){throw Error(`process.binding is not supported`)},i.cwd=function(){return`/`},i.chdir=function(e){throw Error(`process.chdir is not supported`)},i.umask=function(){return 0}},function(e,t){var n=function(){return this}();try{n||=Function(`return this`)()}catch{typeof window==`object`&&(n=window)}e.exports=n},function(e,t){}])})})),f=c({EndUserBase64Coder:()=>M,EndUserUTF16LECoder:()=>P,EndUserUTF8Coder:()=>N,IS_DSTU_7564_DAY:()=>A,arrayToBase64:()=>v,arrayToString:()=>x,base64ToArray:()=>y,convertFromBase64:()=>C,convertToBase64:()=>S,dateWithoutTimezone:()=>j,downloadAndSignFiles:()=>O,downloadData:()=>m,format:()=>g,getFileNameFromUrl:()=>D,getSupportedSignAlgos:()=>T,isDefaultValue:()=>k,isUrlValid:()=>E,makeUrl:()=>h,readFile:()=>_,signAlgoToHashAlgo:()=>w,stringToArray:()=>b}),p=u(d());function m(e,t,n,r){return new Promise((i,a)=>{e=h(e);let o=new XMLHttpRequest;if(o.onerror=function(t){console.error(t),a(`Download data error. URL - `+e+`, status - `+o.status)},o.onload=function(){if(o.readyState!=XMLHttpRequest.DONE)return;if(o.status!=200){a(`Download data error. URL - `+e+`, status - `+o.status);return}let n;switch(t){case`binary`:i(new Uint8Array(o.response));break;case`json`:i(JSON.parse(o.responseText.replace(/\\'/g,`'`)));break;case`xml`:i(o.responseXML);break;case`blob`:try{n=new Blob([o.responseText],{type:`application/javascript`})}catch{n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder),n.append(o.responseText),n=n.getBlob()}i(n);break;default:i(o.responseText)}},t===`binary`?o.responseType=`arraybuffer`:t==`xml`&&(o.responseType=`document`),o.open(r?`POST`:`GET`,e,!0),typeof n==`string`&&o.setRequestHeader(`Authorization`,`Bearer `+n),r){let e=JSON.stringify(r);o.setRequestHeader(`Content-Type`,`application/json`),o.send(e)}else o.send()})}function h(e){let t=location.origin,n=location.pathname;return e.indexOf(`http://`)===0||e.indexOf(`https://`)===0?e:e.indexOf(`/`)===0&&t?t+e:t&&n?t+n.substring(0,n.lastIndexOf(`/`))+`/`+e:e}function g(e){let t=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,n){return t[n]===void 0?e:t[n]})}function _(e){return new Promise((t,n)=>{let r=new FileReader;r.onloadend=function(){this.readyState==this.DONE?t(new Uint8Array(this.result)):n(this.error)},r.readAsArrayBuffer(e)})}function v(e){return typeof e.toBase64==`function`?e.toBase64():new M().encode(e)}function y(e){return typeof Uint8Array.fromBase64==`function`?Uint8Array.fromBase64(e):new M().decode(e)}function b(e){return new Uint8Array(new P().encode(e))}function x(e){return new P().decode(e)}function S(e){return v(b(e))}function C(e){return x(y(e))}function w(e){switch(e){case p.EndUserConstants.EndUserSignAlgo.RSAWithSHA:case p.EndUserConstants.EndUserSignAlgo.ECDSAWithSHA:return p.EndUserConstants.EndUserHashAlgo.SHA256;case p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311:return p.EndUserConstants.EndUserHashAlgo.GOST34311;case p.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564:return p.EndUserConstants.EndUserHashAlgo.DSTU7564_256;default:return p.EndUserConstants.EndUserHashAlgo.Unknown}}function T(e,t=null){let n=[];return e.forEach(e=>{if((e.infoEx.keyUsageType&p.EndUserConstants.EndUserKeyUsage.DigitalSignature)===p.EndUserConstants.EndUserKeyUsage.DigitalSignature)switch(e.infoEx.publicKeyType){case p.EndUserConstants.EndUserCertKeyType.DSTU4145:(e.infoEx.certHashType===p.EndUserConstants.EU_CERT_HASH_TYPE_GOST34311||e.infoEx.certHashType===p.EndUserConstants.EU_CERT_HASH_TYPE_DSTU7564_256)&&t?.HashAlgorithm===`GOST34311`?n.push(p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311):n.push(p.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564);break;case p.EndUserConstants.EndUserCertKeyType.RSA:n.push(p.EndUserConstants.EndUserSignAlgo.RSAWithSHA);break;case p.EndUserConstants.EndUserCertKeyType.ECDSA:n.push(p.EndUserConstants.EndUserSignAlgo.ECDSAWithSHA)}}),n}function E(e){try{return!!new URL(e)}catch{return!1}}function D(e){return e=new URL(e),e.searchParams.get(`file`)||e.searchParams.get(`name`)||e.pathname.split(`/`).pop()}async function O(e,t){let n=e=>typeof e==`string`&&E(e)||typeof e==`object`&&typeof e.name==`string`&&typeof e.val==`string`&&E(e.val);if(Array.isArray(e)){if(!e.every(n)||!(e.every(e=>typeof e==`string`)||e.every(e=>typeof e==`object`)))throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:`Bad parameter fileUrl`};let r=e.every(e=>typeof e==`object`);e=await Promise.all(e.map(async e=>typeof e==`object`?{name:e.name,val:await m(e.val,`binary`)}:{name:D(e),val:await m(e,`binary`)}));let i=await t(e);return r?i:i.map(e=>e.val||e)}{if(!n(e))throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:`Bad parameter fileUrl`};let r=typeof e==`object`;e=typeof e==`object`?{name:e.name,val:await m(e.val,`binary`)}:{name:D(e),val:await m(e,`binary`)};let i=await t(e);return r?i:i.val||i}}function k(e){return e===!1||e==null}var A=()=>Date.now()>=new Date(2026,6,1);function j(e){let t=e.getTimezoneOffset()*6e4;return new Date(e.valueOf()-t).toISOString().slice(0,-1)}var M=class{constructor(){this.m_map=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,this.m_codes=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47]}_getTextDecoder(){try{if(typeof TextDecoder>`u`)return null;let e=new TextDecoder(`utf-8`);return e.encoding==`utf-8`?e:null}catch{return null}}_encodePart(e,t,n){let r=[],i,a;for(let o=t;o<n;o+=3)i=e[o]<<16|e[o+1]<<8|e[o+2],a=this.m_map[i>>18&63]+this.m_map[i>>12&63]+this.m_map[i>>6&63]+this.m_map[i&63],r.push(a);return r.join(``)}encode(e){let t,n,r,i,a,o=``,s;if(t=typeof Uint8Array>`u`?typeof EndUserUint8Array>`u`?e.slice(0):new EndUserUint8Array(e):new Uint8Array(e),a=t.length,a==0)return``;let c=this._getTextDecoder();if(c!=null){for(s=new Uint8Array(parseInt((a+2)/3)*4),n=0,r=0;n<a-a%3;n+=3,r+=4)i=t[n]<<16|t[n+1]<<8|t[n+2],s[r]=this.m_codes[i>>18&63],s[r+1]=this.m_codes[i>>12&63],s[r+2]=this.m_codes[i>>6&63],s[r+3]=this.m_codes[i&63];switch(a%3){case 1:i=t[n]<<16,s[r]=this.m_codes[i>>18&63],s[r+1]=this.m_codes[i>>12&63],s[r+2]=61,s[r+3]=61;break;case 2:i=t[n]<<16|t[n+1]<<8,s[r]=this.m_codes[i>>18&63],s[r+1]=this.m_codes[i>>12&63],s[r+2]=this.m_codes[i>>6&63],s[r+3]=61}o=c.decode(s)}else{let e=null,r=15360,c=a-a%3,l=parseInt(c/r),u;for(s=[],n=0;n<l;n++)e=this._encodePart(t,n*r,n*r+r),s.push(e);switch(l*r<c&&(e=this._encodePart(t,n*r,c),s.push(e)),a%3){case 1:i=t[a-1]<<16,u=this.m_map[i>>18&63],u+=this.m_map[i>>12&63],u+=`=`,u+=`=`,s.push(u);break;case 2:i=t[a-2]<<16|t[a-1]<<8,u=this.m_map[i>>18&63],u+=this.m_map[i>>12&63],u+=this.m_map[i>>6&63],u+=`=`,s.push(u)}o=s.join(``)}return o}decode(e){let t,n,r,i,a,o,s,c,l,u,d;if(e==``||(e.length&3)>0)return typeof Uint8Array>`u`?typeof EndUserUint8Array>`u`?[]:new EndUserUint8Array(0):new Uint8Array;for(o=e.length,s=e[o-1]==`=`?e[o-2]==`=`?2:1:0,n=o/4*3-s,t=typeof Uint8Array>`u`?typeof EndUserUint8Array>`u`?[]:new EndUserUint8Array(n):new Uint8Array(n),r=0,i=0,a=0;r<Math.floor((o-s)/4);r++)c=this.m_map.indexOf(e[i++]),l=this.m_map.indexOf(e[i++]),u=this.m_map.indexOf(e[i++]),d=this.m_map.indexOf(e[i++]),t[a++]=c<<2|l>>4,t[a++]=(l&15)<<4|u>>2,t[a++]=(u&3)<<6|d&63;switch(s){case 2:c=this.m_map.indexOf(e[i]),l=this.m_map.indexOf(e[i+1]),t[a++]=c<<2|l>>4;break;case 1:c=this.m_map.indexOf(e[i]),l=this.m_map.indexOf(e[i+1]),u=this.m_map.indexOf(e[i+2]),t[a++]=c<<2|l>>4,t[a++]=(l&15)<<4|u>>2}return t}},N=class{encode(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}decode(e){for(var t=[],n=0,r=0,i,a,o;n<e.length;)i=e[n++],i<128?t[r++]=String.fromCharCode(i):i>191&&i<224?(a=e[n++],t[r++]=String.fromCharCode((i&31)<<6|a&63)):(a=e[n++],o=e[n++],t[r++]=String.fromCharCode((i&15)<<12|(a&63)<<6|o&63));return t.join(``)}},P=class{encode(e){for(var t=[],n,r=0;r<e.length;r++)n=e.charCodeAt(r),t.push(n&255),t.push((n&65280)>>8);return t}decode(e){var t=0,n=``,r;if(e.length%2!=0)return null;for(r=e.length,r>0&&e[r-2]==0&&e[r-1]==0&&(r-=2);t<r;)n+=String.fromCharCode(e[t]|e[t+1]<<8),t+=2;return n}},F=class{constructor(e){e||=``;let t=e.split(`;`);this.AllowSavePassword=this._getZoneValue(t,1)!==`1`,this.AutoSetParams=this._getSubZoneValue(t,2,`,`,1)===`+`,this.ProviderName=this._getSubZoneValue(t,2,`,`,2),this.SaveCert=this._getZoneValue(t,3)===`+`,this.CheckCrls=this._getSubZoneValue(t,4,`,`,1)===`+`,this.OwnCrlsOnly=this._getSubZoneValue(t,4,`,`,2)===`+`,this.FullAndDeltaCrls=this._getSubZoneValue(t,4,`,`,3)===`+`,this.AutoDownloadCrls=this._getSubZoneValue(t,4,`,`,4)===`+`,this.UseTsp=this._getSubZoneValue(t,5,`,`,1)===`+`,this.TspAddress=this._getSubZoneValue(t,5,`,`,2),this.TspPort=parseInt(this._getSubZoneValue(t,5,`,`,3)),this.UseOcsp=this._getSubZoneValue(t,6,`,`,1)===`+`,this.OcspAddress=this._getSubZoneValue(t,6,`,`,2),this.OcspPort=parseInt(this._getSubZoneValue(t,6,`,`,3)),this.OcspBeforeStore=this._getSubZoneValue(t,6,`,`,4)===`+`,this.UseOcspAccess=this._getSubZoneValue(t,6,`,`,5)===`+`,this.UseCmp=this._getSubZoneValue(t,7,`,`,1)===`+`,this.CmpAddress=this._getSubZoneValue(t,7,`,`,2),this.CmpPort=parseInt(this._getSubZoneValue(t,7,`,`,3)),this.UseLdap=this._getSubZoneValue(t,8,`,`,1)===`+`,this.LdapAddress=this._getSubZoneValue(t,8,`,`,2),this.LdapPort=parseInt(this._getSubZoneValue(t,8,`,`,3)),this.ValidateOwner=this._getZoneValue(t,9)===`+`,this.StrongCheck=this._getZoneValue(t,10)===`+`,this.DontEraseKey=this._getZoneValue(t,11)===`+`,this.IdleTimeout=parseInt(this._getZoneValue(t,12)),this.DeviceType=this._getZoneValue(t,13),this.MainCrl=this._getZoneValue(t,14),this.HashAlgorithm=this._getZoneValue(t,15),this.PreferHarware=this._getZoneValue(t,16),this.HideMobileId=!0,this.UseProxy=this._getSubZoneValue(t,19,`,`,1)===`+`,this.ProxyAddress=this._getSubZoneValue(t,19,`,`,2),this.ProxyPort=this._getSubZoneValue(t,19,`,`,3),this.ProxyUser=this._getSubZoneValue(t,19,`,`,4),this.ProxyPassword=this._getSubZoneValue(t,19,`,`,5);let n=this._getSubZoneValue(t,19,`,`,6);this.ApplyProxySettings=!n||!n.trim()?this.UseProxy:n===`+`,this.AllowTestKeys=this._getZoneValue(t,20)===`+`,this.AgentSignWeb=this._getZoneValue(t,21)===`+`,this.TestCAConnection=this._getZoneValue(t,22)===`+`,this.DontSaveToRegistry=this._getZoneValue(t,23)===`+`;let r=this._getZoneValue(t,24),i=this._getZoneValue(t,25)===`+`||this._getZoneValue(t,25)!==`-`&&null;this.DirectAccess=i===!0||i!==!1&&!this.ApplyProxySettings&&!this.UseProxy,this.PreLoadClientLibraries=this._getZoneValue(t,26)===`+`;let a=parseInt(this._getZoneValue(t,27));if(this.WebClientFileSize=a<5?5:a>127?127:a,this.UseTSL=this._getZoneValue(t,28)===`+`,this.UmcaservicePort=this._getZoneValue(t,29),!r)this.KSPs=Y(this.AllowTestKeys);else{try{r=new TextDecoder().decode(y(r)),this.KSPs=JSON.parse(r)}catch(e){console.error(`error parsing KSPs from GlSign`),console.error(e)}(!this.KSPs||this.KSPs.length===0)&&(this.KSPs=Y(this.AllowTestKeys)),this.KSPs.forEach(e=>{if(e.ksp===K.DIIA||e.ksp===K.IIT||e.ksp===K.PB||e.ksp===K.VTOKEN){if(e.address.includes(`cabinet.e-life.com.ua`)||e.address.includes(`sserver.amokey.com`)||e.address.includes(`smart-sign.dpsu.gov.ua`)||e.address.includes(`sign-ca.mvs.gov.ua`)||e.address.includes(`id.edin.ua`)||e.address.includes(`business.ukrsibbank.com`))return;(!Array.isArray(e.signAlgos)||e.signAlgos.length==0)&&(e.signAlgos=[p.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564,p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311])}})}}_getZoneValue(e,t){return e.length>=t&&e[t-1]||``}_getSubZoneValue(e,t,n,r){let i=this._getZoneValue(e,t);if(!i)return``;let a=i.split(n);return this._getZoneValue(a,r)}},I=c({CertificatesProvider:()=>V,DefaultCertificatesProvider:()=>H,DefaultSettingProvider:()=>R,DigitalSignatureKeyType:()=>G,DigitalSignatureKeyTypeFile:()=>0,DigitalSignatureKeyTypeKSP:()=>2,DigitalSignatureKeyTypeToken:()=>1,DigitalSignatureKeyTypeUmCAService:()=>4,DigitalSignatureKeyTypeWindowsCertStore:()=>3,DigitalSignatureLibraryType:()=>W,DigitalSignatureLibraryTypeJS:()=>0,DigitalSignatureLibraryTypeSW:()=>1,DigitalSignatureSettings:()=>L,EU_KSP_ClientIdType:()=>-1,EU_KSP_DIIA:()=>7,EU_KSP_GRYADA:()=>-1,EU_KSP_IIT:()=>4,EU_KSP_PB:()=>6,EU_KSP_VTOKEN:()=>-2,EndUserKSP:()=>K,EndUserKSPClientIdType:()=>q,FilePrivateKeyInfo:()=>ee,HardwarePrivateKeyInfo:()=>te,KSPKeyMedia:()=>ie,KSPKeyMediasResponse:()=>re,KSPPrivateKeyAuthData:()=>Z,KSPUserAuthData:()=>X,KspPrivateKeyInfo:()=>ne,LegacyCertificatesProvider:()=>U,LegacySettingsProvider:()=>B,PrivateKeyInfo:()=>J,ProtectTaxReportParams:()=>Q,WebserviceSettingProvider:()=>z,getDefaultKSPs:()=>Y}),L=class{constructor(e,t,n,r,i){this.language=e||`en`,this.userId=t,this.httpProxyServiceURL=n,this.certificatesProvider=r,this.libraryUrl=i}},R=class{constructor(e,t,n,r){if(typeof n!=`string`)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:`basePath is not a string`};n.endsWith(`/`)&&(n=n.substring(0,n.length-1)),this.language=e,this.userId=t,this.apiPath=n,this.workerPath=r}async getGlSign(){return new F(await m(this.apiPath+`/files?name=glsign`,`string`))}async getSettings(){return this._settings||=new L(this.language,this.userId,this.apiPath+`/ProxyHandler`,new H(this.apiPath+`/files?name=CAs.json`,this.apiPath+`/files?name=CACertificates.p7b`),this.workerPath||`/euscp.worker.js`),this._settings}},z=class{constructor(e,t,n,r){this.language=e,this.userId=t,this.apiPath=n,this.workerPath=r}async getGlSign(){return new F(await m(`${this.apiPath}/webservice.asmx/ExecuteEx?pureJSON=`,void 0,void 0,{calcId:`GETGLSIGNBEFORELOGIN`,args:``,ticket:``}))}async getSettings(){if(this._settings)return this._settings;let e=await m(`${this.apiPath}/webservice.asmx/ExecuteEx?pureJSON=`,`json`,void 0,{calcId:`GETCASANDCERTIFICATEFILES`,args:``,ticket:``});return this._settings=new L(this.language,this.userId,`${this.apiPath}/ProxyHandler`,new H(`${this.apiPath}/GetFile.ashx?file=${e.FILECAS}`,`${this.apiPath}/GetFile.ashx?file=${e.FILECERT}`),this.workerPath||`/euscp.worker.js`),this._settings}},B=class{constructor(e,t,n,r,i){if(typeof n!=`string`)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:`basePath is not a string`};n.endsWith(`/`)&&(n=n.substring(0,n.length-1)),this.language=e,this.userId=t,this.basePath=n,this.glsign=r,this.workerPath=i}getGlSign(){return typeof this.glsign==`string`?new F(this.glsign):this.glsign}getSettings(e){return new L(this.language,this.userId,this.basePath+`/ProxyHandler.ashx`,new U(e,this.basePath+`/Data/version.txt`,this.basePath+(e?`/Data/CAs.Test.json`:`/Data/CAs.json`),this.basePath+(e?`/Data/CACertificates.Test.p7b`:`/Data/CACertificates.p7b`)),this.workerPath||`/euscp.worker.js`)}},V=class{constructor(e){this.testMode=e}async loadCertificates(){throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:`Not implemented`}}get _storagePrefix(){return this.testMode?`Test`:``}_getItem(e){return localStorage.getItem(this._storagePrefix+e)}_setItem(e,t){localStorage.setItem(this._storagePrefix+e,t)}_removeItem(e){localStorage.removeItem(this._storagePrefix+e)}},H=class extends V{constructor(e,t){super(!1),this.CAsUri=e,this.CACertificatesUri=t}async loadCertificates(){try{let[e,t]=await Promise.all([m(this.CAsUri,`json`),m(this.CACertificatesUri,`binary`)]);return{CAs:e,CACertificates:t}}catch(e){throw console.error(e),{code:p.EndUserError.EU_ERROR_DOWNLOAD_FILE,message:`Error downloading root certificates`}}}},U=class extends V{constructor(e,t,n,r){super(e),this.versionUri=t,this.CAsUri=n,this.CACertificatesUri=r}async loadCertificates(){let e=this._getItem(`CA`),t=this._getItem(`Certificates`),n=this._getItem(`CAVersion`);try{let r=await m(this.versionUri);if(r!=n&&(n=r,e=null,t=null),e)try{e=JSON.parse(e)}catch(t){console.error(t),e=null}if(e||(e=await m(this.CAsUri,`json`),this._setItem(`CA`,JSON.stringify(e))),t)try{t=y(t)}catch(e){console.error(e),t=null}return t||(t=await m(this.CACertificatesUri,`binary`),this._setItem(`Certificates`,v(t))),this._setItem(`CAVersion`,n),{CAs:e,CACertificates:t}}catch(e){throw this._removeItem(`CA`),this._removeItem(`CAVersion`),this._removeItem(`Certificates`),console.error(e),{code:p.EndUserError.EU_ERROR_DOWNLOAD_FILE,message:`Error downloading root certificates`}}}},W={JS:0,SW:1},G={File:0,Token:1,KSP:2,WindowsCertStore:3,UmCAService:4},K={IIT:4,PB:6,DIIA:7,GRYADA:-1,VTOKEN:-2},q={Default:p.EndUserConstants.EndUserKSPClientIdType.Default,Name:p.EndUserConstants.EndUserKSPClientIdType.Name,Phone:p.EndUserConstants.EndUserKSPClientIdType.Phone,Email:p.EndUserConstants.EndUserKSPClientIdType.Email,NamePassword:-1},J=class{constructor(e,t,n,r,i){this.keyType=e,this.ownerInfo=t,this.certificates=n,this.visibleName=r,this.id=i}isDigitalStamp(){if(!Array.isArray(this.certificates)||this.certificates.length===0)return!1;let e=this.certificates;for(let t=0;t<e.length;t++){let n=e[t].infoEx;if(n.publicKeyType==p.EndUserConstants.EndUserCertKeyType.DSTU4145&&(n.keyUsageType&p.EndUserConstants.EndUserKeyUsage.DigitalSignature)==p.EndUserConstants.EndUserKeyUsage.DigitalSignature)return!(n.extKeyUsages.indexOf(p.EndUserConstants.EU_UA_OID_EXT_KEY_USAGE_STAMP)<0&&n.extKeyUsages.indexOf(`Цифрова печатка`)<0)}return!1}supportSigning(){if(this.keyType===2)return!0;let e=this.certificates;for(let t=0;t<e.length;t++)if((e[t].infoEx.keyUsageType&p.EndUserConstants.EndUserKeyUsage.DigitalSignature)==p.EndUserConstants.EndUserKeyUsage.DigitalSignature)return!0;return!1}supportEncryption(){if(this.keyType===2)return!1;let e=this.certificates;for(let t=0;t<e.length;t++)if((e[t].infoEx.keyUsageType&p.EndUserConstants.EndUserKeyUsage.KeyAgreement)==p.EndUserConstants.EndUserKeyUsage.KeyAgreement)return!0;return!1}getSignAlgo(){let e=this.certificates;if(this.keyType===2){let e=this.ksp;if(Array.isArray(e.signAlgos)&&e.signAlgos.length>0){let t=e.signAlgos[0];return t===p.EndUserConstants.EndUserSignAlgo.DSTU4145WithDSTU7564&&this._glsign?.HashAlgorithm===`GOST34311`&&e.signAlgos.includes(p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311)?p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311:t}return p.EndUserConstants.EndUserSignAlgo.DSTU4145WithGOST34311}return e.length>0?T(e,this._glsign)[0]:p.EndUserConstants.EndUserSignAlgo.Unknown}getHashAlgo(){if(this.keyType===2)return w(this.getSignAlgo());let e=this.certificates;if(e.length>0&&e[0]?.infoEx?.certHashType){let t=e[0].infoEx.certHashType;return t==p.EndUserConstants.EndUserHashAlgo.GOST34311&&this._glsign?.HashAlgorithm!==`GOST34311`?p.EndUserConstants.EndUserHashAlgo.DSTU7564_256:t==p.EndUserConstants.EndUserHashAlgo.DSTU7564_256&&this._glsign?.HashAlgorithm===`GOST34311`?p.EndUserConstants.EndUserHashAlgo.GOST34311:t}return w(this.getSignAlgo())}},ee=class extends J{constructor(e,t,n,r,i){super(e,t,n,n[0].infoEx.subjCN,n[0].infoEx.serial),this.privateKey=r,this.password=i}},te=class extends J{constructor(e,t,n,r){super(e,t,n,n[0].infoEx.subjCN,n[0].infoEx.serial),this.keyMedia=r}},ne=class extends J{constructor(e,t,n,r,i,a){super(e,t,n,r,r),this.userId=r,this.ksp=i,this.keyId=a}};function Y(e){let t=new p.KSPSettings;t.id=`DEPOSITSIGN`,t.name=`DepositSign`,t.ksp=p.EndUserConstants.EU_KSP_PB,t.address=`https://depositsign.com/api/v1/it-enterprise/sign-server`,t.clientIdPrefix=``,t.directAccess=!0,t.needQRCode=!1;let n=new p.KSPSettings;n.id=`DIIA-SIGN`,n.name=`Дія.Підпис`,n.ksp=p.EndUserConstants.EU_KSP_DIIA,n.directAccess=!1,n.mobileAppName=`Дія`,n.address=`https://diia-sign.it.ua/KSPSign`,n.systemId=`diia-sign-it-ent`,n.needQRCode=!0,n.signAlgos=[1];let r=new p.KSPSettings;r.id=`PB-SMARTID`,r.name=`Приватбанк - хмарний підпис "SmartID"`,r.ksp=p.EndUserConstants.EU_KSP_PB,r.directAccess=!0,r.mobileAppName=`Приват24`,r.address=`https://acsk.privatbank.ua/cloud/api/back/`,r.clientIdPrefix=`IEIS_`,r.confirmationURL=`https://www.privat24.ua/rd/kep`,r.needQRCode=!0;let i=new p.KSPSettings;i.id=`VCHASNO`,i.name=`Вчасно - хмарний підпис`,i.ksp=p.EndUserConstants.EU_KSP_PB,i.address=`https://cs.vchasno.ua/ss/`,i.clientIdPrefix=``,i.directAccess=!1,i.needQRCode=!1;let a=new p.KSPSettings;a.id=`VCHASNOQR`,a.name=`Вчасно - хмарний підпис (QR)`,a.ksp=p.EndUserConstants.EU_KSP_PB,a.address=`https://cs.vchasno.ua/ss/`,a.clientIdPrefix=`vchasno_`,a.confirmationURL=`https://cs.vchasno.ua/rd/`,a.mobileAppName=`Вчасно.КЕП`,a.directAccess=!1,a.needQRCode=!0;let o=new p.KSPSettings;o.id=`CLOUDKEY`,o.name=`ТОВ «ЦСК «Україна» - хмарний підпис CloudKey`,o.ksp=p.EndUserConstants.EU_KSP_PB,o.directAccess=!0,o.mobileAppName=`CloudKey`,o.address=`https://sid.uakey.com.ua/smartid/iit/`,o.clientIdPrefix=`DIIA_2`,o.confirmationURL=`https://sid.uakey.com.ua/kep?hash=rd/kep`,o.needQRCode=!0;let s=new p.KSPSettings;s.id=`ESIGN`,s.name=`ESign - хмарний підпис`,s.ksp=p.EndUserConstants.EU_KSP_PB,s.address=`https://cabinet.e-life.com.ua/api/EDG/Sign`,s.clientIdPrefix=``,s.directAccess=!0,s.needQRCode=!1;let c=new p.KSPSettings;c.id=`SMARTSIGNTAX`,c.name=`ДПС - хмарний підпис`,c.ksp=p.EndUserConstants.EU_KSP_PB,c.address=`https://smart-sign.tax.gov.ua/`,c.port=`443`,c.directAccess=!0,c.clientIdType=q.Name,c.needQRCode=!1;let l=new p.KSPSettings;l.id=`PUMB`,l.name=`ПУМБ - хмарний підпис`,l.ksp=p.EndUserConstants.EU_KSP_PB,l.address=`https://apiext.pumb.ua/hogsmeade/striga/v1`,l.directAccess=!1,l.clientIdPrefix=`SMARTTENDER_`,l.confirmationURL=`https://www.pumb.ua/qes`,l.mobileAppName=``,l.needQRCode=!0;let u=new p.KSPSettings;u.id=`UGB`,u.name=`Укргазбанк - хмарний підпис «EcoSign»`,u.ksp=K.VTOKEN,u.address=`https://vtms-api-qca.ukrgasbank.com/vtco/api/v1`,u.systemId=`cihsmVtcoServiceClientSmartTender`,u.directAccess=!0,u.clientIdType=q.NamePassword,u.needQRCode=!1;let d=new p.KSPSettings;d.id=`ALLIANCE`,d.name=`Банк Альянс - хмарний підпис`,d.ksp=K.VTOKEN,d.address=`https://cihsm-api.bankalliance.ua/vtco/api/v1`,d.systemId=`cihsmVtcoServiceClientSmartTender`,d.directAccess=!0,d.clientIdType=q.NamePassword,d.needQRCode=!1;let f=new p.KSPSettings;f.id=`VTOKEN`,f.name=`Хмарний сервіс Шифр-vToken (тестовий)`,f.ksp=K.VTOKEN,f.address=`https://cihsm-dev-api.cipher.com.ua/vtco/api/v1`,f.systemId=`cipherVTokenIntegrationClient`,f.directAccess=!0,f.clientIdType=q.NamePassword,f.needQRCode=!1;let m=new p.KSPSettings;m.id=`AMOKEY`,m.name=`АМО ФІНТЕХ – хмарний підпис AMOKEY`,m.ksp=K.PB,m.address=`https://sserver.amokey.com`,m.port=`443`,m.clientIdPrefix=``,m.directAccess=!0,m.clientIdType=q.Name,m.needQRCode=!1;let h=new p.KSPSettings;h.id=`TASCOMBANK`,h.name=`Сервер підпису КНЕДП АТ "ТАСКОМБАНК"`,h.ksp=K.PB,h.address=`https://smartsign.tascombank.ua`,h.port=`443`,h.clientIdPrefix=``,h.directAccess=!0,h.clientIdType=q.Name,h.needQRCode=!1;let g=new p.KSPSettings;g.id=`EDINQR`,g.name=`EDIN ID - хмарний підпис (QR)`,g.ksp=K.PB,g.address=`https://id.edin.ua/api/ess/v1/`,g.confirmationURL=`https://id.edin.ua/mobile/sign`,g.port=``,g.clientIdPrefix=`EDIN_`,g.directAccess=!0,g.mobileAppName=`edinid`,g.needQRCode=!0;let _=new p.KSPSettings;_.id=`EDIN`,_.name=`EDIN ID - хмарний підпис`,_.ksp=K.PB,_.address=`https://id.edin.ua/api/ess/v1/`,_.port=``,_.clientIdPrefix=``,_.directAccess=!0,_.clientIdType=q.Name,_.needQRCode=!1;let v=new p.KSPSettings;v.id=`UKRSIBBANK`,v.name=`УКРСИББАНК - хмарний підпис`,v.ksp=K.PB,v.address=`https://business.ukrsibbank.com/morpheus/smart-sign/`,v.confirmationURL=`https://business.ukrsibbank.com/smartsign`,v.port=``,v.clientIdPrefix=`USB_`,v.directAccess=!0,v.mobileAppName=`UKRSIB business`,v.needQRCode=!0;let y=[t,n,r,i,a,o,s,c,l,u,d,m,h,g,_,v];return e&&y.push(f),y}var re=class{constructor(e,t,n){this.token=e,this.isTwoFactor=t,this.keys=n}},ie=class{constructor(e,t,n,r,i){this.keyId=e,this.visibleName=t,this.subject=n,this.issuer=r,this.isStamp=i}},X=class{constructor(e,t){this.userName=e,this.password=t}},Z=class{constructor(e,t,n){this.pin=e,this.token=t,this.twoFactorCode=n}},Q=class{constructor(e,t,n,r,i,a,o){this.accountantPrivateKeyContext=e,this.directorPrivateKeyContext=t,this.stampPrivateKeyContext=n,this.senderEMail=r,this.recipientCertificate=i,this.reports=a,this.returnIntermediateSign=o}},$=class{constructor(e){e||=`25989`,typeof e!=`string`&&(e=String(e)),this.baseUrl=`https://localhost:${e.trim()}/`}async tryConnect(){try{let e=await fetch(this.baseUrl+`about`);return e.ok&&typeof(await e.json()).AppID==`string`}catch{return!1}}async getKeys(){let e=await fetch(this.baseUrl+`keystores?ReadCertificates=true&KeyParams=true`);if(!e.ok){let t=await e.json();throw{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:t.Message}}return(await e.json()).map(e=>{let t=e.Description,n=e.Description.indexOf(`KeyStores`);return n>0&&(t=t.substring(n)),{alias:e.Certs[0].CertificateSerialNumber,visibleName:t,certificates:e.Certs.map(e=>e.Base64),password:null}})}async signData(e,t,n,r){let i;n.type===p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES?i=`pdf-attached`:(i=n.signLevel>=p.EndUserConstants.EU_SIGN_TYPE_CADES_C?`cades-x-ts-signtime-ocsp-stdua`:`cms-ts-signtime`,n.subType===p.EndUserConstants.EU_CADES_TYPE_ENVELOPED&&(i+=`-attached`));let a=!0;Array.isArray(t)?t=[...t]:(a=!1,t=[t]);for(let e=0;e<t.length;e++){let n=t[e];n.val?(typeof n.val==`string`&&(n.val=S(n.val)),t[e]={name:n.name,val:ae(n.val,!0)}):(typeof n==`string`&&(n=S(n)),t[e]=ae(n,!0))}let o=[];for(let n of t){let t=new Request(this.baseUrl+`sign`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({Data:n.val?n.val:n,Certificate:e.certificates[0],Pin:e.password,SigType:i,AsBlob:!1,AsResource:!1,DataAsLink:!1})}),r=await fetch(t);if(!r.ok){let e=await r.json();throw{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:e.Message}}let a=await r.json();o.push(n.name?{name:n.name,val:a}:a)}for(let e=0;e<o.length;e++){let t=o[e];t.val?o[e]={name:t.name,val:ae(t.val,!r)}:o[e]=ae(t,!r)}return a?o:o[0]}},ae=(e,t)=>t&&typeof e!=`string`?v(e):!t&&typeof e==`string`?y(e):e,oe={uk:{LibraryNotSupported:`Бібліотека web-підпису не підтримується в вашому браузері або ОС.`,LibraryNeedsInstall:`Бібліотека web-підпису не запущена або потребує встановлення. Будь ласка, запустіть або встановіть бібліотеку за посиланням та оновіть сторінку.`,LibraryNeedsUpdate:`Бібліотека web-підпису потребує оновлення. Будь ласка, встановіть оновлення за посиланням та оновіть сторінку.`,LibraryNeedsExtensionInstall:`Бібліотека web-підпису потребує встановлення веб-розширення. Будь ласка, встановіть веб-розширення за посиланням та оновіть сторінку.`,LibraryUserManual:`Настанова користувача`,WebExtensionInstall:`Інсталяційний пакет бібліотеки підпису (web-розширення)`,LibraryInstall:`Інсталяційний пакет web-бібліотеки підпису`,LibraryUpdate:`Оновлення web-бібліотеки підпису`,PrivateKeyNotReaded:`Особистий ключ не считано.`,DiiaError:`Дія.Підпис – сервіс для накладання кваліфікованого електронного підпису за допомогою смартфону і додатку «Дія».<br/>Для можливості використання «Дія.Підпис» у даній інсталяції системи вам необхідно звернутися до свого постачальника.<br/>У зверненні вкажіть наступну інформацію:<br/><ul><li>Посилання: `,DiiaHealthCheckError:`Сервіс Дія.Підпис недоступний.`,XadesError:"Перевірка кваліфікованого електронного підпису, який сформовано у вигляді окремого файлу з розширенням .xml виконується за умов наявності файлу з даними, на які накладено кваліфікований електронний підпис. Ім`я такого файлу зазвичай ідентичне з іменем файлу файлу з розширенням .xml. Оберіть цей файл разом з файлом кваліфікованого електронного підпису.",KSPSignFormatError:`Хмарні сервіси підтримують тільки підписи типу CAdES або PAdES`,KSPSignPAdESError:`Створення підписів в форматі PAdES підтримується тільки для Серверу підпису`,BadSignatureType:`Невірний тип підпису`,DownloadingRootCertificatesError:`Помилка при завантаженні сертифікатів ЦСК або списку ЦСК. Перевірте наявність налаштувань ЦСК в функції "Інструменти і налаштування → Електронний підпис → Налаштування ЦСК" та виконання задачі планувальника UPDATECASCERTIFICATES.`,BadParameter:`Невірний параметр`,PasswordNotSet:`Не вказано пароль до особистого ключа`,ReadPrivateKeyCAAutoDetectError:`Надавач не підтримує автоматичний пошук сертифіката за ос. ключем. Необхідно обрати надавача самостійно.`,ReadPrivateKeyInvalidCAError:`Ваш сертифікат виданий іншим надавачем та не обслуговується в {0}. Необхідно обрати надавача Вашого сертифіката.`,ReadPrivateKeyNeedCertificateError:`Надавач {0} не підтримує автоматичний пошук сертифіката за ос. ключем. Необхідно обрати сертифікат(и) ос. ключа.`,UmCAServiceConnectError:`Не вдалося підключитися до UmCAService. Перевірте чи сервіс запущений. В разі використання нестандартного порту, вкажіть його в глобальному параметрі GlSign.`,UmCAServiceWrongPassword:`Невірний пароль`},ru:{LibraryNotSupported:`Библиотека web-подписи не поддерживается в вашем браузере или ОС.`,LibraryNeedsInstall:`Библиотека web-подписи не установлена или не запущена. Для продолжения запустите или установите библиотеку по ссылке и обновите страницу.`,LibraryNeedsUpdate:`Библиотеке web-подписи требуется обновление. Для продолжения установите обновление по ссылке и обновите страницу.`,LibraryNeedsExtensionInstall:`Библиотеке web-подписи требуется устрановка веб-расширения. Для продолжения утсановите веб-расширение по ссылке и обновите страницу.`,LibraryUserManual:`Руководство пользователя`,WebExtensionInstall:`Установочный пакет библиотеки подписи (web-розширення)`,LibraryInstall:`Установочный пакет web-библиотеки подписи`,LibraryUpdate:`Обновление web-библиотеки подписи`,PrivateKeyNotReaded:`Приватный ключ не считан.`,DiiaError:`Дія.Підпис – сервис для наложения квалифицированной электронной подписи с помощью смартфона и приложения «Дія».<br/>Для возможности использования «Дія.Підпис» в данной инсталляции системы вам необходимо обратиться к своему поставщику.<br/>В обращении укажите следующую информацию:<br/><ul><li>Ссылка: `,DiiaHealthCheckError:`Сервис Дія.Підпис недоступен.`,XadesError:`Проверка квалифицированной электронной подписи, которая сформирована в виде отдельного файла с расширением .xml, выполняется при наличии файла с данными, на которые наложена квалифицированная электронная подпись. Имя такого файла обычно идентично с именем файла с расширением .xml. Выберите этот файл вместе с квалифицированной электронной подписью.`,KSPSignFormatError:`Облачные сервисы поддерживают только подписи типа CAdES или PAdES`,KSPSignPAdESError:`Создание подписей в формате PAdES поддерживается только для Сервера подписи`,BadSignatureType:`Неверный тип подписи`,DownloadingRootCertificatesError:`Ошибка при загрузке корневых сертификатов ЦСК, либо списка ЦСК. Проверьте наличие настроек ЦСК в функции "Инструменты и настройки → Электронная подпись → Настройки ЦСК" и выполнение задачи планировщика UPDATECASCERTIFICATES.`,BadParameter:`Неверный параметр`,PasswordNotSet:`Не указан пароль к приватному ключу`,ReadPrivateKeyCAAutoDetectError:`Центр сертификации не поддерживает автоматический поиск сертификата по приватному ключу. Необходимо выбрать центр сертификации самостоятельно.`,ReadPrivateKeyInvalidCAError:`Ваш сертификат выдан в другом центре сертификации и не обслуживается в {0}. Необходимо выбрать центр сертификации Вашего сертификата.`,ReadPrivateKeyNeedCertificateError:`Центр сертификации {0} не поддерживает автоматический поиск сертификата по приватному ключу. Нобходимо указать сертификат(ы) приватного ключа.`,UmCAServiceConnectError:`Не удалось подключиться к UmCAService. Проверьте, запущен ли сервис. В случае использования нестандартного порта, укажите его в глобальном параметре GlSign.`,UmCAServiceWrongPassword:`Неправильный пароль`},en:{LibraryNotSupported:`Web-signature library is not supported in your browser or OS.`,LibraryNeedsInstall:`Web-signature library not installed or not launched. Please, launch or install library by link and reload page.`,LibraryNeedsUpdate:`Web-signature library requires update. Please, install update by link and reload page.`,LibraryNeedsExtensionInstall:`Web-signature library requires installation of web-extension. Please, install web-extension by link and reload page.`,LibraryUserManual:`User manual`,WebExtensionInstall:`Signature library installation package (web-extension)`,LibraryInstall:`Web-signature library installation package`,LibraryUpdate:`Web-signature library update package`,PrivateKeyNotReaded:`Private key not readed.`,DiiaError:`Diia.Sign - a service for applying a qualified digital signature using a smartphone and the application "Diia". <br/> To be able to use "Diia.Sign" in this system, you need to contact your provider. <br/> Please include the following information in your request: <br/> <ul> <li> Link: `,DiiaHealthCheckError:`Diia.Sign service is unavailable.`,XadesError:`The verification of a qualified digital signature, which is formed as a separate file with the extension .xml, is performed under the conditions of the file with the data on which the qualified digital signature is affixed. The name of such a file is usually identical to the filename of the .xml file. Select this file along with the qualified digital signature file.`,KSPSignFormatError:`Cloud services only supports CAdES or PAdES signatures`,KSPSignPAdESError:`PAdES signatures are supported only by SignServer`,BadSignatureType:`Invalid signature type`,DownloadingRootCertificatesError:`Error occured while downloading root CA certificates or CA list. Check for CA setting in function "Tools and settings → Electronic signature → CA settings" and execution of task scheduler UPDATECASCERTIFICATES.`,BadParameter:`Invalid parameter`,PasswordNotSet:`Private key password not specified.`,ReadPrivateKeyCAAutoDetectError:`Certification authority does not support automatic search for a certificate by private key. You need to choose a certification authority yourself.`,ReadPrivateKeyInvalidCAError:`Your certificate was issued by a different CA and is not being serviced in {0}. You need to select a certification authority for your certificate.`,ReadPrivateKeyNeedCertificateError:`Certification authority {0} does not support automatic search for a certificate by private key. You must specify the certificates of the private key.`,UmCAServiceConnectError:`Unable to connect to UmCAService. Check if the service is running. If using a non-standard port, specify it in the global parameter GlSign.`,UmCAServiceWrongPassword:`Wrong password`}},se=`PKType`,ce=`PKInfo`;e.DigitalSignature=class{constructor(e){this._settingsProvider=e,this._glSign=null,this._settings=null,this._euSignFile,this._euSignKeyMedia,this._euSign=null,this._selectedCA=null,this._KSPs=[],this._readedKey=null,this._isInitializing=!1,this._initializationPromise=Promise.resolve(G.File)}get readedKey(){return this._readedKey}get _selectedIssuerCN(){return this._selectedCA?this._selectedCA.issuerCNs[0]:null}getLibraryType(){return this.keyType}async setLibraryType(e){switch(e){case G.Token:if(this._euSign===this._euSignKeyMedia&&await this._euSign.IsInitialized())return;this._euSign=this._euSignKeyMedia;break;case G.UmCAService:this._euSign=this._euSignFile;break;default:if(this._euSign===this._euSignFile)return;this._euSign=this._euSignFile}e!=null&&e!=null&&(this._preferredKeyType=e),this.keyType=e,await this.initialise()}initialise(){return this.initialize()}initialize(){return this._isInitializing?this._initializationPromise:(this._isInitializing=!0,this._initializationPromise=new Promise(async(e,t)=>{try{e(await this._initialize())}catch(e){t(e)}finally{this._isInitializing=!1}}),this._initializationPromise)}async _initialize(){if(this._glSign||=await Promise.resolve(this._settingsProvider.getGlSign()),this._settings||=await Promise.resolve(this._settingsProvider.getSettings(this._glSign.AllowTestKeys)),this._euSignFile||=new p.EndUser(this._settings.libraryUrl,p.EndUserConstants.EndUserLibraryType.JS,this._glSign.WebClientFileSize),this._euSignKeyMedia||=new p.EndUser(this._settings.libraryUrl,p.EndUserConstants.EndUserLibraryType.SW,this._glSign.WebClientFileSize),this._euSign||(this._euSign=this._glSign.PreferHarware?this._euSignKeyMedia:this._euSignFile,this.keyType=this._glSign.PreferHarware?G.Token:this._preferredKeyType),this.keyType===G.UmCAService&&(this.UmCAService||=new $(this.glSign.UmcaservicePort),!await this.UmCAService.tryConnect()))throw{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.UmCAServiceConnectError};let e=this._euSign;if(await e.IsInitialized())return this.getLibraryType();if(e===this._euSignKeyMedia){let t=await e.GetLibraryInfo();if(!t.supported)throw{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.LibraryNotSupported};if(!t.loaded)throw t.isNativeLibraryNeedUpdate?{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.LibraryNeedsUpdate,reload:!0,urls:[{href:t.nativeLibraryUpdateURL,caption:this._resourses.LibraryUpdate},{href:t.helpURL,caption:this._resourses.LibraryUserManual}]}:t.isWebExtensionSupported&&!t.isWebExtensionInstalled?{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.LibraryNeedsExtensionInstall,reload:!0,urls:[{href:t.webExtensionInstallURL,caption:this._resourses.WebExtensionInstall},{href:t.helpURL,caption:this._resourses.LibraryUserManual}]}:{code:p.EndUserError.EU_ERROR_LIBRARY_LOAD,message:this._resourses.LibraryNeedsInstall,reload:!0,urls:[{href:t.nativeLibraryInstallURL,caption:this._resourses.LibraryInstall},{href:t.helpURL,caption:this._resourses.LibraryUserManual}]}}if(!this._euSettings){let e;try{e=await this._settings.certificatesProvider.loadCertificates()}catch(e){throw e&&e.code===p.EndUserError.EU_ERROR_DOWNLOAD_FILE?{code:p.EndUserError.EU_ERROR_DOWNLOAD_FILE,message:this._resourses.DownloadingRootCertificatesError}:e}this._euSettings={language:this._language,encoding:`UTF-16LE`,httpProxyServiceURL:this._settings.httpProxyServiceURL,directAccess:this._glSign.DirectAccess,CAs:e.CAs,CACertificates:e.CACertificates,KSPs:this.KSPs,allowedKeyMediaTypes:[`е.ключ BIFIT iToken`,`криптомод. ІІТ Гряда-61`,`е.ключ ІІТ Алмаз-1К`,`е.ключ ІІТ Алмаз-1К (Bluetooth)`,`е.ключ ІІТ Кристал-1`,`криптомод. ІІТ Гряда-301`,`ID-карта громадянина (БЕН)`,`е.ключ ІІТ Алмаз-1К (PKCS#11)`,`е.ключ ІІТ Кристал-1 (PKCS#11)`,`е.ключ чи смарт-карта Avest (PKCS#11)`,`е.ключ Ефіт Key (PKCS#11)`,`е.ключ чи смарт-карта Автор (PKCS#11)`,`е.ключ чи смарт-карта Автор 338 (PKCS#11)`,`смарт-карта Техноконс. TEllipse3 (PKCS#11)`,`смарт-карта Техноконс. TEllipse`,`смарт-карта Техноконс. TEllipse2/3`,`е.ключ SIS DIAMOND`,`е.ключ SafeNet iKey (PKCS#11, RSA)`,`е.ключ Aruba Key (PKCS#11, RSA)`]}}if(await e.Initialize(this._euSettings),e===this._euSignKeyMedia&&!await this._euSignFile.IsInitialized()&&this._euSignFile.Initialize(this._euSettings),this._glSign.ApplyProxySettings){let{UseProxy:t,ProxyAddress:n,ProxyPort:r,ProxyUser:i,ProxyPassword:a}=this._glSign,o=new p.EndUserProxySettings;o.useProxy=t,o.address=n,o.port=r,o.anonymous=!i||!a,o.user=i,o.password=a,o.savePassword=!0,await e.SetProxySettings(o),e===this._euSignKeyMedia&&!await this._euSignFile.IsInitialized()&&this._euSignFile.SetProxySettings(o)}return await e.SetRuntimeParameter(p.EndUserConstants.EU_SIGN_TYPE_PARAMETER,p.EndUserConstants.EndUserSignType.CAdES_X_Long),e===this._euSignKeyMedia&&!await this._euSignFile.IsInitialized()&&this._euSignFile.SetRuntimeParameter(p.EndUserConstants.EU_SIGN_TYPE_PARAMETER,p.EndUserConstants.EndUserSignType.CAdES_X_Long),this.getLibraryType()}get glSign(){return this._glSign}async setLanguage(e){await this._euSignFile.SetLanguage(e),await this._euSignKeyMedia.IsInitialized()&&await this._euSignKeyMedia.SetLanguage(e)}async parseCertificate(e){await this.setLibraryType(G.File),typeof e==`string`&&(e=y(e));let t=new p.EndUserCertificate;return t.data=e,t.infoEx=await this._euSign.m_library.m_worker.postMessage(`ParseCertificateEx`,[e]),t}async getKeyMedias(){return await this.setLibraryType(G.Token),this._euSignKeyMedia.GetKeyMedias()}async readPrivateKeyByInfo(e){if(!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyInfo`};switch(await this.setLibraryType(e.keyType),e.keyType){case G.File:return await this.readFileKey(e.privateKey,e.password,e.certificates);case G.Token:return await this.readHardwareKey(e.keyMedia,e.certificates);case G.KSP:return await this.readPrivateKeyKSP(e.ksp,e.userId,!1,e.keyId);case G.UmCAService:return await this.readPrivateKeyUmCAService(e.keyMedia);case G.WindowsCertStore:return await this.readWindowsCertStorePrivateKey();default:return null}}async readHardwareKey(e,t){if(await this.setLibraryType(G.Token),!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyMedia`};if(!e.password)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.PasswordNotSet};t=Array.isArray(t)&&t.length>0?await Promise.all(t.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)):null;try{let n=await this._euSign.ReadPrivateKey(e,t,this._selectedIssuerCN);return this._readedKey=new te(G.Token,n,await this._euSign.GetOwnCertificates(),e),this._readedKey._glSign=this._glSign,this._readedKey}catch(e){if(e&&e.code===p.EndUserError.EU_ERROR_CERT_NOT_FOUND){if(!this._selectedIssuerCN)throw{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:this._resourses.ReadPrivateKeyCAAutoDetectError};if(this._selectedIssuerCN)throw this._selectedCA.cmpAddress?{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyInvalidCAError,this._selectedIssuerCN)}:{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyNeedCertificateError,this._selectedIssuerCN)}}throw e}}async readFileKey(e,t,n){if(await this.setLibraryType(G.File),!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyMedia`};if(!t)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.PasswordNotSet};(e instanceof File||e instanceof Blob)&&(e=await _(e)),n=Array.isArray(n)&&n.length>0?await Promise.all(n.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)):null;try{let r;try{r=await this._euSign.ReadPrivateKeyBinary(e,t,n,this._selectedIssuerCN)}catch(n){if(n&&n.code===p.EndUserError.EU_ERROR_CERT_BAD_BY_OCSP){let{certs:n}=await this._searchPrivateKeyCertificatesWithCMP_JS(e,t,this._selectedIssuerCN);r=await this._euSign.ReadPrivateKeyBinary(e,t,n,this._selectedIssuerCN)}else throw n}let i=await this._euSign.GetOwnCertificates();return this._readedKey=new ee(G.File,r,i,e,t),this._readedKey._glSign=this._glSign,this._readedKey}catch(e){if(e&&e.code===p.EndUserError.EU_ERROR_CERT_NOT_FOUND){if(!this._selectedIssuerCN)throw{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:this._resourses.ReadPrivateKeyCAAutoDetectError};if(this._selectedIssuerCN)throw this._selectedCA.cmpAddress?{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyInvalidCAError,this._selectedIssuerCN)}:{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyNeedCertificateError,this._selectedIssuerCN)}}throw e}}async getJKSPrivateKeys(e){return await this.setLibraryType(G.File),(e instanceof File||e instanceof Blob)&&(e=await _(e)),await this._euSign.GetJKSPrivateKeys(e)}isJKSContainer(e){return e.name.endsWith(`.jks`)}async _searchPrivateKeyCertificatesWithCMP_JS(e,t,n){return await this._euSignFile.m_library.m_worker.postMessage(`CallSearchPrivateKeyCertificatesWithCMP`,[e,t,n])}async readPrivateKeyDepositsign(e,t=!1){let n=this.KSPs.find(e=>e.id===`DEPOSITSIGN`);return await this.readPrivateKeyKSP(n,e,t)}async readPrivateKeyDiia(e=!1){let t=this.KSPs.find(e=>e.id===`DIIA-SIGN`);return await this.readPrivateKeyKSP(t,null,e)}async readPrivateKeyKSP(e,t,n=!1,r,i,a){await this.setLibraryType(G.KSP),e.ksp===p.EndUserConstants.EU_KSP_DIIA&&await this._diiaCheckAccess(e),a=Array.isArray(a)&&a.length>0?await Promise.all(a.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)):null;let o=await this._euSign.ReadPrivateKeyKSP(t,e.name,n,r,null,i,a);if((n||a)&&!o)throw{code:p.EndUserError.EU_ERROR_KEY_MEDIAS_READ_FAILED,message:this._resourses.PrivateKeyNotReaded};return this._readedKey=new ne(G.KSP,o,n||a?await this._euSign.GetOwnCertificates():[],t,e,r),this._readedKey._glSign=this._glSign,this._readedKey}async getKeyMediasKSP(e,t){return await this.setLibraryType(G.KSP),this._euSign.m_library.m_worker.postMessage(`GetKeyMediasKSP`,[e,t])}async setTwoFactorCodeKSP(e){return await this.setLibraryType(G.KSP),this._euSign.m_library.m_worker.postMessage(`SetTwoFactorCodeKSP`,[e])}async addConfirmKSPOperationEventListener(e){await this._euSignFile.AddEventListener(p.EndUserConstants.EndUserEventType.ConfirmKSPOperation,function(t){t.qrCode=`data:image/bmp;base64,`+t.qrCode,e(t)})}async readPrivateKeyUmCAService(e){await this.setLibraryType(G.UmCAService);let t=[];for(let n of e.certificates){let e=await this.parseCertificate(n);t.push(e)}try{let n=new p.EndUserSignContainerInfo;n.type=p.EndUserConstants.EndUserSignContainerType.CAdES,n.subType=p.EndUserConstants.EndUserCAdESType.Enveloped,n.signLevel=p.EndUserConstants.EndUserSignType.CAdES_BES;let r=await this.UmCAService.signData(e,`AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=`,n),i=await this._euSignFile.VerifyDataInternal(r);return this._readedKey=new J(G.UmCAService,i[0].ownerInfo,t,e.visibleName,e.alias),this._readedKey.glSign=this.glSign,this._readedKey.keyMedia=e,this._readedKey}catch(e){throw e.message&&e.message==`KeyStoreException: KSE_INVALID_PASSWORD`?{code:p.EndUserError.EU_ERROR_BAD_PRIVATE_KEY,message:this._resourses.UmCAServiceWrongPassword}:e}}async getKeyMediasUmCAService(){return await this.setLibraryType(G.UmCAService),this.UmCAService.getKeys()}async readWindowsCertStorePrivateKey(){await this.setLibraryType(G.File);let e;try{e=await SignerDigital.getSelectedCertificate()}catch(e){throw{code:p.EndUserError.EU_ERROR_BAD_PRIVATE_KEY,message:String(e)}}e=JSON.parse(e);let t=await this.parseCertificate(e.Cert);return this._readedKey=new J(G.WindowsCertStore,t.infoEx,[t],t.infoEx.subjCN,e.CertThumbPrint),this._readedKey._glSign=this._glSign,this._readedKey}get KSPs(){return this._glSign.KSPs}async isPrivateKeyReaded(){if(!this._readedKey)return!1;if(this._readedKey.keyType===G.WindowsCertStore||this._readedKey.keyType===G.UmCAService)return!0;try{return await this._euSign.IsPrivateKeyReaded()}catch{return!1}}async resetPrivateKey(){await this._euSign.ResetPrivateKey(),this._readedKey=null}async resetKSPOperation(){await this._euSignFile.ResetOperationKSP()}async getCAs(){return await this._euSignFile.GetCAs()}async setCA(e){typeof e==`string`&&(e=(await this.getCAs()).find(t=>t.issuerCNs.find(t=>t===e))),this._selectedCA=e}needPrivateKeyCertificates(){return this._selectedCA&&!this._selectedCA.cmpAddress}async signData(e,t,n){if(t===!0?(t=new p.EndUserSignContainerInfo,t.type=p.EndUserConstants.EndUserSignContainerType.CAdES,t.subType=p.EndUserConstants.EndUserCAdESType.Enveloped,t.signLevel=p.EndUserConstants.EndUserSignType.CAdES_X_Long):k(t)&&(t=new p.EndUserSignContainerInfo,t.type=p.EndUserConstants.EndUserSignContainerType.CAdES,t.subType=p.EndUserConstants.EndUserCAdESType.Detached,t.signLevel=p.EndUserConstants.EndUserSignType.CAdES_X_Long),typeof n!=`boolean`&&(n=!1),this.readedKey.keyType===G.KSP){if(t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES&&t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};if(t.type===p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES&&(typeof this.readedKey.ksp==`object`?this.readedKey.ksp.ksp:this.readedKey.ksp)!=K.GRYADA)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignPAdESError}}if(this.readedKey.keyType===G.WindowsCertStore){if(t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};let r=await this._euSign.HashData(this._readedKey.getHashAlgo(),e,!0),i=await this._signHashWindowsCertificateStore(r,t,n);return this._euSign.m_library.m_worker.postMessage(`AppendDataToSignedData`,[i,e,!n])}if(this.readedKey.keyType===G.UmCAService){if(t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES&&t.type!==p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};return await this.UmCAService.signData(this._readedKey.keyMedia,e,t,n)}let r=this._readedKey.getSignAlgo();if(t.type===p.EndUserConstants.EndUserSignContainerType.ASiC){let i=t.signLevel||t.asicSignType===p.EndUserConstants.EndUserASiCSignType.CAdES?p.EndUserConstants.EndUserSignType.CAdES_X_Long:p.EndUserConstants.EndUserXAdESSignLevel.B_LT;return await this._euSign.ASiCSignData(r,t.subType,t.asicSignType,i,e,!n)}if(t.type===p.EndUserConstants.EndUserSignContainerType.XAdES){let i=!0;Array.isArray(e)||(e=[e],i=!1),e=e.map((e,t)=>!e.name&&!e.val?{name:`data`+t,val:e}:e);let a=t.signLevel||p.EndUserConstants.EndUserXAdESSignLevel.B_LT,o=[];for(let i=0;i<e.length;i++){let s=await this._euSign.XAdESSignData(r,t.subType,a,e[i],!n);o[i]=s}return i?o:o[0]}if(t.type===p.EndUserConstants.EndUserSignContainerType.PAdES){let i=t.signLevel||p.EndUserConstants.EndUserPAdESSignLevel.B_T;return await this._euSign.PDFSignData(r,e,i,!n)}if(t.type===p.EndUserConstants.EndUserSignContainerType.CAdES){let i=t.signLevel||p.EndUserConstants.EndUserSignType.CAdES_X_Long;if(await this._euSign.SetRuntimeParameter(p.EndUserConstants.EU_SIGN_TYPE_PARAMETER,i),t.subType===p.EndUserConstants.EndUserCAdESType.Detached){let i=await this._euSign.HashData(this._readedKey.getHashAlgo(),e,!n);return this._readedKey.keyType==3?this._signHashWindowsCertificateStore(i,t,n):await this._euSign.SignHash(r,i,!0,!n)}return await this._euSign.SignDataEx(r,e,!1,!0,!n)}throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadSignatureType}}async signFile(e,t,n){return await O(e,async e=>await this.signData(e,t,n))}async signHash(e,t){if(typeof t!=`boolean`&&(t=!1),this._readedKey.keyType==G.WindowsCertStore)return this._signHashWindowsCertificateStore(e,!1,t);if(this._readedKey.keyType==G.UmCAService)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};return await this._euSign.SignHash(this._readedKey.getSignAlgo(),e,!0,!t)}async signFileHash(e,t){return await O(e,async e=>await this.signHash(e,t))}async getSignContainerInfo(e){return await this._euSign.GetSignContainerInfo(e)}async verifyData(e,t,n){Number.isInteger(n)||(n=-1);let r=await this._euSign.GetSignContainerInfo(t.val||t);if(r.type===p.EndUserConstants.EndUserSignContainerType.ASiC)return await this._euSign.ASiCVerifyData(t.val||t,n);if(r.type===p.EndUserConstants.EndUserSignContainerType.PAdES)return await this._euSign.PDFVerifyData(t.val||t,n);if(r.type===p.EndUserConstants.EndUserSignContainerType.XAdES)return await this._euSign.XAdESVerifyData(e,t.val||t,n);if(r.type===p.EndUserConstants.EndUserSignContainerType.CAdES){if(r.subType===p.EndUserConstants.EndUserCAdESType.Enveloped)return await this._euSign.VerifyDataInternal(t.val||t,n);if(!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` data`}}return await this._euSign.VerifyData(e.val||e,t.val||t,n)}async verifyFile(e,t,n){let[r,i]=await Promise.all([m(e,`binary`),m(t,`binary`)]);return await this.verifyData(r,i,n)}async verifyDataInternal(e,t){return await this.verifyData(null,e,t)}async verifyFileInternal(e,t){let n=await m(e);return await this.verifyDataInternal(n,t)}async verifyHash(e,t,n){return Number.isInteger(n)||(n=-1),await this._euSign.VerifyHash(e.val||e,t.val||t,n)}async verifyFileHash(e,t,n){let[r,i]=await Promise.all([m(e,`binary`),m(t,`binary`)]);return await this.verifyData(r,i,n)}async signDataEx(e,t){let n=await this.signData(e,t);if(Array.isArray(e)){let t=[];for(let r=0;r<n.length;r++)t[r]=await this._formatSignInfo(e[r],n[r],!1);return t}return await this._formatSignInfo(e,n)}async signFileEx(e,t){return await O(e,async e=>await this.signDataEx(e,t))}async signHashEx(e){let t=await this.signHash(e);if(Array.isArray(e)){let n=[];for(let r=0;r<t.length;r++)n[r]=await this._formatSignInfo(e[r],t[r],!0);return n}return await this._formatSignInfo(e,t,!0)}async _formatSignInfo(e,t,n){let r=this;return await i(e.val||e,t.val||t);async function i(e,t){let i;i=n?await r.verifyHash(e,t):await r.verifyData(e,t),Array.isArray(i)&&(i=i.pop());let o=await a(t);i.ownerInfo.certBeginTime=j(o.certBeginTime),i.ownerInfo.certEndTime=j(o.certEndTime),i.ownerInfo.publicKeyType=o.publicKeyType,i.ownerInfo.keyUsageType=o.keyUsageType,i.ownerInfo.certHashType=r._readedKey.getHashAlgo();let s=i.timeInfo,c=j(s.isSignTimeStampAvail?s.signTimeStamp:s.time);switch((s.isSignTimeStampAvail||s.isTimeStamp)&&(i.ownerInfo.timestamp=j(s.isSignTimeStampAvail?s.signTimeStamp:s.time)),r._readedKey.keyType){case G.File:i.ownerInfo.privateKeyType=`FileKey`;break;case G.Token:i.ownerInfo.privateKeyType=`HardwareKey`;break;case G.UmCAService:i.ownerInfo.privateKeyType=`UmCAService`;break;case G.WindowsCertStore:i.ownerInfo.privateKeyType=`WindowsCertStore`;break;case G.KSP:i.ownerInfo.privateKeyType=r._readedKey.ksp.ksp==K.GRYADA?`GRYADA`:r._readedKey.ksp.id}return{Success:!0,Sign:t,SignatureInfo:{Success:!0,DateTimeStr:c,Signer:i.ownerInfo.subjCN,OwnerInfo:i.ownerInfo}}}async function a(e){let t=await r._euSign.GetSignContainerInfo(e),n;switch(t.type){case p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_CADES:n=await r._euSign.GetSigner(e);break;case p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_XADES:n=await r._euSign.XAdESGetSigner(e);break;case p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_PADES:n=await r._euSign.PDFGetSigner(e);break;case p.EndUserConstants.EU_SIGN_CONTAINER_TYPE_ASIC:n=await r._euSign.ASiCGetSigner(e)}return Array.isArray(n)&&(n=n.pop()),n.infoEx}}async _signHashWindowsCertificateStore(e,t,n){if(typeof n!=`boolean`&&(n=!1),t===!0?(t=new p.EndUserSignContainerInfo,t.type=p.EndUserConstants.EndUserSignContainerType.CAdES,t.subType=p.EndUserConstants.EndUserCAdESType.Enveloped,t.signLevel=p.EndUserConstants.EndUserSignType.CAdES_X_Long):k(t)&&(t=new p.EndUserSignContainerInfo,t.type=p.EndUserConstants.EndUserSignContainerType.CAdES,t.subType=p.EndUserConstants.EndUserCAdESType.Detached,t.signLevel=p.EndUserConstants.EndUserSignType.CAdES_X_Long),t.type!=p.EndUserConstants.EndUserSignContainerType.CAdES)throw{code:p.EndUserError.EU_ERROR_NOT_SUPPORTED,message:this._resourses.KSPSignFormatError};let r=`SHA256`;switch(this._readedKey.getHashAlgo()){case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA512:r=`SHA512`;break;case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA384:r=`SHA384`;break;case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA256:r=`SHA256`;break;case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA224:r=`SHA224`;break;case p.EndUserConstants.EU_CTX_HASH_ALGO_SHA160:r=`SHA160`}let i=this;async function a(e){typeof e!=`string`&&(e=v(e));let t;try{t=await SignerDigital.signHashCms(e,r,2,i._readedKey.id)}catch(e){throw{code:p.EndUserError.EU_ERROR_BAD_CERT,message:String(e)}}return await i._euSign.m_library.m_worker.postMessage(`AppendValidationData`,[t,i._readedKey.certificates[0].data,i._readedKey.getSignAlgo(),!n])}async function o(e){return e.val?{name:e.name,val:await a(e.val)}:await a(e)}if(Array.isArray(e)){let t=[];for(let n=0;n<e.length;n++){let r=e[n];t[n]=await o(r)}return t}return await o(e)}async envelopData(e,t,n){return typeof n!=`boolean`&&(n=!1),Array.isArray(e)?await Promise.all(e.map(e=>this._euSign.EnvelopData(t,e,!1,!0,!n,!1))):await this._euSign.EnvelopData(t,e,!1,!0,!n,!1)}async developData(e,t){return await this._euSign.DevelopData(e,t)}async envelopFile(e,t,n){let r;return r=Array.isArray(e)?await Promise.all(e.map(e=>m(e,`binary`))):await m(e,`binary`),await this.envelopData(r,t,n)}async developFile(e,t){let n=await m(e,`binary`);return await this.developData(n,t)}async protectTaxReports(e){return await this._euSign.ProtectTaxReports(e.accountantPrivateKeyContext?.keyContext,Array.isArray(e.directorPrivateKeyContext)?e.directorPrivateKeyContext.map(e=>e.keyContext):e.directorPrivateKeyContext?.keyContext,Array.isArray(e.stampPrivateKeyContext)?e.stampPrivateKeyContext.map(e=>e.keyContext):e.stampPrivateKeyContext?.keyContext,e.senderEMail,e.recipientCertificate,e.reports,e.returnIntermediateSign)}async ctxReadHardwareKey(e,t){if(await this.setLibraryType(G.Token),!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyMedia`};if(!e.password)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.PasswordNotSet};Array.isArray(t)&&t.length>0&&(t=await Promise.all(t.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)));try{let n=await this._euSign.CtxCreate(),r=await this._euSign.CtxReadPrivateKey(n,e,t,this._selectedIssuerCN),i=new te(G.Token,r.ownerInfo,await this._euSign.CtxGetOwnCertificates(r),e);return i.context=n,i.keyContext=r,i._glSign=this._glSign,i}catch(e){if(e&&e.code===p.EndUserError.EU_ERROR_CERT_NOT_FOUND){if(!this._selectedIssuerCN)throw{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:this._resourses.ReadPrivateKeyCAAutoDetectError};if(this._selectedIssuerCN)throw this._selectedCA.cmpAddress?{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyInvalidCAError,this._selectedIssuerCN)}:{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyNeedCertificateError,this._selectedIssuerCN)}}throw e}}async ctxReadFileKey(e,t,n){if(await this.setLibraryType(G.File),!e)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.BadParameter+` keyMedia`};if(!t)throw{code:p.EndUserError.EU_ERROR_BAD_PARAMETER,message:this._resourses.PasswordNotSet};(e instanceof File||e instanceof Blob)&&(e=await _(e)),Array.isArray(n)&&n.length>0&&(n=await Promise.all(n.map(e=>e instanceof File||e instanceof Blob?_(e):e instanceof p.EndUserCertificate?e.data:e)));try{let r=await this._euSign.CtxCreate(),i=await this._euSign.CtxReadPrivateKeyBinary(r,e,t,n,this._selectedIssuerCN),a=new ee(G.File,i.ownerInfo,await this._euSign.CtxGetOwnCertificates(i),e,t);return a.context=r,a.keyContext=i,a._glSign=this._glSign,a}catch(e){if(e&&e.code===p.EndUserError.EU_ERROR_CERT_NOT_FOUND){if(!this._selectedIssuerCN)throw{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:this._resourses.ReadPrivateKeyCAAutoDetectError};if(this._selectedIssuerCN)throw this._selectedCA.cmpAddress?{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyInvalidCAError,this._selectedIssuerCN)}:{code:p.EndUserError.EU_ERROR_CERT_NOT_FOUND,message:g(this._resourses.ReadPrivateKeyNeedCertificateError,this._selectedIssuerCN)}}throw e}}async ctxFreePrivateKey(e){e.keyType===G.Token?await this.setLibraryType(G.Token):await this.setLibraryType(G.File),await this._euSign.CtxFreePrivateKey(e.keyContext),await this._euSign.CtxFree(e.context)}async getPrivateKeyInfoFromStorage(e,t){let n=(e?localStorage:sessionStorage)[this._userId+ce],r,i=[];if(!n)return i;let a=await this._euSignFile.UnprotectDataByPassword(n,``,!0);try{r=JSON.parse(a),t>=0&&(r=r.filter(e=>e.keyType==t))}catch{r=[]}return r.forEach(e=>{let t=e.password;if(e.keyType==G.File)e.privateKey=new Uint8Array(Object.assign([],e.privateKey)),e=new ee(e.keyType,e.ownerInfo,e.certificates,e.privateKey,e.password);else if(e.keyType==G.Token)e=new te(e.keyType,e.ownerInfo,e.certificates,e.keyMedia);else if(e.keyType==G.KSP)e=new ne(e.keyType,e.ownerInfo,e.certificates,e.userId,e.ksp,e.keyId);else if(e.keyType==G.UmCAService){let t=e.keyMedia;e=new J(e.keyType,e.ownerInfo,e.certificates,e.visibleName,e.id),e.keyMedia=t}else e.keyType==G.WindowsCertStore&&(e=new J(e.keyType,e.ownerInfo,e.certificates,e.visibleName,e.id));let n=[];e.certificates.forEach(e=>{let t=Object.assign(new p.EndUserCertificate,e);t.data=new Uint8Array(Object.assign([],e.data)),n.push(t)}),e.certificates=n,e.password=t,e._glSign=this._glSign,i.push(e)}),i}async storePrivateKeyInfo(e,t){if(e.ksp&&e.ksp.needQRCode)return;let n=t?localStorage:sessionStorage,r=await this.getStoredPrivateKeyInfo();if(r.length==0||r.filter(t=>t.id==e.id).length<1){let r=await this.getPrivateKeyInfoFromStorage(t);r.push(e);let i=await this._euSignFile.ProtectDataByPassword(JSON.stringify(r),``,!0);n[this._userId+ce]=i}}async getStoredPrivateKeyInfo(e){let t=await this.getPrivateKeyInfoFromStorage(!0,e),n=await this.getPrivateKeyInfoFromStorage(!1,e);return t.concat(n)}async removeStoredPrivateKeyInfo(e){if(e===void 0)localStorage.removeItem(this._userId+ce),sessionStorage.removeItem(this._userId+ce);else{let t=await this.getPrivateKeyInfoFromStorage(!0),n=await this.getPrivateKeyInfoFromStorage(!1),r=t.filter(t=>t.id==e).length>0?localStorage:sessionStorage,i=r==localStorage?t:n,a=i.findIndex(t=>t.id==e);if(a>-1){i.splice(a,1);let e=await this._euSignFile.ProtectDataByPassword(JSON.stringify(i),``,!0);r[this._userId+ce]=e}}}get _preferredKeyType(){let e=parseInt(localStorage[this._userId+se]);return typeof e==`number`&&e>-1?e:(localStorage[this._userId+se]=G.File,G.File)}set _preferredKeyType(e){typeof e==`number`&&e>-1&&(localStorage[this._userId+se]=e)}get _resourses(){return oe[this._language]}get _userId(){return typeof this._settingsProvider.userId==`function`?this._settingsProvider.userId():this._settingsProvider.userId}get _language(){return typeof this._settingsProvider.language==`function`?this._settingsProvider.language():this._settingsProvider.language}async _diiaCheckAccess(e){let t=`DIIA`;if(sessionStorage[t]!=`+`)try{sessionStorage[t]=await m(e.address.replace(`KSPSign`,`DIIA`))}catch{throw{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:this._resourses.DiiaError+`<a target="_blank" href="${window.origin}">${window.origin}</a></li><ul>`}}try{if((await m(e.address.replace(`KSPSign`,`health`))).trim().toLowerCase()!=`healthy`)throw{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:this._resourses.DiiaHealthCheckError}}catch(e){throw console.error(e),{code:p.EndUserError.EU_ERROR_TRANSMIT_REQUEST,message:this._resourses.DiiaHealthCheckError}}}},Object.defineProperty(e,"EUSignCP",{enumerable:!0,get:function(){return p}}),e.GlSign=F,Object.defineProperty(e,"Models",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"Utils",{enumerable:!0,get:function(){return f}})});
2
2
  //# sourceMappingURL=it-digital-signature.umd.js.map