mini_program_gizwits_sdk 3.1.17-13 → 3.1.17-15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,34 @@
1
- module.exports=function(e){var t={};function i(s){if(t[s])return t[s].exports;var n=t[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=t,i.d=function(e,t,s){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(s,n,function(t){return e[t]}.bind(null,n));return s},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=17)}([function(e,t,i){(function(t){var s;e.exports=(s=s||function(e,s){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!==t&&t.crypto&&(n=t.crypto),!n)try{n=i(35)}catch(e){}var r=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 i;return e.prototype=t,i=new e,e.prototype=null,i}}(),c={},a=c.lib={},l=a.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)}},d=a.WordArray=l.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,i=e.words,s=this.sigBytes,n=e.sigBytes;if(this.clamp(),s%4)for(var r=0;r<n;r++){var o=i[r>>>2]>>>24-r%4*8&255;t[s+r>>>2]|=o<<24-(s+r)%4*8}else for(var c=0;c<n;c+=4)t[s+c>>>2]=i[c>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=l.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i<e;i+=4)t.push(r());return new d.init(t,e)}}),h=c.enc={},u=h.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],n=0;n<i;n++){var r=t[n>>>2]>>>24-n%4*8&255;s.push((r>>>4).toString(16)),s.push((15&r).toString(16))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s<t;s+=2)i[s>>>3]|=parseInt(e.substr(s,2),16)<<24-s%8*4;return new d.init(i,t/2)}},f=h.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],n=0;n<i;n++){var r=t[n>>>2]>>>24-n%4*8&255;s.push(String.fromCharCode(r))}return s.join("")},parse:function(e){for(var t=e.length,i=[],s=0;s<t;s++)i[s>>>2]|=(255&e.charCodeAt(s))<<24-s%4*8;return new d.init(i,t)}},p=h.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},v=a.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new d.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 i,s=this._data,n=s.words,r=s.sigBytes,o=this.blockSize,c=r/(4*o),a=(c=t?e.ceil(c):e.max((0|c)-this._minBufferSize,0))*o,l=e.min(4*a,r);if(a){for(var h=0;h<a;h+=o)this._doProcessBlock(n,h);i=n.splice(0,a),s.sigBytes-=l}return new d.init(i,l)},clone:function(){var e=l.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),g=(a.Hasher=v.extend({cfg:l.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){v.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new g.HMAC.init(e,i).finalize(t)}}}),c.algo={});return c}(Math),s)}).call(this,i(34))},function(e,t,i){var s,n,r,o,c,a,l,d,h,u,f,p,v,g,y,_,D,m,S;e.exports=(s=i(0),i(5),void(s.lib.Cipher||(n=s,r=n.lib,o=r.Base,c=r.WordArray,a=r.BufferedBlockAlgorithm,l=n.enc,l.Utf8,d=l.Base64,h=n.algo.EvpKDF,u=r.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this.cfg=this.cfg.extend(i),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?S:D}return function(t){return{encrypt:function(i,s,n){return e(s).encrypt(t,i,s,n)},decrypt:function(i,s,n){return e(s).decrypt(t,i,s,n)}}}}()}),r.StreamCipher=u.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),f=n.mode={},p=r.BlockCipherMode=o.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),v=f.CBC=function(){var e=p.extend();function t(e,t,i){var s,n=this._iv;n?(s=n,this._iv=void 0):s=this._prevBlock;for(var r=0;r<i;r++)e[t+r]^=s[r]}return e.Encryptor=e.extend({processBlock:function(e,i){var s=this._cipher,n=s.blockSize;t.call(this,e,i,n),s.encryptBlock(e,i),this._prevBlock=e.slice(i,i+n)}}),e.Decryptor=e.extend({processBlock:function(e,i){var s=this._cipher,n=s.blockSize,r=e.slice(i,i+n);s.decryptBlock(e,i),t.call(this,e,i,n),this._prevBlock=r}}),e}(),g=(n.pad={}).Pkcs7={pad:function(e,t){for(var i=4*t,s=i-e.sigBytes%i,n=s<<24|s<<16|s<<8|s,r=[],o=0;o<s;o+=4)r.push(n);var a=c.create(r,s);e.concat(a)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},r.BlockCipher=u.extend({cfg:u.cfg.extend({mode:v,padding:g}),reset:function(){var e;u.reset.call(this);var t=this.cfg,i=t.iv,s=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=s.createEncryptor:(e=s.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(s,this,i&&i.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}),y=r.CipherParams=o.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(n.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?c.create([1398893684,1701076831]).concat(i).concat(t):t).toString(d)},parse:function(e){var t,i=d.parse(e),s=i.words;return 1398893684==s[0]&&1701076831==s[1]&&(t=c.create(s.slice(2,4)),s.splice(0,4),i.sigBytes-=16),y.create({ciphertext:i,salt:t})}},D=r.SerializableCipher=o.extend({cfg:o.extend({format:_}),encrypt:function(e,t,i,s){s=this.cfg.extend(s);var n=e.createEncryptor(i,s),r=n.finalize(t),o=n.cfg;return y.create({ciphertext:r,key:i,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:s.format})},decrypt:function(e,t,i,s){return s=this.cfg.extend(s),t=this._parse(t,s.format),e.createDecryptor(i,s).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),m=(n.kdf={}).OpenSSL={execute:function(e,t,i,s){s||(s=c.random(8));var n=h.create({keySize:t+i}).compute(e,s),r=c.create(n.words.slice(t),4*i);return n.sigBytes=4*t,y.create({key:n,iv:r,salt:s})}},S=r.PasswordBasedCipher=D.extend({cfg:D.cfg.extend({kdf:m}),encrypt:function(e,t,i,s){var n=(s=this.cfg.extend(s)).kdf.execute(i,e.keySize,e.ivSize);s.iv=n.iv;var r=D.encrypt.call(this,e,t,n.key,s);return r.mixIn(n),r},decrypt:function(e,t,i,s){s=this.cfg.extend(s),t=this._parse(t,s.format);var n=s.kdf.execute(i,e.keySize,e.ivSize,t.salt);return s.iv=n.iv,D.decrypt.call(this,e,t,n.key,s)}}))))},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(4),n=i(33);t.default=new class{constructor(){this.logMap=[{id:"debug"},{id:"info"},{id:"warn"},{id:"error"}],this.console=Object.assign({},console),this.debug=(...e)=>{this.console.debug(...e)},this.info=(...e)=>{this.console.info(...e)},this.log=(...e)=>{this.console.log(...e)},this.warn=(...e)=>{this.console.warn(...e)},this.error=(e,t)=>{this.console.error(e,t),n.default(t)},this.setLogLevel=e=>{const t=this.logMap.findIndex(t=>t.id===e);return-1!==t?(this.console=Object.assign({},console),this.logMap.map((e,i)=>{i<t&&(this.console[e.id]=()=>{})}),{success:!0,err:null}):{success:!1,err:s.default.GIZ_SDK_LOG_LEVEL_INVALID}}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.checkHeader=e=>{let t=0;return 0===e[0]&&0===e[1]&&0===e[2]&&3===e[3]&&(t=4,4)};t.getProtocolLen=e=>{let t=0;for(;t<e.length&&"1"===s(e[t].toString(2),8)[0];t++);return t+1},t.arrayToString=function(e){let t="";return e.map(e=>(t+=s(e.toString(16),2),null)),t};const s=(e,t,i=!1)=>{const s=t-e.length,n=new Array(s).fill(0).join("");return i?e+=n:e=n+e,e};t.fillString=s;t.string2Bytes=e=>{const t=[];for(let i=0;i<e.length;i++)t.push(e.charCodeAt(i));return t};t.hexStrint2byte=e=>{const t=Math.ceil(e.length/2),i=[];for(let s=0;s<t;s++){const t=2*s,n=t+2,r=e.substring(t,n);i.push(parseInt(r,16))}return i};const n=e=>{const t=encodeURI(e);return-1!==t.indexOf("%")&&"%"!==e?t.split("%").filter(e=>""!==e).map(e=>parseInt(e,16)):[t.charCodeAt(0)]};t.formatCode=n;t.formatCodesFromStr=e=>{const t=[0,0];let i=[];for(let s=0;s<e.length;s++){const r=n(e[s]);t[1]+=r.length,i=i.concat(r)}return[i,t]};t.arrayToUint8=e=>{const t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let s=0;s<t.byteLength;s++)i[s]=e[s];return i}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={GIZ_OPENAPI_DEVICE_NOT_BOUND:{errorCode:9017,errorMessage:"not bind"},GIZ_SDK_HTTP_REQUEST_FAILED:{errorCode:8099,errorMessage:"网络请求失败"},GIZ_SDK_SDK_NOT_INITIALIZED:{errorCode:8300,errorMessage:"not init"},CONFIG_TIME_OUT:{errorCode:8023,errorMessage:"Config Timeout"},WECHAT_ERROR:{errorCode:1e4,errorMessage:"wechat error"},GIZ_SDK_ONBOARDING_STOPPED:{errorCode:8318,errorMessage:"配网中断"},GIZ_SDK_DEVICE_CONFIG_IS_RUNNING:{errorCode:8022,errorMessage:"配置正在进行中"},GIZ_OPENAPI_TOKEN_INVALID:{errorCode:9004,errorMessage:"token 失效"},GIZ_SDK_BIND_DEVICE_FAILED:{errorCode:8039,errorMessage:"设备绑定失败"},GIZ_SDK_BLE_BLUETOOTH_FUNCTION_NOT_TURNED_ON:{errorCode:8281,errorMessage:"蓝牙未启用"},GIZ_SDK_OTHERWISE:{errorCode:8100,errorMessage:""},GIZ_SDK_DEVICE_NOT_SUBSCRIBED:{errorCode:8029,errorMessage:"设备还未订阅"},GIZ_SDK_PRODUCTKEY_NOT_IN_SPECIFY:{errorCode:8250,errorMessage:"产品类型不在指定范围内"},GIZ_SDK_LOG_LEVEL_INVALID:{errorCode:8009,errorMessage:"产品类型不在指定范围内"}}},function(e,t,i){var s,n,r,o,c,a,l,d;e.exports=(d=i(0),i(14),i(15),n=(s=d).lib,r=n.Base,o=n.WordArray,c=s.algo,a=c.MD5,l=c.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var i,s=this.cfg,n=s.hasher.create(),r=o.create(),c=r.words,a=s.keySize,l=s.iterations;c.length<a;){i&&n.update(i),i=n.update(e).finalize(t),n.reset();for(var d=1;d<l;d++)i=n.finalize(i),n.reset();r.concat(i)}return r.sigBytes=4*a,r}}),s.EvpKDF=function(e,t,i){return l.create(i).compute(e,t)},d.EvpKDF)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(3);class n{constructor(e){this.header="",this.len=0,this.flag=[0],this.cmd="",this.content=[],this.formatP0=e=>{let t=s.checkHeader(e);if(!1===t)throw new Error("Header Error");this.header=s.arrayToString(e.slice(0,t));const i=e.slice(t,e.length),r=s.getProtocolLen(i);this.len=n.decodeLen(i.slice(0,r)),t+=r,this.flag=e.slice(t,t+1),t+=1,this.cmd=s.arrayToString(e.slice(t,t+2)),t+=2,this.content=e.slice(t,e.length)},e&&e.length>0&&this.formatP0(e)}}n.decodeLen=e=>{let t=1,i=0,s=0,n=0;do{s=e[n],i+=(127&s)*t,t*=128,n+=1}while(0!=(128&s));return i},t.default=n},function(e,t,i){var s,n,r;e.exports=(r=i(0),n=(s=r).lib.WordArray,s.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,s=this._map;e.clamp();for(var n=[],r=0;r<i;r+=3)for(var o=(t[r>>>2]>>>24-r%4*8&255)<<16|(t[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|t[r+2>>>2]>>>24-(r+2)%4*8&255,c=0;c<4&&r+.75*c<i;c++)n.push(s.charAt(o>>>6*(3-c)&63));var a=s.charAt(64);if(a)for(;n.length%4;)n.push(a);return n.join("")},parse:function(e){var t=e.length,i=this._map,s=this._reverseMap;if(!s){s=this._reverseMap=[];for(var r=0;r<i.length;r++)s[i.charCodeAt(r)]=r}var o=i.charAt(64);if(o){var c=e.indexOf(o);-1!==c&&(t=c)}return function(e,t,i){for(var s=[],r=0,o=0;o<t;o++)if(o%4){var c=i[e.charCodeAt(o-1)]<<o%4*2,a=i[e.charCodeAt(o)]>>>6-o%4*2,l=c|a;s[r>>>2]|=l<<24-r%4*8,r++}return n.create(s,r)}(e,t,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},r.enc.Base64)},function(e,t,i){var s;e.exports=(s=i(0),function(e){var t=s,i=t.lib,n=i.WordArray,r=i.Hasher,o=t.algo,c=[];!function(){for(var t=0;t<64;t++)c[t]=4294967296*e.abs(e.sin(t+1))|0}();var a=o.MD5=r.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var s=t+i,n=e[s];e[s]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var r=this._hash.words,o=e[t+0],a=e[t+1],f=e[t+2],p=e[t+3],v=e[t+4],g=e[t+5],y=e[t+6],_=e[t+7],D=e[t+8],m=e[t+9],S=e[t+10],b=e[t+11],w=e[t+12],B=e[t+13],k=e[t+14],I=e[t+15],C=r[0],A=r[1],x=r[2],E=r[3];C=l(C,A,x,E,o,7,c[0]),E=l(E,C,A,x,a,12,c[1]),x=l(x,E,C,A,f,17,c[2]),A=l(A,x,E,C,p,22,c[3]),C=l(C,A,x,E,v,7,c[4]),E=l(E,C,A,x,g,12,c[5]),x=l(x,E,C,A,y,17,c[6]),A=l(A,x,E,C,_,22,c[7]),C=l(C,A,x,E,D,7,c[8]),E=l(E,C,A,x,m,12,c[9]),x=l(x,E,C,A,S,17,c[10]),A=l(A,x,E,C,b,22,c[11]),C=l(C,A,x,E,w,7,c[12]),E=l(E,C,A,x,B,12,c[13]),x=l(x,E,C,A,k,17,c[14]),C=d(C,A=l(A,x,E,C,I,22,c[15]),x,E,a,5,c[16]),E=d(E,C,A,x,y,9,c[17]),x=d(x,E,C,A,b,14,c[18]),A=d(A,x,E,C,o,20,c[19]),C=d(C,A,x,E,g,5,c[20]),E=d(E,C,A,x,S,9,c[21]),x=d(x,E,C,A,I,14,c[22]),A=d(A,x,E,C,v,20,c[23]),C=d(C,A,x,E,m,5,c[24]),E=d(E,C,A,x,k,9,c[25]),x=d(x,E,C,A,p,14,c[26]),A=d(A,x,E,C,D,20,c[27]),C=d(C,A,x,E,B,5,c[28]),E=d(E,C,A,x,f,9,c[29]),x=d(x,E,C,A,_,14,c[30]),C=h(C,A=d(A,x,E,C,w,20,c[31]),x,E,g,4,c[32]),E=h(E,C,A,x,D,11,c[33]),x=h(x,E,C,A,b,16,c[34]),A=h(A,x,E,C,k,23,c[35]),C=h(C,A,x,E,a,4,c[36]),E=h(E,C,A,x,v,11,c[37]),x=h(x,E,C,A,_,16,c[38]),A=h(A,x,E,C,S,23,c[39]),C=h(C,A,x,E,B,4,c[40]),E=h(E,C,A,x,o,11,c[41]),x=h(x,E,C,A,p,16,c[42]),A=h(A,x,E,C,y,23,c[43]),C=h(C,A,x,E,m,4,c[44]),E=h(E,C,A,x,w,11,c[45]),x=h(x,E,C,A,I,16,c[46]),C=u(C,A=h(A,x,E,C,f,23,c[47]),x,E,o,6,c[48]),E=u(E,C,A,x,_,10,c[49]),x=u(x,E,C,A,k,15,c[50]),A=u(A,x,E,C,g,21,c[51]),C=u(C,A,x,E,w,6,c[52]),E=u(E,C,A,x,p,10,c[53]),x=u(x,E,C,A,S,15,c[54]),A=u(A,x,E,C,a,21,c[55]),C=u(C,A,x,E,D,6,c[56]),E=u(E,C,A,x,I,10,c[57]),x=u(x,E,C,A,y,15,c[58]),A=u(A,x,E,C,B,21,c[59]),C=u(C,A,x,E,v,6,c[60]),E=u(E,C,A,x,b,10,c[61]),x=u(x,E,C,A,f,15,c[62]),A=u(A,x,E,C,m,21,c[63]),r[0]=r[0]+C|0,r[1]=r[1]+A|0,r[2]=r[2]+x|0,r[3]=r[3]+E|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,n=8*t.sigBytes;i[n>>>5]|=128<<24-n%32;var r=e.floor(s/4294967296),o=s;i[15+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),i[14+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(i.length+1),this._process();for(var c=this._hash,a=c.words,l=0;l<4;l++){var d=a[l];a[l]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}return c},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});function l(e,t,i,s,n,r,o){var c=e+(t&i|~t&s)+n+o;return(c<<r|c>>>32-r)+t}function d(e,t,i,s,n,r,o){var c=e+(t&s|i&~s)+n+o;return(c<<r|c>>>32-r)+t}function h(e,t,i,s,n,r,o){var c=e+(t^i^s)+n+o;return(c<<r|c>>>32-r)+t}function u(e,t,i,s,n,r,o){var c=e+(i^(t|~s))+n+o;return(c<<r|c>>>32-r)+t}t.MD5=r._createHelper(a),t.HmacMD5=r._createHmacHelper(a)}(Math),s.MD5)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(2);function n(e){return Array.prototype.map.call(new Uint8Array(e),(function(e){return("00"+e.toString(16)).slice(-2)})).join("")}t.ab2hex=n,t.compareWXSDKVersion=function(e,t){const i=e.split("."),s=t.split("."),n=Math.max(e.length,t.length);for(;i.length<n;)i.push("0");for(;s.length<n;)s.push("0");for(let i=0;i<n;i++){const s=parseInt(e[i]),n=parseInt(t[i]);if(s>n)return 1;if(s<n)return-1}return 0},t.isError=e=>null!=e&&"symbol"==typeof e.errorCode,t.wrapErrorInfo=e=>({errorCode:e,errorMessage:e}),t.unionBy=(e,t)=>e.reduce((e,i)=>{const s=i[t];return e.some(e=>e[t]===s)||e.push(i),e},[]),t.isWXDevicesResult=function(e){return e.success&&"[object Array]"===Object.prototype.toString.call(e.bleDevices)},t.str2Buf=function(e){var t=e.length,i=new ArrayBuffer(t+2),s=new DataView(i);for(let i=0;i<t;i++)s.setUint8(i,parseInt(e[i],16));return i},t.numberArray2Uint8Array=e=>{const t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let s=0;s<t.byteLength;s++)i[s]=e[s];return i};function r(e){if(25!=(e=e.slice(0,25)).length)throw new Error("数据不合法");const t=`${c(e[0])}${c(e[1])}`;if(e[2]!==(255&e.slice(3).reduce((e,t)=>e+t,0)))throw new Error("校验和不合法");const i=c(e[3]),s=e.slice(5,5+e[4]).map(e=>c(e));return{mac:t,cmd:parseInt(i,16),data:s}}function o(e){return Array.prototype.map.call(new Uint8Array(e),(function(e){return e}))}function c(e,t=2){return`${new Array(t).fill(0).join("")}${e.toString(16)}`.slice(-t)}t.advertisData2PkAndMac=(e,t)=>e&&e.byteLength>=22&&e.byteLength<=24?Object.assign(Object.assign({},((e,t)=>{let i=e.slice(e.byteLength-16),s=e.slice(0,e.byteLength-16),r=n(i);if(t.find(e=>e===r)){const e=n(s);return{productKey:r,mac:e}}{i=e.slice(0,16),s=e.slice(16),r=n(i);const t=n(s);return{productKey:r,mac:t}}})(e,t)),{bleWorkStatus:1}):e&&e.byteLength>24?((e,t)=>{if(!e||0===e.byteLength)return{bleWorkStatus:0,mac:"",productKey:""};let i=0,s="",r="",o=1;const c=new Uint8Array(e);for(;!(i>e.byteLength-1);){const a=c[i];if(a<=0||!a)break;if(e.byteLength<a+i+1)break;const l=e.slice(i+1,i+a+1);if(a>=6&&a<=8&&(s=n(l),16==s.length&&(s=s.substring(0,15))),16==a){const e=n(l).toLowerCase();t.find(t=>t===e)&&(r=e)}1==a&&(o=new Uint8Array(l)[0]),i+=1+a}return{bleWorkStatus:o,mac:s,productKey:r}})(e,t):{mac:"",productKey:"",bleWorkStatus:1},t.isSameDevice=(e,t)=>e.mac===t.mac&&e.productKey===t.productKey,t.merageBleLocalDevices=(e,i)=>(i.map(i=>{const s=e.find(e=>t.isSameDevice(e,i));s?(s.isBleOnline=!0,s.bleDeviceID=i.bleDeviceID,s.bleWorkStatus=i.bleWorkStatus):e.push(i)}),e),t.merageLanLocalDevices=(e,i)=>(i.map(i=>{const s=e.find(e=>t.isSameDevice(e,i));s?s.isLanOnline=!0:e.push(i)}),e),t.BTDevice2GDevice=(e,i)=>{let n={productKey:"",mac:"",bleWorkStatus:0},c={did:"",productKey:"",mac:"",bleWorkStatus:0,connectType:"NONE",isBleOnline:!0,isLanOnline:!1,isOnline:!1,name:e.name,isBind:!1,bleDeviceID:e.deviceId,ctime:(new Date).getTime()};switch(e.communicationType){case"BLE_BROADCAST":try{s.default.log("parse BLE_BROADCAST");const t=r(o(e.advertisData));n.productKey=t.data.join(""),n.mac=t.mac,c.connectType="BLE_BROADCAST"}catch(e){}break;default:n=t.advertisData2PkAndMac(e.advertisData,i)}return c=Object.assign(Object.assign({},c),n),c},t.getFirstConnectType=(e,t)=>{if(!t)return e.isLanOnline?"LAN":e.isBleOnline?"BLE":"WAN";if("WAN"===t)return"WAN";switch(t){case"BLE":return e.isBleOnline?"BLE":"NONE";case"LAN":return e.isLanOnline?"LAN":"NONE"}return"WAN"},t.getProductInfoThroughPK=(e,t)=>t.find(t=>t.productKey===e),t.mergeObject=(e,t)=>{for(let i in t)null!=t[i]&&""!==t[i]&&(e[i]=t[i]);return e},t.hex2ab=function(e){const t=[];for(let s=0;s<e.length;s+=2){var i=e.slice(s,s+2);t.push(parseInt(i,16))}return new Uint8Array(t)},t.parseBroadcastData=r,t.ab2numbers=o;let a=0;function l(e,t){let i=1,s=t;return e.map(e=>{const t=65535&(e^s);return s=i-t&65535,i<<=1,c(t,4)})}function d(e,t,i){if(i.length>22)throw new Error("最大长度为22");const n=[...i,...new Array(22-i.length).fill(0)],r=255&i.reduce((e,t)=>e+t,0),o=(t>>4<<12)+(r>>4<<8)+((15&t)<<4)+(15&r),a=Array.from({length:11},(e,t)=>(n[2*t]<<8)+n[2*t+1]);return s.default.log("明文",c(e,4),c((t<<8)+r,4),a.map(e=>c(e,4))),[c(e,4),c((t<<8)+r,4),...l(a,o)].map(e=>`${e.slice(2)}${e.slice(0,2)}`)}t.encrypt=l,t.convertToServiceUuids=({len:e=null,data:i=null,index:s=0,mac:n})=>{const r=null==e?Math.round(18*Math.random())+1:e,o=null==i?Array.from({length:r},e=>Math.round(255*Math.random())):i,c=[147,r,...o],l=d(n,(()=>{const e=a;return a=a+1&255,e})(),c);return[...new Set(l)].length!==l.length?t.convertToServiceUuids({len:r,data:o,index:s++,mac:n}):l},t.convertToUuids=d},function(e,t,i){var s;e.exports=(s=i(0),i(11),i(36),i(37),i(7),i(38),i(8),i(14),i(20),i(39),i(21),i(40),i(41),i(42),i(15),i(43),i(5),i(1),i(44),i(45),i(46),i(47),i(48),i(49),i(50),i(51),i(52),i(53),i(54),i(55),i(56),i(57),i(58),i(59),s)},function(e,t,i){var s,n,r,o,c,a;e.exports=(a=i(0),n=(s=a).lib,r=n.Base,o=n.WordArray,(c=s.x64={}).Word=r.extend({init:function(e,t){this.high=e,this.low=t}}),c.WordArray=r.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,i=[],s=0;s<t;s++){var n=e[s];i.push(n.high),i.push(n.low)}return o.create(i,this.sigBytes)},clone:function(){for(var e=r.clone.call(this),t=e.words=this.words.slice(0),i=t.length,s=0;s<i;s++)t[s]=t[s].clone();return e}}),a)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=e=>new Promise(t=>setTimeout(()=>t(),e))},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(22),r=i(18),o=i(4);t.default=(e,t,i=!0)=>s(void 0,void 0,void 0,(function*(){const s=Object.assign({},t),c={"Content-Type":"application/json","X-Gizwits-Application-Id":r.getGlobalData("appID")};i&&(c["X-Gizwits-User-token"]=r.getGlobalData("token")),s.header=Object.assign(Object.assign({},c),t.headers),delete s.headers;const a=r.getGlobalData("cloudServiceInfo").openAPIInfo,l=yield n.default("https://"+a+e,s);if(l.statusCode>=200&&l.statusCode<300)return{success:!0,data:l.data};let d={success:!1,err:{errorCode:o.default.GIZ_SDK_HTTP_REQUEST_FAILED.errorCode,errorMessage:""}};try{d={success:!1,err:{errorCode:l.data.error_code,errorMessage:l.data.error_message}}}catch(e){}return d}))},function(e,t,i){var s,n,r,o,c,a,l,d;e.exports=(d=i(0),n=(s=d).lib,r=n.WordArray,o=n.Hasher,c=s.algo,a=[],l=c.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],n=i[1],r=i[2],o=i[3],c=i[4],l=0;l<80;l++){if(l<16)a[l]=0|e[t+l];else{var d=a[l-3]^a[l-8]^a[l-14]^a[l-16];a[l]=d<<1|d>>>31}var h=(s<<5|s>>>27)+c+a[l];h+=l<20?1518500249+(n&r|~n&o):l<40?1859775393+(n^r^o):l<60?(n&r|n&o|r&o)-1894007588:(n^r^o)-899497514,c=o,o=r,r=n<<30|n>>>2,n=s,s=h}i[0]=i[0]+s|0,i[1]=i[1]+n|0,i[2]=i[2]+r|0,i[3]=i[3]+o|0,i[4]=i[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(s+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),s.SHA1=o._createHelper(l),s.HmacSHA1=o._createHmacHelper(l),d.SHA1)},function(e,t,i){var s,n,r,o;e.exports=(s=i(0),r=(n=s).lib.Base,o=n.enc.Utf8,void(n.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=o.parse(t));var i=e.blockSize,s=4*i;t.sigBytes>s&&(t=e.finalize(t)),t.clamp();for(var n=this._oKey=t.clone(),r=this._iKey=t.clone(),c=n.words,a=r.words,l=0;l<i;l++)c[l]^=1549556828,a[l]^=909522486;n.sigBytes=r.sigBytes=s,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,i=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(i))}})))},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(13);const r=new class{constructor(){this.data={},this.key="dataPointConfig",this.init=()=>s(this,void 0,void 0,(function*(){const e=(yield wx.getStorageSync(this.key))||"{}";let t={};try{t=JSON.parse(e)}catch(e){}this.data=t})),this.getConfigFile=e=>s(this,void 0,void 0,(function*(){var t;if(!this.data[e]){const i=`/app/datapoint?product_key=${e}`,s=yield n.default(`${i}`,{method:"GET"});if(!s.success||!(null===(t=s.data)||void 0===t?void 0:t.entities))return null;this.data[e]=s.data,wx.setStorageSync(this.key,JSON.stringify(this.data))}return this.data[e]}))}};r.init(),t.default=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),i(31);const s=i(32),n=i(4);t.errorCode=n.default;const r=i(19);t.BleHandle=r.BleHandle,t.default=s.default},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s={};t.setGlobalData=function(e,t){s[e]=t},t.getGlobalData=function(e){return s[e]}},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))},n=this&&this.__rest||function(e,t){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(e);n<s.length;n++)t.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(e,s[n])&&(i[s[n]]=e[s[n]])}return i};Object.defineProperty(t,"__esModule",{value:!0});const r=i(9),o=i(23),c=i(24),a=i(3),l=i(6),d=i(25),h=i(60),u=i(26),f=i(2),p=i(27);class v extends p.default{constructor({pks:e=[],bleHandleParams:t={serviceUUIDSuffix:"abf0",characteristicUUIDSuffix:"abf7"},offlineThreshold:i}){super(),this.connectedList=[],this.connectingDevId=null,this.pks=[],this.listenDevOfflineTimer=null,this.boradcastDataCache={},this.tmpBleData="",this.tmpDataNum=0,this.peripheralServer=null,this.isActive=!0,this.scanList=[],this.onAppShow=()=>{this.isActive=!0,this.scanList.map(e=>{e.ctime=Date.now()})},this.onAppHide=()=>{this.isActive=!1},this.listenDevOffline=e=>{this.listenDevOfflineTimer=setInterval(()=>{if(!this.isActive)return;const t=(new Date).getTime(),i=this.scanList.filter(i=>{const s=this.connectedList.find(e=>i.bleDeviceID==e.deviceId),n=this.connectingDevId===i.bleDeviceID;return!(!s&&!n)||("BLE_BROADCAST"===i.connectType?t-i.ctime<2*e:t-i.ctime<e)});i.length!==this.scanList.length&&(this.scanList=i,this.notifyDevices())},500)},this.openBluetoothAdapter=(e="central")=>new Promise((t,i)=>{wx.openBluetoothAdapter({mode:e,success:()=>{t({success:!0}),wx.onBLECharacteristicValueChange(this.handleOnBLECharacteristicValueChange)},fail:e=>{f.default.error("openBluetoothAdapter fail",new Error(JSON.stringify(e))),this.notifyError({errMsg:e.errMsg,errCode:-1}),i({success:!1,err:e})}})}),this.handleOnBLECharacteristicValueChange=e=>{if(!e.value)return;const t=r.ab2hex(e.value);try{const i=new l.default(a.hexStrint2byte(t));this.tmpBleData=t,this.tmpDataNum=i.len-e.value.byteLength+4+Math.ceil(i.len.toString(2).length/8)}catch(i){this.tmpBleData&&(this.tmpBleData+=t,this.tmpDataNum-=e.value.byteLength)}this.tmpDataNum>0||!this.tmpBleData||(this.notiDeviceDataToSdk(e,this.tmpBleData),this.tmpBleData="",this.tmpDataNum=0)},this.notiDeviceDataToSdk=(e,t)=>{this.listenerMap.GizBleDeviceData&&this.listenerMap.GizBleDeviceData.map(i=>{i(e,t)})},this.notifyError=e=>{this.listenerMap.GizBleError&&this.listenerMap.GizBleError.map(t=>{t(e)})},this.notifyDevices=()=>{this.listenerMap.GizBleDeviceList&&this.listenerMap.GizBleDeviceList.map(e=>{e(this.scanList)})},this.listenConnection=e=>{wx.onBLEConnectionStateChange(t=>{const i=this.connectedList.map(e=>e.deviceId).includes(e)&&t.deviceId===e&&!1===t.connected;f.default.log("蓝牙状态变化",{connectedList:this.connectedList,res:t,deviceId:e}),i&&this.connectDevice(e)})},this.init=()=>s(this,void 0,void 0,(function*(){const{platform:e}=wx.getSystemInfoSync();yield this.openBluetoothAdapter(),"ios"===e&&(yield this.openBluetoothAdapter("peripheral"));try{this.peripheralServer=(yield wx.createBLEPeripheralServer()).server,f.default.info("GIZ_SDK: 广播初始化成功",this.peripheralServer)}catch(e){f.default.error("GIZ_SDK: 广播初始化失败",new Error(JSON.stringify(e)))}return yield this.getBluetoothAdapterState()})),this.checkPermission=()=>s(this,void 0,void 0,(function*(){if((yield wx.getSetting()).authSetting["scope.bluetooth"])return yield this.init();try{return yield wx.authorize({scope:"scope.bluetooth"}),yield this.init()}catch(e){f.default.log("授权失败",e),this.openBluetoothAdapter(),this.notifyError({errMsg:e.errMsg,errCode:-1})}})),this.getBluetoothAdapterState=()=>s(this,void 0,void 0,(function*(){f.default.log("getBluetoothAdapterState",yield wx.getBluetoothAdapterState());const e=yield wx.getBluetoothAdapterState(),{errMsg:t,available:i}=e,s=n(e,["errMsg","available"]);return{data:Object.assign({},s),err:r.wrapErrorInfo(t),success:i}})),this.getDeviceStatus=(e,t,i,n)=>s(this,void 0,void 0,(function*(){const s=yield h.default.pack(t,i,n);return s?yield this.write(e,r.numberArray2Uint8Array(s).buffer):{success:!1}})),this.updateDevice=e=>{const t=e.bleDeviceID,i=this.scanList.findIndex(e=>t==e.bleDeviceID);-1!==i&&(this.scanList[i]=e)},this.checkDeviceIsChange=(e,t)=>e.bleWorkStatus!==t.bleWorkStatus||e.name!==t.name||e.isBleOnline!==t.isBleOnline||e.isOnline!==t.isOnline,this.handleBluetoothDeviceFound=(e,t)=>{r.unionBy(e.devices,"deviceId").map(e=>{const{advertisData:i,deviceId:s,name:n,localName:o}=e,c=r.ab2hex(i);let a=null;try{a=r.parseBroadcastData(r.ab2numbers(i))}catch(e){}const l=this.scanList.find(e=>e.bleDeviceID===s);if(a&&148===a.cmd){const t=r.ab2hex(i);if(this.boradcastDataCache[s]&&this.boradcastDataCache[s]===t)return!1;if(!l)return!1;this.boradcastDataCache[s]=r.ab2hex(i);const n=u.padBoradcastData(a.data.map(e=>parseInt(e,16)));this.notiDeviceDataToSdk(e,n)}else{if(a&&25===a.cmd){this.pks.find(e=>e===a.data.join(""))&&(e.communicationType="BLE_BROADCAST")}if(l){const i=r.BTDevice2GDevice(e,this.pks);if(i.productKey&&i.mac){const e=this.checkDeviceIsChange(i,l);i.ctime=Date.now(),this.updateDevice(i),e&&t(this.scanList)}}else{if(this.pks.some(e=>c.includes(e))){const i=r.BTDevice2GDevice(e,this.pks);i.productKey&&i.mac&&(this.scanList.push(i),t(this.scanList))}}}})},this.startScan=(e,t=5e3)=>s(this,void 0,void 0,(function*(){return new Promise(i=>s(this,void 0,void 0,(function*(){wx.onBluetoothDeviceFound(t=>{this.handleBluetoothDeviceFound(t,e)}),f.default.debug("GIZ_SDK: start scan",t),yield wx.startBluetoothDevicesDiscovery({powerLevel:"high",allowDuplicatesKey:!0,interval:0}),t>0&&setTimeout(()=>{this.stopScan(),i({scanList:this.scanList})},t)})))})),this.stopScan=()=>s(this,void 0,void 0,(function*(){try{return yield wx.stopBluetoothDevicesDiscovery()}catch(e){return e}})),this.connectDevice=e=>s(this,void 0,void 0,(function*(){var t;try{this.connectingDevId=e;try{const t=yield o.retryConnect(e);t&&0==t.errCode&&"createBLEConnection:ok"===t.errMsg&&this.listenConnection(e)}catch(e){return f.default.error("GIZ_SDK: createBLEConnection error",new Error(JSON.stringify(e))),"createBLEConnection:fail:already connect"===(null==e?void 0:e.errMsg)?{success:!0}:(this.notifyError(e),{success:!1,message:null==e?void 0:e.errMsg})}const i=yield wx.getBLEDeviceServices({deviceId:e}).catch(e=>this.notifyError(e)),s=null===(t=null==i?void 0:i.services.find(e=>e.isPrimary&&e.uuid.toLowerCase().includes(this.serviceUUIDSuffix)))||void 0===t?void 0:t.uuid;if(!s)return{message:"can not find valid serviceId",success:!1};const n=yield wx.getBLEDeviceCharacteristics({deviceId:e,serviceId:s}).catch(e=>this.notifyError(e)),a=null==n?void 0:n.characteristics[0].uuid;this.connectedList.every(t=>t.deviceId!==e)&&this.connectedList.push({deviceId:e,serviceId:s,characteristicId:a}),yield wx.notifyBLECharacteristicValueChange({deviceId:e,serviceId:s,characteristicId:a,state:!0,type:"notification"}).catch(e=>this.notifyError(e)),this.write(e,r.numberArray2Uint8Array(c.default.pack()).buffer);const l=yield this.handleBindReq(e);if(f.default.log("handleBindReq",l),l.success){this.write(e,r.numberArray2Uint8Array(d.default.pack({passcode:l.data})).buffer);const t=yield this.handleLoginReq(e).catch(e=>this.notifyError(e));if(null==t?void 0:t.success)return{success:!0,message:"ok"}}else yield wx.closeBLEConnection({deviceId:e});return{success:!1,message:"ok"}}finally{this.connectingDevId=null}})),this.handleBindReq=e=>new Promise(t=>{const i=(s,n)=>{if(s.deviceId!==e)return;f.default.log("监听蓝牙特征值发生变化");const r=new c.default(a.hexStrint2byte(n));this.removeEventListener("GizBleDeviceData",i),r.passcode?t({success:!0,data:r.passcode}):t({success:!1,data:""})};this.watchBleDevice(e,i)}),this.handleLoginReq=e=>new Promise(t=>{const i=(s,n)=>{if(s.deviceId!==e)return;f.default.log("设备回复LoginReq",n);const r=new d.default(a.hexStrint2byte(n));this.removeEventListener("GizBleDeviceData",i),!0===r.result?t({success:!0,data:r.did}):t({success:!1,data:""})};this.watchBleDevice(e,i)}),this.watchBleDevice=(e,t)=>s(this,void 0,void 0,(function*(){const{serviceId:i,characteristicId:s,errMsg:n}=this.getTargetDevice(e);return n?{success:!1,message:n}:(yield wx.notifyBLECharacteristicValueChange({deviceId:e,serviceId:i,characteristicId:s,state:!0,type:"notification"}).catch(e=>this.notifyError(e)),f.default.log(`监听设备 ${e} 成功!`),this.addEventListener("GizBleDeviceData",t),{message:"ok",success:!0})})),this.writeBoradcast=(e,t)=>s(this,void 0,void 0,(function*(){const i=this.scanList.find(t=>t.bleDeviceID===e);if(!i)return{success:!1,message:"not found device"};this.boradcastTimer&&clearTimeout(this.boradcastTimer);try{this.peripheralServer.stopAdvertising({});const e=r.convertToServiceUuids({mac:i.mac,index:0,data:t,len:t.length});return this.peripheralServer.startAdvertising({advertiseRequest:{connectable:!0,serviceUuids:e},powerLevel:"high",success:e=>{f.default.debug("GIZ_SDK: startAdvertising success",e)},fail:e=>{f.default.error("GIZ_SDK: startAdvertising error",new Error(JSON.stringify(e)))}}),f.default.debug("GIZ_SDK: start adv",e),this.boradcastTimer=setTimeout(()=>{this.peripheralServer.stopAdvertising({}),this.boradcastTimer=null},1e3),{success:!0}}catch(e){return f.default.log("GIZ_SDK:",e),clearTimeout(this.boradcastTimer),{success:!1,message:"send cmd error"}}})),this.write=(e,t)=>s(this,void 0,void 0,(function*(){f.default.log("app => dev:",r.ab2hex(t));const i=this.getTargetDevice(e);if(i.serviceId&&i.characteristicId){return yield o.unpackWriteBLECharacteristicValue(e,i.serviceId,i.characteristicId,t)}return{success:!1,message:"send cmd error"}})),this.disConnectDevice=e=>s(this,void 0,void 0,(function*(){this.removeDevById(e);const{errMsg:t}=yield wx.closeBLEConnection({deviceId:e}),i=this.scanList.find(t=>t.bleDeviceID===e);return i&&(i.ctime=Date.now(),this.updateDevice(i)),"closeBLEConnection:ok"===t?{err:t,success:!0}:{err:t,success:!1}})),this.removeDevById=e=>{const t=this.connectedList.findIndex(t=>t.deviceId===e);-1!==t&&this.connectedList.splice(t,1)},this.getTargetDevice=e=>{const t=this.connectedList.find(t=>e===t.deviceId);return t||{errMsg:"Unable get this device,maybe you forgot to connect it."}},this.destory=()=>{this.listenDevOfflineTimer&&clearInterval(this.listenDevOfflineTimer),wx.offAppShow(this.onAppShow),wx.offAppHide(this.onAppHide)};const{serviceUUIDSuffix:p}=t;this.serviceUUIDSuffix=p,this.pks=e,this.listenDevOffline(null!=i?i:1e4),wx.onAppShow(this.onAppShow),wx.onAppHide(this.onAppHide)}}t.BleHandle=v},function(e,t,i){var s;e.exports=(s=i(0),function(e){var t=s,i=t.lib,n=i.WordArray,r=i.Hasher,o=t.algo,c=[],a=[];!function(){function t(t){for(var i=e.sqrt(t),s=2;s<=i;s++)if(!(t%s))return!1;return!0}function i(e){return 4294967296*(e-(0|e))|0}for(var s=2,n=0;n<64;)t(s)&&(n<8&&(c[n]=i(e.pow(s,.5))),a[n]=i(e.pow(s,1/3)),n++),s++}();var l=[],d=o.SHA256=r.extend({_doReset:function(){this._hash=new n.init(c.slice(0))},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],n=i[1],r=i[2],o=i[3],c=i[4],d=i[5],h=i[6],u=i[7],f=0;f<64;f++){if(f<16)l[f]=0|e[t+f];else{var p=l[f-15],v=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,g=l[f-2],y=(g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10;l[f]=v+l[f-7]+y+l[f-16]}var _=s&n^s&r^n&r,D=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),m=u+((c<<26|c>>>6)^(c<<21|c>>>11)^(c<<7|c>>>25))+(c&d^~c&h)+a[f]+l[f];u=h,h=d,d=c,c=o+m|0,o=r,r=n,n=s,s=m+(D+_)|0}i[0]=i[0]+s|0,i[1]=i[1]+n|0,i[2]=i[2]+r|0,i[3]=i[3]+o|0,i[4]=i[4]+c|0,i[5]=i[5]+d|0,i[6]=i[6]+h|0,i[7]=i[7]+u|0},_doFinalize:function(){var t=this._data,i=t.words,s=8*this._nDataBytes,n=8*t.sigBytes;return i[n>>>5]|=128<<24-n%32,i[14+(n+64>>>9<<4)]=e.floor(s/4294967296),i[15+(n+64>>>9<<4)]=s,t.sigBytes=4*i.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(d),t.HmacSHA256=r._createHmacHelper(d)}(Math),s.SHA256)},function(e,t,i){var s;e.exports=(s=i(0),i(11),function(){var e=s,t=e.lib.Hasher,i=e.x64,n=i.Word,r=i.WordArray,o=e.algo;function c(){return n.create.apply(n,arguments)}var a=[c(1116352408,3609767458),c(1899447441,602891725),c(3049323471,3964484399),c(3921009573,2173295548),c(961987163,4081628472),c(1508970993,3053834265),c(2453635748,2937671579),c(2870763221,3664609560),c(3624381080,2734883394),c(310598401,1164996542),c(607225278,1323610764),c(1426881987,3590304994),c(1925078388,4068182383),c(2162078206,991336113),c(2614888103,633803317),c(3248222580,3479774868),c(3835390401,2666613458),c(4022224774,944711139),c(264347078,2341262773),c(604807628,2007800933),c(770255983,1495990901),c(1249150122,1856431235),c(1555081692,3175218132),c(1996064986,2198950837),c(2554220882,3999719339),c(2821834349,766784016),c(2952996808,2566594879),c(3210313671,3203337956),c(3336571891,1034457026),c(3584528711,2466948901),c(113926993,3758326383),c(338241895,168717936),c(666307205,1188179964),c(773529912,1546045734),c(1294757372,1522805485),c(1396182291,2643833823),c(1695183700,2343527390),c(1986661051,1014477480),c(2177026350,1206759142),c(2456956037,344077627),c(2730485921,1290863460),c(2820302411,3158454273),c(3259730800,3505952657),c(3345764771,106217008),c(3516065817,3606008344),c(3600352804,1432725776),c(4094571909,1467031594),c(275423344,851169720),c(430227734,3100823752),c(506948616,1363258195),c(659060556,3750685593),c(883997877,3785050280),c(958139571,3318307427),c(1322822218,3812723403),c(1537002063,2003034995),c(1747873779,3602036899),c(1955562222,1575990012),c(2024104815,1125592928),c(2227730452,2716904306),c(2361852424,442776044),c(2428436474,593698344),c(2756734187,3733110249),c(3204031479,2999351573),c(3329325298,3815920427),c(3391569614,3928383900),c(3515267271,566280711),c(3940187606,3454069534),c(4118630271,4000239992),c(116418474,1914138554),c(174292421,2731055270),c(289380356,3203993006),c(460393269,320620315),c(685471733,587496836),c(852142971,1086792851),c(1017036298,365543100),c(1126000580,2618297676),c(1288033470,3409855158),c(1501505948,4234509866),c(1607167915,987167468),c(1816402316,1246189591)],l=[];!function(){for(var e=0;e<80;e++)l[e]=c()}();var d=o.SHA512=t.extend({_doReset:function(){this._hash=new r.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var i=this._hash.words,s=i[0],n=i[1],r=i[2],o=i[3],c=i[4],d=i[5],h=i[6],u=i[7],f=s.high,p=s.low,v=n.high,g=n.low,y=r.high,_=r.low,D=o.high,m=o.low,S=c.high,b=c.low,w=d.high,B=d.low,k=h.high,I=h.low,C=u.high,A=u.low,x=f,E=p,L=v,O=g,T=y,P=_,M=D,H=m,K=S,N=b,G=w,R=B,U=k,z=I,j=C,W=A,Z=0;Z<80;Z++){var F,V,$=l[Z];if(Z<16)V=$.high=0|e[t+2*Z],F=$.low=0|e[t+2*Z+1];else{var X=l[Z-15],J=X.high,q=X.low,Y=(J>>>1|q<<31)^(J>>>8|q<<24)^J>>>7,Q=(q>>>1|J<<31)^(q>>>8|J<<24)^(q>>>7|J<<25),ee=l[Z-2],te=ee.high,ie=ee.low,se=(te>>>19|ie<<13)^(te<<3|ie>>>29)^te>>>6,ne=(ie>>>19|te<<13)^(ie<<3|te>>>29)^(ie>>>6|te<<26),re=l[Z-7],oe=re.high,ce=re.low,ae=l[Z-16],le=ae.high,de=ae.low;V=(V=(V=Y+oe+((F=Q+ce)>>>0<Q>>>0?1:0))+se+((F+=ne)>>>0<ne>>>0?1:0))+le+((F+=de)>>>0<de>>>0?1:0),$.high=V,$.low=F}var he,ue=K&G^~K&U,fe=N&R^~N&z,pe=x&L^x&T^L&T,ve=E&O^E&P^O&P,ge=(x>>>28|E<<4)^(x<<30|E>>>2)^(x<<25|E>>>7),ye=(E>>>28|x<<4)^(E<<30|x>>>2)^(E<<25|x>>>7),_e=(K>>>14|N<<18)^(K>>>18|N<<14)^(K<<23|N>>>9),De=(N>>>14|K<<18)^(N>>>18|K<<14)^(N<<23|K>>>9),me=a[Z],Se=me.high,be=me.low,we=j+_e+((he=W+De)>>>0<W>>>0?1:0),Be=ye+ve;j=U,W=z,U=G,z=R,G=K,R=N,K=M+(we=(we=(we=we+ue+((he+=fe)>>>0<fe>>>0?1:0))+Se+((he+=be)>>>0<be>>>0?1:0))+V+((he+=F)>>>0<F>>>0?1:0))+((N=H+he|0)>>>0<H>>>0?1:0)|0,M=T,H=P,T=L,P=O,L=x,O=E,x=we+(ge+pe+(Be>>>0<ye>>>0?1:0))+((E=he+Be|0)>>>0<he>>>0?1:0)|0}p=s.low=p+E,s.high=f+x+(p>>>0<E>>>0?1:0),g=n.low=g+O,n.high=v+L+(g>>>0<O>>>0?1:0),_=r.low=_+P,r.high=y+T+(_>>>0<P>>>0?1:0),m=o.low=m+H,o.high=D+M+(m>>>0<H>>>0?1:0),b=c.low=b+N,c.high=S+K+(b>>>0<N>>>0?1:0),B=d.low=B+R,d.high=w+G+(B>>>0<R>>>0?1:0),I=h.low=I+z,h.high=k+U+(I>>>0<z>>>0?1:0),A=u.low=A+W,u.high=C+j+(A>>>0<W>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;return t[s>>>5]|=128<<24-s%32,t[30+(s+128>>>10<<5)]=Math.floor(i/4294967296),t[31+(s+128>>>10<<5)]=i,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(d),e.HmacSHA512=t._createHmacHelper(d)}(),s.SHA512)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return new Promise((i,s)=>{wx.request(Object.assign(Object.assign({url:e,timeout:3e3},t),{success:e=>{i(e)},fail:e=>{s(e)}}))})}},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(2),r=i(12);function o(e,t){return new Promise((i,s)=>{wx.createBLEConnection({deviceId:e,timeout:t,success:e=>i(e),fail:e=>{-1===e.errCode?i(e):s(e)}})})}function c(e,t,i,s){return new Promise(n=>{wx.writeBLECharacteristicValue({deviceId:e,serviceId:t,characteristicId:i,value:s,complete:n})})}t.retryConnect=function(e,t=1e4){return s(this,void 0,void 0,(function*(){try{return yield o(e,t)}catch(i){return yield r.default(500),yield o(e,t)}}))},t.openBluetoothAdapter=function(){return new Promise((e,t)=>{wx.openBluetoothAdapter({success:e,fail:t})})},t.closeBluetoothAdapter=function(){return new Promise((e,t)=>{wx.closeBluetoothAdapter({success:e,fail:t})})},t.getBluetoothAdapterState=function(){return new Promise((e,t)=>{wx.getBluetoothAdapterState({success:e,fail:t})})},t.startBluetoothDevicesDiscovery=function(e=!0){return new Promise((t,i)=>{wx.startBluetoothDevicesDiscovery({success:t,fail:i,allowDuplicatesKey:e,powerLevel:"high",interval:0})})},t.getBluetoothDevices=function(){return new Promise((e,t)=>{wx.getBluetoothDevices({success:({devices:t})=>e(t),fail:t})})},t.createBLEConnection=o,t.getBLEDeviceServices=function(e){return new Promise((t,i)=>{wx.getBLEDeviceServices({deviceId:e,success:({services:e})=>t(e),fail:i})})},t.getBLEDeviceCharacteristics=function(e,t){return new Promise((i,s)=>{wx.getBLEDeviceCharacteristics({deviceId:e,serviceId:t,success:({characteristics:e})=>i(e),fail:s})})},t.notifyBLECharacteristicValueChange=function(e,t,i,s=!0){return new Promise((n,r)=>{wx.notifyBLECharacteristicValueChange({deviceId:e,serviceId:t,characteristicId:i,state:s,success:n,fail:r})})},t.writeBLECharacteristicValue=c,t.unpackWriteBLECharacteristicValue=function(e,t,i,o){if(!o||0===o.byteLength)throw new Error("value is empty");return new Promise((a,l)=>s(this,void 0,void 0,(function*(){let s,d=0,h=o.byteLength;for(;h>0;){yield r.default(30);const a=o.slice(d,d+20);if(d+=20,h-=20,s=yield c(e,t,i,a),n.default.log("unpackWriteBLECharacteristicValue",d/20,s),0!==s.errCode)break}0!==s.errCode?l(s):a(s)})))}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(6),n=i(3);class r extends s.default{constructor(e){super(e),this.passcode="";let t=0;const i=parseInt(n.arrayToString(this.content.slice(t,t+2)),16);t+=2;let s="";this.content.slice(t,t+i).map(e=>{s+=String.fromCharCode(e)}),this.passcode=s}}r.pack=()=>[0,0,0,3,3,0,0,6],t.default=r},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(6),n=i(3);class r extends s.default{constructor(e){super(e),this.result=!1,this.didLength=0,this.did="";let t=0;if(this.result=0===this.content[0],t++,1===this.flag[0]){this.didLength=parseInt(n.arrayToString(this.content.slice(t,t+2)),16),t+=2;let e="";this.content.slice(t,this.content.length).map(t=>{e+=String.fromCharCode(t)}),this.did=e}}}r.pack=({passcode:e})=>{let t=[0];const i=n.hexStrint2byte(n.fillString(e.length.toString(16),4)),s=n.string2Bytes(e),r=[0].concat([0,8]).concat(i).concat(s);return t=n.hexStrint2byte(r.length.toString(16)),[0,0,0,3].concat(t).concat(r)},t.default=r},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(16),r=i(3),o=e=>{const t=r.fillString(e,8*Math.ceil(e.length/8)),i=[];for(let e=0;e<t.length;e+=8)i.push(parseInt(t.substring(e,e+8),2));return i},c=e=>-1!==e.indexOf("uint")?"number":e,a=(e,t,i)=>{let s="";switch(e){case"bool":s=`${!0===t[i.name]?1:0}`;break;case"enum":{let e=t[i.name];"number"==typeof e&&(e=i.enum[e]);const n=i.enum.findIndex(t=>e===t),o=-1===n?0:n;s=r.fillString(o.toString(2),i.position.len);break}case"number":{let e=0;null!=t[i.name]&&(e=Math.round((t[i.name]-i.uint_spec.addition)/i.uint_spec.ratio)),s=r.fillString(e.toString(2),8*i.position.len);break}case"binary":{const e=t[i.name]||"",n=r.fillString(e,2*i.position.len,!0);for(let e=0;e<n.length/2;e++){const t=2*e,i=n[t]+n[t+1];s+=r.fillString(parseInt(i,16).toString(2),8)}break}}const n=i.position.len*("byte"===i.position.unit?8:1)-s.length;if(n>0)for(let e=0;e<n;e++)s=`0${s}`;return`${s}`},l=(e,t,i)=>{switch(e){case"bool":return"1"===t;case"enum":return parseInt(t,2);case"binary":{const e=i.position.len;let s="";for(let e=0;e<t.length/8;e++){const i=8*e,n=t.substring(i,i+8);s+=r.fillString(parseInt(n,2).toString(16),2)}return r.fillString(s,2*e,!0)}case"number":return parseInt(t,2)/(1/i.uint_spec.ratio)+i.uint_spec.addition;default:return""}},d=({config:e,data:t,isAdaptiveDatapoint:i})=>{let s=e;const n=[0,0,0,3],l=[0],d=[0,147],u=[0,0,0,0];let f=[1],p="";const v=[];i||(s=s.filter(e=>"status_writable"===e.type)),s.map(e=>{void 0!==t[e.name]?(p=`1${p}`,v.push(e)):p=`0${p}`}),i&&(f=[17],s=v),p=r.fillString(p,8*Math.ceil(p.length/8));for(let e=0;e<p.length/8;e++)f.push(parseInt(p.substring(8*e,8*(e+1)),2));let g,y="";try{g=s[0]}catch(e){}s.map(e=>{"bool"===e.data_type||"enum"===e.data_type?(g.type!==e.type&&(f=f.concat(o(y)),y=""),y=((e,i)=>{const s=c(e.data_type);return i=a(s,t,e)+i})(e,y)):(y.length>0&&(f=f.concat(o(y)),y=""),f=((e,i)=>{const s=c(e.data_type),n=a(s,t,e);return i=i.concat(o(n))})(e,f)),g=e}),y.length>0&&(f=f.concat(o(y)),y="");const _=l.concat(d).concat(u).concat(f),D=h(_);return n.push(...D),{data:n.concat(_),raw:{header:[0,0,0,3],flag:l,len:D,headerCmd:d,sn:u,cmd:f}}};function h(e){const t=e.length.toString(2),i=[];for(let e=t.length;e>0;e-=7){const s=e-7,n=e;let r=t.substring(s,n);r=`${s>0?"1":"0"}${r}`,i.push(parseInt(r,2))}return i}function u(e,t){return e===t||"ALL"===e}function f({attrs:e,activeAttrs:t,flagString:i,cmdData:s,accumulate:n}){let r=0,o={},c=0;return["status_writable","status_readonly","alert","fault"].map(a=>{const l=e.filter(e=>u(a,e.type)).length,{cmd:d,cmdDataLength:h}=p({type:a,attrs:e.slice(c,c+l),activeAttrs:t,flagString:i.substring(c,c+l),cmdData:s.slice(r,s.length),accumulate:n});return r+=h,o=Object.assign(Object.assign({},o),d),c+=l,null}),o}function p({type:e,attrs:t,activeAttrs:i,cmdData:s,flagString:n,accumulate:o}){let a=0,d=0,h=0;return i.map(t=>{if(u(e,t.type)){const e=t.position.len*("bit"===t.position.unit?1:8);"bool"===t.data_type||"enum"===t.data_type?d+=e:h+=e}return null}),a=Math.ceil(h/8)+Math.ceil(d/8),{cmdDataLength:a,cmd:function({attrs:e,flagString:t,boolEnumLength:i,cmdData:s,accumulate:n}){const o={};let a=0;for(let d=0;d<t.length;d++)if(e[d]&&"1"===t[d]){const{data_type:t,position:{len:n}}=e[d];let h="";if("bool"===t||"enum"===t){let e="";s.slice(0,i).map(t=>(e+=r.fillString(t.toString(2),8),null));const t=e.length-a;h=e.substring(t-n,t),a+=n}else{const e=i,t=i+n;s.slice(e,t).map(e=>(h+=r.fillString(e.toString(2),8),null)),i+=n}const u=c(t);o[e[d].name]=l(u,h,e[d])}else if(n){const t=e[d]||{position:{len:0}};"byte"===t.position.unit?i+=t.position.len:a+=t.position.len}return o}({attrs:t,flagString:n,boolEnumLength:Math.ceil(d/8),cmdData:s,accumulate:o})}}t.unpack=(e,t)=>s(void 0,void 0,void 0,(function*(){const i=yield n.default.getConfigFile(t);return i?function({config:e=[],data:t}){let i,s,n="";const o={header:r.arrayToString(t.slice(0,4)),flag:"",len:"",cmd:"",sn:"",action:"",payload:""},c=e;let a=r.checkHeader(t);if(!1===a)return;const l=t.slice(a,t.length),d=r.getProtocolLen(l);if(a+=d,o.len=r.arrayToString(l.slice(0,d)),a+=1,o.flag=r.arrayToString(t.slice(a-1,a)),a+=2,o.cmd=r.arrayToString(t.slice(a-2,a)),o.sn="",("0093"===o.cmd||"0094"===o.cmd)&&(a+=4,o.sn=r.arrayToString(t.slice(a-4,a)),"01"===o.flag)){a+=2,a+=parseInt(r.arrayToString(t.slice(a-2,a)),16)}a+=1,o.action=r.arrayToString(t.slice(a-1,a)),i=parseInt(o.action,16),o.payload=r.arrayToString(t.slice(a,t.length));const h=t.slice(a,t.length);let u=c;1===i&&(u=c.filter(e=>"status_writable"===e.type));const v=JSON.parse(JSON.stringify(u)),g=Math.ceil(u.length/8);let y=h.slice(0,g),_=h.slice(g,h.length);3!==i&&4!==i||(y=new Array(g).fill(255),_=h);let D="";y.map(e=>(D+=r.fillString(e.toString(2),8),null)),i>=17&&i<=20&&(u=u.filter((e,t)=>{const i=D.length-1-t;return"1"===D[i]})),"0090"===o.cmd||"0093"===o.cmd?(n="App 透传数据到 Dev",s="APP2DEV"):"0091"===o.cmd||"0094"===o.cmd?(n="Dev 收到控制命令后应答到 App",s="DEV2APP"):(n="非法数据",s="UNKNOW");let m={};switch(i){case 1:n="App 下发数据到 Dev",m=f({attrs:v,activeAttrs:u,flagString:D.split("").reverse().join(""),cmdData:_,accumulate:!0});break;case 2:return n="App 下发查询指令到 Dev",{kvData:null,rawData:o,message:n,messageType:s};case 3:n="Dev 回复查询指令到 App",m=f({attrs:v,activeAttrs:u,flagString:D.split("").reverse().join(""),cmdData:_,accumulate:!0});break;case 4:n="Dev 上报状态到 App",m=f({attrs:v,activeAttrs:u,flagString:D.split("").reverse().join(""),cmdData:_,accumulate:!0});break;case 5:return n="App 透传数据到 Dev",{kvData:null,rawData:o,message:n,messageType:s};case 6:return n="Dev 透传数据到 App",{kvData:null,rawData:o,message:n,messageType:s};case 7:return n="App 下发控制子设备",{kvData:null,rawData:o,message:n,messageType:s};case 8:return n="App 读取子设备数据",{kvData:null,rawData:o,message:n,messageType:s};case 9:return n="Dev 中控回复ACK",{kvData:null,rawData:o,message:n,messageType:s};case 10:return n="子设备上报状态到 App",{kvData:null,rawData:o,message:n,messageType:s};case 11:return n="App 下发添加子设备指令",{kvData:null,rawData:o,message:n,messageType:s};case 12:return n="App 下发删除子设备",{kvData:null,rawData:o,message:n,messageType:s};case 13:return n="App 获取中控子设备列表",{kvData:null,rawData:o,message:n,messageType:s};case 14:return n="中控响应字设备查询到 App",{kvData:null,rawData:o,message:n,messageType:s};case 15:return n="子设备列表变更通知到 App",{kvData:null,rawData:o,message:n,messageType:s};case 16:return n="Dev 子设备上下线状态变更通知",{kvData:null,rawData:o,message:n,messageType:s};case 17:n="App 下发变长数据到 Dev",m=p({type:"ALL",attrs:v,activeAttrs:u,flagString:D.split("").reverse().join(""),cmdData:_}).cmd;break;case 18:return n="App 下发变长查询到 Dev",{kvData:null,rawData:o,message:n,messageType:s};case 19:n="Dev 变长回复查询指令到 App",m=p({type:"ALL",attrs:v,activeAttrs:u,flagString:D.split("").reverse().join(""),cmdData:_}).cmd;break;case 20:n="Dev 变长上报状态到 App",m=p({type:"ALL",attrs:v,activeAttrs:u,flagString:D.split("").reverse().join(""),cmdData:_}).cmd;break;case 114:return n="App 向网关发送数据",{kvData:null,rawData:o,message:n,messageType:s};case 115:return n="Dev 网关上报数据到 App",{kvData:null,rawData:o,message:n,messageType:s};case 116:return n="App 通知网关删除子设备",{kvData:null,rawData:o,message:n,messageType:s};default:return{kvData:null,rawData:o,message:n,messageType:s}}return 0===c.length?{kvData:null,rawData:o,message:n,messageType:s}:{kvData:m,rawData:o,message:n,messageType:s}}({config:(yield i).entities[0].attrs,data:e}):null}));t.pack=(e,t)=>s(void 0,void 0,void 0,(function*(){const i=yield n.default.getConfigFile(t);if(i){const t="var_len"===i.protocolType;return d({data:e,config:(yield i).entities[0].attrs,isAdaptiveDatapoint:t})}return null}));t.padBoradcastData=e=>{const t=[0].concat([0,147]).concat([0,0,0,0]).concat(e),i=h(t);return r.arrayToString([0,0,0,3].concat(i).concat(t))}},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.listenerMap={},this.addEventListener=(e,t)=>s(this,void 0,void 0,(function*(){return this.listenerMap[e]||(this.listenerMap[e]=[]),-1===this.listenerMap[e].indexOf(t)&&this.listenerMap[e].push(t),{success:!0}})),this.removeEventListener=(e,t)=>{if(this.listenerMap[e]){const i=this.listenerMap[e].indexOf(t);if(-1!==i)return this.listenerMap[e].splice(i,1),{success:!0}}return{success:!1}}}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(6),n=i(3);class r extends s.default{constructor(e){super(e)}}r.pack=(e,t)=>{const i=[],[s,r]=n.formatCodesFromStr(e),[o,c]=n.formatCodesFromStr(t),a=[0].concat([0,1],r,s,c,o);let l=a.length;for(;l>0;)i.push(l),l-=255;const d=[0,0,0,3].concat(i).concat(a),h=new ArrayBuffer(d.length),u=new Uint8Array(h);for(let e=0;e<h.byteLength;e++)u[e]=d[e];return u},t.default=r},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(12),r=i(4),o=i(30),c=i(2);t.default=class{constructor(e,t,i,a){this.ssid="",this.password="",this.specialProductKeys=[],this.disableSearchDevice=!1,this.specialProductKeySecrets=[],this.timeoutHandler=null,this.setDeviceOnboardingDeployRej=()=>{},this.cleanTimeout=()=>{this.disableSearchDevice=!0,this.timeoutHandler&&clearTimeout(this.timeoutHandler),this.timeoutHandler=null},this.stopDeviceOnboardingDeploy=()=>{this.setDeviceOnboardingDeployRej&&this.setDeviceOnboardingDeployRej({success:!1,err:r.default.GIZ_SDK_ONBOARDING_STOPPED}),this.cleanTimeout()},this.hasTimeoutHandler=e=>!!this.timeoutHandler&&(e&&e({success:!1,err:r.default.GIZ_SDK_DEVICE_CONFIG_IS_RUNNING}),!0),this.handleTimeout=()=>{this.setDeviceOnboardingDeployRej&&this.setDeviceOnboardingDeployRej({success:!1,err:{errorCode:r.default.CONFIG_TIME_OUT,errorMessage:"time out"}}),this.timeoutHandler=null},this.searchDevice=({ssid:e,password:t})=>new Promise((i,a)=>{c.default.debug("GIZ_SDK: 开始大循环搜索设备");const l=()=>s(this,void 0,void 0,(function*(){var s;if(this.hasTimeoutHandler())try{const d=yield o.checkDeviceRegister({SSID:e,password:t,productKeys:this.specialProductKeys});if((null===(s=d.err)||void 0===s?void 0:s.errorCode)===r.default.GIZ_OPENAPI_TOKEN_INVALID.errorCode)return void a({success:!1,err:r.default.GIZ_OPENAPI_TOKEN_INVALID});d.err||0===d.data.length?(c.default.debug("GIZ_SDK: 大循环没有发现设备"),yield n.default(1500),!this.disableSearchDevice&&l()):(c.default.debug("GIZ_SDK: 大循环搜索到设备",d),i({success:!0,data:d.data}))}catch(e){yield n.default(3e3),!this.disableSearchDevice&&l()}}));l()}),this.initDeviceOnboardingDeploy=(e,t)=>{this.setDeviceOnboardingDeployRej=e,this.disableSearchDevice=!1},this.startTimeoutTimer=e=>{this.timeoutHandler=setTimeout(this.handleTimeout,1e3*e)},this.bindDevices=e=>(c.default.log("GIZ_SDK: start bind device"),new Promise((t,i)=>s(this,void 0,void 0,(function*(){const s=e.map(e=>{const t=this.specialProductKeys.findIndex(t=>e.productKey===t);if(-1===t)return;const i=this.specialProductKeySecrets[t];return o.bindMac({mac:e.mac,productKey:e.productKey,productSecret:i})});try{const n=yield Promise.all(s),o=e.filter((e,t)=>{const i=n[t];return i&&i.success});o.length>0?(c.default.log("GIZ_SDK: bind device success",o),t({success:!0,data:o})):(c.default.log("GIZ_SDK: bind device error",n),i({success:!1,data:e,err:r.default.GIZ_SDK_BIND_DEVICE_FAILED}))}catch(e){i(e)}})))),this.ssid=e,this.password=t,this.specialProductKeys=i,this.specialProductKeySecrets=a}}},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(13),r=i(63),o=i(64),c=i(10);t.getBindingList=()=>s(void 0,void 0,void 0,(function*(){const e=yield n.default("/app/bindings?show_disabled=0&limit=1000&skip=0",{method:"GET"});if(e.success){return{success:!0,data:e.data.devices.map(e=>({productKey:e.product_key,mac:e.mac,did:e.did,host:e.host,port_s:e.port_s,port:e.port,ws_port:e.ws_port,wss_port:e.wss_port,isBleOnline:!1,isLanOnline:!1,connectType:"NONE",name:e.dev_alias,isBind:!0,isOnline:e.is_online}))}}return{success:!1,err:e.err}})),t.bindMac=function({mac:e,productKey:t,productSecret:i,alias:r,beOwner:c}){return s(this,void 0,void 0,(function*(){const s={mac:e,product_key:t,dev_alias:r,set_owner:c},{Signature:a,timestamp:l}=o.psKeySign(i);return yield n.default("/app/bind_mac",{method:"POST",data:s,headers:{"X-Gizwits-Signature":a,"X-Gizwits-Timestamp":l}})}))},t.unbindDevice=function({devices:e}){return s(this,void 0,void 0,(function*(){return yield n.default("/app/bindings",{method:"DELETE",data:{devices:e.map(e=>({did:e.did}))}})}))},t.checkDeviceRegister=function({SSID:e,password:t,productKeys:i}){return s(this,void 0,void 0,(function*(){const s=r.default({SSID:e,password:t,pks:i});let o="";return s.map(e=>{o+=`${e},`}),o=o.substring(0,o.length-1),yield n.default(`/app/device_register?random_codes=${o}`,{method:"get"})}))},t.safeRegister=function({productKey:e,productSecret:t,mac:i,passcode:r,gwDid:o,isReset:a}){return s(this,void 0,void 0,(function*(){let s=`is_reset=${a?1:0}&mac=${i}&passcode=${r}`;o&&(s+=`&gw_did=${o}`);const l=c.enc.Hex.parse(t),d=c.enc.Hex.parse(""),h=c.enc.Utf8.parse(s),u=c.AES.encrypt(h,l,{iv:d,mode:c.mode.ECB,padding:c.pad.Pkcs7}).ciphertext.toString().toUpperCase(),f=yield n.default(`/dev/${e}/device`,{method:"POST",data:{data:u},headers:{"content-type":"application/x-www-form-urlencoded"}},!1);return f.success?{success:!0,data:{successDevices:[],failedDevices:[]}}:{success:!1,err:f.err}}))}},function(e,t){},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(18),r=i(19),o=i(61),c=i(62),a=i(65),l=i(2),d=i(17),h=i(66),u=i(30),f=i(9),p=i(16),v=i(26),g=i(3),y=i(67);t.default=class{constructor({appID:e,appSecret:t,productInfo:i,cloudServiceInfo:r,token:o,uid:y,offlineThreshold:_}){this.version="3.1.11-1",this.listenerMap={},this.keepScanTimer=null,this._deviceList=[],this._bleDevices=[],this._lanDevices=[],this.productInfo=[],this.handleBleError=e=>{this.listenerMap.onBleHandleError&&this.listenerMap.onBleHandleError.map(t=>{t(e)})},this.handleBleDevices=e=>{l.default.log("handleBleDevices",e),this.bleDevices=e},this.handleLanDevices=e=>{this.lanDevices=e},this.handleBleDeviceData=(e,t)=>s(this,void 0,void 0,(function*(){const i=this.allDevices.find(t=>t.bleDeviceID===e.deviceId);if(i){const e=yield v.unpack(g.hexStrint2byte(t),i.productKey);(null==e?void 0:e.kvData)&&this.listenerMap.GizDeviceAttrsNotifications&&this.listenerMap.GizDeviceAttrsNotifications.map(t=>{t({device:i,data:null==e?void 0:e.kvData})})}})),this.handleSocketDeviceData=e=>{const t=this.allDevices.find(t=>t.did===e.did);if(t){if(e.attrs&&null!=e.attrs.is_online){const i=e.attrs.is_online;this.setDeviceMeta(t,"isOnline",i)}this.listenerMap.GizDeviceAttrsNotifications&&this.listenerMap.GizDeviceAttrsNotifications.map(i=>{i(Object.assign({device:t},"attrs"in e?{data:e.attrs}:{raw:e.raw}))})}},this.handleSocketStatus=(e,t)=>{const i=this.allDevices.filter(t=>e.includes(t.did)&&"WAN"===t.connectType);l.default.log("handleSocketStatus",e,t),i.forEach(e=>{this.setDeviceMeta(e,"connectType",t?"NONE":"WAN")})},this.notiDeviceList=()=>{var e,t;null===(e=this.listenerMap.GizDeviceListNotifications)||void 0===e||e.map(e=>{e(this.allDevices)}),null===(t=this.listenerMap.onScanListChange)||void 0===t||t.map(e=>{e(this.bleScanDevice)})},this.initLan=()=>{this.lanHandle.init(),this.lanHandle.addEventListener("GizLanDeviceList",this.handleLanDevices)},this.startAutoScan=()=>{this.keepScanTimer||(this.keepScanTimer=setInterval(()=>s(this,void 0,void 0,(function*(){this.bleHandle.startScan(e=>{this.bleDevices=e},-1)})),3e3),this.bleHandle.startScan(e=>{this.bleDevices=e},-1))},this.stopAutoScan=()=>{this.keepScanTimer&&clearInterval(this.keepScanTimer),this.bleHandle.stopScan()},this.setDeviceMeta=(e,t,i,s=!1)=>{const n=this.allDevices.find(t=>t.mac===e.mac);n&&0!==this.allDevices.length&&(e[t]!==i||s)&&(n[t]=i,this.notiDeviceList())},this.getVersion=()=>({success:!0,data:this.version}),this.initBle=()=>s(this,void 0,void 0,(function*(){const e=yield this.bleHandle.checkPermission();return e.success?(this.bleHandle.addEventListener("GizBleDeviceData",this.handleBleDeviceData),this.bleHandle.addEventListener("GizBleDeviceList",this.handleBleDevices),this.bleHandle.addEventListener("GizBleError",this.handleBleError),l.default.debug("init BLE succcess",e),{success:!0}):(l.default.error("init BLE Error",new Error(JSON.stringify(e))),{success:!1,err:d.errorCode.GIZ_SDK_BLE_BLUETOOTH_FUNCTION_NOT_TURNED_ON})})),this.scanBleDevice=e=>s(this,void 0,void 0,(function*(){return this.bleHandle.scanList=[],{success:!0,data:(yield this.bleHandle.startScan(e=>{this.bleDevices=e},e)).scanList}})),this.write=(e,t)=>s(this,void 0,void 0,(function*(){const i=this.allDevices.find(t=>f.isSameDevice(t,e));if(!i)return{success:!1,message:"target is undefind"};if("NONE"!==i.connectType){const{data:e,raw:s}=yield v.pack(t,i.productKey);switch(i.connectType){case"BLE_BROADCAST":return yield this.bleHandle.writeBoradcast(i.bleDeviceID,s.cmd);case"BLE":return e?yield this.bleHandle.write(i.bleDeviceID,f.numberArray2Uint8Array(e).buffer):{success:!1};case"WAN":return this.socketHandle.writeData(i,t);case"LAN":return this.lanHandle.write(i,f.numberArray2Uint8Array(e).buffer)}}return{success:!1}})),this.writeRaw=(e,t)=>s(this,void 0,void 0,(function*(){const i=this.allDevices.find(t=>f.isSameDevice(t,e));if(!i)return{success:!1,message:"target is undefind"};if("NONE"!==i.connectType)switch(i.connectType){case"BLE_BROADCAST":return yield this.bleHandle.writeBoradcast(i.bleDeviceID,t);case"BLE":return t?yield this.bleHandle.write(i.bleDeviceID,f.numberArray2Uint8Array(t).buffer):{success:!1};case"WAN":return this.socketHandle.send(i.did,t);case"LAN":return this.lanHandle.write(i,f.numberArray2Uint8Array(t).buffer)}return{success:!1}})),this.getProductConfig=e=>s(this,void 0,void 0,(function*(){const t=yield p.default.getConfigFile(e);return t?{success:!0,data:t}:{success:!1}})),this.stopScanBleDevice=()=>{this.bleHandle.stopScan()},this.login=e=>s(this,void 0,void 0,(function*(){var t,i;const s=yield h.AnonymousLogin({uid:e});return s.success&&(n.setGlobalData("token",null===(t=s.data)||void 0===t?void 0:t.token),n.setGlobalData("uid",null===(i=s.data)||void 0===i?void 0:i.uid)),s})),this.getDeviceStatus=(e,t)=>s(this,void 0,void 0,(function*(){const i=this.allDevices.find(t=>f.isSameDevice(t,e));if(!i)return{success:!1,message:"target is undefind"};switch(i.connectType){case"BLE":return yield this.bleHandle.getDeviceStatus(i.bleDeviceID,i.productKey,i.rootDeviceId,t);case"WAN":return this.socketHandle.readStatus(i,t);default:return{success:!1,message:"Device connectType is unsupported"}}})),this.subscribe=(e,t,i=!0)=>s(this,void 0,void 0,(function*(){l.default.debug("subscribe device:",e);let i=this.allDevices.find(t=>f.isSameDevice(t,e));if(!i)return l.default.warn("Device Target Not Found"),{success:!1};if("BLE_BROADCAST"===i.connectType)return{success:!0};const s=f.getFirstConnectType(i,t);switch("NONE"!==i.connectType&&i.connectType!==s&&(yield this.unSubscribe(i)),s){case"BLE":{const e=yield this.bleHandle.connectDevice(i.bleDeviceID);return e.success&&(this.setDeviceMeta(i,"connectType","BLE",!0),setTimeout(()=>{this.getDeviceStatus(i)},500)),e}case"WAN":{const t=this.socketHandle.connectDevice(i);return t.success&&this.setDeviceMeta(e,"connectType","WAN",!0),t}case"LAN":{const t=yield this.lanHandle.connectDevice(i);return t.success&&this.setDeviceMeta(e,"connectType","LAN",!0),t}}return{success:!1}})),this.unSubscribe=e=>s(this,void 0,void 0,(function*(){const t=this.allDevices.find(t=>f.isSameDevice(t,e));switch(t.connectType){case"BLE":{const e=yield this.bleHandle.disConnectDevice(t.bleDeviceID);return e.success&&this.setDeviceMeta(t,"connectType","NONE",!0),e}case"WAN":{const e=this.socketHandle.disConnectDevice(t);return e.success&&this.setDeviceMeta(t,"connectType","NONE",!0),e}case"LAN":{const e=this.lanHandle.disConnectDevice(t);return e.success&&this.setDeviceMeta(t,"connectType","NONE",!0),e}}return{success:!1}})),this.bindRemoteDevice=({mac:e,productKey:t,alias:i,beOwner:n})=>s(this,void 0,void 0,(function*(){const s=f.getProductInfoThroughPK(t,this.productInfo);if(s){const r=yield u.bindMac({mac:e,productKey:t,productSecret:s.productSecret,alias:i,beOwner:n});return this.getBindingList(),r}return{success:!1,err:d.errorCode.GIZ_SDK_PRODUCTKEY_NOT_IN_SPECIFY}})),this.unbindDevice=({devices:e})=>s(this,void 0,void 0,(function*(){const t=yield u.unbindDevice({devices:e});return t.success&&this.getBindingList(),t})),this.deviceSafetyRegister=({mac:e,productKey:t})=>s(this,void 0,void 0,(function*(){return yield this.deviceSafetyApi({mac:e,productKey:t,isReset:!1})})),this.deviceSafetyUnbind=({mac:e,productKey:t})=>s(this,void 0,void 0,(function*(){return yield this.deviceSafetyApi({mac:e,productKey:t,isReset:!0})})),this.setDeviceOnboardingDeploy=({ssid:e,password:t,mode:i=0,timeout:n,isBind:r=!0,softAPSSIDPrefix:o})=>s(this,void 0,void 0,(function*(){if(this.currentWifiConfigHandle)return{success:!1,err:d.errorCode.GIZ_SDK_DEVICE_CONFIG_IS_RUNNING};const s=(new Date).getTime();l.default.debug("GIZ_SDK: 配网开始时间:"+s);try{switch(i){case 0:{this.currentWifiConfigHandle=new c.default(e,t,this.specialProductKeys,this.specialProductKeySecrets);const i=yield this.currentWifiConfigHandle.setDeviceOnboardingDeploy({timeout:n,isBind:r,softAPSSIDPrefix:o});this.currentWifiConfigHandle=null;const a=(new Date).getTime();return l.default.debug("GIZ_SDK: 配网结束时间:"+a),l.default.debug("GIZ_SDK: 配网用时:"+(a-s)),i}case 3:{this.currentWifiConfigHandle=new a.default(e,t,this.specialProductKeys,this.specialProductKeySecrets);const i=yield this.currentWifiConfigHandle.setDeviceOnboardingDeploy({timeout:n,isBind:r,softAPSSIDPrefix:o});this.currentWifiConfigHandle=null;const c=(new Date).getTime();return l.default.debug("GIZ_SDK: 配网结束时间:"+c),l.default.debug("GIZ_SDK: 配网用时:"+(c-s)),i}}}catch(e){return l.default.error("GIZ_SDK: setDeviceOnboardingDeploy",new Error(JSON.stringify(e))),e.err&&e.err.errorCode?e:{success:!1,err:d.errorCode.GIZ_SDK_OTHERWISE}}finally{this.currentWifiConfigHandle=null}})),this.setDomain=e=>{const t=e&&e.openAPIInfo||"api.gizwits.com",i=Object.assign(Object.assign({},e||{}),{openAPIInfo:t});n.setGlobalData("cloudServiceInfo",i)},this.deviceSafetyApi=({mac:e,productKey:t,isReset:i})=>s(this,void 0,void 0,(function*(){const s=f.getProductInfoThroughPK(t,this.productInfo);return s?yield u.safeRegister({productKey:t,productSecret:s.productSecret,mac:e,isReset:i,passcode:"1234567890"}):{success:!1,err:d.errorCode.GIZ_SDK_PRODUCTKEY_NOT_IN_SPECIFY}})),this.getBindingList=()=>s(this,void 0,void 0,(function*(){const e=yield u.getBindingList();return this.deviceList=e.data||[],e})),this.getDevices=()=>s(this,void 0,void 0,(function*(){return yield this.getBindingList(),{success:!0,data:this.allDevices}})),this.stopDeviceOnboardingDeploy=()=>{this.currentWifiConfigHandle&&(this.currentWifiConfigHandle.stopDeviceOnboardingDeploy(),this.currentWifiConfigHandle=null)},this.setLogLevel=e=>l.default.setLogLevel(e),this.removeEventListener=(e,t)=>{if(this.listenerMap[e]){const i=this.listenerMap[e].indexOf(t);if(-1!==i)return this.listenerMap[e].splice(i,1),{success:!0}}return{success:!1}},this.addEventListener=(e,t)=>s(this,void 0,void 0,(function*(){return this.listenerMap[e]||(this.listenerMap[e]=[]),-1===this.listenerMap[e].indexOf(t)&&this.listenerMap[e].push(t),{success:!0}})),this.destory=()=>{this.bleHandle.destory(),this.lanHandle.destory(),this.socketHandle.destory(),this.keepScanTimer&&clearInterval(this.keepScanTimer)},this.productInfo=i,n.setGlobalData("appID",e),n.setGlobalData("appSecret",t),n.setGlobalData("productInfo",i),n.setGlobalData("token",o),n.setGlobalData("uid",y),this.setDomain(r),this.offlineThreshold=_,l.default.debug(`init sdk success, current version: ${this.version}`),this.initLan()}get deviceList(){return this._deviceList}set deviceList(e){this._deviceList=e,this.notiDeviceList()}get bleDevices(){return this._bleDevices}set bleDevices(e){this._bleDevices=e,this.notiDeviceList()}get lanDevices(){return this._lanDevices}set lanDevices(e){this._lanDevices=e,this.notiDeviceList()}get allDevices(){let e=f.merageBleLocalDevices([...this.deviceList],this.bleDevices);e=f.merageLanLocalDevices(e,this.lanDevices),this.bleHandle.connectedList.map(t=>{const i=e.findIndex(e=>e.bleDeviceID===t.deviceId);-1!==i&&(e[i].connectType="BLE")});const t=this.socketHandle._connections;return Object.keys(t).forEach(i=>{const s=t[i];s&&s._subDids.forEach(t=>{const i=e.findIndex(e=>e.did===t);-1!==i&&(e[i].connectType="WAN")})}),this.lanHandle.connectedList.map(t=>{const i=e.findIndex(e=>e.mac===t.mac&&e.productKey===t.productKey);-1!==i&&(e[i].connectType="LAN")}),e}get bleScanDevice(){return this.bleDevices.filter(e=>!0===e.isBleOnline)}get bleHandle(){return this._bleHandle||(this._bleHandle=new r.BleHandle({pks:this.specialProductKeys,offlineThreshold:this.offlineThreshold})),this._bleHandle}get lanHandle(){return this._lanHandle||(this._lanHandle=new y.LanHandle({pks:this.specialProductKeys})),this._lanHandle}get socketHandle(){return this._gizSocket||(this._gizSocket=new o.default({appID:n.getGlobalData("appID"),token:n.getGlobalData("token"),uid:n.getGlobalData("uid")}),this._gizSocket.subscribeDeviceStatus(this.handleSocketDeviceData),this._gizSocket.subscribeBindingChanged(this.getBindingList),this._gizSocket.subscribeSocketStatus(this.handleSocketStatus)),this._gizSocket}get specialProductKeys(){return this.productInfo.map(e=>{var t;return null!==(t=e.productKey)&&void 0!==t?t:""})}get specialProductKeySecrets(){return this.productInfo.map(e=>{var t;return null!==(t=e.productSecret)&&void 0!==t?t:""})}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(10),n=i(22);t.default=e=>{const t=wx.getSystemInfoSync(),i={exception:{values:[{type:"Error",value:e.stack,stacktrace:{},mechanism:{type:"generic",handled:!0}}]},level:"error",event_id:s.MD5(`${(new Date).getTime()}`).toString(),platform:"javascript",sdk:{},timestamp:(new Date).getTime()/1e3,environment:"production",contexts:{device:{},os:{name:t.platform,version:t.version},extra:{}},extra:{message:e.message}};var r={method:"POST",headers:{Connection:"keep-alive","User-Agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1 wechatdevtools/1.06.2206090 MicroMessenger/8.0.5 Language/zh_CN webview/","content-type":"application/json",Accept:"*/*","Sec-Fetch-Site":"cross-site","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty",Referer:"https://servicewechat.com/wx6dc8e50cb68bc121/devtools/page-frame.html",Cookie:"__org="},data:JSON.stringify(i)};n.default("https://appmonitor.gizwits.com/api/21/store/?sentry_key=0b2de791abf548a1bedf0b0ebdd8ecc7&sentry_version=7",r)}},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t){},function(e,t,i){var s;e.exports=(s=i(0),function(){if("function"==typeof ArrayBuffer){var e=s.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var i=e.byteLength,s=[],n=0;n<i;n++)s[n>>>2]|=e[n]<<24-n%4*8;t.call(this,s,i)}else t.apply(this,arguments)}).prototype=e}}(),s.lib.WordArray)},function(e,t,i){var s;e.exports=(s=i(0),function(){var e=s,t=e.lib.WordArray,i=e.enc;function n(e){return e<<8&4278255360|e>>>8&16711935}i.Utf16=i.Utf16BE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],n=0;n<i;n+=2){var r=t[n>>>2]>>>16-n%4*8&65535;s.push(String.fromCharCode(r))}return s.join("")},parse:function(e){for(var i=e.length,s=[],n=0;n<i;n++)s[n>>>1]|=e.charCodeAt(n)<<16-n%2*16;return t.create(s,2*i)}},i.Utf16LE={stringify:function(e){for(var t=e.words,i=e.sigBytes,s=[],r=0;r<i;r+=2){var o=n(t[r>>>2]>>>16-r%4*8&65535);s.push(String.fromCharCode(o))}return s.join("")},parse:function(e){for(var i=e.length,s=[],r=0;r<i;r++)s[r>>>1]|=n(e.charCodeAt(r)<<16-r%2*16);return t.create(s,2*i)}}}(),s.enc.Utf16)},function(e,t,i){var s,n,r;e.exports=(r=i(0),n=(s=r).lib.WordArray,s.enc.Base64url={stringify:function(e,t=!0){var i=e.words,s=e.sigBytes,n=t?this._safe_map:this._map;e.clamp();for(var r=[],o=0;o<s;o+=3)for(var c=(i[o>>>2]>>>24-o%4*8&255)<<16|(i[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|i[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<s;a++)r.push(n.charAt(c>>>6*(3-a)&63));var l=n.charAt(64);if(l)for(;r.length%4;)r.push(l);return r.join("")},parse:function(e,t=!0){var i=e.length,s=t?this._safe_map:this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var o=0;o<s.length;o++)r[s.charCodeAt(o)]=o}var c=s.charAt(64);if(c){var a=e.indexOf(c);-1!==a&&(i=a)}return function(e,t,i){for(var s=[],r=0,o=0;o<t;o++)if(o%4){var c=i[e.charCodeAt(o-1)]<<o%4*2,a=i[e.charCodeAt(o)]>>>6-o%4*2,l=c|a;s[r>>>2]|=l<<24-r%4*8,r++}return n.create(s,r)}(e,i,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},r.enc.Base64url)},function(e,t,i){var s,n,r,o,c,a;e.exports=(a=i(0),i(20),n=(s=a).lib.WordArray,r=s.algo,o=r.SHA256,c=r.SHA224=o.extend({_doReset:function(){this._hash=new n.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=o._doFinalize.call(this);return e.sigBytes-=4,e}}),s.SHA224=o._createHelper(c),s.HmacSHA224=o._createHmacHelper(c),a.SHA224)},function(e,t,i){var s,n,r,o,c,a,l,d;e.exports=(d=i(0),i(11),i(21),n=(s=d).x64,r=n.Word,o=n.WordArray,c=s.algo,a=c.SHA512,l=c.SHA384=a.extend({_doReset:function(){this._hash=new o.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var e=a._doFinalize.call(this);return e.sigBytes-=16,e}}),s.SHA384=a._createHelper(l),s.HmacSHA384=a._createHmacHelper(l),d.SHA384)},function(e,t,i){var s;e.exports=(s=i(0),i(11),function(e){var t=s,i=t.lib,n=i.WordArray,r=i.Hasher,o=t.x64.Word,c=t.algo,a=[],l=[],d=[];!function(){for(var e=1,t=0,i=0;i<24;i++){a[e+5*t]=(i+1)*(i+2)/2%64;var s=(2*e+3*t)%5;e=t%5,t=s}for(e=0;e<5;e++)for(t=0;t<5;t++)l[e+5*t]=t+(2*e+3*t)%5*5;for(var n=1,r=0;r<24;r++){for(var c=0,h=0,u=0;u<7;u++){if(1&n){var f=(1<<u)-1;f<32?h^=1<<f:c^=1<<f-32}128&n?n=n<<1^113:n<<=1}d[r]=o.create(c,h)}}();var h=[];!function(){for(var e=0;e<25;e++)h[e]=o.create()}();var u=c.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var i=this._state,s=this.blockSize/2,n=0;n<s;n++){var r=e[t+2*n],o=e[t+2*n+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(A=i[n]).high^=o,A.low^=r}for(var c=0;c<24;c++){for(var u=0;u<5;u++){for(var f=0,p=0,v=0;v<5;v++)f^=(A=i[u+5*v]).high,p^=A.low;var g=h[u];g.high=f,g.low=p}for(u=0;u<5;u++){var y=h[(u+4)%5],_=h[(u+1)%5],D=_.high,m=_.low;for(f=y.high^(D<<1|m>>>31),p=y.low^(m<<1|D>>>31),v=0;v<5;v++)(A=i[u+5*v]).high^=f,A.low^=p}for(var S=1;S<25;S++){var b=(A=i[S]).high,w=A.low,B=a[S];B<32?(f=b<<B|w>>>32-B,p=w<<B|b>>>32-B):(f=w<<B-32|b>>>64-B,p=b<<B-32|w>>>64-B);var k=h[l[S]];k.high=f,k.low=p}var I=h[0],C=i[0];for(I.high=C.high,I.low=C.low,u=0;u<5;u++)for(v=0;v<5;v++){var A=i[S=u+5*v],x=h[S],E=h[(u+1)%5+5*v],L=h[(u+2)%5+5*v];A.high=x.high^~E.high&L.high,A.low=x.low^~E.low&L.low}A=i[0];var O=d[c];A.high^=O.high,A.low^=O.low}},_doFinalize:function(){var t=this._data,i=t.words,s=(this._nDataBytes,8*t.sigBytes),r=32*this.blockSize;i[s>>>5]|=1<<24-s%32,i[(e.ceil((s+1)/r)*r>>>5)-1]|=128,t.sigBytes=4*i.length,this._process();for(var o=this._state,c=this.cfg.outputLength/8,a=c/8,l=[],d=0;d<a;d++){var h=o[d],u=h.high,f=h.low;u=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),l.push(f),l.push(u)}return new n.init(l,c)},clone:function(){for(var e=r.clone.call(this),t=e._state=this._state.slice(0),i=0;i<25;i++)t[i]=t[i].clone();return e}});t.SHA3=r._createHelper(u),t.HmacSHA3=r._createHmacHelper(u)}(Math),s.SHA3)},function(e,t,i){var s;e.exports=(s=i(0),
1
+ module.exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=34)}([function(e,t,n){"use strict";function i(e){return void 0===e}function r(e){return null!==e&&"object"==typeof e}function o(e){return!0===e||!1===e}function s(e){return"function"==typeof e}n.d(t,"a",(function(){return g})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return y})),n.d(t,"d",(function(){return b})),n.d(t,"e",(function(){return f})),n.d(t,"f",(function(){return a})),n.d(t,"g",(function(){return o})),n.d(t,"h",(function(){return s})),n.d(t,"i",(function(){return r})),n.d(t,"j",(function(){return i})),n.d(t,"k",(function(){return v})),n.d(t,"l",(function(){return _})),n.d(t,"m",(function(){return m}));const a=Array.isArray,c={bindTouchStart:"",bindTouchMove:"",bindTouchEnd:"",bindTouchCancel:"",bindLongTap:""},u={bindAnimationStart:"",bindAnimationIteration:"",bindAnimationEnd:"",bindTransitionEnd:""};function l(e){return`'${e}'`}const d=Object.assign(Object.assign({"hover-class":l("none"),"hover-stop-propagation":"false","hover-start-time":"50","hover-stay-time":"400",animation:""},c),u),h=Object.assign({longitude:"",latitude:"",scale:"16",markers:"[]",covers:"",polyline:"[]",circles:"[]",controls:"[]","include-points":"[]","show-location":"","layer-style":"1",bindMarkerTap:"",bindControlTap:"",bindCalloutTap:"",bindUpdated:""},c),f={View:d,Icon:{type:"",size:"23",color:""},Progress:{percent:"","stroke-width":"6",color:l("#09BB07"),activeColor:l("#09BB07"),backgroundColor:l("#EBEBEB"),active:"false","active-mode":l("backwards"),"show-info":"false"},RichText:{nodes:"[]"},Text:{selectable:"false",space:"",decode:"false"},Button:Object.assign({size:l("default"),type:"",plain:"false",disabled:"",loading:"false","form-type":"","open-type":"","hover-class":l("button-hover"),"hover-stop-propagation":"false","hover-start-time":"20","hover-stay-time":"70",name:""},c),Checkbox:{value:"",disabled:"",checked:"false",color:l("#09BB07"),name:""},CheckboxGroup:{bindChange:"",name:""},Form:{"report-submit":"false",bindSubmit:"",bindReset:"",name:""},Input:{value:"",type:l(""),password:"false",placeholder:"","placeholder-style":"","placeholder-class":l("input-placeholder"),disabled:"",maxlength:"140","cursor-spacing":"0",focus:"false","confirm-type":l("done"),"confirm-hold":"false",cursor:"i.value.length","selection-start":"-1","selection-end":"-1",bindInput:"",bindFocus:"",bindBlur:"",bindConfirm:"",name:""},Label:{for:"",name:""},Picker:{mode:l("selector"),disabled:"",range:"","range-key":"",value:"",start:"",end:"",fields:l("day"),"custom-item":"",name:"",bindCancel:"",bindChange:"",bindColumnChange:""},PickerView:{value:"","indicator-style":"","indicator-class":"","mask-style":"","mask-class":"",bindChange:"",name:""},PickerViewColumn:{name:""},Radio:{value:"",checked:"false",disabled:"",color:l("#09BB07"),name:""},RadioGroup:{bindChange:"",name:""},Slider:{min:"0",max:"100",step:"1",disabled:"",value:"0",activeColor:l("#1aad19"),backgroundColor:l("#e9e9e9"),"block-size":"28","block-color":l("#ffffff"),"show-value":"false",bindChange:"",bindChanging:"",name:""},Switch:{checked:"false",disabled:"",type:l("switch"),color:l("#04BE02"),bindChange:"",name:""},CoverImage:{src:"",bindLoad:"eh",bindError:"eh"},Textarea:{value:"",placeholder:"","placeholder-style":"","placeholder-class":l("textarea-placeholder"),disabled:"",maxlength:"140","auto-focus":"false",focus:"false","auto-height":"false",fixed:"false","cursor-spacing":"0",cursor:"-1","selection-start":"-1","selection-end":"-1",bindFocus:"",bindBlur:"",bindLineChange:"",bindInput:"",bindConfirm:"",name:""},CoverView:Object.assign({"scroll-top":"false"},c),MovableArea:{"scale-area":"false"},MovableView:Object.assign(Object.assign({direction:"none",inertia:"false","out-of-bounds":"false",x:"",y:"",damping:"20",friction:"2",disabled:"",scale:"false","scale-min":"0.5","scale-max":"10","scale-value":"1",animation:"true",bindChange:"",bindScale:"",bindHTouchMove:"",bindVTouchMove:"",width:l("10px"),height:l("10px")},c),u),ScrollView:Object.assign(Object.assign({"scroll-x":"false","scroll-y":"false","upper-threshold":"50","lower-threshold":"50","scroll-top":"","scroll-left":"","scroll-into-view":"","scroll-with-animation":"false","enable-back-to-top":"false",bindScrollToUpper:"",bindScrollToLower:"",bindScroll:""},c),u),Swiper:Object.assign({"indicator-dots":"false","indicator-color":l("rgba(0, 0, 0, .3)"),"indicator-active-color":l("#000000"),autoplay:"false",current:"0",interval:"5000",duration:"500",circular:"false",vertical:"false","previous-margin":"'0px'","next-margin":"'0px'","display-multiple-items":"1",bindChange:"",bindTransition:"",bindAnimationFinish:""},c),SwiperItem:{"item-id":""},Navigator:{url:"","open-type":l("navigate"),delta:"1","hover-class":l("navigator-hover"),"hover-stop-propagation":"false","hover-start-time":"50","hover-stay-time":"600",bindSuccess:"",bindFail:"",bindComplete:""},Audio:{id:"",src:"",loop:"false",controls:"false",poster:"",name:"",author:"",bindError:"",bindPlay:"",bindPause:"",bindTimeUpdate:"",bindEnded:""},Camera:{"device-position":l("back"),flash:l("auto"),bindStop:"",bindError:""},Image:Object.assign({src:"",mode:l("scaleToFill"),"lazy-load":"false",bindError:"",bindLoad:""},c),LivePlayer:{src:"",autoplay:"false",muted:"false",orientation:l("vertical"),"object-fit":l("contain"),"background-mute":"false","min-cache":"1","max-cache":"3",animation:"",bindStateChange:"",bindFullScreenChange:"",bindNetStatus:""},Video:{src:"",duration:"",controls:"true","danmu-list":"","danmu-btn":"","enable-danmu":"",autoplay:"false",loop:"false",muted:"false","initial-time":"0","page-gesture":"false",direction:"","show-progress":"true","show-fullscreen-btn":"true","show-play-btn":"true","show-center-play-btn":"true","enable-progress-gesture":"true","object-fit":l("contain"),poster:"","show-mute-btn":"false",animation:"",bindPlay:"",bindPause:"",bindEnded:"",bindTimeUpdate:"",bindFullScreenChange:"",bindWaiting:"",bindError:""},Canvas:Object.assign({"canvas-id":"","disable-scroll":"false",bindError:""},c),Ad:{"unit-id":"","ad-intervals":"",bindLoad:"",bindError:"",bindClose:""},WebView:{src:"",bindMessage:"",bindLoad:"",bindError:""},Block:{},Map:h,Slot:{name:""},SlotView:{name:""}},p=new Set(["input","checkbox","picker","picker-view","radio","slider","switch","textarea"]),g=(new Set(["input","textarea"]),new Set(["progress","icon","rich-text","input","textarea","slider","switch","audio","ad","official-account","open-data","navigation-bar"]),new Map([["view",-1],["catch-view",-1],["cover-view",-1],["static-view",-1],["pure-view",-1],["block",-1],["text",-1],["static-text",6],["slot",8],["slot-view",8],["label",6],["form",4],["scroll-view",4],["swiper",4],["swiper-item",4]]),{}),v=(...e)=>{},y=Object.create(null);function m(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function _(e){let t="",n=!1;for(let i=0;i<e.length;i++)"-"!==e[i]?(t+=n?e[i].toUpperCase():e[i],n=!1):n=!0;return t}Object.prototype.hasOwnProperty;function b(e,t){if(!e)throw new Error(t+"\n如有疑问,请提交 issue 至:https://github.com/nervjs/taro/issues")}(new Date).getTime().toString();new Set(["addPhoneContact","authorize","canvasGetImageData","canvasPutImageData","canvasToTempFilePath","checkSession","chooseAddress","chooseImage","chooseInvoiceTitle","chooseLocation","chooseVideo","clearStorage","closeBLEConnection","closeBluetoothAdapter","closeSocket","compressImage","connectSocket","createBLEConnection","downloadFile","exitMiniProgram","getAvailableAudioSources","getBLEDeviceCharacteristics","getBLEDeviceServices","getBatteryInfo","getBeacons","getBluetoothAdapterState","getBluetoothDevices","getClipboardData","getConnectedBluetoothDevices","getConnectedWifi","getExtConfig","getFileInfo","getImageInfo","getLocation","getNetworkType","getSavedFileInfo","getSavedFileList","getScreenBrightness","getSetting","getStorage","getStorageInfo","getSystemInfo","getUserInfo","getWifiList","hideHomeButton","hideShareMenu","hideTabBar","hideTabBarRedDot","loadFontFace","login","makePhoneCall","navigateBack","navigateBackMiniProgram","navigateTo","navigateToBookshelf","navigateToMiniProgram","notifyBLECharacteristicValueChange","hideKeyboard","hideLoading","hideNavigationBarLoading","hideToast","openBluetoothAdapter","openDocument","openLocation","openSetting","pageScrollTo","previewImage","queryBookshelf","reLaunch","readBLECharacteristicValue","redirectTo","removeSavedFile","removeStorage","removeTabBarBadge","requestSubscribeMessage","saveFile","saveImageToPhotosAlbum","saveVideoToPhotosAlbum","scanCode","sendSocketMessage","setBackgroundColor","setBackgroundTextStyle","setClipboardData","setEnableDebug","setInnerAudioOption","setKeepScreenOn","setNavigationBarColor","setNavigationBarTitle","setScreenBrightness","setStorage","setTabBarBadge","setTabBarItem","setTabBarStyle","showActionSheet","showFavoriteGuide","showLoading","showModal","showShareMenu","showTabBar","showTabBarRedDot","showToast","startBeaconDiscovery","startBluetoothDevicesDiscovery","startDeviceMotionListening","startPullDownRefresh","stopBeaconDiscovery","stopBluetoothDevicesDiscovery","stopCompass","startCompass","startAccelerometer","stopAccelerometer","showNavigationBarLoading","stopDeviceMotionListening","stopPullDownRefresh","switchTab","uploadFile","vibrateLong","vibrateShort","writeBLECharacteristicValue"])},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multiBindToService=t.getServiceIdentifierAsString=t.typeConstraint=t.namedConstraint=t.taggedConstraint=t.traverseAncerstors=t.decorate=t.id=t.MetadataReader=t.postConstruct=t.targetName=t.multiInject=t.unmanaged=t.optional=t.LazyServiceIdentifer=t.inject=t.named=t.tagged=t.injectable=t.ContainerModule=t.AsyncContainerModule=t.TargetTypeEnum=t.BindingTypeEnum=t.BindingScopeEnum=t.Container=t.METADATA_KEY=void 0;var i=n(4);t.METADATA_KEY=i;var r=n(91);Object.defineProperty(t,"Container",{enumerable:!0,get:function(){return r.Container}});var o=n(10);Object.defineProperty(t,"BindingScopeEnum",{enumerable:!0,get:function(){return o.BindingScopeEnum}}),Object.defineProperty(t,"BindingTypeEnum",{enumerable:!0,get:function(){return o.BindingTypeEnum}}),Object.defineProperty(t,"TargetTypeEnum",{enumerable:!0,get:function(){return o.TargetTypeEnum}});var s=n(107);Object.defineProperty(t,"AsyncContainerModule",{enumerable:!0,get:function(){return s.AsyncContainerModule}}),Object.defineProperty(t,"ContainerModule",{enumerable:!0,get:function(){return s.ContainerModule}});var a=n(108);Object.defineProperty(t,"injectable",{enumerable:!0,get:function(){return a.injectable}});var c=n(109);Object.defineProperty(t,"tagged",{enumerable:!0,get:function(){return c.tagged}});var u=n(110);Object.defineProperty(t,"named",{enumerable:!0,get:function(){return u.named}});var l=n(51);Object.defineProperty(t,"inject",{enumerable:!0,get:function(){return l.inject}}),Object.defineProperty(t,"LazyServiceIdentifer",{enumerable:!0,get:function(){return l.LazyServiceIdentifer}});var d=n(111);Object.defineProperty(t,"optional",{enumerable:!0,get:function(){return d.optional}});var h=n(112);Object.defineProperty(t,"unmanaged",{enumerable:!0,get:function(){return h.unmanaged}});var f=n(113);Object.defineProperty(t,"multiInject",{enumerable:!0,get:function(){return f.multiInject}});var p=n(114);Object.defineProperty(t,"targetName",{enumerable:!0,get:function(){return p.targetName}});var g=n(115);Object.defineProperty(t,"postConstruct",{enumerable:!0,get:function(){return g.postConstruct}});var v=n(49);Object.defineProperty(t,"MetadataReader",{enumerable:!0,get:function(){return v.MetadataReader}});var y=n(15);Object.defineProperty(t,"id",{enumerable:!0,get:function(){return y.id}});var m=n(11);Object.defineProperty(t,"decorate",{enumerable:!0,get:function(){return m.decorate}});var _=n(54);Object.defineProperty(t,"traverseAncerstors",{enumerable:!0,get:function(){return _.traverseAncerstors}}),Object.defineProperty(t,"taggedConstraint",{enumerable:!0,get:function(){return _.taggedConstraint}}),Object.defineProperty(t,"namedConstraint",{enumerable:!0,get:function(){return _.namedConstraint}}),Object.defineProperty(t,"typeConstraint",{enumerable:!0,get:function(){return _.typeConstraint}});var b=n(19);Object.defineProperty(t,"getServiceIdentifierAsString",{enumerable:!0,get:function(){return b.getServiceIdentifierAsString}});var S=n(116);Object.defineProperty(t,"multiBindToService",{enumerable:!0,get:function(){return S.multiBindToService}})},function(e,t,n){(function(t){var i;e.exports=(i=i||function(e,i){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==t&&t.crypto&&(r=t.crypto),!r)try{r=n(59)}catch(e){}var o=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),a={},c=a.lib={},u=c.Base={extend:function(e){var t=s(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)}},l=c.WordArray=u.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||h).stringify(this)},concat:function(e){var t=this.words,n=e.words,i=this.sigBytes,r=e.sigBytes;if(this.clamp(),i%4)for(var o=0;o<r;o++){var s=n[o>>>2]>>>24-o%4*8&255;t[i+o>>>2]|=s<<24-(i+o)%4*8}else for(var a=0;a<r;a+=4)t[i+a>>>2]=n[a>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=u.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(o());return new l.init(t,e)}}),d=a.enc={},h=d.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],r=0;r<n;r++){var o=t[r>>>2]>>>24-r%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i+=2)n[i>>>3]|=parseInt(e.substr(i,2),16)<<24-i%8*4;return new l.init(n,t/2)}},f=d.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],r=0;r<n;r++){var o=t[r>>>2]>>>24-r%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var t=e.length,n=[],i=0;i<t;i++)n[i>>>2]|=(255&e.charCodeAt(i))<<24-i%4*8;return new l.init(n,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(f.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return f.parse(unescape(encodeURIComponent(e)))}},g=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new l.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 n,i=this._data,r=i.words,o=i.sigBytes,s=this.blockSize,a=o/(4*s),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*s,u=e.min(4*c,o);if(c){for(var d=0;d<c;d+=s)this._doProcessBlock(r,d);n=r.splice(0,c),i.sigBytes-=u}return new l.init(n,u)},clone:function(){var e=u.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0}),v=(c.Hasher=g.extend({cfg:u.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new v.HMAC.init(e,n).finalize(t)}}}),a.algo={});return a}(Math),i)}).call(this,n(21))},function(e,t,n){"use strict";n.r(t),function(e,i){n.d(t,"Current",(function(){return rn})),n.d(t,"ElementNames",(function(){return D})),n.d(t,"Events",(function(){return sn})),n.d(t,"FormElement",(function(){return We})),n.d(t,"SERVICE_IDENTIFIER",(function(){return u})),n.d(t,"SVGElement",(function(){return ze})),n.d(t,"Style",(function(){return U})),n.d(t,"TaroElement",(function(){return z})),n.d(t,"TaroEvent",(function(){return Ht})),n.d(t,"TaroNode",(function(){return E})),n.d(t,"TaroRootElement",(function(){return Ke})),n.d(t,"TaroText",(function(){return A})),n.d(t,"cancelAnimationFrame",(function(){return en})),n.d(t,"connectReactPage",(function(){return In})),n.d(t,"connectVuePage",(function(){return xn})),n.d(t,"container",(function(){return Mt})),n.d(t,"createComponentConfig",(function(){return Sn})),n.d(t,"createDocument",(function(){return Vt})),n.d(t,"createEvent",(function(){return Ut})),n.d(t,"createNativeComponentConfig",(function(){return Pn})),n.d(t,"createPageConfig",(function(){return bn})),n.d(t,"createReactApp",(function(){return kn})),n.d(t,"createRecursiveComponentConfig",(function(){return wn})),n.d(t,"createVue3App",(function(){return Ln})),n.d(t,"createVueApp",(function(){return jn})),n.d(t,"document",(function(){return $t})),n.d(t,"eventCenter",(function(){return an})),n.d(t,"getComputedStyle",(function(){return tn})),n.d(t,"getCurrentInstance",(function(){return on})),n.d(t,"hydrate",(function(){return S})),n.d(t,"injectPageInstance",(function(){return dn})),n.d(t,"navigator",(function(){return Jt})),n.d(t,"nextTick",(function(){return ti})),n.d(t,"now",(function(){return Yt})),n.d(t,"options",(function(){return Ue})),n.d(t,"processPluginHooks",(function(){return xt})),n.d(t,"requestAnimationFrame",(function(){return Qt})),n.d(t,"stringify",(function(){return gn})),n.d(t,"useAddToFavorites",(function(){return Yn})),n.d(t,"useDidHide",(function(){return Un})),n.d(t,"useDidShow",(function(){return Hn})),n.d(t,"useOptionMenuClick",(function(){return qn})),n.d(t,"usePageScroll",(function(){return Kn})),n.d(t,"usePullDownRefresh",(function(){return Fn})),n.d(t,"usePullIntercept",(function(){return Zn})),n.d(t,"useReachBottom",(function(){return Gn})),n.d(t,"useReady",(function(){return Xn})),n.d(t,"useResize",(function(){return Wn})),n.d(t,"useRouter",(function(){return Qn})),n.d(t,"useScope",(function(){return ei})),n.d(t,"useShareAppMessage",(function(){return zn})),n.d(t,"useShareTimeline",(function(){return Jn})),n.d(t,"useTabItemTap",(function(){return Vn})),n.d(t,"useTitleClick",(function(){return $n})),n.d(t,"window",(function(){return nn}));var r=n(1),o=n(0);
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
5
+ this file except in compliance with the License. You may obtain a copy of the
6
+ License at http://www.apache.org/licenses/LICENSE-2.0
7
+
8
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
9
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
10
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
11
+ MERCHANTABLITY OR NON-INFRINGEMENT.
12
+
13
+ See the Apache Version 2.0 License for specific language governing permissions
14
+ and limitations under the License.
15
+ ***************************************************************************** */
16
+ function s(e,t,n,i){var r,o=arguments.length,s=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,n,s):r(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}function a(e,t){return function(n,i){t(n,i,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}
17
+ /*! *****************************************************************************
18
+ Copyright (C) Microsoft. All rights reserved.
19
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
20
+ this file except in compliance with the License. You may obtain a copy of the
21
+ License at http://www.apache.org/licenses/LICENSE-2.0
22
+
23
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
24
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
25
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
26
+ MERCHANTABLITY OR NON-INFRINGEMENT.
27
+
28
+ See the Apache Version 2.0 License for specific language governing permissions
29
+ and limitations under the License.
30
+ ***************************************************************************** */
31
+ "h5"===e.env.TARO_ENV?n(117):function(t){var n,i;!function(t){var n=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,r=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",s="function"==typeof Object.create,a={__proto__:[]}instanceof Array,c=!s&&!a,u={create:s?function(){return P(Object.create(null))}:a?function(){return P({__proto__:null})}:function(){return P({})},has:c?function(e,t){return n.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return n.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},l=Object.getPrototypeOf(Function),d="object"==typeof e&&e.env&&"true"===e.env.REFLECT_METADATA_USE_MAP_POLYFILL,h=d||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){var e={},t=[],n=function(){function e(e,t,n){this._index=0,this._keys=e,this._values=t,this._selector=n}return e.prototype["@@iterator"]=function(){return this},e.prototype[o]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var n=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var n=this._find(e,!0);return this._values[n]=t,this},t.prototype.delete=function(t){var n=this._find(t,!1);if(n>=0){for(var i=this._keys.length,r=n+1;r<i;r++)this._keys[r-1]=this._keys[r],this._values[r-1]=this._values[r];return this._keys.length--,this._values.length--,t===this._cacheKey&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new n(this._keys,this._values,i)},t.prototype.values=function(){return new n(this._keys,this._values,r)},t.prototype.entries=function(){return new n(this._keys,this._values,s)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[o]=function(){return this.entries()},t.prototype._find=function(e,t){return this._cacheKey!==e&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=e)),this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function i(e,t){return e}function r(e,t){return t}function s(e,t){return[e,t]}}():Map,f=d||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){function e(){this._map=new h}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.values()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[o]=function(){return this.keys()},e}():Set,p=new(d||"function"!=typeof WeakMap?function(){var e=u.create(),t=i();return function(){function e(){this._key=i()}return e.prototype.has=function(e){var t=r(e,!1);return void 0!==t&&u.has(t,this._key)},e.prototype.get=function(e){var t=r(e,!1);return void 0!==t?u.get(t,this._key):void 0},e.prototype.set=function(e,t){return r(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=r(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=i()},e}();function i(){var t;do{t="@@WeakMap@@"+s()}while(u.has(e,t));return e[t]=!0,t}function r(e,i){if(!n.call(e,t)){if(!i)return;Object.defineProperty(e,t,{value:u.create()})}return e[t]}function o(e,t){for(var n=0;n<t;++n)e[n]=255*Math.random()|0;return e}function s(){var e=function(e){return"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(e)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(e)):o(new Uint8Array(e),e):o(new Array(e),e)}(16);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",n=0;n<16;++n){var i=e[n];4!==n&&6!==n&&8!==n||(t+="-"),i<16&&(t+="0"),t+=i.toString(16).toLowerCase()}return t}}():WeakMap);function g(e,t,n){var i=p.get(e);if(S(i)){if(!n)return;i=new h,p.set(e,i)}var r=i.get(t);if(S(r)){if(!n)return;r=new h,i.set(t,r)}return r}function v(e,t,n){var i=g(t,n,!1);return!S(i)&&!!i.has(e)}function y(e,t,n){var i=g(t,n,!1);if(!S(i))return i.get(e)}function m(e,t,n,i){g(n,i,!0).set(e,t)}function _(e,t){var n=[],i=g(e,t,!1);if(S(i))return n;for(var r=function(e){var t=C(e,o);if(!O(t))throw new TypeError;var n=t.call(e);if(!D(n))throw new TypeError;return n}(i.keys()),s=0;;){var a=B(r);if(!a)return n.length=s,n;var c=a.value;try{n[s]=c}catch(e){try{k(r)}finally{throw e}}s++}}function b(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function S(e){return void 0===e}function w(e){return null===e}function D(e){return"object"==typeof e?null!==e:"function"==typeof e}function T(e,t){switch(b(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var n=3===t?"string":5===t?"number":"default",i=C(e,r);if(void 0!==i){var o=i.call(e,n);if(D(o))throw new TypeError;return o}return function(e,t){if("string"===t){var n=e.toString;if(O(n)&&!D(r=n.call(e)))return r;if(O(i=e.valueOf)&&!D(r=i.call(e)))return r}else{var i;if(O(i=e.valueOf)&&!D(r=i.call(e)))return r;var r,o=e.toString;if(O(o)&&!D(r=o.call(e)))return r}throw new TypeError}(e,"default"===n?"number":n)}function E(e){var t=T(e,3);return"symbol"==typeof t?t:function(e){return""+e}(t)}function A(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function O(e){return"function"==typeof e}function I(e){return"function"==typeof e}function C(e,t){var n=e[t];if(null!=n){if(!O(n))throw new TypeError;return n}}function B(e){var t=e.next();return!t.done&&t}function k(e){var t=e.return;t&&t.call(e)}function N(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===l)return t;if(t!==l)return t;var n=e.prototype,i=n&&Object.getPrototypeOf(n);if(null==i||i===Object.prototype)return t;var r=i.constructor;return"function"!=typeof r||r===e?t:r}function P(e){return e.__=void 0,delete e.__,e}t("decorate",(function(e,t,n,i){if(S(n)){if(!A(e))throw new TypeError;if(!I(t))throw new TypeError;return function(e,t){for(var n=e.length-1;n>=0;--n){var i=(0,e[n])(t);if(!S(i)&&!w(i)){if(!I(i))throw new TypeError;t=i}}return t}(e,t)}if(!A(e))throw new TypeError;if(!D(t))throw new TypeError;if(!D(i)&&!S(i)&&!w(i))throw new TypeError;return w(i)&&(i=void 0),function(e,t,n,i){for(var r=e.length-1;r>=0;--r){var o=(0,e[r])(t,n,i);if(!S(o)&&!w(o)){if(!D(o))throw new TypeError;i=o}}return i}(e,t,n=E(n),i)})),t("metadata",(function(e,t){return function(n,i){if(!D(n))throw new TypeError;if(!S(i)&&!function(e){switch(b(e)){case 3:case 4:return!0;default:return!1}}(i))throw new TypeError;m(e,t,n,i)}})),t("defineMetadata",(function(e,t,n,i){if(!D(n))throw new TypeError;return S(i)||(i=E(i)),m(e,t,n,i)})),t("hasMetadata",(function(e,t,n){if(!D(t))throw new TypeError;return S(n)||(n=E(n)),function e(t,n,i){if(v(t,n,i))return!0;var r=N(n);return!w(r)&&e(t,r,i)}(e,t,n)})),t("hasOwnMetadata",(function(e,t,n){if(!D(t))throw new TypeError;return S(n)||(n=E(n)),v(e,t,n)})),t("getMetadata",(function(e,t,n){if(!D(t))throw new TypeError;return S(n)||(n=E(n)),function e(t,n,i){if(v(t,n,i))return y(t,n,i);var r=N(n);return w(r)?void 0:e(t,r,i)}(e,t,n)})),t("getOwnMetadata",(function(e,t,n){if(!D(t))throw new TypeError;return S(n)||(n=E(n)),y(e,t,n)})),t("getMetadataKeys",(function(e,t){if(!D(e))throw new TypeError;return S(t)||(t=E(t)),function e(t,n){var i=_(t,n),r=N(t);if(null===r)return i;var o=e(r,n);if(o.length<=0)return i;if(i.length<=0)return o;for(var s=new f,a=[],c=0,u=i;c<u.length;c++){var l=u[c];s.has(l)||(s.add(l),a.push(l))}for(var d=0,h=o;d<h.length;d++)l=h[d],s.has(l)||(s.add(l),a.push(l));return a}(e,t)})),t("getOwnMetadataKeys",(function(e,t){if(!D(e))throw new TypeError;return S(t)||(t=E(t)),_(e,t)})),t("deleteMetadata",(function(e,t,n){if(!D(t))throw new TypeError;S(n)||(n=E(n));var i=g(t,n,!1);if(S(i))return!1;if(!i.delete(e))return!1;if(i.size>0)return!0;var r=p.get(t);return r.delete(n),r.size>0||p.delete(t),!0}))}((n=t,function(e,t){"function"!=typeof n[e]&&Object.defineProperty(n,e,{configurable:!0,writable:!0,value:t}),i&&i(e,t)}))}(Reflect||(Reflect={}));const u={TaroElement:"TaroElement",TaroElementFactory:"Factory<TaroElement>",TaroText:"TaroText",TaroTextFactory:"Factory<TaroText>",TaroNodeImpl:"TaroNodeImpl",TaroElementImpl:"TaroElementImpl",Hooks:"hooks",onRemoveAttribute:"onRemoveAttribute",getLifecycle:"getLifecycle",getPathIndex:"getPathIndex",getEventCenter:"getEventCenter",isBubbleEvents:"isBubbleEvents",getSpecialNodes:"getSpecialNodes",eventCenter:"eventCenter",modifyMpEvent:"modifyMpEvent",modifyTaroEvent:"modifyTaroEvent",batchedEventUpdates:"batchedEventUpdates",mergePageInstance:"mergePageInstance",createPullDownComponent:"createPullDownComponent",getDOMNode:"getDOMNode",initNativeApi:"initNativeApi",modifyHydrateData:"modifyHydrateData",modifySetAttrPayload:"modifySetAttrPayload",modifyRmAttrPayload:"modifyRmAttrPayload",onAddEvent:"onAddEvent",patchElement:"patchElement"},l="id",d="style",h="view",f="props",p="dataset",g=()=>{let e=0;return()=>(e++).toString()};function v(e){return 1===e.nodeType}function y(e){return"comment"===e.nodeName}function m(e){const t=Object.keys(e.props).find(e=>!(/^(class|style|id)$/.test(e)||e.startsWith("data-")));return Boolean(t)}function _(e){switch(e){case d:return"st";case l:return"uid";case"class":return"cl";default:return e}}let b=class{constructor(e){this.__handlers={},this.hooks=e}addEventListener(e,t,n){var i,r;if(null===(r=(i=this.hooks).onAddEvent)||void 0===r||r.call(i,e,t,n,this),"regionchange"===e)return this.addEventListener("begin",t,n),void this.addEventListener("end",t,n);e=e.toLowerCase();const s=this.__handlers[e];let a=Boolean(n),c=!1;if(Object(o.i)(n)&&(a=Boolean(n.capture),c=Boolean(n.once)),c){const i=function(){t.apply(this,arguments),this.removeEventListener(e,i)};this.addEventListener(e,i,Object.assign(Object.assign({},n),{once:!1}))}else Object(o.f)(s)?s.push(t):this.__handlers[e]=[t]}removeEventListener(e,t){if(e=e.toLowerCase(),null==t)return;const n=this.__handlers[e];if(!Object(o.f)(n))return;const i=n.indexOf(t);n.splice(i,1)}isAnyEventBinded(){const e=this.__handlers,t=Object.keys(e).find(t=>e[t].length);return Boolean(t)}};function S(e){var t,n;const i=e.nodeName;if(function(e){return 3===e.nodeType}(e))return{v:e.nodeValue,nn:i};const r={nn:i,uid:e.uid},{props:s}=e,a=e.hooks.getSpecialNodes();!e.isAnyEventBinded()&&a.indexOf(i)>-1&&(r.nn=`static-${i}`,i!==h||m(e)||(r.nn="pure-view"));for(const e in s){const t=Object(o.l)(e);e.startsWith("data-")||"class"===e||e===d||e===l||"catchMove"===t||(r[t]=s[e]),i===h&&"catchMove"===t&&!1!==s[e]&&(r.nn="catch-view")}let{childNodes:c}=e;return c=c.filter(e=>!y(e)),c.length>0?r.cn=c.map(S):r.cn=[],""!==e.className&&(r.cl=e.className),""!==e.cssText&&"swiper-item"!==i&&(r.st=e.cssText),null===(n=(t=e.hooks).modifyHydrateData)||void 0===n||n.call(t,r),r}b=s([Object(r.injectable)(),a(0,Object(r.inject)(u.Hooks)),c("design:paramtypes",[Object])],b);const w=new Map;var D;!function(e){e.Element="Element",e.Document="Document",e.RootElement="RootElement",e.FormElement="FormElement"}(D||(D={}));const T=g();let E=class extends b{constructor(e,t,n){super(n),this.parentNode=null,this.childNodes=[],this.hydrate=e=>()=>S(e),e.bind(this),this._getElement=t,this.uid=`_n_${T()}`,w.set(this.uid,this)}_empty(){for(;this.childNodes.length>0;){const e=this.childNodes[0];e.parentNode=null,w.delete(e.uid),this.childNodes.shift()}}get _root(){var e;return(null===(e=this.parentNode)||void 0===e?void 0:e._root)||null}findIndex(e){const t=this.childNodes.indexOf(e);return Object(o.d)(-1!==t,"The node to be replaced is not a child of this node."),t}get _path(){const e=this.parentNode;if(e){const t=e.childNodes.filter(e=>!y(e)).indexOf(this),n=this.hooks.getPathIndex(t);return`${e._path}.cn.${n}`}return""}get nextSibling(){const e=this.parentNode;return(null==e?void 0:e.childNodes[e.findIndex(this)+1])||null}get previousSibling(){const e=this.parentNode;return(null==e?void 0:e.childNodes[e.findIndex(this)-1])||null}get parentElement(){const e=this.parentNode;return 1===(null==e?void 0:e.nodeType)?e:null}get firstChild(){return this.childNodes[0]||null}get lastChild(){const e=this.childNodes;return e[e.length-1]||null}set textContent(e){if(this._empty(),""===e)this.enqueueUpdate({path:`${this._path}.cn`,value:()=>[]});else{const t=this._getElement(D.Document)();this.appendChild(t.createTextNode(e))}}insertBefore(e,t,n){if("document-fragment"===e.nodeName)return e.childNodes.reduceRight((e,t)=>(this.insertBefore(t,e),t),t),e;let i;if(e.remove(),e.parentNode=this,t){const r=this.findIndex(t);this.childNodes.splice(r,0,e),i=n?{path:e._path,value:this.hydrate(e)}:{path:`${this._path}.cn`,value:()=>this.childNodes.filter(e=>!y(e)).map(S)}}else this.childNodes.push(e),i={path:e._path,value:this.hydrate(e)};return this.enqueueUpdate(i),w.has(e.uid)||w.set(e.uid,e),e}appendChild(e){this.insertBefore(e)}replaceChild(e,t){if(t.parentNode===this)return this.insertBefore(e,t,!0),t.remove(!0),t}removeChild(e,t){const n=this.findIndex(e);return this.childNodes.splice(n,1),t||this.enqueueUpdate({path:`${this._path}.cn`,value:()=>this.childNodes.filter(e=>!y(e)).map(S)}),e.parentNode=null,w.delete(e.uid),e}remove(e){var t;null===(t=this.parentNode)||void 0===t||t.removeChild(this,e)}hasChildNodes(){return this.childNodes.length>0}enqueueUpdate(e){var t;null===(t=this._root)||void 0===t||t.enqueueUpdate(e)}contains(e){let t=!1;return this.childNodes.some(n=>{const{uid:i}=n;if(i===e.uid||i===e.id||n.contains(e))return t=!0,!0}),t}get ownerDocument(){return this._getElement(D.Document)()}};E=s([Object(r.injectable)(),a(0,Object(r.inject)(u.TaroNodeImpl)),a(1,Object(r.inject)(u.TaroElementFactory)),a(2,Object(r.inject)(u.Hooks)),c("design:paramtypes",[Function,Function,Function])],E);let A=class extends E{constructor(e,t,n){super(e,t,n),this.nodeType=3,this.nodeName="#text"}set textContent(e){this._value=e,this.enqueueUpdate({path:`${this._path}.v`,value:e})}get textContent(){return this._value}set nodeValue(e){this.textContent=e}get nodeValue(){return this._value}};A=s([Object(r.injectable)(),a(0,Object(r.inject)(u.TaroNodeImpl)),a(1,Object(r.inject)(u.TaroElementFactory)),a(2,Object(r.inject)(u.Hooks)),c("design:paramtypes",[Function,Function,Function])],A);const O=["all","appearance","blockOverflow","blockSize","bottom","clear","contain","content","continue","cursor","direction","display","filter","float","gap","height","inset","isolation","left","letterSpacing","lightingColor","markerSide","mixBlendMode","opacity","order","position","quotes","resize","right","rowGap","tabSize","tableLayout","top","userSelect","verticalAlign","visibility","voiceFamily","volume","whiteSpace","widows","width","zIndex","pointerEvents"];function I(e,t,n){!n&&O.push(e),t.forEach(t=>{O.push(e+t)})}const C=["Color","Style","Width"],B=["FitLength","FitWidth","Image"],k=[...B,"Radius"],N=[...C,...B],P=["EndRadius","StartRadius"],x=["Bottom","Left","Right","Top"],M=["End","Start"],j=["Content","Items","Self"],L=["BlockSize","Height","InlineSize","Width"],R=["After","Before"];function H(e,t){const n=this[t];e&&this._usedStyleProp.add(t),n!==e&&(this._value[t]=e,this._element.enqueueUpdate({path:`${this._element._path}.st`,value:this.cssText}))}I("borderBlock",C),I("borderBlockEnd",C),I("borderBlockStart",C),I("outline",[...C,"Offset"]),I("border",[...C,"Boundary","Break","Collapse","Radius","Spacing"]),I("borderFit",["Length","Width"]),I("borderInline",C),I("borderInlineEnd",C),I("borderInlineStart",C),I("borderLeft",N),I("borderRight",N),I("borderTop",N),I("borderBottom",N),I("textDecoration",["Color","Style","Line"]),I("textEmphasis",["Color","Style","Position"]),I("scrollMargin",x),I("scrollPadding",x),I("padding",x),I("margin",[...x,"Trim"]),I("scrollMarginBlock",M),I("scrollMarginInline",M),I("scrollPaddingBlock",M),I("scrollPaddingInline",M),I("gridColumn",M),I("gridRow",M),I("insetBlock",M),I("insetInline",M),I("marginBlock",M),I("marginInline",M),I("paddingBlock",M),I("paddingInline",M),I("pause",R),I("cue",R),I("mask",["Clip","Composite","Image","Mode","Origin","Position","Repeat","Size","Type"]),I("borderImage",["Outset","Repeat","Slice","Source","Transform","Width"]),I("maskBorder",["Mode","Outset","Repeat","Slice","Source","Width"]),I("font",["Family","FeatureSettings","Kerning","LanguageOverride","MaxSize","MinSize","OpticalSizing","Palette","Size","SizeAdjust","Stretch","Style","Weight","VariationSettings"]),I("fontSynthesis",["SmallCaps","Style","Weight"]),I("transform",["Box","Origin","Style"]),I("background",["Color","Image","Attachment","BlendMode","Clip","Origin","Position","Repeat","Size"]),I("listStyle",["Image","Position","Type"]),I("scrollSnap",["Align","Stop","Type"]),I("grid",["Area","AutoColumns","AutoFlow","AutoRows"]),I("gridTemplate",["Areas","Columns","Rows"]),I("overflow",["Block","Inline","Wrap","X","Y"]),I("transition",["Delay","Duration","Property","TimingFunction"]),I("lineStacking",["Ruby","Shift","Strategy"]),I("color",["Adjust","InterpolationFilters","Scheme"]),I("textAlign",["All","Last"]),I("page",["BreakAfter","BreakBefore","BreakInside"]),I("speak",["Header","Numeral","Punctuation"]),I("animation",["Delay","Direction","Duration","FillMode","IterationCount","Name","PlayState","TimingFunction"]),I("flex",["Basis","Direction","Flow","Grow","Shrink","Wrap"]),I("offset",[...R,...M,"Anchor","Distance","Path","Position","Rotate"]),I("fontVariant",["Alternates","Caps","EastAsian","Emoji","Ligatures","Numeric","Position"]),I("perspective",["Origin"]),I("pitch",["Range"]),I("clip",["Path","Rule"]),I("flow",["From","Into"]),I("align",["Content","Items","Self"],!0),I("alignment",["Adjust","Baseline"],!0),I("bookmark",["Label","Level","State"],!0),I("borderStart",P,!0),I("borderEnd",P,!0),I("borderCorner",["Fit","Image","ImageTransform"],!0),I("borderTopLeft",k,!0),I("borderTopRight",k,!0),I("borderBottomLeft",k,!0),I("borderBottomRight",k,!0),I("column",["s","Count","Fill","Gap","Rule","RuleColor","RuleStyle","RuleWidth","Span","Width"],!0),I("break",[...R,"Inside"],!0),I("wrap",[...R,"Flow","Inside","Through"],!0),I("justify",j,!0),I("place",j,!0),I("max",[...L,"Lines"],!0),I("min",L,!0),I("line",["Break","Clamp","Grid","Height","Padding","Snap"],!0),I("inline",["BoxAlign","Size","Sizing"],!0),I("text",["CombineUpright","GroupAlign","Height","Indent","Justify","Orientation","Overflow","Shadow","SpaceCollapse","SpaceTrim","Spacing","Transform","UnderlinePosition","Wrap"],!0),I("shape",["ImageThreshold","Inside","Margin","Outside"],!0),I("word",["Break","Spacing","Wrap"],!0),I("nav",["Down","Left","Right","Up"],!0),I("object",["Fit","Position"],!0),I("box",["DecorationBreak","Shadow","Sizing","Snap"],!0);class U{constructor(e){this._element=e,this._usedStyleProp=new Set,this._value={}}setCssVariables(e){this.hasOwnProperty(e)||Object.defineProperty(this,e,{enumerable:!0,configurable:!0,get:()=>this._value[e]||"",set:t=>{H.call(this,t,e)}})}get cssText(){let e="";return this._usedStyleProp.forEach(t=>{const n=this[t];if(!n)return;const i=/^--/.test(t)?t:Object(o.m)(t);e+=`${i}: ${n};`}),e}set cssText(e){if(null==e&&(e=""),this._usedStyleProp.forEach(e=>{this.removeProperty(e)}),""===e)return;const t=e.split(";");for(let e=0;e<t.length;e++){const n=t[e].trim();if(""===n)continue;const[i,...r]=n.split(":"),s=r.join(":");Object(o.j)(s)||this.setProperty(i.trim(),s.trim())}}setProperty(e,t){"-"===e[0]?this.setCssVariables(e):e=Object(o.l)(e),Object(o.j)(t)||(null===t||""===t?this.removeProperty(e):this[e]=t)}removeProperty(e){if(e=Object(o.l)(e),!this._usedStyleProp.has(e))return"";const t=this[e];return this[e]="",this._usedStyleProp.delete(e),t}getPropertyValue(e){const t=this[e=Object(o.l)(e)];return t||""}}function F(){return!0}function G(e,t){const n=[],i=null!=t?t:F;let r=e;for(;r;)1===r.nodeType&&i(r)&&n.push(r),r=K(r,e);return n}function K(e,t){const n=e.firstChild;if(n)return n;let i=e;do{if(i===t)return null;const e=i.nextSibling;if(e)return e;i=i.parentElement}while(i);return null}!function(e){const t={};for(let e=0;e<O.length;e++){const n=O[e];t[n]={get(){return this._value[n]||""},set(e){H.call(this,e,n)}}}Object.defineProperties(e.prototype,t)}(U);class W extends Set{constructor(e,t){super(),e.trim().split(/\s+/).forEach(super.add.bind(this)),this.el=t}get value(){return[...this].join(" ")}add(e){return super.add(e),this._update(),this}get length(){return this.size}remove(e){super.delete(e),this._update()}toggle(e){super.has(e)?super.delete(e):super.add(e),this._update()}replace(e,t){super.delete(e),super.add(t),this._update()}contains(e){return super.has(e)}toString(){return this.value}_update(){this.el.className=this.value}}let z=class extends E{constructor(e,t,n,i){super(e,t,n),this.props={},this.dataset=o.a,i.bind(this),this.nodeType=1,this.style=new U(this),n.patchElement(this)}_stopPropagation(e){let t=this;for(;t=t.parentNode;){const n=t.__handlers[e.type];if(Object(o.f)(n))for(let e=n.length;e--;){n[e]._stop=!0}}}get id(){return this.getAttribute(l)}set id(e){this.setAttribute(l,e)}get className(){return this.getAttribute("class")||""}set className(e){this.setAttribute("class",e)}get cssText(){return this.getAttribute(d)||""}get classList(){return new W(this.className,this)}get children(){return this.childNodes.filter(v)}get attributes(){const e=this.props,t=Object.keys(e),n=this.style.cssText;return t.map(t=>({name:t,value:e[t]})).concat(n?{name:d,value:n}:[])}get textContent(){let e="";const t=this.childNodes;for(let n=0;n<t.length;n++)e+=t[n].textContent;return e}set textContent(e){super.textContent=e}hasAttribute(e){return!Object(o.j)(this.props[e])}hasAttributes(){return this.attributes.length>0}focus(){this.setAttribute("focus",!0)}blur(){this.setAttribute("focus",!1)}setAttribute(e,t){var n,i;const r=this.nodeName===h&&!m(this)&&!this.isAnyEventBinded();switch(e){case d:this.style.cssText=t;break;case l:w.delete(this.uid),t=String(t),this.props[e]=this.uid=t,w.set(t,this);break;default:this.props[e]=t,e.startsWith("data-")&&(this.dataset===o.a&&(this.dataset=Object.create(null)),this.dataset[Object(o.l)(e.replace(/^data-/,""))]=t)}e=_(e);const s={path:`${this._path}.${Object(o.l)(e)}`,value:t};null===(i=(n=this.hooks).modifySetAttrPayload)||void 0===i||i.call(n,this,e,s),this.enqueueUpdate(s),this.nodeName===h&&("catchMove"===Object(o.l)(e)?this.enqueueUpdate({path:`${this._path}.nn`,value:t?"catch-view":this.isAnyEventBinded()?h:"static-view"}):r&&m(this)&&this.enqueueUpdate({path:`${this._path}.nn`,value:"static-view"}))}removeAttribute(e){var t,n,i,r;const s=this.nodeName===h&&m(this)&&!this.isAnyEventBinded();if(e===d)this.style.cssText="";else{if(null===(n=(t=this.hooks).onRemoveAttribute)||void 0===n?void 0:n.call(t,this,e))return;if(!this.props.hasOwnProperty(e))return;delete this.props[e]}e=_(e);const a={path:`${this._path}.${Object(o.l)(e)}`,value:""};null===(r=(i=this.hooks).modifyRmAttrPayload)||void 0===r||r.call(i,this,e,a),this.enqueueUpdate(a),this.nodeName===h&&("catchMove"===Object(o.l)(e)?this.enqueueUpdate({path:`${this._path}.nn`,value:this.isAnyEventBinded()?h:m(this)?"static-view":"pure-view"}):s&&!m(this)&&this.enqueueUpdate({path:`${this._path}.nn`,value:"pure-view"}))}getAttribute(e){const t=e===d?this.style.cssText:this.props[e];return null!=t?t:""}getElementsByTagName(e){return G(this,t=>t.nodeName===e||"*"===e&&this!==t)}getElementsByClassName(e){return G(this,t=>{const n=t.classList;return e.trim().split(/\s+/).every(e=>n.has(e))})}dispatchEvent(e){const t=e.cancelable,n=this.__handlers[e.type];if(!Object(o.f)(n))return!1;for(let i=n.length;i--;){const r=n[i];let o;if(r._stop?r._stop=!1:o=r.call(this,e),(!1===o||e._end)&&t&&(e.defaultPrevented=!0),e._end&&e._stop)break}return e._stop?this._stopPropagation(e):e._stop=!0,null!=n}addEventListener(e,t,n){const i=this.nodeName,r=this.hooks.getSpecialNodes();!this.isAnyEventBinded()&&r.indexOf(i)>-1&&this.enqueueUpdate({path:`${this._path}.nn`,value:i}),super.addEventListener(e,t,n)}removeEventListener(e,t){super.removeEventListener(e,t);const n=this.nodeName,i=this.hooks.getSpecialNodes();!this.isAnyEventBinded()&&i.indexOf(n)>-1&&this.enqueueUpdate({path:`${this._path}.nn`,value:m(this)?`static-${n}`:`pure-${n}`})}};z=s([Object(r.injectable)(),a(0,Object(r.inject)(u.TaroNodeImpl)),a(1,Object(r.inject)(u.TaroElementFactory)),a(2,Object(r.inject)(u.Hooks)),a(3,Object(r.inject)(u.TaroElementImpl)),c("design:paramtypes",[Function,Function,Function,Function])],z);var V=Array.isArray,$="object"==typeof i&&i&&i.Object===Object&&i,q="object"==typeof self&&self&&self.Object===Object&&self,Z=$||q||Function("return this")(),J=Z.Symbol,Y=Object.prototype,X=Y.hasOwnProperty,Q=Y.toString,ee=J?J.toStringTag:void 0;var te=Object.prototype.toString;var ne=J?J.toStringTag:void 0;function ie(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ne&&ne in Object(e)?function(e){var t=X.call(e,ee),n=e[ee];try{e[ee]=void 0;var i=!0}catch(e){}var r=Q.call(e);return i&&(t?e[ee]=n:delete e[ee]),r}(e):function(e){return te.call(e)}(e)}function re(e){return"symbol"==typeof e||function(e){return null!=e&&"object"==typeof e}(e)&&"[object Symbol]"==ie(e)}var oe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,se=/^\w*$/;function ae(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var ce,ue=Z["__core-js_shared__"],le=(ce=/[^.]+$/.exec(ue&&ue.keys&&ue.keys.IE_PROTO||""))?"Symbol(src)_1."+ce:"";var de=Function.prototype.toString;var he=/^\[object .+?Constructor\]$/,fe=Function.prototype,pe=Object.prototype,ge=fe.toString,ve=pe.hasOwnProperty,ye=RegExp("^"+ge.call(ve).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function me(e){return!(!ae(e)||(t=e,le&&le in t))&&(function(e){if(!ae(e))return!1;var t=ie(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}(e)?ye:he).test(function(e){if(null!=e){try{return de.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function _e(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return me(n)?n:void 0}var be=_e(Object,"create");var Se=Object.prototype.hasOwnProperty;var we=Object.prototype.hasOwnProperty;function De(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Te(e,t){for(var n,i,r=e.length;r--;)if((n=e[r][0])===(i=t)||n!=n&&i!=i)return r;return-1}De.prototype.clear=function(){this.__data__=be?be(null):{},this.size=0},De.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},De.prototype.get=function(e){var t=this.__data__;if(be){var n=t[e];return"__lodash_hash_undefined__"===n?void 0:n}return Se.call(t,e)?t[e]:void 0},De.prototype.has=function(e){var t=this.__data__;return be?void 0!==t[e]:we.call(t,e)},De.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=be&&void 0===t?"__lodash_hash_undefined__":t,this};var Ee=Array.prototype.splice;function Ae(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Ae.prototype.clear=function(){this.__data__=[],this.size=0},Ae.prototype.delete=function(e){var t=this.__data__,n=Te(t,e);return!(n<0)&&(n==t.length-1?t.pop():Ee.call(t,n,1),--this.size,!0)},Ae.prototype.get=function(e){var t=this.__data__,n=Te(t,e);return n<0?void 0:t[n][1]},Ae.prototype.has=function(e){return Te(this.__data__,e)>-1},Ae.prototype.set=function(e,t){var n=this.__data__,i=Te(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this};var Oe=_e(Z,"Map");function Ie(e,t){var n,i,r=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?r["string"==typeof t?"string":"hash"]:r.map}function Ce(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}Ce.prototype.clear=function(){this.size=0,this.__data__={hash:new De,map:new(Oe||Ae),string:new De}},Ce.prototype.delete=function(e){var t=Ie(this,e).delete(e);return this.size-=t?1:0,t},Ce.prototype.get=function(e){return Ie(this,e).get(e)},Ce.prototype.has=function(e){return Ie(this,e).has(e)},Ce.prototype.set=function(e,t){var n=Ie(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this};function Be(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError("Expected a function");var n=function(){var i=arguments,r=t?t.apply(this,i):i[0],o=n.cache;if(o.has(r))return o.get(r);var s=e.apply(this,i);return n.cache=o.set(r,s)||o,s};return n.cache=new(Be.Cache||Ce),n}Be.Cache=Ce;var ke=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ne=/\\(\\)?/g,Pe=function(e){var t=Be(e,(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(ke,(function(e,n,i,r){t.push(i?r.replace(Ne,"$1"):n||e)})),t}));var xe=J?J.prototype:void 0,Me=xe?xe.toString:void 0;function je(e){if("string"==typeof e)return e;if(V(e))return function(e,t){for(var n=-1,i=null==e?0:e.length,r=Array(i);++n<i;)r[n]=t(e[n],n,e);return r}(e,je)+"";if(re(e))return Me?Me.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Le(e,t){return V(e)?e:function(e,t){if(V(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!re(e))||(se.test(e)||!oe.test(e)||null!=t&&e in Object(t))}(e,t)?[e]:Pe(function(e){return null==e?"":je(e)}(e))}function Re(e){if("string"==typeof e||re(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function He(e,t,n){var i=null==e?void 0:function(e,t){for(var n=0,i=(t=Le(t,e)).length;null!=e&&n<i;)e=e[Re(t[n++])];return n&&n==i?e:void 0}(e,t);return void 0===i?n:i}const Ue={prerender:!0,debug:!1};const Fe=new class{constructor(){this.recorder=new Map}start(e){Ue.debug&&this.recorder.set(e,Date.now())}stop(e){if(!Ue.debug)return;const t=Date.now()-this.recorder.get(e);console.log(`${e} 时长: ${t}ms`)}},Ge=g();let Ke=class extends z{constructor(e,t,n,i,r){super(e,t,n,i),this.pendingFlush=!1,this.updatePayloads=[],this.updateCallbacks=[],this.pendingUpdate=!1,this.ctx=null,this.nodeName="root",this.eventCenter=r}get _path(){return"root"}get _root(){return this}enqueueUpdate(e){this.updatePayloads.push(e),this.pendingUpdate||null===this.ctx||this.performUpdate()}performUpdate(e=!1,t){this.pendingUpdate=!0;const n=this.ctx;setTimeout(()=>{Fe.start("小程序 setData");const i=Object.create(null),r=new Set(e?["root.cn.[0]","root.cn[0]"]:[]);for(;this.updatePayloads.length>0;){const{path:e,value:t}=this.updatePayloads.shift();e.endsWith("cn")&&r.add(e),i[e]=t}for(const e in i){r.forEach(t=>{e.includes(t)&&e!==t&&delete i[e]});const t=i[e];Object(o.h)(t)&&(i[e]=t())}if(Object(o.h)(t))t(i);else{this.pendingUpdate=!1;const t=[],r=new Map,o={};if(!e){for(const e in i){const t=e.split(".");let s=!1;for(let o=t.length;o>0;o--){const a=t.slice(0,o).join("."),c=He(n.__data__||n.data,a);if(c&&c.nn&&"custom-wrapper"===c.nn){const a=c.uid,u=n.selectComponent(`#${a}`),l=t.slice(o).join(".");u&&(s=!0,r.set(u,Object.assign(Object.assign({},r.get(u)||{}),{[`i.${l}`]:i[e]})));break}}s||(o[e]=i[e])}r.size>0&&r.forEach((e,n)=>{t.push({ctx:n,data:e})})}const s=t.length;if(s){const i=`${this._path}_update_${Ge()}`,r=this.eventCenter;let a=0;r.once(i,()=>{a++,a===s+1&&(Fe.stop("小程序 setData"),this.pendingFlush||this.flushUpdateCallback(),e&&Fe.stop("页面初始化"))},r),t.forEach(e=>{e.ctx.setData(e.data,()=>{r.trigger(i)})}),Object.keys(o).length&&n.setData(o,()=>{r.trigger(i)})}else n.setData(i,()=>{Fe.stop("小程序 setData"),this.pendingFlush||this.flushUpdateCallback(),e&&Fe.stop("页面初始化")})}},0)}enqueueUpdateCallback(e,t){this.updateCallbacks.push(()=>{t?e.call(t):e()})}flushUpdateCallback(){this.pendingFlush=!1;const e=this.updateCallbacks.slice(0);this.updateCallbacks.length=0;for(let t=0;t<e.length;t++)e[t]()}};Ke=s([Object(r.injectable)(),a(0,Object(r.inject)(u.TaroNodeImpl)),a(1,Object(r.inject)(u.TaroElementFactory)),a(2,Object(r.inject)(u.Hooks)),a(3,Object(r.inject)(u.TaroElementImpl)),a(4,Object(r.inject)(u.eventCenter)),c("design:paramtypes",[Function,Function,Function,Function,Function])],Ke);class We extends z{get value(){const e=this.props.value;return null==e?"":e}set value(e){this.setAttribute("value",e)}dispatchEvent(e){if(e.mpEvent){const t=e.mpEvent.detail.value;"change"===e.type?this.props.value=t:"input"===e.type&&(this.value=t)}return super.dispatchEvent(e)}}class ze extends z{}function Ve(e,t,n){const i=e.index,r=e.index=i+n;for(let n=i;n<r;n++){"\n"===t.charAt(n)?(e.line++,e.column=0):e.column++}}function $e(e,t,n){return Ve(e,t,n-e.index)}function qe(e){return{index:e.index,line:e.line,column:e.column}}const Ze=/\s/;function Je(e){return Ze.test(e)}const Ye=/=/;function Xe(e){return Ye.test(e)}function Qe(e){const t=e.toLowerCase();return!!Ue.html.skipElements.has(t)}const et=/[A-Za-z0-9]/;function tt(e,t,n){if(!Je(n.charAt(e)))return!1;const i=n.length;for(let i=e-1;i>t;i--){const e=n.charAt(i);if(!Je(e)){if(Xe(e))return!1;break}}for(let t=e+1;t<i;t++){const e=n.charAt(t);if(!Je(e))return!Xe(e)}}class nt{constructor(e){this.tokens=[],this.position={index:0,column:0,line:0},this.html=e}scan(){const{html:e,position:t}=this,n=e.length;for(;t.index<n;){const n=t.index;if(this.scanText(),t.index===n){if(e.startsWith("!--",n+1))this.scanComment();else{const e=this.scanTag();Qe(e)&&this.scanSkipTag(e)}}}return this.tokens}scanText(){const{html:e,position:t}=this;let n=function(e,t){for(;;){const n=e.indexOf("<",t);if(-1===n)return n;const i=e.charAt(n+1);if("/"===i||"!"===i||et.test(i))return n;t=n+1}}(e,t.index);if(n===t.index)return;-1===n&&(n=e.length);const i=qe(t),r=e.slice(t.index,n);$e(t,e,n);const o=qe(t);this.tokens.push({type:"text",content:r,position:{start:i,end:o}})}scanComment(){const{html:e,position:t}=this,n=qe(t);Ve(t,e,4);let i=e.indexOf("--\x3e",t.index),r=i+3;-1===i&&(i=r=e.length);const o=e.slice(t.index,i);$e(t,e,r),this.tokens.push({type:"comment",content:o,position:{start:n,end:qe(t)}})}scanTag(){this.scanTagStart();const e=this.scanTagName();return this.scanAttrs(),this.scanTagEnd(),e}scanTagStart(){const{html:e,position:t}=this,n="/"===e.charAt(t.index+1),i=qe(t);Ve(t,e,n?2:1),this.tokens.push({type:"tag-start",close:n,position:{start:i}})}scanTagEnd(){const{html:e,position:t}=this,n="/"===e.charAt(t.index);Ve(t,e,n?2:1);const i=qe(t);this.tokens.push({type:"tag-end",close:n,position:{end:i}})}scanTagName(){const{html:e,position:t}=this,n=e.length;let i=t.index;for(;i<n;){const t=e.charAt(i);if(!(Je(t)||"/"===t||">"===t))break;i++}let r=i+1;for(;r<n;){const t=e.charAt(r);if(!!(Je(t)||"/"===t||">"===t))break;r++}$e(t,e,r);const o=e.slice(i,r);return this.tokens.push({type:"tag",content:o}),o}scanAttrs(){const{html:e,position:t,tokens:n}=this;let i=t.index,r=null,o=i;const s=[],a=e.length;for(;i<a;){const t=e.charAt(i);if(r){t===r&&(r=null),i++}else{if("/"===t||">"===t){i!==o&&s.push(e.slice(o,i));break}tt(i,o,e)?(i!==o&&s.push(e.slice(o,i)),o=i+1,i++):"'"===t||'"'===t?(r=t,i++):i++}}$e(t,e,i);const c=s.length,u="attribute";for(let e=0;e<c;e++){const t=s[e];if(t.includes("=")){const i=s[e+1];if(i&&i.startsWith("=")){if(i.length>1){const r=t+i;n.push({type:u,content:r}),e+=1;continue}const r=s[e+2];if(e+=1,r){const i=t+"="+r;n.push({type:u,content:i}),e+=1;continue}}}if(t.endsWith("=")){const i=s[e+1];if(i&&!i.includes("=")){const r=t+i;n.push({type:u,content:r}),e+=1;continue}const r=t.slice(0,-1);n.push({type:u,content:r})}else n.push({type:u,content:t})}}scanSkipTag(e){const{html:t,position:n}=this,i=e.toLowerCase(),r=t.length;for(;n.index<r;){const e=t.indexOf("</",n.index);if(-1===e){this.scanText();break}if($e(n,t,e),i===this.scanTag().toLowerCase())break}}}function it(e,t){const n=Object.create(null),i=e.split(",");for(let e=0;e<i.length;e++)n[i[e]]=!0;return t?e=>!!n[e.toLowerCase()]:e=>!!n[e]}const rt={img:"image",iframe:"web-view"},ot=it(Object.keys(o.e).map(e=>e.toLowerCase()).join(","),!0),st=it("a,i,abbr,iframe,select,acronym,slot,small,span,bdi,kbd,strong,big,map,sub,sup,br,mark,mark,meter,template,canvas,textarea,cite,object,time,code,output,u,data,picture,tt,datalist,var,dfn,del,q,em,s,embed,samp,b",!0),at=it("address,fieldset,li,article,figcaption,main,aside,figure,nav,blockquote,footer,ol,details,form,p,dialog,h1,h2,h3,h4,h5,h6,pre,dd,header,section,div,hgroup,table,dl,hr,ul,dt",!0);function ct(e){const t=e.charAt(0),n=e.length-1;return('"'===t||"'"===t)&&t===e.charAt(n)?e.slice(1,n):e}class ut{constructor(){this.styles=[]}extractStyle(e){let t=e;return t=t.replace(/<style\s?[^>]*>((.|\n|\s)+?)<\/style>/g,(e,t)=>{const n=t.trim();return this.stringToSelector(n),""}),t.trim()}stringToSelector(e){let t=e.indexOf("{");for(;t>-1;){const n=e.indexOf("}"),i=e.slice(0,t).trim();let r=e.slice(t+1,n);r=r.replace(/:(.*);/g,(function(e,t){return`:${t.trim().replace(/ +/g,"+++")};`})),r=r.replace(/ /g,""),r=r.replace(/\+\+\+/g," "),/;$/.test(r)||(r+=";"),i.split(",").forEach(e=>{const t=this.parseSelector(e);this.styles.push({content:r,selectorList:t})}),t=(e=e.slice(n+1)).indexOf("{")}}parseSelector(e){return e.trim().replace(/ *([>~+]) */g," $1").replace(/ +/g," ").split(" ").map(e=>{const t=e.charAt(0),n={isChild:">"===t,isGeneralSibling:"~"===t,isAdjacentSibling:"+"===t,tag:null,id:null,class:[],attrs:[]};return""!==(e=(e=(e=e.replace(/^[>~+]/,"")).replace(/\[(.+?)\]/g,(function(e,t){const[i,r]=t.split("="),o=-1===t.indexOf("="),s={all:o,key:i,value:o?null:r};return n.attrs.push(s),""}))).replace(/([.#][A-Za-z0-9-_]+)/g,(function(e,t){return"#"===t[0]?n.id=t.substr(1):"."===t[0]&&n.class.push(t.substr(1)),""})))&&(n.tag=e),n})}matchStyle(e,t,n){var i;return(i=this.styles,i.sort((e,t)=>{const n=dt(e.selectorList),i=dt(t.selectorList);if(n!==i)return n-i;const r=ht(e.selectorList),o=ht(t.selectorList);return r!==o?r-o:ft(e.selectorList)-ft(t.selectorList)})).reduce((i,{content:r,selectorList:o},s)=>{let a=n[s],c=o[a];const u=o[a+1];((null==u?void 0:u.isGeneralSibling)||(null==u?void 0:u.isAdjacentSibling))&&(c=u,a+=1,n[s]+=1);let l=this.matchCurrent(e,t,c);if(l&&c.isGeneralSibling){let e=lt(t);for(;e;){if(e.h5tagName&&this.matchCurrent(e.h5tagName,e,o[a-1])){l=!0;break}e=lt(e),l=!1}}if(l&&c.isAdjacentSibling){const e=lt(t);if(e&&e.h5tagName){this.matchCurrent(e.h5tagName,e,o[a-1])||(l=!1)}else l=!1}if(l){if(a===o.length-1)return i+r;a<o.length-1&&(n[s]+=1)}else c.isChild&&a>0&&(n[s]-=1,this.matchCurrent(e,t,o[n[s]])&&(n[s]+=1));return i},"")}matchCurrent(e,t,n){if(n.tag&&n.tag!==e)return!1;if(n.id&&n.id!==t.id)return!1;if(n.class.length){const e=t.className.split(" ");for(let t=0;t<n.class.length;t++){const i=n.class[t];if(-1===e.indexOf(i))return!1}}if(n.attrs.length)for(let e=0;e<n.attrs.length;e++){const{all:i,key:r,value:o}=n.attrs[e];if(i&&!t.hasAttribute(r))return!1;if(t.getAttribute(r)!==ct(o||""))return!1}return!0}}function lt(e){if(!e.parentElement)return null;const t=e.previousSibling;return t?1===t.nodeType?t:lt(t):null}function dt(e){return e.reduce((e,t)=>e+(t.id?1:0),0)}function ht(e){return e.reduce((e,t)=>e+t.class.length+t.attrs.length,0)}function ft(e){return e.reduce((e,t)=>e+(t.tag?1:0),0)}const pt={li:["ul","ol","menu"],dt:["dl"],dd:["dl"],tbody:["table"],thead:["table"],tfoot:["table"],tr:["table"],td:["table"]};function gt(e,t){const n=pt[e];if(n){let i=t.length-1;for(;i>=0;){const r=t[i].tagName;if(r===e)break;if(n&&n.includes(r))return!0;i--}}return!1}function vt(e){const t=e.indexOf("=");return-1===t?[e]:[e.slice(0,t).trim(),e.slice(t+"=".length).trim()]}function yt(e,t,n,i){return e.filter(e=>"comment"!==e.type&&("text"!==e.type||""!==e.content)).map(e=>{if("text"===e.type){const n=t.createTextNode(e.content);return Object(o.h)(Ue.html.transformText)?Ue.html.transformText(n,e):(null==i||i.appendChild(n),n)}const r=t.createElement((s=e.tagName,Ue.html.renderHTMLTag?s:rt[s]?rt[s]:ot(s)?s:at(s)?"view":st(s)?"text":"view"));var s;r.h5tagName=e.tagName,null==i||i.appendChild(r),Ue.html.renderHTMLTag||(r.className=`h5-${e.tagName}`);for(let t=0;t<e.attributes.length;t++){const n=e.attributes[t],[i,o]=vt(n);if("class"===i)r.className+=" "+ct(o);else{if("o"===i[0]&&"n"===i[1])continue;r.setAttribute(i,null==o||ct(o))}}const{styleTagParser:a,descendantList:c}=n,u=c.slice(),l=a.matchStyle(e.tagName,r,u);return r.setAttribute("style",l+r.style.cssText),yt(e.children,t,{styleTagParser:a,descendantList:u},r),Object(o.h)(Ue.html.transformElement)?Ue.html.transformElement(r,e):r})}function mt(e,t){const n=new ut;e=n.extractStyle(e);const i={tagName:"",children:[],type:"element",attributes:[]};return function e(t){const{tokens:n,stack:i}=t;let{cursor:r}=t;const o=n.length;let s=i[i.length-1].children;for(;r<o;){const t=n[r];if("tag-start"!==t.type){s.push(t),r++;continue}const a=n[++r];r++;const c=a.content.toLowerCase();if(t.close){let e=i.length,t=!1;for(;--e>-1;)if(i[e].tagName===c){t=!0;break}for(;r<o;){if("tag-end"!==n[r].type)break;r++}if(t){i.splice(e);break}continue}let u=Ue.html.closingElements.has(c);if(u&&(u=!gt(c,i)),u){let e=i.length-1;for(;e>0;){if(c===i[e].tagName){i.splice(e),s=i[e-1].children;break}e-=1}}const l=[];let d;for(;r<o&&(d=n[r],"tag-end"!==d.type);)l.push(d.content),r++;r++;const h=[],f={type:"element",tagName:a.content,attributes:l,children:h};if(s.push(f),!(d.close||Ue.html.voidElements.has(c))){i.push({tagName:c,children:h});const t={tokens:n,cursor:r,stack:i};e(t),r=t.cursor}}t.cursor=r}({tokens:new nt(e).scan(),options:Ue,cursor:0,stack:[i]}),yt(i.children,t,{styleTagParser:n,descendantList:Array(n.styles.length).fill(0)})}function _t(e,t,n){for(;e.firstChild;)e.removeChild(e.firstChild);const i=mt(t,n());for(let t=0;t<i.length;t++)e.appendChild(i[t])}function bt(e,t,n){var i,r;const o=mt(t,n());for(let t=0;t<o.length;t++){const n=o[t];switch(e){case"beforebegin":null===(i=this.parentNode)||void 0===i||i.insertBefore(n,this);break;case"afterbegin":this.hasChildNodes()?this.insertBefore(n,this.childNodes[0]):this.appendChild(n);break;case"beforeend":this.appendChild(n);break;case"afterend":null===(r=this.parentNode)||void 0===r||r.appendChild(n)}}}function St(e,t,n=!1){const i=t();let r;1===e.nodeType?r=i.createElement(e.nodeName):3===e.nodeType&&(r=i.createTextNode(""));for(const e in this){const t=this[e];[f,p].includes(e)&&"object"==typeof t?r[e]=Object.assign({},t):"_value"===e?r[e]=t:e===d&&(r.style._value=Object.assign({},t._value),r.style._usedStyleProp=new Set(Array.from(t._usedStyleProp)))}return n&&(r.childNodes=e.childNodes.map(e=>e.cloneNode(!0))),r}Ue.html={skipElements:new Set(["style","script"]),voidElements:new Set(["!doctype","area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),closingElements:new Set(["html","head","body","p","dt","dd","li","option","thead","th","tbody","tr","td","tfoot","colgroup"]),renderHTMLTag:!1};let wt=class{constructor(e){this.getDoc=()=>e(D.Document)()}bind(e){const t=this.getDoc;ENABLE_INNER_HTML&&(function(e,t){Object.defineProperty(e,"innerHTML",{configurable:!0,enumerable:!0,set(n){_t.call(e,e,n,t)},get:()=>""})}(e,t),ENABLE_ADJACENT_HTML&&function(e,t){e.insertAdjacentHTML=function(n,i){bt.call(e,n,i,t)}}(e,t)),ENABLE_CLONE_NODE&&(e.cloneNode=St.bind(e,e,t))}};function Dt(){return Ue.miniGlobal?new Promise(e=>{Ue.miniGlobal.createSelectorQuery().select(`#${this.uid}`).boundingClientRect(t=>{e(t)}).exec()}):Promise.resolve(null)}wt=s([Object(r.injectable)(),a(0,Object(r.inject)(u.TaroElementFactory)),c("design:paramtypes",[Function])],wt);let Tt=class{bind(e){ENABLE_SIZE_APIS&&(e.getBoundingClientRect=async function(...t){return await Dt.apply(e,t)}),ENABLE_TEMPLATE_CONTENT&&function(e){Object.defineProperty(e,"content",{configurable:!0,enumerable:!0,get:()=>function(e){if("template"===e.nodeName){const t=e._getElement(D.Element)("document-fragment");return t.childNodes=e.childNodes,e.childNodes=[t],t.parentNode=e,t.childNodes.forEach(e=>{e.parentNode=t}),t}}(e)})}(e)}};Tt=s([Object(r.injectable)()],Tt);let Et=class extends z{constructor(e,t,n,i,r){super(e,t,n,i),this._getText=r,this.nodeType=9,this.nodeName="#document"}createElement(e){return"root"===e?this._getElement(D.RootElement)():o.b.has(e)?this._getElement(D.FormElement)(e):this._getElement(D.Element)(e)}createElementNS(e,t){return this.createElement(t)}createTextNode(e){return this._getText(e)}getElementById(e){const t=w.get(e);return Object(o.j)(t)?null:t}querySelector(e){return/^#/.test(e)?this.getElementById(e.slice(1)):null}querySelectorAll(){return[]}createComment(){const e=this._getText("");return e.nodeName="comment",e}};Et=s([Object(r.injectable)(),a(0,Object(r.inject)(u.TaroNodeImpl)),a(1,Object(r.inject)(u.TaroElementFactory)),a(2,Object(r.inject)(u.Hooks)),a(3,Object(r.inject)(u.TaroElementImpl)),a(4,Object(r.inject)(u.TaroTextFactory)),c("design:paramtypes",[Function,Function,Function,Function,Function])],Et);let At=class{modifyMpEvent(e){var t;null===(t=this.modifyMpEventImpls)||void 0===t||t.forEach(t=>t(e))}modifyTaroEvent(e,t){var n;null===(n=this.modifyTaroEventImpls)||void 0===n||n.forEach(n=>n(e,t))}initNativeApi(e){var t;null===(t=this.initNativeApiImpls)||void 0===t||t.forEach(t=>t(e))}patchElement(e){var t;null===(t=this.patchElementImpls)||void 0===t||t.forEach(t=>t(e))}};s([Object(r.inject)(u.getLifecycle),c("design:type",Function)],At.prototype,"getLifecycle",void 0),s([Object(r.inject)(u.getPathIndex),c("design:type",Function)],At.prototype,"getPathIndex",void 0),s([Object(r.inject)(u.getEventCenter),c("design:type",Function)],At.prototype,"getEventCenter",void 0),s([Object(r.inject)(u.isBubbleEvents),c("design:type",Function)],At.prototype,"isBubbleEvents",void 0),s([Object(r.inject)(u.getSpecialNodes),c("design:type",Function)],At.prototype,"getSpecialNodes",void 0),s([Object(r.inject)(u.onRemoveAttribute),Object(r.optional)(),c("design:type",Function)],At.prototype,"onRemoveAttribute",void 0),s([Object(r.inject)(u.batchedEventUpdates),Object(r.optional)(),c("design:type",Function)],At.prototype,"batchedEventUpdates",void 0),s([Object(r.inject)(u.mergePageInstance),Object(r.optional)(),c("design:type",Function)],At.prototype,"mergePageInstance",void 0),s([Object(r.inject)(u.createPullDownComponent),Object(r.optional)(),c("design:type",Function)],At.prototype,"createPullDownComponent",void 0),s([Object(r.inject)(u.getDOMNode),Object(r.optional)(),c("design:type",Function)],At.prototype,"getDOMNode",void 0),s([Object(r.inject)(u.modifyHydrateData),Object(r.optional)(),c("design:type",Function)],At.prototype,"modifyHydrateData",void 0),s([Object(r.inject)(u.modifySetAttrPayload),Object(r.optional)(),c("design:type",Function)],At.prototype,"modifySetAttrPayload",void 0),s([Object(r.inject)(u.modifyRmAttrPayload),Object(r.optional)(),c("design:type",Function)],At.prototype,"modifyRmAttrPayload",void 0),s([Object(r.inject)(u.onAddEvent),Object(r.optional)(),c("design:type",Function)],At.prototype,"onAddEvent",void 0),s([Object(r.multiInject)(u.modifyMpEvent),Object(r.optional)(),c("design:type",Array)],At.prototype,"modifyMpEventImpls",void 0),s([Object(r.multiInject)(u.modifyTaroEvent),Object(r.optional)(),c("design:type",Array)],At.prototype,"modifyTaroEventImpls",void 0),s([Object(r.multiInject)(u.initNativeApi),Object(r.optional)(),c("design:type",Array)],At.prototype,"initNativeApiImpls",void 0),s([Object(r.multiInject)(u.patchElement),Object(r.optional)(),c("design:type",Array)],At.prototype,"patchElementImpls",void 0),At=s([Object(r.injectable)()],At);const Ot=new Set(["touchstart","touchmove","touchcancel","touchend","touchforcechange","tap","longpress","longtap","transitionend","animationstart","animationiteration","animationend"]),It=function(e,t){return e[t]},Ct=function(e){return`[${e}]`},Bt=function(e){return new e},kt=function(e){return Ot.has(e)},Nt=function(){return["view","text","image"]},Pt=new r.ContainerModule(e=>{e(u.getLifecycle).toFunction(It),e(u.getPathIndex).toFunction(Ct),e(u.getEventCenter).toFunction(Bt),e(u.isBubbleEvents).toFunction(kt),e(u.getSpecialNodes).toFunction(Nt)});function xt(e){Object.keys(o.c).forEach(t=>{if(t in u){const n=u[t],i=o.c[t];Object(o.f)(i)?i.forEach(t=>e.bind(n).toFunction(t)):e.isBound(n)?e.rebind(n).toFunction(i):e.bind(n).toFunction(i)}})}const Mt=new r.Container;let jt,Lt,Rt;"h5"!==e.env.TARO_ENV&&(Mt.bind(u.TaroElement).to(z).whenTargetNamed(D.Element),Mt.bind(u.TaroElement).to(Et).inSingletonScope().whenTargetNamed(D.Document),Mt.bind(u.TaroElement).to(Ke).whenTargetNamed(D.RootElement),Mt.bind(u.TaroElement).to(We).whenTargetNamed(D.FormElement),Mt.bind(u.TaroElementFactory).toFactory(e=>t=>n=>{const i=e.container.getNamed(u.TaroElement,t);return n&&(i.nodeName=n),i.tagName=i.nodeName.toUpperCase(),i}),Mt.bind(u.TaroText).to(A),Mt.bind(u.TaroTextFactory).toFactory(e=>t=>{const n=e.container.get(u.TaroText);return n._value=t,n}),Mt.bind(u.TaroNodeImpl).to(wt).inSingletonScope(),Mt.bind(u.TaroElementImpl).to(Tt).inSingletonScope()),Mt.bind(u.Hooks).to(At).inSingletonScope(),Mt.load(Pt),xt(Mt),"h5"!==e.env.TARO_ENV&&(jt=Mt.get(u.Hooks),Lt=Mt.get(u.TaroElementFactory),Rt=Lt(D.Document)());class Ht{constructor(e,t,n){this._stop=!1,this._end=!1,this.defaultPrevented=!1,this.timeStamp=Date.now(),this.type=e.toLowerCase(),this.mpEvent=n,this.bubbles=Boolean(t&&t.bubbles),this.cancelable=Boolean(t&&t.cancelable)}stopPropagation(){this._stop=!0}stopImmediatePropagation(){this._end=this._stop=!0}preventDefault(){this.defaultPrevented=!0}get target(){var e,t,n;const i=Rt.getElementById(null===(e=this.mpEvent)||void 0===e?void 0:e.target.id);return Object.assign(Object.assign(Object.assign({},null===(t=this.mpEvent)||void 0===t?void 0:t.target),null===(n=this.mpEvent)||void 0===n?void 0:n.detail),{dataset:null!==i?i.dataset:o.a})}get currentTarget(){var e,t,n;const i=Rt.getElementById(null===(e=this.mpEvent)||void 0===e?void 0:e.currentTarget.id);return null===i?this.target:Object.assign(Object.assign(Object.assign({},null===(t=this.mpEvent)||void 0===t?void 0:t.currentTarget),null===(n=this.mpEvent)||void 0===n?void 0:n.detail),{dataset:i.dataset})}}function Ut(e,t){if("string"==typeof e)return new Ht(e,{bubbles:!0,cancelable:!0});const n=new Ht(e.type,{bubbles:!0,cancelable:!0},e);for(const t in e)"currentTarget"!==t&&"target"!==t&&"type"!==t&&"timeStamp"!==t&&(n[t]=e[t]);return"confirm"===n.type&&"input"===(null==t?void 0:t.nodeName)&&(n.keyCode=13),n}const Ft={};function Gt(e){var t;null===(t=jt.modifyMpEvent)||void 0===t||t.call(jt,e),null==e.currentTarget&&(e.currentTarget=e.target);const n=Rt.getElementById(e.currentTarget.id);if(n){const t=()=>{var t;const i=Ut(e,n);null===(t=jt.modifyTaroEvent)||void 0===t||t.call(jt,i,n),n.dispatchEvent(i)};if("function"==typeof jt.batchedEventUpdates){const i=e.type;!jt.isBubbleEvents(i)||!function(e,t){var n;let i=!1;for(;(null==e?void 0:e.parentElement)&&"root"!==e.parentElement._path;){if(null===(n=e.parentElement.__handlers[t])||void 0===n?void 0:n.length){i=!0;break}e=e.parentElement}return i}(n,i)||"touchmove"===i&&n.props.catchMove?jt.batchedEventUpdates(()=>{Ft[i]&&(Ft[i].forEach(e=>e()),delete Ft[i]),t()}):(Ft[i]||(Ft[i]=[])).push(t)}else t()}}const Kt="undefined"!=typeof document&&!!document.scripts,Wt=Kt?document:o.a,zt=Kt?window:o.a;function Vt(){const e=Mt.get(u.TaroElementFactory)(D.Document)(),t=e.createElement.bind(e),n=t("html"),i=t("head"),r=t("body"),o=t("app");o.id="app";const s=t("container");return e.appendChild(n),n.appendChild(i),n.appendChild(r),r.appendChild(s),s.appendChild(o),e.documentElement=n,e.head=i,e.body=r,e.createEvent=Ut,e}const $t=Kt?Wt:Vt(),qt="Intel Mac OS X 10_14_5",Zt="AppleWebKit/534.36 (KHTML, like Gecko) NodeJS/v4.1.0 Chrome/76.0.3809.132 Safari/534.36",Jt=Kt?zt.navigator:{appCodeName:"Mozilla",appName:"Netscape",appVersion:"5.0 (Macintosh; "+qt+") "+Zt,cookieEnabled:!0,mimeTypes:[],onLine:!0,platform:"MacIntel",plugins:[],product:"Taro",productSub:"20030107",userAgent:"Mozilla/5.0 (Macintosh; "+qt+") "+Zt,vendor:"Joyent",vendorSub:""};let Yt;!function(){let e;"undefined"!=typeof performance&&null!==performance&&performance.now?Yt=function(){return performance.now()}:Date.now?(Yt=function(){return Date.now()-e},e=Date.now()):(Yt=function(){return(new Date).getTime()-e},e=(new Date).getTime())}();let Xt=0;const Qt="undefined"!=typeof requestAnimationFrame&&null!==requestAnimationFrame?requestAnimationFrame:function(e){const t=Yt(),n=Math.max(Xt+16,t);return setTimeout((function(){e(Xt=n)}),n-t)},en="undefined"!=typeof cancelAnimationFrame&&null!==cancelAnimationFrame?cancelAnimationFrame:function(e){clearTimeout(e)};function tn(e){return e.style}const nn=Kt?zt:{navigator:Jt,document:$t};if(!Kt){[...Object.getOwnPropertyNames(i||zt),...Object.getOwnPropertySymbols(i||zt)].forEach(e=>{"atob"!==e&&(Object.prototype.hasOwnProperty.call(nn,e)||(nn[e]=i[e]))}),$t.defaultView=nn}e.env.TARO_ENV&&"h5"!==e.env.TARO_ENV&&(nn.requestAnimationFrame=Qt,nn.cancelAnimationFrame=en,nn.getComputedStyle=tn,nn.addEventListener=function(){},nn.removeEventListener=function(){},"Date"in nn||(nn.Date=Date),"setTimeout"in nn||(nn.setTimeout=setTimeout));const rn={app:null,router:null,page:null},on=()=>rn;class sn{constructor(e){void 0!==e&&e.callbacks?this.callbacks=e.callbacks:this.callbacks={}}on(e,t,n){let i,r,o,s;if(!t)return this;e=e.split(sn.eventSplitter),this.callbacks||(this.callbacks={});const a=this.callbacks;for(;i=e.shift();)s=a[i],r=s?s.tail:{},r.next=o={},r.context=n,r.callback=t,a[i]={tail:o,next:s?s.next:r};return this}once(e,t,n){const i=(...r)=>{t.apply(this,r),this.off(e,i,n)};return this.on(e,i,n),this}off(e,t,n){let i,r,o,s,a,c;if(!(r=this.callbacks))return this;if(!(e||t||n))return delete this.callbacks,this;for(e=e?e.split(sn.eventSplitter):Object.keys(r);i=e.shift();)if(o=r[i],delete r[i],o&&(t||n))for(s=o.tail;(o=o.next)!==s;)a=o.callback,c=o.context,(t&&a!==t||n&&c!==n)&&this.on(i,a,c);return this}trigger(e){let t,n,i,r;if(!(i=this.callbacks))return this;e=e.split(sn.eventSplitter);const o=[].slice.call(arguments,1);for(;t=e.shift();)if(n=i[t])for(r=n.tail;(n=n.next)!==r;)n.callback.apply(n.context||this,o);return this}}sn.eventSplitter=/\s+/;const an=Mt.get(u.Hooks).getEventCenter(sn);Mt.bind(u.eventCenter).toConstantValue(an);const cn=new Map,un=g(),ln=Mt.get(u.Hooks);function dn(e,t){var n;null===(n=ln.mergePageInstance)||void 0===n||n.call(ln,cn.get(t),e),cn.set(t,e)}function hn(e){return cn.get(e)}function fn(e){return null==e?"":"/"===e.charAt(0)?e:"/"+e}function pn(e,t,...n){const i=cn.get(e);if(null==i)return;const r=ln.getLifecycle(i,t);if(Object(o.f)(r)){return r.map(e=>e.apply(i,n))[0]}return Object(o.h)(r)?r.apply(i,n):void 0}function gn(e){if(null==e)return"";const t=Object.keys(e).map(t=>t+"="+e[t]).join("&");return""===t?t:"?"+t}function vn(e,t){let n=e;return Kt||(n=e+gn(t)),n}function yn(e){return e+".onReady"}function mn(e){return e+".onShow"}function _n(e){return e+".onHide"}function bn(e,t,n,i){var r,s;const a=null!=t?t:`taro_page_${un()}`;let c=null,u=!1,l=[];const d={onLoad(t,n){Fe.start("页面初始化"),rn.page=this,this.config=i||{},t.$taroTimestamp=Date.now(),this.$taroPath=vn(a,t),null==this.$taroParams&&(this.$taroParams=Object.assign({},t));const r=Kt?this.$taroPath:this.route||this.__route__;rn.router={params:this.$taroParams,path:fn(r),onReady:yn(a),onShow:mn(a),onHide:_n(a)};const s=()=>{rn.app.mount(e,this.$taroPath,()=>{c=$t.getElementById(this.$taroPath),Object(o.d)(null!==c,"没有找到页面实例。"),pn(this.$taroPath,"onLoad",this.$taroParams),Kt?Object(o.h)(n)&&n():(c.ctx=this,c.performUpdate(!0,n))})};u?l.push(s):s()},onReady(){Qt(()=>{an.trigger(yn(a))}),pn(this.$taroPath,"onReady"),this.onReady.called=!0},onUnload(){u=!0,rn.app.unmount(this.$taroPath,()=>{u=!1,cn.delete(this.$taroPath),c&&(c.ctx=null),l.length&&(l.forEach(e=>e()),l=[])})},onShow(){rn.page=this,this.config=i||{};const e=Kt?this.$taroPath:this.route||this.__route__;rn.router={params:this.$taroParams,path:fn(e),onReady:yn(a),onShow:mn(a),onHide:_n(a)},Qt(()=>{an.trigger(mn(a))}),pn(this.$taroPath,"onShow")},onHide(){rn.page=null,rn.router=null,pn(this.$taroPath,"onHide"),an.trigger(_n(a))},onPullDownRefresh(){return pn(this.$taroPath,"onPullDownRefresh")},onReachBottom(){return pn(this.$taroPath,"onReachBottom")},onPageScroll(e){return pn(this.$taroPath,"onPageScroll",e)},onResize(e){return pn(this.$taroPath,"onResize",e)},onTabItemTap(e){return pn(this.$taroPath,"onTabItemTap",e)},onTitleClick(){return pn(this.$taroPath,"onTitleClick")},onOptionMenuClick(){return pn(this.$taroPath,"onOptionMenuClick")},onPopMenuClick(){return pn(this.$taroPath,"onPopMenuClick")},onPullIntercept(){return pn(this.$taroPath,"onPullIntercept")},onAddToFavorites(){return pn(this.$taroPath,"onAddToFavorites")}};return(e.onShareAppMessage||(null===(r=e.prototype)||void 0===r?void 0:r.onShareAppMessage)||e.enableShareAppMessage)&&(d.onShareAppMessage=function(e){const t=null==e?void 0:e.target;if(null!=t){const n=t.id,i=$t.getElementById(n);null!=i&&(e.target.dataset=i.dataset)}return pn(this.$taroPath,"onShareAppMessage",e)}),(e.onShareTimeline||(null===(s=e.prototype)||void 0===s?void 0:s.onShareTimeline)||e.enableShareTimeline)&&(d.onShareTimeline=function(){return pn(this.$taroPath,"onShareTimeline")}),d.eh=Gt,Object(o.j)(n)||(d.data=n),Kt&&(d.path=a),d}function Sn(e,t,n){var i,r,s;const a=null!=t?t:`taro_component_${un()}`;let c=null;const u={attached(){var t;Fe.start("页面初始化");const n=vn(a,{id:(null===(t=this.getPageId)||void 0===t?void 0:t.call(this))||un()});rn.app.mount(e,n,()=>{c=$t.getElementById(n),Object(o.d)(null!==c,"没有找到组件实例。"),pn(n,"onLoad"),Kt||(c.ctx=this,c.performUpdate(!0))})},detached(){const e=vn(a,{id:this.getPageId()});rn.app.unmount(e,()=>{cn.delete(e),c&&(c.ctx=null)})},methods:{eh:Gt}};return Object(o.j)(n)||(u.data=n),u.options=null!==(i=null==e?void 0:e.options)&&void 0!==i?i:o.a,u.externalClasses=null!==(r=null==e?void 0:e.externalClasses)&&void 0!==r?r:o.a,u.behaviors=null!==(s=null==e?void 0:e.behaviors)&&void 0!==s?s:o.a,u}function wn(e){return{properties:{i:{type:Object,value:{nn:"view"}},l:{type:String,value:""}},options:{addGlobalClass:!0,virtualHost:"custom-wrapper"!==e},methods:{eh:Gt}}}const Dn=Mt.get(u.Hooks);function Tn(e,t){var n;return Object(o.h)(t.render)||!!(null===(n=t.prototype)||void 0===n?void 0:n.isReactComponent)||t.prototype instanceof e.Component}let En,An=o.a,On=o.a;function In(e,t){const n=e.createElement;return i=>{const r=e=>e&&dn(e,t),s=Tn(e,i)?{ref:r}:{forwardedRef:r,reactReduxForwardedRef:r};return On===o.a&&(On=e.createContext("")),class extends e.Component{constructor(){super(...arguments),this.state={hasError:!1}}static getDerivedStateFromError(e){return{hasError:!0}}componentDidCatch(e,t){}render(){const e=this.state.hasError?[]:n(On.Provider,{value:t},n(i,Object.assign(Object.assign({},this.props),s)));return Kt?n("div",{id:t,className:"taro_page"},e):n("root",{id:t},e)}}}}function Cn(){Dn.getLifecycle=function(e,t){return e[t=t.replace(/^on(Show|Hide)$/,"componentDid$1")]},Dn.modifyMpEvent=function(e){e.type=e.type.replace(/-/g,"")},Dn.batchedEventUpdates=function(e){En.unstable_batchedUpdates(e)},Dn.mergePageInstance=function(e,t){e&&t&&("constructor"in e||Object.keys(e).forEach(n=>{Object(o.h)(t[n])?t[n]=[t[n],...e[n]]:t[n]=[...t[n]||[],...e[n]]}))},"h5"===e.env.TARO_ENV&&(Dn.createPullDownComponent=(e,t,n,i)=>{const r=Tn(n,e);return n.forwardRef((t,o)=>{const s=Object.assign({},t),a=r?{ref:o}:{forwardedRef:o,reactReduxForwardedRef:o};return n.createElement(i||"taro-pull-to-refresh",null,n.createElement(e,Object.assign(Object.assign({},s),a)))})},Dn.getDOMNode=e=>En.findDOMNode(e))}const Bn=g();function kn(e,t,n,i){An=t,En=n,Object(o.d)(!!En,"构建 React/Nerv 项目请把 process.env.FRAMEWORK 设置为 'react'/'nerv' ");const r=An.createRef(),s=Tn(An,e);Cn();class a extends An.Component{constructor(){super(...arguments),this.pages=[],this.elements=[]}mount(e,t,n){const i=t+Bn();this.pages.push(()=>An.createElement(e,{key:i,tid:t})),this.forceUpdate(n)}unmount(e,t){for(let t=0;t<this.elements.length;t++){if(this.elements[t].props.tid===e){this.elements.splice(t,1);break}}this.forceUpdate(t)}render(){for(;this.pages.length>0;){const e=this.pages.pop();this.elements.push(e())}let t=null;return s&&(t={ref:r}),An.createElement(e,t,Kt?An.createElement("div",null,this.elements.slice()):this.elements.slice())}}let c;Kt||(c=En.render(An.createElement(a),$t.getElementById("app")));const u=Object.create({render(e){c.forceUpdate(e)},mount(e,t,n){const i=In(An,t)(e);c.mount(i,t,n)},unmount(e,t){c.unmount(e,t)}},{config:{writable:!0,enumerable:!0,configurable:!0,value:i},onLaunch:{enumerable:!0,writable:!0,value(e){rn.router=Object.assign({params:null==e?void 0:e.query},e),Kt&&(c=En.render(An.createElement(a),$t.getElementById("app")));const t=r.current;if(null==t?void 0:t.taroGlobalData){const e=t.taroGlobalData,n=Object.keys(e),i=Object.getOwnPropertyDescriptors(e);n.forEach(t=>{Object.defineProperty(this,t,{configurable:!0,enumerable:!0,get:()=>e[t],set(n){e[t]=n}})}),Object.defineProperties(this,i)}this.$app=t,null!=t&&Object(o.h)(t.onLaunch)&&t.onLaunch(e)}},onShow:{enumerable:!0,writable:!0,value(e){const t=r.current;rn.router=Object.assign({params:null==e?void 0:e.query},e),null!=t&&Object(o.h)(t.componentDidShow)&&t.componentDidShow(e),l("onShow")}},onHide:{enumerable:!0,writable:!0,value(e){const t=r.current;null!=t&&Object(o.h)(t.componentDidHide)&&t.componentDidHide(e),l("onHide")}},onPageNotFound:{enumerable:!0,writable:!0,value(e){const t=r.current;null!=t&&Object(o.h)(t.onPageNotFound)&&t.onPageNotFound(e)}}});function l(e){const t=hn("taro-app");if(t){const n=r.current,i=Dn.getLifecycle(t,e);Array.isArray(i)&&i.forEach(e=>e.apply(n))}}return rn.app=u,rn.app}const Nn=g();function Pn(e,t,n,i){return An=t,En=n,Cn(),{properties:{props:{type:null,value:null,observer(e,t){t&&this.component.forceUpdate()}}},created(){rn.app||function(e,t){class n extends e.Component{constructor(){super(...arguments),this.root=e.createRef(),this.ctx=this.props.getCtx()}componentDidMount(){this.ctx.component=this;const e=this.root.current;e.ctx=this.ctx,e.performUpdate(!0)}render(){return e.createElement("root",{ref:this.root},this.props.renderComponent(this.ctx))}}class i extends e.Component{constructor(){super(...arguments),this.state={components:[]}}componentDidMount(){rn.app=this}mount(t,i,r){const o=e=>e&&dn(e,i),s=Tn(e,t)?{ref:o}:{forwardedRef:o,reactReduxForwardedRef:o},a={compId:i,element:e.createElement(n,{key:i,getCtx:r,renderComponent:n=>e.createElement(t,Object.assign(Object.assign({},(n.data||(n.data={})).props),s))})};this.setState({components:[...this.state.components,a]})}unmount(e){const t=this.state.components,n=t.findIndex(t=>t.compId===e),i=[...t.slice(0,n),...t.slice(n+1)];this.setState({components:i})}render(){return this.state.components.map(({element:e})=>e)}}Cn();const r=$t.getElementById("app");t.render(e.createElement(i,{}),r)}(An,En)},attached(){!function(){const e=getCurrentPages(),t=e[e.length-1];if(rn.page===t)return;rn.page=t;const n=t.route||t.__route__,i={params:t.options||{},path:fn(n),onReady:"",onHide:"",onShow:""};rn.router=i,t.options||Object.defineProperty(t,"options",{enumerable:!0,configurable:!0,get(){return this._optionsValue},set(e){i.params=e,this._optionsValue=e}})}(),this.compId=Nn(),this.config=i,rn.app.mount(e,this.compId,()=>this)},ready(){pn(this.compId,"onReady")},detached(){rn.app.unmount(this.compId)},pageLifetimes:{show(){pn(this.compId,"onShow")},hide(){pn(this.compId,"onHide")}},methods:{eh:Gt}}}function xn(e,t){return n=>{const i=e.extend({props:{tid:String},mixins:[n,{created(){dn(this,t)}}]});return{render:e=>e(Kt?"div":"root",{attrs:{id:t,class:Kt?"taro_page":""}},[e(i,{props:{tid:t}})])}}}let Mn;function jn(t,n,i){Mn=n,Object(o.d)(!!Mn,"构建 Vue 项目请把 process.env.FRAMEWORK 设置为 'vue'"),function(){const t=Mt.get(u.Hooks);t.onRemoveAttribute=function(e,t){const n=e.props;if(!n.hasOwnProperty(t)||Object(o.g)(n[t]))return e.setAttribute(t,!1),!0},t.getLifecycle=function(e,t){return e.$options[t]},"h5"===e.env.TARO_ENV&&(t.createPullDownComponent=(e,t,n)=>{const i=n.extend({props:{tid:String},mixins:[e,{created(){dn(this,t)}}]});return{name:"PullToRefresh",render(e){return e("taro-pull-to-refresh",{class:["hydrated"]},[e(i,this.$slots.default)])}}},t.getDOMNode=e=>e.$el)}(),Mn.config.getTagNamespace=o.k;const r=[],s=[];let a;const c=new Mn({render(e){for(;s.length>0;){const t=s.pop();r.push(t(e))}return e(t,{ref:"app"},r.slice())},methods:{mount(e,t,n){s.push(n=>n(e,{key:t})),this.updateSync(n)},updateSync(e){this._update(this._render(),!1),this.$children.forEach(e=>e._update(e._render(),!1)),e()},unmount(e,t){for(let t=0;t<r.length;t++){if(r[t].key===e){r.splice(t,1);break}}this.updateSync(t)}}});Kt||c.$mount($t.getElementById("app"));const l=Object.create({mount(e,t,n){const i=xn(Mn,t)(e);c.mount(i,t,n)},unmount(e,t){c.unmount(e,t)}},{config:{writable:!0,enumerable:!0,configurable:!0,value:i},onLaunch:{writable:!0,enumerable:!0,value(e){rn.router=Object.assign({params:null==e?void 0:e.query},e),Kt&&c.$mount($t.getElementById("app")),a=c.$refs.app,null!=a&&Object(o.h)(a.$options.onLaunch)&&a.$options.onLaunch.call(a,e)}},onShow:{writable:!0,enumerable:!0,value(e){rn.router=Object.assign({params:null==e?void 0:e.query},e),null!=a&&Object(o.h)(a.$options.onShow)&&a.$options.onShow.call(a,e)}},onHide:{writable:!0,enumerable:!0,value(e){null!=a&&Object(o.h)(a.$options.onHide)&&a.$options.onHide.call(a,e)}}});return rn.app=l,rn.app}function Ln(t,n,i){let r,s=[];Object(o.d)(!Object(o.h)(t._component),"入口组件不支持使用函数式组件"),function(){const t=Mt.get(u.Hooks);t.getLifecycle=function(e,t){return e.$options[t]},t.modifyMpEvent=function(e){e.type=e.type.replace(/-/g,"")},"h5"===e.env.TARO_ENV&&(t.createPullDownComponent=(e,t,n)=>{const i={props:{tid:String},created(){dn(this,t)}};return e.mixins=Object(o.f)(e.mixins)?e.mixins.push(i):[i],{render(){return n("taro-pull-to-refresh",{class:"hydrated"},[n(e,this.$slots.default)])}}},t.getDOMNode=e=>e.$el)}(),t._component.render=function(){return s.slice()},Kt||(r=t.mount("#app"));const a=Object.create({mount(e,t,i){const r=function(e,t){return function(n){var i;const r={props:{tid:String},created(){dn(this,t),this.$nextTick(()=>{pn(t,"onShow")})}};if(Object(o.f)(n.mixins)){const e=n.mixins,t=e.length-1;(null===(i=e[t].props)||void 0===i?void 0:i.tid)?n.mixins[t]=r:n.mixins.push(r)}else n.mixins=[r];return e(Kt?"div":"root",{key:t,id:t,class:Kt?"taro_page":""},[e(Object.assign({},n),{tid:t})])}}(n,t)(e);s.push(r),this.updateAppInstance(i)},unmount(e,t){s=s.filter(t=>t.key!==e),this.updateAppInstance(t)},updateAppInstance(e){r.$forceUpdate(),r.$nextTick(e)}},{config:{writable:!0,enumerable:!0,configurable:!0,value:i},onLaunch:{writable:!0,enumerable:!0,value(e){var n;if(rn.router=Object.assign({params:null==e?void 0:e.query},e),Kt&&(r=t.mount("#app")),t.taroGlobalData){const e=t.taroGlobalData,n=Object.keys(e),i=Object.getOwnPropertyDescriptors(e);n.forEach(t=>{Object.defineProperty(this,t,{configurable:!0,enumerable:!0,get:()=>e[t],set(n){e[t]=n}})}),Object.defineProperties(this,i)}const i=null===(n=null==r?void 0:r.$options)||void 0===n?void 0:n.onLaunch;Object(o.h)(i)&&i.call(r,e)}},onShow:{writable:!0,enumerable:!0,value(e){var t;rn.router=Object.assign({params:null==e?void 0:e.query},e);const n=null===(t=null==r?void 0:r.$options)||void 0===t?void 0:t.onShow;Object(o.h)(n)&&n.call(r,e)}},onHide:{writable:!0,enumerable:!0,value(e){var t;const n=null===(t=null==r?void 0:r.$options)||void 0===t?void 0:t.onHide;Object(o.h)(n)&&n.call(r,e)}}});return rn.app=a,rn.app}const Rn=e=>t=>{const n=An.useContext(On)||"taro-app",i=An.useRef(t);i.current!==t&&(i.current=t),An.useLayoutEffect(()=>{let t=hn(n),r=!1;null==t&&(r=!0,t=Object.create(null)),t=t;const s=(...e)=>i.current(...e);return Object(o.h)(t[e])?t[e]=[t[e],s]:t[e]=[...t[e]||[],s],r&&dn(t,n),()=>{const t=hn(n),i=t[e];i===s?t[e]=void 0:Object(o.f)(i)&&(t[e]=i.filter(e=>e!==s))}},[])},Hn=Rn("componentDidShow"),Un=Rn("componentDidHide"),Fn=Rn("onPullDownRefresh"),Gn=Rn("onReachBottom"),Kn=Rn("onPageScroll"),Wn=Rn("onResize"),zn=Rn("onShareAppMessage"),Vn=Rn("onTabItemTap"),$n=Rn("onTitleClick"),qn=Rn("onOptionMenuClick"),Zn=Rn("onPullIntercept"),Jn=Rn("onShareTimeline"),Yn=Rn("onAddToFavorites"),Xn=Rn("onReady"),Qn=(e=!1)=>e?rn.router:An.useMemo(()=>rn.router,[]),ei=()=>{};const ti=(e,t)=>{var n,i,r;const o=rn.router,s=()=>{setTimeout((function(){t?e.call(t):e()}),1)};if(null!==o){let a=null;const c=vn(function(e){return null==e?"":"/"===e.charAt(0)?e.slice(1):e}(o.path),o.params);a=$t.getElementById(c),(null==a?void 0:a.pendingUpdate)?Kt?null!==(r=null===(i=null===(n=a.firstChild)||void 0===n?void 0:n.componentOnReady)||void 0===i?void 0:i.call(n).then(()=>{s()}))&&void 0!==r||s():a.enqueueUpdateCallback(e,t):s()}else s()}}.call(this,n(48),n(21))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NON_CUSTOM_TAG_KEYS=t.POST_CONSTRUCT=t.DESIGN_PARAM_TYPES=t.PARAM_TYPES=t.TAGGED_PROP=t.TAGGED=t.MULTI_INJECT_TAG=t.INJECT_TAG=t.OPTIONAL_TAG=t.UNMANAGED_TAG=t.NAME_TAG=t.NAMED_TAG=void 0,t.NAMED_TAG="named",t.NAME_TAG="name",t.UNMANAGED_TAG="unmanaged",t.OPTIONAL_TAG="optional",t.INJECT_TAG="inject",t.MULTI_INJECT_TAG="multi_inject",t.TAGGED="inversify:tagged",t.TAGGED_PROP="inversify:tagged_props",t.PARAM_TYPES="inversify:paramtypes",t.DESIGN_PARAM_TYPES="design:paramtypes",t.POST_CONSTRUCT="post_construct",t.NON_CUSTOM_TAG_KEYS=[t.INJECT_TAG,t.MULTI_INJECT_TAG,t.NAME_TAG,t.UNMANAGED_TAG,t.NAMED_TAG,t.OPTIONAL_TAG]},function(e,t,n){var i,r,o,s,a,c,u,l,d,h,f,p,g,v,y,m,_,b,S;e.exports=(i=n(2),n(13),void(i.lib.Cipher||(r=i,o=r.lib,s=o.Base,a=o.WordArray,c=o.BufferedBlockAlgorithm,u=r.enc,u.Utf8,l=u.Base64,d=r.algo.EvpKDF,h=o.Cipher=c.extend({cfg:s.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){c.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?S:_}return function(t){return{encrypt:function(n,i,r){return e(i).encrypt(t,n,i,r)},decrypt:function(n,i,r){return e(i).decrypt(t,n,i,r)}}}}()}),o.StreamCipher=h.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),f=r.mode={},p=o.BlockCipherMode=s.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),g=f.CBC=function(){var e=p.extend();function t(e,t,n){var i,r=this._iv;r?(i=r,this._iv=void 0):i=this._prevBlock;for(var o=0;o<n;o++)e[t+o]^=i[o]}return e.Encryptor=e.extend({processBlock:function(e,n){var i=this._cipher,r=i.blockSize;t.call(this,e,n,r),i.encryptBlock(e,n),this._prevBlock=e.slice(n,n+r)}}),e.Decryptor=e.extend({processBlock:function(e,n){var i=this._cipher,r=i.blockSize,o=e.slice(n,n+r);i.decryptBlock(e,n),t.call(this,e,n,r),this._prevBlock=o}}),e}(),v=(r.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,i=n-e.sigBytes%n,r=i<<24|i<<16|i<<8|i,o=[],s=0;s<i;s+=4)o.push(r);var c=a.create(o,i);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},o.BlockCipher=h.extend({cfg:h.cfg.extend({mode:g,padding:v}),reset:function(){var e;h.reset.call(this);var t=this.cfg,n=t.iv,i=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=i.createEncryptor:(e=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(i,this,n&&n.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}),y=o.CipherParams=s.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),m=(r.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?a.create([1398893684,1701076831]).concat(n).concat(t):t).toString(l)},parse:function(e){var t,n=l.parse(e),i=n.words;return 1398893684==i[0]&&1701076831==i[1]&&(t=a.create(i.slice(2,4)),i.splice(0,4),n.sigBytes-=16),y.create({ciphertext:n,salt:t})}},_=o.SerializableCipher=s.extend({cfg:s.extend({format:m}),encrypt:function(e,t,n,i){i=this.cfg.extend(i);var r=e.createEncryptor(n,i),o=r.finalize(t),s=r.cfg;return y.create({ciphertext:o,key:n,iv:s.iv,algorithm:e,mode:s.mode,padding:s.padding,blockSize:e.blockSize,formatter:i.format})},decrypt:function(e,t,n,i){return i=this.cfg.extend(i),t=this._parse(t,i.format),e.createDecryptor(n,i).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),b=(r.kdf={}).OpenSSL={execute:function(e,t,n,i){i||(i=a.random(8));var r=d.create({keySize:t+n}).compute(e,i),o=a.create(r.words.slice(t),4*n);return r.sigBytes=4*t,y.create({key:r,iv:o,salt:i})}},S=o.PasswordBasedCipher=_.extend({cfg:_.cfg.extend({kdf:b}),encrypt:function(e,t,n,i){var r=(i=this.cfg.extend(i)).kdf.execute(n,e.keySize,e.ivSize);i.iv=r.iv;var o=_.encrypt.call(this,e,t,r.key,i);return o.mixIn(r),o},decrypt:function(e,t,n,i){i=this.cfg.extend(i),t=this._parse(t,i.format);var r=i.kdf.execute(n,e.keySize,e.ivSize,t.salt);return i.iv=r.iv,_.decrypt.call(this,e,t,r.key,i)}}))))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.STACK_OVERFLOW=t.CIRCULAR_DEPENDENCY_IN_FACTORY=t.POST_CONSTRUCT_ERROR=t.MULTIPLE_POST_CONSTRUCT_METHODS=t.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK=t.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE=t.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE=t.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT=t.ARGUMENTS_LENGTH_MISMATCH=t.INVALID_DECORATOR_OPERATION=t.INVALID_TO_SELF_VALUE=t.INVALID_FUNCTION_BINDING=t.INVALID_MIDDLEWARE_RETURN=t.NO_MORE_SNAPSHOTS_AVAILABLE=t.INVALID_BINDING_TYPE=t.NOT_IMPLEMENTED=t.CIRCULAR_DEPENDENCY=t.UNDEFINED_INJECT_ANNOTATION=t.MISSING_INJECT_ANNOTATION=t.MISSING_INJECTABLE_ANNOTATION=t.NOT_REGISTERED=t.CANNOT_UNBIND=t.AMBIGUOUS_MATCH=t.KEY_NOT_FOUND=t.NULL_ARGUMENT=t.DUPLICATED_METADATA=t.DUPLICATED_INJECTABLE_DECORATOR=void 0,t.DUPLICATED_INJECTABLE_DECORATOR="Cannot apply @injectable decorator multiple times.",t.DUPLICATED_METADATA="Metadata key was used more than once in a parameter:",t.NULL_ARGUMENT="NULL argument",t.KEY_NOT_FOUND="Key Not Found",t.AMBIGUOUS_MATCH="Ambiguous match found for serviceIdentifier:",t.CANNOT_UNBIND="Could not unbind serviceIdentifier:",t.NOT_REGISTERED="No matching bindings found for serviceIdentifier:",t.MISSING_INJECTABLE_ANNOTATION="Missing required @injectable annotation in:",t.MISSING_INJECT_ANNOTATION="Missing required @inject or @multiInject annotation in:";t.UNDEFINED_INJECT_ANNOTATION=function(e){return"@inject called with undefined this could mean that the class "+e+" has a circular dependency problem. You can use a LazyServiceIdentifer to overcome this limitation."},t.CIRCULAR_DEPENDENCY="Circular dependency found:",t.NOT_IMPLEMENTED="Sorry, this feature is not fully implemented yet.",t.INVALID_BINDING_TYPE="Invalid binding type:",t.NO_MORE_SNAPSHOTS_AVAILABLE="No snapshot available to restore.",t.INVALID_MIDDLEWARE_RETURN="Invalid return type in middleware. Middleware must return!",t.INVALID_FUNCTION_BINDING="Value provided to function binding must be a function!",t.INVALID_TO_SELF_VALUE="The toSelf function can only be applied when a constructor is used as service identifier",t.INVALID_DECORATOR_OPERATION="The @inject @multiInject @tagged and @named decorators must be applied to the parameters of a class constructor or a class property.";t.ARGUMENTS_LENGTH_MISMATCH=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return"The number of constructor arguments in the derived class "+e[0]+" must be >= than the number of constructor arguments of its base class."},t.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT="Invalid Container constructor argument. Container options must be an object.",t.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE="Invalid Container option. Default scope must be a string ('singleton' or 'transient').",t.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE="Invalid Container option. Auto bind injectable must be a boolean",t.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK="Invalid Container option. Skip base check must be a boolean",t.MULTIPLE_POST_CONSTRUCT_METHODS="Cannot apply @postConstruct decorator multiple times in the same class";t.POST_CONSTRUCT_ERROR=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return"@postConstruct error in class "+e[0]+": "+e[1]};t.CIRCULAR_DEPENDENCY_IN_FACTORY=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return"It looks like there is a circular dependency in one of the '"+e[0]+"' bindings. Please investigate bindings withservice identifier '"+e[1]+"'."},t.STACK_OVERFLOW="Maximum call stack size exceeded"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var i=n(4),r=function(){function e(e,t){this.key=e,this.value=t}return e.prototype.toString=function(){return this.key===i.NAMED_TAG?"named: "+this.value.toString()+" ":"tagged: { key:"+this.key.toString()+", value: "+this.value+" }"},e}();t.Metadata=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(12),r=n(58);t.default=new class{constructor(){this.logMap=[{id:"debug"},{id:"info"},{id:"warn"},{id:"error"}],this.console=Object.assign({},console),this.debug=(...e)=>{this.console.debug(...e)},this.info=(...e)=>{this.console.info(...e)},this.log=(...e)=>{this.console.log(...e)},this.warn=(...e)=>{this.console.warn(...e)},this.error=(e,t)=>{this.console.error(e,t),r.default(t)},this.setLogLevel=e=>{const t=this.logMap.findIndex(t=>t.id===e);return-1!==t?(this.console=Object.assign({},console),this.logMap.map((e,n)=>{n<t&&(this.console[e.id]=()=>{})}),{success:!0,err:null}):{success:!1,err:i.default.GIZ_SDK_LOG_LEVEL_INVALID}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.checkHeader=e=>{let t=0;return 0===e[0]&&0===e[1]&&0===e[2]&&3===e[3]&&(t=4,4)};t.getProtocolLen=e=>{let t=0;for(;t<e.length&&"1"===i(e[t].toString(2),8)[0];t++);return t+1},t.arrayToString=function(e){let t="";return e.map(e=>(t+=i(e.toString(16),2),null)),t};const i=(e,t,n=!1)=>{const i=t-e.length,r=new Array(i).fill(0).join("");return n?e+=r:e=r+e,e};t.fillString=i;t.string2Bytes=e=>{const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return t};t.hexStrint2byte=e=>{const t=Math.ceil(e.length/2),n=[];for(let i=0;i<t;i++){const t=2*i,r=t+2,o=e.substring(t,r);n.push(parseInt(o,16))}return n};const r=e=>{const t=encodeURI(e);return-1!==t.indexOf("%")&&"%"!==e?t.split("%").filter(e=>""!==e).map(e=>parseInt(e,16)):[t.charCodeAt(0)]};t.formatCode=r;t.formatCodesFromStr=e=>{const t=[0,0];let n=[];for(let i=0;i<e.length;i++){const o=r(e[i]);t[1]+=o.length,n=n.concat(o)}return[n,t]};t.arrayToUint8=e=>{const t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0;i<t.byteLength;i++)n[i]=e[i];return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TargetTypeEnum=t.BindingTypeEnum=t.BindingScopeEnum=void 0;t.BindingScopeEnum={Request:"Request",Singleton:"Singleton",Transient:"Transient"};t.BindingTypeEnum={ConstantValue:"ConstantValue",Constructor:"Constructor",DynamicValue:"DynamicValue",Factory:"Factory",Function:"Function",Instance:"Instance",Invalid:"Invalid",Provider:"Provider"};t.TargetTypeEnum={ClassProperty:"ClassProperty",ConstructorArgument:"ConstructorArgument",Variable:"Variable"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tagProperty=t.tagParameter=t.decorate=void 0;var i=n(6),r=n(4);function o(e,t,n,r,o){var s={},a="number"==typeof o,c=void 0!==o&&a?o.toString():n;if(a&&void 0!==n)throw new Error(i.INVALID_DECORATOR_OPERATION);Reflect.hasOwnMetadata(e,t)&&(s=Reflect.getMetadata(e,t));var u=s[c];if(Array.isArray(u))for(var l=0,d=u;l<d.length;l++){var h=d[l];if(h.key===r.key)throw new Error(i.DUPLICATED_METADATA+" "+h.key.toString())}else u=[];u.push(r),s[c]=u,Reflect.defineMetadata(e,s,t)}function s(e,t){Reflect.decorate(e,t)}function a(e,t){return function(n,i){t(n,i,e)}}t.tagParameter=function(e,t,n,i){o(r.TAGGED,e,t,i,n)},t.tagProperty=function(e,t,n){o(r.TAGGED_PROP,e.constructor,t,n)},t.decorate=function(e,t,n){"number"==typeof n?s([a(n,e)],t):"string"==typeof n?Reflect.decorate([e],t,n):s([e],t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default={GIZ_OPENAPI_DEVICE_NOT_BOUND:{errorCode:9017,errorMessage:"not bind"},GIZ_SDK_HTTP_REQUEST_FAILED:{errorCode:8099,errorMessage:"网络请求失败"},GIZ_SDK_SDK_NOT_INITIALIZED:{errorCode:8300,errorMessage:"not init"},CONFIG_TIME_OUT:{errorCode:8023,errorMessage:"Config Timeout"},WECHAT_ERROR:{errorCode:1e4,errorMessage:"wechat error"},GIZ_SDK_ONBOARDING_STOPPED:{errorCode:8318,errorMessage:"配网中断"},GIZ_SDK_DEVICE_CONFIG_IS_RUNNING:{errorCode:8022,errorMessage:"配置正在进行中"},GIZ_OPENAPI_TOKEN_INVALID:{errorCode:9004,errorMessage:"token 失效"},GIZ_SDK_BIND_DEVICE_FAILED:{errorCode:8039,errorMessage:"设备绑定失败"},GIZ_SDK_BLE_BLUETOOTH_FUNCTION_NOT_TURNED_ON:{errorCode:8281,errorMessage:"蓝牙未启用"},GIZ_SDK_OTHERWISE:{errorCode:8100,errorMessage:""},GIZ_SDK_DEVICE_NOT_SUBSCRIBED:{errorCode:8029,errorMessage:"设备还未订阅"},GIZ_SDK_PRODUCTKEY_NOT_IN_SPECIFY:{errorCode:8250,errorMessage:"产品类型不在指定范围内"},GIZ_SDK_LOG_LEVEL_INVALID:{errorCode:8009,errorMessage:"产品类型不在指定范围内"}}},function(e,t,n){var i,r,o,s,a,c,u,l;e.exports=(l=n(2),n(26),n(27),r=(i=l).lib,o=r.Base,s=r.WordArray,a=i.algo,c=a.MD5,u=a.EvpKDF=o.extend({cfg:o.extend({keySize:4,hasher:c,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,i=this.cfg,r=i.hasher.create(),o=s.create(),a=o.words,c=i.keySize,u=i.iterations;a.length<c;){n&&r.update(n),n=r.update(e).finalize(t),r.reset();for(var l=1;l<u;l++)n=r.finalize(n),r.reset();o.concat(n)}return o.sigBytes=4*c,o}}),i.EvpKDF=function(e,t,n){return u.create(n).compute(e,t)},l.EvpKDF)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9);class r{constructor(e){this.header="",this.len=0,this.flag=[0],this.cmd="",this.content=[],this.formatP0=e=>{let t=i.checkHeader(e);if(!1===t)throw new Error("Header Error");this.header=i.arrayToString(e.slice(0,t));const n=e.slice(t,e.length),o=i.getProtocolLen(n);this.len=r.decodeLen(n.slice(0,o)),t+=o,this.flag=e.slice(t,t+1),t+=1,this.cmd=i.arrayToString(e.slice(t,t+2)),t+=2,this.content=e.slice(t,e.length)},e&&e.length>0&&this.formatP0(e)}}r.decodeLen=e=>{let t=1,n=0,i=0,r=0;do{i=e[r],n+=(127&i)*t,t*=128,r+=1}while(0!=(128&i));return n},t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.id=void 0;var i=0;t.id=function(){return i++}},function(e,t,n){var i,r,o;e.exports=(o=n(2),r=(i=o).lib.WordArray,i.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,i=this._map;e.clamp();for(var r=[],o=0;o<n;o+=3)for(var s=(t[o>>>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,a=0;a<4&&o+.75*a<n;a++)r.push(i.charAt(s>>>6*(3-a)&63));var c=i.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<n.length;o++)i[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=e.indexOf(s);-1!==a&&(t=a)}return function(e,t,n){for(var i=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,c=n[e.charCodeAt(s)]>>>6-s%4*2,u=a|c;i[o>>>2]|=u<<24-o%4*8,o++}return r.create(i,o)}(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o.enc.Base64)},function(e,t,n){var i;e.exports=(i=n(2),function(e){var t=i,n=t.lib,r=n.WordArray,o=n.Hasher,s=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=s.MD5=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var i=t+n,r=e[i];e[i]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var o=this._hash.words,s=e[t+0],c=e[t+1],f=e[t+2],p=e[t+3],g=e[t+4],v=e[t+5],y=e[t+6],m=e[t+7],_=e[t+8],b=e[t+9],S=e[t+10],w=e[t+11],D=e[t+12],T=e[t+13],E=e[t+14],A=e[t+15],O=o[0],I=o[1],C=o[2],B=o[3];O=u(O,I,C,B,s,7,a[0]),B=u(B,O,I,C,c,12,a[1]),C=u(C,B,O,I,f,17,a[2]),I=u(I,C,B,O,p,22,a[3]),O=u(O,I,C,B,g,7,a[4]),B=u(B,O,I,C,v,12,a[5]),C=u(C,B,O,I,y,17,a[6]),I=u(I,C,B,O,m,22,a[7]),O=u(O,I,C,B,_,7,a[8]),B=u(B,O,I,C,b,12,a[9]),C=u(C,B,O,I,S,17,a[10]),I=u(I,C,B,O,w,22,a[11]),O=u(O,I,C,B,D,7,a[12]),B=u(B,O,I,C,T,12,a[13]),C=u(C,B,O,I,E,17,a[14]),O=l(O,I=u(I,C,B,O,A,22,a[15]),C,B,c,5,a[16]),B=l(B,O,I,C,y,9,a[17]),C=l(C,B,O,I,w,14,a[18]),I=l(I,C,B,O,s,20,a[19]),O=l(O,I,C,B,v,5,a[20]),B=l(B,O,I,C,S,9,a[21]),C=l(C,B,O,I,A,14,a[22]),I=l(I,C,B,O,g,20,a[23]),O=l(O,I,C,B,b,5,a[24]),B=l(B,O,I,C,E,9,a[25]),C=l(C,B,O,I,p,14,a[26]),I=l(I,C,B,O,_,20,a[27]),O=l(O,I,C,B,T,5,a[28]),B=l(B,O,I,C,f,9,a[29]),C=l(C,B,O,I,m,14,a[30]),O=d(O,I=l(I,C,B,O,D,20,a[31]),C,B,v,4,a[32]),B=d(B,O,I,C,_,11,a[33]),C=d(C,B,O,I,w,16,a[34]),I=d(I,C,B,O,E,23,a[35]),O=d(O,I,C,B,c,4,a[36]),B=d(B,O,I,C,g,11,a[37]),C=d(C,B,O,I,m,16,a[38]),I=d(I,C,B,O,S,23,a[39]),O=d(O,I,C,B,T,4,a[40]),B=d(B,O,I,C,s,11,a[41]),C=d(C,B,O,I,p,16,a[42]),I=d(I,C,B,O,y,23,a[43]),O=d(O,I,C,B,b,4,a[44]),B=d(B,O,I,C,D,11,a[45]),C=d(C,B,O,I,A,16,a[46]),O=h(O,I=d(I,C,B,O,f,23,a[47]),C,B,s,6,a[48]),B=h(B,O,I,C,m,10,a[49]),C=h(C,B,O,I,E,15,a[50]),I=h(I,C,B,O,v,21,a[51]),O=h(O,I,C,B,D,6,a[52]),B=h(B,O,I,C,p,10,a[53]),C=h(C,B,O,I,S,15,a[54]),I=h(I,C,B,O,c,21,a[55]),O=h(O,I,C,B,_,6,a[56]),B=h(B,O,I,C,A,10,a[57]),C=h(C,B,O,I,y,15,a[58]),I=h(I,C,B,O,T,21,a[59]),O=h(O,I,C,B,g,6,a[60]),B=h(B,O,I,C,w,10,a[61]),C=h(C,B,O,I,f,15,a[62]),I=h(I,C,B,O,b,21,a[63]),o[0]=o[0]+O|0,o[1]=o[1]+I|0,o[2]=o[2]+C|0,o[3]=o[3]+B|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;n[r>>>5]|=128<<24-r%32;var o=e.floor(i/4294967296),s=i;n[15+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(r+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,c=a.words,u=0;u<4;u++){var l=c[u];c[u]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,n,i,r,o,s){var a=e+(t&n|~t&i)+r+s;return(a<<o|a>>>32-o)+t}function l(e,t,n,i,r,o,s){var a=e+(t&i|n&~i)+r+s;return(a<<o|a>>>32-o)+t}function d(e,t,n,i,r,o,s){var a=e+(t^n^i)+r+s;return(a<<o|a>>>32-o)+t}function h(e,t,n,i,r,o,s){var a=e+(n^(t|~i))+r+s;return(a<<o|a>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),i.MD5)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8);function r(e){return Array.prototype.map.call(new Uint8Array(e),(function(e){return("00"+e.toString(16)).slice(-2)})).join("")}t.ab2hex=r,t.compareWXSDKVersion=function(e,t){const n=e.split("."),i=t.split("."),r=Math.max(e.length,t.length);for(;n.length<r;)n.push("0");for(;i.length<r;)i.push("0");for(let n=0;n<r;n++){const i=parseInt(e[n]),r=parseInt(t[n]);if(i>r)return 1;if(i<r)return-1}return 0},t.isError=e=>null!=e&&"symbol"==typeof e.errorCode,t.wrapErrorInfo=e=>({errorCode:e,errorMessage:e}),t.unionBy=(e,t)=>e.reduce((e,n)=>{const i=n[t];return e.some(e=>e[t]===i)||e.push(n),e},[]),t.isWXDevicesResult=function(e){return e.success&&"[object Array]"===Object.prototype.toString.call(e.bleDevices)},t.str2Buf=function(e){var t=e.length,n=new ArrayBuffer(t+2),i=new DataView(n);for(let n=0;n<t;n++)i.setUint8(n,parseInt(e[n],16));return n},t.numberArray2Uint8Array=e=>{const t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0;i<t.byteLength;i++)n[i]=e[i];return n};function o(e){if(25!=(e=e.slice(0,25)).length)throw new Error("数据不合法");const t=`${a(e[0])}${a(e[1])}`;if(e[2]!==(255&e.slice(3).reduce((e,t)=>e+t,0)))throw new Error("校验和不合法");const n=a(e[3]),i=e.slice(5,5+e[4]).map(e=>a(e));return{mac:t,cmd:parseInt(n,16),data:i}}function s(e){return Array.prototype.map.call(new Uint8Array(e),(function(e){return e}))}function a(e,t=2){return`${new Array(t).fill(0).join("")}${e.toString(16)}`.slice(-t)}t.advertisData2PkAndMac=(e,t)=>e&&e.byteLength>=22&&e.byteLength<=24?Object.assign(Object.assign({},((e,t)=>{let n=e.slice(e.byteLength-16),i=e.slice(0,e.byteLength-16),o=r(n);if(t.find(e=>e===o)){const e=r(i);return{productKey:o,mac:e}}{n=e.slice(0,16),i=e.slice(16),o=r(n);const t=r(i);return{productKey:o,mac:t}}})(e,t)),{bleWorkStatus:1}):e&&e.byteLength>24?((e,t)=>{if(!e||0===e.byteLength)return{bleWorkStatus:0,mac:"",productKey:""};let n=0,i="",o="",s=1;const a=new Uint8Array(e);for(;!(n>e.byteLength-1);){const c=a[n];if(c<=0||!c)break;if(e.byteLength<c+n+1)break;const u=e.slice(n+1,n+c+1);if(c>=6&&c<=8&&(i=r(u),16==i.length&&(i=i.substring(0,15))),16==c){const e=r(u).toLowerCase();t.find(t=>t===e)&&(o=e)}1==c&&(s=new Uint8Array(u)[0]),n+=1+c}return{bleWorkStatus:s,mac:i,productKey:o}})(e,t):{mac:"",productKey:"",bleWorkStatus:1},t.isSameDevice=(e,t)=>e.mac===t.mac&&e.productKey===t.productKey,t.merageBleLocalDevices=(e,n)=>(n.map(n=>{const i=e.find(e=>t.isSameDevice(e,n));i?(i.isBleOnline=!0,i.bleDeviceID=n.bleDeviceID,i.bleWorkStatus=n.bleWorkStatus):e.push(n)}),e),t.merageLanLocalDevices=(e,n)=>(n.map(n=>{const i=e.find(e=>t.isSameDevice(e,n));i?i.isLanOnline=!0:e.push(n)}),e),t.BTDevice2GDevice=(e,n)=>{let r={productKey:"",mac:"",bleWorkStatus:0},a={did:"",productKey:"",mac:"",bleWorkStatus:0,connectType:"NONE",isBleOnline:!0,isLanOnline:!1,isOnline:!1,name:e.name,isBind:!1,bleDeviceID:e.deviceId,ctime:(new Date).getTime()};switch(e.communicationType){case"BLE_BROADCAST":try{i.default.log("parse BLE_BROADCAST");const t=o(s(e.advertisData));r.productKey=t.data.join(""),r.mac=t.mac,a.connectType="BLE_BROADCAST"}catch(e){}break;default:r=t.advertisData2PkAndMac(e.advertisData,n)}return a=Object.assign(Object.assign({},a),r),a},t.getFirstConnectType=(e,t)=>{if(!t)return e.isLanOnline?"LAN":e.isBleOnline?"BLE":"WAN";if("WAN"===t)return"WAN";switch(t){case"BLE":return e.isBleOnline?"BLE":"NONE";case"LAN":return e.isLanOnline?"LAN":"NONE"}return"WAN"},t.getProductInfoThroughPK=(e,t)=>t.find(t=>t.productKey===e),t.mergeObject=(e,t)=>{for(let n in t)null!=t[n]&&""!==t[n]&&(e[n]=t[n]);return e},t.hex2ab=function(e){const t=[];for(let i=0;i<e.length;i+=2){var n=e.slice(i,i+2);t.push(parseInt(n,16))}return new Uint8Array(t)},t.parseBroadcastData=o,t.ab2numbers=s;let c=0;function u(e,t){let n=1,i=t;return e.map(e=>{const t=65535&(e^i);return i=n-t&65535,n<<=1,a(t,4)})}function l(e,t,n){if(n.length>22)throw new Error("最大长度为22");const r=[...n,...new Array(22-n.length).fill(0)],o=255&n.reduce((e,t)=>e+t,0),s=(t>>4<<12)+(o>>4<<8)+((15&t)<<4)+(15&o),c=Array.from({length:11},(e,t)=>(r[2*t]<<8)+r[2*t+1]);return i.default.log("明文",a(e,4),a((t<<8)+o,4),c.map(e=>a(e,4))),[a(e,4),a((t<<8)+o,4),...u(c,s)].map(e=>`${e.slice(2)}${e.slice(0,2)}`)}t.encrypt=u,t.convertToServiceUuids=({len:e=null,data:n=null,index:i=0,mac:r})=>{const o=null==e?Math.round(18*Math.random())+1:e,s=null==n?Array.from({length:o},e=>Math.round(255*Math.random())):n,a=[147,o,...s],u=l(r,(()=>{const e=c;return c=c+1&255,e})(),a);return[...new Set(u)].length!==u.length?t.convertToServiceUuids({len:o,data:s,index:i++,mac:r}):u},t.convertToUuids=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.circularDependencyToException=t.listMetadataForTarget=t.listRegisteredBindingsForServiceIdentifier=t.getServiceIdentifierAsString=t.getFunctionName=void 0;var i=n(6);function r(e){return"function"==typeof e?e.name:"symbol"==typeof e?e.toString():e}function o(e){if(e.name)return e.name;var t=e.toString(),n=t.match(/^function\s*([^\s(]+)/);return n?n[1]:"Anonymous function: "+t}t.getServiceIdentifierAsString=r,t.listRegisteredBindingsForServiceIdentifier=function(e,t,n){var i="",r=n(e,t);return 0!==r.length&&(i="\nRegistered bindings:",r.forEach((function(e){var t="Object";null!==e.implementationType&&(t=o(e.implementationType)),i=i+"\n "+t,e.constraint.metaData&&(i=i+" - "+e.constraint.metaData)}))),i},t.circularDependencyToException=function e(t){t.childRequests.forEach((function(t){if(function e(t,n){return null!==t.parentRequest&&(t.parentRequest.serviceIdentifier===n||e(t.parentRequest,n))}(t,t.serviceIdentifier)){var n=function(e){return function e(t,n){void 0===n&&(n=[]);var i=r(t.serviceIdentifier);return n.push(i),null!==t.parentRequest?e(t.parentRequest,n):n}(e).reverse().join(" --\x3e ")}(t);throw new Error(i.CIRCULAR_DEPENDENCY+" "+n)}e(t)}))},t.listMetadataForTarget=function(e,t){if(t.isTagged()||t.isNamed()){var n="",i=t.getNamedTag(),r=t.getCustomTags();return null!==i&&(n+=i.toString()+"\n"),null!==r&&r.forEach((function(e){n+=e.toString()+"\n"}))," "+e+"\n "+e+" - "+n}return" "+e},t.getFunctionName=o},function(e,t,n){var i;e.exports=(i=n(2),n(22),n(60),n(61),n(16),n(62),n(17),n(26),n(37),n(63),n(38),n(64),n(65),n(66),n(27),n(67),n(13),n(5),n(68),n(69),n(70),n(71),n(72),n(73),n(74),n(75),n(76),n(77),n(78),n(79),n(80),n(81),n(82),n(83),i)},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){var i,r,o,s,a,c;e.exports=(c=n(2),r=(i=c).lib,o=r.Base,s=r.WordArray,(a=i.x64={}).Word=o.extend({init:function(e,t){this.high=e,this.low=t}}),a.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,n=[],i=0;i<t;i++){var r=e[i];n.push(r.high),n.push(r.low)}return s.create(n,this.sigBytes)},clone:function(){for(var e=o.clone.call(this),t=e.words=this.words.slice(0),n=t.length,i=0;i<n;i++)t[i]=t[i].clone();return e}}),c)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default=e=>new Promise(t=>setTimeout(()=>t(),e))},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(39),o=n(35),s=n(12);t.default=(e,t,n=!0)=>i(void 0,void 0,void 0,(function*(){const i=Object.assign({},t),a={"Content-Type":"application/json","X-Gizwits-Application-Id":o.getGlobalData("appID")};n&&(a["X-Gizwits-User-token"]=o.getGlobalData("token")),i.header=Object.assign(Object.assign({},a),t.headers),delete i.headers;const c=o.getGlobalData("cloudServiceInfo").openAPIInfo,u=yield r.default("https://"+c+e,i);if(u.statusCode>=200&&u.statusCode<300)return{success:!0,data:u.data};let l={success:!1,err:{errorCode:s.default.GIZ_SDK_HTTP_REQUEST_FAILED.errorCode,errorMessage:""}};try{l={success:!1,err:{errorCode:u.data.error_code,errorMessage:u.data.error_message}}}catch(e){}return l}))},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=n=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var i,r,o,s,a,c,u,l;e.exports=(l=n(2),r=(i=l).lib,o=r.WordArray,s=r.Hasher,a=i.algo,c=[],u=a.SHA1=s.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],u=0;u<80;u++){if(u<16)c[u]=0|e[t+u];else{var l=c[u-3]^c[u-8]^c[u-14]^c[u-16];c[u]=l<<1|l>>>31}var d=(i<<5|i>>>27)+a+c[u];d+=u<20?1518500249+(r&o|~r&s):u<40?1859775393+(r^o^s):u<60?(r&o|r&s|o&s)-1894007588:(r^o^s)-899497514,a=s,s=o,o=r<<30|r>>>2,r=i,i=d}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(i+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),i.SHA1=s._createHelper(u),i.HmacSHA1=s._createHmacHelper(u),l.SHA1)},function(e,t,n){var i,r,o,s;e.exports=(i=n(2),o=(r=i).lib.Base,s=r.enc.Utf8,void(r.algo.HMAC=o.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=s.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var r=this._oKey=t.clone(),o=this._iKey=t.clone(),a=r.words,c=o.words,u=0;u<n;u++)a[u]^=1549556828,c[u]^=909522486;r.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})))},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(24);const o=new class{constructor(){this.data={},this.key="dataPointConfig",this.init=()=>i(this,void 0,void 0,(function*(){const e=(yield wx.getStorageSync(this.key))||"{}";let t={};try{t=JSON.parse(e)}catch(e){}this.data=t})),this.getConfigFile=e=>i(this,void 0,void 0,(function*(){var t;if(!this.data[e]){const n=`/app/datapoint?product_key=${e}`,i=yield r.default(`${n}`,{method:"GET"});if(!i.success||!(null===(t=i.data)||void 0===t?void 0:t.entities))return null;this.data[e]=i.data,wx.setStorageSync(this.key,JSON.stringify(this.data))}return this.data[e]}))}};o.init(),t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingOnSyntax=void 0;var i=n(30),r=function(){function e(e){this._binding=e}return e.prototype.onActivation=function(e){return this._binding.onActivation=e,new i.BindingWhenSyntax(this._binding)},e}();t.BindingOnSyntax=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingWhenSyntax=void 0;var i=n(29),r=n(54),o=function(){function e(e){this._binding=e}return e.prototype.when=function(e){return this._binding.constraint=e,new i.BindingOnSyntax(this._binding)},e.prototype.whenTargetNamed=function(e){return this._binding.constraint=r.namedConstraint(e),new i.BindingOnSyntax(this._binding)},e.prototype.whenTargetIsDefault=function(){return this._binding.constraint=function(e){return null!==e.target&&!e.target.isNamed()&&!e.target.isTagged()},new i.BindingOnSyntax(this._binding)},e.prototype.whenTargetTagged=function(e,t){return this._binding.constraint=r.taggedConstraint(e)(t),new i.BindingOnSyntax(this._binding)},e.prototype.whenInjectedInto=function(e){return this._binding.constraint=function(t){return r.typeConstraint(e)(t.parentRequest)},new i.BindingOnSyntax(this._binding)},e.prototype.whenParentNamed=function(e){return this._binding.constraint=function(t){return r.namedConstraint(e)(t.parentRequest)},new i.BindingOnSyntax(this._binding)},e.prototype.whenParentTagged=function(e,t){return this._binding.constraint=function(n){return r.taggedConstraint(e)(t)(n.parentRequest)},new i.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorIs=function(e){return this._binding.constraint=function(t){return r.traverseAncerstors(t,r.typeConstraint(e))},new i.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorIs=function(e){return this._binding.constraint=function(t){return!r.traverseAncerstors(t,r.typeConstraint(e))},new i.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorNamed=function(e){return this._binding.constraint=function(t){return r.traverseAncerstors(t,r.namedConstraint(e))},new i.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorNamed=function(e){return this._binding.constraint=function(t){return!r.traverseAncerstors(t,r.namedConstraint(e))},new i.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorTagged=function(e,t){return this._binding.constraint=function(n){return r.traverseAncerstors(n,r.taggedConstraint(e)(t))},new i.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorTagged=function(e,t){return this._binding.constraint=function(n){return!r.traverseAncerstors(n,r.taggedConstraint(e)(t))},new i.BindingOnSyntax(this._binding)},e.prototype.whenAnyAncestorMatches=function(e){return this._binding.constraint=function(t){return r.traverseAncerstors(t,e)},new i.BindingOnSyntax(this._binding)},e.prototype.whenNoAncestorMatches=function(e){return this._binding.constraint=function(t){return!r.traverseAncerstors(t,e)},new i.BindingOnSyntax(this._binding)},e}();t.BindingWhenSyntax=o},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}e.exports=function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(56);const i=n(57),r=n(12);t.errorCode=r.default;const o=n(36);t.BleHandle=o.BleHandle,t.default=i.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={};t.setGlobalData=function(e,t){i[e]=t},t.getGlobalData=function(e){return i[e]}},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},r=this&&this.__rest||function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n};Object.defineProperty(t,"__esModule",{value:!0});const o=n(18),s=n(40),a=n(41),c=n(9),u=n(14),l=n(42),d=n(84),h=n(43),f=n(8),p=n(44);class g extends p.default{constructor({pks:e=[],bleHandleParams:t={serviceUUIDSuffix:"abf0",characteristicUUIDSuffix:"abf7"},offlineThreshold:n}){super(),this.connectedList=[],this.connectingDevId=null,this.pks=[],this.listenDevOfflineTimer=null,this.boradcastDataCache={},this.tmpBleData="",this.tmpDataNum=0,this.peripheralServer=null,this.isActive=!0,this.scanList=[],this.onAppShow=()=>{this.isActive=!0,this.scanList.map(e=>{e.ctime=Date.now()})},this.onAppHide=()=>{this.isActive=!1},this.listenDevOffline=e=>{this.listenDevOfflineTimer=setInterval(()=>{if(!this.isActive)return;const t=(new Date).getTime(),n=this.scanList.filter(n=>{const i=this.connectedList.find(e=>n.bleDeviceID==e.deviceId),r=this.connectingDevId===n.bleDeviceID;return!(!i&&!r)||("BLE_BROADCAST"===n.connectType?t-n.ctime<2*e:t-n.ctime<e)});n.length!==this.scanList.length&&(this.scanList=n,this.notifyDevices())},500)},this.openBluetoothAdapter=(e="central")=>new Promise((t,n)=>{wx.openBluetoothAdapter({mode:e,success:()=>{t({success:!0}),wx.onBLECharacteristicValueChange(this.handleOnBLECharacteristicValueChange)},fail:e=>{f.default.error("openBluetoothAdapter fail",new Error(JSON.stringify(e))),this.notifyError({errMsg:e.errMsg,errCode:-1}),n({success:!1,err:e})}})}),this.handleOnBLECharacteristicValueChange=e=>{if(!e.value)return;console.log("handleOnBLECharacteristicValueChange",e);const t=o.ab2hex(e.value);try{const n=new u.default(c.hexStrint2byte(t));this.tmpBleData=t,this.tmpDataNum=n.len-e.value.byteLength+4+Math.ceil(n.len.toString(2).length/8)}catch(n){this.tmpBleData&&(this.tmpBleData+=t,this.tmpDataNum-=e.value.byteLength)}this.tmpDataNum>0||!this.tmpBleData||(this.notiDeviceDataToSdk(e,this.tmpBleData),this.tmpBleData="",this.tmpDataNum=0)},this.notiDeviceDataToSdk=(e,t)=>{this.listenerMap.GizBleDeviceData&&this.listenerMap.GizBleDeviceData.map(n=>{n(e,t)})},this.notifyError=e=>{this.listenerMap.GizBleError&&this.listenerMap.GizBleError.map(t=>{t(e)})},this.notifyDevices=()=>{this.listenerMap.GizBleDeviceList&&this.listenerMap.GizBleDeviceList.map(e=>{e(this.scanList)})},this.listenConnection=e=>{wx.onBLEConnectionStateChange(t=>{const n=this.connectedList.map(e=>e.deviceId).includes(e)&&t.deviceId===e&&!1===t.connected;f.default.log("蓝牙状态变化",{connectedList:this.connectedList,res:t,deviceId:e}),n&&this.connectDevice(e)})},this.init=()=>i(this,void 0,void 0,(function*(){const{platform:e}=wx.getSystemInfoSync();yield this.openBluetoothAdapter(),"ios"===e&&(yield this.openBluetoothAdapter("peripheral"));try{this.peripheralServer=(yield wx.createBLEPeripheralServer()).server,f.default.info("GIZ_SDK: 广播初始化成功",this.peripheralServer)}catch(e){f.default.error("GIZ_SDK: 广播初始化失败",new Error(JSON.stringify(e)))}return yield this.getBluetoothAdapterState()})),this.checkPermission=()=>i(this,void 0,void 0,(function*(){if((yield wx.getSetting()).authSetting["scope.bluetooth"])return yield this.init();try{return yield wx.authorize({scope:"scope.bluetooth"}),yield this.init()}catch(e){f.default.log("授权失败",e),this.openBluetoothAdapter(),this.notifyError({errMsg:e.errMsg,errCode:-1})}})),this.getBluetoothAdapterState=()=>i(this,void 0,void 0,(function*(){f.default.log("getBluetoothAdapterState",yield wx.getBluetoothAdapterState());const e=yield wx.getBluetoothAdapterState(),{errMsg:t,available:n}=e,i=r(e,["errMsg","available"]);return{data:Object.assign({},i),err:o.wrapErrorInfo(t),success:n}})),this.getDeviceStatus=(e,t,n,r)=>i(this,void 0,void 0,(function*(){const i=yield d.default.pack(t,n,r);return i?yield this.write(e,o.numberArray2Uint8Array(i).buffer):{success:!1}})),this.updateDevice=e=>{const t=e.bleDeviceID,n=this.scanList.findIndex(e=>t==e.bleDeviceID);-1!==n&&(this.scanList[n]=e)},this.checkDeviceIsChange=(e,t)=>e.bleWorkStatus!==t.bleWorkStatus||e.name!==t.name||e.isBleOnline!==t.isBleOnline||e.isOnline!==t.isOnline,this.handleBluetoothDeviceFound=(e,t)=>{o.unionBy(e.devices,"deviceId").map(e=>{const{advertisData:n,deviceId:i,name:r,localName:s}=e,a=o.ab2hex(n);let c=null;try{c=o.parseBroadcastData(o.ab2numbers(n))}catch(e){}const u=this.scanList.find(e=>e.bleDeviceID===i);if(c&&148===c.cmd){const t=o.ab2hex(n);if(this.boradcastDataCache[i]&&this.boradcastDataCache[i]===t)return!1;if(!u)return!1;this.boradcastDataCache[i]=o.ab2hex(n);const r=h.padBoradcastData(c.data.map(e=>parseInt(e,16)));this.notiDeviceDataToSdk(e,r)}else{if(c&&25===c.cmd){this.pks.find(e=>e===c.data.join(""))&&(e.communicationType="BLE_BROADCAST")}if(u){const n=o.BTDevice2GDevice(e,this.pks);if(n.productKey&&n.mac){const e=this.checkDeviceIsChange(n,u);n.ctime=Date.now(),this.updateDevice(n),e&&t(this.scanList)}}else{if(this.pks.some(e=>a.includes(e))){const n=o.BTDevice2GDevice(e,this.pks);n.productKey&&n.mac&&(this.scanList.push(n),t(this.scanList))}}}})},this.startScan=(e,t=5e3)=>i(this,void 0,void 0,(function*(){return new Promise(n=>i(this,void 0,void 0,(function*(){wx.onBluetoothDeviceFound(t=>{this.handleBluetoothDeviceFound(t,e)}),f.default.debug("GIZ_SDK: start scan",t),yield wx.startBluetoothDevicesDiscovery({powerLevel:"high",allowDuplicatesKey:!0,interval:0}),t>0&&setTimeout(()=>{this.stopScan(),n({scanList:this.scanList})},t)})))})),this.stopScan=()=>i(this,void 0,void 0,(function*(){try{return yield wx.stopBluetoothDevicesDiscovery()}catch(e){return e}})),this.connectDevice=e=>i(this,void 0,void 0,(function*(){var t;try{this.connectingDevId=e;try{yield this.stopScan();const t=yield s.retryConnect(e);t&&0==t.errCode&&"createBLEConnection:ok"===t.errMsg&&this.listenConnection(e)}catch(e){return f.default.error("GIZ_SDK: createBLEConnection error",new Error(JSON.stringify(e))),"createBLEConnection:fail:already connect"===(null==e?void 0:e.errMsg)?{success:!0}:(this.notifyError(e),{success:!1,message:null==e?void 0:e.errMsg})}const n=yield wx.getBLEDeviceServices({deviceId:e}).catch(e=>this.notifyError(e)),i=null===(t=null==n?void 0:n.services.find(e=>e.isPrimary&&e.uuid.toLowerCase().includes(this.serviceUUIDSuffix)))||void 0===t?void 0:t.uuid;if(!i)return{message:"can not find valid serviceId",success:!1};const r=yield wx.getBLEDeviceCharacteristics({deviceId:e,serviceId:i}).catch(e=>this.notifyError(e)),c=null==r?void 0:r.characteristics[0].uuid;this.connectedList.every(t=>t.deviceId!==e)&&this.connectedList.push({deviceId:e,serviceId:i,characteristicId:c}),yield wx.notifyBLECharacteristicValueChange({deviceId:e,serviceId:i,characteristicId:c,state:!0,type:"notification"}).catch(e=>this.notifyError(e)),this.write(e,o.numberArray2Uint8Array(a.default.pack()).buffer);const u=yield this.handleBindReq(e);if(f.default.log("handleBindReq",u),u.success){this.write(e,o.numberArray2Uint8Array(l.default.pack({passcode:u.data})).buffer);const t=yield this.handleLoginReq(e).catch(e=>this.notifyError(e));if(null==t?void 0:t.success)return{success:!0,message:"ok"}}else yield wx.closeBLEConnection({deviceId:e});return{success:!1,message:"ok"}}finally{this.connectingDevId=null}})),this.handleBindReq=e=>new Promise(t=>{const n=(i,r)=>{if(i.deviceId!==e)return;f.default.log("监听蓝牙特征值发生变化");const o=new a.default(c.hexStrint2byte(r));this.removeEventListener("GizBleDeviceData",n),o.passcode?t({success:!0,data:o.passcode}):t({success:!1,data:""})};this.watchBleDevice(e,n)}),this.handleLoginReq=e=>new Promise(t=>{const n=(i,r)=>{if(i.deviceId!==e)return;f.default.log("设备回复LoginReq",r);const o=new l.default(c.hexStrint2byte(r));this.removeEventListener("GizBleDeviceData",n),!0===o.result?t({success:!0,data:o.did}):t({success:!1,data:""})};this.watchBleDevice(e,n)}),this.watchBleDevice=(e,t)=>i(this,void 0,void 0,(function*(){const{serviceId:n,characteristicId:i,errMsg:r}=this.getTargetDevice(e);return r?{success:!1,message:r}:(yield wx.notifyBLECharacteristicValueChange({deviceId:e,serviceId:n,characteristicId:i,state:!0,type:"notification"}).catch(e=>this.notifyError(e)),f.default.log(`监听设备 ${e} 成功!`),this.addEventListener("GizBleDeviceData",t),{message:"ok",success:!0})})),this.writeBoradcast=(e,t)=>i(this,void 0,void 0,(function*(){const n=this.scanList.find(t=>t.bleDeviceID===e);if(!n)return{success:!1,message:"not found device"};this.boradcastTimer&&clearTimeout(this.boradcastTimer);try{this.peripheralServer.stopAdvertising({});const e=o.convertToServiceUuids({mac:n.mac,index:0,data:t,len:t.length});return this.peripheralServer.startAdvertising({advertiseRequest:{connectable:!0,serviceUuids:e},powerLevel:"high",success:e=>{f.default.debug("GIZ_SDK: startAdvertising success",e)},fail:e=>{f.default.error("GIZ_SDK: startAdvertising error",new Error(JSON.stringify(e)))}}),f.default.debug("GIZ_SDK: start adv",e),this.boradcastTimer=setTimeout(()=>{this.peripheralServer.stopAdvertising({}),this.boradcastTimer=null},1e3),{success:!0}}catch(e){return f.default.log("GIZ_SDK:",e),clearTimeout(this.boradcastTimer),{success:!1,message:"send cmd error"}}})),this.write=(e,t)=>i(this,void 0,void 0,(function*(){f.default.log("app => dev:",o.ab2hex(t));const n=this.getTargetDevice(e);if(n.serviceId&&n.characteristicId){return yield s.unpackWriteBLECharacteristicValue(e,n.serviceId,n.characteristicId,t)}return{success:!1,message:"send cmd error"}})),this.disConnectDevice=e=>i(this,void 0,void 0,(function*(){this.removeDevById(e);const{errMsg:t}=yield wx.closeBLEConnection({deviceId:e}),n=this.scanList.find(t=>t.bleDeviceID===e);return n&&(n.ctime=Date.now(),this.updateDevice(n)),"closeBLEConnection:ok"===t?{err:t,success:!0}:{err:t,success:!1}})),this.removeDevById=e=>{const t=this.connectedList.findIndex(t=>t.deviceId===e);-1!==t&&this.connectedList.splice(t,1)},this.getTargetDevice=e=>{const t=this.connectedList.find(t=>e===t.deviceId);return t||{errMsg:"Unable get this device,maybe you forgot to connect it."}},this.destory=()=>{this.listenDevOfflineTimer&&clearInterval(this.listenDevOfflineTimer),wx.offAppShow(this.onAppShow),wx.offAppHide(this.onAppHide)};const{serviceUUIDSuffix:p}=t;this.serviceUUIDSuffix=p,this.pks=e,this.listenDevOffline(null!=n?n:1e4),wx.onAppShow(this.onAppShow),wx.onAppHide(this.onAppHide)}}t.BleHandle=g},function(e,t,n){var i;e.exports=(i=n(2),function(e){var t=i,n=t.lib,r=n.WordArray,o=n.Hasher,s=t.algo,a=[],c=[];!function(){function t(t){for(var n=e.sqrt(t),i=2;i<=n;i++)if(!(t%i))return!1;return!0}function n(e){return 4294967296*(e-(0|e))|0}for(var i=2,r=0;r<64;)t(i)&&(r<8&&(a[r]=n(e.pow(i,.5))),c[r]=n(e.pow(i,1/3)),r++),i++}();var u=[],l=s.SHA256=o.extend({_doReset:function(){this._hash=new r.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],l=n[5],d=n[6],h=n[7],f=0;f<64;f++){if(f<16)u[f]=0|e[t+f];else{var p=u[f-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,v=u[f-2],y=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;u[f]=g+u[f-7]+y+u[f-16]}var m=i&r^i&o^r&o,_=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=h+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&l^~a&d)+c[f]+u[f];h=d,d=l,l=a,a=s+b|0,s=o,o=r,r=i,i=b+(_+m)|0}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+l|0,n[6]=n[6]+d|0,n[7]=n[7]+h|0},_doFinalize:function(){var t=this._data,n=t.words,i=8*this._nDataBytes,r=8*t.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=e.floor(i/4294967296),n[15+(r+64>>>9<<4)]=i,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=o._createHelper(l),t.HmacSHA256=o._createHmacHelper(l)}(Math),i.SHA256)},function(e,t,n){var i;e.exports=(i=n(2),n(22),function(){var e=i,t=e.lib.Hasher,n=e.x64,r=n.Word,o=n.WordArray,s=e.algo;function a(){return r.create.apply(r,arguments)}var c=[a(1116352408,3609767458),a(1899447441,602891725),a(3049323471,3964484399),a(3921009573,2173295548),a(961987163,4081628472),a(1508970993,3053834265),a(2453635748,2937671579),a(2870763221,3664609560),a(3624381080,2734883394),a(310598401,1164996542),a(607225278,1323610764),a(1426881987,3590304994),a(1925078388,4068182383),a(2162078206,991336113),a(2614888103,633803317),a(3248222580,3479774868),a(3835390401,2666613458),a(4022224774,944711139),a(264347078,2341262773),a(604807628,2007800933),a(770255983,1495990901),a(1249150122,1856431235),a(1555081692,3175218132),a(1996064986,2198950837),a(2554220882,3999719339),a(2821834349,766784016),a(2952996808,2566594879),a(3210313671,3203337956),a(3336571891,1034457026),a(3584528711,2466948901),a(113926993,3758326383),a(338241895,168717936),a(666307205,1188179964),a(773529912,1546045734),a(1294757372,1522805485),a(1396182291,2643833823),a(1695183700,2343527390),a(1986661051,1014477480),a(2177026350,1206759142),a(2456956037,344077627),a(2730485921,1290863460),a(2820302411,3158454273),a(3259730800,3505952657),a(3345764771,106217008),a(3516065817,3606008344),a(3600352804,1432725776),a(4094571909,1467031594),a(275423344,851169720),a(430227734,3100823752),a(506948616,1363258195),a(659060556,3750685593),a(883997877,3785050280),a(958139571,3318307427),a(1322822218,3812723403),a(1537002063,2003034995),a(1747873779,3602036899),a(1955562222,1575990012),a(2024104815,1125592928),a(2227730452,2716904306),a(2361852424,442776044),a(2428436474,593698344),a(2756734187,3733110249),a(3204031479,2999351573),a(3329325298,3815920427),a(3391569614,3928383900),a(3515267271,566280711),a(3940187606,3454069534),a(4118630271,4000239992),a(116418474,1914138554),a(174292421,2731055270),a(289380356,3203993006),a(460393269,320620315),a(685471733,587496836),a(852142971,1086792851),a(1017036298,365543100),a(1126000580,2618297676),a(1288033470,3409855158),a(1501505948,4234509866),a(1607167915,987167468),a(1816402316,1246189591)],u=[];!function(){for(var e=0;e<80;e++)u[e]=a()}();var l=s.SHA512=t.extend({_doReset:function(){this._hash=new o.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(e,t){for(var n=this._hash.words,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],l=n[5],d=n[6],h=n[7],f=i.high,p=i.low,g=r.high,v=r.low,y=o.high,m=o.low,_=s.high,b=s.low,S=a.high,w=a.low,D=l.high,T=l.low,E=d.high,A=d.low,O=h.high,I=h.low,C=f,B=p,k=g,N=v,P=y,x=m,M=_,j=b,L=S,R=w,H=D,U=T,F=E,G=A,K=O,W=I,z=0;z<80;z++){var V,$,q=u[z];if(z<16)$=q.high=0|e[t+2*z],V=q.low=0|e[t+2*z+1];else{var Z=u[z-15],J=Z.high,Y=Z.low,X=(J>>>1|Y<<31)^(J>>>8|Y<<24)^J>>>7,Q=(Y>>>1|J<<31)^(Y>>>8|J<<24)^(Y>>>7|J<<25),ee=u[z-2],te=ee.high,ne=ee.low,ie=(te>>>19|ne<<13)^(te<<3|ne>>>29)^te>>>6,re=(ne>>>19|te<<13)^(ne<<3|te>>>29)^(ne>>>6|te<<26),oe=u[z-7],se=oe.high,ae=oe.low,ce=u[z-16],ue=ce.high,le=ce.low;$=($=($=X+se+((V=Q+ae)>>>0<Q>>>0?1:0))+ie+((V+=re)>>>0<re>>>0?1:0))+ue+((V+=le)>>>0<le>>>0?1:0),q.high=$,q.low=V}var de,he=L&H^~L&F,fe=R&U^~R&G,pe=C&k^C&P^k&P,ge=B&N^B&x^N&x,ve=(C>>>28|B<<4)^(C<<30|B>>>2)^(C<<25|B>>>7),ye=(B>>>28|C<<4)^(B<<30|C>>>2)^(B<<25|C>>>7),me=(L>>>14|R<<18)^(L>>>18|R<<14)^(L<<23|R>>>9),_e=(R>>>14|L<<18)^(R>>>18|L<<14)^(R<<23|L>>>9),be=c[z],Se=be.high,we=be.low,De=K+me+((de=W+_e)>>>0<W>>>0?1:0),Te=ye+ge;K=F,W=G,F=H,G=U,H=L,U=R,L=M+(De=(De=(De=De+he+((de+=fe)>>>0<fe>>>0?1:0))+Se+((de+=we)>>>0<we>>>0?1:0))+$+((de+=V)>>>0<V>>>0?1:0))+((R=j+de|0)>>>0<j>>>0?1:0)|0,M=P,j=x,P=k,x=N,k=C,N=B,C=De+(ve+pe+(Te>>>0<ye>>>0?1:0))+((B=de+Te|0)>>>0<de>>>0?1:0)|0}p=i.low=p+B,i.high=f+C+(p>>>0<B>>>0?1:0),v=r.low=v+N,r.high=g+k+(v>>>0<N>>>0?1:0),m=o.low=m+x,o.high=y+P+(m>>>0<x>>>0?1:0),b=s.low=b+j,s.high=_+M+(b>>>0<j>>>0?1:0),w=a.low=w+R,a.high=S+L+(w>>>0<R>>>0?1:0),T=l.low=T+U,l.high=D+H+(T>>>0<U>>>0?1:0),A=d.low=A+G,d.high=E+F+(A>>>0<G>>>0?1:0),I=h.low=I+W,h.high=O+K+(I>>>0<W>>>0?1:0)},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return t[i>>>5]|=128<<24-i%32,t[30+(i+128>>>10<<5)]=Math.floor(n/4294967296),t[31+(i+128>>>10<<5)]=n,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(l),e.HmacSHA512=t._createHmacHelper(l)}(),i.SHA512)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){return new Promise((n,i)=>{wx.request(Object.assign(Object.assign({url:e,timeout:3e3},t),{success:e=>{n(e)},fail:e=>{i(e)}}))})}},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(8),o=n(23);function s(e,t){return new Promise((n,i)=>{wx.createBLEConnection({deviceId:e,timeout:t,success:e=>n(e),fail:e=>{-1===e.errCode?n(e):i(e)}})})}function a(e,t,n,i){return new Promise(r=>{wx.writeBLECharacteristicValue({deviceId:e,serviceId:t,characteristicId:n,value:i,complete:r})})}t.retryConnect=function(e,t=1e4){return i(this,void 0,void 0,(function*(){try{return yield s(e,t)}catch(n){return yield o.default(500),yield s(e,t)}}))},t.openBluetoothAdapter=function(){return new Promise((e,t)=>{wx.openBluetoothAdapter({success:e,fail:t})})},t.closeBluetoothAdapter=function(){return new Promise((e,t)=>{wx.closeBluetoothAdapter({success:e,fail:t})})},t.getBluetoothAdapterState=function(){return new Promise((e,t)=>{wx.getBluetoothAdapterState({success:e,fail:t})})},t.startBluetoothDevicesDiscovery=function(e=!0){return new Promise((t,n)=>{wx.startBluetoothDevicesDiscovery({success:t,fail:n,allowDuplicatesKey:e,powerLevel:"high",interval:0})})},t.getBluetoothDevices=function(){return new Promise((e,t)=>{wx.getBluetoothDevices({success:({devices:t})=>e(t),fail:t})})},t.createBLEConnection=s,t.getBLEDeviceServices=function(e){return new Promise((t,n)=>{wx.getBLEDeviceServices({deviceId:e,success:({services:e})=>t(e),fail:n})})},t.getBLEDeviceCharacteristics=function(e,t){return new Promise((n,i)=>{wx.getBLEDeviceCharacteristics({deviceId:e,serviceId:t,success:({characteristics:e})=>n(e),fail:i})})},t.notifyBLECharacteristicValueChange=function(e,t,n,i=!0){return new Promise((r,o)=>{wx.notifyBLECharacteristicValueChange({deviceId:e,serviceId:t,characteristicId:n,state:i,success:r,fail:o})})},t.writeBLECharacteristicValue=a,t.unpackWriteBLECharacteristicValue=function(e,t,n,s){if(!s||0===s.byteLength)throw new Error("value is empty");return new Promise((c,u)=>i(this,void 0,void 0,(function*(){let i,l=0,d=s.byteLength;for(;d>0;){yield o.default(30);const c=s.slice(l,l+20);if(l+=20,d-=20,i=yield a(e,t,n,c),r.default.log("unpackWriteBLECharacteristicValue",l/20,i),0!==i.errCode)break}0!==i.errCode?u(i):c(i)})))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(14),r=n(9);class o extends i.default{constructor(e){super(e),this.passcode="";let t=0;const n=parseInt(r.arrayToString(this.content.slice(t,t+2)),16);t+=2;let i="";this.content.slice(t,t+n).map(e=>{i+=String.fromCharCode(e)}),this.passcode=i}}o.pack=()=>[0,0,0,3,3,0,0,6],t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(14),r=n(9);class o extends i.default{constructor(e){super(e),this.result=!1,this.didLength=0,this.did="";let t=0;if(this.result=0===this.content[0],t++,1===this.flag[0]){this.didLength=parseInt(r.arrayToString(this.content.slice(t,t+2)),16),t+=2;let e="";this.content.slice(t,this.content.length).map(t=>{e+=String.fromCharCode(t)}),this.did=e}}}o.pack=({passcode:e})=>{let t=[0];const n=r.hexStrint2byte(r.fillString(e.length.toString(16),4)),i=r.string2Bytes(e),o=[0].concat([0,8]).concat(n).concat(i);return t=r.hexStrint2byte(o.length.toString(16)),[0,0,0,3].concat(t).concat(o)},t.default=o},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(28),o=n(9),s=e=>{const t=o.fillString(e,8*Math.ceil(e.length/8)),n=[];for(let e=0;e<t.length;e+=8)n.push(parseInt(t.substring(e,e+8),2));return n},a=e=>-1!==e.indexOf("uint")?"number":e,c=(e,t,n)=>{let i="";switch(e){case"bool":i=`${!0===t[n.name]?1:0}`;break;case"enum":{let e=t[n.name];"number"==typeof e&&(e=n.enum[e]);const r=n.enum.findIndex(t=>e===t),s=-1===r?0:r;i=o.fillString(s.toString(2),n.position.len);break}case"number":{let e=0;null!=t[n.name]&&(e=Math.round((t[n.name]-n.uint_spec.addition)/n.uint_spec.ratio)),i=o.fillString(e.toString(2),8*n.position.len);break}case"binary":{const e=t[n.name]||"",r=o.fillString(e,2*n.position.len,!0);for(let e=0;e<r.length/2;e++){const t=2*e,n=r[t]+r[t+1];i+=o.fillString(parseInt(n,16).toString(2),8)}break}}const r=n.position.len*("byte"===n.position.unit?8:1)-i.length;if(r>0)for(let e=0;e<r;e++)i=`0${i}`;return`${i}`},u=(e,t,n)=>{switch(e){case"bool":return"1"===t;case"enum":return parseInt(t,2);case"binary":{const e=n.position.len;let i="";for(let e=0;e<t.length/8;e++){const n=8*e,r=t.substring(n,n+8);i+=o.fillString(parseInt(r,2).toString(16),2)}return o.fillString(i,2*e,!0)}case"number":return parseInt(t,2)/(1/n.uint_spec.ratio)+n.uint_spec.addition;default:return""}},l=({config:e,data:t,isAdaptiveDatapoint:n})=>{let i=e;const r=[0,0,0,3],u=[0],l=[0,147],h=[0,0,0,0];let f=[1],p="";const g=[];n||(i=i.filter(e=>"status_writable"===e.type)),i.map(e=>{void 0!==t[e.name]?(p=`1${p}`,g.push(e)):p=`0${p}`}),n&&(f=[17],i=g),p=o.fillString(p,8*Math.ceil(p.length/8));for(let e=0;e<p.length/8;e++)f.push(parseInt(p.substring(8*e,8*(e+1)),2));let v,y="";try{v=i[0]}catch(e){}i.map(e=>{"bool"===e.data_type||"enum"===e.data_type?(v.type!==e.type&&(f=f.concat(s(y)),y=""),y=((e,n)=>{const i=a(e.data_type);return n=c(i,t,e)+n})(e,y)):(y.length>0&&(f=f.concat(s(y)),y=""),f=((e,n)=>{const i=a(e.data_type),r=c(i,t,e);return n=n.concat(s(r))})(e,f)),v=e}),y.length>0&&(f=f.concat(s(y)),y="");const m=u.concat(l).concat(h).concat(f),_=d(m);return r.push(..._),{data:r.concat(m),raw:{header:[0,0,0,3],flag:u,len:_,headerCmd:l,sn:h,cmd:f}}};function d(e){const t=e.length.toString(2),n=[];for(let e=t.length;e>0;e-=7){const i=e-7,r=e;let o=t.substring(i,r);o=`${i>0?"1":"0"}${o}`,n.push(parseInt(o,2))}return n}function h(e,t){return e===t||"ALL"===e}function f({attrs:e,activeAttrs:t,flagString:n,cmdData:i,accumulate:r}){let o=0,s={},a=0;return["status_writable","status_readonly","alert","fault"].map(c=>{const u=e.filter(e=>h(c,e.type)).length,{cmd:l,cmdDataLength:d}=p({type:c,attrs:e.slice(a,a+u),activeAttrs:t,flagString:n.substring(a,a+u),cmdData:i.slice(o,i.length),accumulate:r});return o+=d,s=Object.assign(Object.assign({},s),l),a+=u,null}),s}function p({type:e,attrs:t,activeAttrs:n,cmdData:i,flagString:r,accumulate:s}){let c=0,l=0,d=0;return n.map(t=>{if(h(e,t.type)){const e=t.position.len*("bit"===t.position.unit?1:8);"bool"===t.data_type||"enum"===t.data_type?l+=e:d+=e}return null}),c=Math.ceil(d/8)+Math.ceil(l/8),{cmdDataLength:c,cmd:function({attrs:e,flagString:t,boolEnumLength:n,cmdData:i,accumulate:r}){const s={};let c=0;for(let l=0;l<t.length;l++)if(e[l]&&"1"===t[l]){const{data_type:t,position:{len:r}}=e[l];let d="";if("bool"===t||"enum"===t){let e="";i.slice(0,n).map(t=>(e+=o.fillString(t.toString(2),8),null));const t=e.length-c;d=e.substring(t-r,t),c+=r}else{const e=n,t=n+r;i.slice(e,t).map(e=>(d+=o.fillString(e.toString(2),8),null)),n+=r}const h=a(t);s[e[l].name]=u(h,d,e[l])}else if(r){const t=e[l]||{position:{len:0}};"byte"===t.position.unit?n+=t.position.len:c+=t.position.len}return s}({attrs:t,flagString:r,boolEnumLength:Math.ceil(l/8),cmdData:i,accumulate:s})}}t.unpack=(e,t)=>i(void 0,void 0,void 0,(function*(){const n=yield r.default.getConfigFile(t);return n?function({config:e=[],data:t}){let n,i,r="";const s={header:o.arrayToString(t.slice(0,4)),flag:"",len:"",cmd:"",sn:"",action:"",payload:""},a=e;let c=o.checkHeader(t);if(!1===c)return;const u=t.slice(c,t.length),l=o.getProtocolLen(u);if(c+=l,s.len=o.arrayToString(u.slice(0,l)),c+=1,s.flag=o.arrayToString(t.slice(c-1,c)),c+=2,s.cmd=o.arrayToString(t.slice(c-2,c)),s.sn="",("0093"===s.cmd||"0094"===s.cmd)&&(c+=4,s.sn=o.arrayToString(t.slice(c-4,c)),"01"===s.flag)){c+=2,c+=parseInt(o.arrayToString(t.slice(c-2,c)),16)}c+=1,s.action=o.arrayToString(t.slice(c-1,c)),n=parseInt(s.action,16),s.payload=o.arrayToString(t.slice(c,t.length));const d=t.slice(c,t.length);let h=a;1===n&&(h=a.filter(e=>"status_writable"===e.type));const g=JSON.parse(JSON.stringify(h)),v=Math.ceil(h.length/8);let y=d.slice(0,v),m=d.slice(v,d.length);3!==n&&4!==n||(y=new Array(v).fill(255),m=d);let _="";y.map(e=>(_+=o.fillString(e.toString(2),8),null)),n>=17&&n<=20&&(h=h.filter((e,t)=>{const n=_.length-1-t;return"1"===_[n]})),"0090"===s.cmd||"0093"===s.cmd?(r="App 透传数据到 Dev",i="APP2DEV"):"0091"===s.cmd||"0094"===s.cmd?(r="Dev 收到控制命令后应答到 App",i="DEV2APP"):(r="非法数据",i="UNKNOW");let b={};switch(n){case 1:r="App 下发数据到 Dev",b=f({attrs:g,activeAttrs:h,flagString:_.split("").reverse().join(""),cmdData:m,accumulate:!0});break;case 2:return r="App 下发查询指令到 Dev",{kvData:null,rawData:s,message:r,messageType:i};case 3:r="Dev 回复查询指令到 App",b=f({attrs:g,activeAttrs:h,flagString:_.split("").reverse().join(""),cmdData:m,accumulate:!0});break;case 4:r="Dev 上报状态到 App",b=f({attrs:g,activeAttrs:h,flagString:_.split("").reverse().join(""),cmdData:m,accumulate:!0});break;case 5:return r="App 透传数据到 Dev",{kvData:null,rawData:s,message:r,messageType:i};case 6:return r="Dev 透传数据到 App",{kvData:null,rawData:s,message:r,messageType:i};case 7:return r="App 下发控制子设备",{kvData:null,rawData:s,message:r,messageType:i};case 8:return r="App 读取子设备数据",{kvData:null,rawData:s,message:r,messageType:i};case 9:return r="Dev 中控回复ACK",{kvData:null,rawData:s,message:r,messageType:i};case 10:return r="子设备上报状态到 App",{kvData:null,rawData:s,message:r,messageType:i};case 11:return r="App 下发添加子设备指令",{kvData:null,rawData:s,message:r,messageType:i};case 12:return r="App 下发删除子设备",{kvData:null,rawData:s,message:r,messageType:i};case 13:return r="App 获取中控子设备列表",{kvData:null,rawData:s,message:r,messageType:i};case 14:return r="中控响应字设备查询到 App",{kvData:null,rawData:s,message:r,messageType:i};case 15:return r="子设备列表变更通知到 App",{kvData:null,rawData:s,message:r,messageType:i};case 16:return r="Dev 子设备上下线状态变更通知",{kvData:null,rawData:s,message:r,messageType:i};case 17:r="App 下发变长数据到 Dev",b=p({type:"ALL",attrs:g,activeAttrs:h,flagString:_.split("").reverse().join(""),cmdData:m}).cmd;break;case 18:return r="App 下发变长查询到 Dev",{kvData:null,rawData:s,message:r,messageType:i};case 19:r="Dev 变长回复查询指令到 App",b=p({type:"ALL",attrs:g,activeAttrs:h,flagString:_.split("").reverse().join(""),cmdData:m}).cmd;break;case 20:r="Dev 变长上报状态到 App",b=p({type:"ALL",attrs:g,activeAttrs:h,flagString:_.split("").reverse().join(""),cmdData:m}).cmd;break;case 114:return r="App 向网关发送数据",{kvData:null,rawData:s,message:r,messageType:i};case 115:return r="Dev 网关上报数据到 App",{kvData:null,rawData:s,message:r,messageType:i};case 116:return r="App 通知网关删除子设备",{kvData:null,rawData:s,message:r,messageType:i};default:return{kvData:null,rawData:s,message:r,messageType:i}}return 0===a.length?{kvData:null,rawData:s,message:r,messageType:i}:{kvData:b,rawData:s,message:r,messageType:i}}({config:(yield n).entities[0].attrs,data:e}):null}));t.pack=(e,t)=>i(void 0,void 0,void 0,(function*(){const n=yield r.default.getConfigFile(t);if(n){const t="var_len"===n.protocolType;return l({data:e,config:(yield n).entities[0].attrs,isAdaptiveDatapoint:t})}return null}));t.padBoradcastData=e=>{const t=[0].concat([0,147]).concat([0,0,0,0]).concat(e),n=d(t);return o.arrayToString([0,0,0,3].concat(n).concat(t))}},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});t.default=class{constructor(){this.listenerMap={},this.addEventListener=(e,t)=>i(this,void 0,void 0,(function*(){return this.listenerMap[e]||(this.listenerMap[e]=[]),-1===this.listenerMap[e].indexOf(t)&&this.listenerMap[e].push(t),{success:!0}})),this.removeEventListener=(e,t)=>{if(this.listenerMap[e]){const n=this.listenerMap[e].indexOf(t);if(-1!==n)return this.listenerMap[e].splice(n,1),{success:!0}}return{success:!1}}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(14),r=n(9);class o extends i.default{constructor(e){super(e)}}o.pack=(e,t)=>{const n=[],[i,o]=r.formatCodesFromStr(e),[s,a]=r.formatCodesFromStr(t),c=[0].concat([0,1],o,i,a,s);let u=c.length;for(;u>0;)n.push(u),u-=255;const l=[0,0,0,3].concat(n).concat(c),d=new ArrayBuffer(l.length),h=new Uint8Array(d);for(let e=0;e<d.byteLength;e++)h[e]=l[e];return h},t.default=o},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(23),o=n(12),s=n(47),a=n(8);t.default=class{constructor(e,t,n,c){this.ssid="",this.password="",this.specialProductKeys=[],this.disableSearchDevice=!1,this.specialProductKeySecrets=[],this.timeoutHandler=null,this.setDeviceOnboardingDeployRej=()=>{},this.cleanTimeout=()=>{this.disableSearchDevice=!0,this.timeoutHandler&&clearTimeout(this.timeoutHandler),this.timeoutHandler=null},this.stopDeviceOnboardingDeploy=()=>{this.setDeviceOnboardingDeployRej&&this.setDeviceOnboardingDeployRej({success:!1,err:o.default.GIZ_SDK_ONBOARDING_STOPPED}),this.cleanTimeout()},this.hasTimeoutHandler=e=>!!this.timeoutHandler&&(e&&e({success:!1,err:o.default.GIZ_SDK_DEVICE_CONFIG_IS_RUNNING}),!0),this.handleTimeout=()=>{this.setDeviceOnboardingDeployRej&&this.setDeviceOnboardingDeployRej({success:!1,err:{errorCode:o.default.CONFIG_TIME_OUT,errorMessage:"time out"}}),this.timeoutHandler=null},this.searchDevice=({ssid:e,password:t})=>new Promise((n,c)=>{a.default.debug("GIZ_SDK: 开始大循环搜索设备");const u=()=>i(this,void 0,void 0,(function*(){var i;if(this.hasTimeoutHandler())try{const l=yield s.checkDeviceRegister({SSID:e,password:t,productKeys:this.specialProductKeys});if((null===(i=l.err)||void 0===i?void 0:i.errorCode)===o.default.GIZ_OPENAPI_TOKEN_INVALID.errorCode)return void c({success:!1,err:o.default.GIZ_OPENAPI_TOKEN_INVALID});l.err||0===l.data.length?(a.default.debug("GIZ_SDK: 大循环没有发现设备"),yield r.default(1500),!this.disableSearchDevice&&u()):(a.default.debug("GIZ_SDK: 大循环搜索到设备",l),n({success:!0,data:l.data}))}catch(e){yield r.default(3e3),!this.disableSearchDevice&&u()}}));u()}),this.initDeviceOnboardingDeploy=(e,t)=>{this.setDeviceOnboardingDeployRej=e,this.disableSearchDevice=!1},this.startTimeoutTimer=e=>{this.timeoutHandler=setTimeout(this.handleTimeout,1e3*e)},this.bindDevices=e=>(a.default.log("GIZ_SDK: start bind device"),new Promise((t,n)=>i(this,void 0,void 0,(function*(){const i=e.map(e=>{const t=this.specialProductKeys.findIndex(t=>e.productKey===t);if(-1===t)return;const n=this.specialProductKeySecrets[t];return s.bindMac({mac:e.mac,productKey:e.productKey,productSecret:n})});try{const r=yield Promise.all(i),s=e.filter((e,t)=>{const n=r[t];return n&&n.success});s.length>0?(a.default.log("GIZ_SDK: bind device success",s),t({success:!0,data:s})):(a.default.log("GIZ_SDK: bind device error",r),n({success:!1,data:e,err:o.default.GIZ_SDK_BIND_DEVICE_FAILED}))}catch(e){n(e)}})))),this.ssid=e,this.password=t,this.specialProductKeys=n,this.specialProductKeySecrets=c}}},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(24),o=n(87),s=n(88),a=n(20);t.getBindingList=()=>i(void 0,void 0,void 0,(function*(){const e=yield r.default("/app/bindings?show_disabled=0&limit=1000&skip=0",{method:"GET"});if(e.success){return{success:!0,data:e.data.devices.map(e=>({productKey:e.product_key,mac:e.mac,did:e.did,host:e.host,port_s:e.port_s,port:e.port,ws_port:e.ws_port,wss_port:e.wss_port,isBleOnline:!1,isLanOnline:!1,connectType:"NONE",name:e.dev_alias,isBind:!0,isOnline:e.is_online}))}}return{success:!1,err:e.err}})),t.bindMac=function({mac:e,productKey:t,productSecret:n,alias:o,beOwner:a}){return i(this,void 0,void 0,(function*(){const i={mac:e,product_key:t,dev_alias:o,set_owner:a},{Signature:c,timestamp:u}=s.psKeySign(n);return yield r.default("/app/bind_mac",{method:"POST",data:i,headers:{"X-Gizwits-Signature":c,"X-Gizwits-Timestamp":u}})}))},t.unbindDevice=function({devices:e}){return i(this,void 0,void 0,(function*(){return yield r.default("/app/bindings",{method:"DELETE",data:{devices:e.map(e=>({did:e.did}))}})}))},t.checkDeviceRegister=function({SSID:e,password:t,productKeys:n}){return i(this,void 0,void 0,(function*(){const i=o.default({SSID:e,password:t,pks:n});let s="";return i.map(e=>{s+=`${e},`}),s=s.substring(0,s.length-1),yield r.default(`/app/device_register?random_codes=${s}`,{method:"get"})}))},t.safeRegister=function({productKey:e,productSecret:t,mac:n,passcode:o,gwDid:s,isReset:c}){return i(this,void 0,void 0,(function*(){let i=`is_reset=${c?1:0}&mac=${n}&passcode=${o}`;s&&(i+=`&gw_did=${s}`);const u=a.enc.Hex.parse(t),l=a.enc.Hex.parse(""),d=a.enc.Utf8.parse(i),h=a.AES.encrypt(d,u,{iv:l,mode:a.mode.ECB,padding:a.pad.Pkcs7}).ciphertext.toString().toUpperCase(),f=yield r.default(`/dev/${e}/device`,{method:"POST",data:{data:h},headers:{"content-type":"application/x-www-form-urlencoded"}},!1);return f.success?{success:!0,data:{successDevices:[],failedDevices:[]}}:{success:!1,err:f.err}}))}},function(e,t){var n,i,r=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(e){i=s}}();var c,u=[],l=!1,d=-1;function h(){l&&c&&(l=!1,c.length?u=c.concat(u):d=-1,u.length&&f())}function f(){if(!l){var e=a(h);l=!0;for(var t=u.length;t;){for(c=u,u=[];++d<t;)c&&c[d].run();d=-1,t=u.length}c=null,l=!1,function(e){if(i===clearTimeout)return clearTimeout(e);if((i===s||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(e);try{i(e)}catch(t){try{return i.call(null,e)}catch(t){return i.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function g(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||l||a(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=g,r.addListener=g,r.once=g,r.off=g,r.removeListener=g,r.removeAllListeners=g,r.emit=g,r.prependListener=g,r.prependOnceListener=g,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MetadataReader=void 0;var i=n(4),r=function(){function e(){}return e.prototype.getConstructorMetadata=function(e){return{compilerGeneratedMetadata:Reflect.getMetadata(i.PARAM_TYPES,e),userGeneratedMetadata:Reflect.getMetadata(i.TAGGED,e)||{}}},e.prototype.getPropertiesMetadata=function(e){return Reflect.getMetadata(i.TAGGED_PROP,e)||[]},e}();t.MetadataReader=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isStackOverflowExeption=void 0;var i=n(6);t.isStackOverflowExeption=function(e){return e instanceof RangeError||e.message===i.STACK_OVERFLOW}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.inject=t.LazyServiceIdentifer=void 0;var i=n(6),r=n(4),o=n(7),s=n(11),a=function(){function e(e){this._cb=e}return e.prototype.unwrap=function(){return this._cb()},e}();t.LazyServiceIdentifer=a,t.inject=function(e){return function(t,n,a){if(void 0===e)throw new Error(i.UNDEFINED_INJECT_ANNOTATION(t.name));var c=new o.Metadata(r.INJECT_TAG,e);"number"==typeof a?s.tagParameter(t,n,a,c):s.tagProperty(t,n,c)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Target=void 0;var i=n(4),r=n(15),o=n(7),s=n(98),a=function(){function e(e,t,n,a){this.id=r.id(),this.type=e,this.serviceIdentifier=n,this.name=new s.QueryableString(t||""),this.metadata=new Array;var c=null;"string"==typeof a?c=new o.Metadata(i.NAMED_TAG,a):a instanceof o.Metadata&&(c=a),null!==c&&this.metadata.push(c)}return e.prototype.hasTag=function(e){for(var t=0,n=this.metadata;t<n.length;t++){if(n[t].key===e)return!0}return!1},e.prototype.isArray=function(){return this.hasTag(i.MULTI_INJECT_TAG)},e.prototype.matchesArray=function(e){return this.matchesTag(i.MULTI_INJECT_TAG)(e)},e.prototype.isNamed=function(){return this.hasTag(i.NAMED_TAG)},e.prototype.isTagged=function(){return this.metadata.some((function(e){return i.NON_CUSTOM_TAG_KEYS.every((function(t){return e.key!==t}))}))},e.prototype.isOptional=function(){return this.matchesTag(i.OPTIONAL_TAG)(!0)},e.prototype.getNamedTag=function(){return this.isNamed()?this.metadata.filter((function(e){return e.key===i.NAMED_TAG}))[0]:null},e.prototype.getCustomTags=function(){return this.isTagged()?this.metadata.filter((function(e){return i.NON_CUSTOM_TAG_KEYS.every((function(t){return e.key!==t}))})):null},e.prototype.matchesNamedTag=function(e){return this.matchesTag(i.NAMED_TAG)(e)},e.prototype.matchesTag=function(e){var t=this;return function(n){for(var i=0,r=t.metadata;i<r.length;i++){var o=r[i];if(o.key===e&&o.value===n)return!0}return!1}},e}();t.Target=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingWhenOnSyntax=void 0;var i=n(29),r=n(30),o=function(){function e(e){this._binding=e,this._bindingWhenSyntax=new r.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new i.BindingOnSyntax(this._binding)}return e.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},e.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},e.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},e.prototype.whenTargetTagged=function(e,t){return this._bindingWhenSyntax.whenTargetTagged(e,t)},e.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},e.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},e.prototype.whenParentTagged=function(e,t){return this._bindingWhenSyntax.whenParentTagged(e,t)},e.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},e.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},e.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},e.prototype.whenAnyAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,t)},e.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},e.prototype.whenNoAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenNoAncestorTagged(e,t)},e.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},e.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},e.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},e}();t.BindingWhenOnSyntax=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.typeConstraint=t.namedConstraint=t.taggedConstraint=t.traverseAncerstors=void 0;var i=n(4),r=n(7),o=function(e,t){var n=e.parentRequest;return null!==n&&(!!t(n)||o(n,t))};t.traverseAncerstors=o;var s=function(e){return function(t){var n=function(n){return null!==n&&null!==n.target&&n.target.matchesTag(e)(t)};return n.metaData=new r.Metadata(e,t),n}};t.taggedConstraint=s;var a=s(i.NAMED_TAG);t.namedConstraint=a;t.typeConstraint=function(e){return function(t){var n=null;if(null!==t){if(n=t.bindings[0],"string"==typeof e)return n.serviceIdentifier===e;var i=t.bindings[0].implementationType;return e===i}return!1}}},function(e,t,n){var i=n(31);function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}e.exports=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(35),o=n(36),s=n(85),a=n(86),c=n(89),u=n(8),l=n(34),d=n(119),h=n(47),f=n(18),p=n(28),g=n(43),v=n(9),y=n(120);t.default=class{constructor({appID:e,appSecret:t,productInfo:n,cloudServiceInfo:o,token:s,uid:y,offlineThreshold:m}){this.version="3.1.11-1",this.listenerMap={},this.keepScanTimer=null,this._deviceList=[],this._bleDevices=[],this._lanDevices=[],this.productInfo=[],this.handleBleError=e=>{this.listenerMap.onBleHandleError&&this.listenerMap.onBleHandleError.map(t=>{t(e)})},this.handleBleDevices=e=>{u.default.log("handleBleDevices",e),this.bleDevices=e},this.handleLanDevices=e=>{this.lanDevices=e},this.handleBleDeviceData=(e,t)=>i(this,void 0,void 0,(function*(){const n=this.allDevices.find(t=>t.bleDeviceID===e.deviceId);if(n){const e=yield g.unpack(v.hexStrint2byte(t),n.productKey);(null==e?void 0:e.kvData)&&this.listenerMap.GizDeviceAttrsNotifications&&this.listenerMap.GizDeviceAttrsNotifications.map(t=>{t({device:n,data:null==e?void 0:e.kvData})})}})),this.handleSocketDeviceData=e=>{const t=this.allDevices.find(t=>t.did===e.did);if(t){if(e.attrs&&null!=e.attrs.is_online){const n=e.attrs.is_online;this.setDeviceMeta(t,"isOnline",n)}this.listenerMap.GizDeviceAttrsNotifications&&this.listenerMap.GizDeviceAttrsNotifications.map(n=>{n(Object.assign({device:t},"attrs"in e?{data:e.attrs}:{raw:e.raw}))})}},this.handleSocketStatus=(e,t)=>{const n=this.allDevices.filter(t=>e.includes(t.did)&&"WAN"===t.connectType);u.default.log("handleSocketStatus",e,t),n.forEach(e=>{this.setDeviceMeta(e,"connectType",t?"NONE":"WAN")})},this.notiDeviceList=()=>{var e,t;null===(e=this.listenerMap.GizDeviceListNotifications)||void 0===e||e.map(e=>{e(this.allDevices)}),null===(t=this.listenerMap.onScanListChange)||void 0===t||t.map(e=>{e(this.bleScanDevice)})},this.initLan=()=>{this.lanHandle.init(),this.lanHandle.addEventListener("GizLanDeviceList",this.handleLanDevices)},this.startAutoScan=()=>{this.keepScanTimer||(this.keepScanTimer=setInterval(()=>i(this,void 0,void 0,(function*(){this.bleHandle.startScan(e=>{this.bleDevices=e},-1)})),3e3),this.bleHandle.startScan(e=>{this.bleDevices=e},-1))},this.stopAutoScan=()=>{this.keepScanTimer&&clearInterval(this.keepScanTimer),this.bleHandle.stopScan()},this.setDeviceMeta=(e,t,n,i=!1)=>{const r=this.allDevices.find(t=>t.mac===e.mac);r&&0!==this.allDevices.length&&(e[t]!==n||i)&&(r[t]=n,this.notiDeviceList())},this.getVersion=()=>({success:!0,data:this.version}),this.initBle=()=>i(this,void 0,void 0,(function*(){const e=yield this.bleHandle.checkPermission();return e.success?(this.bleHandle.addEventListener("GizBleDeviceData",this.handleBleDeviceData),this.bleHandle.addEventListener("GizBleDeviceList",this.handleBleDevices),this.bleHandle.addEventListener("GizBleError",this.handleBleError),u.default.debug("init BLE succcess",e),{success:!0}):(u.default.error("init BLE Error",new Error(JSON.stringify(e))),{success:!1,err:l.errorCode.GIZ_SDK_BLE_BLUETOOTH_FUNCTION_NOT_TURNED_ON})})),this.scanBleDevice=e=>i(this,void 0,void 0,(function*(){return this.bleHandle.scanList=[],{success:!0,data:(yield this.bleHandle.startScan(e=>{this.bleDevices=e},e)).scanList}})),this.write=(e,t)=>i(this,void 0,void 0,(function*(){const n=this.allDevices.find(t=>f.isSameDevice(t,e));if(!n)return{success:!1,message:"target is undefind"};if("NONE"!==n.connectType){const{data:e,raw:i}=yield g.pack(t,n.productKey);switch(n.connectType){case"BLE_BROADCAST":return yield this.bleHandle.writeBoradcast(n.bleDeviceID,i.cmd);case"BLE":return e?yield this.bleHandle.write(n.bleDeviceID,f.numberArray2Uint8Array(e).buffer):{success:!1};case"WAN":return this.socketHandle.writeData(n,t);case"LAN":return this.lanHandle.write(n,f.numberArray2Uint8Array(e).buffer)}}return{success:!1}})),this.writeRaw=(e,t)=>i(this,void 0,void 0,(function*(){const n=this.allDevices.find(t=>f.isSameDevice(t,e));if(!n)return{success:!1,message:"target is undefind"};if("NONE"!==n.connectType)switch(n.connectType){case"BLE_BROADCAST":return yield this.bleHandle.writeBoradcast(n.bleDeviceID,t);case"BLE":return t?yield this.bleHandle.write(n.bleDeviceID,f.numberArray2Uint8Array(t).buffer):{success:!1};case"WAN":return this.socketHandle.send(n.did,t);case"LAN":return this.lanHandle.write(n,f.numberArray2Uint8Array(t).buffer)}return{success:!1}})),this.getProductConfig=e=>i(this,void 0,void 0,(function*(){const t=yield p.default.getConfigFile(e);return t?{success:!0,data:t}:{success:!1}})),this.stopScanBleDevice=()=>{this.bleHandle.stopScan()},this.login=e=>i(this,void 0,void 0,(function*(){var t,n;const i=yield d.AnonymousLogin({uid:e});return i.success&&(r.setGlobalData("token",null===(t=i.data)||void 0===t?void 0:t.token),r.setGlobalData("uid",null===(n=i.data)||void 0===n?void 0:n.uid)),i})),this.getDeviceStatus=(e,t)=>i(this,void 0,void 0,(function*(){const n=this.allDevices.find(t=>f.isSameDevice(t,e));if(!n)return{success:!1,message:"target is undefind"};switch(n.connectType){case"BLE":return yield this.bleHandle.getDeviceStatus(n.bleDeviceID,n.productKey,n.rootDeviceId,t);case"WAN":return this.socketHandle.readStatus(n,t);default:return{success:!1,message:"Device connectType is unsupported"}}})),this.subscribe=(e,t,n=!0)=>i(this,void 0,void 0,(function*(){u.default.debug("subscribe device:",e);let n=this.allDevices.find(t=>f.isSameDevice(t,e));if(!n)return u.default.warn("Device Target Not Found"),{success:!1};if("BLE_BROADCAST"===n.connectType)return{success:!0};const i=f.getFirstConnectType(n,t);switch("NONE"!==n.connectType&&n.connectType!==i&&(yield this.unSubscribe(n)),i){case"BLE":{const e=yield this.bleHandle.connectDevice(n.bleDeviceID);return e.success&&(this.setDeviceMeta(n,"connectType","BLE",!0),setTimeout(()=>{this.getDeviceStatus(n)},500)),e}case"WAN":{const t=this.socketHandle.connectDevice(n);return t.success&&this.setDeviceMeta(e,"connectType","WAN",!0),t}case"LAN":{const t=yield this.lanHandle.connectDevice(n);return t.success&&this.setDeviceMeta(e,"connectType","LAN",!0),t}}return{success:!1}})),this.unSubscribe=e=>i(this,void 0,void 0,(function*(){const t=this.allDevices.find(t=>f.isSameDevice(t,e));switch(t.connectType){case"BLE":{const e=yield this.bleHandle.disConnectDevice(t.bleDeviceID);return e.success&&this.setDeviceMeta(t,"connectType","NONE",!0),e}case"WAN":{const e=this.socketHandle.disConnectDevice(t);return e.success&&this.setDeviceMeta(t,"connectType","NONE",!0),e}case"LAN":{const e=this.lanHandle.disConnectDevice(t);return e.success&&this.setDeviceMeta(t,"connectType","NONE",!0),e}}return{success:!1}})),this.bindRemoteDevice=({mac:e,productKey:t,alias:n,beOwner:r})=>i(this,void 0,void 0,(function*(){const i=f.getProductInfoThroughPK(t,this.productInfo);if(i){const o=yield h.bindMac({mac:e,productKey:t,productSecret:i.productSecret,alias:n,beOwner:r});return this.getBindingList(),o}return{success:!1,err:l.errorCode.GIZ_SDK_PRODUCTKEY_NOT_IN_SPECIFY}})),this.unbindDevice=({devices:e})=>i(this,void 0,void 0,(function*(){const t=yield h.unbindDevice({devices:e});return t.success&&this.getBindingList(),t})),this.deviceSafetyRegister=({mac:e,productKey:t})=>i(this,void 0,void 0,(function*(){return yield this.deviceSafetyApi({mac:e,productKey:t,isReset:!1})})),this.deviceSafetyUnbind=({mac:e,productKey:t})=>i(this,void 0,void 0,(function*(){return yield this.deviceSafetyApi({mac:e,productKey:t,isReset:!0})})),this.setDeviceOnboardingDeploy=({ssid:e,password:t,mode:n=0,timeout:r,isBind:o=!0,softAPSSIDPrefix:s})=>i(this,void 0,void 0,(function*(){if(this.currentWifiConfigHandle)return{success:!1,err:l.errorCode.GIZ_SDK_DEVICE_CONFIG_IS_RUNNING};const i=(new Date).getTime();u.default.debug("GIZ_SDK: 配网开始时间:"+i);try{switch(n){case 0:{this.currentWifiConfigHandle=new a.default(e,t,this.specialProductKeys,this.specialProductKeySecrets);const n=yield this.currentWifiConfigHandle.setDeviceOnboardingDeploy({timeout:r,isBind:o,softAPSSIDPrefix:s});this.currentWifiConfigHandle=null;const c=(new Date).getTime();return u.default.debug("GIZ_SDK: 配网结束时间:"+c),u.default.debug("GIZ_SDK: 配网用时:"+(c-i)),n}case 3:{this.currentWifiConfigHandle=new c.default(e,t,this.specialProductKeys,this.specialProductKeySecrets,this.bleHandle);const n=yield this.currentWifiConfigHandle.setDeviceOnboardingDeploy({timeout:r,isBind:o,softAPSSIDPrefix:s});this.currentWifiConfigHandle=null;const a=(new Date).getTime();return u.default.debug("GIZ_SDK: 配网结束时间:"+a),u.default.debug("GIZ_SDK: 配网用时:"+(a-i)),n}}}catch(e){return u.default.error("GIZ_SDK: setDeviceOnboardingDeploy",new Error(JSON.stringify(e))),e.err&&e.err.errorCode?e:{success:!1,err:l.errorCode.GIZ_SDK_OTHERWISE}}finally{this.currentWifiConfigHandle=null}})),this.setDomain=e=>{const t=e&&e.openAPIInfo||"api.gizwits.com",n=Object.assign(Object.assign({},e||{}),{openAPIInfo:t});r.setGlobalData("cloudServiceInfo",n)},this.deviceSafetyApi=({mac:e,productKey:t,isReset:n})=>i(this,void 0,void 0,(function*(){const i=f.getProductInfoThroughPK(t,this.productInfo);return i?yield h.safeRegister({productKey:t,productSecret:i.productSecret,mac:e,isReset:n,passcode:"1234567890"}):{success:!1,err:l.errorCode.GIZ_SDK_PRODUCTKEY_NOT_IN_SPECIFY}})),this.getBindingList=()=>i(this,void 0,void 0,(function*(){const e=yield h.getBindingList();return this.deviceList=e.data||[],e})),this.getDevices=()=>i(this,void 0,void 0,(function*(){return yield this.getBindingList(),{success:!0,data:this.allDevices}})),this.stopDeviceOnboardingDeploy=()=>{this.currentWifiConfigHandle&&(this.currentWifiConfigHandle.stopDeviceOnboardingDeploy(),this.currentWifiConfigHandle=null)},this.setLogLevel=e=>u.default.setLogLevel(e),this.removeEventListener=(e,t)=>{if(this.listenerMap[e]){const n=this.listenerMap[e].indexOf(t);if(-1!==n)return this.listenerMap[e].splice(n,1),{success:!0}}return{success:!1}},this.addEventListener=(e,t)=>i(this,void 0,void 0,(function*(){return this.listenerMap[e]||(this.listenerMap[e]=[]),-1===this.listenerMap[e].indexOf(t)&&this.listenerMap[e].push(t),{success:!0}})),this.destory=()=>{this.bleHandle.destory(),this.lanHandle.destory(),this.socketHandle.destory(),this.keepScanTimer&&clearInterval(this.keepScanTimer)},this.productInfo=n,r.setGlobalData("appID",e),r.setGlobalData("appSecret",t),r.setGlobalData("productInfo",n),r.setGlobalData("token",s),r.setGlobalData("uid",y),this.setDomain(o),this.offlineThreshold=m,u.default.debug(`init sdk success, current version: ${this.version}`),this.initLan()}get deviceList(){return this._deviceList}set deviceList(e){this._deviceList=e,this.notiDeviceList()}get bleDevices(){return this._bleDevices}set bleDevices(e){this._bleDevices=e,this.notiDeviceList()}get lanDevices(){return this._lanDevices}set lanDevices(e){this._lanDevices=e,this.notiDeviceList()}get allDevices(){let e=f.merageBleLocalDevices([...this.deviceList],this.bleDevices);e=f.merageLanLocalDevices(e,this.lanDevices),this.bleHandle.connectedList.map(t=>{const n=e.findIndex(e=>e.bleDeviceID===t.deviceId);-1!==n&&(e[n].connectType="BLE")});const t=this.socketHandle._connections;return Object.keys(t).forEach(n=>{const i=t[n];i&&i._subDids.forEach(t=>{const n=e.findIndex(e=>e.did===t);-1!==n&&(e[n].connectType="WAN")})}),this.lanHandle.connectedList.map(t=>{const n=e.findIndex(e=>e.mac===t.mac&&e.productKey===t.productKey);-1!==n&&(e[n].connectType="LAN")}),e}get bleScanDevice(){return this.bleDevices.filter(e=>!0===e.isBleOnline)}get bleHandle(){return this._bleHandle||(this._bleHandle=new o.BleHandle({pks:this.specialProductKeys,offlineThreshold:this.offlineThreshold})),this._bleHandle}get lanHandle(){return this._lanHandle||(this._lanHandle=new y.LanHandle({pks:this.specialProductKeys})),this._lanHandle}get socketHandle(){return this._gizSocket||(this._gizSocket=new s.default({appID:r.getGlobalData("appID"),token:r.getGlobalData("token"),uid:r.getGlobalData("uid")}),this._gizSocket.subscribeDeviceStatus(this.handleSocketDeviceData),this._gizSocket.subscribeBindingChanged(this.getBindingList),this._gizSocket.subscribeSocketStatus(this.handleSocketStatus)),this._gizSocket}get specialProductKeys(){return this.productInfo.map(e=>{var t;return null!==(t=e.productKey)&&void 0!==t?t:""})}get specialProductKeySecrets(){return this.productInfo.map(e=>{var t;return null!==(t=e.productSecret)&&void 0!==t?t:""})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(20),r=n(39);t.default=e=>{const t=wx.getSystemInfoSync(),n={exception:{values:[{type:"Error",value:e.stack,stacktrace:{},mechanism:{type:"generic",handled:!0}}]},level:"error",event_id:i.MD5(`${(new Date).getTime()}`).toString(),platform:"javascript",sdk:{},timestamp:(new Date).getTime()/1e3,environment:"production",contexts:{device:{},os:{name:t.platform,version:t.version},extra:{}},extra:{message:e.message}};var o={method:"POST",headers:{Connection:"keep-alive","User-Agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1 wechatdevtools/1.06.2206090 MicroMessenger/8.0.5 Language/zh_CN webview/","content-type":"application/json",Accept:"*/*","Sec-Fetch-Site":"cross-site","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty",Referer:"https://servicewechat.com/wx6dc8e50cb68bc121/devtools/page-frame.html",Cookie:"__org="},data:JSON.stringify(n)};r.default("https://appmonitor.gizwits.com/api/21/store/?sentry_key=0b2de791abf548a1bedf0b0ebdd8ecc7&sentry_version=7",o)}},function(e,t){},function(e,t,n){var i;e.exports=(i=n(2),function(){if("function"==typeof ArrayBuffer){var e=i.lib.WordArray,t=e.init;(e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var n=e.byteLength,i=[],r=0;r<n;r++)i[r>>>2]|=e[r]<<24-r%4*8;t.call(this,i,n)}else t.apply(this,arguments)}).prototype=e}}(),i.lib.WordArray)},function(e,t,n){var i;e.exports=(i=n(2),function(){var e=i,t=e.lib.WordArray,n=e.enc;function r(e){return e<<8&4278255360|e>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],r=0;r<n;r+=2){var o=t[r>>>2]>>>16-r%4*8&65535;i.push(String.fromCharCode(o))}return i.join("")},parse:function(e){for(var n=e.length,i=[],r=0;r<n;r++)i[r>>>1]|=e.charCodeAt(r)<<16-r%2*16;return t.create(i,2*n)}},n.Utf16LE={stringify:function(e){for(var t=e.words,n=e.sigBytes,i=[],o=0;o<n;o+=2){var s=r(t[o>>>2]>>>16-o%4*8&65535);i.push(String.fromCharCode(s))}return i.join("")},parse:function(e){for(var n=e.length,i=[],o=0;o<n;o++)i[o>>>1]|=r(e.charCodeAt(o)<<16-o%2*16);return t.create(i,2*n)}}}(),i.enc.Utf16)},function(e,t,n){var i,r,o;e.exports=(o=n(2),r=(i=o).lib.WordArray,i.enc.Base64url={stringify:function(e,t=!0){var n=e.words,i=e.sigBytes,r=t?this._safe_map:this._map;e.clamp();for(var o=[],s=0;s<i;s+=3)for(var a=(n[s>>>2]>>>24-s%4*8&255)<<16|(n[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|n[s+2>>>2]>>>24-(s+2)%4*8&255,c=0;c<4&&s+.75*c<i;c++)o.push(r.charAt(a>>>6*(3-c)&63));var u=r.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(e,t=!0){var n=e.length,i=t?this._safe_map:this._map,o=this._reverseMap;if(!o){o=this._reverseMap=[];for(var s=0;s<i.length;s++)o[i.charCodeAt(s)]=s}var a=i.charAt(64);if(a){var c=e.indexOf(a);-1!==c&&(n=c)}return function(e,t,n){for(var i=[],o=0,s=0;s<t;s++)if(s%4){var a=n[e.charCodeAt(s-1)]<<s%4*2,c=n[e.charCodeAt(s)]>>>6-s%4*2,u=a|c;i[o>>>2]|=u<<24-o%4*8,o++}return r.create(i,o)}(e,n,o)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},o.enc.Base64url)},function(e,t,n){var i,r,o,s,a,c;e.exports=(c=n(2),n(37),r=(i=c).lib.WordArray,o=i.algo,s=o.SHA256,a=o.SHA224=s.extend({_doReset:function(){this._hash=new r.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var e=s._doFinalize.call(this);return e.sigBytes-=4,e}}),i.SHA224=s._createHelper(a),i.HmacSHA224=s._createHmacHelper(a),c.SHA224)},function(e,t,n){var i,r,o,s,a,c,u,l;e.exports=(l=n(2),n(22),n(38),r=(i=l).x64,o=r.Word,s=r.WordArray,a=i.algo,c=a.SHA512,u=a.SHA384=c.extend({_doReset:function(){this._hash=new s.init([new o.init(3418070365,3238371032),new o.init(1654270250,914150663),new o.init(2438529370,812702999),new o.init(355462360,4144912697),new o.init(1731405415,4290775857),new o.init(2394180231,1750603025),new o.init(3675008525,1694076839),new o.init(1203062813,3204075428)])},_doFinalize:function(){var e=c._doFinalize.call(this);return e.sigBytes-=16,e}}),i.SHA384=c._createHelper(u),i.HmacSHA384=c._createHmacHelper(u),l.SHA384)},function(e,t,n){var i;e.exports=(i=n(2),n(22),function(e){var t=i,n=t.lib,r=n.WordArray,o=n.Hasher,s=t.x64.Word,a=t.algo,c=[],u=[],l=[];!function(){for(var e=1,t=0,n=0;n<24;n++){c[e+5*t]=(n+1)*(n+2)/2%64;var i=(2*e+3*t)%5;e=t%5,t=i}for(e=0;e<5;e++)for(t=0;t<5;t++)u[e+5*t]=t+(2*e+3*t)%5*5;for(var r=1,o=0;o<24;o++){for(var a=0,d=0,h=0;h<7;h++){if(1&r){var f=(1<<h)-1;f<32?d^=1<<f:a^=1<<f-32}128&r?r=r<<1^113:r<<=1}l[o]=s.create(a,d)}}();var d=[];!function(){for(var e=0;e<25;e++)d[e]=s.create()}();var h=a.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],t=0;t<25;t++)e[t]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,t){for(var n=this._state,i=this.blockSize/2,r=0;r<i;r++){var o=e[t+2*r],s=e[t+2*r+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),(I=n[r]).high^=s,I.low^=o}for(var a=0;a<24;a++){for(var h=0;h<5;h++){for(var f=0,p=0,g=0;g<5;g++)f^=(I=n[h+5*g]).high,p^=I.low;var v=d[h];v.high=f,v.low=p}for(h=0;h<5;h++){var y=d[(h+4)%5],m=d[(h+1)%5],_=m.high,b=m.low;for(f=y.high^(_<<1|b>>>31),p=y.low^(b<<1|_>>>31),g=0;g<5;g++)(I=n[h+5*g]).high^=f,I.low^=p}for(var S=1;S<25;S++){var w=(I=n[S]).high,D=I.low,T=c[S];T<32?(f=w<<T|D>>>32-T,p=D<<T|w>>>32-T):(f=D<<T-32|w>>>64-T,p=w<<T-32|D>>>64-T);var E=d[u[S]];E.high=f,E.low=p}var A=d[0],O=n[0];for(A.high=O.high,A.low=O.low,h=0;h<5;h++)for(g=0;g<5;g++){var I=n[S=h+5*g],C=d[S],B=d[(h+1)%5+5*g],k=d[(h+2)%5+5*g];I.high=C.high^~B.high&k.high,I.low=C.low^~B.low&k.low}I=n[0];var N=l[a];I.high^=N.high,I.low^=N.low}},_doFinalize:function(){var t=this._data,n=t.words,i=(this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;n[i>>>5]|=1<<24-i%32,n[(e.ceil((i+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var s=this._state,a=this.cfg.outputLength/8,c=a/8,u=[],l=0;l<c;l++){var d=s[l],h=d.high,f=d.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),u.push(f),u.push(h)}return new r.init(u,a)},clone:function(){for(var e=o.clone.call(this),t=e._state=this._state.slice(0),n=0;n<25;n++)t[n]=t[n].clone();return e}});t.SHA3=o._createHelper(h),t.HmacSHA3=o._createHmacHelper(h)}(Math),i.SHA3)},function(e,t,n){var i;e.exports=(i=n(2),
2
32
  /** @preserve
3
33
  (c) 2012 by Cédric Mesnil. All rights reserved.
4
34
 
@@ -9,10 +39,25 @@ module.exports=function(e){var t={};function i(s){if(t[s])return t[s].exports;va
9
39
 
10
40
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11
41
  */
12
- function(e){var t=s,i=t.lib,n=i.WordArray,r=i.Hasher,o=t.algo,c=n.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),a=n.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=n.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),d=n.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=n.create([0,1518500249,1859775393,2400959708,2840853838]),u=n.create([1352829926,1548603684,1836072691,2053994217,0]),f=o.RIPEMD160=r.extend({_doReset:function(){this._hash=n.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var s=t+i,n=e[s];e[s]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var r,o,f,m,S,b,w,B,k,I,C,A=this._hash.words,x=h.words,E=u.words,L=c.words,O=a.words,T=l.words,P=d.words;for(b=r=A[0],w=o=A[1],B=f=A[2],k=m=A[3],I=S=A[4],i=0;i<80;i+=1)C=r+e[t+L[i]]|0,C+=i<16?p(o,f,m)+x[0]:i<32?v(o,f,m)+x[1]:i<48?g(o,f,m)+x[2]:i<64?y(o,f,m)+x[3]:_(o,f,m)+x[4],C=(C=D(C|=0,T[i]))+S|0,r=S,S=m,m=D(f,10),f=o,o=C,C=b+e[t+O[i]]|0,C+=i<16?_(w,B,k)+E[0]:i<32?y(w,B,k)+E[1]:i<48?g(w,B,k)+E[2]:i<64?v(w,B,k)+E[3]:p(w,B,k)+E[4],C=(C=D(C|=0,P[i]))+I|0,b=I,I=k,k=D(B,10),B=w,w=C;C=A[1]+f+k|0,A[1]=A[2]+m+I|0,A[2]=A[3]+S+b|0,A[3]=A[4]+r+w|0,A[4]=A[0]+o+B|0,A[0]=C},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,s=8*e.sigBytes;t[s>>>5]|=128<<24-s%32,t[14+(s+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),e.sigBytes=4*(t.length+1),this._process();for(var n=this._hash,r=n.words,o=0;o<5;o++){var c=r[o];r[o]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return n},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,i){return e^t^i}function v(e,t,i){return e&t|~e&i}function g(e,t,i){return(e|~t)^i}function y(e,t,i){return e&i|t&~i}function _(e,t,i){return e^(t|~i)}function D(e,t){return e<<t|e>>>32-t}t.RIPEMD160=r._createHelper(f),t.HmacRIPEMD160=r._createHmacHelper(f)}(Math),s.RIPEMD160)},function(e,t,i){var s,n,r,o,c,a,l,d,h;e.exports=(h=i(0),i(14),i(15),n=(s=h).lib,r=n.Base,o=n.WordArray,c=s.algo,a=c.SHA1,l=c.HMAC,d=c.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var i=this.cfg,s=l.create(i.hasher,e),n=o.create(),r=o.create([1]),c=n.words,a=r.words,d=i.keySize,h=i.iterations;c.length<d;){var u=s.update(t).finalize(r);s.reset();for(var f=u.words,p=f.length,v=u,g=1;g<h;g++){v=s.finalize(v),s.reset();for(var y=v.words,_=0;_<p;_++)f[_]^=y[_]}n.concat(u),a[0]++}return n.sigBytes=4*d,n}}),s.PBKDF2=function(e,t,i){return d.create(i).compute(e,t)},h.PBKDF2)},function(e,t,i){var s;e.exports=(s=i(0),i(1),s.mode.CFB=function(){var e=s.lib.BlockCipherMode.extend();function t(e,t,i,s){var n,r=this._iv;r?(n=r.slice(0),this._iv=void 0):n=this._prevBlock,s.encryptBlock(n,0);for(var o=0;o<i;o++)e[t+o]^=n[o]}return e.Encryptor=e.extend({processBlock:function(e,i){var s=this._cipher,n=s.blockSize;t.call(this,e,i,n,s),this._prevBlock=e.slice(i,i+n)}}),e.Decryptor=e.extend({processBlock:function(e,i){var s=this._cipher,n=s.blockSize,r=e.slice(i,i+n);t.call(this,e,i,n,s),this._prevBlock=r}}),e}(),s.mode.CFB)},function(e,t,i){var s,n,r;e.exports=(r=i(0),i(1),r.mode.CTR=(s=r.lib.BlockCipherMode.extend(),n=s.Encryptor=s.extend({processBlock:function(e,t){var i=this._cipher,s=i.blockSize,n=this._iv,r=this._counter;n&&(r=this._counter=n.slice(0),this._iv=void 0);var o=r.slice(0);i.encryptBlock(o,0),r[s-1]=r[s-1]+1|0;for(var c=0;c<s;c++)e[t+c]^=o[c]}}),s.Decryptor=n,s),r.mode.CTR)},function(e,t,i){var s;e.exports=(s=i(0),i(1),
42
+ function(e){var t=i,n=t.lib,r=n.WordArray,o=n.Hasher,s=t.algo,a=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),c=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),u=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),d=r.create([0,1518500249,1859775393,2400959708,2840853838]),h=r.create([1352829926,1548603684,1836072691,2053994217,0]),f=s.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var i=t+n,r=e[i];e[i]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var o,s,f,b,S,w,D,T,E,A,O,I=this._hash.words,C=d.words,B=h.words,k=a.words,N=c.words,P=u.words,x=l.words;for(w=o=I[0],D=s=I[1],T=f=I[2],E=b=I[3],A=S=I[4],n=0;n<80;n+=1)O=o+e[t+k[n]]|0,O+=n<16?p(s,f,b)+C[0]:n<32?g(s,f,b)+C[1]:n<48?v(s,f,b)+C[2]:n<64?y(s,f,b)+C[3]:m(s,f,b)+C[4],O=(O=_(O|=0,P[n]))+S|0,o=S,S=b,b=_(f,10),f=s,s=O,O=w+e[t+N[n]]|0,O+=n<16?m(D,T,E)+B[0]:n<32?y(D,T,E)+B[1]:n<48?v(D,T,E)+B[2]:n<64?g(D,T,E)+B[3]:p(D,T,E)+B[4],O=(O=_(O|=0,x[n]))+A|0,w=A,A=E,E=_(T,10),T=D,D=O;O=I[1]+f+E|0,I[1]=I[2]+b+A|0,I[2]=I[3]+S+w|0,I[3]=I[4]+o+D|0,I[4]=I[0]+s+T|0,I[0]=O},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;t[i>>>5]|=128<<24-i%32,t[14+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(t.length+1),this._process();for(var r=this._hash,o=r.words,s=0;s<5;s++){var a=o[s];o[s]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}return r},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function p(e,t,n){return e^t^n}function g(e,t,n){return e&t|~e&n}function v(e,t,n){return(e|~t)^n}function y(e,t,n){return e&n|t&~n}function m(e,t,n){return e^(t|~n)}function _(e,t){return e<<t|e>>>32-t}t.RIPEMD160=o._createHelper(f),t.HmacRIPEMD160=o._createHmacHelper(f)}(Math),i.RIPEMD160)},function(e,t,n){var i,r,o,s,a,c,u,l,d;e.exports=(d=n(2),n(26),n(27),r=(i=d).lib,o=r.Base,s=r.WordArray,a=i.algo,c=a.SHA1,u=a.HMAC,l=a.PBKDF2=o.extend({cfg:o.extend({keySize:4,hasher:c,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,i=u.create(n.hasher,e),r=s.create(),o=s.create([1]),a=r.words,c=o.words,l=n.keySize,d=n.iterations;a.length<l;){var h=i.update(t).finalize(o);i.reset();for(var f=h.words,p=f.length,g=h,v=1;v<d;v++){g=i.finalize(g),i.reset();for(var y=g.words,m=0;m<p;m++)f[m]^=y[m]}r.concat(h),c[0]++}return r.sigBytes=4*l,r}}),i.PBKDF2=function(e,t,n){return l.create(n).compute(e,t)},d.PBKDF2)},function(e,t,n){var i;e.exports=(i=n(2),n(5),i.mode.CFB=function(){var e=i.lib.BlockCipherMode.extend();function t(e,t,n,i){var r,o=this._iv;o?(r=o.slice(0),this._iv=void 0):r=this._prevBlock,i.encryptBlock(r,0);for(var s=0;s<n;s++)e[t+s]^=r[s]}return e.Encryptor=e.extend({processBlock:function(e,n){var i=this._cipher,r=i.blockSize;t.call(this,e,n,r,i),this._prevBlock=e.slice(n,n+r)}}),e.Decryptor=e.extend({processBlock:function(e,n){var i=this._cipher,r=i.blockSize,o=e.slice(n,n+r);t.call(this,e,n,r,i),this._prevBlock=o}}),e}(),i.mode.CFB)},function(e,t,n){var i,r,o;e.exports=(o=n(2),n(5),o.mode.CTR=(i=o.lib.BlockCipherMode.extend(),r=i.Encryptor=i.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,r=this._iv,o=this._counter;r&&(o=this._counter=r.slice(0),this._iv=void 0);var s=o.slice(0);n.encryptBlock(s,0),o[i-1]=o[i-1]+1|0;for(var a=0;a<i;a++)e[t+a]^=s[a]}}),i.Decryptor=r,i),o.mode.CTR)},function(e,t,n){var i;e.exports=(i=n(2),n(5),
13
43
  /** @preserve
14
44
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
15
45
  * derived from CryptoJS.mode.CTR
16
46
  * Jan Hruby jhruby.web@gmail.com
17
47
  */
18
- s.mode.CTRGladman=function(){var e=s.lib.BlockCipherMode.extend();function t(e){if(255==(e>>24&255)){var t=e>>16&255,i=e>>8&255,s=255&e;255===t?(t=0,255===i?(i=0,255===s?s=0:++s):++i):++t,e=0,e+=t<<16,e+=i<<8,e+=s}else e+=1<<24;return e}var i=e.Encryptor=e.extend({processBlock:function(e,i){var s=this._cipher,n=s.blockSize,r=this._iv,o=this._counter;r&&(o=this._counter=r.slice(0),this._iv=void 0),function(e){0===(e[0]=t(e[0]))&&(e[1]=t(e[1]))}(o);var c=o.slice(0);s.encryptBlock(c,0);for(var a=0;a<n;a++)e[i+a]^=c[a]}});return e.Decryptor=i,e}(),s.mode.CTRGladman)},function(e,t,i){var s,n,r;e.exports=(r=i(0),i(1),r.mode.OFB=(s=r.lib.BlockCipherMode.extend(),n=s.Encryptor=s.extend({processBlock:function(e,t){var i=this._cipher,s=i.blockSize,n=this._iv,r=this._keystream;n&&(r=this._keystream=n.slice(0),this._iv=void 0),i.encryptBlock(r,0);for(var o=0;o<s;o++)e[t+o]^=r[o]}}),s.Decryptor=n,s),r.mode.OFB)},function(e,t,i){var s,n;e.exports=(n=i(0),i(1),n.mode.ECB=((s=n.lib.BlockCipherMode.extend()).Encryptor=s.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),s.Decryptor=s.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),s),n.mode.ECB)},function(e,t,i){var s;e.exports=(s=i(0),i(1),s.pad.AnsiX923={pad:function(e,t){var i=e.sigBytes,s=4*t,n=s-i%s,r=i+n-1;e.clamp(),e.words[r>>>2]|=n<<24-r%4*8,e.sigBytes+=n},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},s.pad.Ansix923)},function(e,t,i){var s;e.exports=(s=i(0),i(1),s.pad.Iso10126={pad:function(e,t){var i=4*t,n=i-e.sigBytes%i;e.concat(s.lib.WordArray.random(n-1)).concat(s.lib.WordArray.create([n<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},s.pad.Iso10126)},function(e,t,i){var s;e.exports=(s=i(0),i(1),s.pad.Iso97971={pad:function(e,t){e.concat(s.lib.WordArray.create([2147483648],1)),s.pad.ZeroPadding.pad(e,t)},unpad:function(e){s.pad.ZeroPadding.unpad(e),e.sigBytes--}},s.pad.Iso97971)},function(e,t,i){var s;e.exports=(s=i(0),i(1),s.pad.ZeroPadding={pad:function(e,t){var i=4*t;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){var t=e.words,i=e.sigBytes-1;for(i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},s.pad.ZeroPadding)},function(e,t,i){var s;e.exports=(s=i(0),i(1),s.pad.NoPadding={pad:function(){},unpad:function(){}},s.pad.NoPadding)},function(e,t,i){var s,n,r,o;e.exports=(o=i(0),i(1),n=(s=o).lib.CipherParams,r=s.enc.Hex,s.format.Hex={stringify:function(e){return e.ciphertext.toString(r)},parse:function(e){var t=r.parse(e);return n.create({ciphertext:t})}},o.format.Hex)},function(e,t,i){var s;e.exports=(s=i(0),i(7),i(8),i(5),i(1),function(){var e=s,t=e.lib.BlockCipher,i=e.algo,n=[],r=[],o=[],c=[],a=[],l=[],d=[],h=[],u=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,s=0;for(t=0;t<256;t++){var p=s^s<<1^s<<2^s<<3^s<<4;p=p>>>8^255&p^99,n[i]=p,r[p]=i;var v=e[i],g=e[v],y=e[g],_=257*e[p]^16843008*p;o[i]=_<<24|_>>>8,c[i]=_<<16|_>>>16,a[i]=_<<8|_>>>24,l[i]=_,_=16843009*y^65537*g^257*v^16843008*i,d[p]=_<<24|_>>>8,h[p]=_<<16|_>>>16,u[p]=_<<8|_>>>24,f[p]=_,i?(i=v^e[e[e[y^v]]],s^=e[e[s]]):i=s=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],v=i.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,s=4*((this._nRounds=i+6)+1),r=this._keySchedule=[],o=0;o<s;o++)o<i?r[o]=t[o]:(l=r[o-1],o%i?i>6&&o%i==4&&(l=n[l>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l]):(l=n[(l=l<<8|l>>>24)>>>24]<<24|n[l>>>16&255]<<16|n[l>>>8&255]<<8|n[255&l],l^=p[o/i|0]<<24),r[o]=r[o-i]^l);for(var c=this._invKeySchedule=[],a=0;a<s;a++){if(o=s-a,a%4)var l=r[o];else l=r[o-4];c[a]=a<4||o<=4?l:d[n[l>>>24]]^h[n[l>>>16&255]]^u[n[l>>>8&255]]^f[n[255&l]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,c,a,l,n)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,d,h,u,f,r),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,s,n,r,o,c){for(var a=this._nRounds,l=e[t]^i[0],d=e[t+1]^i[1],h=e[t+2]^i[2],u=e[t+3]^i[3],f=4,p=1;p<a;p++){var v=s[l>>>24]^n[d>>>16&255]^r[h>>>8&255]^o[255&u]^i[f++],g=s[d>>>24]^n[h>>>16&255]^r[u>>>8&255]^o[255&l]^i[f++],y=s[h>>>24]^n[u>>>16&255]^r[l>>>8&255]^o[255&d]^i[f++],_=s[u>>>24]^n[l>>>16&255]^r[d>>>8&255]^o[255&h]^i[f++];l=v,d=g,h=y,u=_}v=(c[l>>>24]<<24|c[d>>>16&255]<<16|c[h>>>8&255]<<8|c[255&u])^i[f++],g=(c[d>>>24]<<24|c[h>>>16&255]<<16|c[u>>>8&255]<<8|c[255&l])^i[f++],y=(c[h>>>24]<<24|c[u>>>16&255]<<16|c[l>>>8&255]<<8|c[255&d])^i[f++],_=(c[u>>>24]<<24|c[l>>>16&255]<<16|c[d>>>8&255]<<8|c[255&h])^i[f++],e[t]=v,e[t+1]=g,e[t+2]=y,e[t+3]=_},keySize:8});e.AES=t._createHelper(v)}(),s.AES)},function(e,t,i){var s;e.exports=(s=i(0),i(7),i(8),i(5),i(1),function(){var e=s,t=e.lib,i=t.WordArray,n=t.BlockCipher,r=e.algo,o=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],a=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=r.DES=n.extend({_doReset:function(){for(var e=this._key.words,t=[],i=0;i<56;i++){var s=o[i]-1;t[i]=e[s>>>5]>>>31-s%32&1}for(var n=this._subKeys=[],r=0;r<16;r++){var l=n[r]=[],d=a[r];for(i=0;i<24;i++)l[i/6|0]|=t[(c[i]-1+d)%28]<<31-i%6,l[4+(i/6|0)]|=t[28+(c[i+24]-1+d)%28]<<31-i%6;for(l[0]=l[0]<<1|l[0]>>>31,i=1;i<7;i++)l[i]=l[i]>>>4*(i-1)+3;l[7]=l[7]<<5|l[7]>>>27}var h=this._invSubKeys=[];for(i=0;i<16;i++)h[i]=n[15-i]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,i){this._lBlock=e[t],this._rBlock=e[t+1],u.call(this,4,252645135),u.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),u.call(this,1,1431655765);for(var s=0;s<16;s++){for(var n=i[s],r=this._lBlock,o=this._rBlock,c=0,a=0;a<8;a++)c|=l[a][((o^n[a])&d[a])>>>0];this._lBlock=o,this._rBlock=r^c}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,u.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(e,t){var i=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=i,this._lBlock^=i<<e}function f(e,t){var i=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=i,this._rBlock^=i<<e}e.DES=n._createHelper(h);var p=r.TripleDES=n.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),s=e.length<4?e.slice(0,2):e.slice(2,4),n=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=h.createEncryptor(i.create(t)),this._des2=h.createEncryptor(i.create(s)),this._des3=h.createEncryptor(i.create(n))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=n._createHelper(p)}(),s.TripleDES)},function(e,t,i){var s;e.exports=(s=i(0),i(7),i(8),i(5),i(1),function(){var e=s,t=e.lib.StreamCipher,i=e.algo,n=i.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,i=e.sigBytes,s=this._S=[],n=0;n<256;n++)s[n]=n;n=0;for(var r=0;n<256;n++){var o=n%i,c=t[o>>>2]>>>24-o%4*8&255;r=(r+s[n]+c)%256;var a=s[n];s[n]=s[r],s[r]=a}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=r.call(this)},keySize:8,ivSize:0});function r(){for(var e=this._S,t=this._i,i=this._j,s=0,n=0;n<4;n++){i=(i+e[t=(t+1)%256])%256;var r=e[t];e[t]=e[i],e[i]=r,s|=e[(e[t]+e[i])%256]<<24-8*n}return this._i=t,this._j=i,s}e.RC4=t._createHelper(n);var o=i.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)r.call(this)}});e.RC4Drop=t._createHelper(o)}(),s.RC4)},function(e,t,i){var s;e.exports=(s=i(0),i(7),i(8),i(5),i(1),function(){var e=s,t=e.lib.StreamCipher,i=e.algo,n=[],r=[],o=[],c=i.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,i=0;i<4;i++)e[i]=16711935&(e[i]<<8|e[i]>>>24)|4278255360&(e[i]<<24|e[i]>>>8);var s=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],n=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,i=0;i<4;i++)a.call(this);for(i=0;i<8;i++)n[i]^=s[i+4&7];if(t){var r=t.words,o=r[0],c=r[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(n[0]^=l,n[1]^=h,n[2]^=d,n[3]^=u,n[4]^=l,n[5]^=h,n[6]^=d,n[7]^=u,i=0;i<4;i++)a.call(this)}},_doProcessBlock:function(e,t){var i=this._X;a.call(this),n[0]=i[0]^i[5]>>>16^i[3]<<16,n[1]=i[2]^i[7]>>>16^i[5]<<16,n[2]=i[4]^i[1]>>>16^i[7]<<16,n[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)n[s]=16711935&(n[s]<<8|n[s]>>>24)|4278255360&(n[s]<<24|n[s]>>>8),e[t+s]^=n[s]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,i=0;i<8;i++)r[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<r[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<r[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<r[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<r[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<r[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<r[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<r[6]>>>0?1:0)|0,this._b=t[7]>>>0<r[7]>>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],n=65535&s,c=s>>>16,a=((n*n>>>17)+n*c>>>15)+c*c,l=((4294901760&s)*s|0)+((65535&s)*s|0);o[i]=a^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.Rabbit=t._createHelper(c)}(),s.Rabbit)},function(e,t,i){var s;e.exports=(s=i(0),i(7),i(8),i(5),i(1),function(){var e=s,t=e.lib.StreamCipher,i=e.algo,n=[],r=[],o=[],c=i.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],s=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var n=0;n<4;n++)a.call(this);for(n=0;n<8;n++)s[n]^=i[n+4&7];if(t){var r=t.words,o=r[0],c=r[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),d=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),h=l>>>16|4294901760&d,u=d<<16|65535&l;for(s[0]^=l,s[1]^=h,s[2]^=d,s[3]^=u,s[4]^=l,s[5]^=h,s[6]^=d,s[7]^=u,n=0;n<4;n++)a.call(this)}},_doProcessBlock:function(e,t){var i=this._X;a.call(this),n[0]=i[0]^i[5]>>>16^i[3]<<16,n[1]=i[2]^i[7]>>>16^i[5]<<16,n[2]=i[4]^i[1]>>>16^i[7]<<16,n[3]=i[6]^i[3]>>>16^i[1]<<16;for(var s=0;s<4;s++)n[s]=16711935&(n[s]<<8|n[s]>>>24)|4278255360&(n[s]<<24|n[s]>>>8),e[t+s]^=n[s]},blockSize:4,ivSize:2});function a(){for(var e=this._X,t=this._C,i=0;i<8;i++)r[i]=t[i];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<r[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<r[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<r[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<r[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<r[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<r[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<r[6]>>>0?1:0)|0,this._b=t[7]>>>0<r[7]>>>0?1:0,i=0;i<8;i++){var s=e[i]+t[i],n=65535&s,c=s>>>16,a=((n*n>>>17)+n*c>>>15)+c*c,l=((4294901760&s)*s|0)+((65535&s)*s|0);o[i]=a^l}e[0]=o[0]+(o[7]<<16|o[7]>>>16)+(o[6]<<16|o[6]>>>16)|0,e[1]=o[1]+(o[0]<<8|o[0]>>>24)+o[7]|0,e[2]=o[2]+(o[1]<<16|o[1]>>>16)+(o[0]<<16|o[0]>>>16)|0,e[3]=o[3]+(o[2]<<8|o[2]>>>24)+o[1]|0,e[4]=o[4]+(o[3]<<16|o[3]>>>16)+(o[2]<<16|o[2]>>>16)|0,e[5]=o[5]+(o[4]<<8|o[4]>>>24)+o[3]|0,e[6]=o[6]+(o[5]<<16|o[5]>>>16)+(o[4]<<16|o[4]>>>16)|0,e[7]=o[7]+(o[6]<<8|o[6]>>>24)+o[5]|0}e.RabbitLegacy=t._createHelper(c)}(),s.RabbitLegacy)},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(16),r=i(6),o=i(3);class c extends r.default{}c.pack=(e,t,i)=>s(void 0,void 0,void 0,(function*(){const s=yield n.default.getConfigFile(e);if(s){const e="var_len"===s.protocolType,n=[0,0,0,3],r=[0];let c=[0];const a=[0,147];let l=[0,0,0,0],d=[2];if(t){c=[1];const e=o.fillString(t.length.toString(16),4),i=o.hexStrint2byte(e),s=o.string2Bytes(t);l=l.concat(i).concat(s)}if(e){d=[18];let e="";if(i){const t=i.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:1}),{});s.entities[0].attrs.map(i=>{e=t[i.name]?`1${e}`:`0${e}`})}else s.entities[0].attrs.map(()=>{e=`1${e}`});e=o.fillString(e,8*Math.ceil(e.length/8)),d=d.concat(o.hexStrint2byte(parseInt(e,2).toString(16)))}const h=c.concat(a).concat(l).concat(d);return r[0]=h.length,n.concat(r).concat(h)}return null})),t.default=c},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(4),r=i(2),o=i(13),c=i(9);t.default=class{constructor({appID:e,token:t,uid:i,limitSocketNum:r=!0}){this._bindingDevices=null,this._connections={},this._getDevice=e=>{if(null===this._bindingDevices)return n.default.GIZ_SDK_SDK_NOT_INITIALIZED;const t=this._bindingDevices[e];return null==t?n.default.GIZ_OPENAPI_DEVICE_NOT_BOUND:t},this._getConnect=e=>{const t=this._getWebsocketConnInfo(e);return this._connections[t]},this._getDeviceAndConnect=e=>{const t=this._getDevice(e);if(c.isError(t))return t;const i=this._getConnect(t);return null==i?n.default.GIZ_SDK_DEVICE_NOT_SUBSCRIBED:[t,i]},this.connectDevice=e=>{const t=this._getWebsocketConnInfo(e);let i=this._connections[t];if(null==i){const e=Object.keys(this._connections).length;if(0!==this._maxSocketNum&&e>=this._maxSocketNum)return{success:!1,errorCode:n.default.MAX_CONNECT};i=new a({appID:this.appID,token:this.token,uid:this.uid,wsInfo:t,onDeviceStatusChanged:this._handleDeviceStatusChanged,onBindingChanged:this._handleBindingChanged,onSocketStatusChanged:this._handleSocketStatusChanged}),this._connections[t]=i}return i._addSubDid(e.did),null==i._websocket?i._connectWS():i.ready&&i._subDevices([e.did]),{success:!0}},this.disConnectDevice=e=>{const t=this._getWebsocketConnInfo(e);let i=this._connections[t];return i&&i._unSubDevices([e.did]),{success:!0}},this.connect=e=>{const t=this._getDevice(e);if(c.isError(t))return t;const i=this.connectDevice(t);return i.success?null:i.errorCode},this.send=(e,t)=>{const i=this._getDeviceAndConnect(e);return c.isError(i)?i:i[1]._send({cmd:"c2s_raw",data:{did:e,raw:t}})},this.writeData=(e,t)=>{const i=this._getConnect(e);return null!=i?i._send({cmd:"c2s_write",data:{did:e.did,attrs:t}}):{success:!1}},this.write=(e,t)=>{const i=this._getDeviceAndConnect(e);return c.isError(i)?i:i[1]._send({cmd:"c2s_write",data:{did:e,attrs:t}})},this.readStatus=(e,t)=>{const i=this._getConnect(e),s=null!=i;return s&&i._send({cmd:"c2s_read",data:{did:e.did,names:t}}),{success:s}},this.read=(e,t)=>{const i=this._getDeviceAndConnect(e);return c.isError(i)?i:i[1]._send({cmd:"c2s_read",data:{did:e,names:t}})},this.destory=()=>{Object.values(this._connections).forEach(e=>e.destory())},this.subscribeDeviceStatus=e=>{this._onDeviceStatusChanged=e},this.subscribeBindingChanged=e=>{this._onBindingChanged=e},this.subscribeSocketStatus=e=>{this._onSocketStatusChanged=e},this._handleDeviceStatusChanged=e=>{this._onDeviceStatusChanged&&this._onDeviceStatusChanged(e)},this._handleBindingChanged=()=>{this._onBindingChanged&&this._onBindingChanged()},this._handleSocketStatusChanged=(...e)=>{this._onSocketStatusChanged&&this._onSocketStatusChanged(...e)},this._getBindingList=(e=20,t=0,i=[])=>s(this,void 0,void 0,(function*(){const s=`/app/bindings?show_disabled=0&limit=${e}&skip=${t}`,{err:n,data:r}=yield o.default(`${s}`,{method:"GET"});if(n)return{err:n};const c=[...i,...(null==r?void 0:r.devices)||[]];return r&&r.devices.length===e?yield this._getBindingList(e,e+t,c):c})),this._getWebsocketConnInfo=e=>e.host?`wss://wx${e.host}`:"wss://wxstage.gizwits.com",this.appID=e,this.token=t,this.uid=i;const l=wx.getSystemInfoSync().SDKVersion;this._maxSocketNum=r?-1===c.compareWXSDKVersion(l||"1.0.0","1.7.0")?1:5:0}init(){var e,t;return s(this,void 0,void 0,(function*(){try{const i=yield this._getBindingList();return(null===(e=i.err)||void 0===e?void 0:e.errorCode)?{errorCode:null===(t=i.err)||void 0===t?void 0:t.errorCode,errorMessage:"getting binding list failed"}:(this._bindingDevices=i.reduce((e,t)=>Object.assign(Object.assign({},e),{[t.did]:t}),{}),null)}catch(e){return n.default.GIZ_SDK_OTHERWISE}}))}};class a{constructor({appID:e,token:t,uid:i,wsInfo:n,onDeviceStatusChanged:o,onBindingChanged:c,onSocketStatusChanged:a}){this.ready=!1,this.commType="attrs_v4",this._heartbeatInterval=60,this._keepaliveTime=180,this._loginIntveral=5e3,this.autoSubscribe=!1,this._websocket=null,this._loginFailedTimes=0,this._subDids=new Set,this._socketRespHandleMap={},this._waitSends=[],this.destory=()=>{this._heartbeatTimerId&&clearInterval(this._heartbeatTimerId),this._checkConnectTimerId&&clearInterval(this._checkConnectTimerId),this.close()},this._networkChange=e=>s(this,void 0,void 0,(function*(){r.default.log("network change",e)})),this._appShow=()=>s(this,void 0,void 0,(function*(){r.default.log("app show")})),this._addSubDid=e=>{this._subDids.add(e)},this._removeSubDid=e=>{this._subDids.delete(e)},this._connectWS=()=>{r.default.log("GIZ_SDK: start connect ws"),this._websocket=wx.connectSocket({url:this._wsUrl}),this._websocket.onClose(this.handleClose),this._websocket.onOpen(this.handleOpen),this._websocket.onError(this.handleError),this._websocket.onMessage(this.handleMessage),this._checkConnectTimerId||(this._checkConnectTimerId=setInterval(()=>{this._websocket||this._connectWS()},1e3))},this._subDevices=e=>{const t={cmd:"subscribe_req",data:e.map(e=>({did:e}))};this._send(t)},this._unSubDevices=e=>{e.map(e=>this._removeSubDid(e))},this._send=(e,t=!1)=>(r.default.log("Socket send",e,t),new Promise(i=>{if(!this._websocket&&!this.ready)return this._waitSends.push(e),i({success:!0,message:""}),void r.default.debug("GIZ_SDK: cache data wait socket ready");this._websocket&&(t||this.ready)&&this._websocket.send({data:JSON.stringify(e),complete:e=>{r.default.log("GIZ_SDK: socket send res",e),r.default.log("resres",e);let t=!1;"sendSocketMessage:ok"===e.errMsg&&(t=!0),i({success:t,message:e.errMsg})},fail:e=>{r.default.error("GIZ_SDK: Socket send error",new Error(JSON.stringify(e))),i({success:!1,message:e.errMsg})}})})),this.close=()=>{this.ready=!1,this._heartbeatTimerId&&clearInterval(this._heartbeatTimerId),this._websocket&&(this._websocket.close({}),this._websocket=null),this._handleSocketStatusChanged(!1)},this.handleClose=e=>{r.default.debug("GIZ_SDK: socket close",e),this.close(),this._stopPing()},this.handleOpen=()=>{r.default.log(" socket open"),this._login()},this.handleMessage=({data:e})=>{r.default.log("message",e);const t=JSON.parse(e),i=this._socketRespHandleMap[t.cmd];i&&i(t.data)},this.handleError=e=>{r.default.error("GIZ_SDK: socket error",new Error(JSON.stringify(e))),this.close(),this._stopPing()},this._login=()=>{const e={cmd:"login_req",data:{appid:this.appID,uid:this.uid,token:this.token,p0_type:this.commType,heartbeat_interval:this._keepaliveTime,auto_subscribe:this.autoSubscribe}};this._send(e,!0)},this._tryLoginAgain=()=>{this._loginFailedTimes+=1,setTimeout(()=>{this._login()},this._loginFailedTimes*this._loginIntveral)},this._startPing=()=>{this._heartbeatTimerId=setInterval(()=>{this._send({cmd:"ping"})},1e3*this._heartbeatInterval)},this._stopPing=()=>{this._heartbeatTimerId&&clearInterval(this._heartbeatTimerId)},this.pongResp=()=>{},this._loginResp=e=>{1==e.success?(this._loginFailedTimes=0,this.ready=!0,this._startPing(),this._subDevices([...this._subDids]),this._handleSocketStatusChanged(!0),this._consumeWaitSends()):this._loginFailedTimes<3?(r.default.log("GIZ_SDK: Login failed, will try again, please wait..."),this._tryLoginAgain()):(r.default.error("GIZ_SDK: Login failed",new Error("m2m socket login failed")),this.close())},this._consumeWaitSends=()=>{let e=this._waitSends.pop();for(;e;)this._send(e),e=this._waitSends.pop()},this._handleSocketStatusChanged=e=>{this._onSocketStatusChanged&&this._onSocketStatusChanged([...this._subDids],e)},this._subscribeResp=e=>{r.default.log("GIZ_SDK: subscribe_res",e),e&&e.success&&e.success.forEach(e=>this._send({cmd:"c2s_read",data:{did:e.did}})),r.default.debug("GIZ_SDK: subscribe_res",e)},this._onlineResp=e=>{this._isSub(e.did)&&this._onDeviceStatusChanged&&this._onDeviceStatusChanged({did:e.did,attrs:Object.assign({is_online:e.online},e)})},this._rawChangedResp=e=>{this._isSub(e.did)&&this._onDeviceStatusChanged&&this._onDeviceStatusChanged(e)},this._statusChangedResp=e=>{this._isSub(e.did)&&this._onDeviceStatusChanged&&this._onDeviceStatusChanged(e)},this._isSub=e=>this._subDids.has(e),this._invalidMsgResp=e=>{1003===e.error_code&&this._login(),r.default.error("GIZ_SDK: s2c_invalid_msg",new Error(JSON.stringify(e)))},this._bindingChangedResp=e=>{!e.bind&&e.did&&this._removeSubDid(e.did),this._onBindingChanged&&this._onBindingChanged()},this.appID=e,this.token=t,this.uid=i,this._wsUrl=`${n}/ws/app/v1`,this._heartbeatTimerId=void 0,this._loginFailedTimes=0,this._onDeviceStatusChanged=o,this._onBindingChanged=c,this._onSocketStatusChanged=a,this._socketRespHandleMap={pong:this.pongResp,login_res:this._loginResp,subscribe_res:this._subscribeResp,s2c_online_status:this._onlineResp,s2c_raw:this._rawChangedResp,s2c_noti:this._statusChangedResp,s2c_invalid_msg:this._invalidMsgResp,s2c_binding_changed:this._bindingChangedResp},wx.onNetworkStatusChange(this._networkChange),wx.onAppShow(this._appShow)}}t.Connection=a},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(4),r=i(2),o=i(28),c=i(29);class a extends c.default{constructor(){super(...arguments),this.disableSendUDP=!1,this.sendMessageInterval=null,this.UDPSocketHandler=null,this.destroy=()=>{this.cleanTimeout(),this.sendMessageInterval&&clearInterval(this.sendMessageInterval),this.sendMessageInterval=null,this.UDPSocketHandler&&(this.UDPSocketHandler.offError(),this.UDPSocketHandler.offMessage(),this.UDPSocketHandler.close())},this.configDevice=({ssid:e,password:t,softAPSSIDPrefix:i})=>new Promise((c,a)=>{r.default.debug("GIZ_SDK: start config device");let l=!1,d=0;const h=o.default.pack(e,t);this.UDPSocketHandler=wx.createUDPSocket(),this.UDPSocketHandler.bind(),this.disableSendUDP=!1;const u=()=>{try{!this.disableSendUDP&&this.UDPSocketHandler.send({address:"10.10.100.254",port:12414,message:h,offset:0,length:h.byteLength})}catch(e){}};this.sendMessageInterval=setInterval(()=>{u()},2e3),this.UDPSocketHandler.onError(e=>{d+=1,d>2&&(this.destroy(),a({success:!1,err:{errorCode:n.default.WECHAT_ERROR.errorCode,errorMessage:e.errMsg}}))});const f=()=>s(this,void 0,void 0,(function*(){if(!l){this.UDPSocketHandler.offMessage(),this.UDPSocketHandler.offError(),this.sendMessageInterval&&clearInterval(this.sendMessageInterval),this.disableSendUDP=!0,l=!0;try{const i=yield this.searchDevice({ssid:e,password:t});c(i)}catch(e){a(e)}}}));this.UDPSocketHandler.onMessage(e=>{f()}),wx.onNetworkStatusChange(()=>s(this,void 0,void 0,(function*(){!l&&wx.getConnectedWifi({success:e=>s(this,void 0,void 0,(function*(){-1===e.wifi.SSID.indexOf(i)&&f()}))})})))}),this.setDeviceOnboardingDeploy=({timeout:e,isBind:t=!0,softAPSSIDPrefix:i})=>{const n=this.ssid,r=this.password;return new Promise((o,c)=>s(this,void 0,void 0,(function*(){this.destroy(),this.initDeviceOnboardingDeploy(o,c),this.startTimeoutTimer(e);try{const e=((yield this.configDevice({ssid:n,password:r,softAPSSIDPrefix:i})).data||[]).map(e=>({mac:e.mac,productKey:e.product_key,did:e.did,name:"",isBind:!1,connectType:"NONE",isBleOnline:!1,isLanOnline:!1,isOnline:!1}));if(t)try{o(yield this.bindDevices(e))}catch(e){c(e)}else o({success:!0,data:e})}catch(e){c(e)}finally{this.destroy()}})))}}}t.default=a},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(10),n=({SSID:e,password:t,pk:i})=>{let n=s.MD5(e+t).toString();n=s.enc.Hex.parse(n);let r=s.enc.Utf8.parse(i),o=s.AES.encrypt(r,n,{iv:n,mode:s.mode.ECB,padding:s.pad.ZeroPadding});return s.MD5(o.ciphertext).toString()};t.default=({SSID:e,password:t,pks:i})=>{const s=[];return i.map(i=>{const r=n({SSID:e,password:t,pk:i});s.push(r)}),s}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(10);t.psKeySign=e=>{const t=Math.round((new Date).getTime()/1e3),i=e+t;return{Signature:s.MD5(i).toString(),timestamp:t}}},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(4),r=i(9),o=i(23),c=i(12),a=i(29),l=i(28),d=i(2);function h({bleDeviceId:e,arrayBuffer:t,serviceUUIDSuffix:i="abf0",characteristicUUIDSuffix:n="abf7"}){let c=null,a=null;const l=()=>null===a&&(c&&clearInterval(c),!0);return new Promise((h,u)=>s(this,void 0,void 0,(function*(){try{d.default.debug("GIZ_SDK: ssid info: ",t),a=setTimeout(()=>{c&&clearInterval(c),a=null,h(!1)},5e3),d.default.debug("GIZ_SDK: createBLEConnection start: ",e);const s=yield o.retryConnect(e,1e4);d.default.debug("GIZ_SDK: createBLEConnection end, res:",s);const u=yield o.getBLEDeviceServices(e);d.default.debug("GIZ_SDK: getBLEDeviceServices end, res:",u);const f=u.find(e=>e.uuid.split("-")[0].toLowerCase().endsWith(i));if(!f)return d.default.debug("GIZ_SDK: get ble device services fail",e,u),void h(!1);const p=yield o.getBLEDeviceCharacteristics(e,f.uuid);d.default.debug("GIZ_SDK: getBLEDeviceCharacteristics end, res:",p);const v=p.find(e=>e.uuid.split("-")[0].toLowerCase().endsWith(n));if(!v)return d.default.debug("GIZ_SDK: get ble device characteristics fail",e,p),void h(!1);if(!v.properties.notify&&!v.properties.indicate)return d.default.debug("GIZ_SDK: the ble device characteristic not support notify or indicate",e,v),void h(!1);d.default.debug("GIZ_SDK: check characteristic and service success"),yield o.notifyBLECharacteristicValueChange(e,f.uuid,v.uuid);const g=e=>{const t=r.ab2hex(e.value);d.default.debug("GIZ_SDK: 收到设备返回ack",t),"0000000303000002"===t&&(wx.offBLECharacteristicValueChange(g),h(!0))};if(wx.onBLECharacteristicValueChange(g),d.default.debug("GIZ_SDK: on notifyBLECharacteristicValueChange success"),l())return;yield o.unpackWriteBLECharacteristicValue(e,f.uuid,v.uuid,t),c=setInterval(()=>{l()||o.unpackWriteBLECharacteristicValue(e,f.uuid,v.uuid,t)},2e3),d.default.debug("GIZ_SDK: unpackWriteBLECharacteristicValue end")}catch(e){u(!1),d.default.debug("GIZ_SDK: sendBLEConfigCmd error",e)}}))).catch(e=>{d.default.debug("GIZ_SDK: sendBLEConfigCmd error",e)}).finally(()=>{a&&clearTimeout(a),c&&clearInterval(c),wx.closeBLEConnection({deviceId:e})})}t.sendBLEConfigCmd=h;class u extends a.default{constructor(){super(...arguments),this.destroy=()=>{this.cleanTimeout()},this.isValidBleDevice=(e,t)=>{if(!e||!e.advertisData)return!1;const{productKey:i,mac:s}=r.advertisData2PkAndMac(e.advertisData,this.specialProductKeys);return!!this.specialProductKeys.includes(i)&&(d.default.debug(`GIZ_SDK: isValidBleDevice mac: ${s} pk: ${i} name: ${e.name}`),d.default.debug(`GIZ_SDK: softAPSSIDPrefix: ${t} ismatch : ${e.name&&e.name.startsWith(t)}`),!t||e.name&&e.name.startsWith(t))},this.enableBluetoothDevicesDescovery=()=>s(this,void 0,void 0,(function*(){return(yield o.getBluetoothAdapterState()).available?(yield o.startBluetoothDevicesDiscovery(),{success:!0}):{success:!1,err:{errorCode:n.default.GIZ_SDK_BLE_BLUETOOTH_FUNCTION_NOT_TURNED_ON.errorCode,errorMessage:"蓝牙状态不可用"}}})),this.enableAndGetBluetoothDevices=e=>s(this,void 0,void 0,(function*(){const t=yield this.enableBluetoothDevicesDescovery();if(!t.success)return t;d.default.debug("GIZ_SDK: start enableAndGetBluetoothDevices");const i=(yield o.getBluetoothDevices()).filter(t=>this.isValidBleDevice(t,e));return d.default.debug("GIZ_SDK: getBluetoothDevices success",i),{success:!0,bleDevices:i}})),this.setDeviceOnboardingDeploy=({timeout:e,isBind:t=!0,softAPSSIDPrefix:i})=>new Promise((n,r)=>s(this,void 0,void 0,(function*(){const s=this.ssid,o=this.password;this.destroy(),this.initDeviceOnboardingDeploy(n,r),this.startTimeoutTimer(e);try{const r=((yield this.configBLEDevice({ssid:s,password:o,timeout:1e3*e,softAPSSIDPrefix:i})).data||[]).map(e=>({mac:e.mac,productKey:e.product_key,did:e.did,name:"",isBind:!1,connectType:"NONE",isBleOnline:!1,isLanOnline:!1,isOnline:!1}));n(t?yield this.bindDevices(r):{success:!0,data:r})}catch(e){n({success:!1,data:e})}finally{this.destroy()}}))),this.configBLEDevice=({ssid:e,password:t,softAPSSIDPrefix:i})=>new Promise((a,u)=>s(this,void 0,void 0,(function*(){d.default.debug("GIZ_SDK: start config ble device");const f=yield this.enableAndGetBluetoothDevices(i).catch(e=>({success:!1,err:{errorCode:n.default.WECHAT_ERROR.errorCode,errorMessage:JSON.stringify(e)}}));if(!r.isWXDevicesResult(f))return u(f);const{bleDevices:p}=f;d.default.debug("GIZ_SDK: enableAndGetBluetoothDevices success, target devices: ",p);const v=({devices:e})=>s(this,void 0,void 0,(function*(){this.hasTimeoutHandler()?Array.prototype.push.apply(p,e.filter(e=>this.isValidBleDevice(e,i))):wx.offBluetoothDeviceFound(v)}));wx.onBluetoothDeviceFound(v);const g=l.default.pack(e,t),y=()=>s(this,void 0,void 0,(function*(){if(d.default.debug("GIZ_SDK: startConfigDevice"),!this.hasTimeoutHandler())return;const e=p.shift();if(e&&d.default.debug("GIZ_SDK: startConfigDevice, target device: ",e),!(e&&(yield h({bleDeviceId:e.deviceId,arrayBuffer:g.buffer}))))return yield c.default(500),yield o.startBluetoothDevicesDiscovery(),void(yield y());d.default.debug("GIZ_SDK: offBluetoothDeviceFound ready search device"),wx.offBluetoothDeviceFound(v)}));try{this.searchDevice({ssid:e,password:t}).then(e=>{a(e)})}catch(e){u(e),d.default.error("GIZ_SDK: searchDevice error",new Error(JSON.stringify(e)))}yield y()})))}}t.default=u},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(13);t.AnonymousLogin=function({uid:e}){return s(this,void 0,void 0,(function*(){return n.default("/app/users",{data:{phone_id:e},method:"POST"},!1)}))}},function(e,t,i){"use strict";var s=this&&this.__awaiter||function(e,t,i,s){return new(i||(i=Promise))((function(n,r){function o(e){try{a(s.next(e))}catch(e){r(e)}}function c(e){try{a(s.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,c)}a((s=s.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const n=i(2),r=i(24),o=i(68),c=i(25),a=i(6),l=i(3),d=i(12),h=i(9),u=i(27);class f extends u.default{constructor({pks:e}){super(),this.connectedList=[],this.pks=[],this.scanList=[],this.deviceUDPPort=12414,this.appUDPPort=2415,this.offlineThreshold=2e4,this.isActive=!0,this.listenDevOfflineTimer=null,this.init=()=>{this.UDPSocket=wx.createUDPSocket(),this.UDPSocket.bind(),this.UDPSocket.onMessage(this.onMessage),this.UDPSocket.onError(this.onError),n.default.info("Start UDP Discover"),this.startDiscover(),this.listenDevOffline(this.offlineThreshold),wx.onAppShow(this.onAppShow),wx.onAppHide(this.onAppHide)},this.onAppShow=()=>{this.isActive=!0,this.scanList.map(e=>{e.ctime=Date.now()})},this.onAppHide=()=>{this.isActive=!1},this.listenDevOffline=e=>{this.listenDevOfflineTimer=setInterval(()=>{if(!this.isActive)return;const t=(new Date).getTime(),i=this.scanList.filter(i=>t-i.ctime<e);i.length!==this.scanList.length&&(n.default.debug("remove lan device"),this.scanList=i,this.notifyDevices())},500)},this.notifyDevices=()=>{this.listenerMap.GizLanDeviceList&&this.listenerMap.GizLanDeviceList.map(e=>{e(this.scanList)})},this.isSameDevice=(e,t)=>e.mac===t.mac&&e.productKey===t.productKey,this.disConnectDevice=e=>{const t=this.connectedList.findIndex(t=>t.productKey===e.productKey&&t.mac===e.mac);try{return-1!==t&&(this.connectedList[t].socketHandle.destory(),this.connectedList.splice(t,1)),{success:!0}}catch(e){return{success:!1,err:e}}},this.connectDevice=e=>s(this,void 0,void 0,(function*(){const t=this.scanList.find(t=>this.isSameDevice(e,t));if(!t)return{success:!1};if(this.connectedList.find(t=>this.isSameDevice(e,t)))return{success:!0};{const e=new p({ip:t.ip,mac:t.mac,productKey:t.productKey,onClose:this.onDeviceClose}),i=yield e.connect();return i.success?this.connectedList.push({mac:t.mac,productKey:t.productKey,socketHandle:e}):e.destory(),i}})),this.onError=e=>{n.default.warn("Discover Error",e)},this.isMatchPk=e=>0===this.pks.length||this.pks.includes(e),this.onMessage=e=>{const t=h.ab2numbers(e.message),i=new o.default(t);""!==i.mac&&this.isMatchPk(i.productKey)&&this.updateDevice(i,e.remoteInfo.address)},this.onDeviceClose=({productKey:e,mac:t})=>{const i=this.connectedList.findIndex(i=>i.productKey===e&&i.mac===t);-1!==i&&this.connectedList.splice(i,1)},this.write=(e,t)=>s(this,void 0,void 0,(function*(){n.default.debug("send data to device",e,t,this.connectedList);const i=this.connectedList.findIndex(t=>this.isSameDevice(t,e));if(-1!==i){return this.connectedList[i].socketHandle.write(t)}return{success:!1,message:"device not sub"}})),this.updateDevice=(e,t)=>{const i=this.scanList.find(t=>t.mac===e.mac);if(i)i.ctime=Date.now();else{const i={mac:e.mac,ip:t,productKey:e.productKey,did:e.did,expandData:e,name:"",isBind:!1,connectType:"NONE",isOnline:!1,isLanOnline:!0,isBleOnline:!1,ctime:Date.now()};this.scanList.push(i),this.notifyDevices()}},this.sendBoradCast=()=>{this.UDPSocket&&(this.UDPSocket.send({address:"255.255.255.255",message:o.default.pack(),port:this.deviceUDPPort}),n.default.debug("Send UDP Discover"))},this.startDiscover=()=>{this.sendBoradCast(),this.boradcastTimer=setInterval(()=>{this.sendBoradCast()},5e3)},this.destory=()=>{this.boradcastTimer&&clearInterval(this.boradcastTimer),this.UDPSocket&&this.UDPSocket.close(),this.listenDevOfflineTimer&&clearInterval(this.listenDevOfflineTimer),wx.offAppShow(this.onAppShow),wx.offAppHide(this.onAppHide)},this.pks=e}}t.LanHandle=f;class p{constructor({ip:e,onClose:t,mac:i,productKey:o}){this.deviceTCPPort=12416,this.ip="",this.productKey="",this.mac="",this.tcpHandler=null,this.onCloseListener=({mac:e,productKey:t})=>{},this.connect=()=>s(this,void 0,void 0,(function*(){return new Promise(e=>s(this,void 0,void 0,(function*(){const t=()=>{const e=r.default.pack();this.tcpHandler.write(l.arrayToUint8(e)),n.default.debug("connect success try login")},i=t=>{e({success:!0,err:t})},s=t=>{switch(new a.default(h.ab2numbers(t.message)).cmd){case"0007":{const e=new r.default(h.ab2numbers(t.message)),i=c.default.pack({passcode:e.passcode});this.tcpHandler.write(l.arrayToUint8(i));break}case"0009":new c.default(h.ab2numbers(t.message)).result?(e({success:!0}),this.initListener()):e({success:!1})}};try{this.tcpHandler=wx.createTCPSocket(),this.tcpHandler.onConnect(t),this.tcpHandler.onError(i),this.tcpHandler.onMessage(s),this.tcpHandler.connect({address:this.ip,port:this.deviceTCPPort,timeout:2}),yield d.default(4e3),e({success:!1,err:null})}catch(t){n.default.error("connect lan error",t),e({success:!1,err:null})}finally{this.tcpHandler.offConnect(t),this.tcpHandler.offError(i),this.tcpHandler.offMessage(s)}})))})),this.write=e=>(this.tcpHandler.write(e),{success:!0}),this.onMessage=e=>{const t=new a.default(h.ab2numbers(e.message));n.default.debug("on tcp message",t)},this.onError=()=>{},this.onClose=()=>{this.onCloseListener({productKey:this.productKey,mac:this.mac})},this.initListener=()=>{this.tcpHandler.onError(this.onError),this.tcpHandler.onMessage(this.onMessage),this.tcpHandler.onClose(this.onClose)},this.destory=()=>{this.tcpHandler&&this.tcpHandler.close(),this.tcpHandler.offError(this.onError),this.tcpHandler.offMessage(this.onMessage),this.tcpHandler.offClose(this.onClose)},this.ip=e,this.mac=i,this.productKey=o,this.onCloseListener=t}}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const s=i(2),n=i(6),r=i(3);class o extends n.default{constructor(e){super(e),this.did="",this.mac="",this.productKey="",this.deviceType=0,this.apiUrl="",this.protocolVersion="",this.mcuVersion="",this.moduleVersion="",this.parseEndChat=(e,t)=>{let i="";const s=this.content.slice(e,this.content.length);for(let t in s){const n=s[t];if(e+=1,0===n)break;i+=String.fromCharCode(n)}return this[t]=i,e},this.baseParse=(e,t,i="ASCII")=>{const s=parseInt(r.arrayToString(this.content.slice(e,e+2)),16);e+=2;let n="";return this.content.slice(e,e+s).map(e=>{if("ASCII"===i)n+=String.fromCharCode(e);else{const t=e.toString(16);n+=r.fillString(t,2)}}),this[t]=n,e+s};let t=0;try{t=this.baseParse(t,"did"),t=this.baseParse(t,"mac","HEX"),t=this.baseParse(t,"moduleVersion"),t=this.baseParse(t,"productKey"),t+=8,t=this.parseEndChat(t,"apiUrl"),t=this.parseEndChat(t,"protocolVersion"),this.mcuVersion="",this.content.slice(t,this.content.length).map(e=>{this.mcuVersion+=String.fromCharCode(e)})}catch(e){s.default.warn("Parse DiscoverUDP error",e)}}}o.pack=()=>{const e=[0,0,0,3,3,0,0,3],t=new ArrayBuffer(e.length),i=new Uint8Array(t);for(let s=0;s<t.byteLength;s++)i[s]=e[s];return i},t.default=o}]);
48
+ i.mode.CTRGladman=function(){var e=i.lib.BlockCipherMode.extend();function t(e){if(255==(e>>24&255)){var t=e>>16&255,n=e>>8&255,i=255&e;255===t?(t=0,255===n?(n=0,255===i?i=0:++i):++n):++t,e=0,e+=t<<16,e+=n<<8,e+=i}else e+=1<<24;return e}var n=e.Encryptor=e.extend({processBlock:function(e,n){var i=this._cipher,r=i.blockSize,o=this._iv,s=this._counter;o&&(s=this._counter=o.slice(0),this._iv=void 0),function(e){0===(e[0]=t(e[0]))&&(e[1]=t(e[1]))}(s);var a=s.slice(0);i.encryptBlock(a,0);for(var c=0;c<r;c++)e[n+c]^=a[c]}});return e.Decryptor=n,e}(),i.mode.CTRGladman)},function(e,t,n){var i,r,o;e.exports=(o=n(2),n(5),o.mode.OFB=(i=o.lib.BlockCipherMode.extend(),r=i.Encryptor=i.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,r=this._iv,o=this._keystream;r&&(o=this._keystream=r.slice(0),this._iv=void 0),n.encryptBlock(o,0);for(var s=0;s<i;s++)e[t+s]^=o[s]}}),i.Decryptor=r,i),o.mode.OFB)},function(e,t,n){var i,r;e.exports=(r=n(2),n(5),r.mode.ECB=((i=r.lib.BlockCipherMode.extend()).Encryptor=i.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),i.Decryptor=i.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),i),r.mode.ECB)},function(e,t,n){var i;e.exports=(i=n(2),n(5),i.pad.AnsiX923={pad:function(e,t){var n=e.sigBytes,i=4*t,r=i-n%i,o=n+r-1;e.clamp(),e.words[o>>>2]|=r<<24-o%4*8,e.sigBytes+=r},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Ansix923)},function(e,t,n){var i;e.exports=(i=n(2),n(5),i.pad.Iso10126={pad:function(e,t){var n=4*t,r=n-e.sigBytes%n;e.concat(i.lib.WordArray.random(r-1)).concat(i.lib.WordArray.create([r<<24],1))},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}},i.pad.Iso10126)},function(e,t,n){var i;e.exports=(i=n(2),n(5),i.pad.Iso97971={pad:function(e,t){e.concat(i.lib.WordArray.create([2147483648],1)),i.pad.ZeroPadding.pad(e,t)},unpad:function(e){i.pad.ZeroPadding.unpad(e),e.sigBytes--}},i.pad.Iso97971)},function(e,t,n){var i;e.exports=(i=n(2),n(5),i.pad.ZeroPadding={pad:function(e,t){var n=4*t;e.clamp(),e.sigBytes+=n-(e.sigBytes%n||n)},unpad:function(e){var t=e.words,n=e.sigBytes-1;for(n=e.sigBytes-1;n>=0;n--)if(t[n>>>2]>>>24-n%4*8&255){e.sigBytes=n+1;break}}},i.pad.ZeroPadding)},function(e,t,n){var i;e.exports=(i=n(2),n(5),i.pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)},function(e,t,n){var i,r,o,s;e.exports=(s=n(2),n(5),r=(i=s).lib.CipherParams,o=i.enc.Hex,i.format.Hex={stringify:function(e){return e.ciphertext.toString(o)},parse:function(e){var t=o.parse(e);return r.create({ciphertext:t})}},s.format.Hex)},function(e,t,n){var i;e.exports=(i=n(2),n(16),n(17),n(13),n(5),function(){var e=i,t=e.lib.BlockCipher,n=e.algo,r=[],o=[],s=[],a=[],c=[],u=[],l=[],d=[],h=[],f=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,i=0;for(t=0;t<256;t++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,r[n]=p,o[p]=n;var g=e[n],v=e[g],y=e[v],m=257*e[p]^16843008*p;s[n]=m<<24|m>>>8,a[n]=m<<16|m>>>16,c[n]=m<<8|m>>>24,u[n]=m,m=16843009*y^65537*v^257*g^16843008*n,l[p]=m<<24|m>>>8,d[p]=m<<16|m>>>16,h[p]=m<<8|m>>>24,f[p]=m,n?(n=g^e[e[e[y^g]]],i^=e[e[i]]):n=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],g=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,i=4*((this._nRounds=n+6)+1),o=this._keySchedule=[],s=0;s<i;s++)s<n?o[s]=t[s]:(u=o[s-1],s%n?n>6&&s%n==4&&(u=r[u>>>24]<<24|r[u>>>16&255]<<16|r[u>>>8&255]<<8|r[255&u]):(u=r[(u=u<<8|u>>>24)>>>24]<<24|r[u>>>16&255]<<16|r[u>>>8&255]<<8|r[255&u],u^=p[s/n|0]<<24),o[s]=o[s-n]^u);for(var a=this._invKeySchedule=[],c=0;c<i;c++){if(s=i-c,c%4)var u=o[s];else u=o[s-4];a[c]=c<4||s<=4?u:l[r[u>>>24]]^d[r[u>>>16&255]]^h[r[u>>>8&255]]^f[r[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,a,c,u,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,d,h,f,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,i,r,o,s,a){for(var c=this._nRounds,u=e[t]^n[0],l=e[t+1]^n[1],d=e[t+2]^n[2],h=e[t+3]^n[3],f=4,p=1;p<c;p++){var g=i[u>>>24]^r[l>>>16&255]^o[d>>>8&255]^s[255&h]^n[f++],v=i[l>>>24]^r[d>>>16&255]^o[h>>>8&255]^s[255&u]^n[f++],y=i[d>>>24]^r[h>>>16&255]^o[u>>>8&255]^s[255&l]^n[f++],m=i[h>>>24]^r[u>>>16&255]^o[l>>>8&255]^s[255&d]^n[f++];u=g,l=v,d=y,h=m}g=(a[u>>>24]<<24|a[l>>>16&255]<<16|a[d>>>8&255]<<8|a[255&h])^n[f++],v=(a[l>>>24]<<24|a[d>>>16&255]<<16|a[h>>>8&255]<<8|a[255&u])^n[f++],y=(a[d>>>24]<<24|a[h>>>16&255]<<16|a[u>>>8&255]<<8|a[255&l])^n[f++],m=(a[h>>>24]<<24|a[u>>>16&255]<<16|a[l>>>8&255]<<8|a[255&d])^n[f++],e[t]=g,e[t+1]=v,e[t+2]=y,e[t+3]=m},keySize:8});e.AES=t._createHelper(g)}(),i.AES)},function(e,t,n){var i;e.exports=(i=n(2),n(16),n(17),n(13),n(5),function(){var e=i,t=e.lib,n=t.WordArray,r=t.BlockCipher,o=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],d=o.DES=r.extend({_doReset:function(){for(var e=this._key.words,t=[],n=0;n<56;n++){var i=s[n]-1;t[n]=e[i>>>5]>>>31-i%32&1}for(var r=this._subKeys=[],o=0;o<16;o++){var u=r[o]=[],l=c[o];for(n=0;n<24;n++)u[n/6|0]|=t[(a[n]-1+l)%28]<<31-n%6,u[4+(n/6|0)]|=t[28+(a[n+24]-1+l)%28]<<31-n%6;for(u[0]=u[0]<<1|u[0]>>>31,n=1;n<7;n++)u[n]=u[n]>>>4*(n-1)+3;u[7]=u[7]<<5|u[7]>>>27}var d=this._invSubKeys=[];for(n=0;n<16;n++)d[n]=r[15-n]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._subKeys)},decryptBlock:function(e,t){this._doCryptBlock(e,t,this._invSubKeys)},_doCryptBlock:function(e,t,n){this._lBlock=e[t],this._rBlock=e[t+1],h.call(this,4,252645135),h.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),h.call(this,1,1431655765);for(var i=0;i<16;i++){for(var r=n[i],o=this._lBlock,s=this._rBlock,a=0,c=0;c<8;c++)a|=u[c][((s^r[c])&l[c])>>>0];this._lBlock=s,this._rBlock=o^a}var d=this._lBlock;this._lBlock=this._rBlock,this._rBlock=d,h.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),e[t]=this._lBlock,e[t+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(e,t){var n=(this._lBlock>>>e^this._rBlock)&t;this._rBlock^=n,this._lBlock^=n<<e}function f(e,t){var n=(this._rBlock>>>e^this._lBlock)&t;this._lBlock^=n,this._rBlock^=n<<e}e.DES=r._createHelper(d);var p=o.TripleDES=r.extend({_doReset:function(){var e=this._key.words;if(2!==e.length&&4!==e.length&&e.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var t=e.slice(0,2),i=e.length<4?e.slice(0,2):e.slice(2,4),r=e.length<6?e.slice(0,2):e.slice(4,6);this._des1=d.createEncryptor(n.create(t)),this._des2=d.createEncryptor(n.create(i)),this._des3=d.createEncryptor(n.create(r))},encryptBlock:function(e,t){this._des1.encryptBlock(e,t),this._des2.decryptBlock(e,t),this._des3.encryptBlock(e,t)},decryptBlock:function(e,t){this._des3.decryptBlock(e,t),this._des2.encryptBlock(e,t),this._des1.decryptBlock(e,t)},keySize:6,ivSize:2,blockSize:2});e.TripleDES=r._createHelper(p)}(),i.TripleDES)},function(e,t,n){var i;e.exports=(i=n(2),n(16),n(17),n(13),n(5),function(){var e=i,t=e.lib.StreamCipher,n=e.algo,r=n.RC4=t.extend({_doReset:function(){for(var e=this._key,t=e.words,n=e.sigBytes,i=this._S=[],r=0;r<256;r++)i[r]=r;r=0;for(var o=0;r<256;r++){var s=r%n,a=t[s>>>2]>>>24-s%4*8&255;o=(o+i[r]+a)%256;var c=i[r];i[r]=i[o],i[o]=c}this._i=this._j=0},_doProcessBlock:function(e,t){e[t]^=o.call(this)},keySize:8,ivSize:0});function o(){for(var e=this._S,t=this._i,n=this._j,i=0,r=0;r<4;r++){n=(n+e[t=(t+1)%256])%256;var o=e[t];e[t]=e[n],e[n]=o,i|=e[(e[t]+e[n])%256]<<24-8*r}return this._i=t,this._j=n,i}e.RC4=t._createHelper(r);var s=n.RC4Drop=r.extend({cfg:r.cfg.extend({drop:192}),_doReset:function(){r._doReset.call(this);for(var e=this.cfg.drop;e>0;e--)o.call(this)}});e.RC4Drop=t._createHelper(s)}(),i.RC4)},function(e,t,n){var i;e.exports=(i=n(2),n(16),n(17),n(13),n(5),function(){var e=i,t=e.lib.StreamCipher,n=e.algo,r=[],o=[],s=[],a=n.Rabbit=t.extend({_doReset:function(){for(var e=this._key.words,t=this.cfg.iv,n=0;n<4;n++)e[n]=16711935&(e[n]<<8|e[n]>>>24)|4278255360&(e[n]<<24|e[n]>>>8);var i=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],r=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];for(this._b=0,n=0;n<4;n++)c.call(this);for(n=0;n<8;n++)r[n]^=i[n+4&7];if(t){var o=t.words,s=o[0],a=o[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=u>>>16|4294901760&l,h=l<<16|65535&u;for(r[0]^=u,r[1]^=d,r[2]^=l,r[3]^=h,r[4]^=u,r[5]^=d,r[6]^=l,r[7]^=h,n=0;n<4;n++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),r[0]=n[0]^n[5]>>>16^n[3]<<16,r[1]=n[2]^n[7]>>>16^n[5]<<16,r[2]=n[4]^n[1]>>>16^n[7]<<16,r[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)r[i]=16711935&(r[i]<<8|r[i]>>>24)|4278255360&(r[i]<<24|r[i]>>>8),e[t+i]^=r[i]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],r=65535&i,a=i>>>16,c=((r*r>>>17)+r*a>>>15)+a*a,u=((4294901760&i)*i|0)+((65535&i)*i|0);s[n]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.Rabbit=t._createHelper(a)}(),i.Rabbit)},function(e,t,n){var i;e.exports=(i=n(2),n(16),n(17),n(13),n(5),function(){var e=i,t=e.lib.StreamCipher,n=e.algo,r=[],o=[],s=[],a=n.RabbitLegacy=t.extend({_doReset:function(){var e=this._key.words,t=this.cfg.iv,n=this._X=[e[0],e[3]<<16|e[2]>>>16,e[1],e[0]<<16|e[3]>>>16,e[2],e[1]<<16|e[0]>>>16,e[3],e[2]<<16|e[1]>>>16],i=this._C=[e[2]<<16|e[2]>>>16,4294901760&e[0]|65535&e[1],e[3]<<16|e[3]>>>16,4294901760&e[1]|65535&e[2],e[0]<<16|e[0]>>>16,4294901760&e[2]|65535&e[3],e[1]<<16|e[1]>>>16,4294901760&e[3]|65535&e[0]];this._b=0;for(var r=0;r<4;r++)c.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(t){var o=t.words,s=o[0],a=o[1],u=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),l=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),d=u>>>16|4294901760&l,h=l<<16|65535&u;for(i[0]^=u,i[1]^=d,i[2]^=l,i[3]^=h,i[4]^=u,i[5]^=d,i[6]^=l,i[7]^=h,r=0;r<4;r++)c.call(this)}},_doProcessBlock:function(e,t){var n=this._X;c.call(this),r[0]=n[0]^n[5]>>>16^n[3]<<16,r[1]=n[2]^n[7]>>>16^n[5]<<16,r[2]=n[4]^n[1]>>>16^n[7]<<16,r[3]=n[6]^n[3]>>>16^n[1]<<16;for(var i=0;i<4;i++)r[i]=16711935&(r[i]<<8|r[i]>>>24)|4278255360&(r[i]<<24|r[i]>>>8),e[t+i]^=r[i]},blockSize:4,ivSize:2});function c(){for(var e=this._X,t=this._C,n=0;n<8;n++)o[n]=t[n];for(t[0]=t[0]+1295307597+this._b|0,t[1]=t[1]+3545052371+(t[0]>>>0<o[0]>>>0?1:0)|0,t[2]=t[2]+886263092+(t[1]>>>0<o[1]>>>0?1:0)|0,t[3]=t[3]+1295307597+(t[2]>>>0<o[2]>>>0?1:0)|0,t[4]=t[4]+3545052371+(t[3]>>>0<o[3]>>>0?1:0)|0,t[5]=t[5]+886263092+(t[4]>>>0<o[4]>>>0?1:0)|0,t[6]=t[6]+1295307597+(t[5]>>>0<o[5]>>>0?1:0)|0,t[7]=t[7]+3545052371+(t[6]>>>0<o[6]>>>0?1:0)|0,this._b=t[7]>>>0<o[7]>>>0?1:0,n=0;n<8;n++){var i=e[n]+t[n],r=65535&i,a=i>>>16,c=((r*r>>>17)+r*a>>>15)+a*a,u=((4294901760&i)*i|0)+((65535&i)*i|0);s[n]=c^u}e[0]=s[0]+(s[7]<<16|s[7]>>>16)+(s[6]<<16|s[6]>>>16)|0,e[1]=s[1]+(s[0]<<8|s[0]>>>24)+s[7]|0,e[2]=s[2]+(s[1]<<16|s[1]>>>16)+(s[0]<<16|s[0]>>>16)|0,e[3]=s[3]+(s[2]<<8|s[2]>>>24)+s[1]|0,e[4]=s[4]+(s[3]<<16|s[3]>>>16)+(s[2]<<16|s[2]>>>16)|0,e[5]=s[5]+(s[4]<<8|s[4]>>>24)+s[3]|0,e[6]=s[6]+(s[5]<<16|s[5]>>>16)+(s[4]<<16|s[4]>>>16)|0,e[7]=s[7]+(s[6]<<8|s[6]>>>24)+s[5]|0}e.RabbitLegacy=t._createHelper(a)}(),i.RabbitLegacy)},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(28),o=n(14),s=n(9);class a extends o.default{}a.pack=(e,t,n)=>i(void 0,void 0,void 0,(function*(){const i=yield r.default.getConfigFile(e);if(i){const e="var_len"===i.protocolType,r=[0,0,0,3],o=[0];let a=[0];const c=[0,147];let u=[0,0,0,0],l=[2];if(t){a=[1];const e=s.fillString(t.length.toString(16),4),n=s.hexStrint2byte(e),i=s.string2Bytes(t);u=u.concat(n).concat(i)}if(e){l=[18];let e="";if(n){const t=n.reduce((e,t)=>Object.assign(Object.assign({},e),{[t]:1}),{});i.entities[0].attrs.map(n=>{e=t[n.name]?`1${e}`:`0${e}`})}else i.entities[0].attrs.map(()=>{e=`1${e}`});e=s.fillString(e,8*Math.ceil(e.length/8)),l=l.concat(s.hexStrint2byte(parseInt(e,2).toString(16)))}const d=a.concat(c).concat(u).concat(l);return o[0]=d.length,r.concat(o).concat(d)}return null})),t.default=a},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(12),o=n(8),s=n(24),a=n(18);t.default=class{constructor({appID:e,token:t,uid:n,limitSocketNum:o=!0}){this._bindingDevices=null,this._connections={},this._getDevice=e=>{if(null===this._bindingDevices)return r.default.GIZ_SDK_SDK_NOT_INITIALIZED;const t=this._bindingDevices[e];return null==t?r.default.GIZ_OPENAPI_DEVICE_NOT_BOUND:t},this._getConnect=e=>{const t=this._getWebsocketConnInfo(e);return this._connections[t]},this._getDeviceAndConnect=e=>{const t=this._getDevice(e);if(a.isError(t))return t;const n=this._getConnect(t);return null==n?r.default.GIZ_SDK_DEVICE_NOT_SUBSCRIBED:[t,n]},this.connectDevice=e=>{const t=this._getWebsocketConnInfo(e);let n=this._connections[t];if(null==n){const e=Object.keys(this._connections).length;if(0!==this._maxSocketNum&&e>=this._maxSocketNum)return{success:!1,errorCode:r.default.MAX_CONNECT};n=new c({appID:this.appID,token:this.token,uid:this.uid,wsInfo:t,onDeviceStatusChanged:this._handleDeviceStatusChanged,onBindingChanged:this._handleBindingChanged,onSocketStatusChanged:this._handleSocketStatusChanged}),this._connections[t]=n}return n._addSubDid(e.did),null==n._websocket?n._connectWS():n.ready&&n._subDevices([e.did]),{success:!0}},this.disConnectDevice=e=>{const t=this._getWebsocketConnInfo(e);let n=this._connections[t];return n&&n._unSubDevices([e.did]),{success:!0}},this.connect=e=>{const t=this._getDevice(e);if(a.isError(t))return t;const n=this.connectDevice(t);return n.success?null:n.errorCode},this.send=(e,t)=>{const n=this._getDeviceAndConnect(e);return a.isError(n)?n:n[1]._send({cmd:"c2s_raw",data:{did:e,raw:t}})},this.writeData=(e,t)=>{const n=this._getConnect(e);return null!=n?n._send({cmd:"c2s_write",data:{did:e.did,attrs:t}}):{success:!1}},this.write=(e,t)=>{const n=this._getDeviceAndConnect(e);return a.isError(n)?n:n[1]._send({cmd:"c2s_write",data:{did:e,attrs:t}})},this.readStatus=(e,t)=>{const n=this._getConnect(e),i=null!=n;return i&&n._send({cmd:"c2s_read",data:{did:e.did,names:t}}),{success:i}},this.read=(e,t)=>{const n=this._getDeviceAndConnect(e);return a.isError(n)?n:n[1]._send({cmd:"c2s_read",data:{did:e,names:t}})},this.destory=()=>{Object.values(this._connections).forEach(e=>e.destory())},this.subscribeDeviceStatus=e=>{this._onDeviceStatusChanged=e},this.subscribeBindingChanged=e=>{this._onBindingChanged=e},this.subscribeSocketStatus=e=>{this._onSocketStatusChanged=e},this._handleDeviceStatusChanged=e=>{this._onDeviceStatusChanged&&this._onDeviceStatusChanged(e)},this._handleBindingChanged=()=>{this._onBindingChanged&&this._onBindingChanged()},this._handleSocketStatusChanged=(...e)=>{this._onSocketStatusChanged&&this._onSocketStatusChanged(...e)},this._getBindingList=(e=20,t=0,n=[])=>i(this,void 0,void 0,(function*(){const i=`/app/bindings?show_disabled=0&limit=${e}&skip=${t}`,{err:r,data:o}=yield s.default(`${i}`,{method:"GET"});if(r)return{err:r};const a=[...n,...(null==o?void 0:o.devices)||[]];return o&&o.devices.length===e?yield this._getBindingList(e,e+t,a):a})),this._getWebsocketConnInfo=e=>e.host?`wss://wx${e.host}`:"wss://wxstage.gizwits.com",this.appID=e,this.token=t,this.uid=n;const u=wx.getSystemInfoSync().SDKVersion;this._maxSocketNum=o?-1===a.compareWXSDKVersion(u||"1.0.0","1.7.0")?1:5:0}init(){var e,t;return i(this,void 0,void 0,(function*(){try{const n=yield this._getBindingList();return(null===(e=n.err)||void 0===e?void 0:e.errorCode)?{errorCode:null===(t=n.err)||void 0===t?void 0:t.errorCode,errorMessage:"getting binding list failed"}:(this._bindingDevices=n.reduce((e,t)=>Object.assign(Object.assign({},e),{[t.did]:t}),{}),null)}catch(e){return r.default.GIZ_SDK_OTHERWISE}}))}};class c{constructor({appID:e,token:t,uid:n,wsInfo:r,onDeviceStatusChanged:s,onBindingChanged:a,onSocketStatusChanged:c}){this.ready=!1,this.commType="attrs_v4",this._heartbeatInterval=60,this._keepaliveTime=180,this._loginIntveral=5e3,this.autoSubscribe=!1,this._websocket=null,this._loginFailedTimes=0,this._subDids=new Set,this._socketRespHandleMap={},this._waitSends=[],this.destory=()=>{this._heartbeatTimerId&&clearInterval(this._heartbeatTimerId),this._checkConnectTimerId&&clearInterval(this._checkConnectTimerId),this.close()},this._networkChange=e=>i(this,void 0,void 0,(function*(){o.default.log("network change",e)})),this._appShow=()=>i(this,void 0,void 0,(function*(){o.default.log("app show")})),this._addSubDid=e=>{this._subDids.add(e)},this._removeSubDid=e=>{this._subDids.delete(e)},this._connectWS=()=>{o.default.log("GIZ_SDK: start connect ws"),this._websocket=wx.connectSocket({url:this._wsUrl}),this._websocket.onClose(this.handleClose),this._websocket.onOpen(this.handleOpen),this._websocket.onError(this.handleError),this._websocket.onMessage(this.handleMessage),this._checkConnectTimerId||(this._checkConnectTimerId=setInterval(()=>{this._websocket||this._connectWS()},1e3))},this._subDevices=e=>{const t={cmd:"subscribe_req",data:e.map(e=>({did:e}))};this._send(t)},this._unSubDevices=e=>{e.map(e=>this._removeSubDid(e))},this._send=(e,t=!1)=>(o.default.log("Socket send",e,t),new Promise(n=>{if(!this._websocket&&!this.ready)return this._waitSends.push(e),n({success:!0,message:""}),void o.default.debug("GIZ_SDK: cache data wait socket ready");this._websocket&&(t||this.ready)&&this._websocket.send({data:JSON.stringify(e),complete:e=>{o.default.log("GIZ_SDK: socket send res",e),o.default.log("resres",e);let t=!1;"sendSocketMessage:ok"===e.errMsg&&(t=!0),n({success:t,message:e.errMsg})},fail:e=>{o.default.error("GIZ_SDK: Socket send error",new Error(JSON.stringify(e))),n({success:!1,message:e.errMsg})}})})),this.close=()=>{this.ready=!1,this._heartbeatTimerId&&clearInterval(this._heartbeatTimerId),this._websocket&&(this._websocket.close({}),this._websocket=null),this._handleSocketStatusChanged(!1)},this.handleClose=e=>{o.default.debug("GIZ_SDK: socket close",e),this.close(),this._stopPing()},this.handleOpen=()=>{o.default.log(" socket open"),this._login()},this.handleMessage=({data:e})=>{o.default.log("message",e);const t=JSON.parse(e),n=this._socketRespHandleMap[t.cmd];n&&n(t.data)},this.handleError=e=>{o.default.error("GIZ_SDK: socket error",new Error(JSON.stringify(e))),this.close(),this._stopPing()},this._login=()=>{const e={cmd:"login_req",data:{appid:this.appID,uid:this.uid,token:this.token,p0_type:this.commType,heartbeat_interval:this._keepaliveTime,auto_subscribe:this.autoSubscribe}};this._send(e,!0)},this._tryLoginAgain=()=>{this._loginFailedTimes+=1,setTimeout(()=>{this._login()},this._loginFailedTimes*this._loginIntveral)},this._startPing=()=>{this._heartbeatTimerId=setInterval(()=>{this._send({cmd:"ping"})},1e3*this._heartbeatInterval)},this._stopPing=()=>{this._heartbeatTimerId&&clearInterval(this._heartbeatTimerId)},this.pongResp=()=>{},this._loginResp=e=>{1==e.success?(this._loginFailedTimes=0,this.ready=!0,this._startPing(),this._subDevices([...this._subDids]),this._handleSocketStatusChanged(!0),this._consumeWaitSends()):this._loginFailedTimes<3?(o.default.log("GIZ_SDK: Login failed, will try again, please wait..."),this._tryLoginAgain()):(o.default.error("GIZ_SDK: Login failed",new Error("m2m socket login failed")),this.close())},this._consumeWaitSends=()=>{let e=this._waitSends.pop();for(;e;)this._send(e),e=this._waitSends.pop()},this._handleSocketStatusChanged=e=>{this._onSocketStatusChanged&&this._onSocketStatusChanged([...this._subDids],e)},this._subscribeResp=e=>{o.default.log("GIZ_SDK: subscribe_res",e),e&&e.success&&e.success.forEach(e=>this._send({cmd:"c2s_read",data:{did:e.did}})),o.default.debug("GIZ_SDK: subscribe_res",e)},this._onlineResp=e=>{this._isSub(e.did)&&this._onDeviceStatusChanged&&this._onDeviceStatusChanged({did:e.did,attrs:Object.assign({is_online:e.online},e)})},this._rawChangedResp=e=>{this._isSub(e.did)&&this._onDeviceStatusChanged&&this._onDeviceStatusChanged(e)},this._statusChangedResp=e=>{this._isSub(e.did)&&this._onDeviceStatusChanged&&this._onDeviceStatusChanged(e)},this._isSub=e=>this._subDids.has(e),this._invalidMsgResp=e=>{1003===e.error_code&&this._login(),o.default.error("GIZ_SDK: s2c_invalid_msg",new Error(JSON.stringify(e)))},this._bindingChangedResp=e=>{!e.bind&&e.did&&this._removeSubDid(e.did),this._onBindingChanged&&this._onBindingChanged()},this.appID=e,this.token=t,this.uid=n,this._wsUrl=`${r}/ws/app/v1`,this._heartbeatTimerId=void 0,this._loginFailedTimes=0,this._onDeviceStatusChanged=s,this._onBindingChanged=a,this._onSocketStatusChanged=c,this._socketRespHandleMap={pong:this.pongResp,login_res:this._loginResp,subscribe_res:this._subscribeResp,s2c_online_status:this._onlineResp,s2c_raw:this._rawChangedResp,s2c_noti:this._statusChangedResp,s2c_invalid_msg:this._invalidMsgResp,s2c_binding_changed:this._bindingChangedResp},wx.onNetworkStatusChange(this._networkChange),wx.onAppShow(this._appShow)}}t.Connection=c},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(12),o=n(8),s=n(45),a=n(46);class c extends a.default{constructor(){super(...arguments),this.disableSendUDP=!1,this.sendMessageInterval=null,this.UDPSocketHandler=null,this.destroy=()=>{this.cleanTimeout(),this.sendMessageInterval&&clearInterval(this.sendMessageInterval),this.sendMessageInterval=null,this.UDPSocketHandler&&(this.UDPSocketHandler.offError(),this.UDPSocketHandler.offMessage(),this.UDPSocketHandler.close())},this.configDevice=({ssid:e,password:t,softAPSSIDPrefix:n})=>new Promise((a,c)=>{o.default.debug("GIZ_SDK: start config device");let u=!1,l=0;const d=s.default.pack(e,t);this.UDPSocketHandler=wx.createUDPSocket(),this.UDPSocketHandler.bind(),this.disableSendUDP=!1;const h=()=>{try{!this.disableSendUDP&&this.UDPSocketHandler.send({address:"10.10.100.254",port:12414,message:d,offset:0,length:d.byteLength})}catch(e){}};this.sendMessageInterval=setInterval(()=>{h()},2e3),this.UDPSocketHandler.onError(e=>{l+=1,l>2&&(this.destroy(),c({success:!1,err:{errorCode:r.default.WECHAT_ERROR.errorCode,errorMessage:e.errMsg}}))});const f=()=>i(this,void 0,void 0,(function*(){if(!u){this.UDPSocketHandler.offMessage(),this.UDPSocketHandler.offError(),this.sendMessageInterval&&clearInterval(this.sendMessageInterval),this.disableSendUDP=!0,u=!0;try{const n=yield this.searchDevice({ssid:e,password:t});a(n)}catch(e){c(e)}}}));this.UDPSocketHandler.onMessage(e=>{f()}),wx.onNetworkStatusChange(()=>i(this,void 0,void 0,(function*(){!u&&wx.getConnectedWifi({success:e=>i(this,void 0,void 0,(function*(){-1===e.wifi.SSID.indexOf(n)&&f()}))})})))}),this.setDeviceOnboardingDeploy=({timeout:e,isBind:t=!0,softAPSSIDPrefix:n})=>{const r=this.ssid,o=this.password;return new Promise((s,a)=>i(this,void 0,void 0,(function*(){this.destroy(),this.initDeviceOnboardingDeploy(s,a),this.startTimeoutTimer(e);try{const e=((yield this.configDevice({ssid:r,password:o,softAPSSIDPrefix:n})).data||[]).map(e=>({mac:e.mac,productKey:e.product_key,did:e.did,name:"",isBind:!1,connectType:"NONE",isBleOnline:!1,isLanOnline:!1,isOnline:!1}));if(t)try{s(yield this.bindDevices(e))}catch(e){a(e)}else s({success:!0,data:e})}catch(e){a(e)}finally{this.destroy()}})))}}}t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(20),r=({SSID:e,password:t,pk:n})=>{let r=i.MD5(e+t).toString();r=i.enc.Hex.parse(r);let o=i.enc.Utf8.parse(n),s=i.AES.encrypt(o,r,{iv:r,mode:i.mode.ECB,padding:i.pad.ZeroPadding});return i.MD5(s.ciphertext).toString()};t.default=({SSID:e,password:t,pks:n})=>{const i=[];return n.map(n=>{const o=r({SSID:e,password:t,pk:n});i.push(o)}),i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(20);t.psKeySign=e=>{const t=Math.round((new Date).getTime()/1e3),n=e+t;return{Signature:i.MD5(n).toString(),timestamp:t}}},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(12),o=n(18),s=n(40),a=n(23),c=n(46),u=n(45),l=n(8),d=n(90);function h({bleDeviceId:e,arrayBuffer:t,serviceUUIDSuffix:n="abf0",characteristicUUIDSuffix:r="abf7",bleHandle:a}){let c=null,u=null;const h=()=>null===u&&(c&&clearInterval(c),!0);return new Promise((f,p)=>i(this,void 0,void 0,(function*(){try{l.default.debug("GIZ_SDK: ssid info: ",t),u=setTimeout(()=>{c&&clearInterval(c),u=null,f(!1)},5e3),l.default.debug("GIZ_SDK: createBLEConnection start: ",e),yield d.stopBluetoothDevicesDiscovery();const i=yield s.retryConnect(e,1e4);l.default.debug("GIZ_SDK: createBLEConnection end, res:",i);const p=yield s.getBLEDeviceServices(e);l.default.debug("GIZ_SDK: getBLEDeviceServices end, res:",p);const g=p.find(e=>e.uuid.split("-")[0].toLowerCase().endsWith(n));if(!g)return l.default.debug("GIZ_SDK: get ble device services fail",e,p),void f(!1);const v=yield s.getBLEDeviceCharacteristics(e,g.uuid);l.default.debug("GIZ_SDK: getBLEDeviceCharacteristics end, res:",v);const y=v.find(e=>e.uuid.split("-")[0].toLowerCase().endsWith(r));if(!y)return l.default.debug("GIZ_SDK: get ble device characteristics fail",e,v),void f(!1);if(!y.properties.notify&&!y.properties.indicate)return l.default.debug("GIZ_SDK: the ble device characteristic not support notify or indicate",e,y),void f(!1);l.default.debug("GIZ_SDK: check characteristic and service success"),yield s.notifyBLECharacteristicValueChange(e,g.uuid,y.uuid);const m=e=>{const t=o.ab2hex(e.value);l.default.debug("GIZ_SDK: 收到设备返回ack",t),"0000000303000002"===t&&(a.removeEventListener("GizBleDeviceData",m),f(!0))};if(a.addEventListener("GizBleDeviceData",m),l.default.debug("GIZ_SDK: on notifyBLECharacteristicValueChange success"),h())return;yield s.unpackWriteBLECharacteristicValue(e,g.uuid,y.uuid,t),c=setInterval(()=>{h()||s.unpackWriteBLECharacteristicValue(e,g.uuid,y.uuid,t)},2e3),l.default.debug("GIZ_SDK: unpackWriteBLECharacteristicValue end")}catch(e){p(!1),l.default.debug("GIZ_SDK: sendBLEConfigCmd error",e)}}))).catch(e=>{l.default.debug("GIZ_SDK: sendBLEConfigCmd error",e)}).finally(()=>{u&&clearTimeout(u),c&&clearInterval(c),wx.closeBLEConnection({deviceId:e})})}t.sendBLEConfigCmd=h;class f extends c.default{constructor(e,t,n,c,d){super(e,t,n,c),this.destroy=()=>{this.cleanTimeout()},this.isValidBleDevice=(e,t)=>{if(!e||!e.advertisData)return!1;const{productKey:n,mac:i}=o.advertisData2PkAndMac(e.advertisData,this.specialProductKeys);return!!this.specialProductKeys.includes(n)&&(l.default.debug(`GIZ_SDK: isValidBleDevice mac: ${i} pk: ${n} name: ${e.name}`),l.default.debug(`GIZ_SDK: softAPSSIDPrefix: ${t} ismatch : ${e.name&&e.name.startsWith(t)}`),!t||e.name&&e.name.startsWith(t))},this.enableBluetoothDevicesDescovery=()=>i(this,void 0,void 0,(function*(){return(yield s.getBluetoothAdapterState()).available?(yield s.startBluetoothDevicesDiscovery(),{success:!0}):{success:!1,err:{errorCode:r.default.GIZ_SDK_BLE_BLUETOOTH_FUNCTION_NOT_TURNED_ON.errorCode,errorMessage:"蓝牙状态不可用"}}})),this.enableAndGetBluetoothDevices=e=>i(this,void 0,void 0,(function*(){const t=yield this.enableBluetoothDevicesDescovery();if(!t.success)return t;l.default.debug("GIZ_SDK: start enableAndGetBluetoothDevices");const n=(yield s.getBluetoothDevices()).filter(t=>this.isValidBleDevice(t,e));return l.default.debug("GIZ_SDK: getBluetoothDevices success",n),{success:!0,bleDevices:n}})),this.setDeviceOnboardingDeploy=({timeout:e,isBind:t=!0,softAPSSIDPrefix:n})=>new Promise((r,o)=>i(this,void 0,void 0,(function*(){const i=this.ssid,s=this.password;this.destroy(),this.initDeviceOnboardingDeploy(r,o),this.startTimeoutTimer(e);try{const o=((yield this.configBLEDevice({ssid:i,password:s,timeout:1e3*e,softAPSSIDPrefix:n})).data||[]).map(e=>({mac:e.mac,productKey:e.product_key,did:e.did,name:"",isBind:!1,connectType:"NONE",isBleOnline:!1,isLanOnline:!1,isOnline:!1}));r(t?yield this.bindDevices(o):{success:!0,data:o})}catch(e){r({success:!1,data:e})}finally{this.destroy()}}))),this.configBLEDevice=({ssid:e,password:t,softAPSSIDPrefix:n})=>new Promise((c,d)=>i(this,void 0,void 0,(function*(){l.default.debug("GIZ_SDK: start config ble device");const f=yield this.enableAndGetBluetoothDevices(n).catch(e=>({success:!1,err:{errorCode:r.default.WECHAT_ERROR.errorCode,errorMessage:JSON.stringify(e)}}));if(!o.isWXDevicesResult(f))return d(f);const{bleDevices:p}=f;l.default.debug("GIZ_SDK: enableAndGetBluetoothDevices success, target devices: ",p);const g=({devices:e})=>i(this,void 0,void 0,(function*(){this.hasTimeoutHandler()?Array.prototype.push.apply(p,e.filter(e=>this.isValidBleDevice(e,n))):wx.offBluetoothDeviceFound(g)}));wx.onBluetoothDeviceFound(g);const v=u.default.pack(e,t),y=()=>i(this,void 0,void 0,(function*(){if(l.default.debug("GIZ_SDK: startConfigDevice"),!this.hasTimeoutHandler())return;const e=p.shift();if(e&&l.default.debug("GIZ_SDK: startConfigDevice, target device: ",e),!(e&&(yield h({bleDeviceId:e.deviceId,arrayBuffer:v.buffer,bleHandle:this.bleHandle}))))return yield a.default(500),yield s.startBluetoothDevicesDiscovery(),void(yield y());l.default.debug("GIZ_SDK: offBluetoothDeviceFound ready search device"),wx.offBluetoothDeviceFound(g)}));try{this.searchDevice({ssid:e,password:t}).then(e=>{c(e)})}catch(e){d(e),l.default.error("GIZ_SDK: searchDevice error",new Error(JSON.stringify(e)))}yield y()}))),this.bleHandle=d}}t.default=f},function(e,t,n){const{container:i,SERVICE_IDENTIFIER:r}=n(3),o=n(118).default,s=i.get(r.Hooks);"function"==typeof s.initNativeApi&&s.initNativeApi(o),e.exports=o,e.exports.default=e.exports},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))},r=this&&this.__generator||function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__spreadArray||function(e,t){for(var n=0,i=t.length,r=e.length;n<i;n++,r++)e[r]=t[n];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.Container=void 0;var s=n(92),a=n(6),c=n(10),u=n(4),l=n(49),d=n(93),h=n(100),f=n(102),p=n(15),g=n(19),v=n(105),y=n(106),m=function(){function e(e){this._appliedMiddleware=[];var t=e||{};if("object"!=typeof t)throw new Error(""+a.CONTAINER_OPTIONS_MUST_BE_AN_OBJECT);if(void 0===t.defaultScope)t.defaultScope=c.BindingScopeEnum.Transient;else if(t.defaultScope!==c.BindingScopeEnum.Singleton&&t.defaultScope!==c.BindingScopeEnum.Transient&&t.defaultScope!==c.BindingScopeEnum.Request)throw new Error(""+a.CONTAINER_OPTIONS_INVALID_DEFAULT_SCOPE);if(void 0===t.autoBindInjectable)t.autoBindInjectable=!1;else if("boolean"!=typeof t.autoBindInjectable)throw new Error(""+a.CONTAINER_OPTIONS_INVALID_AUTO_BIND_INJECTABLE);if(void 0===t.skipBaseClassChecks)t.skipBaseClassChecks=!1;else if("boolean"!=typeof t.skipBaseClassChecks)throw new Error(""+a.CONTAINER_OPTIONS_INVALID_SKIP_BASE_CHECK);this.options={autoBindInjectable:t.autoBindInjectable,defaultScope:t.defaultScope,skipBaseClassChecks:t.skipBaseClassChecks},this.id=p.id(),this._bindingDictionary=new y.Lookup,this._snapshots=[],this._middleware=null,this.parent=null,this._metadataReader=new l.MetadataReader}return e.merge=function(t,n){for(var i=[],r=2;r<arguments.length;r++)i[r-2]=arguments[r];var s=new e,a=o([t,n],i).map((function(e){return d.getBindingDictionary(e)})),c=d.getBindingDictionary(s);function u(e,t){e.traverse((function(e,n){n.forEach((function(e){t.add(e.serviceIdentifier,e.clone())}))}))}return a.forEach((function(e){u(e,c)})),s},e.prototype.load=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var n=this._getContainerModuleHelpersFactory(),i=0,r=e;i<r.length;i++){var o=r[i],s=n(o.id);o.registry(s.bindFunction,s.unbindFunction,s.isboundFunction,s.rebindFunction)}},e.prototype.loadAsync=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return i(this,void 0,void 0,(function(){var t,n,i,o,s;return r(this,(function(r){switch(r.label){case 0:t=this._getContainerModuleHelpersFactory(),n=0,i=e,r.label=1;case 1:return n<i.length?(o=i[n],s=t(o.id),[4,o.registry(s.bindFunction,s.unbindFunction,s.isboundFunction,s.rebindFunction)]):[3,4];case 2:r.sent(),r.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))},e.prototype.unload=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var i=function(e){return function(t){return t.moduleId===e}};t.forEach((function(t){var n=i(t.id);e._bindingDictionary.removeByCondition(n)}))},e.prototype.bind=function(e){var t=this.options.defaultScope||c.BindingScopeEnum.Transient,n=new s.Binding(e,t);return this._bindingDictionary.add(e,n),new f.BindingToSyntax(n)},e.prototype.rebind=function(e){return this.unbind(e),this.bind(e)},e.prototype.unbind=function(e){try{this._bindingDictionary.remove(e)}catch(t){throw new Error(a.CANNOT_UNBIND+" "+g.getServiceIdentifierAsString(e))}},e.prototype.unbindAll=function(){this._bindingDictionary=new y.Lookup},e.prototype.isBound=function(e){var t=this._bindingDictionary.hasKey(e);return!t&&this.parent&&(t=this.parent.isBound(e)),t},e.prototype.isBoundNamed=function(e,t){return this.isBoundTagged(e,u.NAMED_TAG,t)},e.prototype.isBoundTagged=function(e,t,n){var i=!1;if(this._bindingDictionary.hasKey(e)){var r=this._bindingDictionary.get(e),o=d.createMockRequest(this,e,t,n);i=r.some((function(e){return e.constraint(o)}))}return!i&&this.parent&&(i=this.parent.isBoundTagged(e,t,n)),i},e.prototype.snapshot=function(){this._snapshots.push(v.ContainerSnapshot.of(this._bindingDictionary.clone(),this._middleware))},e.prototype.restore=function(){var e=this._snapshots.pop();if(void 0===e)throw new Error(a.NO_MORE_SNAPSHOTS_AVAILABLE);this._bindingDictionary=e.bindings,this._middleware=e.middleware},e.prototype.createChild=function(t){var n=new e(t||this.options);return n.parent=this,n},e.prototype.applyMiddleware=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._appliedMiddleware=this._appliedMiddleware.concat(e);var n=this._middleware?this._middleware:this._planAndResolve();this._middleware=e.reduce((function(e,t){return t(e)}),n)},e.prototype.applyCustomMetadataReader=function(e){this._metadataReader=e},e.prototype.get=function(e){return this._get(!1,!1,c.TargetTypeEnum.Variable,e)},e.prototype.getTagged=function(e,t,n){return this._get(!1,!1,c.TargetTypeEnum.Variable,e,t,n)},e.prototype.getNamed=function(e,t){return this.getTagged(e,u.NAMED_TAG,t)},e.prototype.getAll=function(e){return this._get(!0,!0,c.TargetTypeEnum.Variable,e)},e.prototype.getAllTagged=function(e,t,n){return this._get(!1,!0,c.TargetTypeEnum.Variable,e,t,n)},e.prototype.getAllNamed=function(e,t){return this.getAllTagged(e,u.NAMED_TAG,t)},e.prototype.resolve=function(e){var t=this.createChild();return t.bind(e).toSelf(),this._appliedMiddleware.forEach((function(e){t.applyMiddleware(e)})),t.get(e)},e.prototype._getContainerModuleHelpersFactory=function(){var e=this,t=function(e,t){e._binding.moduleId=t},n=function(n){return function(i){var r=e.rebind.bind(e)(i);return t(r,n),r}};return function(i){return{bindFunction:(r=i,function(n){var i=e.bind.bind(e)(n);return t(i,r),i}),isboundFunction:function(t){return e.isBound.bind(e)(t)},rebindFunction:n(i),unbindFunction:function(t){e.unbind.bind(e)(t)}};var r}},e.prototype._get=function(e,t,n,i,r,o){var s=null,c={avoidConstraints:e,contextInterceptor:function(e){return e},isMultiInject:t,key:r,serviceIdentifier:i,targetType:n,value:o};if(this._middleware){if(null==(s=this._middleware(c)))throw new Error(a.INVALID_MIDDLEWARE_RETURN)}else s=this._planAndResolve()(c);return s},e.prototype._planAndResolve=function(){var e=this;return function(t){var n=d.plan(e._metadataReader,e,t.isMultiInject,t.targetType,t.serviceIdentifier,t.key,t.value,t.avoidConstraints);return n=t.contextInterceptor(n),h.resolve(n)}},e}();t.Container=m},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Binding=void 0;var i=n(10),r=n(15),o=function(){function e(e,t){this.id=r.id(),this.activated=!1,this.serviceIdentifier=e,this.scope=t,this.type=i.BindingTypeEnum.Invalid,this.constraint=function(e){return!0},this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.onActivation=null,this.dynamicValue=null}return e.prototype.clone=function(){var t=new e(this.serviceIdentifier,this.scope);return t.activated=t.scope===i.BindingScopeEnum.Singleton&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.factory=this.factory,t.provider=this.provider,t.constraint=this.constraint,t.onActivation=this.onActivation,t.cache=this.cache,t},e}();t.Binding=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getBindingDictionary=t.createMockRequest=t.plan=void 0;var i=n(94),r=n(6),o=n(10),s=n(4),a=n(50),c=n(19),u=n(95),l=n(7),d=n(96),h=n(97),f=n(99),p=n(52);function g(e){return e._bindingDictionary}function v(e,t,n,o,s){var a=y(n.container,s.serviceIdentifier),u=[];return a.length===i.BindingCount.NoBindingsAvailable&&n.container.options.autoBindInjectable&&"function"==typeof s.serviceIdentifier&&e.getConstructorMetadata(s.serviceIdentifier).compilerGeneratedMetadata&&(n.container.bind(s.serviceIdentifier).toSelf(),a=y(n.container,s.serviceIdentifier)),u=t?a:a.filter((function(e){var t=new f.Request(e.serviceIdentifier,n,o,e,s);return e.constraint(t)})),function(e,t,n,o){switch(t.length){case i.BindingCount.NoBindingsAvailable:if(n.isOptional())return t;var s=c.getServiceIdentifierAsString(e),a=r.NOT_REGISTERED;throw a+=c.listMetadataForTarget(s,n),a+=c.listRegisteredBindingsForServiceIdentifier(o,s,y),new Error(a);case i.BindingCount.OnlyOneBindingAvailable:if(!n.isArray())return t;case i.BindingCount.MultipleBindingsAvailable:default:if(n.isArray())return t;s=c.getServiceIdentifierAsString(e),a=r.AMBIGUOUS_MATCH+" "+s;throw a+=c.listRegisteredBindingsForServiceIdentifier(o,s,y),new Error(a)}}(s.serviceIdentifier,u,s,n.container),u}function y(e,t){var n=[],i=g(e);return i.hasKey(t)?n=i.get(t):null!==e.parent&&(n=y(e.parent,t)),n}t.getBindingDictionary=g,t.plan=function(e,t,n,i,g,y,m,_){void 0===_&&(_=!1);var b=new u.Context(t),S=function(e,t,n,i,r,o){var a=e?s.MULTI_INJECT_TAG:s.INJECT_TAG,c=new l.Metadata(a,n),u=new p.Target(t,i,n,c);if(void 0!==r){var d=new l.Metadata(r,o);u.metadata.push(d)}return u}(n,i,g,"",y,m);try{return function e(t,n,i,s,a,c){var u,l;if(null===a){u=v(t,n,s,null,c),l=new f.Request(i,s,null,u,c);var p=new d.Plan(s,l);s.addPlan(p)}else u=v(t,n,s,a,c),l=a.addChildRequest(c.serviceIdentifier,u,c);u.forEach((function(n){var i=null;if(c.isArray())i=l.addChildRequest(n.serviceIdentifier,n,c);else{if(n.cache)return;i=l}if(n.type===o.BindingTypeEnum.Instance&&null!==n.implementationType){var a=h.getDependencies(t,n.implementationType);if(!s.container.options.skipBaseClassChecks){var u=h.getBaseClassDependencyCount(t,n.implementationType);if(a.length<u){var d=r.ARGUMENTS_LENGTH_MISMATCH(h.getFunctionName(n.implementationType));throw new Error(d)}}a.forEach((function(n){e(t,!1,n.serviceIdentifier,s,i,n)}))}}))}(e,_,g,b,null,S),b}catch(e){throw a.isStackOverflowExeption(e)&&b.plan&&c.circularDependencyToException(b.plan.rootRequest),e}},t.createMockRequest=function(e,t,n,i){var r=new p.Target(o.TargetTypeEnum.Variable,"",t,new l.Metadata(n,i)),s=new u.Context(e);return new f.Request(t,s,null,[],r)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingCount=void 0;t.BindingCount={MultipleBindingsAvailable:2,NoBindingsAvailable:0,OnlyOneBindingAvailable:1}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Context=void 0;var i=n(15),r=function(){function e(e){this.id=i.id(),this.container=e}return e.prototype.addPlan=function(e){this.plan=e},e.prototype.setCurrentRequest=function(e){this.currentRequest=e},e}();t.Context=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Plan=void 0;var i=function(e,t){this.parentContext=e,this.rootRequest=t};t.Plan=i},function(e,t,n){"use strict";var i=this&&this.__spreadArray||function(e,t){for(var n=0,i=t.length,r=e.length;n<i;n++,r++)e[r]=t[n];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.getFunctionName=t.getBaseClassDependencyCount=t.getDependencies=void 0;var r=n(51),o=n(6),s=n(10),a=n(4),c=n(19);Object.defineProperty(t,"getFunctionName",{enumerable:!0,get:function(){return c.getFunctionName}});var u=n(52);function l(e,t,n,r){var a=e.getConstructorMetadata(n),c=a.compilerGeneratedMetadata;if(void 0===c){var l=o.MISSING_INJECTABLE_ANNOTATION+" "+t+".";throw new Error(l)}var f=a.userGeneratedMetadata,p=Object.keys(f),g=0===n.length&&p.length>0,v=p.length>n.length,y=function(e,t,n,i,r){for(var o=[],s=0;s<r;s++){var a=d(s,e,t,n,i);null!==a&&o.push(a)}return o}(r,t,c,f,g||v?p.length:n.length),m=function e(t,n){for(var r=t.getPropertiesMetadata(n),o=[],a=Object.keys(r),c=0,l=a;c<l.length;c++){var d=l[c],f=r[d],p=h(r[d]),g=p.targetName||d,v=p.inject||p.multiInject,y=new u.Target(s.TargetTypeEnum.ClassProperty,g,v);y.metadata=f,o.push(y)}var m=Object.getPrototypeOf(n.prototype).constructor;if(m!==Object){var _=e(t,m);o=i(i([],o),_)}return o}(e,n);return i(i([],y),m)}function d(e,t,n,i,a){var c=a[e.toString()]||[],l=h(c),d=!0!==l.unmanaged,f=i[e],p=l.inject||l.multiInject;if((f=p||f)instanceof r.LazyServiceIdentifer&&(f=f.unwrap()),d){if(!t&&(f===Object||f===Function||void 0===f)){var g=o.MISSING_INJECT_ANNOTATION+" argument "+e+" in class "+n+".";throw new Error(g)}var v=new u.Target(s.TargetTypeEnum.ConstructorArgument,l.targetName,f);return v.metadata=c,v}return null}function h(e){var t={};return e.forEach((function(e){t[e.key.toString()]=e.value})),{inject:t[a.INJECT_TAG],multiInject:t[a.MULTI_INJECT_TAG],targetName:t[a.NAME_TAG],unmanaged:t[a.UNMANAGED_TAG]}}t.getDependencies=function(e,t){return l(e,c.getFunctionName(t),t,!1)},t.getBaseClassDependencyCount=function e(t,n){var i=Object.getPrototypeOf(n.prototype).constructor;if(i!==Object){var r=l(t,c.getFunctionName(i),i,!0),o=r.map((function(e){return e.metadata.filter((function(e){return e.key===a.UNMANAGED_TAG}))})),s=[].concat.apply([],o).length,u=r.length-s;return u>0?u:e(t,i)}return 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.QueryableString=void 0;var i=function(){function e(e){this.str=e}return e.prototype.startsWith=function(e){return 0===this.str.indexOf(e)},e.prototype.endsWith=function(e){var t,n=e.split("").reverse().join("");return t=this.str.split("").reverse().join(""),this.startsWith.call({str:t},n)},e.prototype.contains=function(e){return-1!==this.str.indexOf(e)},e.prototype.equals=function(e){return this.str===e},e.prototype.value=function(){return this.str},e}();t.QueryableString=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Request=void 0;var i=n(15),r=function(){function e(e,t,n,r,o){this.id=i.id(),this.serviceIdentifier=e,this.parentContext=t,this.parentRequest=n,this.target=o,this.childRequests=[],this.bindings=Array.isArray(r)?r:[r],this.requestScope=null===n?new Map:null}return e.prototype.addChildRequest=function(t,n,i){var r=new e(t,this.parentContext,this,n,i);return this.childRequests.push(r),r},e}();t.Request=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resolve=void 0;var i=n(6),r=n(10),o=n(50),s=n(19),a=n(101),c=function(e,t,n){try{return n()}catch(n){throw o.isStackOverflowExeption(n)?new Error(i.CIRCULAR_DEPENDENCY_IN_FACTORY(e,t.toString())):n}},u=function(e){return function(t){t.parentContext.setCurrentRequest(t);var n=t.bindings,o=t.childRequests,l=t.target&&t.target.isArray(),d=!(t.parentRequest&&t.parentRequest.target&&t.target&&t.parentRequest.target.matchesArray(t.target.serviceIdentifier));if(l&&d)return o.map((function(t){return u(e)(t)}));var h=null;if(!t.target.isOptional()||0!==n.length){var f=n[0],p=f.scope===r.BindingScopeEnum.Singleton,g=f.scope===r.BindingScopeEnum.Request;if(p&&f.activated)return f.cache;if(g&&null!==e&&e.has(f.id))return e.get(f.id);if(f.type===r.BindingTypeEnum.ConstantValue)h=f.cache,f.activated=!0;else if(f.type===r.BindingTypeEnum.Function)h=f.cache,f.activated=!0;else if(f.type===r.BindingTypeEnum.Constructor)h=f.implementationType;else if(f.type===r.BindingTypeEnum.DynamicValue&&null!==f.dynamicValue)h=c("toDynamicValue",f.serviceIdentifier,(function(){return f.dynamicValue(t.parentContext)}));else if(f.type===r.BindingTypeEnum.Factory&&null!==f.factory)h=c("toFactory",f.serviceIdentifier,(function(){return f.factory(t.parentContext)}));else if(f.type===r.BindingTypeEnum.Provider&&null!==f.provider)h=c("toProvider",f.serviceIdentifier,(function(){return f.provider(t.parentContext)}));else{if(f.type!==r.BindingTypeEnum.Instance||null===f.implementationType){var v=s.getServiceIdentifierAsString(t.serviceIdentifier);throw new Error(i.INVALID_BINDING_TYPE+" "+v)}h=a.resolveInstance(f.implementationType,o,u(e))}return"function"==typeof f.onActivation&&(h=f.onActivation(t.parentContext,h)),p&&(f.cache=h,f.activated=!0),g&&null!==e&&!e.has(f.id)&&e.set(f.id,h),h}}};t.resolve=function(e){return u(e.plan.rootRequest.requestScope)(e.plan.rootRequest)}},function(e,t,n){"use strict";var i=this&&this.__spreadArray||function(e,t){for(var n=0,i=t.length,r=e.length;n<i;n++,r++)e[r]=t[n];return e};Object.defineProperty(t,"__esModule",{value:!0}),t.resolveInstance=void 0;var r=n(6),o=n(10),s=n(4);t.resolveInstance=function(e,t,n){var a,c,u=null;if(t.length>0){var l=t.filter((function(e){return null!==e.target&&e.target.type===o.TargetTypeEnum.ConstructorArgument})).map(n);c=l,u=function(e,t,n){var i=t.filter((function(e){return null!==e.target&&e.target.type===o.TargetTypeEnum.ClassProperty})),r=i.map(n);return i.forEach((function(t,n){var i;i=t.target.name.value();var o=r[n];e[i]=o})),e}(u=new((a=e).bind.apply(a,i([void 0],c))),t,n)}else u=new e;return function(e,t){if(Reflect.hasMetadata(s.POST_CONSTRUCT,e)){var n=Reflect.getMetadata(s.POST_CONSTRUCT,e);try{t[n.value]()}catch(t){throw new Error(r.POST_CONSTRUCT_ERROR(e.name,t.message))}}}(e,u),u}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingToSyntax=void 0;var i=n(6),r=n(10),o=n(103),s=n(53),a=function(){function e(e){this._binding=e}return e.prototype.to=function(e){return this._binding.type=r.BindingTypeEnum.Instance,this._binding.implementationType=e,new o.BindingInWhenOnSyntax(this._binding)},e.prototype.toSelf=function(){if("function"!=typeof this._binding.serviceIdentifier)throw new Error(""+i.INVALID_TO_SELF_VALUE);var e=this._binding.serviceIdentifier;return this.to(e)},e.prototype.toConstantValue=function(e){return this._binding.type=r.BindingTypeEnum.ConstantValue,this._binding.cache=e,this._binding.dynamicValue=null,this._binding.implementationType=null,this._binding.scope=r.BindingScopeEnum.Singleton,new s.BindingWhenOnSyntax(this._binding)},e.prototype.toDynamicValue=function(e){return this._binding.type=r.BindingTypeEnum.DynamicValue,this._binding.cache=null,this._binding.dynamicValue=e,this._binding.implementationType=null,new o.BindingInWhenOnSyntax(this._binding)},e.prototype.toConstructor=function(e){return this._binding.type=r.BindingTypeEnum.Constructor,this._binding.implementationType=e,this._binding.scope=r.BindingScopeEnum.Singleton,new s.BindingWhenOnSyntax(this._binding)},e.prototype.toFactory=function(e){return this._binding.type=r.BindingTypeEnum.Factory,this._binding.factory=e,this._binding.scope=r.BindingScopeEnum.Singleton,new s.BindingWhenOnSyntax(this._binding)},e.prototype.toFunction=function(e){if("function"!=typeof e)throw new Error(i.INVALID_FUNCTION_BINDING);var t=this.toConstantValue(e);return this._binding.type=r.BindingTypeEnum.Function,this._binding.scope=r.BindingScopeEnum.Singleton,t},e.prototype.toAutoFactory=function(e){return this._binding.type=r.BindingTypeEnum.Factory,this._binding.factory=function(t){return function(){return t.container.get(e)}},this._binding.scope=r.BindingScopeEnum.Singleton,new s.BindingWhenOnSyntax(this._binding)},e.prototype.toProvider=function(e){return this._binding.type=r.BindingTypeEnum.Provider,this._binding.provider=e,this._binding.scope=r.BindingScopeEnum.Singleton,new s.BindingWhenOnSyntax(this._binding)},e.prototype.toService=function(e){this.toDynamicValue((function(t){return t.container.get(e)}))},e}();t.BindingToSyntax=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingInWhenOnSyntax=void 0;var i=n(104),r=n(29),o=n(30),s=function(){function e(e){this._binding=e,this._bindingWhenSyntax=new o.BindingWhenSyntax(this._binding),this._bindingOnSyntax=new r.BindingOnSyntax(this._binding),this._bindingInSyntax=new i.BindingInSyntax(e)}return e.prototype.inRequestScope=function(){return this._bindingInSyntax.inRequestScope()},e.prototype.inSingletonScope=function(){return this._bindingInSyntax.inSingletonScope()},e.prototype.inTransientScope=function(){return this._bindingInSyntax.inTransientScope()},e.prototype.when=function(e){return this._bindingWhenSyntax.when(e)},e.prototype.whenTargetNamed=function(e){return this._bindingWhenSyntax.whenTargetNamed(e)},e.prototype.whenTargetIsDefault=function(){return this._bindingWhenSyntax.whenTargetIsDefault()},e.prototype.whenTargetTagged=function(e,t){return this._bindingWhenSyntax.whenTargetTagged(e,t)},e.prototype.whenInjectedInto=function(e){return this._bindingWhenSyntax.whenInjectedInto(e)},e.prototype.whenParentNamed=function(e){return this._bindingWhenSyntax.whenParentNamed(e)},e.prototype.whenParentTagged=function(e,t){return this._bindingWhenSyntax.whenParentTagged(e,t)},e.prototype.whenAnyAncestorIs=function(e){return this._bindingWhenSyntax.whenAnyAncestorIs(e)},e.prototype.whenNoAncestorIs=function(e){return this._bindingWhenSyntax.whenNoAncestorIs(e)},e.prototype.whenAnyAncestorNamed=function(e){return this._bindingWhenSyntax.whenAnyAncestorNamed(e)},e.prototype.whenAnyAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenAnyAncestorTagged(e,t)},e.prototype.whenNoAncestorNamed=function(e){return this._bindingWhenSyntax.whenNoAncestorNamed(e)},e.prototype.whenNoAncestorTagged=function(e,t){return this._bindingWhenSyntax.whenNoAncestorTagged(e,t)},e.prototype.whenAnyAncestorMatches=function(e){return this._bindingWhenSyntax.whenAnyAncestorMatches(e)},e.prototype.whenNoAncestorMatches=function(e){return this._bindingWhenSyntax.whenNoAncestorMatches(e)},e.prototype.onActivation=function(e){return this._bindingOnSyntax.onActivation(e)},e}();t.BindingInWhenOnSyntax=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BindingInSyntax=void 0;var i=n(10),r=n(53),o=function(){function e(e){this._binding=e}return e.prototype.inRequestScope=function(){return this._binding.scope=i.BindingScopeEnum.Request,new r.BindingWhenOnSyntax(this._binding)},e.prototype.inSingletonScope=function(){return this._binding.scope=i.BindingScopeEnum.Singleton,new r.BindingWhenOnSyntax(this._binding)},e.prototype.inTransientScope=function(){return this._binding.scope=i.BindingScopeEnum.Transient,new r.BindingWhenOnSyntax(this._binding)},e}();t.BindingInSyntax=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerSnapshot=void 0;var i=function(){function e(){}return e.of=function(t,n){var i=new e;return i.bindings=t,i.middleware=n,i},e}();t.ContainerSnapshot=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Lookup=void 0;var i=n(6),r=function(){function e(){this._map=new Map}return e.prototype.getMap=function(){return this._map},e.prototype.add=function(e,t){if(null==e)throw new Error(i.NULL_ARGUMENT);if(null==t)throw new Error(i.NULL_ARGUMENT);var n=this._map.get(e);void 0!==n?(n.push(t),this._map.set(e,n)):this._map.set(e,[t])},e.prototype.get=function(e){if(null==e)throw new Error(i.NULL_ARGUMENT);var t=this._map.get(e);if(void 0!==t)return t;throw new Error(i.KEY_NOT_FOUND)},e.prototype.remove=function(e){if(null==e)throw new Error(i.NULL_ARGUMENT);if(!this._map.delete(e))throw new Error(i.KEY_NOT_FOUND)},e.prototype.removeByCondition=function(e){var t=this;this._map.forEach((function(n,i){var r=n.filter((function(t){return!e(t)}));r.length>0?t._map.set(i,r):t._map.delete(i)}))},e.prototype.hasKey=function(e){if(null==e)throw new Error(i.NULL_ARGUMENT);return this._map.has(e)},e.prototype.clone=function(){var t=new e;return this._map.forEach((function(e,n){e.forEach((function(e){return t.add(n,e.clone())}))})),t},e.prototype.traverse=function(e){this._map.forEach((function(t,n){e(n,t)}))},e}();t.Lookup=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AsyncContainerModule=t.ContainerModule=void 0;var i=n(15),r=function(e){this.id=i.id(),this.registry=e};t.ContainerModule=r;var o=function(e){this.id=i.id(),this.registry=e};t.AsyncContainerModule=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.injectable=void 0;var i=n(6),r=n(4);t.injectable=function(){return function(e){if(Reflect.hasOwnMetadata(r.PARAM_TYPES,e))throw new Error(i.DUPLICATED_INJECTABLE_DECORATOR);var t=Reflect.getMetadata(r.DESIGN_PARAM_TYPES,e)||[];return Reflect.defineMetadata(r.PARAM_TYPES,t,e),e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.tagged=void 0;var i=n(7),r=n(11);t.tagged=function(e,t){return function(n,o,s){var a=new i.Metadata(e,t);"number"==typeof s?r.tagParameter(n,o,s,a):r.tagProperty(n,o,a)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.named=void 0;var i=n(4),r=n(7),o=n(11);t.named=function(e){return function(t,n,s){var a=new r.Metadata(i.NAMED_TAG,e);"number"==typeof s?o.tagParameter(t,n,s,a):o.tagProperty(t,n,a)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.optional=void 0;var i=n(4),r=n(7),o=n(11);t.optional=function(){return function(e,t,n){var s=new r.Metadata(i.OPTIONAL_TAG,!0);"number"==typeof n?o.tagParameter(e,t,n,s):o.tagProperty(e,t,s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unmanaged=void 0;var i=n(4),r=n(7),o=n(11);t.unmanaged=function(){return function(e,t,n){var s=new r.Metadata(i.UNMANAGED_TAG,!0);o.tagParameter(e,t,n,s)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multiInject=void 0;var i=n(4),r=n(7),o=n(11);t.multiInject=function(e){return function(t,n,s){var a=new r.Metadata(i.MULTI_INJECT_TAG,e);"number"==typeof s?o.tagParameter(t,n,s,a):o.tagProperty(t,n,a)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.targetName=void 0;var i=n(4),r=n(7),o=n(11);t.targetName=function(e){return function(t,n,s){var a=new r.Metadata(i.NAME_TAG,e);o.tagParameter(t,n,s,a)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.postConstruct=void 0;var i=n(6),r=n(4),o=n(7);t.postConstruct=function(){return function(e,t,n){var s=new o.Metadata(r.POST_CONSTRUCT,t);if(Reflect.hasOwnMetadata(r.POST_CONSTRUCT,e.constructor))throw new Error(i.MULTIPLE_POST_CONSTRUCT_METHODS);Reflect.defineMetadata(r.POST_CONSTRUCT,s,e.constructor)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.multiBindToService=void 0;t.multiBindToService=function(e){return function(t){return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return n.forEach((function(n){return e.bind(n).toService(t)}))}}}},function(e,t,n){(function(e,t){
49
+ /*! *****************************************************************************
50
+ Copyright (C) Microsoft. All rights reserved.
51
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
52
+ this file except in compliance with the License. You may obtain a copy of the
53
+ License at http://www.apache.org/licenses/LICENSE-2.0
54
+
55
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
56
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
57
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
58
+ MERCHANTABLITY OR NON-INFRINGEMENT.
59
+
60
+ See the Apache Version 2.0 License for specific language governing permissions
61
+ and limitations under the License.
62
+ ***************************************************************************** */
63
+ var n;!function(n){!function(i){var r="object"==typeof t?t:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),o=s(n);function s(e,t){return function(n,i){"function"!=typeof e[n]&&Object.defineProperty(e,n,{configurable:!0,writable:!0,value:i}),t&&t(n,i)}}void 0===r.Reflect?r.Reflect=n:o=s(r.Reflect,o),function(t){var n=Object.prototype.hasOwnProperty,i="function"==typeof Symbol,r=i&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",o=i&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",s="function"==typeof Object.create,a={__proto__:[]}instanceof Array,c=!s&&!a,u={create:s?function(){return P(Object.create(null))}:a?function(){return P({__proto__:null})}:function(){return P({})},has:c?function(e,t){return n.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return n.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},l=Object.getPrototypeOf(Function),d="object"==typeof e&&e.env&&"true"===e.env.REFLECT_METADATA_USE_MAP_POLYFILL,h=d||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?function(){var e={},t=[],n=function(){function e(e,t,n){this._index=0,this._keys=e,this._values=t,this._selector=n}return e.prototype["@@iterator"]=function(){return this},e.prototype[o]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var n=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:n,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var n=this._find(e,!0);return this._values[n]=t,this},t.prototype.delete=function(t){var n=this._find(t,!1);if(n>=0){for(var i=this._keys.length,r=n+1;r<i;r++)this._keys[r-1]=this._keys[r],this._values[r-1]=this._values[r];return this._keys.length--,this._values.length--,t===this._cacheKey&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new n(this._keys,this._values,i)},t.prototype.values=function(){return new n(this._keys,this._values,r)},t.prototype.entries=function(){return new n(this._keys,this._values,s)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[o]=function(){return this.entries()},t.prototype._find=function(e,t){return this._cacheKey!==e&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=e)),this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function i(e,t){return e}function r(e,t){return t}function s(e,t){return[e,t]}}():Map,f=d||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?function(){function e(){this._map=new h}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.values()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[o]=function(){return this.keys()},e}():Set,p=new(d||"function"!=typeof WeakMap?function(){var e=u.create(),t=i();return function(){function e(){this._key=i()}return e.prototype.has=function(e){var t=r(e,!1);return void 0!==t&&u.has(t,this._key)},e.prototype.get=function(e){var t=r(e,!1);return void 0!==t?u.get(t,this._key):void 0},e.prototype.set=function(e,t){return r(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=r(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=i()},e}();function i(){var t;do{t="@@WeakMap@@"+s()}while(u.has(e,t));return e[t]=!0,t}function r(e,i){if(!n.call(e,t)){if(!i)return;Object.defineProperty(e,t,{value:u.create()})}return e[t]}function o(e,t){for(var n=0;n<t;++n)e[n]=255*Math.random()|0;return e}function s(){var e,t=(e=16,"function"==typeof Uint8Array?"undefined"!=typeof crypto?crypto.getRandomValues(new Uint8Array(e)):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(new Uint8Array(e)):o(new Uint8Array(e),e):o(new Array(e),e));t[6]=79&t[6]|64,t[8]=191&t[8]|128;for(var n="",i=0;i<16;++i){var r=t[i];4!==i&&6!==i&&8!==i||(n+="-"),r<16&&(n+="0"),n+=r.toString(16).toLowerCase()}return n}}():WeakMap);function g(e,t,n){var i=p.get(e);if(S(i)){if(!n)return;i=new h,p.set(e,i)}var r=i.get(t);if(S(r)){if(!n)return;r=new h,i.set(t,r)}return r}function v(e,t,n){var i=g(t,n,!1);return!S(i)&&!!i.has(e)}function y(e,t,n){var i=g(t,n,!1);if(!S(i))return i.get(e)}function m(e,t,n,i){g(n,i,!0).set(e,t)}function _(e,t){var n=[],i=g(e,t,!1);if(S(i))return n;for(var r=function(e){var t=C(e,o);if(!O(t))throw new TypeError;var n=t.call(e);if(!D(n))throw new TypeError;return n}(i.keys()),s=0;;){var a=B(r);if(!a)return n.length=s,n;var c=a.value;try{n[s]=c}catch(e){try{k(r)}finally{throw e}}s++}}function b(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function S(e){return void 0===e}function w(e){return null===e}function D(e){return"object"==typeof e?null!==e:"function"==typeof e}function T(e,t){switch(b(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var n=3===t?"string":5===t?"number":"default",i=C(e,r);if(void 0!==i){var o=i.call(e,n);if(D(o))throw new TypeError;return o}return function(e,t){if("string"===t){var n=e.toString;if(O(n))if(!D(r=n.call(e)))return r;if(O(i=e.valueOf))if(!D(r=i.call(e)))return r}else{var i;if(O(i=e.valueOf))if(!D(r=i.call(e)))return r;var r,o=e.toString;if(O(o))if(!D(r=o.call(e)))return r}throw new TypeError}(e,"default"===n?"number":n)}function E(e){var t=T(e,3);return"symbol"==typeof t?t:function(e){return""+e}(t)}function A(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function O(e){return"function"==typeof e}function I(e){return"function"==typeof e}function C(e,t){var n=e[t];if(null!=n){if(!O(n))throw new TypeError;return n}}function B(e){var t=e.next();return!t.done&&t}function k(e){var t=e.return;t&&t.call(e)}function N(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===l)return t;if(t!==l)return t;var n=e.prototype,i=n&&Object.getPrototypeOf(n);if(null==i||i===Object.prototype)return t;var r=i.constructor;return"function"!=typeof r||r===e?t:r}function P(e){return e.__=void 0,delete e.__,e}t("decorate",(function(e,t,n,i){if(S(n)){if(!A(e))throw new TypeError;if(!I(t))throw new TypeError;return function(e,t){for(var n=e.length-1;n>=0;--n){var i=(0,e[n])(t);if(!S(i)&&!w(i)){if(!I(i))throw new TypeError;t=i}}return t}(e,t)}if(!A(e))throw new TypeError;if(!D(t))throw new TypeError;if(!D(i)&&!S(i)&&!w(i))throw new TypeError;return w(i)&&(i=void 0),function(e,t,n,i){for(var r=e.length-1;r>=0;--r){var o=(0,e[r])(t,n,i);if(!S(o)&&!w(o)){if(!D(o))throw new TypeError;i=o}}return i}(e,t,n=E(n),i)})),t("metadata",(function(e,t){return function(n,i){if(!D(n))throw new TypeError;if(!S(i)&&!function(e){switch(b(e)){case 3:case 4:return!0;default:return!1}}(i))throw new TypeError;m(e,t,n,i)}})),t("defineMetadata",(function(e,t,n,i){if(!D(n))throw new TypeError;return S(i)||(i=E(i)),m(e,t,n,i)})),t("hasMetadata",(function(e,t,n){if(!D(t))throw new TypeError;return S(n)||(n=E(n)),function e(t,n,i){if(v(t,n,i))return!0;var r=N(n);return!w(r)&&e(t,r,i)}(e,t,n)})),t("hasOwnMetadata",(function(e,t,n){if(!D(t))throw new TypeError;return S(n)||(n=E(n)),v(e,t,n)})),t("getMetadata",(function(e,t,n){if(!D(t))throw new TypeError;return S(n)||(n=E(n)),function e(t,n,i){if(v(t,n,i))return y(t,n,i);var r=N(n);return w(r)?void 0:e(t,r,i)}(e,t,n)})),t("getOwnMetadata",(function(e,t,n){if(!D(t))throw new TypeError;return S(n)||(n=E(n)),y(e,t,n)})),t("getMetadataKeys",(function(e,t){if(!D(e))throw new TypeError;return S(t)||(t=E(t)),function e(t,n){var i=_(t,n),r=N(t);if(null===r)return i;var o=e(r,n);if(o.length<=0)return i;if(i.length<=0)return o;for(var s=new f,a=[],c=0,u=i;c<u.length;c++){var l=u[c];s.has(l)||(s.add(l),a.push(l))}for(var d=0,h=o;d<h.length;d++){l=h[d];s.has(l)||(s.add(l),a.push(l))}return a}(e,t)})),t("getOwnMetadataKeys",(function(e,t){if(!D(e))throw new TypeError;return S(t)||(t=E(t)),_(e,t)})),t("deleteMetadata",(function(e,t,n){if(!D(t))throw new TypeError;S(n)||(n=E(n));var i=g(t,n,!1);if(S(i))return!1;if(!i.delete(e))return!1;if(i.size>0)return!0;var r=p.get(t);return r.delete(n),r.size>0||p.delete(t),!0}))}(o)}()}(n||(n={}))}).call(this,n(48),n(21))},function(e,t,n){"use strict";n.r(t),function(e){var i=n(25),r=n.n(i),o=n(55),s=n.n(o),a=n(32),c=n.n(a),u=n(33),l=n.n(u),d=n(31),h=n.n(d),f=n(3);"function"!=typeof Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}),"function"!=typeof Object.defineProperties&&(Object.defineProperties=function(e,t){function n(e){function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function n(e){return"function"==typeof e}if("object"!==r()(e)||null===e)throw new TypeError("bad desc");var i={};if(t(e,"enumerable")&&(i.enumerable=!!e.enumerable),t(e,"configurable")&&(i.configurable=!!e.configurable),t(e,"value")&&(i.value=e.value),t(e,"writable")&&(i.writable=!!e.writable),t(e,"get")){var o=e.get;if(!n(o)&&void 0!==o)throw new TypeError("bad get");i.get=o}if(t(e,"set")){var s=e.set;if(!n(s)&&void 0!==s)throw new TypeError("bad set");i.set=s}if(("get"in i||"set"in i)&&("value"in i||"writable"in i))throw new TypeError("identity-confused descriptor");return i}if("object"!==r()(e)||null===e)throw new TypeError("bad obj");t=Object(t);for(var i=Object.keys(t),o=[],s=0;s<i.length;s++)o.push([i[s],n(t[i[s]])]);for(var a=0;a<o.length;a++)Object.defineProperty(e,o[a][0],o[a][1]);return e});var p={WEAPP:"WEAPP",WEB:"WEB",RN:"RN",SWAN:"SWAN",ALIPAY:"ALIPAY",TT:"TT",QQ:"QQ",JD:"JD"},g=null;var v=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;c()(this,e),this.index=i,this.requestParams=t,this.interceptors=n}return l()(e,[{key:"proceed",value:function(e){if(this.requestParams=e,this.index>=this.interceptors.length)throw new Error("chain 参数错误, 请勿直接修改 request.chain");var t=this._getNextInterceptor()(this._getNextChain()),n=t.catch((function(e){return Promise.reject(e)}));return"function"==typeof t.abort&&(n.abort=t.abort),n}},{key:"_getNextInterceptor",value:function(){return this.interceptors[this.index]}},{key:"_getNextChain",value:function(){return new e(this.requestParams,this.interceptors,this.index+1)}}]),e}();function y(e){return function(t){var n=t.designWidth,i=void 0===n?750:n,r=t.deviceRatio,o=void 0===r?{640:1.17,750:1,828:.905}:r;e.config=e.config||{},e.config.designWidth=i,e.config.deviceRatio=o}}var m,_,b={Behavior:function(e){return e},getEnv:function(){return g||("undefined"!=typeof jd&&jd.getSystemInfo?(g=p.JD,p.JD):"undefined"!=typeof qq&&qq.getSystemInfo?(g=p.QQ,p.QQ):"undefined"!=typeof tt&&tt.getSystemInfo?(g=p.TT,p.TT):"undefined"!=typeof wx&&wx.getSystemInfo?(g=p.WEAPP,p.WEAPP):"undefined"!=typeof swan&&swan.getSystemInfo?(g=p.SWAN,p.SWAN):"undefined"!=typeof my&&my.getSystemInfo?(g=p.ALIPAY,p.ALIPAY):void 0!==e&&e.__fbGenNativeModule?(g=p.RN,p.RN):"undefined"!=typeof window?(g=p.WEB,p.WEB):"Unknown environment")},ENV_TYPE:p,Link:function(){function e(t){c()(this,e),this.taroInterceptor=t,this.chain=new v}return l()(e,[{key:"request",value:function(e){var t=this;return this.chain.interceptors=this.chain.interceptors.filter((function(e){return e!==t.taroInterceptor})),this.chain.interceptors.push(this.taroInterceptor),this.chain.proceed(s()({},e))}},{key:"addInterceptor",value:function(e){this.chain.interceptors.push(e)}},{key:"cleanInterceptors",value:function(){this.chain=new v}}]),e}(),interceptors:Object.freeze({__proto__:null,timeoutInterceptor:function(e){var t,n=e.requestParams,i=new Promise((function(i,r){var o=setTimeout((function(){o=null,r(new Error("网络链接超时,请稍后再试!"))}),n&&n.timeout||6e4);(t=e.proceed(n)).then((function(e){o&&(clearTimeout(o),i(e))})).catch((function(e){o&&clearTimeout(o),r(e)}))}));return void 0!==t&&"function"==typeof t.abort&&(i.abort=t.abort),i},logInterceptor:function(e){var t=e.requestParams,n=t.method,i=t.data,r=t.url;console.log("http ".concat(n||"GET"," --\x3e ").concat(r," data: "),i);var o=e.proceed(t),s=o.then((function(e){return console.log("http <-- ".concat(r," result:"),e),e}));return"function"==typeof o.abort&&(s.abort=o.abort),s}}),Current:f.Current,getCurrentInstance:f.getCurrentInstance,options:f.options,nextTick:f.nextTick,eventCenter:f.eventCenter,Events:f.Events,useDidShow:f.useDidShow,useDidHide:f.useDidHide,usePullDownRefresh:f.usePullDownRefresh,useReachBottom:f.useReachBottom,usePageScroll:f.usePageScroll,useResize:f.useResize,useShareAppMessage:f.useShareAppMessage,useTabItemTap:f.useTabItemTap,useTitleClick:f.useTitleClick,useOptionMenuClick:f.useOptionMenuClick,usePullIntercept:f.usePullIntercept,useShareTimeline:f.useShareTimeline,useAddToFavorites:f.useAddToFavorites,useReady:f.useReady,useRouter:f.useRouter,getInitPxTransform:y};b.initPxTransform=y(b),b.preload=(m=f.Current,function(e,t){"object"===r()(e)?m.preloadData=e:void 0!==e&&void 0!==t&&(m.preloadData=h()({},e,t))}),b.pxTransform=(_=b,function(e){var t=_.config||{},n=t.designWidth,i=void 0===n?750:n,r=t.deviceRatio,o=void 0===r?{640:1.17,750:1,828:.905}:r;if(!(i in o))throw new Error("deviceRatio 配置中不存在 ".concat(i," 的设置!"));return parseInt(e,10)*o[i]+"rpx"}),t.default=b}.call(this,n(21))},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(24);t.AnonymousLogin=function({uid:e}){return i(this,void 0,void 0,(function*(){return r.default("/app/users",{data:{phone_id:e},method:"POST"},!1)}))}},function(e,t,n){"use strict";var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(8),o=n(41),s=n(121),a=n(42),c=n(14),u=n(9),l=n(23),d=n(18),h=n(44);class f extends h.default{constructor({pks:e}){super(),this.connectedList=[],this.pks=[],this.scanList=[],this.deviceUDPPort=12414,this.appUDPPort=2415,this.offlineThreshold=2e4,this.isActive=!0,this.listenDevOfflineTimer=null,this.init=()=>{this.UDPSocket=wx.createUDPSocket(),this.UDPSocket.bind(),this.UDPSocket.onMessage(this.onMessage),this.UDPSocket.onError(this.onError),r.default.info("Start UDP Discover"),this.startDiscover(),this.listenDevOffline(this.offlineThreshold),wx.onAppShow(this.onAppShow),wx.onAppHide(this.onAppHide)},this.onAppShow=()=>{this.isActive=!0,this.scanList.map(e=>{e.ctime=Date.now()})},this.onAppHide=()=>{this.isActive=!1},this.listenDevOffline=e=>{this.listenDevOfflineTimer=setInterval(()=>{if(!this.isActive)return;const t=(new Date).getTime(),n=this.scanList.filter(n=>t-n.ctime<e);n.length!==this.scanList.length&&(r.default.debug("remove lan device"),this.scanList=n,this.notifyDevices())},500)},this.notifyDevices=()=>{this.listenerMap.GizLanDeviceList&&this.listenerMap.GizLanDeviceList.map(e=>{e(this.scanList)})},this.isSameDevice=(e,t)=>e.mac===t.mac&&e.productKey===t.productKey,this.disConnectDevice=e=>{const t=this.connectedList.findIndex(t=>t.productKey===e.productKey&&t.mac===e.mac);try{return-1!==t&&(this.connectedList[t].socketHandle.destory(),this.connectedList.splice(t,1)),{success:!0}}catch(e){return{success:!1,err:e}}},this.connectDevice=e=>i(this,void 0,void 0,(function*(){const t=this.scanList.find(t=>this.isSameDevice(e,t));if(!t)return{success:!1};if(this.connectedList.find(t=>this.isSameDevice(e,t)))return{success:!0};{const e=new p({ip:t.ip,mac:t.mac,productKey:t.productKey,onClose:this.onDeviceClose}),n=yield e.connect();return n.success?this.connectedList.push({mac:t.mac,productKey:t.productKey,socketHandle:e}):e.destory(),n}})),this.onError=e=>{r.default.warn("Discover Error",e)},this.isMatchPk=e=>0===this.pks.length||this.pks.includes(e),this.onMessage=e=>{const t=d.ab2numbers(e.message),n=new s.default(t);""!==n.mac&&this.isMatchPk(n.productKey)&&this.updateDevice(n,e.remoteInfo.address)},this.onDeviceClose=({productKey:e,mac:t})=>{const n=this.connectedList.findIndex(n=>n.productKey===e&&n.mac===t);-1!==n&&this.connectedList.splice(n,1)},this.write=(e,t)=>i(this,void 0,void 0,(function*(){r.default.debug("send data to device",e,t,this.connectedList);const n=this.connectedList.findIndex(t=>this.isSameDevice(t,e));if(-1!==n){return this.connectedList[n].socketHandle.write(t)}return{success:!1,message:"device not sub"}})),this.updateDevice=(e,t)=>{const n=this.scanList.find(t=>t.mac===e.mac);if(n)n.ctime=Date.now();else{const n={mac:e.mac,ip:t,productKey:e.productKey,did:e.did,expandData:e,name:"",isBind:!1,connectType:"NONE",isOnline:!1,isLanOnline:!0,isBleOnline:!1,ctime:Date.now()};this.scanList.push(n),this.notifyDevices()}},this.sendBoradCast=()=>{this.UDPSocket&&(this.UDPSocket.send({address:"255.255.255.255",message:s.default.pack(),port:this.deviceUDPPort}),r.default.debug("Send UDP Discover"))},this.startDiscover=()=>{this.sendBoradCast(),this.boradcastTimer=setInterval(()=>{this.sendBoradCast()},5e3)},this.destory=()=>{this.boradcastTimer&&clearInterval(this.boradcastTimer),this.UDPSocket&&this.UDPSocket.close(),this.listenDevOfflineTimer&&clearInterval(this.listenDevOfflineTimer),wx.offAppShow(this.onAppShow),wx.offAppHide(this.onAppHide)},this.pks=e}}t.LanHandle=f;class p{constructor({ip:e,onClose:t,mac:n,productKey:s}){this.deviceTCPPort=12416,this.ip="",this.productKey="",this.mac="",this.tcpHandler=null,this.onCloseListener=({mac:e,productKey:t})=>{},this.connect=()=>i(this,void 0,void 0,(function*(){return new Promise(e=>i(this,void 0,void 0,(function*(){const t=()=>{const e=o.default.pack();this.tcpHandler.write(u.arrayToUint8(e)),r.default.debug("connect success try login")},n=t=>{e({success:!0,err:t})},i=t=>{switch(new c.default(d.ab2numbers(t.message)).cmd){case"0007":{const e=new o.default(d.ab2numbers(t.message)),n=a.default.pack({passcode:e.passcode});this.tcpHandler.write(u.arrayToUint8(n));break}case"0009":new a.default(d.ab2numbers(t.message)).result?(e({success:!0}),this.initListener()):e({success:!1})}};try{this.tcpHandler=wx.createTCPSocket(),this.tcpHandler.onConnect(t),this.tcpHandler.onError(n),this.tcpHandler.onMessage(i),this.tcpHandler.connect({address:this.ip,port:this.deviceTCPPort,timeout:2}),yield l.default(4e3),e({success:!1,err:null})}catch(t){r.default.error("connect lan error",t),e({success:!1,err:null})}finally{this.tcpHandler.offConnect(t),this.tcpHandler.offError(n),this.tcpHandler.offMessage(i)}})))})),this.write=e=>(this.tcpHandler.write(e),{success:!0}),this.onMessage=e=>{const t=new c.default(d.ab2numbers(e.message));r.default.debug("on tcp message",t)},this.onError=()=>{},this.onClose=()=>{this.onCloseListener({productKey:this.productKey,mac:this.mac})},this.initListener=()=>{this.tcpHandler.onError(this.onError),this.tcpHandler.onMessage(this.onMessage),this.tcpHandler.onClose(this.onClose)},this.destory=()=>{this.tcpHandler&&this.tcpHandler.close(),this.tcpHandler.offError(this.onError),this.tcpHandler.offMessage(this.onMessage),this.tcpHandler.offClose(this.onClose)},this.ip=e,this.mac=n,this.productKey=s,this.onCloseListener=t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(8),r=n(14),o=n(9);class s extends r.default{constructor(e){super(e),this.did="",this.mac="",this.productKey="",this.deviceType=0,this.apiUrl="",this.protocolVersion="",this.mcuVersion="",this.moduleVersion="",this.parseEndChat=(e,t)=>{let n="";const i=this.content.slice(e,this.content.length);for(let t in i){const r=i[t];if(e+=1,0===r)break;n+=String.fromCharCode(r)}return this[t]=n,e},this.baseParse=(e,t,n="ASCII")=>{const i=parseInt(o.arrayToString(this.content.slice(e,e+2)),16);e+=2;let r="";return this.content.slice(e,e+i).map(e=>{if("ASCII"===n)r+=String.fromCharCode(e);else{const t=e.toString(16);r+=o.fillString(t,2)}}),this[t]=r,e+i};let t=0;try{t=this.baseParse(t,"did"),t=this.baseParse(t,"mac","HEX"),t=this.baseParse(t,"moduleVersion"),t=this.baseParse(t,"productKey"),t+=8,t=this.parseEndChat(t,"apiUrl"),t=this.parseEndChat(t,"protocolVersion"),this.mcuVersion="",this.content.slice(t,this.content.length).map(e=>{this.mcuVersion+=String.fromCharCode(e)})}catch(e){i.default.warn("Parse DiscoverUDP error",e)}}}s.pack=()=>{const e=[0,0,0,3,3,0,0,3],t=new ArrayBuffer(e.length),n=new Uint8Array(t);for(let i=0;i<t.byteLength;i++)n[i]=e[i];return n},t.default=s}]);