UNPKG

@suprsend/web-components

Version:

This SuprSend library enables the use of features like inbox and preference drop-in components in non-React frameworks such as Vanilla JavaScript, Angular, and Vue

1 lines 586 kB
(function(Se,un){typeof exports=="object"&&typeof module<"u"?un(exports):typeof define=="function"&&define.amd?define(["exports"],un):(Se=typeof globalThis<"u"?globalThis:Se||self,un(Se.SuprSend={}))})(this,function(Se){"use strict";var $m;var un,he,Xu,Ln,Ju,Zu,ec,tc,a1,s1,o1,nc,ur={},rc=[],Vm=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qr=Array.isArray;function cn(t,e){for(var n in e)t[n]=e[n];return t}function l1(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function et(t,e,n){var r,i,a,o={};for(a in e)a=="key"?r=e[a]:a=="ref"?i=e[a]:o[a]=e[a];if(arguments.length>2&&(o.children=arguments.length>3?un.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(a in t.defaultProps)o[a]===void 0&&(o[a]=t.defaultProps[a]);return cr(t,o,r,i,null)}function cr(t,e,n,r,i){var a={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++Xu,__i:-1,__u:0};return i==null&&he.vnode!=null&&he.vnode(a),a}function ic(){return{current:null}}function Ot(t){return t.children}function Gt(t,e){this.props=t,this.context=e}function jn(t,e){if(e==null)return t.__?jn(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?jn(t):null}function ac(t){var e,n;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null){t.__e=t.__c.base=n.__e;break}return ac(t)}}function u1(t){(!t.__d&&(t.__d=!0)&&Ln.push(t)&&!Xr.__r++||Ju!==he.debounceRendering)&&((Ju=he.debounceRendering)||Zu)(Xr)}function Xr(){for(var t,e,n,r,i,a,o,s=1;Ln.length;)Ln.length>s&&Ln.sort(ec),t=Ln.shift(),s=Ln.length,t.__d&&(n=void 0,i=(r=(e=t).__v).__e,a=[],o=[],e.__P&&((n=cn({},r)).__v=r.__v+1,he.vnode&&he.vnode(n),c1(e.__P,n,r,e.__n,e.__P.namespaceURI,32&r.__u?[i]:null,a,i??jn(r),!!(32&r.__u),o),n.__v=r.__v,n.__.__k[n.__i]=n,cc(a,n,o),n.__e!=i&&ac(n)));Xr.__r=0}function sc(t,e,n,r,i,a,o,s,u,c,d){var f,T,l,p,_,y,C=r&&r.__k||rc,v=e.length;for(u=Ym(n,e,C,u,v),f=0;f<v;f++)(l=n.__k[f])!=null&&(T=l.__i===-1?ur:C[l.__i]||ur,l.__i=f,y=c1(t,l,T,i,a,o,s,u,c,d),p=l.__e,l.ref&&T.ref!=l.ref&&(T.ref&&f1(T.ref,null,l),d.push(l.ref,l.__c||p,l)),_==null&&p!=null&&(_=p),4&l.__u||T.__k===l.__k?u=oc(l,u,t):typeof l.type=="function"&&y!==void 0?u=y:p&&(u=p.nextSibling),l.__u&=-7);return n.__e=_,u}function Ym(t,e,n,r,i){var a,o,s,u,c,d=n.length,f=d,T=0;for(t.__k=new Array(i),a=0;a<i;a++)(o=e[a])!=null&&typeof o!="boolean"&&typeof o!="function"?(u=a+T,(o=t.__k[a]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?cr(null,o,null,null,null):Qr(o)?cr(Ot,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?cr(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=t,o.__b=t.__b+1,s=null,(c=o.__i=Qm(o,n,u,f))!==-1&&(f--,(s=n[c])&&(s.__u|=2)),s==null||s.__v===null?(c==-1&&T--,typeof o.type!="function"&&(o.__u|=4)):c!=u&&(c==u-1?T--:c==u+1?T++:(c>u?T--:T++,o.__u|=4))):t.__k[a]=null;if(f)for(a=0;a<d;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=jn(s)),fc(s,s));return r}function oc(t,e,n){var r,i;if(typeof t.type=="function"){for(r=t.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=t,e=oc(r[i],e,n));return e}t.__e!=e&&(e&&t.type&&!n.contains(e)&&(e=jn(t)),n.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function fn(t,e){return e=e||[],t==null||typeof t=="boolean"||(Qr(t)?t.some(function(n){fn(n,e)}):e.push(t)),e}function Qm(t,e,n,r){var i,a,o=t.key,s=t.type,u=e[n];if(u===null||u&&o==u.key&&s===u.type&&!(2&u.__u))return n;if(r>(u!=null&&!(2&u.__u)?1:0))for(i=n-1,a=n+1;i>=0||a<e.length;){if(i>=0){if((u=e[i])&&!(2&u.__u)&&o==u.key&&s===u.type)return i;i--}if(a<e.length){if((u=e[a])&&!(2&u.__u)&&o==u.key&&s===u.type)return a;a++}}return-1}function lc(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||Vm.test(e)?n:n+"px"}function Jr(t,e,n,r,i){var a;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||lc(t.style,e,"");if(n)for(e in n)r&&n[e]===r[e]||lc(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")a=e!=(e=e.replace(tc,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+a]=n,n?r?n.u=r.u:(n.u=a1,t.addEventListener(e,a?o1:s1,a)):t.removeEventListener(e,a?o1:s1,a);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function uc(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=a1++;else if(e.t<n.u)return;return n(he.event?he.event(e):e)}}}function c1(t,e,n,r,i,a,o,s,u,c){var d,f,T,l,p,_,y,C,v,R,E,S,b,x,N,O,M,P,B=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(u=!!(32&n.__u),a=[s=e.__e=n.__e]),(d=he.__b)&&d(e);e:if(typeof B=="function")try{if(C=e.props,v="prototype"in B&&B.prototype.render,R=(d=B.contextType)&&r[d.__c],E=d?R?R.props.value:d.__:r,n.__c?y=(f=e.__c=n.__c).__=f.__E:(v?e.__c=f=new B(C,E):(e.__c=f=new Gt(C,E),f.constructor=B,f.render=Jm),R&&R.sub(f),f.props=C,f.state||(f.state={}),f.context=E,f.__n=r,T=f.__d=!0,f.__h=[],f._sb=[]),v&&f.__s==null&&(f.__s=f.state),v&&B.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=cn({},f.__s)),cn(f.__s,B.getDerivedStateFromProps(C,f.__s))),l=f.props,p=f.state,f.__v=e,T)v&&B.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),v&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(v&&B.getDerivedStateFromProps==null&&C!==l&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(C,E),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(C,f.__s,E)===!1||e.__v==n.__v)){for(e.__v!=n.__v&&(f.props=C,f.state=f.__s,f.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(w){w&&(w.__=e)}),S=0;S<f._sb.length;S++)f.__h.push(f._sb[S]);f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(C,f.__s,E),v&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(l,p,_)})}if(f.context=E,f.props=C,f.__P=t,f.__e=!1,b=he.__r,x=0,v){for(f.state=f.__s,f.__d=!1,b&&b(e),d=f.render(f.props,f.state,f.context),N=0;N<f._sb.length;N++)f.__h.push(f._sb[N]);f._sb=[]}else do f.__d=!1,b&&b(e),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++x<25);f.state=f.__s,f.getChildContext!=null&&(r=cn(cn({},r),f.getChildContext())),v&&!T&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(l,p)),M=(O=d!=null&&d.type===Ot&&d.key==null)?d.props.children:d,O&&(d.props.children=null),s=sc(t,Qr(M)?M:[M],e,n,r,i,a,o,s,u,c),f.base=e.__e,e.__u&=-161,f.__h.length&&o.push(f),y&&(f.__E=f.__=null)}catch(w){if(e.__v=null,u||a!=null)if(w.then){for(e.__u|=u?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,e.__e=s}else for(P=a.length;P--;)l1(a[P]);else e.__e=n.__e,e.__k=n.__k;he.__e(w,e,n)}else a==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):s=e.__e=Xm(n.__e,e,n,r,i,a,o,u,c);return(d=he.diffed)&&d(e),128&e.__u?void 0:s}function cc(t,e,n){for(var r=0;r<n.length;r++)f1(n[r],n[++r],n[++r]);he.__c&&he.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(a){a.call(i)})}catch(a){he.__e(a,i.__v)}})}function Xm(t,e,n,r,i,a,o,s,u){var c,d,f,T,l,p,_,y=n.props,C=e.props,v=e.type;if(v=="svg"?i="http://www.w3.org/2000/svg":v=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(c=0;c<a.length;c++)if((l=a[c])&&"setAttribute"in l==!!v&&(v?l.localName==v:l.nodeType==3)){t=l,a[c]=null;break}}if(t==null){if(v==null)return document.createTextNode(C);t=document.createElementNS(i,v,C.is&&C),s&&(he.__m&&he.__m(e,a),s=!1),a=null}if(v===null)y===C||s&&t.data===C||(t.data=C);else{if(a=a&&un.call(t.childNodes),y=n.props||ur,!s&&a!=null)for(y={},c=0;c<t.attributes.length;c++)y[(l=t.attributes[c]).name]=l.value;for(c in y)if(l=y[c],c!="children"){if(c=="dangerouslySetInnerHTML")f=l;else if(!(c in C)){if(c=="value"&&"defaultValue"in C||c=="checked"&&"defaultChecked"in C)continue;Jr(t,c,null,l,i)}}for(c in C)l=C[c],c=="children"?T=l:c=="dangerouslySetInnerHTML"?d=l:c=="value"?p=l:c=="checked"?_=l:s&&typeof l!="function"||y[c]===l||Jr(t,c,l,y[c],i);if(d)s||f&&(d.__html===f.__html||d.__html===t.innerHTML)||(t.innerHTML=d.__html),e.__k=[];else if(f&&(t.innerHTML=""),sc(e.type==="template"?t.content:t,Qr(T)?T:[T],e,n,r,v=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,o,a?a[0]:n.__k&&jn(n,0),s,u),a!=null)for(c=a.length;c--;)l1(a[c]);s||(c="value",v=="progress"&&p==null?t.removeAttribute("value"):p!==void 0&&(p!==t[c]||v=="progress"&&!p||v=="option"&&p!==y[c])&&Jr(t,c,p,y[c],i),c="checked",_!==void 0&&_!==t[c]&&Jr(t,c,_,y[c],i))}return t}function f1(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(i){he.__e(i,n)}}function fc(t,e,n){var r,i;if(he.unmount&&he.unmount(t),(r=t.ref)&&(r.current&&r.current!==t.__e||f1(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){he.__e(a,e)}r.base=r.__P=null}if(r=t.__k)for(i=0;i<r.length;i++)r[i]&&fc(r[i],e,n||typeof t.type!="function");n||l1(t.__e),t.__c=t.__=t.__e=void 0}function Jm(t,e,n){return this.constructor(t,n)}function fr(t,e,n){var r,i,a,o;e==document&&(e=document.documentElement),he.__&&he.__(t,e),i=(r=typeof n=="function")?null:n&&n.__k||e.__k,a=[],o=[],c1(e,t=(!r&&n||e).__k=et(Ot,null,[t]),i||ur,ur,e.namespaceURI,!r&&n?[n]:i?null:e.firstChild?un.call(e.childNodes):null,a,!r&&n?n:i?i.__e:e.firstChild,r,o),cc(a,t,o)}function dc(t,e){fr(t,e,dc)}function Zm(t,e,n){var r,i,a,o,s=cn({},t.props);for(a in t.type&&t.type.defaultProps&&(o=t.type.defaultProps),e)a=="key"?r=e[a]:a=="ref"?i=e[a]:s[a]=e[a]===void 0&&o!==void 0?o[a]:e[a];return arguments.length>2&&(s.children=arguments.length>3?un.call(arguments,2):n),cr(t.type,s,r||t.key,i||t.ref,null)}function Pn(t){function e(n){var r,i;return this.getChildContext||(r=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&r.forEach(function(o){o.__e=!0,u1(o)})},this.sub=function(a){r.add(a);var o=a.componentWillUnmount;a.componentWillUnmount=function(){r&&r.delete(a),o&&o.call(a)}}),n.children}return e.__c="__cC"+nc++,e.__=t,e.Provider=e.__l=(e.Consumer=function(n,r){return n.children(r)}).contextType=e,e}un=rc.slice,he={__e:function(t,e,n,r){for(var i,a,o;e=e.__;)if((i=e.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(t)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,r||{}),o=i.__d),o)return i.__E=i}catch(s){t=s}throw t}},Xu=0,Gt.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=cn({},this.state),typeof t=="function"&&(t=t(cn({},n),this.props)),t&&cn(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),u1(this))},Gt.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),u1(this))},Gt.prototype.render=Ot,Ln=[],Zu=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ec=function(t,e){return t.__v.__b-e.__v.__b},Xr.__r=0,tc=/(PointerCapture)$|Capture$/i,a1=0,s1=uc(!1),o1=uc(!0),nc=0;var e5=0;function tt(t,e,n,r,i,a){e||(e={});var o,s,u=e;if("ref"in u)for(s in u={},e)s=="ref"?o=e[s]:u[s]=e[s];var c={type:t,props:u,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--e5,__i:-1,__u:0,__source:i,__self:a};if(typeof t=="function"&&(o=t.defaultProps))for(s in o)u[s]===void 0&&(u[s]=o[s]);return he.vnode&&he.vnode(c),c}var dn,He,d1,hc,Wn=0,pc=[],je=he,mc=je.__b,gc=je.__r,Tc=je.diffed,_c=je.__c,Ec=je.unmount,vc=je.__;function Mn(t,e){je.__h&&je.__h(He,t,Wn||e),Wn=0;var n=He.__H||(He.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function $e(t){return Wn=1,Zr(Ac,t)}function Zr(t,e,n){var r=Mn(dn++,2);if(r.t=t,!r.__c&&(r.__=[n?n(e):Ac(void 0,e),function(s){var u=r.__N?r.__N[0]:r.__[0],c=r.t(u,s);u!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=He,!He.__f)){var i=function(s,u,c){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(T){return!!T.__c});if(d.every(function(T){return!T.__N}))return!a||a.call(this,s,u,c);var f=r.__c.props!==s;return d.forEach(function(T){if(T.__N){var l=T.__[0];T.__=T.__N,T.__N=void 0,l!==T.__[0]&&(f=!0)}}),a&&a.call(this,s,u,c)||f};He.__f=!0;var a=He.shouldComponentUpdate,o=He.componentWillUpdate;He.componentWillUpdate=function(s,u,c){if(this.__e){var d=a;a=void 0,i(s,u,c),a=d}o&&o.call(this,s,u,c)},He.shouldComponentUpdate=i}return r.__N||r.__}function nt(t,e){var n=Mn(dn++,3);!je.__s&&T1(n.__H,e)&&(n.__=t,n.u=e,He.__H.__h.push(n))}function Dn(t,e){var n=Mn(dn++,4);!je.__s&&T1(n.__H,e)&&(n.__=t,n.u=e,He.__h.push(n))}function hn(t){return Wn=5,zt(function(){return{current:t}},[])}function h1(t,e,n){Wn=6,Dn(function(){if(typeof t=="function"){var r=t(e());return function(){t(null),r&&typeof r=="function"&&r()}}if(t)return t.current=e(),function(){return t.current=null}},n==null?n:n.concat(t))}function zt(t,e){var n=Mn(dn++,7);return T1(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function Fn(t,e){return Wn=8,zt(function(){return t},e)}function kt(t){var e=He.context[t.__c],n=Mn(dn++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(He)),e.props.value):t.__}function p1(t,e){je.useDebugValue&&je.useDebugValue(e?e(t):t)}function t5(t){var e=Mn(dn++,10),n=$e();return e.__=t,He.componentDidCatch||(He.componentDidCatch=function(r,i){e.__&&e.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function m1(){var t=Mn(dn++,11);if(!t.__){for(var e=He.__v;e!==null&&!e.__m&&e.__!==null;)e=e.__;var n=e.__m||(e.__m=[0,0]);t.__="P"+n[0]+"-"+n[1]++}return t.__}function n5(){for(var t;t=pc.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(ei),t.__H.__h.forEach(g1),t.__H.__h=[]}catch(e){t.__H.__h=[],je.__e(e,t.__v)}}je.__b=function(t){He=null,mc&&mc(t)},je.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),vc&&vc(t,e)},je.__r=function(t){gc&&gc(t),dn=0;var e=(He=t.__c).__H;e&&(d1===He?(e.__h=[],He.__h=[],e.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.forEach(ei),e.__h.forEach(g1),e.__h=[],dn=0)),d1=He},je.diffed=function(t){Tc&&Tc(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(pc.push(e)!==1&&hc===je.requestAnimationFrame||((hc=je.requestAnimationFrame)||r5)(n5)),e.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),d1=He=null},je.__c=function(t,e){e.some(function(n){try{n.__h.forEach(ei),n.__h=n.__h.filter(function(r){return!r.__||g1(r)})}catch(r){e.some(function(i){i.__h&&(i.__h=[])}),e=[],je.__e(r,n.__v)}}),_c&&_c(t,e)},je.unmount=function(t){Ec&&Ec(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{ei(r)}catch(i){e=i}}),n.__H=void 0,e&&je.__e(e,n.__v))};var yc=typeof requestAnimationFrame=="function";function r5(t){var e,n=function(){clearTimeout(r),yc&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,100);yc&&(e=requestAnimationFrame(n))}function ei(t){var e=He,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),He=e}function g1(t){var e=He;t.__c=t.__(),He=e}function T1(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function Ac(t,e){return typeof e=="function"?e(t):e}function Cc(t,e){for(var n in e)t[n]=e[n];return t}function _1(t,e){for(var n in t)if(n!=="__source"&&!(n in e))return!0;for(var r in e)if(r!=="__source"&&t[r]!==e[r])return!0;return!1}function E1(t,e){var n=e(),r=$e({t:{__:n,u:e}}),i=r[0].t,a=r[1];return Dn(function(){i.__=n,i.u=e,v1(i)&&a({t:i})},[t,n,e]),nt(function(){return v1(i)&&a({t:i}),t(function(){v1(i)&&a({t:i})})},[t]),n}function v1(t){var e,n,r=t.u,i=t.__;try{var a=r();return!((e=i)===(n=a)&&(e!==0||1/e==1/n)||e!=e&&n!=n)}catch{return!0}}function y1(t){t()}function A1(t){return t}function C1(){return[!1,y1]}var S1=Dn;function ti(t,e){this.props=t,this.context=e}function Sc(t,e){function n(i){var a=this.props.ref,o=a==i.ref;return!o&&a&&(a.call?a(null):a.current=null),e?!e(this.props,i)||!o:_1(this.props,i)}function r(i){return this.shouldComponentUpdate=n,et(t,i)}return r.displayName="Memo("+(t.displayName||t.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(ti.prototype=new Gt).isPureReactComponent=!0,ti.prototype.shouldComponentUpdate=function(t,e){return _1(this.props,t)||_1(this.state,e)};var bc=he.__b;he.__b=function(t){t.type&&t.type.__f&&t.ref&&(t.props.ref=t.ref,t.ref=null),bc&&bc(t)};var i5=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function b1(t){function e(n){var r=Cc({},n);return delete r.ref,t(r,n.ref||null)}return e.$$typeof=i5,e.render=e,e.prototype.isReactComponent=e.__f=!0,e.displayName="ForwardRef("+(t.displayName||t.name)+")",e}var Rc=function(t,e){return t==null?null:fn(fn(t).map(e))},xc={map:Rc,forEach:Rc,count:function(t){return t?fn(t).length:0},only:function(t){var e=fn(t);if(e.length!==1)throw"Children.only";return e[0]},toArray:fn},a5=he.__e;he.__e=function(t,e,n,r){if(t.then){for(var i,a=e;a=a.__;)if((i=a.__c)&&i.__c)return e.__e==null&&(e.__e=n.__e,e.__k=n.__k),i.__c(t,e)}a5(t,e,n,r)};var Oc=he.unmount;function kc(t,e,n){return t&&(t.__c&&t.__c.__H&&(t.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),t.__c.__H=null),(t=Cc({},t)).__c!=null&&(t.__c.__P===n&&(t.__c.__P=e),t.__c=null),t.__k=t.__k&&t.__k.map(function(r){return kc(r,e,n)})),t}function Nc(t,e,n){return t&&n&&(t.__v=null,t.__k=t.__k&&t.__k.map(function(r){return Nc(r,e,n)}),t.__c&&t.__c.__P===e&&(t.__e&&n.appendChild(t.__e),t.__c.__e=!0,t.__c.__P=n)),t}function dr(){this.__u=0,this.o=null,this.__b=null}function Ic(t){var e=t.__.__c;return e&&e.__a&&e.__a(t)}function wc(t){var e,n,r;function i(a){if(e||(e=t()).then(function(o){n=o.default||o},function(o){r=o}),r)throw r;if(!n)throw e;return et(n,a)}return i.displayName="Lazy",i.__f=!0,i}function Vn(){this.i=null,this.l=null}he.unmount=function(t){var e=t.__c;e&&e.__R&&e.__R(),e&&32&t.__u&&(t.type=null),Oc&&Oc(t)},(dr.prototype=new Gt).__c=function(t,e){var n=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var i=Ic(r.__v),a=!1,o=function(){a||(a=!0,n.__R=null,i?i(s):s())};n.__R=o;var s=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=Nc(u,u.__c.__P,u.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.o.pop();)c.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),t.then(o,o)},dr.prototype.componentWillUnmount=function(){this.o=[]},dr.prototype.render=function(t,e){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=kc(this.__b,n,r.__O=r.__P)}this.__b=null}var i=e.__a&&et(Ot,null,t.fallback);return i&&(i.__u&=-33),[et(Ot,null,e.__a?null:t.children),i]};var Lc=function(t,e,n){if(++n[1]===n[0]&&t.l.delete(e),t.props.revealOrder&&(t.props.revealOrder[0]!=="t"||!t.l.size))for(n=t.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;t.i=n=n[2]}};function s5(t){return this.getChildContext=function(){return t.context},t.children}function o5(t){var e=this,n=t.h;e.componentWillUnmount=function(){fr(null,e.v),e.v=null,e.h=null},e.h&&e.h!==n&&e.componentWillUnmount(),e.v||(e.h=n,e.v={nodeType:1,parentNode:n,childNodes:[],contains:function(){return!0},appendChild:function(r){this.childNodes.push(r),e.h.appendChild(r)},insertBefore:function(r,i){this.childNodes.push(r),e.h.insertBefore(r,i)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),e.h.removeChild(r)}}),fr(et(s5,{context:e.context},t.__v),e.v)}function ni(t,e){var n=et(o5,{__v:t,h:e});return n.containerInfo=e,n}(Vn.prototype=new Gt).__a=function(t){var e=this,n=Ic(e.__v),r=e.l.get(t);return r[0]++,function(i){var a=function(){e.props.revealOrder?(r.push(i),Lc(e,t,r)):i()};n?n(a):a()}},Vn.prototype.render=function(t){this.i=null,this.l=new Map;var e=fn(t.children);t.revealOrder&&t.revealOrder[0]==="b"&&e.reverse();for(var n=e.length;n--;)this.l.set(e[n],this.i=[1,0,this.i]);return t.children},Vn.prototype.componentDidUpdate=Vn.prototype.componentDidMount=function(){var t=this;this.l.forEach(function(e,n){Lc(t,n,e)})};var Pc=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,l5=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,u5=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,c5=/[A-Z0-9]/g,f5=typeof document<"u",d5=function(t){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(t)};function R1(t,e,n){return e.__k==null&&(e.textContent=""),fr(t,e),typeof n=="function"&&n(),t?t.__c:null}function Mc(t,e,n){return dc(t,e),typeof n=="function"&&n(),t?t.__c:null}Gt.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(t){Object.defineProperty(Gt.prototype,t,{configurable:!0,get:function(){return this["UNSAFE_"+t]},set:function(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})});var Dc=he.event;function h5(){}function p5(){return this.cancelBubble}function m5(){return this.defaultPrevented}he.event=function(t){return Dc&&(t=Dc(t)),t.persist=h5,t.isPropagationStopped=p5,t.isDefaultPrevented=m5,t.nativeEvent=t};var x1,g5={enumerable:!1,configurable:!0,get:function(){return this.class}},Fc=he.vnode;he.vnode=function(t){typeof t.type=="string"&&function(e){var n=e.props,r=e.type,i={},a=r.indexOf("-")===-1;for(var o in n){var s=n[o];if(!(o==="value"&&"defaultValue"in n&&s==null||f5&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var u=o.toLowerCase();o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&s===!0?s="":u==="translate"&&s==="no"?s=!1:u[0]==="o"&&u[1]==="n"?u==="ondoubleclick"?o="ondblclick":u!=="onchange"||r!=="input"&&r!=="textarea"||d5(n.type)?u==="onfocus"?o="onfocusin":u==="onblur"?o="onfocusout":u5.test(o)&&(o=u):u=o="oninput":a&&l5.test(o)?o=o.replace(c5,"-$&").toLowerCase():s===null&&(s=void 0),u==="oninput"&&i[o=u]&&(o="oninputCapture"),i[o]=s}}r=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=fn(n.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),r=="select"&&i.defaultValue!=null&&(i.value=fn(n.children).forEach(function(c){c.props.selected=i.multiple?i.defaultValue.indexOf(c.props.value)!=-1:i.defaultValue==c.props.value})),n.class&&!n.className?(i.class=n.class,Object.defineProperty(i,"className",g5)):(n.className&&!n.class||n.class&&n.className)&&(i.class=i.className=n.className),e.props=i}(t),t.$$typeof=Pc,Fc&&Fc(t)};var Hc=he.__r;he.__r=function(t){Hc&&Hc(t),x1=t.__c};var Bc=he.diffed;he.diffed=function(t){Bc&&Bc(t);var e=t.props,n=t.__e;n!=null&&t.type==="textarea"&&"value"in e&&e.value!==n.value&&(n.value=e.value==null?"":e.value),x1=null};var Uc={ReactCurrentDispatcher:{current:{readContext:function(t){return x1.__n[t.__c].props.value},useCallback:Fn,useContext:kt,useDebugValue:p1,useDeferredValue:A1,useEffect:nt,useId:m1,useImperativeHandle:h1,useInsertionEffect:S1,useLayoutEffect:Dn,useMemo:zt,useReducer:Zr,useRef:hn,useState:$e,useSyncExternalStore:E1,useTransition:C1}}},T5="18.3.1";function qc(t){return et.bind(null,t)}function hr(t){return!!t&&t.$$typeof===Pc}function $c(t){return hr(t)&&t.type===Ot}function Gc(t){return!!t&&!!t.displayName&&(typeof t.displayName=="string"||t.displayName instanceof String)&&t.displayName.startsWith("Memo(")}function zc(t){return hr(t)?Zm.apply(null,arguments):t}function ri(t){return!!t.__k&&(fr(null,t),!0)}function Kc(t){return t&&(t.base||t.nodeType===1&&t)||null}var jc=function(t,e){return t(e)},O1=function(t,e){return t(e)},Wc=Ot,Vc=hr,L={useState:$e,useId:m1,useReducer:Zr,useEffect:nt,useLayoutEffect:Dn,useInsertionEffect:S1,useTransition:C1,useDeferredValue:A1,useSyncExternalStore:E1,startTransition:y1,useRef:hn,useImperativeHandle:h1,useMemo:zt,useCallback:Fn,useContext:kt,useDebugValue:p1,version:"18.3.1",Children:xc,render:R1,hydrate:Mc,unmountComponentAtNode:ri,createPortal:ni,createElement:et,createContext:Pn,createFactory:qc,cloneElement:zc,createRef:ic,Fragment:Ot,isValidElement:hr,isElement:Vc,isFragment:$c,isMemo:Gc,findDOMNode:Kc,Component:Gt,PureComponent:ti,memo:Sc,forwardRef:b1,flushSync:O1,unstable_batchedUpdates:jc,StrictMode:Wc,Suspense:dr,SuspenseList:Vn,lazy:wc,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Uc};const k1=Object.freeze(Object.defineProperty({__proto__:null,Children:xc,Component:Gt,Fragment:Ot,PureComponent:ti,StrictMode:Wc,Suspense:dr,SuspenseList:Vn,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Uc,cloneElement:zc,createContext:Pn,createElement:et,createFactory:qc,createPortal:ni,createRef:ic,default:L,findDOMNode:Kc,flushSync:O1,forwardRef:b1,hydrate:Mc,isElement:Vc,isFragment:$c,isMemo:Gc,isValidElement:hr,lazy:wc,memo:Sc,render:R1,startTransition:y1,unmountComponentAtNode:ri,unstable_batchedUpdates:jc,useCallback:Fn,useContext:kt,useDebugValue:p1,useDeferredValue:A1,useEffect:nt,useErrorBoundary:t5,useId:m1,useImperativeHandle:h1,useInsertionEffect:S1,useLayoutEffect:Dn,useMemo:zt,useReducer:Zr,useRef:hn,useState:$e,useSyncExternalStore:E1,useTransition:C1,version:T5},Symbol.toStringTag,{value:"Module"}));function Yc(t){return{all:t=t||new Map,on:function(e,n){var r=t.get(e);r?r.push(n):t.set(e,[n])},off:function(e,n){var r=t.get(e);r&&(n?r.splice(r.indexOf(n)>>>0,1):t.set(e,[]))},emit:function(e,n){var r=t.get(e);r&&r.slice().map(function(i){i(n)}),(r=t.get("*"))&&r.slice().map(function(i){i(e,n)})}}}function N1(t){this.message=t}N1.prototype=new Error,N1.prototype.name="InvalidCharacterError";var Qc=typeof window<"u"&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new N1("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,i=0,a=0,o="";r=e.charAt(a++);~r&&(n=i%4?64*n+r:r,i++%4)?o+=String.fromCharCode(255&n>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};function _5(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(n){return decodeURIComponent(Qc(n).replace(/(.)/g,function(r,i){var a=i.charCodeAt(0).toString(16).toUpperCase();return a.length<2&&(a="0"+a),"%"+a}))}(e)}catch{return Qc(e)}}function ii(t){this.message=t}function I1(t,e){if(typeof t!="string")throw new ii("Invalid token specified");var n=(e=e||{}).header===!0?0:1;try{return JSON.parse(_5(t.split(".")[n]))}catch(r){throw new ii("Invalid token specified: "+r.message)}}ii.prototype=new Error,ii.prototype.name="InvalidTokenError";const Xc=t=>{let e;const n=new Set,r=(c,d)=>{const f=typeof c=="function"?c(e):c;if(!Object.is(f,e)){const T=e;e=d??(typeof f!="object"||f===null)?f:Object.assign({},e,f),n.forEach(l=>l(e,T))}},i=()=>e,s={setState:r,getState:i,getInitialState:()=>u,subscribe:c=>(n.add(c),()=>n.delete(c))},u=e=t(r,i,s);return s},E5=t=>t?Xc(t):Xc,Xt=Object.create(null);Xt.open="0",Xt.close="1",Xt.ping="2",Xt.pong="3",Xt.message="4",Xt.upgrade="5",Xt.noop="6";const ai=Object.create(null);Object.keys(Xt).forEach(t=>{ai[Xt[t]]=t});const w1={type:"error",data:"parser error"},Jc=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Zc=typeof ArrayBuffer=="function",ef=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,L1=({type:t,data:e},n,r)=>Jc&&e instanceof Blob?n?r(e):tf(e,r):Zc&&(e instanceof ArrayBuffer||ef(e))?n?r(e):tf(new Blob([e]),r):r(Xt[t]+(e||"")),tf=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function nf(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let P1;function v5(t,e){if(Jc&&t.data instanceof Blob)return t.data.arrayBuffer().then(nf).then(e);if(Zc&&(t.data instanceof ArrayBuffer||ef(t.data)))return e(nf(t.data));L1(t,!1,n=>{P1||(P1=new TextEncoder),e(P1.encode(n))})}const rf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<rf.length;t++)pr[rf.charCodeAt(t)]=t;const y5=t=>{let e=t.length*.75,n=t.length,r,i=0,a,o,s,u;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const c=new ArrayBuffer(e),d=new Uint8Array(c);for(r=0;r<n;r+=4)a=pr[t.charCodeAt(r)],o=pr[t.charCodeAt(r+1)],s=pr[t.charCodeAt(r+2)],u=pr[t.charCodeAt(r+3)],d[i++]=a<<2|o>>4,d[i++]=(o&15)<<4|s>>2,d[i++]=(s&3)<<6|u&63;return c},A5=typeof ArrayBuffer=="function",M1=(t,e)=>{if(typeof t!="string")return{type:"message",data:af(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:C5(t.substring(1),e)}:ai[n]?t.length>1?{type:ai[n],data:t.substring(1)}:{type:ai[n]}:w1},C5=(t,e)=>{if(A5){const n=y5(t);return af(n,e)}else return{base64:!0,data:t}},af=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},sf="",S5=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((a,o)=>{L1(a,!1,s=>{r[o]=s,++i===n&&e(r.join(sf))})})},b5=(t,e)=>{const n=t.split(sf),r=[];for(let i=0;i<n.length;i++){const a=M1(n[i],e);if(r.push(a),a.type==="error")break}return r};function R5(){return new TransformStream({transform(t,e){v5(t,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const a=new DataView(i.buffer);a.setUint8(0,126),a.setUint16(1,r)}else{i=new Uint8Array(9);const a=new DataView(i.buffer);a.setUint8(0,127),a.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let D1;function si(t){return t.reduce((e,n)=>e+n.length,0)}function oi(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;i<e;i++)n[i]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function x5(t,e){D1||(D1=new TextDecoder);const n=[];let r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(si(n)<1)break;const u=oi(n,1);a=(u[0]&128)===128,i=u[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(si(n)<2)break;const u=oi(n,2);i=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),r=3}else if(r===2){if(si(n)<8)break;const u=oi(n,8),c=new DataView(u.buffer,u.byteOffset,u.length),d=c.getUint32(0);if(d>Math.pow(2,21)-1){s.enqueue(w1);break}i=d*Math.pow(2,32)+c.getUint32(4),r=3}else{if(si(n)<i)break;const u=oi(n,i);s.enqueue(M1(a?u:D1.decode(u),e)),r=0}if(i===0||i>t){s.enqueue(w1);break}}}})}const of=4;function Ye(t){if(t)return O5(t)}function O5(t){for(var e in Ye.prototype)t[e]=Ye.prototype[e];return t}Ye.prototype.on=Ye.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},Ye.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},Ye.prototype.off=Ye.prototype.removeListener=Ye.prototype.removeAllListeners=Ye.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===e||r.fn===e){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+t],this},Ye.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,e)}return this},Ye.prototype.emitReserved=Ye.prototype.emit,Ye.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},Ye.prototype.hasListeners=function(t){return!!this.listeners(t).length};const li=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Dt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),k5="arraybuffer";function N6(){}function lf(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const N5=Dt.setTimeout,I5=Dt.clearTimeout;function ui(t,e){e.useNativeTimers?(t.setTimeoutFn=N5.bind(Dt),t.clearTimeoutFn=I5.bind(Dt)):(t.setTimeoutFn=Dt.setTimeout.bind(Dt),t.clearTimeoutFn=Dt.clearTimeout.bind(Dt))}const w5=1.33;function L5(t){return typeof t=="string"?P5(t):Math.ceil((t.byteLength||t.size)*w5)}function P5(t){let e=0,n=0;for(let r=0,i=t.length;r<i;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function uf(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function M5(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function D5(t){let e={},n=t.split("&");for(let r=0,i=n.length;r<i;r++){let a=n[r].split("=");e[decodeURIComponent(a[0])]=decodeURIComponent(a[1])}return e}class F5 extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class F1 extends Ye{constructor(e){super(),this.writable=!1,ui(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new F5(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=M1(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=M5(e);return n.length?"?"+n:""}}class H5 extends F1{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};b5(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,S5(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=uf()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let cf=!1;try{cf=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const B5=cf;function U5(){}class q5 extends H5{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,a)=>{this.onError("xhr post error",i,a)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}class Jt extends Ye{constructor(e,n,r){super(),this.createRequest=e,ui(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=lf(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=Jt.requestsCount++,Jt.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=U5,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Jt.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(Jt.requestsCount=0,Jt.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",ff);else if(typeof addEventListener=="function"){const t="onpagehide"in Dt?"pagehide":"unload";addEventListener(t,ff,!1)}}function ff(){for(let t in Jt.requests)Jt.requests.hasOwnProperty(t)&&Jt.requests[t].abort()}const $5=function(){const t=df({xdomain:!1});return t&&t.responseType!==null}();class G5 extends q5{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=$5&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Jt(df,this.uri(),e)}}function df(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||B5))return new XMLHttpRequest}catch{}if(!e)try{return new Dt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const hf=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class z5 extends F1{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=hf?{}:lf(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;L1(r,this.supportsBinary,a=>{try{this.doWrite(r,a)}catch{}i&&li(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=uf()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const H1=Dt.WebSocket||Dt.MozWebSocket;class K5 extends z5{createSocket(e,n,r){return hf?new H1(e,n,r):n?new H1(e,n):new H1(e)}doWrite(e,n){this.ws.send(n)}}class j5 extends F1{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=x5(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=R5();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const a=()=>{r.read().then(({done:s,value:u})=>{s||(this.onPacket(u),a())}).catch(s=>{})};a();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],i=n===e.length-1;this._writer.write(r).then(()=>{i&&li(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const W5={websocket:K5,webtransport:j5,polling:G5},V5=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Y5=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function B1(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=V5.exec(t||""),a={},o=14;for(;o--;)a[Y5[o]]=i[o]||"";return n!=-1&&r!=-1&&(a.source=e,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a.pathNames=Q5(a,a.path),a.queryKey=X5(a,a.query),a}function Q5(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function X5(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,a){i&&(n[i]=a)}),n}const U1=typeof addEventListener=="function"&&typeof removeEventListener=="function",ci=[];U1&&addEventListener("offline",()=>{ci.forEach(t=>t())},!1);class xn extends Ye{constructor(e,n){if(super(),this.binaryType=k5,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=B1(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=B1(n.host).host);ui(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=D5(this.opts.query)),U1&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ci.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=of,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&xn.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",xn.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=L5(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,li(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const a={type:e,data:n,options:r};this.emitReserved("packetCreate",a),this.writeBuffer.push(a),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(xn.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),U1&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=ci.indexOf(this._offlineEventListener);r!==-1&&ci.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}xn.protocol=of;class J5 extends xn{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;xn.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;xn.priorWebsocketSucc