@amityco/ts-sdk-react-native 6.14.0 → 6.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- var Amity=function(e,t){"use strict";const r=Object.freeze({ONLY_ADMIN_CAN_POST:"ONLY_ADMIN_CAN_POST",ADMIN_REVIEW_POST_REQUIRED:"ADMIN_REVIEW_POST_REQUIRED",ANYONE_CAN_POST:"ANYONE_CAN_POST"}),n=Object.freeze({ONLY_ADMIN_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!0},ADMIN_REVIEW_POST_REQUIRED:{needApprovalOnPostCreation:!0,onlyAdminCanPost:!1},ANYONE_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!1}}),s="ONLY_ADMIN_CAN_POST",i=Object.freeze({STORY:"story",CLIP:"clip",CHAT:"chat",POST:"post",MESSAGE:"message"}),o=Object.freeze({FILE:"file",IMAGE:"image",VIDEO:"video"}),a=Object.freeze({"1080P":"1080p","720P":"720p","480P":"480p","360P":"360p",ORIGINAL:"original"}),l=Object.freeze({UPLOADED:"uploaded",TRANSCODING:"transcoding",TRANSCODED:"transcoded",TRANSCODE_FAILED:"transcodeFailed"}),c=Object.freeze({LOW:"low",MEDIUM:"medium",HIGH:"high",ORIGINAL:"original"}),u=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",AUDIO:"audio",CUSTOM:"custom"}),d=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",LIVESTREAM:"liveStream",POLL:"poll",CUSTOM:"custom"});const h=function(){try{return"v6.14.0-umd"}catch(e){return"__dev__"}}(),f=5,p="cache_then_server",g="For using Live Collection feature you need to enable Cache!",m=6e5,y="dead",v=2e3,b=6e4,w=e=>JSON.stringify(e,((e,t)=>{return"object"==typeof t?(r=t,Object.keys(r).sort().reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:r[t]})),{})):t;var r})),E=e=>JSON.parse(e),T=(e,t)=>e===t||!(!e||!t)&&("object"==typeof e&&Object.keys(e).every((r=>T(e[r],t[r])))),S=e=>[400400,400300].includes(e),C="function"==typeof atob,_="function"==typeof btoa,k="function"==typeof Buffer,A="function"==typeof TextDecoder?new TextDecoder:void 0,I="function"==typeof TextEncoder?new TextEncoder:void 0,R=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),L=(e=>{let t={};return e.forEach(((e,r)=>t[e]=r)),t})(R),D=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,x=String.fromCharCode.bind(String),O="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),P=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),M=_?e=>btoa(e):k?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,r,n,s,i="";const o=e.length%3;for(let o=0;o<e.length;){if((r=e.charCodeAt(o++))>255||(n=e.charCodeAt(o++))>255||(s=e.charCodeAt(o++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|s,i+=R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[63&t]}return o?i.slice(0,o-3)+"===".substring(o):i},F=k?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(x.apply(null,e.subarray(r,r+4096)));return M(t.join(""))},N=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?x(192|t>>>6)+x(128|63&t):x(224|t>>>12&15)+x(128|t>>>6&63)+x(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return x(240|t>>>18&7)+x(128|t>>>12&63)+x(128|t>>>6&63)+x(128|63&t)},U=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,B=k?e=>Buffer.from(e,"utf8").toString("base64"):I?e=>F(I.encode(e)):e=>M(e.replace(U,N)),j=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,$=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return x(55296+(t>>>10))+x(56320+(1023&t));case 3:return x((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return x((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},q=C?e=>atob(P(e)):k?e=>Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!D.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,n,s="";for(let i=0;i<e.length;)t=L[e.charAt(i++)]<<18|L[e.charAt(i++)]<<12|(r=L[e.charAt(i++)])<<6|(n=L[e.charAt(i++)]),s+=64===r?x(t>>16&255):64===n?x(t>>16&255,t>>8&255):x(t>>16&255,t>>8&255,255&t);return s},G=k?e=>O(Buffer.from(e,"base64")):e=>O(q(e),(e=>e.charCodeAt(0))),H=k?e=>Buffer.from(e,"base64").toString("utf8"):A?e=>A.decode(G(e)):e=>q(e).replace(j,$),K=e=>H(P(e.replace(/[-_]/g,(e=>"-"==e?"+":"/")))),V=e=>["skip"].some((t=>t in e)),z=e=>["after","before","first","last","limit"].some((t=>t in e)),W=e=>"limit"in e,Y=e=>(null==e?void 0:e.hasOwnProperty("data"))&&(null==e?void 0:e.hasOwnProperty("nextPage"))&&(null==e?void 0:e.hasOwnProperty("prevPage")),X=(e,t)=>{var r;if(!e||!Object.keys(e).length)return;let n={};return"skiplimit"===t?n={skip:null!==(r=e.after)&&void 0!==r?r:0,limit:e.limit}:"afterbefore"===t&&z(e)?((null==e?void 0:e.before)&&(n=Object.assign(Object.assign({},n),{before:e.before})),(null==e?void 0:e.after)&&(n=Object.assign(Object.assign({},n),{after:e.after})),Number.isNaN(Number(null==e?void 0:e.limit))||(n=Object.assign(Object.assign({},n),{limit:e.limit}))):"afterbeforeraw"===t&&(n=e),Object.keys(n).length?((e,t=!1)=>t?(e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_")))(B(e)):B(e))(JSON.stringify(n)):void 0},Q=e=>{if(!e)return;const t=JSON.parse(K(e));if(V(t))return{after:t.skip,limit:t.limit};if(z(t)){if("before"in t)return{before:t.before,limit:t.last};if("after"in t)return{after:t.after,limit:t.first}}},J=e=>{if(!e)return;const t=JSON.parse(K(e));return W(t)?t:void 0},Z=e=>"locally"in e,ee=e=>"optimistically"in e,te=e=>Z(e)||ee(e),re=e=>null==e?void 0:e.hasOwnProperty("cachedAt"),ne=(e,t=6e4)=>{var r;return Date.now()-(null!==(r=null==e?void 0:e.cachedAt)&&void 0!==r?r:0)<=t},se=(e,...t)=>({func:e,args:t}),ie=(e,t=6e4)=>"cache_only"===e?{lifeSpan:1/0}:{lifeSpan:t<b?b:t},oe=({func:e,args:t},r,n=ie("cache_then_server"))=>{let s;const{lifeSpan:i}=ie("cache_then_server",n.lifeSpan);if(te(e)){try{s=ee(e)?e.optimistically(...t):e.locally(...t)}catch(e){null==r||r(ae(void 0,{origin:"local",loading:!1,error:e}))}const n=re(s)&&ne(s,i);if(null==r||r(ae(s,{origin:"local",loading:!(Z(e)&&n)})),n)return}else null==r||r(ae(void 0,{origin:"local",loading:!0}));e(...t).then((e=>{null==r||r(ae(e,{origin:"server",loading:!1}))})).catch((e=>{null==r||r(ae(void 0,{origin:"server",loading:!1,error:e}))}))};function ae(e,t){return Y(e)||re(e)?Object.assign(Object.assign({},t),e):Object.assign(Object.assign({},t),{data:e})}const le={user:({userId:e})=>e,file:({fileId:e})=>e,role:({roleId:e})=>e,channel:({channelId:e})=>e,subChannel:({subChannelId:e})=>e,channelUsers:({channelId:e,userId:t})=>`${e}#${t}`,message:({messageId:e})=>e,messagePreviewChannel:({channelId:e})=>`${e}`,messagePreviewSubChannel:({subChannelId:e})=>`${e}`,channelMarker:({entityId:e,userId:t})=>`${e}#${t}`,subChannelMarker:({entityId:e,feedId:t,userId:r})=>`${e}#${t}#${r}`,messageMarker:({feedId:e,contentId:t,creatorId:r})=>`${e}#${t}#${r}`,feedMarker:({feedId:e,entityId:t})=>`${e}#${t}`,userMarker:({userId:e})=>e,community:({communityId:e})=>e,category:({categoryId:e})=>e,communityUsers:({communityId:e,userId:t})=>`${e}#${t}`,post:({postId:e})=>e,comment:({commentId:e})=>e,poll:({pollId:e})=>e,reaction:({referenceType:e,referenceId:t})=>`${e}#${t}`,reactor:({reactionId:e})=>e,stream:({streamId:e})=>e,follow:({from:e,to:t})=>`${e}#${t}`,followInfo:({userId:e})=>e,followCount:({userId:e})=>e,feed:({targetId:e,feedId:t})=>`${e}#${t}`},ce=e=>le[e],ue={file:["fileId","attributes"],user:["userId","avatarFileId","roles","permissions"],role:["roleId"],channel:["channelId","defaultSubChannelId"],subChannel:["subChannelId","latestMessageId"],channelUsers:["channelId","userId","membership"],message:["messageId"],community:["communityId","postSetting"],category:["categoryId"],communityUsers:["userId","communityId","communityMembership"],post:["postId","feedId"],comment:["commentId","referenceId"],poll:["pollId"],reaction:["referenceId","referenceType","reactors"],reactor:["reactionId"],stream:["streamId"],follow:["from","to"],feed:["feedId","feedType"],followInfo:["userId","status"],followCount:["userId","followerCount"]},de=e=>{var t;return null===(t=Object.entries(ue).find((([t,r])=>((e,t)=>{const r=Object.keys(e);return t.every((e=>r.includes(e)))})(e,r))))||void 0===t?void 0:t[0]},he=e=>{var t;const r=de(e);if(r)return null===(t=ue[r])||void 0===t?void 0:t[0]},fe={users:"user",files:"file",roles:"role",channels:"channel",messageFeeds:"subChannel",channelUsers:"channelUsers",messages:"message",messagePreviewChannel:"messagePreviewChannel",messagePreviewSubChannel:"messagePreviewSubChannel",userEntityMarkers:"channelMarker",userFeedMarkers:"subChannelMarker",contentMarkers:"messageMarker",feedMarkers:"feedMarker",userMarkers:"userMarker",communities:"community",categories:"category",communityUsers:"communityUsers",posts:"post",postChildren:"post",comments:"comment",polls:"poll",reactors:"reactor",reactions:"reaction",videoStreamings:"stream",follows:"follow",followCounts:"followCount",feeds:"feed"};function pe(e=(new Date).toISOString()){return new Date(new Date(e).getTime()+1).toISOString()}class ge extends Error{constructor(e,t,r){super(`Amity SDK (${t}): ${e}`),this.code=t,this.level=r,this.type="ASC",this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,ge)}}class me extends ge{constructor(e,t,r){super(e,t,r)}}class ye extends ge{constructor(e=8e5,t="fatal"){super("Unexpected error",e,t)}}class ve extends ge{constructor(e,t="SDK client is having connection issues"){super(`${t} (${e})`,"disconnected"===e?800211:800210,"error"),this.event=e}}let be=null;const we=()=>{if(!be)throw new ge("There is no active client",8e5,"fatal");return be},Ee=e=>{be=e};var Te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ce(e){var t=e.default;if("function"==typeof t){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}const _e=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},{hasOwnProperty:ke}=Object.prototype,{propertyIsEnumerable:Ae}=Object,Ie=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),Re=Te,Le={concatArrays:!1,ignoreUndefined:!1},De=e=>{const t=[];for(const r in e)ke.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)Ae.call(e,n)&&t.push(n)}return t};function xe(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return De(e).forEach((r=>{Ie(t,r,xe(e[r]))})),t}(e):_e(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return De(e).forEach((r=>{Ie(t,r,xe(e[r]))})),t}(e):e}const Oe=(e,t,r,n)=>(r.forEach((r=>{void 0===t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?Ie(e,r,Pe(e[r],t[r],n)):Ie(e,r,xe(t[r])))})),e);function Pe(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),s=0;return[e,t].forEach((t=>{const i=[];for(let r=0;r<t.length;r++)ke.call(t,r)&&(i.push(String(r)),Ie(n,s++,t===e?t[r]:xe(t[r])));n=Oe(n,t,De(t).filter((e=>!i.includes(e))),r)})),n})(e,t,r):_e(t)&&_e(e)?Oe(e,t,De(t),r):xe(t)}const Me=function(...e){const t=Pe(xe(Le),this!==Re&&this||{},Le);let r={_:{}};for(const n of e)if(void 0!==n){if(!_e(n))throw new TypeError("`"+n+"` is not an Option Object");r=Pe(r,{_:n},t)}return r._}.bind({concatArrays:!0,ignoreUndefined:!0});function Fe(e,t){return new Promise(((r,n)=>{try{const n=e();null==t||t(null,n),r(n)}catch(e){null==t||t(e),n(e)}}))}function Ne(e,t,r){return Promise.all(e).then((e=>{var n;const s=null!==(n=null==r?void 0:r(e))&&void 0!==n?n:null;return null==t||t(null,s),Promise.resolve(s)}),(e=>(null==t||t(e),Promise.reject(e))))}const Ue={getItem:(e,t)=>Fe((()=>window.localStorage.getItem(e)),t),setItem:(e,t,r)=>Fe((()=>window.localStorage.setItem(e,t)),r),removeItem:(e,t)=>Fe((()=>window.localStorage.removeItem(e)),t),mergeItem:(e,t,r)=>Fe((()=>function(e,t){const r=window.localStorage.getItem(e);if(r){const n=JSON.parse(r),s=JSON.parse(t),i=JSON.stringify(Me(n,s));window.localStorage.setItem(e,i)}else window.localStorage.setItem(e,t)}(e,t)),r),clear:e=>Fe((()=>window.localStorage.clear()),e),getAllKeys:e=>Fe((()=>{const e=window.localStorage.length,t=[];for(let r=0;r<e;r+=1){const e=window.localStorage.key(r)||"";t.push(e)}return t}),e),flushGetRequests:()=>{},multiGet:(e,t)=>Ne(e.map((e=>Ue.getItem(e))),t,(t=>t.map(((t,r)=>[e[r],t])))),multiSet:(e,t)=>Ne(e.map((e=>Ue.setItem(e[0],e[1]))),t),multiRemove:(e,t)=>Ne(e.map((e=>Ue.removeItem(e))),t),multiMerge:(e,t)=>Ne(e.map((e=>Ue.mergeItem(e[0],e[1]))),t)},Be=e=>{const{log:t,cache:r}=we();if(r)return t("cache/api/queryCache",{key:e}),Object.keys(r.data).filter((t=>{const r=E(t);return T(e,r)})).map((e=>r.data[e]))},je=e=>{const{log:t,cache:r}=we();if(!r)return;t("cache/api/pullFromCache",e);const n=w(e);return r.data[n]?r.data[n]:void 0},$e=(e,t,r={cachedAt:Date.now()})=>{const{log:n,cache:s}=we();if(!s)return!1;n("cache/api/pushToCache",{key:e,data:t,options:r}),!(null==r?void 0:r.hasOwnProperty("offline"))&&s.persistIf&&(r.offline=s.persistIf(e,t));const i=w(e);return s.data[i]=Object.assign({key:e,data:t},r),!0},qe=(e,t,r)=>{const{log:n,cache:s}=we();if(!s)return!1;n("cache/api/mergeInCache",{key:e,mutation:t});const i=je(e);if(!i)return!1;const o="function"==typeof t?t(i.data):Object.assign(Object.assign({},i.data),t);return a=i.data,!("updatedAt"in(l=o)&&"updatedAt"in l&&new Date(l.updatedAt)<new Date(a.updatedAt))&&($e(e,o,r),!0);var a,l},Ge=(e,t,r={cachedAt:Date.now()})=>{const{log:n,cache:s}=we();if(!s)return!1;n("cache/api/upsertInCache",{key:e,data:t,options:r});return je(e)?qe(e,t,r):$e(e,t,r)},He=(e,t=!1)=>{const{log:r,cache:n}=we();if(!n)return!1;if(r("cache/api/dropFromCache",{key:e,exact:t}),!t)return Object.keys(n.data).map((e=>E(e))).filter((t=>T(e,t))).map((e=>He(e,!0))).every((e=>e));const s=w(e);return s in n.data&&(delete n.data[s],!0)},Ke=(e,t,r)=>void 0!==r?e.filter((e=>JSON.stringify(e[t])===JSON.stringify(r))):e,Ve=(e,t,r)=>void 0!==r?e.filter((e=>"string"==typeof e[t]&&"string"==typeof r&&String(e[t]).toLowerCase().match(r.toLowerCase()))):e,ze=(e,t,r)=>(null==r?void 0:r.length)?e.filter((e=>Array.isArray(e[t])&&r.some((r=>e[t].includes(r))))):e,We=(e,t,r)=>"all"===t?e:e.filter((e=>{var n;if("community"===e.type)return!0;const s=ce("channelUsers")({channelId:e.channelId,userId:r}),i=null===(n=je(["channelUsers","get",s]))||void 0===n?void 0:n.data;return"member"===t?i&&"none"!==i.membership:!i||"none"===i.membership})),Ye=(e,t)=>e.filter((({targetId:e,feedId:r})=>{var n;const s=null===(n=je(["feed","get",ce("feed")({targetId:e,feedId:r})]))||void 0===n?void 0:n.data;return s&&s.feedType===t})),Xe=(e,t,r)=>"all"===t?e:e.filter((e=>{var n;const s=ce("communityUsers")({communityId:e.communityId,userId:r}),i=null===(n=je(["communityUsers","get",s]))||void 0===n?void 0:n.data;return"member"===t?i&&"member"===i.communityMembership:!i||"none"!==i.communityMembership})),Qe=(e,t)=>{const r=[];return e.reduce(((e,n)=>{var s;if("text"===n.dataType&&!n.children.length)return e;if(r.includes(n.postId))return e;if((null==t?void 0:t.includes(n.dataType))&&e.push(n),!n.children.length)return e;const i=null===(s=je(["post","get",n.children[0]]))||void 0===s?void 0:s.data;return i?r.includes(i.postId)?e:(null==t?void 0:t.includes(null==i?void 0:i.dataType))?(r.push(i.postId),e.push(i),e):e:e}),[])},Je=(e,t)=>{const r=new RegExp(t,"i");return e.filter((e=>{var t;return!!e.userId.match(r)||e.user&&(null===(t=e.user.displayName)||void 0===t?void 0:t.match(r))}))},Ze=({displayName:e},{displayName:t})=>e===t?0:e<t?-1:1,et=({name:e},{name:t})=>e.localeCompare(t),tt=({createdAt:e},{createdAt:t})=>new Date(e).valueOf()-new Date(t).valueOf(),rt=({createdAt:e},{createdAt:t})=>new Date(t).valueOf()-new Date(e).valueOf(),nt=({lastActivity:e},{lastActivity:t})=>new Date(t).valueOf()-new Date(e).valueOf();let st=null;const it=()=>{if(!st)throw new ge("Connect client first",8e5,"fatal");return st},ot=e=>{st={_id:e._id,userId:e.userId,path:e.path}};let at,lt=[];const ct=e=>{clearTimeout(at),lt.push(e),at=setTimeout((()=>{lt.forEach((e=>e())),lt=[]}),0)},ut=["disconnected","error","connect_error","reconnect_error","reconnect_failed","sessionStateChange","tokenExpired"],dt=["connect","message","disconnect","error","close","end","reconnect","user.didGlobalBan"],ht=()=>{return{all:e=e||new Map,on:function(t,r){var n=e.get(t);n?n.push(r):e.set(t,[r])},off:function(t,r){var n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var n=e.get(t);n&&n.slice().map((function(e){e(r)})),(n=e.get("*"))&&n.slice().map((function(e){e(t,r)}))}};var e},ft=(e,t,r,n)=>{const{log:s,emitter:i}=e,o=Date.now();s(`${t}(tmpid: ${o}) > listen`);const a=(...e)=>{s(`${t}(tmpid: ${o}) > trigger`,e);try{n(...e)}catch(e){s(`${t}(tmpid: ${o}) > error`,e)}};return i.on(r,a),()=>{s(`${t}(tmpid: ${o}) > dispose`),i.off(r,a)}},pt=(e,t)=>{const{emitter:r}=we();ct((()=>{r.emit(e,t)}))};let gt,mt;async function yt(){var e;const{mqtt:t,emitter:r,token:n}=we(),s=null!==(e=null==n?void 0:n.accessToken)&&void 0!==e?e:"",i=it();gt===s&&mt===i._id||(gt=s,mt=i._id,await t.connect({accessToken:gt,userId:mt}),((e,t)=>{dt.forEach((r=>{e.on(r,((...e)=>{t.emit(r,1===e.length?e[0]:e)}))})),e.on("message",((e,r)=>{const n=JSON.parse(r.toString());t.emit(n.eventType,n.data)}))})(t,r))}var vt;e.SubscriptionLevels=void 0,(vt=e.SubscriptionLevels||(e.SubscriptionLevels={})).COMMUNITY="community",vt.POST="post",vt.COMMENT="comment",vt.POST_AND_COMMENT="post_and_comment",vt.USER="user";const bt=(e,t)=>{switch(t){case"post":return`${e}/post/+`;case"comment":return`${e}/post/+/comment/+`;case"post_and_comment":return`${e}/post/#`;default:return e}},wt=e=>e.path.split("/user/")[0],Et=({path:t},r=e.SubscriptionLevels.USER)=>bt(r===e.SubscriptionLevels.USER?t:t.replace(/^(\w*)/,"$1/social"),r),Tt=({channelId:e,subChannelId:t})=>{const r=it();return`${wt(r)}/marker/channel/${e}/message/${t}`},St=()=>wt(it()),Ct=()=>{const e=it();return`${wt(e)}/smartfeed/${e._id}/channels`},_t=()=>{const e=it();return`${wt(e)}/smartfeed/${e._id}/messagefeeds`},kt=()=>{const e=it();return`${wt(e)}/smartfeed/${e._id}/messages`};function At(e,t){const{mqtt:r}=we();return yt(),r.subscribe(e,t)}var It,Rt,Lt={exports:{}};function Dt(){if(Rt)return It;Rt=1;var e=1e3,t=60*e,r=60*t,n=24*r,s=7*n,i=365.25*n;function o(e,t,r,n){var s=t>=1.5*r;return Math.round(e/r)+" "+n+(s?"s":"")}return It=function(a,l){l=l||{};var c=typeof a;if("string"===c&&a.length>0)return function(o){if((o=String(o)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!a)return;var l=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*i;case"weeks":case"week":case"w":return l*s;case"days":case"day":case"d":return l*n;case"hours":case"hour":case"hrs":case"hr":case"h":return l*r;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}(a);if("number"===c&&isFinite(a))return l.long?function(s){var i=Math.abs(s);if(i>=n)return o(s,i,n,"day");if(i>=r)return o(s,i,r,"hour");if(i>=t)return o(s,i,t,"minute");if(i>=e)return o(s,i,e,"second");return s+" ms"}(a):function(s){var i=Math.abs(s);if(i>=n)return Math.round(s/n)+"d";if(i>=r)return Math.round(s/r)+"h";if(i>=t)return Math.round(s/t)+"m";if(i>=e)return Math.round(s/e)+"s";return s+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))},It}var xt=function(e){function t(e){let n,s,i,o=null;function a(...e){if(!a.enabled)return;const r=a,s=Number(new Date),i=s-(n||s);r.diff=i,r.prev=n,r.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,s)=>{if("%%"===n)return"%";o++;const i=t.formatters[s];if("function"==typeof i){const t=e[o];n=i.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r<s;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Dt(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,s=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(s=n))})),t.splice(s,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.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`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=xt(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Lt,Lt.exports);var Ot,Pt=Lt.exports;const Mt="object"==typeof globalThis?globalThis:"object"==typeof global?global:window,{process:Ft={}}=Mt,Nt="production"===(null===(Ot=Ft.env)||void 0===Ot?void 0:Ot.NODE_ENV),Ut={EU:"eu",SG:"sg",US:"us"},Bt={http:"https://api.{region}.amity.co",mqtt:"wss://sse.{region}.amity.co:443/mqtt"};function jt(e,t){return Bt[e].replace("{region}",t)}function $t(e,t){return function(){return e.apply(t,arguments)}}const{toString:qt}=Object.prototype,{getPrototypeOf:Gt}=Object,Ht=(Kt=Object.create(null),e=>{const t=qt.call(e);return Kt[t]||(Kt[t]=t.slice(8,-1).toLowerCase())});var Kt;const Vt=e=>(e=e.toLowerCase(),t=>Ht(t)===e),zt=e=>t=>typeof t===e,{isArray:Wt}=Array,Yt=zt("undefined");const Xt=Vt("ArrayBuffer");const Qt=zt("string"),Jt=zt("function"),Zt=zt("number"),er=e=>null!==e&&"object"==typeof e,tr=e=>{if("object"!==Ht(e))return!1;const t=Gt(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},rr=Vt("Date"),nr=Vt("File"),sr=Vt("Blob"),ir=Vt("FileList"),or=Vt("URLSearchParams");function ar(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,s;if("object"!=typeof e&&(e=[e]),Wt(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{const s=r?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length;let o;for(n=0;n<i;n++)o=s[n],t.call(null,e[o],o,e)}}function lr(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,s=r.length;for(;s-- >0;)if(n=r[s],t===n.toLowerCase())return n;return null}const cr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,ur=e=>!Yt(e)&&e!==cr;const dr=(hr="undefined"!=typeof Uint8Array&&Gt(Uint8Array),e=>hr&&e instanceof hr);var hr;const fr=Vt("HTMLFormElement"),pr=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),gr=Vt("RegExp"),mr=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};ar(r,((r,s)=>{!1!==t(r,s,e)&&(n[s]=r)})),Object.defineProperties(e,n)};var yr={isArray:Wt,isArrayBuffer:Xt,isBuffer:function(e){return null!==e&&!Yt(e)&&null!==e.constructor&&!Yt(e.constructor)&&Jt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||qt.call(e)===t||Jt(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Xt(e.buffer),t},isString:Qt,isNumber:Zt,isBoolean:e=>!0===e||!1===e,isObject:er,isPlainObject:tr,isUndefined:Yt,isDate:rr,isFile:nr,isBlob:sr,isRegExp:gr,isFunction:Jt,isStream:e=>er(e)&&Jt(e.pipe),isURLSearchParams:or,isTypedArray:dr,isFileList:ir,forEach:ar,merge:function e(){const{caseless:t}=ur(this)&&this||{},r={},n=(n,s)=>{const i=t&&lr(r,s)||s;tr(r[i])&&tr(n)?r[i]=e(r[i],n):tr(n)?r[i]=e({},n):Wt(n)?r[i]=n.slice():r[i]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&ar(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(ar(t,((t,n)=>{r&&Jt(t)?e[n]=$t(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],n&&!n(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==r&&Gt(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Ht,kindOfTest:Vt,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(Wt(e))return e;let t=e.length;if(!Zt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:fr,hasOwnProperty:pr,hasOwnProp:pr,reduceDescriptors:mr,freezeMethods:e=>{mr(e,((t,r)=>{if(Jt(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Jt(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return Wt(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:lr,global:cr,isContextDefined:ur,toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(er(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const s=Wt(e)?[]:{};return ar(e,((e,t)=>{const i=r(e,n+1);!Yt(i)&&(s[t]=i)})),t[n]=void 0,s}}return e};return r(e,0)}};function vr(e,t,r,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s)}yr.inherits(vr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:yr.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const br=vr.prototype,wr={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{wr[e]={value:e}})),Object.defineProperties(vr,wr),Object.defineProperty(br,"isAxiosError",{value:!0}),vr.from=(e,t,r,n,s,i)=>{const o=Object.create(br);return yr.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),vr.call(o,e.message,t,r,n,s),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};var Er="object"==typeof self?self.FormData:window.FormData;function Tr(e){return yr.isPlainObject(e)||yr.isArray(e)}function Sr(e){return yr.endsWith(e,"[]")?e.slice(0,-2):e}function Cr(e,t,r){return e?e.concat(t).map((function(e,t){return e=Sr(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const _r=yr.toFlatObject(yr,{},null,(function(e){return/^is[A-Z]/.test(e)}));function kr(e,t,r){if(!yr.isObject(e))throw new TypeError("target must be an object");t=t||new(Er||FormData);const n=(r=yr.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!yr.isUndefined(t[e])}))).metaTokens,s=r.visitor||u,i=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&((l=t)&&yr.isFunction(l.append)&&"FormData"===l[Symbol.toStringTag]&&l[Symbol.iterator]);var l;if(!yr.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(yr.isDate(e))return e.toISOString();if(!a&&yr.isBlob(e))throw new vr("Blob is not supported. Use a Buffer instead.");return yr.isArrayBuffer(e)||yr.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,s){let a=e;if(e&&!s&&"object"==typeof e)if(yr.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(yr.isArray(e)&&function(e){return yr.isArray(e)&&!e.some(Tr)}(e)||yr.isFileList(e)||yr.endsWith(r,"[]")&&(a=yr.toArray(e)))return r=Sr(r),a.forEach((function(e,n){!yr.isUndefined(e)&&null!==e&&t.append(!0===o?Cr([r],n,i):null===o?r:r+"[]",c(e))})),!1;return!!Tr(e)||(t.append(Cr(s,r,i),c(e)),!1)}const d=[],h=Object.assign(_r,{defaultVisitor:u,convertValue:c,isVisitable:Tr});if(!yr.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!yr.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),yr.forEach(r,(function(r,i){!0===(!(yr.isUndefined(r)||null===r)&&s.call(t,r,yr.isString(i)?i.trim():i,n,h))&&e(r,n?n.concat(i):[i])})),d.pop()}}(e),t}function Ar(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Ir(e,t){this._pairs=[],e&&kr(e,this,t)}const Rr=Ir.prototype;function Lr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Dr(e,t,r){if(!t)return e;const n=r&&r.encode||Lr,s=r&&r.serialize;let i;if(i=s?s(t,r):yr.isURLSearchParams(t)?t.toString():new Ir(t,r).toString(n),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}Rr.append=function(e,t){this._pairs.push([e,t])},Rr.toString=function(e){const t=e?function(t){return e.call(this,t,Ar)}:Ar;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class xr{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){yr.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Or={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Pr="undefined"!=typeof URLSearchParams?URLSearchParams:Ir,Mr=FormData;const Fr=(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),Nr="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var Ur={isBrowser:!0,classes:{URLSearchParams:Pr,FormData:Mr,Blob:Blob},isStandardBrowserEnv:Fr,isStandardBrowserWebWorkerEnv:Nr,protocols:["http","https","file","blob","url","data"]};function Br(e){function t(e,r,n,s){let i=e[s++];const o=Number.isFinite(+i),a=s>=e.length;if(i=!i&&yr.isArray(n)?n.length:i,a)return yr.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!o;n[i]&&yr.isObject(n[i])||(n[i]=[]);return t(e,r,n[i],s)&&yr.isArray(n[i])&&(n[i]=function(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}(n[i])),!o}if(yr.isFormData(e)&&yr.isFunction(e.entries)){const r={};return yr.forEachEntry(e,((e,n)=>{t(function(e){return yr.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const jr={"Content-Type":void 0};const $r={transitional:Or,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,s=yr.isObject(e);s&&yr.isHTMLForm(e)&&(e=new FormData(e));if(yr.isFormData(e))return n&&n?JSON.stringify(Br(e)):e;if(yr.isArrayBuffer(e)||yr.isBuffer(e)||yr.isStream(e)||yr.isFile(e)||yr.isBlob(e))return e;if(yr.isArrayBufferView(e))return e.buffer;if(yr.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return kr(e,new Ur.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Ur.isNode&&yr.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=yr.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return kr(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),function(e,t,r){if(yr.isString(e))try{return(t||JSON.parse)(e),yr.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||$r.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&yr.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw vr.from(e,vr.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ur.classes.FormData,Blob:Ur.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};yr.forEach(["delete","get","head"],(function(e){$r.headers[e]={}})),yr.forEach(["post","put","patch"],(function(e){$r.headers[e]=yr.merge(jr)}));const qr=yr.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Gr=Symbol("internals");function Hr(e){return e&&String(e).trim().toLowerCase()}function Kr(e){return!1===e||null==e?e:yr.isArray(e)?e.map(Kr):String(e)}function Vr(e,t,r,n){return yr.isFunction(n)?n.call(this,t,r):yr.isString(t)?yr.isString(n)?-1!==t.indexOf(n):yr.isRegExp(n)?n.test(t):void 0:void 0}class zr{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function s(e,t,r){const s=Hr(t);if(!s)throw new Error("header name must be a non-empty string");const i=yr.findKey(n,s);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||t]=Kr(e))}const i=(e,t)=>yr.forEach(e,((e,r)=>s(e,r,t)));return yr.isPlainObject(e)||e instanceof this.constructor?i(e,t):yr.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?i((e=>{const t={};let r,n,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),r=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!r||t[r]&&qr[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&s(t,e,r),this}get(e,t){if(e=Hr(e)){const r=yr.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(yr.isFunction(t))return t.call(this,e,r);if(yr.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Hr(e)){const r=yr.findKey(this,e);return!(!r||t&&!Vr(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function s(e){if(e=Hr(e)){const s=yr.findKey(r,e);!s||t&&!Vr(0,r[s],s,t)||(delete r[s],n=!0)}}return yr.isArray(e)?e.forEach(s):s(e),n}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,r={};return yr.forEach(this,((n,s)=>{const i=yr.findKey(r,s);if(i)return t[i]=Kr(n),void delete t[s];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(s):String(s).trim();o!==s&&delete t[s],t[o]=Kr(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return yr.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&yr.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[Gr]=this[Gr]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Hr(e);t[n]||(!function(e,t){const r=yr.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,s){return this[n].call(this,t,e,r,s)},configurable:!0})}))}(r,e),t[n]=!0)}return yr.isArray(e)?e.forEach(n):n(e),this}}function Wr(e,t){const r=this||$r,n=t||r,s=zr.from(n.headers);let i=n.data;return yr.forEach(e,(function(e){i=e.call(r,i,s.normalize(),t?t.status:void 0)})),s.normalize(),i}function Yr(e){return!(!e||!e.__CANCEL__)}function Xr(e,t,r){vr.call(this,null==e?"canceled":e,vr.ERR_CANCELED,t,r),this.name="CanceledError"}zr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),yr.freezeMethods(zr.prototype),yr.freezeMethods(zr),yr.inherits(Xr,vr,{__CANCEL__:!0});var Qr=Ur.isStandardBrowserEnv?{write:function(e,t,r,n,s,i){const o=[];o.push(e+"="+encodeURIComponent(t)),yr.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),yr.isString(n)&&o.push("path="+n),yr.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Jr(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Zr=Ur.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=yr.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function en(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s,i=0,o=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),c=n[o];s||(s=l),r[i]=a,n[i]=l;let u=o,d=0;for(;u!==i;)d+=r[u++],u%=e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),l-s<t)return;const h=c&&l-c;return h?Math.round(1e3*d/h):void 0}}(50,250);return s=>{const i=s.loaded,o=s.lengthComputable?s.total:void 0,a=i-r,l=n(a);r=i;const c={loaded:i,total:o,progress:o?i/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&i<=o?(o-i)/l:void 0,event:s};c[t?"download":"upload"]=!0,e(c)}}var tn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const s=zr.from(e.headers).normalize(),i=e.responseType;let o;function a(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}yr.isFormData(n)&&(Ur.isStandardBrowserEnv||Ur.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+r))}const c=Jr(e.baseURL,e.url);function u(){if(!l)return;const n=zr.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new vr("Request failed with status code "+r.status,[vr.ERR_BAD_REQUEST,vr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),a()}),(function(e){r(e),a()}),{data:i&&"text"!==i&&"json"!==i?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:n,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),Dr(c,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=u:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(u)},l.onabort=function(){l&&(r(new vr("Request aborted",vr.ECONNABORTED,e,l)),l=null)},l.onerror=function(){r(new vr("Network Error",vr.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Or;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new vr(t,n.clarifyTimeoutError?vr.ETIMEDOUT:vr.ECONNABORTED,e,l)),l=null},Ur.isStandardBrowserEnv){const t=(e.withCredentials||Zr(c))&&e.xsrfCookieName&&Qr.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===n&&s.setContentType(null),"setRequestHeader"in l&&yr.forEach(s.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),yr.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&"json"!==i&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",en(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",en(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{l&&(r(!t||t.type?new Xr(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);d&&-1===Ur.protocols.indexOf(d)?r(new vr("Unsupported protocol "+d+":",vr.ERR_BAD_REQUEST,e)):l.send(n||null)}))};const rn={http:null,xhr:tn};yr.forEach(rn,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var nn=e=>{e=yr.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let s=0;s<t&&(r=e[s],!(n=yr.isString(r)?rn[r.toLowerCase()]:r));s++);if(!n){if(!1===n)throw new vr(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(yr.hasOwnProp(rn,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!yr.isFunction(n))throw new TypeError("adapter is not a function");return n};function sn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xr(null,e)}function on(e){sn(e),e.headers=zr.from(e.headers),e.data=Wr.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return nn(e.adapter||$r.adapter)(e).then((function(t){return sn(e),t.data=Wr.call(e,e.transformResponse,t),t.headers=zr.from(t.headers),t}),(function(t){return Yr(t)||(sn(e),t&&t.response&&(t.response.data=Wr.call(e,e.transformResponse,t.response),t.response.headers=zr.from(t.response.headers))),Promise.reject(t)}))}const an=e=>e instanceof zr?e.toJSON():e;function ln(e,t){t=t||{};const r={};function n(e,t,r){return yr.isPlainObject(e)&&yr.isPlainObject(t)?yr.merge.call({caseless:r},e,t):yr.isPlainObject(t)?yr.merge({},t):yr.isArray(t)?t.slice():t}function s(e,t,r){return yr.isUndefined(t)?yr.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function i(e,t){if(!yr.isUndefined(t))return n(void 0,t)}function o(e,t){return yr.isUndefined(t)?yr.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,s,i){return i in t?n(r,s):i in e?n(void 0,r):void 0}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t)=>s(an(e),an(t),!0)};return yr.forEach(Object.keys(e).concat(Object.keys(t)),(function(n){const i=l[n]||s,o=i(e[n],t[n],n);yr.isUndefined(o)&&i!==a||(r[n]=o)})),r}const cn="1.2.3",un={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{un[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const dn={};un.transitional=function(e,t,r){function n(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,s,i)=>{if(!1===e)throw new vr(n(s," has been removed"+(t?" in "+t:"")),vr.ERR_DEPRECATED);return t&&!dn[s]&&(dn[s]=!0,console.warn(n(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,s,i)}};var hn={assertOptions:function(e,t,r){if("object"!=typeof e)throw new vr("options must be an object",vr.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],o=t[i];if(o){const t=e[i],r=void 0===t||o(t,i,e);if(!0!==r)throw new vr("option "+i+" must be "+r,vr.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new vr("Unknown option "+i,vr.ERR_BAD_OPTION)}},validators:un};const fn=hn.validators;class pn{constructor(e){this.defaults=e,this.interceptors={request:new xr,response:new xr}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ln(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:s}=t;let i;void 0!==r&&hn.assertOptions(r,{silentJSONParsing:fn.transitional(fn.boolean),forcedJSONParsing:fn.transitional(fn.boolean),clarifyTimeoutError:fn.transitional(fn.boolean)},!1),void 0!==n&&hn.assertOptions(n,{encode:fn.function,serialize:fn.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),i=s&&yr.merge(s.common,s[t.method]),i&&yr.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=zr.concat(i,s);const o=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const l=[];let c;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let u,d=0;if(!a){const e=[on.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,l),u=e.length,c=Promise.resolve(t);d<u;)c=c.then(e[d++],e[d++]);return c}u=o.length;let h=t;for(d=0;d<u;){const e=o[d++],t=o[d++];try{h=e(h)}catch(e){t.call(this,e);break}}try{c=on.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,u=l.length;d<u;)c=c.then(l[d++],l[d++]);return c}getUri(e){return Dr(Jr((e=ln(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}yr.forEach(["delete","get","head","options"],(function(e){pn.prototype[e]=function(t,r){return this.request(ln(r||{},{method:e,url:t,data:(r||{}).data}))}})),yr.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,s){return this.request(ln(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}pn.prototype[e]=t(),pn.prototype[e+"Form"]=t(!0)}));class gn{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,s){r.reason||(r.reason=new Xr(e,n,s),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new gn((function(t){e=t})),cancel:e}}}const mn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(mn).forEach((([e,t])=>{mn[t]=e}));const yn=function e(t){const r=new pn(t),n=$t(pn.prototype.request,r);return yr.extend(n,pn.prototype,r,{allOwnKeys:!0}),yr.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ln(t,r))},n}($r);yn.Axios=pn,yn.CanceledError=Xr,yn.CancelToken=gn,yn.isCancel=Yr,yn.VERSION=cn,yn.toFormData=kr,yn.AxiosError=vr,yn.Cancel=yn.CanceledError,yn.all=function(e){return Promise.all(e)},yn.spread=function(e){return function(t){return e.apply(null,t)}},yn.isAxiosError=function(e){return yr.isObject(e)&&!0===e.isAxiosError},yn.mergeConfig=ln,yn.AxiosHeaders=zr,yn.formToJSON=e=>Br(yr.isHTMLForm(e)?new FormData(e):e),yn.HttpStatusCode=mn,yn.default=yn;var vn={exports:{}};vn.exports=wn;var bn=vn.exports.HttpsAgent=wn;function wn(){}var En;!function(e){e.UserDeleted="User Deleted",e.UserGlobalBanned="User Global Banned",e.TokenExpired="Token Expired"}(En||(En={}));const Tn=new AbortController,Sn=e=>{switch(e){case En.UserGlobalBanned:throw new ge(e,400312,"fatal");case En.UserDeleted:throw new ge(e,400100,"fatal");case En.TokenExpired:throw pt("tokenExpired","tokenExpired"),new ge(e,800403,"fatal");default:throw new ge("Request Aborted",8e5,"error")}},Cn=e=>{const t={maxSockets:100,maxFreeSockets:10,timeout:6e4,freeSocketTimeout:3e4},r=yn.create({baseURL:e,httpAgent:new vn.exports(t),httpsAgent:new bn(t),signal:Tn.signal});return r.interceptors.request.use((e=>{if("/api/v4/sessions"===e.url)return e;if(e.metadata){const{tokenExpiry:t,isGlobalBanned:r,isUserDeleted:n}=e.metadata;r&&(Tn.abort(),Sn(En.UserGlobalBanned)),n&&(Tn.abort(),Sn(En.UserDeleted)),t&&Date.now()>=Date.parse(t)&&(Tn.abort(En.UserDeleted),Sn(En.TokenExpired))}return e})),r.interceptors.response.use((e=>e),(e=>{var t,r;const{response:n}=e;if(400100===(null==n?void 0:n.data.code)&&pt("tokenTerminated","terminated"),(null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.status)&&(e=>{if("success"===e.status)return e.data;if("fail"===e.status)throw new ye(e.code);if("error"===e.status)throw new me(e.message,e.code,"error")})(null==n?void 0:n.data),Tn.signal.aborted)throw e;throw new Error(null!==(r=null==n?void 0:n.data)&&void 0!==r?r:e)})),r};var _n={exports:{}},kn=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,An=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],In=function(e){var t=e,r=e.indexOf("["),n=e.indexOf("]");-1!=r&&-1!=n&&(e=e.substring(0,r)+e.substring(r,n).replace(/:/g,";")+e.substring(n,e.length));for(var s=kn.exec(e||""),i={},o=14;o--;)i[An[o]]=s[o]||"";return-1!=r&&-1!=n&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i},Rn={exports:{}},Ln={exports:{}},Dn=1e3,xn=6e4,On=60*xn,Pn=24*On,Mn=365.25*Pn,Fn=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*Mn;case"days":case"day":case"d":return r*Pn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*On;case"minutes":case"minute":case"mins":case"min":case"m":return r*xn;case"seconds":case"second":case"secs":case"sec":case"s":return r*Dn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&!1===isNaN(e))return t.long?function(e){return Nn(e,Pn,"day")||Nn(e,On,"hour")||Nn(e,xn,"minute")||Nn(e,Dn,"second")||e+" ms"}(e):function(e){if(e>=Pn)return Math.round(e/Pn)+"d";if(e>=On)return Math.round(e/On)+"h";if(e>=xn)return Math.round(e/xn)+"m";if(e>=Dn)return Math.round(e/Dn)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Nn(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}!function(e,t){function r(e){var r;function s(){if(s.enabled){var e=s,n=+new Date,i=n-(r||n);e.diff=i,e.prev=r,e.curr=n,r=n;for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];o[0]=t.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var l=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;l++;var s=t.formatters[n];if("function"==typeof s){var i=o[l];r=s.call(e,i),o.splice(l,1),l--}return r})),t.formatArgs.call(e,o);var c=s.log||t.log||console.log.bind(console);c.apply(e,o)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),s.destroy=n,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function n(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r<s;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var i=t.instances[r];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Fn,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Ln,Ln.exports),function(e,t){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Ln.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,n)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.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"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())}(Rn,Rn.exports);var Un=In,Bn=Rn.exports("socket.io-client:url"),jn=function(e,t){var r=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(Bn("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),Bn("parse %s",e),r=Un(e));r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443"));r.path=r.path||"/";var n=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r};var $n={},qn={exports:{}},Gn={exports:{}},Hn=1e3,Kn=6e4,Vn=60*Kn,zn=24*Vn,Wn=365.25*zn,Yn=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*Wn;case"days":case"day":case"d":return r*zn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Vn;case"minutes":case"minute":case"mins":case"min":case"m":return r*Kn;case"seconds":case"second":case"secs":case"sec":case"s":return r*Hn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&!1===isNaN(e))return t.long?function(e){return Xn(e,zn,"day")||Xn(e,Vn,"hour")||Xn(e,Kn,"minute")||Xn(e,Hn,"second")||e+" ms"}(e):function(e){if(e>=zn)return Math.round(e/zn)+"d";if(e>=Vn)return Math.round(e/Vn)+"h";if(e>=Kn)return Math.round(e/Kn)+"m";if(e>=Hn)return Math.round(e/Hn)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Xn(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}!function(e,t){function r(e){var r;function s(){if(s.enabled){var e=s,n=+new Date,i=n-(r||n);e.diff=i,e.prev=r,e.curr=n,r=n;for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];o[0]=t.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var l=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;l++;var s=t.formatters[n];if("function"==typeof s){var i=o[l];r=s.call(e,i),o.splice(l,1),l--}return r})),t.formatArgs.call(e,o);var c=s.log||t.log||console.log.bind(console);c.apply(e,o)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),s.destroy=n,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function n(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r<s;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var i=t.instances[r];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Yn,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Gn,Gn.exports),function(e,t){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Gn.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,n)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.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"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())}(qn,qn.exports);var Qn={exports:{}};!function(e){function t(e){if(e)return function(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<n.length;s++)if((r=n[s])===t||r.fn===t){n.splice(s,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var s=(r=r.slice(0)).length;n<s;++n)r[n].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(Qn);var Jn={},Zn={}.toString,es=Array.isArray||function(e){return"[object Array]"==Zn.call(e)},ts=function(e){return rs&&Buffer.isBuffer(e)||ns&&(e instanceof ArrayBuffer||function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer}(e))},rs="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,ns="function"==typeof ArrayBuffer;var ss=es,is=ts,os=Object.prototype.toString,as="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===os.call(Blob),ls="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===os.call(File);function cs(e,t){if(!e)return e;if(is(e)){var r={_placeholder:!0,num:t.length};return t.push(e),r}if(ss(e)){for(var n=new Array(e.length),s=0;s<e.length;s++)n[s]=cs(e[s],t);return n}if("object"==typeof e&&!(e instanceof Date)){n={};for(var i in e)n[i]=cs(e[i],t);return n}return e}function us(e,t){if(!e)return e;if(e&&e._placeholder)return t[e.num];if(ss(e))for(var r=0;r<e.length;r++)e[r]=us(e[r],t);else if("object"==typeof e)for(var n in e)e[n]=us(e[n],t);return e}Jn.deconstructPacket=function(e){var t=[],r=e.data,n=e;return n.data=cs(r,t),n.attachments=t.length,{packet:n,buffers:t}},Jn.reconstructPacket=function(e,t){return e.data=us(e.data,t),e.attachments=void 0,e},Jn.removeBlobs=function(e,t){var r=0,n=e;!function e(s,i,o){if(!s)return s;if(as&&s instanceof Blob||ls&&s instanceof File){r++;var a=new FileReader;a.onload=function(){o?o[i]=this.result:n=this.result,--r||t(n)},a.readAsArrayBuffer(s)}else if(ss(s))for(var l=0;l<s.length;l++)e(s[l],l,s);else if("object"==typeof s&&!is(s))for(var c in s)e(s[c],c,s)}(n),r||t(n)},function(e){var t=qn.exports("socket.io-parser"),r=Qn.exports,n=Jn,s=es,i=ts;function o(){}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=o,e.Decoder=c;var a=e.ERROR+'"encode error"';function l(r){var n=""+r.type;if(e.BINARY_EVENT!==r.type&&e.BINARY_ACK!==r.type||(n+=r.attachments+"-"),r.nsp&&"/"!==r.nsp&&(n+=r.nsp+","),null!=r.id&&(n+=r.id),null!=r.data){var s=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(r.data);if(!1===s)return a;n+=s}return t("encoded %j as %s",r,n),n}function c(){this.reconstructor=null}function u(e){this.reconPack=e,this.buffers=[]}function d(t){return{type:e.ERROR,data:"parser error: "+t}}o.prototype.encode=function(r,s){(t("encoding packet %j",r),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type)?function(e,t){function r(e){var r=n.deconstructPacket(e),s=l(r.packet),i=r.buffers;i.unshift(s),t(i)}n.removeBlobs(e,r)}(r,s):s([l(r)])},r(c.prototype),c.prototype.add=function(r){var n;if("string"==typeof r)n=function(r){var n=0,i={type:Number(r.charAt(0))};if(null==e.types[i.type])return d("unknown packet type "+i.type);if(e.BINARY_EVENT===i.type||e.BINARY_ACK===i.type){for(var o=n+1;"-"!==r.charAt(++n)&&n!=r.length;);var a=r.substring(o,n);if(a!=Number(a)||"-"!==r.charAt(n))throw new Error("Illegal attachments");i.attachments=Number(a)}if("/"===r.charAt(n+1)){for(o=n+1;++n;){if(","===(c=r.charAt(n)))break;if(n===r.length)break}i.nsp=r.substring(o,n)}else i.nsp="/";var l=r.charAt(n+1);if(""!==l&&Number(l)==l){for(o=n+1;++n;){var c;if(null==(c=r.charAt(n))||Number(c)!=c){--n;break}if(n===r.length)break}i.id=Number(r.substring(o,n+1))}if(r.charAt(++n)){var u=function(e){try{return JSON.parse(e)}catch(e){return!1}}(r.substr(n));if(!(!1!==u&&(i.type===e.ERROR||s(u))))return d("invalid payload");i.data=u}return t("decoded %s as %j",r,i),i}(r),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type?(this.reconstructor=new u(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!i(r)&&!r.base64)throw new Error("Unknown type: "+r);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(r))&&(this.reconstructor=null,this.emit("decoded",n))}},c.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},u.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},u.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}}($n);var ds={exports:{}},hs={},fs={exports:{}};try{fs.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){fs.exports=!1}var ps,gs,ms,ys,vs=fs.exports,bs=function(e){var t=e.xdomain,r=e.xscheme,n=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||vs))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!r&&n)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}},ws={exports:{}},Es={},Ts=Object.keys||function(e){var t=[],r=Object.prototype.hasOwnProperty;for(var n in e)r.call(e,n)&&t.push(n);return t};function Ss(){if(ys)return ms;ys=1;var e=function(){if(gs)return ps;gs=1;var e={}.toString;return ps=Array.isArray||function(t){return"[object Array]"==e.call(t)}}(),t=Object.prototype.toString,r="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===t.call(Blob),n="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===t.call(File);return ms=function t(s){if(!s||"object"!=typeof s)return!1;if(e(s)){for(var i=0,o=s.length;i<o;i++)if(t(s[i]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(s)||"function"==typeof ArrayBuffer&&s instanceof ArrayBuffer||r&&s instanceof Blob||n&&s instanceof File)return!0;if(s.toJSON&&"function"==typeof s.toJSON&&1===arguments.length)return t(s.toJSON(),!0);for(var a in s)if(Object.prototype.hasOwnProperty.call(s,a)&&t(s[a]))return!0;return!1},ms}var Cs=function(e,t,r){var n=e.byteLength;if(t=t||0,r=r||n,e.slice)return e.slice(t,r);if(t<0&&(t+=n),r<0&&(r+=n),r>n&&(r=n),t>=n||t>=r||0===n)return new ArrayBuffer(0);for(var s=new Uint8Array(e),i=new Uint8Array(r-t),o=t,a=0;o<r;o++,a++)i[a]=s[o];return i.buffer},_s=function(e,t,r){var n=!1;return r=r||ks,s.count=e,0===e?t():s;function s(e,i){if(s.count<=0)throw new Error("after called too many times");--s.count,e?(n=!0,t(e),t=r):0!==s.count||n||t(null,i)}};function ks(){}
1
+ var Amity=function(e,t){"use strict";const r=Object.freeze({ONLY_ADMIN_CAN_POST:"ONLY_ADMIN_CAN_POST",ADMIN_REVIEW_POST_REQUIRED:"ADMIN_REVIEW_POST_REQUIRED",ANYONE_CAN_POST:"ANYONE_CAN_POST"}),n=Object.freeze({ONLY_ADMIN_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!0},ADMIN_REVIEW_POST_REQUIRED:{needApprovalOnPostCreation:!0,onlyAdminCanPost:!1},ANYONE_CAN_POST:{needApprovalOnPostCreation:!1,onlyAdminCanPost:!1}}),s="ONLY_ADMIN_CAN_POST",i=Object.freeze({STORY:"story",CLIP:"clip",CHAT:"chat",POST:"post",MESSAGE:"message"}),o=Object.freeze({FILE:"file",IMAGE:"image",VIDEO:"video"}),a=Object.freeze({"1080P":"1080p","720P":"720p","480P":"480p","360P":"360p",ORIGINAL:"original"}),l=Object.freeze({UPLOADED:"uploaded",TRANSCODING:"transcoding",TRANSCODED:"transcoded",TRANSCODE_FAILED:"transcodeFailed"}),c=Object.freeze({LOW:"low",MEDIUM:"medium",HIGH:"high",ORIGINAL:"original"}),u=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",AUDIO:"audio",CUSTOM:"custom"}),d=Object.freeze({TEXT:"text",IMAGE:"image",FILE:"file",VIDEO:"video",LIVESTREAM:"liveStream",POLL:"poll",CUSTOM:"custom"});const h=function(){try{return"v6.14.1-umd"}catch(e){return"__dev__"}}(),f=5,p="cache_then_server",g="For using Live Collection feature you need to enable Cache!",m=6e5,y="dead",v=2e3,b=6e4,w=e=>JSON.stringify(e,((e,t)=>{return"object"==typeof t?(r=t,Object.keys(r).sort().reduce(((e,t)=>Object.assign(Object.assign({},e),{[t]:r[t]})),{})):t;var r})),E=e=>JSON.parse(e),T=(e,t)=>e===t||!(!e||!t)&&("object"==typeof e&&Object.keys(e).every((r=>T(e[r],t[r])))),S=e=>[400400,400300].includes(e),C="function"==typeof atob,_="function"==typeof btoa,k="function"==typeof Buffer,A="function"==typeof TextDecoder?new TextDecoder:void 0,I="function"==typeof TextEncoder?new TextEncoder:void 0,R=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),L=(e=>{let t={};return e.forEach(((e,r)=>t[e]=r)),t})(R),D=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,x=String.fromCharCode.bind(String),O="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),P=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),M=_?e=>btoa(e):k?e=>Buffer.from(e,"binary").toString("base64"):e=>{let t,r,n,s,i="";const o=e.length%3;for(let o=0;o<e.length;){if((r=e.charCodeAt(o++))>255||(n=e.charCodeAt(o++))>255||(s=e.charCodeAt(o++))>255)throw new TypeError("invalid character found");t=r<<16|n<<8|s,i+=R[t>>18&63]+R[t>>12&63]+R[t>>6&63]+R[63&t]}return o?i.slice(0,o-3)+"===".substring(o):i},F=k?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,n=e.length;r<n;r+=4096)t.push(x.apply(null,e.subarray(r,r+4096)));return M(t.join(""))},N=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?x(192|t>>>6)+x(128|63&t):x(224|t>>>12&15)+x(128|t>>>6&63)+x(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return x(240|t>>>18&7)+x(128|t>>>12&63)+x(128|t>>>6&63)+x(128|63&t)},U=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,B=k?e=>Buffer.from(e,"utf8").toString("base64"):I?e=>F(I.encode(e)):e=>M(e.replace(U,N)),j=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,$=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return x(55296+(t>>>10))+x(56320+(1023&t));case 3:return x((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return x((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},q=C?e=>atob(P(e)):k?e=>Buffer.from(e,"base64").toString("binary"):e=>{if(e=e.replace(/\s+/g,""),!D.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,n,s="";for(let i=0;i<e.length;)t=L[e.charAt(i++)]<<18|L[e.charAt(i++)]<<12|(r=L[e.charAt(i++)])<<6|(n=L[e.charAt(i++)]),s+=64===r?x(t>>16&255):64===n?x(t>>16&255,t>>8&255):x(t>>16&255,t>>8&255,255&t);return s},G=k?e=>O(Buffer.from(e,"base64")):e=>O(q(e),(e=>e.charCodeAt(0))),H=k?e=>Buffer.from(e,"base64").toString("utf8"):A?e=>A.decode(G(e)):e=>q(e).replace(j,$),K=e=>H(P(e.replace(/[-_]/g,(e=>"-"==e?"+":"/")))),V=e=>["skip"].some((t=>t in e)),z=e=>["after","before","first","last","limit"].some((t=>t in e)),W=e=>"limit"in e,Y=e=>(null==e?void 0:e.hasOwnProperty("data"))&&(null==e?void 0:e.hasOwnProperty("nextPage"))&&(null==e?void 0:e.hasOwnProperty("prevPage")),X=(e,t)=>{var r;if(!e||!Object.keys(e).length)return;let n={};return"skiplimit"===t?n={skip:null!==(r=e.after)&&void 0!==r?r:0,limit:e.limit}:"afterbefore"===t&&z(e)?((null==e?void 0:e.before)&&(n=Object.assign(Object.assign({},n),{before:e.before})),(null==e?void 0:e.after)&&(n=Object.assign(Object.assign({},n),{after:e.after})),Number.isNaN(Number(null==e?void 0:e.limit))||(n=Object.assign(Object.assign({},n),{limit:e.limit}))):"afterbeforeraw"===t&&(n=e),Object.keys(n).length?((e,t=!1)=>t?(e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_")))(B(e)):B(e))(JSON.stringify(n)):void 0},Q=e=>{if(!e)return;const t=JSON.parse(K(e));if(V(t))return{after:t.skip,limit:t.limit};if(z(t)){if("before"in t)return{before:t.before,limit:t.last};if("after"in t)return{after:t.after,limit:t.first}}},J=e=>{if(!e)return;const t=JSON.parse(K(e));return W(t)?t:void 0},Z=e=>"locally"in e,ee=e=>"optimistically"in e,te=e=>Z(e)||ee(e),re=e=>null==e?void 0:e.hasOwnProperty("cachedAt"),ne=(e,t=6e4)=>{var r;return Date.now()-(null!==(r=null==e?void 0:e.cachedAt)&&void 0!==r?r:0)<=t},se=(e,...t)=>({func:e,args:t}),ie=(e,t=6e4)=>"cache_only"===e?{lifeSpan:1/0}:{lifeSpan:t<b?b:t},oe=({func:e,args:t},r,n=ie("cache_then_server"))=>{let s;const{lifeSpan:i}=ie("cache_then_server",n.lifeSpan);if(te(e)){try{s=ee(e)?e.optimistically(...t):e.locally(...t)}catch(e){null==r||r(ae(void 0,{origin:"local",loading:!1,error:e}))}const n=re(s)&&ne(s,i);if(null==r||r(ae(s,{origin:"local",loading:!(Z(e)&&n)})),n)return}else null==r||r(ae(void 0,{origin:"local",loading:!0}));e(...t).then((e=>{null==r||r(ae(e,{origin:"server",loading:!1}))})).catch((e=>{null==r||r(ae(void 0,{origin:"server",loading:!1,error:e}))}))};function ae(e,t){return Y(e)||re(e)?Object.assign(Object.assign({},t),e):Object.assign(Object.assign({},t),{data:e})}const le={user:({userId:e})=>e,file:({fileId:e})=>e,role:({roleId:e})=>e,channel:({channelId:e})=>e,subChannel:({subChannelId:e})=>e,channelUsers:({channelId:e,userId:t})=>`${e}#${t}`,message:({messageId:e})=>e,messagePreviewChannel:({channelId:e})=>`${e}`,messagePreviewSubChannel:({subChannelId:e})=>`${e}`,channelMarker:({entityId:e,userId:t})=>`${e}#${t}`,subChannelMarker:({entityId:e,feedId:t,userId:r})=>`${e}#${t}#${r}`,messageMarker:({feedId:e,contentId:t,creatorId:r})=>`${e}#${t}#${r}`,feedMarker:({feedId:e,entityId:t})=>`${e}#${t}`,userMarker:({userId:e})=>e,community:({communityId:e})=>e,category:({categoryId:e})=>e,communityUsers:({communityId:e,userId:t})=>`${e}#${t}`,post:({postId:e})=>e,comment:({commentId:e})=>e,poll:({pollId:e})=>e,reaction:({referenceType:e,referenceId:t})=>`${e}#${t}`,reactor:({reactionId:e})=>e,stream:({streamId:e})=>e,follow:({from:e,to:t})=>`${e}#${t}`,followInfo:({userId:e})=>e,followCount:({userId:e})=>e,feed:({targetId:e,feedId:t})=>`${e}#${t}`},ce=e=>le[e],ue={file:["fileId","attributes"],user:["userId","avatarFileId","roles","permissions"],role:["roleId"],channel:["channelId","defaultSubChannelId"],subChannel:["subChannelId","latestMessageId"],channelUsers:["channelId","userId","membership"],message:["messageId"],community:["communityId","postSetting"],category:["categoryId"],communityUsers:["userId","communityId","communityMembership"],post:["postId","feedId"],comment:["commentId","referenceId"],poll:["pollId"],reaction:["referenceId","referenceType","reactors"],reactor:["reactionId"],stream:["streamId"],follow:["from","to"],feed:["feedId","feedType"],followInfo:["userId","status"],followCount:["userId","followerCount"]},de=e=>{var t;return null===(t=Object.entries(ue).find((([t,r])=>((e,t)=>{const r=Object.keys(e);return t.every((e=>r.includes(e)))})(e,r))))||void 0===t?void 0:t[0]},he=e=>{var t;const r=de(e);if(r)return null===(t=ue[r])||void 0===t?void 0:t[0]},fe={users:"user",files:"file",roles:"role",channels:"channel",messageFeeds:"subChannel",channelUsers:"channelUsers",messages:"message",messagePreviewChannel:"messagePreviewChannel",messagePreviewSubChannel:"messagePreviewSubChannel",userEntityMarkers:"channelMarker",userFeedMarkers:"subChannelMarker",contentMarkers:"messageMarker",feedMarkers:"feedMarker",userMarkers:"userMarker",communities:"community",categories:"category",communityUsers:"communityUsers",posts:"post",postChildren:"post",comments:"comment",polls:"poll",reactors:"reactor",reactions:"reaction",videoStreamings:"stream",follows:"follow",followCounts:"followCount",feeds:"feed"};function pe(e=(new Date).toISOString()){return new Date(new Date(e).getTime()+1).toISOString()}class ge extends Error{constructor(e,t,r){super(`Amity SDK (${t}): ${e}`),this.code=t,this.level=r,this.type="ASC",this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,ge)}}class me extends ge{constructor(e,t,r){super(e,t,r)}}class ye extends ge{constructor(e=8e5,t="fatal"){super("Unexpected error",e,t)}}class ve extends ge{constructor(e,t="SDK client is having connection issues"){super(`${t} (${e})`,"disconnected"===e?800211:800210,"error"),this.event=e}}let be=null;const we=()=>{if(!be)throw new ge("There is no active client",8e5,"fatal");return be},Ee=e=>{be=e};var Te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Se(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ce(e){var t=e.default;if("function"==typeof t){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}const _e=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},{hasOwnProperty:ke}=Object.prototype,{propertyIsEnumerable:Ae}=Object,Ie=(e,t,r)=>Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0}),Re=Te,Le={concatArrays:!1,ignoreUndefined:!1},De=e=>{const t=[];for(const r in e)ke.call(e,r)&&t.push(r);if(Object.getOwnPropertySymbols){const r=Object.getOwnPropertySymbols(e);for(const n of r)Ae.call(e,n)&&t.push(n)}return t};function xe(e){return Array.isArray(e)?function(e){const t=e.slice(0,0);return De(e).forEach((r=>{Ie(t,r,xe(e[r]))})),t}(e):_e(e)?function(e){const t=null===Object.getPrototypeOf(e)?Object.create(null):{};return De(e).forEach((r=>{Ie(t,r,xe(e[r]))})),t}(e):e}const Oe=(e,t,r,n)=>(r.forEach((r=>{void 0===t[r]&&n.ignoreUndefined||(r in e&&e[r]!==Object.getPrototypeOf(e)?Ie(e,r,Pe(e[r],t[r],n)):Ie(e,r,xe(t[r])))})),e);function Pe(e,t,r){return r.concatArrays&&Array.isArray(e)&&Array.isArray(t)?((e,t,r)=>{let n=e.slice(0,0),s=0;return[e,t].forEach((t=>{const i=[];for(let r=0;r<t.length;r++)ke.call(t,r)&&(i.push(String(r)),Ie(n,s++,t===e?t[r]:xe(t[r])));n=Oe(n,t,De(t).filter((e=>!i.includes(e))),r)})),n})(e,t,r):_e(t)&&_e(e)?Oe(e,t,De(t),r):xe(t)}const Me=function(...e){const t=Pe(xe(Le),this!==Re&&this||{},Le);let r={_:{}};for(const n of e)if(void 0!==n){if(!_e(n))throw new TypeError("`"+n+"` is not an Option Object");r=Pe(r,{_:n},t)}return r._}.bind({concatArrays:!0,ignoreUndefined:!0});function Fe(e,t){return new Promise(((r,n)=>{try{const n=e();null==t||t(null,n),r(n)}catch(e){null==t||t(e),n(e)}}))}function Ne(e,t,r){return Promise.all(e).then((e=>{var n;const s=null!==(n=null==r?void 0:r(e))&&void 0!==n?n:null;return null==t||t(null,s),Promise.resolve(s)}),(e=>(null==t||t(e),Promise.reject(e))))}const Ue={getItem:(e,t)=>Fe((()=>window.localStorage.getItem(e)),t),setItem:(e,t,r)=>Fe((()=>window.localStorage.setItem(e,t)),r),removeItem:(e,t)=>Fe((()=>window.localStorage.removeItem(e)),t),mergeItem:(e,t,r)=>Fe((()=>function(e,t){const r=window.localStorage.getItem(e);if(r){const n=JSON.parse(r),s=JSON.parse(t),i=JSON.stringify(Me(n,s));window.localStorage.setItem(e,i)}else window.localStorage.setItem(e,t)}(e,t)),r),clear:e=>Fe((()=>window.localStorage.clear()),e),getAllKeys:e=>Fe((()=>{const e=window.localStorage.length,t=[];for(let r=0;r<e;r+=1){const e=window.localStorage.key(r)||"";t.push(e)}return t}),e),flushGetRequests:()=>{},multiGet:(e,t)=>Ne(e.map((e=>Ue.getItem(e))),t,(t=>t.map(((t,r)=>[e[r],t])))),multiSet:(e,t)=>Ne(e.map((e=>Ue.setItem(e[0],e[1]))),t),multiRemove:(e,t)=>Ne(e.map((e=>Ue.removeItem(e))),t),multiMerge:(e,t)=>Ne(e.map((e=>Ue.mergeItem(e[0],e[1]))),t)},Be=e=>{const{log:t,cache:r}=we();if(r)return t("cache/api/queryCache",{key:e}),Object.keys(r.data).filter((t=>{const r=E(t);return T(e,r)})).map((e=>r.data[e]))},je=e=>{const{log:t,cache:r}=we();if(!r)return;t("cache/api/pullFromCache",e);const n=w(e);return r.data[n]?r.data[n]:void 0},$e=(e,t,r={cachedAt:Date.now()})=>{const{log:n,cache:s}=we();if(!s)return!1;n("cache/api/pushToCache",{key:e,data:t,options:r}),!(null==r?void 0:r.hasOwnProperty("offline"))&&s.persistIf&&(r.offline=s.persistIf(e,t));const i=w(e);return s.data[i]=Object.assign({key:e,data:t},r),!0},qe=(e,t,r)=>{const{log:n,cache:s}=we();if(!s)return!1;n("cache/api/mergeInCache",{key:e,mutation:t});const i=je(e);if(!i)return!1;const o="function"==typeof t?t(i.data):Object.assign(Object.assign({},i.data),t);return a=i.data,!("updatedAt"in(l=o)&&"updatedAt"in l&&new Date(l.updatedAt)<new Date(a.updatedAt))&&($e(e,o,r),!0);var a,l},Ge=(e,t,r={cachedAt:Date.now()})=>{const{log:n,cache:s}=we();if(!s)return!1;n("cache/api/upsertInCache",{key:e,data:t,options:r});return je(e)?qe(e,t,r):$e(e,t,r)},He=(e,t=!1)=>{const{log:r,cache:n}=we();if(!n)return!1;if(r("cache/api/dropFromCache",{key:e,exact:t}),!t)return Object.keys(n.data).map((e=>E(e))).filter((t=>T(e,t))).map((e=>He(e,!0))).every((e=>e));const s=w(e);return s in n.data&&(delete n.data[s],!0)},Ke=(e,t,r)=>void 0!==r?e.filter((e=>JSON.stringify(e[t])===JSON.stringify(r))):e,Ve=(e,t,r)=>void 0!==r?e.filter((e=>"string"==typeof e[t]&&"string"==typeof r&&String(e[t]).toLowerCase().match(r.toLowerCase()))):e,ze=(e,t,r)=>(null==r?void 0:r.length)?e.filter((e=>Array.isArray(e[t])&&r.some((r=>e[t].includes(r))))):e,We=(e,t,r)=>"all"===t?e:e.filter((e=>{var n;if("community"===e.type)return!0;const s=ce("channelUsers")({channelId:e.channelId,userId:r}),i=null===(n=je(["channelUsers","get",s]))||void 0===n?void 0:n.data;return"member"===t?i&&"none"!==i.membership:!i||"none"===i.membership})),Ye=(e,t)=>e.filter((({targetId:e,feedId:r})=>{var n;const s=null===(n=je(["feed","get",ce("feed")({targetId:e,feedId:r})]))||void 0===n?void 0:n.data;return s&&s.feedType===t})),Xe=(e,t,r)=>"all"===t?e:e.filter((e=>{var n;const s=ce("communityUsers")({communityId:e.communityId,userId:r}),i=null===(n=je(["communityUsers","get",s]))||void 0===n?void 0:n.data;return"member"===t?i&&"member"===i.communityMembership:!i||"none"!==i.communityMembership})),Qe=(e,t)=>{const r=[];return e.reduce(((e,n)=>{var s;if("text"===n.dataType&&!n.children.length)return e;if(r.includes(n.postId))return e;if((null==t?void 0:t.includes(n.dataType))&&e.push(n),!n.children.length)return e;const i=null===(s=je(["post","get",n.children[0]]))||void 0===s?void 0:s.data;return i?r.includes(i.postId)?e:(null==t?void 0:t.includes(null==i?void 0:i.dataType))?(r.push(i.postId),e.push(i),e):e:e}),[])},Je=(e,t)=>{const r=new RegExp(t,"i");return e.filter((e=>{var t;return!!e.userId.match(r)||e.user&&(null===(t=e.user.displayName)||void 0===t?void 0:t.match(r))}))},Ze=({displayName:e},{displayName:t})=>e===t?0:e<t?-1:1,et=({name:e},{name:t})=>e.localeCompare(t),tt=({createdAt:e},{createdAt:t})=>new Date(e).valueOf()-new Date(t).valueOf(),rt=({createdAt:e},{createdAt:t})=>new Date(t).valueOf()-new Date(e).valueOf(),nt=({lastActivity:e},{lastActivity:t})=>new Date(t).valueOf()-new Date(e).valueOf();let st=null;const it=()=>{if(!st)throw new ge("Connect client first",8e5,"fatal");return st},ot=e=>{st={_id:e._id,userId:e.userId,path:e.path}};let at,lt=[];const ct=e=>{clearTimeout(at),lt.push(e),at=setTimeout((()=>{lt.forEach((e=>e())),lt=[]}),0)},ut=["disconnected","error","connect_error","reconnect_error","reconnect_failed","sessionStateChange","tokenExpired"],dt=["connect","message","disconnect","error","close","end","reconnect","user.didGlobalBan"],ht=()=>{return{all:e=e||new Map,on:function(t,r){var n=e.get(t);n?n.push(r):e.set(t,[r])},off:function(t,r){var n=e.get(t);n&&(r?n.splice(n.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var n=e.get(t);n&&n.slice().map((function(e){e(r)})),(n=e.get("*"))&&n.slice().map((function(e){e(t,r)}))}};var e},ft=(e,t,r,n)=>{const{log:s,emitter:i}=e,o=Date.now();s(`${t}(tmpid: ${o}) > listen`);const a=(...e)=>{s(`${t}(tmpid: ${o}) > trigger`,e);try{n(...e)}catch(e){s(`${t}(tmpid: ${o}) > error`,e)}};return i.on(r,a),()=>{s(`${t}(tmpid: ${o}) > dispose`),i.off(r,a)}},pt=(e,t)=>{const{emitter:r}=we();ct((()=>{r.emit(e,t)}))};let gt,mt;async function yt(){var e;const{mqtt:t,emitter:r,token:n}=we(),s=null!==(e=null==n?void 0:n.accessToken)&&void 0!==e?e:"",i=it();gt===s&&mt===i._id||(gt=s,mt=i._id,await t.connect({accessToken:gt,userId:mt}),((e,t)=>{dt.forEach((r=>{e.on(r,((...e)=>{t.emit(r,1===e.length?e[0]:e)}))})),e.on("message",((e,r)=>{const n=JSON.parse(r.toString());t.emit(n.eventType,n.data)}))})(t,r))}var vt;e.SubscriptionLevels=void 0,(vt=e.SubscriptionLevels||(e.SubscriptionLevels={})).COMMUNITY="community",vt.POST="post",vt.COMMENT="comment",vt.POST_AND_COMMENT="post_and_comment",vt.USER="user";const bt=(e,t)=>{switch(t){case"post":return`${e}/post/+`;case"comment":return`${e}/post/+/comment/+`;case"post_and_comment":return`${e}/post/#`;default:return e}},wt=e=>e.path.split("/user/")[0],Et=({path:t},r=e.SubscriptionLevels.USER)=>bt(r===e.SubscriptionLevels.USER?t:t.replace(/^(\w*)/,"$1/social"),r),Tt=({channelId:e,subChannelId:t})=>{const r=it();return`${wt(r)}/marker/channel/${e}/message/${t}`},St=()=>wt(it()),Ct=()=>{const e=it();return`${wt(e)}/smartfeed/${e._id}/channels`},_t=()=>{const e=it();return`${wt(e)}/smartfeed/${e._id}/messagefeeds`},kt=()=>{const e=it();return`${wt(e)}/smartfeed/${e._id}/messages`};function At(e,t){const{mqtt:r}=we();return yt(),r.subscribe(e,t)}var It,Rt,Lt={exports:{}};function Dt(){if(Rt)return It;Rt=1;var e=1e3,t=60*e,r=60*t,n=24*r,s=7*n,i=365.25*n;function o(e,t,r,n){var s=t>=1.5*r;return Math.round(e/r)+" "+n+(s?"s":"")}return It=function(a,l){l=l||{};var c=typeof a;if("string"===c&&a.length>0)return function(o){if((o=String(o)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!a)return;var l=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return l*i;case"weeks":case"week":case"w":return l*s;case"days":case"day":case"d":return l*n;case"hours":case"hour":case"hrs":case"hr":case"h":return l*r;case"minutes":case"minute":case"mins":case"min":case"m":return l*t;case"seconds":case"second":case"secs":case"sec":case"s":return l*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return l;default:return}}(a);if("number"===c&&isFinite(a))return l.long?function(s){var i=Math.abs(s);if(i>=n)return o(s,i,n,"day");if(i>=r)return o(s,i,r,"hour");if(i>=t)return o(s,i,t,"minute");if(i>=e)return o(s,i,e,"second");return s+" ms"}(a):function(s){var i=Math.abs(s);if(i>=n)return Math.round(s/n)+"d";if(i>=r)return Math.round(s/r)+"h";if(i>=t)return Math.round(s/t)+"m";if(i>=e)return Math.round(s/e)+"s";return s+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))},It}var xt=function(e){function t(e){let n,s,i,o=null;function a(...e){if(!a.enabled)return;const r=a,s=Number(new Date),i=s-(n||s);r.diff=i,r.prev=n,r.curr=s,n=s,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,s)=>{if("%%"===n)return"%";o++;const i=t.formatters[s];if("function"==typeof i){const t=e[o];n=i.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(s!==t.namespaces&&(s=t.namespaces,i=t.enabled(e)),i),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r<s;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Dt(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t};!function(e,t){t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let n=0,s=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(s=n))})),t.splice(s,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.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`."))}})(),t.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"],t.log=console.debug||console.log||(()=>{}),e.exports=xt(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Lt,Lt.exports);var Ot,Pt=Lt.exports;const Mt="object"==typeof globalThis?globalThis:"object"==typeof global?global:window,{process:Ft={}}=Mt,Nt="production"===(null===(Ot=Ft.env)||void 0===Ot?void 0:Ot.NODE_ENV),Ut={EU:"eu",SG:"sg",US:"us"},Bt={http:"https://api.{region}.amity.co",mqtt:"wss://sse.{region}.amity.co:443/mqtt"};function jt(e,t){return Bt[e].replace("{region}",t)}function $t(e,t){return function(){return e.apply(t,arguments)}}const{toString:qt}=Object.prototype,{getPrototypeOf:Gt}=Object,Ht=(Kt=Object.create(null),e=>{const t=qt.call(e);return Kt[t]||(Kt[t]=t.slice(8,-1).toLowerCase())});var Kt;const Vt=e=>(e=e.toLowerCase(),t=>Ht(t)===e),zt=e=>t=>typeof t===e,{isArray:Wt}=Array,Yt=zt("undefined");const Xt=Vt("ArrayBuffer");const Qt=zt("string"),Jt=zt("function"),Zt=zt("number"),er=e=>null!==e&&"object"==typeof e,tr=e=>{if("object"!==Ht(e))return!1;const t=Gt(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},rr=Vt("Date"),nr=Vt("File"),sr=Vt("Blob"),ir=Vt("FileList"),or=Vt("URLSearchParams");function ar(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,s;if("object"!=typeof e&&(e=[e]),Wt(e))for(n=0,s=e.length;n<s;n++)t.call(null,e[n],n,e);else{const s=r?Object.getOwnPropertyNames(e):Object.keys(e),i=s.length;let o;for(n=0;n<i;n++)o=s[n],t.call(null,e[o],o,e)}}function lr(e,t){t=t.toLowerCase();const r=Object.keys(e);let n,s=r.length;for(;s-- >0;)if(n=r[s],t===n.toLowerCase())return n;return null}const cr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,ur=e=>!Yt(e)&&e!==cr;const dr=(hr="undefined"!=typeof Uint8Array&&Gt(Uint8Array),e=>hr&&e instanceof hr);var hr;const fr=Vt("HTMLFormElement"),pr=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),gr=Vt("RegExp"),mr=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};ar(r,((r,s)=>{!1!==t(r,s,e)&&(n[s]=r)})),Object.defineProperties(e,n)};var yr={isArray:Wt,isArrayBuffer:Xt,isBuffer:function(e){return null!==e&&!Yt(e)&&null!==e.constructor&&!Yt(e.constructor)&&Jt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{const t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||qt.call(e)===t||Jt(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Xt(e.buffer),t},isString:Qt,isNumber:Zt,isBoolean:e=>!0===e||!1===e,isObject:er,isPlainObject:tr,isUndefined:Yt,isDate:rr,isFile:nr,isBlob:sr,isRegExp:gr,isFunction:Jt,isStream:e=>er(e)&&Jt(e.pipe),isURLSearchParams:or,isTypedArray:dr,isFileList:ir,forEach:ar,merge:function e(){const{caseless:t}=ur(this)&&this||{},r={},n=(n,s)=>{const i=t&&lr(r,s)||s;tr(r[i])&&tr(n)?r[i]=e(r[i],n):tr(n)?r[i]=e({},n):Wt(n)?r[i]=n.slice():r[i]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&ar(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(ar(t,((t,n)=>{r&&Jt(t)?e[n]=$t(t,r):e[n]=t}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let s,i,o;const a={};if(t=t||{},null==e)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],n&&!n(o,e,t)||a[o]||(t[o]=e[o],a[o]=!0);e=!1!==r&&Gt(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Ht,kindOfTest:Vt,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(Wt(e))return e;let t=e.length;if(!Zt(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:fr,hasOwnProperty:pr,hasOwnProp:pr,reduceDescriptors:mr,freezeMethods:e=>{mr(e,((t,r)=>{if(Jt(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Jt(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return Wt(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[_-\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>(e=+e,Number.isFinite(e)?e:t),findKey:lr,global:cr,isContextDefined:ur,toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(er(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const s=Wt(e)?[]:{};return ar(e,((e,t)=>{const i=r(e,n+1);!Yt(i)&&(s[t]=i)})),t[n]=void 0,s}}return e};return r(e,0)}};function vr(e,t,r,n,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),s&&(this.response=s)}yr.inherits(vr,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:yr.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const br=vr.prototype,wr={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{wr[e]={value:e}})),Object.defineProperties(vr,wr),Object.defineProperty(br,"isAxiosError",{value:!0}),vr.from=(e,t,r,n,s,i)=>{const o=Object.create(br);return yr.toFlatObject(e,o,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),vr.call(o,e.message,t,r,n,s),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};var Er="object"==typeof self?self.FormData:window.FormData;function Tr(e){return yr.isPlainObject(e)||yr.isArray(e)}function Sr(e){return yr.endsWith(e,"[]")?e.slice(0,-2):e}function Cr(e,t,r){return e?e.concat(t).map((function(e,t){return e=Sr(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const _r=yr.toFlatObject(yr,{},null,(function(e){return/^is[A-Z]/.test(e)}));function kr(e,t,r){if(!yr.isObject(e))throw new TypeError("target must be an object");t=t||new(Er||FormData);const n=(r=yr.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!yr.isUndefined(t[e])}))).metaTokens,s=r.visitor||u,i=r.dots,o=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&((l=t)&&yr.isFunction(l.append)&&"FormData"===l[Symbol.toStringTag]&&l[Symbol.iterator]);var l;if(!yr.isFunction(s))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(yr.isDate(e))return e.toISOString();if(!a&&yr.isBlob(e))throw new vr("Blob is not supported. Use a Buffer instead.");return yr.isArrayBuffer(e)||yr.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function u(e,r,s){let a=e;if(e&&!s&&"object"==typeof e)if(yr.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(yr.isArray(e)&&function(e){return yr.isArray(e)&&!e.some(Tr)}(e)||yr.isFileList(e)||yr.endsWith(r,"[]")&&(a=yr.toArray(e)))return r=Sr(r),a.forEach((function(e,n){!yr.isUndefined(e)&&null!==e&&t.append(!0===o?Cr([r],n,i):null===o?r:r+"[]",c(e))})),!1;return!!Tr(e)||(t.append(Cr(s,r,i),c(e)),!1)}const d=[],h=Object.assign(_r,{defaultVisitor:u,convertValue:c,isVisitable:Tr});if(!yr.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!yr.isUndefined(r)){if(-1!==d.indexOf(r))throw Error("Circular reference detected in "+n.join("."));d.push(r),yr.forEach(r,(function(r,i){!0===(!(yr.isUndefined(r)||null===r)&&s.call(t,r,yr.isString(i)?i.trim():i,n,h))&&e(r,n?n.concat(i):[i])})),d.pop()}}(e),t}function Ar(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Ir(e,t){this._pairs=[],e&&kr(e,this,t)}const Rr=Ir.prototype;function Lr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Dr(e,t,r){if(!t)return e;const n=r&&r.encode||Lr,s=r&&r.serialize;let i;if(i=s?s(t,r):yr.isURLSearchParams(t)?t.toString():new Ir(t,r).toString(n),i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}Rr.append=function(e,t){this._pairs.push([e,t])},Rr.toString=function(e){const t=e?function(t){return e.call(this,t,Ar)}:Ar;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class xr{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){yr.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Or={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Pr="undefined"!=typeof URLSearchParams?URLSearchParams:Ir,Mr=FormData;const Fr=(()=>{let e;return("undefined"==typeof navigator||"ReactNative"!==(e=navigator.product)&&"NativeScript"!==e&&"NS"!==e)&&("undefined"!=typeof window&&"undefined"!=typeof document)})(),Nr="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var Ur={isBrowser:!0,classes:{URLSearchParams:Pr,FormData:Mr,Blob:Blob},isStandardBrowserEnv:Fr,isStandardBrowserWebWorkerEnv:Nr,protocols:["http","https","file","blob","url","data"]};function Br(e){function t(e,r,n,s){let i=e[s++];const o=Number.isFinite(+i),a=s>=e.length;if(i=!i&&yr.isArray(n)?n.length:i,a)return yr.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!o;n[i]&&yr.isObject(n[i])||(n[i]=[]);return t(e,r,n[i],s)&&yr.isArray(n[i])&&(n[i]=function(e){const t={},r=Object.keys(e);let n;const s=r.length;let i;for(n=0;n<s;n++)i=r[n],t[i]=e[i];return t}(n[i])),!o}if(yr.isFormData(e)&&yr.isFunction(e.entries)){const r={};return yr.forEachEntry(e,((e,n)=>{t(function(e){return yr.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const jr={"Content-Type":void 0};const $r={transitional:Or,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,s=yr.isObject(e);s&&yr.isHTMLForm(e)&&(e=new FormData(e));if(yr.isFormData(e))return n&&n?JSON.stringify(Br(e)):e;if(yr.isArrayBuffer(e)||yr.isBuffer(e)||yr.isStream(e)||yr.isFile(e)||yr.isBlob(e))return e;if(yr.isArrayBufferView(e))return e.buffer;if(yr.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let i;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return kr(e,new Ur.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Ur.isNode&&yr.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((i=yr.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return kr(i?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),function(e,t,r){if(yr.isString(e))try{return(t||JSON.parse)(e),yr.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||$r.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&yr.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw vr.from(e,vr.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ur.classes.FormData,Blob:Ur.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};yr.forEach(["delete","get","head"],(function(e){$r.headers[e]={}})),yr.forEach(["post","put","patch"],(function(e){$r.headers[e]=yr.merge(jr)}));const qr=yr.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Gr=Symbol("internals");function Hr(e){return e&&String(e).trim().toLowerCase()}function Kr(e){return!1===e||null==e?e:yr.isArray(e)?e.map(Kr):String(e)}function Vr(e,t,r,n){return yr.isFunction(n)?n.call(this,t,r):yr.isString(t)?yr.isString(n)?-1!==t.indexOf(n):yr.isRegExp(n)?n.test(t):void 0:void 0}class zr{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function s(e,t,r){const s=Hr(t);if(!s)throw new Error("header name must be a non-empty string");const i=yr.findKey(n,s);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||t]=Kr(e))}const i=(e,t)=>yr.forEach(e,((e,r)=>s(e,r,t)));return yr.isPlainObject(e)||e instanceof this.constructor?i(e,t):yr.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?i((e=>{const t={};let r,n,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),r=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!r||t[r]&&qr[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&s(t,e,r),this}get(e,t){if(e=Hr(e)){const r=yr.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(yr.isFunction(t))return t.call(this,e,r);if(yr.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Hr(e)){const r=yr.findKey(this,e);return!(!r||t&&!Vr(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function s(e){if(e=Hr(e)){const s=yr.findKey(r,e);!s||t&&!Vr(0,r[s],s,t)||(delete r[s],n=!0)}}return yr.isArray(e)?e.forEach(s):s(e),n}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,r={};return yr.forEach(this,((n,s)=>{const i=yr.findKey(r,s);if(i)return t[i]=Kr(n),void delete t[s];const o=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(s):String(s).trim();o!==s&&delete t[s],t[o]=Kr(n),r[o]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return yr.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&yr.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[Gr]=this[Gr]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Hr(e);t[n]||(!function(e,t){const r=yr.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,s){return this[n].call(this,t,e,r,s)},configurable:!0})}))}(r,e),t[n]=!0)}return yr.isArray(e)?e.forEach(n):n(e),this}}function Wr(e,t){const r=this||$r,n=t||r,s=zr.from(n.headers);let i=n.data;return yr.forEach(e,(function(e){i=e.call(r,i,s.normalize(),t?t.status:void 0)})),s.normalize(),i}function Yr(e){return!(!e||!e.__CANCEL__)}function Xr(e,t,r){vr.call(this,null==e?"canceled":e,vr.ERR_CANCELED,t,r),this.name="CanceledError"}zr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),yr.freezeMethods(zr.prototype),yr.freezeMethods(zr),yr.inherits(Xr,vr,{__CANCEL__:!0});var Qr=Ur.isStandardBrowserEnv?{write:function(e,t,r,n,s,i){const o=[];o.push(e+"="+encodeURIComponent(t)),yr.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),yr.isString(n)&&o.push("path="+n),yr.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Jr(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Zr=Ur.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=yr.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function en(e,t){let r=0;const n=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let s,i=0,o=0;return t=void 0!==t?t:1e3,function(a){const l=Date.now(),c=n[o];s||(s=l),r[i]=a,n[i]=l;let u=o,d=0;for(;u!==i;)d+=r[u++],u%=e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),l-s<t)return;const h=c&&l-c;return h?Math.round(1e3*d/h):void 0}}(50,250);return s=>{const i=s.loaded,o=s.lengthComputable?s.total:void 0,a=i-r,l=n(a);r=i;const c={loaded:i,total:o,progress:o?i/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&i<=o?(o-i)/l:void 0,event:s};c[t?"download":"upload"]=!0,e(c)}}var tn="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const s=zr.from(e.headers).normalize(),i=e.responseType;let o;function a(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}yr.isFormData(n)&&(Ur.isStandardBrowserEnv||Ur.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let l=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+r))}const c=Jr(e.baseURL,e.url);function u(){if(!l)return;const n=zr.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new vr("Request failed with status code "+r.status,[vr.ERR_BAD_REQUEST,vr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),a()}),(function(e){r(e),a()}),{data:i&&"text"!==i&&"json"!==i?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:n,config:e,request:l}),l=null}if(l.open(e.method.toUpperCase(),Dr(c,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=u:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(u)},l.onabort=function(){l&&(r(new vr("Request aborted",vr.ECONNABORTED,e,l)),l=null)},l.onerror=function(){r(new vr("Network Error",vr.ERR_NETWORK,e,l)),l=null},l.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Or;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new vr(t,n.clarifyTimeoutError?vr.ETIMEDOUT:vr.ECONNABORTED,e,l)),l=null},Ur.isStandardBrowserEnv){const t=(e.withCredentials||Zr(c))&&e.xsrfCookieName&&Qr.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===n&&s.setContentType(null),"setRequestHeader"in l&&yr.forEach(s.toJSON(),(function(e,t){l.setRequestHeader(t,e)})),yr.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&"json"!==i&&(l.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&l.addEventListener("progress",en(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",en(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{l&&(r(!t||t.type?new Xr(null,e,l):t),l.abort(),l=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const d=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(c);d&&-1===Ur.protocols.indexOf(d)?r(new vr("Unsupported protocol "+d+":",vr.ERR_BAD_REQUEST,e)):l.send(n||null)}))};const rn={http:null,xhr:tn};yr.forEach(rn,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var nn=e=>{e=yr.isArray(e)?e:[e];const{length:t}=e;let r,n;for(let s=0;s<t&&(r=e[s],!(n=yr.isString(r)?rn[r.toLowerCase()]:r));s++);if(!n){if(!1===n)throw new vr(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(yr.hasOwnProp(rn,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!yr.isFunction(n))throw new TypeError("adapter is not a function");return n};function sn(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xr(null,e)}function on(e){sn(e),e.headers=zr.from(e.headers),e.data=Wr.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return nn(e.adapter||$r.adapter)(e).then((function(t){return sn(e),t.data=Wr.call(e,e.transformResponse,t),t.headers=zr.from(t.headers),t}),(function(t){return Yr(t)||(sn(e),t&&t.response&&(t.response.data=Wr.call(e,e.transformResponse,t.response),t.response.headers=zr.from(t.response.headers))),Promise.reject(t)}))}const an=e=>e instanceof zr?e.toJSON():e;function ln(e,t){t=t||{};const r={};function n(e,t,r){return yr.isPlainObject(e)&&yr.isPlainObject(t)?yr.merge.call({caseless:r},e,t):yr.isPlainObject(t)?yr.merge({},t):yr.isArray(t)?t.slice():t}function s(e,t,r){return yr.isUndefined(t)?yr.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function i(e,t){if(!yr.isUndefined(t))return n(void 0,t)}function o(e,t){return yr.isUndefined(t)?yr.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,s,i){return i in t?n(r,s):i in e?n(void 0,r):void 0}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(e,t)=>s(an(e),an(t),!0)};return yr.forEach(Object.keys(e).concat(Object.keys(t)),(function(n){const i=l[n]||s,o=i(e[n],t[n],n);yr.isUndefined(o)&&i!==a||(r[n]=o)})),r}const cn="1.2.3",un={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{un[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const dn={};un.transitional=function(e,t,r){function n(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,s,i)=>{if(!1===e)throw new vr(n(s," has been removed"+(t?" in "+t:"")),vr.ERR_DEPRECATED);return t&&!dn[s]&&(dn[s]=!0,console.warn(n(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,s,i)}};var hn={assertOptions:function(e,t,r){if("object"!=typeof e)throw new vr("options must be an object",vr.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const i=n[s],o=t[i];if(o){const t=e[i],r=void 0===t||o(t,i,e);if(!0!==r)throw new vr("option "+i+" must be "+r,vr.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new vr("Unknown option "+i,vr.ERR_BAD_OPTION)}},validators:un};const fn=hn.validators;class pn{constructor(e){this.defaults=e,this.interceptors={request:new xr,response:new xr}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=ln(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:s}=t;let i;void 0!==r&&hn.assertOptions(r,{silentJSONParsing:fn.transitional(fn.boolean),forcedJSONParsing:fn.transitional(fn.boolean),clarifyTimeoutError:fn.transitional(fn.boolean)},!1),void 0!==n&&hn.assertOptions(n,{encode:fn.function,serialize:fn.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),i=s&&yr.merge(s.common,s[t.method]),i&&yr.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=zr.concat(i,s);const o=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,o.unshift(e.fulfilled,e.rejected))}));const l=[];let c;this.interceptors.response.forEach((function(e){l.push(e.fulfilled,e.rejected)}));let u,d=0;if(!a){const e=[on.bind(this),void 0];for(e.unshift.apply(e,o),e.push.apply(e,l),u=e.length,c=Promise.resolve(t);d<u;)c=c.then(e[d++],e[d++]);return c}u=o.length;let h=t;for(d=0;d<u;){const e=o[d++],t=o[d++];try{h=e(h)}catch(e){t.call(this,e);break}}try{c=on.call(this,h)}catch(e){return Promise.reject(e)}for(d=0,u=l.length;d<u;)c=c.then(l[d++],l[d++]);return c}getUri(e){return Dr(Jr((e=ln(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}yr.forEach(["delete","get","head","options"],(function(e){pn.prototype[e]=function(t,r){return this.request(ln(r||{},{method:e,url:t,data:(r||{}).data}))}})),yr.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,s){return this.request(ln(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}pn.prototype[e]=t(),pn.prototype[e+"Form"]=t(!0)}));class gn{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,s){r.reason||(r.reason=new Xr(e,n,s),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new gn((function(t){e=t})),cancel:e}}}const mn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(mn).forEach((([e,t])=>{mn[t]=e}));const yn=function e(t){const r=new pn(t),n=$t(pn.prototype.request,r);return yr.extend(n,pn.prototype,r,{allOwnKeys:!0}),yr.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(ln(t,r))},n}($r);yn.Axios=pn,yn.CanceledError=Xr,yn.CancelToken=gn,yn.isCancel=Yr,yn.VERSION=cn,yn.toFormData=kr,yn.AxiosError=vr,yn.Cancel=yn.CanceledError,yn.all=function(e){return Promise.all(e)},yn.spread=function(e){return function(t){return e.apply(null,t)}},yn.isAxiosError=function(e){return yr.isObject(e)&&!0===e.isAxiosError},yn.mergeConfig=ln,yn.AxiosHeaders=zr,yn.formToJSON=e=>Br(yr.isHTMLForm(e)?new FormData(e):e),yn.HttpStatusCode=mn,yn.default=yn;var vn={exports:{}};vn.exports=wn;var bn=vn.exports.HttpsAgent=wn;function wn(){}var En;!function(e){e.UserDeleted="User Deleted",e.UserGlobalBanned="User Global Banned",e.TokenExpired="Token Expired"}(En||(En={}));const Tn=new AbortController,Sn=e=>{switch(e){case En.UserGlobalBanned:throw new ge(e,400312,"fatal");case En.UserDeleted:throw new ge(e,400100,"fatal");case En.TokenExpired:throw pt("tokenExpired","tokenExpired"),new ge(e,800403,"fatal");default:throw new ge("Request Aborted",8e5,"error")}},Cn=e=>{const t={maxSockets:100,maxFreeSockets:10,timeout:6e4,freeSocketTimeout:3e4},r=yn.create({baseURL:e,httpAgent:new vn.exports(t),httpsAgent:new bn(t),signal:Tn.signal});return r.interceptors.request.use((e=>{if("/api/v4/sessions"===e.url)return e;if(e.metadata){const{tokenExpiry:t,isGlobalBanned:r,isUserDeleted:n}=e.metadata;r&&(Tn.abort(),Sn(En.UserGlobalBanned)),n&&(Tn.abort(),Sn(En.UserDeleted)),t&&Date.now()>=Date.parse(t)&&(Tn.abort(En.UserDeleted),Sn(En.TokenExpired))}return e})),r.interceptors.response.use((e=>e),(e=>{var t,r;const{response:n}=e;if(400100===(null==n?void 0:n.data.code)&&pt("tokenTerminated","terminated"),(null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.status)&&(e=>{if("success"===e.status)return e.data;if("fail"===e.status)throw new ye(e.code);if("error"===e.status)throw new me(e.message,e.code,"error")})(null==n?void 0:n.data),Tn.signal.aborted)throw e;throw new Error(null!==(r=null==n?void 0:n.data)&&void 0!==r?r:e)})),r.defaults.paramsSerializer={encode:e=>encodeURIComponent(e)},r};var _n={exports:{}},kn=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,An=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],In=function(e){var t=e,r=e.indexOf("["),n=e.indexOf("]");-1!=r&&-1!=n&&(e=e.substring(0,r)+e.substring(r,n).replace(/:/g,";")+e.substring(n,e.length));for(var s=kn.exec(e||""),i={},o=14;o--;)i[An[o]]=s[o]||"";return-1!=r&&-1!=n&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i},Rn={exports:{}},Ln={exports:{}},Dn=1e3,xn=6e4,On=60*xn,Pn=24*On,Mn=365.25*Pn,Fn=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*Mn;case"days":case"day":case"d":return r*Pn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*On;case"minutes":case"minute":case"mins":case"min":case"m":return r*xn;case"seconds":case"second":case"secs":case"sec":case"s":return r*Dn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&!1===isNaN(e))return t.long?function(e){return Nn(e,Pn,"day")||Nn(e,On,"hour")||Nn(e,xn,"minute")||Nn(e,Dn,"second")||e+" ms"}(e):function(e){if(e>=Pn)return Math.round(e/Pn)+"d";if(e>=On)return Math.round(e/On)+"h";if(e>=xn)return Math.round(e/xn)+"m";if(e>=Dn)return Math.round(e/Dn)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Nn(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}!function(e,t){function r(e){var r;function s(){if(s.enabled){var e=s,n=+new Date,i=n-(r||n);e.diff=i,e.prev=r,e.curr=n,r=n;for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];o[0]=t.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var l=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;l++;var s=t.formatters[n];if("function"==typeof s){var i=o[l];r=s.call(e,i),o.splice(l,1),l--}return r})),t.formatArgs.call(e,o);var c=s.log||t.log||console.log.bind(console);c.apply(e,o)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),s.destroy=n,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function n(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r<s;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var i=t.instances[r];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Fn,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Ln,Ln.exports),function(e,t){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Ln.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,n)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.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"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())}(Rn,Rn.exports);var Un=In,Bn=Rn.exports("socket.io-client:url"),jn=function(e,t){var r=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(Bn("protocol-less url %s",e),e=void 0!==t?t.protocol+"//"+e:"https://"+e),Bn("parse %s",e),r=Un(e));r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443"));r.path=r.path||"/";var n=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+n+":"+r.port,r.href=r.protocol+"://"+n+(t&&t.port===r.port?"":":"+r.port),r};var $n={},qn={exports:{}},Gn={exports:{}},Hn=1e3,Kn=6e4,Vn=60*Kn,zn=24*Vn,Wn=365.25*zn,Yn=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*Wn;case"days":case"day":case"d":return r*zn;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Vn;case"minutes":case"minute":case"mins":case"min":case"m":return r*Kn;case"seconds":case"second":case"secs":case"sec":case"s":return r*Hn;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&!1===isNaN(e))return t.long?function(e){return Xn(e,zn,"day")||Xn(e,Vn,"hour")||Xn(e,Kn,"minute")||Xn(e,Hn,"second")||e+" ms"}(e):function(e){if(e>=zn)return Math.round(e/zn)+"d";if(e>=Vn)return Math.round(e/Vn)+"h";if(e>=Kn)return Math.round(e/Kn)+"m";if(e>=Hn)return Math.round(e/Hn)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Xn(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}!function(e,t){function r(e){var r;function s(){if(s.enabled){var e=s,n=+new Date,i=n-(r||n);e.diff=i,e.prev=r,e.curr=n,r=n;for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];o[0]=t.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var l=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;l++;var s=t.formatters[n];if("function"==typeof s){var i=o[l];r=s.call(e,i),o.splice(l,1),l--}return r})),t.formatArgs.call(e,o);var c=s.log||t.log||console.log.bind(console);c.apply(e,o)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),s.destroy=n,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function n(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r<s;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var i=t.instances[r];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=Yn,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(Gn,Gn.exports),function(e,t){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=Gn.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,n)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.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"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())}(qn,qn.exports);var Qn={exports:{}};!function(e){function t(e){if(e)return function(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<n.length;s++)if((r=n[s])===t||r.fn===t){n.splice(s,1);break}return 0===n.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){n=0;for(var s=(r=r.slice(0)).length;n<s;++n)r[n].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(Qn);var Jn={},Zn={}.toString,es=Array.isArray||function(e){return"[object Array]"==Zn.call(e)},ts=function(e){return rs&&Buffer.isBuffer(e)||ns&&(e instanceof ArrayBuffer||function(e){return"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer}(e))},rs="function"==typeof Buffer&&"function"==typeof Buffer.isBuffer,ns="function"==typeof ArrayBuffer;var ss=es,is=ts,os=Object.prototype.toString,as="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===os.call(Blob),ls="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===os.call(File);function cs(e,t){if(!e)return e;if(is(e)){var r={_placeholder:!0,num:t.length};return t.push(e),r}if(ss(e)){for(var n=new Array(e.length),s=0;s<e.length;s++)n[s]=cs(e[s],t);return n}if("object"==typeof e&&!(e instanceof Date)){n={};for(var i in e)n[i]=cs(e[i],t);return n}return e}function us(e,t){if(!e)return e;if(e&&e._placeholder)return t[e.num];if(ss(e))for(var r=0;r<e.length;r++)e[r]=us(e[r],t);else if("object"==typeof e)for(var n in e)e[n]=us(e[n],t);return e}Jn.deconstructPacket=function(e){var t=[],r=e.data,n=e;return n.data=cs(r,t),n.attachments=t.length,{packet:n,buffers:t}},Jn.reconstructPacket=function(e,t){return e.data=us(e.data,t),e.attachments=void 0,e},Jn.removeBlobs=function(e,t){var r=0,n=e;!function e(s,i,o){if(!s)return s;if(as&&s instanceof Blob||ls&&s instanceof File){r++;var a=new FileReader;a.onload=function(){o?o[i]=this.result:n=this.result,--r||t(n)},a.readAsArrayBuffer(s)}else if(ss(s))for(var l=0;l<s.length;l++)e(s[l],l,s);else if("object"==typeof s&&!is(s))for(var c in s)e(s[c],c,s)}(n),r||t(n)},function(e){var t=qn.exports("socket.io-parser"),r=Qn.exports,n=Jn,s=es,i=ts;function o(){}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=o,e.Decoder=c;var a=e.ERROR+'"encode error"';function l(r){var n=""+r.type;if(e.BINARY_EVENT!==r.type&&e.BINARY_ACK!==r.type||(n+=r.attachments+"-"),r.nsp&&"/"!==r.nsp&&(n+=r.nsp+","),null!=r.id&&(n+=r.id),null!=r.data){var s=function(e){try{return JSON.stringify(e)}catch(e){return!1}}(r.data);if(!1===s)return a;n+=s}return t("encoded %j as %s",r,n),n}function c(){this.reconstructor=null}function u(e){this.reconPack=e,this.buffers=[]}function d(t){return{type:e.ERROR,data:"parser error: "+t}}o.prototype.encode=function(r,s){(t("encoding packet %j",r),e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type)?function(e,t){function r(e){var r=n.deconstructPacket(e),s=l(r.packet),i=r.buffers;i.unshift(s),t(i)}n.removeBlobs(e,r)}(r,s):s([l(r)])},r(c.prototype),c.prototype.add=function(r){var n;if("string"==typeof r)n=function(r){var n=0,i={type:Number(r.charAt(0))};if(null==e.types[i.type])return d("unknown packet type "+i.type);if(e.BINARY_EVENT===i.type||e.BINARY_ACK===i.type){for(var o=n+1;"-"!==r.charAt(++n)&&n!=r.length;);var a=r.substring(o,n);if(a!=Number(a)||"-"!==r.charAt(n))throw new Error("Illegal attachments");i.attachments=Number(a)}if("/"===r.charAt(n+1)){for(o=n+1;++n;){if(","===(c=r.charAt(n)))break;if(n===r.length)break}i.nsp=r.substring(o,n)}else i.nsp="/";var l=r.charAt(n+1);if(""!==l&&Number(l)==l){for(o=n+1;++n;){var c;if(null==(c=r.charAt(n))||Number(c)!=c){--n;break}if(n===r.length)break}i.id=Number(r.substring(o,n+1))}if(r.charAt(++n)){var u=function(e){try{return JSON.parse(e)}catch(e){return!1}}(r.substr(n));if(!(!1!==u&&(i.type===e.ERROR||s(u))))return d("invalid payload");i.data=u}return t("decoded %s as %j",r,i),i}(r),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type?(this.reconstructor=new u(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!i(r)&&!r.base64)throw new Error("Unknown type: "+r);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(r))&&(this.reconstructor=null,this.emit("decoded",n))}},c.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},u.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},u.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}}($n);var ds={exports:{}},hs={},fs={exports:{}};try{fs.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){fs.exports=!1}var ps,gs,ms,ys,vs=fs.exports,bs=function(e){var t=e.xdomain,r=e.xscheme,n=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||vs))return new XMLHttpRequest}catch(e){}try{if("undefined"!=typeof XDomainRequest&&!r&&n)return new XDomainRequest}catch(e){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}},ws={exports:{}},Es={},Ts=Object.keys||function(e){var t=[],r=Object.prototype.hasOwnProperty;for(var n in e)r.call(e,n)&&t.push(n);return t};function Ss(){if(ys)return ms;ys=1;var e=function(){if(gs)return ps;gs=1;var e={}.toString;return ps=Array.isArray||function(t){return"[object Array]"==e.call(t)}}(),t=Object.prototype.toString,r="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===t.call(Blob),n="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===t.call(File);return ms=function t(s){if(!s||"object"!=typeof s)return!1;if(e(s)){for(var i=0,o=s.length;i<o;i++)if(t(s[i]))return!0;return!1}if("function"==typeof Buffer&&Buffer.isBuffer&&Buffer.isBuffer(s)||"function"==typeof ArrayBuffer&&s instanceof ArrayBuffer||r&&s instanceof Blob||n&&s instanceof File)return!0;if(s.toJSON&&"function"==typeof s.toJSON&&1===arguments.length)return t(s.toJSON(),!0);for(var a in s)if(Object.prototype.hasOwnProperty.call(s,a)&&t(s[a]))return!0;return!1},ms}var Cs=function(e,t,r){var n=e.byteLength;if(t=t||0,r=r||n,e.slice)return e.slice(t,r);if(t<0&&(t+=n),r<0&&(r+=n),r>n&&(r=n),t>=n||t>=r||0===n)return new ArrayBuffer(0);for(var s=new Uint8Array(e),i=new Uint8Array(r-t),o=t,a=0;o<r;o++,a++)i[a]=s[o];return i.buffer},_s=function(e,t,r){var n=!1;return r=r||ks,s.count=e,0===e?t():s;function s(e,i){if(s.count<=0)throw new Error("after called too many times");--s.count,e?(n=!0,t(e),t=r):0!==s.count||n||t(null,i)}};function ks(){}
2
2
  /*! https://mths.be/utf8js v2.1.2 by @mathias */var As,Is,Rs,Ls=String.fromCharCode;function Ds(e){for(var t,r,n=[],s=0,i=e.length;s<i;)(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<i?56320==(64512&(r=e.charCodeAt(s++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),s--):n.push(t);return n}function xs(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function Os(e,t){return Ls(e>>t&63|128)}function Ps(e,t){if(0==(4294967168&e))return Ls(e);var r="";return 0==(4294965248&e)?r=Ls(e>>6&31|192):0==(4294901760&e)?(xs(e,t)||(e=65533),r=Ls(e>>12&15|224),r+=Os(e,6)):0==(4292870144&e)&&(r=Ls(e>>18&7|240),r+=Os(e,12),r+=Os(e,6)),r+=Ls(63&e|128)}function Ms(){if(Rs>=Is)throw Error("Invalid byte index");var e=255&As[Rs];if(Rs++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function Fs(e){var t,r;if(Rs>Is)throw Error("Invalid byte index");if(Rs==Is)return!1;if(t=255&As[Rs],Rs++,0==(128&t))return t;if(192==(224&t)){if((r=(31&t)<<6|Ms())>=128)return r;throw Error("Invalid continuation byte")}if(224==(240&t)){if((r=(15&t)<<12|Ms()<<6|Ms())>=2048)return xs(r,e)?r:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(r=(7&t)<<18|Ms()<<12|Ms()<<6|Ms())>=65536&&r<=1114111)return r;throw Error("Invalid UTF-8 detected")}var Ns,Us,Bs,js={version:"2.1.2",encode:function(e,t){for(var r=!1!==(t=t||{}).strict,n=Ds(e),s=n.length,i=-1,o="";++i<s;)o+=Ps(n[i],r);return o},decode:function(e,t){var r=!1!==(t=t||{}).strict;As=Ds(e),Is=As.length,Rs=0;for(var n,s=[];!1!==(n=Fs(r));)s.push(n);return function(e){for(var t,r=e.length,n=-1,s="";++n<r;)(t=e[n])>65535&&(s+=Ls((t-=65536)>>>10&1023|55296),t=56320|1023&t),s+=Ls(t);return s}(s)}},$s={};function qs(){if(Bs)return Us;Bs=1;var e=void 0!==e?e:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,t=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),r=t&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),n=e&&e.prototype.append&&e.prototype.getBlob;function s(e){return e.map((function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var r=new Uint8Array(e.byteLength);r.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=r.buffer}return t}return e}))}function i(t,r){r=r||{};var n=new e;return s(t).forEach((function(e){n.append(e)})),r.type?n.getBlob(r.type):n.getBlob()}function o(e,t){return new Blob(s(e),t||{})}return"undefined"!=typeof Blob&&(i.prototype=Blob.prototype,o.prototype=Blob.prototype),Us=t?r?Blob:o:n?i:void 0}!function(e){var t,r=Ts,n=Ss(),s=Cs,i=_s,o=js;"undefined"!=typeof ArrayBuffer&&(Ns||(Ns=1,function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new Uint8Array(256),r=0;r<e.length;r++)t[e.charCodeAt(r)]=r;$s.encode=function(t){var r,n=new Uint8Array(t),s=n.length,i="";for(r=0;r<s;r+=3)i+=e[n[r]>>2],i+=e[(3&n[r])<<4|n[r+1]>>4],i+=e[(15&n[r+1])<<2|n[r+2]>>6],i+=e[63&n[r+2]];return s%3==2?i=i.substring(0,i.length-1)+"=":s%3==1&&(i=i.substring(0,i.length-2)+"=="),i},$s.decode=function(e){var r,n,s,i,o,a=.75*e.length,l=e.length,c=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var u=new ArrayBuffer(a),d=new Uint8Array(u);for(r=0;r<l;r+=4)n=t[e.charCodeAt(r)],s=t[e.charCodeAt(r+1)],i=t[e.charCodeAt(r+2)],o=t[e.charCodeAt(r+3)],d[c++]=n<<2|s>>4,d[c++]=(15&s)<<4|i>>2,d[c++]=(3&i)<<6|63&o;return u}}()),t=$s);var a="undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),l="undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent),c=a||l;e.protocol=3;var u=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},d=r(u),h={type:"error",data:"parser error"},f=qs();function p(e,t,r){for(var n=new Array(e.length),s=i(e.length,r),o=function(e,r,s){t(r,(function(t,r){n[e]=r,s(t,n)}))},a=0;a<e.length;a++)o(a,e[a],s)}e.encodePacket=function(t,r,n,s){"function"==typeof r&&(s=r,r=!1),"function"==typeof n&&(s=n,n=null);var i=void 0===t.data?void 0:t.data.buffer||t.data;if("undefined"!=typeof ArrayBuffer&&i instanceof ArrayBuffer)return function(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var s=t.data,i=new Uint8Array(s),o=new Uint8Array(1+s.byteLength);o[0]=u[t.type];for(var a=0;a<i.length;a++)o[a+1]=i[a];return n(o.buffer)}(t,r,s);if(void 0!==f&&i instanceof f)return function(t,r,n){if(!r)return e.encodeBase64Packet(t,n);if(c)return function(t,r,n){if(!r)return e.encodeBase64Packet(t,n);var s=new FileReader;return s.onload=function(){e.encodePacket({type:t.type,data:s.result},r,!0,n)},s.readAsArrayBuffer(t.data)}(t,r,n);var s=new Uint8Array(1);s[0]=u[t.type];var i=new f([s.buffer,t.data]);return n(i)}(t,r,s);if(i&&i.base64)return function(t,r){var n="b"+e.packets[t.type]+t.data.data;return r(n)}(t,s);var a=u[t.type];return void 0!==t.data&&(a+=n?o.encode(String(t.data),{strict:!1}):String(t.data)),s(""+a)},e.encodeBase64Packet=function(t,r){var n,s="b"+e.packets[t.type];if(void 0!==f&&t.data instanceof f){var i=new FileReader;return i.onload=function(){var e=i.result.split(",")[1];r(s+e)},i.readAsDataURL(t.data)}try{n=String.fromCharCode.apply(null,new Uint8Array(t.data))}catch(e){for(var o=new Uint8Array(t.data),a=new Array(o.length),l=0;l<o.length;l++)a[l]=o[l];n=String.fromCharCode.apply(null,a)}return s+=btoa(n),r(s)},e.decodePacket=function(t,r,n){if(void 0===t)return h;if("string"==typeof t){if("b"===t.charAt(0))return e.decodeBase64Packet(t.substr(1),r);if(n&&!1===(t=function(e){try{e=o.decode(e,{strict:!1})}catch(e){return!1}return e}(t)))return h;var i=t.charAt(0);return Number(i)==i&&d[i]?t.length>1?{type:d[i],data:t.substring(1)}:{type:d[i]}:h}i=new Uint8Array(t)[0];var a=s(t,1);return f&&"blob"===r&&(a=new f([a])),{type:d[i],data:a}},e.decodeBase64Packet=function(e,r){var n=d[e.charAt(0)];if(!t)return{type:n,data:{base64:!0,data:e.substr(1)}};var s=t.decode(e.substr(1));return"blob"===r&&f&&(s=new f([s])),{type:n,data:s}},e.encodePayload=function(t,r,s){"function"==typeof r&&(s=r,r=null);var i=n(t);if(r&&i)return f&&!c?e.encodePayloadAsBlob(t,s):e.encodePayloadAsArrayBuffer(t,s);if(!t.length)return s("0:");p(t,(function(t,n){e.encodePacket(t,!!i&&r,!1,(function(e){n(null,function(e){return e.length+":"+e}(e))}))}),(function(e,t){return s(t.join(""))}))},e.decodePayload=function(t,r,n){if("string"!=typeof t)return e.decodePayloadAsBinary(t,r,n);var s;if("function"==typeof r&&(n=r,r=null),""===t)return n(h,0,1);for(var i,o,a="",l=0,c=t.length;l<c;l++){var u=t.charAt(l);if(":"===u){if(""===a||a!=(i=Number(a)))return n(h,0,1);if(a!=(o=t.substr(l+1,i)).length)return n(h,0,1);if(o.length){if(s=e.decodePacket(o,r,!1),h.type===s.type&&h.data===s.data)return n(h,0,1);if(!1===n(s,l+i,c))return}l+=i,a=""}else a+=u}return""!==a?n(h,0,1):void 0},e.encodePayloadAsArrayBuffer=function(t,r){if(!t.length)return r(new ArrayBuffer(0));p(t,(function(t,r){e.encodePacket(t,!0,!0,(function(e){return r(null,e)}))}),(function(e,t){var n=t.reduce((function(e,t){var r;return e+(r="string"==typeof t?t.length:t.byteLength).toString().length+r+2}),0),s=new Uint8Array(n),i=0;return t.forEach((function(e){var t="string"==typeof e,r=e;if(t){for(var n=new Uint8Array(e.length),o=0;o<e.length;o++)n[o]=e.charCodeAt(o);r=n.buffer}s[i++]=t?0:1;var a=r.byteLength.toString();for(o=0;o<a.length;o++)s[i++]=parseInt(a[o]);s[i++]=255;for(n=new Uint8Array(r),o=0;o<n.length;o++)s[i++]=n[o]})),r(s.buffer)}))},e.encodePayloadAsBlob=function(t,r){p(t,(function(t,r){e.encodePacket(t,!0,!0,(function(e){var t=new Uint8Array(1);if(t[0]=1,"string"==typeof e){for(var n=new Uint8Array(e.length),s=0;s<e.length;s++)n[s]=e.charCodeAt(s);e=n.buffer,t[0]=0}var i=(e instanceof ArrayBuffer?e.byteLength:e.size).toString(),o=new Uint8Array(i.length+1);for(s=0;s<i.length;s++)o[s]=parseInt(i[s]);if(o[i.length]=255,f){var a=new f([t.buffer,o.buffer,e]);r(null,a)}}))}),(function(e,t){return r(new f(t))}))},e.decodePayloadAsBinary=function(t,r,n){"function"==typeof r&&(n=r,r=null);for(var i=t,o=[];i.byteLength>0;){for(var a=new Uint8Array(i),l=0===a[0],c="",u=1;255!==a[u];u++){if(c.length>310)return n(h,0,1);c+=a[u]}i=s(i,2+c.length),c=parseInt(c);var d=s(i,0,c);if(l)try{d=String.fromCharCode.apply(null,new Uint8Array(d))}catch(e){var f=new Uint8Array(d);d="";for(u=0;u<f.length;u++)d+=String.fromCharCode(f[u])}o.push(d),i=s(i,c)}var p=o.length;o.forEach((function(t,s){n(e.decodePacket(t,r,!0),s,p)}))}}(Es);var Gs,Hs,Ks={exports:{}};function Vs(){if(Hs)return Gs;Hs=1;var e=Es;function t(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}return Gs=t,(0,Ks.exports)(t.prototype),t.prototype.onError=function(e,t){var r=new Error(e);return r.type="TransportError",r.description=t,this.emit("error",r),this},t.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},t.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},t.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},t.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},t.prototype.onData=function(t){var r=e.decodePacket(t,this.socket.binaryType);this.onPacket(r)},t.prototype.onPacket=function(e){this.emit("packet",e)},t.prototype.onClose=function(){this.readyState="closed",this.emit("close")},Gs}!function(e){function t(e){if(e)return function(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<n.length;s++)if((r=n[s])===t||r.fn===t){n.splice(s,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),r=this._callbacks["$"+e];if(r)for(var n=0,s=(r=r.slice(0)).length;n<s;++n)r[n].apply(this,t);return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(Ks);var zs,Ws={};function Ys(){return zs||(zs=1,Ws.encode=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t},Ws.decode=function(e){for(var t={},r=e.split("&"),n=0,s=r.length;n<s;n++){var i=r[n].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}),Ws}var Xs,Qs=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},Js="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Zs={},ei=0,ti=0;function ri(e){var t="";do{t=Js[e%64]+t,e=Math.floor(e/64)}while(e>0);return t}function ni(){var e=ri(+new Date);return e!==Xs?(ei=0,Xs=e):e+"."+ri(ei++)}for(;ti<64;ti++)Zs[Js[ti]]=ti;ni.encode=ri,ni.decode=function(e){var t=0;for(ti=0;ti<e.length;ti++)t=64*t+Zs[e.charAt(ti)];return t};var si=ni,ii={exports:{}},oi={exports:{}},ai=1e3,li=60*ai,ci=60*li,ui=24*ci,di=365.25*ui,hi=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*di;case"days":case"day":case"d":return r*ui;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ci;case"minutes":case"minute":case"mins":case"min":case"m":return r*li;case"seconds":case"second":case"secs":case"sec":case"s":return r*ai;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&!1===isNaN(e))return t.long?function(e){return fi(e,ui,"day")||fi(e,ci,"hour")||fi(e,li,"minute")||fi(e,ai,"second")||e+" ms"}(e):function(e){if(e>=ui)return Math.round(e/ui)+"d";if(e>=ci)return Math.round(e/ci)+"h";if(e>=li)return Math.round(e/li)+"m";if(e>=ai)return Math.round(e/ai)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function fi(e,t,r){if(!(e<t))return e<1.5*t?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}!function(e,t){function r(e){var r;function s(){if(s.enabled){var e=s,n=+new Date,i=n-(r||n);e.diff=i,e.prev=r,e.curr=n,r=n;for(var o=new Array(arguments.length),a=0;a<o.length;a++)o[a]=arguments[a];o[0]=t.coerce(o[0]),"string"!=typeof o[0]&&o.unshift("%O");var l=0;o[0]=o[0].replace(/%([a-zA-Z%])/g,(function(r,n){if("%%"===r)return r;l++;var s=t.formatters[n];if("function"==typeof s){var i=o[l];r=s.call(e,i),o.splice(l,1),l--}return r})),t.formatArgs.call(e,o);var c=s.log||t.log||console.log.bind(console);c.apply(e,o)}}return s.namespace=e,s.enabled=t.enabled(e),s.useColors=t.useColors(),s.color=function(e){var r,n=0;for(r in e)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]}(e),s.destroy=n,"function"==typeof t.init&&t.init(s),t.instances.push(s),s}function n(){var e=t.instances.indexOf(this);return-1!==e&&(t.instances.splice(e,1),!0)}(t=e.exports=r.debug=r.default=r).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){var r;t.save(e),t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),s=n.length;for(r=0;r<s;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")));for(r=0;r<t.instances.length;r++){var i=t.instances[r];i.enabled=t.enabled(i.namespace)}},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=hi,t.instances=[],t.names=[],t.skips=[],t.formatters={}}(oi,oi.exports),function(e,t){function r(){var e;try{e=t.storage.debug}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}(t=e.exports=oi.exports).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},t.formatArgs=function(e){var r=this.useColors;if(e[0]=(r?"%c":"")+this.namespace+(r?" %c":" ")+e[0]+(r?"%c ":" ")+"+"+t.humanize(this.diff),!r)return;var n="color: "+this.color;e.splice(1,0,n,"color: inherit");var s=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(s++,"%c"===e&&(i=s))})),e.splice(i,0,n)},t.save=function(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(e){}},t.load=r,t.useColors=function(){if("undefined"!=typeof window&&window.process&&"renderer"===window.process.type)return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),t.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"],t.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},t.enable(r())}(ii,ii.exports);var pi=Vs(),gi=Ys(),mi=Es,yi=Qs,vi=si,bi=ii.exports("engine.io-client:polling"),wi=Ti,Ei=null!=new bs({xdomain:!1}).responseType;function Ti(e){var t=e&&e.forceBase64;Ei&&!t||(this.supportsBinary=!1),pi.call(this,e)}yi(Ti,pi),Ti.prototype.name="polling",Ti.prototype.doOpen=function(){this.poll()},Ti.prototype.pause=function(e){var t=this;function r(){bi("paused"),t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var n=0;this.polling&&(bi("we are currently polling - waiting to pause"),n++,this.once("pollComplete",(function(){bi("pre-pause polling complete"),--n||r()}))),this.writable||(bi("we are currently writing - waiting to pause"),n++,this.once("drain",(function(){bi("pre-pause writing complete"),--n||r()})))}else r()},Ti.prototype.poll=function(){bi("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},Ti.prototype.onData=function(e){var t=this;bi("polling got data %s",e);mi.decodePayload(e,this.socket.binaryType,(function(e,r,n){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():bi('ignoring poll - transport state "%s"',this.readyState))},Ti.prototype.doClose=function(){var e=this;function t(){bi("writing close packet"),e.write([{type:"close"}])}"open"===this.readyState?(bi("transport open - closing"),t()):(bi("transport not open - deferring close"),this.once("open",t))},Ti.prototype.write=function(e){var t=this;this.writable=!1;var r=function(){t.writable=!0,t.emit("drain")};mi.encodePayload(e,this.supportsBinary,(function(e){t.doWrite(e,r)}))},Ti.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",r="";return!1!==this.timestampRequests&&(e[this.timestampParam]=vi()),this.supportsBinary||e.sid||(e.b64=1),e=gi.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(r=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+e};var Si=bs,Ci=wi,_i=Ks.exports,ki=Qs,Ai=ii.exports("engine.io-client:polling-xhr");function Ii(){}function Ri(e){if(Ci.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,"undefined"!=typeof location){var t="https:"===location.protocol,r=location.port;r||(r=t?443:80),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||r!==e.port,this.xs=e.secure!==t}}function Li(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=!1!==e.async,this.data=void 0!==e.data?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}if(ws.exports=Ri,ws.exports.Request=Li,ki(Ri,Ci),Ri.prototype.supportsBinary=!0,Ri.prototype.request=function(e){return(e=e||{}).uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new Li(e)},Ri.prototype.doWrite=function(e,t){var r="string"!=typeof e&&void 0!==e,n=this.request({method:"POST",data:e,isBinary:r}),s=this;n.on("success",t),n.on("error",(function(e){s.onError("xhr post error",e)})),this.sendXhr=n},Ri.prototype.doPoll=function(){Ai("xhr poll");var e=this.request(),t=this;e.on("data",(function(e){t.onData(e)})),e.on("error",(function(e){t.onError("xhr poll error",e)})),this.pollXhr=e},_i(Li.prototype),Li.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new Si(e),r=this;try{Ai("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders)for(var n in t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0),this.extraHeaders)this.extraHeaders.hasOwnProperty(n)&&t.setRequestHeader(n,this.extraHeaders[n])}catch(e){}if("POST"===this.method)try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{t.setRequestHeader("Accept","*/*")}catch(e){}"withCredentials"in t&&(t.withCredentials=!0),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){r.onLoad()},t.onerror=function(){r.onError(t.responseText)}):t.onreadystatechange=function(){if(2===t.readyState)try{var e=t.getResponseHeader("Content-Type");r.supportsBinary&&"application/octet-stream"===e&&(t.responseType="arraybuffer")}catch(e){}4===t.readyState&&(200===t.status||1223===t.status?r.onLoad():setTimeout((function(){r.onError(t.status)}),0))},Ai("xhr data %s",this.data),t.send(this.data)}catch(e){return void setTimeout((function(){r.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Li.requestsCount++,Li.requests[this.index]=this)},Li.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},Li.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},Li.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},Li.prototype.cleanup=function(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=Ii:this.xhr.onreadystatechange=Ii,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Li.requests[this.index],this.xhr=null}},Li.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(e){}e="application/octet-stream"===t&&this.xhr.response||this.xhr.responseText}catch(e){this.onError(e)}null!=e&&this.onData(e)},Li.prototype.hasXDR=function(){return"undefined"!=typeof XDomainRequest&&!this.xs&&this.enablesXDR},Li.prototype.abort=function(){this.cleanup()},Li.requestsCount=0,Li.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",xi);else if("function"==typeof addEventListener){var Di="onpagehide"in self?"pagehide":"unload";addEventListener(Di,xi,!1)}function xi(){for(var e in Li.requests)Li.requests.hasOwnProperty(e)&&Li.requests[e].abort()}var Oi,Pi=wi,Mi=ji,Fi=/\n/g,Ni=/\\n/g;function Ui(){}function Bi(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==Te?Te:{}}function ji(e){if(Pi.call(this,e),this.query=this.query||{},!Oi){var t=Bi();Oi=t.___eio=t.___eio||[]}this.index=Oi.length;var r=this;Oi.push((function(e){r.onData(e)})),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",(function(){r.script&&(r.script.onerror=Ui)}),!1)}Qs(ji,Pi),ji.prototype.supportsBinary=!1,ji.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),Pi.prototype.doClose.call(this)},ji.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(t,r):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout((function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)}),100)},ji.prototype.doWrite=function(e,t){var r=this;if(!this.form){var n,s=document.createElement("form"),i=document.createElement("textarea"),o=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=o,s.method="POST",s.setAttribute("accept-charset","utf-8"),i.name="d",s.appendChild(i),document.body.appendChild(s),this.form=s,this.area=i}function a(){l(),t()}function l(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(e){r.onError("jsonp polling iframe removal error",e)}try{var e='<iframe src="javascript:0" name="'+r.iframeId+'">';n=document.createElement(e)}catch(e){(n=document.createElement("iframe")).name=r.iframeId,n.src="javascript:0"}n.id=r.iframeId,r.form.appendChild(n),r.iframe=n}this.form.action=this.uri(),l(),e=e.replace(Ni,"\\\n"),this.area.value=e.replace(Fi,"\\n");try{this.form.submit()}catch(e){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===r.iframe.readyState&&a()}:this.iframe.onload=a};var $i,qi,Gi=Ce(Object.freeze({__proto__:null,default:{}})),Hi=Vs(),Ki=Es,Vi=Ys(),zi=Qs,Wi=si,Yi=ii.exports("engine.io-client:websocket");if("undefined"!=typeof WebSocket)$i=WebSocket;else if("undefined"!=typeof self)$i=self.WebSocket||self.MozWebSocket;else try{qi=Gi}catch(e){}var Xi=$i||qi,Qi=Ji;function Ji(e){e&&e.forceBase64&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=$i&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(Xi=qi),Hi.call(this,e)}zi(Ji,Hi),Ji.prototype.name="websocket",Ji.prototype.supportsBinary=!0,Ji.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=this.protocols,r={agent:this.agent,perMessageDeflate:this.perMessageDeflate};r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?t?new Xi(e,t):new Xi(e):new Xi(e,t,r)}catch(e){return this.emit("error",e)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},Ji.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},Ji.prototype.write=function(e){var t=this;this.writable=!1;for(var r=e.length,n=0,s=r;n<s;n++)!function(e){Ki.encodePacket(e,t.supportsBinary,(function(n){if(!t.usingBrowserWebSocket){var s={};if(e.options&&(s.compress=e.options.compress),t.perMessageDeflate)("string"==typeof n?Buffer.byteLength(n):n.length)<t.perMessageDeflate.threshold&&(s.compress=!1)}try{t.usingBrowserWebSocket?t.ws.send(n):t.ws.send(n,s)}catch(e){Yi("websocket closed before onclose event")}--r||i()}))}(e[n]);function i(){t.emit("flush"),setTimeout((function(){t.writable=!0,t.emit("drain")}),0)}},Ji.prototype.onClose=function(){Hi.prototype.onClose.call(this)},Ji.prototype.doClose=function(){void 0!==this.ws&&this.ws.close()},Ji.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",r="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(r=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=Wi()),this.supportsBinary||(e.b64=1),(e=Vi.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+r+this.path+e},Ji.prototype.check=function(){return!(!Xi||"__initialize"in Xi&&this.name===Ji.prototype.name)};var Zi=bs,eo=ws.exports,to=Mi,ro=Qi;hs.polling=function(e){var t=!1,r=!1,n=!1!==e.jsonp;if("undefined"!=typeof location){var s="https:"===location.protocol,i=location.port;i||(i=s?443:80),t=e.hostname!==location.hostname||i!==e.port,r=e.secure!==s}if(e.xdomain=t,e.xscheme=r,"open"in new Zi(e)&&!e.forceJSONP)return new eo(e);if(!n)throw new Error("JSONP disabled");return new to(e)},hs.websocket=ro;var no,so=[].indexOf,io=function(e,t){if(so)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1},oo=hs,ao=Ks.exports,lo=ii.exports("engine.io-client:socket"),co=io,uo=Es,ho=In,fo=Ys(),po=go;function go(e,t){if(!(this instanceof go))return new go(e,t);t=t||{},e&&"object"==typeof e&&(t=e,e=null),e?(e=ho(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ho(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=fo.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=void 0===t.rejectUnauthorized||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}go.priorWebsocketSuccess=!1,ao(go.prototype),go.protocol=uo.protocol,go.Socket=go,go.Transport=Vs(),go.transports=hs,go.parser=Es,go.prototype.createTransport=function(e){lo('creating transport "%s"',e);var t=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}(this.query);t.EIO=uo.protocol,t.transport=e;var r=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new oo[e]({query:t,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative})},go.prototype.open=function(){var e;if(this.rememberUpgrade&&go.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout((function(){t.emit("error","No transports available")}),0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},go.prototype.setTransport=function(e){lo("setting transport %s",e.name);var t=this;this.transport&&(lo("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",(function(){t.onDrain()})).on("packet",(function(e){t.onPacket(e)})).on("error",(function(e){t.onError(e)})).on("close",(function(){t.onClose("transport close")}))},go.prototype.probe=function(e){lo('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;function s(){if(n.onlyBinaryUpgrades){var s=!this.supportsBinary&&n.transport.supportsBinary;r=r||s}r||(lo('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",(function(s){if(!r)if("pong"===s.type&&"probe"===s.data){if(lo('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;go.priorWebsocketSuccess="websocket"===t.name,lo('pausing current transport "%s"',n.transport.name),n.transport.pause((function(){r||"closed"!==n.readyState&&(lo("changing transport and sending upgrade packet"),u(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())}))}else{lo('probe transport "%s" failed',e);var i=new Error("probe error");i.transport=t.name,n.emit("upgradeError",i)}})))}function i(){r||(r=!0,u(),t.close(),t=null)}function o(r){var s=new Error("probe error: "+r);s.transport=t.name,i(),lo('probe transport "%s" failed because of error: %s',e,r),n.emit("upgradeError",s)}function a(){o("transport closed")}function l(){o("socket closed")}function c(e){t&&e.name!==t.name&&(lo('"%s" works - aborting "%s"',e.name,t.name),i())}function u(){t.removeListener("open",s),t.removeListener("error",o),t.removeListener("close",a),n.removeListener("close",l),n.removeListener("upgrading",c)}go.priorWebsocketSuccess=!1,t.once("open",s),t.once("error",o),t.once("close",a),this.once("close",l),this.once("upgrading",c),t.open()},go.prototype.onOpen=function(){if(lo("socket open"),this.readyState="open",go.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){lo("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},go.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(lo('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else lo('packet received with socket readyState "%s"',this.readyState)},go.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},go.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout((function(){"closed"!==t.readyState&&t.onClose("ping timeout")}),e||t.pingInterval+t.pingTimeout)},go.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout((function(){lo("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)}),e.pingInterval)},go.prototype.ping=function(){var e=this;this.sendPacket("ping",(function(){e.emit("ping")}))},go.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},go.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(lo("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},go.prototype.write=go.prototype.send=function(e,t,r){return this.sendPacket("message",e,t,r),this},go.prototype.sendPacket=function(e,t,r,n){if("function"==typeof t&&(n=t,t=void 0),"function"==typeof r&&(n=r,r=null),"closing"!==this.readyState&&"closed"!==this.readyState){(r=r||{}).compress=!1!==r.compress;var s={type:e,data:t,options:r};this.emit("packetCreate",s),this.writeBuffer.push(s),n&&this.once("flush",n),this.flush()}},go.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",(function(){this.upgrading?n():t()})):this.upgrading?n():t()}function t(){e.onClose("forced close"),lo("socket closing - telling transport to close"),e.transport.close()}function r(){e.removeListener("upgrade",r),e.removeListener("upgradeError",r),t()}function n(){e.once("upgrade",r),e.once("upgradeError",r)}return this},go.prototype.onError=function(e){lo("socket error %j",e),go.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},go.prototype.onClose=function(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){lo('socket close with reason: "%s"',e);clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",e,t),this.writeBuffer=[],this.prevBufferLen=0}},go.prototype.filterUpgrades=function(e){for(var t=[],r=0,n=e.length;r<n;r++)~co(this.transports,e[r])&&t.push(e[r]);return t},(no=ds).exports=po,no.exports.parser=Es;var mo,yo,vo={exports:{}},bo={exports:{}};!function(e){function t(e){if(e)return function(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var r,n=this._callbacks["$"+e];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var s=0;s<n.length;s++)if((r=n[s])===t||r.fn===t){n.splice(s,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),r=this._callbacks["$"+e];if(r)for(var n=0,s=(r=r.slice(0)).length;n<s;++n)r[n].apply(this,t);return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(bo);var wo=function(e,t,r){return e.on(t,r),{destroy:function(){e.removeListener(t,r)}}};var Eo,To=[].slice,So=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var r=To.call(arguments,2);return function(){return t.apply(e,r.concat(To.call(arguments)))}};function Co(){return Eo||(Eo=1,function(e,t){var r=$n,n=bo.exports,s=(yo||(yo=1,mo=function(e,t){for(var r=[],n=(t=t||0)||0;n<e.length;n++)r[n-t]=e[n];return r}),mo),i=wo,o=So,a=Rn.exports("socket.io-client:socket"),l=Ys(),c=Ss();e.exports=h;var u={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},d=n.prototype.emit;function h(e,t,r){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},r&&r.query&&(this.query=r.query),this.io.autoConnect&&this.open()}n(h.prototype),h.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[i(e,"open",o(this,"onopen")),i(e,"packet",o(this,"onpacket")),i(e,"close",o(this,"onclose"))]}},h.prototype.open=h.prototype.connect=function(){return this.connected||(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting")),this},h.prototype.send=function(){var e=s(arguments);return e.unshift("message"),this.emit.apply(this,e),this},h.prototype.emit=function(e){if(u.hasOwnProperty(e))return d.apply(this,arguments),this;var t=s(arguments),n={type:(void 0!==this.flags.binary?this.flags.binary:c(t))?r.BINARY_EVENT:r.EVENT,data:t,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(a("emitting packet with ack id %d",this.ids),this.acks[this.ids]=t.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},h.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},h.prototype.onopen=function(){if(a("transport is open - connecting"),"/"!==this.nsp)if(this.query){var e="object"==typeof this.query?l.encode(this.query):this.query;a("sending connect packet with query %s",e),this.packet({type:r.CONNECT,query:e})}else this.packet({type:r.CONNECT})},h.prototype.onclose=function(e){a("close (%s)",e),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},h.prototype.onpacket=function(e){var t=e.nsp===this.nsp,n=e.type===r.ERROR&&"/"===e.nsp;if(t||n)switch(e.type){case r.CONNECT:this.onconnect();break;case r.EVENT:case r.BINARY_EVENT:this.onevent(e);break;case r.ACK:case r.BINARY_ACK:this.onack(e);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",e.data)}},h.prototype.onevent=function(e){var t=e.data||[];a("emitting event %j",t),null!=e.id&&(a("attaching ack callback to event"),t.push(this.ack(e.id))),this.connected?d.apply(this,t):this.receiveBuffer.push(t)},h.prototype.ack=function(e){var t=this,n=!1;return function(){if(!n){n=!0;var i=s(arguments);a("sending ack %j",i),t.packet({type:c(i)?r.BINARY_ACK:r.ACK,id:e,data:i})}}},h.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(a("calling ack %s with %j",e.id,e.data),t.apply(this,e.data),delete this.acks[e.id]):a("bad ack %s",e.id)},h.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},h.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)d.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},h.prototype.ondisconnect=function(){a("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},h.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},h.prototype.close=h.prototype.disconnect=function(){return this.connected&&(a("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},h.prototype.compress=function(e){return this.flags.compress=e,this},h.prototype.binary=function(e){return this.flags.binary=e,this}}(vo)),vo.exports}var _o=ko;function ko(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}ko.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-r:e+r}return 0|Math.min(e,this.max)},ko.prototype.reset=function(){this.attempts=0},ko.prototype.setMin=function(e){this.ms=e},ko.prototype.setMax=function(e){this.max=e},ko.prototype.setJitter=function(e){this.jitter=e};var Ao=ds.exports,Io=Co(),Ro=bo.exports,Lo=$n,Do=wo,xo=So,Oo=Rn.exports("socket.io-client:manager"),Po=io,Mo=_o,Fo=Object.prototype.hasOwnProperty,No=Uo;function Uo(e,t){if(!(this instanceof Uo))return new Uo(e,t);e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new Mo({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=t.parser||Lo;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}Uo.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)Fo.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},Uo.prototype.updateSocketIds=function(){for(var e in this.nsps)Fo.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},Uo.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},Ro(Uo.prototype),Uo.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},Uo.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},Uo.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},Uo.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},Uo.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},Uo.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},Uo.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},Uo.prototype.open=Uo.prototype.connect=function(e,t){if(Oo("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;Oo("opening %s",this.uri),this.engine=Ao(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var s=Do(r,"open",(function(){n.onopen(),e&&e()})),i=Do(r,"error",(function(t){if(Oo("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",t),e){var r=new Error("Connection error");r.data=t,e(r)}else n.maybeReconnectOnOpen()}));if(!1!==this._timeout){var o=this._timeout;Oo("connect attempt will timeout after %d",o);var a=setTimeout((function(){Oo("connect attempt timed out after %d",o),s.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",o)}),o);this.subs.push({destroy:function(){clearTimeout(a)}})}return this.subs.push(s),this.subs.push(i),this},Uo.prototype.onopen=function(){Oo("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(Do(e,"data",xo(this,"ondata"))),this.subs.push(Do(e,"ping",xo(this,"onping"))),this.subs.push(Do(e,"pong",xo(this,"onpong"))),this.subs.push(Do(e,"error",xo(this,"onerror"))),this.subs.push(Do(e,"close",xo(this,"onclose"))),this.subs.push(Do(this.decoder,"decoded",xo(this,"ondecoded")))},Uo.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},Uo.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},Uo.prototype.ondata=function(e){this.decoder.add(e)},Uo.prototype.ondecoded=function(e){this.emit("packet",e)},Uo.prototype.onerror=function(e){Oo("error",e),this.emitAll("error",e)},Uo.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new Io(this,e,t),this.nsps[e]=r;var n=this;r.on("connecting",s),r.on("connect",(function(){r.id=n.generateId(e)})),this.autoConnect&&s()}function s(){~Po(n.connecting,r)||n.connecting.push(r)}return r},Uo.prototype.destroy=function(e){var t=Po(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},Uo.prototype.packet=function(e){Oo("writing packet %j",e);var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,(function(r){for(var n=0;n<r.length;n++)t.engine.write(r[n],e.options);t.encoding=!1,t.processPacketQueue()})))},Uo.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},Uo.prototype.cleanup=function(){Oo("cleanup");for(var e=this.subs.length,t=0;t<e;t++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},Uo.prototype.close=Uo.prototype.disconnect=function(){Oo("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},Uo.prototype.onclose=function(e){Oo("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},Uo.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)Oo("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();Oo("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var r=setTimeout((function(){e.skipReconnect||(Oo("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||e.open((function(t){t?(Oo("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):(Oo("reconnect success"),e.onreconnect())})))}),t);this.subs.push({destroy:function(){clearTimeout(r)}})}},Uo.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var r=jn,n=$n,s=No,i=Rn.exports("socket.io-client");e.exports=t=a;var o=t.managers={};function a(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var n,a=r(e),l=a.source,c=a.id,u=a.path,d=o[c]&&u in o[c].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||d?(i("ignoring socket cache for %s",l),n=s(l,t)):(o[c]||(i("new io instance for %s",l),o[c]=s(l,t)),n=o[c]),a.query&&!t.query&&(t.query=a.query),n.socket(a.path,t)}t.protocol=n.protocol,t.connect=a,t.Manager=No,t.Socket=Co()}(_n,_n.exports);var Bo=_n.exports;function jo(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var $o={exports:{}};!function(e,t){e.exports=function(){function e(t,r,n){function s(o,a){if(!r[o]){if(!t[o]){if(!a&&jo)return jo(o);if(i)return i(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[o]={exports:{}};t[o][0].call(c.exports,(function(e){return s(t[o][1][e]||e)}),c,c.exports,e,t,r,n)}return r[o].exports}for(var i=jo,o=0;o<n.length;o++)s(n[o]);return s}return e}()({1:[function(e,t,r){(function(r,n){(function(){const s=e("events").EventEmitter,i=e("./store"),o=e("./topic-alias-recv"),a=e("./topic-alias-send"),l=e("mqtt-packet"),c=e("./default-message-id-provider"),u=e("readable-stream").Writable,d=e("inherits"),h=e("reinterval"),f=e("rfdc/default"),p=e("./validations"),g=e("xtend"),m=e("debug")("mqttjs:client"),y=r?r.nextTick:function(e){setTimeout(e,0)},v=n.setImmediate||function(e){y(e)},b={keepalive:60,reschedulePings:!0,protocolId:"MQTT",protocolVersion:4,reconnectPeriod:1e3,connectTimeout:3e4,clean:!0,resubscribe:!0},w=["ECONNREFUSED","EADDRINUSE","ECONNRESET","ENOTFOUND"],E={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 T(){return"mqttjs_"+Math.random().toString(16).substr(2,8)}function S(e,t){if(5===e.options.protocolVersion&&"publish"===t.cmd){let r;t.properties&&(r=t.properties.topicAlias);const n=t.topic.toString();if(e.topicAliasSend)if(r){if(0!==n.length&&(m("applyTopicAlias :: register topic: %s - alias: %d",n,r),!e.topicAliasSend.put(n,r)))return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}else 0!==n.length&&(e.options.autoAssignTopicAlias?(r=e.topicAliasSend.getAliasByTopic(n),r?(t.topic="",t.properties={...t.properties,topicAlias:r},m("applyTopicAlias :: auto assign(use) topic: %s - alias: %d",n,r)):(r=e.topicAliasSend.getLruAlias(),e.topicAliasSend.put(n,r),t.properties={...t.properties,topicAlias:r},m("applyTopicAlias :: auto assign topic: %s - alias: %d",n,r))):e.options.autoUseTopicAlias&&(r=e.topicAliasSend.getAliasByTopic(n),r&&(t.topic="",t.properties={...t.properties,topicAlias:r},m("applyTopicAlias :: auto use topic: %s - alias: %d",n,r))));else if(r)return m("applyTopicAlias :: error out of range. topic: %s - alias: %d",n,r),new Error("Sending Topic Alias out of range")}}function C(e,t){let r;t.properties&&(r=t.properties.topicAlias);let n=t.topic.toString();if(0===n.length){if(void 0===r)return new Error("Unregistered Topic Alias");if(n=e.topicAliasSend.getTopicByAlias(r),void 0===n)return new Error("Unregistered Topic Alias");t.topic=n}r&&delete t.properties.topicAlias}function _(e,t,r){m("sendPacket :: packet: %O",t),m("sendPacket :: emitting `packetsend`"),e.emit("packetsend",t),m("sendPacket :: writing to stream");const n=l.writeToStream(t,e.stream,e.options);m("sendPacket :: writeToStream result %s",n),!n&&r&&r!==R?(m("sendPacket :: handle events on `drain` once through callback."),e.stream.once("drain",r)):r&&(m("sendPacket :: invoking cb"),r())}function k(e){e&&(m("flush: queue exists? %b",!!e),Object.keys(e).forEach((function(t){"function"==typeof e[t].cb&&(e[t].cb(new Error("Connection closed")),delete e[t])})))}function A(e){e&&(m("flushVolatile :: deleting volatile messages from the queue and setting their callbacks as error function"),Object.keys(e).forEach((function(t){e[t].volatile&&"function"==typeof e[t].cb&&(e[t].cb(new Error("Connection closed")),delete e[t])})))}function I(e,t,r,n){m("storeAndSend :: store packet with cmd %s to outgoingStore",t.cmd);let s,i=t;if("publish"===i.cmd&&(i=f(t),s=C(e,i),s))return r&&r(s);e.outgoingStore.put(i,(function(s){if(s)return r&&r(s);n(),_(e,t,r)}))}function R(e){m("nop ::",e)}function L(e,t){let r;const n=this;if(!(this instanceof L))return new L(e,t);for(r in this.options=t||{},b)void 0===this.options[r]?this.options[r]=b[r]:this.options[r]=t[r];m("MqttClient :: options.protocol",t.protocol),m("MqttClient :: options.protocolVersion",t.protocolVersion),m("MqttClient :: options.username",t.username),m("MqttClient :: options.keepalive",t.keepalive),m("MqttClient :: options.reconnectPeriod",t.reconnectPeriod),m("MqttClient :: options.rejectUnauthorized",t.rejectUnauthorized),m("MqttClient :: options.topicAliasMaximum",t.topicAliasMaximum),this.options.clientId="string"==typeof t.clientId?t.clientId:T(),m("MqttClient :: clientId",this.options.clientId),this.options.customHandleAcks=5===t.protocolVersion&&t.customHandleAcks?t.customHandleAcks:function(){arguments[3](0)},this.streamBuilder=e,this.messageIdProvider=void 0===this.options.messageIdProvider?new c:this.options.messageIdProvider,this.outgoingStore=t.outgoingStore||new i,this.incomingStore=t.incomingStore||new i,this.queueQoSZero=void 0===t.queueQoSZero||t.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,t.topicAliasMaximum>0&&(t.topicAliasMaximum>65535?m("MqttClient :: options.topicAliasMaximum is out of range"):this.topicAliasRecv=new o(t.topicAliasMaximum)),this.on("connect",(function(){const e=this.queue;function t(){const r=e.shift();m("deliver :: entry %o",r);let s=null;if(!r)return void n._resubscribe();s=r.packet,m("deliver :: call _sendPacket for %o",s);let i=!0;s.messageId&&0!==s.messageId&&(n.messageIdProvider.register(s.messageId)||(i=!1)),i?n._sendPacket(s,(function(e){r.cb&&r.cb(e),t()})):(m("messageId: %d has already used. The message is skipped and removed.",s.messageId),t())}m("connect :: sending queued packets"),t()})),this.on("close",(function(){m("close :: connected set to `false`"),this.connected=!1,m("close :: clearing connackTimer"),clearTimeout(this.connackTimer),m("close :: clearing ping timer"),null!==n.pingTimer&&(n.pingTimer.clear(),n.pingTimer=null),this.topicAliasRecv&&this.topicAliasRecv.clear(),m("close :: calling _setupReconnect"),this._setupReconnect()})),s.call(this),m("MqttClient :: setting up stream"),this._setupStream()}d(L,s),L.prototype._setupStream=function(){const e=this,t=new u,r=l.parser(this.options);let n=null;const s=[];function i(){if(s.length)y(o);else{const e=n;n=null,e()}}function o(){m("work :: getting next packet in queue");const t=s.shift();if(t)m("work :: packet pulled from queue"),e._handlePacket(t,i);else{m("work :: no packets in queue");const e=n;n=null,m("work :: done flag is %s",!!e),e&&e()}}function a(t){m("streamErrorHandler :: error",t.message),w.includes(t.code)?(m("streamErrorHandler :: emitting error"),e.emit("error",t)):R(t)}m("_setupStream :: calling method to clear reconnect"),this._clearReconnect(),m("_setupStream :: using streamBuilder provided to client to create stream"),this.stream=this.streamBuilder(this),r.on("packet",(function(e){m("parser :: on packet push to packets array."),s.push(e)})),t._write=function(e,t,s){n=s,m("writable stream :: parsing buffer"),r.parse(e),o()},m("_setupStream :: pipe stream to writable stream"),this.stream.pipe(t),this.stream.on("error",a),this.stream.on("close",(function(){m("(%s)stream :: on close",e.options.clientId),A(e.outgoing),m("stream: emit close to MqttClient"),e.emit("close")})),m("_setupStream: sending packet `connect`");const c=Object.create(this.options);if(c.cmd="connect",this.topicAliasRecv&&(c.properties||(c.properties={}),this.topicAliasRecv&&(c.properties.topicAliasMaximum=this.topicAliasRecv.max)),_(this,c),r.on("error",this.emit.bind(this,"error")),this.options.properties){if(!this.options.properties.authenticationMethod&&this.options.properties.authenticationData)return e.end((()=>this.emit("error",new Error("Packet has no Authentication Method")))),this;this.options.properties.authenticationMethod&&this.options.authPacket&&"object"==typeof this.options.authPacket&&_(this,g({cmd:"auth",reasonCode:0},this.options.authPacket))}this.stream.setMaxListeners(1e3),clearTimeout(this.connackTimer),this.connackTimer=setTimeout((function(){m("!!connectTimeout hit!! Calling _cleanUp with force `true`"),e._cleanUp(!0)}),this.options.connectTimeout)},L.prototype._handlePacket=function(e,t){const r=this.options;if(5===r.protocolVersion&&r.properties&&r.properties.maximumPacketSize&&r.properties.maximumPacketSize<e.length)return this.emit("error",new Error("exceeding packets size "+e.cmd)),this.end({reasonCode:149,properties:{reasonString:"Maximum packet size was exceeded"}}),this;switch(m("_handlePacket :: emitting packetreceive"),this.emit("packetreceive",e),e.cmd){case"publish":this._handlePublish(e,t);break;case"puback":case"pubrec":case"pubcomp":case"suback":case"unsuback":this._handleAck(e),t();break;case"pubrel":this._handlePubrel(e,t);break;case"connack":this._handleConnack(e),t();break;case"auth":this._handleAuth(e),t();break;case"pingresp":this._handlePingresp(e),t();break;case"disconnect":this._handleDisconnect(e),t()}},L.prototype._checkDisconnecting=function(e){return this.disconnecting&&(e&&e!==R?e(new Error("client disconnecting")):this.emit("error",new Error("client disconnecting"))),this.disconnecting},L.prototype.publish=function(e,t,r,n){m("publish :: message `%s` to topic `%s`",t,e);const s=this.options;if("function"==typeof r&&(n=r,r=null),r=g({qos:0,retain:!1,dup:!1},r),this._checkDisconnecting(n))return this;const i=this,o=function(){let o=0;if((1===r.qos||2===r.qos)&&(o=i._nextId(),null===o))return m("No messageId left"),!1;const a={cmd:"publish",topic:e,payload:t,qos:r.qos,retain:r.retain,messageId:o,dup:r.dup};switch(5===s.protocolVersion&&(a.properties=r.properties),m("publish :: qos",r.qos),r.qos){case 1:case 2:i.outgoing[a.messageId]={volatile:!1,cb:n||R},m("MqttClient:publish: packet cmd: %s",a.cmd),i._sendPacket(a,void 0,r.cbStorePut);break;default:m("MqttClient:publish: packet cmd: %s",a.cmd),i._sendPacket(a,n,r.cbStorePut)}return!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,cbStorePut:r.cbStorePut,callback:n}),this},L.prototype.subscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];const r=[];let n=t.shift();const s=n.resubscribe;let i=t.pop()||R,o=t.pop();const a=this.options.protocolVersion;delete n.resubscribe,"string"==typeof n&&(n=[n]),"function"!=typeof i&&(o=i,i=R);const l=p.validateTopics(n);if(null!==l)return v(i,new Error("Invalid topic "+l)),this;if(this._checkDisconnecting(i))return m("subscribe: discconecting true"),this;const c={qos:0};if(5===a&&(c.nl=!1,c.rap=!1,c.rh=0),o=g(c,o),Array.isArray(n)?n.forEach((function(t){if(m("subscribe: array topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<o.qos||s){const e={topic:t,qos:o.qos};5===a&&(e.nl=o.nl,e.rap=o.rap,e.rh=o.rh,e.properties=o.properties),m("subscribe: pushing topic `%s` and qos `%s` to subs list",e.topic,e.qos),r.push(e)}})):Object.keys(n).forEach((function(t){if(m("subscribe: object topic %s",t),!Object.prototype.hasOwnProperty.call(e._resubscribeTopics,t)||e._resubscribeTopics[t].qos<n[t].qos||s){const e={topic:t,qos:n[t].qos};5===a&&(e.nl=n[t].nl,e.rap=n[t].rap,e.rh=n[t].rh,e.properties=o.properties),m("subscribe: pushing `%s` to subs list",e),r.push(e)}})),!r.length)return i(null,[]),this;const u=function(){const t=e._nextId();if(null===t)return m("No messageId left"),!1;const n={cmd:"subscribe",subscriptions:r,qos:1,retain:!1,dup:!1,messageId:t};if(o.properties&&(n.properties=o.properties),e.options.resubscribe){m("subscribe :: resubscribe true");const t=[];r.forEach((function(r){if(e.options.reconnectPeriod>0){const n={qos:r.qos};5===a&&(n.nl=r.nl||!1,n.rap=r.rap||!1,n.rh=r.rh||0,n.properties=r.properties),e._resubscribeTopics[r.topic]=n,t.push(r.topic)}})),e.messageIdToTopic[n.messageId]=t}return e.outgoing[n.messageId]={volatile:!0,cb:function(e,t){if(!e){const e=t.granted;for(let t=0;t<e.length;t+=1)r[t].qos=e[t]}i(e,r)}},m("subscribe :: call _sendPacket"),e._sendPacket(n),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!u())&&this._storeProcessingQueue.push({invoke:u,callback:i}),this},L.prototype.unsubscribe=function(){const e=this,t=new Array(arguments.length);for(let e=0;e<arguments.length;e++)t[e]=arguments[e];let r=t.shift(),n=t.pop()||R,s=t.pop();"string"==typeof r&&(r=[r]),"function"!=typeof n&&(s=n,n=R);const i=p.validateTopics(r);if(null!==i)return v(n,new Error("Invalid topic "+i)),this;if(e._checkDisconnecting(n))return this;const o=function(){const t=e._nextId();if(null===t)return m("No messageId left"),!1;const i={cmd:"unsubscribe",qos:1,messageId:t};return"string"==typeof r?i.unsubscriptions=[r]:Array.isArray(r)&&(i.unsubscriptions=r),e.options.resubscribe&&i.unsubscriptions.forEach((function(t){delete e._resubscribeTopics[t]})),"object"==typeof s&&s.properties&&(i.properties=s.properties),e.outgoing[i.messageId]={volatile:!0,cb:n},m("unsubscribe: call _sendPacket"),e._sendPacket(i),!0};return(this._storeProcessing||this._storeProcessingQueue.length>0||!o())&&this._storeProcessingQueue.push({invoke:o,callback:n}),this},L.prototype.end=function(e,t,r){const n=this;function s(){m("end :: closeStores: closing incoming and outgoing stores"),n.disconnected=!0,n.incomingStore.close((function(e){n.outgoingStore.close((function(t){if(m("end :: closeStores: emitting end"),n.emit("end"),r){const n=e||t;m("end :: closeStores: invoking callback with args"),r(n)}}))})),n._deferredReconnect&&n._deferredReconnect()}function i(){m("end :: (%s) :: finish :: calling _cleanUp with force %s",n.options.clientId,e),n._cleanUp(e,(()=>{m("end :: finish :: calling process.nextTick on closeStores"),y(s.bind(n))}),t)}return m("end :: (%s)",this.options.clientId),null!=e&&"boolean"==typeof e||(r=t||R,t=e,e=!1,"object"!=typeof t&&(r=t,t=null,"function"!=typeof r&&(r=R))),"object"!=typeof t&&(r=t,t=null),m("end :: cb? %s",!!r),r=r||R,this.disconnecting?(r(),this):(this._clearReconnect(),this.disconnecting=!0,!e&&Object.keys(this.outgoing).length>0?(m("end :: (%s) :: calling finish in 10ms once outgoing is empty",n.options.clientId),this.once("outgoingEmpty",setTimeout.bind(null,i,10))):(m("end :: (%s) :: immediately calling finish",n.options.clientId),i()),this)},L.prototype.removeOutgoingMessage=function(e){const t=this.outgoing[e]?this.outgoing[e].cb:null;return delete this.outgoing[e],this.outgoingStore.del({messageId:e},(function(){t(new Error("Message removed"))})),this},L.prototype.reconnect=function(e){m("client reconnect");const t=this,r=function(){e?(t.options.incomingStore=e.incomingStore,t.options.outgoingStore=e.outgoingStore):(t.options.incomingStore=null,t.options.outgoingStore=null),t.incomingStore=t.options.incomingStore||new i,t.outgoingStore=t.options.outgoingStore||new i,t.disconnecting=!1,t.disconnected=!1,t._deferredReconnect=null,t._reconnect()};return this.disconnecting&&!this.disconnected?this._deferredReconnect=r:r(),this},L.prototype._reconnect=function(){m("_reconnect: emitting reconnect to client"),this.emit("reconnect"),this.connected?(this.end((()=>{this._setupStream()})),m("client already connected. disconnecting first.")):(m("_reconnect: calling _setupStream"),this._setupStream())},L.prototype._setupReconnect=function(){const e=this;!e.disconnecting&&!e.reconnectTimer&&e.options.reconnectPeriod>0?(this.reconnecting||(m("_setupReconnect :: emit `offline` state"),this.emit("offline"),m("_setupReconnect :: set `reconnecting` to `true`"),this.reconnecting=!0),m("_setupReconnect :: setting reconnectTimer for %d ms",e.options.reconnectPeriod),e.reconnectTimer=setInterval((function(){m("reconnectTimer :: reconnect triggered!"),e._reconnect()}),e.options.reconnectPeriod)):m("_setupReconnect :: doing nothing...")},L.prototype._clearReconnect=function(){m("_clearReconnect : clearing reconnect timer"),this.reconnectTimer&&(clearInterval(this.reconnectTimer),this.reconnectTimer=null)},L.prototype._cleanUp=function(e,t){const r=arguments[2];if(t&&(m("_cleanUp :: done callback provided for on stream close"),this.stream.on("close",t)),m("_cleanUp :: forced? %s",e),e)0===this.options.reconnectPeriod&&this.options.clean&&k(this.outgoing),m("_cleanUp :: (%s) :: destroying stream",this.options.clientId),this.stream.destroy();else{const e=g({cmd:"disconnect"},r);m("_cleanUp :: (%s) :: call _sendPacket with disconnect packet",this.options.clientId),this._sendPacket(e,v.bind(null,this.stream.end.bind(this.stream)))}this.disconnecting||(m("_cleanUp :: client not disconnecting. Clearing and resetting reconnect."),this._clearReconnect(),this._setupReconnect()),null!==this.pingTimer&&(m("_cleanUp :: clearing pingTimer"),this.pingTimer.clear(),this.pingTimer=null),t&&!this.connected&&(m("_cleanUp :: (%s) :: removing stream `done` callback `close` listener",this.options.clientId),this.stream.removeListener("close",t),t())},L.prototype._sendPacket=function(e,t,r){m("_sendPacket :: (%s) :: start",this.options.clientId),r=r||R,t=t||R;const n=S(this,e);if(n)t(n);else{if(!this.connected)return"auth"===e.cmd?(this._shiftPingInterval(),void _(this,e,t)):(m("_sendPacket :: client not connected. Storing packet offline."),void this._storePacket(e,t,r));switch(this._shiftPingInterval(),e.cmd){case"publish":break;case"pubrel":return void I(this,e,t,r);default:return void _(this,e,t)}switch(e.qos){case 2:case 1:I(this,e,t,r);break;default:_(this,e,t)}m("_sendPacket :: (%s) :: end",this.options.clientId)}},L.prototype._storePacket=function(e,t,r){m("_storePacket :: packet: %o",e),m("_storePacket :: cb? %s",!!t),r=r||R;let n=e;if("publish"===n.cmd){n=f(e);const r=C(this,n);if(r)return t&&t(r)}0===(n.qos||0)&&this.queueQoSZero||"publish"!==n.cmd?this.queue.push({packet:n,cb:t}):n.qos>0?(t=this.outgoing[n.messageId]?this.outgoing[n.messageId].cb:null,this.outgoingStore.put(n,(function(e){if(e)return t&&t(e);r()}))):t&&t(new Error("No connection to broker"))},L.prototype._setupPingTimer=function(){m("_setupPingTimer :: keepalive %d (seconds)",this.options.keepalive);const e=this;!this.pingTimer&&this.options.keepalive&&(this.pingResp=!0,this.pingTimer=h((function(){e._checkPing()}),1e3*this.options.keepalive))},L.prototype._shiftPingInterval=function(){this.pingTimer&&this.options.keepalive&&this.options.reschedulePings&&this.pingTimer.reschedule(1e3*this.options.keepalive)},L.prototype._checkPing=function(){m("_checkPing :: checking ping..."),this.pingResp?(m("_checkPing :: ping response received. Clearing flag and sending `pingreq`"),this.pingResp=!1,this._sendPacket({cmd:"pingreq"})):(m("_checkPing :: calling _cleanUp with force true"),this._cleanUp(!0))},L.prototype._handlePingresp=function(){this.pingResp=!0},L.prototype._handleConnack=function(e){m("_handleConnack");const t=this.options,r=5===t.protocolVersion?e.reasonCode:e.returnCode;if(clearTimeout(this.connackTimer),delete this.topicAliasSend,e.properties){if(e.properties.topicAliasMaximum){if(e.properties.topicAliasMaximum>65535)return void this.emit("error",new Error("topicAliasMaximum from broker is out of range"));e.properties.topicAliasMaximum>0&&(this.topicAliasSend=new a(e.properties.topicAliasMaximum))}e.properties.serverKeepAlive&&t.keepalive&&(t.keepalive=e.properties.serverKeepAlive,this._shiftPingInterval()),e.properties.maximumPacketSize&&(t.properties||(t.properties={}),t.properties.maximumPacketSize=e.properties.maximumPacketSize)}if(0===r)this.reconnecting=!1,this._onConnect(e);else if(r>0){const e=new Error("Connection refused: "+E[r]);e.code=r,this.emit("error",e)}},L.prototype._handleAuth=function(e){const t=this.options.protocolVersion,r=5===t?e.reasonCode:e.returnCode;if(5!==t){const e=new Error("Protocol error: Auth packets are only supported in MQTT 5. Your version:"+t);return e.code=r,void this.emit("error",e)}const n=this;this.handleAuth(e,(function(e,t){if(e)n.emit("error",e);else if(24===r)n.reconnecting=!1,n._sendPacket(t);else{const t=new Error("Connection refused: "+E[r]);e.code=r,n.emit("error",t)}}))},L.prototype.handleAuth=function(e,t){t()},L.prototype._handlePublish=function(e,t){m("_handlePublish: packet %o",e),t=void 0!==t?t:R;let r=e.topic.toString();const n=e.payload,s=e.qos,i=e.messageId,o=this,a=this.options,l=[0,16,128,131,135,144,145,151,153];if(5===this.options.protocolVersion){let t;if(e.properties&&(t=e.properties.topicAlias),void 0!==t)if(0===r.length){if(!(t>0&&t<=65535))return m("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));{const e=this.topicAliasRecv.getTopicByAlias(t);if(!e)return m("_handlePublish :: unregistered topic alias. alias: %d",t),void this.emit("error",new Error("Received unregistered Topic Alias"));r=e,m("_handlePublish :: topic complemented by alias. topic: %s - alias: %d",r,t)}}else{if(!this.topicAliasRecv.put(r,t))return m("_handlePublish :: topic alias out of range. alias: %d",t),void this.emit("error",new Error("Received Topic Alias is out of range"));m("_handlePublish :: registered topic: %s - alias: %d",r,t)}}switch(m("_handlePublish: qos %d",s),s){case 2:a.customHandleAcks(r,n,e,(function(r,n){return r instanceof Error||(n=r,r=null),r?o.emit("error",r):-1===l.indexOf(n)?o.emit("error",new Error("Wrong reason code for pubrec")):void(n?o._sendPacket({cmd:"pubrec",messageId:i,reasonCode:n},t):o.incomingStore.put(e,(function(){o._sendPacket({cmd:"pubrec",messageId:i},t)})))}));break;case 1:a.customHandleAcks(r,n,e,(function(s,a){return s instanceof Error||(a=s,s=null),s?o.emit("error",s):-1===l.indexOf(a)?o.emit("error",new Error("Wrong reason code for puback")):(a||o.emit("message",r,n,e),void o.handleMessage(e,(function(e){if(e)return t&&t(e);o._sendPacket({cmd:"puback",messageId:i,reasonCode:a},t)})))}));break;case 0:this.emit("message",r,n,e),this.handleMessage(e,t);break;default:m("_handlePublish: unknown QoS. Doing nothing.")}},L.prototype.handleMessage=function(e,t){t()},L.prototype._handleAck=function(e){const t=e.messageId,r=e.cmd;let n=null;const s=this.outgoing[t]?this.outgoing[t].cb:null,i=this;let o;if(s){switch(m("_handleAck :: packet type",r),r){case"pubcomp":case"puback":{const r=e.reasonCode;r&&r>0&&16!==r&&(o=new Error("Publish error: "+E[r]),o.code=r,s(o,e)),delete this.outgoing[t],this.outgoingStore.del(e,s),this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue();break}case"pubrec":{n={cmd:"pubrel",qos:2,messageId:t};const r=e.reasonCode;r&&r>0&&16!==r?(o=new Error("Publish error: "+E[r]),o.code=r,s(o,e)):this._sendPacket(n);break}case"suback":delete this.outgoing[t],this.messageIdProvider.deallocate(t);for(let r=0;r<e.granted.length;r++)if(0!=(128&e.granted[r])){const e=this.messageIdToTopic[t];e&&e.forEach((function(e){delete i._resubscribeTopics[e]}))}this._invokeStoreProcessingQueue(),s(null,e);break;case"unsuback":delete this.outgoing[t],this.messageIdProvider.deallocate(t),this._invokeStoreProcessingQueue(),s(null);break;default:i.emit("error",new Error("unrecognized packet type"))}this.disconnecting&&0===Object.keys(this.outgoing).length&&this.emit("outgoingEmpty")}else m("_handleAck :: Server sent an ack in error. Ignoring.")},L.prototype._handlePubrel=function(e,t){m("handling pubrel packet"),t=void 0!==t?t:R;const r=e.messageId,n=this,s={cmd:"pubcomp",messageId:r};n.incomingStore.get(e,(function(e,r){e?n._sendPacket(s,t):(n.emit("message",r.topic,r.payload,r),n.handleMessage(r,(function(e){if(e)return t(e);n.incomingStore.del(r,R),n._sendPacket(s,t)})))}))},L.prototype._handleDisconnect=function(e){this.emit("disconnect",e)},L.prototype._nextId=function(){return this.messageIdProvider.allocate()},L.prototype.getLastMessageId=function(){return this.messageIdProvider.getLastAllocated()},L.prototype._resubscribe=function(){m("_resubscribe");const e=Object.keys(this._resubscribeTopics);if(!this._firstConnection&&(this.options.clean||5===this.options.protocolVersion&&!this.connackPacket.sessionPresent)&&e.length>0)if(this.options.resubscribe)if(5===this.options.protocolVersion){m("_resubscribe: protocolVersion 5");for(let t=0;t<e.length;t++){const r={};r[e[t]]=this._resubscribeTopics[e[t]],r.resubscribe=!0,this.subscribe(r,{properties:r[e[t]].properties})}}else this._resubscribeTopics.resubscribe=!0,this.subscribe(this._resubscribeTopics);else this._resubscribeTopics={};this._firstConnection=!1},L.prototype._onConnect=function(e){if(this.disconnected)return void this.emit("connect",e);const t=this;function r(){let n=t.outgoingStore.createStream();function s(){t._storeProcessing=!1,t._packetIdsDuringStoreProcessing={}}function i(){n.destroy(),n=null,t._flushStoreProcessingQueue(),s()}function o(){if(!n)return;t._storeProcessing=!0;const e=n.read(1);let r;e?t._packetIdsDuringStoreProcessing[e.messageId]?o():t.disconnecting||t.reconnectTimer?n.destroy&&n.destroy():(r=t.outgoing[e.messageId]?t.outgoing[e.messageId].cb:null,t.outgoing[e.messageId]={volatile:!1,cb:function(e,t){r&&r(e,t),o()}},t._packetIdsDuringStoreProcessing[e.messageId]=!0,t.messageIdProvider.register(e.messageId)?t._sendPacket(e):m("messageId: %d has already used.",e.messageId)):n.once("readable",o)}t.once("close",i),n.on("error",(function(e){s(),t._flushStoreProcessingQueue(),t.removeListener("close",i),t.emit("error",e)})),n.on("end",(function(){let n=!0;for(const e in t._packetIdsDuringStoreProcessing)if(!t._packetIdsDuringStoreProcessing[e]){n=!1;break}n?(s(),t.removeListener("close",i),t._invokeAllStoreProcessingQueue(),t.emit("connect",e)):r()})),o()}this.connackPacket=e,this.messageIdProvider.clear(),this._setupPingTimer(),this.connected=!0,r()},L.prototype._invokeStoreProcessingQueue=function(){if(this._storeProcessingQueue.length>0){const e=this._storeProcessingQueue[0];if(e&&e.invoke())return this._storeProcessingQueue.shift(),!0}return!1},L.prototype._invokeAllStoreProcessingQueue=function(){for(;this._invokeStoreProcessingQueue(););},L.prototype._flushStoreProcessingQueue=function(){for(const e of this._storeProcessingQueue)e.cbStorePut&&e.cbStorePut(new Error("Connection closed")),e.callback&&e.callback(new Error("Connection closed"));this._storeProcessingQueue.splice(0)},t.exports=L}).call(this)}).call(this,e("_process"),void 0!==Te?Te:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./default-message-id-provider":7,"./store":8,"./topic-alias-recv":9,"./topic-alias-send":10,"./validations":11,_process:50,debug:18,events:22,inherits:24,"mqtt-packet":40,"readable-stream":69,reinterval:70,"rfdc/default":71,xtend:81}],2:[function(e,t,r){const{Buffer:n}=e("buffer"),s=e("readable-stream").Transform,i=e("duplexify");let o,a,l,c=!1;function u(){const e=new s;return e._write=function(e,t,r){o.sendSocketMessage({data:e.buffer,success:function(){r()},fail:function(){r(new Error)}})},e._flush=function(e){o.closeSocket({success:function(){e()}})},e}function d(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}function h(e,t){const r="alis"===e.protocol?"wss":"ws";let n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}function f(){c||(c=!0,o.onSocketOpen((function(){l.setReadable(a),l.setWritable(a),l.emit("connect")})),o.onSocketMessage((function(e){if("string"==typeof e.data){const t=n.from(e.data,"base64");a.push(t)}else{const t=new FileReader;t.addEventListener("load",(function(){let e=t.result;e=e instanceof ArrayBuffer?n.from(e):n.from(e,"utf8"),a.push(e)})),t.readAsArrayBuffer(e.data)}})),o.onSocketClose((function(){l.end(),l.destroy()})),o.onSocketError((function(e){l.destroy(e)})))}function p(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";d(t);const n=h(t,e);return o=t.my,o.connectSocket({url:n,protocols:r}),a=u(),l=i.obj(),f(),l}t.exports=p},{buffer:17,duplexify:20,"readable-stream":69}],3:[function(e,t,r){const n=e("net"),s=e("debug")("mqttjs:tcp");function i(e,t){t.port=t.port||1883,t.hostname=t.hostname||t.host||"localhost";const r=t.port,i=t.hostname;return s("port %d and host %s",r,i),n.createConnection(r,i)}t.exports=i},{debug:18,net:16}],4:[function(e,t,r){const n=e("tls"),s=e("net"),i=e("debug")("mqttjs:tls");function o(e,t){t.port=t.port||8883,t.host=t.hostname||t.host||"localhost",0===s.isIP(t.host)&&(t.servername=t.host),t.rejectUnauthorized=!1!==t.rejectUnauthorized,delete t.path,i("port %d host %s rejectUnauthorized %b",t.port,t.host,t.rejectUnauthorized);const r=n.connect(t);function o(n){t.rejectUnauthorized&&e.emit("error",n),r.end()}return r.on("secureConnect",(function(){t.rejectUnauthorized&&!r.authorized?r.emit("error",new Error("TLS not authorized")):r.removeListener("error",o)})),r.on("error",o),r}t.exports=o},{debug:18,net:16,tls:16}],5:[function(e,t,r){(function(r){(function(){const{Buffer:n}=e("buffer"),s=e("ws"),i=e("debug")("mqttjs:ws"),o=e("duplexify"),a=e("readable-stream").Transform,l=["rejectUnauthorized","ca","cert","key","pfx","passphrase"],c=void 0!==r&&"browser"===r.title||"function"==typeof __webpack_require__;function u(e,t){let r=e.protocol+"://"+e.hostname+":"+e.port+e.path;return"function"==typeof e.transformWsUrl&&(r=e.transformWsUrl(r,e,t)),r}function d(e){const t=e;return e.hostname||(t.hostname="localhost"),e.port||("wss"===e.protocol?t.port=443:t.port=80),e.path||(t.path="/"),e.wsOptions||(t.wsOptions={}),c||"wss"!==e.protocol||l.forEach((function(r){Object.prototype.hasOwnProperty.call(e,r)&&!Object.prototype.hasOwnProperty.call(e.wsOptions,r)&&(t.wsOptions[r]=e[r])})),t}function h(e){const t=d(e);if(t.hostname||(t.hostname=t.host),!t.hostname){if("undefined"==typeof document)throw new Error("Could not determine host. Specify host manually.");const e=new URL(document.URL);t.hostname=e.hostname,t.port||(t.port=e.port)}return void 0===t.objectMode&&(t.objectMode=!(!0===t.binary||void 0===t.binary)),t}function f(e,t,r){i("createWebSocket"),i("protocol: "+r.protocolId+" "+r.protocolVersion);const n="MQIsdp"===r.protocolId&&3===r.protocolVersion?"mqttv3.1":"mqtt";return i("creating new Websocket for url: "+t+" and protocol: "+n),new s(t,[n],r.wsOptions)}function p(e,t){const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt",n=u(t,e),s=new WebSocket(n,[r]);return s.binaryType="arraybuffer",s}function g(e,t){i("streamBuilder");const r=d(t),n=u(r,e),o=f(e,n,r),a=s.createWebSocketStream(o,r.wsOptions);return a.url=n,o.on("close",(()=>{a.destroy()})),a}function m(e,t){let r;i("browserStreamBuilder");const s=h(t).browserBufferSize||524288,l=t.browserBufferTimeout||1e3,c=!t.objectMode,u=p(e,t),d=g(t,E,T);t.objectMode||(d._writev=w),d.on("close",(()=>{u.close()}));const f=void 0!==u.addEventListener;function g(e,t,r){const n=new a({objectModeMode:e.objectMode});return n._write=t,n._flush=r,n}function m(){r.setReadable(d),r.setWritable(d),r.emit("connect")}function y(){r.end(),r.destroy()}function v(e){r.destroy(e)}function b(e){let t=e.data;t=t instanceof ArrayBuffer?n.from(t):n.from(t,"utf8"),d.push(t)}function w(e,t){const r=new Array(e.length);for(let t=0;t<e.length;t++)"string"==typeof e[t].chunk?r[t]=n.from(e[t],"utf8"):r[t]=e[t].chunk;this._write(n.concat(r),"binary",t)}function E(e,t,r){u.bufferedAmount>s&&setTimeout(E,l,e,t,r),c&&"string"==typeof e&&(e=n.from(e,"utf8"));try{u.send(e)}catch(e){return r(e)}r()}function T(e){u.close(),e()}return u.readyState===u.OPEN?r=d:(r=r=o(void 0,void 0,t),t.objectMode||(r._writev=w),f?u.addEventListener("open",m):u.onopen=m),r.socket=u,f?(u.addEventListener("close",y),u.addEventListener("error",v),u.addEventListener("message",b)):(u.onclose=y,u.onerror=v,u.onmessage=b),r}t.exports=c?m:g}).call(this)}).call(this,e("_process"))},{_process:50,buffer:17,debug:18,duplexify:20,"readable-stream":69,ws:80}],6:[function(e,t,r){const{Buffer:n}=e("buffer"),s=e("readable-stream").Transform,i=e("duplexify");let o,a,l;function c(){const e=new s;return e._write=function(e,t,r){o.send({data:e.buffer,success:function(){r()},fail:function(e){r(new Error(e))}})},e._flush=function(e){o.close({success:function(){e()}})},e}function u(e){e.hostname||(e.hostname="localhost"),e.path||(e.path="/"),e.wsOptions||(e.wsOptions={})}function d(e,t){const r="wxs"===e.protocol?"wss":"ws";let n=r+"://"+e.hostname+e.path;return e.port&&80!==e.port&&443!==e.port&&(n=r+"://"+e.hostname+":"+e.port+e.path),"function"==typeof e.transformWsUrl&&(n=e.transformWsUrl(n,e,t)),n}function h(){o.onOpen((function(){l.setReadable(a),l.setWritable(a),l.emit("connect")})),o.onMessage((function(e){let t=e.data;t=t instanceof ArrayBuffer?n.from(t):n.from(t,"utf8"),a.push(t)})),o.onClose((function(){l.end(),l.destroy()})),o.onError((function(e){l.destroy(new Error(e.errMsg))}))}function f(e,t){if(t.hostname=t.hostname||t.host,!t.hostname)throw new Error("Could not determine host. Specify host manually.");const r="MQIsdp"===t.protocolId&&3===t.protocolVersion?"mqttv3.1":"mqtt";u(t);const n=d(t,e);o=wx.connectSocket({url:n,protocols:[r]}),a=c(),l=i.obj(),l._destroy=function(e,t){o.close({success:function(){t&&t(e)}})};const s=l.destroy;return l.destroy=function(){l.destroy=s;const e=this;setTimeout((function(){o.close({fail:function(){e._destroy(new Error)}})}),0)}.bind(l),h(),l}t.exports=f},{buffer:17,duplexify:20,"readable-stream":69}],7:[function(e,t,r){function n(){if(!(this instanceof n))return new n;this.nextId=Math.max(1,Math.floor(65535*Math.random()))}n.prototype.allocate=function(){const e=this.nextId++;return 65536===this.nextId&&(this.nextId=1),e},n.prototype.getLastAllocated=function(){return 1===this.nextId?65535:this.nextId-1},n.prototype.register=function(e){return!0},n.prototype.deallocate=function(e){},n.prototype.clear=function(){},t.exports=n},{}],8:[function(e,t,r){const n=e("xtend"),s=e("readable-stream").Readable,i={objectMode:!0},o={clean:!0};function a(e){if(!(this instanceof a))return new a(e);this.options=e||{},this.options=n(o,e),this._inflights=new Map}a.prototype.put=function(e,t){return this._inflights.set(e.messageId,e),t&&t(),this},a.prototype.createStream=function(){const e=new s(i),t=[];let r=!1,n=0;return this._inflights.forEach((function(e,r){t.push(e)})),e._read=function(){!r&&n<t.length?this.push(t[n++]):this.push(null)},e.destroy=function(){if(r)return;const e=this;r=!0,setTimeout((function(){e.emit("close")}),0)},e},a.prototype.del=function(e,t){return(e=this._inflights.get(e.messageId))?(this._inflights.delete(e.messageId),t(null,e)):t&&t(new Error("missing packet")),this},a.prototype.get=function(e,t){return(e=this._inflights.get(e.messageId))?t(null,e):t&&t(new Error("missing packet")),this},a.prototype.close=function(e){this.options.clean&&(this._inflights=null),e&&e()},t.exports=a},{"readable-stream":69,xtend:81}],9:[function(e,t,r){function n(e){if(!(this instanceof n))return new n(e);this.aliasToTopic={},this.max=e}n.prototype.put=function(e,t){return!(0===t||t>this.max||(this.aliasToTopic[t]=e,this.length=Object.keys(this.aliasToTopic).length,0))},n.prototype.getTopicByAlias=function(e){return this.aliasToTopic[e]},n.prototype.clear=function(){this.aliasToTopic={}},t.exports=n},{}],10:[function(e,t,r){const n=e("lru-cache"),s=e("number-allocator").NumberAllocator;function i(e){if(!(this instanceof i))return new i(e);e>0&&(this.aliasToTopic=new n({max:e}),this.topicToAlias={},this.numberAllocator=new s(1,e),this.max=e,this.length=0)}i.prototype.put=function(e,t){if(0===t||t>this.max)return!1;const r=this.aliasToTopic.get(t);return r&&delete this.topicToAlias[r],this.aliasToTopic.set(t,e),this.topicToAlias[e]=t,this.numberAllocator.use(t),this.length=this.aliasToTopic.length,!0},i.prototype.getTopicByAlias=function(e){return this.aliasToTopic.get(e)},i.prototype.getAliasByTopic=function(e){const t=this.topicToAlias[e];return void 0!==t&&this.aliasToTopic.get(t),t},i.prototype.clear=function(){this.aliasToTopic.reset(),this.topicToAlias={},this.numberAllocator.clear(),this.length=0},i.prototype.getLruAlias=function(){const e=this.numberAllocator.firstVacant();return e||this.aliasToTopic.keys()[this.aliasToTopic.length-1]},t.exports=i},{"lru-cache":37,"number-allocator":46}],11:[function(e,t,r){function n(e){const t=e.split("/");for(let e=0;e<t.length;e++)if("+"!==t[e]){if("#"===t[e])return e===t.length-1;if(-1!==t[e].indexOf("+")||-1!==t[e].indexOf("#"))return!1}return!0}function s(e){if(0===e.length)return"empty_topic_list";for(let t=0;t<e.length;t++)if(!n(e[t]))return e[t];return null}t.exports={validateTopics:s}},{}],12:[function(e,t,r){(function(r){(function(){const n=e("../client"),s=e("../store"),i=e("url"),o=e("xtend"),a=e("debug")("mqttjs"),l={};function c(e){let t;e.auth&&(t=e.auth.match(/^(.+):(.+)$/),t?(e.username=t[1],e.password=t[2]):e.username=e.auth)}function u(e,t){if(a("connecting to an MQTT broker..."),"object"!=typeof e||t||(t=e,e=null),t=t||{},e){const r=i.parse(e,!0);if(null!=r.port&&(r.port=Number(r.port)),null===(t=o(r,t)).protocol)throw new Error("Missing protocol");t.protocol=t.protocol.replace(/:$/,"")}if(c(t),t.query&&"string"==typeof t.query.clientId&&(t.clientId=t.query.clientId),t.cert&&t.key){if(!t.protocol)throw new Error("Missing secure protocol key");if(-1===["mqtts","wss","wxs","alis"].indexOf(t.protocol))switch(t.protocol){case"mqtt":t.protocol="mqtts";break;case"ws":t.protocol="wss";break;case"wx":t.protocol="wxs";break;case"ali":t.protocol="alis";break;default:throw new Error('Unknown protocol for secure connection: "'+t.protocol+'"!')}}if(!l[t.protocol]){const e=-1!==["mqtts","wss"].indexOf(t.protocol);t.protocol=["mqtt","mqtts","ws","wss","wx","wxs","ali","alis"].filter((function(t,r){return(!e||r%2!=0)&&"function"==typeof l[t]}))[0]}if(!1===t.clean&&!t.clientId)throw new Error("Missing clientId for unclean clients");function r(e){return t.servers&&(e._reconnectCount&&e._reconnectCount!==t.servers.length||(e._reconnectCount=0),t.host=t.servers[e._reconnectCount].host,t.port=t.servers[e._reconnectCount].port,t.protocol=t.servers[e._reconnectCount].protocol?t.servers[e._reconnectCount].protocol:t.defaultProtocol,t.hostname=t.host,e._reconnectCount++),a("calling streambuilder for",t.protocol),l[t.protocol](e,t)}t.protocol&&(t.defaultProtocol=t.protocol);const s=new n(r,t);return s.on("error",(function(){})),s}void 0!==r&&"browser"!==r.title||"function"!=typeof __webpack_require__?(l.mqtt=e("./tcp"),l.tcp=e("./tcp"),l.ssl=e("./tls"),l.tls=e("./tls"),l.mqtts=e("./tls")):(l.wx=e("./wx"),l.wxs=e("./wx"),l.ali=e("./ali"),l.alis=e("./ali")),l.ws=e("./ws"),l.wss=e("./ws"),t.exports=u,t.exports.connect=u,t.exports.MqttClient=n,t.exports.Store=s}).call(this)}).call(this,e("_process"))},{"../client":1,"../store":8,"./ali":2,"./tcp":3,"./tls":4,"./ws":5,"./wx":6,_process:50,debug:18,url:76,xtend:81}],13:[function(e,t,r){r.byteLength=u,r.toByteArray=h,r.fromByteArray=g;for(var n=[],s=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=o.length;a<l;++a)n[a]=o[a],s[o.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n}function d(e,t,r){return 3*(t+r)/4-r}function h(e){var t,r,n=c(e),o=n[0],a=n[1],l=new i(d(e,o,a)),u=0,h=a>0?o-4:o;for(r=0;r<h;r+=4)t=s[e.charCodeAt(r)]<<18|s[e.charCodeAt(r+1)]<<12|s[e.charCodeAt(r+2)]<<6|s[e.charCodeAt(r+3)],l[u++]=t>>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===a&&(t=s[e.charCodeAt(r)]<<2|s[e.charCodeAt(r+1)]>>4,l[u++]=255&t),1===a&&(t=s[e.charCodeAt(r)]<<10|s[e.charCodeAt(r+1)]<<4|s[e.charCodeAt(r+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l}function f(e){return n[e>>18&63]+n[e>>12&63]+n[e>>6&63]+n[63&e]}function p(e,t,r){for(var n,s=[],i=t;i<r;i+=3)n=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),s.push(f(n));return s.join("")}function g(e){for(var t,r=e.length,s=r%3,i=[],o=16383,a=0,l=r-s;a<l;a+=o)i.push(p(e,a,a+o>l?l:a+o));return 1===s?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===s&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"=")),i.join("")}s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},{}],14:[function(e,t,r){const{Buffer:n}=e("buffer"),s=Symbol.for("BufferList");function i(e){if(!(this instanceof i))return new i(e);i._init.call(this,e)}i._init=function(e){Object.defineProperty(this,s,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},i.prototype._new=function(e){return new i(e)},i.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let r=0;r<this._bufs.length;r++){const n=t+this._bufs[r].length;if(e<n||r===this._bufs.length-1)return[r,e-t];t=n}},i.prototype._reverseOffset=function(e){const t=e[0];let r=e[1];for(let e=0;e<t;e++)r+=this._bufs[e].length;return r},i.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},i.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},i.prototype.copy=function(e,t,r,s){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof s||s>this.length)&&(s=this.length),r>=this.length)return e||n.alloc(0);if(s<=0)return e||n.alloc(0);const i=!!e,o=this._offset(r),a=s-r;let l=a,c=i&&t||0,u=o[1];if(0===r&&s===this.length){if(!i)return 1===this._bufs.length?this._bufs[0]:n.concat(this._bufs,this.length);for(let t=0;t<this._bufs.length;t++)this._bufs[t].copy(e,c),c+=this._bufs[t].length;return e}if(l<=this._bufs[o[0]].length-u)return i?this._bufs[o[0]].copy(e,t,u,u+l):this._bufs[o[0]].slice(u,u+l);i||(e=n.allocUnsafe(a));for(let t=o[0];t<this._bufs.length;t++){const r=this._bufs[t].length-u;if(!(l>r)){this._bufs[t].copy(e,c,u,u+l),c+=r;break}this._bufs[t].copy(e,c,u),c+=r,l-=r,u&&(u=0)}return e.length>c?e.slice(0,c):e},i.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const r=this._offset(e),n=this._offset(t),s=this._bufs.slice(r[0],n[0]+1);return 0===n[1]?s.pop():s[s.length-1]=s[s.length-1].slice(0,n[1]),0!==r[1]&&(s[0]=s[0].slice(r[1])),this._new(s)},i.prototype.toString=function(e,t,r){return this.slice(t,r).toString(e)},i.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},i.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},i.prototype.append=function(e){if(null==e)return this;if(e.buffer)this._appendBuffer(n.from(e.buffer,e.byteOffset,e.byteLength));else if(Array.isArray(e))for(let t=0;t<e.length;t++)this.append(e[t]);else if(this._isBufferList(e))for(let t=0;t<e._bufs.length;t++)this.append(e._bufs[t]);else"number"==typeof e&&(e=e.toString()),this._appendBuffer(n.from(e));return this},i.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},i.prototype.indexOf=function(e,t,r){if(void 0===r&&"string"==typeof t&&(r=t,t=void 0),"function"==typeof e||Array.isArray(e))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof e?e=n.from([e]):"string"==typeof e?e=n.from(e,r):this._isBufferList(e)?e=e.slice():Array.isArray(e.buffer)?e=n.from(e.buffer,e.byteOffset,e.byteLength):n.isBuffer(e)||(e=n.from(e)),t=Number(t||0),isNaN(t)&&(t=0),t<0&&(t=this.length+t),t<0&&(t=0),0===e.length)return t>this.length?this.length:t;const s=this._offset(t);let i=s[0],o=s[1];for(;i<this._bufs.length;i++){const t=this._bufs[i];for(;o<t.length;)if(t.length-o>=e.length){const r=t.indexOf(e,o);if(-1!==r)return this._reverseOffset([i,r]);o=t.length-e.length+1}else{const t=this._reverseOffset([i,o]);if(this._match(t,e))return t;o++}o=0}return-1},i.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let r=0;r<t.length;r++)if(this.get(e+r)!==t[r])return!1;return!0},function(){const e={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(const t in e)!function(t){null===e[t]?i.prototype[t]=function(e,r){return this.slice(e,e+r)[t](0,r)}:i.prototype[t]=function(r=0){return this.slice(r,r+e[t])[t](0)}}(t)}(),i.prototype._isBufferList=function(e){return e instanceof i||i.isBufferList(e)},i.isBufferList=function(e){return null!=e&&e[s]},t.exports=i},{buffer:17}],15:[function(e,t,r){const n=e("readable-stream").Duplex,s=e("inherits"),i=e("./BufferList");function o(e){if(!(this instanceof o))return new o(e);if("function"==typeof e){this._callback=e;const t=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",(function(e){e.on("error",t)})),this.on("unpipe",(function(e){e.removeListener("error",t)})),e=null}i._init.call(this,e),n.call(this)}s(o,n),Object.assign(o.prototype,i.prototype),o.prototype._new=function(e){return new o(e)},o.prototype._write=function(e,t,r){this._appendBuffer(e),"function"==typeof r&&r()},o.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},o.prototype.end=function(e){n.prototype.end.call(this,e),this._callback&&(this._callback(null,this.slice()),this._callback=null)},o.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},o.prototype._isBufferList=function(e){return e instanceof o||e instanceof i||o.isBufferList(e)},o.isBufferList=i.isBufferList,t.exports=o,t.exports.BufferListStream=o,t.exports.BufferList=i},{"./BufferList":14,inherits:24,"readable-stream":69}],16:[function(e,t,r){},{}],17:[function(e,t,r){(function(t){(function(){var t=e("base64-js"),n=e("ieee754");r.Buffer=a,r.SlowBuffer=y,r.INSPECT_MAX_BYTES=50;var s=2147483647;function i(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(e){return!1}}function o(e){if(e>s)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=a.prototype,t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return h(e,t);if(ArrayBuffer.isView(e))return f(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(X(e,ArrayBuffer)||e&&X(e.buffer,ArrayBuffer))return p(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return a.from(n,t,r);var s=g(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e,t,r){return c(e),e<=0?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)}function d(e){return c(e),o(e<0?0:0|m(e))}function h(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|v(e,t),n=o(r),s=n.write(e,t);return s!==r&&(n=n.slice(0,s)),n}function f(e){for(var t=e.length<0?0:0|m(e.length),r=o(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}function p(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');var n;return(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r)).__proto__=a.prototype,n}function g(e){if(a.isBuffer(e)){var t=0|m(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||Q(e.length)?o(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}function m(e){if(e>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|e}function y(e){return+e!=e&&(e=0),a.alloc(+e)}function v(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||X(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var s=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(s)return n?-1:K(e).length;t=(""+t).toLowerCase(),s=!0}}function b(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,r);case"utf8":case"utf-8":return L(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return P(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function w(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function E(e,t,r,n,s){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Q(r=+r)&&(r=s?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(s)return-1;r=e.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof t&&(t=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:T(e,t,r,n,s);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):T(e,[t],r,n,s);throw new TypeError("val must be string, number or Buffer")}function T(e,t,r,n,s){var i,o=1,a=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(s){var u=-1;for(i=r;i<a;i++)if(c(e,i)===c(t,-1===u?0:i-u)){if(-1===u&&(u=i),i-u+1===l)return u*o}else-1!==u&&(i-=i-u),u=-1}else for(r+l>a&&(r=a-l),i=r;i>=0;i--){for(var d=!0,h=0;h<l;h++)if(c(e,i+h)!==c(t,h)){d=!1;break}if(d)return i}return-1}function S(e,t,r,n){r=Number(r)||0;var s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;var i=t.length;n>i/2&&(n=i/2);for(var o=0;o<n;++o){var a=parseInt(t.substr(2*o,2),16);if(Q(a))return o;e[r+o]=a}return o}function C(e,t,r,n){return Y(K(t,e.length-r),e,r,n)}function _(e,t,r,n){return Y(V(t),e,r,n)}function k(e,t,r,n){return _(e,t,r,n)}function A(e,t,r,n){return Y(W(t),e,r,n)}function I(e,t,r,n){return Y(z(t,e.length-r),e,r,n)}function R(e,r,n){return 0===r&&n===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(r,n))}function L(e,t,r){r=Math.min(e.length,r);for(var n=[],s=t;s<r;){var i,o,a,l,c=e[s],u=null,d=c>239?4:c>223?3:c>191?2:1;if(s+d<=r)switch(d){case 1:c<128&&(u=c);break;case 2:128==(192&(i=e[s+1]))&&(l=(31&c)<<6|63&i)>127&&(u=l);break;case 3:i=e[s+1],o=e[s+2],128==(192&i)&&128==(192&o)&&(l=(15&c)<<12|(63&i)<<6|63&o)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:i=e[s+1],o=e[s+2],a=e[s+3],128==(192&i)&&128==(192&o)&&128==(192&a)&&(l=(15&c)<<18|(63&i)<<12|(63&o)<<6|63&a)>65535&&l<1114112&&(u=l)}null===u?(u=65533,d=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),s+=d}return x(n)}r.kMaxLength=s,a.TYPED_ARRAY_SUPPORT=i(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),a.poolSize=8192,a.from=function(e,t,r){return l(e,t,r)},a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,a.alloc=function(e,t,r){return u(e,t,r)},a.allocUnsafe=function(e){return d(e)},a.allocUnsafeSlow=function(e){return d(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(X(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),X(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,s=0,i=Math.min(r,n);s<i;++s)if(e[s]!==t[s]){r=e[s],n=t[s];break}return r<n?-1:n<r?1:0},a.isEncoding=function(e){switch(String(e).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}},a.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=a.allocUnsafe(t),s=0;for(r=0;r<e.length;++r){var i=e[r];if(X(i,Uint8Array)&&(i=a.from(i)),!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,s),s+=i.length}return n},a.byteLength=v,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)w(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)w(this,t,t+3),w(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)w(this,t,t+7),w(this,t+1,t+6),w(this,t+2,t+5),w(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?L(this,0,e):b.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},a.prototype.compare=function(e,t,r,n,s){if(X(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),t<0||r>e.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&t>=r)return 0;if(n>=s)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(s>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),l=Math.min(i,o),c=this.slice(n,s),u=e.slice(t,r),d=0;d<l;++d)if(c[d]!==u[d]){i=c[d],o=u[d];break}return i<o?-1:o<i?1:0},a.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return E(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return E(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var s=this.length-t;if((void 0===r||r>s)&&(r=s),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return S(this,e,t,r);case"utf8":case"utf-8":return C(this,e,t,r);case"ascii":return _(this,e,t,r);case"latin1":case"binary":return k(this,e,t,r);case"base64":return A(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var D=4096;function x(e){var t=e.length;if(t<=D)return String.fromCharCode.apply(String,e);for(var r="",n=0;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=D));return r}function O(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(127&e[s]);return n}function P(e,t,r){var n="";r=Math.min(e.length,r);for(var s=t;s<r;++s)n+=String.fromCharCode(e[s]);return n}function M(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var s="",i=t;i<r;++i)s+=H(e[i]);return s}function F(e,t,r){for(var n=e.slice(t,r),s="",i=0;i<n.length;i+=2)s+=String.fromCharCode(n[i]+256*n[i+1]);return s}function N(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function U(e,t,r,n,s,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>s||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function B(e,t,r,n,s,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function j(e,t,r,s,i){return t=+t,r>>>=0,i||B(e,t,r,4),n.write(e,t,r,s,23,4),r+4}function $(e,t,r,s,i){return t=+t,r>>>=0,i||B(e,t,r,8),n.write(e,t,r,s,52,8),r+8}a.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return n.__proto__=a.prototype,n},a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return n},a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=this[e+--t],s=1;t>0&&(s*=256);)n+=this[e+--t]*s;return n},a.prototype.readUInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||N(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=this[e],s=1,i=0;++i<t&&(s*=256);)n+=this[e+i]*s;return n>=(s*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||N(e,t,this.length);for(var n=t,s=1,i=this[e+--n];n>0&&(s*=256);)i+=this[e+--n]*s;return i>=(s*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readInt8=function(e,t){return e>>>=0,t||N(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||N(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||N(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||N(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||N(e,4,this.length),n.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||N(e,4,this.length),n.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||N(e,8,this.length),n.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||N(e,8,this.length),n.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||U(this,e,t,r,Math.pow(2,8*r)-1,0);var s=1,i=0;for(this[t]=255&e;++i<r&&(s*=256);)this[t+i]=e/s&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||U(this,e,t,r,Math.pow(2,8*r)-1,0);var s=r-1,i=1;for(this[t+s]=255&e;--s>=0&&(i*=256);)this[t+s]=e/i&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var s=Math.pow(2,8*r-1);U(this,e,t,r,s-1,-s)}var i=0,o=1,a=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var s=Math.pow(2,8*r-1);U(this,e,t,r,s-1,-s)}var i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return j(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return j(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return $(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return $(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var s=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var i=s-1;i>=0;--i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return s},a.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){var s=e.charCodeAt(0);("utf8"===n&&s<128||"latin1"===n)&&(e=s)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var o=a.isBuffer(e)?e:a.from(e,n),l=o.length;if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=o[i%l]}return this};var q=/[^+/0-9A-Za-z-_]/g;function G(e){if((e=(e=e.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}function H(e){return e<16?"0"+e.toString(16):e.toString(16)}function K(e,t){var r;t=t||1/0;for(var n=e.length,s=null,i=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),s=r;continue}r=65536+(s-55296<<10|r-56320)}else s&&(t-=3)>-1&&i.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function V(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function z(e,t){for(var r,n,s,i=[],o=0;o<e.length&&!((t-=2)<0);++o)n=(r=e.charCodeAt(o))>>8,s=r%256,i.push(s),i.push(n);return i}function W(e){return t.toByteArray(G(e))}function Y(e,t,r,n){for(var s=0;s<n&&!(s+r>=t.length||s>=e.length);++s)t[s+r]=e[s];return s}function X(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Q(e){return e!=e}}).call(this)}).call(this,e("buffer").Buffer)},{"base64-js":13,buffer:17,ieee754:23}],18:[function(e,t,r){(function(n){(function(){function s(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(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;const r="color: "+this.color;e.splice(1,0,r,"color: inherit");let n=0,s=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(n++,"%c"===e&&(s=n))})),e.splice(s,0,r)}function o(e){try{e?r.storage.setItem("debug",e):r.storage.removeItem("debug")}catch(e){}}function a(){let e;try{e=r.storage.getItem("debug")}catch(e){}return!e&&void 0!==n&&"env"in n&&(e=n.env.DEBUG),e}function l(){try{return localStorage}catch(e){}}r.formatArgs=i,r.save=o,r.load=a,r.useColors=s,r.storage=l(),r.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`."))}})(),r.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"],r.log=console.debug||console.log||(()=>{}),t.exports=e("./common")(r);const{formatters:c}=t.exports;c.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this)}).call(this,e("_process"))},{"./common":19,_process:50}],19:[function(e,t,r){function n(t){function r(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return n.colors[Math.abs(t)%n.colors.length]}function n(e){let t,r,i,o=null;function a(...e){if(!a.enabled)return;const r=a,s=Number(new Date),i=s-(t||s);r.diff=i,r.prev=t,r.curr=s,t=s,e[0]=n.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((t,s)=>{if("%%"===t)return"%";o++;const i=n.formatters[s];if("function"==typeof i){const n=e[o];t=i.call(r,n),e.splice(o,1),o--}return t})),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return a.namespace=e,a.useColors=n.useColors(),a.color=n.selectColor(e),a.extend=s,a.destroy=n.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(r!==n.namespaces&&(r=n.namespaces,i=n.enabled(e)),i),set:e=>{o=e}}),"function"==typeof n.init&&n.init(a),a}function s(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function i(e){let t;n.save(e),n.namespaces=e,n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),s=r.length;for(t=0;t<s;t++)r[t]&&("-"===(e=r[t].replace(/\*/g,".*?"))[0]?n.skips.push(new RegExp("^"+e.substr(1)+"$")):n.names.push(new RegExp("^"+e+"$")))}function o(){const e=[...n.names.map(l),...n.skips.map(l).map((e=>"-"+e))].join(",");return n.enable(""),e}function a(e){if("*"===e[e.length-1])return!0;let t,r;for(t=0,r=n.skips.length;t<r;t++)if(n.skips[t].test(e))return!1;for(t=0,r=n.names.length;t<r;t++)if(n.names[t].test(e))return!0;return!1}function l(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}function c(e){return e instanceof Error?e.stack||e.message:e}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 n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=a,n.humanize=e("ms"),n.destroy=u,Object.keys(t).forEach((e=>{n[e]=t[e]})),n.names=[],n.skips=[],n.formatters={},n.selectColor=r,n.enable(n.load()),n}t.exports=n},{ms:45}],20:[function(e,t,r){(function(r,n){(function(){var s=e("readable-stream"),i=e("end-of-stream"),o=e("inherits"),a=e("stream-shift"),l=n.from&&n.from!==Uint8Array.from?n.from([0]):new n([0]),c=function(e,t){e._corked?e.once("uncork",t):t()},u=function(e,t){e._autoDestroy&&e.destroy(t)},d=function(e,t){return function(r){r?u(e,"premature close"===r.message?null:r):t&&!e._ended&&e.end()}},h=function(e,t){return e?e._writableState&&e._writableState.finished?t():e._writableState?e.end(t):(e.end(),void t()):t()},f=function(){},p=function(e){return new s.Readable({objectMode:!0,highWaterMark:16}).wrap(e)},g=function(e,t,r){if(!(this instanceof g))return new g(e,t,r);s.Duplex.call(this,r),this._writable=null,this._readable=null,this._readable2=null,this._autoDestroy=!r||!1!==r.autoDestroy,this._forwardDestroy=!r||!1!==r.destroy,this._forwardEnd=!r||!1!==r.end,this._corked=1,this._ondrain=null,this._drained=!1,this._forwarding=!1,this._unwrite=null,this._unread=null,this._ended=!1,this.destroyed=!1,e&&this.setWritable(e),t&&this.setReadable(t)};o(g,s.Duplex),g.obj=function(e,t,r){return r||(r={}),r.objectMode=!0,r.highWaterMark=16,new g(e,t,r)},g.prototype.cork=function(){1==++this._corked&&this.emit("cork")},g.prototype.uncork=function(){this._corked&&0==--this._corked&&this.emit("uncork")},g.prototype.setWritable=function(e){if(this._unwrite&&this._unwrite(),this.destroyed)e&&e.destroy&&e.destroy();else if(null!==e&&!1!==e){var t=this,n=i(e,{writable:!0,readable:!1},d(this,this._forwardEnd)),s=function(){var e=t._ondrain;t._ondrain=null,e&&e()},o=function(){t._writable.removeListener("drain",s),n()};this._unwrite&&r.nextTick(s),this._writable=e,this._writable.on("drain",s),this._unwrite=o,this.uncork()}else this.end()},g.prototype.setReadable=function(e){if(this._unread&&this._unread(),this.destroyed)e&&e.destroy&&e.destroy();else{if(null===e||!1===e)return this.push(null),void this.resume();var t=this,r=i(e,{writable:!1,readable:!0},d(this)),n=function(){t._forward()},s=function(){t.push(null)},o=function(){t._readable2.removeListener("readable",n),t._readable2.removeListener("end",s),r()};this._drained=!0,this._readable=e,this._readable2=e._readableState?e:p(e),this._readable2.on("readable",n),this._readable2.on("end",s),this._unread=o,this._forward()}},g.prototype._read=function(){this._drained=!0,this._forward()},g.prototype._forward=function(){if(!this._forwarding&&this._readable2&&this._drained){var e;for(this._forwarding=!0;this._drained&&null!==(e=a(this._readable2));)this.destroyed||(this._drained=this.push(e));this._forwarding=!1}},g.prototype.destroy=function(e,t){if(t||(t=f),this.destroyed)return t(null);this.destroyed=!0;var n=this;r.nextTick((function(){n._destroy(e),t(null)}))},g.prototype._destroy=function(e){if(e){var t=this._ondrain;this._ondrain=null,t?t(e):this.emit("error",e)}this._forwardDestroy&&(this._readable&&this._readable.destroy&&this._readable.destroy(),this._writable&&this._writable.destroy&&this._writable.destroy()),this.emit("close")},g.prototype._write=function(e,t,r){if(!this.destroyed)return this._corked?c(this,this._write.bind(this,e,t,r)):e===l?this._finish(r):this._writable?void(!1===this._writable.write(e)?this._ondrain=r:this.destroyed||r()):r()},g.prototype._finish=function(e){var t=this;this.emit("preend"),c(this,(function(){h(t._forwardEnd&&t._writable,(function(){!1===t._writableState.prefinished&&(t._writableState.prefinished=!0),t.emit("prefinish"),c(t,e)}))}))},g.prototype.end=function(e,t,r){return"function"==typeof e?this.end(null,null,e):"function"==typeof t?this.end(e,null,t):(this._ended=!0,e&&this.write(e),this._writableState.ending||this._writableState.destroyed||this.write(l),s.Writable.prototype.end.call(this,r))},t.exports=g}).call(this)}).call(this,e("_process"),e("buffer").Buffer)},{_process:50,buffer:17,"end-of-stream":21,inherits:24,"readable-stream":69,"stream-shift":74}],21:[function(e,t,r){(function(r){(function(){var n=e("once"),s=function(){},i=function(e){return e.setHeader&&"function"==typeof e.abort},o=function(e){return e.stdio&&Array.isArray(e.stdio)&&3===e.stdio.length},a=function(e,t,l){if("function"==typeof t)return a(e,null,t);t||(t={}),l=n(l||s);var c=e._writableState,u=e._readableState,d=t.readable||!1!==t.readable&&e.readable,h=t.writable||!1!==t.writable&&e.writable,f=!1,p=function(){e.writable||g()},g=function(){h=!1,d||l.call(e)},m=function(){d=!1,h||l.call(e)},y=function(t){l.call(e,t?new Error("exited with error code: "+t):null)},v=function(t){l.call(e,t)},b=function(){r.nextTick(w)},w=function(){if(!f)return(!d||u&&u.ended&&!u.destroyed)&&(!h||c&&c.ended&&!c.destroyed)?void 0:l.call(e,new Error("premature close"))},E=function(){e.req.on("finish",g)};return i(e)?(e.on("complete",g),e.on("abort",b),e.req?E():e.on("request",E)):h&&!c&&(e.on("end",p),e.on("close",p)),o(e)&&e.on("exit",y),e.on("end",m),e.on("finish",g),!1!==t.error&&e.on("error",v),e.on("close",b),function(){f=!0,e.removeListener("complete",g),e.removeListener("abort",b),e.removeListener("request",E),e.req&&e.req.removeListener("finish",g),e.removeListener("end",p),e.removeListener("close",p),e.removeListener("finish",g),e.removeListener("exit",y),e.removeListener("end",m),e.removeListener("error",v),e.removeListener("close",b)}};t.exports=a}).call(this)}).call(this,e("_process"))},{_process:50,once:48}],22:[function(e,t,r){var n=Object.create||C,s=Object.keys||_,i=Function.prototype.bind||k;function o(){this._events&&Object.prototype.hasOwnProperty.call(this,"_events")||(this._events=n(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0}t.exports=o,o.EventEmitter=o,o.prototype._events=void 0,o.prototype._maxListeners=void 0;var a,l=10;try{var c={};Object.defineProperty&&Object.defineProperty(c,"x",{value:0}),a=0===c.x}catch(e){a=!1}function u(e){return void 0===e._maxListeners?o.defaultMaxListeners:e._maxListeners}function d(e,t,r){if(t)e.call(r);else for(var n=e.length,s=T(e,n),i=0;i<n;++i)s[i].call(r)}function h(e,t,r,n){if(t)e.call(r,n);else for(var s=e.length,i=T(e,s),o=0;o<s;++o)i[o].call(r,n)}function f(e,t,r,n,s){if(t)e.call(r,n,s);else for(var i=e.length,o=T(e,i),a=0;a<i;++a)o[a].call(r,n,s)}function p(e,t,r,n,s,i){if(t)e.call(r,n,s,i);else for(var o=e.length,a=T(e,o),l=0;l<o;++l)a[l].call(r,n,s,i)}function g(e,t,r,n){if(t)e.apply(r,n);else for(var s=e.length,i=T(e,s),o=0;o<s;++o)i[o].apply(r,n)}function m(e,t,r,s){var i,o,a;if("function"!=typeof r)throw new TypeError('"listener" argument must be a function');if((o=e._events)?(o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]):(o=e._events=n(null),e._eventsCount=0),a){if("function"==typeof a?a=o[t]=s?[r,a]:[a,r]:s?a.unshift(r):a.push(r),!a.warned&&(i=u(e))&&i>0&&a.length>i){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+' "'+String(t)+'" listeners added. Use emitter.setMaxListeners() to increase limit.');l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=a.length,"object"==typeof console&&console.warn&&console.warn("%s: %s",l.name,l.message)}}else a=o[t]=r,++e._eventsCount;return e}function y(){if(!this.fired)switch(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];this.listener.apply(this.target,e)}}function v(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=i.call(y,n);return s.listener=r,n.wrapFn=s,s}function b(e,t,r){var n=e._events;if(!n)return[];var s=n[t];return s?"function"==typeof s?r?[s.listener||s]:[s]:r?S(s):T(s,s.length):[]}function w(e){var t=this._events;if(t){var r=t[e];if("function"==typeof r)return 1;if(r)return r.length}return 0}function E(e,t){for(var r=t,n=r+1,s=e.length;n<s;r+=1,n+=1)e[r]=e[n];e.pop()}function T(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function S(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}function C(e){var t=function(){};return t.prototype=e,new t}function _(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t);return t}function k(e){var t=this;return function(){return t.apply(e,arguments)}}a?Object.defineProperty(o,"defaultMaxListeners",{enumerable:!0,get:function(){return l},set:function(e){if("number"!=typeof e||e<0||e!=e)throw new TypeError('"defaultMaxListeners" must be a positive number');l=e}}):o.defaultMaxListeners=l,o.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},o.prototype.getMaxListeners=function(){return u(this)},o.prototype.emit=function(e){var t,r,n,s,i,o,a="error"===e;if(o=this._events)a=a&&null==o.error;else if(!a)return!1;if(a){if(arguments.length>1&&(t=arguments[1]),t instanceof Error)throw t;var l=new Error('Unhandled "error" event. ('+t+")");throw l.context=t,l}if(!(r=o[e]))return!1;var c="function"==typeof r;switch(n=arguments.length){case 1:d(r,c,this);break;case 2:h(r,c,this,arguments[1]);break;case 3:f(r,c,this,arguments[1],arguments[2]);break;case 4:p(r,c,this,arguments[1],arguments[2],arguments[3]);break;default:for(s=new Array(n-1),i=1;i<n;i++)s[i-1]=arguments[i];g(r,c,this,s)}return!0},o.prototype.addListener=function(e,t){return m(this,e,t,!1)},o.prototype.on=o.prototype.addListener,o.prototype.prependListener=function(e,t){return m(this,e,t,!0)},o.prototype.once=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.on(e,v(this,e,t)),this},o.prototype.prependOnceListener=function(e,t){if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');return this.prependListener(e,v(this,e,t)),this},o.prototype.removeListener=function(e,t){var r,s,i,o,a;if("function"!=typeof t)throw new TypeError('"listener" argument must be a function');if(!(s=this._events))return this;if(!(r=s[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=n(null):(delete s[e],s.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():E(r,i),1===r.length&&(s[e]=r[0]),s.removeListener&&this.emit("removeListener",e,a||t)}return this},o.prototype.removeAllListeners=function(e){var t,r,i;if(!(r=this._events))return this;if(!r.removeListener)return 0===arguments.length?(this._events=n(null),this._eventsCount=0):r[e]&&(0==--this._eventsCount?this._events=n(null):delete r[e]),this;if(0===arguments.length){var o,a=s(r);for(i=0;i<a.length;++i)"removeListener"!==(o=a[i])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=n(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},o.prototype.listeners=function(e){return b(this,e,!0)},o.prototype.rawListeners=function(e){return b(this,e,!1)},o.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):w.call(e,t)},o.prototype.listenerCount=w,o.prototype.eventNames=function(){return this._eventsCount>0?Reflect.ownKeys(this._events):[]}},{}],23:[function(e,t,r){
3
3
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
4
4
  r.read=function(e,t,r,n,s){var i,o,a=8*s-n-1,l=(1<<a)-1,c=l>>1,u=-7,d=r?s-1:0,h=r?-1:1,f=e[t+d];for(d+=h,i=f&(1<<-u)-1,f>>=-u,u+=a;u>0;i=256*i+e[t+d],d+=h,u-=8);for(o=i&(1<<-u)-1,i>>=-u,u+=n;u>0;o=256*o+e[t+d],d+=h,u-=8);if(0===i)i=1-c;else{if(i===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,n),i-=c}return(f?-1:1)*o*Math.pow(2,i-n)},r.write=function(e,t,r,n,s,i){var o,a,l,c=8*i-s-1,u=(1<<c)-1,d=u>>1,h=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:i-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),(t+=o+d>=1?h/l:h*Math.pow(2,1-d))*l>=2&&(o++,l/=2),o+d>=u?(a=0,o=u):o+d>=1?(a=(t*l-1)*Math.pow(2,s),o+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,s),o=0));s>=8;e[r+f]=255&a,f+=p,a/=256,s-=8);for(o=o<<s|a,c+=s;c>0;e[r+f]=255&o,f+=p,o/=256,c-=8);e[r+f-p]|=128*g}},{}],24:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},{}],25:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=function(){function e(e,t){this.color=!0,this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0,this.leftChild=void 0,this.rightChild=void 0,this.key=e,this.value=t}return e.prototype.rotateLeft=function(){var e=this.parent,t=this.brother,r=this.leftChild,n=this.rightChild;if(!n)throw new Error("unknown error");var s=n.leftChild,i=n.rightChild;return e&&(e.leftChild===this?e.leftChild=n:e.rightChild===this&&(e.rightChild=n)),n.parent=e,n.brother=t,n.leftChild=this,n.rightChild=i,t&&(t.brother=n),this.parent=n,this.brother=i,this.leftChild=r,this.rightChild=s,i&&(i.parent=n,i.brother=this),r&&(r.parent=this,r.brother=s),s&&(s.parent=this,s.brother=r),n},e.prototype.rotateRight=function(){var e=this.parent,t=this.brother,r=this.leftChild;if(!r)throw new Error("unknown error");var n=this.rightChild,s=r.leftChild,i=r.rightChild;return e&&(e.leftChild===this?e.leftChild=r:e.rightChild===this&&(e.rightChild=r)),r.parent=e,r.brother=t,r.leftChild=s,r.rightChild=this,t&&(t.brother=r),s&&(s.parent=r,s.brother=this),this.parent=r,this.brother=s,this.leftChild=i,this.rightChild=n,i&&(i.parent=this,i.brother=n),n&&(n.parent=this,n.brother=i),r},e.prototype.remove=function(){if(this.leftChild||this.rightChild)throw new Error("can only remove leaf node");this.parent&&(this===this.parent.leftChild?this.parent.leftChild=void 0:this===this.parent.rightChild&&(this.parent.rightChild=void 0)),this.brother&&(this.brother.brother=void 0),this.key=void 0,this.value=void 0,this.parent=void 0,this.brother=void 0},e.TreeNodeColorType={red:!0,black:!1},e}();Object.freeze(n),r.default=n},{}],26:[function(e,t,r){var n=this&&this.__generator||function(e,t){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return l([e,t])}}function l(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}};function s(e){var t=this;void 0===e&&(e=[]);var r=[],i=0,o=0,a=0,l=0,c=0,u=0;this.size=function(){return u},this.empty=function(){return 0===u},this.clear=function(){i=a=o=l=c=u=0,h.call(this,s.bucketSize),u=0},this.front=function(){return r[i][o]},this.back=function(){return r[a][l]},this.forEach=function(e){if(!this.empty()){var t=0;if(i!==a){for(c=o;c<s.bucketSize;++c)e(r[i][c],t++);for(c=i+1;c<a;++c)for(var n=0;n<s.bucketSize;++n)e(r[c][n],t++);for(c=0;c<=l;++c)e(r[a][c],t++)}else for(var c=o;c<=l;++c)e(r[i][c],t++)}};var d=function(e){var t=i*s.bucketSize+o,r=t+e,n=a*s.bucketSize+l;if(r<t||r>n)throw new Error("pos should more than 0 and less than queue's size");return{curNodeBucketIndex:Math.floor(r/s.bucketSize),curNodePointerIndex:r%s.bucketSize}};this.getElementByPos=function(e){var t=d(e),n=t.curNodeBucketIndex,s=t.curNodePointerIndex;return r[n][s]},this.eraseElementByPos=function(e){var t=this;if(e<0||e>u)throw new Error("pos should more than 0 and less than queue's size");if(0===e)this.popFront();else if(e===this.size())this.popBack();else{for(var r=[],n=e+1;n<u;++n)r.push(this.getElementByPos(n));this.cut(e),this.popBack(),r.forEach((function(e){return t.pushBack(e)}))}},this.eraseElementByValue=function(e){if(!this.empty()){var t=[];this.forEach((function(r){r!==e&&t.push(r)}));for(var r=t.length,n=0;n<r;++n)this.setElementByPos(n,t[n]);this.cut(r-1)}};var h=function(e){for(var t=[],n=e*s.sigma,d=Math.max(Math.ceil(n/s.bucketSize),2),h=0;h<d;++h)t.push(new Array(s.bucketSize));var f=Math.ceil(e/s.bucketSize),p=Math.floor(d/2)-Math.floor(f/2),g=p,m=0;if(this.size())for(h=0;h<f;++h){for(var y=0;y<s.bucketSize;++y)if(t[p+h][y]=this.front(),this.popFront(),this.empty()){g=p+h,m=y;break}if(this.empty())break}r=t,i=p,o=0,a=g,l=m,c=d,u=e};this.pushBack=function(e){this.empty()||(a===c-1&&l===s.bucketSize-1&&h.call(this,this.size()),l<s.bucketSize-1?++l:a<c-1&&(++a,l=0)),++u,r[a][l]=e},this.popBack=function(){this.empty()||(1!==this.size()&&(l>0?--l:i<a&&(--a,l=s.bucketSize-1)),u>0&&--u)},this.setElementByPos=function(e,t){var n=d(e),s=n.curNodeBucketIndex,i=n.curNodePointerIndex;r[s][i]=t},this.insert=function(e,t,r){var n=this;if(void 0===r&&(r=1),0===e)for(;r--;)this.pushFront(t);else if(e===this.size())for(;r--;)this.pushBack(t);else{for(var s=[],i=e;i<u;++i)s.push(this.getElementByPos(i));for(this.cut(e-1),i=0;i<r;++i)this.pushBack(t);s.forEach((function(e){return n.pushBack(e)}))}},this.find=function(e){if(i===a){for(var t=o;t<=l;++t)if(r[i][t]===e)return!0;return!1}for(t=o;t<s.bucketSize;++t)if(r[i][t]===e)return!0;for(t=i+1;t<a;++t)for(var n=0;n<s.bucketSize;++n)if(r[t][n]===e)return!0;for(t=0;t<=l;++t)if(r[a][t]===e)return!0;return!1},this.reverse=function(){for(var e=0,t=u-1;e<t;){var r=this.getElementByPos(e);this.setElementByPos(e,this.getElementByPos(t)),this.setElementByPos(t,r),++e,--t}},this.unique=function(){if(!this.empty()){var e=[],t=this.front();this.forEach((function(r,n){0!==n&&r===t||(e.push(r),t=r)}));for(var r=0;r<u;++r)this.setElementByPos(r,e[r]);this.cut(e.length-1)}},this.sort=function(e){var t=[];this.forEach((function(e){t.push(e)})),t.sort(e);for(var r=0;r<u;++r)this.setElementByPos(r,t[r])},this.pushFront=function(e){this.empty()||(0===i&&0===o&&h.call(this,this.size()),o>0?--o:i>0&&(--i,o=s.bucketSize-1)),++u,r[i][o]=e},this.popFront=function(){this.empty()||(1!==this.size()&&(o<s.bucketSize-1?++o:i<a&&(++i,o=0)),u>0&&--u)},this.shrinkToFit=function(){var e=this,t=[];this.forEach((function(e){t.push(e)}));var n=t.length;r=[];for(var i=Math.ceil(n/s.bucketSize),o=0;o<i;++o)r.push(new Array(s.bucketSize));this.clear(),t.forEach((function(t){return e.pushBack(t)}))},this.cut=function(e){if(e<0)this.clear();else{var t=d(e),r=t.curNodeBucketIndex,n=t.curNodePointerIndex;a=r,l=n,u=e+1}},this[Symbol.iterator]=function(){return function(){var e,t;return n(this,(function(n){switch(n.label){case 0:if(0===u)return[2];if(i!==a)return[3,5];t=o,n.label=1;case 1:return t<=l?[4,r[i][t]]:[3,4];case 2:n.sent(),n.label=3;case 3:return++t,[3,1];case 4:return[2];case 5:t=o,n.label=6;case 6:return t<s.bucketSize?[4,r[i][t]]:[3,9];case 7:n.sent(),n.label=8;case 8:return++t,[3,6];case 9:t=i+1,n.label=10;case 10:if(!(t<a))return[3,15];e=0,n.label=11;case 11:return e<s.bucketSize?[4,r[t][e]]:[3,14];case 12:n.sent(),n.label=13;case 13:return++e,[3,11];case 14:return++t,[3,10];case 15:t=0,n.label=16;case 16:return t<=l?[4,r[a][t]]:[3,19];case 17:n.sent(),n.label=18;case 18:return++t,[3,16];case 19:return[2]}}))}()},function(){var n=s.bucketSize;e.size?n=e.size():e.length&&(n=e.length);var o=n*s.sigma;c=Math.ceil(o/s.bucketSize),c=Math.max(c,3);for(var l=0;l<c;++l)r.push(new Array(s.bucketSize));var u=Math.ceil(n/s.bucketSize);i=Math.floor(c/2)-Math.floor(u/2),a=i,e.forEach((function(e){return t.pushBack(e)}))}(),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),s.sigma=3,s.bucketSize=5e3,Object.freeze(s),r.default=s},{}],27:[function(e,t,r){var n=this&&this.__generator||function(e,t){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return l([e,t])}}function l(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var i=e("../LinkList/LinkList"),o=e("../Map/Map");function a(e,t,r){var l=this;if(void 0===e&&(e=[]),void 0===t&&(t=a.initSize),r=r||function(e){var t,r,n=0,i="";if("number"==typeof e)n=((n=Math.floor(e))<<5)-n,n&=n;else{i="string"!=typeof e?JSON.stringify(e):e;try{for(var o=s(i),a=o.next();!a.done;a=o.next())n=(n<<5)-n+a.value.charCodeAt(0),n&=n}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}}return n^=n>>>16},0!=(t&t-1))throw new Error("initBucketNum must be 2 to the power of n");var c=0,u=[],d=Math.max(a.initSize,Math.min(a.maxSize,t));this.size=function(){return c},this.empty=function(){return 0===c},this.clear=function(){c=0,d=t,u=[]},this.forEach=function(e){var t=0;u.forEach((function(r){r.forEach((function(r){e(r,t++)}))}))};var h=function(e){if(!(e>=a.maxSize)){d=2*e;var t=[];u.forEach((function(n,s){if(!n.empty()){if(n instanceof i.default&&1===n.size()){var l=n.front(),c=l.key,h=l.value;t[r(c)&d-1]=new i.default([{key:c,value:h}])}else if(n instanceof o.default){var f=new i.default,p=new i.default;n.forEach((function(t){0==(r(t.key)&e)?f.pushBack(t):p.pushBack(t)})),f.size()>a.untreeifyThreshold?t[s]=new o.default(f):f.size()&&(t[s]=f),p.size()>a.untreeifyThreshold?t[s+e]=new o.default(p):p.size()&&(t[s+e]=p)}else{var g=new i.default,m=new i.default;n.forEach((function(t){0==(r(t.key)&e)?g.pushBack(t):m.pushBack(t)})),g.size()&&(t[s]=g),m.size()&&(t[s+e]=m)}u[s].clear()}})),u=t}};this.setElement=function(e,t){var n,l;if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=t){var f=r(e)&d-1;if(u[f]){var p=u[f].size();if(u[f]instanceof i.default){try{for(var g=s(u[f]),m=g.next();!m.done;m=g.next()){var y=m.value;if(y.key===e)return void(y.value=t)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(l=g.return)&&l.call(g)}finally{if(n)throw n.error}}u[f].pushBack({key:e,value:t}),u[f].size()>=a.treeifyThreshold&&(u[f]=new o.default(u[f]))}else u[f].setElement(e,t);var v=u[f].size();c+=v-p}else++c,u[f]=new i.default([{key:e,value:t}]);c>d*a.sigma&&h.call(this,d)}else this.eraseElementByKey(e)},this.getElementByKey=function(e){var t,n,i=r(e)&d-1;if(u[i]){if(u[i]instanceof o.default)return u[i].getElementByKey(e);try{for(var a=s(u[i]),l=a.next();!l.done;l=a.next()){var c=l.value;if(c.key===e)return c.value}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}}},this.eraseElementByKey=function(e){var t,n,l=r(e)&d-1;if(u[l]){var h=u[l].size();if(u[l]instanceof o.default)u[l].eraseElementByKey(e),u[l].size()<=a.untreeifyThreshold&&(u[l]=new i.default(u[l]));else{var f=-1;try{for(var p=s(u[l]),g=p.next();!g.done;g=p.next()){var m=g.value;if(++f,m.key===e){u[l].eraseElementByPos(f);break}}}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}}var y=u[l].size();c+=y-h}},this.find=function(e){var t,n,i=r(e)&d-1;if(!u[i])return!1;if(u[i]instanceof o.default)return u[i].find(e);try{for(var a=s(u[i]),l=a.next();!l.done;l=a.next())if(l.value.key===e)return!0}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return!1},this[Symbol.iterator]=function(){return function(){var e,t,r,i,o,a;return n(this,(function(n){switch(n.label){case 0:e=0,n.label=1;case 1:if(!(e<d))return[3,10];for(;e<d&&!u[e];)++e;if(e>=d)return[3,10];n.label=2;case 2:n.trys.push([2,7,8,9]),o=void 0,t=s(u[e]),r=t.next(),n.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:n.sent(),n.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return i=n.sent(),o={error:i},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(o)throw o.error}return[7];case 9:return++e,[3,1];case 10:return[2]}}))}()},e.forEach((function(e){var t=e.key,r=e.value;return l.setElement(t,r)})),Object.freeze(this)}a.initSize=16,a.maxSize=1<<30,a.sigma=.75,a.treeifyThreshold=8,a.untreeifyThreshold=6,a.minTreeifySize=64,Object.freeze(a),r.default=a},{"../LinkList/LinkList":29,"../Map/Map":30}],28:[function(e,t,r){var n=this&&this.__generator||function(e,t){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return l([e,t])}}function l(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Set/Set"),o=e("../LinkList/LinkList");function a(e,t,r){var l=this;if(void 0===e&&(e=[]),void 0===t&&(t=a.initSize),r=r||function(e){var t=0,r="";if("number"==typeof e)t=((t=Math.floor(e))<<5)-t,t&=t;else{r="string"!=typeof e?JSON.stringify(e):e;for(var n=0;n<r.length;n++)t=(t<<5)-t+r.charCodeAt(n),t&=t}return t^=t>>>16},0!=(t&t-1))throw new Error("initBucketNum must be 2 to the power of n");var c=0,u=[],d=Math.max(a.initSize,Math.min(a.maxSize,t));this.size=function(){return c},this.empty=function(){return 0===c},this.clear=function(){c=0,d=t,u=[]},this.forEach=function(e){var t=0;u.forEach((function(r){r.forEach((function(r){e(r,t++)}))}))};var h=function(e){if(!(e>=a.maxSize)){d=2*e;var t=[];u.forEach((function(n,s){if(!n.empty()){if(n instanceof o.default&&1===n.size()){var l=n.front();if(void 0===l)throw new Error("unknown error");t[r(l)&d-1]=new o.default([l])}else if(n instanceof i.default){var c=new o.default,h=new o.default;n.forEach((function(t){0==(r(t)&e)?c.pushBack(t):h.pushBack(t)})),c.size()>a.untreeifyThreshold?t[s]=new i.default(c):c.size()&&(t[s]=c),h.size()>a.untreeifyThreshold?t[s+e]=new i.default(h):h.size()&&(t[s+e]=h)}else{var f=new o.default,p=new o.default;n.forEach((function(t){0==(r(t)&e)?f.pushBack(t):p.pushBack(t)})),f.size()&&(t[s]=f),p.size()&&(t[s+e]=p)}u[s].clear()}})),u=t}};this.insert=function(e){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");var t=r(e)&d-1;if(u[t]){var n=u[t].size();if(u[t]instanceof o.default){if(u[t].find(e))return;u[t].pushBack(e),u[t].size()>=a.treeifyThreshold&&(u[t]=new i.default(u[t]))}else u[t].insert(e);var s=u[t].size();c+=s-n}else u[t]=new o.default([e]),++c;c>d*a.sigma&&h.call(this,d)},this.eraseElementByValue=function(e){var t=r(e)&d-1;if(u[t]){var n=u[t].size();u[t].eraseElementByValue(e),u[t]instanceof i.default&&u[t].size()<=a.untreeifyThreshold&&(u[t]=new o.default(u[t]));var s=u[t].size();c+=s-n}},this.find=function(e){var t=r(e)&d-1;return!!u[t]&&u[t].find(e)},this[Symbol.iterator]=function(){return function(){var e,t,r,i,o,a;return n(this,(function(n){switch(n.label){case 0:e=0,n.label=1;case 1:if(!(e<d))return[3,10];for(;e<d&&!u[e];)++e;if(e>=d)return[3,10];n.label=2;case 2:n.trys.push([2,7,8,9]),o=void 0,t=s(u[e]),r=t.next(),n.label=3;case 3:return r.done?[3,6]:[4,r.value];case 4:n.sent(),n.label=5;case 5:return r=t.next(),[3,3];case 6:return[3,9];case 7:return i=n.sent(),o={error:i},[3,9];case 8:try{r&&!r.done&&(a=t.return)&&a.call(t)}finally{if(o)throw o.error}return[7];case 9:return++e,[3,1];case 10:return[2]}}))}()},e.forEach((function(e){return l.insert(e)})),Object.freeze(this)}a.initSize=16,a.maxSize=1<<30,a.sigma=.75,a.treeifyThreshold=8,a.untreeifyThreshold=6,a.minTreeifySize=64,Object.freeze(a),r.default=a},{"../LinkList/LinkList":29,"../Set/Set":33}],29:[function(e,t,r){var n=this&&this.__generator||function(e,t){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return l([e,t])}}function l(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}};Object.defineProperty(r,"__esModule",{value:!0});var s=function(){function e(e){this.value=void 0,this.pre=void 0,this.next=void 0,this.value=e}return e}();function i(e){var t=this;void 0===e&&(e=[]);var r=0,i=void 0,o=void 0;this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){i=o=void 0,r=0},this.front=function(){return null==i?void 0:i.value},this.back=function(){return null==o?void 0:o.value},this.forEach=function(e){for(var t=i,r=0;t;){if(void 0===t.value)throw new Error("unknown error");e(t.value,r++),t=t.next}},this.getElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more then 0 and less then the list length");for(var t=i;e--&&t;)t=t.next;if(!t||void 0===t.value)throw new Error("unknown error");return t.value},this.eraseElementByPos=function(e){if(e<0||e>=r)throw new Error("erase pos must more then 0 and less then the list length");if(0===e)this.popFront();else if(e===r-1)this.popBack();else{for(var t=i;e--;){if(!(null==t?void 0:t.next))throw new Error("unknown error");t=t.next}if(!t||!t.pre||!t.next)throw new Error("unknown error");var n=t.pre,s=t.next;s.pre=n,n.next=s,r>0&&--r}},this.eraseElementByValue=function(e){for(;i&&i.value===e;)this.popFront();for(;o&&o.value===e;)this.popBack();if(i)for(var t=i;t;){if(t.value===e){var n=t.pre,s=t.next;s&&(s.pre=n),n&&(n.next=s),r>0&&--r}t=t.next}},this.pushBack=function(e){if(null==e)throw new Error("you can't push null or undefined here");++r;var t=new s(e);o?(o.next=t,t.pre=o,o=t):i=o=t},this.popBack=function(){o&&(r>0&&--r,o&&(i===o?i=o=void 0:(o=o.pre)&&(o.next=void 0)))},this.setElementByPos=function(e,t){if(null==t)throw new Error("you can't set null or undefined here");if(e<0||e>=r)throw new Error("pos must more then 0 and less then the list length");for(var n=i;e--;){if(!n)throw new Error("unknown error");n=n.next}n&&(n.value=t)},this.insert=function(e,t,n){if(void 0===n&&(n=1),null==t)throw new Error("you can't insert null or undefined here");if(e<0||e>r)throw new Error("insert pos must more then 0 and less then or equal to the list length");if(n<0)throw new Error("insert size must more than 0");if(0===e)for(;n--;)this.pushFront(t);else if(e===r)for(;n--;)this.pushBack(t);else{for(var o=i,a=1;a<e;++a){if(!(null==o?void 0:o.next))throw new Error("unknown error");o=null==o?void 0:o.next}if(!o)throw new Error("unknown error");var l=o.next;for(r+=n;n--;)o.next=new s(t),o.next.pre=o,o=o.next;o.next=l,l&&(l.pre=o)}},this.find=function(e){for(var t=i;t;){if(t.value===e)return!0;t=t.next}return!1},this.reverse=function(){for(var e=i,t=o,n=0;e&&t&&2*n<r;){var s=e.value;e.value=t.value,t.value=s,e=e.next,t=t.pre,++n}},this.unique=function(){for(var e=i;e;){for(var t=e;t&&t.next&&t.value===t.next.value;)t=t.next,r>0&&--r;e.next=t.next,e.next&&(e.next.pre=e),e=e.next}},this.sort=function(e){var t=[];this.forEach((function(e){t.push(e)})),t.sort(e);var r=i;t.forEach((function(e){r&&(r.value=e,r=r.next)}))},this.pushFront=function(e){if(null==e)throw new Error("you can't push null or undefined here");++r;var t=new s(e);i?(t.next=i,i.pre=t,i=t):i=o=t},this.popFront=function(){i&&(r>0&&--r,i&&(i===o?i=o=void 0:(i=i.next)&&(i.pre=void 0)))},this.merge=function(e){var t=this,n=i;e.forEach((function(e){for(;n&&void 0!==n.value&&n.value<=e;)n=n.next;if(void 0===n)t.pushBack(e),n=o;else if(n===i)t.pushFront(e),n=i;else{++r;var a=n.pre;a&&(a.next=new s(e),a.next.pre=a,a.next.next=n,n&&(n.pre=a.next))}}))},this[Symbol.iterator]=function(){return function(){var e;return n(this,(function(t){switch(t.label){case 0:e=i,t.label=1;case 1:if(void 0===e)return[3,3];if(!e.value)throw new Error("unknown error");return[4,e.value];case 2:return t.sent(),e=e.next,[3,1];case 3:return[2]}}))}()},e.forEach((function(e){return t.pushBack(e)})),Object.freeze(this)}Object.freeze(i),r.default=i},{}],30:[function(e,t,r){var n=this&&this.__generator||function(e,t){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return l([e,t])}}function l(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Base/TreeNode");function o(e,t){var r=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var o=0,a=new i.default;a.color=i.default.TreeNodeColorType.black,this.size=function(){return o},this.empty=function(){return 0===o},this.clear=function(){o=0,a.key=a.value=void 0,a.leftChild=a.rightChild=a.brother=void 0};var l=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?l(e.leftChild):e},c=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?c(e.rightChild):e};this.front=function(){if(!this.empty()){var e=l(a);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.back=function(){if(!this.empty()){var e=c(a);if(void 0===e.key||void 0===e.value)throw new Error("unknown error");return{key:e.key,value:e.value}}},this.forEach=function(e){var t,r,n=0;try{for(var i=s(this),o=i.next();!o.done;o=i.next())e(o.value,n++)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,r;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var n=0;try{for(var i=s(this),o=i.next();!o.done;o=i.next()){var a=o.value;if(n===e)return a;++n}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}throw new Error("unknown Error")};var u=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value){var n=t(e.key,r);return 0===n?{key:e.key,value:e.value}:n<0?u(e.rightChild,r):u(e.leftChild,r)||{key:e.key,value:e.value}}};this.lowerBound=function(e){return u(a,e)};var d=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,r)<=0?d(e.rightChild,r):d(e.leftChild,r)||{key:e.key,value:e.value}};this.upperBound=function(e){return d(a,e)};var h=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value){var n=t(e.key,r);return 0===n?{key:e.key,value:e.value}:n>0?h(e.leftChild,r):h(e.rightChild,r)||{key:e.key,value:e.value}}};this.reverseLowerBound=function(e){return h(a,e)};var f=function(e,r){if(e&&void 0!==e.key&&void 0!==e.value)return t(e.key,r)>=0?f(e.leftChild,r):f(e.rightChild,r)||{key:e.key,value:e.value}};this.reverseUpperBound=function(e){return f(a,e)};var p=function(e){var t=e.parent;if(!t){if(e===a)return;throw new Error("unknown error")}if(e.color!==i.default.TreeNodeColorType.red){var r=e.brother;if(!r)throw new Error("unknown error");if(e===t.leftChild)if(r.color===i.default.TreeNodeColorType.red){r.color=i.default.TreeNodeColorType.black,t.color=i.default.TreeNodeColorType.red;var n=t.rotateLeft();a===t&&(a=n),p(e)}else r.color===i.default.TreeNodeColorType.black&&(r.rightChild&&r.rightChild.color===i.default.TreeNodeColorType.red?(r.color=t.color,t.color=i.default.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=i.default.TreeNodeColorType.black),n=t.rotateLeft(),a===t&&(a=n),e.color=i.default.TreeNodeColorType.black):r.rightChild&&r.rightChild.color!==i.default.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==i.default.TreeNodeColorType.red?r.leftChild&&r.leftChild.color!==i.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==i.default.TreeNodeColorType.black||(r.color=i.default.TreeNodeColorType.red,p(t)):(r.color=i.default.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=i.default.TreeNodeColorType.black),n=r.rotateRight(),a===r&&(a=n),p(e)));else e===t.rightChild&&(r.color===i.default.TreeNodeColorType.red?(r.color=i.default.TreeNodeColorType.black,t.color=i.default.TreeNodeColorType.red,n=t.rotateRight(),a===t&&(a=n),p(e)):r.color===i.default.TreeNodeColorType.black&&(r.leftChild&&r.leftChild.color===i.default.TreeNodeColorType.red?(r.color=t.color,t.color=i.default.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=i.default.TreeNodeColorType.black),n=t.rotateRight(),a===t&&(a=n),e.color=i.default.TreeNodeColorType.black):r.leftChild&&r.leftChild.color!==i.default.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==i.default.TreeNodeColorType.red?r.leftChild&&r.leftChild.color!==i.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==i.default.TreeNodeColorType.black||(r.color=i.default.TreeNodeColorType.red,p(t)):(r.color=i.default.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=i.default.TreeNodeColorType.black),n=r.rotateLeft(),a===r&&(a=n),p(e))))}else e.color=i.default.TreeNodeColorType.black},g=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=l(t.rightChild);var r=e.key;e.key=t.key,t.key=r;var n=e.value;e.value=t.value,t.value=n,e=t}t.leftChild&&(t=c(t.leftChild),r=e.key,e.key=t.key,t.key=r,n=e.value,e.value=t.value,t.value=n,e=t)}p(t),t&&t.remove(),--o,a.color=i.default.TreeNodeColorType.black},m=function(e,t){return!(!e||void 0===e.key)&&(!!m(e.leftChild,t)||!!t(e)||m(e.rightChild,t))};this.eraseElementByPos=function(e){if(e<0||e>=o)throw new Error("pos must more than 0 and less than set's size");var t=0;m(a,(function(r){return e===t?(g(r),!0):(++t,!1)}))},this.eraseElementByKey=function(e){if(!this.empty()){var r=b(a,e);void 0!==r&&void 0!==r.key&&0===t(r.key,e)&&g(r)}};var y=function(e,r){if(!e||void 0===e.key)throw new Error("unknown error");var n=t(r,e.key);return n<0?e.leftChild?y(e.leftChild,r):(e.leftChild=new i.default,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):n>0?e.rightChild?y(e.rightChild,r):(e.rightChild=new i.default,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},v=function(e){var t=e.parent;if(!t){if(e===a)return;throw new Error("unknown error")}if(t.color!==i.default.TreeNodeColorType.black&&t.color===i.default.TreeNodeColorType.red){var r=t.brother,n=t.parent;if(!n)throw new Error("unknown error");if(r&&r.color===i.default.TreeNodeColorType.red)r.color=t.color=i.default.TreeNodeColorType.black,n.color=i.default.TreeNodeColorType.red,v(n);else if(!r||r.color===i.default.TreeNodeColorType.black)if(t===n.leftChild)if(e===t.leftChild){t.color=i.default.TreeNodeColorType.black,n.color=i.default.TreeNodeColorType.red;var s=n.rotateRight();n===a&&(a=s)}else e===t.rightChild&&(s=t.rotateLeft(),n===a&&(a=s),v(t));else t===n.rightChild&&(e===t.leftChild?(s=t.rotateRight(),n===a&&(a=s),v(t)):e===t.rightChild&&(t.color=i.default.TreeNodeColorType.black,n.color=i.default.TreeNodeColorType.red,s=n.rotateLeft(),n===a&&(a=s)))}};this.setElement=function(e,r){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(null!=r){if(this.empty())return++o,a.key=e,a.value=r,void(a.color=i.default.TreeNodeColorType.black);var n=y(a,e);void 0===n.key||0!==t(n.key,e)?(++o,n.key=e,n.value=r,v(n),a.color=i.default.TreeNodeColorType.black):n.value=r}else this.eraseElementByKey(e)};var b=function(e,r){if(e&&void 0!==e.key){var n=t(r,e.key);return n<0?b(e.leftChild,r):n>0?b(e.rightChild,r):e}};this.find=function(e){return!!b(a,e)},this.getElementByKey=function(e){var t=b(a,e);if(void 0===(null==t?void 0:t.key)||void 0===(null==t?void 0:t.value))throw new Error("unknown error");return t.value},this.union=function(e){var t=this;e.forEach((function(e){var r=e.key,n=e.value;return t.setElement(r,n)}))},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(a)};var w=function(e){return n(this,(function(t){switch(t.label){case 0:return e&&void 0!==e.key&&void 0!==e.value?[5,s(w(e.leftChild))]:[2];case 1:return t.sent(),[4,{key:e.key,value:e.value}];case 2:return t.sent(),[5,s(w(e.rightChild))];case 3:return t.sent(),[2]}}))};this[Symbol.iterator]=function(){return w(a)},e.forEach((function(e){var t=e.key,n=e.value;return r.setElement(t,n)})),Object.freeze(this)}Object.freeze(o),r.default=o},{"../Base/TreeNode":25}],31:[function(e,t,r){function n(e,t){void 0===e&&(e=[]),t=t||function(e,t){return e>t?-1:e<t?1:0};var r=[];e.forEach((function(e){return r.push(e)}));var n=r.length,s=function(e,t){if(e<0||e>=n)throw new Error("unknown error");if(t<0||t>=n)throw new Error("unknown error");var s=r[e];r[e]=r[t],r[t]=s},i=function(e){if(e<0||e>=n)throw new Error("unknown error");var i=2*e+1,o=2*e+2;i<n&&t(r[e],r[i])>0&&s(e,i),o<n&&t(r[e],r[o])>0&&s(e,o)};!function(){for(var e=Math.floor((n-1)/2);e>=0;--e)for(var i=e,o=2*i+1;o<n;){var a=o+1,l=o;if(a<n&&t(r[o],r[a])>0&&(l=a),t(r[i],r[l])<=0)break;s(i,l),o=2*(i=l)+1}}(),this.size=function(){return n},this.empty=function(){return 0===n},this.clear=function(){n=0,r.length=0},this.push=function(e){if(r.push(e),1!=++n)for(var s=n-1;s>0;){var o=Math.floor((s-1)/2);if(t(r[o],e)<=0)break;i(o),s=o}},this.pop=function(){if(!this.empty())if(1!==this.size()){var e=r[n-1];--n;for(var s=0;s<this.size();){var i=2*s+1,o=2*s+2;if(i>=this.size())break;var a=i;if(o<this.size()&&t(r[i],r[o])>0&&(a=o),t(r[a],e)>=0)break;r[s]=r[a],s=a}r[s]=e}else--n},this.top=function(){return r[0]},Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(n),r.default=n},{}],32:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0});var n=e("../LinkList/LinkList");function s(e){void 0===e&&(e=[]);var t=new n.default(e);this.size=function(){return t.size()},this.empty=function(){return t.empty()},this.clear=function(){t.clear()},this.push=function(e){t.pushBack(e)},this.pop=function(){t.popFront()},this.front=function(){return t.front()},Object.freeze(this)}Object.freeze(s),r.default=s},{"../LinkList/LinkList":29}],33:[function(e,t,r){var n=this&&this.__generator||function(e,t){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return l([e,t])}}function l(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(r,"__esModule",{value:!0});var i=e("../Base/TreeNode");function o(e,t){var r=this;void 0===e&&(e=[]),t=t||function(e,t){return e<t?-1:e>t?1:0};var o=0,a=new i.default;a.color=i.default.TreeNodeColorType.black,this.size=function(){return o},this.empty=function(){return 0===o},this.clear=function(){o=0,a.key=void 0,a.leftChild=a.rightChild=a.brother=a.parent=void 0,a.color=i.default.TreeNodeColorType.black};var l=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.leftChild?l(e.leftChild):e},c=function(e){if(!e||void 0===e.key)throw new Error("unknown error");return e.rightChild?c(e.rightChild):e};this.front=function(){if(!this.empty())return l(a).key},this.back=function(){if(!this.empty())return c(a).key},this.forEach=function(e){var t,r,n=0;try{for(var i=s(this),o=i.next();!o.done;o=i.next())e(o.value,n++)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},this.getElementByPos=function(e){var t,r;if(e<0||e>=this.size())throw new Error("pos must more than 0 and less than set's size");var n=0;try{for(var i=s(this),o=i.next();!o.done;o=i.next()){var a=o.value;if(n===e)return a;++n}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}throw new Error("unknown error")};var u=function(e){var t=e.parent;if(!t){if(e===a)return;throw new Error("unknown error")}if(e.color!==i.default.TreeNodeColorType.red){var r=e.brother;if(!r)throw new Error("unknown error");if(e===t.leftChild)if(r.color===i.default.TreeNodeColorType.red){r.color=i.default.TreeNodeColorType.black,t.color=i.default.TreeNodeColorType.red;var n=t.rotateLeft();a===t&&(a=n),u(e)}else r.color===i.default.TreeNodeColorType.black&&(r.rightChild&&r.rightChild.color===i.default.TreeNodeColorType.red?(r.color=t.color,t.color=i.default.TreeNodeColorType.black,r.rightChild&&(r.rightChild.color=i.default.TreeNodeColorType.black),n=t.rotateLeft(),a===t&&(a=n),e.color=i.default.TreeNodeColorType.black):r.rightChild&&r.rightChild.color!==i.default.TreeNodeColorType.black||!r.leftChild||r.leftChild.color!==i.default.TreeNodeColorType.red?r.leftChild&&r.leftChild.color!==i.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==i.default.TreeNodeColorType.black||(r.color=i.default.TreeNodeColorType.red,u(t)):(r.color=i.default.TreeNodeColorType.red,r.leftChild&&(r.leftChild.color=i.default.TreeNodeColorType.black),n=r.rotateRight(),a===r&&(a=n),u(e)));else e===t.rightChild&&(r.color===i.default.TreeNodeColorType.red?(r.color=i.default.TreeNodeColorType.black,t.color=i.default.TreeNodeColorType.red,n=t.rotateRight(),a===t&&(a=n),u(e)):r.color===i.default.TreeNodeColorType.black&&(r.leftChild&&r.leftChild.color===i.default.TreeNodeColorType.red?(r.color=t.color,t.color=i.default.TreeNodeColorType.black,r.leftChild&&(r.leftChild.color=i.default.TreeNodeColorType.black),n=t.rotateRight(),a===t&&(a=n),e.color=i.default.TreeNodeColorType.black):r.leftChild&&r.leftChild.color!==i.default.TreeNodeColorType.black||!r.rightChild||r.rightChild.color!==i.default.TreeNodeColorType.red?r.leftChild&&r.leftChild.color!==i.default.TreeNodeColorType.black||r.rightChild&&r.rightChild.color!==i.default.TreeNodeColorType.black||(r.color=i.default.TreeNodeColorType.red,u(t)):(r.color=i.default.TreeNodeColorType.red,r.rightChild&&(r.rightChild.color=i.default.TreeNodeColorType.black),n=r.rotateLeft(),a===r&&(a=n),u(e))))}else e.color=i.default.TreeNodeColorType.black},d=function(e){for(var t=e;t.leftChild||t.rightChild;){if(t.rightChild){t=l(t.rightChild);var r=e.key;e.key=t.key,t.key=r,e=t}t.leftChild&&(t=c(t.leftChild),r=e.key,e.key=t.key,t.key=r,e=t)}u(t),t&&t.remove(),--o,a.color=i.default.TreeNodeColorType.black},h=function(e,t){return!(!e||void 0===e.key)&&(!!h(e.leftChild,t)||!!t(e)||h(e.rightChild,t))};this.eraseElementByPos=function(e){if(e<0||e>=o)throw new Error("pos must more than 0 and less than set's size");var t=0;h(a,(function(r){return e===t?(d(r),!0):(++t,!1)}))},this.eraseElementByValue=function(e){if(!this.empty()){var r=g(a,e);void 0!==r&&void 0!==r.key&&0===t(r.key,e)&&d(r)}};var f=function(e,r){if(!e||void 0===e.key)throw new Error("unknown error");var n=t(r,e.key);return n<0?e.leftChild?f(e.leftChild,r):(e.leftChild=new i.default,e.leftChild.parent=e,e.leftChild.brother=e.rightChild,e.rightChild&&(e.rightChild.brother=e.leftChild),e.leftChild):n>0?e.rightChild?f(e.rightChild,r):(e.rightChild=new i.default,e.rightChild.parent=e,e.rightChild.brother=e.leftChild,e.leftChild&&(e.leftChild.brother=e.rightChild),e.rightChild):e},p=function(e){var t=e.parent;if(!t){if(e===a)return;throw new Error("unknown error")}if(t.color!==i.default.TreeNodeColorType.black&&t.color===i.default.TreeNodeColorType.red){var r=t.brother,n=t.parent;if(!n)throw new Error("unknown error");if(r&&r.color===i.default.TreeNodeColorType.red)r.color=t.color=i.default.TreeNodeColorType.black,n.color=i.default.TreeNodeColorType.red,p(n);else if(!r||r.color===i.default.TreeNodeColorType.black)if(t===n.leftChild)if(e===t.leftChild){t.color=i.default.TreeNodeColorType.black,n.color=i.default.TreeNodeColorType.red;var s=n.rotateRight();n===a&&(a=s)}else e===t.rightChild&&(s=t.rotateLeft(),n===a&&(a=s),p(t));else t===n.rightChild&&(e===t.leftChild?(s=t.rotateRight(),n===a&&(a=s),p(t)):e===t.rightChild&&(t.color=i.default.TreeNodeColorType.black,n.color=i.default.TreeNodeColorType.red,s=n.rotateLeft(),n===a&&(a=s)))}};this.insert=function(e){if(null==e)throw new Error("to avoid some unnecessary errors, we don't suggest you insert null or undefined here");if(this.empty())return++o,a.key=e,void(a.color=i.default.TreeNodeColorType.black);var r=f(a,e);void 0!==r.key&&0===t(r.key,e)||(++o,r.key=e,p(r),a.color=i.default.TreeNodeColorType.black)};var g=function(e,r){if(e&&void 0!==e.key){var n=t(r,e.key);return n<0?g(e.leftChild,r):n>0?g(e.rightChild,r):e}};this.find=function(e){var r=g(a,e);return void 0!==r&&void 0!==r.key&&0===t(r.key,e)};var m=function(e,r){if(e&&void 0!==e.key){var n=t(e.key,r);if(0===n)return e.key;if(n<0)return m(e.rightChild,r);var s=m(e.leftChild,r);return void 0!==s?s:e.key}};this.lowerBound=function(e){return m(a,e)};var y=function(e,r){if(e&&void 0!==e.key){if(t(e.key,r)<=0)return y(e.rightChild,r);var n=y(e.leftChild,r);return void 0!==n?n:e.key}};this.upperBound=function(e){return y(a,e)};var v=function(e,r){if(e&&void 0!==e.key){var n=t(e.key,r);if(0===n)return e.key;if(n>0)return v(e.leftChild,r);var s=v(e.rightChild,r);return void 0!==s?s:e.key}};this.reverseLowerBound=function(e){return v(a,e)};var b=function(e,r){if(e&&void 0!==e.key){if(t(e.key,r)>=0)return b(e.leftChild,r);var n=b(e.rightChild,r);return void 0!==n?n:e.key}};this.reverseUpperBound=function(e){return b(a,e)},this.union=function(e){var t=this;e.forEach((function(e){return t.insert(e)}))},this.getHeight=function(){if(this.empty())return 0;var e=function(t){return t?Math.max(e(t.leftChild),e(t.rightChild))+1:1};return e(a)};var w=function(e){return n(this,(function(t){switch(t.label){case 0:return e&&void 0!==e.key?[5,s(w(e.leftChild))]:[2];case 1:return t.sent(),[4,e.key];case 2:return t.sent(),[5,s(w(e.rightChild))];case 3:return t.sent(),[2]}}))};this[Symbol.iterator]=function(){return w(a)},e.forEach((function(e){return r.insert(e)})),Object.freeze(this)}Object.freeze(o),r.default=o},{"../Base/TreeNode":25}],34:[function(e,t,r){function n(e){var t=this;void 0===e&&(e=[]);var r=0,n=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,n.length=0},this.push=function(e){n.push(e),++r},this.pop=function(){n.pop(),r>0&&--r},this.top=function(){return n[r-1]},e.forEach((function(e){return t.push(e)})),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(n),r.default=n},{}],35:[function(e,t,r){var n=this&&this.__generator||function(e,t){var r,n,s,i,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return l([e,t])}}function l(i){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(s=2&i[0]?n.return:i[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,i[1])).done)return s;switch(n=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,n=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){o=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){o.label=i[1];break}if(6===i[0]&&o.label<s[1]){o.label=s[1],s=i;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(i);break}s[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],n=0}finally{r=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}},s=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,s,i=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)o.push(n.value)}catch(e){s={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(s)throw s.error}}return o},i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,s=0,i=t.length;s<i;s++)!n&&s in t||(n||(n=Array.prototype.slice.call(t,0,s)),n[s]=t[s]);return e.concat(n||Array.prototype.slice.call(t))},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function a(e){var t=this;void 0===e&&(e=[]);var r=0,a=[];this.size=function(){return r},this.empty=function(){return 0===r},this.clear=function(){r=0,a.length=0},this.front=function(){if(!this.empty())return a[0]},this.back=function(){if(!this.empty())return a[r-1]},this.forEach=function(e){a.forEach(e)},this.getElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");return a[e]},this.eraseElementByPos=function(e){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");for(var t=e;t<r-1;++t)a[t]=a[t+1];this.popBack()},this.eraseElementByValue=function(e){var t=[];this.forEach((function(r){r!==e&&t.push(r)})),t.forEach((function(e,t){a[t]=e}));for(var n=t.length;r>n;)this.popBack()},this.pushBack=function(e){a.push(e),++r},this.popBack=function(){a.pop(),r>0&&--r},this.setElementByPos=function(e,t){if(e<0||e>=r)throw new Error("pos must more than 0 and less than vector's size");a[e]=t},this.insert=function(e,t,n){if(void 0===n&&(n=1),e<0||e>r)throw new Error("pos must more than 0 and less than or equal to vector's size");a.splice.apply(a,i([e,0],s(new Array(n).fill(t)),!1)),r+=n},this.find=function(e){return a.includes(e)},this.reverse=function(){a.reverse()},this.unique=function(){var e,t=[];this.forEach((function(r,n){0!==n&&r===e||(t.push(r),e=r)})),t.forEach((function(e,t){a[t]=e}));for(var n=t.length;r>n;)this.popBack()},this.sort=function(e){a.sort(e)},this[Symbol.iterator]=function(){return function(){return n(this,(function(e){switch(e.label){case 0:return[5,o(a)];case 1:return[2,e.sent()]}}))}()},e.forEach((function(e){return t.pushBack(e)})),Object.freeze(this)}Object.defineProperty(r,"__esModule",{value:!0}),Object.freeze(a),r.default=a},{}],36:[function(e,t,r){Object.defineProperty(r,"__esModule",{value:!0}),r.HashMap=r.HashSet=r.Map=r.Set=r.PriorityQueue=r.Deque=r.LinkList=r.Queue=r.Stack=r.Vector=void 0;var n=e("./Vector/Vector");r.Vector=n.default;var s=e("./Stack/Stack");r.Stack=s.default;var i=e("./Queue/Queue");r.Queue=i.default;var o=e("./LinkList/LinkList");r.LinkList=o.default;var a=e("./Deque/Deque");r.Deque=a.default;var l=e("./PriorityQueue/PriorityQueue");r.PriorityQueue=l.default;var c=e("./Set/Set");r.Set=c.default;var u=e("./Map/Map");r.Map=u.default;var d=e("./HashSet/HashSet");r.HashSet=d.default;var h=e("./HashMap/HashMap");r.HashMap=h.default},{"./Deque/Deque":26,"./HashMap/HashMap":27,"./HashSet/HashSet":28,"./LinkList/LinkList":29,"./Map/Map":30,"./PriorityQueue/PriorityQueue":31,"./Queue/Queue":32,"./Set/Set":33,"./Stack/Stack":34,"./Vector/Vector":35}],37:[function(e,t,r){const n=e("yallist"),s=Symbol("max"),i=Symbol("length"),o=Symbol("lengthCalculator"),a=Symbol("allowStale"),l=Symbol("maxAge"),c=Symbol("dispose"),u=Symbol("noDisposeOnSet"),d=Symbol("lruList"),h=Symbol("cache"),f=Symbol("updateAgeOnGet"),p=()=>1;class g{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[s]=e.max||1/0;const t=e.length||p;if(this[o]="function"!=typeof t?p:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[l]=e.maxAge||0,this[c]=e.dispose,this[u]=e.noDisposeOnSet||!1,this[f]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[s]=e||1/0,v(this)}get max(){return this[s]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[l]=e,v(this)}get maxAge(){return this[l]}set lengthCalculator(e){"function"!=typeof e&&(e=p),e!==this[o]&&(this[o]=e,this[i]=0,this[d].forEach((e=>{e.length=this[o](e.value,e.key),this[i]+=e.length}))),v(this)}get lengthCalculator(){return this[o]}get length(){return this[i]}get itemCount(){return this[d].length}rforEach(e,t){t=t||this;for(let r=this[d].tail;null!==r;){const n=r.prev;E(this,e,r,t),r=n}}forEach(e,t){t=t||this;for(let r=this[d].head;null!==r;){const n=r.next;E(this,e,r,t),r=n}}keys(){return this[d].toArray().map((e=>e.key))}values(){return this[d].toArray().map((e=>e.value))}reset(){this[c]&&this[d]&&this[d].length&&this[d].forEach((e=>this[c](e.key,e.value))),this[h]=new Map,this[d]=new n,this[i]=0}dump(){return this[d].map((e=>!y(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[d]}set(e,t,r){if((r=r||this[l])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const n=r?Date.now():0,a=this[o](t,e);if(this[h].has(e)){if(a>this[s])return b(this,this[h].get(e)),!1;const o=this[h].get(e).value;return this[c]&&(this[u]||this[c](e,o.value)),o.now=n,o.maxAge=r,o.value=t,this[i]+=a-o.length,o.length=a,this.get(e),v(this),!0}const f=new w(e,t,a,n,r);return f.length>this[s]?(this[c]&&this[c](e,t),!1):(this[i]+=f.length,this[d].unshift(f),this[h].set(e,this[d].head),v(this),!0)}has(e){if(!this[h].has(e))return!1;const t=this[h].get(e).value;return!y(this,t)}get(e){return m(this,e,!0)}peek(e){return m(this,e,!1)}pop(){const e=this[d].tail;return e?(b(this,e),e.value):null}del(e){b(this,this[h].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const n=e[r],s=n.e||0;if(0===s)this.set(n.k,n.v);else{const e=s-t;e>0&&this.set(n.k,n.v,e)}}}prune(){this[h].forEach(((e,t)=>m(this,t,!1)))}}const m=(e,t,r)=>{const n=e[h].get(t);if(n){const t=n.value;if(y(e,t)){if(b(e,n),!e[a])return}else r&&(e[f]&&(n.value.now=Date.now()),e[d].unshiftNode(n));return t.value}},y=(e,t)=>{if(!t||!t.maxAge&&!e[l])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[l]&&r>e[l]},v=e=>{if(e[i]>e[s])for(let t=e[d].tail;e[i]>e[s]&&null!==t;){const r=t.prev;b(e,t),t=r}},b=(e,t)=>{if(t){const r=t.value;e[c]&&e[c](r.key,r.value),e[i]-=r.length,e[h].delete(r.key),e[d].removeNode(t)}};class w{constructor(e,t,r,n,s){this.key=e,this.value=t,this.length=r,this.now=n,this.maxAge=s||0}}const E=(e,t,r,n)=>{let s=r.value;y(e,s)&&(b(e,r),e[a]||(s=void 0)),s&&t.call(n,s.value,s.key,e)};t.exports=g},{yallist:83}],38:[function(e,t,r){(function(e){(function(){const r=t.exports;r.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"},r.codes={};for(const e in r.types){const t=r.types[e];r.codes[t]=e}r.CMD_SHIFT=4,r.CMD_MASK=240,r.DUP_MASK=8,r.QOS_MASK=3,r.QOS_SHIFT=1,r.RETAIN_MASK=1,r.VARBYTEINT_MASK=127,r.VARBYTEINT_FIN_MASK=128,r.VARBYTEINT_MAX=268435455,r.SESSIONPRESENT_MASK=1,r.SESSIONPRESENT_HEADER=e.from([r.SESSIONPRESENT_MASK]),r.CONNACK_HEADER=e.from([r.codes.connack<<r.CMD_SHIFT]),r.USERNAME_MASK=128,r.PASSWORD_MASK=64,r.WILL_RETAIN_MASK=32,r.WILL_QOS_MASK=24,r.WILL_QOS_SHIFT=3,r.WILL_FLAG_MASK=4,r.CLEAN_SESSION_MASK=2,r.CONNECT_HEADER=e.from([r.codes.connect<<r.CMD_SHIFT]),r.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},r.propertiesCodes={};for(const e in r.properties){const t=r.properties[e];r.propertiesCodes[t]=e}function n(t){return[0,1,2].map((n=>[0,1].map((s=>[0,1].map((i=>{const o=e.alloc(1);return o.writeUInt8(r.codes[t]<<r.CMD_SHIFT|(s?r.DUP_MASK:0)|n<<r.QOS_SHIFT|i,0,!0),o}))))))}r.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"},r.PUBLISH_HEADER=n("publish"),r.SUBSCRIBE_HEADER=n("subscribe"),r.SUBSCRIBE_OPTIONS_QOS_MASK=3,r.SUBSCRIBE_OPTIONS_NL_MASK=1,r.SUBSCRIBE_OPTIONS_NL_SHIFT=2,r.SUBSCRIBE_OPTIONS_RAP_MASK=1,r.SUBSCRIBE_OPTIONS_RAP_SHIFT=3,r.SUBSCRIBE_OPTIONS_RH_MASK=3,r.SUBSCRIBE_OPTIONS_RH_SHIFT=4,r.SUBSCRIBE_OPTIONS_RH=[0,16,32],r.SUBSCRIBE_OPTIONS_NL=4,r.SUBSCRIBE_OPTIONS_RAP=8,r.SUBSCRIBE_OPTIONS_QOS=[0,1,2],r.UNSUBSCRIBE_HEADER=n("unsubscribe"),r.ACKS={unsuback:n("unsuback"),puback:n("puback"),pubcomp:n("pubcomp"),pubrel:n("pubrel"),pubrec:n("pubrec")},r.SUBACK_HEADER=e.from([r.codes.suback<<r.CMD_SHIFT]),r.VERSION3=e.from([3]),r.VERSION4=e.from([4]),r.VERSION5=e.from([5]),r.VERSION131=e.from([131]),r.VERSION132=e.from([132]),r.QOS=[0,1,2].map((t=>e.from([t]))),r.EMPTY={pingreq:e.from([r.codes.pingreq<<4,0]),pingresp:e.from([r.codes.pingresp<<4,0]),disconnect:e.from([r.codes.disconnect<<4,0])}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17}],39:[function(e,t,r){(function(r){(function(){const n=e("./writeToStream"),s=e("events");function i(e,t){const r=new o;return n(e,r,t),r.concat()}class o extends s{constructor(){super(),this._array=new Array(20),this._i=0}write(e){return this._array[this._i++]=e,!0}concat(){let e=0;const t=new Array(this._array.length),n=this._array;let s,i=0;for(s=0;s<n.length&&void 0!==n[s];s++)"string"!=typeof n[s]?t[s]=n[s].length:t[s]=r.byteLength(n[s]),e+=t[s];const o=r.allocUnsafe(e);for(s=0;s<n.length&&void 0!==n[s];s++)"string"!=typeof n[s]?(n[s].copy(o,i),i+=t[s]):(o.write(n[s],i),i+=t[s]);return o}}t.exports=i}).call(this)}).call(this,e("buffer").Buffer)},{"./writeToStream":44,buffer:17,events:22}],40:[function(e,t,r){r.parser=e("./parser").parser,r.generate=e("./generate"),r.writeToStream=e("./writeToStream")},{"./generate":39,"./parser":43,"./writeToStream":44}],41:[function(e,t,r){(function(e){(function(){const r=65536,n={},s=e.isBuffer(e.from([1,2]).subarray(0,1));function i(t){const r=e.allocUnsafe(2);return r.writeUInt8(t>>8,0),r.writeUInt8(255&t,1),r}function o(){for(let e=0;e<r;e++)n[e]=i(e)}function a(t){const r=4;let n=0,i=0;const o=e.allocUnsafe(r);do{n=t%128|0,(t=t/128|0)>0&&(n|=128),o.writeUInt8(n,i++)}while(t>0&&i<r);return t>0&&(i=0),s?o.subarray(0,i):o.slice(0,i)}function l(t){const r=e.allocUnsafe(4);return r.writeUInt32BE(t,0),r}t.exports={cache:n,generateCache:o,generateNumber:i,genBufVariableByteInt:a,generate4ByteBuffer:l}}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17}],42:[function(e,t,r){class n{constructor(){this.cmd=null,this.retain=!1,this.qos=0,this.dup=!1,this.length=-1,this.topic=null,this.payload=null}}t.exports=n},{}],43:[function(e,t,r){const n=e("bl"),s=e("events"),i=e("./packet"),o=e("./constants"),a=e("debug")("mqtt-packet:parser");class l extends s{constructor(){super(),this.parser=this.constructor.parser}static parser(e){return this instanceof l?(this.settings=e||{},this._states=["_parseHeader","_parseLength","_parsePayload","_newPacket"],this._resetState(),this):(new l).parser(e)}_resetState(){a("_resetState: resetting packet, error, _list, and _stateCounter"),this.packet=new i,this.error=null,this._list=n(),this._stateCounter=0}parse(e){for(this.error&&this._resetState(),this._list.append(e),a("parse: current state: %s",this._states[this._stateCounter]);(-1!==this.packet.length||this._list.length>0)&&this[this._states[this._stateCounter]]()&&!this.error;)this._stateCounter++,a("parse: state complete. _stateCounter is now: %d",this._stateCounter),a("parse: packet.length: %d, buffer list length: %d",this.packet.length,this._list.length),this._stateCounter>=this._states.length&&(this._stateCounter=0);return a("parse: exited while loop. packet: %d, buffer list length: %d",this.packet.length,this._list.length),this._list.length}_parseHeader(){const e=this._list.readUInt8(0);return this.packet.cmd=o.types[e>>o.CMD_SHIFT],this.packet.retain=0!=(e&o.RETAIN_MASK),this.packet.qos=e>>o.QOS_SHIFT&o.QOS_MASK,this.packet.dup=0!=(e&o.DUP_MASK),a("_parseHeader: packet: %o",this.packet),this._list.consume(1),!0}_parseLength(){const e=this._parseVarByteNum(!0);return e&&(this.packet.length=e.value,this._list.consume(e.bytes)),a("_parseLength %d",e.value),!!e}_parsePayload(){a("_parsePayload: payload %O",this._list);let e=!1;if(0===this.packet.length||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 a("_parsePayload complete result: %s",e),e}_parseConnect(){let e,t,r,n;a("_parseConnect");const s={},i=this.packet,l=this._parseString();if(null===l)return this._emitError(new Error("Cannot parse protocolId"));if("MQTT"!==l&&"MQIsdp"!==l)return this._emitError(new Error("Invalid protocolId"));if(i.protocolId=l,this._pos>=this._list.length)return this._emitError(new Error("Packet too short"));if(i.protocolVersion=this._list.readUInt8(this._pos),i.protocolVersion>=128&&(i.bridgeMode=!0,i.protocolVersion=i.protocolVersion-128),3!==i.protocolVersion&&4!==i.protocolVersion&&5!==i.protocolVersion)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(s.username=this._list.readUInt8(this._pos)&o.USERNAME_MASK,s.password=this._list.readUInt8(this._pos)&o.PASSWORD_MASK,s.will=this._list.readUInt8(this._pos)&o.WILL_FLAG_MASK,s.will&&(i.will={},i.will.retain=0!=(this._list.readUInt8(this._pos)&o.WILL_RETAIN_MASK),i.will.qos=(this._list.readUInt8(this._pos)&o.WILL_QOS_MASK)>>o.WILL_QOS_SHIFT),i.clean=0!=(this._list.readUInt8(this._pos)&o.CLEAN_SESSION_MASK),this._pos++,i.keepalive=this._parseNum(),-1===i.keepalive)return this._emitError(new Error("Packet too short"));if(5===i.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(i.properties=e)}const c=this._parseString();if(null===c)return this._emitError(new Error("Packet too short"));if(i.clientId=c,a("_parseConnect: packet.clientId: %s",i.clientId),s.will){if(5===i.protocolVersion){const e=this._parseProperties();Object.getOwnPropertyNames(e).length&&(i.will.properties=e)}if(e=this._parseString(),null===e)return this._emitError(new Error("Cannot parse will topic"));if(i.will.topic=e,a("_parseConnect: packet.will.topic: %s",i.will.topic),t=this._parseBuffer(),null===t)return this._emitError(new Error("Cannot parse will payload"));i.will.payload=t,a("_parseConnect: packet.will.paylaod: %s",i.will.payload)}if(s.username){if(n=this._parseString(),null===n)return this._emitError(new Error("Cannot parse username"));i.username=n,a("_parseConnect: packet.username: %s",i.username)}if(s.password){if(r=this._parseBuffer(),null===r)return this._emitError(new Error("Cannot parse password"));i.password=r}return this.settings=i,a("_parseConnect: complete"),i}_parseConnack(){a("_parseConnack");const e=this.packet;if(this._list.length<1)return null;if(e.sessionPresent=!!(this._list.readUInt8(this._pos++)&o.SESSIONPRESENT_MASK),5===this.settings.protocolVersion)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(-1===e.returnCode||-1===e.reasonCode)return this._emitError(new Error("Cannot parse return code"));if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}a("_parseConnack: complete")}_parsePublish(){a("_parsePublish");const e=this.packet;if(e.topic=this._parseString(),null===e.topic)return this._emitError(new Error("Cannot parse topic"));if(!(e.qos>0)||this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}e.payload=this._list.slice(this._pos,e.length),a("_parsePublish: payload from buffer list: %o",e.payload)}}_parseSubscribe(){a("_parseSubscribe");const e=this.packet;let t,r,n,s,i,l,c;if(1!==e.qos)return this._emitError(new Error("Wrong subscribe header"));if(e.subscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){if(t=this._parseString(),null===t)return this._emitError(new Error("Cannot parse topic"));if(this._pos>=e.length)return this._emitError(new Error("Malformed Subscribe Payload"));r=this._parseByte(),n=r&o.SUBSCRIBE_OPTIONS_QOS_MASK,l=0!=(r>>o.SUBSCRIBE_OPTIONS_NL_SHIFT&o.SUBSCRIBE_OPTIONS_NL_MASK),i=0!=(r>>o.SUBSCRIBE_OPTIONS_RAP_SHIFT&o.SUBSCRIBE_OPTIONS_RAP_MASK),s=r>>o.SUBSCRIBE_OPTIONS_RH_SHIFT&o.SUBSCRIBE_OPTIONS_RH_MASK,c={topic:t,qos:n},5===this.settings.protocolVersion?(c.nl=l,c.rap=i,c.rh=s):this.settings.bridgeMode&&(c.rh=0,c.rap=!0,c.nl=!0),a("_parseSubscribe: push subscription `%s` to subscription",c),e.subscriptions.push(c)}}}_parseSuback(){a("_parseSuback");const e=this.packet;if(this.packet.granted=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const 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(){a("_parseUnsubscribe");const e=this.packet;if(e.unsubscriptions=[],this._parseMessageId()){if(5===this.settings.protocolVersion){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}for(;this._pos<e.length;){const t=this._parseString();if(null===t)return this._emitError(new Error("Cannot parse topic"));a("_parseUnsubscribe: push topic `%s` to unsubscriptions",t),e.unsubscriptions.push(t)}}}_parseUnsuback(){a("_parseUnsuback");const e=this.packet;if(!this._parseMessageId())return this._emitError(new Error("Cannot parse messageId"));if(5===this.settings.protocolVersion){const 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(){a("_parseConfirmation: packet.cmd: `%s`",this.packet.cmd);const e=this.packet;if(this._parseMessageId(),5===this.settings.protocolVersion&&(e.length>2?(e.reasonCode=this._parseByte(),a("_parseConfirmation: packet.reasonCode `%d`",e.reasonCode)):e.reasonCode=0,e.length>3)){const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return!0}_parseDisconnect(){const e=this.packet;if(a("_parseDisconnect"),5===this.settings.protocolVersion){this._list.length>0?e.reasonCode=this._parseByte():e.reasonCode=0;const t=this._parseProperties();Object.getOwnPropertyNames(t).length&&(e.properties=t)}return a("_parseDisconnect result: true"),!0}_parseAuth(){a("_parseAuth");const e=this.packet;if(5!==this.settings.protocolVersion)return this._emitError(new Error("Not supported auth packet for this version MQTT"));e.reasonCode=this._parseByte();const t=this._parseProperties();return Object.getOwnPropertyNames(t).length&&(e.properties=t),a("_parseAuth: result: true"),!0}_parseMessageId(){const e=this.packet;return e.messageId=this._parseNum(),null===e.messageId?(this._emitError(new Error("Cannot parse messageId")),!1):(a("_parseMessageId: packet.messageId %d",e.messageId),!0)}_parseString(e){const t=this._parseNum(),r=t+this._pos;if(-1===t||r>this._list.length||r>this.packet.length)return null;const n=this._list.toString("utf8",this._pos,r);return this._pos+=t,a("_parseString: result: %s",n),n}_parseStringPair(){return a("_parseStringPair"),{name:this._parseString(),value:this._parseString()}}_parseBuffer(){const e=this._parseNum(),t=e+this._pos;if(-1===e||t>this._list.length||t>this.packet.length)return null;const r=this._list.slice(this._pos,t);return this._pos+=e,a("_parseBuffer: result: %o",r),r}_parseNum(){if(this._list.length-this._pos<2)return-1;const e=this._list.readUInt16BE(this._pos);return this._pos+=2,a("_parseNum: result: %s",e),e}_parse4ByteNum(){if(this._list.length-this._pos<4)return-1;const e=this._list.readUInt32BE(this._pos);return this._pos+=4,a("_parse4ByteNum: result: %s",e),e}_parseVarByteNum(e){a("_parseVarByteNum");const t=4;let r,n=0,s=1,i=0,l=!1;const c=this._pos?this._pos:0;for(;n<t&&c+n<this._list.length;){if(r=this._list.readUInt8(c+n++),i+=s*(r&o.VARBYTEINT_MASK),s*=128,0==(r&o.VARBYTEINT_FIN_MASK)){l=!0;break}if(this._list.length<=n)break}return!l&&n===t&&this._list.length>=n&&this._emitError(new Error("Invalid variable byte integer")),c&&(this._pos+=n),l=!!l&&(e?{bytes:n,value:i}:i),a("_parseVarByteNum: result: %o",l),l}_parseByte(){let e;return this._pos<this._list.length&&(e=this._list.readUInt8(this._pos),this._pos++),a("_parseByte: result: %o",e),e}_parseByType(e){switch(a("_parseByType: type: %s",e),e){case"byte":return 0!==this._parseByte();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(){a("_parseProperties");const e=this._parseVarByteNum(),t=this._pos+e,r={};for(;this._pos<t;){const e=this._parseByte();if(!e)return this._emitError(new Error("Cannot parse property code type")),!1;const t=o.propertiesCodes[e];if(!t)return this._emitError(new Error("Unknown property")),!1;if("userProperties"!==t)r[t]?(Array.isArray(r[t])||(r[t]=[r[t]]),r[t].push(this._parseByType(o.propertiesTypes[t]))):r[t]=this._parseByType(o.propertiesTypes[t]);else{r[t]||(r[t]=Object.create(null));const e=this._parseByType(o.propertiesTypes[t]);if(r[t][e.name])if(Array.isArray(r[t][e.name]))r[t][e.name].push(e.value);else{const n=r[t][e.name];r[t][e.name]=[n],r[t][e.name].push(e.value)}else r[t][e.name]=e.value}}return r}_newPacket(){return a("_newPacket"),this.packet&&(this._list.consume(this.packet.length),a("_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)),a("_newPacket: new packet"),this.packet=new i,this._pos=0,!0}_emitError(e){a("_emitError"),this.error=e,this.emit("error",e)}}t.exports=l},{"./constants":38,"./packet":42,bl:15,debug:18,events:22}],44:[function(e,t,r){(function(r){(function(){const n=e("./constants"),s=r.allocUnsafe(0),i=r.from([0]),o=e("./numbers"),a=e("process-nextick-args").nextTick,l=e("debug")("mqtt-packet:writeToStream"),c=o.cache,u=o.generateNumber,d=o.generateCache,h=o.genBufVariableByteInt,f=o.generate4ByteBuffer;let p=O,g=!0;function m(e,t,r){switch(l("generate called"),t.cork&&(t.cork(),a(y,t)),g&&(g=!1,d()),l("generate: packet.cmd: %s",e.cmd),e.cmd){case"connect":return v(e,t);case"connack":return b(e,t,r);case"publish":return w(e,t,r);case"puback":case"pubrec":case"pubrel":case"pubcomp":return E(e,t,r);case"subscribe":return T(e,t,r);case"suback":return S(e,t,r);case"unsubscribe":return C(e,t,r);case"unsuback":return _(e,t,r);case"pingreq":case"pingresp":return k(e,t);case"disconnect":return A(e,t,r);case"auth":return I(e,t,r);default:return t.emit("error",new Error("Unknown command")),!1}}function y(e){e.uncork()}function v(e,t,s){const i=e||{},o=i.protocolId||"MQTT";let a=i.protocolVersion||4;const l=i.will;let c=i.clean;const u=i.keepalive||0,d=i.clientId||"",h=i.username,f=i.password,g=i.properties;void 0===c&&(c=!0);let m=0;if(!o||"string"!=typeof o&&!r.isBuffer(o))return t.emit("error",new Error("Invalid protocolId")),!1;if(m+=o.length+2,3!==a&&4!==a&&5!==a)return t.emit("error",new Error("Invalid protocol version")),!1;if(m+=1,("string"==typeof d||r.isBuffer(d))&&(d||a>=4)&&(d||c))m+=r.byteLength(d)+2;else{if(a<4)return t.emit("error",new Error("clientId must be supplied before 3.1.1")),!1;if(1*c==0)return t.emit("error",new Error("clientId must be given if cleanSession set to 0")),!1}if("number"!=typeof u||u<0||u>65535||u%1!=0)return t.emit("error",new Error("Invalid keepalive")),!1;if(m+=2,m+=1,5===a){var y=N(t,g);if(!y)return!1;m+=y.length}if(l){if("object"!=typeof l)return t.emit("error",new Error("Invalid will")),!1;if(!l.topic||"string"!=typeof l.topic)return t.emit("error",new Error("Invalid will topic")),!1;if(m+=r.byteLength(l.topic)+2,m+=2,l.payload){if(!(l.payload.length>=0))return t.emit("error",new Error("Invalid will payload")),!1;"string"==typeof l.payload?m+=r.byteLength(l.payload):m+=l.payload.length}var v={};if(5===a){if(!(v=N(t,l.properties)))return!1;m+=v.length}}let b=!1;if(null!=h){if(!q(h))return t.emit("error",new Error("Invalid username")),!1;b=!0,m+=r.byteLength(h)+2}if(null!=f){if(!b)return t.emit("error",new Error("Username is required to use password")),!1;if(!q(f))return t.emit("error",new Error("Invalid password")),!1;m+=$(f)+2}t.write(n.CONNECT_HEADER),L(t,m),F(t,o),i.bridgeMode&&(a+=128),t.write(131===a?n.VERSION131:132===a?n.VERSION132:4===a?n.VERSION4:5===a?n.VERSION5:n.VERSION3);let w=0;return w|=null!=h?n.USERNAME_MASK:0,w|=null!=f?n.PASSWORD_MASK:0,w|=l&&l.retain?n.WILL_RETAIN_MASK:0,w|=l&&l.qos?l.qos<<n.WILL_QOS_SHIFT:0,w|=l?n.WILL_FLAG_MASK:0,w|=c?n.CLEAN_SESSION_MASK:0,t.write(r.from([w])),p(t,u),5===a&&y.write(),F(t,d),l&&(5===a&&v.write(),D(t,l.topic),F(t,l.payload)),null!=h&&F(t,h),null!=f&&F(t,f),!0}function b(e,t,s){const o=s?s.protocolVersion:4,a=e||{},l=5===o?a.reasonCode:a.returnCode,c=a.properties;let u=2;if("number"!=typeof l)return t.emit("error",new Error("Invalid return code")),!1;let d=null;if(5===o){if(d=N(t,c),!d)return!1;u+=d.length}return t.write(n.CONNACK_HEADER),L(t,u),t.write(a.sessionPresent?n.SESSIONPRESENT_HEADER:i),t.write(r.from([l])),null!=d&&d.write(),!0}function w(e,t,i){l("publish: packet: %o",e);const o=i?i.protocolVersion:4,a=e||{},c=a.qos||0,u=a.retain?n.RETAIN_MASK:0,d=a.topic,h=a.payload||s,f=a.messageId,g=a.properties;let m=0;if("string"==typeof d)m+=r.byteLength(d)+2;else{if(!r.isBuffer(d))return t.emit("error",new Error("Invalid topic")),!1;m+=d.length+2}if(r.isBuffer(h)?m+=h.length:m+=r.byteLength(h),c&&"number"!=typeof f)return t.emit("error",new Error("Invalid messageId")),!1;c&&(m+=2);let y=null;if(5===o){if(y=N(t,g),!y)return!1;m+=y.length}return t.write(n.PUBLISH_HEADER[c][a.dup?1:0][u?1:0]),L(t,m),p(t,$(d)),t.write(d),c>0&&p(t,f),null!=y&&y.write(),l("publish: payload: %o",h),t.write(h)}function E(e,t,s){const i=s?s.protocolVersion:4,o=e||{},a=o.cmd||"puback",l=o.messageId,c=o.dup&&"pubrel"===a?n.DUP_MASK:0;let u=0;const d=o.reasonCode,h=o.properties;let f=5===i?3:2;if("pubrel"===a&&(u=1),"number"!=typeof l)return t.emit("error",new Error("Invalid messageId")),!1;let g=null;if(5===i&&"object"==typeof h){if(g=U(t,h,s,f),!g)return!1;f+=g.length}return t.write(n.ACKS[a][u][c][0]),L(t,f),p(t,l),5===i&&t.write(r.from([d])),null!==g&&g.write(),!0}function T(e,t,s){l("subscribe: packet: ");const i=s?s.protocolVersion:4,o=e||{},a=o.dup?n.DUP_MASK:0,c=o.messageId,u=o.subscriptions,d=o.properties;let h=0;if("number"!=typeof c)return t.emit("error",new Error("Invalid messageId")),!1;h+=2;let f=null;if(5===i){if(f=N(t,d),!f)return!1;h+=f.length}if("object"!=typeof u||!u.length)return t.emit("error",new Error("Invalid subscriptions")),!1;for(let e=0;e<u.length;e+=1){const n=u[e].topic,s=u[e].qos;if("string"!=typeof n)return t.emit("error",new Error("Invalid subscriptions - invalid topic")),!1;if("number"!=typeof s)return t.emit("error",new Error("Invalid subscriptions - invalid qos")),!1;if(5===i){if("boolean"!=typeof(u[e].nl||!1))return t.emit("error",new Error("Invalid subscriptions - invalid No Local")),!1;if("boolean"!=typeof(u[e].rap||!1))return t.emit("error",new Error("Invalid subscriptions - invalid Retain as Published")),!1;const r=u[e].rh||0;if("number"!=typeof r||r>2)return t.emit("error",new Error("Invalid subscriptions - invalid Retain Handling")),!1}h+=r.byteLength(n)+2+1}l("subscribe: writing to stream: %o",n.SUBSCRIBE_HEADER),t.write(n.SUBSCRIBE_HEADER[1][a?1:0][0]),L(t,h),p(t,c),null!==f&&f.write();let g=!0;for(const e of u){const s=e.topic,o=e.qos,a=+e.nl,l=+e.rap,c=e.rh;let u;D(t,s),u=n.SUBSCRIBE_OPTIONS_QOS[o],5===i&&(u|=a?n.SUBSCRIBE_OPTIONS_NL:0,u|=l?n.SUBSCRIBE_OPTIONS_RAP:0,u|=c?n.SUBSCRIBE_OPTIONS_RH[c]:0),g=t.write(r.from([u]))}return g}function S(e,t,s){const i=s?s.protocolVersion:4,o=e||{},a=o.messageId,l=o.granted,c=o.properties;let u=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;if(u+=2,"object"!=typeof l||!l.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<l.length;e+=1){if("number"!=typeof l[e])return t.emit("error",new Error("Invalid qos vector")),!1;u+=1}let d=null;if(5===i){if(d=U(t,c,s,u),!d)return!1;u+=d.length}return t.write(n.SUBACK_HEADER),L(t,u),p(t,a),null!==d&&d.write(),t.write(r.from(l))}function C(e,t,s){const i=s?s.protocolVersion:4,o=e||{},a=o.messageId,l=o.dup?n.DUP_MASK:0,c=o.unsubscriptions,u=o.properties;let d=0;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;if(d+=2,"object"!=typeof c||!c.length)return t.emit("error",new Error("Invalid unsubscriptions")),!1;for(let e=0;e<c.length;e+=1){if("string"!=typeof c[e])return t.emit("error",new Error("Invalid unsubscriptions")),!1;d+=r.byteLength(c[e])+2}let h=null;if(5===i){if(h=N(t,u),!h)return!1;d+=h.length}t.write(n.UNSUBSCRIBE_HEADER[1][l?1:0][0]),L(t,d),p(t,a),null!==h&&h.write();let f=!0;for(let e=0;e<c.length;e++)f=D(t,c[e]);return f}function _(e,t,s){const i=s?s.protocolVersion:4,o=e||{},a=o.messageId,l=o.dup?n.DUP_MASK:0,c=o.granted,u=o.properties,d=o.cmd,h=0;let f=2;if("number"!=typeof a)return t.emit("error",new Error("Invalid messageId")),!1;if(5===i){if("object"!=typeof c||!c.length)return t.emit("error",new Error("Invalid qos vector")),!1;for(let e=0;e<c.length;e+=1){if("number"!=typeof c[e])return t.emit("error",new Error("Invalid qos vector")),!1;f+=1}}let g=null;if(5===i){if(g=U(t,u,s,f),!g)return!1;f+=g.length}return t.write(n.ACKS[d][h][l][0]),L(t,f),p(t,a),null!==g&&g.write(),5===i&&t.write(r.from(c)),!0}function k(e,t,r){return t.write(n.EMPTY[e.cmd])}function A(e,t,s){const i=s?s.protocolVersion:4,o=e||{},a=o.reasonCode,l=o.properties;let c=5===i?1:0,u=null;if(5===i){if(u=U(t,l,s,c),!u)return!1;c+=u.length}return t.write(r.from([n.codes.disconnect<<4])),L(t,c),5===i&&t.write(r.from([a])),null!==u&&u.write(),!0}function I(e,t,s){const i=s?s.protocolVersion:4,o=e||{},a=o.reasonCode,l=o.properties;let c=5===i?1:0;5!==i&&t.emit("error",new Error("Invalid mqtt version for auth packet"));const u=U(t,l,s,c);return!!u&&(c+=u.length,t.write(r.from([n.codes.auth<<4])),L(t,c),t.write(r.from([a])),null!==u&&u.write(),!0)}Object.defineProperty(m,"cacheNumbers",{get:()=>p===O,set(e){e?(c&&0!==Object.keys(c).length||(g=!0),p=O):(g=!1,p=P)}});const R={};function L(e,t){if(t>n.VARBYTEINT_MAX)return e.emit("error",new Error(`Invalid variable byte integer: ${t}`)),!1;let r=R[t];return r||(r=h(t),t<16384&&(R[t]=r)),l("writeVarByteInt: writing to stream: %o",r),e.write(r)}function D(e,t){const n=r.byteLength(t);return p(e,n),l("writeString: %s",t),e.write(t,"utf8")}function x(e,t,r){D(e,t),D(e,r)}function O(e,t){return l("writeNumberCached: number: %d",t),l("writeNumberCached: %o",c[t]),e.write(c[t])}function P(e,t){const r=u(t);return l("writeNumberGenerated: %o",r),e.write(r)}function M(e,t){const r=f(t);return l("write4ByteNumber: %o",r),e.write(r)}function F(e,t){"string"==typeof t?D(e,t):t?(p(e,t.length),e.write(t)):p(e,0)}function N(e,t){if("object"!=typeof t||null!=t.length)return{length:1,write(){j(e,{},0)}};let s=0;function i(t,s){let i=0;switch(n.propertiesTypes[t]){case"byte":if("boolean"!=typeof s)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=2;break;case"int8":if("number"!=typeof s||s<0||s>255)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=2;break;case"binary":if(s&&null===s)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=1+r.byteLength(s)+2;break;case"int16":if("number"!=typeof s||s<0||s>65535)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=3;break;case"int32":if("number"!=typeof s||s<0||s>4294967295)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=5;break;case"var":if("number"!=typeof s||s<0||s>268435455)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=1+r.byteLength(h(s));break;case"string":if("string"!=typeof s)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=3+r.byteLength(s.toString());break;case"pair":if("object"!=typeof s)return e.emit("error",new Error(`Invalid ${t}: ${s}`)),!1;i+=Object.getOwnPropertyNames(s).reduce(((e,t)=>{const n=s[t];return Array.isArray(n)?e+=n.reduce(((e,n)=>e+=3+r.byteLength(t.toString())+2+r.byteLength(n.toString())),0):e+=3+r.byteLength(t.toString())+2+r.byteLength(s[t].toString()),e}),0);break;default:return e.emit("error",new Error(`Invalid property ${t}: ${s}`)),!1}return i}if(t)for(const e in t){let r=0,n=0;const o=t[e];if(Array.isArray(o))for(let t=0;t<o.length;t++){if(n=i(e,o[t]),!n)return!1;r+=n}else{if(n=i(e,o),!n)return!1;r=n}if(!r)return!1;s+=r}return{length:r.byteLength(h(s))+s,write(){j(e,t,s)}}}function U(e,t,r,n){const s=["reasonString","userProperties"],i=r&&r.properties&&r.properties.maximumPacketSize?r.properties.maximumPacketSize:0;let o=N(e,t);if(i)for(;n+o.length>i;){const r=s.shift();if(!r||!t[r])return!1;delete t[r],o=N(e,t)}return o}function B(e,t,s){switch(n.propertiesTypes[t]){case"byte":e.write(r.from([n.properties[t]])),e.write(r.from([+s]));break;case"int8":e.write(r.from([n.properties[t]])),e.write(r.from([s]));break;case"binary":e.write(r.from([n.properties[t]])),F(e,s);break;case"int16":e.write(r.from([n.properties[t]])),p(e,s);break;case"int32":e.write(r.from([n.properties[t]])),M(e,s);break;case"var":e.write(r.from([n.properties[t]])),L(e,s);break;case"string":e.write(r.from([n.properties[t]])),D(e,s);break;case"pair":Object.getOwnPropertyNames(s).forEach((i=>{const o=s[i];Array.isArray(o)?o.forEach((s=>{e.write(r.from([n.properties[t]])),x(e,i.toString(),s.toString())})):(e.write(r.from([n.properties[t]])),x(e,i.toString(),o.toString()))}));break;default:return e.emit("error",new Error(`Invalid property ${t} value: ${s}`)),!1}}function j(e,t,r){L(e,r);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&null!==t[r]){const n=t[r];if(Array.isArray(n))for(let t=0;t<n.length;t++)B(e,r,n[t]);else B(e,r,n)}}function $(e){return e?e instanceof r?e.length:r.byteLength(e):0}function q(e){return"string"==typeof e||e instanceof r}t.exports=m}).call(this)}).call(this,e("buffer").Buffer)},{"./constants":38,"./numbers":41,buffer:17,debug:18,"process-nextick-args":49}],45:[function(e,t,r){var n=1e3,s=60*n,i=60*s,o=24*i,a=7*o,l=365.25*o;function c(e){if(!((e=String(e)).length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*l;case"weeks":case"week":case"w":return r*a;case"days":case"day":case"d":return r*o;case"hours":case"hour":case"hrs":case"hr":case"h":return r*i;case"minutes":case"minute":case"mins":case"min":case"m":return r*s;case"seconds":case"second":case"secs":case"sec":case"s":return r*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function u(e){var t=Math.abs(e);return t>=o?Math.round(e/o)+"d":t>=i?Math.round(e/i)+"h":t>=s?Math.round(e/s)+"m":t>=n?Math.round(e/n)+"s":e+"ms"}function d(e){var t=Math.abs(e);return t>=o?h(e,t,o,"day"):t>=i?h(e,t,i,"hour"):t>=s?h(e,t,s,"minute"):t>=n?h(e,t,n,"second"):e+" ms"}function h(e,t,r,n){var s=t>=1.5*r;return Math.round(e/r)+" "+n+(s?"s":"")}t.exports=function(e,t){t=t||{};var r=typeof e;if("string"===r&&e.length>0)return c(e);if("number"===r&&isFinite(e))return t.long?d(e):u(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},{}],46:[function(e,t,r){const n=e("./lib/number-allocator.js");t.exports.NumberAllocator=n},{"./lib/number-allocator.js":47}],47:[function(e,t,r){const n=e("js-sdsl").Set,s=e("debug")("number-allocator:trace"),i=e("debug")("number-allocator:error");function o(e,t){this.low=e,this.high=t}function a(e,t){if(!(this instanceof a))return new a(e,t);this.min=e,this.max=t,this.ss=new n([],((e,t)=>e.compare(t))),s("Create"),this.clear()}o.prototype.equals=function(e){return this.low===e.low&&this.high===e.high},o.prototype.compare=function(e){return this.low<e.low&&this.high<e.low?-1:e.low<this.low&&e.high<this.low?1:0},a.prototype.firstVacant=function(){return 0===this.ss.size()?null:this.ss.front().low},a.prototype.alloc=function(){if(0===this.ss.size())return s("alloc():empty"),null;const e=this.ss.front(),t=e.low;return t+1<=e.high?++e.low:this.ss.eraseElementByPos(0),s("alloc():"+t),t},a.prototype.use=function(e){const t=new o(e,e),r=this.ss.lowerBound(t);if(r){if(r.equals(t))return this.ss.eraseElementByValue(r),s("use():"+e),!0;if(r.low>e)return!1;if(r.low===e)return++r.low,s("use():"+e),!0;if(r.high===e)return--r.high,s("use():"+e),!0;const n=r.low;return r.low=e+1,this.ss.insert(new o(n,e-1)),s("use():"+e),!0}return s("use():failed"),!1},a.prototype.free=function(e){if(e<this.min||e>this.max)return void i("free():"+e+" is out of range");const t=new o(e,e),r=this.ss.lowerBound(t);if(r){if(r.low<=e&&e<=r.high)return void i("free():"+e+" has already been vacant");if(r===this.ss.front())e+1===r.low?--r.low:this.ss.insert(t);else{const n=this.ss.reverseLowerBound(t);n.high+1===e?e+1===r.low?(this.ss.eraseElementByValue(n),r.low=n.low):n.high=e:e+1===r.low?r.low=e:this.ss.insert(t)}}else{if(r===this.ss.front())return void this.ss.insert(t);const n=this.ss.reverseLowerBound(t);n.high+1===e?n.high=e:this.ss.insert(t)}s("free():"+e)},a.prototype.clear=function(){s("clear()"),this.ss.clear(),this.ss.insert(new o(this.min,this.max))},a.prototype.intervalCount=function(){return this.ss.size()},a.prototype.dump=function(){console.log("length:"+this.ss.size());for(const e of this.ss)console.log(e)},t.exports=a},{debug:18,"js-sdsl":36}],48:[function(e,t,r){var n=e("wrappy");function s(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}t.exports=n(s),t.exports.strict=n(i),s.proto=s((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return s(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return i(this)},configurable:!0})}))},{wrappy:79}],49:[function(e,t,r){(function(e){(function(){function r(t,r,n,s){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var i,o,a=arguments.length;switch(a){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,r)}));case 3:return e.nextTick((function(){t.call(null,r,n)}));case 4:return e.nextTick((function(){t.call(null,r,n,s)}));default:for(i=new Array(a-1),o=0;o<i.length;)i[o++]=arguments[o];return e.nextTick((function(){t.apply(null,i)}))}}void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:r}:t.exports=e}).call(this)}).call(this,e("_process"))},{_process:50}],50:[function(e,t,r){var n,s,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}function c(e){if(s===clearTimeout)return clearTimeout(e);if((s===a||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(e);try{return s(e)}catch(t){try{return s.call(null,e)}catch(t){return s.call(this,e)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{s="function"==typeof clearTimeout?clearTimeout:a}catch(e){s=a}}();var u,d=[],h=!1,f=-1;function p(){h&&u&&(h=!1,u.length?d=u.concat(d):f=-1,d.length&&g())}function g(){if(!h){var e=l(p);h=!0;for(var t=d.length;t;){for(u=d,d=[];++f<t;)u&&u[f].run();f=-1,t=d.length}u=null,h=!1,c(e)}}function m(e,t){this.fun=e,this.array=t}function y(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];d.push(new m(e,t)),1!==d.length||h||l(g)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=y,i.addListener=y,i.once=y,i.off=y,i.removeListener=y,i.removeAllListeners=y,i.emit=y,i.prependListener=y,i.prependOnceListener=y,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],51:[function(e,t,r){(function(e){(function(){!function(n){var s="object"==typeof r&&r&&!r.nodeType&&r,i="object"==typeof t&&t&&!t.nodeType&&t,o="object"==typeof e&&e;o.global!==o&&o.window!==o&&o.self!==o||(n=o);var a,l,c=2147483647,u=36,d=1,h=26,f=38,p=700,g=72,m=128,y="-",v=/^xn--/,b=/[^\x20-\x7E]/,w=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=u-d,S=Math.floor,C=String.fromCharCode;function _(e){throw new RangeError(E[e])}function k(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function A(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+k((e=e.replace(w,".")).split("."),t).join(".")}function I(e){for(var t,r,n=[],s=0,i=e.length;s<i;)(t=e.charCodeAt(s++))>=55296&&t<=56319&&s<i?56320==(64512&(r=e.charCodeAt(s++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),s--):n.push(t);return n}function R(e){return k(e,(function(e){var t="";return e>65535&&(t+=C((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=C(e)})).join("")}function L(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:u}function D(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function x(e,t,r){var n=0;for(e=r?S(e/p):e>>1,e+=S(e/t);e>T*h>>1;n+=u)e=S(e/T);return S(n+(T+1)*e/(e+f))}function O(e){var t,r,n,s,i,o,a,l,f,p,v=[],b=e.length,w=0,E=m,T=g;for((r=e.lastIndexOf(y))<0&&(r=0),n=0;n<r;++n)e.charCodeAt(n)>=128&&_("not-basic"),v.push(e.charCodeAt(n));for(s=r>0?r+1:0;s<b;){for(i=w,o=1,a=u;s>=b&&_("invalid-input"),((l=L(e.charCodeAt(s++)))>=u||l>S((c-w)/o))&&_("overflow"),w+=l*o,!(l<(f=a<=T?d:a>=T+h?h:a-T));a+=u)o>S(c/(p=u-f))&&_("overflow"),o*=p;T=x(w-i,t=v.length+1,0==i),S(w/t)>c-E&&_("overflow"),E+=S(w/t),w%=t,v.splice(w++,0,E)}return R(v)}function P(e){var t,r,n,s,i,o,a,l,f,p,v,b,w,E,T,k=[];for(b=(e=I(e)).length,t=m,r=0,i=g,o=0;o<b;++o)(v=e[o])<128&&k.push(C(v));for(n=s=k.length,s&&k.push(y);n<b;){for(a=c,o=0;o<b;++o)(v=e[o])>=t&&v<a&&(a=v);for(a-t>S((c-r)/(w=n+1))&&_("overflow"),r+=(a-t)*w,t=a,o=0;o<b;++o)if((v=e[o])<t&&++r>c&&_("overflow"),v==t){for(l=r,f=u;!(l<(p=f<=i?d:f>=i+h?h:f-i));f+=u)T=l-p,E=u-p,k.push(C(D(p+T%E,0))),l=S(T/E);k.push(C(D(l,0))),i=x(r,w,n==s),r=0,++n}++r,++t}return k.join("")}function M(e){return A(e,(function(e){return v.test(e)?O(e.slice(4).toLowerCase()):e}))}function F(e){return A(e,(function(e){return b.test(e)?"xn--"+P(e):e}))}if(a={version:"1.4.1",ucs2:{decode:I,encode:R},decode:O,encode:P,toASCII:F,toUnicode:M},s&&i)if(t.exports==s)i.exports=a;else for(l in a)a.hasOwnProperty(l)&&(s[l]=a[l]);else n.punycode=a}(this)}).call(this)}).call(this,void 0!==Te?Te:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],52:[function(e,t,r){function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.exports=function(e,t,r,i){t=t||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var l=1e3;i&&"number"==typeof i.maxKeys&&(l=i.maxKeys);var c=e.length;l>0&&c>l&&(c=l);for(var u=0;u<c;++u){var d,h,f,p,g=e[u].replace(a,"%20"),m=g.indexOf(r);m>=0?(d=g.substr(0,m),h=g.substr(m+1)):(d=g,h=""),f=decodeURIComponent(d),p=decodeURIComponent(h),n(o,f)?s(o[f])?o[f].push(p):o[f]=[o[f],p]:o[f]=p}return o};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],53:[function(e,t,r){var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,a){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?i(o(e),(function(o){var a=encodeURIComponent(n(o))+r;return s(e[o])?i(e[o],(function(e){return a+encodeURIComponent(n(e))})).join(t):a+encodeURIComponent(n(e[o]))})).join(t):a?encodeURIComponent(n(a))+r+encodeURIComponent(n(e)):""};var s=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function i(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var o=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t}},{}],54:[function(e,t,r){r.decode=r.parse=e("./decode"),r.encode=r.stringify=e("./encode")},{"./decode":52,"./encode":53}],55:[function(e,t,r){function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var s={};function i(e,t,r){function i(e,r,n){return"string"==typeof t?t:t(e,r,n)}r||(r=Error);var o=function(e){function t(t,r,n){return e.call(this,i(t,r,n))||this}return n(t,e),t}(r);o.prototype.name=r.name,o.prototype.code=e,s[e]=o}function o(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map((function(e){return String(e)})),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:2===r?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}function a(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function l(e,t,r){return(void 0===r||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function c(e,t,r){return"number"!=typeof r&&(r=0),!(r+t.length>e.length)&&-1!==e.indexOf(t,r)}i("ERR_INVALID_OPT_VALUE",(function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'}),TypeError),i("ERR_INVALID_ARG_TYPE",(function(e,t,r){var n,s;if("string"==typeof t&&a(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be",l(e," argument"))s="The ".concat(e," ").concat(n," ").concat(o(t,"type"));else{var i=c(e,".")?"property":"argument";s='The "'.concat(e,'" ').concat(i," ").concat(n," ").concat(o(t,"type"))}return s+=". Received type ".concat(typeof r)}),TypeError),i("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),i("ERR_METHOD_NOT_IMPLEMENTED",(function(e){return"The "+e+" method is not implemented"})),i("ERR_STREAM_PREMATURE_CLOSE","Premature close"),i("ERR_STREAM_DESTROYED",(function(e){return"Cannot call "+e+" after a stream was destroyed"})),i("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),i("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),i("ERR_STREAM_WRITE_AFTER_END","write after end"),i("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),i("ERR_UNKNOWN_ENCODING",(function(e){return"Unknown encoding: "+e}),TypeError),i("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=s},{}],56:[function(e,t,r){(function(r){(function(){var n=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=c;var s=e("./_stream_readable"),i=e("./_stream_writable");e("inherits")(c,s);for(var o=n(i.prototype),a=0;a<o.length;a++){var l=o[a];c.prototype[l]||(c.prototype[l]=i.prototype[l])}function c(e){if(!(this instanceof c))return new c(e);s.call(this,e),i.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",u)))}function u(){this._writableState.ended||r.nextTick(d,this)}function d(e){e.end()}Object.defineProperty(c.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(c.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(c.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(c.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}})}).call(this)}).call(this,e("_process"))},{"./_stream_readable":58,"./_stream_writable":60,_process:50,inherits:24}],57:[function(e,t,r){t.exports=s;var n=e("./_stream_transform");function s(e){if(!(this instanceof s))return new s(e);n.call(this,e)}e("inherits")(s,n),s.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":59,inherits:24}],58:[function(e,t,r){(function(r,n){(function(){var s;t.exports=I,I.ReadableState=A,e("events").EventEmitter;var i=function(e,t){return e.listeners(t).length},o=e("./internal/streams/stream"),a=e("buffer").Buffer,l=n.Uint8Array||function(){};function c(e){return a.from(e)}function u(e){return a.isBuffer(e)||e instanceof l}var d,h=e("util");d=h&&h.debuglog?h.debuglog("stream"):function(){};var f,p,g,m=e("./internal/streams/buffer_list"),y=e("./internal/streams/destroy"),v=e("./internal/streams/state").getHighWaterMark,b=e("../errors").codes,w=b.ERR_INVALID_ARG_TYPE,E=b.ERR_STREAM_PUSH_AFTER_EOF,T=b.ERR_METHOD_NOT_IMPLEMENTED,S=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;e("inherits")(I,o);var C=y.errorOrDestroy,_=["error","close","destroy","pause","resume"];function k(e,t,r){if("function"==typeof e.prependListener)return e.prependListener(t,r);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]:e.on(t,r)}function A(t,r,n){s=s||e("./_stream_duplex"),t=t||{},"boolean"!=typeof n&&(n=r instanceof s),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=v(this,t,"readableHighWaterMark",n),this.buffer=new m,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=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(f||(f=e("string_decoder/").StringDecoder),this.decoder=new f(t.encoding),this.encoding=t.encoding)}function I(t){if(s=s||e("./_stream_duplex"),!(this instanceof I))return new I(t);var r=this instanceof s;this._readableState=new A(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),o.call(this)}function R(e,t,r,n,s){d("readableAddChunk",t);var i,o=e._readableState;if(null===t)o.reading=!1,M(e,o);else if(s||(i=D(o,t)),i)C(e,i);else if(o.objectMode||t&&t.length>0)if("string"==typeof t||o.objectMode||Object.getPrototypeOf(t)===a.prototype||(t=c(t)),n)o.endEmitted?C(e,new S):L(e,o,t,!0);else if(o.ended)C(e,new E);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!r?(t=o.decoder.write(t),o.objectMode||0!==t.length?L(e,o,t,!1):U(e,o)):L(e,o,t,!1)}else n||(o.reading=!1,U(e,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function L(e,t,r,n){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",r)):(t.length+=t.objectMode?1:r.length,n?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&F(e)),U(e,t)}function D(e,t){var r;return u(t)||"string"==typeof t||void 0===t||e.objectMode||(r=new w("chunk",["string","Buffer","Uint8Array"],t)),r}Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),I.prototype.destroy=y.destroy,I.prototype._undestroy=y.undestroy,I.prototype._destroy=function(e,t){t(e)},I.prototype.push=function(e,t){var r,n=this._readableState;return n.objectMode?r=!0:"string"==typeof e&&((t=t||n.defaultEncoding)!==n.encoding&&(e=a.from(e,t),t=""),r=!0),R(this,e,t,!1,r)},I.prototype.unshift=function(e){return R(this,e,null,!0,!1)},I.prototype.isPaused=function(){return!1===this._readableState.flowing},I.prototype.setEncoding=function(t){f||(f=e("string_decoder/").StringDecoder);var r=new f(t);this._readableState.decoder=r,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,s="";null!==n;)s+=r.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==s&&this._readableState.buffer.push(s),this._readableState.length=s.length,this};var x=1073741824;function O(e){return e>=x?e=x:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function P(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=O(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function M(e,t){if(d("onEofChunk"),!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,t.sync?F(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,N(e)))}}function F(e){var t=e._readableState;d("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,r.nextTick(N,e))}function N(e){var t=e._readableState;d("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,K(e)}function U(e,t){t.readingMore||(t.readingMore=!0,r.nextTick(B,e,t))}function B(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var r=t.length;if(d("maybeReadMore read 0"),e.read(0),r===t.length)break}t.readingMore=!1}function j(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&i(e,"data")&&(t.flowing=!0,K(e))}}function $(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function q(e){d("readable nexttick read 0"),e.read(0)}function G(e,t){t.resumeScheduled||(t.resumeScheduled=!0,r.nextTick(H,e,t))}function H(e,t){d("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),K(e),t.flowing&&!t.reading&&e.read(0)}function K(e){var t=e._readableState;for(d("flow",t.flowing);t.flowing&&null!==e.read(););}function V(e,t){return 0===t.length?null:(t.objectMode?r=t.buffer.shift():!e||e>=t.length?(r=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):r=t.buffer.consume(e,t.decoder),r);var r}function z(e){var t=e._readableState;d("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,r.nextTick(W,t,e))}function W(e,t){if(d("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var r=t._writableState;(!r||r.autoDestroy&&r.finished)&&t.destroy()}}function Y(e,t){for(var r=0,n=e.length;r<n;r++)if(e[r]===t)return r;return-1}I.prototype.read=function(e){d("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?z(this):F(this),null;if(0===(e=P(e,t))&&t.ended)return 0===t.length&&z(this),null;var n,s=t.needReadable;return d("need readable",s),(0===t.length||t.length-e<t.highWaterMark)&&d("length less than watermark",s=!0),t.ended||t.reading?d("reading or ended",s=!1):s&&(d("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=P(r,t))),null===(n=e>0?V(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&z(this)),null!==n&&this.emit("data",n),n},I.prototype._read=function(e){C(this,new T("_read()"))},I.prototype.pipe=function(e,t){var n=this,s=this._readableState;switch(s.pipesCount){case 0:s.pipes=e;break;case 1:s.pipes=[s.pipes,e];break;default:s.pipes.push(e)}s.pipesCount+=1,d("pipe count=%d opts=%j",s.pipesCount,t);var o=t&&!1===t.end||e===r.stdout||e===r.stderr?y:l;function a(e,t){d("onunpipe"),e===n&&t&&!1===t.hasUnpiped&&(t.hasUnpiped=!0,h())}function l(){d("onend"),e.end()}s.endEmitted?r.nextTick(o):n.once("end",o),e.on("unpipe",a);var c=j(n);e.on("drain",c);var u=!1;function h(){d("cleanup"),e.removeListener("close",g),e.removeListener("finish",m),e.removeListener("drain",c),e.removeListener("error",p),e.removeListener("unpipe",a),n.removeListener("end",l),n.removeListener("end",y),n.removeListener("data",f),u=!0,!s.awaitDrain||e._writableState&&!e._writableState.needDrain||c()}function f(t){d("ondata");var r=e.write(t);d("dest.write",r),!1===r&&((1===s.pipesCount&&s.pipes===e||s.pipesCount>1&&-1!==Y(s.pipes,e))&&!u&&(d("false write response, pause",s.awaitDrain),s.awaitDrain++),n.pause())}function p(t){d("onerror",t),y(),e.removeListener("error",p),0===i(e,"error")&&C(e,t)}function g(){e.removeListener("finish",m),y()}function m(){d("onfinish"),e.removeListener("close",g),y()}function y(){d("unpipe"),n.unpipe(e)}return n.on("data",f),k(e,"error",p),e.once("close",g),e.once("finish",m),e.emit("pipe",n),s.flowing||(d("pipe resume"),n.resume()),e},I.prototype.unpipe=function(e){var t=this._readableState,r={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,r)),this;if(!e){var n=t.pipes,s=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i<s;i++)n[i].emit("unpipe",this,{hasUnpiped:!1});return this}var o=Y(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,r)),this},I.prototype.on=function(e,t){var n=o.prototype.on.call(this,e,t),s=this._readableState;return"data"===e?(s.readableListening=this.listenerCount("readable")>0,!1!==s.flowing&&this.resume()):"readable"===e&&(s.endEmitted||s.readableListening||(s.readableListening=s.needReadable=!0,s.flowing=!1,s.emittedReadable=!1,d("on readable",s.length,s.reading),s.length?F(this):s.reading||r.nextTick(q,this))),n},I.prototype.addListener=I.prototype.on,I.prototype.removeListener=function(e,t){var n=o.prototype.removeListener.call(this,e,t);return"readable"===e&&r.nextTick($,this),n},I.prototype.removeAllListeners=function(e){var t=o.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||r.nextTick($,this),t},I.prototype.resume=function(){var e=this._readableState;return e.flowing||(d("resume"),e.flowing=!e.readableListening,G(this,e)),e.paused=!1,this},I.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},I.prototype.wrap=function(e){var t=this,r=this._readableState,n=!1;for(var s in e.on("end",(function(){if(d("wrapped end"),r.decoder&&!r.ended){var e=r.decoder.end();e&&e.length&&t.push(e)}t.push(null)})),e.on("data",(function(s){d("wrapped data"),r.decoder&&(s=r.decoder.write(s)),r.objectMode&&null==s||(r.objectMode||s&&s.length)&&(t.push(s)||(n=!0,e.pause()))})),e)void 0===this[s]&&"function"==typeof e[s]&&(this[s]=function(t){return function(){return e[t].apply(e,arguments)}}(s));for(var i=0;i<_.length;i++)e.on(_[i],this.emit.bind(this,_[i]));return this._read=function(t){d("wrapped _read",t),n&&(n=!1,e.resume())},this},"function"==typeof Symbol&&(I.prototype[Symbol.asyncIterator]=function(){return void 0===p&&(p=e("./internal/streams/async_iterator")),p(this)}),Object.defineProperty(I.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(I.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(I.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),I._fromList=V,Object.defineProperty(I.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(I.from=function(t,r){return void 0===g&&(g=e("./internal/streams/from")),g(I,t,r)})}).call(this)}).call(this,e("_process"),void 0!==Te?Te:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/async_iterator":61,"./internal/streams/buffer_list":62,"./internal/streams/destroy":63,"./internal/streams/from":65,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,events:22,inherits:24,"string_decoder/":75,util:16}],59:[function(e,t,r){t.exports=u;var n=e("../errors").codes,s=n.ERR_METHOD_NOT_IMPLEMENTED,i=n.ERR_MULTIPLE_CALLBACK,o=n.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=n.ERR_TRANSFORM_WITH_LENGTH_0,l=e("./_stream_duplex");function c(e,t){var r=this._transformState;r.transforming=!1;var n=r.writecb;if(null===n)return this.emit("error",new i);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),n(e);var s=this._readableState;s.reading=!1,(s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}function u(e){if(!(this instanceof u))return new u(e);l.call(this,e),this._transformState={afterTransform:c.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",d)}function d(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?h(this,null,null):this._flush((function(t,r){h(e,t,r)}))}function h(e,t,r){if(t)return e.emit("error",t);if(null!=r&&e.push(r),e._writableState.length)throw new a;if(e._transformState.transforming)throw new o;return e.push(null)}e("inherits")(u,l),u.prototype.push=function(e,t){return this._transformState.needTransform=!1,l.prototype.push.call(this,e,t)},u.prototype._transform=function(e,t,r){r(new s("_transform()"))},u.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var s=this._readableState;(n.needTransform||s.needReadable||s.length<s.highWaterMark)&&this._read(s.highWaterMark)}},u.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},u.prototype._destroy=function(e,t){l.prototype._destroy.call(this,e,(function(e){t(e)}))}},{"../errors":55,"./_stream_duplex":56,inherits:24}],60:[function(e,t,r){(function(r,n){(function(){function s(e){var t=this;this.next=null,this.entry=null,this.finish=function(){H(t,e)}}var i;t.exports=A,A.WritableState=k;var o={deprecate:e("util-deprecate")},a=e("./internal/streams/stream"),l=e("buffer").Buffer,c=n.Uint8Array||function(){};function u(e){return l.from(e)}function d(e){return l.isBuffer(e)||e instanceof c}var h,f=e("./internal/streams/destroy"),p=e("./internal/streams/state").getHighWaterMark,g=e("../errors").codes,m=g.ERR_INVALID_ARG_TYPE,y=g.ERR_METHOD_NOT_IMPLEMENTED,v=g.ERR_MULTIPLE_CALLBACK,b=g.ERR_STREAM_CANNOT_PIPE,w=g.ERR_STREAM_DESTROYED,E=g.ERR_STREAM_NULL_VALUES,T=g.ERR_STREAM_WRITE_AFTER_END,S=g.ERR_UNKNOWN_ENCODING,C=f.errorOrDestroy;function _(){}function k(t,r,n){i=i||e("./_stream_duplex"),t=t||{},"boolean"!=typeof n&&(n=r instanceof i),this.objectMode=!!t.objectMode,n&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=p(this,t,"writableHighWaterMark",n),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var o=!1===t.decodeStrings;this.decodeStrings=!o,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){M(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new s(this)}function A(t){var r=this instanceof(i=i||e("./_stream_duplex"));if(!r&&!h.call(A,this))return new A(t);this._writableState=new k(t,this,r),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),a.call(this)}function I(e,t){var n=new T;C(e,n),r.nextTick(t,n)}function R(e,t,n,s){var i;return null===n?i=new E:"string"==typeof n||t.objectMode||(i=new m("chunk",["string","Buffer"],n)),!i||(C(e,i),r.nextTick(s,i),!1)}function L(e,t,r){return e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=l.from(t,r)),t}function D(e,t,r,n,s,i){if(!r){var o=L(t,n,s);n!==o&&(r=!0,s="buffer",n=o)}var a=t.objectMode?1:n.length;t.length+=a;var l=t.length<t.highWaterMark;if(l||(t.needDrain=!0),t.writing||t.corked){var c=t.lastBufferedRequest;t.lastBufferedRequest={chunk:n,encoding:s,isBuf:r,callback:i,next:null},c?c.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else x(e,t,!1,a,n,s,i);return l}function x(e,t,r,n,s,i,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new w("write")):r?e._writev(s,t.onwrite):e._write(s,i,t.onwrite),t.sync=!1}function O(e,t,n,s,i){--t.pendingcb,n?(r.nextTick(i,s),r.nextTick(q,e,t),e._writableState.errorEmitted=!0,C(e,s)):(i(s),e._writableState.errorEmitted=!0,C(e,s),q(e,t))}function P(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function M(e,t){var n=e._writableState,s=n.sync,i=n.writecb;if("function"!=typeof i)throw new v;if(P(n),t)O(e,n,s,t,i);else{var o=B(n)||e.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||U(e,n),s?r.nextTick(F,e,n,o,i):F(e,n,o,i)}}function F(e,t,r,n){r||N(e,t),t.pendingcb--,n(),q(e,t)}function N(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function U(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),o=t.corkedRequestsFree;o.entry=r;for(var a=0,l=!0;r;)i[a]=r,r.isBuf||(l=!1),r=r.next,a+=1;i.allBuffers=l,x(e,t,!0,t.length,i,"",o.finish),t.pendingcb++,t.lastBufferedRequest=null,o.next?(t.corkedRequestsFree=o.next,o.next=null):t.corkedRequestsFree=new s(t),t.bufferedRequestCount=0}else{for(;r;){var c=r.chunk,u=r.encoding,d=r.callback;if(x(e,t,!1,t.objectMode?1:c.length,c,u,d),r=r.next,t.bufferedRequestCount--,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequest=r,t.bufferProcessing=!1}function B(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function j(e,t){e._final((function(r){t.pendingcb--,r&&C(e,r),t.prefinished=!0,e.emit("prefinish"),q(e,t)}))}function $(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,r.nextTick(j,e,t)))}function q(e,t){var r=B(t);if(r&&($(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var n=e._readableState;(!n||n.autoDestroy&&n.endEmitted)&&e.destroy()}return r}function G(e,t,n){t.ending=!0,q(e,t),n&&(t.finished?r.nextTick(n):e.once("finish",n)),t.ended=!0,e.writable=!1}function H(e,t,r){var n=e.entry;for(e.entry=null;n;){var s=n.callback;t.pendingcb--,s(r),n=n.next}t.corkedRequestsFree.next=e}e("inherits")(A,a),k.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(k.prototype,"buffer",{get:o.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(A,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===A&&e&&e._writableState instanceof k}})):h=function(e){return e instanceof this},A.prototype.pipe=function(){C(this,new b)},A.prototype.write=function(e,t,r){var n=this._writableState,s=!1,i=!n.objectMode&&d(e);return i&&!l.isBuffer(e)&&(e=u(e)),"function"==typeof t&&(r=t,t=null),i?t="buffer":t||(t=n.defaultEncoding),"function"!=typeof r&&(r=_),n.ending?I(this,r):(i||R(this,n,e,r))&&(n.pendingcb++,s=D(this,n,i,e,t,r)),s},A.prototype.cork=function(){this._writableState.corked++},A.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||U(this,e))},A.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new S(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(A.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(A.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),A.prototype._write=function(e,t,r){r(new y("_write()"))},A.prototype._writev=null,A.prototype.end=function(e,t,r){var n=this._writableState;return"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!=e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||G(this,n,r),this},Object.defineProperty(A.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(A.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),A.prototype.destroy=f.destroy,A.prototype._undestroy=f.undestroy,A.prototype._destroy=function(e,t){t(e)}}).call(this)}).call(this,e("_process"),void 0!==Te?Te:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../errors":55,"./_stream_duplex":56,"./internal/streams/destroy":63,"./internal/streams/state":67,"./internal/streams/stream":68,_process:50,buffer:17,inherits:24,"util-deprecate":78}],61:[function(e,t,r){(function(r){(function(){var n;function s(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=e("./end-of-stream"),o=Symbol("lastResolve"),a=Symbol("lastReject"),l=Symbol("error"),c=Symbol("ended"),u=Symbol("lastPromise"),d=Symbol("handlePromise"),h=Symbol("stream");function f(e,t){return{value:e,done:t}}function p(e){var t=e[o];if(null!==t){var r=e[h].read();null!==r&&(e[u]=null,e[o]=null,e[a]=null,t(f(r,!1)))}}function g(e){r.nextTick(p,e)}function m(e,t){return function(r,n){e.then((function(){t[c]?r(f(void 0,!0)):t[d](r,n)}),n)}}var y=Object.getPrototypeOf((function(){})),v=Object.setPrototypeOf((s(n={get stream(){return this[h]},next:function(){var e=this,t=this[l];if(null!==t)return Promise.reject(t);if(this[c])return Promise.resolve(f(void 0,!0));if(this[h].destroyed)return new Promise((function(t,n){r.nextTick((function(){e[l]?n(e[l]):t(f(void 0,!0))}))}));var n,s=this[u];if(s)n=new Promise(m(s,this));else{var i=this[h].read();if(null!==i)return Promise.resolve(f(i,!1));n=new Promise(this[d])}return this[u]=n,n}},Symbol.asyncIterator,(function(){return this})),s(n,"return",(function(){var e=this;return new Promise((function(t,r){e[h].destroy(null,(function(e){e?r(e):t(f(void 0,!0))}))}))})),n),y),b=function(e){var t,r=Object.create(v,(s(t={},h,{value:e,writable:!0}),s(t,o,{value:null,writable:!0}),s(t,a,{value:null,writable:!0}),s(t,l,{value:null,writable:!0}),s(t,c,{value:e._readableState.endEmitted,writable:!0}),s(t,d,{value:function(e,t){var n=r[h].read();n?(r[u]=null,r[o]=null,r[a]=null,e(f(n,!1))):(r[o]=e,r[a]=t)},writable:!0}),t));return r[u]=null,i(e,(function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=r[a];return null!==t&&(r[u]=null,r[o]=null,r[a]=null,t(e)),void(r[l]=e)}var n=r[o];null!==n&&(r[u]=null,r[o]=null,r[a]=null,n(f(void 0,!0))),r[c]=!0})),e.on("readable",g.bind(null,r)),r};t.exports=b}).call(this)}).call(this,e("_process"))},{"./end-of-stream":64,_process:50}],62:[function(e,t,r){function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function l(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e}var c=e("buffer").Buffer,u=e("util").inspect,d=u&&u.custom||"inspect";function h(e,t,r){c.prototype.copy.call(e,t,r)}t.exports=function(){function e(){o(this,e),this.head=null,this.tail=null,this.length=0}return l(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r}},{key:"concat",value:function(e){if(0===this.length)return c.alloc(0);for(var t=c.allocUnsafe(e>>>0),r=this.head,n=0;r;)h(r.data,t,n),n+=r.data.length,r=r.next;return t}},{key:"consume",value:function(e,t){var r;return e<this.head.data.length?(r=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):r=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),r}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,r=1,n=t.data;for(e-=n.length;t=t.next;){var s=t.data,i=e>s.length?s.length:e;if(i===s.length?n+=s:n+=s.slice(0,e),0==(e-=i)){i===s.length?(++r,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=s.slice(i));break}++r}return this.length-=r,n}},{key:"_getBuffer",value:function(e){var t=c.allocUnsafe(e),r=this.head,n=1;for(r.data.copy(t),e-=r.data.length;r=r.next;){var s=r.data,i=e>s.length?s.length:e;if(s.copy(t,t.length-e,0,i),0==(e-=i)){i===s.length?(++n,r.next?this.head=r.next:this.head=this.tail=null):(this.head=r,r.data=s.slice(i));break}++n}return this.length-=n,t}},{key:d,value:function(e,t){return u(this,s({},t,{depth:0,customInspect:!1}))}}]),e}()},{buffer:17,util:16}],63:[function(e,t,r){(function(e){(function(){function r(t,r){var i=this,a=this._readableState&&this._readableState.destroyed,l=this._writableState&&this._writableState.destroyed;return a||l?(r?r(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,e.nextTick(o,this,t)):e.nextTick(o,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!r&&t?i._writableState?i._writableState.errorEmitted?e.nextTick(s,i):(i._writableState.errorEmitted=!0,e.nextTick(n,i,t)):e.nextTick(n,i,t):r?(e.nextTick(s,i),r(t)):e.nextTick(s,i)})),this)}function n(e,t){o(e,t),s(e)}function s(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function i(){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 o(e,t){e.emit("error",t)}function a(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}t.exports={destroy:r,undestroy:i,errorOrDestroy:a}}).call(this)}).call(this,e("_process"))},{_process:50}],64:[function(e,t,r){var n=e("../../../errors").codes.ERR_STREAM_PREMATURE_CLOSE;function s(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),s=0;s<r;s++)n[s]=arguments[s];e.apply(this,n)}}}function i(){}function o(e){return e.setHeader&&"function"==typeof e.abort}function a(e,t,r){if("function"==typeof t)return a(e,null,t);t||(t={}),r=s(r||i);var l=t.readable||!1!==t.readable&&e.readable,c=t.writable||!1!==t.writable&&e.writable,u=function(){e.writable||h()},d=e._writableState&&e._writableState.finished,h=function(){c=!1,d=!0,l||r.call(e)},f=e._readableState&&e._readableState.endEmitted,p=function(){l=!1,f=!0,c||r.call(e)},g=function(t){r.call(e,t)},m=function(){var t;return l&&!f?(e._readableState&&e._readableState.ended||(t=new n),r.call(e,t)):c&&!d?(e._writableState&&e._writableState.ended||(t=new n),r.call(e,t)):void 0},y=function(){e.req.on("finish",h)};return o(e)?(e.on("complete",h),e.on("abort",m),e.req?y():e.on("request",y)):c&&!e._writableState&&(e.on("end",u),e.on("close",u)),e.on("end",p),e.on("finish",h),!1!==t.error&&e.on("error",g),e.on("close",m),function(){e.removeListener("complete",h),e.removeListener("abort",m),e.removeListener("request",y),e.req&&e.req.removeListener("finish",h),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",h),e.removeListener("end",p),e.removeListener("error",g),e.removeListener("close",m)}}t.exports=a},{"../../../errors":55}],65:[function(e,t,r){t.exports=function(){throw new Error("Readable.from is not available in the browser")}},{}],66:[function(e,t,r){var n;function s(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}var i=e("../../../errors").codes,o=i.ERR_MISSING_ARGS,a=i.ERR_STREAM_DESTROYED;function l(e){if(e)throw e}function c(e){return e.setHeader&&"function"==typeof e.abort}function u(t,r,i,o){o=s(o);var l=!1;t.on("close",(function(){l=!0})),void 0===n&&(n=e("./end-of-stream")),n(t,{readable:r,writable:i},(function(e){if(e)return o(e);l=!0,o()}));var u=!1;return function(e){if(!l&&!u)return u=!0,c(t)?t.abort():"function"==typeof t.destroy?t.destroy():void o(e||new a("pipe"))}}function d(e){e()}function h(e,t){return e.pipe(t)}function f(e){return e.length?"function"!=typeof e[e.length-1]?l:e.pop():l}function p(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n,s=f(t);if(Array.isArray(t[0])&&(t=t[0]),t.length<2)throw new o("streams");var i=t.map((function(e,r){var o=r<t.length-1;return u(e,o,r>0,(function(e){n||(n=e),e&&i.forEach(d),o||(i.forEach(d),s(n))}))}));return t.reduce(h)}t.exports=p},{"../../../errors":55,"./end-of-stream":64}],67:[function(e,t,r){var n=e("../../../errors").codes.ERR_INVALID_OPT_VALUE;function s(e,t,r){return null!=e.highWaterMark?e.highWaterMark:t?e[r]:null}function i(e,t,r,i){var o=s(t,i,r);if(null!=o){if(!isFinite(o)||Math.floor(o)!==o||o<0)throw new n(i?r:"highWaterMark",o);return Math.floor(o)}return e.objectMode?16:16384}t.exports={getHighWaterMark:i}},{"../../../errors":55}],68:[function(e,t,r){t.exports=e("events").EventEmitter},{events:22}],69:[function(e,t,r){(r=t.exports=e("./lib/_stream_readable.js")).Stream=r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js"),r.finished=e("./lib/internal/streams/end-of-stream.js"),r.pipeline=e("./lib/internal/streams/pipeline.js")},{"./lib/_stream_duplex.js":56,"./lib/_stream_passthrough.js":57,"./lib/_stream_readable.js":58,"./lib/_stream_transform.js":59,"./lib/_stream_writable.js":60,"./lib/internal/streams/end-of-stream.js":64,"./lib/internal/streams/pipeline.js":66}],70:[function(e,t,r){function n(e,t,r){var n=this;this._callback=e,this._args=r,this._interval=setInterval(e,t,this._args),this.reschedule=function(e){e||(e=n._interval),n._interval&&clearInterval(n._interval),n._interval=setInterval(n._callback,e,n._args)},this.clear=function(){n._interval&&(clearInterval(n._interval),n._interval=void 0)},this.destroy=function(){n._interval&&clearInterval(n._interval),n._callback=void 0,n._interval=void 0,n._args=void 0}}function s(){if("function"!=typeof arguments[0])throw new Error("callback needed");if("number"!=typeof arguments[1])throw new Error("interval needed");var e;if(arguments.length>0){e=new Array(arguments.length-2);for(var t=0;t<e.length;t++)e[t]=arguments[t+2]}return new n(arguments[0],arguments[1],e)}t.exports=s},{}],71:[function(e,t,r){t.exports=e("./index.js")()},{"./index.js":72}],72:[function(e,t,r){(function(e){(function(){function r(t){return t instanceof e?e.from(t):new t.constructor(t.buffer.slice(),t.byteOffset,t.length)}function n(e){return(e=e||{}).circles?s(e):e.proto?i:n;function t(e,t){for(var n=Object.keys(e),s=new Array(n.length),i=0;i<n.length;i++){var o=n[i],a=e[o];"object"!=typeof a||null===a?s[o]=a:a instanceof Date?s[o]=new Date(a):ArrayBuffer.isView(a)?s[o]=r(a):s[o]=t(a)}return s}function n(e){if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return t(e,n);if(e instanceof Map)return new Map(t(Array.from(e),n));if(e instanceof Set)return new Set(t(Array.from(e),n));var s={};for(var i in e)if(!1!==Object.hasOwnProperty.call(e,i)){var o=e[i];"object"!=typeof o||null===o?s[i]=o:o instanceof Date?s[i]=new Date(o):o instanceof Map?s[i]=new Map(t(Array.from(o),n)):o instanceof Set?s[i]=new Set(t(Array.from(o),n)):ArrayBuffer.isView(o)?s[i]=r(o):s[i]=n(o)}return s}function i(e){if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return t(e,i);if(e instanceof Map)return new Map(t(Array.from(e),i));if(e instanceof Set)return new Set(t(Array.from(e),i));var n={};for(var s in e){var o=e[s];"object"!=typeof o||null===o?n[s]=o:o instanceof Date?n[s]=new Date(o):o instanceof Map?n[s]=new Map(t(Array.from(o),i)):o instanceof Set?n[s]=new Set(t(Array.from(o),i)):ArrayBuffer.isView(o)?n[s]=r(o):n[s]=i(o)}return n}}function s(e){var t=[],n=[];return e.proto?o:i;function s(e,s){for(var i=Object.keys(e),o=new Array(i.length),a=0;a<i.length;a++){var l=i[a],c=e[l];if("object"!=typeof c||null===c)o[l]=c;else if(c instanceof Date)o[l]=new Date(c);else if(ArrayBuffer.isView(c))o[l]=r(c);else{var u=t.indexOf(c);o[l]=-1!==u?n[u]:s(c)}}return o}function i(e){if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return s(e,i);if(e instanceof Map)return new Map(s(Array.from(e),i));if(e instanceof Set)return new Set(s(Array.from(e),i));var o={};for(var a in t.push(e),n.push(o),e)if(!1!==Object.hasOwnProperty.call(e,a)){var l=e[a];if("object"!=typeof l||null===l)o[a]=l;else if(l instanceof Date)o[a]=new Date(l);else if(l instanceof Map)o[a]=new Map(s(Array.from(l),i));else if(l instanceof Set)o[a]=new Set(s(Array.from(l),i));else if(ArrayBuffer.isView(l))o[a]=r(l);else{var c=t.indexOf(l);o[a]=-1!==c?n[c]:i(l)}}return t.pop(),n.pop(),o}function o(e){if("object"!=typeof e||null===e)return e;if(e instanceof Date)return new Date(e);if(Array.isArray(e))return s(e,o);if(e instanceof Map)return new Map(s(Array.from(e),o));if(e instanceof Set)return new Set(s(Array.from(e),o));var i={};for(var a in t.push(e),n.push(i),e){var l=e[a];if("object"!=typeof l||null===l)i[a]=l;else if(l instanceof Date)i[a]=new Date(l);else if(l instanceof Map)i[a]=new Map(s(Array.from(l),o));else if(l instanceof Set)i[a]=new Set(s(Array.from(l),o));else if(ArrayBuffer.isView(l))i[a]=r(l);else{var c=t.indexOf(l);i[a]=-1!==c?n[c]:o(l)}}return t.pop(),n.pop(),i}}t.exports=n}).call(this)}).call(this,e("buffer").Buffer)},{buffer:17}],73:[function(e,t,r){