uni-ticket-system/node_modules/@dcloudio/uni-push/lib/gtpush-min.js

88 lines
186 KiB
JavaScript
Raw Normal View History

2023-12-05 02:11:10 +00:00
/*! For license information please see gtpush-min.js.LICENSE.txt */
(function t(e,r){if("object"===typeof exports&&"object"===typeof module)module.exports=r();else if("function"===typeof define&&define.amd)define([],r);else if("object"===typeof exports)exports["GtPush"]=r();else e["GtPush"]=r()})(self,(()=>(()=>{var t={4736:(t,e,r)=>{t=r.nmd(t);var i;var n=function(t){"use strict";var e=1e7,r=7,i=9007199254740992,s=d(i),a="0123456789abcdefghijklmnopqrstuvwxyz";var o="function"===typeof BigInt;function u(t,e,r,i){if("undefined"===typeof t)return u[0];if("undefined"!==typeof e)return 10===+e&&!r?st(t):X(t,e,r,i);return st(t)}function c(t,e){this.value=t;this.sign=e;this.isSmall=false}c.prototype=Object.create(u.prototype);function l(t){this.value=t;this.sign=t<0;this.isSmall=true}l.prototype=Object.create(u.prototype);function f(t){this.value=t}f.prototype=Object.create(u.prototype);function h(t){return-i<t&&t<i}function d(t){if(t<1e7)return[t];if(t<1e14)return[t%1e7,Math.floor(t/1e7)];return[t%1e7,Math.floor(t/1e7)%1e7,Math.floor(t/1e14)]}function v(t){p(t);var r=t.length;if(r<4&&N(t,s)<0)switch(r){case 0:return 0;case 1:return t[0];case 2:return t[0]+t[1]*e;default:return t[0]+(t[1]+t[2]*e)*e}return t}function p(t){var e=t.length;while(0===t[--e]);t.length=e+1}function g(t){var e=new Array(t);var r=-1;while(++r<t)e[r]=0;return e}function y(t){if(t>0)return Math.floor(t);return Math.ceil(t)}function m(t,r){var i=t.length,n=r.length,s=new Array(i),a=0,o=e,u,c;for(c=0;c<n;c++){u=t[c]+r[c]+a;a=u>=o?1:0;s[c]=u-a*o}while(c<i){u=t[c]+a;a=u===o?1:0;s[c++]=u-a*o}if(a>0)s.push(a);return s}function w(t,e){if(t.length>=e.length)return m(t,e);return m(e,t)}function S(t,r){var i=t.length,n=new Array(i),s=e,a,o;for(o=0;o<i;o++){a=t[o]-s+r;r=Math.floor(a/s);n[o]=a-r*s;r+=1}while(r>0){n[o++]=r%s;r=Math.floor(r/s)}return n}c.prototype.add=function(t){var e=st(t);if(this.sign!==e.sign)return this.subtract(e.negate());var r=this.value,i=e.value;if(e.isSmall)return new c(S(r,Math.abs(i)),this.sign);return new c(w(r,i),this.sign)};c.prototype.plus=c.prototype.add;l.prototype.add=function(t){var e=st(t);var r=this.value;if(r<0!==e.sign)return this.subtract(e.negate());var i=e.value;if(e.isSmall){if(h(r+i))return new l(r+i);i=d(Math.abs(i))}return new c(S(i,Math.abs(r)),r<0)};l.prototype.plus=l.prototype.add;f.prototype.add=function(t){return new f(this.value+st(t).value)};f.prototype.plus=f.prototype.add;function _(t,r){var i=t.length,n=r.length,s=new Array(i),a=0,o=e,u,c;for(u=0;u<n;u++){c=t[u]-a-r[u];if(c<0){c+=o;a=1}else a=0;s[u]=c}for(u=n;u<i;u++){c=t[u]-a;if(c<0)c+=o;else{s[u++]=c;break}s[u]=c}for(;u<i;u++)s[u]=t[u];p(s);return s}function b(t,e,r){var i;if(N(t,e)>=0)i=_(t,e);else{i=_(e,t);r=!r}i=v(i);if("number"===typeof i){if(r)i=-i;return new l(i)}return new c(i,r)}function E(t,r,i){var n=t.length,s=new Array(n),a=-r,o=e,u,f;for(u=0;u<n;u++){f=t[u]+a;a=Math.floor(f/o);f%=o;s[u]=f<0?f+o:f}s=v(s);if("number"===typeof s){if(i)s=-s;return new l(s)}return new c(s,i)}c.prototype.subtract=function(t){var e=st(t);if(this.sign!==e.sign)return this.add(e.negate());var r=this.value,i=e.value;if(e.isSmall)return E(r,Math.abs(i),this.sign);return b(r,i,this.sign)};c.prototype.minus=c.prototype.subtract;l.prototype.subtract=function(t){var e=st(t);var r=this.value;if(r<0!==e.sign)return this.add(e.negate());var i=e.value;if(e.isSmall)return new l(r-i);return E(i,Math.abs(r),r>=0)};l.prototype.minus=l.prototype.subtract;f.prototype.subtract=function(t){return new f(this.value-st(t).value)};f.prototype.minus=f.prototype.subtract;c.prototype.negate=function(){return new c(this.value,!this.sign)};l.prototype.negate=function(){var t=this.sign;var e=new l(-this.value);e.sign=!t;return e};f.prototype.negate=function(){return new f(-this.value)};c.prototype.abs=function(){return new c(this.value,false)};l.prototype.abs=function(){return new l(Math.abs(this.value))};f.prototype.abs=function(){return new f(this.value>=0?this.value:-this.value)};function D(t,r){var i=t.length,n=r.length,s=i+n,a=g(s),o=e,u,c,l,f,h;for(l=0;l<i;++l){f=t[l];for(var d=0;d<n;++d){h=r[d];u=f*h+a[l+d];c=Math.floor(u/o);a[l+d]=u-c*o;a[l+d+1]+=c}}p(a);r
// #ifdef APP-PLUS
t="APP-PLUS";
// #endif
// #ifdef APP-PLUS-NVUE
t="APP-PLUS-NVUE";
// #endif
// #ifdef APP-NVUE
t="APP-NVUE";
// #endif
// #ifdef H5
t="H5";
// #endif
// #ifdef MP-WEIXIN
t="MP-WEIXIN";
// #endif
// #ifdef MP-ALIPAY
t="MP-ALIPAY";
// #endif
// #ifdef MP-BAIDU
t="MP-BAIDU";
// #endif
// #ifdef MP-TOUTIAO
t="MP-TOUTIAO";
// #endif
// #ifdef MP-LARK
t="MP-LARK";
// #endif
// #ifdef MP-QQ
t="MP-QQ";
// #endif
// #ifdef MP-KUAISHOU
t="MP-KUAISHOU";
// #endif
// #ifdef MP-360
t="MP-360";
// #endif
// #ifdef QUICKAPP-WEBVIEW
t="QUICKAPP-WEBVIEW";
// #endif
// #ifdef QUICKAPP-WEBVIEW-UNION
t="QUICKAPP-WEBVIEW-UNION";
// #endif
return t}platformVersion(){return this.systemInfo?this.systemInfo.version:""}platformId(){return this.accountInfo?this.accountInfo.miniProgram.appId:""}language(){var t;return(null===(t=this.systemInfo)||void 0===t?void 0:t.language)?this.systemInfo.language:""}userAgent(){return window?window.navigator.userAgent:""}getNetworkType(t){uni.getNetworkType(t)}onNetworkStatusChange(t){uni.onNetworkStatusChange(t)}}e["default"]=s},3680:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:true});class r{set(t){uni.setStorage(t)}setSync(t,e){uni.setStorageSync(t,e)}get(t){uni.getStorage(t)}getSync(t){return uni.getStorageSync(t)}}e["default"]=r},7706:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:true});class r{connect(t){let e=uni.connectSocket(t);return{send:t=>{
// #ifdef MP-ALIPAY
uni.sendSocketMessage(t);
// #endif
// #ifndef MP-ALIPAY
null===e||void 0===e||e.send(t);
// #endif
},close:t=>{
// #ifdef MP-ALIPAY
uni.closeSocket(t);
// #endif
// #ifndef MP-ALIPAY
null===e||void 0===e||e.close(t);
// #endif
},onOpen:t=>{
// #ifdef MP-ALIPAY
uni.onSocketOpen(t);
// #endif
// #ifndef MP-ALIPAY
null===e||void 0===e||e.onOpen(t);
// #endif
},onError:t=>{
// #ifdef MP-ALIPAY
uni.onSocketError(t);
// #endif
// #ifndef MP-ALIPAY
null===e||void 0===e||e.onError(t);
// #endif
},onMessage:t=>{
// #ifdef MP-ALIPAY
uni.onSocketMessage(t);
// #endif
// #ifndef MP-ALIPAY
null===e||void 0===e||e.onMessage(t);
// #endif
},onClose:t=>{
// #ifdef MP-ALIPAY
uni.onSocketClose(t);
// #endif
// #ifndef MP-ALIPAY
null===e||void 0===e||e.onClose(t);
// #endif
}}}}e["default"]=r},4486:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:true});const n=i(r(3854));class s{constructor(){this.systemInfo=wx.getSystemInfoSync()}os(){return n.default.getStr(this.systemInfo,"platform")}osVersion(){return n.default.getStr(this.systemInfo,"system")}model(){return n.default.getStr(this.systemInfo,"model")}brand(){return n.default.getStr(this.systemInfo,"brand")}platform(){return"MP-WEIXIN"}platformVersion(){return n.default.getStr(this.systemInfo,"version")}language(){return n.default.getStr(this.systemInfo,"language")}platformId(){if(wx.canIUse("getAccountInfoSync"))return wx.getAccountInfoSync().miniProgram.appId;return""}getNetworkType(t){wx.getNetworkType({success:e=>{var r;null===(r=t.success)||void 0===r||r.call(t.success,{networkType:e.networkType})},fail:t.fail})}onNetworkStatusChange(t){wx.onNetworkStatusChange(t)}}e["default"]=s},5867:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:true});class r{set(t){wx.setStorage(t)}setSync(t,e){wx.setStorageSync(t,e)}get(t){wx.getStorage(t)}getSync(t){return wx.getStorageSync(t)}}e["default"]=r},7006:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:true});class r{connect(t){let e=wx.connectSocket({url:t.url,header:t.header,protocols:t.protocols,success:t.success,fail:t.fail,complete:t.complete});return{onOpen:e.onOpen,send:e.send,onMessage:e.onMessage,onError:e.onError,onClose:e.onClose,close:e.close}}}e["default"]=r},6893:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:true});var r;(function(t){t.SDK_VERSION="GTMP-2.0.4.dcloud";t.DEFAULT_SOCKET_URL="wss://wshzn.gepush.com:5223/nws";t.SOCKET_PROTOCOL_VERSION="1.0";t.SERVER_PUBLIC_KEY="MHwwDQYJKoZIhvcNAQEBBQADawAwaAJhAJp1rROuvBF7sBSnvLaesj2iFhMcY8aXyLvpnNLKs2wjL3JmEnyr++SlVa35liUlzi83tnAFkn3A9GB7pHBNzawyUkBh8WUhq5bnFIkk2RaDa6+5MpG84DEv52p7RR+aWwIDAQAB";t.SERVER_PUBLIC_KEY_ID="69d747c4b9f641baf4004be4297e9f3b";t.ID_U_2_G=true})(r||(r={}));e["default"]=r},7555:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:true});const n=i(r(7002));const s=i(r(529));const a=i(r(6379));class o{static init(t){var e;if(this.inited)return;try{this.checkAppid(t.appid);this.inited=true;s.default.info(`init: appid=${t.appid}`);a.default.init(t);n.default.connect()}catch(r){this.inited=false;null===(e=t.onError)||void 0===e||e.call(t.onError,{error:r});throw r}}static enableSocket(t){this.checkInit();n.default.enableSocket(t)}static checkInit(){if(!this.inited)throw new Error(`not init, please invoke init method firstly`)}static checkAppid(t){if(null==t||void 0==t||""==t.trim())throw new Error(`invalid appid ${t}`)}}o.inited=false;e["default"]=o},6379:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:true});const n=i(r(6667));const s=i(r(8506));const a=i(r(6893));const o=i(r(7002));const u=i(r(529));const c=i(r(4685));const l=i(r(2323));class f{static init(t){var e;if(a.default.ID_U_2_G)this.appid=l.default.to_getui(t.appid);else this.appid=t.appid;this.onError=t.onError;this.onClientId=t.onClientId;this.onlineState=t.onlineState;this.onPushMsg=t.onPushMsg;if(this.appid!=s.default.getSync(s.default.KEY_APPID,this.appid)){u.default.info("appid changed, clear session and cid");s.default.setSync(s.default.KEY_CID,"");s.default.setSync(s.default.KEY_SESSION,"")}s.default.setSync(s.default.KEY_APPID,this.appid);this.cid=s.default.getSync(s.default.KEY_CID,this.cid);if(this.cid)null===(e=this.onClientId)||void 0===e||e.call(this.onClientId,{cid:f.cid});this.session=s.default.getSync(s.default.KEY_SESSION,this.session);this.deviceId=s.default.getSync(s.default.KEY_DEVICE_ID,this.deviceId);this.regId=s.default.getSync(s.default.KEY_REGID,this.regId);if(!this.regId){this.regId=this.createRegId();s.default.set({key:s.default.KEY_REGID,data:this.regId})}this.sock
//# sourceMappingURL=gtpush.map