@nethesis/chat-island 0.1.5 โ†’ 0.1.7

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.
@@ -2,8 +2,8 @@
2
2
  `+fe+e}var me=!1;function O(e,t){if(!e||me)return``;me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t){if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var r=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){r=e}e.call(t.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==`string`){for(var i=t.stack.split(`
3
3
  `),a=r.stack.split(`
4
4
  `),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(o!==1||s!==1)do if(o--,s--,0>s||i[o]!==a[s]){var c=`
5
- `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{me=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?pe(e):``}function he(e){switch(e.tag){case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 2:case 15:return e=O(e.type,!1),e;case 11:return e=O(e.type.render,!1),e;case 1:return e=O(e.type,!0),e;default:return``}}function ge(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ee:return`Fragment`;case T:return`Portal`;case ne:return`Profiler`;case te:return`StrictMode`;case oe:return`Suspense`;case se:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case ie:return(e.displayName||`Context`)+`.Consumer`;case re:return(e._context.displayName||`Context`)+`.Provider`;case ae:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?ge(e.type)||`Memo`:t;case ce:t=e._payload,e=e._init;try{return ge(e(t))}catch{}}return null}function _e(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ge(t);case 8:return t===te?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function k(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ve(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ye(e){var t=ve(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function be(e){e._valueTracker||=ye(e)}function xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ve(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Se(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ce(e,t){var n=t.checked;return D({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function we(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=k(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Te(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function Ee(e,t){Te(e,t);var n=k(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?Oe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Oe(e,t.type,k(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function De(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function Oe(e,t,n){(t!==`number`||Se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ke=Array.isArray;function Ae(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+k(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function je(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return D({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Me(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(ke(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:k(n)}}function Ne(e,t){var n=k(t.value),r=k(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function Pe(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function Fe(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Ie(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?Fe(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Le,Re=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Le||=document.createElement(`div`),Le.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ze(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Be={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ve=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Be).forEach(function(e){Ve.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Be[t]=Be[e]})});function He(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Be.hasOwnProperty(e)&&Be[e]?(``+t).trim():t+`px`}function Ue(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=He(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var We=D({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ge(e,t){if(t){if(We[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ke(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var qe=null;function Je(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ye=null,Xe=null,Ze=null;function Qe(e){if(e=Wi(e)){if(typeof Ye!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ki(t),Ye(e.stateNode,e.type,t))}}function $e(e){Xe?Ze?Ze.push(e):Ze=[e]:Xe=e}function et(){if(Xe){var e=Xe,t=Ze;if(Ze=Xe=null,Qe(e),t)for(e=0;e<t.length;e++)Qe(t[e])}}function tt(e,t){return e(t)}function nt(){}var rt=!1;function it(e,t,n){if(rt)return e(t,n);rt=!0;try{return tt(e,t,n)}finally{rt=!1,(Xe!==null||Ze!==null)&&(nt(),et())}}function at(e,t){var n=e.stateNode;if(n===null)return null;var i=Ki(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var ot=!1;if(c)try{var st={};Object.defineProperty(st,"passive",{get:function(){ot=!0}}),window.addEventListener(`test`,st,st),window.removeEventListener(`test`,st,st)}catch{ot=!1}function ct(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var lt=!1,ut=null,dt=!1,ft=null,pt={onError:function(e){lt=!0,ut=e}};function mt(e,t,n,r,i,a,o,s,c){lt=!1,ut=null,ct.apply(pt,arguments)}function ht(e,t,n,i,a,o,s,c,l){if(mt.apply(this,arguments),lt){if(lt){var u=ut;lt=!1,ut=null}else throw Error(r(198));dt||(dt=!0,ft=u)}}function gt(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function _t(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function vt(e){if(gt(e)!==e)throw Error(r(188))}function yt(e){var t=e.alternate;if(!t){if(t=gt(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return vt(a),e;if(o===i)return vt(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function bt(e){return e=yt(e),e===null?null:xt(e)}function xt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=xt(e);if(t!==null)return t;e=e.sibling}return null}var St=n.unstable_scheduleCallback,Ct=n.unstable_cancelCallback,wt=n.unstable_shouldYield,Tt=n.unstable_requestPaint,A=n.unstable_now,Et=n.unstable_getCurrentPriorityLevel,Dt=n.unstable_ImmediatePriority,Ot=n.unstable_UserBlockingPriority,kt=n.unstable_NormalPriority,At=n.unstable_LowPriority,jt=n.unstable_IdlePriority,Mt=null,Nt=null;function Pt(e){if(Nt&&typeof Nt.onCommitFiberRoot==`function`)try{Nt.onCommitFiberRoot(Mt,e,void 0,(e.current.flags&128)==128)}catch{}}var Ft=Math.clz32?Math.clz32:Rt,It=Math.log,Lt=Math.LN2;function Rt(e){return e>>>=0,e===0?32:31-(It(e)/Lt|0)|0}var zt=64,Bt=4194304;function Vt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ht(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Vt(a))):r=Vt(s)}else o=n&~i,o===0?a!==0&&(r=Vt(a)):r=Vt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Ft(t),i=1<<n,r|=e[n],t&=~i;return r}function Ut(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Ft(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ut(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Gt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Kt(){var e=zt;return zt<<=1,!(zt&4194240)&&(zt=64),e}function qt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Jt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ft(t),e[t]=n}function Yt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Ft(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Xt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ft(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var j=0;function Zt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Qt,$t,en,tn,nn,rn=!1,an=[],on=null,sn=null,cn=null,ln=new Map,un=new Map,dn=[],fn=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit`.split(` `);function pn(e,t){switch(e){case`focusin`:case`focusout`:on=null;break;case`dragenter`:case`dragleave`:sn=null;break;case`mouseover`:case`mouseout`:cn=null;break;case`pointerover`:case`pointerout`:ln.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:un.delete(t.pointerId)}}function mn(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Wi(t),t!==null&&$t(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function hn(e,t,n,r,i){switch(t){case`focusin`:return on=mn(on,e,t,n,r,i),!0;case`dragenter`:return sn=mn(sn,e,t,n,r,i),!0;case`mouseover`:return cn=mn(cn,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return ln.set(a,mn(ln.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,un.set(a,mn(un.get(a)||null,e,t,n,r,i)),!0}return!1}function gn(e){var t=Ui(e.target);if(t!==null){var n=gt(t);if(n!==null){if(t=n.tag,t===13){if(t=_t(n),t!==null){e.blockedOn=t,nn(e.priority,function(){en(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function _n(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=En(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qe=r,n.target.dispatchEvent(r),qe=null}else return t=Wi(n),t!==null&&$t(t),e.blockedOn=n,!1;t.shift()}return!0}function vn(e,t,n){_n(e)&&n.delete(t)}function yn(){rn=!1,on!==null&&_n(on)&&(on=null),sn!==null&&_n(sn)&&(sn=null),cn!==null&&_n(cn)&&(cn=null),ln.forEach(vn),un.forEach(vn)}function bn(e,t){e.blockedOn===t&&(e.blockedOn=null,rn||(rn=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,yn)))}function xn(e){function t(t){return bn(t,e)}if(0<an.length){bn(an[0],e);for(var n=1;n<an.length;n++){var r=an[n];r.blockedOn===e&&(r.blockedOn=null)}}for(on!==null&&bn(on,e),sn!==null&&bn(sn,e),cn!==null&&bn(cn,e),ln.forEach(t),un.forEach(t),n=0;n<dn.length;n++)r=dn[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<dn.length&&(n=dn[0],n.blockedOn===null);)gn(n),n.blockedOn===null&&dn.shift()}var M=C.ReactCurrentBatchConfig,Sn=!0;function Cn(e,t,n,r){var i=j,a=M.transition;M.transition=null;try{j=1,wn(e,t,n,r)}finally{j=i,M.transition=a}}function N(e,t,n,r){var i=j,a=M.transition;M.transition=null;try{j=4,wn(e,t,n,r)}finally{j=i,M.transition=a}}function wn(e,t,n,r){if(Sn){var i=En(e,t,n,r);if(i===null)hi(e,t,r,Tn,n),pn(e,r);else if(hn(i,e,t,n,r))r.stopPropagation();else if(pn(e,r),t&4&&-1<fn.indexOf(e)){for(;i!==null;){var a=Wi(i);if(a!==null&&Qt(a),a=En(e,t,n,r),a===null&&hi(e,t,r,Tn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else hi(e,t,r,null,n)}}var Tn=null;function En(e,t,n,r){if(Tn=null,e=Je(r),e=Ui(e),e!==null){if(t=gt(e),t===null)e=null;else if(n=t.tag,n===13){if(e=_t(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return Tn=e,null}function Dn(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(Et()){case Dt:return 1;case Ot:return 4;case kt:case At:return 16;case jt:return 536870912;default:return 16}default:return 16}}var On=null,kn=null,An=null;function jn(){if(An)return An;var e,t=kn,n=t.length,r,i=`value`in On?On.value:On.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return An=i.slice(e,1<r?1-r:void 0)}function Mn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Nn(){return!0}function Pn(){return!1}function Fn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Nn:Pn,this.isPropagationStopped=Pn,this}return D(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Nn)},persist:function(){},isPersistent:Nn}),t}var In={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ln=Fn(In),Rn=D({},In,{view:0,detail:0}),zn=Fn(Rn),Bn,Vn,Hn,Un=D({},Rn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:F,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Hn&&(Hn&&e.type===`mousemove`?(Bn=e.screenX-Hn.screenX,Vn=e.screenY-Hn.screenY):Vn=Bn=0,Hn=e),Bn)},movementY:function(e){return`movementY`in e?e.movementY:Vn}}),Wn=Fn(Un),P=Fn(D({},Un,{dataTransfer:0})),Gn=Fn(D({},Rn,{relatedTarget:0})),Kn=Fn(D({},In,{animationName:0,elapsedTime:0,pseudoElement:0})),qn=Fn(D({},In,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Jn=Fn(D({},In,{data:0})),Yn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Xn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Qn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Zn[e])?!!t[e]:!1}function F(){return Qn}var $n=Fn(D({},Rn,{key:function(e){if(e.key){var t=Yn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Mn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Xn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:F,charCode:function(e){return e.type===`keypress`?Mn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Mn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),er=Fn(D({},Un,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),I=Fn(D({},Rn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:F})),tr=Fn(D({},In,{propertyName:0,elapsedTime:0,pseudoElement:0})),nr=Fn(D({},Un,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),rr=[9,13,27,32],ir=c&&`CompositionEvent`in window,ar=null;c&&`documentMode`in document&&(ar=document.documentMode);var or=c&&`TextEvent`in window&&!ar,sr=c&&(!ir||ar&&8<ar&&11>=ar),L=` `,cr=!1;function lr(e,t){switch(e){case`keyup`:return rr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ur(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var dr=!1;function fr(e,t){switch(e){case`compositionend`:return ur(t);case`keypress`:return t.which===32?(cr=!0,L):null;case`textInput`:return e=t.data,e===L&&cr?null:e;default:return null}}function pr(e,t){if(dr)return e===`compositionend`||!ir&&lr(e,t)?(e=jn(),An=kn=On=null,dr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return sr&&t.locale!==`ko`?null:t.data;default:return null}}var mr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!mr[e.type]:t===`textarea`}function gr(e,t,n,r){$e(r),t=_i(t,`onChange`),0<t.length&&(n=new Ln(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var _r=null,vr=null;function yr(e){ui(e,0)}function br(e){if(xe(Gi(e)))return e}function xr(e,t){if(e===`change`)return t}var Sr=!1;if(c){var Cr;if(c){var wr=`oninput`in document;if(!wr){var Tr=document.createElement(`div`);Tr.setAttribute(`oninput`,`return;`),wr=typeof Tr.oninput==`function`}Cr=wr}else Cr=!1;Sr=Cr&&(!document.documentMode||9<document.documentMode)}function Er(){_r&&(_r.detachEvent(`onpropertychange`,Dr),vr=_r=null)}function Dr(e){if(e.propertyName===`value`&&br(vr)){var t=[];gr(t,vr,e,Je(e)),it(yr,t)}}function Or(e,t,n){e===`focusin`?(Er(),_r=t,vr=n,_r.attachEvent(`onpropertychange`,Dr)):e===`focusout`&&Er()}function kr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return br(vr)}function Ar(e,t){if(e===`click`)return br(t)}function jr(e,t){if(e===`input`||e===`change`)return br(t)}function Mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Nr=typeof Object.is==`function`?Object.is:Mr;function Pr(e,t){if(Nr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Nr(e[i],t[i]))return!1}return!0}function Fr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ir(e,t){var n=Fr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Fr(n)}}function Lr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Rr(){for(var e=window,t=Se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Se(e.document)}return t}function zr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Br(e){var t=Rr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Lr(n.ownerDocument.documentElement,n)){if(r!==null&&zr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ir(n,a);var o=Ir(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Vr=c&&`documentMode`in document&&11>=document.documentMode,Hr=null,Ur=null,Wr=null,Gr=!1;function Kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Gr||Hr==null||Hr!==Se(r)||(r=Hr,`selectionStart`in r&&zr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Wr&&Pr(Wr,r)||(Wr=r,r=_i(Ur,`onSelect`),0<r.length&&(t=new Ln(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Hr)))}function qr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Jr={animationend:qr(`Animation`,`AnimationEnd`),animationiteration:qr(`Animation`,`AnimationIteration`),animationstart:qr(`Animation`,`AnimationStart`),transitionend:qr(`Transition`,`TransitionEnd`)},Yr={},Xr={};c&&(Xr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Jr.animationend.animation,delete Jr.animationiteration.animation,delete Jr.animationstart.animation),`TransitionEvent`in window||delete Jr.transitionend.transition);function Zr(e){if(Yr[e])return Yr[e];if(!Jr[e])return e;var t=Jr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Xr)return Yr[e]=t[n];return e}var Qr=Zr(`animationend`),$r=Zr(`animationiteration`),ei=Zr(`animationstart`),ti=Zr(`transitionend`),ni=new Map,ri=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function ii(e,t){ni.set(e,t),o(t,[e])}for(var ai=0;ai<ri.length;ai++){var oi=ri[ai];ii(oi.toLowerCase(),`on`+(oi[0].toUpperCase()+oi.slice(1)))}ii(Qr,`onAnimationEnd`),ii($r,`onAnimationIteration`),ii(ei,`onAnimationStart`),ii(`dblclick`,`onDoubleClick`),ii(`focusin`,`onFocus`),ii(`focusout`,`onBlur`),ii(ti,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var si=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),ci=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(si));function li(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,ht(r,t,void 0,e),e.currentTarget=null}function ui(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;li(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;li(i,s,l),a=c}}}if(dt)throw e=ft,dt=!1,ft=null,e}function R(e,t){var n=t[Bi];n===void 0&&(n=t[Bi]=new Set);var r=e+`__bubble`;n.has(r)||(mi(t,e,2,!1),n.add(r))}function di(e,t,n){var r=0;t&&(r|=4),mi(n,e,r,t)}var fi=`_reactListening`+Math.random().toString(36).slice(2);function pi(e){if(!e[fi]){e[fi]=!0,i.forEach(function(t){t!==`selectionchange`&&(ci.has(t)||di(t,!1,e),di(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[fi]||(t[fi]=!0,di(`selectionchange`,!1,t))}}function mi(e,t,n,r){switch(Dn(t)){case 1:var i=Cn;break;case 4:i=N;break;default:i=wn}n=i.bind(null,t,n,e),i=void 0,!ot||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function hi(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Ui(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}it(function(){var r=a,i=Je(n),o=[];a:{var s=ni.get(e);if(s!==void 0){var c=Ln,l=e;switch(e){case`keypress`:if(Mn(n)===0)break a;case`keydown`:case`keyup`:c=$n;break;case`focusin`:l=`focus`,c=Gn;break;case`focusout`:l=`blur`,c=Gn;break;case`beforeblur`:case`afterblur`:c=Gn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=P;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=I;break;case Qr:case $r:case ei:c=Kn;break;case ti:c=tr;break;case`scroll`:c=zn;break;case`wheel`:c=nr;break;case`copy`:case`cut`:case`paste`:c=qn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=er}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=at(p,f),h!=null&&u.push(gi(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==qe&&(l=n.relatedTarget||n.fromElement)&&(Ui(l)||l[zi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ui(l):null,l!==null&&(d=gt(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Wn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=er,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Gi(c),m=l==null?s:Gi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Ui(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=vi(m))p++;for(m=0,h=f;h;h=vi(h))m++;for(;0<p-m;)u=vi(u),p--;for(;0<m-p;)f=vi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=vi(u),f=vi(f)}u=null}else u=null;c!==null&&yi(o,s,c,u,!1),l!==null&&d!==null&&yi(o,d,l,u,!0)}}a:{if(s=r?Gi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=xr;else if(hr(s)){if(Sr)g=jr;else{g=kr;var _=Or}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=Ar);if(g&&=g(e,r)){gr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&Oe(s,`number`,s.value)}switch(_=r?Gi(r):window,e){case`focusin`:(hr(_)||_.contentEditable===`true`)&&(Hr=_,Ur=r,Wr=null);break;case`focusout`:Wr=Ur=Hr=null;break;case`mousedown`:Gr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Gr=!1,Kr(o,n,i);break;case`selectionchange`:if(Vr)break;case`keydown`:case`keyup`:Kr(o,n,i)}var v;if(ir)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else dr?lr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(sr&&n.locale!==`ko`&&(dr||y!==`onCompositionStart`?y===`onCompositionEnd`&&dr&&(v=jn()):(On=i,kn=`value`in On?On.value:On.textContent,dr=!0)),_=_i(r,y),0<_.length&&(y=new Jn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=ur(n),v!==null&&(y.data=v)))),(v=or?fr(e,n):pr(e,n))&&(r=_i(r,`onBeforeInput`),0<r.length&&(i=new Jn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ui(o,t)})}function gi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function _i(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=at(e,n),a!=null&&r.unshift(gi(e,a,i)),a=at(e,t),a!=null&&r.push(gi(e,a,i))),e=e.return}return r}function vi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function yi(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=at(n,a),c!=null&&o.unshift(gi(n,c,s))):i||(c=at(n,a),c!=null&&o.push(gi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var bi=/\r\n?/g,xi=/\u0000|\uFFFD/g;function Si(e){return(typeof e==`string`?e:``+e).replace(bi,`
5
+ `+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(`<anonymous>`)&&(c=c.replace(`<anonymous>`,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{me=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?pe(e):``}function he(e){switch(e.tag){case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 2:case 15:return e=O(e.type,!1),e;case 11:return e=O(e.type.render,!1),e;case 1:return e=O(e.type,!0),e;default:return``}}function ge(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ee:return`Fragment`;case T:return`Portal`;case ne:return`Profiler`;case te:return`StrictMode`;case oe:return`Suspense`;case se:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case ie:return(e.displayName||`Context`)+`.Consumer`;case re:return(e._context.displayName||`Context`)+`.Provider`;case ae:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?ge(e.type)||`Memo`:t;case ce:t=e._payload,e=e._init;try{return ge(e(t))}catch{}}return null}function _e(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ge(t);case 8:return t===te?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function k(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function ve(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function ye(e){var t=ve(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function be(e){e._valueTracker||=ye(e)}function xe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=ve(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Se(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ce(e,t){var n=t.checked;return D({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function we(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=k(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function Te(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function Ee(e,t){Te(e,t);var n=k(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?Oe(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&Oe(e,t.type,k(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function De(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function Oe(e,t,n){(t!==`number`||Se(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ke=Array.isArray;function Ae(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+k(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function je(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(r(91));return D({},t,{value:void 0,defaultValue:void 0,children:``+e._wrapperState.initialValue})}function Me(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(r(92));if(ke(n)){if(1<n.length)throw Error(r(93));n=n[0]}t=n}t??=``,n=t}e._wrapperState={initialValue:k(n)}}function Ne(e,t){var n=k(t.value),r=k(t.defaultValue);n!=null&&(n=``+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=``+r)}function Pe(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==``&&t!==null&&(e.value=t)}function Fe(e){switch(e){case`svg`:return`http://www.w3.org/2000/svg`;case`math`:return`http://www.w3.org/1998/Math/MathML`;default:return`http://www.w3.org/1999/xhtml`}}function Ie(e,t){return e==null||e===`http://www.w3.org/1999/xhtml`?Fe(t):e===`http://www.w3.org/2000/svg`&&t===`foreignObject`?`http://www.w3.org/1999/xhtml`:e}var Le,Re=function(e){return typeof MSApp<`u`&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!==`http://www.w3.org/2000/svg`||`innerHTML`in e)e.innerHTML=t;else{for(Le||=document.createElement(`div`),Le.innerHTML=`<svg>`+t.valueOf().toString()+`</svg>`,t=Le.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ze(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Be={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Ve=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Be).forEach(function(e){Ve.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Be[t]=Be[e]})});function He(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Be.hasOwnProperty(e)&&Be[e]?(``+t).trim():t+`px`}function Ue(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=He(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var We=D({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Ge(e,t){if(t){if(We[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ke(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var qe=null;function Je(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ye=null,Xe=null,Ze=null;function Qe(e){if(e=Wi(e)){if(typeof Ye!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Ki(t),Ye(e.stateNode,e.type,t))}}function $e(e){Xe?Ze?Ze.push(e):Ze=[e]:Xe=e}function et(){if(Xe){var e=Xe,t=Ze;if(Ze=Xe=null,Qe(e),t)for(e=0;e<t.length;e++)Qe(t[e])}}function tt(e,t){return e(t)}function nt(){}var rt=!1;function it(e,t,n){if(rt)return e(t,n);rt=!0;try{return tt(e,t,n)}finally{rt=!1,(Xe!==null||Ze!==null)&&(nt(),et())}}function at(e,t){var n=e.stateNode;if(n===null)return null;var i=Ki(n);if(i===null)return null;n=i[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(i=!i.disabled)||(e=e.type,i=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!i;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(r(231,t,typeof n));return n}var ot=!1;if(c)try{var st={};Object.defineProperty(st,"passive",{get:function(){ot=!0}}),window.addEventListener(`test`,st,st),window.removeEventListener(`test`,st,st)}catch{ot=!1}function ct(e,t,n,r,i,a,o,s,c){var l=Array.prototype.slice.call(arguments,3);try{t.apply(n,l)}catch(e){this.onError(e)}}var lt=!1,ut=null,dt=!1,ft=null,pt={onError:function(e){lt=!0,ut=e}};function mt(e,t,n,r,i,a,o,s,c){lt=!1,ut=null,ct.apply(pt,arguments)}function ht(e,t,n,i,a,o,s,c,l){if(mt.apply(this,arguments),lt){if(lt){var u=ut;lt=!1,ut=null}else throw Error(r(198));dt||(dt=!0,ft=u)}}function gt(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function _t(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function vt(e){if(gt(e)!==e)throw Error(r(188))}function yt(e){var t=e.alternate;if(!t){if(t=gt(e),t===null)throw Error(r(188));return t===e?e:null}for(var n=e,i=t;;){var a=n.return;if(a===null)break;var o=a.alternate;if(o===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===o.child){for(o=a.child;o;){if(o===n)return vt(a),e;if(o===i)return vt(a),t;o=o.sibling}throw Error(r(188))}if(n.return!==i.return)n=a,i=o;else{for(var s=!1,c=a.child;c;){if(c===n){s=!0,n=a,i=o;break}if(c===i){s=!0,i=a,n=o;break}c=c.sibling}if(!s){for(c=o.child;c;){if(c===n){s=!0,n=o,i=a;break}if(c===i){s=!0,i=o,n=a;break}c=c.sibling}if(!s)throw Error(r(189))}}if(n.alternate!==i)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?e:t}function bt(e){return e=yt(e),e===null?null:xt(e)}function xt(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=xt(e);if(t!==null)return t;e=e.sibling}return null}var St=n.unstable_scheduleCallback,Ct=n.unstable_cancelCallback,wt=n.unstable_shouldYield,Tt=n.unstable_requestPaint,A=n.unstable_now,Et=n.unstable_getCurrentPriorityLevel,Dt=n.unstable_ImmediatePriority,Ot=n.unstable_UserBlockingPriority,kt=n.unstable_NormalPriority,At=n.unstable_LowPriority,jt=n.unstable_IdlePriority,Mt=null,Nt=null;function Pt(e){if(Nt&&typeof Nt.onCommitFiberRoot==`function`)try{Nt.onCommitFiberRoot(Mt,e,void 0,(e.current.flags&128)==128)}catch{}}var Ft=Math.clz32?Math.clz32:Rt,It=Math.log,Lt=Math.LN2;function Rt(e){return e>>>=0,e===0?32:31-(It(e)/Lt|0)|0}var zt=64,Bt=4194304;function Vt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Ht(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Vt(a))):r=Vt(s)}else o=n&~i,o===0?a!==0&&(r=Vt(a)):r=Vt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Ft(t),i=1<<n,r|=e[n],t&=~i;return r}function Ut(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Wt(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes;0<a;){var o=31-Ft(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ut(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}}function Gt(e){return e=e.pendingLanes&-1073741825,e===0?e&1073741824?1073741824:0:e}function Kt(){var e=zt;return zt<<=1,!(zt&4194240)&&(zt=64),e}function qt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Jt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ft(t),e[t]=n}function Yt(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Ft(n),a=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~a}}function Xt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ft(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var j=0;function Zt(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Qt,$t,en,tn,nn,rn=!1,an=[],on=null,sn=null,cn=null,ln=new Map,un=new Map,dn=[],fn=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit`.split(` `);function pn(e,t){switch(e){case`focusin`:case`focusout`:on=null;break;case`dragenter`:case`dragleave`:sn=null;break;case`mouseover`:case`mouseout`:cn=null;break;case`pointerover`:case`pointerout`:ln.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:un.delete(t.pointerId)}}function mn(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Wi(t),t!==null&&$t(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function hn(e,t,n,r,i){switch(t){case`focusin`:return on=mn(on,e,t,n,r,i),!0;case`dragenter`:return sn=mn(sn,e,t,n,r,i),!0;case`mouseover`:return cn=mn(cn,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return ln.set(a,mn(ln.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,un.set(a,mn(un.get(a)||null,e,t,n,r,i)),!0}return!1}function gn(e){var t=Ui(e.target);if(t!==null){var n=gt(t);if(n!==null){if(t=n.tag,t===13){if(t=_t(n),t!==null){e.blockedOn=t,nn(e.priority,function(){en(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function _n(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=En(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qe=r,n.target.dispatchEvent(r),qe=null}else return t=Wi(n),t!==null&&$t(t),e.blockedOn=n,!1;t.shift()}return!0}function vn(e,t,n){_n(e)&&n.delete(t)}function yn(){rn=!1,on!==null&&_n(on)&&(on=null),sn!==null&&_n(sn)&&(sn=null),cn!==null&&_n(cn)&&(cn=null),ln.forEach(vn),un.forEach(vn)}function bn(e,t){e.blockedOn===t&&(e.blockedOn=null,rn||(rn=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,yn)))}function xn(e){function t(t){return bn(t,e)}if(0<an.length){bn(an[0],e);for(var n=1;n<an.length;n++){var r=an[n];r.blockedOn===e&&(r.blockedOn=null)}}for(on!==null&&bn(on,e),sn!==null&&bn(sn,e),cn!==null&&bn(cn,e),ln.forEach(t),un.forEach(t),n=0;n<dn.length;n++)r=dn[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<dn.length&&(n=dn[0],n.blockedOn===null);)gn(n),n.blockedOn===null&&dn.shift()}var M=C.ReactCurrentBatchConfig,Sn=!0;function Cn(e,t,n,r){var i=j,a=M.transition;M.transition=null;try{j=1,wn(e,t,n,r)}finally{j=i,M.transition=a}}function N(e,t,n,r){var i=j,a=M.transition;M.transition=null;try{j=4,wn(e,t,n,r)}finally{j=i,M.transition=a}}function wn(e,t,n,r){if(Sn){var i=En(e,t,n,r);if(i===null)hi(e,t,r,Tn,n),pn(e,r);else if(hn(i,e,t,n,r))r.stopPropagation();else if(pn(e,r),t&4&&-1<fn.indexOf(e)){for(;i!==null;){var a=Wi(i);if(a!==null&&Qt(a),a=En(e,t,n,r),a===null&&hi(e,t,r,Tn,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else hi(e,t,r,null,n)}}var Tn=null;function En(e,t,n,r){if(Tn=null,e=Je(r),e=Ui(e),e!==null){if(t=gt(e),t===null)e=null;else if(n=t.tag,n===13){if(e=_t(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}return Tn=e,null}function Dn(e){switch(e){case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 1;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`toggle`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 4;case`message`:switch(Et()){case Dt:return 1;case Ot:return 4;case kt:case At:return 16;case jt:return 536870912;default:return 16}default:return 16}}var On=null,kn=null,An=null;function jn(){if(An)return An;var e,t=kn,n=t.length,r,i=`value`in On?On.value:On.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return An=i.slice(e,1<r?1-r:void 0)}function Mn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Nn(){return!0}function Pn(){return!1}function Fn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Nn:Pn,this.isPropagationStopped=Pn,this}return D(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Nn)},persist:function(){},isPersistent:Nn}),t}var In={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ln=Fn(In),Rn=D({},In,{view:0,detail:0}),zn=Fn(Rn),Bn,Vn,Hn,Un=D({},Rn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$n,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Hn&&(Hn&&e.type===`mousemove`?(Bn=e.screenX-Hn.screenX,Vn=e.screenY-Hn.screenY):Vn=Bn=0,Hn=e),Bn)},movementY:function(e){return`movementY`in e?e.movementY:Vn}}),Wn=Fn(Un),Gn=Fn(D({},Un,{dataTransfer:0})),P=Fn(D({},Rn,{relatedTarget:0})),Kn=Fn(D({},In,{animationName:0,elapsedTime:0,pseudoElement:0})),qn=Fn(D({},In,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Jn=Fn(D({},In,{data:0})),Yn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Xn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},Zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Qn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Zn[e])?!!t[e]:!1}function $n(){return Qn}var F=Fn(D({},Rn,{key:function(e){if(e.key){var t=Yn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Mn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Xn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$n,charCode:function(e){return e.type===`keypress`?Mn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Mn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),er=Fn(D({},Un,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),tr=Fn(D({},Rn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$n})),I=Fn(D({},In,{propertyName:0,elapsedTime:0,pseudoElement:0})),nr=Fn(D({},Un,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),rr=[9,13,27,32],ir=c&&`CompositionEvent`in window,ar=null;c&&`documentMode`in document&&(ar=document.documentMode);var or=c&&`TextEvent`in window&&!ar,sr=c&&(!ir||ar&&8<ar&&11>=ar),cr=` `,L=!1;function lr(e,t){switch(e){case`keyup`:return rr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function ur(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var dr=!1;function fr(e,t){switch(e){case`compositionend`:return ur(t);case`keypress`:return t.which===32?(L=!0,cr):null;case`textInput`:return e=t.data,e===cr&&L?null:e;default:return null}}function pr(e,t){if(dr)return e===`compositionend`||!ir&&lr(e,t)?(e=jn(),An=kn=On=null,dr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return sr&&t.locale!==`ko`?null:t.data;default:return null}}var mr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!mr[e.type]:t===`textarea`}function gr(e,t,n,r){$e(r),t=_i(t,`onChange`),0<t.length&&(n=new Ln(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var _r=null,vr=null;function yr(e){ui(e,0)}function br(e){if(xe(Gi(e)))return e}function xr(e,t){if(e===`change`)return t}var Sr=!1;if(c){var Cr;if(c){var wr=`oninput`in document;if(!wr){var Tr=document.createElement(`div`);Tr.setAttribute(`oninput`,`return;`),wr=typeof Tr.oninput==`function`}Cr=wr}else Cr=!1;Sr=Cr&&(!document.documentMode||9<document.documentMode)}function Er(){_r&&(_r.detachEvent(`onpropertychange`,Dr),vr=_r=null)}function Dr(e){if(e.propertyName===`value`&&br(vr)){var t=[];gr(t,vr,e,Je(e)),it(yr,t)}}function Or(e,t,n){e===`focusin`?(Er(),_r=t,vr=n,_r.attachEvent(`onpropertychange`,Dr)):e===`focusout`&&Er()}function kr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return br(vr)}function Ar(e,t){if(e===`click`)return br(t)}function jr(e,t){if(e===`input`||e===`change`)return br(t)}function Mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Nr=typeof Object.is==`function`?Object.is:Mr;function Pr(e,t){if(Nr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!l.call(t,i)||!Nr(e[i],t[i]))return!1}return!0}function Fr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ir(e,t){var n=Fr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Fr(n)}}function Lr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Lr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Rr(){for(var e=window,t=Se();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Se(e.document)}return t}function zr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Br(e){var t=Rr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Lr(n.ownerDocument.documentElement,n)){if(r!==null&&zr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=Ir(n,a);var o=Ir(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Vr=c&&`documentMode`in document&&11>=document.documentMode,Hr=null,Ur=null,Wr=null,Gr=!1;function Kr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Gr||Hr==null||Hr!==Se(r)||(r=Hr,`selectionStart`in r&&zr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Wr&&Pr(Wr,r)||(Wr=r,r=_i(Ur,`onSelect`),0<r.length&&(t=new Ln(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Hr)))}function qr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Jr={animationend:qr(`Animation`,`AnimationEnd`),animationiteration:qr(`Animation`,`AnimationIteration`),animationstart:qr(`Animation`,`AnimationStart`),transitionend:qr(`Transition`,`TransitionEnd`)},Yr={},Xr={};c&&(Xr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Jr.animationend.animation,delete Jr.animationiteration.animation,delete Jr.animationstart.animation),`TransitionEvent`in window||delete Jr.transitionend.transition);function Zr(e){if(Yr[e])return Yr[e];if(!Jr[e])return e;var t=Jr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Xr)return Yr[e]=t[n];return e}var Qr=Zr(`animationend`),$r=Zr(`animationiteration`),ei=Zr(`animationstart`),ti=Zr(`transitionend`),ni=new Map,ri=`abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);function ii(e,t){ni.set(e,t),o(t,[e])}for(var ai=0;ai<ri.length;ai++){var oi=ri[ai];ii(oi.toLowerCase(),`on`+(oi[0].toUpperCase()+oi.slice(1)))}ii(Qr,`onAnimationEnd`),ii($r,`onAnimationIteration`),ii(ei,`onAnimationStart`),ii(`dblclick`,`onDoubleClick`),ii(`focusin`,`onFocus`),ii(`focusout`,`onBlur`),ii(ti,`onTransitionEnd`),s(`onMouseEnter`,[`mouseout`,`mouseover`]),s(`onMouseLeave`,[`mouseout`,`mouseover`]),s(`onPointerEnter`,[`pointerout`,`pointerover`]),s(`onPointerLeave`,[`pointerout`,`pointerover`]),o(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),o(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),o(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),o(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),o(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var si=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),ci=new Set(`cancel close invalid load scroll toggle`.split(` `).concat(si));function li(e,t,n){var r=e.type||`unknown-event`;e.currentTarget=n,ht(r,t,void 0,e),e.currentTarget=null}function ui(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;li(i,s,l),a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;li(i,s,l),a=c}}}if(dt)throw e=ft,dt=!1,ft=null,e}function R(e,t){var n=t[Bi];n===void 0&&(n=t[Bi]=new Set);var r=e+`__bubble`;n.has(r)||(mi(t,e,2,!1),n.add(r))}function di(e,t,n){var r=0;t&&(r|=4),mi(n,e,r,t)}var fi=`_reactListening`+Math.random().toString(36).slice(2);function pi(e){if(!e[fi]){e[fi]=!0,i.forEach(function(t){t!==`selectionchange`&&(ci.has(t)||di(t,!1,e),di(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[fi]||(t[fi]=!0,di(`selectionchange`,!1,t))}}function mi(e,t,n,r){switch(Dn(t)){case 1:var i=Cn;break;case 4:i=N;break;default:i=wn}n=i.bind(null,t,n,e),i=void 0,!ot||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function hi(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i||s.nodeType===8&&s.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;s!==null;){if(o=Ui(s),o===null)return;if(c=o.tag,c===5||c===6){r=a=o;continue a}s=s.parentNode}}r=r.return}it(function(){var r=a,i=Je(n),o=[];a:{var s=ni.get(e);if(s!==void 0){var c=Ln,l=e;switch(e){case`keypress`:if(Mn(n)===0)break a;case`keydown`:case`keyup`:c=F;break;case`focusin`:l=`focus`,c=P;break;case`focusout`:l=`blur`,c=P;break;case`beforeblur`:case`afterblur`:c=P;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:c=Wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:c=Gn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:c=tr;break;case Qr:case $r:case ei:c=Kn;break;case ti:c=I;break;case`scroll`:c=zn;break;case`wheel`:c=nr;break;case`copy`:case`cut`:case`paste`:c=qn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:c=er}var u=!!(t&4),d=!u&&e===`scroll`,f=u?s===null?null:s+`Capture`:s;u=[];for(var p=r,m;p!==null;){m=p;var h=m.stateNode;if(m.tag===5&&h!==null&&(m=h,f!==null&&(h=at(p,f),h!=null&&u.push(gi(p,h,m)))),d)break;p=p.return}0<u.length&&(s=new c(s,l,null,n,i),o.push({event:s,listeners:u}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,s&&n!==qe&&(l=n.relatedTarget||n.fromElement)&&(Ui(l)||l[zi]))break a;if((c||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Ui(l):null,l!==null&&(d=gt(l),l!==d||l.tag!==5&&l.tag!==6)&&(l=null)):(c=null,l=r),c!==l)){if(u=Wn,h=`onMouseLeave`,f=`onMouseEnter`,p=`mouse`,(e===`pointerout`||e===`pointerover`)&&(u=er,h=`onPointerLeave`,f=`onPointerEnter`,p=`pointer`),d=c==null?s:Gi(c),m=l==null?s:Gi(l),s=new u(h,p+`leave`,c,n,i),s.target=d,s.relatedTarget=m,h=null,Ui(i)===r&&(u=new u(f,p+`enter`,l,n,i),u.target=m,u.relatedTarget=d,h=u),d=h,c&&l)b:{for(u=c,f=l,p=0,m=u;m;m=vi(m))p++;for(m=0,h=f;h;h=vi(h))m++;for(;0<p-m;)u=vi(u),p--;for(;0<m-p;)f=vi(f),m--;for(;p--;){if(u===f||f!==null&&u===f.alternate)break b;u=vi(u),f=vi(f)}u=null}else u=null;c!==null&&yi(o,s,c,u,!1),l!==null&&d!==null&&yi(o,d,l,u,!0)}}a:{if(s=r?Gi(r):window,c=s.nodeName&&s.nodeName.toLowerCase(),c===`select`||c===`input`&&s.type===`file`)var g=xr;else if(hr(s)){if(Sr)g=jr;else{g=kr;var _=Or}}else(c=s.nodeName)&&c.toLowerCase()===`input`&&(s.type===`checkbox`||s.type===`radio`)&&(g=Ar);if(g&&=g(e,r)){gr(o,g,n,i);break a}_&&_(e,s,r),e===`focusout`&&(_=s._wrapperState)&&_.controlled&&s.type===`number`&&Oe(s,`number`,s.value)}switch(_=r?Gi(r):window,e){case`focusin`:(hr(_)||_.contentEditable===`true`)&&(Hr=_,Ur=r,Wr=null);break;case`focusout`:Wr=Ur=Hr=null;break;case`mousedown`:Gr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Gr=!1,Kr(o,n,i);break;case`selectionchange`:if(Vr)break;case`keydown`:case`keyup`:Kr(o,n,i)}var v;if(ir)b:{switch(e){case`compositionstart`:var y=`onCompositionStart`;break b;case`compositionend`:y=`onCompositionEnd`;break b;case`compositionupdate`:y=`onCompositionUpdate`;break b}y=void 0}else dr?lr(e,n)&&(y=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(y=`onCompositionStart`);y&&(sr&&n.locale!==`ko`&&(dr||y!==`onCompositionStart`?y===`onCompositionEnd`&&dr&&(v=jn()):(On=i,kn=`value`in On?On.value:On.textContent,dr=!0)),_=_i(r,y),0<_.length&&(y=new Jn(y,e,null,n,i),o.push({event:y,listeners:_}),v?y.data=v:(v=ur(n),v!==null&&(y.data=v)))),(v=or?fr(e,n):pr(e,n))&&(r=_i(r,`onBeforeInput`),0<r.length&&(i=new Jn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:i,listeners:r}),i.data=v))}ui(o,t)})}function gi(e,t,n){return{instance:e,listener:t,currentTarget:n}}function _i(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;i.tag===5&&a!==null&&(i=a,a=at(e,n),a!=null&&r.unshift(gi(e,a,i)),a=at(e,t),a!=null&&r.push(gi(e,a,i))),e=e.return}return r}function vi(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function yi(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(c!==null&&c===r)break;s.tag===5&&l!==null&&(s=l,i?(c=at(n,a),c!=null&&o.unshift(gi(n,c,s))):i||(c=at(n,a),c!=null&&o.push(gi(n,c,s)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var bi=/\r\n?/g,xi=/\u0000|\uFFFD/g;function Si(e){return(typeof e==`string`?e:``+e).replace(bi,`
6
6
  `).replace(xi,``)}function Ci(e,t,n){if(t=Si(t),Si(e)!==t&&n)throw Error(r(425))}function wi(){}var Ti=null,Ei=null;function Di(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Oi=typeof setTimeout==`function`?setTimeout:void 0,ki=typeof clearTimeout==`function`?clearTimeout:void 0,Ai=typeof Promise==`function`?Promise:void 0,ji=typeof queueMicrotask==`function`?queueMicrotask:Ai===void 0?Oi:function(e){return Ai.resolve(null).then(e).catch(Mi)};function Mi(e){setTimeout(function(){throw e})}function Ni(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`){if(r===0){e.removeChild(i),xn(t);return}r--}else n!==`$`&&n!==`$?`&&n!==`$!`||r++}n=i}while(n);xn(t)}function Pi(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`)break;if(t===`/$`)return null}}return e}function Fi(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`){if(t===0)return e;t--}else n===`/$`&&t++}e=e.previousSibling}return null}var Ii=Math.random().toString(36).slice(2),Li=`__reactFiber$`+Ii,Ri=`__reactProps$`+Ii,zi=`__reactContainer$`+Ii,Bi=`__reactEvents$`+Ii,Vi=`__reactListeners$`+Ii,Hi=`__reactHandles$`+Ii;function Ui(e){var t=e[Li];if(t)return t;for(var n=e.parentNode;n;){if(t=n[zi]||n[Li]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Fi(e);e!==null;){if(n=e[Li])return n;e=Fi(e)}return t}e=n,n=e.parentNode}return null}function Wi(e){return e=e[Li]||e[zi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Gi(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(r(33))}function Ki(e){return e[Ri]||null}var qi=[],Ji=-1;function Yi(e){return{current:e}}function z(e){0>Ji||(e.current=qi[Ji],qi[Ji]=null,Ji--)}function B(e,t){Ji++,qi[Ji]=e.current,e.current=t}var Xi={},Zi=Yi(Xi),Qi=Yi(!1),$i=Xi;function ea(e,t){var n=e.type.contextTypes;if(!n)return Xi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ta(e){return e=e.childContextTypes,e!=null}function na(){z(Qi),z(Zi)}function ra(e,t,n){if(Zi.current!==Xi)throw Error(r(168));B(Zi,t),B(Qi,n)}function ia(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,_e(e)||`Unknown`,a));return D({},n,i)}function aa(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Xi,$i=Zi.current,B(Zi,e),B(Qi,Qi.current),!0}function oa(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ia(e,t,$i),i.__reactInternalMemoizedMergedChildContext=e,z(Qi),z(Zi),B(Zi,e)):z(Qi),B(Qi,n)}var sa=null,ca=!1,la=!1;function ua(e){sa===null?sa=[e]:sa.push(e)}function da(e){ca=!0,ua(e)}function fa(){if(!la&&sa!==null){la=!0;var e=0,t=j;try{var n=sa;for(j=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}sa=null,ca=!1}catch(t){throw sa!==null&&(sa=sa.slice(e+1)),St(Dt,fa),t}finally{j=t,la=!1}}return null}var pa=[],ma=0,ha=null,ga=0,_a=[],va=0,ya=null,ba=1,xa=``;function Sa(e,t){pa[ma++]=ga,pa[ma++]=ha,ha=e,ga=t}function Ca(e,t,n){_a[va++]=ba,_a[va++]=xa,_a[va++]=ya,ya=e;var r=ba;e=xa;var i=32-Ft(r)-1;r&=~(1<<i),n+=1;var a=32-Ft(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,ba=1<<32-Ft(t)+i|n<<i|r,xa=a+e}else ba=1<<a|n<<i|r,xa=e}function wa(e){e.return!==null&&(Sa(e,1),Ca(e,1,0))}function Ta(e){for(;e===ha;)ha=pa[--ma],pa[ma]=null,ga=pa[--ma],pa[ma]=null;for(;e===ya;)ya=_a[--va],_a[va]=null,xa=_a[--va],_a[va]=null,ba=_a[--va],_a[va]=null}var Ea=null,Da=null,V=!1,Oa=null;function ka(e,t){var n=Kl(5,null,null,0);n.elementType=`DELETED`,n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function Aa(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null&&(e.stateNode=t,Ea=e,Da=Pi(t.firstChild),!0);case 6:return t=e.pendingProps===``||t.nodeType!==3?null:t,t!==null&&(e.stateNode=t,Ea=e,Da=null,!0);case 13:return t=t.nodeType===8?t:null,t!==null&&(n=ya===null?null:{id:ba,overflow:xa},e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Kl(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Ea=e,Da=null,!0);default:return!1}}function ja(e){return!!(e.mode&1)&&!(e.flags&128)}function Ma(e){if(V){var t=Da;if(t){var n=t;if(!Aa(e,t)){if(ja(e))throw Error(r(418));t=Pi(n.nextSibling);var i=Ea;t&&Aa(e,t)?ka(i,n):(e.flags=e.flags&-4097|2,V=!1,Ea=e)}}else{if(ja(e))throw Error(r(418));e.flags=e.flags&-4097|2,V=!1,Ea=e}}}function Na(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Ea=e}function Pa(e){if(e!==Ea)return!1;if(!V)return Na(e),V=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!==`head`&&t!==`body`&&!Di(e.type,e.memoizedProps)),t&&=Da){if(ja(e))throw Fa(),Error(r(418));for(;t;)ka(e,t),t=Pi(t.nextSibling)}if(Na(e),e.tag===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(r(317));a:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`){if(t===0){Da=Pi(e.nextSibling);break a}t--}else n!==`$`&&n!==`$!`&&n!==`$?`||t++}e=e.nextSibling}Da=null}}else Da=Ea?Pi(e.stateNode.nextSibling):null;return!0}function Fa(){for(var e=Da;e;)e=Pi(e.nextSibling)}function Ia(){Da=Ea=null,V=!1}function La(e){Oa===null?Oa=[e]:Oa.push(e)}var Ra=C.ReactCurrentBatchConfig;function za(e,t,n){if(e=n.ref,e!==null&&typeof e!=`function`&&typeof e!=`object`){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(r(309));var i=n.stateNode}if(!i)throw Error(r(147,e));var a=i,o=``+e;return t!==null&&t.ref!==null&&typeof t.ref==`function`&&t.ref._stringRef===o?t.ref:(t=function(e){var t=a.refs;e===null?delete t[o]:t[o]=e},t._stringRef=o,t)}if(typeof e!=`string`)throw Error(r(284));if(!n._owner)throw Error(r(290,e))}return e}function Ba(e,t){throw e=Object.prototype.toString.call(t),Error(r(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e))}function Va(e){var t=e._init;return t(e._payload)}function Ha(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function i(e,t){for(e=new Map;t!==null;)t.key===null?e.set(t.index,t):e.set(t.key,t),t=t.sibling;return e}function a(e,t){return e=Yl(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=2,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=2),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=$l(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===ee?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===ce&&Va(i)===t.type)?(r=a(t,n.props),r.ref=za(e,t,n),r.return=e,r):(r=Xl(n.type,n.key,n.props,null,e.mode,r),r.ref=za(e,t,n),r.return=e,r)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=eu(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Zl(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`)return t=$l(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case w:return n=Xl(t.type,t.key,t.props,null,e.mode,n),n.ref=za(e,null,t),n.return=e,n;case T:return t=eu(t,e.mode,n),t.return=e,t;case ce:var r=t._init;return f(e,r(t._payload),n)}if(ke(t)||de(t))return t=Zl(t,e.mode,n,null),t.return=e,t;Ba(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case w:return n.key===i?l(e,t,n,r):null;case T:return n.key===i?u(e,t,n,r):null;case ce:return i=n._init,p(e,t,i(n._payload),r)}if(ke(n)||de(n))return i===null?d(e,t,n,r,null):null;Ba(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case w:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case T:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case ce:var a=r._init;return m(e,t,n,a(r._payload),i)}if(ke(r)||de(r))return e=e.get(n)||null,d(t,e,r,i,null);Ba(t,r)}return null}function h(r,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),V&&Sa(r,h),l;if(d===null){for(;h<s.length;h++)d=f(r,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return V&&Sa(r,h),l}for(d=i(r,d);h<s.length;h++)g=m(d,r,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(r,e)}),V&&Sa(r,h),l}function g(a,s,c,l){var u=de(c);if(typeof u!=`function`)throw Error(r(150));if(c=u.call(c),c==null)throw Error(r(151));for(var d=u=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),V&&Sa(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return V&&Sa(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),V&&Sa(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===ee&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===ee){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===ce&&Va(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=za(e,l,i),r.return=e,e=r;break a}n(e,l);break}t(e,l),l=l.sibling}i.type===ee?(r=Zl(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=Xl(i.type,i.key,i.props,null,e.mode,o),o.ref=za(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}n(e,r);break}t(e,r),r=r.sibling}r=eu(i,e.mode,o),r.return=e,e=r}return s(e);case ce:return l=i._init,_(e,r,l(i._payload),o)}if(ke(i))return h(e,r,i,o);if(de(i))return g(e,r,i,o);Ba(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=$l(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Ua=Ha(!0),Wa=Ha(!1),Ga=Yi(null),Ka=null,qa=null,Ja=null;function Ya(){Ja=qa=Ka=null}function Xa(e){var t=Ga.current;z(Ga),e._currentValue=t}function Za(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Qa(e,t){Ka=e,Ja=qa=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Rs=!0),e.firstContext=null)}function $a(e){var t=e._currentValue;if(Ja!==e){if(e={context:e,memoizedValue:t,next:null},qa===null){if(Ka===null)throw Error(r(308));qa=e,Ka.dependencies={lanes:0,firstContext:e}}else qa=qa.next=e}return t}var eo=null;function to(e){eo===null?eo=[e]:eo.push(e)}function no(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,to(t)):(n.next=i.next,i.next=n),t.interleaved=n,ro(e,r)}function ro(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var io=!1;function ao(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function oo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function so(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function co(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,J&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,ro(e,n)}return i=r.interleaved,i===null?(t.next=t,to(r)):(t.next=i.next,i.next=t),r.interleaved=t,ro(e,n)}function lo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xt(e,n)}}function uo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function fo(e,t,n,r){var i=e.updateQueue;io=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=D({},d,f);break a;case 2:io=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);Yc|=o,e.lanes=o,e.memoizedState=d}}function po(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var i=e[t],a=i.callback;if(a!==null){if(i.callback=null,i=n,typeof a!=`function`)throw Error(r(191,a));a.call(i)}}}var mo={},ho=Yi(mo),go=Yi(mo),_o=Yi(mo);function vo(e){if(e===mo)throw Error(r(174));return e}function yo(e,t){switch(B(_o,t),B(go,e),B(ho,mo),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ie(null,``);break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ie(t,e)}z(ho),B(ho,t)}function bo(){z(ho),z(go),z(_o)}function xo(e){vo(_o.current);var t=vo(ho.current),n=Ie(t,e.type);t!==n&&(B(go,e),B(ho,n))}function So(e){go.current===e&&(z(ho),z(go))}var H=Yi(0);function Co(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data===`$?`||n.data===`$!`))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var wo=[];function To(){for(var e=0;e<wo.length;e++)wo[e]._workInProgressVersionPrimary=null;wo.length=0}var Eo=C.ReactCurrentDispatcher,Do=C.ReactCurrentBatchConfig,Oo=0,U=null,W=null,G=null,ko=!1,Ao=!1,jo=0,Mo=0;function No(){throw Error(r(321))}function Po(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Nr(e[n],t[n]))return!1;return!0}function Fo(e,t,n,i,a,o){if(Oo=o,U=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Eo.current=e===null||e.memoizedState===null?vs:ys,e=n(i,a),Ao){o=0;do{if(Ao=!1,jo=0,25<=o)throw Error(r(301));o+=1,G=W=null,t.updateQueue=null,Eo.current=bs,e=n(i,a)}while(Ao)}if(Eo.current=_s,t=W!==null&&W.next!==null,Oo=0,G=W=U=null,ko=!1,t)throw Error(r(300));return e}function Io(){var e=jo!==0;return jo=0,e}function Lo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return G===null?U.memoizedState=G=e:G=G.next=e,G}function Ro(){if(W===null){var e=U.alternate;e=e===null?null:e.memoizedState}else e=W.next;var t=G===null?U.memoizedState:G.next;if(t!==null)G=t,W=e;else{if(e===null)throw Error(r(310));W=e,e={memoizedState:W.memoizedState,baseState:W.baseState,baseQueue:W.baseQueue,queue:W.queue,next:null},G===null?U.memoizedState=G=e:G=G.next=e}return G}function zo(e,t){return typeof t==`function`?t(e):t}function Bo(e){var t=Ro(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=W,a=i.baseQueue,o=n.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}i.baseQueue=a=o,n.pending=null}if(a!==null){o=a.next,i=i.baseState;var c=s=null,l=null,u=o;do{var d=u.lane;if((Oo&d)===d)l!==null&&(l=l.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),i=u.hasEagerState?u.eagerState:e(i,u.action);else{var f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};l===null?(c=l=f,s=i):l=l.next=f,U.lanes|=d,Yc|=d}u=u.next}while(u!==null&&u!==o);l===null?s=i:l.next=c,Nr(i,t.memoizedState)||(Rs=!0),t.memoizedState=i,t.baseState=s,t.baseQueue=l,n.lastRenderedState=i}if(e=n.interleaved,e!==null){a=e;do o=a.lane,U.lanes|=o,Yc|=o,a=a.next;while(a!==e)}else a===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Vo(e){var t=Ro(),n=t.queue;if(n===null)throw Error(r(311));n.lastRenderedReducer=e;var i=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Nr(o,t.memoizedState)||(Rs=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,i]}function Ho(){}function Uo(e,t){var n=U,i=Ro(),a=t(),o=!Nr(i.memoizedState,a);if(o&&(i.memoizedState=a,Rs=!0),i=i.queue,ts(Ko.bind(null,n,i,e),[e]),i.getSnapshot!==t||o||G!==null&&G.memoizedState.tag&1){if(n.flags|=2048,Xo(9,Go.bind(null,n,i,a,t),void 0,null),Y===null)throw Error(r(349));Oo&30||Wo(n,t,a)}return a}function Wo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=U.updateQueue,t===null?(t={lastEffect:null,stores:null},U.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Go(e,t,n,r){t.value=n,t.getSnapshot=r,qo(t)&&Jo(e)}function Ko(e,t,n){return n(function(){qo(t)&&Jo(e)})}function qo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Nr(e,n)}catch{return!0}}function Jo(e){var t=ro(e,1);t!==null&&hl(t,e,1,-1)}function Yo(e){var t=Lo();return typeof e==`function`&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:zo,lastRenderedState:e},t.queue=e,e=e.dispatch=ps.bind(null,U,e),[t.memoizedState,e]}function Xo(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=U.updateQueue,t===null?(t={lastEffect:null,stores:null},U.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function Zo(){return Ro().memoizedState}function Qo(e,t,n,r){var i=Lo();U.flags|=e,i.memoizedState=Xo(1|t,n,void 0,r===void 0?null:r)}function $o(e,t,n,r){var i=Ro();r=r===void 0?null:r;var a=void 0;if(W!==null){var o=W.memoizedState;if(a=o.destroy,r!==null&&Po(r,o.deps)){i.memoizedState=Xo(t,n,a,r);return}}U.flags|=e,i.memoizedState=Xo(1|t,n,a,r)}function es(e,t){return Qo(8390656,8,e,t)}function ts(e,t){return $o(2048,8,e,t)}function ns(e,t){return $o(4,2,e,t)}function rs(e,t){return $o(4,4,e,t)}function is(e,t){if(typeof t==`function`)return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function as(e,t,n){return n=n==null?null:n.concat([e]),$o(4,4,is.bind(null,t,e),n)}function os(){}function ss(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Po(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function cs(e,t){var n=Ro();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Po(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function ls(e,t,n){return Oo&21?(Nr(n,t)||(n=Kt(),U.lanes|=n,Yc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Rs=!0),e.memoizedState=n)}function us(e,t){var n=j;j=n!==0&&4>n?n:4,e(!0);var r=Do.transition;Do.transition={};try{e(!1),t()}finally{j=n,Do.transition=r}}function ds(){return Ro().memoizedState}function fs(e,t,n){var r=ml(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ms(e))hs(t,n);else if(n=no(e,t,n,r),n!==null){var i=pl();hl(n,e,r,i),gs(n,t,r)}}function ps(e,t,n){var r=ml(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ms(e))hs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Nr(s,o)){var c=t.interleaved;c===null?(i.next=i,to(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=no(e,t,i,r),n!==null&&(i=pl(),hl(n,e,r,i),gs(n,t,r))}}function ms(e){var t=e.alternate;return e===U||t!==null&&t===U}function hs(e,t){Ao=ko=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function gs(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Xt(e,n)}}var _s={readContext:$a,useCallback:No,useContext:No,useEffect:No,useImperativeHandle:No,useInsertionEffect:No,useLayoutEffect:No,useMemo:No,useReducer:No,useRef:No,useState:No,useDebugValue:No,useDeferredValue:No,useTransition:No,useMutableSource:No,useSyncExternalStore:No,useId:No,unstable_isNewReconciler:!1},vs={readContext:$a,useCallback:function(e,t){return Lo().memoizedState=[e,t===void 0?null:t],e},useContext:$a,useEffect:es,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),Qo(4194308,4,is.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qo(4194308,4,e,t)},useInsertionEffect:function(e,t){return Qo(4,2,e,t)},useMemo:function(e,t){var n=Lo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Lo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=fs.bind(null,U,e),[r.memoizedState,e]},useRef:function(e){var t=Lo();return e={current:e},t.memoizedState=e},useState:Yo,useDebugValue:os,useDeferredValue:function(e){return Lo().memoizedState=e},useTransition:function(){var e=Yo(!1),t=e[0];return e=us.bind(null,e[1]),Lo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=U,a=Lo();if(V){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Y===null)throw Error(r(349));Oo&30||Wo(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,es(Ko.bind(null,i,o,e),[e]),i.flags|=2048,Xo(9,Go.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=Lo(),t=Y.identifierPrefix;if(V){var n=xa,r=ba;n=(r&~(1<<32-Ft(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=jo++,0<n&&(t+=`H`+n.toString(32)),t+=`:`}else n=Mo++,t=`:`+t+`r`+n.toString(32)+`:`;return e.memoizedState=t},unstable_isNewReconciler:!1},ys={readContext:$a,useCallback:ss,useContext:$a,useEffect:ts,useImperativeHandle:as,useInsertionEffect:ns,useLayoutEffect:rs,useMemo:cs,useReducer:Bo,useRef:Zo,useState:function(){return Bo(zo)},useDebugValue:os,useDeferredValue:function(e){return ls(Ro(),W.memoizedState,e)},useTransition:function(){return[Bo(zo)[0],Ro().memoizedState]},useMutableSource:Ho,useSyncExternalStore:Uo,useId:ds,unstable_isNewReconciler:!1},bs={readContext:$a,useCallback:ss,useContext:$a,useEffect:ts,useImperativeHandle:as,useInsertionEffect:ns,useLayoutEffect:rs,useMemo:cs,useReducer:Vo,useRef:Zo,useState:function(){return Vo(zo)},useDebugValue:os,useDeferredValue:function(e){var t=Ro();return W===null?t.memoizedState=e:ls(t,W.memoizedState,e)},useTransition:function(){return[Vo(zo)[0],Ro().memoizedState]},useMutableSource:Ho,useSyncExternalStore:Uo,useId:ds,unstable_isNewReconciler:!1};function xs(e,t){if(e&&e.defaultProps){for(var n in t=D({},t),e=e.defaultProps,e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ss(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:D({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Cs={isMounted:function(e){return(e=e._reactInternals)?gt(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=pl(),i=ml(e),a=so(r,i);a.payload=t,n!=null&&(a.callback=n),t=co(e,a,i),t!==null&&(hl(t,e,i,r),lo(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=pl(),i=ml(e),a=so(r,i);a.tag=1,a.payload=t,n!=null&&(a.callback=n),t=co(e,a,i),t!==null&&(hl(t,e,i,r),lo(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=pl(),r=ml(e),i=so(n,r);i.tag=2,t!=null&&(i.callback=t),t=co(e,i,r),t!==null&&(hl(t,e,r,n),lo(t,e,r))}};function ws(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Pr(n,r)||!Pr(i,a):!0}function Ts(e,t,n){var r=!1,i=Xi,a=t.contextType;return typeof a==`object`&&a?a=$a(a):(i=ta(t)?$i:Zi.current,r=t.contextTypes,a=(r=r!=null)?ea(e,i):Xi),t=new t(n,a),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Cs,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function Es(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Cs.enqueueReplaceState(t,t.state,null)}function Ds(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},ao(e);var a=t.contextType;typeof a==`object`&&a?i.context=$a(a):(a=ta(t)?$i:Zi.current,i.context=ea(e,a)),i.state=e.memoizedState,a=t.getDerivedStateFromProps,typeof a==`function`&&(Ss(e,t,a,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps==`function`||typeof i.getSnapshotBeforeUpdate==`function`||typeof i.UNSAFE_componentWillMount!=`function`&&typeof i.componentWillMount!=`function`||(t=i.state,typeof i.componentWillMount==`function`&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount==`function`&&i.UNSAFE_componentWillMount(),t!==i.state&&Cs.enqueueReplaceState(i,i.state,null),fo(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount==`function`&&(e.flags|=4194308)}function Os(e,t){try{var n=``,r=t;do n+=he(r),r=r.return;while(r);var i=n}catch(e){i=`
7
7
  Error generating stack: `+e.message+`
8
- `+e.stack}return{value:e,source:t,stack:i,digest:null}}function ks(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function As(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var js=typeof WeakMap==`function`?WeakMap:Map;function Ms(e,t,n){n=so(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rl||(rl=!0,il=r),As(e,t)},n}function Ns(e,t,n){n=so(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){As(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){As(e,t),typeof r!=`function`&&(al===null?al=new Set([this]):al.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ps(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new js;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zl.bind(null,e,t,n),t.then(e,e))}function Fs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Is(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=so(-1,1),t.tag=2,co(n,t,1))),n.lanes|=1),e)}var Ls=C.ReactCurrentOwner,Rs=!1;function zs(e,t,n,r){t.child=e===null?Wa(t,null,n,r):Ua(t,e.child,n,r)}function Bs(e,t,n,r,i){n=n.render;var a=t.ref;return Qa(t,i),r=Fo(e,t,n,r,a,i),n=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(V&&n&&wa(t),t.flags|=1,zs(e,t,r,i),t.child)}function Vs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Hs(e,t,a,r,i)):(e=Xl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Pr:n,n(o,r)&&e.ref===t.ref)return oc(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Hs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Pr(a,r)&&e.ref===t.ref){if(Rs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Rs=!0);else return t.lanes=e.lanes,oc(e,t,i)}}return Gs(e,t,n,r,i)}function Us(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},B(qc,Kc),Kc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,B(qc,Kc),Kc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,B(qc,Kc),Kc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),B(qc,Kc),Kc|=r;return zs(e,t,i,n),t.child}function Ws(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gs(e,t,n,r,i){var a=ta(n)?$i:Zi.current;return a=ea(t,a),Qa(t,i),n=Fo(e,t,n,r,a,i),r=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(V&&r&&wa(t),t.flags|=1,zs(e,t,n,i),t.child)}function Ks(e,t,n,r,i){if(ta(n)){var a=!0;aa(t)}else a=!1;if(Qa(t,i),t.stateNode===null)ac(e,t),Ts(t,n,r),Ds(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=$a(l):(l=ta(n)?$i:Zi.current,l=ea(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Es(t,o,r,l),io=!1;var f=t.memoizedState;o.state=f,fo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Qi.current||io?(typeof u==`function`&&(Ss(t,n,u,r),c=t.memoizedState),(s=io||ws(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,oo(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:xs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=$a(c):(c=ta(n)?$i:Zi.current,c=ea(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Es(t,o,r,c),io=!1,f=t.memoizedState,o.state=f,fo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Qi.current||io?(typeof p==`function`&&(Ss(t,n,p,r),m=t.memoizedState),(l=io||ws(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return qs(e,t,n,r,a,i)}function qs(e,t,n,r,i,a){Ws(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&oa(t,n,!1),oc(e,t,a);r=t.stateNode,Ls.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ua(t,e.child,null,a),t.child=Ua(t,null,s,a)):zs(e,t,s,a),t.memoizedState=r.state,i&&oa(t,n,!0),t.child}function Js(e){var t=e.stateNode;t.pendingContext?ra(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ra(e,t.context,!1),yo(e,t.containerInfo)}function Ys(e,t,n,r,i){return Ia(),La(i),t.flags|=256,zs(e,t,n,r),t.child}var Xs={dehydrated:null,treeContext:null,retryLane:0};function Zs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Qs(e,t,n){var r=t.pendingProps,i=H.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),B(H,i&1),e===null)return Ma(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Ql(o,r,0,null),e=Zl(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Zs(n),t.memoizedState=Xs,e):$s(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return tc(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Yl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Zl(a,o,n,null),a.flags|=2):a=Yl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Zs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Xs,r}return a=e.child,e=a.sibling,r=Yl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function $s(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function ec(e,t,n,r){return r!==null&&La(r),Ua(t,e.child,null,n),e=$s(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function tc(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ks(Error(r(422))),ec(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=Ql({mode:`visible`,children:i.children},a,0,null),o=Zl(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ua(t,e.child,null,s),t.child.memoizedState=Zs(s),t.memoizedState=Xs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return ec(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=ks(o,i,void 0),ec(e,t,s,i)}if(c=(s&e.childLanes)!==0,Rs||c){if(i=Y,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,ro(e,a),hl(i,e,a,-1))}return kl(),i=ks(Error(r(421))),ec(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Vl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Da=Pi(a.nextSibling),Ea=t,V=!0,Oa=null,e!==null&&(_a[va++]=ba,_a[va++]=xa,_a[va++]=ya,ba=e.id,xa=e.overflow,ya=t),t=$s(t,i.children),t.flags|=4096,t)}function nc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Za(e.return,t,n)}function rc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function ic(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(zs(e,t,r.children,n),r=H.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nc(e,n,t);else if(e.tag===19)nc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(B(H,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Co(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),rc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Co(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}rc(t,!0,n,null,a);break;case`together`:rc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ac(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function oc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Yc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function sc(e,t,n){switch(t.tag){case 3:Js(t),Ia();break;case 5:xo(t);break;case 1:ta(t.type)&&aa(t);break;case 4:yo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;B(Ga,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(B(H,H.current&1),e=oc(e,t,n),e===null?null:e.sibling):Qs(e,t,n):(B(H,H.current&1),t.flags|=128,null);B(H,H.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ic(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),B(H,H.current),r)break;return null;case 22:case 23:return t.lanes=0,Us(e,t,n)}return oc(e,t,n)}var cc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},lc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,vo(ho.current);var o=null;switch(n){case`input`:i=Ce(e,i),r=Ce(e,r),o=[];break;case`select`:i=D({},i,{value:void 0}),r=D({},r,{value:void 0}),o=[];break;case`textarea`:i=je(e,i),r=je(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=wi)}Ge(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&R(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},uc=function(e,t,n,r){n!==r&&(t.flags|=4)};function dc(e,t){if(!V)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function fc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function pc(e,t,n){var i=t.pendingProps;switch(Ta(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fc(t),null;case 1:return ta(t.type)&&na(),fc(t),null;case 3:return i=t.stateNode,bo(),z(Qi),z(Zi),To(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Pa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Oa!==null&&(yl(Oa),Oa=null))),fc(t),null;case 5:So(t);var o=vo(_o.current);if(n=t.type,e!==null&&t.stateNode!=null)lc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return fc(t),null}if(e=vo(ho.current),Pa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Li]=t,i[Ri]=s,e=!!(t.mode&1),n){case`dialog`:R(`cancel`,i),R(`close`,i);break;case`iframe`:case`object`:case`embed`:R(`load`,i);break;case`video`:case`audio`:for(o=0;o<si.length;o++)R(si[o],i);break;case`source`:R(`error`,i);break;case`img`:case`image`:case`link`:R(`error`,i),R(`load`,i);break;case`details`:R(`toggle`,i);break;case`input`:we(i,s),R(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},R(`invalid`,i);break;case`textarea`:Me(i,s),R(`invalid`,i)}for(var c in Ge(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&Ci(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&Ci(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&R(`scroll`,i)}switch(n){case`input`:be(i),De(i,s,!0);break;case`textarea`:be(i),Pe(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=wi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=Fe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Li]=t,e[Ri]=i,cc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ke(n,i),n){case`dialog`:R(`cancel`,e),R(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:R(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<si.length;o++)R(si[o],e);o=i;break;case`source`:R(`error`,e),o=i;break;case`img`:case`image`:case`link`:R(`error`,e),R(`load`,e),o=i;break;case`details`:R(`toggle`,e),o=i;break;case`input`:we(e,i),o=Ce(e,i),R(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=D({},i,{value:void 0}),R(`invalid`,e);break;case`textarea`:Me(e,i),o=je(e,i),R(`invalid`,e);break;default:o=i}for(s in Ge(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ue(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Re(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&ze(e,u):typeof u==`number`&&ze(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&R(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:be(e),De(e,i,!1);break;case`textarea`:be(e),Pe(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+k(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Ae(e,!!i.multiple,i.defaultValue,!0):Ae(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=wi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return fc(t),null;case 6:if(e&&t.stateNode!=null)uc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=vo(_o.current),vo(ho.current),Pa(t)){if(i=t.stateNode,n=t.memoizedProps,i[Li]=t,(s=i.nodeValue!==n)&&(e=Ea,e!==null))switch(e.tag){case 3:Ci(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ci(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Li]=t,t.stateNode=i}return fc(t),null;case 13:if(z(H),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(V&&Da!==null&&t.mode&1&&!(t.flags&128))Fa(),Ia(),t.flags|=98560,s=!1;else if(s=Pa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Li]=t}else Ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;fc(t),s=!1}else Oa!==null&&(yl(Oa),Oa=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||H.current&1?Q===0&&(Q=3):kl())),t.updateQueue!==null&&(t.flags|=4),fc(t),null);case 4:return bo(),e===null&&pi(t.stateNode.containerInfo),fc(t),null;case 10:return Xa(t.type._context),fc(t),null;case 17:return ta(t.type)&&na(),fc(t),null;case 19:if(z(H),s=t.memoizedState,s===null)return fc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)dc(s,!1);else{if(Q!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=Co(e),c!==null){for(t.flags|=128,dc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return B(H,H.current&1|2),t.child}e=e.sibling}s.tail!==null&&A()>tl&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=Co(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!V)return fc(t),null}else 2*A()-s.renderingStartTime>tl&&n!==1073741824&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(fc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=A(),t.sibling=null,n=H.current,B(H,i?n&1|2:n&1),t);case 22:case 23:return Tl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Kc&1073741824&&(fc(t),t.subtreeFlags&6&&(t.flags|=8192)):fc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function mc(e,t){switch(Ta(t),t.tag){case 1:return ta(t.type)&&na(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bo(),z(Qi),z(Zi),To(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return So(t),null;case 13:if(z(H),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(H),null;case 4:return bo(),null;case 10:return Xa(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var hc=!1,gc=!1,_c=typeof WeakSet==`function`?WeakSet:Set,K=null;function vc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function yc(e,t,n){try{n()}catch(n){$(e,t,n)}}var bc=!1;function xc(e,t){if(Ti=Sn,e=Rr(),zr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ei={focusedElem:e,selectionRange:n},Sn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:xs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=bc,bc=!1,h}function Sc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&yc(t,n,a)}i=i.next}while(i!==r)}}function Cc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Tc(e){var t=e.alternate;t!==null&&(e.alternate=null,Tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Li],delete t[Ri],delete t[Bi],delete t[Vi],delete t[Hi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Dc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=wi));else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}function kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}var q=null,Ac=!1;function jc(e,t,n){for(n=n.child;n!==null;)Mc(e,t,n),n=n.sibling}function Mc(e,t,n){if(Nt&&typeof Nt.onCommitFiberUnmount==`function`)try{Nt.onCommitFiberUnmount(Mt,n)}catch{}switch(n.tag){case 5:gc||vc(n,t);case 6:var r=q,i=Ac;q=null,jc(e,t,n),q=r,Ac=i,q!==null&&(Ac?(e=q,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):q.removeChild(n.stateNode));break;case 18:q!==null&&(Ac?(e=q,n=n.stateNode,e.nodeType===8?Ni(e.parentNode,n):e.nodeType===1&&Ni(e,n),xn(e)):Ni(q,n.stateNode));break;case 4:r=q,i=Ac,q=n.stateNode.containerInfo,Ac=!0,jc(e,t,n),q=r,Ac=i;break;case 0:case 11:case 14:case 15:if(!gc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&yc(n,t,o),i=i.next}while(i!==r)}jc(e,t,n);break;case 1:if(!gc&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}jc(e,t,n);break;case 21:jc(e,t,n);break;case 22:n.mode&1?(gc=(r=gc)||n.memoizedState!==null,jc(e,t,n),gc=r):jc(e,t,n);break;default:jc(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _c),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Pc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:q=c.stateNode,Ac=!1;break a;case 3:q=c.stateNode.containerInfo,Ac=!0;break a;case 4:q=c.stateNode.containerInfo,Ac=!0;break a}c=c.return}if(q===null)throw Error(r(160));Mc(o,s,a),q=null,Ac=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){$(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fc(t,e),t=t.sibling}function Fc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pc(t,e),Ic(e),i&4){try{Sc(3,e,e.return),Cc(3,e)}catch(t){$(e,e.return,t)}try{Sc(5,e,e.return)}catch(t){$(e,e.return,t)}}break;case 1:Pc(t,e),Ic(e),i&512&&n!==null&&vc(n,n.return);break;case 5:if(Pc(t,e),Ic(e),i&512&&n!==null&&vc(n,n.return),e.flags&32){var a=e.stateNode;try{ze(a,``)}catch(t){$(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&Te(a,o),Ke(c,s);var u=Ke(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ue(a,f):d===`dangerouslySetInnerHTML`?Re(a,f):d===`children`?ze(a,f):S(a,d,f,u)}switch(c){case`input`:Ee(a,o);break;case`textarea`:Ne(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Ae(a,!!o.multiple,o.multiple?[]:``,!1):Ae(a,!!o.multiple,o.defaultValue,!0)):Ae(a,!!o.multiple,m,!1)}a[Ri]=o}catch(t){$(e,e.return,t)}}break;case 6:if(Pc(t,e),Ic(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){$(e,e.return,t)}}break;case 3:if(Pc(t,e),Ic(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{xn(t.containerInfo)}catch(t){$(e,e.return,t)}break;case 4:Pc(t,e),Ic(e);break;case 13:Pc(t,e),Ic(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(el=A())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(gc=(u=gc)||d,Pc(t,e),gc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(K=e,d=e.child;d!==null;){for(f=K=d;K!==null;){switch(p=K,m=p.child,p.tag){case 0:case 11:case 14:case 15:Sc(4,p,p.return);break;case 1:vc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){$(i,n,e)}}break;case 5:vc(p,p.return);break;case 22:if(p.memoizedState!==null){Bc(f);continue}}m===null?Bc(f):(m.return=p,K=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=He(`display`,s))}catch(t){$(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){$(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Pc(t,e),Ic(e),i&4&&Nc(e);break;case 21:break;default:Pc(t,e),Ic(e)}}function Ic(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Ec(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(ze(a,``),i.flags&=-33),kc(e,Dc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Oc(e,Dc(e),o);break;default:throw Error(r(161))}}catch(t){$(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lc(e,t,n){K=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=!!(e.mode&1);K!==null;){var i=K,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||hc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||gc;s=hc;var l=gc;if(hc=o,(gc=c)&&!l)for(K=i;K!==null;)o=K,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,K=c);for(;a!==null;)K=a,Rc(a,t,n),a=a.sibling;K=i,hc=s,gc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,K=a):zc(e,t,n)}}function zc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:gc||Cc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!gc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:xs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&po(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}po(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&xn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}gc||t.flags&512&&wc(t)}catch(e){$(t,t.return,e)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function Bc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Vc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Cc(4,t)}catch(e){$(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){$(t,i,e)}}var a=t.return;try{wc(t)}catch(e){$(t,a,e)}break;case 5:var o=t.return;try{wc(t)}catch(e){$(t,o,e)}}}catch(e){$(t,t.return,e)}if(t===e){K=null;break}var s=t.sibling;if(s!==null){s.return=t.return,K=s;break}K=t.return}}var Hc=Math.ceil,Uc=C.ReactCurrentDispatcher,Wc=C.ReactCurrentOwner,Gc=C.ReactCurrentBatchConfig,J=0,Y=null,X=null,Z=0,Kc=0,qc=Yi(0),Q=0,Jc=null,Yc=0,Xc=0,Zc=0,Qc=null,$c=null,el=0,tl=1/0,nl=null,rl=!1,il=null,al=null,ol=!1,sl=null,cl=0,ll=0,ul=null,dl=-1,fl=0;function pl(){return J&6?A():dl===-1?dl=A():dl}function ml(e){return e.mode&1?J&2&&Z!==0?Z&-Z:Ra.transition===null?(e=j,e===0?(e=window.event,e=e===void 0?16:Dn(e.type),e):e):(fl===0&&(fl=Kt()),fl):1}function hl(e,t,n,i){if(50<ll)throw ll=0,ul=null,Error(r(185));Jt(e,n,i),(!(J&2)||e!==Y)&&(e===Y&&(!(J&2)&&(Xc|=n),Q===4&&xl(e,Z)),gl(e,i),n===1&&J===0&&!(t.mode&1)&&(tl=A()+500,ca&&fa()))}function gl(e,t){var n=e.callbackNode;Wt(e,t);var r=Ht(e,e===Y?Z:0);if(r===0)n!==null&&Ct(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ct(n),t===1)e.tag===0?da(Sl.bind(null,e)):ua(Sl.bind(null,e)),ji(function(){!(J&6)&&fa()}),n=null;else{switch(Zt(r)){case 1:n=Dt;break;case 4:n=Ot;break;case 16:n=kt;break;case 536870912:n=jt;break;default:n=kt}n=Wl(n,_l.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _l(e,t){if(dl=-1,fl=0,J&6)throw Error(r(327));var n=e.callbackNode;if(Ll()&&e.callbackNode!==n)return null;var i=Ht(e,e===Y?Z:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Al(e,i);else{t=i;var a=J;J|=2;var o=Ol();(Y!==e||Z!==t)&&(nl=null,tl=A()+500,El(e,t));do try{Ml();break}catch(t){Dl(e,t)}while(1);Ya(),Uc.current=o,J=a,X===null?(Y=null,Z=0,t=Q):t=0}if(t!==0){if(t===2&&(a=Gt(e),a!==0&&(i=a,t=vl(e,a))),t===1)throw n=Jc,El(e,0),xl(e,i),gl(e,A()),n;if(t===6)xl(e,i);else{if(a=e.current.alternate,!(i&30)&&!bl(a)&&(t=Al(e,i),t===2&&(o=Gt(e),o!==0&&(i=o,t=vl(e,o))),t===1))throw n=Jc,El(e,0),xl(e,i),gl(e,A()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Fl(e,$c,nl);break;case 3:if(xl(e,i),(i&130023424)===i&&(t=el+500-A(),10<t)){if(Ht(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){pl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Oi(Fl.bind(null,e,$c,nl),t);break}Fl(e,$c,nl);break;case 4:if(xl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Ft(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=A()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Hc(i/1960))-i,10<i){e.timeoutHandle=Oi(Fl.bind(null,e,$c,nl),i);break}Fl(e,$c,nl);break;case 5:Fl(e,$c,nl);break;default:throw Error(r(329))}}}return gl(e,A()),e.callbackNode===n?_l.bind(null,e):null}function vl(e,t){var n=Qc;return e.current.memoizedState.isDehydrated&&(El(e,t).flags|=256),e=Al(e,t),e!==2&&(t=$c,$c=n,t!==null&&yl(t)),e}function yl(e){$c===null?$c=e:$c.push.apply($c,e)}function bl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Nr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xl(e,t){for(t&=~Zc,t&=~Xc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ft(t),r=1<<n;e[n]=-1,t&=~r}}function Sl(e){if(J&6)throw Error(r(327));Ll();var t=Ht(e,0);if(!(t&1))return gl(e,A()),null;var n=Al(e,t);if(e.tag!==0&&n===2){var i=Gt(e);i!==0&&(t=i,n=vl(e,i))}if(n===1)throw n=Jc,El(e,0),xl(e,t),gl(e,A()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fl(e,$c,nl),gl(e,A()),null}function Cl(e,t){var n=J;J|=1;try{return e(t)}finally{J=n,J===0&&(tl=A()+500,ca&&fa())}}function wl(e){sl!==null&&sl.tag===0&&!(J&6)&&Ll();var t=J;J|=1;var n=Gc.transition,r=j;try{if(Gc.transition=null,j=1,e)return e()}finally{j=r,Gc.transition=n,J=t,!(J&6)&&fa()}}function Tl(){Kc=qc.current,z(qc)}function El(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ki(n)),X!==null)for(n=X.return;n!==null;){var r=n;switch(Ta(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&na();break;case 3:bo(),z(Qi),z(Zi),To();break;case 5:So(r);break;case 4:bo();break;case 13:z(H);break;case 19:z(H);break;case 10:Xa(r.type._context);break;case 22:case 23:Tl()}n=n.return}if(Y=e,X=e=Yl(e.current,null),Z=Kc=t,Q=0,Jc=null,Zc=Xc=Yc=0,$c=Qc=null,eo!==null){for(t=0;t<eo.length;t++)if(n=eo[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}eo=null}return e}function Dl(e,t){do{var n=X;try{if(Ya(),Eo.current=_s,ko){for(var i=U.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}ko=!1}if(Oo=0,G=W=U=null,Ao=!1,jo=0,Wc.current=null,n===null||n.return===null){Q=1,Jc=t,X=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Z,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Fs(s);if(m!==null){m.flags&=-257,Is(m,s,c,o,t),m.mode&1&&Ps(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Ps(o,u,t),kl();break a}l=Error(r(426))}else if(V&&c.mode&1){var _=Fs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Is(_,s,c,o,t),La(Os(l,c));break a}}o=l=Os(l,c),Q!==4&&(Q=2),Qc===null?Qc=[o]:Qc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ms(o,l,t);uo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(al===null||!al.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ns(o,c,t);uo(o,x);break a}}o=o.return}while(o!==null)}Pl(n)}catch(e){t=e,X===n&&n!==null&&(X=n=n.return);continue}break}while(1)}function Ol(){var e=Uc.current;return Uc.current=_s,e===null?_s:e}function kl(){(Q===0||Q===3||Q===2)&&(Q=4),Y===null||!(Yc&268435455)&&!(Xc&268435455)||xl(Y,Z)}function Al(e,t){var n=J;J|=2;var i=Ol();(Y!==e||Z!==t)&&(nl=null,El(e,t));do try{jl();break}catch(t){Dl(e,t)}while(1);if(Ya(),J=n,Uc.current=i,X!==null)throw Error(r(261));return Y=null,Z=0,Q}function jl(){for(;X!==null;)Nl(X)}function Ml(){for(;X!==null&&!wt();)Nl(X)}function Nl(e){var t=Ul(e.alternate,e,Kc);e.memoizedProps=e.pendingProps,t===null?Pl(e):X=t,Wc.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=mc(n,t),n!==null){n.flags&=32767,X=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Q=6,X=null;return}}else if(n=pc(n,t,Kc),n!==null){X=n;return}if(t=t.sibling,t!==null){X=t;return}X=t=e}while(t!==null);Q===0&&(Q=5)}function Fl(e,t,n){var r=j,i=Gc.transition;try{Gc.transition=null,j=1,Il(e,t,n,r)}finally{Gc.transition=i,j=r}return null}function Il(e,t,n,i){do Ll();while(sl!==null);if(J&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Yt(e,o),e===Y&&(X=Y=null,Z=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,Wl(kt,function(){return Ll(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=j;j=1;var c=J;J|=4,Wc.current=null,xc(e,n),Fc(n,e),Br(Ei),Sn=!!Ti,Ei=Ti=null,e.current=n,Lc(n,e,a),Tt(),J=c,j=s,Gc.transition=o}else e.current=n;if(ol&&(ol=!1,sl=e,cl=a),o=e.pendingLanes,o===0&&(al=null),Pt(n.stateNode,i),gl(e,A()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(rl)throw rl=!1,e=il,il=null,e;return cl&1&&e.tag!==0&&Ll(),o=e.pendingLanes,o&1?e===ul?ll++:(ll=0,ul=e):ll=0,fa(),null}function Ll(){if(sl!==null){var e=Zt(cl),t=Gc.transition,n=j;try{if(Gc.transition=null,j=16>e?16:e,sl===null)var i=!1;else{if(e=sl,sl=null,cl=0,J&6)throw Error(r(331));var a=J;for(J|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(K=u;K!==null;){var d=K;switch(d.tag){case 0:case 11:case 15:Sc(8,d,o)}var f=d.child;if(f!==null)f.return=d,K=f;else for(;K!==null;){d=K;var p=d.sibling,m=d.return;if(Tc(d),d===u){K=null;break}if(p!==null){p.return=m,K=p;break}K=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}K=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,K=s;else b:for(;K!==null;){if(o=K,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Sc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,K=v;break b}K=o.return}}var y=e.current;for(K=y;K!==null;){s=K;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,K=b;else b:for(s=y;K!==null;){if(c=K,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Cc(9,c)}}catch(e){$(c,c.return,e)}if(c===s){K=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,K=x;break b}K=c.return}}if(J=a,fa(),Nt&&typeof Nt.onPostCommitFiberRoot==`function`)try{Nt.onPostCommitFiberRoot(Mt,e)}catch{}i=!0}return i}finally{j=n,Gc.transition=t}}return!1}function Rl(e,t,n){t=Os(n,t),t=Ms(e,t,1),e=co(e,t,1),t=pl(),e!==null&&(Jt(e,1,t),gl(e,t))}function $(e,t,n){if(e.tag===3)Rl(e,e,n);else for(;t!==null;){if(t.tag===3){Rl(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(al===null||!al.has(r))){e=Os(n,e),e=Ns(t,e,1),t=co(t,e,1),e=pl(),t!==null&&(Jt(t,1,e),gl(t,e));break}}t=t.return}}function zl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=pl(),e.pingedLanes|=e.suspendedLanes&n,Y===e&&(Z&n)===n&&(Q===4||Q===3&&(Z&130023424)===Z&&500>A()-el?El(e,0):Zc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Bt,Bt<<=1,!(Bt&130023424)&&(Bt=4194304)):t=1);var n=pl();e=ro(e,t),e!==null&&(Jt(e,t,n),gl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Qi.current)Rs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Rs=!1,sc(e,t,n);Rs=!!(e.flags&131072)}}else Rs=!1,V&&t.flags&1048576&&Ca(t,ga,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ac(e,t),e=t.pendingProps;var a=ea(t,Zi.current);Qa(t,n),a=Fo(null,t,i,e,a,n);var o=Io();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ta(i)?(o=!0,aa(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ao(t),a.updater=Cs,t.stateNode=a,a._reactInternals=t,Ds(t,i,e,n),t=qs(null,t,i,!0,o,n)):(t.tag=0,V&&o&&wa(t),zs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ac(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=xs(i,e),a){case 0:t=Gs(null,t,i,e,n);break a;case 1:t=Ks(null,t,i,e,n);break a;case 11:t=Bs(null,t,i,e,n);break a;case 14:t=Vs(null,t,i,xs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Gs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Ks(e,t,i,a,n);case 3:a:{if(Js(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,oo(e,t),fo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Os(Error(r(423)),t),t=Ys(e,t,i,n,a);break a}if(i!==a){a=Os(Error(r(424)),t),t=Ys(e,t,i,n,a);break a}for(Da=Pi(t.stateNode.containerInfo.firstChild),Ea=t,V=!0,Oa=null,n=Wa(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ia(),i===a){t=oc(e,t,n);break a}zs(e,t,i,n)}t=t.child}return t;case 5:return xo(t),e===null&&Ma(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Di(i,a)?s=null:o!==null&&Di(i,o)&&(t.flags|=32),Ws(e,t),zs(e,t,s,n),t.child;case 6:return e===null&&Ma(t),null;case 13:return Qs(e,t,n);case 4:return yo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ua(t,null,i,n):zs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Bs(e,t,i,a,n);case 7:return zs(e,t,t.pendingProps,n),t.child;case 8:return zs(e,t,t.pendingProps.children,n),t.child;case 12:return zs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,B(Ga,i._currentValue),i._currentValue=s,o!==null){if(Nr(o.value,s)){if(o.children===a.children&&!Qi.current){t=oc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=so(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Za(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Za(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}zs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Qa(t,n),a=$a(a),i=i(a),t.flags|=1,zs(e,t,i,n),t.child;case 14:return i=t.type,a=xs(i,t.pendingProps),a=xs(i.type,a),Vs(e,t,i,a,n);case 15:return Hs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),ac(e,t),t.tag=1,ta(i)?(e=!0,aa(t)):e=!1,Qa(t,n),Ts(t,i,a),Ds(t,i,a,n),qs(null,t,i,!0,e,n);case 19:return ic(e,t,n);case 22:return Us(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return St(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ae)return 11;if(e===E)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ee:return Zl(n.children,a,o,t);case te:s=8,a|=8;break;case ne:return e=Kl(12,n,t,a|2),e.elementType=ne,e.lanes=o,e;case oe:return e=Kl(13,n,t,a),e.elementType=oe,e.lanes=o,e;case se:return e=Kl(19,n,t,a),e.elementType=se,e.lanes=o,e;case le:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case re:s=10;break a;case ie:s=9;break a;case ae:s=11;break a;case E:s=14;break a;case ce:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=le,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qt(0),this.expirationTimes=qt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ao(a),e}function ru(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function iu(e){if(!e)return Xi;e=e._reactInternals;a:{if(gt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(ta(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(ta(n))return ia(e,n,t)}return t}function au(e,t,n,r,i,a,o,s,c){return e=nu(n,r,!0,e,i,a,o,s,c),e.context=iu(null),n=e.current,r=pl(),i=ml(n),a=so(r,i),a.callback=t??null,co(n,a,i),e.current.lanes=i,Jt(e,i,r),gl(e,r),e}function ou(e,t,n,r){var i=t.current,a=pl(),o=ml(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=so(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=co(i,t,o),e!==null&&(hl(e,i,o,a),lo(e,i,o)),o}function su(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lu(e,t){cu(e,t),(e=e.alternate)&&cu(e,t)}function uu(){return null}var du=typeof reportError==`function`?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}pu.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));ou(e,t,null,null)},pu.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wl(function(){ou(null,e,null,null)}),t[zi]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=tn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<dn.length&&t!==0&&t<dn[n].priority;n++);dn.splice(n,0,e),n===0&&gn(e)}};function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function gu(){}function _u(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=su(o);a.call(e)}}var o=au(t,r,e,0,null,!1,!1,``,gu);return e._reactRootContainer=o,e[zi]=o.current,pi(e.nodeType===8?e.parentNode:e),wl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=su(c);s.call(e)}}var c=nu(e,0,!1,null,null,!1,!1,``,gu);return e._reactRootContainer=c,e[zi]=c.current,pi(e.nodeType===8?e.parentNode:e),wl(function(){ou(t,c,n,r)}),c}function vu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=su(o);s.call(e)}}ou(t,o,e,i)}else o=_u(n,t,e,i,r);return su(o)}Qt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Vt(t.pendingLanes);n!==0&&(Xt(t,n|1),gl(t,A()),!(J&6)&&(tl=A()+500,fa()))}break;case 13:wl(function(){var t=ro(e,1);t!==null&&hl(t,e,1,pl())}),lu(e,1)}},$t=function(e){if(e.tag===13){var t=ro(e,134217728);t!==null&&hl(t,e,134217728,pl()),lu(e,134217728)}},en=function(e){if(e.tag===13){var t=ml(e),n=ro(e,t);n!==null&&hl(n,e,t,pl()),lu(e,t)}},tn=function(){return j},nn=function(e,t){var n=j;try{return j=e,t()}finally{j=n}},Ye=function(e,t,n){switch(t){case`input`:if(Ee(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ki(i);if(!a)throw Error(r(90));xe(i),Ee(i,a)}}}break;case`textarea`:Ne(e,n);break;case`select`:t=n.value,t!=null&&Ae(e,!!n.multiple,t,!1)}},tt=Cl,nt=wl;var yu={usingClientEntryPoint:!1,Events:[Wi,Gi,Ki,$e,et,Cl]},bu={findFiberByHostInstance:Ui,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},xu={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=bt(e),e===null?null:e.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||uu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{Mt=Su.inject(xu),Nt=Su}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(t))throw Error(r(200));return ru(e,t,null,n)},e.createRoot=function(e,t){if(!mu(e))throw Error(r(299));var n=!1,i=``,a=du;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=nu(e,1,!1,null,null,n,!1,i,a),e[zi]=t.current,pi(e.nodeType===8?e.parentNode:e),new fu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=bt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return wl(e)},e.hydrate=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!mu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=du;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=au(t,null,e,1,n??null,a,!1,o,s),e[zi]=t.current,pi(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new pu(t)},e.render=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!hu(e))throw Error(r(40));return e._reactRootContainer?(wl(function(){vu(null,null,e,!1,function(){e._reactRootContainer=null,e[zi]=null})}),!0):!1},e.unstable_batchedUpdates=Cl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!hu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return vu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),m=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))(),g=c(u(),1);function _(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var{useRef:v}=g.default;function y(e){let t=v();return n=>{let r=e(n);return _(t.current,r)?t.current:t.current=r}}var b=8;function x(e,t){let[n,r]=(0,g.useState)(()=>{try{let e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}}),i=(0,g.useRef)(!1),a=(0,g.useCallback)(t=>{let n=e.current,r=n?.offsetWidth??0,i=n?.offsetHeight??0;return{right:Math.min(Math.max(b,t.right),Math.max(b,window.innerWidth-r-b)),bottom:Math.min(Math.max(b,t.bottom),Math.max(b,window.innerHeight-i-b))}},[e]);return(0,g.useEffect)(()=>{let e=()=>r(e=>e&&a(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[a]),{anchor:n,start:(0,g.useCallback)(n=>{if(n.button!==0)return;let o=e.current;if(!o)return;let s=o.getBoundingClientRect(),c={x:n.clientX,y:n.clientY,right:window.innerWidth-s.right,bottom:window.innerHeight-s.bottom};i.current=!1;let l=e=>{let t=e.clientX-c.x,n=e.clientY-c.y;!i.current&&Math.hypot(t,n)<5||(i.current=!0,r(a({right:c.right-t,bottom:c.bottom-n})))},u=null,d=e=>{l(e),i.current&&(u=a({right:c.right-(e.clientX-c.x),bottom:c.bottom-(e.clientY-c.y)}))},f=()=>{if(window.removeEventListener(`pointermove`,d),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,f),i.current&&u)try{localStorage.setItem(t,JSON.stringify(u))}catch{}};window.addEventListener(`pointermove`,d),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,f)},[e,a,t]),onClickCapture:(0,g.useCallback)(e=>{i.current&&=(e.stopPropagation(),e.preventDefault(),!1)},[])}}var S=o((e=>{var t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&apos;`};function n(e){return t[e]}var r={"&amp;":`&`,"&lt;":`<`,"&gt;":`>`,"&quot;":`"`,"&apos;":`'`};function i(e){if(e[1]===`#`){let t=e[2]===`x`?parseInt(e.slice(3),16):parseInt(e.slice(2),10);if(t===9||t===10||t===13||t>=32&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111)return String.fromCodePoint(t);throw Error(`Illegal XML character 0x`+t.toString(16))}if(r[e])return r[e]||e;throw Error(`Illegal XML entity `+e)}function a(e){return e.replace(/["&'<>]/g,n)}function o(e){let t=``,n=-1,r=-1,a=0;for(;(n=e.indexOf(`&`,a))!==-1&&(r=e.indexOf(`;`,n+1))!==-1;)t=t+e.slice(a,n)+i(e.slice(n,r+1)),a=r+1;return a===0?e:(t+=e.substring(a),t)}function s(e){return e.replace(/[&<>]/g,n)}function c(e){return e.replace(/&(amp|#38|lt|#60|gt|#62);/g,i)}e.escapeXML=a,e.escapeXMLText=s,e.unescapeXML=o,e.unescapeXMLText=c})),C=o(((e,t)=>{var n=S(),r=class e{constructor(e,t){this.name=e,this.parent=null,this.children=[],this.attrs={},this.setAttrs(t)}is(e,t){return this.getName()===e&&(!t||this.getNS()===t)}getName(){let e=this.name.indexOf(`:`);return e>=0?this.name.slice(e+1):this.name}getNS(){let e=this.name.indexOf(`:`);if(e>=0){let t=this.name.slice(0,e);return this.findNS(t)}return this.findNS()}findNS(e){if(e){let t=`xmlns:`+e;if(this.attrs[t])return this.attrs[t];if(this.parent)return this.parent.findNS(e)}else{if(this.attrs.xmlns)return this.attrs.xmlns;if(this.parent)return this.parent.findNS()}}getXmlns(){let e={};this.parent&&(e=this.parent.getXmlns());for(let t in this.attrs){let n=t.match(`xmlns:?(.*)`);this.attrs.hasOwnProperty(t)&&n&&(e[this.attrs[t]]=n[1])}return e}setAttrs(e){typeof e==`string`?this.attrs.xmlns=e:e&&Object.assign(this.attrs,e)}getAttr(e,t){if(!t)return this.attrs[e];let n=this.getXmlns();return n[t]?this.attrs[[n[t],e].join(`:`)]:null}getChild(e,t){return this.getChildren(e,t)[0]}getChildren(e,t){let n=[];for(let r of this.children)r.getName&&r.getName()===e&&(!t||r.getNS()===t)&&n.push(r);return n}getChildByAttr(e,t,n,r){return this.getChildrenByAttr(e,t,n,r)[0]}getChildrenByAttr(e,t,n,r){let i=[];for(let a of this.children)a.attrs&&a.attrs[e]===t&&(!n||a.getNS()===n)&&i.push(a),r&&a.getChildrenByAttr&&i.push(a.getChildrenByAttr(e,t,n,!0));return r&&(i=i.flat()),i}getChildrenByFilter(e,t){let n=[];for(let r of this.children)e(r)&&n.push(r),t&&r.getChildrenByFilter&&n.push(r.getChildrenByFilter(e,!0));return t&&(n=n.flat()),n}getText(){let e=``;for(let t of this.children)(typeof t==`string`||typeof t==`number`)&&(e+=t);return e}getChildText(e,t){let n=this.getChild(e,t);return n?n.getText():null}getChildElements(){return this.getChildrenByFilter(t=>t instanceof e)}root(){return this.parent?this.parent.root():this}up(){return this.parent?this.parent:this}c(t,n){return this.cnode(new e(t,n))}cnode(e){return this.children.push(e),typeof e==`object`&&(e.parent=this),e}append(...e){for(let t of e)this.children.push(t),typeof t==`object`&&(t.parent=this)}prepend(...e){for(let t of e)this.children.unshift(t),typeof t==`object`&&(t.parent=this)}t(e){return this.children.push(e),this}remove(e,t){let n=typeof e==`string`?n=>!(n.is&&n.is(e,t)):t=>t!==e;return this.children=this.children.filter(n),this}text(e){return e&&this.children.length===1?(this.children[0]=e,this):this.getText()}attr(e,t){return t!==void 0||t===null?(this.attrs||={},this.attrs[e]=t,this):this.attrs[e]}toString(){let e=``;return this.write(t=>{e+=t}),e}_addChildren(e){e(`>`);for(let t of this.children)t!=null&&(t.write?t.write(e):typeof t==`string`?e(n.escapeXMLText(t)):t.toString&&e(n.escapeXMLText(t.toString(10))));e(`</`),e(this.name),e(`>`)}write(e){e(`<`),e(this.name);for(let t in this.attrs){let r=this.attrs[t];r!=null&&(e(` `),e(t),e(`="`),e(n.escapeXML(typeof r==`string`?r:r.toString(10))),e(`"`))}this.children.length===0?e(`/>`):this._addChildren(e)}};r.prototype.tree=r.prototype.root,t.exports=r})),w=o(((e,t)=>{var n=C();function r(e,t){if(Array.isArray(t)){for(let n of t)r(e,n);return}t!==``&&t!=null&&t!==!0&&t!==!1&&e.cnode(t)}function i(e,t,...i){if(typeof t==`object`&&t){delete t.__source,delete t.__self;for(let[e,n]of Object.entries(t))n==null?delete t[e]:t[e]=n.toString(10)}let a=new n(e,t);for(let e of i)r(a,e);return a}t.exports=i})),T=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),ee=o(((e,t)=>{var n=T(),r=S(),i=0,a=1,o=2,s=3,c=4,l=5,u=6,d=7,f=8,p=9,m=10;t.exports=class extends n.EventEmitter{constructor(){super();let e=i,t,n,h,g,_,v,y,b,x=0,S;this._handleTagOpening=function(e,t,n){e?this.emit(`endElement`,t,!1):(this.emit(`startElement`,t,n),v&&this.emit(`endElement`,t,!0))},this.write=function(C){typeof C!=`string`&&(C=C.toString());let w=0;t&&=(C=t+C,w+=n?0:t.length,n=!1,null);function T(){if(typeof x==`number`){let e=C.slice(x,w);return x=void 0,e}}for(;w<C.length;w++){switch(e){case i:{let e=C.indexOf(`<`,w);e!==-1&&w!==e&&(w=e);break}case f:{let e=C.indexOf(b,w);e!==-1&&(w=e);break}case a:{let e=C.indexOf(`-->`,w);e!==-1&&(w=e+2);break}case m:{let e=C.indexOf(`]]>`,w);e!==-1&&(w=e+2);break}}let t=C.charCodeAt(w);switch(e){case i:if(t===60){let t=T();t&&this.emit(`text`,r.unescapeXML(t)),e=s,x=w+1,g={}}break;case p:if(t===93){if(C.substr(w+1,2)===`]>`){let t=T();t&&this.emit(`text`,t),e=i}else C.length<w+2&&(n=!0,w=C.length)}break;case s:t===47&&x===w?(x=w+1,_=!0):t===33?C.substr(w+1,7)===`[CDATA[`?(x=w+8,e=p):C.length<w+8&&`[CDATA[`.startsWith(C.slice(w+1))?(n=!0,w=C.length):(x=void 0,e=a):t===63?(x=void 0,e=o):(t<=32||t===47||t===62)&&(h=T(),w--,e=c);break;case a:if(t===62){let t=C.charCodeAt(w-1),n=C.charCodeAt(w-2);(t===45&&n===45||t===93&&n===93)&&(e=i)}break;case o:t===62&&C.charCodeAt(w-1)===63&&(e=i);break;case c:t===62?(this._handleTagOpening(_,h,g),h=void 0,g=void 0,_=void 0,v=void 0,e=i,x=w+1):t===47?v=!0:t>32&&(x=w,e=l);break;case l:(t<=32||t===61)&&(S=T(),w--,e=u);break;case u:t===61&&(e=d);break;case d:(t===34||t===39)&&(y=t,b=t===34?`"`:`'`,e=f,x=w+1);break;case f:if(t===y){let t=r.unescapeXML(T());g[S]=t,S=void 0,e=c}}}typeof x==`number`&&x<=C.length&&(t=C.slice(x),x=0)}}end(e){e&&this.write(e),this.write=function(){}}}})),te=S(),ne=c(C(),1),re=c(w(),1),ie=T(),ae=c(ee(),1),oe=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}};function se(e){let t,n=new Promise(n=>{t=setTimeout(n,e)});return n.timeout=t,n}function E(e,t){let n=se(t);function r(){clearTimeout(n.timeout)}let i=new oe;return Promise.race([e.finally(r),n.then(()=>{throw i})])}var ce=new WeakMap;function le(e){let t=ce.get(e);return t||(t={on:(e.addEventListener??e.addListener).bind(e),off:(e.removeEventListener??e.removeListener).bind(e),once:(e.once??((t,n)=>e.addEventListener(t,n,{once:!0}))).bind(e)},ce.set(e,t)),t}function ue(e,t,n=`error`,r){return new Promise((i,a)=>{let o,{off:s,once:c}=le(e),l=()=>{clearTimeout(o),s(t,d),s(n,u)};function u(e){a(e),l()}function d(e){i(e),l()}if(c(t,d),n&&c(n,u),r){let e=new oe;o=setTimeout(()=>{l(),a(e)},r)}})}function de(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}function D(e,t=null,n){return new Promise((r,i)=>{function a(t){e.removeListener(`nonza`,s),i(t)}function o(...t){e.removeListener(`nonza`,s),r(...t)}async function s(e){try{await n(e,o)}catch(e){a(e)}}t&&e.send(t).catch(a),e.on(`nonza`,s)})}function fe(e){return{subscribe(t){let{on:n}=le(t);for(let[t,r]of Object.entries(e))n(t,r)},unsubscribe(t){let{off:n}=le(t);for(let[t,r]of Object.entries(e))n(t,r)}}}var pe=class extends Error{constructor(...e){super(...e),this.name=`XMLError`}},me=class extends ie.EventEmitter{constructor(){super();let e=new ae.default;this.root=null,this.cursor=null,e.on(`startElement`,this.onStartElement.bind(this)),e.on(`endElement`,this.onEndElement.bind(this)),e.on(`text`,this.onText.bind(this)),this.parser=e}onStartElement(e,t){let n=new ne.default(e,t),{root:r,cursor:i}=this;r?i!==r&&i.append(n):(this.root=n,this.emit(`start`,n)),this.cursor=n}onEndElement(e){let{root:t,cursor:n}=this;if(e!==n.name){this.emit(`error`,new pe(`${n.name} must be closed.`));return}if(n===t){this.emit(`end`,t);return}if(!n.parent){n.parent=t,this.emit(`element`,n),this.cursor=t;return}this.cursor=n.parent}onText(e){let{cursor:t}=this;if(!t){this.emit(`error`,new pe(`${e} must be a child.`));return}t.t(e)}write(e){this.parser.write(e)}end(e){e&&this.parser.write(e)}};me.XMLError=pe;function O(...e){return(0,re.default)(...e)}Object.assign(O,{Element:ne.default,createElement:re.default,Parser:me,escapeXML:te.escapeXML,unescapeXML:te.unescapeXML,escapeXMLText:te.escapeXMLText,unescapeXMLText:te.unescapeXMLText,XMLError:pe,xml:O});function he(e){return!(!e||e.replaceAll(String.raw`\20`,``).replaceAll(String.raw`\22`,``).replaceAll(String.raw`\26`,``).replaceAll(String.raw`\27`,``).replaceAll(String.raw`\2f`,``).replaceAll(String.raw`\3a`,``).replaceAll(String.raw`\3c`,``).replaceAll(String.raw`\3e`,``).replaceAll(String.raw`\40`,``).replaceAll(String.raw`\5c`,``).search(/[ "&'/:<>@\\]/g)===-1)}function ge(e){return e===null?null:e.replaceAll(/^\s+|\s+$/g,``).replaceAll(`\\`,String.raw`\5c`).replaceAll(` `,String.raw`\20`).replaceAll(`"`,String.raw`\22`).replaceAll(`&`,String.raw`\26`).replaceAll(`'`,String.raw`\27`).replaceAll(`/`,String.raw`\2f`).replaceAll(`:`,String.raw`\3a`).replaceAll(`<`,String.raw`\3c`).replaceAll(`>`,String.raw`\3e`).replaceAll(`@`,String.raw`\40`)}function _e(e){return e===null?null:e.replaceAll(String.raw`\20`,` `).replaceAll(String.raw`\22`,`"`).replaceAll(String.raw`\26`,`&`).replaceAll(String.raw`\27`,`'`).replaceAll(String.raw`\2f`,`/`).replaceAll(String.raw`\3a`,`:`).replaceAll(String.raw`\3c`,`<`).replaceAll(String.raw`\3e`,`>`).replaceAll(String.raw`\40`,`@`).replaceAll(String.raw`\5c`,`\\`)}var k=class e{constructor(e,t,n){if(typeof t!=`string`||!t)throw TypeError(`Invalid domain.`);this.setDomain(t),this.setLocal(typeof e==`string`?e:``),this.setResource(typeof n==`string`?n:``)}[Symbol.toPrimitive](e){return e===`number`?NaN:this.toString()}toString(e){let t=this._domain;return this._local&&(t=this.getLocal(e)+`@`+t),this._resource&&(t=t+`/`+this._resource),t}bare(){return this._resource?new e(this._local,this._domain,null):this}equals(e){return this._local===e._local&&this._domain===e._domain&&this._resource===e._resource}setLocal(e,t){return t||=he(e),t&&(e=ge(e)),this._local=e&&e.toLowerCase(),this}getLocal(e=!1){let t=null;return t=e?_e(this._local):this._local,t}setDomain(e){return this._domain=e.toLowerCase(),this}getDomain(){return this._domain}setResource(e){return this._resource=e,this}getResource(){return this._resource}};Object.defineProperty(k.prototype,"local",{get:k.prototype.getLocal,set:k.prototype.setLocal}),Object.defineProperty(k.prototype,"domain",{get:k.prototype.getDomain,set:k.prototype.setDomain}),Object.defineProperty(k.prototype,"resource",{get:k.prototype.getResource,set:k.prototype.setResource});function ve(e){let t,n,r=e.indexOf(`/`);r!==-1&&(n=e.slice(r+1),e=e.slice(0,r));let i=e.indexOf(`@`);return i!==-1&&(t=e.slice(0,i),e=e.slice(i+1)),new k(t,e,n)}function ye(e,t){return e.equals(t)}function be(...e){return!e[1]&&!e[2]?ve(...e):new k(...e)}var xe=be.bind();xe.jid=be,xe.JID=k,xe.parse=ve,xe.equal=ye,xe.detectEscape=he,xe.escapeLocal=ge,xe.unescapeLocal=_e;var Se=class extends Error{constructor(e,t,n){super(e+(t?` - ${t}`:``)),this.name=`XMPPError`,this.condition=e,this.text=t,this.application=n}static fromElement(e){let[t,n,r]=e.getChildElements(),i,a;n&&(n.is(`text`)?i=n:n&&(a=n),r&&(a=r));let o=new this(t.name,i?i.text():``,a);return o.element=e,o}},Ce=class extends Se{constructor(...e){super(...e),this.name=`StreamError`}};function we(e){let{port:t,hostname:n,protocol:r}=new URL(e);return n===`[::1]`&&(n=`::1`),{port:t,hostname:n,protocol:r}}function Te(e){let{port:t,hostname:n}=we(`http://${e}`);return{port:t,hostname:n}}function Ee(e){return e.includes(`://`)?we(e):Te(e)}var De=`urn:ietf:params:xml:ns:xmpp-streams`,Oe=`http://etherx.jabber.org/streams`,ke=class extends ie.EventEmitter{#e=null;#t=null;constructor(e={}){super(),typeof e==`string`&&(e={domain:e}),this.jid=null,this.timeout=e.timeout||2e3,this.options=e,this.status=`offline`,this.socket=null,this.parser=null,this.root=null}isSecure(){return this.socket?.secure===!0}async _streamError(e,t){try{await this.send(O(`stream:error`,{},[O(e,{xmlns:De},t)]))}catch{}return this.disconnect()}_onData(e){let t=e.toString(`utf8`);this.parser.write(t)}#n(e){this._streamError(`bad-format`),this._detachParser(),this.emit(`error`,e)}#r(e,t){this._detachSocket(),this._status(`disconnect`,{clean:!e,reason:t})}#i(e,t){this._detachParser(),this._status(`close`,{clean:!e,reason:t})}_attachSocket(e){this.socket=e,this.#e??=fe({data:this._onData.bind(this),close:this.#r.bind(this),connect:()=>this._status(`connect`),error:e=>this.emit(`error`,e)}),this.#e.subscribe(this.socket)}_detachSocket(){this.socket&&this.#e?.unsubscribe(this.socket),this.socket=null}_onElement(e){let t=e.is(`error`,Oe);t&&this._onStreamError(e),this.emit(`element`,e),this.emit(this.isStanza(e)?`stanza`:`nonza`,e),t&&this.disconnect()}_onStreamError(e){let t=Ce.fromElement(e);if(t.condition===`see-other-host`)return this._onSeeOtherHost(t);this.emit(`error`,t)}async _onSeeOtherHost(e){let{protocol:t}=Ee(this.options.service),n=e.element.getChildText(`see-other-host`),{port:r}=Te(n),i;i=r?`${t||`xmpp:`}//${n}`:(t?`${t}//`:``)+n;try{await ue(this,`disconnect`);let{domain:e,lang:t}=this.options;await this.connect(i),await this.open({domain:e,lang:t})}catch(e){this.emit(`error`,e)}}_attachParser(e){this.parser=e,this.#t??=fe({element:this._onElement.bind(this),error:this.#n.bind(this),end:this.#i.bind(this),start:e=>this._status(`open`,e)}),this.#t.subscribe(this.parser)}_detachParser(){this.parser&&this.#t?.unsubscribe(this.parser),this.parser=null,this.root=null}_jid(e){return this.jid=xe(e),this.jid}_status(e,...t){this.status!==e&&(this.status=e,this.emit(`status`,e,...t),this.emit(e,...t))}_ready(e=!1){e?this.status=`online`:this._status(`online`,this.jid)}async disconnect(){let e;try{e=await this._closeStream()}catch(e){this.#i(e)}try{await this._closeSocket()}catch(e){this.#r(!0,e)}return e}async start(){if(this.status!==`offline`)throw Error(`Connection is not offline`);let{service:e,domain:t,lang:n}=this.options;await this.connect(e);let r=ue(this,`online`);return await this.open({domain:t,lang:n}),r}async connect(e){this._status(`connecting`,e);let t=new this.Socket;return this._attachSocket(t),t.connect(this.socketParameters(e)),ue(t,`connect`)}async _closeSocket(e=this.timeout){this._status(`disconnecting`),this.socket.end(),await ue(this.socket,`close`,`error`,e)}async open(e){this._status(`opening`);let{domain:t,lang:n}=e,r=this.headerElement();return r.attrs.to=t,r.attrs[`xml:lang`]=n,this.root=r,this._attachParser(new this.Parser),await this.write(this.header(r)),ue(this,`open`,`error`,this.timeout)}async stop(){let e=await this.disconnect();return this._status(`offline`,e),e}async _closeStream(e=this.timeout){await this.#c(`close`);let t=this.footer(this.footerElement());return await this.write(t),this._status(`closing`),ue(this.parser,`end`,`error`,e)}async restart(){this._detachParser();let{domain:e,lang:t}=this.options;return this.open({domain:e,lang:t})}async send(e){e.parent=this.root,await this.write(e.toString()),this.emit(`send`,e)}sendReceive(e,t=this.timeout){return Promise.all([this.send(e),ue(this,`element`,`error`,t)]).then(([,e])=>e)}async write(e){if(this.status===`closing`)throw Error(`Connection is closing`);return new Promise((t,n)=>{this.socket.write(e,e=>e?n(e):t())})}isStanza(e){let{name:t}=e;return t===`iq`||t===`message`||t===`presence`}isNonza(e){return!this.isStanza(e)}header(e){return e.toString()}headerElement(){return new O.Element(``,{version:`1.0`,xmlns:this.NS})}footer(e){return e.toString()}footerElement(){}socketParameters(){}#a=new Map;#o=new Set([`close`]);hook(e,t){this.#s(e),this.#a.has(e)||this.#a.set(e,new Set),this.#a.get(e).add([t])}#s(e){if(!this.#o.has(e))throw Error(`Hook event name "${e}" is unknown.`)}unhook(e,t){this.#s(e);let n=this.#a.get(`event`),r=[...n].find(e=>e.handler===t);n.remove(r)}async#c(e,...t){this.#s(e);let n=this.#a.get(e);n&&await Promise.all([...n].map(async([e])=>{try{await e(...t)}catch(e){this.emit(`error`,e)}}))}};ke.prototype.NS=``,ke.prototype.Socket=null,ke.prototype.Parser=null;var Ae=class extends ke{constructor(e){super(e),this.transports=[]}send(e,...t){return this.Transport.prototype.send.call(this,e,...t)}sendMany(...e){return this.Transport.prototype.sendMany.call(this,...e)}_findTransport(e){return this.transports.find(t=>{try{return t.prototype.socketParameters(e)!==void 0}catch{return!1}})}connect(e){let t=this._findTransport(e);if(!t)throw Error(`No compatible connection method found.`);return this.Transport=t,this.Socket=t.prototype.Socket,this.Parser=t.prototype.Parser,super.connect(e)}socketParameters(...e){return this.Transport.prototype.socketParameters(...e)}header(e,...t){let n=this.isSecure()&&this.jid?.bare().toString();return n&&(e.attrs.from=n),this.Transport.prototype.header(e,...t)}headerElement(...e){return this.Transport.prototype.headerElement(...e)}footer(...e){return this.Transport.prototype.footer(...e)}footerElement(...e){return this.Transport.prototype.footerElement(...e)}};Ae.prototype.NS=`jabber:client`;var je=class extends ie.EventEmitter{constructor(e){super(),this.delay=1e3,this.entity=e,this._timeout=null}#e=()=>{this.scheduleReconnect()};scheduleReconnect(){let{entity:e,delay:t,_timeout:n}=this;clearTimeout(n),this._timeout=setTimeout(async()=>{if(e.status===`disconnect`)try{await this.reconnect()}catch{}},t)}async reconnect(){let{entity:e}=this;this.emit(`reconnecting`);let{service:t,domain:n,lang:r}=e.options;await e.connect(t),await e.open({domain:n,lang:r}),this.emit(`reconnected`)}start(){let{entity:e}=this;e.on(`disconnect`,this.#e)}stop(){let{entity:e,_timeout:t}=this;e.removeListener(`disconnect`,this.#e),clearTimeout(t)}};function Me({entity:e}){let t=new je(e);return t.start(),t}var Ne=`ECONNERROR`;function Pe(e){let t=we(e);return!!(t.protocol===`wss:`||[`localhost`,`127.0.0.1`,`::1`].includes(t.hostname))}var Fe=class extends ie.EventEmitter{#e=null;socket=null;url=null;secure=!1;connect(e){this.url=e,this.secure=Pe(e),this._attachSocket(new WebSocket(e,[`xmpp`]))}_attachSocket(e){this.socket=e,this.#e??=fe({open:()=>this.emit(`connect`),message:({data:e})=>this.emit(`data`,e),error:e=>{let{url:t}=this,{error:n}=e;n||(n=Error(e.message||`WebSocket ${Ne} ${t}`),n.errno=Ne,n.code=Ne),n.event=e,n.url=t,this.emit(`error`,n)},close:e=>{this._detachSocket(),this.emit(`close`,!e.wasClean,e)}}),this.#e.subscribe(this.socket)}_detachSocket(){this.url=null,this.secure=!1,this.socket&&this.#e?.unsubscribe(this.socket),this.socket=null}end(){this.socket.close()}write(e,t){function n(e){t&&Promise.resolve().then(()=>t(e))}try{this.socket.send(e)}catch(e){n(e);return}n()}},Ie=class extends me{onStartElement(e,t){let n=new ne.default(e,t),{cursor:r}=this;r&&r.append(n),this.cursor=n}onEndElement(e){let{cursor:t}=this;if(e!==t.name){this.emit(`error`,new pe(`${t.name} must be closed.`));return}if(t.parent){this.cursor=t.parent;return}t.is(`open`,`urn:ietf:params:xml:ns:xmpp-framing`)?this.emit(`start`,t):t.is(`close`,`urn:ietf:params:xml:ns:xmpp-framing`)?this.emit(`end`,t):this.emit(`element`,t),this.cursor=null}},Le=`urn:ietf:params:xml:ns:xmpp-framing`,Re=class extends ke{send(e,...t){return e.attrs.xmlns??=this.NS,super.send(e,...t)}async sendMany(e){for(let t of e)t.attrs.xmlns??=this.NS,t.parent=this.root,this.socket.write(t.toString()),this.emit(`send`,t)}footerElement(){return new O.Element(`close`,{xmlns:Le})}headerElement(){let e=super.headerElement();return e.name=`open`,e.attrs.xmlns=Le,e}socketParameters(e){return/^wss?:\/\//.test(e)?e:void 0}};Re.prototype.Socket=Fe,Re.prototype.NS=`jabber:client`,Re.prototype.Parser=Ie;function ze({entity:e}){e.transports.push(Re)}var Be=o(((e,t)=>{t.exports={}})),Ve=o(((e,t)=>{t.exports=n;function n(e){if(!Array.isArray(e))throw TypeError(`Middleware stack must be an array!`);for(let t of e)if(typeof t!=`function`)throw TypeError(`Middleware must be composed of functions!`);return function(t,n){let r=-1;return i(0);function i(a){if(a<=r)return Promise.reject(Error(`next() called multiple times`));r=a;let o=e[a];if(a===e.length&&(o=n),!o)return Promise.resolve();try{return Promise.resolve(o(t,i.bind(null,a+1)))}catch(e){return Promise.reject(e)}}}}})),He=c(Be(),1),Ue=c(Ve(),1),We=class{constructor(e,t){this.stanza=t,this.entity=e;let{name:n,attrs:r}=t,{type:i,id:a}=r;this.name=n,this.id=a||``,this.type=n===`message`?i||`normal`:n===`presence`?i||`available`:i||``,this.from=null,this.to=null,this.local=``,this.domain=``,this.resource=``}},Ge=class extends We{constructor(e,t){super(e,t);let{jid:n}=e,{domain:r}=e.options??{},i=t.attrs.to||n?.toString(),a=t.attrs.from||r;i&&(this.to=new xe(i)),a&&(this.from=new xe(a),this.local=this.from.local,this.domain=this.from.domain,this.resource=this.from.resource)}},Ke=class extends We{constructor(e,t){super(e,t);let{jid:n}=e,{domain:r}=e.options??{},i=t.attrs.from||n?.toString(),a=t.attrs.to||r;i&&(this.from=new xe(i)),a&&(this.to=new xe(a),this.local=this.to.local,this.domain=this.to.domain,this.resource=this.to.resource)}};function qe(e,t,n){return r=>{let i=new n(e,r);return(0,Ue.default)(t)(i)}}function Je(e){return(t,n)=>{n().then(t=>t&&e.send(t)).catch(t=>e.emit(`error`,t))}}function Ye({entity:e}){let t=[Je(e)],n=[],r=qe(e,t,Ge),i=qe(e,n,Ke);return e.on(`element`,r),e.on(`send`,i),{use(e){return t.push(e),e},filter(e){return n.push(e),e}}}function Xe({middleware:e}){function t(t,n,r){return e.use((e,i)=>{let{stanza:a}=e;if(!a.is(`features`,`http://etherx.jabber.org/streams`))return i();let o=a.getChild(t,n);return o?r(e,i,o):i()})}return{use:t}}function Ze(){let e;for(;!e;)e=Math.random().toString(36).slice(2,12);return e}var Qe=class extends Se{constructor(e,t,n,r){super(e,t,n),this.type=r,this.name=`StanzaError`}static fromElement(e){let t=super.fromElement(e);return t.type=e.attrs.type,t}};function $e({name:e,type:t}){return!(e!==`iq`||t!==`error`&&t!==`result`)}var et=class{constructor({entity:e,middleware:t}){this.handlers=new Map,this.entity=e,this.middleware=t}start(){this.middleware.use(this._route.bind(this))}_route({type:e,name:t,id:n,stanza:r},i){if(!$e({name:t,type:e}))return i();let a=this.handlers.get(n);if(!a)return i();e===`error`?a.reject(Qe.fromElement(r.getChild(`error`))):a.resolve(r),this.handlers.delete(n)}async request(e,t=3e4){e.attrs.id||(e.attrs.id=Ze());let n=new de;this.handlers.set(e.attrs.id,n);try{await this.entity.send(e),await E(n.promise,t)}catch(t){throw this.handlers.delete(e.attrs.id),t}return n.promise}_childRequest(e,t,n,...r){let{name:i,attrs:{xmlns:a}}=t;return this.request(O(`iq`,{type:e,to:n},t),...r).then(e=>e.getChild(i,a))}async get(...e){return this._childRequest(`get`,...e)}async set(...e){return this._childRequest(`set`,...e)}};function tt(...e){let t=new et(...e);return t.start(),t}var nt=`urn:ietf:params:xml:ns:xmpp-stanzas`;function rt({name:e,type:t}){return e===`iq`&&t!==`error`&&t!==`result`}function it({type:e},t,n){return!(e!==`get`&&e!==`set`||t.length!==1||!n)}function at({stanza:e}){return O(`iq`,{to:e.attrs.from,from:e.attrs.to,id:e.attrs.id})}function ot(e,t){let n=at(e);return n.attrs.type=`result`,t&&n.append(t),n}function st(e,t,n){let r=at(e);return r.attrs.type=`error`,n&&r.append(n),r.append(t),r}function ct(e,t){return O(`error`,{type:e},O(t,nt))}function lt(e){return async function(t,n){if(!rt(t))return n();let{stanza:r}=t,i=r.getChildElements(),[a]=i;if(!it(t,i,a))return st(t,ct(`modify`,`bad-request`),a);t.element=a;let o;try{o=await n()}catch(t){e.emit(`error`,t),o=ct(`cancel`,`internal-server-error`)}return o||=ct(`cancel`,`service-unavailable`),o instanceof O.Element&&o.is(`error`)?st(t,o,a):ot(t,o instanceof O.Element?o:void 0)}}function ut(e,t,n,r){return(i,a)=>i.type!==e|!i.element||!i.element.is(n,t)?a():r(i,a)}function dt({middleware:e,entity:t}){return e.use(lt(t)),{get(t,n,r){e.use(ut(`get`,t,n,r))},set(t,n,r){e.use(ut(`set`,t,n,r))}}}var ft=[`ENOTFOUND`,`ENODATA`];function pt(e,t={}){return t.all=!0,new Promise((n,r)=>{He.default.lookup(e,t,(e,t)=>{if(e)return r(e);let i=[];for(let{family:e,address:n}of t){let t=`://${e===4?n:`[`+n+`]`}:`;i.push({family:e,address:n,uri:`xmpps`+t+`5223`},{family:e,address:n,uri:`xmpp`+t+`5222`})}n(i)})})}function mt(e,{service:t,protocol:n}){return new Promise((r,i)=>{He.default.resolveSrv(`_${t}._${n}.${e}`,(e,a)=>{e&&ft.includes(e.code)?r([]):e?i(e):r(a.map(e=>Object.assign(e,{service:t,protocol:n})))})})}function ht(e){return e.toSorted((e,t)=>{let n=e.priority-t.priority;if(n!==0)return n;let r=t.weight-e.weight;return r===0?0:r})}function gt(e,t){let n=[];return Promise.all(e.map(async e=>{let r=await pt(e.name,t);for(let t of r){let{port:r,service:i}=e,a=t.address;n.push({...t,...e,uri:`${i.split(`-`)[0]}://${t.family===6?`[`+a+`]`:a}:${r}`})}})).then(()=>n)}function _t(e,t={}){t.srv||=[{service:`xmpps-client`,protocol:`tcp`},{service:`xmpp-client`,protocol:`tcp`},{service:`xmpps-server`,protocol:`tcp`},{service:`xmpp-server`,protocol:`tcp`},{service:`stun`,protocol:`tcp`},{service:`stun`,protocol:`udp`},{service:`stuns `,protcol:`tcp`},{service:`turn`,protocol:`tcp`},{service:`turn`,protocol:`udp`},{service:`turns`,protcol:`tcp`}];let n={options:t};return pt(e,t).then(r=>Promise.all(t.srv.map(r=>mt(e,{...r,family:n}).then(e=>gt(e,t)))).then(e=>[...ht(e.flat()),...r]))}function vt(e){let t=new me,n=null,r=null;if(t.on(`start`,e=>{n=e}),t.on(`element`,e=>{n.append(e)}),t.on(`error`,e=>{r=e}),t.write(e),t.end(),r)throw r;return n}function yt(e){return e.startsWith(`https`)||e.startsWith(`wss`)}function bt(e,t){let n;if(n=yt(e.uri)&&!yt(t.uri)?-1:!yt(e.uri)&&yt(t.uri)?1:0,n!==0)return n;let r;return r=e.method===t.method?0:e.method===`websocket`?-1:t.method===`websocket`?1:e.method===`xbosh`?-1:t.method===`xbosh`?1:e.method===`httppoll`?-1:+(t.method===`httppoll`),r===0?0:r}function xt(e){return fetch(`https://${e}/.well-known/host-meta`).then(e=>e.text()).then(e=>vt(e).getChildren(`Link`).filter(e=>[`urn:xmpp:alt-connections:websocket`,`urn:xmpp:alt-connections:httppoll`,`urn:xmpp:alt-connections:xbosh`].includes(e.attrs.rel)).map(({attrs:e})=>({rel:e.rel,href:e.href,method:e.rel.split(`:`).pop(),uri:e.href})).toSorted(bt)).catch(()=>[])}function St(...e){return Promise.all([_t?_t(...e):Promise.resolve([]),xt(...e)]).then(([e,t])=>[...e,...t])}async function Ct(e){let t=await St(e,{srv:[{service:`xmpps-client`,protocol:`tcp`},{service:`xmpp-client`,protocol:`tcp`}]});return[...new Set(t.map(e=>e.uri))]}function wt(e,t){return t.filter(t=>e._findTransport(t))}async function Tt(e,t){if(t.length===0)throw Error(`Couldn't connect`);let n=t.shift(),r=e._findTransport(n);if(!r)return Tt(e,t);e._status(`connecting`,n);let i=r.prototype.socketParameters(n),a=new r.prototype.Socket;try{a.connect(i),await ue(a,`connect`)}catch{return Tt(e,t)}e._attachSocket(a),a.emit(`connect`),e.Transport=r,e.Socket=r.prototype.Socket,e.Parser=r.prototype.Parser}function A({entity:e}){let t=e.connect;e.connect=async function(n){if(!n||/:\/\//.test(n))return t.call(this,n);let r=wt(e,await Ct(n));if(r.length===0)throw Error(`No compatible transport found.`);try{await Tt(e,r)}catch(t){throw await e.disconnect(),e._status(`disconnect`),t}}}function Et(e){return globalThis.btoa(e)}function Dt(e){return globalThis.atob(e)}var Ot=class extends Se{constructor(...e){super(...e),this.name=`SASLError`}},kt=`urn:ietf:params:xml:ns:xmpp-sasl`;function At(e,t,n){let r=new Set(e.getChildren(`mechanism`,t).map(e=>e.text()));return n._mechs.map(({name:e})=>e).filter(e=>r.has(e))}async function jt({saslFactory:e,entity:t,mechanism:n,credentials:r}){let i=e.create([n]);if(!i)throw Error(`SASL: Mechanism ${n} not found.`);let{domain:a}=t.options,o={username:null,password:null,server:a,host:a,realm:a,serviceType:`xmpp`,serviceName:a,...r};await D(t,i.clientFirst&&O(`auth`,{xmlns:kt,mechanism:i.name},Et(await i.response(o))),async(e,n)=>{if(e.getNS()===kt){if(e.name===`challenge`){await i.challenge(Dt(e.text()));let n=await i.response(o);await t.send(O(`response`,{xmlns:kt,mechanism:i.name},typeof n==`string`?Et(n):``));return}if(e.name===`failure`)throw Ot.fromElement(e);if(e.name===`success`)return n()}})}function Mt({streamFeatures:e,saslFactory:t},n){e.use(`mechanisms`,kt,async({entity:e},r,i)=>{let a=At(i,kt,t);if(a.length===0)throw new Ot(`SASL: No compatible mechanism available.`);async function o(n,r){await jt({saslFactory:t,entity:e,mechanism:r,credentials:n})}await n(o,a,null,e),await e.restart()})}var Nt=`urn:xmpp:sasl:2`;async function Pt({saslFactory:e,entity:t,mechanism:n,credentials:r,userAgent:i,streamFeatures:a,features:o}){let s=e.create([n]);if(!s)throw Error(`SASL: Mechanism ${n} not found.`);let{domain:c}=t.options,l={username:null,password:null,server:c,host:c,realm:c,serviceType:`xmpp`,serviceName:c,...r};await D(t,O(`authenticate`,{xmlns:Nt,mechanism:s.name},[s.clientFirst&&O(`initial-response`,{},Et(await s.response(l))),i,...a]),async(e,n)=>{if(e.getNS()===Nt){if(e.name===`challenge`){await s.challenge(Dt(e.text()));let n=await s.response(l);await t.send(O(`response`,{xmlns:Nt,mechanism:s.name},typeof n==`string`?Et(n):``));return}if(e.name===`failure`)throw Ot.fromElement(e);if(e.name===`continue`)throw Error(`SASL continue is not supported yet`);if(e.name===`success`){let r=e.getChild(`additional-data`)?.text();r&&s.final&&await s.final(Dt(r));let i=e.getChildText(`authorization-identifier`);i&&t._jid(i);for(let t of e.getChildElements())o.get(t.getNS())?.[1]?.(t);return n()}}})}function Ft({streamFeatures:e,saslFactory:t},n){let r=new Map,i;return e.use(`authentication`,Nt,async({entity:e},a,o)=>{let s=At(o,Nt,t),c=await It({element:o,features:r}),l=!!i?.mechanism;if(s.length===0&&!l)throw new Ot(`SASL: No compatible mechanism available.`);await n(u,s,l?i:null,e);async function u(n,a,o){await i.auth({authenticate:Pt,entity:e,userAgent:o,streamFeatures:c,features:r,credentials:n})||await Pt({entity:e,userAgent:o,streamFeatures:c,features:r,saslFactory:t,mechanism:a,credentials:n})}}),{use(e,t,n){r.set(e,[t,n])},setup({fast:e}){i=e}}}async function It({element:e,features:t}){let n=[],r=e.getChild(`inline`);if(!r)return n;for(let e of r.getChildElements()){let r=e.getNS(),i=t.get(r);i&&n.push(i[0](e))}return Promise.all(n)}var Lt=`urn:ietf:params:xml:ns:xmpp-bind`;function Rt(e){return O(`bind`,{xmlns:Lt},e&&O(`resource`,{},e))}async function zt(e,t,n){let r=(await t.set(Rt(n))).getChildText(`jid`);return e._jid(r),e._ready(!1),r}function Bt({iqCaller:e},t){return async({entity:n},r)=>{t=typeof t==`function`?await t():t,await zt(n,e,t),r()}}function Vt({streamFeatures:e,iqCaller:t},n){e.use(`bind`,Lt,Bt({iqCaller:t},n))}function Ht(e=new Date){return typeof e==`string`&&(e=new Date(e)),new Date(e).toISOString().split(`.`)[0]+`Z`}function Ut({bind2:e,sm:t,failed:n,enabled:r}){e.use(Jt,e=>Yt({sm:t}),async e=>{e.is(`enabled`)?r(e.attrs):e.is(`failed`)&&n()})}function Wt({sasl2:e,sm:t,failed:n,resumed:r}){e.use(Jt,e=>{if(e.is(`sm`)&&t.id)return Xt({sm:t})},e=>{e.is(`resumed`)?r(e):e.is(`failed`)&&n()})}function Gt({streamFeatures:e,sm:t,entity:n,resumed:r,failed:i,enabled:a}){e.use(`sm`,Jt,async(e,o)=>{if(t.id)try{await r(await qt(n,t));return}catch{i()}await o();let s=Kt(n,t);if(t.outbound_q.length>0)throw Error(`Stream Management assertion failure, queue should be empty after enable`);t.outbound=0;try{a((await s).attrs)}catch{t.enabled=!1,t.enableSent=!1}})}function Kt(e,t){return D(e,Yt({sm:t}),(e,t)=>{if(e.is(`enabled`,`urn:xmpp:sm:3`))return t(e);if(e.is(`failed`,`urn:xmpp:sm:3`))throw Se.fromElement(e)})}async function qt(e,t){return D(e,Xt({sm:t}),(e,t)=>{if(e.is(`resumed`,`urn:xmpp:sm:3`))return t(e);if(e.is(`failed`,`urn:xmpp:sm:3`))throw Se.fromElement(e)})}var Jt=`urn:xmpp:sm:3`;function Yt({sm:e}){return O(`enable`,{xmlns:Jt,max:e.preferredMaximum,resume:`true`})}function Xt({sm:e}){return O(`resume`,{xmlns:Jt,h:e.inbound,previd:e.id})}function j({streamFeatures:e,entity:t,middleware:n,bind2:r,sasl2:i}){let a=null,o=null,s=null,c=new ie.EventEmitter;Object.assign(c,{preferredMaximum:null,enabled:!1,enableSent:!1,id:``,outbound_q:[],outbound:0,inbound:0,max:null,timeout:6e4,requestAckInterval:3e4,requestAckDebounce:250});async function l(){try{await t.send(O(`a`,{xmlns:Jt,h:c.inbound}))}catch{}}t.on(`disconnect`,()=>{clearTimeout(a),clearTimeout(o),clearTimeout(s),c.enabled=!1,c.enableSent=!1}),t.hook(`close`,async()=>{c.enabled&&await l()});async function u(e){c.enabled=!0,f(+e.attrs.h);let n=c.outbound_q;c.outbound_q=[],await t.sendMany(n.map(e=>Zt({entity:t,item:e}))),c.emit(`resumed`),t._ready(!0),h()}function d(){c.enabled=!1,c.enableSent=!1,c.id=``,p()}function f(e){let t=c.outbound;for(let n=0;n<+e-t;n++){let e=c.outbound_q.shift();c.outbound++,c.emit(`ack`,e.stanza)}}function p(){let e;for(;e=c.outbound_q.shift();)c.emit(`fail`,e.stanza);c.outbound=0}function m({id:e,max:t}){c.enabled=!0,c.id=e,c.max=t,c.inbound=0,h()}t.on(`offline`,()=>{p(),c.inbound=0,c.enabled=!1,c.enableSent=!1,c.id=``}),n.use(async(e,t)=>{let{stanza:n}=e;return clearTimeout(a),a=null,[`presence`,`message`,`iq`].includes(n.name)?c.inbound+=1:n.is(`r`,`urn:xmpp:sm:3`)?await l():n.is(`a`,`urn:xmpp:sm:3`)&&f(+n.attrs.h),h(),t()}),r&&Ut({bind2:r,sm:c,failed:d,enabled:m}),i&&Wt({sasl2:i,sm:c,failed:d,resumed:u});function h(e=c.requestAckInterval){clearTimeout(o),c.enabled&&e&&(o=setTimeout(g,e))}function g(){clearTimeout(o),clearTimeout(s),c.enabled&&(c.timeout&&!a&&(a=setTimeout(()=>{clearTimeout(o),t.disconnect().catch(()=>{})},c.timeout)),t.send(O(`r`,{xmlns:Jt})).catch(()=>{}),h())}return n.filter((e,t)=>{let{stanza:n}=e;return n.is(`enable`,`urn:xmpp:sm:3`)&&(c.enableSent=!0),!c.enabled&&!c.enableSent||![`presence`,`message`,`iq`].includes(n.name)?t():(c.outbound_q.push({stanza:n,stamp:Ht()}),clearTimeout(o),clearTimeout(s),s=setTimeout(g,c.requestAckDebounce),t())}),e&&Gt({streamFeatures:e,sm:c,entity:t,resumed:u,failed:d,enabled:m}),c}function Zt({entity:e,item:t}){let{stanza:n,stamp:r}=t;return n.name===`message`&&!n.getChild(`delay`,`urn:xmpp:delay`)&&n.append(O(`delay`,{xmlns:`urn:xmpp:delay`,from:e.jid.toString(),stamp:r})),n}var Qt=`urn:xmpp:bind:0`;function $t({sasl2:e,entity:t},n){let r=new Map;return e.use(Qt,async e=>{if(!e.is(`bind`,Qt))return;n=typeof n==`function`?await n():n;let t=await en({element:e,features:r});return O(`bind`,{xmlns:`urn:xmpp:bind:0`},n&&O(`tag`,null,n),...t)},e=>{if(e.is(`bound`)){t._ready(!1);for(let t of e.getChildElements())r.get(t.getNS())?.[1]?.(t)}}),{use(e,t,n){r.set(e,[t,n])}}}function en({element:e,features:t}){let n=[],r=e.getChild(`inline`);if(!r)return n;for(let e of r.getChildElements()){let r=e.attrs.var,i=t.get(r);i&&n.push(i[0](e))}return Promise.all(n)}var tn=o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t):typeof define==`function`&&define.amd&&define([`exports`,`module`],r)})(e,function(e,t){function n(){this._mechs=[]}n.prototype.use=function(e,t){return t||(t=e,e=t.prototype.name),this._mechs.push({name:e,mech:t}),this},n.prototype.create=function(e){for(var t=0,n=this._mechs.length;t<n;t++)for(var r=0,i=e.length;r<i;r++){var a=this._mechs[t];if(a.name==e[r])return new a.mech}return null},e=t.exports=n})})),nn=c(o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t,tn()):typeof define==`function`&&define.amd&&define([`exports`,`module`,`./lib/factory`],r)})(e,function(e,t,n){e=t.exports=n,e.Factory=n})}))(),1),rn=`urn:xmpp:fast:0`;function an({sasl2:e,entity:t}){let n=new nn.default,r,i=new ie.EventEmitter;Object.assign(i,{mechanism:null,mechanisms:[],async saveToken(e){r=e},async fetchToken(){return r},async deleteToken(){r=null},async save(e){try{await this.saveToken(e)}catch(e){t.emit(`error`,e)}},async fetch(){try{return this.fetchToken()}catch(e){t.emit(`error`,e)}},async delete(){try{await this.deleteToken()}catch(e){t.emit(`error`,e)}},saslFactory:n,async auth({authenticate:e,entity:t,userAgent:n,credentials:r,streamFeatures:o,features:s}){if(!i.mechanism)return!1;let{token:c}=r;if(!on(c,i.mechanisms))return l();try{return await e({saslFactory:i.saslFactory,mechanism:c.mechanism,credentials:{...r,password:c.token},streamFeatures:[...o,O(`fast`,{xmlns:rn})],entity:t,userAgent:n,features:s}),!0}catch(e){return e instanceof Ot&&[`not-authorized`,`credentials-expired`].includes(e.condition)?l():(t.emit(`error`,e),!1)}async function l(){return await i.delete(),a(o),!1}}});function a(e){e.push(O(`request-token`,{xmlns:rn,mechanism:i.mechanism}))}function o(){i.mechanism=null,i.mechanisms=[]}return o(),e.use(rn,async e=>{if(!e.is(`fast`,rn))return o();i.available=!0;let t=At(e,rn,n),r=t[0];if(!r)return o();i.mechanisms=t,i.mechanism=r},async e=>{e.is(`token`,rn)&&await i.save({mechanism:i.mechanism,token:e.attrs.token,expiry:e.attrs.expiry})}),i}function on(e,t){return!(!e||!t.includes(e.mechanism)||new Date(e.expiry)<=new Date)}var sn=o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t):typeof define==`function`&&define.amd&&define([`exports`,`module`],r)})(e,function(e,t){function n(){}n.prototype.name=`PLAIN`,n.prototype.clientFirst=!0,n.prototype.response=function(e){var t=``;return t+=e.authzid||``,t+=`\0`,t+=e.username,t+=`\0`,t+=e.password,t},n.prototype.challenge=function(e){return this},e=t.exports=n})})),cn=c(o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t,sn()):typeof define==`function`&&define.amd&&define([`exports`,`module`,`./lib/mechanism`],r)})(e,function(e,t,n){e=t.exports=n,e.Mechanism=n})}))(),1);function ln(e){e.use(cn.default)}var un=o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t):typeof define==`function`&&define.amd&&define([`exports`,`module`],r)})(e,function(e,t){function n(){}n.prototype.name=`ANONYMOUS`,n.prototype.clientFirst=!0,n.prototype.response=function(e){return e.trace||``},n.prototype.challenge=function(e){},e=t.exports=n})})),dn=c(o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t,un()):typeof define==`function`&&define.amd&&define([`exports`,`module`,`./lib/mechanism`],r)})(e,function(e,t,n){e=t.exports=n,e.Mechanism=n})}))(),1);function fn(e){e.use(dn.default)}function pn(){}pn.prototype.Mechanism=pn,pn.prototype.name=`HT-SHA-256-NONE`,pn.prototype.clientFirst=!0,pn.prototype.response=async function({username:e,password:t}){this.key=await crypto.subtle.importKey(`raw`,new TextEncoder().encode(t),{name:`HMAC`,hash:`SHA-256`},!1,[`sign`,`verify`]);let n=await crypto.subtle.sign(`HMAC`,this.key,new TextEncoder().encode(`Initiator`));return`${e}\0${String.fromCodePoint(...new Uint8Array(n))}`},pn.prototype.final=async function(e){let t=Uint8Array.from(e,e=>e.codePointAt(0));if(await crypto.subtle.verify(`HMAC`,this.key,t,new TextEncoder().encode(`Responder`))!==!0)throw Error(`Responder message from server was wrong`)};function mn(e){e.use(pn)}var hn=`ANONYMOUS`,gn=`PLAIN`;function _n(e,t){return async function(...n){if(typeof e==`function`){await e(...n);return}let[r,i,a,o]=n;e.token??=await a?.fetch(),await r(e,vn({mechanisms:i,entity:o,credentials:e}),t)}}function vn({mechanisms:e,entity:t,credentials:n}){return!n?.username&&!n?.password&&!n?.token&&e.includes(hn)?hn:t.isSecure()?e[0]:e.find(e=>e!==gn)}function yn(e){return(e.split(`://`)[1]||e).split(`:`)[0].split(`/`)[0]}function bn(e={}){let{resource:t,credentials:n,username:r,password:i,userAgent:a,...o}=e,{domain:s,service:c}=o;!s&&c&&(o.domain=yn(c));let l=new Ae(o);r&&o.domain&&(l.jid=xe(r,o.domain));let u=Me({entity:l}),d=ze({entity:l}),f=xn(He.default,{entity:l}),p=xn(He.default,{entity:l}),m=Ye({entity:l}),h=Xe({middleware:m}),g=tt({middleware:m,entity:l}),_=dt({middleware:m,entity:l}),v=A({entity:l}),y=new nn.default,b=Object.entries({...typeof He.default==`function`&&{scramsha1:He.default},plain:ln,anonymous:fn}).map(([e,t])=>({[e]:t(y)}));a??=O(`user-agent`,{id:globalThis.crypto.randomUUID()});let x=xn(He.default,{streamFeatures:h}),S=Ft({streamFeatures:h,saslFactory:y},_n(n??{username:r,password:i},a)),C=an({sasl2:S,entity:l});S.setup({fast:C});let w=$t({sasl2:S,entity:l},t);mn(C.saslFactory);let T=Mt({streamFeatures:h,saslFactory:y},_n(n??{username:r,password:i},a)),ee=j({streamFeatures:h,entity:l,middleware:m,bind2:w,sasl2:S}),te=Vt({iqCaller:g,streamFeatures:h},t);return _?.get(`urn:xmpp:ping`,`ping`,()=>({})),Object.assign(l,{entity:l,reconnect:u,tcp:f,websocket:d,tls:p,middleware:m,streamFeatures:h,iqCaller:g,iqCallee:_,resolve:v,starttls:x,saslFactory:y,sasl2:S,sasl:T,resourceBinding:te,streamManagement:ee,mechanisms:b,bind2:w,fast:C})}function xn(e,...t){if(typeof e==`function`)return e(...t)}var M={carbons:`urn:xmpp:carbons:2`,forward:`urn:xmpp:forward:0`,mam:`urn:xmpp:mam:2`,rsm:`http://jabber.org/protocol/rsm`,sid:`urn:xmpp:sid:0`,hints:`urn:xmpp:hints`,chatstates:`http://jabber.org/protocol/chatstates`,oob:`jabber:x:oob`,upload:`urn:xmpp:http:upload:0`,delay:`urn:xmpp:delay`,disco:`http://jabber.org/protocol/disco#items`,discoInfo:`http://jabber.org/protocol/disco#info`,push:`urn:xmpp:push:0`,hello:`urn:nethvoice:chat:presence`,data:`jabber:x:data`,muc:`http://jabber.org/protocol/muc`,mucOwner:`http://jabber.org/protocol/muc#owner`,mucAdmin:`http://jabber.org/protocol/muc#admin`,mucsub:`urn:xmpp:mucsub:0`,pubsubEvent:`http://jabber.org/protocol/pubsub#event`,mucsubMessages:`urn:xmpp:mucsub:nodes:messages`,conference:`jabber:x:conference`,vcard:`vcard-temp`,ping:`urn:xmpp:ping`,reactions:`urn:xmpp:reactions:0`},Sn=3e4,Cn=class{xmpp;me;domain;mucHost;uploadService;mamQueries=new Map;mamReactions=new Map;stopped=!1;attempt=0;retryTimer;pingTimer;unauthorized=!1;connected=!1;online=new Map;cfg;h;constructor(e,t){this.cfg=e,this.h=t,this.domain=e.host,this.mucHost=`conference.${e.host}`,this.me=`${e.username}@${e.host}`,this.xmpp=bn({service:`wss://${e.host}/xmpp-websocket`,domain:e.host,username:e.username,password:e.token,resource:`chat-island.`+Math.random().toString(36).slice(2,8)}),this.xmpp.reconnect?.stop(),this.xmpp.on(`status`,e=>{this.stopped||this.unauthorized||((e===`connecting`||e===`opening`||e===`connect`)&&this.h.status(`connecting`),(e===`disconnect`||e===`close`)&&(this.connected=!1,window.clearInterval(this.pingTimer),this.forgetPresence(),this.h.status(`offline`)),e===`disconnect`&&this.scheduleRetry())}),this.xmpp.on(`error`,e=>{if(!this.stopped){if(wn(e)){this.unauthorized=!0,window.clearTimeout(this.retryTimer),this.h.status(`unauthorized`,e.message);return}this.h.status(`error`,e.message)}}),this.xmpp.on(`online`,async()=>{if(this.stopped){await this.xmpp.stop().catch(()=>{});return}this.attempt=0,this.connected=!0;try{await this.xmpp.send(O(`iq`,{type:`set`,id:`carbons`},O(`enable`,{xmlns:M.carbons}))),await this.xmpp.send(O(`presence`))}catch{return}window.clearInterval(this.pingTimer),this.pingTimer=window.setInterval(()=>this.ping(),Sn),this.h.status(`online`)}),this.xmpp.on(`stanza`,e=>this.onStanza(e))}start(){window.addEventListener(`online`,this.wake),document.addEventListener(`visibilitychange`,this.onVisible),this.h.status(`connecting`),setTimeout(()=>this.connectNow(),0)}stop(){return this.stopped=!0,window.clearTimeout(this.retryTimer),window.clearInterval(this.pingTimer),window.removeEventListener(`online`,this.wake),document.removeEventListener(`visibilitychange`,this.onVisible),this.xmpp.stop().catch(()=>{})}wake=()=>{if(!(this.stopped||this.unauthorized)){if(this.connected){this.ping();return}window.clearTimeout(this.retryTimer),this.attempt=0,this.connectNow()}};onVisible=()=>{document.visibilityState===`visible`&&this.wake()};ping(){this.connected&&this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:this.domain},O(`ping`,{xmlns:M.ping})),1e4).catch(e=>{!this.stopped&&this.connected&&e.name!==`StanzaError`&&this.xmpp.disconnect().catch(()=>{})})}forgetPresence(){for(let e of this.online.keys())this.h.presence(e,!1);this.online.clear()}connectNow(){if(this.stopped||this.unauthorized)return;this.retryTimer=void 0;let e=this.xmpp;(e.status===`offline`?this.xmpp.start():e.connect(e.options.service).then(()=>e.open({domain:e.options.domain}))).catch(e=>{if(!this.stopped){if(wn(e)){this.unauthorized=!0,this.h.status(`unauthorized`,e.message);return}this.h.status(`error`,e.message),this.scheduleRetry()}})}scheduleRetry(){if(this.stopped||this.unauthorized||this.retryTimer!==void 0)return;let e=Math.min(6e4,1e3*2**this.attempt)*(.7+Math.random()*.6);this.attempt++,this.retryTimer=window.setTimeout(()=>this.connectNow(),e)}isGroup(e){return e.endsWith(`@`+this.mucHost)}async send(e,t,n){let r=crypto.randomUUID(),i=[O(`body`,{},t),O(`origin-id`,{xmlns:M.sid,id:r}),O(`store`,{xmlns:M.hints})];return n&&i.push(O(`x`,{xmlns:M.oob},O(`url`,{},n))),this.isGroup(e)?(await this.xmpp.send(O(`message`,{to:e,type:`groupchat`,id:r},...i)),{id:r,oid:r,from:e,to:this.cfg.username,body:t,ts:Date.now(),mine:!0,oob:n,room:e,nick:this.cfg.username}):(i.push(O(`active`,{xmlns:M.chatstates})),await this.xmpp.send(O(`message`,{to:`${e}@${this.domain}`,type:`chat`,id:r},...i)),{id:r,oid:r,from:this.cfg.username,to:e,body:t,ts:Date.now(),mine:!0,oob:n})}async react(e,t,n){let r=this.isGroup(e),i=O(`reactions`,{xmlns:M.reactions,id:t},...n.map(e=>O(`reaction`,{},e)));await this.xmpp.send(O(`message`,{to:r?e:`${e}@${this.domain}`,type:r?`groupchat`:`chat`,id:crypto.randomUUID()},i,O(`store`,{xmlns:M.hints})))}async announce(e){for(let t of e)await this.xmpp.send(O(`presence`,{to:`${t}@${this.domain}`},O(`x`,{xmlns:M.hello}))).catch(()=>{})}typing(e,t){return this.isGroup(e)?Promise.resolve():this.xmpp.send(O(`message`,{to:`${e}@${this.domain}`,type:`chat`},O(t?`composing`:`paused`,{xmlns:M.chatstates})))}enablePush(e,t){return this.xmpp.iqCaller.request(O(`iq`,{type:`set`},O(`enable`,{xmlns:M.push,jid:e,node:t})),15e3)}disablePush(e,t){return this.xmpp.iqCaller.request(O(`iq`,{type:`set`},O(`disable`,{xmlns:M.push,jid:e,node:t})),5e3)}async recent(e=200){return this.mam(void 0,void 0,e)}history(e,t,n=30){return this.mam(e,t,n)}async mam(e,t,n){let r=crypto.randomUUID();this.mamQueries.set(r,[]),this.mamReactions.set(r,[]);let i=O(`set`,{xmlns:M.rsm},O(`max`,{},String(n)),O(`before`,{},t??``)),a=[O(`field`,{var:`FORM_TYPE`,type:`hidden`},O(`value`,{},M.mam))];e&&a.push(O(`field`,{var:`with`},O(`value`,{},this.isGroup(e)?e:`${e}@${this.domain}`)));let o=O(`x`,{xmlns:M.data,type:`submit`},...a),s,c,l;try{s=await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,id:r},O(`query`,{xmlns:M.mam,queryid:r},o,i)),3e4)}finally{c=this.mamQueries.get(r)??[],l=this.mamReactions.get(r)??[],this.mamQueries.delete(r),this.mamReactions.delete(r)}let u=s.getChild(`fin`,M.mam),d=u?.getChild(`set`,M.rsm)?.getChildText(`first`)??void 0;return{messages:c,reactions:l,complete:u?.attrs.complete===`true`,first:d}}async createGroup(e,t,n){let r=`g-${Math.random().toString(36).slice(2,10)}@${this.mucHost}`,i=this.cfg.username,a=this.waitFor(e=>e.is(`presence`)&&N(e.attrs.from)===r,1e4);await this.xmpp.send(O(`presence`,{to:`${r}/${i}`},O(`x`,{xmlns:M.muc}))),await a;let o=(e,t)=>O(`field`,{var:e},O(`value`,{},t));await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:r},O(`query`,{xmlns:M.mucOwner},O(`x`,{xmlns:M.data,type:`submit`},o(`FORM_TYPE`,`http://jabber.org/protocol/muc#roomconfig`),o(`muc#roomconfig_roomname`,e),o(`muc#roomconfig_persistentroom`,`1`),o(`muc#roomconfig_membersonly`,`1`),o(`muc#roomconfig_publicroom`,`0`),o(`muc#roomconfig_whois`,`anyone`),o(`allow_subscription`,`1`),o(`mam`,`1`)))),15e3),n&&await this.setGroupAvatar(r,n).catch(()=>{});let s=t.filter(e=>e&&e!==this.cfg.username);await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:r},O(`query`,{xmlns:M.mucAdmin},...s.map(e=>O(`item`,{affiliation:`member`,jid:`${e}@${this.domain}`})))),15e3);for(let e of s)await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:r},O(`subscribe`,{xmlns:M.mucsub,jid:`${e}@${this.domain}`,nick:e},O(`event`,{node:M.mucsubMessages}))),15e3).catch(()=>{});await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:r},O(`subscribe`,{xmlns:M.mucsub,nick:i},O(`event`,{node:M.mucsubMessages}))),15e3),await this.xmpp.send(O(`presence`,{to:`${r}/${i}`,type:`unavailable`}));for(let t of s)await this.xmpp.send(O(`message`,{to:`${t}@${this.domain}`},O(`x`,{xmlns:M.conference,jid:r,reason:e}))).catch(()=>{});return r}async leaveGroup(e,t){t?await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:e},O(`query`,{xmlns:M.mucOwner},O(`destroy`,{}))),1e4):await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:e},O(`unsubscribe`,{xmlns:M.mucsub})),1e4)}async setGroupAvatar(e,t){let n=/^data:(image\/[a-z+]+);base64,(.+)$/i.exec(t);n&&await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:e},O(`vCard`,{xmlns:M.vcard},O(`PHOTO`,{},O(`TYPE`,{},n[1]),O(`BINVAL`,{},n[2])))),15e3)}async groupAvatar(e){let t=(await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`vCard`,{xmlns:M.vcard})),1e4)).getChild(`vCard`,M.vcard)?.getChild(`PHOTO`),n=t?.getChildText(`BINVAL`);return n?`data:${t?.getChildText(`TYPE`)||`image/jpeg`};base64,${n.replace(/\s+/g,``)}`:void 0}async listGroups(){let e=((await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:this.mucHost},O(`subscriptions`,{xmlns:M.mucsub})),15e3)).getChild(`subscriptions`,M.mucsub)?.getChildren(`subscription`)??[]).map(e=>e.attrs.jid);return Promise.all(e.map(e=>this.groupInfo(e)))}async subscribed(e){return((await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:this.mucHost},O(`subscriptions`,{xmlns:M.mucsub})),15e3)).getChild(`subscriptions`,M.mucsub)?.getChildren(`subscription`)??[]).some(t=>N(t.attrs.jid)===e)}async groupInfo(e){let t=e.split(`@`)[0],n=[],r=!1;try{t=(await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`query`,{xmlns:M.discoInfo})),1e4)).getChild(`query`,M.discoInfo)?.getChild(`identity`)?.attrs.name||t}catch{}try{n=((await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`query`,{xmlns:M.mucAdmin},O(`item`,{affiliation:`member`}))),1e4)).getChild(`query`,M.mucAdmin)?.getChildren(`item`)??[]).map(e=>Tn(e.attrs.jid));let t=await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`query`,{xmlns:M.mucAdmin},O(`item`,{affiliation:`owner`}))),1e4);for(let e of t.getChild(`query`,M.mucAdmin)?.getChildren(`item`)??[])n.push(Tn(e.attrs.jid)),Tn(e.attrs.jid)===this.cfg.username&&(r=!0)}catch{}let i=await this.groupAvatar(e).catch(()=>void 0);return{peer:e,name:t,members:[...new Set(n)],avatar:i,owner:r}}async upload(e){let t=await this.findUploadService(),n=(await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:t},O(`request`,{xmlns:M.upload,filename:e.name,size:String(e.size),"content-type":e.type||`application/octet-stream`})),3e4)).getChild(`slot`,M.upload),r=n?.getChild(`put`),i=n?.getChild(`get`)?.attrs.url;if(!r||!i)throw Error(`upload: no slot`);let a={"Content-Type":e.type||`application/octet-stream`};for(let e of r.getChildren(`header`))a[e.attrs.name]=e.text();let o=await fetch(r.attrs.url,{method:`PUT`,headers:a,body:e});if(!o.ok)throw Error(`upload: HTTP ${o.status}`);return i}async findUploadService(){if(this.uploadService)return this.uploadService;let e=async e=>{try{return(await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`query`,{xmlns:M.discoInfo})),1e4)).getChild(`query`,M.discoInfo)?.getChildren(`feature`).some(e=>e.attrs.var===M.upload)??!1}catch{return!1}},t=[`upload.${this.domain}`];try{let e=await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:this.domain},O(`query`,{xmlns:M.disco})),1e4);for(let n of e.getChild(`query`,M.disco)?.getChildren(`item`)??[])t.includes(n.attrs.jid)||t.push(n.attrs.jid)}catch{}for(let n of t)if(await e(n))return this.uploadService=n,n;throw Error(`upload: service not found`)}waiters=[];waitFor(e,t){return new Promise((n,r)=>{let i={test:e,resolve:n};this.waiters.push(i),setTimeout(()=>{let e=this.waiters.indexOf(i);e>=0&&(this.waiters.splice(e,1),r(Error(`timeout`)))},t)})}onStanza(e){for(let t of[...this.waiters])t.test(e)&&(this.waiters.splice(this.waiters.indexOf(t),1),t.resolve());if(e.is(`presence`)){let t=e.attrs.from??``,n=N(t);if(!n||n===this.me||n.endsWith(`@`+this.mucHost)||e.attrs.type===`error`||e.attrs.type?.startsWith(`subscribe`))return;let r=Tn(n),i=this.online.get(r)??new Set;e.attrs.type===`unavailable`?i.delete(t):i.add(t),this.online.set(r,i),this.h.presence(r,i.size>0);let a=e.getChild(`x`,M.hello);a&&!a.attrs.reply&&e.attrs.type!==`unavailable`&&this.xmpp.send(O(`presence`,{to:n},O(`x`,{xmlns:M.hello,reply:`1`}))).catch(()=>{});return}if(!e.is(`message`))return;let t=!e.attrs.from||N(e.attrs.from)===this.me,n=e.getChild(`result`,M.mam);if(n){if(!t)return;let e=n.getChild(`forwarded`,M.forward)?.getChild(`message`),r=this.mamQueries.get(n.attrs.queryid);if(e&&r){let t=this.reactionOf(e);t&&this.mamReactions.get(n.attrs.queryid)?.push(t);let i=t?void 0:this.toMessage(e,n.attrs.id,En(n.getChild(`forwarded`,M.forward)));i&&r.push(i)}return}let r=e.getChild(`received`,M.carbons)??e.getChild(`sent`,M.carbons);if(r){if(!t)return;let e=r.getChild(`forwarded`,M.forward)?.getChild(`message`);e&&this.deliver(e);return}let i=e.getChild(`x`,M.conference);if(i){let e=N(i.attrs.jid);this.isGroup(e)&&this.h.groupInvite(e);return}this.deliver(e)}deliver(e){let t=this.reactionOf(e);if(t){this.h.reaction(t);return}let n=this.toMessage(e,e.getChild(`stanza-id`,M.sid)?.attrs.id,En(e));if(n){this.h.message(n);return}if(e.attrs.type!==`chat`)return;let r=N(e.attrs.from),i=r===this.me?N(e.attrs.to):r,a=e.getChildByAttr(`xmlns`,M.chatstates);!e.getChild(`body`)&&a&&this.h.typing(Tn(i),a.name===`composing`)}reactionOf(e){let t=e.getChild(`event`,M.pubsubEvent),n=e,r;if(t&&t.getChild(`items`)?.attrs.node===M.mucsubMessages){r=N(e.attrs.from);let i=Dn(t);if(!this.isGroup(r)||!i||N(i.attrs.from)!==r)return;n=i}else if(e.attrs.type===`groupchat`&&(r=N(e.attrs.from),!this.isGroup(r)))return;let i=n.getChild(`reactions`,M.reactions),a=i?.attrs.id;if(!i||!a)return;let o=[...new Set(i.getChildren(`reaction`).map(e=>e.text().trim()).filter(e=>e&&e.length<=16))].slice(0,5);if(r){let e=(n.attrs.from??``).split(`/`)[1]??``;return e?{peer:r,target:a,user:e,emojis:o}:void 0}if(n.attrs.type!==`chat`)return;let s=N(n.attrs.from),c=s===this.me||!n.attrs.from,l=Tn(c?N(n.attrs.to):s);return l?{peer:l,target:a,user:c?this.cfg.username:Tn(s),emojis:o}:void 0}toMessage(e,t,n){let r=e.getChild(`event`,M.pubsubEvent);if(r&&r.getChild(`items`)?.attrs.node===M.mucsubMessages){let i=N(e.attrs.from);if(!this.isGroup(i))return;let a=Dn(r);if(!a||N(a.attrs.from)!==i)return;let o=(a.attrs.from??``).split(`/`)[1]??``,s=a.getChildText(`body`);return s==null?void 0:{id:a.getChild(`origin-id`,M.sid)?.attrs.id??t??a.getChild(`stanza-id`,M.sid)?.attrs.id??a.attrs.id??crypto.randomUUID(),oid:a.getChild(`origin-id`,M.sid)?.attrs.id??a.attrs.id,from:i,to:this.cfg.username,body:s,ts:En(a)!==n&&a.getChild(`delay`,M.delay)?En(a):n,mine:o===this.cfg.username,oob:a.getChild(`x`,M.oob)?.getChildText(`url`)??void 0,room:i,nick:o}}let i=e.getChildText(`body`);if(i==null)return;let a=N(e.attrs.from);if(e.attrs.type===`groupchat`){if(!this.isGroup(a))return;let r=(e.attrs.from??``).split(`/`)[1]??``;return{id:t??e.getChild(`origin-id`,M.sid)?.attrs.id??e.attrs.id??crypto.randomUUID(),oid:e.getChild(`origin-id`,M.sid)?.attrs.id??e.attrs.id,from:a,to:this.cfg.username,body:i,ts:n,mine:r===this.cfg.username,oob:e.getChild(`x`,M.oob)?.getChildText(`url`)??void 0,room:a,nick:r}}if(e.attrs.type!==`chat`)return;let o=a===this.me;return{id:t??e.getChild(`origin-id`,M.sid)?.attrs.id??e.attrs.id??crypto.randomUUID(),oid:e.getChild(`origin-id`,M.sid)?.attrs.id??e.attrs.id,from:Tn(a),to:Tn(N(e.attrs.to)),body:i,ts:n,mine:o,oob:e.getChild(`x`,M.oob)?.getChildText(`url`)??void 0}}},N=(e=``)=>e.split(`/`)[0],wn=e=>e.name===`SASLError`||e.condition===`not-authorized`,Tn=(e=``)=>e.split(`@`)[0],En=e=>{let t=e?.getChild(`delay`,M.delay)?.attrs.stamp;return t?Date.parse(t):Date.now()};function Dn(e){for(let t of e.children){if(typeof t==`string`)continue;if(t.name===`message`)return t;let e=Dn(t);if(e)return e}}var On;function kn(){try{On??=new AudioContext,On.state===`suspended`&&On.resume();let e=On.currentTime;for(let[t,n,r]of[[880,0,.09],[1174.7,.1,.16]]){let i=On.createOscillator(),a=On.createGain();i.type=`sine`,i.frequency.value=t,a.gain.setValueAtTime(1e-4,e+n),a.gain.exponentialRampToValueAtTime(.12,e+n+.01),a.gain.exponentialRampToValueAtTime(1e-4,e+n+r),i.connect(a).connect(On.destination),i.start(e+n),i.stop(e+n+r+.02)}}catch{}}var An=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},jn=e=>e?An(e):An,Mn=o((e=>{var t=u();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Nn=o(((e,t)=>{t.exports=Mn()})),Pn=o((e=>{var t=u(),n=Nn();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Fn=c(o(((e,t)=>{t.exports=Pn()}))(),1),{useDebugValue:In}=g.default,{useSyncExternalStoreWithSelector:Ln}=Fn.default,Rn=e=>e;function zn(e,t=Rn,n){let r=Ln(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return In(r),r}var Bn=e=>{let t=typeof e==`function`?jn(e):e,n=(e,n)=>zn(t,e,n);return Object.assign(n,t),n},Vn=e=>e?Bn(e):Bn,Hn=e=>e.room??(e.mine?e.to:e.from),Un=(e,t)=>({peer:e,kind:t&&e.endsWith(`@`+t)?`group`:`chat`,messages:[],unread:0,typing:!1,loaded:!1,complete:!1}),Wn=(e,t,n,r)=>{if(e.includes(t))return e;let i=[t,...e];if(i.length<=n)return i;let a=[...i].reverse().find(e=>e!==r);return i.filter(e=>e!==a)},P=Vn((e,t)=>({me:``,mucHost:``,status:`connecting`,contacts:{},online:{},mobile:{},conversations:{},order:[],open:null,picker:!1,push:`unavailable`,enablePush:()=>{},maxHeads:5,newChatButton:!0,setStatus:(t,n)=>e({status:t,error:n}),reset:()=>e({status:`connecting`,error:void 0,contacts:{},online:{},mobile:{},conversations:{},order:[],open:null,picker:!1}),setContacts:t=>e({contacts:Object.fromEntries(t.filter(e=>e?.username).map(e=>[e.username,{...e,name:e.name||e.username}]))}),setMobile:t=>e({mobile:Object.fromEntries(t.map(e=>[e,!0]))}),setOnline:(t,n)=>e(e=>e.online[t]===n?{}:{online:{...e.online,[t]:n}}),ensure:n=>{let r=t().conversations[n];if(r)return r;let i=Un(n,t().mucHost);return e(e=>({conversations:{...e.conversations,[n]:i}})),i},setGroup:(t,n,r,i,a)=>e(e=>{let o=e.conversations[t]??Un(t,e.mucHost);return{conversations:{...e.conversations,[t]:{...o,kind:`group`,name:n,members:r,avatar:i??o.avatar,owner:a??o.owner}}}}),seed:(t,n)=>e(e=>{let r={...e.conversations};for(let i of t){let t=Hn(i);if(!t||t===n)continue;let a=r[t]??Un(t,e.mucHost);if(a.messages.some(e=>e.id===i.id))continue;if(a.loaded){r[t]={...a,messages:[...a.messages,i].sort((e,t)=>e.ts-t.ts)};continue}let o=a.messages[a.messages.length-1];r[t]={...a,messages:!o||o.ts<=i.ts?[i]:a.messages}}return{conversations:r}}),addMessage:(t,n,r)=>e(e=>{let i=e.conversations[t]??Un(t,e.mucHost),a=i.messages.filter(e=>e.id!==n.id&&!(e.pending&&n.mine&&e.body===n.body&&e.oob===n.oob)),o=a.length;for(;o>0&&a[o-1].ts>n.ts;)o--;a.splice(o,0,n);let s=e.open===t,c=r?.live&&!n.mine&&!s?i.unread+1:i.unread,l=Wn(e.order,t,e.maxHeads,e.open);return{conversations:{...e.conversations,[t]:{...i,messages:a,unread:c,typing:n.mine?i.typing:!1}},order:l}}),prependHistory:(t,n,r,i)=>e(e=>{let a=e.conversations[t]??Un(t,e.mucHost),o=new Set(a.messages.map(e=>e.id)),s=[...n.filter(e=>!o.has(e.id)),...a.messages].sort((e,t)=>e.ts-t.ts);return{conversations:{...e.conversations,[t]:{...a,messages:s,loaded:!0,complete:r,oldest:i??a.oldest}}}}),applyReactions:t=>e(e=>{if(!t.length)return{};let n={...e.conversations};for(let r of t){let t=n[r.peer]??Un(r.peer,e.mucHost),i={...t.reactions??{}},a={...i[r.target]??{}};r.emojis.length?a[r.user]=r.emojis:delete a[r.user],i[r.target]=a,n[r.peer]={...t,reactions:i}}return{conversations:n}}),setTyping:(t,n)=>e(e=>e.conversations[t]?{conversations:{...e.conversations,[t]:{...e.conversations[t],typing:n}}}:{}),openChat:t=>e(e=>({conversations:e.conversations[t]?e.conversations:{...e.conversations,[t]:Un(t,e.mucHost)},order:Wn(e.order,t,e.maxHeads,e.open),open:t,picker:!1})),closeChat:()=>e({open:null}),removeConversation:t=>e(e=>{let n={...e.conversations};return delete n[t],{conversations:n,order:e.order.filter(e=>e!==t),open:e.open===t?null:e.open}}),removeHead:t=>e(e=>({order:e.order.filter(e=>e!==t),open:e.open===t?null:e.open})),markRead:t=>e(e=>e.conversations[t]&&e.conversations[t].unread?{conversations:{...e.conversations,[t]:{...e.conversations[t],unread:0}}}:{}),setPicker:t=>e({picker:t}),totalUnread:()=>Object.values(t().conversations).reduce((e,t)=>e+t.unread,0)}));async function Gn(e,t,n){let r=await fetch(`https://${e}/api${n}`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw Error(`${n}: HTTP ${r.status}`);return await r.json()}async function Kn(e,t,n){let r=await Gn(e,t,`/user/endpoints/all`),i={};try{i=await Gn(e,t,`/user/all_avatars`)}catch{}return Object.values(r).filter(e=>e.username&&e.username!==n).map(e=>({username:e.username,name:e.name||e.username,avatar:i[e.username],presence:e.mainPresence})).sort((e,t)=>e.name.localeCompare(t.name))}async function qn(e,t){let n=await fetch(`https://${e}/chat-gw/push/mobile`,{headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw Error(`push/mobile: HTTP ${n.status}`);return(await n.json()).users}async function Jn(e,t,n){let r=await fetch(`https://${e}/chat-gw/conversations/${encodeURIComponent(n)}`,{method:`DELETE`,headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw Error(`delete: HTTP ${r.status}`)}var Yn=e=>{let t=atob((e+`=`.repeat((4-e.length%4)%4)).replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))},Xn=!1;function Zn(){Xn||(Xn=!0,navigator.serviceWorker.addEventListener(`message`,e=>{e.data?.type===`chat-island-open`&&typeof e.data.username==`string`&&window.dispatchEvent(new CustomEvent(`chat-island-open`,{detail:{username:e.data.username}}))}))}async function Qn(e,t){if(!(`serviceWorker`in navigator)||!(`PushManager`in window))throw Error(`push not supported by this browser`);if(Notification.permission===`denied`||Notification.permission!==`granted`&&await Notification.requestPermission()!==`granted`)return null;let n=`https://${e.host}/chat-gw`,r=await fetch(`${n}/push/vapid`);if(!r.ok)throw Error(`vapid: HTTP ${r.status}`);let i=await r.json(),a=await navigator.serviceWorker.register(t);await navigator.serviceWorker.ready;let o=await a.pushManager.getSubscription()??await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Yn(i.publicKey)}),s=await fetch(`${n}/push/web`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.token}`},body:JSON.stringify(o.toJSON())});if(!s.ok)throw Error(`push/web: HTTP ${s.status} ${(await s.text()).slice(0,120)}`);let c=await s.json();return Zn(),{node:c.node,service:c.service}}function F(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function $n(e,t){let n=e=>t(e.detail);return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}var er=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),I=o(((e,t)=>{t.exports=er()}))(),tr=e=>e.split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()??``).join(``);function nr({contact:e,username:t,size:n=40}){let r=e?.name||t,i={width:n,height:n,fontSize:n/2.6};return e?.avatar?(0,I.jsx)(`img`,{src:e.avatar,alt:r,style:i,draggable:!1,className:`ci-rounded-full ci-object-cover ci-shrink-0`}):(0,I.jsx)(`div`,{style:i,className:`ci-rounded-full ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-font-medium ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900`,children:tr(r)})}function rr({online:e,presence:t,mobile:n}){return(0,I.jsx)(`span`,{className:`ci-absolute ci-bottom-0 ci-right-0 ci-w-3 ci-h-3 ci-rounded-full ci-ring-2 ci-ring-gray-50 dark:ci-ring-gray-950 ${t===`dnd`||t===`busy`?`ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark`:e||n?`ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark`:`ci-bg-gray-400 dark:ci-bg-gray-600`}`})}function ir({name:e,size:t=40,avatar:n}){let r={width:t,height:t,fontSize:t/2.8};return n?(0,I.jsx)(`img`,{src:n,alt:e,style:r,draggable:!1,className:`ci-rounded-full ci-object-cover ci-shrink-0`}):(0,I.jsx)(`div`,{style:r,className:`ci-rounded-full ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-font-medium ci-bg-iconSecondary dark:ci-bg-iconSecondaryDark ci-text-white`,children:tr(e||`G`)})}var ar=`ci-flex ci-content-center ci-items-center ci-justify-center ci-tracking-wide ci-duration-200 ci-transform ci-outline-none focus:ci-ring-2 focus:ci-z-20 focus:ci-ring-offset-2 disabled:ci-opacity-40 disabled:ci-cursor-not-allowed ci-border ci-border-transparent focus:ci-ring-offset-white dark:focus:ci-ring-offset-black ci-text-sm ci-leading-4 ci-transition-colors ci-shrink-0 ci-font-light`,or={default:`ci-bg-phoneIslandActive dark:ci-bg-phoneIslandActiveDark hover:ci-bg-gray-500 dark:hover:ci-bg-gray-50 focus:ci-ring-emerald-500 dark:focus:ci-ring-emerald-300 ci-text-primaryInvert dark:ci-text-primaryInvertDark ci-h-12 ci-w-12 ci-rounded-full`,green:`ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark hover:ci-bg-phoneIslandCallHover dark:hover:ci-bg-phoneIslandCallHoverDark focus:ci-ring-green-500 ci-text-white dark:ci-text-gray-950 ci-h-12 ci-w-12 ci-rounded-full`,red:`ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark hover:ci-bg-phoneIslandCloseHover dark:hover:ci-bg-phoneIslandCloseHoverDark focus:ci-ring-emerald-500 ci-text-white dark:ci-text-gray-950 ci-h-12 ci-w-12 ci-rounded-full`,neutral:`ci-bg-transparent enabled:hover:ci-bg-gray-500 enabled:hover:ci-border-gray-500 ci-border ci-border-gray-700 focus:ci-ring-0 ci-text-secondaryNeutral dark:ci-text-secondaryNeutralDark ci-h-12 ci-w-12 ci-rounded-full`,transparent:`ci-bg-transparent dark:enabled:hover:ci-bg-gray-700/30 enabled:hover:ci-bg-gray-300/70 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500 ci-text-secondaryNeutral dark:ci-text-secondaryNeutralDark ci-h-12 ci-w-12 ci-rounded-full`,call:`ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark hover:ci-bg-phoneIslandCallHover dark:hover:ci-bg-phoneIslandCallHoverDark focus:ci-ring-green-500 ci-text-white dark:ci-text-gray-950 ci-h-8 ci-w-8 ci-rounded-full`,small:`ci-bg-transparent dark:hover:ci-bg-gray-600 hover:ci-bg-gray-300 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500 ci-text-gray-700 dark:ci-text-white ci-h-8 ci-w-8 ci-rounded`};function sr({variant:e,className:t=``,children:n,...r}){return(0,I.jsx)(`button`,{type:`button`,"aria-label":r[`aria-label`]??r.title,className:`${ar} ${or[e]} ${t}`,...r,children:n})}var L={chat:(0,I.jsx)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`})}),bell:(0,I.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9M13.73 21a2 2 0 0 1-3.46 0`})}),clip:(0,I.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`})}),send:(0,I.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`})}),phone:(0,I.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z`})}),mic:(0,I.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`path`,{d:`M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z`}),(0,I.jsx)(`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2M12 19v4M8 23h8`})]}),camera:(0,I.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`path`,{d:`M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z`}),(0,I.jsx)(`circle`,{cx:`12`,cy:`13`,r:`4`})]}),trash:(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6`})}),minus:(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,I.jsx)(`path`,{d:`M5 12h14`})}),close:(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,I.jsx)(`path`,{d:`M18 6L6 18M6 6l12 12`})}),smile:(0,I.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,I.jsx)(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),react:(0,I.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`path`,{d:`M20.5 11A8.5 8.5 0 1 1 13 3.5`}),(0,I.jsx)(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01M19 2v6M16 5h6`})]}),search:(0,I.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,I.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,I.jsx)(`path`,{d:`M21 21l-4.35-4.35`})]})};function cr({onDragStart:e,pushButton:t=!0}){let{order:n,open:r,conversations:i,contacts:a,online:o,mobile:s,openChat:c,removeHead:l,picker:u,setPicker:d,status:f,push:p,enablePush:m,newChatButton:h}=P(y(e=>({order:e.order,open:e.open,conversations:e.conversations,contacts:e.contacts,online:e.online,mobile:e.mobile,openChat:e.openChat,removeHead:e.removeHead,picker:e.picker,setPicker:e.setPicker,status:e.status,push:e.push,enablePush:e.enablePush,newChatButton:e.newChatButton})));return(0,I.jsxs)(`div`,{className:`ci-flex ci-flex-col-reverse ci-items-center ci-gap-3 ci-mb-3 ${e?`ci-cursor-grab active:ci-cursor-grabbing ci-touch-none`:``}`,onPointerDown:e,children:[n.map(e=>{let t=i[e],n=r===e;return(0,I.jsxs)(`div`,{className:`ci-relative ci-group`,children:[(0,I.jsxs)(`button`,{type:`button`,title:t?.kind===`group`?t.name??e:a[e]?.name??e,onClick:()=>n?P.getState().closeChat():c(e),className:`ci-relative ci-rounded-full ci-shadow-lg ci-transition-transform hover:ci-scale-105 ci-ring-2 ci-border-0 ci-p-0 ci-bg-transparent ${n?`ci-ring-iconSecondary dark:ci-ring-iconSecondaryDark`:`ci-ring-gray-50 dark:ci-ring-gray-950`}`,children:[t?.kind===`group`?(0,I.jsx)(ir,{name:t.name??e,size:48,avatar:t.avatar}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(nr,{contact:a[e],username:e,size:48}),(0,I.jsx)(rr,{online:o[e],presence:a[e]?.presence,mobile:s[e]})]}),t?.unread>0&&(0,I.jsx)(`span`,{className:`ci-absolute ci--top-1 ci--right-1 ci-min-w-5 ci-h-5 ci-px-1 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-text-white dark:ci-text-gray-950 ci-text-xs ci-font-medium ci-flex ci-items-center ci-justify-center`,children:t.unread>99?`99+`:t.unread})]}),(0,I.jsx)(`button`,{type:`button`,"aria-label":`Remove ${t?.kind===`group`?t.name??e:a[e]?.name??e} from the dock`,onClick:()=>l(e),className:`ci-absolute ci--top-1 ci--left-1 ci-hidden group-hover:ci-flex group-focus-within:ci-flex ci-w-5 ci-h-5 ci-rounded-full ci-border-0 ci-p-0 ci-bg-gray-700 dark:ci-bg-gray-300 ci-text-gray-50 dark:ci-text-gray-900 ci-items-center ci-justify-center`,children:L.close})]},e)}),h&&(0,I.jsxs)(sr,{variant:`default`,title:f===`online`?`New chat`:`Chat ${f}`,onClick:()=>d(!u),className:`ci-relative ci-shadow-lg`,children:[L.chat,f!==`online`&&(0,I.jsx)(`span`,{className:`ci-absolute ci-bottom-0 ci-right-0 ci-w-3 ci-h-3 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-ring-2 ci-ring-gray-50 dark:ci-ring-gray-950`})]}),t&&p===`ask`&&f===`online`&&(0,I.jsx)(sr,{variant:`neutral`,title:`Enable notifications when the tab is closed`,onClick:m,className:`ci-shadow-lg ci-bg-gray-50 dark:ci-bg-gray-950`,children:L.bell})]})}var lr={"+1":`๐Ÿ‘`,thumbsup:`๐Ÿ‘`,"-1":`๐Ÿ‘Ž`,thumbsdown:`๐Ÿ‘Ž`,ok_hand:`๐Ÿ‘Œ`,clap:`๐Ÿ‘`,pray:`๐Ÿ™`,wave:`๐Ÿ‘‹`,raised_hands:`๐Ÿ™Œ`,muscle:`๐Ÿ’ช`,point_up:`โ˜๏ธ`,point_right:`๐Ÿ‘‰`,point_left:`๐Ÿ‘ˆ`,point_down:`๐Ÿ‘‡`,v:`โœŒ๏ธ`,crossed_fingers:`๐Ÿคž`,handshake:`๐Ÿค`,eyes:`๐Ÿ‘€`,facepalm:`๐Ÿคฆ`,shrug:`๐Ÿคท`,raising_hand:`๐Ÿ™‹`,heart:`โค๏ธ`,broken_heart:`๐Ÿ’”`,orange_heart:`๐Ÿงก`,yellow_heart:`๐Ÿ’›`,green_heart:`๐Ÿ’š`,blue_heart:`๐Ÿ’™`,purple_heart:`๐Ÿ’œ`,black_heart:`๐Ÿ–ค`,white_heart:`๐Ÿค`,sparkling_heart:`๐Ÿ’–`,two_hearts:`๐Ÿ’•`,100:`๐Ÿ’ฏ`,fire:`๐Ÿ”ฅ`,star:`โญ`,star2:`๐ŸŒŸ`,sparkles:`โœจ`,zap:`โšก`,boom:`๐Ÿ’ฅ`,tada:`๐ŸŽ‰`,confetti_ball:`๐ŸŽŠ`,balloon:`๐ŸŽˆ`,gift:`๐ŸŽ`,birthday:`๐ŸŽ‚`,cake:`๐Ÿฐ`,trophy:`๐Ÿ†`,medal:`๐Ÿ…`,rocket:`๐Ÿš€`,white_check_mark:`โœ…`,heavy_check_mark:`โœ”๏ธ`,x:`โŒ`,warning:`โš ๏ธ`,question:`โ“`,exclamation:`โ—`,no_entry:`โ›”`,ok:`๐Ÿ†—`,new:`๐Ÿ†•`,sos:`๐Ÿ†˜`,heavy_plus_sign:`โž•`,heavy_minus_sign:`โž–`,smile:`๐Ÿ˜„`,smiley:`๐Ÿ˜ƒ`,grinning:`๐Ÿ˜€`,grin:`๐Ÿ˜`,laughing:`๐Ÿ˜†`,satisfied:`๐Ÿ˜†`,sweat_smile:`๐Ÿ˜…`,joy:`๐Ÿ˜‚`,rofl:`๐Ÿคฃ`,slightly_smiling_face:`๐Ÿ™‚`,upside_down_face:`๐Ÿ™ƒ`,wink:`๐Ÿ˜‰`,blush:`๐Ÿ˜Š`,innocent:`๐Ÿ˜‡`,heart_eyes:`๐Ÿ˜`,star_struck:`๐Ÿคฉ`,kissing_heart:`๐Ÿ˜˜`,yum:`๐Ÿ˜‹`,stuck_out_tongue:`๐Ÿ˜›`,stuck_out_tongue_winking_eye:`๐Ÿ˜œ`,zany_face:`๐Ÿคช`,money_mouth_face:`๐Ÿค‘`,hugs:`๐Ÿค—`,hugging_face:`๐Ÿค—`,shushing_face:`๐Ÿคซ`,thinking:`๐Ÿค”`,thinking_face:`๐Ÿค”`,zipper_mouth_face:`๐Ÿค`,raised_eyebrow:`๐Ÿคจ`,neutral_face:`๐Ÿ˜`,expressionless:`๐Ÿ˜‘`,no_mouth:`๐Ÿ˜ถ`,smirk:`๐Ÿ˜`,unamused:`๐Ÿ˜’`,roll_eyes:`๐Ÿ™„`,grimacing:`๐Ÿ˜ฌ`,relieved:`๐Ÿ˜Œ`,pensive:`๐Ÿ˜”`,sleepy:`๐Ÿ˜ช`,sleeping:`๐Ÿ˜ด`,mask:`๐Ÿ˜ท`,face_with_thermometer:`๐Ÿค’`,nauseated_face:`๐Ÿคข`,sneezing_face:`๐Ÿคง`,hot_face:`๐Ÿฅต`,cold_face:`๐Ÿฅถ`,dizzy_face:`๐Ÿ˜ต`,exploding_head:`๐Ÿคฏ`,cowboy_hat_face:`๐Ÿค `,partying_face:`๐Ÿฅณ`,sunglasses:`๐Ÿ˜Ž`,nerd_face:`๐Ÿค“`,confused:`๐Ÿ˜•`,worried:`๐Ÿ˜Ÿ`,slightly_frowning_face:`๐Ÿ™`,open_mouth:`๐Ÿ˜ฎ`,astonished:`๐Ÿ˜ฒ`,flushed:`๐Ÿ˜ณ`,pleading_face:`๐Ÿฅบ`,fearful:`๐Ÿ˜จ`,cold_sweat:`๐Ÿ˜ฐ`,cry:`๐Ÿ˜ข`,sob:`๐Ÿ˜ญ`,scream:`๐Ÿ˜ฑ`,disappointed:`๐Ÿ˜ž`,weary:`๐Ÿ˜ฉ`,tired_face:`๐Ÿ˜ซ`,yawning_face:`๐Ÿฅฑ`,triumph:`๐Ÿ˜ค`,rage:`๐Ÿ˜ก`,angry:`๐Ÿ˜ `,cursing_face:`๐Ÿคฌ`,smiling_imp:`๐Ÿ˜ˆ`,skull:`๐Ÿ’€`,poop:`๐Ÿ’ฉ`,hankey:`๐Ÿ’ฉ`,clown_face:`๐Ÿคก`,ghost:`๐Ÿ‘ป`,alien:`๐Ÿ‘ฝ`,robot:`๐Ÿค–`,see_no_evil:`๐Ÿ™ˆ`,hear_no_evil:`๐Ÿ™‰`,speak_no_evil:`๐Ÿ™Š`,coffee:`โ˜•`,tea:`๐Ÿต`,beer:`๐Ÿบ`,beers:`๐Ÿป`,wine_glass:`๐Ÿท`,clinking_glasses:`๐Ÿฅ‚`,pizza:`๐Ÿ•`,hamburger:`๐Ÿ”`,sunny:`โ˜€๏ธ`,cloud:`โ˜๏ธ`,rainbow:`๐ŸŒˆ`,snowflake:`โ„๏ธ`,umbrella:`โ˜”`,phone:`โ˜Ž๏ธ`,telephone_receiver:`๐Ÿ“ž`,iphone:`๐Ÿ“ฑ`,computer:`๐Ÿ’ป`,email:`๐Ÿ“ง`,calendar:`๐Ÿ“…`,memo:`๐Ÿ“`,pencil2:`โœ๏ธ`,paperclip:`๐Ÿ“Ž`,pushpin:`๐Ÿ“Œ`,lock:`๐Ÿ”’`,key:`๐Ÿ”‘`,bulb:`๐Ÿ’ก`,hourglass:`โŒ›`,hourglass_flowing_sand:`โณ`,alarm_clock:`โฐ`,stopwatch:`โฑ๏ธ`,bell:`๐Ÿ””`,mega:`๐Ÿ“ฃ`,loudspeaker:`๐Ÿ“ข`,speech_balloon:`๐Ÿ’ฌ`,thought_balloon:`๐Ÿ’ญ`,moneybag:`๐Ÿ’ฐ`,car:`๐Ÿš—`,airplane:`โœˆ๏ธ`,house:`๐Ÿ `,office:`๐Ÿข`,earth_africa:`๐ŸŒ`,globe_with_meridians:`๐ŸŒ`,arrow_right:`โžก๏ธ`,arrow_left:`โฌ…๏ธ`,arrow_up:`โฌ†๏ธ`,arrow_down:`โฌ‡๏ธ`,recycle:`โ™ป๏ธ`,zzz:`๐Ÿ’ค`,sweat_drops:`๐Ÿ’ฆ`,dash:`๐Ÿ’จ`},ur=/(```[\s\S]*?(?:```|$)|`[^`\n]*`?)/g,dr=/:([a-z0-9_+-]+):/g,fr=e=>e.replace(dr,(e,t)=>lr[t]??e);function pr(e){return e.includes(`:`)?e.split(ur).map((e,t)=>t%2?e:fr(e)).join(``):e}var mr=[{label:`Smileys`,icon:`๐Ÿ˜€`,emojis:`๐Ÿ˜€ ๐Ÿ˜ƒ ๐Ÿ˜„ ๐Ÿ˜ ๐Ÿ˜† ๐Ÿ˜… ๐Ÿคฃ ๐Ÿ˜‚ ๐Ÿ™‚ ๐Ÿ™ƒ ๐Ÿ˜‰ ๐Ÿ˜Š ๐Ÿ˜‡ ๐Ÿฅฐ ๐Ÿ˜ ๐Ÿคฉ ๐Ÿ˜˜ ๐Ÿ˜— ๐Ÿ˜š ๐Ÿ˜™ ๐Ÿ˜‹ ๐Ÿ˜› ๐Ÿ˜œ ๐Ÿคช ๐Ÿ˜ ๐Ÿค‘ ๐Ÿค— ๐Ÿคญ ๐Ÿคซ ๐Ÿค” ๐Ÿค ๐Ÿคจ ๐Ÿ˜ ๐Ÿ˜‘ ๐Ÿ˜ถ ๐Ÿ˜ ๐Ÿ˜’ ๐Ÿ™„ ๐Ÿ˜ฌ ๐Ÿ˜Œ ๐Ÿ˜” ๐Ÿ˜ช ๐Ÿคค ๐Ÿ˜ด ๐Ÿ˜ท ๐Ÿค’ ๐Ÿค• ๐Ÿคข ๐Ÿคฎ ๐Ÿคง ๐Ÿฅต ๐Ÿฅถ ๐Ÿฅด ๐Ÿ˜ต ๐Ÿคฏ ๐Ÿค  ๐Ÿฅณ ๐Ÿ˜Ž ๐Ÿค“ ๐Ÿง ๐Ÿ˜• ๐Ÿ˜Ÿ ๐Ÿ™ โ˜น๏ธ ๐Ÿ˜ฎ ๐Ÿ˜ฏ ๐Ÿ˜ฒ ๐Ÿ˜ณ ๐Ÿฅบ ๐Ÿ˜ฆ ๐Ÿ˜ง ๐Ÿ˜จ ๐Ÿ˜ฐ ๐Ÿ˜ฅ ๐Ÿ˜ข ๐Ÿ˜ญ ๐Ÿ˜ฑ ๐Ÿ˜– ๐Ÿ˜ฃ ๐Ÿ˜ž ๐Ÿ˜“ ๐Ÿ˜ฉ ๐Ÿ˜ซ ๐Ÿฅฑ ๐Ÿ˜ค ๐Ÿ˜ก ๐Ÿ˜  ๐Ÿคฌ ๐Ÿ˜ˆ ๐Ÿ’€ ๐Ÿ’ฉ ๐Ÿคก ๐Ÿ‘ป ๐Ÿ‘ฝ ๐Ÿค–`},{label:`Gestures`,icon:`๐Ÿ‘`,emojis:`๐Ÿ‘ ๐Ÿ‘Ž ๐Ÿ‘Œ ๐ŸคŒ ๐Ÿค โœŒ๏ธ ๐Ÿคž ๐ŸคŸ ๐Ÿค˜ ๐Ÿค™ ๐Ÿ‘ˆ ๐Ÿ‘‰ ๐Ÿ‘† ๐Ÿ‘‡ โ˜๏ธ โœ‹ ๐Ÿคš ๐Ÿ–๏ธ ๐Ÿ–– ๐Ÿ‘‹ ๐Ÿ‘ ๐Ÿ™Œ ๐Ÿ‘ ๐Ÿคฒ ๐Ÿค ๐Ÿ™ โœ๏ธ ๐Ÿ’ช ๐Ÿซถ ๐Ÿ‘€ ๐Ÿง  ๐Ÿ™‹ ๐Ÿ™† ๐Ÿ™… ๐Ÿคท ๐Ÿคฆ ๐Ÿ™‡`},{label:`Hearts and symbols`,icon:`โค๏ธ`,emojis:`โค๏ธ ๐Ÿงก ๐Ÿ’› ๐Ÿ’š ๐Ÿ’™ ๐Ÿ’œ ๐Ÿ–ค ๐Ÿค ๐ŸคŽ ๐Ÿ’” โฃ๏ธ ๐Ÿ’• ๐Ÿ’ž ๐Ÿ’“ ๐Ÿ’— ๐Ÿ’– ๐Ÿ’˜ ๐Ÿ’ ๐Ÿ’ฏ ๐Ÿ’ข ๐Ÿ’ฅ ๐Ÿ’ซ ๐Ÿ’ฆ ๐Ÿ’จ ๐Ÿ”ฅ โœจ โญ ๐ŸŒŸ โœ… โŒ โš ๏ธ โ“ โ— โž• โž– ๐Ÿ†— ๐Ÿ†• ๐Ÿ”ด ๐ŸŸข ๐ŸŸก ๐Ÿ”ต`},{label:`Celebrations`,icon:`๐ŸŽ‰`,emojis:`๐ŸŽ‰ ๐ŸŽŠ ๐ŸŽˆ ๐ŸŽ ๐ŸŽ‚ ๐Ÿฐ ๐Ÿฅ‚ ๐Ÿพ ๐Ÿป ๐Ÿบ ๐Ÿท ๐Ÿ† ๐Ÿฅ‡ ๐Ÿฅˆ ๐Ÿฅ‰ ๐Ÿ… ๐ŸŽฏ ๐ŸŽฎ โšฝ ๐Ÿ€ ๐ŸŽพ ๐Ÿšด ๐Ÿƒ ๐ŸŽต ๐ŸŽถ ๐Ÿ“ธ ๐ŸŽฌ`},{label:`Work`,icon:`๐Ÿ’ผ`,emojis:`๐Ÿ’ผ ๐Ÿ“ž โ˜Ž๏ธ ๐Ÿ“ฑ ๐Ÿ’ป ๐Ÿ–ฅ๏ธ โŒจ๏ธ ๐Ÿ–จ๏ธ ๐Ÿ“ง ๐Ÿ“จ ๐Ÿ“ฉ ๐Ÿ“… ๐Ÿ“† ๐Ÿ—“๏ธ ๐Ÿ“Œ ๐Ÿ“ ๐Ÿ“Ž โœ‚๏ธ ๐Ÿ“ โœ๏ธ ๐Ÿ“ ๐Ÿ“‚ ๐Ÿ—‚๏ธ ๐Ÿ“Š ๐Ÿ“ˆ ๐Ÿ“‰ ๐Ÿ”’ ๐Ÿ”“ ๐Ÿ”‘ ๐Ÿ”ง ๐Ÿ› ๏ธ โš™๏ธ ๐Ÿ’ก ๐Ÿ”‹ โฐ โณ โŒ› ๐Ÿงพ ๐Ÿ’ถ ๐Ÿ’ฐ`},{label:`Food and places`,icon:`โ˜•`,emojis:`โ˜• ๐Ÿต ๐Ÿฅค ๐Ÿ• ๐Ÿ” ๐ŸŸ ๐ŸŒญ ๐Ÿฅช ๐ŸŒฎ ๐Ÿ ๐Ÿฃ ๐Ÿฉ ๐Ÿช ๐Ÿซ ๐ŸŽ ๐ŸŒ ๐Ÿ“ ๐Ÿฅ ๐Ÿš— ๐Ÿš• ๐ŸšŒ ๐Ÿš† โœˆ๏ธ ๐Ÿš€ ๐Ÿ  ๐Ÿข ๐Ÿ–๏ธ ๐ŸŒ โ˜€๏ธ ๐ŸŒค๏ธ ๐ŸŒง๏ธ โ›ˆ๏ธ โ„๏ธ โšก ๐ŸŒˆ ๐ŸŒ™`}],hr=[`๐Ÿ‘`,`โค๏ธ`,`๐Ÿ˜‚`,`๐Ÿ˜ฎ`,`๐Ÿ˜ข`,`๐Ÿ™`];function gr({onPick:e,onClose:t,className:n=``}){let[r,i]=(0,g.useState)(0),a=(0,g.useRef)(null);return(0,g.useEffect)(()=>{let e=e=>a.current&&!a.current.contains(e.target)&&t(),n=e=>{e.key===`Escape`&&(e.stopPropagation(),t())};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`keydown`,n,!0),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,n,!0)}},[t]),(0,I.jsxs)(`div`,{ref:a,role:`dialog`,"aria-label":`Emoji`,className:`ci-z-30 ci-w-[21rem] ci-max-w-full ci-rounded-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-2xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ci-select-none ${n}`,children:[(0,I.jsx)(`div`,{className:`ci-flex ci-gap-1 ci-px-2 ci-pt-2 ci-border-b ci-border-gray-300 dark:ci-border-gray-700`,children:mr.map((e,t)=>(0,I.jsx)(`button`,{type:`button`,title:e.label,"aria-label":e.label,onClick:()=>i(t),style:{fontSize:20,lineHeight:`28px`},className:`ci-flex-1 ci-pb-1.5 ci-border-0 ci-bg-transparent ci-border-b-2 ci-border-solid ${t===r?`ci-border-iconSecondary dark:ci-border-iconSecondaryDark`:`ci-border-transparent ci-opacity-60 hover:ci-opacity-100`}`,children:e.icon},e.label))}),(0,I.jsx)(`div`,{className:`ci-grid ci-grid-cols-7 ci-gap-1 ci-p-2 ci-h-64 ci-overflow-y-auto`,children:mr[r].emojis.split(` `).map(t=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>e(t),style:{fontSize:26,lineHeight:`36px`},className:`ci-h-10 ci-w-10 ci-flex ci-items-center ci-justify-center ci-rounded-lg ci-border-0 ci-bg-transparent hover:ci-bg-gray-200 dark:hover:ci-bg-gray-800`,children:t},t))})]})}var _r=e=>/\.(png|jpe?g|gif|webp|avif|svg)(\?|$)/i.test(e),vr=e=>/\.(webm|ogg|oga|opus|mp3|m4a|wav)(\?|$)/i.test(e),yr=e=>{let t=e.split(`/`).pop()||`file`;try{return decodeURIComponent(t)}catch{return t}},br=e=>{try{return new URL(e).protocol===`https:`}catch{return!1}},xr=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),Sr=e=>new Date(e).toLocaleDateString([],{weekday:`short`,day:`numeric`,month:`short`}),Cr=(e,t)=>new Date(e).toDateString()===new Date(t).toDateString(),wr=e=>{if(!e.startsWith(`{"`))return null;try{let t=JSON.parse(e);return!Array.isArray(t.attachments)||!t.attachments.length?null:{text:typeof t.body==`string`&&t.body?t.body:void 0,count:t.attachments.length}}catch{return null}},Tr=(0,g.memo)(function({url:e}){return br(e)?_r(e)?(0,I.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:(0,I.jsx)(`img`,{src:e,alt:yr(e),className:`ci-max-w-full ci-max-h-60 ci-rounded-2xl ci-block`})}):vr(e)?(0,I.jsx)(`audio`,{controls:!0,src:e,className:`ci-max-w-full`}):(0,I.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`ci-underline ci-break-all ci-flex ci-items-center ci-gap-1`,children:[(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,I.jsx)(`path`,{d:`M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`})}),yr(e)]}):(0,I.jsx)(`span`,{className:`ci-break-all`,children:e})}),Er=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*|__[^_\n]+__)|(~~[^~\n]+~~)|(\*[^*\s][^*\n]*\*|_[^_\s][^_\n]*_)|\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<]+)/g;function Dr({text:e}){let t=[],n=0;for(let r of e.matchAll(Er)){let i=r[0],a=r.index??0;a>n&&t.push(pr(e.slice(n,a))),r[1]?t.push((0,I.jsx)(`code`,{className:`ci-px-1 ci-py-0.5 ci-rounded ci-bg-black/10 dark:ci-bg-white/10 ci-font-mono ci-text-[0.85em]`,children:i.slice(1,-1)},a)):r[2]?t.push((0,I.jsx)(`strong`,{children:i.slice(2,-2)},a)):r[3]?t.push((0,I.jsx)(`s`,{children:i.slice(2,-2)},a)):r[4]?t.push((0,I.jsx)(`em`,{children:i.slice(1,-1)},a)):r[5]?t.push((0,I.jsx)(`a`,{href:r[6],target:`_blank`,rel:`noreferrer`,className:`ci-underline`,children:r[5]},a)):t.push((0,I.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`ci-underline ci-break-all`,children:i},a)),n=a+i.length}return n<e.length&&t.push(pr(e.slice(n))),(0,I.jsx)(I.Fragment,{children:t})}var Or=(0,g.memo)(function({text:e}){let t=e.split(/```[^\n]*\n?([\s\S]*?)```/g);return(0,I.jsx)(`span`,{className:`ci-whitespace-pre-wrap ci-break-words`,children:t.map((e,t)=>t%2?(0,I.jsx)(`pre`,{className:`ci-my-1 ci-p-2 ci-rounded-xl ci-bg-black/10 dark:ci-bg-white/10 ci-font-mono ci-text-xs ci-overflow-x-auto ci-whitespace-pre`,children:e.replace(/\n$/,``)},t):(0,I.jsx)(Dr,{text:e.replace(/^(\s*)[-*] (?=\S)/gm,`$1โ€ข `)},t))})});function kr({text:e,count:t}){return(0,I.jsxs)(`span`,{className:`ci-italic ci-opacity-80`,children:[e&&(0,I.jsx)(`span`,{className:`ci-not-italic ci-block`,children:e}),t>1?`${t} attachments`:`Attachment`,` from the mobile app, not available here`]})}function Ar({forMsg:e,me:t,onReact:n,nameOf:r,mine:i}){if(!e)return null;let a=new Map;for(let[t,n]of Object.entries(e))for(let e of n)a.set(e,[...a.get(e)??[],t]);return a.size?(0,I.jsx)(`div`,{className:`ci-flex ci-flex-wrap ci-gap-1 ci--mt-1.5 ci-relative ci-z-[1] ${i?`ci-justify-end ci-pr-2`:`ci-pl-2`}`,children:[...a.entries()].map(([e,i])=>{let a=i.includes(t);return(0,I.jsxs)(`button`,{type:`button`,title:i.map(e=>e===t?`You`:r(e)).join(`, `),"aria-label":`${e} ${i.length}${a?`, yours: press to remove`:``}`,onClick:()=>n(e),className:`ci-flex ci-items-center ci-gap-0.5 ci-h-6 ci-px-1.5 ci-rounded-full ci-text-xs ci-border ci-border-solid ci-shadow-sm ${a?`ci-bg-emerald-50 ci-border-emerald-400 dark:ci-bg-emerald-950 dark:ci-border-emerald-600`:`ci-bg-gray-50 ci-border-gray-300 dark:ci-bg-gray-900 dark:ci-border-gray-700`} ci-text-gray-900 dark:ci-text-white`,children:[(0,I.jsx)(`span`,{style:{fontSize:16,lineHeight:`20px`},children:e}),i.length>1&&(0,I.jsx)(`span`,{children:i.length})]},e)})}):null}function jr({messages:e,typing:t,onLoadOlder:n,hasOlder:r,group:i,reactions:a,me:o=``,onReact:s}){let c=P(e=>e.contacts),l=(0,g.useRef)(null),u=(0,g.useRef)(!0),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(null),h=e=>c[e]?.name??e;(0,g.useEffect)(()=>{let e=l.current;e&&u.current&&(e.scrollTop=e.scrollHeight)},[e.length,t,a]),(0,g.useEffect)(()=>{if(!d)return;let e=()=>f(null),t=window.setTimeout(()=>document.addEventListener(`click`,e,{once:!0}),0);return()=>{window.clearTimeout(t),document.removeEventListener(`click`,e)}},[d]);let _=()=>{let e=l.current;e&&(u.current=e.scrollHeight-e.scrollTop-e.clientHeight<40,e.scrollTop<30&&r&&n())},v=(e,t)=>{f(null),m(null),s?.(e,t)};return(0,I.jsxs)(`div`,{className:`ci-relative ci-flex-1 ci-min-h-0 ci-flex ci-flex-col`,children:[(0,I.jsxs)(`div`,{ref:l,onScroll:_,className:`ci-flex-1 ci-overflow-y-auto ci-px-4 ci-py-2 ci-space-y-1`,children:[r&&(0,I.jsx)(`div`,{className:`ci-text-center ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-py-1`,children:`Scroll up for older messages`}),e.map((t,n)=>{let r=e[n-1],l=!r||!Cr(r.ts,t.ts),u=r&&!l&&r.mine===t.mine&&r.nick===t.nick&&t.ts-r.ts<12e4,p=i&&!t.mine&&t.nick?h(t.nick):null,g=t.oid,_=!!s&&!!g&&!t.pending,y=_&&(0,I.jsx)(`button`,{type:`button`,title:`React`,"aria-label":`React to this message`,onClick:e=>{e.stopPropagation(),f(d===g?null:g)},className:`ci-self-center ci-h-7 ci-w-7 ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-transparent ci-text-gray-500 dark:ci-text-gray-400 hover:ci-bg-gray-200 dark:hover:ci-bg-gray-800 focus:ci-opacity-100 ${d===g?`ci-opacity-100`:`ci-opacity-0 group-hover:ci-opacity-100`}`,children:L.react});return(0,I.jsxs)(`div`,{children:[l&&(0,I.jsx)(`div`,{className:`ci-text-center ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-py-2`,children:Sr(t.ts)}),(0,I.jsxs)(`div`,{className:`ci-group ci-flex ci-items-start ci-gap-1.5 ${t.mine?`ci-justify-end`:`ci-justify-start`} ${u?`ci-mt-0.5`:`ci-mt-2`}`,children:[p&&(0,I.jsx)(`span`,{className:`ci-w-7 ci-shrink-0`,title:p,children:!u&&(0,I.jsx)(nr,{contact:c[t.nick],username:t.nick,size:28})}),t.mine&&y,(0,I.jsxs)(`div`,{className:`ci-relative ci-flex ci-flex-col ci-max-w-[80%] ${t.mine?`ci-items-end`:`ci-items-start`}`,children:[d===g&&g&&(0,I.jsxs)(`div`,{role:`menu`,onClick:e=>e.stopPropagation(),className:`ci-absolute ci-bottom-full ci-mb-1 ci-z-20 ci-flex ci-items-center ci-gap-0.5 ci-p-1 ci-rounded-full ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ${t.mine?`ci-right-0`:`ci-left-0`}`,children:[hr.map(e=>(0,I.jsx)(`button`,{type:`button`,role:`menuitem`,"aria-label":e,onClick:()=>v(g,e),style:{fontSize:22,lineHeight:`32px`},className:`ci-h-9 ci-w-9 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 hover:ci-scale-125 ci-transition-transform ${a?.[g]?.[o]?.includes(e)?`ci-bg-gray-200 dark:ci-bg-gray-800`:`ci-bg-transparent`}`,children:e},e)),(0,I.jsx)(`button`,{type:`button`,role:`menuitem`,title:`More emojis`,"aria-label":`More emojis`,onClick:()=>{f(null),m(g)},className:`ci-h-8 ci-w-8 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-gray-200 dark:ci-bg-gray-800 ci-text-gray-700 dark:ci-text-gray-200 ci-text-lg`,children:`+`})]}),(0,I.jsxs)(`div`,{title:xr(t.ts),onDoubleClick:()=>_&&v(g,hr[0]),className:`ci-px-3.5 ci-py-2 ci-rounded-3xl ci-text-sm ci-select-text ci-cursor-text ${t.mine?`ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900 ci-rounded-br-lg`:`ci-bg-elevationL2 ci-text-gray-900 dark:ci-bg-elevationL2Dark dark:ci-text-white ci-rounded-bl-lg`} ${t.pending?`ci-opacity-60`:``}`,children:[t.oob?(0,I.jsx)(Tr,{url:t.oob}):wr(t.body)?(0,I.jsx)(kr,{...wr(t.body)}):(0,I.jsx)(Or,{text:t.body}),t.oob&&t.body&&t.body!==t.oob&&t.body!==yr(t.oob)&&(0,I.jsx)(`div`,{className:`ci-text-xs ci-opacity-80 ci-mt-1`,children:t.body}),(0,I.jsx)(`span`,{className:`ci-block ci-text-right ci-text-[10px] ci-leading-none ci-opacity-60 ci-mt-1`,children:xr(t.ts)})]}),g&&(0,I.jsx)(Ar,{forMsg:a?.[g],me:o,mine:t.mine,nameOf:h,onReact:e=>_&&v(g,e)})]}),!t.mine&&y]})]},t.id)}),t&&(0,I.jsx)(`div`,{className:`ci-flex ci-justify-start ci-mt-2`,children:(0,I.jsx)(`div`,{className:`ci-px-3.5 ci-py-2 ci-rounded-3xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-500 dark:ci-text-gray-400 ci-text-xs ci-italic`,children:`typingโ€ฆ`})})]}),p&&(0,I.jsx)(gr,{className:`ci-absolute ci-bottom-2 ci-left-1/2 ci--translate-x-1/2`,onPick:e=>v(p,e),onClose:()=>m(null)})]})}function Mr(e,t,n){let r=e[t];if(r===void 0)return null;let i=1;for(;i<=8&&!(r&128>>i-1);)i++;if(i>8||t+i>e.length)return null;let a=n?r:r&255>>i,o=a===255>>i;for(let n=1;n<i;n++)a=a*256+e[t+n],e[t+n]!==255&&(o=!1);return{value:a,len:i,unknown:!n&&o}}var Nr=new Set([408125543,524531317,374648427,174,225,160]);function Pr(e){let t={channels:1,packets:[]},n=0;for(;n<e.length;){let r=Mr(e,n,!0);if(!r)break;let i=Mr(e,n+r.len,!1);if(!i)break;let a=n+r.len+i.len;if(Nr.has(r.value)){n=a;continue}if(i.unknown)break;let o=Math.min(e.length,a+i.value);if(r.value===25506)t.head=e.slice(a,o);else if(r.value===159)t.channels=e[a]||1;else if(r.value===163||r.value===161){let n=Mr(e,a,!1);n&&(e[a+n.len+2]>>1&3||t.packets.push(e.slice(a+n.len+3,o)))}n=o}return t}function Fr(e){if(!e.length)return 0;let t=e[0],n=t>>3,r;r=n<12?[10,20,40,60][n%4]:n<16?[10,20][n%2]:[2.5,5,10,20][n%4];let i=t&3,a=i===0?1:i===3?(e[1]??0)&63:2;return Math.round(a*r*48)}var Ir=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t<<24;for(let e=0;e<8;e++)n=n&2147483648?n<<1^79764919:n<<1;e[t]=n>>>0}return e})();function Lr(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<8^Ir[(t>>>24^e[n])&255])>>>0;return t}function Rr(e,t,n,r,i){let a=[];for(let t of e){let e=t.length;for(;e>=255;)a.push(255),e-=255;a.push(e)}let o=e.reduce((e,t)=>e+t.length,0),s=new Uint8Array(27+a.length+o),c=new DataView(s.buffer);s.set([79,103,103,83],0),s[5]=i,c.setUint32(6,t%4294967296,!0),c.setUint32(10,Math.floor(t/4294967296),!0),c.setUint32(14,n,!0),c.setUint32(18,r,!0),s[26]=a.length,s.set(a,27);let l=27+a.length;for(let t of e)s.set(t,l),l+=t.length;return c.setUint32(22,Lr(s),!0),s}function zr(e){let t=new Uint8Array(19),n=new DataView(t.buffer);return t.set(new TextEncoder().encode(`OpusHead`),0),t[8]=1,t[9]=e,n.setUint16(10,312,!0),n.setUint32(12,48e3,!0),t}function Br(){let e=new TextEncoder().encode(`chat-island`),t=new Uint8Array(12+e.length+4);return t.set(new TextEncoder().encode(`OpusTags`),0),new DataView(t.buffer).setUint32(8,e.length,!0),t.set(e,12),t}function Vr(e){let{head:t,channels:n,packets:r}=Pr(e);if(!r.length)return null;let i=t&&t.length>=19&&new TextDecoder().decode(t.slice(0,8))===`OpusHead`,a=Math.random()*4294967295>>>0,o=[Rr([i?t:zr(n)],0,a,0,2),Rr([Br()],0,a,1,0)],s=0,c=2;for(let e=0;e<r.length;){let t=[],n=0;for(;e<r.length&&t.length<50;){let i=Math.floor(r[e].length/255)+1;if(n+i>255)break;t.push(r[e]),n+=i,s+=Fr(r[e]),e++}if(!t.length)return null;o.push(Rr(t,s,a,c++,e>=r.length?4:0))}let l=o.reduce((e,t)=>e+t.length,0),u=new Uint8Array(l),d=0;for(let e of o)u.set(e,d),d+=e.length;return u}var Hr=[`audio/ogg;codecs=opus`,`audio/webm;codecs=opus`,`audio/mp4`,`audio/webm`];async function Ur(e,t){let n=Date.now();if(/webm/.test(t)&&/opus/.test(t))try{let t=Vr(new Uint8Array(await new Blob(e).arrayBuffer()));if(t)return new File([t],`voice-${n}.ogg`,{type:`audio/ogg`})}catch{}return new File(e,`voice-${n}.${Wr(t)}`,{type:t.split(`;`)[0]})}var Wr=e=>/mp4/.test(e)?`m4a`:/ogg/.test(e)?`ogg`:`webm`,Gr=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e%6e4/1e3)).padStart(2,`0`)}`;function Kr({onSend:e,onTyping:t,onFile:n,disabled:r}){let[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),c=(0,g.useRef)(null),l=(0,g.useRef)(null),u=(0,g.useRef)(null),d=(0,g.useRef)(),f=(0,g.useRef)(!1),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)(0),v=(0,g.useRef)(!1),y=(0,g.useRef)(!1),b=(0,g.useRef)(!1),x=(0,g.useRef)({});(0,g.useEffect)(()=>u.current?.focus(),[]),(0,g.useEffect)(()=>()=>{b.current=!0,v.current=!0,window.clearTimeout(d.current);let{r:e,stream:t}=x.current;e&&e.state!==`inactive`&&e.stop(),t?.getTracks().forEach(e=>e.stop()),x.current={}},[]),(0,g.useEffect)(()=>{if(!p)return;let e=window.setInterval(()=>_(Date.now()-p.since),250);return()=>window.clearInterval(e)},[p]);let S=e=>{f.current!==e&&(f.current=e,t(e))},C=e=>{let t=e.includes(`:`)?pr(e):e;t!==e&&(c.current=Math.max(0,(u.current?.selectionStart??e.length)-(e.length-t.length))),a(t),t?(S(!0),window.clearTimeout(d.current),d.current=window.setTimeout(()=>S(!1),4e3)):S(!1)};(0,g.useLayoutEffect)(()=>{c.current!==null&&(u.current?.setSelectionRange(c.current,c.current),c.current=null)},[i]);let w=e=>{let t=u.current,n=t?.selectionStart??i.length,r=t?.selectionEnd??n;C(i.slice(0,n)+e+i.slice(r)),requestAnimationFrame(()=>{t?.focus(),t?.setSelectionRange(n+e.length,n+e.length)})},T=()=>{let t=i.trim();t&&(a(``),Promise.resolve(e(t)).catch(()=>a(e=>e||t)),window.clearTimeout(d.current),f.current=!1)},ee=async()=>{if(y.current||p)return;y.current=!0;let e;try{e=await navigator.mediaDevices.getUserMedia({audio:!0});let t=e;if(b.current){t.getTracks().forEach(e=>e.stop());return}let r=Hr.find(e=>MediaRecorder.isTypeSupported(e)),i=new MediaRecorder(e,r?{mimeType:r}:void 0),a=[];i.ondataavailable=e=>e.data.size&&a.push(e.data),i.onstop=()=>{t.getTracks().forEach(e=>e.stop()),x.current={},m(null),!v.current&&a.length&&Ur(a,i.mimeType||r||``).then(n)},v.current=!1,i.start(),x.current={r:i,stream:t},_(0),m({r:i,since:Date.now()})}catch{e?.getTracks().forEach(e=>e.stop())}finally{y.current=!1}},te=e=>{v.current=e,p?.r.stop()};return p?(0,I.jsxs)(`div`,{className:`ci-flex ci-items-center ci-gap-2 ci-px-3 ci-py-3`,children:[(0,I.jsx)(sr,{variant:`transparent`,title:`Discard`,"aria-label":`Discard`,onClick:()=>te(!0),className:`ci-h-10 ci-w-10`,children:L.close}),(0,I.jsxs)(`div`,{className:`ci-flex-1 ci-flex ci-items-center ci-gap-2 ci-px-4 ci-py-2.5 ci-rounded-3xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-sm`,children:[(0,I.jsx)(`span`,{className:`ci-w-2.5 ci-h-2.5 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-animate-pulse`}),(0,I.jsxs)(`span`,{children:[`Recording `,Gr(h)]})]}),(0,I.jsx)(sr,{variant:`green`,title:`Send voice note`,"aria-label":`Send voice note`,onClick:()=>te(!1),className:`ci-h-10 ci-w-10`,children:L.send})]}):(0,I.jsxs)(`div`,{className:`ci-relative ci-flex ci-items-center ci-gap-2 ci-px-3 ci-py-3`,children:[o&&(0,I.jsx)(gr,{className:`ci-absolute ci-bottom-full ci-left-3 ci-mb-1`,onPick:w,onClose:()=>s(!1)}),(0,I.jsx)(`input`,{ref:l,type:`file`,hidden:!0,onChange:e=>e.target.files?.[0]&&(n(e.target.files[0]),e.target.value=``)}),(0,I.jsx)(sr,{variant:`transparent`,disabled:r,title:`Attach a file`,onClick:()=>l.current?.click(),className:`ci-h-10 ci-w-10`,children:L.clip}),(0,I.jsxs)(`div`,{className:`ci-relative ci-flex-1 ci-min-w-0`,children:[(0,I.jsx)(`button`,{type:`button`,disabled:r,title:`Emoji`,"aria-label":`Emoji`,"aria-expanded":o,onClick:()=>s(e=>!e),className:`ci-absolute ci-left-2 ci-bottom-1 ci-z-10 ci-h-8 ci-w-8 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-transparent ci-text-secondaryNeutral dark:ci-text-secondaryNeutralDark hover:ci-bg-gray-300/70 dark:hover:ci-bg-gray-700/30 disabled:ci-opacity-40`,children:L.smile}),(0,I.jsx)(`textarea`,{ref:u,value:i,disabled:r,rows:1,placeholder:r?`Connectingโ€ฆ`:`Write a message`,onChange:e=>C(e.target.value),onKeyDown:e=>{let t=(i.match(/```/g)??[]).length%2==1;e.key===`Enter`&&!e.shiftKey&&!t&&(e.preventDefault(),T())},className:`ci-block ci-w-full ci-resize-none ci-max-h-32 ci-pl-11 ci-pr-4 ci-py-2.5 ci-rounded-3xl ci-border-0 ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400 ci-outline-none focus:ci-ring-2 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500 ci-text-sm`,style:{height:Math.min(128,40+20*(i.split(`
9
- `).length-1))}})]}),i.trim()?(0,I.jsx)(sr,{variant:`default`,disabled:r,onClick:T,title:`Send`,className:`ci-h-10 ci-w-10`,children:L.send}):(0,I.jsx)(sr,{variant:`default`,disabled:r||typeof MediaRecorder>`u`,onClick:ee,title:`Record a voice note`,"aria-label":`Record a voice note`,className:`ci-h-10 ci-w-10`,children:L.mic})]})}var qr=e=>!!e&&![`offline`,`dnd`,`busy`,`ringing`,`onhold`].includes(e);function Jr({peer:e,actions:t,onDragStart:n}){let{c:r,contacts:i,online:a,mobile:o,status:s,closeChat:c,openChat:l,markRead:u,order:d,me:f}=P(y(t=>({c:t.conversations[e],contacts:t.contacts,online:t.online,mobile:t.mobile,status:t.status,closeChat:t.closeChat,openChat:t.openChat,markRead:t.markRead,order:t.order,me:t.me}))),p=Math.max(0,d.indexOf(e)),m=i[e],[h,_]=(0,g.useState)(!1),v=e=>e===f?`You`:i[e]?.name??e,b=[...r?.members??[]].sort((e,t)=>Number(e===f)-Number(t===f));return(0,g.useEffect)(()=>{r&&!r.loaded&&t.loadOlder(e)},[e,r?.loaded]),(0,g.useEffect)(()=>{u(e)},[e,r?.messages.length]),(0,g.useEffect)(()=>_(!1),[e]),r?(0,I.jsxs)(`div`,{role:`dialog`,"aria-label":r.kind===`group`?r.name??e:m?.name??e,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),h?_(!1):c())},className:`ci-relative ci-w-[22rem] ci-h-[30rem] ci-flex ci-flex-col ci-rounded-3xl ci-shadow-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-text-gray-900 dark:ci-text-white`,children:[(0,I.jsx)(`span`,{className:`ci-absolute ci--right-1.5 ci-w-3 ci-h-3 ci-rotate-45 ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-2xl ci-transition-all ci-duration-200`,style:{bottom:`calc(1.875rem + ${p} * 3.75rem)`},"aria-hidden":`true`}),(0,I.jsxs)(`div`,{className:`ci-flex ci-items-center ci-gap-3 ci-px-4 ci-py-3 ci-rounded-t-3xl ${n?`ci-cursor-grab active:ci-cursor-grabbing ci-touch-none`:``}`,onPointerDown:n,children:[r.kind===`group`?(0,I.jsx)(ir,{name:r.name??e,size:36,avatar:r.avatar}):(0,I.jsxs)(`span`,{className:`ci-relative`,children:[(0,I.jsx)(nr,{contact:m,username:e,size:36}),(0,I.jsx)(rr,{online:a[e],presence:m?.presence,mobile:o[e]})]}),(0,I.jsxs)(`div`,{className:`ci-flex-1 ci-min-w-0 ${r.kind===`group`?`ci-cursor-pointer`:``}`,...r.kind===`group`?{role:`button`,tabIndex:0,"aria-expanded":h,onKeyDown:e=>(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(e=>!e))}:{},onClick:()=>r.kind===`group`&&_(e=>!e),children:[(0,I.jsx)(`div`,{className:`ci-font-medium ci-truncate ci-text-sm`,children:r.kind===`group`?r.name??e:m?.name??e}),(0,I.jsx)(`div`,{className:`ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-truncate`,children:s===`online`?r.kind===`group`?b.map(v).join(`, `):r.typing?`typingโ€ฆ`:a[e]?`online`:o[e]?`Mobile`:`offline`:s})]}),r.kind!==`group`&&m?.number&&qr(m.presence)&&(0,I.jsx)(sr,{variant:`call`,title:`Call ${m.number}`,"aria-label":`Call`,onClick:()=>F(`chat-island-call`,{username:e,number:m.number}),children:L.phone}),(0,I.jsx)(sr,{variant:`small`,onClick:()=>c(),"aria-label":`Close`,children:L.close})]}),(0,I.jsx)(`div`,{className:`ci-border-t ci-border-gray-300 dark:ci-border-gray-700`}),h&&r.kind===`group`&&(0,I.jsx)(`div`,{className:`ci-absolute ci-left-3 ci-right-3 ci-top-16 ci-z-10 ci-max-h-64 ci-overflow-y-auto ci-rounded-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-2xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ci-p-2`,children:b.map(e=>(0,I.jsxs)(`div`,{className:`ci-flex ci-items-center ci-gap-3 ci-px-2 ci-py-1.5 ci-text-sm`,children:[(0,I.jsxs)(`span`,{className:`ci-relative`,children:[(0,I.jsx)(nr,{contact:i[e],username:e,size:28}),e!==f&&(0,I.jsx)(rr,{online:a[e],presence:i[e]?.presence,mobile:o[e]})]}),(0,I.jsx)(`span`,{className:`ci-truncate ci-flex-1`,children:v(e)}),e!==f&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(sr,{variant:`small`,title:`Chat`,"aria-label":`Chat`,onClick:()=>l(e),children:L.chat}),i[e]?.number&&qr(i[e]?.presence)&&(0,I.jsx)(sr,{variant:`call`,title:`Call ${i[e]?.number}`,"aria-label":`Call`,onClick:()=>F(`chat-island-call`,{username:e,number:i[e].number}),children:L.phone})]})]},e))}),(0,I.jsxs)(`div`,{className:`ci-flex-1 ci-min-h-0 ci-flex ci-flex-col ci-overflow-hidden ci-rounded-b-3xl`,children:[(0,I.jsx)(jr,{messages:r.messages,typing:r.typing,group:r.kind===`group`,hasOlder:r.loaded&&!r.complete,onLoadOlder:()=>t.loadOlder(e),reactions:r.reactions,me:f,onReact:(n,r)=>t.react(e,n,r)}),(0,I.jsx)(Kr,{disabled:s!==`online`,onSend:n=>t.send(e,n),onTyping:n=>t.typing(e,n),onFile:n=>t.upload(e,n)},e)]})]}):null}async function Yr(e){let t=await createImageBitmap(e),n=Math.min(t.width,t.height),r=document.createElement(`canvas`);return r.width=r.height=128,r.getContext(`2d`)?.drawImage(t,(t.width-n)/2,(t.height-n)/2,n,n,0,0,128,128),r.toDataURL(`image/jpeg`,.8)}function Xr({onOpen:e,onCreateGroup:t}){let{contacts:n,online:r,mobile:i,setPicker:a}=P(),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)([]),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(!1),[m,h]=(0,g.useState)(),_=(0,g.useRef)(null),v=(0,g.useMemo)(()=>{let e=Object.values(n),t=o.trim().toLowerCase();return t?e.filter(e=>(e.name??``).toLowerCase().includes(t)||e.username.includes(t)):e},[n,o]),y=e=>l(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),b=async()=>{p(!0);try{await t(u.trim(),c,m)}finally{p(!1)}};return(0,I.jsxs)(`div`,{className:`ci-w-[22rem] ci-max-h-[30rem] ci-flex ci-flex-col ci-rounded-3xl ci-shadow-2xl ci-overflow-hidden ci-bg-gray-50 dark:ci-bg-gray-950 ci-text-gray-900 dark:ci-text-white`,children:[(0,I.jsxs)(`div`,{className:`ci-px-4 ci-py-3 ci-flex ci-items-center ci-gap-2`,children:[(0,I.jsxs)(`div`,{className:`ci-flex-1 ci-flex ci-items-center ci-gap-2 ci-px-4 ci-py-2 ci-rounded-3xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-500 dark:ci-text-gray-400`,children:[L.search,(0,I.jsx)(`input`,{autoFocus:!0,value:o,onChange:e=>s(e.target.value),placeholder:`Search colleagues`,className:`ci-flex-1 ci-bg-transparent ci-border-0 ci-outline-none ci-text-sm ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400`})]}),(0,I.jsx)(sr,{variant:`small`,onClick:()=>a(!1),"aria-label":`Close`,children:L.close})]}),c.length>0&&(0,I.jsx)(`div`,{className:`ci-px-4 ci-pb-2 ci-flex ci-flex-wrap ci-gap-1.5`,children:c.map(e=>(0,I.jsxs)(`button`,{type:`button`,onClick:()=>y(e),className:`ci-flex ci-items-center ci-gap-1 ci-pl-2.5 ci-pr-1.5 ci-py-1 ci-rounded-full ci-text-xs ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900 ci-border-0`,children:[n[e]?.name??e,L.close]},e))}),(0,I.jsx)(`div`,{className:`ci-border-t ci-border-gray-300 dark:ci-border-gray-700`}),(0,I.jsxs)(`ul`,{className:`ci-overflow-y-auto ci-py-1 ci-m-0 ci-p-0 ci-list-none ci-flex-1`,children:[v.length===0&&(0,I.jsx)(`li`,{className:`ci-px-4 ci-py-6 ci-text-center ci-text-sm ci-text-gray-500 dark:ci-text-gray-400`,children:`No colleagues found`}),v.map(e=>{let t=c.includes(e.username);return(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>y(e.username),className:`ci-w-full ci-flex ci-items-center ci-gap-3 ci-px-4 ci-py-2 ci-bg-transparent ci-border-0 ci-text-left hover:ci-bg-gray-300/70 dark:hover:ci-bg-gray-700/30 ci-text-inherit`,children:[(0,I.jsxs)(`span`,{className:`ci-relative`,children:[(0,I.jsx)(nr,{contact:e,username:e.username,size:36}),(0,I.jsx)(rr,{online:r[e.username],presence:e.presence,mobile:i[e.username]})]}),(0,I.jsxs)(`span`,{className:`ci-flex ci-flex-col ci-min-w-0 ci-flex-1`,children:[(0,I.jsx)(`span`,{className:`ci-text-sm ci-font-medium ci-truncate`,children:e.name}),(0,I.jsx)(`span`,{className:`ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-truncate`,children:e.username})]}),(0,I.jsx)(`span`,{className:`ci-w-5 ci-h-5 ci-rounded-full ci-border ci-flex ci-items-center ci-justify-center ${t?`ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark ci-border-transparent ci-text-white dark:ci-text-gray-950`:`ci-border-gray-400 dark:ci-border-gray-600`}`,children:t&&(0,I.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M20 6L9 17l-5-5`})})})]})},e.username)})]}),c.length>0&&(0,I.jsx)(`div`,{className:`ci-border-t ci-border-gray-300 dark:ci-border-gray-700 ci-px-4 ci-py-3 ci-flex ci-items-center ci-gap-2`,children:c.length===1?(0,I.jsx)(sr,{variant:`default`,className:`ci-w-auto ci-h-10 ci-px-5`,onClick:()=>e(c[0]),children:`Open chat`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`input`,{ref:_,type:`file`,accept:`image/*`,hidden:!0,onChange:e=>e.target.files?.[0]&&Yr(e.target.files[0]).then(h).catch(()=>{})}),(0,I.jsx)(`button`,{type:`button`,title:`Group picture`,onClick:()=>_.current?.click(),className:`ci-w-10 ci-h-10 ci-shrink-0 ci-rounded-full ci-border-0 ci-p-0 ci-overflow-hidden ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-500 dark:ci-text-gray-400 ci-flex ci-items-center ci-justify-center`,children:m?(0,I.jsx)(`img`,{src:m,alt:``,draggable:!1,className:`ci-w-full ci-h-full ci-object-cover`}):L.camera}),(0,I.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`Group name`,onKeyDown:e=>e.key===`Enter`&&u.trim()&&!f&&b(),className:`ci-flex-1 ci-min-w-0 ci-w-0 ci-px-4 ci-py-2 ci-rounded-3xl ci-border-0 ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-sm ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400 ci-outline-none focus:ci-ring-2 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500`}),(0,I.jsx)(sr,{variant:`green`,className:`ci-w-auto ci-h-10 ci-px-4 ci-shrink-0 ci-whitespace-nowrap`,disabled:!u.trim()||f,onClick:b,children:f?`โ€ฆ`:`Create group`})]})})]})}var Zr=`chat-island-theme`,Qr=()=>{try{let e=localStorage.getItem(Zr);return e===`light`||e===`dark`||e===`system`?e:void 0}catch{return}};function $r(e){let[t,n]=(0,g.useState)(()=>e??Qr()),[r,i]=(0,g.useState)(!1);return(0,g.useEffect)(()=>n(e??Qr()),[e]),(0,g.useEffect)(()=>{let e=e=>{let t=e.detail?.theme;if(t===`light`||t===`dark`||t===`system`){try{localStorage.setItem(Zr,t)}catch{}n(t)}};return window.addEventListener(`chat-island-theme-change`,e),()=>window.removeEventListener(`chat-island-theme-change`,e)},[]),(0,g.useEffect)(()=>{if(t===`light`||t===`dark`){i(t===`dark`);return}if(t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>i(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}let e=document.documentElement,n=()=>i(e.classList.contains(`dark`));n();let r=new MutationObserver(n);return r.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>r.disconnect()},[t]),r}function ei(){let e=P.getState();return Object.values(e.conversations).map(t=>{let n=t.messages[t.messages.length-1],r=e.contacts[t.peer];return{peer:t.peer,kind:t.kind,name:t.kind===`group`?t.name??t.peer.split(`@`)[0]:r?.name??t.peer,avatar:t.kind===`group`?t.avatar:r?.avatar,online:t.kind!==`group`&&!!e.online[t.peer],mobile:t.kind!==`group`&&!!e.mobile[t.peer],owner:t.kind===`group`?!!t.owner:void 0,unread:t.unread,members:t.members,last:n?{body:ri(n.body),ts:n.ts,mine:n.mine,oob:n.oob,nick:n.nick}:void 0}}).filter(e=>e.last||e.kind===`group`).sort((e,t)=>(t.last?.ts??0)-(e.last?.ts??0))}var ti=class extends g.Component{state={failed:!1};failures=[];static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){F(`chat-island-error`,{scope:`render`,message:e.message});let t=Date.now();this.failures=[...this.failures.filter(e=>t-e<1e4),t],!(this.failures.length>=3)&&(P.getState().closeChat(),window.setTimeout(()=>this.setState({failed:!1}),0))}render(){return this.state.failed?null:this.props.children}};function ni(e){try{let[t,n,r]=atob(e).split(`:`);return t&&n&&r?{host:t,username:n,token:r}:null}catch{return null}}var ri=e=>(wr(e)?`Attachment`:pr(e)).replace(/```[^\n]*\n?/g,``).replace(/(\*\*|__|~~|`)/g,``).replace(/(^|\s)[*_](\S[^*_]*)[*_]/g,`$1$2`).replace(/\s+/g,` `).trim();function ii({dataConfig:e,position:t=`bottom-right`,theme:n,serviceWorker:r,maxHeads:i=5,newChatButton:a=!0,notifications:o=`click`,sound:s=!0,drag:c=!0,onDragStart:l}){let u=(0,g.useMemo)(()=>ni(e),[e]),d=$r(n),f=(0,g.useRef)(u),p=(0,g.useRef)(s),m=(0,g.useRef)(o);(0,g.useEffect)(()=>{f.current=u,p.current=s,m.current=o},[u,s,o]),(0,g.useEffect)(()=>P.setState({maxHeads:i,newChatButton:a}),[i,a]);let[h,_]=(0,g.useState)(0);(0,g.useEffect)(()=>{let e=e=>e.persisted&&_(e=>e+1);return window.addEventListener(`pageshow`,e),()=>window.removeEventListener(`pageshow`,e)},[]);let v=(0,g.useRef)(null),b=(0,g.useRef)(new Set),S=(0,g.useRef)(!1),C=(0,g.useRef)(null),w=(0,g.useRef)(null),T=x(w,`chat-island-pos:${u?.host??``}:${u?.username??``}`),{open:ee,picker:te,status:ne}=P(y(e=>({open:e.open,picker:e.picker,status:e.status}))),re=(0,g.useMemo)(()=>({send:async(e,t)=>{let n=v.current;if(!n)throw Error(`not connected`);try{P.getState().addMessage(e,await n.send(e,pr(t)))}catch(e){throw F(`chat-island-error`,{scope:`send`,message:e.message}),e}},typing:(e,t)=>P.getState().online[e]&&v.current?.typing(e,t).catch(()=>{}),upload:async(e,t)=>{let n=v.current;if(n)try{let r=await n.upload(t);P.getState().addMessage(e,await n.send(e,t.name,r))}catch(e){F(`chat-island-error`,{scope:`upload`,message:e.message})}},createGroup:async(e,t,n)=>{let r=v.current,i=f.current;if(r&&i)try{let a=await r.createGroup(e,t,n),o=P.getState();o.setGroup(a,e,[...t,i.username],n),o.openChat(a)}catch(e){F(`chat-island-error`,{scope:`group`,message:e.message})}},remove:async e=>{let t=v.current,n=f.current;if(!t||!n)return;let r=P.getState().conversations[e];try{r?.kind===`group`&&await t.leaveGroup(e,!!r.owner).catch(()=>{}),await Jn(n.host,n.token,e),P.getState().removeConversation(e)}catch(e){F(`chat-island-error`,{scope:`delete`,message:e.message})}},react:async(e,t,n)=>{let r=v.current,i=f.current?.username;if(!r||!i)return;let a=(P.getState().conversations[e]?.reactions?.[t]?.[i]??[]).includes(n)?[]:[n];try{await r.react(e,t,a),P.getState().applyReactions([{peer:e,target:t,user:i,emojis:a}])}catch(e){F(`chat-island-error`,{scope:`reaction`,message:e.message})}},loadOlder:async e=>{let t=v.current,n=P.getState().ensure(e);if(!(!t||n.complete||b.current.has(e))){b.current.add(e);try{let r=await t.history(e,n.oldest);P.getState().prependHistory(e,r.messages,r.complete,r.first),P.getState().applyReactions(r.reactions)}catch(e){F(`chat-island-error`,{scope:`history`,message:e.message})}finally{b.current.delete(e)}}}}),[]);(0,g.useEffect)(()=>{if(!u)return;let e=P.getState();e.reset(),P.setState({me:u.username,mucHost:`conference.${u.host}`,maxHeads:i,newChatButton:a});let t=new Cn(u,{status:(n,i)=>{if(e.setStatus(n,i),F(`chat-island-status`,{status:n,error:i}),n===`online`&&r&&!S.current&&typeof Notification<`u`){let e=Notification.permission;(e===`granted`||m.current===`auto`&&e==="default")&&o()}n===`online`&&t.listGroups().then(t=>t.forEach(t=>e.setGroup(t.peer,t.name,t.members,t.avatar,t.owner))).catch(()=>{}).then(()=>t.recent()).then(e=>{e&&(P.getState().seed(e.messages,u.username),P.getState().applyReactions(e.reactions))}).catch(()=>{})},typing:(t,n)=>e.setTyping(t,n),reaction:t=>e.applyReactions([t]),presence:(t,n)=>e.setOnline(t,n),groupInvite:n=>{t.subscribed(n).then(async r=>{if(!r)return;let i=await t.groupInfo(n);e.setGroup(i.peer,i.name,i.members,i.avatar,i.owner)}).catch(()=>{})},message:r=>{let i=Hn(r);r.room&&!P.getState().conversations[r.room]?.name&&t.groupInfo(r.room).then(t=>e.setGroup(t.peer,t.name,t.members,t.avatar,t.owner)).catch(()=>{}),e.addMessage(i,r,{live:!0}),F(`chat-island-message`,{...r,peer:i}),F(`chat-island-unread`,{total:P.getState().totalUnread()}),r.mine||n(i,r)}}),n=(e,t)=>{let n=P.getState(),r=document.visibilityState===`visible`;if(r&&n.open===e)return;let i=n.conversations[e],a=i?.kind===`group`?i.name??e:n.contacts[e]?.name??e,o=t.oob?`Attachment`:pr(t.body),s=i?.kind===`group`,c=s&&t.nick?n.contacts[t.nick]?.name??t.nick:a,l=s&&t.nick?`${c}: ${o}`:o;p.current&&kn();let u=s?i?.avatar:n.contacts[e]?.avatar;if(F(`chat-island-notify`,{peer:e,name:a,body:l,kind:s?`group`:`chat`,author:c,text:o,attachment:!!t.oob,avatar:u,ts:t.ts}),!r&&typeof Notification<`u`&&Notification.permission===`granted`)try{let t=new Notification(a,{body:l,tag:`chat-${e}`});t.onclick=()=>{window.focus(),P.getState().openChat(e),t.close()}}catch{}};v.current=t;let o=()=>{r&&!S.current&&(S.current=!0,Qn(u,r).then(e=>{if(!e){S.current=!1,P.setState({push:Notification.permission===`denied`?`denied`:`ask`});return}return t.enablePush(e.service,e.node).then(()=>{C.current=e,P.setState({push:`enabled`}),F(`chat-island-push`,{enabled:!0})})}).catch(e=>{S.current=!1,F(`chat-island-error`,{scope:`push`,message:e.message})}))},s=!!r&&`serviceWorker`in navigator&&`PushManager`in window&&typeof Notification<`u`;P.setState({push:s?Notification.permission===`denied`?`denied`:`ask`:`unavailable`,enablePush:o});let c=()=>t.stop();window.addEventListener(`pagehide`,c),t.start();let l=()=>qn(u.host,u.token).then(e.setMobile).catch(()=>{});l();let d=window.setInterval(l,12e4);Kn(u.host,u.token,u.username).then(e.setContacts).catch(e=>F(`chat-island-error`,{scope:`contacts`,message:e.message}));let f=$n(`chat-island-open`,({username:t})=>t&&e.openChat(t)),h=$n(`chat-island-close`,()=>e.closeChat()),g=$n(`chat-island-new`,()=>e.setPicker(!0)),_=$n(`chat-island-delete`,({username:e})=>e&&re.remove(e)),y=$n(`chat-island-contacts`,({contacts:t})=>t&&e.setContacts(t)),b=$n(`chat-island-conversations-request`,()=>F(`chat-island-conversations`,{conversations:ei()}));return()=>{window.removeEventListener(`pagehide`,c),window.clearInterval(d),b(),g(),_(),f(),h(),y(),C.current&&t.disablePush(C.current.service,C.current.node).catch(()=>{}),C.current=null,t.stop(),v.current=null,S.current=!1}},[u,r,h]);let ie=P(e=>Object.keys(e.contacts).join(`,`));(0,g.useEffect)(()=>{ne===`online`&&ie&&v.current?.announce(ie.split(`,`))},[ne,ie]);let ae=P(e=>Object.values(e.conversations).map(e=>`${e.peer}:${e.kind}:${e.name??``}:${(e.members??[]).length}:${e.unread}:${e.messages[e.messages.length-1]?.id??``}`).join(`|`)+`#`+Object.keys(e.contacts).length+`#`+Object.values(e.online).filter(Boolean).length);(0,g.useEffect)(()=>F(`chat-island-conversations`,{conversations:ei()}),[ae]);let oe=P(e=>Object.values(e.conversations).reduce((e,t)=>e+t.unread,0));if((0,g.useEffect)(()=>F(`chat-island-unread`,{total:oe}),[oe]),!u)return null;let se=c&&!l&&T.anchor?{right:T.anchor.right,bottom:T.anchor.bottom}:void 0,E=se?``:t===`bottom-left`?`ci-left-4 ci-bottom-5`:`ci-right-4 ci-bottom-5`;return(0,I.jsx)(`div`,{ref:w,style:se,onClickCapture:T.onClickCapture,className:`chat-island-root ${d?`ci-dark`:``} ci-fixed ${E} ci-z-[9999] ci-flex ci-items-end ci-gap-3 ci-font-sans ci-select-none`,"data-status":ne,children:(0,I.jsxs)(ti,{children:[ee&&(0,I.jsx)(Jr,{peer:ee,actions:re,onDragStart:l??(c?T.start:void 0)}),te&&(0,I.jsx)(Xr,{onOpen:e=>P.getState().openChat(e),onCreateGroup:re.createGroup}),(0,I.jsx)(cr,{onDragStart:l??(c?T.start:void 0),pushButton:o!==`auto`})]})})}document.querySelectorAll(`.chat-island`).forEach(e=>{(0,h.createRoot)(e).render((0,I.jsx)(g.StrictMode,{children:(0,I.jsx)(ii,{dataConfig:e.dataset.config??``,position:e.dataset.position===`bottom-left`?`bottom-left`:`bottom-right`,theme:e.dataset.theme,serviceWorker:e.dataset.serviceWorker})}))})})();
8
+ `+e.stack}return{value:e,source:t,stack:i,digest:null}}function ks(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function As(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var js=typeof WeakMap==`function`?WeakMap:Map;function Ms(e,t,n){n=so(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rl||(rl=!0,il=r),As(e,t)},n}function Ns(e,t,n){n=so(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){As(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){As(e,t),typeof r!=`function`&&(al===null?al=new Set([this]):al.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function Ps(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new js;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zl.bind(null,e,t,n),t.then(e,e))}function Fs(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null||t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Is(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=so(-1,1),t.tag=2,co(n,t,1))),n.lanes|=1),e)}var Ls=C.ReactCurrentOwner,Rs=!1;function zs(e,t,n,r){t.child=e===null?Wa(t,null,n,r):Ua(t,e.child,n,r)}function Bs(e,t,n,r,i){n=n.render;var a=t.ref;return Qa(t,i),r=Fo(e,t,n,r,a,i),n=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(V&&n&&wa(t),t.flags|=1,zs(e,t,r,i),t.child)}function Vs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Hs(e,t,a,r,i)):(e=Xl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Pr:n,n(o,r)&&e.ref===t.ref)return oc(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Hs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Pr(a,r)&&e.ref===t.ref){if(Rs=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Rs=!0);else return t.lanes=e.lanes,oc(e,t,i)}}return Gs(e,t,n,r,i)}function Us(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`){if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},B(qc,Kc),Kc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,B(qc,Kc),Kc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,B(qc,Kc),Kc|=r}}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),B(qc,Kc),Kc|=r;return zs(e,t,i,n),t.child}function Ws(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Gs(e,t,n,r,i){var a=ta(n)?$i:Zi.current;return a=ea(t,a),Qa(t,i),n=Fo(e,t,n,r,a,i),r=Io(),e!==null&&!Rs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,oc(e,t,i)):(V&&r&&wa(t),t.flags|=1,zs(e,t,n,i),t.child)}function Ks(e,t,n,r,i){if(ta(n)){var a=!0;aa(t)}else a=!1;if(Qa(t,i),t.stateNode===null)ac(e,t),Ts(t,n,r),Ds(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=$a(l):(l=ta(n)?$i:Zi.current,l=ea(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Es(t,o,r,l),io=!1;var f=t.memoizedState;o.state=f,fo(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Qi.current||io?(typeof u==`function`&&(Ss(t,n,u,r),c=t.memoizedState),(s=io||ws(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,oo(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:xs(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=$a(c):(c=ta(n)?$i:Zi.current,c=ea(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Es(t,o,r,c),io=!1,f=t.memoizedState,o.state=f,fo(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Qi.current||io?(typeof p==`function`&&(Ss(t,n,p,r),m=t.memoizedState),(l=io||ws(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return qs(e,t,n,r,a,i)}function qs(e,t,n,r,i,a){Ws(e,t);var o=!!(t.flags&128);if(!r&&!o)return i&&oa(t,n,!1),oc(e,t,a);r=t.stateNode,Ls.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ua(t,e.child,null,a),t.child=Ua(t,null,s,a)):zs(e,t,s,a),t.memoizedState=r.state,i&&oa(t,n,!0),t.child}function Js(e){var t=e.stateNode;t.pendingContext?ra(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ra(e,t.context,!1),yo(e,t.containerInfo)}function Ys(e,t,n,r,i){return Ia(),La(i),t.flags|=256,zs(e,t,n,r),t.child}var Xs={dehydrated:null,treeContext:null,retryLane:0};function Zs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Qs(e,t,n){var r=t.pendingProps,i=H.current,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(i&2)),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),B(H,i&1),e===null)return Ma(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.lanes=t.mode&1?e.data===`$!`?8:1073741824:1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Ql(o,r,0,null),e=Zl(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=Zs(n),t.memoizedState=Xs,e):$s(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return tc(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Yl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Zl(a,o,n,null),a.flags|=2):a=Yl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?Zs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Xs,r}return a=e.child,e=a.sibling,r=Yl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function $s(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function ec(e,t,n,r){return r!==null&&La(r),Ua(t,e.child,null,n),e=$s(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function tc(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=ks(Error(r(422))),ec(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=Ql({mode:`visible`,children:i.children},a,0,null),o=Zl(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&Ua(t,e.child,null,s),t.child.memoizedState=Zs(s),t.memoizedState=Xs,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return ec(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=ks(o,i,void 0),ec(e,t,s,i)}if(c=(s&e.childLanes)!==0,Rs||c){if(i=Y,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,ro(e,a),hl(i,e,a,-1))}return kl(),i=ks(Error(r(421))),ec(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Vl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,Da=Pi(a.nextSibling),Ea=t,V=!0,Oa=null,e!==null&&(_a[va++]=ba,_a[va++]=xa,_a[va++]=ya,ba=e.id,xa=e.overflow,ya=t),t=$s(t,i.children),t.flags|=4096,t)}function nc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Za(e.return,t,n)}function rc(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function ic(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(zs(e,t,r.children,n),r=H.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&nc(e,n,t);else if(e.tag===19)nc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(B(H,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Co(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),rc(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Co(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}rc(t,!0,n,null,a);break;case`together`:rc(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ac(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function oc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Yc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function sc(e,t,n){switch(t.tag){case 3:Js(t),Ia();break;case 5:xo(t);break;case 1:ta(t.type)&&aa(t);break;case 4:yo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;B(Ga,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(B(H,H.current&1),e=oc(e,t,n),e===null?null:e.sibling):Qs(e,t,n):(B(H,H.current&1),t.flags|=128,null);B(H,H.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ic(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),B(H,H.current),r)break;return null;case 22:case 23:return t.lanes=0,Us(e,t,n)}return oc(e,t,n)}var cc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},lc=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,vo(ho.current);var o=null;switch(n){case`input`:i=Ce(e,i),r=Ce(e,r),o=[];break;case`select`:i=D({},i,{value:void 0}),r=D({},r,{value:void 0}),o=[];break;case`textarea`:i=je(e,i),r=je(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=wi)}Ge(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null){if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null))}for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null)){if(u===`style`){if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l}else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&R(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},uc=function(e,t,n,r){n!==r&&(t.flags|=4)};function dc(e,t){if(!V)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function fc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function pc(e,t,n){var i=t.pendingProps;switch(Ta(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return fc(t),null;case 1:return ta(t.type)&&na(),fc(t),null;case 3:return i=t.stateNode,bo(),z(Qi),z(Zi),To(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Pa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Oa!==null&&(yl(Oa),Oa=null))),fc(t),null;case 5:So(t);var o=vo(_o.current);if(n=t.type,e!==null&&t.stateNode!=null)lc(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return fc(t),null}if(e=vo(ho.current),Pa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[Li]=t,i[Ri]=s,e=!!(t.mode&1),n){case`dialog`:R(`cancel`,i),R(`close`,i);break;case`iframe`:case`object`:case`embed`:R(`load`,i);break;case`video`:case`audio`:for(o=0;o<si.length;o++)R(si[o],i);break;case`source`:R(`error`,i);break;case`img`:case`image`:case`link`:R(`error`,i),R(`load`,i);break;case`details`:R(`toggle`,i);break;case`input`:we(i,s),R(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},R(`invalid`,i);break;case`textarea`:Me(i,s),R(`invalid`,i)}for(var c in Ge(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&Ci(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&Ci(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&R(`scroll`,i)}switch(n){case`input`:be(i),De(i,s,!0);break;case`textarea`:be(i),Pe(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=wi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=Fe(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Li]=t,e[Ri]=i,cc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ke(n,i),n){case`dialog`:R(`cancel`,e),R(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:R(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<si.length;o++)R(si[o],e);o=i;break;case`source`:R(`error`,e),o=i;break;case`img`:case`image`:case`link`:R(`error`,e),R(`load`,e),o=i;break;case`details`:R(`toggle`,e),o=i;break;case`input`:we(e,i),o=Ce(e,i),R(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=D({},i,{value:void 0}),R(`invalid`,e);break;case`textarea`:Me(e,i),o=je(e,i),R(`invalid`,e);break;default:o=i}for(s in Ge(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?Ue(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Re(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&ze(e,u):typeof u==`number`&&ze(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&R(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:be(e),De(e,i,!1);break;case`textarea`:be(e),Pe(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+k(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Ae(e,!!i.multiple,i.defaultValue,!0):Ae(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=wi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return fc(t),null;case 6:if(e&&t.stateNode!=null)uc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=vo(_o.current),vo(ho.current),Pa(t)){if(i=t.stateNode,n=t.memoizedProps,i[Li]=t,(s=i.nodeValue!==n)&&(e=Ea,e!==null))switch(e.tag){case 3:Ci(i.nodeValue,n,!!(e.mode&1));break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&Ci(i.nodeValue,n,!!(e.mode&1))}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[Li]=t,t.stateNode=i}return fc(t),null;case 13:if(z(H),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(V&&Da!==null&&t.mode&1&&!(t.flags&128))Fa(),Ia(),t.flags|=98560,s=!1;else if(s=Pa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[Li]=t}else Ia(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;fc(t),s=!1}else Oa!==null&&(yl(Oa),Oa=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||H.current&1?Q===0&&(Q=3):kl())),t.updateQueue!==null&&(t.flags|=4),fc(t),null);case 4:return bo(),e===null&&pi(t.stateNode.containerInfo),fc(t),null;case 10:return Xa(t.type._context),fc(t),null;case 17:return ta(t.type)&&na(),fc(t),null;case 19:if(z(H),s=t.memoizedState,s===null)return fc(t),null;if(i=!!(t.flags&128),c=s.rendering,c===null){if(i)dc(s,!1);else{if(Q!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=Co(e),c!==null){for(t.flags|=128,dc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return B(H,H.current&1|2),t.child}e=e.sibling}s.tail!==null&&A()>tl&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}}else{if(!i){if(e=Co(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!V)return fc(t),null}else 2*A()-s.renderingStartTime>tl&&n!==1073741824&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(fc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=A(),t.sibling=null,n=H.current,B(H,i?n&1|2:n&1),t);case 22:case 23:return Tl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Kc&1073741824&&(fc(t),t.subtreeFlags&6&&(t.flags|=8192)):fc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function mc(e,t){switch(Ta(t),t.tag){case 1:return ta(t.type)&&na(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bo(),z(Qi),z(Zi),To(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return So(t),null;case 13:if(z(H),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Ia()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return z(H),null;case 4:return bo(),null;case 10:return Xa(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var hc=!1,gc=!1,_c=typeof WeakSet==`function`?WeakSet:Set,K=null;function vc(e,t){var n=e.ref;if(n!==null){if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}}function yc(e,t,n){try{n()}catch(n){$(e,t,n)}}var bc=!1;function xc(e,t){if(Ti=Sn,e=Rr(),zr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ei={focusedElem:e,selectionRange:n},Sn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:xs(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=bc,bc=!1,h}function Sc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&yc(t,n,a)}i=i.next}while(i!==r)}}function Cc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Tc(e){var t=e.alternate;t!==null&&(e.alternate=null,Tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Li],delete t[Ri],delete t[Bi],delete t[Vi],delete t[Hi])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Dc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=wi));else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}function kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}var q=null,Ac=!1;function jc(e,t,n){for(n=n.child;n!==null;)Mc(e,t,n),n=n.sibling}function Mc(e,t,n){if(Nt&&typeof Nt.onCommitFiberUnmount==`function`)try{Nt.onCommitFiberUnmount(Mt,n)}catch{}switch(n.tag){case 5:gc||vc(n,t);case 6:var r=q,i=Ac;q=null,jc(e,t,n),q=r,Ac=i,q!==null&&(Ac?(e=q,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):q.removeChild(n.stateNode));break;case 18:q!==null&&(Ac?(e=q,n=n.stateNode,e.nodeType===8?Ni(e.parentNode,n):e.nodeType===1&&Ni(e,n),xn(e)):Ni(q,n.stateNode));break;case 4:r=q,i=Ac,q=n.stateNode.containerInfo,Ac=!0,jc(e,t,n),q=r,Ac=i;break;case 0:case 11:case 14:case 15:if(!gc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&yc(n,t,o),i=i.next}while(i!==r)}jc(e,t,n);break;case 1:if(!gc&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}jc(e,t,n);break;case 21:jc(e,t,n);break;case 22:n.mode&1?(gc=(r=gc)||n.memoizedState!==null,jc(e,t,n),gc=r):jc(e,t,n);break;default:jc(e,t,n)}}function Nc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _c),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Pc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:q=c.stateNode,Ac=!1;break a;case 3:q=c.stateNode.containerInfo,Ac=!0;break a;case 4:q=c.stateNode.containerInfo,Ac=!0;break a}c=c.return}if(q===null)throw Error(r(160));Mc(o,s,a),q=null,Ac=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){$(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Fc(t,e),t=t.sibling}function Fc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Pc(t,e),Ic(e),i&4){try{Sc(3,e,e.return),Cc(3,e)}catch(t){$(e,e.return,t)}try{Sc(5,e,e.return)}catch(t){$(e,e.return,t)}}break;case 1:Pc(t,e),Ic(e),i&512&&n!==null&&vc(n,n.return);break;case 5:if(Pc(t,e),Ic(e),i&512&&n!==null&&vc(n,n.return),e.flags&32){var a=e.stateNode;try{ze(a,``)}catch(t){$(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&Te(a,o),Ke(c,s);var u=Ke(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?Ue(a,f):d===`dangerouslySetInnerHTML`?Re(a,f):d===`children`?ze(a,f):S(a,d,f,u)}switch(c){case`input`:Ee(a,o);break;case`textarea`:Ne(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Ae(a,!!o.multiple,o.multiple?[]:``,!1):Ae(a,!!o.multiple,o.defaultValue,!0)):Ae(a,!!o.multiple,m,!1)}a[Ri]=o}catch(t){$(e,e.return,t)}}break;case 6:if(Pc(t,e),Ic(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){$(e,e.return,t)}}break;case 3:if(Pc(t,e),Ic(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{xn(t.containerInfo)}catch(t){$(e,e.return,t)}break;case 4:Pc(t,e),Ic(e);break;case 13:Pc(t,e),Ic(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(el=A())),i&4&&Nc(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(gc=(u=gc)||d,Pc(t,e),gc=u):Pc(t,e),Ic(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(K=e,d=e.child;d!==null;){for(f=K=d;K!==null;){switch(p=K,m=p.child,p.tag){case 0:case 11:case 14:case 15:Sc(4,p,p.return);break;case 1:vc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){$(i,n,e)}}break;case 5:vc(p,p.return);break;case 22:if(p.memoizedState!==null){Bc(f);continue}}m===null?Bc(f):(m.return=p,K=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=He(`display`,s))}catch(t){$(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){$(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Pc(t,e),Ic(e),i&4&&Nc(e);break;case 21:break;default:Pc(t,e),Ic(e)}}function Ic(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Ec(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(ze(a,``),i.flags&=-33),kc(e,Dc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;Oc(e,Dc(e),o);break;default:throw Error(r(161))}}catch(t){$(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Lc(e,t,n){K=e,Rc(e,t,n)}function Rc(e,t,n){for(var r=!!(e.mode&1);K!==null;){var i=K,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||hc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||gc;s=hc;var l=gc;if(hc=o,(gc=c)&&!l)for(K=i;K!==null;)o=K,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Vc(i):(c.return=o,K=c);for(;a!==null;)K=a,Rc(a,t,n),a=a.sibling;K=i,hc=s,gc=l}zc(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,K=a):zc(e,t,n)}}function zc(e){for(;K!==null;){var t=K;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:gc||Cc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!gc){if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:xs(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}}var o=t.updateQueue;o!==null&&po(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}po(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&xn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}gc||t.flags&512&&wc(t)}catch(e){$(t,t.return,e)}}if(t===e){K=null;break}if(n=t.sibling,n!==null){n.return=t.return,K=n;break}K=t.return}}function Bc(e){for(;K!==null;){var t=K;if(t===e){K=null;break}var n=t.sibling;if(n!==null){n.return=t.return,K=n;break}K=t.return}}function Vc(e){for(;K!==null;){var t=K;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Cc(4,t)}catch(e){$(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){$(t,i,e)}}var a=t.return;try{wc(t)}catch(e){$(t,a,e)}break;case 5:var o=t.return;try{wc(t)}catch(e){$(t,o,e)}}}catch(e){$(t,t.return,e)}if(t===e){K=null;break}var s=t.sibling;if(s!==null){s.return=t.return,K=s;break}K=t.return}}var Hc=Math.ceil,Uc=C.ReactCurrentDispatcher,Wc=C.ReactCurrentOwner,Gc=C.ReactCurrentBatchConfig,J=0,Y=null,X=null,Z=0,Kc=0,qc=Yi(0),Q=0,Jc=null,Yc=0,Xc=0,Zc=0,Qc=null,$c=null,el=0,tl=1/0,nl=null,rl=!1,il=null,al=null,ol=!1,sl=null,cl=0,ll=0,ul=null,dl=-1,fl=0;function pl(){return J&6?A():dl===-1?dl=A():dl}function ml(e){return e.mode&1?J&2&&Z!==0?Z&-Z:Ra.transition===null?(e=j,e===0?(e=window.event,e=e===void 0?16:Dn(e.type),e):e):(fl===0&&(fl=Kt()),fl):1}function hl(e,t,n,i){if(50<ll)throw ll=0,ul=null,Error(r(185));Jt(e,n,i),(!(J&2)||e!==Y)&&(e===Y&&(!(J&2)&&(Xc|=n),Q===4&&xl(e,Z)),gl(e,i),n===1&&J===0&&!(t.mode&1)&&(tl=A()+500,ca&&fa()))}function gl(e,t){var n=e.callbackNode;Wt(e,t);var r=Ht(e,e===Y?Z:0);if(r===0)n!==null&&Ct(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Ct(n),t===1)e.tag===0?da(Sl.bind(null,e)):ua(Sl.bind(null,e)),ji(function(){!(J&6)&&fa()}),n=null;else{switch(Zt(r)){case 1:n=Dt;break;case 4:n=Ot;break;case 16:n=kt;break;case 536870912:n=jt;break;default:n=kt}n=Wl(n,_l.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _l(e,t){if(dl=-1,fl=0,J&6)throw Error(r(327));var n=e.callbackNode;if(Ll()&&e.callbackNode!==n)return null;var i=Ht(e,e===Y?Z:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Al(e,i);else{t=i;var a=J;J|=2;var o=Ol();(Y!==e||Z!==t)&&(nl=null,tl=A()+500,El(e,t));do try{Ml();break}catch(t){Dl(e,t)}while(1);Ya(),Uc.current=o,J=a,X===null?(Y=null,Z=0,t=Q):t=0}if(t!==0){if(t===2&&(a=Gt(e),a!==0&&(i=a,t=vl(e,a))),t===1)throw n=Jc,El(e,0),xl(e,i),gl(e,A()),n;if(t===6)xl(e,i);else{if(a=e.current.alternate,!(i&30)&&!bl(a)&&(t=Al(e,i),t===2&&(o=Gt(e),o!==0&&(i=o,t=vl(e,o))),t===1))throw n=Jc,El(e,0),xl(e,i),gl(e,A()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Fl(e,$c,nl);break;case 3:if(xl(e,i),(i&130023424)===i&&(t=el+500-A(),10<t)){if(Ht(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){pl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Oi(Fl.bind(null,e,$c,nl),t);break}Fl(e,$c,nl);break;case 4:if(xl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Ft(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=A()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Hc(i/1960))-i,10<i){e.timeoutHandle=Oi(Fl.bind(null,e,$c,nl),i);break}Fl(e,$c,nl);break;case 5:Fl(e,$c,nl);break;default:throw Error(r(329))}}}return gl(e,A()),e.callbackNode===n?_l.bind(null,e):null}function vl(e,t){var n=Qc;return e.current.memoizedState.isDehydrated&&(El(e,t).flags|=256),e=Al(e,t),e!==2&&(t=$c,$c=n,t!==null&&yl(t)),e}function yl(e){$c===null?$c=e:$c.push.apply($c,e)}function bl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Nr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xl(e,t){for(t&=~Zc,t&=~Xc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ft(t),r=1<<n;e[n]=-1,t&=~r}}function Sl(e){if(J&6)throw Error(r(327));Ll();var t=Ht(e,0);if(!(t&1))return gl(e,A()),null;var n=Al(e,t);if(e.tag!==0&&n===2){var i=Gt(e);i!==0&&(t=i,n=vl(e,i))}if(n===1)throw n=Jc,El(e,0),xl(e,t),gl(e,A()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fl(e,$c,nl),gl(e,A()),null}function Cl(e,t){var n=J;J|=1;try{return e(t)}finally{J=n,J===0&&(tl=A()+500,ca&&fa())}}function wl(e){sl!==null&&sl.tag===0&&!(J&6)&&Ll();var t=J;J|=1;var n=Gc.transition,r=j;try{if(Gc.transition=null,j=1,e)return e()}finally{j=r,Gc.transition=n,J=t,!(J&6)&&fa()}}function Tl(){Kc=qc.current,z(qc)}function El(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,ki(n)),X!==null)for(n=X.return;n!==null;){var r=n;switch(Ta(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&na();break;case 3:bo(),z(Qi),z(Zi),To();break;case 5:So(r);break;case 4:bo();break;case 13:z(H);break;case 19:z(H);break;case 10:Xa(r.type._context);break;case 22:case 23:Tl()}n=n.return}if(Y=e,X=e=Yl(e.current,null),Z=Kc=t,Q=0,Jc=null,Zc=Xc=Yc=0,$c=Qc=null,eo!==null){for(t=0;t<eo.length;t++)if(n=eo[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}eo=null}return e}function Dl(e,t){do{var n=X;try{if(Ya(),Eo.current=_s,ko){for(var i=U.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}ko=!1}if(Oo=0,G=W=U=null,Ao=!1,jo=0,Wc.current=null,n===null||n.return===null){Q=1,Jc=t,X=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Z,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=Fs(s);if(m!==null){m.flags&=-257,Is(m,s,c,o,t),m.mode&1&&Ps(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}if(!(t&1)){Ps(o,u,t),kl();break a}l=Error(r(426))}else if(V&&c.mode&1){var _=Fs(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Is(_,s,c,o,t),La(Os(l,c));break a}}o=l=Os(l,c),Q!==4&&(Q=2),Qc===null?Qc=[o]:Qc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Ms(o,l,t);uo(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(al===null||!al.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=Ns(o,c,t);uo(o,x);break a}}o=o.return}while(o!==null)}Pl(n)}catch(e){t=e,X===n&&n!==null&&(X=n=n.return);continue}break}while(1)}function Ol(){var e=Uc.current;return Uc.current=_s,e===null?_s:e}function kl(){(Q===0||Q===3||Q===2)&&(Q=4),Y===null||!(Yc&268435455)&&!(Xc&268435455)||xl(Y,Z)}function Al(e,t){var n=J;J|=2;var i=Ol();(Y!==e||Z!==t)&&(nl=null,El(e,t));do try{jl();break}catch(t){Dl(e,t)}while(1);if(Ya(),J=n,Uc.current=i,X!==null)throw Error(r(261));return Y=null,Z=0,Q}function jl(){for(;X!==null;)Nl(X)}function Ml(){for(;X!==null&&!wt();)Nl(X)}function Nl(e){var t=Ul(e.alternate,e,Kc);e.memoizedProps=e.pendingProps,t===null?Pl(e):X=t,Wc.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=mc(n,t),n!==null){n.flags&=32767,X=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Q=6,X=null;return}}else if(n=pc(n,t,Kc),n!==null){X=n;return}if(t=t.sibling,t!==null){X=t;return}X=t=e}while(t!==null);Q===0&&(Q=5)}function Fl(e,t,n){var r=j,i=Gc.transition;try{Gc.transition=null,j=1,Il(e,t,n,r)}finally{Gc.transition=i,j=r}return null}function Il(e,t,n,i){do Ll();while(sl!==null);if(J&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Yt(e,o),e===Y&&(X=Y=null,Z=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,Wl(kt,function(){return Ll(),null})),o=!!(n.flags&15990),n.subtreeFlags&15990||o){o=Gc.transition,Gc.transition=null;var s=j;j=1;var c=J;J|=4,Wc.current=null,xc(e,n),Fc(n,e),Br(Ei),Sn=!!Ti,Ei=Ti=null,e.current=n,Lc(n,e,a),Tt(),J=c,j=s,Gc.transition=o}else e.current=n;if(ol&&(ol=!1,sl=e,cl=a),o=e.pendingLanes,o===0&&(al=null),Pt(n.stateNode,i),gl(e,A()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(rl)throw rl=!1,e=il,il=null,e;return cl&1&&e.tag!==0&&Ll(),o=e.pendingLanes,o&1?e===ul?ll++:(ll=0,ul=e):ll=0,fa(),null}function Ll(){if(sl!==null){var e=Zt(cl),t=Gc.transition,n=j;try{if(Gc.transition=null,j=16>e?16:e,sl===null)var i=!1;else{if(e=sl,sl=null,cl=0,J&6)throw Error(r(331));var a=J;for(J|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(K=u;K!==null;){var d=K;switch(d.tag){case 0:case 11:case 15:Sc(8,d,o)}var f=d.child;if(f!==null)f.return=d,K=f;else for(;K!==null;){d=K;var p=d.sibling,m=d.return;if(Tc(d),d===u){K=null;break}if(p!==null){p.return=m,K=p;break}K=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}K=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,K=s;else b:for(;K!==null;){if(o=K,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Sc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,K=v;break b}K=o.return}}var y=e.current;for(K=y;K!==null;){s=K;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,K=b;else b:for(s=y;K!==null;){if(c=K,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:Cc(9,c)}}catch(e){$(c,c.return,e)}if(c===s){K=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,K=x;break b}K=c.return}}if(J=a,fa(),Nt&&typeof Nt.onPostCommitFiberRoot==`function`)try{Nt.onPostCommitFiberRoot(Mt,e)}catch{}i=!0}return i}finally{j=n,Gc.transition=t}}return!1}function Rl(e,t,n){t=Os(n,t),t=Ms(e,t,1),e=co(e,t,1),t=pl(),e!==null&&(Jt(e,1,t),gl(e,t))}function $(e,t,n){if(e.tag===3)Rl(e,e,n);else for(;t!==null;){if(t.tag===3){Rl(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(al===null||!al.has(r))){e=Os(n,e),e=Ns(t,e,1),t=co(t,e,1),e=pl(),t!==null&&(Jt(t,1,e),gl(t,e));break}}t=t.return}}function zl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=pl(),e.pingedLanes|=e.suspendedLanes&n,Y===e&&(Z&n)===n&&(Q===4||Q===3&&(Z&130023424)===Z&&500>A()-el?El(e,0):Zc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Bt,Bt<<=1,!(Bt&130023424)&&(Bt=4194304)):t=1);var n=pl();e=ro(e,t),e!==null&&(Jt(e,t,n),gl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps||Qi.current)Rs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Rs=!1,sc(e,t,n);Rs=!!(e.flags&131072)}}else Rs=!1,V&&t.flags&1048576&&Ca(t,ga,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ac(e,t),e=t.pendingProps;var a=ea(t,Zi.current);Qa(t,n),a=Fo(null,t,i,e,a,n);var o=Io();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ta(i)?(o=!0,aa(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ao(t),a.updater=Cs,t.stateNode=a,a._reactInternals=t,Ds(t,i,e,n),t=qs(null,t,i,!0,o,n)):(t.tag=0,V&&o&&wa(t),zs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ac(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=xs(i,e),a){case 0:t=Gs(null,t,i,e,n);break a;case 1:t=Ks(null,t,i,e,n);break a;case 11:t=Bs(null,t,i,e,n);break a;case 14:t=Vs(null,t,i,xs(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Gs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Ks(e,t,i,a,n);case 3:a:{if(Js(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,oo(e,t),fo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated){if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=Os(Error(r(423)),t),t=Ys(e,t,i,n,a);break a}if(i!==a){a=Os(Error(r(424)),t),t=Ys(e,t,i,n,a);break a}for(Da=Pi(t.stateNode.containerInfo.firstChild),Ea=t,V=!0,Oa=null,n=Wa(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Ia(),i===a){t=oc(e,t,n);break a}zs(e,t,i,n)}t=t.child}return t;case 5:return xo(t),e===null&&Ma(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Di(i,a)?s=null:o!==null&&Di(i,o)&&(t.flags|=32),Ws(e,t),zs(e,t,s,n),t.child;case 6:return e===null&&Ma(t),null;case 13:return Qs(e,t,n);case 4:return yo(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ua(t,null,i,n):zs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),Bs(e,t,i,a,n);case 7:return zs(e,t,t.pendingProps,n),t.child;case 8:return zs(e,t,t.pendingProps.children,n),t.child;case 12:return zs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,B(Ga,i._currentValue),i._currentValue=s,o!==null){if(Nr(o.value,s)){if(o.children===a.children&&!Qi.current){t=oc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=so(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Za(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Za(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}zs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Qa(t,n),a=$a(a),i=i(a),t.flags|=1,zs(e,t,i,n),t.child;case 14:return i=t.type,a=xs(i,t.pendingProps),a=xs(i.type,a),Vs(e,t,i,a,n);case 15:return Hs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:xs(i,a),ac(e,t),t.tag=1,ta(i)?(e=!0,aa(t)):e=!1,Qa(t,n),Ts(t,i,a),Ds(t,i,a,n),qs(null,t,i,!0,e,n);case 19:return ic(e,t,n);case 22:return Us(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return St(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===ae)return 11;if(e===E)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case ee:return Zl(n.children,a,o,t);case te:s=8,a|=8;break;case ne:return e=Kl(12,n,t,a|2),e.elementType=ne,e.lanes=o,e;case oe:return e=Kl(13,n,t,a),e.elementType=oe,e.lanes=o,e;case se:return e=Kl(19,n,t,a),e.elementType=se,e.lanes=o,e;case le:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case re:s=10;break a;case ie:s=9;break a;case ae:s=11;break a;case E:s=14;break a;case ce:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=le,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qt(0),this.expirationTimes=qt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ao(a),e}function ru(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function iu(e){if(!e)return Xi;e=e._reactInternals;a:{if(gt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(ta(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(ta(n))return ia(e,n,t)}return t}function au(e,t,n,r,i,a,o,s,c){return e=nu(n,r,!0,e,i,a,o,s,c),e.context=iu(null),n=e.current,r=pl(),i=ml(n),a=so(r,i),a.callback=t??null,co(n,a,i),e.current.lanes=i,Jt(e,i,r),gl(e,r),e}function ou(e,t,n,r){var i=t.current,a=pl(),o=ml(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=so(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=co(i,t,o),e!==null&&(hl(e,i,o,a),lo(e,i,o)),o}function su(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lu(e,t){cu(e,t),(e=e.alternate)&&cu(e,t)}function uu(){return null}var du=typeof reportError==`function`?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}pu.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));ou(e,t,null,null)},pu.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wl(function(){ou(null,e,null,null)}),t[zi]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=tn();e={blockedOn:null,target:e,priority:t};for(var n=0;n<dn.length&&t!==0&&t<dn[n].priority;n++);dn.splice(n,0,e),n===0&&gn(e)}};function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function gu(){}function _u(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=su(o);a.call(e)}}var o=au(t,r,e,0,null,!1,!1,``,gu);return e._reactRootContainer=o,e[zi]=o.current,pi(e.nodeType===8?e.parentNode:e),wl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=su(c);s.call(e)}}var c=nu(e,0,!1,null,null,!1,!1,``,gu);return e._reactRootContainer=c,e[zi]=c.current,pi(e.nodeType===8?e.parentNode:e),wl(function(){ou(t,c,n,r)}),c}function vu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=su(o);s.call(e)}}ou(t,o,e,i)}else o=_u(n,t,e,i,r);return su(o)}Qt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Vt(t.pendingLanes);n!==0&&(Xt(t,n|1),gl(t,A()),!(J&6)&&(tl=A()+500,fa()))}break;case 13:wl(function(){var t=ro(e,1);t!==null&&hl(t,e,1,pl())}),lu(e,1)}},$t=function(e){if(e.tag===13){var t=ro(e,134217728);t!==null&&hl(t,e,134217728,pl()),lu(e,134217728)}},en=function(e){if(e.tag===13){var t=ml(e),n=ro(e,t);n!==null&&hl(n,e,t,pl()),lu(e,t)}},tn=function(){return j},nn=function(e,t){var n=j;try{return j=e,t()}finally{j=n}},Ye=function(e,t,n){switch(t){case`input`:if(Ee(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Ki(i);if(!a)throw Error(r(90));xe(i),Ee(i,a)}}}break;case`textarea`:Ne(e,n);break;case`select`:t=n.value,t!=null&&Ae(e,!!n.multiple,t,!1)}},tt=Cl,nt=wl;var yu={usingClientEntryPoint:!1,Events:[Wi,Gi,Ki,$e,et,Cl]},bu={findFiberByHostInstance:Ui,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},xu={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=bt(e),e===null?null:e.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||uu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{Mt=Su.inject(xu),Nt=Su}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(t))throw Error(r(200));return ru(e,t,null,n)},e.createRoot=function(e,t){if(!mu(e))throw Error(r(299));var n=!1,i=``,a=du;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=nu(e,1,!1,null,null,n,!1,i,a),e[zi]=t.current,pi(e.nodeType===8?e.parentNode:e),new fu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=bt(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return wl(e)},e.hydrate=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!mu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=du;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=au(t,null,e,1,n??null,a,!1,o,s),e[zi]=t.current,pi(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new pu(t)},e.render=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!hu(e))throw Error(r(40));return e._reactRootContainer?(wl(function(){vu(null,null,e,!1,function(){e._reactRootContainer=null,e[zi]=null})}),!0):!1},e.unstable_batchedUpdates=Cl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!hu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return vu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),m=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot}))(),g=c(u(),1);function _(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var{useRef:v}=g.default;function y(e){let t=v();return n=>{let r=e(n);return _(t.current,r)?t.current:t.current=r}}var b=8;function x(e,t){let[n,r]=(0,g.useState)(()=>{try{let e=localStorage.getItem(t);return e?JSON.parse(e):null}catch{return null}}),i=(0,g.useRef)(!1),a=(0,g.useCallback)(t=>{let n=e.current,r=n?.offsetWidth??0,i=n?.offsetHeight??0;return{right:Math.min(Math.max(b,t.right),Math.max(b,window.innerWidth-r-b)),bottom:Math.min(Math.max(b,t.bottom),Math.max(b,window.innerHeight-i-b))}},[e]);return(0,g.useEffect)(()=>{let e=()=>r(e=>e&&a(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[a]),{anchor:n,start:(0,g.useCallback)(n=>{if(n.button!==0)return;let o=e.current;if(!o)return;let s=o.getBoundingClientRect(),c={x:n.clientX,y:n.clientY,right:window.innerWidth-s.right,bottom:window.innerHeight-s.bottom};i.current=!1;let l=e=>{let t=e.clientX-c.x,n=e.clientY-c.y;!i.current&&Math.hypot(t,n)<5||(i.current=!0,r(a({right:c.right-t,bottom:c.bottom-n})))},u=null,d=e=>{l(e),i.current&&(u=a({right:c.right-(e.clientX-c.x),bottom:c.bottom-(e.clientY-c.y)}))},f=()=>{if(window.removeEventListener(`pointermove`,d),window.removeEventListener(`pointerup`,f),window.removeEventListener(`pointercancel`,f),i.current&&u)try{localStorage.setItem(t,JSON.stringify(u))}catch{}};window.addEventListener(`pointermove`,d),window.addEventListener(`pointerup`,f),window.addEventListener(`pointercancel`,f)},[e,a,t]),onClickCapture:(0,g.useCallback)(e=>{i.current&&=(e.stopPropagation(),e.preventDefault(),!1)},[])}}var S=o((e=>{var t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&apos;`};function n(e){return t[e]}var r={"&amp;":`&`,"&lt;":`<`,"&gt;":`>`,"&quot;":`"`,"&apos;":`'`};function i(e){if(e[1]===`#`){let t=e[2]===`x`?parseInt(e.slice(3),16):parseInt(e.slice(2),10);if(t===9||t===10||t===13||t>=32&&t<=55295||t>=57344&&t<=65533||t>=65536&&t<=1114111)return String.fromCodePoint(t);throw Error(`Illegal XML character 0x`+t.toString(16))}if(r[e])return r[e]||e;throw Error(`Illegal XML entity `+e)}function a(e){return e.replace(/["&'<>]/g,n)}function o(e){let t=``,n=-1,r=-1,a=0;for(;(n=e.indexOf(`&`,a))!==-1&&(r=e.indexOf(`;`,n+1))!==-1;)t=t+e.slice(a,n)+i(e.slice(n,r+1)),a=r+1;return a===0?e:(t+=e.substring(a),t)}function s(e){return e.replace(/[&<>]/g,n)}function c(e){return e.replace(/&(amp|#38|lt|#60|gt|#62);/g,i)}e.escapeXML=a,e.escapeXMLText=s,e.unescapeXML=o,e.unescapeXMLText=c})),C=o(((e,t)=>{var n=S(),r=class e{constructor(e,t){this.name=e,this.parent=null,this.children=[],this.attrs={},this.setAttrs(t)}is(e,t){return this.getName()===e&&(!t||this.getNS()===t)}getName(){let e=this.name.indexOf(`:`);return e>=0?this.name.slice(e+1):this.name}getNS(){let e=this.name.indexOf(`:`);if(e>=0){let t=this.name.slice(0,e);return this.findNS(t)}return this.findNS()}findNS(e){if(e){let t=`xmlns:`+e;if(this.attrs[t])return this.attrs[t];if(this.parent)return this.parent.findNS(e)}else{if(this.attrs.xmlns)return this.attrs.xmlns;if(this.parent)return this.parent.findNS()}}getXmlns(){let e={};this.parent&&(e=this.parent.getXmlns());for(let t in this.attrs){let n=t.match(`xmlns:?(.*)`);this.attrs.hasOwnProperty(t)&&n&&(e[this.attrs[t]]=n[1])}return e}setAttrs(e){typeof e==`string`?this.attrs.xmlns=e:e&&Object.assign(this.attrs,e)}getAttr(e,t){if(!t)return this.attrs[e];let n=this.getXmlns();return n[t]?this.attrs[[n[t],e].join(`:`)]:null}getChild(e,t){return this.getChildren(e,t)[0]}getChildren(e,t){let n=[];for(let r of this.children)r.getName&&r.getName()===e&&(!t||r.getNS()===t)&&n.push(r);return n}getChildByAttr(e,t,n,r){return this.getChildrenByAttr(e,t,n,r)[0]}getChildrenByAttr(e,t,n,r){let i=[];for(let a of this.children)a.attrs&&a.attrs[e]===t&&(!n||a.getNS()===n)&&i.push(a),r&&a.getChildrenByAttr&&i.push(a.getChildrenByAttr(e,t,n,!0));return r&&(i=i.flat()),i}getChildrenByFilter(e,t){let n=[];for(let r of this.children)e(r)&&n.push(r),t&&r.getChildrenByFilter&&n.push(r.getChildrenByFilter(e,!0));return t&&(n=n.flat()),n}getText(){let e=``;for(let t of this.children)(typeof t==`string`||typeof t==`number`)&&(e+=t);return e}getChildText(e,t){let n=this.getChild(e,t);return n?n.getText():null}getChildElements(){return this.getChildrenByFilter(t=>t instanceof e)}root(){return this.parent?this.parent.root():this}up(){return this.parent?this.parent:this}c(t,n){return this.cnode(new e(t,n))}cnode(e){return this.children.push(e),typeof e==`object`&&(e.parent=this),e}append(...e){for(let t of e)this.children.push(t),typeof t==`object`&&(t.parent=this)}prepend(...e){for(let t of e)this.children.unshift(t),typeof t==`object`&&(t.parent=this)}t(e){return this.children.push(e),this}remove(e,t){let n=typeof e==`string`?n=>!(n.is&&n.is(e,t)):t=>t!==e;return this.children=this.children.filter(n),this}text(e){return e&&this.children.length===1?(this.children[0]=e,this):this.getText()}attr(e,t){return t!==void 0||t===null?(this.attrs||={},this.attrs[e]=t,this):this.attrs[e]}toString(){let e=``;return this.write(t=>{e+=t}),e}_addChildren(e){e(`>`);for(let t of this.children)t!=null&&(t.write?t.write(e):typeof t==`string`?e(n.escapeXMLText(t)):t.toString&&e(n.escapeXMLText(t.toString(10))));e(`</`),e(this.name),e(`>`)}write(e){e(`<`),e(this.name);for(let t in this.attrs){let r=this.attrs[t];r!=null&&(e(` `),e(t),e(`="`),e(n.escapeXML(typeof r==`string`?r:r.toString(10))),e(`"`))}this.children.length===0?e(`/>`):this._addChildren(e)}};r.prototype.tree=r.prototype.root,t.exports=r})),w=o(((e,t)=>{var n=C();function r(e,t){if(Array.isArray(t)){for(let n of t)r(e,n);return}t!==``&&t!=null&&t!==!0&&t!==!1&&e.cnode(t)}function i(e,t,...i){if(typeof t==`object`&&t){delete t.__source,delete t.__self;for(let[e,n]of Object.entries(t))n==null?delete t[e]:t[e]=n.toString(10)}let a=new n(e,t);for(let e of i)r(a,e);return a}t.exports=i})),T=o(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),ee=o(((e,t)=>{var n=T(),r=S(),i=0,a=1,o=2,s=3,c=4,l=5,u=6,d=7,f=8,p=9,m=10;t.exports=class extends n.EventEmitter{constructor(){super();let e=i,t,n,h,g,_,v,y,b,x=0,S;this._handleTagOpening=function(e,t,n){e?this.emit(`endElement`,t,!1):(this.emit(`startElement`,t,n),v&&this.emit(`endElement`,t,!0))},this.write=function(C){typeof C!=`string`&&(C=C.toString());let w=0;t&&=(C=t+C,w+=n?0:t.length,n=!1,null);function T(){if(typeof x==`number`){let e=C.slice(x,w);return x=void 0,e}}for(;w<C.length;w++){switch(e){case i:{let e=C.indexOf(`<`,w);e!==-1&&w!==e&&(w=e);break}case f:{let e=C.indexOf(b,w);e!==-1&&(w=e);break}case a:{let e=C.indexOf(`-->`,w);e!==-1&&(w=e+2);break}case m:{let e=C.indexOf(`]]>`,w);e!==-1&&(w=e+2);break}}let t=C.charCodeAt(w);switch(e){case i:if(t===60){let t=T();t&&this.emit(`text`,r.unescapeXML(t)),e=s,x=w+1,g={}}break;case p:if(t===93){if(C.substr(w+1,2)===`]>`){let t=T();t&&this.emit(`text`,t),e=i}else C.length<w+2&&(n=!0,w=C.length)}break;case s:t===47&&x===w?(x=w+1,_=!0):t===33?C.substr(w+1,7)===`[CDATA[`?(x=w+8,e=p):C.length<w+8&&`[CDATA[`.startsWith(C.slice(w+1))?(n=!0,w=C.length):(x=void 0,e=a):t===63?(x=void 0,e=o):(t<=32||t===47||t===62)&&(h=T(),w--,e=c);break;case a:if(t===62){let t=C.charCodeAt(w-1),n=C.charCodeAt(w-2);(t===45&&n===45||t===93&&n===93)&&(e=i)}break;case o:t===62&&C.charCodeAt(w-1)===63&&(e=i);break;case c:t===62?(this._handleTagOpening(_,h,g),h=void 0,g=void 0,_=void 0,v=void 0,e=i,x=w+1):t===47?v=!0:t>32&&(x=w,e=l);break;case l:(t<=32||t===61)&&(S=T(),w--,e=u);break;case u:t===61&&(e=d);break;case d:(t===34||t===39)&&(y=t,b=t===34?`"`:`'`,e=f,x=w+1);break;case f:if(t===y){let t=r.unescapeXML(T());g[S]=t,S=void 0,e=c}}}typeof x==`number`&&x<=C.length&&(t=C.slice(x),x=0)}}end(e){e&&this.write(e),this.write=function(){}}}})),te=S(),ne=c(C(),1),re=c(w(),1),ie=T(),ae=c(ee(),1),oe=class extends Error{constructor(e){super(e),this.name=`TimeoutError`}};function se(e){let t,n=new Promise(n=>{t=setTimeout(n,e)});return n.timeout=t,n}function E(e,t){let n=se(t);function r(){clearTimeout(n.timeout)}let i=new oe;return Promise.race([e.finally(r),n.then(()=>{throw i})])}var ce=new WeakMap;function le(e){let t=ce.get(e);return t||(t={on:(e.addEventListener??e.addListener).bind(e),off:(e.removeEventListener??e.removeListener).bind(e),once:(e.once??((t,n)=>e.addEventListener(t,n,{once:!0}))).bind(e)},ce.set(e,t)),t}function ue(e,t,n=`error`,r){return new Promise((i,a)=>{let o,{off:s,once:c}=le(e),l=()=>{clearTimeout(o),s(t,d),s(n,u)};function u(e){a(e),l()}function d(e){i(e),l()}if(c(t,d),n&&c(n,u),r){let e=new oe;o=setTimeout(()=>{l(),a(e)},r)}})}function de(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}function D(e,t=null,n){return new Promise((r,i)=>{function a(t){e.removeListener(`nonza`,s),i(t)}function o(...t){e.removeListener(`nonza`,s),r(...t)}async function s(e){try{await n(e,o)}catch(e){a(e)}}t&&e.send(t).catch(a),e.on(`nonza`,s)})}function fe(e){return{subscribe(t){let{on:n}=le(t);for(let[t,r]of Object.entries(e))n(t,r)},unsubscribe(t){let{off:n}=le(t);for(let[t,r]of Object.entries(e))n(t,r)}}}var pe=class extends Error{constructor(...e){super(...e),this.name=`XMLError`}},me=class extends ie.EventEmitter{constructor(){super();let e=new ae.default;this.root=null,this.cursor=null,e.on(`startElement`,this.onStartElement.bind(this)),e.on(`endElement`,this.onEndElement.bind(this)),e.on(`text`,this.onText.bind(this)),this.parser=e}onStartElement(e,t){let n=new ne.default(e,t),{root:r,cursor:i}=this;r?i!==r&&i.append(n):(this.root=n,this.emit(`start`,n)),this.cursor=n}onEndElement(e){let{root:t,cursor:n}=this;if(e!==n.name){this.emit(`error`,new pe(`${n.name} must be closed.`));return}if(n===t){this.emit(`end`,t);return}if(!n.parent){n.parent=t,this.emit(`element`,n),this.cursor=t;return}this.cursor=n.parent}onText(e){let{cursor:t}=this;if(!t){this.emit(`error`,new pe(`${e} must be a child.`));return}t.t(e)}write(e){this.parser.write(e)}end(e){e&&this.parser.write(e)}};me.XMLError=pe;function O(...e){return(0,re.default)(...e)}Object.assign(O,{Element:ne.default,createElement:re.default,Parser:me,escapeXML:te.escapeXML,unescapeXML:te.unescapeXML,escapeXMLText:te.escapeXMLText,unescapeXMLText:te.unescapeXMLText,XMLError:pe,xml:O});function he(e){return!(!e||e.replaceAll(String.raw`\20`,``).replaceAll(String.raw`\22`,``).replaceAll(String.raw`\26`,``).replaceAll(String.raw`\27`,``).replaceAll(String.raw`\2f`,``).replaceAll(String.raw`\3a`,``).replaceAll(String.raw`\3c`,``).replaceAll(String.raw`\3e`,``).replaceAll(String.raw`\40`,``).replaceAll(String.raw`\5c`,``).search(/[ "&'/:<>@\\]/g)===-1)}function ge(e){return e===null?null:e.replaceAll(/^\s+|\s+$/g,``).replaceAll(`\\`,String.raw`\5c`).replaceAll(` `,String.raw`\20`).replaceAll(`"`,String.raw`\22`).replaceAll(`&`,String.raw`\26`).replaceAll(`'`,String.raw`\27`).replaceAll(`/`,String.raw`\2f`).replaceAll(`:`,String.raw`\3a`).replaceAll(`<`,String.raw`\3c`).replaceAll(`>`,String.raw`\3e`).replaceAll(`@`,String.raw`\40`)}function _e(e){return e===null?null:e.replaceAll(String.raw`\20`,` `).replaceAll(String.raw`\22`,`"`).replaceAll(String.raw`\26`,`&`).replaceAll(String.raw`\27`,`'`).replaceAll(String.raw`\2f`,`/`).replaceAll(String.raw`\3a`,`:`).replaceAll(String.raw`\3c`,`<`).replaceAll(String.raw`\3e`,`>`).replaceAll(String.raw`\40`,`@`).replaceAll(String.raw`\5c`,`\\`)}var k=class e{constructor(e,t,n){if(typeof t!=`string`||!t)throw TypeError(`Invalid domain.`);this.setDomain(t),this.setLocal(typeof e==`string`?e:``),this.setResource(typeof n==`string`?n:``)}[Symbol.toPrimitive](e){return e===`number`?NaN:this.toString()}toString(e){let t=this._domain;return this._local&&(t=this.getLocal(e)+`@`+t),this._resource&&(t=t+`/`+this._resource),t}bare(){return this._resource?new e(this._local,this._domain,null):this}equals(e){return this._local===e._local&&this._domain===e._domain&&this._resource===e._resource}setLocal(e,t){return t||=he(e),t&&(e=ge(e)),this._local=e&&e.toLowerCase(),this}getLocal(e=!1){let t=null;return t=e?_e(this._local):this._local,t}setDomain(e){return this._domain=e.toLowerCase(),this}getDomain(){return this._domain}setResource(e){return this._resource=e,this}getResource(){return this._resource}};Object.defineProperty(k.prototype,"local",{get:k.prototype.getLocal,set:k.prototype.setLocal}),Object.defineProperty(k.prototype,"domain",{get:k.prototype.getDomain,set:k.prototype.setDomain}),Object.defineProperty(k.prototype,"resource",{get:k.prototype.getResource,set:k.prototype.setResource});function ve(e){let t,n,r=e.indexOf(`/`);r!==-1&&(n=e.slice(r+1),e=e.slice(0,r));let i=e.indexOf(`@`);return i!==-1&&(t=e.slice(0,i),e=e.slice(i+1)),new k(t,e,n)}function ye(e,t){return e.equals(t)}function be(...e){return!e[1]&&!e[2]?ve(...e):new k(...e)}var xe=be.bind();xe.jid=be,xe.JID=k,xe.parse=ve,xe.equal=ye,xe.detectEscape=he,xe.escapeLocal=ge,xe.unescapeLocal=_e;var Se=class extends Error{constructor(e,t,n){super(e+(t?` - ${t}`:``)),this.name=`XMPPError`,this.condition=e,this.text=t,this.application=n}static fromElement(e){let[t,n,r]=e.getChildElements(),i,a;n&&(n.is(`text`)?i=n:n&&(a=n),r&&(a=r));let o=new this(t.name,i?i.text():``,a);return o.element=e,o}},Ce=class extends Se{constructor(...e){super(...e),this.name=`StreamError`}};function we(e){let{port:t,hostname:n,protocol:r}=new URL(e);return n===`[::1]`&&(n=`::1`),{port:t,hostname:n,protocol:r}}function Te(e){let{port:t,hostname:n}=we(`http://${e}`);return{port:t,hostname:n}}function Ee(e){return e.includes(`://`)?we(e):Te(e)}var De=`urn:ietf:params:xml:ns:xmpp-streams`,Oe=`http://etherx.jabber.org/streams`,ke=class extends ie.EventEmitter{#e=null;#t=null;constructor(e={}){super(),typeof e==`string`&&(e={domain:e}),this.jid=null,this.timeout=e.timeout||2e3,this.options=e,this.status=`offline`,this.socket=null,this.parser=null,this.root=null}isSecure(){return this.socket?.secure===!0}async _streamError(e,t){try{await this.send(O(`stream:error`,{},[O(e,{xmlns:De},t)]))}catch{}return this.disconnect()}_onData(e){let t=e.toString(`utf8`);this.parser.write(t)}#n(e){this._streamError(`bad-format`),this._detachParser(),this.emit(`error`,e)}#r(e,t){this._detachSocket(),this._status(`disconnect`,{clean:!e,reason:t})}#i(e,t){this._detachParser(),this._status(`close`,{clean:!e,reason:t})}_attachSocket(e){this.socket=e,this.#e??=fe({data:this._onData.bind(this),close:this.#r.bind(this),connect:()=>this._status(`connect`),error:e=>this.emit(`error`,e)}),this.#e.subscribe(this.socket)}_detachSocket(){this.socket&&this.#e?.unsubscribe(this.socket),this.socket=null}_onElement(e){let t=e.is(`error`,Oe);t&&this._onStreamError(e),this.emit(`element`,e),this.emit(this.isStanza(e)?`stanza`:`nonza`,e),t&&this.disconnect()}_onStreamError(e){let t=Ce.fromElement(e);if(t.condition===`see-other-host`)return this._onSeeOtherHost(t);this.emit(`error`,t)}async _onSeeOtherHost(e){let{protocol:t}=Ee(this.options.service),n=e.element.getChildText(`see-other-host`),{port:r}=Te(n),i;i=r?`${t||`xmpp:`}//${n}`:(t?`${t}//`:``)+n;try{await ue(this,`disconnect`);let{domain:e,lang:t}=this.options;await this.connect(i),await this.open({domain:e,lang:t})}catch(e){this.emit(`error`,e)}}_attachParser(e){this.parser=e,this.#t??=fe({element:this._onElement.bind(this),error:this.#n.bind(this),end:this.#i.bind(this),start:e=>this._status(`open`,e)}),this.#t.subscribe(this.parser)}_detachParser(){this.parser&&this.#t?.unsubscribe(this.parser),this.parser=null,this.root=null}_jid(e){return this.jid=xe(e),this.jid}_status(e,...t){this.status!==e&&(this.status=e,this.emit(`status`,e,...t),this.emit(e,...t))}_ready(e=!1){e?this.status=`online`:this._status(`online`,this.jid)}async disconnect(){let e;try{e=await this._closeStream()}catch(e){this.#i(e)}try{await this._closeSocket()}catch(e){this.#r(!0,e)}return e}async start(){if(this.status!==`offline`)throw Error(`Connection is not offline`);let{service:e,domain:t,lang:n}=this.options;await this.connect(e);let r=ue(this,`online`);return await this.open({domain:t,lang:n}),r}async connect(e){this._status(`connecting`,e);let t=new this.Socket;return this._attachSocket(t),t.connect(this.socketParameters(e)),ue(t,`connect`)}async _closeSocket(e=this.timeout){this._status(`disconnecting`),this.socket.end(),await ue(this.socket,`close`,`error`,e)}async open(e){this._status(`opening`);let{domain:t,lang:n}=e,r=this.headerElement();return r.attrs.to=t,r.attrs[`xml:lang`]=n,this.root=r,this._attachParser(new this.Parser),await this.write(this.header(r)),ue(this,`open`,`error`,this.timeout)}async stop(){let e=await this.disconnect();return this._status(`offline`,e),e}async _closeStream(e=this.timeout){await this.#c(`close`);let t=this.footer(this.footerElement());return await this.write(t),this._status(`closing`),ue(this.parser,`end`,`error`,e)}async restart(){this._detachParser();let{domain:e,lang:t}=this.options;return this.open({domain:e,lang:t})}async send(e){e.parent=this.root,await this.write(e.toString()),this.emit(`send`,e)}sendReceive(e,t=this.timeout){return Promise.all([this.send(e),ue(this,`element`,`error`,t)]).then(([,e])=>e)}async write(e){if(this.status===`closing`)throw Error(`Connection is closing`);return new Promise((t,n)=>{this.socket.write(e,e=>e?n(e):t())})}isStanza(e){let{name:t}=e;return t===`iq`||t===`message`||t===`presence`}isNonza(e){return!this.isStanza(e)}header(e){return e.toString()}headerElement(){return new O.Element(``,{version:`1.0`,xmlns:this.NS})}footer(e){return e.toString()}footerElement(){}socketParameters(){}#a=new Map;#o=new Set([`close`]);hook(e,t){this.#s(e),this.#a.has(e)||this.#a.set(e,new Set),this.#a.get(e).add([t])}#s(e){if(!this.#o.has(e))throw Error(`Hook event name "${e}" is unknown.`)}unhook(e,t){this.#s(e);let n=this.#a.get(`event`),r=[...n].find(e=>e.handler===t);n.remove(r)}async#c(e,...t){this.#s(e);let n=this.#a.get(e);n&&await Promise.all([...n].map(async([e])=>{try{await e(...t)}catch(e){this.emit(`error`,e)}}))}};ke.prototype.NS=``,ke.prototype.Socket=null,ke.prototype.Parser=null;var Ae=class extends ke{constructor(e){super(e),this.transports=[]}send(e,...t){return this.Transport.prototype.send.call(this,e,...t)}sendMany(...e){return this.Transport.prototype.sendMany.call(this,...e)}_findTransport(e){return this.transports.find(t=>{try{return t.prototype.socketParameters(e)!==void 0}catch{return!1}})}connect(e){let t=this._findTransport(e);if(!t)throw Error(`No compatible connection method found.`);return this.Transport=t,this.Socket=t.prototype.Socket,this.Parser=t.prototype.Parser,super.connect(e)}socketParameters(...e){return this.Transport.prototype.socketParameters(...e)}header(e,...t){let n=this.isSecure()&&this.jid?.bare().toString();return n&&(e.attrs.from=n),this.Transport.prototype.header(e,...t)}headerElement(...e){return this.Transport.prototype.headerElement(...e)}footer(...e){return this.Transport.prototype.footer(...e)}footerElement(...e){return this.Transport.prototype.footerElement(...e)}};Ae.prototype.NS=`jabber:client`;var je=class extends ie.EventEmitter{constructor(e){super(),this.delay=1e3,this.entity=e,this._timeout=null}#e=()=>{this.scheduleReconnect()};scheduleReconnect(){let{entity:e,delay:t,_timeout:n}=this;clearTimeout(n),this._timeout=setTimeout(async()=>{if(e.status===`disconnect`)try{await this.reconnect()}catch{}},t)}async reconnect(){let{entity:e}=this;this.emit(`reconnecting`);let{service:t,domain:n,lang:r}=e.options;await e.connect(t),await e.open({domain:n,lang:r}),this.emit(`reconnected`)}start(){let{entity:e}=this;e.on(`disconnect`,this.#e)}stop(){let{entity:e,_timeout:t}=this;e.removeListener(`disconnect`,this.#e),clearTimeout(t)}};function Me({entity:e}){let t=new je(e);return t.start(),t}var Ne=`ECONNERROR`;function Pe(e){let t=we(e);return!!(t.protocol===`wss:`||[`localhost`,`127.0.0.1`,`::1`].includes(t.hostname))}var Fe=class extends ie.EventEmitter{#e=null;socket=null;url=null;secure=!1;connect(e){this.url=e,this.secure=Pe(e),this._attachSocket(new WebSocket(e,[`xmpp`]))}_attachSocket(e){this.socket=e,this.#e??=fe({open:()=>this.emit(`connect`),message:({data:e})=>this.emit(`data`,e),error:e=>{let{url:t}=this,{error:n}=e;n||(n=Error(e.message||`WebSocket ${Ne} ${t}`),n.errno=Ne,n.code=Ne),n.event=e,n.url=t,this.emit(`error`,n)},close:e=>{this._detachSocket(),this.emit(`close`,!e.wasClean,e)}}),this.#e.subscribe(this.socket)}_detachSocket(){this.url=null,this.secure=!1,this.socket&&this.#e?.unsubscribe(this.socket),this.socket=null}end(){this.socket.close()}write(e,t){function n(e){t&&Promise.resolve().then(()=>t(e))}try{this.socket.send(e)}catch(e){n(e);return}n()}},Ie=class extends me{onStartElement(e,t){let n=new ne.default(e,t),{cursor:r}=this;r&&r.append(n),this.cursor=n}onEndElement(e){let{cursor:t}=this;if(e!==t.name){this.emit(`error`,new pe(`${t.name} must be closed.`));return}if(t.parent){this.cursor=t.parent;return}t.is(`open`,`urn:ietf:params:xml:ns:xmpp-framing`)?this.emit(`start`,t):t.is(`close`,`urn:ietf:params:xml:ns:xmpp-framing`)?this.emit(`end`,t):this.emit(`element`,t),this.cursor=null}},Le=`urn:ietf:params:xml:ns:xmpp-framing`,Re=class extends ke{send(e,...t){return e.attrs.xmlns??=this.NS,super.send(e,...t)}async sendMany(e){for(let t of e)t.attrs.xmlns??=this.NS,t.parent=this.root,this.socket.write(t.toString()),this.emit(`send`,t)}footerElement(){return new O.Element(`close`,{xmlns:Le})}headerElement(){let e=super.headerElement();return e.name=`open`,e.attrs.xmlns=Le,e}socketParameters(e){return/^wss?:\/\//.test(e)?e:void 0}};Re.prototype.Socket=Fe,Re.prototype.NS=`jabber:client`,Re.prototype.Parser=Ie;function ze({entity:e}){e.transports.push(Re)}var Be=o(((e,t)=>{t.exports={}})),Ve=o(((e,t)=>{t.exports=n;function n(e){if(!Array.isArray(e))throw TypeError(`Middleware stack must be an array!`);for(let t of e)if(typeof t!=`function`)throw TypeError(`Middleware must be composed of functions!`);return function(t,n){let r=-1;return i(0);function i(a){if(a<=r)return Promise.reject(Error(`next() called multiple times`));r=a;let o=e[a];if(a===e.length&&(o=n),!o)return Promise.resolve();try{return Promise.resolve(o(t,i.bind(null,a+1)))}catch(e){return Promise.reject(e)}}}}})),He=c(Be(),1),Ue=c(Ve(),1),We=class{constructor(e,t){this.stanza=t,this.entity=e;let{name:n,attrs:r}=t,{type:i,id:a}=r;this.name=n,this.id=a||``,this.type=n===`message`?i||`normal`:n===`presence`?i||`available`:i||``,this.from=null,this.to=null,this.local=``,this.domain=``,this.resource=``}},Ge=class extends We{constructor(e,t){super(e,t);let{jid:n}=e,{domain:r}=e.options??{},i=t.attrs.to||n?.toString(),a=t.attrs.from||r;i&&(this.to=new xe(i)),a&&(this.from=new xe(a),this.local=this.from.local,this.domain=this.from.domain,this.resource=this.from.resource)}},Ke=class extends We{constructor(e,t){super(e,t);let{jid:n}=e,{domain:r}=e.options??{},i=t.attrs.from||n?.toString(),a=t.attrs.to||r;i&&(this.from=new xe(i)),a&&(this.to=new xe(a),this.local=this.to.local,this.domain=this.to.domain,this.resource=this.to.resource)}};function qe(e,t,n){return r=>{let i=new n(e,r);return(0,Ue.default)(t)(i)}}function Je(e){return(t,n)=>{n().then(t=>t&&e.send(t)).catch(t=>e.emit(`error`,t))}}function Ye({entity:e}){let t=[Je(e)],n=[],r=qe(e,t,Ge),i=qe(e,n,Ke);return e.on(`element`,r),e.on(`send`,i),{use(e){return t.push(e),e},filter(e){return n.push(e),e}}}function Xe({middleware:e}){function t(t,n,r){return e.use((e,i)=>{let{stanza:a}=e;if(!a.is(`features`,`http://etherx.jabber.org/streams`))return i();let o=a.getChild(t,n);return o?r(e,i,o):i()})}return{use:t}}function Ze(){let e;for(;!e;)e=Math.random().toString(36).slice(2,12);return e}var Qe=class extends Se{constructor(e,t,n,r){super(e,t,n),this.type=r,this.name=`StanzaError`}static fromElement(e){let t=super.fromElement(e);return t.type=e.attrs.type,t}};function $e({name:e,type:t}){return!(e!==`iq`||t!==`error`&&t!==`result`)}var et=class{constructor({entity:e,middleware:t}){this.handlers=new Map,this.entity=e,this.middleware=t}start(){this.middleware.use(this._route.bind(this))}_route({type:e,name:t,id:n,stanza:r},i){if(!$e({name:t,type:e}))return i();let a=this.handlers.get(n);if(!a)return i();e===`error`?a.reject(Qe.fromElement(r.getChild(`error`))):a.resolve(r),this.handlers.delete(n)}async request(e,t=3e4){e.attrs.id||(e.attrs.id=Ze());let n=new de;this.handlers.set(e.attrs.id,n);try{await this.entity.send(e),await E(n.promise,t)}catch(t){throw this.handlers.delete(e.attrs.id),t}return n.promise}_childRequest(e,t,n,...r){let{name:i,attrs:{xmlns:a}}=t;return this.request(O(`iq`,{type:e,to:n},t),...r).then(e=>e.getChild(i,a))}async get(...e){return this._childRequest(`get`,...e)}async set(...e){return this._childRequest(`set`,...e)}};function tt(...e){let t=new et(...e);return t.start(),t}var nt=`urn:ietf:params:xml:ns:xmpp-stanzas`;function rt({name:e,type:t}){return e===`iq`&&t!==`error`&&t!==`result`}function it({type:e},t,n){return!(e!==`get`&&e!==`set`||t.length!==1||!n)}function at({stanza:e}){return O(`iq`,{to:e.attrs.from,from:e.attrs.to,id:e.attrs.id})}function ot(e,t){let n=at(e);return n.attrs.type=`result`,t&&n.append(t),n}function st(e,t,n){let r=at(e);return r.attrs.type=`error`,n&&r.append(n),r.append(t),r}function ct(e,t){return O(`error`,{type:e},O(t,nt))}function lt(e){return async function(t,n){if(!rt(t))return n();let{stanza:r}=t,i=r.getChildElements(),[a]=i;if(!it(t,i,a))return st(t,ct(`modify`,`bad-request`),a);t.element=a;let o;try{o=await n()}catch(t){e.emit(`error`,t),o=ct(`cancel`,`internal-server-error`)}return o||=ct(`cancel`,`service-unavailable`),o instanceof O.Element&&o.is(`error`)?st(t,o,a):ot(t,o instanceof O.Element?o:void 0)}}function ut(e,t,n,r){return(i,a)=>i.type!==e|!i.element||!i.element.is(n,t)?a():r(i,a)}function dt({middleware:e,entity:t}){return e.use(lt(t)),{get(t,n,r){e.use(ut(`get`,t,n,r))},set(t,n,r){e.use(ut(`set`,t,n,r))}}}var ft=[`ENOTFOUND`,`ENODATA`];function pt(e,t={}){return t.all=!0,new Promise((n,r)=>{He.default.lookup(e,t,(e,t)=>{if(e)return r(e);let i=[];for(let{family:e,address:n}of t){let t=`://${e===4?n:`[`+n+`]`}:`;i.push({family:e,address:n,uri:`xmpps`+t+`5223`},{family:e,address:n,uri:`xmpp`+t+`5222`})}n(i)})})}function mt(e,{service:t,protocol:n}){return new Promise((r,i)=>{He.default.resolveSrv(`_${t}._${n}.${e}`,(e,a)=>{e&&ft.includes(e.code)?r([]):e?i(e):r(a.map(e=>Object.assign(e,{service:t,protocol:n})))})})}function ht(e){return e.toSorted((e,t)=>{let n=e.priority-t.priority;if(n!==0)return n;let r=t.weight-e.weight;return r===0?0:r})}function gt(e,t){let n=[];return Promise.all(e.map(async e=>{let r=await pt(e.name,t);for(let t of r){let{port:r,service:i}=e,a=t.address;n.push({...t,...e,uri:`${i.split(`-`)[0]}://${t.family===6?`[`+a+`]`:a}:${r}`})}})).then(()=>n)}function _t(e,t={}){t.srv||=[{service:`xmpps-client`,protocol:`tcp`},{service:`xmpp-client`,protocol:`tcp`},{service:`xmpps-server`,protocol:`tcp`},{service:`xmpp-server`,protocol:`tcp`},{service:`stun`,protocol:`tcp`},{service:`stun`,protocol:`udp`},{service:`stuns `,protcol:`tcp`},{service:`turn`,protocol:`tcp`},{service:`turn`,protocol:`udp`},{service:`turns`,protcol:`tcp`}];let n={options:t};return pt(e,t).then(r=>Promise.all(t.srv.map(r=>mt(e,{...r,family:n}).then(e=>gt(e,t)))).then(e=>[...ht(e.flat()),...r]))}function vt(e){let t=new me,n=null,r=null;if(t.on(`start`,e=>{n=e}),t.on(`element`,e=>{n.append(e)}),t.on(`error`,e=>{r=e}),t.write(e),t.end(),r)throw r;return n}function yt(e){return e.startsWith(`https`)||e.startsWith(`wss`)}function bt(e,t){let n;if(n=yt(e.uri)&&!yt(t.uri)?-1:!yt(e.uri)&&yt(t.uri)?1:0,n!==0)return n;let r;return r=e.method===t.method?0:e.method===`websocket`?-1:t.method===`websocket`?1:e.method===`xbosh`?-1:t.method===`xbosh`?1:e.method===`httppoll`?-1:+(t.method===`httppoll`),r===0?0:r}function xt(e){return fetch(`https://${e}/.well-known/host-meta`).then(e=>e.text()).then(e=>vt(e).getChildren(`Link`).filter(e=>[`urn:xmpp:alt-connections:websocket`,`urn:xmpp:alt-connections:httppoll`,`urn:xmpp:alt-connections:xbosh`].includes(e.attrs.rel)).map(({attrs:e})=>({rel:e.rel,href:e.href,method:e.rel.split(`:`).pop(),uri:e.href})).toSorted(bt)).catch(()=>[])}function St(...e){return Promise.all([_t?_t(...e):Promise.resolve([]),xt(...e)]).then(([e,t])=>[...e,...t])}async function Ct(e){let t=await St(e,{srv:[{service:`xmpps-client`,protocol:`tcp`},{service:`xmpp-client`,protocol:`tcp`}]});return[...new Set(t.map(e=>e.uri))]}function wt(e,t){return t.filter(t=>e._findTransport(t))}async function Tt(e,t){if(t.length===0)throw Error(`Couldn't connect`);let n=t.shift(),r=e._findTransport(n);if(!r)return Tt(e,t);e._status(`connecting`,n);let i=r.prototype.socketParameters(n),a=new r.prototype.Socket;try{a.connect(i),await ue(a,`connect`)}catch{return Tt(e,t)}e._attachSocket(a),a.emit(`connect`),e.Transport=r,e.Socket=r.prototype.Socket,e.Parser=r.prototype.Parser}function A({entity:e}){let t=e.connect;e.connect=async function(n){if(!n||/:\/\//.test(n))return t.call(this,n);let r=wt(e,await Ct(n));if(r.length===0)throw Error(`No compatible transport found.`);try{await Tt(e,r)}catch(t){throw await e.disconnect(),e._status(`disconnect`),t}}}function Et(e){return globalThis.btoa(e)}function Dt(e){return globalThis.atob(e)}var Ot=class extends Se{constructor(...e){super(...e),this.name=`SASLError`}},kt=`urn:ietf:params:xml:ns:xmpp-sasl`;function At(e,t,n){let r=new Set(e.getChildren(`mechanism`,t).map(e=>e.text()));return n._mechs.map(({name:e})=>e).filter(e=>r.has(e))}async function jt({saslFactory:e,entity:t,mechanism:n,credentials:r}){let i=e.create([n]);if(!i)throw Error(`SASL: Mechanism ${n} not found.`);let{domain:a}=t.options,o={username:null,password:null,server:a,host:a,realm:a,serviceType:`xmpp`,serviceName:a,...r};await D(t,i.clientFirst&&O(`auth`,{xmlns:kt,mechanism:i.name},Et(await i.response(o))),async(e,n)=>{if(e.getNS()===kt){if(e.name===`challenge`){await i.challenge(Dt(e.text()));let n=await i.response(o);await t.send(O(`response`,{xmlns:kt,mechanism:i.name},typeof n==`string`?Et(n):``));return}if(e.name===`failure`)throw Ot.fromElement(e);if(e.name===`success`)return n()}})}function Mt({streamFeatures:e,saslFactory:t},n){e.use(`mechanisms`,kt,async({entity:e},r,i)=>{let a=At(i,kt,t);if(a.length===0)throw new Ot(`SASL: No compatible mechanism available.`);async function o(n,r){await jt({saslFactory:t,entity:e,mechanism:r,credentials:n})}await n(o,a,null,e),await e.restart()})}var Nt=`urn:xmpp:sasl:2`;async function Pt({saslFactory:e,entity:t,mechanism:n,credentials:r,userAgent:i,streamFeatures:a,features:o}){let s=e.create([n]);if(!s)throw Error(`SASL: Mechanism ${n} not found.`);let{domain:c}=t.options,l={username:null,password:null,server:c,host:c,realm:c,serviceType:`xmpp`,serviceName:c,...r};await D(t,O(`authenticate`,{xmlns:Nt,mechanism:s.name},[s.clientFirst&&O(`initial-response`,{},Et(await s.response(l))),i,...a]),async(e,n)=>{if(e.getNS()===Nt){if(e.name===`challenge`){await s.challenge(Dt(e.text()));let n=await s.response(l);await t.send(O(`response`,{xmlns:Nt,mechanism:s.name},typeof n==`string`?Et(n):``));return}if(e.name===`failure`)throw Ot.fromElement(e);if(e.name===`continue`)throw Error(`SASL continue is not supported yet`);if(e.name===`success`){let r=e.getChild(`additional-data`)?.text();r&&s.final&&await s.final(Dt(r));let i=e.getChildText(`authorization-identifier`);i&&t._jid(i);for(let t of e.getChildElements())o.get(t.getNS())?.[1]?.(t);return n()}}})}function Ft({streamFeatures:e,saslFactory:t},n){let r=new Map,i;return e.use(`authentication`,Nt,async({entity:e},a,o)=>{let s=At(o,Nt,t),c=await It({element:o,features:r}),l=!!i?.mechanism;if(s.length===0&&!l)throw new Ot(`SASL: No compatible mechanism available.`);await n(u,s,l?i:null,e);async function u(n,a,o){await i.auth({authenticate:Pt,entity:e,userAgent:o,streamFeatures:c,features:r,credentials:n})||await Pt({entity:e,userAgent:o,streamFeatures:c,features:r,saslFactory:t,mechanism:a,credentials:n})}}),{use(e,t,n){r.set(e,[t,n])},setup({fast:e}){i=e}}}async function It({element:e,features:t}){let n=[],r=e.getChild(`inline`);if(!r)return n;for(let e of r.getChildElements()){let r=e.getNS(),i=t.get(r);i&&n.push(i[0](e))}return Promise.all(n)}var Lt=`urn:ietf:params:xml:ns:xmpp-bind`;function Rt(e){return O(`bind`,{xmlns:Lt},e&&O(`resource`,{},e))}async function zt(e,t,n){let r=(await t.set(Rt(n))).getChildText(`jid`);return e._jid(r),e._ready(!1),r}function Bt({iqCaller:e},t){return async({entity:n},r)=>{t=typeof t==`function`?await t():t,await zt(n,e,t),r()}}function Vt({streamFeatures:e,iqCaller:t},n){e.use(`bind`,Lt,Bt({iqCaller:t},n))}function Ht(e=new Date){return typeof e==`string`&&(e=new Date(e)),new Date(e).toISOString().split(`.`)[0]+`Z`}function Ut({bind2:e,sm:t,failed:n,enabled:r}){e.use(Jt,e=>Yt({sm:t}),async e=>{e.is(`enabled`)?r(e.attrs):e.is(`failed`)&&n()})}function Wt({sasl2:e,sm:t,failed:n,resumed:r}){e.use(Jt,e=>{if(e.is(`sm`)&&t.id)return Xt({sm:t})},e=>{e.is(`resumed`)?r(e):e.is(`failed`)&&n()})}function Gt({streamFeatures:e,sm:t,entity:n,resumed:r,failed:i,enabled:a}){e.use(`sm`,Jt,async(e,o)=>{if(t.id)try{await r(await qt(n,t));return}catch{i()}await o();let s=Kt(n,t);if(t.outbound_q.length>0)throw Error(`Stream Management assertion failure, queue should be empty after enable`);t.outbound=0;try{a((await s).attrs)}catch{t.enabled=!1,t.enableSent=!1}})}function Kt(e,t){return D(e,Yt({sm:t}),(e,t)=>{if(e.is(`enabled`,`urn:xmpp:sm:3`))return t(e);if(e.is(`failed`,`urn:xmpp:sm:3`))throw Se.fromElement(e)})}async function qt(e,t){return D(e,Xt({sm:t}),(e,t)=>{if(e.is(`resumed`,`urn:xmpp:sm:3`))return t(e);if(e.is(`failed`,`urn:xmpp:sm:3`))throw Se.fromElement(e)})}var Jt=`urn:xmpp:sm:3`;function Yt({sm:e}){return O(`enable`,{xmlns:Jt,max:e.preferredMaximum,resume:`true`})}function Xt({sm:e}){return O(`resume`,{xmlns:Jt,h:e.inbound,previd:e.id})}function j({streamFeatures:e,entity:t,middleware:n,bind2:r,sasl2:i}){let a=null,o=null,s=null,c=new ie.EventEmitter;Object.assign(c,{preferredMaximum:null,enabled:!1,enableSent:!1,id:``,outbound_q:[],outbound:0,inbound:0,max:null,timeout:6e4,requestAckInterval:3e4,requestAckDebounce:250});async function l(){try{await t.send(O(`a`,{xmlns:Jt,h:c.inbound}))}catch{}}t.on(`disconnect`,()=>{clearTimeout(a),clearTimeout(o),clearTimeout(s),c.enabled=!1,c.enableSent=!1}),t.hook(`close`,async()=>{c.enabled&&await l()});async function u(e){c.enabled=!0,f(+e.attrs.h);let n=c.outbound_q;c.outbound_q=[],await t.sendMany(n.map(e=>Zt({entity:t,item:e}))),c.emit(`resumed`),t._ready(!0),h()}function d(){c.enabled=!1,c.enableSent=!1,c.id=``,p()}function f(e){let t=c.outbound;for(let n=0;n<+e-t;n++){let e=c.outbound_q.shift();c.outbound++,c.emit(`ack`,e.stanza)}}function p(){let e;for(;e=c.outbound_q.shift();)c.emit(`fail`,e.stanza);c.outbound=0}function m({id:e,max:t}){c.enabled=!0,c.id=e,c.max=t,c.inbound=0,h()}t.on(`offline`,()=>{p(),c.inbound=0,c.enabled=!1,c.enableSent=!1,c.id=``}),n.use(async(e,t)=>{let{stanza:n}=e;return clearTimeout(a),a=null,[`presence`,`message`,`iq`].includes(n.name)?c.inbound+=1:n.is(`r`,`urn:xmpp:sm:3`)?await l():n.is(`a`,`urn:xmpp:sm:3`)&&f(+n.attrs.h),h(),t()}),r&&Ut({bind2:r,sm:c,failed:d,enabled:m}),i&&Wt({sasl2:i,sm:c,failed:d,resumed:u});function h(e=c.requestAckInterval){clearTimeout(o),c.enabled&&e&&(o=setTimeout(g,e))}function g(){clearTimeout(o),clearTimeout(s),c.enabled&&(c.timeout&&!a&&(a=setTimeout(()=>{clearTimeout(o),t.disconnect().catch(()=>{})},c.timeout)),t.send(O(`r`,{xmlns:Jt})).catch(()=>{}),h())}return n.filter((e,t)=>{let{stanza:n}=e;return n.is(`enable`,`urn:xmpp:sm:3`)&&(c.enableSent=!0),!c.enabled&&!c.enableSent||![`presence`,`message`,`iq`].includes(n.name)?t():(c.outbound_q.push({stanza:n,stamp:Ht()}),clearTimeout(o),clearTimeout(s),s=setTimeout(g,c.requestAckDebounce),t())}),e&&Gt({streamFeatures:e,sm:c,entity:t,resumed:u,failed:d,enabled:m}),c}function Zt({entity:e,item:t}){let{stanza:n,stamp:r}=t;return n.name===`message`&&!n.getChild(`delay`,`urn:xmpp:delay`)&&n.append(O(`delay`,{xmlns:`urn:xmpp:delay`,from:e.jid.toString(),stamp:r})),n}var Qt=`urn:xmpp:bind:0`;function $t({sasl2:e,entity:t},n){let r=new Map;return e.use(Qt,async e=>{if(!e.is(`bind`,Qt))return;n=typeof n==`function`?await n():n;let t=await en({element:e,features:r});return O(`bind`,{xmlns:`urn:xmpp:bind:0`},n&&O(`tag`,null,n),...t)},e=>{if(e.is(`bound`)){t._ready(!1);for(let t of e.getChildElements())r.get(t.getNS())?.[1]?.(t)}}),{use(e,t,n){r.set(e,[t,n])}}}function en({element:e,features:t}){let n=[],r=e.getChild(`inline`);if(!r)return n;for(let e of r.getChildElements()){let r=e.attrs.var,i=t.get(r);i&&n.push(i[0](e))}return Promise.all(n)}var tn=o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t):typeof define==`function`&&define.amd&&define([`exports`,`module`],r)})(e,function(e,t){function n(){this._mechs=[]}n.prototype.use=function(e,t){return t||(t=e,e=t.prototype.name),this._mechs.push({name:e,mech:t}),this},n.prototype.create=function(e){for(var t=0,n=this._mechs.length;t<n;t++)for(var r=0,i=e.length;r<i;r++){var a=this._mechs[t];if(a.name==e[r])return new a.mech}return null},e=t.exports=n})})),nn=c(o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t,tn()):typeof define==`function`&&define.amd&&define([`exports`,`module`,`./lib/factory`],r)})(e,function(e,t,n){e=t.exports=n,e.Factory=n})}))(),1),rn=`urn:xmpp:fast:0`;function an({sasl2:e,entity:t}){let n=new nn.default,r,i=new ie.EventEmitter;Object.assign(i,{mechanism:null,mechanisms:[],async saveToken(e){r=e},async fetchToken(){return r},async deleteToken(){r=null},async save(e){try{await this.saveToken(e)}catch(e){t.emit(`error`,e)}},async fetch(){try{return this.fetchToken()}catch(e){t.emit(`error`,e)}},async delete(){try{await this.deleteToken()}catch(e){t.emit(`error`,e)}},saslFactory:n,async auth({authenticate:e,entity:t,userAgent:n,credentials:r,streamFeatures:o,features:s}){if(!i.mechanism)return!1;let{token:c}=r;if(!on(c,i.mechanisms))return l();try{return await e({saslFactory:i.saslFactory,mechanism:c.mechanism,credentials:{...r,password:c.token},streamFeatures:[...o,O(`fast`,{xmlns:rn})],entity:t,userAgent:n,features:s}),!0}catch(e){return e instanceof Ot&&[`not-authorized`,`credentials-expired`].includes(e.condition)?l():(t.emit(`error`,e),!1)}async function l(){return await i.delete(),a(o),!1}}});function a(e){e.push(O(`request-token`,{xmlns:rn,mechanism:i.mechanism}))}function o(){i.mechanism=null,i.mechanisms=[]}return o(),e.use(rn,async e=>{if(!e.is(`fast`,rn))return o();i.available=!0;let t=At(e,rn,n),r=t[0];if(!r)return o();i.mechanisms=t,i.mechanism=r},async e=>{e.is(`token`,rn)&&await i.save({mechanism:i.mechanism,token:e.attrs.token,expiry:e.attrs.expiry})}),i}function on(e,t){return!(!e||!t.includes(e.mechanism)||new Date(e.expiry)<=new Date)}var sn=o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t):typeof define==`function`&&define.amd&&define([`exports`,`module`],r)})(e,function(e,t){function n(){}n.prototype.name=`PLAIN`,n.prototype.clientFirst=!0,n.prototype.response=function(e){var t=``;return t+=e.authzid||``,t+=`\0`,t+=e.username,t+=`\0`,t+=e.password,t},n.prototype.challenge=function(e){return this},e=t.exports=n})})),cn=c(o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t,sn()):typeof define==`function`&&define.amd&&define([`exports`,`module`,`./lib/mechanism`],r)})(e,function(e,t,n){e=t.exports=n,e.Mechanism=n})}))(),1);function ln(e){e.use(cn.default)}var un=o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t):typeof define==`function`&&define.amd&&define([`exports`,`module`],r)})(e,function(e,t){function n(){}n.prototype.name=`ANONYMOUS`,n.prototype.clientFirst=!0,n.prototype.response=function(e){return e.trace||``},n.prototype.challenge=function(e){},e=t.exports=n})})),dn=c(o(((e,t)=>{(function(n,r){typeof e==`object`?r(e,t,un()):typeof define==`function`&&define.amd&&define([`exports`,`module`,`./lib/mechanism`],r)})(e,function(e,t,n){e=t.exports=n,e.Mechanism=n})}))(),1);function fn(e){e.use(dn.default)}function pn(){}pn.prototype.Mechanism=pn,pn.prototype.name=`HT-SHA-256-NONE`,pn.prototype.clientFirst=!0,pn.prototype.response=async function({username:e,password:t}){this.key=await crypto.subtle.importKey(`raw`,new TextEncoder().encode(t),{name:`HMAC`,hash:`SHA-256`},!1,[`sign`,`verify`]);let n=await crypto.subtle.sign(`HMAC`,this.key,new TextEncoder().encode(`Initiator`));return`${e}\0${String.fromCodePoint(...new Uint8Array(n))}`},pn.prototype.final=async function(e){let t=Uint8Array.from(e,e=>e.codePointAt(0));if(await crypto.subtle.verify(`HMAC`,this.key,t,new TextEncoder().encode(`Responder`))!==!0)throw Error(`Responder message from server was wrong`)};function mn(e){e.use(pn)}var hn=`ANONYMOUS`,gn=`PLAIN`;function _n(e,t){return async function(...n){if(typeof e==`function`){await e(...n);return}let[r,i,a,o]=n;e.token??=await a?.fetch(),await r(e,vn({mechanisms:i,entity:o,credentials:e}),t)}}function vn({mechanisms:e,entity:t,credentials:n}){return!n?.username&&!n?.password&&!n?.token&&e.includes(hn)?hn:t.isSecure()?e[0]:e.find(e=>e!==gn)}function yn(e){return(e.split(`://`)[1]||e).split(`:`)[0].split(`/`)[0]}function bn(e={}){let{resource:t,credentials:n,username:r,password:i,userAgent:a,...o}=e,{domain:s,service:c}=o;!s&&c&&(o.domain=yn(c));let l=new Ae(o);r&&o.domain&&(l.jid=xe(r,o.domain));let u=Me({entity:l}),d=ze({entity:l}),f=xn(He.default,{entity:l}),p=xn(He.default,{entity:l}),m=Ye({entity:l}),h=Xe({middleware:m}),g=tt({middleware:m,entity:l}),_=dt({middleware:m,entity:l}),v=A({entity:l}),y=new nn.default,b=Object.entries({...typeof He.default==`function`&&{scramsha1:He.default},plain:ln,anonymous:fn}).map(([e,t])=>({[e]:t(y)}));a??=O(`user-agent`,{id:globalThis.crypto.randomUUID()});let x=xn(He.default,{streamFeatures:h}),S=Ft({streamFeatures:h,saslFactory:y},_n(n??{username:r,password:i},a)),C=an({sasl2:S,entity:l});S.setup({fast:C});let w=$t({sasl2:S,entity:l},t);mn(C.saslFactory);let T=Mt({streamFeatures:h,saslFactory:y},_n(n??{username:r,password:i},a)),ee=j({streamFeatures:h,entity:l,middleware:m,bind2:w,sasl2:S}),te=Vt({iqCaller:g,streamFeatures:h},t);return _?.get(`urn:xmpp:ping`,`ping`,()=>({})),Object.assign(l,{entity:l,reconnect:u,tcp:f,websocket:d,tls:p,middleware:m,streamFeatures:h,iqCaller:g,iqCallee:_,resolve:v,starttls:x,saslFactory:y,sasl2:S,sasl:T,resourceBinding:te,streamManagement:ee,mechanisms:b,bind2:w,fast:C})}function xn(e,...t){if(typeof e==`function`)return e(...t)}var M={carbons:`urn:xmpp:carbons:2`,forward:`urn:xmpp:forward:0`,mam:`urn:xmpp:mam:2`,rsm:`http://jabber.org/protocol/rsm`,sid:`urn:xmpp:sid:0`,hints:`urn:xmpp:hints`,chatstates:`http://jabber.org/protocol/chatstates`,oob:`jabber:x:oob`,upload:`urn:xmpp:http:upload:0`,delay:`urn:xmpp:delay`,disco:`http://jabber.org/protocol/disco#items`,discoInfo:`http://jabber.org/protocol/disco#info`,push:`urn:xmpp:push:0`,hello:`urn:nethvoice:chat:presence`,data:`jabber:x:data`,muc:`http://jabber.org/protocol/muc`,mucOwner:`http://jabber.org/protocol/muc#owner`,mucAdmin:`http://jabber.org/protocol/muc#admin`,mucsub:`urn:xmpp:mucsub:0`,pubsubEvent:`http://jabber.org/protocol/pubsub#event`,mucsubMessages:`urn:xmpp:mucsub:nodes:messages`,mucsubConfig:`urn:xmpp:mucsub:nodes:config`,mucUser:`http://jabber.org/protocol/muc#user`,conference:`jabber:x:conference`,vcard:`vcard-temp`,ping:`urn:xmpp:ping`,reactions:`urn:xmpp:reactions:0`},Sn=3e4,Cn=class{xmpp;me;domain;mucHost;uploadService;mamQueries=new Map;mamReactions=new Map;stopped=!1;attempt=0;retryTimer;pingTimer;unauthorized=!1;connected=!1;online=new Map;cfg;h;constructor(e,t){this.cfg=e,this.h=t,this.domain=e.host,this.mucHost=`conference.${e.host}`,this.me=`${e.username}@${e.host}`,this.xmpp=bn({service:`wss://${e.host}/xmpp-websocket`,domain:e.host,username:e.username,password:e.token,resource:`chat-island.`+Math.random().toString(36).slice(2,8)}),this.xmpp.reconnect?.stop(),this.xmpp.on(`status`,e=>{this.stopped||this.unauthorized||((e===`connecting`||e===`opening`||e===`connect`)&&this.h.status(`connecting`),(e===`disconnect`||e===`close`)&&(this.connected=!1,window.clearInterval(this.pingTimer),this.forgetPresence(),this.h.status(`offline`)),e===`disconnect`&&this.scheduleRetry())}),this.xmpp.on(`error`,e=>{if(!this.stopped){if(wn(e)){this.unauthorized=!0,window.clearTimeout(this.retryTimer),this.h.status(`unauthorized`,e.message);return}this.h.status(`error`,e.message)}}),this.xmpp.on(`online`,async()=>{if(this.stopped){await this.xmpp.stop().catch(()=>{});return}this.attempt=0,this.connected=!0;try{await this.xmpp.send(O(`iq`,{type:`set`,id:`carbons`},O(`enable`,{xmlns:M.carbons}))),await this.xmpp.send(O(`presence`))}catch{return}window.clearInterval(this.pingTimer),this.pingTimer=window.setInterval(()=>this.ping(),Sn),this.h.status(`online`)}),this.xmpp.on(`stanza`,e=>this.onStanza(e))}start(){window.addEventListener(`online`,this.wake),document.addEventListener(`visibilitychange`,this.onVisible),this.h.status(`connecting`),setTimeout(()=>this.connectNow(),0)}stop(){return this.stopped=!0,window.clearTimeout(this.retryTimer),window.clearInterval(this.pingTimer),window.removeEventListener(`online`,this.wake),document.removeEventListener(`visibilitychange`,this.onVisible),this.xmpp.stop().catch(()=>{})}wake=()=>{if(!(this.stopped||this.unauthorized)){if(this.connected){this.ping();return}window.clearTimeout(this.retryTimer),this.attempt=0,this.connectNow()}};onVisible=()=>{document.visibilityState===`visible`&&this.wake()};ping(){this.connected&&this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:this.domain},O(`ping`,{xmlns:M.ping})),1e4).catch(e=>{!this.stopped&&this.connected&&e.name!==`StanzaError`&&this.xmpp.disconnect().catch(()=>{})})}forgetPresence(){for(let e of this.online.keys())this.h.presence(e,!1);this.online.clear()}connectNow(){if(this.stopped||this.unauthorized)return;this.retryTimer=void 0;let e=this.xmpp;(e.status===`offline`?this.xmpp.start():e.connect(e.options.service).then(()=>e.open({domain:e.options.domain}))).catch(e=>{if(!this.stopped){if(wn(e)){this.unauthorized=!0,this.h.status(`unauthorized`,e.message);return}this.h.status(`error`,e.message),this.scheduleRetry()}})}scheduleRetry(){if(this.stopped||this.unauthorized||this.retryTimer!==void 0)return;let e=Math.min(6e4,1e3*2**this.attempt)*(.7+Math.random()*.6);this.attempt++,this.retryTimer=window.setTimeout(()=>this.connectNow(),e)}isGroup(e){return e.endsWith(`@`+this.mucHost)}async send(e,t,n){let r=crypto.randomUUID(),i=[O(`body`,{},t),O(`origin-id`,{xmlns:M.sid,id:r}),O(`store`,{xmlns:M.hints})];return n&&i.push(O(`x`,{xmlns:M.oob},O(`url`,{},n))),this.isGroup(e)?(await this.xmpp.send(O(`message`,{to:e,type:`groupchat`,id:r},...i)),{id:r,oid:r,from:e,to:this.cfg.username,body:t,ts:Date.now(),mine:!0,oob:n,room:e,nick:this.cfg.username}):(i.push(O(`active`,{xmlns:M.chatstates})),await this.xmpp.send(O(`message`,{to:`${e}@${this.domain}`,type:`chat`,id:r},...i)),{id:r,oid:r,from:this.cfg.username,to:e,body:t,ts:Date.now(),mine:!0,oob:n})}async react(e,t,n){let r=this.isGroup(e),i=O(`reactions`,{xmlns:M.reactions,id:t},...n.map(e=>O(`reaction`,{},e)));await this.xmpp.send(O(`message`,{to:r?e:`${e}@${this.domain}`,type:r?`groupchat`:`chat`,id:crypto.randomUUID()},i,O(`store`,{xmlns:M.hints})))}async announce(e){for(let t of e)await this.xmpp.send(O(`presence`,{to:`${t}@${this.domain}`},O(`x`,{xmlns:M.hello}))).catch(()=>{})}typing(e,t){return this.isGroup(e)?Promise.resolve():this.xmpp.send(O(`message`,{to:`${e}@${this.domain}`,type:`chat`},O(t?`composing`:`paused`,{xmlns:M.chatstates})))}enablePush(e,t){return this.xmpp.iqCaller.request(O(`iq`,{type:`set`},O(`enable`,{xmlns:M.push,jid:e,node:t})),15e3)}disablePush(e,t){return this.xmpp.iqCaller.request(O(`iq`,{type:`set`},O(`disable`,{xmlns:M.push,jid:e,node:t})),5e3)}async recent(e=200){return this.mam(void 0,void 0,e)}history(e,t,n=30){return this.mam(e,t,n)}async mam(e,t,n){let r=crypto.randomUUID();this.mamQueries.set(r,[]),this.mamReactions.set(r,[]);let i=O(`set`,{xmlns:M.rsm},O(`max`,{},String(n)),O(`before`,{},t??``)),a=[O(`field`,{var:`FORM_TYPE`,type:`hidden`},O(`value`,{},M.mam))];e&&a.push(O(`field`,{var:`with`},O(`value`,{},this.isGroup(e)?e:`${e}@${this.domain}`)));let o=O(`x`,{xmlns:M.data,type:`submit`},...a),s,c,l;try{s=await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,id:r},O(`query`,{xmlns:M.mam,queryid:r},o,i)),3e4)}finally{c=this.mamQueries.get(r)??[],l=this.mamReactions.get(r)??[],this.mamQueries.delete(r),this.mamReactions.delete(r)}let u=s.getChild(`fin`,M.mam),d=u?.getChild(`set`,M.rsm)?.getChildText(`first`)??void 0;return{messages:c,reactions:l,complete:u?.attrs.complete===`true`,first:d}}async createGroup(e,t,n){let r=`g-${Math.random().toString(36).slice(2,10)}@${this.mucHost}`,i=this.cfg.username,a=this.waitFor(e=>e.is(`presence`)&&N(e.attrs.from)===r,1e4);await this.xmpp.send(O(`presence`,{to:`${r}/${i}`},O(`x`,{xmlns:M.muc}))),await a;let o=(e,t)=>O(`field`,{var:e},O(`value`,{},t));await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:r},O(`query`,{xmlns:M.mucOwner},O(`x`,{xmlns:M.data,type:`submit`},o(`FORM_TYPE`,`http://jabber.org/protocol/muc#roomconfig`),o(`muc#roomconfig_roomname`,e),o(`muc#roomconfig_persistentroom`,`1`),o(`muc#roomconfig_membersonly`,`1`),o(`muc#roomconfig_publicroom`,`0`),o(`muc#roomconfig_whois`,`anyone`),o(`allow_subscription`,`1`),o(`mam`,`1`)))),15e3),n&&await this.setGroupAvatar(r,n).catch(()=>{});let s=t.filter(e=>e&&e!==this.cfg.username);await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:r},O(`query`,{xmlns:M.mucAdmin},...s.map(e=>O(`item`,{affiliation:`member`,jid:`${e}@${this.domain}`})))),15e3);for(let e of s)await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:r},O(`subscribe`,{xmlns:M.mucsub,jid:`${e}@${this.domain}`,nick:e},O(`event`,{node:M.mucsubMessages}),O(`event`,{node:M.mucsubConfig}))),15e3).catch(()=>{});await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:r},O(`subscribe`,{xmlns:M.mucsub,nick:i},O(`event`,{node:M.mucsubMessages}),O(`event`,{node:M.mucsubConfig}))),15e3),await this.xmpp.send(O(`presence`,{to:`${r}/${i}`,type:`unavailable`}));for(let t of s)await this.xmpp.send(O(`message`,{to:`${t}@${this.domain}`},O(`x`,{xmlns:M.conference,jid:r,reason:e}))).catch(()=>{});return r}async leaveGroup(e,t){t?await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:e},O(`query`,{xmlns:M.mucOwner},O(`destroy`,{}))),1e4):await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:e},O(`unsubscribe`,{xmlns:M.mucsub})),1e4)}async setGroupAvatar(e,t){let n=/^data:(image\/[a-z+]+);base64,(.+)$/i.exec(t);n&&await this.xmpp.iqCaller.request(O(`iq`,{type:`set`,to:e},O(`vCard`,{xmlns:M.vcard},O(`PHOTO`,{},O(`TYPE`,{},n[1]),O(`BINVAL`,{},n[2])))),15e3)}async groupAvatar(e){let t=(await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`vCard`,{xmlns:M.vcard})),1e4)).getChild(`vCard`,M.vcard)?.getChild(`PHOTO`),n=t?.getChildText(`BINVAL`);return n?`data:${t?.getChildText(`TYPE`)||`image/jpeg`};base64,${n.replace(/\s+/g,``)}`:void 0}async listGroups(){let e=((await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:this.mucHost},O(`subscriptions`,{xmlns:M.mucsub})),15e3)).getChild(`subscriptions`,M.mucsub)?.getChildren(`subscription`)??[]).map(e=>e.attrs.jid);return Promise.all(e.map(e=>this.groupInfo(e)))}async subscribed(e){return((await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:this.mucHost},O(`subscriptions`,{xmlns:M.mucsub})),15e3)).getChild(`subscriptions`,M.mucsub)?.getChildren(`subscription`)??[]).some(t=>N(t.attrs.jid)===e)}async groupInfo(e){let t=e.split(`@`)[0],n=[],r=!1;try{t=(await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`query`,{xmlns:M.discoInfo})),1e4)).getChild(`query`,M.discoInfo)?.getChild(`identity`)?.attrs.name||t}catch{}try{n=((await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`query`,{xmlns:M.mucAdmin},O(`item`,{affiliation:`member`}))),1e4)).getChild(`query`,M.mucAdmin)?.getChildren(`item`)??[]).map(e=>Tn(e.attrs.jid));let t=await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`query`,{xmlns:M.mucAdmin},O(`item`,{affiliation:`owner`}))),1e4);for(let e of t.getChild(`query`,M.mucAdmin)?.getChildren(`item`)??[])n.push(Tn(e.attrs.jid)),Tn(e.attrs.jid)===this.cfg.username&&(r=!0)}catch{}let i=await this.groupAvatar(e).catch(()=>void 0);return{peer:e,name:t,members:[...new Set(n)],avatar:i,owner:r}}async upload(e){let t=await this.findUploadService(),n=(await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:t},O(`request`,{xmlns:M.upload,filename:e.name,size:String(e.size),"content-type":e.type||`application/octet-stream`})),3e4)).getChild(`slot`,M.upload),r=n?.getChild(`put`),i=n?.getChild(`get`)?.attrs.url;if(!r||!i)throw Error(`upload: no slot`);let a={"Content-Type":e.type||`application/octet-stream`};for(let e of r.getChildren(`header`))a[e.attrs.name]=e.text();let o=await fetch(r.attrs.url,{method:`PUT`,headers:a,body:e});if(!o.ok)throw Error(`upload: HTTP ${o.status}`);return i}async findUploadService(){if(this.uploadService)return this.uploadService;let e=async e=>{try{return(await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:e},O(`query`,{xmlns:M.discoInfo})),1e4)).getChild(`query`,M.discoInfo)?.getChildren(`feature`).some(e=>e.attrs.var===M.upload)??!1}catch{return!1}},t=[`upload.${this.domain}`];try{let e=await this.xmpp.iqCaller.request(O(`iq`,{type:`get`,to:this.domain},O(`query`,{xmlns:M.disco})),1e4);for(let n of e.getChild(`query`,M.disco)?.getChildren(`item`)??[])t.includes(n.attrs.jid)||t.push(n.attrs.jid)}catch{}for(let n of t)if(await e(n))return this.uploadService=n,n;throw Error(`upload: service not found`)}waiters=[];waitFor(e,t){return new Promise((n,r)=>{let i={test:e,resolve:n};this.waiters.push(i),setTimeout(()=>{let e=this.waiters.indexOf(i);e>=0&&(this.waiters.splice(e,1),r(Error(`timeout`)))},t)})}onStanza(e){for(let t of[...this.waiters])t.test(e)&&(this.waiters.splice(this.waiters.indexOf(t),1),t.resolve());if(e.is(`presence`)){let t=e.attrs.from??``,n=N(t);if(!n||n===this.me||n.endsWith(`@`+this.mucHost)||e.attrs.type===`error`||e.attrs.type?.startsWith(`subscribe`))return;let r=Tn(n),i=this.online.get(r)??new Set;e.attrs.type===`unavailable`?i.delete(t):i.add(t),this.online.set(r,i),this.h.presence(r,i.size>0);let a=e.getChild(`x`,M.hello);a&&!a.attrs.reply&&e.attrs.type!==`unavailable`&&this.xmpp.send(O(`presence`,{to:n},O(`x`,{xmlns:M.hello,reply:`1`}))).catch(()=>{});return}if(!e.is(`message`))return;let t=!e.attrs.from||N(e.attrs.from)===this.me,n=e.getChild(`result`,M.mam);if(n){if(!t)return;let e=n.getChild(`forwarded`,M.forward)?.getChild(`message`),r=this.mamQueries.get(n.attrs.queryid);if(e&&r){let t=this.reactionOf(e);t&&this.mamReactions.get(n.attrs.queryid)?.push(t);let i=t?void 0:this.toMessage(e,n.attrs.id,En(n.getChild(`forwarded`,M.forward)));i&&r.push(i)}return}let r=e.getChild(`received`,M.carbons)??e.getChild(`sent`,M.carbons);if(r){if(!t)return;let e=r.getChild(`forwarded`,M.forward)?.getChild(`message`);e&&this.deliver(e);return}let i=e.getChild(`event`,M.pubsubEvent);if(i?.getChild(`items`)?.attrs.node===M.mucsubConfig){let t=N(e.attrs.from);this.isGroup(t)&&Dn(i,`presence`)?.getChild(`x`,M.mucUser)?.getChild(`destroy`)&&this.h.groupDestroyed(t);return}let a=e.getChild(`x`,M.conference);if(a){let e=N(a.attrs.jid);this.isGroup(e)&&this.h.groupInvite(e);return}this.deliver(e)}deliver(e){let t=this.reactionOf(e);if(t){this.h.reaction(t);return}let n=this.toMessage(e,e.getChild(`stanza-id`,M.sid)?.attrs.id,En(e));if(n){this.h.message(n);return}if(e.attrs.type!==`chat`)return;let r=N(e.attrs.from),i=r===this.me?N(e.attrs.to):r,a=e.getChildByAttr(`xmlns`,M.chatstates);!e.getChild(`body`)&&a&&this.h.typing(Tn(i),a.name===`composing`)}reactionOf(e){let t=e.getChild(`event`,M.pubsubEvent),n=e,r;if(t&&t.getChild(`items`)?.attrs.node===M.mucsubMessages){r=N(e.attrs.from);let i=On(t);if(!this.isGroup(r)||!i||N(i.attrs.from)!==r)return;n=i}else if(e.attrs.type===`groupchat`&&(r=N(e.attrs.from),!this.isGroup(r)))return;let i=n.getChild(`reactions`,M.reactions),a=i?.attrs.id;if(!i||!a)return;let o=[...new Set(i.getChildren(`reaction`).map(e=>e.text().trim()).filter(e=>e&&e.length<=16))].slice(0,5);if(r){let e=(n.attrs.from??``).split(`/`)[1]??``;return e?{peer:r,target:a,user:e,emojis:o}:void 0}if(n.attrs.type!==`chat`)return;let s=N(n.attrs.from),c=s===this.me||!n.attrs.from,l=Tn(c?N(n.attrs.to):s);return l?{peer:l,target:a,user:c?this.cfg.username:Tn(s),emojis:o}:void 0}toMessage(e,t,n){let r=e.getChild(`event`,M.pubsubEvent);if(r&&r.getChild(`items`)?.attrs.node===M.mucsubMessages){let i=N(e.attrs.from);if(!this.isGroup(i))return;let a=On(r);if(!a||N(a.attrs.from)!==i)return;let o=(a.attrs.from??``).split(`/`)[1]??``,s=a.getChildText(`body`);return s==null?void 0:{id:a.getChild(`origin-id`,M.sid)?.attrs.id??t??a.getChild(`stanza-id`,M.sid)?.attrs.id??a.attrs.id??crypto.randomUUID(),oid:a.getChild(`origin-id`,M.sid)?.attrs.id??a.attrs.id,from:i,to:this.cfg.username,body:s,ts:En(a)!==n&&a.getChild(`delay`,M.delay)?En(a):n,mine:o===this.cfg.username,oob:a.getChild(`x`,M.oob)?.getChildText(`url`)??void 0,room:i,nick:o}}let i=e.getChildText(`body`);if(i==null)return;let a=N(e.attrs.from);if(e.attrs.type===`groupchat`){if(!this.isGroup(a))return;let r=(e.attrs.from??``).split(`/`)[1]??``;return{id:t??e.getChild(`origin-id`,M.sid)?.attrs.id??e.attrs.id??crypto.randomUUID(),oid:e.getChild(`origin-id`,M.sid)?.attrs.id??e.attrs.id,from:a,to:this.cfg.username,body:i,ts:n,mine:r===this.cfg.username,oob:e.getChild(`x`,M.oob)?.getChildText(`url`)??void 0,room:a,nick:r}}if(e.attrs.type!==`chat`)return;let o=a===this.me;return{id:t??e.getChild(`origin-id`,M.sid)?.attrs.id??e.attrs.id??crypto.randomUUID(),oid:e.getChild(`origin-id`,M.sid)?.attrs.id??e.attrs.id,from:Tn(a),to:Tn(N(e.attrs.to)),body:i,ts:n,mine:o,oob:e.getChild(`x`,M.oob)?.getChildText(`url`)??void 0}}},N=(e=``)=>e.split(`/`)[0],wn=e=>e.name===`SASLError`||e.condition===`not-authorized`,Tn=(e=``)=>e.split(`@`)[0],En=e=>{let t=e?.getChild(`delay`,M.delay)?.attrs.stamp;return t?Date.parse(t):Date.now()};function Dn(e,t){for(let n of e.children){if(typeof n==`string`)continue;if(n.name===t)return n;let e=Dn(n,t);if(e)return e}}var On=e=>Dn(e,`message`),kn;function An(){try{kn??=new AudioContext,kn.state===`suspended`&&kn.resume();let e=kn.currentTime;for(let[t,n,r]of[[880,0,.09],[1174.7,.1,.16]]){let i=kn.createOscillator(),a=kn.createGain();i.type=`sine`,i.frequency.value=t,a.gain.setValueAtTime(1e-4,e+n),a.gain.exponentialRampToValueAtTime(.12,e+n+.01),a.gain.exponentialRampToValueAtTime(1e-4,e+n+r),i.connect(a).connect(kn.destination),i.start(e+n),i.stop(e+n+r+.02)}}catch{}}var jn=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},Mn=e=>e?jn(e):jn,Nn=o((e=>{var t=u();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Pn=o(((e,t)=>{t.exports=Nn()})),Fn=o((e=>{var t=u(),n=Pn();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),In=c(o(((e,t)=>{t.exports=Fn()}))(),1),{useDebugValue:Ln}=g.default,{useSyncExternalStoreWithSelector:Rn}=In.default,zn=e=>e;function Bn(e,t=zn,n){let r=Rn(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ln(r),r}var Vn=e=>{let t=typeof e==`function`?Mn(e):e,n=(e,n)=>Bn(t,e,n);return Object.assign(n,t),n},Hn=e=>e?Vn(e):Vn,Un=e=>e.room??(e.mine?e.to:e.from),Wn=(e,t)=>({peer:e,kind:t&&e.endsWith(`@`+t)?`group`:`chat`,messages:[],unread:0,typing:!1,loaded:!1,complete:!1}),Gn=(e,t,n,r)=>{if(e.includes(t))return e;let i=[t,...e];if(i.length<=n)return i;let a=[...i].reverse().find(e=>e!==r);return i.filter(e=>e!==a)},P=Hn((e,t)=>({me:``,mucHost:``,status:`connecting`,contacts:{},online:{},mobile:{},conversations:{},order:[],open:null,picker:!1,push:`unavailable`,enablePush:()=>{},maxHeads:5,newChatButton:!0,setStatus:(t,n)=>e({status:t,error:n}),reset:()=>e({status:`connecting`,error:void 0,contacts:{},online:{},mobile:{},conversations:{},order:[],open:null,picker:!1}),setContacts:t=>e({contacts:Object.fromEntries(t.filter(e=>e?.username).map(e=>[e.username,{...e,name:e.name||e.username}]))}),setMobile:t=>e({mobile:Object.fromEntries(t.map(e=>[e,!0]))}),setOnline:(t,n)=>e(e=>e.online[t]===n?{}:{online:{...e.online,[t]:n}}),ensure:n=>{let r=t().conversations[n];if(r)return r;let i=Wn(n,t().mucHost);return e(e=>({conversations:{...e.conversations,[n]:i}})),i},setGroup:(t,n,r,i,a)=>e(e=>{let o=e.conversations[t]??Wn(t,e.mucHost);return{conversations:{...e.conversations,[t]:{...o,kind:`group`,name:n,members:r,avatar:i??o.avatar,owner:a??o.owner}}}}),seed:(t,n)=>e(e=>{let r={...e.conversations};for(let i of t){let t=Un(i);if(!t||t===n)continue;let a=r[t]??Wn(t,e.mucHost);if(a.messages.some(e=>e.id===i.id))continue;if(a.loaded){r[t]={...a,messages:[...a.messages,i].sort((e,t)=>e.ts-t.ts)};continue}let o=a.messages[a.messages.length-1];r[t]={...a,messages:!o||o.ts<=i.ts?[i]:a.messages}}return{conversations:r}}),addMessage:(t,n,r)=>e(e=>{let i=e.conversations[t]??Wn(t,e.mucHost),a=i.messages.filter(e=>e.id!==n.id&&!(e.pending&&n.mine&&e.body===n.body&&e.oob===n.oob)),o=a.length;for(;o>0&&a[o-1].ts>n.ts;)o--;a.splice(o,0,n);let s=e.open===t,c=r?.live&&!n.mine&&!s?i.unread+1:i.unread,l=Gn(e.order,t,e.maxHeads,e.open);return{conversations:{...e.conversations,[t]:{...i,messages:a,unread:c,typing:n.mine?i.typing:!1}},order:l}}),prependHistory:(t,n,r,i)=>e(e=>{let a=e.conversations[t]??Wn(t,e.mucHost),o=new Set(a.messages.map(e=>e.id)),s=[...n.filter(e=>!o.has(e.id)),...a.messages].sort((e,t)=>e.ts-t.ts);return{conversations:{...e.conversations,[t]:{...a,messages:s,loaded:!0,complete:r,oldest:i??a.oldest}}}}),applyReactions:t=>e(e=>{if(!t.length)return{};let n={...e.conversations};for(let r of t){let t=n[r.peer]??Wn(r.peer,e.mucHost),i={...t.reactions??{}},a={...i[r.target]??{}};r.emojis.length?a[r.user]=r.emojis:delete a[r.user],i[r.target]=a,n[r.peer]={...t,reactions:i}}return{conversations:n}}),setTyping:(t,n)=>e(e=>e.conversations[t]?{conversations:{...e.conversations,[t]:{...e.conversations[t],typing:n}}}:{}),openChat:t=>e(e=>({conversations:e.conversations[t]?e.conversations:{...e.conversations,[t]:Wn(t,e.mucHost)},order:Gn(e.order,t,e.maxHeads,e.open),open:t,picker:!1})),closeChat:()=>e({open:null}),removeConversation:t=>e(e=>{let n={...e.conversations};return delete n[t],{conversations:n,order:e.order.filter(e=>e!==t),open:e.open===t?null:e.open}}),removeHead:t=>e(e=>({order:e.order.filter(e=>e!==t),open:e.open===t?null:e.open})),markRead:t=>e(e=>e.conversations[t]&&e.conversations[t].unread?{conversations:{...e.conversations,[t]:{...e.conversations[t],unread:0}}}:{}),setPicker:t=>e({picker:t}),totalUnread:()=>Object.values(t().conversations).reduce((e,t)=>e+t.unread,0)}));async function Kn(e,t,n){let r=await fetch(`https://${e}/api${n}`,{headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw Error(`${n}: HTTP ${r.status}`);return await r.json()}async function qn(e,t,n){let r=await Kn(e,t,`/user/endpoints/all`),i={};try{i=await Kn(e,t,`/user/all_avatars`)}catch{}return Object.values(r).filter(e=>e.username&&e.username!==n).map(e=>({username:e.username,name:e.name||e.username,avatar:i[e.username],presence:e.mainPresence})).sort((e,t)=>e.name.localeCompare(t.name))}async function Jn(e,t){let n=await fetch(`https://${e}/chat-gw/push/mobile`,{headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw Error(`push/mobile: HTTP ${n.status}`);return(await n.json()).users}async function Yn(e,t,n){let r=await fetch(`https://${e}/chat-gw/conversations/${encodeURIComponent(n)}`,{method:`DELETE`,headers:{Authorization:`Bearer ${t}`}});if(!r.ok)throw Error(`delete: HTTP ${r.status}`)}var Xn=e=>{let t=atob((e+`=`.repeat((4-e.length%4)%4)).replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))},Zn=!1;function Qn(){Zn||(Zn=!0,navigator.serviceWorker.addEventListener(`message`,e=>{e.data?.type===`chat-island-open`&&typeof e.data.username==`string`&&window.dispatchEvent(new CustomEvent(`chat-island-open`,{detail:{username:e.data.username}}))}))}async function $n(e,t){if(!(`serviceWorker`in navigator)||!(`PushManager`in window))throw Error(`push not supported by this browser`);if(Notification.permission===`denied`||Notification.permission!==`granted`&&await Notification.requestPermission()!==`granted`)return null;let n=`https://${e.host}/chat-gw`,r=await fetch(`${n}/push/vapid`);if(!r.ok)throw Error(`vapid: HTTP ${r.status}`);let i=await r.json(),a=await navigator.serviceWorker.register(t);await navigator.serviceWorker.ready;let o=await a.pushManager.getSubscription()??await a.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Xn(i.publicKey)}),s=await fetch(`${n}/push/web`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${e.token}`},body:JSON.stringify(o.toJSON())});if(!s.ok)throw Error(`push/web: HTTP ${s.status} ${(await s.text()).slice(0,120)}`);let c=await s.json();return Qn(),{node:c.node,service:c.service}}function F(e,t){window.dispatchEvent(new CustomEvent(e,{detail:t}))}function er(e,t){let n=e=>t(e.detail);return window.addEventListener(e,n),()=>window.removeEventListener(e,n)}var tr=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),I=o(((e,t)=>{t.exports=tr()}))(),nr=e=>e.split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()??``).join(``);function rr({contact:e,username:t,size:n=40}){let r=e?.name||t,i={width:n,height:n,fontSize:n/2.6};return e?.avatar?(0,I.jsx)(`img`,{src:e.avatar,alt:r,style:i,draggable:!1,className:`ci-rounded-full ci-object-cover ci-shrink-0`}):(0,I.jsx)(`div`,{style:i,className:`ci-rounded-full ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-font-medium ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900`,children:nr(r)})}function ir({online:e,presence:t,mobile:n}){return(0,I.jsx)(`span`,{className:`ci-absolute ci-bottom-0 ci-right-0 ci-w-3 ci-h-3 ci-rounded-full ci-ring-2 ci-ring-gray-50 dark:ci-ring-gray-950 ${t===`dnd`||t===`busy`?`ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark`:e||n?`ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark`:`ci-bg-gray-400 dark:ci-bg-gray-600`}`})}function ar({name:e,size:t=40,avatar:n}){let r={width:t,height:t,fontSize:t/2.8};return n?(0,I.jsx)(`img`,{src:n,alt:e,style:r,draggable:!1,className:`ci-rounded-full ci-object-cover ci-shrink-0`}):(0,I.jsx)(`div`,{style:r,className:`ci-rounded-full ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-font-medium ci-bg-iconSecondary dark:ci-bg-iconSecondaryDark ci-text-white`,children:nr(e||`G`)})}var or=`ci-flex ci-content-center ci-items-center ci-justify-center ci-tracking-wide ci-duration-200 ci-transform ci-outline-none focus:ci-ring-2 focus:ci-z-20 focus:ci-ring-offset-2 disabled:ci-opacity-40 disabled:ci-cursor-not-allowed ci-border ci-border-transparent focus:ci-ring-offset-white dark:focus:ci-ring-offset-black ci-text-sm ci-leading-4 ci-transition-colors ci-shrink-0 ci-font-light`,sr={default:`ci-bg-phoneIslandActive dark:ci-bg-phoneIslandActiveDark hover:ci-bg-gray-500 dark:hover:ci-bg-gray-50 focus:ci-ring-emerald-500 dark:focus:ci-ring-emerald-300 ci-text-primaryInvert dark:ci-text-primaryInvertDark ci-h-12 ci-w-12 ci-rounded-full`,green:`ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark hover:ci-bg-phoneIslandCallHover dark:hover:ci-bg-phoneIslandCallHoverDark focus:ci-ring-green-500 ci-text-white dark:ci-text-gray-950 ci-h-12 ci-w-12 ci-rounded-full`,red:`ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark hover:ci-bg-phoneIslandCloseHover dark:hover:ci-bg-phoneIslandCloseHoverDark focus:ci-ring-emerald-500 ci-text-white dark:ci-text-gray-950 ci-h-12 ci-w-12 ci-rounded-full`,neutral:`ci-bg-transparent enabled:hover:ci-bg-gray-500 enabled:hover:ci-border-gray-500 ci-border ci-border-gray-700 focus:ci-ring-0 ci-text-secondaryNeutral dark:ci-text-secondaryNeutralDark ci-h-12 ci-w-12 ci-rounded-full`,transparent:`ci-bg-transparent dark:enabled:hover:ci-bg-gray-700/30 enabled:hover:ci-bg-gray-300/70 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500 ci-text-secondaryNeutral dark:ci-text-secondaryNeutralDark ci-h-12 ci-w-12 ci-rounded-full`,call:`ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark hover:ci-bg-phoneIslandCallHover dark:hover:ci-bg-phoneIslandCallHoverDark focus:ci-ring-green-500 ci-text-white dark:ci-text-gray-950 ci-h-8 ci-w-8 ci-rounded-full`,small:`ci-bg-transparent dark:hover:ci-bg-gray-600 hover:ci-bg-gray-300 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500 ci-text-gray-700 dark:ci-text-white ci-h-8 ci-w-8 ci-rounded`};function cr({variant:e,className:t=``,children:n,...r}){return(0,I.jsx)(`button`,{type:`button`,"aria-label":r[`aria-label`]??r.title,className:`${or} ${sr[e]} ${t}`,...r,children:n})}var L={chat:(0,I.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 512 512`,fill:`currentColor`,children:(0,I.jsx)(`path`,{d:`M0 240c0 54.4 19.3 104.6 51.9 144.9L3.1 474.3c-2 3.7-3.1 7.9-3.1 12.2 0 14.1 11.4 25.5 25.5 25.5 4 0 7.8-.6 11.5-2.1L153.4 460c31.4 12.9 66.1 20 102.6 20 141.4 0 256-107.5 256-240S397.4 0 256 0 0 107.5 0 240zM94 407.9c9.3-17.1 7.4-38.1-4.8-53.2-26.1-32.3-41.2-71.9-41.2-114.7 0-103.2 90.2-192 208-192s208 88.8 208 192-90.2 192-208 192c-30.2 0-58.7-5.9-84.3-16.4-11.9-4.9-25.3-4.8-37.1 .3L76 440.9 94 407.9zM144 272a32 32 0 1 0 0-64 32 32 0 1 0 0 64zm144-32a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zm80 32a32 32 0 1 0 0-64 32 32 0 1 0 0 64z`})}),bell:(0,I.jsx)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9M13.73 21a2 2 0 0 1-3.46 0`})}),clip:(0,I.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`})}),send:(0,I.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M22 2L11 13M22 2l-7 20-4-9-9-4 20-7z`})}),phone:(0,I.jsx)(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92z`})}),mic:(0,I.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`path`,{d:`M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z`}),(0,I.jsx)(`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2M12 19v4M8 23h8`})]}),camera:(0,I.jsxs)(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`path`,{d:`M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z`}),(0,I.jsx)(`circle`,{cx:`12`,cy:`13`,r:`4`})]}),trash:(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v6M14 11v6`})}),minus:(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,I.jsx)(`path`,{d:`M5 12h14`})}),close:(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:(0,I.jsx)(`path`,{d:`M18 6L6 18M6 6l12 12`})}),smile:(0,I.jsxs)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,I.jsx)(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01`})]}),react:(0,I.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,I.jsx)(`path`,{d:`M20.5 11A8.5 8.5 0 1 1 13 3.5`}),(0,I.jsx)(`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01M19 2v6M16 5h6`})]}),search:(0,I.jsxs)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,I.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,I.jsx)(`path`,{d:`M21 21l-4.35-4.35`})]})};function lr({onDragStart:e,pushButton:t=!0}){let{order:n,open:r,conversations:i,contacts:a,online:o,mobile:s,openChat:c,removeHead:l,picker:u,setPicker:d,status:f,push:p,enablePush:m,newChatButton:h}=P(y(e=>({order:e.order,open:e.open,conversations:e.conversations,contacts:e.contacts,online:e.online,mobile:e.mobile,openChat:e.openChat,removeHead:e.removeHead,picker:e.picker,setPicker:e.setPicker,status:e.status,push:e.push,enablePush:e.enablePush,newChatButton:e.newChatButton})));return(0,I.jsxs)(`div`,{className:`ci-flex ci-flex-col-reverse ci-items-center ci-gap-3 ci-mb-3 ${e?`ci-cursor-grab active:ci-cursor-grabbing ci-touch-none`:``}`,onPointerDown:e,children:[n.map(e=>{let t=i[e],n=r===e;return(0,I.jsxs)(`div`,{className:`ci-relative ci-group`,children:[(0,I.jsxs)(`button`,{type:`button`,title:t?.kind===`group`?t.name??e:a[e]?.name??e,onClick:()=>n?P.getState().closeChat():c(e),className:`ci-relative ci-rounded-full ci-shadow-lg ci-transition-transform hover:ci-scale-105 ci-ring-2 ci-border-0 ci-p-0 ci-bg-transparent ${n?`ci-ring-iconSecondary dark:ci-ring-iconSecondaryDark`:`ci-ring-gray-50 dark:ci-ring-gray-950`}`,children:[t?.kind===`group`?(0,I.jsx)(ar,{name:t.name??e,size:48,avatar:t.avatar}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(rr,{contact:a[e],username:e,size:48}),(0,I.jsx)(ir,{online:o[e],presence:a[e]?.presence,mobile:s[e]})]}),t?.unread>0&&(0,I.jsx)(`span`,{className:`ci-absolute ci--top-1 ci--right-1 ci-min-w-5 ci-h-5 ci-px-1 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-text-white dark:ci-text-gray-950 ci-text-xs ci-font-medium ci-flex ci-items-center ci-justify-center`,children:t.unread>99?`99+`:t.unread})]}),(0,I.jsx)(`button`,{type:`button`,"aria-label":`Remove ${t?.kind===`group`?t.name??e:a[e]?.name??e} from the dock`,onClick:()=>l(e),className:`ci-absolute ci--top-1 ci--left-1 ci-hidden group-hover:ci-flex group-focus-within:ci-flex ci-w-5 ci-h-5 ci-rounded-full ci-border-0 ci-p-0 ci-bg-gray-700 dark:ci-bg-gray-300 ci-text-gray-50 dark:ci-text-gray-900 ci-items-center ci-justify-center`,children:L.close})]},e)}),h&&(0,I.jsxs)(cr,{variant:`default`,title:f===`online`?`New chat`:`Chat ${f}`,onClick:()=>d(!u),className:`ci-relative ci-shadow-lg`,children:[L.chat,f!==`online`&&(0,I.jsx)(`span`,{className:`ci-absolute ci-bottom-0 ci-right-0 ci-w-3 ci-h-3 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-ring-2 ci-ring-gray-50 dark:ci-ring-gray-950`})]}),t&&p===`ask`&&f===`online`&&(0,I.jsx)(cr,{variant:`neutral`,title:`Enable notifications when the tab is closed`,onClick:m,className:`ci-shadow-lg ci-bg-gray-50 dark:ci-bg-gray-950`,children:L.bell})]})}var ur={"+1":`๐Ÿ‘`,thumbsup:`๐Ÿ‘`,"-1":`๐Ÿ‘Ž`,thumbsdown:`๐Ÿ‘Ž`,ok_hand:`๐Ÿ‘Œ`,clap:`๐Ÿ‘`,pray:`๐Ÿ™`,wave:`๐Ÿ‘‹`,raised_hands:`๐Ÿ™Œ`,muscle:`๐Ÿ’ช`,point_up:`โ˜๏ธ`,point_right:`๐Ÿ‘‰`,point_left:`๐Ÿ‘ˆ`,point_down:`๐Ÿ‘‡`,v:`โœŒ๏ธ`,crossed_fingers:`๐Ÿคž`,handshake:`๐Ÿค`,eyes:`๐Ÿ‘€`,facepalm:`๐Ÿคฆ`,shrug:`๐Ÿคท`,raising_hand:`๐Ÿ™‹`,heart:`โค๏ธ`,broken_heart:`๐Ÿ’”`,orange_heart:`๐Ÿงก`,yellow_heart:`๐Ÿ’›`,green_heart:`๐Ÿ’š`,blue_heart:`๐Ÿ’™`,purple_heart:`๐Ÿ’œ`,black_heart:`๐Ÿ–ค`,white_heart:`๐Ÿค`,sparkling_heart:`๐Ÿ’–`,two_hearts:`๐Ÿ’•`,100:`๐Ÿ’ฏ`,fire:`๐Ÿ”ฅ`,star:`โญ`,star2:`๐ŸŒŸ`,sparkles:`โœจ`,zap:`โšก`,boom:`๐Ÿ’ฅ`,tada:`๐ŸŽ‰`,confetti_ball:`๐ŸŽŠ`,balloon:`๐ŸŽˆ`,gift:`๐ŸŽ`,birthday:`๐ŸŽ‚`,cake:`๐Ÿฐ`,trophy:`๐Ÿ†`,medal:`๐Ÿ…`,rocket:`๐Ÿš€`,white_check_mark:`โœ…`,heavy_check_mark:`โœ”๏ธ`,x:`โŒ`,warning:`โš ๏ธ`,question:`โ“`,exclamation:`โ—`,no_entry:`โ›”`,ok:`๐Ÿ†—`,new:`๐Ÿ†•`,sos:`๐Ÿ†˜`,heavy_plus_sign:`โž•`,heavy_minus_sign:`โž–`,smile:`๐Ÿ˜„`,smiley:`๐Ÿ˜ƒ`,grinning:`๐Ÿ˜€`,grin:`๐Ÿ˜`,laughing:`๐Ÿ˜†`,satisfied:`๐Ÿ˜†`,sweat_smile:`๐Ÿ˜…`,joy:`๐Ÿ˜‚`,rofl:`๐Ÿคฃ`,slightly_smiling_face:`๐Ÿ™‚`,upside_down_face:`๐Ÿ™ƒ`,wink:`๐Ÿ˜‰`,blush:`๐Ÿ˜Š`,innocent:`๐Ÿ˜‡`,heart_eyes:`๐Ÿ˜`,star_struck:`๐Ÿคฉ`,kissing_heart:`๐Ÿ˜˜`,yum:`๐Ÿ˜‹`,stuck_out_tongue:`๐Ÿ˜›`,stuck_out_tongue_winking_eye:`๐Ÿ˜œ`,zany_face:`๐Ÿคช`,money_mouth_face:`๐Ÿค‘`,hugs:`๐Ÿค—`,hugging_face:`๐Ÿค—`,shushing_face:`๐Ÿคซ`,thinking:`๐Ÿค”`,thinking_face:`๐Ÿค”`,zipper_mouth_face:`๐Ÿค`,raised_eyebrow:`๐Ÿคจ`,neutral_face:`๐Ÿ˜`,expressionless:`๐Ÿ˜‘`,no_mouth:`๐Ÿ˜ถ`,smirk:`๐Ÿ˜`,unamused:`๐Ÿ˜’`,roll_eyes:`๐Ÿ™„`,grimacing:`๐Ÿ˜ฌ`,relieved:`๐Ÿ˜Œ`,pensive:`๐Ÿ˜”`,sleepy:`๐Ÿ˜ช`,sleeping:`๐Ÿ˜ด`,mask:`๐Ÿ˜ท`,face_with_thermometer:`๐Ÿค’`,nauseated_face:`๐Ÿคข`,sneezing_face:`๐Ÿคง`,hot_face:`๐Ÿฅต`,cold_face:`๐Ÿฅถ`,dizzy_face:`๐Ÿ˜ต`,exploding_head:`๐Ÿคฏ`,cowboy_hat_face:`๐Ÿค `,partying_face:`๐Ÿฅณ`,sunglasses:`๐Ÿ˜Ž`,nerd_face:`๐Ÿค“`,confused:`๐Ÿ˜•`,worried:`๐Ÿ˜Ÿ`,slightly_frowning_face:`๐Ÿ™`,open_mouth:`๐Ÿ˜ฎ`,astonished:`๐Ÿ˜ฒ`,flushed:`๐Ÿ˜ณ`,pleading_face:`๐Ÿฅบ`,fearful:`๐Ÿ˜จ`,cold_sweat:`๐Ÿ˜ฐ`,cry:`๐Ÿ˜ข`,sob:`๐Ÿ˜ญ`,scream:`๐Ÿ˜ฑ`,disappointed:`๐Ÿ˜ž`,weary:`๐Ÿ˜ฉ`,tired_face:`๐Ÿ˜ซ`,yawning_face:`๐Ÿฅฑ`,triumph:`๐Ÿ˜ค`,rage:`๐Ÿ˜ก`,angry:`๐Ÿ˜ `,cursing_face:`๐Ÿคฌ`,smiling_imp:`๐Ÿ˜ˆ`,skull:`๐Ÿ’€`,poop:`๐Ÿ’ฉ`,hankey:`๐Ÿ’ฉ`,clown_face:`๐Ÿคก`,ghost:`๐Ÿ‘ป`,alien:`๐Ÿ‘ฝ`,robot:`๐Ÿค–`,see_no_evil:`๐Ÿ™ˆ`,hear_no_evil:`๐Ÿ™‰`,speak_no_evil:`๐Ÿ™Š`,coffee:`โ˜•`,tea:`๐Ÿต`,beer:`๐Ÿบ`,beers:`๐Ÿป`,wine_glass:`๐Ÿท`,clinking_glasses:`๐Ÿฅ‚`,pizza:`๐Ÿ•`,hamburger:`๐Ÿ”`,sunny:`โ˜€๏ธ`,cloud:`โ˜๏ธ`,rainbow:`๐ŸŒˆ`,snowflake:`โ„๏ธ`,umbrella:`โ˜”`,phone:`โ˜Ž๏ธ`,telephone_receiver:`๐Ÿ“ž`,iphone:`๐Ÿ“ฑ`,computer:`๐Ÿ’ป`,email:`๐Ÿ“ง`,calendar:`๐Ÿ“…`,memo:`๐Ÿ“`,pencil2:`โœ๏ธ`,paperclip:`๐Ÿ“Ž`,pushpin:`๐Ÿ“Œ`,lock:`๐Ÿ”’`,key:`๐Ÿ”‘`,bulb:`๐Ÿ’ก`,hourglass:`โŒ›`,hourglass_flowing_sand:`โณ`,alarm_clock:`โฐ`,stopwatch:`โฑ๏ธ`,bell:`๐Ÿ””`,mega:`๐Ÿ“ฃ`,loudspeaker:`๐Ÿ“ข`,speech_balloon:`๐Ÿ’ฌ`,thought_balloon:`๐Ÿ’ญ`,moneybag:`๐Ÿ’ฐ`,car:`๐Ÿš—`,airplane:`โœˆ๏ธ`,house:`๐Ÿ `,office:`๐Ÿข`,earth_africa:`๐ŸŒ`,globe_with_meridians:`๐ŸŒ`,arrow_right:`โžก๏ธ`,arrow_left:`โฌ…๏ธ`,arrow_up:`โฌ†๏ธ`,arrow_down:`โฌ‡๏ธ`,recycle:`โ™ป๏ธ`,zzz:`๐Ÿ’ค`,sweat_drops:`๐Ÿ’ฆ`,dash:`๐Ÿ’จ`},dr=/(```[\s\S]*?(?:```|$)|`[^`\n]*`?)/g,fr=/:([a-z0-9_+-]+):/g,pr=e=>e.replace(fr,(e,t)=>ur[t]??e);function mr(e){return e.includes(`:`)?e.split(dr).map((e,t)=>t%2?e:pr(e)).join(``):e}var hr=[{label:`Smileys`,icon:`๐Ÿ˜€`,emojis:`๐Ÿ˜€ ๐Ÿ˜ƒ ๐Ÿ˜„ ๐Ÿ˜ ๐Ÿ˜† ๐Ÿ˜… ๐Ÿคฃ ๐Ÿ˜‚ ๐Ÿ™‚ ๐Ÿ™ƒ ๐Ÿ˜‰ ๐Ÿ˜Š ๐Ÿ˜‡ ๐Ÿฅฐ ๐Ÿ˜ ๐Ÿคฉ ๐Ÿ˜˜ ๐Ÿ˜— ๐Ÿ˜š ๐Ÿ˜™ ๐Ÿ˜‹ ๐Ÿ˜› ๐Ÿ˜œ ๐Ÿคช ๐Ÿ˜ ๐Ÿค‘ ๐Ÿค— ๐Ÿคญ ๐Ÿคซ ๐Ÿค” ๐Ÿค ๐Ÿคจ ๐Ÿ˜ ๐Ÿ˜‘ ๐Ÿ˜ถ ๐Ÿ˜ ๐Ÿ˜’ ๐Ÿ™„ ๐Ÿ˜ฌ ๐Ÿ˜Œ ๐Ÿ˜” ๐Ÿ˜ช ๐Ÿคค ๐Ÿ˜ด ๐Ÿ˜ท ๐Ÿค’ ๐Ÿค• ๐Ÿคข ๐Ÿคฎ ๐Ÿคง ๐Ÿฅต ๐Ÿฅถ ๐Ÿฅด ๐Ÿ˜ต ๐Ÿคฏ ๐Ÿค  ๐Ÿฅณ ๐Ÿ˜Ž ๐Ÿค“ ๐Ÿง ๐Ÿ˜• ๐Ÿ˜Ÿ ๐Ÿ™ โ˜น๏ธ ๐Ÿ˜ฎ ๐Ÿ˜ฏ ๐Ÿ˜ฒ ๐Ÿ˜ณ ๐Ÿฅบ ๐Ÿ˜ฆ ๐Ÿ˜ง ๐Ÿ˜จ ๐Ÿ˜ฐ ๐Ÿ˜ฅ ๐Ÿ˜ข ๐Ÿ˜ญ ๐Ÿ˜ฑ ๐Ÿ˜– ๐Ÿ˜ฃ ๐Ÿ˜ž ๐Ÿ˜“ ๐Ÿ˜ฉ ๐Ÿ˜ซ ๐Ÿฅฑ ๐Ÿ˜ค ๐Ÿ˜ก ๐Ÿ˜  ๐Ÿคฌ ๐Ÿ˜ˆ ๐Ÿ’€ ๐Ÿ’ฉ ๐Ÿคก ๐Ÿ‘ป ๐Ÿ‘ฝ ๐Ÿค–`},{label:`Gestures`,icon:`๐Ÿ‘`,emojis:`๐Ÿ‘ ๐Ÿ‘Ž ๐Ÿ‘Œ ๐ŸคŒ ๐Ÿค โœŒ๏ธ ๐Ÿคž ๐ŸคŸ ๐Ÿค˜ ๐Ÿค™ ๐Ÿ‘ˆ ๐Ÿ‘‰ ๐Ÿ‘† ๐Ÿ‘‡ โ˜๏ธ โœ‹ ๐Ÿคš ๐Ÿ–๏ธ ๐Ÿ–– ๐Ÿ‘‹ ๐Ÿ‘ ๐Ÿ™Œ ๐Ÿ‘ ๐Ÿคฒ ๐Ÿค ๐Ÿ™ โœ๏ธ ๐Ÿ’ช ๐Ÿซถ ๐Ÿ‘€ ๐Ÿง  ๐Ÿ™‹ ๐Ÿ™† ๐Ÿ™… ๐Ÿคท ๐Ÿคฆ ๐Ÿ™‡`},{label:`Hearts and symbols`,icon:`โค๏ธ`,emojis:`โค๏ธ ๐Ÿงก ๐Ÿ’› ๐Ÿ’š ๐Ÿ’™ ๐Ÿ’œ ๐Ÿ–ค ๐Ÿค ๐ŸคŽ ๐Ÿ’” โฃ๏ธ ๐Ÿ’• ๐Ÿ’ž ๐Ÿ’“ ๐Ÿ’— ๐Ÿ’– ๐Ÿ’˜ ๐Ÿ’ ๐Ÿ’ฏ ๐Ÿ’ข ๐Ÿ’ฅ ๐Ÿ’ซ ๐Ÿ’ฆ ๐Ÿ’จ ๐Ÿ”ฅ โœจ โญ ๐ŸŒŸ โœ… โŒ โš ๏ธ โ“ โ— โž• โž– ๐Ÿ†— ๐Ÿ†• ๐Ÿ”ด ๐ŸŸข ๐ŸŸก ๐Ÿ”ต`},{label:`Celebrations`,icon:`๐ŸŽ‰`,emojis:`๐ŸŽ‰ ๐ŸŽŠ ๐ŸŽˆ ๐ŸŽ ๐ŸŽ‚ ๐Ÿฐ ๐Ÿฅ‚ ๐Ÿพ ๐Ÿป ๐Ÿบ ๐Ÿท ๐Ÿ† ๐Ÿฅ‡ ๐Ÿฅˆ ๐Ÿฅ‰ ๐Ÿ… ๐ŸŽฏ ๐ŸŽฎ โšฝ ๐Ÿ€ ๐ŸŽพ ๐Ÿšด ๐Ÿƒ ๐ŸŽต ๐ŸŽถ ๐Ÿ“ธ ๐ŸŽฌ`},{label:`Work`,icon:`๐Ÿ’ผ`,emojis:`๐Ÿ’ผ ๐Ÿ“ž โ˜Ž๏ธ ๐Ÿ“ฑ ๐Ÿ’ป ๐Ÿ–ฅ๏ธ โŒจ๏ธ ๐Ÿ–จ๏ธ ๐Ÿ“ง ๐Ÿ“จ ๐Ÿ“ฉ ๐Ÿ“… ๐Ÿ“† ๐Ÿ—“๏ธ ๐Ÿ“Œ ๐Ÿ“ ๐Ÿ“Ž โœ‚๏ธ ๐Ÿ“ โœ๏ธ ๐Ÿ“ ๐Ÿ“‚ ๐Ÿ—‚๏ธ ๐Ÿ“Š ๐Ÿ“ˆ ๐Ÿ“‰ ๐Ÿ”’ ๐Ÿ”“ ๐Ÿ”‘ ๐Ÿ”ง ๐Ÿ› ๏ธ โš™๏ธ ๐Ÿ’ก ๐Ÿ”‹ โฐ โณ โŒ› ๐Ÿงพ ๐Ÿ’ถ ๐Ÿ’ฐ`},{label:`Food and places`,icon:`โ˜•`,emojis:`โ˜• ๐Ÿต ๐Ÿฅค ๐Ÿ• ๐Ÿ” ๐ŸŸ ๐ŸŒญ ๐Ÿฅช ๐ŸŒฎ ๐Ÿ ๐Ÿฃ ๐Ÿฉ ๐Ÿช ๐Ÿซ ๐ŸŽ ๐ŸŒ ๐Ÿ“ ๐Ÿฅ ๐Ÿš— ๐Ÿš• ๐ŸšŒ ๐Ÿš† โœˆ๏ธ ๐Ÿš€ ๐Ÿ  ๐Ÿข ๐Ÿ–๏ธ ๐ŸŒ โ˜€๏ธ ๐ŸŒค๏ธ ๐ŸŒง๏ธ โ›ˆ๏ธ โ„๏ธ โšก ๐ŸŒˆ ๐ŸŒ™`}],gr=[`๐Ÿ‘`,`โค๏ธ`,`๐Ÿ˜‚`,`๐Ÿ˜ฎ`,`๐Ÿ˜ข`,`๐Ÿ™`];function _r({onPick:e,onClose:t,className:n=``}){let[r,i]=(0,g.useState)(0),a=(0,g.useRef)(null);return(0,g.useEffect)(()=>{let e=e=>a.current&&!a.current.contains(e.target)&&t(),n=e=>{e.key===`Escape`&&(e.stopPropagation(),t())};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`keydown`,n,!0),()=>{document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`keydown`,n,!0)}},[t]),(0,I.jsxs)(`div`,{ref:a,role:`dialog`,"aria-label":`Emoji`,className:`ci-z-30 ci-w-[21rem] ci-max-w-full ci-rounded-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-2xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ci-select-none ${n}`,children:[(0,I.jsx)(`div`,{className:`ci-flex ci-gap-1 ci-px-2 ci-pt-2 ci-border-b ci-border-gray-300 dark:ci-border-gray-700`,children:hr.map((e,t)=>(0,I.jsx)(`button`,{type:`button`,title:e.label,"aria-label":e.label,onClick:()=>i(t),style:{fontSize:20,lineHeight:`28px`},className:`ci-flex-1 ci-pb-1.5 ci-border-0 ci-bg-transparent ci-border-b-2 ci-border-solid ${t===r?`ci-border-iconSecondary dark:ci-border-iconSecondaryDark`:`ci-border-transparent ci-opacity-60 hover:ci-opacity-100`}`,children:e.icon},e.label))}),(0,I.jsx)(`div`,{className:`ci-grid ci-grid-cols-7 ci-gap-1 ci-p-2 ci-h-64 ci-overflow-y-auto`,children:hr[r].emojis.split(` `).map(t=>(0,I.jsx)(`button`,{type:`button`,onClick:()=>e(t),style:{fontSize:26,lineHeight:`36px`},className:`ci-h-10 ci-w-10 ci-flex ci-items-center ci-justify-center ci-rounded-lg ci-border-0 ci-bg-transparent hover:ci-bg-gray-200 dark:hover:ci-bg-gray-800`,children:t},t))})]})}var vr=e=>/\.(png|jpe?g|gif|webp|avif|svg)(\?|$)/i.test(e),yr=e=>/\.(webm|ogg|oga|opus|mp3|m4a|wav)(\?|$)/i.test(e),br=e=>{let t=e.split(`/`).pop()||`file`;try{return decodeURIComponent(t)}catch{return t}},xr=e=>{try{return new URL(e).protocol===`https:`}catch{return!1}},Sr=e=>new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),Cr=e=>new Date(e).toLocaleDateString([],{weekday:`short`,day:`numeric`,month:`short`}),wr=(e,t)=>new Date(e).toDateString()===new Date(t).toDateString(),Tr=e=>{if(!e.startsWith(`{"`))return null;try{let t=JSON.parse(e);return!Array.isArray(t.attachments)||!t.attachments.length?null:{text:typeof t.body==`string`&&t.body?t.body:void 0,count:t.attachments.length}}catch{return null}},Er=(0,g.memo)(function({url:e}){return xr(e)?vr(e)?(0,I.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,children:(0,I.jsx)(`img`,{src:e,alt:br(e),className:`ci-max-w-full ci-max-h-60 ci-rounded-2xl ci-block`})}):yr(e)?(0,I.jsx)(`audio`,{controls:!0,src:e,className:`ci-max-w-full`}):(0,I.jsxs)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`ci-underline ci-break-all ci-flex ci-items-center ci-gap-1`,children:[(0,I.jsx)(`svg`,{width:`16`,height:`16`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,I.jsx)(`path`,{d:`M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48`})}),br(e)]}):(0,I.jsx)(`span`,{className:`ci-break-all`,children:e})}),Dr=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*|__[^_\n]+__)|(~~[^~\n]+~~)|(\*[^*\s][^*\n]*\*|_[^_\s][^_\n]*_)|\[([^\]\n]+)\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<]+)/g;function Or({text:e}){let t=[],n=0;for(let r of e.matchAll(Dr)){let i=r[0],a=r.index??0;a>n&&t.push(mr(e.slice(n,a))),r[1]?t.push((0,I.jsx)(`code`,{className:`ci-px-1 ci-py-0.5 ci-rounded ci-bg-black/10 dark:ci-bg-white/10 ci-font-mono ci-text-[0.85em]`,children:i.slice(1,-1)},a)):r[2]?t.push((0,I.jsx)(`strong`,{children:i.slice(2,-2)},a)):r[3]?t.push((0,I.jsx)(`s`,{children:i.slice(2,-2)},a)):r[4]?t.push((0,I.jsx)(`em`,{children:i.slice(1,-1)},a)):r[5]?t.push((0,I.jsx)(`a`,{href:r[6],target:`_blank`,rel:`noreferrer`,className:`ci-underline`,children:r[5]},a)):t.push((0,I.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`ci-underline ci-break-all`,children:i},a)),n=a+i.length}return n<e.length&&t.push(mr(e.slice(n))),(0,I.jsx)(I.Fragment,{children:t})}var kr=(0,g.memo)(function({text:e}){let t=e.split(/```[^\n]*\n?([\s\S]*?)```/g);return(0,I.jsx)(`span`,{className:`ci-whitespace-pre-wrap ci-break-words`,children:t.map((e,t)=>t%2?(0,I.jsx)(`pre`,{className:`ci-my-1 ci-p-2 ci-rounded-xl ci-bg-black/10 dark:ci-bg-white/10 ci-font-mono ci-text-xs ci-overflow-x-auto ci-whitespace-pre`,children:e.replace(/\n$/,``)},t):(0,I.jsx)(Or,{text:e.replace(/^(\s*)[-*] (?=\S)/gm,`$1โ€ข `)},t))})});function Ar({text:e,count:t}){return(0,I.jsxs)(`span`,{className:`ci-italic ci-opacity-80`,children:[e&&(0,I.jsx)(`span`,{className:`ci-not-italic ci-block`,children:e}),t>1?`${t} attachments`:`Attachment`,` from the mobile app, not available here`]})}function jr({forMsg:e,me:t,onReact:n,nameOf:r,mine:i}){if(!e)return null;let a=new Map;for(let[t,n]of Object.entries(e))for(let e of n)a.set(e,[...a.get(e)??[],t]);return a.size?(0,I.jsx)(`div`,{className:`ci-flex ci-flex-wrap ci-gap-1 ci--mt-1.5 ci-relative ci-z-[1] ${i?`ci-justify-end ci-pr-2`:`ci-pl-2`}`,children:[...a.entries()].map(([e,i])=>{let a=i.includes(t);return(0,I.jsxs)(`button`,{type:`button`,title:i.map(e=>e===t?`You`:r(e)).join(`, `),"aria-label":`${e} ${i.length}${a?`, yours: press to remove`:``}`,onClick:()=>n(e),className:`ci-flex ci-items-center ci-gap-0.5 ci-h-6 ci-px-1.5 ci-rounded-full ci-text-xs ci-border ci-border-solid ci-shadow-sm ${a?`ci-bg-emerald-50 ci-border-emerald-400 dark:ci-bg-emerald-950 dark:ci-border-emerald-600`:`ci-bg-gray-50 ci-border-gray-300 dark:ci-bg-gray-900 dark:ci-border-gray-700`} ci-text-gray-900 dark:ci-text-white`,children:[(0,I.jsx)(`span`,{style:{fontSize:16,lineHeight:`20px`},children:e}),i.length>1&&(0,I.jsx)(`span`,{children:i.length})]},e)})}):null}function Mr({messages:e,typing:t,onLoadOlder:n,hasOlder:r,group:i,reactions:a,me:o=``,onReact:s}){let c=P(e=>e.contacts),l=(0,g.useRef)(null),u=(0,g.useRef)(!0),[d,f]=(0,g.useState)(null),[p,m]=(0,g.useState)(null),h=e=>c[e]?.name??e;(0,g.useEffect)(()=>{let e=l.current;e&&u.current&&(e.scrollTop=e.scrollHeight)},[e.length,t,a]),(0,g.useEffect)(()=>{if(!d)return;let e=()=>f(null),t=window.setTimeout(()=>document.addEventListener(`click`,e,{once:!0}),0);return()=>{window.clearTimeout(t),document.removeEventListener(`click`,e)}},[d]);let _=()=>{let e=l.current;e&&(u.current=e.scrollHeight-e.scrollTop-e.clientHeight<40,e.scrollTop<30&&r&&n())},v=(e,t)=>{f(null),m(null),s?.(e,t)};return(0,I.jsxs)(`div`,{className:`ci-relative ci-flex-1 ci-min-h-0 ci-flex ci-flex-col`,children:[(0,I.jsxs)(`div`,{ref:l,onScroll:_,className:`ci-flex-1 ci-overflow-y-auto ci-px-4 ci-py-2 ci-space-y-1`,children:[r&&(0,I.jsx)(`div`,{className:`ci-text-center ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-py-1`,children:`Scroll up for older messages`}),e.map((t,n)=>{let r=e[n-1],l=!r||!wr(r.ts,t.ts),u=r&&!l&&r.mine===t.mine&&r.nick===t.nick&&t.ts-r.ts<12e4,p=i&&!t.mine&&t.nick?h(t.nick):null,g=t.oid,_=!!s&&!!g&&!t.pending,y=_&&(0,I.jsx)(`button`,{type:`button`,title:`React`,"aria-label":`React to this message`,onClick:e=>{e.stopPropagation(),f(d===g?null:g)},className:`ci-self-center ci-h-7 ci-w-7 ci-shrink-0 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-transparent ci-text-gray-500 dark:ci-text-gray-400 hover:ci-bg-gray-200 dark:hover:ci-bg-gray-800 focus:ci-opacity-100 ${d===g?`ci-opacity-100`:`ci-opacity-0 group-hover:ci-opacity-100`}`,children:L.react});return(0,I.jsxs)(`div`,{children:[l&&(0,I.jsx)(`div`,{className:`ci-text-center ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-py-2`,children:Cr(t.ts)}),(0,I.jsxs)(`div`,{className:`ci-group ci-flex ci-items-start ci-gap-1.5 ${t.mine?`ci-justify-end`:`ci-justify-start`} ${u?`ci-mt-0.5`:`ci-mt-2`}`,children:[p&&(0,I.jsx)(`span`,{className:`ci-w-7 ci-shrink-0`,title:p,children:!u&&(0,I.jsx)(rr,{contact:c[t.nick],username:t.nick,size:28})}),t.mine&&y,(0,I.jsxs)(`div`,{className:`ci-relative ci-flex ci-flex-col ci-max-w-[80%] ${t.mine?`ci-items-end`:`ci-items-start`}`,children:[d===g&&g&&(0,I.jsxs)(`div`,{role:`menu`,onClick:e=>e.stopPropagation(),className:`ci-absolute ci-bottom-full ci-mb-1 ci-z-20 ci-flex ci-items-center ci-gap-0.5 ci-p-1 ci-rounded-full ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ${t.mine?`ci-right-0`:`ci-left-0`}`,children:[gr.map(e=>(0,I.jsx)(`button`,{type:`button`,role:`menuitem`,"aria-label":e,onClick:()=>v(g,e),style:{fontSize:22,lineHeight:`32px`},className:`ci-h-9 ci-w-9 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 hover:ci-scale-125 ci-transition-transform ${a?.[g]?.[o]?.includes(e)?`ci-bg-gray-200 dark:ci-bg-gray-800`:`ci-bg-transparent`}`,children:e},e)),(0,I.jsx)(`button`,{type:`button`,role:`menuitem`,title:`More emojis`,"aria-label":`More emojis`,onClick:()=>{f(null),m(g)},className:`ci-h-8 ci-w-8 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-gray-200 dark:ci-bg-gray-800 ci-text-gray-700 dark:ci-text-gray-200 ci-text-lg`,children:`+`})]}),(0,I.jsxs)(`div`,{title:Sr(t.ts),onDoubleClick:()=>_&&v(g,gr[0]),className:`ci-px-3.5 ci-py-2 ci-rounded-3xl ci-text-sm ci-select-text ci-cursor-text ${t.mine?`ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900 ci-rounded-br-lg`:`ci-bg-elevationL2 ci-text-gray-900 dark:ci-bg-elevationL2Dark dark:ci-text-white ci-rounded-bl-lg`} ${t.pending?`ci-opacity-60`:``}`,children:[t.oob?(0,I.jsx)(Er,{url:t.oob}):Tr(t.body)?(0,I.jsx)(Ar,{...Tr(t.body)}):(0,I.jsx)(kr,{text:t.body}),t.oob&&t.body&&t.body!==t.oob&&t.body!==br(t.oob)&&(0,I.jsx)(`div`,{className:`ci-text-xs ci-opacity-80 ci-mt-1`,children:t.body}),(0,I.jsx)(`span`,{className:`ci-block ci-text-right ci-text-[10px] ci-leading-none ci-opacity-60 ci-mt-1`,children:Sr(t.ts)})]}),g&&(0,I.jsx)(jr,{forMsg:a?.[g],me:o,mine:t.mine,nameOf:h,onReact:e=>_&&v(g,e)})]}),!t.mine&&y]})]},t.id)}),t&&(0,I.jsx)(`div`,{className:`ci-flex ci-justify-start ci-mt-2`,children:(0,I.jsx)(`div`,{className:`ci-px-3.5 ci-py-2 ci-rounded-3xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-500 dark:ci-text-gray-400 ci-text-xs ci-italic`,children:`typingโ€ฆ`})})]}),p&&(0,I.jsx)(_r,{className:`ci-absolute ci-bottom-2 ci-left-1/2 ci--translate-x-1/2`,onPick:e=>v(p,e),onClose:()=>m(null)})]})}function Nr(e,t,n){let r=e[t];if(r===void 0)return null;let i=1;for(;i<=8&&!(r&128>>i-1);)i++;if(i>8||t+i>e.length)return null;let a=n?r:r&255>>i,o=a===255>>i;for(let n=1;n<i;n++)a=a*256+e[t+n],e[t+n]!==255&&(o=!1);return{value:a,len:i,unknown:!n&&o}}var Pr=new Set([408125543,524531317,374648427,174,225,160]);function Fr(e){let t={channels:1,packets:[]},n=0;for(;n<e.length;){let r=Nr(e,n,!0);if(!r)break;let i=Nr(e,n+r.len,!1);if(!i)break;let a=n+r.len+i.len;if(Pr.has(r.value)){n=a;continue}if(i.unknown)break;let o=Math.min(e.length,a+i.value);if(r.value===25506)t.head=e.slice(a,o);else if(r.value===159)t.channels=e[a]||1;else if(r.value===163||r.value===161){let n=Nr(e,a,!1);n&&(e[a+n.len+2]>>1&3||t.packets.push(e.slice(a+n.len+3,o)))}n=o}return t}function Ir(e){if(!e.length)return 0;let t=e[0],n=t>>3,r;r=n<12?[10,20,40,60][n%4]:n<16?[10,20][n%2]:[2.5,5,10,20][n%4];let i=t&3,a=i===0?1:i===3?(e[1]??0)&63:2;return Math.round(a*r*48)}var Lr=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t<<24;for(let e=0;e<8;e++)n=n&2147483648?n<<1^79764919:n<<1;e[t]=n>>>0}return e})();function Rr(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<8^Lr[(t>>>24^e[n])&255])>>>0;return t}function zr(e,t,n,r,i){let a=[];for(let t of e){let e=t.length;for(;e>=255;)a.push(255),e-=255;a.push(e)}let o=e.reduce((e,t)=>e+t.length,0),s=new Uint8Array(27+a.length+o),c=new DataView(s.buffer);s.set([79,103,103,83],0),s[5]=i,c.setUint32(6,t%4294967296,!0),c.setUint32(10,Math.floor(t/4294967296),!0),c.setUint32(14,n,!0),c.setUint32(18,r,!0),s[26]=a.length,s.set(a,27);let l=27+a.length;for(let t of e)s.set(t,l),l+=t.length;return c.setUint32(22,Rr(s),!0),s}function Br(e){let t=new Uint8Array(19),n=new DataView(t.buffer);return t.set(new TextEncoder().encode(`OpusHead`),0),t[8]=1,t[9]=e,n.setUint16(10,312,!0),n.setUint32(12,48e3,!0),t}function Vr(){let e=new TextEncoder().encode(`chat-island`),t=new Uint8Array(12+e.length+4);return t.set(new TextEncoder().encode(`OpusTags`),0),new DataView(t.buffer).setUint32(8,e.length,!0),t.set(e,12),t}function Hr(e){let{head:t,channels:n,packets:r}=Fr(e);if(!r.length)return null;let i=t&&t.length>=19&&new TextDecoder().decode(t.slice(0,8))===`OpusHead`,a=Math.random()*4294967295>>>0,o=[zr([i?t:Br(n)],0,a,0,2),zr([Vr()],0,a,1,0)],s=0,c=2;for(let e=0;e<r.length;){let t=[],n=0;for(;e<r.length&&t.length<50;){let i=Math.floor(r[e].length/255)+1;if(n+i>255)break;t.push(r[e]),n+=i,s+=Ir(r[e]),e++}if(!t.length)return null;o.push(zr(t,s,a,c++,e>=r.length?4:0))}let l=o.reduce((e,t)=>e+t.length,0),u=new Uint8Array(l),d=0;for(let e of o)u.set(e,d),d+=e.length;return u}var Ur=[`audio/ogg;codecs=opus`,`audio/webm;codecs=opus`,`audio/mp4`,`audio/webm`];async function Wr(e,t){let n=Date.now();if(/webm/.test(t)&&/opus/.test(t))try{let t=Hr(new Uint8Array(await new Blob(e).arrayBuffer()));if(t)return new File([t],`voice-${n}.ogg`,{type:`audio/ogg`})}catch{}return new File(e,`voice-${n}.${Gr(t)}`,{type:t.split(`;`)[0]})}var Gr=e=>/mp4/.test(e)?`m4a`:/ogg/.test(e)?`ogg`:`webm`,Kr=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e%6e4/1e3)).padStart(2,`0`)}`;function qr({onSend:e,onTyping:t,onFile:n,disabled:r}){let[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(!1),c=(0,g.useRef)(null),l=(0,g.useRef)(null),u=(0,g.useRef)(null),d=(0,g.useRef)(),f=(0,g.useRef)(!1),[p,m]=(0,g.useState)(null),[h,_]=(0,g.useState)(0),v=(0,g.useRef)(!1),y=(0,g.useRef)(!1),b=(0,g.useRef)(!1),x=(0,g.useRef)({});(0,g.useEffect)(()=>u.current?.focus(),[]),(0,g.useEffect)(()=>()=>{b.current=!0,v.current=!0,window.clearTimeout(d.current);let{r:e,stream:t}=x.current;e&&e.state!==`inactive`&&e.stop(),t?.getTracks().forEach(e=>e.stop()),x.current={}},[]),(0,g.useEffect)(()=>{if(!p)return;let e=window.setInterval(()=>_(Date.now()-p.since),250);return()=>window.clearInterval(e)},[p]);let S=e=>{f.current!==e&&(f.current=e,t(e))},C=e=>{let t=e.includes(`:`)?mr(e):e;t!==e&&(c.current=Math.max(0,(u.current?.selectionStart??e.length)-(e.length-t.length))),a(t),t?(S(!0),window.clearTimeout(d.current),d.current=window.setTimeout(()=>S(!1),4e3)):S(!1)};(0,g.useLayoutEffect)(()=>{c.current!==null&&(u.current?.setSelectionRange(c.current,c.current),c.current=null)},[i]);let w=e=>{let t=u.current,n=t?.selectionStart??i.length,r=t?.selectionEnd??n;C(i.slice(0,n)+e+i.slice(r)),requestAnimationFrame(()=>{t?.focus(),t?.setSelectionRange(n+e.length,n+e.length)})},T=()=>{let t=i.trim();t&&(a(``),Promise.resolve(e(t)).catch(()=>a(e=>e||t)),window.clearTimeout(d.current),f.current=!1)},ee=async()=>{if(y.current||p)return;y.current=!0;let e;try{e=await navigator.mediaDevices.getUserMedia({audio:!0});let t=e;if(b.current){t.getTracks().forEach(e=>e.stop());return}let r=Ur.find(e=>MediaRecorder.isTypeSupported(e)),i=new MediaRecorder(e,r?{mimeType:r}:void 0),a=[];i.ondataavailable=e=>e.data.size&&a.push(e.data),i.onstop=()=>{t.getTracks().forEach(e=>e.stop()),x.current={},m(null),!v.current&&a.length&&Wr(a,i.mimeType||r||``).then(n)},v.current=!1,i.start(),x.current={r:i,stream:t},_(0),m({r:i,since:Date.now()})}catch{e?.getTracks().forEach(e=>e.stop())}finally{y.current=!1}},te=e=>{v.current=e,p?.r.stop()};return p?(0,I.jsxs)(`div`,{className:`ci-flex ci-items-center ci-gap-2 ci-px-3 ci-py-3`,children:[(0,I.jsx)(cr,{variant:`transparent`,title:`Discard`,"aria-label":`Discard`,onClick:()=>te(!0),className:`ci-h-10 ci-w-10`,children:L.close}),(0,I.jsxs)(`div`,{className:`ci-flex-1 ci-flex ci-items-center ci-gap-2 ci-px-4 ci-py-2.5 ci-rounded-3xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-sm`,children:[(0,I.jsx)(`span`,{className:`ci-w-2.5 ci-h-2.5 ci-rounded-full ci-bg-phoneIslandClose dark:ci-bg-phoneIslandCloseDark ci-animate-pulse`}),(0,I.jsxs)(`span`,{children:[`Recording `,Kr(h)]})]}),(0,I.jsx)(cr,{variant:`green`,title:`Send voice note`,"aria-label":`Send voice note`,onClick:()=>te(!1),className:`ci-h-10 ci-w-10`,children:L.send})]}):(0,I.jsxs)(`div`,{className:`ci-relative ci-flex ci-items-center ci-gap-2 ci-px-3 ci-py-3`,children:[o&&(0,I.jsx)(_r,{className:`ci-absolute ci-bottom-full ci-left-3 ci-mb-1`,onPick:w,onClose:()=>s(!1)}),(0,I.jsx)(`input`,{ref:l,type:`file`,hidden:!0,onChange:e=>e.target.files?.[0]&&(n(e.target.files[0]),e.target.value=``)}),(0,I.jsx)(cr,{variant:`transparent`,disabled:r,title:`Attach a file`,onClick:()=>l.current?.click(),className:`ci-h-10 ci-w-10`,children:L.clip}),(0,I.jsxs)(`div`,{className:`ci-relative ci-flex-1 ci-min-w-0`,children:[(0,I.jsx)(`button`,{type:`button`,disabled:r,title:`Emoji`,"aria-label":`Emoji`,"aria-expanded":o,onClick:()=>s(e=>!e),className:`ci-absolute ci-left-2 ci-bottom-1 ci-z-10 ci-h-8 ci-w-8 ci-flex ci-items-center ci-justify-center ci-rounded-full ci-border-0 ci-bg-transparent ci-text-secondaryNeutral dark:ci-text-secondaryNeutralDark hover:ci-bg-gray-300/70 dark:hover:ci-bg-gray-700/30 disabled:ci-opacity-40`,children:L.smile}),(0,I.jsx)(`textarea`,{ref:u,value:i,disabled:r,rows:1,placeholder:r?`Connectingโ€ฆ`:`Write a message`,onChange:e=>C(e.target.value),onKeyDown:e=>{let t=(i.match(/```/g)??[]).length%2==1;e.key===`Enter`&&!e.shiftKey&&!t&&(e.preventDefault(),T())},className:`ci-block ci-w-full ci-resize-none ci-max-h-32 ci-pl-11 ci-pr-4 ci-py-2.5 ci-rounded-3xl ci-border-0 ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400 ci-outline-none focus:ci-ring-2 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500 ci-text-sm`,style:{height:Math.min(128,40+20*(i.split(`
9
+ `).length-1))}})]}),i.trim()?(0,I.jsx)(cr,{variant:`default`,disabled:r,onClick:T,title:`Send`,className:`ci-h-10 ci-w-10`,children:L.send}):(0,I.jsx)(cr,{variant:`default`,disabled:r||typeof MediaRecorder>`u`,onClick:ee,title:`Record a voice note`,"aria-label":`Record a voice note`,className:`ci-h-10 ci-w-10`,children:L.mic})]})}var Jr=e=>!!e&&![`offline`,`dnd`,`busy`,`ringing`,`onhold`].includes(e);function Yr({peer:e,actions:t,onDragStart:n}){let{c:r,contacts:i,online:a,mobile:o,status:s,closeChat:c,openChat:l,markRead:u,order:d,me:f}=P(y(t=>({c:t.conversations[e],contacts:t.contacts,online:t.online,mobile:t.mobile,status:t.status,closeChat:t.closeChat,openChat:t.openChat,markRead:t.markRead,order:t.order,me:t.me}))),p=Math.max(0,d.indexOf(e)),m=i[e],[h,_]=(0,g.useState)(!1),v=e=>e===f?`You`:i[e]?.name??e,b=[...r?.members??[]].sort((e,t)=>Number(e===f)-Number(t===f));return(0,g.useEffect)(()=>{r&&!r.loaded&&t.loadOlder(e)},[e,r?.loaded]),(0,g.useEffect)(()=>{u(e)},[e,r?.messages.length]),(0,g.useEffect)(()=>_(!1),[e]),r?(0,I.jsxs)(`div`,{role:`dialog`,"aria-label":r.kind===`group`?r.name??e:m?.name??e,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),h?_(!1):c())},className:`ci-relative ci-w-[22rem] ci-h-[30rem] ci-flex ci-flex-col ci-rounded-3xl ci-shadow-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-text-gray-900 dark:ci-text-white`,children:[(0,I.jsx)(`span`,{className:`ci-absolute ci--right-1.5 ci-w-3 ci-h-3 ci-rotate-45 ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-2xl ci-transition-all ci-duration-200`,style:{bottom:`calc(1.875rem + ${p} * 3.75rem)`},"aria-hidden":`true`}),(0,I.jsxs)(`div`,{className:`ci-flex ci-items-center ci-gap-3 ci-px-4 ci-py-3 ci-rounded-t-3xl ${n?`ci-cursor-grab active:ci-cursor-grabbing ci-touch-none`:``}`,onPointerDown:n,children:[r.kind===`group`?(0,I.jsx)(ar,{name:r.name??e,size:36,avatar:r.avatar}):(0,I.jsxs)(`span`,{className:`ci-relative`,children:[(0,I.jsx)(rr,{contact:m,username:e,size:36}),(0,I.jsx)(ir,{online:a[e],presence:m?.presence,mobile:o[e]})]}),(0,I.jsxs)(`div`,{className:`ci-flex-1 ci-min-w-0 ${r.kind===`group`?`ci-cursor-pointer`:``}`,...r.kind===`group`?{role:`button`,tabIndex:0,"aria-expanded":h,onKeyDown:e=>(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),_(e=>!e))}:{},onClick:()=>r.kind===`group`&&_(e=>!e),children:[(0,I.jsx)(`div`,{className:`ci-font-medium ci-truncate ci-text-sm`,children:r.kind===`group`?r.name??e:m?.name??e}),(0,I.jsx)(`div`,{className:`ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-truncate`,children:s===`online`?r.kind===`group`?b.map(v).join(`, `):r.typing?`typingโ€ฆ`:a[e]?`online`:o[e]?`Mobile`:`offline`:s})]}),r.kind!==`group`&&m?.number&&Jr(m.presence)&&(0,I.jsx)(cr,{variant:`call`,title:`Call ${m.number}`,"aria-label":`Call`,onClick:()=>F(`chat-island-call`,{username:e,number:m.number}),children:L.phone}),(0,I.jsx)(cr,{variant:`small`,onClick:()=>c(),"aria-label":`Minimize`,title:`Minimize`,children:L.minus})]}),(0,I.jsx)(`div`,{className:`ci-border-t ci-border-gray-300 dark:ci-border-gray-700`}),h&&r.kind===`group`&&(0,I.jsx)(`div`,{className:`ci-absolute ci-left-3 ci-right-3 ci-top-16 ci-z-10 ci-max-h-64 ci-overflow-y-auto ci-rounded-2xl ci-bg-gray-50 dark:ci-bg-gray-950 ci-shadow-2xl ci-ring-1 ci-ring-gray-300 dark:ci-ring-gray-700 ci-p-2`,children:b.map(e=>(0,I.jsxs)(`div`,{className:`ci-flex ci-items-center ci-gap-3 ci-px-2 ci-py-1.5 ci-text-sm`,children:[(0,I.jsxs)(`span`,{className:`ci-relative`,children:[(0,I.jsx)(rr,{contact:i[e],username:e,size:28}),e!==f&&(0,I.jsx)(ir,{online:a[e],presence:i[e]?.presence,mobile:o[e]})]}),(0,I.jsx)(`span`,{className:`ci-truncate ci-flex-1`,children:v(e)}),e!==f&&(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(cr,{variant:`small`,title:`Chat`,"aria-label":`Chat`,onClick:()=>l(e),children:L.chat}),i[e]?.number&&Jr(i[e]?.presence)&&(0,I.jsx)(cr,{variant:`call`,title:`Call ${i[e]?.number}`,"aria-label":`Call`,onClick:()=>F(`chat-island-call`,{username:e,number:i[e].number}),children:L.phone})]})]},e))}),(0,I.jsxs)(`div`,{className:`ci-flex-1 ci-min-h-0 ci-flex ci-flex-col ci-overflow-hidden ci-rounded-b-3xl`,children:[(0,I.jsx)(Mr,{messages:r.messages,typing:r.typing,group:r.kind===`group`,hasOlder:r.loaded&&!r.complete,onLoadOlder:()=>t.loadOlder(e),reactions:r.reactions,me:f,onReact:(n,r)=>t.react(e,n,r)}),(0,I.jsx)(qr,{disabled:s!==`online`,onSend:n=>t.send(e,n),onTyping:n=>t.typing(e,n),onFile:n=>t.upload(e,n)},e)]})]}):null}async function Xr(e){let t=await createImageBitmap(e),n=Math.min(t.width,t.height),r=document.createElement(`canvas`);return r.width=r.height=128,r.getContext(`2d`)?.drawImage(t,(t.width-n)/2,(t.height-n)/2,n,n,0,0,128,128),r.toDataURL(`image/jpeg`,.8)}function Zr({onOpen:e,onCreateGroup:t}){let{contacts:n,online:r,mobile:i,setPicker:a}=P(),[o,s]=(0,g.useState)(``),[c,l]=(0,g.useState)([]),[u,d]=(0,g.useState)(``),[f,p]=(0,g.useState)(!1),[m,h]=(0,g.useState)(),_=(0,g.useRef)(null),v=(0,g.useMemo)(()=>{let e=Object.values(n),t=o.trim().toLowerCase();return t?e.filter(e=>(e.name??``).toLowerCase().includes(t)||e.username.includes(t)):e},[n,o]),y=e=>l(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),b=async()=>{p(!0);try{await t(u.trim(),c,m)}finally{p(!1)}};return(0,I.jsxs)(`div`,{className:`ci-w-[22rem] ci-max-h-[30rem] ci-flex ci-flex-col ci-rounded-3xl ci-shadow-2xl ci-overflow-hidden ci-bg-gray-50 dark:ci-bg-gray-950 ci-text-gray-900 dark:ci-text-white`,children:[(0,I.jsxs)(`div`,{className:`ci-px-4 ci-py-3 ci-flex ci-items-center ci-gap-2`,children:[(0,I.jsxs)(`div`,{className:`ci-flex-1 ci-flex ci-items-center ci-gap-2 ci-px-4 ci-py-2 ci-rounded-3xl ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-500 dark:ci-text-gray-400`,children:[L.search,(0,I.jsx)(`input`,{autoFocus:!0,value:o,onChange:e=>s(e.target.value),placeholder:`Search colleagues`,className:`ci-flex-1 ci-bg-transparent ci-border-0 ci-outline-none ci-text-sm ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400`})]}),(0,I.jsx)(cr,{variant:`small`,onClick:()=>a(!1),"aria-label":`Close`,children:L.close})]}),c.length>0&&(0,I.jsx)(`div`,{className:`ci-px-4 ci-pb-2 ci-flex ci-flex-wrap ci-gap-1.5`,children:c.map(e=>(0,I.jsxs)(`button`,{type:`button`,onClick:()=>y(e),className:`ci-flex ci-items-center ci-gap-1 ci-pl-2.5 ci-pr-1.5 ci-py-1 ci-rounded-full ci-text-xs ci-bg-gray-700 ci-text-gray-50 dark:ci-bg-gray-300 dark:ci-text-gray-900 ci-border-0`,children:[n[e]?.name??e,L.close]},e))}),(0,I.jsx)(`div`,{className:`ci-border-t ci-border-gray-300 dark:ci-border-gray-700`}),(0,I.jsxs)(`ul`,{className:`ci-overflow-y-auto ci-py-1 ci-m-0 ci-p-0 ci-list-none ci-flex-1`,children:[v.length===0&&(0,I.jsx)(`li`,{className:`ci-px-4 ci-py-6 ci-text-center ci-text-sm ci-text-gray-500 dark:ci-text-gray-400`,children:`No colleagues found`}),v.map(e=>{let t=c.includes(e.username);return(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,onClick:()=>y(e.username),className:`ci-w-full ci-flex ci-items-center ci-gap-3 ci-px-4 ci-py-2 ci-bg-transparent ci-border-0 ci-text-left hover:ci-bg-gray-300/70 dark:hover:ci-bg-gray-700/30 ci-text-inherit`,children:[(0,I.jsxs)(`span`,{className:`ci-relative`,children:[(0,I.jsx)(rr,{contact:e,username:e.username,size:36}),(0,I.jsx)(ir,{online:r[e.username],presence:e.presence,mobile:i[e.username]})]}),(0,I.jsxs)(`span`,{className:`ci-flex ci-flex-col ci-min-w-0 ci-flex-1`,children:[(0,I.jsx)(`span`,{className:`ci-text-sm ci-font-medium ci-truncate`,children:e.name}),(0,I.jsx)(`span`,{className:`ci-text-xs ci-text-gray-500 dark:ci-text-gray-400 ci-truncate`,children:e.username})]}),(0,I.jsx)(`span`,{className:`ci-w-5 ci-h-5 ci-rounded-full ci-border ci-flex ci-items-center ci-justify-center ${t?`ci-bg-phoneIslandCall dark:ci-bg-phoneIslandCallDark ci-border-transparent ci-text-white dark:ci-text-gray-950`:`ci-border-gray-400 dark:ci-border-gray-600`}`,children:t&&(0,I.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,I.jsx)(`path`,{d:`M20 6L9 17l-5-5`})})})]})},e.username)})]}),c.length>0&&(0,I.jsx)(`div`,{className:`ci-border-t ci-border-gray-300 dark:ci-border-gray-700 ci-px-4 ci-py-3 ci-flex ci-items-center ci-gap-2`,children:c.length===1?(0,I.jsx)(cr,{variant:`default`,className:`ci-w-auto ci-h-10 ci-px-5`,onClick:()=>e(c[0]),children:`Open chat`}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`input`,{ref:_,type:`file`,accept:`image/*`,hidden:!0,onChange:e=>e.target.files?.[0]&&Xr(e.target.files[0]).then(h).catch(()=>{})}),(0,I.jsx)(`button`,{type:`button`,title:`Group picture`,onClick:()=>_.current?.click(),className:`ci-w-10 ci-h-10 ci-shrink-0 ci-rounded-full ci-border-0 ci-p-0 ci-overflow-hidden ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-gray-500 dark:ci-text-gray-400 ci-flex ci-items-center ci-justify-center`,children:m?(0,I.jsx)(`img`,{src:m,alt:``,draggable:!1,className:`ci-w-full ci-h-full ci-object-cover`}):L.camera}),(0,I.jsx)(`input`,{value:u,onChange:e=>d(e.target.value),placeholder:`Group name`,onKeyDown:e=>e.key===`Enter`&&u.trim()&&!f&&b(),className:`ci-flex-1 ci-min-w-0 ci-w-0 ci-px-4 ci-py-2 ci-rounded-3xl ci-border-0 ci-bg-elevationL2 dark:ci-bg-elevationL2Dark ci-text-sm ci-text-gray-900 dark:ci-text-white placeholder:ci-text-gray-500 dark:placeholder:ci-text-gray-400 ci-outline-none focus:ci-ring-2 focus:ci-ring-gray-400 dark:focus:ci-ring-gray-500`}),(0,I.jsx)(cr,{variant:`green`,className:`ci-w-auto ci-h-10 ci-px-4 ci-shrink-0 ci-whitespace-nowrap`,disabled:!u.trim()||f,onClick:b,children:f?`โ€ฆ`:`Create group`})]})})]})}var Qr=`chat-island-theme`,$r=()=>{try{let e=localStorage.getItem(Qr);return e===`light`||e===`dark`||e===`system`?e:void 0}catch{return}};function ei(e){let[t,n]=(0,g.useState)(()=>e??$r()),[r,i]=(0,g.useState)(!1);return(0,g.useEffect)(()=>n(e??$r()),[e]),(0,g.useEffect)(()=>{let e=e=>{let t=e.detail?.theme;if(t===`light`||t===`dark`||t===`system`){try{localStorage.setItem(Qr,t)}catch{}n(t)}};return window.addEventListener(`chat-island-theme-change`,e),()=>window.removeEventListener(`chat-island-theme-change`,e)},[]),(0,g.useEffect)(()=>{if(t===`light`||t===`dark`){i(t===`dark`);return}if(t===`system`){let e=window.matchMedia(`(prefers-color-scheme: dark)`),t=()=>i(e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}let e=document.documentElement,n=()=>i(e.classList.contains(`dark`));n();let r=new MutationObserver(n);return r.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>r.disconnect()},[t]),r}function ti(){let e=P.getState();return Object.values(e.conversations).map(t=>{let n=t.messages[t.messages.length-1],r=e.contacts[t.peer];return{peer:t.peer,kind:t.kind,name:t.kind===`group`?t.name??t.peer.split(`@`)[0]:r?.name??t.peer,avatar:t.kind===`group`?t.avatar:r?.avatar,online:t.kind!==`group`&&!!e.online[t.peer],mobile:t.kind!==`group`&&!!e.mobile[t.peer],owner:t.kind===`group`?!!t.owner:void 0,unread:t.unread,members:t.members,last:n?{body:ii(n.body),ts:n.ts,mine:n.mine,oob:n.oob,nick:n.nick}:void 0}}).filter(e=>e.last||e.kind===`group`).sort((e,t)=>(t.last?.ts??0)-(e.last?.ts??0))}var ni=class extends g.Component{state={failed:!1};failures=[];static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(e){F(`chat-island-error`,{scope:`render`,message:e.message});let t=Date.now();this.failures=[...this.failures.filter(e=>t-e<1e4),t],!(this.failures.length>=3)&&(P.getState().closeChat(),window.setTimeout(()=>this.setState({failed:!1}),0))}render(){return this.state.failed?null:this.props.children}};function ri(e){try{let[t,n,r]=atob(e).split(`:`);return t&&n&&r?{host:t,username:n,token:r}:null}catch{return null}}var ii=e=>(Tr(e)?`Attachment`:mr(e)).replace(/```[^\n]*\n?/g,``).replace(/(\*\*|__|~~|`)/g,``).replace(/(^|\s)[*_](\S[^*_]*)[*_]/g,`$1$2`).replace(/\s+/g,` `).trim();function ai({dataConfig:e,position:t=`bottom-right`,theme:n,serviceWorker:r,maxHeads:i=5,newChatButton:a=!0,notifications:o=`click`,sound:s=!0,drag:c=!0,onDragStart:l}){let u=(0,g.useMemo)(()=>ri(e),[e]),d=ei(n),f=(0,g.useRef)(u),p=(0,g.useRef)(s),m=(0,g.useRef)(o);(0,g.useEffect)(()=>{f.current=u,p.current=s,m.current=o},[u,s,o]),(0,g.useEffect)(()=>P.setState({maxHeads:i,newChatButton:a}),[i,a]);let[h,_]=(0,g.useState)(0);(0,g.useEffect)(()=>{let e=e=>e.persisted&&_(e=>e+1);return window.addEventListener(`pageshow`,e),()=>window.removeEventListener(`pageshow`,e)},[]);let v=(0,g.useRef)(null),b=(0,g.useRef)(new Set),S=(0,g.useRef)(!1),C=(0,g.useRef)(null),w=(0,g.useRef)(null),T=x(w,`chat-island-pos:${u?.host??``}:${u?.username??``}`),{open:ee,picker:te,status:ne}=P(y(e=>({open:e.open,picker:e.picker,status:e.status}))),re=(0,g.useMemo)(()=>({send:async(e,t)=>{let n=v.current;if(!n)throw Error(`not connected`);try{P.getState().addMessage(e,await n.send(e,mr(t)))}catch(e){throw F(`chat-island-error`,{scope:`send`,message:e.message}),e}},typing:(e,t)=>P.getState().online[e]&&v.current?.typing(e,t).catch(()=>{}),upload:async(e,t)=>{let n=v.current;if(n)try{let r=await n.upload(t);P.getState().addMessage(e,await n.send(e,t.name,r))}catch(e){F(`chat-island-error`,{scope:`upload`,message:e.message})}},createGroup:async(e,t,n)=>{let r=v.current,i=f.current;if(r&&i)try{let a=await r.createGroup(e,t,n),o=P.getState();o.setGroup(a,e,[...t,i.username],n),o.openChat(a)}catch(e){F(`chat-island-error`,{scope:`group`,message:e.message})}},remove:async e=>{let t=v.current,n=f.current;if(!t||!n)return;let r=P.getState().conversations[e];try{r?.kind===`group`&&await t.leaveGroup(e,!!r.owner).catch(()=>{}),await Yn(n.host,n.token,e),P.getState().removeConversation(e)}catch(e){F(`chat-island-error`,{scope:`delete`,message:e.message})}},react:async(e,t,n)=>{let r=v.current,i=f.current?.username;if(!r||!i)return;let a=(P.getState().conversations[e]?.reactions?.[t]?.[i]??[]).includes(n)?[]:[n];try{await r.react(e,t,a),P.getState().applyReactions([{peer:e,target:t,user:i,emojis:a}])}catch(e){F(`chat-island-error`,{scope:`reaction`,message:e.message})}},loadOlder:async e=>{let t=v.current,n=P.getState().ensure(e);if(!(!t||n.complete||b.current.has(e))){b.current.add(e);try{let r=await t.history(e,n.oldest);P.getState().prependHistory(e,r.messages,r.complete,r.first),P.getState().applyReactions(r.reactions)}catch(e){F(`chat-island-error`,{scope:`history`,message:e.message})}finally{b.current.delete(e)}}}}),[]);(0,g.useEffect)(()=>{if(!u)return;let e=P.getState();e.reset(),P.setState({me:u.username,mucHost:`conference.${u.host}`,maxHeads:i,newChatButton:a});let t=new Cn(u,{status:(n,i)=>{if(e.setStatus(n,i),F(`chat-island-status`,{status:n,error:i}),n===`online`&&r&&!S.current&&typeof Notification<`u`){let e=Notification.permission;(e===`granted`||m.current===`auto`&&e==="default")&&o()}n===`online`&&t.listGroups().then(t=>t.forEach(t=>e.setGroup(t.peer,t.name,t.members,t.avatar,t.owner))).catch(()=>{}).then(()=>t.recent()).then(e=>{e&&(P.getState().seed(e.messages,u.username),P.getState().applyReactions(e.reactions))}).catch(()=>{})},typing:(t,n)=>e.setTyping(t,n),reaction:t=>e.applyReactions([t]),presence:(t,n)=>e.setOnline(t,n),groupDestroyed:t=>e.removeConversation(t),groupInvite:n=>{t.subscribed(n).then(async r=>{if(!r)return;let i=await t.groupInfo(n);e.setGroup(i.peer,i.name,i.members,i.avatar,i.owner)}).catch(()=>{})},message:r=>{let i=Un(r);r.room&&!P.getState().conversations[r.room]?.name&&t.groupInfo(r.room).then(t=>e.setGroup(t.peer,t.name,t.members,t.avatar,t.owner)).catch(()=>{}),e.addMessage(i,r,{live:!0}),F(`chat-island-message`,{...r,peer:i}),F(`chat-island-unread`,{total:P.getState().totalUnread()}),r.mine||n(i,r)}}),n=(e,t)=>{let n=P.getState(),r=document.visibilityState===`visible`;if(r&&n.open===e)return;let i=n.conversations[e],a=i?.kind===`group`?i.name??e:n.contacts[e]?.name??e,o=t.oob?`Attachment`:mr(t.body),s=i?.kind===`group`,c=s&&t.nick?n.contacts[t.nick]?.name??t.nick:a,l=s&&t.nick?`${c}: ${o}`:o;p.current&&An();let u=s?i?.avatar:n.contacts[e]?.avatar;if(F(`chat-island-notify`,{peer:e,name:a,body:l,kind:s?`group`:`chat`,author:c,text:o,attachment:!!t.oob,avatar:u,ts:t.ts}),!r&&typeof Notification<`u`&&Notification.permission===`granted`)try{let t=new Notification(a,{body:l,tag:`chat-${e}`});t.onclick=()=>{window.focus(),P.getState().openChat(e),t.close()}}catch{}};v.current=t;let o=()=>{r&&!S.current&&(S.current=!0,$n(u,r).then(e=>{if(!e){S.current=!1,P.setState({push:Notification.permission===`denied`?`denied`:`ask`});return}return t.enablePush(e.service,e.node).then(()=>{C.current=e,P.setState({push:`enabled`}),F(`chat-island-push`,{enabled:!0})})}).catch(e=>{S.current=!1,F(`chat-island-error`,{scope:`push`,message:e.message})}))},s=!!r&&`serviceWorker`in navigator&&`PushManager`in window&&typeof Notification<`u`;P.setState({push:s?Notification.permission===`denied`?`denied`:`ask`:`unavailable`,enablePush:o});let c=()=>t.stop();window.addEventListener(`pagehide`,c),t.start();let l=()=>Jn(u.host,u.token).then(e.setMobile).catch(()=>{});l();let d=window.setInterval(l,12e4);qn(u.host,u.token,u.username).then(e.setContacts).catch(e=>F(`chat-island-error`,{scope:`contacts`,message:e.message}));let f=er(`chat-island-open`,({username:t})=>t&&e.openChat(t)),h=er(`chat-island-close`,()=>e.closeChat()),g=er(`chat-island-new`,()=>e.setPicker(!0)),_=er(`chat-island-delete`,({username:e})=>e&&re.remove(e)),y=er(`chat-island-contacts`,({contacts:t})=>t&&e.setContacts(t)),b=er(`chat-island-conversations-request`,()=>F(`chat-island-conversations`,{conversations:ti()}));return()=>{window.removeEventListener(`pagehide`,c),window.clearInterval(d),b(),g(),_(),f(),h(),y(),C.current&&t.disablePush(C.current.service,C.current.node).catch(()=>{}),C.current=null,t.stop(),v.current=null,S.current=!1}},[u,r,h]);let ie=P(e=>Object.keys(e.contacts).join(`,`));(0,g.useEffect)(()=>{ne===`online`&&ie&&v.current?.announce(ie.split(`,`))},[ne,ie]);let ae=P(e=>Object.values(e.conversations).map(e=>`${e.peer}:${e.kind}:${e.name??``}:${(e.members??[]).length}:${e.unread}:${e.messages[e.messages.length-1]?.id??``}`).join(`|`)+`#`+Object.keys(e.contacts).length+`#`+Object.values(e.online).filter(Boolean).length);(0,g.useEffect)(()=>F(`chat-island-conversations`,{conversations:ti()}),[ae]);let oe=P(e=>Object.values(e.conversations).reduce((e,t)=>e+t.unread,0));if((0,g.useEffect)(()=>F(`chat-island-unread`,{total:oe}),[oe]),!u)return null;let se=c&&!l&&T.anchor?{right:T.anchor.right,bottom:T.anchor.bottom}:void 0,E=se?``:t===`bottom-left`?`ci-left-4 ci-bottom-5`:`ci-right-4 ci-bottom-5`;return(0,I.jsx)(`div`,{ref:w,style:se,onClickCapture:T.onClickCapture,className:`chat-island-root ${d?`ci-dark`:``} ci-fixed ${E} ci-z-[9999] ci-flex ci-items-end ci-gap-3 ci-font-sans ci-select-none`,"data-status":ne,children:(0,I.jsxs)(ni,{children:[ee&&(0,I.jsx)(Yr,{peer:ee,actions:re,onDragStart:l??(c?T.start:void 0)}),te&&(0,I.jsx)(Zr,{onOpen:e=>P.getState().openChat(e),onCreateGroup:re.createGroup}),(0,I.jsx)(lr,{onDragStart:l??(c?T.start:void 0),pushButton:o!==`auto`})]})})}document.querySelectorAll(`.chat-island`).forEach(e=>{(0,h.createRoot)(e).render((0,I.jsx)(g.StrictMode,{children:(0,I.jsx)(ai,{dataConfig:e.dataset.config??``,position:e.dataset.position===`bottom-left`?`bottom-left`:`bottom-right`,theme:e.dataset.theme,serviceWorker:e.dataset.serviceWorker})}))})})();