@pluve/wasm-sms
Version:
wasm sms sdk
2 lines (1 loc) • 13.3 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).__YF_WASM_SMS={})}(this,(function(t){"use strict";var e=function(){return e=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},e.apply(this,arguments)};function n(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}function r(t,e,n,r){return new(n||(n=Promise))((function(o,i){function s(t){try{c(r.next(t))}catch(t){i(t)}}function a(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((r=r.apply(t,e||[])).next())}))}function o(t,e){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return i.label++,{value:a[1],done:!1};case 5:i.label++,r=a[1],a=[0];continue;case 7:a=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){i=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(6===a[0]&&i.label<o[1]){i.label=o[1],o=a;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(a);break}o[2]&&i.ops.pop(),i.trys.pop();continue}a=e.call(t,i)}catch(t){a=[6,t],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function s(t,e,n){return t(n={path:e,exports:{},require:function(t,e){return a(null==e&&n.path)}},n.exports),n.exports}function a(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var c,u=(c=Object.freeze({__proto__:null,default:{}}))&&c.default||c,f=s((function(t,e){var n;t.exports=(n=n||function(t,e){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&&void 0!==i&&i.crypto&&(n=i.crypto),!n)try{n=u}catch(t){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),s={},a=s.lib={},c=a.Base={extend:function(t){var e=o(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},f=a.WordArray=c.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||p).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var s=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=s<<24-(r+i)%4*8}else for(var a=0;a<o;a+=4)e[r+a>>>2]=n[a>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(r());return new f.init(e,t)}}),l=s.enc={},p=l.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new f.init(n,e/2)}},h=l.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new f.init(n,e)}},d=l.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.parse(unescape(encodeURIComponent(t)))}},y=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new f.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,o=r.words,i=r.sigBytes,s=this.blockSize,a=i/(4*s),c=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*s,u=t.min(4*c,i);if(c){for(var l=0;l<c;l+=s)this._doProcessBlock(o,l);n=o.splice(0,c),r.sigBytes-=u}return new f.init(n,u)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});a.Hasher=y.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){y.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new v.HMAC.init(t,n).finalize(e)}}});var v=s.algo={};return s}(Math),n)})),l=s((function(t,e){var n;t.exports=(n=f,function(t){var e=n,r=e.lib,o=r.WordArray,i=r.Hasher,s=e.algo,a=[];!function(){for(var e=0;e<64;e++)a[e]=4294967296*t.abs(t.sin(e+1))|0}();var c=s.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var r=e+n,o=t[r];t[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,s=t[e+0],c=t[e+1],h=t[e+2],d=t[e+3],y=t[e+4],v=t[e+5],w=t[e+6],m=t[e+7],g=t[e+8],b=t[e+9],_=t[e+10],B=t[e+11],x=t[e+12],C=t[e+13],S=t[e+14],A=t[e+15],D=i[0],E=i[1],F=i[2],O=i[3];D=u(D,E,F,O,s,7,a[0]),O=u(O,D,E,F,c,12,a[1]),F=u(F,O,D,E,h,17,a[2]),E=u(E,F,O,D,d,22,a[3]),D=u(D,E,F,O,y,7,a[4]),O=u(O,D,E,F,v,12,a[5]),F=u(F,O,D,E,w,17,a[6]),E=u(E,F,O,D,m,22,a[7]),D=u(D,E,F,O,g,7,a[8]),O=u(O,D,E,F,b,12,a[9]),F=u(F,O,D,E,_,17,a[10]),E=u(E,F,O,D,B,22,a[11]),D=u(D,E,F,O,x,7,a[12]),O=u(O,D,E,F,C,12,a[13]),F=u(F,O,D,E,S,17,a[14]),D=f(D,E=u(E,F,O,D,A,22,a[15]),F,O,c,5,a[16]),O=f(O,D,E,F,w,9,a[17]),F=f(F,O,D,E,B,14,a[18]),E=f(E,F,O,D,s,20,a[19]),D=f(D,E,F,O,v,5,a[20]),O=f(O,D,E,F,_,9,a[21]),F=f(F,O,D,E,A,14,a[22]),E=f(E,F,O,D,y,20,a[23]),D=f(D,E,F,O,b,5,a[24]),O=f(O,D,E,F,S,9,a[25]),F=f(F,O,D,E,d,14,a[26]),E=f(E,F,O,D,g,20,a[27]),D=f(D,E,F,O,C,5,a[28]),O=f(O,D,E,F,h,9,a[29]),F=f(F,O,D,E,m,14,a[30]),D=l(D,E=f(E,F,O,D,x,20,a[31]),F,O,v,4,a[32]),O=l(O,D,E,F,g,11,a[33]),F=l(F,O,D,E,B,16,a[34]),E=l(E,F,O,D,S,23,a[35]),D=l(D,E,F,O,c,4,a[36]),O=l(O,D,E,F,y,11,a[37]),F=l(F,O,D,E,m,16,a[38]),E=l(E,F,O,D,_,23,a[39]),D=l(D,E,F,O,C,4,a[40]),O=l(O,D,E,F,s,11,a[41]),F=l(F,O,D,E,d,16,a[42]),E=l(E,F,O,D,w,23,a[43]),D=l(D,E,F,O,b,4,a[44]),O=l(O,D,E,F,x,11,a[45]),F=l(F,O,D,E,A,16,a[46]),D=p(D,E=l(E,F,O,D,h,23,a[47]),F,O,s,6,a[48]),O=p(O,D,E,F,m,10,a[49]),F=p(F,O,D,E,S,15,a[50]),E=p(E,F,O,D,v,21,a[51]),D=p(D,E,F,O,x,6,a[52]),O=p(O,D,E,F,d,10,a[53]),F=p(F,O,D,E,_,15,a[54]),E=p(E,F,O,D,c,21,a[55]),D=p(D,E,F,O,g,6,a[56]),O=p(O,D,E,F,A,10,a[57]),F=p(F,O,D,E,w,15,a[58]),E=p(E,F,O,D,C,21,a[59]),D=p(D,E,F,O,y,6,a[60]),O=p(O,D,E,F,B,10,a[61]),F=p(F,O,D,E,h,15,a[62]),E=p(E,F,O,D,b,21,a[63]),i[0]=i[0]+D|0,i[1]=i[1]+E|0,i[2]=i[2]+F|0,i[3]=i[3]+O|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;n[o>>>5]|=128<<24-o%32;var i=t.floor(r/4294967296),s=r;n[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),n[14+(o+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var f=c[u];c[u]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8)}return a},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function u(t,e,n,r,o,i,s){var a=t+(e&n|~e&r)+o+s;return(a<<i|a>>>32-i)+e}function f(t,e,n,r,o,i,s){var a=t+(e&r|n&~r)+o+s;return(a<<i|a>>>32-i)+e}function l(t,e,n,r,o,i,s){var a=t+(e^n^r)+o+s;return(a<<i|a>>>32-i)+e}function p(t,e,n,r,o,i,s){var a=t+(n^(e|~r))+o+s;return(a<<i|a>>>32-i)+e}e.MD5=i._createHelper(c),e.HmacMD5=i._createHmacHelper(c)}(Math),n.MD5)}));function p(){var t=["8D5A3A42EF19C3BEB2F81031ACFCF641A29C1F09","7E25E91F05C071E20FDC92FBF9F9882B188767EA","source","10AebToR","wasmExecUrl","1292540iGDWYJ","4517117QbMrYh","mobile","6613998xgrboU","env","153Kxxdgp","02FE8F589135C49B8933EFD1A41709C783AFBC6C","async","call","join","https://static.pharmacyyf.com/share","获取短信验证码失败","test","run","/wasm/wasm_exec.min.js","message","slice","sent","/wasm/sms.v1.wasm","src","POST","arrayBuffer","23300772wGXgpc","success","importObject","7CfCsgX","label","__YF_WASM_SMS_GET_SIGN","SCRM_D","toString","stringify","C2FF02C67AEAF1D7C6AD9675607B708CA2EB6AF8","9NoicKH","then","8D5B3DBD748BB3AAB967C1079CE1540D14A87A1F","118368MqFsRZ","script","catch","1661752irSHNb","appendChild","DJYY","onload","https://scrm-m.yifengx.com/scrm-open","SCRM_JZT_D","wasmUrl","4009935xObmaz","concat","instance","2hDWocM","json","/api/MessageService/sendCusSmsCode"];return(p=function(){return t})()}function h(t,e){var n=p();return(h=function(t,e){return n[t-=107]})(t,e)}!function(t){for(var e=h,n=t();;)try{if(887551===parseInt(e(113))/1*(-parseInt(e(123))/2)+parseInt(e(107))/3*(parseInt(e(131))/4)+-parseInt(e(120))/5+-parseInt(e(134))/6*(-parseInt(e(156))/7)+parseInt(e(110))/8*(-parseInt(e(136))/9)+-parseInt(e(129))/10*(parseInt(e(132))/11)+parseInt(e(153))/12)break;n.push(n.shift())}catch(t){n.push(n.shift())}}(p);var d=function(t){var e=h;return t===e(143)?"https://yf-test-oss.yifengx.com/share":e(141)},y=function(t){var r,o,i=h,s=t[i(135)],a=n(t,[i(135)]);return fetch(""[i(121)]((r=s,o=h,r===o(143)?"https://scrm-m-te.pharmacyyf.com/scrm-open":o(117)),i(125)),{method:i(151),body:JSON[i(161)]({smsQuery:e({},a)})}).then((function(t){var e=i;return t[e(124)]()[e(108)]((function(t){var n,r=e;return 0===(null==t?void 0:t.code)?{code:0,message:r(154)}:{code:500,message:null!==(n=null==t?void 0:t[r(146)])&&void 0!==n?n:r(142)}}))}))[i(112)]((function(){return{code:500,message:i(142)}}))},v=function(t){var r,o,i=h,s=t[i(135)],a=n(t,[i(135)]),c=null===(o=(r=window)[i(158)])||void 0===o?void 0:o[i(139)](r,e(e({},a),{env:s}));return y(e(e({env:s},a),c))},w=function(t){var e=h,n=function(t){var e=h,n=t[e(135)],r=t[e(128)];if("test"===n)switch(r){case e(159):return e(126);case e(118):return e(137);case e(115):return e(127);default:return""}else switch(r){case e(159):return e(109);case"SCRM_JZT_D":return"031800A8A8072E8AAB39D30D7678A259EB04AB1C";case e(115):return e(162);default:return""}}({source:t[e(128)],env:t[e(135)]}),r=t.mobile[e(147)](0,3),o=t[e(133)][e(147)](-8),i=+new Date;return{sign:l([r,n,i,o][e(140)](""))[e(160)](),timestamp:i}};t.sendSmsCode=function(t){return r(void 0,void 0,void 0,(function(){var r,i,s,a,c,u=h,f=t[u(135)],l=t[u(119)],p=t[u(130)],m=n(t,[u(135),u(119),u(130)]);return o(this,(function(t){var n,o=u;switch(t.label){case 0:if(window[o(158)])return[2,v(e({env:f},m))];t[o(157)]=1;case 1:return t.trys.push([1,7,,8]),window.Go?[3,3]:[4,(n=p||"".concat(d(f),o(145)),new Promise((function(t){var e=h,r=document.createElement(e(111));r[e(150)]=n,r[e(138)]=!0,r[e(116)]=function(){t(!0)},r.onerror=function(){t(!1)},document.head[e(114)](r)})))];case 2:if(!t[o(148)]())throw new Error("load wasm_exec fail");t[o(157)]=3;case 3:return r=new window.Go,[4,fetch(l||"".concat(d(f),o(149)))];case 4:return[4,t[o(148)]()[o(152)]()];case 5:return i=t[o(148)](),[4,WebAssembly.instantiate(i,r[o(155)])];case 6:return s=t[o(148)](),r[o(144)](s[o(122)]),[2,v(e({env:f},m))];case 7:return t[o(148)](),a=m[o(128)]===o(115)?m[o(128)]:[m.source,"D"][o(140)]("_"),c=w(e(e({env:f},m),{source:a})),[2,y(e(e(e({env:f},m),c),{source:a}))];case 8:return[2]}}))}))},Object.defineProperty(t,"__esModule",{value:!0})}));