gws-client 0.4.4 → 0.5.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.es.js +155 -152
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var xt=Object.defineProperty,Dt=Object.defineProperties;var bt=Object.getOwnPropertyDescriptors;var et=Object.getOwnPropertySymbols;var Bt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var J=(n,t,e)=>t in n?xt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,b=(n,t)=>{for(var e in t||(t={}))Bt.call(t,e)&&J(n,e,t[e]);if(et)for(var e of et(t))St.call(t,e)&&J(n,e,t[e]);return n},B=(n,t)=>Dt(n,bt(t));var c=(n,t,e)=>J(n,typeof t!="symbol"?t+"":t,e);var l=(n,t,e)=>new Promise((s,a)=>{var r=u=>{try{i(e.next(u))}catch(h){a(h)}},o=u=>{try{i(e.throw(u))}catch(h){a(h)}},i=u=>u.done?s(u.value):Promise.resolve(u.value).then(r,o);i((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $t=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",It="1",Et="2";var ht=(n=>(n[n.MIN=0]="MIN",n[n.LOW=1]="LOW",n[n.MIDDLE=2]="MIDDLE",n[n.HIGH=3]="HIGH",n))(ht||{});const At="00000001";function _t(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var G={},nt;function Lt(){if(nt)return G;nt=1,G.byteLength=i,G.toByteArray=h,G.fromByteArray=D;for(var n=[],t=[],e=typeof Uint8Array!="undefined"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,r=s.length;a<r;++a)n[a]=s[a],t[s.charCodeAt(a)]=a;t[45]=62,t[95]=63;function o(d){var p=d.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=d.indexOf("=");f===-1&&(f=p);var v=f===p?0:4-f%4;return[f,v]}function i(d){var p=o(d),f=p[0],v=p[1];return(f+v)*3/4-v}function u(d,p,f){return(p+f)*3/4-f}function h(d){var p,f=o(d),v=f[0],w=f[1],m=new e(u(d,v,w)),k=0,A=w>0?v-4:v,C;for(C=0;C<A;C+=4)p=t[d.charCodeAt(C)]<<18|t[d.charCodeAt(C+1)]<<12|t[d.charCodeAt(C+2)]<<6|t[d.charCodeAt(C+3)],m[k++]=p>>16&255,m[k++]=p>>8&255,m[k++]=p&255;return w===2&&(p=t[d.charCodeAt(C)]<<2|t[d.charCodeAt(C+1)]>>4,m[k++]=p&255),w===1&&(p=t[d.charCodeAt(C)]<<10|t[d.charCodeAt(C+1)]<<4|t[d.charCodeAt(C+2)]>>2,m[k++]=p>>8&255,m[k++]=p&255),m}function g(d){return n[d>>18&63]+n[d>>12&63]+n[d>>6&63]+n[d&63]}function y(d,p,f){for(var v,w=[],m=p;m<f;m+=3)v=(d[m]<<16&16711680)+(d[m+1]<<8&65280)+(d[m+2]&255),w.push(g(v));return w.join("")}function D(d){for(var p,f=d.length,v=f%3,w=[],m=16383,k=0,A=f-v;k<A;k+=m)w.push(y(d,k,k+m>A?A:k+m));return v===1?(p=d[f-1],w.push(n[p>>2]+n[p<<4&63]+"==")):v===2&&(p=(d[f-2]<<8)+d[f-1],w.push(n[p>>10]+n[p>>4&63]+n[p<<2&63]+"=")),w.join("")}return G}var Pt=Lt();const st=_t(Pt);class Mt{constructor(){c(this,"deps",new Map)}on(t,e){this.deps.set(t,e)}emit(t,e){const s=this.deps.get(t);s&&s(e)}}(function(){try{var n=document.createElement("style");n.appendChild(document.createTextNode("button.svelte-n1zwga{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-n1zwga{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-n1zwga{background-color:#fff;padding:20px;border-radius:5px;width:40%}.model-title.svelte-n1zwga{color:#303133;font-size:18px;margin-bottom:16px}.modal-visible.svelte-n1zwga{display:flex}.modal-footer.svelte-n1zwga{display:flex;align-items:center;justify-content:flex-end;margin-top:16px}.modal-btn.svelte-n1zwga{padding:8px 15px;border-radius:4px;font-size:14px;border:1px solid #dcdfe6}.success.svelte-n1zwga{background-color:#409eff;margin-left:12px;color:#fff}.slot.svelte-n1zwga{max-height:200px;overflow-y:scroll}.slot.svelte-n1zwga::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:16px;display:flex;align-items:center;cursor:pointer;border-bottom:1px solid #ebeef5;font-size:14px}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:1px solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:180px;height:180px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid #ccc;margin-top:10px;margin-right:10px;border-radius:4px}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:100px;height:100px}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:10px;color:#333}")),document.head.appendChild(n)}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();var Tt=Object.defineProperty,Ht=(n,t,e)=>t in n?Tt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,at=(n,t,e)=>Ht(n,typeof t!="symbol"?t+"":t,e);function K(){}function Gt(n,t){for(const e in t)n[e]=t[e];return n}function yt(n){return n()}function rt(){return Object.create(null)}function N(n){n.forEach(yt)}function j(n){return typeof n=="function"}function pt(n,t){return n!=n?t==t:n!==t||n&&typeof n=="object"||typeof n=="function"}function Ft(n){return Object.keys(n).length===0}function jt(n,t,e,s){if(n){const a=gt(n,t,e,s);return n[0](a)}}function gt(n,t,e,s){return n[1]&&s?Gt(e.ctx.slice(),n[1](s(t))):e.ctx}function Ot(n,t,e,s){if(n[2]&&s){const a=n[2](s(e));if(t.dirty===void 0)return a;if(typeof a=="object"){const r=[],o=Math.max(t.dirty.length,a.length);for(let i=0;i<o;i+=1)r[i]=t.dirty[i]|a[i];return r}return t.dirty|a}return t.dirty}function Zt(n,t,e,s,a,r){if(a){const o=gt(t,e,s,r);n.p(o,a)}}function Nt(n){if(n.ctx.length>32){const t=[],e=n.ctx.length/32;for(let s=0;s<e;s++)t[s]=-1;return t}return-1}function ot(n){return n!=null?n:""}function x(n,t){n.appendChild(t)}function X(n,t,e){n.insertBefore(t,e||null)}function U(n){n.parentNode&&n.parentNode.removeChild(n)}function zt(n,t){for(let e=0;e<n.length;e+=1)n[e]&&n[e].d(t)}function I(n){return document.createElement(n)}function E(n){return document.createTextNode(n)}function O(){return E(" ")}function Vt(){return E("")}function F(n,t,e,s){return n.addEventListener(t,e,s),()=>n.removeEventListener(t,e,s)}function S(n,t,e){e==null?n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}function Rt(n){return Array.from(n.childNodes)}function T(n,t){t=""+t,n.data!==t&&(n.data=t)}let Y;function Z(n){Y=n}const P=[],ct=[];let H=[];const it=[],Ut=Promise.resolve();let W=!1;function Jt(){W||(W=!0,Ut.then(ft))}function Q(n){H.push(n)}const q=new Set;let L=0;function ft(){if(L!==0)return;const n=Y;do{try{for(;L<P.length;){const t=P[L];L++,Z(t),qt(t.$$)}}catch(t){throw P.length=0,L=0,t}for(Z(null),P.length=0,L=0;ct.length;)ct.pop()();for(let t=0;t<H.length;t+=1){const e=H[t];q.has(e)||(q.add(e),e())}H.length=0}while(P.length);for(;it.length;)it.pop()();W=!1,q.clear(),Z(n)}function qt(n){if(n.fragment!==null){n.update(),N(n.before_update);const t=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,t),n.after_update.forEach(Q)}}function Kt(n){const t=[],e=[];H.forEach(s=>n.indexOf(s)===-1?t.push(s):e.push(s)),e.forEach(s=>s()),H=t}const V=new Set;let Wt;function tt(n,t){n&&n.i&&(V.delete(n),n.i(t))}function mt(n,t,e,s){if(n&&n.o){if(V.has(n))return;V.add(n),Wt.c.push(()=>{V.delete(n)}),n.o(t)}}function lt(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function Qt(n){n&&n.c()}function wt(n,t,e){const{fragment:s,after_update:a}=n.$$;s&&s.m(t,e),Q(()=>{const r=n.$$.on_mount.map(yt).filter(j);n.$$.on_destroy?n.$$.on_destroy.push(...r):N(r),n.$$.on_mount=[]}),a.forEach(Q)}function Ct(n,t){const e=n.$$;e.fragment!==null&&(Kt(e.after_update),N(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Xt(n,t){n.$$.dirty[0]===-1&&(P.push(n),Jt(),n.$$.dirty.fill(0)),n.$$.dirty[t/31|0]|=1<<t%31}function vt(n,t,e,s,a,r,o=null,i=[-1]){const u=Y;Z(n);const h=n.$$={fragment:null,ctx:[],props:r,update:K,not_equal:a,bound:rt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:rt(),dirty:i,skip_bound:!1,root:t.target||u.$$.root};o&&o(h.root);let g=!1;if(h.ctx=e?e(n,t.props||{},(y,D,...d)=>{const p=d.length?d[0]:D;return h.ctx&&a(h.ctx[y],h.ctx[y]=p)&&(!h.skip_bound&&h.bound[y]&&h.bound[y](p),g&&Xt(n,y)),D}):[],h.update(),g=!0,N(h.before_update),h.fragment=s?s(h.ctx):!1,t.target){if(t.hydrate){const y=Rt(t.target);h.fragment&&h.fragment.l(y),y.forEach(U)}else h.fragment&&h.fragment.c();t.intro&&tt(n.$$.fragment),wt(n,t.target,t.anchor),ft()}Z(u)}class kt{constructor(){at(this,"$$"),at(this,"$$set")}$destroy(){Ct(this,1),this.$destroy=K}$on(t,e){if(!j(e))return K;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(e),()=>{const a=s.indexOf(e);a!==-1&&s.splice(a,1)}}$set(t){this.$$set&&!Ft(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Yt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Yt);function te(n){let t,e,s,a=(n[1]||"标题")+"",r,o,i,u,h,g,y=(n[4]||"取消")+"",D,d,p,f=(n[5]||"确认")+"",v,w,m,k;const A=n[7].default,C=jt(A,n,n[6],null);return{c(){t=I("div"),e=I("div"),s=I("div"),r=E(a),o=O(),i=I("div"),C&&C.c(),u=O(),h=I("div"),g=I("button"),D=E(y),d=O(),p=I("button"),v=E(f),S(s,"class","model-title svelte-n1zwga"),S(i,"class","slot svelte-n1zwga"),S(g,"class","modal-btn svelte-n1zwga"),S(p,"class","modal-btn success svelte-n1zwga"),S(h,"class","modal-footer svelte-n1zwga"),S(e,"class","modal-content svelte-n1zwga"),S(t,"class","modal-background modal-visible svelte-n1zwga")},m($,_){X($,t,_),x(t,e),x(e,s),x(s,r),x(e,o),x(e,i),C&&C.m(i,null),x(e,u),x(e,h),x(h,g),x(g,D),x(h,d),x(h,p),x(p,v),w=!0,m||(k=[F(g,"click",function(){j(n[0])&&n[0].apply(this,arguments)}),F(p,"click",function(){j(n[2])&&n[2].apply(this,arguments)}),F(e,"click",ee),F(t,"click",function(){j(n[3])&&n[3].apply(this,arguments)})],m=!0)},p($,[_]){n=$,(!w||_&2)&&a!==(a=(n[1]||"标题")+"")&&T(r,a),C&&C.p&&(!w||_&64)&&Zt(C,A,n,n[6],w?Ot(A,n[6],_,null):Nt(n[6]),null),(!w||_&16)&&y!==(y=(n[4]||"取消")+"")&&T(D,y),(!w||_&32)&&f!==(f=(n[5]||"确认")+"")&&T(v,f)},i($){w||(tt(C,$),w=!0)},o($){mt(C,$),w=!1},d($){$&&U(t),C&&C.d($),m=!1,N(k)}}}const ee=n=>n.stopPropagation();function ne(n,t,e){let{$$slots:s={},$$scope:a}=t,{onCancel:r}=t,{title:o}=t,{onOk:i}=t,{onClose:u}=t,{cancelText:h}=t,{okText:g}=t;return n.$$set=y=>{"onCancel"in y&&e(0,r=y.onCancel),"title"in y&&e(1,o=y.title),"onOk"in y&&e(2,i=y.onOk),"onClose"in y&&e(3,u=y.onClose),"cancelText"in y&&e(4,h=y.cancelText),"okText"in y&&e(5,g=y.okText),"$$scope"in y&&e(6,a=y.$$scope)},[r,o,i,u,h,g,a,s]}class se extends kt{constructor(t){super(),vt(this,t,ne,te,pt,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5})}}function dt(n,t,e){const s=n.slice();return s[10]=t[e],s[12]=e,s}function ut(n){let t,e,s=n[10].CN+"",a,r,o,i=n[10].DevClass+"",u,h,g=n[10].sn+"",y,D,d,p,f,v;function w(){return n[9](n[12])}return{c(){t=I("div"),e=I("span"),a=E(s),r=O(),o=I("span"),u=E(i),h=E("("),y=E(g),D=E(")"),d=O(),S(e,"class","svelte-jtc2v4"),S(o,"class","svelte-jtc2v4"),S(t,"class",p=ot(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")},m(m,k){X(m,t,k),x(t,e),x(e,a),x(t,r),x(t,o),x(o,u),x(o,h),x(o,y),x(o,D),x(t,d),f||(v=F(t,"click",w),f=!0)},p(m,k){n=m,k&1&&s!==(s=n[10].CN+"")&&T(a,s),k&1&&i!==(i=n[10].DevClass+"")&&T(u,i),k&1&&g!==(g=n[10].sn+"")&&T(y,g),k&16&&p!==(p=ot(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")&&S(t,"class",p)},d(m){m&&U(t),f=!1,v()}}}function ae(n){let t,e=lt(n[0]),s=[];for(let a=0;a<e.length;a+=1)s[a]=ut(dt(n,e,a));return{c(){for(let a=0;a<s.length;a+=1)s[a].c();t=Vt()},m(a,r){for(let o=0;o<s.length;o+=1)s[o]&&s[o].m(a,r);X(a,t,r)},p(a,r){if(r&17){e=lt(a[0]);let o;for(o=0;o<e.length;o+=1){const i=dt(a,e,o);s[o]?s[o].p(i,r):(s[o]=ut(i),s[o].c(),s[o].m(t.parentNode,t))}for(;o<s.length;o+=1)s[o].d(1);s.length=e.length}},d(a){a&&U(t),zt(s,a)}}}function re(n){let t,e;return t=new se({props:{onOk:n[6],onClose:n[1],onCancel:n[5],cancelText:n[2],okText:n[3],title:"选择证书",$$slots:{default:[ae]},$$scope:{ctx:n}}}),{c(){Qt(t.$$.fragment)},m(s,a){wt(t,s,a),e=!0},p(s,[a]){const r={};a&2&&(r.onClose=s[1]),a&4&&(r.cancelText=s[2]),a&8&&(r.okText=s[3]),a&8209&&(r.$$scope={dirty:a,ctx:s}),t.$set(r)},i(s){e||(tt(t.$$.fragment,s),e=!0)},o(s){mt(t.$$.fragment,s),e=!1},d(s){Ct(t,s)}}}function oe(n,t,e){let{certList:s=[]}=t,{onCancel:a}=t,{onOk:r}=t,{onClose:o}=t,{cancelText:i=""}=t,{okText:u=""}=t,h=0;const g=()=>{o==null||o()},y=()=>{r==null||r(s[h]),o==null||o()},D=d=>e(4,h=d);return n.$$set=d=>{"certList"in d&&e(0,s=d.certList),"onCancel"in d&&e(7,a=d.onCancel),"onOk"in d&&e(8,r=d.onOk),"onClose"in d&&e(1,o=d.onClose),"cancelText"in d&&e(2,i=d.cancelText),"okText"in d&&e(3,u=d.okText)},[s,o,i,u,h,g,y,a,r,D]}class ce extends kt{constructor(t){super(),vt(this,t,oe,re,pt,{certList:0,onCancel:7,onOk:8,onClose:1,cancelText:2,okText:3})}}class ie{constructor(){c(this,"modalInstance",{current:null});c(this,"open",t=>new Promise((e,s)=>{this.modalInstance.current=new ce({target:document.body,props:B(b({},t),{onCancel:a=>{s()},onOk:a=>{e(a)},onClose:()=>{this.close()}})})}));c(this,"close",()=>{setTimeout(()=>{var t;(t=this.modalInstance.current)==null||t.$destroy()})})}}const le=new ie;class de{constructor(t){c(this,"socketInstance",null);c(this,"eventBus",new Mt);c(this,"isRememberPin",!1);c(this,"socketEvent");c(this,"pinPolicy");c(this,"socketConfig",null);c(this,"getSocketReadyState",()=>{var t;return(t=this.socketInstance)==null?void 0:t.readyState});c(this,"destroy",()=>{var t;(t=this.socketInstance)==null||t.close()});c(this,"sendMessage",(t,e)=>new Promise((s,a)=>{var o,i;if(((o=this.socketInstance)==null?void 0:o.readyState)!==WebSocket.OPEN){console.log(t),a({errCode:-1,msg:"socket未连接"});return}const r={function:t,args:[e!=null?e:{}]};(i=this.socketInstance)==null||i.send(JSON.stringify(r)),this.eventBus.on(t,u=>{u.success?s(u.data):a(u)})}));c(this,"handleEventData",t=>l(this,null,function*(){var e,s,a,r,o,i;if(t.data instanceof Blob){const u=yield t.data.arrayBuffer(),g=new TextDecoder("gbk").decode(u),y=JSON.parse(g),D={data:y.data,success:(e=y.result)==null?void 0:e.success,msg:(s=y.result)==null?void 0:s.msg,errCode:(a=y.result)==null?void 0:a.errCode};this.eventBus.emit((r=y.result)==null?void 0:r.function,D),(i=(o=this.socketConfig)==null?void 0:o.onMessage)==null||i.call(o,D)}}));c(this,"base64Encode",t=>{const e=new TextEncoder().encode(t);return st.fromByteArray(e)});c(this,"base64Decode",t=>{const e=st.toByteArray(t);return new TextDecoder().decode(e)});c(this,"changeIsRememberPin",t=>l(this,null,function*(){this.isRememberPin=t}));c(this,"changePinPolicy",t=>l(this,null,function*(){this.pinPolicy=t}));c(this,"checkCertIsLogin",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",t)}));c(this,"addUkeyEvents",()=>l(this,null,function*(){this.sendMessage("GZCA_StartListen",{Type:At}).then(t=>{var e,s;(s=(e=this.socketConfig)==null?void 0:e.onUkeyEvent)==null||s.call(e,t)})}));c(this,"certLogin",t=>l(this,null,function*(){const e=yield this.checkCertIsLogin({ContainerName:t});e!=null&&e[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:t,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));c(this,"getCert",(t,e)=>l(this,null,function*(){const s=e!=null?e:yield this.chooseCert(t);return yield this.certLogin(s.ContainerName),s}));c(this,"getCertList",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",t)}));c(this,"chooseCert",t=>l(this,null,function*(){const e=yield this.getCertList(t);return(e==null?void 0:e.length)===1?e[0]:yield le.open({certList:e})}));c(this,"pkcs1Sign",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",B(b({},t),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1Base64Sign",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",B(b({},t),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1VerifySignature",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",t)}));c(this,"pkcs1Base64VerifySignature",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",t)}));c(this,"getSealList",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",B(b({},t),{IsLogin:this.getIsLogin()}))}));c(this,"sm2SignPreprocess1",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",t)}));c(this,"sm2SignPreprocess2",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",t)}));c(this,"pkcs1HashSign",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",B(b({},t!=null?t:{}),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1HashVerifySignature",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",t)}));c(this,"pkcs7Sign",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",B(b({},t),{IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy}))}));c(this,"pkcs7VerifySignature",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",t)}));c(this,"sm3Hash",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashData",t)}));c(this,"sm3HexHash",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",t)}));c(this,"sm3FileHash",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",t)}));c(this,"sm3HashEncryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_HMac",t)}));c(this,"pkcs7Encryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",t)}));c(this,"pkcs7Decryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",B(b({},t),{IsLogin:this.getIsLogin()}))}));c(this,"asymmetricEncryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",t)}));c(this,"asymmetricDecryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",B(b({},t),{IsLogin:this.getIsLogin()}))}));c(this,"sm4Encryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",t)}));c(this,"sm4Decryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",t)}));c(this,"getCertInfo",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",t)}));c(this,"getCertInfoByOid",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",t)}));var e,s;this.socketConfig=t,this.socketInstance=this.createSocket(t),this.isRememberPin=(e=t.isRememberPin)!=null?e:!1,this.pinPolicy=(s=t.pinPolicy)!=null?s:ht.MIN}createSocket(t){const e=new WebSocket(t.url);return e.onerror=s=>{var a;(a=t.onError)==null||a.call(t,s)},e.onopen=s=>{var a;(a=t.onOpen)==null||a.call(t,s),this.addUkeyEvents()},e.onmessage=s=>{this.handleEventData(s)},e.onclose=s=>{var a;(a=t.onClose)==null||a.call(t,s)},e}getIsLogin(){return this.isRememberPin?"Y":"N"}}const M=class M{constructor(t){c(this,"coreInstance",null);c(this,"gwsConfig",{});c(this,"createGwsCore",t=>{this.gwsConfig=t!=null?t:{},this.coreInstance=new de(B(b({},t!=null?t:{}),{url:$t}))});c(this,"appendCertBase64",(t,e=!0)=>l(this,null,function*(){if(t.CertB64)return t;const s=e?yield this.getSignatureCert():yield this.getEncryptionCert();return B(b({},t!=null?t:{}),{CertB64:s==null?void 0:s.CertB64})}));c(this,"destroy",()=>{var t;(t=this.coreInstance)==null||t.destroy(),this.coreInstance=null});c(this,"restart",t=>{this.coreInstance&&this.destroy(),this.gwsConfig=t!=null?t:this.gwsConfig,this.createGwsCore(t)});c(this,"getSocketReadyState",()=>{var t;return(t=this.coreInstance)==null?void 0:t.getSocketReadyState()});c(this,"getSignatureCert",t=>l(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:It},t)}));c(this,"getEncryptionCert",t=>l(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:Et},t)}));c(this,"base64Encode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Encode(t.Data)});c(this,"base64Decode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Decode(t.DataB64)});c(this,"changeIsRememberPin",t=>{var e;(e=this.coreInstance)==null||e.changeIsRememberPin(t)});c(this,"changePinPolicy",t=>{var e;(e=this.coreInstance)==null||e.changePinPolicy(t)});c(this,"pkcs1Sign",(t,e)=>l(this,null,function*(){var r,o,i;const s=yield this.getSignatureCert(e),a=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(B(b({},t!=null?t:{}),{ContainerName:(r=s==null?void 0:s.ContainerName)!=null?r:""}));return(i=a==null?void 0:a[0])==null?void 0:i.SignData}));c(this,"pkcs1VerifySignature",t=>l(this,null,function*(){var a;const e=yield this.appendCertBase64(t),s=yield(a=this.coreInstance)==null?void 0:a.pkcs1VerifySignature(e);return Array.isArray(s)}));c(this,"pkcs1Base64Sign",(t,e)=>l(this,null,function*(){var o,i,u,h,g;const s=yield this.getSignatureCert(e),a=(i=t.DataB64)!=null?i:this.base64Encode({Data:(o=t.Data)!=null?o:""}),r=yield(h=this.coreInstance)==null?void 0:h.pkcs1Base64Sign({ContainerName:(u=s==null?void 0:s.ContainerName)!=null?u:"",DataB64:a});return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));c(this,"pkcs1Base64VerifySignature",t=>l(this,null,function*(){var r,o,i;const e=(o=t.DataB64)!=null?o:this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=yield this.appendCertBase64(t);return!!(yield(i=this.coreInstance)==null?void 0:i.pkcs1Base64VerifySignature({CertB64:s.CertB64,DataB64:e,SignData:s.SignData}))}));c(this,"getSealList",()=>l(this,null,function*(){var s,a;const t=yield this.getSignatureCert(),e=yield(a=this.coreInstance)==null?void 0:a.getSealList({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:""});return{cert:t,sealList:e}}));c(this,"sm2SignPreprocess1",t=>l(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t),s=yield(a=this.coreInstance)==null?void 0:a.sm2SignPreprocess1(e);return(r=s==null?void 0:s[0])==null?void 0:r.Z}));c(this,"sm2SignPreprocess2",t=>l(this,null,function*(){var r,o;const e=this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=yield this.appendCertBase64(t),a=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:s.CertB64,DataB64:e});return a==null?void 0:a[0].H}));c(this,"pkcs1HashSign",(t,e)=>l(this,null,function*(){var r,o,i,u;const s=yield this.getSignatureCert(e),a=yield(i=this.coreInstance)==null?void 0:i.pkcs1HashSign({ContainerName:(r=s==null?void 0:s.ContainerName)!=null?r:"",DataB64:t.DataB64,HashAlg:(o=t.HashAlg)!=null?o:"sm3"});return(u=a==null?void 0:a[0])==null?void 0:u.SignData}));c(this,"pkcs1HashVerifySignature",t=>l(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t);return!!(yield(r=this.coreInstance)==null?void 0:r.pkcs1HashVerifySignature(B(b({},e),{HashAlg:(a=e.HashAlg)!=null?a:"sm3"})))}));c(this,"pkcs7Sign",(t,e)=>l(this,null,function*(){var o,i,u,h,g;const s=(i=t.DataB64)!=null?i:this.base64Encode({Data:(o=t.Data)!=null?o:""}),a=yield this.getSignatureCert(e),r=yield(h=this.coreInstance)==null?void 0:h.pkcs7Sign({IsDetached:t.IsDetached,ContainerName:(u=a==null?void 0:a.ContainerName)!=null?u:"",DataB64:s});return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));c(this,"pkcs7VerifySignature",t=>l(this,null,function*(){var a,r,o;const e=(r=t.DataB64)!=null?r:this.base64Encode({Data:(a=t.Data)!=null?a:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:e,SignData:t.SignData}))}));c(this,"sm3Hash",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3Hash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3HexHash",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3HexHash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3FileHash",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3FileHash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3HashEncryption",t=>l(this,null,function*(){var r,o,i,u,h,g;const e=(o=t.DataB64)!=null?o:this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=(u=t.KeyB64)!=null?u:this.base64Encode({Data:(i=t.Key)!=null?i:""}),a=yield(h=this.coreInstance)==null?void 0:h.sm3HashEncryption({dataB64:e,keyB64:s,alg:"sm3"});return(g=a==null?void 0:a[0])==null?void 0:g.DataB64}));c(this,"pkcs7Encryption",t=>l(this,null,function*(){var a,r,o,i;if(!t.CertB64List){const u=yield this.getEncryptionCert();t.CertB64List=u==null?void 0:u.CertB64}const e=(r=t.DataB64)!=null?r:this.base64Encode({Data:(a=t.Data)!=null?a:""}),s=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:e,CertB64List:t.CertB64List});return(i=s==null?void 0:s[0])==null?void 0:i.DataB64}));c(this,"pkcs7Decryption",t=>l(this,null,function*(){var r,o;const e=yield this.getEncryptionCert(),s=yield(r=this.coreInstance)==null?void 0:r.pkcs7Decryption({DataB64:t.DataB64,ContainerName:e==null?void 0:e.ContainerName}),a=(o=s==null?void 0:s[0])==null?void 0:o.DataB64;return t.shouldDecodeBase64?this.base64Decode({DataB64:a}):a}));c(this,"asymmetricEncryption",t=>l(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t,!1),s=yield(a=this.coreInstance)==null?void 0:a.asymmetricEncryption(e);return(r=s==null?void 0:s[0])==null?void 0:r.Data}));c(this,"asymmetricDecryption",t=>l(this,null,function*(){var a,r;const e=yield this.getEncryptionCert(),s=yield(a=this.coreInstance)==null?void 0:a.asymmetricDecryption({Data:t.Data,ContainerName:e==null?void 0:e.ContainerName});return(r=s==null?void 0:s[0])==null?void 0:r.Data}));c(this,"sm4Encryption",t=>l(this,null,function*(){var s;const e=yield(s=this.coreInstance)==null?void 0:s.sm4Encryption(t);return e==null?void 0:e[0]}));c(this,"sm4Decryption",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm4Decryption(t);return(a=e==null?void 0:e[0])==null?void 0:a.Data}));c(this,"getCertInfo",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(t);return b({},(a=e==null?void 0:e[0])!=null?a:{})}));c(this,"getCertInfoByOid",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.getCertInfoByOid(b({},t!=null?t:{}));return(a=e==null?void 0:e[0])==null?void 0:a.OidValue}));return M.instance&&!(t!=null&&t.isCreateNew)?M.instance:(this.createGwsCore(t),M.instance=this,this)}};c(M,"instance",null);let R=M,z=null;function ue(n){return new Promise((t,e)=>{z&&t(z);const s=new R(B(b({},n!=null?n:{}),{onOpen(a){var r;z=s,t(s),(r=n==null?void 0:n.onOpen)==null||r.call(n,a)},onClose(a){var r;z=null,e(a),(r=n==null?void 0:n.onClose)==null||r.call(n,a)}}))})}exports.GwsService=R;exports.createService=ue;
|
|
1
|
+
"use strict";var kt=Object.defineProperty,xt=Object.defineProperties;var Dt=Object.getOwnPropertyDescriptors;var tt=Object.getOwnPropertySymbols;var bt=Object.prototype.hasOwnProperty,Bt=Object.prototype.propertyIsEnumerable;var U=(n,t,e)=>t in n?kt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,b=(n,t)=>{for(var e in t||(t={}))bt.call(t,e)&&U(n,e,t[e]);if(tt)for(var e of tt(t))Bt.call(t,e)&&U(n,e,t[e]);return n},B=(n,t)=>xt(n,Dt(t));var c=(n,t,e)=>U(n,typeof t!="symbol"?t+"":t,e);var l=(n,t,e)=>new Promise((s,a)=>{var r=u=>{try{i(e.next(u))}catch(h){a(h)}},o=u=>{try{i(e.throw(u))}catch(h){a(h)}},i=u=>u.done?s(u.value):Promise.resolve(u.value).then(r,o);i((e=e.apply(n,t)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const St=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",$t="1",It="2";var ut=(n=>(n[n.MIN=0]="MIN",n[n.LOW=1]="LOW",n[n.MIDDLE=2]="MIDDLE",n[n.HIGH=3]="HIGH",n))(ut||{});const Et="00000001";function At(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var F={},et;function _t(){if(et)return F;et=1,F.byteLength=i,F.toByteArray=h,F.fromByteArray=D;for(var n=[],t=[],e=typeof Uint8Array!="undefined"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,r=s.length;a<r;++a)n[a]=s[a],t[s.charCodeAt(a)]=a;t[45]=62,t[95]=63;function o(d){var p=d.length;if(p%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=d.indexOf("=");f===-1&&(f=p);var v=f===p?0:4-f%4;return[f,v]}function i(d){var p=o(d),f=p[0],v=p[1];return(f+v)*3/4-v}function u(d,p,f){return(p+f)*3/4-f}function h(d){var p,f=o(d),v=f[0],w=f[1],m=new e(u(d,v,w)),k=0,A=w>0?v-4:v,C;for(C=0;C<A;C+=4)p=t[d.charCodeAt(C)]<<18|t[d.charCodeAt(C+1)]<<12|t[d.charCodeAt(C+2)]<<6|t[d.charCodeAt(C+3)],m[k++]=p>>16&255,m[k++]=p>>8&255,m[k++]=p&255;return w===2&&(p=t[d.charCodeAt(C)]<<2|t[d.charCodeAt(C+1)]>>4,m[k++]=p&255),w===1&&(p=t[d.charCodeAt(C)]<<10|t[d.charCodeAt(C+1)]<<4|t[d.charCodeAt(C+2)]>>2,m[k++]=p>>8&255,m[k++]=p&255),m}function g(d){return n[d>>18&63]+n[d>>12&63]+n[d>>6&63]+n[d&63]}function y(d,p,f){for(var v,w=[],m=p;m<f;m+=3)v=(d[m]<<16&16711680)+(d[m+1]<<8&65280)+(d[m+2]&255),w.push(g(v));return w.join("")}function D(d){for(var p,f=d.length,v=f%3,w=[],m=16383,k=0,A=f-v;k<A;k+=m)w.push(y(d,k,k+m>A?A:k+m));return v===1?(p=d[f-1],w.push(n[p>>2]+n[p<<4&63]+"==")):v===2&&(p=(d[f-2]<<8)+d[f-1],w.push(n[p>>10]+n[p>>4&63]+n[p<<2&63]+"=")),w.join("")}return F}var Lt=_t();const nt=At(Lt);class Pt{constructor(){c(this,"deps",new Map)}on(t,e){this.deps.set(t,e)}emit(t,e){const s=this.deps.get(t);s&&s(e)}}(function(){try{var n=document.createElement("style");n.appendChild(document.createTextNode("button.svelte-n1zwga{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-n1zwga{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-n1zwga{background-color:#fff;padding:20px;border-radius:5px;width:40%}.model-title.svelte-n1zwga{color:#303133;font-size:18px;margin-bottom:16px}.modal-visible.svelte-n1zwga{display:flex}.modal-footer.svelte-n1zwga{display:flex;align-items:center;justify-content:flex-end;margin-top:16px}.modal-btn.svelte-n1zwga{padding:8px 15px;border-radius:4px;font-size:14px;border:1px solid #dcdfe6}.success.svelte-n1zwga{background-color:#409eff;margin-left:12px;color:#fff}.slot.svelte-n1zwga{max-height:200px;overflow-y:scroll}.slot.svelte-n1zwga::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:16px;display:flex;align-items:center;cursor:pointer;border-bottom:1px solid #ebeef5;font-size:14px}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:1px solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:180px;height:180px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid #ccc;margin-top:10px;margin-right:10px;border-radius:4px}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:100px;height:100px}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:10px;color:#333}")),document.head.appendChild(n)}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();var Mt=Object.defineProperty,Tt=(n,t,e)=>t in n?Mt(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,st=(n,t,e)=>Tt(n,typeof t!="symbol"?t+"":t,e);function q(){}function Ht(n,t){for(const e in t)n[e]=t[e];return n}function ht(n){return n()}function at(){return Object.create(null)}function z(n){n.forEach(ht)}function O(n){return typeof n=="function"}function yt(n,t){return n!=n?t==t:n!==t||n&&typeof n=="object"||typeof n=="function"}function Gt(n){return Object.keys(n).length===0}function Ft(n,t,e,s){if(n){const a=pt(n,t,e,s);return n[0](a)}}function pt(n,t,e,s){return n[1]&&s?Ht(e.ctx.slice(),n[1](s(t))):e.ctx}function jt(n,t,e,s){if(n[2]&&s){const a=n[2](s(e));if(t.dirty===void 0)return a;if(typeof a=="object"){const r=[],o=Math.max(t.dirty.length,a.length);for(let i=0;i<o;i+=1)r[i]=t.dirty[i]|a[i];return r}return t.dirty|a}return t.dirty}function Ot(n,t,e,s,a,r){if(a){const o=pt(t,e,s,r);n.p(o,a)}}function Zt(n){if(n.ctx.length>32){const t=[],e=n.ctx.length/32;for(let s=0;s<e;s++)t[s]=-1;return t}return-1}function rt(n){return n!=null?n:""}function x(n,t){n.appendChild(t)}function Q(n,t,e){n.insertBefore(t,e||null)}function R(n){n.parentNode&&n.parentNode.removeChild(n)}function Nt(n,t){for(let e=0;e<n.length;e+=1)n[e]&&n[e].d(t)}function I(n){return document.createElement(n)}function E(n){return document.createTextNode(n)}function Z(){return E(" ")}function zt(){return E("")}function j(n,t,e,s){return n.addEventListener(t,e,s),()=>n.removeEventListener(t,e,s)}function S(n,t,e){e==null?n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}function Vt(n){return Array.from(n.childNodes)}function T(n,t){t=""+t,n.data!==t&&(n.data=t)}let X;function N(n){X=n}const P=[],ot=[];let H=[];const ct=[],Rt=Promise.resolve();let K=!1;function Ut(){K||(K=!0,Rt.then(gt))}function W(n){H.push(n)}const J=new Set;let L=0;function gt(){if(L!==0)return;const n=X;do{try{for(;L<P.length;){const t=P[L];L++,N(t),Jt(t.$$)}}catch(t){throw P.length=0,L=0,t}for(N(null),P.length=0,L=0;ot.length;)ot.pop()();for(let t=0;t<H.length;t+=1){const e=H[t];J.has(e)||(J.add(e),e())}H.length=0}while(P.length);for(;ct.length;)ct.pop()();K=!1,J.clear(),N(n)}function Jt(n){if(n.fragment!==null){n.update(),z(n.before_update);const t=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,t),n.after_update.forEach(W)}}function qt(n){const t=[],e=[];H.forEach(s=>n.indexOf(s)===-1?t.push(s):e.push(s)),e.forEach(s=>s()),H=t}const V=new Set;let Kt;function Y(n,t){n&&n.i&&(V.delete(n),n.i(t))}function ft(n,t,e,s){if(n&&n.o){if(V.has(n))return;V.add(n),Kt.c.push(()=>{V.delete(n)}),n.o(t)}}function it(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function Wt(n){n&&n.c()}function mt(n,t,e){const{fragment:s,after_update:a}=n.$$;s&&s.m(t,e),W(()=>{const r=n.$$.on_mount.map(ht).filter(O);n.$$.on_destroy?n.$$.on_destroy.push(...r):z(r),n.$$.on_mount=[]}),a.forEach(W)}function wt(n,t){const e=n.$$;e.fragment!==null&&(qt(e.after_update),z(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Qt(n,t){n.$$.dirty[0]===-1&&(P.push(n),Ut(),n.$$.dirty.fill(0)),n.$$.dirty[t/31|0]|=1<<t%31}function Ct(n,t,e,s,a,r,o=null,i=[-1]){const u=X;N(n);const h=n.$$={fragment:null,ctx:[],props:r,update:q,not_equal:a,bound:at(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(u?u.$$.context:[])),callbacks:at(),dirty:i,skip_bound:!1,root:t.target||u.$$.root};o&&o(h.root);let g=!1;if(h.ctx=e?e(n,t.props||{},(y,D,...d)=>{const p=d.length?d[0]:D;return h.ctx&&a(h.ctx[y],h.ctx[y]=p)&&(!h.skip_bound&&h.bound[y]&&h.bound[y](p),g&&Qt(n,y)),D}):[],h.update(),g=!0,z(h.before_update),h.fragment=s?s(h.ctx):!1,t.target){if(t.hydrate){const y=Vt(t.target);h.fragment&&h.fragment.l(y),y.forEach(R)}else h.fragment&&h.fragment.c();t.intro&&Y(n.$$.fragment),mt(n,t.target,t.anchor),gt()}N(u)}class vt{constructor(){st(this,"$$"),st(this,"$$set")}$destroy(){wt(this,1),this.$destroy=q}$on(t,e){if(!O(e))return q;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(e),()=>{const a=s.indexOf(e);a!==-1&&s.splice(a,1)}}$set(t){this.$$set&&!Gt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Xt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Xt);function Yt(n){let t,e,s,a=(n[1]||"标题")+"",r,o,i,u,h,g,y=(n[4]||"取消")+"",D,d,p,f=(n[5]||"确认")+"",v,w,m,k;const A=n[7].default,C=Ft(A,n,n[6],null);return{c(){t=I("div"),e=I("div"),s=I("div"),r=E(a),o=Z(),i=I("div"),C&&C.c(),u=Z(),h=I("div"),g=I("button"),D=E(y),d=Z(),p=I("button"),v=E(f),S(s,"class","model-title svelte-n1zwga"),S(i,"class","slot svelte-n1zwga"),S(g,"class","modal-btn svelte-n1zwga"),S(p,"class","modal-btn success svelte-n1zwga"),S(h,"class","modal-footer svelte-n1zwga"),S(e,"class","modal-content svelte-n1zwga"),S(t,"class","modal-background modal-visible svelte-n1zwga")},m($,_){Q($,t,_),x(t,e),x(e,s),x(s,r),x(e,o),x(e,i),C&&C.m(i,null),x(e,u),x(e,h),x(h,g),x(g,D),x(h,d),x(h,p),x(p,v),w=!0,m||(k=[j(g,"click",function(){O(n[0])&&n[0].apply(this,arguments)}),j(p,"click",function(){O(n[2])&&n[2].apply(this,arguments)}),j(e,"click",te),j(t,"click",function(){O(n[3])&&n[3].apply(this,arguments)})],m=!0)},p($,[_]){n=$,(!w||_&2)&&a!==(a=(n[1]||"标题")+"")&&T(r,a),C&&C.p&&(!w||_&64)&&Ot(C,A,n,n[6],w?jt(A,n[6],_,null):Zt(n[6]),null),(!w||_&16)&&y!==(y=(n[4]||"取消")+"")&&T(D,y),(!w||_&32)&&f!==(f=(n[5]||"确认")+"")&&T(v,f)},i($){w||(Y(C,$),w=!0)},o($){ft(C,$),w=!1},d($){$&&R(t),C&&C.d($),m=!1,z(k)}}}const te=n=>n.stopPropagation();function ee(n,t,e){let{$$slots:s={},$$scope:a}=t,{onCancel:r}=t,{title:o}=t,{onOk:i}=t,{onClose:u}=t,{cancelText:h}=t,{okText:g}=t;return n.$$set=y=>{"onCancel"in y&&e(0,r=y.onCancel),"title"in y&&e(1,o=y.title),"onOk"in y&&e(2,i=y.onOk),"onClose"in y&&e(3,u=y.onClose),"cancelText"in y&&e(4,h=y.cancelText),"okText"in y&&e(5,g=y.okText),"$$scope"in y&&e(6,a=y.$$scope)},[r,o,i,u,h,g,a,s]}class ne extends vt{constructor(t){super(),Ct(this,t,ee,Yt,yt,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5})}}function lt(n,t,e){const s=n.slice();return s[10]=t[e],s[12]=e,s}function dt(n){let t,e,s=n[10].CN+"",a,r,o,i=n[10].DevClass+"",u,h,g=n[10].sn+"",y,D,d,p,f,v;function w(){return n[9](n[12])}return{c(){t=I("div"),e=I("span"),a=E(s),r=Z(),o=I("span"),u=E(i),h=E("("),y=E(g),D=E(")"),d=Z(),S(e,"class","svelte-jtc2v4"),S(o,"class","svelte-jtc2v4"),S(t,"class",p=rt(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")},m(m,k){Q(m,t,k),x(t,e),x(e,a),x(t,r),x(t,o),x(o,u),x(o,h),x(o,y),x(o,D),x(t,d),f||(v=j(t,"click",w),f=!0)},p(m,k){n=m,k&1&&s!==(s=n[10].CN+"")&&T(a,s),k&1&&i!==(i=n[10].DevClass+"")&&T(u,i),k&1&&g!==(g=n[10].sn+"")&&T(y,g),k&16&&p!==(p=rt(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")&&S(t,"class",p)},d(m){m&&R(t),f=!1,v()}}}function se(n){let t,e=it(n[0]),s=[];for(let a=0;a<e.length;a+=1)s[a]=dt(lt(n,e,a));return{c(){for(let a=0;a<s.length;a+=1)s[a].c();t=zt()},m(a,r){for(let o=0;o<s.length;o+=1)s[o]&&s[o].m(a,r);Q(a,t,r)},p(a,r){if(r&17){e=it(a[0]);let o;for(o=0;o<e.length;o+=1){const i=lt(a,e,o);s[o]?s[o].p(i,r):(s[o]=dt(i),s[o].c(),s[o].m(t.parentNode,t))}for(;o<s.length;o+=1)s[o].d(1);s.length=e.length}},d(a){a&&R(t),Nt(s,a)}}}function ae(n){let t,e;return t=new ne({props:{onOk:n[6],onClose:n[1],onCancel:n[5],cancelText:n[2],okText:n[3],title:"选择证书",$$slots:{default:[se]},$$scope:{ctx:n}}}),{c(){Wt(t.$$.fragment)},m(s,a){mt(t,s,a),e=!0},p(s,[a]){const r={};a&2&&(r.onClose=s[1]),a&4&&(r.cancelText=s[2]),a&8&&(r.okText=s[3]),a&8209&&(r.$$scope={dirty:a,ctx:s}),t.$set(r)},i(s){e||(Y(t.$$.fragment,s),e=!0)},o(s){ft(t.$$.fragment,s),e=!1},d(s){wt(t,s)}}}function re(n,t,e){let{certList:s=[]}=t,{onCancel:a}=t,{onOk:r}=t,{onClose:o}=t,{cancelText:i=""}=t,{okText:u=""}=t,h=0;const g=()=>{o==null||o()},y=()=>{r==null||r(s[h]),o==null||o()},D=d=>e(4,h=d);return n.$$set=d=>{"certList"in d&&e(0,s=d.certList),"onCancel"in d&&e(7,a=d.onCancel),"onOk"in d&&e(8,r=d.onOk),"onClose"in d&&e(1,o=d.onClose),"cancelText"in d&&e(2,i=d.cancelText),"okText"in d&&e(3,u=d.okText)},[s,o,i,u,h,g,y,a,r,D]}class oe extends vt{constructor(t){super(),Ct(this,t,re,ae,yt,{certList:0,onCancel:7,onOk:8,onClose:1,cancelText:2,okText:3})}}class ce{constructor(){c(this,"modalInstance",{current:null});c(this,"open",t=>new Promise((e,s)=>{this.modalInstance.current=new oe({target:document.body,props:B(b({},t),{onCancel:a=>{s()},onOk:a=>{e(a)},onClose:()=>{this.close()}})})}));c(this,"close",()=>{setTimeout(()=>{var t;(t=this.modalInstance.current)==null||t.$destroy()})})}}const ie=new ce;class le{constructor(t){c(this,"socketInstance",null);c(this,"eventBus",new Pt);c(this,"isRememberPin",!1);c(this,"socketEvent");c(this,"pinPolicy");c(this,"socketConfig",null);c(this,"getSocketReadyState",()=>{var t;return(t=this.socketInstance)==null?void 0:t.readyState});c(this,"destroy",()=>{var t;(t=this.socketInstance)==null||t.close()});c(this,"sendMessage",(t,e)=>new Promise((s,a)=>{var o,i;if(((o=this.socketInstance)==null?void 0:o.readyState)!==WebSocket.OPEN){console.log(t),a({errCode:-1,msg:"socket未连接"});return}const r={function:t,args:[e!=null?e:{}]};(i=this.socketInstance)==null||i.send(JSON.stringify(r)),this.eventBus.on(t,u=>{u.success?s(u.data):a(u)})}));c(this,"handleEventData",t=>l(this,null,function*(){var e,s,a,r,o,i;if(t.data instanceof Blob){const u=yield t.data.arrayBuffer(),g=new TextDecoder("gbk").decode(u),y=JSON.parse(g),D={data:y.data,success:(e=y.result)==null?void 0:e.success,msg:(s=y.result)==null?void 0:s.msg,errCode:(a=y.result)==null?void 0:a.errCode};this.eventBus.emit((r=y.result)==null?void 0:r.function,D),(i=(o=this.socketConfig)==null?void 0:o.onMessage)==null||i.call(o,D)}}));c(this,"base64Encode",t=>{const e=new TextEncoder().encode(t);return nt.fromByteArray(e)});c(this,"base64Decode",t=>{const e=nt.toByteArray(t);return new TextDecoder().decode(e)});c(this,"changeIsRememberPin",t=>l(this,null,function*(){this.isRememberPin=t}));c(this,"changePinPolicy",t=>l(this,null,function*(){this.pinPolicy=t}));c(this,"checkCertIsLogin",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",t)}));c(this,"addUkeyEvents",()=>l(this,null,function*(){this.sendMessage("GZCA_StartListen",{Type:Et}).then(t=>{var e,s;(s=(e=this.socketConfig)==null?void 0:e.onUkeyEvent)==null||s.call(e,t)})}));c(this,"certLogin",t=>l(this,null,function*(){const e=yield this.checkCertIsLogin({ContainerName:t});e!=null&&e[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:t,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));c(this,"getCert",(t,e)=>l(this,null,function*(){const s=e!=null?e:yield this.chooseCert(t);return yield this.certLogin(s.ContainerName),s}));c(this,"getCertList",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",t)}));c(this,"chooseCert",t=>l(this,null,function*(){const e=yield this.getCertList(t);return(e==null?void 0:e.length)===1?e[0]:yield ie.open({certList:e})}));c(this,"pkcs1Sign",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",B(b({},t),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1Base64Sign",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",B(b({},t),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1VerifySignature",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",t)}));c(this,"pkcs1Base64VerifySignature",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",t)}));c(this,"getSealList",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",B(b({},t),{IsLogin:this.getIsLogin()}))}));c(this,"sm2SignPreprocess1",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",t)}));c(this,"sm2SignPreprocess2",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",t)}));c(this,"pkcs1HashSign",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",B(b({},t!=null?t:{}),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1HashVerifySignature",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",t)}));c(this,"pkcs7Sign",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",B(b({},t),{IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy}))}));c(this,"pkcs7VerifySignature",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",t)}));c(this,"sm3Hash",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashData",t)}));c(this,"sm3HexHash",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",t)}));c(this,"sm3FileHash",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",t)}));c(this,"sm3HashEncryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_HMac",t)}));c(this,"pkcs7Encryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",t)}));c(this,"pkcs7Decryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",B(b({},t),{IsLogin:this.getIsLogin()}))}));c(this,"asymmetricEncryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",t)}));c(this,"asymmetricDecryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",B(b({},t),{IsLogin:this.getIsLogin()}))}));c(this,"sm4Encryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",t)}));c(this,"sm4Decryption",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",t)}));c(this,"getCertInfo",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",t)}));c(this,"getCertInfoByOid",t=>l(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",t)}));var e,s;this.socketConfig=t,this.socketInstance=this.createSocket(t),this.isRememberPin=(e=t.isRememberPin)!=null?e:!1,this.pinPolicy=(s=t.pinPolicy)!=null?s:ut.MIN}createSocket(t){const e=new WebSocket(t.url);return e.onerror=s=>{var a;(a=t.onError)==null||a.call(t,s)},e.onopen=s=>{var a;(a=t.onOpen)==null||a.call(t,s),this.addUkeyEvents()},e.onmessage=s=>{this.handleEventData(s)},e.onclose=s=>{var a;(a=t.onClose)==null||a.call(t,s)},e}getIsLogin(){return this.isRememberPin?"Y":"N"}}const M=class M{constructor(t){c(this,"coreInstance",null);c(this,"gwsConfig",{});c(this,"createGwsCore",t=>{this.gwsConfig=t!=null?t:{},this.coreInstance=new le(B(b({},t!=null?t:{}),{url:St}))});c(this,"appendCertBase64",(t,e=!0)=>l(this,null,function*(){if(t.CertB64)return t;const s=e?yield this.getSignatureCert():yield this.getEncryptionCert();return B(b({},t!=null?t:{}),{CertB64:s==null?void 0:s.CertB64})}));c(this,"destroy",()=>{var t;(t=this.coreInstance)==null||t.destroy(),this.coreInstance=null});c(this,"restart",t=>{this.coreInstance&&this.destroy(),this.gwsConfig=t!=null?t:this.gwsConfig,this.createGwsCore(t)});c(this,"getSocketReadyState",()=>{var t;return(t=this.coreInstance)==null?void 0:t.getSocketReadyState()});c(this,"getSignatureCert",t=>l(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:$t},t)}));c(this,"getEncryptionCert",t=>l(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:It},t)}));c(this,"base64Encode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Encode(t.Data)});c(this,"base64Decode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Decode(t.DataB64)});c(this,"changeIsRememberPin",t=>{var e;(e=this.coreInstance)==null||e.changeIsRememberPin(t)});c(this,"changePinPolicy",t=>{var e;(e=this.coreInstance)==null||e.changePinPolicy(t)});c(this,"pkcs1Sign",(t,e)=>l(this,null,function*(){var r,o,i;const s=yield this.getSignatureCert(e),a=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(B(b({},t!=null?t:{}),{ContainerName:(r=s==null?void 0:s.ContainerName)!=null?r:""}));return(i=a==null?void 0:a[0])==null?void 0:i.SignData}));c(this,"pkcs1VerifySignature",t=>l(this,null,function*(){var a;const e=yield this.appendCertBase64(t),s=yield(a=this.coreInstance)==null?void 0:a.pkcs1VerifySignature(e);return Array.isArray(s)}));c(this,"pkcs1Base64Sign",(t,e)=>l(this,null,function*(){var o,i,u,h,g;const s=yield this.getSignatureCert(e),a=(i=t.DataB64)!=null?i:this.base64Encode({Data:(o=t.Data)!=null?o:""}),r=yield(h=this.coreInstance)==null?void 0:h.pkcs1Base64Sign({ContainerName:(u=s==null?void 0:s.ContainerName)!=null?u:"",DataB64:a});return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));c(this,"pkcs1Base64VerifySignature",t=>l(this,null,function*(){var r,o,i;const e=(o=t.DataB64)!=null?o:this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=yield this.appendCertBase64(t);return!!(yield(i=this.coreInstance)==null?void 0:i.pkcs1Base64VerifySignature({CertB64:s.CertB64,DataB64:e,SignData:s.SignData}))}));c(this,"getSealList",()=>l(this,null,function*(){var s,a;const t=yield this.getSignatureCert(),e=yield(a=this.coreInstance)==null?void 0:a.getSealList({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:""});return{cert:t,sealList:e}}));c(this,"sm2SignPreprocess1",t=>l(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t),s=yield(a=this.coreInstance)==null?void 0:a.sm2SignPreprocess1(e);return(r=s==null?void 0:s[0])==null?void 0:r.Z}));c(this,"sm2SignPreprocess2",t=>l(this,null,function*(){var r,o;const e=this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=yield this.appendCertBase64(t),a=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:s.CertB64,DataB64:e});return a==null?void 0:a[0].H}));c(this,"pkcs1HashSign",(t,e)=>l(this,null,function*(){var r,o,i,u;const s=yield this.getSignatureCert(e),a=yield(i=this.coreInstance)==null?void 0:i.pkcs1HashSign({ContainerName:(r=s==null?void 0:s.ContainerName)!=null?r:"",DataB64:t.DataB64,HashAlg:(o=t.HashAlg)!=null?o:"sm3"});return(u=a==null?void 0:a[0])==null?void 0:u.SignData}));c(this,"pkcs1HashVerifySignature",t=>l(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t);return!!(yield(r=this.coreInstance)==null?void 0:r.pkcs1HashVerifySignature(B(b({},e),{HashAlg:(a=e.HashAlg)!=null?a:"sm3"})))}));c(this,"pkcs7Sign",(t,e)=>l(this,null,function*(){var o,i,u,h,g;const s=(i=t.DataB64)!=null?i:this.base64Encode({Data:(o=t.Data)!=null?o:""}),a=yield this.getSignatureCert(e),r=yield(h=this.coreInstance)==null?void 0:h.pkcs7Sign({IsDetached:t.IsDetached,ContainerName:(u=a==null?void 0:a.ContainerName)!=null?u:"",DataB64:s});return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));c(this,"pkcs7VerifySignature",t=>l(this,null,function*(){var a,r,o;const e=(r=t.DataB64)!=null?r:this.base64Encode({Data:(a=t.Data)!=null?a:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:e,SignData:t.SignData}))}));c(this,"sm3Hash",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3Hash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3HexHash",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3HexHash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3FileHash",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3FileHash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3HashEncryption",t=>l(this,null,function*(){var r,o,i,u,h,g;const e=(o=t.DataB64)!=null?o:this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=(u=t.KeyB64)!=null?u:this.base64Encode({Data:(i=t.Key)!=null?i:""}),a=yield(h=this.coreInstance)==null?void 0:h.sm3HashEncryption({dataB64:e,keyB64:s,alg:"sm3"});return(g=a==null?void 0:a[0])==null?void 0:g.DataB64}));c(this,"pkcs7Encryption",t=>l(this,null,function*(){var a,r,o,i;if(!t.CertB64List){const u=yield this.getEncryptionCert();t.CertB64List=u==null?void 0:u.CertB64}const e=(r=t.DataB64)!=null?r:this.base64Encode({Data:(a=t.Data)!=null?a:""}),s=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:e,CertB64List:t.CertB64List});return(i=s==null?void 0:s[0])==null?void 0:i.DataB64}));c(this,"pkcs7Decryption",t=>l(this,null,function*(){var r,o;const e=yield this.getEncryptionCert(),s=yield(r=this.coreInstance)==null?void 0:r.pkcs7Decryption({DataB64:t.DataB64,ContainerName:e==null?void 0:e.ContainerName}),a=(o=s==null?void 0:s[0])==null?void 0:o.DataB64;return t.shouldDecodeBase64?this.base64Decode({DataB64:a}):a}));c(this,"asymmetricEncryption",t=>l(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t,!1),s=yield(a=this.coreInstance)==null?void 0:a.asymmetricEncryption(e);return(r=s==null?void 0:s[0])==null?void 0:r.Data}));c(this,"asymmetricDecryption",t=>l(this,null,function*(){var a,r;const e=yield this.getEncryptionCert(),s=yield(a=this.coreInstance)==null?void 0:a.asymmetricDecryption({Data:t.Data,ContainerName:e==null?void 0:e.ContainerName});return(r=s==null?void 0:s[0])==null?void 0:r.Data}));c(this,"sm4Encryption",t=>l(this,null,function*(){var s;const e=yield(s=this.coreInstance)==null?void 0:s.sm4Encryption(t);return e==null?void 0:e[0]}));c(this,"sm4Decryption",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm4Decryption(t);return(a=e==null?void 0:e[0])==null?void 0:a.Data}));c(this,"getCertInfo",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(t);return b({},(a=e==null?void 0:e[0])!=null?a:{})}));c(this,"getCertInfoByOid",t=>l(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.getCertInfoByOid(b({},t!=null?t:{}));return(a=e==null?void 0:e[0])==null?void 0:a.OidValue}));return M.instance&&!(t!=null&&t.isCreateNew)?M.instance:(this.createGwsCore(t),M.instance=this,this)}};c(M,"instance",null);let G=M;function de(n){return new Promise((t,e)=>{if(G.instance)t(G.instance);else{const s=new G(B(b({},n!=null?n:{}),{onOpen(a){var r;t(s),(r=n==null?void 0:n.onOpen)==null||r.call(n,a)},onClose(a){var r;e(a),(r=n==null?void 0:n.onClose)==null||r.call(n,a)}}))}})}exports.GwsService=G;exports.createService=de;
|
package/dist/index.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var U = (n, t, e) => t in n ?
|
|
1
|
+
var kt = Object.defineProperty, xt = Object.defineProperties;
|
|
2
|
+
var Dt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var tt = Object.getOwnPropertySymbols;
|
|
4
|
+
var Bt = Object.prototype.hasOwnProperty, bt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var U = (n, t, e) => t in n ? kt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, B = (n, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
|
|
7
|
+
Bt.call(t, e) && U(n, e, t[e]);
|
|
8
|
+
if (tt)
|
|
9
|
+
for (var e of tt(t))
|
|
10
|
+
bt.call(t, e) && U(n, e, t[e]);
|
|
11
11
|
return n;
|
|
12
|
-
}, b = (n, t) =>
|
|
12
|
+
}, b = (n, t) => xt(n, Dt(t));
|
|
13
13
|
var c = (n, t, e) => U(n, typeof t != "symbol" ? t + "" : t, e);
|
|
14
14
|
var l = (n, t, e) => new Promise((s, a) => {
|
|
15
15
|
var r = (u) => {
|
|
@@ -27,16 +27,16 @@ var l = (n, t, e) => new Promise((s, a) => {
|
|
|
27
27
|
}, i = (u) => u.done ? s(u.value) : Promise.resolve(u.value).then(r, o);
|
|
28
28
|
i((e = e.apply(n, t)).next());
|
|
29
29
|
});
|
|
30
|
-
const
|
|
31
|
-
var
|
|
32
|
-
const
|
|
33
|
-
function
|
|
30
|
+
const St = window.location.href.includes("https") ? "wss://localhost:19528" : "ws://localhost:9527", $t = "1", It = "2";
|
|
31
|
+
var ut = /* @__PURE__ */ ((n) => (n[n.MIN = 0] = "MIN", n[n.LOW = 1] = "LOW", n[n.MIDDLE = 2] = "MIDDLE", n[n.HIGH = 3] = "HIGH", n))(ut || {});
|
|
32
|
+
const Et = "00000001";
|
|
33
|
+
function At(n) {
|
|
34
34
|
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
|
35
35
|
}
|
|
36
|
-
var G = {},
|
|
37
|
-
function
|
|
38
|
-
if (
|
|
39
|
-
|
|
36
|
+
var G = {}, et;
|
|
37
|
+
function _t() {
|
|
38
|
+
if (et) return G;
|
|
39
|
+
et = 1, G.byteLength = i, G.toByteArray = h, G.fromByteArray = D;
|
|
40
40
|
for (var n = [], t = [], e = typeof Uint8Array != "undefined" ? Uint8Array : Array, s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", a = 0, r = s.length; a < r; ++a)
|
|
41
41
|
n[a] = s[a], t[s.charCodeAt(a)] = a;
|
|
42
42
|
t[45] = 62, t[95] = 63;
|
|
@@ -81,9 +81,9 @@ function Lt() {
|
|
|
81
81
|
}
|
|
82
82
|
return G;
|
|
83
83
|
}
|
|
84
|
-
var
|
|
85
|
-
const
|
|
86
|
-
class
|
|
84
|
+
var Lt = _t();
|
|
85
|
+
const nt = /* @__PURE__ */ At(Lt);
|
|
86
|
+
class Pt {
|
|
87
87
|
constructor() {
|
|
88
88
|
c(this, "deps", /* @__PURE__ */ new Map());
|
|
89
89
|
}
|
|
@@ -103,44 +103,44 @@ class Ht {
|
|
|
103
103
|
console.error("vite-plugin-css-injected-by-js", t);
|
|
104
104
|
}
|
|
105
105
|
})();
|
|
106
|
-
var
|
|
106
|
+
var Ht = Object.defineProperty, Mt = (n, t, e) => t in n ? Ht(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, st = (n, t, e) => Mt(n, typeof t != "symbol" ? t + "" : t, e);
|
|
107
107
|
function q() {
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function Tt(n, t) {
|
|
110
110
|
for (const e in t) n[e] = t[e];
|
|
111
111
|
return (
|
|
112
112
|
/** @type {T & S} */
|
|
113
113
|
n
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function ht(n) {
|
|
117
117
|
return n();
|
|
118
118
|
}
|
|
119
|
-
function
|
|
119
|
+
function at() {
|
|
120
120
|
return /* @__PURE__ */ Object.create(null);
|
|
121
121
|
}
|
|
122
|
-
function
|
|
123
|
-
n.forEach(
|
|
122
|
+
function z(n) {
|
|
123
|
+
n.forEach(ht);
|
|
124
124
|
}
|
|
125
125
|
function j(n) {
|
|
126
126
|
return typeof n == "function";
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function yt(n, t) {
|
|
129
129
|
return n != n ? t == t : n !== t || n && typeof n == "object" || typeof n == "function";
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Gt(n) {
|
|
132
132
|
return Object.keys(n).length === 0;
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Ft(n, t, e, s) {
|
|
135
135
|
if (n) {
|
|
136
|
-
const a =
|
|
136
|
+
const a = pt(n, t, e, s);
|
|
137
137
|
return n[0](a);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
function
|
|
141
|
-
return n[1] && s ?
|
|
140
|
+
function pt(n, t, e, s) {
|
|
141
|
+
return n[1] && s ? Tt(e.ctx.slice(), n[1](s(t))) : e.ctx;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
143
|
+
function jt(n, t, e, s) {
|
|
144
144
|
if (n[2] && s) {
|
|
145
145
|
const a = n[2](s(e));
|
|
146
146
|
if (t.dirty === void 0)
|
|
@@ -155,13 +155,13 @@ function Ot(n, t, e, s) {
|
|
|
155
155
|
}
|
|
156
156
|
return t.dirty;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function Ot(n, t, e, s, a, r) {
|
|
159
159
|
if (a) {
|
|
160
|
-
const o =
|
|
160
|
+
const o = pt(t, e, s, r);
|
|
161
161
|
n.p(o, a);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Zt(n) {
|
|
165
165
|
if (n.ctx.length > 32) {
|
|
166
166
|
const t = [], e = n.ctx.length / 32;
|
|
167
167
|
for (let s = 0; s < e; s++)
|
|
@@ -170,19 +170,19 @@ function Nt(n) {
|
|
|
170
170
|
}
|
|
171
171
|
return -1;
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function rt(n) {
|
|
174
174
|
return n != null ? n : "";
|
|
175
175
|
}
|
|
176
176
|
function x(n, t) {
|
|
177
177
|
n.appendChild(t);
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function Q(n, t, e) {
|
|
180
180
|
n.insertBefore(t, e || null);
|
|
181
181
|
}
|
|
182
182
|
function R(n) {
|
|
183
183
|
n.parentNode && n.parentNode.removeChild(n);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function Nt(n, t) {
|
|
186
186
|
for (let e = 0; e < n.length; e += 1)
|
|
187
187
|
n[e] && n[e].d(t);
|
|
188
188
|
}
|
|
@@ -195,7 +195,7 @@ function E(n) {
|
|
|
195
195
|
function O() {
|
|
196
196
|
return E(" ");
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function zt() {
|
|
199
199
|
return E("");
|
|
200
200
|
}
|
|
201
201
|
function F(n, t, e, s) {
|
|
@@ -204,99 +204,99 @@ function F(n, t, e, s) {
|
|
|
204
204
|
function S(n, t, e) {
|
|
205
205
|
e == null ? n.removeAttribute(t) : n.getAttribute(t) !== e && n.setAttribute(t, e);
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function Vt(n) {
|
|
208
208
|
return Array.from(n.childNodes);
|
|
209
209
|
}
|
|
210
210
|
function M(n, t) {
|
|
211
211
|
t = "" + t, n.data !== t && (n.data = /** @type {string} */
|
|
212
212
|
t);
|
|
213
213
|
}
|
|
214
|
-
let
|
|
214
|
+
let X;
|
|
215
215
|
function Z(n) {
|
|
216
|
-
|
|
216
|
+
X = n;
|
|
217
217
|
}
|
|
218
|
-
const P = [],
|
|
218
|
+
const P = [], ot = [];
|
|
219
219
|
let T = [];
|
|
220
|
-
const
|
|
220
|
+
const ct = [], Rt = /* @__PURE__ */ Promise.resolve();
|
|
221
221
|
let K = !1;
|
|
222
|
-
function
|
|
223
|
-
K || (K = !0,
|
|
222
|
+
function Ut() {
|
|
223
|
+
K || (K = !0, Rt.then(gt));
|
|
224
224
|
}
|
|
225
225
|
function W(n) {
|
|
226
226
|
T.push(n);
|
|
227
227
|
}
|
|
228
228
|
const J = /* @__PURE__ */ new Set();
|
|
229
229
|
let L = 0;
|
|
230
|
-
function
|
|
230
|
+
function gt() {
|
|
231
231
|
if (L !== 0)
|
|
232
232
|
return;
|
|
233
|
-
const n =
|
|
233
|
+
const n = X;
|
|
234
234
|
do {
|
|
235
235
|
try {
|
|
236
236
|
for (; L < P.length; ) {
|
|
237
237
|
const t = P[L];
|
|
238
|
-
L++, Z(t),
|
|
238
|
+
L++, Z(t), Jt(t.$$);
|
|
239
239
|
}
|
|
240
240
|
} catch (t) {
|
|
241
241
|
throw P.length = 0, L = 0, t;
|
|
242
242
|
}
|
|
243
|
-
for (Z(null), P.length = 0, L = 0;
|
|
243
|
+
for (Z(null), P.length = 0, L = 0; ot.length; ) ot.pop()();
|
|
244
244
|
for (let t = 0; t < T.length; t += 1) {
|
|
245
245
|
const e = T[t];
|
|
246
246
|
J.has(e) || (J.add(e), e());
|
|
247
247
|
}
|
|
248
248
|
T.length = 0;
|
|
249
249
|
} while (P.length);
|
|
250
|
-
for (;
|
|
251
|
-
|
|
250
|
+
for (; ct.length; )
|
|
251
|
+
ct.pop()();
|
|
252
252
|
K = !1, J.clear(), Z(n);
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function Jt(n) {
|
|
255
255
|
if (n.fragment !== null) {
|
|
256
|
-
n.update(),
|
|
256
|
+
n.update(), z(n.before_update);
|
|
257
257
|
const t = n.dirty;
|
|
258
258
|
n.dirty = [-1], n.fragment && n.fragment.p(n.ctx, t), n.after_update.forEach(W);
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function qt(n) {
|
|
262
262
|
const t = [], e = [];
|
|
263
263
|
T.forEach((s) => n.indexOf(s) === -1 ? t.push(s) : e.push(s)), e.forEach((s) => s()), T = t;
|
|
264
264
|
}
|
|
265
265
|
const V = /* @__PURE__ */ new Set();
|
|
266
|
-
let
|
|
267
|
-
function
|
|
266
|
+
let Kt;
|
|
267
|
+
function Y(n, t) {
|
|
268
268
|
n && n.i && (V.delete(n), n.i(t));
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function ft(n, t, e, s) {
|
|
271
271
|
if (n && n.o) {
|
|
272
272
|
if (V.has(n)) return;
|
|
273
|
-
V.add(n),
|
|
273
|
+
V.add(n), Kt.c.push(() => {
|
|
274
274
|
V.delete(n);
|
|
275
275
|
}), n.o(t);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function it(n) {
|
|
279
279
|
return (n == null ? void 0 : n.length) !== void 0 ? n : Array.from(n);
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function Wt(n) {
|
|
282
282
|
n && n.c();
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function mt(n, t, e) {
|
|
285
285
|
const { fragment: s, after_update: a } = n.$$;
|
|
286
286
|
s && s.m(t, e), W(() => {
|
|
287
|
-
const r = n.$$.on_mount.map(
|
|
288
|
-
n.$$.on_destroy ? n.$$.on_destroy.push(...r) :
|
|
287
|
+
const r = n.$$.on_mount.map(ht).filter(j);
|
|
288
|
+
n.$$.on_destroy ? n.$$.on_destroy.push(...r) : z(r), n.$$.on_mount = [];
|
|
289
289
|
}), a.forEach(W);
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function wt(n, t) {
|
|
292
292
|
const e = n.$$;
|
|
293
|
-
e.fragment !== null && (
|
|
293
|
+
e.fragment !== null && (qt(e.after_update), z(e.on_destroy), e.fragment && e.fragment.d(t), e.on_destroy = e.fragment = null, e.ctx = []);
|
|
294
294
|
}
|
|
295
|
-
function
|
|
296
|
-
n.$$.dirty[0] === -1 && (P.push(n),
|
|
295
|
+
function Qt(n, t) {
|
|
296
|
+
n.$$.dirty[0] === -1 && (P.push(n), Ut(), n.$$.dirty.fill(0)), n.$$.dirty[t / 31 | 0] |= 1 << t % 31;
|
|
297
297
|
}
|
|
298
|
-
function
|
|
299
|
-
const u =
|
|
298
|
+
function Ct(n, t, e, s, a, r, o = null, i = [-1]) {
|
|
299
|
+
const u = X;
|
|
300
300
|
Z(n);
|
|
301
301
|
const h = n.$$ = {
|
|
302
302
|
fragment: null,
|
|
@@ -305,7 +305,7 @@ function vt(n, t, e, s, a, r, o = null, i = [-1]) {
|
|
|
305
305
|
props: r,
|
|
306
306
|
update: q,
|
|
307
307
|
not_equal: a,
|
|
308
|
-
bound:
|
|
308
|
+
bound: at(),
|
|
309
309
|
// lifecycle
|
|
310
310
|
on_mount: [],
|
|
311
311
|
on_destroy: [],
|
|
@@ -314,7 +314,7 @@ function vt(n, t, e, s, a, r, o = null, i = [-1]) {
|
|
|
314
314
|
after_update: [],
|
|
315
315
|
context: new Map(t.context || (u ? u.$$.context : [])),
|
|
316
316
|
// everything else
|
|
317
|
-
callbacks:
|
|
317
|
+
callbacks: at(),
|
|
318
318
|
dirty: i,
|
|
319
319
|
skip_bound: !1,
|
|
320
320
|
root: t.target || u.$$.root
|
|
@@ -323,24 +323,24 @@ function vt(n, t, e, s, a, r, o = null, i = [-1]) {
|
|
|
323
323
|
let g = !1;
|
|
324
324
|
if (h.ctx = e ? e(n, t.props || {}, (y, D, ...d) => {
|
|
325
325
|
const p = d.length ? d[0] : D;
|
|
326
|
-
return h.ctx && a(h.ctx[y], h.ctx[y] = p) && (!h.skip_bound && h.bound[y] && h.bound[y](p), g &&
|
|
327
|
-
}) : [], h.update(), g = !0,
|
|
326
|
+
return h.ctx && a(h.ctx[y], h.ctx[y] = p) && (!h.skip_bound && h.bound[y] && h.bound[y](p), g && Qt(n, y)), D;
|
|
327
|
+
}) : [], h.update(), g = !0, z(h.before_update), h.fragment = s ? s(h.ctx) : !1, t.target) {
|
|
328
328
|
if (t.hydrate) {
|
|
329
|
-
const y =
|
|
329
|
+
const y = Vt(t.target);
|
|
330
330
|
h.fragment && h.fragment.l(y), y.forEach(R);
|
|
331
331
|
} else
|
|
332
332
|
h.fragment && h.fragment.c();
|
|
333
|
-
t.intro &&
|
|
333
|
+
t.intro && Y(n.$$.fragment), mt(n, t.target, t.anchor), gt();
|
|
334
334
|
}
|
|
335
335
|
Z(u);
|
|
336
336
|
}
|
|
337
|
-
class
|
|
337
|
+
class vt {
|
|
338
338
|
constructor() {
|
|
339
|
-
|
|
339
|
+
st(this, "$$"), st(this, "$$set");
|
|
340
340
|
}
|
|
341
341
|
/** @returns {void} */
|
|
342
342
|
$destroy() {
|
|
343
|
-
|
|
343
|
+
wt(this, 1), this.$destroy = q;
|
|
344
344
|
}
|
|
345
345
|
/**
|
|
346
346
|
* @template {Extract<keyof Events, string>} K
|
|
@@ -362,12 +362,12 @@ class kt {
|
|
|
362
362
|
* @returns {void}
|
|
363
363
|
*/
|
|
364
364
|
$set(t) {
|
|
365
|
-
this.$$set && !
|
|
365
|
+
this.$$set && !Gt(t) && (this.$$.skip_bound = !0, this.$$set(t), this.$$.skip_bound = !1);
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
const
|
|
369
|
-
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(
|
|
370
|
-
function
|
|
368
|
+
const Xt = "4";
|
|
369
|
+
typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Xt);
|
|
370
|
+
function Yt(n) {
|
|
371
371
|
let t, e, s, a = (
|
|
372
372
|
/*title*/
|
|
373
373
|
(n[1] || "标题") + ""
|
|
@@ -381,7 +381,7 @@ function te(n) {
|
|
|
381
381
|
const A = (
|
|
382
382
|
/*#slots*/
|
|
383
383
|
n[7].default
|
|
384
|
-
), C =
|
|
384
|
+
), C = Ft(
|
|
385
385
|
A,
|
|
386
386
|
n,
|
|
387
387
|
/*$$scope*/
|
|
@@ -393,7 +393,7 @@ function te(n) {
|
|
|
393
393
|
t = I("div"), e = I("div"), s = I("div"), r = E(a), o = O(), i = I("div"), C && C.c(), u = O(), h = I("div"), g = I("button"), D = E(y), d = O(), p = I("button"), v = E(f), S(s, "class", "model-title svelte-n1zwga"), S(i, "class", "slot svelte-n1zwga"), S(g, "class", "modal-btn svelte-n1zwga"), S(p, "class", "modal-btn success svelte-n1zwga"), S(h, "class", "modal-footer svelte-n1zwga"), S(e, "class", "modal-content svelte-n1zwga"), S(t, "class", "modal-background modal-visible svelte-n1zwga");
|
|
394
394
|
},
|
|
395
395
|
m($, _) {
|
|
396
|
-
|
|
396
|
+
Q($, t, _), x(t, e), x(e, s), x(s, r), x(e, o), x(e, i), C && C.m(i, null), x(e, u), x(e, h), x(h, g), x(g, D), x(h, d), x(h, p), x(p, v), w = !0, m || (k = [
|
|
397
397
|
F(g, "click", function() {
|
|
398
398
|
j(
|
|
399
399
|
/*onCancel*/
|
|
@@ -406,7 +406,7 @@ function te(n) {
|
|
|
406
406
|
n[2]
|
|
407
407
|
) && n[2].apply(this, arguments);
|
|
408
408
|
}),
|
|
409
|
-
F(e, "click",
|
|
409
|
+
F(e, "click", te),
|
|
410
410
|
F(t, "click", function() {
|
|
411
411
|
j(
|
|
412
412
|
/*onClose*/
|
|
@@ -419,19 +419,19 @@ function te(n) {
|
|
|
419
419
|
n = $, (!w || _ & /*title*/
|
|
420
420
|
2) && a !== (a = /*title*/
|
|
421
421
|
(n[1] || "标题") + "") && M(r, a), C && C.p && (!w || _ & /*$$scope*/
|
|
422
|
-
64) &&
|
|
422
|
+
64) && Ot(
|
|
423
423
|
C,
|
|
424
424
|
A,
|
|
425
425
|
n,
|
|
426
426
|
/*$$scope*/
|
|
427
427
|
n[6],
|
|
428
|
-
w ?
|
|
428
|
+
w ? jt(
|
|
429
429
|
A,
|
|
430
430
|
/*$$scope*/
|
|
431
431
|
n[6],
|
|
432
432
|
_,
|
|
433
433
|
null
|
|
434
|
-
) :
|
|
434
|
+
) : Zt(
|
|
435
435
|
/*$$scope*/
|
|
436
436
|
n[6]
|
|
437
437
|
),
|
|
@@ -443,26 +443,26 @@ function te(n) {
|
|
|
443
443
|
(n[5] || "确认") + "") && M(v, f);
|
|
444
444
|
},
|
|
445
445
|
i($) {
|
|
446
|
-
w || (
|
|
446
|
+
w || (Y(C, $), w = !0);
|
|
447
447
|
},
|
|
448
448
|
o($) {
|
|
449
|
-
|
|
449
|
+
ft(C, $), w = !1;
|
|
450
450
|
},
|
|
451
451
|
d($) {
|
|
452
|
-
$ && R(t), C && C.d($), m = !1,
|
|
452
|
+
$ && R(t), C && C.d($), m = !1, z(k);
|
|
453
453
|
}
|
|
454
454
|
};
|
|
455
455
|
}
|
|
456
|
-
const
|
|
457
|
-
function
|
|
456
|
+
const te = (n) => n.stopPropagation();
|
|
457
|
+
function ee(n, t, e) {
|
|
458
458
|
let { $$slots: s = {}, $$scope: a } = t, { onCancel: r } = t, { title: o } = t, { onOk: i } = t, { onClose: u } = t, { cancelText: h } = t, { okText: g } = t;
|
|
459
459
|
return n.$$set = (y) => {
|
|
460
460
|
"onCancel" in y && e(0, r = y.onCancel), "title" in y && e(1, o = y.title), "onOk" in y && e(2, i = y.onOk), "onClose" in y && e(3, u = y.onClose), "cancelText" in y && e(4, h = y.cancelText), "okText" in y && e(5, g = y.okText), "$$scope" in y && e(6, a = y.$$scope);
|
|
461
461
|
}, [r, o, i, u, h, g, a, s];
|
|
462
462
|
}
|
|
463
|
-
class
|
|
463
|
+
class ne extends vt {
|
|
464
464
|
constructor(t) {
|
|
465
|
-
super(),
|
|
465
|
+
super(), Ct(this, t, ee, Yt, yt, {
|
|
466
466
|
onCancel: 0,
|
|
467
467
|
title: 1,
|
|
468
468
|
onOk: 2,
|
|
@@ -472,11 +472,11 @@ class se extends kt {
|
|
|
472
472
|
});
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
function
|
|
475
|
+
function lt(n, t, e) {
|
|
476
476
|
const s = n.slice();
|
|
477
477
|
return s[10] = t[e], s[12] = e, s;
|
|
478
478
|
}
|
|
479
|
-
function
|
|
479
|
+
function dt(n) {
|
|
480
480
|
let t, e, s = (
|
|
481
481
|
/*item*/
|
|
482
482
|
n[10].CN + ""
|
|
@@ -498,13 +498,13 @@ function ut(n) {
|
|
|
498
498
|
}
|
|
499
499
|
return {
|
|
500
500
|
c() {
|
|
501
|
-
t = I("div"), e = I("span"), a = E(s), r = O(), o = I("span"), u = E(i), h = E("("), y = E(g), D = E(")"), d = O(), S(e, "class", "svelte-jtc2v4"), S(o, "class", "svelte-jtc2v4"), S(t, "class", p =
|
|
501
|
+
t = I("div"), e = I("span"), a = E(s), r = O(), o = I("span"), u = E(i), h = E("("), y = E(g), D = E(")"), d = O(), S(e, "class", "svelte-jtc2v4"), S(o, "class", "svelte-jtc2v4"), S(t, "class", p = rt(`cert-item ${/*index*/
|
|
502
502
|
n[12] === 0 ? "cert-item-first" : ""} ${/*index*/
|
|
503
503
|
n[12] === /*selectedIndex*/
|
|
504
504
|
n[4] ? "cert-item-selected" : ""}`) + " svelte-jtc2v4");
|
|
505
505
|
},
|
|
506
506
|
m(m, k) {
|
|
507
|
-
|
|
507
|
+
Q(m, t, k), x(t, e), x(e, a), x(t, r), x(t, o), x(o, u), x(o, h), x(o, y), x(o, D), x(t, d), f || (v = F(t, "click", w), f = !0);
|
|
508
508
|
},
|
|
509
509
|
p(m, k) {
|
|
510
510
|
n = m, k & /*certList*/
|
|
@@ -514,7 +514,7 @@ function ut(n) {
|
|
|
514
514
|
n[10].DevClass + "") && M(u, i), k & /*certList*/
|
|
515
515
|
1 && g !== (g = /*item*/
|
|
516
516
|
n[10].sn + "") && M(y, g), k & /*selectedIndex*/
|
|
517
|
-
16 && p !== (p =
|
|
517
|
+
16 && p !== (p = rt(`cert-item ${/*index*/
|
|
518
518
|
n[12] === 0 ? "cert-item-first" : ""} ${/*index*/
|
|
519
519
|
n[12] === /*selectedIndex*/
|
|
520
520
|
n[4] ? "cert-item-selected" : ""}`) + " svelte-jtc2v4") && S(t, "class", p);
|
|
@@ -524,35 +524,35 @@ function ut(n) {
|
|
|
524
524
|
}
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
function
|
|
528
|
-
let t, e =
|
|
527
|
+
function se(n) {
|
|
528
|
+
let t, e = it(
|
|
529
529
|
/*certList*/
|
|
530
530
|
n[0]
|
|
531
531
|
), s = [];
|
|
532
532
|
for (let a = 0; a < e.length; a += 1)
|
|
533
|
-
s[a] =
|
|
533
|
+
s[a] = dt(lt(n, e, a));
|
|
534
534
|
return {
|
|
535
535
|
c() {
|
|
536
536
|
for (let a = 0; a < s.length; a += 1)
|
|
537
537
|
s[a].c();
|
|
538
|
-
t =
|
|
538
|
+
t = zt();
|
|
539
539
|
},
|
|
540
540
|
m(a, r) {
|
|
541
541
|
for (let o = 0; o < s.length; o += 1)
|
|
542
542
|
s[o] && s[o].m(a, r);
|
|
543
|
-
|
|
543
|
+
Q(a, t, r);
|
|
544
544
|
},
|
|
545
545
|
p(a, r) {
|
|
546
546
|
if (r & /*selectedIndex, certList*/
|
|
547
547
|
17) {
|
|
548
|
-
e =
|
|
548
|
+
e = it(
|
|
549
549
|
/*certList*/
|
|
550
550
|
a[0]
|
|
551
551
|
);
|
|
552
552
|
let o;
|
|
553
553
|
for (o = 0; o < e.length; o += 1) {
|
|
554
|
-
const i =
|
|
555
|
-
s[o] ? s[o].p(i, r) : (s[o] =
|
|
554
|
+
const i = lt(a, e, o);
|
|
555
|
+
s[o] ? s[o].p(i, r) : (s[o] = dt(i), s[o].c(), s[o].m(t.parentNode, t));
|
|
556
556
|
}
|
|
557
557
|
for (; o < s.length; o += 1)
|
|
558
558
|
s[o].d(1);
|
|
@@ -560,13 +560,13 @@ function ae(n) {
|
|
|
560
560
|
}
|
|
561
561
|
},
|
|
562
562
|
d(a) {
|
|
563
|
-
a && R(t),
|
|
563
|
+
a && R(t), Nt(s, a);
|
|
564
564
|
}
|
|
565
565
|
};
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function ae(n) {
|
|
568
568
|
let t, e;
|
|
569
|
-
return t = new
|
|
569
|
+
return t = new ne({
|
|
570
570
|
props: {
|
|
571
571
|
onOk: (
|
|
572
572
|
/*handleConfirm*/
|
|
@@ -589,15 +589,15 @@ function re(n) {
|
|
|
589
589
|
n[3]
|
|
590
590
|
),
|
|
591
591
|
title: "选择证书",
|
|
592
|
-
$$slots: { default: [
|
|
592
|
+
$$slots: { default: [se] },
|
|
593
593
|
$$scope: { ctx: n }
|
|
594
594
|
}
|
|
595
595
|
}), {
|
|
596
596
|
c() {
|
|
597
|
-
|
|
597
|
+
Wt(t.$$.fragment);
|
|
598
598
|
},
|
|
599
599
|
m(s, a) {
|
|
600
|
-
|
|
600
|
+
mt(t, s, a), e = !0;
|
|
601
601
|
},
|
|
602
602
|
p(s, [a]) {
|
|
603
603
|
const r = {};
|
|
@@ -611,17 +611,17 @@ function re(n) {
|
|
|
611
611
|
8209 && (r.$$scope = { dirty: a, ctx: s }), t.$set(r);
|
|
612
612
|
},
|
|
613
613
|
i(s) {
|
|
614
|
-
e || (
|
|
614
|
+
e || (Y(t.$$.fragment, s), e = !0);
|
|
615
615
|
},
|
|
616
616
|
o(s) {
|
|
617
|
-
|
|
617
|
+
ft(t.$$.fragment, s), e = !1;
|
|
618
618
|
},
|
|
619
619
|
d(s) {
|
|
620
|
-
|
|
620
|
+
wt(t, s);
|
|
621
621
|
}
|
|
622
622
|
};
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function re(n, t, e) {
|
|
625
625
|
let { certList: s = [] } = t, { onCancel: a } = t, { onOk: r } = t, { onClose: o } = t, { cancelText: i = "" } = t, { okText: u = "" } = t, h = 0;
|
|
626
626
|
const g = () => {
|
|
627
627
|
o == null || o();
|
|
@@ -643,9 +643,9 @@ function oe(n, t, e) {
|
|
|
643
643
|
D
|
|
644
644
|
];
|
|
645
645
|
}
|
|
646
|
-
class
|
|
646
|
+
class oe extends vt {
|
|
647
647
|
constructor(t) {
|
|
648
|
-
super(),
|
|
648
|
+
super(), Ct(this, t, re, ae, yt, {
|
|
649
649
|
certList: 0,
|
|
650
650
|
onCancel: 7,
|
|
651
651
|
onOk: 8,
|
|
@@ -655,11 +655,11 @@ class ce extends kt {
|
|
|
655
655
|
});
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
-
class
|
|
658
|
+
class ce {
|
|
659
659
|
constructor() {
|
|
660
660
|
c(this, "modalInstance", { current: null });
|
|
661
661
|
c(this, "open", (t) => new Promise((e, s) => {
|
|
662
|
-
this.modalInstance.current = new
|
|
662
|
+
this.modalInstance.current = new oe({
|
|
663
663
|
target: document.body,
|
|
664
664
|
props: b(B({}, t), {
|
|
665
665
|
onCancel: (a) => {
|
|
@@ -682,11 +682,11 @@ class ie {
|
|
|
682
682
|
});
|
|
683
683
|
}
|
|
684
684
|
}
|
|
685
|
-
const
|
|
686
|
-
class
|
|
685
|
+
const ie = new ce();
|
|
686
|
+
class le {
|
|
687
687
|
constructor(t) {
|
|
688
688
|
c(this, "socketInstance", null);
|
|
689
|
-
c(this, "eventBus", new
|
|
689
|
+
c(this, "eventBus", new Pt());
|
|
690
690
|
c(this, "isRememberPin", !1);
|
|
691
691
|
c(this, "socketEvent");
|
|
692
692
|
c(this, "pinPolicy");
|
|
@@ -730,10 +730,10 @@ class de {
|
|
|
730
730
|
}));
|
|
731
731
|
c(this, "base64Encode", (t) => {
|
|
732
732
|
const e = new TextEncoder().encode(t);
|
|
733
|
-
return
|
|
733
|
+
return nt.fromByteArray(e);
|
|
734
734
|
});
|
|
735
735
|
c(this, "base64Decode", (t) => {
|
|
736
|
-
const e =
|
|
736
|
+
const e = nt.toByteArray(t);
|
|
737
737
|
return new TextDecoder().decode(e);
|
|
738
738
|
});
|
|
739
739
|
c(this, "changeIsRememberPin", (t) => l(this, null, function* () {
|
|
@@ -747,7 +747,7 @@ class de {
|
|
|
747
747
|
}));
|
|
748
748
|
c(this, "addUkeyEvents", () => l(this, null, function* () {
|
|
749
749
|
this.sendMessage("GZCA_StartListen", {
|
|
750
|
-
Type:
|
|
750
|
+
Type: Et
|
|
751
751
|
}).then((t) => {
|
|
752
752
|
var e, s;
|
|
753
753
|
(s = (e = this.socketConfig) == null ? void 0 : e.onUkeyEvent) == null || s.call(e, t);
|
|
@@ -776,7 +776,7 @@ class de {
|
|
|
776
776
|
}));
|
|
777
777
|
c(this, "chooseCert", (t) => l(this, null, function* () {
|
|
778
778
|
const e = yield this.getCertList(t);
|
|
779
|
-
return (e == null ? void 0 : e.length) === 1 ? e[0] : yield
|
|
779
|
+
return (e == null ? void 0 : e.length) === 1 ? e[0] : yield ie.open({
|
|
780
780
|
certList: e
|
|
781
781
|
});
|
|
782
782
|
}));
|
|
@@ -869,7 +869,7 @@ class de {
|
|
|
869
869
|
return yield this.sendMessage("GZCA_GetCertInfoByOid", t);
|
|
870
870
|
}));
|
|
871
871
|
var e, s;
|
|
872
|
-
this.socketConfig = t, this.socketInstance = this.createSocket(t), this.isRememberPin = (e = t.isRememberPin) != null ? e : !1, this.pinPolicy = (s = t.pinPolicy) != null ? s :
|
|
872
|
+
this.socketConfig = t, this.socketInstance = this.createSocket(t), this.isRememberPin = (e = t.isRememberPin) != null ? e : !1, this.pinPolicy = (s = t.pinPolicy) != null ? s : ut.MIN;
|
|
873
873
|
}
|
|
874
874
|
createSocket(t) {
|
|
875
875
|
const e = new WebSocket(t.url);
|
|
@@ -895,8 +895,8 @@ const H = class H {
|
|
|
895
895
|
c(this, "coreInstance", null);
|
|
896
896
|
c(this, "gwsConfig", {});
|
|
897
897
|
c(this, "createGwsCore", (t) => {
|
|
898
|
-
this.gwsConfig = t != null ? t : {}, this.coreInstance = new
|
|
899
|
-
url:
|
|
898
|
+
this.gwsConfig = t != null ? t : {}, this.coreInstance = new le(b(B({}, t != null ? t : {}), {
|
|
899
|
+
url: St
|
|
900
900
|
}));
|
|
901
901
|
});
|
|
902
902
|
c(this, "appendCertBase64", (t, e = !0) => l(this, null, function* () {
|
|
@@ -918,14 +918,14 @@ const H = class H {
|
|
|
918
918
|
c(this, "getSignatureCert", (t) => l(this, null, function* () {
|
|
919
919
|
var s;
|
|
920
920
|
return yield (s = this.coreInstance) == null ? void 0 : s.getCert(
|
|
921
|
-
{ CertType:
|
|
921
|
+
{ CertType: $t },
|
|
922
922
|
t
|
|
923
923
|
);
|
|
924
924
|
}));
|
|
925
925
|
c(this, "getEncryptionCert", (t) => l(this, null, function* () {
|
|
926
926
|
var s;
|
|
927
927
|
return yield (s = this.coreInstance) == null ? void 0 : s.getCert(
|
|
928
|
-
{ CertType:
|
|
928
|
+
{ CertType: It },
|
|
929
929
|
t
|
|
930
930
|
);
|
|
931
931
|
}));
|
|
@@ -1111,23 +1111,26 @@ const H = class H {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
};
|
|
1113
1113
|
c(H, "instance", null);
|
|
1114
|
-
let
|
|
1115
|
-
function
|
|
1114
|
+
let N = H;
|
|
1115
|
+
function ue(n) {
|
|
1116
1116
|
return new Promise((t, e) => {
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1117
|
+
if (N.instance)
|
|
1118
|
+
t(N.instance);
|
|
1119
|
+
else {
|
|
1120
|
+
const s = new N(b(B({}, n != null ? n : {}), {
|
|
1121
|
+
onOpen(a) {
|
|
1122
|
+
var r;
|
|
1123
|
+
t(s), (r = n == null ? void 0 : n.onOpen) == null || r.call(n, a);
|
|
1124
|
+
},
|
|
1125
|
+
onClose(a) {
|
|
1126
|
+
var r;
|
|
1127
|
+
e(a), (r = n == null ? void 0 : n.onClose) == null || r.call(n, a);
|
|
1128
|
+
}
|
|
1129
|
+
}));
|
|
1130
|
+
}
|
|
1128
1131
|
});
|
|
1129
1132
|
}
|
|
1130
1133
|
export {
|
|
1131
|
-
|
|
1132
|
-
|
|
1134
|
+
N as GwsService,
|
|
1135
|
+
ue as createService
|
|
1133
1136
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(D,w){typeof exports=="object"&&typeof module!="undefined"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(D=typeof globalThis!="undefined"?globalThis:D||self,w(D.GWS_CLIENT={}))})(this,function(D){"use strict";var ie=Object.defineProperty,le=Object.defineProperties;var de=Object.getOwnPropertyDescriptors;var It=Object.getOwnPropertySymbols;var ue=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable;var lt=(D,w,S)=>w in D?ie(D,w,{enumerable:!0,configurable:!0,writable:!0,value:S}):D[w]=S,$=(D,w)=>{for(var S in w||(w={}))ue.call(w,S)&<(D,S,w[S]);if(It)for(var S of It(w))he.call(w,S)&<(D,S,w[S]);return D},I=(D,w)=>le(D,de(w));var c=(D,w,S)=>lt(D,typeof w!="symbol"?w+"":w,S);var i=(D,w,S)=>new Promise((Y,Z)=>{var tt=A=>{try{T(S.next(A))}catch(z){Z(z)}},et=A=>{try{T(S.throw(A))}catch(z){Z(z)}},T=A=>A.done?Y(A.value):Promise.resolve(A.value).then(tt,et);T((S=S.apply(D,w)).next())});const w=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",S="1",Y="2";var Z=(n=>(n[n.MIN=0]="MIN",n[n.LOW=1]="LOW",n[n.MIDDLE=2]="MIDDLE",n[n.HIGH=3]="HIGH",n))(Z||{});const tt="00000001";function et(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var T={},A;function z(){if(A)return T;A=1,T.byteLength=d,T.toByteArray=u,T.fromByteArray=B;for(var n=[],t=[],e=typeof Uint8Array!="undefined"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,r=s.length;a<r;++a)n[a]=s[a],t[s.charCodeAt(a)]=a;t[45]=62,t[95]=63;function o(l){var y=l.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=l.indexOf("=");f===-1&&(f=y);var k=f===y?0:4-f%4;return[f,k]}function d(l){var y=o(l),f=y[0],k=y[1];return(f+k)*3/4-k}function p(l,y,f){return(y+f)*3/4-f}function u(l){var y,f=o(l),k=f[0],C=f[1],m=new e(p(l,k,C)),x=0,M=C>0?k-4:k,v;for(v=0;v<M;v+=4)y=t[l.charCodeAt(v)]<<18|t[l.charCodeAt(v+1)]<<12|t[l.charCodeAt(v+2)]<<6|t[l.charCodeAt(v+3)],m[x++]=y>>16&255,m[x++]=y>>8&255,m[x++]=y&255;return C===2&&(y=t[l.charCodeAt(v)]<<2|t[l.charCodeAt(v+1)]>>4,m[x++]=y&255),C===1&&(y=t[l.charCodeAt(v)]<<10|t[l.charCodeAt(v+1)]<<4|t[l.charCodeAt(v+2)]>>2,m[x++]=y>>8&255,m[x++]=y&255),m}function g(l){return n[l>>18&63]+n[l>>12&63]+n[l>>6&63]+n[l&63]}function h(l,y,f){for(var k,C=[],m=y;m<f;m+=3)k=(l[m]<<16&16711680)+(l[m+1]<<8&65280)+(l[m+2]&255),C.push(g(k));return C.join("")}function B(l){for(var y,f=l.length,k=f%3,C=[],m=16383,x=0,M=f-k;x<M;x+=m)C.push(h(l,x,x+m>M?M:x+m));return k===1?(y=l[f-1],C.push(n[y>>2]+n[y<<4&63]+"==")):k===2&&(y=(l[f-2]<<8)+l[f-1],C.push(n[y>>10]+n[y>>4&63]+n[y<<2&63]+"=")),C.join("")}return T}var Et=z();const dt=et(Et);class At{constructor(){c(this,"deps",new Map)}on(t,e){this.deps.set(t,e)}emit(t,e){const s=this.deps.get(t);s&&s(e)}}(function(){try{var n=document.createElement("style");n.appendChild(document.createTextNode("button.svelte-n1zwga{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-n1zwga{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-n1zwga{background-color:#fff;padding:20px;border-radius:5px;width:40%}.model-title.svelte-n1zwga{color:#303133;font-size:18px;margin-bottom:16px}.modal-visible.svelte-n1zwga{display:flex}.modal-footer.svelte-n1zwga{display:flex;align-items:center;justify-content:flex-end;margin-top:16px}.modal-btn.svelte-n1zwga{padding:8px 15px;border-radius:4px;font-size:14px;border:1px solid #dcdfe6}.success.svelte-n1zwga{background-color:#409eff;margin-left:12px;color:#fff}.slot.svelte-n1zwga{max-height:200px;overflow-y:scroll}.slot.svelte-n1zwga::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:16px;display:flex;align-items:center;cursor:pointer;border-bottom:1px solid #ebeef5;font-size:14px}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:1px solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:180px;height:180px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid #ccc;margin-top:10px;margin-right:10px;border-radius:4px}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:100px;height:100px}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:10px;color:#333}")),document.head.appendChild(n)}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();var _t=Object.defineProperty,Lt=(n,t,e)=>t in n?_t(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ut=(n,t,e)=>Lt(n,typeof t!="symbol"?t+"":t,e);function nt(){}function Pt(n,t){for(const e in t)n[e]=t[e];return n}function ht(n){return n()}function yt(){return Object.create(null)}function V(n){n.forEach(ht)}function R(n){return typeof n=="function"}function pt(n,t){return n!=n?t==t:n!==t||n&&typeof n=="object"||typeof n=="function"}function Tt(n){return Object.keys(n).length===0}function Mt(n,t,e,s){if(n){const a=gt(n,t,e,s);return n[0](a)}}function gt(n,t,e,s){return n[1]&&s?Pt(e.ctx.slice(),n[1](s(t))):e.ctx}function Ht(n,t,e,s){if(n[2]&&s){const a=n[2](s(e));if(t.dirty===void 0)return a;if(typeof a=="object"){const r=[],o=Math.max(t.dirty.length,a.length);for(let d=0;d<o;d+=1)r[d]=t.dirty[d]|a[d];return r}return t.dirty|a}return t.dirty}function Gt(n,t,e,s,a,r){if(a){const o=gt(t,e,s,r);n.p(o,a)}}function jt(n){if(n.ctx.length>32){const t=[],e=n.ctx.length/32;for(let s=0;s<e;s++)t[s]=-1;return t}return-1}function ft(n){return n!=null?n:""}function b(n,t){n.appendChild(t)}function st(n,t,e){n.insertBefore(t,e||null)}function q(n){n.parentNode&&n.parentNode.removeChild(n)}function Ft(n,t){for(let e=0;e<n.length;e+=1)n[e]&&n[e].d(t)}function _(n){return document.createElement(n)}function L(n){return document.createTextNode(n)}function U(){return L(" ")}function Ot(){return L("")}function J(n,t,e,s){return n.addEventListener(t,e,s),()=>n.removeEventListener(t,e,s)}function E(n,t,e){e==null?n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}function Nt(n){return Array.from(n.childNodes)}function G(n,t){t=""+t,n.data!==t&&(n.data=t)}let at;function W(n){at=n}const j=[],mt=[];let F=[];const wt=[],Zt=Promise.resolve();let rt=!1;function zt(){rt||(rt=!0,Zt.then(Ct))}function ot(n){F.push(n)}const ct=new Set;let O=0;function Ct(){if(O!==0)return;const n=at;do{try{for(;O<j.length;){const t=j[O];O++,W(t),Vt(t.$$)}}catch(t){throw j.length=0,O=0,t}for(W(null),j.length=0,O=0;mt.length;)mt.pop()();for(let t=0;t<F.length;t+=1){const e=F[t];ct.has(e)||(ct.add(e),e())}F.length=0}while(j.length);for(;wt.length;)wt.pop()();rt=!1,ct.clear(),W(n)}function Vt(n){if(n.fragment!==null){n.update(),V(n.before_update);const t=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,t),n.after_update.forEach(ot)}}function Rt(n){const t=[],e=[];F.forEach(s=>n.indexOf(s)===-1?t.push(s):e.push(s)),e.forEach(s=>s()),F=t}const K=new Set;let Ut;function it(n,t){n&&n.i&&(K.delete(n),n.i(t))}function vt(n,t,e,s){if(n&&n.o){if(K.has(n))return;K.add(n),Ut.c.push(()=>{K.delete(n)}),n.o(t)}}function kt(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function Jt(n){n&&n.c()}function xt(n,t,e){const{fragment:s,after_update:a}=n.$$;s&&s.m(t,e),ot(()=>{const r=n.$$.on_mount.map(ht).filter(R);n.$$.on_destroy?n.$$.on_destroy.push(...r):V(r),n.$$.on_mount=[]}),a.forEach(ot)}function Dt(n,t){const e=n.$$;e.fragment!==null&&(Rt(e.after_update),V(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Wt(n,t){n.$$.dirty[0]===-1&&(j.push(n),zt(),n.$$.dirty.fill(0)),n.$$.dirty[t/31|0]|=1<<t%31}function bt(n,t,e,s,a,r,o=null,d=[-1]){const p=at;W(n);const u=n.$$={fragment:null,ctx:[],props:r,update:nt,not_equal:a,bound:yt(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(p?p.$$.context:[])),callbacks:yt(),dirty:d,skip_bound:!1,root:t.target||p.$$.root};o&&o(u.root);let g=!1;if(u.ctx=e?e(n,t.props||{},(h,B,...l)=>{const y=l.length?l[0]:B;return u.ctx&&a(u.ctx[h],u.ctx[h]=y)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](y),g&&Wt(n,h)),B}):[],u.update(),g=!0,V(u.before_update),u.fragment=s?s(u.ctx):!1,t.target){if(t.hydrate){const h=Nt(t.target);u.fragment&&u.fragment.l(h),h.forEach(q)}else u.fragment&&u.fragment.c();t.intro&&it(n.$$.fragment),xt(n,t.target,t.anchor),Ct()}W(p)}class St{constructor(){ut(this,"$$"),ut(this,"$$set")}$destroy(){Dt(this,1),this.$destroy=nt}$on(t,e){if(!R(e))return nt;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(e),()=>{const a=s.indexOf(e);a!==-1&&s.splice(a,1)}}$set(t){this.$$set&&!Tt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const qt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(qt);function Kt(n){let t,e,s,a=(n[1]||"标题")+"",r,o,d,p,u,g,h=(n[4]||"取消")+"",B,l,y,f=(n[5]||"确认")+"",k,C,m,x;const M=n[7].default,v=Mt(M,n,n[6],null);return{c(){t=_("div"),e=_("div"),s=_("div"),r=L(a),o=U(),d=_("div"),v&&v.c(),p=U(),u=_("div"),g=_("button"),B=L(h),l=U(),y=_("button"),k=L(f),E(s,"class","model-title svelte-n1zwga"),E(d,"class","slot svelte-n1zwga"),E(g,"class","modal-btn svelte-n1zwga"),E(y,"class","modal-btn success svelte-n1zwga"),E(u,"class","modal-footer svelte-n1zwga"),E(e,"class","modal-content svelte-n1zwga"),E(t,"class","modal-background modal-visible svelte-n1zwga")},m(P,H){st(P,t,H),b(t,e),b(e,s),b(s,r),b(e,o),b(e,d),v&&v.m(d,null),b(e,p),b(e,u),b(u,g),b(g,B),b(u,l),b(u,y),b(y,k),C=!0,m||(x=[J(g,"click",function(){R(n[0])&&n[0].apply(this,arguments)}),J(y,"click",function(){R(n[2])&&n[2].apply(this,arguments)}),J(e,"click",Qt),J(t,"click",function(){R(n[3])&&n[3].apply(this,arguments)})],m=!0)},p(P,[H]){n=P,(!C||H&2)&&a!==(a=(n[1]||"标题")+"")&&G(r,a),v&&v.p&&(!C||H&64)&&Gt(v,M,n,n[6],C?Ht(M,n[6],H,null):jt(n[6]),null),(!C||H&16)&&h!==(h=(n[4]||"取消")+"")&&G(B,h),(!C||H&32)&&f!==(f=(n[5]||"确认")+"")&&G(k,f)},i(P){C||(it(v,P),C=!0)},o(P){vt(v,P),C=!1},d(P){P&&q(t),v&&v.d(P),m=!1,V(x)}}}const Qt=n=>n.stopPropagation();function Xt(n,t,e){let{$$slots:s={},$$scope:a}=t,{onCancel:r}=t,{title:o}=t,{onOk:d}=t,{onClose:p}=t,{cancelText:u}=t,{okText:g}=t;return n.$$set=h=>{"onCancel"in h&&e(0,r=h.onCancel),"title"in h&&e(1,o=h.title),"onOk"in h&&e(2,d=h.onOk),"onClose"in h&&e(3,p=h.onClose),"cancelText"in h&&e(4,u=h.cancelText),"okText"in h&&e(5,g=h.okText),"$$scope"in h&&e(6,a=h.$$scope)},[r,o,d,p,u,g,a,s]}class Yt extends St{constructor(t){super(),bt(this,t,Xt,Kt,pt,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5})}}function Bt(n,t,e){const s=n.slice();return s[10]=t[e],s[12]=e,s}function $t(n){let t,e,s=n[10].CN+"",a,r,o,d=n[10].DevClass+"",p,u,g=n[10].sn+"",h,B,l,y,f,k;function C(){return n[9](n[12])}return{c(){t=_("div"),e=_("span"),a=L(s),r=U(),o=_("span"),p=L(d),u=L("("),h=L(g),B=L(")"),l=U(),E(e,"class","svelte-jtc2v4"),E(o,"class","svelte-jtc2v4"),E(t,"class",y=ft(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")},m(m,x){st(m,t,x),b(t,e),b(e,a),b(t,r),b(t,o),b(o,p),b(o,u),b(o,h),b(o,B),b(t,l),f||(k=J(t,"click",C),f=!0)},p(m,x){n=m,x&1&&s!==(s=n[10].CN+"")&&G(a,s),x&1&&d!==(d=n[10].DevClass+"")&&G(p,d),x&1&&g!==(g=n[10].sn+"")&&G(h,g),x&16&&y!==(y=ft(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")&&E(t,"class",y)},d(m){m&&q(t),f=!1,k()}}}function te(n){let t,e=kt(n[0]),s=[];for(let a=0;a<e.length;a+=1)s[a]=$t(Bt(n,e,a));return{c(){for(let a=0;a<s.length;a+=1)s[a].c();t=Ot()},m(a,r){for(let o=0;o<s.length;o+=1)s[o]&&s[o].m(a,r);st(a,t,r)},p(a,r){if(r&17){e=kt(a[0]);let o;for(o=0;o<e.length;o+=1){const d=Bt(a,e,o);s[o]?s[o].p(d,r):(s[o]=$t(d),s[o].c(),s[o].m(t.parentNode,t))}for(;o<s.length;o+=1)s[o].d(1);s.length=e.length}},d(a){a&&q(t),Ft(s,a)}}}function ee(n){let t,e;return t=new Yt({props:{onOk:n[6],onClose:n[1],onCancel:n[5],cancelText:n[2],okText:n[3],title:"选择证书",$$slots:{default:[te]},$$scope:{ctx:n}}}),{c(){Jt(t.$$.fragment)},m(s,a){xt(t,s,a),e=!0},p(s,[a]){const r={};a&2&&(r.onClose=s[1]),a&4&&(r.cancelText=s[2]),a&8&&(r.okText=s[3]),a&8209&&(r.$$scope={dirty:a,ctx:s}),t.$set(r)},i(s){e||(it(t.$$.fragment,s),e=!0)},o(s){vt(t.$$.fragment,s),e=!1},d(s){Dt(t,s)}}}function ne(n,t,e){let{certList:s=[]}=t,{onCancel:a}=t,{onOk:r}=t,{onClose:o}=t,{cancelText:d=""}=t,{okText:p=""}=t,u=0;const g=()=>{o==null||o()},h=()=>{r==null||r(s[u]),o==null||o()},B=l=>e(4,u=l);return n.$$set=l=>{"certList"in l&&e(0,s=l.certList),"onCancel"in l&&e(7,a=l.onCancel),"onOk"in l&&e(8,r=l.onOk),"onClose"in l&&e(1,o=l.onClose),"cancelText"in l&&e(2,d=l.cancelText),"okText"in l&&e(3,p=l.okText)},[s,o,d,p,u,g,h,a,r,B]}class se extends St{constructor(t){super(),bt(this,t,ne,ee,pt,{certList:0,onCancel:7,onOk:8,onClose:1,cancelText:2,okText:3})}}class ae{constructor(){c(this,"modalInstance",{current:null});c(this,"open",t=>new Promise((e,s)=>{this.modalInstance.current=new se({target:document.body,props:I($({},t),{onCancel:a=>{s()},onOk:a=>{e(a)},onClose:()=>{this.close()}})})}));c(this,"close",()=>{setTimeout(()=>{var t;(t=this.modalInstance.current)==null||t.$destroy()})})}}const re=new ae;class oe{constructor(t){c(this,"socketInstance",null);c(this,"eventBus",new At);c(this,"isRememberPin",!1);c(this,"socketEvent");c(this,"pinPolicy");c(this,"socketConfig",null);c(this,"getSocketReadyState",()=>{var t;return(t=this.socketInstance)==null?void 0:t.readyState});c(this,"destroy",()=>{var t;(t=this.socketInstance)==null||t.close()});c(this,"sendMessage",(t,e)=>new Promise((s,a)=>{var o,d;if(((o=this.socketInstance)==null?void 0:o.readyState)!==WebSocket.OPEN){console.log(t),a({errCode:-1,msg:"socket未连接"});return}const r={function:t,args:[e!=null?e:{}]};(d=this.socketInstance)==null||d.send(JSON.stringify(r)),this.eventBus.on(t,p=>{p.success?s(p.data):a(p)})}));c(this,"handleEventData",t=>i(this,null,function*(){var e,s,a,r,o,d;if(t.data instanceof Blob){const p=yield t.data.arrayBuffer(),g=new TextDecoder("gbk").decode(p),h=JSON.parse(g),B={data:h.data,success:(e=h.result)==null?void 0:e.success,msg:(s=h.result)==null?void 0:s.msg,errCode:(a=h.result)==null?void 0:a.errCode};this.eventBus.emit((r=h.result)==null?void 0:r.function,B),(d=(o=this.socketConfig)==null?void 0:o.onMessage)==null||d.call(o,B)}}));c(this,"base64Encode",t=>{const e=new TextEncoder().encode(t);return dt.fromByteArray(e)});c(this,"base64Decode",t=>{const e=dt.toByteArray(t);return new TextDecoder().decode(e)});c(this,"changeIsRememberPin",t=>i(this,null,function*(){this.isRememberPin=t}));c(this,"changePinPolicy",t=>i(this,null,function*(){this.pinPolicy=t}));c(this,"checkCertIsLogin",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",t)}));c(this,"addUkeyEvents",()=>i(this,null,function*(){this.sendMessage("GZCA_StartListen",{Type:tt}).then(t=>{var e,s;(s=(e=this.socketConfig)==null?void 0:e.onUkeyEvent)==null||s.call(e,t)})}));c(this,"certLogin",t=>i(this,null,function*(){const e=yield this.checkCertIsLogin({ContainerName:t});e!=null&&e[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:t,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));c(this,"getCert",(t,e)=>i(this,null,function*(){const s=e!=null?e:yield this.chooseCert(t);return yield this.certLogin(s.ContainerName),s}));c(this,"getCertList",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",t)}));c(this,"chooseCert",t=>i(this,null,function*(){const e=yield this.getCertList(t);return(e==null?void 0:e.length)===1?e[0]:yield re.open({certList:e})}));c(this,"pkcs1Sign",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",I($({},t),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1Base64Sign",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",I($({},t),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1VerifySignature",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",t)}));c(this,"pkcs1Base64VerifySignature",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",t)}));c(this,"getSealList",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",I($({},t),{IsLogin:this.getIsLogin()}))}));c(this,"sm2SignPreprocess1",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",t)}));c(this,"sm2SignPreprocess2",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",t)}));c(this,"pkcs1HashSign",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",I($({},t!=null?t:{}),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1HashVerifySignature",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",t)}));c(this,"pkcs7Sign",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",I($({},t),{IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy}))}));c(this,"pkcs7VerifySignature",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",t)}));c(this,"sm3Hash",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_HashData",t)}));c(this,"sm3HexHash",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",t)}));c(this,"sm3FileHash",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",t)}));c(this,"sm3HashEncryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_HMac",t)}));c(this,"pkcs7Encryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",t)}));c(this,"pkcs7Decryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",I($({},t),{IsLogin:this.getIsLogin()}))}));c(this,"asymmetricEncryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",t)}));c(this,"asymmetricDecryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",I($({},t),{IsLogin:this.getIsLogin()}))}));c(this,"sm4Encryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",t)}));c(this,"sm4Decryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",t)}));c(this,"getCertInfo",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",t)}));c(this,"getCertInfoByOid",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",t)}));var e,s;this.socketConfig=t,this.socketInstance=this.createSocket(t),this.isRememberPin=(e=t.isRememberPin)!=null?e:!1,this.pinPolicy=(s=t.pinPolicy)!=null?s:Z.MIN}createSocket(t){const e=new WebSocket(t.url);return e.onerror=s=>{var a;(a=t.onError)==null||a.call(t,s)},e.onopen=s=>{var a;(a=t.onOpen)==null||a.call(t,s),this.addUkeyEvents()},e.onmessage=s=>{this.handleEventData(s)},e.onclose=s=>{var a;(a=t.onClose)==null||a.call(t,s)},e}getIsLogin(){return this.isRememberPin?"Y":"N"}}const N=class N{constructor(t){c(this,"coreInstance",null);c(this,"gwsConfig",{});c(this,"createGwsCore",t=>{this.gwsConfig=t!=null?t:{},this.coreInstance=new oe(I($({},t!=null?t:{}),{url:w}))});c(this,"appendCertBase64",(t,e=!0)=>i(this,null,function*(){if(t.CertB64)return t;const s=e?yield this.getSignatureCert():yield this.getEncryptionCert();return I($({},t!=null?t:{}),{CertB64:s==null?void 0:s.CertB64})}));c(this,"destroy",()=>{var t;(t=this.coreInstance)==null||t.destroy(),this.coreInstance=null});c(this,"restart",t=>{this.coreInstance&&this.destroy(),this.gwsConfig=t!=null?t:this.gwsConfig,this.createGwsCore(t)});c(this,"getSocketReadyState",()=>{var t;return(t=this.coreInstance)==null?void 0:t.getSocketReadyState()});c(this,"getSignatureCert",t=>i(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:S},t)}));c(this,"getEncryptionCert",t=>i(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:Y},t)}));c(this,"base64Encode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Encode(t.Data)});c(this,"base64Decode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Decode(t.DataB64)});c(this,"changeIsRememberPin",t=>{var e;(e=this.coreInstance)==null||e.changeIsRememberPin(t)});c(this,"changePinPolicy",t=>{var e;(e=this.coreInstance)==null||e.changePinPolicy(t)});c(this,"pkcs1Sign",(t,e)=>i(this,null,function*(){var r,o,d;const s=yield this.getSignatureCert(e),a=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(I($({},t!=null?t:{}),{ContainerName:(r=s==null?void 0:s.ContainerName)!=null?r:""}));return(d=a==null?void 0:a[0])==null?void 0:d.SignData}));c(this,"pkcs1VerifySignature",t=>i(this,null,function*(){var a;const e=yield this.appendCertBase64(t),s=yield(a=this.coreInstance)==null?void 0:a.pkcs1VerifySignature(e);return Array.isArray(s)}));c(this,"pkcs1Base64Sign",(t,e)=>i(this,null,function*(){var o,d,p,u,g;const s=yield this.getSignatureCert(e),a=(d=t.DataB64)!=null?d:this.base64Encode({Data:(o=t.Data)!=null?o:""}),r=yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64Sign({ContainerName:(p=s==null?void 0:s.ContainerName)!=null?p:"",DataB64:a});return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));c(this,"pkcs1Base64VerifySignature",t=>i(this,null,function*(){var r,o,d;const e=(o=t.DataB64)!=null?o:this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=yield this.appendCertBase64(t);return!!(yield(d=this.coreInstance)==null?void 0:d.pkcs1Base64VerifySignature({CertB64:s.CertB64,DataB64:e,SignData:s.SignData}))}));c(this,"getSealList",()=>i(this,null,function*(){var s,a;const t=yield this.getSignatureCert(),e=yield(a=this.coreInstance)==null?void 0:a.getSealList({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:""});return{cert:t,sealList:e}}));c(this,"sm2SignPreprocess1",t=>i(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t),s=yield(a=this.coreInstance)==null?void 0:a.sm2SignPreprocess1(e);return(r=s==null?void 0:s[0])==null?void 0:r.Z}));c(this,"sm2SignPreprocess2",t=>i(this,null,function*(){var r,o;const e=this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=yield this.appendCertBase64(t),a=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:s.CertB64,DataB64:e});return a==null?void 0:a[0].H}));c(this,"pkcs1HashSign",(t,e)=>i(this,null,function*(){var r,o,d,p;const s=yield this.getSignatureCert(e),a=yield(d=this.coreInstance)==null?void 0:d.pkcs1HashSign({ContainerName:(r=s==null?void 0:s.ContainerName)!=null?r:"",DataB64:t.DataB64,HashAlg:(o=t.HashAlg)!=null?o:"sm3"});return(p=a==null?void 0:a[0])==null?void 0:p.SignData}));c(this,"pkcs1HashVerifySignature",t=>i(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t);return!!(yield(r=this.coreInstance)==null?void 0:r.pkcs1HashVerifySignature(I($({},e),{HashAlg:(a=e.HashAlg)!=null?a:"sm3"})))}));c(this,"pkcs7Sign",(t,e)=>i(this,null,function*(){var o,d,p,u,g;const s=(d=t.DataB64)!=null?d:this.base64Encode({Data:(o=t.Data)!=null?o:""}),a=yield this.getSignatureCert(e),r=yield(u=this.coreInstance)==null?void 0:u.pkcs7Sign({IsDetached:t.IsDetached,ContainerName:(p=a==null?void 0:a.ContainerName)!=null?p:"",DataB64:s});return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));c(this,"pkcs7VerifySignature",t=>i(this,null,function*(){var a,r,o;const e=(r=t.DataB64)!=null?r:this.base64Encode({Data:(a=t.Data)!=null?a:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:e,SignData:t.SignData}))}));c(this,"sm3Hash",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3Hash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3HexHash",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3HexHash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3FileHash",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3FileHash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3HashEncryption",t=>i(this,null,function*(){var r,o,d,p,u,g;const e=(o=t.DataB64)!=null?o:this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=(p=t.KeyB64)!=null?p:this.base64Encode({Data:(d=t.Key)!=null?d:""}),a=yield(u=this.coreInstance)==null?void 0:u.sm3HashEncryption({dataB64:e,keyB64:s,alg:"sm3"});return(g=a==null?void 0:a[0])==null?void 0:g.DataB64}));c(this,"pkcs7Encryption",t=>i(this,null,function*(){var a,r,o,d;if(!t.CertB64List){const p=yield this.getEncryptionCert();t.CertB64List=p==null?void 0:p.CertB64}const e=(r=t.DataB64)!=null?r:this.base64Encode({Data:(a=t.Data)!=null?a:""}),s=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:e,CertB64List:t.CertB64List});return(d=s==null?void 0:s[0])==null?void 0:d.DataB64}));c(this,"pkcs7Decryption",t=>i(this,null,function*(){var r,o;const e=yield this.getEncryptionCert(),s=yield(r=this.coreInstance)==null?void 0:r.pkcs7Decryption({DataB64:t.DataB64,ContainerName:e==null?void 0:e.ContainerName}),a=(o=s==null?void 0:s[0])==null?void 0:o.DataB64;return t.shouldDecodeBase64?this.base64Decode({DataB64:a}):a}));c(this,"asymmetricEncryption",t=>i(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t,!1),s=yield(a=this.coreInstance)==null?void 0:a.asymmetricEncryption(e);return(r=s==null?void 0:s[0])==null?void 0:r.Data}));c(this,"asymmetricDecryption",t=>i(this,null,function*(){var a,r;const e=yield this.getEncryptionCert(),s=yield(a=this.coreInstance)==null?void 0:a.asymmetricDecryption({Data:t.Data,ContainerName:e==null?void 0:e.ContainerName});return(r=s==null?void 0:s[0])==null?void 0:r.Data}));c(this,"sm4Encryption",t=>i(this,null,function*(){var s;const e=yield(s=this.coreInstance)==null?void 0:s.sm4Encryption(t);return e==null?void 0:e[0]}));c(this,"sm4Decryption",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm4Decryption(t);return(a=e==null?void 0:e[0])==null?void 0:a.Data}));c(this,"getCertInfo",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(t);return $({},(a=e==null?void 0:e[0])!=null?a:{})}));c(this,"getCertInfoByOid",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.getCertInfoByOid($({},t!=null?t:{}));return(a=e==null?void 0:e[0])==null?void 0:a.OidValue}));return N.instance&&!(t!=null&&t.isCreateNew)?N.instance:(this.createGwsCore(t),N.instance=this,this)}};c(N,"instance",null);let Q=N,X=null;function ce(n){return new Promise((t,e)=>{X&&t(X);const s=new Q(I($({},n!=null?n:{}),{onOpen(a){var r;X=s,t(s),(r=n==null?void 0:n.onOpen)==null||r.call(n,a)},onClose(a){var r;X=null,e(a),(r=n==null?void 0:n.onClose)==null||r.call(n,a)}}))})}D.GwsService=Q,D.createService=ce,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(D,w){typeof exports=="object"&&typeof module!="undefined"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(D=typeof globalThis!="undefined"?globalThis:D||self,w(D.GWS_CLIENT={}))})(this,function(D){"use strict";var ce=Object.defineProperty,ie=Object.defineProperties;var le=Object.getOwnPropertyDescriptors;var $t=Object.getOwnPropertySymbols;var de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable;var it=(D,w,B)=>w in D?ce(D,w,{enumerable:!0,configurable:!0,writable:!0,value:B}):D[w]=B,$=(D,w)=>{for(var B in w||(w={}))de.call(w,B)&&it(D,B,w[B]);if($t)for(var B of $t(w))ue.call(w,B)&&it(D,B,w[B]);return D},I=(D,w)=>ie(D,le(w));var c=(D,w,B)=>it(D,typeof w!="symbol"?w+"":w,B);var i=(D,w,B)=>new Promise((X,z)=>{var Y=A=>{try{T(B.next(A))}catch(V){z(V)}},tt=A=>{try{T(B.throw(A))}catch(V){z(V)}},T=A=>A.done?X(A.value):Promise.resolve(A.value).then(Y,tt);T((B=B.apply(D,w)).next())});const w=window.location.href.includes("https")?"wss://localhost:19528":"ws://localhost:9527",B="1",X="2";var z=(n=>(n[n.MIN=0]="MIN",n[n.LOW=1]="LOW",n[n.MIDDLE=2]="MIDDLE",n[n.HIGH=3]="HIGH",n))(z||{});const Y="00000001";function tt(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var T={},A;function V(){if(A)return T;A=1,T.byteLength=d,T.toByteArray=u,T.fromByteArray=S;for(var n=[],t=[],e=typeof Uint8Array!="undefined"?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,r=s.length;a<r;++a)n[a]=s[a],t[s.charCodeAt(a)]=a;t[45]=62,t[95]=63;function o(l){var y=l.length;if(y%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=l.indexOf("=");f===-1&&(f=y);var k=f===y?0:4-f%4;return[f,k]}function d(l){var y=o(l),f=y[0],k=y[1];return(f+k)*3/4-k}function p(l,y,f){return(y+f)*3/4-f}function u(l){var y,f=o(l),k=f[0],C=f[1],m=new e(p(l,k,C)),x=0,M=C>0?k-4:k,v;for(v=0;v<M;v+=4)y=t[l.charCodeAt(v)]<<18|t[l.charCodeAt(v+1)]<<12|t[l.charCodeAt(v+2)]<<6|t[l.charCodeAt(v+3)],m[x++]=y>>16&255,m[x++]=y>>8&255,m[x++]=y&255;return C===2&&(y=t[l.charCodeAt(v)]<<2|t[l.charCodeAt(v+1)]>>4,m[x++]=y&255),C===1&&(y=t[l.charCodeAt(v)]<<10|t[l.charCodeAt(v+1)]<<4|t[l.charCodeAt(v+2)]>>2,m[x++]=y>>8&255,m[x++]=y&255),m}function g(l){return n[l>>18&63]+n[l>>12&63]+n[l>>6&63]+n[l&63]}function h(l,y,f){for(var k,C=[],m=y;m<f;m+=3)k=(l[m]<<16&16711680)+(l[m+1]<<8&65280)+(l[m+2]&255),C.push(g(k));return C.join("")}function S(l){for(var y,f=l.length,k=f%3,C=[],m=16383,x=0,M=f-k;x<M;x+=m)C.push(h(l,x,x+m>M?M:x+m));return k===1?(y=l[f-1],C.push(n[y>>2]+n[y<<4&63]+"==")):k===2&&(y=(l[f-2]<<8)+l[f-1],C.push(n[y>>10]+n[y>>4&63]+n[y<<2&63]+"=")),C.join("")}return T}var It=V();const lt=tt(It);class Et{constructor(){c(this,"deps",new Map)}on(t,e){this.deps.set(t,e)}emit(t,e){const s=this.deps.get(t);s&&s(e)}}(function(){try{var n=document.createElement("style");n.appendChild(document.createTextNode("button.svelte-n1zwga{background-color:transparent;border:none;padding:0;margin:0;font-family:inherit;font-size:inherit;color:inherit;cursor:pointer;outline:none}.modal-background.svelte-n1zwga{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-n1zwga{background-color:#fff;padding:20px;border-radius:5px;width:40%}.model-title.svelte-n1zwga{color:#303133;font-size:18px;margin-bottom:16px}.modal-visible.svelte-n1zwga{display:flex}.modal-footer.svelte-n1zwga{display:flex;align-items:center;justify-content:flex-end;margin-top:16px}.modal-btn.svelte-n1zwga{padding:8px 15px;border-radius:4px;font-size:14px;border:1px solid #dcdfe6}.success.svelte-n1zwga{background-color:#409eff;margin-left:12px;color:#fff}.slot.svelte-n1zwga{max-height:200px;overflow-y:scroll}.slot.svelte-n1zwga::-webkit-scrollbar{display:none}.cert-item.svelte-jtc2v4.svelte-jtc2v4{padding:16px;display:flex;align-items:center;cursor:pointer;border-bottom:1px solid #ebeef5;font-size:14px}.cert-item-selected.svelte-jtc2v4.svelte-jtc2v4{background-color:#f1f1f1}.cert-item-first.svelte-jtc2v4.svelte-jtc2v4{border-top:1px solid #ebeef5}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4{display:inline-block;color:#606266}.cert-item.svelte-jtc2v4 span.svelte-jtc2v4:first-child{width:30%}.seal-wrapper.svelte-1w19fs3.svelte-1w19fs3{display:flex;flex-direction:row;align-items:center;flex-wrap:wrap}.seal-item.svelte-1w19fs3.svelte-1w19fs3{width:180px;height:180px;display:flex;flex-direction:column;align-items:center;justify-content:center;border:1px solid #ccc;margin-top:10px;margin-right:10px;border-radius:4px}.seal-item.svelte-1w19fs3 img.svelte-1w19fs3{width:100px;height:100px}.seal-item-selected.svelte-1w19fs3.svelte-1w19fs3{background-color:#f1f1f1}.seal-name.svelte-1w19fs3.svelte-1w19fs3{margin-top:10px;color:#333}")),document.head.appendChild(n)}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();var At=Object.defineProperty,_t=(n,t,e)=>t in n?At(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,dt=(n,t,e)=>_t(n,typeof t!="symbol"?t+"":t,e);function et(){}function Lt(n,t){for(const e in t)n[e]=t[e];return n}function ut(n){return n()}function ht(){return Object.create(null)}function R(n){n.forEach(ut)}function U(n){return typeof n=="function"}function yt(n,t){return n!=n?t==t:n!==t||n&&typeof n=="object"||typeof n=="function"}function Pt(n){return Object.keys(n).length===0}function Tt(n,t,e,s){if(n){const a=pt(n,t,e,s);return n[0](a)}}function pt(n,t,e,s){return n[1]&&s?Lt(e.ctx.slice(),n[1](s(t))):e.ctx}function Mt(n,t,e,s){if(n[2]&&s){const a=n[2](s(e));if(t.dirty===void 0)return a;if(typeof a=="object"){const r=[],o=Math.max(t.dirty.length,a.length);for(let d=0;d<o;d+=1)r[d]=t.dirty[d]|a[d];return r}return t.dirty|a}return t.dirty}function Ht(n,t,e,s,a,r){if(a){const o=pt(t,e,s,r);n.p(o,a)}}function Gt(n){if(n.ctx.length>32){const t=[],e=n.ctx.length/32;for(let s=0;s<e;s++)t[s]=-1;return t}return-1}function gt(n){return n!=null?n:""}function b(n,t){n.appendChild(t)}function nt(n,t,e){n.insertBefore(t,e||null)}function K(n){n.parentNode&&n.parentNode.removeChild(n)}function jt(n,t){for(let e=0;e<n.length;e+=1)n[e]&&n[e].d(t)}function _(n){return document.createElement(n)}function L(n){return document.createTextNode(n)}function J(){return L(" ")}function Ft(){return L("")}function W(n,t,e,s){return n.addEventListener(t,e,s),()=>n.removeEventListener(t,e,s)}function E(n,t,e){e==null?n.removeAttribute(t):n.getAttribute(t)!==e&&n.setAttribute(t,e)}function Ot(n){return Array.from(n.childNodes)}function G(n,t){t=""+t,n.data!==t&&(n.data=t)}let st;function q(n){st=n}const j=[],ft=[];let F=[];const mt=[],Nt=Promise.resolve();let at=!1;function Zt(){at||(at=!0,Nt.then(wt))}function rt(n){F.push(n)}const ot=new Set;let O=0;function wt(){if(O!==0)return;const n=st;do{try{for(;O<j.length;){const t=j[O];O++,q(t),zt(t.$$)}}catch(t){throw j.length=0,O=0,t}for(q(null),j.length=0,O=0;ft.length;)ft.pop()();for(let t=0;t<F.length;t+=1){const e=F[t];ot.has(e)||(ot.add(e),e())}F.length=0}while(j.length);for(;mt.length;)mt.pop()();at=!1,ot.clear(),q(n)}function zt(n){if(n.fragment!==null){n.update(),R(n.before_update);const t=n.dirty;n.dirty=[-1],n.fragment&&n.fragment.p(n.ctx,t),n.after_update.forEach(rt)}}function Vt(n){const t=[],e=[];F.forEach(s=>n.indexOf(s)===-1?t.push(s):e.push(s)),e.forEach(s=>s()),F=t}const Q=new Set;let Rt;function ct(n,t){n&&n.i&&(Q.delete(n),n.i(t))}function Ct(n,t,e,s){if(n&&n.o){if(Q.has(n))return;Q.add(n),Rt.c.push(()=>{Q.delete(n)}),n.o(t)}}function vt(n){return(n==null?void 0:n.length)!==void 0?n:Array.from(n)}function Ut(n){n&&n.c()}function kt(n,t,e){const{fragment:s,after_update:a}=n.$$;s&&s.m(t,e),rt(()=>{const r=n.$$.on_mount.map(ut).filter(U);n.$$.on_destroy?n.$$.on_destroy.push(...r):R(r),n.$$.on_mount=[]}),a.forEach(rt)}function xt(n,t){const e=n.$$;e.fragment!==null&&(Vt(e.after_update),R(e.on_destroy),e.fragment&&e.fragment.d(t),e.on_destroy=e.fragment=null,e.ctx=[])}function Jt(n,t){n.$$.dirty[0]===-1&&(j.push(n),Zt(),n.$$.dirty.fill(0)),n.$$.dirty[t/31|0]|=1<<t%31}function Dt(n,t,e,s,a,r,o=null,d=[-1]){const p=st;q(n);const u=n.$$={fragment:null,ctx:[],props:r,update:et,not_equal:a,bound:ht(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(p?p.$$.context:[])),callbacks:ht(),dirty:d,skip_bound:!1,root:t.target||p.$$.root};o&&o(u.root);let g=!1;if(u.ctx=e?e(n,t.props||{},(h,S,...l)=>{const y=l.length?l[0]:S;return u.ctx&&a(u.ctx[h],u.ctx[h]=y)&&(!u.skip_bound&&u.bound[h]&&u.bound[h](y),g&&Jt(n,h)),S}):[],u.update(),g=!0,R(u.before_update),u.fragment=s?s(u.ctx):!1,t.target){if(t.hydrate){const h=Ot(t.target);u.fragment&&u.fragment.l(h),h.forEach(K)}else u.fragment&&u.fragment.c();t.intro&&ct(n.$$.fragment),kt(n,t.target,t.anchor),wt()}q(p)}class bt{constructor(){dt(this,"$$"),dt(this,"$$set")}$destroy(){xt(this,1),this.$destroy=et}$on(t,e){if(!U(e))return et;const s=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return s.push(e),()=>{const a=s.indexOf(e);a!==-1&&s.splice(a,1)}}$set(t){this.$$set&&!Pt(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Wt="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Wt);function qt(n){let t,e,s,a=(n[1]||"标题")+"",r,o,d,p,u,g,h=(n[4]||"取消")+"",S,l,y,f=(n[5]||"确认")+"",k,C,m,x;const M=n[7].default,v=Tt(M,n,n[6],null);return{c(){t=_("div"),e=_("div"),s=_("div"),r=L(a),o=J(),d=_("div"),v&&v.c(),p=J(),u=_("div"),g=_("button"),S=L(h),l=J(),y=_("button"),k=L(f),E(s,"class","model-title svelte-n1zwga"),E(d,"class","slot svelte-n1zwga"),E(g,"class","modal-btn svelte-n1zwga"),E(y,"class","modal-btn success svelte-n1zwga"),E(u,"class","modal-footer svelte-n1zwga"),E(e,"class","modal-content svelte-n1zwga"),E(t,"class","modal-background modal-visible svelte-n1zwga")},m(P,H){nt(P,t,H),b(t,e),b(e,s),b(s,r),b(e,o),b(e,d),v&&v.m(d,null),b(e,p),b(e,u),b(u,g),b(g,S),b(u,l),b(u,y),b(y,k),C=!0,m||(x=[W(g,"click",function(){U(n[0])&&n[0].apply(this,arguments)}),W(y,"click",function(){U(n[2])&&n[2].apply(this,arguments)}),W(e,"click",Kt),W(t,"click",function(){U(n[3])&&n[3].apply(this,arguments)})],m=!0)},p(P,[H]){n=P,(!C||H&2)&&a!==(a=(n[1]||"标题")+"")&&G(r,a),v&&v.p&&(!C||H&64)&&Ht(v,M,n,n[6],C?Mt(M,n[6],H,null):Gt(n[6]),null),(!C||H&16)&&h!==(h=(n[4]||"取消")+"")&&G(S,h),(!C||H&32)&&f!==(f=(n[5]||"确认")+"")&&G(k,f)},i(P){C||(ct(v,P),C=!0)},o(P){Ct(v,P),C=!1},d(P){P&&K(t),v&&v.d(P),m=!1,R(x)}}}const Kt=n=>n.stopPropagation();function Qt(n,t,e){let{$$slots:s={},$$scope:a}=t,{onCancel:r}=t,{title:o}=t,{onOk:d}=t,{onClose:p}=t,{cancelText:u}=t,{okText:g}=t;return n.$$set=h=>{"onCancel"in h&&e(0,r=h.onCancel),"title"in h&&e(1,o=h.title),"onOk"in h&&e(2,d=h.onOk),"onClose"in h&&e(3,p=h.onClose),"cancelText"in h&&e(4,u=h.cancelText),"okText"in h&&e(5,g=h.okText),"$$scope"in h&&e(6,a=h.$$scope)},[r,o,d,p,u,g,a,s]}class Xt extends bt{constructor(t){super(),Dt(this,t,Qt,qt,yt,{onCancel:0,title:1,onOk:2,onClose:3,cancelText:4,okText:5})}}function Bt(n,t,e){const s=n.slice();return s[10]=t[e],s[12]=e,s}function St(n){let t,e,s=n[10].CN+"",a,r,o,d=n[10].DevClass+"",p,u,g=n[10].sn+"",h,S,l,y,f,k;function C(){return n[9](n[12])}return{c(){t=_("div"),e=_("span"),a=L(s),r=J(),o=_("span"),p=L(d),u=L("("),h=L(g),S=L(")"),l=J(),E(e,"class","svelte-jtc2v4"),E(o,"class","svelte-jtc2v4"),E(t,"class",y=gt(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")},m(m,x){nt(m,t,x),b(t,e),b(e,a),b(t,r),b(t,o),b(o,p),b(o,u),b(o,h),b(o,S),b(t,l),f||(k=W(t,"click",C),f=!0)},p(m,x){n=m,x&1&&s!==(s=n[10].CN+"")&&G(a,s),x&1&&d!==(d=n[10].DevClass+"")&&G(p,d),x&1&&g!==(g=n[10].sn+"")&&G(h,g),x&16&&y!==(y=gt(`cert-item ${n[12]===0?"cert-item-first":""} ${n[12]===n[4]?"cert-item-selected":""}`)+" svelte-jtc2v4")&&E(t,"class",y)},d(m){m&&K(t),f=!1,k()}}}function Yt(n){let t,e=vt(n[0]),s=[];for(let a=0;a<e.length;a+=1)s[a]=St(Bt(n,e,a));return{c(){for(let a=0;a<s.length;a+=1)s[a].c();t=Ft()},m(a,r){for(let o=0;o<s.length;o+=1)s[o]&&s[o].m(a,r);nt(a,t,r)},p(a,r){if(r&17){e=vt(a[0]);let o;for(o=0;o<e.length;o+=1){const d=Bt(a,e,o);s[o]?s[o].p(d,r):(s[o]=St(d),s[o].c(),s[o].m(t.parentNode,t))}for(;o<s.length;o+=1)s[o].d(1);s.length=e.length}},d(a){a&&K(t),jt(s,a)}}}function te(n){let t,e;return t=new Xt({props:{onOk:n[6],onClose:n[1],onCancel:n[5],cancelText:n[2],okText:n[3],title:"选择证书",$$slots:{default:[Yt]},$$scope:{ctx:n}}}),{c(){Ut(t.$$.fragment)},m(s,a){kt(t,s,a),e=!0},p(s,[a]){const r={};a&2&&(r.onClose=s[1]),a&4&&(r.cancelText=s[2]),a&8&&(r.okText=s[3]),a&8209&&(r.$$scope={dirty:a,ctx:s}),t.$set(r)},i(s){e||(ct(t.$$.fragment,s),e=!0)},o(s){Ct(t.$$.fragment,s),e=!1},d(s){xt(t,s)}}}function ee(n,t,e){let{certList:s=[]}=t,{onCancel:a}=t,{onOk:r}=t,{onClose:o}=t,{cancelText:d=""}=t,{okText:p=""}=t,u=0;const g=()=>{o==null||o()},h=()=>{r==null||r(s[u]),o==null||o()},S=l=>e(4,u=l);return n.$$set=l=>{"certList"in l&&e(0,s=l.certList),"onCancel"in l&&e(7,a=l.onCancel),"onOk"in l&&e(8,r=l.onOk),"onClose"in l&&e(1,o=l.onClose),"cancelText"in l&&e(2,d=l.cancelText),"okText"in l&&e(3,p=l.okText)},[s,o,d,p,u,g,h,a,r,S]}class ne extends bt{constructor(t){super(),Dt(this,t,ee,te,yt,{certList:0,onCancel:7,onOk:8,onClose:1,cancelText:2,okText:3})}}class se{constructor(){c(this,"modalInstance",{current:null});c(this,"open",t=>new Promise((e,s)=>{this.modalInstance.current=new ne({target:document.body,props:I($({},t),{onCancel:a=>{s()},onOk:a=>{e(a)},onClose:()=>{this.close()}})})}));c(this,"close",()=>{setTimeout(()=>{var t;(t=this.modalInstance.current)==null||t.$destroy()})})}}const ae=new se;class re{constructor(t){c(this,"socketInstance",null);c(this,"eventBus",new Et);c(this,"isRememberPin",!1);c(this,"socketEvent");c(this,"pinPolicy");c(this,"socketConfig",null);c(this,"getSocketReadyState",()=>{var t;return(t=this.socketInstance)==null?void 0:t.readyState});c(this,"destroy",()=>{var t;(t=this.socketInstance)==null||t.close()});c(this,"sendMessage",(t,e)=>new Promise((s,a)=>{var o,d;if(((o=this.socketInstance)==null?void 0:o.readyState)!==WebSocket.OPEN){console.log(t),a({errCode:-1,msg:"socket未连接"});return}const r={function:t,args:[e!=null?e:{}]};(d=this.socketInstance)==null||d.send(JSON.stringify(r)),this.eventBus.on(t,p=>{p.success?s(p.data):a(p)})}));c(this,"handleEventData",t=>i(this,null,function*(){var e,s,a,r,o,d;if(t.data instanceof Blob){const p=yield t.data.arrayBuffer(),g=new TextDecoder("gbk").decode(p),h=JSON.parse(g),S={data:h.data,success:(e=h.result)==null?void 0:e.success,msg:(s=h.result)==null?void 0:s.msg,errCode:(a=h.result)==null?void 0:a.errCode};this.eventBus.emit((r=h.result)==null?void 0:r.function,S),(d=(o=this.socketConfig)==null?void 0:o.onMessage)==null||d.call(o,S)}}));c(this,"base64Encode",t=>{const e=new TextEncoder().encode(t);return lt.fromByteArray(e)});c(this,"base64Decode",t=>{const e=lt.toByteArray(t);return new TextDecoder().decode(e)});c(this,"changeIsRememberPin",t=>i(this,null,function*(){this.isRememberPin=t}));c(this,"changePinPolicy",t=>i(this,null,function*(){this.pinPolicy=t}));c(this,"checkCertIsLogin",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_IsLogin",t)}));c(this,"addUkeyEvents",()=>i(this,null,function*(){this.sendMessage("GZCA_StartListen",{Type:Y}).then(t=>{var e,s;(s=(e=this.socketConfig)==null?void 0:e.onUkeyEvent)==null||s.call(e,t)})}));c(this,"certLogin",t=>i(this,null,function*(){const e=yield this.checkCertIsLogin({ContainerName:t});e!=null&&e[0].isLogin||(yield this.sendMessage("GZCA_Login",{ContainerName:t,IsLogin:"N",UserPin:"123456",PinPolicy:this.pinPolicy}))}));c(this,"getCert",(t,e)=>i(this,null,function*(){const s=e!=null?e:yield this.chooseCert(t);return yield this.certLogin(s.ContainerName),s}));c(this,"getCertList",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_GetCertList",t)}));c(this,"chooseCert",t=>i(this,null,function*(){const e=yield this.getCertList(t);return(e==null?void 0:e.length)===1?e[0]:yield ae.open({certList:e})}));c(this,"pkcs1Sign",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignData",I($({},t),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1Base64Sign",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataEx",I($({},t),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1VerifySignature",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySign",t)}));c(this,"pkcs1Base64VerifySignature",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignEx",t)}));c(this,"getSealList",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_EnumSeals",I($({},t),{IsLogin:this.getIsLogin()}))}));c(this,"sm2SignPreprocess1",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep1",t)}));c(this,"sm2SignPreprocess2",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_PrepareSm2SignStep2",t)}));c(this,"pkcs1HashSign",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1SignDataForHash",I($({},t!=null?t:{}),{IsLogin:this.getIsLogin(),PinPolicy:this.pinPolicy}))}));c(this,"pkcs1HashVerifySignature",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs1VerifySignForHash",t)}));c(this,"pkcs7Sign",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7SignData",I($({},t),{IsLogin:this.getIsLogin(),IsAuthAttr:"Y",PinPolicy:this.pinPolicy}))}));c(this,"pkcs7VerifySignature",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7VerifySign",t)}));c(this,"sm3Hash",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_HashData",t)}));c(this,"sm3HexHash",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_HashDataEx",t)}));c(this,"sm3FileHash",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_HashFile",t)}));c(this,"sm3HashEncryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_HMac",t)}));c(this,"pkcs7Encryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7EncryptData",t)}));c(this,"pkcs7Decryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_Pkcs7DecryptData",I($({},t),{IsLogin:this.getIsLogin()}))}));c(this,"asymmetricEncryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_AsymEncryptData",t)}));c(this,"asymmetricDecryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_AsymDecryptData",I($({},t),{IsLogin:this.getIsLogin()}))}));c(this,"sm4Encryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_EncryptDataEx",t)}));c(this,"sm4Decryption",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_DecryptDataEx",t)}));c(this,"getCertInfo",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfo",t)}));c(this,"getCertInfoByOid",t=>i(this,null,function*(){return yield this.sendMessage("GZCA_GetCertInfoByOid",t)}));var e,s;this.socketConfig=t,this.socketInstance=this.createSocket(t),this.isRememberPin=(e=t.isRememberPin)!=null?e:!1,this.pinPolicy=(s=t.pinPolicy)!=null?s:z.MIN}createSocket(t){const e=new WebSocket(t.url);return e.onerror=s=>{var a;(a=t.onError)==null||a.call(t,s)},e.onopen=s=>{var a;(a=t.onOpen)==null||a.call(t,s),this.addUkeyEvents()},e.onmessage=s=>{this.handleEventData(s)},e.onclose=s=>{var a;(a=t.onClose)==null||a.call(t,s)},e}getIsLogin(){return this.isRememberPin?"Y":"N"}}const Z=class Z{constructor(t){c(this,"coreInstance",null);c(this,"gwsConfig",{});c(this,"createGwsCore",t=>{this.gwsConfig=t!=null?t:{},this.coreInstance=new re(I($({},t!=null?t:{}),{url:w}))});c(this,"appendCertBase64",(t,e=!0)=>i(this,null,function*(){if(t.CertB64)return t;const s=e?yield this.getSignatureCert():yield this.getEncryptionCert();return I($({},t!=null?t:{}),{CertB64:s==null?void 0:s.CertB64})}));c(this,"destroy",()=>{var t;(t=this.coreInstance)==null||t.destroy(),this.coreInstance=null});c(this,"restart",t=>{this.coreInstance&&this.destroy(),this.gwsConfig=t!=null?t:this.gwsConfig,this.createGwsCore(t)});c(this,"getSocketReadyState",()=>{var t;return(t=this.coreInstance)==null?void 0:t.getSocketReadyState()});c(this,"getSignatureCert",t=>i(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:B},t)}));c(this,"getEncryptionCert",t=>i(this,null,function*(){var s;return yield(s=this.coreInstance)==null?void 0:s.getCert({CertType:X},t)}));c(this,"base64Encode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Encode(t.Data)});c(this,"base64Decode",t=>{var e;return(e=this.coreInstance)==null?void 0:e.base64Decode(t.DataB64)});c(this,"changeIsRememberPin",t=>{var e;(e=this.coreInstance)==null||e.changeIsRememberPin(t)});c(this,"changePinPolicy",t=>{var e;(e=this.coreInstance)==null||e.changePinPolicy(t)});c(this,"pkcs1Sign",(t,e)=>i(this,null,function*(){var r,o,d;const s=yield this.getSignatureCert(e),a=yield(o=this.coreInstance)==null?void 0:o.pkcs1Sign(I($({},t!=null?t:{}),{ContainerName:(r=s==null?void 0:s.ContainerName)!=null?r:""}));return(d=a==null?void 0:a[0])==null?void 0:d.SignData}));c(this,"pkcs1VerifySignature",t=>i(this,null,function*(){var a;const e=yield this.appendCertBase64(t),s=yield(a=this.coreInstance)==null?void 0:a.pkcs1VerifySignature(e);return Array.isArray(s)}));c(this,"pkcs1Base64Sign",(t,e)=>i(this,null,function*(){var o,d,p,u,g;const s=yield this.getSignatureCert(e),a=(d=t.DataB64)!=null?d:this.base64Encode({Data:(o=t.Data)!=null?o:""}),r=yield(u=this.coreInstance)==null?void 0:u.pkcs1Base64Sign({ContainerName:(p=s==null?void 0:s.ContainerName)!=null?p:"",DataB64:a});return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));c(this,"pkcs1Base64VerifySignature",t=>i(this,null,function*(){var r,o,d;const e=(o=t.DataB64)!=null?o:this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=yield this.appendCertBase64(t);return!!(yield(d=this.coreInstance)==null?void 0:d.pkcs1Base64VerifySignature({CertB64:s.CertB64,DataB64:e,SignData:s.SignData}))}));c(this,"getSealList",()=>i(this,null,function*(){var s,a;const t=yield this.getSignatureCert(),e=yield(a=this.coreInstance)==null?void 0:a.getSealList({ContainerName:(s=t==null?void 0:t.ContainerName)!=null?s:""});return{cert:t,sealList:e}}));c(this,"sm2SignPreprocess1",t=>i(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t),s=yield(a=this.coreInstance)==null?void 0:a.sm2SignPreprocess1(e);return(r=s==null?void 0:s[0])==null?void 0:r.Z}));c(this,"sm2SignPreprocess2",t=>i(this,null,function*(){var r,o;const e=this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=yield this.appendCertBase64(t),a=yield(o=this.coreInstance)==null?void 0:o.sm2SignPreprocess2({CertB64:s.CertB64,DataB64:e});return a==null?void 0:a[0].H}));c(this,"pkcs1HashSign",(t,e)=>i(this,null,function*(){var r,o,d,p;const s=yield this.getSignatureCert(e),a=yield(d=this.coreInstance)==null?void 0:d.pkcs1HashSign({ContainerName:(r=s==null?void 0:s.ContainerName)!=null?r:"",DataB64:t.DataB64,HashAlg:(o=t.HashAlg)!=null?o:"sm3"});return(p=a==null?void 0:a[0])==null?void 0:p.SignData}));c(this,"pkcs1HashVerifySignature",t=>i(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t);return!!(yield(r=this.coreInstance)==null?void 0:r.pkcs1HashVerifySignature(I($({},e),{HashAlg:(a=e.HashAlg)!=null?a:"sm3"})))}));c(this,"pkcs7Sign",(t,e)=>i(this,null,function*(){var o,d,p,u,g;const s=(d=t.DataB64)!=null?d:this.base64Encode({Data:(o=t.Data)!=null?o:""}),a=yield this.getSignatureCert(e),r=yield(u=this.coreInstance)==null?void 0:u.pkcs7Sign({IsDetached:t.IsDetached,ContainerName:(p=a==null?void 0:a.ContainerName)!=null?p:"",DataB64:s});return(g=r==null?void 0:r[0])==null?void 0:g.SignData}));c(this,"pkcs7VerifySignature",t=>i(this,null,function*(){var a,r,o;const e=(r=t.DataB64)!=null?r:this.base64Encode({Data:(a=t.Data)!=null?a:""});return!!(yield(o=this.coreInstance)==null?void 0:o.pkcs7VerifySignature({DataB64:e,SignData:t.SignData}))}));c(this,"sm3Hash",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3Hash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3HexHash",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3HexHash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3FileHash",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm3FileHash(t);return(a=e==null?void 0:e[0])==null?void 0:a.HashB64}));c(this,"sm3HashEncryption",t=>i(this,null,function*(){var r,o,d,p,u,g;const e=(o=t.DataB64)!=null?o:this.base64Encode({Data:(r=t.Data)!=null?r:""}),s=(p=t.KeyB64)!=null?p:this.base64Encode({Data:(d=t.Key)!=null?d:""}),a=yield(u=this.coreInstance)==null?void 0:u.sm3HashEncryption({dataB64:e,keyB64:s,alg:"sm3"});return(g=a==null?void 0:a[0])==null?void 0:g.DataB64}));c(this,"pkcs7Encryption",t=>i(this,null,function*(){var a,r,o,d;if(!t.CertB64List){const p=yield this.getEncryptionCert();t.CertB64List=p==null?void 0:p.CertB64}const e=(r=t.DataB64)!=null?r:this.base64Encode({Data:(a=t.Data)!=null?a:""}),s=yield(o=this.coreInstance)==null?void 0:o.pkcs7Encryption({DataB64:e,CertB64List:t.CertB64List});return(d=s==null?void 0:s[0])==null?void 0:d.DataB64}));c(this,"pkcs7Decryption",t=>i(this,null,function*(){var r,o;const e=yield this.getEncryptionCert(),s=yield(r=this.coreInstance)==null?void 0:r.pkcs7Decryption({DataB64:t.DataB64,ContainerName:e==null?void 0:e.ContainerName}),a=(o=s==null?void 0:s[0])==null?void 0:o.DataB64;return t.shouldDecodeBase64?this.base64Decode({DataB64:a}):a}));c(this,"asymmetricEncryption",t=>i(this,null,function*(){var a,r;const e=yield this.appendCertBase64(t,!1),s=yield(a=this.coreInstance)==null?void 0:a.asymmetricEncryption(e);return(r=s==null?void 0:s[0])==null?void 0:r.Data}));c(this,"asymmetricDecryption",t=>i(this,null,function*(){var a,r;const e=yield this.getEncryptionCert(),s=yield(a=this.coreInstance)==null?void 0:a.asymmetricDecryption({Data:t.Data,ContainerName:e==null?void 0:e.ContainerName});return(r=s==null?void 0:s[0])==null?void 0:r.Data}));c(this,"sm4Encryption",t=>i(this,null,function*(){var s;const e=yield(s=this.coreInstance)==null?void 0:s.sm4Encryption(t);return e==null?void 0:e[0]}));c(this,"sm4Decryption",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.sm4Decryption(t);return(a=e==null?void 0:e[0])==null?void 0:a.Data}));c(this,"getCertInfo",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.getCertInfo(t);return $({},(a=e==null?void 0:e[0])!=null?a:{})}));c(this,"getCertInfoByOid",t=>i(this,null,function*(){var s,a;const e=yield(s=this.coreInstance)==null?void 0:s.getCertInfoByOid($({},t!=null?t:{}));return(a=e==null?void 0:e[0])==null?void 0:a.OidValue}));return Z.instance&&!(t!=null&&t.isCreateNew)?Z.instance:(this.createGwsCore(t),Z.instance=this,this)}};c(Z,"instance",null);let N=Z;function oe(n){return new Promise((t,e)=>{if(N.instance)t(N.instance);else{const s=new N(I($({},n!=null?n:{}),{onOpen(a){var r;t(s),(r=n==null?void 0:n.onOpen)==null||r.call(n,a)},onClose(a){var r;e(a),(r=n==null?void 0:n.onClose)==null||r.call(n,a)}}))}})}D.GwsService=N,D.createService=oe,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})});
|