hhdlinkble 1.0.2 → 1.0.4

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.
@@ -1,15 +1 @@
1
- var hhdlinkble=function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function e(t,e,r,n,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void r(t)}s.done?e(c):Promise.resolve(c).then(n,i)}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function n(t,e,r){return(e=c(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function o(){o=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var a=e&&e.prototype instanceof y?e:y,o=Object.create(a.prototype),s=new H(n||[]);return i(o,"_invoke",{value:C(t,r,s)}),o}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var g="suspendedStart",p="suspendedYield",d="executing",v="completed",x={};function y(){}function U(){}function m(){}var w={};u(w,s,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(L([])));b&&b!==r&&n.call(b,s)&&(w=b);var A=m.prototype=y.prototype=Object.create(w);function S(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function B(t,e){function r(i,a,o,s){var c=h(t[i],t,a);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){r("next",t,o,s)}),(function(t){r("throw",t,o,s)})):e.resolve(u).then((function(t){l.value=t,o(l)}),(function(t){return r("throw",t,o,s)}))}s(c.arg)}var a;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return a=a?a.then(i,i):i()}})}function C(e,r,n){var i=g;return function(a,o){if(i===d)throw Error("Generator is already running");if(i===v){if("throw"===a)throw o;return{value:t,done:!0}}for(n.method=a,n.arg=o;;){var s=n.delegate;if(s){var c=k(s,n);if(c){if(c===x)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===g)throw i=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=d;var l=h(e,r,n);if("normal"===l.type){if(i=n.done?v:p,l.arg===x)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=v,n.method="throw",n.arg=l.arg)}}}function k(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,k(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),x;var a=h(i,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,x;var o=a.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,x):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,x)}function T(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function H(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function L(e){if(e||""===e){var r=e[s];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return U.prototype=m,i(A,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:U,configurable:!0}),U.displayName=u(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===U||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,l,"GeneratorFunction")),t.prototype=Object.create(A),t},e.awrap=function(t){return{__await:t}},S(B.prototype),u(B.prototype,c,(function(){return this})),e.AsyncIterator=B,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var o=new B(f(t,r,n,i),a);return e.isGeneratorFunction(r)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},S(A),u(A,l,"Generator"),u(A,s,(function(){return this})),u(A,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=L,H.prototype={constructor:H,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,x):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),x},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),x}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;I(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:L(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),x}},e}function s(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var l,u,f,h,g,p,d,v,x,y,U,m={exports:{}};function w(t){var e=t.getFullYear(),r=t.getMonth()+1,n=t.getDate(),i=t.getHours(),a=t.getMinutes(),o=t.getSeconds();return[e,r,n].map(_).join("/")+" "+[i,a,o].map(_).join(":")}function _(t){return(t=t.toString())[1]?t:"0"+t}function b(t){return Array.prototype.map.call(new Uint8Array(t),(function(t){return("00"+t.toString(16)).slice(-2)})).join("")}function A(t){return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(t){return parseInt(t,16)})))}function S(t,e){for(var r=65535,n=0;n<e;++n)for(var i=0;i<8;i++){var a=0,o=0;1==(t[n]>>7-i&1)&&(o=1),1==(r>>15&1)&&(a=1),r<<=1,1==(a^o)&&(r^=4129)}return r}function B(t,e){t=A(t);var r=m.exports;e=b(e);for(var n=r.enc.Hex.parse(e),i=r.enc.Hex.parse(""),a=new Uint8Array([]),o=0;o<t.length;o+=16){var c=t.slice(o,o+16),l=r.enc.Hex.parse(b(c)),u=r.AES.encrypt(l,n,{iv:i,mode:r.mode.CBC,padding:r.pad.ZeroPadding});a=new Uint8Array([].concat(s(a),s(A(r.enc.Hex.stringify(u.ciphertext)))))}return a}m.exports=(U=U||function(t,e){var r=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),n={},i=n.lib={},a=i.Base={extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},o=i.WordArray=a.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;e[n+a>>>2]|=o<<24-(n+a)%4*8}else for(a=0;a<i;a+=4)e[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r,n=[],i=function(e){var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n;return i/=4294967296,(i+=.5)*(t.random()>.5?1:-1)}},a=0;a<e;a+=4){var s=i(4294967296*(r||t.random()));r=987654071*s(),n.push(4294967296*s()|0)}return new o.init(n,e)}}),s=n.enc={},c=s.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var a=e[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new o.init(r,e/2)}},l=s.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var a=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new o.init(r,e)}},u=s.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},f=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=u.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),c=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*a,l=t.min(4*c,i);if(c){for(var u=0;u<c;u+=a)this._doProcessBlock(n,u);var f=n.splice(0,c);r.sigBytes-=l}return new o.init(f,l)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});i.Hasher=f.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new h.HMAC.init(t,r).finalize(e)}}});var h=n.algo={};return n}(Math),function(){var t=U,e=t.lib.WordArray;function r(t,r,n){for(var i=[],a=0,o=0;o<r;o++)if(o%4){var s=n[t.charCodeAt(o-1)]<<o%4*2,c=n[t.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=(s|c)<<24-a%4*8,a++}return e.create(i,a)}t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],a=0;a<r;a+=3)for(var o=(e[a>>>2]>>>24-a%4*8&255)<<16|(e[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|e[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(t){var e=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<n.length;a++)i[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var s=t.indexOf(o);-1!==s&&(e=s)}return r(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){var e=U,r=e.lib,n=r.WordArray,i=r.Hasher,a=e.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var s=a.MD5=i.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,s=t[e+0],h=t[e+1],g=t[e+2],p=t[e+3],d=t[e+4],v=t[e+5],x=t[e+6],y=t[e+7],U=t[e+8],m=t[e+9],w=t[e+10],_=t[e+11],b=t[e+12],A=t[e+13],S=t[e+14],B=t[e+15],C=a[0],k=a[1],T=a[2],I=a[3];C=c(C,k,T,I,s,7,o[0]),I=c(I,C,k,T,h,12,o[1]),T=c(T,I,C,k,g,17,o[2]),k=c(k,T,I,C,p,22,o[3]),C=c(C,k,T,I,d,7,o[4]),I=c(I,C,k,T,v,12,o[5]),T=c(T,I,C,k,x,17,o[6]),k=c(k,T,I,C,y,22,o[7]),C=c(C,k,T,I,U,7,o[8]),I=c(I,C,k,T,m,12,o[9]),T=c(T,I,C,k,w,17,o[10]),k=c(k,T,I,C,_,22,o[11]),C=c(C,k,T,I,b,7,o[12]),I=c(I,C,k,T,A,12,o[13]),T=c(T,I,C,k,S,17,o[14]),C=l(C,k=c(k,T,I,C,B,22,o[15]),T,I,h,5,o[16]),I=l(I,C,k,T,x,9,o[17]),T=l(T,I,C,k,_,14,o[18]),k=l(k,T,I,C,s,20,o[19]),C=l(C,k,T,I,v,5,o[20]),I=l(I,C,k,T,w,9,o[21]),T=l(T,I,C,k,B,14,o[22]),k=l(k,T,I,C,d,20,o[23]),C=l(C,k,T,I,m,5,o[24]),I=l(I,C,k,T,S,9,o[25]),T=l(T,I,C,k,p,14,o[26]),k=l(k,T,I,C,U,20,o[27]),C=l(C,k,T,I,A,5,o[28]),I=l(I,C,k,T,g,9,o[29]),T=l(T,I,C,k,y,14,o[30]),C=u(C,k=l(k,T,I,C,b,20,o[31]),T,I,v,4,o[32]),I=u(I,C,k,T,U,11,o[33]),T=u(T,I,C,k,_,16,o[34]),k=u(k,T,I,C,S,23,o[35]),C=u(C,k,T,I,h,4,o[36]),I=u(I,C,k,T,d,11,o[37]),T=u(T,I,C,k,y,16,o[38]),k=u(k,T,I,C,w,23,o[39]),C=u(C,k,T,I,A,4,o[40]),I=u(I,C,k,T,s,11,o[41]),T=u(T,I,C,k,p,16,o[42]),k=u(k,T,I,C,x,23,o[43]),C=u(C,k,T,I,m,4,o[44]),I=u(I,C,k,T,b,11,o[45]),T=u(T,I,C,k,B,16,o[46]),C=f(C,k=u(k,T,I,C,g,23,o[47]),T,I,s,6,o[48]),I=f(I,C,k,T,y,10,o[49]),T=f(T,I,C,k,S,15,o[50]),k=f(k,T,I,C,v,21,o[51]),C=f(C,k,T,I,b,6,o[52]),I=f(I,C,k,T,p,10,o[53]),T=f(T,I,C,k,w,15,o[54]),k=f(k,T,I,C,h,21,o[55]),C=f(C,k,T,I,U,6,o[56]),I=f(I,C,k,T,B,10,o[57]),T=f(T,I,C,k,x,15,o[58]),k=f(k,T,I,C,A,21,o[59]),C=f(C,k,T,I,d,6,o[60]),I=f(I,C,k,T,_,10,o[61]),T=f(T,I,C,k,g,15,o[62]),k=f(k,T,I,C,m,21,o[63]),a[0]=a[0]+C|0,a[1]=a[1]+k|0,a[2]=a[2]+T|0,a[3]=a[3]+I|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var a=t.floor(n/4294967296),o=n;r[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),e.sigBytes=4*(r.length+1),this._process();for(var s=this._hash,c=s.words,l=0;l<4;l++){var u=c[l];c[l]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}return s},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,r,n,i,a,o){var s=t+(e&r|~e&n)+i+o;return(s<<a|s>>>32-a)+e}function l(t,e,r,n,i,a,o){var s=t+(e&n|r&~n)+i+o;return(s<<a|s>>>32-a)+e}function u(t,e,r,n,i,a,o){var s=t+(e^r^n)+i+o;return(s<<a|s>>>32-a)+e}function f(t,e,r,n,i,a,o){var s=t+(r^(e|~n))+i+o;return(s<<a|s>>>32-a)+e}e.MD5=i._createHelper(s),e.HmacMD5=i._createHmacHelper(s)}(Math),g=(h=U).lib,p=g.WordArray,d=g.Hasher,v=h.algo,x=[],y=v.SHA1=d.extend({_doReset:function(){this._hash=new p.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],c=0;c<80;c++){if(c<16)x[c]=0|t[e+c];else{var l=x[c-3]^x[c-8]^x[c-14]^x[c-16];x[c]=l<<1|l>>>31}var u=(n<<5|n>>>27)+s+x[c];u+=c<20?1518500249+(i&a|~i&o):c<40?1859775393+(i^a^o):c<60?(i&a|i&o|a&o)-1894007588:(i^a^o)-899497514,s=o,o=a,a=i<<30|i>>>2,i=n,n=u}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+s|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=d.clone.call(this);return t._hash=this._hash.clone(),t}}),h.SHA1=d._createHelper(y),h.HmacSHA1=d._createHmacHelper(y),function(t){var e=U,r=e.lib,n=r.WordArray,i=r.Hasher,a=e.algo,o=[],s=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(o[i]=r(t.pow(n,.5))),s[i]=r(t.pow(n,1/3)),i++),n++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6],h=r[7],g=0;g<64;g++){if(g<16)c[g]=0|t[e+g];else{var p=c[g-15],d=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,v=c[g-2],x=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;c[g]=d+c[g-7]+x+c[g-16]}var y=n&i^n&a^i&a,U=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),m=h+((l<<26|l>>>6)^(l<<21|l>>>11)^(l<<7|l>>>25))+(l&u^~l&f)+s[g]+c[g];h=f,f=u,u=l,l=o+m|0,o=a,a=i,i=n,n=m+(U+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+l|0,r[5]=r[5]+u|0,r[6]=r[6]+f|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(l),e.HmacSHA256=i._createHmacHelper(l)}(Math),function(){var t=U,e=t.lib.WordArray,r=t.enc;function n(t){return t<<8&4278255360|t>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i+=2){var a=e[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var r=t.length,n=[],i=0;i<r;i++)n[i>>>1]|=t.charCodeAt(i)<<16-i%2*16;return e.create(n,2*r)}},r.Utf16LE={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],a=0;a<r;a+=2){var o=n(e[a>>>2]>>>16-a%4*8&65535);i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var r=t.length,i=[],a=0;a<r;a++)i[a>>>1]|=n(t.charCodeAt(a)<<16-a%2*16);return e.create(i,2*r)}}}(),function(){if("function"==typeof ArrayBuffer){var t=U.lib.WordArray,e=t.init,r=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var r=t.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=t[i]<<24-i%4*8;e.call(this,n,r)}else e.apply(this,arguments)};r.prototype=t}}(),
2
- /** @preserve
3
- (c) 2012 by C茅dric Mesnil. All rights reserved.
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
- - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
- - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
7
- 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.
8
- */
9
- function(){var t=U,e=t.lib,r=e.WordArray,n=e.Hasher,i=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]),o=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]),s=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]),c=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]),l=r.create([0,1518500249,1859775393,2400959708,2840853838]),u=r.create([1352829926,1548603684,1836072691,2053994217,0]),f=i.RIPEMD160=n.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var f,y,U,m,w,_,b,A,S,B,C,k=this._hash.words,T=l.words,I=u.words,H=a.words,L=o.words,D=s.words,R=c.words;for(_=f=k[0],b=y=k[1],A=U=k[2],S=m=k[3],B=w=k[4],r=0;r<80;r+=1)C=f+t[e+H[r]]|0,C+=r<16?h(y,U,m)+T[0]:r<32?g(y,U,m)+T[1]:r<48?p(y,U,m)+T[2]:r<64?d(y,U,m)+T[3]:v(y,U,m)+T[4],C=(C=x(C|=0,D[r]))+w|0,f=w,w=m,m=x(U,10),U=y,y=C,C=_+t[e+L[r]]|0,C+=r<16?v(b,A,S)+I[0]:r<32?d(b,A,S)+I[1]:r<48?p(b,A,S)+I[2]:r<64?g(b,A,S)+I[3]:h(b,A,S)+I[4],C=(C=x(C|=0,R[r]))+B|0,_=B,B=S,S=x(A,10),A=b,b=C;C=k[1]+U+S|0,k[1]=k[2]+m+B|0,k[2]=k[3]+w+_|0,k[3]=k[4]+f+b|0,k[4]=k[0]+y+A|0,k[0]=C},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,a=i.words,o=0;o<5;o++){var s=a[o];a[o]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return i},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});function h(t,e,r){return t^e^r}function g(t,e,r){return t&e|~t&r}function p(t,e,r){return(t|~e)^r}function d(t,e,r){return t&r|e&~r}function v(t,e,r){return t^(e|~r)}function x(t,e){return t<<e|t>>>32-e}t.RIPEMD160=n._createHelper(f),t.HmacRIPEMD160=n._createHmacHelper(f)}(),function(){var t=U,e=t.lib.Base,r=t.enc.Utf8;t.algo.HMAC=e.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=r.parse(e));var n=t.blockSize,i=4*n;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var a=this._oKey=e.clone(),o=this._iKey=e.clone(),s=a.words,c=o.words,l=0;l<n;l++)s[l]^=1549556828,c[l]^=909522486;a.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})}(),function(){var t=U,e=t.lib,r=e.Base,n=e.WordArray,i=t.algo,a=i.SHA1,o=i.HMAC,s=i.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r=this.cfg,i=o.create(r.hasher,t),a=n.create(),s=n.create([1]),c=a.words,l=s.words,u=r.keySize,f=r.iterations;c.length<u;){var h=i.update(e).finalize(s);i.reset();for(var g=h.words,p=g.length,d=h,v=1;v<f;v++){d=i.finalize(d),i.reset();for(var x=d.words,y=0;y<p;y++)g[y]^=x[y]}a.concat(h),l[0]++}return a.sigBytes=4*u,a}});t.PBKDF2=function(t,e,r){return s.create(r).compute(t,e)}}(),function(){var t=U,e=t.lib,r=e.Base,n=e.WordArray,i=t.algo,a=i.MD5,o=i.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r=this.cfg,i=r.hasher.create(),a=n.create(),o=a.words,s=r.keySize,c=r.iterations;o.length<s;){l&&i.update(l);var l=i.update(t).finalize(e);i.reset();for(var u=1;u<c;u++)l=i.finalize(l),i.reset();a.concat(l)}return a.sigBytes=4*s,a}});t.EvpKDF=function(t,e,r){return o.create(r).compute(t,e)}}(),function(){var t=U,e=t.lib.WordArray,r=t.algo,n=r.SHA256,i=r.SHA224=n.extend({_doReset:function(){this._hash=new e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=4,t}});t.SHA224=n._createHelper(i),t.HmacSHA224=n._createHmacHelper(i)}(),function(t){var e=U,r=e.lib,n=r.Base,i=r.WordArray,a=e.x64={};a.Word=n.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=n.extend({init:function(e,r){e=this.words=e||[],this.sigBytes=r!=t?r:8*e.length},toX32:function(){for(var t=this.words,e=t.length,r=[],n=0;n<e;n++){var a=t[n];r.push(a.high),r.push(a.low)}return i.create(r,this.sigBytes)},clone:function(){for(var t=n.clone.call(this),e=t.words=this.words.slice(0),r=e.length,i=0;i<r;i++)e[i]=e[i].clone();return t}})}(),function(t){var e=U,r=e.lib,n=r.WordArray,i=r.Hasher,a=e.x64.Word,o=e.algo,s=[],c=[],l=[];!function(){for(var t=1,e=0,r=0;r<24;r++){s[t+5*e]=(r+1)*(r+2)/2%64;var n=(2*t+3*e)%5;t=e%5,e=n}for(t=0;t<5;t++)for(e=0;e<5;e++)c[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,o=0;o<24;o++){for(var u=0,f=0,h=0;h<7;h++){if(1&i){var g=(1<<h)-1;g<32?f^=1<<g:u^=1<<g-32}128&i?i=i<<1^113:i<<=1}l[o]=a.create(u,f)}}();var u=[];!function(){for(var t=0;t<25;t++)u[t]=a.create()}();var f=o.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var a=t[e+2*i],o=t[e+2*i+1];a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(k=r[i]).high^=o,k.low^=a}for(var f=0;f<24;f++){for(var h=0;h<5;h++){for(var g=0,p=0,d=0;d<5;d++)g^=(k=r[h+5*d]).high,p^=k.low;var v=u[h];v.high=g,v.low=p}for(h=0;h<5;h++){var x=u[(h+4)%5],y=u[(h+1)%5],U=y.high,m=y.low;for(g=x.high^(U<<1|m>>>31),p=x.low^(m<<1|U>>>31),d=0;d<5;d++)(k=r[h+5*d]).high^=g,k.low^=p}for(var w=1;w<25;w++){var _=(k=r[w]).high,b=k.low,A=s[w];A<32?(g=_<<A|b>>>32-A,p=b<<A|_>>>32-A):(g=b<<A-32|_>>>64-A,p=_<<A-32|b>>>64-A);var S=u[c[w]];S.high=g,S.low=p}var B=u[0],C=r[0];for(B.high=C.high,B.low=C.low,h=0;h<5;h++)for(d=0;d<5;d++){var k=r[w=h+5*d],T=u[w],I=u[(h+1)%5+5*d],H=u[(h+2)%5+5*d];k.high=T.high^~I.high&H.high,k.low=T.low^~I.low&H.low}k=r[0];var L=l[f];k.high^=L.high,k.low^=L.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes;var i=8*e.sigBytes,a=32*this.blockSize;r[i>>>5]|=1<<24-i%32,r[(t.ceil((i+1)/a)*a>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var o=this._state,s=this.cfg.outputLength/8,c=s/8,l=[],u=0;u<c;u++){var f=o[u],h=f.high,g=f.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),g=16711935&(g<<8|g>>>24)|4278255360&(g<<24|g>>>8),l.push(g),l.push(h)}return new n.init(l,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),r=0;r<25;r++)e[r]=e[r].clone();return t}});e.SHA3=i._createHelper(f),e.HmacSHA3=i._createHmacHelper(f)}(Math),function(){var t=U,e=t.lib.Hasher,r=t.x64,n=r.Word,i=r.WordArray,a=t.algo;function o(){return n.create.apply(n,arguments)}var s=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],c=[];!function(){for(var t=0;t<80;t++)c[t]=o()}();var l=a.SHA512=e.extend({_doReset:function(){this._hash=new i.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(t,e){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6],h=r[7],g=n.high,p=n.low,d=i.high,v=i.low,x=a.high,y=a.low,U=o.high,m=o.low,w=l.high,_=l.low,b=u.high,A=u.low,S=f.high,B=f.low,C=h.high,k=h.low,T=g,I=p,H=d,L=v,D=x,R=y,E=U,P=m,M=w,O=_,N=b,z=A,F=S,j=B,V=C,G=k,W=0;W<80;W++){var X=c[W];if(W<16)var K=X.high=0|t[e+2*W],J=X.low=0|t[e+2*W+1];else{var Q=c[W-15],Z=Q.high,Y=Q.low,$=(Z>>>1|Y<<31)^(Z>>>8|Y<<24)^Z>>>7,q=(Y>>>1|Z<<31)^(Y>>>8|Z<<24)^(Y>>>7|Z<<25),tt=c[W-2],et=tt.high,rt=tt.low,nt=(et>>>19|rt<<13)^(et<<3|rt>>>29)^et>>>6,it=(rt>>>19|et<<13)^(rt<<3|et>>>29)^(rt>>>6|et<<26),at=c[W-7],ot=at.high,st=at.low,ct=c[W-16],lt=ct.high,ut=ct.low;K=(K=(K=$+ot+((J=q+st)>>>0<q>>>0?1:0))+nt+((J+=it)>>>0<it>>>0?1:0))+lt+((J+=ut)>>>0<ut>>>0?1:0),X.high=K,X.low=J}var ft,ht=M&N^~M&F,gt=O&z^~O&j,pt=T&H^T&D^H&D,dt=I&L^I&R^L&R,vt=(T>>>28|I<<4)^(T<<30|I>>>2)^(T<<25|I>>>7),xt=(I>>>28|T<<4)^(I<<30|T>>>2)^(I<<25|T>>>7),yt=(M>>>14|O<<18)^(M>>>18|O<<14)^(M<<23|O>>>9),Ut=(O>>>14|M<<18)^(O>>>18|M<<14)^(O<<23|M>>>9),mt=s[W],wt=mt.high,_t=mt.low,bt=V+yt+((ft=G+Ut)>>>0<G>>>0?1:0),At=xt+dt;V=F,G=j,F=N,j=z,N=M,z=O,M=E+(bt=(bt=(bt=bt+ht+((ft+=gt)>>>0<gt>>>0?1:0))+wt+((ft+=_t)>>>0<_t>>>0?1:0))+K+((ft+=J)>>>0<J>>>0?1:0))+((O=P+ft|0)>>>0<P>>>0?1:0)|0,E=D,P=R,D=H,R=L,H=T,L=I,T=bt+(vt+pt+(At>>>0<xt>>>0?1:0))+((I=ft+At|0)>>>0<ft>>>0?1:0)|0}p=n.low=p+I,n.high=g+T+(p>>>0<I>>>0?1:0),v=i.low=v+L,i.high=d+H+(v>>>0<L>>>0?1:0),y=a.low=y+R,a.high=x+D+(y>>>0<R>>>0?1:0),m=o.low=m+P,o.high=U+E+(m>>>0<P>>>0?1:0),_=l.low=_+O,l.high=w+M+(_>>>0<O>>>0?1:0),A=u.low=A+z,u.high=b+N+(A>>>0<z>>>0?1:0),B=f.low=B+j,f.high=S+F+(B>>>0<j>>>0?1:0),k=h.low=k+G,h.high=C+V+(k>>>0<G>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),e[31+(n+128>>>10<<5)]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=e.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});t.SHA512=e._createHelper(l),t.HmacSHA512=e._createHmacHelper(l)}(),function(){var t=U,e=t.x64,r=e.Word,n=e.WordArray,i=t.algo,a=i.SHA512,o=i.SHA384=a.extend({_doReset:function(){this._hash=new n.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 t=a._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=a._createHelper(o),t.HmacSHA384=a._createHmacHelper(o)}(),U.lib.Cipher||function(t){var e=U,r=e.lib,n=r.Base,i=r.WordArray,a=r.BufferedBlockAlgorithm,o=e.enc;o.Utf8;var s=o.Base64,c=e.algo.EvpKDF,l=r.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?y:v}return function(e){return{encrypt:function(r,n,i){return t(n).encrypt(e,r,n,i)},decrypt:function(r,n,i){return t(n).decrypt(e,r,n,i)}}}}()});r.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=e.mode={},f=r.BlockCipherMode=n.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),h=u.CBC=function(){var e=f.extend();function r(e,r,n){var i=this._iv;if(i){var a=i;this._iv=t}else a=this._prevBlock;for(var o=0;o<n;o++)e[r+o]^=a[o]}return e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize;r.call(this,t,e,i),n.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,a=t.slice(e,e+i);n.decryptBlock(t,e),r.call(this,t,e,i),this._prevBlock=a}}),e}(),g=(e.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,n=r-t.sigBytes%r,a=n<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(a);var c=i.create(o,n);t.concat(c)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:h,padding:g}),reset:function(){l.reset.call(this);var t=this.cfg,e=t.iv,r=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,e&&e.words):(this._mode=n.call(r,this,e&&e.words),this._mode.__creator=n)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var p=r.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),d=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;if(r)var n=i.create([1398893684,1701076831]).concat(r).concat(e);else n=e;return n.toString(s)},parse:function(t){var e=s.parse(t),r=e.words;if(1398893684==r[0]&&1701076831==r[1]){var n=i.create(r.slice(2,4));r.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:n})}},v=r.SerializableCipher=n.extend({cfg:n.extend({format:d}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n),a=i.finalize(e),o=i.cfg;return p.create({ciphertext:a,key:r,iv:o.iv,algorithm:t,mode:o.mode,padding:o.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),x=(e.kdf={}).OpenSSL={execute:function(t,e,r,n){n||(n=i.random(8));var a=c.create({keySize:e+r}).compute(t,n),o=i.create(a.words.slice(e),4*r);return a.sigBytes=4*e,p.create({key:a,iv:o,salt:n})}},y=r.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:x}),encrypt:function(t,e,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize);n.iv=i.iv;var a=v.encrypt.call(this,t,e,i.key,n);return a.mixIn(i),a},decrypt:function(t,e,r,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var i=n.kdf.execute(r,t.keySize,t.ivSize,e.salt);return n.iv=i.iv,v.decrypt.call(this,t,e,i.key,n)}})}(),U.mode.CFB=function(){var t=U.lib.BlockCipherMode.extend();function e(t,e,r,n){var i=this._iv;if(i){var a=i.slice(0);this._iv=void 0}else a=this._prevBlock;n.encryptBlock(a,0);for(var o=0;o<r;o++)t[e+o]^=a[o]}return t.Encryptor=t.extend({processBlock:function(t,r){var n=this._cipher,i=n.blockSize;e.call(this,t,r,i,n),this._prevBlock=t.slice(r,r+i)}}),t.Decryptor=t.extend({processBlock:function(t,r){var n=this._cipher,i=n.blockSize,a=t.slice(r,r+i);e.call(this,t,r,i,n),this._prevBlock=a}}),t}(),U.mode.ECB=((f=U.lib.BlockCipherMode.extend()).Encryptor=f.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),f.Decryptor=f.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),f),U.pad.AnsiX923={pad:function(t,e){var r=t.sigBytes,n=4*e,i=n-r%n,a=r+i-1;t.clamp(),t.words[a>>>2]|=i<<24-a%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},U.pad.Iso10126={pad:function(t,e){var r=4*e,n=r-t.sigBytes%r;t.concat(U.lib.WordArray.random(n-1)).concat(U.lib.WordArray.create([n<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},U.pad.Iso97971={pad:function(t,e){t.concat(U.lib.WordArray.create([2147483648],1)),U.pad.ZeroPadding.pad(t,e)},unpad:function(t){U.pad.ZeroPadding.unpad(t),t.sigBytes--}},U.mode.OFB=(l=U.lib.BlockCipherMode.extend(),u=l.Encryptor=l.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._keystream;i&&(a=this._keystream=i.slice(0),this._iv=void 0),r.encryptBlock(a,0);for(var o=0;o<n;o++)t[e+o]^=a[o]}}),l.Decryptor=u,l),U.pad.NoPadding={pad:function(){},unpad:function(){}},function(){var t=U,e=t.lib.CipherParams,r=t.enc.Hex;t.format.Hex={stringify:function(t){return t.ciphertext.toString(r)},parse:function(t){var n=r.parse(t);return e.create({ciphertext:n})}}}(),function(){var t=U,e=t.lib.BlockCipher,r=t.algo,n=[],i=[],a=[],o=[],s=[],c=[],l=[],u=[],f=[],h=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var r=0,g=0;for(e=0;e<256;e++){var p=g^g<<1^g<<2^g<<3^g<<4;p=p>>>8^255&p^99,n[r]=p,i[p]=r;var d=t[r],v=t[d],x=t[v],y=257*t[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,s[r]=y<<8|y>>>24,c[r]=y,y=16843009*x^65537*v^257*d^16843008*r,l[p]=y<<24|y>>>8,u[p]=y<<16|y>>>16,f[p]=y<<8|y>>>24,h[p]=y,r?(r=d^t[t[t[x^d]]],g^=t[t[g]]):r=g=1}}();var g=[0,1,2,4,8,16,32,64,128,27,54],p=r.AES=e.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,r=t.sigBytes/4,i=4*((this._nRounds=r+6)+1),a=this._keySchedule=[],o=0;o<i;o++)if(o<r)a[o]=e[o];else{var s=a[o-1];o%r?r>6&&o%r==4&&(s=n[s>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s]):(s=n[(s=s<<8|s>>>24)>>>24]<<24|n[s>>>16&255]<<16|n[s>>>8&255]<<8|n[255&s],s^=g[o/r|0]<<24),a[o]=a[o-r]^s}for(var c=this._invKeySchedule=[],p=0;p<i;p++)o=i-p,s=p%4?a[o]:a[o-4],c[p]=p<4||o<=4?s:l[n[s>>>24]]^u[n[s>>>16&255]]^f[n[s>>>8&255]]^h[n[255&s]]}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,o,s,c,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,l,u,f,h,i),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,n,i,a,o,s){for(var c=this._nRounds,l=t[e]^r[0],u=t[e+1]^r[1],f=t[e+2]^r[2],h=t[e+3]^r[3],g=4,p=1;p<c;p++){var d=n[l>>>24]^i[u>>>16&255]^a[f>>>8&255]^o[255&h]^r[g++],v=n[u>>>24]^i[f>>>16&255]^a[h>>>8&255]^o[255&l]^r[g++],x=n[f>>>24]^i[h>>>16&255]^a[l>>>8&255]^o[255&u]^r[g++],y=n[h>>>24]^i[l>>>16&255]^a[u>>>8&255]^o[255&f]^r[g++];l=d,u=v,f=x,h=y}d=(s[l>>>24]<<24|s[u>>>16&255]<<16|s[f>>>8&255]<<8|s[255&h])^r[g++],v=(s[u>>>24]<<24|s[f>>>16&255]<<16|s[h>>>8&255]<<8|s[255&l])^r[g++],x=(s[f>>>24]<<24|s[h>>>16&255]<<16|s[l>>>8&255]<<8|s[255&u])^r[g++],y=(s[h>>>24]<<24|s[l>>>16&255]<<16|s[u>>>8&255]<<8|s[255&f])^r[g++],t[e]=d,t[e+1]=v,t[e+2]=x,t[e+3]=y},keySize:8});t.AES=e._createHelper(p)}(),function(){var t=U,e=t.lib,r=e.WordArray,n=e.BlockCipher,i=t.algo,a=[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],o=[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],s=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{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],u=i.DES=n.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;r<56;r++){var n=a[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],c=0;c<16;c++){var l=i[c]=[],u=s[c];for(r=0;r<24;r++)l[r/6|0]|=e[(o[r]-1+u)%28]<<31-r%6,l[4+(r/6|0)]|=e[28+(o[r+24]-1+u)%28]<<31-r%6;for(l[0]=l[0]<<1|l[0]>>>31,r=1;r<7;r++)l[r]=l[r]>>>4*(r-1)+3;l[7]=l[7]<<5|l[7]>>>27}var f=this._invSubKeys=[];for(r=0;r<16;r++)f[r]=i[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,r){this._lBlock=t[e],this._rBlock=t[e+1],f.call(this,4,252645135),f.call(this,16,65535),h.call(this,2,858993459),h.call(this,8,16711935),f.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],a=this._lBlock,o=this._rBlock,s=0,u=0;u<8;u++)s|=c[u][((o^i[u])&l[u])>>>0];this._lBlock=o,this._rBlock=a^s}var g=this._lBlock;this._lBlock=this._rBlock,this._rBlock=g,f.call(this,1,1431655765),h.call(this,8,16711935),h.call(this,2,858993459),f.call(this,16,65535),f.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function f(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function h(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}t.DES=n._createHelper(u);var g=i.TripleDES=n.extend({_doReset:function(){var t=this._key.words;this._des1=u.createEncryptor(r.create(t.slice(0,2))),this._des2=u.createEncryptor(r.create(t.slice(2,4))),this._des3=u.createEncryptor(r.create(t.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=n._createHelper(g)}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=r.RC4=e.extend({_doReset:function(){for(var t=this._key,e=t.words,r=t.sigBytes,n=this._S=[],i=0;i<256;i++)n[i]=i;i=0;for(var a=0;i<256;i++){var o=i%r,s=e[o>>>2]>>>24-o%4*8&255;a=(a+n[i]+s)%256;var c=n[i];n[i]=n[a],n[a]=c}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var t=this._S,e=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+t[e=(e+1)%256])%256;var a=t[e];t[e]=t[r],t[r]=a,n|=t[(t[e]+t[r])%256]<<24-8*i}return this._i=e,this._j=r,n}t.RC4=e._createHelper(n);var a=r.RC4Drop=n.extend({cfg:n.cfg.extend({drop:192}),_doReset:function(){n._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)i.call(this)}});t.RC4Drop=e._createHelper(a)}(),
10
- /** @preserve
11
- * Counter block mode compatible with Dr Brian Gladman fileenc.c
12
- * derived from CryptoJS.mode.CTR
13
- * Jan Hruby jhruby.web@gmail.com
14
- */
15
- U.mode.CTRGladman=function(){var t=U.lib.BlockCipherMode.extend();function e(t){if(255&~(t>>24))t+=1<<24;else{var e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}return t}function r(t){return 0===(t[0]=e(t[0]))&&(t[1]=e(t[1])),t}var n=t.Encryptor=t.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,a=this._iv,o=this._counter;a&&(o=this._counter=a.slice(0),this._iv=void 0),r(o);var s=o.slice(0);n.encryptBlock(s,0);for(var c=0;c<i;c++)t[e+c]^=s[c]}});return t.Decryptor=n,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.Rabbit=e.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)s.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(i[0]^=l,i[1]^=f,i[2]^=u,i[3]^=h,i[4]^=l,i[5]^=f,i[6]^=u,i[7]^=h,r=0;r<4;r++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=e._createHelper(o)}(),U.mode.CTR=function(){var t=U.lib.BlockCipherMode.extend(),e=t.Encryptor=t.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0);var o=a.slice(0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)t[e+s]^=o[s]}});return t.Decryptor=e,t}(),function(){var t=U,e=t.lib.StreamCipher,r=t.algo,n=[],i=[],a=[],o=r.RabbitLegacy=e.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)s.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(e){var a=e.words,o=a[0],c=a[1],l=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),u=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8),f=l>>>16|4294901760&u,h=u<<16|65535&l;for(n[0]^=l,n[1]^=f,n[2]^=u,n[3]^=h,n[4]^=l,n[5]^=f,n[6]^=u,n[7]^=h,i=0;i<4;i++)s.call(this)}},_doProcessBlock:function(t,e){var r=this._X;s.call(this),n[0]=r[0]^r[5]>>>16^r[3]<<16,n[1]=r[2]^r[7]>>>16^r[5]<<16,n[2]=r[4]^r[1]>>>16^r[7]<<16,n[3]=r[6]^r[3]>>>16^r[1]<<16;for(var i=0;i<4;i++)n[i]=16711935&(n[i]<<8|n[i]>>>24)|4278255360&(n[i]<<24|n[i]>>>8),t[e+i]^=n[i]},blockSize:4,ivSize:2});function s(){for(var t=this._X,e=this._C,r=0;r<8;r++)i[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],o=65535&n,s=n>>>16,c=((o*o>>>17)+o*s>>>15)+s*s,l=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=c^l}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=e._createHelper(o)}(),U.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var e=t.words,r=t.sigBytes-1;!(e[r>>>2]>>>24-r%4*8&255);)r--;t.sigBytes=r+1}},U),new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1);var C={formatTime:w,inArray:function(t,e,r){for(var n=0;n<t.length;n++)if(t[n][e]===r)return n;return-1},ab2hex:b,mergeArrayBuffer:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0;i<r.length;i++)r[i]=new Uint8Array(r[i]),t+=r[i].length;for(var a=new Uint8Array(t),o=0,s=0,c=r;s<c.length;s++){var l=c[s];a.set(l,o),o+=l.length}return a.buffer},Encrypt:B,Decrypt:function(t,e,r){var n=b(B(b(new Uint8Array(16).buffer),e)),i=m.exports;t=A(t);var a=new Uint8Array([]);e=b(e);for(var o=i.enc.Hex.parse(e),c=i.enc.Hex.parse(""),l=0;l<t.length;l+=16){var u=t.slice(l,l+16);if(b(u)!=n){var f=i.enc.Hex.parse(b(u)),h=i.enc.Base64.stringify(f),g=i.AES.decrypt(h,o,{iv:c,mode:i.mode.CBC,padding:i.pad.NoPadding});a=new Uint8Array([].concat(s(a),s(A(i.enc.Hex.stringify(g)))))}}return a},Crc16_Ccitt:S,SunCheck:function(t,e){var r,n=0;for(r=0;r<e;r++)n=n+(255&t[r])&255;return n=1+~n,(n&=255)>240&&(n-=16),n},stringToUint8Array:function(t){for(var e=[],r=0,n=t.length;r<n;++r)e.push(t.charCodeAt(r));return new Uint8Array(e)},sleep:function(t){for(var e=new Date,r=e.getTime()+t;;)if((e=new Date).getTime()>r)return},Uint8ArrayToHex:function(t,e){if(null==t)return"";for(var r,n=[],i=0;i<t.length;i++)1==(r=t[i].toString(16)).length&&(r="0"+r),n.push(r);return e?n.join(""):n.join(" ")},Uint8ArrayToString:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},getTimeArr:function(t){var e=w(new Date);return t&&(e=w(new Date(t))),A(e)},HexToUint8Array:A,DelayExecFunc:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200;null==t||t.length<1||null==e||r<1||function n(){null==t||t.length<1||(e(t.shift()),setTimeout(n,r))}()},SplitArray:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null==t||t.length<1||e<1)return[];for(var n=[],i=0;i<t.length;)n.push(t.slice(i,i+e)),i+=e;return null==r||n.forEach((function(t,e,n){r(t)})),n},clone:function(t){var e=null;if(t instanceof Array)e=t.concat();else if(t instanceof Function)e=t;else for(var r in e=new Object,t){var n=t[r];e[r]=n instanceof Object?this.clone(n):n}return e},GetPowerPercent:function(t){if(t<=3)return 0;if(t>4.22)return 102;if(t>=4.2)return 100;var e=0,r=0,n=0,i=10;return t<4.2&&t>=4.06?(e=90,r=4.2,n=4.06):t<4.06&&t>=3.98?(e=80,r=4.06,n=3.98):t<3.98&&t>=3.92?(e=70,r=3.98,n=3.92):t<3.92&&t>=3.87?(e=60,r=3.92,n=3.87):t<3.87&&t>=3.82?(e=50,r=3.87,n=3.82):t<3.82&&t>=3.79?(e=40,r=3.82,n=3.79):t<3.79&&t>=3.77?(e=30,r=3.79,n=3.77):t<3.77&&t>=3.74?(e=20,r=3.77,n=3.74):t<3.74&&t>=3.68?(e=10,r=3.74,n=3.68):t<3.68&&t>=3.45?(e=5,r=3.68,n=3.45,i=5):t<3.45&&t>=3&&(e=0,r=3.45,n=3,i=5),parseInt(e+i*(t-n)/(r-n))},GetPower:function(t){return t<3?5:t>=3?100:parseInt(t)},GetPowertow:function(t){var e=0;return t<1.4?0:t>=3?100:(t<3&&t>=2.5?e=(e=parseInt(392.16*t-488.24))>=100?100:e:t<2.016&&t>=1.4?e=parseInt(44.286*t*t-10.706*t-14.206):t<2.628&&t>=2.016?e=parseInt(13141*t*t-3752.7*t*t*t-15022*t+5653.6):t<3&&t>=2.628&&(e=(e=parseInt(53.763*t+19.36))>=100?100:e),e)},GetXorCheck:function(t,e){if(null==t||e<1)return 0;for(var r=0,n=0;n<e;n++)r^=t[n],r&=255;return r},ShiftSend:function(t){for(var e=new ArrayBuffer(2*t.length+2),r=new DataView(e,0),n=1,i=1;i<t.length-1;i++)126==t[i]?(r.setUint8(n,125),r.setUint8(n+1,2),n++):125==t[i]?(r.setUint8(n,125),r.setUint8(n+1,1),n++):r.setUint8(n,t[i]),n++;r.setUint8(0,126),r.setUint8(n,126),n++;try{return new Uint8Array(e.slice(0,n))}catch(t){return!1}},recoverRecv:function(t){for(var e=new Uint8Array(t.length),r=0,n=0;n<t.length;n++)125==t[n]?2==t[n+1]?(e[r]=126,n++):1==t[n+1]?(e[r]=125,n++):e[r]=t[n]:e[r]=t[n],r++;return e=e.slice(0,r)},bufferToHex:function(t){if(null==t)return"";for(var e,r=[],n=0;n<t.length;n++)1==(e=t[n].toString(16)).length&&(e="0"+e),r.push(e);return r.join(" ")},stringToUint8Arraytwo:function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?(e.push(192|n>>6),e.push(128|63&n)):n<65536?(e.push(224|n>>12),e.push(128|n>>6&63),e.push(128|63&n)):(e.push(240|n>>18),e.push(128|n>>12&63),e.push(128|n>>6&63),e.push(128|63&n))}return new Uint8Array(e)},checkCrc:function(t,e){var r=new ArrayBuffer(2),n=new DataView(r);n.setUint8(0,t[0]),n.setUint8(1,t[1]);var i=t.slice(12,e),a=S(i,i.length);return a&=65535,n.getUint16(0)==a}};var k={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"2401":return r=a(a({},r),function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint16(3),n={};1==(r>>15&1)?n.Power=((32767&r)/100).toFixed(2):n.Voltage=(r/1e3).toFixed(2);return n.sealNum=e.getUint32(5),n.unsealNum=e.getUint32(9),n.Time=C.Uint8ArrayToHex(t.slice(13,20),!0),n}(c));case"2403":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={CardList:[]},n=(t.length-1)/4,i=0;i<n;i++){var a=t.slice(e,e+4);r.CardList.push(C.ab2hex(a)),e+=4}return r.CardList=r.CardList,r}(c));case"2406":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={sealLogList:[]},n=(t.length-1)/11,i=0;i<n;i++){var a={};a.eventID=t[e];var o=t.slice(e+1,e+1+4);a.UserId=C.ab2hex(o),o=t.slice(e+5,e+5+6),a.Time=C.ab2hex(o),r.sealLogList.push(a),e+=11}return r}(c));case"2407":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=1,n={alarmLogList:[]},i=(t.length-1)/10,a=0;a<i;a++){var o={};o.eventID=e.getUint8(r),o.sealStatus=e.getUint8(r+1),o.Voltage=e.getUint16(r+2)/1e3;var s=t.slice(r+4,r+4+6);o.Time=C.ab2hex(s),n.alarmLogList.push(o),r+=10}return n}(c));case"2409":return r=a(a({},r),function(t){if(1!=t[0])return;var e=1,r={Content:""},n=t.slice(e,e+512);return r.Content=C.Uint8ArrayToString(n),r}(c));case"240D":return r.Data=function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(1),n=1,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2)}catch(t){break}if("0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o){var c=0;2==s&&(c=e.getUint16(n+3)),i[""+o]=c}else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x04"==o||"0x07"==o||"0x06"==o||"0x10"==o||"0x12"==o||"0xFC"==o){c="";c=C.Uint8ArrayToHex(t.slice(n+3,n+3+s),!0),i[""+o]=c}else if("0x11"==o||"0x0E"==o||"0x08"==o||"0x09"==o||"0x0A"==o){var l=t.slice(n+3,n+3+s);if(parseInt(l[0])>=49)i[""+o]=C.Uint8ArrayToString(l);else{for(var u="",f=0;f<l.length;f++)u+=l[f];i[""+o]=u}}else{l=t.slice(n+3,n+3+s);i[""+o]=l.toString()}n+=2+s}return i}(c),r;case"2402":case"2408":case"240A":case"240B":case"240C":return r}}catch(t){return console.log("==--",t),r}}};function T(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var I={setCommand:function(t,e){switch(t){case"HHD_BLE_2401":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=1;for(var r=new Uint8Array(20),n=C.stringToUint8Arraytwo(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];r[8]=parseInt(t.setData.cmd);var a=C.getTimeArr();return r[9]=a[0],r[10]=a[1],r[11]=a[2],r[12]=a[3],r[13]=a[4],r[14]=a[5],r[15]=a[6],r[16]=0,r[17]=0,r[18]=0,r[19]=0,T(e,r,t)}(e);case"HHD_BLE_2402":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=2;for(var r=t.setData,n=new Uint8Array(8+4*r.length),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];var o=0;for(a=0;a<r.length;a++){for(var s=C.HexToUint8Array(r[a]),c=0;c<4;c++)n[8+o+c]=s[c];o+=4}return T(e,n,t)}(e);case"HHD_BLE_2403":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=3;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2406":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=6;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2407":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=7;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e);case"HHD_BLE_2408":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=8;for(var r=C.stringToUint8Arraytwo(t.setData.content),n=new Uint8Array(8+r.length+1),i=C.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];n[8]=parseInt(t.setData.address);for(a=0;a<r.length;a++)n[9+a]=r[a];return T(e,n,t)}(e);case"HHD_BLE_2409":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=9;for(var r=new Uint8Array(9),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return r[8]=t.setData.address,T(e,r,t)}(e);case"HHD_BLE_240A":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=10;for(var r=new Uint8Array(16),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.password);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240B":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=11;for(var r=new Uint8Array(24),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=C.stringToUint8Array(t.setData.aespassword);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return T(e,r,t)}(e);case"HHD_BLE_240C":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(a.setUint8(r+1,parseInt(o)),"0x03"==o||"0x0B"==o||"0x0C"==o||"0x0D"==o||"0x13"==o)a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x01"==o||"0x02"==o||"0x09"==o||"0x0F"==o||"0xFE"==o||"0x14"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x04"==o){a.setUint8(r+2,7);var c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),a.setUint8(r+9,c[6]),r+=9}else if("0x07"==o){a.setUint8(r+2,6);c=C.HexToUint8Array(s);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),r+=8}else if("0xFC"==o){var l=C.HexToUint8Array(s);a.setUint8(r+2,l.length);for(var u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);r+=l.length+2}else{for(l=C.stringToUint8Arraytwo(s),u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);a.setUint8(r+2,l.length),r+=2+l.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var f=new Uint8Array(2);f[0]=36,f[1]=12;var h=new Uint8Array(8+r+1),g=C.stringToUint8Array(t.blePassword);for(u=0;u<g.byteLength;u++)h[u]=g[u];for(u=0;u<r+1;u++)h[8+u]=a.getUint8(u);return T(f,h,t)}return!1}(e);case"HHD_BLE_240D":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=13;for(var r=new Uint8Array(8),n=C.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return T(e,r,t)}(e)}}},H=a(a({},k),I),L=Object.freeze({__proto__:null,default:H});var D={parseResponse:function(t,e){t=new Uint8Array(t),t=C.recoverRecv(t),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(3,5);i=2047&new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+15!=n)return r;var s=t.slice(13,n-2),c=C.Decrypt(C.ab2hex(s),e,o);switch(c=c.slice(8,i),r.Code=c[0],C.ab2hex(t.slice(1,3)).toUpperCase()){case"0311":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0313":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2)}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0215":return r;case"0217":return r=a(a({},r),function(t){var e=0,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function R(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=126,i[1]=t[0],i[2]=t[1];var a=e.length+6|32768;i[3]=a>>8,i[4]=a;var o="00000000000000"+r.lockId;o=o.substr(-12),i[5]=parseInt(o.substr(0,2),16),i[6]=parseInt(o.substr(2,2),16),i[7]=parseInt(o.substr(4,2),16),i[8]=parseInt(o.substr(6,2),16),i[9]=parseInt(o.substr(8,2),16),i[10]=parseInt(o.substr(10,2),16),i[11]=0,i[12]=0;var s=parseInt(16*Math.ceil((6+e.length)/16)),c=new Uint8Array(s),l=C.getTimeArr();c[0]=l[1],c[1]=l[2],c[2]=l[3],c[3]=l[4],c[4]=l[5],c[5]=l[6];for(var u=0;u<e.length;u++)c[6+u]=e[u];var f=C.Encrypt(C.ab2hex(c.buffer),n);for(u=0;u<f.byteLength;u++)i[13+u]=f[u];return i[13+f.byteLength]=C.GetXorCheck(i.slice(1,f.byteLength+13),f.byteLength+13),i[14+f.byteLength]=126,C.ShiftSend(i.slice(0,14+f.byteLength+1))}var E={setCommand:function(t,e){switch(t){case"HHD_JT_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return R(S,B,t)}return!1}(e);case"HHD_JT_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return R(r,a,t)}(e);case"HHD_JT_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),R(r,i,t)}(e);case"HHD_JT_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,R(r,n,t)}(e)}}},P=a(a({},D),E),M=Object.freeze({__proto__:null,default:P});var O={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",C.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(C.mergeArrayBuffer([],i)).getUint16();var o=16*Math.ceil(i/16);if(o+11!=n)return r;if(C.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var s=t.slice(8,n-3);console.log("解密前:",C.ab2hex(s));var c=C.Decrypt(C.ab2hex(s),e,o);if(console.log("解密后:",C.ab2hex(c)),!C.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],C.ab2hex(t.slice(4,6)).toUpperCase()){case"0310":return r=a({},function(t){for(var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[o]=e.getUint8(n+2),n+=2}return i}(c));case"0312":return r=a({},function(t){var e=new DataView(C.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var o="0x"+C.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),s=e.getUint8(n+2);console.log(o,"================")}catch(t){break}if("0x06"==o||"0x2A"==o||"0x42"==o){var c=0;c=e.getUint32(n+3),i[""+o]=c}else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x94"==o||"0x02"==o||"0x88"==o||"0x89"==o||"0x8A"==o||"0x8B"==o||"0x34"==o||"0x3E"==o||"0x82"==o){c=0;2==s&&(c=e.getUint16(n+3)),"0x8B"==o&&(c>0?c/=100:c=0),i[""+o]=c+""}else if("0x43"==o){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+o]=l}else if("0x40"==o){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x90"==o){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+o]=l}else if("0x24"==o||"0x0F"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4F"==o||"0x23"==o||"0x5D"==o||"0x5E"==o||"0x5F"==o||"0x5C"==o||"0x3B"==o||"0x4E"==o||"0x44"==o||"0x72"==o||"0x98"==o||"0x30"==o||"0x2B"==o||"0x1A"==o||"0x2E"==o||"0x31"==o||"0x4D"==o||"0x99"==o||"0xA3"==o||"0xB1"==o||"0xB2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x2C"==o||"0xC2"==o||"0xC3"==o||"0xC4"==o||"0xC6"==o||"0xFE"==o||"0x75"==o){c=0;1==s&&(c=e.getUint8(n+3)),i[""+o]=c+""}else if("0x41"==o||"0x4B"==o){for(var u=[],f=s/7,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+o]=u}else if("0x45"==o){for(u=[],f=s/6,h=0;h<f;h++)u.push(C.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+o]=u}else if("0xFC"==o)i[""+o]=C.ab2hex(t.slice(n+3,n+9));else if("0x28"==o||"0xC7"==o||"0xC8"==o){c=t.slice(n+3,n+3+s);c=C.ab2hex(c),i[""+o]=c}else if("0x15"==o||"0x9A"==o){c=t.slice(n+3,n+3+s);parseInt(c[0])>=49?i[""+o]=C.Uint8ArrayToString(c):(c=C.ab2hex(c),i[""+o]=c)}else if("0x3F"==o){for(u=[],h=0;h<s;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=C.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=C.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+o]=u}else if("0x70"==o){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+o]=u}else if("0x71"==o){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+o]=u}else if("0x72"==o){c=[];u.push(e.getUint8(n+3)),i[""+o]=c.join(";")}else if("0x76"==o){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+o]=u}else if("0x9C"==o){for(u=[],f=s/10,h=0;h<f;h++){var p={};p.StartMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+3,n+10*h+6)),p.EndMinuteSecondBCD=C.ab2hex(t.slice(n+10*h+6,n+10*h+9)),p.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(p)}i[""+o]=u}else if("0x91"==o){for(u=[],f=s/22,h=0;h<f;h++){var d={};d.StartDate=C.ab2hex(t.slice(n+22*h+3,n+22*h+10)),d.EndDate=C.ab2hex(t.slice(n+22*h+10,n+22*h+17)),d.ReturnInterval=e.getUint32(n+22*h+17),d.StaticTimingThreshold=e.getUint16(n+22*h+21),d.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(d)}i[""+o]=u}else if("0x95"==o){var v=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&v?1:"0",RedShellDamageAlarm:v>>1&1?1:"0",RedLowBatteryAlarm:v>>2&1?1:"0",RedMcuAbnormalAlarm:v>>3&1?1:"0",RedCutLockRodAlarm:v>>4&1?1:"0",RedOpenCircuitAlarm:v>>5&1?1:"0",RedShortCircuitAlarm:v>>6&1?1:"0",RedSealStickAlarm:v>>7&1?1:"0",RedUnsealStickAlarm:v>>8&1?1:"0",RedOverspeedAlarm:v>>9&1?1:"0",RedTimeoutAlarm:v>>10&1?1:"0",RedGnssDownAlarm:v>>11&1?1:"0",RedPowerDownAlarm:v>>12&1?1:"0"};i[""+o]=u}else if("0x96"==o){var x=e.getUint32(n+3);u={RedAccStatus:(1&x)+"",RedGPSPositionStatus:(x>>1&1)+"",RedLatitudePosition:(x>>2&1)+"",RedLongitudePosition:(x>>3&1)+"",RedLinkMode:(x>>4&1)+"",RedLocationModuleStatus:(x>>5&1)+"",RedMotionSensorStatus:(x>>6&1)+"",RedDeviceSwitchState:(x>>14&1)+"",RedLockRodStatus:(x>>15&1)+"",RedChargeStatus:(x>>17&1)+""+(x>>16&1),RedNetworkMode:(x>>19&1)+""+(x>>18&1),RedSimMode:(x>>21&1)+""+(x>>20&1)};i[""+o]=u}else if("0x97"==o){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+o]=u}else if("0x26"==o||"0x39"==o||"0x48"==o||"0x93"==o||"0x92"==o){var y=t.slice(n+3,n+3+s);if(parseInt(y[0])>=49)i[""+o]=C.Uint8ArrayToString(y);else{for(var U="",m=0;m<y.length;m++)U+=y[m];i[""+o]=U}}else if("0xA4"==o){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+o]=u}else if("0xA5"==o){(u={}).IlluminationStartTime=C.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=C.ab2hex(t.slice(n+5,n+7)),i[""+o]=u}else if("0xA6"==o){u=[];for(var w=0;w<parseInt(s/2);w++)u.push(e.getUint16(n+3+2*w));i[""+o]=u}else if("0xB0"==o){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+o]=u}else if("0x22"==o){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+o]=u}else if("0x62"==o){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+o]=u}else if("0x32"==o){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+o]=u}else if("0x33"==o){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+o]=u}else if("0x6A"==o){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+o]=u}else if("0x77"==o){y=t.slice(n+3,n+3+s);var _=C.Uint8ArrayToString(y);u={};_&&(_=_.split(","),u.simId=_[0],u.apnName=_[1],u.apnUserName=_[2],u.apnPassword=_[3],u.apnAuth=_[4],u.regisNetStatus=_[5]),i[""+o]=u}else{y=t.slice(n+3,n+3+s);i[""+o]=C.Uint8ArrayToString(y)}n+=2+s}return i}(c)),r;case"0214":return r;case"0216":return r=a(a({},r),function(t){var e=1,r=new DataView(C.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var o=t.slice(e+2,e+2+4);i.push(C.Uint8ArrayToHex(o).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function N(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var o=parseInt(16*Math.ceil((12+e.length)/16)),s=new Uint8Array(o),c=C.Crc16_Ccitt(i.slice(8,8+e.length),e.length);s[0]=c>>8,s[1]=c;var l=C.getTimeArr();s[2]=l[1],s[3]=l[2],s[4]=l[3],s[5]=l[4],s[6]=l[5],s[7]=l[6],s[8]=49,s[9]=50,s[10]=51,s[11]=52;for(a=0;a<e.length;a++)s[12+a]=e[a];var u=C.Encrypt(C.ab2hex(s.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=C.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var z={setCommand:function(t,e){switch(t){case"HHD_G_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var o in e){var s=e[o];if(o=o.toLowerCase(),a.setUint8(r+1,parseInt(o)),"0x06"==o||"0x2a"==o||"0x42"==o)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(s)),r+=6;else if("0x08"==o||"0x11"==o||"0x14"==o||"0x17"==o||"0x27"==o||"0x80"==o||"0x81"==o||"0x02"==o||"0x82"==o||"0x66"==o||"0x88"==o||"0x89"==o||"0x8a"==o||"0x8b"==o||"0x34"==o||"0x94"==o||"0x3e"==o)"0x8b"==o&&(s=100*parseInt(s)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(s)),r+=4;else if("0x0f"==o||"0x10"==o||"0x16"==o||"0x18"==o||"0x19"==o||"0x20"==o||"0x37"==o||"0x4f"==o||"0x23"==o||"0x5d"==o||"0x5e"==o||"0x5f"==o||"0x3b"==o||"0x4e"==o||"0x5c"==o||"0x98"==o||"0x2c"==o||"0x1a"==o||"0x2e"==o||"0x31"==o||"0x65"==o||"0x68"==o||"0x6b"==o||"0xfe"==o||"0x4d"==o||"0x99"==o||"0x9b"==o||"0x75"==o||"0xa3"==o||"0xb1"==o||"0xb2"==o||"0x50"==o||"0x51"==o||"0x83"==o||"0x85"==o||"0x86"==o||"0x52"==o||"0x53"==o||"0x30"==o||"0xc2"==o||"0xc3"==o||"0xc4"==o||"0xc6"==o)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(s)),r+=3;else if("0x15"==o||"0x9a"==o||"0xfc"==o||"0x28"==o||"0xc7"==o||"0xc8"==o||"0x92"==o){var c=C.HexToUint8Array(s);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==o||"0x46"==o){var u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,s.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==o){var h=s;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=C.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==o||"0x49"==o){h=s.deviceCodeList;a.setUint8(r+3,h.length);var p=0;for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+p,c[g]),p++;var d=0;if(s.userName){d=(u=C.stringToUint8Arraytwo(s.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+p,u[f])}a.setUint8(r+2,p+1+d),r+=p+3+d}else if("0x4a"==o){var v=s.deviceCodeList,x=0;a.setUint8(r+3,v.length),x+=1;var y=0;for(l=0;l<v.length;l++){for(c=C.HexToUint8Array(v[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+y,c[g]);y+=6}switch(x+=y,s.Cmd){case"0x01":a.setUint8(r+3+x,1),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x03":a.setUint8(r+3+x,3),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0F":a.setUint8(r+3+x,15),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3;break;case"0x13":a.setUint8(r+3+x,19),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0x0B":a.setUint8(r+3+x,11),a.setUint8(r+3+x+1,2),a.setUint16(r+3+x+2,parseInt(Number(s.CmdValue))),x+=4;break;case"0xF0":a.setUint8(r+3+x,240),a.setUint8(r+3+x+1,1),a.setUint8(r+3+x+2,parseInt(Number(s.CmdValue))),x+=3}u=[];s.userName&&(u=C.stringToUint8Arraytwo(s.userName));var U=u.length;for(f=0;f<U;f++)a.setUint8(r+3+x+f,u[f]);x+=U,a.setUint8(r+2,x),r+=r+x+2}else if("0x41"==o||"0x4b"==o){h=s;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=C.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==o){a.setUint8(r+2,18*s.length);g=0;s.forEach((function(t){var e;e=6==t.LoraTHSensor.length?C.stringToUint8Arraytwo(t.LoraTHSensor):e=C.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==o){a.setUint8(r+2,2);h=s.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(s.ShootingDuration)),r+=4;else if("0x22"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TrackBlindSpotData)),a.setUint8(r+4,parseInt(s.EventBlindSpotData)),r+=4;else if("0x43"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(s.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.DurationOfInactivity)),a.setUint16(r+5,parseInt(s.ShortConnTransInterval)),r+=6;else if("0x90"==o)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(s.LowVoltageValue)),a.setUint16(r+5,parseInt(s.TransmissionInterval)),r+=6;else if("0x91"==o){h=s;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=C.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==o){a.setUint8(r+3,parseInt(s.BindingBoxSlotNO));for(c=C.HexToUint8Array(s.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==o){a.setUint8(r+3,parseInt(s.RemoteBoxOpenChannelNo));for(u=C.stringToUint8Arraytwo(s.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var _=1+u.length;a.setUint8(r+2,_),r+=_+2}else if("0xa2"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.SetSlotNO)),a.setUint16(r+4,parseInt(s.SetFullChargeCurrValue)),r+=5;else if("0xa4"==o)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(s.FaultBoxID)),a.setUint8(r+4,parseInt(s.DisableBoxID)),r+=4;else if("0xa5"==o){a.setUint8(r+2,4);var b=C.HexToUint8Array(s.IlluminationStartTime);for(g=0;g<b.length;g++)a.setUint8(r+3+g,b[g]);var A=C.HexToUint8Array(s.IlluminationEndTime);for(g=0;g<A.length;g++)a.setUint8(r+3+b.length+g,A[g]);r+=6}else if("0xb0"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(s.TempAlarmThreshold)),r+=5;else if("0x32"==o)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(s.TempMinLimit)),a.setInt16(r+5,10*Number(s.TempMaxLimit)),r+=6;else if("0x33"==o)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(s.HumMinLimit)),a.setUint16(r+5,10*Number(s.HumMaxLimit)),r+=6;else if("0x6a"==o)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(s.RecordingActivationMode)),a.setUint8(r+4,parseInt(s.FrameRate)),a.setUint8(r+5,parseInt(s.VideoQuality)),r+=5;else{for(c=C.stringToUint8Arraytwo(s),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var S=new Uint8Array(2);S[0]=3,S[1]=16;var B=new Uint8Array(r+1);for(l=0;l<r+1;l++)B[l]=a.getUint8(l);return console.log("原始报文",C.ab2hex(B)),N(S,B,t)}return!1}(e);case"HHD_G_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var o=0;for(var i in e)a[1+o]=parseInt(i,16),o++;return N(r,a,t)}(e);case"HHD_G_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,o=e.address;return i[0]=o,n.forEach((function(t,e){if(i[a+1]=e+100*o>>8,i[a+2]=e+100*o,0!=t)for(var r=C.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),N(r,i,t)}(e);case"HHD_G_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,N(r,n,t)}(e)}}},F=a(a({},O),z),j=Object.freeze({__proto__:null,default:F}),V=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modules={Block:!1!==e.Block?H:null,JTGlock:!1!==e.JTGlock?P:null,Glock:!1!==e.Glock?F:null},this.version="__VERSION__"},n=[{key:"loadModule",value:(a=o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.modules[e]){t.next=16;break}t.t0=e,t.next="Block"===t.t0?4:"JTGlock"===t.t0?8:"Glock"===t.t0?12:16;break;case 4:return t.next=6,Promise.resolve().then((function(){return L}));case 6:return this.modules.Block=t.sent.default,t.abrupt("break",16);case 8:return t.next=10,Promise.resolve().then((function(){return M}));case 10:return this.modules.JTGlock=t.sent.default,t.abrupt("break",16);case 12:return t.next=14,Promise.resolve().then((function(){return j}));case 14:return this.modules.Glock=t.sent.default,t.abrupt("break",16);case 16:return t.abrupt("return",this.modules[e]);case 17:case"end":return t.stop()}}),t,this)})),s=function(){var t=this,r=arguments;return new Promise((function(n,i){var o=a.apply(t,r);function s(t){e(o,n,i,s,c,"next",t)}function c(t){e(o,n,i,s,c,"throw",t)}s(void 0)}))},function(t){return s.apply(this,arguments)})},{key:"Block",get:function(){return this.modules.Block}},{key:"JTGlock",get:function(){return this.modules.JTGlock}},{key:"Glock",get:function(){return this.modules.Glock}}],n&&r(t.prototype,n),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i,a,s}();return V}();
1
+ var hhdlinkble=function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function e(t,e,r,n,i,a,s){try{var o=t[a](s),c=o.value}catch(t){return void r(t)}o.done?e(c):Promise.resolve(c).then(n,i)}function r(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,c(n.key),n)}}function n(t,e,r){return(e=c(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(){s=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",c=a.asyncIterator||"@@asyncIterator",l=a.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var a=e&&e.prototype instanceof v?e:v,s=Object.create(a.prototype),o=new D(n||[]);return i(s,"_invoke",{value:C(t,r,o)}),s}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var g="suspendedStart",x="suspendedYield",p="executing",U="completed",d={};function v(){}function y(){}function m(){}var b={};u(b,o,(function(){return this}));var w=Object.getPrototypeOf,A=w&&w(w(k([])));A&&A!==r&&n.call(A,o)&&(b=A);var S=m.prototype=v.prototype=Object.create(b);function T(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function I(t,e){function r(i,a,s,o){var c=h(t[i],t,a);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&n.call(u,"__await")?e.resolve(u.__await).then((function(t){r("next",t,s,o)}),(function(t){r("throw",t,s,o)})):e.resolve(u).then((function(t){l.value=t,s(l)}),(function(t){return r("throw",t,s,o)}))}o(c.arg)}var a;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,i){r(t,n,e,i)}))}return a=a?a.then(i,i):i()}})}function C(e,r,n){var i=g;return function(a,s){if(i===p)throw Error("Generator is already running");if(i===U){if("throw"===a)throw s;return{value:t,done:!0}}for(n.method=a,n.arg=s;;){var o=n.delegate;if(o){var c=L(o,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===g)throw i=U,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var l=h(e,r,n);if("normal"===l.type){if(i=n.done?U:x,l.arg===d)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(i=U,n.method="throw",n.arg=l.arg)}}}function L(e,r){var n=r.method,i=e.iterator[n];if(i===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var a=h(i,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,d;var s=a.arg;return s?s.done?(r[e.resultName]=s.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):s:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function B(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function k(e){if(e||""===e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return y.prototype=m,i(S,"constructor",{value:m,configurable:!0}),i(m,"constructor",{value:y,configurable:!0}),y.displayName=u(m,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,u(t,l,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},T(I.prototype),u(I.prototype,c,(function(){return this})),e.AsyncIterator=I,e.async=function(t,r,n,i,a){void 0===a&&(a=Promise);var s=new I(f(t,r,n,i),a);return e.isGeneratorFunction(r)?s:s.next().then((function(t){return t.done?t.value:s.next()}))},T(S),u(S,l,"Generator"),u(S,o,(function(){return this})),u(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=k,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(B),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return o.type="throw",o.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var s=this.tryEntries[a],o=s.completion;if("root"===s.tryLoc)return i("end");if(s.tryLoc<=this.prev){var c=n.call(s,"catchLoc"),l=n.call(s,"finallyLoc");if(c&&l){if(this.prev<s.catchLoc)return i(s.catchLoc,!0);if(this.prev<s.finallyLoc)return i(s.finallyLoc)}else if(c){if(this.prev<s.catchLoc)return i(s.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return i(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var s=a?a.completion:{};return s.type=t,s.arg=e,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),B(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;B(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}function o(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var l,u,f,h,g,x={exports:{}};function p(t){var e=t.getFullYear(),r=t.getMonth()+1,n=t.getDate(),i=t.getHours(),a=t.getMinutes(),s=t.getSeconds();return[e,r,n].map(U).join("/")+" "+[i,a,s].map(U).join(":")}function U(t){return(t=t.toString())[1]?t:"0"+t}function d(t){return Array.prototype.map.call(new Uint8Array(t),(function(t){return("00"+t.toString(16)).slice(-2)})).join("")}function v(t){return new Uint8Array(t.match(/[\da-f]{2}/gi).map((function(t){return parseInt(t,16)})))}function y(t,e){for(var r=65535,n=0;n<e;++n)for(var i=0;i<8;i++){var a=0,s=0;1==(t[n]>>7-i&1)&&(s=1),1==(r>>15&1)&&(a=1),r<<=1,1==(a^s)&&(r^=4129)}return r}function m(t,e){t=v(t);var r=x.exports;e=d(e);for(var n=r.enc.Hex.parse(e),i=r.enc.Hex.parse(""),a=new Uint8Array([]),s=0;s<t.length;s+=16){var c=t.slice(s,s+16),l=r.enc.Hex.parse(d(c)),u=r.AES.encrypt(l,n,{iv:i,mode:r.mode.CBC,padding:r.pad.ZeroPadding});a=new Uint8Array([].concat(o(a),o(v(r.enc.Hex.stringify(u.ciphertext)))))}return a}x.exports=(g=g||function(t,e){var r=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),n={},i=n.lib={},a=i.Base={extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=i.WordArray=a.extend({init:function(t,r){t=this.words=t||[],this.sigBytes=r!=e?r:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var s=r[a>>>2]>>>24-a%4*8&255;e[n+a>>>2]|=s<<24-(n+a)%4*8}else for(a=0;a<i;a+=4)e[n+a>>>2]=r[a>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var r,n=[],i=function(e){var r=987654321,n=4294967295;return function(){var i=((r=36969*(65535&r)+(r>>16)&n)<<16)+(e=18e3*(65535&e)+(e>>16)&n)&n;return i/=4294967296,(i+=.5)*(t.random()>.5?1:-1)}},a=0;a<e;a+=4){var o=i(4294967296*(r||t.random()));r=987654071*o(),n.push(4294967296*o()|0)}return new s.init(n,e)}}),o=n.enc={},c=o.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var a=e[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new s.init(r,e/2)}},l=o.Utf8={stringify:function(t){try{return decodeURIComponent(escape(Latin1.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return Latin1.parse(unescape(encodeURIComponent(t)))}},u=i.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=l.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r=this._data,n=r.words,i=r.sigBytes,a=this.blockSize,o=i/(4*a),c=(o=e?t.ceil(o):t.max((0|o)-this._minBufferSize,0))*a,l=t.min(4*c,i);if(c){for(var u=0;u<c;u+=a)this._doProcessBlock(n,u);var f=n.splice(0,c);r.sigBytes-=l}return new s.init(f,l)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0});i.Hasher=u.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new f.HMAC.init(t,r).finalize(e)}}});var f=n.algo={};return n}(Math),function(){var t=g,e=t.lib.WordArray;function r(t,r,n){for(var i=[],a=0,s=0;s<r;s++)if(s%4){var o=n[t.charCodeAt(s-1)]<<s%4*2,c=n[t.charCodeAt(s)]>>>6-s%4*2;i[a>>>2]|=(o|c)<<24-a%4*8,a++}return e.create(i,a)}t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],a=0;a<r;a+=3)for(var s=(e[a>>>2]>>>24-a%4*8&255)<<16|(e[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|e[a+2>>>2]>>>24-(a+2)%4*8&255,o=0;o<4&&a+.75*o<r;o++)i.push(n.charAt(s>>>6*(3-o)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(t){var e=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<n.length;a++)i[n.charCodeAt(a)]=a}var s=n.charAt(64);if(s){var o=t.indexOf(s);-1!==o&&(e=o)}return r(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(){if("function"==typeof ArrayBuffer){var t=g.lib.WordArray,e=t.init,r=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var r=t.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=t[i]<<24-i%4*8;e.call(this,n,r)}else e.apply(this,arguments)};r.prototype=t}}(),g.lib.Cipher||function(t){var e=g,r=e.lib,n=r.Base,i=r.WordArray,a=r.BufferedBlockAlgorithm,s=e.enc;s.Utf8;var o=s.Base64,c=e.algo.EvpKDF,l=r.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?y:d}return function(e){return{encrypt:function(r,n,i){return t(n).encrypt(e,r,n,i)},decrypt:function(r,n,i){return t(n).decrypt(e,r,n,i)}}}}()});r.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=e.mode={},f=r.BlockCipherMode=n.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),h=u.CBC=function(){var e=f.extend();function r(e,r,n){var i=this._iv;if(i){var a=i;this._iv=t}else a=this._prevBlock;for(var s=0;s<n;s++)e[r+s]^=a[s]}return e.Encryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize;r.call(this,t,e,i),n.encryptBlock(t,e),this._prevBlock=t.slice(e,e+i)}}),e.Decryptor=e.extend({processBlock:function(t,e){var n=this._cipher,i=n.blockSize,a=t.slice(e,e+i);n.decryptBlock(t,e),r.call(this,t,e,i),this._prevBlock=a}}),e}(),x=(e.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,n=r-t.sigBytes%r,a=n<<24|n<<16|n<<8|n,s=[],o=0;o<n;o+=4)s.push(a);var c=i.create(s,n);t.concat(c)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}};r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:h,padding:x}),reset:function(){l.reset.call(this);var t=this.cfg,e=t.iv,r=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=r.createEncryptor;else n=r.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,e&&e.words):(this._mode=n.call(r,this,e&&e.words),this._mode.__creator=n)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var p=r.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),U=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;if(r)var n=i.create([1398893684,1701076831]).concat(r).concat(e);else n=e;return n.toString(o)},parse:function(t){var e=o.parse(t),r=e.words;if(1398893684==r[0]&&1701076831==r[1]){var n=i.create(r.slice(2,4));r.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:n})}},d=r.SerializableCipher=n.extend({cfg:n.extend({format:U}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n),a=i.finalize(e),s=i.cfg;return p.create({ciphertext:a,key:r,iv:s.iv,algorithm:t,mode:s.mode,padding:s.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),v=(e.kdf={}).OpenSSL={execute:function(t,e,r,n){n||(n=i.random(8));var a=c.create({keySize:e+r}).compute(t,n),s=i.create(a.words.slice(e),4*r);return a.sigBytes=4*e,p.create({key:a,iv:s,salt:n})}},y=r.PasswordBasedCipher=d.extend({cfg:d.cfg.extend({kdf:v}),encrypt:function(t,e,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize);n.iv=i.iv;var a=d.encrypt.call(this,t,e,i.key,n);return a.mixIn(i),a},decrypt:function(t,e,r,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var i=n.kdf.execute(r,t.keySize,t.ivSize,e.salt);return n.iv=i.iv,d.decrypt.call(this,t,e,i.key,n)}})}(),g.mode.ECB=((h=g.lib.BlockCipherMode.extend()).Encryptor=h.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),h.Decryptor=h.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),h),g.pad.NoPadding={pad:function(){},unpad:function(){}},u=(l=g).lib.CipherParams,f=l.enc.Hex,l.format.Hex={stringify:function(t){return t.ciphertext.toString(f)},parse:function(t){var e=f.parse(t);return u.create({ciphertext:e})}},function(){var t=g,e=t.lib.BlockCipher,r=t.algo,n=[],i=[],a=[],s=[],o=[],c=[],l=[],u=[],f=[],h=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var r=0,g=0;for(e=0;e<256;e++){var x=g^g<<1^g<<2^g<<3^g<<4;x=x>>>8^255&x^99,n[r]=x,i[x]=r;var p=t[r],U=t[p],d=t[U],v=257*t[x]^16843008*x;a[r]=v<<24|v>>>8,s[r]=v<<16|v>>>16,o[r]=v<<8|v>>>24,c[r]=v,v=16843009*d^65537*U^257*p^16843008*r,l[x]=v<<24|v>>>8,u[x]=v<<16|v>>>16,f[x]=v<<8|v>>>24,h[x]=v,r?(r=p^t[t[t[d^p]]],g^=t[t[g]]):r=g=1}}();var x=[0,1,2,4,8,16,32,64,128,27,54],p=r.AES=e.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,r=t.sigBytes/4,i=4*((this._nRounds=r+6)+1),a=this._keySchedule=[],s=0;s<i;s++)if(s<r)a[s]=e[s];else{var o=a[s-1];s%r?r>6&&s%r==4&&(o=n[o>>>24]<<24|n[o>>>16&255]<<16|n[o>>>8&255]<<8|n[255&o]):(o=n[(o=o<<8|o>>>24)>>>24]<<24|n[o>>>16&255]<<16|n[o>>>8&255]<<8|n[255&o],o^=x[s/r|0]<<24),a[s]=a[s-r]^o}for(var c=this._invKeySchedule=[],g=0;g<i;g++)s=i-g,o=g%4?a[s]:a[s-4],c[g]=g<4||s<=4?o:l[n[o>>>24]]^u[n[o>>>16&255]]^f[n[o>>>8&255]]^h[n[255&o]]}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,s,o,c,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,l,u,f,h,i),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,n,i,a,s,o){for(var c=this._nRounds,l=t[e]^r[0],u=t[e+1]^r[1],f=t[e+2]^r[2],h=t[e+3]^r[3],g=4,x=1;x<c;x++){var p=n[l>>>24]^i[u>>>16&255]^a[f>>>8&255]^s[255&h]^r[g++],U=n[u>>>24]^i[f>>>16&255]^a[h>>>8&255]^s[255&l]^r[g++],d=n[f>>>24]^i[h>>>16&255]^a[l>>>8&255]^s[255&u]^r[g++],v=n[h>>>24]^i[l>>>16&255]^a[u>>>8&255]^s[255&f]^r[g++];l=p,u=U,f=d,h=v}p=(o[l>>>24]<<24|o[u>>>16&255]<<16|o[f>>>8&255]<<8|o[255&h])^r[g++],U=(o[u>>>24]<<24|o[f>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[g++],d=(o[f>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&u])^r[g++],v=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[u>>>8&255]<<8|o[255&f])^r[g++],t[e]=p,t[e+1]=U,t[e+2]=d,t[e+3]=v},keySize:8});t.AES=e._createHelper(p)}(),g.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){for(var e=t.words,r=t.sigBytes-1;!(e[r>>>2]>>>24-r%4*8&255);)r--;t.sigBytes=r+1}},g);var b={formatTime:p,ab2hex:d,mergeArrayBuffer:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0;i<r.length;i++)r[i]=new Uint8Array(r[i]),t+=r[i].length;for(var a=new Uint8Array(t),s=0,o=0,c=r;o<c.length;o++){var l=c[o];a.set(l,s),s+=l.length}return a.buffer},Encrypt:m,Decrypt:function(t,e,r){d(m(d(new Uint8Array(16).buffer),e));var n=x.exports;t=v(t);var i=new Uint8Array([]);e=d(e);for(var a=n.enc.Hex.parse(e),s=n.enc.Hex.parse(""),c=0;c<t.length;c+=16){var l=t.slice(c,c+16),u=n.enc.Hex.parse(d(l)),f=n.enc.Base64.stringify(u),h=n.AES.decrypt(f,a,{iv:s,mode:n.mode.CBC,padding:n.pad.NoPadding});i=new Uint8Array([].concat(o(i),o(v(n.enc.Hex.stringify(h)))))}return i},Crc16_Ccitt:y,SunCheck:function(t,e){var r,n=0;for(r=0;r<e;r++)n=n+(255&t[r])&255;return n=1+~n,(n&=255)>240&&(n-=16),n},stringToUint8Array:function(t){for(var e=[],r=0,n=t.length;r<n;++r)e.push(t.charCodeAt(r));return new Uint8Array(e)},Uint8ArrayToHex:function(t,e){if(null==t)return"";for(var r,n=[],i=0;i<t.length;i++)1==(r=t[i].toString(16)).length&&(r="0"+r),n.push(r);return e?n.join(""):n.join(" ")},Uint8ArrayToString:function(t){for(var e="",r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},getTimeArr:function(t){var e=p(new Date);return t&&(e=p(new Date(t))),v(e)},HexToUint8Array:v,clone:function(t){var e=null;if(t instanceof Array)e=t.concat();else if(t instanceof Function)e=t;else for(var r in e=new Object,t){var n=t[r];e[r]=n instanceof Object?this.clone(n):n}return e},GetPowerPercent:function(t){if(t<=3)return 0;if(t>4.22)return 102;if(t>=4.2)return 100;var e=0,r=0,n=0,i=10;return t<4.2&&t>=4.06?(e=90,r=4.2,n=4.06):t<4.06&&t>=3.98?(e=80,r=4.06,n=3.98):t<3.98&&t>=3.92?(e=70,r=3.98,n=3.92):t<3.92&&t>=3.87?(e=60,r=3.92,n=3.87):t<3.87&&t>=3.82?(e=50,r=3.87,n=3.82):t<3.82&&t>=3.79?(e=40,r=3.82,n=3.79):t<3.79&&t>=3.77?(e=30,r=3.79,n=3.77):t<3.77&&t>=3.74?(e=20,r=3.77,n=3.74):t<3.74&&t>=3.68?(e=10,r=3.74,n=3.68):t<3.68&&t>=3.45?(e=5,r=3.68,n=3.45,i=5):t<3.45&&t>=3&&(e=0,r=3.45,n=3,i=5),parseInt(e+i*(t-n)/(r-n))},GetPower:function(t){return t<3?5:t>=3?100:parseInt(t)},GetPowertow:function(t){var e=0;return t<1.4?0:t>=3?100:(t<3&&t>=2.5?e=(e=parseInt(392.16*t-488.24))>=100?100:e:t<2.016&&t>=1.4?e=parseInt(44.286*t*t-10.706*t-14.206):t<2.628&&t>=2.016?e=parseInt(13141*t*t-3752.7*t*t*t-15022*t+5653.6):t<3&&t>=2.628&&(e=(e=parseInt(53.763*t+19.36))>=100?100:e),e)},GetXorCheck:function(t,e){if(null==t||e<1)return 0;for(var r=0,n=0;n<e;n++)r^=t[n],r&=255;return r},ShiftSend:function(t){for(var e=new ArrayBuffer(2*t.length+2),r=new DataView(e,0),n=1,i=1;i<t.length-1;i++)126==t[i]?(r.setUint8(n,125),r.setUint8(n+1,2),n++):125==t[i]?(r.setUint8(n,125),r.setUint8(n+1,1),n++):r.setUint8(n,t[i]),n++;r.setUint8(0,126),r.setUint8(n,126),n++;try{return new Uint8Array(e.slice(0,n))}catch(t){return!1}},recoverRecv:function(t){for(var e=new Uint8Array(t.length),r=0,n=0;n<t.length;n++)125==t[n]?2==t[n+1]?(e[r]=126,n++):1==t[n+1]?(e[r]=125,n++):e[r]=t[n]:e[r]=t[n],r++;return e=e.slice(0,r)},bufferToHex:function(t){if(null==t)return"";for(var e,r=[],n=0;n<t.length;n++)1==(e=t[n].toString(16)).length&&(e="0"+e),r.push(e);return r.join(" ")},stringToUint8Arraytwo:function(t){for(var e=[],r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e.push(n):n<2048?(e.push(192|n>>6),e.push(128|63&n)):n<65536?(e.push(224|n>>12),e.push(128|n>>6&63),e.push(128|63&n)):(e.push(240|n>>18),e.push(128|n>>12&63),e.push(128|n>>6&63),e.push(128|63&n))}return new Uint8Array(e)},checkCrc:function(t,e){var r=new ArrayBuffer(2),n=new DataView(r);n.setUint8(0,t[0]),n.setUint8(1,t[1]);var i=t.slice(12,e),a=y(i,i.length);return a&=65535,n.getUint16(0)==a}};var w={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",b.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(b.mergeArrayBuffer([],i)).getUint16();var s=16*Math.ceil(i/16);if(s+11!=n)return r;if(b.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var o=t.slice(8,n-3);console.log("解密前:",b.ab2hex(o));var c=b.Decrypt(b.ab2hex(o),e,s);if(console.log("解密后:",b.ab2hex(c)),!b.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],b.ab2hex(t.slice(4,6)).toUpperCase()){case"2401":return r=a(a({},r),function(t){var e=new DataView(b.mergeArrayBuffer([],t),0),r=e.getUint16(3),n={};1==(r>>15&1)?n.Power=((32767&r)/100).toFixed(2):n.Voltage=(r/1e3).toFixed(2);return n.sealNum=e.getUint32(5),n.unsealNum=e.getUint32(9),n.Time=b.Uint8ArrayToHex(t.slice(13,20),!0),n}(c));case"2403":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={CardList:[]},n=(t.length-1)/4,i=0;i<n;i++){var a=t.slice(e,e+4);r.CardList.push(b.ab2hex(a)),e+=4}return r.CardList=r.CardList,r}(c));case"2406":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=1,r={sealLogList:[]},n=(t.length-1)/11,i=0;i<n;i++){var a={};a.eventID=t[e];var s=t.slice(e+1,e+1+4);a.UserId=b.ab2hex(s),s=t.slice(e+5,e+5+6),a.Time=b.ab2hex(s),r.sealLogList.push(a),e+=11}return r}(c));case"2407":return r=a(a({},r),function(t){if(1!=t[0])return;for(var e=new DataView(b.mergeArrayBuffer([],t),0),r=1,n={alarmLogList:[]},i=(t.length-1)/10,a=0;a<i;a++){var s={};s.eventID=e.getUint8(r),s.sealStatus=e.getUint8(r+1),s.Voltage=e.getUint16(r+2)/1e3;var o=t.slice(r+4,r+4+6);s.Time=b.ab2hex(o),n.alarmLogList.push(s),r+=10}return n}(c));case"2409":return r=a(a({},r),function(t){if(1!=t[0])return;var e=1,r={Content:""},n=t.slice(e,e+512);return r.Content=b.Uint8ArrayToString(n),r}(c));case"240D":return r.Data=function(t){for(var e=new DataView(b.mergeArrayBuffer([],t),0),r=e.getUint8(1),n=1,i={},a=0;a<r;a++){try{var s="0x"+b.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),o=e.getUint8(n+2)}catch(t){break}if("0x03"==s||"0x0B"==s||"0x0C"==s||"0x0D"==s||"0x13"==s){var c=0;2==o&&(c=e.getUint16(n+3)),i[""+s]=c}else if("0x01"==s||"0x02"==s||"0x09"==s||"0x0F"==s){c=0;1==o&&(c=e.getUint8(n+3)),i[""+s]=c+""}else if("0x04"==s||"0x07"==s||"0x06"==s||"0x10"==s||"0x12"==s||"0xFC"==s){c="";c=b.Uint8ArrayToHex(t.slice(n+3,n+3+o),!0),i[""+s]=c}else if("0x11"==s||"0x0E"==s||"0x08"==s||"0x09"==s||"0x0A"==s){var l=t.slice(n+3,n+3+o);if(parseInt(l[0])>=49)i[""+s]=b.Uint8ArrayToString(l);else{for(var u="",f=0;f<l.length;f++)u+=l[f];i[""+s]=u}}else{l=t.slice(n+3,n+3+o);i[""+s]=l.toString()}n+=2+o}return i}(c),r;case"2402":case"2408":case"240A":case"240B":case"240C":return r}}catch(t){return console.log("==--",t),r}}};function A(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var s=parseInt(16*Math.ceil((12+e.length)/16)),o=new Uint8Array(s),c=b.Crc16_Ccitt(i.slice(8,8+e.length),e.length);o[0]=c>>8,o[1]=c;var l=b.getTimeArr();o[2]=l[1],o[3]=l[2],o[4]=l[3],o[5]=l[4],o[6]=l[5],o[7]=l[6],o[8]=49,o[9]=50,o[10]=51,o[11]=52;for(a=0;a<e.length;a++)o[12+a]=e[a];var u=b.Encrypt(b.ab2hex(o.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=b.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var S={setCommand:function(t,e){switch(t){case"HHD_BLE_2401":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=1;for(var r=new Uint8Array(20),n=b.stringToUint8Arraytwo(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];r[8]=parseInt(t.setData.cmd);var a=b.getTimeArr();return r[9]=a[0],r[10]=a[1],r[11]=a[2],r[12]=a[3],r[13]=a[4],r[14]=a[5],r[15]=a[6],r[16]=0,r[17]=0,r[18]=0,r[19]=0,A(e,r,t)}(e);case"HHD_BLE_2402":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=2;for(var r=t.setData,n=new Uint8Array(8+4*r.length),i=b.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];var s=0;for(a=0;a<r.length;a++){for(var o=b.HexToUint8Array(r[a]),c=0;c<4;c++)n[8+s+c]=o[c];s+=4}return A(e,n,t)}(e);case"HHD_BLE_2403":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=3;for(var r=new Uint8Array(8),n=b.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return A(e,r,t)}(e);case"HHD_BLE_2406":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=6;for(var r=new Uint8Array(8),n=b.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return A(e,r,t)}(e);case"HHD_BLE_2407":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=7;for(var r=new Uint8Array(8),n=b.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return A(e,r,t)}(e);case"HHD_BLE_2408":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=8;for(var r=b.stringToUint8Arraytwo(t.setData.content),n=new Uint8Array(8+r.length+1),i=b.stringToUint8Array(t.blePassword),a=0;a<i.byteLength;a++)n[a]=i[a];n[8]=parseInt(t.setData.address);for(a=0;a<r.length;a++)n[9+a]=r[a];return A(e,n,t)}(e);case"HHD_BLE_2409":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=9;for(var r=new Uint8Array(9),n=b.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return r[8]=t.setData.address,A(e,r,t)}(e);case"HHD_BLE_240A":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=10;for(var r=new Uint8Array(16),n=b.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=b.stringToUint8Array(t.setData.password);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return A(e,r,t)}(e);case"HHD_BLE_240B":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=11;for(var r=new Uint8Array(24),n=b.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];var a=b.stringToUint8Array(t.setData.aespassword);for(i=0;i<a.byteLength;i++)r[8+i]=a[i];return A(e,r,t)}(e);case"HHD_BLE_240C":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var s in e){var o=e[s];if(a.setUint8(r+1,parseInt(s)),"0x03"==s||"0x0B"==s||"0x0C"==s||"0x0D"==s||"0x13"==s)a.setUint8(r+2,2),a.setUint16(r+3,parseInt(o)),r+=4;else if("0x01"==s||"0x02"==s||"0x09"==s||"0x0F"==s||"0xFE"==s||"0x14"==s)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(o)),r+=3;else if("0x04"==s){a.setUint8(r+2,7);var c=b.HexToUint8Array(o);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),a.setUint8(r+9,c[6]),r+=9}else if("0x07"==s){a.setUint8(r+2,6);c=b.HexToUint8Array(o);a.setUint8(r+3,c[0]),a.setUint8(r+4,c[1]),a.setUint8(r+5,c[2]),a.setUint8(r+6,c[3]),a.setUint8(r+7,c[4]),a.setUint8(r+8,c[5]),r+=8}else if("0xFC"==s){var l=b.HexToUint8Array(o);a.setUint8(r+2,l.length);for(var u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);r+=l.length+2}else{for(l=b.stringToUint8Arraytwo(o),u=0;u<l.length;u++)a.setUint8(r+3+u,l[u]);a.setUint8(r+2,l.length),r+=2+l.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var f=new Uint8Array(2);f[0]=36,f[1]=12;var h=new Uint8Array(8+r+1),g=b.stringToUint8Array(t.blePassword);for(u=0;u<g.byteLength;u++)h[u]=g[u];for(u=0;u<r+1;u++)h[8+u]=a.getUint8(u);return A(f,h,t)}return!1}(e);case"HHD_BLE_240D":return function(t){var e=new Uint8Array(2);e[0]=36,e[1]=13;for(var r=new Uint8Array(8),n=b.stringToUint8Array(t.blePassword),i=0;i<n.byteLength;i++)r[i]=n[i];return A(e,r,t)}(e)}}},T=a(a({},w),S),I=Object.freeze({__proto__:null,default:T});var C={parseResponse:function(t,e){t=new Uint8Array(t),t=b.recoverRecv(t),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(3,5);i=2047&new DataView(b.mergeArrayBuffer([],i)).getUint16();var s=16*Math.ceil(i/16);if(s+15!=n)return r;var o=t.slice(13,n-2),c=b.Decrypt(b.ab2hex(o),e,s);switch(c=c.slice(8,i),r.Code=c[0],b.ab2hex(t.slice(1,3)).toUpperCase()){case"0311":return r=a({},function(t){for(var e=new DataView(b.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var s="0x"+b.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[s]=e.getUint8(n+2),n+=2}return i}(c));case"0313":return r=a({},function(t){for(var e=new DataView(b.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var s="0x"+b.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),o=e.getUint8(n+2)}catch(t){break}if("0x06"==s||"0x2A"==s||"0x42"==s){var c=0;c=e.getUint32(n+3),i[""+s]=c}else if("0x08"==s||"0x11"==s||"0x14"==s||"0x17"==s||"0x27"==s||"0x80"==s||"0x81"==s||"0x94"==s||"0x02"==s||"0x88"==s||"0x89"==s||"0x8A"==s||"0x8B"==s||"0x34"==s||"0x3E"==s||"0x82"==s){c=0;2==o&&(c=e.getUint16(n+3)),"0x8B"==s&&(c>0?c/=100:c=0),i[""+s]=c+""}else if("0x43"==s){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+s]=l}else if("0x40"==s){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+s]=l}else if("0x90"==s){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+s]=l}else if("0x24"==s||"0x0F"==s||"0x10"==s||"0x16"==s||"0x18"==s||"0x19"==s||"0x20"==s||"0x37"==s||"0x4F"==s||"0x23"==s||"0x5D"==s||"0x5E"==s||"0x5F"==s||"0x5C"==s||"0x3B"==s||"0x4E"==s||"0x44"==s||"0x72"==s||"0x98"==s||"0x30"==s||"0x2B"==s||"0x1A"==s||"0x2E"==s||"0x31"==s||"0x4D"==s||"0x99"==s||"0xA3"==s||"0xB1"==s||"0xB2"==s||"0x50"==s||"0x51"==s||"0x83"==s||"0x85"==s||"0x86"==s||"0x52"==s||"0x53"==s||"0x2C"==s||"0xC2"==s||"0xC3"==s||"0xC4"==s||"0xC6"==s||"0xFE"==s||"0x75"==s){c=0;1==o&&(c=e.getUint8(n+3)),i[""+s]=c+""}else if("0x41"==s||"0x4B"==s){for(var u=[],f=o/7,h=0;h<f;h++)u.push(b.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+s]=u}else if("0x45"==s){for(u=[],f=o/6,h=0;h<f;h++)u.push(b.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+s]=u}else if("0xFC"==s)i[""+s]=b.ab2hex(t.slice(n+3,n+9));else if("0x28"==s||"0xC7"==s||"0xC8"==s){c=t.slice(n+3,n+3+o);c=b.ab2hex(c),i[""+s]=c}else if("0x15"==s||"0x9A"==s){c=t.slice(n+3,n+3+o);parseInt(c[0])>=49?i[""+s]=b.Uint8ArrayToString(c):(c=b.ab2hex(c),i[""+s]=c)}else if("0x3F"==s){for(u=[],h=0;h<o;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=b.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=b.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+s]=u}else if("0x70"==s){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+s]=u}else if("0x71"==s){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+s]=u}else if("0x72"==s){c=[];u.push(e.getUint8(n+3)),i[""+s]=c.join(";")}else if("0x76"==s){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+s]=u}else if("0x9C"==s){for(u=[],f=o/10,h=0;h<f;h++){var x={};x.StartMinuteSecondBCD=b.ab2hex(t.slice(n+10*h+3,n+10*h+6)),x.EndMinuteSecondBCD=b.ab2hex(t.slice(n+10*h+6,n+10*h+9)),x.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(x)}i[""+s]=u}else if("0x91"==s){for(u=[],f=o/22,h=0;h<f;h++){var p={};p.StartDate=b.ab2hex(t.slice(n+22*h+3,n+22*h+10)),p.EndDate=b.ab2hex(t.slice(n+22*h+10,n+22*h+17)),p.ReturnInterval=e.getUint32(n+22*h+17),p.StaticTimingThreshold=e.getUint16(n+22*h+21),p.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(p)}i[""+s]=u}else if("0x95"==s){var U=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&U?1:"0",RedShellDamageAlarm:U>>1&1?1:"0",RedLowBatteryAlarm:U>>2&1?1:"0",RedMcuAbnormalAlarm:U>>3&1?1:"0",RedCutLockRodAlarm:U>>4&1?1:"0",RedOpenCircuitAlarm:U>>5&1?1:"0",RedShortCircuitAlarm:U>>6&1?1:"0",RedSealStickAlarm:U>>7&1?1:"0",RedUnsealStickAlarm:U>>8&1?1:"0",RedOverspeedAlarm:U>>9&1?1:"0",RedTimeoutAlarm:U>>10&1?1:"0",RedGnssDownAlarm:U>>11&1?1:"0",RedPowerDownAlarm:U>>12&1?1:"0"};i[""+s]=u}else if("0x96"==s){var d=e.getUint32(n+3);u={RedAccStatus:(1&d)+"",RedGPSPositionStatus:(d>>1&1)+"",RedLatitudePosition:(d>>2&1)+"",RedLongitudePosition:(d>>3&1)+"",RedLinkMode:(d>>4&1)+"",RedLocationModuleStatus:(d>>5&1)+"",RedMotionSensorStatus:(d>>6&1)+"",RedDeviceSwitchState:(d>>14&1)+"",RedLockRodStatus:(d>>15&1)+"",RedChargeStatus:(d>>17&1)+""+(d>>16&1),RedNetworkMode:(d>>19&1)+""+(d>>18&1),RedSimMode:(d>>21&1)+""+(d>>20&1)};i[""+s]=u}else if("0x97"==s){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+s]=u}else if("0x26"==s||"0x39"==s||"0x48"==s||"0x93"==s||"0x92"==s){var v=t.slice(n+3,n+3+o);if(parseInt(v[0])>=49)i[""+s]=b.Uint8ArrayToString(v);else{for(var y="",m=0;m<v.length;m++)y+=v[m];i[""+s]=y}}else if("0xA4"==s){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+s]=u}else if("0xA5"==s){(u={}).IlluminationStartTime=b.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=b.ab2hex(t.slice(n+5,n+7)),i[""+s]=u}else if("0xA6"==s){u=[];for(var w=0;w<parseInt(o/2);w++)u.push(e.getUint16(n+3+2*w));i[""+s]=u}else if("0xB0"==s){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+s]=u}else if("0x22"==s){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+s]=u}else if("0x62"==s){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+s]=u}else if("0x32"==s){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+s]=u}else if("0x33"==s){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+s]=u}else if("0x6A"==s){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+s]=u}else if("0x77"==s){v=t.slice(n+3,n+3+o);var A=b.Uint8ArrayToString(v);u={};A&&(A=A.split(","),u.simId=A[0],u.apnName=A[1],u.apnUserName=A[2],u.apnPassword=A[3],u.apnAuth=A[4],u.regisNetStatus=A[5]),i[""+s]=u}else{v=t.slice(n+3,n+3+o);i[""+s]=b.Uint8ArrayToString(v)}n+=2+o}return i}(c)),r;case"0215":return r;case"0217":return r=a(a({},r),function(t){var e=0,r=new DataView(b.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var s=t.slice(e+2,e+2+4);i.push(b.Uint8ArrayToHex(s).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function L(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=126,i[1]=t[0],i[2]=t[1];var a=e.length+6|32768;i[3]=a>>8,i[4]=a;var s="00000000000000"+r.lockId;s=s.substr(-12),i[5]=parseInt(s.substr(0,2),16),i[6]=parseInt(s.substr(2,2),16),i[7]=parseInt(s.substr(4,2),16),i[8]=parseInt(s.substr(6,2),16),i[9]=parseInt(s.substr(8,2),16),i[10]=parseInt(s.substr(10,2),16),i[11]=0,i[12]=0;var o=parseInt(16*Math.ceil((6+e.length)/16)),c=new Uint8Array(o),l=b.getTimeArr();c[0]=l[1],c[1]=l[2],c[2]=l[3],c[3]=l[4],c[4]=l[5],c[5]=l[6];for(var u=0;u<e.length;u++)c[6+u]=e[u];var f=b.Encrypt(b.ab2hex(c.buffer),n);for(u=0;u<f.byteLength;u++)i[13+u]=f[u];return i[13+f.byteLength]=b.GetXorCheck(i.slice(1,f.byteLength+13),f.byteLength+13),i[14+f.byteLength]=126,b.ShiftSend(i.slice(0,14+f.byteLength+1))}var _={setCommand:function(t,e){switch(t){case"HHD_JT_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var s in e){var o=e[s];if(s=s.toLowerCase(),a.setUint8(r+1,parseInt(s)),"0x06"==s||"0x2a"==s||"0x42"==s)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(o)),r+=6;else if("0x08"==s||"0x11"==s||"0x14"==s||"0x17"==s||"0x27"==s||"0x80"==s||"0x81"==s||"0x02"==s||"0x82"==s||"0x66"==s||"0x88"==s||"0x89"==s||"0x8a"==s||"0x8b"==s||"0x34"==s||"0x94"==s||"0x3e"==s)"0x8b"==s&&(o=100*parseInt(o)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(o)),r+=4;else if("0x0f"==s||"0x10"==s||"0x16"==s||"0x18"==s||"0x19"==s||"0x20"==s||"0x37"==s||"0x4f"==s||"0x23"==s||"0x5d"==s||"0x5e"==s||"0x5f"==s||"0x3b"==s||"0x4e"==s||"0x5c"==s||"0x98"==s||"0x2c"==s||"0x1a"==s||"0x2e"==s||"0x31"==s||"0x65"==s||"0x68"==s||"0x6b"==s||"0xfe"==s||"0x4d"==s||"0x99"==s||"0x9b"==s||"0x75"==s||"0xa3"==s||"0xb1"==s||"0xb2"==s||"0x50"==s||"0x51"==s||"0x83"==s||"0x85"==s||"0x86"==s||"0x52"==s||"0x53"==s||"0x30"==s||"0xc2"==s||"0xc3"==s||"0xc4"==s||"0xc6"==s)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(o)),r+=3;else if("0x15"==s||"0x9a"==s||"0xfc"==s||"0x28"==s||"0xc7"==s||"0xc8"==s||"0x92"==s){var c=b.HexToUint8Array(o);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==s||"0x46"==s){var u=[];o.userName&&(u=b.stringToUint8Arraytwo(o.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,o.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==s){var h=o;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=b.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==s||"0x49"==s){h=o.deviceCodeList;a.setUint8(r+3,h.length);var x=0;for(l=0;l<h.length;l++)for(c=b.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+x,c[g]),x++;var p=0;if(o.userName){p=(u=b.stringToUint8Arraytwo(o.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+x,u[f])}a.setUint8(r+2,x+1+p),r+=x+3+p}else if("0x4a"==s){var U=o.deviceCodeList,d=0;a.setUint8(r+3,U.length),d+=1;var v=0;for(l=0;l<U.length;l++){for(c=b.HexToUint8Array(U[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+v,c[g]);v+=6}switch(d+=v,o.Cmd){case"0x01":a.setUint8(r+3+d,1),a.setUint8(r+3+d+1,1),a.setUint8(r+3+d+2,parseInt(Number(o.CmdValue))),d+=3;break;case"0x03":a.setUint8(r+3+d,3),a.setUint8(r+3+d+1,2),a.setUint16(r+3+d+2,parseInt(Number(o.CmdValue))),d+=4;break;case"0x0F":a.setUint8(r+3+d,15),a.setUint8(r+3+d+1,1),a.setUint8(r+3+d+2,parseInt(Number(o.CmdValue))),d+=3;break;case"0x13":a.setUint8(r+3+d,19),a.setUint8(r+3+d+1,2),a.setUint16(r+3+d+2,parseInt(Number(o.CmdValue))),d+=4;break;case"0x0B":a.setUint8(r+3+d,11),a.setUint8(r+3+d+1,2),a.setUint16(r+3+d+2,parseInt(Number(o.CmdValue))),d+=4;break;case"0xF0":a.setUint8(r+3+d,240),a.setUint8(r+3+d+1,1),a.setUint8(r+3+d+2,parseInt(Number(o.CmdValue))),d+=3}u=[];o.userName&&(u=b.stringToUint8Arraytwo(o.userName));var y=u.length;for(f=0;f<y;f++)a.setUint8(r+3+d+f,u[f]);d+=y,a.setUint8(r+2,d),r+=r+d+2}else if("0x41"==s||"0x4b"==s){h=o;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=b.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==s){a.setUint8(r+2,18*o.length);g=0;o.forEach((function(t){var e;e=6==t.LoraTHSensor.length?b.stringToUint8Arraytwo(t.LoraTHSensor):e=b.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==s){a.setUint8(r+2,2);h=o.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==s)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(o.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(o.ShootingDuration)),r+=4;else if("0x22"==s)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(o.TrackBlindSpotData)),a.setUint8(r+4,parseInt(o.EventBlindSpotData)),r+=4;else if("0x43"==s)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(o.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(o.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==s)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(o.DurationOfInactivity)),a.setUint16(r+5,parseInt(o.ShortConnTransInterval)),r+=6;else if("0x90"==s)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(o.LowVoltageValue)),a.setUint16(r+5,parseInt(o.TransmissionInterval)),r+=6;else if("0x91"==s){h=o;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=b.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==s){a.setUint8(r+3,parseInt(o.BindingBoxSlotNO));for(c=b.HexToUint8Array(o.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=b.stringToUint8Arraytwo(o.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==s){a.setUint8(r+3,parseInt(o.RemoteBoxOpenChannelNo));for(u=b.stringToUint8Arraytwo(o.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var A=1+u.length;a.setUint8(r+2,A),r+=A+2}else if("0xa2"==s)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(o.SetSlotNO)),a.setUint16(r+4,parseInt(o.SetFullChargeCurrValue)),r+=5;else if("0xa4"==s)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(o.FaultBoxID)),a.setUint8(r+4,parseInt(o.DisableBoxID)),r+=4;else if("0xa5"==s){a.setUint8(r+2,4);var S=b.HexToUint8Array(o.IlluminationStartTime);for(g=0;g<S.length;g++)a.setUint8(r+3+g,S[g]);var T=b.HexToUint8Array(o.IlluminationEndTime);for(g=0;g<T.length;g++)a.setUint8(r+3+S.length+g,T[g]);r+=6}else if("0xb0"==s)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(o.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(o.TempAlarmThreshold)),r+=5;else if("0x32"==s)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(o.TempMinLimit)),a.setInt16(r+5,10*Number(o.TempMaxLimit)),r+=6;else if("0x33"==s)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(o.HumMinLimit)),a.setUint16(r+5,10*Number(o.HumMaxLimit)),r+=6;else if("0x6a"==s)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(o.RecordingActivationMode)),a.setUint8(r+4,parseInt(o.FrameRate)),a.setUint8(r+5,parseInt(o.VideoQuality)),r+=5;else{for(c=b.stringToUint8Arraytwo(o),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var I=new Uint8Array(2);I[0]=3,I[1]=16;var C=new Uint8Array(r+1);for(l=0;l<r+1;l++)C[l]=a.getUint8(l);return L(I,C,t)}return!1}(e);case"HHD_JT_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var s=0;for(var i in e)a[1+s]=e[i],s++;return L(r,a,t)}(e);case"HHD_JT_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,s=e.address;return i[0]=s,n.forEach((function(t,e){if(i[a+1]=e+100*s>>8,i[a+2]=e+100*s,0!=t)for(var r=b.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),L(r,i,t)}(e);case"HHD_JT_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,L(r,n,t)}(e)}}},B=a(a({},C),_),D=Object.freeze({__proto__:null,default:B});var k={parseResponse:function(t,e){t=new Uint8Array(t),console.log("响应报文",b.ab2hex(t)),e=e.split("").map((function(t){return t.charCodeAt(0)}));var r={Code:6};try{var n=t.byteLength,i=t.slice(6,8);i=new DataView(b.mergeArrayBuffer([],i)).getUint16();var s=16*Math.ceil(i/16);if(s+11!=n)return r;if(b.SunCheck(t.slice(2,n-3),n-5)!=t[n-3])return r;var o=t.slice(8,n-3);console.log("解密前:",b.ab2hex(o));var c=b.Decrypt(b.ab2hex(o),e,s);if(console.log("解密后:",b.ab2hex(c)),!b.checkCrc(c,i))return r.Code=5,r;switch(c=c.slice(12,i),r.Code=c[0],b.ab2hex(t.slice(4,6)).toUpperCase()){case"0310":return r=a({},function(t){for(var e=new DataView(b.mergeArrayBuffer([],t),0),r=e.getUint8(0),n=0,i={},a=0;a<r;a++){try{var s="0x"+b.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase()}catch(t){break}i[s]=e.getUint8(n+2),n+=2}return i}(c));case"0312":return r=a({},function(t){var e=new DataView(b.mergeArrayBuffer([],t),0),r=e.getUint8(0);console.log("ID总数:",r);for(var n=0,i={},a=0;a<r;a++){try{var s="0x"+b.Uint8ArrayToHex([e.getUint8(n+1)]).toUpperCase(),o=e.getUint8(n+2);console.log(s,"================")}catch(t){break}if("0x06"==s||"0x2A"==s||"0x42"==s){var c=0;c=e.getUint32(n+3),i[""+s]=c}else if("0x08"==s||"0x11"==s||"0x14"==s||"0x17"==s||"0x27"==s||"0x80"==s||"0x81"==s||"0x94"==s||"0x02"==s||"0x88"==s||"0x89"==s||"0x8A"==s||"0x8B"==s||"0x34"==s||"0x3E"==s||"0x82"==s){c=0;2==o&&(c=e.getUint16(n+3)),"0x8B"==s&&(c>0?c/=100:c=0),i[""+s]=c+""}else if("0x43"==s){var l={TimeforConsecIncorrPwdEntries:e.getUint8(n+3),NumberofConsecIncorrPwdEntries:e.getUint8(n+4)};i[""+s]=l}else if("0x40"==s){l={DurationOfInactivity:e.getUint16(n+3),ShortConnTransInterval:e.getUint16(n+5)};i[""+s]=l}else if("0x90"==s){l={LowVoltageValue:e.getUint16(n+3),TransmissionInterval:e.getUint16(n+5)};i[""+s]=l}else if("0x24"==s||"0x0F"==s||"0x10"==s||"0x16"==s||"0x18"==s||"0x19"==s||"0x20"==s||"0x37"==s||"0x4F"==s||"0x23"==s||"0x5D"==s||"0x5E"==s||"0x5F"==s||"0x5C"==s||"0x3B"==s||"0x4E"==s||"0x44"==s||"0x72"==s||"0x98"==s||"0x30"==s||"0x2B"==s||"0x1A"==s||"0x2E"==s||"0x31"==s||"0x4D"==s||"0x99"==s||"0xA3"==s||"0xB1"==s||"0xB2"==s||"0x50"==s||"0x51"==s||"0x83"==s||"0x85"==s||"0x86"==s||"0x52"==s||"0x53"==s||"0x2C"==s||"0xC2"==s||"0xC3"==s||"0xC4"==s||"0xC6"==s||"0xFE"==s||"0x75"==s){c=0;1==o&&(c=e.getUint8(n+3)),i[""+s]=c+""}else if("0x41"==s||"0x4B"==s){for(var u=[],f=o/7,h=0;h<f;h++)u.push(b.ab2hex(t.slice(n+7*h+3,n+7*h+10)));i[""+s]=u}else if("0x45"==s){for(u=[],f=o/6,h=0;h<f;h++)u.push(b.ab2hex(t.slice(n+6*h+3,n+6*h+9)));i[""+s]=u}else if("0xFC"==s)i[""+s]=b.ab2hex(t.slice(n+3,n+9));else if("0x28"==s||"0xC7"==s||"0xC8"==s){c=t.slice(n+3,n+3+o);c=b.ab2hex(c),i[""+s]=c}else if("0x15"==s||"0x9A"==s){c=t.slice(n+3,n+3+o);parseInt(c[0])>=49?i[""+s]=b.Uint8ArrayToString(c):(c=b.ab2hex(c),i[""+s]=c)}else if("0x3F"==s){for(u=[],h=0;h<o;h+=18){var g={};c=t.slice(n+3+h,n+3+h+6);try{g.LoraTHSensor=b.Uint8ArrayToString(c)}catch(t){g.LoraTHSensor=b.ab2hex(c)}g.THSensorName=e.getUint16(n+3+h+6),g.TempUpperLimit=e.getUint16(n+3+h+8),g.TempLowerLimit=e.getUint16(n+3+h+10),g.ContOverHeatTIME=e.getUint8(n+3+h+12),g.HumUpperLimit=e.getUint8(n+3+h+13),g.HumLowerLimit=e.getUint16(n+3+h+14),g.ContSuperWetTIME=e.getUint16(n+3+h+16),u.push(g)}i[""+s]=u}else if("0x70"==s){(u={}).ConnectionStatus=e.getUint8(n+3),u.BaseStationCSQValue=e.getUint8(n+4),u.LastOnlineDuration=e.getUint32(n+5),u.ExternalStorageStatus=e.getUint8(n+9),u.RemTrackBlindSpots=32767&e.getUint16(n+10),u.RemEventBlindSpots=32767&e.getUint16(n+12),u.TrackBlindSpotD=e.getUint16(n+10)>>15&1?1:0,u.EventBlindSpotD=e.getUint16(n+12)>>15&1?1:0,i[""+s]=u}else if("0x71"==s){(u={}).RealTimeSensorStatus=e.getUint8(n+3),u.RealTimeLocationStatus=e.getUint8(n+4),u.RealTimeLocAntennaStatus=e.getUint8(n+5),u.RealTimePDOP=e.getUint16(n+6)/10,u.RealTimeLongitude=e.getUint32(n+8)/1e6,u.RealTimeLatitude=e.getUint32(n+12)/1e6,u.TotalNumberOfSatellites=e.getUint8(n+16),u.NumberOfBDSSatellites=e.getUint8(n+17),u.NumberOfGPSSatellites=e.getUint8(n+18),u.CNValuesOfTheTop10Strongest=e.getUint8(n+19)+","+e.getUint8(n+20)+","+e.getUint8(n+21)+","+e.getUint8(n+22)+","+e.getUint8(n+23)+","+e.getUint8(n+24)+","+e.getUint8(n+25)+","+e.getUint8(n+26)+","+e.getUint8(n+27)+","+e.getUint8(n+28),i[""+s]=u}else if("0x72"==s){c=[];u.push(e.getUint8(n+3)),i[""+s]=c.join(";")}else if("0x76"==s){(u={}).CardStatus=e.getUint8(n+3)+"",u.CardTotalCapacity=e.getUint32(n+4),u.CardUsedCapacit=e.getUint32(n+8),u.AvailableCapacity=e.getUint32(n+12),i[""+s]=u}else if("0x9C"==s){for(u=[],f=o/10,h=0;h<f;h++){var x={};x.StartMinuteSecondBCD=b.ab2hex(t.slice(n+10*h+3,n+10*h+6)),x.EndMinuteSecondBCD=b.ab2hex(t.slice(n+10*h+6,n+10*h+9)),x.DeviceReturnInterval=e.getUint32(n+10*h+9),u.push(x)}i[""+s]=u}else if("0x91"==s){for(u=[],f=o/22,h=0;h<f;h++){var p={};p.StartDate=b.ab2hex(t.slice(n+22*h+3,n+22*h+10)),p.EndDate=b.ab2hex(t.slice(n+22*h+10,n+22*h+17)),p.ReturnInterval=e.getUint32(n+22*h+17),p.StaticTimingThreshold=e.getUint16(n+22*h+21),p.StaticReturnInterva=e.getUint16(n+22*h+23),u.push(p)}i[""+s]=u}else if("0x95"==s){var U=e.getUint32(n+3);u={RedLockRodDestroyAlarm:1&U?1:"0",RedShellDamageAlarm:U>>1&1?1:"0",RedLowBatteryAlarm:U>>2&1?1:"0",RedMcuAbnormalAlarm:U>>3&1?1:"0",RedCutLockRodAlarm:U>>4&1?1:"0",RedOpenCircuitAlarm:U>>5&1?1:"0",RedShortCircuitAlarm:U>>6&1?1:"0",RedSealStickAlarm:U>>7&1?1:"0",RedUnsealStickAlarm:U>>8&1?1:"0",RedOverspeedAlarm:U>>9&1?1:"0",RedTimeoutAlarm:U>>10&1?1:"0",RedGnssDownAlarm:U>>11&1?1:"0",RedPowerDownAlarm:U>>12&1?1:"0"};i[""+s]=u}else if("0x96"==s){var d=e.getUint32(n+3);u={RedAccStatus:(1&d)+"",RedGPSPositionStatus:(d>>1&1)+"",RedLatitudePosition:(d>>2&1)+"",RedLongitudePosition:(d>>3&1)+"",RedLinkMode:(d>>4&1)+"",RedLocationModuleStatus:(d>>5&1)+"",RedMotionSensorStatus:(d>>6&1)+"",RedDeviceSwitchState:(d>>14&1)+"",RedLockRodStatus:(d>>15&1)+"",RedChargeStatus:(d>>17&1)+""+(d>>16&1),RedNetworkMode:(d>>19&1)+""+(d>>18&1),RedSimMode:(d>>21&1)+""+(d>>20&1)};i[""+s]=u}else if("0x97"==s){(u={}).RedLatitude=e.getUint32(n+3)/1e6,u.RedLongitude=e.getUint32(n+7)/1e6,u.RedElevation=e.getUint16(n+11),u.RedSpeed=e.getUint16(n+13),u.RedDirection=e.getUint16(n+15),i[""+s]=u}else if("0x26"==s||"0x39"==s||"0x48"==s||"0x93"==s||"0x92"==s){var v=t.slice(n+3,n+3+o);if(parseInt(v[0])>=49)i[""+s]=b.Uint8ArrayToString(v);else{for(var y="",m=0;m<v.length;m++)y+=v[m];i[""+s]=y}}else if("0xA4"==s){(u={}).FaultBoxID=e.getUint8(n+3),u.DisableBoxID=e.getUint16(n+4),i[""+s]=u}else if("0xA5"==s){(u={}).IlluminationStartTime=b.ab2hex(t.slice(n+3,n+5)),u.IlluminationEndTime=b.ab2hex(t.slice(n+5,n+7)),i[""+s]=u}else if("0xA6"==s){u=[];for(var w=0;w<parseInt(o/2);w++)u.push(e.getUint16(n+3+2*w));i[""+s]=u}else if("0xB0"==s){(u={}).TempSensorEnableFlag=e.getUint8(n+3),u.TempAlarmThreshold=e.getUint16(n+4),i[""+s]=u}else if("0x22"==s){(u={}).TrackBlindSpotData=e.getUint8(n+3),u.EventBlindSpotData=e.getUint16(n+4),i[""+s]=u}else if("0x62"==s){(u={}).RemoteShootChannelNo=e.getUint8(n+3),u.ShootingDuration=e.getUint8(n+3),i[""+s]=u}else if("0x32"==s){(u={}).TempMinLimit=e.getInt16(n+3)/10,u.TempMaxLimit=e.getInt16(n+5)/10,i[""+s]=u}else if("0x33"==s){(u={}).HumMinLimit=e.getUint16(n+3)/10,u.HumMaxLimit=e.getUint16(n+5)/10,i[""+s]=u}else if("0x6A"==s){(u={}).RecordingActivationMode=e.getUint8(n+3)+"",u.FrameRate=e.getUint8(n+3),u.VideoQuality=e.getUint8(n+3)+"",i[""+s]=u}else if("0x77"==s){v=t.slice(n+3,n+3+o);var A=b.Uint8ArrayToString(v);u={};A&&(A=A.split(","),u.simId=A[0],u.apnName=A[1],u.apnUserName=A[2],u.apnPassword=A[3],u.apnAuth=A[4],u.regisNetStatus=A[5]),i[""+s]=u}else{v=t.slice(n+3,n+3+o);i[""+s]=b.Uint8ArrayToString(v)}n+=2+o}return i}(c)),r;case"0214":return r;case"0216":return r=a(a({},r),function(t){var e=1,r=new DataView(b.mergeArrayBuffer([],t),0);r.getUint8(e),e+=1;var n=r.getUint16(e);e+=2,r.getUint16(e),e+=2;for(var i=[],a=0;a<n;a++){var s=t.slice(e+2,e+2+4);i.push(b.Uint8ArrayToHex(s).replace(/\s*/g,"")),e+=6}return{CardList:i}}(c))}}catch(t){return console.log("==--",t),r}}};function E(t,e,r){var n;n=r.aesPassword.split("").map((function(t){return t.charCodeAt(0)}));var i=new Uint8Array(2e3);i[0]=241,i[1]=31,i[2]=255,i[3]=238,i[4]=t[0],i[5]=t[1],i[6]=e.length>>8,i[7]=e.length;for(var a=0;a<e.length;a++)i[8+a]=e[a];var s=parseInt(16*Math.ceil((12+e.length)/16)),o=new Uint8Array(s),c=b.Crc16_Ccitt(i.slice(8,8+e.length),e.length);o[0]=c>>8,o[1]=c;var l=b.getTimeArr();o[2]=l[1],o[3]=l[2],o[4]=l[3],o[5]=l[4],o[6]=l[5],o[7]=l[6],o[8]=49,o[9]=50,o[10]=51,o[11]=52;for(a=0;a<e.length;a++)o[12+a]=e[a];var u=b.Encrypt(b.ab2hex(o.buffer),n);for(a=0;a<u.byteLength;a++)i[8+a]=u[a];return i[6]=e.length+12>>8,i[7]=e.length+12,i[u.byteLength+8]=b.SunCheck(i.slice(2,u.byteLength+8),u.byteLength+6),i[u.byteLength+9]=242,i[u.byteLength+10]=47,i.slice(0,u.byteLength+11)}var H={setCommand:function(t,e){switch(t){case"HHD_G_0310":return function(t){var e=t.setData,r=0,n=0,i=new ArrayBuffer(2e3),a=new DataView(i,0);for(var s in e){var o=e[s];if(s=s.toLowerCase(),a.setUint8(r+1,parseInt(s)),"0x06"==s||"0x2a"==s||"0x42"==s)a.setUint8(r+2,4),a.setUint32(r+3,parseInt(o)),r+=6;else if("0x08"==s||"0x11"==s||"0x14"==s||"0x17"==s||"0x27"==s||"0x80"==s||"0x81"==s||"0x02"==s||"0x82"==s||"0x66"==s||"0x88"==s||"0x89"==s||"0x8a"==s||"0x8b"==s||"0x34"==s||"0x94"==s||"0x3e"==s)"0x8b"==s&&(o=100*parseInt(o)),a.setUint8(r+2,2),a.setUint16(r+3,parseInt(o)),r+=4;else if("0x0f"==s||"0x10"==s||"0x16"==s||"0x18"==s||"0x19"==s||"0x20"==s||"0x37"==s||"0x4f"==s||"0x23"==s||"0x5d"==s||"0x5e"==s||"0x5f"==s||"0x3b"==s||"0x4e"==s||"0x5c"==s||"0x98"==s||"0x2c"==s||"0x1a"==s||"0x2e"==s||"0x31"==s||"0x65"==s||"0x68"==s||"0x6b"==s||"0xfe"==s||"0x4d"==s||"0x99"==s||"0x9b"==s||"0x75"==s||"0xa3"==s||"0xb1"==s||"0xb2"==s||"0x50"==s||"0x51"==s||"0x83"==s||"0x85"==s||"0x86"==s||"0x52"==s||"0x53"==s||"0x30"==s||"0xc2"==s||"0xc3"==s||"0xc4"==s||"0xc6"==s)a.setUint8(r+2,1),a.setUint8(r+3,parseInt(o)),r+=3;else if("0x15"==s||"0x9a"==s||"0xfc"==s||"0x28"==s||"0xc7"==s||"0xc8"==s||"0x92"==s){var c=b.HexToUint8Array(o);a.setUint8(r+2,c.length);for(var l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);r+=c.length+2}else if("0x24"==s||"0x46"==s){var u=[];o.userName&&(u=b.stringToUint8Arraytwo(o.userName)),a.setUint8(r+2,u.length+1),a.setUint8(r+3,o.cmd);for(var f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);r+=u.length+3}else if("0x45"==s){var h=o;a.setUint8(r+2,6*h.length);for(l=0;l<h.length;l++){c=b.HexToUint8Array(h[l]);for(var g=0;g<c.length;g++)a.setUint8(r+3+g+6*l,c[g])}r+=6*h.length+2}else if("0x47"==s||"0x49"==s){h=o.deviceCodeList;a.setUint8(r+3,h.length);var x=0;for(l=0;l<h.length;l++)for(c=b.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+4+x,c[g]),x++;var p=0;if(o.userName){p=(u=b.stringToUint8Arraytwo(o.userName)).length;for(f=0;f<u.length;f++)a.setUint8(r+4+f+x,u[f])}a.setUint8(r+2,x+1+p),r+=x+3+p}else if("0x4a"==s){var U=o.deviceCodeList,d=0;a.setUint8(r+3,U.length),d+=1;var v=0;for(l=0;l<U.length;l++){for(c=b.HexToUint8Array(U[l]),g=0;g<c.length;g++)a.setUint8(r+4+g+v,c[g]);v+=6}switch(d+=v,o.Cmd){case"0x01":a.setUint8(r+3+d,1),a.setUint8(r+3+d+1,1),a.setUint8(r+3+d+2,parseInt(Number(o.CmdValue))),d+=3;break;case"0x03":a.setUint8(r+3+d,3),a.setUint8(r+3+d+1,2),a.setUint16(r+3+d+2,parseInt(Number(o.CmdValue))),d+=4;break;case"0x0F":a.setUint8(r+3+d,15),a.setUint8(r+3+d+1,1),a.setUint8(r+3+d+2,parseInt(Number(o.CmdValue))),d+=3;break;case"0x13":a.setUint8(r+3+d,19),a.setUint8(r+3+d+1,2),a.setUint16(r+3+d+2,parseInt(Number(o.CmdValue))),d+=4;break;case"0x0B":a.setUint8(r+3+d,11),a.setUint8(r+3+d+1,2),a.setUint16(r+3+d+2,parseInt(Number(o.CmdValue))),d+=4;break;case"0xF0":a.setUint8(r+3+d,240),a.setUint8(r+3+d+1,1),a.setUint8(r+3+d+2,parseInt(Number(o.CmdValue))),d+=3}u=[];o.userName&&(u=b.stringToUint8Arraytwo(o.userName));var y=u.length;for(f=0;f<y;f++)a.setUint8(r+3+d+f,u[f]);d+=y,a.setUint8(r+2,d),r+=r+d+2}else if("0x41"==s||"0x4b"==s){h=o;a.setUint8(r+2,7*h.length);for(l=0;l<h.length;l++)for(c=b.HexToUint8Array(h[l]),g=0;g<c.length;g++)a.setUint8(r+3+g+7*l,c[g]);r+=7*h.length+2}else if("0x3f"==s){a.setUint8(r+2,18*o.length);g=0;o.forEach((function(t){var e;e=6==t.LoraTHSensor.length?b.stringToUint8Arraytwo(t.LoraTHSensor):e=b.HexToUint8Array(t.LoraTHSensor);for(var n=0;n<e.length;n++)a.setUint8(r+3+g+n,e[n]);a.setUint16(r+g+9,parseInt(t.THSensorName)),a.setUint16(r+g+11,parseInt(t.TempUpperLimit)),a.setUint16(r+g+13,parseInt(t.TempLowerLimit)),a.setUint8(r+g+15,parseInt(t.ContOverHeatTIME)),a.setUint8(r+g+16,parseInt(t.HumUpperLimit)),a.setUint16(r+g+17,parseInt(t.HumLowerLimit)),a.setUint16(r+g+19,parseInt(t.ContSuperWetTIME)),g+=18})),r+=2+g}else if("0x6c"==s){a.setUint8(r+2,2);h=o.split(",");a.setUint8(r+3,parseInt(h[0])),a.setUint8(r+4,parseInt(h[1])),r+=4}else if("0x62"==s)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(o.RemoteShootChannelNo)),a.setUint8(r+4,parseInt(o.ShootingDuration)),r+=4;else if("0x22"==s)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(o.TrackBlindSpotData)),a.setUint8(r+4,parseInt(o.EventBlindSpotData)),r+=4;else if("0x43"==s)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(o.TimeforConsecIncorrPwdEntries)),a.setUint8(r+4,parseInt(o.NumberofConsecIncorrPwdEntries)),r+=4;else if("0x40"==s)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(o.DurationOfInactivity)),a.setUint16(r+5,parseInt(o.ShortConnTransInterval)),r+=6;else if("0x90"==s)a.setUint8(r+2,4),a.setUint16(r+3,parseInt(o.LowVoltageValue)),a.setUint16(r+5,parseInt(o.TransmissionInterval)),r+=6;else if("0x91"==s){h=o;a.setUint8(r+2,22*h.length);for(l=0;l<h.length;l++){var m=h[l];for(c=b.HexToUint8Array(m.StartDate+m.EndDate),g=0;g<c.length;g++)a.setUint8(r+3+g+22*l,c[g]);a.setUint32(r+17+22*l,parseInt(m.ReturnInterval)),a.setUint16(r+21+22*l,parseInt(m.StaticTimingThreshold)),a.setUint16(r+23+22*l,parseInt(m.StaticReturnInterva))}r+=22*h.length+2}else if("0xa0"==s){a.setUint8(r+3,parseInt(o.BindingBoxSlotNO));for(c=b.HexToUint8Array(o.BindingELockBleMAC),g=0;g<c.length;g++)a.setUint8(r+4+g,c[g]);for(u=b.stringToUint8Arraytwo(o.userName),f=0;f<u.length;f++)a.setUint8(r+4+c.length+f,u[f]);var w=1+c.length+u.length;a.setUint8(r+2,w),r+=w+2}else if("0xa1"==s){a.setUint8(r+3,parseInt(o.RemoteBoxOpenChannelNo));for(u=b.stringToUint8Arraytwo(o.userName),f=0;f<u.length;f++)a.setUint8(r+4+f,u[f]);var A=1+u.length;a.setUint8(r+2,A),r+=A+2}else if("0xa2"==s)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(o.SetSlotNO)),a.setUint16(r+4,parseInt(o.SetFullChargeCurrValue)),r+=5;else if("0xa4"==s)a.setUint8(r+2,2),a.setUint8(r+3,parseInt(o.FaultBoxID)),a.setUint8(r+4,parseInt(o.DisableBoxID)),r+=4;else if("0xa5"==s){a.setUint8(r+2,4);var S=b.HexToUint8Array(o.IlluminationStartTime);for(g=0;g<S.length;g++)a.setUint8(r+3+g,S[g]);var T=b.HexToUint8Array(o.IlluminationEndTime);for(g=0;g<T.length;g++)a.setUint8(r+3+S.length+g,T[g]);r+=6}else if("0xb0"==s)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(o.TempSensorEnableFlag)),a.setUint16(r+4,parseInt(o.TempAlarmThreshold)),r+=5;else if("0x32"==s)a.setUint8(r+2,4),a.setInt16(r+3,10*Number(o.TempMinLimit)),a.setInt16(r+5,10*Number(o.TempMaxLimit)),r+=6;else if("0x33"==s)a.setUint8(r+2,4),a.setUint16(r+3,10*Number(o.HumMinLimit)),a.setUint16(r+5,10*Number(o.HumMaxLimit)),r+=6;else if("0x6a"==s)a.setUint8(r+2,3),a.setUint8(r+3,parseInt(o.RecordingActivationMode)),a.setUint8(r+4,parseInt(o.FrameRate)),a.setUint8(r+5,parseInt(o.VideoQuality)),r+=5;else{for(c=b.stringToUint8Arraytwo(o),l=0;l<c.length;l++)a.setUint8(r+3+l,c[l]);a.setUint8(r+2,c.length),r+=2+c.length}n++}if(0==n)return;if(a.setUint8(0,n),n>0){var I=new Uint8Array(2);I[0]=3,I[1]=16;var C=new Uint8Array(r+1);for(l=0;l<r+1;l++)C[l]=a.getUint8(l);return console.log("原始报文",b.ab2hex(C)),E(I,C,t)}return!1}(e);case"HHD_G_0312":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=3,r[1]=18;var n=0;for(var i in e)n++;var a=new Uint8Array(n+1);a[0]=n;var s=0;for(var i in e)a[1+s]=e[i],s++;return E(r,a,t)}(e);case"HHD_G_0214":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=20;var n=e.CardLists,i=new Uint8Array(6*n.length+1),a=0,s=e.address;return i[0]=s,n.forEach((function(t,e){if(i[a+1]=e+100*s>>8,i[a+2]=e+100*s,0!=t)for(var r=b.HexToUint8Array(t),n=0;n<4;n++)i[a+3+n]=r[n];a+=6})),E(r,i,t)}(e);case"HHD_G_0216":return function(t){var e=t.setData,r=new Uint8Array(2);r[0]=2,r[1]=22;var n=new Uint8Array(1);return n[0]=e.address,E(r,n,t)}(e)}}},R=a(a({},k),H),O=Object.freeze({__proto__:null,default:R}),N=function(){return t=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.modules={Block:!1!==e.Block?T:null,JTGlock:!1!==e.JTGlock?B:null,Glock:!1!==e.Glock?R:null},this.version="__VERSION__"},n=[{key:"loadModule",value:(a=s().mark((function t(e){return s().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.modules[e]){t.next=16;break}t.t0=e,t.next="Block"===t.t0?4:"JTGlock"===t.t0?8:"Glock"===t.t0?12:16;break;case 4:return t.next=6,Promise.resolve().then((function(){return I}));case 6:return this.modules.Block=t.sent.default,t.abrupt("break",16);case 8:return t.next=10,Promise.resolve().then((function(){return D}));case 10:return this.modules.JTGlock=t.sent.default,t.abrupt("break",16);case 12:return t.next=14,Promise.resolve().then((function(){return O}));case 14:return this.modules.Glock=t.sent.default,t.abrupt("break",16);case 16:return t.abrupt("return",this.modules[e]);case 17:case"end":return t.stop()}}),t,this)})),o=function(){var t=this,r=arguments;return new Promise((function(n,i){var s=a.apply(t,r);function o(t){e(s,n,i,o,c,"next",t)}function c(t){e(s,n,i,o,c,"throw",t)}o(void 0)}))},function(t){return o.apply(this,arguments)})},{key:"Block",get:function(){return this.modules.Block}},{key:"JTGlock",get:function(){return this.modules.JTGlock}},{key:"Glock",get:function(){return this.modules.Glock}}],n&&r(t.prototype,n),i&&r(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,n,i,a,o}();return N}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hhdlinkble",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "main": "dist/index.cjs.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "browser": "dist/index.iife.js",