gws-client 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +19 -0
- package/dist/index.es.js +810 -666
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var xe=Object.defineProperty,Pe=Object.defineProperties;var $e=Object.getOwnPropertyDescriptors;var re=Object.getOwnPropertySymbols;var Ne=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable;var K=(s,e,t)=>e in s?xe(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,S=(s,e)=>{for(var t in e||(e={}))Ne.call(e,t)&&K(s,t,e[t]);if(re)for(var t of re(e))Le.call(e,t)&&K(s,t,e[t]);return s},E=(s,e)=>Pe(s,$e(e));var o=(s,e,t)=>K(s,typeof e!="symbol"?e+"":e,t);var l=(s,e,t)=>new Promise((n,r)=>{var i=d=>{try{c(t.next(d))}catch(u){r(u)}},a=d=>{try{c(t.throw(d))}catch(u){r(u)}},c=d=>d.done?n(d.value):Promise.resolve(d.value).then(i,a);c((t=t.apply(s,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Te=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",ie="1",ae="2";var Se=(s=>(s.MIN="0",s.LOW="1",s.MIDDLE="2",s.HIGH="3",s))(Se||{});const Me="00000001",Y="NO_SEAL_AVAILABLE",Fe="CERTIFICATE_NOT_FOUND",Ge="CLIENT_CONNECTION_FAILED";function Oe(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var F={},oe;function He(){if(oe)return F;oe=1,F.byteLength=c,F.toByteArray=u,F.fromByteArray=m;for(var s=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0,i=n.length;r<i;++r)s[r]=n[r],e[n.charCodeAt(r)]=r;e[45]=62,e[95]=63;function a(h){var f=h.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var w=h.indexOf("=");w===-1&&(w=f);var y=w===f?0:4-w%4;return[w,y]}function c(h){var f=a(h),w=f[0],y=f[1];return(w+y)*3/4-y}function d(h,f,w){return(f+w)*3/4-w}function u(h){var f,w=a(h),y=w[0],p=w[1],v=new t(d(h,y,p)),I=0,D=p>0?y-4:y,k;for(k=0;k<D;k+=4)f=e[h.charCodeAt(k)]<<18|e[h.charCodeAt(k+1)]<<12|e[h.charCodeAt(k+2)]<<6|e[h.charCodeAt(k+3)],v[I++]=f>>16&255,v[I++]=f>>8&255,v[I++]=f&255;return p===2&&(f=e[h.charCodeAt(k)]<<2|e[h.charCodeAt(k+1)]>>4,v[I++]=f&255),p===1&&(f=e[h.charCodeAt(k)]<<10|e[h.charCodeAt(k+1)]<<4|e[h.charCodeAt(k+2)]>>2,v[I++]=f>>8&255,v[I++]=f&255),v}function C(h){return s[h>>18&63]+s[h>>12&63]+s[h>>6&63]+s[h&63]}function g(h,f,w){for(var y,p=[],v=f;v<w;v+=3)y=(h[v]<<16&16711680)+(h[v+1]<<8&65280)+(h[v+2]&255),p.push(C(y));return p.join("")}function m(h){for(var f,w=h.length,y=w%3,p=[],v=16383,I=0,D=w-y;I<D;I+=v)p.push(g(h,I,I+v>D?D:I+v));return y===1?(f=h[w-1],p.push(s[f>>2]+s[f<<4&63]+"==")):y===2&&(f=(h[w-2]<<8)+h[w-1],p.push(s[f>>10]+s[f>>4&63]+s[f<<2&63]+"=")),p.join("")}return F}var Ze=He();const ce=Oe(Ze);class Ve{constructor(){o(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const n=this.deps.get(e);n==null||n(t)}}(function(){try{var s=document.createElement("style");s.appendChild(document.createTextNode("button.svelte-16iv9d0{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-16iv9d0{display:none;position:fixed;z-index:10000;left:0;top:0;width:100%;height:100%;background-color:#00000080;align-items:center;justify-content:center}.modal-content.svelte-16iv9d0{background-color:#fff;padding:1.25rem;border-radius:.3125rem;width:40%}.model-title.svelte-16iv9d0{color:#303133;font-size:1.125rem;margin-bottom:1.125rem}.modal-visible.svelte-16iv9d0{display:flex}.modal-footer.svelte-16iv9d0{display:flex;align-items:center;justify-content:flex-end;margin-top:1rem}.modal-btn.svelte-16iv9d0{padding:.5rem .9375rem;border-radius:.25rem;font-size:.875rem;border:.0625rem solid #dcdfe6}.success.svelte-16iv9d0{margin-left:.75rem;color:#fff}.slot.svelte-16iv9d0{max-height:12.5rem;overflow-y:scroll}.slot.svelte-16iv9d0::-webkit-scrollbar{display:none}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:11.25rem;height:11.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.0625rem solid #ccc;margin-top:.625rem;margin-right:.625rem;border-radius:.25rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:6.25rem;height:6.25rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.625rem;color:#333}.cert-item.svelte-1kh75ag.svelte-1kh75ag{padding:1rem;display:flex;align-items:center;cursor:pointer;border-bottom:.0625rem solid #ebeef5;font-size:1rem}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag{word-break:break-all;color:#373a40}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag:nth-child(1){padding-right:.5rem}.cert-item-selected.svelte-1kh75ag.svelte-1kh75ag{background-color:#f1f1f1}.cert-item-first.svelte-1kh75ag.svelte-1kh75ag{border-top:.0625rem solid #ebeef5}")),document.head.appendChild(s)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var je=Object.defineProperty,Ue=(s,e,t)=>e in s?je(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,le=(s,e,t)=>Ue(s,typeof e!="symbol"?e+"":e,t);function X(){}function ze(s,e){for(const t in e)s[t]=e[t];return s}function pe(s){return s()}function ue(){return Object.create(null)}function Z(s){s.forEach(pe)}function O(s){return typeof s=="function"}function ke(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}function Je(s){return Object.keys(s).length===0}function Qe(s,e,t,n){if(s){const r=ve(s,e,t,n);return s[0](r)}}function ve(s,e,t,n){return s[1]&&n?ze(t.ctx.slice(),s[1](n(e))):t.ctx}function We(s,e,t,n){if(s[2]&&n){const r=s[2](n(t));if(e.dirty===void 0)return r;if(typeof r=="object"){const i=[],a=Math.max(e.dirty.length,r.length);for(let c=0;c<a;c+=1)i[c]=e.dirty[c]|r[c];return i}return e.dirty|r}return e.dirty}function qe(s,e,t,n,r,i){if(r){const a=ve(e,t,n,i);s.p(a,r)}}function Ke(s){if(s.ctx.length>32){const e=[],t=s.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function de(s){return s==null?"":s}function B(s,e){s.appendChild(e)}function q(s,e,t){s.insertBefore(e,t||null)}function V(s){s.parentNode&&s.parentNode.removeChild(s)}function Ie(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function _(s){return document.createElement(s)}function L(s){return document.createTextNode(s)}function j(){return L(" ")}function Ye(){return L("")}function G(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function b(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function Re(s){return Array.from(s.childNodes)}function U(s,e){e=""+e,s.data!==e&&(s.data=e)}function Q(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}let ne;function H(s){ne=s}const $=[],he=[];let T=[];const ge=[],Xe=Promise.resolve();let ee=!1;function et(){ee||(ee=!0,Xe.then(Ee))}function te(s){T.push(s)}const R=new Set;let P=0;function Ee(){if(P!==0)return;const s=ne;do{try{for(;P<$.length;){const e=$[P];P++,H(e),tt(e.$$)}}catch(e){throw $.length=0,P=0,e}for(H(null),$.length=0,P=0;he.length;)he.pop()();for(let e=0;e<T.length;e+=1){const t=T[e];R.has(t)||(R.add(t),t())}T.length=0}while($.length);for(;ge.length;)ge.pop()();ee=!1,R.clear(),H(s)}function tt(s){if(s.fragment!==null){s.update(),Z(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(te)}}function nt(s){const e=[],t=[];T.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),T=e}const z=new Set;let st;function se(s,e){s&&s.i&&(z.delete(s),s.i(e))}function Be(s,e,t,n){if(s&&s.o){if(z.has(s))return;z.add(s),st.c.push(()=>{z.delete(s)}),s.o(e)}}function W(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function rt(s){s&&s.c()}function Ae(s,e,t){const{fragment:n,after_update:r}=s.$$;n&&n.m(e,t),te(()=>{const i=s.$$.on_mount.map(pe).filter(O);s.$$.on_destroy?s.$$.on_destroy.push(...i):Z(i),s.$$.on_mount=[]}),r.forEach(te)}function be(s,e){const t=s.$$;t.fragment!==null&&(nt(t.after_update),Z(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function it(s,e){s.$$.dirty[0]===-1&&($.push(s),et(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function De(s,e,t,n,r,i,a=null,c=[-1]){const d=ne;H(s);const u=s.$$={fragment:null,ctx:[],props:i,update:X,not_equal:r,bound:ue(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(d?d.$$.context:[])),callbacks:ue(),dirty:c,skip_bound:!1,root:e.target||d.$$.root};a&&a(u.root);let C=!1;if(u.ctx=t?t(s,e.props||{},(g,m,...h)=>{const f=h.length?h[0]:m;return u.ctx&&r(u.ctx[g],u.ctx[g]=f)&&(!u.skip_bound&&u.bound[g]&&u.bound[g](f),C&&it(s,g)),m}):[],u.update(),C=!0,Z(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const g=Re(e.target);u.fragment&&u.fragment.l(g),g.forEach(V)}else u.fragment&&u.fragment.c();e.intro&&se(s.$$.fragment),Ae(s,e.target,e.anchor),Ee()}H(d)}class _e{constructor(){le(this,"$$"),le(this,"$$set")}$destroy(){be(this,1),this.$destroy=X}$on(e,t){if(!O(t))return X;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const r=n.indexOf(t);r!==-1&&n.splice(r,1)}}$set(e){this.$$set&&!Je(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const at="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(at);function ot(s){let e,t,n,r=(s[1]||"标题")+"",i,a,c,d,u,C,g=(s[4]||"取消")+"",m,h,f,w=(s[5]||"确认")+"",y,p,v,I;const D=s[8].default,k=Qe(D,s,s[7],null);return{c(){e=_("div"),t=_("div"),n=_("div"),i=L(r),a=j(),c=_("div"),k&&k.c(),d=j(),u=_("div"),C=_("button"),m=L(g),h=j(),f=_("button"),y=L(w),b(n,"class","model-title svelte-16iv9d0"),b(c,"class","slot svelte-16iv9d0"),b(C,"class","modal-btn svelte-16iv9d0"),b(f,"class","modal-btn success svelte-16iv9d0"),Q(f,"background-color",s[6]),b(u,"class","modal-footer svelte-16iv9d0"),b(t,"class","modal-content svelte-16iv9d0"),b(e,"class","modal-background modal-visible svelte-16iv9d0")},m(A,x){q(A,e,x),B(e,t),B(t,n),B(n,i),B(t,a),B(t,c),k&&k.m(c,null),B(t,d),B(t,u),B(u,C),B(C,m),B(u,h),B(u,f),B(f,y),p=!0,v||(I=[G(C,"click",function(){O(s[0])&&s[0].apply(this,arguments)}),G(f,"click",function(){O(s[2])&&s[2].apply(this,arguments)}),G(t,"click",ct),G(e,"click",function(){O(s[3])&&s[3].apply(this,arguments)})],v=!0)},p(A,[x]){s=A,(!p||x&2)&&r!==(r=(s[1]||"标题")+"")&&U(i,r),k&&k.p&&(!p||x&128)&&qe(k,D,s,s[7],p?We(D,s[7],x,null):Ke(s[7]),null),(!p||x&16)&&g!==(g=(s[4]||"取消")+"")&&U(m,g),(!p||x&32)&&w!==(w=(s[5]||"确认")+"")&&U(y,w),(!p||x&64)&&Q(f,"background-color",s[6])},i(A){p||(se(k,A),p=!0)},o(A){Be(k,A),p=!1},d(A){A&&V(e),k&&k.d(A),v=!1,Z(I)}}}const ct=s=>s.stopPropagation();function lt(s,e,t){let{$$slots:n={},$$scope:r}=e,{onCancel:i}=e,{title:a}=e,{onOk:c}=e,{onClose:d}=e,{cancelText:u}=e,{okText:C}=e,{theme:g}=e;return s.$$set=m=>{"onCancel"in m&&t(0,i=m.onCancel),"title"in m&&t(1,a=m.title),"onOk"in m&&t(2,c=m.onOk),"onClose"in m&&t(3,d=m.onClose),"cancelText"in m&&t(4,u=m.cancelText),"okText"in m&&t(5,C=m.okText),"theme"in m&&t(6,g=m.theme),"$$scope"in m&&t(7,r=m.$$scope)},[i,a,c,d,u,C,g,r,n]}class ut extends _e{constructor(e){super(),De(this,e,lt,ot,ke,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function ye(s,e,t){const n=s.slice();return n[13]=e[t],n[15]=t,n}function fe(s,e,t){const n=s.slice();return n[16]=e[t],n}function Ce(s){let e,t=(s[16].format?s[16].format(s[13]):s[13][s[16].key])+"",n;return{c(){e=_("div"),n=L(t),b(e,"class","svelte-1kh75ag"),Q(e,"width",`${100/s[1].length}%`)},m(r,i){q(r,e,i),B(e,n)},p(r,i){i&3&&t!==(t=(r[16].format?r[16].format(r[13]):r[13][r[16].key])+"")&&U(n,t),i&2&&Q(e,"width",`${100/r[1].length}%`)},d(r){r&&V(e)}}}function me(s){let e,t,n,r,i,a=W(s[1]),c=[];for(let u=0;u<a.length;u+=1)c[u]=Ce(fe(s,a,u));function d(){return s[12](s[15])}return{c(){e=_("div");for(let u=0;u<c.length;u+=1)c[u].c();t=j(),b(e,"class",n=de(`cert-item ${s[15]===0?"cert-item-first":""} ${s[15]===s[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,C){q(u,e,C);for(let g=0;g<c.length;g+=1)c[g]&&c[g].m(e,null);B(e,t),r||(i=G(e,"click",d),r=!0)},p(u,C){if(s=u,C&3){a=W(s[1]);let g;for(g=0;g<a.length;g+=1){const m=fe(s,a,g);c[g]?c[g].p(m,C):(c[g]=Ce(m),c[g].c(),c[g].m(e,t))}for(;g<c.length;g+=1)c[g].d(1);c.length=a.length}C&128&&n!==(n=de(`cert-item ${s[15]===0?"cert-item-first":""} ${s[15]===s[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&b(e,"class",n)},d(u){u&&V(e),Ie(c,u),r=!1,i()}}}function dt(s){let e,t=W(s[0]),n=[];for(let r=0;r<t.length;r+=1)n[r]=me(ye(s,t,r));return{c(){for(let r=0;r<n.length;r+=1)n[r].c();e=Ye()},m(r,i){for(let a=0;a<n.length;a+=1)n[a]&&n[a].m(r,i);q(r,e,i)},p(r,i){if(i&131){t=W(r[0]);let a;for(a=0;a<t.length;a+=1){const c=ye(r,t,a);n[a]?n[a].p(c,i):(n[a]=me(c),n[a].c(),n[a].m(e.parentNode,e))}for(;a<n.length;a+=1)n[a].d(1);n.length=t.length}},d(r){r&&V(e),Ie(n,r)}}}function ht(s){let e,t;return e=new ut({props:{onOk:s[9],onClose:s[2],onCancel:s[8],cancelText:s[3],okText:s[4],title:s[6],theme:s[5],$$slots:{default:[dt]},$$scope:{ctx:s}}}),{c(){rt(e.$$.fragment)},m(n,r){Ae(e,n,r),t=!0},p(n,[r]){const i={};r&4&&(i.onClose=n[2]),r&8&&(i.cancelText=n[3]),r&16&&(i.okText=n[4]),r&64&&(i.title=n[6]),r&32&&(i.theme=n[5]),r&524419&&(i.$$scope={dirty:r,ctx:n}),e.$set(i)},i(n){t||(se(e.$$.fragment,n),t=!0)},o(n){Be(e.$$.fragment,n),t=!1},d(n){be(e,n)}}}function gt(s,e,t){let{data:n=[]}=e,{columns:r=[]}=e,{onCancel:i}=e,{onOk:a}=e,{onClose:c}=e,{cancelText:d=""}=e,{okText:u=""}=e,{theme:C="#409eff"}=e,{title:g=""}=e,m=0;const h=()=>{i(`${g}失败`),c==null||c()},f=()=>{a==null||a(n[m]),c==null||c()},w=y=>t(7,m=y);return s.$$set=y=>{"data"in y&&t(0,n=y.data),"columns"in y&&t(1,r=y.columns),"onCancel"in y&&t(10,i=y.onCancel),"onOk"in y&&t(11,a=y.onOk),"onClose"in y&&t(2,c=y.onClose),"cancelText"in y&&t(3,d=y.cancelText),"okText"in y&&t(4,u=y.okText),"theme"in y&&t(5,C=y.theme),"title"in y&&t(6,g=y.title)},[n,r,c,d,u,C,g,m,h,f,i,a,w]}class yt extends _e{constructor(e){super(),De(this,e,gt,ht,ke,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class ft{constructor(){o(this,"modalInstance",{current:null});o(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new yt({target:document.body,props:E(S({},e),{onCancel:r=>{n({code:-1,msg:r})},onOk:r=>{t(r)},onClose:()=>{this.close()}})})}));o(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const J=new ft;function Ct(s=32,e=!0,t=0){const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),r=[];if(t=t||n.length,s)for(let i=0;i<s;i++)r[i]=n[0|Math.random()*t];else{let i;r[8]=r[13]=r[18]=r[23]="-",r[14]="4";for(let a=0;a<36;a++)r[a]||(i=0|Math.random()*16,r[a]=n[a===19?i&3|8:i])}return e?(r.shift(),`u${r.join("")}`):r.join("")}const mt=[{key:"CN"},{format:s=>`${s.DevClass}(${s.sn})`}],wt=[{key:"SealId"},{key:"Vid"},{format:s=>`${s.FileName}(${s.FileSize}B)`}],we=[{key:"SealId"}];class St{constructor(e){o(this,"socketInstance",null);o(this,"eventBus",new Ve);o(this,"isRememberPin",!1);o(this,"pinPolicy");o(this,"socketConfig",null);o(this,"isConnecting",!1);o(this,"messageQueue",[]);o(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});o(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});o(this,"sendMessage",(e,t)=>new Promise((n,r)=>{var a;const i=()=>{var C,g;if(((C=this.socketInstance)==null?void 0:C.readyState)!==WebSocket.OPEN){r({errCode:Ge,msg:"数字证书客户端连接失败"});return}const c=Ct(),d=m=>{m.success?n(m.data):r(m)},u={function:e,args:[t!=null?t:{}],msgid:c};(g=this.socketInstance)==null||g.send(JSON.stringify(u)),this.eventBus.on(e,d),this.eventBus.on(c,d)};if(((a=this.socketInstance)==null?void 0:a.readyState)===WebSocket.OPEN){i();return}this.messageQueue.push(i),this.isConnecting||this.initSocket(this.socketConfig)}));o(this,"flushMsgQueue",()=>{var e;(e=this.messageQueue)==null||e.forEach(t=>t()),this.messageQueue=[]});o(this,"handleEventData",e=>l(this,null,function*(){var t,n,r,i,a,c,d,u;if(e.data instanceof Blob){const C=yield e.data.arrayBuffer(),m=new TextDecoder("gbk").decode(C),h=JSON.parse(m),f={success:(t=h.result)==null?void 0:t.success,msg:(n=h.result)==null?void 0:n.msg,errCode:(r=h.result)==null?void 0:r.errCode,data:h.data,type:(i=h.result)==null?void 0:i.event},w=(a=h.result)==null?void 0:a.function,y=(c=h.result)==null?void 0:c.msgid;y?this.eventBus.emit(y,f):this.eventBus.emit(w,f),(u=(d=this.socketConfig)==null?void 0:d.onMessage)==null||u.call(d,f)}}));o(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return ce.fromByteArray(t)});o(this,"base64Decode",e=>{const t=ce.toByteArray(e);return new TextDecoder().decode(t)});o(this,"changeIsRememberPin",e=>l(this,null,function*(){this.isRememberPin=e}));o(this,"changePinPolicy",e=>l(this,null,function*(){this.pinPolicy=e}));o(this,"checkCertIsLogin",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));o(this,"addUkeyEvents",()=>l(this,null,function*(){this.sendMessage("GZCA_WaitForDevEvent",{Type:Me}),this.eventBus.on("GZCA_OnDeviceChange",e=>{var t,n,r;(r=(t=this.socketConfig)==null?void 0:t.onUkeyChange)==null||r.call(t,E(S({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));o(this,"certLogin",e=>l(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));o(this,"getCert",(e,t,n)=>l(this,null,function*(){const r=t!=null?t:yield this.chooseCert(e);return this.isRememberPin&&n&&(yield this.certLogin(r.ContainerName)),r}));o(this,"chooseCert",e=>l(this,null,function*(){var r;const t=yield this.getCertList(e);return t!=null&&t.length?(t==null?void 0:t.length)===1?t[0]:yield J.open({title:"选择证书",data:t,columns:mt,theme:(r=this.socketConfig)==null?void 0:r.theme}):Promise.reject({errCode:Fe,msg:"暂无证书"})}));o(this,"getCertList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));o(this,"pkcs1Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1Base64Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"batchPkcs1Base64Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));o(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));o(this,"getSealList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",S({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"writeSeal",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"deleteSeal",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"getSealInfo",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"getTPSealList",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",S({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"getTPSealPic",e=>l(this,null,function*(){var n;return yield this.sendMessage("GZCA_GetSealPicData",S({IsLogin:(n=e.IsLogin)!=null?n:this.getIsLogin()},e!=null?e:{}))}));o(this,"sm2SignPreprocess1",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));o(this,"sm2SignPreprocess2",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));o(this,"pkcs1HashSign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",S({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));o(this,"pkcs7Sign",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",S({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));o(this,"pkcs7VerifySignature",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));o(this,"sm3Hash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));o(this,"sm3HexHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));o(this,"sm3FileHash",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));o(this,"sm3HashEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));o(this,"pkcs7Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));o(this,"pkcs7Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",S({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"pkcs7FileEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeSealFileEx_qyzc",e)}));o(this,"pkcs7FileDecryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeOpenFileEx_qyzc",S({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"asymmetricEncryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));o(this,"asymmetricDecryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",S({IsLogin:this.getIsLogin()},e!=null?e:{}))}));o(this,"sm4Encryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));o(this,"sm4Decryption",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));o(this,"getCertInfo",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));o(this,"getCertInfoByOid",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));o(this,"getSealVendor",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetSealIssuer",e)}));o(this,"deleteAllSealByVendor",e=>l(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",S({IsLogin:this.getIsLogin()},e!=null?e:{}))}));var t,n;this.socketConfig=e,this.initSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.pinPolicy=(n=e.pinPolicy)!=null?n:Se.MIN}initSocket(e){this.isConnecting=!0;const t=new WebSocket(e.url);return t.onerror=n=>{var r;this.isConnecting=!1,(r=e.onError)==null||r.call(e,n),this.flushMsgQueue()},t.onopen=n=>{var r;this.isConnecting=!1,(r=e.onOpen)==null||r.call(e,n),e.onUkeyChange&&this.addUkeyEvents(),this.flushMsgQueue()},t.onmessage=n=>{this.handleEventData(n)},t.onclose=n=>{var r;this.isConnecting=!1,(r=e.onClose)==null||r.call(e,n)},this.socketInstance=t,t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const N=class N{constructor(e){o(this,"coreInstance",null);o(this,"gwsConfig",{});o(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new St(E(S({},e!=null?e:{}),{url:Te}))});o(this,"appendCertBase64",(e,t=!0)=>l(this,null,function*(){if(e.CertB64)return e;const n=t?yield this.getSignatureCert():yield this.getEncryptionCert();return E(S({},e!=null?e:{}),{CertB64:n==null?void 0:n.CertB64})}));o(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});o(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});o(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});o(this,"getSignatureCert",(e,t=!0)=>l(this,null,function*(){var r;return yield(r=this.coreInstance)==null?void 0:r.getCert({CertType:ie},e,t)}));o(this,"getSignatureCertList",()=>l(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:ie})}));o(this,"getEncryptionCert",(e,t=!0)=>l(this,null,function*(){var r;return yield(r=this.coreInstance)==null?void 0:r.getCert({CertType:ae},e,t)}));o(this,"getEncryptionCertList",()=>l(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:ae})}));o(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});o(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});o(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});o(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});o(this,"pkcs1Sign",(e,t)=>l(this,null,function*(){var i,a,c;const n=yield this.getSignatureCert(t),r=yield(a=this.coreInstance)==null?void 0:a.pkcs1Sign(E(S({},e!=null?e:{}),{ContainerName:(i=n==null?void 0:n.ContainerName)!=null?i:""}));return(c=r==null?void 0:r[0])==null?void 0:c.SignData}));o(this,"pkcs1VerifySignature",e=>l(this,null,function*(){var r;const t=yield this.appendCertBase64(e),n=yield(r=this.coreInstance)==null?void 0:r.pkcs1VerifySignature(t);return Array.isArray(n)}));o(this,"pkcs1Base64Sign",(e,t)=>l(this,null,function*(){var a,c,d,u,C;const n=yield this.getSignatureCert(t),r=(c=e.DataB64)!=null?c:this.base64Encode({Data:(a=e.Data)!=null?a:""}),i=yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64Sign(E(S({},e!=null?e:{}),{ContainerName:(d=n==null?void 0:n.ContainerName)!=null?d:"",DataB64:r}));return(C=i==null?void 0:i[0])==null?void 0:C.SignData}));o(this,"batchPkcs1Base64Sign",(e,t)=>l(this,null,function*(){var C,g,m,h,f,w;const n="|",r=(g=e.DataB64)!=null?g:(C=e.Data)==null?void 0:C.map(y=>this.base64Encode({Data:y})),i=yield this.getSignatureCert(t);let a="";a=Array.isArray(r)?r==null?void 0:r.map((y,p)=>`${p}:${y}`).join(n):"";const c=yield(h=this.coreInstance)==null?void 0:h.batchPkcs1Base64Sign({ContainerName:(m=i==null?void 0:i.ContainerName)!=null?m:"",DataB64:a}),d=(w=(f=c==null?void 0:c[0])==null?void 0:f.SignData)==null?void 0:w.split(n),u=[];return d.forEach(y=>{const p=y.split(":"),v=Number(p[0]),I=p[1];u[v]=I}),u}));o(this,"pkcs1Base64VerifySignature",e=>l(this,null,function*(){var i,a,c;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(i=e.Data)!=null?i:""}),n=yield this.appendCertBase64(e);return!!(yield(c=this.coreInstance)==null?void 0:c.pkcs1Base64VerifySignature({CertB64:n.CertB64,DataB64:t,SignData:n.SignData}))}));o(this,"writeSeal",(e,t)=>l(this,null,function*(){var i,a;const n=yield this.getSignatureCert(t);return!!(yield(a=this.coreInstance)==null?void 0:a.writeSeal(E(S({},e!=null?e:{}),{ContainerName:(i=n==null?void 0:n.ContainerName)!=null?i:""})))}));o(this,"deleteSeal",e=>l(this,null,function*(){var i,a,c,d,u;const t=yield this.getSealList(e);if(!((i=t==null?void 0:t.data)!=null&&i.length))return Promise.reject({errCode:Y,msg:"暂无印章"});const n=yield J.open({title:"删除印章",data:t==null?void 0:t.data,columns:we,okText:"删除"});return!!(yield(u=this.coreInstance)==null?void 0:u.deleteSeal({ContainerName:(c=(a=t==null?void 0:t.cert)==null?void 0:a.ContainerName)!=null?c:"",SealId:(d=n==null?void 0:n.SealId)!=null?d:""}))}));o(this,"getSealList",e=>l(this,null,function*(){var r,i;const t=yield this.getSignatureCert(e),n=yield(i=this.coreInstance)==null?void 0:i.getSealList({ContainerName:(r=t==null?void 0:t.ContainerName)!=null?r:"",IsLogin:"Y"});return{cert:t,data:n}}));o(this,"getSealInfo",e=>l(this,null,function*(){var i,a,c,d,u,C,g;const t=yield this.getSealList(e);if(!((i=t==null?void 0:t.data)!=null&&i.length))return Promise.reject({errCode:Y,msg:"暂无印章"});const n=((a=t==null?void 0:t.data)==null?void 0:a.length)>1?yield J.open({title:"选择印章",data:t==null?void 0:t.data,columns:we,theme:(c=this.gwsConfig)==null?void 0:c.theme}):t==null?void 0:t.data[0],r=yield(g=this.coreInstance)==null?void 0:g.getSealInfo({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:(C=n==null?void 0:n.SealId)!=null?C:""});return r==null?void 0:r[0]}));o(this,"getTPSealList",(e,t)=>l(this,null,function*(){var i,a;const n=yield this.getSignatureCert(t),r=yield(a=this.coreInstance)==null?void 0:a.getTPSealList({ContainerName:(i=n==null?void 0:n.ContainerName)!=null?i:"",Vid:e==null?void 0:e.Vid});return{cert:n,data:r}}));o(this,"getTPSeal",(e,t)=>l(this,null,function*(){var i,a,c;const n=yield this.getTPSealList(e,t);if(!((i=n==null?void 0:n.data)!=null&&i.length))return Promise.reject({errCode:Y,msg:"暂无印章"});const r=((a=n==null?void 0:n.data)==null?void 0:a.length)===1?n==null?void 0:n.data[0]:yield J.open({title:"选择印章",data:n==null?void 0:n.data,columns:wt,theme:(c=this.gwsConfig)==null?void 0:c.theme});return{cert:n==null?void 0:n.cert,data:r}}));o(this,"getTPSealPic",(e,t)=>l(this,null,function*(){var i,a,c,d,u;const n=yield this.getTPSeal(e,t),r=yield(u=this.coreInstance)==null?void 0:u.getTPSealPic(E(S({ContainerName:(a=(i=n==null?void 0:n.cert)==null?void 0:i.ContainerName)!=null?a:""},(c=n==null?void 0:n.data)!=null?c:{}),{FileSize:String((d=n==null?void 0:n.data)==null?void 0:d.FileSize)}));return r==null?void 0:r[0]}));o(this,"sm2SignPreprocess1",e=>l(this,null,function*(){var r,i;const t=yield this.appendCertBase64(e),n=yield(r=this.coreInstance)==null?void 0:r.sm2SignPreprocess1(t);return(i=n==null?void 0:n[0])==null?void 0:i.Z}));o(this,"sm2SignPreprocess2",e=>l(this,null,function*(){var i,a;const t=this.base64Encode({Data:(i=e.Data)!=null?i:""}),n=yield this.appendCertBase64(e),r=yield(a=this.coreInstance)==null?void 0:a.sm2SignPreprocess2({CertB64:n.CertB64,DataB64:t});return r==null?void 0:r[0].H}));o(this,"pkcs1HashSign",(e,t)=>l(this,null,function*(){var i,a,c,d;const n=yield this.getSignatureCert(t),r=yield(c=this.coreInstance)==null?void 0:c.pkcs1HashSign({ContainerName:(i=n==null?void 0:n.ContainerName)!=null?i:"",DataB64:e.DataB64,HashAlg:(a=e.HashAlg)!=null?a:"sm3"});return(d=r==null?void 0:r[0])==null?void 0:d.SignData}));o(this,"pkcs1HashVerifySignature",e=>l(this,null,function*(){var r,i;const t=yield this.appendCertBase64(e);return!!(yield(i=this.coreInstance)==null?void 0:i.pkcs1HashVerifySignature(E(S({},t),{HashAlg:(r=t.HashAlg)!=null?r:"sm3"})))}));o(this,"pkcs7Sign",(e,t)=>l(this,null,function*(){var a,c,d,u,C;const n=(c=e.DataB64)!=null?c:this.base64Encode({Data:(a=e.Data)!=null?a:""}),r=yield this.getSignatureCert(t),i=yield(u=this.coreInstance)==null?void 0:u.pkcs7Sign(E(S({},e!=null?e:{}),{ContainerName:(d=r==null?void 0:r.ContainerName)!=null?d:"",DataB64:n}));return(C=i==null?void 0:i[0])==null?void 0:C.SignData}));o(this,"pkcs7VerifySignature",e=>l(this,null,function*(){var r,i,a;const t=(i=e.DataB64)!=null?i:this.base64Encode({Data:(r=e.Data)!=null?r:""});return!!(yield(a=this.coreInstance)==null?void 0:a.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));o(this,"sm3Hash",e=>l(this,null,function*(){var n,r;const t=yield(n=this.coreInstance)==null?void 0:n.sm3Hash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));o(this,"sm3HexHash",e=>l(this,null,function*(){var n,r;const t=yield(n=this.coreInstance)==null?void 0:n.sm3HexHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));o(this,"sm3FileHash",e=>l(this,null,function*(){var n,r;const t=yield(n=this.coreInstance)==null?void 0:n.sm3FileHash(e);return(r=t==null?void 0:t[0])==null?void 0:r.HashB64}));o(this,"sm3HashEncryption",e=>l(this,null,function*(){var i,a,c,d,u,C;const t=(a=e.DataB64)!=null?a:this.base64Encode({Data:(i=e.Data)!=null?i:""}),n=(d=e.KeyB64)!=null?d:this.base64Encode({Data:(c=e.Key)!=null?c:""}),r=yield(u=this.coreInstance)==null?void 0:u.sm3HashEncryption({dataB64:t,keyB64:n,alg:"sm3"});return(C=r==null?void 0:r[0])==null?void 0:C.DataB64}));o(this,"pkcs7Encryption",e=>l(this,null,function*(){var r,i,a,c;if(!e.CertB64List){const d=yield this.getEncryptionCert();e.CertB64List=d==null?void 0:d.CertB64}const t=(i=e.DataB64)!=null?i:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield(a=this.coreInstance)==null?void 0:a.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(c=n==null?void 0:n[0])==null?void 0:c.DataB64}));o(this,"pkcs7Decryption",e=>l(this,null,function*(){var i,a;const t=yield this.getEncryptionCert(),n=yield(i=this.coreInstance)==null?void 0:i.pkcs7Decryption(E(S({},e!=null?e:{}),{ContainerName:t==null?void 0:t.ContainerName})),r=(a=n==null?void 0:n[0])==null?void 0:a.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:r}):r}));o(this,"pkcs7FileEncryption",e=>l(this,null,function*(){var r,i;const t=yield this.appendCertBase64(e,!1),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7FileEncryption(t);return(i=n==null?void 0:n[0])==null?void 0:i.DataB64}));o(this,"pkcs7FileDecryption",e=>l(this,null,function*(){var r,i,a;const t=yield this.getEncryptionCert(),n=yield(i=this.coreInstance)==null?void 0:i.pkcs7FileDecryption({SrcFile:e.SrcFile,DstFile:(r=e.DstFile)!=null?r:e.SrcFile.slice(0,-4),ContainerName:t==null?void 0:t.ContainerName});return(a=n==null?void 0:n[0])==null?void 0:a.DataB64}));o(this,"asymmetricEncryption",e=>l(this,null,function*(){var r,i;const t=yield this.appendCertBase64(e,!1),n=yield(r=this.coreInstance)==null?void 0:r.asymmetricEncryption(t);return(i=n==null?void 0:n[0])==null?void 0:i.Data}));o(this,"asymmetricDecryption",(e,t)=>l(this,null,function*(){var i,a;const n=yield this.getEncryptionCert(t),r=yield(i=this.coreInstance)==null?void 0:i.asymmetricDecryption(E(S({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return(a=r==null?void 0:r[0])==null?void 0:a.Data}));o(this,"sm4Encryption",e=>l(this,null,function*(){var n;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Encryption(e);return t==null?void 0:t[0]}));o(this,"sm4Decryption",e=>l(this,null,function*(){var n,r;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Decryption(e);return(r=t==null?void 0:t[0])==null?void 0:r.Data}));o(this,"getCertInfo",e=>l(this,null,function*(){var n,r;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfo(e);return S({},(r=t==null?void 0:t[0])!=null?r:{})}));o(this,"getCertInfoByOid",e=>l(this,null,function*(){var n,r;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfoByOid(S({},e!=null?e:{}));return(r=t==null?void 0:t[0])==null?void 0:r.OidValue}));o(this,"getSealVendor",e=>l(this,null,function*(){var r;const t=yield this.getSignatureCert(e),n=yield(r=this.coreInstance)==null?void 0:r.getSealVendor({ContainerName:t==null?void 0:t.ContainerName});return n==null?void 0:n[0]}));o(this,"deleteAllSealByVendor",(e,t)=>l(this,null,function*(){var i;const n=yield this.getSignatureCert(t),r=yield(i=this.coreInstance)==null?void 0:i.deleteAllSealByVendor(E(S({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return r==null?void 0:r[0]}));return N.instance&&!(e!=null&&e.isCreateNew)?N.instance:(this.createGwsCore(e),N.instance=this,this)}};o(N,"instance",null);let M=N;function pt(s){return new Promise((e,t)=>{if(M.instance&&!(s!=null&&s.isCreateNew))e(M.instance);else{const n=new M(E(S({},s!=null?s:{}),{onOpen(r){var i;e(n),(i=s==null?void 0:s.onOpen)==null||i.call(s,r)},onClose(r){var i;t(r),(i=s==null?void 0:s.onClose)==null||i.call(s,r)}}))}})}exports.GwsService=M;exports.createService=pt;
|
|
1
|
+
"use strict";var be=Object.defineProperty,xe=Object.defineProperties;var Ne=Object.getOwnPropertyDescriptors;var re=Object.getOwnPropertySymbols;var $e=Object.prototype.hasOwnProperty,Te=Object.prototype.propertyIsEnumerable;var Y=(s,e,t)=>e in s?be(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,m=(s,e)=>{for(var t in e||(e={}))$e.call(e,t)&&Y(s,t,e[t]);if(re)for(var t of re(e))Te.call(e,t)&&Y(s,t,e[t]);return s},_=(s,e)=>xe(s,Ne(e));var a=(s,e,t)=>Y(s,typeof e!="symbol"?e+"":e,t);var c=(s,e,t)=>new Promise((n,i)=>{var r=d=>{try{l(t.next(d))}catch(u){i(u)}},o=d=>{try{l(t.throw(d))}catch(u){i(u)}},l=d=>d.done?n(d.value):Promise.resolve(d.value).then(r,o);l((t=t.apply(s,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Me=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",ae="1",oe="2";var Se=(s=>(s.MIN="0",s.LOW="1",s.MIDDLE="2",s.HIGH="3",s))(Se||{});const I={LEVEL_1:1,LEVEL_2:2,LEVEL_3:4},Fe={OPEN:I.LEVEL_1,INTERNAL:I.LEVEL_2|I.LEVEL_1,OMP:I.LEVEL_3|I.LEVEL_2|I.LEVEL_1},Ge="00000001",q="NO_SEAL_AVAILABLE",Oe="CERTIFICATE_NOT_FOUND",Ve="CLIENT_CONNECTION_FAILED",Ze="ACCESS_DENIED";function He(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var G={},ce;function Ue(){if(ce)return G;ce=1,G.byteLength=l,G.toByteArray=u,G.fromByteArray=w;for(var s=[],e=[],t=typeof Uint8Array!="undefined"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,r=n.length;i<r;++i)s[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function o(h){var f=h.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=h.indexOf("=");E===-1&&(E=f);var y=E===f?0:4-E%4;return[E,y]}function l(h){var f=o(h),E=f[0],y=f[1];return(E+y)*3/4-y}function d(h,f,E){return(f+E)*3/4-E}function u(h){var f,E=o(h),y=E[0],S=E[1],k=new t(d(h,y,S)),p=0,D=S>0?y-4:y,v;for(v=0;v<D;v+=4)f=e[h.charCodeAt(v)]<<18|e[h.charCodeAt(v+1)]<<12|e[h.charCodeAt(v+2)]<<6|e[h.charCodeAt(v+3)],k[p++]=f>>16&255,k[p++]=f>>8&255,k[p++]=f&255;return S===2&&(f=e[h.charCodeAt(v)]<<2|e[h.charCodeAt(v+1)]>>4,k[p++]=f&255),S===1&&(f=e[h.charCodeAt(v)]<<10|e[h.charCodeAt(v+1)]<<4|e[h.charCodeAt(v+2)]>>2,k[p++]=f>>8&255,k[p++]=f&255),k}function C(h){return s[h>>18&63]+s[h>>12&63]+s[h>>6&63]+s[h&63]}function g(h,f,E){for(var y,S=[],k=f;k<E;k+=3)y=(h[k]<<16&16711680)+(h[k+1]<<8&65280)+(h[k+2]&255),S.push(C(y));return S.join("")}function w(h){for(var f,E=h.length,y=E%3,S=[],k=16383,p=0,D=E-y;p<D;p+=k)S.push(g(h,p,p+k>D?D:p+k));return y===1?(f=h[E-1],S.push(s[f>>2]+s[f<<4&63]+"==")):y===2&&(f=(h[E-2]<<8)+h[E-1],S.push(s[f>>10]+s[f>>4&63]+s[f<<2&63]+"=")),S.join("")}return G}var je=Ue();const le=He(je);class Ke{constructor(){a(this,"deps",new Map)}on(e,t){this.deps.set(e,t)}emit(e,t){const n=this.deps.get(e);n==null||n(t)}}(function(){try{var s=document.createElement("style");s.appendChild(document.createTextNode("button.svelte-16iv9d0{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-16iv9d0{display:none;position:fixed;z-index:10000;left:0;top:0;width:100%;height:100%;background-color:#00000080;align-items:center;justify-content:center}.modal-content.svelte-16iv9d0{background-color:#fff;padding:1.25rem;border-radius:.3125rem;width:40%}.model-title.svelte-16iv9d0{color:#303133;font-size:1.125rem;margin-bottom:1.125rem}.modal-visible.svelte-16iv9d0{display:flex}.modal-footer.svelte-16iv9d0{display:flex;align-items:center;justify-content:flex-end;margin-top:1rem}.modal-btn.svelte-16iv9d0{padding:.5rem .9375rem;border-radius:.25rem;font-size:.875rem;border:.0625rem solid #dcdfe6}.success.svelte-16iv9d0{margin-left:.75rem;color:#fff}.slot.svelte-16iv9d0{max-height:12.5rem;overflow-y:scroll}.slot.svelte-16iv9d0::-webkit-scrollbar{display:none}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:11.25rem;height:11.25rem;display:flex;flex-direction:column;align-items:center;justify-content:center;border:.0625rem solid #ccc;margin-top:.625rem;margin-right:.625rem;border-radius:.25rem}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:6.25rem;height:6.25rem}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:.625rem;color:#333}.cert-item.svelte-1kh75ag.svelte-1kh75ag{padding:1rem;display:flex;align-items:center;cursor:pointer;border-bottom:.0625rem solid #ebeef5;font-size:1rem}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag{word-break:break-all;color:#373a40}.cert-item.svelte-1kh75ag>div.svelte-1kh75ag:nth-child(1){padding-right:.5rem}.cert-item-selected.svelte-1kh75ag.svelte-1kh75ag{background-color:#f1f1f1}.cert-item-first.svelte-1kh75ag.svelte-1kh75ag{border-top:.0625rem solid #ebeef5}")),document.head.appendChild(s)}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var ze=Object.defineProperty,Qe=(s,e,t)=>e in s?ze(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,ue=(s,e,t)=>Qe(s,typeof e!="symbol"?e+"":e,t);function ee(){}function We(s,e){for(const t in e)s[t]=e[t];return s}function ve(s){return s()}function de(){return Object.create(null)}function U(s){s.forEach(ve)}function Z(s){return typeof s=="function"}function ke(s,e){return s!=s?e==e:s!==e||s&&typeof s=="object"||typeof s=="function"}function Je(s){return Object.keys(s).length===0}function Re(s,e,t,n){if(s){const i=Ie(s,e,t,n);return s[0](i)}}function Ie(s,e,t,n){return s[1]&&n?We(t.ctx.slice(),s[1](n(e))):t.ctx}function Ye(s,e,t,n){if(s[2]&&n){const i=s[2](n(t));if(e.dirty===void 0)return i;if(typeof i=="object"){const r=[],o=Math.max(e.dirty.length,i.length);for(let l=0;l<o;l+=1)r[l]=e.dirty[l]|i[l];return r}return e.dirty|i}return e.dirty}function qe(s,e,t,n,i,r){if(i){const o=Ie(e,t,n,r);s.p(o,i)}}function Xe(s){if(s.ctx.length>32){const e=[],t=s.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function he(s){return s==null?"":s}function L(s,e){s.appendChild(e)}function R(s,e,t){s.insertBefore(e,t||null)}function j(s){s.parentNode&&s.parentNode.removeChild(s)}function pe(s,e){for(let t=0;t<s.length;t+=1)s[t]&&s[t].d(e)}function P(s){return document.createElement(s)}function T(s){return document.createTextNode(s)}function K(){return T(" ")}function et(){return T("")}function O(s,e,t,n){return s.addEventListener(e,t,n),()=>s.removeEventListener(e,t,n)}function B(s,e,t){t==null?s.removeAttribute(e):s.getAttribute(e)!==t&&s.setAttribute(e,t)}function tt(s){return Array.from(s.childNodes)}function z(s,e){e=""+e,s.data!==e&&(s.data=e)}function W(s,e,t,n){t==null?s.style.removeProperty(e):s.style.setProperty(e,t,"")}let se;function H(s){se=s}const N=[],ge=[];let M=[];const ye=[],nt=Promise.resolve();let te=!1;function st(){te||(te=!0,nt.then(_e))}function ne(s){M.push(s)}const X=new Set;let x=0;function _e(){if(x!==0)return;const s=se;do{try{for(;x<N.length;){const e=N[x];x++,H(e),it(e.$$)}}catch(e){throw N.length=0,x=0,e}for(H(null),N.length=0,x=0;ge.length;)ge.pop()();for(let e=0;e<M.length;e+=1){const t=M[e];X.has(t)||(X.add(t),t())}M.length=0}while(N.length);for(;ye.length;)ye.pop()();te=!1,X.clear(),H(s)}function it(s){if(s.fragment!==null){s.update(),U(s.before_update);const e=s.dirty;s.dirty=[-1],s.fragment&&s.fragment.p(s.ctx,e),s.after_update.forEach(ne)}}function rt(s){const e=[],t=[];M.forEach(n=>s.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),M=e}const Q=new Set;let at;function ie(s,e){s&&s.i&&(Q.delete(s),s.i(e))}function Le(s,e,t,n){if(s&&s.o){if(Q.has(s))return;Q.add(s),at.c.push(()=>{Q.delete(s)}),s.o(e)}}function J(s){return(s==null?void 0:s.length)!==void 0?s:Array.from(s)}function ot(s){s&&s.c()}function Ae(s,e,t){const{fragment:n,after_update:i}=s.$$;n&&n.m(e,t),ne(()=>{const r=s.$$.on_mount.map(ve).filter(Z);s.$$.on_destroy?s.$$.on_destroy.push(...r):U(r),s.$$.on_mount=[]}),i.forEach(ne)}function Be(s,e){const t=s.$$;t.fragment!==null&&(rt(t.after_update),U(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function ct(s,e){s.$$.dirty[0]===-1&&(N.push(s),st(),s.$$.dirty.fill(0)),s.$$.dirty[e/31|0]|=1<<e%31}function De(s,e,t,n,i,r,o=null,l=[-1]){const d=se;H(s);const u=s.$$={fragment:null,ctx:[],props:r,update:ee,not_equal:i,bound:de(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(d?d.$$.context:[])),callbacks:de(),dirty:l,skip_bound:!1,root:e.target||d.$$.root};o&&o(u.root);let C=!1;if(u.ctx=t?t(s,e.props||{},(g,w,...h)=>{const f=h.length?h[0]:w;return u.ctx&&i(u.ctx[g],u.ctx[g]=f)&&(!u.skip_bound&&u.bound[g]&&u.bound[g](f),C&&ct(s,g)),w}):[],u.update(),C=!0,U(u.before_update),u.fragment=n?n(u.ctx):!1,e.target){if(e.hydrate){const g=tt(e.target);u.fragment&&u.fragment.l(g),g.forEach(j)}else u.fragment&&u.fragment.c();e.intro&&ie(s.$$.fragment),Ae(s,e.target,e.anchor),_e()}H(d)}class Pe{constructor(){ue(this,"$$"),ue(this,"$$set")}$destroy(){Be(this,1),this.$destroy=ee}$on(e,t){if(!Z(t))return ee;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!Je(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const lt="4";typeof window!="undefined"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(lt);function ut(s){let e,t,n,i=(s[1]||"标题")+"",r,o,l,d,u,C,g=(s[4]||"取消")+"",w,h,f,E=(s[5]||"确认")+"",y,S,k,p;const D=s[8].default,v=Re(D,s,s[7],null);return{c(){e=P("div"),t=P("div"),n=P("div"),r=T(i),o=K(),l=P("div"),v&&v.c(),d=K(),u=P("div"),C=P("button"),w=T(g),h=K(),f=P("button"),y=T(E),B(n,"class","model-title svelte-16iv9d0"),B(l,"class","slot svelte-16iv9d0"),B(C,"class","modal-btn svelte-16iv9d0"),B(f,"class","modal-btn success svelte-16iv9d0"),W(f,"background-color",s[6]),B(u,"class","modal-footer svelte-16iv9d0"),B(t,"class","modal-content svelte-16iv9d0"),B(e,"class","modal-background modal-visible svelte-16iv9d0")},m(A,b){R(A,e,b),L(e,t),L(t,n),L(n,r),L(t,o),L(t,l),v&&v.m(l,null),L(t,d),L(t,u),L(u,C),L(C,w),L(u,h),L(u,f),L(f,y),S=!0,k||(p=[O(C,"click",function(){Z(s[0])&&s[0].apply(this,arguments)}),O(f,"click",function(){Z(s[2])&&s[2].apply(this,arguments)}),O(t,"click",dt),O(e,"click",function(){Z(s[3])&&s[3].apply(this,arguments)})],k=!0)},p(A,[b]){s=A,(!S||b&2)&&i!==(i=(s[1]||"标题")+"")&&z(r,i),v&&v.p&&(!S||b&128)&&qe(v,D,s,s[7],S?Ye(D,s[7],b,null):Xe(s[7]),null),(!S||b&16)&&g!==(g=(s[4]||"取消")+"")&&z(w,g),(!S||b&32)&&E!==(E=(s[5]||"确认")+"")&&z(y,E),(!S||b&64)&&W(f,"background-color",s[6])},i(A){S||(ie(v,A),S=!0)},o(A){Le(v,A),S=!1},d(A){A&&j(e),v&&v.d(A),k=!1,U(p)}}}const dt=s=>s.stopPropagation();function ht(s,e,t){let{$$slots:n={},$$scope:i}=e,{onCancel:r}=e,{title:o}=e,{onOk:l}=e,{onClose:d}=e,{cancelText:u}=e,{okText:C}=e,{theme:g}=e;return s.$$set=w=>{"onCancel"in w&&t(0,r=w.onCancel),"title"in w&&t(1,o=w.title),"onOk"in w&&t(2,l=w.onOk),"onClose"in w&&t(3,d=w.onClose),"cancelText"in w&&t(4,u=w.cancelText),"okText"in w&&t(5,C=w.okText),"theme"in w&&t(6,g=w.theme),"$$scope"in w&&t(7,i=w.$$scope)},[r,o,l,d,u,C,g,i,n]}class gt extends Pe{constructor(e){super(),De(this,e,ht,ut,ke,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5,theme:6})}}function fe(s,e,t){const n=s.slice();return n[13]=e[t],n[15]=t,n}function Ce(s,e,t){const n=s.slice();return n[16]=e[t],n}function we(s){let e,t=(s[16].format?s[16].format(s[13]):s[13][s[16].key])+"",n;return{c(){e=P("div"),n=T(t),B(e,"class","svelte-1kh75ag"),W(e,"width",`${100/s[1].length}%`)},m(i,r){R(i,e,r),L(e,n)},p(i,r){r&3&&t!==(t=(i[16].format?i[16].format(i[13]):i[13][i[16].key])+"")&&z(n,t),r&2&&W(e,"width",`${100/i[1].length}%`)},d(i){i&&j(e)}}}function me(s){let e,t,n,i,r,o=J(s[1]),l=[];for(let u=0;u<o.length;u+=1)l[u]=we(Ce(s,o,u));function d(){return s[12](s[15])}return{c(){e=P("div");for(let u=0;u<l.length;u+=1)l[u].c();t=K(),B(e,"class",n=he(`cert-item ${s[15]===0?"cert-item-first":""} ${s[15]===s[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")},m(u,C){R(u,e,C);for(let g=0;g<l.length;g+=1)l[g]&&l[g].m(e,null);L(e,t),i||(r=O(e,"click",d),i=!0)},p(u,C){if(s=u,C&3){o=J(s[1]);let g;for(g=0;g<o.length;g+=1){const w=Ce(s,o,g);l[g]?l[g].p(w,C):(l[g]=we(w),l[g].c(),l[g].m(e,t))}for(;g<l.length;g+=1)l[g].d(1);l.length=o.length}C&128&&n!==(n=he(`cert-item ${s[15]===0?"cert-item-first":""} ${s[15]===s[7]?"cert-item-selected":""}`)+" svelte-1kh75ag")&&B(e,"class",n)},d(u){u&&j(e),pe(l,u),i=!1,r()}}}function yt(s){let e,t=J(s[0]),n=[];for(let i=0;i<t.length;i+=1)n[i]=me(fe(s,t,i));return{c(){for(let i=0;i<n.length;i+=1)n[i].c();e=et()},m(i,r){for(let o=0;o<n.length;o+=1)n[o]&&n[o].m(i,r);R(i,e,r)},p(i,r){if(r&131){t=J(i[0]);let o;for(o=0;o<t.length;o+=1){const l=fe(i,t,o);n[o]?n[o].p(l,r):(n[o]=me(l),n[o].c(),n[o].m(e.parentNode,e))}for(;o<n.length;o+=1)n[o].d(1);n.length=t.length}},d(i){i&&j(e),pe(n,i)}}}function ft(s){let e,t;return e=new gt({props:{onOk:s[9],onClose:s[2],onCancel:s[8],cancelText:s[3],okText:s[4],title:s[6],theme:s[5],$$slots:{default:[yt]},$$scope:{ctx:s}}}),{c(){ot(e.$$.fragment)},m(n,i){Ae(e,n,i),t=!0},p(n,[i]){const r={};i&4&&(r.onClose=n[2]),i&8&&(r.cancelText=n[3]),i&16&&(r.okText=n[4]),i&64&&(r.title=n[6]),i&32&&(r.theme=n[5]),i&524419&&(r.$$scope={dirty:i,ctx:n}),e.$set(r)},i(n){t||(ie(e.$$.fragment,n),t=!0)},o(n){Le(e.$$.fragment,n),t=!1},d(n){Be(e,n)}}}function Ct(s,e,t){let{data:n=[]}=e,{columns:i=[]}=e,{onCancel:r}=e,{onOk:o}=e,{onClose:l}=e,{cancelText:d=""}=e,{okText:u=""}=e,{theme:C="#409eff"}=e,{title:g=""}=e,w=0;const h=()=>{r(`${g}失败`),l==null||l()},f=()=>{o==null||o(n[w]),l==null||l()},E=y=>t(7,w=y);return s.$$set=y=>{"data"in y&&t(0,n=y.data),"columns"in y&&t(1,i=y.columns),"onCancel"in y&&t(10,r=y.onCancel),"onOk"in y&&t(11,o=y.onOk),"onClose"in y&&t(2,l=y.onClose),"cancelText"in y&&t(3,d=y.cancelText),"okText"in y&&t(4,u=y.okText),"theme"in y&&t(5,C=y.theme),"title"in y&&t(6,g=y.title)},[n,i,l,d,u,C,g,w,h,f,r,o,E]}class wt extends Pe{constructor(e){super(),De(this,e,Ct,ft,ke,{data:0,columns:1,onCancel:10,onOk:11,onClose:2,cancelText:3,okText:4,theme:5,title:6})}}class mt{constructor(){a(this,"modalInstance",{current:null});a(this,"open",e=>new Promise((t,n)=>{this.modalInstance.current=new wt({target:document.body,props:_(m({},e),{onCancel:i=>{n({code:-1,msg:i})},onOk:i=>{t(i)},onClose:()=>{this.close()}})})}));a(this,"close",()=>{setTimeout(()=>{var e;(e=this.modalInstance.current)==null||e.$destroy()})})}}const V=new mt;function Et(s=32,e=!0,t=0){const n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),i=[];if(t=t||n.length,s)for(let r=0;r<s;r++)i[r]=n[0|Math.random()*t];else{let r;i[8]=i[13]=i[18]=i[23]="-",i[14]="4";for(let o=0;o<36;o++)i[o]||(r=0|Math.random()*16,i[o]=n[o===19?r&3|8:r])}return e?(i.shift(),`u${i.join("")}`):i.join("")}const St=[{key:"CN"},{format:s=>`${s.DevClass}(${s.sn})`}],vt=[{key:"SealId"},{key:"Vid"},{format:s=>`${s.FileName}(${s.FileSize}B)`}],Ee=[{key:"SealId"}],kt=[{key:"manu"},{key:"sn"}];class It{constructor(e){a(this,"socketInstance",null);a(this,"eventBus",new Ke);a(this,"scene");a(this,"isRememberPin",!1);a(this,"pinPolicy");a(this,"socketConfig",null);a(this,"isConnecting",!1);a(this,"messageQueue",[]);a(this,"getSocketReadyState",()=>{var e;return(e=this.socketInstance)==null?void 0:e.readyState});a(this,"destroy",()=>{var e;(e=this.socketInstance)==null||e.close()});a(this,"sendMessage",(e,t,n)=>new Promise((i,r)=>{var l;const o=()=>{var g,w;if(((g=this.socketInstance)==null?void 0:g.readyState)!==WebSocket.OPEN){r({errCode:Ve,msg:"数字证书客户端连接失败"});return}const d=Et(),u=h=>{h.success?i(h.data):r(h)},C={function:e,args:t?[t]:[],msgid:d};(w=this.socketInstance)==null||w.send(JSON.stringify(C)),this.eventBus.on(e,u),this.eventBus.on(d,u)};if(n&&(this.scene&n)!==n){r({errCode:Ze,msg:"无权限执行此操作"});return}if(((l=this.socketInstance)==null?void 0:l.readyState)===WebSocket.OPEN){o();return}this.messageQueue.push(o),this.isConnecting||this.initSocket(this.socketConfig)}));a(this,"flushMsgQueue",()=>{var e;(e=this.messageQueue)==null||e.forEach(t=>t()),this.messageQueue=[]});a(this,"handleEventData",e=>c(this,null,function*(){var t,n,i,r,o,l,d,u;if(e.data instanceof Blob){const C=yield e.data.arrayBuffer(),w=new TextDecoder(navigator.userAgent.includes("Windows")?"gbk":"utf-8").decode(C),h=JSON.parse(w),f={success:(t=h.result)==null?void 0:t.success,msg:(n=h.result)==null?void 0:n.msg,errCode:(i=h.result)==null?void 0:i.errCode,data:h.data,type:(r=h.result)==null?void 0:r.event},E=(o=h.result)==null?void 0:o.function,y=(l=h.result)==null?void 0:l.msgid;y?this.eventBus.emit(y,f):this.eventBus.emit(E,f),(u=(d=this.socketConfig)==null?void 0:d.onMessage)==null||u.call(d,f)}}));a(this,"base64Encode",e=>{const t=new TextEncoder().encode(e);return le.fromByteArray(t)});a(this,"base64Decode",e=>{const t=le.toByteArray(e);return new TextDecoder().decode(t)});a(this,"changeIsRememberPin",e=>c(this,null,function*(){this.isRememberPin=e}));a(this,"changePinPolicy",e=>c(this,null,function*(){this.pinPolicy=e}));a(this,"checkCertIsLogin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",e)}));a(this,"addUkeyEvents",()=>c(this,null,function*(){this.sendMessage("GZCA_WaitForDevEvent",{Type:Ge}),this.eventBus.on("GZCA_OnDeviceChange",e=>{var t,n,i;(i=(t=this.socketConfig)==null?void 0:t.onUkeyChange)==null||i.call(t,_(m({},e),{data:(n=e.data)==null?void 0:n[0]}))})}));a(this,"certLogin",e=>c(this,null,function*(){const t=yield this.checkCertIsLogin({ContainerName:e});t!=null&&t[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:e,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));a(this,"verifyPin",e=>c(this,null,function*(){var t;yield this.sendMessage("GZCA_Login",{ContainerName:e.ContainerName,IsLogin:e.UserPin?"Y":"N",UserPin:(t=e.UserPin)!=null?t:"123456",PinPolicy:this.pinPolicy})}));a(this,"getCert",(e,t,n)=>c(this,null,function*(){const i=t!=null?t:yield this.chooseCert(e);return this.isRememberPin&&n&&(yield this.certLogin(i.ContainerName)),i}));a(this,"chooseCert",e=>c(this,null,function*(){var i;const t=yield this.getCertList(e);return t!=null&&t.length?(t==null?void 0:t.length)===1?t[0]:yield V.open({title:"选择证书",data:t,columns:St,theme:(i=this.socketConfig)==null?void 0:i.theme}):Promise.reject({errCode:Oe,msg:"暂无证书"})}));a(this,"getCertList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",e)}));a(this,"pkcs1Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"batchPkcs1Base64Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_BatchPkcs1SignDataEx",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1VerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",e)}));a(this,"pkcs1Base64VerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",e)}));a(this,"getSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"writeSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_WriteSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"deleteSeal",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DeleteSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"getSealInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ReadSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"getTPSealList",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealPicList",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"getTPSealPic",e=>c(this,null,function*(){var n;return yield this.sendMessage("GZCA_GetSealPicData",m({IsLogin:(n=e.IsLogin)!=null?n:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"sm2SignPreprocess1",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",e)}));a(this,"sm2SignPreprocess2",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",e)}));a(this,"pkcs1HashSign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",m({IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs1HashVerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",e)}));a(this,"pkcs7Sign",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",m({IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy},e!=null?e:{}))}));a(this,"pkcs7VerifySignature",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",e)}));a(this,"sm3Hash",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HashData",e)}));a(this,"sm3HexHash",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",e)}));a(this,"sm3FileHash",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",e)}));a(this,"sm3HashEncryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_HMac",e)}));a(this,"pkcs7Encryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",e)}));a(this,"pkcs7Decryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",m({IsLogin:this.getIsLogin()},e!=null?e:{}))}));a(this,"pkcs7FileEncryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeSealFileEx_qyzc",e)}));a(this,"pkcs7FileDecryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EnvelopeOpenFileEx_qyzc",m({IsLogin:this.getIsLogin()},e!=null?e:{}))}));a(this,"asymmetricEncryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",e)}));a(this,"asymmetricDecryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",m({IsLogin:this.getIsLogin()},e!=null?e:{}))}));a(this,"sm4Encryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",e)}));a(this,"sm4Decryption",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",e)}));a(this,"getCertInfo",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",e)}));a(this,"getCertInfoByOid",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",e)}));a(this,"getSealVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_GetSealIssuer",e,I.LEVEL_2)}));a(this,"deleteAllSealByVendor",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ClearSeal",m({IsLogin:this.getIsLogin()},e!=null?e:{}),I.LEVEL_2)}));a(this,"applyCert",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_ApplyCert",{manu:e.manu,sn:e.sn,keyid:e.ContainerName,type:e.type,url:e.url},I.LEVEL_3)}));a(this,"resetPin",e=>c(this,null,function*(){return yield this.sendMessage("GZCA_UnblockUserPin",m({},e!=null?e:{}),I.LEVEL_3)}));a(this,"getUKeyList",()=>c(this,null,function*(){return yield this.sendMessage("GetUKeyList",void 0,I.LEVEL_3)}));a(this,"getUKeyInfo",e=>c(this,null,function*(){return yield this.sendMessage("GetUKeyID",e!=null?e:{},I.LEVEL_3)}));var t,n,i;this.socketConfig=e,this.initSocket(e),this.isRememberPin=(t=e.isRememberPin)!=null?t:!1,this.scene=(n=e.scene)!=null?n:Fe.OPEN,this.pinPolicy=(i=e.pinPolicy)!=null?i:Se.MIN}initSocket(e){this.isConnecting=!0;const t=new WebSocket(e.url);t.onerror=n=>{var i;this.isConnecting=!1,(i=e.onError)==null||i.call(e,n),this.flushMsgQueue()},t.onopen=n=>{var i;this.isConnecting=!1,(i=e.onOpen)==null||i.call(e,n),e.onUkeyChange&&this.addUkeyEvents(),this.flushMsgQueue()},t.onmessage=n=>{this.handleEventData(n)},t.onclose=n=>{var i;this.isConnecting=!1,(i=e.onClose)==null||i.call(e,n)},this.socketInstance=t}getIsLogin(){return this.isRememberPin?"Y":"N"}}const $=class ${constructor(e){a(this,"coreInstance",null);a(this,"gwsConfig",{});a(this,"createGwsCore",e=>{this.gwsConfig=e!=null?e:{},this.coreInstance=new It(_(m({},e!=null?e:{}),{url:Me}))});a(this,"appendCertBase64",(e,t=!0)=>c(this,null,function*(){if(e.CertB64)return e;const n=t?yield this.getSignatureCert():yield this.getEncryptionCert();return _(m({},e!=null?e:{}),{CertB64:n==null?void 0:n.CertB64})}));a(this,"destroy",()=>{var e;(e=this.coreInstance)==null||e.destroy(),this.coreInstance=null});a(this,"restart",e=>{this.coreInstance&&this.destroy(),this.gwsConfig=e!=null?e:this.gwsConfig,this.createGwsCore(e)});a(this,"getSocketReadyState",()=>{var e;return(e=this.coreInstance)==null?void 0:e.getSocketReadyState()});a(this,"verifyPin",(e,t)=>c(this,null,function*(){var i,r;const n=yield this.getSignatureCert(t);return(r=this.coreInstance)==null?void 0:r.verifyPin({ContainerName:(i=n==null?void 0:n.ContainerName)!=null?i:"",UserPin:e==null?void 0:e.UserPin})}));a(this,"getSignatureCert",(e,t=!0)=>c(this,null,function*(){var i;return yield(i=this.coreInstance)==null?void 0:i.getCert({CertType:ae},e,t)}));a(this,"getSignatureCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:ae})}));a(this,"getEncryptionCert",(e,t=!0)=>c(this,null,function*(){var i;return yield(i=this.coreInstance)==null?void 0:i.getCert({CertType:oe},e,t)}));a(this,"getEncryptionCertList",()=>c(this,null,function*(){var t;return yield(t=this.coreInstance)==null?void 0:t.getCertList({CertType:oe})}));a(this,"base64Encode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Encode(e.Data)});a(this,"base64Decode",e=>{var t;return(t=this.coreInstance)==null?void 0:t.base64Decode(e.DataB64)});a(this,"changeIsRememberPin",e=>{var t;(t=this.coreInstance)==null||t.changeIsRememberPin(e)});a(this,"changePinPolicy",e=>{var t;(t=this.coreInstance)==null||t.changePinPolicy(e)});a(this,"pkcs1Sign",(e,t)=>c(this,null,function*(){var r,o,l;const n=yield this.getSignatureCert(t),i=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(_(m({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""}));return(l=i==null?void 0:i[0])==null?void 0:l.SignData}));a(this,"pkcs1VerifySignature",e=>c(this,null,function*(){var i;const t=yield this.appendCertBase64(e),n=yield(i=this.coreInstance)==null?void 0:i.pkcs1VerifySignature(t);return Array.isArray(n)}));a(this,"pkcs1Base64Sign",(e,t)=>c(this,null,function*(){var o,l,d,u,C;const n=yield this.getSignatureCert(t),i=(l=e.DataB64)!=null?l:this.base64Encode({Data:(o=e.Data)!=null?o:""}),r=yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64Sign(_(m({},e!=null?e:{}),{ContainerName:(d=n==null?void 0:n.ContainerName)!=null?d:"",DataB64:i}));return(C=r==null?void 0:r[0])==null?void 0:C.SignData}));a(this,"batchPkcs1Base64Sign",(e,t)=>c(this,null,function*(){var C,g,w,h,f,E;const n="|",i=(g=e.DataB64)!=null?g:(C=e.Data)==null?void 0:C.map(y=>this.base64Encode({Data:y})),r=yield this.getSignatureCert(t);let o="";o=Array.isArray(i)?i==null?void 0:i.map((y,S)=>`${S}:${y}`).join(n):"";const l=yield(h=this.coreInstance)==null?void 0:h.batchPkcs1Base64Sign({ContainerName:(w=r==null?void 0:r.ContainerName)!=null?w:"",DataB64:o}),d=(E=(f=l==null?void 0:l[0])==null?void 0:f.SignData)==null?void 0:E.split(n),u=[];return d.forEach(y=>{const S=y.split(":"),k=Number(S[0]),p=S[1];u[k]=p}),u}));a(this,"pkcs1Base64VerifySignature",e=>c(this,null,function*(){var r,o,l;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e);return!!(yield(l=this.coreInstance)==null?void 0:l.pkcs1Base64VerifySignature({CertB64:n.CertB64,DataB64:t,SignData:n.SignData}))}));a(this,"writeSeal",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t);return!!(yield(o=this.coreInstance)==null?void 0:o.writeSeal(_(m({},e!=null?e:{}),{ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:""})))}));a(this,"deleteSeal",e=>c(this,null,function*(){var r,o,l,d,u;const t=yield this.getSealList(e);if(!((r=t==null?void 0:t.data)!=null&&r.length))return Promise.reject({errCode:q,msg:"暂无印章"});const n=yield V.open({title:"删除印章",data:t==null?void 0:t.data,columns:Ee,okText:"删除"});return!!(yield(u=this.coreInstance)==null?void 0:u.deleteSeal({ContainerName:(l=(o=t==null?void 0:t.cert)==null?void 0:o.ContainerName)!=null?l:"",SealId:(d=n==null?void 0:n.SealId)!=null?d:""}))}));a(this,"getSealList",e=>c(this,null,function*(){var i,r;const t=yield this.getSignatureCert(e),n=yield(r=this.coreInstance)==null?void 0:r.getSealList({ContainerName:(i=t==null?void 0:t.ContainerName)!=null?i:"",IsLogin:"Y"});return{cert:t,data:n}}));a(this,"getSealInfo",e=>c(this,null,function*(){var r,o,l,d,u,C,g;const t=yield this.getSealList(e);if(!((r=t==null?void 0:t.data)!=null&&r.length))return Promise.reject({errCode:q,msg:"暂无印章"});const n=((o=t==null?void 0:t.data)==null?void 0:o.length)>1?yield V.open({title:"选择印章",data:t==null?void 0:t.data,columns:Ee,theme:(l=this.gwsConfig)==null?void 0:l.theme}):t==null?void 0:t.data[0],i=yield(g=this.coreInstance)==null?void 0:g.getSealInfo({ContainerName:(u=(d=t==null?void 0:t.cert)==null?void 0:d.ContainerName)!=null?u:"",SealId:(C=n==null?void 0:n.SealId)!=null?C:""});return i==null?void 0:i[0]}));a(this,"getTPSealList",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getSignatureCert(t),i=yield(o=this.coreInstance)==null?void 0:o.getTPSealList({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",Vid:e==null?void 0:e.Vid});return{cert:n,data:i}}));a(this,"getTPSeal",(e,t)=>c(this,null,function*(){var r,o,l;const n=yield this.getTPSealList(e,t);if(!((r=n==null?void 0:n.data)!=null&&r.length))return Promise.reject({errCode:q,msg:"暂无印章"});const i=((o=n==null?void 0:n.data)==null?void 0:o.length)===1?n==null?void 0:n.data[0]:yield V.open({title:"选择印章",data:n==null?void 0:n.data,columns:vt,theme:(l=this.gwsConfig)==null?void 0:l.theme});return{cert:n==null?void 0:n.cert,data:i}}));a(this,"getTPSealPic",(e,t)=>c(this,null,function*(){var r,o,l,d,u;const n=yield this.getTPSeal(e,t),i=yield(u=this.coreInstance)==null?void 0:u.getTPSealPic(_(m({ContainerName:(o=(r=n==null?void 0:n.cert)==null?void 0:r.ContainerName)!=null?o:""},(l=n==null?void 0:n.data)!=null?l:{}),{FileSize:String((d=n==null?void 0:n.data)==null?void 0:d.FileSize)}));return i==null?void 0:i[0]}));a(this,"sm2SignPreprocess1",e=>c(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e),n=yield(i=this.coreInstance)==null?void 0:i.sm2SignPreprocess1(t);return(r=n==null?void 0:n[0])==null?void 0:r.Z}));a(this,"sm2SignPreprocess2",e=>c(this,null,function*(){var r,o;const t=this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=yield this.appendCertBase64(e),i=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:n.CertB64,DataB64:t});return i==null?void 0:i[0].H}));a(this,"pkcs1HashSign",(e,t)=>c(this,null,function*(){var r,o,l,d;const n=yield this.getSignatureCert(t),i=yield(l=this.coreInstance)==null?void 0:l.pkcs1HashSign({ContainerName:(r=n==null?void 0:n.ContainerName)!=null?r:"",DataB64:e.DataB64,HashAlg:(o=e.HashAlg)!=null?o:"sm3"});return(d=i==null?void 0:i[0])==null?void 0:d.SignData}));a(this,"pkcs1HashVerifySignature",e=>c(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e);return!!(yield(r=this.coreInstance)==null?void 0:r.pkcs1HashVerifySignature(_(m({},t),{HashAlg:(i=t.HashAlg)!=null?i:"sm3"})))}));a(this,"pkcs7Sign",(e,t)=>c(this,null,function*(){var o,l,d,u,C;const n=(l=e.DataB64)!=null?l:this.base64Encode({Data:(o=e.Data)!=null?o:""}),i=yield this.getSignatureCert(t),r=yield(u=this.coreInstance)==null?void 0:u.pkcs7Sign(_(m({},e!=null?e:{}),{ContainerName:(d=i==null?void 0:i.ContainerName)!=null?d:"",DataB64:n}));return(C=r==null?void 0:r[0])==null?void 0:C.SignData}));a(this,"pkcs7VerifySignature",e=>c(this,null,function*(){var i,r,o;const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(i=e.Data)!=null?i:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:t,SignData:e.SignData}))}));a(this,"sm3Hash",e=>c(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm3Hash(e);return(i=t==null?void 0:t[0])==null?void 0:i.HashB64}));a(this,"sm3HexHash",e=>c(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm3HexHash(e);return(i=t==null?void 0:t[0])==null?void 0:i.HashB64}));a(this,"sm3FileHash",e=>c(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm3FileHash(e);return(i=t==null?void 0:t[0])==null?void 0:i.HashB64}));a(this,"sm3HashEncryption",e=>c(this,null,function*(){var r,o,l,d,u,C;const t=(o=e.DataB64)!=null?o:this.base64Encode({Data:(r=e.Data)!=null?r:""}),n=(d=e.KeyB64)!=null?d:this.base64Encode({Data:(l=e.Key)!=null?l:""}),i=yield(u=this.coreInstance)==null?void 0:u.sm3HashEncryption({dataB64:t,keyB64:n,alg:"sm3"});return(C=i==null?void 0:i[0])==null?void 0:C.DataB64}));a(this,"pkcs7Encryption",e=>c(this,null,function*(){var i,r,o,l;if(!e.CertB64List){const d=yield this.getEncryptionCert();e.CertB64List=d==null?void 0:d.CertB64}const t=(r=e.DataB64)!=null?r:this.base64Encode({Data:(i=e.Data)!=null?i:""}),n=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:t,CertB64List:e.CertB64List});return(l=n==null?void 0:n[0])==null?void 0:l.DataB64}));a(this,"pkcs7Decryption",e=>c(this,null,function*(){var r,o;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7Decryption(_(m({},e!=null?e:{}),{ContainerName:t==null?void 0:t.ContainerName})),i=(o=n==null?void 0:n[0])==null?void 0:o.DataB64;return e.shouldDecodeBase64?this.base64Decode({DataB64:i}):i}));a(this,"pkcs7FileEncryption",e=>c(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e,!1),n=yield(i=this.coreInstance)==null?void 0:i.pkcs7FileEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.DataB64}));a(this,"pkcs7FileDecryption",e=>c(this,null,function*(){var i,r,o;const t=yield this.getEncryptionCert(),n=yield(r=this.coreInstance)==null?void 0:r.pkcs7FileDecryption({SrcFile:e.SrcFile,DstFile:(i=e.DstFile)!=null?i:e.SrcFile.slice(0,-4),ContainerName:t==null?void 0:t.ContainerName});return(o=n==null?void 0:n[0])==null?void 0:o.DataB64}));a(this,"asymmetricEncryption",e=>c(this,null,function*(){var i,r;const t=yield this.appendCertBase64(e,!1),n=yield(i=this.coreInstance)==null?void 0:i.asymmetricEncryption(t);return(r=n==null?void 0:n[0])==null?void 0:r.Data}));a(this,"asymmetricDecryption",(e,t)=>c(this,null,function*(){var r,o;const n=yield this.getEncryptionCert(t),i=yield(r=this.coreInstance)==null?void 0:r.asymmetricDecryption(_(m({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return(o=i==null?void 0:i[0])==null?void 0:o.Data}));a(this,"sm4Encryption",e=>c(this,null,function*(){var n;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Encryption(e);return t==null?void 0:t[0]}));a(this,"sm4Decryption",e=>c(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.sm4Decryption(e);return(i=t==null?void 0:t[0])==null?void 0:i.Data}));a(this,"getCertInfo",e=>c(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfo(e);return m({},(i=t==null?void 0:t[0])!=null?i:{})}));a(this,"getCertInfoByOid",e=>c(this,null,function*(){var n,i;const t=yield(n=this.coreInstance)==null?void 0:n.getCertInfoByOid(m({},e!=null?e:{}));return(i=t==null?void 0:t[0])==null?void 0:i.OidValue}));a(this,"getSealVendor",e=>c(this,null,function*(){var i;const t=yield this.getSignatureCert(e),n=yield(i=this.coreInstance)==null?void 0:i.getSealVendor({ContainerName:t==null?void 0:t.ContainerName});return n==null?void 0:n[0]}));a(this,"deleteAllSealByVendor",(e,t)=>c(this,null,function*(){var r;const n=yield this.getSignatureCert(t),i=yield(r=this.coreInstance)==null?void 0:r.deleteAllSealByVendor(_(m({},e!=null?e:{}),{ContainerName:n==null?void 0:n.ContainerName}));return i==null?void 0:i[0]}));a(this,"getUKeyList",e=>c(this,null,function*(){var i;if(e)return e;const t=yield(i=this.coreInstance)==null?void 0:i.getUKeyList();return yield V.open({title:"选择介质",data:t,columns:kt})}));a(this,"getUKeyInfo",e=>c(this,null,function*(){var i;const t=yield this.getUKeyList(e),n=yield(i=this.coreInstance)==null?void 0:i.getUKeyInfo({manu:t==null?void 0:t.manu,sn:t==null?void 0:t.sn});return n==null?void 0:n[0]}));a(this,"applyCert",(e,t)=>c(this,null,function*(){var o;const n=yield this.getUKeyList(t),i=yield this.getUKeyInfo(n);return yield(o=this.coreInstance)==null?void 0:o.applyCert(_(m({},e!=null?e:{}),{manu:i==null?void 0:i.manu,sn:i==null?void 0:i.sn,ContainerName:i==null?void 0:i.keyid}))}));a(this,"resetPin",(e,t)=>c(this,null,function*(){var r;const n=yield this.getSignatureCert(t);return yield(r=this.coreInstance)==null?void 0:r.resetPin(_(m({},e!=null?e:{}),{manu:n==null?void 0:n.manu,sn:n==null?void 0:n.sn,ContainerName:n==null?void 0:n.ContainerName}))}));return $.instance&&!(e!=null&&e.isCreateNew)?$.instance:(this.createGwsCore(e),$.instance=this,this)}};a($,"instance",null);let F=$;function pt(s){return new Promise((e,t)=>{if(F.instance&&!(s!=null&&s.isCreateNew))e(F.instance);else{const n=new F(_(m({},s!=null?s:{}),{onOpen(i){var r;e(n),(r=s==null?void 0:s.onOpen)==null||r.call(s,i)},onClose(i){var r;t(i),(r=s==null?void 0:s.onClose)==null||r.call(s,i)}}))}})}exports.GwsService=F;exports.createService=pt;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,9 @@ export declare class GwsService {
|
|
|
21
21
|
destroy: () => void;
|
|
22
22
|
restart: (config?: Record<string, any>) => void;
|
|
23
23
|
getSocketReadyState: () => number | undefined;
|
|
24
|
+
verifyPin: (params: {
|
|
25
|
+
UserPin?: string;
|
|
26
|
+
}, curCert?: CertType) => Promise<void | undefined>;
|
|
24
27
|
getSignatureCert: (cert?: CertType, checkLogin?: boolean) => Promise<Record<string, any> | undefined>;
|
|
25
28
|
getSignatureCertList: () => Promise<CertType[] | undefined>;
|
|
26
29
|
getEncryptionCert: (cert?: CertType, checkLogin?: boolean) => Promise<Record<string, any> | undefined>;
|
|
@@ -184,6 +187,15 @@ export declare class GwsService {
|
|
|
184
187
|
deleteAllSealByVendor: (params: {
|
|
185
188
|
SealIssuer: string;
|
|
186
189
|
}, curCert?: CertType) => Promise<any>;
|
|
190
|
+
getUKeyList: (curUkey?: UkeyType) => Promise<UkeyType>;
|
|
191
|
+
getUKeyInfo: (curUkey?: UkeyType) => Promise<any>;
|
|
192
|
+
applyCert: (params: {
|
|
193
|
+
type: string;
|
|
194
|
+
url: string;
|
|
195
|
+
}, curUkey?: UkeyType) => Promise<any>;
|
|
196
|
+
resetPin: (params: {
|
|
197
|
+
url: string;
|
|
198
|
+
}, curCert?: CertType) => Promise<any>;
|
|
187
199
|
}
|
|
188
200
|
|
|
189
201
|
export declare type SelectModalColItemType = {
|
|
@@ -213,6 +225,7 @@ export declare type ServiceConfigType = {
|
|
|
213
225
|
onClose?: (event: Event) => void;
|
|
214
226
|
onUkeyChange?: (data: Record<string, unknown>) => void;
|
|
215
227
|
theme?: string;
|
|
228
|
+
scene?: number;
|
|
216
229
|
};
|
|
217
230
|
|
|
218
231
|
export declare type SocketResponseType = {
|
|
@@ -230,4 +243,10 @@ export declare type TPSeaType = {
|
|
|
230
243
|
Vid: string;
|
|
231
244
|
};
|
|
232
245
|
|
|
246
|
+
export declare type UkeyType = {
|
|
247
|
+
isLogin: boolean;
|
|
248
|
+
manu: string;
|
|
249
|
+
sn: string;
|
|
250
|
+
};
|
|
251
|
+
|
|
233
252
|
export { }
|