数据可视化大屏
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

10 linhas
241KB

  1. import{$ as Rt,$a as ct,A as We,C as Ve,Ca as tt,Ga as rt,Ia as nt,La as ot,O as sr,P as ar,Pa as st,S as lr,Sa as at,T as ur,U as cr,Ua as lt,V as He,Xa as ut,_ as qe,aa as Ke,bb as ft,ca as Qe,da as fr,db as ht,e as Ue,fa as hr,fb as pt,ga as pr,ha as dr,hb as dt,ia as gr,j as ir,ja as mr,jb as gt,ka as yr,kb as kt,la as Ye,n as nr,pa as Ge,ra as $e,ta as Je,u as je,ua as Xe,v as ze,wa as Ze,ya as et,z as or}from"./chunk-WD6SV3WH.js";import{Ab as Ct,Bb as xt,Cb as It,Db as Tt,Eb as we,Fb as Se,Fe as Mt,Gb as At,Ge as Ne,He as Ot,I as Yt,J as Gt,Jb as Ee,K as $t,Ka as pe,Le as De,Nf as it,Oa as be,Ta as Ae,Va as _e,X as Jt,Y as Xt,Za as vt,a as bt,b as wt,c as _t,cc as Pt,dc as rr,f as Zr,gb as ge,h as Vt,ha as Zt,hb as de,hf as Le,ib as Ie,ja as Dt,k as Re,ka as Lt,l as Ht,lf as Fe,m as qt,mb as er,n as Kt,na as ve,nc as Be,o as Nt,p as Qt,qb as Te,sa as Ft,sb as ke,ta as Ut,tb as Et,ub as St,vb as tr}from"./chunk-VDRVUQCF.js";var zt=Zr((Jr,jt)=>{"use strict";(function(se){if(typeof Jr=="object"&&typeof jt<"u")jt.exports=se();else if(typeof define=="function"&&define.amd)define([],se);else{var ae;typeof window<"u"?ae=window:typeof global<"u"?ae=global:typeof self<"u"?ae=self:ae=this,ae.mqtt=se()}})(function(){var se,ae,me;return function(){function m(T,v,h){function p(o,i){if(!v[o]){if(!T[o]){var r=typeof _t=="function"&&_t;if(!i&&r)return r(o,!0);if(y)return y(o,!0);var e=new Error("Cannot find module '"+o+"'");throw e.code="MODULE_NOT_FOUND",e}var t=v[o]={exports:{}};T[o][0].call(t.exports,function(s){var u=T[o][1][s];return p(u||s)},t,t.exports,m,T,v,h)}return v[o].exports}for(var y=typeof _t=="function"&&_t,c=0;c<h.length;c++)p(h[c]);return p}return m}()({1:[function(m,T,v){"use strict";v.byteLength=e,v.toByteArray=s,v.fromByteArray=g;for(var h=[],p=[],y=typeof Uint8Array<"u"?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=c.length;o<i;++o)h[o]=c[o],p[c.charCodeAt(o)]=o;p[45]=62,p[95]=63;function r(_){var f=_.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var E=_.indexOf("=");E===-1&&(E=f);var M=E===f?0:4-E%4;return[E,M]}function e(_){var f=r(_),E=f[0],M=f[1];return(E+M)*3/4-M}function t(_,f,E){return(f+E)*3/4-E}function s(_){var f,E=r(_),M=E[0],A=E[1],z=new y(t(_,M,A)),j=0,x=A>0?M-4:M,O;for(O=0;O<x;O+=4)f=p[_.charCodeAt(O)]<<18|p[_.charCodeAt(O+1)]<<12|p[_.charCodeAt(O+2)]<<6|p[_.charCodeAt(O+3)],z[j++]=f>>16&255,z[j++]=f>>8&255,z[j++]=f&255;return A===2&&(f=p[_.charCodeAt(O)]<<2|p[_.charCodeAt(O+1)]>>4,z[j++]=f&255),A===1&&(f=p[_.charCodeAt(O)]<<10|p[_.charCodeAt(O+1)]<<4|p[_.charCodeAt(O+2)]>>2,z[j++]=f>>8&255,z[j++]=f&255),z}function u(_){return h[_>>18&63]+h[_>>12&63]+h[_>>6&63]+h[_&63]}function d(_,f,E){for(var M,A=[],z=f;z<E;z+=3)M=(_[z]<<16&16711680)+(_[z+1]<<8&65280)+(_[z+2]&255),A.push(u(M));return A.join("")}function g(_){for(var f,E=_.length,M=E%3,A=[],z=16383,j=0,x=E-M;j<x;j+=z)A.push(d(_,j,j+z>x?x:j+z));return M===1?(f=_[E-1],A.push(h[f>>2]+h[f<<4&63]+"==")):M===2&&(f=(_[E-2]<<8)+_[E-1],A.push(h[f>>10]+h[f>>4&63]+h[f<<2&63]+"=")),A.join("")}},{}],2:[function(m,T,v){},{}],3:[function(m,T,v){(function(h){(function(){"use strict";var p=m("base64-js"),y=m("ieee754");v.Buffer=r,v.SlowBuffer=M,v.INSPECT_MAX_BYTES=50;var c=2147483647;v.kMaxLength=c,r.TYPED_ARRAY_SUPPORT=o(),!r.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{var l=new Uint8Array(1);return l.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},l.foo()===42}catch{return!1}}Object.defineProperty(r.prototype,"parent",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.buffer}}),Object.defineProperty(r.prototype,"offset",{enumerable:!0,get:function(){if(r.isBuffer(this))return this.byteOffset}});function i(l){if(l>c)throw new RangeError('The value "'+l+'" is invalid for option "size"');var n=new Uint8Array(l);return n.__proto__=r.prototype,n}function r(l,n,a){if(typeof l=="number"){if(typeof n=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(l)}return e(l,n,a)}typeof Symbol<"u"&&Symbol.species!=null&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),r.poolSize=8192;function e(l,n,a){if(typeof l=="string")return d(l,n);if(ArrayBuffer.isView(l))return g(l);if(l==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(Y(l,ArrayBuffer)||l&&Y(l.buffer,ArrayBuffer))return _(l,n,a);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var w=l.valueOf&&l.valueOf();if(w!=null&&w!==l)return r.from(w,n,a);var D=f(l);if(D)return D;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return r.from(l[Symbol.toPrimitive]("string"),n,a);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}r.from=function(l,n,a){return e(l,n,a)},r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array;function t(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function s(l,n,a){return t(l),l<=0?i(l):n!==void 0?typeof a=="string"?i(l).fill(n,a):i(l).fill(n):i(l)}r.alloc=function(l,n,a){return s(l,n,a)};function u(l){return t(l),i(l<0?0:E(l)|0)}r.allocUnsafe=function(l){return u(l)},r.allocUnsafeSlow=function(l){return u(l)};function d(l,n){if((typeof n!="string"||n==="")&&(n="utf8"),!r.isEncoding(n))throw new TypeError("Unknown encoding: "+n);var a=A(l,n)|0,w=i(a),D=w.write(l,n);return D!==a&&(w=w.slice(0,D)),w}function g(l){for(var n=l.length<0?0:E(l.length)|0,a=i(n),w=0;w<n;w+=1)a[w]=l[w]&255;return a}function _(l,n,a){if(n<0||l.byteLength<n)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<n+(a||0))throw new RangeError('"length" is outside of buffer bounds');var w;return n===void 0&&a===void 0?w=new Uint8Array(l):a===void 0?w=new Uint8Array(l,n):w=new Uint8Array(l,n,a),w.__proto__=r.prototype,w}function f(l){if(r.isBuffer(l)){var n=E(l.length)|0,a=i(n);return a.length===0||l.copy(a,0,0,n),a}if(l.length!==void 0)return typeof l.length!="number"||b(l.length)?i(0):g(l);if(l.type==="Buffer"&&Array.isArray(l.data))return g(l.data)}function E(l){if(l>=c)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+c.toString(16)+" bytes");return l|0}function M(l){return+l!=l&&(l=0),r.alloc(+l)}r.isBuffer=function(n){return n!=null&&n._isBuffer===!0&&n!==r.prototype},r.compare=function(n,a){if(Y(n,Uint8Array)&&(n=r.from(n,n.offset,n.byteLength)),Y(a,Uint8Array)&&(a=r.from(a,a.offset,a.byteLength)),!r.isBuffer(n)||!r.isBuffer(a))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(n===a)return 0;for(var w=n.length,D=a.length,K=0,J=Math.min(w,D);K<J;++K)if(n[K]!==a[K]){w=n[K],D=a[K];break}return w<D?-1:D<w?1:0},r.isEncoding=function(n){switch(String(n).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.concat=function(n,a){if(!Array.isArray(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return r.alloc(0);var w;if(a===void 0)for(a=0,w=0;w<n.length;++w)a+=n[w].length;var D=r.allocUnsafe(a),K=0;for(w=0;w<n.length;++w){var J=n[w];if(Y(J,Uint8Array)&&(J=r.from(J)),!r.isBuffer(J))throw new TypeError('"list" argument must be an Array of Buffers');J.copy(D,K),K+=J.length}return D};function A(l,n){if(r.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||Y(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);var a=l.length,w=arguments.length>2&&arguments[2]===!0;if(!w&&a===0)return 0;for(var D=!1;;)switch(n){case"ascii":case"latin1":case"binary":return a;case"utf8":case"utf-8":return te(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a*2;case"hex":return a>>>1;case"base64":return N(l).length;default:if(D)return w?-1:te(l).length;n=(""+n).toLowerCase(),D=!0}}r.byteLength=A;function z(l,n,a){var w=!1;if((n===void 0||n<0)&&(n=0),n>this.length||((a===void 0||a>this.length)&&(a=this.length),a<=0)||(a>>>=0,n>>>=0,a<=n))return"";for(l||(l="utf8");;)switch(l){case"hex":return ee(this,n,a);case"utf8":case"utf-8":return S(this,n,a);case"ascii":return H(this,n,a);case"latin1":case"binary":return re(this,n,a);case"base64":return G(this,n,a);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,n,a);default:if(w)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),w=!0}}r.prototype._isBuffer=!0;function j(l,n,a){var w=l[n];l[n]=l[a],l[a]=w}r.prototype.swap16=function(){var n=this.length;if(n%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var a=0;a<n;a+=2)j(this,a,a+1);return this},r.prototype.swap32=function(){var n=this.length;if(n%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var a=0;a<n;a+=4)j(this,a,a+3),j(this,a+1,a+2);return this},r.prototype.swap64=function(){var n=this.length;if(n%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var a=0;a<n;a+=8)j(this,a,a+7),j(this,a+1,a+6),j(this,a+2,a+5),j(this,a+3,a+4);return this},r.prototype.toString=function(){var n=this.length;return n===0?"":arguments.length===0?S(this,0,n):z.apply(this,arguments)},r.prototype.toLocaleString=r.prototype.toString,r.prototype.equals=function(n){if(!r.isBuffer(n))throw new TypeError("Argument must be a Buffer");return this===n?!0:r.compare(this,n)===0},r.prototype.inspect=function(){var n="",a=v.INSPECT_MAX_BYTES;return n=this.toString("hex",0,a).replace(/(.{2})/g,"$1 ").trim(),this.length>a&&(n+=" ... "),"<Buffer "+n+">"},r.prototype.compare=function(n,a,w,D,K){if(Y(n,Uint8Array)&&(n=r.from(n,n.offset,n.byteLength)),!r.isBuffer(n))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof n);if(a===void 0&&(a=0),w===void 0&&(w=n?n.length:0),D===void 0&&(D=0),K===void 0&&(K=this.length),a<0||w>n.length||D<0||K>this.length)throw new RangeError("out of range index");if(D>=K&&a>=w)return 0;if(D>=K)return-1;if(a>=w)return 1;if(a>>>=0,w>>>=0,D>>>=0,K>>>=0,this===n)return 0;for(var J=K-D,ue=w-a,ce=Math.min(J,ue),fe=this.slice(D,K),ye=n.slice(a,w),he=0;he<ce;++he)if(fe[he]!==ye[he]){J=fe[he],ue=ye[he];break}return J<ue?-1:ue<J?1:0};function x(l,n,a,w,D){if(l.length===0)return-1;if(typeof a=="string"?(w=a,a=0):a>2147483647?a=2147483647:a<-2147483648&&(a=-2147483648),a=+a,b(a)&&(a=D?0:l.length-1),a<0&&(a=l.length+a),a>=l.length){if(D)return-1;a=l.length-1}else if(a<0)if(D)a=0;else return-1;if(typeof n=="string"&&(n=r.from(n,w)),r.isBuffer(n))return n.length===0?-1:O(l,n,a,w,D);if(typeof n=="number")return n=n&255,typeof Uint8Array.prototype.indexOf=="function"?D?Uint8Array.prototype.indexOf.call(l,n,a):Uint8Array.prototype.lastIndexOf.call(l,n,a):O(l,[n],a,w,D);throw new TypeError("val must be string, number or Buffer")}function O(l,n,a,w,D){var K=1,J=l.length,ue=n.length;if(w!==void 0&&(w=String(w).toLowerCase(),w==="ucs2"||w==="ucs-2"||w==="utf16le"||w==="utf-16le")){if(l.length<2||n.length<2)return-1;K=2,J/=2,ue/=2,a/=2}function ce(Pe,xe){return K===1?Pe[xe]:Pe.readUInt16BE(xe*K)}var fe;if(D){var ye=-1;for(fe=a;fe<J;fe++)if(ce(l,fe)===ce(n,ye===-1?0:fe-ye)){if(ye===-1&&(ye=fe),fe-ye+1===ue)return ye*K}else ye!==-1&&(fe-=fe-ye),ye=-1}else for(a+ue>J&&(a=J-ue),fe=a;fe>=0;fe--){for(var he=!0,Ce=0;Ce<ue;Ce++)if(ce(l,fe+Ce)!==ce(n,Ce)){he=!1;break}if(he)return fe}return-1}r.prototype.includes=function(n,a,w){return this.indexOf(n,a,w)!==-1},r.prototype.indexOf=function(n,a,w){return x(this,n,a,w,!0)},r.prototype.lastIndexOf=function(n,a,w){return x(this,n,a,w,!1)};function C(l,n,a,w){a=Number(a)||0;var D=l.length-a;w?(w=Number(w),w>D&&(w=D)):w=D;var K=n.length;w>K/2&&(w=K/2);for(var J=0;J<w;++J){var ue=parseInt(n.substr(J*2,2),16);if(b(ue))return J;l[a+J]=ue}return J}function V(l,n,a,w){return q(te(n,l.length-a),l,a,w)}function B(l,n,a,w){return q(R(n),l,a,w)}function ne(l,n,a,w){return B(l,n,a,w)}function oe(l,n,a,w){return q(N(n),l,a,w)}function ie(l,n,a,w){return q(I(n,l.length-a),l,a,w)}r.prototype.write=function(n,a,w,D){if(a===void 0)D="utf8",w=this.length,a=0;else if(w===void 0&&typeof a=="string")D=a,w=this.length,a=0;else if(isFinite(a))a=a>>>0,isFinite(w)?(w=w>>>0,D===void 0&&(D="utf8")):(D=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var K=this.length-a;if((w===void 0||w>K)&&(w=K),n.length>0&&(w<0||a<0)||a>this.length)throw new RangeError("Attempt to write outside buffer bounds");D||(D="utf8");for(var J=!1;;)switch(D){case"hex":return C(this,n,a,w);case"utf8":case"utf-8":return V(this,n,a,w);case"ascii":return B(this,n,a,w);case"latin1":case"binary":return ne(this,n,a,w);case"base64":return oe(this,n,a,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ie(this,n,a,w);default:if(J)throw new TypeError("Unknown encoding: "+D);D=(""+D).toLowerCase(),J=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function G(l,n,a){return n===0&&a===l.length?p.fromByteArray(l):p.fromByteArray(l.slice(n,a))}function S(l,n,a){a=Math.min(l.length,a);for(var w=[],D=n;D<a;){var K=l[D],J=null,ue=K>239?4:K>223?3:K>191?2:1;if(D+ue<=a){var ce,fe,ye,he;switch(ue){case 1:K<128&&(J=K);break;case 2:ce=l[D+1],(ce&192)===128&&(he=(K&31)<<6|ce&63,he>127&&(J=he));break;case 3:ce=l[D+1],fe=l[D+2],(ce&192)===128&&(fe&192)===128&&(he=(K&15)<<12|(ce&63)<<6|fe&63,he>2047&&(he<55296||he>57343)&&(J=he));break;case 4:ce=l[D+1],fe=l[D+2],ye=l[D+3],(ce&192)===128&&(fe&192)===128&&(ye&192)===128&&(he=(K&15)<<18|(ce&63)<<12|(fe&63)<<6|ye&63,he>65535&&he<1114112&&(J=he))}}J===null?(J=65533,ue=1):J>65535&&(J-=65536,w.push(J>>>10&1023|55296),J=56320|J&1023),w.push(J),D+=ue}return L(w)}var P=4096;function L(l){var n=l.length;if(n<=P)return String.fromCharCode.apply(String,l);for(var a="",w=0;w<n;)a+=String.fromCharCode.apply(String,l.slice(w,w+=P));return a}function H(l,n,a){var w="";a=Math.min(l.length,a);for(var D=n;D<a;++D)w+=String.fromCharCode(l[D]&127);return w}function re(l,n,a){var w="";a=Math.min(l.length,a);for(var D=n;D<a;++D)w+=String.fromCharCode(l[D]);return w}function ee(l,n,a){var w=l.length;(!n||n<0)&&(n=0),(!a||a<0||a>w)&&(a=w);for(var D="",K=n;K<a;++K)D+=Q(l[K]);return D}function W(l,n,a){for(var w=l.slice(n,a),D="",K=0;K<w.length;K+=2)D+=String.fromCharCode(w[K]+w[K+1]*256);return D}r.prototype.slice=function(n,a){var w=this.length;n=~~n,a=a===void 0?w:~~a,n<0?(n+=w,n<0&&(n=0)):n>w&&(n=w),a<0?(a+=w,a<0&&(a=0)):a>w&&(a=w),a<n&&(a=n);var D=this.subarray(n,a);return D.__proto__=r.prototype,D};function U(l,n,a){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+n>a)throw new RangeError("Trying to access beyond buffer length")}r.prototype.readUIntLE=function(n,a,w){n=n>>>0,a=a>>>0,w||U(n,a,this.length);for(var D=this[n],K=1,J=0;++J<a&&(K*=256);)D+=this[n+J]*K;return D},r.prototype.readUIntBE=function(n,a,w){n=n>>>0,a=a>>>0,w||U(n,a,this.length);for(var D=this[n+--a],K=1;a>0&&(K*=256);)D+=this[n+--a]*K;return D},r.prototype.readUInt8=function(n,a){return n=n>>>0,a||U(n,1,this.length),this[n]},r.prototype.readUInt16LE=function(n,a){return n=n>>>0,a||U(n,2,this.length),this[n]|this[n+1]<<8},r.prototype.readUInt16BE=function(n,a){return n=n>>>0,a||U(n,2,this.length),this[n]<<8|this[n+1]},r.prototype.readUInt32LE=function(n,a){return n=n>>>0,a||U(n,4,this.length),(this[n]|this[n+1]<<8|this[n+2]<<16)+this[n+3]*16777216},r.prototype.readUInt32BE=function(n,a){return n=n>>>0,a||U(n,4,this.length),this[n]*16777216+(this[n+1]<<16|this[n+2]<<8|this[n+3])},r.prototype.readIntLE=function(n,a,w){n=n>>>0,a=a>>>0,w||U(n,a,this.length);for(var D=this[n],K=1,J=0;++J<a&&(K*=256);)D+=this[n+J]*K;return K*=128,D>=K&&(D-=Math.pow(2,8*a)),D},r.prototype.readIntBE=function(n,a,w){n=n>>>0,a=a>>>0,w||U(n,a,this.length);for(var D=a,K=1,J=this[n+--D];D>0&&(K*=256);)J+=this[n+--D]*K;return K*=128,J>=K&&(J-=Math.pow(2,8*a)),J},r.prototype.readInt8=function(n,a){return n=n>>>0,a||U(n,1,this.length),this[n]&128?(255-this[n]+1)*-1:this[n]},r.prototype.readInt16LE=function(n,a){n=n>>>0,a||U(n,2,this.length);var w=this[n]|this[n+1]<<8;return w&32768?w|4294901760:w},r.prototype.readInt16BE=function(n,a){n=n>>>0,a||U(n,2,this.length);var w=this[n+1]|this[n]<<8;return w&32768?w|4294901760:w},r.prototype.readInt32LE=function(n,a){return n=n>>>0,a||U(n,4,this.length),this[n]|this[n+1]<<8|this[n+2]<<16|this[n+3]<<24},r.prototype.readInt32BE=function(n,a){return n=n>>>0,a||U(n,4,this.length),this[n]<<24|this[n+1]<<16|this[n+2]<<8|this[n+3]},r.prototype.readFloatLE=function(n,a){return n=n>>>0,a||U(n,4,this.length),y.read(this,n,!0,23,4)},r.prototype.readFloatBE=function(n,a){return n=n>>>0,a||U(n,4,this.length),y.read(this,n,!1,23,4)},r.prototype.readDoubleLE=function(n,a){return n=n>>>0,a||U(n,8,this.length),y.read(this,n,!0,52,8)},r.prototype.readDoubleBE=function(n,a){return n=n>>>0,a||U(n,8,this.length),y.read(this,n,!1,52,8)};function X(l,n,a,w,D,K){if(!r.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(n>D||n<K)throw new RangeError('"value" argument is out of bounds');if(a+w>l.length)throw new RangeError("Index out of range")}r.prototype.writeUIntLE=function(n,a,w,D){if(n=+n,a=a>>>0,w=w>>>0,!D){var K=Math.pow(2,8*w)-1;X(this,n,a,w,K,0)}var J=1,ue=0;for(this[a]=n&255;++ue<w&&(J*=256);)this[a+ue]=n/J&255;return a+w},r.prototype.writeUIntBE=function(n,a,w,D){if(n=+n,a=a>>>0,w=w>>>0,!D){var K=Math.pow(2,8*w)-1;X(this,n,a,w,K,0)}var J=w-1,ue=1;for(this[a+J]=n&255;--J>=0&&(ue*=256);)this[a+J]=n/ue&255;return a+w},r.prototype.writeUInt8=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,1,255,0),this[a]=n&255,a+1},r.prototype.writeUInt16LE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,2,65535,0),this[a]=n&255,this[a+1]=n>>>8,a+2},r.prototype.writeUInt16BE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,2,65535,0),this[a]=n>>>8,this[a+1]=n&255,a+2},r.prototype.writeUInt32LE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,4,4294967295,0),this[a+3]=n>>>24,this[a+2]=n>>>16,this[a+1]=n>>>8,this[a]=n&255,a+4},r.prototype.writeUInt32BE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,4,4294967295,0),this[a]=n>>>24,this[a+1]=n>>>16,this[a+2]=n>>>8,this[a+3]=n&255,a+4},r.prototype.writeIntLE=function(n,a,w,D){if(n=+n,a=a>>>0,!D){var K=Math.pow(2,8*w-1);X(this,n,a,w,K-1,-K)}var J=0,ue=1,ce=0;for(this[a]=n&255;++J<w&&(ue*=256);)n<0&&ce===0&&this[a+J-1]!==0&&(ce=1),this[a+J]=(n/ue>>0)-ce&255;return a+w},r.prototype.writeIntBE=function(n,a,w,D){if(n=+n,a=a>>>0,!D){var K=Math.pow(2,8*w-1);X(this,n,a,w,K-1,-K)}var J=w-1,ue=1,ce=0;for(this[a+J]=n&255;--J>=0&&(ue*=256);)n<0&&ce===0&&this[a+J+1]!==0&&(ce=1),this[a+J]=(n/ue>>0)-ce&255;return a+w},r.prototype.writeInt8=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,1,127,-128),n<0&&(n=255+n+1),this[a]=n&255,a+1},r.prototype.writeInt16LE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,2,32767,-32768),this[a]=n&255,this[a+1]=n>>>8,a+2},r.prototype.writeInt16BE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,2,32767,-32768),this[a]=n>>>8,this[a+1]=n&255,a+2},r.prototype.writeInt32LE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,4,2147483647,-2147483648),this[a]=n&255,this[a+1]=n>>>8,this[a+2]=n>>>16,this[a+3]=n>>>24,a+4},r.prototype.writeInt32BE=function(n,a,w){return n=+n,a=a>>>0,w||X(this,n,a,4,2147483647,-2147483648),n<0&&(n=4294967295+n+1),this[a]=n>>>24,this[a+1]=n>>>16,this[a+2]=n>>>8,this[a+3]=n&255,a+4};function $(l,n,a,w,D,K){if(a+w>l.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("Index out of range")}function le(l,n,a,w,D){return n=+n,a=a>>>0,D||$(l,n,a,4,34028234663852886e22,-34028234663852886e22),y.write(l,n,a,w,23,4),a+4}r.prototype.writeFloatLE=function(n,a,w){return le(this,n,a,!0,w)},r.prototype.writeFloatBE=function(n,a,w){return le(this,n,a,!1,w)};function Z(l,n,a,w,D){return n=+n,a=a>>>0,D||$(l,n,a,8,17976931348623157e292,-17976931348623157e292),y.write(l,n,a,w,52,8),a+8}r.prototype.writeDoubleLE=function(n,a,w){return Z(this,n,a,!0,w)},r.prototype.writeDoubleBE=function(n,a,w){return Z(this,n,a,!1,w)},r.prototype.copy=function(n,a,w,D){if(!r.isBuffer(n))throw new TypeError("argument should be a Buffer");if(w||(w=0),!D&&D!==0&&(D=this.length),a>=n.length&&(a=n.length),a||(a=0),D>0&&D<w&&(D=w),D===w||n.length===0||this.length===0)return 0;if(a<0)throw new RangeError("targetStart out of bounds");if(w<0||w>=this.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("sourceEnd out of bounds");D>this.length&&(D=this.length),n.length-a<D-w&&(D=n.length-a+w);var K=D-w;if(this===n&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(a,w,D);else if(this===n&&w<a&&a<D)for(var J=K-1;J>=0;--J)n[J+a]=this[J+w];else Uint8Array.prototype.set.call(n,this.subarray(w,D),a);return K},r.prototype.fill=function(n,a,w,D){if(typeof n=="string"){if(typeof a=="string"?(D=a,a=0,w=this.length):typeof w=="string"&&(D=w,w=this.length),D!==void 0&&typeof D!="string")throw new TypeError("encoding must be a string");if(typeof D=="string"&&!r.isEncoding(D))throw new TypeError("Unknown encoding: "+D);if(n.length===1){var K=n.charCodeAt(0);(D==="utf8"&&K<128||D==="latin1")&&(n=K)}}else typeof n=="number"&&(n=n&255);if(a<0||this.length<a||this.length<w)throw new RangeError("Out of range index");if(w<=a)return this;a=a>>>0,w=w===void 0?this.length:w>>>0,n||(n=0);var J;if(typeof n=="number")for(J=a;J<w;++J)this[J]=n;else{var ue=r.isBuffer(n)?n:r.from(n,D),ce=ue.length;if(ce===0)throw new TypeError('The value "'+n+'" is invalid for argument "value"');for(J=0;J<w-a;++J)this[J+a]=ue[J%ce]}return this};var F=/[^+/0-9A-Za-z-_]/g;function k(l){if(l=l.split("=")[0],l=l.trim().replace(F,""),l.length<2)return"";for(;l.length%4!==0;)l=l+"=";return l}function Q(l){return l<16?"0"+l.toString(16):l.toString(16)}function te(l,n){n=n||1/0;for(var a,w=l.length,D=null,K=[],J=0;J<w;++J){if(a=l.charCodeAt(J),a>55295&&a<57344){if(!D){if(a>56319){(n-=3)>-1&&K.push(239,191,189);continue}else if(J+1===w){(n-=3)>-1&&K.push(239,191,189);continue}D=a;continue}if(a<56320){(n-=3)>-1&&K.push(239,191,189),D=a;continue}a=(D-55296<<10|a-56320)+65536}else D&&(n-=3)>-1&&K.push(239,191,189);if(D=null,a<128){if((n-=1)<0)break;K.push(a)}else if(a<2048){if((n-=2)<0)break;K.push(a>>6|192,a&63|128)}else if(a<65536){if((n-=3)<0)break;K.push(a>>12|224,a>>6&63|128,a&63|128)}else if(a<1114112){if((n-=4)<0)break;K.push(a>>18|240,a>>12&63|128,a>>6&63|128,a&63|128)}else throw new Error("Invalid code point")}return K}function R(l){for(var n=[],a=0;a<l.length;++a)n.push(l.charCodeAt(a)&255);return n}function I(l,n){for(var a,w,D,K=[],J=0;J<l.length&&!((n-=2)<0);++J)a=l.charCodeAt(J),w=a>>8,D=a%256,K.push(D),K.push(w);return K}function N(l){return p.toByteArray(k(l))}function q(l,n,a,w){for(var D=0;D<w&&!(D+a>=n.length||D>=l.length);++D)n[D+a]=l[D];return D}function Y(l,n){return l instanceof n||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===n.name}function b(l){return l!==l}}).call(this)}).call(this,m("buffer").Buffer)},{"base64-js":1,buffer:3,ieee754:5}],4:[function(m,T,v){"use strict";var h=typeof Reflect=="object"?Reflect:null,p=h&&typeof h.apply=="function"?h.apply:function(O,C,V){return Function.prototype.apply.call(O,C,V)},y;h&&typeof h.ownKeys=="function"?y=h.ownKeys:Object.getOwnPropertySymbols?y=function(O){return Object.getOwnPropertyNames(O).concat(Object.getOwnPropertySymbols(O))}:y=function(O){return Object.getOwnPropertyNames(O)};function c(x){console&&console.warn&&console.warn(x)}var o=Number.isNaN||function(O){return O!==O};function i(){i.init.call(this)}T.exports=i,T.exports.once=A,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var r=10;function e(x){if(typeof x!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof x)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return r},set:function(x){if(typeof x!="number"||x<0||o(x))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+x+".");r=x}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(O){if(typeof O!="number"||O<0||o(O))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+O+".");return this._maxListeners=O,this};function t(x){return x._maxListeners===void 0?i.defaultMaxListeners:x._maxListeners}i.prototype.getMaxListeners=function(){return t(this)},i.prototype.emit=function(O){for(var C=[],V=1;V<arguments.length;V++)C.push(arguments[V]);var B=O==="error",ne=this._events;if(ne!==void 0)B=B&&ne.error===void 0;else if(!B)return!1;if(B){var oe;if(C.length>0&&(oe=C[0]),oe instanceof Error)throw oe;var ie=new Error("Unhandled error."+(oe?" ("+oe.message+")":""));throw ie.context=oe,ie}var G=ne[O];if(G===void 0)return!1;if(typeof G=="function")p(G,this,C);else for(var S=G.length,P=f(G,S),V=0;V<S;++V)p(P[V],this,C);return!0};function s(x,O,C,V){var B,ne,oe;if(e(C),ne=x._events,ne===void 0?(ne=x._events=Object.create(null),x._eventsCount=0):(ne.newListener!==void 0&&(x.emit("newListener",O,C.listener?C.listener:C),ne=x._events),oe=ne[O]),oe===void 0)oe=ne[O]=C,++x._eventsCount;else if(typeof oe=="function"?oe=ne[O]=V?[C,oe]:[oe,C]:V?oe.unshift(C):oe.push(C),B=t(x),B>0&&oe.length>B&&!oe.warned){oe.warned=!0;var ie=new Error("Possible EventEmitter memory leak detected. "+oe.length+" "+String(O)+" listeners added. Use emitter.setMaxListeners() to increase limit");ie.name="MaxListenersExceededWarning",ie.emitter=x,ie.type=O,ie.count=oe.length,c(ie)}return x}i.prototype.addListener=function(O,C){return s(this,O,C,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(O,C){return s(this,O,C,!0)};function u(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function d(x,O,C){var V={fired:!1,wrapFn:void 0,target:x,type:O,listener:C},B=u.bind(V);return B.listener=C,V.wrapFn=B,B}i.prototype.once=function(O,C){return e(C),this.on(O,d(this,O,C)),this},i.prototype.prependOnceListener=function(O,C){return e(C),this.prependListener(O,d(this,O,C)),this},i.prototype.removeListener=function(O,C){var V,B,ne,oe,ie;if(e(C),B=this._events,B===void 0)return this;if(V=B[O],V===void 0)return this;if(V===C||V.listener===C)--this._eventsCount===0?this._events=Object.create(null):(delete B[O],B.removeListener&&this.emit("removeListener",O,V.listener||C));else if(typeof V!="function"){for(ne=-1,oe=V.length-1;oe>=0;oe--)if(V[oe]===C||V[oe].listener===C){ie=V[oe].listener,ne=oe;break}if(ne<0)return this;ne===0?V.shift():E(V,ne),V.length===1&&(B[O]=V[0]),B.removeListener!==void 0&&this.emit("removeListener",O,ie||C)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(O){var C,V,B;if(V=this._events,V===void 0)return this;if(V.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):V[O]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete V[O]),this;if(arguments.length===0){var ne=Object.keys(V),oe;for(B=0;B<ne.length;++B)oe=ne[B],oe!=="removeListener"&&this.removeAllListeners(oe);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(C=V[O],typeof C=="function")this.removeListener(O,C);else if(C!==void 0)for(B=C.length-1;B>=0;B--)this.removeListener(O,C[B]);return this};function g(x,O,C){var V=x._events;if(V===void 0)return[];var B=V[O];return B===void 0?[]:typeof B=="function"?C?[B.listener||B]:[B]:C?M(B):f(B,B.length)}i.prototype.listeners=function(O){return g(this,O,!0)},i.prototype.rawListeners=function(O){return g(this,O,!1)},i.listenerCount=function(x,O){return typeof x.listenerCount=="function"?x.listenerCount(O):_.call(x,O)},i.prototype.listenerCount=_;function _(x){var O=this._events;if(O!==void 0){var C=O[x];if(typeof C=="function")return 1;if(C!==void 0)return C.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?y(this._events):[]};function f(x,O){for(var C=new Array(O),V=0;V<O;++V)C[V]=x[V];return C}function E(x,O){for(;O+1<x.length;O++)x[O]=x[O+1];x.pop()}function M(x){for(var O=new Array(x.length),C=0;C<O.length;++C)O[C]=x[C].listener||x[C];return O}function A(x,O){return new Promise(function(C,V){function B(oe){x.removeListener(O,ne),V(oe)}function ne(){typeof x.removeListener=="function"&&x.removeListener("error",B),C([].slice.call(arguments))}j(x,O,ne,{once:!0}),O!=="error"&&z(x,B,{once:!0})})}function z(x,O,C){typeof x.on=="function"&&j(x,"error",O,C)}function j(x,O,C,V){if(typeof x.on=="function")V.once?x.once(O,C):x.on(O,C);else if(typeof x.addEventListener=="function")x.addEventListener(O,function B(ne){V.once&&x.removeEventListener(O,B),C(ne)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof x)}},{}],5:[function(m,T,v){v.read=function(h,p,y,c,o){var i,r,e=o*8-c-1,t=(1<<e)-1,s=t>>1,u=-7,d=y?o-1:0,g=y?-1:1,_=h[p+d];for(d+=g,i=_&(1<<-u)-1,_>>=-u,u+=e;u>0;i=i*256+h[p+d],d+=g,u-=8);for(r=i&(1<<-u)-1,i>>=-u,u+=c;u>0;r=r*256+h[p+d],d+=g,u-=8);if(i===0)i=1-s;else{if(i===t)return r?NaN:(_?-1:1)*(1/0);r=r+Math.pow(2,c),i=i-s}return(_?-1:1)*r*Math.pow(2,i-c)},v.write=function(h,p,y,c,o,i){var r,e,t,s=i*8-o-1,u=(1<<s)-1,d=u>>1,g=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=c?0:i-1,f=c?1:-1,E=p<0||p===0&&1/p<0?1:0;for(p=Math.abs(p),isNaN(p)||p===1/0?(e=isNaN(p)?1:0,r=u):(r=Math.floor(Math.log(p)/Math.LN2),p*(t=Math.pow(2,-r))<1&&(r--,t*=2),r+d>=1?p+=g/t:p+=g*Math.pow(2,1-d),p*t>=2&&(r++,t/=2),r+d>=u?(e=0,r=u):r+d>=1?(e=(p*t-1)*Math.pow(2,o),r=r+d):(e=p*Math.pow(2,d-1)*Math.pow(2,o),r=0));o>=8;h[y+_]=e&255,_+=f,e/=256,o-=8);for(r=r<<o|e,s+=o;s>0;h[y+_]=r&255,_+=f,r/=256,s-=8);h[y+_-f]|=E*128}},{}],6:[function(m,T,v){(function(h,p){(function(){"use strict";let y=m("events").EventEmitter,c=m("./store"),o=m("./topic-alias-recv"),i=m("./topic-alias-send"),r=m("mqtt-packet"),e=m("./default-message-id-provider"),t=m("readable-stream").Writable,s=m("inherits"),u=m("reinterval"),d=m("rfdc/default"),g=m("./validations"),_=m("xtend"),f=m("debug")("mqttjs:client"),E=h?h.nextTick:function(S){setTimeout(S,0)},M=p.setImmediate||function(S){E(S)},A={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:30*1e3,clean:!0,resubscribe:!0},z=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],j={0:"",1:"Unacceptable protocol version",2:"Identifier rejected",3:"Server unavailable",4:"Bad username or password",5:"Not authorized",16:"No matching subscribers",17:"No subscription existed",128:"Unspecified error",129:"Malformed Packet",130:"Protocol Error",131:"Implementation specific error",132:"Unsupported Protocol Version",133:"Client Identifier not valid",134:"Bad User Name or Password",135:"Not authorized",136:"Server unavailable",137:"Server busy",138:"Banned",139:"Server shutting down",140:"Bad authentication method",141:"Keep Alive timeout",142:"Session taken over",143:"Topic Filter invalid",144:"Topic Name invalid",145:"Packet identifier in use",146:"Packet Identifier not found",147:"Receive Maximum exceeded",148:"Topic Alias invalid",149:"Packet too large",150:"Message rate too high",151:"Quota exceeded",152:"Administrative action",153:"Payload format invalid",154:"Retain not supported",155:"QoS not supported",156:"Use another server",157:"Server moved",158:"Shared Subscriptions not supported",159:"Connection rate exceeded",160:"Maximum connect time",161:"Subscription Identifiers not supported",162:"Wildcard Subscriptions not supported"};function x(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function O(S,P){if(S.options.protocolVersion===5&&P.cmd==="publish"){let L;P.properties&&(L=P.properties.topicAlias);let H=P.topic.toString();if(S.topicAliasSend)if(L){if(H.length!==0&&(f("applyTopicAlias :: register topic: %s - alias: %d",H,L),!S.topicAliasSend.put(H,L)))return f("applyTopicAlias :: error out of range. topic: %s - alias: %d",H,L),new Error("Sending Topic Alias out of range")}else H.length!==0&&(S.options.autoAssignTopicAlias?(L=S.topicAliasSend.getAliasByTopic(H),L?(P.topic="",P.properties=wt(bt({},P.properties),{topicAlias:L}),f("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",H,L)):(L=S.topicAliasSend.getLruAlias(),S.topicAliasSend.put(H,L),P.properties=wt(bt({},P.properties),{topicAlias:L}),f("applyTopicAlias :: auto assign topic: %s - alias: %d",H,L))):S.options.autoUseTopicAlias&&(L=S.topicAliasSend.getAliasByTopic(H),L&&(P.topic="",P.properties=wt(bt({},P.properties),{topicAlias:L}),f("applyTopicAlias :: auto use topic: %s - alias: %d",H,L))));else if(L)return f("applyTopicAlias :: error out of range. topic: %s - alias: %d",H,L),new Error("Sending Topic Alias out of range")}}function C(S,P){let L;P.properties&&(L=P.properties.topicAlias);let H=P.topic.toString();if(H.length===0){if(typeof L>"u")return new Error("Unregistered Topic Alias");if(H=S.topicAliasSend.getTopicByAlias(L),typeof H>"u")return new Error("Unregistered Topic Alias");P.topic=H}L&&delete P.properties.topicAlias}function V(S,P,L){f("sendPacket :: packet: %O",P),f("sendPacket :: emitting `packetsend`"),S.emit("packetsend",P),f("sendPacket :: writing to stream");let H=r.writeToStream(P,S.stream,S.options);f("sendPacket :: writeToStream result %s",H),!H&&L&&L!==ie?(f("sendPacket :: handle events on `drain` once through callback."),S.stream.once("drain",L)):L&&(f("sendPacket :: invoking cb"),L())}function B(S){S&&(f("flush: queue exists? %b",!!S),Object.keys(S).forEach(function(P){typeof S[P].cb=="function"&&(S[P].cb(new Error("Connection closed")),delete S[P])}))}function ne(S){S&&(f("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(S).forEach(function(P){S[P].volatile&&typeof S[P].cb=="function"&&(S[P].cb(new Error("Connection closed")),delete S[P])}))}function oe(S,P,L,H){f("storeAndSend :: store packet with cmd %s to outgoingStore",P.cmd);let re=P,ee;if(re.cmd==="publish"&&(re=d(P),ee=C(S,re),ee))return L&&L(ee);S.outgoingStore.put(re,function(U){if(U)return L&&L(U);H(),V(S,P,L)})}function ie(S){f("nop ::",S)}function G(S,P){let L,H=this;if(!(this instanceof G))return new G(S,P);this.options=P||{};for(L in A)typeof this.options[L]>"u"?this.options[L]=A[L]:this.options[L]=P[L];f("MqttClient :: options.protocol",P.protocol),f("MqttClient :: options.protocolVersion",P.protocolVersion),f("MqttClient :: options.username",P.username),f("MqttClient :: options.keepalive",P.keepalive),f("MqttClient :: options.reconnectPeriod",P.reconnectPeriod),f("MqttClient :: options.rejectUnauthorized",P.rejectUnauthorized),f("MqttClient :: options.topicAliasMaximum",P.topicAliasMaximum),this.options.clientId=typeof P.clientId=="string"?P.clientId:x(),f("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=P.protocolVersion===5&&P.customHandleAcks?P.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=S,this.messageIdProvider=typeof this.options.messageIdProvider>"u"?new e:this.options.messageIdProvider,this.outgoingStore=P.outgoingStore||new c,this.incomingStore=P.incomingStore||new c,this.queueQoSZero=P.queueQoSZero===void 0?!0:P.queueQoSZero,this._resubscribeTopics={},this.messageIdToTopic={},this.pingTimer=null,this.connected=!1,this.disconnecting=!1,this.queue=[],this.connackTimer=null,this.reconnectTimer=null,this._storeProcessing=!1,this._packetIdsDuringStoreProcessing={},this._storeProcessingQueue=[],this.outgoing={},this._firstConnection=!0,P.topicAliasMaximum>0&&(P.topicAliasMaximum>65535?f("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new o(P.topicAliasMaximum)),this.on("connect",function(){let re=this.queue;function ee(){let W=re.shift();f("deliver :: entry %o",W);let U=null;if(!W){H._resubscribe();return}U=W.packet,f("deliver :: call _sendPacket for %o",U);let X=!0;U.messageId&&U.messageId!==0&&(H.messageIdProvider.register(U.messageId)||(X=!1)),X?H._sendPacket(U,function($){W.cb&&W.cb($),ee()}):(f("messageId: %d has already used. The message is skipped and removed.",U.messageId),ee())}f("connect :: sending queued packets"),ee()}),this.on("close",function(){f("close :: connected set to `false`"),this.connected=!1,f("close :: clearing connackTimer"),clearTimeout(this.connackTimer),f("close :: clearing ping timer"),H.pingTimer!==null&&(H.pingTimer.clear(),H.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),f("close :: calling _setupReconnect"),this._setupReconnect()}),y.call(this),f("MqttClient :: setting up stream"),this._setupStream()}s(G,y),G.prototype._setupStream=function(){let S=this,P=new t,L=r.parser(this.options),H=null,re=[];f("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),f("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),L.on("packet",function($){f("parser :: on packet push to packets array."),re.push($)});function ee(){if(re.length)E(W);else{let $=H;H=null,$()}}function W(){f("work :: getting next packet in queue");let $=re.shift();if($)f("work :: packet pulled from queue"),S._handlePacket($,ee);else{f("work :: no packets in queue");let le=H;H=null,f("work :: done flag is %s",!!le),le&&le()}}P._write=function($,le,Z){H=Z,f("writable stream :: parsing buffer"),L.parse($),W()};function U($){f("streamErrorHandler :: error",$.message),z.includes($.code)?(f("streamErrorHandler :: emitting error"),S.emit("error",$)):ie($)}f("_setupStream :: pipe stream to writable stream"),this.stream.pipe(P),this.stream.on("error",U),this.stream.on("close",function(){f("(%s)stream :: on close",S.options.clientId),ne(S.outgoing),f("stream: emit close to MqttClient"),S.emit("close")}),f("_setupStream: sending packet `connect`");let X=Object.create(this.options);if(X.cmd="connect",this.topicAliasRecv&&(X.properties||(X.properties={}),this.topicAliasRecv&&(X.properties.topicAliasMaximum=this.topicAliasRecv.max)),V(this,X),L.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return S.end(()=>this.emit("error",new Error("Packet has no Authentication Method"))),this;if(this.options.properties.authenticationMethod&&this.options.authPacket&&typeof this.options.authPacket=="object"){let $=_({cmd:"auth",reasonCode:0},this.options.authPacket);V(this,$)}}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout(function(){f("!!connectTimeout hit!! Calling _cleanUp with force `true`"),S._cleanUp(!0)},this.options.connectTimeout)},G.prototype._handlePacket=function(S,P){let L=this.options;if(L.protocolVersion===5&&L.properties&&L.properties.maximumPacketSize&&L.properties.maximumPacketSize<S.length)return this.emit("error",new Error("exceeding packets size "+S.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(f("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",S),S.cmd){case"publish":this._handlePublish(S,P);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(S),P();break;case"pubrel":this._handlePubrel(S,P);break;case"connack":this._handleConnack(S),P();break;case"auth":this._handleAuth(S),P();break;case"pingresp":this._handlePingresp(S),P();break;case"disconnect":this._handleDisconnect(S),P();break;default:break}},G.prototype._checkDisconnecting=function(S){return this.disconnecting&&(S&&S!==ie?S(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},G.prototype.publish=function(S,P,L,H){f("publish :: message `%s` to topic `%s`",P,S);let re=this.options;if(typeof L=="function"&&(H=L,L=null),L=_({qos:0,retain:!1,dup:!1},L),this._checkDisconnecting(H))return this;let W=this,U=function(){let X=0;if((L.qos===1||L.qos===2)&&(X=W._nextId(),X===null))return f("No messageId left"),!1;let $={cmd:"publish",topic:S,payload:P,qos:L.qos,retain:L.retain,messageId:X,dup:L.dup};switch(re.protocolVersion===5&&($.properties=L.properties),f("publish :: qos",L.qos),L.qos){case 1:case 2:W.outgoing[$.messageId]={volatile:!1,cb:H||ie},f("MqttClient:publish: packet cmd: %s",$.cmd),W._sendPacket($,void 0,L.cbStorePut);break;default:f("MqttClient:publish: packet cmd: %s",$.cmd),W._sendPacket($,H,L.cbStorePut);break}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!U())&&this._storeProcessingQueue.push({invoke:U,cbStorePut:L.cbStorePut,callback:H}),this},G.prototype.subscribe=function(){let S=this,P=new Array(arguments.length);for(let Z=0;Z<arguments.length;Z++)P[Z]=arguments[Z];let L=[],H=P.shift(),re=H.resubscribe,ee=P.pop()||ie,W=P.pop(),U=this.options.protocolVersion;delete H.resubscribe,typeof H=="string"&&(H=[H]),typeof ee!="function"&&(W=ee,ee=ie);let X=g.validateTopics(H);if(X!==null)return M(ee,new Error("Invalid topic "+X)),this;if(this._checkDisconnecting(ee))return f("subscribe: discconecting true"),this;let $={qos:0};if(U===5&&($.nl=!1,$.rap=!1,$.rh=0),W=_($,W),Array.isArray(H)?H.forEach(function(Z){if(f("subscribe: array topic %s",Z),!Object.prototype.hasOwnProperty.call(S._resubscribeTopics,Z)||S._resubscribeTopics[Z].qos<W.qos||re){let F={topic:Z,qos:W.qos};U===5&&(F.nl=W.nl,F.rap=W.rap,F.rh=W.rh,F.properties=W.properties),f("subscribe: pushing topic `%s` and qos `%s` to subs list",F.topic,F.qos),L.push(F)}}):Object.keys(H).forEach(function(Z){if(f("subscribe: object topic %s",Z),!Object.prototype.hasOwnProperty.call(S._resubscribeTopics,Z)||S._resubscribeTopics[Z].qos<H[Z].qos||re){let F={topic:Z,qos:H[Z].qos};U===5&&(F.nl=H[Z].nl,F.rap=H[Z].rap,F.rh=H[Z].rh,F.properties=W.properties),f("subscribe: pushing `%s` to subs list",F),L.push(F)}}),!L.length)return ee(null,[]),this;let le=function(){let Z=S._nextId();if(Z===null)return f("No messageId left"),!1;let F={cmd:"subscribe",subscriptions:L,qos:1,retain:!1,dup:!1,messageId:Z};if(W.properties&&(F.properties=W.properties),S.options.resubscribe){f("subscribe :: resubscribe true");let k=[];L.forEach(function(Q){if(S.options.reconnectPeriod>0){let te={qos:Q.qos};U===5&&(te.nl=Q.nl||!1,te.rap=Q.rap||!1,te.rh=Q.rh||0,te.properties=Q.properties),S._resubscribeTopics[Q.topic]=te,k.push(Q.topic)}}),S.messageIdToTopic[F.messageId]=k}return S.outgoing[F.messageId]={volatile:!0,cb:function(k,Q){if(!k){let te=Q.granted;for(let R=0;R<te.length;R+=1)L[R].qos=te[R]}ee(k,L)}},f("subscribe :: call _sendPacket"),S._sendPacket(F),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!le())&&this._storeProcessingQueue.push({invoke:le,callback:ee}),this},G.prototype.unsubscribe=function(){let S=this,P=new Array(arguments.length);for(let U=0;U<arguments.length;U++)P[U]=arguments[U];let L=P.shift(),H=P.pop()||ie,re=P.pop();typeof L=="string"&&(L=[L]),typeof H!="function"&&(re=H,H=ie);let ee=g.validateTopics(L);if(ee!==null)return M(H,new Error("Invalid topic "+ee)),this;if(S._checkDisconnecting(H))return this;let W=function(){let U=S._nextId();if(U===null)return f("No messageId left"),!1;let X={cmd:"unsubscribe",qos:1,messageId:U};return typeof L=="string"?X.unsubscriptions=[L]:Array.isArray(L)&&(X.unsubscriptions=L),S.options.resubscribe&&X.unsubscriptions.forEach(function($){delete S._resubscribeTopics[$]}),typeof re=="object"&&re.properties&&(X.properties=re.properties),S.outgoing[X.messageId]={volatile:!0,cb:H},f("unsubscribe: call _sendPacket"),S._sendPacket(X),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!W())&&this._storeProcessingQueue.push({invoke:W,callback:H}),this},G.prototype.end=function(S,P,L){let H=this;f("end :: (%s)",this.options.clientId),(S==null||typeof S!="boolean")&&(L=P||ie,P=S,S=!1,typeof P!="object"&&(L=P,P=null,typeof L!="function"&&(L=ie))),typeof P!="object"&&(L=P,P=null),f("end :: cb? %s",!!L),L=L||ie;function re(){f("end :: closeStores: closing incoming and outgoing stores"),H.disconnected=!0,H.incomingStore.close(function(W){H.outgoingStore.close(function(U){if(f("end :: closeStores: emitting end"),H.emit("end"),L){let X=W||U;f("end :: closeStores: invoking callback with args"),L(X)}})}),H._deferredReconnect&&H._deferredReconnect()}function ee(){f("end :: (%s) :: finish :: calling _cleanUp with force %s",H.options.clientId,S),H._cleanUp(S,()=>{f("end :: finish :: calling process.nextTick on closeStores"),E(re.bind(H))},P)}return this.disconnecting?(L(),this):(this._clearReconnect(),this.disconnecting=!0,!S&&Object.keys(this.outgoing).length>0?(f("end :: (%s) :: calling finish in 10ms once outgoing is empty",H.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,ee,10))):(f("end :: (%s) :: immediately calling finish",H.options.clientId),ee()),this)},G.prototype.removeOutgoingMessage=function(S){let P=this.outgoing[S]?this.outgoing[S].cb:null;return delete this.outgoing[S],this.outgoingStore.del({messageId:S},function(){P(new Error("Message removed"))}),this},G.prototype.reconnect=function(S){f("client reconnect");let P=this,L=function(){S?(P.options.incomingStore=S.incomingStore,P.options.outgoingStore=S.outgoingStore):(P.options.incomingStore=null,P.options.outgoingStore=null),P.incomingStore=P.options.incomingStore||new c,P.outgoingStore=P.options.outgoingStore||new c,P.disconnecting=!1,P.disconnected=!1,P._deferredReconnect=null,P._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=L:L(),this},G.prototype._reconnect=function(){f("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end(()=>{this._setupStream()}),f("client already connected. disconnecting first.")):(f("_reconnect: calling _setupStream"),this._setupStream())},G.prototype._setupReconnect=function(){let S=this;!S.disconnecting&&!S.reconnectTimer&&S.options.reconnectPeriod>0?(this.reconnecting||(f("_setupReconnect :: emit `offline` state"),this.emit("offline"),f("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),f("_setupReconnect :: setting reconnectTimer for %d ms",S.options.reconnectPeriod),S.reconnectTimer=setInterval(function(){f("reconnectTimer :: reconnect triggered!"),S._reconnect()},S.options.reconnectPeriod)):f("_setupReconnect :: doing nothing...")},G.prototype._clearReconnect=function(){f("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},G.prototype._cleanUp=function(S,P){let L=arguments[2];if(P&&(f("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",P)),f("_cleanUp :: forced? %s",S),S)this.options.reconnectPeriod===0&&this.options.clean&&B(this.outgoing),f("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{let H=_({cmd:"disconnect"},L);f("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(H,M.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(f("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),this.pingTimer!==null&&(f("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),P&&!this.connected&&(f("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",P),P())},G.prototype._sendPacket=function(S,P,L){f("_sendPacket :: (%s) :: start",this.options.clientId),L=L||ie,P=P||ie;let H=O(this,S);if(H){P(H);return}if(!this.connected){if(S.cmd==="auth"){this._shiftPingInterval(),V(this,S,P);return}f("_sendPacket :: client not connected. Storing packet offline."),this._storePacket(S,P,L);return}switch(this._shiftPingInterval(),S.cmd){case"publish":break;case"pubrel":oe(this,S,P,L);return;default:V(this,S,P);return}switch(S.qos){case 2:case 1:oe(this,S,P,L);break;case 0:default:V(this,S,P);break}f("_sendPacket :: (%s) :: end",this.options.clientId)},G.prototype._storePacket=function(S,P,L){f("_storePacket :: packet: %o",S),f("_storePacket :: cb? %s",!!P),L=L||ie;let H=S;if(H.cmd==="publish"){H=d(S);let re=C(this,H);if(re)return P&&P(re)}(H.qos||0)===0&&this.queueQoSZero||H.cmd!=="publish"?this.queue.push({packet:H,cb:P}):H.qos>0?(P=this.outgoing[H.messageId]?this.outgoing[H.messageId].cb:null,this.outgoingStore.put(H,function(re){if(re)return P&&P(re);L()})):P&&P(new Error("No connection to broker"))},G.prototype._setupPingTimer=function(){f("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);let S=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=u(function(){S._checkPing()},this.options.keepalive*1e3))},G.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(this.options.keepalive*1e3)},G.prototype._checkPing=function(){f("_checkPing :: checking ping..."),this.pingResp?(f("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(f("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},G.prototype._handlePingresp=function(){this.pingResp=!0},G.prototype._handleConnack=function(S){f("_handleConnack");let P=this.options,H=P.protocolVersion===5?S.reasonCode:S.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,S.properties){if(S.properties.topicAliasMaximum){if(S.properties.topicAliasMaximum>65535){this.emit("error",new Error("topicAliasMaximum from broker is out of range"));return}S.properties.topicAliasMaximum>0&&(this.topicAliasSend=new i(S.properties.topicAliasMaximum))}S.properties.serverKeepAlive&&P.keepalive&&(P.keepalive=S.properties.serverKeepAlive,this._shiftPingInterval()),S.properties.maximumPacketSize&&(P.properties||(P.properties={}),P.properties.maximumPacketSize=S.properties.maximumPacketSize)}if(H===0)this.reconnecting=!1,this._onConnect(S);else if(H>0){let re=new Error("Connection refused: "+j[H]);re.code=H,this.emit("error",re)}},G.prototype._handleAuth=function(S){let L=this.options.protocolVersion,H=L===5?S.reasonCode:S.returnCode;if(L!==5){let ee=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+L);ee.code=H,this.emit("error",ee);return}let re=this;this.handleAuth(S,function(ee,W){if(ee){re.emit("error",ee);return}if(H===24)re.reconnecting=!1,re._sendPacket(W);else{let U=new Error("Connection refused: "+j[H]);ee.code=H,re.emit("error",U)}})},G.prototype.handleAuth=function(S,P){P()},G.prototype._handlePublish=function(S,P){f("_handlePublish: packet %o",S),P=typeof P<"u"?P:ie;let L=S.topic.toString(),H=S.payload,re=S.qos,ee=S.messageId,W=this,U=this.options,X=[0,16,128,131,135,144,145,151,153];if(this.options.protocolVersion===5){let $;if(S.properties&&($=S.properties.topicAlias),typeof $<"u")if(L.length===0)if($>0&&$<=65535){let le=this.topicAliasRecv.getTopicByAlias($);if(le)L=le,f("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",L,$);else{f("_handlePublish :: unregistered topic alias. alias: %d",$),this.emit("error",new Error("Received unregistered Topic Alias"));return}}else{f("_handlePublish :: topic alias out of range. alias: %d",$),this.emit("error",new Error("Received Topic Alias is out of range"));return}else if(this.topicAliasRecv.put(L,$))f("_handlePublish :: registered topic: %s - alias: %d",L,$);else{f("_handlePublish :: topic alias out of range. alias: %d",$),this.emit("error",new Error("Received Topic Alias is out of range"));return}}switch(f("_handlePublish: qos %d",re),re){case 2:{U.customHandleAcks(L,H,S,function($,le){if($ instanceof Error||(le=$,$=null),$)return W.emit("error",$);if(X.indexOf(le)===-1)return W.emit("error",new Error("Wrong reason code for pubrec"));le?W._sendPacket({cmd:"pubrec",messageId:ee,reasonCode:le},P):W.incomingStore.put(S,function(){W._sendPacket({cmd:"pubrec",messageId:ee},P)})});break}case 1:{U.customHandleAcks(L,H,S,function($,le){if($ instanceof Error||(le=$,$=null),$)return W.emit("error",$);if(X.indexOf(le)===-1)return W.emit("error",new Error("Wrong reason code for puback"));le||W.emit("message",L,H,S),W.handleMessage(S,function(Z){if(Z)return P&&P(Z);W._sendPacket({cmd:"puback",messageId:ee,reasonCode:le},P)})});break}case 0:this.emit("message",L,H,S),this.handleMessage(S,P);break;default:f("_handlePublish: unknown QoS. Doing nothing.");break}},G.prototype.handleMessage=function(S,P){P()},G.prototype._handleAck=function(S){let P=S.messageId,L=S.cmd,H=null,re=this.outgoing[P]?this.outgoing[P].cb:null,ee=this,W;if(!re){f("_handleAck :: Server sent an ack in error. Ignoring.");return}switch(f("_handleAck :: packet type",L),L){case"pubcomp":case"puback":{let U=S.reasonCode;U&&U>0&&U!==16&&(W=new Error("Publish error: "+j[U]),W.code=U,re(W,S)),delete this.outgoing[P],this.outgoingStore.del(S,re),this.messageIdProvider.deallocate(P),this._invokeStoreProcessingQueue();break}case"pubrec":{H={cmd:"pubrel",qos:2,messageId:P};let U=S.reasonCode;U&&U>0&&U!==16?(W=new Error("Publish error: "+j[U]),W.code=U,re(W,S)):this._sendPacket(H);break}case"suback":{delete this.outgoing[P],this.messageIdProvider.deallocate(P);for(let U=0;U<S.granted.length;U++)if(S.granted[U]&128){let X=this.messageIdToTopic[P];X&&X.forEach(function($){delete ee._resubscribeTopics[$]})}this._invokeStoreProcessingQueue(),re(null,S);break}case"unsuback":{delete this.outgoing[P],this.messageIdProvider.deallocate(P),this._invokeStoreProcessingQueue(),re(null);break}default:ee.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&Object.keys(this.outgoing).length===0&&this.emit("outgoingEmpty")},G.prototype._handlePubrel=function(S,P){f("handling pubrel packet"),P=typeof P<"u"?P:ie;let L=S.messageId,H=this,re={cmd:"pubcomp",messageId:L};H.incomingStore.get(S,function(ee,W){ee?H._sendPacket(re,P):(H.emit("message",W.topic,W.payload,W),H.handleMessage(W,function(U){if(U)return P(U);H.incomingStore.del(W,ie),H._sendPacket(re,P)}))})},G.prototype._handleDisconnect=function(S){this.emit("disconnect",S)},G.prototype._nextId=function(){return this.messageIdProvider.allocate()},G.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},G.prototype._resubscribe=function(){f("_resubscribe");let S=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||this.options.protocolVersion===5&&!this.connackPacket.sessionPresent)&&S.length>0)if(this.options.resubscribe)if(this.options.protocolVersion===5){f("_resubscribe: protocolVersion 5");for(let P=0;P<S.length;P++){let L={};L[S[P]]=this._resubscribeTopics[S[P]],L.resubscribe=!0,this.subscribe(L,{properties:L[S[P]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},G.prototype._onConnect=function(S){if(this.disconnected){this.emit("connect",S);return}let P=this;this.connackPacket=S,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0;function L(){let H=P.outgoingStore.createStream();function re(){P._storeProcessing=!1,P._packetIdsDuringStoreProcessing={}}P.once("close",ee),H.on("error",function(U){re(),P._flushStoreProcessingQueue(),P.removeListener("close",ee),P.emit("error",U)});function ee(){H.destroy(),H=null,P._flushStoreProcessingQueue(),re()}function W(){if(!H)return;P._storeProcessing=!0;let U=H.read(1),X;if(!U){H.once("readable",W);return}if(P._packetIdsDuringStoreProcessing[U.messageId]){W();return}!P.disconnecting&&!P.reconnectTimer?(X=P.outgoing[U.messageId]?P.outgoing[U.messageId].cb:null,P.outgoing[U.messageId]={volatile:!1,cb:function($,le){X&&X($,le),W()}},P._packetIdsDuringStoreProcessing[U.messageId]=!0,P.messageIdProvider.register(U.messageId)?P._sendPacket(U):f("messageId: %d has already used.",U.messageId)):H.destroy&&H.destroy()}H.on("end",function(){let U=!0;for(let X in P._packetIdsDuringStoreProcessing)if(!P._packetIdsDuringStoreProcessing[X]){U=!1;break}U?(re(),P.removeListener("close",ee),P._invokeAllStoreProcessingQueue(),P.emit("connect",S)):L()}),W()}L()},G.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){let S=this._storeProcessingQueue[0];if(S&&S.invoke())return this._storeProcessingQueue.shift(),!0}return!1},G.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},G.prototype._flushStoreProcessingQueue=function(){for(let S of this._storeProcessingQueue)S.cbStorePut&&S.cbStorePut(new Error("Connection closed")),S.callback&&S.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},T.exports=G}).call(this)}).call(this,m("_process"),typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{"./default-message-id-provider":12,"./store":13,"./topic-alias-recv":14,"./topic-alias-send":15,"./validations":16,_process:85,debug:20,events:4,inherits:24,"mqtt-packet":48,"readable-stream":72,reinterval:73,"rfdc/default":74,xtend:82}],7:[function(m,T,v){"use strict";let{Buffer:h}=m("buffer"),p=m("readable-stream").Transform,y=m("duplexify"),c,o,i,r=!1;function e(){let g=new p;return g._write=function(_,f,E){c.sendSocketMessage({data:_.buffer,success:function(){E()},fail:function(){E(new Error)}})},g._flush=function(f){c.closeSocket({success:function(){f()}})},g}function t(g){g.hostname||(g.hostname="localhost"),g.path||(g.path="/"),g.wsOptions||(g.wsOptions={})}function s(g,_){let f=g.protocol==="alis"?"wss":"ws",E=f+"://"+g.hostname+g.path;return g.port&&g.port!==80&&g.port!==443&&(E=f+"://"+g.hostname+":"+g.port+g.path),typeof g.transformWsUrl=="function"&&(E=g.transformWsUrl(E,g,_)),E}function u(){r||(r=!0,c.onSocketOpen(function(){i.setReadable(o),i.setWritable(o),i.emit("connect")}),c.onSocketMessage(function(g){if(typeof g.data=="string"){let _=h.from(g.data,"base64");o.push(_)}else{let _=new FileReader;_.addEventListener("load",function(){let f=_.result;f instanceof ArrayBuffer?f=h.from(f):f=h.from(f,"utf8"),o.push(f)}),_.readAsArrayBuffer(g.data)}}),c.onSocketClose(function(){i.end(),i.destroy()}),c.onSocketError(function(g){i.destroy(g)}))}function d(g,_){if(_.hostname=_.hostname||_.host,!_.hostname)throw new Error("Could not determine host. Specify host manually.");let f=_.protocolId==="MQIsdp"&&_.protocolVersion===3?"mqttv3.1":"mqtt";t(_);let E=s(_,g);return c=_.my,c.connectSocket({url:E,protocols:f}),o=e(),i=y.obj(),u(),i}T.exports=d},{buffer:3,duplexify:22,"readable-stream":72}],8:[function(m,T,v){"use strict";let h=m("net"),p=m("debug")("mqttjs:tcp");function y(c,o){o.port=o.port||1883,o.hostname=o.hostname||o.host||"localhost";let i=o.port,r=o.hostname;return p("port %d and host %s",i,r),h.createConnection(i,r)}T.exports=y},{debug:20,net:2}],9:[function(m,T,v){"use strict";let h=m("tls"),p=m("net"),y=m("debug")("mqttjs:tls");function c(o,i){i.port=i.port||8883,i.host=i.hostname||i.host||"localhost",p.isIP(i.host)===0&&(i.servername=i.host),i.rejectUnauthorized=i.rejectUnauthorized!==!1,delete i.path,y("port %d host %s rejectUnauthorized %b",i.port,i.host,i.rejectUnauthorized);let r=h.connect(i);r.on("secureConnect",function(){i.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",e)});function e(t){i.rejectUnauthorized&&o.emit("error",t),r.end()}return r.on("error",e),r}T.exports=c},{debug:20,net:2,tls:2}],10:[function(m,T,v){(function(h){(function(){"use strict";let{Buffer:p}=m("buffer"),y=m("ws"),c=m("debug")("mqttjs:ws"),o=m("duplexify"),i=m("readable-stream").Transform,r=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],e=typeof h<"u"&&h.title==="browser"||typeof __webpack_require__=="function";function t(E,M){let A=E.protocol+"://"+E.hostname+":"+E.port+E.path;return typeof E.transformWsUrl=="function"&&(A=E.transformWsUrl(A,E,M)),A}function s(E){let M=E;return E.hostname||(M.hostname="localhost"),E.port||(E.protocol==="wss"?M.port=443:M.port=80),E.path||(M.path="/"),E.wsOptions||(M.wsOptions={}),!e&&E.protocol==="wss"&&r.forEach(function(A){Object.prototype.hasOwnProperty.call(E,A)&&!Object.prototype.hasOwnProperty.call(E.wsOptions,A)&&(M.wsOptions[A]=E[A])}),M}function u(E){let M=s(E);if(M.hostname||(M.hostname=M.host),!M.hostname){if(typeof document>"u")throw new Error("Could not determine host. Specify host manually.");let A=new URL(document.URL);M.hostname=A.hostname,M.port||(M.port=A.port)}return M.objectMode===void 0&&(M.objectMode=!(M.binary===!0||M.binary===void 0)),M}function d(E,M,A){c("createWebSocket"),c("protocol: "+A.protocolId+" "+A.protocolVersion);let z=A.protocolId==="MQIsdp"&&A.protocolVersion===3?"mqttv3.1":"mqtt";return c("creating new Websocket for url: "+M+" and protocol: "+z),new y(M,[z],A.wsOptions)}function g(E,M){let A=M.protocolId==="MQIsdp"&&M.protocolVersion===3?"mqttv3.1":"mqtt",z=t(M,E),j=new WebSocket(z,[A]);return j.binaryType="arraybuffer",j}function _(E,M){c("streamBuilder");let A=s(M),z=t(A,E),j=d(E,z,A),x=y.createWebSocketStream(j,A.wsOptions);return x.url=z,j.on("close",()=>{x.destroy()}),x}function f(E,M){c("browserStreamBuilder");let A,j=u(M).browserBufferSize||1024*512,x=M.browserBufferTimeout||1e3,O=!M.objectMode,C=g(E,M),V=ne(M,L,H);M.objectMode||(V._writev=P),V.on("close",()=>{C.close()});let B=typeof C.addEventListener<"u";C.readyState===C.OPEN?A=V:(A=A=o(void 0,void 0,M),M.objectMode||(A._writev=P),B?C.addEventListener("open",oe):C.onopen=oe),A.socket=C,B?(C.addEventListener("close",ie),C.addEventListener("error",G),C.addEventListener("message",S)):(C.onclose=ie,C.onerror=G,C.onmessage=S);function ne(re,ee,W){let U=new i({objectModeMode:re.objectMode});return U._write=ee,U._flush=W,U}function oe(){A.setReadable(V),A.setWritable(V),A.emit("connect")}function ie(){A.end(),A.destroy()}function G(re){A.destroy(re)}function S(re){let ee=re.data;ee instanceof ArrayBuffer?ee=p.from(ee):ee=p.from(ee,"utf8"),V.push(ee)}function P(re,ee){let W=new Array(re.length);for(let U=0;U<re.length;U++)typeof re[U].chunk=="string"?W[U]=p.from(re[U],"utf8"):W[U]=re[U].chunk;this._write(p.concat(W),"binary",ee)}function L(re,ee,W){C.bufferedAmount>j&&setTimeout(L,x,re,ee,W),O&&typeof re=="string"&&(re=p.from(re,"utf8"));try{C.send(re)}catch(U){return W(U)}W()}function H(re){C.close(),re()}return A}e?T.exports=f:T.exports=_}).call(this)}).call(this,m("_process"))},{_process:85,buffer:3,debug:20,duplexify:22,"readable-stream":72,ws:81}],11:[function(m,T,v){"use strict";let{Buffer:h}=m("buffer"),p=m("readable-stream").Transform,y=m("duplexify"),c,o,i;function r(){let d=new p;return d._write=function(g,_,f){c.send({data:g.buffer,success:function(){f()},fail:function(E){f(new Error(E))}})},d._flush=function(_){c.close({success:function(){_()}})},d}function e(d){d.hostname||(d.hostname="localhost"),d.path||(d.path="/"),d.wsOptions||(d.wsOptions={})}function t(d,g){let _=d.protocol==="wxs"?"wss":"ws",f=_+"://"+d.hostname+d.path;return d.port&&d.port!==80&&d.port!==443&&(f=_+"://"+d.hostname+":"+d.port+d.path),typeof d.transformWsUrl=="function"&&(f=d.transformWsUrl(f,d,g)),f}function s(){c.onOpen(function(){i.setReadable(o),i.setWritable(o),i.emit("connect")}),c.onMessage(function(d){let g=d.data;g instanceof ArrayBuffer?g=h.from(g):g=h.from(g,"utf8"),o.push(g)}),c.onClose(function(){i.end(),i.destroy()}),c.onError(function(d){i.destroy(new Error(d.errMsg))})}function u(d,g){if(g.hostname=g.hostname||g.host,!g.hostname)throw new Error("Could not determine host. Specify host manually.");let _=g.protocolId==="MQIsdp"&&g.protocolVersion===3?"mqttv3.1":"mqtt";e(g);let f=t(g,d);c=wx.connectSocket({url:f,protocols:[_]}),o=r(),i=y.obj(),i._destroy=function(M,A){c.close({success:function(){A&&A(M)}})};let E=i.destroy;return i.destroy=(function(){i.destroy=E;let M=this;setTimeout(function(){c.close({fail:function(){M._destroy(new Error)}})},0)}).bind(i),s(),i}T.exports=u},{buffer:3,duplexify:22,"readable-stream":72}],12:[function(m,T,v){"use strict";function h(){if(!(this instanceof h))return new h;this.nextId=Math.max(1,Math.floor(Math.random()*65535))}h.prototype.allocate=function(){let p=this.nextId++;return this.nextId===65536&&(this.nextId=1),p},h.prototype.getLastAllocated=function(){return this.nextId===1?65535:this.nextId-1},h.prototype.register=function(p){return!0},h.prototype.deallocate=function(p){},h.prototype.clear=function(){},T.exports=h},{}],13:[function(m,T,v){"use strict";let h=m("xtend"),p=m("readable-stream").Readable,y={objectMode:!0},c={clean:!0};function o(i){if(!(this instanceof o))return new o(i);this.options=i||{},this.options=h(c,i),this._inflights=new Map}o.prototype.put=function(i,r){return this._inflights.set(i.messageId,i),r&&r(),this},o.prototype.createStream=function(){let i=new p(y),r=[],e=!1,t=0;return this._inflights.forEach(function(s,u){r.push(s)}),i._read=function(){!e&&t<r.length?this.push(r[t++]):this.push(null)},i.destroy=function(){if(e)return;let s=this;e=!0,setTimeout(function(){s.emit("close")},0)},i},o.prototype.del=function(i,r){return i=this._inflights.get(i.messageId),i?(this._inflights.delete(i.messageId),r(null,i)):r&&r(new Error("missing packet")),this},o.prototype.get=function(i,r){return i=this._inflights.get(i.messageId),i?r(null,i):r&&r(new Error("missing packet")),this},o.prototype.close=function(i){this.options.clean&&(this._inflights=null),i&&i()},T.exports=o},{"readable-stream":72,xtend:82}],14:[function(m,T,v){"use strict";function h(p){if(!(this instanceof h))return new h(p);this.aliasToTopic={},this.max=p}h.prototype.put=function(p,y){return y===0||y>this.max?!1:(this.aliasToTopic[y]=p,this.length=Object.keys(this.aliasToTopic).length,!0)},h.prototype.getTopicByAlias=function(p){return this.aliasToTopic[p]},h.prototype.clear=function(){this.aliasToTopic={}},T.exports=h},{}],15:[function(m,T,v){"use strict";let h=m("lru-cache"),p=m("number-allocator").NumberAllocator;function y(c){if(!(this instanceof y))return new y(c);c>0&&(this.aliasToTopic=new h({max:c}),this.topicToAlias={},this.numberAllocator=new p(1,c),this.max=c,this.length=0)}y.prototype.put=function(c,o){if(o===0||o>this.max)return!1;let i=this.aliasToTopic.get(o);return i&&delete this.topicToAlias[i],this.aliasToTopic.set(o,c),this.topicToAlias[c]=o,this.numberAllocator.use(o),this.length=this.aliasToTopic.length,!0},y.prototype.getTopicByAlias=function(c){return this.aliasToTopic.get(c)},y.prototype.getAliasByTopic=function(c){let o=this.topicToAlias[c];return typeof o<"u"&&this.aliasToTopic.get(o),o},y.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},y.prototype.getLruAlias=function(){let c=this.numberAllocator.firstVacant();return c||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},T.exports=y},{"lru-cache":45,"number-allocator":54}],16:[function(m,T,v){"use strict";function h(y){let c=y.split("/");for(let o=0;o<c.length;o++)if(c[o]!=="+"){if(c[o]==="#")return o===c.length-1;if(c[o].indexOf("+")!==-1||c[o].indexOf("#")!==-1)return!1}return!0}function p(y){if(y.length===0)return"empty_topic_list";for(let c=0;c<y.length;c++)if(!h(y[c]))return y[c];return null}T.exports={validateTopics:p}},{}],17:[function(m,T,v){(function(h){(function(){"use strict";let p=m("../client"),y=m("../store"),c=m("url"),o=m("xtend"),i=m("debug")("mqttjs"),r={};typeof h<"u"&&h.title!=="browser"||typeof __webpack_require__!="function"?(r.mqtt=m("./tcp"),r.tcp=m("./tcp"),r.ssl=m("./tls"),r.tls=m("./tls"),r.mqtts=m("./tls")):(r.wx=m("./wx"),r.wxs=m("./wx"),r.ali=m("./ali"),r.alis=m("./ali")),r.ws=m("./ws"),r.wss=m("./ws");function e(s){let u;s.auth&&(u=s.auth.match(/^(.+):(.+)$/),u?(s.username=u[1],s.password=u[2]):s.username=s.auth)}function t(s,u){if(i("connecting to an MQTT broker..."),typeof s=="object"&&!u&&(u=s,s=null),u=u||{},s){let _=c.parse(s,!0);if(_.port!=null&&(_.port=Number(_.port)),u=o(_,u),u.protocol===null)throw new Error("Missing protocol");u.protocol=u.protocol.replace(/:$/,"")}if(e(u),u.query&&typeof u.query.clientId=="string"&&(u.clientId=u.query.clientId),u.cert&&u.key)if(u.protocol){if(["mqtts","wss","wxs","alis"].indexOf(u.protocol)===-1)switch(u.protocol){case"mqtt":u.protocol="mqtts";break;case"ws":u.protocol="wss";break;case"wx":u.protocol="wxs";break;case"ali":u.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+u.protocol+'"!')}}else throw new Error("Missing secure protocol key");if(!r[u.protocol]){let _=["mqtts","wss"].indexOf(u.protocol)!==-1;u.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter(function(f,E){return _&&E%2===0?!1:typeof r[f]=="function"})[0]}if(u.clean===!1&&!u.clientId)throw new Error("Missing clientId for unclean clients");u.protocol&&(u.defaultProtocol=u.protocol);function d(_){return u.servers&&((!_._reconnectCount||_._reconnectCount===u.servers.length)&&(_._reconnectCount=0),u.host=u.servers[_._reconnectCount].host,u.port=u.servers[_._reconnectCount].port,u.protocol=u.servers[_._reconnectCount].protocol?u.servers[_._reconnectCount].protocol:u.defaultProtocol,u.hostname=u.host,_._reconnectCount++),i("calling streambuilder for",u.protocol),r[u.protocol](_,u)}let g=new p(d,u);return g.on("error",function(){}),g}T.exports=t,T.exports.connect=t,T.exports.MqttClient=p,T.exports.Store=y}).call(this)}).call(this,m("_process"))},{"../client":6,"../store":13,"./ali":7,"./tcp":8,"./tls":9,"./ws":10,"./wx":11,_process:85,debug:20,url:90,xtend:82}],18:[function(m,T,v){"use strict";let{Buffer:h}=m("buffer"),p=Symbol.for("BufferList");function y(c){if(!(this instanceof y))return new y(c);y._init.call(this,c)}y._init=function(o){Object.defineProperty(this,p,{value:!0}),this._bufs=[],this.length=0,o&&this.append(o)},y.prototype._new=function(o){return new y(o)},y.prototype._offset=function(o){if(o===0)return[0,0];let i=0;for(let r=0;r<this._bufs.length;r++){let e=i+this._bufs[r].length;if(o<e||r===this._bufs.length-1)return[r,o-i];i=e}},y.prototype._reverseOffset=function(c){let o=c[0],i=c[1];for(let r=0;r<o;r++)i+=this._bufs[r].length;return i},y.prototype.get=function(o){if(o>this.length||o<0)return;let i=this._offset(o);return this._bufs[i[0]][i[1]]},y.prototype.slice=function(o,i){return typeof o=="number"&&o<0&&(o+=this.length),typeof i=="number"&&i<0&&(i+=this.length),this.copy(null,0,o,i)},y.prototype.copy=function(o,i,r,e){if((typeof r!="number"||r<0)&&(r=0),(typeof e!="number"||e>this.length)&&(e=this.length),r>=this.length||e<=0)return o||h.alloc(0);let t=!!o,s=this._offset(r),u=e-r,d=u,g=t&&i||0,_=s[1];if(r===0&&e===this.length){if(!t)return this._bufs.length===1?this._bufs[0]:h.concat(this._bufs,this.length);for(let f=0;f<this._bufs.length;f++)this._bufs[f].copy(o,g),g+=this._bufs[f].length;return o}if(d<=this._bufs[s[0]].length-_)return t?this._bufs[s[0]].copy(o,i,_,_+d):this._bufs[s[0]].slice(_,_+d);t||(o=h.allocUnsafe(u));for(let f=s[0];f<this._bufs.length;f++){let E=this._bufs[f].length-_;if(d>E)this._bufs[f].copy(o,g,_),g+=E;else{this._bufs[f].copy(o,g,_,_+d),g+=E;break}d-=E,_&&(_=0)}return o.length>g?o.slice(0,g):o},y.prototype.shallowSlice=function(o,i){if(o=o||0,i=typeof i!="number"?this.length:i,o<0&&(o+=this.length),i<0&&(i+=this.length),o===i)return this._new();let r=this._offset(o),e=this._offset(i),t=this._bufs.slice(r[0],e[0]+1);return e[1]===0?t.pop():t[t.length-1]=t[t.length-1].slice(0,e[1]),r[1]!==0&&(t[0]=t[0].slice(r[1])),this._new(t)},y.prototype.toString=function(o,i,r){return this.slice(i,r).toString(o)},y.prototype.consume=function(o){if(o=Math.trunc(o),Number.isNaN(o)||o<=0)return this;for(;this._bufs.length;)if(o>=this._bufs[0].length)o-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift();else{this._bufs[0]=this._bufs[0].slice(o),this.length-=o;break}return this},y.prototype.duplicate=function(){let o=this._new();for(let i=0;i<this._bufs.length;i++)o.append(this._bufs[i]);return o},y.prototype.append=function(o){if(o==null)return this;if(o.buffer)this._appendBuffer(h.from(o.buffer,o.byteOffset,o.byteLength));else if(Array.isArray(o))for(let i=0;i<o.length;i++)this.append(o[i]);else if(this._isBufferList(o))for(let i=0;i<o._bufs.length;i++)this.append(o._bufs[i]);else typeof o=="number"&&(o=o.toString()),this._appendBuffer(h.from(o));return this},y.prototype._appendBuffer=function(o){this._bufs.push(o),this.length+=o.length},y.prototype.indexOf=function(c,o,i){if(i===void 0&&typeof o=="string"&&(i=o,o=void 0),typeof c=="function"||Array.isArray(c))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if(typeof c=="number"?c=h.from([c]):typeof c=="string"?c=h.from(c,i):this._isBufferList(c)?c=c.slice():Array.isArray(c.buffer)?c=h.from(c.buffer,c.byteOffset,c.byteLength):h.isBuffer(c)||(c=h.from(c)),o=Number(o||0),isNaN(o)&&(o=0),o<0&&(o=this.length+o),o<0&&(o=0),c.length===0)return o>this.length?this.length:o;let r=this._offset(o),e=r[0],t=r[1];for(;e<this._bufs.length;e++){let s=this._bufs[e];for(;t<s.length;)if(s.length-t>=c.length){let d=s.indexOf(c,t);if(d!==-1)return this._reverseOffset([e,d]);t=s.length-c.length+1}else{let d=this._reverseOffset([e,t]);if(this._match(d,c))return d;t++}t=0}return-1},y.prototype._match=function(c,o){if(this.length-c<o.length)return!1;for(let i=0;i<o.length;i++)if(this.get(c+i)!==o[i])return!1;return!0},function(){let c={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(let o in c)(function(i){c[i]===null?y.prototype[i]=function(r,e){return this.slice(r,r+e)[i](0,e)}:y.prototype[i]=function(r=0){return this.slice(r,r+c[i])[i](0)}})(o)}(),y.prototype._isBufferList=function(o){return o instanceof y||y.isBufferList(o)},y.isBufferList=function(o){return o!=null&&o[p]},T.exports=y},{buffer:3}],19:[function(m,T,v){"use strict";let h=m("readable-stream").Duplex,p=m("inherits"),y=m("./BufferList");function c(o){if(!(this instanceof c))return new c(o);if(typeof o=="function"){this._callback=o;let i=(function(e){this._callback&&(this._callback(e),this._callback=null)}).bind(this);this.on("pipe",function(e){e.on("error",i)}),this.on("unpipe",function(e){e.removeListener("error",i)}),o=null}y._init.call(this,o),h.call(this)}p(c,h),Object.assign(c.prototype,y.prototype),c.prototype._new=function(i){return new c(i)},c.prototype._write=function(i,r,e){this._appendBuffer(i),typeof e=="function"&&e()},c.prototype._read=function(i){if(!this.length)return this.push(null);i=Math.min(i,this.length),this.push(this.slice(0,i)),this.consume(i)},c.prototype.end=function(i){h.prototype.end.call(this,i),this._callback&&(this._callback(null,this.slice()),this._callback=null)},c.prototype._destroy=function(i,r){this._bufs.length=0,this.length=0,r(i)},c.prototype._isBufferList=function(i){return i instanceof c||i instanceof y||c.isBufferList(i)},c.isBufferList=y.isBufferList,T.exports=c,T.exports.BufferListStream=c,T.exports.BufferList=y},{"./BufferList":18,inherits:24,"readable-stream":72}],20:[function(m,T,v){(function(h){(function(){v.formatArgs=y,v.save=c,v.load=o,v.useColors=p,v.storage=i(),v.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),v.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function p(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function y(e){if(e[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")+"+"+T.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;e.splice(1,0,t,"color: inherit");let s=0,u=0;e[0].replace(/%[a-zA-Z%]/g,d=>{d!=="%%"&&(s++,d==="%c"&&(u=s))}),e.splice(u,0,t)}v.log=console.debug||console.log||(()=>{});function c(e){try{e?v.storage.setItem("debug",e):v.storage.removeItem("debug")}catch{}}function o(){let e;try{e=v.storage.getItem("debug")}catch{}return!e&&typeof h<"u"&&"env"in h&&(e=h.env.DEBUG),e}function i(){try{return localStorage}catch{}}T.exports=m("./common")(v);let{formatters:r}=T.exports;r.j=function(e){try{return JSON.stringify(e)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}}).call(this)}).call(this,m("_process"))},{"./common":21,_process:85}],21:[function(m,T,v){function h(p){c.debug=c,c.default=c,c.coerce=s,c.disable=r,c.enable=i,c.enabled=e,c.humanize=m("ms"),c.destroy=u,Object.keys(p).forEach(d=>{c[d]=p[d]}),c.names=[],c.skips=[],c.formatters={};function y(d){let g=0;for(let _=0;_<d.length;_++)g=(g<<5)-g+d.charCodeAt(_),g|=0;return c.colors[Math.abs(g)%c.colors.length]}c.selectColor=y;function c(d){let g,_=null,f,E;function M(...A){if(!M.enabled)return;let z=M,j=Number(new Date),x=j-(g||j);z.diff=x,z.prev=g,z.curr=j,g=j,A[0]=c.coerce(A[0]),typeof A[0]!="string"&&A.unshift("%O");let O=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,(V,B)=>{if(V==="%%")return"%";O++;let ne=c.formatters[B];if(typeof ne=="function"){let oe=A[O];V=ne.call(z,oe),A.splice(O,1),O--}return V}),c.formatArgs.call(z,A),(z.log||c.log).apply(z,A)}return M.namespace=d,M.useColors=c.useColors(),M.color=c.selectColor(d),M.extend=o,M.destroy=c.destroy,Object.defineProperty(M,"enabled",{enumerable:!0,configurable:!1,get:()=>_!==null?_:(f!==c.namespaces&&(f=c.namespaces,E=c.enabled(d)),E),set:A=>{_=A}}),typeof c.init=="function"&&c.init(M),M}function o(d,g){let _=c(this.namespace+(typeof g>"u"?":":g)+d);return _.log=this.log,_}function i(d){c.save(d),c.namespaces=d,c.names=[],c.skips=[];let g,_=(typeof d=="string"?d:"").split(/[\s,]+/),f=_.length;for(g=0;g<f;g++)_[g]&&(d=_[g].replace(/\*/g,".*?"),d[0]==="-"?c.skips.push(new RegExp("^"+d.slice(1)+"$")):c.names.push(new RegExp("^"+d+"$")))}function r(){let d=[...c.names.map(t),...c.skips.map(t).map(g=>"-"+g)].join(",");return c.enable(""),d}function e(d){if(d[d.length-1]==="*")return!0;let g,_;for(g=0,_=c.skips.length;g<_;g++)if(c.skips[g].test(d))return!1;for(g=0,_=c.names.length;g<_;g++)if(c.names[g].test(d))return!0;return!1}function t(d){return d.toString().substring(2,d.toString().length-2).replace(/\.\*\?$/,"*")}function s(d){return d instanceof Error?d.stack||d.message:d}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return c.enable(c.load()),c}T.exports=h},{ms:53}],22:[function(m,T,v){(function(h,p){(function(){var y=m("readable-stream"),c=m("end-of-stream"),o=m("inherits"),i=m("stream-shift"),r=p.from&&p.from!==Uint8Array.from?p.from([0]):new p([0]),e=function(f,E){f._corked?f.once("uncork",E):E()},t=function(f,E){f._autoDestroy&&f.destroy(E)},s=function(f,E){return function(M){M?t(f,M.message==="premature close"?null:M):E&&!f._ended&&f.end()}},u=function(f,E){if(!f||f._writableState&&f._writableState.finished)return E();if(f._writableState)return f.end(E);f.end(),E()},d=function(){},g=function(f){return new y.Readable({objectMode:!0,highWaterMark:16}).wrap(f)},_=function(f,E,M){if(!(this instanceof _))return new _(f,E,M);y.Duplex.call(this,M),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!M||M.autoDestroy!==!1,this._forwardDestroy=!M||M.destroy!==!1,this._forwardEnd=!M||M.end!==!1,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,f&&this.setWritable(f),E&&this.setReadable(E)};o(_,y.Duplex),_.obj=function(f,E,M){return M||(M={}),M.objectMode=!0,M.highWaterMark=16,new _(f,E,M)},_.prototype.cork=function(){++this._corked===1&&this.emit("cork")},_.prototype.uncork=function(){this._corked&&--this._corked===0&&this.emit("uncork")},_.prototype.setWritable=function(f){if(this._unwrite&&this._unwrite(),this.destroyed){f&&f.destroy&&f.destroy();return}if(f===null||f===!1){this.end();return}var E=this,M=c(f,{writable:!0,readable:!1},s(this,this._forwardEnd)),A=function(){var j=E._ondrain;E._ondrain=null,j&&j()},z=function(){E._writable.removeListener("drain",A),M()};this._unwrite&&h.nextTick(A),this._writable=f,this._writable.on("drain",A),this._unwrite=z,this.uncork()},_.prototype.setReadable=function(f){if(this._unread&&this._unread(),this.destroyed){f&&f.destroy&&f.destroy();return}if(f===null||f===!1){this.push(null),this.resume();return}var E=this,M=c(f,{writable:!1,readable:!0},s(this)),A=function(){E._forward()},z=function(){E.push(null)},j=function(){E._readable2.removeListener("readable",A),E._readable2.removeListener("end",z),M()};this._drained=!0,this._readable=f,this._readable2=f._readableState?f:g(f),this._readable2.on("readable",A),this._readable2.on("end",z),this._unread=j,this._forward()},_.prototype._read=function(){this._drained=!0,this._forward()},_.prototype._forward=function(){if(!(this._forwarding||!this._readable2||!this._drained)){this._forwarding=!0;for(var f;this._drained&&(f=i(this._readable2))!==null;)this.destroyed||(this._drained=this.push(f));this._forwarding=!1}},_.prototype.destroy=function(f,E){if(E||(E=d),this.destroyed)return E(null);this.destroyed=!0;var M=this;h.nextTick(function(){M._destroy(f),E(null)})},_.prototype._destroy=function(f){if(f){var E=this._ondrain;this._ondrain=null,E?E(f):this.emit("error",f)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},_.prototype._write=function(f,E,M){if(!this.destroyed){if(this._corked)return e(this,this._write.bind(this,f,E,M));if(f===r)return this._finish(M);if(!this._writable)return M();this._writable.write(f)===!1?this._ondrain=M:this.destroyed||M()}},_.prototype._finish=function(f){var E=this;this.emit("preend"),e(this,function(){u(E._forwardEnd&&E._writable,function(){E._writableState.prefinished===!1&&(E._writableState.prefinished=!0),E.emit("prefinish"),e(E,f)})})},_.prototype.end=function(f,E,M){return typeof f=="function"?this.end(null,null,f):typeof E=="function"?this.end(f,null,E):(this._ended=!0,f&&this.write(f),!this._writableState.ending&&!this._writableState.destroyed&&this.write(r),y.Writable.prototype.end.call(this,M))},T.exports=_}).call(this)}).call(this,m("_process"),m("buffer").Buffer)},{_process:85,buffer:3,"end-of-stream":23,inherits:24,"readable-stream":72,"stream-shift":77}],23:[function(m,T,v){(function(h){(function(){var p=m("once"),y=function(){},c=function(r){return r.setHeader&&typeof r.abort=="function"},o=function(r){return r.stdio&&Array.isArray(r.stdio)&&r.stdio.length===3},i=function(r,e,t){if(typeof e=="function")return i(r,null,e);e||(e={}),t=p(t||y);var s=r._writableState,u=r._readableState,d=e.readable||e.readable!==!1&&r.readable,g=e.writable||e.writable!==!1&&r.writable,_=!1,f=function(){r.writable||E()},E=function(){g=!1,d||t.call(r)},M=function(){d=!1,g||t.call(r)},A=function(C){t.call(r,C?new Error("exited with error code: "+C):null)},z=function(C){t.call(r,C)},j=function(){h.nextTick(x)},x=function(){if(!_){if(d&&!(u&&u.ended&&!u.destroyed))return t.call(r,new Error("premature close"));if(g&&!(s&&s.ended&&!s.destroyed))return t.call(r,new Error("premature close"))}},O=function(){r.req.on("finish",E)};return c(r)?(r.on("complete",E),r.on("abort",j),r.req?O():r.on("request",O)):g&&!s&&(r.on("end",f),r.on("close",f)),o(r)&&r.on("exit",A),r.on("end",M),r.on("finish",E),e.error!==!1&&r.on("error",z),r.on("close",j),function(){_=!0,r.removeListener("complete",E),r.removeListener("abort",j),r.removeListener("request",O),r.req&&r.req.removeListener("finish",E),r.removeListener("end",f),r.removeListener("close",f),r.removeListener("finish",E),r.removeListener("exit",A),r.removeListener("end",M),r.removeListener("error",z),r.removeListener("close",j)}};T.exports=i}).call(this)}).call(this,m("_process"))},{_process:85,once:56}],24:[function(m,T,v){typeof Object.create=="function"?T.exports=function(p,y){y&&(p.super_=y,p.prototype=Object.create(y.prototype,{constructor:{value:p,enumerable:!1,writable:!0,configurable:!0}}))}:T.exports=function(p,y){if(y){p.super_=y;var c=function(){};c.prototype=y.prototype,p.prototype=new c,p.prototype.constructor=p}}},{}],25:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.ContainerIterator=v.Container=v.Base=void 0;class h{constructor(o=0){this.iteratorType=o}equals(o){return this.o===o.o}}v.ContainerIterator=h;class p{constructor(){this.i=0}get length(){return this.i}size(){return this.i}empty(){return this.i===0}}v.Base=p;class y extends p{}v.Container=y},{}],26:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.HashContainerIterator=v.HashContainer=void 0;var h=m("../../ContainerBase"),p=c(m("../../../utils/checkObject")),y=m("../../../utils/throwError");function c(r){return r&&r.t?r:{default:r}}class o extends h.ContainerIterator{constructor(e,t,s){super(s),this.o=e,this.h=t,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.L,this})}}v.HashContainerIterator=o;class i extends h.Container{constructor(){super(),this.H=[],this.g={},this.HASH_TAG=Symbol("@@HASH_TAG"),Object.setPrototypeOf(this.g,null),this.h={},this.h.L=this.h.B=this.p=this._=this.h}V(e){let{L:t,B:s}=e;t.B=s,s.L=t,e===this.p&&(this.p=s),e===this._&&(this._=t),this.i-=1}M(e,t,s){s===void 0&&(s=(0,p.default)(e));let u;if(s){let d=e[this.HASH_TAG];if(d!==void 0)return this.H[d].l=t,this.i;Object.defineProperty(e,this.HASH_TAG,{value:this.H.length,configurable:!0}),u={u:e,l:t,L:this._,B:this.h},this.H.push(u)}else{let d=this.g[e];if(d)return d.l=t,this.i;u={u:e,l:t,L:this._,B:this.h},this.g[e]=u}return this.i===0?(this.p=u,this.h.B=u):this._.B=u,this._=u,this.h.L=u,++this.i}I(e,t){if(t===void 0&&(t=(0,p.default)(e)),t){let s=e[this.HASH_TAG];return s===void 0?this.h:this.H[s]}else return this.g[e]||this.h}clear(){let e=this.HASH_TAG;this.H.forEach(function(t){delete t.u[e]}),this.H=[],this.g={},Object.setPrototypeOf(this.g,null),this.i=0,this.p=this._=this.h.L=this.h.B=this.h}eraseElementByKey(e,t){let s;if(t===void 0&&(t=(0,p.default)(e)),t){let u=e[this.HASH_TAG];if(u===void 0)return!1;delete e[this.HASH_TAG],s=this.H[u],delete this.H[u]}else{if(s=this.g[e],s===void 0)return!1;delete this.g[e]}return this.V(s),!0}eraseElementByIterator(e){let t=e.o;return t===this.h&&(0,y.throwIteratorAccessError)(),this.V(t),e.next()}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let t=this.p;for(;e--;)t=t.B;return this.V(t),this.i}}v.HashContainer=i},{"../../../utils/checkObject":43,"../../../utils/throwError":44,"../../ContainerBase":25}],27:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("./Base"),p=c(m("../../utils/checkObject")),y=m("../../utils/throwError");function c(e){return e&&e.t?e:{default:e}}class o extends h.HashContainerIterator{constructor(t,s,u,d){super(t,s,d),this.container=u}get pointer(){this.o===this.h&&(0,y.throwIteratorAccessError)();let t=this;return new Proxy([],{get(s,u){if(u==="0")return t.o.u;if(u==="1")return t.o.l},set(s,u,d){if(u!=="1")throw new TypeError("props must be 1");return t.o.l=d,!0}})}copy(){return new o(this.o,this.h,this.container,this.iteratorType)}}class i extends h.HashContainer{constructor(t=[]){super();let s=this;t.forEach(function(u){s.setElement(u[0],u[1])})}begin(){return new o(this.p,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this._,this.h,this,1)}rEnd(){return new o(this.h,this.h,this,1)}front(){if(this.i!==0)return[this.p.u,this.p.l]}back(){if(this.i!==0)return[this._.u,this._.l]}setElement(t,s,u){return this.M(t,s,u)}getElementByKey(t,s){if(s===void 0&&(s=(0,p.default)(t)),s){let d=t[this.HASH_TAG];return d!==void 0?this.H[d].l:void 0}let u=this.g[t];return u?u.l:void 0}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let s=this.p;for(;t--;)s=s.B;return[s.u,s.l]}find(t,s){let u=this.I(t,s);return new o(u,this.h,this)}forEach(t){let s=0,u=this.p;for(;u!==this.h;)t([u.u,u.l],s++,this),u=u.B}[Symbol.iterator](){return(function*(){let t=this.p;for(;t!==this.h;)yield[t.u,t.l],t=t.B}).bind(this)()}}var r=i;v.default=r},{"../../utils/checkObject":43,"../../utils/throwError":44,"./Base":26}],28:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("./Base"),p=m("../../utils/throwError");class y extends h.HashContainerIterator{constructor(r,e,t,s){super(r,e,s),this.container=t}get pointer(){return this.o===this.h&&(0,p.throwIteratorAccessError)(),this.o.u}copy(){return new y(this.o,this.h,this.container,this.iteratorType)}}class c extends h.HashContainer{constructor(r=[]){super();let e=this;r.forEach(function(t){e.insert(t)})}begin(){return new y(this.p,this.h,this)}end(){return new y(this.h,this.h,this)}rBegin(){return new y(this._,this.h,this,1)}rEnd(){return new y(this.h,this.h,this,1)}front(){return this.p.u}back(){return this._.u}insert(r,e){return this.M(r,void 0,e)}getElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let e=this.p;for(;r--;)e=e.B;return e.u}find(r,e){let t=this.I(r,e);return new y(t,this.h,this)}forEach(r){let e=0,t=this.p;for(;t!==this.h;)r(t.u,e++,this),t=t.B}[Symbol.iterator](){return(function*(){let r=this.p;for(;r!==this.h;)yield r.u,r=r.B}).bind(this)()}}var o=c;v.default=o},{"../../utils/throwError":44,"./Base":26}],29:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("../ContainerBase");class p extends h.Base{constructor(o=[],i=function(e,t){return e>t?-1:e<t?1:0},r=!0){if(super(),this.v=i,Array.isArray(o))this.C=r?[...o]:o;else{this.C=[];let t=this;o.forEach(function(s){t.C.push(s)})}this.i=this.C.length;let e=this.i>>1;for(let t=this.i-1>>1;t>=0;--t)this.k(t,e)}m(o){let i=this.C[o];for(;o>0;){let r=o-1>>1,e=this.C[r];if(this.v(e,i)<=0)break;this.C[o]=e,o=r}this.C[o]=i}k(o,i){let r=this.C[o];for(;o<i;){let e=o<<1|1,t=e+1,s=this.C[e];if(t<this.i&&this.v(s,this.C[t])>0&&(e=t,s=this.C[t]),this.v(s,r)>=0)break;this.C[o]=s,o=e}this.C[o]=r}clear(){this.i=0,this.C.length=0}push(o){this.C.push(o),this.m(this.i),this.i+=1}pop(){if(this.i===0)return;let o=this.C[0],i=this.C.pop();return this.i-=1,this.i&&(this.C[0]=i,this.k(0,this.i>>1)),o}top(){return this.C[0]}find(o){return this.C.indexOf(o)>=0}remove(o){let i=this.C.indexOf(o);return i<0?!1:(i===0?this.pop():i===this.i-1?(this.C.pop(),this.i-=1):(this.C.splice(i,1,this.C.pop()),this.i-=1,this.m(i),this.k(i,this.i>>1)),!0)}updateItem(o){let i=this.C.indexOf(o);return i<0?!1:(this.m(i),this.k(i,this.i>>1),!0)}toArray(){return[...this.C]}}var y=p;v.default=y},{"../ContainerBase":25}],30:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("../ContainerBase");class p extends h.Base{constructor(o=[]){super(),this.j=0,this.q=[];let i=this;o.forEach(function(r){i.push(r)})}clear(){this.q=[],this.i=this.j=0}push(o){let i=this.q.length;if(this.j/i>.5&&this.j+this.i>=i&&i>4096){let r=this.i;for(let e=0;e<r;++e)this.q[e]=this.q[this.j+e];this.j=0,this.q[this.i]=o}else this.q[this.j+this.i]=o;return++this.i}pop(){if(this.i===0)return;let o=this.q[this.j++];return this.i-=1,o}front(){if(this.i!==0)return this.q[this.j]}}var y=p;v.default=y},{"../ContainerBase":25}],31:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("../ContainerBase");class p extends h.Base{constructor(o=[]){super(),this.S=[];let i=this;o.forEach(function(r){i.push(r)})}clear(){this.i=0,this.S=[]}push(o){return this.S.push(o),this.i+=1,this.i}pop(){if(this.i!==0)return this.i-=1,this.S.pop()}top(){return this.S[this.i-1]}}var y=p;v.default=y},{"../ContainerBase":25}],32:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.RandomIterator=void 0;var h=m("../../ContainerBase"),p=m("../../../utils/throwError");class y extends h.ContainerIterator{constructor(o,i){super(i),this.o=o,this.iteratorType===0?(this.pre=function(){return this.o===0&&(0,p.throwIteratorAccessError)(),this.o-=1,this},this.next=function(){return this.o===this.container.size()&&(0,p.throwIteratorAccessError)(),this.o+=1,this}):(this.pre=function(){return this.o===this.container.size()-1&&(0,p.throwIteratorAccessError)(),this.o+=1,this},this.next=function(){return this.o===-1&&(0,p.throwIteratorAccessError)(),this.o-=1,this})}get pointer(){return this.container.getElementByPos(this.o)}set pointer(o){this.container.setElementByPos(this.o,o)}}v.RandomIterator=y},{"../../../utils/throwError":44,"../../ContainerBase":25}],33:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("../../ContainerBase");class p extends h.Container{}var y=p;v.default=y},{"../../ContainerBase":25}],34:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=y(m("./Base")),p=m("./Base/RandomIterator");function y(r){return r&&r.t?r:{default:r}}class c extends p.RandomIterator{constructor(e,t,s){super(e,s),this.container=t}copy(){return new c(this.o,this.container,this.iteratorType)}}class o extends h.default{constructor(e=[],t=4096){super(),this.j=0,this.D=0,this.R=0,this.N=0,this.P=0,this.A=[];let s=(()=>{if(typeof e.length=="number")return e.length;if(typeof e.size=="number")return e.size;if(typeof e.size=="function")return e.size();throw new TypeError("Cannot get the length or size of the container")})();this.F=t,this.P=Math.max(Math.ceil(s/this.F),1);for(let g=0;g<this.P;++g)this.A.push(new Array(this.F));let u=Math.ceil(s/this.F);this.j=this.R=(this.P>>1)-(u>>1),this.D=this.N=this.F-s%this.F>>1;let d=this;e.forEach(function(g){d.pushBack(g)})}T(){let e=[],t=Math.max(this.P>>1,1);for(let s=0;s<t;++s)e[s]=new Array(this.F);for(let s=this.j;s<this.P;++s)e[e.length]=this.A[s];for(let s=0;s<this.R;++s)e[e.length]=this.A[s];e[e.length]=[...this.A[this.R]],this.j=t,this.R=e.length-1;for(let s=0;s<t;++s)e[e.length]=new Array(this.F);this.A=e,this.P=e.length}O(e){let t=this.D+e+1,s=t%this.F,u=s-1,d=this.j+(t-s)/this.F;return s===0&&(d-=1),d%=this.P,u<0&&(u+=this.F),{curNodeBucketIndex:d,curNodePointerIndex:u}}clear(){this.A=[new Array(this.F)],this.P=1,this.j=this.R=this.i=0,this.D=this.N=this.F>>1}begin(){return new c(0,this)}end(){return new c(this.i,this)}rBegin(){return new c(this.i-1,this,1)}rEnd(){return new c(-1,this,1)}front(){if(this.i!==0)return this.A[this.j][this.D]}back(){if(this.i!==0)return this.A[this.R][this.N]}pushBack(e){return this.i&&(this.N<this.F-1?this.N+=1:this.R<this.P-1?(this.R+=1,this.N=0):(this.R=0,this.N=0),this.R===this.j&&this.N===this.D&&this.T()),this.i+=1,this.A[this.R][this.N]=e,this.i}popBack(){if(this.i===0)return;let e=this.A[this.R][this.N];return this.i!==1&&(this.N>0?this.N-=1:this.R>0?(this.R-=1,this.N=this.F-1):(this.R=this.P-1,this.N=this.F-1)),this.i-=1,e}pushFront(e){return this.i&&(this.D>0?this.D-=1:this.j>0?(this.j-=1,this.D=this.F-1):(this.j=this.P-1,this.D=this.F-1),this.j===this.R&&this.D===this.N&&this.T()),this.i+=1,this.A[this.j][this.D]=e,this.i}popFront(){if(this.i===0)return;let e=this.A[this.j][this.D];return this.i!==1&&(this.D<this.F-1?this.D+=1:this.j<this.P-1?(this.j+=1,this.D=0):(this.j=0,this.D=0)),this.i-=1,e}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:t,curNodePointerIndex:s}=this.O(e);return this.A[t][s]}setElementByPos(e,t){if(e<0||e>this.i-1)throw new RangeError;let{curNodeBucketIndex:s,curNodePointerIndex:u}=this.O(e);this.A[s][u]=t}insert(e,t,s=1){if(e<0||e>this.i)throw new RangeError;if(e===0)for(;s--;)this.pushFront(t);else if(e===this.i)for(;s--;)this.pushBack(t);else{let u=[];for(let d=e;d<this.i;++d)u.push(this.getElementByPos(d));this.cut(e-1);for(let d=0;d<s;++d)this.pushBack(t);for(let d=0;d<u.length;++d)this.pushBack(u[d])}return this.i}cut(e){if(e<0)return this.clear(),0;let{curNodeBucketIndex:t,curNodePointerIndex:s}=this.O(e);return this.R=t,this.N=s,this.i=e+1,this.i}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;if(e===0)this.popFront();else if(e===this.i-1)this.popBack();else{let t=[];for(let u=e+1;u<this.i;++u)t.push(this.getElementByPos(u));this.cut(e),this.popBack();let s=this;t.forEach(function(u){s.pushBack(u)})}return this.i}eraseElementByValue(e){if(this.i===0)return 0;let t=[];for(let u=0;u<this.i;++u){let d=this.getElementByPos(u);d!==e&&t.push(d)}let s=t.length;for(let u=0;u<s;++u)this.setElementByPos(u,t[u]);return this.cut(s-1)}eraseElementByIterator(e){let t=e.o;return this.eraseElementByPos(t),e=e.next(),e}find(e){for(let t=0;t<this.i;++t)if(this.getElementByPos(t)===e)return new c(t,this);return this.end()}reverse(){let e=0,t=this.i-1;for(;e<t;){let s=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(t)),this.setElementByPos(t,s),e+=1,t-=1}}unique(){if(this.i<=1)return this.i;let e=1,t=this.getElementByPos(0);for(let s=1;s<this.i;++s){let u=this.getElementByPos(s);u!==t&&(t=u,this.setElementByPos(e++,u))}for(;this.i>e;)this.popBack();return this.i}sort(e){let t=[];for(let s=0;s<this.i;++s)t.push(this.getElementByPos(s));t.sort(e);for(let s=0;s<this.i;++s)this.setElementByPos(s,t[s])}shrinkToFit(){if(this.i===0)return;let e=[];this.forEach(function(t){e.push(t)}),this.P=Math.max(Math.ceil(this.i/this.F),1),this.i=this.j=this.R=this.D=this.N=0,this.A=[];for(let t=0;t<this.P;++t)this.A.push(new Array(this.F));for(let t=0;t<e.length;++t)this.pushBack(e[t])}forEach(e){for(let t=0;t<this.i;++t)e(this.getElementByPos(t),t,this)}[Symbol.iterator](){return(function*(){for(let e=0;e<this.i;++e)yield this.getElementByPos(e)}).bind(this)()}}var i=o;v.default=i},{"./Base":33,"./Base/RandomIterator":32}],35:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=c(m("./Base")),p=m("../ContainerBase"),y=m("../../utils/throwError");function c(e){return e&&e.t?e:{default:e}}class o extends p.ContainerIterator{constructor(t,s,u,d){super(d),this.o=t,this.h=s,this.container=u,this.iteratorType===0?(this.pre=function(){return this.o.L===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.L,this},this.next=function(){return this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.B,this}):(this.pre=function(){return this.o.B===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.B,this},this.next=function(){return this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o=this.o.L,this})}get pointer(){return this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o.l}set pointer(t){this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o.l=t}copy(){return new o(this.o,this.h,this.container,this.iteratorType)}}class i extends h.default{constructor(t=[]){super(),this.h={},this.p=this._=this.h.L=this.h.B=this.h;let s=this;t.forEach(function(u){s.pushBack(u)})}V(t){let{L:s,B:u}=t;s.B=u,u.L=s,t===this.p&&(this.p=u),t===this._&&(this._=s),this.i-=1}G(t,s){let u=s.B,d={l:t,L:s,B:u};s.B=d,u.L=d,s===this.h&&(this.p=d),u===this.h&&(this._=d),this.i+=1}clear(){this.i=0,this.p=this._=this.h.L=this.h.B=this.h}begin(){return new o(this.p,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this._,this.h,this,1)}rEnd(){return new o(this.h,this.h,this,1)}front(){return this.p.l}back(){return this._.l}getElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let s=this.p;for(;t--;)s=s.B;return s.l}eraseElementByPos(t){if(t<0||t>this.i-1)throw new RangeError;let s=this.p;for(;t--;)s=s.B;return this.V(s),this.i}eraseElementByValue(t){let s=this.p;for(;s!==this.h;)s.l===t&&this.V(s),s=s.B;return this.i}eraseElementByIterator(t){let s=t.o;return s===this.h&&(0,y.throwIteratorAccessError)(),t=t.next(),this.V(s),t}pushBack(t){return this.G(t,this._),this.i}popBack(){if(this.i===0)return;let t=this._.l;return this.V(this._),t}pushFront(t){return this.G(t,this.h),this.i}popFront(){if(this.i===0)return;let t=this.p.l;return this.V(this.p),t}setElementByPos(t,s){if(t<0||t>this.i-1)throw new RangeError;let u=this.p;for(;t--;)u=u.B;u.l=s}insert(t,s,u=1){if(t<0||t>this.i)throw new RangeError;if(u<=0)return this.i;if(t===0)for(;u--;)this.pushFront(s);else if(t===this.i)for(;u--;)this.pushBack(s);else{let d=this.p;for(let _=1;_<t;++_)d=d.B;let g=d.B;for(this.i+=u;u--;)d.B={l:s,L:d},d.B.L=d,d=d.B;d.B=g,g.L=d}return this.i}find(t){let s=this.p;for(;s!==this.h;){if(s.l===t)return new o(s,this.h,this);s=s.B}return this.end()}reverse(){if(this.i<=1)return;let t=this.p,s=this._,u=0;for(;u<<1<this.i;){let d=t.l;t.l=s.l,s.l=d,t=t.B,s=s.L,u+=1}}unique(){if(this.i<=1)return this.i;let t=this.p;for(;t!==this.h;){let s=t;for(;s.B!==this.h&&s.l===s.B.l;)s=s.B,this.i-=1;t.B=s.B,t.B.L=t,t=t.B}return this.i}sort(t){if(this.i<=1)return;let s=[];this.forEach(function(d){s.push(d)}),s.sort(t);let u=this.p;s.forEach(function(d){u.l=d,u=u.B})}merge(t){let s=this;if(this.i===0)t.forEach(function(u){s.pushBack(u)});else{let u=this.p;t.forEach(function(d){for(;u!==s.h&&u.l<=d;)u=u.B;s.G(d,u.L)})}return this.i}forEach(t){let s=this.p,u=0;for(;s!==this.h;)t(s.l,u++,this),s=s.B}[Symbol.iterator](){return(function*(){if(this.i===0)return;let t=this.p;for(;t!==this.h;)yield t.l,t=t.B}).bind(this)()}}var r=i;v.default=r},{"../../utils/throwError":44,"../ContainerBase":25,"./Base":33}],36:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=y(m("./Base")),p=m("./Base/RandomIterator");function y(r){return r&&r.t?r:{default:r}}class c extends p.RandomIterator{constructor(e,t,s){super(e,s),this.container=t}copy(){return new c(this.o,this.container,this.iteratorType)}}class o extends h.default{constructor(e=[],t=!0){if(super(),Array.isArray(e))this.J=t?[...e]:e,this.i=e.length;else{this.J=[];let s=this;e.forEach(function(u){s.pushBack(u)})}}clear(){this.i=0,this.J.length=0}begin(){return new c(0,this)}end(){return new c(this.i,this)}rBegin(){return new c(this.i-1,this,1)}rEnd(){return new c(-1,this,1)}front(){return this.J[0]}back(){return this.J[this.i-1]}getElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J[e]}eraseElementByPos(e){if(e<0||e>this.i-1)throw new RangeError;return this.J.splice(e,1),this.i-=1,this.i}eraseElementByValue(e){let t=0;for(let s=0;s<this.i;++s)this.J[s]!==e&&(this.J[t++]=this.J[s]);return this.i=this.J.length=t,this.i}eraseElementByIterator(e){let t=e.o;return e=e.next(),this.eraseElementByPos(t),e}pushBack(e){return this.J.push(e),this.i+=1,this.i}popBack(){if(this.i!==0)return this.i-=1,this.J.pop()}setElementByPos(e,t){if(e<0||e>this.i-1)throw new RangeError;this.J[e]=t}insert(e,t,s=1){if(e<0||e>this.i)throw new RangeError;return this.J.splice(e,0,...new Array(s).fill(t)),this.i+=s,this.i}find(e){for(let t=0;t<this.i;++t)if(this.J[t]===e)return new c(t,this);return this.end()}reverse(){this.J.reverse()}unique(){let e=1;for(let t=1;t<this.i;++t)this.J[t]!==this.J[t-1]&&(this.J[e++]=this.J[t]);return this.i=this.J.length=e,this.i}sort(e){this.J.sort(e)}forEach(e){for(let t=0;t<this.i;++t)e(this.J[t],t,this)}[Symbol.iterator](){return(function*(){yield*Re(this.J)}).bind(this)()}}var i=o;v.default=i},{"./Base":33,"./Base/RandomIterator":32}],37:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("../../ContainerBase"),p=m("../../../utils/throwError");class y extends h.ContainerIterator{constructor(i,r,e){super(e),this.o=i,this.h=r,this.iteratorType===0?(this.pre=function(){return this.o===this.h.U&&(0,p.throwIteratorAccessError)(),this.o=this.o.L(),this},this.next=function(){return this.o===this.h&&(0,p.throwIteratorAccessError)(),this.o=this.o.B(),this}):(this.pre=function(){return this.o===this.h.W&&(0,p.throwIteratorAccessError)(),this.o=this.o.B(),this},this.next=function(){return this.o===this.h&&(0,p.throwIteratorAccessError)(),this.o=this.o.L(),this})}get index(){let i=this.o,r=this.h.tt;if(i===this.h)return r?r.rt-1:0;let e=0;for(i.U&&(e+=i.U.rt);i!==r;){let t=i.tt;i===t.W&&(e+=1,t.U&&(e+=t.U.rt)),i=t}return e}}var c=y;v.default=c},{"../../../utils/throwError":44,"../../ContainerBase":25}],38:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.TreeNodeEnableIndex=v.TreeNode=void 0;class h{constructor(c,o){this.ee=1,this.u=void 0,this.l=void 0,this.U=void 0,this.W=void 0,this.tt=void 0,this.u=c,this.l=o}L(){let c=this;if(c.ee===1&&c.tt.tt===c)c=c.W;else if(c.U)for(c=c.U;c.W;)c=c.W;else{let o=c.tt;for(;o.U===c;)c=o,o=c.tt;c=o}return c}B(){let c=this;if(c.W){for(c=c.W;c.U;)c=c.U;return c}else{let o=c.tt;for(;o.W===c;)c=o,o=c.tt;return c.W!==o?o:c}}te(){let c=this.tt,o=this.W,i=o.U;return c.tt===this?c.tt=o:c.U===this?c.U=o:c.W=o,o.tt=c,o.U=this,this.tt=o,this.W=i,i&&(i.tt=this),o}se(){let c=this.tt,o=this.U,i=o.W;return c.tt===this?c.tt=o:c.U===this?c.U=o:c.W=o,o.tt=c,o.W=this,this.tt=o,this.U=i,i&&(i.tt=this),o}}v.TreeNode=h;class p extends h{constructor(){super(...arguments),this.rt=1}te(){let c=super.te();return this.ie(),c.ie(),c}se(){let c=super.se();return this.ie(),c.ie(),c}ie(){this.rt=1,this.U&&(this.rt+=this.U.rt),this.W&&(this.rt+=this.W.rt)}}v.TreeNodeEnableIndex=p},{}],39:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=m("./TreeNode"),p=m("../../ContainerBase"),y=m("../../../utils/throwError");class c extends p.Container{constructor(r=function(t,s){return t<s?-1:t>s?1:0},e=!1){super(),this.Y=void 0,this.v=r,e?(this.re=h.TreeNodeEnableIndex,this.M=function(t,s,u){let d=this.ne(t,s,u);if(d){let g=d.tt;for(;g!==this.h;)g.rt+=1,g=g.tt;let _=this.he(d);if(_){let{parentNode:f,grandParent:E,curNode:M}=_;f.ie(),E.ie(),M.ie()}}return this.i},this.V=function(t){let s=this.fe(t);for(;s!==this.h;)s.rt-=1,s=s.tt}):(this.re=h.TreeNode,this.M=function(t,s,u){let d=this.ne(t,s,u);return d&&this.he(d),this.i},this.V=this.fe),this.h=new this.re}X(r,e){let t=this.h;for(;r;){let s=this.v(r.u,e);if(s<0)r=r.W;else if(s>0)t=r,r=r.U;else return r}return t}Z(r,e){let t=this.h;for(;r;)this.v(r.u,e)<=0?r=r.W:(t=r,r=r.U);return t}$(r,e){let t=this.h;for(;r;){let s=this.v(r.u,e);if(s<0)t=r,r=r.W;else if(s>0)r=r.U;else return r}return t}rr(r,e){let t=this.h;for(;r;)this.v(r.u,e)<0?(t=r,r=r.W):r=r.U;return t}ue(r){for(;;){let e=r.tt;if(e===this.h)return;if(r.ee===1){r.ee=0;return}if(r===e.U){let t=e.W;if(t.ee===1)t.ee=0,e.ee=1,e===this.Y?this.Y=e.te():e.te();else if(t.W&&t.W.ee===1){t.ee=e.ee,e.ee=0,t.W.ee=0,e===this.Y?this.Y=e.te():e.te();return}else t.U&&t.U.ee===1?(t.ee=1,t.U.ee=0,t.se()):(t.ee=1,r=e)}else{let t=e.U;if(t.ee===1)t.ee=0,e.ee=1,e===this.Y?this.Y=e.se():e.se();else if(t.U&&t.U.ee===1){t.ee=e.ee,e.ee=0,t.U.ee=0,e===this.Y?this.Y=e.se():e.se();return}else t.W&&t.W.ee===1?(t.ee=1,t.W.ee=0,t.te()):(t.ee=1,r=e)}}}fe(r){if(this.i===1)return this.clear(),this.h;let e=r;for(;e.U||e.W;){if(e.W)for(e=e.W;e.U;)e=e.U;else e=e.U;[r.u,e.u]=[e.u,r.u],[r.l,e.l]=[e.l,r.l],r=e}this.h.U===e?this.h.U=e.tt:this.h.W===e&&(this.h.W=e.tt),this.ue(e);let t=e.tt;return e===t.U?t.U=void 0:t.W=void 0,this.i-=1,this.Y.ee=0,t}oe(r,e){return r===void 0?!1:this.oe(r.U,e)||e(r)?!0:this.oe(r.W,e)}he(r){for(;;){let e=r.tt;if(e.ee===0)return;let t=e.tt;if(e===t.U){let s=t.W;if(s&&s.ee===1){if(s.ee=e.ee=0,t===this.Y)return;t.ee=1,r=t;continue}else if(r===e.W){if(r.ee=0,r.U&&(r.U.tt=e),r.W&&(r.W.tt=t),e.W=r.U,t.U=r.W,r.U=e,r.W=t,t===this.Y)this.Y=r,this.h.tt=r;else{let u=t.tt;u.U===t?u.U=r:u.W=r}return r.tt=t.tt,e.tt=r,t.tt=r,t.ee=1,{parentNode:e,grandParent:t,curNode:r}}else e.ee=0,t===this.Y?this.Y=t.se():t.se(),t.ee=1}else{let s=t.U;if(s&&s.ee===1){if(s.ee=e.ee=0,t===this.Y)return;t.ee=1,r=t;continue}else if(r===e.U){if(r.ee=0,r.U&&(r.U.tt=t),r.W&&(r.W.tt=e),t.W=r.U,e.U=r.W,r.U=t,r.W=e,t===this.Y)this.Y=r,this.h.tt=r;else{let u=t.tt;u.U===t?u.U=r:u.W=r}return r.tt=t.tt,e.tt=r,t.tt=r,t.ee=1,{parentNode:e,grandParent:t,curNode:r}}else e.ee=0,t===this.Y?this.Y=t.te():t.te(),t.ee=1}return}}ne(r,e,t){if(this.Y===void 0){this.i+=1,this.Y=new this.re(r,e),this.Y.ee=0,this.Y.tt=this.h,this.h.tt=this.Y,this.h.U=this.Y,this.h.W=this.Y;return}let s,u=this.h.U,d=this.v(u.u,r);if(d===0){u.l=e;return}else if(d>0)u.U=new this.re(r,e),u.U.tt=u,s=u.U,this.h.U=s;else{let g=this.h.W,_=this.v(g.u,r);if(_===0){g.l=e;return}else if(_<0)g.W=new this.re(r,e),g.W.tt=g,s=g.W,this.h.W=s;else{if(t!==void 0){let f=t.o;if(f!==this.h){let E=this.v(f.u,r);if(E===0){f.l=e;return}else if(E>0){let M=f.L(),A=this.v(M.u,r);if(A===0){M.l=e;return}else A<0&&(s=new this.re(r,e),M.W===void 0?(M.W=s,s.tt=M):(f.U=s,s.tt=f))}}}if(s===void 0)for(s=this.Y;;){let f=this.v(s.u,r);if(f>0){if(s.U===void 0){s.U=new this.re(r,e),s.U.tt=s,s=s.U;break}s=s.U}else if(f<0){if(s.W===void 0){s.W=new this.re(r,e),s.W.tt=s,s=s.W;break}s=s.W}else{s.l=e;return}}}}return this.i+=1,s}I(r,e){for(;r;){let t=this.v(r.u,e);if(t<0)r=r.W;else if(t>0)r=r.U;else return r}return r||this.h}clear(){this.i=0,this.Y=void 0,this.h.tt=void 0,this.h.U=this.h.W=void 0}updateKeyByIterator(r,e){let t=r.o;if(t===this.h&&(0,y.throwIteratorAccessError)(),this.i===1)return t.u=e,!0;if(t===this.h.U)return this.v(t.B().u,e)>0?(t.u=e,!0):!1;if(t===this.h.W)return this.v(t.L().u,e)<0?(t.u=e,!0):!1;let s=t.L().u;if(this.v(s,e)>=0)return!1;let u=t.B().u;return this.v(u,e)<=0?!1:(t.u=e,!0)}eraseElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let e=0,t=this;return this.oe(this.Y,function(s){return r===e?(t.V(s),!0):(e+=1,!1)}),this.i}eraseElementByKey(r){if(this.i===0)return!1;let e=this.I(this.Y,r);return e===this.h?!1:(this.V(e),!0)}eraseElementByIterator(r){let e=r.o;e===this.h&&(0,y.throwIteratorAccessError)();let t=e.W===void 0;return r.iteratorType===0?t&&r.next():(!t||e.U===void 0)&&r.next(),this.V(e),r}forEach(r){let e=0;for(let t of this)r(t,e++,this)}getElementByPos(r){if(r<0||r>this.i-1)throw new RangeError;let e,t=0;for(let s of this){if(t===r){e=s;break}t+=1}return e}getHeight(){if(this.i===0)return 0;let r=function(e){return e?Math.max(r(e.U),r(e.W))+1:0};return r(this.Y)}}var o=c;v.default=o},{"../../../utils/throwError":44,"../../ContainerBase":25,"./TreeNode":38}],40:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=c(m("./Base")),p=c(m("./Base/TreeIterator")),y=m("../../utils/throwError");function c(e){return e&&e.t?e:{default:e}}class o extends p.default{constructor(t,s,u,d){super(t,s,d),this.container=u}get pointer(){this.o===this.h&&(0,y.throwIteratorAccessError)();let t=this;return new Proxy([],{get(s,u){if(u==="0")return t.o.u;if(u==="1")return t.o.l},set(s,u,d){if(u!=="1")throw new TypeError("props must be 1");return t.o.l=d,!0}})}copy(){return new o(this.o,this.h,this.container,this.iteratorType)}}class i extends h.default{constructor(t=[],s,u){super(s,u);let d=this;t.forEach(function(g){d.setElement(g[0],g[1])})}*K(t){t!==void 0&&(yield*Re(this.K(t.U)),yield[t.u,t.l],yield*Re(this.K(t.W)))}begin(){return new o(this.h.U||this.h,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this.h.W||this.h,this.h,this,1)}rEnd(){return new o(this.h,this.h,this,1)}front(){if(this.i===0)return;let t=this.h.U;return[t.u,t.l]}back(){if(this.i===0)return;let t=this.h.W;return[t.u,t.l]}lowerBound(t){let s=this.X(this.Y,t);return new o(s,this.h,this)}upperBound(t){let s=this.Z(this.Y,t);return new o(s,this.h,this)}reverseLowerBound(t){let s=this.$(this.Y,t);return new o(s,this.h,this)}reverseUpperBound(t){let s=this.rr(this.Y,t);return new o(s,this.h,this)}setElement(t,s,u){return this.M(t,s,u)}find(t){let s=this.I(this.Y,t);return new o(s,this.h,this)}getElementByKey(t){return this.I(this.Y,t).l}union(t){let s=this;return t.forEach(function(u){s.setElement(u[0],u[1])}),this.i}[Symbol.iterator](){return this.K(this.Y)}}var r=i;v.default=r},{"../../utils/throwError":44,"./Base":39,"./Base/TreeIterator":37}],41:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=void 0;var h=c(m("./Base")),p=c(m("./Base/TreeIterator")),y=m("../../utils/throwError");function c(e){return e&&e.t?e:{default:e}}class o extends p.default{constructor(t,s,u,d){super(t,s,d),this.container=u}get pointer(){return this.o===this.h&&(0,y.throwIteratorAccessError)(),this.o.u}copy(){return new o(this.o,this.h,this.container,this.iteratorType)}}class i extends h.default{constructor(t=[],s,u){super(s,u);let d=this;t.forEach(function(g){d.insert(g)})}*K(t){t!==void 0&&(yield*Re(this.K(t.U)),yield t.u,yield*Re(this.K(t.W)))}begin(){return new o(this.h.U||this.h,this.h,this)}end(){return new o(this.h,this.h,this)}rBegin(){return new o(this.h.W||this.h,this.h,this,1)}rEnd(){return new o(this.h,this.h,this,1)}front(){return this.h.U?this.h.U.u:void 0}back(){return this.h.W?this.h.W.u:void 0}insert(t,s){return this.M(t,void 0,s)}find(t){let s=this.I(this.Y,t);return new o(s,this.h,this)}lowerBound(t){let s=this.X(this.Y,t);return new o(s,this.h,this)}upperBound(t){let s=this.Z(this.Y,t);return new o(s,this.h,this)}reverseLowerBound(t){let s=this.$(this.Y,t);return new o(s,this.h,this)}reverseUpperBound(t){let s=this.rr(this.Y,t);return new o(s,this.h,this)}union(t){let s=this;return t.forEach(function(u){s.insert(u)}),this.i}[Symbol.iterator](){return this.K(this.Y)}}var r=i;v.default=r},{"../../utils/throwError":44,"./Base":39,"./Base/TreeIterator":37}],42:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),Object.defineProperty(v,"Deque",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(v,"HashMap",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(v,"HashSet",{enumerable:!0,get:function(){return t.default}}),Object.defineProperty(v,"LinkList",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(v,"OrderedMap",{enumerable:!0,get:function(){return e.default}}),Object.defineProperty(v,"OrderedSet",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(v,"PriorityQueue",{enumerable:!0,get:function(){return y.default}}),Object.defineProperty(v,"Queue",{enumerable:!0,get:function(){return p.default}}),Object.defineProperty(v,"Stack",{enumerable:!0,get:function(){return h.default}}),Object.defineProperty(v,"Vector",{enumerable:!0,get:function(){return c.default}});var h=u(m("./container/OtherContainer/Stack")),p=u(m("./container/OtherContainer/Queue")),y=u(m("./container/OtherContainer/PriorityQueue")),c=u(m("./container/SequentialContainer/Vector")),o=u(m("./container/SequentialContainer/LinkList")),i=u(m("./container/SequentialContainer/Deque")),r=u(m("./container/TreeContainer/OrderedSet")),e=u(m("./container/TreeContainer/OrderedMap")),t=u(m("./container/HashContainer/HashSet")),s=u(m("./container/HashContainer/HashMap"));function u(d){return d&&d.t?d:{default:d}}},{"./container/HashContainer/HashMap":27,"./container/HashContainer/HashSet":28,"./container/OtherContainer/PriorityQueue":29,"./container/OtherContainer/Queue":30,"./container/OtherContainer/Stack":31,"./container/SequentialContainer/Deque":34,"./container/SequentialContainer/LinkList":35,"./container/SequentialContainer/Vector":36,"./container/TreeContainer/OrderedMap":40,"./container/TreeContainer/OrderedSet":41}],43:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.default=h;function h(p){let y=typeof p;return y==="object"&&p!==null||y==="function"}},{}],44:[function(m,T,v){"use strict";Object.defineProperty(v,"t",{value:!0}),v.throwIteratorAccessError=h;function h(){throw new RangeError("Iterator access denied!")}},{}],45:[function(m,T,v){"use strict";let h=m("yallist"),p=Symbol("max"),y=Symbol("length"),c=Symbol("lengthCalculator"),o=Symbol("allowStale"),i=Symbol("maxAge"),r=Symbol("dispose"),e=Symbol("noDisposeOnSet"),t=Symbol("lruList"),s=Symbol("cache"),u=Symbol("updateAgeOnGet"),d=()=>1;class g{constructor(x){if(typeof x=="number"&&(x={max:x}),x||(x={}),x.max&&(typeof x.max!="number"||x.max<0))throw new TypeError("max must be a non-negative number");let O=this[p]=x.max||1/0,C=x.length||d;if(this[c]=typeof C!="function"?d:C,this[o]=x.stale||!1,x.maxAge&&typeof x.maxAge!="number")throw new TypeError("maxAge must be a number");this[i]=x.maxAge||0,this[r]=x.dispose,this[e]=x.noDisposeOnSet||!1,this[u]=x.updateAgeOnGet||!1,this.reset()}set max(x){if(typeof x!="number"||x<0)throw new TypeError("max must be a non-negative number");this[p]=x||1/0,E(this)}get max(){return this[p]}set allowStale(x){this[o]=!!x}get allowStale(){return this[o]}set maxAge(x){if(typeof x!="number")throw new TypeError("maxAge must be a non-negative number");this[i]=x,E(this)}get maxAge(){return this[i]}set lengthCalculator(x){typeof x!="function"&&(x=d),x!==this[c]&&(this[c]=x,this[y]=0,this[t].forEach(O=>{O.length=this[c](O.value,O.key),this[y]+=O.length})),E(this)}get lengthCalculator(){return this[c]}get length(){return this[y]}get itemCount(){return this[t].length}rforEach(x,O){O=O||this;for(let C=this[t].tail;C!==null;){let V=C.prev;z(this,x,C,O),C=V}}forEach(x,O){O=O||this;for(let C=this[t].head;C!==null;){let V=C.next;z(this,x,C,O),C=V}}keys(){return this[t].toArray().map(x=>x.key)}values(){return this[t].toArray().map(x=>x.value)}reset(){this[r]&&this[t]&&this[t].length&&this[t].forEach(x=>this[r](x.key,x.value)),this[s]=new Map,this[t]=new h,this[y]=0}dump(){return this[t].map(x=>f(this,x)?!1:{k:x.key,v:x.value,e:x.now+(x.maxAge||0)}).toArray().filter(x=>x)}dumpLru(){return this[t]}set(x,O,C){if(C=C||this[i],C&&typeof C!="number")throw new TypeError("maxAge must be a number");let V=C?Date.now():0,B=this[c](O,x);if(this[s].has(x)){if(B>this[p])return M(this,this[s].get(x)),!1;let ie=this[s].get(x).value;return this[r]&&(this[e]||this[r](x,ie.value)),ie.now=V,ie.maxAge=C,ie.value=O,this[y]+=B-ie.length,ie.length=B,this.get(x),E(this),!0}let ne=new A(x,O,B,V,C);return ne.length>this[p]?(this[r]&&this[r](x,O),!1):(this[y]+=ne.length,this[t].unshift(ne),this[s].set(x,this[t].head),E(this),!0)}has(x){if(!this[s].has(x))return!1;let O=this[s].get(x).value;return!f(this,O)}get(x){return _(this,x,!0)}peek(x){return _(this,x,!1)}pop(){let x=this[t].tail;return x?(M(this,x),x.value):null}del(x){M(this,this[s].get(x))}load(x){this.reset();let O=Date.now();for(let C=x.length-1;C>=0;C--){let V=x[C],B=V.e||0;if(B===0)this.set(V.k,V.v);else{let ne=B-O;ne>0&&this.set(V.k,V.v,ne)}}}prune(){this[s].forEach((x,O)=>_(this,O,!1))}}let _=(j,x,O)=>{let C=j[s].get(x);if(C){let V=C.value;if(f(j,V)){if(M(j,C),!j[o])return}else O&&(j[u]&&(C.value.now=Date.now()),j[t].unshiftNode(C));return V.value}},f=(j,x)=>{if(!x||!x.maxAge&&!j[i])return!1;let O=Date.now()-x.now;return x.maxAge?O>x.maxAge:j[i]&&O>j[i]},E=j=>{if(j[y]>j[p])for(let x=j[t].tail;j[y]>j[p]&&x!==null;){let O=x.prev;M(j,x),x=O}},M=(j,x)=>{if(x){let O=x.value;j[r]&&j[r](O.key,O.value),j[y]-=O.length,j[s].delete(O.key),j[t].removeNode(x)}};class A{constructor(x,O,C,V,B){this.key=x,this.value=O,this.length=C,this.now=V,this.maxAge=B||0}}let z=(j,x,O,C)=>{let V=O.value;f(j,V)&&(M(j,O),j[o]||(V=void 0)),V&&x.call(C,V.value,V.key,j)};T.exports=g},{yallist:84}],46:[function(m,T,v){(function(h){(function(){let p=T.exports;p.types={0:"reserved",1:"connect",2:"connack",3:"publish",4:"puback",5:"pubrec",6:"pubrel",7:"pubcomp",8:"subscribe",9:"suback",10:"unsubscribe",11:"unsuback",12:"pingreq",13:"pingresp",14:"disconnect",15:"auth"},p.codes={};for(let c in p.types){let o=p.types[c];p.codes[o]=c}p.CMD_SHIFT=4,p.CMD_MASK=240,p.DUP_MASK=8,p.QOS_MASK=3,p.QOS_SHIFT=1,p.RETAIN_MASK=1,p.VARBYTEINT_MASK=127,p.VARBYTEINT_FIN_MASK=128,p.VARBYTEINT_MAX=268435455,p.SESSIONPRESENT_MASK=1,p.SESSIONPRESENT_HEADER=h.from([p.SESSIONPRESENT_MASK]),p.CONNACK_HEADER=h.from([p.codes.connack<<p.CMD_SHIFT]),p.USERNAME_MASK=128,p.PASSWORD_MASK=64,p.WILL_RETAIN_MASK=32,p.WILL_QOS_MASK=24,p.WILL_QOS_SHIFT=3,p.WILL_FLAG_MASK=4,p.CLEAN_SESSION_MASK=2,p.CONNECT_HEADER=h.from([p.codes.connect<<p.CMD_SHIFT]),p.properties={sessionExpiryInterval:17,willDelayInterval:24,receiveMaximum:33,maximumPacketSize:39,topicAliasMaximum:34,requestResponseInformation:25,requestProblemInformation:23,userProperties:38,authenticationMethod:21,authenticationData:22,payloadFormatIndicator:1,messageExpiryInterval:2,contentType:3,responseTopic:8,correlationData:9,maximumQoS:36,retainAvailable:37,assignedClientIdentifier:18,reasonString:31,wildcardSubscriptionAvailable:40,subscriptionIdentifiersAvailable:41,sharedSubscriptionAvailable:42,serverKeepAlive:19,responseInformation:26,serverReference:28,topicAlias:35,subscriptionIdentifier:11},p.propertiesCodes={};for(let c in p.properties){let o=p.properties[c];p.propertiesCodes[o]=c}p.propertiesTypes={sessionExpiryInterval:"int32",willDelayInterval:"int32",receiveMaximum:"int16",maximumPacketSize:"int32",topicAliasMaximum:"int16",requestResponseInformation:"byte",requestProblemInformation:"byte",userProperties:"pair",authenticationMethod:"string",authenticationData:"binary",payloadFormatIndicator:"byte",messageExpiryInterval:"int32",contentType:"string",responseTopic:"string",correlationData:"binary",maximumQoS:"int8",retainAvailable:"byte",assignedClientIdentifier:"string",reasonString:"string",wildcardSubscriptionAvailable:"byte",subscriptionIdentifiersAvailable:"byte",sharedSubscriptionAvailable:"byte",serverKeepAlive:"int16",responseInformation:"string",serverReference:"string",topicAlias:"int16",subscriptionIdentifier:"var"};function y(c){return[0,1,2].map(o=>[0,1].map(i=>[0,1].map(r=>{let e=h.alloc(1);return e.writeUInt8(p.codes[c]<<p.CMD_SHIFT|(i?p.DUP_MASK:0)|o<<p.QOS_SHIFT|r,0,!0),e})))}p.PUBLISH_HEADER=y("publish"),p.SUBSCRIBE_HEADER=y("subscribe"),p.SUBSCRIBE_OPTIONS_QOS_MASK=3,p.SUBSCRIBE_OPTIONS_NL_MASK=1,p.SUBSCRIBE_OPTIONS_NL_SHIFT=2,p.SUBSCRIBE_OPTIONS_RAP_MASK=1,p.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,p.SUBSCRIBE_OPTIONS_RH_MASK=3,p.SUBSCRIBE_OPTIONS_RH_SHIFT=4,p.SUBSCRIBE_OPTIONS_RH=[0,16,32],p.SUBSCRIBE_OPTIONS_NL=4,p.SUBSCRIBE_OPTIONS_RAP=8,p.SUBSCRIBE_OPTIONS_QOS=[0,1,2],p.UNSUBSCRIBE_HEADER=y("unsubscribe"),p.ACKS={unsuback:y("unsuback"),puback:y("puback"),pubcomp:y("pubcomp"),pubrel:y("pubrel"),pubrec:y("pubrec")},p.SUBACK_HEADER=h.from([p.codes.suback<<p.CMD_SHIFT]),p.VERSION3=h.from([3]),p.VERSION4=h.from([4]),p.VERSION5=h.from([5]),p.VERSION131=h.from([131]),p.VERSION132=h.from([132]),p.QOS=[0,1,2].map(c=>h.from([c])),p.EMPTY={pingreq:h.from([p.codes.pingreq<<4,0]),pingresp:h.from([p.codes.pingresp<<4,0]),disconnect:h.from([p.codes.disconnect<<4,0])}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:3}],47:[function(m,T,v){(function(h){(function(){let p=m("./writeToStream"),y=m("events");function c(i,r){let e=new o;return p(i,e,r),e.concat()}class o extends y{constructor(){super(),this._array=new Array(20),this._i=0}write(r){return this._array[this._i++]=r,!0}concat(){let r=0,e=new Array(this._array.length),t=this._array,s=0,u;for(u=0;u<t.length&&t[u]!==void 0;u++)typeof t[u]!="string"?e[u]=t[u].length:e[u]=h.byteLength(t[u]),r+=e[u];let d=h.allocUnsafe(r);for(u=0;u<t.length&&t[u]!==void 0;u++)typeof t[u]!="string"?(t[u].copy(d,s),s+=e[u]):(d.write(t[u],s),s+=e[u]);return d}}T.exports=c}).call(this)}).call(this,m("buffer").Buffer)},{"./writeToStream":52,buffer:3,events:4}],48:[function(m,T,v){v.parser=m("./parser").parser,v.generate=m("./generate"),v.writeToStream=m("./writeToStream")},{"./generate":47,"./parser":51,"./writeToStream":52}],49:[function(m,T,v){(function(h){(function(){let y={},c=h.isBuffer(h.from([1,2]).subarray(0,1));function o(t){let s=h.allocUnsafe(2);return s.writeUInt8(t>>8,0),s.writeUInt8(t&255,1),s}function i(){for(let t=0;t<65536;t++)y[t]=o(t)}function r(t){let u=0,d=0,g=h.allocUnsafe(4);do u=t%128|0,t=t/128|0,t>0&&(u=u|128),g.writeUInt8(u,d++);while(t>0&&d<4);return t>0&&(d=0),c?g.subarray(0,d):g.slice(0,d)}function e(t){let s=h.allocUnsafe(4);return s.writeUInt32BE(t,0),s}T.exports={cache:y,generateCache:i,generateNumber:o,genBufVariableByteInt:r,generate4ByteBuffer:e}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:3}],50:[function(m,T,v){class h{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}T.exports=h},{}],51:[function(m,T,v){let h=m("bl"),p=m("events"),y=m("./packet"),c=m("./constants"),o=m("debug")("mqtt-packet:parser");class i extends p{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof i?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):new i().parser(e)}_resetState(){o("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new y,this.error=null,this._list=h(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),o("parse: current state: %s",this._states[this._stateCounter]);(this.packet.length!==-1||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,o("parse: state complete. _stateCounter is now: %d",this._stateCounter),o("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return o("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){let e=this._list.readUInt8(0);return this.packet.cmd=c.types[e>>c.CMD_SHIFT],this.packet.retain=(e&c.RETAIN_MASK)!==0,this.packet.qos=e>>c.QOS_SHIFT&c.QOS_MASK,this.packet.dup=(e&c.DUP_MASK)!==0,o("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){let e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),o("_parseLength %d",e.value),!!e}_parsePayload(){o("_parsePayload: payload %O",this._list);let e=!1;if(this.packet.length===0||this._list.length>=this.packet.length){switch(this._pos=0,this.packet.cmd){case"connect":this._parseConnect();break;case"connack":this._parseConnack();break;case"publish":this._parsePublish();break;case"puback":case"pubrec":case"pubrel":case"pubcomp":this._parseConfirmation();break;case"subscribe":this._parseSubscribe();break;case"suback":this._parseSuback();break;case"unsubscribe":this._parseUnsubscribe();break;case"unsuback":this._parseUnsuback();break;case"pingreq":case"pingresp":break;case"disconnect":this._parseDisconnect();break;case"auth":this._parseAuth();break;default:this._emitError(new Error("Not supported"))}e=!0}return o("_parsePayload complete result: %s",e),e}_parseConnect(){o("_parseConnect");let e,t,s,u,d={},g=this.packet,_=this._parseString();if(_===null)return this._emitError(new Error("Cannot parse protocolId"));if(_!=="MQTT"&&_!=="MQIsdp")return this._emitError(new Error("Invalid protocolId"));if(g.protocolId=_,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(g.protocolVersion=this._list.readUInt8(this._pos),g.protocolVersion>=128&&(g.bridgeMode=!0,g.protocolVersion=g.protocolVersion-128),g.protocolVersion!==3&&g.protocolVersion!==4&&g.protocolVersion!==5)return this._emitError(new Error("Invalid protocol version"));if(this._pos++,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(d.username=this._list.readUInt8(this._pos)&c.USERNAME_MASK,d.password=this._list.readUInt8(this._pos)&c.PASSWORD_MASK,d.will=this._list.readUInt8(this._pos)&c.WILL_FLAG_MASK,d.will&&(g.will={},g.will.retain=(this._list.readUInt8(this._pos)&c.WILL_RETAIN_MASK)!==0,g.will.qos=(this._list.readUInt8(this._pos)&c.WILL_QOS_MASK)>>c.WILL_QOS_SHIFT),g.clean=(this._list.readUInt8(this._pos)&c.CLEAN_SESSION_MASK)!==0,this._pos++,g.keepalive=this._parseNum(),g.keepalive===-1)return this._emitError(new Error("Packet too short"));if(g.protocolVersion===5){let E=this._parseProperties();Object.getOwnPropertyNames(E).length&&(g.properties=E)}let f=this._parseString();if(f===null)return this._emitError(new Error("Packet too short"));if(g.clientId=f,o("_parseConnect: packet.clientId: %s",g.clientId),d.will){if(g.protocolVersion===5){let E=this._parseProperties();Object.getOwnPropertyNames(E).length&&(g.will.properties=E)}if(e=this._parseString(),e===null)return this._emitError(new Error("Cannot parse will topic"));if(g.will.topic=e,o("_parseConnect: packet.will.topic: %s",g.will.topic),t=this._parseBuffer(),t===null)return this._emitError(new Error("Cannot parse will payload"));g.will.payload=t,o("_parseConnect: packet.will.paylaod: %s",g.will.payload)}if(d.username){if(u=this._parseString(),u===null)return this._emitError(new Error("Cannot parse username"));g.username=u,o("_parseConnect: packet.username: %s",g.username)}if(d.password){if(s=this._parseBuffer(),s===null)return this._emitError(new Error("Cannot parse password"));g.password=s}return this.settings=g,o("_parseConnect: complete"),g}_parseConnack(){o("_parseConnack");let e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&c.SESSIONPRESENT_MASK),this.settings.protocolVersion===5)this._list.length>=2?e.reasonCode=this._list.readUInt8(this._pos++):e.reasonCode=0;else{if(this._list.length<2)return null;e.returnCode=this._list.readUInt8(this._pos++)}if(e.returnCode===-1||e.reasonCode===-1)return this._emitError(new Error("Cannot parse return code"));if(this.settings.protocolVersion===5){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}o("_parseConnack: complete")}_parsePublish(){o("_parsePublish");let e=this.packet;if(e.topic=this._parseString(),e.topic===null)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0&&!this._parseMessageId())){if(this.settings.protocolVersion===5){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),o("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){o("_parseSubscribe");let e=this.packet,t,s,u,d,g,_,f;if(e.qos!==1)return this._emitError(new Error("Wrong subscribe header"));if(e.subscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let E=this._parseProperties();Object.getOwnPropertyNames(E).length&&(e.properties=E)}for(;this._pos<e.length;){if(t=this._parseString(),t===null)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));s=this._parseByte(),u=s&c.SUBSCRIBE_OPTIONS_QOS_MASK,_=(s>>c.SUBSCRIBE_OPTIONS_NL_SHIFT&c.SUBSCRIBE_OPTIONS_NL_MASK)!==0,g=(s>>c.SUBSCRIBE_OPTIONS_RAP_SHIFT&c.SUBSCRIBE_OPTIONS_RAP_MASK)!==0,d=s>>c.SUBSCRIBE_OPTIONS_RH_SHIFT&c.SUBSCRIBE_OPTIONS_RH_MASK,f={topic:t,qos:u},this.settings.protocolVersion===5?(f.nl=_,f.rap=g,f.rh=d):this.settings.bridgeMode&&(f.rh=0,f.rap=!0,f.nl=!0),o("_parseSubscribe: push subscription `%s` to subscription",f),e.subscriptions.push(f)}}}_parseSuback(){o("_parseSuback");let e=this.packet;if(this.packet.granted=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseUnsubscribe(){o("_parseUnsubscribe");let e=this.packet;if(e.unsubscriptions=[],!!this._parseMessageId()){if(this.settings.protocolVersion===5){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){let t=this._parseString();if(t===null)return this._emitError(new Error("Cannot parse topic"));o("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){o("_parseUnsuback");let e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(this.settings.protocolVersion===5){let t=this._parseProperties();for(Object.getOwnPropertyNames(t).length&&(e.properties=t),e.granted=[];this._pos<this.packet.length;)this.packet.granted.push(this._list.readUInt8(this._pos++))}}_parseConfirmation(){o("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);let e=this.packet;if(this._parseMessageId(),this.settings.protocolVersion===5&&(e.length>2?(e.reasonCode=this._parseByte(),o("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)):e.reasonCode=0,e.length>3)){let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}_parseDisconnect(){let e=this.packet;if(o("_parseDisconnect"),this.settings.protocolVersion===5){this._list.length>0?e.reasonCode=this._parseByte():e.reasonCode=0;let t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return o("_parseDisconnect result: true"),!0}_parseAuth(){o("_parseAuth");let e=this.packet;if(this.settings.protocolVersion!==5)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();let t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),o("_parseAuth: result: true"),!0}_parseMessageId(){let e=this.packet;return e.messageId=this._parseNum(),e.messageId===null?(this._emitError(new Error("Cannot parse messageId")),!1):(o("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){let t=this._parseNum(),s=t+this._pos;if(t===-1||s>this._list.length||s>this.packet.length)return null;let u=this._list.toString("utf8",this._pos,s);return this._pos+=t,o("_parseString: result: %s",u),u}_parseStringPair(){return o("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){let e=this._parseNum(),t=e+this._pos;if(e===-1||t>this._list.length||t>this.packet.length)return null;let s=this._list.slice(this._pos,t);return this._pos+=e,o("_parseBuffer: result: %o",s),s}_parseNum(){if(this._list.length-this._pos<2)return-1;let e=this._list.readUInt16BE(this._pos);return this._pos+=2,o("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;let e=this._list.readUInt32BE(this._pos);return this._pos+=4,o("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){o("_parseVarByteNum");let t=4,s=0,u=1,d=0,g=!1,_,f=this._pos?this._pos:0;for(;s<t&&f+s<this._list.length;){if(_=this._list.readUInt8(f+s++),d+=u*(_&c.VARBYTEINT_MASK),u*=128,!(_&c.VARBYTEINT_FIN_MASK)){g=!0;break}if(this._list.length<=s)break}return!g&&s===t&&this._list.length>=s&&this._emitError(new Error("Invalid variable byte integer")),f&&(this._pos+=s),g=g?e?{bytes:s,value:d}:d:!1,o("_parseVarByteNum: result: %o",g),g}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),o("_parseByte: result: %o",e),e}_parseByType(e){switch(o("_parseByType: type: %s",e),e){case"byte":return this._parseByte()!==0;case"int8":return this._parseByte();case"int16":return this._parseNum();case"int32":return this._parse4ByteNum();case"var":return this._parseVarByteNum();case"string":return this._parseString();case"pair":return this._parseStringPair();case"binary":return this._parseBuffer()}}_parseProperties(){o("_parseProperties");let e=this._parseVarByteNum(),s=this._pos+e,u={};for(;this._pos<s;){let d=this._parseByte();if(!d)return this._emitError(new Error("Cannot parse property code type")),!1;let g=c.propertiesCodes[d];if(!g)return this._emitError(new Error("Unknown property")),!1;if(g==="userProperties"){u[g]||(u[g]=Object.create(null));let _=this._parseByType(c.propertiesTypes[g]);if(u[g][_.name])if(Array.isArray(u[g][_.name]))u[g][_.name].push(_.value);else{let f=u[g][_.name];u[g][_.name]=[f],u[g][_.name].push(_.value)}else u[g][_.name]=_.value;continue}u[g]?Array.isArray(u[g])?u[g].push(this._parseByType(c.propertiesTypes[g])):(u[g]=[u[g]],u[g].push(this._parseByType(c.propertiesTypes[g]))):u[g]=this._parseByType(c.propertiesTypes[g])}return u}_newPacket(){return o("_newPacket"),this.packet&&(this._list.consume(this.packet.length),o("_newPacket: parser emit packet: packet.cmd: %s, packet.payload: %s, packet.length: %d",this.packet.cmd,this.packet.payload,this.packet.length),this.emit("packet",this.packet)),o("_newPacket: new packet"),this.packet=new y,this._pos=0,!0}_emitError(e){o("_emitError"),this.error=e,this.emit("error",e)}}T.exports=i},{"./constants":46,"./packet":50,bl:19,debug:20,events:4}],52:[function(m,T,v){(function(h){(function(){let p=m("./constants"),y=h.allocUnsafe(0),c=h.from([0]),o=m("./numbers"),i=m("process-nextick-args").nextTick,r=m("debug")("mqtt-packet:writeToStream"),e=o.cache,t=o.generateNumber,s=o.generateCache,u=o.genBufVariableByteInt,d=o.generate4ByteBuffer,g=L,_=!0;function f(F,k,Q){switch(r("generate called"),k.cork&&(k.cork(),i(E,k)),_&&(_=!1,s()),r("generate: packet.cmd: %s",F.cmd),F.cmd){case"connect":return M(F,k,Q);case"connack":return A(F,k,Q);case"publish":return z(F,k,Q);case"puback":case"pubrec":case"pubrel":case"pubcomp":return j(F,k,Q);case"subscribe":return x(F,k,Q);case"suback":return O(F,k,Q);case"unsubscribe":return C(F,k,Q);case"unsuback":return V(F,k,Q);case"pingreq":case"pingresp":return B(F,k,Q);case"disconnect":return ne(F,k,Q);case"auth":return oe(F,k,Q);default:return k.emit("error",new Error("Unknown command")),!1}}Object.defineProperty(f,"cacheNumbers",{get(){return g===L},set(F){F?((!e||Object.keys(e).length===0)&&(_=!0),g=L):(_=!1,g=H)}});function E(F){F.uncork()}function M(F,k,Q){let te=F||{},R=te.protocolId||"MQTT",I=te.protocolVersion||4,N=te.will,q=te.clean,Y=te.keepalive||0,b=te.clientId||"",l=te.username,n=te.password,a=te.properties;q===void 0&&(q=!0);let w=0;if(!R||typeof R!="string"&&!h.isBuffer(R))return k.emit("error",new Error("Invalid protocolId")),!1;if(w+=R.length+2,I!==3&&I!==4&&I!==5)return k.emit("error",new Error("Invalid protocol version")),!1;if(w+=1,(typeof b=="string"||h.isBuffer(b))&&(b||I>=4)&&(b||q))w+=h.byteLength(b)+2;else{if(I<4)return k.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(q*1===0)return k.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if(typeof Y!="number"||Y<0||Y>65535||Y%1!==0)return k.emit("error",new Error("Invalid keepalive")),!1;if(w+=2,w+=1,I===5){var D=W(k,a);if(!D)return!1;w+=D.length}if(N){if(typeof N!="object")return k.emit("error",new Error("Invalid will")),!1;if(!N.topic||typeof N.topic!="string")return k.emit("error",new Error("Invalid will topic")),!1;if(w+=h.byteLength(N.topic)+2,w+=2,N.payload)if(N.payload.length>=0)typeof N.payload=="string"?w+=h.byteLength(N.payload):w+=N.payload.length;else return k.emit("error",new Error("Invalid will payload")),!1;var K={};if(I===5){if(K=W(k,N.properties),!K)return!1;w+=K.length}}let J=!1;if(l!=null)if(Z(l))J=!0,w+=h.byteLength(l)+2;else return k.emit("error",new Error("Invalid username")),!1;if(n!=null){if(!J)return k.emit("error",new Error("Username is required to use password")),!1;if(Z(n))w+=le(n)+2;else return k.emit("error",new Error("Invalid password")),!1}k.write(p.CONNECT_HEADER),G(k,w),ee(k,R),te.bridgeMode&&(I+=128),k.write(I===131?p.VERSION131:I===132?p.VERSION132:I===4?p.VERSION4:I===5?p.VERSION5:p.VERSION3);let ue=0;return ue|=l!=null?p.USERNAME_MASK:0,ue|=n!=null?p.PASSWORD_MASK:0,ue|=N&&N.retain?p.WILL_RETAIN_MASK:0,ue|=N&&N.qos?N.qos<<p.WILL_QOS_SHIFT:0,ue|=N?p.WILL_FLAG_MASK:0,ue|=q?p.CLEAN_SESSION_MASK:0,k.write(h.from([ue])),g(k,Y),I===5&&D.write(),ee(k,b),N&&(I===5&&K.write(),S(k,N.topic),ee(k,N.payload)),l!=null&&ee(k,l),n!=null&&ee(k,n),!0}function A(F,k,Q){let te=Q?Q.protocolVersion:4,R=F||{},I=te===5?R.reasonCode:R.returnCode,N=R.properties,q=2;if(typeof I!="number")return k.emit("error",new Error("Invalid return code")),!1;let Y=null;if(te===5){if(Y=W(k,N),!Y)return!1;q+=Y.length}return k.write(p.CONNACK_HEADER),G(k,q),k.write(R.sessionPresent?p.SESSIONPRESENT_HEADER:c),k.write(h.from([I])),Y?.write(),!0}function z(F,k,Q){r("publish: packet: %o",F);let te=Q?Q.protocolVersion:4,R=F||{},I=R.qos||0,N=R.retain?p.RETAIN_MASK:0,q=R.topic,Y=R.payload||y,b=R.messageId,l=R.properties,n=0;if(typeof q=="string")n+=h.byteLength(q)+2;else if(h.isBuffer(q))n+=q.length+2;else return k.emit("error",new Error("Invalid topic")),!1;if(h.isBuffer(Y)?n+=Y.length:n+=h.byteLength(Y),I&&typeof b!="number")return k.emit("error",new Error("Invalid messageId")),!1;I&&(n+=2);let a=null;if(te===5){if(a=W(k,l),!a)return!1;n+=a.length}return k.write(p.PUBLISH_HEADER[I][R.dup?1:0][N?1:0]),G(k,n),g(k,le(q)),k.write(q),I>0&&g(k,b),a?.write(),r("publish: payload: %o",Y),k.write(Y)}function j(F,k,Q){let te=Q?Q.protocolVersion:4,R=F||{},I=R.cmd||"puback",N=R.messageId,q=R.dup&&I==="pubrel"?p.DUP_MASK:0,Y=0,b=R.reasonCode,l=R.properties,n=te===5?3:2;if(I==="pubrel"&&(Y=1),typeof N!="number")return k.emit("error",new Error("Invalid messageId")),!1;let a=null;if(te===5&&typeof l=="object"){if(a=U(k,l,Q,n),!a)return!1;n+=a.length}return k.write(p.ACKS[I][Y][q][0]),G(k,n),g(k,N),te===5&&k.write(h.from([b])),a!==null&&a.write(),!0}function x(F,k,Q){r("subscribe: packet: ");let te=Q?Q.protocolVersion:4,R=F||{},I=R.dup?p.DUP_MASK:0,N=R.messageId,q=R.subscriptions,Y=R.properties,b=0;if(typeof N!="number")return k.emit("error",new Error("Invalid messageId")),!1;b+=2;let l=null;if(te===5){if(l=W(k,Y),!l)return!1;b+=l.length}if(typeof q=="object"&&q.length)for(let a=0;a<q.length;a+=1){let w=q[a].topic,D=q[a].qos;if(typeof w!="string")return k.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if(typeof D!="number")return k.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(te===5){if(typeof(q[a].nl||!1)!="boolean")return k.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if(typeof(q[a].rap||!1)!="boolean")return k.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;let ue=q[a].rh||0;if(typeof ue!="number"||ue>2)return k.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}b+=h.byteLength(w)+2+1}else return k.emit("error",new Error("Invalid subscriptions")),!1;r("subscribe: writing to stream: %o",p.SUBSCRIBE_HEADER),k.write(p.SUBSCRIBE_HEADER[1][I?1:0][0]),G(k,b),g(k,N),l!==null&&l.write();let n=!0;for(let a of q){let w=a.topic,D=a.qos,K=+a.nl,J=+a.rap,ue=a.rh,ce;S(k,w),ce=p.SUBSCRIBE_OPTIONS_QOS[D],te===5&&(ce|=K?p.SUBSCRIBE_OPTIONS_NL:0,ce|=J?p.SUBSCRIBE_OPTIONS_RAP:0,ce|=ue?p.SUBSCRIBE_OPTIONS_RH[ue]:0),n=k.write(h.from([ce]))}return n}function O(F,k,Q){let te=Q?Q.protocolVersion:4,R=F||{},I=R.messageId,N=R.granted,q=R.properties,Y=0;if(typeof I!="number")return k.emit("error",new Error("Invalid messageId")),!1;if(Y+=2,typeof N=="object"&&N.length)for(let l=0;l<N.length;l+=1){if(typeof N[l]!="number")return k.emit("error",new Error("Invalid qos vector")),!1;Y+=1}else return k.emit("error",new Error("Invalid qos vector")),!1;let b=null;if(te===5){if(b=U(k,q,Q,Y),!b)return!1;Y+=b.length}return k.write(p.SUBACK_HEADER),G(k,Y),g(k,I),b!==null&&b.write(),k.write(h.from(N))}function C(F,k,Q){let te=Q?Q.protocolVersion:4,R=F||{},I=R.messageId,N=R.dup?p.DUP_MASK:0,q=R.unsubscriptions,Y=R.properties,b=0;if(typeof I!="number")return k.emit("error",new Error("Invalid messageId")),!1;if(b+=2,typeof q=="object"&&q.length)for(let a=0;a<q.length;a+=1){if(typeof q[a]!="string")return k.emit("error",new Error("Invalid unsubscriptions")),!1;b+=h.byteLength(q[a])+2}else return k.emit("error",new Error("Invalid unsubscriptions")),!1;let l=null;if(te===5){if(l=W(k,Y),!l)return!1;b+=l.length}k.write(p.UNSUBSCRIBE_HEADER[1][N?1:0][0]),G(k,b),g(k,I),l!==null&&l.write();let n=!0;for(let a=0;a<q.length;a++)n=S(k,q[a]);return n}function V(F,k,Q){let te=Q?Q.protocolVersion:4,R=F||{},I=R.messageId,N=R.dup?p.DUP_MASK:0,q=R.granted,Y=R.properties,b=R.cmd,l=0,n=2;if(typeof I!="number")return k.emit("error",new Error("Invalid messageId")),!1;if(te===5)if(typeof q=="object"&&q.length)for(let w=0;w<q.length;w+=1){if(typeof q[w]!="number")return k.emit("error",new Error("Invalid qos vector")),!1;n+=1}else return k.emit("error",new Error("Invalid qos vector")),!1;let a=null;if(te===5){if(a=U(k,Y,Q,n),!a)return!1;n+=a.length}return k.write(p.ACKS[b][l][N][0]),G(k,n),g(k,I),a!==null&&a.write(),te===5&&k.write(h.from(q)),!0}function B(F,k,Q){return k.write(p.EMPTY[F.cmd])}function ne(F,k,Q){let te=Q?Q.protocolVersion:4,R=F||{},I=R.reasonCode,N=R.properties,q=te===5?1:0,Y=null;if(te===5){if(Y=U(k,N,Q,q),!Y)return!1;q+=Y.length}return k.write(h.from([p.codes.disconnect<<4])),G(k,q),te===5&&k.write(h.from([I])),Y!==null&&Y.write(),!0}function oe(F,k,Q){let te=Q?Q.protocolVersion:4,R=F||{},I=R.reasonCode,N=R.properties,q=te===5?1:0;te!==5&&k.emit("error",new Error("Invalid mqtt version for auth packet"));let Y=U(k,N,Q,q);return Y?(q+=Y.length,k.write(h.from([p.codes.auth<<4])),G(k,q),k.write(h.from([I])),Y!==null&&Y.write(),!0):!1}let ie={};function G(F,k){if(k>p.VARBYTEINT_MAX)return F.emit("error",new Error(`Invalid variable byte integer: ${k}`)),!1;let Q=ie[k];return Q||(Q=u(k),k<16384&&(ie[k]=Q)),r("writeVarByteInt: writing to stream: %o",Q),F.write(Q)}function S(F,k){let Q=h.byteLength(k);return g(F,Q),r("writeString: %s",k),F.write(k,"utf8")}function P(F,k,Q){S(F,k),S(F,Q)}function L(F,k){return r("writeNumberCached: number: %d",k),r("writeNumberCached: %o",e[k]),F.write(e[k])}function H(F,k){let Q=t(k);return r("writeNumberGenerated: %o",Q),F.write(Q)}function re(F,k){let Q=d(k);return r("write4ByteNumber: %o",Q),F.write(Q)}function ee(F,k){typeof k=="string"?S(F,k):k?(g(F,k.length),F.write(k)):g(F,0)}function W(F,k){if(typeof k!="object"||k.length!=null)return{length:1,write(){$(F,{},0)}};let Q=0;function te(I,N){let q=p.propertiesTypes[I],Y=0;switch(q){case"byte":{if(typeof N!="boolean")return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=2;break}case"int8":{if(typeof N!="number"||N<0||N>255)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=2;break}case"binary":{if(N&&N===null)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=1+h.byteLength(N)+2;break}case"int16":{if(typeof N!="number"||N<0||N>65535)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=3;break}case"int32":{if(typeof N!="number"||N<0||N>4294967295)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=5;break}case"var":{if(typeof N!="number"||N<0||N>268435455)return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=1+h.byteLength(u(N));break}case"string":{if(typeof N!="string")return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=3+h.byteLength(N.toString());break}case"pair":{if(typeof N!="object")return F.emit("error",new Error(`Invalid ${I}: ${N}`)),!1;Y+=Object.getOwnPropertyNames(N).reduce((b,l)=>{let n=N[l];return Array.isArray(n)?b+=n.reduce((a,w)=>(a+=3+h.byteLength(l.toString())+2+h.byteLength(w.toString()),a),0):b+=3+h.byteLength(l.toString())+2+h.byteLength(N[l].toString()),b},0);break}default:return F.emit("error",new Error(`Invalid property ${I}: ${N}`)),!1}return Y}if(k)for(let I in k){let N=0,q=0,Y=k[I];if(Array.isArray(Y))for(let b=0;b<Y.length;b++){if(q=te(I,Y[b]),!q)return!1;N+=q}else{if(q=te(I,Y),!q)return!1;N=q}if(!N)return!1;Q+=N}return{length:h.byteLength(u(Q))+Q,write(){$(F,k,Q)}}}function U(F,k,Q,te){let R=["reasonString","userProperties"],I=Q&&Q.properties&&Q.properties.maximumPacketSize?Q.properties.maximumPacketSize:0,N=W(F,k);if(I)for(;te+N.length>I;){let q=R.shift();if(q&&k[q])delete k[q],N=W(F,k);else return!1}return N}function X(F,k,Q){switch(p.propertiesTypes[k]){case"byte":{F.write(h.from([p.properties[k]])),F.write(h.from([+Q]));break}case"int8":{F.write(h.from([p.properties[k]])),F.write(h.from([Q]));break}case"binary":{F.write(h.from([p.properties[k]])),ee(F,Q);break}case"int16":{F.write(h.from([p.properties[k]])),g(F,Q);break}case"int32":{F.write(h.from([p.properties[k]])),re(F,Q);break}case"var":{F.write(h.from([p.properties[k]])),G(F,Q);break}case"string":{F.write(h.from([p.properties[k]])),S(F,Q);break}case"pair":{Object.getOwnPropertyNames(Q).forEach(R=>{let I=Q[R];Array.isArray(I)?I.forEach(N=>{F.write(h.from([p.properties[k]])),P(F,R.toString(),N.toString())}):(F.write(h.from([p.properties[k]])),P(F,R.toString(),I.toString()))});break}default:return F.emit("error",new Error(`Invalid property ${k} value: ${Q}`)),!1}}function $(F,k,Q){G(F,Q);for(let te in k)if(Object.prototype.hasOwnProperty.call(k,te)&&k[te]!==null){let R=k[te];if(Array.isArray(R))for(let I=0;I<R.length;I++)X(F,te,R[I]);else X(F,te,R)}}function le(F){return F?F instanceof h?F.length:h.byteLength(F):0}function Z(F){return typeof F=="string"||F instanceof h}T.exports=f}).call(this)}).call(this,m("buffer").Buffer)},{"./constants":46,"./numbers":49,buffer:3,debug:20,"process-nextick-args":57}],53:[function(m,T,v){var h=1e3,p=h*60,y=p*60,c=y*24,o=c*7,i=c*365.25;T.exports=function(u,d){d=d||{};var g=typeof u;if(g==="string"&&u.length>0)return r(u);if(g==="number"&&isFinite(u))return d.long?t(u):e(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function r(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var g=parseFloat(d[1]),_=(d[2]||"ms").toLowerCase();switch(_){case"years":case"year":case"yrs":case"yr":case"y":return g*i;case"weeks":case"week":case"w":return g*o;case"days":case"day":case"d":return g*c;case"hours":case"hour":case"hrs":case"hr":case"h":return g*y;case"minutes":case"minute":case"mins":case"min":case"m":return g*p;case"seconds":case"second":case"secs":case"sec":case"s":return g*h;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return g;default:return}}}}function e(u){var d=Math.abs(u);return d>=c?Math.round(u/c)+"d":d>=y?Math.round(u/y)+"h":d>=p?Math.round(u/p)+"m":d>=h?Math.round(u/h)+"s":u+"ms"}function t(u){var d=Math.abs(u);return d>=c?s(u,d,c,"day"):d>=y?s(u,d,y,"hour"):d>=p?s(u,d,p,"minute"):d>=h?s(u,d,h,"second"):u+" ms"}function s(u,d,g,_){var f=d>=g*1.5;return Math.round(u/g)+" "+_+(f?"s":"")}},{}],54:[function(m,T,v){let h=m("./lib/number-allocator.js");T.exports.NumberAllocator=h},{"./lib/number-allocator.js":55}],55:[function(m,T,v){"use strict";let h=m("js-sdsl").OrderedSet,p=m("debug")("number-allocator:trace"),y=m("debug")("number-allocator:error");function c(i,r){this.low=i,this.high=r}c.prototype.equals=function(i){return this.low===i.low&&this.high===i.high},c.prototype.compare=function(i){return this.low<i.low&&this.high<i.low?-1:i.low<this.low&&i.high<this.low?1:0};function o(i,r){if(!(this instanceof o))return new o(i,r);this.min=i,this.max=r,this.ss=new h([],(e,t)=>e.compare(t)),p("Create"),this.clear()}o.prototype.firstVacant=function(){return this.ss.size()===0?null:this.ss.front().low},o.prototype.alloc=function(){if(this.ss.size()===0)return p("alloc():empty"),null;let i=this.ss.begin(),r=i.pointer.low,e=i.pointer.high,t=r;return t+1<=e?this.ss.updateKeyByIterator(i,new c(r+1,e)):this.ss.eraseElementByPos(0),p("alloc():"+t),t},o.prototype.use=function(i){let r=new c(i,i),e=this.ss.lowerBound(r);if(!e.equals(this.ss.end())){let t=e.pointer.low,s=e.pointer.high;return e.pointer.equals(r)?(this.ss.eraseElementByIterator(e),p("use():"+i),!0):t>i?!1:t===i?(this.ss.updateKeyByIterator(e,new c(t+1,s)),p("use():"+i),!0):s===i?(this.ss.updateKeyByIterator(e,new c(t,s-1)),p("use():"+i),!0):(this.ss.updateKeyByIterator(e,new c(i+1,s)),this.ss.insert(new c(t,i-1)),p("use():"+i),!0)}return p("use():failed"),!1},o.prototype.free=function(i){if(i<this.min||i>this.max){y("free():"+i+" is out of range");return}let r=new c(i,i),e=this.ss.upperBound(r);if(e.equals(this.ss.end())){if(e.equals(this.ss.begin())){this.ss.insert(r);return}e.pre();let t=e.pointer.high;e.pointer.high+1===i?this.ss.updateKeyByIterator(e,new c(t,i)):this.ss.insert(r)}else if(e.equals(this.ss.begin()))if(i+1===e.pointer.low){let t=e.pointer.high;this.ss.updateKeyByIterator(e,new c(i,t))}else this.ss.insert(r);else{let t=e.pointer.low,s=e.pointer.high;e.pre();let u=e.pointer.low;e.pointer.high+1===i?i+1===t?(this.ss.eraseElementByIterator(e),this.ss.updateKeyByIterator(e,new c(u,s))):this.ss.updateKeyByIterator(e,new c(u,i)):i+1===t?(this.ss.eraseElementByIterator(e.next()),this.ss.insert(new c(i,s))):this.ss.insert(r)}p("free():"+i)},o.prototype.clear=function(){p("clear()"),this.ss.clear(),this.ss.insert(new c(this.min,this.max))},o.prototype.intervalCount=function(){return this.ss.size()},o.prototype.dump=function(){console.log("length:"+this.ss.size());for(let i of this.ss)console.log(i)},T.exports=o},{debug:20,"js-sdsl":42}],56:[function(m,T,v){var h=m("wrappy");T.exports=h(p),T.exports.strict=h(y),p.proto=p(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return p(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return y(this)},configurable:!0})});function p(c){var o=function(){return o.called?o.value:(o.called=!0,o.value=c.apply(this,arguments))};return o.called=!1,o}function y(c){var o=function(){if(o.called)throw new Error(o.onceError);return o.called=!0,o.value=c.apply(this,arguments)},i=c.name||"Function wrapped with `once`";return o.onceError=i+" shouldn't be called more than once",o.called=!1,o}},{wrappy:80}],57:[function(m,T,v){(function(h){(function(){"use strict";typeof h>"u"||!h.version||h.version.indexOf("v0.")===0||h.version.indexOf("v1.")===0&&h.version.indexOf("v1.8.")!==0?T.exports={nextTick:p}:T.exports=h;function p(y,c,o,i){if(typeof y!="function")throw new TypeError('"callback" argument must be a function');var r=arguments.length,e,t;switch(r){case 0:case 1:return h.nextTick(y);case 2:return h.nextTick(function(){y.call(null,c)});case 3:return h.nextTick(function(){y.call(null,c,o)});case 4:return h.nextTick(function(){y.call(null,c,o,i)});default:for(e=new Array(r-1),t=0;t<e.length;)e[t++]=arguments[t];return h.nextTick(function(){y.apply(null,e)})}}}).call(this)}).call(this,m("_process"))},{_process:85}],58:[function(m,T,v){"use strict";function h(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var p={};function y(e,t,s){s||(s=Error);function u(g,_,f){return typeof t=="string"?t:t(g,_,f)}var d=function(g){h(_,g);function _(f,E,M){return g.call(this,u(f,E,M))||this}return _}(s);d.prototype.name=s.name,d.prototype.code=e,p[e]=d}function c(e,t){if(Array.isArray(e)){var s=e.length;return e=e.map(function(u){return String(u)}),s>2?"one of ".concat(t," ").concat(e.slice(0,s-1).join(", "),", or ")+e[s-1]:s===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function o(e,t,s){return e.substr(!s||s<0?0:+s,t.length)===t}function i(e,t,s){return(s===void 0||s>e.length)&&(s=e.length),e.substring(s-t.length,s)===t}function r(e,t,s){return typeof s!="number"&&(s=0),s+t.length>e.length?!1:e.indexOf(t,s)!==-1}y("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),y("ERR_INVALID_ARG_TYPE",function(e,t,s){var u;typeof t=="string"&&o(t,"not ")?(u="must not be",t=t.replace(/^not /,"")):u="must be";var d;if(i(e," argument"))d="The ".concat(e," ").concat(u," ").concat(c(t,"type"));else{var g=r(e,".")?"property":"argument";d='The "'.concat(e,'" ').concat(g," ").concat(u," ").concat(c(t,"type"))}return d+=". Received type ".concat(typeof s),d},TypeError),y("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),y("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),y("ERR_STREAM_PREMATURE_CLOSE","Premature close"),y("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),y("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),y("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),y("ERR_STREAM_WRITE_AFTER_END","write after end"),y("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),y("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),y("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),T.exports.codes=p},{}],59:[function(m,T,v){(function(h){(function(){"use strict";var p=Object.keys||function(u){var d=[];for(var g in u)d.push(g);return d};T.exports=e;var y=m("./_stream_readable"),c=m("./_stream_writable");m("inherits")(e,y);for(var o=p(c.prototype),i=0;i<o.length;i++){var r=o[i];e.prototype[r]||(e.prototype[r]=c.prototype[r])}function e(u){if(!(this instanceof e))return new e(u);y.call(this,u),c.call(this,u),this.allowHalfOpen=!0,u&&(u.readable===!1&&(this.readable=!1),u.writable===!1&&(this.writable=!1),u.allowHalfOpen===!1&&(this.allowHalfOpen=!1,this.once("end",t)))}Object.defineProperty(e.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(e.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(e.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function t(){this._writableState.ended||h.nextTick(s,this)}function s(u){u.end()}Object.defineProperty(e.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set:function(d){this._readableState===void 0||this._writableState===void 0||(this._readableState.destroyed=d,this._writableState.destroyed=d)}})}).call(this)}).call(this,m("_process"))},{"./_stream_readable":61,"./_stream_writable":63,_process:85,inherits:24}],60:[function(m,T,v){"use strict";T.exports=p;var h=m("./_stream_transform");m("inherits")(p,h);function p(y){if(!(this instanceof p))return new p(y);h.call(this,y)}p.prototype._transform=function(y,c,o){o(null,y)}},{"./_stream_transform":62,inherits:24}],61:[function(m,T,v){(function(h,p){(function(){"use strict";T.exports=G;var y;G.ReadableState=ie;var c=m("events").EventEmitter,o=function(l,n){return l.listeners(n).length},i=m("./internal/streams/stream"),r=m("buffer").Buffer,e=p.Uint8Array||function(){};function t(b){return r.from(b)}function s(b){return r.isBuffer(b)||b instanceof e}var u=m("util"),d;u&&u.debuglog?d=u.debuglog("stream"):d=function(){};var g=m("./internal/streams/buffer_list"),_=m("./internal/streams/destroy"),f=m("./internal/streams/state"),E=f.getHighWaterMark,M=m("../errors").codes,A=M.ERR_INVALID_ARG_TYPE,z=M.ERR_STREAM_PUSH_AFTER_EOF,j=M.ERR_METHOD_NOT_IMPLEMENTED,x=M.ERR_STREAM_UNSHIFT_AFTER_END_EVENT,O,C,V;m("inherits")(G,i);var B=_.errorOrDestroy,ne=["error","close","destroy","pause","resume"];function oe(b,l,n){if(typeof b.prependListener=="function")return b.prependListener(l,n);!b._events||!b._events[l]?b.on(l,n):Array.isArray(b._events[l])?b._events[l].unshift(n):b._events[l]=[n,b._events[l]]}function ie(b,l,n){y=y||m("./_stream_duplex"),b=b||{},typeof n!="boolean"&&(n=l instanceof y),this.objectMode=!!b.objectMode,n&&(this.objectMode=this.objectMode||!!b.readableObjectMode),this.highWaterMark=E(this,b,"readableHighWaterMark",n),this.buffer=new g,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=b.emitClose!==!1,this.autoDestroy=!!b.autoDestroy,this.destroyed=!1,this.defaultEncoding=b.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,b.encoding&&(O||(O=m("string_decoder/").StringDecoder),this.decoder=new O(b.encoding),this.encoding=b.encoding)}function G(b){if(y=y||m("./_stream_duplex"),!(this instanceof G))return new G(b);var l=this instanceof y;this._readableState=new ie(b,this,l),this.readable=!0,b&&(typeof b.read=="function"&&(this._read=b.read),typeof b.destroy=="function"&&(this._destroy=b.destroy)),i.call(this)}Object.defineProperty(G.prototype,"destroyed",{enumerable:!1,get:function(){return this._readableState===void 0?!1:this._readableState.destroyed},set:function(l){this._readableState&&(this._readableState.destroyed=l)}}),G.prototype.destroy=_.destroy,G.prototype._undestroy=_.undestroy,G.prototype._destroy=function(b,l){l(b)},G.prototype.push=function(b,l){var n=this._readableState,a;return n.objectMode?a=!0:typeof b=="string"&&(l=l||n.defaultEncoding,l!==n.encoding&&(b=r.from(b,l),l=""),a=!0),S(this,b,l,!1,a)},G.prototype.unshift=function(b){return S(this,b,null,!0,!1)};function S(b,l,n,a,w){d("readableAddChunk",l);var D=b._readableState;if(l===null)D.reading=!1,W(b,D);else{var K;if(w||(K=L(D,l)),K)B(b,K);else if(D.objectMode||l&&l.length>0)if(typeof l!="string"&&!D.objectMode&&Object.getPrototypeOf(l)!==r.prototype&&(l=t(l)),a)D.endEmitted?B(b,new x):P(b,D,l,!0);else if(D.ended)B(b,new z);else{if(D.destroyed)return!1;D.reading=!1,D.decoder&&!n?(l=D.decoder.write(l),D.objectMode||l.length!==0?P(b,D,l,!1):$(b,D)):P(b,D,l,!1)}else a||(D.reading=!1,$(b,D))}return!D.ended&&(D.length<D.highWaterMark||D.length===0)}function P(b,l,n,a){l.flowing&&l.length===0&&!l.sync?(l.awaitDrain=0,b.emit("data",n)):(l.length+=l.objectMode?1:n.length,a?l.buffer.unshift(n):l.buffer.push(n),l.needReadable&&U(b)),$(b,l)}function L(b,l){var n;return!s(l)&&typeof l!="string"&&l!==void 0&&!b.objectMode&&(n=new A("chunk",["string","Buffer","Uint8Array"],l)),n}G.prototype.isPaused=function(){return this._readableState.flowing===!1},G.prototype.setEncoding=function(b){O||(O=m("string_decoder/").StringDecoder);var l=new O(b);this._readableState.decoder=l,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,a="";n!==null;)a+=l.write(n.data),n=n.next;return this._readableState.buffer.clear(),a!==""&&this._readableState.buffer.push(a),this._readableState.length=a.length,this};var H=1073741824;function re(b){return b>=H?b=H:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function ee(b,l){return b<=0||l.length===0&&l.ended?0:l.objectMode?1:b!==b?l.flowing&&l.length?l.buffer.head.data.length:l.length:(b>l.highWaterMark&&(l.highWaterMark=re(b)),b<=l.length?b:l.ended?l.length:(l.needReadable=!0,0))}G.prototype.read=function(b){d("read",b),b=parseInt(b,10);var l=this._readableState,n=b;if(b!==0&&(l.emittedReadable=!1),b===0&&l.needReadable&&((l.highWaterMark!==0?l.length>=l.highWaterMark:l.length>0)||l.ended))return d("read: emitReadable",l.length,l.ended),l.length===0&&l.ended?N(this):U(this),null;if(b=ee(b,l),b===0&&l.ended)return l.length===0&&N(this),null;var a=l.needReadable;d("need readable",a),(l.length===0||l.length-b<l.highWaterMark)&&(a=!0,d("length less than watermark",a)),l.ended||l.reading?(a=!1,d("reading or ended",a)):a&&(d("do read"),l.reading=!0,l.sync=!0,l.length===0&&(l.needReadable=!0),this._read(l.highWaterMark),l.sync=!1,l.reading||(b=ee(n,l)));var w;return b>0?w=I(b,l):w=null,w===null?(l.needReadable=l.length<=l.highWaterMark,b=0):(l.length-=b,l.awaitDrain=0),l.length===0&&(l.ended||(l.needReadable=!0),n!==b&&l.ended&&N(this)),w!==null&&this.emit("data",w),w};function W(b,l){if(d("onEofChunk"),!l.ended){if(l.decoder){var n=l.decoder.end();n&&n.length&&(l.buffer.push(n),l.length+=l.objectMode?1:n.length)}l.ended=!0,l.sync?U(b):(l.needReadable=!1,l.emittedReadable||(l.emittedReadable=!0,X(b)))}}function U(b){var l=b._readableState;d("emitReadable",l.needReadable,l.emittedReadable),l.needReadable=!1,l.emittedReadable||(d("emitReadable",l.flowing),l.emittedReadable=!0,h.nextTick(X,b))}function X(b){var l=b._readableState;d("emitReadable_",l.destroyed,l.length,l.ended),!l.destroyed&&(l.length||l.ended)&&(b.emit("readable"),l.emittedReadable=!1),l.needReadable=!l.flowing&&!l.ended&&l.length<=l.highWaterMark,R(b)}function $(b,l){l.readingMore||(l.readingMore=!0,h.nextTick(le,b,l))}function le(b,l){for(;!l.reading&&!l.ended&&(l.length<l.highWaterMark||l.flowing&&l.length===0);){var n=l.length;if(d("maybeReadMore read 0"),b.read(0),n===l.length)break}l.readingMore=!1}G.prototype._read=function(b){B(this,new j("_read()"))},G.prototype.pipe=function(b,l){var n=this,a=this._readableState;switch(a.pipesCount){case 0:a.pipes=b;break;case 1:a.pipes=[a.pipes,b];break;default:a.pipes.push(b);break}a.pipesCount+=1,d("pipe count=%d opts=%j",a.pipesCount,l);var w=(!l||l.end!==!1)&&b!==h.stdout&&b!==h.stderr,D=w?J:xe;a.endEmitted?h.nextTick(D):n.once("end",D),b.on("unpipe",K);function K(Me,Oe){d("onunpipe"),Me===n&&Oe&&Oe.hasUnpiped===!1&&(Oe.hasUnpiped=!0,fe())}function J(){d("onend"),b.end()}var ue=Z(n);b.on("drain",ue);var ce=!1;function fe(){d("cleanup"),b.removeListener("close",Ce),b.removeListener("finish",Pe),b.removeListener("drain",ue),b.removeListener("error",he),b.removeListener("unpipe",K),n.removeListener("end",J),n.removeListener("end",xe),n.removeListener("data",ye),ce=!0,a.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&ue()}n.on("data",ye);function ye(Me){d("ondata");var Oe=b.write(Me);d("dest.write",Oe),Oe===!1&&((a.pipesCount===1&&a.pipes===b||a.pipesCount>1&&Y(a.pipes,b)!==-1)&&!ce&&(d("false write response, pause",a.awaitDrain),a.awaitDrain++),n.pause())}function he(Me){d("onerror",Me),xe(),b.removeListener("error",he),o(b,"error")===0&&B(b,Me)}oe(b,"error",he);function Ce(){b.removeListener("finish",Pe),xe()}b.once("close",Ce);function Pe(){d("onfinish"),b.removeListener("close",Ce),xe()}b.once("finish",Pe);function xe(){d("unpipe"),n.unpipe(b)}return b.emit("pipe",n),a.flowing||(d("pipe resume"),n.resume()),b};function Z(b){return function(){var n=b._readableState;d("pipeOnDrain",n.awaitDrain),n.awaitDrain&&n.awaitDrain--,n.awaitDrain===0&&o(b,"data")&&(n.flowing=!0,R(b))}}G.prototype.unpipe=function(b){var l=this._readableState,n={hasUnpiped:!1};if(l.pipesCount===0)return this;if(l.pipesCount===1)return b&&b!==l.pipes?this:(b||(b=l.pipes),l.pipes=null,l.pipesCount=0,l.flowing=!1,b&&b.emit("unpipe",this,n),this);if(!b){var a=l.pipes,w=l.pipesCount;l.pipes=null,l.pipesCount=0,l.flowing=!1;for(var D=0;D<w;D++)a[D].emit("unpipe",this,{hasUnpiped:!1});return this}var K=Y(l.pipes,b);return K===-1?this:(l.pipes.splice(K,1),l.pipesCount-=1,l.pipesCount===1&&(l.pipes=l.pipes[0]),b.emit("unpipe",this,n),this)},G.prototype.on=function(b,l){var n=i.prototype.on.call(this,b,l),a=this._readableState;return b==="data"?(a.readableListening=this.listenerCount("readable")>0,a.flowing!==!1&&this.resume()):b==="readable"&&!a.endEmitted&&!a.readableListening&&(a.readableListening=a.needReadable=!0,a.flowing=!1,a.emittedReadable=!1,d("on readable",a.length,a.reading),a.length?U(this):a.reading||h.nextTick(k,this)),n},G.prototype.addListener=G.prototype.on,G.prototype.removeListener=function(b,l){var n=i.prototype.removeListener.call(this,b,l);return b==="readable"&&h.nextTick(F,this),n},G.prototype.removeAllListeners=function(b){var l=i.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&h.nextTick(F,this),l};function F(b){var l=b._readableState;l.readableListening=b.listenerCount("readable")>0,l.resumeScheduled&&!l.paused?l.flowing=!0:b.listenerCount("data")>0&&b.resume()}function k(b){d("readable nexttick read 0"),b.read(0)}G.prototype.resume=function(){var b=this._readableState;return b.flowing||(d("resume"),b.flowing=!b.readableListening,Q(this,b)),b.paused=!1,this};function Q(b,l){l.resumeScheduled||(l.resumeScheduled=!0,h.nextTick(te,b,l))}function te(b,l){d("resume",l.reading),l.reading||b.read(0),l.resumeScheduled=!1,b.emit("resume"),R(b),l.flowing&&!l.reading&&b.read(0)}G.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function R(b){var l=b._readableState;for(d("flow",l.flowing);l.flowing&&b.read()!==null;);}G.prototype.wrap=function(b){var l=this,n=this._readableState,a=!1;b.on("end",function(){if(d("wrapped end"),n.decoder&&!n.ended){var K=n.decoder.end();K&&K.length&&l.push(K)}l.push(null)}),b.on("data",function(K){if(d("wrapped data"),n.decoder&&(K=n.decoder.write(K)),!(n.objectMode&&K==null)&&!(!n.objectMode&&(!K||!K.length))){var J=l.push(K);J||(a=!0,b.pause())}});for(var w in b)this[w]===void 0&&typeof b[w]=="function"&&(this[w]=function(J){return function(){return b[J].apply(b,arguments)}}(w));for(var D=0;D<ne.length;D++)b.on(ne[D],this.emit.bind(this,ne[D]));return this._read=function(K){d("wrapped _read",K),a&&(a=!1,b.resume())},this},typeof Symbol=="function"&&(G.prototype[Symbol.asyncIterator]=function(){return C===void 0&&(C=m("./internal/streams/async_iterator")),C(this)}),Object.defineProperty(G.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(G.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(G.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(l){this._readableState&&(this._readableState.flowing=l)}}),G._fromList=I,Object.defineProperty(G.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}});function I(b,l){if(l.length===0)return null;var n;return l.objectMode?n=l.buffer.shift():!b||b>=l.length?(l.decoder?n=l.buffer.join(""):l.buffer.length===1?n=l.buffer.first():n=l.buffer.concat(l.length),l.buffer.clear()):n=l.buffer.consume(b,l.decoder),n}function N(b){var l=b._readableState;d("endReadable",l.endEmitted),l.endEmitted||(l.ended=!0,h.nextTick(q,l,b))}function q(b,l){if(d("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,l.readable=!1,l.emit("end"),b.autoDestroy)){var n=l._writableState;(!n||n.autoDestroy&&n.finished)&&l.destroy()}}typeof Symbol=="function"&&(G.from=function(b,l){return V===void 0&&(V=m("./internal/streams/from")),V(G,b,l)});function Y(b,l){for(var n=0,a=b.length;n<a;n++)if(b[n]===l)return n;return-1}}).call(this)}).call(this,m("_process"),typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":58,"./_stream_duplex":59,"./internal/streams/async_iterator":64,"./internal/streams/buffer_list":65,"./internal/streams/destroy":66,"./internal/streams/from":68,"./internal/streams/state":70,"./internal/streams/stream":71,_process:85,buffer:3,events:4,inherits:24,"string_decoder/":78,util:2}],62:[function(m,T,v){"use strict";T.exports=e;var h=m("../errors").codes,p=h.ERR_METHOD_NOT_IMPLEMENTED,y=h.ERR_MULTIPLE_CALLBACK,c=h.ERR_TRANSFORM_ALREADY_TRANSFORMING,o=h.ERR_TRANSFORM_WITH_LENGTH_0,i=m("./_stream_duplex");m("inherits")(e,i);function r(u,d){var g=this._transformState;g.transforming=!1;var _=g.writecb;if(_===null)return this.emit("error",new y);g.writechunk=null,g.writecb=null,d!=null&&this.push(d),_(u);var f=this._readableState;f.reading=!1,(f.needReadable||f.length<f.highWaterMark)&&this._read(f.highWaterMark)}function e(u){if(!(this instanceof e))return new e(u);i.call(this,u),this._transformState={afterTransform:r.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,u&&(typeof u.transform=="function"&&(this._transform=u.transform),typeof u.flush=="function"&&(this._flush=u.flush)),this.on("prefinish",t)}function t(){var u=this;typeof this._flush=="function"&&!this._readableState.destroyed?this._flush(function(d,g){s(u,d,g)}):s(this,null,null)}e.prototype.push=function(u,d){return this._transformState.needTransform=!1,i.prototype.push.call(this,u,d)},e.prototype._transform=function(u,d,g){g(new p("_transform()"))},e.prototype._write=function(u,d,g){var _=this._transformState;if(_.writecb=g,_.writechunk=u,_.writeencoding=d,!_.transforming){var f=this._readableState;(_.needTransform||f.needReadable||f.length<f.highWaterMark)&&this._read(f.highWaterMark)}},e.prototype._read=function(u){var d=this._transformState;d.writechunk!==null&&!d.transforming?(d.transforming=!0,this._transform(d.writechunk,d.writeencoding,d.afterTransform)):d.needTransform=!0},e.prototype._destroy=function(u,d){i.prototype._destroy.call(this,u,function(g){d(g)})};function s(u,d,g){if(d)return u.emit("error",d);if(g!=null&&u.push(g),u._writableState.length)throw new o;if(u._transformState.transforming)throw new c;return u.push(null)}},{"../errors":58,"./_stream_duplex":59,inherits:24}],63:[function(m,T,v){(function(h,p){(function(){"use strict";T.exports=ie;function y(R,I,N){this.chunk=R,this.encoding=I,this.callback=N,this.next=null}function c(R){var I=this;this.next=null,this.entry=null,this.finish=function(){te(I,R)}}var o;ie.WritableState=ne;var i={deprecate:m("util-deprecate")},r=m("./internal/streams/stream"),e=m("buffer").Buffer,t=p.Uint8Array||function(){};function s(R){return e.from(R)}function u(R){return e.isBuffer(R)||R instanceof t}var d=m("./internal/streams/destroy"),g=m("./internal/streams/state"),_=g.getHighWaterMark,f=m("../errors").codes,E=f.ERR_INVALID_ARG_TYPE,M=f.ERR_METHOD_NOT_IMPLEMENTED,A=f.ERR_MULTIPLE_CALLBACK,z=f.ERR_STREAM_CANNOT_PIPE,j=f.ERR_STREAM_DESTROYED,x=f.ERR_STREAM_NULL_VALUES,O=f.ERR_STREAM_WRITE_AFTER_END,C=f.ERR_UNKNOWN_ENCODING,V=d.errorOrDestroy;m("inherits")(ie,r);function B(){}function ne(R,I,N){o=o||m("./_stream_duplex"),R=R||{},typeof N!="boolean"&&(N=I instanceof o),this.objectMode=!!R.objectMode,N&&(this.objectMode=this.objectMode||!!R.writableObjectMode),this.highWaterMark=_(this,R,"writableHighWaterMark",N),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var q=R.decodeStrings===!1;this.decodeStrings=!q,this.defaultEncoding=R.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Y){W(I,Y)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=R.emitClose!==!1,this.autoDestroy=!!R.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new c(this)}ne.prototype.getBuffer=function(){for(var I=this.bufferedRequest,N=[];I;)N.push(I),I=I.next;return N},function(){try{Object.defineProperty(ne.prototype,"buffer",{get:i.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var oe;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(oe=Function.prototype[Symbol.hasInstance],Object.defineProperty(ie,Symbol.hasInstance,{value:function(I){return oe.call(this,I)?!0:this!==ie?!1:I&&I._writableState instanceof ne}})):oe=function(I){return I instanceof this};function ie(R){o=o||m("./_stream_duplex");var I=this instanceof o;if(!I&&!oe.call(ie,this))return new ie(R);this._writableState=new ne(R,this,I),this.writable=!0,R&&(typeof R.write=="function"&&(this._write=R.write),typeof R.writev=="function"&&(this._writev=R.writev),typeof R.destroy=="function"&&(this._destroy=R.destroy),typeof R.final=="function"&&(this._final=R.final)),r.call(this)}ie.prototype.pipe=function(){V(this,new z)};function G(R,I){var N=new O;V(R,N),h.nextTick(I,N)}function S(R,I,N,q){var Y;return N===null?Y=new x:typeof N!="string"&&!I.objectMode&&(Y=new E("chunk",["string","Buffer"],N)),Y?(V(R,Y),h.nextTick(q,Y),!1):!0}ie.prototype.write=function(R,I,N){var q=this._writableState,Y=!1,b=!q.objectMode&&u(R);return b&&!e.isBuffer(R)&&(R=s(R)),typeof I=="function"&&(N=I,I=null),b?I="buffer":I||(I=q.defaultEncoding),typeof N!="function"&&(N=B),q.ending?G(this,N):(b||S(this,q,R,N))&&(q.pendingcb++,Y=L(this,q,b,R,I,N)),Y},ie.prototype.cork=function(){this._writableState.corked++},ie.prototype.uncork=function(){var R=this._writableState;R.corked&&(R.corked--,!R.writing&&!R.corked&&!R.bufferProcessing&&R.bufferedRequest&&$(this,R))},ie.prototype.setDefaultEncoding=function(I){if(typeof I=="string"&&(I=I.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((I+"").toLowerCase())>-1))throw new C(I);return this._writableState.defaultEncoding=I,this},Object.defineProperty(ie.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function P(R,I,N){return!R.objectMode&&R.decodeStrings!==!1&&typeof I=="string"&&(I=e.from(I,N)),I}Object.defineProperty(ie.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function L(R,I,N,q,Y,b){if(!N){var l=P(I,q,Y);q!==l&&(N=!0,Y="buffer",q=l)}var n=I.objectMode?1:q.length;I.length+=n;var a=I.length<I.highWaterMark;if(a||(I.needDrain=!0),I.writing||I.corked){var w=I.lastBufferedRequest;I.lastBufferedRequest={chunk:q,encoding:Y,isBuf:N,callback:b,next:null},w?w.next=I.lastBufferedRequest:I.bufferedRequest=I.lastBufferedRequest,I.bufferedRequestCount+=1}else H(R,I,!1,n,q,Y,b);return a}function H(R,I,N,q,Y,b,l){I.writelen=q,I.writecb=l,I.writing=!0,I.sync=!0,I.destroyed?I.onwrite(new j("write")):N?R._writev(Y,I.onwrite):R._write(Y,b,I.onwrite),I.sync=!1}function re(R,I,N,q,Y){--I.pendingcb,N?(h.nextTick(Y,q),h.nextTick(k,R,I),R._writableState.errorEmitted=!0,V(R,q)):(Y(q),R._writableState.errorEmitted=!0,V(R,q),k(R,I))}function ee(R){R.writing=!1,R.writecb=null,R.length-=R.writelen,R.writelen=0}function W(R,I){var N=R._writableState,q=N.sync,Y=N.writecb;if(typeof Y!="function")throw new A;if(ee(N),I)re(R,N,q,I,Y);else{var b=le(N)||R.destroyed;!b&&!N.corked&&!N.bufferProcessing&&N.bufferedRequest&&$(R,N),q?h.nextTick(U,R,N,b,Y):U(R,N,b,Y)}}function U(R,I,N,q){N||X(R,I),I.pendingcb--,q(),k(R,I)}function X(R,I){I.length===0&&I.needDrain&&(I.needDrain=!1,R.emit("drain"))}function $(R,I){I.bufferProcessing=!0;var N=I.bufferedRequest;if(R._writev&&N&&N.next){var q=I.bufferedRequestCount,Y=new Array(q),b=I.corkedRequestsFree;b.entry=N;for(var l=0,n=!0;N;)Y[l]=N,N.isBuf||(n=!1),N=N.next,l+=1;Y.allBuffers=n,H(R,I,!0,I.length,Y,"",b.finish),I.pendingcb++,I.lastBufferedRequest=null,b.next?(I.corkedRequestsFree=b.next,b.next=null):I.corkedRequestsFree=new c(I),I.bufferedRequestCount=0}else{for(;N;){var a=N.chunk,w=N.encoding,D=N.callback,K=I.objectMode?1:a.length;if(H(R,I,!1,K,a,w,D),N=N.next,I.bufferedRequestCount--,I.writing)break}N===null&&(I.lastBufferedRequest=null)}I.bufferedRequest=N,I.bufferProcessing=!1}ie.prototype._write=function(R,I,N){N(new M("_write()"))},ie.prototype._writev=null,ie.prototype.end=function(R,I,N){var q=this._writableState;return typeof R=="function"?(N=R,R=null,I=null):typeof I=="function"&&(N=I,I=null),R!=null&&this.write(R,I),q.corked&&(q.corked=1,this.uncork()),q.ending||Q(this,q,N),this},Object.defineProperty(ie.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}});function le(R){return R.ending&&R.length===0&&R.bufferedRequest===null&&!R.finished&&!R.writing}function Z(R,I){R._final(function(N){I.pendingcb--,N&&V(R,N),I.prefinished=!0,R.emit("prefinish"),k(R,I)})}function F(R,I){!I.prefinished&&!I.finalCalled&&(typeof R._final=="function"&&!I.destroyed?(I.pendingcb++,I.finalCalled=!0,h.nextTick(Z,R,I)):(I.prefinished=!0,R.emit("prefinish")))}function k(R,I){var N=le(I);if(N&&(F(R,I),I.pendingcb===0&&(I.finished=!0,R.emit("finish"),I.autoDestroy))){var q=R._readableState;(!q||q.autoDestroy&&q.endEmitted)&&R.destroy()}return N}function Q(R,I,N){I.ending=!0,k(R,I),N&&(I.finished?h.nextTick(N):R.once("finish",N)),I.ended=!0,R.writable=!1}function te(R,I,N){var q=R.entry;for(R.entry=null;q;){var Y=q.callback;I.pendingcb--,Y(N),q=q.next}I.corkedRequestsFree.next=R}Object.defineProperty(ie.prototype,"destroyed",{enumerable:!1,get:function(){return this._writableState===void 0?!1:this._writableState.destroyed},set:function(I){this._writableState&&(this._writableState.destroyed=I)}}),ie.prototype.destroy=d.destroy,ie.prototype._undestroy=d.undestroy,ie.prototype._destroy=function(R,I){I(R)}}).call(this)}).call(this,m("_process"),typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{"../errors":58,"./_stream_duplex":59,"./internal/streams/destroy":66,"./internal/streams/state":70,"./internal/streams/stream":71,_process:85,buffer:3,inherits:24,"util-deprecate":79}],64:[function(m,T,v){(function(h){(function(){"use strict";var p;function y(z,j,x){return j in z?Object.defineProperty(z,j,{value:x,enumerable:!0,configurable:!0,writable:!0}):z[j]=x,z}var c=m("./end-of-stream"),o=Symbol("lastResolve"),i=Symbol("lastReject"),r=Symbol("error"),e=Symbol("ended"),t=Symbol("lastPromise"),s=Symbol("handlePromise"),u=Symbol("stream");function d(z,j){return{value:z,done:j}}function g(z){var j=z[o];if(j!==null){var x=z[u].read();x!==null&&(z[t]=null,z[o]=null,z[i]=null,j(d(x,!1)))}}function _(z){h.nextTick(g,z)}function f(z,j){return function(x,O){z.then(function(){if(j[e]){x(d(void 0,!0));return}j[s](x,O)},O)}}var E=Object.getPrototypeOf(function(){}),M=Object.setPrototypeOf((p={get stream(){return this[u]},next:function(){var j=this,x=this[r];if(x!==null)return Promise.reject(x);if(this[e])return Promise.resolve(d(void 0,!0));if(this[u].destroyed)return new Promise(function(B,ne){h.nextTick(function(){j[r]?ne(j[r]):B(d(void 0,!0))})});var O=this[t],C;if(O)C=new Promise(f(O,this));else{var V=this[u].read();if(V!==null)return Promise.resolve(d(V,!1));C=new Promise(this[s])}return this[t]=C,C}},y(p,Symbol.asyncIterator,function(){return this}),y(p,"return",function(){var j=this;return new Promise(function(x,O){j[u].destroy(null,function(C){if(C){O(C);return}x(d(void 0,!0))})})}),p),E),A=function(j){var x,O=Object.create(M,(x={},y(x,u,{value:j,writable:!0}),y(x,o,{value:null,writable:!0}),y(x,i,{value:null,writable:!0}),y(x,r,{value:null,writable:!0}),y(x,e,{value:j._readableState.endEmitted,writable:!0}),y(x,s,{value:function(V,B){var ne=O[u].read();ne?(O[t]=null,O[o]=null,O[i]=null,V(d(ne,!1))):(O[o]=V,O[i]=B)},writable:!0}),x));return O[t]=null,c(j,function(C){if(C&&C.code!=="ERR_STREAM_PREMATURE_CLOSE"){var V=O[i];V!==null&&(O[t]=null,O[o]=null,O[i]=null,V(C)),O[r]=C;return}var B=O[o];B!==null&&(O[t]=null,O[o]=null,O[i]=null,B(d(void 0,!0))),O[e]=!0}),j.on("readable",_.bind(null,O)),O};T.exports=A}).call(this)}).call(this,m("_process"))},{"./end-of-stream":67,_process:85}],65:[function(m,T,v){"use strict";function h(g,_){var f=Object.keys(g);if(Object.getOwnPropertySymbols){var E=Object.getOwnPropertySymbols(g);_&&(E=E.filter(function(M){return Object.getOwnPropertyDescriptor(g,M).enumerable})),f.push.apply(f,E)}return f}function p(g){for(var _=1;_<arguments.length;_++){var f=arguments[_]!=null?arguments[_]:{};_%2?h(Object(f),!0).forEach(function(E){y(g,E,f[E])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(f)):h(Object(f)).forEach(function(E){Object.defineProperty(g,E,Object.getOwnPropertyDescriptor(f,E))})}return g}function y(g,_,f){return _ in g?Object.defineProperty(g,_,{value:f,enumerable:!0,configurable:!0,writable:!0}):g[_]=f,g}function c(g,_){if(!(g instanceof _))throw new TypeError("Cannot call a class as a function")}function o(g,_){for(var f=0;f<_.length;f++){var E=_[f];E.enumerable=E.enumerable||!1,E.configurable=!0,"value"in E&&(E.writable=!0),Object.defineProperty(g,E.key,E)}}function i(g,_,f){return _&&o(g.prototype,_),f&&o(g,f),g}var r=m("buffer"),e=r.Buffer,t=m("util"),s=t.inspect,u=s&&s.custom||"inspect";function d(g,_,f){e.prototype.copy.call(g,_,f)}T.exports=function(){function g(){c(this,g),this.head=null,this.tail=null,this.length=0}return i(g,[{key:"push",value:function(f){var E={data:f,next:null};this.length>0?this.tail.next=E:this.head=E,this.tail=E,++this.length}},{key:"unshift",value:function(f){var E={data:f,next:this.head};this.length===0&&(this.tail=E),this.head=E,++this.length}},{key:"shift",value:function(){if(this.length!==0){var f=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,f}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(f){if(this.length===0)return"";for(var E=this.head,M=""+E.data;E=E.next;)M+=f+E.data;return M}},{key:"concat",value:function(f){if(this.length===0)return e.alloc(0);for(var E=e.allocUnsafe(f>>>0),M=this.head,A=0;M;)d(M.data,E,A),A+=M.data.length,M=M.next;return E}},{key:"consume",value:function(f,E){var M;return f<this.head.data.length?(M=this.head.data.slice(0,f),this.head.data=this.head.data.slice(f)):f===this.head.data.length?M=this.shift():M=E?this._getString(f):this._getBuffer(f),M}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(f){var E=this.head,M=1,A=E.data;for(f-=A.length;E=E.next;){var z=E.data,j=f>z.length?z.length:f;if(j===z.length?A+=z:A+=z.slice(0,f),f-=j,f===0){j===z.length?(++M,E.next?this.head=E.next:this.head=this.tail=null):(this.head=E,E.data=z.slice(j));break}++M}return this.length-=M,A}},{key:"_getBuffer",value:function(f){var E=e.allocUnsafe(f),M=this.head,A=1;for(M.data.copy(E),f-=M.data.length;M=M.next;){var z=M.data,j=f>z.length?z.length:f;if(z.copy(E,E.length-f,0,j),f-=j,f===0){j===z.length?(++A,M.next?this.head=M.next:this.head=this.tail=null):(this.head=M,M.data=z.slice(j));break}++A}return this.length-=A,E}},{key:u,value:function(f,E){return s(this,p({},E,{depth:0,customInspect:!1}))}}]),g}()},{buffer:3,util:2}],66:[function(m,T,v){(function(h){(function(){"use strict";function p(e,t){var s=this,u=this._readableState&&this._readableState.destroyed,d=this._writableState&&this._writableState.destroyed;return u||d?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,h.nextTick(i,this,e)):h.nextTick(i,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(g){!t&&g?s._writableState?s._writableState.errorEmitted?h.nextTick(c,s):(s._writableState.errorEmitted=!0,h.nextTick(y,s,g)):h.nextTick(y,s,g):t?(h.nextTick(c,s),t(g)):h.nextTick(c,s)}),this)}function y(e,t){i(e,t),c(e)}function c(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function o(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function i(e,t){e.emit("error",t)}function r(e,t){var s=e._readableState,u=e._writableState;s&&s.autoDestroy||u&&u.autoDestroy?e.destroy(t):e.emit("error",t)}T.exports={destroy:p,undestroy:o,errorOrDestroy:r}}).call(this)}).call(this,m("_process"))},{_process:85}],67:[function(m,T,v){"use strict";var h=m("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function p(i){var r=!1;return function(){if(!r){r=!0;for(var e=arguments.length,t=new Array(e),s=0;s<e;s++)t[s]=arguments[s];i.apply(this,t)}}}function y(){}function c(i){return i.setHeader&&typeof i.abort=="function"}function o(i,r,e){if(typeof r=="function")return o(i,null,r);r||(r={}),e=p(e||y);var t=r.readable||r.readable!==!1&&i.readable,s=r.writable||r.writable!==!1&&i.writable,u=function(){i.writable||g()},d=i._writableState&&i._writableState.finished,g=function(){s=!1,d=!0,t||e.call(i)},_=i._readableState&&i._readableState.endEmitted,f=function(){t=!1,_=!0,s||e.call(i)},E=function(j){e.call(i,j)},M=function(){var j;if(t&&!_)return(!i._readableState||!i._readableState.ended)&&(j=new h),e.call(i,j);if(s&&!d)return(!i._writableState||!i._writableState.ended)&&(j=new h),e.call(i,j)},A=function(){i.req.on("finish",g)};return c(i)?(i.on("complete",g),i.on("abort",M),i.req?A():i.on("request",A)):s&&!i._writableState&&(i.on("end",u),i.on("close",u)),i.on("end",f),i.on("finish",g),r.error!==!1&&i.on("error",E),i.on("close",M),function(){i.removeListener("complete",g),i.removeListener("abort",M),i.removeListener("request",A),i.req&&i.req.removeListener("finish",g),i.removeListener("end",u),i.removeListener("close",u),i.removeListener("finish",g),i.removeListener("end",f),i.removeListener("error",E),i.removeListener("close",M)}}T.exports=o},{"../../../errors":58}],68:[function(m,T,v){T.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],69:[function(m,T,v){"use strict";var h;function p(g){var _=!1;return function(){_||(_=!0,g.apply(void 0,arguments))}}var y=m("../../../errors").codes,c=y.ERR_MISSING_ARGS,o=y.ERR_STREAM_DESTROYED;function i(g){if(g)throw g}function r(g){return g.setHeader&&typeof g.abort=="function"}function e(g,_,f,E){E=p(E);var M=!1;g.on("close",function(){M=!0}),h===void 0&&(h=m("./end-of-stream")),h(g,{readable:_,writable:f},function(z){if(z)return E(z);M=!0,E()});var A=!1;return function(z){if(!M&&!A){if(A=!0,r(g))return g.abort();if(typeof g.destroy=="function")return g.destroy();E(z||new o("pipe"))}}}function t(g){g()}function s(g,_){return g.pipe(_)}function u(g){return!g.length||typeof g[g.length-1]!="function"?i:g.pop()}function d(){for(var g=arguments.length,_=new Array(g),f=0;f<g;f++)_[f]=arguments[f];var E=u(_);if(Array.isArray(_[0])&&(_=_[0]),_.length<2)throw new c("streams");var M,A=_.map(function(z,j){var x=j<_.length-1,O=j>0;return e(z,x,O,function(C){M||(M=C),C&&A.forEach(t),!x&&(A.forEach(t),E(M))})});return _.reduce(s)}T.exports=d},{"../../../errors":58,"./end-of-stream":67}],70:[function(m,T,v){"use strict";var h=m("../../../errors").codes.ERR_INVALID_OPT_VALUE;function p(c,o,i){return c.highWaterMark!=null?c.highWaterMark:o?c[i]:null}function y(c,o,i,r){var e=p(o,r,i);if(e!=null){if(!(isFinite(e)&&Math.floor(e)===e)||e<0){var t=r?i:"highWaterMark";throw new h(t,e)}return Math.floor(e)}return c.objectMode?16:16*1024}T.exports={getHighWaterMark:y}},{"../../../errors":58}],71:[function(m,T,v){T.exports=m("events").EventEmitter},{events:4}],72:[function(m,T,v){v=T.exports=m("./lib/_stream_readable.js"),v.Stream=v,v.Readable=v,v.Writable=m("./lib/_stream_writable.js"),v.Duplex=m("./lib/_stream_duplex.js"),v.Transform=m("./lib/_stream_transform.js"),v.PassThrough=m("./lib/_stream_passthrough.js"),v.finished=m("./lib/internal/streams/end-of-stream.js"),v.pipeline=m("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":59,"./lib/_stream_passthrough.js":60,"./lib/_stream_readable.js":61,"./lib/_stream_transform.js":62,"./lib/_stream_writable.js":63,"./lib/internal/streams/end-of-stream.js":67,"./lib/internal/streams/pipeline.js":69}],73:[function(m,T,v){"use strict";function h(y,c,o){var i=this;this._callback=y,this._args=o,this._interval=setInterval(y,c,this._args),this.reschedule=function(r){r||(r=i._interval),i._interval&&clearInterval(i._interval),i._interval=setInterval(i._callback,r,i._args)},this.clear=function(){i._interval&&(clearInterval(i._interval),i._interval=void 0)},this.destroy=function(){i._interval&&clearInterval(i._interval),i._callback=void 0,i._interval=void 0,i._args=void 0}}function p(){if(typeof arguments[0]!="function")throw new Error("callback needed");if(typeof arguments[1]!="number")throw new Error("interval needed");var y;if(arguments.length>0){y=new Array(arguments.length-2);for(var c=0;c<y.length;c++)y[c]=arguments[c+2]}return new h(arguments[0],arguments[1],y)}T.exports=p},{}],74:[function(m,T,v){"use strict";T.exports=m("./index.js")()},{"./index.js":75}],75:[function(m,T,v){(function(h){(function(){"use strict";T.exports=y;function p(o){return o instanceof h?h.from(o):new o.constructor(o.buffer.slice(),o.byteOffset,o.length)}function y(o){if(o=o||{},o.circles)return c(o);return o.proto?e:r;function i(t,s){for(var u=Object.keys(t),d=new Array(u.length),g=0;g<u.length;g++){var _=u[g],f=t[_];typeof f!="object"||f===null?d[_]=f:f instanceof Date?d[_]=new Date(f):ArrayBuffer.isView(f)?d[_]=p(f):d[_]=s(f)}return d}function r(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,r);if(t instanceof Map)return new Map(i(Array.from(t),r));if(t instanceof Set)return new Set(i(Array.from(t),r));var s={};for(var u in t)if(Object.hasOwnProperty.call(t,u)!==!1){var d=t[u];typeof d!="object"||d===null?s[u]=d:d instanceof Date?s[u]=new Date(d):d instanceof Map?s[u]=new Map(i(Array.from(d),r)):d instanceof Set?s[u]=new Set(i(Array.from(d),r)):ArrayBuffer.isView(d)?s[u]=p(d):s[u]=r(d)}return s}function e(t){if(typeof t!="object"||t===null)return t;if(t instanceof Date)return new Date(t);if(Array.isArray(t))return i(t,e);if(t instanceof Map)return new Map(i(Array.from(t),e));if(t instanceof Set)return new Set(i(Array.from(t),e));var s={};for(var u in t){var d=t[u];typeof d!="object"||d===null?s[u]=d:d instanceof Date?s[u]=new Date(d):d instanceof Map?s[u]=new Map(i(Array.from(d),e)):d instanceof Set?s[u]=new Set(i(Array.from(d),e)):ArrayBuffer.isView(d)?s[u]=p(d):s[u]=e(d)}return s}}function c(o){var i=[],r=[];return o.proto?s:t;function e(u,d){for(var g=Object.keys(u),_=new Array(g.length),f=0;f<g.length;f++){var E=g[f],M=u[E];if(typeof M!="object"||M===null)_[E]=M;else if(M instanceof Date)_[E]=new Date(M);else if(ArrayBuffer.isView(M))_[E]=p(M);else{var A=i.indexOf(M);A!==-1?_[E]=r[A]:_[E]=d(M)}}return _}function t(u){if(typeof u!="object"||u===null)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return e(u,t);if(u instanceof Map)return new Map(e(Array.from(u),t));if(u instanceof Set)return new Set(e(Array.from(u),t));var d={};i.push(u),r.push(d);for(var g in u)if(Object.hasOwnProperty.call(u,g)!==!1){var _=u[g];if(typeof _!="object"||_===null)d[g]=_;else if(_ instanceof Date)d[g]=new Date(_);else if(_ instanceof Map)d[g]=new Map(e(Array.from(_),t));else if(_ instanceof Set)d[g]=new Set(e(Array.from(_),t));else if(ArrayBuffer.isView(_))d[g]=p(_);else{var f=i.indexOf(_);f!==-1?d[g]=r[f]:d[g]=t(_)}}return i.pop(),r.pop(),d}function s(u){if(typeof u!="object"||u===null)return u;if(u instanceof Date)return new Date(u);if(Array.isArray(u))return e(u,s);if(u instanceof Map)return new Map(e(Array.from(u),s));if(u instanceof Set)return new Set(e(Array.from(u),s));var d={};i.push(u),r.push(d);for(var g in u){var _=u[g];if(typeof _!="object"||_===null)d[g]=_;else if(_ instanceof Date)d[g]=new Date(_);else if(_ instanceof Map)d[g]=new Map(e(Array.from(_),s));else if(_ instanceof Set)d[g]=new Set(e(Array.from(_),s));else if(ArrayBuffer.isView(_))d[g]=p(_);else{var f=i.indexOf(_);f!==-1?d[g]=r[f]:d[g]=s(_)}}return i.pop(),r.pop(),d}}}).call(this)}).call(this,m("buffer").Buffer)},{buffer:3}],76:[function(m,T,v){var h=m("buffer"),p=h.Buffer;function y(o,i){for(var r in o)i[r]=o[r]}p.from&&p.alloc&&p.allocUnsafe&&p.allocUnsafeSlow?T.exports=h:(y(h,v),v.Buffer=c);function c(o,i,r){return p(o,i,r)}c.prototype=Object.create(p.prototype),y(p,c),c.from=function(o,i,r){if(typeof o=="number")throw new TypeError("Argument must not be a number");return p(o,i,r)},c.alloc=function(o,i,r){if(typeof o!="number")throw new TypeError("Argument must be a number");var e=p(o);return i!==void 0?typeof r=="string"?e.fill(i,r):e.fill(i):e.fill(0),e},c.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return p(o)},c.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return h.SlowBuffer(o)}},{buffer:3}],77:[function(m,T,v){T.exports=h;function h(y){var c=y._readableState;return c?c.objectMode||typeof y._duplexState=="number"?y.read():y.read(p(c)):null}function p(y){return y.buffer.length?y.buffer.head?y.buffer.head.data.length:y.buffer[0].length:y.length}},{}],78:[function(m,T,v){"use strict";var h=m("safe-buffer").Buffer,p=h.isEncoding||function(A){switch(A=""+A,A&&A.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function y(A){if(!A)return"utf8";for(var z;;)switch(A){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return A;default:if(z)return;A=(""+A).toLowerCase(),z=!0}}function c(A){var z=y(A);if(typeof z!="string"&&(h.isEncoding===p||!p(A)))throw new Error("Unknown encoding: "+A);return z||A}v.StringDecoder=o;function o(A){this.encoding=c(A);var z;switch(this.encoding){case"utf16le":this.text=d,this.end=g,z=4;break;case"utf8":this.fillLast=t,z=4;break;case"base64":this.text=_,this.end=f,z=3;break;default:this.write=E,this.end=M;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=h.allocUnsafe(z)}o.prototype.write=function(A){if(A.length===0)return"";var z,j;if(this.lastNeed){if(z=this.fillLast(A),z===void 0)return"";j=this.lastNeed,this.lastNeed=0}else j=0;return j<A.length?z?z+this.text(A,j):this.text(A,j):z||""},o.prototype.end=u,o.prototype.text=s,o.prototype.fillLast=function(A){if(this.lastNeed<=A.length)return A.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);A.copy(this.lastChar,this.lastTotal-this.lastNeed,0,A.length),this.lastNeed-=A.length};function i(A){return A<=127?0:A>>5===6?2:A>>4===14?3:A>>3===30?4:A>>6===2?-1:-2}function r(A,z,j){var x=z.length-1;if(x<j)return 0;var O=i(z[x]);return O>=0?(O>0&&(A.lastNeed=O-1),O):--x<j||O===-2?0:(O=i(z[x]),O>=0?(O>0&&(A.lastNeed=O-2),O):--x<j||O===-2?0:(O=i(z[x]),O>=0?(O>0&&(O===2?O=0:A.lastNeed=O-3),O):0))}function e(A,z,j){if((z[0]&192)!==128)return A.lastNeed=0,"\uFFFD";if(A.lastNeed>1&&z.length>1){if((z[1]&192)!==128)return A.lastNeed=1,"\uFFFD";if(A.lastNeed>2&&z.length>2&&(z[2]&192)!==128)return A.lastNeed=2,"\uFFFD"}}function t(A){var z=this.lastTotal-this.lastNeed,j=e(this,A,z);if(j!==void 0)return j;if(this.lastNeed<=A.length)return A.copy(this.lastChar,z,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);A.copy(this.lastChar,z,0,A.length),this.lastNeed-=A.length}function s(A,z){var j=r(this,A,z);if(!this.lastNeed)return A.toString("utf8",z);this.lastTotal=j;var x=A.length-(j-this.lastNeed);return A.copy(this.lastChar,0,x),A.toString("utf8",z,x)}function u(A){var z=A&&A.length?this.write(A):"";return this.lastNeed?z+"\uFFFD":z}function d(A,z){if((A.length-z)%2===0){var j=A.toString("utf16le",z);if(j){var x=j.charCodeAt(j.length-1);if(x>=55296&&x<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=A[A.length-2],this.lastChar[1]=A[A.length-1],j.slice(0,-1)}return j}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=A[A.length-1],A.toString("utf16le",z,A.length-1)}function g(A){var z=A&&A.length?this.write(A):"";if(this.lastNeed){var j=this.lastTotal-this.lastNeed;return z+this.lastChar.toString("utf16le",0,j)}return z}function _(A,z){var j=(A.length-z)%3;return j===0?A.toString("base64",z):(this.lastNeed=3-j,this.lastTotal=3,j===1?this.lastChar[0]=A[A.length-1]:(this.lastChar[0]=A[A.length-2],this.lastChar[1]=A[A.length-1]),A.toString("base64",z,A.length-j))}function f(A){var z=A&&A.length?this.write(A):"";return this.lastNeed?z+this.lastChar.toString("base64",0,3-this.lastNeed):z}function E(A){return A.toString(this.encoding)}function M(A){return A&&A.length?this.write(A):""}},{"safe-buffer":76}],79:[function(m,T,v){(function(h){(function(){T.exports=p;function p(c,o){if(y("noDeprecation"))return c;var i=!1;function r(){if(!i){if(y("throwDeprecation"))throw new Error(o);y("traceDeprecation")?console.trace(o):console.warn(o),i=!0}return c.apply(this,arguments)}return r}function y(c){try{if(!h.localStorage)return!1}catch{return!1}var o=h.localStorage[c];return o==null?!1:String(o).toLowerCase()==="true"}}).call(this)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],80:[function(m,T,v){T.exports=h;function h(p,y){if(p&&y)return h(p)(y);if(typeof p!="function")throw new TypeError("need wrapper function");return Object.keys(p).forEach(function(o){c[o]=p[o]}),c;function c(){for(var o=new Array(arguments.length),i=0;i<o.length;i++)o[i]=arguments[i];var r=p.apply(this,o),e=o[o.length-1];return typeof r=="function"&&r!==e&&Object.keys(e).forEach(function(t){r[t]=e[t]}),r}}},{}],81:[function(m,T,v){"use strict";T.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},{}],82:[function(m,T,v){T.exports=p;var h=Object.prototype.hasOwnProperty;function p(){for(var y={},c=0;c<arguments.length;c++){var o=arguments[c];for(var i in o)h.call(o,i)&&(y[i]=o[i])}return y}},{}],83:[function(m,T,v){"use strict";T.exports=function(h){h.prototype[Symbol.iterator]=function*(){for(let p=this.head;p;p=p.next)yield p.value}}},{}],84:[function(m,T,v){"use strict";T.exports=h,h.Node=o,h.create=h;function h(i){var r=this;if(r instanceof h||(r=new h),r.tail=null,r.head=null,r.length=0,i&&typeof i.forEach=="function")i.forEach(function(s){r.push(s)});else if(arguments.length>0)for(var e=0,t=arguments.length;e<t;e++)r.push(arguments[e]);return r}h.prototype.removeNode=function(i){if(i.list!==this)throw new Error("removing node which does not belong to this list");var r=i.next,e=i.prev;return r&&(r.prev=e),e&&(e.next=r),i===this.head&&(this.head=r),i===this.tail&&(this.tail=e),i.list.length--,i.next=null,i.prev=null,i.list=null,r},h.prototype.unshiftNode=function(i){if(i!==this.head){i.list&&i.list.removeNode(i);var r=this.head;i.list=this,i.next=r,r&&(r.prev=i),this.head=i,this.tail||(this.tail=i),this.length++}},h.prototype.pushNode=function(i){if(i!==this.tail){i.list&&i.list.removeNode(i);var r=this.tail;i.list=this,i.prev=r,r&&(r.next=i),this.tail=i,this.head||(this.head=i),this.length++}},h.prototype.push=function(){for(var i=0,r=arguments.length;i<r;i++)y(this,arguments[i]);return this.length},h.prototype.unshift=function(){for(var i=0,r=arguments.length;i<r;i++)c(this,arguments[i]);return this.length},h.prototype.pop=function(){if(this.tail){var i=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,i}},h.prototype.shift=function(){if(this.head){var i=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,i}},h.prototype.forEach=function(i,r){r=r||this;for(var e=this.head,t=0;e!==null;t++)i.call(r,e.value,t,this),e=e.next},h.prototype.forEachReverse=function(i,r){r=r||this;for(var e=this.tail,t=this.length-1;e!==null;t--)i.call(r,e.value,t,this),e=e.prev},h.prototype.get=function(i){for(var r=0,e=this.head;e!==null&&r<i;r++)e=e.next;if(r===i&&e!==null)return e.value},h.prototype.getReverse=function(i){for(var r=0,e=this.tail;e!==null&&r<i;r++)e=e.prev;if(r===i&&e!==null)return e.value},h.prototype.map=function(i,r){r=r||this;for(var e=new h,t=this.head;t!==null;)e.push(i.call(r,t.value,this)),t=t.next;return e},h.prototype.mapReverse=function(i,r){r=r||this;for(var e=new h,t=this.tail;t!==null;)e.push(i.call(r,t.value,this)),t=t.prev;return e},h.prototype.reduce=function(i,r){var e,t=this.head;if(arguments.length>1)e=r;else if(this.head)t=this.head.next,e=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;t!==null;s++)e=i(e,t.value,s),t=t.next;return e},h.prototype.reduceReverse=function(i,r){var e,t=this.tail;if(arguments.length>1)e=r;else if(this.tail)t=this.tail.prev,e=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;t!==null;s--)e=i(e,t.value,s),t=t.prev;return e},h.prototype.toArray=function(){for(var i=new Array(this.length),r=0,e=this.head;e!==null;r++)i[r]=e.value,e=e.next;return i},h.prototype.toArrayReverse=function(){for(var i=new Array(this.length),r=0,e=this.tail;e!==null;r++)i[r]=e.value,e=e.prev;return i},h.prototype.slice=function(i,r){r=r||this.length,r<0&&(r+=this.length),i=i||0,i<0&&(i+=this.length);var e=new h;if(r<i||r<0)return e;i<0&&(i=0),r>this.length&&(r=this.length);for(var t=0,s=this.head;s!==null&&t<i;t++)s=s.next;for(;s!==null&&t<r;t++,s=s.next)e.push(s.value);return e},h.prototype.sliceReverse=function(i,r){r=r||this.length,r<0&&(r+=this.length),i=i||0,i<0&&(i+=this.length);var e=new h;if(r<i||r<0)return e;i<0&&(i=0),r>this.length&&(r=this.length);for(var t=this.length,s=this.tail;s!==null&&t>r;t--)s=s.prev;for(;s!==null&&t>i;t--,s=s.prev)e.push(s.value);return e},h.prototype.splice=function(i,r,...e){i>this.length&&(i=this.length-1),i<0&&(i=this.length+i);for(var t=0,s=this.head;s!==null&&t<i;t++)s=s.next;for(var u=[],t=0;s&&t<r;t++)u.push(s.value),s=this.removeNode(s);s===null&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(var t=0;t<e.length;t++)s=p(this,s,e[t]);return u},h.prototype.reverse=function(){for(var i=this.head,r=this.tail,e=i;e!==null;e=e.prev){var t=e.prev;e.prev=e.next,e.next=t}return this.head=r,this.tail=i,this};function p(i,r,e){var t=r===i.head?new o(e,null,r,i):new o(e,r,r.next,i);return t.next===null&&(i.tail=t),t.prev===null&&(i.head=t),i.length++,t}function y(i,r){i.tail=new o(r,i.tail,null,i),i.head||(i.head=i.tail),i.length++}function c(i,r){i.head=new o(r,null,i.head,i),i.tail||(i.tail=i.head),i.length++}function o(i,r,e,t){if(!(this instanceof o))return new o(i,r,e,t);this.list=t,this.value=i,r?(r.next=this,this.prev=r):this.prev=null,e?(e.prev=this,this.next=e):this.next=null}try{m("./iterator.js")(h)}catch{}},{"./iterator.js":83}],85:[function(m,T,v){var h=T.exports={},p,y;function c(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?p=setTimeout:p=c}catch{p=c}try{typeof clearTimeout=="function"?y=clearTimeout:y=o}catch{y=o}})();function i(E){if(p===setTimeout)return setTimeout(E,0);if((p===c||!p)&&setTimeout)return p=setTimeout,setTimeout(E,0);try{return p(E,0)}catch{try{return p.call(null,E,0)}catch{return p.call(this,E,0)}}}function r(E){if(y===clearTimeout)return clearTimeout(E);if((y===o||!y)&&clearTimeout)return y=clearTimeout,clearTimeout(E);try{return y(E)}catch{try{return y.call(null,E)}catch{return y.call(this,E)}}}var e=[],t=!1,s,u=-1;function d(){!t||!s||(t=!1,s.length?e=s.concat(e):u=-1,e.length&&g())}function g(){if(!t){var E=i(d);t=!0;for(var M=e.length;M;){for(s=e,e=[];++u<M;)s&&s[u].run();u=-1,M=e.length}s=null,t=!1,r(E)}}h.nextTick=function(E){var M=new Array(arguments.length-1);if(arguments.length>1)for(var A=1;A<arguments.length;A++)M[A-1]=arguments[A];e.push(new _(E,M)),e.length===1&&!t&&i(g)};function _(E,M){this.fun=E,this.array=M}_.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={};function f(){}h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.prependListener=f,h.prependOnceListener=f,h.listeners=function(E){return[]},h.binding=function(E){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(E){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],86:[function(m,T,v){(function(h){(function(){(function(p){var y=typeof v=="object"&&v&&!v.nodeType&&v,c=typeof T=="object"&&T&&!T.nodeType&&T,o=typeof h=="object"&&h;(o.global===o||o.window===o||o.self===o)&&(p=o);var i,r=2147483647,e=36,t=1,s=26,u=38,d=700,g=72,_=128,f="-",E=/^xn--/,M=/[^\x20-\x7E]/,A=/[\x2E\u3002\uFF0E\uFF61]/g,z={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},j=e-t,x=Math.floor,O=String.fromCharCode,C;function V(W){throw new RangeError(z[W])}function B(W,U){for(var X=W.length,$=[];X--;)$[X]=U(W[X]);return $}function ne(W,U){var X=W.split("@"),$="";X.length>1&&($=X[0]+"@",W=X[1]),W=W.replace(A,".");var le=W.split("."),Z=B(le,U).join(".");return $+Z}function oe(W){for(var U=[],X=0,$=W.length,le,Z;X<$;)le=W.charCodeAt(X++),le>=55296&&le<=56319&&X<$?(Z=W.charCodeAt(X++),(Z&64512)==56320?U.push(((le&1023)<<10)+(Z&1023)+65536):(U.push(le),X--)):U.push(le);return U}function ie(W){return B(W,function(U){var X="";return U>65535&&(U-=65536,X+=O(U>>>10&1023|55296),U=56320|U&1023),X+=O(U),X}).join("")}function G(W){return W-48<10?W-22:W-65<26?W-65:W-97<26?W-97:e}function S(W,U){return W+22+75*(W<26)-((U!=0)<<5)}function P(W,U,X){var $=0;for(W=X?x(W/d):W>>1,W+=x(W/U);W>j*s>>1;$+=e)W=x(W/j);return x($+(j+1)*W/(W+u))}function L(W){var U=[],X=W.length,$,le=0,Z=_,F=g,k,Q,te,R,I,N,q,Y,b;for(k=W.lastIndexOf(f),k<0&&(k=0),Q=0;Q<k;++Q)W.charCodeAt(Q)>=128&&V("not-basic"),U.push(W.charCodeAt(Q));for(te=k>0?k+1:0;te<X;){for(R=le,I=1,N=e;te>=X&&V("invalid-input"),q=G(W.charCodeAt(te++)),(q>=e||q>x((r-le)/I))&&V("overflow"),le+=q*I,Y=N<=F?t:N>=F+s?s:N-F,!(q<Y);N+=e)b=e-Y,I>x(r/b)&&V("overflow"),I*=b;$=U.length+1,F=P(le-R,$,R==0),x(le/$)>r-Z&&V("overflow"),Z+=x(le/$),le%=$,U.splice(le++,0,Z)}return ie(U)}function H(W){var U,X,$,le,Z,F,k,Q,te,R,I,N=[],q,Y,b,l;for(W=oe(W),q=W.length,U=_,X=0,Z=g,F=0;F<q;++F)I=W[F],I<128&&N.push(O(I));for($=le=N.length,le&&N.push(f);$<q;){for(k=r,F=0;F<q;++F)I=W[F],I>=U&&I<k&&(k=I);for(Y=$+1,k-U>x((r-X)/Y)&&V("overflow"),X+=(k-U)*Y,U=k,F=0;F<q;++F)if(I=W[F],I<U&&++X>r&&V("overflow"),I==U){for(Q=X,te=e;R=te<=Z?t:te>=Z+s?s:te-Z,!(Q<R);te+=e)l=Q-R,b=e-R,N.push(O(S(R+l%b,0))),Q=x(l/b);N.push(O(S(Q,0))),Z=P(X,Y,$==le),X=0,++$}++X,++U}return N.join("")}function re(W){return ne(W,function(U){return E.test(U)?L(U.slice(4).toLowerCase()):U})}function ee(W){return ne(W,function(U){return M.test(U)?"xn--"+H(U):U})}if(i={version:"1.4.1",ucs2:{decode:oe,encode:ie},decode:L,encode:H,toASCII:ee,toUnicode:re},typeof se=="function"&&typeof se.amd=="object"&&se.amd)se("punycode",function(){return i});else if(y&&c)if(T.exports==y)c.exports=i;else for(C in i)i.hasOwnProperty(C)&&(y[C]=i[C]);else p.punycode=i})(this)}).call(this)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],87:[function(m,T,v){"use strict";function h(y,c){return Object.prototype.hasOwnProperty.call(y,c)}T.exports=function(y,c,o,i){c=c||"&",o=o||"=";var r={};if(typeof y!="string"||y.length===0)return r;var e=/\+/g;y=y.split(c);var t=1e3;i&&typeof i.maxKeys=="number"&&(t=i.maxKeys);var s=y.length;t>0&&s>t&&(s=t);for(var u=0;u<s;++u){var d=y[u].replace(e,"%20"),g=d.indexOf(o),_,f,E,M;g>=0?(_=d.substr(0,g),f=d.substr(g+1)):(_=d,f=""),E=decodeURIComponent(_),M=decodeURIComponent(f),h(r,E)?p(r[E])?r[E].push(M):r[E]=[r[E],M]:r[E]=M}return r};var p=Array.isArray||function(y){return Object.prototype.toString.call(y)==="[object Array]"}},{}],88:[function(m,T,v){"use strict";var h=function(o){switch(typeof o){case"string":return o;case"boolean":return o?"true":"false";case"number":return isFinite(o)?o:"";default:return""}};T.exports=function(o,i,r,e){return i=i||"&",r=r||"=",o===null&&(o=void 0),typeof o=="object"?y(c(o),function(t){var s=encodeURIComponent(h(t))+r;return p(o[t])?y(o[t],function(u){return s+encodeURIComponent(h(u))}).join(i):s+encodeURIComponent(h(o[t]))}).join(i):e?encodeURIComponent(h(e))+r+encodeURIComponent(h(o)):""};var p=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"};function y(o,i){if(o.map)return o.map(i);for(var r=[],e=0;e<o.length;e++)r.push(i(o[e],e));return r}var c=Object.keys||function(o){var i=[];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&i.push(r);return i}},{}],89:[function(m,T,v){"use strict";v.decode=v.parse=m("./decode"),v.encode=v.stringify=m("./encode")},{"./decode":87,"./encode":88}],90:[function(m,T,v){"use strict";var h=m("punycode"),p=m("./util");v.parse=z,v.resolve=x,v.resolveObject=O,v.format=j,v.Url=y;function y(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var c=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,i=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,r=["<",">",'"',"`"," ","\r",`
  2. `," "],e=["{","}","|","\\","^","`"].concat(r),t=["'"].concat(e),s=["%","/","?",";","#"].concat(t),u=["/","?","#"],d=255,g=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},E={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=m("querystring");function z(C,V,B){if(C&&p.isObject(C)&&C instanceof y)return C;var ne=new y;return ne.parse(C,V,B),ne}y.prototype.parse=function(C,V,B){if(!p.isString(C))throw new TypeError("Parameter 'url' must be a string, not "+typeof C);var ne=C.indexOf("?"),oe=ne!==-1&&ne<C.indexOf("#")?"?":"#",ie=C.split(oe),G=/\\/g;ie[0]=ie[0].replace(G,"/"),C=ie.join(oe);var S=C;if(S=S.trim(),!B&&C.split("#").length===1){var P=i.exec(S);if(P)return this.path=S,this.href=S,this.pathname=P[1],P[2]?(this.search=P[2],V?this.query=A.parse(this.search.substr(1)):this.query=this.search.substr(1)):V&&(this.search="",this.query={}),this}var L=c.exec(S);if(L){L=L[0];var H=L.toLowerCase();this.protocol=H,S=S.substr(L.length)}if(B||L||S.match(/^\/\/[^@\/]+@[^@\/]+/)){var re=S.substr(0,2)==="//";re&&!(L&&E[L])&&(S=S.substr(2),this.slashes=!0)}if(!E[L]&&(re||L&&!M[L])){for(var ee=-1,W=0;W<u.length;W++){var U=S.indexOf(u[W]);U!==-1&&(ee===-1||U<ee)&&(ee=U)}var X,$;ee===-1?$=S.lastIndexOf("@"):$=S.lastIndexOf("@",ee),$!==-1&&(X=S.slice(0,$),S=S.slice($+1),this.auth=decodeURIComponent(X)),ee=-1;for(var W=0;W<s.length;W++){var U=S.indexOf(s[W]);U!==-1&&(ee===-1||U<ee)&&(ee=U)}ee===-1&&(ee=S.length),this.host=S.slice(0,ee),S=S.slice(ee),this.parseHost(),this.hostname=this.hostname||"";var le=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!le)for(var Z=this.hostname.split(/\./),W=0,F=Z.length;W<F;W++){var k=Z[W];if(k&&!k.match(g)){for(var Q="",te=0,R=k.length;te<R;te++)k.charCodeAt(te)>127?Q+="x":Q+=k[te];if(!Q.match(g)){var I=Z.slice(0,W),N=Z.slice(W+1),q=k.match(_);q&&(I.push(q[1]),N.unshift(q[2])),N.length&&(S="/"+N.join(".")+S),this.hostname=I.join(".");break}}}this.hostname.length>d?this.hostname="":this.hostname=this.hostname.toLowerCase(),le||(this.hostname=h.toASCII(this.hostname));var Y=this.port?":"+this.port:"",b=this.hostname||"";this.host=b+Y,this.href+=this.host,le&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),S[0]!=="/"&&(S="/"+S))}if(!f[H])for(var W=0,F=t.length;W<F;W++){var l=t[W];if(S.indexOf(l)!==-1){var n=encodeURIComponent(l);n===l&&(n=escape(l)),S=S.split(l).join(n)}}var a=S.indexOf("#");a!==-1&&(this.hash=S.substr(a),S=S.slice(0,a));var w=S.indexOf("?");if(w!==-1?(this.search=S.substr(w),this.query=S.substr(w+1),V&&(this.query=A.parse(this.query)),S=S.slice(0,w)):V&&(this.search="",this.query={}),S&&(this.pathname=S),M[H]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var Y=this.pathname||"",D=this.search||"";this.path=Y+D}return this.href=this.format(),this};function j(C){return p.isString(C)&&(C=z(C)),C instanceof y?C.format():y.prototype.format.call(C)}y.prototype.format=function(){var C=this.auth||"";C&&(C=encodeURIComponent(C),C=C.replace(/%3A/i,":"),C+="@");var V=this.protocol||"",B=this.pathname||"",ne=this.hash||"",oe=!1,ie="";this.host?oe=C+this.host:this.hostname&&(oe=C+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(oe+=":"+this.port)),this.query&&p.isObject(this.query)&&Object.keys(this.query).length&&(ie=A.stringify(this.query));var G=this.search||ie&&"?"+ie||"";return V&&V.substr(-1)!==":"&&(V+=":"),this.slashes||(!V||M[V])&&oe!==!1?(oe="//"+(oe||""),B&&B.charAt(0)!=="/"&&(B="/"+B)):oe||(oe=""),ne&&ne.charAt(0)!=="#"&&(ne="#"+ne),G&&G.charAt(0)!=="?"&&(G="?"+G),B=B.replace(/[?#]/g,function(S){return encodeURIComponent(S)}),G=G.replace("#","%23"),V+oe+B+G+ne};function x(C,V){return z(C,!1,!0).resolve(V)}y.prototype.resolve=function(C){return this.resolveObject(z(C,!1,!0)).format()};function O(C,V){return C?z(C,!1,!0).resolveObject(V):V}y.prototype.resolveObject=function(C){if(p.isString(C)){var V=new y;V.parse(C,!1,!0),C=V}for(var B=new y,ne=Object.keys(this),oe=0;oe<ne.length;oe++){var ie=ne[oe];B[ie]=this[ie]}if(B.hash=C.hash,C.href==="")return B.href=B.format(),B;if(C.slashes&&!C.protocol){for(var G=Object.keys(C),S=0;S<G.length;S++){var P=G[S];P!=="protocol"&&(B[P]=C[P])}return M[B.protocol]&&B.hostname&&!B.pathname&&(B.path=B.pathname="/"),B.href=B.format(),B}if(C.protocol&&C.protocol!==B.protocol){if(!M[C.protocol]){for(var L=Object.keys(C),H=0;H<L.length;H++){var re=L[H];B[re]=C[re]}return B.href=B.format(),B}if(B.protocol=C.protocol,!C.host&&!E[C.protocol]){for(var F=(C.pathname||"").split("/");F.length&&!(C.host=F.shift()););C.host||(C.host=""),C.hostname||(C.hostname=""),F[0]!==""&&F.unshift(""),F.length<2&&F.unshift(""),B.pathname=F.join("/")}else B.pathname=C.pathname;if(B.search=C.search,B.query=C.query,B.host=C.host||"",B.auth=C.auth,B.hostname=C.hostname||C.host,B.port=C.port,B.pathname||B.search){var ee=B.pathname||"",W=B.search||"";B.path=ee+W}return B.slashes=B.slashes||C.slashes,B.href=B.format(),B}var U=B.pathname&&B.pathname.charAt(0)==="/",X=C.host||C.pathname&&C.pathname.charAt(0)==="/",$=X||U||B.host&&C.pathname,le=$,Z=B.pathname&&B.pathname.split("/")||[],F=C.pathname&&C.pathname.split("/")||[],k=B.protocol&&!M[B.protocol];if(k&&(B.hostname="",B.port=null,B.host&&(Z[0]===""?Z[0]=B.host:Z.unshift(B.host)),B.host="",C.protocol&&(C.hostname=null,C.port=null,C.host&&(F[0]===""?F[0]=C.host:F.unshift(C.host)),C.host=null),$=$&&(F[0]===""||Z[0]==="")),X)B.host=C.host||C.host===""?C.host:B.host,B.hostname=C.hostname||C.hostname===""?C.hostname:B.hostname,B.search=C.search,B.query=C.query,Z=F;else if(F.length)Z||(Z=[]),Z.pop(),Z=Z.concat(F),B.search=C.search,B.query=C.query;else if(!p.isNullOrUndefined(C.search)){if(k){B.hostname=B.host=Z.shift();var Q=B.host&&B.host.indexOf("@")>0?B.host.split("@"):!1;Q&&(B.auth=Q.shift(),B.host=B.hostname=Q.shift())}return B.search=C.search,B.query=C.query,(!p.isNull(B.pathname)||!p.isNull(B.search))&&(B.path=(B.pathname?B.pathname:"")+(B.search?B.search:"")),B.href=B.format(),B}if(!Z.length)return B.pathname=null,B.search?B.path="/"+B.search:B.path=null,B.href=B.format(),B;for(var te=Z.slice(-1)[0],R=(B.host||C.host||Z.length>1)&&(te==="."||te==="..")||te==="",I=0,N=Z.length;N>=0;N--)te=Z[N],te==="."?Z.splice(N,1):te===".."?(Z.splice(N,1),I++):I&&(Z.splice(N,1),I--);if(!$&&!le)for(;I--;I)Z.unshift("..");$&&Z[0]!==""&&(!Z[0]||Z[0].charAt(0)!=="/")&&Z.unshift(""),R&&Z.join("/").substr(-1)!=="/"&&Z.push("");var q=Z[0]===""||Z[0]&&Z[0].charAt(0)==="/";if(k){B.hostname=B.host=q?"":Z.length?Z.shift():"";var Q=B.host&&B.host.indexOf("@")>0?B.host.split("@"):!1;Q&&(B.auth=Q.shift(),B.host=B.hostname=Q.shift())}return $=$||B.host&&Z.length,$&&!q&&Z.unshift(""),Z.length?B.pathname=Z.join("/"):(B.pathname=null,B.path=null),(!p.isNull(B.pathname)||!p.isNull(B.search))&&(B.path=(B.pathname?B.pathname:"")+(B.search?B.search:"")),B.auth=C.auth||B.auth,B.slashes=B.slashes||C.slashes,B.href=B.format(),B},y.prototype.parseHost=function(){var C=this.host,V=o.exec(C);V&&(V=V[0],V!==":"&&(this.port=V.substr(1)),C=C.substr(0,C.length-V.length)),C&&(this.hostname=C)}},{"./util":91,punycode:86,querystring:89}],91:[function(m,T,v){"use strict";T.exports={isString:function(h){return typeof h=="string"},isObject:function(h){return typeof h=="object"&&h!==null},isNull:function(h){return h===null},isNullOrUndefined:function(h){return h==null}}},{}]},{},[17])(17)})});function ri(se,ae){if(se&1&&(ge(0,"th",5),we(1),de()),se&2){let me=ae.$implicit;pe(),Se(me.title)}}function ii(se,ae){if(se&1&&(ge(0,"td",7),we(1),de()),se&2){let me=ae.$implicit,m=ke().$implicit;pe(),Se(m[me.key])}}function ni(se,ae){if(se&1&&(ge(0,"tr"),Ae(1,ii,2,1,"td",6),de()),se&2){let me=ke();pe(),_e("ngForOf",me.columns)}}var bi=(()=>{let ae=class ae{constructor(){this.columns=[],this.data=[]}ngOnInit(){console.log(this.data)}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["app-data-v-lj-table"]],inputs:{columns:"columns",data:"data"},standalone:!0,features:[Ee],decls:7,vars:4,consts:[["nzBordered","","nzSize","small",3,"nzData","nzPageSize"],["dynamicTable",""],["style",`
  3. background: rgb(8 22 48);
  4. /* color: #bfceff !important; */
  5. color: #75f9fd;
  6. text-align: center;
  7. border: 0.5px solid #ffffff !important;
  8. `,"nzShowSort","true",4,"ngFor","ngForOf"],[2,"background","rgb(8 22 48)"],[4,"ngFor","ngForOf"],["nzShowSort","true",2,"background","rgb(8 22 48)","/* color","#bfceff !important",`*/
  9. color`,"#75f9fd","text-align","center","border","0.5px solid #ffffff !important"],["style","text-align: center; color: #75f9fd; border: 0.5px solid #ffffff !important; transition: background 0.3s",4,"ngFor","ngForOf"],[2,"text-align","center","color","#75f9fd","border","0.5px solid #ffffff !important","transition","background 0.3s"]],template:function(T,v){if(T&1&&(ge(0,"nz-table",0,1)(2,"thead")(3,"tr"),Ae(4,ri,2,1,"th",2),de()(),ge(5,"tbody",3),Ae(6,ni,2,1,"tr",4),de()()),T&2){let h=Tt(1);_e("nzData",v.data)("nzPageSize",5),pe(4),_e("ngForOf",v.columns),pe(2),_e("ngForOf",h.data)}},dependencies:[je,ze,at,et,ut,ct,lt,ot,Ue,Je,Ze,gt,nt,rt,tt,De,Ge,$e,ft,dt,qe,ht,it,He,Xe,Ye,dr,hr,fr,pr,yr,gr,mr,pt,Fe,Le,st,Ve,Ne,We,Qe,Be,Pt,Ke],styles:[".ant-table-bordered[_ngcontent-%COMP%] .ant-table-thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%], .ant-table-bordered[_ngcontent-%COMP%] .ant-table-tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{border-color:#fff!important}.tableColor[_ngcontent-%COMP%] .ant-table-tbody[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > td[_ngcontent-%COMP%]{border-right:3px solid #2b3e71!important;border-bottom:1px solid #334474!important;transition:background .3s}.tableColor[_ngcontent-%COMP%] .ant-table-thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%] > th[_ngcontent-%COMP%]{color:#bfceff!important;background-color:transparent!important;border-right:3px solid #2b3e71!important;border-bottom:1px solid #334474!important}"]});let se=ae;return se})();var si=["myGrid"],Si=(()=>{let ae=class ae{constructor(){this.defaultColDef={width:130,editable:!1},this.columnDefs=[],this.rowData=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz"}ngOnInit(){console.log("-----\u8868\u683C\u521D\u59CB\u5316-----"),this.pageSize=10,this.pageIndex=1,this.pageRowTotal=this.rowData.length}nzPageSizeChange(m){this.pageSize=m}nzPageIndexChange(m){console.log(`nzPageIndexChange${m}`),this.grid.api&&(m==1?this.grid.api.paginationGoToFirstPage():this.grid.api.paginationGoToPage(m))}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["app-ag-grid-component"]],viewQuery:function(T,v){if(T&1&&Ct(si,5),T&2){let h;xt(h=It())&&(v.grid=h.first)}},inputs:{defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData:"rowData",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Ee],decls:7,vars:15,consts:[[3,"pagination","suppressPaginationPanel","suppressScrollOnNewData","paginationPageSize","defaultColDef","rowData","columnDefs"],["myGrid",""],[1,"grid-pagination"],[1,"page-total-style"],["nzShowSizeChanger","",3,"nzPageIndex","nzPageSize","nzTotal","className","nzPageSizeChange","nzPageIndexChange"]],template:function(T,v){T&1&&(Ie(0,"ag-grid-angular",0,1)(2,"br"),ge(3,"div",2)(4,"div",3),we(5),de(),ge(6,"nz-pagination",4),Te("nzPageSizeChange",function(p){return v.nzPageSizeChange(p)})("nzPageIndexChange",function(p){return v.nzPageIndexChange(p)}),de()()),T&2&&(vt(v.gridThemeClass),_e("pagination",!0)("suppressPaginationPanel",!0)("suppressPaginationPanel",!0)("suppressScrollOnNewData",!0)("paginationPageSize",v.pageSize)("defaultColDef",v.defaultColDef)("rowData",v.rowData)("columnDefs",v.columnDefs),pe(5),At("\u5171 ",v.pageRowTotal," \u9879\u6570\u636E"),pe(),_e("nzPageIndex",v.pageIndex)("nzPageSize",v.pageSize)("nzTotal",v.pageRowTotal)("className",v.paginationThemeClass))},dependencies:[kt,Ke,Rt],styles:[".grid-pagination[_ngcontent-%COMP%]{display:flex;justify-content:space-between;height:32px}.grid-pagination[_ngcontent-%COMP%] .ant-select-selection-item, .ant-select-selector[_ngcontent-%COMP%]{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .page-total-style{font-size:medium;font-weight:700;color:#00eff8} .ant-select-item-option{color:#00eff8!important} .ant-select-item-option-active div{font-weight:800!important;color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .anticon{color:#00eff8}.grid-pagination[_ngcontent-%COMP%] .ant-select-selector{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-prev .ant-pagination-item-link{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item a{color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active a{color:#000!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-next button, .ant-pagination-prev[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active:focus-visible, .ant-pagination-item-active[_ngcontent-%COMP%]:hover, .ant-pagination-next[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%], .ant-pagination-prev[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%]{border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active{font-weight:500;background-color:#00eff8;border-color:#00eff8;border-width:2px}"]});let se=ae;return se})();var xi=(()=>{let ae=class ae{agInit(m){this.cellValue=this.getValueToDisplay(m)}refresh(m){return this.cellValue=this.getValueToDisplay(m),!0}buttonClicked(){alert(`\u70B9\u51FB\u4E86 ${this.cellValue}`)}getValueToDisplay(m){return m.valueFormatted?m.valueFormatted:m.value}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["ng-component"]],standalone:!0,features:[Ee],decls:3,vars:1,consts:[[2,"display","flex","justify-content","center","align-items","center","height","100%"],[1,"ag-grid-button-style",3,"click"]],template:function(T,v){T&1&&(ge(0,"span",0)(1,"button",1),Te("click",function(){return v.buttonClicked()}),we(2),de()()),T&2&&(pe(2),Se(v.cellValue))},styles:[".ag-grid-button-style[_ngcontent-%COMP%]{cursor:pointer;display:inline-block;width:90px;margin:4px;padding:8px 12px;font-weight:800;color:#e0e0e0;text-align:center;text-decoration:none;background-color:#1e4d6b;border:none;transition:background-color .3s,color .3s}.ag-grid-button-style[_ngcontent-%COMP%]:hover{color:#fff;text-decoration:underline;background-color:#3a6d8c}"]});let se=ae;return se})();var li=["*"],$r=(()=>{let ae=class ae{constructor(){this.showSetting=!1,this.optionsList=[],this.onCheckedItemsChange=new be,this.title=""}getCheckedItems(){return this.optionsList.filter(m=>m.checked)}onCheckChange(){let m=this.getCheckedItems();this.onCheckedItemsChange.emit(m)}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["lj-data-v-card"]],inputs:{showSetting:"showSetting",optionsList:"optionsList",title:"title"},outputs:{onCheckedItemsChange:"onCheckedItemsChange"},standalone:!0,features:[Ee],ngContentSelectors:li,decls:7,vars:1,consts:[[1,"card-content"],[1,"card-top-content"],[1,"card-content-title"],[1,"card-content-l"],["nz-icon","","nzType","setting","nzTheme","outline"]],template:function(T,v){T&1&&(Et(),ge(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3),we(4),de()(),Ie(5,"span",4),de(),St(6),de()),T&2&&(pe(4),Se(v.title))},dependencies:[Ne,Mt,Be,He,je,ze,at,et,ut,ct,lt,ot,Ue,Je,Ze,gt,nt,rt,tt,De,Ot,Ge,$e,ft,dt,qe,ht,it,Xe,Ye,pt,Fe,Le,st,Ve,We,Qe],styles:['.card-content-title[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;width:fit-content;height:fit-content;padding:5px 20px 0;font-size:16px;color:#29b6f6;text-align:center;background-color:#19426e;border:1px solid #1f6f97;border-radius:10px 10px 0 0;box-shadow:inset 0 0 10px #1f6f97}.card-top-content[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto auto;align-items:center;justify-content:space-between}.card-content[_ngcontent-%COMP%]{overflow:hidden;margin-bottom:.5rem;padding:1rem 1.5rem;background-image:url("./media/dashboard_card_bg-2QFDBQFD.jpg");background-repeat:no-repeat;background-position:center;background-size:100% 100%}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%]{display:flex;margin-bottom:.5rem;font-size:18px;font-weight:600;color:#74fafb}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-l[_ngcontent-%COMP%]{flex:1;align-self:flex-start}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-r[_ngcontent-%COMP%]{align-self:flex-end}']});let se=ae;return se})();var ui=["myGrid"],Wi=(()=>{let ae=class ae{constructor(){this.title="",this.showSetting=!0,this.defaultColDef={width:130,editable:!1,headerClass:"ag-header-center",cellStyle:{"font-weight":"bold",textAlign:"center","justify-content":"center","line-height":"38px"}},this.columnDefs=[],this.rowData=[],this.gridThemeClass="ag-theme-quartz",this.paginationThemeClass="ag-theme-quartz",this.tableColumns=[{key:"sort",title:"\u5E8F\u53F7"},{key:"time",title:"\u65F6\u95F4"},{key:"option",title:"\u64CD\u4F5C"},{key:"optionDesc",title:"\u64CD\u4F5C\u63CF\u8FF0"},{key:"optionMan",title:"\u64CD\u4F5C\u4EBA\u5458"},{key:"mark",title:"\u5907\u6CE8"},{key:"edit",title:"\u7F16\u8F91"}],this.tableData=[{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u9501\u5B9A",optionDesc:"\u9501\u5B9A1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"},{sort:"1",time:"2024.1.12 18:23",option:"\u91CA\u653E",optionDesc:"\u91CA\u653E1\u53F7\u78C5",optionMan:"\u5F20\u4E09",mark:"\u65E9\u6668",edit:"\u6309\u94AE"}]}ngOnInit(){this.title?console.log("Title has been passed:",this.title):console.log("Title has not been passed"),console.log("-----\u8868\u683C\u521D\u59CB\u5316-----"),this.pageSize=10,this.pageIndex=1,this.pageRowTotal=this.rowData.length}nzPageSizeChange(m){this.pageSize=m}nzPageIndexChange(m){console.log(`nzPageIndexChange${m}`),this.grid.api&&(m==1?this.grid.api.paginationGoToFirstPage():this.grid.api.paginationGoToPage(m))}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["lj-app-ag-grid-component"]],viewQuery:function(T,v){if(T&1&&Ct(ui,5),T&2){let h;xt(h=It())&&(v.grid=h.first)}},inputs:{title:"title",defaultColDef:"defaultColDef",columnDefs:"columnDefs",rowData:"rowData",gridThemeClass:"gridThemeClass",paginationThemeClass:"paginationThemeClass"},standalone:!0,features:[Ee],decls:8,vars:17,consts:[["nz-col","","nzSpan","24","nzXs","24","nzSm","24","nzMd","12","nzLg","12","nzXl","12","nzXXl","12",3,"title"],[3,"pagination","suppressPaginationPanel","suppressScrollOnNewData","paginationPageSize","defaultColDef","rowData","columnDefs","rowHeight"],["myGrid",""],[1,"grid-pagination"],[1,"page-total-style"],["nzShowSizeChanger","",3,"nzPageIndex","nzPageSize","nzTotal","className","nzPageSizeChange","nzPageIndexChange"]],template:function(T,v){T&1&&(ge(0,"lj-data-v-card",0),Ie(1,"ag-grid-angular",1,2)(3,"br"),ge(4,"div",3)(5,"div",4),we(6),de(),ge(7,"nz-pagination",5),Te("nzPageSizeChange",function(p){return v.nzPageSizeChange(p)})("nzPageIndexChange",function(p){return v.nzPageIndexChange(p)}),de()()()),T&2&&(tr("title",v.title),pe(),vt(v.gridThemeClass),_e("pagination",!0)("suppressPaginationPanel",!0)("suppressPaginationPanel",!0)("suppressScrollOnNewData",!0)("paginationPageSize",v.pageSize)("defaultColDef",v.defaultColDef)("rowData",v.rowData)("columnDefs",v.columnDefs)("rowHeight",38),pe(5),At("\u5171 ",v.pageRowTotal," \u9879\u6570\u636E"),pe(),_e("nzPageIndex",v.pageIndex)("nzPageSize",v.pageSize)("nzTotal",v.pageRowTotal)("className",v.paginationThemeClass))},dependencies:[kt,Ke,Rt,$r],styles:[".grid-pagination[_ngcontent-%COMP%]{display:flex;justify-content:space-between;height:32px}.grid-pagination[_ngcontent-%COMP%] .ant-select-selection-item, .ant-select-selector[_ngcontent-%COMP%]{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .page-total-style{font-size:medium;font-weight:700;color:#00eff8} .ant-select-item-option{color:#00eff8!important} .ant-select-item-option-active div{font-weight:800!important;color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .anticon{color:#00eff8}.grid-pagination[_ngcontent-%COMP%] .ant-select-selector{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-prev .ant-pagination-item-link{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item{color:#00eff8;border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item a{color:#00eff8!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active a{color:#000!important}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-next button, .ant-pagination-prev[_ngcontent-%COMP%] button[_ngcontent-%COMP%]{color:#00eff8;border-color:transparent}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active:focus-visible, .ant-pagination-item-active[_ngcontent-%COMP%]:hover, .ant-pagination-next[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%], .ant-pagination-prev[_ngcontent-%COMP%]:hover button[_ngcontent-%COMP%]{border-color:#00eff8;border-width:2px}.grid-pagination[_ngcontent-%COMP%] .ant-pagination-item-active{font-weight:500;background-color:#00eff8;border-color:#00eff8;border-width:2px}"]});let se=ae;return se})();function ci(se,ae){if(se&1){let me=er();ge(0,"li",9)(1,"label",10),Te("ngModelChange",function(T){let h=Ft(me).$implicit;return Ut(h.checked=T)})("ngModelChange",function(){Ft(me);let T=ke(2);return Ut(T.onCheckChange())}),we(2),de()()}if(se&2){let me=ae.$implicit;pe(),_e("ngModel",me.checked),pe(),Se(me.label)}}function fi(se,ae){if(se&1&&(ge(0,"div",4),Ie(1,"a",5),ge(2,"nz-dropdown-menu",null,6)(4,"ul",7),Ae(5,ci,3,2,"li",8),de()()()),se&2){let me=Tt(3),m=ke();pe(),_e("nzDropdownMenu",me),pe(4),_e("ngForOf",m.optionsList)}}var hi=["*"],en=(()=>{let ae=class ae{constructor(){this.showSetting=!1,this.optionsList=[],this.onCheckedItemsChange=new be,this.title=""}getCheckedItems(){return this.optionsList.filter(m=>m.checked)}onCheckChange(){let m=this.getCheckedItems();this.onCheckedItemsChange.emit(m)}};ae.\u0275fac=function(T){return new(T||ae)},ae.\u0275cmp=ve({type:ae,selectors:[["data-v-card"]],inputs:{showSetting:"showSetting",optionsList:"optionsList",title:"title"},outputs:{onCheckedItemsChange:"onCheckedItemsChange"},standalone:!0,features:[Ee],ngContentSelectors:hi,decls:6,vars:2,consts:[[1,"card-content"],[1,"card-content-title"],[1,"card-content-l"],["class","card-content-r",4,"ngIf"],[1,"card-content-r"],["nz-dropdown","","nz-icon","","nzType","setting","nzTrigger","click","nzTheme","outline",3,"nzDropdownMenu"],["menu","nzDropdownMenu"],["nz-menu","","nzSelectable",""],["nz-menu-item","",4,"ngFor","ngForOf"],["nz-menu-item",""],["nz-checkbox","",3,"ngModel","ngModelChange"]],template:function(T,v){T&1&&(Et(),ge(0,"div",0)(1,"div",1)(2,"div",2),we(3),de(),Ae(4,fi,6,2,"div",3),de(),St(5),de()),T&2&&(pe(3),Se(v.title),pe(),_e("ngIf",v.showSetting))},dependencies:[Ne,Mt,Be,Pt,rr,He,ar,sr,lr,ur,cr,je,ir,nr,ze,at,et,ut,ct,lt,ot,Ue,Je,Ze,gt,nt,rt,tt,De,Ot,Ge,$e,ft,dt,qe,ht,it,Xe,Ye,pt,Fe,Le,st,Ve,We,or,Qe],styles:['.card-content[_ngcontent-%COMP%]{overflow:hidden;padding:1rem 1.5rem;background-image:url("./media/dashboard_card_bg-2QFDBQFD.jpg");background-position:top;background-size:cover;margin-bottom:.5rem}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%]{display:flex;margin-bottom:.5rem;font-size:18px;font-weight:600;color:#74fafb}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-l[_ngcontent-%COMP%]{align-self:flex-start;flex:1}.card-content[_ngcontent-%COMP%] .card-content-title[_ngcontent-%COMP%] .card-content-r[_ngcontent-%COMP%]{align-self:flex-end}']});let se=ae;return se})();var fn=Vt(zt(),1),Xr=Vt(zt(),1);var yt=function(se){return se[se.CLOSED=0]="CLOSED",se[se.CONNECTING=1]="CONNECTING",se[se.CONNECTED=2]="CONNECTED",se}(yt||{});var pi=new Dt("NgxMqttServiceConfig"),di=new Dt("NgxMqttClientService");function Bt(se,...ae){if(!ae.length)return se;let me=ae.shift();if(Wt(se)&&Wt(me))for(let m in me)Wt(me[m])?(se[m]||Object.assign(se,{[m]:{}}),Bt(se[m],me[m])):Object.assign(se,{[m]:me[m]});return Bt(se,...ae)}function Wt(se){return se&&typeof se=="object"&&!Array.isArray(se)}var dn=(()=>{let ae=class ae{constructor(m,T){this.options=m,this.observables={},this.state=new Qt(yt.CLOSED),this.messages=new Nt,this._clientId=this._generateClientId(),this._connectTimeout=1e4,this._reconnectPeriod=1e4,this._onConnect=new be,this._onReconnect=new be,this._onClose=new be,this._onOffline=new be,this._onError=new be,this._onEnd=new be,this._onMessage=new be,this._onSuback=new be,this._onPacketsend=new be,this._onPacketreceive=new be,this._handleOnConnect=v=>{this.options.connectOnCreate===!0&&Object.keys(this.observables).forEach(h=>{this.client.subscribe(h)}),this.state.next(yt.CONNECTED),this._onConnect.emit(v)},this._handleOnReconnect=()=>{this.options.connectOnCreate===!0&&Object.keys(this.observables).forEach(v=>{this.client.subscribe(v)}),this.state.next(yt.CONNECTING),this._onReconnect.emit()},this._handleOnClose=()=>{this.state.next(yt.CLOSED),this._onClose.emit()},this._handleOnOffline=()=>{this._onOffline.emit()},this._handleOnError=v=>{this._onError.emit(v),console.error(v)},this._handleOnEnd=()=>{this._onEnd.emit()},this._handleOnMessage=(v,h,p)=>{this._onMessage.emit(p),p.cmd==="publish"&&this.messages.next(p)},this._handleOnPacketsend=v=>{this._onPacketsend.emit(v)},this._handleOnPacketreceive=v=>{this._onPacketreceive.emit(v)},m.connectOnCreate!==!1&&this.connect({},T),this.state.subscribe()}get clientId(){return this._clientId}get onConnect(){return this._onConnect}get onReconnect(){return this._onReconnect}get onClose(){return this._onClose}get onOffline(){return this._onOffline}get onError(){return this._onError}get onEnd(){return this._onEnd}get onMessage(){return this._onMessage}get onPacketsend(){return this._onPacketsend}get onPacketreceive(){return this._onPacketreceive}get onSuback(){return this._onSuback}static filterMatchesTopic(m,T){if(m[0]==="#"&&T[0]==="$")return!1;let v=(m||"").split("/").reverse(),h=(T||"").split("/").reverse(),p=()=>{let y=v.pop(),c=h.pop();switch(y){case"#":return!0;case"+":return c?p():!1;default:return y===c&&(y===void 0?!0:p())}};return p()}connect(m,T){let v=Bt(this.options||{},m),h=v.protocol||"ws",p=v.hostname||"localhost";v.url?this._url=v.url:(this._url=`${h}://${p}`,this._url+=v.port?`:${v.port}`:"",this._url+=v.path?`${v.path}`:""),this.state.next(yt.CONNECTING);let y=Bt({clientId:this._clientId,reconnectPeriod:this._reconnectPeriod,connectTimeout:this._connectTimeout},v);this.client&&this.client.end(!0),T?this.client=T:this.client=(0,Xr.connect)(this._url,y),this._clientId=y.clientId,this.client.on("connect",this._handleOnConnect),this.client.on("reconnect",this._handleOnReconnect),this.client.on("close",this._handleOnClose),this.client.on("offline",this._handleOnOffline),this.client.on("error",this._handleOnError),this.client.stream.on("error",this._handleOnError),this.client.on("end",this._handleOnEnd),this.client.on("message",this._handleOnMessage),this.client.on("packetsend",this._handleOnPacketsend),this.client.on("packetreceive",this._handleOnPacketreceive)}disconnect(m=!0){if(!this.client)throw new Error("mqtt client not connected");this.client.end(m)}observeRetained(m,T={qos:1}){return this._generalObserve(m,()=>Xt(1),T)}observe(m,T={qos:1}){return this._generalObserve(m,()=>Jt(),T)}_generalObserve(m,T,v){if(!this.client)throw new Error("mqtt client not connected");if(!this.observables[m]){let h=new Nt;this.observables[m]=$t(()=>{let p=new Ht;return this.client.subscribe(m,v,(y,c)=>{c&&c.forEach(o=>{o.qos===128&&(delete this.observables[o.topic],this.client.unsubscribe(o.topic),h.error(`subscription for '${o.topic}' rejected!`)),this._onSuback.emit({filter:m,granted:o.qos!==128})})}),p.add(()=>{delete this.observables[m],this.client.unsubscribe(m)}),p},p=>Yt(h,this.messages)).pipe(Gt(p=>ae.filterMatchesTopic(m,p.topic)),T(),Kt())}return this.observables[m]}publish(m,T,v={}){if(!this.client)throw new Error("mqtt client not connected");return qt.create(h=>{this.client.publish(m,T,v,p=>{p?h.error(p):(h.next(),h.complete())})})}unsafePublish(m,T,v={}){if(!this.client)throw new Error("mqtt client not connected");this.client.publish(m,T,v,h=>{if(h)throw h})}_generateClientId(){return"client-"+Math.random().toString(36).substr(2,19)}};ae.\u0275fac=function(T){return new(T||ae)(Lt(pi),Lt(di))},ae.\u0275prov=Zt({token:ae,factory:ae.\u0275fac,providedIn:"root"});let se=ae;return se})();export{Si as a,xi as b,bi as c,Wi as d,en as e,dn as f};