Socket
Socket
Sign inDemoInstall

@ray-js/wechat-helper

Package Overview
Dependencies
0
Maintainers
1
Versions
138
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.19 to 0.0.20-beta-1

2

index.esm.js

@@ -1,1 +0,1 @@

function e(e,t){return wx[e]?t?t=>new Promise(((n,r)=>{const{success:o,fail:a}=t||{};wx[e](Object.assign(Object.assign({},t),{success:e=>{o&&o(e),n(e)},fail:e=>{a&&a(e),r(e)}}))})):wx[e]:()=>{console.warn(`The Api ${e} is not found`)}}const t=e("getFileSystemManager"),n=e("downloadFile",!0),r=e("getFileInfo",!0),o=e("getSystemInfoSync"),a=e("getAccountInfoSync"),i=e("getAppAuthorizeSetting"),c=e("authorizeForMiniProgram",!0),s=e("authorize",!0),u=e("onBLEConnectionStateChange"),l=e("offBLEConnectionStateChange"),f=e("onBluetoothAdapterStateChange"),h=e("notifyBLECharacteristicValueChange",!0),g=e("readBLECharacteristicValue",!0),p=e("getBLEMTU",!0),d=e("setBLEMTU",!0),S=e("getBluetoothAdapterState",!0),C=e("onBluetoothDeviceFound"),w=e("offBluetoothDeviceFound"),y=e("getBluetoothDevices",!0),A=e("onBLECharacteristicValueChange"),B=e("offBLECharacteristicValueChange"),m=e("writeBLECharacteristicValue",!0),I=e("createBLEPeripheralServer",!0),U=e("openBluetoothAdapter",!0),E=e("closeBluetoothAdapter",!0),b=e("connectSocket"),L=e("login",!0),v=e("getUserInfo",!0),M=e("createUDPSocket"),T=e("scanCode",!0),F=e("getSetting",!0),V=e("getLocalIPAddress",!0),j=e("startWifi",!0),D=e("stopWifi",!0),P=e("getConnectedWifi",!0),k=e("request",!0),x=e("setStorageSync"),z=e("getStorageSync"),W=e("removeStorageSync"),_=e("onAppHide"),O=e("offAppHide"),H=e("onAppShow"),$=e("offAppShow"),q=e("navigateToMiniProgram",!0),R=e("navigateTo",!0),K=e("redirectTo",!0),N=e("navigateBack",!0),G=e("reLaunch",!0);var J=Object.freeze({__proto__:null,hasBaseApi:e=>!!wx[e],getFileSystemManager:t,downloadFile:n,getFileInfo:r,getSystemInfoSync:o,getAccountInfoSync:a,getAppAuthorizeSetting:i,authorizeForMiniProgram:c,authorize:s,onBLEConnectionStateChange:u,offBLEConnectionStateChange:l,onBluetoothAdapterStateChange:f,notifyBLECharacteristicValueChange:h,readBLECharacteristicValue:g,getBLEMTU:p,setBLEMTU:d,getBluetoothAdapterState:S,onBluetoothDeviceFound:C,offBluetoothDeviceFound:w,getBluetoothDevices:y,onBLECharacteristicValueChange:A,offBLECharacteristicValueChange:B,writeBLECharacteristicValue:m,createBLEPeripheralServer:I,openBluetoothAdapter:U,closeBluetoothAdapter:E,connectSocket:b,login:L,getUserInfo:v,createUDPSocket:M,scanCode:T,getSetting:F,getLocalIPAddress:V,startWifi:j,stopWifi:D,getConnectedWifi:P,request:k,setStorageSync:x,getStorageSync:z,removeStorageSync:W,onAppHide:_,offAppHide:O,onAppShow:H,offAppShow:$,navigateToMiniProgram:q,navigateTo:R,redirectTo:K,navigateBack:N,reLaunch:G});function Q(e,t=2){let n=e;return"string"==typeof e&&(n=parseInt(e)),n.toString(16).padStart(t,"0")}function X(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(Q(e))})),t}function Y(e){return parseInt(e,16)}function Z(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2){const r=parseInt(e.slice(n,n+2),16);t.push(String.fromCharCode(r))}else for(let n=0;n<e.length;n++){const r=parseInt(e[n],16);t.push(String.fromCharCode(r))}return t.join("")}function ee(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2)t.push(parseInt(e.slice(n,n+2),16));else if("string"==typeof e[0])for(let n=0;n<e.length;n++)t.push(parseInt(e[n],16));return new Uint8Array(t)}function te(e){const t=255&e;let n=0;return t>=128?(n=t%128,n=-1*(128-n)):n=t,n}function ne(e){const t=te(255&e);return[te(e>>8&255),t]}function re(e,t=!1){const n=e.length,r=new Uint8Array(t?4*n:n);let o=0;for(let a=0;a<n;a++){let i=e.charCodeAt(a);if(t&&55296<=i&&i<=56319){if(++a>=n)throw new Error("Malformed string, low surrogate expected at position "+a);i=(55296^i)<<10|65536|56320^e.charCodeAt(a)}else if(!t&&i>>>8)throw new Error("Wide characters are not allowed.");!t||i<=127?r[o++]=i:i<=2047?(r[o++]=192|i>>6,r[o++]=128|63&i):i<=65535?(r[o++]=224|i>>12,r[o++]=128|i>>6&63,r[o++]=128|63&i):(r[o++]=240|i>>18,r[o++]=128|i>>12&63,r[o++]=128|i>>6&63,r[o++]=128|63&i)}return r.subarray(0,o)}function oe(e){return re(e,!0)}function ae(e,t=!1){const n=e.length,r=new Array(n);let o=0;for(let a=0;a<n;a++){const i=e[a];if(!t||i<128)r[o++]=i;else if(i>=192&&i<224&&a+1<n)r[o++]=(31&i)<<6|63&e[++a];else if(i>=224&&i<240&&a+2<n)r[o++]=(15&i)<<12|(63&e[++a])<<6|63&e[++a];else{if(!(i>=240&&i<248&&a+3<n))throw new Error("Malformed UTF8 character at byte offset "+a);{let t=(7&i)<<18|(63&e[++a])<<12|(63&e[++a])<<6|63&e[++a];t<=65535?r[o++]=t:(t^=65536,r[o++]=55296|t>>10,r[o++]=56320|1023&t)}}}let a="";const i=16384;for(let e=0;e<o;e+=i)a+=String.fromCharCode(...r.slice(e,e+i<=o?e+i:o));return a}const ie=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((n,r)=>{const o=e[r];return void 0!==o&&n.push(`${r}=${t?encodeURIComponent(o):o}`),n}),[]).join("&")},ce=e=>{const t=o().SDKVersion;return se(e,t)},se=(e,t,n=!0)=>{const r=e.split("."),o=t.split("."),a=Math.max(o.length,r.length);for(;o.length<a;)o.splice(0,0,"0");for(;r.length<a;)r.splice(0,0,"0");for(let e=0;e<a;e++){const t=parseInt(r[e]),n=parseInt(o[e]);if(t>n)return!0;if(t===n)break;return!1}return n},ue=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));function le(e){return"object"!=typeof e?e:Array.isArray(e)?e.map((e=>le(e))):Object.keys(e).reduce(((t,n)=>{const r=n.split("_").map(((e,t)=>t>0?ue(e):e)).join("");let o=e[n];return Array.isArray(o)?o=o.map((e=>le(e))):"object"==typeof o&&(o=le(o)),t[r]=o,t}),{})}const fe=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?t>>>1^3988292384:t>>>1;fe[e]=t}function he(e){let t=-1;for(let n=0,r=e.length;n<r;n++)t=t>>>8^fe[255&(t^e[n])];return-1^t}function ge(e){let t=65535;let n,r;for(n=0;n<e.length;n++)for(t^=255&e[n],r=0;r<8;r++)0!=(1&t)?(t>>=1,t^=40961):t>>=1;return t}const pe={initial_value:0,table:function(e){const t=[];for(let n=0;n<256;++n){let r=n;for(let t=0;t<8;++t)r=0!=(128&r)?(r<<1^e)%256:(r<<1)%256;t[n]=r}return t}(7)},de=e=>{let t=pe.initial_value;for(let n=0;n<e.length;n++)t=pe.table[(t^e[n])%256];return t};function Se(e,t){return!!((e&Math.pow(2,t))>>t)}function Ce(e){if(e.length>6)throw new Error("The number of bytes exceeds 6");const t=new DataView(e.buffer);switch(e.length){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:{let t=we(e);const n=Math.pow(2,8*e.length)/2;return t>=n&&(t%=n,t=-1*(n-t)),t}}}function we(e){const t=new DataView(e.buffer);switch(e.length){case 1:return t.getUint8(0);case 2:return t.getUint16(0);case 3:return e.reduce(((e,t)=>e<<8|t),0);case 4:return t.getUint32(0);default:return parseInt(Ae(e),16)}}function ye(e){return e.reduceRight(((e,t)=>{const n=t.toString(2).padStart(8,"0").split("").map((e=>Number(e))).reverse();return e.concat(n)}),[])}function Ae(e){return e.length<=4?we(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase()}function Be(e){return e.length%2!=0?(console.error("Illegal Format UTF16 Code!"),""):e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")}function me(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];r<128?(t.push(String.fromCharCode(r)),n++):r>191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[n+1])),n+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[n+1])<<6|63&e[n+2])),n+=3)}return t.join("")}function Ie(e){const t=[],n=e.length;for(let r=0;r<n;r++){const n=e.charCodeAt(r);n>=65536&&n<=1114111?(t.push(n>>18&7|240),t.push(n>>12&63|128),t.push(n>>6&63|128),t.push(63&n|128)):n>=2048&&n<=65535?(t.push(n>>12&15|224),t.push(n>>6&63|128),t.push(63&n|128)):n>=128&&n<=2047?(t.push(n>>6&31|192),t.push(63&n|128)):t.push(255&n)}return new Uint8Array(t)}function Ue(e){const t=[],n=e.length;for(let r=0;r<n;r++){const n=e[r].toString(2),o=n.match(/^1+?(?=0)/);if(o&&8==n.length){const a=o[0].length;let i=n.slice(7-a);for(let t=1;t<a;t++)i+=e[t+r].toString(2).slice(2);t.push(String.fromCharCode(parseInt(i,2))),r+=a-1}else t.push(String.fromCharCode(e[r]))}return t.join("")}const Ee=e=>{const t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=Math.floor(256*Math.random());return t},be=e=>{const t=[];do{let n=e%128;(e=parseInt(""+e/128))>0&&(n|=128),t.push(n)}while(e>0);return new Uint8Array(t)},Le=(e,t=0)=>{let n=0,r=t;for(;r<4&&r<e.length;r++){const o=e[r];if(n|=(127&o)<<7*(r-t),0==(o>>7&1))break}return{num:n,end:r-t<4?r+1:r}},ve=(e,t)=>{const n=new Uint32Array([e]),r=new Uint8Array(n.buffer);return r.reverse(),t?r.slice(4-t):r},Me=(e,t)=>{const n=new Int32Array([e]),r=new Int8Array(n.buffer);return r.reverse(),t?new Uint8Array(r.slice(4-t)):new Uint8Array(r)},Te=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=parseInt(e.slice(2*r,2*r+2),16);return n},Fe=e=>{const t=new DataView(e.buffer),n=[];for(let r=0;r<e.length;r+=4)n.push(t.getInt32(r));return n},Ve=e=>{const t=new Uint8Array(4*e.length),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setInt32(4*t,e[t]);return t};const je={encrypt:function(e,t){const n=Fe(e),r=Fe(t),o=n.length-1;let a,i,c=n[o],s=n[0],u=Math.floor(6+52/(o+1)),l=0;for(;u-- >0;){l=l+2654435769&4294967295,i=l>>>2&3;let e=0;for(;e<o;e++)s=n[e+1],a=(c>>>5^s<<2)+(s>>>3^c<<4)^(l^s)+(r[3&e^i]^c),c=n[e]=n[e]+a&4294967295;s=n[0],a=(c>>>5^s<<2)+(s>>>3^c<<4)^(l^s)+(r[3&e^i]^c),c=n[o]=n[o]+a&4294967295}return Ve(n)},decrypt:function(e,t){const n=Fe(e),r=Fe(t),o=n.length-1;let a=n[o-1],i=n[0];const c=2654435769;let s,u,l=Math.floor(6+52/(o+1))*c&4294967295;for(;0!==l;){u=l>>>2&3;let e=o;for(;e>0;e--)a=n[e-1],s=(a>>>5^i<<2)+(i>>>3^a<<4)^(l^i)+(r[3&e^u]^a),i=n[e]=n[e]-s&4294967295;a=n[o],s=(a>>>5^i<<2)+(i>>>3^a<<4)^(l^i)+(r[3&e^u]^a),i=n[0]=n[0]-s&4294967295,l=l-c&4294967295}return Ve(n)}},De={},Pe=()=>"undefined"!=typeof globalThis?globalThis:De;function ke(e,t){const n=Pe();return n[e]?n[e][t]:null}function xe(e){const t=Pe();return t[e]?t[e]:null}function ze(e,t,n){const r=Pe();r[e]||(r[e]={}),r[e][t]=n}function We(e){const t=Pe();t[e]&&(t[e]={})}export{J as BaseApi,ge as CRC16,he as CRC32,de as CRC8,X as ab2hex,Se as bitToBoolean,ae as bytes2string,ye as bytesToBits,Be as bytesToCharts,Ae as bytesToHex,Ce as bytesToInt,Le as bytesToIntBy128,Ue as bytesToString,we as bytesToUint,me as bytesToUtf8,se as checkVersion,ce as checkWxVersion,We as clearCache,Q as dec2hex,ue as firstUpperCase,ie as formatQuery,ke as getCache,xe as getCacheSpace,ee as hex2ab,Y as hex2dec,Z as hex2string,Te as hexToBytes,ne as int2TwoBytes,te as intToByte,Me as intToBytes,le as keyToHump,Ee as randomBytes,ze as setCache,re as string2bytes,Ie as stringToBytes,ve as uintToBytes,be as uintToBytesBy128,oe as utf8ToBytes,je as xxtea};
function e(e,t){const n=wx||(my||{});return n[e]?t?t=>new Promise(((r,o)=>{const{success:a,fail:i}=t||{};n[e](Object.assign(Object.assign({},t),{success:e=>{a&&a(e),r(e)},fail:e=>{i&&i(e),o(e)}}))})):n[e]:()=>{console.warn(`The Api ${e} is not found`)}}const t=e("getFileSystemManager"),n=e("downloadFile",!0),r=e("getFileInfo",!0),o=e("getSystemInfoSync"),a=e("getAccountInfoSync"),i=e("getAppAuthorizeSetting"),c=e("authorizeForMiniProgram",!0),s=e("authorize",!0),u=e("onBLEConnectionStateChange"),l=e("offBLEConnectionStateChange"),f=e("onBluetoothAdapterStateChange"),h=e("notifyBLECharacteristicValueChange",!0),g=e("readBLECharacteristicValue",!0),p=e("getBLEMTU",!0),d=e("setBLEMTU",!0),S=e("getBluetoothAdapterState",!0),w=e("onBluetoothDeviceFound"),C=e("offBluetoothDeviceFound"),y=e("getBluetoothDevices",!0),A=e("onBLECharacteristicValueChange"),B=e("offBLECharacteristicValueChange"),m=e("writeBLECharacteristicValue",!0),I=e("createBLEPeripheralServer",!0),U=e("openBluetoothAdapter",!0),v=e("closeBluetoothAdapter",!0),E=e("connectSocket"),b=e("login",!0),L=e("getUserInfo",!0),M=e("createUDPSocket"),T=e("scanCode",!0),F=e("getSetting",!0),V=e("getLocalIPAddress",!0),j=e("startWifi",!0),D=e("stopWifi",!0),x=e("getConnectedWifi",!0),P=e("request",!0),k=e("onAppHide"),z=e("offAppHide"),W=e("onAppShow"),_=e("offAppShow"),O=e("navigateToMiniProgram",!0),H=e("navigateTo",!0),$=e("redirectTo",!0),q=e("navigateBack",!0),R=e("reLaunch",!0),K=wx.setStorageSync,N=wx.getStorageSync,G=wx.removeStorageSync,J=e("showToast",!1),Q=wx.env;var X=Object.freeze({__proto__:null,hasBaseApi:e=>!!wx[e],getFileSystemManager:t,downloadFile:n,getFileInfo:r,getSystemInfoSync:o,getAccountInfoSync:a,getAppAuthorizeSetting:i,authorizeForMiniProgram:c,authorize:s,onBLEConnectionStateChange:u,offBLEConnectionStateChange:l,onBluetoothAdapterStateChange:f,notifyBLECharacteristicValueChange:h,readBLECharacteristicValue:g,getBLEMTU:p,setBLEMTU:d,getBluetoothAdapterState:S,onBluetoothDeviceFound:w,offBluetoothDeviceFound:C,getBluetoothDevices:y,onBLECharacteristicValueChange:A,offBLECharacteristicValueChange:B,writeBLECharacteristicValue:m,createBLEPeripheralServer:I,openBluetoothAdapter:U,closeBluetoothAdapter:v,connectSocket:E,login:b,getUserInfo:L,createUDPSocket:M,scanCode:T,getSetting:F,getLocalIPAddress:V,startWifi:j,stopWifi:D,getConnectedWifi:x,request:P,onAppHide:k,offAppHide:z,onAppShow:W,offAppShow:_,navigateToMiniProgram:O,navigateTo:H,redirectTo:$,navigateBack:q,reLaunch:R,setStorageSync:K,getStorageSync:N,removeStorageSync:G,showToast:J,env:Q});function Y(e,t=2){let n=e;return"string"==typeof e&&(n=parseInt(e)),n.toString(16).padStart(t,"0")}function Z(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(Y(e))})),t}function ee(e){return parseInt(e,16)}function te(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2){const r=parseInt(e.slice(n,n+2),16);t.push(String.fromCharCode(r))}else for(let n=0;n<e.length;n++){const r=parseInt(e[n],16);t.push(String.fromCharCode(r))}return t.join("")}function ne(e){const t=[];if("string"==typeof e)for(let n=0;n<e.length;n+=2)t.push(parseInt(e.slice(n,n+2),16));else if("string"==typeof e[0])for(let n=0;n<e.length;n++)t.push(parseInt(e[n],16));return new Uint8Array(t)}function re(e){const t=255&e;let n=0;return t>=128?(n=t%128,n=-1*(128-n)):n=t,n}function oe(e){const t=re(255&e);return[re(e>>8&255),t]}function ae(e,t=!1){const n=e.length,r=new Uint8Array(t?4*n:n);let o=0;for(let a=0;a<n;a++){let i=e.charCodeAt(a);if(t&&55296<=i&&i<=56319){if(++a>=n)throw new Error("Malformed string, low surrogate expected at position "+a);i=(55296^i)<<10|65536|56320^e.charCodeAt(a)}else if(!t&&i>>>8)throw new Error("Wide characters are not allowed.");!t||i<=127?r[o++]=i:i<=2047?(r[o++]=192|i>>6,r[o++]=128|63&i):i<=65535?(r[o++]=224|i>>12,r[o++]=128|i>>6&63,r[o++]=128|63&i):(r[o++]=240|i>>18,r[o++]=128|i>>12&63,r[o++]=128|i>>6&63,r[o++]=128|63&i)}return r.subarray(0,o)}function ie(e){return ae(e,!0)}function ce(e,t=!1){const n=e.length,r=new Array(n);let o=0;for(let a=0;a<n;a++){const i=e[a];if(!t||i<128)r[o++]=i;else if(i>=192&&i<224&&a+1<n)r[o++]=(31&i)<<6|63&e[++a];else if(i>=224&&i<240&&a+2<n)r[o++]=(15&i)<<12|(63&e[++a])<<6|63&e[++a];else{if(!(i>=240&&i<248&&a+3<n))throw new Error("Malformed UTF8 character at byte offset "+a);{let t=(7&i)<<18|(63&e[++a])<<12|(63&e[++a])<<6|63&e[++a];t<=65535?r[o++]=t:(t^=65536,r[o++]=55296|t>>10,r[o++]=56320|1023&t)}}}let a="";const i=16384;for(let e=0;e<o;e+=i)a+=String.fromCharCode(...r.slice(e,e+i<=o?e+i:o));return a}const se=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((n,r)=>{const o=e[r];return void 0!==o&&n.push(`${r}=${t?encodeURIComponent(o):o}`),n}),[]).join("&")},ue=e=>{const t=o().SDKVersion;return le(e,t)},le=(e,t,n=!0)=>{const r=e.split("."),o=t.split("."),a=Math.max(o.length,r.length);for(;o.length<a;)o.splice(0,0,"0");for(;r.length<a;)r.splice(0,0,"0");for(let e=0;e<a;e++){const t=parseInt(r[e]),n=parseInt(o[e]);if(t>n)return!0;if(t===n)break;return!1}return n},fe=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));function he(e){return"object"!=typeof e?e:Array.isArray(e)?e.map((e=>he(e))):Object.keys(e).reduce(((t,n)=>{const r=n.split("_").map(((e,t)=>t>0?fe(e):e)).join("");let o=e[n];return Array.isArray(o)?o=o.map((e=>he(e))):"object"==typeof o&&(o=he(o)),t[r]=o,t}),{})}const ge=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?t>>>1^3988292384:t>>>1;ge[e]=t}function pe(e){let t=-1;for(let n=0,r=e.length;n<r;n++)t=t>>>8^ge[255&(t^e[n])];return-1^t}function de(e){let t=65535;let n,r;for(n=0;n<e.length;n++)for(t^=255&e[n],r=0;r<8;r++)0!=(1&t)?(t>>=1,t^=40961):t>>=1;return t}const Se={initial_value:0,table:function(e){const t=[];for(let n=0;n<256;++n){let r=n;for(let t=0;t<8;++t)r=0!=(128&r)?(r<<1^e)%256:(r<<1)%256;t[n]=r}return t}(7)},we=e=>{let t=Se.initial_value;for(let n=0;n<e.length;n++)t=Se.table[(t^e[n])%256];return t};function Ce(e,t){return!!((e&Math.pow(2,t))>>t)}function ye(e){if(e.length>6)throw new Error("The number of bytes exceeds 6");const t=new DataView(e.buffer);switch(e.length){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:{let t=Ae(e);const n=Math.pow(2,8*e.length)/2;return t>=n&&(t%=n,t=-1*(n-t)),t}}}function Ae(e){const t=new DataView(e.buffer);switch(e.length){case 1:return t.getUint8(0);case 2:return t.getUint16(0);case 3:return e.reduce(((e,t)=>e<<8|t),0);case 4:return t.getUint32(0);default:return parseInt(me(e),16)}}function Be(e){return e.reduceRight(((e,t)=>{const n=t.toString(2).padStart(8,"0").split("").map((e=>Number(e))).reverse();return e.concat(n)}),[])}function me(e){return e.length<=4?Ae(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase()}function Ie(e){return e.length%2!=0?(console.error("Illegal Format UTF16 Code!"),""):e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")}function Ue(e){const t=[];let n=0;for(;n<e.length;){const r=e[n];r<128?(t.push(String.fromCharCode(r)),n++):r>191&&r<224?(t.push(String.fromCharCode((31&r)<<6|63&e[n+1])),n+=2):(t.push(String.fromCharCode((15&r)<<12|(63&e[n+1])<<6|63&e[n+2])),n+=3)}return t.join("")}function ve(e){const t=[],n=e.length;for(let r=0;r<n;r++){const n=e.charCodeAt(r);n>=65536&&n<=1114111?(t.push(n>>18&7|240),t.push(n>>12&63|128),t.push(n>>6&63|128),t.push(63&n|128)):n>=2048&&n<=65535?(t.push(n>>12&15|224),t.push(n>>6&63|128),t.push(63&n|128)):n>=128&&n<=2047?(t.push(n>>6&31|192),t.push(63&n|128)):t.push(255&n)}return new Uint8Array(t)}function Ee(e){const t=[],n=e.length;for(let r=0;r<n;r++){const n=e[r].toString(2),o=n.match(/^1+?(?=0)/);if(o&&8==n.length){const a=o[0].length;let i=n.slice(7-a);for(let t=1;t<a;t++)i+=e[t+r].toString(2).slice(2);t.push(String.fromCharCode(parseInt(i,2))),r+=a-1}else t.push(String.fromCharCode(e[r]))}return t.join("")}const be=e=>{const t=new Uint8Array(e);for(let n=0;n<e;n++)t[n]=Math.floor(256*Math.random());return t},Le=e=>{const t=[];do{let n=e%128;(e=parseInt(""+e/128))>0&&(n|=128),t.push(n)}while(e>0);return new Uint8Array(t)},Me=(e,t=0)=>{let n=0,r=t;for(;r<4&&r<e.length;r++){const o=e[r];if(n|=(127&o)<<7*(r-t),0==(o>>7&1))break}return{num:n,end:r-t<4?r+1:r}},Te=(e,t)=>{const n=new Uint32Array([e]),r=new Uint8Array(n.buffer);return r.reverse(),t?r.slice(4-t):r},Fe=(e,t)=>{const n=new Int32Array([e]),r=new Int8Array(n.buffer);return r.reverse(),t?new Uint8Array(r.slice(4-t)):new Uint8Array(r)},Ve=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,n=new Uint8Array(t);for(let r=0;r<t;r++)n[r]=parseInt(e.slice(2*r,2*r+2),16);return n},je=e=>{const t=new DataView(e.buffer),n=[];for(let r=0;r<e.length;r+=4)n.push(t.getInt32(r));return n},De=e=>{const t=new Uint8Array(4*e.length),n=new DataView(t.buffer);for(let t=0;t<e.length;t++)n.setInt32(4*t,e[t]);return t};const xe={encrypt:function(e,t){const n=je(e),r=je(t),o=n.length-1;let a,i,c=n[o],s=n[0],u=Math.floor(6+52/(o+1)),l=0;for(;u-- >0;){l=l+2654435769&4294967295,i=l>>>2&3;let e=0;for(;e<o;e++)s=n[e+1],a=(c>>>5^s<<2)+(s>>>3^c<<4)^(l^s)+(r[3&e^i]^c),c=n[e]=n[e]+a&4294967295;s=n[0],a=(c>>>5^s<<2)+(s>>>3^c<<4)^(l^s)+(r[3&e^i]^c),c=n[o]=n[o]+a&4294967295}return De(n)},decrypt:function(e,t){const n=je(e),r=je(t),o=n.length-1;let a=n[o-1],i=n[0];const c=2654435769;let s,u,l=Math.floor(6+52/(o+1))*c&4294967295;for(;0!==l;){u=l>>>2&3;let e=o;for(;e>0;e--)a=n[e-1],s=(a>>>5^i<<2)+(i>>>3^a<<4)^(l^i)+(r[3&e^u]^a),i=n[e]=n[e]-s&4294967295;a=n[o],s=(a>>>5^i<<2)+(i>>>3^a<<4)^(l^i)+(r[3&e^u]^a),i=n[0]=n[0]-s&4294967295,l=l-c&4294967295}return De(n)}},Pe={},ke=()=>"undefined"!=typeof globalThis?globalThis:Pe;function ze(e,t){const n=ke();return n[e]?n[e][t]:null}function We(e){const t=ke();return t[e]?t[e]:null}function _e(e,t,n){const r=ke();r[e]||(r[e]={}),r[e][t]=n}function Oe(e){const t=ke();t[e]&&(t[e]={})}export{X as BaseApi,de as CRC16,pe as CRC32,we as CRC8,Z as ab2hex,Ce as bitToBoolean,ce as bytes2string,Be as bytesToBits,Ie as bytesToCharts,me as bytesToHex,ye as bytesToInt,Me as bytesToIntBy128,Ee as bytesToString,Ae as bytesToUint,Ue as bytesToUtf8,le as checkVersion,ue as checkWxVersion,Oe as clearCache,Y as dec2hex,fe as firstUpperCase,se as formatQuery,ze as getCache,We as getCacheSpace,ne as hex2ab,ee as hex2dec,te as hex2string,Ve as hexToBytes,oe as int2TwoBytes,re as intToByte,Fe as intToBytes,he as keyToHump,be as randomBytes,_e as setCache,ae as string2bytes,ve as stringToBytes,Te as uintToBytes,Le as uintToBytesBy128,ie as utf8ToBytes,xe as xxtea};

@@ -1,1 +0,1 @@

"use strict";function e(e,t){return wx[e]?t?t=>new Promise(((r,n)=>{const{success:o,fail:s}=t||{};wx[e](Object.assign(Object.assign({},t),{success:e=>{o&&o(e),r(e)},fail:e=>{s&&s(e),n(e)}}))})):wx[e]:()=>{console.warn(`The Api ${e} is not found`)}}Object.defineProperty(exports,"__esModule",{value:!0});const t=e("getFileSystemManager"),r=e("downloadFile",!0),n=e("getFileInfo",!0),o=e("getSystemInfoSync"),s=e("getAccountInfoSync"),a=e("getAppAuthorizeSetting"),i=e("authorizeForMiniProgram",!0),c=e("authorize",!0),u=e("onBLEConnectionStateChange"),l=e("offBLEConnectionStateChange"),f=e("onBluetoothAdapterStateChange"),h=e("notifyBLECharacteristicValueChange",!0),p=e("readBLECharacteristicValue",!0),g=e("getBLEMTU",!0),d=e("setBLEMTU",!0),y=e("getBluetoothAdapterState",!0),C=e("onBluetoothDeviceFound"),S=e("offBluetoothDeviceFound"),x=e("getBluetoothDevices",!0),w=e("onBLECharacteristicValueChange"),A=e("offBLECharacteristicValueChange"),B=e("writeBLECharacteristicValue",!0),b=e("createBLEPeripheralServer",!0),m=e("openBluetoothAdapter",!0),T=e("closeBluetoothAdapter",!0),I=e("connectSocket"),U=e("login",!0),E=e("getUserInfo",!0),v=e("createUDPSocket"),L=e("scanCode",!0),M=e("getSetting",!0),V=e("getLocalIPAddress",!0),j=e("startWifi",!0),F=e("stopWifi",!0),k=e("getConnectedWifi",!0),D=e("request",!0),P=e("setStorageSync"),_=e("getStorageSync"),W=e("removeStorageSync"),z=e("onAppHide"),H=e("offAppHide"),O=e("onAppShow"),R=e("offAppShow"),$=e("navigateToMiniProgram",!0),q=e("navigateTo",!0),K=e("redirectTo",!0),N=e("navigateBack",!0),Q=e("reLaunch",!0);var G=Object.freeze({__proto__:null,hasBaseApi:e=>!!wx[e],getFileSystemManager:t,downloadFile:r,getFileInfo:n,getSystemInfoSync:o,getAccountInfoSync:s,getAppAuthorizeSetting:a,authorizeForMiniProgram:i,authorize:c,onBLEConnectionStateChange:u,offBLEConnectionStateChange:l,onBluetoothAdapterStateChange:f,notifyBLECharacteristicValueChange:h,readBLECharacteristicValue:p,getBLEMTU:g,setBLEMTU:d,getBluetoothAdapterState:y,onBluetoothDeviceFound:C,offBluetoothDeviceFound:S,getBluetoothDevices:x,onBLECharacteristicValueChange:w,offBLECharacteristicValueChange:A,writeBLECharacteristicValue:B,createBLEPeripheralServer:b,openBluetoothAdapter:m,closeBluetoothAdapter:T,connectSocket:I,login:U,getUserInfo:E,createUDPSocket:v,scanCode:L,getSetting:M,getLocalIPAddress:V,startWifi:j,stopWifi:F,getConnectedWifi:k,request:D,setStorageSync:P,getStorageSync:_,removeStorageSync:W,onAppHide:z,offAppHide:H,onAppShow:O,offAppShow:R,navigateToMiniProgram:$,navigateTo:q,redirectTo:K,navigateBack:N,reLaunch:Q});function J(e,t=2){let r=e;return"string"==typeof e&&(r=parseInt(e)),r.toString(16).padStart(t,"0")}function X(e){const t=255&e;let r=0;return t>=128?(r=t%128,r=-1*(128-r)):r=t,r}function Y(e,t=!1){const r=e.length,n=new Uint8Array(t?4*r:r);let o=0;for(let s=0;s<r;s++){let a=e.charCodeAt(s);if(t&&55296<=a&&a<=56319){if(++s>=r)throw new Error("Malformed string, low surrogate expected at position "+s);a=(55296^a)<<10|65536|56320^e.charCodeAt(s)}else if(!t&&a>>>8)throw new Error("Wide characters are not allowed.");!t||a<=127?n[o++]=a:a<=2047?(n[o++]=192|a>>6,n[o++]=128|63&a):a<=65535?(n[o++]=224|a>>12,n[o++]=128|a>>6&63,n[o++]=128|63&a):(n[o++]=240|a>>18,n[o++]=128|a>>12&63,n[o++]=128|a>>6&63,n[o++]=128|63&a)}return n.subarray(0,o)}const Z=(e,t,r=!0)=>{const n=e.split("."),o=t.split("."),s=Math.max(o.length,n.length);for(;o.length<s;)o.splice(0,0,"0");for(;n.length<s;)n.splice(0,0,"0");for(let e=0;e<s;e++){const t=parseInt(n[e]),r=parseInt(o[e]);if(t>r)return!0;if(t===r)break;return!1}return r},ee=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));const te=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?t>>>1^3988292384:t>>>1;te[e]=t}const re={initial_value:0,table:function(e){const t=[];for(let r=0;r<256;++r){let n=r;for(let t=0;t<8;++t)n=0!=(128&n)?(n<<1^e)%256:(n<<1)%256;t[r]=n}return t}(7)};function ne(e){const t=new DataView(e.buffer);switch(e.length){case 1:return t.getUint8(0);case 2:return t.getUint16(0);case 3:return e.reduce(((e,t)=>e<<8|t),0);case 4:return t.getUint32(0);default:return parseInt(oe(e),16)}}function oe(e){return e.length<=4?ne(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase()}const se=e=>{const t=new DataView(e.buffer),r=[];for(let n=0;n<e.length;n+=4)r.push(t.getInt32(n));return r},ae=e=>{const t=new Uint8Array(4*e.length),r=new DataView(t.buffer);for(let t=0;t<e.length;t++)r.setInt32(4*t,e[t]);return t};const ie={encrypt:function(e,t){const r=se(e),n=se(t),o=r.length-1;let s,a,i=r[o],c=r[0],u=Math.floor(6+52/(o+1)),l=0;for(;u-- >0;){l=l+2654435769&4294967295,a=l>>>2&3;let e=0;for(;e<o;e++)c=r[e+1],s=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(n[3&e^a]^i),i=r[e]=r[e]+s&4294967295;c=r[0],s=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(n[3&e^a]^i),i=r[o]=r[o]+s&4294967295}return ae(r)},decrypt:function(e,t){const r=se(e),n=se(t),o=r.length-1;let s=r[o-1],a=r[0];const i=2654435769;let c,u,l=Math.floor(6+52/(o+1))*i&4294967295;for(;0!==l;){u=l>>>2&3;let e=o;for(;e>0;e--)s=r[e-1],c=(s>>>5^a<<2)+(a>>>3^s<<4)^(l^a)+(n[3&e^u]^s),a=r[e]=r[e]-c&4294967295;s=r[o],c=(s>>>5^a<<2)+(a>>>3^s<<4)^(l^a)+(n[3&e^u]^s),a=r[0]=r[0]-c&4294967295,l=l-i&4294967295}return ae(r)}},ce={},ue=()=>"undefined"!=typeof globalThis?globalThis:ce;exports.BaseApi=G,exports.CRC16=function(e){let t,r,n=65535;for(t=0;t<e.length;t++)for(n^=255&e[t],r=0;r<8;r++)0!=(1&n)?(n>>=1,n^=40961):n>>=1;return n},exports.CRC32=function(e){let t=-1;for(let r=0,n=e.length;r<n;r++)t=t>>>8^te[255&(t^e[r])];return-1^t},exports.CRC8=e=>{let t=re.initial_value;for(let r=0;r<e.length;r++)t=re.table[(t^e[r])%256];return t},exports.ab2hex=function(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(J(e))})),t},exports.bitToBoolean=function(e,t){return!!((e&Math.pow(2,t))>>t)},exports.bytes2string=function(e,t=!1){const r=e.length,n=new Array(r);let o=0;for(let s=0;s<r;s++){const a=e[s];if(!t||a<128)n[o++]=a;else if(a>=192&&a<224&&s+1<r)n[o++]=(31&a)<<6|63&e[++s];else if(a>=224&&a<240&&s+2<r)n[o++]=(15&a)<<12|(63&e[++s])<<6|63&e[++s];else{if(!(a>=240&&a<248&&s+3<r))throw new Error("Malformed UTF8 character at byte offset "+s);{let t=(7&a)<<18|(63&e[++s])<<12|(63&e[++s])<<6|63&e[++s];t<=65535?n[o++]=t:(t^=65536,n[o++]=55296|t>>10,n[o++]=56320|1023&t)}}}let s="";const a=16384;for(let e=0;e<o;e+=a)s+=String.fromCharCode(...n.slice(e,e+a<=o?e+a:o));return s},exports.bytesToBits=function(e){return e.reduceRight(((e,t)=>{const r=t.toString(2).padStart(8,"0").split("").map((e=>Number(e))).reverse();return e.concat(r)}),[])},exports.bytesToCharts=function(e){return e.length%2!=0?(console.error("Illegal Format UTF16 Code!"),""):e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")},exports.bytesToHex=oe,exports.bytesToInt=function(e){if(e.length>6)throw new Error("The number of bytes exceeds 6");const t=new DataView(e.buffer);switch(e.length){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:{let t=ne(e);const r=Math.pow(2,8*e.length)/2;return t>=r&&(t%=r,t=-1*(r-t)),t}}},exports.bytesToIntBy128=(e,t=0)=>{let r=0,n=t;for(;n<4&&n<e.length;n++){const o=e[n];if(r|=(127&o)<<7*(n-t),0==(o>>7&1))break}return{num:r,end:n-t<4?n+1:n}},exports.bytesToString=function(e){const t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n].toString(2),o=r.match(/^1+?(?=0)/);if(o&&8==r.length){const s=o[0].length;let a=r.slice(7-s);for(let t=1;t<s;t++)a+=e[t+n].toString(2).slice(2);t.push(String.fromCharCode(parseInt(a,2))),n+=s-1}else t.push(String.fromCharCode(e[n]))}return t.join("")},exports.bytesToUint=ne,exports.bytesToUtf8=function(e){const t=[];let r=0;for(;r<e.length;){const n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):n>191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")},exports.checkVersion=Z,exports.checkWxVersion=e=>{const t=o().SDKVersion;return Z(e,t)},exports.clearCache=function(e){const t=ue();t[e]&&(t[e]={})},exports.dec2hex=J,exports.firstUpperCase=ee,exports.formatQuery=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((r,n)=>{const o=e[n];return void 0!==o&&r.push(`${n}=${t?encodeURIComponent(o):o}`),r}),[]).join("&")},exports.getCache=function(e,t){const r=ue();return r[e]?r[e][t]:null},exports.getCacheSpace=function(e){const t=ue();return t[e]?t[e]:null},exports.hex2ab=function(e){const t=[];if("string"==typeof e)for(let r=0;r<e.length;r+=2)t.push(parseInt(e.slice(r,r+2),16));else if("string"==typeof e[0])for(let r=0;r<e.length;r++)t.push(parseInt(e[r],16));return new Uint8Array(t)},exports.hex2dec=function(e){return parseInt(e,16)},exports.hex2string=function(e){const t=[];if("string"==typeof e)for(let r=0;r<e.length;r+=2){const n=parseInt(e.slice(r,r+2),16);t.push(String.fromCharCode(n))}else for(let r=0;r<e.length;r++){const n=parseInt(e[r],16);t.push(String.fromCharCode(n))}return t.join("")},exports.hexToBytes=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=parseInt(e.slice(2*n,2*n+2),16);return r},exports.int2TwoBytes=function(e){const t=X(255&e);return[X(e>>8&255),t]},exports.intToByte=X,exports.intToBytes=(e,t)=>{const r=new Int32Array([e]),n=new Int8Array(r.buffer);return n.reverse(),t?new Uint8Array(n.slice(4-t)):new Uint8Array(n)},exports.keyToHump=function e(t){return"object"!=typeof t?t:Array.isArray(t)?t.map((t=>e(t))):Object.keys(t).reduce(((r,n)=>{const o=n.split("_").map(((e,t)=>t>0?ee(e):e)).join("");let s=t[n];return Array.isArray(s)?s=s.map((t=>e(t))):"object"==typeof s&&(s=e(s)),r[o]=s,r}),{})},exports.randomBytes=e=>{const t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=Math.floor(256*Math.random());return t},exports.setCache=function(e,t,r){const n=ue();n[e]||(n[e]={}),n[e][t]=r},exports.string2bytes=Y,exports.stringToBytes=function(e){const t=[],r=e.length;for(let n=0;n<r;n++){const r=e.charCodeAt(n);r>=65536&&r<=1114111?(t.push(r>>18&7|240),t.push(r>>12&63|128),t.push(r>>6&63|128),t.push(63&r|128)):r>=2048&&r<=65535?(t.push(r>>12&15|224),t.push(r>>6&63|128),t.push(63&r|128)):r>=128&&r<=2047?(t.push(r>>6&31|192),t.push(63&r|128)):t.push(255&r)}return new Uint8Array(t)},exports.uintToBytes=(e,t)=>{const r=new Uint32Array([e]),n=new Uint8Array(r.buffer);return n.reverse(),t?n.slice(4-t):n},exports.uintToBytesBy128=e=>{const t=[];do{let r=e%128;(e=parseInt(""+e/128))>0&&(r|=128),t.push(r)}while(e>0);return new Uint8Array(t)},exports.utf8ToBytes=function(e){return Y(e,!0)},exports.xxtea=ie;
"use strict";function e(e,t){const r=wx||(my||{});return r[e]?t?t=>new Promise(((n,o)=>{const{success:s,fail:a}=t||{};r[e](Object.assign(Object.assign({},t),{success:e=>{s&&s(e),n(e)},fail:e=>{a&&a(e),o(e)}}))})):r[e]:()=>{console.warn(`The Api ${e} is not found`)}}Object.defineProperty(exports,"__esModule",{value:!0});const t=e("getFileSystemManager"),r=e("downloadFile",!0),n=e("getFileInfo",!0),o=e("getSystemInfoSync"),s=e("getAccountInfoSync"),a=e("getAppAuthorizeSetting"),i=e("authorizeForMiniProgram",!0),c=e("authorize",!0),u=e("onBLEConnectionStateChange"),l=e("offBLEConnectionStateChange"),f=e("onBluetoothAdapterStateChange"),h=e("notifyBLECharacteristicValueChange",!0),p=e("readBLECharacteristicValue",!0),g=e("getBLEMTU",!0),d=e("setBLEMTU",!0),y=e("getBluetoothAdapterState",!0),C=e("onBluetoothDeviceFound"),S=e("offBluetoothDeviceFound"),w=e("getBluetoothDevices",!0),x=e("onBLECharacteristicValueChange"),A=e("offBLECharacteristicValueChange"),B=e("writeBLECharacteristicValue",!0),m=e("createBLEPeripheralServer",!0),b=e("openBluetoothAdapter",!0),T=e("closeBluetoothAdapter",!0),I=e("connectSocket"),U=e("login",!0),v=e("getUserInfo",!0),E=e("createUDPSocket"),L=e("scanCode",!0),M=e("getSetting",!0),V=e("getLocalIPAddress",!0),j=e("startWifi",!0),F=e("stopWifi",!0),k=e("getConnectedWifi",!0),D=e("request",!0),P=e("onAppHide"),_=e("offAppHide"),W=e("onAppShow"),z=e("offAppShow"),H=e("navigateToMiniProgram",!0),O=e("navigateTo",!0),R=e("redirectTo",!0),$=e("navigateBack",!0),q=e("reLaunch",!0),K=wx.setStorageSync,N=wx.getStorageSync,Q=wx.removeStorageSync,G=e("showToast",!1),J=wx.env;var X=Object.freeze({__proto__:null,hasBaseApi:e=>!!wx[e],getFileSystemManager:t,downloadFile:r,getFileInfo:n,getSystemInfoSync:o,getAccountInfoSync:s,getAppAuthorizeSetting:a,authorizeForMiniProgram:i,authorize:c,onBLEConnectionStateChange:u,offBLEConnectionStateChange:l,onBluetoothAdapterStateChange:f,notifyBLECharacteristicValueChange:h,readBLECharacteristicValue:p,getBLEMTU:g,setBLEMTU:d,getBluetoothAdapterState:y,onBluetoothDeviceFound:C,offBluetoothDeviceFound:S,getBluetoothDevices:w,onBLECharacteristicValueChange:x,offBLECharacteristicValueChange:A,writeBLECharacteristicValue:B,createBLEPeripheralServer:m,openBluetoothAdapter:b,closeBluetoothAdapter:T,connectSocket:I,login:U,getUserInfo:v,createUDPSocket:E,scanCode:L,getSetting:M,getLocalIPAddress:V,startWifi:j,stopWifi:F,getConnectedWifi:k,request:D,onAppHide:P,offAppHide:_,onAppShow:W,offAppShow:z,navigateToMiniProgram:H,navigateTo:O,redirectTo:R,navigateBack:$,reLaunch:q,setStorageSync:K,getStorageSync:N,removeStorageSync:Q,showToast:G,env:J});function Y(e,t=2){let r=e;return"string"==typeof e&&(r=parseInt(e)),r.toString(16).padStart(t,"0")}function Z(e){const t=255&e;let r=0;return t>=128?(r=t%128,r=-1*(128-r)):r=t,r}function ee(e,t=!1){const r=e.length,n=new Uint8Array(t?4*r:r);let o=0;for(let s=0;s<r;s++){let a=e.charCodeAt(s);if(t&&55296<=a&&a<=56319){if(++s>=r)throw new Error("Malformed string, low surrogate expected at position "+s);a=(55296^a)<<10|65536|56320^e.charCodeAt(s)}else if(!t&&a>>>8)throw new Error("Wide characters are not allowed.");!t||a<=127?n[o++]=a:a<=2047?(n[o++]=192|a>>6,n[o++]=128|63&a):a<=65535?(n[o++]=224|a>>12,n[o++]=128|a>>6&63,n[o++]=128|63&a):(n[o++]=240|a>>18,n[o++]=128|a>>12&63,n[o++]=128|a>>6&63,n[o++]=128|63&a)}return n.subarray(0,o)}const te=(e,t,r=!0)=>{const n=e.split("."),o=t.split("."),s=Math.max(o.length,n.length);for(;o.length<s;)o.splice(0,0,"0");for(;n.length<s;)n.splice(0,0,"0");for(let e=0;e<s;e++){const t=parseInt(n[e]),r=parseInt(o[e]);if(t>r)return!0;if(t===r)break;return!1}return r},re=e=>e.replace(/^\S/,(function(e){return e.toUpperCase()}));const ne=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?t>>>1^3988292384:t>>>1;ne[e]=t}const oe={initial_value:0,table:function(e){const t=[];for(let r=0;r<256;++r){let n=r;for(let t=0;t<8;++t)n=0!=(128&n)?(n<<1^e)%256:(n<<1)%256;t[r]=n}return t}(7)};function se(e){const t=new DataView(e.buffer);switch(e.length){case 1:return t.getUint8(0);case 2:return t.getUint16(0);case 3:return e.reduce(((e,t)=>e<<8|t),0);case 4:return t.getUint32(0);default:return parseInt(ae(e),16)}}function ae(e){return e.length<=4?se(e).toString(16).padStart(2*e.length,"0").toUpperCase():e.reduce(((e,t)=>(e.push(t.toString(16).padStart(2,"0")),e)),[]).join("").toUpperCase()}const ie=e=>{const t=new DataView(e.buffer),r=[];for(let n=0;n<e.length;n+=4)r.push(t.getInt32(n));return r},ce=e=>{const t=new Uint8Array(4*e.length),r=new DataView(t.buffer);for(let t=0;t<e.length;t++)r.setInt32(4*t,e[t]);return t};const ue={encrypt:function(e,t){const r=ie(e),n=ie(t),o=r.length-1;let s,a,i=r[o],c=r[0],u=Math.floor(6+52/(o+1)),l=0;for(;u-- >0;){l=l+2654435769&4294967295,a=l>>>2&3;let e=0;for(;e<o;e++)c=r[e+1],s=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(n[3&e^a]^i),i=r[e]=r[e]+s&4294967295;c=r[0],s=(i>>>5^c<<2)+(c>>>3^i<<4)^(l^c)+(n[3&e^a]^i),i=r[o]=r[o]+s&4294967295}return ce(r)},decrypt:function(e,t){const r=ie(e),n=ie(t),o=r.length-1;let s=r[o-1],a=r[0];const i=2654435769;let c,u,l=Math.floor(6+52/(o+1))*i&4294967295;for(;0!==l;){u=l>>>2&3;let e=o;for(;e>0;e--)s=r[e-1],c=(s>>>5^a<<2)+(a>>>3^s<<4)^(l^a)+(n[3&e^u]^s),a=r[e]=r[e]-c&4294967295;s=r[o],c=(s>>>5^a<<2)+(a>>>3^s<<4)^(l^a)+(n[3&e^u]^s),a=r[0]=r[0]-c&4294967295,l=l-i&4294967295}return ce(r)}},le={},fe=()=>"undefined"!=typeof globalThis?globalThis:le;exports.BaseApi=X,exports.CRC16=function(e){let t,r,n=65535;for(t=0;t<e.length;t++)for(n^=255&e[t],r=0;r<8;r++)0!=(1&n)?(n>>=1,n^=40961):n>>=1;return n},exports.CRC32=function(e){let t=-1;for(let r=0,n=e.length;r<n;r++)t=t>>>8^ne[255&(t^e[r])];return-1^t},exports.CRC8=e=>{let t=oe.initial_value;for(let r=0;r<e.length;r++)t=oe.table[(t^e[r])%256];return t},exports.ab2hex=function(e){const t=[];return Array.prototype.map.call(new Uint8Array(e),(function(e){t.push(Y(e))})),t},exports.bitToBoolean=function(e,t){return!!((e&Math.pow(2,t))>>t)},exports.bytes2string=function(e,t=!1){const r=e.length,n=new Array(r);let o=0;for(let s=0;s<r;s++){const a=e[s];if(!t||a<128)n[o++]=a;else if(a>=192&&a<224&&s+1<r)n[o++]=(31&a)<<6|63&e[++s];else if(a>=224&&a<240&&s+2<r)n[o++]=(15&a)<<12|(63&e[++s])<<6|63&e[++s];else{if(!(a>=240&&a<248&&s+3<r))throw new Error("Malformed UTF8 character at byte offset "+s);{let t=(7&a)<<18|(63&e[++s])<<12|(63&e[++s])<<6|63&e[++s];t<=65535?n[o++]=t:(t^=65536,n[o++]=55296|t>>10,n[o++]=56320|1023&t)}}}let s="";const a=16384;for(let e=0;e<o;e+=a)s+=String.fromCharCode(...n.slice(e,e+a<=o?e+a:o));return s},exports.bytesToBits=function(e){return e.reduceRight(((e,t)=>{const r=t.toString(2).padStart(8,"0").split("").map((e=>Number(e))).reverse();return e.concat(r)}),[])},exports.bytesToCharts=function(e){return e.length%2!=0?(console.error("Illegal Format UTF16 Code!"),""):e.reduce(((e,t)=>(e.push(String.fromCharCode(t)),e)),[]).join("")},exports.bytesToHex=ae,exports.bytesToInt=function(e){if(e.length>6)throw new Error("The number of bytes exceeds 6");const t=new DataView(e.buffer);switch(e.length){case 1:return t.getInt8(0);case 2:return t.getInt16(0);case 4:return t.getInt32(0);default:{let t=se(e);const r=Math.pow(2,8*e.length)/2;return t>=r&&(t%=r,t=-1*(r-t)),t}}},exports.bytesToIntBy128=(e,t=0)=>{let r=0,n=t;for(;n<4&&n<e.length;n++){const o=e[n];if(r|=(127&o)<<7*(n-t),0==(o>>7&1))break}return{num:r,end:n-t<4?n+1:n}},exports.bytesToString=function(e){const t=[],r=e.length;for(let n=0;n<r;n++){const r=e[n].toString(2),o=r.match(/^1+?(?=0)/);if(o&&8==r.length){const s=o[0].length;let a=r.slice(7-s);for(let t=1;t<s;t++)a+=e[t+n].toString(2).slice(2);t.push(String.fromCharCode(parseInt(a,2))),n+=s-1}else t.push(String.fromCharCode(e[n]))}return t.join("")},exports.bytesToUint=se,exports.bytesToUtf8=function(e){const t=[];let r=0;for(;r<e.length;){const n=e[r];n<128?(t.push(String.fromCharCode(n)),r++):n>191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")},exports.checkVersion=te,exports.checkWxVersion=e=>{const t=o().SDKVersion;return te(e,t)},exports.clearCache=function(e){const t=fe();t[e]&&(t[e]={})},exports.dec2hex=Y,exports.firstUpperCase=re,exports.formatQuery=(e,t=!1)=>{if(!e)return"";return Object.keys(e).reduce(((r,n)=>{const o=e[n];return void 0!==o&&r.push(`${n}=${t?encodeURIComponent(o):o}`),r}),[]).join("&")},exports.getCache=function(e,t){const r=fe();return r[e]?r[e][t]:null},exports.getCacheSpace=function(e){const t=fe();return t[e]?t[e]:null},exports.hex2ab=function(e){const t=[];if("string"==typeof e)for(let r=0;r<e.length;r+=2)t.push(parseInt(e.slice(r,r+2),16));else if("string"==typeof e[0])for(let r=0;r<e.length;r++)t.push(parseInt(e[r],16));return new Uint8Array(t)},exports.hex2dec=function(e){return parseInt(e,16)},exports.hex2string=function(e){const t=[];if("string"==typeof e)for(let r=0;r<e.length;r+=2){const n=parseInt(e.slice(r,r+2),16);t.push(String.fromCharCode(n))}else for(let r=0;r<e.length;r++){const n=parseInt(e[r],16);t.push(String.fromCharCode(n))}return t.join("")},exports.hexToBytes=e=>{if(e.length%2!=0)throw new Error("hex length error");const t=e.length/2,r=new Uint8Array(t);for(let n=0;n<t;n++)r[n]=parseInt(e.slice(2*n,2*n+2),16);return r},exports.int2TwoBytes=function(e){const t=Z(255&e);return[Z(e>>8&255),t]},exports.intToByte=Z,exports.intToBytes=(e,t)=>{const r=new Int32Array([e]),n=new Int8Array(r.buffer);return n.reverse(),t?new Uint8Array(n.slice(4-t)):new Uint8Array(n)},exports.keyToHump=function e(t){return"object"!=typeof t?t:Array.isArray(t)?t.map((t=>e(t))):Object.keys(t).reduce(((r,n)=>{const o=n.split("_").map(((e,t)=>t>0?re(e):e)).join("");let s=t[n];return Array.isArray(s)?s=s.map((t=>e(t))):"object"==typeof s&&(s=e(s)),r[o]=s,r}),{})},exports.randomBytes=e=>{const t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=Math.floor(256*Math.random());return t},exports.setCache=function(e,t,r){const n=fe();n[e]||(n[e]={}),n[e][t]=r},exports.string2bytes=ee,exports.stringToBytes=function(e){const t=[],r=e.length;for(let n=0;n<r;n++){const r=e.charCodeAt(n);r>=65536&&r<=1114111?(t.push(r>>18&7|240),t.push(r>>12&63|128),t.push(r>>6&63|128),t.push(63&r|128)):r>=2048&&r<=65535?(t.push(r>>12&15|224),t.push(r>>6&63|128),t.push(63&r|128)):r>=128&&r<=2047?(t.push(r>>6&31|192),t.push(63&r|128)):t.push(255&r)}return new Uint8Array(t)},exports.uintToBytes=(e,t)=>{const r=new Uint32Array([e]),n=new Uint8Array(r.buffer);return n.reverse(),t?n.slice(4-t):n},exports.uintToBytesBy128=e=>{const t=[];do{let r=e%128;(e=parseInt(""+e/128))>0&&(r|=128),t.push(r)}while(e>0);return new Uint8Array(t)},exports.utf8ToBytes=function(e){return ee(e,!0)},exports.xxtea=ue;
{
"name": "@ray-js/wechat-helper",
"version": "0.0.19",
"version": "0.0.20-beta-1",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public",

@@ -38,5 +38,2 @@ export declare const hasBaseApi: (apiName: string) => boolean;

export declare const request: (option?: any) => Promise<any>;
export declare const setStorageSync: (option?: any) => any;
export declare const getStorageSync: (option?: any) => any;
export declare const removeStorageSync: (option?: any) => any;
export declare const onAppHide: (option?: any) => any;

@@ -51,1 +48,6 @@ export declare const offAppHide: (option?: any) => any;

export declare const reLaunch: (option?: any) => Promise<any>;
export declare const setStorageSync: any;
export declare const getStorageSync: any;
export declare const removeStorageSync: any;
export declare const showToast: (option?: any) => Promise<any>;
export declare const env: any;

@@ -6,3 +6,3 @@ /**

*
* @param data 8位无符号整形数据
* @param data 无符号整形数据
* @param offset

@@ -9,0 +9,0 @@ * @returns

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc