(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const v of document.querySelectorAll('link[rel="modulepreload"]'))s(v);new MutationObserver(v=>{for(const N of v)if(N.type==="childList")for(const I of N.addedNodes)I.tagName==="LINK"&&I.rel==="modulepreload"&&s(I)}).observe(document,{childList:!0,subtree:!0});function b(v){const N={};return v.integrity&&(N.integrity=v.integrity),v.referrerPolicy&&(N.referrerPolicy=v.referrerPolicy),v.crossOrigin==="use-credentials"?N.credentials="include":v.crossOrigin==="anonymous"?N.credentials="omit":N.credentials="same-origin",N}function s(v){if(v.ep)return;v.ep=!0;const N=b(v);fetch(v.href,N)}})();function dm(O){return O&&O.__esModule&&Object.prototype.hasOwnProperty.call(O,"default")?O.default:O}var fr={exports:{}},Mu={};var Kd;function hm(){if(Kd)return Mu;Kd=1;var O=Symbol.for("react.transitional.element"),r=Symbol.for("react.fragment");function b(s,v,N){var I=null;if(N!==void 0&&(I=""+N),v.key!==void 0&&(I=""+v.key),"key"in v){N={};for(var W in v)W!=="key"&&(N[W]=v[W])}else N=v;return v=N.ref,{$$typeof:O,type:s,key:I,ref:v!==void 0?v:null,props:N}}return Mu.Fragment=r,Mu.jsx=b,Mu.jsxs=b,Mu}var Jd;function pm(){return Jd||(Jd=1,fr.exports=hm()),fr.exports}var P=pm(),sr={exports:{}},oe={};var Fd;function mm(){if(Fd)return oe;Fd=1;var O=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),I=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),S=Symbol.for("react.memo"),ae=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),_e=Symbol.iterator;function Ke(m){return m===null||typeof m!="object"?null:(m=_e&&m[_e]||m["@@iterator"],typeof m=="function"?m:null)}var Ce={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Te=Object.assign,Be={};function Le(m,B,w){this.props=m,this.context=B,this.refs=Be,this.updater=w||Ce}Le.prototype.isReactComponent={},Le.prototype.setState=function(m,B){if(typeof m!="object"&&typeof m!="function"&&m!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,m,B,"setState")},Le.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function D(){}D.prototype=Le.prototype;function V(m,B,w){this.props=m,this.context=B,this.refs=Be,this.updater=w||Ce}var ue=V.prototype=new D;ue.constructor=V,Te(ue,Le.prototype),ue.isPureReactComponent=!0;var Ue=Array.isArray;function De(){}var re={H:null,A:null,T:null,S:null},tt=Object.prototype.hasOwnProperty;function wt(m,B,w){var X=w.ref;return{$$typeof:O,type:m,key:B,ref:X!==void 0?X:null,props:w}}function Sl(m,B){return wt(m.type,B,m.props)}function Xt(m){return typeof m=="object"&&m!==null&&m.$$typeof===O}function st(m){var B={"=":"=0",":":"=2"};return"$"+m.replace(/[=:]/g,function(w){return B[w]})}var Al=/\/+/g;function Zt(m,B){return typeof m=="object"&&m!==null&&m.key!=null?st(""+m.key):B.toString(36)}function Dt(m){switch(m.status){case"fulfilled":return m.value;case"rejected":throw m.reason;default:switch(typeof m.status=="string"?m.then(De,De):(m.status="pending",m.then(function(B){m.status==="pending"&&(m.status="fulfilled",m.value=B)},function(B){m.status==="pending"&&(m.status="rejected",m.reason=B)})),m.status){case"fulfilled":return m.value;case"rejected":throw m.reason}}throw m}function M(m,B,w,X,ie){var de=typeof m;(de==="undefined"||de==="boolean")&&(m=null);var Oe=!1;if(m===null)Oe=!0;else switch(de){case"bigint":case"string":case"number":Oe=!0;break;case"object":switch(m.$$typeof){case O:case r:Oe=!0;break;case ae:return Oe=m._init,M(Oe(m._payload),B,w,X,ie)}}if(Oe)return ie=ie(m),Oe=X===""?"."+Zt(m,0):X,Ue(ie)?(w="",Oe!=null&&(w=Oe.replace(Al,"$&/")+"/"),M(ie,B,w,"",function(ll){return ll})):ie!=null&&(Xt(ie)&&(ie=Sl(ie,w+(ie.key==null||m&&m.key===ie.key?"":(""+ie.key).replace(Al,"$&/")+"/")+Oe)),B.push(ie)),1;Oe=0;var Ve=X===""?".":X+":";if(Ue(m))for(var Xe=0;Xe>>1,G=M[ve];if(0>>1;vev(w,ne))Xv(ie,w)?(M[ve]=ie,M[X]=ne,ve=X):(M[ve]=w,M[B]=ne,ve=B);else if(Xv(ie,ne))M[ve]=ie,M[X]=ne,ve=X;else break e}}return R}function v(M,R){var ne=M.sortIndex-R.sortIndex;return ne!==0?ne:M.id-R.id}if(O.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var N=performance;O.unstable_now=function(){return N.now()}}else{var I=Date,W=I.now();O.unstable_now=function(){return I.now()-W}}var H=[],S=[],ae=1,ee=null,_e=3,Ke=!1,Ce=!1,Te=!1,Be=!1,Le=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,V=typeof setImmediate<"u"?setImmediate:null;function ue(M){for(var R=b(S);R!==null;){if(R.callback===null)s(S);else if(R.startTime<=M)s(S),R.sortIndex=R.expirationTime,r(H,R);else break;R=b(S)}}function Ue(M){if(Te=!1,ue(M),!Ce)if(b(H)!==null)Ce=!0,De||(De=!0,st());else{var R=b(S);R!==null&&Dt(Ue,R.startTime-M)}}var De=!1,re=-1,tt=5,wt=-1;function Sl(){return Be?!0:!(O.unstable_now()-wtM&&Sl());){var ve=ee.callback;if(typeof ve=="function"){ee.callback=null,_e=ee.priorityLevel;var G=ve(ee.expirationTime<=M);if(M=O.unstable_now(),typeof G=="function"){ee.callback=G,ue(M),R=!0;break t}ee===b(H)&&s(H),ue(M)}else s(H);ee=b(H)}if(ee!==null)R=!0;else{var m=b(S);m!==null&&Dt(Ue,m.startTime-M),R=!1}}break e}finally{ee=null,_e=ne,Ke=!1}R=void 0}}finally{R?st():De=!1}}}var st;if(typeof V=="function")st=function(){V(Xt)};else if(typeof MessageChannel<"u"){var Al=new MessageChannel,Zt=Al.port2;Al.port1.onmessage=Xt,st=function(){Zt.postMessage(null)}}else st=function(){Le(Xt,0)};function Dt(M,R){re=Le(function(){M(O.unstable_now())},R)}O.unstable_IdlePriority=5,O.unstable_ImmediatePriority=1,O.unstable_LowPriority=4,O.unstable_NormalPriority=3,O.unstable_Profiling=null,O.unstable_UserBlockingPriority=2,O.unstable_cancelCallback=function(M){M.callback=null},O.unstable_forceFrameRate=function(M){0>M||125ve?(M.sortIndex=ne,r(S,M),b(H)===null&&M===b(S)&&(Te?(D(re),re=-1):Te=!0,Dt(Ue,ne-ve))):(M.sortIndex=G,r(H,M),Ce||Ke||(Ce=!0,De||(De=!0,st()))),M},O.unstable_shouldYield=Sl,O.unstable_wrapCallback=function(M){var R=_e;return function(){var ne=_e;_e=R;try{return M.apply(this,arguments)}finally{_e=ne}}}})(pr)),pr}var Pd;function bm(){return Pd||(Pd=1,hr.exports=vm()),hr.exports}var mr={exports:{}},_t={};var eh;function gm(){if(eh)return _t;eh=1;var O=vr();function r(H){var S="https://react.dev/errors/"+H;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(O)}catch(r){console.error(r)}}return O(),mr.exports=gm(),mr.exports}var lh;function _m(){if(lh)return xu;lh=1;var O=bm(),r=vr(),b=ym();function s(e){var t="https://react.dev/errors/"+e;if(1G||(e.current=ve[G],ve[G]=null,G--)}function w(e,t){G++,ve[G]=e.current,e.current=t}var X=m(null),ie=m(null),de=m(null),Oe=m(null);function Ve(e,t){switch(w(de,t),w(ie,e),w(X,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?bd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=bd(t),e=gd(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}B(X),w(X,e)}function Xe(){B(X),B(ie),B(de)}function ll(e){e.memoizedState!==null&&w(Oe,e);var t=X.current,l=gd(t,e.type);t!==l&&(w(ie,e),w(X,l))}function fl(e){ie.current===e&&(B(X),B(ie)),Oe.current===e&&(B(Oe),Tu._currentValue=ne)}var Jn,Fn;function dt(e){if(Jn===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);Jn=t&&t[1]||"",Fn=-1)":-1a||d[n]!==_[a]){var z=` `+d[n].replace(" at new "," at ");return e.displayName&&z.includes("")&&(z=z.replace("",e.displayName)),z}while(1<=n&&0<=a);break}}}finally{wa=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?dt(l):""}function lc(e,t){switch(e.tag){case 26:case 27:case 5:return dt(e.type);case 16:return dt("Lazy");case 13:return e.child!==t&&t!==null?dt("Suspense Fallback"):dt("Suspense");case 19:return dt("SuspenseList");case 0:case 15:return Rt(e.type,!1);case 11:return Rt(e.type.render,!1);case 1:return Rt(e.type,!0);case 31:return dt("Activity");default:return""}}function $n(e){try{var t="",l=null;do t+=lc(e,l),l=e,e=e.return;while(e);return t}catch(n){return` Error generating stack: `+n.message+` `+n.stack}}var Da=Object.prototype.hasOwnProperty,Tn=O.unstable_scheduleCallback,Ra=O.unstable_cancelCallback,nc=O.unstable_shouldYield,ac=O.unstable_requestPaint,St=O.unstable_now,On=O.unstable_getCurrentPriorityLevel,Hu=O.unstable_ImmediatePriority,wu=O.unstable_UserBlockingPriority,jt=O.unstable_NormalPriority,uc=O.unstable_LowPriority,Du=O.unstable_IdlePriority,sl=O.log,ic=O.unstable_setDisableYieldValue,Cn=null,ot=null;function dl(e){if(typeof sl=="function"&&ic(e),ot&&typeof ot.setStrictMode=="function")try{ot.setStrictMode(Cn,e)}catch{}}var At=Math.clz32?Math.clz32:ja,cc=Math.log,Ru=Math.LN2;function ja(e){return e>>>=0,e===0?32:31-(cc(e)/Ru|0)|0}var Ql=256,zn=262144,In=4194304;function hl(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Wl(e,t,l){var n=e.pendingLanes;if(n===0)return 0;var a=0,u=e.suspendedLanes,i=e.pingedLanes;e=e.warmLanes;var c=n&134217727;return c!==0?(n=c&~u,n!==0?a=hl(n):(i&=c,i!==0?a=hl(i):l||(l=c&~e,l!==0&&(a=hl(l))))):(c=n&~u,c!==0?a=hl(c):i!==0?a=hl(i):l||(l=n&~e,l!==0&&(a=hl(l)))),a===0?0:t!==0&&t!==a&&(t&u)===0&&(u=a&-a,l=t&-t,u>=l||u===32&&(l&4194048)!==0)?t:a}function nl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Mn(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ju(){var e=In;return In<<=1,(In&62914560)===0&&(In=4194304),e}function Pn(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function El(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Xl(e,t,l,n,a,u){var i=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var c=e.entanglements,d=e.expirationTimes,_=e.hiddenUpdates;for(l=i&~l;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Ya=/[\n"\\]/g;function o(e){return e.replace(Ya,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function f(e,t,l,n,a,u,i,c){e.name="",i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"?e.type=i:e.removeAttribute("type"),t!=null?i==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+Ct(t)):e.value!==""+Ct(t)&&(e.value=""+Ct(t)):i!=="submit"&&i!=="reset"||e.removeAttribute("value"),t!=null?E(e,i,Ct(t)):l!=null?E(e,i,Ct(l)):n!=null&&e.removeAttribute("value"),a==null&&u!=null&&(e.defaultChecked=!!u),a!=null&&(e.checked=a&&typeof a!="function"&&typeof a!="symbol"),c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"?e.name=""+Ct(c):e.removeAttribute("name")}function h(e,t,l,n,a,u,i,c){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||l!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){Cl(e);return}l=l!=null?""+Ct(l):"",t=t!=null?""+Ct(t):l,c||t===e.value||(e.value=t),e.defaultValue=t}n=n??a,n=typeof n!="function"&&typeof n!="symbol"&&!!n,e.checked=c?e.checked:!!n,e.defaultChecked=!!n,i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(e.name=i),Cl(e)}function E(e,t,l){t==="number"&&na(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function C(e,t,l,n){if(e=e.options,t){t={};for(var a=0;a"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Bn=!1;if(ul)try{var Un={};Object.defineProperty(Un,"passive",{get:function(){Bn=!0}}),window.addEventListener("test",Un,Un),window.removeEventListener("test",Un,Un)}catch{Bn=!1}var vl=null,L=null,zt=null;function zl(){if(zt)return zt;var e,t=L,l=t.length,n,a="value"in vl?vl.value:vl.textContent,u=a.length;for(e=0;e=Xa),Er=" ",Tr=!1;function Or(e,t){switch(e){case"keyup":return wh.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cr(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var aa=!1;function Rh(e,t){switch(e){case"compositionend":return Cr(t);case"keypress":return t.which!==32?null:(Tr=!0,Er);case"textInput":return e=t.data,e===Er&&Tr?null:e;default:return null}}function jh(e,t){if(aa)return e==="compositionend"||!mc&&Or(e,t)?(e=zl(),zt=L=vl=null,aa=!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)return{node:l,offset:t-e};e=n}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=wr(l)}}function Rr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Rr(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function jr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=na(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=na(e.document)}return t}function gc(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")}var Xh=ul&&"documentMode"in document&&11>=document.documentMode,ua=null,yc=null,Ja=null,_c=!1;function qr(e,t,l){var n=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;_c||ua==null||ua!==na(n)||(n=ua,"selectionStart"in n&&gc(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),Ja&&Ka(Ja,n)||(Ja=n,n=ji(yc,"onSelect"),0>=i,a-=i,bl=1<<32-At(t)+a|l<pe?(Ae=$,$=null):Ae=$.sibling;var xe=A(g,$,y[pe],x);if(xe===null){$===null&&($=Ae);break}e&&$&&xe.alternate===null&&t(g,$),p=u(xe,p,pe),Me===null?te=xe:Me.sibling=xe,Me=xe,$=Ae}if(pe===y.length)return l(g,$),Ee&&xl(g,pe),te;if($===null){for(;pepe?(Ae=$,$=null):Ae=$.sibling;var Sn=A(g,$,xe.value,x);if(Sn===null){$===null&&($=Ae);break}e&&$&&Sn.alternate===null&&t(g,$),p=u(Sn,p,pe),Me===null?te=Sn:Me.sibling=Sn,Me=Sn,$=Ae}if(xe.done)return l(g,$),Ee&&xl(g,pe),te;if($===null){for(;!xe.done;pe++,xe=y.next())xe=U(g,xe.value,x),xe!==null&&(p=u(xe,p,pe),Me===null?te=xe:Me.sibling=xe,Me=xe);return Ee&&xl(g,pe),te}for($=n($);!xe.done;pe++,xe=y.next())xe=T($,g,pe,xe.value,x),xe!==null&&(e&&xe.alternate!==null&&$.delete(xe.key===null?pe:xe.key),p=u(xe,p,pe),Me===null?te=xe:Me.sibling=xe,Me=xe);return e&&$.forEach(function(sm){return t(g,sm)}),Ee&&xl(g,pe),te}function Ge(g,p,y,x){if(typeof y=="object"&&y!==null&&y.type===Te&&y.key===null&&(y=y.props.children),typeof y=="object"&&y!==null){switch(y.$$typeof){case Ke:e:{for(var te=y.key;p!==null;){if(p.key===te){if(te=y.type,te===Te){if(p.tag===7){l(g,p.sibling),x=a(p,y.props.children),x.return=g,g=x;break e}}else if(p.elementType===te||typeof te=="object"&&te!==null&&te.$$typeof===tt&&Vn(te)===p.type){l(g,p.sibling),x=a(p,y.props),tu(x,y),x.return=g,g=x;break e}l(g,p);break}else t(g,p);p=p.sibling}y.type===Te?(x=jn(y.props.children,g.mode,x,y.key),x.return=g,g=x):(x=ei(y.type,y.key,y.props,null,g.mode,x),tu(x,y),x.return=g,g=x)}return i(g);case Ce:e:{for(te=y.key;p!==null;){if(p.key===te)if(p.tag===4&&p.stateNode.containerInfo===y.containerInfo&&p.stateNode.implementation===y.implementation){l(g,p.sibling),x=a(p,y.children||[]),x.return=g,g=x;break e}else{l(g,p);break}else t(g,p);p=p.sibling}x=zc(y,g.mode,x),x.return=g,g=x}return i(g);case tt:return y=Vn(y),Ge(g,p,y,x)}if(Dt(y))return k(g,p,y,x);if(st(y)){if(te=st(y),typeof te!="function")throw Error(s(150));return y=te.call(y),le(g,p,y,x)}if(typeof y.then=="function")return Ge(g,p,ci(y),x);if(y.$$typeof===V)return Ge(g,p,ni(g,y),x);oi(g,y)}return typeof y=="string"&&y!==""||typeof y=="number"||typeof y=="bigint"?(y=""+y,p!==null&&p.tag===6?(l(g,p.sibling),x=a(p,y),x.return=g,g=x):(l(g,p),x=Cc(y,g.mode,x),x.return=g,g=x),i(g)):l(g,p)}return function(g,p,y,x){try{eu=0;var te=Ge(g,p,y,x);return va=null,te}catch($){if($===ma||$===ui)throw $;var Me=Gt(29,$,null,g.mode);return Me.lanes=x,Me.return=g,Me}finally{}}}var Wn=of(!0),rf=of(!1),nn=!1;function Gc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Lc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function an(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function un(e,t,l){var n=e.updateQueue;if(n===null)return null;if(n=n.shared,(Ne&2)!==0){var a=n.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),n.pending=t,t=Pu(e),Xr(e,null,l),t}return Iu(e,n,t,l),Pu(e)}function lu(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,Gu(e,l)}}function Yc(e,t){var l=e.updateQueue,n=e.alternate;if(n!==null&&(n=n.updateQueue,l===n)){var a=null,u=null;if(l=l.firstBaseUpdate,l!==null){do{var i={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};u===null?a=u=i:u=u.next=i,l=l.next}while(l!==null);u===null?a=u=t:u=u.next=t}else a=u=t;l={baseState:n.baseState,firstBaseUpdate:a,lastBaseUpdate:u,shared:n.shared,callbacks:n.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Vc=!1;function nu(){if(Vc){var e=pa;if(e!==null)throw e}}function au(e,t,l,n){Vc=!1;var a=e.updateQueue;nn=!1;var u=a.firstBaseUpdate,i=a.lastBaseUpdate,c=a.shared.pending;if(c!==null){a.shared.pending=null;var d=c,_=d.next;d.next=null,i===null?u=_:i.next=_,i=d;var z=e.alternate;z!==null&&(z=z.updateQueue,c=z.lastBaseUpdate,c!==i&&(c===null?z.firstBaseUpdate=_:c.next=_,z.lastBaseUpdate=d))}if(u!==null){var U=a.baseState;i=0,z=_=d=null,c=u;do{var A=c.lane&-536870913,T=A!==c.lane;if(T?(Se&A)===A:(n&A)===A){A!==0&&A===ha&&(Vc=!0),z!==null&&(z=z.next={lane:0,tag:c.tag,payload:c.payload,callback:null,next:null});e:{var k=e,le=c;A=t;var Ge=l;switch(le.tag){case 1:if(k=le.payload,typeof k=="function"){U=k.call(Ge,U,A);break e}U=k;break e;case 3:k.flags=k.flags&-65537|128;case 0:if(k=le.payload,A=typeof k=="function"?k.call(Ge,U,A):k,A==null)break e;U=ee({},U,A);break e;case 2:nn=!0}}A=c.callback,A!==null&&(e.flags|=64,T&&(e.flags|=8192),T=a.callbacks,T===null?a.callbacks=[A]:T.push(A))}else T={lane:A,tag:c.tag,payload:c.payload,callback:c.callback,next:null},z===null?(_=z=T,d=U):z=z.next=T,i|=A;if(c=c.next,c===null){if(c=a.shared.pending,c===null)break;T=c,c=T.next,T.next=null,a.lastBaseUpdate=T,a.shared.pending=null}}while(!0);z===null&&(d=U),a.baseState=d,a.firstBaseUpdate=_,a.lastBaseUpdate=z,u===null&&(a.shared.lanes=0),sn|=i,e.lanes=i,e.memoizedState=U}}function ff(e,t){if(typeof e!="function")throw Error(s(191,e));e.call(t)}function sf(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;eu?u:8;var i=M.T,c={};M.T=c,co(e,!1,t,l);try{var d=a(),_=M.S;if(_!==null&&_(c,d),d!==null&&typeof d=="object"&&typeof d.then=="function"){var z=ep(d,n);cu(e,t,z,Wt(e))}else cu(e,t,n,Wt(e))}catch(U){cu(e,t,{then:function(){},status:"rejected",reason:U},Wt())}finally{R.p=u,i!==null&&c.types!==null&&(i.types=c.types),M.T=i}}function ip(){}function uo(e,t,l,n){if(e.tag!==5)throw Error(s(476));var a=Qf(e).queue;Vf(e,a,t,ne,l===null?ip:function(){return Wf(e),l(n)})}function Qf(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hl,lastRenderedState:ne},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hl,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Wf(e){var t=Qf(e);t.next===null&&(t=e.alternate.memoizedState),cu(e,t.next.queue,{},Wt())}function io(){return mt(Tu)}function Xf(){return et().memoizedState}function Zf(){return et().memoizedState}function cp(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=Wt();e=an(l);var n=un(t,e,l);n!==null&&(Ht(n,t,l),lu(n,t,l)),t={cache:Dc()},e.payload=t;return}t=t.return}}function op(e,t,l){var n=Wt();l={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},gi(e)?Kf(t,l):(l=Tc(e,t,l,n),l!==null&&(Ht(l,e,n),Jf(l,t,n)))}function kf(e,t,l){var n=Wt();cu(e,t,l,n)}function cu(e,t,l,n){var a={lane:n,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(gi(e))Kf(t,a);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var i=t.lastRenderedState,c=u(i,l);if(a.hasEagerState=!0,a.eagerState=c,qt(c,i))return Iu(e,t,a,0),Ye===null&&$u(),!1}catch{}finally{}if(l=Tc(e,t,a,n),l!==null)return Ht(l,e,n),Jf(l,t,n),!0}return!1}function co(e,t,l,n){if(n={lane:2,revertLane:Lo(),gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},gi(e)){if(t)throw Error(s(479))}else t=Tc(e,l,n,2),t!==null&&Ht(t,e,2)}function gi(e){var t=e.alternate;return e===se||t!==null&&t===se}function Kf(e,t){ga=si=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Jf(e,t,l){if((l&4194048)!==0){var n=t.lanes;n&=e.pendingLanes,l|=n,t.lanes=l,Gu(e,l)}}var ou={readContext:mt,use:pi,useCallback:$e,useContext:$e,useEffect:$e,useImperativeHandle:$e,useLayoutEffect:$e,useInsertionEffect:$e,useMemo:$e,useReducer:$e,useRef:$e,useState:$e,useDebugValue:$e,useDeferredValue:$e,useTransition:$e,useSyncExternalStore:$e,useId:$e,useHostTransitionStatus:$e,useFormState:$e,useActionState:$e,useOptimistic:$e,useMemoCache:$e,useCacheRefresh:$e};ou.useEffectEvent=$e;var Ff={readContext:mt,use:pi,useCallback:function(e,t){return Tt().memoizedState=[e,t===void 0?null:t],e},useContext:mt,useEffect:Hf,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,vi(4194308,4,jf.bind(null,t,e),l)},useLayoutEffect:function(e,t){return vi(4194308,4,e,t)},useInsertionEffect:function(e,t){vi(4,2,e,t)},useMemo:function(e,t){var l=Tt();t=t===void 0?null:t;var n=e();if(Xn){dl(!0);try{e()}finally{dl(!1)}}return l.memoizedState=[n,t],n},useReducer:function(e,t,l){var n=Tt();if(l!==void 0){var a=l(t);if(Xn){dl(!0);try{l(t)}finally{dl(!1)}}}else a=t;return n.memoizedState=n.baseState=a,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:a},n.queue=e,e=e.dispatch=op.bind(null,se,e),[n.memoizedState,e]},useRef:function(e){var t=Tt();return e={current:e},t.memoizedState=e},useState:function(e){e=eo(e);var t=e.queue,l=kf.bind(null,se,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:no,useDeferredValue:function(e,t){var l=Tt();return ao(l,e,t)},useTransition:function(){var e=eo(!1);return e=Vf.bind(null,se,e.queue,!0,!1),Tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var n=se,a=Tt();if(Ee){if(l===void 0)throw Error(s(407));l=l()}else{if(l=t(),Ye===null)throw Error(s(349));(Se&127)!==0||bf(n,t,l)}a.memoizedState=l;var u={value:l,getSnapshot:t};return a.queue=u,Hf(yf.bind(null,n,u,e),[e]),n.flags|=2048,_a(9,{destroy:void 0},gf.bind(null,n,u,l,t),null),l},useId:function(){var e=Tt(),t=Ye.identifierPrefix;if(Ee){var l=gl,n=bl;l=(n&~(1<<32-At(n)-1)).toString(32)+l,t="_"+t+"R_"+l,l=di++,0<\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof n.is=="string"?i.createElement("select",{is:n.is}):i.createElement("select"),n.multiple?u.multiple=!0:n.size&&(u.size=n.size);break;default:u=typeof n.is=="string"?i.createElement(a,{is:n.is}):i.createElement(a)}}u[lt]=t,u[ht]=n;e:for(i=t.child;i!==null;){if(i.tag===5||i.tag===6)u.appendChild(i.stateNode);else if(i.tag!==4&&i.tag!==27&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===t)break e;for(;i.sibling===null;){if(i.return===null||i.return===t)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}t.stateNode=u;e:switch(bt(u,a,n),a){case"button":case"input":case"select":case"textarea":n=!!n.autoFocus;break e;case"img":n=!0;break e;default:n=!1}n&&Dl(t)}}return We(t),Ao(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==n&&Dl(t);else{if(typeof n!="string"&&t.stateNode===null)throw Error(s(166));if(e=de.current,sa(t)){if(e=t.stateNode,l=t.memoizedProps,n=null,a=pt,a!==null)switch(a.tag){case 27:case 5:n=a.memoizedProps}e[lt]=t,e=!!(e.nodeValue===l||n!==null&&n.suppressHydrationWarning===!0||md(e.nodeValue,l)),e||tn(t,!0)}else e=qi(e).createTextNode(n),e[lt]=t,t.stateNode=e}return We(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(n=sa(t),l!==null){if(e===null){if(!n)throw Error(s(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(s(557));e[lt]=t}else qn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),e=!1}else l=Uc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(Yt(t),t):(Yt(t),null);if((t.flags&128)!==0)throw Error(s(558))}return We(t),null;case 13:if(n=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=sa(t),n!==null&&n.dehydrated!==null){if(e===null){if(!a)throw Error(s(318));if(a=t.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(s(317));a[lt]=t}else qn(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;We(t),a=!1}else a=Uc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Yt(t),t):(Yt(t),null)}return Yt(t),(t.flags&128)!==0?(t.lanes=l,t):(l=n!==null,e=e!==null&&e.memoizedState!==null,l&&(n=t.child,a=null,n.alternate!==null&&n.alternate.memoizedState!==null&&n.alternate.memoizedState.cachePool!==null&&(a=n.alternate.memoizedState.cachePool.pool),u=null,n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(u=n.memoizedState.cachePool.pool),u!==a&&(n.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),Ei(t,t.updateQueue),We(t),null);case 4:return Xe(),e===null&&Wo(t.stateNode.containerInfo),We(t),null;case 10:return Ul(t.type),We(t),null;case 19:if(B(Pe),n=t.memoizedState,n===null)return We(t),null;if(a=(t.flags&128)!==0,u=n.rendering,u===null)if(a)fu(n,!1);else{if(Ie!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=fi(e),u!==null){for(t.flags|=128,fu(n,!1),e=u.updateQueue,t.updateQueue=e,Ei(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)Zr(l,e),l=l.sibling;return w(Pe,Pe.current&1|2),Ee&&xl(t,n.treeForkCount),t.child}e=e.sibling}n.tail!==null&&St()>Mi&&(t.flags|=128,a=!0,fu(n,!1),t.lanes=4194304)}else{if(!a)if(e=fi(u),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Ei(t,e),fu(n,!0),n.tail===null&&n.tailMode==="hidden"&&!u.alternate&&!Ee)return We(t),null}else 2*St()-n.renderingStartTime>Mi&&l!==536870912&&(t.flags|=128,a=!0,fu(n,!1),t.lanes=4194304);n.isBackwards?(u.sibling=t.child,t.child=u):(e=n.last,e!==null?e.sibling=u:t.child=u,n.last=u)}return n.tail!==null?(e=n.tail,n.rendering=e,n.tail=e.sibling,n.renderingStartTime=St(),e.sibling=null,l=Pe.current,w(Pe,a?l&1|2:l&1),Ee&&xl(t,n.treeForkCount),e):(We(t),null);case 22:case 23:return Yt(t),Wc(),n=t.memoizedState!==null,e!==null?e.memoizedState!==null!==n&&(t.flags|=8192):n&&(t.flags|=8192),n?(l&536870912)!==0&&(t.flags&128)===0&&(We(t),t.subtreeFlags&6&&(t.flags|=8192)):We(t),l=t.updateQueue,l!==null&&Ei(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),n=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),n!==l&&(t.flags|=2048),e!==null&&B(Yn),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Ul(at),We(t),null;case 25:return null;case 30:return null}throw Error(s(156,t.tag))}function hp(e,t){switch(xc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ul(at),Xe(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return fl(t),null;case 31:if(t.memoizedState!==null){if(Yt(t),t.alternate===null)throw Error(s(340));qn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Yt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(s(340));qn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return B(Pe),null;case 4:return Xe(),null;case 10:return Ul(t.type),null;case 22:case 23:return Yt(t),Wc(),e!==null&&B(Yn),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ul(at),null;case 25:return null;default:return null}}function _s(e,t){switch(xc(t),t.tag){case 3:Ul(at),Xe();break;case 26:case 27:case 5:fl(t);break;case 4:Xe();break;case 31:t.memoizedState!==null&&Yt(t);break;case 13:Yt(t);break;case 19:B(Pe);break;case 10:Ul(t.type);break;case 22:case 23:Yt(t),Wc(),e!==null&&B(Yn);break;case 24:Ul(at)}}function su(e,t){try{var l=t.updateQueue,n=l!==null?l.lastEffect:null;if(n!==null){var a=n.next;l=a;do{if((l.tag&e)===e){n=void 0;var u=l.create,i=l.inst;n=u(),i.destroy=n}l=l.next}while(l!==a)}}catch(c){we(t,t.return,c)}}function rn(e,t,l){try{var n=t.updateQueue,a=n!==null?n.lastEffect:null;if(a!==null){var u=a.next;n=u;do{if((n.tag&e)===e){var i=n.inst,c=i.destroy;if(c!==void 0){i.destroy=void 0,a=t;var d=l,_=c;try{_()}catch(z){we(a,d,z)}}}n=n.next}while(n!==u)}}catch(z){we(t,t.return,z)}}function Ss(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{sf(t,l)}catch(n){we(e,e.return,n)}}}function As(e,t,l){l.props=Zn(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(n){we(e,t,n)}}function du(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var n=e.stateNode;break;case 30:n=e.stateNode;break;default:n=e.stateNode}typeof l=="function"?e.refCleanup=l(n):l.current=n}}catch(a){we(e,t,a)}}function yl(e,t){var l=e.ref,n=e.refCleanup;if(l!==null)if(typeof n=="function")try{n()}catch(a){we(e,t,a)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(a){we(e,t,a)}else l.current=null}function Es(e){var t=e.type,l=e.memoizedProps,n=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break e;case"img":l.src?n.src=l.src:l.srcSet&&(n.srcset=l.srcSet)}}catch(a){we(e,e.return,a)}}function Eo(e,t,l){try{var n=e.stateNode;Dp(n,e.type,l,t),n[ht]=t}catch(a){we(e,e.return,a)}}function Ts(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&vn(e.type)||e.tag===4}function To(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ts(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.tag===27&&vn(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oo(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=F));else if(n!==4&&(n===27&&vn(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(Oo(e,t,l),e=e.sibling;e!==null;)Oo(e,t,l),e=e.sibling}function Ti(e,t,l){var n=e.tag;if(n===5||n===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(n!==4&&(n===27&&vn(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Ti(e,t,l),e=e.sibling;e!==null;)Ti(e,t,l),e=e.sibling}function Os(e){var t=e.stateNode,l=e.memoizedProps;try{for(var n=e.type,a=t.attributes;a.length;)t.removeAttributeNode(a[0]);bt(t,n,l),t[lt]=e,t[ht]=l}catch(u){we(e,e.return,u)}}var Rl=!1,ct=!1,Co=!1,Cs=typeof WeakSet=="function"?WeakSet:Set,ft=null;function pp(e,t){if(e=e.containerInfo,ko=Xi,e=jr(e),gc(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var n=l.getSelection&&l.getSelection();if(n&&n.rangeCount!==0){l=n.anchorNode;var a=n.anchorOffset,u=n.focusNode;n=n.focusOffset;try{l.nodeType,u.nodeType}catch{l=null;break e}var i=0,c=-1,d=-1,_=0,z=0,U=e,A=null;t:for(;;){for(var T;U!==l||a!==0&&U.nodeType!==3||(c=i+a),U!==u||n!==0&&U.nodeType!==3||(d=i+n),U.nodeType===3&&(i+=U.nodeValue.length),(T=U.firstChild)!==null;)A=U,U=T;for(;;){if(U===e)break t;if(A===l&&++_===a&&(c=i),A===u&&++z===n&&(d=i),(T=U.nextSibling)!==null)break;U=A,A=U.parentNode}U=T}l=c===-1||d===-1?null:{start:c,end:d}}else l=null}l=l||{start:0,end:0}}else l=null;for(Ko={focusedElem:e,selectionRange:l},Xi=!1,ft=t;ft!==null;)if(t=ft,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ft=e;else for(;ft!==null;){switch(t=ft,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l title"))),bt(u,n,l),u[lt]=e,nt(u),n=u;break e;case"link":var i=Nd("link","href",a).get(n+(l.href||""));if(i){for(var c=0;cGe&&(i=Ge,Ge=le,le=i);var g=Dr(c,le),p=Dr(c,Ge);if(g&&p&&(T.rangeCount!==1||T.anchorNode!==g.node||T.anchorOffset!==g.offset||T.focusNode!==p.node||T.focusOffset!==p.offset)){var y=U.createRange();y.setStart(g.node,g.offset),T.removeAllRanges(),le>Ge?(T.addRange(y),T.extend(p.node,p.offset)):(y.setEnd(p.node,p.offset),T.addRange(y))}}}}for(U=[],T=c;T=T.parentNode;)T.nodeType===1&&U.push({element:T,left:T.scrollLeft,top:T.scrollTop});for(typeof c.focus=="function"&&c.focus(),c=0;cl?32:l,M.T=null,l=Ho,Ho=null;var u=hn,i=Yl;if(rt=0,Oa=hn=null,Yl=0,(Ne&6)!==0)throw Error(s(331));var c=Ne;if(Ne|=4,js(u.current),ws(u,u.current,i,l),Ne=c,gu(0,!1),ot&&typeof ot.onPostCommitFiberRoot=="function")try{ot.onPostCommitFiberRoot(Cn,u)}catch{}return!0}finally{R.p=a,M.T=n,td(e,t)}}function nd(e,t,l){t=Jt(l,t),t=so(e.stateNode,t,2),e=un(e,t,2),e!==null&&(El(e,2),_l(e))}function we(e,t,l){if(e.tag===3)nd(e,e,l);else for(;t!==null;){if(t.tag===3){nd(t,e,l);break}else if(t.tag===1){var n=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof n.componentDidCatch=="function"&&(dn===null||!dn.has(n))){e=Jt(l,e),l=as(2),n=un(t,l,2),n!==null&&(us(l,n,t,e),El(n,2),_l(n));break}}t=t.return}}function jo(e,t,l){var n=e.pingCache;if(n===null){n=e.pingCache=new bp;var a=new Set;n.set(t,a)}else a=n.get(t),a===void 0&&(a=new Set,n.set(t,a));a.has(l)||(xo=!0,a.add(l),e=Ap.bind(null,e,t,l),t.then(e,e))}function Ap(e,t,l){var n=e.pingCache;n!==null&&n.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,Ye===e&&(Se&l)===l&&(Ie===4||Ie===3&&(Se&62914560)===Se&&300>St()-zi?(Ne&2)===0&&Ca(e,0):Bo|=l,Ta===Se&&(Ta=0)),_l(e)}function ad(e,t){t===0&&(t=ju()),e=Rn(e,t),e!==null&&(El(e,t),_l(e))}function Ep(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),ad(e,l)}function Tp(e,t){var l=0;switch(e.tag){case 31:case 13:var n=e.stateNode,a=e.memoizedState;a!==null&&(l=a.retryLane);break;case 19:n=e.stateNode;break;case 22:n=e.stateNode._retryCache;break;default:throw Error(s(314))}n!==null&&n.delete(t),ad(e,l)}function Op(e,t){return Tn(e,t)}var wi=null,Ma=null,qo=!1,Di=!1,Go=!1,mn=0;function _l(e){e!==Ma&&e.next===null&&(Ma===null?wi=Ma=e:Ma=Ma.next=e),Di=!0,qo||(qo=!0,zp())}function gu(e,t){if(!Go&&Di){Go=!0;do for(var l=!1,n=wi;n!==null;){if(e!==0){var a=n.pendingLanes;if(a===0)var u=0;else{var i=n.suspendedLanes,c=n.pingedLanes;u=(1<<31-At(42|e)+1)-1,u&=a&~(i&~c),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(l=!0,od(n,u))}else u=Se,u=Wl(n,n===Ye?u:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),(u&3)===0||nl(n,u)||(l=!0,od(n,u));n=n.next}while(l);Go=!1}}function Cp(){ud()}function ud(){Di=qo=!1;var e=0;mn!==0&&jp()&&(e=mn);for(var t=St(),l=null,n=wi;n!==null;){var a=n.next,u=id(n,t);u===0?(n.next=null,l===null?wi=a:l.next=a,a===null&&(Ma=l)):(l=n,(e!==0||(u&3)!==0)&&(Di=!0)),n=a}rt!==0&&rt!==5||gu(e),mn!==0&&(mn=0)}function id(e,t){for(var l=e.suspendedLanes,n=e.pingedLanes,a=e.expirationTimes,u=e.pendingLanes&-62914561;0c)break;var z=d.transferSize,U=d.initiatorType;z&&vd(U)&&(d=d.responseEnd,i+=z*(d"u"?null:document;function Md(e,t,l){var n=xa;if(n&&typeof t=="string"&&t){var a=o(t);a='link[rel="'+e+'"][href="'+a+'"]',typeof l=="string"&&(a+='[crossorigin="'+l+'"]'),zd.has(a)||(zd.add(a),e={rel:e,crossOrigin:l,href:t},n.querySelector(a)===null&&(t=n.createElement("link"),bt(t,"link",e),nt(t),n.head.appendChild(t)))}}function Zp(e){Vl.D(e),Md("dns-prefetch",e,null)}function kp(e,t){Vl.C(e,t),Md("preconnect",e,t)}function Kp(e,t,l){Vl.L(e,t,l);var n=xa;if(n&&e&&t){var a='link[rel="preload"][as="'+o(t)+'"]';t==="image"&&l&&l.imageSrcSet?(a+='[imagesrcset="'+o(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(a+='[imagesizes="'+o(l.imageSizes)+'"]')):a+='[href="'+o(e)+'"]';var u=a;switch(t){case"style":u=Ba(e);break;case"script":u=Ua(e)}tl.has(u)||(e=ee({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),tl.set(u,e),n.querySelector(a)!==null||t==="style"&&n.querySelector(Au(u))||t==="script"&&n.querySelector(Eu(u))||(t=n.createElement("link"),bt(t,"link",e),nt(t),n.head.appendChild(t)))}}function Jp(e,t){Vl.m(e,t);var l=xa;if(l&&e){var n=t&&typeof t.as=="string"?t.as:"script",a='link[rel="modulepreload"][as="'+o(n)+'"][href="'+o(e)+'"]',u=a;switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=Ua(e)}if(!tl.has(u)&&(e=ee({rel:"modulepreload",href:e},t),tl.set(u,e),l.querySelector(a)===null)){switch(n){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Eu(u)))return}n=l.createElement("link"),bt(n,"link",e),nt(n),l.head.appendChild(n)}}}function Fp(e,t,l){Vl.S(e,t,l);var n=xa;if(n&&e){var a=Jl(n).hoistableStyles,u=Ba(e);t=t||"default";var i=a.get(u);if(!i){var c={loading:0,preload:null};if(i=n.querySelector(Au(u)))c.loading=5;else{e=ee({rel:"stylesheet",href:e,"data-precedence":t},l),(l=tl.get(u))&&tr(e,l);var d=i=n.createElement("link");nt(d),bt(d,"link",e),d._p=new Promise(function(_,z){d.onload=_,d.onerror=z}),d.addEventListener("load",function(){c.loading|=1}),d.addEventListener("error",function(){c.loading|=2}),c.loading|=4,Li(i,t,n)}i={type:"stylesheet",instance:i,count:1,state:c},a.set(u,i)}}}function $p(e,t){Vl.X(e,t);var l=xa;if(l&&e){var n=Jl(l).hoistableScripts,a=Ua(e),u=n.get(a);u||(u=l.querySelector(Eu(a)),u||(e=ee({src:e,async:!0},t),(t=tl.get(a))&&lr(e,t),u=l.createElement("script"),nt(u),bt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function Ip(e,t){Vl.M(e,t);var l=xa;if(l&&e){var n=Jl(l).hoistableScripts,a=Ua(e),u=n.get(a);u||(u=l.querySelector(Eu(a)),u||(e=ee({src:e,async:!0,type:"module"},t),(t=tl.get(a))&&lr(e,t),u=l.createElement("script"),nt(u),bt(u,"link",e),l.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},n.set(a,u))}}function xd(e,t,l,n){var a=(a=de.current)?Gi(a):null;if(!a)throw Error(s(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=Ba(l.href),l=Jl(a).hoistableStyles,n=l.get(t),n||(n={type:"style",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=Ba(l.href);var u=Jl(a).hoistableStyles,i=u.get(e);if(i||(a=a.ownerDocument||a,i={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,i),(u=a.querySelector(Au(e)))&&!u._p&&(i.instance=u,i.state.loading=5),tl.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},tl.set(e,l),u||Pp(a,e,l,i.state))),t&&n===null)throw Error(s(528,""));return i}if(t&&n!==null)throw Error(s(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ua(l),l=Jl(a).hoistableScripts,n=l.get(t),n||(n={type:"script",instance:null,count:0,state:null},l.set(t,n)),n):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,e))}}function Ba(e){return'href="'+o(e)+'"'}function Au(e){return'link[rel="stylesheet"]['+e+"]"}function Bd(e){return ee({},e,{"data-precedence":e.precedence,precedence:null})}function Pp(e,t,l,n){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?n.loading=1:(t=e.createElement("link"),n.preload=t,t.addEventListener("load",function(){return n.loading|=1}),t.addEventListener("error",function(){return n.loading|=2}),bt(t,"link",l),nt(t),e.head.appendChild(t))}function Ua(e){return'[src="'+o(e)+'"]'}function Eu(e){return"script[async]"+e}function Ud(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var n=e.querySelector('style[data-href~="'+o(l.href)+'"]');if(n)return t.instance=n,nt(n),n;var a=ee({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return n=(e.ownerDocument||e).createElement("style"),nt(n),bt(n,"style",a),Li(n,l.precedence,e),t.instance=n;case"stylesheet":a=Ba(l.href);var u=e.querySelector(Au(a));if(u)return t.state.loading|=4,t.instance=u,nt(u),u;n=Bd(l),(a=tl.get(a))&&tr(n,a),u=(e.ownerDocument||e).createElement("link"),nt(u);var i=u;return i._p=new Promise(function(c,d){i.onload=c,i.onerror=d}),bt(u,"link",n),t.state.loading|=4,Li(u,l.precedence,e),t.instance=u;case"script":return u=Ua(l.src),(a=e.querySelector(Eu(u)))?(t.instance=a,nt(a),a):(n=l,(a=tl.get(u))&&(n=ee({},l),lr(n,a)),e=e.ownerDocument||e,a=e.createElement("script"),nt(a),bt(a,"link",n),e.head.appendChild(a),t.instance=a);case"void":return null;default:throw Error(s(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(n=t.instance,t.state.loading|=4,Li(n,l.precedence,e));return t.instance}function Li(e,t,l){for(var n=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=n.length?n[n.length-1]:null,u=a,i=0;i title"):null)}function em(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function wd(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function tm(e,t,l,n){if(l.type==="stylesheet"&&(typeof n.media!="string"||matchMedia(n.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var a=Ba(n.href),u=t.querySelector(Au(a));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Vi.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=u,nt(u);return}u=t.ownerDocument||t,n=Bd(n),(a=tl.get(a))&&tr(n,a),u=u.createElement("link"),nt(u);var i=u;i._p=new Promise(function(c,d){i.onload=c,i.onerror=d}),bt(u,"link",n),l.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=Vi.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var nr=0;function lm(e,t){return e.stylesheets&&e.count===0&&Wi(e,e.stylesheets),0nr?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(n),clearTimeout(a)}}:null}function Vi(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Wi(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Qi=null;function Wi(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Qi=new Map,t.forEach(nm,e),Qi=null,Vi.call(e))}function nm(e,t){if(!(t.state.loading&4)){var l=Qi.get(e);if(l)var n=l.get(null);else{l=new Map,Qi.set(e,l);for(var a=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(O)}catch(r){console.error(r)}}return O(),dr.exports=_m(),dr.exports}var Am=Sm();function Em(O,r){O.terminate=function(){const b=()=>{};this.onerror=b,this.onmessage=b,this.onopen=b;const s=new Date,v=Math.random().toString().substring(2,8),N=this.onclose;this.onclose=I=>{const W=new Date().getTime()-s.getTime();r(`Discarded socket (#${v}) closed after ${W}ms, with code/reason: ${I.code}/${I.reason}`)},this.close(),N?.call(O,{code:4001,reason:`Quick discarding socket (#${v}) without waiting for the shutdown sequence.`,wasClean:!1})}}const Uu={LF:` `,NULL:"\0"};class An{get body(){return!this._body&&this.isBinaryBody&&(this._body=new TextDecoder().decode(this._binaryBody)),this._body||""}get binaryBody(){return!this._binaryBody&&!this.isBinaryBody&&(this._binaryBody=new TextEncoder().encode(this._body)),this._binaryBody}constructor(r){const{command:b,headers:s,body:v,binaryBody:N,escapeHeaderValues:I,skipContentLengthHeader:W}=r;this.command=b,this.headers=Object.assign({},s||{}),N?(this._binaryBody=N,this.isBinaryBody=!0):(this._body=v||"",this.isBinaryBody=!1),this.escapeHeaderValues=I||!1,this.skipContentLengthHeader=W||!1}static fromRawFrame(r,b){const s={},v=N=>N.replace(/^\s+|\s+$/g,"");for(const N of r.headers.reverse()){N.indexOf(":");const I=v(N[0]);let W=v(N[1]);b&&r.command!=="CONNECT"&&r.command!=="CONNECTED"&&(W=An.hdrValueUnEscape(W)),s[I]=W}return new An({command:r.command,headers:s,binaryBody:r.binaryBody,escapeHeaderValues:b})}toString(){return this.serializeCmdAndHeaders()}serialize(){const r=this.serializeCmdAndHeaders();return this.isBinaryBody?An.toUnit8Array(r,this._binaryBody).buffer:r+this._body+Uu.NULL}serializeCmdAndHeaders(){const r=[this.command];this.skipContentLengthHeader&&delete this.headers["content-length"];for(const b of Object.keys(this.headers||{})){const s=this.headers[b];this.escapeHeaderValues&&this.command!=="CONNECT"&&this.command!=="CONNECTED"?r.push(`${b}:${An.hdrValueEscape(`${s}`)}`):r.push(`${b}:${s}`)}return(this.isBinaryBody||!this.isBodyEmpty()&&!this.skipContentLengthHeader)&&r.push(`content-length:${this.bodyLength()}`),r.join(Uu.LF)+Uu.LF+Uu.LF}isBodyEmpty(){return this.bodyLength()===0}bodyLength(){const r=this.binaryBody;return r?r.length:0}static sizeOfUTF8(r){return r?new TextEncoder().encode(r).length:0}static toUnit8Array(r,b){const s=new TextEncoder().encode(r),v=new Uint8Array([0]),N=new Uint8Array(s.length+b.length+v.length);return N.set(s),N.set(b,s.length),N.set(v,s.length+b.length),N}static marshall(r){return new An(r).serialize()}static hdrValueEscape(r){return r.replace(/\\/g,"\\\\").replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/:/g,"\\c")}static hdrValueUnEscape(r){return r.replace(/\\r/g,"\r").replace(/\\n/g,` `).replace(/\\c/g,":").replace(/\\\\/g,"\\")}}const ah=0,Ii=10,Pi=13,Tm=58;class Om{constructor(r,b){this.onFrame=r,this.onIncomingPing=b,this._encoder=new TextEncoder,this._decoder=new TextDecoder,this._token=[],this._initState()}parseChunk(r,b=!1){let s;if(typeof r=="string"?s=this._encoder.encode(r):s=new Uint8Array(r),b&&s[s.length-1]!==0){const v=new Uint8Array(s.length+1);v.set(s,0),v[s.length]=0,s=v}for(let v=0;vb[0]==="content-length")[0];r?(this._bodyBytesRemaining=parseInt(r[1],10),this._onByte=this._collectBodyFixedSize):this._onByte=this._collectBodyNullTerminated}_collectBodyNullTerminated(r){if(r===ah){this._retrievedBody();return}this._consumeByte(r)}_collectBodyFixedSize(r){if(this._bodyBytesRemaining--===0){this._retrievedBody();return}this._consumeByte(r)}_retrievedBody(){this._results.binaryBody=this._consumeTokenAsRaw();try{this.onFrame(this._results)}catch(r){console.log("Ignoring an exception thrown by a frame handler. Original exception: ",r)}this._initState()}_consumeByte(r){this._token.push(r)}_consumeTokenAsUTF8(){return this._decoder.decode(this._consumeTokenAsRaw())}_consumeTokenAsRaw(){const r=new Uint8Array(this._token);return this._token=[],r}_initState(){this._results={command:void 0,headers:[],binaryBody:void 0},this._token=[],this._headerKey=void 0,this._onByte=this._collectFrame}}var En;(function(O){O[O.CONNECTING=0]="CONNECTING",O[O.OPEN=1]="OPEN",O[O.CLOSING=2]="CLOSING",O[O.CLOSED=3]="CLOSED"})(En||(En={}));var rl;(function(O){O[O.ACTIVE=0]="ACTIVE",O[O.DEACTIVATING=1]="DEACTIVATING",O[O.INACTIVE=2]="INACTIVE"})(rl||(rl={}));var tc;(function(O){O[O.LINEAR=0]="LINEAR",O[O.EXPONENTIAL=1]="EXPONENTIAL"})(tc||(tc={}));var Nu;(function(O){O.Interval="interval",O.Worker="worker"})(Nu||(Nu={}));class Cm{constructor(r,b=Nu.Interval,s){this._interval=r,this._strategy=b,this._debug=s,this._workerScript=` var startTime = Date.now(); setInterval(function() { self.postMessage(Date.now() - startTime); }, ${this._interval}); `}start(r){this.stop(),this.shouldUseWorker()?this.runWorker(r):this.runInterval(r)}stop(){this.disposeWorker(),this.disposeInterval()}shouldUseWorker(){return typeof Worker<"u"&&this._strategy===Nu.Worker}runWorker(r){this._debug("Using runWorker for outgoing pings"),this._worker||(this._worker=new Worker(URL.createObjectURL(new Blob([this._workerScript],{type:"text/javascript"}))),this._worker.onmessage=b=>r(b.data))}runInterval(r){if(this._debug("Using runInterval for outgoing pings"),!this._timer){const b=Date.now();this._timer=setInterval(()=>{r(Date.now()-b)},this._interval)}}disposeWorker(){this._worker&&(this._worker.terminate(),delete this._worker,this._debug("Outgoing ping disposeWorker"))}disposeInterval(){this._timer&&(clearInterval(this._timer),delete this._timer,this._debug("Outgoing ping disposeInterval"))}}class Ot{constructor(r){this.versions=r}supportedVersions(){return this.versions.join(",")}protocolVersions(){return this.versions.map(r=>`v${r.replace(".","")}.stomp`)}}Ot.V1_0="1.0";Ot.V1_1="1.1";Ot.V1_2="1.2";Ot.default=new Ot([Ot.V1_2,Ot.V1_1,Ot.V1_0]);class zm{get connectedVersion(){return this._connectedVersion}get connected(){return this._connected}constructor(r,b,s){this._client=r,this._webSocket=b,this._connected=!1,this._serverFrameHandlers={CONNECTED:v=>{this.debug(`connected to server ${v.headers.server}`),this._connected=!0,this._connectedVersion=v.headers.version,this._connectedVersion===Ot.V1_2&&(this._escapeHeaderValues=!0),this._setupHeartbeat(v.headers),this.onConnect(v)},MESSAGE:v=>{const N=v.headers.subscription,I=this._subscriptions[N]||this.onUnhandledMessage,W=v,H=this,S=this._connectedVersion===Ot.V1_2?W.headers.ack:W.headers["message-id"];W.ack=(ae={})=>H.ack(S,N,ae),W.nack=(ae={})=>H.nack(S,N,ae),I(W)},RECEIPT:v=>{const N=this._receiptWatchers[v.headers["receipt-id"]];N?(N(v),delete this._receiptWatchers[v.headers["receipt-id"]]):this.onUnhandledReceipt(v)},ERROR:v=>{this.onStompError(v)}},this._counter=0,this._subscriptions={},this._receiptWatchers={},this._partialData="",this._escapeHeaderValues=!1,this._lastServerActivityTS=Date.now(),this.debug=s.debug,this.stompVersions=s.stompVersions,this.connectHeaders=s.connectHeaders,this.disconnectHeaders=s.disconnectHeaders,this.heartbeatIncoming=s.heartbeatIncoming,this.heartbeatToleranceMultiplier=s.heartbeatGracePeriods,this.heartbeatOutgoing=s.heartbeatOutgoing,this.splitLargeFrames=s.splitLargeFrames,this.maxWebSocketChunkSize=s.maxWebSocketChunkSize,this.forceBinaryWSFrames=s.forceBinaryWSFrames,this.logRawCommunication=s.logRawCommunication,this.appendMissingNULLonIncoming=s.appendMissingNULLonIncoming,this.discardWebsocketOnCommFailure=s.discardWebsocketOnCommFailure,this.onConnect=s.onConnect,this.onDisconnect=s.onDisconnect,this.onStompError=s.onStompError,this.onWebSocketClose=s.onWebSocketClose,this.onWebSocketError=s.onWebSocketError,this.onUnhandledMessage=s.onUnhandledMessage,this.onUnhandledReceipt=s.onUnhandledReceipt,this.onUnhandledFrame=s.onUnhandledFrame,this.onHeartbeatReceived=s.onHeartbeatReceived,this.onHeartbeatLost=s.onHeartbeatLost}start(){const r=new Om(b=>{const s=An.fromRawFrame(b,this._escapeHeaderValues);this.logRawCommunication||this.debug(`<<< ${s}`),(this._serverFrameHandlers[s.command]||this.onUnhandledFrame)(s)},()=>{this.debug("<<< PONG"),this.onHeartbeatReceived()});this._webSocket.onmessage=b=>{if(this.debug("Received data"),this._lastServerActivityTS=Date.now(),this.logRawCommunication){const s=b.data instanceof ArrayBuffer?new TextDecoder().decode(b.data):b.data;this.debug(`<<< ${s}`)}r.parseChunk(b.data,this.appendMissingNULLonIncoming)},this._webSocket.onclose=b=>{this.debug(`Connection closed to ${this._webSocket.url}`),this._cleanUp(),this.onWebSocketClose(b)},this._webSocket.onerror=b=>{this.onWebSocketError(b)},this._webSocket.onopen=()=>{const b=Object.assign({},this.connectHeaders);this.debug("Web Socket Opened..."),b["accept-version"]=this.stompVersions.supportedVersions(),b["heart-beat"]=[this.heartbeatOutgoing,this.heartbeatIncoming].join(","),this._transmit({command:"CONNECT",headers:b})}}_setupHeartbeat(r){if(r.version!==Ot.V1_1&&r.version!==Ot.V1_2||!r["heart-beat"])return;const[b,s]=r["heart-beat"].split(",").map(v=>parseInt(v,10));if(this.heartbeatOutgoing!==0&&s!==0){const v=Math.max(this.heartbeatOutgoing,s);this.debug(`send PING every ${v}ms`),this._pinger=new Cm(v,this._client.heartbeatStrategy,this.debug),this._pinger.start(()=>{this._webSocket.readyState===En.OPEN&&(this._webSocket.send(Uu.LF),this.debug(">>> PING"))})}if(this.heartbeatIncoming!==0&&b!==0){const v=Math.max(this.heartbeatIncoming,b);this.debug(`check PONG every ${v}ms`),this._ponger=setInterval(()=>{const N=Date.now()-this._lastServerActivityTS;N>v*this.heartbeatToleranceMultiplier&&(this.debug(`did not receive server activity for the last ${N}ms`),this.onHeartbeatLost(),this._closeOrDiscardWebsocket())},v)}}_closeOrDiscardWebsocket(){this.discardWebsocketOnCommFailure?(this.debug("Discarding websocket, the underlying socket may linger for a while"),this.discardWebsocket()):(this.debug("Issuing close on the websocket"),this._closeWebsocket())}forceDisconnect(){this._webSocket&&(this._webSocket.readyState===En.CONNECTING||this._webSocket.readyState===En.OPEN)&&this._closeOrDiscardWebsocket()}_closeWebsocket(){this._webSocket.onmessage=()=>{},this._webSocket.close()}discardWebsocket(){typeof this._webSocket.terminate!="function"&&Em(this._webSocket,r=>this.debug(r)),this._webSocket.terminate()}_transmit(r){const{command:b,headers:s,body:v,binaryBody:N,skipContentLengthHeader:I}=r,W=new An({command:b,headers:s,body:v,binaryBody:N,escapeHeaderValues:this._escapeHeaderValues,skipContentLengthHeader:I});let H=W.serialize();if(this.logRawCommunication?this.debug(`>>> ${H}`):this.debug(`>>> ${W}`),this.forceBinaryWSFrames&&typeof H=="string"&&(H=new TextEncoder().encode(H)),typeof H!="string"||!this.splitLargeFrames)this._webSocket.send(H);else{let S=H;for(;S.length>0;){const ae=S.substring(0,this.maxWebSocketChunkSize);S=S.substring(this.maxWebSocketChunkSize),this._webSocket.send(ae),this.debug(`chunk sent = ${ae.length}, remaining = ${S.length}`)}}}dispose(){if(this.connected)try{const r=Object.assign({},this.disconnectHeaders);r.receipt||(r.receipt=`close-${this._counter++}`),this.watchForReceipt(r.receipt,b=>{this._closeWebsocket(),this._cleanUp(),this.onDisconnect(b)}),this._transmit({command:"DISCONNECT",headers:r})}catch(r){this.debug(`Ignoring error during disconnect ${r}`)}else(this._webSocket.readyState===En.CONNECTING||this._webSocket.readyState===En.OPEN)&&this._closeWebsocket()}_cleanUp(){this._connected=!1,this._pinger&&(this._pinger.stop(),this._pinger=void 0),this._ponger&&(clearInterval(this._ponger),this._ponger=void 0)}publish(r){const{destination:b,headers:s,body:v,binaryBody:N,skipContentLengthHeader:I}=r,W=Object.assign({destination:b},s);this._transmit({command:"SEND",headers:W,body:v,binaryBody:N,skipContentLengthHeader:I})}watchForReceipt(r,b){this._receiptWatchers[r]=b}subscribe(r,b,s={}){s=Object.assign({},s),s.id||(s.id=`sub-${this._counter++}`),s.destination=r,this._subscriptions[s.id]=b,this._transmit({command:"SUBSCRIBE",headers:s});const v=this;return{id:s.id,unsubscribe(N){return v.unsubscribe(s.id,N)}}}unsubscribe(r,b={}){b=Object.assign({},b),delete this._subscriptions[r],b.id=r,this._transmit({command:"UNSUBSCRIBE",headers:b})}begin(r){const b=r||`tx-${this._counter++}`;this._transmit({command:"BEGIN",headers:{transaction:b}});const s=this;return{id:b,commit(){s.commit(b)},abort(){s.abort(b)}}}commit(r){this._transmit({command:"COMMIT",headers:{transaction:r}})}abort(r){this._transmit({command:"ABORT",headers:{transaction:r}})}ack(r,b,s={}){s=Object.assign({},s),this._connectedVersion===Ot.V1_2?s.id=r:s["message-id"]=r,s.subscription=b,this._transmit({command:"ACK",headers:s})}nack(r,b,s={}){return s=Object.assign({},s),this._connectedVersion===Ot.V1_2?s.id=r:s["message-id"]=r,s.subscription=b,this._transmit({command:"NACK",headers:s})}}class Mm{get webSocket(){return this._stompHandler?._webSocket}get disconnectHeaders(){return this._disconnectHeaders}set disconnectHeaders(r){this._disconnectHeaders=r,this._stompHandler&&(this._stompHandler.disconnectHeaders=this._disconnectHeaders)}get connected(){return!!this._stompHandler&&this._stompHandler.connected}get connectedVersion(){return this._stompHandler?this._stompHandler.connectedVersion:void 0}get active(){return this.state===rl.ACTIVE}_changeState(r){this.state=r,this.onChangeState(r)}constructor(r={}){this.stompVersions=Ot.default,this.connectionTimeout=0,this.reconnectDelay=5e3,this._nextReconnectDelay=0,this.maxReconnectDelay=900*1e3,this.reconnectTimeMode=tc.LINEAR,this.heartbeatIncoming=1e4,this.heartbeatToleranceMultiplier=2,this.heartbeatOutgoing=1e4,this.heartbeatStrategy=Nu.Interval,this.splitLargeFrames=!1,this.maxWebSocketChunkSize=8*1024,this.forceBinaryWSFrames=!1,this.appendMissingNULLonIncoming=!1,this.discardWebsocketOnCommFailure=!1,this.state=rl.INACTIVE;const b=()=>{};this.debug=b,this.beforeConnect=b,this.onConnect=b,this.onDisconnect=b,this.onUnhandledMessage=b,this.onUnhandledReceipt=b,this.onUnhandledFrame=b,this.onHeartbeatReceived=b,this.onHeartbeatLost=b,this.onStompError=b,this.onWebSocketClose=b,this.onWebSocketError=b,this.logRawCommunication=!1,this.onChangeState=b,this.connectHeaders={},this._disconnectHeaders={},this.configure(r)}configure(r){Object.assign(this,r),this.maxReconnectDelay>0&&this.maxReconnectDelay{if(this.active){this.debug("Already ACTIVE, ignoring request to activate");return}this._changeState(rl.ACTIVE),this._nextReconnectDelay=this.reconnectDelay,this._connect()};this.state===rl.DEACTIVATING?(this.debug("Waiting for deactivation to finish before activating"),this.deactivate().then(()=>{r()})):r()}async _connect(){if(await this.beforeConnect(this),this._stompHandler){this.debug("There is already a stompHandler, skipping the call to connect");return}if(!this.active){this.debug("Client has been marked inactive, will not attempt to connect");return}this.connectionTimeout>0&&(this._connectionWatcher&&clearTimeout(this._connectionWatcher),this._connectionWatcher=setTimeout(()=>{this.connected||(this.debug(`Connection not established in ${this.connectionTimeout}ms, closing socket`),this.forceDisconnect())},this.connectionTimeout)),this.debug("Opening Web Socket...");const r=this._createWebSocket();this._stompHandler=new zm(this,r,{debug:this.debug,stompVersions:this.stompVersions,connectHeaders:this.connectHeaders,disconnectHeaders:this._disconnectHeaders,heartbeatIncoming:this.heartbeatIncoming,heartbeatGracePeriods:this.heartbeatToleranceMultiplier,heartbeatOutgoing:this.heartbeatOutgoing,heartbeatStrategy:this.heartbeatStrategy,splitLargeFrames:this.splitLargeFrames,maxWebSocketChunkSize:this.maxWebSocketChunkSize,forceBinaryWSFrames:this.forceBinaryWSFrames,logRawCommunication:this.logRawCommunication,appendMissingNULLonIncoming:this.appendMissingNULLonIncoming,discardWebsocketOnCommFailure:this.discardWebsocketOnCommFailure,onConnect:b=>{if(this._connectionWatcher&&(clearTimeout(this._connectionWatcher),this._connectionWatcher=void 0),this._nextReconnectDelay=this.reconnectDelay,!this.active){this.debug("STOMP got connected while deactivate was issued, will disconnect now"),this._disposeStompHandler();return}this.onConnect(b)},onDisconnect:b=>{this.onDisconnect(b)},onStompError:b=>{this.onStompError(b)},onWebSocketClose:b=>{this._stompHandler=void 0,this.state===rl.DEACTIVATING&&this._changeState(rl.INACTIVE),this.onWebSocketClose(b),this.active&&this._schedule_reconnect()},onWebSocketError:b=>{this.onWebSocketError(b)},onUnhandledMessage:b=>{this.onUnhandledMessage(b)},onUnhandledReceipt:b=>{this.onUnhandledReceipt(b)},onUnhandledFrame:b=>{this.onUnhandledFrame(b)},onHeartbeatReceived:()=>{this.onHeartbeatReceived()},onHeartbeatLost:()=>{this.onHeartbeatLost()}}),this._stompHandler.start()}_createWebSocket(){let r;if(this.webSocketFactory)r=this.webSocketFactory();else if(this.brokerURL)r=new WebSocket(this.brokerURL,this.stompVersions.protocolVersions());else throw new Error("Either brokerURL or webSocketFactory must be provided");return r.binaryType="arraybuffer",r}_schedule_reconnect(){this._nextReconnectDelay>0&&(this.debug(`STOMP: scheduling reconnection in ${this._nextReconnectDelay}ms`),this._reconnector=setTimeout(()=>{this.reconnectTimeMode===tc.EXPONENTIAL&&(this._nextReconnectDelay=this._nextReconnectDelay*2,this.maxReconnectDelay!==0&&(this._nextReconnectDelay=Math.min(this._nextReconnectDelay,this.maxReconnectDelay))),this._connect()},this._nextReconnectDelay))}async deactivate(r={}){const b=r.force||!1,s=this.active;let v;if(this.state===rl.INACTIVE)return this.debug("Already INACTIVE, nothing more to do"),Promise.resolve();if(this._changeState(rl.DEACTIVATING),this._nextReconnectDelay=0,this._reconnector&&(clearTimeout(this._reconnector),this._reconnector=void 0),this._stompHandler&&this.webSocket.readyState!==En.CLOSED){const N=this._stompHandler.onWebSocketClose;v=new Promise((I,W)=>{this._stompHandler.onWebSocketClose=H=>{N(H),I()}})}else return this._changeState(rl.INACTIVE),Promise.resolve();return b?this._stompHandler?.discardWebsocket():s&&this._disposeStompHandler(),v}forceDisconnect(){this._stompHandler&&this._stompHandler.forceDisconnect()}_disposeStompHandler(){this._stompHandler&&this._stompHandler.dispose()}publish(r){this._checkConnection(),this._stompHandler.publish(r)}_checkConnection(){if(!this.connected)throw new TypeError("There is no underlying STOMP connection")}watchForReceipt(r,b){this._checkConnection(),this._stompHandler.watchForReceipt(r,b)}subscribe(r,b,s={}){return this._checkConnection(),this._stompHandler.subscribe(r,b,s)}unsubscribe(r,b={}){this._checkConnection(),this._stompHandler.unsubscribe(r,b)}begin(r){return this._checkConnection(),this._stompHandler.begin(r)}commit(r){this._checkConnection(),this._stompHandler.commit(r)}abort(r){this._checkConnection(),this._stompHandler.abort(r)}ack(r,b,s={}){this._checkConnection(),this._stompHandler.ack(r,b,s)}nack(r,b,s={}){this._checkConnection(),this._stompHandler.nack(r,b,s)}}const rh=gt.createContext(null),br=()=>{const O=gt.useContext(rh);if(!O)throw new Error("useGame must be used within a GameProvider");return O},xm=({children:O})=>{const[r,b]=gt.useState(null),[s,v]=gt.useState(!1),[N,I]=gt.useState(null),[W,H]=gt.useState(null),[S,ae]=gt.useState(null);gt.useEffect(()=>{const Te=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws`,Be=new Mm({brokerURL:Te,reconnectDelay:5e3,debug:Le=>{console.log(Le)},onConnect:Le=>{console.log("Connected: "+Le),v(!0),Be.subscribe("/user/queue/errors",D=>{ae(D.body)}),Be.subscribe("/user/queue/player-info",D=>{const V=JSON.parse(D.body);H(V),console.log("Current player set:",V)}),Be.subscribe("/user/queue/created",D=>{const V=JSON.parse(D.body);I(V)})},onStompError:Le=>{console.error("Broker reported error: "+Le.headers.message),console.error("Additional details: "+Le.body),ae(Le.headers.message)},onWebSocketClose:()=>{v(!1),console.log("WebSocket connection closed")}});return Be.activate(),b(Be),()=>{Be.deactivate()}},[]),gt.useEffect(()=>{if(s&&r&&N){const Ce=r.subscribe(`/topic/room/${N.roomId}`,Te=>{const Be=JSON.parse(Te.body);I(Be)});return()=>Ce.unsubscribe()}},[s,r,N?.roomId]);const ee=gt.useCallback((Ce,Te)=>{r&&s&&r.publish({destination:"/app/create",body:JSON.stringify({playerName:Ce,userId:Te})})},[r,s]),_e=gt.useCallback((Ce,Te,Be)=>{r&&s&&r.publish({destination:"/app/join",body:JSON.stringify({roomId:Ce,playerName:Te,userId:Be})})},[r,s]),Ke=gt.useCallback(Ce=>{r&&s&&N&&r.publish({destination:"/app/team/join",body:JSON.stringify({roomId:N.roomId,teamId:Ce})})},[r,s,N]);return P.jsx(rh.Provider,{value:{connected:s,room:N,currentPlayer:W,error:S,createRoom:ee,joinRoom:_e,joinTeam:Ke},children:O})};var ec={},Bu={},uh={},ih;function Bm(){return ih||(ih=1,(function(){var O={},r="";try{r=location.hash.toString()}catch{}var b=H(r),s=Le("initParams");if(s)for(var v in s)typeof b[v]>"u"&&(b[v]=s[v]);Be("initParams",b);var N=!1,I;try{if(N=window.parent!=null&&window!=window.parent,N){window.addEventListener("message",function(D){if(D.source===window.parent){try{var V=JSON.parse(D.data)}catch{return}if(!(!V||!V.eventType))if(V.eventType=="set_custom_style")D.origin==="https://web.telegram.org"&&(I.innerHTML=V.eventData);else if(V.eventType=="reload_iframe"){try{window.parent.postMessage(JSON.stringify({eventType:"iframe_will_reload"}),"*")}catch{}location.reload()}else _e(V.eventType,V.eventData)}}),I=document.createElement("style"),document.head.appendChild(I);try{window.parent.postMessage(JSON.stringify({eventType:"iframe_ready",eventData:{reload_supported:!0}}),"*")}catch{}}}catch{}function W(D){try{return D=D.replace(/\+/g,"%20"),decodeURIComponent(D)}catch{return D}}function H(D){D=D.replace(/^#/,"");var V={};if(!D.length)return V;if(D.indexOf("=")<0&&D.indexOf("?")<0)return V._path=W(D),V;var ue=D.indexOf("?");if(ue>=0){var Ue=D.substr(0,ue);V._path=W(Ue),D=D.substr(ue+1)}var De=S(D);for(var re in De)V[re]=De[re];return V}function S(D){var V={};if(!D.length)return V;var ue=D.split("&"),Ue,De,re,tt;for(Ue=0;Ue=0?D+"&"+V:Ue.length>0?D+"?"+V:D+V}function ee(D,V,ue){if(V||(V=function(){}),ue===void 0&&(ue=""),console.log("[Telegram.WebView] > postEvent",D,ue),window.TelegramWebviewProxy!==void 0)TelegramWebviewProxy.postEvent(D,JSON.stringify(ue)),V();else if(window.external&&"notify"in window.external)window.external.notify(JSON.stringify({eventType:D,eventData:ue})),V();else if(N)try{var Ue="https://web.telegram.org";Ue="*",window.parent.postMessage(JSON.stringify({eventType:D,eventData:ue}),Ue),V()}catch(De){V(De)}else V({notAvailable:!0})}function _e(D,V){console.log("[Telegram.WebView] < receiveEvent",D,V),Ke(D,function(ue){ue(D,V)})}function Ke(D,V){var ue=O[D];if(!(ue===void 0||!ue.length))for(var Ue=0;Ue0){for(var E=0;Ej?1:-1;return 0}function ce(o){return Gu(S,o)>=0}function qa(o){if(window.Blob)try{return new Blob([o]).size}catch{}for(var f=o.length,h=o.length-1;h>=0;h--){var E=o.charCodeAt(h);E>127&&E<=2047?f++:E>2047&&E<=65535&&(f+=2),E>=56320&&E<=57343&&h--}return f}var Ga=(function(){var o=!1,f={};Object.defineProperty(f,"isVisible",{set:function(J){be({is_visible:J})},get:function(){return o},enumerable:!0});var h=null;r.onEvent("back_button_pressed",E);function E(){G("backButtonClicked")}function C(){return{is_visible:o}}function j(J){return typeof J>"u"&&(J=C()),JSON.stringify(J)}function Z(){return ce("6.1")?!0:(console.warn("[Telegram.WebApp] BackButton is not supported in version "+S),!1)}function Y(){var J=C(),me=j(J);h!==me&&(h=me,r.postEvent("web_app_setup_back_button",!1,J))}function be(J){return Z()&&(typeof J.is_visible<"u"&&(o=!!J.is_visible),Y()),f}return f.onClick=function(J){return Z()&&m("backButtonClicked",J),f},f.offClick=function(J){return Z()&&B("backButtonClicked",J),f},f.show=function(){return be({is_visible:!0})},f.hide=function(){return be({is_visible:!1})},f})(),Et=null,ea={},Fe=0;if(b.tgWebAppDebug){Et=document.createElement("tg-bottom-bar");var lt={display:"flex",gap:"7px",font:"600 14px/18px sans-serif",width:"100%",background:Mn(),position:"fixed",left:"0",right:"0",bottom:"0",margin:"0",padding:"7px",textAlign:"center",boxSizing:"border-box",zIndex:"10000"};for(var ht in lt)Et.style[ht]=lt[ht];document.addEventListener("DOMContentLoaded",function o(f){document.removeEventListener("DOMContentLoaded",o),document.body.appendChild(Et)});var Tl=document.createElement("style");Tl.innerHTML='tg-bottom-button.shine { position: relative; overflow: hidden; } tg-bottom-button.shine:before { content:""; position: absolute; top: 0; width: 100%; height: 100%; background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .2), transparent); animation: tg-bottom-button-shine 5s ease-in-out infinite; } @-webkit-keyframes tg-bottom-button-shine { 0% {left: -100%;} 12%,100% {left: 100%}} @keyframes tg-bottom-button-shine { 0% {left: -100%;} 12%,100% {left: 100%}}',Et.appendChild(Tl)}function ta(){var o=ea.main._bottomButton,f=ea.secondary._bottomButton;o.isVisible||f.isVisible?(Et.style.display="flex",Fe=58,o.isVisible&&f.isVisible&&(f.position=="top"?(Et.style.flexDirection="column-reverse",Fe+=51):f.position=="bottom"?(Et.style.flexDirection="column",Fe+=51):f.position=="left"?Et.style.flexDirection="row-reverse":f.position=="right"&&(Et.style.flexDirection="row"))):(Et.style.display="none",Fe=0),Et.style.background=Mn(),document.documentElement&&(document.documentElement.style.boxSizing="border-box",document.documentElement.style.paddingBottom=Fe+"px"),Fn()}var Lu=function(o){var f=o=="main";if(f)var h="web_app_setup_main_button",E="main_button_pressed",C="mainButtonClicked",j="Continue",Z=function(){return W.button_color||"#2481cc"},Y=function(){return W.button_text_color||"#ffffff"};else var h="web_app_setup_secondary_button",E="secondary_button_pressed",C="secondaryButtonClicked",j="Cancel",Z=function(){return Mn()},Y=function(){return W.button_color||"#2481cc"};var be=!1,J=!0,me=!1,ze=!1,he=o,q=j,Q=!1,F=!1,Ze="left",K={};Object.defineProperty(K,"type",{get:function(){return he},enumerable:!0}),Object.defineProperty(K,"text",{set:function(L){K.setParams({text:L})},get:function(){return q},enumerable:!0}),Object.defineProperty(K,"color",{set:function(L){K.setParams({color:L})},get:function(){return Q||Z()},enumerable:!0}),Object.defineProperty(K,"textColor",{set:function(L){K.setParams({text_color:L})},get:function(){return F||Y()},enumerable:!0}),Object.defineProperty(K,"isVisible",{set:function(L){K.setParams({is_visible:L})},get:function(){return be},enumerable:!0}),Object.defineProperty(K,"isProgressVisible",{get:function(){return ze},enumerable:!0}),Object.defineProperty(K,"isActive",{set:function(L){K.setParams({is_active:L})},get:function(){return J},enumerable:!0}),Object.defineProperty(K,"hasShineEffect",{set:function(L){K.setParams({has_shine_effect:L})},get:function(){return me},enumerable:!0}),f||Object.defineProperty(K,"position",{set:function(L){K.setParams({position:L})},get:function(){return Ze},enumerable:!0});var Re=null;r.onEvent(E,Va);var fe=null;if(b.tgWebAppDebug){fe=document.createElement("tg-bottom-button");var Je={display:"none",width:"100%",height:"44px",borderRadius:"0",background:"no-repeat right center",padding:"13px 15px",textAlign:"center",boxSizing:"border-box"};for(var kt in Je)fe.style[kt]=Je[kt];Et.appendChild(fe),fe.addEventListener("click",Va,!1),fe._bottomButton=K,ea[o]=fe}function Va(){J&&G(C)}function Il(){var L=K.color,zt=K.textColor;if(be){var zl={is_visible:!0,is_active:J,is_progress_visible:ze,text:q,color:L,text_color:zt,has_shine_effect:me&&J&&!ze};f||(zl.position=Ze)}else var zl={is_visible:!1};return zl}function ul(L){return typeof L>"u"&&(L=Il()),JSON.stringify(L)}function Bn(){var L=Il(),zt=ul(L);Re!==zt&&(Re=zt,r.postEvent(h,!1,L),b.tgWebAppDebug&&Un(L))}function Un(L){L.is_visible?(fe.style.display="block",fe.style.opacity=L.is_active?"1":"0.8",fe.style.cursor=L.is_active?"pointer":"auto",fe.disabled=!L.is_active,fe.innerText=L.text,fe.className=L.has_shine_effect?"shine":"",fe.style.backgroundImage=L.is_progress_visible?"url('data:image/svg+xml,"+encodeURIComponent('')+"')":"none",fe.style.backgroundColor=L.color,fe.style.color=L.text_color):fe.style.display="none",ta()}function vl(L){if(typeof L.text<"u"){var zt=ve(L.text);if(!zt.length)throw console.error("[Telegram.WebApp] Bottom button text is required",L.text),Error("WebAppBottomButtonParamInvalid");if(zt.length>64)throw console.error("[Telegram.WebApp] Bottom button text is too long",zt),Error("WebAppBottomButtonParamInvalid");q=zt}if(typeof L.color<"u")if(L.color===!1||L.color===null)Q=!1;else{var zl=Xl(L.color);if(!zl)throw console.error("[Telegram.WebApp] Bottom button color format is invalid",L.color),Error("WebAppBottomButtonParamInvalid");Q=zl}if(typeof L.text_color<"u")if(L.text_color===!1||L.text_color===null)F=!1;else{var Nn=Xl(L.text_color);if(!Nn)throw console.error("[Telegram.WebApp] Bottom button text color format is invalid",L.text_color),Error("WebAppBottomButtonParamInvalid");F=Nn}if(typeof L.is_visible<"u"){if(L.is_visible&&!K.text.length)throw console.error("[Telegram.WebApp] Bottom button text is required"),Error("WebAppBottomButtonParamInvalid");be=!!L.is_visible}if(typeof L.has_shine_effect<"u"&&(me=!!L.has_shine_effect),!f&&typeof L.position<"u"){if(L.position!="left"&&L.position!="right"&&L.position!="top"&&L.position!="bottom")throw console.error("[Telegram.WebApp] Bottom button posiition is invalid",L.position),Error("WebAppBottomButtonParamInvalid");Ze=L.position}return typeof L.is_active<"u"&&(J=!!L.is_active),Bn(),K}return K.setText=function(L){return K.setParams({text:L})},K.onClick=function(L){return m(C,L),K},K.offClick=function(L){return B(C,L),K},K.show=function(){return K.setParams({is_visible:!0})},K.hide=function(){return K.setParams({is_visible:!1})},K.enable=function(){return K.setParams({is_active:!0})},K.disable=function(){return K.setParams({is_active:!1})},K.showProgress=function(L){return J=!!L,ze=!0,Bn(),K},K.hideProgress=function(){return K.isActive||(J=!0),ze=!1,Bn(),K},K.setParams=vl,K},oc=Lu("main"),Yu=Lu("secondary"),Zl=(function(){var o=!1,f={};Object.defineProperty(f,"isVisible",{set:function(J){be({is_visible:J})},get:function(){return o},enumerable:!0});var h=null;r.onEvent("settings_button_pressed",E);function E(){G("settingsButtonClicked")}function C(){return{is_visible:o}}function j(J){return typeof J>"u"&&(J=C()),JSON.stringify(J)}function Z(){return ce("6.10")?!0:(console.warn("[Telegram.WebApp] SettingsButton is not supported in version "+S),!1)}function Y(){var J=C(),me=j(J);h!==me&&(h=me,r.postEvent("web_app_setup_settings_button",!1,J))}function be(J){return Z()&&(typeof J.is_visible<"u"&&(o=!!J.is_visible),Y()),f}return f.onClick=function(J){return Z()&&m("settingsButtonClicked",J),f},f.offClick=function(J){return Z()&&B("settingsButtonClicked",J),f},f.show=function(){return be({is_visible:!0})},f.hide=function(){return be({is_visible:!1})},f})(),La=(function(){var o={};function f(h){if(!ce("6.1"))return console.warn("[Telegram.WebApp] HapticFeedback is not supported in version "+S),o;if(h.type=="impact"){if(h.impact_style!="light"&&h.impact_style!="medium"&&h.impact_style!="heavy"&&h.impact_style!="rigid"&&h.impact_style!="soft")throw console.error("[Telegram.WebApp] Haptic impact style is invalid",h.impact_style),Error("WebAppHapticImpactStyleInvalid")}else if(h.type=="notification"){if(h.notification_type!="error"&&h.notification_type!="success"&&h.notification_type!="warning")throw console.error("[Telegram.WebApp] Haptic notification type is invalid",h.notification_type),Error("WebAppHapticNotificationTypeInvalid")}else if(h.type!="selection_change")throw console.error("[Telegram.WebApp] Haptic feedback type is invalid",h.type),Error("WebAppHapticFeedbackTypeInvalid");return r.postEvent("web_app_trigger_haptic_feedback",!1,h),o}return o.impactOccurred=function(h){return f({type:"impact",impact_style:h})},o.notificationOccurred=function(h){return f({type:"notification",notification_type:h})},o.selectionChanged=function(){return f({type:"selection_change"})},o})(),kl=(function(){var o={};function f(h,E,C){if(!ce("6.9"))throw console.error("[Telegram.WebApp] CloudStorage is not supported in version "+S),Error("WebAppMethodUnsupported");return Ya(h,E,C),o}return o.setItem=function(h,E,C){return f("saveStorageValue",{key:h,value:E},C)},o.getItem=function(h,E){return o.getItems([h],E?function(C,j){C?E(C):E(null,j[h])}:null)},o.getItems=function(h,E){return f("getStorageValues",{keys:h},E)},o.removeItem=function(h,E){return o.removeItems([h],E)},o.removeItems=function(h,E){return f("deleteStorageValues",{keys:h},E)},o.getKeys=function(h){return f("getStorageKeys",{},h)},o})(),Kl=(function(){var o=!1,f=!1,h="unknown",E=!1,C=!1,j=!1,Z="",Y={};Object.defineProperty(Y,"isInited",{get:function(){return o},enumerable:!0}),Object.defineProperty(Y,"isBiometricAvailable",{get:function(){return o&&f},enumerable:!0}),Object.defineProperty(Y,"biometricType",{get:function(){return h||"unknown"},enumerable:!0}),Object.defineProperty(Y,"isAccessRequested",{get:function(){return E},enumerable:!0}),Object.defineProperty(Y,"isAccessGranted",{get:function(){return E&&C},enumerable:!0}),Object.defineProperty(Y,"isBiometricTokenSaved",{get:function(){return j},enumerable:!0}),Object.defineProperty(Y,"deviceId",{get:function(){return Z||""},enumerable:!0});var be={callbacks:[]},J=!1,me=!1,ze=!1;r.onEvent("biometry_info_received",he),r.onEvent("biometry_auth_requested",q),r.onEvent("biometry_token_updated",Q);function he(K,Re){if(o=!0,Re.available?(f=!0,h=Re.type||"unknown",Re.access_requested?(E=!0,C=!!Re.access_granted,j=!!Re.token_saved):(E=!1,C=!1,j=!1)):(f=!1,h="unknown",E=!1,C=!1,j=!1),Z=Re.device_id||"",be.callbacks.length>0){for(var fe=0;fe128)throw console.error("[Telegram.WebApp] Biometric reason is too long",Je),Error("WebAppBiometricRequestAccessParamInvalid");Je.length>0&&(fe.reason=Je)}return J={callback:Re},r.postEvent("web_app_biometry_request_access",!1,fe),Y},Y.authenticate=function(K,Re){if(!F())return Y;if(Ze(),!f)throw console.error("[Telegram.WebApp] Biometrics is not available on this device."),Error("WebAppBiometricManagerBiometricsNotAvailable");if(!C)throw console.error("[Telegram.WebApp] Biometric access was not granted by the user."),Error("WebAppBiometricManagerBiometricAccessNotGranted");if(me)throw console.error("[Telegram.WebApp] Authentication request is already in progress."),Error("WebAppBiometricManagerAuthenticationRequested");var fe={};if(typeof K.reason<"u"){var Je=ve(K.reason);if(Je.length>128)throw console.error("[Telegram.WebApp] Biometric reason is too long",Je),Error("WebAppBiometricRequestAccessParamInvalid");Je.length>0&&(fe.reason=Je)}return me={callback:Re},r.postEvent("web_app_biometry_request_auth",!1,fe),Y},Y.updateBiometricToken=function(K,Re){if(!F())return Y;if(K=K||"",K.length>1024)throw console.error("[Telegram.WebApp] Token is too long",K),Error("WebAppBiometricManagerTokenInvalid");if(Ze(),!f)throw console.error("[Telegram.WebApp] Biometrics is not available on this device."),Error("WebAppBiometricManagerBiometricsNotAvailable");if(!C)throw console.error("[Telegram.WebApp] Biometric access was not granted by the user."),Error("WebAppBiometricManagerBiometricAccessNotGranted");if(ze)throw console.error("[Telegram.WebApp] Token request is already in progress."),Error("WebAppBiometricManagerTokenUpdateRequested");return ze={callback:Re},r.postEvent("web_app_biometry_update_token",!1,{token:K}),Y},Y.openSettings=function(){if(!F())return Y;if(Ze(),!f)throw console.error("[Telegram.WebApp] Biometrics is not available on this device."),Error("WebAppBiometricManagerBiometricsNotAvailable");if(!E)throw console.error("[Telegram.WebApp] Biometric access was not requested yet."),Error("WebAppBiometricManagerBiometricsAccessNotRequested");return C?(console.warn("[Telegram.WebApp] Biometric access was granted by the user, no need to go to settings."),Y):(r.postEvent("web_app_biometry_open_settings",!1),Y)},Y})(),xn=(function(){var o=!1,f=!1,h=!1,E=!1,C={};Object.defineProperty(C,"isInited",{get:function(){return o},enumerable:!0}),Object.defineProperty(C,"isLocationAvailable",{get:function(){return o&&f},enumerable:!0}),Object.defineProperty(C,"isAccessRequested",{get:function(){return h},enumerable:!0}),Object.defineProperty(C,"isAccessGranted",{get:function(){return h&&E},enumerable:!0});var j={callbacks:[]},Z={callbacks:[]};r.onEvent("location_checked",Y),r.onEvent("location_requested",be);function Y(he,q){if(o=!0,q.available?(f=!0,q.access_requested?(h=!0,E=!!q.access_granted):(h=!1,E=!1)):(f=!1,h=!1,E=!1),j.callbacks.length>0){for(var Q=0;Q0){for(var q=0;q0){for(var Q=0;Q0){for(var Q=0;Q0){for(var Q=0;Q1e3?console.warn("[Telegram.WebApp] Accelerometer refresh_rate is invalid",F):Q.refresh_rate=F,q&&C.push(q),r.postEvent("web_app_start_accelerometer",!1,Q),Z},Z.stop=function(he){return ze()&&(he&&j.push(he),r.postEvent("web_app_stop_accelerometer")),Z},Z})(),nt=(function(){var o=!1,f=null,h=null,E=null,C=!1,j=[],Z=[],Y={};Object.defineProperty(Y,"isStarted",{get:function(){return o},enumerable:!0}),Object.defineProperty(Y,"absolute",{get:function(){return C},enumerable:!0}),Object.defineProperty(Y,"alpha",{get:function(){return f},enumerable:!0}),Object.defineProperty(Y,"beta",{get:function(){return h},enumerable:!0}),Object.defineProperty(Y,"gamma",{get:function(){return E},enumerable:!0}),r.onEvent("device_orientation_started",be),r.onEvent("device_orientation_stopped",J),r.onEvent("device_orientation_changed",me),r.onEvent("device_orientation_failed",ze);function be(q,Q){if(o=!0,j.length>0){for(var F=0;F0){for(var F=0;F0){for(var F=0;F1e3?console.warn("[Telegram.WebApp] DeviceOrientation refresh_rate is invalid",Ze):F.refresh_rate=Ze,F.need_absolute=!!q.need_absolute,Q&&j.push(Q),r.postEvent("web_app_start_device_orientation",!1,F),Y},Y.stop=function(q){return he()&&(q&&Z.push(q),r.postEvent("web_app_stop_device_orientation")),Y},Y})(),Vu=(function(){var o=!1,f=null,h=null,E=null,C=[],j=[],Z={};Object.defineProperty(Z,"isStarted",{get:function(){return o},enumerable:!0}),Object.defineProperty(Z,"x",{get:function(){return f},enumerable:!0}),Object.defineProperty(Z,"y",{get:function(){return h},enumerable:!0}),Object.defineProperty(Z,"z",{get:function(){return E},enumerable:!0}),r.onEvent("gyroscope_started",Y),r.onEvent("gyroscope_stopped",be),r.onEvent("gyroscope_changed",J),r.onEvent("gyroscope_failed",me);function Y(he,q){if(o=!0,C.length>0){for(var Q=0;Q0){for(var Q=0;Q0){for(var Q=0;Q1e3?console.warn("[Telegram.WebApp] Gyroscope refresh_rate is invalid",F):Q.refresh_rate=F,q&&C.push(q),r.postEvent("web_app_start_gyroscope",!1,Q),Z},Z.stop=function(he){return ze()&&(he&&j.push(he),r.postEvent("web_app_stop_gyroscope")),Z},Z})(),Fl={};function Ol(o,f){if(f.slug&&Fl[f.slug]){var h=Fl[f.slug];delete Fl[f.slug],h.callback&&h.callback(f.status),G("invoiceClosed",{url:h.url,status:f.status})}}var yt=!1;function Qu(o,f){if(yt){var h=yt;yt=!1;var E=null;typeof f.button_id<"u"&&(E=f.button_id),h.callback&&h.callback(E),G("popupClosed",{button_id:E})}}var pl=!1;function Wu(o,f){if(pl){var h=pl,E=null;typeof f.data<"u"&&(E=f.data),h.callback&&h.callback(E)&&(pl=!1,r.postEvent("web_app_close_scan_qr_popup",!1)),G("qrTextReceived",{data:E})}}function rc(o,f){pl=!1,G("scanQrPopupClosed")}function la(o,f){if(f.req_id&&Ve[f.req_id]){var h=Ve[f.req_id];delete Ve[f.req_id];var E=null;typeof f.data<"u"&&(E=f.data),h.callback&&h.callback(E),G("clipboardTextReceived",{data:E})}}var ml=!1;function al(o,f){if(ml){var h=ml;ml=!1,h.callback&&h.callback(f.status=="allowed"),G("writeAccessRequested",{status:f.status})}}function Ct(o,f){var h,E,C=0,j=function(){Ya("getRequestedContact",{},function(Y,be){be&&be.length?(clearTimeout(E),o(be)):(C+=50,h=setTimeout(j,C))})},Z=function(){clearTimeout(h),o("")};E=setTimeout(Z,f),j()}var $l=!1;function fc(o,f){if($l){var h=$l;$l=!1;var E=f.status=="sent",C={status:f.status};E?Ct(function(j){if(j&&j.length){C.response=j,C.responseUnsafe=O.urlParseQueryString(j);for(var Z in C.responseUnsafe){var Y=C.responseUnsafe[Z];try{(Y.substr(0,1)=="{"&&Y.substr(-1)=="}"||Y.substr(0,1)=="["&&Y.substr(-1)=="]")&&(C.responseUnsafe[Z]=JSON.parse(Y))}catch{}}}h.callback&&h.callback(E,C),G("contactRequested",C)},3e3):(h.callback&&h.callback(E,C),G("contactRequested",C))}}var Cl=!1;function Xu(o,f){if(Cl){var h=Cl;Cl=!1;var E=f.status=="downloading";h.callback&&h.callback(E),G("fileDownloadRequested",{status:E?"downloading":"cancelled"})}}function na(o,f){if(f.req_id&&Ve[f.req_id]){var h=Ve[f.req_id];delete Ve[f.req_id];var E=null,C=null;typeof f.result<"u"&&(E=f.result),typeof f.error<"u"&&(C=f.error),h.callback&&h.callback(C,E)}}function Ya(o,f,h){if(!ce("6.9"))throw console.error("[Telegram.WebApp] Method invokeCustomMethod is not supported in version "+S),Error("WebAppMethodUnsupported");var E=Xe(16),C={req_id:E,method:o,params:f||{}};Ve[E]={callback:h},r.postEvent("web_app_invoke_custom_method",!1,C)}window.Telegram||(window.Telegram={}),Object.defineProperty(v,"initData",{get:function(){return N},enumerable:!0}),Object.defineProperty(v,"initDataUnsafe",{get:function(){return I},enumerable:!0}),Object.defineProperty(v,"version",{get:function(){return S},enumerable:!0}),Object.defineProperty(v,"platform",{get:function(){return ae},enumerable:!0}),Object.defineProperty(v,"colorScheme",{get:function(){return H},enumerable:!0}),Object.defineProperty(v,"themeParams",{get:function(){return W},enumerable:!0}),Object.defineProperty(v,"isExpanded",{get:function(){return Jn},enumerable:!0}),Object.defineProperty(v,"viewportHeight",{get:function(){return(ll===!1?window.innerHeight:ll)-Fe},enumerable:!0}),Object.defineProperty(v,"viewportStableHeight",{get:function(){return(fl===!1?window.innerHeight:fl)-Fe},enumerable:!0}),Object.defineProperty(v,"safeAreaInset",{get:function(){return dt},enumerable:!0}),Object.defineProperty(v,"contentSafeAreaInset",{get:function(){return Rt},enumerable:!0}),Object.defineProperty(v,"isClosingConfirmationEnabled",{set:function(o){Da(o)},get:function(){return $n},enumerable:!0}),Object.defineProperty(v,"isVerticalSwipesEnabled",{set:function(o){Ra(o)},get:function(){return Tn},enumerable:!0}),Object.defineProperty(v,"isFullscreen",{get:function(){return _e},enumerable:!0}),Object.defineProperty(v,"isOrientationLocked",{set:function(o){St(o)},get:function(){return Ke},enumerable:!0}),Object.defineProperty(v,"isActive",{get:function(){return ee},enumerable:!0}),Object.defineProperty(v,"headerColor",{set:function(o){cc(o)},get:function(){return At()},enumerable:!0}),Object.defineProperty(v,"backgroundColor",{set:function(o){In(o)},get:function(){return zn()},enumerable:!0}),Object.defineProperty(v,"bottomBarColor",{set:function(o){ju(o)},get:function(){return Mn()},enumerable:!0}),Object.defineProperty(v,"BackButton",{value:Ga,enumerable:!0}),Object.defineProperty(v,"MainButton",{value:oc,enumerable:!0}),Object.defineProperty(v,"SecondaryButton",{value:Yu,enumerable:!0}),Object.defineProperty(v,"SettingsButton",{value:Zl,enumerable:!0}),Object.defineProperty(v,"HapticFeedback",{value:La,enumerable:!0}),Object.defineProperty(v,"CloudStorage",{value:kl,enumerable:!0}),Object.defineProperty(v,"BiometricManager",{value:Kl,enumerable:!0}),Object.defineProperty(v,"Accelerometer",{value:Jl,enumerable:!0}),Object.defineProperty(v,"DeviceOrientation",{value:nt,enumerable:!0}),Object.defineProperty(v,"Gyroscope",{value:Vu,enumerable:!0}),Object.defineProperty(v,"LocationManager",{value:xn,enumerable:!0}),v.isVersionAtLeast=function(o){return ce(o)},v.setHeaderColor=function(o){v.headerColor=o},v.setBackgroundColor=function(o){v.backgroundColor=o},v.setBottomBarColor=function(o){v.bottomBarColor=o},v.enableClosingConfirmation=function(){v.isClosingConfirmationEnabled=!0},v.disableClosingConfirmation=function(){v.isClosingConfirmationEnabled=!1},v.enableVerticalSwipes=function(){v.isVerticalSwipesEnabled=!0},v.disableVerticalSwipes=function(){v.isVerticalSwipesEnabled=!1},v.lockOrientation=function(){v.isOrientationLocked=!0},v.unlockOrientation=function(){v.isOrientationLocked=!1},v.requestFullscreen=function(){if(!ce("8.0"))throw console.error("[Telegram.WebApp] Method requestFullscreen is not supported in version "+S),Error("WebAppMethodUnsupported");r.postEvent("web_app_request_fullscreen")},v.exitFullscreen=function(){if(!ce("8.0"))throw console.error("[Telegram.WebApp] Method exitFullscreen is not supported in version "+S),Error("WebAppMethodUnsupported");r.postEvent("web_app_exit_fullscreen")},v.addToHomeScreen=function(){if(!ce("8.0"))throw console.error("[Telegram.WebApp] Method addToHomeScreen is not supported in version "+S),Error("WebAppMethodUnsupported");r.postEvent("web_app_add_to_home_screen")},v.checkHomeScreenStatus=function(o){if(!ce("8.0"))throw console.error("[Telegram.WebApp] Method checkHomeScreenStatus is not supported in version "+S),Error("WebAppMethodUnsupported");o&&On.push(o),r.postEvent("web_app_check_home_screen")},v.onEvent=function(o,f){m(o,f)},v.offEvent=function(o,f){B(o,f)},v.sendData=function(o){if(!o||!o.length)throw console.error("[Telegram.WebApp] Data is required",o),Error("WebAppDataInvalid");if(qa(o)>4096)throw console.error("[Telegram.WebApp] Data is too long",o),Error("WebAppDataInvalid");r.postEvent("web_app_data_send",!1,{data:o})},v.switchInlineQuery=function(o,f){if(!ce("6.6"))throw console.error("[Telegram.WebApp] Method switchInlineQuery is not supported in version "+S),Error("WebAppMethodUnsupported");if(!b.tgWebAppBotInline)throw console.error("[Telegram.WebApp] Inline mode is disabled for this bot. Read more about inline mode: https://core.telegram.org/bots/inline"),Error("WebAppInlineModeDisabled");if(o=o||"",o.length>256)throw console.error("[Telegram.WebApp] Inline query is too long",o),Error("WebAppInlineQueryInvalid");var h=[];if(f){if(!Array.isArray(f))throw console.error("[Telegram.WebApp] Choose chat types should be an array",f),Error("WebAppInlineChooseChatTypesInvalid");for(var E={users:1,bots:1,groups:1,channels:1},C=0;C64)throw console.error("[Telegram.WebApp] Popup title is too long",h),Error("WebAppPopupParamInvalid");h.length>0&&(j.title=h)}if(typeof o.message<"u"&&(E=ve(o.message)),!E.length)throw console.error("[Telegram.WebApp] Popup message is required",o.message),Error("WebAppPopupParamInvalid");if(E.length>256)throw console.error("[Telegram.WebApp] Popup message is too long",E),Error("WebAppPopupParamInvalid");if(j.message=E,typeof o.buttons<"u"){if(!Array.isArray(o.buttons))throw console.error("[Telegram.WebApp] Popup buttons should be an array",o.buttons),Error("WebAppPopupParamInvalid");for(var Z=0;Z64))throw console.error("[Telegram.WebApp] Popup button id is too long",J),Error("WebAppPopupParamInvalid");be.id=J;var me=Y.type;if(typeof me>"u"&&(me="default"),be.type=me,!(me=="ok"||me=="close"||me=="cancel"))if(me=="default"||me=="destructive"){var ze="";if(typeof Y.text<"u"&&(ze=ve(Y.text)),!ze.length)throw console.error("[Telegram.WebApp] Popup button text is required for type "+me,Y.text),Error("WebAppPopupParamInvalid");if(ze.length>64)throw console.error("[Telegram.WebApp] Popup button text is too long",ze),Error("WebAppPopupParamInvalid");be.text=ze}else throw console.error("[Telegram.WebApp] Popup button type is invalid",me),Error("WebAppPopupParamInvalid");C.push(be)}}else C.push({id:"",type:"close"});if(C.length<1)throw console.error("[Telegram.WebApp] Popup should have at least one button"),Error("WebAppPopupParamInvalid");if(C.length>3)throw console.error("[Telegram.WebApp] Popup should not have more than 3 buttons"),Error("WebAppPopupParamInvalid");j.buttons=C,yt={callback:f},r.postEvent("web_app_open_popup",!1,j)},v.showAlert=function(o,f){v.showPopup({message:o},f?function(){f()}:null)},v.showConfirm=function(o,f){v.showPopup({message:o,buttons:[{type:"ok",id:"ok"},{type:"cancel"}]},f?function(h){f(h=="ok")}:null)},v.showScanQrPopup=function(o,f){if(!ce("6.4"))throw console.error("[Telegram.WebApp] Method showScanQrPopup is not supported in version "+S),Error("WebAppMethodUnsupported");if(pl)throw console.error("[Telegram.WebApp] Popup is already opened"),Error("WebAppScanQrPopupOpened");var h="",E={};if(typeof o.text<"u"){if(h=ve(o.text),h.length>64)throw console.error("[Telegram.WebApp] Scan QR popup text is too long",h),Error("WebAppScanQrPopupParamInvalid");h.length>0&&(E.text=h)}pl={callback:f},r.postEvent("web_app_open_scan_qr_popup",!1,E)},v.closeScanQrPopup=function(){if(!ce("6.4"))throw console.error("[Telegram.WebApp] Method closeScanQrPopup is not supported in version "+S),Error("WebAppMethodUnsupported");pl=!1,r.postEvent("web_app_close_scan_qr_popup",!1)},v.readTextFromClipboard=function(o){if(!ce("6.4"))throw console.error("[Telegram.WebApp] Method readTextFromClipboard is not supported in version "+S),Error("WebAppMethodUnsupported");var f=Xe(16),h={req_id:f};Ve[f]={callback:o},r.postEvent("web_app_read_text_from_clipboard",!1,h)},v.requestWriteAccess=function(o){if(!ce("6.9"))throw console.error("[Telegram.WebApp] Method requestWriteAccess is not supported in version "+S),Error("WebAppMethodUnsupported");if(ml)throw console.error("[Telegram.WebApp] Write access is already requested"),Error("WebAppWriteAccessRequested");ml={callback:o},r.postEvent("web_app_request_write_access")},v.requestContact=function(o){if(!ce("6.9"))throw console.error("[Telegram.WebApp] Method requestContact is not supported in version "+S),Error("WebAppMethodUnsupported");if($l)throw console.error("[Telegram.WebApp] Contact is already requested"),Error("WebAppContactRequested");$l={callback:o},r.postEvent("web_app_request_phone")},v.downloadFile=function(o,f){if(!ce("8.0"))throw console.error("[Telegram.WebApp] Method downloadFile is not supported in version "+S),Error("WebAppMethodUnsupported");if(Cl)throw console.error("[Telegram.WebApp] Popup is already opened"),Error("WebAppDownloadFilePopupOpened");var h=document.createElement("A"),E={};if(!o||!o.url||!o.url.length)throw console.error("[Telegram.WebApp] Url is required"),Error("WebAppDownloadFileParamInvalid");if(h.href=o.url,h.protocol!="https:")throw console.error("[Telegram.WebApp] Url protocol is not supported",url),Error("WebAppDownloadFileParamInvalid");if(E.url=h.href,!o||!o.file_name||!o.file_name.length)throw console.error("[Telegram.WebApp] File name is required"),Error("WebAppDownloadFileParamInvalid");E.file_name=o.file_name,Cl={callback:f},r.postEvent("web_app_request_file_download",!1,E)},v.shareToStory=function(o,f){if(f=f||{},!ce("7.8"))throw console.error("[Telegram.WebApp] Method shareToStory is not supported in version "+S),Error("WebAppMethodUnsupported");var h=document.createElement("A");if(h.href=o,h.protocol!="http:"&&h.protocol!="https:")throw console.error("[Telegram.WebApp] Media url protocol is not supported",url),Error("WebAppMediaUrlInvalid");var E={};if(E.media_url=h.href,typeof f.text<"u"){var C=ve(f.text);if(C.length>2048)throw console.error("[Telegram.WebApp] Text is too long",C),Error("WebAppShareToStoryParamInvalid");C.length>0&&(E.text=C)}if(typeof f.widget_link<"u"){if(f.widget_link=f.widget_link||{},h.href=f.widget_link.url,h.protocol!="http:"&&h.protocol!="https:")throw console.error("[Telegram.WebApp] Link protocol is not supported",url),Error("WebAppShareToStoryParamInvalid");var j={url:h.href};if(typeof f.widget_link.name<"u"){var Z=ve(f.widget_link.name);if(Z.length>48)throw console.error("[Telegram.WebApp] Link name is too long",Z),Error("WebAppShareToStoryParamInvalid");Z.length>0&&(j.name=Z)}E.widget_link=j}r.postEvent("web_app_share_to_story",!1,E)},v.shareMessage=function(o,f){if(!ce("8.0"))throw console.error("[Telegram.WebApp] Method shareMessage is not supported in version "+S),Error("WebAppMethodUnsupported");if(jt)throw console.error("[Telegram.WebApp] Share message is already opened"),Error("WebAppShareMessageOpened");jt={callback:f},r.postEvent("web_app_send_prepared_message",!1,{id:o})},v.setEmojiStatus=function(o,f,h){if(f=f||{},!ce("8.0"))throw console.error("[Telegram.WebApp] Method setEmojiStatus is not supported in version "+S),Error("WebAppMethodUnsupported");var E={};if(E.custom_emoji_id=o,typeof f.duration<"u"&&(E.duration=f.duration),sl)throw console.error("[Telegram.WebApp] Emoji status is already requested"),Error("WebAppEmojiStatusRequested");sl={callback:h},r.postEvent("web_app_set_emoji_status",!1,E)},v.requestEmojiStatusAccess=function(o){if(!ce("8.0"))throw console.error("[Telegram.WebApp] Method requestEmojiStatusAccess is not supported in version "+S),Error("WebAppMethodUnsupported");if(ot)throw console.error("[Telegram.WebApp] Emoji status permission is already requested"),Error("WebAppEmojiStatusAccessRequested");ot={callback:o},r.postEvent("web_app_request_emoji_status_access")},v.invokeCustomMethod=function(o,f,h){Ya(o,f,h)},v.ready=function(){r.postEvent("web_app_ready")},v.expand=function(){r.postEvent("web_app_expand")},v.close=function(o){o=o||{};var f={};ce("7.6")&&o.return_back&&(f.return_back=!0),r.postEvent("web_app_close",!1,f)},window.Telegram.WebApp=v,Ql(),Wl(),El(),Fn(),b.tgWebAppShowSettings&&Zl.show(),window.addEventListener("resize",Zt),s&&document.addEventListener("click",ne),r.onEvent("theme_changed",Xt),r.onEvent("viewport_changed",Al),r.onEvent("safe_area_changed",Dt),r.onEvent("content_safe_area_changed",M),r.onEvent("visibility_changed",R),r.onEvent("invoice_closed",Ol),r.onEvent("popup_closed",Qu),r.onEvent("qr_text_received",Wu),r.onEvent("scan_qr_popup_closed",rc),r.onEvent("clipboard_text_received",la),r.onEvent("write_access_requested",al),r.onEvent("phone_requested",fc),r.onEvent("file_download_requested",Xu),r.onEvent("custom_method_invoked",na),r.onEvent("fullscreen_changed",nc),r.onEvent("fullscreen_failed",ac),r.onEvent("home_screen_added",Hu),r.onEvent("home_screen_checked",wu),r.onEvent("prepared_message_sent",uc),r.onEvent("prepared_message_failed",Du),r.onEvent("emoji_status_set",ic),r.onEvent("emoji_status_failed",Cn),r.onEvent("emoji_status_access_requested",dl),r.postEvent("web_app_request_theme"),r.postEvent("web_app_request_viewport"),r.postEvent("web_app_request_safe_area"),r.postEvent("web_app_request_content_safe_area")})()),uh}var ch;function Um(){if(ch)return Bu;ch=1,Object.defineProperty(Bu,"__esModule",{value:!0}),Bu.WebApp=void 0,Bm();var O=window;return Bu.WebApp=O.Telegram.WebApp,Bu}var oh;function Nm(){if(oh)return ec;oh=1,Object.defineProperty(ec,"__esModule",{value:!0});var O=Um();return ec.default=O.WebApp,ec}var Hm=Nm();const Ha=dm(Hm),wm=()=>{const{createRoom:O,joinRoom:r}=br(),[b,s]=gt.useState(""),[v,N]=gt.useState(""),[I,W]=gt.useState("create");gt.useEffect(()=>{Ha.initDataUnsafe?.user?.first_name&&s(Ha.initDataUnsafe.user.first_name)},[]);const H=()=>{b&&O(b,Ha.initDataUnsafe?.user?.id?.toString())},S=()=>{!b||!v||r(v,b,Ha.initDataUnsafe?.user?.id?.toString())};return P.jsxs("div",{className:"flex flex-col items-center justify-center min-h-screen p-4 space-y-8",children:[P.jsx("h1",{className:"text-4xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-blue-400 to-purple-600",children:"Alias"}),P.jsxs("div",{className:"w-full max-w-sm bg-gray-800/50 backdrop-blur-md rounded-2xl p-6 shadow-xl border border-gray-700",children:[P.jsxs("div",{className:"flex space-x-2 mb-6 bg-gray-900/50 p-1 rounded-lg",children:[P.jsx("button",{onClick:()=>W("create"),className:`flex-1 py-2 rounded-md text-sm font-medium transition-all ${I==="create"?"bg-blue-600 text-white shadow-lg":"text-gray-400 hover:text-white"}`,children:"Создать"}),P.jsx("button",{onClick:()=>W("join"),className:`flex-1 py-2 rounded-md text-sm font-medium transition-all ${I==="join"?"bg-blue-600 text-white shadow-lg":"text-gray-400 hover:text-white"}`,children:"Войти"})]}),P.jsxs("div",{className:"space-y-4",children:[P.jsxs("div",{children:[P.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1 ml-1",children:"Твое имя"}),P.jsx("input",{type:"text",value:b,onChange:ae=>s(ae.target.value),placeholder:"Введите имя...",className:"w-full px-4 py-3 bg-gray-900 border border-gray-700 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-all text-white placeholder-gray-600"})]}),I==="join"&&P.jsxs("div",{children:[P.jsx("label",{className:"block text-xs font-medium text-gray-400 mb-1 ml-1",children:"Номер комнаты"}),P.jsx("input",{type:"number",value:v,onChange:ae=>N(ae.target.value),placeholder:"1234",className:"w-full px-4 py-3 bg-gray-900 border border-gray-700 rounded-xl focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-all text-white placeholder-gray-600 font-mono tracking-widest text-center text-lg"})]}),P.jsx("button",{onClick:I==="create"?H:S,className:"w-full py-3 mt-2 bg-gradient-to-r from-blue-600 to-blue-700 hover:from-blue-500 hover:to-blue-600 text-white font-bold rounded-xl shadow-lg transform transition-all active:scale-95",children:I==="create"?"Создать комнату":"Присоединиться"})]})]})]})},Dm=()=>{const{room:O,currentPlayer:r,joinTeam:b}=br();if(!O)return null;const s=N=>{const I=O.teams.find(H=>H.id===N.id)?.playerIds.map(H=>O.players[H])||[],W=r?.teamId===N.id;return P.jsxs("div",{className:"flex-1 min-w-[45%] bg-gray-800/50 rounded-xl p-4 border border-gray-700 flex flex-col",children:[P.jsxs("div",{className:"flex justify-between items-center mb-3",children:[P.jsx("h3",{className:"font-bold text-lg text-white",children:N.name}),!W&&P.jsx("button",{onClick:()=>b(N.id),className:"text-xs px-3 py-1 bg-gray-700 hover:bg-gray-600 rounded-full transition-colors",children:"Войти"})]}),P.jsxs("div",{className:"flex-1 space-y-2",children:[I.map(H=>P.jsxs("div",{className:"flex items-center space-x-2 bg-gray-900/60 p-2 rounded-lg",children:[P.jsx("div",{className:"w-8 h-8 bg-gradient-to-br from-blue-500 to-purple-500 rounded-full flex items-center justify-center text-xs font-bold",children:H.name.substring(0,2).toUpperCase()}),P.jsx("span",{className:"text-sm truncate",children:H.name}),H.host&&P.jsx("span",{className:"text-xs text-yellow-500",children:"👑"})]},H.sessionId)),I.length===0&&P.jsx("div",{className:"text-center text-gray-500 text-sm py-4",children:"Пусто"})]})]},N.id)},v=Object.values(O.players).filter(N=>!N.teamId);return P.jsxs("div",{className:"flex flex-col h-screen p-4 bg-gray-900 text-white",children:[P.jsxs("header",{className:"flex justify-between items-center mb-6",children:[P.jsxs("div",{children:[P.jsxs("h2",{className:"text-xl font-bold",children:["Комната #",O.roomId]}),P.jsx("p",{className:"text-xs text-gray-400",children:"Ожидание игроков..."})]}),P.jsxs("div",{className:"bg-gray-800 px-3 py-1 rounded-full text-xs font-mono",children:[Object.keys(O.players).length," Online"]})]}),v.length>0&&P.jsxs("div",{className:"mb-6",children:[P.jsx("h4",{className:"text-xs text-gray-400 uppercase mb-2 ml-1",children:"Без команды"}),P.jsx("div",{className:"flex flex-wrap gap-2",children:v.map(N=>P.jsx("div",{className:"bg-gray-800 px-3 py-1.5 rounded-full text-sm border border-gray-700",children:N.name},N.sessionId))})]}),P.jsx("div",{className:"flex gap-4 mb-auto",children:O.teams.map(s)}),r?.host?P.jsxs("div",{className:"mt-4 p-4 bg-gray-800 rounded-t-2xl -mx-4 space-y-4 shadow-2xl border-t border-gray-700",children:[P.jsxs("div",{className:"flex justify-between items-center",children:[P.jsx("span",{className:"text-sm text-gray-400",children:"Сложность"}),P.jsxs("select",{className:"bg-gray-900 border border-gray-700 rounded px-2 py-1 text-sm outline-none",children:[P.jsx("option",{children:"EASY"}),P.jsx("option",{children:"MEDIUM"}),P.jsx("option",{children:"HARD"})]})]}),P.jsx("button",{className:"w-full py-4 bg-green-600 hover:bg-green-500 text-white font-bold rounded-xl text-lg shadow-lg active:scale-95 transition-all",children:"Начать игру"})]}):P.jsx("div",{className:"mt-4 text-center text-gray-500 text-sm pb-4",children:"Ждем, пока хост начнет игру..."})]})},Rm={LOBBY:"LOBBY"};Ha.ready();Ha.expand();const jm=()=>{const{room:O,error:r}=br();return r?P.jsx("div",{className:"flex items-center justify-center h-screen text-red-500 p-4 text-center",children:P.jsxs("div",{children:[P.jsx("h2",{className:"text-xl font-bold mb-2",children:"Ошибка"}),P.jsx("p",{children:r}),P.jsx("button",{onClick:()=>window.location.reload(),className:"mt-4 text-blue-500 underline",children:"Перезагрузить"})]})}):O?O.state===Rm.LOBBY?P.jsx(Dm,{}):P.jsx("div",{className:"flex items-center justify-center h-screen text-white",children:"Game Started! (Coming soon)"}):P.jsx(wm,{})},qm=()=>P.jsx(xm,{children:P.jsx(jm,{})});Am.createRoot(document.getElementById("root")).render(P.jsx(gt.StrictMode,{children:P.jsx(qm,{})}));