(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Au={exports:{}},Si={},Du={exports:{}},z={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var ur=Symbol.for("react.element"),lf=Symbol.for("react.portal"),sf=Symbol.for("react.fragment"),uf=Symbol.for("react.strict_mode"),af=Symbol.for("react.profiler"),cf=Symbol.for("react.provider"),ff=Symbol.for("react.context"),df=Symbol.for("react.forward_ref"),pf=Symbol.for("react.suspense"),hf=Symbol.for("react.memo"),mf=Symbol.for("react.lazy"),hs=Symbol.iterator;function yf(e){return e===null||typeof e!="object"?null:(e=hs&&e[hs]||e["@@iterator"],typeof e=="function"?e:null)}var Iu={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Mu=Object.assign,ju={};function vn(e,t,n){this.props=e,this.context=t,this.refs=ju,this.updater=n||Iu}vn.prototype.isReactComponent={};vn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};vn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Bu(){}Bu.prototype=vn.prototype;function pl(e,t,n){this.props=e,this.context=t,this.refs=ju,this.updater=n||Iu}var hl=pl.prototype=new Bu;hl.constructor=pl;Mu(hl,vn.prototype);hl.isPureReactComponent=!0;var ms=Array.isArray,Fu=Object.prototype.hasOwnProperty,ml={current:null},Uu={key:!0,ref:!0,__self:!0,__source:!0};function $u(e,t,n){var r,i={},o=null,l=null;if(t!=null)for(r in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(o=""+t.key),t)Fu.call(t,r)&&!Uu.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1>>1,Z=S[Q];if(0>>1;Qi(Bi,R))Oti(hr,Bi)?(S[Q]=hr,S[Ot]=R,Q=Ot):(S[Q]=Bi,S[Pt]=R,Q=Pt);else if(Oti(hr,R))S[Q]=hr,S[Ot]=R,Q=Ot;else break e}}return O}function i(S,O){var R=S.sortIndex-O.sortIndex;return R!==0?R:S.id-O.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,s=l.now();e.unstable_now=function(){return l.now()-s}}var u=[],c=[],h=1,m=null,p=3,g=!1,y=!1,k=!1,D=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,a=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d(S){for(var O=n(c);O!==null;){if(O.callback===null)r(c);else if(O.startTime<=S)r(c),O.sortIndex=O.expirationTime,t(u,O);else break;O=n(c)}}function v(S){if(k=!1,d(S),!y)if(n(u)!==null)y=!0,ze(E);else{var O=n(c);O!==null&<(v,O.startTime-S)}}function E(S,O){y=!1,k&&(k=!1,f(N),N=-1),g=!0;var R=p;try{for(d(O),m=n(u);m!==null&&(!(m.expirationTime>O)||S&&!ie());){var Q=m.callback;if(typeof Q=="function"){m.callback=null,p=m.priorityLevel;var Z=Q(m.expirationTime<=O);O=e.unstable_now(),typeof Z=="function"?m.callback=Z:m===n(u)&&r(u),d(O)}else r(u);m=n(u)}if(m!==null)var pr=!0;else{var Pt=n(c);Pt!==null&<(v,Pt.startTime-O),pr=!1}return pr}finally{m=null,p=R,g=!1}}var x=!1,C=null,N=-1,T=5,L=-1;function ie(){return!(e.unstable_now()-LS||125Q?(S.sortIndex=R,t(c,S),n(u)===null&&S===n(c)&&(k?(f(N),N=-1):k=!0,lt(v,R-Q))):(S.sortIndex=Z,t(u,S),y||g||(y=!0,ze(E))),S},e.unstable_shouldYield=ie,e.unstable_wrapCallback=function(S){var O=p;return function(){var R=p;p=O;try{return S.apply(this,arguments)}finally{p=R}}}})(Ku);Qu.exports=Ku;var Tf=Qu.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Pf=X,Se=Tf;function w(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mo=Object.prototype.hasOwnProperty,Of=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,gs={},vs={};function Rf(e){return mo.call(vs,e)?!0:mo.call(gs,e)?!1:Of.test(e)?vs[e]=!0:(gs[e]=!0,!1)}function Lf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function zf(e,t,n,r){if(t===null||typeof t>"u"||Lf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function de(e,t,n,r,i,o,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=l}var re={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){re[e]=new de(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];re[t]=new de(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){re[e]=new de(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){re[e]=new de(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){re[e]=new de(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){re[e]=new de(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){re[e]=new de(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){re[e]=new de(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){re[e]=new de(e,5,!1,e.toLowerCase(),null,!1,!1)});var gl=/[\-:]([a-z])/g;function vl(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(gl,vl);re[t]=new de(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(gl,vl);re[t]=new de(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(gl,vl);re[t]=new de(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!1,!1)});re.xlinkHref=new de("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){re[e]=new de(e,1,!1,e.toLowerCase(),null,!0,!0)});function wl(e,t,n,r){var i=re.hasOwnProperty(t)?re[t]:null;(i!==null?i.type!==0:r||!(2s||i[l]!==o[s]){var u=` `+i[l].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=l&&0<=s);break}}}finally{$i=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ln(e):""}function Af(e){switch(e.tag){case 5:return Ln(e.type);case 16:return Ln("Lazy");case 13:return Ln("Suspense");case 19:return Ln("SuspenseList");case 0:case 2:case 15:return e=Vi(e.type,!1),e;case 11:return e=Vi(e.type.render,!1),e;case 1:return e=Vi(e.type,!0),e;default:return""}}function wo(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Yt:return"Fragment";case Kt:return"Portal";case yo:return"Profiler";case kl:return"StrictMode";case go:return"Suspense";case vo:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Xu:return(e.displayName||"Context")+".Consumer";case qu:return(e._context.displayName||"Context")+".Provider";case Sl:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case El:return t=e.displayName||null,t!==null?t:wo(e.type)||"Memo";case at:t=e._payload,e=e._init;try{return wo(e(t))}catch{}}return null}function Df(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return wo(t);case 8:return t===kl?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function _t(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Gu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function If(e){var t=Gu(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(l){r=""+l,o.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(l){r=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gr(e){e._valueTracker||(e._valueTracker=If(e))}function Zu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Gu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Gr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function ko(e,t){var n=t.checked;return H({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ks(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=_t(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function bu(e,t){t=t.checked,t!=null&&wl(e,"checked",t,!1)}function So(e,t){bu(e,t);var n=_t(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Eo(e,t.type,n):t.hasOwnProperty("defaultValue")&&Eo(e,t.type,_t(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Ss(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Eo(e,t,n){(t!=="number"||Gr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function on(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=vr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Kn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Mn={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Mf=["Webkit","ms","Moz","O"];Object.keys(Mn).forEach(function(e){Mf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Mn[t]=Mn[e]})});function ra(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Mn.hasOwnProperty(e)&&Mn[e]?(""+t).trim():t+"px"}function ia(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=ra(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var jf=H({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Co(e,t){if(t){if(jf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(w(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(w(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(w(61))}if(t.style!=null&&typeof t.style!="object")throw Error(w(62))}}function No(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var To=null;function _l(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Po=null,ln=null,sn=null;function xs(e){if(e=fr(e)){if(typeof Po!="function")throw Error(w(280));var t=e.stateNode;t&&(t=Ni(t),Po(e.stateNode,e.type,t))}}function oa(e){ln?sn?sn.push(e):sn=[e]:ln=e}function la(){if(ln){var e=ln,t=sn;if(sn=ln=null,xs(e),t)for(e=0;e>>=0,e===0?32:31-(qf(e)/Xf|0)|0}var wr=64,kr=4194304;function An(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ti(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,l=n&268435455;if(l!==0){var s=l&~i;s!==0?r=An(s):(o&=l,o!==0&&(r=An(o)))}else l=n&~i,l!==0?r=An(l):o!==0&&(r=An(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function ar(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Be(t),e[t]=n}function bf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Bn),As=" ",Ds=!1;function Na(e,t){switch(e){case"keyup":return Td.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ta(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qt=!1;function Od(e,t){switch(e){case"compositionend":return Ta(t);case"keypress":return t.which!==32?null:(Ds=!0,As);case"textInput":return e=t.data,e===As&&Ds?null:e;default:return null}}function Rd(e,t){if(qt)return e==="compositionend"||!Ll&&Na(e,t)?(e=xa(),Fr=Pl=pt=null,qt=!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:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Bs(n)}}function La(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?La(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function za(){for(var e=window,t=Gr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Gr(e.document)}return t}function zl(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Fd(e){var t=za(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&La(n.ownerDocument.documentElement,n)){if(r!==null&&zl(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Fs(n,o);var l=Fs(n,r);i&&l&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Xt=null,Do=null,Un=null,Io=!1;function Us(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Io||Xt==null||Xt!==Gr(r)||(r=Xt,"selectionStart"in r&&zl(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Un&&Zn(Un,r)||(Un=r,r=ii(Do,"onSelect"),0Zt||(e.current=$o[Zt],$o[Zt]=null,Zt--)}function j(e,t){Zt++,$o[Zt]=e.current,e.current=t}var xt={},ue=Nt(xt),me=Nt(!1),jt=xt;function dn(e,t){var n=e.type.contextTypes;if(!n)return xt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ye(e){return e=e.childContextTypes,e!=null}function li(){F(me),F(ue)}function Ys(e,t,n){if(ue.current!==xt)throw Error(w(168));j(ue,t),j(me,n)}function $a(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(w(108,Df(e)||"Unknown",i));return H({},n,r)}function si(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||xt,jt=ue.current,j(ue,e),j(me,me.current),!0}function qs(e,t,n){var r=e.stateNode;if(!r)throw Error(w(169));n?(e=$a(e,t,jt),r.__reactInternalMemoizedMergedChildContext=e,F(me),F(ue),j(ue,e)):F(me),j(me,n)}var Je=null,Ti=!1,no=!1;function Va(e){Je===null?Je=[e]:Je.push(e)}function Gd(e){Ti=!0,Va(e)}function Tt(){if(!no&&Je!==null){no=!0;var e=0,t=M;try{var n=Je;for(M=1;e>=l,i-=l,Ge=1<<32-Be(t)+i|n<N?(T=C,C=null):T=C.sibling;var L=p(f,C,d[N],v);if(L===null){C===null&&(C=T);break}e&&C&&L.alternate===null&&t(f,C),a=o(L,a,N),x===null?E=L:x.sibling=L,x=L,C=T}if(N===d.length)return n(f,C),U&&Rt(f,N),E;if(C===null){for(;NN?(T=C,C=null):T=C.sibling;var ie=p(f,C,L.value,v);if(ie===null){C===null&&(C=T);break}e&&C&&ie.alternate===null&&t(f,C),a=o(ie,a,N),x===null?E=ie:x.sibling=ie,x=ie,C=T}if(L.done)return n(f,C),U&&Rt(f,N),E;if(C===null){for(;!L.done;N++,L=d.next())L=m(f,L.value,v),L!==null&&(a=o(L,a,N),x===null?E=L:x.sibling=L,x=L);return U&&Rt(f,N),E}for(C=r(f,C);!L.done;N++,L=d.next())L=g(C,f,N,L.value,v),L!==null&&(e&&L.alternate!==null&&C.delete(L.key===null?N:L.key),a=o(L,a,N),x===null?E=L:x.sibling=L,x=L);return e&&C.forEach(function(Le){return t(f,Le)}),U&&Rt(f,N),E}function D(f,a,d,v){if(typeof d=="object"&&d!==null&&d.type===Yt&&d.key===null&&(d=d.props.children),typeof d=="object"&&d!==null){switch(d.$$typeof){case yr:e:{for(var E=d.key,x=a;x!==null;){if(x.key===E){if(E=d.type,E===Yt){if(x.tag===7){n(f,x.sibling),a=i(x,d.props.children),a.return=f,f=a;break e}}else if(x.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===at&&Gs(E)===x.type){n(f,x.sibling),a=i(x,d.props),a.ref=Tn(f,x,d),a.return=f,f=a;break e}n(f,x);break}else t(f,x);x=x.sibling}d.type===Yt?(a=Mt(d.props.children,f.mode,v,d.key),a.return=f,f=a):(v=Yr(d.type,d.key,d.props,null,f.mode,v),v.ref=Tn(f,a,d),v.return=f,f=v)}return l(f);case Kt:e:{for(x=d.key;a!==null;){if(a.key===x)if(a.tag===4&&a.stateNode.containerInfo===d.containerInfo&&a.stateNode.implementation===d.implementation){n(f,a.sibling),a=i(a,d.children||[]),a.return=f,f=a;break e}else{n(f,a);break}else t(f,a);a=a.sibling}a=co(d,f.mode,v),a.return=f,f=a}return l(f);case at:return x=d._init,D(f,a,x(d._payload),v)}if(zn(d))return y(f,a,d,v);if(En(d))return k(f,a,d,v);Tr(f,d)}return typeof d=="string"&&d!==""||typeof d=="number"?(d=""+d,a!==null&&a.tag===6?(n(f,a.sibling),a=i(a,d),a.return=f,f=a):(n(f,a),a=ao(d,f.mode,v),a.return=f,f=a),l(f)):n(f,a)}return D}var hn=Ka(!0),Ya=Ka(!1),ci=Nt(null),fi=null,tn=null,Ml=null;function jl(){Ml=tn=fi=null}function Bl(e){var t=ci.current;F(ci),e._currentValue=t}function Wo(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function an(e,t){fi=e,Ml=tn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(he=!0),e.firstContext=null)}function Oe(e){var t=e._currentValue;if(Ml!==e)if(e={context:e,memoizedValue:t,next:null},tn===null){if(fi===null)throw Error(w(308));tn=e,fi.dependencies={lanes:0,firstContext:e}}else tn=tn.next=e;return t}var At=null;function Fl(e){At===null?At=[e]:At.push(e)}function qa(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Fl(t)):(n.next=i.next,i.next=n),t.interleaved=n,nt(e,r)}function nt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ct=!1;function Ul(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Xa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function be(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function wt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,I&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,nt(e,n)}return i=r.interleaved,i===null?(t.next=t,Fl(r)):(t.next=i.next,i.next=t),r.interleaved=t,nt(e,n)}function $r(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Cl(e,n)}}function Zs(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=l:o=o.next=l,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function di(e,t,n,r){var i=e.updateQueue;ct=!1;var o=i.firstBaseUpdate,l=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var u=s,c=u.next;u.next=null,l===null?o=c:l.next=c,l=u;var h=e.alternate;h!==null&&(h=h.updateQueue,s=h.lastBaseUpdate,s!==l&&(s===null?h.firstBaseUpdate=c:s.next=c,h.lastBaseUpdate=u))}if(o!==null){var m=i.baseState;l=0,h=c=u=null,s=o;do{var p=s.lane,g=s.eventTime;if((r&p)===p){h!==null&&(h=h.next={eventTime:g,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var y=e,k=s;switch(p=t,g=n,k.tag){case 1:if(y=k.payload,typeof y=="function"){m=y.call(g,m,p);break e}m=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=k.payload,p=typeof y=="function"?y.call(g,m,p):y,p==null)break e;m=H({},m,p);break e;case 2:ct=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[s]:p.push(s))}else g={eventTime:g,lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},h===null?(c=h=g,u=m):h=h.next=g,l|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(h===null&&(u=m),i.baseState=u,i.firstBaseUpdate=c,i.lastBaseUpdate=h,t=i.shared.interleaved,t!==null){i=t;do l|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);Ut|=l,e.lanes=l,e.memoizedState=m}}function bs(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=io.transition;io.transition={};try{e(!1),t()}finally{M=n,io.transition=r}}function dc(){return Re().memoizedState}function tp(e,t,n){var r=St(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},pc(e))hc(t,n);else if(n=qa(e,t,n,r),n!==null){var i=ce();Fe(n,e,r,i),mc(n,t,r)}}function np(e,t,n){var r=St(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(pc(e))hc(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var l=t.lastRenderedState,s=o(l,n);if(i.hasEagerState=!0,i.eagerState=s,Ue(s,l)){var u=t.interleaved;u===null?(i.next=i,Fl(t)):(i.next=u.next,u.next=i),t.interleaved=i;return}}catch{}finally{}n=qa(e,t,i,r),n!==null&&(i=ce(),Fe(n,e,r,i),mc(n,t,r))}}function pc(e){var t=e.alternate;return e===V||t!==null&&t===V}function hc(e,t){$n=hi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function mc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Cl(e,n)}}var mi={readContext:Oe,useCallback:oe,useContext:oe,useEffect:oe,useImperativeHandle:oe,useInsertionEffect:oe,useLayoutEffect:oe,useMemo:oe,useReducer:oe,useRef:oe,useState:oe,useDebugValue:oe,useDeferredValue:oe,useTransition:oe,useMutableSource:oe,useSyncExternalStore:oe,useId:oe,unstable_isNewReconciler:!1},rp={readContext:Oe,useCallback:function(e,t){return Ve().memoizedState=[e,t===void 0?null:t],e},useContext:Oe,useEffect:tu,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hr(4194308,4,sc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hr(4,2,e,t)},useMemo:function(e,t){var n=Ve();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ve();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=tp.bind(null,V,e),[r.memoizedState,e]},useRef:function(e){var t=Ve();return e={current:e},t.memoizedState=e},useState:eu,useDebugValue:ql,useDeferredValue:function(e){return Ve().memoizedState=e},useTransition:function(){var e=eu(!1),t=e[0];return e=ep.bind(null,e[1]),Ve().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=V,i=Ve();if(U){if(n===void 0)throw Error(w(407));n=n()}else{if(n=t(),ee===null)throw Error(w(349));Ft&30||ba(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,tu(tc.bind(null,r,o,e),[e]),r.flags|=2048,lr(9,ec.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ve(),t=ee.identifierPrefix;if(U){var n=Ze,r=Ge;n=(r&~(1<<32-Be(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=l.createElement(n,{is:r.is}):(e=l.createElement(n),n==="select"&&(l=e,r.multiple?l.multiple=!0:r.size&&(l.size=r.size))):e=l.createElementNS(e,n),e[He]=t,e[tr]=r,Cc(e,t,!1,!1),t.stateNode=e;e:{switch(l=No(n,r),n){case"dialog":B("cancel",e),B("close",e),i=r;break;case"iframe":case"object":case"embed":B("load",e),i=r;break;case"video":case"audio":for(i=0;ign&&(t.flags|=128,r=!0,Pn(o,!1),t.lanes=4194304)}else{if(!r)if(e=pi(l),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Pn(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!U)return le(t),null}else 2*K()-o.renderingStartTime>gn&&n!==1073741824&&(t.flags|=128,r=!0,Pn(o,!1),t.lanes=4194304);o.isBackwards?(l.sibling=t.child,t.child=l):(n=o.last,n!==null?n.sibling=l:t.child=l,o.last=l)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=K(),t.sibling=null,n=$.current,j($,r?n&1|2:n&1),t):(le(t),null);case 22:case 23:return es(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ve&1073741824&&(le(t),t.subtreeFlags&6&&(t.flags|=8192)):le(t),null;case 24:return null;case 25:return null}throw Error(w(156,t.tag))}function fp(e,t){switch(Dl(t),t.tag){case 1:return ye(t.type)&&li(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return mn(),F(me),F(ue),Hl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Vl(t),null;case 13:if(F($),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(w(340));pn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return F($),null;case 4:return mn(),null;case 10:return Bl(t.type._context),null;case 22:case 23:return es(),null;case 24:return null;default:return null}}var Or=!1,se=!1,dp=typeof WeakSet=="function"?WeakSet:Set,_=null;function nn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){W(e,t,r)}else n.current=null}function bo(e,t,n){try{n()}catch(r){W(e,t,r)}}var du=!1;function pp(e,t){if(Mo=ni,e=za(),zl(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var l=0,s=-1,u=-1,c=0,h=0,m=e,p=null;t:for(;;){for(var g;m!==n||i!==0&&m.nodeType!==3||(s=l+i),m!==o||r!==0&&m.nodeType!==3||(u=l+r),m.nodeType===3&&(l+=m.nodeValue.length),(g=m.firstChild)!==null;)p=m,m=g;for(;;){if(m===e)break t;if(p===n&&++c===i&&(s=l),p===o&&++h===r&&(u=l),(g=m.nextSibling)!==null)break;m=p,p=m.parentNode}m=g}n=s===-1||u===-1?null:{start:s,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(jo={focusedElem:e,selectionRange:n},ni=!1,_=t;_!==null;)if(t=_,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,_=e;else for(;_!==null;){t=_;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var k=y.memoizedProps,D=y.memoizedState,f=t.stateNode,a=f.getSnapshotBeforeUpdate(t.elementType===t.type?k:De(t.type,k),D);f.__reactInternalSnapshotBeforeUpdate=a}break;case 3:var d=t.stateNode.containerInfo;d.nodeType===1?d.textContent="":d.nodeType===9&&d.documentElement&&d.removeChild(d.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(w(163))}}catch(v){W(t,t.return,v)}if(e=t.sibling,e!==null){e.return=t.return,_=e;break}_=t.return}return y=du,du=!1,y}function Vn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&bo(t,n,o)}i=i.next}while(i!==r)}}function Ri(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function el(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Pc(e){var t=e.alternate;t!==null&&(e.alternate=null,Pc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[He],delete t[tr],delete t[Uo],delete t[Xd],delete t[Jd])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Oc(e){return e.tag===5||e.tag===3||e.tag===4}function pu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Oc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function tl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=oi));else if(r!==4&&(e=e.child,e!==null))for(tl(e,t,n),e=e.sibling;e!==null;)tl(e,t,n),e=e.sibling}function nl(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(nl(e,t,n),e=e.sibling;e!==null;)nl(e,t,n),e=e.sibling}var te=null,Ie=!1;function st(e,t,n){for(n=n.child;n!==null;)Rc(e,t,n),n=n.sibling}function Rc(e,t,n){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(Ei,n)}catch{}switch(n.tag){case 5:se||nn(n,t);case 6:var r=te,i=Ie;te=null,st(e,t,n),te=r,Ie=i,te!==null&&(Ie?(e=te,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):te.removeChild(n.stateNode));break;case 18:te!==null&&(Ie?(e=te,n=n.stateNode,e.nodeType===8?to(e.parentNode,n):e.nodeType===1&&to(e,n),Jn(e)):to(te,n.stateNode));break;case 4:r=te,i=Ie,te=n.stateNode.containerInfo,Ie=!0,st(e,t,n),te=r,Ie=i;break;case 0:case 11:case 14:case 15:if(!se&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&bo(n,t,l),i=i.next}while(i!==r)}st(e,t,n);break;case 1:if(!se&&(nn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){W(n,t,s)}st(e,t,n);break;case 21:st(e,t,n);break;case 22:n.mode&1?(se=(r=se)||n.memoizedState!==null,st(e,t,n),se=r):st(e,t,n);break;default:st(e,t,n)}}function hu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new dp),t.forEach(function(r){var i=Ep.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ae(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=l),r&=~o}if(r=i,r=K()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*mp(r/1960))-r,10e?16:e,ht===null)var r=!1;else{if(e=ht,ht=null,vi=0,I&6)throw Error(w(331));var i=I;for(I|=4,_=e.current;_!==null;){var o=_,l=o.child;if(_.flags&16){var s=o.deletions;if(s!==null){for(var u=0;uK()-Zl?It(e,0):Gl|=n),ge(e,t)}function Bc(e,t){t===0&&(e.mode&1?(t=kr,kr<<=1,!(kr&130023424)&&(kr=4194304)):t=1);var n=ce();e=nt(e,t),e!==null&&(ar(e,t,n),ge(e,n))}function Sp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bc(e,n)}function Ep(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(w(314))}r!==null&&r.delete(t),Bc(e,n)}var Fc;Fc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||me.current)he=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return he=!1,ap(e,t,n);he=!!(e.flags&131072)}else he=!1,U&&t.flags&1048576&&Ha(t,ai,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wr(e,t),e=t.pendingProps;var i=dn(t,ue.current);an(t,n),i=Ql(null,t,r,e,i,n);var o=Kl();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ye(r)?(o=!0,si(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Ul(t),i.updater=Oi,t.stateNode=i,i._reactInternals=t,Ko(t,r,e,n),t=Xo(null,t,r,!0,o,n)):(t.tag=0,U&&o&&Al(t),ae(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wr(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=xp(r),e=De(r,e),i){case 0:t=qo(null,t,r,e,n);break e;case 1:t=au(null,t,r,e,n);break e;case 11:t=su(null,t,r,e,n);break e;case 14:t=uu(null,t,r,De(r.type,e),n);break e}throw Error(w(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:De(r,i),qo(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:De(r,i),au(e,t,r,i,n);case 3:e:{if(Ec(t),e===null)throw Error(w(387));r=t.pendingProps,o=t.memoizedState,i=o.element,Xa(e,t),di(t,r,null,n);var l=t.memoizedState;if(r=l.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=yn(Error(w(423)),t),t=cu(e,t,r,n,i);break e}else if(r!==i){i=yn(Error(w(424)),t),t=cu(e,t,r,n,i);break e}else for(we=vt(t.stateNode.containerInfo.firstChild),ke=t,U=!0,je=null,n=Ya(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(pn(),r===i){t=rt(e,t,n);break e}ae(e,t,r,n)}t=t.child}return t;case 5:return Ja(t),e===null&&Ho(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,l=i.children,Bo(r,i)?l=null:o!==null&&Bo(r,o)&&(t.flags|=32),Sc(e,t),ae(e,t,l,n),t.child;case 6:return e===null&&Ho(t),null;case 13:return _c(e,t,n);case 4:return $l(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hn(t,null,r,n):ae(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:De(r,i),su(e,t,r,i,n);case 7:return ae(e,t,t.pendingProps,n),t.child;case 8:return ae(e,t,t.pendingProps.children,n),t.child;case 12:return ae(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,l=i.value,j(ci,r._currentValue),r._currentValue=l,o!==null)if(Ue(o.value,l)){if(o.children===i.children&&!me.current){t=rt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){l=o.child;for(var u=s.firstContext;u!==null;){if(u.context===r){if(o.tag===1){u=be(-1,n&-n),u.tag=2;var c=o.updateQueue;if(c!==null){c=c.shared;var h=c.pending;h===null?u.next=u:(u.next=h.next,h.next=u),c.pending=u}}o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Wo(o.return,n,t),s.lanes|=n;break}u=u.next}}else if(o.tag===10)l=o.type===t.type?null:o.child;else if(o.tag===18){if(l=o.return,l===null)throw Error(w(341));l.lanes|=n,s=l.alternate,s!==null&&(s.lanes|=n),Wo(l,n,t),l=o.sibling}else l=o.child;if(l!==null)l.return=o;else for(l=o;l!==null;){if(l===t){l=null;break}if(o=l.sibling,o!==null){o.return=l.return,l=o;break}l=l.return}o=l}ae(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,an(t,n),i=Oe(i),r=r(i),t.flags|=1,ae(e,t,r,n),t.child;case 14:return r=t.type,i=De(r,t.pendingProps),i=De(r.type,i),uu(e,t,r,i,n);case 15:return wc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:De(r,i),Wr(e,t),t.tag=1,ye(r)?(e=!0,si(t)):e=!1,an(t,n),yc(t,r,i),Ko(t,r,i,n),Xo(null,t,r,!0,e,n);case 19:return xc(e,t,n);case 22:return kc(e,t,n)}throw Error(w(156,t.tag))};function Uc(e,t){return pa(e,t)}function _p(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Te(e,t,n,r){return new _p(e,t,n,r)}function ns(e){return e=e.prototype,!(!e||!e.isReactComponent)}function xp(e){if(typeof e=="function")return ns(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Sl)return 11;if(e===El)return 14}return 2}function Et(e,t){var n=e.alternate;return n===null?(n=Te(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Yr(e,t,n,r,i,o){var l=2;if(r=e,typeof e=="function")ns(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case Yt:return Mt(n.children,i,o,t);case kl:l=8,i|=8;break;case yo:return e=Te(12,n,t,i|2),e.elementType=yo,e.lanes=o,e;case go:return e=Te(13,n,t,i),e.elementType=go,e.lanes=o,e;case vo:return e=Te(19,n,t,i),e.elementType=vo,e.lanes=o,e;case Ju:return zi(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case qu:l=10;break e;case Xu:l=9;break e;case Sl:l=11;break e;case El:l=14;break e;case at:l=16,r=null;break e}throw Error(w(130,e==null?e:typeof e,""))}return t=Te(l,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Mt(e,t,n,r){return e=Te(7,e,r,t),e.lanes=n,e}function zi(e,t,n,r){return e=Te(22,e,r,t),e.elementType=Ju,e.lanes=n,e.stateNode={isHidden:!1},e}function ao(e,t,n){return e=Te(6,e,null,t),e.lanes=n,e}function co(e,t,n){return t=Te(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Cp(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wi(0),this.expirationTimes=Wi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wi(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function rs(e,t,n,r,i,o,l,s,u){return e=new Cp(e,t,n,s,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Te(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ul(o),e}function Np(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Wc)}catch(e){console.error(e)}}Wc(),Wu.exports=Ee;var Lp=Wu.exports,Eu=Lp;ho.createRoot=Eu.createRoot,ho.hydrateRoot=Eu.hydrateRoot;const Ye=Object.create(null);Ye.open="0";Ye.close="1";Ye.ping="2";Ye.pong="3";Ye.message="4";Ye.upgrade="5";Ye.noop="6";const qr=Object.create(null);Object.keys(Ye).forEach(e=>{qr[Ye[e]]=e});const sl={type:"error",data:"parser error"},Qc=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Kc=typeof ArrayBuffer=="function",Yc=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ss=({type:e,data:t},n,r)=>Qc&&t instanceof Blob?n?r(t):_u(t,r):Kc&&(t instanceof ArrayBuffer||Yc(t))?n?r(t):_u(new Blob([t]),r):r(Ye[e]+(t||"")),_u=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function xu(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let fo;function zp(e,t){if(Qc&&e.data instanceof Blob)return e.data.arrayBuffer().then(xu).then(t);if(Kc&&(e.data instanceof ArrayBuffer||Yc(e.data)))return t(xu(e.data));ss(e,!1,n=>{fo||(fo=new TextEncoder),t(fo.encode(n))})}const Cu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",In=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,l,s,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const c=new ArrayBuffer(t),h=new Uint8Array(c);for(r=0;r>4,h[i++]=(l&15)<<4|s>>2,h[i++]=(s&3)<<6|u&63;return c},Dp=typeof ArrayBuffer=="function",us=(e,t)=>{if(typeof e!="string")return{type:"message",data:qc(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Ip(e.substring(1),t)}:qr[n]?e.length>1?{type:qr[n],data:e.substring(1)}:{type:qr[n]}:sl},Ip=(e,t)=>{if(Dp){const n=Ap(e);return qc(n,t)}else return{base64:!0,data:e}},qc=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Xc="",Mp=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,l)=>{ss(o,!1,s=>{r[l]=s,++i===n&&t(r.join(Xc))})})},jp=(e,t)=>{const n=e.split(Xc),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let po;function zr(e){return e.reduce((t,n)=>t+n.length,0)}function Ar(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,21)-1){s.enqueue(sl);break}i=h*Math.pow(2,32)+c.getUint32(4),r=3}else{if(zr(n)e){s.enqueue(sl);break}}}})}const Jc=4;function q(e){if(e)return Up(e)}function Up(e){for(var t in q.prototype)e[t]=q.prototype[t];return e}q.prototype.on=q.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};q.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};q.prototype.off=q.prototype.removeListener=q.prototype.removeAllListeners=q.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const $p=Ne.setTimeout,Vp=Ne.clearTimeout;function ji(e,t){t.useNativeTimers?(e.setTimeoutFn=$p.bind(Ne),e.clearTimeoutFn=Vp.bind(Ne)):(e.setTimeoutFn=Ne.setTimeout.bind(Ne),e.clearTimeoutFn=Ne.clearTimeout.bind(Ne))}const Hp=1.33;function Wp(e){return typeof e=="string"?Qp(e):Math.ceil((e.byteLength||e.size)*Hp)}function Qp(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function Kp(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Yp(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function bc(){const e=Pu(+new Date);return e!==Tu?(Nu=0,Tu=e):e+"."+Pu(Nu++)}for(;Dr{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};jp(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Mp(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=bc()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Ke(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class Ke extends q{constructor(t,n){super(),ji(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=Gc(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new tf(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=Ke.requestsCount++,Ke.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=Gp,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Ke.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}Ke.requestsCount=0;Ke.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ou);else if(typeof addEventListener=="function"){const e="onpagehide"in Ne?"pagehide":"unload";addEventListener(e,Ou,!1)}}function Ou(){for(let e in Ke.requests)Ke.requests.hasOwnProperty(e)&&Ke.requests[e].abort()}const cs=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ir=Ne.WebSocket||Ne.MozWebSocket,Ru=!0,eh="arraybuffer",Lu=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class th extends as{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=Lu?{}:Gc(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=Ru&&!Lu?n?new Ir(t,n):new Ir(t):new Ir(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const l={};try{Ru&&this.ws.send(o)}catch{}i&&cs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=bc()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!Ir}}class nh extends as{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=Fp(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=Bp();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:u})=>{s||(this.onPacket(u),o())}).catch(s=>{})};o();const l={type:"open"};this.query.sid&&(l.data=`{"sid":"${this.query.sid}"}`),this.writer.write(l).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&cs(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const rh={websocket:th,webtransport:nh,polling:bp},ih=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,oh=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function al(e){if(e.length>2e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=ih.exec(e||""),o={},l=14;for(;l--;)o[oh[l]]=i[l]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=lh(o,o.path),o.queryKey=sh(o,o.query),o}function lh(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function sh(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let nf=class Qt extends q{constructor(t,n={}){super(),this.binaryType=eh,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=al(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=al(n.host).host),ji(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Yp(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=Jc,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new rh[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Qt.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Qt.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",m=>{if(!r)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Qt.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(h(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const p=new Error("probe error");p.transport=n.name,this.emitReserved("upgradeError",p)}}))};function o(){r||(r=!0,h(),n.close(),n=null)}const l=m=>{const p=new Error("probe error: "+m);p.transport=n.name,o(),this.emitReserved("upgradeError",p)};function s(){l("transport closed")}function u(){l("socket closed")}function c(m){n&&m.name!==n.name&&o()}const h=()=>{n.removeListener("open",i),n.removeListener("error",l),n.removeListener("close",s),this.off("close",u),this.off("upgrading",c)};n.once("open",i),n.once("error",l),n.once("close",s),this.once("close",u),this.once("upgrading",c),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Qt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Qt.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,rf=Object.prototype.toString,fh=typeof Blob=="function"||typeof Blob<"u"&&rf.call(Blob)==="[object BlobConstructor]",dh=typeof File=="function"||typeof File<"u"&&rf.call(File)==="[object FileConstructor]";function fs(e){return ah&&(e instanceof ArrayBuffer||ch(e))||fh&&e instanceof Blob||dh&&e instanceof File}function Xr(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let s=0;s{this.io.clearTimeoutFn(o),n.apply(this,s)};l.withError=!0,this.acks[t]=l}emitWithAck(t,...n){return new Promise((r,i)=>{const o=(l,s)=>l?i(l):r(s);o.withError=!0,n.push(o),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:A.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case A.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case A.EVENT:case A.BINARY_EVENT:this.onevent(t);break;case A.ACK:case A.BINARY_ACK:this.onack(t);break;case A.DISCONNECT:this.ondisconnect();break;case A.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:A.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:A.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Sn.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Sn.prototype.reset=function(){this.attempts=0};Sn.prototype.setMin=function(e){this.ms=e};Sn.prototype.setMax=function(e){this.max=e};Sn.prototype.setJitter=function(e){this.jitter=e};class dl extends q{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,ji(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Sn({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||wh;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new nf(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Me(n,"open",function(){r.onopen(),t&&t()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},l=Me(n,"error",o);if(this._timeout!==!1){const s=this._timeout,u=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(i),this.subs.push(l),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Me(t,"ping",this.onping.bind(this)),Me(t,"data",this.ondata.bind(this)),Me(t,"error",this.onerror.bind(this)),Me(t,"close",this.onclose.bind(this)),Me(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){cs(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new of(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Rn={};function Jr(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=uh(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,l=Rn[i]&&o in Rn[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||l;let u;return s?u=new dl(r,t):(Rn[i]||(Rn[i]=new dl(r,t)),u=Rn[i]),n.query&&!t.query&&(t.query=n.queryKey),u.socket(n.path,t)}Object.assign(Jr,{Manager:dl,Socket:of,io:Jr,connect:Jr});async function Sh(e){const t="https://kundesone.no/api/chat/getMessages";try{const n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chat_id:e})});if(!n.ok)throw new Error("Network response was not ok");const r=await n.json();return console.log(r),r.map(i=>({sender:i.senderName||"Unknown Sender",content:i.message||"",contentType:i.type,type:i.from=="user"?"user":"partner"}))}catch(n){return console.error("Error:",n),[]}}function Eh({socket:e,toggleChat:t}){const[n,r]=X.useState(""),[i,o]=X.useState(!1),[l,s]=X.useState(!1);X.useState(!1);const[u,c]=X.useState([]),[h,m]=X.useState("");X.useEffect(()=>{var g=localStorage.getItem("aw_chat");return g&&(g=JSON.parse(g),r("company name"),s(g),Sh(g.id).then(y=>{c(y)}),console.log(g)),e.on("connect",()=>{console.log("Connected to the server with socket ID:",e.id);var y=localStorage.getItem("aw_customer_id");y||(y=generateRandomId(),localStorage.setItem("aw_customer_id",y),o(y)),e.emit("register",y),console.log(y)}),e.on("disconnect",y=>{console.log("Disconnected from the server:",y),o(!1),y==="io server disconnect"&&e.connect()}),e.on("chat message",y=>{console.log(y);const k={sender:"ADNAN HASSAN",content:y.sms,contentType:"text",type:"partner"};c(D=>[...D,k])}),()=>{e.off("connect"),e.off("disconnect"),e.off("chat message")}},[]);const p=()=>{if(h.trim()==="")return;const g={sender:"ADNAN HASSAN",content:h,contentType:"text",type:"user"},y=new FormData;y.append("chat_id",l.id),y.append("from","user"),y.append("message",h),y.append("type","text"),fetch("https://kundesone.no/api/chat/send-message",{method:"POST",body:y}).then(D=>D.json()).then(D=>{console.log("Success:",D),e.emit("chat message",{sms:h,id:l.id},l.user_id),c([...u,g]),m("")}).catch(D=>{console.error("Error:",D)})};return P.jsx("div",{className:"chat-messages",children:P.jsx("div",{className:"chatbox-holder",children:P.jsxs("div",{className:"chatbox",children:[P.jsxs("div",{className:"chatbox-top",children:[P.jsxs("div",{className:"chat-partner-name",children:[P.jsx("span",{className:"status online"}),P.jsx("a",{children:n})]}),P.jsx("div",{className:"chatbox-icons",children:P.jsx("a",{href:"javascript:void(0);",onClick:t,children:P.jsx("i",{className:"fa fa-close"})})})]}),P.jsx("div",{className:"chat-messages",children:u.map((g,y)=>P.jsx("div",{className:`message-box-holder ${g.type==="partner"?"partner":"user"}`,children:P.jsxs("div",{className:`message-box ${g.type==="partner"?"message-partner":""}`,children:[g.contentType==="text"&&g.content,g.contentType==="image"&&P.jsx("img",{src:g.content,alt:"Image message"}),g.contentType==="pdf"&&P.jsx("a",{href:g.content,target:"_blank",rel:"noopener noreferrer",children:"View PDF"})]})},y))}),P.jsxs("div",{className:"chat-input-holder",children:[P.jsx("textarea",{className:"chat-input",value:h,onChange:g=>m(g.target.value),placeholder:"Write something...."}),P.jsxs("label",{className:"file-input-label",children:[P.jsx("input",{type:"file",className:"file-input"}),P.jsx("i",{className:"fa fa-paperclip","aria-hidden":"true"})]}),P.jsx("input",{type:"submit",value:"Send",onClick:p,className:"message-send"})]})]})})})}const ut=Jr("https://chat.rapidev.tech/",{withCredentials:!1});function _h(){const[e,t]=X.useState(!1),[n,r]=X.useState(!1),[i,o]=X.useState(!1),[l,s]=X.useState(""),[u,c]=X.useState(""),[h,m]=X.useState(""),[p,g]=X.useState(!1),[y,k]=X.useState({}),[D,f]=X.useState([]),a=()=>t(!e),d=T=>s(T.target.value),v=T=>c(T.target.value),E=T=>m(T.target.value),x=T=>g(T.target.checked);ut.on("connect",()=>{console.log("Connected to the server with socket ID:",ut.id);var T=localStorage.getItem("aw_customer_id");T||(T=xh(),localStorage.setItem("aw_customer_id",T),r(T)),ut.emit("register",T),console.log(T)}),ut.on("disconnect",T=>{console.log("Disconnected from the server:",T),r(!1),T==="io server disconnect"&&ut.connect()}),X.useEffect(()=>{var T=localStorage.getItem("aw_chat");if(T){T=JSON.parse(T);const L="https://kundesone.no/api/chat/get",ie=new FormData;ie.append("chat_id",T.id),fetch(L,{method:"POST",body:ie}).then(Le=>Le.json()).then(Le=>{Le.status=="open"&&o(!0),console.log("Success:",Le)})}});const C=()=>{const T={};return l.trim()||(T.username="Username is required"),u.trim()?/\S+@\S+\.\S+/.test(u)||(T.email="Email is invalid"):T.email="Email is required",h.trim()||(T.message="Message is required"),p||(T.acceptPolicy="You must accept the policy"),T},N=()=>{const T=C();if(Object.keys(T).length===0){const ie={username:l,text:h},ot=document.getElementById("aw-root-chat").dataset.company,qe=new FormData;qe.append("company_id",ot),qe.append("customer_id",n),qe.append("name",l),qe.append("email",u),qe.append("subject",h);var L={company_id:ot,customer_id:n,name:l,email:u,subject:h};ut.emit("start_chat",L),fetch("https://kundesone.no/api/chat/start",{method:"POST",body:qe}).then(ze=>ze.json()).then(ze=>{console.log("Success:",ze);var lt=ze.chat;localStorage.setItem("aw_chat",JSON.stringify(ze.chat));const S=new FormData;S.append("chat_id",lt.id),S.append("from","user"),S.append("message",lt.subject),S.append("type","text"),fetch("https://kundesone.no/api/chat/send-message",{method:"POST",body:S}).then(R=>R.json()).then(R=>{console.log("Success:",R),ut.emit("chat message",lt.subject,lt.user_id),f([...D,ie]),o(!0),s(""),c(""),m(""),g(!1),k({})})}).catch(ze=>{console.error("Error:",ze)})}else k(T)};return P.jsxs("div",{className:"chat-widget",children:[P.jsx("button",{onClick:a,className:"toggle-button",children:e?P.jsx("i",{className:"fa fa-times","aria-hidden":"true"}):P.jsx("span",{className:"chat__box",children:P.jsx("i",{className:"fa fa-commenting-o","aria-hidden":"true"})})}),e&&P.jsx("div",{className:"chat-box",children:i?P.jsx(Eh,{socket:ut,toggleChat:a}):P.jsxs("div",{className:"message-box",children:[P.jsx("div",{className:"media",children:P.jsx("h4",{children:"Limon Media"})}),P.jsx("label",{htmlFor:"Username",children:"Username"}),P.jsx("input",{type:"text",value:l,onChange:d,placeholder:"Username"}),y.username&&P.jsx("p",{className:"error",children:y.username}),P.jsx("label",{htmlFor:"Email",children:"Email"}),P.jsx("input",{type:"email",value:u,onChange:v,placeholder:"Email"}),y.email&&P.jsx("p",{className:"error",children:y.email}),P.jsx("label",{htmlFor:"Message",children:"Message"}),P.jsx("textarea",{value:h,onChange:E,placeholder:"Type your message here..."}),y.message&&P.jsx("p",{className:"error",children:y.message}),P.jsxs("div",{className:"policy-box",children:[P.jsx("input",{type:"checkbox",checked:p,onChange:x}),P.jsx("label",{children:"Jeg har lest policy for personopplysninger. "})]}),y.acceptPolicy&&P.jsx("p",{className:"error",children:y.acceptPolicy}),P.jsx("button",{onClick:N,children:"Start en chat"})]})})]})}function xh(){function e(i){let o=0;for(let l=0;lP.jsx(P.Fragment,{children:P.jsx("div",{className:"App",children:P.jsx(_h,{})})});ho.createRoot(document.getElementById("aw-root-chat")).render(P.jsx(Ch,{}));