!function(e,t){for(var r in t)e[r]=t[r]}(exports,function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=23)}([function(e,t,r){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&"undefined"!=typeof global&&global.crypto&&(n=global.crypto),!n)try{n=r(2)}catch(e){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),a={},s=a.lib={},u=s.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},c=s.WordArray=u.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(var s=0;s>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e=u.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],r=0;r>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new c.init(r,t/2)}},h=f.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new c.init(r,t)}},p=f.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},d=s.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.sigBytes,a=this.blockSize,s=o/(4*a),u=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,f=e.min(4*u,o);if(u){for(var l=0;l>>2];e.sigBytes-=t}},o.BlockCipher=h.extend({cfg:h.cfg.extend({mode:y,padding:g}),reset:function(){var e;h.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4}),v=o.CipherParams=a.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(i.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,r=e.salt;return(r?s.create([1398893684,1701076831]).concat(r).concat(t):t).toString(f)},parse:function(e){var t,r=f.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=s.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},m=o.SerializableCipher=a.extend({cfg:a.extend({format:_}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),a=i.cfg;return v.create({ciphertext:o,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),b=(i.kdf={}).OpenSSL={execute:function(e,t,r,n){n||(n=s.random(8));var i=l.create({keySize:t+r}).compute(e,n),o=s.create(i.words.slice(t),4*r);return i.sigBytes=4*t,v.create({key:i,iv:o,salt:n})}},w=o.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:b}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize);n.iv=i.iv;var o=m.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt);return n.iv=i.iv,m.decrypt.call(this,e,t,i.key,n)}}))))},function(e,t){e.exports=require("crypto")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={FormData:!0,UniCloudError:!0};Object.defineProperty(t,"FormData",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"UniCloudError",{enumerable:!0,get:function(){return o.default}});var i=u(r(26)),o=u(r(27)),a=r(28);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var s=r(7);function u(e){return e&&e.__esModule?e:{default:e}}Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(n,e)||e in t&&t[e]===s[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}}))}))},function(e,t,r){var n,i,o,a,s,u,c,f;e.exports=(f=r(0),r(11),r(12),i=(n=f).lib,o=i.Base,a=i.WordArray,s=n.algo,u=s.MD5,c=s.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:u,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,i=n.hasher.create(),o=a.create(),s=o.words,u=n.keySize,c=n.iterations;s.length>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s>>6*(3-s)&63));var u=n.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o>>6-a%4*2,c=s|u;n[o>>>2]|=c<<24-o%4*8,o++}return i.create(n,o)}(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,r){var n;e.exports=(n=r(0),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,a=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=a.MD5=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,a=e[t+0],u=e[t+1],p=e[t+2],d=e[t+3],y=e[t+4],g=e[t+5],v=e[t+6],_=e[t+7],m=e[t+8],b=e[t+9],w=e[t+10],S=e[t+11],E=e[t+12],A=e[t+13],I=e[t+14],N=e[t+15],C=o[0],T=o[1],R=o[2],x=o[3];C=c(C,T,R,x,a,7,s[0]),x=c(x,C,T,R,u,12,s[1]),R=c(R,x,C,T,p,17,s[2]),T=c(T,R,x,C,d,22,s[3]),C=c(C,T,R,x,y,7,s[4]),x=c(x,C,T,R,g,12,s[5]),R=c(R,x,C,T,v,17,s[6]),T=c(T,R,x,C,_,22,s[7]),C=c(C,T,R,x,m,7,s[8]),x=c(x,C,T,R,b,12,s[9]),R=c(R,x,C,T,w,17,s[10]),T=c(T,R,x,C,S,22,s[11]),C=c(C,T,R,x,E,7,s[12]),x=c(x,C,T,R,A,12,s[13]),R=c(R,x,C,T,I,17,s[14]),C=f(C,T=c(T,R,x,C,N,22,s[15]),R,x,u,5,s[16]),x=f(x,C,T,R,v,9,s[17]),R=f(R,x,C,T,S,14,s[18]),T=f(T,R,x,C,a,20,s[19]),C=f(C,T,R,x,g,5,s[20]),x=f(x,C,T,R,w,9,s[21]),R=f(R,x,C,T,N,14,s[22]),T=f(T,R,x,C,y,20,s[23]),C=f(C,T,R,x,b,5,s[24]),x=f(x,C,T,R,I,9,s[25]),R=f(R,x,C,T,d,14,s[26]),T=f(T,R,x,C,m,20,s[27]),C=f(C,T,R,x,A,5,s[28]),x=f(x,C,T,R,p,9,s[29]),R=f(R,x,C,T,_,14,s[30]),C=l(C,T=f(T,R,x,C,E,20,s[31]),R,x,g,4,s[32]),x=l(x,C,T,R,m,11,s[33]),R=l(R,x,C,T,S,16,s[34]),T=l(T,R,x,C,I,23,s[35]),C=l(C,T,R,x,u,4,s[36]),x=l(x,C,T,R,y,11,s[37]),R=l(R,x,C,T,_,16,s[38]),T=l(T,R,x,C,w,23,s[39]),C=l(C,T,R,x,A,4,s[40]),x=l(x,C,T,R,a,11,s[41]),R=l(R,x,C,T,d,16,s[42]),T=l(T,R,x,C,v,23,s[43]),C=l(C,T,R,x,b,4,s[44]),x=l(x,C,T,R,E,11,s[45]),R=l(R,x,C,T,N,16,s[46]),C=h(C,T=l(T,R,x,C,p,23,s[47]),R,x,a,6,s[48]),x=h(x,C,T,R,_,10,s[49]),R=h(R,x,C,T,I,15,s[50]),T=h(T,R,x,C,g,21,s[51]),C=h(C,T,R,x,E,6,s[52]),x=h(x,C,T,R,d,10,s[53]),R=h(R,x,C,T,w,15,s[54]),T=h(T,R,x,C,u,21,s[55]),C=h(C,T,R,x,m,6,s[56]),x=h(x,C,T,R,N,10,s[57]),R=h(R,x,C,T,v,15,s[58]),T=h(T,R,x,C,A,21,s[59]),C=h(C,T,R,x,y,6,s[60]),x=h(x,C,T,R,S,10,s[61]),R=h(R,x,C,T,p,15,s[62]),T=h(T,R,x,C,b,21,s[63]),o[0]=o[0]+C|0,o[1]=o[1]+T|0,o[2]=o[2]+R|0,o[3]=o[3]+x|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),a=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,u=s.words,c=0;c<4;c++){var f=u[c];u[c]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,r,n,i,o,a){var s=e+(t&r|~t&n)+i+a;return(s<>>32-o)+t}function f(e,t,r,n,i,o,a){var s=e+(t&n|r&~n)+i+a;return(s<>>32-o)+t}function l(e,t,r,n,i,o,a){var s=e+(t^r^n)+i+a;return(s<>>32-o)+t}function h(e,t,r,n,i,o,a){var s=e+(r^(t|~n))+i+a;return(s<>>32-o)+t}t.MD5=o._createHelper(u),t.HmacMD5=o._createHmacHelper(u)}(Math),n.MD5)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.accMul=function(e,t){if(isNaN(e)||isNaN(t))return NaN;const{value:r,power:n}=y(e),{value:i,power:o}=y(t);return r*i/Math.pow(10,n+o)},t.camel2snake=l,t.camel2snakeJson=function(e){return h(e,"camel2snake")},t.deepClone=function(e){return JSON.parse(JSON.stringify(e))},t.deleteObjectKey=function e(t,r){const n=t.shift();if(!n)return;e(t,r[n]),r[n]&&(Object.keys(r[n]).length<=0||"string"==typeof r[n])&&delete r[n]},t.getDateStr=p,t.getExtension=function(e){return s[e]},t.getFullTimeStr=function(e){return p(e=e||new Date)+" "+d(e)},t.getOffsetDate=function(e){return new Date(Date.now()+6e4*((new Date).getTimezoneOffset()+60*(e||0)))},t.getTimeStr=d,t.hasOwn=o,t.isFn=function(e){return"function"==typeof e},t.isPlainObject=a,t.log=function(){0},t.mime2ext=void 0,t.snake2camel=f,t.snake2camelJson=function(e){return h(e,"snake2camel")};const n=Object.prototype.toString,i=Object.prototype.hasOwnProperty;function o(e,t){return i.call(e,t)}function a(e){return"[object Object]"===n.call(e)}const s={"image/png":"png","image/jpeg":"jpg","image/gif":"gif","image/svg+xml":"svg","image/bmp":"bmp","image/webp":"webp"};t.mime2ext=s;const u=/_(\w)/g,c=/[A-Z]/g;function f(e){return e.replace(u,(e,t)=>t?t.toUpperCase():"")}function l(e){return e.replace(c,e=>"_"+e.toLowerCase())}function h(e,t){let r,n;switch(t){case"snake2camel":n=f,r=u;break;case"camel2snake":n=l,r=c}for(const i in e)if(o(e,i)&&r.test(i)){const r=n(i);e[r]=e[i],delete e[i],a(e[r])?e[r]=h(e[r],t):Array.isArray(e[r])&&(e[r]=e[r].map(e=>h(e,t)))}return e}function p(e,t="-"){e=e||new Date;const r=[];return r.push(e.getFullYear()),r.push(("00"+(e.getMonth()+1)).substr(-2)),r.push(("00"+e.getDate()).substr(-2)),r.join(t)}function d(e,t=":"){e=e||new Date;const r=[];return r.push(("00"+e.getHours()).substr(-2)),r.push(("00"+e.getMinutes()).substr(-2)),r.push(("00"+e.getSeconds()).substr(-2)),r.join(t)}function y(e){const t=e.toString().split("."),r=t[1]?t[1].length:0;return{value:Number(t.join("")),power:r}}},function(e,t,r){var n,i,o,a,s,u;e.exports=(u=r(0),i=(n=u).lib,o=i.Base,a=i.WordArray,(s=n.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),s.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:8*e.length},toX32:function(){for(var e=this.words,t=e.length,r=[],n=0;n>>31}var l=(n<<5|n>>>27)+s+u[c];l+=c<20?1518500249+(i&o|~i&a):c<40?1859775393+(i^o^a):c<60?(i&o|i&a|o&a)-1894007588:(i^o^a)-899497514,s=a,a=o,o=i<<30|i>>>2,i=n,n=l}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=a._createHelper(c),n.HmacSHA1=a._createHmacHelper(c),f.SHA1)},function(e,t,r){var n,i,o,a;e.exports=(n=r(0),o=(i=n).lib.Base,a=i.enc.Utf8,void(i.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=a.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),s=i.words,u=o.words,c=0;cparseInt(e,10)));case 6:const t=e.split(":"),r=Buffer.alloc(16);let n=0;""===t[t.length-1]&&(t[t.length-1]="0");for(let e=0;eo&&(o=n,i=r)):(r=-1,n=0),t.push(s.toString(16))}if(o>0){let e="";const r=t.slice(i+o);t.length=i,0===t.length&&(e+=":"),0===r.length&&(e+=":"),t.push(e,...r)}return t.join(":");default:return""}};const i=Object.create(null),o=/^[0-9.]+$/;function a(e,t){i[e]=t,i[t]=e}t.getOID=function(e){return o.test(e)&&""!==i[e]?e:null==i[e]?"":i[e]},t.getOIDName=function(e){return o.test(e)||""===i[e]?null==i[e]?e:i[e]:e},a("1.2.840.113549.1.1.1","rsaEncryption"),a("1.2.840.113549.1.1.4","md5WithRsaEncryption"),a("1.2.840.113549.1.1.5","sha1WithRsaEncryption"),a("1.2.840.113549.1.1.8","mgf1"),a("1.2.840.113549.1.1.10","RSASSA-PSS"),a("1.2.840.113549.1.1.11","sha256WithRsaEncryption"),a("1.2.840.113549.1.1.12","sha384WithRsaEncryption"),a("1.2.840.113549.1.1.13","sha512WithRsaEncryption"),a("1.2.840.10045.2.1","ecEncryption"),a("1.2.840.10045.4.1","ecdsaWithSha1"),a("1.2.840.10045.4.3.2","ecdsaWithSha256"),a("1.2.840.10045.4.3.3","ecdsaWithSha384"),a("1.2.840.10045.4.3.4","ecdsaWithSha512"),a("1.2.840.10040.4.3","dsaWithSha1"),a("2.16.840.1.101.3.4.3.2","dsaWithSha256"),a("1.3.14.3.2.7","desCBC"),a("1.3.14.3.2.26","sha1"),a("2.16.840.1.101.3.4.2.1","sha256"),a("2.16.840.1.101.3.4.2.2","sha384"),a("2.16.840.1.101.3.4.2.3","sha512"),a("1.2.840.113549.2.5","md5"),a("1.3.101.110","X25519"),a("1.3.101.111","X448"),a("1.3.101.112","Ed25519"),a("1.3.101.113","Ed448"),a("1.2.840.113549.1.7.1","data"),a("1.2.840.113549.1.7.2","signedData"),a("1.2.840.113549.1.7.3","envelopedData"),a("1.2.840.113549.1.7.4","signedAndEnvelopedData"),a("1.2.840.113549.1.7.5","digestedData"),a("1.2.840.113549.1.7.6","encryptedData"),a("1.2.840.113549.1.9.1","emailAddress"),a("1.2.840.113549.1.9.2","unstructuredName"),a("1.2.840.113549.1.9.3","contentType"),a("1.2.840.113549.1.9.4","messageDigest"),a("1.2.840.113549.1.9.5","signingTime"),a("1.2.840.113549.1.9.6","counterSignature"),a("1.2.840.113549.1.9.7","challengePassword"),a("1.2.840.113549.1.9.8","unstructuredAddress"),a("1.2.840.113549.1.9.14","extensionRequest"),a("1.2.840.113549.1.9.20","friendlyName"),a("1.2.840.113549.1.9.21","localKeyId"),a("1.2.840.113549.1.9.22.1","x509Certificate"),a("1.2.840.113549.1.12.10.1.1","keyBag"),a("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),a("1.2.840.113549.1.12.10.1.3","certBag"),a("1.2.840.113549.1.12.10.1.4","crlBag"),a("1.2.840.113549.1.12.10.1.5","secretBag"),a("1.2.840.113549.1.12.10.1.6","safeContentsBag"),a("1.2.840.113549.1.5.13","pkcs5PBES2"),a("1.2.840.113549.1.5.12","pkcs5PBKDF2"),a("1.2.840.113549.2.7","hmacWithSha1"),a("1.2.840.113549.2.9","hmacWithSha256"),a("1.2.840.113549.2.10","hmacWithSha384"),a("1.2.840.113549.2.11","hmacWithSha512"),a("1.2.840.113549.3.7","3desCBC"),a("2.16.840.1.101.3.4.1.2","aesCBC128"),a("2.16.840.1.101.3.4.1.42","aesCBC256"),a("2.5.4.3","commonName"),a("2.5.4.5","serialName"),a("2.5.4.6","countryName"),a("2.5.4.7","localityName"),a("2.5.4.8","stateOrProvinceName"),a("2.5.4.10","organizationName"),a("2.5.4.11","organizationalUnitName"),a("2.5.4.15","businessCategory"),a("2.16.840.1.113730.1.1","nsCertType"),a("2.5.29.2","keyAttributes"),a("2.5.29.4","keyUsageRestriction"),a("2.5.29.6","subtreesConstraint"),a("2.5.29.9","subjectDirectoryAttributes"),a("2.5.29.14","subjectKeyIdentifier"),a("2.5.29.15","keyUsage"),a("2.5.29.16","privateKeyUsagePeriod"),a("2.5.29.17","subjectAltName"),a("2.5.29.18","issuerAltName"),a("2.5.29.19","basicConstraints"),a("2.5.29.20","cRLNumber"),a("2.5.29.21","cRLReason"),a("2.5.29.22","expirationDate"),a("2.5.29.23","instructionCode"),a("2.5.29.24","invalidityDate"),a("2.5.29.27","deltaCRLIndicator"),a("2.5.29.28","issuingDistributionPoint"),a("2.5.29.29","certificateIssuer"),a("2.5.29.30","nameConstraints"),a("2.5.29.31","cRLDistributionPoints"),a("2.5.29.32","certificatePolicies"),a("2.5.29.33","policyMappings"),a("2.5.29.35","authorityKeyIdentifier"),a("2.5.29.36","policyConstraints"),a("2.5.29.37","extKeyUsage"),a("2.5.29.46","freshestCRL"),a("2.5.29.54","inhibitAnyPolicy"),a("1.3.6.1.4.1.311.60.2.1.2","jurisdictionST"),a("1.3.6.1.4.1.311.60.2.1.3","jurisdictionC"),a("1.3.6.1.4.1.11129.2.4.2","timestampList"),a("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),a("1.3.6.1.5.5.7.3.1","serverAuth"),a("1.3.6.1.5.5.7.3.2","clientAuth"),a("1.3.6.1.5.5.7.3.3","codeSigning"),a("1.3.6.1.5.5.7.3.4","emailProtection"),a("1.3.6.1.5.5.7.3.8","timeStamping"),a("1.3.6.1.5.5.7.48.1","authorityInfoAccessOcsp"),a("1.3.6.1.5.5.7.48.2","authorityInfoAccessIssuers")},function(e,t,r){"use strict";const n=e=>!("object"!=typeof e||null===e||e instanceof RegExp||e instanceof Error||e instanceof Date);e.exports=function e(t,r,i,o){if(i=Object.assign({deep:!1,target:{}},i),(o=o||new WeakMap).has(t))return o.get(t);o.set(t,i.target);const a=i.target;delete i.target;for(const s of Object.keys(t)){const u=t[s],c=r(s,u,t);let f=c[1];i.deep&&n(f)&&(f=Array.isArray(f)?f.map(t=>n(t)?e(t,r,i,o):t):e(f,r,i,o)),a[c[0]]=f}return a}},function(e,t,r){"use strict";var n=r(14),i=r(42);e.exports=function(e,t){return t=Object.assign({deep:!0},t),n(e,(function(e,t){return[i(e),t]}),t)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(2),i=r(45),o=r(46),a=r(15),s=r(47),u=r(72),c={RSA:"RSA-SHA1",RSA2:"RSA-SHA256"};function f(e){return{iv:s.enc.Hex.parse(u.padEnd("",32,"0")),key:s.enc.Base64.parse(e)}}t.ALIPAY_ALGORITHM_MAPPING=c,t.aesDecrypt=function(e,t){const{iv:r,key:n}=f(t),i=s.AES.decrypt(e,n,{iv:r});return JSON.parse(i.toString(s.enc.Utf8))},t.sign=function(e,t={},r){let l=Object.assign({method:e,appId:r.appId,charset:r.charset,version:r.version,signType:r.signType,timestamp:i().format("YYYY-MM-DD HH:mm:ss")},u.omit(t,["bizContent","needEncrypt"]));r.appCertSn&&r.alipayRootCertSn&&(l=Object.assign({appCertSn:r.appCertSn,alipayRootCertSn:r.alipayRootCertSn},l)),r.wsServiceUrl&&(l.wsServiceUrl=r.wsServiceUrl);const h=t.bizContent;if(h)if(t.needEncrypt){if(!r.encryptKey)throw new Error("请设置encryptKey参数");l.encryptType="AES",l.bizContent=function(e,t){const{iv:r,key:n}=f(t);return s.AES.encrypt(JSON.stringify(e),n,{iv:r}).toString()}(a(h),r.encryptKey)}else l.bizContent=JSON.stringify(a(h));const p=a(l),d=Object.keys(p).sort().map(e=>{let t=p[e];return"[object String]"!==Array.prototype.toString.call(t)&&(t=JSON.stringify(t)),`${e}=${o.encode(t,r.charset)}`}).join("&"),y=n.createSign(c[r.signType]).update(d,"utf8").sign(r.privateKey,"base64");return Object.assign(p,{sign:y})}},function(e,t,r){var n;e.exports=(n=r(0),function(e){var t=n,r=t.lib,i=r.WordArray,o=r.Hasher,a=t.algo,s=[],u=[];!function(){function t(t){for(var r=e.sqrt(t),n=2;n<=r;n++)if(!(t%n))return!1;return!0}function r(e){return 4294967296*(e-(0|e))|0}for(var n=2,i=0;i<64;)t(n)&&(i<8&&(s[i]=r(e.pow(n,.5))),u[i]=r(e.pow(n,1/3)),i++),n++}();var c=[],f=a.SHA256=o.extend({_doReset:function(){this._hash=new i.init(s.slice(0))},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],f=r[5],l=r[6],h=r[7],p=0;p<64;p++){if(p<16)c[p]=0|e[t+p];else{var d=c[p-15],y=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,g=c[p-2],v=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;c[p]=y+c[p-7]+v+c[p-16]}var _=n&i^n&o^i&o,m=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),b=h+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&f^~s&l)+u[p]+c[p];h=l,l=f,f=s,s=a+b|0,a=o,o=i,i=n,n=b+(m+_)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+s|0,r[5]=r[5]+f|0,r[6]=r[6]+l|0,r[7]=r[7]+h|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=e.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,t.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(f),t.HmacSHA256=o._createHmacHelper(f)}(Math),n.SHA256)},function(e,t,r){var n;e.exports=(n=r(0),r(8),function(){var e=n,t=e.lib.Hasher,r=e.x64,i=r.Word,o=r.WordArray,a=e.algo;function s(){return i.create.apply(i,arguments)}var u=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],c=[];!function(){for(var e=0;e<80;e++)c[e]=s()}();var f=a.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],s=r[4],f=r[5],l=r[6],h=r[7],p=n.high,d=n.low,y=i.high,g=i.low,v=o.high,_=o.low,m=a.high,b=a.low,w=s.high,S=s.low,E=f.high,A=f.low,I=l.high,N=l.low,C=h.high,T=h.low,R=p,x=d,P=y,O=g,B=v,k=_,D=m,U=b,M=w,j=S,L=E,F=A,K=I,z=N,V=C,$=T,q=0;q<80;q++){var H,W,G=c[q];if(q<16)W=G.high=0|e[t+2*q],H=G.low=0|e[t+2*q+1];else{var J=c[q-15],Y=J.high,Z=J.low,Q=(Y>>>1|Z<<31)^(Y>>>8|Z<<24)^Y>>>7,X=(Z>>>1|Y<<31)^(Z>>>8|Y<<24)^(Z>>>7|Y<<25),ee=c[q-2],te=ee.high,re=ee.low,ne=(te>>>19|re<<13)^(te<<3|re>>>29)^te>>>6,ie=(re>>>19|te<<13)^(re<<3|te>>>29)^(re>>>6|te<<26),oe=c[q-7],ae=oe.high,se=oe.low,ue=c[q-16],ce=ue.high,fe=ue.low;W=(W=(W=Q+ae+((H=X+se)>>>0>>0?1:0))+ne+((H+=ie)>>>0>>0?1:0))+ce+((H+=fe)>>>0>>0?1:0),G.high=W,G.low=H}var le,he=M&L^~M&K,pe=j&F^~j&z,de=R&P^R&B^P&B,ye=x&O^x&k^O&k,ge=(R>>>28|x<<4)^(R<<30|x>>>2)^(R<<25|x>>>7),ve=(x>>>28|R<<4)^(x<<30|R>>>2)^(x<<25|R>>>7),_e=(M>>>14|j<<18)^(M>>>18|j<<14)^(M<<23|j>>>9),me=(j>>>14|M<<18)^(j>>>18|M<<14)^(j<<23|M>>>9),be=u[q],we=be.high,Se=be.low,Ee=V+_e+((le=$+me)>>>0<$>>>0?1:0),Ae=ve+ye;V=K,$=z,K=L,z=F,L=M,F=j,M=D+(Ee=(Ee=(Ee=Ee+he+((le+=pe)>>>0>>0?1:0))+we+((le+=Se)>>>0>>0?1:0))+W+((le+=H)>>>0>>0?1:0))+((j=U+le|0)>>>0>>0?1:0)|0,D=B,U=k,B=P,k=O,P=R,O=x,R=Ee+(ge+de+(Ae>>>0>>0?1:0))+((x=le+Ae|0)>>>0>>0?1:0)|0}d=n.low=d+x,n.high=p+R+(d>>>0>>0?1:0),g=i.low=g+O,i.high=y+P+(g>>>0>>0?1:0),_=o.low=_+k,o.high=v+B+(_>>>0>>0?1:0),b=a.low=b+U,a.high=m+D+(b>>>0>>0?1:0),S=s.low=S+j,s.high=w+M+(S>>>0>>0?1:0),A=f.low=A+F,f.high=E+L+(A>>>0>>0?1:0),N=l.low=N+z,l.high=I+K+(N>>>0>>0?1:0),T=h.low=T+$,h.high=C+V+(T>>>0<$>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),t[31+(n+128>>>10<<5)]=r,e.sigBytes=4*t.length,this._process(),this._hash.toX32()},clone:function(){var e=t.clone.call(this);return e._hash=this._hash.clone(),e},blockSize:32});e.SHA512=t._createHelper(f),e.HmacSHA512=t._createHmacHelper(f)}(),n.SHA512)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(13);t.bytesFromIP=n.bytesFromIP,t.bytesToIP=n.bytesToIP,t.getOID=n.getOID,t.getOIDName=n.getOIDName;var i=r(20);t.PublicKey=i.PublicKey,t.PrivateKey=i.PrivateKey,t.RSAPublicKey=i.RSAPublicKey,t.RSAPrivateKey=i.RSAPrivateKey;var o=r(80);t.Certificate=o.Certificate,t.DistinguishedName=o.DistinguishedName},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(9),i=r(2),o=r(77),a=r(21),s=r(13);t.publicKeyValidator={name:"PublicKeyInfo",class:a.Class.UNIVERSAL,tag:a.Tag.SEQUENCE,capture:"publicKeyInfo",value:[{name:"PublicKeyInfo.AlgorithmIdentifier",class:a.Class.UNIVERSAL,tag:a.Tag.SEQUENCE,value:[{name:"PublicKeyAlgorithmIdentifier.algorithm",class:a.Class.UNIVERSAL,tag:a.Tag.OID,capture:"publicKeyOID"}]},{name:"PublicKeyInfo.PublicKey",class:a.Class.UNIVERSAL,tag:a.Tag.BITSTRING,capture:"publicKey"}]},t.privateKeyValidator={name:"PrivateKeyInfo",class:a.Class.UNIVERSAL,tag:a.Tag.SEQUENCE,capture:"privateKeyInfo",value:[{name:"PrivateKeyInfo.Version",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.AlgorithmIdentifier",class:a.Class.UNIVERSAL,tag:a.Tag.SEQUENCE,value:[{name:"PrivateKeyAlgorithmIdentifier.algorithm",class:a.Class.UNIVERSAL,tag:a.Tag.OID,capture:"privateKeyOID"}]},{name:"PrivateKeyInfo.PrivateKey",class:a.Class.UNIVERSAL,tag:a.Tag.OCTETSTRING,capture:"privateKey"}]};const u={name:"RSAPublicKey",class:a.Class.UNIVERSAL,tag:a.Tag.SEQUENCE,value:[{name:"RSAPublicKey.modulus",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"publicKeyExponent"}]},c={name:"RSAPrivateKey",class:a.Class.UNIVERSAL,tag:a.Tag.SEQUENCE,value:[{name:"RSAPrivateKey.version",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",class:a.Class.UNIVERSAL,tag:a.Tag.INTEGER,capture:"privateKeyCoefficient"}]},f=[s.getOID("X25519"),s.getOID("X448"),s.getOID("Ed25519"),s.getOID("Ed448")];class l{constructor(e){const r={},n=e.validate(t.publicKeyValidator,r);if(null!=n)throw new Error("Cannot read X.509 public key: "+n.message);this.oid=a.ASN1.parseOID(r.publicKeyOID.bytes),this.algo=s.getOIDName(this.oid),this._pkcs8=e,this._keyRaw=a.ASN1.parseBitString(r.publicKey.bytes).buf,this._finalKey=this._keyRaw,this._finalPEM=""}static fromPEM(e){const t=a.PEM.parse(e)[0];if(t.procType.includes("ENCRYPTED"))throw new Error("Could not convert public key from PEM, PEM is encrypted.");const r=a.ASN1.fromDER(t.body,!0);switch(t.type){case"PUBLIC KEY":return new l(r);case"RSA PUBLIC KEY":const e=a.ASN1.Seq([a.ASN1.Seq([a.ASN1.OID(s.getOID("rsaEncryption")),a.ASN1.Null()]),a.ASN1.BitString(r.DER)]);return new l(e);default:throw new Error("Could not convert public key from PEM, recommend PKCS#8 PEM")}}static addVerifier(e,t){if(""===(e=s.getOID(e)))throw new Error("Invalid object identifier: "+e);if(null!=l._verifiers[e])throw new Error(`Verifier ${e} exists`);l._verifiers[e]=t}get keyRaw(){return this._finalKey}verify(e,t,r){const n=l._verifiers[this.oid];if(null!=n){const o=i.createHash(r).update(e).digest();return n.call(this,o,t)}const o=i.createVerify(r);return o.update(e),o.verify(this.toPEM(),t)}getFingerprint(e,t="PublicKey"){let r;switch(t){case"PublicKeyInfo":r=this._pkcs8.DER;break;case"PublicKey":r=this._keyRaw;break;default:throw new Error(`Unknown fingerprint type "${t}".`)}const n=i.createHash(e);return n.update(r),n.digest()}toASN1(){return this._pkcs8}toDER(){return this._pkcs8.DER}toPEM(){return""===this._finalPEM&&(this._finalPEM=new a.PEM("PUBLIC KEY",this._pkcs8.DER).toString()),this._finalPEM}toJSON(){return{oid:this.oid,algo:this.algo,publicKey:this._keyRaw}}[n.inspect.custom](e,t){return`<${this.constructor.name} ${n.inspect(this.toJSON(),t)}>`}}l._verifiers=Object.create(null),t.PublicKey=l;class h{constructor(e){const r=Object.create(null),n=e.validate(t.privateKeyValidator,r);if(null!=n)throw new Error("Cannot read X.509 private key: "+n.message);if(this.version=a.ASN1.parseIntegerNum(r.privateKeyVersion.bytes)+1,this.oid=a.ASN1.parseOID(r.privateKeyOID.bytes),this.algo=s.getOIDName(this.oid),this._pkcs8=e,this._keyRaw=r.privateKey.bytes,this._publicKeyRaw=null,this._finalKey=this._keyRaw,this._finalPEM="",f.includes(this.oid))if(this._finalKey=this._keyRaw=a.ASN1.parseDER(this._keyRaw,a.Class.UNIVERSAL,a.Tag.OCTETSTRING).bytes,"1.3.101.112"===this.oid){const e=o.sign.keyPair.fromSeed(this._keyRaw);this._publicKeyRaw=Buffer.from(e.publicKey),this._finalKey=Buffer.from(e.secretKey)}else if(2===this.version)for(const t of e.mustCompound())t.class===a.Class.CONTEXT_SPECIFIC&&1===t.tag&&(this._publicKeyRaw=a.ASN1.parseBitString(t.bytes).buf,this._finalKey=Buffer.concat([this._keyRaw,this._publicKeyRaw]))}static fromPEM(e){const t=a.PEM.parse(e)[0];if(t.procType.includes("ENCRYPTED"))throw new Error("Could not convert private key from PEM, PEM is encrypted.");let r=a.ASN1.fromDER(t.body,!0);switch(t.type){case"PRIVATE KEY":return new h(r);case"RSA PRIVATE KEY":return r=a.ASN1.Seq([r.value[0],a.ASN1.Seq([a.ASN1.OID(s.getOID("rsaEncryption")),a.ASN1.Null()]),new a.ASN1(a.Class.UNIVERSAL,a.Tag.OCTETSTRING,r.DER)]),new h(r);default:throw new Error("Could not convert private key from PEM, recommend PKCS#8 PEM")}}static addSigner(e,t){if(""===(e=s.getOID(e)))throw new Error("Invalid object identifier: "+e);if(null!=h._signers[e])throw new Error(`Signer ${e} exists`);h._signers[e]=t}get keyRaw(){return this._finalKey}get publicKeyRaw(){return this._publicKeyRaw}sign(e,t){const r=h._signers[this.oid];if(null!=r){const n=i.createHash(t).update(e).digest();return r.call(this,n)}const n=i.createSign(t);return n.update(e),n.sign(this.toPEM())}toASN1(){return this._pkcs8}toDER(){return this._pkcs8.DER}toPEM(){return""===this._finalPEM&&(this._finalPEM=new a.PEM("PRIVATE KEY",this._pkcs8.DER).toString()),this._finalPEM}toJSON(){return{version:this.version,oid:this.oid,algo:this.algo,privateKey:this._keyRaw,publicKey:this._publicKeyRaw}}[n.inspect.custom](e,t){return`<${this.constructor.name} ${n.inspect(this.toJSON(),t)}>`}}h._signers=Object.create(null),t.PrivateKey=h;class p extends l{static fromPublicKey(e){return new p(e.toASN1())}constructor(e){if(super(e),s.getOID(this.oid)!==s.getOID("rsaEncryption"))throw new Error("Invalid RSA public key, unknown OID: "+this.oid);const t=Object.create(null);this._pkcs1=a.ASN1.fromDER(this._keyRaw,!0);const r=this._pkcs1.validate(u,t);if(null!=r)throw new Error("Cannot read RSA public key: "+r.message);this.modulus=a.ASN1.parseIntegerStr(t.publicKeyModulus.bytes),this.exponent=a.ASN1.parseIntegerNum(t.publicKeyExponent.bytes)}toASN1(){return this._pkcs1}toDER(){return this._keyRaw}toPEM(){return""===this._finalPEM&&(this._finalPEM=new a.PEM("RSA PUBLIC KEY",this._keyRaw).toString()),this._finalPEM}toPublicKeyPEM(){return new a.PEM("PUBLIC KEY",this._pkcs8.DER).toString()}toJSON(){return{oid:this.oid,algo:this.algo,modulus:y(this.modulus),exponent:this.exponent}}[n.inspect.custom](e,t){return`<${this.constructor.name} ${n.inspect(this.toJSON(),t)}>`}}t.RSAPublicKey=p;class d extends h{static fromPrivateKey(e){return new d(e.toASN1())}constructor(e){if(super(e),s.getOID(this.oid)!==s.getOID("rsaEncryption"))throw new Error("Invalid RSA private key, unknown OID: "+this.oid);const t=Object.create(null);this._pkcs1=a.ASN1.fromDER(this._keyRaw,!0);const r=this._pkcs1.validate(c,t);if(null!=r)throw new Error("Cannot read RSA private key: "+r.message);this.publicExponent=a.ASN1.parseIntegerNum(t.privateKeyPublicExponent.bytes),this.privateExponent=a.ASN1.parseIntegerStr(t.privateKeyPrivateExponent.bytes),this.modulus=a.ASN1.parseIntegerStr(t.privateKeyModulus.bytes),this.prime1=a.ASN1.parseIntegerStr(t.privateKeyPrime1.bytes),this.prime2=a.ASN1.parseIntegerStr(t.privateKeyPrime2.bytes),this.exponent1=a.ASN1.parseIntegerStr(t.privateKeyExponent1.bytes),this.exponent2=a.ASN1.parseIntegerStr(t.privateKeyExponent2.bytes),this.coefficient=a.ASN1.parseIntegerStr(t.privateKeyCoefficient.bytes)}toASN1(){return this._pkcs1}toDER(){return this._keyRaw}toPEM(){return""===this._finalPEM&&(this._finalPEM=new a.PEM("RSA PRIVATE KEY",this._keyRaw).toString()),this._finalPEM}toPrivateKeyPEM(){return new a.PEM("PRIVATE KEY",this._pkcs8.DER).toString()}toJSON(){return{version:this.version,oid:this.oid,algo:this.algo,publicExponent:this.publicExponent,privateExponent:y(this.privateExponent),modulus:y(this.modulus),prime1:y(this.prime1),prime2:y(this.prime2),exponent1:y(this.exponent1),exponent2:y(this.exponent2),coefficient:y(this.coefficient)}}[n.inspect.custom](e,t){return`<${this.constructor.name} ${n.inspect(this.toJSON(),t)}>`}}function y(e){return e.length%8!=0&&e.startsWith("00")?e.slice(2):e}t.RSAPrivateKey=d,l.addVerifier(s.getOID("Ed25519"),(function(e,t){return o.sign.detached.verify(e,t,this.keyRaw)})),h.addSigner(s.getOID("Ed25519"),(function(e){const t=this.keyRaw;if(64!==t.length)throw new Error("Invalid signing key.");return Buffer.from(o.sign.detached(e,t))}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(22);t.BufferVisitor=n.BufferVisitor;var i=r(78);t.PEM=i.PEM;var o=r(79);t.ASN1=o.ASN1,t.Class=o.Class,t.Tag=o.Tag,t.BitString=o.BitString},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BufferVisitor=class{constructor(e,t=0,r=0){this.start=t,this.end=r>t?r:t,this.buf=e}get length(){return this.buf.length}reset(e=0,t=0){return this.start=e,t>=this.start?this.end=t:this.endthis.buf.length){const e=new Error(t);throw e.available=this.buf.length,e.requested=r,e}return this.walk(0),this}mustWalk(e,t){return this.mustHas(e,t),this.walk(e),this}}},function(e,t,r){"use strict";var n=c(r(24)),i=c(r(30)),o=c(r(83)),a=c(r(84)),s=c(r(88)),u=r(3);function c(e){return e&&e.__esModule?e:{default:e}}e.exports={initWeixin:(e={})=>(e.clientType=e.clientType||__ctx__.PLATFORM,(0,u.createApi)(n.default,e)),initAlipay:(e={})=>(e.clientType=e.clientType||__ctx__.PLATFORM,(0,u.createApi)(i.default,e)),initAppleIapPayment:(e={})=>(e.clientType=e.clientType||__ctx__.PLATFORM,(0,u.createApi)(o.default,e)),initWeixinV3:(e={})=>(e.clientType=e.clientType||__ctx__.PLATFORM,(0,u.createApi)(a.default,e)),initWeixinVirtualPayment:(e={})=>(e.clientType=e.clientType||__ctx__.PLATFORM,(0,u.createApi)(s.default,e))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=a(r(25)),i=a(r(29)),o=r(3);function a(e){return e&&e.__esModule?e:{default:e}}t.default=class{constructor(e={}){if(!e.appId)throw new Error("appId required");if(!e.mchId)throw new Error("mchId required");if(!e.key)throw new Error("key required");e.signType=e.signType||"MD5",this.options=Object.assign({},e),this._protocols=i.default,this.baseUrl="https://api.mch.weixin.qq.com",this.paths={unifiedOrder:"/pay/unifiedorder",orderQuery:"/pay/orderquery",closeOrder:"/pay/closeorder",refund:"/secapi/pay/refund",refundQuery:"/pay/refundquery",downloadBill:"/pay/downloadbill",downloadFundflow:"/pay/downloadfundflow",getsignkey:"/pay/getsignkey"}}_getSign(e,t){const r=n.default.getSignStr(e)+"&key="+this.options.key;switch(t){case"MD5":return n.default.md5(r).toUpperCase();case"HMAC-SHA256":return n.default.sha256(r,this.options.key).toUpperCase();default:throw new Error("signType Error")}}_normalizeResult(e,t){return e.returnMsg=e.returnMsg||("SUCCESS"===e.returnCode?"ok":"fail"),e.errMsg=`payment.${t} ${e.returnMsg.toLowerCase()}`,e}_parse(e,t,r){const i=n.default.parseXML(e);if("FAIL"===i.return_code)throw new Error(""+i.return_msg);if("getSandboxKey"!==t){if(i.appid!==this.options.appId)throw new Error("appId不匹配");if(i.mch_id!==this.options.mchId)throw new Error("mchId不匹配");if(i.sign!==this._getSign(i,r))throw new Error("返回结果签名错误");i.app_id=i.appid,delete i.appid}if("FAIL"===i.result_code)throw new Error(`${i.err_code} ${i.err_code_des}`);return this._normalizeResult((0,o.snake2camelJson)(i),t)}_parseBill(e,t){const r={};if(n.default.isXML(e)){const t=n.default.parseXML(e);if("FAIL"===t.return_code)throw new Error(""+t.return_msg);if("FAIL"===t.result_code)throw new Error(`${t.err_code} ${t.err_code_des}`)}else r.returnCode="SUCCESS",r.content=e;return this._normalizeResult(r,t)}_getPublicParams(){const{appId:e,mchId:t,subAppId:r,subMchId:i}=this.options;return r?{appid:e,mchId:t,nonceStr:n.default.getNonceStr(),subAppid:r,subMchId:i}:{appid:e,mchId:t,nonceStr:n.default.getNonceStr()}}async _requestWxpay(e,t,r=!1){if(r&&!this.options.pfx)throw new Error("此接口需要微信支付证书(请传入pfx字段)");"getSandboxKey"!==t&&await this._initSandbox();const i=e.signType||this.options.signType;(e=(0,o.camel2snakeJson)(e)).sign=this._getSign(e,i);const a={method:"POST",dataType:"text",data:n.default.buildXML(e),timeout:this.options.timeout};r&&(a.pfx=this.options.pfx,a.passphrase=this.options.mchId);const{status:s,data:u}=await uniCloud.httpclient.request(this.options.sandbox?`${this.baseUrl}/sandboxnew${this.paths[t]}`:`${this.baseUrl}${this.paths[t]}`,a);if(200!==s)throw new Error("request fail");return-1!==["downloadBill","downloadFundflow"].indexOf(t)?this._parseBill(u,t):this._parse(u,t,i)}async getSandboxKey(){const e={mchId:this.options.mchId,nonceStr:n.default.getNonceStr()};return await this._requestWxpay(e,"getSandboxKey")}async _initSandbox(){this.options.sandbox&&!this.options.sandboxKey&&(this.options.key=this.options.sandboxKey=await this.getSandboxKey().sandbox_signkey)}async unifiedOrder(e){let t;if(e.tradeType)t=e.tradeType;else switch(this.options.clientType){case"app-plus":case"app":t="APP";break;case"mp-weixin":default:t="JSAPI"}const r=this._getPublicParams();r.subAppid&&(e.sub_openid=e.openid),("JSAPI"!==t||r.subAppid)&&delete e.openid;const n={...e,...r,spbillCreateIp:e.spbillCreateIp||"127.0.0.1",tradeType:t};return await this._requestWxpay(n,"unifiedOrder")}_getPayParamsByPrepayId(e,t){let r;switch(this.options.clientType){case"app-plus":case"app":r={appid:this.options.subAppId?this.options.subAppId:this.options.appId,noncestr:n.default.getNonceStr(),package:"Sign=WXPay",partnerid:this.options.mchId,prepayid:e,timestamp:""+(Date.now()/1e3|0)},r.sign=this._getSign(r,t);break;case"mp-weixin":default:{const i=""+(Date.now()/1e3|0);r={appId:this.options.subAppId?this.options.subAppId:this.options.appId,nonceStr:n.default.getNonceStr(),package:"prepay_id="+e,timeStamp:i},r.signType=t,r.paySign=this._getSign(r,t),r.timestamp=i;break}}return r}async getOrderInfo(e){let t;if(e.tradeType)t=e.tradeType;else switch(this.options.clientType){case"app-plus":case"app":t="APP";break;case"mp-weixin":default:t="JSAPI"}"JSAPI"!==t&&delete e.openid,e.tradeType=t;const r=await this.unifiedOrder(e);if("NATIVE"===t||"MWEB"===t)return r;if(!r.prepayId)throw new Error(r.errMsg||"获取prepayId失败");return this._getPayParamsByPrepayId(r.prepayId,e.signType||this.options.signType)}async orderQuery(e){const t={...e,...this._getPublicParams()};return await this._requestWxpay(t,"orderQuery")}async closeOrder(e){const t={...e,...this._getPublicParams()};return await this._requestWxpay(t,"closeOrder")}async refund(e){const t={...e,...this._getPublicParams()};return await this._requestWxpay(t,"refund",!0)}async refundQuery(e){const t={...e,...this._getPublicParams()};return await this._requestWxpay(t,"refundQuery")}async downloadBill(e){const t={...e,...this._getPublicParams(),billType:e.billType||"ALL"};return await this._requestWxpay(t,"downloadBill")}async downloadFundflow(e){const t={...e,...this._getPublicParams(),signType:e.signType||"HMAC-SHA256",accountType:e.accountType||"Basic"};return await this._requestWxpay(t,"downloadFundflow",!0)}_getNotifyData(e){let t=e.body;return e.isBase64Encoded&&(t=Buffer.from(t,"base64").toString("utf-8")),n.default.parseXML(t)}_verifyNotify(e,t){const r=this._getNotifyData(e);if("FAIL"===r.return_code)throw new Error(`${r.return_code} ${r.return_msg}`);if(r.appid!==this.options.appId)throw new Error("appId不匹配");if(r.mch_id!==this.options.mchId)throw new Error("mchId不匹配");if(t&&r.sign!==this._getSign(r,this.options.signType))throw new Error("通知验签未通过");const n=(0,o.snake2camelJson)(r);return n.appId=n.appid,delete n.appid,n}verifyPaymentNotify(e){return"payment"===this.checkNotifyType(e)&&this._verifyNotify(e,!0)}verifyRefundNotify(e){if("refund"!==this.checkNotifyType(e))return!1;const t=this._verifyNotify(e,!1),r=(0,o.snake2camelJson)(n.default.parseXML(n.default.decryptData(t.reqInfo,n.default.md5(this.options.key))));return Object.assign(t,r),delete t.reqInfo,t}checkNotifyType(e){const t=this._getNotifyData(e);return"total_fee"in t?"payment":"req_info"in t?"refund":"payment"}},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(2))&&n.__esModule?n:{default:n},o=r(3);var a={decryptData:function(e,t,r=""){const n=i.default.createDecipheriv("aes-256-ecb",t,r);n.setAutoPadding(!0);let o=n.update(e,"base64","utf8");return o+=n.final("utf8"),o},md5:function(e,t="utf8"){return i.default.createHash("md5").update(e,t).digest("hex")},sha256:function(e,t,r="utf8"){return i.default.createHmac("sha256",t).update(e,r).digest("hex")},getSignStr:function(e){return Object.keys(e).filter(t=>"sign"!==t&&void 0!==e[t]&&""!==e[t]).sort().map(t=>t+"="+((0,o.isPlainObject)(e[t])?JSON.stringify(e[t]):e[t])).join("&")},getNonceStr:function(e=16){let t="";for(;t.length${Object.keys(e).map(t=>(0,o.isPlainObject)(e[t])?`<${t}>`:`<${t}>`).join("")}`},parseXML:function(e){const t=/<(?:xml|root).*?>([\s|\S]*)<\/(?:xml|root)>/.exec(e)[1],r={},n=/<(.*?)>(?:){0,1}<\/.*?>/g;let i=null;for(;i=n.exec(t);)r[i[1]]=i[2];return r},isXML:function(e){return/^(<\?xml.*\?>)?(\r?\n)*(.|\r?\n)*<\/xml>$/i.test(e.trim())}};t.default=a,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=class{constructor(){this._boundary="------FormDataBaseBoundary"+Math.random().toString(36).substring(2),this.dataList=[]}_addData(e){const t=this.dataList[this.dataList.length-1];"string"==typeof e&&"string"==typeof t?this.dataList[this.dataList.length-1]=t+"\r\n"+e:this.dataList.push(e)}append(e,t,r){this._addData("--"+this._boundary);let n=`Content-Disposition: form-data; name="${e}"`;switch(Buffer.isBuffer(t)){case!0:if(!r.filename||!r.contentType)throw new Error("filename and contentType required");n+=`; filename="${r.filename}"`,this._addData(n),this._addData("Content-Type: "+r.contentType),this._addData(""),this._addData(t);break;default:this._addData(""),this._addData(t)}}getHeaders(e){const t={"Content-Type":"multipart/form-data; boundary="+this._boundary};return Object.assign(t,e)}getBuffer(){let e=Buffer.alloc(0);return this.dataList.forEach(t=>{e=Buffer.isBuffer(t)?Buffer.concat([e,t]):Buffer.concat([e,Buffer.from(""+t)]),e=Buffer.concat([e,Buffer.from("\r\n")])}),e=Buffer.concat([e,Buffer.from("--"+this._boundary+"--")]),e}},e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;class n extends Error{constructor(e){super(e.message),this.errMsg=e.message||"",this.errCode=e.code||"",Object.defineProperties(this,{message:{get(){return`errCode: ${this.errCode} | errMsg: `+this.errMsg},set(e){this.errMsg=e}}})}}t.default=n,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createApi=function(e,t){const r=new e(t);return new Proxy(r,{get:function(e,t){if("function"==typeof e[t]&&0!==t.indexOf("_")&&e._protocols&&e._protocols[t]){const r=e._protocols[t];return async function(n){n=i(n,r.args);let o=await e[t](n);return o=i(o,r.returnValue),o}}return e[t]}})};var n=r(7);function i(e={},t){if(!t||!e)return e;const r=["_pre","_purify","_post"];t._pre&&(e=t._pre(e));let i={shouldDelete:new Set([])};if(t._purify){const e=t._purify;for(const t in e)e[t]=new Set(e[t]);i=Object.assign(i,e)}if((0,n.isPlainObject)(t))for(const o in t){const a=t[o];if((0,n.isFn)(a)&&-1===r.indexOf(o))e[o]=a(e);else if("string"==typeof a&&/\./g.test(a)){const t=a.split(".");e[o]=t.reduce((e,t)=>e[t],e)}else if("string"==typeof a&&/\./g.test(o)){const t=o.split(".");let r=e;for(const[n,i]of t.entries())r[i]||(r[i]=n+1>=t.length?e[a]:{}),r=r[i]}else"string"==typeof a&&-1===r.indexOf(o)&&(e[o]=e[a]);o!==a&&"string"==typeof a&&i.shouldDelete.add(a)}else(0,n.isFn)(t)&&(e=t(e));if(i.shouldDelete)for(const t of i.shouldDelete)/\./g.test(t)?(0,n.deleteObjectKey)(t.split("."),e):delete e[t];return t._post&&(e=t._post(e)),e}},function(e,t,r){"use strict";function n(e,t){t.forEach(t=>{void 0!==e[t]&&(e[t]=Number(e[t]))})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i={unifiedOrder:{args:{_purify:{shouldDelete:["subject"]}}},getOrderInfo:{args:{_purify:{shouldDelete:["subject"]}}},orderQuery:{returnValue:function(e){n(e,["cashFee","totalFee","couponCount"]),e.couponList=[];const t=e.couponCount||0;for(let r=0;re.billDate.replace(/-/g,"")}},downloadFundflow:{args:{billDate:e=>e.billDate.replace(/-/g,"")}}};t.default=i,e.exports=t.default},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=r(3),i=c(r(2)),o=c(r(31)),a=c(r(32)),s=c(r(82)),u=r(16);function c(e){return e&&e.__esModule?e:{default:e}}const f={RSA:"RSA-SHA1",RSA2:"RSA-SHA256"};class l extends a.default{constructor(e){e.sandbox&&(e.gateway="https://openapi.alipaydev.com/gateway.do"),super(e=Object.assign({gateway:"https://openapi.alipay.com/gateway.do",timeout:5e3,charset:"utf-8",version:"1.0",signType:"RSA2",timeOffset:8,keyType:"PKCS8"},e)),this.options=e,this._protocols=s.default}async _request(e,t){const r={};t.notifyUrl&&(r.notifyUrl=t.notifyUrl,delete t.notifyUrl),r.bizContent=t;return await this.exec(e,r,{validateSign:!0})}async unifiedOrder(e){return await this._request("alipay.trade.create",Object.assign({sellerId:this.options.mchId},e))}_getSign(e,t){return(0,u.sign)(e,t,this.config)}formatUrl(e,t){let r=e;const n=["app_id","method","format","charset","sign_type","sign","timestamp","version","notify_url","return_url","auth_token","app_auth_token","app_cert_sn","alipay_root_cert_sn","appCertSn","alipayRootCertSn"];for(const e in t)if(n.indexOf(e)>-1){const n=encodeURIComponent(t[e]);r=`${r}${r.includes("?")?"&":"?"}${e}=${n}`,delete t[e]}return{execParams:t,url:r}}async getOrderInfo(e){let t;if(e.tradeType)t=e.tradeType,delete e.tradeType;else switch(this.options.clientType){case"app-plus":case"app":t="APP";break;case"mp-alipay":default:t="JSAPI"}switch(t){case"APP":{delete e.buyerId;const t={};e.notifyUrl&&(t.notifyUrl=e.notifyUrl,delete e.notifyUrl),t.bizContent=e;const r=this._getSign("alipay.trade.app.pay",t),{url:n,execParams:i}=this.formatUrl("",r);return(n+"&biz_content="+encodeURIComponent(i.biz_content)).substr(1)}case"JSAPI":{const t=await this.unifiedOrder(e);if(!t.tradeNo)throw new Error("获取支付宝交易号失败,详细信息为:"+JSON.stringify(t));return t.tradeNo}case"NATIVE":return await this._request("alipay.trade.precreate",Object.assign({sellerId:this.options.mchId},e));default:throw new Error("不支持的支付类型,支付宝支付下单仅支持App、支付宝小程序、网站二维码支付")}}async orderQuery(e){return await this._request("alipay.trade.query",e)}async cancelOrder(e){return await this._request("alipay.trade.cancel",e)}async closeOrder(e){return await this._request("alipay.trade.close",e)}async refund(e){return await this._request("alipay.trade.refund",e)}async refundQuery(e){return await this._request("alipay.trade.fastpay.refund.query",e)}notifyRSACheck(e,t,r){const n=Object.keys(e).sort().filter(e=>e).map(t=>{let r=e[t];return"[object String]"!==Array.prototype.toString.call(r)&&(r=JSON.stringify(r)),`${t}=${r}`}).join("&");return i.default.createVerify(f[r]).update(n,"utf8").verify(this.config.alipayPublicKey,t,"base64")}_getNotifyData(e){if(!e.headers)throw new Error("通知格式不正确");let t;for(const r in e.headers)"content-type"===r.toLowerCase()&&(t=e.headers[r]);if(!1!==e.isBase64Encoded&&-1===t.indexOf("application/x-www-form-urlencoded"))throw new Error("通知格式不正确");return o.default.parse(e.body)}_verifyNotify(e){const t=this._getNotifyData(e);return!!this.checkNotifySign(t)&&(0,n.snake2camelJson)(t)}verifyPaymentNotify(e){return"payment"===this.checkNotifyType(e)&&this._verifyNotify(e)}verifyRefundNotify(e){return"refund"===this.checkNotifyType(e)&&this._verifyNotify(e)}checkNotifyType(e){return"refund_fee"in this._getNotifyData(e)?"refund":"payment"}}t.default=l,e.exports=t.default},function(e,t){e.exports=require("querystring")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(10),i=r(33),o=r(2),a=r(34),s=r(35),u=r(36),c=r(38),f=r(39),l=r(15),h=r(16),p=r(74),d=r(81);t.default=class{constructor(e){if(!e.appId)throw Error("config.appId is required");if(!e.privateKey)throw Error("config.privateKey is required");const t="PKCS8"===e.keyType?"PRIVATE KEY":"RSA PRIVATE KEY";e.privateKey=this.formatKey(e.privateKey,t),e.appCertPath||e.appCertContent?(e.appCertSn=i.empty(e.appCertContent)?p.getSNFromPath(e.appCertPath,!1):p.getSN(e.appCertContent,!1),e.alipayCertSn=i.empty(e.alipayPublicCertContent)?p.getSNFromPath(e.alipayPublicCertPath,!1):p.getSN(e.alipayPublicCertContent,!1),e.alipayRootCertSn=i.empty(e.alipayRootCertContent)?p.getSNFromPath(e.alipayRootCertPath,!0):p.getSN(e.alipayRootCertContent,!0),e.alipayPublicKey=i.empty(e.alipayPublicCertContent)?p.loadPublicKeyFromPath(e.alipayPublicCertPath):p.loadPublicKey(e.alipayPublicCertContent),e.alipayPublicKey=this.formatKey(e.alipayPublicKey,"PUBLIC KEY")):e.alipayPublicKey&&(e.alipayPublicKey=this.formatKey(e.alipayPublicKey,"PUBLIC KEY")),this.config=Object.assign({urllib:a,gateway:"https://openapi.alipay.com/gateway.do",timeout:5e3,camelcase:!0,signType:"RSA2",charset:"utf-8",version:"1.0"},f(e,{deep:!0})),this.sdkVersion="alipay-sdk-nodejs-"+d.version}formatKey(e,t){const r=e.split("\n").map(e=>e.trim());return r[0].includes(t)&&r.shift(),r[r.length-1].includes(t)&&r.pop(),`-----BEGIN ${t}-----\n${r.join("")}\n-----END ${t}-----`}formatUrl(e,t){let r=e;const n=["app_id","method","format","charset","sign_type","sign","timestamp","version","notify_url","return_url","auth_token","app_auth_token","app_cert_sn","alipay_root_cert_sn","ws_service_url"];for(const e in t)if(n.indexOf(e)>-1){const n=encodeURIComponent(t[e]);r=`${r}${r.includes("?")?"&":"?"}${e}=${n}`,delete t[e]}return{execParams:t,url:r}}multipartExec(e,t={}){const r=this.config;let o={},a={};const p=t.log&&i.fn(t.log.info)?t.log.info:null,d=t.log&&i.fn(t.log.error)?t.log.error:null;t.formData.getFields().forEach(e=>{o[e.name]=e.value,a[e.name]=e.value}),o=f(o,{deep:!0}),a=l(a),t.formData.getFiles().forEach(e=>{const t=c(e.fieldName);a[t]=u.isValid(e.path)?s(e.path):n.createReadStream(e.path)});const y=h.sign(e,o,r),{url:g}=this.formatUrl(r.gateway,y);return p&&p("[AlipaySdk]start exec url: %s, method: %s, params: %s",g,e,JSON.stringify(o)),new Promise((n,i)=>{s.post({url:g,formData:a,json:!1,timeout:r.timeout,headers:{"user-agent":this.sdkVersion}},(o,a,s)=>{if(o)return o.message="[AlipaySdk]exec error",d&&d(o),i(o);p&&p("[AlipaySdk]exec response: %s",s);try{let o,a;const u=JSON.parse(s);if(a=e.replace(/\./g,"_")+"_response",o=u[a],o){return!t.validateSign||this.checkResponseSign(s,a)?n(r.camelcase?f(o,{deep:!0}):o):i({serverResult:s,errorMessage:"[AlipaySdk]验签失败"})}}catch(e){return i({serverResult:s,errorMessage:"[AlipaySdk]Response 格式错误"})}return i({serverResult:s,errorMessage:"[AlipaySdk]HTTP 请求错误"})})})}pageExec(e,t={}){let r={alipaySdk:this.sdkVersion};const n=this.config,o=t.log&&i.fn(t.log.info)?t.log.info:null;t.formData.getFields().forEach(e=>{r[e.name]=e.value}),r=f(r,{deep:!0});const a=h.sign(e,r,n),{url:s,execParams:u}=this.formatUrl(n.gateway,a);return o&&o("[AlipaySdk]start exec url: %s, method: %s, params: %s",s,e,JSON.stringify(r)),"get"===t.formData.getMethod()?new Promise(e=>{const t=Object.keys(u).map(e=>`${e}=${encodeURIComponent(u[e])}`);e(`${s}&${t.join("&")}`)}):new Promise(e=>{const t="alipaySDKSubmit"+Date.now();e(`\n
\n ${Object.keys(u).map(e=>``).join("")}\n
\n