const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.esm-OyK67d2L.js","./index.esm2017-opiC1jOd.js","./index.esm-CmzND2QD.js","./DiceBoard.component-Dbt9S-uU.js","./DiceBoard-CJ3uYzGw.css"])))=>i.map(i=>d[i]);
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var ASe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function RSe(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function n(){var a=!1;try{a=this instanceof n}catch{}return a?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var a=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:function(){return t[n]}})}),r}var ww={exports:{}},kh={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var CD;function W8(){if(CD)return kh;CD=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function r(n,a,i){var o=null;if(i!==void 0&&(o=""+i),a.key!==void 0&&(o=""+a.key),"key"in a){i={};for(var c in a)c!=="key"&&(i[c]=a[c])}else i=a;return a=i.ref,{$$typeof:t,type:n,key:o,ref:a!==void 0?a:null,props:i}}return kh.Fragment=e,kh.jsx=r,kh.jsxs=r,kh}var xD;function K8(){return xD||(xD=1,ww.exports=W8()),ww.exports}var g=K8(),Sw={exports:{}},rr={};/**
 * @license React
 * react.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var PD;function Y8(){if(PD)return rr;PD=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),i=Symbol.for("react.consumer"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),h=Symbol.for("react.activity"),m=Symbol.iterator;function _(B){return B===null||typeof B!="object"?null:(B=m&&B[m]||B["@@iterator"],typeof B=="function"?B:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,E={};function T(B,K,ae){this.props=B,this.context=K,this.refs=E,this.updater=ae||w}T.prototype.isReactComponent={},T.prototype.setState=function(B,K){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,K,"setState")},T.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function R(){}R.prototype=T.prototype;function P(B,K,ae){this.props=B,this.context=K,this.refs=E,this.updater=ae||w}var A=P.prototype=new R;A.constructor=P,b(A,T.prototype),A.isPureReactComponent=!0;var C=Array.isArray;function O(){}var I={H:null,A:null,T:null,S:null},x=Object.prototype.hasOwnProperty;function D(B,K,ae){var te=ae.ref;return{$$typeof:t,type:B,key:K,ref:te!==void 0?te:null,props:ae}}function N(B,K){return D(B.type,K,B.props)}function L(B){return typeof B=="object"&&B!==null&&B.$$typeof===t}function j(B){var K={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(ae){return K[ae]})}var q=/\/+/g;function U(B,K){return typeof B=="object"&&B!==null&&B.key!=null?j(""+B.key):K.toString(36)}function W(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(O,O):(B.status="pending",B.then(function(K){B.status==="pending"&&(B.status="fulfilled",B.value=K)},function(K){B.status==="pending"&&(B.status="rejected",B.reason=K)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function F(B,K,ae,te,me){var ue=typeof B;(ue==="undefined"||ue==="boolean")&&(B=null);var Ae=!1;if(B===null)Ae=!0;else switch(ue){case"bigint":case"string":case"number":Ae=!0;break;case"object":switch(B.$$typeof){case t:case e:Ae=!0;break;case f:return Ae=B._init,F(Ae(B._payload),K,ae,te,me)}}if(Ae)return me=me(B),Ae=te===""?"."+U(B,0):te,C(me)?(ae="",Ae!=null&&(ae=Ae.replace(q,"$&/")+"/"),F(me,K,ae,"",function(xe){return xe})):me!=null&&(L(me)&&(me=N(me,ae+(me.key==null||B&&B.key===me.key?"":(""+me.key).replace(q,"$&/")+"/")+Ae)),K.push(me)),1;Ae=0;var He=te===""?".":te+":";if(C(B))for(var ce=0;ce<B.length;ce++)te=B[ce],ue=He+U(te,ce),Ae+=F(te,K,ae,ue,me);else if(ce=_(B),typeof ce=="function")for(B=ce.call(B),ce=0;!(te=B.next()).done;)te=te.value,ue=He+U(te,ce++),Ae+=F(te,K,ae,ue,me);else if(ue==="object"){if(typeof B.then=="function")return F(W(B),K,ae,te,me);throw K=String(B),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Ae}function Y(B,K,ae){if(B==null)return B;var te=[],me=0;return F(B,te,"","",function(ue){return K.call(ae,ue,me++)}),te}function Q(B){if(B._status===-1){var K=B._result;K=K(),K.then(function(ae){(B._status===0||B._status===-1)&&(B._status=1,B._result=ae)},function(ae){(B._status===0||B._status===-1)&&(B._status=2,B._result=ae)}),B._status===-1&&(B._status=0,B._result=K)}if(B._status===1)return B._result.default;throw B._result}var ie=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}},G={map:Y,forEach:function(B,K,ae){Y(B,function(){K.apply(this,arguments)},ae)},count:function(B){var K=0;return Y(B,function(){K++}),K},toArray:function(B){return Y(B,function(K){return K})||[]},only:function(B){if(!L(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return rr.Activity=h,rr.Children=G,rr.Component=T,rr.Fragment=r,rr.Profiler=a,rr.PureComponent=P,rr.StrictMode=n,rr.Suspense=u,rr.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,rr.__COMPILER_RUNTIME={__proto__:null,c:function(B){return I.H.useMemoCache(B)}},rr.cache=function(B){return function(){return B.apply(null,arguments)}},rr.cacheSignal=function(){return null},rr.cloneElement=function(B,K,ae){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var te=b({},B.props),me=B.key;if(K!=null)for(ue in K.key!==void 0&&(me=""+K.key),K)!x.call(K,ue)||ue==="key"||ue==="__self"||ue==="__source"||ue==="ref"&&K.ref===void 0||(te[ue]=K[ue]);var ue=arguments.length-2;if(ue===1)te.children=ae;else if(1<ue){for(var Ae=Array(ue),He=0;He<ue;He++)Ae[He]=arguments[He+2];te.children=Ae}return D(B.type,me,te)},rr.createContext=function(B){return B={$$typeof:o,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:i,_context:B},B},rr.createElement=function(B,K,ae){var te,me={},ue=null;if(K!=null)for(te in K.key!==void 0&&(ue=""+K.key),K)x.call(K,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(me[te]=K[te]);var Ae=arguments.length-2;if(Ae===1)me.children=ae;else if(1<Ae){for(var He=Array(Ae),ce=0;ce<Ae;ce++)He[ce]=arguments[ce+2];me.children=He}if(B&&B.defaultProps)for(te in Ae=B.defaultProps,Ae)me[te]===void 0&&(me[te]=Ae[te]);return D(B,ue,me)},rr.createRef=function(){return{current:null}},rr.forwardRef=function(B){return{$$typeof:c,render:B}},rr.isValidElement=L,rr.lazy=function(B){return{$$typeof:f,_payload:{_status:-1,_result:B},_init:Q}},rr.memo=function(B,K){return{$$typeof:d,type:B,compare:K===void 0?null:K}},rr.startTransition=function(B){var K=I.T,ae={};I.T=ae;try{var te=B(),me=I.S;me!==null&&me(ae,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(O,ie)}catch(ue){ie(ue)}finally{K!==null&&ae.types!==null&&(K.types=ae.types),I.T=K}},rr.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},rr.use=function(B){return I.H.use(B)},rr.useActionState=function(B,K,ae){return I.H.useActionState(B,K,ae)},rr.useCallback=function(B,K){return I.H.useCallback(B,K)},rr.useContext=function(B){return I.H.useContext(B)},rr.useDebugValue=function(){},rr.useDeferredValue=function(B,K){return I.H.useDeferredValue(B,K)},rr.useEffect=function(B,K){return I.H.useEffect(B,K)},rr.useEffectEvent=function(B){return I.H.useEffectEvent(B)},rr.useId=function(){return I.H.useId()},rr.useImperativeHandle=function(B,K,ae){return I.H.useImperativeHandle(B,K,ae)},rr.useInsertionEffect=function(B,K){return I.H.useInsertionEffect(B,K)},rr.useLayoutEffect=function(B,K){return I.H.useLayoutEffect(B,K)},rr.useMemo=function(B,K){return I.H.useMemo(B,K)},rr.useOptimistic=function(B,K){return I.H.useOptimistic(B,K)},rr.useReducer=function(B,K,ae){return I.H.useReducer(B,K,ae)},rr.useRef=function(B){return I.H.useRef(B)},rr.useState=function(B){return I.H.useState(B)},rr.useSyncExternalStore=function(B,K,ae){return I.H.useSyncExternalStore(B,K,ae)},rr.useTransition=function(){return I.H.useTransition()},rr.version="19.2.0",rr}var AD;function sx(){return AD||(AD=1,Sw.exports=Y8()),Sw.exports}var v=sx();const Tt=wg(v);var Ew={exports:{}},wh={},Tw={exports:{}},Cw={};/**
 * @license React
 * scheduler.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var RD;function X8(){return RD||(RD=1,(function(t){function e(F,Y){var Q=F.length;F.push(Y);e:for(;0<Q;){var ie=Q-1>>>1,G=F[ie];if(0<a(G,Y))F[ie]=Y,F[Q]=G,Q=ie;else break e}}function r(F){return F.length===0?null:F[0]}function n(F){if(F.length===0)return null;var Y=F[0],Q=F.pop();if(Q!==Y){F[0]=Q;e:for(var ie=0,G=F.length,B=G>>>1;ie<B;){var K=2*(ie+1)-1,ae=F[K],te=K+1,me=F[te];if(0>a(ae,Q))te<G&&0>a(me,ae)?(F[ie]=me,F[te]=Q,ie=te):(F[ie]=ae,F[K]=Q,ie=K);else if(te<G&&0>a(me,Q))F[ie]=me,F[te]=Q,ie=te;else break e}}return Y}function a(F,Y){var Q=F.sortIndex-Y.sortIndex;return Q!==0?Q:F.id-Y.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,c=o.now();t.unstable_now=function(){return o.now()-c}}var u=[],d=[],f=1,h=null,m=3,_=!1,w=!1,b=!1,E=!1,T=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;function A(F){for(var Y=r(d);Y!==null;){if(Y.callback===null)n(d);else if(Y.startTime<=F)n(d),Y.sortIndex=Y.expirationTime,e(u,Y);else break;Y=r(d)}}function C(F){if(b=!1,A(F),!w)if(r(u)!==null)w=!0,O||(O=!0,j());else{var Y=r(d);Y!==null&&W(C,Y.startTime-F)}}var O=!1,I=-1,x=5,D=-1;function N(){return E?!0:!(t.unstable_now()-D<x)}function L(){if(E=!1,O){var F=t.unstable_now();D=F;var Y=!0;try{e:{w=!1,b&&(b=!1,R(I),I=-1),_=!0;var Q=m;try{t:{for(A(F),h=r(u);h!==null&&!(h.expirationTime>F&&N());){var ie=h.callback;if(typeof ie=="function"){h.callback=null,m=h.priorityLevel;var G=ie(h.expirationTime<=F);if(F=t.unstable_now(),typeof G=="function"){h.callback=G,A(F),Y=!0;break t}h===r(u)&&n(u),A(F)}else n(u);h=r(u)}if(h!==null)Y=!0;else{var B=r(d);B!==null&&W(C,B.startTime-F),Y=!1}}break e}finally{h=null,m=Q,_=!1}Y=void 0}}finally{Y?j():O=!1}}}var j;if(typeof P=="function")j=function(){P(L)};else if(typeof MessageChannel<"u"){var q=new MessageChannel,U=q.port2;q.port1.onmessage=L,j=function(){U.postMessage(null)}}else j=function(){T(L,0)};function W(F,Y){I=T(function(){F(t.unstable_now())},Y)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(F){F.callback=null},t.unstable_forceFrameRate=function(F){0>F||125<F||(x=0<F?Math.floor(1e3/F):5)},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_next=function(F){switch(m){case 1:case 2:case 3:var Y=3;break;default:Y=m}var Q=m;m=Y;try{return F()}finally{m=Q}},t.unstable_requestPaint=function(){E=!0},t.unstable_runWithPriority=function(F,Y){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var Q=m;m=F;try{return Y()}finally{m=Q}},t.unstable_scheduleCallback=function(F,Y,Q){var ie=t.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?ie+Q:ie):Q=ie,F){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=Q+G,F={id:f++,callback:Y,priorityLevel:F,startTime:Q,expirationTime:G,sortIndex:-1},Q>ie?(F.sortIndex=Q,e(d,F),r(u)===null&&F===r(d)&&(b?(R(I),I=-1):b=!0,W(C,Q-ie))):(F.sortIndex=G,e(u,F),w||_||(w=!0,O||(O=!0,j()))),F},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(F){var Y=m;return function(){var Q=m;m=Y;try{return F.apply(this,arguments)}finally{m=Q}}}})(Cw)),Cw}var DD;function J8(){return DD||(DD=1,Tw.exports=X8()),Tw.exports}var xw={exports:{}},Na={};/**
 * @license React
 * react-dom.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var OD;function Q8(){if(OD)return Na;OD=1;var t=sx();function e(u){var d="https://react.dev/errors/"+u;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var f=2;f<arguments.length;f++)d+="&args[]="+encodeURIComponent(arguments[f])}return"Minified React error #"+u+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var n={d:{f:r,r:function(){throw Error(e(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for("react.portal");function i(u,d,f){var h=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:h==null?null:""+h,children:u,containerInfo:d,implementation:f}}var o=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,d){if(u==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Na.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Na.createPortal=function(u,d){var f=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return i(u,d,null,f)},Na.flushSync=function(u){var d=o.T,f=n.p;try{if(o.T=null,n.p=2,u)return u()}finally{o.T=d,n.p=f,n.d.f()}},Na.preconnect=function(u,d){typeof u=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(u,d))},Na.prefetchDNS=function(u){typeof u=="string"&&n.d.D(u)},Na.preinit=function(u,d){if(typeof u=="string"&&d&&typeof d.as=="string"){var f=d.as,h=c(f,d.crossOrigin),m=typeof d.integrity=="string"?d.integrity:void 0,_=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;f==="style"?n.d.S(u,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:h,integrity:m,fetchPriority:_}):f==="script"&&n.d.X(u,{crossOrigin:h,integrity:m,fetchPriority:_,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Na.preinitModule=function(u,d){if(typeof u=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var f=c(d.as,d.crossOrigin);n.d.M(u,{crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(u)},Na.preload=function(u,d){if(typeof u=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var f=d.as,h=c(f,d.crossOrigin);n.d.L(u,f,{crossOrigin:h,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Na.preloadModule=function(u,d){if(typeof u=="string")if(d){var f=c(d.as,d.crossOrigin);n.d.m(u,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:f,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(u)},Na.requestFormReset=function(u){n.d.r(u)},Na.unstable_batchedUpdates=function(u,d){return u(d)},Na.useFormState=function(u,d,f){return o.H.useFormState(u,d,f)},Na.useFormStatus=function(){return o.H.useHostTransitionStatus()},Na.version="19.2.0",Na}var ND;function JL(){if(ND)return xw.exports;ND=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch{}}return t(),xw.exports=Q8(),xw.exports}/**
 * @license React
 * react-dom-client.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var ID;function Z8(){if(ID)return wh;ID=1;var t=J8(),e=sx(),r=JL();function n(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)l+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function i(s){var l=s,p=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(p=l.return),s=l.return;while(s)}return l.tag===3?p:null}function o(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function c(s){if(s.tag===31){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function u(s){if(i(s)!==s)throw Error(n(188))}function d(s){var l=s.alternate;if(!l){if(l=i(s),l===null)throw Error(n(188));return l!==s?null:s}for(var p=s,y=l;;){var k=p.return;if(k===null)break;var S=k.alternate;if(S===null){if(y=k.return,y!==null){p=y;continue}break}if(k.child===S.child){for(S=k.child;S;){if(S===p)return u(k),s;if(S===y)return u(k),l;S=S.sibling}throw Error(n(188))}if(p.return!==y.return)p=k,y=S;else{for(var M=!1,V=k.child;V;){if(V===p){M=!0,p=k,y=S;break}if(V===y){M=!0,y=k,p=S;break}V=V.sibling}if(!M){for(V=S.child;V;){if(V===p){M=!0,p=S,y=k;break}if(V===y){M=!0,y=S,p=k;break}V=V.sibling}if(!M)throw Error(n(189))}}if(p.alternate!==y)throw Error(n(190))}if(p.tag!==3)throw Error(n(188));return p.stateNode.current===p?s:l}function f(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=f(s),l!==null)return l;s=s.sibling}return null}var h=Object.assign,m=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),T=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),P=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),D=Symbol.for("react.activity"),N=Symbol.for("react.memo_cache_sentinel"),L=Symbol.iterator;function j(s){return s===null||typeof s!="object"?null:(s=L&&s[L]||s["@@iterator"],typeof s=="function"?s:null)}var q=Symbol.for("react.client.reference");function U(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===q?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case b:return"Fragment";case T:return"Profiler";case E:return"StrictMode";case C:return"Suspense";case O:return"SuspenseList";case D:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case w:return"Portal";case P:return s.displayName||"Context";case R:return(s._context.displayName||"Context")+".Consumer";case A:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case I:return l=s.displayName||null,l!==null?l:U(s.type)||"Memo";case x:l=s._payload,s=s._init;try{return U(s(l))}catch{}}return null}var W=Array.isArray,F=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},ie=[],G=-1;function B(s){return{current:s}}function K(s){0>G||(s.current=ie[G],ie[G]=null,G--)}function ae(s,l){G++,ie[G]=s.current,s.current=l}var te=B(null),me=B(null),ue=B(null),Ae=B(null);function He(s,l){switch(ae(ue,l),ae(me,s),ae(te,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?Y2(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=Y2(l),s=X2(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}K(te),ae(te,s)}function ce(){K(te),K(me),K(ue)}function xe(s){s.memoizedState!==null&&ae(Ae,s);var l=te.current,p=X2(l,s.type);l!==p&&(ae(me,s),ae(te,p))}function re(s){me.current===s&&(K(te),K(me)),Ae.current===s&&(K(Ae),yh._currentValue=Q)}var H,he;function Re(s){if(H===void 0)try{throw Error()}catch(p){var l=p.stack.trim().match(/\n( *(at )?)/);H=l&&l[1]||"",he=-1<p.stack.indexOf(`
    at`)?" (<anonymous>)":-1<p.stack.indexOf("@")?"@unknown:0:0":""}return`
`+H+s+he}var fe=!1;function Ie(s,l){if(!s||fe)return"";fe=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var y={DetermineComponentFrameRoot:function(){try{if(l){var Ge=function(){throw Error()};if(Object.defineProperty(Ge.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ge,[])}catch(Ne){var Pe=Ne}Reflect.construct(s,[],Ge)}else{try{Ge.call()}catch(Ne){Pe=Ne}s.call(Ge.prototype)}}else{try{throw Error()}catch(Ne){Pe=Ne}(Ge=s())&&typeof Ge.catch=="function"&&Ge.catch(function(){})}}catch(Ne){if(Ne&&Pe&&typeof Ne.stack=="string")return[Ne.stack,Pe.stack]}return[null,null]}};y.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var k=Object.getOwnPropertyDescriptor(y.DetermineComponentFrameRoot,"name");k&&k.configurable&&Object.defineProperty(y.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=y.DetermineComponentFrameRoot(),M=S[0],V=S[1];if(M&&V){var oe=M.split(`
`),Te=V.split(`
`);for(k=y=0;y<oe.length&&!oe[y].includes("DetermineComponentFrameRoot");)y++;for(;k<Te.length&&!Te[k].includes("DetermineComponentFrameRoot");)k++;if(y===oe.length||k===Te.length)for(y=oe.length-1,k=Te.length-1;1<=y&&0<=k&&oe[y]!==Te[k];)k--;for(;1<=y&&0<=k;y--,k--)if(oe[y]!==Te[k]){if(y!==1||k!==1)do if(y--,k--,0>k||oe[y]!==Te[k]){var Ue=`
`+oe[y].replace(" at new "," at ");return s.displayName&&Ue.includes("<anonymous>")&&(Ue=Ue.replace("<anonymous>",s.displayName)),Ue}while(1<=y&&0<=k);break}}}finally{fe=!1,Error.prepareStackTrace=p}return(p=s?s.displayName||s.name:"")?Re(p):""}function ct(s,l){switch(s.tag){case 26:case 27:case 5:return Re(s.type);case 16:return Re("Lazy");case 13:return s.child!==l&&l!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("SuspenseList");case 0:case 15:return Ie(s.type,!1);case 11:return Ie(s.type.render,!1);case 1:return Ie(s.type,!0);case 31:return Re("Activity");default:return""}}function $e(s){try{var l="",p=null;do l+=ct(s,p),p=s,s=s.return;while(s);return l}catch(y){return`
Error generating stack: `+y.message+`
`+y.stack}}var tt=Object.prototype.hasOwnProperty,We=t.unstable_scheduleCallback,it=t.unstable_cancelCallback,Et=t.unstable_shouldYield,Mt=t.unstable_requestPaint,_t=t.unstable_now,ge=t.unstable_getCurrentPriorityLevel,Be=t.unstable_ImmediatePriority,je=t.unstable_UserBlockingPriority,rt=t.unstable_NormalPriority,Ct=t.unstable_LowPriority,jt=t.unstable_IdlePriority,De=t.log,nt=t.unstable_setDisableYieldValue,at=null,we=null;function st(s){if(typeof De=="function"&&nt(s),we&&typeof we.setStrictMode=="function")try{we.setStrictMode(at,s)}catch{}}var bt=Math.clz32?Math.clz32:dr,nr=Math.log,ur=Math.LN2;function dr(s){return s>>>=0,s===0?32:31-(nr(s)/ur|0)|0}var Sr=256,un=262144,Z=4194304;function X(s){var l=s&42;if(l!==0)return l;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function le(s,l,p){var y=s.pendingLanes;if(y===0)return 0;var k=0,S=s.suspendedLanes,M=s.pingedLanes;s=s.warmLanes;var V=y&134217727;return V!==0?(y=V&~S,y!==0?k=X(y):(M&=V,M!==0?k=X(M):p||(p=V&~s,p!==0&&(k=X(p))))):(V=y&~S,V!==0?k=X(V):M!==0?k=X(M):p||(p=y&~s,p!==0&&(k=X(p)))),k===0?0:l!==0&&l!==k&&(l&S)===0&&(S=k&-k,p=l&-l,S>=p||S===32&&(p&4194048)!==0)?l:k}function be(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function z(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+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 l+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 ee(){var s=Z;return Z<<=1,(Z&62914560)===0&&(Z=4194304),s}function se(s){for(var l=[],p=0;31>p;p++)l.push(s);return l}function Oe(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function wt(s,l,p,y,k,S){var M=s.pendingLanes;s.pendingLanes=p,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=p,s.entangledLanes&=p,s.errorRecoveryDisabledLanes&=p,s.shellSuspendCounter=0;var V=s.entanglements,oe=s.expirationTimes,Te=s.hiddenUpdates;for(p=M&~p;0<p;){var Ue=31-bt(p),Ge=1<<Ue;V[Ue]=0,oe[Ue]=-1;var Pe=Te[Ue];if(Pe!==null)for(Te[Ue]=null,Ue=0;Ue<Pe.length;Ue++){var Ne=Pe[Ue];Ne!==null&&(Ne.lane&=-536870913)}p&=~Ge}y!==0&&er(s,y,0),S!==0&&k===0&&s.tag!==0&&(s.suspendedLanes|=S&~(M&~l))}function er(s,l,p){s.pendingLanes|=l,s.suspendedLanes&=~l;var y=31-bt(l);s.entangledLanes|=l,s.entanglements[y]=s.entanglements[y]|1073741824|p&261930}function Qt(s,l){var p=s.entangledLanes|=l;for(s=s.entanglements;p;){var y=31-bt(p),k=1<<y;k&l|s[y]&l&&(s[y]|=l),p&=~k}}function Zt(s,l){var p=l&-l;return p=(p&42)!==0?1:oa(p),(p&(s.suspendedLanes|l))!==0?0:p}function oa(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function On(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Ye(){var s=Y.p;return s!==0?s:(s=window.event,s===void 0?32:_D(s.type))}function Yt(s,l){var p=Y.p;try{return Y.p=s,l()}finally{Y.p=p}}var At=Math.random().toString(36).slice(2),Rt="__reactFiber$"+At,Dt="__reactProps$"+At,Nn="__reactContainer$"+At,dn="__reactEvents$"+At,jr="__reactListeners$"+At,Ra="__reactHandles$"+At,oo="__reactResources$"+At,pn="__reactMarker$"+At;function ec(s){delete s[Rt],delete s[Dt],delete s[dn],delete s[jr],delete s[Ra]}function zi(s){var l=s[Rt];if(l)return l;for(var p=s.parentNode;p;){if(l=p[Nn]||p[Rt]){if(p=l.alternate,l.child!==null||p!==null&&p.child!==null)for(s=nD(s);s!==null;){if(p=s[Rt])return p;s=nD(s)}return l}s=p,p=s.parentNode}return null}function Ts(s){if(s=s[Rt]||s[Nn]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function _i(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function Qn(s){var l=s[oo];return l||(l=s[oo]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function hn(s){s[pn]=!0}var Cs=new Set,xs={};function Ps(s,l){$i(s,l),$i(s+"Capture",l)}function $i(s,l){for(xs[s]=l,s=0;s<l.length;s++)Cs.add(l[s])}var jp=RegExp("^[: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]*$"),bd={},kd={};function Lp(s){return tt.call(kd,s)?!0:tt.call(bd,s)?!1:jp.test(s)?kd[s]=!0:(bd[s]=!0,!1)}function tc(s,l,p){if(Lp(l))if(p===null)s.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var y=l.toLowerCase().slice(0,5);if(y!=="data-"&&y!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+p)}}function co(s,l,p){if(p===null)s.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+p)}}function ma(s,l,p,y){if(y===null)s.removeAttribute(p);else{switch(typeof y){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(p);return}s.setAttributeNS(l,p,""+y)}}function ga(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Ba(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Kc(s,l,p){var y=Object.getOwnPropertyDescriptor(s.constructor.prototype,l);if(!s.hasOwnProperty(l)&&typeof y<"u"&&typeof y.get=="function"&&typeof y.set=="function"){var k=y.get,S=y.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return k.call(this)},set:function(M){p=""+M,S.call(this,M)}}),Object.defineProperty(s,l,{enumerable:y.enumerable}),{getValue:function(){return p},setValue:function(M){p=""+M},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function yu(s){if(!s._valueTracker){var l=Ba(s)?"checked":"value";s._valueTracker=Kc(s,l,""+s[l])}}function Yc(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var p=l.getValue(),y="";return s&&(y=Ba(s)?s.checked?"true":"false":s.value),s=y,s!==p?(l.setValue(s),!0):!1}function lo(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var wd=/[\n"\\]/g;function ca(s){return s.replace(wd,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function uo(s,l,p,y,k,S,M,V){s.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?s.type=M:s.removeAttribute("type"),l!=null?M==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+ga(l)):s.value!==""+ga(l)&&(s.value=""+ga(l)):M!=="submit"&&M!=="reset"||s.removeAttribute("value"),l!=null?Xc(s,M,ga(l)):p!=null?Xc(s,M,ga(p)):y!=null&&s.removeAttribute("value"),k==null&&S!=null&&(s.defaultChecked=!!S),k!=null&&(s.checked=k&&typeof k!="function"&&typeof k!="symbol"),V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?s.name=""+ga(V):s.removeAttribute("name")}function bi(s,l,p,y,k,S,M,V){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(s.type=S),l!=null||p!=null){if(!(S!=="submit"&&S!=="reset"||l!=null)){yu(s);return}p=p!=null?""+ga(p):"",l=l!=null?""+ga(l):p,V||l===s.value||(s.value=l),s.defaultValue=l}y=y??k,y=typeof y!="function"&&typeof y!="symbol"&&!!y,s.checked=V?s.checked:!!y,s.defaultChecked=!!y,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(s.name=M),yu(s)}function Xc(s,l,p){l==="number"&&lo(s.ownerDocument)===s||s.defaultValue===""+p||(s.defaultValue=""+p)}function _e(s,l,p,y){if(s=s.options,l){l={};for(var k=0;k<p.length;k++)l["$"+p[k]]=!0;for(p=0;p<s.length;p++)k=l.hasOwnProperty("$"+s[p].value),s[p].selected!==k&&(s[p].selected=k),k&&y&&(s[p].defaultSelected=!0)}else{for(p=""+ga(p),l=null,k=0;k<s.length;k++){if(s[k].value===p){s[k].selected=!0,y&&(s[k].defaultSelected=!0);return}l!==null||s[k].disabled||(l=s[k])}l!==null&&(l.selected=!0)}}function Ze(s,l,p){if(l!=null&&(l=""+ga(l),l!==s.value&&(s.value=l),p==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=p!=null?""+ga(p):""}function ot(s,l,p,y){if(l==null){if(y!=null){if(p!=null)throw Error(n(92));if(W(y)){if(1<y.length)throw Error(n(93));y=y[0]}p=y}p==null&&(p=""),l=p}p=ga(l),s.defaultValue=p,y=s.textContent,y===p&&y!==""&&y!==null&&(s.value=y),yu(s)}function Je(s,l){if(l){var p=s.firstChild;if(p&&p===s.lastChild&&p.nodeType===3){p.nodeValue=l;return}}s.textContent=l}var Nt=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function $t(s,l,p){var y=l.indexOf("--")===0;p==null||typeof p=="boolean"||p===""?y?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":y?s.setProperty(l,p):typeof p!="number"||p===0||Nt.has(l)?l==="float"?s.cssFloat=p:s[l]=(""+p).trim():s[l]=p+"px"}function Or(s,l,p){if(l!=null&&typeof l!="object")throw Error(n(62));if(s=s.style,p!=null){for(var y in p)!p.hasOwnProperty(y)||l!=null&&l.hasOwnProperty(y)||(y.indexOf("--")===0?s.setProperty(y,""):y==="float"?s.cssFloat="":s[y]="");for(var k in l)y=l[k],l.hasOwnProperty(k)&&p[k]!==y&&$t(s,k,y)}else for(var S in l)l.hasOwnProperty(S)&&$t(s,S,l[S])}function rn(s){if(s.indexOf("-")===-1)return!1;switch(s){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 Tn=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),la=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function As(s){return la.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function ya(){}var Jc=null;function Rs(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ki=null,wi=null;function Vi(s){var l=Ts(s);if(l&&(s=l.stateNode)){var p=s[Dt]||null;e:switch(s=l.stateNode,l.type){case"input":if(uo(s,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name),l=p.name,p.type==="radio"&&l!=null){for(p=s;p.parentNode;)p=p.parentNode;for(p=p.querySelectorAll('input[name="'+ca(""+l)+'"][type="radio"]'),l=0;l<p.length;l++){var y=p[l];if(y!==s&&y.form===s.form){var k=y[Dt]||null;if(!k)throw Error(n(90));uo(y,k.value,k.defaultValue,k.defaultValue,k.checked,k.defaultChecked,k.type,k.name)}}for(l=0;l<p.length;l++)y=p[l],y.form===s.form&&Yc(y)}break e;case"textarea":Ze(s,p.value,p.defaultValue);break e;case"select":l=p.value,l!=null&&_e(s,!!p.multiple,l,!1)}}}var fo=!1;function Lr(s,l,p){if(fo)return s(l,p);fo=!0;try{var y=s(l);return y}finally{if(fo=!1,(ki!==null||wi!==null)&&(Oy(),ki&&(l=ki,s=wi,wi=ki=null,Vi(l),s)))for(l=0;l<s.length;l++)Vi(s[l])}}function Zn(s,l){var p=s.stateNode;if(p===null)return null;var y=p[Dt]||null;if(y===null)return null;p=y[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(y=!y.disabled)||(s=s.type,y=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!y;break e;default:s=!1}if(s)return null;if(p&&typeof p!="function")throw Error(n(231,l,typeof p));return p}var ea=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ua=!1;if(ea)try{var Da={};Object.defineProperty(Da,"passive",{get:function(){Ua=!0}}),window.addEventListener("test",Da,Da),window.removeEventListener("test",Da,Da)}catch{Ua=!1}var ta=null,Fn=null,Hi=null;function rc(){if(Hi)return Hi;var s,l=Fn,p=l.length,y,k="value"in ta?ta.value:ta.textContent,S=k.length;for(s=0;s<p&&l[s]===k[s];s++);var M=p-s;for(y=1;y<=M&&l[p-y]===k[S-y];y++);return Hi=k.slice(s,1<y?1-y:void 0)}function Sd(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function Ed(){return!0}function Kg(){return!1}function Oa(s){function l(p,y,k,S,M){this._reactName=p,this._targetInst=k,this.type=y,this.nativeEvent=S,this.target=M,this.currentTarget=null;for(var V in s)s.hasOwnProperty(V)&&(p=s[V],this[V]=p?p(S):S[V]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?Ed:Kg,this.isPropagationStopped=Kg,this}return h(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var p=this.nativeEvent;p&&(p.preventDefault?p.preventDefault():typeof p.returnValue!="unknown"&&(p.returnValue=!1),this.isDefaultPrevented=Ed)},stopPropagation:function(){var p=this.nativeEvent;p&&(p.stopPropagation?p.stopPropagation():typeof p.cancelBubble!="unknown"&&(p.cancelBubble=!0),this.isPropagationStopped=Ed)},persist:function(){},isPersistent:Ed}),l}var nc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ac=Oa(nc),Qc=h({},nc,{view:0,detail:0}),C0=Oa(Qc),Zc,J,pe,ye=h({},Qc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fa,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==pe&&(pe&&s.type==="mousemove"?(Zc=s.screenX-pe.screenX,J=s.screenY-pe.screenY):J=Zc=0,pe=s),Zc)},movementY:function(s){return"movementY"in s?s.movementY:J}}),Me=Oa(ye),Se=h({},ye,{dataTransfer:0}),Ve=Oa(Se),Qe=h({},Qc,{relatedTarget:0}),gt=Oa(Qe),Er=h({},nc,{animationName:0,elapsedTime:0,pseudoElement:0}),nn=Oa(Er),fr=h({},nc,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),an=Oa(fr),Ds=h({},nc,{data:0}),ic=Oa(Ds),vu={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gi={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Td={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yg(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=Td[s])?!!l[s]:!1}function Fa(){return Yg}var el=h({},Qc,{key:function(s){if(s.key){var l=vu[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=Sd(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Gi[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fa,charCode:function(s){return s.type==="keypress"?Sd(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Sd(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Xg=Oa(el),x0=h({},ye,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),e1=Oa(x0),o$=h({},Qc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fa}),c$=Oa(o$),l$=h({},nc,{propertyName:0,elapsedTime:0,pseudoElement:0}),u$=Oa(l$),d$=h({},ye,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),f$=Oa(d$),p$=h({},nc,{newState:0,oldState:0}),h$=Oa(p$),m$=[9,13,27,32],P0=ea&&"CompositionEvent"in window,Bp=null;ea&&"documentMode"in document&&(Bp=document.documentMode);var g$=ea&&"TextEvent"in window&&!Bp,t1=ea&&(!P0||Bp&&8<Bp&&11>=Bp),r1=" ",n1=!1;function a1(s,l){switch(s){case"keyup":return m$.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function i1(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Cd=!1;function y$(s,l){switch(s){case"compositionend":return i1(l);case"keypress":return l.which!==32?null:(n1=!0,r1);case"textInput":return s=l.data,s===r1&&n1?null:s;default:return null}}function v$(s,l){if(Cd)return s==="compositionend"||!P0&&a1(s,l)?(s=rc(),Hi=Fn=ta=null,Cd=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return t1&&l.locale!=="ko"?null:l.data;default:return null}}var _$={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function s1(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!_$[s.type]:l==="textarea"}function o1(s,l,p,y){ki?wi?wi.push(y):wi=[y]:ki=y,l=Uy(l,"onChange"),0<l.length&&(p=new ac("onChange","change",null,p,y),s.push({event:p,listeners:l}))}var Up=null,Fp=null;function b$(s){$2(s,0)}function Jg(s){var l=_i(s);if(Yc(l))return s}function c1(s,l){if(s==="change")return l}var l1=!1;if(ea){var A0;if(ea){var R0="oninput"in document;if(!R0){var u1=document.createElement("div");u1.setAttribute("oninput","return;"),R0=typeof u1.oninput=="function"}A0=R0}else A0=!1;l1=A0&&(!document.documentMode||9<document.documentMode)}function d1(){Up&&(Up.detachEvent("onpropertychange",f1),Fp=Up=null)}function f1(s){if(s.propertyName==="value"&&Jg(Fp)){var l=[];o1(l,Fp,s,Rs(s)),Lr(b$,l)}}function k$(s,l,p){s==="focusin"?(d1(),Up=l,Fp=p,Up.attachEvent("onpropertychange",f1)):s==="focusout"&&d1()}function w$(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Jg(Fp)}function S$(s,l){if(s==="click")return Jg(l)}function E$(s,l){if(s==="input"||s==="change")return Jg(l)}function T$(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var Si=typeof Object.is=="function"?Object.is:T$;function qp(s,l){if(Si(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var p=Object.keys(s),y=Object.keys(l);if(p.length!==y.length)return!1;for(y=0;y<p.length;y++){var k=p[y];if(!tt.call(l,k)||!Si(s[k],l[k]))return!1}return!0}function p1(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function h1(s,l){var p=p1(s);s=0;for(var y;p;){if(p.nodeType===3){if(y=s+p.textContent.length,s<=l&&y>=l)return{node:p,offset:l-s};s=y}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=p1(p)}}function m1(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?m1(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function g1(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=lo(s.document);l instanceof s.HTMLIFrameElement;){try{var p=typeof l.contentWindow.location.href=="string"}catch{p=!1}if(p)s=l.contentWindow;else break;l=lo(s.document)}return l}function D0(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}var C$=ea&&"documentMode"in document&&11>=document.documentMode,xd=null,O0=null,zp=null,N0=!1;function y1(s,l,p){var y=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;N0||xd==null||xd!==lo(y)||(y=xd,"selectionStart"in y&&D0(y)?y={start:y.selectionStart,end:y.selectionEnd}:(y=(y.ownerDocument&&y.ownerDocument.defaultView||window).getSelection(),y={anchorNode:y.anchorNode,anchorOffset:y.anchorOffset,focusNode:y.focusNode,focusOffset:y.focusOffset}),zp&&qp(zp,y)||(zp=y,y=Uy(O0,"onSelect"),0<y.length&&(l=new ac("onSelect","select",null,l,p),s.push({event:l,listeners:y}),l.target=xd)))}function _u(s,l){var p={};return p[s.toLowerCase()]=l.toLowerCase(),p["Webkit"+s]="webkit"+l,p["Moz"+s]="moz"+l,p}var Pd={animationend:_u("Animation","AnimationEnd"),animationiteration:_u("Animation","AnimationIteration"),animationstart:_u("Animation","AnimationStart"),transitionrun:_u("Transition","TransitionRun"),transitionstart:_u("Transition","TransitionStart"),transitioncancel:_u("Transition","TransitionCancel"),transitionend:_u("Transition","TransitionEnd")},I0={},v1={};ea&&(v1=document.createElement("div").style,"AnimationEvent"in window||(delete Pd.animationend.animation,delete Pd.animationiteration.animation,delete Pd.animationstart.animation),"TransitionEvent"in window||delete Pd.transitionend.transition);function bu(s){if(I0[s])return I0[s];if(!Pd[s])return s;var l=Pd[s],p;for(p in l)if(l.hasOwnProperty(p)&&p in v1)return I0[s]=l[p];return s}var _1=bu("animationend"),b1=bu("animationiteration"),k1=bu("animationstart"),x$=bu("transitionrun"),P$=bu("transitionstart"),A$=bu("transitioncancel"),w1=bu("transitionend"),S1=new Map,M0="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");M0.push("scrollEnd");function Os(s,l){S1.set(s,l),Ps(l,[s])}var Qg=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}},Wi=[],Ad=0,j0=0;function Zg(){for(var s=Ad,l=j0=Ad=0;l<s;){var p=Wi[l];Wi[l++]=null;var y=Wi[l];Wi[l++]=null;var k=Wi[l];Wi[l++]=null;var S=Wi[l];if(Wi[l++]=null,y!==null&&k!==null){var M=y.pending;M===null?k.next=k:(k.next=M.next,M.next=k),y.pending=k}S!==0&&E1(p,k,S)}}function ey(s,l,p,y){Wi[Ad++]=s,Wi[Ad++]=l,Wi[Ad++]=p,Wi[Ad++]=y,j0|=y,s.lanes|=y,s=s.alternate,s!==null&&(s.lanes|=y)}function L0(s,l,p,y){return ey(s,l,p,y),ty(s)}function ku(s,l){return ey(s,null,null,l),ty(s)}function E1(s,l,p){s.lanes|=p;var y=s.alternate;y!==null&&(y.lanes|=p);for(var k=!1,S=s.return;S!==null;)S.childLanes|=p,y=S.alternate,y!==null&&(y.childLanes|=p),S.tag===22&&(s=S.stateNode,s===null||s._visibility&1||(k=!0)),s=S,S=S.return;return s.tag===3?(S=s.stateNode,k&&l!==null&&(k=31-bt(p),s=S.hiddenUpdates,y=s[k],y===null?s[k]=[l]:y.push(l),l.lane=p|536870912),S):null}function ty(s){if(50<uh)throw uh=0,Gk=null,Error(n(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var Rd={};function R$(s,l,p,y){this.tag=s,this.key=p,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=y,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ei(s,l,p,y){return new R$(s,l,p,y)}function B0(s){return s=s.prototype,!(!s||!s.isReactComponent)}function sc(s,l){var p=s.alternate;return p===null?(p=Ei(s.tag,l,s.key,s.mode),p.elementType=s.elementType,p.type=s.type,p.stateNode=s.stateNode,p.alternate=s,s.alternate=p):(p.pendingProps=l,p.type=s.type,p.flags=0,p.subtreeFlags=0,p.deletions=null),p.flags=s.flags&65011712,p.childLanes=s.childLanes,p.lanes=s.lanes,p.child=s.child,p.memoizedProps=s.memoizedProps,p.memoizedState=s.memoizedState,p.updateQueue=s.updateQueue,l=s.dependencies,p.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},p.sibling=s.sibling,p.index=s.index,p.ref=s.ref,p.refCleanup=s.refCleanup,p}function T1(s,l){s.flags&=65011714;var p=s.alternate;return p===null?(s.childLanes=0,s.lanes=l,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=p.childLanes,s.lanes=p.lanes,s.child=p.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=p.memoizedProps,s.memoizedState=p.memoizedState,s.updateQueue=p.updateQueue,s.type=p.type,l=p.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function ry(s,l,p,y,k,S){var M=0;if(y=s,typeof s=="function")B0(s)&&(M=1);else if(typeof s=="string")M=M8(s,p,te.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case D:return s=Ei(31,p,l,k),s.elementType=D,s.lanes=S,s;case b:return wu(p.children,k,S,l);case E:M=8,k|=24;break;case T:return s=Ei(12,p,l,k|2),s.elementType=T,s.lanes=S,s;case C:return s=Ei(13,p,l,k),s.elementType=C,s.lanes=S,s;case O:return s=Ei(19,p,l,k),s.elementType=O,s.lanes=S,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case P:M=10;break e;case R:M=9;break e;case A:M=11;break e;case I:M=14;break e;case x:M=16,y=null;break e}M=29,p=Error(n(130,s===null?"null":typeof s,"")),y=null}return l=Ei(M,p,l,k),l.elementType=s,l.type=y,l.lanes=S,l}function wu(s,l,p,y){return s=Ei(7,s,y,l),s.lanes=p,s}function U0(s,l,p){return s=Ei(6,s,null,l),s.lanes=p,s}function C1(s){var l=Ei(18,null,null,0);return l.stateNode=s,l}function F0(s,l,p){return l=Ei(4,s.children!==null?s.children:[],s.key,l),l.lanes=p,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var x1=new WeakMap;function Ki(s,l){if(typeof s=="object"&&s!==null){var p=x1.get(s);return p!==void 0?p:(l={value:s,source:l,stack:$e(l)},x1.set(s,l),l)}return{value:s,source:l,stack:$e(l)}}var Dd=[],Od=0,ny=null,$p=0,Yi=[],Xi=0,tl=null,po=1,ho="";function oc(s,l){Dd[Od++]=$p,Dd[Od++]=ny,ny=s,$p=l}function P1(s,l,p){Yi[Xi++]=po,Yi[Xi++]=ho,Yi[Xi++]=tl,tl=s;var y=po;s=ho;var k=32-bt(y)-1;y&=~(1<<k),p+=1;var S=32-bt(l)+k;if(30<S){var M=k-k%5;S=(y&(1<<M)-1).toString(32),y>>=M,k-=M,po=1<<32-bt(l)+k|p<<k|y,ho=S+s}else po=1<<S|p<<k|y,ho=s}function q0(s){s.return!==null&&(oc(s,1),P1(s,1,0))}function z0(s){for(;s===ny;)ny=Dd[--Od],Dd[Od]=null,$p=Dd[--Od],Dd[Od]=null;for(;s===tl;)tl=Yi[--Xi],Yi[Xi]=null,ho=Yi[--Xi],Yi[Xi]=null,po=Yi[--Xi],Yi[Xi]=null}function A1(s,l){Yi[Xi++]=po,Yi[Xi++]=ho,Yi[Xi++]=tl,po=l.id,ho=l.overflow,tl=s}var va=null,mn=null,Tr=!1,rl=null,Ji=!1,$0=Error(n(519));function nl(s){var l=Error(n(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Vp(Ki(l,s)),$0}function R1(s){var l=s.stateNode,p=s.type,y=s.memoizedProps;switch(l[Rt]=s,l[Dt]=y,p){case"dialog":yr("cancel",l),yr("close",l);break;case"iframe":case"object":case"embed":yr("load",l);break;case"video":case"audio":for(p=0;p<fh.length;p++)yr(fh[p],l);break;case"source":yr("error",l);break;case"img":case"image":case"link":yr("error",l),yr("load",l);break;case"details":yr("toggle",l);break;case"input":yr("invalid",l),bi(l,y.value,y.defaultValue,y.checked,y.defaultChecked,y.type,y.name,!0);break;case"select":yr("invalid",l);break;case"textarea":yr("invalid",l),ot(l,y.value,y.defaultValue,y.children)}p=y.children,typeof p!="string"&&typeof p!="number"&&typeof p!="bigint"||l.textContent===""+p||y.suppressHydrationWarning===!0||W2(l.textContent,p)?(y.popover!=null&&(yr("beforetoggle",l),yr("toggle",l)),y.onScroll!=null&&yr("scroll",l),y.onScrollEnd!=null&&yr("scrollend",l),y.onClick!=null&&(l.onclick=ya),l=!0):l=!1,l||nl(s,!0)}function D1(s){for(va=s.return;va;)switch(va.tag){case 5:case 31:case 13:Ji=!1;return;case 27:case 3:Ji=!0;return;default:va=va.return}}function Nd(s){if(s!==va)return!1;if(!Tr)return D1(s),Tr=!0,!1;var l=s.tag,p;if((p=l!==3&&l!==27)&&((p=l===5)&&(p=s.type,p=!(p!=="form"&&p!=="button")||ow(s.type,s.memoizedProps)),p=!p),p&&mn&&nl(s),D1(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));mn=rD(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));mn=rD(s)}else l===27?(l=mn,yl(s.type)?(s=fw,fw=null,mn=s):mn=l):mn=va?Zi(s.stateNode.nextSibling):null;return!0}function Su(){mn=va=null,Tr=!1}function V0(){var s=rl;return s!==null&&(ei===null?ei=s:ei.push.apply(ei,s),rl=null),s}function Vp(s){rl===null?rl=[s]:rl.push(s)}var H0=B(null),Eu=null,cc=null;function al(s,l,p){ae(H0,l._currentValue),l._currentValue=p}function lc(s){s._currentValue=H0.current,K(H0)}function G0(s,l,p){for(;s!==null;){var y=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,y!==null&&(y.childLanes|=l)):y!==null&&(y.childLanes&l)!==l&&(y.childLanes|=l),s===p)break;s=s.return}}function W0(s,l,p,y){var k=s.child;for(k!==null&&(k.return=s);k!==null;){var S=k.dependencies;if(S!==null){var M=k.child;S=S.firstContext;e:for(;S!==null;){var V=S;S=k;for(var oe=0;oe<l.length;oe++)if(V.context===l[oe]){S.lanes|=p,V=S.alternate,V!==null&&(V.lanes|=p),G0(S.return,p,s),y||(M=null);break e}S=V.next}}else if(k.tag===18){if(M=k.return,M===null)throw Error(n(341));M.lanes|=p,S=M.alternate,S!==null&&(S.lanes|=p),G0(M,p,s),M=null}else M=k.child;if(M!==null)M.return=k;else for(M=k;M!==null;){if(M===s){M=null;break}if(k=M.sibling,k!==null){k.return=M.return,M=k;break}M=M.return}k=M}}function Id(s,l,p,y){s=null;for(var k=l,S=!1;k!==null;){if(!S){if((k.flags&524288)!==0)S=!0;else if((k.flags&262144)!==0)break}if(k.tag===10){var M=k.alternate;if(M===null)throw Error(n(387));if(M=M.memoizedProps,M!==null){var V=k.type;Si(k.pendingProps.value,M.value)||(s!==null?s.push(V):s=[V])}}else if(k===Ae.current){if(M=k.alternate,M===null)throw Error(n(387));M.memoizedState.memoizedState!==k.memoizedState.memoizedState&&(s!==null?s.push(yh):s=[yh])}k=k.return}s!==null&&W0(l,s,p,y),l.flags|=262144}function ay(s){for(s=s.firstContext;s!==null;){if(!Si(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Tu(s){Eu=s,cc=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function _a(s){return O1(Eu,s)}function iy(s,l){return Eu===null&&Tu(s),O1(s,l)}function O1(s,l){var p=l._currentValue;if(l={context:l,memoizedValue:p,next:null},cc===null){if(s===null)throw Error(n(308));cc=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else cc=cc.next=l;return p}var D$=typeof AbortController<"u"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(p,y){s.push(y)}};this.abort=function(){l.aborted=!0,s.forEach(function(p){return p()})}},O$=t.unstable_scheduleCallback,N$=t.unstable_NormalPriority,qn={$$typeof:P,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function K0(){return{controller:new D$,data:new Map,refCount:0}}function Hp(s){s.refCount--,s.refCount===0&&O$(N$,function(){s.controller.abort()})}var Gp=null,Y0=0,Md=0,jd=null;function I$(s,l){if(Gp===null){var p=Gp=[];Y0=0,Md=Qk(),jd={status:"pending",value:void 0,then:function(y){p.push(y)}}}return Y0++,l.then(N1,N1),l}function N1(){if(--Y0===0&&Gp!==null){jd!==null&&(jd.status="fulfilled");var s=Gp;Gp=null,Md=0,jd=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function M$(s,l){var p=[],y={status:"pending",value:null,reason:null,then:function(k){p.push(k)}};return s.then(function(){y.status="fulfilled",y.value=l;for(var k=0;k<p.length;k++)(0,p[k])(l)},function(k){for(y.status="rejected",y.reason=k,k=0;k<p.length;k++)(0,p[k])(void 0)}),y}var I1=F.S;F.S=function(s,l){y2=_t(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&I$(s,l),I1!==null&&I1(s,l)};var Cu=B(null);function X0(){var s=Cu.current;return s!==null?s:sn.pooledCache}function sy(s,l){l===null?ae(Cu,Cu.current):ae(Cu,l.pool)}function M1(){var s=X0();return s===null?null:{parent:qn._currentValue,pool:s}}var Ld=Error(n(460)),J0=Error(n(474)),oy=Error(n(542)),cy={then:function(){}};function j1(s){return s=s.status,s==="fulfilled"||s==="rejected"}function L1(s,l,p){switch(p=s[p],p===void 0?s.push(l):p!==l&&(l.then(ya,ya),l=p),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,U1(s),s;default:if(typeof l.status=="string")l.then(ya,ya);else{if(s=sn,s!==null&&100<s.shellSuspendCounter)throw Error(n(482));s=l,s.status="pending",s.then(function(y){if(l.status==="pending"){var k=l;k.status="fulfilled",k.value=y}},function(y){if(l.status==="pending"){var k=l;k.status="rejected",k.reason=y}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,U1(s),s}throw Pu=l,Ld}}function xu(s){try{var l=s._init;return l(s._payload)}catch(p){throw p!==null&&typeof p=="object"&&typeof p.then=="function"?(Pu=p,Ld):p}}var Pu=null;function B1(){if(Pu===null)throw Error(n(459));var s=Pu;return Pu=null,s}function U1(s){if(s===Ld||s===oy)throw Error(n(483))}var Bd=null,Wp=0;function ly(s){var l=Wp;return Wp+=1,Bd===null&&(Bd=[]),L1(Bd,s,l)}function Kp(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function uy(s,l){throw l.$$typeof===m?Error(n(525)):(s=Object.prototype.toString.call(l),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function F1(s){function l(ve,de){if(s){var Ee=ve.deletions;Ee===null?(ve.deletions=[de],ve.flags|=16):Ee.push(de)}}function p(ve,de){if(!s)return null;for(;de!==null;)l(ve,de),de=de.sibling;return null}function y(ve){for(var de=new Map;ve!==null;)ve.key!==null?de.set(ve.key,ve):de.set(ve.index,ve),ve=ve.sibling;return de}function k(ve,de){return ve=sc(ve,de),ve.index=0,ve.sibling=null,ve}function S(ve,de,Ee){return ve.index=Ee,s?(Ee=ve.alternate,Ee!==null?(Ee=Ee.index,Ee<de?(ve.flags|=67108866,de):Ee):(ve.flags|=67108866,de)):(ve.flags|=1048576,de)}function M(ve){return s&&ve.alternate===null&&(ve.flags|=67108866),ve}function V(ve,de,Ee,qe){return de===null||de.tag!==6?(de=U0(Ee,ve.mode,qe),de.return=ve,de):(de=k(de,Ee),de.return=ve,de)}function oe(ve,de,Ee,qe){var Ft=Ee.type;return Ft===b?Ue(ve,de,Ee.props.children,qe,Ee.key):de!==null&&(de.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===x&&xu(Ft)===de.type)?(de=k(de,Ee.props),Kp(de,Ee),de.return=ve,de):(de=ry(Ee.type,Ee.key,Ee.props,null,ve.mode,qe),Kp(de,Ee),de.return=ve,de)}function Te(ve,de,Ee,qe){return de===null||de.tag!==4||de.stateNode.containerInfo!==Ee.containerInfo||de.stateNode.implementation!==Ee.implementation?(de=F0(Ee,ve.mode,qe),de.return=ve,de):(de=k(de,Ee.children||[]),de.return=ve,de)}function Ue(ve,de,Ee,qe,Ft){return de===null||de.tag!==7?(de=wu(Ee,ve.mode,qe,Ft),de.return=ve,de):(de=k(de,Ee),de.return=ve,de)}function Ge(ve,de,Ee){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return de=U0(""+de,ve.mode,Ee),de.return=ve,de;if(typeof de=="object"&&de!==null){switch(de.$$typeof){case _:return Ee=ry(de.type,de.key,de.props,null,ve.mode,Ee),Kp(Ee,de),Ee.return=ve,Ee;case w:return de=F0(de,ve.mode,Ee),de.return=ve,de;case x:return de=xu(de),Ge(ve,de,Ee)}if(W(de)||j(de))return de=wu(de,ve.mode,Ee,null),de.return=ve,de;if(typeof de.then=="function")return Ge(ve,ly(de),Ee);if(de.$$typeof===P)return Ge(ve,iy(ve,de),Ee);uy(ve,de)}return null}function Pe(ve,de,Ee,qe){var Ft=de!==null?de.key:null;if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint")return Ft!==null?null:V(ve,de,""+Ee,qe);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case _:return Ee.key===Ft?oe(ve,de,Ee,qe):null;case w:return Ee.key===Ft?Te(ve,de,Ee,qe):null;case x:return Ee=xu(Ee),Pe(ve,de,Ee,qe)}if(W(Ee)||j(Ee))return Ft!==null?null:Ue(ve,de,Ee,qe,null);if(typeof Ee.then=="function")return Pe(ve,de,ly(Ee),qe);if(Ee.$$typeof===P)return Pe(ve,de,iy(ve,Ee),qe);uy(ve,Ee)}return null}function Ne(ve,de,Ee,qe,Ft){if(typeof qe=="string"&&qe!==""||typeof qe=="number"||typeof qe=="bigint")return ve=ve.get(Ee)||null,V(de,ve,""+qe,Ft);if(typeof qe=="object"&&qe!==null){switch(qe.$$typeof){case _:return ve=ve.get(qe.key===null?Ee:qe.key)||null,oe(de,ve,qe,Ft);case w:return ve=ve.get(qe.key===null?Ee:qe.key)||null,Te(de,ve,qe,Ft);case x:return qe=xu(qe),Ne(ve,de,Ee,qe,Ft)}if(W(qe)||j(qe))return ve=ve.get(Ee)||null,Ue(de,ve,qe,Ft,null);if(typeof qe.then=="function")return Ne(ve,de,Ee,ly(qe),Ft);if(qe.$$typeof===P)return Ne(ve,de,Ee,iy(de,qe),Ft);uy(de,qe)}return null}function Pt(ve,de,Ee,qe){for(var Ft=null,Nr=null,Lt=de,ir=de=0,kr=null;Lt!==null&&ir<Ee.length;ir++){Lt.index>ir?(kr=Lt,Lt=null):kr=Lt.sibling;var Ir=Pe(ve,Lt,Ee[ir],qe);if(Ir===null){Lt===null&&(Lt=kr);break}s&&Lt&&Ir.alternate===null&&l(ve,Lt),de=S(Ir,de,ir),Nr===null?Ft=Ir:Nr.sibling=Ir,Nr=Ir,Lt=kr}if(ir===Ee.length)return p(ve,Lt),Tr&&oc(ve,ir),Ft;if(Lt===null){for(;ir<Ee.length;ir++)Lt=Ge(ve,Ee[ir],qe),Lt!==null&&(de=S(Lt,de,ir),Nr===null?Ft=Lt:Nr.sibling=Lt,Nr=Lt);return Tr&&oc(ve,ir),Ft}for(Lt=y(Lt);ir<Ee.length;ir++)kr=Ne(Lt,ve,ir,Ee[ir],qe),kr!==null&&(s&&kr.alternate!==null&&Lt.delete(kr.key===null?ir:kr.key),de=S(kr,de,ir),Nr===null?Ft=kr:Nr.sibling=kr,Nr=kr);return s&&Lt.forEach(function(wl){return l(ve,wl)}),Tr&&oc(ve,ir),Ft}function Ht(ve,de,Ee,qe){if(Ee==null)throw Error(n(151));for(var Ft=null,Nr=null,Lt=de,ir=de=0,kr=null,Ir=Ee.next();Lt!==null&&!Ir.done;ir++,Ir=Ee.next()){Lt.index>ir?(kr=Lt,Lt=null):kr=Lt.sibling;var wl=Pe(ve,Lt,Ir.value,qe);if(wl===null){Lt===null&&(Lt=kr);break}s&&Lt&&wl.alternate===null&&l(ve,Lt),de=S(wl,de,ir),Nr===null?Ft=wl:Nr.sibling=wl,Nr=wl,Lt=kr}if(Ir.done)return p(ve,Lt),Tr&&oc(ve,ir),Ft;if(Lt===null){for(;!Ir.done;ir++,Ir=Ee.next())Ir=Ge(ve,Ir.value,qe),Ir!==null&&(de=S(Ir,de,ir),Nr===null?Ft=Ir:Nr.sibling=Ir,Nr=Ir);return Tr&&oc(ve,ir),Ft}for(Lt=y(Lt);!Ir.done;ir++,Ir=Ee.next())Ir=Ne(Lt,ve,ir,Ir.value,qe),Ir!==null&&(s&&Ir.alternate!==null&&Lt.delete(Ir.key===null?ir:Ir.key),de=S(Ir,de,ir),Nr===null?Ft=Ir:Nr.sibling=Ir,Nr=Ir);return s&&Lt.forEach(function(G8){return l(ve,G8)}),Tr&&oc(ve,ir),Ft}function Zr(ve,de,Ee,qe){if(typeof Ee=="object"&&Ee!==null&&Ee.type===b&&Ee.key===null&&(Ee=Ee.props.children),typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case _:e:{for(var Ft=Ee.key;de!==null;){if(de.key===Ft){if(Ft=Ee.type,Ft===b){if(de.tag===7){p(ve,de.sibling),qe=k(de,Ee.props.children),qe.return=ve,ve=qe;break e}}else if(de.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===x&&xu(Ft)===de.type){p(ve,de.sibling),qe=k(de,Ee.props),Kp(qe,Ee),qe.return=ve,ve=qe;break e}p(ve,de);break}else l(ve,de);de=de.sibling}Ee.type===b?(qe=wu(Ee.props.children,ve.mode,qe,Ee.key),qe.return=ve,ve=qe):(qe=ry(Ee.type,Ee.key,Ee.props,null,ve.mode,qe),Kp(qe,Ee),qe.return=ve,ve=qe)}return M(ve);case w:e:{for(Ft=Ee.key;de!==null;){if(de.key===Ft)if(de.tag===4&&de.stateNode.containerInfo===Ee.containerInfo&&de.stateNode.implementation===Ee.implementation){p(ve,de.sibling),qe=k(de,Ee.children||[]),qe.return=ve,ve=qe;break e}else{p(ve,de);break}else l(ve,de);de=de.sibling}qe=F0(Ee,ve.mode,qe),qe.return=ve,ve=qe}return M(ve);case x:return Ee=xu(Ee),Zr(ve,de,Ee,qe)}if(W(Ee))return Pt(ve,de,Ee,qe);if(j(Ee)){if(Ft=j(Ee),typeof Ft!="function")throw Error(n(150));return Ee=Ft.call(Ee),Ht(ve,de,Ee,qe)}if(typeof Ee.then=="function")return Zr(ve,de,ly(Ee),qe);if(Ee.$$typeof===P)return Zr(ve,de,iy(ve,Ee),qe);uy(ve,Ee)}return typeof Ee=="string"&&Ee!==""||typeof Ee=="number"||typeof Ee=="bigint"?(Ee=""+Ee,de!==null&&de.tag===6?(p(ve,de.sibling),qe=k(de,Ee),qe.return=ve,ve=qe):(p(ve,de),qe=U0(Ee,ve.mode,qe),qe.return=ve,ve=qe),M(ve)):p(ve,de)}return function(ve,de,Ee,qe){try{Wp=0;var Ft=Zr(ve,de,Ee,qe);return Bd=null,Ft}catch(Lt){if(Lt===Ld||Lt===oy)throw Lt;var Nr=Ei(29,Lt,null,ve.mode);return Nr.lanes=qe,Nr.return=ve,Nr}finally{}}}var Au=F1(!0),q1=F1(!1),il=!1;function Q0(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Z0(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function sl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ol(s,l,p){var y=s.updateQueue;if(y===null)return null;if(y=y.shared,(Br&2)!==0){var k=y.pending;return k===null?l.next=l:(l.next=k.next,k.next=l),y.pending=l,l=ty(s),E1(s,null,p),l}return ey(s,y,l,p),ty(s)}function Yp(s,l,p){if(l=l.updateQueue,l!==null&&(l=l.shared,(p&4194048)!==0)){var y=l.lanes;y&=s.pendingLanes,p|=y,l.lanes=p,Qt(s,p)}}function ek(s,l){var p=s.updateQueue,y=s.alternate;if(y!==null&&(y=y.updateQueue,p===y)){var k=null,S=null;if(p=p.firstBaseUpdate,p!==null){do{var M={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};S===null?k=S=M:S=S.next=M,p=p.next}while(p!==null);S===null?k=S=l:S=S.next=l}else k=S=l;p={baseState:y.baseState,firstBaseUpdate:k,lastBaseUpdate:S,shared:y.shared,callbacks:y.callbacks},s.updateQueue=p;return}s=p.lastBaseUpdate,s===null?p.firstBaseUpdate=l:s.next=l,p.lastBaseUpdate=l}var tk=!1;function Xp(){if(tk){var s=jd;if(s!==null)throw s}}function Jp(s,l,p,y){tk=!1;var k=s.updateQueue;il=!1;var S=k.firstBaseUpdate,M=k.lastBaseUpdate,V=k.shared.pending;if(V!==null){k.shared.pending=null;var oe=V,Te=oe.next;oe.next=null,M===null?S=Te:M.next=Te,M=oe;var Ue=s.alternate;Ue!==null&&(Ue=Ue.updateQueue,V=Ue.lastBaseUpdate,V!==M&&(V===null?Ue.firstBaseUpdate=Te:V.next=Te,Ue.lastBaseUpdate=oe))}if(S!==null){var Ge=k.baseState;M=0,Ue=Te=oe=null,V=S;do{var Pe=V.lane&-536870913,Ne=Pe!==V.lane;if(Ne?(br&Pe)===Pe:(y&Pe)===Pe){Pe!==0&&Pe===Md&&(tk=!0),Ue!==null&&(Ue=Ue.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var Pt=s,Ht=V;Pe=l;var Zr=p;switch(Ht.tag){case 1:if(Pt=Ht.payload,typeof Pt=="function"){Ge=Pt.call(Zr,Ge,Pe);break e}Ge=Pt;break e;case 3:Pt.flags=Pt.flags&-65537|128;case 0:if(Pt=Ht.payload,Pe=typeof Pt=="function"?Pt.call(Zr,Ge,Pe):Pt,Pe==null)break e;Ge=h({},Ge,Pe);break e;case 2:il=!0}}Pe=V.callback,Pe!==null&&(s.flags|=64,Ne&&(s.flags|=8192),Ne=k.callbacks,Ne===null?k.callbacks=[Pe]:Ne.push(Pe))}else Ne={lane:Pe,tag:V.tag,payload:V.payload,callback:V.callback,next:null},Ue===null?(Te=Ue=Ne,oe=Ge):Ue=Ue.next=Ne,M|=Pe;if(V=V.next,V===null){if(V=k.shared.pending,V===null)break;Ne=V,V=Ne.next,Ne.next=null,k.lastBaseUpdate=Ne,k.shared.pending=null}}while(!0);Ue===null&&(oe=Ge),k.baseState=oe,k.firstBaseUpdate=Te,k.lastBaseUpdate=Ue,S===null&&(k.shared.lanes=0),fl|=M,s.lanes=M,s.memoizedState=Ge}}function z1(s,l){if(typeof s!="function")throw Error(n(191,s));s.call(l)}function $1(s,l){var p=s.callbacks;if(p!==null)for(s.callbacks=null,s=0;s<p.length;s++)z1(p[s],l)}var Ud=B(null),dy=B(0);function V1(s,l){s=vc,ae(dy,s),ae(Ud,l),vc=s|l.baseLanes}function rk(){ae(dy,vc),ae(Ud,Ud.current)}function nk(){vc=dy.current,K(Ud),K(dy)}var Ti=B(null),Qi=null;function cl(s){var l=s.alternate;ae(In,In.current&1),ae(Ti,s),Qi===null&&(l===null||Ud.current!==null||l.memoizedState!==null)&&(Qi=s)}function ak(s){ae(In,In.current),ae(Ti,s),Qi===null&&(Qi=s)}function H1(s){s.tag===22?(ae(In,In.current),ae(Ti,s),Qi===null&&(Qi=s)):ll()}function ll(){ae(In,In.current),ae(Ti,Ti.current)}function Ci(s){K(Ti),Qi===s&&(Qi=null),K(In)}var In=B(0);function fy(s){for(var l=s;l!==null;){if(l.tag===13){var p=l.memoizedState;if(p!==null&&(p=p.dehydrated,p===null||uw(p)||dw(p)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var uc=0,ar=null,Jr=null,zn=null,py=!1,Fd=!1,Ru=!1,hy=0,Qp=0,qd=null,j$=0;function Cn(){throw Error(n(321))}function ik(s,l){if(l===null)return!1;for(var p=0;p<l.length&&p<s.length;p++)if(!Si(s[p],l[p]))return!1;return!0}function sk(s,l,p,y,k,S){return uc=S,ar=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,F.H=s===null||s.memoizedState===null?PR:kk,Ru=!1,S=p(y,k),Ru=!1,Fd&&(S=W1(l,p,y,k)),G1(s),S}function G1(s){F.H=th;var l=Jr!==null&&Jr.next!==null;if(uc=0,zn=Jr=ar=null,py=!1,Qp=0,qd=null,l)throw Error(n(300));s===null||$n||(s=s.dependencies,s!==null&&ay(s)&&($n=!0))}function W1(s,l,p,y){ar=s;var k=0;do{if(Fd&&(qd=null),Qp=0,Fd=!1,25<=k)throw Error(n(301));if(k+=1,zn=Jr=null,s.updateQueue!=null){var S=s.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}F.H=AR,S=l(p,y)}while(Fd);return S}function L$(){var s=F.H,l=s.useState()[0];return l=typeof l.then=="function"?Zp(l):l,s=s.useState()[0],(Jr!==null?Jr.memoizedState:null)!==s&&(ar.flags|=1024),l}function ok(){var s=hy!==0;return hy=0,s}function ck(s,l,p){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~p}function lk(s){if(py){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}py=!1}uc=0,zn=Jr=ar=null,Fd=!1,Qp=hy=0,qd=null}function qa(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return zn===null?ar.memoizedState=zn=s:zn=zn.next=s,zn}function Mn(){if(Jr===null){var s=ar.alternate;s=s!==null?s.memoizedState:null}else s=Jr.next;var l=zn===null?ar.memoizedState:zn.next;if(l!==null)zn=l,Jr=s;else{if(s===null)throw ar.alternate===null?Error(n(467)):Error(n(310));Jr=s,s={memoizedState:Jr.memoizedState,baseState:Jr.baseState,baseQueue:Jr.baseQueue,queue:Jr.queue,next:null},zn===null?ar.memoizedState=zn=s:zn=zn.next=s}return zn}function my(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Zp(s){var l=Qp;return Qp+=1,qd===null&&(qd=[]),s=L1(qd,s,l),l=ar,(zn===null?l.memoizedState:zn.next)===null&&(l=l.alternate,F.H=l===null||l.memoizedState===null?PR:kk),s}function gy(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Zp(s);if(s.$$typeof===P)return _a(s)}throw Error(n(438,String(s)))}function uk(s){var l=null,p=ar.updateQueue;if(p!==null&&(l=p.memoCache),l==null){var y=ar.alternate;y!==null&&(y=y.updateQueue,y!==null&&(y=y.memoCache,y!=null&&(l={data:y.data.map(function(k){return k.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),p===null&&(p=my(),ar.updateQueue=p),p.memoCache=l,p=l.data[l.index],p===void 0)for(p=l.data[l.index]=Array(s),y=0;y<s;y++)p[y]=N;return l.index++,p}function dc(s,l){return typeof l=="function"?l(s):l}function yy(s){var l=Mn();return dk(l,Jr,s)}function dk(s,l,p){var y=s.queue;if(y===null)throw Error(n(311));y.lastRenderedReducer=p;var k=s.baseQueue,S=y.pending;if(S!==null){if(k!==null){var M=k.next;k.next=S.next,S.next=M}l.baseQueue=k=S,y.pending=null}if(S=s.baseState,k===null)s.memoizedState=S;else{l=k.next;var V=M=null,oe=null,Te=l,Ue=!1;do{var Ge=Te.lane&-536870913;if(Ge!==Te.lane?(br&Ge)===Ge:(uc&Ge)===Ge){var Pe=Te.revertLane;if(Pe===0)oe!==null&&(oe=oe.next={lane:0,revertLane:0,gesture:null,action:Te.action,hasEagerState:Te.hasEagerState,eagerState:Te.eagerState,next:null}),Ge===Md&&(Ue=!0);else if((uc&Pe)===Pe){Te=Te.next,Pe===Md&&(Ue=!0);continue}else Ge={lane:0,revertLane:Te.revertLane,gesture:null,action:Te.action,hasEagerState:Te.hasEagerState,eagerState:Te.eagerState,next:null},oe===null?(V=oe=Ge,M=S):oe=oe.next=Ge,ar.lanes|=Pe,fl|=Pe;Ge=Te.action,Ru&&p(S,Ge),S=Te.hasEagerState?Te.eagerState:p(S,Ge)}else Pe={lane:Ge,revertLane:Te.revertLane,gesture:Te.gesture,action:Te.action,hasEagerState:Te.hasEagerState,eagerState:Te.eagerState,next:null},oe===null?(V=oe=Pe,M=S):oe=oe.next=Pe,ar.lanes|=Ge,fl|=Ge;Te=Te.next}while(Te!==null&&Te!==l);if(oe===null?M=S:oe.next=V,!Si(S,s.memoizedState)&&($n=!0,Ue&&(p=jd,p!==null)))throw p;s.memoizedState=S,s.baseState=M,s.baseQueue=oe,y.lastRenderedState=S}return k===null&&(y.lanes=0),[s.memoizedState,y.dispatch]}function fk(s){var l=Mn(),p=l.queue;if(p===null)throw Error(n(311));p.lastRenderedReducer=s;var y=p.dispatch,k=p.pending,S=l.memoizedState;if(k!==null){p.pending=null;var M=k=k.next;do S=s(S,M.action),M=M.next;while(M!==k);Si(S,l.memoizedState)||($n=!0),l.memoizedState=S,l.baseQueue===null&&(l.baseState=S),p.lastRenderedState=S}return[S,y]}function K1(s,l,p){var y=ar,k=Mn(),S=Tr;if(S){if(p===void 0)throw Error(n(407));p=p()}else p=l();var M=!Si((Jr||k).memoizedState,p);if(M&&(k.memoizedState=p,$n=!0),k=k.queue,mk(J1.bind(null,y,k,s),[s]),k.getSnapshot!==l||M||zn!==null&&zn.memoizedState.tag&1){if(y.flags|=2048,zd(9,{destroy:void 0},X1.bind(null,y,k,p,l),null),sn===null)throw Error(n(349));S||(uc&127)!==0||Y1(y,l,p)}return p}function Y1(s,l,p){s.flags|=16384,s={getSnapshot:l,value:p},l=ar.updateQueue,l===null?(l=my(),ar.updateQueue=l,l.stores=[s]):(p=l.stores,p===null?l.stores=[s]:p.push(s))}function X1(s,l,p,y){l.value=p,l.getSnapshot=y,Q1(l)&&Z1(s)}function J1(s,l,p){return p(function(){Q1(l)&&Z1(s)})}function Q1(s){var l=s.getSnapshot;s=s.value;try{var p=l();return!Si(s,p)}catch{return!0}}function Z1(s){var l=ku(s,2);l!==null&&ti(l,s,2)}function pk(s){var l=qa();if(typeof s=="function"){var p=s;if(s=p(),Ru){st(!0);try{p()}finally{st(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:dc,lastRenderedState:s},l}function eR(s,l,p,y){return s.baseState=p,dk(s,Jr,typeof y=="function"?y:dc)}function B$(s,l,p,y,k){if(by(s))throw Error(n(485));if(s=l.action,s!==null){var S={payload:k,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){S.listeners.push(M)}};F.T!==null?p(!0):S.isTransition=!1,y(S),p=l.pending,p===null?(S.next=l.pending=S,tR(l,S)):(S.next=p.next,l.pending=p.next=S)}}function tR(s,l){var p=l.action,y=l.payload,k=s.state;if(l.isTransition){var S=F.T,M={};F.T=M;try{var V=p(k,y),oe=F.S;oe!==null&&oe(M,V),rR(s,l,V)}catch(Te){hk(s,l,Te)}finally{S!==null&&M.types!==null&&(S.types=M.types),F.T=S}}else try{S=p(k,y),rR(s,l,S)}catch(Te){hk(s,l,Te)}}function rR(s,l,p){p!==null&&typeof p=="object"&&typeof p.then=="function"?p.then(function(y){nR(s,l,y)},function(y){return hk(s,l,y)}):nR(s,l,p)}function nR(s,l,p){l.status="fulfilled",l.value=p,aR(l),s.state=p,l=s.pending,l!==null&&(p=l.next,p===l?s.pending=null:(p=p.next,l.next=p,tR(s,p)))}function hk(s,l,p){var y=s.pending;if(s.pending=null,y!==null){y=y.next;do l.status="rejected",l.reason=p,aR(l),l=l.next;while(l!==y)}s.action=null}function aR(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function iR(s,l){return l}function sR(s,l){if(Tr){var p=sn.formState;if(p!==null){e:{var y=ar;if(Tr){if(mn){t:{for(var k=mn,S=Ji;k.nodeType!==8;){if(!S){k=null;break t}if(k=Zi(k.nextSibling),k===null){k=null;break t}}S=k.data,k=S==="F!"||S==="F"?k:null}if(k){mn=Zi(k.nextSibling),y=k.data==="F!";break e}}nl(y)}y=!1}y&&(l=p[0])}}return p=qa(),p.memoizedState=p.baseState=l,y={pending:null,lanes:0,dispatch:null,lastRenderedReducer:iR,lastRenderedState:l},p.queue=y,p=TR.bind(null,ar,y),y.dispatch=p,y=pk(!1),S=bk.bind(null,ar,!1,y.queue),y=qa(),k={state:l,dispatch:null,action:s,pending:null},y.queue=k,p=B$.bind(null,ar,k,S,p),k.dispatch=p,y.memoizedState=s,[l,p,!1]}function oR(s){var l=Mn();return cR(l,Jr,s)}function cR(s,l,p){if(l=dk(s,l,iR)[0],s=yy(dc)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var y=Zp(l)}catch(M){throw M===Ld?oy:M}else y=l;l=Mn();var k=l.queue,S=k.dispatch;return p!==l.memoizedState&&(ar.flags|=2048,zd(9,{destroy:void 0},U$.bind(null,k,p),null)),[y,S,s]}function U$(s,l){s.action=l}function lR(s){var l=Mn(),p=Jr;if(p!==null)return cR(l,p,s);Mn(),l=l.memoizedState,p=Mn();var y=p.queue.dispatch;return p.memoizedState=s,[l,y,!1]}function zd(s,l,p,y){return s={tag:s,create:p,deps:y,inst:l,next:null},l=ar.updateQueue,l===null&&(l=my(),ar.updateQueue=l),p=l.lastEffect,p===null?l.lastEffect=s.next=s:(y=p.next,p.next=s,s.next=y,l.lastEffect=s),s}function uR(){return Mn().memoizedState}function vy(s,l,p,y){var k=qa();ar.flags|=s,k.memoizedState=zd(1|l,{destroy:void 0},p,y===void 0?null:y)}function _y(s,l,p,y){var k=Mn();y=y===void 0?null:y;var S=k.memoizedState.inst;Jr!==null&&y!==null&&ik(y,Jr.memoizedState.deps)?k.memoizedState=zd(l,S,p,y):(ar.flags|=s,k.memoizedState=zd(1|l,S,p,y))}function dR(s,l){vy(8390656,8,s,l)}function mk(s,l){_y(2048,8,s,l)}function F$(s){ar.flags|=4;var l=ar.updateQueue;if(l===null)l=my(),ar.updateQueue=l,l.events=[s];else{var p=l.events;p===null?l.events=[s]:p.push(s)}}function fR(s){var l=Mn().memoizedState;return F$({ref:l,nextImpl:s}),function(){if((Br&2)!==0)throw Error(n(440));return l.impl.apply(void 0,arguments)}}function pR(s,l){return _y(4,2,s,l)}function hR(s,l){return _y(4,4,s,l)}function mR(s,l){if(typeof l=="function"){s=s();var p=l(s);return function(){typeof p=="function"?p():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function gR(s,l,p){p=p!=null?p.concat([s]):null,_y(4,4,mR.bind(null,l,s),p)}function gk(){}function yR(s,l){var p=Mn();l=l===void 0?null:l;var y=p.memoizedState;return l!==null&&ik(l,y[1])?y[0]:(p.memoizedState=[s,l],s)}function vR(s,l){var p=Mn();l=l===void 0?null:l;var y=p.memoizedState;if(l!==null&&ik(l,y[1]))return y[0];if(y=s(),Ru){st(!0);try{s()}finally{st(!1)}}return p.memoizedState=[y,l],y}function yk(s,l,p){return p===void 0||(uc&1073741824)!==0&&(br&261930)===0?s.memoizedState=l:(s.memoizedState=p,s=_2(),ar.lanes|=s,fl|=s,p)}function _R(s,l,p,y){return Si(p,l)?p:Ud.current!==null?(s=yk(s,p,y),Si(s,l)||($n=!0),s):(uc&42)===0||(uc&1073741824)!==0&&(br&261930)===0?($n=!0,s.memoizedState=p):(s=_2(),ar.lanes|=s,fl|=s,l)}function bR(s,l,p,y,k){var S=Y.p;Y.p=S!==0&&8>S?S:8;var M=F.T,V={};F.T=V,bk(s,!1,l,p);try{var oe=k(),Te=F.S;if(Te!==null&&Te(V,oe),oe!==null&&typeof oe=="object"&&typeof oe.then=="function"){var Ue=M$(oe,y);eh(s,l,Ue,Ai(s))}else eh(s,l,y,Ai(s))}catch(Ge){eh(s,l,{then:function(){},status:"rejected",reason:Ge},Ai())}finally{Y.p=S,M!==null&&V.types!==null&&(M.types=V.types),F.T=M}}function q$(){}function vk(s,l,p,y){if(s.tag!==5)throw Error(n(476));var k=kR(s).queue;bR(s,k,l,Q,p===null?q$:function(){return wR(s),p(y)})}function kR(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dc,lastRenderedState:Q},next:null};var p={};return l.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:dc,lastRenderedState:p},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function wR(s){var l=kR(s);l.next===null&&(l=s.alternate.memoizedState),eh(s,l.next.queue,{},Ai())}function _k(){return _a(yh)}function SR(){return Mn().memoizedState}function ER(){return Mn().memoizedState}function z$(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var p=Ai();s=sl(p);var y=ol(l,s,p);y!==null&&(ti(y,l,p),Yp(y,l,p)),l={cache:K0()},s.payload=l;return}l=l.return}}function $$(s,l,p){var y=Ai();p={lane:y,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},by(s)?CR(l,p):(p=L0(s,l,p,y),p!==null&&(ti(p,s,y),xR(p,l,y)))}function TR(s,l,p){var y=Ai();eh(s,l,p,y)}function eh(s,l,p,y){var k={lane:y,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(by(s))CR(l,k);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=l.lastRenderedReducer,S!==null))try{var M=l.lastRenderedState,V=S(M,p);if(k.hasEagerState=!0,k.eagerState=V,Si(V,M))return ey(s,l,k,0),sn===null&&Zg(),!1}catch{}finally{}if(p=L0(s,l,k,y),p!==null)return ti(p,s,y),xR(p,l,y),!0}return!1}function bk(s,l,p,y){if(y={lane:2,revertLane:Qk(),gesture:null,action:y,hasEagerState:!1,eagerState:null,next:null},by(s)){if(l)throw Error(n(479))}else l=L0(s,p,y,2),l!==null&&ti(l,s,2)}function by(s){var l=s.alternate;return s===ar||l!==null&&l===ar}function CR(s,l){Fd=py=!0;var p=s.pending;p===null?l.next=l:(l.next=p.next,p.next=l),s.pending=l}function xR(s,l,p){if((p&4194048)!==0){var y=l.lanes;y&=s.pendingLanes,p|=y,l.lanes=p,Qt(s,p)}}var th={readContext:_a,use:gy,useCallback:Cn,useContext:Cn,useEffect:Cn,useImperativeHandle:Cn,useLayoutEffect:Cn,useInsertionEffect:Cn,useMemo:Cn,useReducer:Cn,useRef:Cn,useState:Cn,useDebugValue:Cn,useDeferredValue:Cn,useTransition:Cn,useSyncExternalStore:Cn,useId:Cn,useHostTransitionStatus:Cn,useFormState:Cn,useActionState:Cn,useOptimistic:Cn,useMemoCache:Cn,useCacheRefresh:Cn};th.useEffectEvent=Cn;var PR={readContext:_a,use:gy,useCallback:function(s,l){return qa().memoizedState=[s,l===void 0?null:l],s},useContext:_a,useEffect:dR,useImperativeHandle:function(s,l,p){p=p!=null?p.concat([s]):null,vy(4194308,4,mR.bind(null,l,s),p)},useLayoutEffect:function(s,l){return vy(4194308,4,s,l)},useInsertionEffect:function(s,l){vy(4,2,s,l)},useMemo:function(s,l){var p=qa();l=l===void 0?null:l;var y=s();if(Ru){st(!0);try{s()}finally{st(!1)}}return p.memoizedState=[y,l],y},useReducer:function(s,l,p){var y=qa();if(p!==void 0){var k=p(l);if(Ru){st(!0);try{p(l)}finally{st(!1)}}}else k=l;return y.memoizedState=y.baseState=k,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:k},y.queue=s,s=s.dispatch=$$.bind(null,ar,s),[y.memoizedState,s]},useRef:function(s){var l=qa();return s={current:s},l.memoizedState=s},useState:function(s){s=pk(s);var l=s.queue,p=TR.bind(null,ar,l);return l.dispatch=p,[s.memoizedState,p]},useDebugValue:gk,useDeferredValue:function(s,l){var p=qa();return yk(p,s,l)},useTransition:function(){var s=pk(!1);return s=bR.bind(null,ar,s.queue,!0,!1),qa().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,p){var y=ar,k=qa();if(Tr){if(p===void 0)throw Error(n(407));p=p()}else{if(p=l(),sn===null)throw Error(n(349));(br&127)!==0||Y1(y,l,p)}k.memoizedState=p;var S={value:p,getSnapshot:l};return k.queue=S,dR(J1.bind(null,y,S,s),[s]),y.flags|=2048,zd(9,{destroy:void 0},X1.bind(null,y,S,p,l),null),p},useId:function(){var s=qa(),l=sn.identifierPrefix;if(Tr){var p=ho,y=po;p=(y&~(1<<32-bt(y)-1)).toString(32)+p,l="_"+l+"R_"+p,p=hy++,0<p&&(l+="H"+p.toString(32)),l+="_"}else p=j$++,l="_"+l+"r_"+p.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:_k,useFormState:sR,useActionState:sR,useOptimistic:function(s){var l=qa();l.memoizedState=l.baseState=s;var p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=p,l=bk.bind(null,ar,!0,p),p.dispatch=l,[s,l]},useMemoCache:uk,useCacheRefresh:function(){return qa().memoizedState=z$.bind(null,ar)},useEffectEvent:function(s){var l=qa(),p={impl:s};return l.memoizedState=p,function(){if((Br&2)!==0)throw Error(n(440));return p.impl.apply(void 0,arguments)}}},kk={readContext:_a,use:gy,useCallback:yR,useContext:_a,useEffect:mk,useImperativeHandle:gR,useInsertionEffect:pR,useLayoutEffect:hR,useMemo:vR,useReducer:yy,useRef:uR,useState:function(){return yy(dc)},useDebugValue:gk,useDeferredValue:function(s,l){var p=Mn();return _R(p,Jr.memoizedState,s,l)},useTransition:function(){var s=yy(dc)[0],l=Mn().memoizedState;return[typeof s=="boolean"?s:Zp(s),l]},useSyncExternalStore:K1,useId:SR,useHostTransitionStatus:_k,useFormState:oR,useActionState:oR,useOptimistic:function(s,l){var p=Mn();return eR(p,Jr,s,l)},useMemoCache:uk,useCacheRefresh:ER};kk.useEffectEvent=fR;var AR={readContext:_a,use:gy,useCallback:yR,useContext:_a,useEffect:mk,useImperativeHandle:gR,useInsertionEffect:pR,useLayoutEffect:hR,useMemo:vR,useReducer:fk,useRef:uR,useState:function(){return fk(dc)},useDebugValue:gk,useDeferredValue:function(s,l){var p=Mn();return Jr===null?yk(p,s,l):_R(p,Jr.memoizedState,s,l)},useTransition:function(){var s=fk(dc)[0],l=Mn().memoizedState;return[typeof s=="boolean"?s:Zp(s),l]},useSyncExternalStore:K1,useId:SR,useHostTransitionStatus:_k,useFormState:lR,useActionState:lR,useOptimistic:function(s,l){var p=Mn();return Jr!==null?eR(p,Jr,s,l):(p.baseState=s,[s,p.queue.dispatch])},useMemoCache:uk,useCacheRefresh:ER};AR.useEffectEvent=fR;function wk(s,l,p,y){l=s.memoizedState,p=p(y,l),p=p==null?l:h({},l,p),s.memoizedState=p,s.lanes===0&&(s.updateQueue.baseState=p)}var Sk={enqueueSetState:function(s,l,p){s=s._reactInternals;var y=Ai(),k=sl(y);k.payload=l,p!=null&&(k.callback=p),l=ol(s,k,y),l!==null&&(ti(l,s,y),Yp(l,s,y))},enqueueReplaceState:function(s,l,p){s=s._reactInternals;var y=Ai(),k=sl(y);k.tag=1,k.payload=l,p!=null&&(k.callback=p),l=ol(s,k,y),l!==null&&(ti(l,s,y),Yp(l,s,y))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var p=Ai(),y=sl(p);y.tag=2,l!=null&&(y.callback=l),l=ol(s,y,p),l!==null&&(ti(l,s,p),Yp(l,s,p))}};function RR(s,l,p,y,k,S,M){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(y,S,M):l.prototype&&l.prototype.isPureReactComponent?!qp(p,y)||!qp(k,S):!0}function DR(s,l,p,y){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(p,y),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(p,y),l.state!==s&&Sk.enqueueReplaceState(l,l.state,null)}function Du(s,l){var p=l;if("ref"in l){p={};for(var y in l)y!=="ref"&&(p[y]=l[y])}if(s=s.defaultProps){p===l&&(p=h({},p));for(var k in s)p[k]===void 0&&(p[k]=s[k])}return p}function OR(s){Qg(s)}function NR(s){}function IR(s){Qg(s)}function ky(s,l){try{var p=s.onUncaughtError;p(l.value,{componentStack:l.stack})}catch(y){setTimeout(function(){throw y})}}function MR(s,l,p){try{var y=s.onCaughtError;y(p.value,{componentStack:p.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(k){setTimeout(function(){throw k})}}function Ek(s,l,p){return p=sl(p),p.tag=3,p.payload={element:null},p.callback=function(){ky(s,l)},p}function jR(s){return s=sl(s),s.tag=3,s}function LR(s,l,p,y){var k=p.type.getDerivedStateFromError;if(typeof k=="function"){var S=y.value;s.payload=function(){return k(S)},s.callback=function(){MR(l,p,y)}}var M=p.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(s.callback=function(){MR(l,p,y),typeof k!="function"&&(pl===null?pl=new Set([this]):pl.add(this));var V=y.stack;this.componentDidCatch(y.value,{componentStack:V!==null?V:""})})}function V$(s,l,p,y,k){if(p.flags|=32768,y!==null&&typeof y=="object"&&typeof y.then=="function"){if(l=p.alternate,l!==null&&Id(l,p,k,!0),p=Ti.current,p!==null){switch(p.tag){case 31:case 13:return Qi===null?Ny():p.alternate===null&&xn===0&&(xn=3),p.flags&=-257,p.flags|=65536,p.lanes=k,y===cy?p.flags|=16384:(l=p.updateQueue,l===null?p.updateQueue=new Set([y]):l.add(y),Yk(s,y,k)),!1;case 22:return p.flags|=65536,y===cy?p.flags|=16384:(l=p.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([y])},p.updateQueue=l):(p=l.retryQueue,p===null?l.retryQueue=new Set([y]):p.add(y)),Yk(s,y,k)),!1}throw Error(n(435,p.tag))}return Yk(s,y,k),Ny(),!1}if(Tr)return l=Ti.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=k,y!==$0&&(s=Error(n(422),{cause:y}),Vp(Ki(s,p)))):(y!==$0&&(l=Error(n(423),{cause:y}),Vp(Ki(l,p))),s=s.current.alternate,s.flags|=65536,k&=-k,s.lanes|=k,y=Ki(y,p),k=Ek(s.stateNode,y,k),ek(s,k),xn!==4&&(xn=2)),!1;var S=Error(n(520),{cause:y});if(S=Ki(S,p),lh===null?lh=[S]:lh.push(S),xn!==4&&(xn=2),l===null)return!0;y=Ki(y,p),p=l;do{switch(p.tag){case 3:return p.flags|=65536,s=k&-k,p.lanes|=s,s=Ek(p.stateNode,y,s),ek(p,s),!1;case 1:if(l=p.type,S=p.stateNode,(p.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(pl===null||!pl.has(S))))return p.flags|=65536,k&=-k,p.lanes|=k,k=jR(k),LR(k,s,p,y),ek(p,k),!1}p=p.return}while(p!==null);return!1}var Tk=Error(n(461)),$n=!1;function ba(s,l,p,y){l.child=s===null?q1(l,null,p,y):Au(l,s.child,p,y)}function BR(s,l,p,y,k){p=p.render;var S=l.ref;if("ref"in y){var M={};for(var V in y)V!=="ref"&&(M[V]=y[V])}else M=y;return Tu(l),y=sk(s,l,p,M,S,k),V=ok(),s!==null&&!$n?(ck(s,l,k),fc(s,l,k)):(Tr&&V&&q0(l),l.flags|=1,ba(s,l,y,k),l.child)}function UR(s,l,p,y,k){if(s===null){var S=p.type;return typeof S=="function"&&!B0(S)&&S.defaultProps===void 0&&p.compare===null?(l.tag=15,l.type=S,FR(s,l,S,y,k)):(s=ry(p.type,null,y,l,l.mode,k),s.ref=l.ref,s.return=l,l.child=s)}if(S=s.child,!Nk(s,k)){var M=S.memoizedProps;if(p=p.compare,p=p!==null?p:qp,p(M,y)&&s.ref===l.ref)return fc(s,l,k)}return l.flags|=1,s=sc(S,y),s.ref=l.ref,s.return=l,l.child=s}function FR(s,l,p,y,k){if(s!==null){var S=s.memoizedProps;if(qp(S,y)&&s.ref===l.ref)if($n=!1,l.pendingProps=y=S,Nk(s,k))(s.flags&131072)!==0&&($n=!0);else return l.lanes=s.lanes,fc(s,l,k)}return Ck(s,l,p,y,k)}function qR(s,l,p,y){var k=y.children,S=s!==null?s.memoizedState:null;if(s===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),y.mode==="hidden"){if((l.flags&128)!==0){if(S=S!==null?S.baseLanes|p:p,s!==null){for(y=l.child=s.child,k=0;y!==null;)k=k|y.lanes|y.childLanes,y=y.sibling;y=k&~S}else y=0,l.child=null;return zR(s,l,S,p,y)}if((p&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&sy(l,S!==null?S.cachePool:null),S!==null?V1(l,S):rk(),H1(l);else return y=l.lanes=536870912,zR(s,l,S!==null?S.baseLanes|p:p,p,y)}else S!==null?(sy(l,S.cachePool),V1(l,S),ll(),l.memoizedState=null):(s!==null&&sy(l,null),rk(),ll());return ba(s,l,k,p),l.child}function rh(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function zR(s,l,p,y,k){var S=X0();return S=S===null?null:{parent:qn._currentValue,pool:S},l.memoizedState={baseLanes:p,cachePool:S},s!==null&&sy(l,null),rk(),H1(l),s!==null&&Id(s,l,y,!0),l.childLanes=k,null}function wy(s,l){return l=Ey({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function $R(s,l,p){return Au(l,s.child,null,p),s=wy(l,l.pendingProps),s.flags|=2,Ci(l),l.memoizedState=null,s}function H$(s,l,p){var y=l.pendingProps,k=(l.flags&128)!==0;if(l.flags&=-129,s===null){if(Tr){if(y.mode==="hidden")return s=wy(l,y),l.lanes=536870912,rh(null,s);if(ak(l),(s=mn)?(s=tD(s,Ji),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:tl!==null?{id:po,overflow:ho}:null,retryLane:536870912,hydrationErrors:null},p=C1(s),p.return=l,l.child=p,va=l,mn=null)):s=null,s===null)throw nl(l);return l.lanes=536870912,null}return wy(l,y)}var S=s.memoizedState;if(S!==null){var M=S.dehydrated;if(ak(l),k)if(l.flags&256)l.flags&=-257,l=$R(s,l,p);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(n(558));else if($n||Id(s,l,p,!1),k=(p&s.childLanes)!==0,$n||k){if(y=sn,y!==null&&(M=Zt(y,p),M!==0&&M!==S.retryLane))throw S.retryLane=M,ku(s,M),ti(y,s,M),Tk;Ny(),l=$R(s,l,p)}else s=S.treeContext,mn=Zi(M.nextSibling),va=l,Tr=!0,rl=null,Ji=!1,s!==null&&A1(l,s),l=wy(l,y),l.flags|=4096;return l}return s=sc(s.child,{mode:y.mode,children:y.children}),s.ref=l.ref,l.child=s,s.return=l,s}function Sy(s,l){var p=l.ref;if(p===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof p!="function"&&typeof p!="object")throw Error(n(284));(s===null||s.ref!==p)&&(l.flags|=4194816)}}function Ck(s,l,p,y,k){return Tu(l),p=sk(s,l,p,y,void 0,k),y=ok(),s!==null&&!$n?(ck(s,l,k),fc(s,l,k)):(Tr&&y&&q0(l),l.flags|=1,ba(s,l,p,k),l.child)}function VR(s,l,p,y,k,S){return Tu(l),l.updateQueue=null,p=W1(l,y,p,k),G1(s),y=ok(),s!==null&&!$n?(ck(s,l,S),fc(s,l,S)):(Tr&&y&&q0(l),l.flags|=1,ba(s,l,p,S),l.child)}function HR(s,l,p,y,k){if(Tu(l),l.stateNode===null){var S=Rd,M=p.contextType;typeof M=="object"&&M!==null&&(S=_a(M)),S=new p(y,S),l.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=Sk,l.stateNode=S,S._reactInternals=l,S=l.stateNode,S.props=y,S.state=l.memoizedState,S.refs={},Q0(l),M=p.contextType,S.context=typeof M=="object"&&M!==null?_a(M):Rd,S.state=l.memoizedState,M=p.getDerivedStateFromProps,typeof M=="function"&&(wk(l,p,M,y),S.state=l.memoizedState),typeof p.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(M=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),M!==S.state&&Sk.enqueueReplaceState(S,S.state,null),Jp(l,y,S,k),Xp(),S.state=l.memoizedState),typeof S.componentDidMount=="function"&&(l.flags|=4194308),y=!0}else if(s===null){S=l.stateNode;var V=l.memoizedProps,oe=Du(p,V);S.props=oe;var Te=S.context,Ue=p.contextType;M=Rd,typeof Ue=="object"&&Ue!==null&&(M=_a(Ue));var Ge=p.getDerivedStateFromProps;Ue=typeof Ge=="function"||typeof S.getSnapshotBeforeUpdate=="function",V=l.pendingProps!==V,Ue||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(V||Te!==M)&&DR(l,S,y,M),il=!1;var Pe=l.memoizedState;S.state=Pe,Jp(l,y,S,k),Xp(),Te=l.memoizedState,V||Pe!==Te||il?(typeof Ge=="function"&&(wk(l,p,Ge,y),Te=l.memoizedState),(oe=il||RR(l,p,oe,y,Pe,Te,M))?(Ue||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount()),typeof S.componentDidMount=="function"&&(l.flags|=4194308)):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=y,l.memoizedState=Te),S.props=y,S.state=Te,S.context=M,y=oe):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),y=!1)}else{S=l.stateNode,Z0(s,l),M=l.memoizedProps,Ue=Du(p,M),S.props=Ue,Ge=l.pendingProps,Pe=S.context,Te=p.contextType,oe=Rd,typeof Te=="object"&&Te!==null&&(oe=_a(Te)),V=p.getDerivedStateFromProps,(Te=typeof V=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(M!==Ge||Pe!==oe)&&DR(l,S,y,oe),il=!1,Pe=l.memoizedState,S.state=Pe,Jp(l,y,S,k),Xp();var Ne=l.memoizedState;M!==Ge||Pe!==Ne||il||s!==null&&s.dependencies!==null&&ay(s.dependencies)?(typeof V=="function"&&(wk(l,p,V,y),Ne=l.memoizedState),(Ue=il||RR(l,p,Ue,y,Pe,Ne,oe)||s!==null&&s.dependencies!==null&&ay(s.dependencies))?(Te||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(y,Ne,oe),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(y,Ne,oe)),typeof S.componentDidUpdate=="function"&&(l.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof S.componentDidUpdate!="function"||M===s.memoizedProps&&Pe===s.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||M===s.memoizedProps&&Pe===s.memoizedState||(l.flags|=1024),l.memoizedProps=y,l.memoizedState=Ne),S.props=y,S.state=Ne,S.context=oe,y=Ue):(typeof S.componentDidUpdate!="function"||M===s.memoizedProps&&Pe===s.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||M===s.memoizedProps&&Pe===s.memoizedState||(l.flags|=1024),y=!1)}return S=y,Sy(s,l),y=(l.flags&128)!==0,S||y?(S=l.stateNode,p=y&&typeof p.getDerivedStateFromError!="function"?null:S.render(),l.flags|=1,s!==null&&y?(l.child=Au(l,s.child,null,k),l.child=Au(l,null,p,k)):ba(s,l,p,k),l.memoizedState=S.state,s=l.child):s=fc(s,l,k),s}function GR(s,l,p,y){return Su(),l.flags|=256,ba(s,l,p,y),l.child}var xk={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Pk(s){return{baseLanes:s,cachePool:M1()}}function Ak(s,l,p){return s=s!==null?s.childLanes&~p:0,l&&(s|=Pi),s}function WR(s,l,p){var y=l.pendingProps,k=!1,S=(l.flags&128)!==0,M;if((M=S)||(M=s!==null&&s.memoizedState===null?!1:(In.current&2)!==0),M&&(k=!0,l.flags&=-129),M=(l.flags&32)!==0,l.flags&=-33,s===null){if(Tr){if(k?cl(l):ll(),(s=mn)?(s=tD(s,Ji),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:tl!==null?{id:po,overflow:ho}:null,retryLane:536870912,hydrationErrors:null},p=C1(s),p.return=l,l.child=p,va=l,mn=null)):s=null,s===null)throw nl(l);return dw(s)?l.lanes=32:l.lanes=536870912,null}var V=y.children;return y=y.fallback,k?(ll(),k=l.mode,V=Ey({mode:"hidden",children:V},k),y=wu(y,k,p,null),V.return=l,y.return=l,V.sibling=y,l.child=V,y=l.child,y.memoizedState=Pk(p),y.childLanes=Ak(s,M,p),l.memoizedState=xk,rh(null,y)):(cl(l),Rk(l,V))}var oe=s.memoizedState;if(oe!==null&&(V=oe.dehydrated,V!==null)){if(S)l.flags&256?(cl(l),l.flags&=-257,l=Dk(s,l,p)):l.memoizedState!==null?(ll(),l.child=s.child,l.flags|=128,l=null):(ll(),V=y.fallback,k=l.mode,y=Ey({mode:"visible",children:y.children},k),V=wu(V,k,p,null),V.flags|=2,y.return=l,V.return=l,y.sibling=V,l.child=y,Au(l,s.child,null,p),y=l.child,y.memoizedState=Pk(p),y.childLanes=Ak(s,M,p),l.memoizedState=xk,l=rh(null,y));else if(cl(l),dw(V)){if(M=V.nextSibling&&V.nextSibling.dataset,M)var Te=M.dgst;M=Te,y=Error(n(419)),y.stack="",y.digest=M,Vp({value:y,source:null,stack:null}),l=Dk(s,l,p)}else if($n||Id(s,l,p,!1),M=(p&s.childLanes)!==0,$n||M){if(M=sn,M!==null&&(y=Zt(M,p),y!==0&&y!==oe.retryLane))throw oe.retryLane=y,ku(s,y),ti(M,s,y),Tk;uw(V)||Ny(),l=Dk(s,l,p)}else uw(V)?(l.flags|=192,l.child=s.child,l=null):(s=oe.treeContext,mn=Zi(V.nextSibling),va=l,Tr=!0,rl=null,Ji=!1,s!==null&&A1(l,s),l=Rk(l,y.children),l.flags|=4096);return l}return k?(ll(),V=y.fallback,k=l.mode,oe=s.child,Te=oe.sibling,y=sc(oe,{mode:"hidden",children:y.children}),y.subtreeFlags=oe.subtreeFlags&65011712,Te!==null?V=sc(Te,V):(V=wu(V,k,p,null),V.flags|=2),V.return=l,y.return=l,y.sibling=V,l.child=y,rh(null,y),y=l.child,V=s.child.memoizedState,V===null?V=Pk(p):(k=V.cachePool,k!==null?(oe=qn._currentValue,k=k.parent!==oe?{parent:oe,pool:oe}:k):k=M1(),V={baseLanes:V.baseLanes|p,cachePool:k}),y.memoizedState=V,y.childLanes=Ak(s,M,p),l.memoizedState=xk,rh(s.child,y)):(cl(l),p=s.child,s=p.sibling,p=sc(p,{mode:"visible",children:y.children}),p.return=l,p.sibling=null,s!==null&&(M=l.deletions,M===null?(l.deletions=[s],l.flags|=16):M.push(s)),l.child=p,l.memoizedState=null,p)}function Rk(s,l){return l=Ey({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Ey(s,l){return s=Ei(22,s,null,l),s.lanes=0,s}function Dk(s,l,p){return Au(l,s.child,null,p),s=Rk(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function KR(s,l,p){s.lanes|=l;var y=s.alternate;y!==null&&(y.lanes|=l),G0(s.return,l,p)}function Ok(s,l,p,y,k,S){var M=s.memoizedState;M===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:y,tail:p,tailMode:k,treeForkCount:S}:(M.isBackwards=l,M.rendering=null,M.renderingStartTime=0,M.last=y,M.tail=p,M.tailMode=k,M.treeForkCount=S)}function YR(s,l,p){var y=l.pendingProps,k=y.revealOrder,S=y.tail;y=y.children;var M=In.current,V=(M&2)!==0;if(V?(M=M&1|2,l.flags|=128):M&=1,ae(In,M),ba(s,l,y,p),y=Tr?$p:0,!V&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&KR(s,p,l);else if(s.tag===19)KR(s,p,l);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break e;for(;s.sibling===null;){if(s.return===null||s.return===l)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(k){case"forwards":for(p=l.child,k=null;p!==null;)s=p.alternate,s!==null&&fy(s)===null&&(k=p),p=p.sibling;p=k,p===null?(k=l.child,l.child=null):(k=p.sibling,p.sibling=null),Ok(l,!1,k,p,S,y);break;case"backwards":case"unstable_legacy-backwards":for(p=null,k=l.child,l.child=null;k!==null;){if(s=k.alternate,s!==null&&fy(s)===null){l.child=k;break}s=k.sibling,k.sibling=p,p=k,k=s}Ok(l,!0,p,null,S,y);break;case"together":Ok(l,!1,null,null,void 0,y);break;default:l.memoizedState=null}return l.child}function fc(s,l,p){if(s!==null&&(l.dependencies=s.dependencies),fl|=l.lanes,(p&l.childLanes)===0)if(s!==null){if(Id(s,l,p,!1),(p&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(n(153));if(l.child!==null){for(s=l.child,p=sc(s,s.pendingProps),l.child=p,p.return=l;s.sibling!==null;)s=s.sibling,p=p.sibling=sc(s,s.pendingProps),p.return=l;p.sibling=null}return l.child}function Nk(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&ay(s)))}function G$(s,l,p){switch(l.tag){case 3:He(l,l.stateNode.containerInfo),al(l,qn,s.memoizedState.cache),Su();break;case 27:case 5:xe(l);break;case 4:He(l,l.stateNode.containerInfo);break;case 10:al(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,ak(l),null;break;case 13:var y=l.memoizedState;if(y!==null)return y.dehydrated!==null?(cl(l),l.flags|=128,null):(p&l.child.childLanes)!==0?WR(s,l,p):(cl(l),s=fc(s,l,p),s!==null?s.sibling:null);cl(l);break;case 19:var k=(s.flags&128)!==0;if(y=(p&l.childLanes)!==0,y||(Id(s,l,p,!1),y=(p&l.childLanes)!==0),k){if(y)return YR(s,l,p);l.flags|=128}if(k=l.memoizedState,k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),ae(In,In.current),y)break;return null;case 22:return l.lanes=0,qR(s,l,p,l.pendingProps);case 24:al(l,qn,s.memoizedState.cache)}return fc(s,l,p)}function XR(s,l,p){if(s!==null)if(s.memoizedProps!==l.pendingProps)$n=!0;else{if(!Nk(s,p)&&(l.flags&128)===0)return $n=!1,G$(s,l,p);$n=(s.flags&131072)!==0}else $n=!1,Tr&&(l.flags&1048576)!==0&&P1(l,$p,l.index);switch(l.lanes=0,l.tag){case 16:e:{var y=l.pendingProps;if(s=xu(l.elementType),l.type=s,typeof s=="function")B0(s)?(y=Du(s,y),l.tag=1,l=HR(null,l,s,y,p)):(l.tag=0,l=Ck(null,l,s,y,p));else{if(s!=null){var k=s.$$typeof;if(k===A){l.tag=11,l=BR(null,l,s,y,p);break e}else if(k===I){l.tag=14,l=UR(null,l,s,y,p);break e}}throw l=U(s)||s,Error(n(306,l,""))}}return l;case 0:return Ck(s,l,l.type,l.pendingProps,p);case 1:return y=l.type,k=Du(y,l.pendingProps),HR(s,l,y,k,p);case 3:e:{if(He(l,l.stateNode.containerInfo),s===null)throw Error(n(387));y=l.pendingProps;var S=l.memoizedState;k=S.element,Z0(s,l),Jp(l,y,null,p);var M=l.memoizedState;if(y=M.cache,al(l,qn,y),y!==S.cache&&W0(l,[qn],p,!0),Xp(),y=M.element,S.isDehydrated)if(S={element:y,isDehydrated:!1,cache:M.cache},l.updateQueue.baseState=S,l.memoizedState=S,l.flags&256){l=GR(s,l,y,p);break e}else if(y!==k){k=Ki(Error(n(424)),l),Vp(k),l=GR(s,l,y,p);break e}else{switch(s=l.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(mn=Zi(s.firstChild),va=l,Tr=!0,rl=null,Ji=!0,p=q1(l,null,y,p),l.child=p;p;)p.flags=p.flags&-3|4096,p=p.sibling}else{if(Su(),y===k){l=fc(s,l,p);break e}ba(s,l,y,p)}l=l.child}return l;case 26:return Sy(s,l),s===null?(p=oD(l.type,null,l.pendingProps,null))?l.memoizedState=p:Tr||(p=l.type,s=l.pendingProps,y=Fy(ue.current).createElement(p),y[Rt]=l,y[Dt]=s,ka(y,p,s),hn(y),l.stateNode=y):l.memoizedState=oD(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return xe(l),s===null&&Tr&&(y=l.stateNode=aD(l.type,l.pendingProps,ue.current),va=l,Ji=!0,k=mn,yl(l.type)?(fw=k,mn=Zi(y.firstChild)):mn=k),ba(s,l,l.pendingProps.children,p),Sy(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Tr&&((k=y=mn)&&(y=w8(y,l.type,l.pendingProps,Ji),y!==null?(l.stateNode=y,va=l,mn=Zi(y.firstChild),Ji=!1,k=!0):k=!1),k||nl(l)),xe(l),k=l.type,S=l.pendingProps,M=s!==null?s.memoizedProps:null,y=S.children,ow(k,S)?y=null:M!==null&&ow(k,M)&&(l.flags|=32),l.memoizedState!==null&&(k=sk(s,l,L$,null,null,p),yh._currentValue=k),Sy(s,l),ba(s,l,y,p),l.child;case 6:return s===null&&Tr&&((s=p=mn)&&(p=S8(p,l.pendingProps,Ji),p!==null?(l.stateNode=p,va=l,mn=null,s=!0):s=!1),s||nl(l)),null;case 13:return WR(s,l,p);case 4:return He(l,l.stateNode.containerInfo),y=l.pendingProps,s===null?l.child=Au(l,null,y,p):ba(s,l,y,p),l.child;case 11:return BR(s,l,l.type,l.pendingProps,p);case 7:return ba(s,l,l.pendingProps,p),l.child;case 8:return ba(s,l,l.pendingProps.children,p),l.child;case 12:return ba(s,l,l.pendingProps.children,p),l.child;case 10:return y=l.pendingProps,al(l,l.type,y.value),ba(s,l,y.children,p),l.child;case 9:return k=l.type._context,y=l.pendingProps.children,Tu(l),k=_a(k),y=y(k),l.flags|=1,ba(s,l,y,p),l.child;case 14:return UR(s,l,l.type,l.pendingProps,p);case 15:return FR(s,l,l.type,l.pendingProps,p);case 19:return YR(s,l,p);case 31:return H$(s,l,p);case 22:return qR(s,l,p,l.pendingProps);case 24:return Tu(l),y=_a(qn),s===null?(k=X0(),k===null&&(k=sn,S=K0(),k.pooledCache=S,S.refCount++,S!==null&&(k.pooledCacheLanes|=p),k=S),l.memoizedState={parent:y,cache:k},Q0(l),al(l,qn,k)):((s.lanes&p)!==0&&(Z0(s,l),Jp(l,null,null,p),Xp()),k=s.memoizedState,S=l.memoizedState,k.parent!==y?(k={parent:y,cache:y},l.memoizedState=k,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=k),al(l,qn,y)):(y=S.cache,al(l,qn,y),y!==k.cache&&W0(l,[qn],p,!0))),ba(s,l,l.pendingProps.children,p),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function pc(s){s.flags|=4}function Ik(s,l,p,y,k){if((l=(s.mode&32)!==0)&&(l=!1),l){if(s.flags|=16777216,(k&335544128)===k)if(s.stateNode.complete)s.flags|=8192;else if(S2())s.flags|=8192;else throw Pu=cy,J0}else s.flags&=-16777217}function JR(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!fD(l))if(S2())s.flags|=8192;else throw Pu=cy,J0}function Ty(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?ee():536870912,s.lanes|=l,Gd|=l)}function nh(s,l){if(!Tr)switch(s.tailMode){case"hidden":l=s.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?s.tail=null:p.sibling=null;break;case"collapsed":p=s.tail;for(var y=null;p!==null;)p.alternate!==null&&(y=p),p=p.sibling;y===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:y.sibling=null}}function gn(s){var l=s.alternate!==null&&s.alternate.child===s.child,p=0,y=0;if(l)for(var k=s.child;k!==null;)p|=k.lanes|k.childLanes,y|=k.subtreeFlags&65011712,y|=k.flags&65011712,k.return=s,k=k.sibling;else for(k=s.child;k!==null;)p|=k.lanes|k.childLanes,y|=k.subtreeFlags,y|=k.flags,k.return=s,k=k.sibling;return s.subtreeFlags|=y,s.childLanes=p,l}function W$(s,l,p){var y=l.pendingProps;switch(z0(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gn(l),null;case 1:return gn(l),null;case 3:return p=l.stateNode,y=null,s!==null&&(y=s.memoizedState.cache),l.memoizedState.cache!==y&&(l.flags|=2048),lc(qn),ce(),p.pendingContext&&(p.context=p.pendingContext,p.pendingContext=null),(s===null||s.child===null)&&(Nd(l)?pc(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,V0())),gn(l),null;case 26:var k=l.type,S=l.memoizedState;return s===null?(pc(l),S!==null?(gn(l),JR(l,S)):(gn(l),Ik(l,k,null,y,p))):S?S!==s.memoizedState?(pc(l),gn(l),JR(l,S)):(gn(l),l.flags&=-16777217):(s=s.memoizedProps,s!==y&&pc(l),gn(l),Ik(l,k,s,y,p)),null;case 27:if(re(l),p=ue.current,k=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==y&&pc(l);else{if(!y){if(l.stateNode===null)throw Error(n(166));return gn(l),null}s=te.current,Nd(l)?R1(l):(s=aD(k,y,p),l.stateNode=s,pc(l))}return gn(l),null;case 5:if(re(l),k=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==y&&pc(l);else{if(!y){if(l.stateNode===null)throw Error(n(166));return gn(l),null}if(S=te.current,Nd(l))R1(l);else{var M=Fy(ue.current);switch(S){case 1:S=M.createElementNS("http://www.w3.org/2000/svg",k);break;case 2:S=M.createElementNS("http://www.w3.org/1998/Math/MathML",k);break;default:switch(k){case"svg":S=M.createElementNS("http://www.w3.org/2000/svg",k);break;case"math":S=M.createElementNS("http://www.w3.org/1998/Math/MathML",k);break;case"script":S=M.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof y.is=="string"?M.createElement("select",{is:y.is}):M.createElement("select"),y.multiple?S.multiple=!0:y.size&&(S.size=y.size);break;default:S=typeof y.is=="string"?M.createElement(k,{is:y.is}):M.createElement(k)}}S[Rt]=l,S[Dt]=y;e:for(M=l.child;M!==null;){if(M.tag===5||M.tag===6)S.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===l)break e;for(;M.sibling===null;){if(M.return===null||M.return===l)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}l.stateNode=S;e:switch(ka(S,k,y),k){case"button":case"input":case"select":case"textarea":y=!!y.autoFocus;break e;case"img":y=!0;break e;default:y=!1}y&&pc(l)}}return gn(l),Ik(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,p),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==y&&pc(l);else{if(typeof y!="string"&&l.stateNode===null)throw Error(n(166));if(s=ue.current,Nd(l)){if(s=l.stateNode,p=l.memoizedProps,y=null,k=va,k!==null)switch(k.tag){case 27:case 5:y=k.memoizedProps}s[Rt]=l,s=!!(s.nodeValue===p||y!==null&&y.suppressHydrationWarning===!0||W2(s.nodeValue,p)),s||nl(l,!0)}else s=Fy(s).createTextNode(y),s[Rt]=l,l.stateNode=s}return gn(l),null;case 31:if(p=l.memoizedState,s===null||s.memoizedState!==null){if(y=Nd(l),p!==null){if(s===null){if(!y)throw Error(n(318));if(s=l.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(557));s[Rt]=l}else Su(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;gn(l),s=!1}else p=V0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=p),s=!0;if(!s)return l.flags&256?(Ci(l),l):(Ci(l),null);if((l.flags&128)!==0)throw Error(n(558))}return gn(l),null;case 13:if(y=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(k=Nd(l),y!==null&&y.dehydrated!==null){if(s===null){if(!k)throw Error(n(318));if(k=l.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[Rt]=l}else Su(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;gn(l),k=!1}else k=V0(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=k),k=!0;if(!k)return l.flags&256?(Ci(l),l):(Ci(l),null)}return Ci(l),(l.flags&128)!==0?(l.lanes=p,l):(p=y!==null,s=s!==null&&s.memoizedState!==null,p&&(y=l.child,k=null,y.alternate!==null&&y.alternate.memoizedState!==null&&y.alternate.memoizedState.cachePool!==null&&(k=y.alternate.memoizedState.cachePool.pool),S=null,y.memoizedState!==null&&y.memoizedState.cachePool!==null&&(S=y.memoizedState.cachePool.pool),S!==k&&(y.flags|=2048)),p!==s&&p&&(l.child.flags|=8192),Ty(l,l.updateQueue),gn(l),null);case 4:return ce(),s===null&&rw(l.stateNode.containerInfo),gn(l),null;case 10:return lc(l.type),gn(l),null;case 19:if(K(In),y=l.memoizedState,y===null)return gn(l),null;if(k=(l.flags&128)!==0,S=y.rendering,S===null)if(k)nh(y,!1);else{if(xn!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(S=fy(s),S!==null){for(l.flags|=128,nh(y,!1),s=S.updateQueue,l.updateQueue=s,Ty(l,s),l.subtreeFlags=0,s=p,p=l.child;p!==null;)T1(p,s),p=p.sibling;return ae(In,In.current&1|2),Tr&&oc(l,y.treeForkCount),l.child}s=s.sibling}y.tail!==null&&_t()>Ry&&(l.flags|=128,k=!0,nh(y,!1),l.lanes=4194304)}else{if(!k)if(s=fy(S),s!==null){if(l.flags|=128,k=!0,s=s.updateQueue,l.updateQueue=s,Ty(l,s),nh(y,!0),y.tail===null&&y.tailMode==="hidden"&&!S.alternate&&!Tr)return gn(l),null}else 2*_t()-y.renderingStartTime>Ry&&p!==536870912&&(l.flags|=128,k=!0,nh(y,!1),l.lanes=4194304);y.isBackwards?(S.sibling=l.child,l.child=S):(s=y.last,s!==null?s.sibling=S:l.child=S,y.last=S)}return y.tail!==null?(s=y.tail,y.rendering=s,y.tail=s.sibling,y.renderingStartTime=_t(),s.sibling=null,p=In.current,ae(In,k?p&1|2:p&1),Tr&&oc(l,y.treeForkCount),s):(gn(l),null);case 22:case 23:return Ci(l),nk(),y=l.memoizedState!==null,s!==null?s.memoizedState!==null!==y&&(l.flags|=8192):y&&(l.flags|=8192),y?(p&536870912)!==0&&(l.flags&128)===0&&(gn(l),l.subtreeFlags&6&&(l.flags|=8192)):gn(l),p=l.updateQueue,p!==null&&Ty(l,p.retryQueue),p=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),y=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(y=l.memoizedState.cachePool.pool),y!==p&&(l.flags|=2048),s!==null&&K(Cu),null;case 24:return p=null,s!==null&&(p=s.memoizedState.cache),l.memoizedState.cache!==p&&(l.flags|=2048),lc(qn),gn(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function K$(s,l){switch(z0(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return lc(qn),ce(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return re(l),null;case 31:if(l.memoizedState!==null){if(Ci(l),l.alternate===null)throw Error(n(340));Su()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(Ci(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Su()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return K(In),null;case 4:return ce(),null;case 10:return lc(l.type),null;case 22:case 23:return Ci(l),nk(),s!==null&&K(Cu),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return lc(qn),null;case 25:return null;default:return null}}function QR(s,l){switch(z0(l),l.tag){case 3:lc(qn),ce();break;case 26:case 27:case 5:re(l);break;case 4:ce();break;case 31:l.memoizedState!==null&&Ci(l);break;case 13:Ci(l);break;case 19:K(In);break;case 10:lc(l.type);break;case 22:case 23:Ci(l),nk(),s!==null&&K(Cu);break;case 24:lc(qn)}}function ah(s,l){try{var p=l.updateQueue,y=p!==null?p.lastEffect:null;if(y!==null){var k=y.next;p=k;do{if((p.tag&s)===s){y=void 0;var S=p.create,M=p.inst;y=S(),M.destroy=y}p=p.next}while(p!==k)}}catch(V){Kr(l,l.return,V)}}function ul(s,l,p){try{var y=l.updateQueue,k=y!==null?y.lastEffect:null;if(k!==null){var S=k.next;y=S;do{if((y.tag&s)===s){var M=y.inst,V=M.destroy;if(V!==void 0){M.destroy=void 0,k=l;var oe=p,Te=V;try{Te()}catch(Ue){Kr(k,oe,Ue)}}}y=y.next}while(y!==S)}}catch(Ue){Kr(l,l.return,Ue)}}function ZR(s){var l=s.updateQueue;if(l!==null){var p=s.stateNode;try{$1(l,p)}catch(y){Kr(s,s.return,y)}}}function e2(s,l,p){p.props=Du(s.type,s.memoizedProps),p.state=s.memoizedState;try{p.componentWillUnmount()}catch(y){Kr(s,l,y)}}function ih(s,l){try{var p=s.ref;if(p!==null){switch(s.tag){case 26:case 27:case 5:var y=s.stateNode;break;case 30:y=s.stateNode;break;default:y=s.stateNode}typeof p=="function"?s.refCleanup=p(y):p.current=y}}catch(k){Kr(s,l,k)}}function mo(s,l){var p=s.ref,y=s.refCleanup;if(p!==null)if(typeof y=="function")try{y()}catch(k){Kr(s,l,k)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(k){Kr(s,l,k)}else p.current=null}function t2(s){var l=s.type,p=s.memoizedProps,y=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":p.autoFocus&&y.focus();break e;case"img":p.src?y.src=p.src:p.srcSet&&(y.srcset=p.srcSet)}}catch(k){Kr(s,s.return,k)}}function Mk(s,l,p){try{var y=s.stateNode;g8(y,s.type,p,l),y[Dt]=l}catch(k){Kr(s,s.return,k)}}function r2(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&yl(s.type)||s.tag===4}function jk(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||r2(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&yl(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Lk(s,l,p){var y=s.tag;if(y===5||y===6)s=s.stateNode,l?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(s,l):(l=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,l.appendChild(s),p=p._reactRootContainer,p!=null||l.onclick!==null||(l.onclick=ya));else if(y!==4&&(y===27&&yl(s.type)&&(p=s.stateNode,l=null),s=s.child,s!==null))for(Lk(s,l,p),s=s.sibling;s!==null;)Lk(s,l,p),s=s.sibling}function Cy(s,l,p){var y=s.tag;if(y===5||y===6)s=s.stateNode,l?p.insertBefore(s,l):p.appendChild(s);else if(y!==4&&(y===27&&yl(s.type)&&(p=s.stateNode),s=s.child,s!==null))for(Cy(s,l,p),s=s.sibling;s!==null;)Cy(s,l,p),s=s.sibling}function n2(s){var l=s.stateNode,p=s.memoizedProps;try{for(var y=s.type,k=l.attributes;k.length;)l.removeAttributeNode(k[0]);ka(l,y,p),l[Rt]=s,l[Dt]=p}catch(S){Kr(s,s.return,S)}}var hc=!1,Vn=!1,Bk=!1,a2=typeof WeakSet=="function"?WeakSet:Set,ua=null;function Y$(s,l){if(s=s.containerInfo,iw=Wy,s=g1(s),D0(s)){if("selectionStart"in s)var p={start:s.selectionStart,end:s.selectionEnd};else e:{p=(p=s.ownerDocument)&&p.defaultView||window;var y=p.getSelection&&p.getSelection();if(y&&y.rangeCount!==0){p=y.anchorNode;var k=y.anchorOffset,S=y.focusNode;y=y.focusOffset;try{p.nodeType,S.nodeType}catch{p=null;break e}var M=0,V=-1,oe=-1,Te=0,Ue=0,Ge=s,Pe=null;t:for(;;){for(var Ne;Ge!==p||k!==0&&Ge.nodeType!==3||(V=M+k),Ge!==S||y!==0&&Ge.nodeType!==3||(oe=M+y),Ge.nodeType===3&&(M+=Ge.nodeValue.length),(Ne=Ge.firstChild)!==null;)Pe=Ge,Ge=Ne;for(;;){if(Ge===s)break t;if(Pe===p&&++Te===k&&(V=M),Pe===S&&++Ue===y&&(oe=M),(Ne=Ge.nextSibling)!==null)break;Ge=Pe,Pe=Ge.parentNode}Ge=Ne}p=V===-1||oe===-1?null:{start:V,end:oe}}else p=null}p=p||{start:0,end:0}}else p=null;for(sw={focusedElem:s,selectionRange:p},Wy=!1,ua=l;ua!==null;)if(l=ua,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,ua=s;else for(;ua!==null;){switch(l=ua,S=l.alternate,s=l.flags,l.tag){case 0:if((s&4)!==0&&(s=l.updateQueue,s=s!==null?s.events:null,s!==null))for(p=0;p<s.length;p++)k=s[p],k.ref.impl=k.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&S!==null){s=void 0,p=l,k=S.memoizedProps,S=S.memoizedState,y=p.stateNode;try{var Pt=Du(p.type,k);s=y.getSnapshotBeforeUpdate(Pt,S),y.__reactInternalSnapshotBeforeUpdate=s}catch(Ht){Kr(p,p.return,Ht)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,p=s.nodeType,p===9)lw(s);else if(p===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":lw(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(n(163))}if(s=l.sibling,s!==null){s.return=l.return,ua=s;break}ua=l.return}}function i2(s,l,p){var y=p.flags;switch(p.tag){case 0:case 11:case 15:gc(s,p),y&4&&ah(5,p);break;case 1:if(gc(s,p),y&4)if(s=p.stateNode,l===null)try{s.componentDidMount()}catch(M){Kr(p,p.return,M)}else{var k=Du(p.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(k,l,s.__reactInternalSnapshotBeforeUpdate)}catch(M){Kr(p,p.return,M)}}y&64&&ZR(p),y&512&&ih(p,p.return);break;case 3:if(gc(s,p),y&64&&(s=p.updateQueue,s!==null)){if(l=null,p.child!==null)switch(p.child.tag){case 27:case 5:l=p.child.stateNode;break;case 1:l=p.child.stateNode}try{$1(s,l)}catch(M){Kr(p,p.return,M)}}break;case 27:l===null&&y&4&&n2(p);case 26:case 5:gc(s,p),l===null&&y&4&&t2(p),y&512&&ih(p,p.return);break;case 12:gc(s,p);break;case 31:gc(s,p),y&4&&c2(s,p);break;case 13:gc(s,p),y&4&&l2(s,p),y&64&&(s=p.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(p=a8.bind(null,p),E8(s,p))));break;case 22:if(y=p.memoizedState!==null||hc,!y){l=l!==null&&l.memoizedState!==null||Vn,k=hc;var S=Vn;hc=y,(Vn=l)&&!S?yc(s,p,(p.subtreeFlags&8772)!==0):gc(s,p),hc=k,Vn=S}break;case 30:break;default:gc(s,p)}}function s2(s){var l=s.alternate;l!==null&&(s.alternate=null,s2(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&ec(l)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var _n=null,Ja=!1;function mc(s,l,p){for(p=p.child;p!==null;)o2(s,l,p),p=p.sibling}function o2(s,l,p){if(we&&typeof we.onCommitFiberUnmount=="function")try{we.onCommitFiberUnmount(at,p)}catch{}switch(p.tag){case 26:Vn||mo(p,l),mc(s,l,p),p.memoizedState?p.memoizedState.count--:p.stateNode&&(p=p.stateNode,p.parentNode.removeChild(p));break;case 27:Vn||mo(p,l);var y=_n,k=Ja;yl(p.type)&&(_n=p.stateNode,Ja=!1),mc(s,l,p),hh(p.stateNode),_n=y,Ja=k;break;case 5:Vn||mo(p,l);case 6:if(y=_n,k=Ja,_n=null,mc(s,l,p),_n=y,Ja=k,_n!==null)if(Ja)try{(_n.nodeType===9?_n.body:_n.nodeName==="HTML"?_n.ownerDocument.body:_n).removeChild(p.stateNode)}catch(S){Kr(p,l,S)}else try{_n.removeChild(p.stateNode)}catch(S){Kr(p,l,S)}break;case 18:_n!==null&&(Ja?(s=_n,Z2(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,p.stateNode),ef(s)):Z2(_n,p.stateNode));break;case 4:y=_n,k=Ja,_n=p.stateNode.containerInfo,Ja=!0,mc(s,l,p),_n=y,Ja=k;break;case 0:case 11:case 14:case 15:ul(2,p,l),Vn||ul(4,p,l),mc(s,l,p);break;case 1:Vn||(mo(p,l),y=p.stateNode,typeof y.componentWillUnmount=="function"&&e2(p,l,y)),mc(s,l,p);break;case 21:mc(s,l,p);break;case 22:Vn=(y=Vn)||p.memoizedState!==null,mc(s,l,p),Vn=y;break;default:mc(s,l,p)}}function c2(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{ef(s)}catch(p){Kr(l,l.return,p)}}}function l2(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{ef(s)}catch(p){Kr(l,l.return,p)}}function X$(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new a2),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new a2),l;default:throw Error(n(435,s.tag))}}function xy(s,l){var p=X$(s);l.forEach(function(y){if(!p.has(y)){p.add(y);var k=i8.bind(null,s,y);y.then(k,k)}})}function Qa(s,l){var p=l.deletions;if(p!==null)for(var y=0;y<p.length;y++){var k=p[y],S=s,M=l,V=M;e:for(;V!==null;){switch(V.tag){case 27:if(yl(V.type)){_n=V.stateNode,Ja=!1;break e}break;case 5:_n=V.stateNode,Ja=!1;break e;case 3:case 4:_n=V.stateNode.containerInfo,Ja=!0;break e}V=V.return}if(_n===null)throw Error(n(160));o2(S,M,k),_n=null,Ja=!1,S=k.alternate,S!==null&&(S.return=null),k.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)u2(l,s),l=l.sibling}var Ns=null;function u2(s,l){var p=s.alternate,y=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Qa(l,s),Za(s),y&4&&(ul(3,s,s.return),ah(3,s),ul(5,s,s.return));break;case 1:Qa(l,s),Za(s),y&512&&(Vn||p===null||mo(p,p.return)),y&64&&hc&&(s=s.updateQueue,s!==null&&(y=s.callbacks,y!==null&&(p=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=p===null?y:p.concat(y))));break;case 26:var k=Ns;if(Qa(l,s),Za(s),y&512&&(Vn||p===null||mo(p,p.return)),y&4){var S=p!==null?p.memoizedState:null;if(y=s.memoizedState,p===null)if(y===null)if(s.stateNode===null){e:{y=s.type,p=s.memoizedProps,k=k.ownerDocument||k;t:switch(y){case"title":S=k.getElementsByTagName("title")[0],(!S||S[pn]||S[Rt]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=k.createElement(y),k.head.insertBefore(S,k.querySelector("head > title"))),ka(S,y,p),S[Rt]=s,hn(S),y=S;break e;case"link":var M=uD("link","href",k).get(y+(p.href||""));if(M){for(var V=0;V<M.length;V++)if(S=M[V],S.getAttribute("href")===(p.href==null||p.href===""?null:p.href)&&S.getAttribute("rel")===(p.rel==null?null:p.rel)&&S.getAttribute("title")===(p.title==null?null:p.title)&&S.getAttribute("crossorigin")===(p.crossOrigin==null?null:p.crossOrigin)){M.splice(V,1);break t}}S=k.createElement(y),ka(S,y,p),k.head.appendChild(S);break;case"meta":if(M=uD("meta","content",k).get(y+(p.content||""))){for(V=0;V<M.length;V++)if(S=M[V],S.getAttribute("content")===(p.content==null?null:""+p.content)&&S.getAttribute("name")===(p.name==null?null:p.name)&&S.getAttribute("property")===(p.property==null?null:p.property)&&S.getAttribute("http-equiv")===(p.httpEquiv==null?null:p.httpEquiv)&&S.getAttribute("charset")===(p.charSet==null?null:p.charSet)){M.splice(V,1);break t}}S=k.createElement(y),ka(S,y,p),k.head.appendChild(S);break;default:throw Error(n(468,y))}S[Rt]=s,hn(S),y=S}s.stateNode=y}else dD(k,s.type,s.stateNode);else s.stateNode=lD(k,y,s.memoizedProps);else S!==y?(S===null?p.stateNode!==null&&(p=p.stateNode,p.parentNode.removeChild(p)):S.count--,y===null?dD(k,s.type,s.stateNode):lD(k,y,s.memoizedProps)):y===null&&s.stateNode!==null&&Mk(s,s.memoizedProps,p.memoizedProps)}break;case 27:Qa(l,s),Za(s),y&512&&(Vn||p===null||mo(p,p.return)),p!==null&&y&4&&Mk(s,s.memoizedProps,p.memoizedProps);break;case 5:if(Qa(l,s),Za(s),y&512&&(Vn||p===null||mo(p,p.return)),s.flags&32){k=s.stateNode;try{Je(k,"")}catch(Pt){Kr(s,s.return,Pt)}}y&4&&s.stateNode!=null&&(k=s.memoizedProps,Mk(s,k,p!==null?p.memoizedProps:k)),y&1024&&(Bk=!0);break;case 6:if(Qa(l,s),Za(s),y&4){if(s.stateNode===null)throw Error(n(162));y=s.memoizedProps,p=s.stateNode;try{p.nodeValue=y}catch(Pt){Kr(s,s.return,Pt)}}break;case 3:if($y=null,k=Ns,Ns=qy(l.containerInfo),Qa(l,s),Ns=k,Za(s),y&4&&p!==null&&p.memoizedState.isDehydrated)try{ef(l.containerInfo)}catch(Pt){Kr(s,s.return,Pt)}Bk&&(Bk=!1,d2(s));break;case 4:y=Ns,Ns=qy(s.stateNode.containerInfo),Qa(l,s),Za(s),Ns=y;break;case 12:Qa(l,s),Za(s);break;case 31:Qa(l,s),Za(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,xy(s,y)));break;case 13:Qa(l,s),Za(s),s.child.flags&8192&&s.memoizedState!==null!=(p!==null&&p.memoizedState!==null)&&(Ay=_t()),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,xy(s,y)));break;case 22:k=s.memoizedState!==null;var oe=p!==null&&p.memoizedState!==null,Te=hc,Ue=Vn;if(hc=Te||k,Vn=Ue||oe,Qa(l,s),Vn=Ue,hc=Te,Za(s),y&8192)e:for(l=s.stateNode,l._visibility=k?l._visibility&-2:l._visibility|1,k&&(p===null||oe||hc||Vn||Ou(s)),p=null,l=s;;){if(l.tag===5||l.tag===26){if(p===null){oe=p=l;try{if(S=oe.stateNode,k)M=S.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{V=oe.stateNode;var Ge=oe.memoizedProps.style,Pe=Ge!=null&&Ge.hasOwnProperty("display")?Ge.display:null;V.style.display=Pe==null||typeof Pe=="boolean"?"":(""+Pe).trim()}}catch(Pt){Kr(oe,oe.return,Pt)}}}else if(l.tag===6){if(p===null){oe=l;try{oe.stateNode.nodeValue=k?"":oe.memoizedProps}catch(Pt){Kr(oe,oe.return,Pt)}}}else if(l.tag===18){if(p===null){oe=l;try{var Ne=oe.stateNode;k?eD(Ne,!0):eD(oe.stateNode,!1)}catch(Pt){Kr(oe,oe.return,Pt)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===s)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break e;for(;l.sibling===null;){if(l.return===null||l.return===s)break e;p===l&&(p=null),l=l.return}p===l&&(p=null),l.sibling.return=l.return,l=l.sibling}y&4&&(y=s.updateQueue,y!==null&&(p=y.retryQueue,p!==null&&(y.retryQueue=null,xy(s,p))));break;case 19:Qa(l,s),Za(s),y&4&&(y=s.updateQueue,y!==null&&(s.updateQueue=null,xy(s,y)));break;case 30:break;case 21:break;default:Qa(l,s),Za(s)}}function Za(s){var l=s.flags;if(l&2){try{for(var p,y=s.return;y!==null;){if(r2(y)){p=y;break}y=y.return}if(p==null)throw Error(n(160));switch(p.tag){case 27:var k=p.stateNode,S=jk(s);Cy(s,S,k);break;case 5:var M=p.stateNode;p.flags&32&&(Je(M,""),p.flags&=-33);var V=jk(s);Cy(s,V,M);break;case 3:case 4:var oe=p.stateNode.containerInfo,Te=jk(s);Lk(s,Te,oe);break;default:throw Error(n(161))}}catch(Ue){Kr(s,s.return,Ue)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function d2(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;d2(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function gc(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)i2(s,l.alternate,l),l=l.sibling}function Ou(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:ul(4,l,l.return),Ou(l);break;case 1:mo(l,l.return);var p=l.stateNode;typeof p.componentWillUnmount=="function"&&e2(l,l.return,p),Ou(l);break;case 27:hh(l.stateNode);case 26:case 5:mo(l,l.return),Ou(l);break;case 22:l.memoizedState===null&&Ou(l);break;case 30:Ou(l);break;default:Ou(l)}s=s.sibling}}function yc(s,l,p){for(p=p&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var y=l.alternate,k=s,S=l,M=S.flags;switch(S.tag){case 0:case 11:case 15:yc(k,S,p),ah(4,S);break;case 1:if(yc(k,S,p),y=S,k=y.stateNode,typeof k.componentDidMount=="function")try{k.componentDidMount()}catch(Te){Kr(y,y.return,Te)}if(y=S,k=y.updateQueue,k!==null){var V=y.stateNode;try{var oe=k.shared.hiddenCallbacks;if(oe!==null)for(k.shared.hiddenCallbacks=null,k=0;k<oe.length;k++)z1(oe[k],V)}catch(Te){Kr(y,y.return,Te)}}p&&M&64&&ZR(S),ih(S,S.return);break;case 27:n2(S);case 26:case 5:yc(k,S,p),p&&y===null&&M&4&&t2(S),ih(S,S.return);break;case 12:yc(k,S,p);break;case 31:yc(k,S,p),p&&M&4&&c2(k,S);break;case 13:yc(k,S,p),p&&M&4&&l2(k,S);break;case 22:S.memoizedState===null&&yc(k,S,p),ih(S,S.return);break;case 30:break;default:yc(k,S,p)}l=l.sibling}}function Uk(s,l){var p=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(p=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==p&&(s!=null&&s.refCount++,p!=null&&Hp(p))}function Fk(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Hp(s))}function Is(s,l,p,y){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)f2(s,l,p,y),l=l.sibling}function f2(s,l,p,y){var k=l.flags;switch(l.tag){case 0:case 11:case 15:Is(s,l,p,y),k&2048&&ah(9,l);break;case 1:Is(s,l,p,y);break;case 3:Is(s,l,p,y),k&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Hp(s)));break;case 12:if(k&2048){Is(s,l,p,y),s=l.stateNode;try{var S=l.memoizedProps,M=S.id,V=S.onPostCommit;typeof V=="function"&&V(M,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(oe){Kr(l,l.return,oe)}}else Is(s,l,p,y);break;case 31:Is(s,l,p,y);break;case 13:Is(s,l,p,y);break;case 23:break;case 22:S=l.stateNode,M=l.alternate,l.memoizedState!==null?S._visibility&2?Is(s,l,p,y):sh(s,l):S._visibility&2?Is(s,l,p,y):(S._visibility|=2,$d(s,l,p,y,(l.subtreeFlags&10256)!==0||!1)),k&2048&&Uk(M,l);break;case 24:Is(s,l,p,y),k&2048&&Fk(l.alternate,l);break;default:Is(s,l,p,y)}}function $d(s,l,p,y,k){for(k=k&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var S=s,M=l,V=p,oe=y,Te=M.flags;switch(M.tag){case 0:case 11:case 15:$d(S,M,V,oe,k),ah(8,M);break;case 23:break;case 22:var Ue=M.stateNode;M.memoizedState!==null?Ue._visibility&2?$d(S,M,V,oe,k):sh(S,M):(Ue._visibility|=2,$d(S,M,V,oe,k)),k&&Te&2048&&Uk(M.alternate,M);break;case 24:$d(S,M,V,oe,k),k&&Te&2048&&Fk(M.alternate,M);break;default:$d(S,M,V,oe,k)}l=l.sibling}}function sh(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var p=s,y=l,k=y.flags;switch(y.tag){case 22:sh(p,y),k&2048&&Uk(y.alternate,y);break;case 24:sh(p,y),k&2048&&Fk(y.alternate,y);break;default:sh(p,y)}l=l.sibling}}var oh=8192;function Vd(s,l,p){if(s.subtreeFlags&oh)for(s=s.child;s!==null;)p2(s,l,p),s=s.sibling}function p2(s,l,p){switch(s.tag){case 26:Vd(s,l,p),s.flags&oh&&s.memoizedState!==null&&j8(p,Ns,s.memoizedState,s.memoizedProps);break;case 5:Vd(s,l,p);break;case 3:case 4:var y=Ns;Ns=qy(s.stateNode.containerInfo),Vd(s,l,p),Ns=y;break;case 22:s.memoizedState===null&&(y=s.alternate,y!==null&&y.memoizedState!==null?(y=oh,oh=16777216,Vd(s,l,p),oh=y):Vd(s,l,p));break;default:Vd(s,l,p)}}function h2(s){var l=s.alternate;if(l!==null&&(s=l.child,s!==null)){l.child=null;do l=s.sibling,s.sibling=null,s=l;while(s!==null)}}function ch(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var y=l[p];ua=y,g2(y,s)}h2(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)m2(s),s=s.sibling}function m2(s){switch(s.tag){case 0:case 11:case 15:ch(s),s.flags&2048&&ul(9,s,s.return);break;case 3:ch(s);break;case 12:ch(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Py(s)):ch(s);break;default:ch(s)}}function Py(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var p=0;p<l.length;p++){var y=l[p];ua=y,g2(y,s)}h2(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:ul(8,l,l.return),Py(l);break;case 22:p=l.stateNode,p._visibility&2&&(p._visibility&=-3,Py(l));break;default:Py(l)}s=s.sibling}}function g2(s,l){for(;ua!==null;){var p=ua;switch(p.tag){case 0:case 11:case 15:ul(8,p,l);break;case 23:case 22:if(p.memoizedState!==null&&p.memoizedState.cachePool!==null){var y=p.memoizedState.cachePool.pool;y!=null&&y.refCount++}break;case 24:Hp(p.memoizedState.cache)}if(y=p.child,y!==null)y.return=p,ua=y;else e:for(p=s;ua!==null;){y=ua;var k=y.sibling,S=y.return;if(s2(y),y===p){ua=null;break e}if(k!==null){k.return=S,ua=k;break e}ua=S}}}var J$={getCacheForType:function(s){var l=_a(qn),p=l.data.get(s);return p===void 0&&(p=s(),l.data.set(s,p)),p},cacheSignal:function(){return _a(qn).controller.signal}},Q$=typeof WeakMap=="function"?WeakMap:Map,Br=0,sn=null,gr=null,br=0,Wr=0,xi=null,dl=!1,Hd=!1,qk=!1,vc=0,xn=0,fl=0,Nu=0,zk=0,Pi=0,Gd=0,lh=null,ei=null,$k=!1,Ay=0,y2=0,Ry=1/0,Dy=null,pl=null,ra=0,hl=null,Wd=null,_c=0,Vk=0,Hk=null,v2=null,uh=0,Gk=null;function Ai(){return(Br&2)!==0&&br!==0?br&-br:F.T!==null?Qk():Ye()}function _2(){if(Pi===0)if((br&536870912)===0||Tr){var s=un;un<<=1,(un&3932160)===0&&(un=262144),Pi=s}else Pi=536870912;return s=Ti.current,s!==null&&(s.flags|=32),Pi}function ti(s,l,p){(s===sn&&(Wr===2||Wr===9)||s.cancelPendingCommit!==null)&&(Kd(s,0),ml(s,br,Pi,!1)),Oe(s,p),((Br&2)===0||s!==sn)&&(s===sn&&((Br&2)===0&&(Nu|=p),xn===4&&ml(s,br,Pi,!1)),go(s))}function b2(s,l,p){if((Br&6)!==0)throw Error(n(327));var y=!p&&(l&127)===0&&(l&s.expiredLanes)===0||be(s,l),k=y?t8(s,l):Kk(s,l,!0),S=y;do{if(k===0){Hd&&!y&&ml(s,l,0,!1);break}else{if(p=s.current.alternate,S&&!Z$(p)){k=Kk(s,l,!1),S=!1;continue}if(k===2){if(S=l,s.errorRecoveryDisabledLanes&S)var M=0;else M=s.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){l=M;e:{var V=s;k=lh;var oe=V.current.memoizedState.isDehydrated;if(oe&&(Kd(V,M).flags|=256),M=Kk(V,M,!1),M!==2){if(qk&&!oe){V.errorRecoveryDisabledLanes|=S,Nu|=S,k=4;break e}S=ei,ei=k,S!==null&&(ei===null?ei=S:ei.push.apply(ei,S))}k=M}if(S=!1,k!==2)continue}}if(k===1){Kd(s,0),ml(s,l,0,!0);break}e:{switch(y=s,S=k,S){case 0:case 1:throw Error(n(345));case 4:if((l&4194048)!==l)break;case 6:ml(y,l,Pi,!dl);break e;case 2:ei=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(k=Ay+300-_t(),10<k)){if(ml(y,l,Pi,!dl),le(y,0,!0)!==0)break e;_c=l,y.timeoutHandle=J2(k2.bind(null,y,p,ei,Dy,$k,l,Pi,Nu,Gd,dl,S,"Throttled",-0,0),k);break e}k2(y,p,ei,Dy,$k,l,Pi,Nu,Gd,dl,S,null,-0,0)}}break}while(!0);go(s)}function k2(s,l,p,y,k,S,M,V,oe,Te,Ue,Ge,Pe,Ne){if(s.timeoutHandle=-1,Ge=l.subtreeFlags,Ge&8192||(Ge&16785408)===16785408){Ge={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ya},p2(l,S,Ge);var Pt=(S&62914560)===S?Ay-_t():(S&4194048)===S?y2-_t():0;if(Pt=L8(Ge,Pt),Pt!==null){_c=S,s.cancelPendingCommit=Pt(A2.bind(null,s,l,S,p,y,k,M,V,oe,Ue,Ge,null,Pe,Ne)),ml(s,S,M,!Te);return}}A2(s,l,S,p,y,k,M,V,oe)}function Z$(s){for(var l=s;;){var p=l.tag;if((p===0||p===11||p===15)&&l.flags&16384&&(p=l.updateQueue,p!==null&&(p=p.stores,p!==null)))for(var y=0;y<p.length;y++){var k=p[y],S=k.getSnapshot;k=k.value;try{if(!Si(S(),k))return!1}catch{return!1}}if(p=l.child,l.subtreeFlags&16384&&p!==null)p.return=l,l=p;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function ml(s,l,p,y){l&=~zk,l&=~Nu,s.suspendedLanes|=l,s.pingedLanes&=~l,y&&(s.warmLanes|=l),y=s.expirationTimes;for(var k=l;0<k;){var S=31-bt(k),M=1<<S;y[S]=-1,k&=~M}p!==0&&er(s,p,l)}function Oy(){return(Br&6)===0?(dh(0),!1):!0}function Wk(){if(gr!==null){if(Wr===0)var s=gr.return;else s=gr,cc=Eu=null,lk(s),Bd=null,Wp=0,s=gr;for(;s!==null;)QR(s.alternate,s),s=s.return;gr=null}}function Kd(s,l){var p=s.timeoutHandle;p!==-1&&(s.timeoutHandle=-1,_8(p)),p=s.cancelPendingCommit,p!==null&&(s.cancelPendingCommit=null,p()),_c=0,Wk(),sn=s,gr=p=sc(s.current,null),br=l,Wr=0,xi=null,dl=!1,Hd=be(s,l),qk=!1,Gd=Pi=zk=Nu=fl=xn=0,ei=lh=null,$k=!1,(l&8)!==0&&(l|=l&32);var y=s.entangledLanes;if(y!==0)for(s=s.entanglements,y&=l;0<y;){var k=31-bt(y),S=1<<k;l|=s[k],y&=~S}return vc=l,Zg(),p}function w2(s,l){ar=null,F.H=th,l===Ld||l===oy?(l=B1(),Wr=3):l===J0?(l=B1(),Wr=4):Wr=l===Tk?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,xi=l,gr===null&&(xn=1,ky(s,Ki(l,s.current)))}function S2(){var s=Ti.current;return s===null?!0:(br&4194048)===br?Qi===null:(br&62914560)===br||(br&536870912)!==0?s===Qi:!1}function E2(){var s=F.H;return F.H=th,s===null?th:s}function T2(){var s=F.A;return F.A=J$,s}function Ny(){xn=4,dl||(br&4194048)!==br&&Ti.current!==null||(Hd=!0),(fl&134217727)===0&&(Nu&134217727)===0||sn===null||ml(sn,br,Pi,!1)}function Kk(s,l,p){var y=Br;Br|=2;var k=E2(),S=T2();(sn!==s||br!==l)&&(Dy=null,Kd(s,l)),l=!1;var M=xn;e:do try{if(Wr!==0&&gr!==null){var V=gr,oe=xi;switch(Wr){case 8:Wk(),M=6;break e;case 3:case 2:case 9:case 6:Ti.current===null&&(l=!0);var Te=Wr;if(Wr=0,xi=null,Yd(s,V,oe,Te),p&&Hd){M=0;break e}break;default:Te=Wr,Wr=0,xi=null,Yd(s,V,oe,Te)}}e8(),M=xn;break}catch(Ue){w2(s,Ue)}while(!0);return l&&s.shellSuspendCounter++,cc=Eu=null,Br=y,F.H=k,F.A=S,gr===null&&(sn=null,br=0,Zg()),M}function e8(){for(;gr!==null;)C2(gr)}function t8(s,l){var p=Br;Br|=2;var y=E2(),k=T2();sn!==s||br!==l?(Dy=null,Ry=_t()+500,Kd(s,l)):Hd=be(s,l);e:do try{if(Wr!==0&&gr!==null){l=gr;var S=xi;t:switch(Wr){case 1:Wr=0,xi=null,Yd(s,l,S,1);break;case 2:case 9:if(j1(S)){Wr=0,xi=null,x2(l);break}l=function(){Wr!==2&&Wr!==9||sn!==s||(Wr=7),go(s)},S.then(l,l);break e;case 3:Wr=7;break e;case 4:Wr=5;break e;case 7:j1(S)?(Wr=0,xi=null,x2(l)):(Wr=0,xi=null,Yd(s,l,S,7));break;case 5:var M=null;switch(gr.tag){case 26:M=gr.memoizedState;case 5:case 27:var V=gr;if(M?fD(M):V.stateNode.complete){Wr=0,xi=null;var oe=V.sibling;if(oe!==null)gr=oe;else{var Te=V.return;Te!==null?(gr=Te,Iy(Te)):gr=null}break t}}Wr=0,xi=null,Yd(s,l,S,5);break;case 6:Wr=0,xi=null,Yd(s,l,S,6);break;case 8:Wk(),xn=6;break e;default:throw Error(n(462))}}r8();break}catch(Ue){w2(s,Ue)}while(!0);return cc=Eu=null,F.H=y,F.A=k,Br=p,gr!==null?0:(sn=null,br=0,Zg(),xn)}function r8(){for(;gr!==null&&!Et();)C2(gr)}function C2(s){var l=XR(s.alternate,s,vc);s.memoizedProps=s.pendingProps,l===null?Iy(s):gr=l}function x2(s){var l=s,p=l.alternate;switch(l.tag){case 15:case 0:l=VR(p,l,l.pendingProps,l.type,void 0,br);break;case 11:l=VR(p,l,l.pendingProps,l.type.render,l.ref,br);break;case 5:lk(l);default:QR(p,l),l=gr=T1(l,vc),l=XR(p,l,vc)}s.memoizedProps=s.pendingProps,l===null?Iy(s):gr=l}function Yd(s,l,p,y){cc=Eu=null,lk(l),Bd=null,Wp=0;var k=l.return;try{if(V$(s,k,l,p,br)){xn=1,ky(s,Ki(p,s.current)),gr=null;return}}catch(S){if(k!==null)throw gr=k,S;xn=1,ky(s,Ki(p,s.current)),gr=null;return}l.flags&32768?(Tr||y===1?s=!0:Hd||(br&536870912)!==0?s=!1:(dl=s=!0,(y===2||y===9||y===3||y===6)&&(y=Ti.current,y!==null&&y.tag===13&&(y.flags|=16384))),P2(l,s)):Iy(l)}function Iy(s){var l=s;do{if((l.flags&32768)!==0){P2(l,dl);return}s=l.return;var p=W$(l.alternate,l,vc);if(p!==null){gr=p;return}if(l=l.sibling,l!==null){gr=l;return}gr=l=s}while(l!==null);xn===0&&(xn=5)}function P2(s,l){do{var p=K$(s.alternate,s);if(p!==null){p.flags&=32767,gr=p;return}if(p=s.return,p!==null&&(p.flags|=32768,p.subtreeFlags=0,p.deletions=null),!l&&(s=s.sibling,s!==null)){gr=s;return}gr=s=p}while(s!==null);xn=6,gr=null}function A2(s,l,p,y,k,S,M,V,oe){s.cancelPendingCommit=null;do My();while(ra!==0);if((Br&6)!==0)throw Error(n(327));if(l!==null){if(l===s.current)throw Error(n(177));if(S=l.lanes|l.childLanes,S|=j0,wt(s,p,S,M,V,oe),s===sn&&(gr=sn=null,br=0),Wd=l,hl=s,_c=p,Vk=S,Hk=k,v2=y,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,s8(rt,function(){return I2(),null})):(s.callbackNode=null,s.callbackPriority=0),y=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||y){y=F.T,F.T=null,k=Y.p,Y.p=2,M=Br,Br|=4;try{Y$(s,l,p)}finally{Br=M,Y.p=k,F.T=y}}ra=1,R2(),D2(),O2()}}function R2(){if(ra===1){ra=0;var s=hl,l=Wd,p=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||p){p=F.T,F.T=null;var y=Y.p;Y.p=2;var k=Br;Br|=4;try{u2(l,s);var S=sw,M=g1(s.containerInfo),V=S.focusedElem,oe=S.selectionRange;if(M!==V&&V&&V.ownerDocument&&m1(V.ownerDocument.documentElement,V)){if(oe!==null&&D0(V)){var Te=oe.start,Ue=oe.end;if(Ue===void 0&&(Ue=Te),"selectionStart"in V)V.selectionStart=Te,V.selectionEnd=Math.min(Ue,V.value.length);else{var Ge=V.ownerDocument||document,Pe=Ge&&Ge.defaultView||window;if(Pe.getSelection){var Ne=Pe.getSelection(),Pt=V.textContent.length,Ht=Math.min(oe.start,Pt),Zr=oe.end===void 0?Ht:Math.min(oe.end,Pt);!Ne.extend&&Ht>Zr&&(M=Zr,Zr=Ht,Ht=M);var ve=h1(V,Ht),de=h1(V,Zr);if(ve&&de&&(Ne.rangeCount!==1||Ne.anchorNode!==ve.node||Ne.anchorOffset!==ve.offset||Ne.focusNode!==de.node||Ne.focusOffset!==de.offset)){var Ee=Ge.createRange();Ee.setStart(ve.node,ve.offset),Ne.removeAllRanges(),Ht>Zr?(Ne.addRange(Ee),Ne.extend(de.node,de.offset)):(Ee.setEnd(de.node,de.offset),Ne.addRange(Ee))}}}}for(Ge=[],Ne=V;Ne=Ne.parentNode;)Ne.nodeType===1&&Ge.push({element:Ne,left:Ne.scrollLeft,top:Ne.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<Ge.length;V++){var qe=Ge[V];qe.element.scrollLeft=qe.left,qe.element.scrollTop=qe.top}}Wy=!!iw,sw=iw=null}finally{Br=k,Y.p=y,F.T=p}}s.current=l,ra=2}}function D2(){if(ra===2){ra=0;var s=hl,l=Wd,p=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||p){p=F.T,F.T=null;var y=Y.p;Y.p=2;var k=Br;Br|=4;try{i2(s,l.alternate,l)}finally{Br=k,Y.p=y,F.T=p}}ra=3}}function O2(){if(ra===4||ra===3){ra=0,Mt();var s=hl,l=Wd,p=_c,y=v2;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?ra=5:(ra=0,Wd=hl=null,N2(s,s.pendingLanes));var k=s.pendingLanes;if(k===0&&(pl=null),On(p),l=l.stateNode,we&&typeof we.onCommitFiberRoot=="function")try{we.onCommitFiberRoot(at,l,void 0,(l.current.flags&128)===128)}catch{}if(y!==null){l=F.T,k=Y.p,Y.p=2,F.T=null;try{for(var S=s.onRecoverableError,M=0;M<y.length;M++){var V=y[M];S(V.value,{componentStack:V.stack})}}finally{F.T=l,Y.p=k}}(_c&3)!==0&&My(),go(s),k=s.pendingLanes,(p&261930)!==0&&(k&42)!==0?s===Gk?uh++:(uh=0,Gk=s):uh=0,dh(0)}}function N2(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,Hp(l)))}function My(){return R2(),D2(),O2(),I2()}function I2(){if(ra!==5)return!1;var s=hl,l=Vk;Vk=0;var p=On(_c),y=F.T,k=Y.p;try{Y.p=32>p?32:p,F.T=null,p=Hk,Hk=null;var S=hl,M=_c;if(ra=0,Wd=hl=null,_c=0,(Br&6)!==0)throw Error(n(331));var V=Br;if(Br|=4,m2(S.current),f2(S,S.current,M,p),Br=V,dh(0,!1),we&&typeof we.onPostCommitFiberRoot=="function")try{we.onPostCommitFiberRoot(at,S)}catch{}return!0}finally{Y.p=k,F.T=y,N2(s,l)}}function M2(s,l,p){l=Ki(p,l),l=Ek(s.stateNode,l,2),s=ol(s,l,2),s!==null&&(Oe(s,2),go(s))}function Kr(s,l,p){if(s.tag===3)M2(s,s,p);else for(;l!==null;){if(l.tag===3){M2(l,s,p);break}else if(l.tag===1){var y=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof y.componentDidCatch=="function"&&(pl===null||!pl.has(y))){s=Ki(p,s),p=jR(2),y=ol(l,p,2),y!==null&&(LR(p,y,l,s),Oe(y,2),go(y));break}}l=l.return}}function Yk(s,l,p){var y=s.pingCache;if(y===null){y=s.pingCache=new Q$;var k=new Set;y.set(l,k)}else k=y.get(l),k===void 0&&(k=new Set,y.set(l,k));k.has(p)||(qk=!0,k.add(p),s=n8.bind(null,s,l,p),l.then(s,s))}function n8(s,l,p){var y=s.pingCache;y!==null&&y.delete(l),s.pingedLanes|=s.suspendedLanes&p,s.warmLanes&=~p,sn===s&&(br&p)===p&&(xn===4||xn===3&&(br&62914560)===br&&300>_t()-Ay?(Br&2)===0&&Kd(s,0):zk|=p,Gd===br&&(Gd=0)),go(s)}function j2(s,l){l===0&&(l=ee()),s=ku(s,l),s!==null&&(Oe(s,l),go(s))}function a8(s){var l=s.memoizedState,p=0;l!==null&&(p=l.retryLane),j2(s,p)}function i8(s,l){var p=0;switch(s.tag){case 31:case 13:var y=s.stateNode,k=s.memoizedState;k!==null&&(p=k.retryLane);break;case 19:y=s.stateNode;break;case 22:y=s.stateNode._retryCache;break;default:throw Error(n(314))}y!==null&&y.delete(l),j2(s,p)}function s8(s,l){return We(s,l)}var jy=null,Xd=null,Xk=!1,Ly=!1,Jk=!1,gl=0;function go(s){s!==Xd&&s.next===null&&(Xd===null?jy=Xd=s:Xd=Xd.next=s),Ly=!0,Xk||(Xk=!0,c8())}function dh(s,l){if(!Jk&&Ly){Jk=!0;do for(var p=!1,y=jy;y!==null;){if(s!==0){var k=y.pendingLanes;if(k===0)var S=0;else{var M=y.suspendedLanes,V=y.pingedLanes;S=(1<<31-bt(42|s)+1)-1,S&=k&~(M&~V),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(p=!0,F2(y,S))}else S=br,S=le(y,y===sn?S:0,y.cancelPendingCommit!==null||y.timeoutHandle!==-1),(S&3)===0||be(y,S)||(p=!0,F2(y,S));y=y.next}while(p);Jk=!1}}function o8(){L2()}function L2(){Ly=Xk=!1;var s=0;gl!==0&&v8()&&(s=gl);for(var l=_t(),p=null,y=jy;y!==null;){var k=y.next,S=B2(y,l);S===0?(y.next=null,p===null?jy=k:p.next=k,k===null&&(Xd=p)):(p=y,(s!==0||(S&3)!==0)&&(Ly=!0)),y=k}ra!==0&&ra!==5||dh(s),gl!==0&&(gl=0)}function B2(s,l){for(var p=s.suspendedLanes,y=s.pingedLanes,k=s.expirationTimes,S=s.pendingLanes&-62914561;0<S;){var M=31-bt(S),V=1<<M,oe=k[M];oe===-1?((V&p)===0||(V&y)!==0)&&(k[M]=z(V,l)):oe<=l&&(s.expiredLanes|=V),S&=~V}if(l=sn,p=br,p=le(s,s===l?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y=s.callbackNode,p===0||s===l&&(Wr===2||Wr===9)||s.cancelPendingCommit!==null)return y!==null&&y!==null&&it(y),s.callbackNode=null,s.callbackPriority=0;if((p&3)===0||be(s,p)){if(l=p&-p,l===s.callbackPriority)return l;switch(y!==null&&it(y),On(p)){case 2:case 8:p=je;break;case 32:p=rt;break;case 268435456:p=jt;break;default:p=rt}return y=U2.bind(null,s),p=We(p,y),s.callbackPriority=l,s.callbackNode=p,l}return y!==null&&y!==null&&it(y),s.callbackPriority=2,s.callbackNode=null,2}function U2(s,l){if(ra!==0&&ra!==5)return s.callbackNode=null,s.callbackPriority=0,null;var p=s.callbackNode;if(My()&&s.callbackNode!==p)return null;var y=br;return y=le(s,s===sn?y:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),y===0?null:(b2(s,y,l),B2(s,_t()),s.callbackNode!=null&&s.callbackNode===p?U2.bind(null,s):null)}function F2(s,l){if(My())return null;b2(s,l,!0)}function c8(){b8(function(){(Br&6)!==0?We(Be,o8):L2()})}function Qk(){if(gl===0){var s=Md;s===0&&(s=Sr,Sr<<=1,(Sr&261888)===0&&(Sr=256)),gl=s}return gl}function q2(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:As(""+s)}function z2(s,l){var p=l.ownerDocument.createElement("input");return p.name=l.name,p.value=l.value,s.id&&p.setAttribute("form",s.id),l.parentNode.insertBefore(p,l),s=new FormData(s),p.parentNode.removeChild(p),s}function l8(s,l,p,y,k){if(l==="submit"&&p&&p.stateNode===k){var S=q2((k[Dt]||null).action),M=y.submitter;M&&(l=(l=M[Dt]||null)?q2(l.formAction):M.getAttribute("formAction"),l!==null&&(S=l,M=null));var V=new ac("action","action",null,y,k);s.push({event:V,listeners:[{instance:null,listener:function(){if(y.defaultPrevented){if(gl!==0){var oe=M?z2(k,M):new FormData(k);vk(p,{pending:!0,data:oe,method:k.method,action:S},null,oe)}}else typeof S=="function"&&(V.preventDefault(),oe=M?z2(k,M):new FormData(k),vk(p,{pending:!0,data:oe,method:k.method,action:S},S,oe))},currentTarget:k}]})}}for(var Zk=0;Zk<M0.length;Zk++){var ew=M0[Zk],u8=ew.toLowerCase(),d8=ew[0].toUpperCase()+ew.slice(1);Os(u8,"on"+d8)}Os(_1,"onAnimationEnd"),Os(b1,"onAnimationIteration"),Os(k1,"onAnimationStart"),Os("dblclick","onDoubleClick"),Os("focusin","onFocus"),Os("focusout","onBlur"),Os(x$,"onTransitionRun"),Os(P$,"onTransitionStart"),Os(A$,"onTransitionCancel"),Os(w1,"onTransitionEnd"),$i("onMouseEnter",["mouseout","mouseover"]),$i("onMouseLeave",["mouseout","mouseover"]),$i("onPointerEnter",["pointerout","pointerover"]),$i("onPointerLeave",["pointerout","pointerover"]),Ps("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ps("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ps("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ps("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ps("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var fh="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),f8=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(fh));function $2(s,l){l=(l&4)!==0;for(var p=0;p<s.length;p++){var y=s[p],k=y.event;y=y.listeners;e:{var S=void 0;if(l)for(var M=y.length-1;0<=M;M--){var V=y[M],oe=V.instance,Te=V.currentTarget;if(V=V.listener,oe!==S&&k.isPropagationStopped())break e;S=V,k.currentTarget=Te;try{S(k)}catch(Ue){Qg(Ue)}k.currentTarget=null,S=oe}else for(M=0;M<y.length;M++){if(V=y[M],oe=V.instance,Te=V.currentTarget,V=V.listener,oe!==S&&k.isPropagationStopped())break e;S=V,k.currentTarget=Te;try{S(k)}catch(Ue){Qg(Ue)}k.currentTarget=null,S=oe}}}}function yr(s,l){var p=l[dn];p===void 0&&(p=l[dn]=new Set);var y=s+"__bubble";p.has(y)||(V2(l,s,2,!1),p.add(y))}function tw(s,l,p){var y=0;l&&(y|=4),V2(p,s,y,l)}var By="_reactListening"+Math.random().toString(36).slice(2);function rw(s){if(!s[By]){s[By]=!0,Cs.forEach(function(p){p!=="selectionchange"&&(f8.has(p)||tw(p,!1,s),tw(p,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[By]||(l[By]=!0,tw("selectionchange",!1,l))}}function V2(s,l,p,y){switch(_D(l)){case 2:var k=F8;break;case 8:k=q8;break;default:k=yw}p=k.bind(null,l,p,s),k=void 0,!Ua||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(k=!0),y?k!==void 0?s.addEventListener(l,p,{capture:!0,passive:k}):s.addEventListener(l,p,!0):k!==void 0?s.addEventListener(l,p,{passive:k}):s.addEventListener(l,p,!1)}function nw(s,l,p,y,k){var S=y;if((l&1)===0&&(l&2)===0&&y!==null)e:for(;;){if(y===null)return;var M=y.tag;if(M===3||M===4){var V=y.stateNode.containerInfo;if(V===k)break;if(M===4)for(M=y.return;M!==null;){var oe=M.tag;if((oe===3||oe===4)&&M.stateNode.containerInfo===k)return;M=M.return}for(;V!==null;){if(M=zi(V),M===null)return;if(oe=M.tag,oe===5||oe===6||oe===26||oe===27){y=S=M;continue e}V=V.parentNode}}y=y.return}Lr(function(){var Te=S,Ue=Rs(p),Ge=[];e:{var Pe=S1.get(s);if(Pe!==void 0){var Ne=ac,Pt=s;switch(s){case"keypress":if(Sd(p)===0)break e;case"keydown":case"keyup":Ne=Xg;break;case"focusin":Pt="focus",Ne=gt;break;case"focusout":Pt="blur",Ne=gt;break;case"beforeblur":case"afterblur":Ne=gt;break;case"click":if(p.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ne=Me;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ne=Ve;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ne=c$;break;case _1:case b1:case k1:Ne=nn;break;case w1:Ne=u$;break;case"scroll":case"scrollend":Ne=C0;break;case"wheel":Ne=f$;break;case"copy":case"cut":case"paste":Ne=an;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ne=e1;break;case"toggle":case"beforetoggle":Ne=h$}var Ht=(l&4)!==0,Zr=!Ht&&(s==="scroll"||s==="scrollend"),ve=Ht?Pe!==null?Pe+"Capture":null:Pe;Ht=[];for(var de=Te,Ee;de!==null;){var qe=de;if(Ee=qe.stateNode,qe=qe.tag,qe!==5&&qe!==26&&qe!==27||Ee===null||ve===null||(qe=Zn(de,ve),qe!=null&&Ht.push(ph(de,qe,Ee))),Zr)break;de=de.return}0<Ht.length&&(Pe=new Ne(Pe,Pt,null,p,Ue),Ge.push({event:Pe,listeners:Ht}))}}if((l&7)===0){e:{if(Pe=s==="mouseover"||s==="pointerover",Ne=s==="mouseout"||s==="pointerout",Pe&&p!==Jc&&(Pt=p.relatedTarget||p.fromElement)&&(zi(Pt)||Pt[Nn]))break e;if((Ne||Pe)&&(Pe=Ue.window===Ue?Ue:(Pe=Ue.ownerDocument)?Pe.defaultView||Pe.parentWindow:window,Ne?(Pt=p.relatedTarget||p.toElement,Ne=Te,Pt=Pt?zi(Pt):null,Pt!==null&&(Zr=i(Pt),Ht=Pt.tag,Pt!==Zr||Ht!==5&&Ht!==27&&Ht!==6)&&(Pt=null)):(Ne=null,Pt=Te),Ne!==Pt)){if(Ht=Me,qe="onMouseLeave",ve="onMouseEnter",de="mouse",(s==="pointerout"||s==="pointerover")&&(Ht=e1,qe="onPointerLeave",ve="onPointerEnter",de="pointer"),Zr=Ne==null?Pe:_i(Ne),Ee=Pt==null?Pe:_i(Pt),Pe=new Ht(qe,de+"leave",Ne,p,Ue),Pe.target=Zr,Pe.relatedTarget=Ee,qe=null,zi(Ue)===Te&&(Ht=new Ht(ve,de+"enter",Pt,p,Ue),Ht.target=Ee,Ht.relatedTarget=Zr,qe=Ht),Zr=qe,Ne&&Pt)t:{for(Ht=p8,ve=Ne,de=Pt,Ee=0,qe=ve;qe;qe=Ht(qe))Ee++;qe=0;for(var Ft=de;Ft;Ft=Ht(Ft))qe++;for(;0<Ee-qe;)ve=Ht(ve),Ee--;for(;0<qe-Ee;)de=Ht(de),qe--;for(;Ee--;){if(ve===de||de!==null&&ve===de.alternate){Ht=ve;break t}ve=Ht(ve),de=Ht(de)}Ht=null}else Ht=null;Ne!==null&&H2(Ge,Pe,Ne,Ht,!1),Pt!==null&&Zr!==null&&H2(Ge,Zr,Pt,Ht,!0)}}e:{if(Pe=Te?_i(Te):window,Ne=Pe.nodeName&&Pe.nodeName.toLowerCase(),Ne==="select"||Ne==="input"&&Pe.type==="file")var Nr=c1;else if(s1(Pe))if(l1)Nr=E$;else{Nr=w$;var Lt=k$}else Ne=Pe.nodeName,!Ne||Ne.toLowerCase()!=="input"||Pe.type!=="checkbox"&&Pe.type!=="radio"?Te&&rn(Te.elementType)&&(Nr=c1):Nr=S$;if(Nr&&(Nr=Nr(s,Te))){o1(Ge,Nr,p,Ue);break e}Lt&&Lt(s,Pe,Te),s==="focusout"&&Te&&Pe.type==="number"&&Te.memoizedProps.value!=null&&Xc(Pe,"number",Pe.value)}switch(Lt=Te?_i(Te):window,s){case"focusin":(s1(Lt)||Lt.contentEditable==="true")&&(xd=Lt,O0=Te,zp=null);break;case"focusout":zp=O0=xd=null;break;case"mousedown":N0=!0;break;case"contextmenu":case"mouseup":case"dragend":N0=!1,y1(Ge,p,Ue);break;case"selectionchange":if(C$)break;case"keydown":case"keyup":y1(Ge,p,Ue)}var ir;if(P0)e:{switch(s){case"compositionstart":var kr="onCompositionStart";break e;case"compositionend":kr="onCompositionEnd";break e;case"compositionupdate":kr="onCompositionUpdate";break e}kr=void 0}else Cd?a1(s,p)&&(kr="onCompositionEnd"):s==="keydown"&&p.keyCode===229&&(kr="onCompositionStart");kr&&(t1&&p.locale!=="ko"&&(Cd||kr!=="onCompositionStart"?kr==="onCompositionEnd"&&Cd&&(ir=rc()):(ta=Ue,Fn="value"in ta?ta.value:ta.textContent,Cd=!0)),Lt=Uy(Te,kr),0<Lt.length&&(kr=new ic(kr,s,null,p,Ue),Ge.push({event:kr,listeners:Lt}),ir?kr.data=ir:(ir=i1(p),ir!==null&&(kr.data=ir)))),(ir=g$?y$(s,p):v$(s,p))&&(kr=Uy(Te,"onBeforeInput"),0<kr.length&&(Lt=new ic("onBeforeInput","beforeinput",null,p,Ue),Ge.push({event:Lt,listeners:kr}),Lt.data=ir)),l8(Ge,s,Te,p,Ue)}$2(Ge,l)})}function ph(s,l,p){return{instance:s,listener:l,currentTarget:p}}function Uy(s,l){for(var p=l+"Capture",y=[];s!==null;){var k=s,S=k.stateNode;if(k=k.tag,k!==5&&k!==26&&k!==27||S===null||(k=Zn(s,p),k!=null&&y.unshift(ph(s,k,S)),k=Zn(s,l),k!=null&&y.push(ph(s,k,S))),s.tag===3)return y;s=s.return}return[]}function p8(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function H2(s,l,p,y,k){for(var S=l._reactName,M=[];p!==null&&p!==y;){var V=p,oe=V.alternate,Te=V.stateNode;if(V=V.tag,oe!==null&&oe===y)break;V!==5&&V!==26&&V!==27||Te===null||(oe=Te,k?(Te=Zn(p,S),Te!=null&&M.unshift(ph(p,Te,oe))):k||(Te=Zn(p,S),Te!=null&&M.push(ph(p,Te,oe)))),p=p.return}M.length!==0&&s.push({event:l,listeners:M})}var h8=/\r\n?/g,m8=/\u0000|\uFFFD/g;function G2(s){return(typeof s=="string"?s:""+s).replace(h8,`
`).replace(m8,"")}function W2(s,l){return l=G2(l),G2(s)===l}function Qr(s,l,p,y,k,S){switch(p){case"children":typeof y=="string"?l==="body"||l==="textarea"&&y===""||Je(s,y):(typeof y=="number"||typeof y=="bigint")&&l!=="body"&&Je(s,""+y);break;case"className":co(s,"class",y);break;case"tabIndex":co(s,"tabindex",y);break;case"dir":case"role":case"viewBox":case"width":case"height":co(s,p,y);break;case"style":Or(s,y,S);break;case"data":if(l!=="object"){co(s,"data",y);break}case"src":case"href":if(y===""&&(l!=="a"||p!=="href")){s.removeAttribute(p);break}if(y==null||typeof y=="function"||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(p);break}y=As(""+y),s.setAttribute(p,y);break;case"action":case"formAction":if(typeof y=="function"){s.setAttribute(p,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof S=="function"&&(p==="formAction"?(l!=="input"&&Qr(s,l,"name",k.name,k,null),Qr(s,l,"formEncType",k.formEncType,k,null),Qr(s,l,"formMethod",k.formMethod,k,null),Qr(s,l,"formTarget",k.formTarget,k,null)):(Qr(s,l,"encType",k.encType,k,null),Qr(s,l,"method",k.method,k,null),Qr(s,l,"target",k.target,k,null)));if(y==null||typeof y=="symbol"||typeof y=="boolean"){s.removeAttribute(p);break}y=As(""+y),s.setAttribute(p,y);break;case"onClick":y!=null&&(s.onclick=ya);break;case"onScroll":y!=null&&yr("scroll",s);break;case"onScrollEnd":y!=null&&yr("scrollend",s);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(n(61));if(p=y.__html,p!=null){if(k.children!=null)throw Error(n(60));s.innerHTML=p}}break;case"multiple":s.multiple=y&&typeof y!="function"&&typeof y!="symbol";break;case"muted":s.muted=y&&typeof y!="function"&&typeof y!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(y==null||typeof y=="function"||typeof y=="boolean"||typeof y=="symbol"){s.removeAttribute("xlink:href");break}p=As(""+y),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",p);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(p,""+y):s.removeAttribute(p);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":y&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(p,""):s.removeAttribute(p);break;case"capture":case"download":y===!0?s.setAttribute(p,""):y!==!1&&y!=null&&typeof y!="function"&&typeof y!="symbol"?s.setAttribute(p,y):s.removeAttribute(p);break;case"cols":case"rows":case"size":case"span":y!=null&&typeof y!="function"&&typeof y!="symbol"&&!isNaN(y)&&1<=y?s.setAttribute(p,y):s.removeAttribute(p);break;case"rowSpan":case"start":y==null||typeof y=="function"||typeof y=="symbol"||isNaN(y)?s.removeAttribute(p):s.setAttribute(p,y);break;case"popover":yr("beforetoggle",s),yr("toggle",s),tc(s,"popover",y);break;case"xlinkActuate":ma(s,"http://www.w3.org/1999/xlink","xlink:actuate",y);break;case"xlinkArcrole":ma(s,"http://www.w3.org/1999/xlink","xlink:arcrole",y);break;case"xlinkRole":ma(s,"http://www.w3.org/1999/xlink","xlink:role",y);break;case"xlinkShow":ma(s,"http://www.w3.org/1999/xlink","xlink:show",y);break;case"xlinkTitle":ma(s,"http://www.w3.org/1999/xlink","xlink:title",y);break;case"xlinkType":ma(s,"http://www.w3.org/1999/xlink","xlink:type",y);break;case"xmlBase":ma(s,"http://www.w3.org/XML/1998/namespace","xml:base",y);break;case"xmlLang":ma(s,"http://www.w3.org/XML/1998/namespace","xml:lang",y);break;case"xmlSpace":ma(s,"http://www.w3.org/XML/1998/namespace","xml:space",y);break;case"is":tc(s,"is",y);break;case"innerText":case"textContent":break;default:(!(2<p.length)||p[0]!=="o"&&p[0]!=="O"||p[1]!=="n"&&p[1]!=="N")&&(p=Tn.get(p)||p,tc(s,p,y))}}function aw(s,l,p,y,k,S){switch(p){case"style":Or(s,y,S);break;case"dangerouslySetInnerHTML":if(y!=null){if(typeof y!="object"||!("__html"in y))throw Error(n(61));if(p=y.__html,p!=null){if(k.children!=null)throw Error(n(60));s.innerHTML=p}}break;case"children":typeof y=="string"?Je(s,y):(typeof y=="number"||typeof y=="bigint")&&Je(s,""+y);break;case"onScroll":y!=null&&yr("scroll",s);break;case"onScrollEnd":y!=null&&yr("scrollend",s);break;case"onClick":y!=null&&(s.onclick=ya);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!xs.hasOwnProperty(p))e:{if(p[0]==="o"&&p[1]==="n"&&(k=p.endsWith("Capture"),l=p.slice(2,k?p.length-7:void 0),S=s[Dt]||null,S=S!=null?S[p]:null,typeof S=="function"&&s.removeEventListener(l,S,k),typeof y=="function")){typeof S!="function"&&S!==null&&(p in s?s[p]=null:s.hasAttribute(p)&&s.removeAttribute(p)),s.addEventListener(l,y,k);break e}p in s?s[p]=y:y===!0?s.setAttribute(p,""):tc(s,p,y)}}}function ka(s,l,p){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":yr("error",s),yr("load",s);var y=!1,k=!1,S;for(S in p)if(p.hasOwnProperty(S)){var M=p[S];if(M!=null)switch(S){case"src":y=!0;break;case"srcSet":k=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Qr(s,l,S,M,p,null)}}k&&Qr(s,l,"srcSet",p.srcSet,p,null),y&&Qr(s,l,"src",p.src,p,null);return;case"input":yr("invalid",s);var V=S=M=k=null,oe=null,Te=null;for(y in p)if(p.hasOwnProperty(y)){var Ue=p[y];if(Ue!=null)switch(y){case"name":k=Ue;break;case"type":M=Ue;break;case"checked":oe=Ue;break;case"defaultChecked":Te=Ue;break;case"value":S=Ue;break;case"defaultValue":V=Ue;break;case"children":case"dangerouslySetInnerHTML":if(Ue!=null)throw Error(n(137,l));break;default:Qr(s,l,y,Ue,p,null)}}bi(s,S,V,oe,Te,M,k,!1);return;case"select":yr("invalid",s),y=M=S=null;for(k in p)if(p.hasOwnProperty(k)&&(V=p[k],V!=null))switch(k){case"value":S=V;break;case"defaultValue":M=V;break;case"multiple":y=V;default:Qr(s,l,k,V,p,null)}l=S,p=M,s.multiple=!!y,l!=null?_e(s,!!y,l,!1):p!=null&&_e(s,!!y,p,!0);return;case"textarea":yr("invalid",s),S=k=y=null;for(M in p)if(p.hasOwnProperty(M)&&(V=p[M],V!=null))switch(M){case"value":y=V;break;case"defaultValue":k=V;break;case"children":S=V;break;case"dangerouslySetInnerHTML":if(V!=null)throw Error(n(91));break;default:Qr(s,l,M,V,p,null)}ot(s,y,k,S);return;case"option":for(oe in p)if(p.hasOwnProperty(oe)&&(y=p[oe],y!=null))switch(oe){case"selected":s.selected=y&&typeof y!="function"&&typeof y!="symbol";break;default:Qr(s,l,oe,y,p,null)}return;case"dialog":yr("beforetoggle",s),yr("toggle",s),yr("cancel",s),yr("close",s);break;case"iframe":case"object":yr("load",s);break;case"video":case"audio":for(y=0;y<fh.length;y++)yr(fh[y],s);break;case"image":yr("error",s),yr("load",s);break;case"details":yr("toggle",s);break;case"embed":case"source":case"link":yr("error",s),yr("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Te in p)if(p.hasOwnProperty(Te)&&(y=p[Te],y!=null))switch(Te){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Qr(s,l,Te,y,p,null)}return;default:if(rn(l)){for(Ue in p)p.hasOwnProperty(Ue)&&(y=p[Ue],y!==void 0&&aw(s,l,Ue,y,p,void 0));return}}for(V in p)p.hasOwnProperty(V)&&(y=p[V],y!=null&&Qr(s,l,V,y,p,null))}function g8(s,l,p,y){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var k=null,S=null,M=null,V=null,oe=null,Te=null,Ue=null;for(Ne in p){var Ge=p[Ne];if(p.hasOwnProperty(Ne)&&Ge!=null)switch(Ne){case"checked":break;case"value":break;case"defaultValue":oe=Ge;default:y.hasOwnProperty(Ne)||Qr(s,l,Ne,null,y,Ge)}}for(var Pe in y){var Ne=y[Pe];if(Ge=p[Pe],y.hasOwnProperty(Pe)&&(Ne!=null||Ge!=null))switch(Pe){case"type":S=Ne;break;case"name":k=Ne;break;case"checked":Te=Ne;break;case"defaultChecked":Ue=Ne;break;case"value":M=Ne;break;case"defaultValue":V=Ne;break;case"children":case"dangerouslySetInnerHTML":if(Ne!=null)throw Error(n(137,l));break;default:Ne!==Ge&&Qr(s,l,Pe,Ne,y,Ge)}}uo(s,M,V,oe,Te,Ue,S,k);return;case"select":Ne=M=V=Pe=null;for(S in p)if(oe=p[S],p.hasOwnProperty(S)&&oe!=null)switch(S){case"value":break;case"multiple":Ne=oe;default:y.hasOwnProperty(S)||Qr(s,l,S,null,y,oe)}for(k in y)if(S=y[k],oe=p[k],y.hasOwnProperty(k)&&(S!=null||oe!=null))switch(k){case"value":Pe=S;break;case"defaultValue":V=S;break;case"multiple":M=S;default:S!==oe&&Qr(s,l,k,S,y,oe)}l=V,p=M,y=Ne,Pe!=null?_e(s,!!p,Pe,!1):!!y!=!!p&&(l!=null?_e(s,!!p,l,!0):_e(s,!!p,p?[]:"",!1));return;case"textarea":Ne=Pe=null;for(V in p)if(k=p[V],p.hasOwnProperty(V)&&k!=null&&!y.hasOwnProperty(V))switch(V){case"value":break;case"children":break;default:Qr(s,l,V,null,y,k)}for(M in y)if(k=y[M],S=p[M],y.hasOwnProperty(M)&&(k!=null||S!=null))switch(M){case"value":Pe=k;break;case"defaultValue":Ne=k;break;case"children":break;case"dangerouslySetInnerHTML":if(k!=null)throw Error(n(91));break;default:k!==S&&Qr(s,l,M,k,y,S)}Ze(s,Pe,Ne);return;case"option":for(var Pt in p)if(Pe=p[Pt],p.hasOwnProperty(Pt)&&Pe!=null&&!y.hasOwnProperty(Pt))switch(Pt){case"selected":s.selected=!1;break;default:Qr(s,l,Pt,null,y,Pe)}for(oe in y)if(Pe=y[oe],Ne=p[oe],y.hasOwnProperty(oe)&&Pe!==Ne&&(Pe!=null||Ne!=null))switch(oe){case"selected":s.selected=Pe&&typeof Pe!="function"&&typeof Pe!="symbol";break;default:Qr(s,l,oe,Pe,y,Ne)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ht in p)Pe=p[Ht],p.hasOwnProperty(Ht)&&Pe!=null&&!y.hasOwnProperty(Ht)&&Qr(s,l,Ht,null,y,Pe);for(Te in y)if(Pe=y[Te],Ne=p[Te],y.hasOwnProperty(Te)&&Pe!==Ne&&(Pe!=null||Ne!=null))switch(Te){case"children":case"dangerouslySetInnerHTML":if(Pe!=null)throw Error(n(137,l));break;default:Qr(s,l,Te,Pe,y,Ne)}return;default:if(rn(l)){for(var Zr in p)Pe=p[Zr],p.hasOwnProperty(Zr)&&Pe!==void 0&&!y.hasOwnProperty(Zr)&&aw(s,l,Zr,void 0,y,Pe);for(Ue in y)Pe=y[Ue],Ne=p[Ue],!y.hasOwnProperty(Ue)||Pe===Ne||Pe===void 0&&Ne===void 0||aw(s,l,Ue,Pe,y,Ne);return}}for(var ve in p)Pe=p[ve],p.hasOwnProperty(ve)&&Pe!=null&&!y.hasOwnProperty(ve)&&Qr(s,l,ve,null,y,Pe);for(Ge in y)Pe=y[Ge],Ne=p[Ge],!y.hasOwnProperty(Ge)||Pe===Ne||Pe==null&&Ne==null||Qr(s,l,Ge,Pe,y,Ne)}function K2(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function y8(){if(typeof performance.getEntriesByType=="function"){for(var s=0,l=0,p=performance.getEntriesByType("resource"),y=0;y<p.length;y++){var k=p[y],S=k.transferSize,M=k.initiatorType,V=k.duration;if(S&&V&&K2(M)){for(M=0,V=k.responseEnd,y+=1;y<p.length;y++){var oe=p[y],Te=oe.startTime;if(Te>V)break;var Ue=oe.transferSize,Ge=oe.initiatorType;Ue&&K2(Ge)&&(oe=oe.responseEnd,M+=Ue*(oe<V?1:(V-Te)/(oe-Te)))}if(--y,l+=8*(S+M)/(k.duration/1e3),s++,10<s)break}}if(0<s)return l/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var iw=null,sw=null;function Fy(s){return s.nodeType===9?s:s.ownerDocument}function Y2(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function X2(s,l){if(s===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&l==="foreignObject"?0:s}function ow(s,l){return s==="textarea"||s==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var cw=null;function v8(){var s=window.event;return s&&s.type==="popstate"?s===cw?!1:(cw=s,!0):(cw=null,!1)}var J2=typeof setTimeout=="function"?setTimeout:void 0,_8=typeof clearTimeout=="function"?clearTimeout:void 0,Q2=typeof Promise=="function"?Promise:void 0,b8=typeof queueMicrotask=="function"?queueMicrotask:typeof Q2<"u"?function(s){return Q2.resolve(null).then(s).catch(k8)}:J2;function k8(s){setTimeout(function(){throw s})}function yl(s){return s==="head"}function Z2(s,l){var p=l,y=0;do{var k=p.nextSibling;if(s.removeChild(p),k&&k.nodeType===8)if(p=k.data,p==="/$"||p==="/&"){if(y===0){s.removeChild(k),ef(l);return}y--}else if(p==="$"||p==="$?"||p==="$~"||p==="$!"||p==="&")y++;else if(p==="html")hh(s.ownerDocument.documentElement);else if(p==="head"){p=s.ownerDocument.head,hh(p);for(var S=p.firstChild;S;){var M=S.nextSibling,V=S.nodeName;S[pn]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&S.rel.toLowerCase()==="stylesheet"||p.removeChild(S),S=M}}else p==="body"&&hh(s.ownerDocument.body);p=k}while(p);ef(l)}function eD(s,l){var p=s;s=0;do{var y=p.nextSibling;if(p.nodeType===1?l?(p._stashedDisplay=p.style.display,p.style.display="none"):(p.style.display=p._stashedDisplay||"",p.getAttribute("style")===""&&p.removeAttribute("style")):p.nodeType===3&&(l?(p._stashedText=p.nodeValue,p.nodeValue=""):p.nodeValue=p._stashedText||""),y&&y.nodeType===8)if(p=y.data,p==="/$"){if(s===0)break;s--}else p!=="$"&&p!=="$?"&&p!=="$~"&&p!=="$!"||s++;p=y}while(p)}function lw(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var p=l;switch(l=l.nextSibling,p.nodeName){case"HTML":case"HEAD":case"BODY":lw(p),ec(p);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(p.rel.toLowerCase()==="stylesheet")continue}s.removeChild(p)}}function w8(s,l,p,y){for(;s.nodeType===1;){var k=p;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!y&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(y){if(!s[pn])switch(l){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(S=s.getAttribute("rel"),S==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(S!==k.rel||s.getAttribute("href")!==(k.href==null||k.href===""?null:k.href)||s.getAttribute("crossorigin")!==(k.crossOrigin==null?null:k.crossOrigin)||s.getAttribute("title")!==(k.title==null?null:k.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(S=s.getAttribute("src"),(S!==(k.src==null?null:k.src)||s.getAttribute("type")!==(k.type==null?null:k.type)||s.getAttribute("crossorigin")!==(k.crossOrigin==null?null:k.crossOrigin))&&S&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(l==="input"&&s.type==="hidden"){var S=k.name==null?null:""+k.name;if(k.type==="hidden"&&s.getAttribute("name")===S)return s}else return s;if(s=Zi(s.nextSibling),s===null)break}return null}function S8(s,l,p){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!p||(s=Zi(s.nextSibling),s===null))return null;return s}function tD(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Zi(s.nextSibling),s===null))return null;return s}function uw(s){return s.data==="$?"||s.data==="$~"}function dw(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function E8(s,l){var p=s.ownerDocument;if(s.data==="$~")s._reactRetry=l;else if(s.data!=="$?"||p.readyState!=="loading")l();else{var y=function(){l(),p.removeEventListener("DOMContentLoaded",y)};p.addEventListener("DOMContentLoaded",y),s._reactRetry=y}}function Zi(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return s}var fw=null;function rD(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var p=s.data;if(p==="/$"||p==="/&"){if(l===0)return Zi(s.nextSibling);l--}else p!=="$"&&p!=="$!"&&p!=="$?"&&p!=="$~"&&p!=="&"||l++}s=s.nextSibling}return null}function nD(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var p=s.data;if(p==="$"||p==="$!"||p==="$?"||p==="$~"||p==="&"){if(l===0)return s;l--}else p!=="/$"&&p!=="/&"||l++}s=s.previousSibling}return null}function aD(s,l,p){switch(l=Fy(p),s){case"html":if(s=l.documentElement,!s)throw Error(n(452));return s;case"head":if(s=l.head,!s)throw Error(n(453));return s;case"body":if(s=l.body,!s)throw Error(n(454));return s;default:throw Error(n(451))}}function hh(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);ec(s)}var es=new Map,iD=new Set;function qy(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var bc=Y.d;Y.d={f:T8,r:C8,D:x8,C:P8,L:A8,m:R8,X:O8,S:D8,M:N8};function T8(){var s=bc.f(),l=Oy();return s||l}function C8(s){var l=Ts(s);l!==null&&l.tag===5&&l.type==="form"?wR(l):bc.r(s)}var Jd=typeof document>"u"?null:document;function sD(s,l,p){var y=Jd;if(y&&typeof l=="string"&&l){var k=ca(l);k='link[rel="'+s+'"][href="'+k+'"]',typeof p=="string"&&(k+='[crossorigin="'+p+'"]'),iD.has(k)||(iD.add(k),s={rel:s,crossOrigin:p,href:l},y.querySelector(k)===null&&(l=y.createElement("link"),ka(l,"link",s),hn(l),y.head.appendChild(l)))}}function x8(s){bc.D(s),sD("dns-prefetch",s,null)}function P8(s,l){bc.C(s,l),sD("preconnect",s,l)}function A8(s,l,p){bc.L(s,l,p);var y=Jd;if(y&&s&&l){var k='link[rel="preload"][as="'+ca(l)+'"]';l==="image"&&p&&p.imageSrcSet?(k+='[imagesrcset="'+ca(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(k+='[imagesizes="'+ca(p.imageSizes)+'"]')):k+='[href="'+ca(s)+'"]';var S=k;switch(l){case"style":S=Qd(s);break;case"script":S=Zd(s)}es.has(S)||(s=h({rel:"preload",href:l==="image"&&p&&p.imageSrcSet?void 0:s,as:l},p),es.set(S,s),y.querySelector(k)!==null||l==="style"&&y.querySelector(mh(S))||l==="script"&&y.querySelector(gh(S))||(l=y.createElement("link"),ka(l,"link",s),hn(l),y.head.appendChild(l)))}}function R8(s,l){bc.m(s,l);var p=Jd;if(p&&s){var y=l&&typeof l.as=="string"?l.as:"script",k='link[rel="modulepreload"][as="'+ca(y)+'"][href="'+ca(s)+'"]',S=k;switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=Zd(s)}if(!es.has(S)&&(s=h({rel:"modulepreload",href:s},l),es.set(S,s),p.querySelector(k)===null)){switch(y){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(gh(S)))return}y=p.createElement("link"),ka(y,"link",s),hn(y),p.head.appendChild(y)}}}function D8(s,l,p){bc.S(s,l,p);var y=Jd;if(y&&s){var k=Qn(y).hoistableStyles,S=Qd(s);l=l||"default";var M=k.get(S);if(!M){var V={loading:0,preload:null};if(M=y.querySelector(mh(S)))V.loading=5;else{s=h({rel:"stylesheet",href:s,"data-precedence":l},p),(p=es.get(S))&&pw(s,p);var oe=M=y.createElement("link");hn(oe),ka(oe,"link",s),oe._p=new Promise(function(Te,Ue){oe.onload=Te,oe.onerror=Ue}),oe.addEventListener("load",function(){V.loading|=1}),oe.addEventListener("error",function(){V.loading|=2}),V.loading|=4,zy(M,l,y)}M={type:"stylesheet",instance:M,count:1,state:V},k.set(S,M)}}}function O8(s,l){bc.X(s,l);var p=Jd;if(p&&s){var y=Qn(p).hoistableScripts,k=Zd(s),S=y.get(k);S||(S=p.querySelector(gh(k)),S||(s=h({src:s,async:!0},l),(l=es.get(k))&&hw(s,l),S=p.createElement("script"),hn(S),ka(S,"link",s),p.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},y.set(k,S))}}function N8(s,l){bc.M(s,l);var p=Jd;if(p&&s){var y=Qn(p).hoistableScripts,k=Zd(s),S=y.get(k);S||(S=p.querySelector(gh(k)),S||(s=h({src:s,async:!0,type:"module"},l),(l=es.get(k))&&hw(s,l),S=p.createElement("script"),hn(S),ka(S,"link",s),p.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},y.set(k,S))}}function oD(s,l,p,y){var k=(k=ue.current)?qy(k):null;if(!k)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(l=Qd(p.href),p=Qn(k).hoistableStyles,y=p.get(l),y||(y={type:"style",instance:null,count:0,state:null},p.set(l,y)),y):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){s=Qd(p.href);var S=Qn(k).hoistableStyles,M=S.get(s);if(M||(k=k.ownerDocument||k,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(s,M),(S=k.querySelector(mh(s)))&&!S._p&&(M.instance=S,M.state.loading=5),es.has(s)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},es.set(s,p),S||I8(k,s,p,M.state))),l&&y===null)throw Error(n(528,""));return M}if(l&&y!==null)throw Error(n(529,""));return null;case"script":return l=p.async,p=p.src,typeof p=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Zd(p),p=Qn(k).hoistableScripts,y=p.get(l),y||(y={type:"script",instance:null,count:0,state:null},p.set(l,y)),y):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,s))}}function Qd(s){return'href="'+ca(s)+'"'}function mh(s){return'link[rel="stylesheet"]['+s+"]"}function cD(s){return h({},s,{"data-precedence":s.precedence,precedence:null})}function I8(s,l,p,y){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?y.loading=1:(l=s.createElement("link"),y.preload=l,l.addEventListener("load",function(){return y.loading|=1}),l.addEventListener("error",function(){return y.loading|=2}),ka(l,"link",p),hn(l),s.head.appendChild(l))}function Zd(s){return'[src="'+ca(s)+'"]'}function gh(s){return"script[async]"+s}function lD(s,l,p){if(l.count++,l.instance===null)switch(l.type){case"style":var y=s.querySelector('style[data-href~="'+ca(p.href)+'"]');if(y)return l.instance=y,hn(y),y;var k=h({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return y=(s.ownerDocument||s).createElement("style"),hn(y),ka(y,"style",k),zy(y,p.precedence,s),l.instance=y;case"stylesheet":k=Qd(p.href);var S=s.querySelector(mh(k));if(S)return l.state.loading|=4,l.instance=S,hn(S),S;y=cD(p),(k=es.get(k))&&pw(y,k),S=(s.ownerDocument||s).createElement("link"),hn(S);var M=S;return M._p=new Promise(function(V,oe){M.onload=V,M.onerror=oe}),ka(S,"link",y),l.state.loading|=4,zy(S,p.precedence,s),l.instance=S;case"script":return S=Zd(p.src),(k=s.querySelector(gh(S)))?(l.instance=k,hn(k),k):(y=p,(k=es.get(S))&&(y=h({},p),hw(y,k)),s=s.ownerDocument||s,k=s.createElement("script"),hn(k),ka(k,"link",y),s.head.appendChild(k),l.instance=k);case"void":return null;default:throw Error(n(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(y=l.instance,l.state.loading|=4,zy(y,p.precedence,s));return l.instance}function zy(s,l,p){for(var y=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),k=y.length?y[y.length-1]:null,S=k,M=0;M<y.length;M++){var V=y[M];if(V.dataset.precedence===l)S=V;else if(S!==k)break}S?S.parentNode.insertBefore(s,S.nextSibling):(l=p.nodeType===9?p.head:p,l.insertBefore(s,l.firstChild))}function pw(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function hw(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var $y=null;function uD(s,l,p){if($y===null){var y=new Map,k=$y=new Map;k.set(p,y)}else k=$y,y=k.get(p),y||(y=new Map,k.set(p,y));if(y.has(s))return y;for(y.set(s,null),p=p.getElementsByTagName(s),k=0;k<p.length;k++){var S=p[k];if(!(S[pn]||S[Rt]||s==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var M=S.getAttribute(l)||"";M=s+M;var V=y.get(M);V?V.push(S):y.set(M,[S])}}return y}function dD(s,l,p){s=s.ownerDocument||s,s.head.insertBefore(p,l==="title"?s.querySelector("head > title"):null)}function M8(s,l,p){if(p===1||l.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return s=l.disabled,typeof l.precedence=="string"&&s==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function fD(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function j8(s,l,p,y){if(p.type==="stylesheet"&&(typeof y.media!="string"||matchMedia(y.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var k=Qd(y.href),S=l.querySelector(mh(k));if(S){l=S._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=Vy.bind(s),l.then(s,s)),p.state.loading|=4,p.instance=S,hn(S);return}S=l.ownerDocument||l,y=cD(y),(k=es.get(k))&&pw(y,k),S=S.createElement("link"),hn(S);var M=S;M._p=new Promise(function(V,oe){M.onload=V,M.onerror=oe}),ka(S,"link",y),p.instance=S}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(p,l),(l=p.state.preload)&&(p.state.loading&3)===0&&(s.count++,p=Vy.bind(s),l.addEventListener("load",p),l.addEventListener("error",p))}}var mw=0;function L8(s,l){return s.stylesheets&&s.count===0&&Gy(s,s.stylesheets),0<s.count||0<s.imgCount?function(p){var y=setTimeout(function(){if(s.stylesheets&&Gy(s,s.stylesheets),s.unsuspend){var S=s.unsuspend;s.unsuspend=null,S()}},6e4+l);0<s.imgBytes&&mw===0&&(mw=62500*y8());var k=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Gy(s,s.stylesheets),s.unsuspend)){var S=s.unsuspend;s.unsuspend=null,S()}},(s.imgBytes>mw?50:800)+l);return s.unsuspend=p,function(){s.unsuspend=null,clearTimeout(y),clearTimeout(k)}}:null}function Vy(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Gy(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Hy=null;function Gy(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Hy=new Map,l.forEach(B8,s),Hy=null,Vy.call(s))}function B8(s,l){if(!(l.state.loading&4)){var p=Hy.get(s);if(p)var y=p.get(null);else{p=new Map,Hy.set(s,p);for(var k=s.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<k.length;S++){var M=k[S];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(p.set(M.dataset.precedence,M),y=M)}y&&p.set(null,y)}k=l.instance,M=k.getAttribute("data-precedence"),S=p.get(M)||y,S===y&&p.set(null,k),p.set(M,k),this.count++,y=Vy.bind(this),k.addEventListener("load",y),k.addEventListener("error",y),S?S.parentNode.insertBefore(k,S.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(k,s.firstChild)),l.state.loading|=4}}var yh={$$typeof:P,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function U8(s,l,p,y,k,S,M,V,oe){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=se(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=se(0),this.hiddenUpdates=se(null),this.identifierPrefix=y,this.onUncaughtError=k,this.onCaughtError=S,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=oe,this.incompleteTransitions=new Map}function pD(s,l,p,y,k,S,M,V,oe,Te,Ue,Ge){return s=new U8(s,l,p,M,oe,Te,Ue,Ge,V),l=1,S===!0&&(l|=24),S=Ei(3,null,null,l),s.current=S,S.stateNode=s,l=K0(),l.refCount++,s.pooledCache=l,l.refCount++,S.memoizedState={element:y,isDehydrated:p,cache:l},Q0(S),s}function hD(s){return s?(s=Rd,s):Rd}function mD(s,l,p,y,k,S){k=hD(k),y.context===null?y.context=k:y.pendingContext=k,y=sl(l),y.payload={element:p},S=S===void 0?null:S,S!==null&&(y.callback=S),p=ol(s,y,l),p!==null&&(ti(p,s,l),Yp(p,s,l))}function gD(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var p=s.retryLane;s.retryLane=p!==0&&p<l?p:l}}function gw(s,l){gD(s,l),(s=s.alternate)&&gD(s,l)}function yD(s){if(s.tag===13||s.tag===31){var l=ku(s,67108864);l!==null&&ti(l,s,67108864),gw(s,67108864)}}function vD(s){if(s.tag===13||s.tag===31){var l=Ai();l=oa(l);var p=ku(s,l);p!==null&&ti(p,s,l),gw(s,l)}}var Wy=!0;function F8(s,l,p,y){var k=F.T;F.T=null;var S=Y.p;try{Y.p=2,yw(s,l,p,y)}finally{Y.p=S,F.T=k}}function q8(s,l,p,y){var k=F.T;F.T=null;var S=Y.p;try{Y.p=8,yw(s,l,p,y)}finally{Y.p=S,F.T=k}}function yw(s,l,p,y){if(Wy){var k=vw(y);if(k===null)nw(s,l,y,Ky,p),bD(s,y);else if($8(k,s,l,p,y))y.stopPropagation();else if(bD(s,y),l&4&&-1<z8.indexOf(s)){for(;k!==null;){var S=Ts(k);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var M=X(S.pendingLanes);if(M!==0){var V=S;for(V.pendingLanes|=2,V.entangledLanes|=2;M;){var oe=1<<31-bt(M);V.entanglements[1]|=oe,M&=~oe}go(S),(Br&6)===0&&(Ry=_t()+500,dh(0))}}break;case 31:case 13:V=ku(S,2),V!==null&&ti(V,S,2),Oy(),gw(S,2)}if(S=vw(y),S===null&&nw(s,l,y,Ky,p),S===k)break;k=S}k!==null&&y.stopPropagation()}else nw(s,l,y,null,p)}}function vw(s){return s=Rs(s),_w(s)}var Ky=null;function _w(s){if(Ky=null,s=zi(s),s!==null){var l=i(s);if(l===null)s=null;else{var p=l.tag;if(p===13){if(s=o(l),s!==null)return s;s=null}else if(p===31){if(s=c(l),s!==null)return s;s=null}else if(p===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return Ky=s,null}function _D(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ge()){case Be:return 2;case je:return 8;case rt:case Ct:return 32;case jt:return 268435456;default:return 32}default:return 32}}var bw=!1,vl=null,_l=null,bl=null,vh=new Map,_h=new Map,kl=[],z8="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function bD(s,l){switch(s){case"focusin":case"focusout":vl=null;break;case"dragenter":case"dragleave":_l=null;break;case"mouseover":case"mouseout":bl=null;break;case"pointerover":case"pointerout":vh.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":_h.delete(l.pointerId)}}function bh(s,l,p,y,k,S){return s===null||s.nativeEvent!==S?(s={blockedOn:l,domEventName:p,eventSystemFlags:y,nativeEvent:S,targetContainers:[k]},l!==null&&(l=Ts(l),l!==null&&yD(l)),s):(s.eventSystemFlags|=y,l=s.targetContainers,k!==null&&l.indexOf(k)===-1&&l.push(k),s)}function $8(s,l,p,y,k){switch(l){case"focusin":return vl=bh(vl,s,l,p,y,k),!0;case"dragenter":return _l=bh(_l,s,l,p,y,k),!0;case"mouseover":return bl=bh(bl,s,l,p,y,k),!0;case"pointerover":var S=k.pointerId;return vh.set(S,bh(vh.get(S)||null,s,l,p,y,k)),!0;case"gotpointercapture":return S=k.pointerId,_h.set(S,bh(_h.get(S)||null,s,l,p,y,k)),!0}return!1}function kD(s){var l=zi(s.target);if(l!==null){var p=i(l);if(p!==null){if(l=p.tag,l===13){if(l=o(p),l!==null){s.blockedOn=l,Yt(s.priority,function(){vD(p)});return}}else if(l===31){if(l=c(p),l!==null){s.blockedOn=l,Yt(s.priority,function(){vD(p)});return}}else if(l===3&&p.stateNode.current.memoizedState.isDehydrated){s.blockedOn=p.tag===3?p.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Yy(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var p=vw(s.nativeEvent);if(p===null){p=s.nativeEvent;var y=new p.constructor(p.type,p);Jc=y,p.target.dispatchEvent(y),Jc=null}else return l=Ts(p),l!==null&&yD(l),s.blockedOn=p,!1;l.shift()}return!0}function wD(s,l,p){Yy(s)&&p.delete(l)}function V8(){bw=!1,vl!==null&&Yy(vl)&&(vl=null),_l!==null&&Yy(_l)&&(_l=null),bl!==null&&Yy(bl)&&(bl=null),vh.forEach(wD),_h.forEach(wD)}function Xy(s,l){s.blockedOn===l&&(s.blockedOn=null,bw||(bw=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,V8)))}var Jy=null;function SD(s){Jy!==s&&(Jy=s,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Jy===s&&(Jy=null);for(var l=0;l<s.length;l+=3){var p=s[l],y=s[l+1],k=s[l+2];if(typeof y!="function"){if(_w(y||p)===null)continue;break}var S=Ts(p);S!==null&&(s.splice(l,3),l-=3,vk(S,{pending:!0,data:k,method:p.method,action:y},y,k))}}))}function ef(s){function l(oe){return Xy(oe,s)}vl!==null&&Xy(vl,s),_l!==null&&Xy(_l,s),bl!==null&&Xy(bl,s),vh.forEach(l),_h.forEach(l);for(var p=0;p<kl.length;p++){var y=kl[p];y.blockedOn===s&&(y.blockedOn=null)}for(;0<kl.length&&(p=kl[0],p.blockedOn===null);)kD(p),p.blockedOn===null&&kl.shift();if(p=(s.ownerDocument||s).$$reactFormReplay,p!=null)for(y=0;y<p.length;y+=3){var k=p[y],S=p[y+1],M=k[Dt]||null;if(typeof S=="function")M||SD(p);else if(M){var V=null;if(S&&S.hasAttribute("formAction")){if(k=S,M=S[Dt]||null)V=M.formAction;else if(_w(k)!==null)continue}else V=M.action;typeof V=="function"?p[y+1]=V:(p.splice(y,3),y-=3),SD(p)}}}function ED(){function s(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(M){return k=M})},focusReset:"manual",scroll:"manual"})}function l(){k!==null&&(k(),k=null),y||setTimeout(p,20)}function p(){if(!y&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var y=!1,k=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(p,100),function(){y=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),k!==null&&(k(),k=null)}}}function kw(s){this._internalRoot=s}Qy.prototype.render=kw.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(n(409));var p=l.current,y=Ai();mD(p,y,s,l,null,null)},Qy.prototype.unmount=kw.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;mD(s.current,2,null,s,null,null),Oy(),l[Nn]=null}};function Qy(s){this._internalRoot=s}Qy.prototype.unstable_scheduleHydration=function(s){if(s){var l=Ye();s={blockedOn:null,target:s,priority:l};for(var p=0;p<kl.length&&l!==0&&l<kl[p].priority;p++);kl.splice(p,0,s),p===0&&kD(s)}};var TD=e.version;if(TD!=="19.2.0")throw Error(n(527,TD,"19.2.0"));Y.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=d(l),s=s!==null?f(s):null,s=s===null?null:s.stateNode,s};var H8={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zy=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zy.isDisabled&&Zy.supportsFiber)try{at=Zy.inject(H8),we=Zy}catch{}}return wh.createRoot=function(s,l){if(!a(s))throw Error(n(299));var p=!1,y="",k=OR,S=NR,M=IR;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(y=l.identifierPrefix),l.onUncaughtError!==void 0&&(k=l.onUncaughtError),l.onCaughtError!==void 0&&(S=l.onCaughtError),l.onRecoverableError!==void 0&&(M=l.onRecoverableError)),l=pD(s,1,!1,null,null,p,y,null,k,S,M,ED),s[Nn]=l.current,rw(s),new kw(l)},wh.hydrateRoot=function(s,l,p){if(!a(s))throw Error(n(299));var y=!1,k="",S=OR,M=NR,V=IR,oe=null;return p!=null&&(p.unstable_strictMode===!0&&(y=!0),p.identifierPrefix!==void 0&&(k=p.identifierPrefix),p.onUncaughtError!==void 0&&(S=p.onUncaughtError),p.onCaughtError!==void 0&&(M=p.onCaughtError),p.onRecoverableError!==void 0&&(V=p.onRecoverableError),p.formState!==void 0&&(oe=p.formState)),l=pD(s,1,!0,l,p??null,y,k,oe,S,M,V,ED),l.context=hD(null),p=l.current,y=Ai(),y=oa(y),k=sl(y),k.callback=null,ol(p,k,y),p=y,l.current.lanes=p,Oe(l,p),go(l),s[Nn]=l.current,rw(s),new Qy(l)},wh.version="19.2.0",wh}var MD;function eV(){if(MD)return Ew.exports;MD=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch{}}return t(),Ew.exports=Z8(),Ew.exports}var Pw=eV();/**
 * react-router v7.9.2
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */var jD="popstate";function tV(t={}){function e(n,a){let{pathname:i,search:o,hash:c}=n.location;return iT("",{pathname:i,search:o,hash:c},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(n,a){return typeof a=="string"?a:Tm(a)}return nV(e,r,null,t)}function Sn(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Ys(t,e){if(!t)try{throw new Error(e)}catch{}}function rV(){return Math.random().toString(36).substring(2,10)}function LD(t,e){return{usr:t.state,key:t.key,idx:e}}function iT(t,e,r=null,n){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?vp(e):e,state:r,key:e&&e.key||n||rV()}}function Tm({pathname:t="/",search:e="",hash:r=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function vp(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substring(r),t=t.substring(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substring(n),t=t.substring(0,n)),t&&(e.pathname=t)}return e}function nV(t,e,r,n={}){let{window:a=document.defaultView,v5Compat:i=!1}=n,o=a.history,c="POP",u=null,d=f();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function f(){return(o.state||{idx:null}).idx}function h(){c="POP";let E=f(),T=E==null?null:E-d;d=E,u&&u({action:c,location:b.location,delta:T})}function m(E,T){c="PUSH";let R=iT(b.location,E,T);d=f()+1;let P=LD(R,d),A=b.createHref(R);try{o.pushState(P,"",A)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;a.location.assign(A)}i&&u&&u({action:c,location:b.location,delta:1})}function _(E,T){c="REPLACE";let R=iT(b.location,E,T);d=f();let P=LD(R,d),A=b.createHref(R);o.replaceState(P,"",A),i&&u&&u({action:c,location:b.location,delta:0})}function w(E){return aV(E)}let b={get action(){return c},get location(){return t(a,o)},listen(E){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(jD,h),u=E,()=>{a.removeEventListener(jD,h),u=null}},createHref(E){return e(a,E)},createURL:w,encodeLocation(E){let T=w(E);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:m,replace:_,go(E){return o.go(E)}};return b}function aV(t,e=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Sn(r,"No window.location.(origin|href) available to create URL");let n=typeof t=="string"?t:Tm(t);return n=n.replace(/ $/,"%20"),!e&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function QL(t,e,r="/"){return iV(t,e,r,!1)}function iV(t,e,r,n){let a=typeof e=="string"?vp(e):e,i=Bc(a.pathname||"/",r);if(i==null)return null;let o=ZL(t);sV(o);let c=null;for(let u=0;c==null&&u<o.length;++u){let d=yV(i);c=mV(o[u],d,n)}return c}function ZL(t,e=[],r=[],n="",a=!1){let i=(o,c,u=a,d)=>{let f={relativePath:d===void 0?o.path||"":d,caseSensitive:o.caseSensitive===!0,childrenIndex:c,route:o};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(n)&&u)return;Sn(f.relativePath.startsWith(n),`Absolute route path "${f.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(n.length)}let h=Dc([n,f.relativePath]),m=r.concat(f);o.children&&o.children.length>0&&(Sn(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${h}".`),ZL(o.children,e,m,h,u)),!(o.path==null&&!o.index)&&e.push({path:h,score:pV(h,o.index),routesMeta:m})};return t.forEach((o,c)=>{if(o.path===""||!o.path?.includes("?"))i(o,c);else for(let u of e3(o.path))i(o,c,!0,u)}),e}function e3(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,a=r.endsWith("?"),i=r.replace(/\?$/,"");if(n.length===0)return a?[i,""]:[i];let o=e3(n.join("/")),c=[];return c.push(...o.map(u=>u===""?i:[i,u].join("/"))),a&&c.push(...o),c.map(u=>t.startsWith("/")&&u===""?"/":u)}function sV(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:hV(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var oV=/^:[\w-]+$/,cV=3,lV=2,uV=1,dV=10,fV=-2,BD=t=>t==="*";function pV(t,e){let r=t.split("/"),n=r.length;return r.some(BD)&&(n+=fV),e&&(n+=lV),r.filter(a=>!BD(a)).reduce((a,i)=>a+(oV.test(i)?cV:i===""?uV:dV),n)}function hV(t,e){return t.length===e.length&&t.slice(0,-1).every((n,a)=>n===e[a])?t[t.length-1]-e[e.length-1]:0}function mV(t,e,r=!1){let{routesMeta:n}=t,a={},i="/",o=[];for(let c=0;c<n.length;++c){let u=n[c],d=c===n.length-1,f=i==="/"?e:e.slice(i.length)||"/",h=C_({path:u.relativePath,caseSensitive:u.caseSensitive,end:d},f),m=u.route;if(!h&&d&&r&&!n[n.length-1].route.index&&(h=C_({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},f)),!h)return null;Object.assign(a,h.params),o.push({params:a,pathname:Dc([i,h.pathname]),pathnameBase:kV(Dc([i,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(i=Dc([i,h.pathnameBase]))}return o}function C_(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[r,n]=gV(t.path,t.caseSensitive,t.end),a=e.match(r);if(!a)return null;let i=a[0],o=i.replace(/(.)\/+$/,"$1"),c=a.slice(1);return{params:n.reduce((d,{paramName:f,isOptional:h},m)=>{if(f==="*"){let w=c[m]||"";o=i.slice(0,i.length-w.length).replace(/(.)\/+$/,"$1")}const _=c[m];return h&&!_?d[f]=void 0:d[f]=(_||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:t}}function gV(t,e=!1,r=!0){Ys(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let n=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,u)=>(n.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(n.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),n]}function yV(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Ys(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Bc(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function vV(t,e="/"){let{pathname:r,search:n="",hash:a=""}=typeof t=="string"?vp(t):t;return{pathname:r?r.startsWith("/")?r:_V(r,e):e,search:wV(n),hash:SV(a)}}function _V(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function Aw(t,e,r,n){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(n)}].  Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function bV(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function ox(t){let e=bV(t);return e.map((r,n)=>n===e.length-1?r.pathname:r.pathnameBase)}function cx(t,e,r,n=!1){let a;typeof t=="string"?a=vp(t):(a={...t},Sn(!a.pathname||!a.pathname.includes("?"),Aw("?","pathname","search",a)),Sn(!a.pathname||!a.pathname.includes("#"),Aw("#","pathname","hash",a)),Sn(!a.search||!a.search.includes("#"),Aw("#","search","hash",a)));let i=t===""||a.pathname==="",o=i?"/":a.pathname,c;if(o==null)c=r;else{let h=e.length-1;if(!n&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),h-=1;a.pathname=m.join("/")}c=h>=0?e[h]:"/"}let u=vV(a,c),d=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(d||f)&&(u.pathname+="/"),u}var Dc=t=>t.join("/").replace(/\/\/+/g,"/"),kV=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),wV=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,SV=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function EV(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var t3=["POST","PUT","PATCH","DELETE"];new Set(t3);var TV=["GET",...t3];new Set(TV);var _p=v.createContext(null);_p.displayName="DataRouter";var Cb=v.createContext(null);Cb.displayName="DataRouterState";v.createContext(!1);var r3=v.createContext({isTransitioning:!1});r3.displayName="ViewTransition";var CV=v.createContext(new Map);CV.displayName="Fetchers";var xV=v.createContext(null);xV.displayName="Await";var eo=v.createContext(null);eo.displayName="Navigation";var Sg=v.createContext(null);Sg.displayName="Location";var bs=v.createContext({outlet:null,matches:[],isDataRoute:!1});bs.displayName="Route";var lx=v.createContext(null);lx.displayName="RouteError";function PV(t,{relative:e}={}){Sn(bp(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=v.useContext(eo),{hash:a,pathname:i,search:o}=Eg(t,{relative:e}),c=i;return r!=="/"&&(c=i==="/"?r:Dc([r,i])),n.createHref({pathname:c,search:o,hash:a})}function bp(){return v.useContext(Sg)!=null}function yi(){return Sn(bp(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(Sg).location}var n3="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function a3(t){v.useContext(eo).static||v.useLayoutEffect(t)}function tn(){let{isDataRoute:t}=v.useContext(bs);return t?$V():AV()}function AV(){Sn(bp(),"useNavigate() may be used only in the context of a <Router> component.");let t=v.useContext(_p),{basename:e,navigator:r}=v.useContext(eo),{matches:n}=v.useContext(bs),{pathname:a}=yi(),i=JSON.stringify(ox(n)),o=v.useRef(!1);return a3(()=>{o.current=!0}),v.useCallback((u,d={})=>{if(Ys(o.current,n3),!o.current)return;if(typeof u=="number"){r.go(u);return}let f=cx(u,JSON.parse(i),a,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Dc([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,i,a,t])}var RV=v.createContext(null);function DV(t){let e=v.useContext(bs).outlet;return v.useMemo(()=>e&&v.createElement(RV.Provider,{value:t},e),[e,t])}function i3(){let{matches:t}=v.useContext(bs),e=t[t.length-1];return e?e.params:{}}function Eg(t,{relative:e}={}){let{matches:r}=v.useContext(bs),{pathname:n}=yi(),a=JSON.stringify(ox(r));return v.useMemo(()=>cx(t,JSON.parse(a),n,e==="path"),[t,a,n,e])}function OV(t,e){return s3(t,e)}function s3(t,e,r,n,a){Sn(bp(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=v.useContext(eo),{matches:o}=v.useContext(bs),c=o[o.length-1],u=c?c.params:{},d=c?c.pathname:"/",f=c?c.pathnameBase:"/",h=c&&c.route;{let R=h&&h.path||"";o3(d,!h||R.endsWith("*")||R.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${d}" (under <Route path="${R}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.

Please change the parent <Route path="${R}"> to <Route path="${R==="/"?"*":`${R}/*`}">.`)}let m=yi(),_;if(e){let R=typeof e=="string"?vp(e):e;Sn(f==="/"||R.pathname?.startsWith(f),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${R.pathname}" was given in the \`location\` prop.`),_=R}else _=m;let w=_.pathname||"/",b=w;if(f!=="/"){let R=f.replace(/^\//,"").split("/");b="/"+w.replace(/^\//,"").split("/").slice(R.length).join("/")}let E=QL(t,{pathname:b});Ys(h||E!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),Ys(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let T=LV(E&&E.map(R=>Object.assign({},R,{params:Object.assign({},u,R.params),pathname:Dc([f,i.encodeLocation?i.encodeLocation(R.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathname]),pathnameBase:R.pathnameBase==="/"?f:Dc([f,i.encodeLocation?i.encodeLocation(R.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:R.pathnameBase])})),o,r,n,a);return e&&T?v.createElement(Sg.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",..._},navigationType:"POP"}},T):T}function NV(){let t=zV(),e=EV(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,n="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:n},i={padding:"2px 4px",backgroundColor:n},o=null;return o=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:i},"ErrorBoundary")," or"," ",v.createElement("code",{style:i},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),r?v.createElement("pre",{style:a},r):null,o)}var IV=v.createElement(NV,null),MV=class extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.unstable_onError&&this.props.unstable_onError(t,e)}render(){return this.state.error!==void 0?v.createElement(bs.Provider,{value:this.props.routeContext},v.createElement(lx.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function jV({routeContext:t,match:e,children:r}){let n=v.useContext(_p);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),v.createElement(bs.Provider,{value:t},r)}function LV(t,e=[],r=null,n=null,a=null){if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let i=t,o=r?.errors;if(o!=null){let d=i.findIndex(f=>f.route.id&&o?.[f.route.id]!==void 0);Sn(d>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),i=i.slice(0,Math.min(i.length,d+1))}let c=!1,u=-1;if(r)for(let d=0;d<i.length;d++){let f=i[d];if((f.route.HydrateFallback||f.route.hydrateFallbackElement)&&(u=d),f.route.id){let{loaderData:h,errors:m}=r,_=f.route.loader&&!h.hasOwnProperty(f.route.id)&&(!m||m[f.route.id]===void 0);if(f.route.lazy||_){c=!0,u>=0?i=i.slice(0,u+1):i=[i[0]];break}}}return i.reduceRight((d,f,h)=>{let m,_=!1,w=null,b=null;r&&(m=o&&f.route.id?o[f.route.id]:void 0,w=f.route.errorElement||IV,c&&(u<0&&h===0?(o3("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),_=!0,b=null):u===h&&(_=!0,b=f.route.hydrateFallbackElement||null)));let E=e.concat(i.slice(0,h+1)),T=()=>{let R;return m?R=w:_?R=b:f.route.Component?R=v.createElement(f.route.Component,null):f.route.element?R=f.route.element:R=d,v.createElement(jV,{match:f,routeContext:{outlet:d,matches:E,isDataRoute:r!=null},children:R})};return r&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?v.createElement(MV,{location:r.location,revalidation:r.revalidation,component:w,error:m,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0},unstable_onError:n}):T()},null)}function ux(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function BV(t){let e=v.useContext(_p);return Sn(e,ux(t)),e}function UV(t){let e=v.useContext(Cb);return Sn(e,ux(t)),e}function FV(t){let e=v.useContext(bs);return Sn(e,ux(t)),e}function dx(t){let e=FV(t),r=e.matches[e.matches.length-1];return Sn(r.route.id,`${t} can only be used on routes that contain a unique "id"`),r.route.id}function qV(){return dx("useRouteId")}function zV(){let t=v.useContext(lx),e=UV("useRouteError"),r=dx("useRouteError");return t!==void 0?t:e.errors?.[r]}function $V(){let{router:t}=BV("useNavigate"),e=dx("useNavigate"),r=v.useRef(!1);return a3(()=>{r.current=!0}),v.useCallback(async(a,i={})=>{Ys(r.current,n3),r.current&&(typeof a=="number"?t.navigate(a):await t.navigate(a,{fromRouteId:e,...i}))},[t,e])}var UD={};function o3(t,e,r){!e&&!UD[t]&&(UD[t]=!0,Ys(!1,r))}v.memo(VV);function VV({routes:t,future:e,state:r,unstable_onError:n}){return s3(t,void 0,r,n,e)}function em({to:t,replace:e,state:r,relative:n}){Sn(bp(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=v.useContext(eo);Ys(!a,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=v.useContext(bs),{pathname:o}=yi(),c=tn(),u=cx(t,ox(i),o,n==="path"),d=JSON.stringify(u);return v.useEffect(()=>{c(JSON.parse(d),{replace:e,state:r,relative:n})},[c,d,n,e,r]),null}function c3(t){return DV(t.context)}function yn(t){Sn(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function HV({basename:t="/",children:e=null,location:r,navigationType:n="POP",navigator:a,static:i=!1}){Sn(!bp(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=t.replace(/^\/*/,"/"),c=v.useMemo(()=>({basename:o,navigator:a,static:i,future:{}}),[o,a,i]);typeof r=="string"&&(r=vp(r));let{pathname:u="/",search:d="",hash:f="",state:h=null,key:m="default"}=r,_=v.useMemo(()=>{let w=Bc(u,o);return w==null?null:{location:{pathname:w,search:d,hash:f,state:h,key:m},navigationType:n}},[o,u,d,f,h,m,n]);return Ys(_!=null,`<Router basename="${o}"> is not able to match the URL "${u}${d}${f}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:v.createElement(eo.Provider,{value:c},v.createElement(Sg.Provider,{children:e,value:_}))}function GV({children:t,location:e}){return OV(sT(t),e)}function sT(t,e=[]){let r=[];return v.Children.forEach(t,(n,a)=>{if(!v.isValidElement(n))return;let i=[...e,a];if(n.type===v.Fragment){r.push.apply(r,sT(n.props.children,i));return}Sn(n.type===yn,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Sn(!n.props.index||!n.props.children,"An index route cannot have child routes.");let o={id:n.props.id||i.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,middleware:n.props.middleware,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=sT(n.props.children,i)),r.push(o)}),r}var Mv="get",jv="application/x-www-form-urlencoded";function xb(t){return t!=null&&typeof t.tagName=="string"}function WV(t){return xb(t)&&t.tagName.toLowerCase()==="button"}function KV(t){return xb(t)&&t.tagName.toLowerCase()==="form"}function YV(t){return xb(t)&&t.tagName.toLowerCase()==="input"}function XV(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function JV(t,e){return t.button===0&&(!e||e==="_self")&&!XV(t)}var ev=null;function QV(){if(ev===null)try{new FormData(document.createElement("form"),0),ev=!1}catch{ev=!0}return ev}var ZV=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Rw(t){return t!=null&&!ZV.has(t)?(Ys(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${jv}"`),null):t}function e7(t,e){let r,n,a,i,o;if(KV(t)){let c=t.getAttribute("action");n=c?Bc(c,e):null,r=t.getAttribute("method")||Mv,a=Rw(t.getAttribute("enctype"))||jv,i=new FormData(t)}else if(WV(t)||YV(t)&&(t.type==="submit"||t.type==="image")){let c=t.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=t.getAttribute("formaction")||c.getAttribute("action");if(n=u?Bc(u,e):null,r=t.getAttribute("formmethod")||c.getAttribute("method")||Mv,a=Rw(t.getAttribute("formenctype"))||Rw(c.getAttribute("enctype"))||jv,i=new FormData(c,t),!QV()){let{name:d,type:f,value:h}=t;if(f==="image"){let m=d?`${d}.`:"";i.append(`${m}x`,"0"),i.append(`${m}y`,"0")}else d&&i.append(d,h)}}else{if(xb(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Mv,n=null,a=jv,o=t}return i&&a==="text/plain"&&(o=i,i=void 0),{action:n,method:r.toLowerCase(),encType:a,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function fx(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function t7(t,e,r){let n=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n.pathname==="/"?n.pathname=`_root.${r}`:e&&Bc(n.pathname,e)==="/"?n.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:n.pathname=`${n.pathname.replace(/\/$/,"")}.${r}`,n}async function r7(t,e){if(t.id in e)return e[t.id];try{let r=await import(t.module);return e[t.id]=r,r}catch{return window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function n7(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function a7(t,e,r){let n=await Promise.all(t.map(async a=>{let i=e.routes[a.route.id];if(i){let o=await r7(i,r);return o.links?o.links():[]}return[]}));return c7(n.flat(1).filter(n7).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function FD(t,e,r,n,a,i){let o=(u,d)=>r[d]?u.route.id!==r[d].route.id:!0,c=(u,d)=>r[d].pathname!==u.pathname||r[d].route.path?.endsWith("*")&&r[d].params["*"]!==u.params["*"];return i==="assets"?e.filter((u,d)=>o(u,d)||c(u,d)):i==="data"?e.filter((u,d)=>{let f=n.routes[u.route.id];if(!f||!f.hasLoader)return!1;if(o(u,d)||c(u,d))return!0;if(u.route.shouldRevalidate){let h=u.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof h=="boolean")return h}return!0}):[]}function i7(t,e,{includeHydrateFallback:r}={}){return s7(t.map(n=>{let a=e.routes[n.route.id];if(!a)return[];let i=[a.module];return a.clientActionModule&&(i=i.concat(a.clientActionModule)),a.clientLoaderModule&&(i=i.concat(a.clientLoaderModule)),r&&a.hydrateFallbackModule&&(i=i.concat(a.hydrateFallbackModule)),a.imports&&(i=i.concat(a.imports)),i}).flat(1))}function s7(t){return[...new Set(t)]}function o7(t){let e={},r=Object.keys(t).sort();for(let n of r)e[n]=t[n];return e}function c7(t,e){let r=new Set;return new Set(e),t.reduce((n,a)=>{let i=JSON.stringify(o7(a));return r.has(i)||(r.add(i),n.push({key:i,link:a})),n},[])}function l3(){let t=v.useContext(_p);return fx(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function l7(){let t=v.useContext(Cb);return fx(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var px=v.createContext(void 0);px.displayName="FrameworkContext";function u3(){let t=v.useContext(px);return fx(t,"You must render this element inside a <HydratedRouter> element"),t}function u7(t,e){let r=v.useContext(px),[n,a]=v.useState(!1),[i,o]=v.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:d,onMouseLeave:f,onTouchStart:h}=e,m=v.useRef(null);v.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let b=T=>{T.forEach(R=>{o(R.isIntersecting)})},E=new IntersectionObserver(b,{threshold:.5});return m.current&&E.observe(m.current),()=>{E.disconnect()}}},[t]),v.useEffect(()=>{if(n){let b=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(b)}}},[n]);let _=()=>{a(!0)},w=()=>{a(!1),o(!1)};return r?t!=="intent"?[i,m,{}]:[i,m,{onFocus:Sh(c,_),onBlur:Sh(u,w),onMouseEnter:Sh(d,_),onMouseLeave:Sh(f,w),onTouchStart:Sh(h,_)}]:[!1,m,{}]}function Sh(t,e){return r=>{t&&t(r),r.defaultPrevented||e(r)}}function d7({page:t,...e}){let{router:r}=l3(),n=v.useMemo(()=>QL(r.routes,t,r.basename),[r.routes,t,r.basename]);return n?v.createElement(p7,{page:t,matches:n,...e}):null}function f7(t){let{manifest:e,routeModules:r}=u3(),[n,a]=v.useState([]);return v.useEffect(()=>{let i=!1;return a7(t,e,r).then(o=>{i||a(o)}),()=>{i=!0}},[t,e,r]),n}function p7({page:t,matches:e,...r}){let n=yi(),{manifest:a,routeModules:i}=u3(),{basename:o}=l3(),{loaderData:c,matches:u}=l7(),d=v.useMemo(()=>FD(t,e,u,a,n,"data"),[t,e,u,a,n]),f=v.useMemo(()=>FD(t,e,u,a,n,"assets"),[t,e,u,a,n]),h=v.useMemo(()=>{if(t===n.pathname+n.search+n.hash)return[];let w=new Set,b=!1;if(e.forEach(T=>{let R=a.routes[T.route.id];!R||!R.hasLoader||(!d.some(P=>P.route.id===T.route.id)&&T.route.id in c&&i[T.route.id]?.shouldRevalidate||R.hasClientLoader?b=!0:w.add(T.route.id))}),w.size===0)return[];let E=t7(t,o,"data");return b&&w.size>0&&E.searchParams.set("_routes",e.filter(T=>w.has(T.route.id)).map(T=>T.route.id).join(",")),[E.pathname+E.search]},[o,c,n,a,d,e,t,i]),m=v.useMemo(()=>i7(f,a),[f,a]),_=f7(f);return v.createElement(v.Fragment,null,h.map(w=>v.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),m.map(w=>v.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),_.map(({key:w,link:b})=>v.createElement("link",{key:w,nonce:r.nonce,...b})))}function h7(...t){return e=>{t.forEach(r=>{typeof r=="function"?r(e):r!=null&&(r.current=e)})}}var d3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{d3&&(window.__reactRouterVersion="7.9.2")}catch{}function m7({basename:t,children:e,window:r}){let n=v.useRef();n.current==null&&(n.current=tV({window:r,v5Compat:!0}));let a=n.current,[i,o]=v.useState({action:a.action,location:a.location}),c=v.useCallback(u=>{v.startTransition(()=>o(u))},[o]);return v.useLayoutEffect(()=>a.listen(c),[a,c]),v.createElement(HV,{basename:t,children:e,location:i.location,navigationType:i.action,navigator:a})}var f3=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,p3=v.forwardRef(function({onClick:e,discover:r="render",prefetch:n="none",relative:a,reloadDocument:i,replace:o,state:c,target:u,to:d,preventScrollReset:f,viewTransition:h,...m},_){let{basename:w}=v.useContext(eo),b=typeof d=="string"&&f3.test(d),E,T=!1;if(typeof d=="string"&&b&&(E=d,d3))try{let D=new URL(window.location.href),N=d.startsWith("//")?new URL(D.protocol+d):new URL(d),L=Bc(N.pathname,w);N.origin===D.origin&&L!=null?d=L+N.search+N.hash:T=!0}catch{Ys(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let R=PV(d,{relative:a}),[P,A,C]=u7(n,m),O=_7(d,{replace:o,state:c,target:u,preventScrollReset:f,relative:a,viewTransition:h});function I(D){e&&e(D),D.defaultPrevented||O(D)}let x=v.createElement("a",{...m,...C,href:E||R,onClick:T||i?e:I,ref:h7(_,A),target:u,"data-discover":!b&&r==="render"?"true":void 0});return P&&!b?v.createElement(v.Fragment,null,x,v.createElement(d7,{page:R})):x});p3.displayName="Link";var g7=v.forwardRef(function({"aria-current":e="page",caseSensitive:r=!1,className:n="",end:a=!1,style:i,to:o,viewTransition:c,children:u,...d},f){let h=Eg(o,{relative:d.relative}),m=yi(),_=v.useContext(Cb),{navigator:w,basename:b}=v.useContext(eo),E=_!=null&&E7(h)&&c===!0,T=w.encodeLocation?w.encodeLocation(h).pathname:h.pathname,R=m.pathname,P=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;r||(R=R.toLowerCase(),P=P?P.toLowerCase():null,T=T.toLowerCase()),P&&b&&(P=Bc(P,b)||P);const A=T!=="/"&&T.endsWith("/")?T.length-1:T.length;let C=R===T||!a&&R.startsWith(T)&&R.charAt(A)==="/",O=P!=null&&(P===T||!a&&P.startsWith(T)&&P.charAt(T.length)==="/"),I={isActive:C,isPending:O,isTransitioning:E},x=C?e:void 0,D;typeof n=="function"?D=n(I):D=[n,C?"active":null,O?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let N=typeof i=="function"?i(I):i;return v.createElement(p3,{...d,"aria-current":x,className:D,ref:f,style:N,to:o,viewTransition:c},typeof u=="function"?u(I):u)});g7.displayName="NavLink";var y7=v.forwardRef(({discover:t="render",fetcherKey:e,navigate:r,reloadDocument:n,replace:a,state:i,method:o=Mv,action:c,onSubmit:u,relative:d,preventScrollReset:f,viewTransition:h,...m},_)=>{let w=w7(),b=S7(c,{relative:d}),E=o.toLowerCase()==="get"?"get":"post",T=typeof c=="string"&&f3.test(c),R=P=>{if(u&&u(P),P.defaultPrevented)return;P.preventDefault();let A=P.nativeEvent.submitter,C=A?.getAttribute("formmethod")||o;w(A||P.currentTarget,{fetcherKey:e,method:C,navigate:r,replace:a,state:i,relative:d,preventScrollReset:f,viewTransition:h})};return v.createElement("form",{ref:_,method:E,action:b,onSubmit:n?u:R,...m,"data-discover":!T&&t==="render"?"true":void 0})});y7.displayName="Form";function v7(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function h3(t){let e=v.useContext(_p);return Sn(e,v7(t)),e}function _7(t,{target:e,replace:r,state:n,preventScrollReset:a,relative:i,viewTransition:o}={}){let c=tn(),u=yi(),d=Eg(t,{relative:i});return v.useCallback(f=>{if(JV(f,e)){f.preventDefault();let h=r!==void 0?r:Tm(u)===Tm(d);c(t,{replace:h,state:n,preventScrollReset:a,relative:i,viewTransition:o})}},[u,c,d,r,n,e,t,a,i,o])}var b7=0,k7=()=>`__${String(++b7)}__`;function w7(){let{router:t}=h3("useSubmit"),{basename:e}=v.useContext(eo),r=qV();return v.useCallback(async(n,a={})=>{let{action:i,method:o,encType:c,formData:u,body:d}=e7(n,e);if(a.navigate===!1){let f=a.fetcherKey||k7();await t.fetch(f,r,a.action||i,{preventScrollReset:a.preventScrollReset,formData:u,body:d,formMethod:a.method||o,formEncType:a.encType||c,flushSync:a.flushSync})}else await t.navigate(a.action||i,{preventScrollReset:a.preventScrollReset,formData:u,body:d,formMethod:a.method||o,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:r,flushSync:a.flushSync,viewTransition:a.viewTransition})},[t,e,r])}function S7(t,{relative:e}={}){let{basename:r}=v.useContext(eo),n=v.useContext(bs);Sn(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),i={...Eg(t||".",{relative:e})},o=yi();if(t==null){i.search=o.search;let c=new URLSearchParams(i.search),u=c.getAll("index");if(u.some(f=>f==="")){c.delete("index"),u.filter(h=>h).forEach(h=>c.append("index",h));let f=c.toString();i.search=f?`?${f}`:""}}return(!t||t===".")&&a.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:Dc([r,i.pathname])),Tm(i)}function E7(t,{relative:e}={}){let r=v.useContext(r3);Sn(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=h3("useViewTransitionState"),a=Eg(t,{relative:e});if(!r.isTransitioning)return!1;let i=Bc(r.currentLocation.pathname,n)||r.currentLocation.pathname,o=Bc(r.nextLocation.pathname,n)||r.nextLocation.pathname;return C_(a.pathname,o)!=null||C_(a.pathname,i)!=null}var Gc=JL();/*! Capacitor: https://capacitorjs.com/ - MIT License */var Kf;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(Kf||(Kf={}));class Dw extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const T7=t=>{var e,r;return t?.androidBridge?"android":!((r=(e=t?.webkit)===null||e===void 0?void 0:e.messageHandlers)===null||r===void 0)&&r.bridge?"ios":"web"},C7=t=>{const e=t.CapacitorCustomPlatform||null,r=t.Capacitor||{},n=r.Plugins=r.Plugins||{},a=()=>e!==null?e.name:T7(t),i=()=>a()!=="web",o=h=>{const m=d.get(h);return!!(m?.platforms.has(a())||c(h))},c=h=>{var m;return(m=r.PluginHeaders)===null||m===void 0?void 0:m.find(_=>_.name===h)},u=h=>t.console.error(h),d=new Map,f=(h,m={})=>{const _=d.get(h);if(_)return _.proxy;const w=a(),b=c(h);let E;const T=async()=>(!E&&w in m?E=typeof m[w]=="function"?E=await m[w]():E=m[w]:e!==null&&!E&&"web"in m&&(E=typeof m.web=="function"?E=await m.web():E=m.web),E),R=(x,D)=>{var N,L;if(b){const j=b?.methods.find(q=>D===q.name);if(j)return j.rtype==="promise"?q=>r.nativePromise(h,D.toString(),q):(q,U)=>r.nativeCallback(h,D.toString(),q,U);if(x)return(N=x[D])===null||N===void 0?void 0:N.bind(x)}else{if(x)return(L=x[D])===null||L===void 0?void 0:L.bind(x);throw new Dw(`"${h}" plugin is not implemented on ${w}`,Kf.Unimplemented)}},P=x=>{let D;const N=(...L)=>{const j=T().then(q=>{const U=R(q,x);if(U){const W=U(...L);return D=W?.remove,W}else throw new Dw(`"${h}.${x}()" is not implemented on ${w}`,Kf.Unimplemented)});return x==="addListener"&&(j.remove=async()=>D()),j};return N.toString=()=>`${x.toString()}() { [capacitor code] }`,Object.defineProperty(N,"name",{value:x,writable:!1,configurable:!1}),N},A=P("addListener"),C=P("removeListener"),O=(x,D)=>{const N=A({eventName:x},D),L=async()=>{const q=await N;C({eventName:x,callbackId:q},D)},j=new Promise(q=>N.then(()=>q({remove:L})));return j.remove=async()=>{await L()},j},I=new Proxy({},{get(x,D){switch(D){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return b?O:A;case"removeListener":return C;default:return P(D)}}});return n[h]=I,d.set(h,{name:h,proxy:I,platforms:new Set([...Object.keys(m),...b?[w]:[]])}),I};return r.convertFileSrc||(r.convertFileSrc=h=>h),r.getPlatform=a,r.handleError=u,r.isNativePlatform=i,r.isPluginAvailable=o,r.registerPlugin=f,r.Exception=Dw,r.DEBUG=!!r.DEBUG,r.isLoggingEnabled=!!r.isLoggingEnabled,r},x7=t=>t.Capacitor=C7(t),Gr=x7(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),to=Gr.registerPlugin;class m3{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(e,r){let n=!1;this.listeners[e]||(this.listeners[e]=[],n=!0),this.listeners[e].push(r);const i=this.windowListeners[e];i&&!i.registered&&this.addWindowListener(i),n&&this.sendRetainedArgumentsForEvent(e);const o=async()=>this.removeListener(e,r);return Promise.resolve({remove:o})}async removeAllListeners(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}}notifyListeners(e,r,n){const a=this.listeners[e];if(!a){if(n){let i=this.retainedEventArguments[e];i||(i=[]),i.push(r),this.retainedEventArguments[e]=i}return}a.forEach(i=>i(r))}hasListeners(e){var r;return!!(!((r=this.listeners[e])===null||r===void 0)&&r.length)}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:n=>{this.notifyListeners(r,n)}}}unimplemented(e="not implemented"){return new Gr.Exception(e,Kf.Unimplemented)}unavailable(e="not available"){return new Gr.Exception(e,Kf.Unavailable)}async removeListener(e,r){const n=this.listeners[e];if(!n)return;const a=n.indexOf(r);this.listeners[e].splice(a,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}sendRetainedArgumentsForEvent(e){const r=this.retainedEventArguments[e];r&&(delete this.retainedEventArguments[e],r.forEach(n=>{this.notifyListeners(e,n)}))}}const qD=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),zD=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class P7 extends m3{async getCookies(){const e=document.cookie,r={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[a,i]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");a=zD(a).trim(),i=zD(i).trim(),r[a]=i}),r}async setCookie(e){try{const r=qD(e.key),n=qD(e.value),a=`; expires=${(e.expires||"").replace("expires=","")}`,i=(e.path||"/").replace("path=",""),o=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${n||""}${a}; path=${i}; ${o};`}catch(r){return Promise.reject(r)}}async deleteCookie(e){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}}async clearCookies(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}}async clearAllCookies(){try{await this.clearCookies()}catch(e){return Promise.reject(e)}}}to("CapacitorCookies",{web:()=>new P7});const A7=async t=>new Promise((e,r)=>{const n=new FileReader;n.onload=()=>{const a=n.result;e(a.indexOf(",")>=0?a.split(",")[1]:a)},n.onerror=a=>r(a),n.readAsDataURL(t)}),R7=(t={})=>{const e=Object.keys(t);return Object.keys(t).map(a=>a.toLocaleLowerCase()).reduce((a,i,o)=>(a[i]=t[e[o]],a),{})},D7=(t,e=!0)=>t?Object.entries(t).reduce((n,a)=>{const[i,o]=a;let c,u;return Array.isArray(o)?(u="",o.forEach(d=>{c=e?encodeURIComponent(d):d,u+=`${i}=${c}&`}),u.slice(0,-1)):(c=e?encodeURIComponent(o):o,u=`${i}=${c}`),`${n}&${u}`},"").substr(1):null,O7=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),a=R7(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(a.includes("application/x-www-form-urlencoded")){const i=new URLSearchParams;for(const[o,c]of Object.entries(t.data||{}))i.set(o,c);r.body=i.toString()}else if(a.includes("multipart/form-data")||t.data instanceof FormData){const i=new FormData;if(t.data instanceof FormData)t.data.forEach((c,u)=>{i.append(u,c)});else for(const c of Object.keys(t.data))i.append(c,t.data[c]);r.body=i;const o=new Headers(r.headers);o.delete("content-type"),r.headers=o}else(a.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class N7 extends m3{async request(e){const r=O7(e,e.webFetchExtra),n=D7(e.params,e.shouldEncodeUrlParams),a=n?`${e.url}?${n}`:e.url,i=await fetch(a,r),o=i.headers.get("content-type")||"";let{responseType:c="text"}=i.ok?e:{};o.includes("application/json")&&(c="json");let u,d;switch(c){case"arraybuffer":case"blob":d=await i.blob(),u=await A7(d);break;case"json":u=await i.json();break;case"document":case"text":default:u=await i.text()}const f={};return i.headers.forEach((h,m)=>{f[m]=h}),{data:u,headers:f,status:i.status,url:i.url}}async get(e){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))}async post(e){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))}async put(e){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))}async patch(e){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))}async delete(e){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))}}to("CapacitorHttp",{web:()=>new N7});const I7="modulepreload",M7=function(t,e){return new URL(t,e).href},$D={},qr=function(e,r,n){let a=Promise.resolve();if(r&&r.length>0){let d=function(f){return Promise.all(f.map(h=>Promise.resolve(h).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};const o=document.getElementsByTagName("link"),c=document.querySelector("meta[property=csp-nonce]"),u=c?.nonce||c?.getAttribute("nonce");a=d(r.map(f=>{if(f=M7(f,n),f in $D)return;$D[f]=!0;const h=f.endsWith(".css"),m=h?'[rel="stylesheet"]':"";if(n)for(let w=o.length-1;w>=0;w--){const b=o[w];if(b.href===f&&(!h||b.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${m}`))return;const _=document.createElement("link");if(_.rel=h?"stylesheet":I7,h||(_.as="script"),_.crossOrigin="",_.href=f,u&&_.setAttribute("nonce",u),document.head.appendChild(_),h)return new Promise((w,b)=>{_.addEventListener("load",w),_.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${f}`)))})}))}function i(o){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=o,window.dispatchEvent(c),!c.defaultPrevented)throw o}return a.then(o=>{for(const c of o||[])c.status==="rejected"&&i(c.reason);return e().catch(i)})},Cm=to("SocialLogin",{web:()=>qr(()=>import("./web-BldmwbWe.js"),[],import.meta.url).then(t=>new t.SocialLoginWeb)});var j7={};const L7={SOCKET:{NEEDS_PREMIUM:"premium_membership_required"}},B7=(()=>{try{if(typeof window>"u")return!1;const t=(window.location?.protocol||"").toLowerCase();return t==="capacitor:"||t==="ionic:"}catch{return!1}})(),U7=(()=>{try{if(typeof window>"u")return!1;const t=window.location?.hostname||"";return t==="localhost"||t==="127.0.0.1"}catch{return!1}})();function F7(){try{const t=window.localStorage?.getItem("api:url")||window.sessionStorage?.getItem("api:url");if(t&&/^https?:\/\//i.test(t))return t.replace(/\/$/,"")}catch{}return null}const VD=(()=>{const t=F7();return t||(B7?"https://dicelounge.app":U7?"http://localhost:4000":"https://dicelounge.app")})(),q7=globalThis?.APP_TARGET,z7=typeof process<"u"?j7?.APP_TARGET:void 0;let oT;try{oT="poker"}catch{oT=void 0}const $7=q7??z7??oT,kp=$7??"unified",HD=kp==="ceelo",$o=kp==="craps",Vo=kp==="poker",tf=kp==="unified",V7="rcb_eaWheJLZtWHJDCzyjruqCITeZlrK",GD={ceelo:"goog_TshzudibKBufFkwSWOodGwQAzMI",craps:"goog_FJlwnXjmdmVYKAbOkaiNyICWjkd",poker:"goog_AwODgwTGrKmYPFStHgslgZENzyG",unified:"goog_TshzudibKBufFkwSWOodGwQAzMI"},H7=GD[kp]??GD.ceelo,WD={ceelo:"appl_YhZbXhNlphlrxochELLsdNJajdp",craps:"appl_uCBrYNXSOUzHdUNnkbfMaNxBxXI",poker:"appl_SKqhTdSJqfYQQGUjeFYzVZoSBqA",unified:"appl_YhZbXhNlphlrxochELLsdNJajdp"},G7=WD[kp]??WD.ceelo,W7="true",g3="default",K7="com.zentaraone.ceeloLounge.chips",y3=K7,Y7="com.zentaraone.ceeloLounge.chips1000",X7="com.zentaraone.crapsLounge.chips_1000",J7="com.zentaraone.pokerLounge.chips_1000",v3=$o?X7:Vo?J7:Y7,Q7="",_3="Premium",Z7="AIzaSyCmll0lLOqadkCyjlrM-bb5H4n1L8eMxkE",eH="dice-lounge.firebaseapp.com",tH="dice-lounge",rH="1:423374558927:web:283377221554368e57c9ba",nH="G-MYPNJQR9RN",aH="dicelounge.app",iH="PEcc15f3HTqKKafnvHp1yRrbxrS8ji1kzZ4dyS4R+fI=",sH="193765381581-rucls0d90bmpkqaj0ginhp87chgjq70j.apps.googleusercontent.com",hx="193765381581-s0a3p66cb39cdfum20jrm0d2e87jmlu8.apps.googleusercontent.com",oH=hx,cH=hx,lH=$o?oH:Vo?cH:hx,uH="com.zentaraone.ceeloLounge.service",dH="com.zentaraone.crapsLounge.service",fH="com.zentaraone.pokerLounge.service",pH=$o?dH:Vo?fH:uH,hH="https://dicelounge.app/api/auth/apple/callback",mH="com.zentaraone.ceeloLounge",gH="com.zentaraone.crapsLounge",yH="com.zentaraone.pokerLounge",vH=$o?gH:Vo?yH:mH,_H="ca-app-pub-4219446894372985/2712849620",bH="ca-app-pub-4219446894372985/4123145978",kH="ca-app-pub-4219446894372985/6524920361",wH="ca-app-pub-4219446894372985/9898216833",SH="ca-app-pub-4219446894372985/2585675356",EH="ca-app-pub-4219446894372985/5810604494",TH=$o?bH:Vo?kH:_H,KD=$o?SH:Vo?EH:wH,CH="ca-app-pub-4219446894372985/3451216225",xH="ca-app-pub-4219446894372985/9366706127",PH="ca-app-pub-4219446894372985/4109691778",AH="ca-app-pub-4219446894372985/2394103660",RH="ca-app-pub-4219446894372985/5020267007",DH="ca-app-pub-4219446894372985/8389694041",OH=$o?xH:Vo?PH:CH,YD=$o?RH:Vo?DH:AH,pf=100,XD=30,b3=3,k3=3,qh=6e4,zh=1500,mx=to("SecureStoragePlugin",{web:()=>qr(()=>import("./web-DxiVssMJ.js"),[],import.meta.url).then(t=>new t.SecureStoragePluginWeb)}),ms=to("Preferences",{web:()=>qr(()=>import("./web-m88b9mqF.js"),[],import.meta.url).then(t=>new t.PreferencesWeb)}),Oc=Object.freeze(Object.defineProperty({__proto__:null,Preferences:ms},Symbol.toStringTag,{value:"Module"})),tv="sess:";async function JD(t){const{value:e}=await ms.get({key:t});return e??null}async function QD(t,e){await ms.set({key:t,value:e})}async function Ow(t){await ms.remove({key:t})}const Ws={async get(t){return JD(t)},async set(t,e){await QD(t,e)},async remove(t){await Ow(t)},async setSession(t,e){await QD(tv+t,e)},async getSession(t){return JD(tv+t)},async removeSession(t){return Ow(tv+t)},async clearSessionKeys(){try{const e=(await ms.keys()).keys?.filter(r=>r.startsWith(tv))||[];await Promise.all(e.map(r=>Ow(r)))}catch{}}};async function Yf(t){try{const e=await Ws.getSession(t);return e?JSON.parse(e):null}catch{return null}}async function Pb(t,e){try{await Ws.setSession(t,JSON.stringify(e))}catch{}}async function Xf(t){try{await Ws.removeSession(t)}catch{}}const Jf="session_token",gx=Gr.isNativePlatform();async function Qf(t){gx?await mx.set({key:Jf,value:t}):await Ws.setSession(Jf,t)}async function oi(){if(gx)try{const{value:e}=await mx.get({key:Jf});return e||void 0}catch{return}return await Ws.getSession(Jf)||void 0}async function Tg(){if(gx)try{await mx.remove({key:Jf})}catch{}else await Ws.removeSession(Jf)}const rf={done:!1};function ZD(t){if(!t)return"";const e=String(t);return e.length<=12?e:`${e.slice(0,6)}…${e.slice(-6)}`}async function NH(){const t=Gr.getPlatform(),e={mode:"online"},r=sH,n=lH;e.clientId=r,e.webClientId=r,e.mode="online",e.iOSClientId=n;const a={mode:"online"},i=t==="ios"?vH:pH,o=hH;a.clientId=i,t!=="ios"&&o&&(a.redirectUrl=o),ZD(r),ZD(n),await Cm.initialize({...Object.keys(e).length?{google:e}:{},...Object.keys(a).length?{apple:a}:{}})}async function Zf(t=!1){if(!(!t&&rf.done)){if(!t&&rf.promise)return rf.promise;rf.promise=NH().then(()=>{rf.done=!0}).catch(e=>{throw rf.promise=void 0,e})}}async function w3(){try{await Zf()}catch{}}function IH(){try{const t=Gr.getPlatform();if(t==="ios"||t==="android")return!0;const e=typeof window<"u"?window:{};return e.Capacitor?.isNativePlatform?!!e.Capacitor.isNativePlatform:!!e.webkit?.messageHandlers}catch{return!1}}async function MH(){await Zf(!0);const e=Gr.getPlatform()==="android"?{}:{scopes:["email","name"]},r=await Cm.login({provider:"apple",options:e}),n=r?.result?.idToken,a=r?.result?.profile,i=a?.email||void 0,o=a?.givenName||a?.name?.split(" ")?.[0],c=a?.familyName||a?.name?.split(" ")?.slice(1)?.join(" "),u=[o,c].filter(Boolean).join(" ").trim()||a?.name||void 0;if(!n)throw new Error("Apple did not return an id token");return{provider:"apple",idToken:n,email:i,name:u}}async function jH(){await Zf(!0);try{const e=Gr.getPlatform()==="android"?{}:{scopes:["email","profile"]},r=await Cm.login({provider:"google",options:e});r?.result,r&&typeof r=="object"&&Object.keys(r),r?.result&&Object.keys(r.result);const n=r?.result?.idToken,a=r?.result?.profile,i=a?.email||void 0,o=a?.name||[a?.givenName,a?.familyName].filter(Boolean).join(" ").trim()||void 0;if(!n)throw new Error("Google did not return an id token");return{provider:"google",idToken:n,email:i,name:o}}catch(t){const e=t;Object.prototype.toString.call(e),e?.message,e?.name,e?.code,e?.status;const r=String(e?.message||"").toLowerCase();if(r.includes("developer console")||r.includes("config")||r.includes("clientid")||e?.code===28444)try{await Zf(!0);const n=Gr.getPlatform(),a=await Cm.login({provider:"google",options:n==="android"?{}:{scopes:["email","profile"]}});a?.result;const i=a?.result?.idToken,o=a?.result?.profile,c=o?.email||void 0,u=o?.name||[o?.givenName,o?.familyName].filter(Boolean).join(" ").trim()||void 0;if(!i)throw new Error("Google did not return an id token (retry)");return{provider:"google",idToken:i,email:c,name:u}}catch{}throw e}}async function LH(t,e){try{await Zf()}catch{}try{await Cm.logout({provider:t})}catch{}try{await new Promise(r=>setTimeout(r,120)),await Zf(!0)}catch{}if(e?.clearLocal!==!1)try{await Tg()}catch{}}const x_={isNativePlatform:IH,signInWithAppleNative:MH,signInWithGoogleNative:jH,signOut:LH,prewarmNativeAuth:w3};let yo;function BH(){try{const t=Gr?.getPlatform?.();if(t)return t==="android"}catch{}try{return typeof navigator<"u"&&/Android/i.test(navigator.userAgent)}catch{return!1}}function UH(){try{const t=Gr?.getPlatform?.();if(t)return t==="ios"}catch{}try{return typeof navigator<"u"&&/iPhone|iPad|iPod/i.test(navigator.userAgent)}catch{return!1}}function FH(){try{const t=Gr?.getPlatform?.();return t&&["ios","android"].includes(t)?!0:!!window.Capacitor?.isNativePlatform?.()}catch{return!1}}function qH(){try{const t=window.localStorage?.getItem("api:url")||window.sessionStorage?.getItem("api:url");if(t&&/^https?:\/\//i.test(t))return t.replace(/\/+$/,"")}catch{}return null}function ci(){if(yo)return yo;const t=BH(),e=UH(),r=FH();if(t||e&&r)return yo="https://dicelounge.app",yo;let n=null;if(!t&&!(e&&r)&&(n=qH()),n)return yo=n,yo;let a=!1;try{const i=window.location?.hostname;a=i==="localhost"||i==="127.0.0.1"}catch{}return a&&!(e&&r)?(yo="http://localhost:4000",yo):(yo="https://dicelounge.app",yo)}const jl=ci();let Uu=null,hf=0,mf=null;const zH=1e4;async function Ab(t){const e=t?.force===!0,r=t?.signal;return!e&&Uu&&Date.now()-hf<zH?Uu:!e&&mf?mf:(mf=(async()=>{try{let i=!1;try{i=!!x_.isNativePlatform?.()}catch{i=!1}let o=null;try{o=await oi()??null}catch{o=null}if(!e&&!o)return null;const c=!!o,u={Accept:"application/json"};c&&o&&(u.Authorization=`Bearer ${o}`);const d=await fetch(`${jl}/api/auth/me`,{credentials:"include",headers:u,signal:r});if(d.ok){const f=await d.json();return Uu=f,hf=Date.now(),f}if(d.status===204)return Uu=null,hf=Date.now(),null;if(d.status===401){if(!c&&o){const f=await fetch(`${jl}/api/auth/me`,{credentials:"include",headers:{Accept:"application/json",Authorization:`Bearer ${o}`},signal:r});if(f.ok){const h=await f.json();return Uu=h,hf=Date.now(),h}if(f.status===401)try{await Tg()}catch{}}return Uu=null,hf=Date.now(),null}return null}catch(i){return i?.name==="AbortError",null}})().finally(()=>{mf=null}),await mf)}async function Lv(t){let e=null;try{e=await oi()??null}catch{e=null}try{await fetch(`${jl}/api/auth/logout`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...e?{Authorization:`Bearer ${e}`}:{}},body:JSON.stringify({email:t})})}catch{}try{await Tg()}catch{}try{Uu=null,hf=0,mf=null}catch{}}async function $H(t){return(await fetch(`${jl}/api/auth/verify-app?token=${encodeURIComponent(t)}`,{method:"GET",credentials:"include"})).json()}async function VH(t){try{if(x_.isNativePlatform())throw new Error("startOAuth is not allowed on native")}catch{}try{const e=await fetch(`${jl}/api/auth/${t}`,{method:"POST",headers:{Accept:"application/json"},credentials:"include"});if(e.ok){const r=await e.json().catch(()=>({ok:!1}));if(r?.ok&&r?.url)return window.location.assign(r.url),{ok:!0,url:r.url}}return window.location.assign(`${jl}/api/auth/${t}`),{ok:!1}}catch{try{window.location.assign(`${jl}/api/auth/${t}`)}catch{}return{ok:!1}}}async function HH(){try{const t=await fetch(`${jl}/api/auth/guest`,{method:"POST",headers:{Accept:"application/json"},credentials:"include"});if(!t.ok)return{ok:!1};const e=await t.json().catch(()=>({ok:!1}));return{ok:!!e?.ok,token:e?.token}}catch{return{ok:!1}}}var GH={};let Nw=!1,ep=null,nf=null;function WH(){return{apiKey:Z7,authDomain:eH,projectId:tH,appId:rH,measurementId:nH}}function tm(){return typeof window<"u"&&typeof document<"u"}function S3(){if(!tm())return!1;if(nf!==null)return nf;try{const t=new URL(window.location.href);if(t.searchParams.has("debug_analytics")||t.searchParams.has("firebase_analytics_debug_mode")||window.localStorage.getItem("analytics:debug")==="1")return nf=!0}catch{}return nf=!1}function rm(...t){S3()}async function KH(){if(Nw||!tm())return;try{if(typeof navigator<"u"&&/jsdom|playwright/i.test(navigator.userAgent||"")||typeof window<"u"&&window.__E2E===!0||typeof process<"u"&&(GH.VITEST||!1)){Nw=!0,rm("skip:init (test env heuristic)");return}}catch{}const t=WH();try{const[{initializeApp:e},{getAnalytics:r}]=await Promise.all([qr(()=>import("./index.esm-OyK67d2L.js"),__vite__mapDeps([0,1]),import.meta.url),qr(()=>import("./index.esm-CmzND2QD.js"),__vite__mapDeps([2,1]),import.meta.url)]),n=e({apiKey:t.apiKey,authDomain:t.authDomain,projectId:t.projectId,appId:t.appId,measurementId:t.measurementId});ep=r(n),rm("init:ok",{measurementId:t.measurementId})}catch(e){ep=null,rm("init:fail",{error:e?.message||String(e)})}finally{Nw=!0}}function tp(t,e){if(ep)try{qr(async()=>{const{logEvent:r}=await import("./index.esm-CmzND2QD.js");return{logEvent:r}},__vite__mapDeps([2,1]),import.meta.url).then(({logEvent:r})=>{const n=e||{};S3()&&(n.debug_mode=!0);try{r(ep,t,n),rm("event",{eventName:t,params:n})}catch{}})}catch{}}function eO(t,e){const r=tm()?window.location.href:void 0,n=t??(tm()?window.location.pathname:void 0),a=tm()?document.title:void 0;tp("page_view",{page_location:r,page_path:n,page_title:a})}function Iw(t){!ep||!t||qr(async()=>{const{setUserId:e}=await import("./index.esm-CmzND2QD.js");return{setUserId:e}},__vite__mapDeps([2,1]),import.meta.url).then(({setUserId:e})=>{try{e(ep,t)}catch{}rm("userId:set",{userId:t})})}async function YH(t){const e=new Set([]);try{await ms.clear()}catch{}try{if(typeof window<"u"){try{const r={};if(e.size>0)for(let n=0;n<window.localStorage.length;n++){const a=window.localStorage.key(n);a&&e.has(a)&&(r[a]=window.localStorage.getItem(a))}if(window.localStorage.clear(),e.size>0)for(const n of Object.keys(r)){const a=r[n];a!=null&&window.localStorage.setItem(n,a)}}catch{}try{window.sessionStorage.clear()}catch{}}}catch{}}const Ho=Object.create(null);Ho.open="0";Ho.close="1";Ho.ping="2";Ho.pong="3";Ho.message="4";Ho.upgrade="5";Ho.noop="6";const Bv=Object.create(null);Object.keys(Ho).forEach(t=>{Bv[Ho[t]]=t});const cT={type:"error",data:"parser error"},E3=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",T3=typeof ArrayBuffer=="function",C3=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,yx=({type:t,data:e},r,n)=>E3&&e instanceof Blob?r?n(e):tO(e,n):T3&&(e instanceof ArrayBuffer||C3(e))?r?n(e):tO(new Blob([e]),n):n(Ho[t]+(e||"")),tO=(t,e)=>{const r=new FileReader;return r.onload=function(){const n=r.result.split(",")[1];e("b"+(n||""))},r.readAsDataURL(t)};function rO(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Mw;function XH(t,e){if(E3&&t.data instanceof Blob)return t.data.arrayBuffer().then(rO).then(e);if(T3&&(t.data instanceof ArrayBuffer||C3(t.data)))return e(rO(t.data));yx(t,!1,r=>{Mw||(Mw=new TextEncoder),e(Mw.encode(r))})}const nO="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$h=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<nO.length;t++)$h[nO.charCodeAt(t)]=t;const JH=t=>{let e=t.length*.75,r=t.length,n,a=0,i,o,c,u;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const d=new ArrayBuffer(e),f=new Uint8Array(d);for(n=0;n<r;n+=4)i=$h[t.charCodeAt(n)],o=$h[t.charCodeAt(n+1)],c=$h[t.charCodeAt(n+2)],u=$h[t.charCodeAt(n+3)],f[a++]=i<<2|o>>4,f[a++]=(o&15)<<4|c>>2,f[a++]=(c&3)<<6|u&63;return d},QH=typeof ArrayBuffer=="function",vx=(t,e)=>{if(typeof t!="string")return{type:"message",data:x3(t,e)};const r=t.charAt(0);return r==="b"?{type:"message",data:ZH(t.substring(1),e)}:Bv[r]?t.length>1?{type:Bv[r],data:t.substring(1)}:{type:Bv[r]}:cT},ZH=(t,e)=>{if(QH){const r=JH(t);return x3(r,e)}else return{base64:!0,data:t}},x3=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},P3="",e9=(t,e)=>{const r=t.length,n=new Array(r);let a=0;t.forEach((i,o)=>{yx(i,!1,c=>{n[o]=c,++a===r&&e(n.join(P3))})})},t9=(t,e)=>{const r=t.split(P3),n=[];for(let a=0;a<r.length;a++){const i=vx(r[a],e);if(n.push(i),i.type==="error")break}return n};function r9(){return new TransformStream({transform(t,e){XH(t,r=>{const n=r.length;let a;if(n<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,n);else if(n<65536){a=new Uint8Array(3);const i=new DataView(a.buffer);i.setUint8(0,126),i.setUint16(1,n)}else{a=new Uint8Array(9);const i=new DataView(a.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(n))}t.data&&typeof t.data!="string"&&(a[0]|=128),e.enqueue(a),e.enqueue(r)})}})}let jw;function rv(t){return t.reduce((e,r)=>e+r.length,0)}function nv(t,e){if(t[0].length===e)return t.shift();const r=new Uint8Array(e);let n=0;for(let a=0;a<e;a++)r[a]=t[0][n++],n===t[0].length&&(t.shift(),n=0);return t.length&&n<t[0].length&&(t[0]=t[0].slice(n)),r}function n9(t,e){jw||(jw=new TextDecoder);const r=[];let n=0,a=-1,i=!1;return new TransformStream({transform(o,c){for(r.push(o);;){if(n===0){if(rv(r)<1)break;const u=nv(r,1);i=(u[0]&128)===128,a=u[0]&127,a<126?n=3:a===126?n=1:n=2}else if(n===1){if(rv(r)<2)break;const u=nv(r,2);a=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),n=3}else if(n===2){if(rv(r)<8)break;const u=nv(r,8),d=new DataView(u.buffer,u.byteOffset,u.length),f=d.getUint32(0);if(f>Math.pow(2,21)-1){c.enqueue(cT);break}a=f*Math.pow(2,32)+d.getUint32(4),n=3}else{if(rv(r)<a)break;const u=nv(r,a);c.enqueue(vx(i?u:jw.decode(u),e)),n=0}if(a===0||a>t){c.enqueue(cT);break}}}})}const A3=4;function Xn(t){if(t)return a9(t)}function a9(t){for(var e in Xn.prototype)t[e]=Xn.prototype[e];return t}Xn.prototype.on=Xn.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Xn.prototype.once=function(t,e){function r(){this.off(t,r),e.apply(this,arguments)}return r.fn=e,this.on(t,r),this};Xn.prototype.off=Xn.prototype.removeListener=Xn.prototype.removeAllListeners=Xn.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+t];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var n,a=0;a<r.length;a++)if(n=r[a],n===e||n.fn===e){r.splice(a,1);break}return r.length===0&&delete this._callbacks["$"+t],this};Xn.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),r=this._callbacks["$"+t],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,a=r.length;n<a;++n)r[n].apply(this,e)}return this};Xn.prototype.emitReserved=Xn.prototype.emit;Xn.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Xn.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Rb=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,r)=>r(e,0),ls=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),i9="arraybuffer";function R3(t,...e){return e.reduce((r,n)=>(t.hasOwnProperty(n)&&(r[n]=t[n]),r),{})}const s9=ls.setTimeout,o9=ls.clearTimeout;function Db(t,e){e.useNativeTimers?(t.setTimeoutFn=s9.bind(ls),t.clearTimeoutFn=o9.bind(ls)):(t.setTimeoutFn=ls.setTimeout.bind(ls),t.clearTimeoutFn=ls.clearTimeout.bind(ls))}const c9=1.33;function l9(t){return typeof t=="string"?u9(t):Math.ceil((t.byteLength||t.size)*c9)}function u9(t){let e=0,r=0;for(let n=0,a=t.length;n<a;n++)e=t.charCodeAt(n),e<128?r+=1:e<2048?r+=2:e<55296||e>=57344?r+=3:(n++,r+=4);return r}function D3(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function d9(t){let e="";for(let r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e}function f9(t){let e={},r=t.split("&");for(let n=0,a=r.length;n<a;n++){let i=r[n].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class p9 extends Error{constructor(e,r,n){super(e),this.description=r,this.context=n,this.type="TransportError"}}class _x extends Xn{constructor(e){super(),this.writable=!1,Db(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,r,n){return super.emitReserved("error",new p9(e,r,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const r=vx(e,this.socket.binaryType);this.onPacket(r)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,r={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const r=d9(e);return r.length?"?"+r:""}}class h9 extends _x{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const r=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||r()})),this.writable||(n++,this.once("drain",function(){--n||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const r=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};t9(e,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,e9(e,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=D3()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(e,r)}}let O3=!1;try{O3=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const m9=O3;function g9(){}class y9 extends h9{constructor(e){if(super(e),typeof location<"u"){const r=location.protocol==="https:";let n=location.port;n||(n=r?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,r){const n=this.request({method:"POST",data:e});n.on("success",r),n.on("error",(a,i)=>{this.onError("xhr post error",a,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(r,n)=>{this.onError("xhr poll error",r,n)}),this.pollXhr=e}}let Nf=class Uv extends Xn{constructor(e,r,n){super(),this.createRequest=e,Db(this,n),this._opts=n,this._method=n.method||"GET",this._uri=r,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var e;const r=R3(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(r);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&n.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var a;n.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=Uv.requestsCount++,Uv.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=g9,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Uv.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Nf.requestsCount=0;Nf.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",aO);else if(typeof addEventListener=="function"){const t="onpagehide"in ls?"pagehide":"unload";addEventListener(t,aO,!1)}}function aO(){for(let t in Nf.requests)Nf.requests.hasOwnProperty(t)&&Nf.requests[t].abort()}const v9=(function(){const t=N3({xdomain:!1});return t&&t.responseType!==null})();class _9 extends y9{constructor(e){super(e);const r=e&&e.forceBase64;this.supportsBinary=v9&&!r}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Nf(N3,this.uri(),e)}}function N3(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||m9))return new XMLHttpRequest}catch{}if(!e)try{return new ls[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const I3=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class b9 extends _x{get name(){return"websocket"}doOpen(){const e=this.uri(),r=this.opts.protocols,n=I3?{}:R3(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,r,n)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const n=e[r],a=r===e.length-1;yx(n,this.supportsBinary,i=>{try{this.doWrite(n,i)}catch{}a&&Rb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=D3()),this.supportsBinary||(r.b64=1),this.createUri(e,r)}}const Lw=ls.WebSocket||ls.MozWebSocket;class k9 extends b9{createSocket(e,r,n){return I3?new Lw(e,r,n):r?new Lw(e,r):new Lw(e)}doWrite(e,r){this.ws.send(r)}}class w9 extends _x{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const r=n9(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(r).getReader(),a=r9();a.readable.pipeTo(e.writable),this._writer=a.writable.getWriter();const i=()=>{n.read().then(({done:c,value:u})=>{c||(this.onPacket(u),i())}).catch(c=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let r=0;r<e.length;r++){const n=e[r],a=r===e.length-1;this._writer.write(n).then(()=>{a&&Rb(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const S9={websocket:k9,webtransport:w9,polling:_9},E9=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,T9=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function lT(t){if(t.length>8e3)throw"URI too long";const e=t,r=t.indexOf("["),n=t.indexOf("]");r!=-1&&n!=-1&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));let a=E9.exec(t||""),i={},o=14;for(;o--;)i[T9[o]]=a[o]||"";return r!=-1&&n!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=C9(i,i.path),i.queryKey=x9(i,i.query),i}function C9(t,e){const r=/\/{2,9}/g,n=e.replace(r,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function x9(t,e){const r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,a,i){a&&(r[a]=i)}),r}const uT=typeof addEventListener=="function"&&typeof removeEventListener=="function",Fv=[];uT&&addEventListener("offline",()=>{Fv.forEach(t=>t())},!1);class Ll extends Xn{constructor(e,r){if(super(),this.binaryType=i9,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(r=e,e=null),e){const n=lT(e);r.hostname=n.host,r.secure=n.protocol==="https"||n.protocol==="wss",r.port=n.port,n.query&&(r.query=n.query)}else r.host&&(r.hostname=lT(r.host).host);Db(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(n=>{const a=n.prototype.name;this.transports.push(a),this._transportsByName[a]=n}),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},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=f9(this.opts.query)),uT&&(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"})},Fv.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const r=Object.assign({},this.opts.query);r.EIO=A3,r.transport=e,this.id&&(r.sid=this.id);const n=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Ll.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(e);r.open(),this.setTransport(r)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",Ll.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=e.data,this._onError(r);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let n=0;n<this.writeBuffer.length;n++){const a=this.writeBuffer[n].data;if(a&&(r+=l9(a)),n>0&&r>this._maxPayload)return this.writeBuffer.slice(0,n);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Rb(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,r,n){return this._sendPacket("message",e,r,n),this}send(e,r,n){return this._sendPacket("message",e,r,n),this}_sendPacket(e,r,n,a){if(typeof r=="function"&&(a=r,r=void 0),typeof n=="function"&&(a=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const i={type:e,data:r,options:n};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),a&&this.once("flush",a),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),e()},n=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(e){if(Ll.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),uT&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=Fv.indexOf(this._offlineEventListener);n!==-1&&Fv.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,r),this.writeBuffer=[],this._prevBufferLen=0}}}Ll.protocol=A3;class P9 extends Ll{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let r=this.createTransport(e),n=!1;Ll.priorWebsocketSuccess=!1;const a=()=>{n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",h=>{if(!n)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;Ll.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(f(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=r.name,this.emitReserved("upgradeError",m)}}))};function i(){n||(n=!0,f(),r.close(),r=null)}const o=h=>{const m=new Error("probe error: "+h);m.transport=r.name,i(),this.emitReserved("upgradeError",m)};function c(){o("transport closed")}function u(){o("socket closed")}function d(h){r&&h.name!==r.name&&i()}const f=()=>{r.removeListener("open",a),r.removeListener("error",o),r.removeListener("close",c),this.off("close",u),this.off("upgrading",d)};r.once("open",a),r.once("error",o),r.once("close",c),this.once("close",u),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||r.open()},200):r.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const r=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&r.push(e[n]);return r}}let A9=class extends P9{constructor(e,r={}){const n=typeof e=="object"?e:r;(!n.transports||n.transports&&typeof n.transports[0]=="string")&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(a=>S9[a]).filter(a=>!!a)),super(e,n)}};function R9(t,e="",r){let n=t;r=r||typeof location<"u"&&location,t==null&&(t=r.protocol+"//"+r.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=r.protocol+t:t=r.host+t),/^(https?|wss?):\/\//.test(t)||(typeof r<"u"?t=r.protocol+"//"+t:t="https://"+t),n=lT(t)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const i=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+i+":"+n.port+e,n.href=n.protocol+"://"+i+(r&&r.port===n.port?"":":"+n.port),n}const D9=typeof ArrayBuffer=="function",O9=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,M3=Object.prototype.toString,N9=typeof Blob=="function"||typeof Blob<"u"&&M3.call(Blob)==="[object BlobConstructor]",I9=typeof File=="function"||typeof File<"u"&&M3.call(File)==="[object FileConstructor]";function bx(t){return D9&&(t instanceof ArrayBuffer||O9(t))||N9&&t instanceof Blob||I9&&t instanceof File}function qv(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let r=0,n=t.length;r<n;r++)if(qv(t[r]))return!0;return!1}if(bx(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return qv(t.toJSON(),!0);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&qv(t[r]))return!0;return!1}function M9(t){const e=[],r=t.data,n=t;return n.data=dT(r,e),n.attachments=e.length,{packet:n,buffers:e}}function dT(t,e){if(!t)return t;if(bx(t)){const r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Array.isArray(t)){const r=new Array(t.length);for(let n=0;n<t.length;n++)r[n]=dT(t[n],e);return r}else if(typeof t=="object"&&!(t instanceof Date)){const r={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=dT(t[n],e));return r}return t}function j9(t,e){return t.data=fT(t.data,e),delete t.attachments,t}function fT(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let r=0;r<t.length;r++)t[r]=fT(t[r],e);else if(typeof t=="object")for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(t[r]=fT(t[r],e));return t}const L9=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],B9=5;var xr;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(xr||(xr={}));class U9{constructor(e){this.replacer=e}encode(e){return(e.type===xr.EVENT||e.type===xr.ACK)&&qv(e)?this.encodeAsBinary({type:e.type===xr.EVENT?xr.BINARY_EVENT:xr.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let r=""+e.type;return(e.type===xr.BINARY_EVENT||e.type===xr.BINARY_ACK)&&(r+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(r+=e.nsp+","),e.id!=null&&(r+=e.id),e.data!=null&&(r+=JSON.stringify(e.data,this.replacer)),r}encodeAsBinary(e){const r=M9(e),n=this.encodeAsString(r.packet),a=r.buffers;return a.unshift(n),a}}function iO(t){return Object.prototype.toString.call(t)==="[object Object]"}class kx extends Xn{constructor(e){super(),this.reviver=e}add(e){let r;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(e);const n=r.type===xr.BINARY_EVENT;n||r.type===xr.BINARY_ACK?(r.type=n?xr.EVENT:xr.ACK,this.reconstructor=new F9(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(bx(e)||e.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(e),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let r=0;const n={type:Number(e.charAt(0))};if(xr[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===xr.BINARY_EVENT||n.type===xr.BINARY_ACK){const i=r+1;for(;e.charAt(++r)!=="-"&&r!=e.length;);const o=e.substring(i,r);if(o!=Number(o)||e.charAt(r)!=="-")throw new Error("Illegal attachments");n.attachments=Number(o)}if(e.charAt(r+1)==="/"){const i=r+1;for(;++r&&!(e.charAt(r)===","||r===e.length););n.nsp=e.substring(i,r)}else n.nsp="/";const a=e.charAt(r+1);if(a!==""&&Number(a)==a){const i=r+1;for(;++r;){const o=e.charAt(r);if(o==null||Number(o)!=o){--r;break}if(r===e.length)break}n.id=Number(e.substring(i,r+1))}if(e.charAt(++r)){const i=this.tryParse(e.substr(r));if(kx.isPayloadValid(n.type,i))n.data=i;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,r){switch(e){case xr.CONNECT:return iO(r);case xr.DISCONNECT:return r===void 0;case xr.CONNECT_ERROR:return typeof r=="string"||iO(r);case xr.EVENT:case xr.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&L9.indexOf(r[0])===-1);case xr.ACK:case xr.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class F9{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const r=j9(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const q9=Object.freeze(Object.defineProperty({__proto__:null,Decoder:kx,Encoder:U9,get PacketType(){return xr},protocol:B9},Symbol.toStringTag,{value:"Module"}));function Fs(t,e,r){return t.on(e,r),function(){t.off(e,r)}}const z9=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class j3 extends Xn{constructor(e,r,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=r,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Fs(e,"open",this.onopen.bind(this)),Fs(e,"packet",this.onpacket.bind(this)),Fs(e,"error",this.onerror.bind(this)),Fs(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...r){var n,a,i;if(z9.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(r.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const o={type:xr.EVENT,data:r};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const f=this.ids++,h=r.pop();this._registerAckCallback(f,h),o.id=f}const c=(a=(n=this.io.engine)===null||n===void 0?void 0:n.transport)===null||a===void 0?void 0:a.writable,u=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!c||(u?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,r){var n;const a=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(a===void 0){this.acks[e]=r;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);r.call(this,new Error("operation has timed out"))},a),o=(...c)=>{this.io.clearTimeoutFn(i),r.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...r){return new Promise((n,a)=>{const i=(o,c)=>o?a(o):n(c);i.withError=!0,r.push(i),this.emit(e,...r)})}_addToQueue(e){let r;typeof e[e.length-1]=="function"&&(r=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((a,...i)=>n!==this._queue[0]?void 0:(a!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(a)):(this._queue.shift(),r&&r(null,...i)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!e||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:xr.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(n=>String(n.id)===e)){const n=this.acks[e];delete this.acks[e],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case xr.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.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 xr.EVENT:case xr.BINARY_EVENT:this.onevent(e);break;case xr.ACK:case xr.BINARY_ACK:this.onack(e);break;case xr.DISCONNECT:this.ondisconnect();break;case xr.CONNECT_ERROR:this.destroy();const n=new Error(e.data.message);n.data=e.data.data,this.emitReserved("connect_error",n);break}}onevent(e){const r=e.data||[];e.id!=null&&r.push(this.ack(e.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const n of r)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const r=this;let n=!1;return function(...a){n||(n=!0,r.packet({type:xr.ACK,id:e,data:a}))}}onack(e){const r=this.acks[e.id];typeof r=="function"&&(delete this.acks[e.id],r.withError&&e.data.unshift(null),r.apply(this,e.data))}onconnect(e,r){this.id=e,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:xr.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const r=this._anyListeners;for(let n=0;n<r.length;n++)if(e===r[n])return r.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const r=this._anyOutgoingListeners;for(let n=0;n<r.length;n++)if(e===r[n])return r.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const n of r)n.apply(this,e.data)}}}function wp(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}wp.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-r:t+r}return Math.min(t,this.max)|0};wp.prototype.reset=function(){this.attempts=0};wp.prototype.setMin=function(t){this.ms=t};wp.prototype.setMax=function(t){this.max=t};wp.prototype.setJitter=function(t){this.jitter=t};class pT extends Xn{constructor(e,r){var n;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(r=e,e=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,Db(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((n=r.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new wp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=e;const a=r.parser||q9;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var r;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(r=this.backoff)===null||r===void 0||r.setMin(e),this)}randomizationFactor(e){var r;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(r=this.backoff)===null||r===void 0||r.setJitter(e),this)}reconnectionDelayMax(e){var r;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(r=this.backoff)===null||r===void 0||r.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new A9(this.uri,this.opts);const r=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const a=Fs(r,"open",function(){n.onopen(),e&&e()}),i=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=Fs(r,"error",i);if(this._timeout!==!1){const c=this._timeout,u=this.setTimeoutFn(()=>{a(),i(new Error("timeout")),r.close()},c);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(a),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Fs(e,"ping",this.onping.bind(this)),Fs(e,"data",this.ondata.bind(this)),Fs(e,"error",this.onerror.bind(this)),Fs(e,"close",this.onclose.bind(this)),Fs(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(r){this.onclose("parse error",r)}}ondecoded(e){Rb(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,r){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new j3(this,e,r),this.nsps[e]=n),n}_destroy(e){const r=Object.keys(this.nsps);for(const n of r)if(this.nsps[n].active)return;this._close()}_packet(e){const r=this.encoder.encode(e);for(let n=0;n<r.length;n++)this.engine.write(r[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,r){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(a=>{a?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",a)):e.onreconnect()}))},r);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Eh={};function zv(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const r=R9(t,e.path||"/socket.io"),n=r.source,a=r.id,i=r.path,o=Eh[a]&&i in Eh[a].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let u;return c?u=new pT(n,e):(Eh[a]||(Eh[a]=new pT(n,e)),u=Eh[a]),r.query&&!e.query&&(e.query=r.queryKey),u.socket(r.path,e)}Object.assign(zv,{Manager:pT,Socket:j3,io:zv,connect:zv});function Qu(t,e){try{if(!t)return;const r={tag:e,id:t.id,connected:t.connected,active:t.active};t.disconnect()}catch{}}function L3(t,e){try{if(!t)return;t.close?.()}catch{}}const B3=v.createContext(void 0),$9=({children:t})=>{const[e,r]=v.useState(!0),[n,a]=v.useState(0),i=v.useCallback(()=>r(!0),[]),o=v.useCallback(()=>a(f=>f+1),[]),c=v.useCallback(()=>a(0),[]),u=v.useCallback(f=>{r(!1),setTimeout(()=>r(!0),f)},[]),d=v.useCallback(()=>r(!1),[]);return v.useEffect(()=>{if(typeof window>"u"||!(typeof window.location<"u"&&window.location.search.includes("e2e=1")))return;const h={triggerSpin:o,scheduleReveal:u,resetReveal:d,resetSpin:c};try{window.__diceRevealTest=h}catch{}return()=>{try{delete window.__diceRevealTest}catch{}}},[o,u,d,c]),g.jsx(B3.Provider,{value:{reveal:e,triggerReveal:i,scheduleReveal:u,resetReveal:d,triggerSpin:o,rollTrigger:n,resetSpin:c},children:t})},Xo=()=>{const t=v.useContext(B3);if(!t)throw new Error("useDiceReveal must be used within a DiceRevealProvider");return t},U3=v.createContext(null);let Ia=null,sO="",$v=0,F3=0,oO=0;const V9=1200;function wx(t=2e3){try{$v=Date.now()+Math.max(0,t|0)}catch{}}function H9(t=2e3){try{wx(t)}catch{}try{Ia?.removeAllListeners()}catch{}try{Qu(Ia,"SocketContext: hardDisconnectSocket")}catch{}}function G9(){const t=Ia;if(t){try{t.auth={platform:"web",guest:!0}}catch{}try{F3=Date.now()+3e3}catch{}try{Qu(t,"SocketContext: logout refresh")}catch{}setTimeout(()=>{try{t.connect()}catch{}},100)}}function W9(t){const e=(()=>{try{return typeof window<"u"&&/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})(),r=(()=>{try{return typeof window<"u"?window.location.search:""}catch{return""}})(),a=/(?:[?&])wsOnly=1/.test(r)||(()=>{try{return localStorage.getItem("socket:wsOnly")==="1"}catch{return!1}})()?["websocket"]:["websocket","polling"],i=window.APP_TARGET||"ceelo",o=zv(t,{path:"/socket.io",withCredentials:!0,transports:a,upgrade:a.length>1,timeout:25e3,autoConnect:!1,extraHeaders:e?{Origin:t}:void 0,auth:{appTarget:i}});return o.on("connect_error",c=>{try{o.__lastConnectErr={ts:Date.now(),reason:c?.message||""}}catch{}}),o}function K9(t){if(Ia&&sO===t)return Ia;if(Ia){try{Ia.removeAllListeners()}catch{}try{L3(Ia,"SocketContext: getSharedSocket replace")}catch{}Ia=null}Ia=W9(t),sO=t;try{if(typeof window<"u"){(window.location?.search||"").includes("e2e=1")&&(window.__SOCKET=Ia,window.__sharedSocket=Ia,window.hardDisconnectSocket=H9,window.suspendSocketAutoConnect=wx);try{if(!window.__clientErrMon){window.__clientErrMon=!0;const r=a=>{try{const i=window.__sharedSocket||Ia;if(!i)return;i.connected?i.emit("client_error",a):(i.__pendingClientErrors=i.__pendingClientErrors||[],i.__pendingClientErrors.push(a))}catch{}},n=()=>{let a="web";try{const i=navigator.userAgent||"";/iPhone|iPad|iPod/i.test(i)?a="ios":/Android/i.test(i)?a="android":a="web"}catch{}return{platform:a,userAgent:typeof navigator<"u"?navigator.userAgent:"",ts:Date.now()}};window.addEventListener("error",a=>{try{if(!a.error&&!a.message)return;r({message:a.message||"error",stack:a.error?.stack?.slice?.(0,5e3),filename:a.filename,line:a.lineno,col:a.colno,...n()})}catch{}}),window.addEventListener("unhandledrejection",a=>{try{const i=a.reason,o=typeof i=="string"?i:i?.message||"unhandledrejection";if(i?.name==="AbortError"||o?.includes?.("aborted")||o?.includes?.("The operation was aborted"))return;r({message:o?.slice?.(0,500)||"unhandledrejection",stack:(i?.stack||"").slice?.(0,5e3),...n()})}catch{}}),Ia.on("connect",()=>{try{const a=Ia,i=a?.__pendingClientErrors;Array.isArray(i)&&i.length&&i.splice(0,i.length).forEach(c=>{try{a.emit("client_error",c)}catch{}})}catch{}})}}catch{}}}catch{}return Ia}function Y9({children:t}){const{user:e,initialized:r}=$r(),n=ci(),a=v.useMemo(()=>K9(n),[n]),{resetSpin:i}=Xo();return v.useEffect(()=>{if(!r)return;let o=!1;return(async()=>{const c=f=>{try{a.__authSig=f}catch{}},u=()=>{try{return String(a.__authSig||"")}catch{return""}},d=f=>{const h=Math.max(0,$v-Date.now());if(h<=0)return f();setTimeout(()=>{o||f()},h).unref?.()};if(e){const f=await oi();if(o)return;if(f){const h=u(),m=`t:${f}`;if(a.auth={token:f},c(m),a.disconnected)d(()=>{o||a.disconnected&&(a.connect(),i())});else if(h!==m){const _=Date.now();_-oO>=V9&&(oO=_,d(()=>{if(!o){try{Qu(a,"SocketContext: auth change soft reconnect")}catch{}setTimeout(()=>{if(!o)try{a.connect(),i()}catch{}},100)}}))}}}})(),()=>{o=!0}},[r,e,a]),v.useEffect(()=>{const o=async()=>{if(Date.now()<$v)return;const c=await oi();if(!c){if(Date.now()<F3){try{a.auth={platform:"web",guest:!0},a.__authSig="g:*"}catch{}i();return}try{a.auth={},a.__authSig=""}catch{}try{a.disconnected||Qu(a,"SocketContext: skip reconnect without token")}catch{}return}a.auth={token:c};try{a.__authSig=`t:${c}`}catch{}i()};return a.on("reconnect_attempt",o),()=>{a.off("reconnect_attempt",o)}},[a,i]),v.useEffect(()=>{const o=async c=>{try{await Qf(c)}catch{}a.auth=c?{token:c}:{};try{a.__authSig=c?`t:${c}`:""}catch{}};return a.on("auth:rotate",o),()=>{a.off("auth:rotate",o)}},[a]),v.useEffect(()=>{let o=!1;const c=async()=>{if(!o){try{const d=await oi();a.auth=d?{token:d}:{platform:"web",guest:!0}}catch{}try{if(a.connected)try{Qu(a,"SocketContext: OTA forceReconnect")}catch{}setTimeout(()=>{if(!o)try{a.connect(),i()}catch{}},100)}catch{}}},u=()=>c();window.addEventListener("ota:activated",u);try{window.__OTA_ACTIVATED__&&c()}catch{}return()=>{o=!0,window.removeEventListener("ota:activated",u)}},[a,i]),v.useEffect(()=>{let o=!1;const c=async()=>{if(!o&&!(Date.now()<$v)&&a.disconnected){try{const m=await oi();if(o||!m)return;a.auth={token:m}}catch{}try{a.disconnected&&(a.connect(),i())}catch{}}},u=()=>{try{document.visibilityState==="visible"&&c()}catch{}},d=()=>c(),f=()=>c(),h=()=>c();return window.addEventListener("visibilitychange",u),window.addEventListener("focus",d),window.addEventListener("pageshow",f),window.addEventListener("online",h),()=>{o=!0,window.removeEventListener("visibilitychange",u),window.removeEventListener("focus",d),window.removeEventListener("pageshow",f),window.removeEventListener("online",h)}},[a,i]),v.useEffect(()=>{const o=()=>{try{a.removeAllListeners()}catch{}try{L3(a,"SocketContext: beforeunload")}catch{}};return window.addEventListener("beforeunload",o),()=>{window.removeEventListener("beforeunload",o)}},[a]),g.jsx(U3.Provider,{value:a,children:t})}function ks(){const t=v.useContext(U3);if(!t)throw new Error("useSocket must be used within a SocketProvider");return t}const q3=v.createContext({user:null,loading:!0,initialized:!1,refreshUser:async()=>{},logout:async()=>{},meId:""}),$r=()=>v.useContext(q3);function X9(t){if(!t)return null;if(typeof t=="object"&&"authenticated"in t){const e=t;return e.authenticated?e.user??null:null}return t}const J9=({children:t})=>{const[e,r]=v.useState(null),[n,a]=v.useState(""),[i,o]=v.useState(!0),[c,u]=v.useState(!1),d=yi(),f=v.useRef(null),h=v.useRef(!0);v.useEffect(()=>(h.current=!0,()=>{h.current=!1}),[]);const m=v.useCallback(async b=>{if(f.current){if(!b?.force)return f.current;try{await f.current}catch{}}const E=new URLSearchParams(d.search);if((()=>{try{if(E.get("e2e")==="1"||typeof window<"u"&&(window.__E2E===!0||window.location?.search?.includes("e2e=1")||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1"))return!0}catch{}return!1})()){let A=1e3;try{const C=window.sessionStorage?.getItem("e2e_balance"),O=C?Number(C):NaN;Number.isFinite(O)&&(A=O)}catch{}r({id:"e2e-user",name:"E2E",email:"e2e@example.com",balance:A,botChatDisabled:!1,ceeloBotsPerRoom:null,crapsBotsPerRoom:null,pokerBotsPerRoom:null}),a("e2e-user"),o(!1),u(!0);return}const R=async()=>{r(null),a("");try{Iw(null)}catch{}};if(d.pathname==="/login"&&!b?.force){await R(),o(!1),u(!0);return}o(!0);const P=(async()=>{try{const A=await Ab(),C=X9(A);if(C){r(C),a(C?.id||"");try{Iw(C.id||null)}catch{}}else await R()}catch{if(!h.current)return;await R()}finally{o(!1),u(!0),f.current=null}})();return f.current=P,P},[]);v.useEffect(()=>{m()},[m]);const _=v.useCallback(async()=>{const b=e?.email;try{try{wx(2500)}catch{}b&&await Lv(b);try{await fetch("/api/auth/clear",{method:"POST",credentials:"include"})}catch{}}finally{if(!h.current)return;try{await Tg()}catch{}try{await YH()}catch{}r(null),a("");try{Iw(null)}catch{}try{G9()}catch{}}},[e?.email]),w=v.useMemo(()=>({user:e,loading:i,initialized:c,refreshUser:m,logout:_,meId:n}),[e,i,c,m,_,n]);return g.jsx(q3.Provider,{value:w,children:t})};function ji({className:t}){return v.useEffect(()=>{document.body.classList.add(t);const e=(()=>{try{return/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})();return e&&(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")),()=>{document.body.classList.remove(t),e&&(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app"))}},[t]),null}function Q9(){const{user:t,loading:e,initialized:r}=$r(),n=yi(),i=new URLSearchParams(n.search).get("e2e")==="1",o=n.pathname||"",c=/^\/poker\/room\//.test(o),u=/^\/room\//.test(o);return!r||e?g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx("div",{className:"home-preloader",children:g.jsx("div",{className:"home-preloader__spinner"})})]}):!t&&!i&&!(c||u)?g.jsx(em,{to:"/login",replace:!0,state:{from:n}}):g.jsx(c3,{})}function Z9(){return g.jsxs("div",{style:{padding:24},children:[g.jsx("h2",{children:"Verification failed"}),g.jsx("p",{children:"Your login link is invalid or expired. Please request a new one."})]})}const z3=v.createContext(null);function eG({children:t}){const[e,r]=v.useState([]),n=v.useRef({}),a=v.useCallback(f=>{r(m=>m.filter(_=>_.id!==f));const h=n.current[f];h&&(window.clearTimeout(h),delete n.current[f])},[]),i=v.useCallback(f=>{const h=crypto.randomUUID(),m={id:h,duration:3500,...f};r(w=>[...w,m]);const _=m.duration??3500;return _>0&&(n.current[h]=window.setTimeout(()=>a(h),_)),h},[a]),o=v.useCallback((f,h={})=>i({message:f,variant:"success",...h}),[i]),c=v.useCallback((f,h={})=>i({message:f,variant:"error",...h}),[i]),u=v.useCallback((f,h={})=>i({message:f,variant:"info",...h}),[i]),d=v.useMemo(()=>({show:i,success:o,error:c,info:u,dismiss:a}),[i,o,c,u,a]);return g.jsxs(z3.Provider,{value:d,children:[t,Gc.createPortal(g.jsx("div",{className:"toast-root","aria-live":"polite","aria-atomic":"true",children:e.map(f=>g.jsxs("div",{className:`toast-item toast-${f.variant}`,role:"status",onClick:()=>a(f.id),children:[f.title&&g.jsx("div",{className:"toast-title",children:f.title}),f.message&&g.jsx("div",{className:"toast-message",children:f.message}),g.jsx("button",{className:"toast-close","aria-label":"Dismiss",onClick:h=>{h.stopPropagation(),a(f.id)},children:"×"})]},f.id))}),document.body)]})}function ou(){const t=v.useContext(z3);if(!t){const e=()=>"noop";return{show:()=>"noop",success:e,error:e,info:e,dismiss:()=>{}}}return t}const $3={BOTS_NUDGE:"bots:nudge",ROOM_REFRESH_STATE:"room:refresh_state",USER_GET_BALANCE:"user:get_balance",SEND_FRIEND_REQUEST:"send_friend_request",CANCEL_FRIEND_REQUEST:"cancel_friend_request",RESPOND_FRIEND_REQUEST:"respond_friend_request",UNFRIEND:"unfriend",BLOCK_USER:"block_user",UNBLOCK_USER:"unblock_user",FAIRNESS_REVEAL:"fairness_reveal",CREATE_ROOM:"room_create",JOIN_ROOM:"join_room",LEAVE_ROOM:"leave_room",ROLL_DICE:"roll_dice",CONFIRM_BETS:"confirm_bets",GET_ROOMS_LIST:"get_rooms_list",BANKER_GIVE_UP:"banker_give_up",BANKER_CHANGED:"banker_changed",PLACE_MAIN_BET:"place_main_bet",CANCEL_MAIN_BET:"cancel_main_bet",CREATE_SIDE_BET:"create_side_bet",ACCEPT_SIDE_BET:"accept_side_bet",CANCEL_SIDE_BET:"cancel_side_bet",GET_WAGERS:"get_wagers",RTC_JOIN:"rtc_join",RTC_LEAVE:"rtc_leave",RTC_SIGNAL:"rtc_signal",RTC_SET_CAMERA_OWNER:"rtc_set_camera_owner",RTC_SET_VIDEO_ENABLED:"rtc_set_video_enabled",RTC_PEER_LEFT:"rtc_peer_left",RTC_CAMERA_OWNER_CHANGED:"rtc_camera_owner_changed",RTC_VIDEO_ENABLED:"rtc_video_enabled",ROOM_SEND_MESSAGE:"room_send_message",ROOM_FETCH_HISTORY:"room_fetch_history",ROOM_MESSAGE:"room_message",ROOM_HISTORY:"room_history",DM_SEND_MESSAGE:"dm_send_message",DM_FETCH_HISTORY:"dm_fetch_history",DIRECT_MESSAGE:"direct_message",DIRECT_HISTORY:"direct_history",LOBBY_JOIN:"lobby_join",LOBBY_LEAVE:"lobby_leave",LOBBY_LIST:"lobby_list",DELETE_ROOM:"room_delete",SOCIAL_GET_LIST:"social:get_list",USER_UPDATE_PROFILE:"user:update_profile",TURN_ORDER_UPDATED:"turn_order_updated",SPECTATE_SET:"spectate_set",SPECTATORS_UPDATED:"spectators_updated",CRAPS_PLACE_PASS:"craps:place_pass",CRAPS_PLACE_DONT_PASS:"craps:place_dont_pass",CRAPS_PLACE_ODDS:"craps:place_odds",CRAPS_PLACE_PLACE:"craps:place_place",CRAPS_PLACE_FIELD:"craps:place_field",CRAPS_PLACE_BIG:"craps:place_big",CRAPS_PLACE_COME:"craps:place_come",CRAPS_PLACE_DONT_COME:"craps:place_dont_come",CRAPS_PLACE_COME_ODDS:"craps:place_come_odds",CRAPS_PLACE_DONT_COME_ODDS:"craps:place_dont_come_odds",CRAPS_TOGGLE_PLACE_WORKING:"craps:toggle_place_working",CRAPS_ROLL:"craps:roll",CRAPS_READY:"craps:ready",CRAPS_READY_UPDATE:"craps:ready_update",CRAPS_FETCH_HISTORY:"craps:fetch_history",POKER_ROOM_CREATE:"poker_room_create",POKER_ROOM_DELETE:"poker_room_delete",POKER_JOIN_ROOM:"poker_join_room",POKER_ACT:"poker:act",POKER_START_HAND:"poker:start_hand",POKER_ROOM_CREATED:"poker_room_created",POKER_ROOM_UPDATED:"poker_room_updated",POKER_ROOM_DELETED:"poker_room_deleted",POKER_JOINED_ROOM:"poker_joined_room",POKER_REJOINED_ROOM:"poker_rejoined_room",POKER_FETCH_HISTORY:"poker:fetch_history",POKER_START_READY_UPDATE:"poker:start_ready_update",GAME_INVITE_SEND:"game_invite:send",GAME_INVITE_RESPOND:"game_invite:respond",GAME_INVITE_RECEIVED:"game_invite:received",POKER_AD_STARTED:"poker:ad_started",POKER_AD_COMPLETED:"poker:ad_completed",POKER_AD_FAILED:"poker:ad_failed",POKER_AD_REQUIRED:"poker:ad_required",POKER_AD_CLEARED:"poker:ad_cleared",POKER_PLAYER_AD_STATUS:"poker:player_ad_status"};Object.freeze($3);const St=new Proxy($3,{set(){throw new TypeError("SocketEvents is read-only")},defineProperty(){throw new TypeError("SocketEvents is read-only")},deleteProperty(){throw new TypeError("SocketEvents is read-only")}}),tG="data:audio/mp4;base64,AAAAHGZ0eXBNNEEgAAAAAE00QSBpc29tbXA0MgAAAAFtZGF0AAAAAAAACHkhIANAaBwhTuE5h+LsYiCvilbNXKcS0BitVYE9SNc0evNePa61+Z8fPn+j/f7bvwv1Hfs+vy2K8OXhDrVnwh7rcY/J7GoeN9vZoQqC4srBiAIptz6ALP25RIg4MSE6ZabZXAudF7C2F9WrVCtPjvCo2zgN65zbXJO2/YGjPc/gu8kKoUn0fRrvACx2qq4x6pvpYgEseZg9EuCYOKuLfO37xf82reT+1dw2OLir7jAeGeayVlQn9T+gQKKTQW1hVADPKJzu7J9kgIBhaLeiBk8aqUv40wAIwQxevFqQ246PdyYQft5CZAtrwC3+DAjRmX2+/C+4ObfObQ9We0ikCEg3ZrbGcqpMX4wAeQ/CRcEYnbQNSCYhFQyCCYng4Cqtme32Hnrx9v5/6a+zr1+/7+4+SHVrPgF1OMc0eupMA3Nxv1/QAKnXlMH0Gm58FQo2wbCv3hnH+gGPC2bz/LmBXLAaauTntyGGK7geDxR4IU6zQVmszRAqjKCyosXQGzGVQUQKIzVohIF9tzvXqmu9fHvnO7pu1P/n1/aWneQ/65+e+jvt8PCdOohAT/S/3dw1dm+8oWy68se0ux2Y4JoceYOXjtzXQD1KZyQccWgAU6RDlDi0XTKqJW2AsVBbkKmrE+nSaiz5Kjt6fPvHzOJfVg1htmqrUCQ92fC/gr1RuT9N7rfsYA7mEltF4s5hPr4ygEA0PejOqTnedYk8MWpMWoJgAj82gUeU94mhRFiEIIGt+rqkJUDGPyAYQoUMfm67hPhod3YcUmCcJ0ORraWn7eVZ6OMY8nAB4OIEANw/kdjzyEeS+UApmeQ2/TSiszfugCt8aSCDbWEdghf6QGejUaynpJgroIOVrpSYjU+O2eSFWnLjTVK4n3RlEoTwDjAe7xMLwXtfGmgTDOfwjf4tUdEMgAhmIfCQ7EghQeoQ+fb/j/u/CdOohABflVwyAFgWEschTpj////4PP/j//8PTaqYKISBqNyCpQmSIyhFgbbaGKrM7LIU/PPgu/f49+uf+/rvcrOsH+1f0XeO+F1+vn7eJ3J4++PD752wc/f3zk9TgRAIbiLK8s09S406sl1J+NWMxZboyQHlCnQisJ/xIFU7BnHz+1/Chy6vpEKAAihj7OnaXFW9iCdodbEqj4tX9MGh/AWGnmK2w9mESmG7fCRLpHbGSPPTOFOPGXyHjO9MyE4M0OKLYFehV0mGwfEN2yhFkUIzb/+giG9NXPCOZ3y1PnstBsWUmnJe8V9KpqTJDfg/dVm04DhNSe9eN2I57fb5pu8LyYrZfZZXPBukAfEP7KFEDyYz1ywOmv9ZjeuY+Xj2dPGWfKhBUc/BxfP4WREABmMm5McGRMmBigD0yQWLsr0yHP3IVOnUMKcx3JZY15jnpS+ODWRlm5ot9kPaM8FMDFO+YBKh+BoYSC+hPQkELC+wYcuggKCpPb4n5zfH6fD1OAkADBNNgeQAOEiszR569qr4IU5MgD/////gP4A/J3abQVSjlkJAw24RAqTZULAxWaQE+P4bur9UHs+c652wvv/2+v7zsnaP9OPXNGeuu5P8+3o5P4++Y9esgHwEAxDmwgx5CfgOqO/P1nNAhdZn8rtJmvMmmt4Lx7LP1VLZsL7PLV/emqmcoad0IzRugDn8XcipvozXIp6YVK2YTqfx6bLdTK7bFEmC6KaHHLZeK5xYiRLhZoNJpxTMoPhCAuTVN7ZGShCEkqZaLxIDIUApbW+Ql0vmAJSOn4iItJL3d0YJSvnQ98tLdYHXqmI5BRwX6M2M6kyZdLyOWss9BUysS8w90lxHGSjvGvD4ZdWDZTzzjTKPIrgaGYQerCg1NYcTSc3MayZHdOA6sa0e7E2z0VePfEqRfRMX3wu0xYIZTJr/p9dq2TwvAAx8ieh7GynXaN+akjY1bLV4F0bp7VuE7Z+NAQUnhCDPN/0xCB+IQ4N/Acf0FDWyP1v3U+zIEZdAevWQgACALGPUUmurBoAYKOAhbA4AAAAAAASNhqDHQ1hMSEIYhIIiAiZ7DA55Gxit2Dxq4bFzBJi+trFJKijFmr1nrMK9R0lXrebQmmrDhm7l949+jvDFVAlNl0SotM2MiulRpk6q6ZxJFdmsHloNhmqJ7z7scLAYjgJicjGU/NDgTs0SMdG4kckjIKBffTWaYN+Ks21c+RJvtndIwVDhRNQqmN/gelZoWFDzEeFQrjQABTrC7dw+Mf3qNExO+ZO79kDFBQcVJFNlpE7QX4KhtJVXPGu2SDbriZLP5oKFUvg1HxmAGS1jR/gACHP2+6dCK0w7j7lnJ9uR5hx/iAmRF/3vqUlFapS6oqARQqyhrdSgW4AhDA/4AAAAAASNOgqGIqiEwCEgEfjWLNr5QbzDdsYx3xcM1QuVm0UkiSSg6TM6fDUmJn8EmjufBhJ0StQNYX2qgNL08ZlXeayKUAKZDnSBmUddTAVVWGeAJ4mimJoPiMVVmvdt/3LBvFSpF4akTRHqOQGV/AnqG3af0h8AJSWfvPRwE73ycPn5vR1rOMRiRdMVqqgdPy7pj5/x/PojYAATflWCOztV19UfOurwT18P0c7ww4bZL+6tiVgQr4AR0wEoYmNemG+AlVNAj/pRSuO7qKgigSgSgRcrNopJEklwIQwP////wAAEHTBeQ2EISGDCPgBYKYg3pW8nWy5VxsSeHEAe2GkypPGiNh+g31iX2VZPLnmw4LQth0WdQ9lurM/vhqAS1/29Hu37ALfBVi8sTolPHq9Hl+H89joAlz5KE5l85I5tzzmWeDknKkWdnptWBQHvt55cPNulQCFAIQAAEy74oouY0+5zmabAdchD3KECDFgR+a9S+N2c8MknMla3M1MiLlXGxL48QB4HkyeHAPXj4AAAA1Jtb292AAAAbG12aGQAAAAA5RNTWeUTU1kAAKxEAAAUzAABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAB5HRyYWsAAABcdGtoZAAAAAHlE1NZ5RNTWQAAAAEAAAAAAAAUzAAAAAAAAAAAAAAAAAEAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAYBtZGlhAAAAIG1kaGQAAAAA5RNTWeUTU1kAAKxEAAAgAFXEAAAAAAAxaGRscgAAAAAAAAAAc291bgAAAAAAAAAAAAAAAENvcmUgTWVkaWEgQXVkaW8AAAABJ21pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAA63N0YmwAAABnc3RzZAAAAAAAAAABAAAAV21wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAACsRAAAAAAAM2VzZHMAAAAAA4CAgCIAAAAEgICAFEAUABgAAAH0AAAB9AAFgICAAhIQBoCAgAECAAAAGHN0dHMAAAAAAAAAAQAAAAgAAAQAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAAIAAAAAQAAADRzdHN6AAAAAAAAAAAAAAAIAAAABgAAAWYAAAFkAAABhAAAAX8AAAECAAAA3wAAALUAAAAUc3RjbwAAAAAAAAABAAAALAAAAPp1ZHRhAAAA8m1ldGEAAAAAAAAAImhkbHIAAAAAAAAAAG1kaXIAAAAAAAAAAAAAAAAAAAAAAMRpbHN0AAAAvC0tLS0AAAAcbWVhbgAAAABjb20uYXBwbGUuaVR1bmVzAAAAFG5hbWUAAAAAaVR1blNNUEIAAACEZGF0YQAAAAEAAAAAIDAwMDAwMDAwIDAwMDAwODQwIDAwMDAwMEUxIDAwMDAwMDAwMDAwMDE2REYgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDAgMDAwMDAwMDA=",cO=""+new URL("flash-1UjQ_pjl.m4a",import.meta.url).href,lO=""+new URL("swoosh-DWLYYP2o.m4a",import.meta.url).href,V3=""+new URL("dice_whirr-D6_Xjgte.m4a",import.meta.url).href,rG=""+new URL("loss-MbFJ6Xyb.m4a",import.meta.url).href,nG=""+new URL("winner-C_feQyA8.m4a",import.meta.url).href,aG=""+new URL("win-BofsSXdy.m4a",import.meta.url).href,iG=""+new URL("ante_up-BNJNkzdg.m4a",import.meta.url).href,sG=""+new URL("push-D8ciTeGD.m4a",import.meta.url).href,oG=""+new URL("your_turn-r-y-lDUH.m4a",import.meta.url).href,cG=""+new URL("point_set-BYYb2H7O.m4a",import.meta.url).href,lG=""+new URL("place_hit-B397CGff.m4a",import.meta.url).href,uG=""+new URL("yes-D6HNwLBK.m4a",import.meta.url).href,dG=""+new URL("smashing-CDhgl1WN.m4a",import.meta.url).href,fG=""+new URL("love_you-ClILzZiq.m4a",import.meta.url).href,pG=""+new URL("gangster-BuThOTHu.m4a",import.meta.url).href,md=typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1),Nc=typeof window<"u"?window.Capacitor:void 0,Ob=!!Nc&&typeof Nc.isNativePlatform=="function"&&Nc.isNativePlatform(),Fr=Nc&&(Nc.Plugins?.NativeAudio||Nc.NativeAudio)||void 0,Sp=Ob&&!!Fr,Sx=Ob&&md,hG=Ob&&!md;let Go=!1,Wl=!0,xm=null;const Ex=500;function mG(){return!!Wl}function uO(t){if(Wl=!!t,!Wl)try{R_()}catch{}}const gG=["vYes","vSmashing","vLove","vGangster"],Li={click:tG,flash:cO,chip:lO,win:nG,winDing:aG,lose:rG,push:sG,cardSwoosh:lO,placeBets:iG,yourTurn:oG,vYes:uG,vSmashing:dG,vLove:fG,vGangster:pG,pointSet:cG,placeHit:lG,betPlaced:cO},yG=["flash","win","winDing","lose","push","chip","cardSwoosh","placeBets","yourTurn","pointSet","vYes","vSmashing","vLove","vGangster","placeHit"],H3=3,G3=4,W3=Sx?1:md?2:8;let Bw=0,Tx=!1;function K3(){const t=performance.now();Tx=Bw>0&&t-Bw>50,Bw=t,requestAnimationFrame(K3)}typeof requestAnimationFrame<"u"&&requestAnimationFrame(K3);const Y3={flash:40,cardSwoosh:80,chip:60,click:25,win:25,winDing:25,lose:25,push:25,placeBets:250,yourTurn:250,pointSet:250,placeHit:250,vYes:2500,vSmashing:2500,vLove:2500,vGangster:2500},P_={},Uc={};let Kl=0,X3=0;const Uw=new WeakMap;let Fw=!1;const dO=[];function Pm(t){dO.push(t),!Fw&&(Fw=!0,requestAnimationFrame(()=>{Fw=!1;const e=dO.splice(0);for(const r of e)r()}))}const us=new Set,qw=new Map,Am=new Map;function Yl(t){const e=Date.now(),r=Am.get(t)||{count:0,last:0};r.count=Math.min(5,r.count+1),r.last=e,Am.set(t,r)}function Nb(t){t?Am.delete(t):Am.clear()}function Ib(t){const e=Am.get(t);if(!e)return!0;const r=Date.now(),n=2e3*Math.min(3,e.count);return r-e.last>n}function vG(t){try{const e=String(t||"");if(!e)return null;if(/^https?:\/\//i.test(e))return{path:e,isUrl:!0};if(/^data:/i.test(e))return null;if(/^file:\/\//i.test(e))return{path:e,isUrl:!0};if(/^capacitor:\/\//i.test(e)){const n=new URL(e).pathname||"";return n.startsWith("/assets/")?{path:`public${n}`,isUrl:!1}:n.startsWith("/public/")?{path:n.replace(/^\//,""),isUrl:!1}:{path:e,isUrl:!0}}return e.startsWith("./assets/")?{path:`public/${e.slice(2)}`,isUrl:!1}:e.startsWith("assets/")?{path:`public/${e}`,isUrl:!1}:e.startsWith("/assets/")?{path:`public${e}`,isUrl:!1}:e.startsWith("public/")?{path:e,isUrl:!1}:e.startsWith("/public/")?{path:e.slice(1),isUrl:!1}:{path:`public/${e.replace(/^\.\//,"")}`,isUrl:!1}}catch{return null}}async function Mb(t,e){if(!Sp||!Fr)throw new Error("Native audio not available");if(us.has(t))return;const r=qw.get(t);if(r){if(await r,!us.has(t))throw new Error("Asset preload failed");return}try{const n=vG(e);if(!n)throw Yl(t),new Error("Failed to resolve asset path");const a=(async()=>{await Fr.preload({assetId:t,assetPath:n.path}),us.add(t)})();qw.set(t,a),await a.finally(()=>{qw.delete(t)})}catch(n){throw Yl(t),n}}async function _G(t,e,r){if(!Sp||!Fr)throw new Error("Native audio not available");if(!Ib(t))throw new Error("Native audio cooldown active");try{if(await Mb(t,e),!us.has(t))throw new Error("Asset not loaded");if(r?.volume!=null&&Fr.setVolume)try{await Fr.setVolume({assetId:t,volume:Ka(r.volume,0,1)})}catch{}await Fr.play({assetId:t}),r?.durationMs&&r.durationMs>0&&window.setTimeout(()=>{try{Fr.stop({assetId:t})}catch{}},Math.max(10,Math.floor(r.durationMs)))}catch(n){throw Yl(t),n}}function Cx(t){const e=new Audio(Li[t]);e.preload="auto";try{e.playsInline=!0}catch{}try{e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline","")}catch{}try{e.muted=!1}catch{}try{e.volume=1}catch{}return e.addEventListener("ended",()=>Io(t,e)),e}function cu(t){let e=Uc[t];if(!e){const r=t==="flash"?G3:H3;e={free:[],busy:new Set,size:0};for(let n=0;n<r;n++)e.free.push(Cx(t)),e.size++;Uc[t]=e}return e}function xx(t){const e=t==="flash"?G3:H3,r=cu(t);if(r.free.length>0)return r.free.pop();if(r.size<e){const n=Cx(t);return r.size++,n}return null}function Io(t,e){const r=Uc[t];r&&r.busy.has(e)&&(r.busy.delete(e),r.free.push(e),Kl=Math.max(0,Kl-1))}function Px(){Object.keys(Y3).forEach(t=>delete P_[t])}function bG(){try{us.clear(),Nb()}catch{}}function jb(t,e=800){const r=Uw.get(t);if(r)return r;const n=new Promise(a=>{try{if(t.readyState>=2){a(!0);return}let i=!1;const o=()=>{try{t.removeEventListener("canplaythrough",c)}catch{}try{t.removeEventListener("loadeddata",c)}catch{}try{t.removeEventListener("error",u)}catch{}},c=()=>{i||(i=!0,o(),a(!0))},u=()=>{i||(i=!0,o(),a(!1))};t.addEventListener("canplaythrough",c,{once:!0}),t.addEventListener("loadeddata",c,{once:!0}),t.addEventListener("error",u,{once:!0});try{t.load()}catch{}window.setTimeout(()=>{i||(i=!0,o(),a(t.readyState>=2))},Math.max(200,Math.min(4e3,e)))}catch{a(!1)}});return Uw.set(t,n),n.finally(()=>{Uw.delete(t)}),n}let av=null,Hn=null,Ic=null,A_=!1;function R_(){Object.keys(Uc).forEach(t=>{const e=Uc[t];e&&[...e.busy].forEach(r=>{try{r.pause(),r.currentTime=0}catch{}Io(t,r)})});try{av&&(av.pause(),av.currentTime=0)}catch{}try{Hn&&(Hn.pause(),Hn.currentTime=0)}catch{}av=null,Hn=null;try{const t=Object.keys(Li);for(const e of t){const r=np?.[e];if(r){try{r.pause(),r.currentTime=0}catch{}np[e]=null}Mc[e]&&(window.clearTimeout(Mc[e]),delete Mc[e])}if(Sp&&Fr){for(const e of Object.keys(Li))if(us.has(e)){try{kf(Fr.stop({assetId:e}))}catch{}try{Fr.unload&&kf(Fr.unload({assetId:e}))}catch{}try{us.delete(e)}catch{}}if(us.has("loop_dice_whirr")){try{kf(Fr.stop({assetId:"loop_dice_whirr"}))}catch{}try{Fr.unload&&kf(Fr.unload({assetId:"loop_dice_whirr"}))}catch{}try{us.delete("loop_dice_whirr"),Nb("loop_dice_whirr")}catch{}}A_=!1}}catch{}Kl=0,Px()}let J3=!1;function nm(t){J3=!!t}let fO=0;const kG=1500;async function wG(t,e){if(!Wl||J3)return!1;const r=Date.now();if(r-fO<kG)return!1;if(fO=r,Sx&&Fr&&Ib(t))try{return(async()=>{try{if(await Mb(t,Li[t]),us.has(t)){if(Fr.setVolume)try{await Fr.setVolume({assetId:t,volume:Ka(e,0,1)})}catch{}await Fr.play({assetId:t})}}catch{Yl(t)}})(),!0}catch{Yl(t)}if(!Go||md&&Tx)return!1;try{const n=xx(t);if(!n){const i=new Audio(Li[t]);return i.volume=pi(t,e),i.play().catch(()=>{}),!0}return cu(t).busy.add(n),Kl++,n.currentTime=0,n.volume=pi(t,e),n.play().catch(()=>Io(t,n)),!0}catch{return!1}}const SG={3:"vGangster",4:"vLove",5:"vSmashing",6:"vYes",7:"vSmashing"};async function pO(t,e=.5){const r=SG[t>=7?7:t];return r?wG(r,e):!1}function EG(t,e){if(!Wl||!Go||Kl>=W3)return;const r=xx(t);if(!r)return;cu(t).busy.add(r),Kl++;try{r.currentTime=0,e?.volume!=null&&(r.volume=pi(t,e.volume)),e?.rate!=null&&(r.playbackRate=Ka(e.rate,.25,4));const a=e?.durationMs&&e.durationMs>0?window.setTimeout(()=>{try{r.pause(),r.currentTime=0}catch{}Io(t,r)},Math.max(10,Math.floor(e.durationMs))):null;Pm(()=>{r.play().catch(()=>{a&&window.clearTimeout(a),Io(t,r)})})}catch{Io(t,r)}}async function gs(t,e){if(!Wl)return;const r=Date.now();if(r<X3||md&&Tx&&t!=="win"&&t!=="lose")return;const n=Y3[t]??0;if(n>0){const o=P_[t]??0;if(r-o<n)return}if(P_[t]=r,Sx&&Fr&&Ib(t)){(async()=>{try{await _G(t,Li[t],{volume:e?.volume,durationMs:e?.durationMs})}catch{Yl(t)}})();return}if(!Go||xm&&r-xm<Ex)return;if(hG){EG(t,e);return}if(Kl>=W3)return;const a=xx(t);if(!a)return;cu(t).busy.add(a),Kl++;try{a.currentTime=0,e?.volume!=null&&(a.volume=pi(t,e.volume)),e?.rate!=null&&(a.playbackRate=Ka(e.rate,.25,4));const o=e?.durationMs&&e.durationMs>0?window.setTimeout(()=>{try{a.pause(),a.currentTime=0}catch{}Io(t,a)},Math.max(10,Math.floor(e.durationMs))):null;if(!await jb(a,1e3)){Pm(()=>{a.play().catch(()=>{o&&window.clearTimeout(o),Io(t,a)})});return}Pm(()=>{a.play().catch(()=>{o&&window.clearTimeout(o),Io(t,a)})})}catch{Io(t,a)}}const Ka=(t,e,r)=>Math.min(r,Math.max(e,t)),TG={flash:.025,cardSwoosh:.02,chip:.25,win:.4,winDing:.025,lose:.1,push:.1,placeBets:.65,yourTurn:.5,pointSet:.12,placeHit:.12,vYes:.45,vSmashing:.45,vLove:.45,vGangster:.45};function pi(t,e){const r=Ka(e,0,1);if(md){const n=TG[t];if(typeof n=="number")return Ka(Math.max(r,n),0,1)}return r}function hT(){md&&(Object.keys(Uc).forEach(t=>{const e=t,r=Uc[e];r&&r.free.forEach(n=>{try{n.pause(),n.src=Li[e],n.load()}catch{}})}),Px())}function CG(){try{R_()}catch{}}function xG(){bG();try{hT()}catch{}Px()}try{const t=Nc&&(Nc.Plugins?.App||Nc.App)||void 0;Ob&&t?.addListener&&t.addListener("appStateChange",e=>{!!(e&&e.isActive)?xG():CG()})}catch{}async function Xr(){if(!Go){Go=!0,xm=Date.now(),X3=Date.now()+Ex,Object.keys(Li).forEach(t=>{try{cu(t)}catch{}});try{rp()}catch{}try{if(Sp&&Fr){const t=yG;Promise.resolve().then(async()=>{for(const e of t)try{await Mb(e,Li[e])}catch{}})}}catch{}}}function Ax(){return!!Go}function rp(t){const e=t&&t.length?t:Object.keys(Li);for(const r of e)cu(r).free.forEach(a=>{try{a.load()}catch{}})}async function D_(t,e=800){const r=t&&t.length?t:Object.keys(Li),n=i=>new Promise(o=>{try{const u=cu(i).free[0]||Cx(i);jb(u,e).then(o)}catch{o(!1)}});return(await Promise.all(r.map(n))).every(Boolean)}if(typeof document<"u"){const t=()=>{document.visibilityState==="hidden"?R_():hT()};document.addEventListener("visibilitychange",t),window.addEventListener("pagehide",()=>R_()),window.addEventListener("pageshow",()=>hT())}function PG(t){const r=Ka(t?.volume,0,1)*.5;gs("flash",{volume:pi("flash",r)})}function AG(t){gs("chip",{volume:pi("chip",t?.volume??.25),durationMs:t?.durationMs??500,rate:t?.playbackRate})}function RG(t){gs("cardSwoosh",{volume:pi("cardSwoosh",t?.volume),rate:t?.playbackRate??1})}function DG(t){gs("lose",{volume:pi("lose",t?.volume)})}function OG(t){gs("push",{volume:pi("push",t?.volume)})}function NG(t){const e=Ka(t?.volume,0,1),r=pi("win",e);gs("winDing",{volume:.025}),gs("win",{volume:pi("win",Ka(r*.35,0,1))})}function mT(t){gs("placeBets",{volume:pi("placeBets",t?.volume??.65)})}function hO(t){gs("pointSet",{volume:pi("pointSet",t?.volume??.15)})}function IG(t){gs("betPlaced",{volume:pi("betPlaced",t?.volume)})}function mO(t){const e=Ka(t?.sfxVolume??.15,0,1);gs("winDing",{volume:Ka(e*.25,0,1)})}async function Q3(t,e=150){return new Promise(r=>{try{const a=Math.max(10,Math.floor(e/10));let i=0;const o=t.volume,c=window.setInterval(()=>{i++;const u=i/10;if(t.volume=Math.max(0,o*(1-u)),i>=10){window.clearInterval(c);try{t.pause(),t.currentTime=0}catch{}t.volume=o,r()}},a)}catch{try{t.pause(),t.currentTime=0}catch{}r()}})}function OSe(t){if(!Wl)return;const e=Ka(t?.volume,0,1),r=Ka(t?.playbackRate,.25,4);let n=!1;if(Sp&&Fr&&Ib("loop_dice_whirr")){try{Mb("loop_dice_whirr",V3).then(async()=>{try{if(A_||(Fr.loop?await Fr.loop({assetId:"loop_dice_whirr"}):await Fr.play({assetId:"loop_dice_whirr"}),A_=!0),Fr.setVolume)try{await Fr.setVolume({assetId:"loop_dice_whirr",volume:e})}catch{}}catch{Yl("loop_dice_whirr"),zw(e,r)}}).catch(()=>{Yl("loop_dice_whirr"),zw(e,r)}),n=!0}catch{}if(n){try{Ic&&window.clearTimeout(Ic),Ic=window.setTimeout(()=>{try{Rx()}catch{}},8e3)}catch{}return}}Go&&zw(e,r)}function zw(t,e){if(Go)try{if(!Hn){Hn=new Audio(V3),Hn.loop=!0,Hn.preload="auto";try{Hn.playsInline=!0}catch{}jb(Hn,800)}if(!Hn.paused){Hn.volume=t,Hn.playbackRate=e;return}Hn.volume=t,Hn.playbackRate=e,Hn.currentTime=0,Pm(()=>{Hn&&Hn.play().catch(()=>{})}),Ic&&window.clearTimeout(Ic),Ic=window.setTimeout(()=>{try{Rx()}catch{}},8e3)}catch{}}function Rx(){if(Ic&&(window.clearTimeout(Ic),Ic=null),Sp&&Fr)try{try{kf(Fr.stop({assetId:"loop_dice_whirr"}))}catch{}try{Fr.unload&&kf(Fr.unload({assetId:"loop_dice_whirr"}))}catch{}try{us.delete("loop_dice_whirr"),Nb("loop_dice_whirr")}catch{}A_=!1}catch{}try{Hn&&Q3(Hn,120)}catch{}}function kf(t){try{return t&&typeof t.then=="function"?t.catch(()=>{}):Promise.resolve()}catch{return Promise.resolve()}}const np={},Mc={};function MG(t,e){gG.includes(t)||gs(t,{volume:e?.volume,rate:e?.rate,durationMs:e?.durationMs})}function jG(t,e){if(!(!Wl||!Go)&&!(xm&&Date.now()-xm<Ex))try{let r=np[t];if(!r){r=new Audio(Li[t]),r.loop=!0,r.preload="auto";try{r.playsInline=!0}catch{}np[t]=r,jb(r,800)}const n=Ka(e?.volume??.1,0,1),a=Ka(e?.rate??1,.25,4);if(!r.paused){r.volume=n,r.playbackRate=a;return}r.volume=n,r.playbackRate=a,r.currentTime=0,Pm(()=>{r.play().catch(()=>{})}),Mc[t]&&window.clearTimeout(Mc[t]);const i=Math.max(5e3,Math.min(6e4,e?.maxMs??15e3));Mc[t]=window.setTimeout(()=>{try{Z3(t)}catch{}},i)}catch{}}async function Z3(t){try{Mc[t]&&(window.clearTimeout(Mc[t]),delete Mc[t]);const e=np[t];if(!e)return;await Q3(e,120),np[t]=null}catch{}}function LG(){try{Xr()}catch{}}async function BG(t,e){try{if(t==="__probe__")return Promise.resolve(!!Go);const r=t;return r in Li?e?.loop?(jG(r,{volume:e.volume,rate:e.rate}),!0):(MG(r,{volume:e?.volume,rate:e?.rate}),!0):!1}catch{return!1}}function UG(t){try{rp(t)}catch{}}function gO(t){try{const e=t;try{Z3(e)}catch{}const r=Uc[e];if(r){try{[...r.busy].forEach(n=>{try{n.pause(),n.currentTime=0}catch{}})}catch{}delete Uc[e]}try{delete P_[e]}catch{}try{us.delete(e),Nb(e)}catch{}try{cu(e)}catch{}}catch{}}const Ol=[];function gT(t,e){try{Ol.push({event:t,ts:Date.now(),mode:e}),Ol.length>12&&Ol.shift()}catch{}}function Vv(){return[...Ol]}function am(t,e=2e3){if(t.connected)return Promise.resolve();try{t.disconnected&&!t.active&&t.connect()}catch{}return new Promise((r,n)=>{let a=!1;const i=()=>{a||(a=!0,u(),r())},o=f=>{a||(a=!0,u(),n(f??new Error("socket connect error")))},c=()=>{a||(a=!0,u(),n(new Error("socket connect timeout")))},u=()=>{try{t.off("connect",i)}catch{}try{t.off("connect_error",o)}catch{}clearTimeout(d)},d=setTimeout(c,Math.max(300,e));d.unref?.(),t.once("connect",i),t.once("connect_error",o)})}async function yT(t,e,r,n){try{tB(e)}catch{}const a=n?.timeoutMs??15e3;try{await am(t)}catch(o){const c=String(o?.message||o||"");if(/socket has been disconnected|the socket is disconnected|connect_error|transport (?:close|error)|timeout/i.test(c)){try{t.disconnected&&t.connect()}catch{}await new Promise(u=>{const d=setTimeout(()=>u(),800);t.once("connect",()=>{clearTimeout(d),u()})})}else throw o}gT(e,"ack");const i=()=>new Promise((o,c)=>{t.timeout(a).emit(e,r,(u,d)=>u?c(u):d?o(d):c(new Error("No ack payload received")))});try{return await i()}catch(o){const c=String(o?.message||o||"");try{if(/operation has timed out|timeout/i.test(c)){const u=t?.io?.engine?.transport?.name,d=r?.roomId||null,f=Ol[Ol.length-1]?.event||"unknown";tp("socket_ack_timeout",{event:String(e),scope:String(e).includes("craps")?"craps":String(e).includes("poker")?"poker":"other",roomId:d,lastEvent:f,timeoutMs:a,connected:!!t.connected,transport:u||"unknown",phase:"initial"})}}catch{}if(/socket has been disconnected|the socket is disconnected/i.test(c)||/connect_error|transport close|transport error/i.test(c)){try{t.disconnected&&t.connect()}catch{}try{await new Promise(u=>{const d=setTimeout(()=>u(),1e3);t.once("connect",()=>{clearTimeout(d),u()})})}catch{}try{return await i()}catch(u){const d=String(u?.message||u||"");try{if(/operation has timed out|timeout/i.test(d)){const f=t?.io?.engine?.transport?.name,h=r?.roomId||null,m=Ol[Ol.length-1]?.event||"unknown";tp("socket_ack_timeout",{event:String(e),scope:String(e).includes("craps")?"craps":String(e).includes("poker")?"poker":"other",roomId:h,lastEvent:m,timeoutMs:a,connected:!!t.connected,transport:f||"unknown",phase:"retry"})}}catch{}throw u}}throw o}}async function eB(t,e,r){try{tB(e)}catch{}try{await am(t),gT(e,"ff"),t.emit(e,r)}catch(n){const a=String(n?.message||n||"");if(/socket has been disconnected|the socket is disconnected|connect_error|transport (?:close|error)/i.test(a)){try{t.disconnected&&t.connect()}catch{}await new Promise(i=>{const o=setTimeout(()=>i(),800);t.once("connect",()=>{clearTimeout(o),i()})}),gT(e,"ff"),t.emit(e,r);return}throw n}}function tB(t){new Set([St.ROLL_DICE,St.PLACE_MAIN_BET,St.CREATE_SIDE_BET,St.ACCEPT_SIDE_BET,St.CANCEL_SIDE_BET,St.POKER_ACT,"poker:start_hand","craps:roll"]).has(t)&&Xr()}const rB=ci();async function FG(t,e,r="usd"){return await(await fetch(`${rB}/api/payment/chips`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({amount:t,userId:e,currency:r})})).json()}async function qG(t,e){return await(await fetch(`${rB}/api/payment/membership`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({planId:t,userId:e})})).json()}const yO={createChipsCheckout:FG,createMembershipCheckout:qG},nB=v.createContext(void 0),zG=({children:t})=>{const[e,r]=v.useState("idle"),[n,a]=v.useState(null),[i,o]=v.useState(!1),[c,u]=v.useState(!1),d=v.useCallback(async(h,m,_="usd")=>{r("loading"),a(null);try{const w=await yO.createChipsCheckout(h,m,_);return w.url?(r("success"),w.url):(r("error"),a(w.error||"Unable to start chips checkout"),null)}catch(w){return r("error"),a(w.message||"Unable to start chips checkout"),null}},[]),f=v.useCallback(async(h,m)=>{r("loading"),a(null);try{const _=await yO.createMembershipCheckout(h,m);return _.url?(r("success"),_.url):(r("error"),a(_.error||"Unable to start membership checkout"),null)}catch(_){return r("error"),a(_.message||"Unable to start membership checkout"),null}},[]);return g.jsx(nB.Provider,{value:{status:e,error:n,startChipsCheckout:d,startMembershipCheckout:f,setStatus:r,setError:a,membershipModalOpen:i,setMembershipModalOpen:o,chipsModalOpen:c,setChipsModalOpen:u},children:t})};function Lb(){const t=v.useContext(nB);return t||{status:"idle",error:null,startChipsCheckout:async()=>null,startMembershipCheckout:async()=>null,setStatus:()=>{},setError:()=>{},membershipModalOpen:!1,setMembershipModalOpen:()=>{},chipsModalOpen:!1,setChipsModalOpen:()=>{}}}function Ri(){const t=typeof globalThis<"u"?globalThis.crypto:void 0;try{if(t&&typeof t.randomUUID=="function")return t.randomUUID()}catch{}try{if(t&&typeof t.getRandomValues=="function"){const c=new Uint8Array(16);t.getRandomValues(c),c[6]=c[6]&15|64,c[8]=c[8]&63|128;const u=Array.from(c,d=>d.toString(16).padStart(2,"0")).join("");return`${u.slice(0,8)}-${u.slice(8,12)}-${u.slice(12,16)}-${u.slice(16,20)}-${u.slice(20)}`}}catch{}const e=()=>Math.floor(Math.random()*4294967295).toString(16).padStart(8,"0"),r=e(),n=e().slice(0,4),a=("4"+e()).slice(0,4),i=((8+Math.floor(Math.random()*4)).toString(16)+e()).slice(0,4),o=(e()+e()).slice(0,12);return`${r}-${n}-${a}-${i}-${o}`}function $G(t,e){const r=v.useCallback(async()=>{if(!t)throw new Error("Socket unavailable");if(t.connected)return t;try{if(!t.active&&t.disconnected)try{t.connect()}catch{}await new Promise(i=>{const o=setTimeout(()=>i(),4e3);t.once("connect",()=>{clearTimeout(o),i()})})}catch{}return t},[t]),n=v.useCallback(async(i,o,c)=>{const u=await r();let d=o;if(o&&typeof o=="object"&&!o.eventId)try{d={...o,eventId:Ri()}}catch{}const f={room_create:3e4,poker_room_create:3e4},h=c?.timeoutMs||15e3,m=i in f?f[i]:h,_={...c,timeoutMs:m},w=async()=>yT(u,i,d,_);let b,E=0;const T=2,R=async()=>{try{return await w()}catch(P){const A=String(P?.message||P||""),C=/socket connect timeout/i.test(A)||/ETIMEDOUT/i.test(A)||/timeout/i.test(A),O=/socket has been disconnected/i.test(A)||/the socket is disconnected/i.test(A);if((C||O||/connect_error|transport close|transport error/i.test(A))&&E<T){E++;const N=(/create/i.test(i)?1500:800)*Math.pow(2,E-1);try{if(t&&t.disconnected)try{t.connect()}catch{}await new Promise(L=>{const j=setTimeout(()=>L(),N);t?.once("connect",()=>{clearTimeout(j),L()})})}catch{}return R()}else throw P}};b=await R();try{if(b&&b.ok===!1&&(b.error==="rate_limited"||/rate[_-]?limited/i.test(b.error||"")))try{e&&e(String(i))}catch{}}catch{}return b},[r,e]),a=v.useCallback(async(i,o)=>{const c=await r();return eB(c,i,o)},[r]);return{ack:n,send:a}}function pa(){const t=ks(),{info:e}=ou(),r=v.useRef(0),n=v.useCallback(z=>{const ee=Date.now();if(!(ee-r.current<1200)){r.current=ee;try{e("Please wait a moment - you're doing that too quickly.",{duration:2500})}catch{}}},[e]),{ack:a,send:i}=$G(t,n),{setMembershipModalOpen:o}=Lb(),{user:c}=$r(),u=v.useCallback(z=>{const ee=(()=>{const se={};try{se.name=String(z.name||"").trim().slice(0,60),(z.isPrivate===!0||z.isPrivate===!1)&&(se.isPrivate=!!z.isPrivate),(z.singlePlayer===!0||z.singlePlayer===!1)&&(se.singlePlayer=!!z.singlePlayer),typeof z.botsPerRoom=="number"&&Number.isInteger(z.botsPerRoom)&&(se.botsPerRoom=z.botsPerRoom),(z.gameMode==="cee-lo"||z.gameMode==="craps")&&(se.gameMode=z.gameMode)}catch{}return se})();return a(St.CREATE_ROOM,ee).then(se=>{try{se&&se.ok}catch{}return se})},[a,o,c]),d=v.useCallback(async z=>{const ee=async()=>a(St.JOIN_ROOM,{roomId:z});let se=await ee();if(se&&se.ok===!1&&/Room not found/i.test(String(se.error||""))){try{await new Promise(Oe=>setTimeout(Oe,120))}catch{}se=await ee(),se&&se.ok}if(se&&se.ok===!1&&se.error===L7.SOCKET.NEEDS_PREMIUM)try{o(!0)}catch{}return se},[a,o]),f=v.useCallback(z=>a(St.LEAVE_ROOM,{roomId:z}),[a]),h=v.useCallback(z=>i(St.LEAVE_ROOM,{roomId:z}),[i]),m=v.useCallback(z=>a(St.ROLL_DICE,{roomId:z}),[a]),_=v.useCallback(z=>a(St.CONFIRM_BETS,{roomId:z}),[a]),w=v.useCallback((z,ee)=>a(St.CRAPS_PLACE_PASS,{roomId:z,amount:ee}),[a]);v.useCallback((z,ee)=>a(St.CRAPS_PLACE_DONT_PASS,{roomId:z,amount:ee}),[a]);const b=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_ODDS,{roomId:z,amount:ee,passType:se}),[a]),E=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_PLACE,{roomId:z,amount:ee,point:se}),[a]),T=v.useCallback((z,ee)=>a(St.CRAPS_PLACE_FIELD,{roomId:z,amount:ee}),[a]),R=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_BIG,{roomId:z,amount:ee,kind:se}),[a]),P=v.useCallback((z,ee)=>a(St.CRAPS_PLACE_COME,{roomId:z,amount:ee}),[a]),A=v.useCallback((z,ee)=>a(St.CRAPS_PLACE_DONT_COME,{roomId:z,amount:ee}),[a]),C=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_COME_ODDS,{roomId:z,point:ee,amount:se}),[a]),O=v.useCallback((z,ee,se)=>a(St.CRAPS_PLACE_DONT_COME_ODDS,{roomId:z,point:ee,amount:se}),[a]),I=v.useCallback((z,ee)=>a(St.CRAPS_TOGGLE_PLACE_WORKING,{roomId:z,working:ee}),[a]),x=v.useCallback(async z=>{try{const ee=Y.current.get(z)||[],se=Q.current.get(z);if(se&&(clearTimeout(se),Q.current.delete(z)),ee.length>0)if(Y.current.delete(z),ee.length>1)await a("craps:add_bets_batch",{roomId:z,bets:ee,eventId:Ri()});else{const{type:Oe,amount:wt}=ee[0];await a("craps:add_bet",{roomId:z,type:Oe,amount:wt,eventId:Ri()})}}catch{}try{const ee=G.current.get(z)||[],se=B.current.get(z);if(se&&(clearTimeout(se),B.current.delete(z)),ee.length>0)if(G.current.delete(z),ee.length>1)await a("craps:remove_bets_batch",{roomId:z,bets:ee,eventId:Ri()});else{const{type:Oe,amount:wt}=ee[0];await a("craps:remove_bet",{roomId:z,type:Oe,amount:wt,eventId:Ri()})}}catch{}},[a]),D=v.useCallback(async z=>{try{if(!z)return{ok:!1,error:"no_room"}}catch{}try{await x(z)}catch{}return a(St.CRAPS_ROLL,{roomId:z})},[a,x]),N=v.useCallback(z=>a(St.CRAPS_READY,{roomId:z}),[a]),L=v.useCallback((z,ee)=>a(St.CRAPS_FETCH_HISTORY,{roomId:z,...ee||{}}),[a]),j=v.useCallback(z=>a("craps:get_state",{roomId:z}),[a]),q=v.useCallback(z=>a("craps:join_order",{roomId:z}),[a]),U=v.useCallback(z=>a("craps:leave_order",{roomId:z}),[a]),W=v.useCallback((z,ee)=>a("craps:set_order",{roomId:z,order:ee}),[a]),F=v.useCallback(z=>a("craps:reset_shooter",{roomId:z}),[a]),Y=v.useRef(new Map),Q=v.useRef(new Map),ie=1e3,G=v.useRef(new Map),B=v.useRef(new Map),K=1e3,ae=v.useCallback(z=>a("craps:list_bets",{roomId:z,eventId:Ri()}),[a]),te=v.useCallback((z,ee,se)=>{const Oe=Y.current.get(z)||[];Oe.push({type:ee,amount:se}),Y.current.set(z,Oe);const wt=Q.current.get(z);wt&&clearTimeout(wt);const er=setTimeout(()=>{const Qt=Y.current.get(z)||[];if(Qt.length!==0)if(Y.current.delete(z),Q.current.delete(z),Qt.length>1)a("craps:add_bets_batch",{roomId:z,bets:Qt,eventId:Ri()});else{const{type:Zt,amount:oa}=Qt[0];a("craps:add_bet",{roomId:z,type:Zt,amount:oa,eventId:Ri()})}},ie);return Q.current.set(z,er),Promise.resolve({ok:!0})},[a]),me=v.useCallback((z,ee)=>a("craps:add_bets_batch",{roomId:z,bets:ee,eventId:Ri()}),[a]),ue=v.useCallback((z,ee)=>a("craps:remove_bets_batch",{roomId:z,bets:ee,eventId:Ri()}),[a]),Ae=v.useCallback((z,ee,se)=>{const Oe=G.current.get(z)||[];Oe.push({type:ee,amount:se}),G.current.set(z,Oe);const wt=B.current.get(z);wt&&clearTimeout(wt);const er=setTimeout(()=>{const Qt=G.current.get(z)||[];if(Qt.length!==0)if(G.current.delete(z),B.current.delete(z),Qt.length>1)a("craps:remove_bets_batch",{roomId:z,bets:Qt,eventId:Ri()});else{const{type:Zt,amount:oa}=Qt[0];a("craps:remove_bet",{roomId:z,type:Zt,amount:oa,eventId:Ri()})}},K);return B.current.set(z,er),Promise.resolve({ok:!0})},[a]),He=v.useCallback(z=>a("craps:clear_bets",{roomId:z,eventId:Ri()}),[a]),ce=v.useCallback(z=>a("craps:summarize",{roomId:z}),[a]),xe=v.useCallback(z=>a(St.BANKER_GIVE_UP,{roomId:z}),[a]),re=v.useCallback(async()=>{const z=async()=>a(St.GET_ROOMS_LIST,{});let ee=await z();return ee&&ee.ok===!1&&ee.error==="invalid_payload"&&(await new Promise(se=>setTimeout(se,80)),ee=await z()),ee},[a]),H=v.useCallback((z,ee)=>a(St.SPECTATE_SET,{roomId:z,spectate:ee}),[a]),he=v.useCallback(async(z,ee)=>{const se=await a(St.PLACE_MAIN_BET,{roomId:z,amount:ee});try{tp("bet_place",{game:"cee-lo",type:"MAIN",amount:ee})}catch{}return se},[a]),Re=v.useCallback((z,ee)=>a(St.CANCEL_MAIN_BET,{roomId:z,wagerId:ee}),[a]),fe=v.useCallback((z,ee)=>a(St.CREATE_SIDE_BET,{roomId:z,...ee}),[a]),Ie=v.useCallback((z,ee)=>a(St.ACCEPT_SIDE_BET,{roomId:z,wagerId:ee}),[a]),ct=v.useCallback((z,ee)=>a(St.CANCEL_SIDE_BET,{roomId:z,wagerId:ee}),[a]),$e=v.useCallback(async z=>{if(!z)return{ok:!1,error:"no_room"};const ee={roomId:z},se=await a(St.GET_WAGERS,ee);return se&&se.ok,se},[a]),tt=v.useCallback(z=>a(St.RTC_JOIN,{roomId:z}),[a]),We=v.useCallback(z=>{try{t?.volatile?.emit?.(St.RTC_LEAVE,{roomId:z})}catch{}},[t]),it=v.useCallback(async(z,ee,se)=>{try{await i(St.RTC_SIGNAL,{roomId:z,toPeerId:ee,payload:se})}catch(Oe){const wt=String(Oe?.message||Oe||"");if(/disconnect|timeout|transport/i.test(wt)){await new Promise(er=>setTimeout(er,200));try{await i(St.RTC_SIGNAL,{roomId:z,toPeerId:ee,payload:se})}catch{}}}},[i]),Et=v.useCallback((z,ee)=>a(St.RTC_SET_CAMERA_OWNER,{roomId:z,ownerId:ee}),[a]),Mt=v.useCallback(async(z,ee)=>{try{if(!z)return{ok:!1,error:"no_room"};const se=await a(St.RTC_SET_VIDEO_ENABLED,{roomId:z,enabled:ee});return se.ok,se}catch{}},[a,o]),_t=v.useCallback((z,ee)=>a(St.ROOM_SEND_MESSAGE,{roomId:z,text:ee}),[a]),ge=v.useCallback((z,ee)=>a(St.ROOM_FETCH_HISTORY,{roomId:z,sinceTs:ee}),[a]),Be=v.useCallback((z,ee)=>a(St.DM_SEND_MESSAGE,{toUserId:z,text:ee}),[a]),je=v.useCallback((z,ee)=>a(St.DM_FETCH_HISTORY,{peerUserId:z,sinceTs:ee}),[a]),rt=v.useCallback(()=>a(St.LOBBY_JOIN,{}),[a]),Ct=v.useCallback(()=>i(St.LOBBY_LEAVE,{}),[i]),jt=v.useCallback(()=>a(St.LOBBY_LIST,{}),[a]),De=v.useCallback(z=>a(St.DELETE_ROOM,{roomId:z}),[a]),nt=v.useCallback(()=>a(St.USER_GET_BALANCE,void 0),[a]),at=v.useCallback((z,ee)=>a(St.SEND_FRIEND_REQUEST,{toUserId:z,message:ee}),[a]),we=v.useCallback(z=>a(St.CANCEL_FRIEND_REQUEST,{requestId:z}),[a]),st=v.useCallback((z,ee)=>a(St.RESPOND_FRIEND_REQUEST,{requestId:z,action:ee}),[a]),bt=v.useCallback(z=>a(St.UNFRIEND,{otherId:z}),[a]),nr=v.useCallback(z=>a(St.BLOCK_USER,{blockedId:z}),[a]),ur=v.useCallback(z=>a(St.UNBLOCK_USER,{blockedId:z}),[a]),dr=v.useCallback(()=>a(St.SOCIAL_GET_LIST,void 0),[a]),Sr=v.useCallback((z,ee,se)=>a(St.GAME_INVITE_SEND,{roomId:z,toUserId:ee,gameMode:se}),[a]),un=v.useCallback((z,ee)=>a(St.GAME_INVITE_RESPOND,{inviteId:z,action:ee}),[a]),Z=v.useCallback(z=>a(St.USER_UPDATE_PROFILE,z),[a]),X=v.useCallback(z=>a(St.BOTS_NUDGE,{roomId:z??null}),[a]),le=v.useCallback(z=>a(St.ROOM_REFRESH_STATE,{roomId:z??null}),[a]),be=v.useCallback((z,ee)=>i("player:visibility",{roomId:z,visible:ee}),[i]);return{createRoom:u,joinRoom:d,leaveRoom:f,leaveRoomTearDown:h,getRoomsList:re,setSpectate:H,bankerGiveUp:xe,pokerCreateRoom:v.useCallback(z=>{const ee={...z};let se=ee.maxPlayers;if((typeof se!="number"||!Number.isInteger(se)||se<1||se>4)&&(se=ee.singlePlayer?1:4),ee.maxPlayers=se,typeof ee.startingStack=="number"){const Oe=Math.max(1,Math.min(1e6,Math.floor(ee.startingStack)));ee.startingStack=Oe}return a(St.POKER_ROOM_CREATE,ee)},[a,c,o]),pokerDeleteRoom:v.useCallback(z=>a(St.POKER_ROOM_DELETE,{roomId:z}),[a]),pokerJoinRoom:v.useCallback(async z=>a(St.POKER_JOIN_ROOM,{roomId:z}),[a]),pokerStartHand:v.useCallback(z=>a(St.POKER_START_HAND,{roomId:z}),[a]),pokerFold:v.useCallback(z=>a(St.POKER_ACT,{roomId:z,action:"fold"}),[a]),pokerCheck:v.useCallback(z=>a(St.POKER_ACT,{roomId:z,action:"check"}),[a]),pokerCall:v.useCallback(z=>a(St.POKER_ACT,{roomId:z,action:"call"}),[a]),pokerBet:v.useCallback((z,ee)=>a(St.POKER_ACT,{roomId:z,action:"bet",amount:ee}),[a]),pokerRaise:v.useCallback((z,ee)=>a(St.POKER_ACT,{roomId:z,action:"raise",amount:ee}),[a]),pokerFetchHistory:v.useCallback((z,ee,se)=>a(St.POKER_FETCH_HISTORY,{roomId:z,limit:ee,beforeSeq:se}),[a]),rollDice:m,confirmBets:_,crapsPlacePass:w,crapsRoll:D,crapsPlaceOdds:b,crapsPlacePlace:E,crapsPlaceField:T,crapsPlaceBig:R,crapsPlaceCome:P,crapsPlaceDontCome:A,crapsPlaceComeOdds:C,crapsPlaceDontComeOdds:O,crapsTogglePlaceWorking:I,crapsReady:N,crapsFetchHistory:L,crapsGetState:j,crapsJoinOrder:q,crapsLeaveOrder:U,crapsSetOrder:W,crapsResetShooter:F,crapsListBets:ae,crapsAddBet:te,crapsBatchAddBets:me,crapsRemoveBet:Ae,crapsBatchRemoveBets:ue,crapsClearBets:He,crapsSummarizeBets:ce,placeMainBet:he,cancelMainBet:Re,createSideBet:fe,acceptSideBet:Ie,cancelSideBet:ct,getWagers:$e,rtcJoin:tt,rtcLeave:We,rtcSignal:it,rtcSetCameraOwner:Et,rtcSetVideoEnabled:Mt,roomSendMessage:_t,roomFetchHistory:ge,dmSendMessage:Be,dmFetchHistory:je,lobbyJoin:rt,lobbyLeave:Ct,lobbyList:jt,deleteRoom:De,getUserBalance:nt,sendFriendRequest:at,cancelFriendRequest:we,respondFriendRequest:st,unfriend:bt,blockUser:nr,unblockUser:ur,getFriendsList:dr,sendGameInvite:Sr,respondGameInvite:un,updateProfile:Z,botsNudge:X,refreshRoomState:le,sendVisibilityChange:be}}const Fe={FAIRNESS_REVEAL:"fairness_reveal",GET_ROOMS_LIST:"get_rooms_list",LOBBY_ROOMS:"lobby_rooms",ROOM_CREATED:"room_created",ROOM_UPDATED:"room_updated",ROOM_DELETED:"room_deleted",JOINED_ROOM:"joined_room",REJOINED_ROOM:"rejoined_room",OTHER_JOINED:"other_player_joined_room",OTHER_LEFT:"other_player_left_room",BANKER_CHANGED:"banker_changed",DICE_ROLLED:"dice_rolled",NOT_YOUR_TURN:"not_your_turn",BETS_UPDATED:"bets_updated",GET_WAGERS:"get_wagers",PLAYER_BALANCE_UPDATED:"player_balance_updated",SIDE_BET_CREATED:"side_bet_created",SIDE_BET_ACCEPTED:"side_bet_accepted",SIDE_BET_CANCELED:"side_bet_canceled",FORCE_LOGOUT:"force_logout",ERROR:"error",RTC_SIGNAL:"rtc_signal",RTC_PEER_JOINED:"rtc_peer_joined",RTC_PEER_LEFT:"rtc_peer_left",RTC_CAMERA_OWNER_CHANGED:"rtc_camera_owner_changed",RTC_VIDEO_ENABLED:"rtc_video_enabled",ROOM_MESSAGE:"room_message",ROOM_HISTORY:"room_history",DM_MESSAGE:"dm_message",DM_HISTORY:"dm_history",FRIEND_REQUEST_RECEIVED:"friend_request_received",FRIEND_REQUEST_CANCELLED:"friend_request_cancelled",FRIEND_REQUEST_RESPONDED:"friend_request_responded",UNFRIENDED:"unfriended",USER_BLOCKED:"user_blocked",USER_UNBLOCKED:"user_unblocked",TURN_ORDER_UPDATED:"turn_order_updated",SPECTATORS_UPDATED:"spectators_updated",PLAYER_PROFILE_UPDATED:"player_profile_updated",CRAPS_ROLL:"craps:roll",CRAPS_READY_UPDATE:"craps:ready_update",CRAPS_BETS_UPDATE:"craps:bets_update",CRAPS_BET_DELTA:"craps:bet_delta",CRAPS_STATE:"craps:state",CRAPS_BET_RESULTS:"craps:bet_results",CRAPS_BET_ERROR:"craps:bet_error",CRAPS_POINT_SET:"craps:point_set",CRAPS_POINT_MADE:"craps:point_made",CRAPS_ATS_PROGRESS:"craps:ats_progress",CRAPS_ATS_SMALL_COMPLETE:"craps:ats_small_complete",CRAPS_ATS_TALL_COMPLETE:"craps:ats_tall_complete",CRAPS_ATS_ALL_COMPLETE:"craps:ats_all_complete",CRAPS_ATS_RESET:"craps:ats_reset",POKER_MY_HOLE:"poker:my_hole",POKER_WINNERS:"poker:winners",POKER_REVEAL_ALL:"poker:reveal_all",POKER_TIMED_OUT:"poker:timed_out",POKER_ROOM_CREATED:"poker_room_created",POKER_ROOM_UPDATED:"poker_room_updated",POKER_ROOM_DELETED:"poker_room_deleted",POKER_OTHER_JOINED:"poker_other_joined_room",POKER_JOINED_ROOM:"poker_joined_room",ROOM_UPDATE_STATE:"room:update_state",OTA_UPDATE_AVAILABLE:"ota:update_available",GAME_INVITE_RECEIVED:"game_invite:received",PLAYER_PRESENCE_UPDATE:"player:presence_update"};function Pa(t){const e=ks(),r=v.useRef(t);v.useEffect(()=>{r.current=t},[t]),v.useEffect(()=>{if(typeof window>"u"||!(window.location?.search?.includes("e2e=1")||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1"))return;const a=window;a.__crapsHandlersBus||(a.__crapsHandlersBus={onCrapsRollResult:new Set,onCrapsBetResults:new Set,onCrapsPointSet:new Set,onCrapsPointMade:new Set,_buffer:{onCrapsRollResult:[],onCrapsBetResults:[],onCrapsPointSet:[],onCrapsPointMade:[],push(c,u){const d=this[c];d.push(u),d.length>20&&d.shift()}}}),(()=>{const c=a.__crapsHandlers||{};c&&c.__wrappedByBus||(a.__crapsHandlers={onCrapsRollResult:u=>{try{a.__crapsHandlersBus._buffer.push("onCrapsRollResult",u)}catch{}a.__crapsHandlersBus.onCrapsRollResult.forEach(d=>{try{d(u)}catch{}});try{const d=a.__flashTest;(a.__E2E===!0||a.location?.search?.includes("e2e=1")||a.sessionStorage&&a.sessionStorage.getItem("e2e")==="1")&&d&&d.info}catch{}try{typeof c.onCrapsRollResult=="function"&&c.onCrapsRollResult(u)}catch{}},onCrapsBetResults:u=>{try{a.__crapsHandlersBus._buffer.push("onCrapsBetResults",u)}catch{}a.__crapsHandlersBus.onCrapsBetResults.forEach(d=>{try{d(u)}catch{}});try{const d=a.__flashTest;if(!(!(a.__E2E===!0||a.location?.search?.includes("e2e=1")||a.sessionStorage&&a.sessionStorage.getItem("e2e")==="1")||!d)){const h=Array.isArray(u?.settlements)?u.settlements:[],m=h.filter(b=>typeof b?.betType=="string"&&b.betType.startsWith("place")&&b.outcome==="WIN"),_=h.filter(b=>(b.betType==="pass"||b.betType==="dontPass")&&b.outcome==="WIN"),w=h.filter(b=>(b.betType==="pass"||b.betType==="dontPass")&&b.outcome==="LOSE");if(m.length>0&&typeof d.win=="function"){const b=m.reduce((E,T)=>E+(Number(T.payout)||0),0);d.win(m.length>1?"Place Wins":"Place Win",b?`+${b}`:void 0)}else if(_.length>0&&typeof d.win=="function"){const b=_.reduce((E,T)=>E+(Number(T.payout)||0)+(Number(T.amount)||0),0);d.win("Line Win",b?`+${b}`:void 0)}else if(w.length>0&&typeof d.lose=="function"){const b=w.reduce((E,T)=>E+(Number(T.amount)||0),0);d.lose("Line Lose",b?`-${b}`:void 0)}}}catch{}try{typeof c.onCrapsBetResults=="function"&&c.onCrapsBetResults(u)}catch{}},onCrapsPointSet:u=>{try{a.__crapsHandlersBus._buffer.push("onCrapsPointSet",u)}catch{}a.__crapsHandlersBus.onCrapsPointSet.forEach(d=>{try{d(u)}catch{}});try{const d=a.__flashTest;if((a.__E2E===!0||a.location?.search?.includes("e2e=1")||a.sessionStorage&&a.sessionStorage.getItem("e2e")==="1")&&d&&typeof d.info=="function"){const h=u&&(u.point??u?.state?.point);d.info("Point Set",h?`${h} is the point`:void 0)}}catch{}try{typeof c.onCrapsPointSet=="function"&&c.onCrapsPointSet(u)}catch{}},onCrapsPointMade:u=>{try{a.__crapsHandlersBus._buffer.push("onCrapsPointMade",u)}catch{}a.__crapsHandlersBus.onCrapsPointMade.forEach(d=>{try{d(u)}catch{}});try{const d=a.__flashTest;if((a.__E2E===!0||a.location?.search?.includes("e2e=1")||a.sessionStorage&&a.sessionStorage.getItem("e2e")==="1")&&d&&typeof d.win=="function"){const h=u&&(u.point??u?.state?.point);d.win("Point Made",h?`${h} hit`:void 0)}}catch{}try{typeof c.onCrapsPointMade=="function"&&c.onCrapsPointMade(u)}catch{}},__wrappedByBus:!0})})();const o={onCrapsRollResult:c=>r.current.onCrapsRollResult?.(c),onCrapsBetResults:c=>r.current.onCrapsBetResults?.(c),onCrapsPointSet:c=>r.current.onCrapsPointSet?.(c),onCrapsPointMade:c=>r.current.onCrapsPointMade?.(c)};a.__crapsHandlersBus.onCrapsRollResult.add(o.onCrapsRollResult),a.__crapsHandlersBus.onCrapsBetResults.add(o.onCrapsBetResults),a.__crapsHandlersBus.onCrapsPointSet.add(o.onCrapsPointSet),a.__crapsHandlersBus.onCrapsPointMade.add(o.onCrapsPointMade);try{const c=a.__crapsHandlersBus._buffer;if(c){for(const u of c.onCrapsRollResult)try{o.onCrapsRollResult(u)}catch{}for(const u of c.onCrapsBetResults)try{o.onCrapsBetResults(u)}catch{}for(const u of c.onCrapsPointSet)try{o.onCrapsPointSet(u)}catch{}for(const u of c.onCrapsPointMade)try{o.onCrapsPointMade(u)}catch{}}}catch{}return()=>{try{a.__crapsHandlersBus.onCrapsRollResult.delete(o.onCrapsRollResult),a.__crapsHandlersBus.onCrapsBetResults.delete(o.onCrapsBetResults),a.__crapsHandlersBus.onCrapsPointSet.delete(o.onCrapsPointSet),a.__crapsHandlersBus.onCrapsPointMade.delete(o.onCrapsPointMade)}catch{}}},[]),v.useEffect(()=>{if(!e)return;const n=ge=>r.current.onLobbyRooms?.(ge),a=ge=>r.current.onRoomCreated?.(ge),i=ge=>r.current.onRoomUpdated?.(ge),o=ge=>r.current.onRoomDeleted?.(ge),c=ge=>r.current.onJoinedRoom?.(ge),u=ge=>r.current.onRejoinedRoom?.(ge),d=ge=>{r.current.onOtherPlayerJoined?.(ge)},f=ge=>{r.current.onOtherLeft?.(ge)},h=ge=>r.current.onBankerChanged?.(ge),m=ge=>r.current.onDiceRolled?.(ge),_=()=>r.current.onNotYourTurn?.(),w=ge=>r.current.onOtaUpdateAvailable?.(ge),b=ge=>r.current.onBetsUpdated?.(ge),E=ge=>r.current.onGetWagers?.(ge),T=ge=>r.current.onPlayerBalanceUpdated?.(ge),R=ge=>r.current.onSideBetCreated?.(ge),P=ge=>r.current.onSideBetAccepted?.(ge),A=ge=>r.current.onSideBetCanceled?.(ge),C=()=>r.current.onForceLogout?.(),O=ge=>r.current.onError?.(ge),I=ge=>r.current.onRtcSignal?.(ge),x=ge=>r.current.onRtcPeerJoined?.(ge),D=ge=>r.current.onRtcPeerLeft?.(ge),N=ge=>r.current.onRtcCameraOwnerChanged?.(ge),L=ge=>r.current.onRtcVideoEnabled?.(ge),j=ge=>r.current.onRoomMessage?.(ge),q=ge=>r.current.onRoomHistory?.(ge),U=ge=>r.current.onDmMessage?.(ge),W=ge=>r.current.onDmHistory?.(ge),F=ge=>r.current.onFairnessReveal?.(ge),Y=ge=>r.current.onFriendRequestReceived?.(ge),Q=ge=>r.current.onFriendRequestCancelled?.(ge),ie=ge=>r.current.onFriendRequestResponded?.(ge),G=ge=>r.current.onUnfriended?.(ge),B=ge=>r.current.onUserBlocked?.(ge),K=ge=>r.current.onUserUnblocked?.(ge),ae=ge=>r.current.onGameInviteReceived?.(ge),te=ge=>r.current.onTurnOrderUpdated?.(ge),me=ge=>r.current.onSpectatorsUpdated?.(ge),ue=ge=>r.current.onPlayerProfileUpdated?.(ge),Ae=ge=>r.current.onPlayerPresenceUpdate?.(ge),He=ge=>r.current.onPokerMyHole?.(ge),ce=ge=>r.current.onPokerWinners?.(ge),xe=ge=>r.current.onPokerRevealAll?.(ge),re=ge=>r.current.onPokerTimedOut?.(ge),H=ge=>r.current.onRoomUpdateState?.(ge),he=ge=>ge&&(!ge.dice&&typeof ge.d1=="number"&&typeof ge.d2=="number"&&(ge.dice=[ge.d1,ge.d2]),ge.dice&&(typeof ge.d1!="number"||typeof ge.d2!="number")&&(ge.d1=ge.dice[0],ge.d2=ge.dice[1]),ge.shooterId!==void 0&&ge.currentRollerId===void 0&&(ge.currentRollerId=ge.shooterId),ge.nextShooterId!==void 0&&ge.nextRollerId===void 0&&(ge.nextRollerId=ge.nextShooterId),ge),Re=ge=>{r.current.onCrapsRollResult?.(he(ge))},fe=ge=>{r.current.onCrapsReadyUpdate?.(ge)},Ie=ge=>{r.current.onCrapsBetsUpdate?.(ge)},ct=ge=>{r.current.onCrapsBetDelta?.(ge)},$e=ge=>{r.current.onCrapsBetResults?.(ge)},tt=ge=>{r.current.onCrapsBetError?.(ge)},We=ge=>{r.current.onCrapsPointSet?.(ge)},it=ge=>{r.current.onCrapsPointMade?.(ge)},Et=()=>{e.on(Fe.LOBBY_ROOMS,n),e.on(Fe.ROOM_CREATED,a);try{e.on(Fe.POKER_ROOM_CREATED,a)}catch{}e.on(Fe.ROOM_UPDATED,i);try{e.on(Fe.POKER_ROOM_UPDATED,i)}catch{}e.on(Fe.ROOM_DELETED,o);try{e.on(Fe.POKER_ROOM_DELETED,o)}catch{}e.on(Fe.JOINED_ROOM,c);try{e.on(Fe.POKER_JOINED_ROOM,c)}catch{}e.on(Fe.REJOINED_ROOM,u),e.on(Fe.OTHER_JOINED,d),e.on(Fe.POKER_OTHER_JOINED,d),e.on(Fe.OTHER_LEFT,f),e.on(Fe.BANKER_CHANGED,h),e.on(Fe.DICE_ROLLED,m),e.on(Fe.NOT_YOUR_TURN,_),e.on(Fe.OTA_UPDATE_AVAILABLE,w),e.on(Fe.BETS_UPDATED,b),e.on(Fe.GET_WAGERS,E),e.on(Fe.PLAYER_BALANCE_UPDATED,T),e.on(Fe.SIDE_BET_CREATED,R),e.on(Fe.SIDE_BET_ACCEPTED,P),e.on(Fe.SIDE_BET_CANCELED,A),e.on(Fe.FORCE_LOGOUT,C),e.on(Fe.ERROR,O),e.on(Fe.RTC_SIGNAL,I),e.on(Fe.RTC_PEER_JOINED,x),e.on(Fe.RTC_PEER_LEFT,D),e.on(Fe.RTC_CAMERA_OWNER_CHANGED,N),e.on(Fe.RTC_VIDEO_ENABLED,L),e.on(Fe.ROOM_MESSAGE,j),e.on(Fe.ROOM_HISTORY,q),e.on(Fe.DM_MESSAGE,U),e.on(Fe.DM_HISTORY,W),e.on(Fe.FAIRNESS_REVEAL,F),e.on(Fe.FRIEND_REQUEST_RECEIVED,Y),e.on(Fe.FRIEND_REQUEST_CANCELLED,Q),e.on(Fe.FRIEND_REQUEST_RESPONDED,ie),e.on(Fe.UNFRIENDED,G),e.on(Fe.USER_BLOCKED,B),e.on(Fe.USER_UNBLOCKED,K),e.on(Fe.GAME_INVITE_RECEIVED,ae),e.on(Fe.TURN_ORDER_UPDATED,te),e.on(Fe.SPECTATORS_UPDATED,me),e.on(Fe.PLAYER_PROFILE_UPDATED,ue),e.on(Fe.PLAYER_PRESENCE_UPDATE,Ae),e.on(Fe.CRAPS_ROLL,Re),e.on(Fe.CRAPS_READY_UPDATE,fe),e.on(Fe.CRAPS_BETS_UPDATE,Ie),e.on(Fe.CRAPS_BET_DELTA,ct),e.on(Fe.CRAPS_BET_RESULTS,$e),e.on(Fe.CRAPS_BET_ERROR,tt),e.on(Fe.CRAPS_POINT_SET,We),e.on(Fe.CRAPS_POINT_MADE,it),e.on(Fe.POKER_MY_HOLE,He),e.on(Fe.POKER_WINNERS,ce),e.on(Fe.POKER_REVEAL_ALL,xe),e.on(Fe.POKER_TIMED_OUT,re),e.on(Fe.ROOM_UPDATE_STATE,H);const ge=Be=>r.current.onCrapsState?.(Be);return e.on(Fe.CRAPS_STATE,ge),()=>{e.off(Fe.LOBBY_ROOMS,n),e.off(Fe.ROOM_CREATED,a);try{e.off(Fe.POKER_ROOM_CREATED,a)}catch{}e.off(Fe.ROOM_UPDATED,i);try{e.off(Fe.POKER_ROOM_UPDATED,i)}catch{}e.off(Fe.ROOM_DELETED,o);try{e.off(Fe.POKER_ROOM_DELETED,o)}catch{}e.off(Fe.JOINED_ROOM,c);try{e.off(Fe.POKER_JOINED_ROOM,c)}catch{}e.off(Fe.REJOINED_ROOM,u),e.off(Fe.OTHER_JOINED,d);try{e.off(Fe.POKER_OTHER_JOINED,d)}catch{}e.off(Fe.OTHER_LEFT,f),e.off(Fe.BANKER_CHANGED,h),e.off(Fe.DICE_ROLLED,m),e.off(Fe.NOT_YOUR_TURN,_),e.off(Fe.OTA_UPDATE_AVAILABLE,w),e.off(Fe.BETS_UPDATED,b),e.off(Fe.GET_WAGERS,E),e.off(Fe.PLAYER_BALANCE_UPDATED,T),e.off(Fe.SIDE_BET_CREATED,R),e.off(Fe.SIDE_BET_ACCEPTED,P),e.off(Fe.SIDE_BET_CANCELED,A),e.off(Fe.FORCE_LOGOUT,C),e.off(Fe.ERROR,O),e.off(Fe.RTC_SIGNAL,I),e.off(Fe.RTC_PEER_JOINED,x),e.off(Fe.RTC_PEER_LEFT,D),e.off(Fe.RTC_CAMERA_OWNER_CHANGED,N),e.off(Fe.RTC_VIDEO_ENABLED,L),e.off(Fe.ROOM_MESSAGE,j),e.off(Fe.ROOM_HISTORY,q),e.off(Fe.DM_MESSAGE,U),e.off(Fe.DM_HISTORY,W),e.off(Fe.FAIRNESS_REVEAL,F),e.off(Fe.FRIEND_REQUEST_RECEIVED,Y),e.off(Fe.FRIEND_REQUEST_CANCELLED,Q),e.off(Fe.FRIEND_REQUEST_RESPONDED,ie),e.off(Fe.UNFRIENDED,G),e.off(Fe.USER_BLOCKED,B),e.off(Fe.USER_UNBLOCKED,K),e.off(Fe.GAME_INVITE_RECEIVED,ae),e.off(Fe.TURN_ORDER_UPDATED,te),e.off(Fe.SPECTATORS_UPDATED,me),e.off(Fe.PLAYER_PROFILE_UPDATED,ue),e.off(Fe.PLAYER_PRESENCE_UPDATE,Ae),e.off(Fe.CRAPS_ROLL,Re),e.off(Fe.CRAPS_READY_UPDATE,fe),e.off(Fe.CRAPS_BETS_UPDATE,Ie),e.off(Fe.CRAPS_BET_DELTA,ct),e.off(Fe.CRAPS_BET_RESULTS,$e),e.off(Fe.CRAPS_BET_ERROR,tt),e.off(Fe.CRAPS_POINT_SET,We),e.off(Fe.CRAPS_POINT_MADE,it),e.off(Fe.POKER_MY_HOLE,He),e.off(Fe.POKER_WINNERS,ce),e.off(Fe.POKER_REVEAL_ALL,xe),e.off(Fe.POKER_TIMED_OUT,re),e.off(Fe.ROOM_UPDATE_STATE,H),e.off(Fe.CRAPS_STATE)}};let Mt=Et();const _t=()=>{try{Mt&&Mt()}catch{}Mt=Et()};return e.on("connect",_t),e.on("reconnect",_t),()=>{e.off("connect",_t),e.off("reconnect",_t);try{Mt&&Mt()}catch{}}},[e])}function aB(){const{getRoomsList:t,createRoom:e,lobbyJoin:r,lobbyLeave:n}=pa(),[a,i]=v.useState({public:[],private:[]}),[o,c]=v.useState(!0),[u,d]=v.useState(null),{setMembershipModalOpen:f}=Lb(),{resetSpin:h}=Xo(),m=globalThis.__lastRoomsFetchAt||(globalThis.__lastRoomsFetchAt={}),_=600,w=v.useCallback(async()=>{const C=Date.now(),O=m.t||0;if(!(C-O<_)){m.t=C,c(!0),d(null);try{const I=await t();if(I?.ok){const x=I.public&&I.private?{public:I.public,private:I.private}:null,D=I.data||I.roomsList||{},N=D.public&&D.private?{public:D.public,private:D.private}:null,L=x||N||{public:[],private:[]};i({public:Array.isArray(L.public)?L.public:[],private:Array.isArray(L.private)?L.private:[]})}else throw new Error(I?.error??"Failed to load rooms.")}catch(I){d(I?.message??"Failed to load rooms.")}finally{c(!1)}}},[t]),b=globalThis.__lobbyState||(globalThis.__lobbyState={refCount:0,joined:!1}),E=v.useCallback(async()=>{b.refCount++,b.joined||(b.joined=!0,await r())},[r]),T=v.useCallback(async()=>{b.refCount=Math.max(0,b.refCount-1),b.refCount===0&&b.joined&&(b.joined=!1,await n())},[n]),R=globalThis.__createRoomGuard||(globalThis.__createRoomGuard={}),P=800,A=v.useCallback(async C=>{const O=Date.now(),I=R.lastAt||0;if(O-I<P&&R.inFlight)try{return await R.inFlight}catch{}const x=async()=>{let L=0;if(O-I<P){const j=P-(O-I);await new Promise(q=>setTimeout(q,Math.max(50,j)))}for(;L<3;){L++;const j=await e({name:C.name,isPrivate:C.isPrivate,singlePlayer:C.singlePlayer,gameMode:C.gameMode});if(!j||j.ok===!0||j?.ok===!1&&j.error!=="rate_limited"&&!/rate[_-]?limited/i.test(j.error||""))return j;const q=180*L,U=Math.floor(Math.random()*140);await new Promise(W=>setTimeout(W,q+U))}return e({name:C.name,isPrivate:C.isPrivate,singlePlayer:C.singlePlayer,gameMode:C.gameMode})};c(!0),d(null),R.lastAt=Date.now();const D=x();R.inFlight=D;try{const N=await D;if(!N?.ok)return N;const L=N.room||N.roomsList?.room||null;if(L){const j={roomId:L.roomId,name:L.name,createdAt:L.createdAt,maxPlayers:L.maxPlayers,currentPlayers:L.players?.length??1,phase:L.gameState?.phase??"waiting",private:!!L.private,gameMode:L.gameMode||L.gameState?.gameMode||"cee-lo"};i(q=>q.public.some(U=>U.roomId===j.roomId)||q.private.some(U=>U.roomId===j.roomId)?q:j.private?{...q,private:[j,...q.private]}:{...q,public:[j,...q.public]})}else await w();return h(),N}catch(N){const L=N?.message??"Failed to create room.";throw d(L),N}finally{c(!1),R.inFlight=null}},[e,w,f,h]);return v.useEffect(()=>(E(),()=>{T()}),[]),v.useEffect(()=>{w()},[w]),Pa({onRoomCreated:C=>{i(O=>C.private?{...O,private:[C,...O.private.filter(I=>I.roomId!==C.roomId)]}:{...O,public:[C,...O.public.filter(I=>I.roomId!==C.roomId)]})},onRoomDeleted:({roomId:C})=>{i(O=>({public:O.public.filter(I=>I.roomId!==C),private:O.private.filter(I=>I.roomId!==C)}))},onRoomUpdated:C=>{i(O=>({public:O.public.map(I=>I.roomId===C.roomId?{...I,currentPlayers:C.currentPlayers??I.currentPlayers,phase:C.phase??I.phase}:I),private:O.private.map(I=>I.roomId===C.roomId?{...I,currentPlayers:C.currentPlayers??I.currentPlayers,phase:C.phase??I.phase}:I)}))}}),{roomsList:a,loading:o,error:u,refreshRooms:w,createRoom:A}}function VG({gameMode:t}){const[e,r]=v.useState(""),[n,a]=v.useState(2),[i,o]=v.useState(!1),[c,u]=v.useState(!1),[d,f]=v.useState(!1),[h,m]=v.useState(null),[_,w]=v.useState(null),b=tn(),{createRoom:E}=aB(),{pokerCreateRoom:T}=pa(),R=async P=>{P.preventDefault(),m(null),f(!0);try{const A=t||"cee-lo";let C;if(A==="poker"?C=await T({name:e,maxPlayers:n,isPrivate:i,singlePlayer:c}):C=await E({name:e,maxPlayers:n,isPrivate:i,singlePlayer:c,gameMode:A}),!C?.ok)m("Failed to create room");else{const O=C?.room??C?.roomsList?.room??C?.data?.room??null,I=O?.roomId??O?.id??C?.roomId??C?.data?.roomId;b(I?A==="poker"?`/poker/room/${I}`:`/room/${I}`:A==="poker"?"/poker":"/")}}catch{m("Unexpected error")}finally{f(!1)}};return _?g.jsxs("div",{className:"create-room-success",children:[g.jsx("h2",{children:"Room Created!"}),g.jsxs("p",{children:["Your room ",g.jsx("strong",{children:_.name})," (ID: ",g.jsx("code",{children:_.roomId}),") has been created."]})]}):g.jsxs("form",{className:"create-room-form",onSubmit:R,children:[g.jsx("h2",{children:"Create a New Room"}),g.jsxs("label",{children:["Room Name",g.jsx("input",{type:"text",value:e,onChange:P=>r(P.target.value),required:!0,disabled:d,className:"create-room-input",placeholder:"Enter room name"})]}),g.jsxs("label",{children:["Max Players",g.jsx("input",{type:"number",value:n,min:2,max:10,className:"create-room-input",onChange:P=>a(Number(P.target.value)),required:!0,disabled:d})]}),g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:i,onChange:P=>o(P.target.checked),disabled:d}),"Private room (invite only)"]}),h&&g.jsx("p",{className:"error",children:h}),g.jsx("button",{className:"felt-btn",type:"submit",disabled:d,children:d?"Creating...":"Create Room"})]})}function iB(t){v.useEffect(()=>{if(!(typeof document>"u")){if(t){try{nm(!0)}catch{}try{Rx()}catch{}try{document.body.classList.add("modal-open")}catch{}}else{try{nm(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}return()=>{try{nm(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}}},[t])}function HG({open:t,onClose:e,gameMode:r}){const[n,a]=v.useState(r||"cee-lo");iB(!!t),v.useEffect(()=>{const o=c=>{c.key==="Escape"&&e()};return t&&document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[t,e]),v.useEffect(()=>{r&&a(r)},[r]);const i=n==="craps"?"Craps":n==="poker"?"Poker":"Cee‑Lo";return t?g.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:e,children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Create a room",onClick:o=>o.stopPropagation(),children:[g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"}),g.jsx("h3",{className:"modal-title",children:"Create a Room"}),g.jsxs("p",{"aria-live":"polite",className:"modal-subtitle",children:["Game mode: ",g.jsx("strong",{children:i})]}),g.jsx(VG,{gameMode:n})]})}):null}function vO({rooms:t,title:e}){const r=tn();if(t.length===0)return g.jsx("div",{className:"room-list",children:"No rooms available."});const n=(a,i)=>{if(i==="poker")return r(`/poker/room/${a}`);r(`/room/${a}`)};return g.jsxs("div",{className:"room-list",children:[g.jsx("h3",{children:e}),g.jsx("ul",{children:[...new Set(t)].filter(a=>!a.singlePlayer).map(a=>g.jsxs("li",{className:"room-list__item",children:[g.jsxs("div",{className:"room-list__info",children:[g.jsx("span",{className:"room-list__name",children:a.name}),a.private&&g.jsx("span",{className:"room-list__private",children:"🔒"}),g.jsxs("span",{className:"room-list__players",children:[a.currentPlayers,"/",a.maxPlayers]}),g.jsx("span",{className:"room-list__phase",children:a.phase??"waiting"}),a.gameMode&&g.jsx("span",{className:"room-list__mode",title:"Game Mode",children:a.gameMode}),g.jsx("span",{className:"room-list__created",children:new Date(a.createdAt).toLocaleTimeString()})]}),g.jsx("button",{className:"btn btn--join",onClick:()=>n(a.roomId,a.gameMode),children:"Join"})]},a.roomId))})]})}function GG({open:t,onClose:e,isPrivate:r,setIsPrivate:n,roomsList:a}){const i=v.useRef(null);return v.useEffect(()=>{if(!t)return;const o=u=>{u.key==="Escape"&&e()},c=u=>{i.current&&!i.current.contains(u.target)&&e()};return document.addEventListener("keydown",o),document.addEventListener("mousedown",c),()=>{document.removeEventListener("keydown",o),document.removeEventListener("mousedown",c)}},[t,e]),t?g.jsx("div",{className:"modal-backdrop",role:"presentation",children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Browse Rooms",ref:i,children:[g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"}),g.jsx("h3",{className:"modal-title",children:"Browse Rooms"}),g.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,marginBottom:12},children:[g.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:r,onChange:o=>n(o.target.checked)}),g.jsxs("span",{children:[r?"Private":"Public"," Rooms"]})]}),r?a.private.length?g.jsx(vO,{title:"Private Rooms",rooms:a.private}):g.jsx("p",{children:"No private rooms available."}):a.public.length?g.jsx(vO,{title:"Public Rooms",rooms:a.public}):g.jsx("p",{children:"No public rooms available."})]})}):null}function WG({anchorRef:t,open:e,onClose:r,items:n}){const a=v.useRef(null);return v.useEffect(()=>{if(!e)return;const i=c=>{const u=c.target,d=!!a.current?.contains(u),f=!!t.current?.contains(u);!d&&!f&&r()},o=c=>{c.key==="Escape"&&r()};return document.addEventListener("mousedown",i,!0),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",i,!0),document.removeEventListener("keydown",o)}},[e,r,t]),e?g.jsx("div",{ref:a,className:"settings-menu",role:"menu","aria-orientation":"vertical",children:n.map(i=>g.jsx("button",{className:"settings-menu__item",role:"menuitem",onClick:()=>{i.onClick?.(),r()},children:i.label},i.key))}):null}const Lo=to("App",{web:()=>qr(()=>import("./web-tx4AbJdR.js"),[],import.meta.url).then(t=>new t.AppWeb)}),KG=Object.freeze(Object.defineProperty({__proto__:null,App:Lo},Symbol.toStringTag,{value:"Module"}));var YG=Object.create,sB=Object.defineProperty,XG=Object.getOwnPropertyDescriptor,JG=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Bb=t=>{throw TypeError(t)},oB=(t,e,r)=>e in t?sB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,QG=t=>[,,,YG(null)],cB=["class","method","getter","setter","accessor","field","value","get","set"],lB=t=>t!==void 0&&typeof t!="function"?Bb("Function expected"):t,ZG=(t,e,r,n,a)=>({kind:cB[t],name:e,metadata:n,addInitializer:i=>r._?Bb("Already initialized"):a.push(lB(i||null))}),eW=(t,e)=>oB(e,JG("metadata"),t[3]),tW=(t,e,r,n)=>{for(var a=0,i=t[e>>1],o=i&&i.length;a<o;a++)i[a].call(r);return n},rW=(t,e,r,n,a,i)=>{for(var o,c,u,d,f=e&7,h=!1,m=!1,_=2,w=cB[f+5],b=t[_]||(t[_]=[]),E=(a=a.prototype,XG(a,r)),T=n.length-1;T>=0;T--)u=ZG(f,r,c={},t[3],b),u.static=h,u.private=m,d=u.access={has:R=>r in R},d.get=R=>R[r],f>2,o=(0,n[T])(E[w],u),c._=1,lB(o)&&(E[w]=o);return E&&sB(a,r,E),a},vt=(t,e,r)=>oB(t,typeof e!="symbol"?e+"":e,r),uB=(t,e,r)=>e.has(t)||Bb("Cannot "+r),_O=(t,e,r)=>(uB(t,e,"read from private field"),r?r.call(t):e.get(t)),bO=(t,e,r)=>e.has(t)?Bb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),kO=(t,e,r,n)=>(uB(t,e,"write to private field"),e.set(t,r),r);const nW="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(nW);const Dx=1,Ox=2,dB=4,aW=8,iW=16,sW=1,oW=2,cW=4,lW=8,uW=16,dW=1,fW=2,pW=4,hW=1,mW=2,ri=Symbol(),Rm="http://www.w3.org/2000/svg";function gW(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const yW=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function vW(t){return yW.includes(t)}const _W={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject"};function bW(t){return t=t.toLowerCase(),_W[t]??t}const kW=["touchstart","touchmove"];function wW(t){return kW.includes(t)}const SW=!1;var Ub=Array.isArray,EW=Array.prototype.indexOf,Nx=Array.from,TW=Object.defineProperty,Bl=Object.getOwnPropertyDescriptor,fB=Object.getOwnPropertyDescriptors,CW=Object.prototype,xW=Array.prototype,Ix=Object.getPrototypeOf;function gf(t){return typeof t=="function"}const Ar=()=>{};function PW(t){return t()}function O_(t){for(var e=0;e<t.length;e++)t[e]()}const Xs=2,pB=4,Cg=8,Fb=16,ro=32,xg=64,N_=128,gd=256,I_=512,hi=1024,Xl=2048,Pg=4096,Bo=8192,Ep=16384,hB=32768,lu=65536,AW=1<<17,RW=1<<19,mB=1<<20,Ul=Symbol("$state"),gB=Symbol("legacy props"),DW=Symbol("");function yB(t){return t===this.v}function vB(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function Mx(t){return!vB(t,this.v)}function OW(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function NW(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function IW(t){throw new Error("https://svelte.dev/e/effect_orphan")}function MW(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function jW(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function LW(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function BW(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function UW(){throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function FW(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Tp=!1,qW=!1;function zW(){Tp=!0}function ai(t,e){var r={f:0,v:t,reactions:null,equals:yB,rv:0,wv:0};return r}function sr(t){return _B(ai(t))}function qb(t,e=!1){var r;const n=ai(t);return e||(n.equals=Mx),Tp&&Dr!==null&&Dr.l!==null&&((r=Dr.l).s??(r.s=[])).push(n),n}function Ls(t,e=!1){return _B(qb(t,e))}function _B(t){return zr!==null&&(zr.f&Xs)!==0&&(Uo===null?eK([t]):Uo.push(t)),t}function pt(t,e){return zr!==null&&qx()&&(zr.f&(Xs|Fb))!==0&&(Uo===null||!Uo.includes(t))&&FW(),vT(t,e)}function vT(t,e){return t.equals(e)||(t.v,t.v=e,t.wv=LB(),bB(t,Xl),qx()&&lr!==null&&(lr.f&hi)!==0&&(lr.f&ro)===0&&(Ma!==null&&Ma.includes(t)?(no(lr,Xl),Vb(lr)):Fl===null?tK([t]):Fl.push(t))),e}function bB(t,e){var r=t.reactions;if(r!==null)for(var n=qx(),a=r.length,i=0;i<a;i++){var o=r[i],c=o.f;(c&Xl)===0&&(!n&&o===lr||(no(o,e),(c&(hi|gd))!==0&&((c&Xs)!==0?bB(o,Pg):Vb(o))))}}let jx=!1;function Vt(t,e=null,r){if(typeof t!="object"||t===null||Ul in t)return t;const n=Ix(t);if(n!==CW&&n!==xW)return t;var a=new Map,i=Ub(t),o=ai(0);i&&a.set("length",ai(t.length));var c;return new Proxy(t,{defineProperty(u,d,f){(!("value"in f)||f.configurable===!1||f.enumerable===!1||f.writable===!1)&&LW();var h=a.get(d);return h===void 0?(h=ai(f.value),a.set(d,h)):pt(h,Vt(f.value,c)),!0},deleteProperty(u,d){var f=a.get(d);if(f===void 0)d in u&&a.set(d,ai(ri));else{if(i&&typeof d=="string"){var h=a.get("length"),m=Number(d);Number.isInteger(m)&&m<h.v&&pt(h,m)}pt(f,ri),wO(o)}return!0},get(u,d,f){var h;if(d===Ul)return t;var m=a.get(d),_=d in u;if(m===void 0&&(!_||(h=Bl(u,d))!=null&&h.writable)&&(m=ai(Vt(_?u[d]:ri,c)),a.set(d,m)),m!==void 0){var w=$(m);return w===ri?void 0:w}return Reflect.get(u,d,f)},getOwnPropertyDescriptor(u,d){var f=Reflect.getOwnPropertyDescriptor(u,d);if(f&&"value"in f){var h=a.get(d);h&&(f.value=$(h))}else if(f===void 0){var m=a.get(d),_=m?.v;if(m!==void 0&&_!==ri)return{enumerable:!0,configurable:!0,value:_,writable:!0}}return f},has(u,d){var f;if(d===Ul)return!0;var h=a.get(d),m=h!==void 0&&h.v!==ri||Reflect.has(u,d);if(h!==void 0||lr!==null&&(!m||(f=Bl(u,d))!=null&&f.writable)){h===void 0&&(h=ai(m?Vt(u[d],c):ri),a.set(d,h));var _=$(h);if(_===ri)return!1}return m},set(u,d,f,h){var m,_=a.get(d),w=d in u;if(i&&d==="length")for(var b=f;b<_.v;b+=1){var E=a.get(b+"");E!==void 0?pt(E,ri):b in u&&(E=ai(ri),a.set(b+"",E))}_===void 0?(!w||(m=Bl(u,d))!=null&&m.writable)&&(_=ai(void 0),pt(_,Vt(f,c)),a.set(d,_)):(w=_.v!==ri,pt(_,Vt(f,c)));var T=Reflect.getOwnPropertyDescriptor(u,d);if(T!=null&&T.set&&T.set.call(h,f),!w){if(i&&typeof d=="string"){var R=a.get("length"),P=Number(d);Number.isInteger(P)&&P>=R.v&&pt(R,P+1)}wO(o)}return!0},ownKeys(u){$(o);var d=Reflect.ownKeys(u).filter(m=>{var _=a.get(m);return _===void 0||_.v!==ri});for(var[f,h]of a)h.v!==ri&&!(f in u)&&d.push(f);return d},setPrototypeOf(){BW()}})}function wO(t,e=1){pt(t,t.v+e)}var SO,kB,wB;function $W(){if(SO===void 0){SO=window;var t=Element.prototype,e=Node.prototype;kB=Bl(e,"firstChild").get,wB=Bl(e,"nextSibling").get,t.__click=void 0,t.__className="",t.__attributes=null,t.__styles=null,t.__e=void 0,Text.prototype.__t=void 0}}function Ag(t=""){return document.createTextNode(t)}function id(t){return kB.call(t)}function zb(t){return wB.call(t)}function Le(t,e){return id(t)}function Xt(t,e){{var r=id(t);return r instanceof Comment&&r.data===""?zb(r):r}}function kt(t,e=1,r=!1){let n=t;for(;e--;)n=zb(n);return n}function VW(t){t.textContent=""}function ze(t){var e=Xs|Xl;lr===null?e|=gd:lr.f|=mB;var r=zr!==null&&(zr.f&Xs)!==0?zr:null;const n={children:null,ctx:Dr,deps:null,equals:yB,f:e,fn:t,reactions:null,rv:0,v:null,wv:0,parent:r??lr};return r!==null&&(r.children??(r.children=[])).push(n),n}function If(t){const e=ze(t);return e.equals=Mx,e}function SB(t){var e=t.children;if(e!==null){t.children=null;for(var r=0;r<e.length;r+=1){var n=e[r];(n.f&Xs)!==0?Lx(n):ys(n)}}}function HW(t){for(var e=t.parent;e!==null;){if((e.f&Xs)===0)return e;e=e.parent}return null}function EB(t){var e,r=lr;mi(HW(t));try{SB(t),e=BB(t)}finally{mi(r)}return e}function TB(t){var e=EB(t),r=(Nl||(t.f&gd)!==0)&&t.deps!==null?Pg:hi;no(t,r),t.equals(e)||(t.v=e,t.wv=LB())}function Lx(t){SB(t),Im(t,0),no(t,Ep),t.v=t.children=t.deps=t.ctx=t.reactions=null}function CB(t){lr===null&&zr===null&&IW(),zr!==null&&(zr.f&gd)!==0&&NW(),Fx&&OW()}function GW(t,e){var r=e.last;r===null?e.last=e.first=t:(r.next=t,t.prev=r,e.last=t)}function Cp(t,e,r,n=!0){var a=(t&xg)!==0,i=lr,o={ctx:Dr,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:t|Xl,first:null,fn:e,last:null,next:null,parent:a?null:i,prev:null,teardown:null,transitions:null,wv:0};if(r){var c=Mf;try{EO(!0),Og(o),o.f|=hB}catch(f){throw ys(o),f}finally{EO(c)}}else e!==null&&Vb(o);var u=r&&o.deps===null&&o.first===null&&o.nodes_start===null&&o.teardown===null&&(o.f&mB)===0;if(!u&&!a&&n&&(i!==null&&GW(o,i),zr!==null&&(zr.f&Xs)!==0)){var d=zr;(d.children??(d.children=[])).push(o)}return o}function WW(){return zr===null?!1:!Nl}function xB(t){const e=Cp(Cg,null,!1);return no(e,hi),e.teardown=t,e}function ap(t){CB();var e=lr!==null&&(lr.f&ro)!==0&&Dr!==null&&!Dr.m;if(e){var r=Dr;(r.e??(r.e=[])).push({fn:t,effect:lr,reaction:zr})}else{var n=$b(t);return n}}function KW(t){return CB(),Rg(t)}function YW(t){const e=Cp(xg,t,!0);return(r={})=>new Promise(n=>{r.outro?sd(e,()=>{ys(e),n(void 0)}):(ys(e),n(void 0))})}function $b(t){return Cp(pB,t,!1)}function vo(t,e){var r=Dr,n={effect:null,ran:!1};r.l.r1.push(n),n.effect=Rg(()=>{t(),!n.ran&&(n.ran=!0,pt(r.l.r2,!0),Wo(e))})}function XW(){var t=Dr;Rg(()=>{if($(t.l.r2)){for(var e of t.l.r1){var r=e.effect;(r.f&hi)!==0&&no(r,Pg),xp(r)&&Og(r),e.ran=!1}t.l.r2.v=!1}})}function Rg(t){return Cp(Cg,t,!0)}function mt(t){return uu(t)}function uu(t,e=0){return Cp(Cg|Fb|e,t,!0)}function ps(t,e=!0){return Cp(Cg|ro,t,!0,e)}function PB(t){var e=t.teardown;if(e!==null){const r=Fx,n=zr;TO(!0),vs(null);try{e.call(null)}finally{TO(r),vs(n)}}}function AB(t){var e=t.deriveds;if(e!==null){t.deriveds=null;for(var r=0;r<e.length;r+=1)Lx(e[r])}}function RB(t,e=!1){var r=t.first;for(t.first=t.last=null;r!==null;){var n=r.next;ys(r,e),r=n}}function JW(t){for(var e=t.first;e!==null;){var r=e.next;(e.f&ro)===0&&ys(e),e=r}}function ys(t,e=!0){var r=!1;if((e||(t.f&RW)!==0)&&t.nodes_start!==null){for(var n=t.nodes_start,a=t.nodes_end;n!==null;){var i=n===a?null:zb(n);n.remove(),n=i}r=!0}RB(t,e&&!r),AB(t),Im(t,0),no(t,Ep);var o=t.transitions;if(o!==null)for(const u of o)u.stop();PB(t);var c=t.parent;c!==null&&c.first!==null&&DB(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=null}function DB(t){var e=t.parent,r=t.prev,n=t.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=r))}function sd(t,e){var r=[];Bx(t,r,!0),OB(r,()=>{ys(t),e&&e()})}function OB(t,e){var r=t.length;if(r>0){var n=()=>--r||e();for(var a of t)a.out(n)}else e()}function Bx(t,e,r){if((t.f&Bo)===0){if(t.f^=Bo,t.transitions!==null)for(const o of t.transitions)(o.is_global||r)&&e.push(o);for(var n=t.first;n!==null;){var a=n.next,i=(n.f&lu)!==0||(n.f&ro)!==0;Bx(n,e,i?r:!1),n=a}}}function Dm(t){NB(t,!0)}function NB(t,e){if((t.f&Bo)!==0){xp(t)&&Og(t),t.f^=Bo;for(var r=t.first;r!==null;){var n=r.next,a=(r.f&lu)!==0||(r.f&ro)!==0;NB(r,a?e:!1),r=n}if(t.transitions!==null)for(const i of t.transitions)(i.is_global||e)&&i.in()}}let M_=!1,_T=[];function IB(){M_=!1;const t=_T.slice();_T=[],O_(t)}function yd(t){M_||(M_=!0,queueMicrotask(IB)),_T.push(t)}function QW(){M_&&IB()}function Ux(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}const MB=0,ZW=1;let im=!1,Hv=MB,Om=!1,Nm=null,Mf=!1,Fx=!1;function EO(t){Mf=t}function TO(t){Fx=t}let Gu=[],jf=0,zr=null;function vs(t){zr=t}let lr=null;function mi(t){lr=t}let Uo=null;function eK(t){Uo=t}let Ma=null,Di=0,Fl=null;function tK(t){Fl=t}let jB=1,bT=0,Nl=!1,Dr=null;function CO(t){Dr=t}function LB(){return++jB}function qx(){return!Tp||Dr!==null&&Dr.l===null}function xp(t){var e,r=t.f;if((r&Xl)!==0)return!0;if((r&Pg)!==0){var n=t.deps,a=(r&gd)!==0;if(n!==null){var i,o,c=(r&I_)!==0,u=a&&lr!==null&&!Nl,d=n.length;if(c||u){for(i=0;i<d;i++)o=n[i],(c||!((e=o?.reactions)!=null&&e.includes(t)))&&(o.reactions??(o.reactions=[])).push(t);c&&(t.f^=I_)}for(i=0;i<d;i++)if(o=n[i],xp(o)&&TB(o),o.wv>t.wv)return!0}(!a||lr!==null&&!Nl)&&no(t,hi)}return!1}function rK(t,e){for(var r=e;r!==null;){if((r.f&N_)!==0)try{r.fn(t);return}catch{r.f^=N_}r=r.parent}throw im=!1,t}function nK(t){return(t.f&Ep)===0&&(t.parent===null||(t.parent.f&N_)===0)}function $w(){im=!1}function Dg(t,e,r,n){if(im){if(r===null&&(im=!1),nK(e))throw t;return}r!==null&&(im=!0);{rK(t,e);return}}function BB(t){var e,r=Ma,n=Di,a=Fl,i=zr,o=Nl,c=Uo,u=Dr,d=t.f;Ma=null,Di=0,Fl=null,zr=(d&(ro|xg))===0?t:null,Nl=!Mf&&(d&gd)!==0,Uo=null,Dr=t.ctx,bT++;try{var f=(0,t.fn)(),h=t.deps;if(Ma!==null){var m;if(Im(t,Di),h!==null&&Di>0)for(h.length=Di+Ma.length,m=0;m<Ma.length;m++)h[Di+m]=Ma[m];else t.deps=h=Ma;if(!Nl)for(m=Di;m<h.length;m++)((e=h[m]).reactions??(e.reactions=[])).push(t)}else h!==null&&Di<h.length&&(Im(t,Di),h.length=Di);return f}finally{Ma=r,Di=n,Fl=a,zr=i,Nl=o,Uo=c,Dr=u}}function aK(t,e){let r=e.reactions;if(r!==null){var n=EW.call(r,t);if(n!==-1){var a=r.length-1;a===0?r=e.reactions=null:(r[n]=r[a],r.pop())}}r===null&&(e.f&Xs)!==0&&(Ma===null||!Ma.includes(e))&&(no(e,Pg),(e.f&(gd|I_))===0&&(e.f^=I_),Im(e,0))}function Im(t,e){var r=t.deps;if(r!==null)for(var n=e;n<r.length;n++)aK(t,r[n])}function Og(t){var e=t.f;if((e&Ep)===0){no(t,hi);var r=lr,n=Dr;lr=t;try{(e&Fb)!==0?JW(t):RB(t),AB(t),PB(t);var a=BB(t);t.teardown=typeof a=="function"?a:null,t.wv=jB;var i=t.deps,o;SW&&qW&&t.f&Xl}catch(c){Dg(c,t,r,n||t.ctx)}finally{lr=r}}}function UB(){if(jf>1e3){jf=0;try{MW()}catch(t){if(Nm!==null)Dg(t,Nm,null);else throw t}}jf++}function FB(t){var e=t.length;if(e!==0){UB();var r=Mf;Mf=!0;try{for(var n=0;n<e;n++){var a=t[n];(a.f&hi)===0&&(a.f^=hi);var i=[];qB(a,i),iK(i)}}finally{Mf=r}}}function iK(t){var e=t.length;if(e!==0)for(var r=0;r<e;r++){var n=t[r];if((n.f&(Ep|Bo))===0)try{xp(n)&&(Og(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?DB(n):n.fn=null))}catch(a){Dg(a,n,null,n.ctx)}}}function sK(){if(Om=!1,jf>1001)return;const t=Gu;Gu=[],FB(t),Om||(jf=0,Nm=null)}function Vb(t){Hv===MB&&(Om||(Om=!0,queueMicrotask(sK))),Nm=t;for(var e=t;e.parent!==null;){e=e.parent;var r=e.f;if((r&(xg|ro))!==0){if((r&hi)===0)return;e.f^=hi}}Gu.push(e)}function qB(t,e){var r=t.first,n=[];e:for(;r!==null;){var a=r.f,i=(a&ro)!==0,o=i&&(a&hi)!==0,c=r.next;if(!o&&(a&Bo)===0)if((a&Cg)!==0){if(i)r.f^=hi;else try{xp(r)&&Og(r)}catch(h){Dg(h,r,null,r.ctx)}var u=r.first;if(u!==null){r=u;continue}}else(a&pB)!==0&&n.push(r);if(c===null){let h=r.parent;for(;h!==null;){if(t===h)break e;var d=h.next;if(d!==null){r=d;continue e}h=h.parent}}r=c}for(var f=0;f<n.length;f++)u=n[f],e.push(u),qB(u,e)}function zB(t){var e=Hv,r=Gu;try{UB();const a=[];Hv=ZW,Gu=a,Om=!1,FB(r);var n=t?.();return QW(),(Gu.length>0||a.length>0)&&zB(),jf=0,Nm=null,n}finally{Hv=e,Gu=r}}async function oK(){await Promise.resolve(),zB()}function $(t){var e,r=t.f,n=(r&Xs)!==0;if(n&&(r&Ep)!==0){var a=EB(t);return Lx(t),a}if(zr!==null){Uo!==null&&Uo.includes(t)&&UW();var i=zr.deps;t.rv<bT&&(t.rv=bT,Ma===null&&i!==null&&i[Di]===t?Di++:Ma===null?Ma=[t]:Ma.push(t),Fl!==null&&lr!==null&&(lr.f&hi)!==0&&(lr.f&ro)===0&&Fl.includes(t)&&(no(lr,Xl),Vb(lr)))}else if(n&&t.deps===null)for(var o=t,c=o.parent,u=o;c!==null;)if((c.f&Xs)!==0){var d=c;u=d,c=d.parent}else{var f=c;(e=f.deriveds)!=null&&e.includes(u)||(f.deriveds??(f.deriveds=[])).push(u);break}return n&&(o=t,xp(o)&&TB(o)),t.v}function Wo(t){const e=zr;try{return zr=null,t()}finally{zr=e}}const cK=-7169;function no(t,e){t.f=t.f&cK|e}function Jn(t){return $B().get(t)}function Zu(t,e){return $B().set(t,e),e}function $B(t){return Dr===null&&Ux(),Dr.c??(Dr.c=new Map(lK(Dr)||void 0))}function lK(t){let e=t.p;for(;e!==null;){const r=e.c;if(r!==null)return r;e=e.p}return null}function Wt(t,e=!1,r){Dr={p:Dr,c:null,e:null,m:!1,s:t,x:null,l:null},Tp&&!e&&(Dr.l={s:null,u:null,r1:[],r2:ai(!1)})}function Kt(t){const e=Dr;if(e!==null){t!==void 0&&(e.x=t);const o=e.e;if(o!==null){var r=lr,n=zr;e.e=null;try{for(var a=0;a<o.length;a++){var i=o[a];mi(i.effect),vs(i.reaction),$b(i.fn)}}finally{mi(r),vs(n)}}Dr=e.p,e.m=!0}return t||{}}function Gv(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(Ul in t)kT(t);else if(!Array.isArray(t))for(let e in t){const r=t[e];typeof r=="object"&&r&&Ul in r&&kT(r)}}}function kT(t,e=new Set){if(typeof t=="object"&&t!==null&&!(t instanceof EventTarget)&&!e.has(t)){e.add(t),t instanceof Date&&t.getTime();for(let n in t)try{kT(t[n],e)}catch{}const r=Ix(t);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const n=fB(r);for(let a in n){const i=n[a].get;if(i)try{i.call(t)}catch{}}}}}function uK(t,e){if(e){const r=document.body;t.autofocus=!0,yd(()=>{document.activeElement===r&&t.focus()})}}function dK(t){var e=zr,r=lr;vs(null),mi(null);try{return t()}finally{vs(e),mi(r)}}const VB=new Set,wT=new Set;function zx(t,e,r,n){function a(i){if(n.capture||Vh.call(e,i),!i.cancelBubble)return dK(()=>r.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?yd(()=>{e.addEventListener(t,a,n)}):e.addEventListener(t,a,n),a}function fK(t,e,r,n={}){var a=zx(e,t,r,n);return()=>{t.removeEventListener(e,a,n)}}function Mo(t,e,r,n,a){var i={capture:n,passive:a},o=zx(t,e,r,i);(e===document.body||e===window||e===document)&&xB(()=>{e.removeEventListener(t,o,i)})}function Hb(t){for(var e=0;e<t.length;e++)VB.add(t[e]);for(var r of wT)r(t)}function Vh(t){var e,r=this,n=r.ownerDocument,a=t.type,i=((e=t.composedPath)==null?void 0:e.call(t))||[],o=i[0]||t.target,c=0,u=t.__root;if(u){var d=i.indexOf(u);if(d!==-1&&(r===document||r===window)){t.__root=r;return}var f=i.indexOf(r);if(f===-1)return;d<=f&&(c=d)}if(o=i[c]||t.target,o!==r){TW(t,"currentTarget",{configurable:!0,get(){return o||n}});var h=zr,m=lr;vs(null),mi(null);try{for(var _,w=[];o!==null;){var b=o.assignedSlot||o.parentNode||o.host||null;try{var E=o["__"+a];if(E!==void 0&&!o.disabled)if(Ub(E)){var[T,...R]=E;T.apply(o,[t,...R])}else E.call(o,t)}catch(P){_?w.push(P):_=P}if(t.cancelBubble||b===r||b===null)break;o=b}if(_){for(let P of w)queueMicrotask(()=>{throw P});throw _}}finally{t.__root=r,delete t.currentTarget,vs(h),mi(m)}}}function $x(t){var e=document.createElement("template");return e.innerHTML=t,e.content}function od(t,e){var r=lr;r.nodes_start===null&&(r.nodes_start=t,r.nodes_end=e)}function lt(t,e){var r=(e&hW)!==0,n=(e&mW)!==0,a,i=!t.startsWith("<!>");return()=>{a===void 0&&(a=$x(i?t:"<!>"+t),r||(a=id(a)));var o=n?document.importNode(a,!0):a.cloneNode(!0);if(r){var c=id(o),u=o.lastChild;od(c,u)}else od(o,o);return o}}function Jo(t,e,r="svg"){var n=!t.startsWith("<!>"),a=`<${r}>${n?t:"<!>"+t}</${r}>`,i;return()=>{if(!i){var o=$x(a),c=id(o);i=id(c)}var u=i.cloneNode(!0);return od(u,u),u}}function Ur(t=""){{var e=Ag(t+"");return od(e,e),e}}function wr(){var t=document.createDocumentFragment(),e=document.createComment(""),r=Ag();return t.append(e,r),od(e,r),t}function ke(t,e){t!==null&&t.before(e)}let j_=!0;function xO(t){j_=t}function hr(t,e){var r=e==null?"":typeof e=="object"?e+"":e;r!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=r,t.nodeValue=r==null?"":r+"")}function ST(t,e){return pK(t,e)}const af=new Map;function pK(t,{target:e,anchor:r,props:n={},events:a,context:i,intro:o=!0}){$W();var c=new Set,u=h=>{for(var m=0;m<h.length;m++){var _=h[m];if(!c.has(_)){c.add(_);var w=wW(_);e.addEventListener(_,Vh,{passive:w});var b=af.get(_);b===void 0?(document.addEventListener(_,Vh,{passive:w}),af.set(_,1)):af.set(_,b+1)}}};u(Nx(VB)),wT.add(u);var d=void 0,f=YW(()=>{var h=r??e.appendChild(Ag());return ps(()=>{if(i){Wt({});var m=Dr;m.c=i}a&&(n.$$events=a),j_=o,d=t(h,n)||{},j_=!0,i&&Kt()}),()=>{var m;for(var _ of c){e.removeEventListener(_,Vh);var w=af.get(_);--w===0?(document.removeEventListener(_,Vh),af.delete(_)):af.set(_,w)}wT.delete(u),h!==r&&((m=h.parentNode)==null||m.removeChild(h))}});return ET.set(d,f),d}let ET=new WeakMap;function Wv(t,e){const r=ET.get(t);return r?(ET.delete(t),r(e)):Promise.resolve()}function xt(t,e,r=!1){var n=t,a=null,i=null,o=ri,c=r?lu:0,u=!1;const d=(h,m=!0)=>{u=!0,f(m,h)},f=(h,m)=>{o!==(o=h)&&(o?(a?Dm(a):m&&(a=ps(()=>m(n))),i&&sd(i,()=>{i=null})):(i?Dm(i):m&&(i=ps(()=>m(n))),a&&sd(a,()=>{a=null})))};uu(()=>{u=!1,e(d),u||f(null,null)},c)}function ip(t,e){return e}function hK(t,e,r,n){for(var a=[],i=e.length,o=0;o<i;o++)Bx(e[o].e,a,!0);var c=i>0&&a.length===0&&r!==null;if(c){var u=r.parentNode;VW(u),u.append(r),n.clear(),xl(t,e[0].prev,e[i-1].next)}OB(a,()=>{for(var d=0;d<i;d++){var f=e[d];c||(n.delete(f.k),xl(t,f.prev,f.next)),ys(f.e,!c)}})}function sp(t,e,r,n,a,i=null){var o=t,c={flags:e,items:new Map,first:null},u=(e&dB)!==0;if(u){var d=t;o=d.appendChild(Ag())}var f=null,h=!1;uu(()=>{var m=r(),_=Ub(m)?m:m==null?[]:Nx(m),w=_.length;if(!(h&&w===0)){h=w===0;{var b=zr;mK(_,c,o,a,e,(b.f&Bo)!==0,n)}i!==null&&(w===0?f?Dm(f):f=ps(()=>i(o)):f!==null&&sd(f,()=>{f=null})),r()}})}function mK(t,e,r,n,a,i,o,c){var u,d,f,h,m=(a&aW)!==0,_=(a&(Dx|Ox))!==0,w=t.length,b=e.items,E=e.first,T=E,R,P=null,A,C=[],O=[],I,x,D,N;if(m)for(N=0;N<w;N+=1)I=t[N],x=o(I,N),D=b.get(x),D!==void 0&&((u=D.a)==null||u.measure(),(A??(A=new Set)).add(D));for(N=0;N<w;N+=1){if(I=t[N],x=o(I,N),D=b.get(x),D===void 0){var L=T?T.e.nodes_start:r;P=yK(L,e,P,P===null?e.first:P.next,I,x,N,n,a),b.set(x,P),C=[],O=[],T=P.next;continue}if(_&&gK(D,I,N,a),(D.e.f&Bo)!==0&&(Dm(D.e),m&&((d=D.a)==null||d.unfix(),(A??(A=new Set)).delete(D))),D!==T){if(R!==void 0&&R.has(D)){if(C.length<O.length){var j=O[0],q;P=j.prev;var U=C[0],W=C[C.length-1];for(q=0;q<C.length;q+=1)PO(C[q],j,r);for(q=0;q<O.length;q+=1)R.delete(O[q]);xl(e,U.prev,W.next),xl(e,P,U),xl(e,W,j),T=j,P=W,N-=1,C=[],O=[]}else R.delete(D),PO(D,T,r),xl(e,D.prev,D.next),xl(e,D,P===null?e.first:P.next),xl(e,P,D),P=D;continue}for(C=[],O=[];T!==null&&T.k!==x;)(i||(T.e.f&Bo)===0)&&(R??(R=new Set)).add(T),O.push(T),T=T.next;if(T===null)continue;D=T}C.push(D),P=D,T=D.next}if(T!==null||R!==void 0){for(var F=R===void 0?[]:Nx(R);T!==null;)(i||(T.e.f&Bo)===0)&&F.push(T),T=T.next;var Y=F.length;if(Y>0){var Q=(a&dB)!==0&&w===0?r:null;if(m){for(N=0;N<Y;N+=1)(f=F[N].a)==null||f.measure();for(N=0;N<Y;N+=1)(h=F[N].a)==null||h.fix()}hK(e,F,Q,b)}}m&&yd(()=>{var ie;if(A!==void 0)for(D of A)(ie=D.a)==null||ie.apply()}),lr.first=e.first&&e.first.e,lr.last=P&&P.e}function gK(t,e,r,n){(n&Dx)!==0&&vT(t.v,e),(n&Ox)!==0?vT(t.i,r):t.i=r}function yK(t,e,r,n,a,i,o,c,u,d){var f=(u&Dx)!==0,h=(u&iW)===0,m=f?h?qb(a):ai(a):a,_=(u&Ox)===0?o:ai(o),w={i:_,v:m,k:i,a:null,e:null,prev:r,next:n};try{return w.e=ps(()=>c(t,m,_),jx),w.e.prev=r&&r.e,w.e.next=n&&n.e,r===null?e.first=w:(r.next=w,r.e.next=w.e),n!==null&&(n.prev=w,n.e.prev=w.e),w}finally{}}function PO(t,e,r){for(var n=t.next?t.next.e.nodes_start:r,a=e?e.e.nodes_start:r,i=t.e.nodes_start;i!==n;){var o=zb(i);a.before(i),i=o}}function xl(t,e,r){e===null?t.first=r:(e.next=r,e.e.next=r&&r.e),r!==null&&(r.prev=e,r.e.prev=e&&e.e)}function du(t,e,r,n,a){var i=t,o="",c;uu(()=>{o!==(o=e()??"")&&(c!==void 0&&(ys(c),c=void 0),o!==""&&(c=ps(()=>{var u=o+"",d=$x(u);od(id(d),d.lastChild),i.before(d)})))})}function Dn(t,e,...r){var n=t,a=Ar,i;uu(()=>{a!==(a=e())&&(i&&(ys(i),i=null),i=ps(()=>a(n,...r)))},lu)}function vK(t,e,r){var n=t,a,i;uu(()=>{a!==(a=e())&&(i&&(sd(i),i=null),a&&(i=ps(()=>r(n,a))))},lu)}function L_(t,e,r,n,a,i){var o,c,u=null,d=t,f;uu(()=>{const h=e()||null;var m=h==="svg"?Rm:null;h!==o&&(f&&(h===null?sd(f,()=>{f=null,c=null}):h===c?Dm(f):(ys(f),xO(!1))),h&&h!==c&&(f=ps(()=>{if(u=m?document.createElementNS(m,h):document.createElement(h),od(u,u),n){var _=u.appendChild(Ag());n(u,_)}lr.nodes_end=u,d.before(u)})),o=h,o&&(c=o),xO(!0))},lu)}function zt(t,e){yd(()=>{var r=t.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+e.hash)){const a=document.createElement("style");a.id=e.hash,a.textContent=e.code,n.appendChild(a)}})}function HB(t){var e,r,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;e<a;e++)t[e]&&(r=HB(t[e]))&&(n&&(n+=" "),n+=r)}else for(r in t)t[r]&&(n&&(n+=" "),n+=r);return n}function _K(){for(var t,e,r=0,n="",a=arguments.length;r<a;r++)(t=arguments[r])&&(e=HB(t))&&(n&&(n+=" "),n+=e);return n}function GB(t){return typeof t=="object"?_K(t):t??""}function bK(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function Ut(t,e,r,n){var a=t.__attributes??(t.__attributes={});a[e]!==(a[e]=r)&&(e==="style"&&"__styles"in t&&(t.__styles={}),e==="loading"&&(t[DW]=r),r==null?t.removeAttribute(e):typeof r!="string"&&WB(t).includes(e)?t[e]=r:t.setAttribute(e,r))}function B_(t,e,r,n,a=!1,i=!1,o=!1){var c=e||{},u=t.tagName==="OPTION";for(var d in e)d in r||(r[d]=null);r.class&&(r.class=GB(r.class)),n!==void 0&&(r.class=r.class?r.class+" "+n:n);var f=WB(t),h=t.__attributes??(t.__attributes={});for(const T in r){let R=r[T];if(u&&T==="value"&&R==null){t.value=t.__value="",c[T]=R;continue}var m=c[T];if(R!==m){c[T]=R;var _=T[0]+T[1];if(_!=="$$"){if(_==="on"){const P={},A="$$"+T;let C=T.slice(2);var w=vW(C);if(gW(C)&&(C=C.slice(0,-7),P.capture=!0),!w&&m){if(R!=null)continue;t.removeEventListener(C,c[A],P),c[A]=null}if(R!=null)if(w)t[`__${C}`]=R,Hb([C]);else{let O=function(I){c[T].call(this,I)};c[A]=zx(C,t,O,P)}else w&&(t[`__${C}`]=void 0)}else if(T==="style"&&R!=null)t.style.cssText=R+"";else if(T==="autofocus")uK(t,!!R);else if(T==="__value"||T==="value"&&R!=null)t.value=t[T]=t.__value=R;else if(T==="selected"&&u)bK(t,R);else{var b=T;a||(b=bW(b));var E=b==="defaultValue"||b==="defaultChecked";if(R==null&&!i&&!E)if(h[T]=null,b==="value"||b==="checked"){let P=t;if(b==="value"){let A=P.defaultValue;P.removeAttribute(b),P.defaultValue=A}else{let A=P.defaultChecked;P.removeAttribute(b),P.defaultChecked=A}}else t.removeAttribute(T);else E||f.includes(b)&&(i||typeof R!="string")?t[b]=R:typeof R!="function"&&Ut(t,b,R)}T==="style"&&"__styles"in t&&(t.__styles={})}}}return c}var AO=new Map;function WB(t){var e=AO.get(t.nodeName);if(e)return e;AO.set(t.nodeName,e=[]);for(var r,n=t,a=Element.prototype;a!==n;){r=fB(n);for(var i in r)r[i].set&&e.push(i);n=Ix(n)}return e}function kK(t,e,r){var n=t.__className,a=KB(e,r);(n!==a||jx)&&(a===""?t.removeAttribute("class"):t.setAttribute("class",a),t.__className=a)}function Jl(t,e,r){var n=t.__className,a=KB(e,r);(n!==a||jx)&&(e==null&&!r?t.removeAttribute("class"):t.className=a,t.__className=a)}function KB(t,e){return(t??"")+(e?" "+e:"")}function jc(t,e,r){if(r){if(t.classList.contains(e))return;t.classList.add(e)}else{if(!t.classList.contains(e))return;t.classList.remove(e)}}const wK=()=>performance.now(),Tc={tick:(t=>requestAnimationFrame(t)),now:()=>wK(),tasks:new Set};function YB(){const t=Tc.now();Tc.tasks.forEach(e=>{e.c(t)||(Tc.tasks.delete(e),e.f())}),Tc.tasks.size!==0&&Tc.tick(YB)}function SK(t){let e;return Tc.tasks.size===0&&Tc.tick(YB),{promise:new Promise(r=>{Tc.tasks.add(e={c:t,f:r})}),abort(){Tc.tasks.delete(e)}}}function iv(t,e){t.dispatchEvent(new CustomEvent(e))}function EK(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function RO(t){const e={},r=t.split(";");for(const n of r){const[a,i]=n.split(":");if(!a||i===void 0)break;const o=EK(a.trim());e[o]=i.trim()}return e}const TK=t=>t;function XB(t,e,r,n){var a=(t&dW)!==0,i=(t&fW)!==0,o=a&&i,c=(t&pW)!==0,u=o?"both":a?"in":"out",d,f=e.inert,h,m;function _(){var R=zr,P=lr;vs(null),mi(null);try{return d??(d=r()(e,n?.()??{},{direction:u}))}finally{vs(R),mi(P)}}var w={is_global:c,in(){var R;if(e.inert=f,!a){m?.abort(),(R=m?.reset)==null||R.call(m);return}i||h==null||h.abort(),iv(e,"introstart"),h=TT(e,_(),m,1,()=>{iv(e,"introend"),h?.abort(),h=d=void 0})},out(R){if(!i){R?.(),d=void 0;return}e.inert=!0,iv(e,"outrostart"),m=TT(e,_(),h,0,()=>{iv(e,"outroend"),R?.()})},stop:()=>{h?.abort(),m?.abort()}},b=lr;if((b.transitions??(b.transitions=[])).push(w),a&&j_){var E=c;if(!E){for(var T=b.parent;T&&(T.f&lu)!==0;)for(;(T=T.parent)&&(T.f&Fb)===0;);E=!T||(T.f&hB)!==0}E&&$b(()=>{Wo(()=>w.in())})}}function TT(t,e,r,n,a){var i=n===1;if(gf(e)){var o,c=!1;return yd(()=>{if(!c){var E=e({direction:i?"in":"out"});o=TT(t,E,r,n,a)}}),{abort:()=>{c=!0,o?.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(r?.deactivate(),!(e!=null&&e.duration))return a(),{abort:Ar,deactivate:Ar,reset:Ar,t:()=>n};const{delay:u=0,css:d,tick:f,easing:h=TK}=e;var m=[];if(i&&r===void 0&&(f&&f(0,1),d)){var _=RO(d(0,1));m.push(_,_)}var w=()=>1-n,b=t.animate(m,{duration:u});return b.onfinish=()=>{var E=r?.t()??1-n;r?.abort();var T=n-E,R=e.duration*Math.abs(T),P=[];if(R>0){if(d)for(var A=Math.ceil(R/16.666666666666668),C=0;C<=A;C+=1){var O=E+T*h(C/A),I=d(O,1-O);P.push(RO(I))}w=()=>{var x=b.currentTime;return E+T*h(x/R)},f&&SK(()=>{if(b.playState!=="running")return!1;var x=w();return f(x,1-x),!0})}b=t.animate(P,{duration:R,fill:"forwards"}),b.onfinish=()=>{w=()=>n,f?.(n,1-n),a()}},{abort:()=>{b&&(b.cancel(),b.effect=null,b.onfinish=Ar)},deactivate:()=>{a=Ar},reset:()=>{n===0&&f?.(1,0)},t:()=>w()}}function DO(t,e){return t===e||t?.[Ul]===e}function JB(t={},e,r,n){return $b(()=>{var a,i;return Rg(()=>{a=i,i=[],Wo(()=>{t!==r(...i)&&(e(t,...i),a&&DO(r(...a),t)&&e(null,...a))})}),()=>{yd(()=>{i&&DO(r(...i),t)&&e(null,...i)})}}),t}function ws(t=!1){const e=Dr,r=e.l.u;if(!r)return;let n=()=>Gv(e.s);if(t){let a=0,i={};const o=ze(()=>{let c=!1;const u=e.s;for(const d in u)u[d]!==i[d]&&(i[d]=u[d],c=!0);return c&&a++,a});n=()=>$(o)}r.b.length&&KW(()=>{OO(e,n),O_(r.b)}),ap(()=>{const a=Wo(()=>r.m.map(PW));return()=>{for(const i of a)typeof i=="function"&&i()}}),r.a.length&&ap(()=>{OO(e,n),O_(r.a)})}function OO(t,e){if(t.l.s)for(const r of t.l.s)$(r);e()}function QB(t,e){var r,n=(r=t.$$events)==null?void 0:r[e.type],a=Ub(n)?n.slice():n==null?[]:[n];for(var i of a)i.call(this,e)}function _s(t){Dr===null&&Ux(),Tp&&Dr.l!==null?CK(Dr).m.push(t):ap(()=>{const e=Wo(t);if(typeof e=="function")return e})}function Ng(t){Dr===null&&Ux(),_s(()=>()=>Wo(t))}function CK(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}function ZB(t,e,r){if(t==null)return e(void 0),r&&r(void 0),Ar;const n=Wo(()=>t.subscribe(e,r));return n.unsubscribe?()=>n.unsubscribe():n}let sv=!1;function ha(t,e,r){const n=r[e]??(r[e]={store:null,source:qb(void 0),unsubscribe:Ar});if(n.store!==t)if(n.unsubscribe(),n.store=t??null,t==null)n.source.v=void 0,n.unsubscribe=Ar;else{var a=!0;n.unsubscribe=ZB(t,i=>{a?n.source.v=i:pt(n.source,i)}),a=!1}return $(n.source)}function xK(t,e){return t.set(e),e}function Aa(){const t={};return xB(()=>{for(var e in t)t[e].unsubscribe()}),t}function PK(t){var e=sv;try{return sv=!1,[t(),sv]}finally{sv=e}}const AK={get(t,e){if(!t.exclude.includes(e))return t.props[e]},set(t,e){return!1},getOwnPropertyDescriptor(t,e){if(!t.exclude.includes(e)&&e in t.props)return{enumerable:!0,configurable:!0,value:t.props[e]}},has(t,e){return t.exclude.includes(e)?!1:e in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(e=>!t.exclude.includes(e))}};function fu(t,e,r){return new Proxy({props:t,exclude:e},AK)}const RK={get(t,e){let r=t.props.length;for(;r--;){let n=t.props[r];if(gf(n)&&(n=n()),typeof n=="object"&&n!==null&&e in n)return n[e]}},set(t,e,r){let n=t.props.length;for(;n--;){let a=t.props[n];gf(a)&&(a=a());const i=Bl(a,e);if(i&&i.set)return i.set(r),!0}return!1},getOwnPropertyDescriptor(t,e){let r=t.props.length;for(;r--;){let n=t.props[r];if(gf(n)&&(n=n()),typeof n=="object"&&n!==null&&e in n){const a=Bl(n,e);return a&&!a.configurable&&(a.configurable=!0),a}}},has(t,e){if(e===Ul||e===gB)return!1;for(let r of t.props)if(gf(r)&&(r=r()),r!=null&&e in r)return!0;return!1},ownKeys(t){const e=[];for(let r of t.props){gf(r)&&(r=r());for(const n in r)e.includes(n)||e.push(n)}return e}};function Fc(...t){return new Proxy({props:t},RK)}function NO(t){for(var e=lr,r=lr;e!==null&&(e.f&(ro|xg))===0;)e=e.parent;try{return mi(e),t()}finally{mi(r)}}function It(t,e,r,n){var a,i=(r&sW)!==0,o=!Tp||(r&oW)!==0,c=(r&lW)!==0,u=(r&uW)!==0,d=!1,f;c?[f,d]=PK(()=>t[e]):f=t[e];var h=Ul in t||gB in t,m=((a=Bl(t,e))==null?void 0:a.set)??(h&&c&&e in t?x=>t[e]=x:void 0),_=n,w=!0,b=!1,E=()=>(b=!0,w&&(w=!1,u?_=Wo(n):_=n),_);f===void 0&&n!==void 0&&(m&&o&&jW(),f=E(),m&&m(f));var T;if(o)T=()=>{var x=t[e];return x===void 0?E():(w=!0,b=!1,x)};else{var R=NO(()=>(i?ze:If)(()=>t[e]));R.f|=AW,T=()=>{var x=$(R);return x!==void 0&&(_=void 0),x===void 0?_:x}}if((r&cW)===0)return T;if(m){var P=t.$$legacy;return function(x,D){return arguments.length>0?((!o||!D||P||d)&&m(D?T():x),x):T()}}var A=!1,C=!1,O=qb(f),I=NO(()=>ze(()=>{var x=T(),D=$(O);return A?(A=!1,C=!0,D):(C=!1,O.v=x)}));return i||(I.equals=Mx),function(x,D){if(arguments.length>0){const N=D?$(I):o&&c?Vt(x):x;return I.equals(N)||(A=!0,pt(O,N),b&&_!==void 0&&(_=N),Wo(()=>$(I))),x}return $(I)}}function IO(t,e){var r=lr,n=zr,a=Dr;mi(t),vs(t),CO(t.ctx);try{e()}finally{mi(r),vs(n),CO(a)}}function DK(t,e,r){var n=t,a;uu(()=>{var i=lr,o=!1;i.fn=c=>{var u=e.onerror;let d=e.failed;if(!u&&!d||o)throw c;var f=()=>{sd(a),IO(i,()=>{o=!1,a=ps(()=>r(n)),$w()})};u?.(c,f),a&&ys(a),d&&yd(()=>{IO(i,()=>{o=!0;try{a=ps(()=>{d(n,()=>c,()=>f)})}catch(h){Dg(h,i,null,i.ctx)}$w(),o=!1})})},a=ps(()=>r(n)),$w()},lu|N_)}var Un=(t=>(t[t.UnknownError=0]="UnknownError",t[t.UserCancelledError=1]="UserCancelledError",t[t.StoreProblemError=2]="StoreProblemError",t[t.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",t[t.PurchaseInvalidError=4]="PurchaseInvalidError",t[t.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",t[t.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",t[t.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",t[t.InvalidReceiptError=8]="InvalidReceiptError",t[t.MissingReceiptFileError=9]="MissingReceiptFileError",t[t.NetworkError=10]="NetworkError",t[t.InvalidCredentialsError=11]="InvalidCredentialsError",t[t.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",t[t.InvalidAppUserIdError=14]="InvalidAppUserIdError",t[t.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",t[t.UnknownBackendError=16]="UnknownBackendError",t[t.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",t[t.IneligibleError=18]="IneligibleError",t[t.InsufficientPermissionsError=19]="InsufficientPermissionsError",t[t.PaymentPendingError=20]="PaymentPendingError",t[t.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",t[t.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",t[t.ConfigurationError=23]="ConfigurationError",t[t.UnsupportedError=24]="UnsupportedError",t[t.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",t[t.CustomerInfoError=28]="CustomerInfoError",t[t.SignatureVerificationError=36]="SignatureVerificationError",t[t.InvalidEmailError=38]="InvalidEmailError",t))(Un||{});class sm{static getPublicMessage(e){switch(e){case 0:return"Unknown error.";case 1:return"Purchase was cancelled.";case 2:return"There was a problem with the store.";case 3:return"The device or user is not allowed to make the purchase.";case 4:return"One or more of the arguments provided are invalid.";case 5:return"The product is not available for purchase.";case 6:return"This product is already active for the user.";case 7:return"There is already another active subscriber using the same receipt.";case 8:return"The receipt is not valid.";case 9:return"The receipt is missing.";case 10:return"Error performing request. Please check your network connection and try again.";case 11:return"There was a credentials issue. Check the underlying error for more details.";case 12:return"Received unexpected response from the backend.";case 14:return"The app user id is not valid.";case 15:return"The operation is already in progress.";case 16:return"There was an unknown backend error.";case 17:return"Apple Subscription Key is invalid or not present. In order to provide subscription offers, you must first generate a subscription key. Please see https://docs.revenuecat.com/docs/ios-subscription-offers for more info.";case 18:return"The User is ineligible for that action.";case 19:return"App does not have sufficient permissions to make purchases.";case 20:return"The payment is pending.";case 21:return"One or more of the attributes sent could not be saved.";case 22:return"Called logOut but the current user is anonymous.";case 23:return"There is an issue with your configuration. Check the underlying error for more details.";case 24:return"There was a problem with the operation. Looks like we doesn't support that yet. Check the underlying error for more details.";case 25:return"A request for subscriber attributes returned none.";case 28:return"There was a problem related to the customer info.";case 36:return"Request failed signature verification. Please see https://rev.cat/trusted-entitlements for more info.";case 38:return"Email is not valid. Please provide a valid email address."}}static getErrorCodeForBackendErrorCode(e){switch(e){case 7101:case 7773:case 7898:case 7899:case 7900:case 7901:return 2;case 7102:return 7;case 7103:return 8;case 7107:case 7224:case 7225:return 11;case 7105:case 7106:case 7814:case 7877:case 7878:return 4;case 7772:return 6;case 7220:return 14;case 7259:return 28;case 7229:return 2;case 7230:case 7e3:return 23;case 7231:return 2;case 7232:return 18;case 7263:case 7264:return 21;case 7104:case 7234:case 7226:case 7110:return 12;case 7662:return 24;case 7012:case 7834:case 7879:return 38}}static convertCodeToBackendErrorCode(e){return e in om?e:null}static convertPurchaseFlowErrorCodeToErrorCode(e){switch(e){case Hr.ErrorSettingUpPurchase:return 2;case Hr.ErrorChargingPayment:return 20;case Hr.NetworkError:return 10;case Hr.MissingEmailError:return 4;case Hr.AlreadyPurchasedError:return 6;default:return 0}}}var om=(t=>(t[t.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",t[t.BackendInvalidEmail=7012]="BackendInvalidEmail",t[t.BackendStoreProblem=7101]="BackendStoreProblem",t[t.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",t[t.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",t[t.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",t[t.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",t[t.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",t[t.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",t[t.BackendInternalServerError=7110]="BackendInternalServerError",t[t.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",t[t.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",t[t.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",t[t.BackendBadRequest=7226]="BackendBadRequest",t[t.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",t[t.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",t[t.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",t[t.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",t[t.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",t[t.BackendSubscriberNotFound=7259]="BackendSubscriberNotFound",t[t.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",t[t.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",t[t.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",t[t.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",t[t.BackendPaymentGatewayGenericError=7773]="BackendPaymentGatewayGenericError",t[t.BackendOfferNotFound=7814]="BackendOfferNotFound",t[t.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",t[t.BackendInvalidOperationSession=7877]="BackendInvalidOperationSession",t[t.BackendPurchaseCannotBeCompleted=7878]="BackendPurchaseCannotBeCompleted",t[t.BackendEmailIsRequired=7879]="BackendEmailIsRequired",t[t.BackendGatewaySetupErrorStripeTaxNotActive=7898]="BackendGatewaySetupErrorStripeTaxNotActive",t[t.BackendGatewaySetupErrorInvalidTaxOriginAddress=7899]="BackendGatewaySetupErrorInvalidTaxOriginAddress",t[t.BackendGatewaySetupErrorMissingRequiredPermission=7900]="BackendGatewaySetupErrorMissingRequiredPermission",t[t.BackendGatewaySetupErrorSandboxModeOnly=7901]="BackendGatewaySetupErrorSandboxModeOnly",t))(om||{});class bn extends Error{constructor(e,r,n,a){super(r),vt(this,"toString",()=>`PurchasesError(code: ${Un[this.errorCode]}, message: ${this.message})`),this.errorCode=e,this.underlyingErrorMessage=n,this.extra=a}static getForBackendError(e,r){const n=sm.getErrorCodeForBackendErrorCode(e);return new bn(n,sm.getPublicMessage(n),r,{backendErrorCode:e})}static getForPurchasesFlowError(e){return new bn(sm.convertPurchaseFlowErrorCodeToErrorCode(e.errorCode),e.message,e.underlyingErrorMessage)}}class OK extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Hh=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Hh||{}),yf=(t=>(t[t.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",t[t.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",t[t.PaymentChargeFailed=3]="PaymentChargeFailed",t[t.SetupIntentCompletionFailed=4]="SetupIntentCompletionFailed",t[t.AlreadyPurchased=5]="AlreadyPurchased",t))(yf||{}),Oi=(t=>(t[t.Silent=0]="Silent",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug",t[t.Verbose=5]="Verbose",t))(Oi||{});class tr{static setLogLevel(e){this.logLevel=e}static setLogHandler(e){this.logHandler=e}static log(e,r=this.logLevel){const n=`[Purchases] ${e}`;if(!(this.logLevel<r||r===Oi.Silent)){if(this.logHandler!==null){this.logHandler(r,n);return}switch(r){case Oi.Error:break;case Oi.Warn:break;case Oi.Info:break;case Oi.Debug:break;case Oi.Verbose:break}}}static errorLog(e){this.log(e,Oi.Error)}static warnLog(e){this.log(e,Oi.Warn)}static infoLog(e){this.log(e,Oi.Info)}static debugLog(e){this.log(e,Oi.Debug)}static verboseLog(e){this.log(e,Oi.Verbose)}}vt(tr,"logLevel",Oi.Silent),vt(tr,"logHandler",null);function NK(t){var e;return t.operation.redemption_info?{redeemUrl:((e=t.operation.redemption_info)==null?void 0:e.redeem_url)??null}:null}var Hr=(t=>(t[t.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",t[t.ErrorChargingPayment=1]="ErrorChargingPayment",t[t.UnknownError=2]="UnknownError",t[t.NetworkError=3]="NetworkError",t[t.MissingEmailError=4]="MissingEmailError",t[t.AlreadyPurchasedError=5]="AlreadyPurchasedError",t[t.StripeTaxNotActive=6]="StripeTaxNotActive",t[t.StripeInvalidTaxOriginAddress=7]="StripeInvalidTaxOriginAddress",t[t.StripeMissingRequiredPermission=8]="StripeMissingRequiredPermission",t))(Hr||{});class on extends Error{constructor(e,r,n,a,i){super(r),this.errorCode=e,this.underlyingErrorMessage=n,this.purchasesErrorCode=a,this.extra=i}getErrorCode(){var e;return((e=this.extra)==null?void 0:e.backendErrorCode)??this.purchasesErrorCode??this.errorCode}static fromPurchasesError(e,r){var n;let a;return e.errorCode===Un.ProductAlreadyPurchasedError?a=5:e.errorCode===Un.InvalidEmailError?a=4:e.errorCode===Un.NetworkError?a=3:a=on.fromBackendErrorCode((n=e.extra)==null?void 0:n.backendErrorCode)??r,new on(a,e.message,e.underlyingErrorMessage,e.errorCode,e.extra)}static fromBackendErrorCode(e){switch(e){case om.BackendGatewaySetupErrorStripeTaxNotActive:return 6;case om.BackendGatewaySetupErrorInvalidTaxOriginAddress:return 7;case om.BackendGatewaySetupErrorMissingRequiredPermission:return 8;default:return null}}}class IK{constructor(e,r,n=10){vt(this,"operationSessionId",null),vt(this,"backend"),vt(this,"eventsTracker"),vt(this,"maxNumberAttempts"),vt(this,"waitMSBetweenAttempts",1e3),this.backend=e,this.eventsTracker=r,this.maxNumberAttempts=n}async checkoutStart(e,r,n,a,i,o){try{const c=this.eventsTracker.getTraceId(),u=await this.backend.postCheckoutStart(e,r,a,n,c,i,o);return this.operationSessionId=u.operation_session_id,u}catch(c){if(c instanceof bn)throw on.fromPurchasesError(c,0);{const u="Unknown error starting purchase: "+String(c);throw tr.errorLog(u),new on(2,u)}}}async checkoutCalculateTax(e,r,n){const a=this.operationSessionId;if(!a)throw new on(0,"No purchase started");try{return await this.backend.postCheckoutCalculateTax(a,e,r,n)}catch(i){if(i instanceof bn)throw on.fromPurchasesError(i,0);{const o="Unknown error calculating tax: "+String(i);throw tr.errorLog(o),new on(2,o)}}}async checkoutComplete(e){const r=this.operationSessionId;if(!r)throw new on(0,"No purchase started");try{return await this.backend.postCheckoutComplete(r,e)}catch(n){if(n instanceof bn)throw on.fromPurchasesError(n,0);{const a="Unknown error starting purchase: "+String(n);throw tr.errorLog(a),new on(2,a)}}}async pollCurrentPurchaseForCompletion(){const e=this.operationSessionId;if(!e)throw new on(0,"No purchase in progress");return new Promise((r,n)=>{const a=(i=1)=>{if(i>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new on(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(e).then(o=>{const c=o.operation.store_transaction_identifier,u=o.operation.product_identifier,d=o.operation.purchase_date?isNaN(Date.parse(o.operation.purchase_date))?null:new Date(o.operation.purchase_date):null;switch(o.operation.status){case Hh.Started:case Hh.InProgress:setTimeout(()=>a(i+1),this.waitMSBetweenAttempts);break;case Hh.Succeeded:if(this.clearPurchaseInProgress(),!c||!u||!d){n(new on(2,"Missing required fields in operation response."));return}r({redemptionInfo:NK(o),operationSessionId:e,storeTransactionIdentifier:c,productIdentifier:u,purchaseDate:d});return;case Hh.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(o.operation.error,n)}}).catch(o=>{const c=on.fromPurchasesError(o,3);n(c)})};a()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(e,r){if(e==null){r(new on(2,"Got an error status but error field is empty."));return}switch(e.code){case yf.SetupIntentCreationFailed:r(new on(0,"Setup intent creation failed"));return;case yf.PaymentMethodCreationFailed:r(new on(0,"Payment method creation failed"));return;case yf.PaymentChargeFailed:r(new on(1,"Payment charge failed"));return;case yf.SetupIntentCompletionFailed:r(new on(0,"Setup intent completion failed"));return;case yf.AlreadyPurchased:r(new on(5,"Purchased was already completed"));return;default:r(new on(2,"Unknown error code received"));return}}}const Bi="rcb-ui-translator",Lf="en",MK={"periods.week":"{{amount}} week","periods.month":"{{amount}} month","periods.year":"{{amount}} year","periods.day":"{{amount}} day","periods.weekShort":"{{amount}}wk","periods.monthShort":"{{amount}}mo","periods.yearShort":"{{amount}}yr","periods.dayShort":"{{amount}}d","periods.lifetime":"lifetime","periods.weekPlural":"{{amount}} weeks","periods.monthPlural":"{{amount}} months","periods.yearPlural":"{{amount}} years","periods.dayPlural":"{{amount}} days","periods.weekFrequency":"weekly","periods.monthFrequency":"monthly","periods.yearFrequency":"yearly","periods.dayFrequency":"daily","periods.perWeekFrequency":"per week","periods.perMonthFrequency":"per month","periods.perYearFrequency":"per year","periods.perDayFrequency":"per day","periods.unknownFrequency":"unknown","periods.weekFrequencyPlural":"every {{amount}} weeks","periods.monthFrequencyPlural":"every {{amount}} months","periods.yearFrequencyPlural":"every {{amount}} years","periods.dayFrequencyPlural":"every {{amount}} days","product_info.subscribe_to":"Subscribe to","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"Try free for {{trialDuration}}","product_info.price_after_free_trial":"After trial ends, on {{renewalDate}}","product_info.intro_price_phase_after_trial":"Then {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase":"First {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase_paid_once":"paid once","product_info.price_after_intro_price":"After {{introPriceDuration}}, on {{renewalDate}}","product_info.after_trial":"after trial","product_info.after":"after","product_info.total_due_today":"Total due today","product_info.renewal_frequency":"Renews {{frequency}}","product_info.continues_until_cancelled":"Continues until cancelled","product_info.cancel_anytime":"Cancel anytime","payment_entry_page.payment_step_title":"Secure checkout by RevenueCat","payment_entry_page.trial_subscription_terms_info":"After your trial ends, you will be charged {{price}} {{perFrequency}} starting {{renewalDate}}. You can cancel any time before this date.","payment_entry_page.subscription_terms_info":"By subscribing, you agree to allow {{appName}} to charge you according to their terms until you cancel.","payment_entry_page.otp_terms_info":"By purchasing, you agree to allow {{appName}} to charge you according to their terms.","payment_entry_page.subscription_info":"Subscription renews automatically. Cancel anytime.","payment_entry_page.button_pay":"Pay now","payment_entry_page.button_start_trial":"Start trial","payment_entry_page.button_with_price":"Pay {{formattedPrice}}","payment_entry_page.button_payment_method":"Pay {{formattedPrice}} with {{paymentMethod}}","payment_entry_page.express_checkout_divider":"OR PAY BY CARD","success_page.purchase_successful":"Payment complete","success_page.button_close":"Continue","error_page.close_button_title":"Go to {{appName}}","error_page.if_error_persists":"If it persists, please contact ","error_page.trouble_accessing":"If you're having trouble accessing your purchase, reach out to support on ","error_page.error_title_already_subscribed":"You already subscribed to {{productTitle}}","error_page.error_title_already_purchased":"You already purchased {{productTitle}}","error_page.error_title_other_errors":"Something went wrong","error_page.error_message_already_subscribed":"You can't subscribe to this product again.","error_page.error_message_already_purchased":"You can't purchase this product again.","error_page.error_title_stripe_tax_not_active":"Stripe Tax not active","error_page.error_title_stripe_invalid_tax_origin_address":"Invalid tax origin address","error_page.error_title_stripe_missing_required_permission":"Missing Stripe permission","error_page.error_message_missing_email_error":"Email is required to complete the purchase.","error_page.error_message_invalid_email_error":"The email address {{email}} couldn't be verified. Please provide a valid email address.","error_page.error_message_network_error":"Network error. Please check your internet connection.","error_page.error_message_error_charging_payment":"Payment failed.","error_page.error_message_error_setting_up_purchase":"Purchase not started due to an error (error code: {{errorCode}}).","error_page.error_message_invalid_tax_location":"We couldn't verify your billing address. Please double-check that the postal code and country are correct.","error_page.error_message_unknown_error":"An unknown error occurred (error code: {{errorCode}}).","error_page.error_message_stripe_tax_not_active":"The purchase failed because Stripe Tax isn’t enabled. In production, purchases will work without taxes applied.","error_page.error_message_stripe_invalid_tax_origin_address":"The purchase failed because the tax origin address is invalid. In production, purchases will work without taxes applied.","error_page.error_message_stripe_missing_required_permission":"The purchase failed because the Stripe app lacks a required permission. In production, purchases will work without taxes applied.","error_page.error_only_in_sandbox":"This message appears only in sandbox.","error_page.button_try_again":"Try again","error_page.button_close":"Close","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% off","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","pricing_dropdown.show_details":"Show details","pricing_dropdown.hide_details":"Hide details","pricing_table.trial_ends":"After trial ends, on {{formattedTrialEndDate}}","pricing_table.total_excluding_tax":"Total excluding tax","pricing_table.total_due_today":"Total due today","pricing_table.tax":"Tax","pricing_table.enter_billing_address_to_calculate":"Enter billing address to calculate","pricing_table.enter_postal_code_to_calculate":"Enter zip code to calculate","pricing_table.enter_state_or_postal_code_to_calculate":"Enter state or postal code to calculate","navbar_header.details":"Details","navbar_header.back_button":"Back","price_update.title":"Price update","price_update.base_message":"The total price was updated with tax based on your billing address. Please review and try again. Your card will only be charged once.","price_update.trial_message":"The subscription price was updated to include tax based on your billing address. Free trial still applies. Review and try again.","apple_pay.free_trial":"Free Trial"},jK={"periods.week":"{{amount}} semana","periods.month":"{{amount}} mes","periods.year":"{{amount}} año","periods.day":"{{amount}} día","periods.weekShort":"{{amount}} sem","periods.monthShort":"{{amount}}mes","periods.yearShort":"{{amount}}año","periods.dayShort":"{{amount}}d","periods.lifetime":"de por vida","periods.weekPlural":"{{amount}} semanas","periods.monthPlural":"{{amount}} meses","periods.yearPlural":"{{amount}} años","periods.dayPlural":"{{amount}} días","periods.weekFrequency":"semanal","periods.monthFrequency":"mensual","periods.yearFrequency":"anual","periods.dayFrequency":"diaria","periods.perWeekFrequency":"por semana","periods.perMonthFrequency":"por mes","periods.perYearFrequency":"por año","periods.perDayFrequency":"por día","periods.unknownFrequency":"desconocida","periods.weekFrequencyPlural":"cada {{amount}} semanas","periods.monthFrequencyPlural":"cada {{amount}} meses","periods.yearFrequencyPlural":"cada {{amount}} años","periods.dayFrequencyPlural":"cada {{amount}} días","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} prueba gratuita","product_info.price_after_free_trial":"Después de que termine el periodo de prueba, el {{renewalDate}}","product_info.renewal_frequency":"Se renueva {{frequency}}","product_info.continues_until_cancelled":"Continua hasta que se cancele","product_info.cancel_anytime":"Cancelar en cualquier momento","payment_entry_page.payment_step_title":"Pago seguro mediante RevenueCat","payment_entry_page.button_pay":"Pagar ahora","payment_entry_page.button_start_trial":"Comenzar prueba","success_page.purchase_successful":"Pago completado","success_page.button_close":"Continuar","error_page.if_error_persists":"Si el error persiste, contacta con ","error_page.error_title_already_subscribed":"Ya te has suscrito a {{productTitle}}","error_page.error_title_already_purchased":"Ya has comprado {{productTitle}}","error_page.error_title_other_errors":"Algo salió mal","error_page.error_message_already_subscribed":"No puedes suscribirte a este producto de nuevo.","error_page.error_message_already_purchased":"No puedes comprar este producto de nuevo.","error_page.error_message_missing_email_error":"Se requiere un correo electrónico para completar la compra.","error_page.error_message_network_error":"Error de red. Por favor, comprueba tu conexión a internet.","error_page.error_message_error_charging_payment":"Pago fallido.","error_page.error_message_error_setting_up_purchase":"No se pudo iniciar la compra debido a un error (código de error: {{errorCode}}).","error_page.error_message_invalid_tax_location":"No pudimos verificar tu dirección de facturación. Por favor, verifica que el código postal y el país sean correctos.","error_page.error_message_unknown_error":"Ocurrió un error desconocido (código de error: {{errorCode}}).","error_page.button_try_again":"Intentar de nuevo","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% de descuento","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total a pagar hoy","product_info.subscribe_to":"Suscribirse a","navbar_header.details":"Detalles","navbar_header.back_button":"Atrás","pricing_dropdown.show_details":"Mostrar detalles","pricing_dropdown.hide_details":"Ocultar detalles","pricing_table.tax":"Impuestos","pricing_table.trial_ends":"Después de que finalice la prueba, el {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total a pagar hoy","pricing_table.total_excluding_tax":"Total sin impuestos","pricing_table.enter_billing_address_to_calculate":"Introduce la dirección de facturación para calcular","pricing_table.enter_state_or_postal_code_to_calculate":"Introduce el estado o el código postal para calcular","pricing_table.enter_postal_code_to_calculate":"Introduce el código postal para calcular","error_page.error_message_invalid_email_error":"La dirección de correo electrónico {{email}} no se pudo verificar. Por favor, proporciona una dirección de correo electrónico válida.","payment_entry_page.button_payment_method":"Pagar {{formattedPrice}} con {{paymentMethod}}","payment_entry_page.button_with_price":"Pagar {{formattedPrice}}","price_update.title":"Actualización de precio","price_update.base_message":"El precio total se actualizó con impuestos según su dirección de facturación. Revise e intente nuevamente. Solo se efectuará un cobro en su tarjeta.","price_update.trial_message":"El precio de la suscripción se actualizó para incluir impuestos según su dirección de facturación. La prueba gratuita sigue aplicándose. Revise e intente nuevamente.","payment_entry_page.express_checkout_divider":"O PAGA CON TARJETA","error_page.trouble_accessing":"Si tiene problemas para acceder a su compra, póngase en contacto con el servicio de asistencia en ","error_page.close_button_title":"Ir a {{appName}}","error_page.error_title_stripe_missing_required_permission":"Falta permiso de Stripe","error_page.button_close":"Cerrar","error_page.error_message_stripe_invalid_tax_origin_address":"La compra falló porque la dirección de origen fiscal no es válida. En producción, las compras funcionarán sin impuestos aplicados.","error_page.error_message_stripe_tax_not_active":"La compra falló porque Stripe Tax no está habilitado. En producción, las compras funcionarán sin impuestos aplicados.","error_page.error_only_in_sandbox":"Este mensaje aparece solo en el entorno de pruebas.","error_page.error_message_stripe_missing_required_permission":"La compra falló porque la aplicación Stripe carece de un permiso necesario. En producción, las compras funcionarán sin impuestos aplicados.","error_page.error_title_stripe_tax_not_active":"Stripe Tax no está activo","error_page.error_title_stripe_invalid_tax_origin_address":"Dirección de origen fiscal no válida","apple_pay.free_trial":"Prueba gratuita","product_info.price_after_intro_price":"Después de {{introPriceDuration}}, el {{renewalDate}}","product_info.after_trial":"después del período de prueba","product_info.after":"después de","product_info.intro_price_phase_after_trial":"Luego, {{introPriceDuration}} por {{introPrice}}","product_info.intro_price_phase":"Primero, {{introPriceDuration}} por {{introPrice}}","product_info.intro_price_phase_paid_once":"pago único","payment_entry_page.trial_subscription_terms_info":"Una vez finalizado el período de prueba, se te cobrarán {{price}} {{perFrequency}} a partir del {{renewalDate}}. Puedes cancelar en cualquier momento antes de esta fecha.","payment_entry_page.subscription_info":"La suscripción se renueva automáticamente. Cancela en cualquier momento.","payment_entry_page.otp_terms_info":"Al comprar, aceptas que {{appName}} te cobre de acuerdo con sus términos.","payment_entry_page.subscription_terms_info":"Al suscribirte, aceptas que {{appName}} te cobre de acuerdo con sus términos hasta que canceles."},LK={"periods.week":"{{amount}} settimana","periods.month":"{{amount}} mese","periods.year":"{{amount}} anno","periods.day":"{{amount}} giorno","periods.weekShort":"{{amount}}sett","periods.monthShort":"{{amount}}mese","periods.yearShort":"{{amount}}anno","periods.dayShort":"{{amount}}g","periods.lifetime":"a vita","periods.weekPlural":"{{amount}} settimane","periods.monthPlural":"{{amount}} mesi","periods.yearPlural":"{{amount}} anni","periods.dayPlural":"{{amount}} giorni","periods.weekFrequency":"settimanale","periods.monthFrequency":"mensile","periods.yearFrequency":"annuale","periods.dayFrequency":"giornaliero","periods.perWeekFrequency":"a settimana","periods.perMonthFrequency":"al mese","periods.perYearFrequency":"all'anno","periods.perDayFrequency":"al giorno","periods.unknownFrequency":"sconosciuto","periods.weekFrequencyPlural":"ogni {{amount}} settimane","periods.monthFrequencyPlural":"ogni {{amount}} mesi","periods.yearFrequencyPlural":"ogni {{amount}} anni","periods.dayFrequencyPlural":"ogni {{amount}} giorni","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} prova gratuita","product_info.price_after_free_trial":"Dopo la fine della prova, il {{renewalDate}}","product_info.renewal_frequency":"Si rinnova {{frequency}}","product_info.continues_until_cancelled":"Continua fino a disdetta","product_info.cancel_anytime":"Disdici in qualsiasi momento","payment_entry_page.payment_step_title":"Pagamento sicuro tramite RevenueCat","payment_entry_page.button_pay":"Paga ora","payment_entry_page.button_start_trial":"Inizia la prova","success_page.purchase_successful":"Pagamento completato","success_page.button_close":"Continua","error_page.if_error_persists":"Se l'errore persiste, contatta ","error_page.error_title_already_subscribed":"Hai già un abbonamento a {{productTitle}}","error_page.error_title_already_purchased":"Hai già acquistato {{productTitle}}","error_page.error_title_other_errors":"Qualcosa è andato storto","error_page.error_message_already_subscribed":"Non puoi abbonarti di nuovo a questo prodotto.","error_page.error_message_already_purchased":"Non puoi acquistare di nuovo questo prodotto.","error_page.error_message_missing_email_error":"L'email è necessaria per completare l'acquisto.","error_page.error_message_network_error":"Errore di rete. Verifica la connessione internet.","error_page.error_message_error_charging_payment":"Pagamento fallito.","error_page.error_message_error_setting_up_purchase":"Acquisto non avviato a causa di un errore (codice errore: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Non siamo riusciti a verificare il tuo indirizzo di fatturazione. Per favore, controlla che il codice postale e il paese siano corretti.","error_page.error_message_unknown_error":"Si è verificato un errore sconosciuto (codice errore: {{errorCode}}).","error_page.button_try_again":"Riprova","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% di sconto","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Totale dovuto oggi","product_info.subscribe_to":"Abbonati a","navbar_header.details":"Dettagli","navbar_header.back_button":"Indietro","pricing_dropdown.show_details":"Mostra dettagli","pricing_dropdown.hide_details":"Nascondi dettagli","pricing_table.tax":"Tasse","pricing_table.trial_ends":"Al termine del periodo di prova, il {{formattedTrialEndDate}}","pricing_table.total_due_today":"Totale dovuto oggi","pricing_table.total_excluding_tax":"Totale tasse escluse","pricing_table.enter_billing_address_to_calculate":"Inserisci l'indirizzo di fatturazione per calcolare","pricing_table.enter_state_or_postal_code_to_calculate":"Inserisci la regione o il codice postale per calcolare","pricing_table.enter_postal_code_to_calculate":"Inserisci il codice postale per calcolare","error_page.error_message_invalid_email_error":"L'indirizzo email {{email}} non può essere verificato. Si prega di fornire un indirizzo email valido.","payment_entry_page.button_payment_method":"Paga {{formattedPrice}} con {{paymentMethod}}","payment_entry_page.button_with_price":"Paga {{formattedPrice}}","price_update.title":"Aggiornamento prezzo","price_update.base_message":"Il prezzo totale è stato aggiornato con le tasse in base al tuo indirizzo di fatturazione. Rivedi e riprova. L'addebito sulla tua carta avverrà solo una volta.","price_update.trial_message":"Il prezzo dell'abbonamento è stato aggiornato per includere le tasse in base al tuo indirizzo di fatturazione. La prova gratuita è ancora valida. Controlla e riprova.","payment_entry_page.express_checkout_divider":"OPPURE PAGA CON CARTA","error_page.trouble_accessing":"Se hai problemi ad accedere al tuo acquisto, contatta l'assistenza all'indirizzo ","error_page.close_button_title":"Vai a {{appName}}","error_page.error_title_stripe_missing_required_permission":"Autorizzazione Stripe mancante","error_page.button_close":"Chiudi","error_page.error_message_stripe_invalid_tax_origin_address":"L'acquisto non è andato a buon fine perché l'indirizzo di origine fiscale non è valido. In produzione, gli acquisti verranno effettuati senza l'applicazione delle imposte e questo errore non sarà visibile.","error_page.error_message_stripe_tax_not_active":"L'acquisto non è andato a buon fine perché Stripe Tax non è abilitato. In produzione, gli acquisti verranno effettuati senza l'applicazione delle imposte e questo errore non sarà visibile.","error_page.error_only_in_sandbox":"Questo messaggio viene visualizzato solo in sandbox.","error_page.error_message_stripe_missing_required_permission":"L'acquisto non è andato a buon fine perché l'app Stripe non dispone dell'autorizzazione necessaria. In produzione, gli acquisti verranno effettuati senza l'applicazione delle imposte e questo errore non sarà visibile.","error_page.error_title_stripe_tax_not_active":"Stripe Tax non attivo","error_page.error_title_stripe_invalid_tax_origin_address":"Indirizzo di origine fiscale non valido","apple_pay.free_trial":"Prova gratuita","product_info.price_after_intro_price":"Dopo {{introPriceDuration}}, il {{renewalDate}}","product_info.after_trial":"dopo il periodo di prova","product_info.after":"dopo","product_info.intro_price_phase_after_trial":"Poi {{introPriceDuration}} a {{introPrice}}","product_info.intro_price_phase":"Prima {{introPriceDuration}} a {{introPrice}}","product_info.intro_price_phase_paid_once":"pagato una volta","payment_entry_page.trial_subscription_terms_info":"Al termine del periodo di prova, ti verranno addebitati {{price}} {{perFrequency}} a partire dal {{renewalDate}}. Puoi annullare in qualsiasi momento prima di questa data.","payment_entry_page.subscription_info":"L'abbonamento si rinnova automaticamente. Annulla in qualsiasi momento.","payment_entry_page.otp_terms_info":"Acquistando, accetti che {{appName}} ti addebiti l'importo in base ai suoi termini.","payment_entry_page.subscription_terms_info":"Abbonandoti, accetti che {{appName}} ti addebiti l'importo secondo i suoi termini fino all'annullamento."},BK={"periods.week":"{{amount}} أسبوع","periods.month":"{{amount}} شهر","periods.year":"{{amount}} سنة","periods.day":"{{amount}} يوم","periods.weekShort":"{{amount}}أسبوع","periods.monthShort":"{{amount}}شهر","periods.yearShort":"{{amount}}سنة","periods.dayShort":"{{amount}}يوم","periods.lifetime":"مدى الحياة","periods.weekPlural":"{{amount}} أسابيع","periods.monthPlural":"{{amount}} أشهر","periods.yearPlural":"{{amount}} سنوات","periods.dayPlural":"{{amount}} أيام","periods.weekFrequency":"أسبوعيًا","periods.monthFrequency":"شهريًا","periods.yearFrequency":"سنويًا","periods.dayFrequency":"يوميًا","periods.perWeekFrequency":"في الأسبوع","periods.perMonthFrequency":"في الشهر","periods.perYearFrequency":"في السنة","periods.perDayFrequency":"في اليوم","periods.unknownFrequency":"غير معروف","periods.weekFrequencyPlural":"كل {{amount}} أسابيع","periods.monthFrequencyPlural":"كل {{amount}} أشهر","periods.yearFrequencyPlural":"كل {{amount}} سنوات","periods.dayFrequencyPlural":"كل {{amount}} أيام","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} تجربة مجانية","product_info.price_after_free_trial":"بعد انتهاء التجربة، في {{renewalDate}}","product_info.renewal_frequency":"يتم التجديد {{frequency}}","product_info.continues_until_cancelled":"يستمر حتى يتم إلغاؤه","product_info.cancel_anytime":"يمكن الإلغاء في أي وقت","payment_entry_page.payment_step_title":"الدفع الآمن عبر RevenueCat","payment_entry_page.button_pay":"ادفع الآن","payment_entry_page.button_start_trial":"ابدأ التجربة","success_page.purchase_successful":"تم الدفع بنجاح","success_page.button_close":"متابعة","error_page.if_error_persists":"إذا استمرت المشكلة، يرجى الاتصال بـ ","error_page.error_title_already_subscribed":"أنت مشترك بالفعل في {{productTitle}}","error_page.error_title_already_purchased":"لقد اشتريت {{productTitle}} بالفعل","error_page.error_title_other_errors":"حدث خطأ ما","error_page.error_message_already_subscribed":"لا يمكنك الاشتراك في هذا المنتج مرة أخرى.","error_page.error_message_already_purchased":"لا يمكنك شراء هذا المنتج مرة أخرى.","error_page.error_message_missing_email_error":"يُطلب البريد الإلكتروني لإتمام عملية الشراء.","error_page.error_message_network_error":"خطأ في الشبكة. يرجى التحقق من اتصال الإنترنت.","error_page.error_message_error_charging_payment":"فشل الدفع.","error_page.error_message_error_setting_up_purchase":"لم تبدأ عملية الشراء بسبب خطأ (رمز الخطأ: {{errorCode}}).","error_page.error_message_invalid_tax_location":"لم نتمكن من التحقق من عنوان الفوترة الخاص بك. يرجى التحقق مرة أخرى من الرمز البريدي والبلد للتأكد من صحتهما.","error_page.error_message_unknown_error":"حدث خطأ غير معروف (رمز الخطأ: {{errorCode}}).","error_page.button_try_again":"حاول مرة أخرى","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% خصم","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"إجمالي المبلغ المستحق اليوم","product_info.subscribe_to":"اشترك في","navbar_header.details":"تفاصيل","navbar_header.back_button":"عودة","pricing_dropdown.show_details":"إظهار التفاصيل","pricing_dropdown.hide_details":"إخفاء التفاصيل","pricing_table.tax":"الضريبة","pricing_table.trial_ends":"بعد انتهاء الفترة التجريبية، في {{formattedTrialEndDate}}","pricing_table.total_due_today":"الإجمالي المستحق اليوم","pricing_table.total_excluding_tax":"الإجمالي باستثناء الضريبة","pricing_table.enter_billing_address_to_calculate":"أدخل عنوان إرسال الفواتير لحسابها","pricing_table.enter_state_or_postal_code_to_calculate":"أدخل الولاية أو الرمز البريدي للحساب","pricing_table.enter_postal_code_to_calculate":"أدخل الرمز البريدي للحساب","error_page.error_message_invalid_email_error":"تعذر التحقق من عنوان البريد الإلكتروني {{email}}. يرجى تقديم عنوان بريد إلكتروني صالح.","payment_entry_page.button_payment_method":"ادفع {{formattedPrice}} باستخدام {{paymentMethod}}","payment_entry_page.button_with_price":"ادفع {{formattedPrice}}","price_update.title":"تحديث السعر","price_update.base_message":"تم تحديث السعر الإجمالي مع الضريبة بناءً على عنوان إرسال الفواتير الخاص بك. يرجى المراجعة والمحاولة مرة أخرى. لن يتم تحصيل رسوم من بطاقتك إلا مرة واحدة.","price_update.trial_message":"تم تحديث سعر الاشتراك ليشمل الضرائب بناءً على عنوان الفوترة الخاص بك. فترة التجربة المجانية لا تزال سارية. يرجى التحقق والمحاولة مرة أخرى.","payment_entry_page.express_checkout_divider":"أو ادفع بواسطة البطاقة","error_page.trouble_accessing":"إذا كنت تواجه مشكلة في الوصول إلى عملية الشراء، فتواصل مع الدعم على ","error_page.close_button_title":"اذهب إلى {{appName}}","error_page.error_title_stripe_missing_required_permission":"إذن Stripe مفقود","error_page.button_close":"إغلاق","error_page.error_message_stripe_invalid_tax_origin_address":"فشلت عملية الشراء لأن عنوان المنشأ الضريبي غير صالح. في مرحلة الإنتاج، ستعمل عمليات الشراء بدون تطبيق الضرائب.","error_page.error_message_stripe_tax_not_active":"فشلت عملية الشراء لأن ضريبة Stripe غير مفعلة. في مرحلة الإنتاج، ستعمل عمليات الشراء بدون تطبيق الضرائب.","error_page.error_only_in_sandbox":"تظهر هذه الرسالة فقط في البيئة التجريبية.","error_page.error_message_stripe_missing_required_permission":"فشلت عملية الشراء لأن تطبيق Stripe يفتقر إلى إذن مطلوب. في مرحلة الإنتاج، ستعمل عمليات الشراء بدون تطبيق الضرائب.","error_page.error_title_stripe_tax_not_active":"ضريبة Stripe غير نشطة","error_page.error_title_stripe_invalid_tax_origin_address":"عنوان منشأ ضريبي غير صالح","apple_pay.free_trial":"تجربة مجانية","product_info.price_after_intro_price":"بعد {{introPriceDuration}}، في {{renewalDate}}","product_info.after_trial":"بعد الفترة التجريبية","product_info.after":"بعد","product_info.intro_price_phase_after_trial":"ثم {{introPriceDuration}} مقابل {{introPrice}}","product_info.intro_price_phase":"أولاً {{introPriceDuration}} مقابل {{introPrice}}","product_info.intro_price_phase_paid_once":"تدفع مرة واحدة","payment_entry_page.trial_subscription_terms_info":"بعد انتهاء الفترة التجريبية، سيتم محاسبتك بمبلغ {{price}} {{perFrequency}} بدءًا من {{renewalDate}}. يمكنك الإلغاء في أي وقت قبل هذا التاريخ.","payment_entry_page.subscription_info":"يتم تجديد الاشتراك تلقائيًا. يمكنك الإلغاء في أي وقت.","payment_entry_page.otp_terms_info":"بالشراء، أنت توافق على السماح لتطبيق {{appName}} بتحصيل الرسوم منك وفقًا لشروطه.","payment_entry_page.subscription_terms_info":"بالاشتراك، فإنك توافق على السماح لـ {{appName}} بتحصيل رسوم منك وفقًا لشروطها حتى تقوم بالإلغاء."},UK={"periods.week":"{{amount}} setmana","periods.month":"{{amount}} mes","periods.year":"{{amount}} any","periods.day":"{{amount}} dia","periods.weekShort":"{{amount}}set","periods.monthShort":"{{amount}}mes","periods.yearShort":"{{amount}}any","periods.dayShort":"{{amount}}d","periods.lifetime":"de per vida","periods.weekPlural":"{{amount}} setmanes","periods.monthPlural":"{{amount}} mesos","periods.yearPlural":"{{amount}} anys","periods.dayPlural":"{{amount}} dies","periods.weekFrequency":"setmanal","periods.monthFrequency":"mensual","periods.yearFrequency":"anual","periods.dayFrequency":"diari","periods.perWeekFrequency":"per setmana","periods.perMonthFrequency":"per mes","periods.perYearFrequency":"per any","periods.perDayFrequency":"per dia","periods.unknownFrequency":"desconeguda","periods.weekFrequencyPlural":"cada {{amount}} setmanes","periods.monthFrequencyPlural":"cada {{amount}} mesos","periods.yearFrequencyPlural":"cada {{amount}} anys","periods.dayFrequencyPlural":"cada {{amount}} dies","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} de prova gratuïta","product_info.price_after_free_trial":"Després del període de prova, el {{renewalDate}}","product_info.renewal_frequency":"Es renova {{frequency}}","product_info.continues_until_cancelled":"Continua fins que es cancel·li","product_info.cancel_anytime":"Cancel·la en qualsevol moment","payment_entry_page.payment_step_title":"Pagament segur amb RevenueCat","payment_entry_page.button_pay":"Paga ara","payment_entry_page.button_start_trial":"Comença la prova","success_page.purchase_successful":"Pagament complet","success_page.button_close":"Continua","error_page.if_error_persists":"Si l'error persisteix, contacta amb ","error_page.error_title_already_subscribed":"Ja us heu subscrit a {{productTitle}}","error_page.error_title_already_purchased":"Ja heu comprat {{productTitle}}","error_page.error_title_other_errors":"Alguna cosa ha anat malament","error_page.error_message_already_subscribed":"No us podeu subscriure a aquest producte de nou.","error_page.error_message_already_purchased":"No podeu comprar aquest producte de nou.","error_page.error_message_missing_email_error":"Es necessita un correu electrònic per completar la compra.","error_page.error_message_network_error":"Error de xarxa. Comprova la teva connexió a internet.","error_page.error_message_error_charging_payment":"El pagament ha fallat.","error_page.error_message_error_setting_up_purchase":"No s'ha iniciat la compra a causa d'un error (codi d'error: {{errorCode}}).","error_page.error_message_invalid_tax_location":"No hem pogut verificar la vostra adreça de facturació. Si us plau, verifiqueu de nou el codi postal i el país per assegurar-vos que són correctes.","error_page.error_message_unknown_error":"S'ha produït un error desconegut (codi d'error: {{errorCode}}).","error_page.button_try_again":"Torna a intentar-ho","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% de descompte","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total a pagar avui","product_info.subscribe_to":"Subscriu-te a","navbar_header.details":"Detalls","navbar_header.back_button":"Enrere","pricing_dropdown.show_details":"Mostra detalls","pricing_dropdown.hide_details":"Amaga detalls","pricing_table.tax":"Impostos","pricing_table.trial_ends":"Després que finalitzi la prova, el {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total a pagar avui","pricing_table.total_excluding_tax":"Total sense impostos","pricing_table.enter_billing_address_to_calculate":"Introduïu l'adreça de facturació per calcular","pricing_table.enter_state_or_postal_code_to_calculate":"Introduïu la província o el codi postal per calcular","pricing_table.enter_postal_code_to_calculate":"Introduïu el codi postal per calcular","error_page.error_message_invalid_email_error":"No s'ha pogut verificar l'adreça de correu electrònic {{email}}. Si us plau, proporcioneu una adreça de correu electrònic vàlida.","payment_entry_page.button_payment_method":"Paga {{formattedPrice}} amb {{paymentMethod}}","payment_entry_page.button_with_price":"Paga {{formattedPrice}}","price_update.title":"Actualització de preu","price_update.base_message":"El preu total s'ha actualitzat amb els impostos segons la vostra adreça de facturació. Reviseu-ho i torneu-ho a provar. Només es carregarà la vostra targeta una vegada.","price_update.trial_message":"El preu de la subscripció s'ha actualitzat per incloure els impostos segons la seva adreça de facturació. El període de prova gratuït segueix vigent. Si us plau, comprovi-ho i torni-ho a provar.","payment_entry_page.express_checkout_divider":"O PAGUEU AMB TARGETA","error_page.trouble_accessing":"Si teniu problemes per accedir a la vostra compra, poseu-vos en contacte amb el servei d'assistència a ","error_page.close_button_title":"Vés a {{appName}}","error_page.error_title_stripe_missing_required_permission":"Falta el permís de Stripe","error_page.button_close":"Tanca","error_page.error_message_stripe_invalid_tax_origin_address":"La compra ha fallat perquè l'adreça d'origen fiscal no és vàlida. En producció, les compres funcionaran sense impostos aplicats.","error_page.error_message_stripe_tax_not_active":"La compra ha fallat perquè Stripe Tax no està activat. En producció, les compres funcionaran sense impostos aplicats.","error_page.error_only_in_sandbox":"Aquest missatge apareix només a l'entorn de proves.","error_page.error_message_stripe_missing_required_permission":"La compra ha fallat perquè l'aplicació Stripe no té un permís necessari. En producció, les compres funcionaran sense impostos aplicats.","error_page.error_title_stripe_tax_not_active":"Stripe Tax no està actiu","error_page.error_title_stripe_invalid_tax_origin_address":"Adreça d'origen fiscal no vàlida","apple_pay.free_trial":"Prova gratuïta","product_info.price_after_intro_price":"Després de {{introPriceDuration}}, el {{renewalDate}}","product_info.after_trial":"després del període de prova","product_info.after":"després de","product_info.intro_price_phase_after_trial":"Després {{introPriceDuration}} per {{introPrice}}","product_info.intro_price_phase":"Primer {{introPriceDuration}} per {{introPrice}}","product_info.intro_price_phase_paid_once":"pagat un cop","payment_entry_page.trial_subscription_terms_info":"Un cop finalitzat el període de prova, se us cobrarà {{price}} {{perFrequency}} a partir del {{renewalDate}}. Podeu cancel·lar-ho en qualsevol moment abans d'aquesta data.","payment_entry_page.subscription_info":"La subscripció es renova automàticament. Cancel·leu-la quan vulgueu.","payment_entry_page.otp_terms_info":"En comprar, accepteu que {{appName}} us cobri d'acord amb les seves condicions.","payment_entry_page.subscription_terms_info":"En subscriure-us, accepteu que {{appName}} us cobri d'acord amb les seves condicions fins que ho cancel·leu."},FK={"periods.week":"{{amount}} 周","periods.month":"{{amount}} 月","periods.year":"{{amount}} 年","periods.day":"{{amount}} 天","periods.weekShort":"{{amount}}周","periods.monthShort":"{{amount}}月","periods.yearShort":"{{amount}}年","periods.dayShort":"{{amount}}天","periods.lifetime":"终身","periods.weekPlural":"{{amount}} 周","periods.monthPlural":"{{amount}} 个月","periods.yearPlural":"{{amount}} 年","periods.dayPlural":"{{amount}} 天","periods.weekFrequency":"每周","periods.monthFrequency":"每月","periods.yearFrequency":"每年","periods.dayFrequency":"每天","periods.perWeekFrequency":"每周","periods.perMonthFrequency":"每月","periods.perYearFrequency":"每年","periods.perDayFrequency":"每天","periods.unknownFrequency":"未知","periods.weekFrequencyPlural":"每 {{amount}} 周","periods.monthFrequencyPlural":"每 {{amount}} 个月","periods.yearFrequencyPlural":"每 {{amount}} 年","periods.dayFrequencyPlural":"每 {{amount}} 天","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} 天免费试用","product_info.price_after_free_trial":"试用期结束后，于 {{renewalDate}}","product_info.renewal_frequency":"续订 {{frequency}}","product_info.continues_until_cancelled":"持续到取消","product_info.cancel_anytime":"随时取消","payment_entry_page.payment_step_title":"RevenueCat 安全结账","payment_entry_page.button_pay":"立即支付","payment_entry_page.button_start_trial":"开始试用","success_page.purchase_successful":"支付完成","success_page.button_close":"继续","error_page.if_error_persists":"如果错误仍然存在，请联系 ","error_page.error_title_already_subscribed":"您已订阅 {{productTitle}}","error_page.error_title_already_purchased":"您已购买 {{productTitle}}","error_page.error_title_other_errors":"出现错误","error_page.error_message_already_subscribed":"您不能再次订阅此产品。","error_page.error_message_already_purchased":"您不能再次购买此产品。","error_page.error_message_missing_email_error":"完成购买需要邮箱地址。","error_page.error_message_network_error":"网络错误。请检查您的互联网连接。","error_page.error_message_error_charging_payment":"支付失败。","error_page.error_message_error_setting_up_purchase":"由于错误，购买未启动（错误代码：{{errorCode}}）。","error_page.error_message_invalid_tax_location":"我们无法验证您的账单地址。请仔细检查邮政编码和国家是否正确。","error_page.error_message_unknown_error":"发生未知错误（错误代码：{{errorCode}}）。","error_page.button_try_again":"重试","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% 折扣","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"今天应付总额","product_info.subscribe_to":"订阅","navbar_header.details":"详情","navbar_header.back_button":"返回","pricing_dropdown.show_details":"显示详情","pricing_dropdown.hide_details":"隐藏详情","pricing_table.tax":"税","pricing_table.trial_ends":"试用期结束后，于{{formattedTrialEndDate}}","pricing_table.total_due_today":"今日应付总额","pricing_table.total_excluding_tax":"总计（不含税）","pricing_table.enter_billing_address_to_calculate":"输入账单地址以计算","pricing_table.enter_state_or_postal_code_to_calculate":"输入州或邮政编码以计算","pricing_table.enter_postal_code_to_calculate":"输入邮政编码以计算","error_page.error_message_invalid_email_error":"无法验证电子邮件地址{{email}}。请提供有效的电子邮件地址。","payment_entry_page.button_payment_method":"使用{{paymentMethod}}支付{{formattedPrice}}","payment_entry_page.button_with_price":"支付{{formattedPrice}}","price_update.title":"价格更新","price_update.base_message":"总价已根据您的账单地址更新了税费。请查看并重试。您的银行卡只会扣款一次。","price_update.trial_message":"根据您的账单地址，订阅价格已更新为含税价格。免费试用仍然有效。请查看并重试。","payment_entry_page.express_checkout_divider":"或使用银行卡支付","error_page.trouble_accessing":"如果您在访问购买项目时遇到问题，请通过以下方式联系支持：","error_page.close_button_title":"前往{{appName}}","error_page.error_title_stripe_missing_required_permission":"缺少Stripe权限","error_page.button_close":"关闭","error_page.error_message_stripe_invalid_tax_origin_address":"购买失败，因为税务起始地址无效。在生产环境中，购买将在不应用税款的情况下进行。","error_page.error_message_stripe_tax_not_active":"购买失败，因为Stripe Tax未启用。在生产环境中，购买将在不应用税款的情况下进行。","error_page.error_only_in_sandbox":"此消息仅在沙盒中显示。","error_page.error_message_stripe_missing_required_permission":"购买失败，因为Stripe应用程序缺少必需的权限。在生产环境中，购买将在不应用税款的情况下进行。","error_page.error_title_stripe_tax_not_active":"Stripe Tax未激活","error_page.error_title_stripe_invalid_tax_origin_address":"税务起始地址无效","apple_pay.free_trial":"免费试用","product_info.price_after_intro_price":"在{{introPriceDuration}}之后，于{{renewalDate}}开始","product_info.after_trial":"试用后","product_info.after":"之后","product_info.intro_price_phase_after_trial":"然后{{introPriceDuration}}，价格为{{introPrice}}","product_info.intro_price_phase":"首先{{introPriceDuration}}，价格为{{introPrice}}","product_info.intro_price_phase_paid_once":"一次性支付","payment_entry_page.trial_subscription_terms_info":"试用期结束后，您将被收取 {{price}} {{perFrequency}}，从 {{renewalDate}} 开始。您可以在此日期之前的任何时间取消。","payment_entry_page.subscription_info":"订阅自动续订。随时取消。","payment_entry_page.otp_terms_info":"购买即表示您同意允许{{appName}}根据其条款向您收费。","payment_entry_page.subscription_terms_info":"订阅即表示您同意允许 {{appName}} 按照其条款向您收费，直到您取消订阅。"},qK={"periods.week":"{{amount}} 週","periods.month":"{{amount}} 個月","periods.year":"{{amount}} 年","periods.day":"{{amount}} 天","periods.weekShort":"{{amount}}週","periods.monthShort":"{{amount}}月","periods.yearShort":"{{amount}}年","periods.dayShort":"{{amount}}天","periods.lifetime":"終身","periods.weekPlural":"{{amount}} 週","periods.monthPlural":"{{amount}} 個月","periods.yearPlural":"{{amount}} 年","periods.dayPlural":"{{amount}} 天","periods.weekFrequency":"每週","periods.monthFrequency":"每月","periods.yearFrequency":"每年","periods.dayFrequency":"每天","periods.perWeekFrequency":"每週","periods.perMonthFrequency":"每月","periods.perYearFrequency":"每年","periods.perDayFrequency":"每天","periods.unknownFrequency":"未知","periods.weekFrequencyPlural":"每 {{amount}} 週","periods.monthFrequencyPlural":"每 {{amount}} 個月","periods.yearFrequencyPlural":"每 {{amount}} 年","periods.dayFrequencyPlural":"每 {{amount}} 天","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} 天免費試用","product_info.price_after_free_trial":"試用期結束後，於 {{renewalDate}}","product_info.renewal_frequency":"每 {{frequency}} 續約","product_info.continues_until_cancelled":"持續到取消","product_info.cancel_anytime":"隨時取消","payment_entry_page.payment_step_title":"RevenueCat 安全結帳","payment_entry_page.button_pay":"立即付款","payment_entry_page.button_start_trial":"開始試用","success_page.purchase_successful":"付款完成","success_page.button_close":"繼續","error_page.if_error_persists":"如果錯誤持續存在，請聯絡 ","error_page.error_title_already_subscribed":"您已經訂閱 {{productTitle}}","error_page.error_title_already_purchased":"您已經購買 {{productTitle}}","error_page.error_title_other_errors":"發生錯誤","error_page.error_message_already_subscribed":"您無法再次訂閱此產品。","error_page.error_message_already_purchased":"您無法再次購買此產品。","error_page.error_message_missing_email_error":"完成購買需要電子郵件地址。","error_page.error_message_network_error":"網路錯誤。請檢查您的網路連線。","error_page.error_message_error_charging_payment":"付款失敗。","error_page.error_message_error_setting_up_purchase":"由於發生錯誤，購買未啟動（錯誤代碼：{{errorCode}}）。","error_page.error_message_invalid_tax_location":"我們無法驗證您的帳單地址。請仔細檢查郵遞區號和國家是否正確。","error_page.error_message_unknown_error":"發生不明錯誤（錯誤代碼：{{errorCode}}）。","error_page.button_try_again":"再試一次","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% 折扣","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"今日應付總額","product_info.subscribe_to":"訂閱","navbar_header.details":"詳細資訊","navbar_header.back_button":"返回","pricing_dropdown.show_details":"顯示詳細資訊","pricing_dropdown.hide_details":"隱藏詳細資訊","pricing_table.tax":"稅金","pricing_table.trial_ends":"試用期結束後，於 {{formattedTrialEndDate}}","pricing_table.total_due_today":"今日應付總額","pricing_table.total_excluding_tax":"總計（不含稅）","pricing_table.enter_billing_address_to_calculate":"輸入帳單地址以計算","pricing_table.enter_state_or_postal_code_to_calculate":"輸入州或郵政編碼以計算","pricing_table.enter_postal_code_to_calculate":"輸入郵政編碼以計算","error_page.error_message_invalid_email_error":"無法驗證電子郵件地址 {{email}}。請提供有效的電子郵件地址。","payment_entry_page.button_payment_method":"使用 {{paymentMethod}} 支付 {{formattedPrice}}","payment_entry_page.button_with_price":"支付 {{formattedPrice}}","price_update.title":"價格更新","price_update.base_message":"總價已根據您的帳單地址更新稅金。請檢查後重試。您的信用卡只會被收取一次費用。","price_update.trial_message":"根據您的帳單地址，訂閱價格已更新為含稅價格。免費試用仍然有效。請查看並重試。","payment_entry_page.express_checkout_divider":"或以信用卡付款","error_page.trouble_accessing":"如果您在存取購買項目時遇到問題，請透過以下方式聯絡支援人員：","error_page.close_button_title":"前往{{appName}}","error_page.error_title_stripe_missing_required_permission":"缺少 Stripe 權限","error_page.button_close":"關閉","error_page.error_message_stripe_invalid_tax_origin_address":"購買失敗，因為稅務起始地址無效。在正式環境中，購買將在不套用稅金的情況下運作。","error_page.error_message_stripe_tax_not_active":"購買失敗，因為 Stripe Tax 未啟用。在正式環境中，購買將在不套用稅金的情況下運作。","error_page.error_only_in_sandbox":"此訊息僅在沙盒中顯示。","error_page.error_message_stripe_missing_required_permission":"購買失敗，因為 Stripe 應用程式缺少必要的權限。在正式環境中，購買將在不套用稅金的情況下運作。","error_page.error_title_stripe_tax_not_active":"Stripe Tax 未啟用","error_page.error_title_stripe_invalid_tax_origin_address":"無效的稅務起始地址","apple_pay.free_trial":"免費試用","product_info.price_after_intro_price":"在 {{introPriceDuration}} 之後，於 {{renewalDate}}","product_info.after_trial":"試用期後","product_info.after":"之後","product_info.intro_price_phase_after_trial":"然後 {{introPriceDuration}}，價格為 {{introPrice}}","product_info.intro_price_phase":"首先 {{introPriceDuration}}，價格為 {{introPrice}}","product_info.intro_price_phase_paid_once":"一次性支付","payment_entry_page.trial_subscription_terms_info":"在您的試用期結束後，您將被收取 {{price}} {{perFrequency}}，從 {{renewalDate}} 開始。您可以隨時在此日期之前取消。","payment_entry_page.subscription_info":"訂閱會自動續訂。隨時取消。","payment_entry_page.otp_terms_info":"購買即表示您同意授權 {{appName}} 根據其條款向您收費。","payment_entry_page.subscription_terms_info":"訂閱即表示您同意允許 {{appName}} 根據其條款向您收費，直到您取消為止。"},zK={"periods.week":"{{amount}} tjedan","periods.month":"{{amount}} mjesec","periods.year":"{{amount}} godina","periods.day":"{{amount}} dan","periods.weekShort":"{{amount}}tj","periods.monthShort":"{{amount}}mj","periods.yearShort":"{{amount}}g","periods.dayShort":"{{amount}}d","periods.lifetime":"doživotno","periods.weekPlural":"{{amount}} tjedana","periods.monthPlural":"{{amount}} mjeseci","periods.yearPlural":"{{amount}} godina","periods.dayPlural":"{{amount}} dana","periods.weekFrequency":"tjedno","periods.monthFrequency":"mjesečno","periods.yearFrequency":"godišnje","periods.dayFrequency":"dnevno","periods.perWeekFrequency":"tjedno","periods.perMonthFrequency":"mjesečno","periods.perYearFrequency":"godišnje","periods.perDayFrequency":"dnevno","periods.unknownFrequency":"nepoznato","periods.weekFrequencyPlural":"svakih {{amount}} tjedana","periods.monthFrequencyPlural":"svakih {{amount}} mjeseci","periods.yearFrequencyPlural":"svakih {{amount}} godina","periods.dayFrequencyPlural":"svakih {{amount}} dana","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} besplatno probno razdoblje","product_info.price_after_free_trial":"Nakon isteka probnog razdoblja, {{renewalDate}}","product_info.renewal_frequency":"Obnavlja se {{frequency}}","product_info.continues_until_cancelled":"Nastavlja se dok se ne otkaže","product_info.cancel_anytime":"Otkažite u bilo kojem trenutku","payment_entry_page.payment_step_title":"Sigurna naplata putem RevenueCat","payment_entry_page.button_pay":"Plati sada","payment_entry_page.button_start_trial":"Počni probno razdoblje","success_page.purchase_successful":"Uplata je uspješna","success_page.button_close":"Nastavi","error_page.if_error_persists":"Ako se pogreška nastavi, obratite se ","error_page.error_title_already_subscribed":"Već ste pretplaćeni na {{productTitle}}","error_page.error_title_already_purchased":"Već ste kupili {{productTitle}}","error_page.error_title_other_errors":"Nešto je pošlo po zlu","error_page.error_message_already_subscribed":"Ne možete se ponovno pretplatiti na ovaj proizvod.","error_page.error_message_already_purchased":"Ne možete ponovno kupiti ovaj proizvod.","error_page.error_message_missing_email_error":"E-pošta je potrebna za dovršetak kupnje.","error_page.error_message_network_error":"Mrežna pogreška. Provjerite internetsku vezu.","error_page.error_message_error_charging_payment":"Plaćanje nije uspjelo.","error_page.error_message_error_setting_up_purchase":"Kupnja nije započela zbog pogreške (kod pogreške: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nismo mogli potvrditi vašu adresu za naplatu. Molimo provjerite poštanski broj i državu kako biste bili sigurni da su točni.","error_page.error_message_unknown_error":"Došlo je do nepoznate pogreške (kod pogreške: {{errorCode}}).","error_page.button_try_again":"Pokušaj ponovno","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% popusta","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Ukupno dospijeće danas","product_info.subscribe_to":"Pretplatite se","navbar_header.details":"Detalji","navbar_header.back_button":"Natrag","pricing_dropdown.show_details":"Prikaži detalje","pricing_dropdown.hide_details":"Sakrij detalje","pricing_table.tax":"Porez","pricing_table.trial_ends":"Nakon isteka probnog razdoblja, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Ukupan iznos dospijeća danas","pricing_table.total_excluding_tax":"Ukupno bez poreza","pricing_table.enter_billing_address_to_calculate":"Unesite adresu za naplatu za izračun","pricing_table.enter_state_or_postal_code_to_calculate":"Unesite državu ili poštanski broj za izračun","pricing_table.enter_postal_code_to_calculate":"Unesite poštanski broj za izračun","error_page.error_message_invalid_email_error":"Adresa e-pošte {{email}} nije se mogla potvrditi. Molimo unesite valjanu adresu e-pošte.","payment_entry_page.button_payment_method":"Plati {{formattedPrice}} putem {{paymentMethod}}","payment_entry_page.button_with_price":"Plati {{formattedPrice}}","price_update.title":"Ažuriranje cijene","price_update.base_message":"Ukupna cijena je ažurirana s porezom na temelju vaše adrese za naplatu. Pregledajte i pokušajte ponovo. Vaša kartica bit će naplaćena samo jednom.","price_update.trial_message":"Cijena pretplate je ažurirana da uključi poreze na temelju vaše adrese za naplatu. Besplatno probno razdoblje i dalje vrijedi. Molimo provjerite i pokušajte ponovno.","payment_entry_page.express_checkout_divider":"ILI PLATITE KARTICOM","error_page.trouble_accessing":"Ako imate problema s pristupom kupnji, obratite se podršci na ","error_page.close_button_title":"Idi na {{appName}}","error_page.error_title_stripe_missing_required_permission":"Nedostaje Stripe dopuštenje","error_page.button_close":"Zatvori","error_page.error_message_stripe_invalid_tax_origin_address":"Kupnja nije uspjela jer je adresa poreznog podrijetla nevažeća. U produkciji će kupnje funkcionirati bez primijenjenih poreza.","error_page.error_message_stripe_tax_not_active":"Kupnja nije uspjela jer Stripe Tax nije omogućen. U produkciji će kupnje funkcionirati bez primijenjenih poreza.","error_page.error_only_in_sandbox":"Ova se poruka pojavljuje samo u sandboxu.","error_page.error_message_stripe_missing_required_permission":"Kupnja nije uspjela jer Stripe aplikaciji nedostaje potrebno dopuštenje. U produkciji će kupnje funkcionirati bez primijenjenih poreza.","error_page.error_title_stripe_tax_not_active":"Stripe Tax nije aktivan","error_page.error_title_stripe_invalid_tax_origin_address":"Nevažeća adresa poreznog podrijetla","apple_pay.free_trial":"Besplatna proba","product_info.price_after_intro_price":"Nakon {{introPriceDuration}}, na {{renewalDate}}","product_info.after_trial":"nakon probnog perioda","product_info.after":"nakon","product_info.intro_price_phase_after_trial":"Zatim {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase":"Prvo {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase_paid_once":"plaća se jednokratno","payment_entry_page.trial_subscription_terms_info":"Nakon isteka probnog razdoblja, bit će vam naplaćeno {{price}} {{perFrequency}} počevši od {{renewalDate}}. Možete otkazati bilo kada prije tog datuma.","payment_entry_page.subscription_info":"Pretplata se automatski obnavlja. Otkažite bilo kada.","payment_entry_page.otp_terms_info":"Kupnjom pristajete dopustiti aplikaciji {{appName}} da vam naplati u skladu s njihovim uvjetima.","payment_entry_page.subscription_terms_info":"Pretplatom se slažete da ćete dopustiti {{appName}} da vam naplaćuje u skladu s njihovim uvjetima dok ne otkažete."},$K={"periods.week":"{{amount}} týden","periods.month":"{{amount}} měsíc","periods.year":"{{amount}} rok","periods.day":"{{amount}} den","periods.weekShort":"{{amount}}týd","periods.monthShort":"{{amount}}měs","periods.yearShort":"{{amount}}rok","periods.dayShort":"{{amount}}d","periods.lifetime":"doživotně","periods.weekPlural":"{{amount}} týdnů","periods.monthPlural":"{{amount}} měsíců","periods.yearPlural":"{{amount}} let","periods.dayPlural":"{{amount}} dnů","periods.weekFrequency":"týdně","periods.monthFrequency":"měsíčně","periods.yearFrequency":"ročně","periods.dayFrequency":"denně","periods.perWeekFrequency":"týdně","periods.perMonthFrequency":"měsíčně","periods.perYearFrequency":"ročně","periods.perDayFrequency":"denně","periods.unknownFrequency":"neznámé","periods.weekFrequencyPlural":"každých {{amount}} týdnů","periods.monthFrequencyPlural":"každých {{amount}} měsíců","periods.yearFrequencyPlural":"každých {{amount}} let","periods.dayFrequencyPlural":"každých {{amount}} dnů","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} zkušební verze zdarma","product_info.price_after_free_trial":"Po skončení zkušební verze, {{renewalDate}}","product_info.renewal_frequency":"Obnovuje se {{frequency}}","product_info.continues_until_cancelled":"Pokračuje, dokud není zrušeno","product_info.cancel_anytime":"Zrušit kdykoli","payment_entry_page.payment_step_title":"Bezpečné placení přes RevenueCat","payment_entry_page.button_pay":"Platit nyní","payment_entry_page.button_start_trial":"Spustit zkušební verzi","success_page.purchase_successful":"Platba dokončena","success_page.button_close":"Pokračovat","error_page.if_error_persists":"Pokud chyba přetrvává, kontaktujte ","error_page.error_title_already_subscribed":"Již máte předplatné pro {{productTitle}}","error_page.error_title_already_purchased":"Již jste zakoupili {{productTitle}}","error_page.error_title_other_errors":"Něco se pokazilo","error_page.error_message_already_subscribed":"Nemůžete si znovu předplatit tento produkt.","error_page.error_message_already_purchased":"Tento produkt si nemůžete znovu zakoupit.","error_page.error_message_missing_email_error":"Pro dokončení nákupu je vyžadován e-mail.","error_page.error_message_network_error":"Síťová chyba. Zkontrolujte prosím své internetové připojení.","error_page.error_message_error_charging_payment":"Platba selhala.","error_page.error_message_error_setting_up_purchase":"Nákup nebyl zahájen z důvodu chyby (kód chyby: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nemohli jsme ověřit vaši fakturační adresu. Zkontrolujte prosím, zda je poštovní směrovací číslo a země správné.","error_page.error_message_unknown_error":"Došlo k neznámé chybě (kód chyby: {{errorCode}}).","error_page.button_try_again":"Zkusit znovu","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% sleva","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Celkem dnes k zaplacení","product_info.subscribe_to":"Předplatit","navbar_header.details":"Podrobnosti","navbar_header.back_button":"Zpět","pricing_dropdown.show_details":"Zobrazit podrobnosti","pricing_dropdown.hide_details":"Skrýt podrobnosti","pricing_table.tax":"Daň","pricing_table.trial_ends":"Po skončení zkušební doby, dne {{formattedTrialEndDate}}","pricing_table.total_due_today":"Celkem splatné dnes","pricing_table.total_excluding_tax":"Celkem bez daně","pricing_table.enter_billing_address_to_calculate":"Zadejte fakturační adresu pro výpočet","pricing_table.enter_state_or_postal_code_to_calculate":"Zadejte stát nebo PSČ pro výpočet","pricing_table.enter_postal_code_to_calculate":"Zadejte PSČ pro výpočet","error_page.error_message_invalid_email_error":"E-mailová adresa {{email}} nemohla být ověřena. Zadejte prosím platnou e-mailovou adresu.","payment_entry_page.button_payment_method":"Zaplatit {{formattedPrice}} pomocí {{paymentMethod}}","payment_entry_page.button_with_price":"Zaplatit {{formattedPrice}}","price_update.title":"Aktualizace ceny","price_update.base_message":"Celková cena byla aktualizována o daň na základě vaší fakturační adresy. Zkontrolujte ji a zkuste to znovu. Vaše karta bude stržena pouze jednou.","price_update.trial_message":"Cena předplatného byla aktualizována včetně daní na základě vaší fakturační adresy. Bezplatná zkušební doba stále platí. Prosím, zkontrolujte a zkuste to znovu.","payment_entry_page.express_checkout_divider":"NEBO ZAPLATIT KARTOU","error_page.trouble_accessing":"Pokud máte potíže s přístupem k zakoupenému obsahu, kontaktujte podporu na ","error_page.close_button_title":"Přejít na {{appName}}","error_page.error_title_stripe_missing_required_permission":"Chybí oprávnění Stripe","error_page.button_close":"Zavřít","error_page.error_message_stripe_invalid_tax_origin_address":"Nákup se nezdařil, protože adresa původu daně je neplatná. V produkčním prostředí budou nákupy fungovat bez uplatnění daní.","error_page.error_message_stripe_tax_not_active":"Nákup se nezdařil, protože Stripe Tax není aktivní. V produkčním prostředí budou nákupy fungovat bez uplatnění daní.","error_page.error_only_in_sandbox":"Tato zpráva se zobrazuje pouze v sandboxu.","error_page.error_message_stripe_missing_required_permission":"Nákup se nezdařil, protože aplikaci Stripe chybí požadované oprávnění. V produkčním prostředí budou nákupy fungovat bez uplatnění daní.","error_page.error_title_stripe_tax_not_active":"Stripe Tax není aktivní","error_page.error_title_stripe_invalid_tax_origin_address":"Neplatná adresa původu daně","apple_pay.free_trial":"Zkušební verze zdarma","product_info.price_after_intro_price":"Po {{introPriceDuration}}, dne {{renewalDate}}","product_info.after_trial":"po zkušební době","product_info.after":"po","product_info.intro_price_phase_after_trial":"Poté {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase":"Nejprve {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase_paid_once":"placeno jednorázově","payment_entry_page.trial_subscription_terms_info":"Po skončení zkušebního období vám bude účtováno {{price}} {{perFrequency}} počínaje {{renewalDate}}. Před tímto datem můžete kdykoli zrušit.","payment_entry_page.subscription_info":"Předplatné se automaticky obnovuje. Zrušit můžete kdykoli.","payment_entry_page.otp_terms_info":"Zakoupením souhlasíte s tím, že umožníte aplikaci {{appName}} účtovat vám poplatky v souladu s jejími podmínkami.","payment_entry_page.subscription_terms_info":"Přihlášením k odběru souhlasíte s tím, že společnost {{appName}} vám bude účtovat poplatky v souladu s jejími podmínkami, dokud odběr nezrušíte."},VK={"periods.week":"{{amount}} uge","periods.month":"{{amount}} måned","periods.year":"{{amount}} år","periods.day":"{{amount}} dag","periods.weekShort":"{{amount}}ug","periods.monthShort":"{{amount}}md","periods.yearShort":"{{amount}}år","periods.dayShort":"{{amount}}d","periods.lifetime":"livstid","periods.weekPlural":"{{amount}} uger","periods.monthPlural":"{{amount}} måneder","periods.yearPlural":"{{amount}} år","periods.dayPlural":"{{amount}} dage","periods.weekFrequency":"ugentligt","periods.monthFrequency":"månedligt","periods.yearFrequency":"årligt","periods.dayFrequency":"dagligt","periods.perWeekFrequency":"pr. uge","periods.perMonthFrequency":"pr. måned","periods.perYearFrequency":"pr. år","periods.perDayFrequency":"pr. dag","periods.unknownFrequency":"ukendt","periods.weekFrequencyPlural":"hver {{amount}} uger","periods.monthFrequencyPlural":"hver {{amount}} måneder","periods.yearFrequencyPlural":"hver {{amount}} år","periods.dayFrequencyPlural":"hver {{amount}} dage","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} gratis prøveperiode","product_info.price_after_free_trial":"Efter prøveperioden slutter, den {{renewalDate}}","product_info.renewal_frequency":"Fornyes {{frequency}}","product_info.continues_until_cancelled":"Fortsætter indtil annulleret","product_info.cancel_anytime":"Annuller når som helst","payment_entry_page.payment_step_title":"Sikker betaling via RevenueCat","payment_entry_page.button_pay":"Betal nu","payment_entry_page.button_start_trial":"Start prøveperiode","success_page.purchase_successful":"Betaling gennemført","success_page.button_close":"Fortsæt","error_page.if_error_persists":"Hvis fejlen fortsætter, kontakt venligst ","error_page.error_title_already_subscribed":"Du abonnerer allerede på {{productTitle}}","error_page.error_title_already_purchased":"Du har allerede købt {{productTitle}}","error_page.error_title_other_errors":"Noget gik galt","error_page.error_message_already_subscribed":"Du kan ikke abonnere på dette produkt igen.","error_page.error_message_already_purchased":"Du kan ikke købe dette produkt igen.","error_page.error_message_missing_email_error":"Email er påkrævet for at gennemføre købet.","error_page.error_message_network_error":"Netværksfejl. Kontroller din internetforbindelse.","error_page.error_message_error_charging_payment":"Betalingen mislykkedes.","error_page.error_message_error_setting_up_purchase":"Køb ikke startet på grund af en fejl (fejlkode: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Vi kunne ikke bekræfte din faktureringsadresse. Kontroller venligst, at postnummeret og landet er korrekte.","error_page.error_message_unknown_error":"Der opstod en ukendt fejl (fejlkode: {{errorCode}}).","error_page.button_try_again":"Prøv igen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% rabat","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Samlet beløb for i dag","product_info.subscribe_to":"Abonner på","navbar_header.details":"Detaljer","navbar_header.back_button":"Tilbage","pricing_dropdown.show_details":"Vis detaljer","pricing_dropdown.hide_details":"Skjul detaljer","pricing_table.tax":"Moms","pricing_table.trial_ends":"Efter prøveperioden slutter, den {{formattedTrialEndDate}}","pricing_table.total_due_today":"Samlet beløb forfalden i dag","pricing_table.total_excluding_tax":"Samlet beløb eksklusive moms","pricing_table.enter_billing_address_to_calculate":"Indtast faktureringsadresse for at beregne","pricing_table.enter_state_or_postal_code_to_calculate":"Indtast stat eller postnummer for at beregne","pricing_table.enter_postal_code_to_calculate":"Indtast postnummer for at beregne","error_page.error_message_invalid_email_error":"E-mailadressen {{email}} kunne ikke bekræftes. Angiv en gyldig e-mailadresse.","payment_entry_page.button_payment_method":"Betal {{formattedPrice}} med {{paymentMethod}}","payment_entry_page.button_with_price":"Betal {{formattedPrice}}","price_update.title":"Prisopdatering","price_update.base_message":"Den samlede pris er blevet opdateret med moms baseret på din faktureringsadresse. Gennemgå og prøv igen. Dit kort vil kun blive debiteret én gang.","price_update.trial_message":"Abonnementsprisen er opdateret for at inkludere skatter baseret på din faktureringsadresse. Den gratis prøveperiode gælder stadig. Kontroller venligst og prøv igen.","payment_entry_page.express_checkout_divider":"ELLER BETAL MED KORT","error_page.trouble_accessing":"Hvis du har problemer med at få adgang til dit køb, kan du kontakte support på ","error_page.close_button_title":"Gå til {{appName}}","error_page.error_title_stripe_missing_required_permission":"Manglende Stripe-tilladelse","error_page.button_close":"Luk","error_page.error_message_stripe_invalid_tax_origin_address":"Købet mislykkedes, fordi skatteoprindelsesadressen er ugyldig. I produktion vil køb fungere uden påførte skatter.","error_page.error_message_stripe_tax_not_active":"Købet mislykkedes, fordi Stripe Tax ikke er aktiveret. I produktion vil køb fungere uden påførte skatter.","error_page.error_only_in_sandbox":"Denne meddelelse vises kun i sandkassen.","error_page.error_message_stripe_missing_required_permission":"Købet mislykkedes, fordi Stripe-appen mangler en påkrævet tilladelse. I produktion vil køb fungere uden påførte skatter.","error_page.error_title_stripe_tax_not_active":"Stripe Tax er ikke aktiv","error_page.error_title_stripe_invalid_tax_origin_address":"Ugyldig skatteoprindelsesadresse","apple_pay.free_trial":"Gratis prøveperiode","product_info.price_after_intro_price":"Efter {{introPriceDuration}}, den {{renewalDate}}","product_info.after_trial":"efter prøveperiode","product_info.after":"efter","product_info.intro_price_phase_after_trial":"Derefter {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase":"Først {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase_paid_once":"betales én gang","payment_entry_page.trial_subscription_terms_info":"Efter din prøveperiode slutter, vil du blive opkrævet {{price}} {{perFrequency}} fra og med {{renewalDate}}. Du kan opsige når som helst før denne dato.","payment_entry_page.subscription_info":"Abonnementet fornys automatisk. Opsig når som helst.","payment_entry_page.otp_terms_info":"Ved at købe accepterer du, at {{appName}} kan debitere dig i overensstemmelse med deres vilkår.","payment_entry_page.subscription_terms_info":"Ved at abonnere accepterer du, at {{appName}} kan opkræve dig i henhold til deres vilkår, indtil du opsiger."},HK={"periods.week":"{{amount}} week","periods.month":"{{amount}} maand","periods.year":"{{amount}} jaar","periods.day":"{{amount}} dag","periods.weekShort":"{{amount}}wk","periods.monthShort":"{{amount}}maand","periods.yearShort":"{{amount}}jr","periods.dayShort":"{{amount}}d","periods.lifetime":"levenslang","periods.weekPlural":"{{amount}} weken","periods.monthPlural":"{{amount}} maanden","periods.yearPlural":"{{amount}} jaren","periods.dayPlural":"{{amount}} dagen","periods.weekFrequency":"wekelijks","periods.monthFrequency":"maandelijks","periods.yearFrequency":"jaarlijks","periods.dayFrequency":"dagelijks","periods.perWeekFrequency":"per week","periods.perMonthFrequency":"per maand","periods.perYearFrequency":"per jaar","periods.perDayFrequency":"per dag","periods.unknownFrequency":"onbekend","periods.weekFrequencyPlural":"elke {{amount}} weken","periods.monthFrequencyPlural":"elke {{amount}} maanden","periods.yearFrequencyPlural":"elke {{amount}} jaren","periods.dayFrequencyPlural":"elke {{amount}} dagen","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} gratis proefperiode","product_info.price_after_free_trial":"Na afloop van de proefperiode, op {{renewalDate}}","product_info.renewal_frequency":"Wordt verlengd {{frequency}}","product_info.continues_until_cancelled":"Wordt voortgezet tot annulering","product_info.cancel_anytime":"Annuleer op elk gewenst moment","payment_entry_page.payment_step_title":"Veilige afrekening via RevenueCat","payment_entry_page.button_pay":"Nu betalen","payment_entry_page.button_start_trial":"Start proefperiode","success_page.purchase_successful":"Betaling voltooid","success_page.button_close":"Doorgaan","error_page.if_error_persists":"Neem contact op met  als de fout aanhoudt","error_page.error_title_already_subscribed":"Je bent al geabonneerd op {{productTitle}}","error_page.error_title_already_purchased":"Je hebt {{productTitle}} al gekocht","error_page.error_title_other_errors":"Er is iets misgegaan","error_page.error_message_already_subscribed":"Je kunt je niet opnieuw abonneren op dit product.","error_page.error_message_already_purchased":"Je kunt dit product niet opnieuw kopen.","error_page.error_message_missing_email_error":"Een e-mailadres is vereist om de aankoop te voltooien.","error_page.error_message_network_error":"Netwerkfout. Controleer uw internetverbinding.","error_page.error_message_error_charging_payment":"Betaling mislukt.","error_page.error_message_error_setting_up_purchase":"Aankoop niet gestart vanwege een fout (foutcode: {{errorCode}}).","error_page.error_message_invalid_tax_location":"We konden uw factuuradres niet verifiëren. Controleer of de postcode en het land correct zijn.","error_page.error_message_unknown_error":"Er is een onbekende fout opgetreden (foutcode: {{errorCode}}).","error_page.button_try_again":"Opnieuw proberen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% korting","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Totaal te betalen vandaag","product_info.subscribe_to":"Abonneren op","navbar_header.details":"Details","navbar_header.back_button":"Terug","pricing_dropdown.show_details":"Toon details","pricing_dropdown.hide_details":"Verberg details","pricing_table.tax":"Btw","pricing_table.trial_ends":"Na afloop van de proefperiode, op {{formattedTrialEndDate}}","pricing_table.total_due_today":"Totaal vandaag te betalen","pricing_table.total_excluding_tax":"Totaal exclusief btw","pricing_table.enter_billing_address_to_calculate":"Voer het factuuradres in om te berekenen","pricing_table.enter_state_or_postal_code_to_calculate":"Voer provincie of postcode in om te berekenen","pricing_table.enter_postal_code_to_calculate":"Voer postcode in om te berekenen","error_page.error_message_invalid_email_error":"Het e-mailadres {{email}} kon niet worden geverifieerd. Geef een geldig e-mailadres op.","payment_entry_page.button_payment_method":"Betaal {{formattedPrice}} met {{paymentMethod}}","payment_entry_page.button_with_price":"Betaal {{formattedPrice}}","price_update.title":"Prijsupdate","price_update.base_message":"De totale prijs is bijgewerkt met belasting op basis van uw factuuradres. Controleer en probeer het opnieuw. Uw kaart wordt slechts één keer belast.","price_update.trial_message":"De abonnementsprijs is bijgewerkt om belastingen op te nemen op basis van uw factuuradres. De gratis proefperiode blijft van toepassing. Controleer en probeer het opnieuw.","payment_entry_page.express_checkout_divider":"OF BETAAL MET EEN KAART","error_page.trouble_accessing":"Als je problemen hebt met het verkrijgen van toegang tot je aankoop, neem dan contact op met de ondersteuning via ","error_page.close_button_title":"Ga naar {{appName}}","error_page.error_title_stripe_missing_required_permission":"Ontbrekende Stripe-toestemming","error_page.button_close":"Sluiten","error_page.error_message_stripe_invalid_tax_origin_address":"De aankoop is mislukt omdat het belastingoorsprongadres ongeldig is. In productie werken aankopen zonder toegepaste belastingen.","error_page.error_message_stripe_tax_not_active":"De aankoop is mislukt omdat Stripe Tax niet is ingeschakeld. In productie werken aankopen zonder toegepaste belastingen.","error_page.error_only_in_sandbox":"Dit bericht verschijnt alleen in de sandbox.","error_page.error_message_stripe_missing_required_permission":"De aankoop is mislukt omdat de Stripe-app een vereiste toestemming mist. In productie werken aankopen zonder toegepaste belastingen.","error_page.error_title_stripe_tax_not_active":"Stripe Tax niet actief","error_page.error_title_stripe_invalid_tax_origin_address":"Ongeldig belastingoorsprongadres","apple_pay.free_trial":"Gratis proefperiode","product_info.price_after_intro_price":"Na {{introPriceDuration}}, op {{renewalDate}}","product_info.after_trial":"na proefperiode","product_info.after":"na","product_info.intro_price_phase_after_trial":"Daarna {{introPriceDuration}} voor {{introPrice}}","product_info.intro_price_phase":"Eerst {{introPriceDuration}} voor {{introPrice}}","product_info.intro_price_phase_paid_once":"eenmalig betaald","payment_entry_page.trial_subscription_terms_info":"Na afloop van uw proefperiode wordt {{price}} {{perFrequency}} in rekening gebracht, beginnend op {{renewalDate}}. U kunt op elk moment vóór deze datum annuleren.","payment_entry_page.subscription_info":"Abonnement wordt automatisch verlengd. Annuleer op elk moment.","payment_entry_page.otp_terms_info":"Door de aankoop ga je ermee akkoord dat {{appName}} kosten in rekening brengt volgens hun voorwaarden.","payment_entry_page.subscription_terms_info":"Door u te abonneren, stemt u ermee in dat {{appName}} u kosten in rekening brengt volgens hun voorwaarden totdat u annuleert."},GK={"periods.week":"{{amount}} viikko","periods.month":"{{amount}} kuukausi","periods.year":"{{amount}} vuosi","periods.day":"{{amount}} päivä","periods.weekShort":"{{amount}}vk","periods.monthShort":"{{amount}}kk","periods.yearShort":"{{amount}}v","periods.dayShort":"{{amount}}p","periods.lifetime":"elämäaika","periods.weekPlural":"{{amount}} viikkoa","periods.monthPlural":"{{amount}} kuukautta","periods.yearPlural":"{{amount}} vuotta","periods.dayPlural":"{{amount}} päivää","periods.weekFrequency":"viikoittain","periods.monthFrequency":"kuukausittain","periods.yearFrequency":"vuosittain","periods.dayFrequency":"päivittäin","periods.perWeekFrequency":"viikossa","periods.perMonthFrequency":"kuukaudessa","periods.perYearFrequency":"vuodessa","periods.perDayFrequency":"päivässä","periods.unknownFrequency":"tuntematon","periods.weekFrequencyPlural":"joka {{amount}} viikko","periods.monthFrequencyPlural":"joka {{amount}} kuukausi","periods.yearFrequencyPlural":"joka {{amount}} vuosi","periods.dayFrequencyPlural":"joka {{amount}} päivä","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} ilmainen kokeilujakso","product_info.price_after_free_trial":"Kokeilujakson päätyttyä, {{renewalDate}}","product_info.renewal_frequency":"Uusiutuu {{frequency}}","product_info.continues_until_cancelled":"Jatkuu, kunnes peruutetaan","product_info.cancel_anytime":"Peruuta milloin tahansa","payment_entry_page.payment_step_title":"Suojautunut kassatoiminto RevenueCatin kautta","payment_entry_page.button_pay":"Maksa nyt","payment_entry_page.button_start_trial":"Aloita kokeilujakso","success_page.purchase_successful":"Maksaminen onnistui","success_page.button_close":"Jatka","error_page.if_error_persists":"Jos virhe jatkuu, ota yhteyttä ","error_page.error_title_already_subscribed":"Olet jo tilannut tuotteen {{productTitle}}","error_page.error_title_already_purchased":"Olet jo ostanut tuotteen {{productTitle}}","error_page.error_title_other_errors":"Jokin meni pieleen","error_page.error_message_already_subscribed":"Et voi tilata tätä tuotetta uudelleen.","error_page.error_message_already_purchased":"Et voi ostaa tätä tuotetta uudelleen.","error_page.error_message_missing_email_error":"Sähköpostiosoite tarvitaan ostoksen loppuun saattamiseksi.","error_page.error_message_network_error":"Verkkovirhe. Tarkista internet-yhteytesi.","error_page.error_message_error_charging_payment":"Maksaminen epäonnistui.","error_page.error_message_error_setting_up_purchase":"Ostoa ei aloitettu virheen vuoksi (virhekoodi: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Emme voineet vahvistaa laskutusosoitettasi. Tarkista, että postinumero ja maa ovat oikein.","error_page.error_message_unknown_error":"Tapahtui tuntematon virhe (virhekoodi: {{errorCode}}).","error_page.button_try_again":"Yritä uudelleen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% alennus","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Maksettava summa tänään","product_info.subscribe_to":"Tilaa","navbar_header.details":"Yksityiskohdat","navbar_header.back_button":"Takaisin","pricing_dropdown.show_details":"Näytä tiedot","pricing_dropdown.hide_details":"Piilota tiedot","pricing_table.tax":"Vero","pricing_table.trial_ends":"Kokeilujakson päätyttyä, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Maksettava summa tänään","pricing_table.total_excluding_tax":"Veroton kokonaissumma","pricing_table.enter_billing_address_to_calculate":"Syötä laskutusosoite laskeaksesi","pricing_table.enter_state_or_postal_code_to_calculate":"Syötä osavaltio tai postinumero laskeaksesi","pricing_table.enter_postal_code_to_calculate":"Syötä postinumero laskeaksesi","error_page.error_message_invalid_email_error":"Sähköpostiosoitetta {{email}} ei voitu vahvistaa. Anna kelvollinen sähköpostiosoite.","payment_entry_page.button_payment_method":"Maksa {{formattedPrice}} käyttämällä {{paymentMethod}}","payment_entry_page.button_with_price":"Maksa {{formattedPrice}}","price_update.title":"Hinnan päivitys","price_update.base_message":"Kokonaishinta on päivitetty verolla laskutusosoitteesi perusteella. Tarkista ja yritä uudelleen. Korttiasi veloitetaan vain kerran.","price_update.trial_message":"Tilauksen hinta on päivitetty sisältämään verot laskutusosoitteesi perusteella. Ilmainen kokeilujakso on edelleen voimassa. Tarkista ja yritä uudelleen.","payment_entry_page.express_checkout_divider":"TAI MAKSA KORTILLA","error_page.trouble_accessing":"Jos sinulla on ongelmia ostoksesi käyttämisessä, ota yhteyttä tukeen osoitteessa ","error_page.close_button_title":"Siirry sovellukseen {{appName}}","error_page.error_title_stripe_missing_required_permission":"Puuttuva Stripe-käyttöoikeus","error_page.button_close":"Sulje","error_page.error_message_stripe_invalid_tax_origin_address":"Osto epäonnistui, koska veron alkuperäosoite on virheellinen. Tuotantoympäristössä ostot toimivat ilman veroja.","error_page.error_message_stripe_tax_not_active":"Osto epäonnistui, koska Stripe Tax ei ole käytössä. Tuotantoympäristössä ostot toimivat ilman veroja.","error_page.error_only_in_sandbox":"Tämä viesti näkyy vain hiekkalaatikossa.","error_page.error_message_stripe_missing_required_permission":"Osto epäonnistui, koska Stripe-sovellukselta puuttuu vaadittu käyttöoikeus. Tuotantoympäristössä ostot toimivat ilman veroja.","error_page.error_title_stripe_tax_not_active":"Stripe Tax ei ole aktiivinen","error_page.error_title_stripe_invalid_tax_origin_address":"Virheellinen veron alkuperäosoite","apple_pay.free_trial":"Ilmainen kokeilu","product_info.price_after_intro_price":"{{introPriceDuration}} jälkeen, {{renewalDate}}","product_info.after_trial":"kokeilujakson jälkeen","product_info.after":"jälkeen","product_info.intro_price_phase_after_trial":"Sitten {{introPriceDuration}} hintaan {{introPrice}}","product_info.intro_price_phase":"Ensimmäiset {{introPriceDuration}} hintaan {{introPrice}}","product_info.intro_price_phase_paid_once":"maksetaan kerran","payment_entry_page.trial_subscription_terms_info":"Kokeilujakson päätyttyä sinulta veloitetaan {{price}} {{perFrequency}} alkaen {{renewalDate}}. Voit peruuttaa milloin tahansa ennen tätä päivämäärää.","payment_entry_page.subscription_info":"Tilaus uusiutuu automaattisesti. Peruuta milloin tahansa.","payment_entry_page.otp_terms_info":"Ostamalla hyväksyt, että {{appName}} veloittaa sinua heidän ehtojensa mukaisesti.","payment_entry_page.subscription_terms_info":"Tilaamalla hyväksyt, että {{appName}} veloittaa sinulta ehtojensa mukaisesti, kunnes peruutat tilauksen."},WK={"periods.week":"{{amount}} semaine","periods.month":"{{amount}} mois","periods.year":"{{amount}} an","periods.day":"{{amount}} jour","periods.weekShort":"{{amount}}sem","periods.monthShort":"{{amount}}mois","periods.yearShort":"{{amount}}an","periods.dayShort":"{{amount}}j","periods.lifetime":"à vie","periods.weekPlural":"{{amount}} semaines","periods.monthPlural":"{{amount}} mois","periods.yearPlural":"{{amount}} ans","periods.dayPlural":"{{amount}} jours","periods.weekFrequency":"hebdomadaire","periods.monthFrequency":"mensuel","periods.yearFrequency":"annuel","periods.dayFrequency":"quotidien","periods.perWeekFrequency":"par semaine","periods.perMonthFrequency":"par mois","periods.perYearFrequency":"par an","periods.perDayFrequency":"par jour","periods.unknownFrequency":"inconnu","periods.weekFrequencyPlural":"toutes les {{amount}} semaines","periods.monthFrequencyPlural":"tous les {{amount}} mois","periods.yearFrequencyPlural":"tous les {{amount}} ans","periods.dayFrequencyPlural":"tous les {{amount}} jours","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} essai gratuit","product_info.price_after_free_trial":"Après la fin de l'essai, le {{renewalDate}}","product_info.renewal_frequency":"Renouvellement {{frequency}}","product_info.continues_until_cancelled":"Continue jusqu'à annulation","product_info.cancel_anytime":"Annulez à tout moment","payment_entry_page.payment_step_title":"Paiement sécurisé par RevenueCat","payment_entry_page.button_pay":"Payer maintenant","payment_entry_page.button_start_trial":"Commencer l'essai","success_page.purchase_successful":"Paiement effectué","success_page.button_close":"Continuer","error_page.if_error_persists":"Si l'erreur persiste, veuillez contacter ","error_page.error_title_already_subscribed":"Vous êtes déjà abonné à {{productTitle}}","error_page.error_title_already_purchased":"Vous avez déjà acheté {{productTitle}}","error_page.error_title_other_errors":"Une erreur s'est produite","error_page.error_message_already_subscribed":"Vous ne pouvez pas vous abonner à nouveau à ce produit.","error_page.error_message_already_purchased":"Vous ne pouvez pas acheter ce produit à nouveau.","error_page.error_message_missing_email_error":"L'adresse e-mail est requise pour effectuer l'achat.","error_page.error_message_network_error":"Erreur réseau. Veuillez vérifier votre connexion Internet.","error_page.error_message_error_charging_payment":"Échec du paiement.","error_page.error_message_error_setting_up_purchase":"L'achat n'a pas pu démarrer en raison d'une erreur (code d'erreur : {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nous n'avons pas pu vérifier votre adresse de facturation. Veuillez vérifier que le code postal et le pays sont corrects.","error_page.error_message_unknown_error":"Une erreur inconnue s'est produite (code d'erreur : {{errorCode}}).","error_page.button_try_again":"Réessayer","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% de réduction","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total dû aujourd'hui","product_info.subscribe_to":"S'abonner à","navbar_header.details":"Détails","navbar_header.back_button":"Retour","pricing_dropdown.show_details":"Afficher les détails","pricing_dropdown.hide_details":"Masquer les détails","pricing_table.tax":"Taxe","pricing_table.trial_ends":"Après la fin de l'essai, le {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total dû aujourd'hui","pricing_table.total_excluding_tax":"Total hors taxes","pricing_table.enter_billing_address_to_calculate":"Saisir l'adresse de facturation pour calculer","pricing_table.enter_state_or_postal_code_to_calculate":"Entrez l'état ou le code postal pour calculer","pricing_table.enter_postal_code_to_calculate":"Entrez le code postal pour calculer","error_page.error_message_invalid_email_error":"L'adresse e-mail {{email}} n'a pas pu être vérifiée. Veuillez fournir une adresse e-mail valide.","payment_entry_page.button_payment_method":"Payer {{formattedPrice}} avec {{paymentMethod}}","payment_entry_page.button_with_price":"Payer {{formattedPrice}}","price_update.title":"Mise à jour du prix","price_update.base_message":"Le prix total a été mis à jour avec la taxe en fonction de votre adresse de facturation. Veuillez vérifier et réessayer. Votre carte ne sera débitée qu'une seule fois.","price_update.trial_message":"Le prix de l'abonnement a été mis à jour pour inclure les taxes en fonction de votre adresse de facturation. La période d'essai gratuit reste applicable. Veuillez vérifier et réessayer.","payment_entry_page.express_checkout_divider":"OU PAYER PAR CARTE","error_page.trouble_accessing":"Si vous avez des difficultés à accéder à votre achat, contactez le support à l'adresse suivante : ","error_page.close_button_title":"Aller sur {{appName}}","error_page.error_title_stripe_missing_required_permission":"Autorisation Stripe manquante","error_page.button_close":"Fermer","error_page.error_message_stripe_invalid_tax_origin_address":"L'achat a échoué car l'adresse d'origine de la taxe n'est pas valide. En production, les achats fonctionneront sans taxes appliquées.","error_page.error_message_stripe_tax_not_active":"L'achat a échoué car Stripe Tax n'est pas activé. En production, les achats fonctionneront sans taxes appliquées.","error_page.error_only_in_sandbox":"Ce message apparaît uniquement dans l'environnement de test.","error_page.error_message_stripe_missing_required_permission":"L'achat a échoué car l'application Stripe ne dispose pas d'une autorisation requise. En production, les achats fonctionneront sans taxes appliquées.","error_page.error_title_stripe_tax_not_active":"Stripe Tax non actif","error_page.error_title_stripe_invalid_tax_origin_address":"Adresse d'origine de la taxe non valide","apple_pay.free_trial":"Essai gratuit","product_info.price_after_intro_price":"Après {{introPriceDuration}}, le {{renewalDate}}","product_info.after_trial":"après l'essai","product_info.after":"après","product_info.intro_price_phase_after_trial":"Puis {{introPriceDuration}} pour {{introPrice}}","product_info.intro_price_phase":"{{introPriceDuration}} pour {{introPrice}} au départ","product_info.intro_price_phase_paid_once":"payé une fois","payment_entry_page.trial_subscription_terms_info":"Après la fin de votre essai, vous serez facturé {{price}} {{perFrequency}} à partir du {{renewalDate}}. Vous pouvez annuler à tout moment avant cette date.","payment_entry_page.subscription_info":"L'abonnement est renouvelé automatiquement. Annulez à tout moment.","payment_entry_page.otp_terms_info":"En achetant, vous acceptez d'autoriser {{appName}} à vous facturer conformément à ses conditions.","payment_entry_page.subscription_terms_info":"En vous abonnant, vous acceptez d'autoriser {{appName}} à vous facturer conformément à ses conditions jusqu'à ce que vous annuliez."},KK={"periods.week":"{{amount}} Woche","periods.month":"{{amount}} Monat","periods.year":"{{amount}} Jahr","periods.day":"{{amount}} Tag","periods.weekShort":"{{amount}}Wo","periods.monthShort":"{{amount}}Mo","periods.yearShort":"{{amount}}J","periods.dayShort":"{{amount}}T","periods.lifetime":"lebenslang","periods.weekPlural":"{{amount}} Wochen","periods.monthPlural":"{{amount}} Monate","periods.yearPlural":"{{amount}} Jahre","periods.dayPlural":"{{amount}} Tage","periods.weekFrequency":"wöchentlich","periods.monthFrequency":"monatlich","periods.yearFrequency":"jährlich","periods.dayFrequency":"täglich","periods.perWeekFrequency":"pro Woche","periods.perMonthFrequency":"pro Monat","periods.perYearFrequency":"pro Jahr","periods.perDayFrequency":"pro Tag","periods.unknownFrequency":"unbekannt","periods.weekFrequencyPlural":"alle {{amount}} Wochen","periods.monthFrequencyPlural":"alle {{amount}} Monate","periods.yearFrequencyPlural":"alle {{amount}} Jahre","periods.dayFrequencyPlural":"alle {{amount}} Tage","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} kostenlose Testversion","product_info.price_after_free_trial":"Nach Ablauf der Testversion, am {{renewalDate}}","product_info.renewal_frequency":"Verlängert sich {{frequency}}","product_info.continues_until_cancelled":"Läuft bis zur Kündigung","product_info.cancel_anytime":"Jederzeit kündbar","payment_entry_page.payment_step_title":"Sicherer Checkout über RevenueCat","payment_entry_page.button_pay":"Jetzt bezahlen","payment_entry_page.button_start_trial":"Testversion starten","success_page.purchase_successful":"Zahlung abgeschlossen","success_page.button_close":"Weiter","error_page.if_error_persists":"Wenn der Fehler weiterhin besteht, wenden Sie sich bitte an ","error_page.error_title_already_subscribed":"Du hast {{productTitle}} bereits abonniert","error_page.error_title_already_purchased":"Du hast {{productTitle}} bereits gekauft","error_page.error_title_other_errors":"Etwas ist schief gelaufen","error_page.error_message_already_subscribed":"Du kannst dieses Produkt nicht erneut abonnieren.","error_page.error_message_already_purchased":"Du kannst dieses Produkt nicht erneut kaufen.","error_page.error_message_missing_email_error":"Für den Kauf ist eine E-Mail-Adresse erforderlich.","error_page.error_message_network_error":"Netzwerkfehler. Bitte überprüfen Sie Ihre Internetverbindung.","error_page.error_message_error_charging_payment":"Zahlung fehlgeschlagen.","error_page.error_message_error_setting_up_purchase":"Der Kauf wurde aufgrund eines Fehlers nicht gestartet (Fehlercode: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Wir konnten Ihre Rechnungsadresse nicht überprüfen. Bitte überprüfen Sie, ob die Postleitzahl und das Land korrekt sind.","error_page.error_message_unknown_error":"Ein unbekannter Fehler ist aufgetreten (Fehlercode: {{errorCode}}).","error_page.button_try_again":"Erneut versuchen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% Rabatt","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Heute fälliger Gesamtbetrag","product_info.subscribe_to":"Abonnieren","navbar_header.details":"Details","navbar_header.back_button":"Zurück","pricing_dropdown.show_details":"Details anzeigen","pricing_dropdown.hide_details":"Details ausblenden","pricing_table.tax":"Steuer","pricing_table.trial_ends":"Nach Ablauf der Testphase, am {{formattedTrialEndDate}}","pricing_table.total_due_today":"Heute fälliger Gesamtbetrag","pricing_table.total_excluding_tax":"Gesamtbetrag ohne Steuer","pricing_table.enter_billing_address_to_calculate":"Rechnungsadresse eingeben, um zu berechnen","pricing_table.enter_state_or_postal_code_to_calculate":"Bundesland oder Postleitzahl zur Berechnung eingeben","pricing_table.enter_postal_code_to_calculate":"Postleitzahl zur Berechnung eingeben","error_page.error_message_invalid_email_error":"Die E-Mail-Adresse {{email}} konnte nicht verifiziert werden. Bitte gib eine gültige E-Mail-Adresse an.","payment_entry_page.button_payment_method":"Mit {{paymentMethod}} für {{formattedPrice}} bezahlen","payment_entry_page.button_with_price":"{{formattedPrice}} bezahlen","price_update.title":"Preisaktualisierung","price_update.base_message":"Der Gesamtpreis wurde basierend auf Ihrer Rechnungsadresse mit Steuern aktualisiert. Bitte überprüfen Sie ihn und versuchen Sie es erneut. Ihre Karte wird erst belastet, wenn alles korrekt ist.","price_update.trial_message":"Der Abonnementpreis wurde aktualisiert, um Steuern basierend auf Ihrer Rechnungsadresse einzuschließen. Die kostenlose Testphase gilt weiterhin. Bitte überprüfen Sie und versuchen Sie es erneut.","payment_entry_page.express_checkout_divider":"ODER MIT KARTE ZAHLEN","error_page.trouble_accessing":"Wenn Sie Probleme beim Zugriff auf Ihren Kauf haben, wenden Sie sich an den Support unter ","error_page.close_button_title":"Zu {{appName}} gehen","error_page.error_title_stripe_missing_required_permission":"Fehlende Stripe-Berechtigung","error_page.button_close":"Schließen","error_page.error_message_stripe_invalid_tax_origin_address":"Der Kauf ist fehlgeschlagen, da die Steuerursprungsadresse ungültig ist. In der Produktion funktionieren Käufe ohne angewendete Steuern.","error_page.error_message_stripe_tax_not_active":"Der Kauf ist fehlgeschlagen, da Stripe Tax nicht aktiviert ist. In der Produktion funktionieren Käufe ohne angewendete Steuern.","error_page.error_only_in_sandbox":"Diese Meldung wird nur in der Sandbox angezeigt.","error_page.error_message_stripe_missing_required_permission":"Der Kauf ist fehlgeschlagen, da der Stripe-App eine erforderliche Berechtigung fehlt. In der Produktion funktionieren Käufe ohne angewendete Steuern.","error_page.error_title_stripe_tax_not_active":"Stripe Tax ist nicht aktiv","error_page.error_title_stripe_invalid_tax_origin_address":"Ungültige Steuerursprungsadresse","apple_pay.free_trial":"Kostenlose Testversion","product_info.price_after_intro_price":"Nach {{introPriceDuration}}, am {{renewalDate}}","product_info.after_trial":"nach Testphase","product_info.after":"nach","product_info.intro_price_phase_after_trial":"Danach {{introPriceDuration}} für {{introPrice}}","product_info.intro_price_phase":"Zuerst {{introPriceDuration}} für {{introPrice}}","product_info.intro_price_phase_paid_once":"einmalig bezahlt","payment_entry_page.trial_subscription_terms_info":"Nach Ablauf Ihres Testzeitraums werden Ihnen {{price}} {{perFrequency}} ab dem {{renewalDate}} berechnet. Sie können jederzeit vor diesem Datum kündigen.","payment_entry_page.subscription_info":"Das Abonnement verlängert sich automatisch. Jederzeit kündbar.","payment_entry_page.otp_terms_info":"Mit dem Kauf erklären Sie sich einverstanden, dass {{appName}} Ihnen Gebühren gemäß ihren Bedingungen berechnet.","payment_entry_page.subscription_terms_info":"Mit dem Abonnieren erklären Sie sich damit einverstanden, dass {{appName}} Ihnen gemäß ihren Bedingungen Gebühren berechnet, bis Sie kündigen."},YK={"periods.week":"{{amount}} εβδομάδα","periods.month":"{{amount}} μήνας","periods.year":"{{amount}} χρόνος","periods.day":"{{amount}} ημέρα","periods.weekShort":"{{amount}} εβδ.","periods.monthShort":"{{amount}} μήν.","periods.yearShort":"{{amount}} έτ.","periods.dayShort":"{{amount}} ημ.","periods.lifetime":"διάρκεια ζωής","periods.weekPlural":"{{amount}} εβδομάδες","periods.monthPlural":"{{amount}} μήνες","periods.yearPlural":"{{amount}} χρόνια","periods.dayPlural":"{{amount}} ημέρες","periods.weekFrequency":"εβδομαδιαία","periods.monthFrequency":"μηνιαία","periods.yearFrequency":"ετήσια","periods.dayFrequency":"καθημερινά","periods.perWeekFrequency":"ανά εβδομάδα","periods.perMonthFrequency":"ανά μήνα","periods.perYearFrequency":"ανά έτος","periods.perDayFrequency":"ανά ημέρα","periods.unknownFrequency":"άγνωστο","periods.weekFrequencyPlural":"κάθε {{amount}} εβδομάδες","periods.monthFrequencyPlural":"κάθε {{amount}} μήνες","periods.yearFrequencyPlural":"κάθε {{amount}} χρόνια","periods.dayFrequencyPlural":"κάθε {{amount}} ημέρες","product_info.subscribe_to":"Εγγραφείτε στο","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"Δωρεάν για {{trialDuration}}","product_info.price_after_free_trial":"Μετά τη λήξη της δοκιμής, στις {{renewalDate}}","product_info.total_due_today":"Σύνολο πληρωτέο σήμερα","product_info.renewal_frequency":"Ανανεώνεται {{frequency}}","product_info.continues_until_cancelled":"Συνεχίζεται μέχρι την ακύρωση","product_info.cancel_anytime":"Ακύρωση ανά πάσα στιγμή","payment_entry_page.payment_step_title":"Ασφαλής ολοκλήρωση αγοράς από την RevenueCat","payment_entry_page.button_pay":"Πληρωμή τώρα","payment_entry_page.button_start_trial":"Έναρξη δοκιμής","success_page.purchase_successful":"Η πληρωμή ολοκληρώθηκε","success_page.button_close":"Συνέχεια","error_page.if_error_persists":"Εάν το σφάλμα παραμένει, επικοινωνήστε με ","error_page.error_title_already_subscribed":"Έχετε ήδη εγγραφεί στο {{productTitle}}","error_page.error_title_already_purchased":"Έχετε ήδη αγοράσει το {{productTitle}}","error_page.error_title_other_errors":"Κάτι πήγε στραβά","error_page.error_message_already_subscribed":"Δεν μπορείτε να εγγραφείτε ξανά σε αυτό το προϊόν.","error_page.error_message_already_purchased":"Δεν μπορείτε να αγοράσετε ξανά αυτό το προϊόν.","error_page.error_message_missing_email_error":"Απαιτείται email για την ολοκλήρωση της αγοράς.","error_page.error_message_network_error":"Σφάλμα δικτύου. Ελέγξτε τη σύνδεσή σας στο διαδίκτυο.","error_page.error_message_error_charging_payment":"Η πληρωμή απέτυχε.","error_page.error_message_error_setting_up_purchase":"Η αγορά δεν ξεκίνησε λόγω σφάλματος (κωδικός σφάλματος: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Δεν μπορέσαμε να επαληθεύσουμε τη διεύθυνση χρέωσής σας. Παρακαλούμε ελέγξτε ξανά τον ταχυδρομικό κώδικα και τη χώρα για να βεβαιωθείτε ότι είναι σωστά.","error_page.error_message_unknown_error":"Παρουσιάστηκε ένα άγνωστο σφάλμα (κωδικός σφάλματος: {{errorCode}}).","error_page.button_try_again":"Προσπαθήστε ξανά","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% έκπτωση","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","navbar_header.details":"Λεπτομέρειες","navbar_header.back_button":"Πίσω","pricing_dropdown.show_details":"Εμφάνιση λεπτομερειών","pricing_dropdown.hide_details":"Απόκρυψη λεπτομερειών","pricing_table.tax":"Φόρος","pricing_table.trial_ends":"Μετά τη λήξη της δοκιμαστικής περιόδου, στις {{formattedTrialEndDate}}","pricing_table.total_due_today":"Σύνολο πληρωτέο σήμερα","pricing_table.total_excluding_tax":"Σύνολο χωρίς φόρο","pricing_table.enter_billing_address_to_calculate":"Εισαγάγετε τη διεύθυνση χρέωσης για να υπολογιστεί","pricing_table.enter_state_or_postal_code_to_calculate":"Εισαγάγετε την πολιτεία ή τον ταχυδρομικό κώδικα για να υπολογιστεί","pricing_table.enter_postal_code_to_calculate":"Εισαγάγετε τον ταχυδρομικό κώδικα για να υπολογιστεί","error_page.error_message_invalid_email_error":"Η διεύθυνση email {{email}} δεν μπόρεσε να επαληθευτεί. Παρακαλώ δώστε μια έγκυρη διεύθυνση email.","payment_entry_page.button_payment_method":"Πληρωμή {{formattedPrice}} με {{paymentMethod}}","payment_entry_page.button_with_price":"Πληρωμή {{formattedPrice}}","price_update.title":"Ενημέρωση τιμής","price_update.base_message":"Η συνολική τιμή ενημερώθηκε με τον φόρο βάσει της διεύθυνσης χρέωσής σας. Ελέγξτε και δοκιμάστε ξανά. Η κάρτα σας θα χρεωθεί μόνο μία φορά.","price_update.trial_message":"Η τιμή της συνδρομής ενημερώθηκε για να συμπεριλάβει τους φόρους βάσει της διεύθυνσης χρέωσής σας. Η δωρεάν δοκιμαστική περίοδος εξακολουθεί να ισχύει. Παρακαλώ ελέγξτε και δοκιμάστε ξανά.","payment_entry_page.express_checkout_divider":"Ή ΠΛΗΡΩΣΤΕ ΜΕ ΚΑΡΤΑ","error_page.trouble_accessing":"Εάν αντιμετωπίζετε προβλήματα πρόσβασης στην αγορά σας, επικοινωνήστε με την υποστήριξη στο ","error_page.close_button_title":"Μετάβαση στο {{appName}}","error_page.error_title_stripe_missing_required_permission":"Λείπει άδεια Stripe","error_page.button_close":"Κλείσιμο","error_page.error_message_stripe_invalid_tax_origin_address":"Η αγορά απέτυχε επειδή η διεύθυνση προέλευσης φόρου δεν είναι έγκυρη. Στην παραγωγή, οι αγορές θα λειτουργούν χωρίς να εφαρμόζονται φόροι.","error_page.error_message_stripe_tax_not_active":"Η αγορά απέτυχε επειδή το Stripe Tax δεν είναι ενεργοποιημένο. Στην παραγωγή, οι αγορές θα λειτουργούν χωρίς να εφαρμόζονται φόροι.","error_page.error_only_in_sandbox":"Αυτό το μήνυμα εμφανίζεται μόνο στο sandbox.","error_page.error_message_stripe_missing_required_permission":"Η αγορά απέτυχε επειδή η εφαρμογή Stripe δεν διαθέτει την απαιτούμενη άδεια. Στην παραγωγή, οι αγορές θα λειτουργούν χωρίς να εφαρμόζονται φόροι.","error_page.error_title_stripe_tax_not_active":"Το Stripe Tax δεν είναι ενεργό","error_page.error_title_stripe_invalid_tax_origin_address":"Μη έγκυρη διεύθυνση προέλευσης φόρου","apple_pay.free_trial":"Δωρεάν δοκιμή","product_info.price_after_intro_price":"Μετά από {{introPriceDuration}}, στις {{renewalDate}}","product_info.after_trial":"μετά τη δοκιμή","product_info.after":"μετά","product_info.intro_price_phase_after_trial":"Έπειτα {{introPriceDuration}} για {{introPrice}}","product_info.intro_price_phase":"Αρχικά {{introPriceDuration}} για {{introPrice}}","product_info.intro_price_phase_paid_once":"πληρωμένο εφάπαξ","payment_entry_page.trial_subscription_terms_info":"Μετά τη λήξη της δοκιμαστικής περιόδου, θα χρεωθείτε {{price}} {{perFrequency}} ξεκινώντας από {{renewalDate}}. Μπορείτε να ακυρώσετε ανά πάσα στιγμή πριν από αυτήν την ημερομηνία.","payment_entry_page.subscription_info":"Η συνδρομή ανανεώνεται αυτόματα. Ακυρώστε ανά πάσα στιγμή.","payment_entry_page.otp_terms_info":"Με την αγορά, συμφωνείτε να επιτρέψετε στην {{appName}} να σας χρεώσει σύμφωνα με τους όρους της.","payment_entry_page.subscription_terms_info":"Με την εγγραφή σας, συμφωνείτε να επιτρέψετε στην εφαρμογή {{appName}} να σας χρεώνει σύμφωνα με τους όρους της έως ότου ακυρώσετε."},XK={"periods.week":"{{amount}} שבוע","periods.month":"{{amount}} חודש","periods.year":"{{amount}} שנה","periods.day":"{{amount}} יום","periods.weekShort":"{{amount}}wk","periods.monthShort":"{{amount}}mo","periods.yearShort":"{{amount}}yr","periods.dayShort":"{{amount}}d","periods.lifetime":"למשך כל החיים","periods.weekPlural":"{{amount}} שבועות","periods.monthPlural":"{{amount}} חודשים","periods.yearPlural":"{{amount}} שנים","periods.dayPlural":"{{amount}} ימים","periods.weekFrequency":"שבועי","periods.monthFrequency":"חודשי","periods.yearFrequency":"שנתי","periods.dayFrequency":"יומי","periods.perWeekFrequency":"לשבוע","periods.perMonthFrequency":"לחודש","periods.perYearFrequency":"לשנה","periods.perDayFrequency":"ליום","periods.unknownFrequency":"לא ידוע","periods.weekFrequencyPlural":"כל {{amount}} שבועות","periods.monthFrequencyPlural":"כל {{amount}} חודשים","periods.yearFrequencyPlural":"כל {{amount}} שנים","periods.dayFrequencyPlural":"כל {{amount}} ימים","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} ניסיון חינם","product_info.price_after_free_trial":"לאחר סיום הניסיון, ב-{{renewalDate}}","product_info.renewal_frequency":"מתחדש {{frequency}}","product_info.continues_until_cancelled":"נמשך עד ביטול","product_info.cancel_anytime":"ניתן לבטל בכל עת","payment_entry_page.payment_step_title":"קופה מאובטחת באמצעות RevenueCat","payment_entry_page.button_pay":"שלם עכשיו","payment_entry_page.button_start_trial":"התחל ניסיון","success_page.purchase_successful":"התשלום הושלם","success_page.button_close":"המשך","error_page.if_error_persists":"אם השגיאה נמשכת, אנא פנה אל ","error_page.error_title_already_subscribed":"כבר נרשמת כמנוי ל-{{productTitle}}","error_page.error_title_already_purchased":"כבר רכשת את {{productTitle}}","error_page.error_title_other_errors":"משהו השתבש","error_page.error_message_already_subscribed":"אינך יכול להירשם כמנוי למוצר זה שוב.","error_page.error_message_already_purchased":"אינך יכול לרכוש מוצר זה שוב.","error_page.error_message_missing_email_error":'דוא"ל נדרש כדי להשלים את הרכישה.',"error_page.error_message_network_error":"שגיאת רשת. אנא בדוק את חיבור האינטרנט שלך.","error_page.error_message_error_charging_payment":"התשלום נכשל.","error_page.error_message_error_setting_up_purchase":"הרכישה לא הופעלה עקב שגיאה (קוד שגיאה: {{errorCode}}).","error_page.error_message_invalid_tax_location":"לא הצלחנו לאמת את כתובת החיוב שלך. אנא בדוק שוב את המיקוד והמדינה כדי לוודא שהם נכונים.","error_page.error_message_unknown_error":"אירעה שגיאה לא ידועה (קוד שגיאה: {{errorCode}}).","error_page.button_try_again":"נסה שוב","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% הנחה","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":'סה"כ לתשלום היום',"product_info.subscribe_to":"הירשם כמנוי ל-","navbar_header.details":"פרטים","navbar_header.back_button":"חזרה","pricing_dropdown.show_details":"הצג פרטים","pricing_dropdown.hide_details":"הסתר פרטים","pricing_table.tax":"מס","pricing_table.trial_ends":"לאחר סיום תקופת הניסיון, בתאריך {{formattedTrialEndDate}}","pricing_table.total_due_today":"סך הכל לתשלום היום","pricing_table.total_excluding_tax":"סך הכל לא כולל מס","pricing_table.enter_billing_address_to_calculate":"הזן כתובת לחיוב כדי לחשב","pricing_table.enter_state_or_postal_code_to_calculate":"הזן מדינה או מיקוד לחישוב","pricing_table.enter_postal_code_to_calculate":"הזן מיקוד לחישוב","error_page.error_message_invalid_email_error":"לא ניתן לאמת את כתובת האימייל {{email}}. אנא ספק כתובת אימייל חוקית.","payment_entry_page.button_payment_method":"שלם {{formattedPrice}} באמצעות {{paymentMethod}}","payment_entry_page.button_with_price":"שלם {{formattedPrice}}","price_update.title":"עדכון מחיר","price_update.base_message":"המחיר הכולל עודכן עם מס בהתבסס על כתובת החיוב שלך. אנא בדוק שוב ונסה שוב. החיוב יתבצע רק פעם אחת.","price_update.trial_message":"מחיר המנוי עודכן כדי לכלול מיסים בהתבסס על כתובת החיוב שלך. תקופת הניסיון החינמית עדיין תקפה. אנא בדוק ונסה שוב.","payment_entry_page.express_checkout_divider":"או שלם באמצעות כרטיס","error_page.trouble_accessing":"אם אתה מתקשה לגשת לרכישה שלך, פנה לתמיכה בכתובת ","error_page.close_button_title":"עבור אל {{appName}}","error_page.error_title_stripe_missing_required_permission":"חסרה הרשאה של Stripe","error_page.button_close":"סגור","error_page.error_message_stripe_invalid_tax_origin_address":"הרכישה נכשלה מכיוון שכתובת מקור המס אינה חוקית. בייצור, רכישות יעבדו ללא מסים.","error_page.error_message_stripe_tax_not_active":"הרכישה נכשלה מכיוון שמס Stripe אינו מופעל. בייצור, רכישות יעבדו ללא מסים.","error_page.error_only_in_sandbox":"הודעה זו מופיעה רק בארגז חול.","error_page.error_message_stripe_missing_required_permission":"הרכישה נכשלה מכיוון שלאפליקציית Stripe חסרה הרשאה נדרשת. בייצור, רכישות יעבדו ללא מסים.","error_page.error_title_stripe_tax_not_active":"מס Stripe לא פעיל","error_page.error_title_stripe_invalid_tax_origin_address":"כתובת מקור מס לא חוקית","apple_pay.free_trial":"תקופת ניסיון בחינם","product_info.price_after_intro_price":"לאחר {{introPriceDuration}}, בתאריך {{renewalDate}}","product_info.after_trial":"אחרי תקופת ניסיון","product_info.after":"אחרי","product_info.intro_price_phase_after_trial":"אחר כך {{introPriceDuration}} עבור {{introPrice}}","product_info.intro_price_phase":"תחילה {{introPriceDuration}} עבור {{introPrice}}","product_info.intro_price_phase_paid_once":"משולם פעם אחת","payment_entry_page.trial_subscription_terms_info":"לאחר סיום תקופת הניסיון שלך, תחויב בסך {{price}} {{perFrequency}} החל מ-{{renewalDate}}. באפשרותך לבטל בכל עת לפני תאריך זה.","payment_entry_page.subscription_info":"המנוי מתחדש אוטומטית. ניתן לבטל בכל עת.","payment_entry_page.otp_terms_info":"ברכישה, אתה מסכים לאפשר ל-{{appName}} לחייב אותך בהתאם לתנאים שלהם.","payment_entry_page.subscription_terms_info":"על ידי הרשמה כמנוי, אתה מסכים לאפשר ל-{{appName}} לחייב אותך בהתאם לתנאים שלהם עד שתבטל."},JK={"periods.week":"{{amount}} सप्ताह","periods.month":"{{amount}} महीना","periods.year":"{{amount}} वर्ष","periods.day":"{{amount}} दिन","periods.weekShort":"{{amount}}सप्ताह","periods.monthShort":"{{amount}}महीना","periods.yearShort":"{{amount}}वर्ष","periods.dayShort":"{{amount}}दिन","periods.lifetime":"लाइफ़टाइम","periods.weekPlural":"{{amount}} सप्ताह","periods.monthPlural":"{{amount}} महीने","periods.yearPlural":"{{amount}} वर्ष","periods.dayPlural":"{{amount}} दिन","periods.weekFrequency":"साप्ताहिक","periods.monthFrequency":"मासिक","periods.yearFrequency":"वार्षिक","periods.dayFrequency":"दैनिक","periods.perWeekFrequency":"प्रति सप्ताह","periods.perMonthFrequency":"प्रति माह","periods.perYearFrequency":"प्रति वर्ष","periods.perDayFrequency":"प्रति दिन","periods.unknownFrequency":"अज्ञात","periods.weekFrequencyPlural":"प्रत्येक {{amount}} सप्ताह","periods.monthFrequencyPlural":"प्रत्येक {{amount}} महीने","periods.yearFrequencyPlural":"प्रत्येक {{amount}} वर्ष","periods.dayFrequencyPlural":"प्रत्येक {{amount}} दिन","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} निःशुल्क परीक्षण","product_info.price_after_free_trial":"परीक्षण समाप्त होने के बाद, {{renewalDate}} को","product_info.renewal_frequency":"{{frequency}} पर नवीनीकृत होता है","product_info.continues_until_cancelled":"रद्द होने तक जारी रहता है","product_info.cancel_anytime":"किसी भी समय रद्द करें","payment_entry_page.payment_step_title":"RevenueCat द्वारा सुरक्षित चेकआउट","payment_entry_page.button_pay":"अभी भुगतान करें","payment_entry_page.button_start_trial":"परीक्षण प्रारंभ करें","success_page.purchase_successful":"भुगतान पूर्ण","success_page.button_close":"जारी रखें","error_page.if_error_persists":"यदि त्रुटि बनी रहती है, तो कृपया संपर्क करें ","error_page.error_title_already_subscribed":"आपने पहले ही {{productTitle}} की सदस्यता ले ली है","error_page.error_title_already_purchased":"आपने पहले ही {{productTitle}} खरीद लिया है","error_page.error_title_other_errors":"कुछ गलत हो गया","error_page.error_message_already_subscribed":"आप इस उत्पाद की सदस्यता फिर से नहीं ले सकते.","error_page.error_message_already_purchased":"आप इस उत्पाद को फिर से नहीं खरीद सकते.","error_page.error_message_missing_email_error":"खरीद को पूरा करने के लिए ईमेल आवश्यक है।","error_page.error_message_network_error":"नेटवर्क त्रुटि। कृपया अपना इंटरनेट कनेक्शन जांचें।","error_page.error_message_error_charging_payment":"भुगतान विफल।","error_page.error_message_error_setting_up_purchase":"किसी त्रुटि के कारण खरीदारी शुरू नहीं हुई (त्रुटि कोड: {{errorCode}})।","error_page.error_message_invalid_tax_location":"हम आपके बिलिंग पते को सत्यापित नहीं कर सके। कृपया सुनिश्चित करें कि पिन कोड और देश सही हैं।","error_page.error_message_unknown_error":"एक अज्ञात त्रुटि हुई (त्रुटि कोड: {{errorCode}})।","error_page.button_try_again":"फिर से कोशिश करें","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% छूट","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"आज देय कुल राशि","product_info.subscribe_to":"सदस्यता लें","navbar_header.details":"विवरण","navbar_header.back_button":"वापस","pricing_dropdown.show_details":"विवरण दिखाएँ","pricing_dropdown.hide_details":"विवरण छिपाएँ","pricing_table.tax":"कर","pricing_table.trial_ends":"{{formattedTrialEndDate}} पर परीक्षण समाप्त होने के बाद","pricing_table.total_due_today":"आज देय कुल","pricing_table.total_excluding_tax":"कर को छोड़कर कुल","pricing_table.enter_billing_address_to_calculate":"गणना करने के लिए बिलिंग पता दर्ज करें","pricing_table.enter_state_or_postal_code_to_calculate":"गणना करने के लिए राज्य या ज़िप कोड दर्ज करें","pricing_table.enter_postal_code_to_calculate":"गणना करने के लिए ज़िप कोड दर्ज करें","error_page.error_message_invalid_email_error":"ईमेल पता {{email}} सत्यापित नहीं किया जा सका. कृपया एक मान्य ईमेल पता प्रदान करें.","payment_entry_page.button_payment_method":"{{paymentMethod}} के साथ {{formattedPrice}} का भुगतान करें","payment_entry_page.button_with_price":"{{formattedPrice}} का भुगतान करें","price_update.title":"मूल्य अपडेट","price_update.base_message":"आप के बिलिंग पते के आधार पर कुल कीमत कर के साथ अपडेट की गई थी। कृपया समीक्षा करें और फिर से प्रयास करें। आपके कार्ड से केवल एक बार शुल्क लिया जाएगा।","price_update.trial_message":"सदस्यता मूल्य आपके बिलिंग पते के आधार पर करों को शामिल करने के लिए अपडेट किया गया है। निःशुल्क परीक्षण अवधि अभी भी लागू है। कृपया जांचें और पुनः प्रयास करें।","payment_entry_page.express_checkout_divider":"या कार्ड से भुगतान करें","error_page.trouble_accessing":"यदि आपको अपनी खरीदारी तक पहुंचने में परेशानी हो रही है, तो पर समर्थन के लिए संपर्क करें","error_page.close_button_title":"{{appName}} पर जाएं","error_page.error_title_stripe_missing_required_permission":"स्ट्राइप अनुमति गुम है","error_page.button_close":"बंद करें","error_page.error_message_stripe_invalid_tax_origin_address":"खरीदारी विफल रही क्योंकि कर उत्पत्ति पता अमान्य है. उत्पादन में, खरीदारी बिना करों के लागू किए काम करेगी.","error_page.error_message_stripe_tax_not_active":"खरीदारी विफल रही क्योंकि स्ट्राइप टैक्स सक्षम नहीं है. उत्पादन में, खरीदारी बिना करों के लागू किए काम करेगी.","error_page.error_only_in_sandbox":"यह संदेश केवल सैंडबॉक्स में दिखाई देता है.","error_page.error_message_stripe_missing_required_permission":"खरीदारी विफल रही क्योंकि स्ट्राइप ऐप में आवश्यक अनुमति नहीं है. उत्पादन में, खरीदारी बिना करों के लागू किए काम करेगी.","error_page.error_title_stripe_tax_not_active":"स्ट्राइप टैक्स सक्रिय नहीं है","error_page.error_title_stripe_invalid_tax_origin_address":"अमान्य कर उत्पत्ति पता","apple_pay.free_trial":"मुफ़्त ट्रायल","product_info.price_after_intro_price":"{{introPriceDuration}} के बाद, {{renewalDate}} पर","product_info.after_trial":"ट्रायल के बाद","product_info.after":"के बाद","product_info.intro_price_phase_after_trial":"फिर {{introPriceDuration}} के लिए {{introPrice}}","product_info.intro_price_phase":"पहले {{introPriceDuration}} के लिए {{introPrice}}","product_info.intro_price_phase_paid_once":"एक बार भुगतान किया गया","payment_entry_page.trial_subscription_terms_info":"आपकी परीक्षण अवधि समाप्त होने के बाद, आपसे {{renewalDate}} से शुरू होकर {{price}} {{perFrequency}} शुल्क लिया जाएगा. आप इस तिथि से पहले कभी भी रद्द कर सकते हैं.","payment_entry_page.subscription_info":"सदस्यता स्वतः नवीनीकृत हो जाती है. कभी भी रद्द करें.","payment_entry_page.otp_terms_info":"खरीदकर, आप {{appName}} को उनकी शर्तों के अनुसार आपसे शुल्क लेने की अनुमति देने के लिए सहमत हैं.","payment_entry_page.subscription_terms_info":"सदस्यता लेकर, आप {{appName}} को रद्द करने तक उनकी शर्तों के अनुसार आपसे शुल्क लेने की अनुमति देने के लिए सहमत हैं."},QK={"periods.week":"{{amount}} hét","periods.month":"{{amount}} hónap","periods.year":"{{amount}} év","periods.day":"{{amount}} nap","periods.weekShort":"{{amount}}hét","periods.monthShort":"{{amount}}hó","periods.yearShort":"{{amount}}év","periods.dayShort":"{{amount}}n","periods.lifetime":"életre szóló","periods.weekPlural":"{{amount}} hét","periods.monthPlural":"{{amount}} hónap","periods.yearPlural":"{{amount}} év","periods.dayPlural":"{{amount}} nap","periods.weekFrequency":"heti","periods.monthFrequency":"havi","periods.yearFrequency":"éves","periods.dayFrequency":"napi","periods.perWeekFrequency":"hetente","periods.perMonthFrequency":"havonta","periods.perYearFrequency":"évente","periods.perDayFrequency":"naponta","periods.unknownFrequency":"ismeretlen","periods.weekFrequencyPlural":"minden {{amount}} hétben","periods.monthFrequencyPlural":"minden {{amount}} hónapban","periods.yearFrequencyPlural":"minden {{amount}} évben","periods.dayFrequencyPlural":"minden {{amount}} napban","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} próbaidőszak","product_info.price_after_free_trial":"A próbaidőszak vége után, {{renewalDate}}-kor","product_info.renewal_frequency":"{{frequency}} gyakorisággal megújul","product_info.continues_until_cancelled":"Folytatódik, amíg le nem mondják","product_info.cancel_anytime":"Bármikor lemondható","payment_entry_page.payment_step_title":"Biztonságos fizetés a RevenueCat-en keresztül","payment_entry_page.button_pay":"Fizetés most","payment_entry_page.button_start_trial":"Próbaidőszak indítása","success_page.purchase_successful":"Fizetés sikeres","success_page.button_close":"Tovább","error_page.if_error_persists":"Ha a hiba továbbra is fennáll, kérjük, vedd fel a kapcsolatot ","error_page.error_title_already_subscribed":"Már előfizettél a(z) {{productTitle}} termékre","error_page.error_title_already_purchased":"Már megvásároltad a(z) {{productTitle}} terméket","error_page.error_title_other_errors":"Valami hiba történt","error_page.error_message_already_subscribed":"Nem fizethetsz elő újra erre a termékre.","error_page.error_message_already_purchased":"Nem vásárolhatod meg újra ezt a terméket.","error_page.error_message_missing_email_error":"Az email cím szükséges a vásárlás befejezéséhez.","error_page.error_message_network_error":"Hálózati hiba. Kérjük, ellenőrizd az internetkapcsolatodat.","error_page.error_message_error_charging_payment":"A fizetés sikertelen volt.","error_page.error_message_error_setting_up_purchase":"Hiba miatt nem indult el a vásárlás (hibakód: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nem tudtuk ellenőrizni a számlázási címét. Kérjük, ellenőrizze, hogy az irányítószám és az ország helyes-e.","error_page.error_message_unknown_error":"Ismeretlen hiba történt (hibakód: {{errorCode}}).","error_page.button_try_again":"Újrapróbálkozás","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% kedvezmény","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Ma fizetendő összesen","product_info.subscribe_to":"Feliratkozás erre:","navbar_header.details":"Részletek","navbar_header.back_button":"Vissza","pricing_dropdown.show_details":"Részletek mutatása","pricing_dropdown.hide_details":"Részletek elrejtése","pricing_table.tax":"Adó","pricing_table.trial_ends":"A próbaidőszak vége: {{formattedTrialEndDate}}","pricing_table.total_due_today":"Ma fizetendő összeg","pricing_table.total_excluding_tax":"Összesen adó nélkül","pricing_table.enter_billing_address_to_calculate":"Adja meg a számlázási címet a számításhoz","pricing_table.enter_state_or_postal_code_to_calculate":"Adja meg az államot vagy az irányítószámot a számításhoz","pricing_table.enter_postal_code_to_calculate":"Adja meg az irányítószámot a számításhoz","error_page.error_message_invalid_email_error":"A(z) {{email}} e-mail címet nem sikerült ellenőrizni. Kérjük, adj meg egy érvényes e-mail címet.","payment_entry_page.button_payment_method":"Fizetés {{formattedPrice}} összeggel a következővel: {{paymentMethod}}","payment_entry_page.button_with_price":"Fizetés {{formattedPrice}}","price_update.title":"Ár frissítése","price_update.base_message":"A teljes ár frissítve lett az adóval a számlázási címed alapján. Kérjük, tekintsd át és próbáld újra. A kártyádat csak egyszer terheljük meg.","price_update.trial_message":"Az előfizetés ára adókkal együtt frissítésre került a számlázási címének megfelelően. Az ingyenes próbaidőszak továbbra is érvényes. Kérjük, ellenőrizze és próbálja újra.","payment_entry_page.express_checkout_divider":"VAGY FIZESSEN KÁRTYÁVAL","error_page.trouble_accessing":"Ha problémái vannak a vásárláshoz való hozzáféréssel, forduljon az ügyfélszolgálathoz a következő címen: ","error_page.close_button_title":"Ugrás a(z) {{appName}} alkalmazáshoz","error_page.error_title_stripe_missing_required_permission":"Hiányzó Stripe engedély","error_page.button_close":"Bezárás","error_page.error_message_stripe_invalid_tax_origin_address":"A vásárlás sikertelen volt, mert az adókiindulási cím érvénytelen. Éles környezetben a vásárlások adók alkalmazása nélkül fognak működni.","error_page.error_message_stripe_tax_not_active":"A vásárlás sikertelen volt, mert a Stripe adó nincs engedélyezve. Éles környezetben a vásárlások adók alkalmazása nélkül fognak működni.","error_page.error_only_in_sandbox":"Ez az üzenet csak a tesztkörnyezetben jelenik meg.","error_page.error_message_stripe_missing_required_permission":"A vásárlás sikertelen volt, mert a Stripe alkalmazásból hiányzik egy szükséges engedély. Éles környezetben a vásárlások adók alkalmazása nélkül fognak működni.","error_page.error_title_stripe_tax_not_active":"A Stripe adó nincs aktiválva","error_page.error_title_stripe_invalid_tax_origin_address":"Érvénytelen adókiindulási cím","apple_pay.free_trial":"Ingyenes próbaidőszak","product_info.price_after_intro_price":"{{introPriceDuration}} után, {{renewalDate}} napján","product_info.after_trial":"próbaidőszak után","product_info.after":"utána","product_info.intro_price_phase_after_trial":"Ezután {{introPriceDuration}} ideig {{introPrice}} áron","product_info.intro_price_phase":"Először {{introPriceDuration}} ideig {{introPrice}} áron","product_info.intro_price_phase_paid_once":"egyszeri fizetéssel","payment_entry_page.trial_subscription_terms_info":"A próbaidőszak vége után {{price}} összeget számítunk fel {{perFrequency}} gyakorisággal, kezdve {{renewalDate}} dátummal. Ezt a dátumot megelőzően bármikor lemondhatod.","payment_entry_page.subscription_info":"Az előfizetés automatikusan megújul. Bármikor lemondhatod.","payment_entry_page.otp_terms_info":"A vásárlással elfogadod, hogy a {{appName}} az általa meghatározott feltételek szerint terheljen.","payment_entry_page.subscription_terms_info":"A feliratkozással elfogadod, hogy a {{appName}} az általa meghatározott feltételek szerint terheljen, amíg le nem mondod."},ZK={"periods.week":"{{amount}} minggu","periods.month":"{{amount}} bulan","periods.year":"{{amount}} tahun","periods.day":"{{amount}} hari","periods.weekShort":"{{amount}}mg","periods.monthShort":"{{amount}}bl","periods.yearShort":"{{amount}}th","periods.dayShort":"{{amount}}h","periods.lifetime":"seumur hidup","periods.weekPlural":"{{amount}} minggu","periods.monthPlural":"{{amount}} bulan","periods.yearPlural":"{{amount}} tahun","periods.dayPlural":"{{amount}} hari","periods.weekFrequency":"mingguan","periods.monthFrequency":"bulanan","periods.yearFrequency":"tahunan","periods.dayFrequency":"harian","periods.perWeekFrequency":"per minggu","periods.perMonthFrequency":"per bulan","periods.perYearFrequency":"per tahun","periods.perDayFrequency":"per hari","periods.unknownFrequency":"tidak diketahui","periods.weekFrequencyPlural":"setiap {{amount}} minggu","periods.monthFrequencyPlural":"setiap {{amount}} bulan","periods.yearFrequencyPlural":"setiap {{amount}} tahun","periods.dayFrequencyPlural":"setiap {{amount}} hari","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} uji coba gratis","product_info.price_after_free_trial":"Setelah uji coba berakhir, pada {{renewalDate}}","product_info.renewal_frequency":"Diperbarui {{frequency}}","product_info.continues_until_cancelled":"Berlanjut hingga dibatalkan","product_info.cancel_anytime":"Batalkan kapan saja","payment_entry_page.payment_step_title":"Pembayaran aman oleh RevenueCat","payment_entry_page.button_pay":"Bayar sekarang","payment_entry_page.button_start_trial":"Mulai Uji Coba","success_page.purchase_successful":"Pembayaran selesai","success_page.button_close":"Lanjutkan","error_page.if_error_persists":"Jika kesalahan berlanjut, silakan hubungi ","error_page.error_title_already_subscribed":"Anda sudah berlangganan ke {{productTitle}}","error_page.error_title_already_purchased":"Anda sudah membeli {{productTitle}}","error_page.error_title_other_errors":"Terjadi kesalahan","error_page.error_message_already_subscribed":"Anda tidak dapat berlangganan produk ini lagi.","error_page.error_message_already_purchased":"Anda tidak dapat membeli produk ini lagi.","error_page.error_message_missing_email_error":"Email diperlukan untuk menyelesaikan pembelian.","error_page.error_message_network_error":"Kesalahan jaringan. Periksa koneksi internet Anda.","error_page.error_message_error_charging_payment":"Pembayaran gagal.","error_page.error_message_error_setting_up_purchase":"Pembelian tidak dimulai karena kesalahan (kode kesalahan: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Kami tidak dapat memverifikasi alamat penagihan Anda. Harap periksa kembali kode pos dan negara untuk memastikan keduanya benar.","error_page.error_message_unknown_error":"Terjadi kesalahan yang tidak diketahui (kode kesalahan: {{errorCode}}).","error_page.button_try_again":"Coba lagi","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% diskon","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total yang harus dibayar hari ini","product_info.subscribe_to":"Berlangganan ke","navbar_header.details":"Detail","navbar_header.back_button":"Kembali","pricing_dropdown.show_details":"Tampilkan detail","pricing_dropdown.hide_details":"Sembunyikan detail","pricing_table.tax":"Pajak","pricing_table.trial_ends":"Setelah masa percobaan berakhir, pada {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total yang harus dibayar hari ini","pricing_table.total_excluding_tax":"Total belum termasuk pajak","pricing_table.enter_billing_address_to_calculate":"Masukkan alamat penagihan untuk menghitung","pricing_table.enter_state_or_postal_code_to_calculate":"Masukkan negara bagian atau kode pos untuk menghitung","pricing_table.enter_postal_code_to_calculate":"Masukkan kode pos untuk menghitung","error_page.error_message_invalid_email_error":"Alamat email {{email}} tidak dapat diverifikasi. Harap berikan alamat email yang valid.","payment_entry_page.button_payment_method":"Bayar {{formattedPrice}} dengan {{paymentMethod}}","payment_entry_page.button_with_price":"Bayar {{formattedPrice}}","price_update.title":"Pembaruan harga","price_update.base_message":"Total harga telah diperbarui dengan pajak berdasarkan alamat penagihan Anda. Harap tinjau dan coba lagi. Kartu Anda hanya akan dikenakan biaya sekali.","price_update.trial_message":"Harga langganan telah diperbarui untuk menyertakan pajak berdasarkan alamat penagihan Anda. Masa percobaan gratis masih berlaku. Silakan periksa dan coba lagi.","payment_entry_page.express_checkout_divider":"ATAU BAYAR DENGAN KARTU","error_page.trouble_accessing":"Jika Anda mengalami masalah dalam mengakses pembelian, hubungi dukungan di ","error_page.close_button_title":"Pergi ke {{appName}}","error_page.error_title_stripe_missing_required_permission":"Izin Stripe tidak ada","error_page.button_close":"Tutup","error_page.error_message_stripe_invalid_tax_origin_address":"Pembelian gagal karena alamat asal pajak tidak valid. Dalam produksi, pembelian akan berfungsi tanpa pajak yang diterapkan.","error_page.error_message_stripe_tax_not_active":"Pembelian gagal karena Stripe Tax tidak diaktifkan. Dalam produksi, pembelian akan berfungsi tanpa pajak yang diterapkan.","error_page.error_only_in_sandbox":"Pesan ini hanya muncul di sandbox.","error_page.error_message_stripe_missing_required_permission":"Pembelian gagal karena aplikasi Stripe tidak memiliki izin yang diperlukan. Dalam produksi, pembelian akan berfungsi tanpa pajak yang diterapkan.","error_page.error_title_stripe_tax_not_active":"Stripe Tax tidak aktif","error_page.error_title_stripe_invalid_tax_origin_address":"Alamat asal pajak tidak valid","apple_pay.free_trial":"Uji Coba Gratis","product_info.price_after_intro_price":"Setelah {{introPriceDuration}}, pada {{renewalDate}}","product_info.after_trial":"setelah uji coba","product_info.after":"setelah","product_info.intro_price_phase_after_trial":"Kemudian {{introPriceDuration}} dengan harga {{introPrice}}","product_info.intro_price_phase":"Pertama {{introPriceDuration}} dengan harga {{introPrice}}","product_info.intro_price_phase_paid_once":"dibayar sekali","payment_entry_page.trial_subscription_terms_info":"Setelah masa percobaan Anda berakhir, Anda akan dikenakan biaya sebesar {{price}} {{perFrequency}} mulai {{renewalDate}}. Anda dapat membatalkan kapan saja sebelum tanggal ini.","payment_entry_page.subscription_info":"Langganan diperpanjang secara otomatis. Batalkan kapan saja.","payment_entry_page.otp_terms_info":"Dengan membeli, Anda setuju untuk mengizinkan {{appName}} menagih Anda sesuai dengan ketentuan mereka.","payment_entry_page.subscription_terms_info":"Dengan berlangganan, Anda setuju untuk mengizinkan {{appName}} mengenakan biaya sesuai dengan ketentuan mereka hingga Anda membatalkan."},eY={"periods.week":"{{amount}}週間","periods.month":"{{amount}}ヶ月","periods.year":"{{amount}}年","periods.day":"{{amount}}日","periods.weekShort":"{{amount}}週","periods.monthShort":"{{amount}}ヶ月","periods.yearShort":"{{amount}}年","periods.dayShort":"{{amount}}日","periods.lifetime":"生涯","periods.weekPlural":"{{amount}}週間","periods.monthPlural":"{{amount}}ヶ月","periods.yearPlural":"{{amount}}年","periods.dayPlural":"{{amount}}日","periods.weekFrequency":"毎週","periods.monthFrequency":"毎月","periods.yearFrequency":"毎年","periods.dayFrequency":"毎日","periods.perWeekFrequency":"週ごと","periods.perMonthFrequency":"月ごと","periods.perYearFrequency":"年ごと","periods.perDayFrequency":"日ごと","periods.unknownFrequency":"不明","periods.weekFrequencyPlural":"{{amount}}週間ごと","periods.monthFrequencyPlural":"{{amount}}ヶ月ごと","periods.yearFrequencyPlural":"{{amount}}年ごと","periods.dayFrequencyPlural":"{{amount}}日ごと","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}}日間無料トライアル","product_info.price_after_free_trial":"トライアル終了後、{{renewalDate}}に","product_info.renewal_frequency":"{{frequency}}で更新","product_info.continues_until_cancelled":"キャンセルされるまで継続されます","product_info.cancel_anytime":"いつでもキャンセルできます","payment_entry_page.payment_step_title":"RevenueCatによる安全なチェックアウト","payment_entry_page.button_pay":"今すぐ支払う","payment_entry_page.button_start_trial":"トライアルを開始","success_page.purchase_successful":"支払いが完了しました","success_page.button_close":"続行","error_page.if_error_persists":"エラーが続く場合は、ご連絡ください。","error_page.error_title_already_subscribed":"すでに{{productTitle}}を購読しています","error_page.error_title_already_purchased":"すでに{{productTitle}}を購入しています","error_page.error_title_other_errors":"エラーが発生しました","error_page.error_message_already_subscribed":"この商品を再度購読することはできません。","error_page.error_message_already_purchased":"この商品を再度購入することはできません。","error_page.error_message_missing_email_error":"購入を完了するにはメールアドレスが必要です。","error_page.error_message_network_error":"ネットワークエラーです。インターネット接続を確認してください。","error_page.error_message_error_charging_payment":"支払いに失敗しました。","error_page.error_message_error_setting_up_purchase":"エラーが発生したため、購入を開始できませんでした（エラーコード：{{errorCode}}）。","error_page.error_message_invalid_tax_location":"請求先住所を確認できませんでした。郵便番号と国が正しいかご確認ください。","error_page.error_message_unknown_error":"不明なエラーが発生しました（エラーコード：{{errorCode}}）。","error_page.button_try_again":"再試行","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}%オフ","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"本日のお支払い合計","product_info.subscribe_to":"購読する","navbar_header.details":"詳細","navbar_header.back_button":"戻る","pricing_dropdown.show_details":"詳細を表示","pricing_dropdown.hide_details":"詳細を隠す","pricing_table.tax":"税金","pricing_table.trial_ends":"トライアル終了後、{{formattedTrialEndDate}}","pricing_table.total_due_today":"本日お支払いいただく合計金額","pricing_table.total_excluding_tax":"税抜き合計","pricing_table.enter_billing_address_to_calculate":"請求先住所を入力して計算","pricing_table.enter_state_or_postal_code_to_calculate":"計算するには州または郵便番号を入力してください","pricing_table.enter_postal_code_to_calculate":"計算するには郵便番号を入力してください","error_page.error_message_invalid_email_error":"メールアドレス{{email}}を確認できませんでした。有効なメールアドレスを入力してください。","payment_entry_page.button_payment_method":"{{paymentMethod}}で{{formattedPrice}}を支払う","payment_entry_page.button_with_price":"{{formattedPrice}}を支払う","price_update.title":"価格の更新","price_update.base_message":"合計金額が、お客様の請求先住所に基づいて税金とともに更新されました。再度ご確認ください。カードへの請求は1回のみです。","price_update.trial_message":"請求先住所に基づいて税金を含むサブスクリプション料金が更新されました。無料トライアルは引き続き適用されます。確認して再度お試しください。","payment_entry_page.express_checkout_divider":"カードで支払う","error_page.trouble_accessing":"購入へのアクセスに問題がある場合は、サポートにお問い合わせください: ","error_page.close_button_title":"{{appName}} に移動","error_page.error_title_stripe_missing_required_permission":"必要なStripeの権限がありません","error_page.button_close":"閉じる","error_page.error_message_stripe_invalid_tax_origin_address":"税の原産地住所が無効なため、購入に失敗しました。 本番環境では、税金が適用されなくても購入は可能です。","error_page.error_message_stripe_tax_not_active":"Stripe Taxが有効になっていないため、購入に失敗しました。 本番環境では、税金が適用されなくても購入は可能です。","error_page.error_only_in_sandbox":"このメッセージはサンドボックスでのみ表示されます。","error_page.error_message_stripe_missing_required_permission":"Stripeアプリに必要な権限がないため、購入に失敗しました。 本番環境では、税金が適用されなくても購入は可能です。","error_page.error_title_stripe_tax_not_active":"Stripe Taxが有効ではありません","error_page.error_title_stripe_invalid_tax_origin_address":"税の原産地住所が無効です","apple_pay.free_trial":"無料トライアル","product_info.price_after_intro_price":"{{introPriceDuration}}の後、{{renewalDate}}に","product_info.after_trial":"トライアル後","product_info.after":"後","product_info.intro_price_phase_after_trial":"その後、{{introPriceDuration}}間は{{introPrice}}","product_info.intro_price_phase":"最初の{{introPriceDuration}}間は{{introPrice}}","product_info.intro_price_phase_paid_once":"一回払い","payment_entry_page.trial_subscription_terms_info":"トライアル期間が終了すると、{{renewalDate}}から{{price}} {{perFrequency}}が課金されます。この日より前にいつでもキャンセルできます。","payment_entry_page.subscription_info":"サブスクリプションは自動的に更新されます。いつでもキャンセルできます。","payment_entry_page.otp_terms_info":"購入することにより、{{appName}}が利用規約に基づいて料金を請求することに同意したことになります。","payment_entry_page.subscription_terms_info":"サブスクリプションに登録すると、キャンセルするまで{{appName}}が利用規約に従って課金することを許可することに同意したことになります。"},tY={"periods.week":"{{amount}}주","periods.month":"{{amount}}개월","periods.year":"{{amount}}년","periods.day":"{{amount}}일","periods.weekShort":"{{amount}}주","periods.monthShort":"{{amount}}개월","periods.yearShort":"{{amount}}년","periods.dayShort":"{{amount}}일","periods.lifetime":"평생","periods.weekPlural":"{{amount}}주","periods.monthPlural":"{{amount}}개월","periods.yearPlural":"{{amount}}년","periods.dayPlural":"{{amount}}일","periods.weekFrequency":"매주","periods.monthFrequency":"매달","periods.yearFrequency":"매년","periods.dayFrequency":"매일","periods.perWeekFrequency":"주당","periods.perMonthFrequency":"월별","periods.perYearFrequency":"연간","periods.perDayFrequency":"매일","periods.unknownFrequency":"알 수 없음","periods.weekFrequencyPlural":"{{amount}}주마다","periods.monthFrequencyPlural":"{{amount}}개월마다","periods.yearFrequencyPlural":"{{amount}}년마다","periods.dayFrequencyPlural":"{{amount}}일마다","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}}일 무료 체험","product_info.price_after_free_trial":"체험 종료 후, {{renewalDate}}에","product_info.renewal_frequency":"{{frequency}}마다 갱신","product_info.continues_until_cancelled":"취소될 때까지 계속됩니다.","product_info.cancel_anytime":"언제든지 취소 가능","payment_entry_page.payment_step_title":"RevenueCat을 통한 안전한 결제","payment_entry_page.button_pay":"지금 결제","payment_entry_page.button_start_trial":"체험 시작","success_page.purchase_successful":"결제가 완료되었습니다.","success_page.button_close":"계속","error_page.if_error_persists":"오류가 지속되면 다음으로 문의하십시오.","error_page.error_title_already_subscribed":"이미 {{productTitle}}을 구독하셨습니다","error_page.error_title_already_purchased":"이미 {{productTitle}}을 구매하셨습니다","error_page.error_title_other_errors":"문제가 발생했습니다.","error_page.error_message_already_subscribed":"이 제품을 다시 구독할 수 없습니다.","error_page.error_message_already_purchased":"이 제품을 다시 구매할 수 없습니다.","error_page.error_message_missing_email_error":"구매를 완료하려면 이메일이 필요합니다.","error_page.error_message_network_error":"네트워크 오류입니다. 인터넷 연결을 확인하십시오.","error_page.error_message_error_charging_payment":"결제에 실패했습니다.","error_page.error_message_error_setting_up_purchase":"오류로 인해 구매가 시작되지 않았습니다(오류 코드: {{errorCode}}).","error_page.error_message_invalid_tax_location":"청구 주소를 확인할 수 없습니다. 우편번호와 국가가 정확한지 다시 한번 확인해 주세요.","error_page.error_message_unknown_error":"알 수 없는 오류가 발생했습니다(오류 코드: {{errorCode}}).","error_page.button_try_again":"다시 시도","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% 할인","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"오늘 총 결제 금액","product_info.subscribe_to":"구독하기","navbar_header.details":"세부 정보","navbar_header.back_button":"뒤로","pricing_dropdown.show_details":"세부 정보 표시","pricing_dropdown.hide_details":"세부 정보 숨기기","pricing_table.tax":"세금","pricing_table.trial_ends":"체험판 종료 후, {{formattedTrialEndDate}}","pricing_table.total_due_today":"오늘 지불해야 할 총액","pricing_table.total_excluding_tax":"세금 제외 총액","pricing_table.enter_billing_address_to_calculate":"계산을 위해 청구지 주소를 입력하세요","pricing_table.enter_state_or_postal_code_to_calculate":"주 또는 우편 번호를 입력하여 계산","pricing_table.enter_postal_code_to_calculate":"우편 번호를 입력하여 계산","error_page.error_message_invalid_email_error":"이메일 주소 {{email}}을(를) 확인할 수 없습니다. 유효한 이메일 주소를 제공해 주세요.","payment_entry_page.button_payment_method":"{{paymentMethod}}으로 {{formattedPrice}} 결제","payment_entry_page.button_with_price":"{{formattedPrice}} 결제","price_update.title":"가격 업데이트","price_update.base_message":"청구지 주소를 기준으로 세금이 포함된 총 가격이 업데이트되었습니다. 다시 확인하고 시도해 주세요. 카드는 한 번만 청구됩니다.","price_update.trial_message":"청구 주소에 따라 세금이 포함된 구독 가격이 업데이트되었습니다. 무료 체험은 계속 적용됩니다. 확인하고 다시 시도해 주세요.","payment_entry_page.express_checkout_divider":"또는 카드 결제","error_page.trouble_accessing":"구매에 문제가 있는 경우 다음 주소로 지원팀에 문의하세요. ","error_page.close_button_title":"{{appName}}으로 이동","error_page.error_title_stripe_missing_required_permission":"필수 Stripe 권한 누락","error_page.button_close":"닫기","error_page.error_message_stripe_invalid_tax_origin_address":"세금 원산지 주소가 잘못되어 구매에 실패했습니다. 프로덕션 환경에서는 세금이 적용되지 않은 상태로 구매가 진행됩니다.","error_page.error_message_stripe_tax_not_active":"Stripe Tax가 활성화되지 않아 구매에 실패했습니다. 프로덕션 환경에서는 세금이 적용되지 않은 상태로 구매가 진행됩니다.","error_page.error_only_in_sandbox":"이 메시지는 샌드박스에서만 표시됩니다.","error_page.error_message_stripe_missing_required_permission":"Stripe 앱에 필요한 권한이 없어 구매에 실패했습니다. 프로덕션 환경에서는 세금이 적용되지 않은 상태로 구매가 진행됩니다.","error_page.error_title_stripe_tax_not_active":"Stripe Tax가 활성화되지 않음","error_page.error_title_stripe_invalid_tax_origin_address":"잘못된 세금 원산지 주소","apple_pay.free_trial":"무료 체험","product_info.price_after_intro_price":"{{introPriceDuration}} 후 {{renewalDate}}에","product_info.after_trial":"체험 후","product_info.after":"후","product_info.intro_price_phase_after_trial":"다음 {{introPriceDuration}} 동안 {{introPrice}}","product_info.intro_price_phase":"처음 {{introPriceDuration}} 동안 {{introPrice}}","product_info.intro_price_phase_paid_once":"1회 결제","payment_entry_page.trial_subscription_terms_info":"체험 기간이 종료되면 {{renewalDate}}부터 {{price}} {{perFrequency}}가 청구됩니다. 이 날짜 전에는 언제든지 취소할 수 있습니다.","payment_entry_page.subscription_info":"구독은 자동으로 갱신됩니다. 언제든지 취소할 수 있습니다.","payment_entry_page.otp_terms_info":"구매하시면 {{appName}}의 약관에 따라 요금이 청구되는 것에 동의하는 것입니다.","payment_entry_page.subscription_terms_info":"구독하면 취소할 때까지 {{appName}}이 약관에 따라 요금을 청구하는 데 동의하는 것입니다."},rY={"periods.week":"{{amount}} minggu","periods.month":"{{amount}} bulan","periods.year":"{{amount}} tahun","periods.day":"{{amount}} hari","periods.weekShort":"{{amount}}mg","periods.monthShort":"{{amount}}bl","periods.yearShort":"{{amount}}th","periods.dayShort":"{{amount}}h","periods.lifetime":"seumur hidup","periods.weekPlural":"{{amount}} minggu","periods.monthPlural":"{{amount}} bulan","periods.yearPlural":"{{amount}} tahun","periods.dayPlural":"{{amount}} hari","periods.weekFrequency":"mingguan","periods.monthFrequency":"bulanan","periods.yearFrequency":"tahunan","periods.dayFrequency":"harian","periods.perWeekFrequency":"setiap minggu","periods.perMonthFrequency":"setiap bulan","periods.perYearFrequency":"setiap tahun","periods.perDayFrequency":"setiap hari","periods.unknownFrequency":"tidak diketahui","periods.weekFrequencyPlural":"setiap {{amount}} minggu","periods.monthFrequencyPlural":"setiap {{amount}} bulan","periods.yearFrequencyPlural":"setiap {{amount}} tahun","periods.dayFrequencyPlural":"setiap {{amount}} hari","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} percubaan percuma","product_info.price_after_free_trial":"Selepas tamat percubaan, pada {{renewalDate}}","product_info.renewal_frequency":"Diperbaharui {{frequency}}","product_info.continues_until_cancelled":"Berterusan sehingga dibatalkan","product_info.cancel_anytime":"Batal bila-bila masa","payment_entry_page.payment_step_title":"Pembayaran selamat oleh RevenueCat","payment_entry_page.button_pay":"Bayar sekarang","payment_entry_page.button_start_trial":"Mula Percubaan","success_page.purchase_successful":"Pembayaran selesai","success_page.button_close":"Teruskan","error_page.if_error_persists":"Jika ralat berterusan, sila hubungi ","error_page.error_title_already_subscribed":"Anda sudah melanggan {{productTitle}}","error_page.error_title_already_purchased":"Anda sudah membeli {{productTitle}}","error_page.error_title_other_errors":"Ada sesuatu yang tidak kena","error_page.error_message_already_subscribed":"Anda tidak boleh melanggan produk ini lagi.","error_page.error_message_already_purchased":"Anda tidak boleh membeli produk ini lagi.","error_page.error_message_missing_email_error":"Emel diperlukan untuk menyelesaikan pembelian.","error_page.error_message_network_error":"Ralat rangkaian. Sila semak sambungan internet anda.","error_page.error_message_error_charging_payment":"Pembayaran gagal.","error_page.error_message_error_setting_up_purchase":"Pembelian tidak dimulakan disebabkan ralat (kod ralat: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Kami tidak dapat mengesahkan alamat bil anda. Sila semak sama ada poskod dan negara adalah betul.","error_page.error_message_unknown_error":"Ralat yang tidak diketahui telah berlaku (kod ralat: {{errorCode}}).","error_page.button_try_again":"Cuba lagi","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% diskaun","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Jumlah yang perlu dibayar hari ini","product_info.subscribe_to":"Langgan","navbar_header.details":"Butiran","navbar_header.back_button":"Kembali","pricing_dropdown.show_details":"Tunjukkan butiran","pricing_dropdown.hide_details":"Sembunyikan butiran","pricing_table.tax":"Cukai","pricing_table.trial_ends":"Selepas tempoh percubaan tamat, pada {{formattedTrialEndDate}}","pricing_table.total_due_today":"Jumlah yang perlu dibayar hari ini","pricing_table.total_excluding_tax":"Jumlah tidak termasuk cukai","pricing_table.enter_billing_address_to_calculate":"Masukkan alamat pengebilan untuk mengira","pricing_table.enter_state_or_postal_code_to_calculate":"Masukkan negeri atau poskod untuk mengira","pricing_table.enter_postal_code_to_calculate":"Masukkan poskod untuk mengira","error_page.error_message_invalid_email_error":"Alamat e-mel {{email}} tidak dapat disahkan. Sila berikan alamat e-mel yang sah.","payment_entry_page.button_payment_method":"Bayar {{formattedPrice}} dengan {{paymentMethod}}","payment_entry_page.button_with_price":"Bayar {{formattedPrice}}","price_update.title":"Kemaskini harga","price_update.base_message":"Jumlah harga telah dikemas kini dengan cukai berdasarkan alamat pengebilan anda. Sila semak dan cuba lagi. Kad anda hanya akan dicaj sekali.","price_update.trial_message":"Harga langganan telah dikemas kini untuk memasukkan cukai berdasarkan alamat bil anda. Tempoh percubaan percuma masih terpakai. Sila semak dan cuba lagi.","payment_entry_page.express_checkout_divider":"ATAU BAYAR DENGAN KAD","error_page.trouble_accessing":"Jika anda menghadapi masalah untuk mengakses pembelian anda, hubungi sokongan di ","error_page.close_button_title":"Pergi ke {{appName}}","error_page.error_title_stripe_missing_required_permission":"Kebenaran Stripe hilang","error_page.button_close":"Tutup","error_page.error_message_stripe_invalid_tax_origin_address":"Pembelian gagal kerana alamat asal cukai tidak sah. Dalam pengeluaran, pembelian akan berfungsi tanpa cukai dikenakan.","error_page.error_message_stripe_tax_not_active":"Pembelian gagal kerana Cukai Stripe tidak didayakan. Dalam pengeluaran, pembelian akan berfungsi tanpa cukai dikenakan.","error_page.error_only_in_sandbox":"Mesej ini hanya muncul dalam kotak pasir.","error_page.error_message_stripe_missing_required_permission":"Pembelian gagal kerana aplikasi Stripe kekurangan kebenaran yang diperlukan. Dalam pengeluaran, pembelian akan berfungsi tanpa cukai dikenakan.","error_page.error_title_stripe_tax_not_active":"Cukai Stripe tidak aktif","error_page.error_title_stripe_invalid_tax_origin_address":"Alamat asal cukai Stripe tidak sah","apple_pay.free_trial":"Percubaan Percuma","product_info.price_after_intro_price":"Selepas {{introPriceDuration}}, pada {{renewalDate}}","product_info.after_trial":"selepas percubaan","product_info.after":"selepas","product_info.intro_price_phase_after_trial":"Kemudian {{introPriceDuration}} untuk {{introPrice}}","product_info.intro_price_phase":"Pertama {{introPriceDuration}} untuk {{introPrice}}","product_info.intro_price_phase_paid_once":"dibayar sekali","payment_entry_page.trial_subscription_terms_info":"Selepas tempoh percubaan anda tamat, anda akan dikenakan bayaran sebanyak {{price}} {{perFrequency}} bermula {{renewalDate}}. Anda boleh membatalkan pada bila-bila masa sebelum tarikh ini.","payment_entry_page.subscription_info":"Langganan diperbaharui secara automatik. Batalkan bila-bila masa.","payment_entry_page.otp_terms_info":"Dengan membuat pembelian, anda bersetuju untuk membenarkan {{appName}} mengenakan bayaran kepada anda mengikut terma mereka.","payment_entry_page.subscription_terms_info":"Dengan melanggan, anda bersetuju untuk membenarkan {{appName}} mengenakan bayaran kepada anda mengikut terma mereka sehingga anda membatalkan."},nY={"periods.week":"{{amount}} uke","periods.month":"{{amount}} måned","periods.year":"{{amount}} år","periods.day":"{{amount}} dag","periods.weekShort":"{{amount}}uk","periods.monthShort":"{{amount}}md","periods.yearShort":"{{amount}}år","periods.dayShort":"{{amount}}d","periods.lifetime":"livstid","periods.weekPlural":"{{amount}} uker","periods.monthPlural":"{{amount}} måneder","periods.yearPlural":"{{amount}} år","periods.dayPlural":"{{amount}} dager","periods.weekFrequency":"ukentlig","periods.monthFrequency":"månedlig","periods.yearFrequency":"årlig","periods.dayFrequency":"daglig","periods.perWeekFrequency":"per uke","periods.perMonthFrequency":"per måned","periods.perYearFrequency":"per år","periods.perDayFrequency":"per dag","periods.unknownFrequency":"ukjent","periods.weekFrequencyPlural":"hver {{amount}} uker","periods.monthFrequencyPlural":"hver {{amount}} måneder","periods.yearFrequencyPlural":"hver {{amount}} år","periods.dayFrequencyPlural":"hver {{amount}} dager","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} gratis prøveperiode","product_info.price_after_free_trial":"Etter prøveperioden slutter, den {{renewalDate}}","product_info.renewal_frequency":"Fornyes {{frequency}}","product_info.continues_until_cancelled":"Varer til den avbestilles","product_info.cancel_anytime":"Avbestille når som helst","payment_entry_page.payment_step_title":"Sikker betaling via RevenueCat","payment_entry_page.button_pay":"Betal nå","payment_entry_page.button_start_trial":"Start prøveperiode","success_page.purchase_successful":"Betalingen er fullført","success_page.button_close":"Fortsett","error_page.if_error_persists":"Hvis feilen vedvarer, vennligst kontakt ","error_page.error_title_already_subscribed":"Du abonnerer allerede på {{productTitle}}","error_page.error_title_already_purchased":"Du har allerede kjøpt {{productTitle}}","error_page.error_title_other_errors":"Noe gikk galt","error_page.error_message_already_subscribed":"Du kan ikke abonnere på dette produktet igjen.","error_page.error_message_already_purchased":"Du kan ikke kjøpe dette produktet igjen.","error_page.error_message_missing_email_error":"E-post er nødvendig for å fullføre kjøpet.","error_page.error_message_network_error":"Nettverksfeil. Vennligst sjekk internettforbindelsen din.","error_page.error_message_error_charging_payment":"Betalingen mislyktes.","error_page.error_message_error_setting_up_purchase":"Kjøpet ble ikke startet på grunn av en feil (feilkode: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Vi kunne ikke bekrefte faktureringsadressen din. Vennligst sjekk at postnummeret og landet er korrekte.","error_page.error_message_unknown_error":"En ukjent feil oppstod (feilkode: {{errorCode}}).","error_page.button_try_again":"Prøv igjen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% rabatt","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Totalt forfaller i dag","product_info.subscribe_to":"Abonner på","navbar_header.details":"Detaljer","navbar_header.back_button":"Tilbake","pricing_dropdown.show_details":"Vis detaljer","pricing_dropdown.hide_details":"Skjul detaljer","pricing_table.tax":"Skatt","pricing_table.trial_ends":"Etter prøveperioden slutter, den {{formattedTrialEndDate}}","pricing_table.total_due_today":"Totalt forfaller i dag","pricing_table.total_excluding_tax":"Total eksklusive skatt","pricing_table.enter_billing_address_to_calculate":"Oppgi faktureringsadresse for å beregne","pricing_table.enter_state_or_postal_code_to_calculate":"Skriv inn stat eller postnummer for å beregne","pricing_table.enter_postal_code_to_calculate":"Skriv inn postnummer for å beregne","error_page.error_message_invalid_email_error":"E-postadressen {{email}} kunne ikke bekreftes. Vennligst oppgi en gyldig e-postadresse.","payment_entry_page.button_payment_method":"Betal {{formattedPrice}} med {{paymentMethod}}","payment_entry_page.button_with_price":"Betal {{formattedPrice}}","price_update.title":"Prisoppdatering","price_update.base_message":"Totalprisen er oppdatert med skatt basert på fakturaadressen din. Vennligst se gjennom og prøv igjen. Kortet ditt vil kun bli belastet én gang.","price_update.trial_message":"Abonnementsprisen er oppdatert for å inkludere skatter basert på din fakturaadresse. Den gratis prøveperioden gjelder fortsatt. Vennligst sjekk og prøv igjen.","payment_entry_page.express_checkout_divider":"ELLER BETAL MED KORT","error_page.trouble_accessing":"Hvis du har problemer med å få tilgang til kjøpet ditt, kan du kontakte support på ","error_page.close_button_title":"Gå til {{appName}}","error_page.error_title_stripe_missing_required_permission":"Mangler Stripe-tillatelse","error_page.button_close":"Lukk","error_page.error_message_stripe_invalid_tax_origin_address":"Kjøpet mislyktes fordi skatteopprinnelsesadressen er ugyldig. I produksjon vil kjøp fungere uten at skatter brukes.","error_page.error_message_stripe_tax_not_active":"Kjøpet mislyktes fordi Stripe Tax ikke er aktivert. I produksjon vil kjøp fungere uten at skatter brukes.","error_page.error_only_in_sandbox":"Denne meldingen vises bare i sandkassen.","error_page.error_message_stripe_missing_required_permission":"Kjøpet mislyktes fordi Stripe-appen mangler en nødvendig tillatelse. I produksjon vil kjøp fungere uten at skatter brukes.","error_page.error_title_stripe_tax_not_active":"Stripe Tax er ikke aktivt","error_page.error_title_stripe_invalid_tax_origin_address":"Ugyldig skatteopprinnelsesadresse","apple_pay.free_trial":"Gratis prøveperiode","product_info.price_after_intro_price":"Etter {{introPriceDuration}}, den {{renewalDate}}","product_info.after_trial":"etter prøveperiode","product_info.after":"etter","product_info.intro_price_phase_after_trial":"Deretter {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase":"Først {{introPriceDuration}} for {{introPrice}}","product_info.intro_price_phase_paid_once":"betales én gang","payment_entry_page.trial_subscription_terms_info":"Etter at prøveperioden din er over, blir du belastet {{price}} {{perFrequency}} fra og med {{renewalDate}}. Du kan kansellere når som helst før denne datoen.","payment_entry_page.subscription_info":"Abonnementet fornyes automatisk. Avbryt når som helst.","payment_entry_page.otp_terms_info":"Ved å kjøpe godtar du at {{appName}} belaster deg i henhold til deres vilkår.","payment_entry_page.subscription_terms_info":"Ved å abonnere godtar du at {{appName}} belaster deg i henhold til deres vilkår til du kansellerer."},aY={"periods.week":"{{amount}} tydzień","periods.month":"{{amount}} miesiąc","periods.year":"{{amount}} rok","periods.day":"{{amount}} dzień","periods.weekShort":"{{amount}}tydz","periods.monthShort":"{{amount}}mies","periods.yearShort":"{{amount}}rok","periods.dayShort":"{{amount}}d","periods.lifetime":"dożywotnio","periods.weekPlural":"{{amount}} tygodni","periods.monthPlural":"{{amount}} miesięcy","periods.yearPlural":"{{amount}} lat","periods.dayPlural":"{{amount}} dni","periods.weekFrequency":"tygodniowo","periods.monthFrequency":"miesięcznie","periods.yearFrequency":"rocznie","periods.dayFrequency":"dziennie","periods.perWeekFrequency":"na tydzień","periods.perMonthFrequency":"na miesiąc","periods.perYearFrequency":"na rok","periods.perDayFrequency":"na dzień","periods.unknownFrequency":"nieznany","periods.weekFrequencyPlural":"co {{amount}} tygodni","periods.monthFrequencyPlural":"co {{amount}} miesięcy","periods.yearFrequencyPlural":"co {{amount}} lat","periods.dayFrequencyPlural":"co {{amount}} dni","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} dni próbnych","product_info.price_after_free_trial":"Po zakończeniu okresu próbnego, dnia {{renewalDate}}","product_info.renewal_frequency":"Odnawialny co {{frequency}}","product_info.continues_until_cancelled":"Kontynuowane do momentu anulowania","product_info.cancel_anytime":"Możesz anulować w dowolnym momencie","payment_entry_page.payment_step_title":"Bezpieczna płatność przez RevenueCat","payment_entry_page.button_pay":"Zapłać teraz","payment_entry_page.button_start_trial":"Rozpocznij okres próbny","success_page.purchase_successful":"Płatność zakończona","success_page.button_close":"Kontynuuj","error_page.if_error_persists":"Jeśli błąd będzie się powtarzał, skontaktuj się z ","error_page.error_title_already_subscribed":"Już subskrybujesz {{productTitle}}","error_page.error_title_already_purchased":"Już zakupiłeś/aś {{productTitle}}","error_page.error_title_other_errors":"Coś poszło nie tak","error_page.error_message_already_subscribed":"Nie możesz ponownie subskrybować tego produktu.","error_page.error_message_already_purchased":"Nie możesz ponownie zakupić tego produktu.","error_page.error_message_missing_email_error":"Adres e-mail jest wymagany do dokonania zakupu.","error_page.error_message_network_error":"Błąd sieci. Sprawdź połączenie internetowe.","error_page.error_message_error_charging_payment":"Płatność nieudana.","error_page.error_message_error_setting_up_purchase":"Zakup nie został rozpoczęty z powodu błędu (kod błędu: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nie mogliśmy zweryfikować Twojego adresu rozliczeniowego. Sprawdź, czy kod pocztowy i kraj są poprawne.","error_page.error_message_unknown_error":"Wystąpił nieznany błąd (kod błędu: {{errorCode}}).","error_page.button_try_again":"Spróbuj ponownie","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% zniżki","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Do zapłaty dzisiaj","product_info.subscribe_to":"Subskrybuj","navbar_header.details":"Szczegóły","navbar_header.back_button":"Wstecz","pricing_dropdown.show_details":"Pokaż szczegóły","pricing_dropdown.hide_details":"Ukryj szczegóły","pricing_table.tax":"Podatek","pricing_table.trial_ends":"Po zakończeniu okresu próbnego, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Suma należna dzisiaj","pricing_table.total_excluding_tax":"Suma bez podatku","pricing_table.enter_billing_address_to_calculate":"Wprowadź adres rozliczeniowy, aby obliczyć","pricing_table.enter_state_or_postal_code_to_calculate":"Wprowadź stan lub kod pocztowy, aby obliczyć","pricing_table.enter_postal_code_to_calculate":"Wprowadź kod pocztowy, aby obliczyć","error_page.error_message_invalid_email_error":"Nie można zweryfikować adresu e-mail {{email}}. Proszę podać prawidłowy adres e-mail.","payment_entry_page.button_payment_method":"Zapłać {{formattedPrice}} przez {{paymentMethod}}","payment_entry_page.button_with_price":"Zapłać {{formattedPrice}}","price_update.title":"Aktualizacja ceny","price_update.base_message":"Cena całkowita została zaktualizowana o podatek na podstawie Twojego adresu rozliczeniowego. Sprawdź i spróbuj ponownie. Twoja karta zostanie obciążona tylko raz.","price_update.trial_message":"Cena subskrypcji została zaktualizowana o podatki na podstawie Twojego adresu rozliczeniowego. Okres próbny nadal obowiązuje. Sprawdź i spróbuj ponownie.","payment_entry_page.express_checkout_divider":"LUB ZAPŁAĆ KARTĄ","error_page.trouble_accessing":"Jeśli masz problemy z dostępem do zakupu, skontaktuj się z działem pomocy pod adresem ","error_page.close_button_title":"Przejdź do {{appName}}","error_page.error_title_stripe_missing_required_permission":"Brakujące uprawnienie Stripe","error_page.button_close":"Zamknij","error_page.error_message_stripe_invalid_tax_origin_address":"Zakup nie powiódł się, ponieważ adres pochodzenia podatku jest nieprawidłowy. W środowisku produkcyjnym zakupy będą działać bez naliczania podatków.","error_page.error_message_stripe_tax_not_active":"Zakup nie powiódł się, ponieważ Stripe Tax nie jest włączony. W środowisku produkcyjnym zakupy będą działać bez naliczania podatków.","error_page.error_only_in_sandbox":"Ta wiadomość pojawia się tylko w środowisku testowym.","error_page.error_message_stripe_missing_required_permission":"Zakup nie powiódł się, ponieważ aplikacja Stripe nie ma wymaganego uprawnienia. W środowisku produkcyjnym zakupy będą działać bez naliczania podatków.","error_page.error_title_stripe_tax_not_active":"Stripe Tax nieaktywny","error_page.error_title_stripe_invalid_tax_origin_address":"Nieprawidłowy adres pochodzenia podatku","apple_pay.free_trial":"Okres próbny","product_info.price_after_intro_price":"Po {{introPriceDuration}}, od {{renewalDate}}","product_info.after_trial":"po okresie próbnym","product_info.after":"po","product_info.intro_price_phase_after_trial":"Następnie {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase":"Najpierw {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase_paid_once":"płatne jednorazowo","payment_entry_page.trial_subscription_terms_info":"Po zakończeniu okresu próbnego zostanie pobrana opłata w wysokości {{price}} {{perFrequency}} począwszy od {{renewalDate}}. Możesz anulować subskrypcję w dowolnym momencie przed tą datą.","payment_entry_page.subscription_info":"Subskrypcja odnawia się automatycznie. Anuluj w dowolnym momencie.","payment_entry_page.otp_terms_info":"Dokonując zakupu, zgadzasz się na obciążenie przez {{appName}} zgodnie z ich warunkami.","payment_entry_page.subscription_terms_info":"Subskrybując, zgadzasz się na obciążanie przez {{appName}} zgodnie z ich warunkami do momentu anulowania."},iY={"periods.week":"{{amount}} semana","periods.month":"{{amount}} mês","periods.year":"{{amount}} ano","periods.day":"{{amount}} dia","periods.weekShort":"{{amount}}sem","periods.monthShort":"{{amount}}mês","periods.yearShort":"{{amount}}ano","periods.dayShort":"{{amount}}d","periods.lifetime":"vitalício","periods.weekPlural":"{{amount}} semanas","periods.monthPlural":"{{amount}} meses","periods.yearPlural":"{{amount}} anos","periods.dayPlural":"{{amount}} dias","periods.weekFrequency":"semanal","periods.monthFrequency":"mensal","periods.yearFrequency":"anual","periods.dayFrequency":"diário","periods.perWeekFrequency":"por semana","periods.perMonthFrequency":"por mês","periods.perYearFrequency":"por ano","periods.perDayFrequency":"por dia","periods.unknownFrequency":"desconhecido","periods.weekFrequencyPlural":"a cada {{amount}} semanas","periods.monthFrequencyPlural":"a cada {{amount}} meses","periods.yearFrequencyPlural":"a cada {{amount}} anos","periods.dayFrequencyPlural":"a cada {{amount}} dias","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} teste grátis","product_info.price_after_free_trial":"Após o término do teste, em {{renewalDate}}","product_info.renewal_frequency":"Renova {{frequency}}","product_info.continues_until_cancelled":"Continua até ser cancelado","product_info.cancel_anytime":"Cancelar a qualquer momento","payment_entry_page.payment_step_title":"Pagamento seguro pela RevenueCat","payment_entry_page.button_pay":"Pagar agora","payment_entry_page.button_start_trial":"Iniciar Teste","success_page.purchase_successful":"Pagamento concluído","success_page.button_close":"Continuar","error_page.if_error_persists":"Se o erro persistir, entre em contato com ","error_page.error_title_already_subscribed":"Você já se inscreveu em {{productTitle}}","error_page.error_title_already_purchased":"Você já comprou {{productTitle}}","error_page.error_title_other_errors":"Algo deu errado","error_page.error_message_already_subscribed":"Você não pode se inscrever neste produto novamente.","error_page.error_message_already_purchased":"Você não pode comprar este produto novamente.","error_page.error_message_missing_email_error":"Email é necessário para concluir a compra.","error_page.error_message_network_error":"Erro de rede. Verifique sua conexão com a internet.","error_page.error_message_error_charging_payment":"Pagamento falhou.","error_page.error_message_error_setting_up_purchase":"Compra não iniciada devido a um erro (código de erro: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Não conseguimos verificar seu endereço de cobrança. Por favor, verifique se o código postal e o país estão corretos.","error_page.error_message_unknown_error":"Ocorreu um erro desconhecido (código de erro: {{errorCode}}).","error_page.button_try_again":"Tentar novamente","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% de desconto","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total a pagar hoje","product_info.subscribe_to":"Subscrever","navbar_header.details":"Detalhes","navbar_header.back_button":"Voltar","pricing_dropdown.show_details":"Mostrar detalhes","pricing_dropdown.hide_details":"Ocultar detalhes","pricing_table.tax":"Imposto","pricing_table.trial_ends":"Após o término do período de avaliação, em {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total a pagar hoje","pricing_table.total_excluding_tax":"Total sem impostos","pricing_table.enter_billing_address_to_calculate":"Insira o endereço de cobrança para calcular","pricing_table.enter_state_or_postal_code_to_calculate":"Insira o estado ou o CEP para calcular","pricing_table.enter_postal_code_to_calculate":"Insira o CEP para calcular","error_page.error_message_invalid_email_error":"O endereço de e-mail {{email}} não pôde ser verificado. Por favor, forneça um endereço de e-mail válido.","payment_entry_page.button_payment_method":"Pagar {{formattedPrice}} com {{paymentMethod}}","payment_entry_page.button_with_price":"Pagar {{formattedPrice}}","price_update.title":"Atualização de preço","price_update.base_message":"O preço total foi atualizado com impostos com base no seu endereço de cobrança. Por favor, revise e tente novamente. Seu cartão só será cobrado uma vez.","price_update.trial_message":"O preço da assinatura foi atualizado para incluir impostos com base no seu endereço de faturação. O período de teste gratuito continua válido. Por favor, verifique e tente novamente.","payment_entry_page.express_checkout_divider":"OU PAGUE COM CARTÃO","error_page.trouble_accessing":"Se estiver com problemas para acessar sua compra, entre em contato com o suporte em ","error_page.close_button_title":"Ir para {{appName}}","error_page.error_title_stripe_missing_required_permission":"Permissão do Stripe em falta","error_page.button_close":"Fechar","error_page.error_message_stripe_invalid_tax_origin_address":"A compra falhou porque o endereço de origem fiscal é inválido. Em produção, as compras funcionarão sem impostos aplicados.","error_page.error_message_stripe_tax_not_active":"A compra falhou porque o Stripe Tax não está ativado. Em produção, as compras funcionarão sem impostos aplicados.","error_page.error_only_in_sandbox":"Esta mensagem aparece apenas na sandbox.","error_page.error_message_stripe_missing_required_permission":"A compra falhou porque o aplicativo Stripe não tem uma permissão necessária. Em produção, as compras funcionarão sem impostos aplicados.","error_page.error_title_stripe_tax_not_active":"Stripe Tax não está ativo","error_page.error_title_stripe_invalid_tax_origin_address":"Endereço de origem fiscal inválido","apple_pay.free_trial":"Teste Gratuito","product_info.price_after_intro_price":"Após {{introPriceDuration}}, em {{renewalDate}}","product_info.after_trial":"após o período de teste","product_info.after":"após","product_info.intro_price_phase_after_trial":"Depois, {{introPriceDuration}} por {{introPrice}}","product_info.intro_price_phase":"Primeiro, {{introPriceDuration}} por {{introPrice}}","product_info.intro_price_phase_paid_once":"pago uma vez","payment_entry_page.trial_subscription_terms_info":"Após o término do período de avaliação, será cobrado o valor de {{price}} {{perFrequency}} a partir de {{renewalDate}}. Pode cancelar a qualquer momento antes desta data.","payment_entry_page.subscription_info":"A subscrição é renovada automaticamente. Cancele a qualquer momento.","payment_entry_page.otp_terms_info":"Ao comprar, você concorda em permitir que o {{appName}} cobre de acordo com os termos deles.","payment_entry_page.subscription_terms_info":"Ao subscrever, concorda em permitir que a {{appName}} lhe cobre de acordo com os seus termos até cancelar."},sY={"periods.week":"{{amount}} săptămână","periods.month":"{{amount}} lună","periods.year":"{{amount}} an","periods.day":"{{amount}} zi","periods.weekShort":"{{amount}}săpt","periods.monthShort":"{{amount}}lun","periods.yearShort":"{{amount}}an","periods.dayShort":"{{amount}}z","periods.lifetime":"pe viață","periods.weekPlural":"{{amount}} săptămâni","periods.monthPlural":"{{amount}} luni","periods.yearPlural":"{{amount}} ani","periods.dayPlural":"{{amount}} zile","periods.weekFrequency":"săptămânal","periods.monthFrequency":"lunar","periods.yearFrequency":"anual","periods.dayFrequency":"zilnic","periods.perWeekFrequency":"pe săptămână","periods.perMonthFrequency":"pe lună","periods.perYearFrequency":"pe an","periods.perDayFrequency":"pe zi","periods.unknownFrequency":"necunoscut","periods.weekFrequencyPlural":"la fiecare {{amount}} săptămâni","periods.monthFrequencyPlural":"la fiecare {{amount}} luni","periods.yearFrequencyPlural":"la fiecare {{amount}} ani","periods.dayFrequencyPlural":"la fiecare {{amount}} zile","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} perioadă de probă gratuită","product_info.price_after_free_trial":"După terminarea perioadei de probă, pe {{renewalDate}}","product_info.renewal_frequency":"Se reînnoiește {{frequency}}","product_info.continues_until_cancelled":"Continuă până la anulare","product_info.cancel_anytime":"Anulare oricând","payment_entry_page.payment_step_title":"Plata securizată prin RevenueCat","payment_entry_page.button_pay":"Plătește acum","payment_entry_page.button_start_trial":"Începe perioada de probă","success_page.purchase_successful":"Plata efectuată","success_page.button_close":"Continuă","error_page.if_error_persists":"Dacă eroarea persistă, vă rugăm să contactați ","error_page.error_title_already_subscribed":"Sunteți deja abonat la {{productTitle}}","error_page.error_title_already_purchased":"Ați achiziționat deja {{productTitle}}","error_page.error_title_other_errors":"A apărut o eroare","error_page.error_message_already_subscribed":"Nu vă puteți abona din nou la acest produs.","error_page.error_message_already_purchased":"Nu puteți achiziționa din nou acest produs.","error_page.error_message_missing_email_error":"Adresa de e-mail este necesară pentru a finaliza achiziția.","error_page.error_message_network_error":"Eroare de rețea. Verificați conexiunea la internet.","error_page.error_message_error_charging_payment":"Plata a eșuat.","error_page.error_message_error_setting_up_purchase":"Achiziția nu a putut fi inițiată din cauza unei erori (cod de eroare: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nu am putut verifica adresa de facturare. Vă rugăm să verificați dacă codul poștal și țara sunt corecte.","error_page.error_message_unknown_error":"A apărut o eroare necunoscută (cod de eroare: {{errorCode}}).","error_page.button_try_again":"Încearcă din nou","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% reducere","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Total de plată astăzi","product_info.subscribe_to":"Abonare la","navbar_header.details":"Detalii","navbar_header.back_button":"Înapoi","pricing_dropdown.show_details":"Arată detalii","pricing_dropdown.hide_details":"Ascunde detalii","pricing_table.tax":"Taxă","pricing_table.trial_ends":"După ce perioada de probă se termină, pe {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total de plătit astăzi","pricing_table.total_excluding_tax":"Total fără taxe","pricing_table.enter_billing_address_to_calculate":"Introduceți adresa de facturare pentru a calcula","pricing_table.enter_state_or_postal_code_to_calculate":"Introduceți statul sau codul poștal pentru a calcula","pricing_table.enter_postal_code_to_calculate":"Introduceți codul poștal pentru a calcula","error_page.error_message_invalid_email_error":"Adresa de e-mail {{email}} nu a putut fi verificată. Vă rugăm să furnizați o adresă de e-mail validă.","payment_entry_page.button_payment_method":"Plătește {{formattedPrice}} cu {{paymentMethod}}","payment_entry_page.button_with_price":"Plătește {{formattedPrice}}","price_update.title":"Actualizare preț","price_update.base_message":"Prețul total a fost actualizat cu taxe, în funcție de adresa dumneavoastră de facturare. Vă rugăm să revizuiți și să încercați din nou. Cardul dumneavoastră va fi debitat o singură dată.","price_update.trial_message":"Prețul abonamentului a fost actualizat pentru a include taxele bazate pe adresa dvs. de facturare. Perioada de probă gratuită rămâne valabilă. Vă rugăm să verificați și să încercați din nou.","payment_entry_page.express_checkout_divider":"SAU PLĂTEȘTE CU CARDUL","error_page.trouble_accessing":"Dacă întâmpini probleme în accesarea achiziției tale, contactează serviciul de asistență la ","error_page.close_button_title":"Mergi la {{appName}}","error_page.error_title_stripe_missing_required_permission":"Permisiune Stripe lipsă","error_page.button_close":"Închide","error_page.error_message_stripe_invalid_tax_origin_address":"Achiziția a eșuat deoarece adresa de origine fiscală este nevalidă. În producție, achizițiile vor funcționa fără taxe aplicate.","error_page.error_message_stripe_tax_not_active":"Achiziția a eșuat deoarece Stripe Tax nu este activat. În producție, achizițiile vor funcționa fără taxe aplicate.","error_page.error_only_in_sandbox":"Acest mesaj apare doar în sandbox.","error_page.error_message_stripe_missing_required_permission":"Achiziția a eșuat deoarece aplicației Stripe îi lipsește o permisiune necesară. În producție, achizițiile vor funcționa fără taxe aplicate.","error_page.error_title_stripe_tax_not_active":"Stripe Tax nu este activ","error_page.error_title_stripe_invalid_tax_origin_address":"Adresă de origine fiscală Stripe nevalidă","apple_pay.free_trial":"Perioadă de probă gratuită","product_info.price_after_intro_price":"După {{introPriceDuration}}, pe {{renewalDate}}","product_info.after_trial":"după perioada de probă","product_info.after":"după","product_info.intro_price_phase_after_trial":"Apoi {{introPriceDuration}} pentru {{introPrice}}","product_info.intro_price_phase":"Mai întâi {{introPriceDuration}} pentru {{introPrice}}","product_info.intro_price_phase_paid_once":"plătit o singură dată","payment_entry_page.trial_subscription_terms_info":"După ce perioada de probă se termină, veți fi taxat cu {{price}} {{perFrequency}} începând cu {{renewalDate}}. Puteți anula oricând înainte de această dată.","payment_entry_page.subscription_info":"Abonamentul se reînnoiește automat. Anulați oricând.","payment_entry_page.otp_terms_info":"Prin achiziționarea, sunteți de acord să permiteți {{appName}} să vă taxeze conform termenilor săi.","payment_entry_page.subscription_terms_info":"Prin abonare, sunteți de acord să permiteți {{appName}} să vă taxeze conform termenilor săi până la anulare."},oY={"periods.week":"{{amount}} неделя","periods.month":"{{amount}} месяц","periods.year":"{{amount}} год","periods.day":"{{amount}} день","periods.weekShort":"{{amount}}нед","periods.monthShort":"{{amount}}мес","periods.yearShort":"{{amount}}г","periods.dayShort":"{{amount}}д","periods.lifetime":"пожизненно","periods.weekPlural":"{{amount}} недель","periods.monthPlural":"{{amount}} месяцев","periods.yearPlural":"{{amount}} лет","periods.dayPlural":"{{amount}} дней","periods.weekFrequency":"еженедельно","periods.monthFrequency":"ежемесячно","periods.yearFrequency":"ежегодно","periods.dayFrequency":"ежедневно","periods.perWeekFrequency":"в неделю","periods.perMonthFrequency":"в месяц","periods.perYearFrequency":"в год","periods.perDayFrequency":"в день","periods.unknownFrequency":"неизвестно","periods.weekFrequencyPlural":"каждые {{amount}} недель","periods.monthFrequencyPlural":"каждые {{amount}} месяцев","periods.yearFrequencyPlural":"каждые {{amount}} лет","periods.dayFrequencyPlural":"каждые {{amount}} дней","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} бесплатная пробная версия","product_info.price_after_free_trial":"После окончания пробного периода, {{renewalDate}}","product_info.renewal_frequency":"Продлевается {{frequency}}","product_info.continues_until_cancelled":"Продолжается до отмены","product_info.cancel_anytime":"Отменить в любое время","payment_entry_page.payment_step_title":"Безопасная оплата через RevenueCat","payment_entry_page.button_pay":"Оплатить сейчас","payment_entry_page.button_start_trial":"Начать пробный период","success_page.purchase_successful":"Оплата завершена","success_page.button_close":"Продолжить","error_page.if_error_persists":"Если ошибка сохраняется, пожалуйста, свяжитесь с ","error_page.error_title_already_subscribed":"Вы уже подписаны на {{productTitle}}","error_page.error_title_already_purchased":"Вы уже приобрели {{productTitle}}","error_page.error_title_other_errors":"Что-то пошло не так","error_page.error_message_already_subscribed":"Вы не можете подписаться на этот продукт повторно.","error_page.error_message_already_purchased":"Вы не можете приобрести этот продукт повторно.","error_page.error_message_missing_email_error":"Для завершения покупки необходим адрес электронной почты.","error_page.error_message_network_error":"Ошибка сети. Проверьте ваше интернет-соединение.","error_page.error_message_error_charging_payment":"Оплата не прошла.","error_page.error_message_error_setting_up_purchase":"Покупка не была начата из-за ошибки (код ошибки: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Мы не смогли проверить ваш платежный адрес. Пожалуйста, проверьте, что почтовый индекс и страна указаны правильно.","error_page.error_message_unknown_error":"Произошла неизвестная ошибка (код ошибки: {{errorCode}}).","error_page.button_try_again":"Повторить попытку","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% скидки","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Всего к оплате сегодня","product_info.subscribe_to":"Подписаться","navbar_header.details":"Детали","navbar_header.back_button":"Назад","pricing_dropdown.show_details":"Показать детали","pricing_dropdown.hide_details":"Скрыть детали","pricing_table.tax":"Налог","pricing_table.trial_ends":"После окончания пробного периода, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Итого к оплате сегодня","pricing_table.total_excluding_tax":"Итого без учета налога","pricing_table.enter_billing_address_to_calculate":"Введите платежный адрес для расчета","pricing_table.enter_state_or_postal_code_to_calculate":"Введите штат или почтовый индекс для расчета","pricing_table.enter_postal_code_to_calculate":"Введите почтовый индекс для расчета","error_page.error_message_invalid_email_error":"Не удалось проверить адрес электронной почты {{email}}. Пожалуйста, укажите действительный адрес электронной почты.","payment_entry_page.button_payment_method":"Оплатить {{formattedPrice}} через {{paymentMethod}}","payment_entry_page.button_with_price":"Оплатить {{formattedPrice}}","price_update.title":"Обновление цены","price_update.base_message":"Общая цена была обновлена с учетом налога на основе вашего платежного адреса. Пожалуйста, проверьте и повторите попытку. С вашей карты будет списано только один раз.","price_update.trial_message":"Цена подписки была обновлена с учетом налогов на основе вашего платежного адреса. Пробный период остается бесплатным. Пожалуйста, проверьте и попробуйте снова.","payment_entry_page.express_checkout_divider":"ИЛИ ОПЛАТИТЕ КАРТОЙ","error_page.trouble_accessing":"Если у вас возникли проблемы с доступом к вашей покупке, обратитесь в службу поддержки по адресу ","error_page.close_button_title":"Перейти в {{appName}}","error_page.error_title_stripe_missing_required_permission":"Отсутствует разрешение Stripe","error_page.button_close":"Закрыть","error_page.error_message_stripe_invalid_tax_origin_address":"Покупка не удалась, так как адрес отправления налога недействителен. В рабочей среде покупки будут работать без применения налогов.","error_page.error_message_stripe_tax_not_active":"Покупка не удалась, так как Stripe Tax не включен. В рабочей среде покупки будут работать без применения налогов.","error_page.error_only_in_sandbox":"Это сообщение появляется только в песочнице.","error_page.error_message_stripe_missing_required_permission":"Покупка не удалась, так как у приложения Stripe отсутствует необходимое разрешение. В рабочей среде покупки будут работать без применения налогов.","error_page.error_title_stripe_tax_not_active":"Stripe Tax не активен","error_page.error_title_stripe_invalid_tax_origin_address":"Недействительный адрес отправления налога","apple_pay.free_trial":"Бесплатная пробная версия","product_info.price_after_intro_price":"После {{introPriceDuration}}, {{renewalDate}}","product_info.after_trial":"после пробного периода","product_info.after":"после","product_info.intro_price_phase_after_trial":"Затем {{introPriceDuration}} за {{introPrice}}","product_info.intro_price_phase":"Сначала {{introPriceDuration}} за {{introPrice}}","product_info.intro_price_phase_paid_once":"единоразовый платеж","payment_entry_page.trial_subscription_terms_info":"По окончании пробного периода с вас будет взиматься плата в размере {{price}} {{perFrequency}}, начиная с {{renewalDate}}. Вы можете отменить подписку в любое время до этой даты.","payment_entry_page.subscription_info":"Подписка продлевается автоматически. Отменить можно в любое время.","payment_entry_page.otp_terms_info":"Совершая покупку, вы соглашаетесь с тем, что {{appName}} будет взимать с вас плату в соответствии со своими условиями.","payment_entry_page.subscription_terms_info":"Подписываясь, вы соглашаетесь с тем, что {{appName}} будет взимать с вас плату в соответствии с их условиями до тех пор, пока вы не отмените подписку."},cY={"periods.week":"{{amount}} týždeň","periods.month":"{{amount}} mesiac","periods.year":"{{amount}} rok","periods.day":"{{amount}} deň","periods.weekShort":"{{amount}}týž","periods.monthShort":"{{amount}}mes","periods.yearShort":"{{amount}}rok","periods.dayShort":"{{amount}}d","periods.lifetime":"doživotne","periods.weekPlural":"{{amount}} týždňov","periods.monthPlural":"{{amount}} mesiacov","periods.yearPlural":"{{amount}} rokov","periods.dayPlural":"{{amount}} dní","periods.weekFrequency":"týždenne","periods.monthFrequency":"mesačne","periods.yearFrequency":"ročne","periods.dayFrequency":"denne","periods.perWeekFrequency":"týždenne","periods.perMonthFrequency":"mesačne","periods.perYearFrequency":"ročne","periods.perDayFrequency":"denne","periods.unknownFrequency":"neznáme","periods.weekFrequencyPlural":"každých {{amount}} týždňov","periods.monthFrequencyPlural":"každých {{amount}} mesiacov","periods.yearFrequencyPlural":"každých {{amount}} rokov","periods.dayFrequencyPlural":"každých {{amount}} dní","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} bezplatné skúšobné obdobie","product_info.price_after_free_trial":"Po skončení skúšobného obdobia, dňa {{renewalDate}}","product_info.renewal_frequency":"Obnovuje sa {{frequency}}","product_info.continues_until_cancelled":"Pokračuje, kým sa nezruší","product_info.cancel_anytime":"Kedykoľvek zrušiť","payment_entry_page.payment_step_title":"Bezpečný nákup prostredníctvom RevenueCat","payment_entry_page.button_pay":"Zaplatiť teraz","payment_entry_page.button_start_trial":"Spustiť skúšobné obdobie","success_page.purchase_successful":"Platba dokončená","success_page.button_close":"Pokračovať","error_page.if_error_persists":"Ak chyba pretrváva, kontaktujte ","error_page.error_title_already_subscribed":"Už ste si predplatili {{productTitle}}","error_page.error_title_already_purchased":"Už ste si zakúpili {{productTitle}}","error_page.error_title_other_errors":"Niečo sa pokazilo","error_page.error_message_already_subscribed":"Na tento produkt sa nemôžete znova prihlásiť na odber.","error_page.error_message_already_purchased":"Tento produkt si nemôžete znova zakúpiť.","error_page.error_message_missing_email_error":"Na dokončenie nákupu je potrebný e-mail.","error_page.error_message_network_error":"Chyba siete. Skontrolujte svoje internetové pripojenie.","error_page.error_message_error_charging_payment":"Platba zlyhala.","error_page.error_message_error_setting_up_purchase":"Nákup sa nespustil kvôli chybe (kód chyby: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Nepodarilo sa nám overiť vašu fakturačnú adresu. Skontrolujte, prosím, či je PSČ a krajina správne.","error_page.error_message_unknown_error":"Vyskytla sa neznáma chyba (kód chyby: {{errorCode}}).","error_page.button_try_again":"Skúsiť znova","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% zľava","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Celková suma splatná dnes","product_info.subscribe_to":"Prihlásiť sa na odber","navbar_header.details":"Podrobnosti","navbar_header.back_button":"Späť","pricing_dropdown.show_details":"Zobraziť podrobnosti","pricing_dropdown.hide_details":"Skryť podrobnosti","pricing_table.tax":"Daň","pricing_table.trial_ends":"Po skončení skúšobnej verzie, dňa {{formattedTrialEndDate}}","pricing_table.total_due_today":"Celková suma splatná dnes","pricing_table.total_excluding_tax":"Celkom bez dane","pricing_table.enter_billing_address_to_calculate":"Zadajte fakturačnú adresu pre výpočet","pricing_table.enter_state_or_postal_code_to_calculate":"Zadajte štát alebo PSČ pre výpočet","pricing_table.enter_postal_code_to_calculate":"Zadajte PSČ pre výpočet","error_page.error_message_invalid_email_error":"E-mailová adresa {{email}} sa nedala overiť. Zadajte platnú e-mailovú adresu.","payment_entry_page.button_payment_method":"Zaplatiť sumu {{formattedPrice}} pomocou {{paymentMethod}}","payment_entry_page.button_with_price":"Zaplatiť {{formattedPrice}}","price_update.title":"Aktualizácia ceny","price_update.base_message":"Celková cena bola aktualizovaná o daň na základe vašej fakturačnej adresy. Skontrolujte to a skúste znova. Vaša karta bude zaťažená iba raz.","price_update.trial_message":"Cena predplatného bola aktualizovaná o daňe na základe vašej fakturačnej adresy. Bezplatná skúšobná doba stále platí. Prosím, skontrolujte a skúste znova.","payment_entry_page.express_checkout_divider":"ALEBO ZAPLATIŤ KARTOU","error_page.trouble_accessing":"Ak máte problémy s prístupom k svojmu nákupu, kontaktujte podporu na ","error_page.close_button_title":"Prejsť na {{appName}}","error_page.error_title_stripe_missing_required_permission":"Chýbajúce povolenie Stripe","error_page.button_close":"Zavrieť","error_page.error_message_stripe_invalid_tax_origin_address":"Nákup sa nepodaril, pretože adresa pôvodu dane je neplatná. V produkčnom prostredí budú nákupy fungovať bez uplatnenia daní.","error_page.error_message_stripe_tax_not_active":"Nákup sa nepodaril, pretože Stripe Tax nie je povolený. V produkčnom prostredí budú nákupy fungovať bez uplatnenia daní.","error_page.error_only_in_sandbox":"Táto správa sa zobrazuje iba v testovacom prostredí (sandbox).","error_page.error_message_stripe_missing_required_permission":"Nákup sa nepodaril, pretože aplikácii Stripe chýba požadované povolenie. V produkčnom prostredí budú nákupy fungovať bez uplatnenia daní.","error_page.error_title_stripe_tax_not_active":"Stripe Tax nie je aktívny","error_page.error_title_stripe_invalid_tax_origin_address":"Neplatná adresa pôvodu dane","apple_pay.free_trial":"Skúšobná verzia zdarma","product_info.price_after_intro_price":"Po {{introPriceDuration}}, dňa {{renewalDate}}","product_info.after_trial":"po skúšobnej dobe","product_info.after":"po","product_info.intro_price_phase_after_trial":"Potom {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase":"Najprv {{introPriceDuration}} za {{introPrice}}","product_info.intro_price_phase_paid_once":"zaplatené jednorazovo","payment_entry_page.trial_subscription_terms_info":"Po skončení skúšobného obdobia vám bude účtovaná suma {{price}} {{perFrequency}} počnúc dňom {{renewalDate}}. Pred týmto dátumom môžete kedykoľvek zrušiť.","payment_entry_page.subscription_info":"Predplatné sa automaticky obnovuje. Zrušiť môžete kedykoľvek.","payment_entry_page.otp_terms_info":"Zakúpením súhlasíte s tým, že spoločnosti {{appName}} umožníte účtovať vám poplatky v súlade s jej podmienkami.","payment_entry_page.subscription_terms_info":"Prihlásením na odber súhlasíte s tým, že spoločnosť {{appName}} vám bude účtovať poplatky podľa svojich podmienok, až kým odber nezrušíte."},lY={"periods.week":"{{amount}} vecka","periods.month":"{{amount}} månad","periods.year":"{{amount}} år","periods.day":"{{amount}} dag","periods.weekShort":"{{amount}}v","periods.monthShort":"{{amount}}mån","periods.yearShort":"{{amount}}år","periods.dayShort":"{{amount}}d","periods.lifetime":"livstid","periods.weekPlural":"{{amount}} veckor","periods.monthPlural":"{{amount}} månader","periods.yearPlural":"{{amount}} år","periods.dayPlural":"{{amount}} dagar","periods.weekFrequency":"veckovis","periods.monthFrequency":"månadsvis","periods.yearFrequency":"årligen","periods.dayFrequency":"dagligen","periods.perWeekFrequency":"per vecka","periods.perMonthFrequency":"per månad","periods.perYearFrequency":"per år","periods.perDayFrequency":"per dag","periods.unknownFrequency":"okänd","periods.weekFrequencyPlural":"varje {{amount}} veckor","periods.monthFrequencyPlural":"varje {{amount}} månader","periods.yearFrequencyPlural":"varje {{amount}} år","periods.dayFrequencyPlural":"varje {{amount}} dagar","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} gratis provperiod","product_info.price_after_free_trial":"Efter provperioden slutar, den {{renewalDate}}","product_info.renewal_frequency":"Förnyas {{frequency}}","product_info.continues_until_cancelled":"Gäller tills avbokad","product_info.cancel_anytime":"Avboka när som helst","payment_entry_page.payment_step_title":"Säker betalning via RevenueCat","payment_entry_page.button_pay":"Betala nu","payment_entry_page.button_start_trial":"Starta provperiod","success_page.purchase_successful":"Betalningen är klar","success_page.button_close":"Fortsätt","error_page.if_error_persists":"Om felet kvarstår, vänligen kontakta ","error_page.error_title_already_subscribed":"Du prenumererar redan på {{productTitle}}","error_page.error_title_already_purchased":"Du har redan köpt {{productTitle}}","error_page.error_title_other_errors":"Något gick fel","error_page.error_message_already_subscribed":"Du kan inte prenumerera på den här produkten igen.","error_page.error_message_already_purchased":"Du kan inte köpa den här produkten igen.","error_page.error_message_missing_email_error":"E-post krävs för att slutföra köpet.","error_page.error_message_network_error":"Nätverksfel. Kontrollera din internetanslutning.","error_page.error_message_error_charging_payment":"Betalningen misslyckades.","error_page.error_message_error_setting_up_purchase":"Köp kunde inte startas på grund av ett fel (felkod: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Vi kunde inte verifiera din faktureringsadress. Kontrollera att postnummer och land är korrekta.","error_page.error_message_unknown_error":"Ett okänt fel inträffade (felkod: {{errorCode}}).","error_page.button_try_again":"Försök igen","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% rabatt","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}} ({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Totalt att betala idag","product_info.subscribe_to":"Prenumerera på","navbar_header.details":"Detaljer","navbar_header.back_button":"Tillbaka","pricing_dropdown.show_details":"Visa detaljer","pricing_dropdown.hide_details":"Dölj detaljer","pricing_table.tax":"Moms","pricing_table.trial_ends":"Efter provperiodens slut, den {{formattedTrialEndDate}}","pricing_table.total_due_today":"Total summa att betala idag","pricing_table.total_excluding_tax":"Totalt exklusive moms","pricing_table.enter_billing_address_to_calculate":"Ange faktureringsadress för att beräkna","pricing_table.enter_state_or_postal_code_to_calculate":"Ange delstat eller postnummer för att beräkna","pricing_table.enter_postal_code_to_calculate":"Ange postnummer för att beräkna","error_page.error_message_invalid_email_error":"E-postadressen {{email}} kunde inte verifieras. Ange en giltig e-postadress.","payment_entry_page.button_payment_method":"Betala {{formattedPrice}} med {{paymentMethod}}","payment_entry_page.button_with_price":"Betala {{formattedPrice}}","price_update.title":"Prisuppdatering","price_update.base_message":"Det totala priset har uppdaterats med moms baserat på din faktureringsadress. Granska och försök igen. Ditt kort kommer endast att debiteras en gång.","price_update.trial_message":"Prenumerationspriset har uppdaterats för att inkludera skatter baserat på din fakturaadress. Den kostnadsfria provperioden gäller fortfarande. Kontrollera och försök igen.","payment_entry_page.express_checkout_divider":"ELLER BETALA MED KORT","error_page.trouble_accessing":"Om du har problem med att komma åt ditt köp, kontakta support på ","error_page.close_button_title":"Gå till {{appName}}","error_page.error_title_stripe_missing_required_permission":"Saknar Stripe-behörighet","error_page.button_close":"Stäng","error_page.error_message_stripe_invalid_tax_origin_address":"Köpet misslyckades eftersom skatteursprungsadressen är ogiltig. I produktion kommer köp att fungera utan att skatter tillämpas.","error_page.error_message_stripe_tax_not_active":"Köpet misslyckades eftersom Stripe Tax inte är aktiverat. I produktion kommer köp att fungera utan att skatter tillämpas.","error_page.error_only_in_sandbox":"Det här meddelandet visas bara i sandlådan.","error_page.error_message_stripe_missing_required_permission":"Köpet misslyckades eftersom Stripe-appen saknar en nödvändig behörighet. I produktion kommer köp att fungera utan att skatter tillämpas.","error_page.error_title_stripe_tax_not_active":"Stripe Tax är inte aktivt","error_page.error_title_stripe_invalid_tax_origin_address":"Ogiltig skatteursprungsadress","apple_pay.free_trial":"Gratis provperiod","product_info.price_after_intro_price":"Efter {{introPriceDuration}}, den {{renewalDate}}","product_info.after_trial":"efter provperioden","product_info.after":"efter","product_info.intro_price_phase_after_trial":"Sedan {{introPriceDuration}} för {{introPrice}}","product_info.intro_price_phase":"Först {{introPriceDuration}} för {{introPrice}}","product_info.intro_price_phase_paid_once":"betalas en gång","payment_entry_page.trial_subscription_terms_info":"Efter att din provperiod slutar debiteras du {{price}} {{perFrequency}} från och med {{renewalDate}}. Du kan avbryta när som helst före detta datum.","payment_entry_page.subscription_info":"Prenumerationen förnyas automatiskt. Avbryt när som helst.","payment_entry_page.otp_terms_info":"Genom att köpa godkänner du att {{appName}} debiterar dig i enlighet med deras villkor.","payment_entry_page.subscription_terms_info":"Genom att prenumerera godkänner du att {{appName}} debiterar dig i enlighet med deras villkor tills du avbryter."},uY={"periods.week":"{{amount}} สัปดาห์","periods.month":"{{amount}} เดือน","periods.year":"{{amount}} ปี","periods.day":"{{amount}} วัน","periods.weekShort":"{{amount}} สัปดาห์","periods.monthShort":"{{amount}} เดือน","periods.yearShort":"{{amount}} ปี","periods.dayShort":"{{amount}} วัน","periods.lifetime":"ตลอดชีพ","periods.weekPlural":"{{amount}} สัปดาห์","periods.monthPlural":"{{amount}} เดือน","periods.yearPlural":"{{amount}} ปี","periods.dayPlural":"{{amount}} วัน","periods.weekFrequency":"รายสัปดาห์","periods.monthFrequency":"รายเดือน","periods.yearFrequency":"รายปี","periods.dayFrequency":"รายวัน","periods.perWeekFrequency":"ต่อสัปดาห์","periods.perMonthFrequency":"ต่อเดือน","periods.perYearFrequency":"ต่อปี","periods.perDayFrequency":"ต่อวัน","periods.unknownFrequency":"ไม่รู้จัก","periods.weekFrequencyPlural":"ทุกๆ {{amount}} สัปดาห์","periods.monthFrequencyPlural":"ทุกๆ {{amount}} เดือน","periods.yearFrequencyPlural":"ทุกๆ {{amount}} ปี","periods.dayFrequencyPlural":"ทุกๆ {{amount}} วัน","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} ทดลองใช้ฟรี","product_info.price_after_free_trial":"หลังจากสิ้นสุดการทดลองใช้ ในวันที่ {{renewalDate}}","product_info.renewal_frequency":"ต่ออายุ {{frequency}}","product_info.continues_until_cancelled":"ต่อเนื่องจนกว่าจะยกเลิก","product_info.cancel_anytime":"ยกเลิกได้ตลอดเวลา","payment_entry_page.payment_step_title":"การชำระเงินอย่างปลอดภัยโดย RevenueCat","payment_entry_page.button_pay":"ชำระเงินตอนนี้","payment_entry_page.button_start_trial":"เริ่มทดลองใช้","success_page.purchase_successful":"การชำระเงินเสร็จสมบูรณ์","success_page.button_close":"ดำเนินการต่อ","error_page.if_error_persists":"หากข้อผิดพลาดยังคงอยู่ โปรดติดต่อ ","error_page.error_title_already_subscribed":"คุณได้สมัครสมาชิก {{productTitle}} แล้ว","error_page.error_title_already_purchased":"คุณได้ซื้อ {{productTitle}} แล้ว","error_page.error_title_other_errors":"มีบางอย่างผิดพลาด","error_page.error_message_already_subscribed":"คุณไม่สามารถสมัครสมาชิกผลิตภัณฑ์นี้ได้อีก","error_page.error_message_already_purchased":"คุณไม่สามารถซื้อผลิตภัณฑ์นี้ได้อีก","error_page.error_message_missing_email_error":"ต้องใช้อีเมลเพื่อทำการซื้อให้เสร็จสมบูรณ์","error_page.error_message_network_error":"ข้อผิดพลาดของเครือข่าย โปรดตรวจสอบการเชื่อมต่ออินเทอร์เน็ตของคุณ","error_page.error_message_error_charging_payment":"การชำระเงินล้มเหลว","error_page.error_message_error_setting_up_purchase":"ไม่สามารถเริ่มการซื้อได้เนื่องจากข้อผิดพลาด (รหัสข้อผิดพลาด: {{errorCode}})","error_page.error_message_invalid_tax_location":"เราไม่สามารถยืนยันที่อยู่สำหรับออกใบแจ้งหนี้ของคุณได้ กรุณาตรวจสอบรหัสไปรษณีย์และประเทศให้ถูกต้อง","error_page.error_message_unknown_error":"เกิดข้อผิดพลาดที่ไม่รู้จัก (รหัสข้อผิดพลาด: {{errorCode}})","error_page.button_try_again":"ลองอีกครั้ง","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% ลด","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"ยอดรวมที่ต้องชำระวันนี้","product_info.subscribe_to":"สมัครสมาชิก","navbar_header.details":"รายละเอียด","navbar_header.back_button":"ย้อนกลับ","pricing_dropdown.show_details":"แสดงรายละเอียด","pricing_dropdown.hide_details":"ซ่อนรายละเอียด","pricing_table.tax":"ภาษี","pricing_table.trial_ends":"หลังจากช่วงทดลองใช้สิ้นสุด ในวันที่ {{formattedTrialEndDate}}","pricing_table.total_due_today":"ยอดรวมที่ต้องชำระวันนี้","pricing_table.total_excluding_tax":"ราคารวมก่อนภาษี","pricing_table.enter_billing_address_to_calculate":"กรุณากรอกที่อยู่สำหรับเรียกเก็บเงินเพื่อคำนวณ","pricing_table.enter_state_or_postal_code_to_calculate":"ใส่รัฐหรือรหัสไปรษณีย์เพื่อคำนวณ","pricing_table.enter_postal_code_to_calculate":"ใส่รหัสไปรษณีย์เพื่อคำนวณ","error_page.error_message_invalid_email_error":"ไม่สามารถยืนยันที่อยู่อีเมล {{email}} ได้ โปรดระบุที่อยู่อีเมลที่ถูกต้อง","payment_entry_page.button_payment_method":"ชำระเงิน {{formattedPrice}} ด้วย {{paymentMethod}}","payment_entry_page.button_with_price":"ชำระเงิน {{formattedPrice}}","price_update.title":"อัปเดตราคา","price_update.base_message":"ราคารวมได้รับการอัปเดตพร้อมภาษีตามที่อยู่สำหรับการเรียกเก็บเงินของคุณ โปรดตรวจสอบและลองอีกครั้ง บัตรของคุณจะถูกเรียกเก็บเงินเพียงครั้งเดียวเท่านั้น","price_update.trial_message":"ราคาการสมัครสมาชิกได้รับการอัปเดตเพื่อรวมภาษีตามที่อยู่สำหรับการเรียกเก็บเงินของคุณ ระยะเวลาทดลองใช้ฟรียังคงมีผล โปรดตรวจสอบและลองอีกครั้ง","payment_entry_page.express_checkout_divider":"หรือชำระด้วยบัตร","error_page.trouble_accessing":"หากคุณมีปัญหาในการเข้าถึงการซื้อ โปรดติดต่อฝ่ายสนับสนุนที่ ","error_page.close_button_title":"ไปที่ {{appName}}","error_page.error_title_stripe_missing_required_permission":"ขาดสิทธิ์ Stripe ที่จำเป็น","error_page.button_close":"ปิด","error_page.error_message_stripe_invalid_tax_origin_address":"การซื้อล้มเหลวเนื่องจากที่อยู่ต้นทางภาษีไม่ถูกต้อง ในสภาพแวดล้อมจริง การซื้อจะทำงานได้โดยไม่มีการเรียกเก็บภาษี","error_page.error_message_stripe_tax_not_active":"การซื้อล้มเหลวเนื่องจากไม่ได้เปิดใช้งาน Stripe Tax ในสภาพแวดล้อมจริง การซื้อจะทำงานได้โดยไม่มีการเรียกเก็บภาษี","error_page.error_only_in_sandbox":"ข้อความนี้จะปรากฏเฉพาะใน sandbox เท่านั้น","error_page.error_message_stripe_missing_required_permission":"การซื้อล้มเหลวเนื่องจากแอป Stripe ขาดสิทธิ์ที่จำเป็น ในสภาพแวดล้อมจริง การซื้อจะทำงานได้โดยไม่มีการเรียกเก็บภาษี","error_page.error_title_stripe_tax_not_active":"Stripe Tax ไม่เปิดใช้งาน","error_page.error_title_stripe_invalid_tax_origin_address":"ที่อยู่ต้นทางภาษีไม่ถูกต้อง","apple_pay.free_trial":"ทดลองใช้ฟรี","product_info.price_after_intro_price":"หลังจาก {{introPriceDuration}} ในวันที่ {{renewalDate}}","product_info.after_trial":"หลังช่วงทดลองใช้","product_info.after":"หลังจาก","product_info.intro_price_phase_after_trial":"จากนั้น {{introPriceDuration}} ในราคา {{introPrice}}","product_info.intro_price_phase":"ช่วงแรก {{introPriceDuration}} ในราคา {{introPrice}}","product_info.intro_price_phase_paid_once":"ชำระครั้งเดียว","payment_entry_page.trial_subscription_terms_info":"หลังจากช่วงทดลองใช้ของคุณสิ้นสุดลง คุณจะถูกเรียกเก็บเงิน {{price}} {{perFrequency}} เริ่มตั้งแต่วันที่ {{renewalDate}} คุณสามารถยกเลิกได้ตลอดเวลาก่อนวันดังกล่าว","payment_entry_page.subscription_info":"การสมัครรับข้อมูลจะต่ออายุโดยอัตโนมัติ ยกเลิกได้ตลอดเวลา","payment_entry_page.otp_terms_info":"เมื่อทำการซื้อ คุณตกลงที่จะอนุญาตให้ {{appName}} เรียกเก็บเงินจากคุณตามข้อกำหนดของพวกเขา","payment_entry_page.subscription_terms_info":"เมื่อสมัครรับข้อมูล แสดงว่าคุณยินยอมให้ {{appName}} เรียกเก็บเงินจากคุณตามข้อกำหนดจนกว่าคุณจะยกเลิก"},dY={"periods.week":"{{amount}} hafta","periods.month":"{{amount}} ay","periods.year":"{{amount}} yıl","periods.day":"{{amount}} gün","periods.weekShort":"{{amount}}hf","periods.monthShort":"{{amount}}ay","periods.yearShort":"{{amount}}yl","periods.dayShort":"{{amount}}g","periods.lifetime":"ömür boyu","periods.weekPlural":"{{amount}} hafta","periods.monthPlural":"{{amount}} ay","periods.yearPlural":"{{amount}} yıl","periods.dayPlural":"{{amount}} gün","periods.weekFrequency":"haftalık","periods.monthFrequency":"aylık","periods.yearFrequency":"yıllık","periods.dayFrequency":"günlük","periods.perWeekFrequency":"haftada","periods.perMonthFrequency":"ayda","periods.perYearFrequency":"yılda","periods.perDayFrequency":"günde","periods.unknownFrequency":"bilinmiyor","periods.weekFrequencyPlural":"her {{amount}} haftada","periods.monthFrequencyPlural":"her {{amount}} ayda","periods.yearFrequencyPlural":"her {{amount}} yılda","periods.dayFrequencyPlural":"her {{amount}} günde","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} ücretsiz deneme","product_info.price_after_free_trial":"Deneme süresi sona erdiğinde, {{renewalDate}} tarihinde","product_info.renewal_frequency":"{{frequency}} sıklığında yenilenir","product_info.continues_until_cancelled":"İptal edilene kadar devam eder","product_info.cancel_anytime":"İstediğiniz zaman iptal edebilirsiniz","payment_entry_page.payment_step_title":"RevenueCat ile güvenli ödeme","payment_entry_page.button_pay":"Şimdi öde","payment_entry_page.button_start_trial":"Denemeyi başlat","success_page.purchase_successful":"Ödeme tamamlandı","success_page.button_close":"Devam et","error_page.if_error_persists":"Hata devam ederse lütfen iletişime geçin ","error_page.error_title_already_subscribed":"{{productTitle}} ürününe zaten abone oldunuz","error_page.error_title_already_purchased":"{{productTitle}} ürününü zaten satın aldınız","error_page.error_title_other_errors":"Bir şeyler ters gitti","error_page.error_message_already_subscribed":"Bu ürüne tekrar abone olamazsınız.","error_page.error_message_already_purchased":"Bu ürünü tekrar satın alamazsınız.","error_page.error_message_missing_email_error":"Satın almayı tamamlamak için e-posta gereklidir.","error_page.error_message_network_error":"Ağ hatası. Lütfen internet bağlantınızı kontrol edin.","error_page.error_message_error_charging_payment":"Ödeme başarısız oldu.","error_page.error_message_error_setting_up_purchase":"Bir hata nedeniyle satın alma başlatılamadı (hata kodu: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Fatura adresinizi doğrulayamadık. Lütfen posta kodu ve ülkenin doğru olduğunu kontrol edin.","error_page.error_message_unknown_error":"Bilinmeyen bir hata oluştu (hata kodu: {{errorCode}}).","error_page.button_try_again":"Tekrar dene","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% indirim","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Bugün ödenecek toplam tutar","product_info.subscribe_to":"Abone Ol","navbar_header.details":"Detaylar","navbar_header.back_button":"Geri","pricing_dropdown.show_details":"Detayları göster","pricing_dropdown.hide_details":"Detayları gizle","pricing_table.tax":"Vergi","pricing_table.trial_ends":"Deneme süresi sona erdikten sonra, {{formattedTrialEndDate}} tarihinde","pricing_table.total_due_today":"Bugün ödenecek toplam","pricing_table.total_excluding_tax":"Vergi hariç toplam","pricing_table.enter_billing_address_to_calculate":"Hesaplamak için fatura adresini girin","pricing_table.enter_state_or_postal_code_to_calculate":"Hesaplamak için eyalet veya posta kodunu girin","pricing_table.enter_postal_code_to_calculate":"Hesaplamak için posta kodunu girin","error_page.error_message_invalid_email_error":"{{email}} e-posta adresi doğrulanamadı. Lütfen geçerli bir e-posta adresi girin.","payment_entry_page.button_payment_method":"{{paymentMethod}} ile {{formattedPrice}} öde","payment_entry_page.button_with_price":"{{formattedPrice}} öde","price_update.title":"Fiyat güncellemesi","price_update.base_message":"Toplam fiyat, fatura adresinize göre vergi dahil olacak şekilde güncellendi. Lütfen inceleyip tekrar deneyin. Kartınızdan yalnızca bir kez ücret alınacaktır.","price_update.trial_message":"Abonelik fiyatı, fatura adresinize göre vergileri içerecek şekilde güncellendi. Ücretsiz deneme süresi hala geçerli. Lütfen kontrol edin ve tekrar deneyin.","payment_entry_page.express_checkout_divider":"VEYA KARTLA ÖDEYİN","error_page.trouble_accessing":"Satın alımınıza erişmekte sorun yaşıyorsanız, şu adresten destek ekibine ulaşın: ","error_page.close_button_title":"{{appName}}'e Git","error_page.error_title_stripe_missing_required_permission":"Eksik Stripe izni","error_page.button_close":"Kapat","error_page.error_message_stripe_invalid_tax_origin_address":"Vergi başlangıç adresi geçersiz olduğu için satın alma başarısız oldu. Üretimde, satın alımlar vergi uygulanmadan çalışacaktır.","error_page.error_message_stripe_tax_not_active":"Stripe Vergi etkinleştirilmediği için satın alma başarısız oldu. Üretimde, satın alımlar vergi uygulanmadan çalışacaktır.","error_page.error_only_in_sandbox":"Bu mesaj yalnızca sanal ortamda görünür.","error_page.error_message_stripe_missing_required_permission":"Stripe uygulamasında gerekli bir izin eksik olduğu için satın alma başarısız oldu. Üretimde, satın alımlar vergi uygulanmadan çalışacaktır.","error_page.error_title_stripe_tax_not_active":"Stripe Vergi aktif değil","error_page.error_title_stripe_invalid_tax_origin_address":"Geçersiz vergi başlangıç adresi","apple_pay.free_trial":"Ücretsiz Deneme","product_info.price_after_intro_price":"{{introPriceDuration}} sonra, {{renewalDate}} tarihinde","product_info.after_trial":"deneme süresinden sonra","product_info.after":"sonra","product_info.intro_price_phase_after_trial":"Sonra {{introPriceDuration}} boyunca {{introPrice}}","product_info.intro_price_phase":"İlk {{introPriceDuration}} boyunca {{introPrice}}","product_info.intro_price_phase_paid_once":"bir defaya mahsus ödenir","payment_entry_page.trial_subscription_terms_info":"Deneme süreniz sona erdikten sonra, {{renewalDate}} tarihinden itibaren {{price}} {{perFrequency}} ücretlendirileceksiniz. Bu tarihten önce istediğiniz zaman iptal edebilirsiniz.","payment_entry_page.subscription_info":"Abonelik otomatik olarak yenilenir. İstediğiniz zaman iptal edin.","payment_entry_page.otp_terms_info":"Satın alarak, {{appName}}'in sizi şartlarına göre ücretlendirmesine izin vermeyi kabul edersiniz.","payment_entry_page.subscription_terms_info":"Abone olarak, iptal edene kadar {{appName}}'in sizi şartlarına göre ücretlendirmesine izin vermeyi kabul edersiniz."},fY={"periods.week":"{{amount}} тиждень","periods.month":"{{amount}} місяць","periods.year":"{{amount}} рік","periods.day":"{{amount}} день","periods.weekShort":"{{amount}}тиж","periods.monthShort":"{{amount}}міс","periods.yearShort":"{{amount}}рік","periods.dayShort":"{{amount}}дн","periods.lifetime":"пожиттєво","periods.weekPlural":"{{amount}} тижнів","periods.monthPlural":"{{amount}} місяців","periods.yearPlural":"{{amount}} років","periods.dayPlural":"{{amount}} днів","periods.weekFrequency":"щотижня","periods.monthFrequency":"щомісяця","periods.yearFrequency":"щороку","periods.dayFrequency":"щодня","periods.perWeekFrequency":"на тиждень","periods.perMonthFrequency":"на місяць","periods.perYearFrequency":"на рік","periods.perDayFrequency":"на день","periods.unknownFrequency":"невідомо","periods.weekFrequencyPlural":"кожні {{amount}} тижнів","periods.monthFrequencyPlural":"кожні {{amount}} місяців","periods.yearFrequencyPlural":"кожні {{amount}} років","periods.dayFrequencyPlural":"кожні {{amount}} днів","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} безкоштовний пробний період","product_info.price_after_free_trial":"Після закінчення пробного періоду, {{renewalDate}}","product_info.renewal_frequency":"Продовжується {{frequency}}","product_info.continues_until_cancelled":"Триває до скасування","product_info.cancel_anytime":"Можна скасувати в будь-який час","payment_entry_page.payment_step_title":"Безпечна оплата через RevenueCat","payment_entry_page.button_pay":"Оплатити зараз","payment_entry_page.button_start_trial":"Розпочати пробний період","success_page.purchase_successful":"Оплата завершена","success_page.button_close":"Продовжити","error_page.if_error_persists":"Якщо помилка повторюється, зверніться до ","error_page.error_title_already_subscribed":"Ви вже підписалися на {{productTitle}}","error_page.error_title_already_purchased":"Ви вже придбали {{productTitle}}","error_page.error_title_other_errors":"Щось пішло не так","error_page.error_message_already_subscribed":"Ви не можете підписатися на цей продукт знову.","error_page.error_message_already_purchased":"Ви не можете придбати цей продукт знову.","error_page.error_message_missing_email_error":"Для завершення покупки потрібна електронна пошта.","error_page.error_message_network_error":"Помилка мережі. Перевірте підключення до інтернету.","error_page.error_message_error_charging_payment":"Оплата не пройшла.","error_page.error_message_error_setting_up_purchase":"Помилка при ініціалізації покупки (код помилки: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Ми не змогли перевірити вашу платіжну адресу. Будь ласка, перевірте, чи правильні поштовий індекс та країна.","error_page.error_message_unknown_error":"Сталася невідома помилка (код помилки: {{errorCode}}).","error_page.button_try_again":"Спробувати ще раз","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% знижки","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Всього до сплати сьогодні","product_info.subscribe_to":"Підписатися на","navbar_header.details":"Деталі","navbar_header.back_button":"Назад","pricing_dropdown.show_details":"Показати деталі","pricing_dropdown.hide_details":"Приховати деталі","pricing_table.tax":"Податок","pricing_table.trial_ends":"Після закінчення пробного періоду, {{formattedTrialEndDate}}","pricing_table.total_due_today":"Загальна сума до сплати сьогодні","pricing_table.total_excluding_tax":"Загальна сума без урахування податку","pricing_table.enter_billing_address_to_calculate":"Введіть адресу виставлення рахунку для розрахунку","pricing_table.enter_state_or_postal_code_to_calculate":"Введіть штат або поштовий індекс для розрахунку","pricing_table.enter_postal_code_to_calculate":"Введіть поштовий індекс для розрахунку","error_page.error_message_invalid_email_error":"Електронну адресу {{email}} не вдалося підтвердити. Будь ласка, вкажіть дійсну електронну адресу.","payment_entry_page.button_payment_method":"Сплатити {{formattedPrice}} за допомогою {{paymentMethod}}","payment_entry_page.button_with_price":"Сплатити {{formattedPrice}}","price_update.title":"Оновлення ціни","price_update.base_message":"Загальну ціну було оновлено з урахуванням податку на основі вашої платіжної адреси. Перегляньте та спробуйте ще раз. З вашої картки буде списано кошти лише один раз.","price_update.trial_message":"Ціна підписки була оновлена для включення податків на основі вашої платіжної адреси. Безкоштовний пробний період все ще діє. Будь ласка, перевірте та спробуйте ще раз.","payment_entry_page.express_checkout_divider":"АБО СПЛАТІТЬ КАРТКОЮ","error_page.trouble_accessing":"Якщо у вас виникли проблеми з доступом до вашої покупки, зверніться до служби підтримки за адресою ","error_page.close_button_title":"Перейти до {{appName}}","error_page.error_title_stripe_missing_required_permission":"Відсутній дозвіл Stripe","error_page.button_close":"Закрити","error_page.error_message_stripe_invalid_tax_origin_address":"Покупка не вдалася, оскільки адреса походження податку недійсна. У виробництві покупки працюватимуть без застосування податків.","error_page.error_message_stripe_tax_not_active":"Покупка не вдалася, оскільки Stripe Tax не ввімкнено. У виробництві покупки працюватимуть без застосування податків.","error_page.error_only_in_sandbox":"Це повідомлення з’являється лише в пісочниці.","error_page.error_message_stripe_missing_required_permission":"Покупка не вдалася, оскільки програмі Stripe не вистачає необхідного дозволу. У виробництві покупки працюватимуть без застосування податків.","error_page.error_title_stripe_tax_not_active":"Stripe Tax не активовано","error_page.error_title_stripe_invalid_tax_origin_address":"Недійсна адреса походження податку","apple_pay.free_trial":"Безкоштовна пробна версія","product_info.price_after_intro_price":"Після {{introPriceDuration}}, {{renewalDate}}","product_info.after_trial":"після пробного періоду","product_info.after":"після","product_info.intro_price_phase_after_trial":"Потім {{introPriceDuration}} за {{introPrice}}","product_info.intro_price_phase":"Спочатку {{introPriceDuration}} за {{introPrice}}","product_info.intro_price_phase_paid_once":"сплачено один раз","payment_entry_page.trial_subscription_terms_info":"Після закінчення пробного періоду з вас буде стягуватися плата в розмірі {{price}} {{perFrequency}} починаючи з {{renewalDate}}. Ви можете скасувати підписку в будь-який час до цієї дати.","payment_entry_page.subscription_info":"Підписка поновлюється автоматично. Скасувати можна в будь-який час.","payment_entry_page.otp_terms_info":"Купуючи, ви погоджуєтеся дозволити {{appName}} стягувати з вас плату відповідно до їхніх умов.","payment_entry_page.subscription_terms_info":"Підписуючись, ви погоджуєтеся дозволити {{appName}} стягувати з вас плату відповідно до їхніх умов, поки ви не скасуєте підписку."},pY={"periods.week":"{{amount}} tuần","periods.month":"{{amount}} tháng","periods.year":"{{amount}} năm","periods.day":"{{amount}} ngày","periods.weekShort":"{{amount}}tuần","periods.monthShort":"{{amount}}tháng","periods.yearShort":"{{amount}}năm","periods.dayShort":"{{amount}}ngày","periods.lifetime":"trọn đời","periods.weekPlural":"{{amount}} tuần","periods.monthPlural":"{{amount}} tháng","periods.yearPlural":"{{amount}} năm","periods.dayPlural":"{{amount}} ngày","periods.weekFrequency":"hàng tuần","periods.monthFrequency":"hàng tháng","periods.yearFrequency":"hàng năm","periods.dayFrequency":"hàng ngày","periods.perWeekFrequency":"mỗi tuần","periods.perMonthFrequency":"mỗi tháng","periods.perYearFrequency":"mỗi năm","periods.perDayFrequency":"mỗi ngày","periods.unknownFrequency":"không xác định","periods.weekFrequencyPlural":"cứ {{amount}} tuần","periods.monthFrequencyPlural":"cứ {{amount}} tháng","periods.yearFrequencyPlural":"cứ {{amount}} năm","periods.dayFrequencyPlural":"cứ {{amount}} ngày","product_info.product_title":"{{productTitle}}","product_info.product_description":"{{productDescription}}","product_info.product_price":"{{productPrice}}","product_info.free_trial_duration":"{{trialDuration}} dùng thử miễn phí","product_info.price_after_free_trial":"Sau khi dùng thử kết thúc, vào {{renewalDate}}","product_info.renewal_frequency":"Gia hạn {{frequency}}","product_info.continues_until_cancelled":"Tiếp tục cho đến khi hủy","product_info.cancel_anytime":"Hủy bất cứ lúc nào","payment_entry_page.payment_step_title":"Thanh toán an toàn bởi RevenueCat","payment_entry_page.button_pay":"Thanh toán ngay","payment_entry_page.button_start_trial":"Bắt đầu dùng thử","success_page.purchase_successful":"Thanh toán hoàn tất","success_page.button_close":"Tiếp tục","error_page.if_error_persists":"Nếu lỗi vẫn tiếp diễn, vui lòng liên hệ ","error_page.error_title_already_subscribed":"Bạn đã đăng ký {{productTitle}} rồi","error_page.error_title_already_purchased":"Bạn đã mua {{productTitle}} rồi","error_page.error_title_other_errors":"Có lỗi xảy ra","error_page.error_message_already_subscribed":"Bạn không thể đăng ký sản phẩm này lần nữa.","error_page.error_message_already_purchased":"Bạn không thể mua sản phẩm này lần nữa.","error_page.error_message_missing_email_error":"Email bắt buộc để hoàn tất việc mua hàng.","error_page.error_message_network_error":"Lỗi mạng. Vui lòng kiểm tra kết nối internet của bạn.","error_page.error_message_error_charging_payment":"Thanh toán thất bại.","error_page.error_message_error_setting_up_purchase":"Không thể bắt đầu mua do lỗi (mã lỗi: {{errorCode}}).","error_page.error_message_invalid_tax_location":"Chúng tôi không thể xác minh địa chỉ thanh toán của bạn. Vui lòng kiểm tra lại mã bưu điện và quốc gia.","error_page.error_message_unknown_error":"Đã xảy ra lỗi không xác định (mã lỗi: {{errorCode}}).","error_page.button_try_again":"Thử lại","paywall_variables.price_per_period":"{{formattedPrice}}/{{period}}","paywall_variables.sub_relative_discount":"{{discount}}% giảm","paywall_variables.total_price_and_per_month":"{{formattedPrice}}/{{period}}({{formattedPricePerMonth}}/{{monthPeriod}})","product_info.total_due_today":"Tổng số tiền phải trả hôm nay","product_info.subscribe_to":"Đăng ký","navbar_header.details":"Chi tiết","navbar_header.back_button":"Quay lại","pricing_dropdown.show_details":"Xem chi tiết","pricing_dropdown.hide_details":"Ẩn chi tiết","pricing_table.tax":"Thuế","pricing_table.trial_ends":"Sau khi thời gian dùng thử kết thúc, vào {{formattedTrialEndDate}}","pricing_table.total_due_today":"Tổng số tiền phải trả hôm nay","pricing_table.total_excluding_tax":"Tổng cộng chưa bao gồm thuế","pricing_table.enter_billing_address_to_calculate":"Nhập địa chỉ thanh toán để tính toán","pricing_table.enter_state_or_postal_code_to_calculate":"Nhập tiểu bang hoặc mã bưu điện để tính toán","pricing_table.enter_postal_code_to_calculate":"Nhập mã bưu điện để tính toán","error_page.error_message_invalid_email_error":"Không thể xác minh địa chỉ email {{email}}. Vui lòng cung cấp một địa chỉ email hợp lệ.","payment_entry_page.button_payment_method":"Thanh toán {{formattedPrice}} bằng {{paymentMethod}}","payment_entry_page.button_with_price":"Thanh toán {{formattedPrice}}","price_update.title":"Cập nhật giá","price_update.base_message":"Tổng giá đã được cập nhật với thuế dựa trên địa chỉ thanh toán của bạn. Vui lòng xem lại và thử lại. Thẻ của bạn sẽ chỉ bị tính phí một lần.","price_update.trial_message":"Giá đăng ký đã được cập nhật để bao gồm thuế dựa trên địa chỉ thanh toán của bạn. Thời gian dùng thử miễn phí vẫn được áp dụng. Vui lòng kiểm tra và thử lại.","payment_entry_page.express_checkout_divider":"HOẶC THANH TOÁN BẰNG THẺ","error_page.trouble_accessing":"Nếu bạn gặp sự cố khi truy cập giao dịch mua của mình, hãy liên hệ với bộ phận hỗ trợ theo địa chỉ ","error_page.close_button_title":"Đi đến {{appName}}","error_page.error_title_stripe_missing_required_permission":"Thiếu quyền Stripe","error_page.button_close":"Đóng","error_page.error_message_stripe_invalid_tax_origin_address":"Giao dịch mua không thành công vì địa chỉ gốc thuế không hợp lệ. Trong môi trường thực tế, giao dịch mua sẽ hoạt động mà không áp dụng thuế.","error_page.error_message_stripe_tax_not_active":"Giao dịch mua không thành công vì Thuế Stripe chưa được bật. Trong môi trường thực tế, giao dịch mua sẽ hoạt động mà không áp dụng thuế.","error_page.error_only_in_sandbox":"Thông báo này chỉ xuất hiện trong môi trường thử nghiệm.","error_page.error_message_stripe_missing_required_permission":"Giao dịch mua không thành công vì ứng dụng Stripe thiếu một quyền cần thiết. Trong môi trường thực tế, giao dịch mua sẽ hoạt động mà không áp dụng thuế.","error_page.error_title_stripe_tax_not_active":"Thuế Stripe chưa hoạt động","error_page.error_title_stripe_invalid_tax_origin_address":"Địa chỉ gốc thuế không hợp lệ","apple_pay.free_trial":"Dùng thử miễn phí","product_info.price_after_intro_price":"Sau {{introPriceDuration}}, vào {{renewalDate}}","product_info.after_trial":"sau khi dùng thử","product_info.after":"sau","product_info.intro_price_phase_after_trial":"Sau đó {{introPriceDuration}} với giá {{introPrice}}","product_info.intro_price_phase":"{{introPriceDuration}} đầu tiên với giá {{introPrice}}","product_info.intro_price_phase_paid_once":"trả một lần","payment_entry_page.trial_subscription_terms_info":"Sau khi thời gian dùng thử của bạn kết thúc, bạn sẽ bị tính phí {{price}} {{perFrequency}} bắt đầu từ {{renewalDate}}. Bạn có thể hủy bất cứ lúc nào trước ngày này.","payment_entry_page.subscription_info":"Gói đăng ký tự động gia hạn. Hủy bất cứ lúc nào.","payment_entry_page.otp_terms_info":"Bằng cách mua, bạn đồng ý cho phép {{appName}} tính phí bạn theo các điều khoản của họ.","payment_entry_page.subscription_terms_info":"Bằng cách đăng ký, bạn đồng ý cho phép {{appName}} tính phí bạn theo các điều khoản của họ cho đến khi bạn hủy."};var Ot=(t=>(t.PeriodsWeek="periods.week",t.PeriodsMonth="periods.month",t.PeriodsYear="periods.year",t.PeriodsDay="periods.day",t.PeriodsWeekShort="periods.weekShort",t.PeriodsMonthShort="periods.monthShort",t.PeriodsYearShort="periods.yearShort",t.PeriodsDayShort="periods.dayShort",t.PeriodsLifetime="periods.lifetime",t.PeriodsWeekPlural="periods.weekPlural",t.PeriodsMonthPlural="periods.monthPlural",t.PeriodsYearPlural="periods.yearPlural",t.PeriodsDayPlural="periods.dayPlural",t.PeriodsWeekFrequency="periods.weekFrequency",t.PeriodsMonthFrequency="periods.monthFrequency",t.PeriodsYearFrequency="periods.yearFrequency",t.PeriodsDayFrequency="periods.dayFrequency",t.PeriodsPerWeekFrequency="periods.perWeekFrequency",t.PeriodsPerMonthFrequency="periods.perMonthFrequency",t.PeriodsPerYearFrequency="periods.perYearFrequency",t.PeriodsPerDayFrequency="periods.perDayFrequency",t.PeriodsUnknownFrequency="periods.unknownFrequency",t.PeriodsWeekFrequencyPlural="periods.weekFrequencyPlural",t.PeriodsMonthFrequencyPlural="periods.monthFrequencyPlural",t.PeriodsYearFrequencyPlural="periods.yearFrequencyPlural",t.PeriodsDayFrequencyPlural="periods.dayFrequencyPlural",t.ProductInfoProductTitle="product_info.product_title",t.ProductInfoProductDescription="product_info.product_description",t.ProductInfoProductPrice="product_info.product_price",t.ProductInfoFreeTrialDuration="product_info.free_trial_duration",t.ProductInfoPriceAfterFreeTrial="product_info.price_after_free_trial",t.ProductInfoIntroPricePhaseAfterTrial="product_info.intro_price_phase_after_trial",t.ProductInfoIntroPricePhasePaidOnce="product_info.intro_price_phase_paid_once",t.ProductInfoIntroPricePhase="product_info.intro_price_phase",t.ProductInfoPriceAfterIntroPrice="product_info.price_after_intro_price",t.ProductInfoAfterTrial="product_info.after_trial",t.ProductInfoAfter="product_info.after",t.ProductInfoPriceTotalDueToday="product_info.total_due_today",t.ProductInfoSubscribeTo="product_info.subscribe_to",t.ProductInfoRenewalFrequency="product_info.renewal_frequency",t.ProductInfoContinuesUntilCancelled="product_info.continues_until_cancelled",t.ProductInfoCancelAnytime="product_info.cancel_anytime",t.PaymentEntryPagePaymentStepTitle="payment_entry_page.payment_step_title",t.PaymentEntryPageTrialSubscriptionTermsInfo="payment_entry_page.trial_subscription_terms_info",t.PaymentEntryPageSubscriptionTermsInfo="payment_entry_page.subscription_terms_info",t.PaymentEntryPageOtpTermsInfo="payment_entry_page.otp_terms_info",t.PaymentEntryPageSubscriptionInfo="payment_entry_page.subscription_info",t.PaymentEntryPageButtonPay="payment_entry_page.button_pay",t.PaymentEntryPageButtonStartTrial="payment_entry_page.button_start_trial",t.PaymentEntryPageButtonWithPrice="payment_entry_page.button_with_price",t.PaymentEntryPageButtonPaymentMethod="payment_entry_page.button_payment_method",t.PaymentEntryPageExpressCheckoutDivider="payment_entry_page.express_checkout_divider",t.SuccessPagePurchaseSuccessful="success_page.purchase_successful",t.SuccessPageButtonClose="success_page.button_close",t.ErrorPageCloseButtonTitle="error_page.close_button_title",t.ErrorPageIfErrorPersists="error_page.if_error_persists",t.ErrorPageTroubleAccessing="error_page.trouble_accessing",t.ErrorPageErrorTitleAlreadySubscribed="error_page.error_title_already_subscribed",t.ErrorPageErrorTitleAlreadyPurchased="error_page.error_title_already_purchased",t.ErrorPageErrorTitleOtherErrors="error_page.error_title_other_errors",t.ErrorPageErrorTitleStripeTaxNotActive="error_page.error_title_stripe_tax_not_active",t.ErrorPageErrorTitleStripeInvalidTaxOriginAddress="error_page.error_title_stripe_invalid_tax_origin_address",t.ErrorPageErrorTitleStripeMissingRequiredPermission="error_page.error_title_stripe_missing_required_permission",t.ErrorPageErrorMessageAlreadySubscribed="error_page.error_message_already_subscribed",t.ErrorPageErrorMessageAlreadyPurchased="error_page.error_message_already_purchased",t.ErrorPageErrorMessageMissingEmailError="error_page.error_message_missing_email_error",t.ErrorPageErrorMessageInvalidEmailError="error_page.error_message_invalid_email_error",t.ErrorPageErrorMessageNetworkError="error_page.error_message_network_error",t.ErrorPageErrorMessageErrorChargingPayment="error_page.error_message_error_charging_payment",t.ErrorPageErrorMessageErrorSettingUpPurchase="error_page.error_message_error_setting_up_purchase",t.ErrorPageErrorMessageUnknownError="error_page.error_message_unknown_error",t.ErrorPageErrorMessageInvalidTaxLocation="error_page.error_message_invalid_tax_location",t.ErrorPageErrorMessageStripeTaxNotActive="error_page.error_message_stripe_tax_not_active",t.ErrorPageErrorMessageStripeInvalidTaxOriginAddress="error_page.error_message_stripe_invalid_tax_origin_address",t.ErrorPageErrorMessageStripeMissingRequiredPermission="error_page.error_message_stripe_missing_required_permission",t.ErrorPageErrorMessageOnlyInSandbox="error_page.error_only_in_sandbox",t.ErrorButtonTryAgain="error_page.button_try_again",t.ErrorButtonClose="error_page.button_close",t.PaywallVariablesPricePerPeriod="paywall_variables.price_per_period",t.PaywallVariablesSubRelativeDiscount="paywall_variables.sub_relative_discount",t.PaywallVariablesTotalPriceAndPerMonth="paywall_variables.total_price_and_per_month",t.PricingDropdownShowDetails="pricing_dropdown.show_details",t.PricingDropdownHideDetails="pricing_dropdown.hide_details",t.PricingTotalExcludingTax="pricing_table.total_excluding_tax",t.PricingTableTrialEnds="pricing_table.trial_ends",t.PricingTableTotalDueToday="pricing_table.total_due_today",t.PricingTableTax="pricing_table.tax",t.PricingTableEnterBillingAddressToCalculate="pricing_table.enter_billing_address_to_calculate",t.PricingTableEnterStateOrPostalCodeToCalculate="pricing_table.enter_state_or_postal_code_to_calculate",t.PricingTableEnterPostalCodeToCalculate="pricing_table.enter_postal_code_to_calculate",t.NavbarHeaderDetails="navbar_header.details",t.NavbarBackButton="navbar_header.back_button",t.PriceUpdateTitle="price_update.title",t.PriceUpdateBaseMessage="price_update.base_message",t.PriceUpdateTrialMessage="price_update.trial_message",t.ApplePayFreeTrial="apple_pay.free_trial",t))(Ot||{});const hY={en:MK,es:jK,it:LK,ar:BK,ca:UK,zh_Hans:FK,zh_Hant:qK,hr:zK,cs:$K,da:VK,nl:HK,fi:GK,fr:WK,de:KK,el:YK,he:XK,hi:JK,hu:QK,id:ZK,ja:eY,ko:tY,ms:rY,no:nY,pl:aY,pt:iY,ro:sY,ru:oY,sk:cY,sv:lY,th:uY,tr:dY,uk:fY,vi:pY};var Ea=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(Ea||{});function eU(t){const e=t.match(/^PT?([0-9]+)([MDYW])$/);if(!e||e.length<3)return tr.errorLog(`Invalid ISO 8601 duration format: ${t}`),null;const r=parseInt(e[1]);switch(e[2]){case"Y":return{number:r,unit:"year"};case"M":return{number:r,unit:"month"};case"W":return{number:r,unit:"week"};case"D":return{number:r,unit:"day"};default:return tr.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}function CT(t,e,r){if(!r)return null;let n=new Date(t);switch(e.unit){case"year":n.getDate()===29&&n.getMonth()===1&&e.number!==4?n.setFullYear(n.getFullYear()+e.number,n.getMonth(),28):n.setFullYear(n.getFullYear()+e.number,n.getMonth(),n.getDate());break;case"month":n.setMonth(n.getMonth()+e.number,n.getDate()),n.getDate()!==t.getDate()&&(n=new Date(t),n.setMonth(n.getMonth()+e.number+1,0));break;case"week":n.setDate(n.getDate()+e.number*7);break;case"day":n.setDate(n.getDate()+e.number);break}return n}const mY=t=>t/1e6,ql=(t,e,r,n={})=>{const a=mY(t),i={style:"currency",currency:e,currencyDisplay:"symbol",...n,minimumFractionDigits:n.maximumFractionDigits};return new Intl.NumberFormat(r,i).format(a).replace("US$","$")},gY=(t,e)=>{const r=eU(t);return r?e.translatePeriod(r.number,r.unit)||`${r.number} ${r.unit}s`:t},yY=t=>{try{return t.charAt(0).toUpperCase()+t.slice(1)}catch{return t}},wf={noWhitespace:!1,short:!1},tU={useMultipleWords:!1};class Gb{constructor(e={},r=Lf,n=Lf){vt(this,"locales",{}),this.selectedLocale=r,this.defaultLocale=n;const a={};Object.entries(hY).forEach(([i,o])=>{a[i]=new MO(o,i)}),this.locales=a,e&&this.override(e)}static fallback(){return new Gb}override(e){Object.entries(e).forEach(([r,n])=>{this.locales[r]=new MO({...this.locales[r].labels||{},...n},this.getLanguageCodeString(r))})}formatPrice(e,r){const n={currencyDisplay:"narrowSymbol"};e===0&&(n.maximumFractionDigits=0);try{return ql(e,r,this.locale,n)}catch{tr.errorLog(`Failed to create a price formatter for locale: ${this.locale}`)}try{return ql(e,r,this.fallbackLocale,n)}catch{tr.errorLog(`Failed to create a price formatter for locale: ${this.fallbackLocale}`)}return ql(e,r,Lf,n)}get locale(){var e;return((e=this.getLocaleInstance(this.selectedLocale))==null?void 0:e.localeKey)||this.getLanguageCodeString(this.selectedLocale)}get fallbackLocale(){var e;return((e=this.getLocaleInstance(this.defaultLocale))==null?void 0:e.localeKey)||this.getLanguageCodeString(this.defaultLocale)}getLanguageCodeString(e){return e.split("_")[0].split("-")[0]}getLocaleInstance(e){const r=this.getLanguageCodeString(e);return this.locales[e]||this.locales[r]}translate(e,r){const n=this.getLocaleInstance(this.selectedLocale),a=this.getLocaleInstance(this.defaultLocale);return n?.translate(e,r)||a?.translate(e,r)||""}formatCountry(e){return new Intl.DisplayNames([this.locale],{type:"region"}).of(e)||e}translatePeriod(e,r,n=wf){const a=this.getLocaleInstance(this.selectedLocale),i=this.getLocaleInstance(this.defaultLocale);return a?.translatePeriod(e,r,n)||i?.translatePeriod(e,r,n)}translatePeriodUnit(e,r=wf){const n=this.getLocaleInstance(this.selectedLocale),a=this.getLocaleInstance(this.defaultLocale);return n?.translatePeriodUnit(e,r)||a?.translatePeriodUnit(e,r)}translatePeriodFrequency(e,r,n=tU){const a=this.getLocaleInstance(this.selectedLocale),i=this.getLocaleInstance(this.defaultLocale);return a?.translatePeriodFrequency(e,r,n)||i?.translatePeriodFrequency(e,r,n)}translateDate(e,r={}){const n=this.getLocaleInstance(this.selectedLocale),a=this.getLocaleInstance(this.defaultLocale);return n?.translateDate(e,r)||a?.translateDate(e,r)}}class MO{constructor(e={},r){this.labels=e,this.localeKey=r}replaceVariables(e,r){return Object.entries(r).reduce((n,[a,i])=>n.replace(`{{${a}}}`,`${i??""}`),e)}translate(e,r){const n=this.labels[e];if(n)return this.replaceVariables(n,r||{})}translatePeriod(e,r,n=wf){var a;const{noWhitespace:i,short:o}={...wf,...n},c=o?`periods.${r}Short`:Math.abs(e)===1?`periods.${r}`:`periods.${r}Plural`;return(a=this.translate(c,{amount:e.toString()}))==null?void 0:a.replace(" ",i?"":" ")}translatePeriodUnit(e,r=wf){var n;const{noWhitespace:a,short:i}={...wf,...r},o=`periods.${e}${i?"Short":""}`;return(n=this.translate(o,{amount:""}))==null?void 0:n.replace(" ",a?"":" ")}translatePeriodFrequency(e,r,n=tU){const a=n?.useMultipleWords,i=Math.abs(e)===1?`periods.${a===!0?"per":""}${a?yY(r.toString()):r}Frequency`:`periods.${r}FrequencyPlural`;return this.translate(i,{amount:e.toString()})}translateDate(e,r={}){return e.toLocaleDateString(this.localeKey,r)}}zW();const vY=`<svg viewBox="0 0 124 124" fill="var(--rc-color-grey-text-dark)" xmlns="http://www.w3.org/2000/svg">
    <circle cx="62" cy="62" r="62" fill="var(--rc-color-grey-text-dark)" opacity="0.2"/>
    <path d="M87.6668 41.504L82.4968 36.334L62.0002 56.8307L41.5035 36.334L36.3335 41.504L56.8302 62.0006L36.3335 82.4973L41.5035 87.6673L62.0002 67.1706L82.4968 87.6673L87.6668 82.4973L67.1702 62.0006L87.6668 41.504Z"
          />
</svg>
`;var _Y=lt('<div style="color:var(--rc-color-primary);"><!></div>');function rU(t){var e=_Y(),r=Le(e);du(r,()=>vY),ke(t,e)}var bY=lt("<button><!></button>");const kY={hash:"svelte-1wpam0z",code:"button.svelte-1wpam0z {border:none;cursor:pointer;background:transparent;width:fit-content;}"};function nU(t,e){Wt(e,!0),zt(t,kY);var r=bY();r.__click=function(...a){var i;(i=e.onclick)==null||i.apply(this,a)};var n=Le(r);Dn(n,()=>e.children??Ar),mt(()=>{Jl(r,GB(e.class),"svelte-1wpam0z"),r.disabled=!e.onclick,Ut(r,"style",e.style)}),ke(t,r),Kt()}Hb(["click"]);const Js="light",xT="#000000",wY="#FFFFFF";var PT;(function(t){t.body_s="p",t.body_m="p",t.body_l="p",t.body_xl="p",t.heading_xs="h6",t.heading_s="h5",t.heading_m="h4",t.heading_l="h3",t.heading_xl="h2",t.heading_xxl="h1"})(PT||(PT={}));var U_;(function(t){t[t.extra_light=100]="extra_light",t[t.thin=200]="thin",t[t.light=300]="light",t[t.regular=400]="regular",t[t.medium=500]="medium",t[t.semibold=600]="semibold",t[t.bold=700]="bold",t[t.extra_bold=800]="extra_bold",t[t.black=900]="black"})(U_||(U_={}));var F_;(function(t){t.body_s="13px",t.body_m="14px",t.body_l="15px",t.body_xl="16px",t.heading_xs="14px",t.heading_s="16px",t.heading_m="18px",t.heading_l="20px",t.heading_xl="26px",t.heading_xxl="32px"})(F_||(F_={}));var q_;(function(t){t.leading="start",t.center="center",t.trailing="end"})(q_||(q_={}));var AT;(function(t){t.vertical="column",t.horizontal="row",t.zlayer="zstack"})(AT||(AT={}));var RT;(function(t){t.top="flex-start",t.leading="flex-start",t.center="center",t.bottom="flex-end",t.trailing="flex-end"})(RT||(RT={}));var DT;(function(t){t.space_between="space-between",t.space_around="space-around",t.space_evenly="space-evenly",t.start="flex-start",t.center="center",t.end="flex-end"})(DT||(DT={}));function jO(t,e){const r={[`--${e}-block-start`]:"0px",[`--${e}-inline-end`]:"0px",[`--${e}-block-end`]:"0px",[`--${e}-inline-start`]:"0px"};return!t||!e||Object.assign(r,{[`--${e}-block-start`]:`${t.top??0}px`,[`--${e}-inline-end`]:`${t.trailing??0}px`,[`--${e}-block-end`]:`${t.bottom??0}px`,[`--${e}-inline-start`]:`${t.leading??0}px`}),r}function SY(t){return PT[t]}function zl({colorMap:t,colorMode:e=Js,fallback:r="FFFFFF"}){if(!t)return r;const n=t[e]||t[Js];let a="";switch(n?.type){case"hex":case"alias":return n.value??r;case"linear":return a=(n.points||[]).map(i=>`${i.color} ${i.percent}%`).join(", "),`linear-gradient(${n.degrees}deg, ${a})`;case"radial":return a=(n.points||[]).map(i=>`${i.color} ${i.percent}%`).join(", "),`radial-gradient(${a})`;default:return r}}function aU(t,e=Js){if(!t)return"";const r=zl({colorMap:t.color,colorMode:e});return`${t.width}px solid ${r}`}function z_(t){return{"--border-start-start-radius":`${t.top_leading}px`,"--border-start-end-radius":`${t.top_trailing}px`,"--border-end-start-radius":`${t.bottom_leading}px`,"--border-end-end-radius":`${t.bottom_trailing}px`}}function Wb({background_color:t,border:e,margin:r,padding:n,color:a,colorMode:i=Js,shape:o,shadow:c}){const u={"--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"initial","--text-color":"initial","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none"};return n&&Object.assign(u,jO(n,"padding")),r&&Object.assign(u,jO(r,"margin")),t&&(u["--background"]=zl({colorMap:t,colorMode:i,fallback:"transparent"})),a&&(u["--text-color"]=zl({colorMap:a,colorMode:i,fallback:xT})),e&&(u["--border"]=aU(e,i)),o?.type==="rectangle"&&o.corners&&Object.assign(u,z_(o.corners)),o?.type==="pill"&&Object.assign(u,z_({bottom_leading:9999,bottom_trailing:9999,top_leading:9999,top_trailing:9999})),c&&(u["--shadow"]=`${c.x}px ${c.y}px ${c.radius}px 
      ${zl({colorMap:c.color,colorMode:i,fallback:xT})}`),u}function LO(t){return t.type==="fixed"?`${t.value}px`:t.type==="fit"?"fit-content":t.type==="fill"?navigator.userAgent.match(/firefox|fxios/i)?"-moz-available":"-webkit-fill-available":"initial"}function Ig(t){const e={"--width":"initial","--height":"initial","--flex":"initial"},r=LO(t.width),n=LO(t.height),a=t.width.type==="fill"||t.height.type==="fill";return Object.assign(e,{"--width":r,"--height":n,"--flex":a?"initial":"0 1 auto"}),e}function iU(t){const e={"--inset":"initial","--transform":"initial"};switch(t.alignment){case"top_leading":e["--inset"]="0 auto auto 0";break;case"top":e["--inset"]="auto auto auto 50%",e["--transform"]="translate(-50%, 0)";break;case"top_trailing":e["--inset"]="0 0 auto auto";break;case"leading":e["--inset"]="50% 0 50% 0",e["--transform"]="translate(0, -50%)";break;case"center":e["--inset"]="50% auto auto 50%",e["--transform"]="translate(-50%, -50%)";break;case"trailing":e["--inset"]="50% 0 50% auto",e["--transform"]="translate(0, -50%)";break;case"bottom_leading":e["--inset"]="auto auto 0 0";break;case"bottom":e["--inset"]="auto 50% 0 auto",e["--transform"]="translate(50%, 0)";break;case"bottom_trailing":e["--inset"]="auto 0 0 auto";break}return e}function EY(t){const e={"--direction":"initial","--alignment":"initial","--distribution":"initial","--position":"relative","--inset":"initial","--transform":"initial"};return t.type!=="zlayer"&&(Object.assign(e,{"--direction":AT[t.type],"--alignment":RT[t.alignment]}),t.distribution&&Object.assign(e,{"--distribution":DT[t.distribution]})),e}function TY(t){const{font_size:e,horizontal_alignment:r,font_weight:n,font_name:a}=t,i={"--text-align":"initial","--font-weight":"initial","--font-size":"initial","--font-family":"sans-serif","--background-clip":"none","--text-fill-color":"none","--background":"unset"};return Object.assign(i,{"--text-align":q_[r]||q_.leading,"--font-weight":U_[n]||U_.regular,"--font-size":F_[e]||F_.body_m,"--font-family":a||"sans-serif"}),i}function Ui(t){return Object.entries(t).map(([e,r])=>`${e}: ${r}`).join("; ")}function CY(t){const e=r=>{if(r.type==="package"&&r.is_selected_by_default)return r;if("components"in r&&Array.isArray(r.components))for(const n of r.components){const a=e(n);if(a!==void 0)return a}if("stack"in r){const n=e(r.stack);if(n!==void 0)return n}};for(const r of t.components_config.base.stack.components){const n=e(r);if(n!==void 0)return n?.package_id}}const Vx=(t,e)=>e?xY(e).reduce((r,n)=>{var a;if(t){const i=((a=t?.states)==null?void 0:a[n])||{};return{...r,...i}}return r},{}):{},xY=t=>t?Object.entries(t).reduce((e,[r,n])=>(n&&e.push(r),e),[]):[];function Ss(t,e){return t?e?Object.entries(t).reduce((r,[n,a])=>{const i=n.replace(/^--/,`${e}-`);return r[`--${i}`]=a,r},{}):t:{}}function PY(t){const{mask_shape:e,imageAspectRatio:r}=t;let n="";return e?.type==="concave"?n=`M 0 0 
              H 100 
              V ${r*100} 
              Q 50 ${r*80} 0 ${r*100} 
              Z`:e?.type==="convex"?n=`M 0 0 
              H 100 
              V ${r*80} 
              Q 50 ${r*120} 0 ${r*80} 
              Z`:n=`M 0 0 H 100 V ${r*100} H 0 Z`,n}const AY=t=>{const e={"--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px"};return t!=null&&t.corners&&Object.assign(e,z_(t.corners)),e};function RY(t,e){var r;const{color_overlay:n}=e;if(((r=n?.[t])==null?void 0:r.type)!=="linear")return{x1:"0%",y1:"0%",x2:"0%",y2:"0%"};const a=n?.[Js],i=a?.type==="linear"?a.degrees:0,o="50%",c="0%",u=`${Math.round(50+Math.sin((i+90)*Math.PI/90)*50)}%`,d=`${Math.round(50-Math.cos((i+90)*Math.PI/90)*50)}%`;return{x1:o,y1:c,x2:u,y2:d}}function DY({stack:t,zStackChildStyles:e}){var r,n;const a=((n=(r=t?.size)==null?void 0:r.width)==null?void 0:n.type)==="fill"?"100%":"fit-content",i=Ss(e||{},"button");return Ui({...i,position:"var(--button-position, relative)",inset:"var(--button-inset, 0)",transform:"var(--button-transform, initial)",width:a})}const sf=[];function sU(t,e){return{subscribe:Hx(t,e).subscribe}}function Hx(t,e=Ar){let r=null;const n=new Set;function a(c){if(vB(t,c)&&(t=c,r)){const u=!sf.length;for(const d of n)d[1](),sf.push(d,t);if(u){for(let d=0;d<sf.length;d+=2)sf[d][0](sf[d+1]);sf.length=0}}}function i(c){a(c(t))}function o(c,u=Ar){const d=[c,u];return n.add(d),n.size===1&&(r=e(a,i)||Ar),c(t),()=>{n.delete(d),n.size===0&&r&&(r(),r=null)}}return{set:a,update:i,subscribe:o}}function oU(t,e,r){const n=!Array.isArray(t),a=n?[t]:t;if(!a.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const i=e.length<2;return sU(r,(o,c)=>{let u=!1;const d=[];let f=0,h=Ar;const m=()=>{if(f)return;h();const w=e(n?d[0]:d,o,c);i?o(w):h=typeof w=="function"?w:Ar},_=a.map((w,b)=>ZB(w,E=>{d[b]=E,f&=~(1<<b),u&&m()},()=>{f|=1<<b}));return u=!0,m(),function(){O_(_),h(),u=!1}})}function OY(t){pt(t,t.v+1)}function NY(t){let e=0,r=ai(0),n;return()=>{WW()&&($(r),Rg(()=>(e===0&&(n=Wo(()=>t(()=>OY(r)))),e+=1,()=>{oK().then(()=>{e-=1,e===0&&(n?.(),n=void 0)})})))}}const cU=Symbol("paywall");function IY(t){Zu(cU,t)}function Gx(){const t=Jn(cU);if(t===void 0)throw new Error("Paywall context not found");return t}const MY={hash:"svelte-mx8s0a",code:""};function jY(t,e){Wt(e,!0),zt(t,MY);const r=fu(e,["$$slots","$$events","$$legacy","stack","action"]),{onButtonAction:n}=Gx(),a=()=>n(e.action),i=ze(()=>DY({stack:e.stack,action:e.action,...r}));nU(t,{onclick:a,get style(){return $(i)},class:"rc-pw-button",children:(o,c)=>{Mg(o,Fc(()=>e.stack))},$$slots:{default:!0}}),Kt()}const lU={light:{type:"hex",value:xT}},LY={light:{type:"hex",value:wY}},Wx=(t,e)=>{const{font_size:r="body_m",color:n=lU,background_color:a=LY,padding:i,margin:o,size:c}=e,u={"--width":"unset","--height":"unset","--text-align":"initial","--font-weight":"initial","--font-size":"initial","--font-family":"sans-serif","--background-clip":"unset","--text-fill-color":"unset","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"transparent","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--flex":"0 1 auto"},d=Vx(e.overrides,e.componentState),f=SY(r),h=TY({...e,...d}),m=Wb({background_color:a,color:n,margin:o,padding:i,colorMode:t,...d}),_=Ig({...c,...d}),w={...u,...m,...h,..._};return{textStyles:Ss(w,"text"),tagToRender:f}};function BY(t,e,r){const n={"--width":"unset","--height":"unset","--flex":"0 1 auto","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"transparent","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--position":"relative","--inset":"0","--transform":"initial"};Object.assign(n,Wb({background_color:r,...t}),Ig(e)),Object.assign(n,t.zStackChildStyles);const a=Ss(n,"text");return Ui(a)}function UY(t,e){const r={"--text-margin-block-start":"0px","--text-margin-inline-end":"0px","--text-margin-block-end":"0px","--text-margin-inline-start":"0px","--text-padding-block-start":"0px","--text-padding-inline-end":"0px","--text-padding-block-end":"0px","--text-padding-inline-start":"0px","--text-background":"transparent","--text-text-color":"inherit","--text-border":"none","--text-border-end-start-radius":"0px","--text-border-end-end-radius":"0px","--text-border-start-start-radius":"0px","--text-border-start-end-radius":"0px","--text-shadow":"none","--text-text-align":"initial","--text-font-weight":"initial","--text-font-size":"initial","--text-font-family":"sans-serif","--text-background-clip":"initial","--text-text-fill-color":"initial","--text-width":"unset","--text-height":"unset","--text-flex":"0 1 auto"},{tagToRender:n,textStyles:a}=Wx(t,e);return Object.assign(r,a),{tagToRender:n,textStyles:Ui(r)}}function FY(t){return t?Object.values({newLine:{regexp:/\\\n/g,output:"<br/>"},bold:{regexp:/\*\*(.*?)\*\*/g,output:"<b>$1</b>"},italic:{regexp:/\*(.*?)\*/g,output:"<i>$1</i>"},strikethrough:{regexp:/~(.*?)~/g,output:"<s>$1</s>"},code:{regexp:/`(.*?)`/g,output:"<span style='font-family: monospace'>$1</span>"},link:{regexp:/\[(.*?)\]\((.*?)\)/g,output:"<a href=$2 target='_blank' rel='noopener noreferrer'>$1</a>"}}).reduce((e,{regexp:r,output:n})=>e.replaceAll(r,n),t):""}const qY={hash:"svelte-1wz4si8",code:".rc-pw-text-block.svelte-1wz4si8 {display:block;padding-block-start:var(--text-padding-block-start, initial);padding-inline-end:var(--text-padding-inline-end, initial);padding-block-end:var(--text-padding-block-end, initial);padding-inline-start:var(--text-padding-inline-start, initial);margin-block-start:var(--text-margin-block-start, initial);margin-inline-end:var(--text-margin-inline-end, initial);margin-block-end:var(--text-margin-block-end, initial);margin-inline-start:var(--text-margin-inline-start, initial);color:var(--text-text-color, #ffffff);background:var(--text-background, none);font-size:var(--text-font-size, 1rem);font-weight:var(--text-font-weight, normal);text-align:var(--text-text-align, center);font-family:var(--text-font-family, sans-serif);-webkit-background-clip:var(--text-background-clip, initial);background-clip:var(--text-background-clip, initial);-webkit-text-fill-color:var(--text-text-fill-color, initial);}"};function uU(t,e){Wt(e,!0),zt(t,qY);const r=It(e,"styleVariables",3,""),n=It(e,"component",3,"p");var a=wr(),i=Xt(a);L_(i,n,!1,(o,c)=>{let u;mt(()=>u=B_(o,u,{id:e.id,style:r(),class:"rc-pw-text-block"},"svelte-1wz4si8",o.namespaceURI===Rm,o.nodeName.includes("-")));var d=wr(),f=Xt(d);Dn(f,()=>e.children??Ar),ke(c,d)}),ke(t,a),Kt()}var Kv,Yv;class zY{constructor(e,r){bO(this,Kv),bO(this,Yv),kO(this,Kv,e),kO(this,Yv,NY(r))}get current(){return _O(this,Yv).call(this),_O(this,Kv).call(this)}}Kv=new WeakMap,Yv=new WeakMap;const $Y=/\(.+\)/;class VY extends zY{constructor(e,r){let n=$Y.test(e)?e:`(${e})`;const a=window.matchMedia(n);super(()=>a.matches,i=>fK(a,"change",i))}}const dU=Symbol("color-mode");function HY(t){const e=new VY("prefers-color-scheme: dark",(t?.()??Js)==="dark"),r=()=>t?.()??(e.current?"dark":Js);return Zu(dU,r),r}function Kb(){return Jn(dU)??(()=>Js)}const fU=Symbol("localization");function GY(t){const e={getLocalizedString:r=>{var n,a;if(!r)return"";const{selectedLocale:i,defaultLocale:o,localizations:c}=t(),u=(n=c[i??o])==null?void 0:n[r],d=(a=c[o])==null?void 0:a[r];return u??d}};return Zu(fU,e),e}function Kx(){const t=Jn(fU);if(t===void 0)throw new Error("Localization context not found");return t}const WY=["product_name","price","price_per_period","price_per_period_full","total_price_and_per_month","total_price_and_per_month_full","sub_price_per_month","sub_price_per_week","sub_duration","sub_duration_in_months","sub_period","sub_period_length","sub_period_abbreviated","sub_offer_duration","sub_offer_duration_2","sub_offer_price","sub_offer_price_2","sub_relative_discount"];function $_(t="",e){return e===void 0?t:WY.reduce((r,n)=>{var a;return r.replaceAll(`{{ ${n} }}`,((a=e[n])==null?void 0:a.toString())||"N/A")},t)}const pU=Symbol("variables");function hU(t){Zu(pU,t)}function Yb(){const t=Jn(pU);if(t===void 0)throw new Error("Variables context not found");return t}var KY=lt('<span class="rc-pw-text-wrapper svelte-11gzifq"><!></span>');const YY={hash:"svelte-11gzifq",code:".rc-pw-text-wrapper.svelte-11gzifq {display:block;height:var(--text-height, initial);width:var(--text-width, initial);background:var(--text-background, none);position:var(--text-position, relative);inset:var(--text-inset, 0);transform:var(--text-transform, initial);}"};function XY(t,e){Wt(e,!0),zt(t,YY);const r=Aa(),n=()=>ha(h,"$variables",r),a=fu(e,["$$slots","$$events","$$legacy","id","text_lid","background_color","size"]),i=Kb(),o=ze(i),c=ze(()=>UY($(o),{id:e.id,text_lid:e.text_lid,background_color:e.background_color,size:e.size,...a})),u=ze(()=>$(c).tagToRender),d=ze(()=>$(c).textStyles),f=ze(()=>BY(a,e.size,e.background_color)),h=Yb(),{getLocalizedString:m}=Kx(),_=ze(()=>$_(m(e.text_lid),n())),w=ze(()=>FY($(_)));var b=KY(),E=Le(b);uU(E,{get styleVariables(){return $(d)},get component(){return $(u)},get id(){return e.id},children:(T,R)=>{var P=wr(),A=Xt(P);du(A,()=>$(w)),ke(T,P)},$$slots:{default:!0}}),mt(()=>Ut(b,"style",$(f))),ke(t,b),Kt()}function V_(t,e){Wt(e,!0);const r={stack:Mg,text:XY,image:yX,button:jY,purchase_button:DX,package:kX,footer:mU,timeline:UX},n=h=>{if(r[h.type])return[r[h.type],h];const{fallback:m}=h;if(m&&r[m?.type])return[r[m.type],m];throw new Error(`Invalid component type: ${h.type}`)},a=fu(e,["$$slots","$$events","$$legacy","nodeData","zStackChildStyles"]),i=ze(()=>n(e.nodeData)),o=ze(()=>$(i)[0]),c=ze(()=>$(i)[1]),u=ze(()=>("components"in e.nodeData?e.nodeData.components:void 0)??[]);var d=wr(),f=Xt(d);return vK(f,()=>$(o),(h,m)=>{m(h,Fc(()=>$(c)||{},{get zStackChildStyles(){return e.zStackChildStyles}},()=>a,{children:(_,w)=>{var b=wr(),E=Xt(b);sp(E,17,()=>$(u),ip,(T,R)=>{V_(T,Fc({get nodeData(){return $(R)}},()=>a))}),ke(_,b)},$$slots:{default:!0}}))}),ke(t,d),Kt({getComponentClass:n})}const JY=(t,e)=>{const{background_color:r,margin:n,padding:a,spacing:i,size:o,border:c,shape:u,shadow:d,dimension:f,componentState:h,overrides:m,zStackChildStyles:_}=e,w={"--flex":"0 1 auto","--height":"initial","--width":"initial","--spacing":`${i||0}px`,"--direction":"unset","--alignment":"unset","--distribution":"flex-start","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"unset","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--position":"relative","--transform":"initial","--inset":"initial"},b=Vx(m,h);Object.assign(w,Wb({background_color:r,margin:n,padding:a,border:c,colorMode:t,shape:u,shadow:d,...b}),EY({...f,...b}),Ig({...o,...b})),Object.assign(w,_);const E=Ss(w,"stack");return Ui(E)};function QY(t,e){var r,n,a,i,o,c;const{badge:u}=e;if(!u)return"";const d={"--inset":"unset","--transform":"unset","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"unset","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--badge-width":"unset","--z-index":"unset"};if(Object.assign(d,iU({alignment:u.alignment}),Wb({...u,background_color:u.background_color,color:u.color,colorMode:t})),u.style==="overlay"&&(d["--margin-block-start"]="0px",d["--margin-block-end"]="0px",d["--transform"]=ov(u,0,-(((r=e.border)==null?void 0:r.width)||0))),u.style==="edge_to_edge")if(d["--margin-block-start"]="0px",d["--margin-block-end"]="0px",d["--margin-inline-start"]="0px",d["--margin-inline-end"]="0px",u.alignment==="top"||u.alignment==="bottom"){d["--badge-width"]=`calc(100% + ${(((n=e.border)==null?void 0:n.width)||0)*2}px)`,d["--z-index"]="-1";const h=Math.max(((i=(a=e.shape)==null?void 0:a.corners)==null?void 0:i.top_leading)||0,((c=(o=e.shape)==null?void 0:o.corners)==null?void 0:c.top_trailing)||0);u.alignment==="top"&&(d["--padding-block-end"]=`${h+u.padding.bottom}px`,d["--transform"]=ov(u,h)),u.alignment==="bottom"&&(d["--padding-block-start"]=`${h+u.padding.top}px`,d["--transform"]=ov(u,-h))}else d["--transform"]=ov(u),Object.assign(d,ZY(e));const f=Ss(d,"stack-badge");return Ui(f)}const BO={top_leading:"bottom_trailing",top_trailing:"bottom_leading",bottom_leading:"top_trailing",bottom_trailing:"top_leading"},UO={top_leading:"--border-start-start-radius",top_trailing:"--border-start-end-radius",bottom_leading:"--border-end-start-radius",bottom_trailing:"--border-end-end-radius"};function ZY(t){var e,r,n;const a={"--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px"},{badge:i}=t;if(!i)return a;const o=((e=t.border)==null?void 0:e.width)||0,c=i.alignment;return a[UO[BO[c]]]=`${(r=i.shape)==null?void 0:r.corners[BO[c]]}px`,a[UO[c]]=`${((n=t.shape)==null?void 0:n.corners[c])-o}px`,a}function ov(t,e=0,r=0){if(!t)return"";if(t.style==="overlay"){if(t.alignment==="top_leading")return`translate(${r}px, calc(-50% + ${e}px))`;if(t.alignment==="top_trailing")return`translate(calc(0% - ${r}px), calc(-50% + ${e}px))`;if(t.alignment==="bottom_leading")return`translate(${r}px, calc(50% + ${e}px))`;if(t.alignment==="bottom_trailing")return`translate(calc(0% - ${r}px), calc(50% + ${e}px))`;if(t.alignment==="top")return`translate(calc(-50% + ${r}px), calc(-50% + ${e}px))`;if(t.alignment==="bottom")return`translate(calc(50% + ${r}px), calc(50% + ${e}px))`}if(t.style==="edge_to_edge"){if(t.alignment==="top")return`translate(calc(-50% + ${r}px), calc(-100% - ${e}px + 16px))`;if(t.alignment==="bottom")return`translate(calc(50% + ${r}px), calc(100% + ${e}px))`}return""}function eX(t,e){const{badge:r}=e;if(!r)return{tagToRender:"",textStyles:""};const{tagToRender:n,textStyles:a}=Wx(t,{id:e.id,...r,type:"text",size:{width:{type:"fit"},height:{type:"fit"}},color:r?.color,name:e.name}),i={...a,"--text-margin-block-start":"0px","--text-margin-inline-end":"0px","--text-margin-block-end":"0px","--text-margin-inline-start":"0px","--text-padding-block-start":"0px","--text-padding-inline-end":"0px","--text-padding-block-end":"0px","--text-padding-inline-start":"0px"},o=Ui(i);return{tagToRender:n,textStyles:o}}function tX(t){const{dimension:e}=t,r={"--inset":"initial","--transform":"initial","--position":"relative"};if(e.type!=="zlayer")return;const n=iU({...e});return Object.assign(r,{...n,"--position":"absolute"}),r}var rX=lt('<span class="rc-pw-badge svelte-1b5bst5"><!></span>'),nX=lt('<div class="rc-pw-stack-wrapper svelte-1b5bst5"><!> <div class="rc-pw-stack svelte-1b5bst5"></div></div>');const aX={hash:"svelte-1b5bst5",code:`.rc-pw-stack-wrapper.svelte-1b5bst5 {display:block;box-sizing:border-box;width:var(--stack-width, unset);height:var(--stack-height, unset);box-shadow:var(--stack-shadow, none);background:var(--stack-background, unset);position:var(--stack-position, relative);transform:var(--stack-transform, initial);inset:var(--stack-inset, initial);margin-block-start:var(--stack-margin-block-start, 0);margin-inline-end:var(--stack-margin-inline-end, 0);margin-block-end:var(--stack-margin-block-end, 0);margin-inline-start:var(--stack-margin-inline-start, 0);border:var(--stack-border, none);border-end-start-radius:var(--stack-border-end-start-radius, 0px);border-end-end-radius:var(--stack-border-end-end-radius, 0px);border-start-start-radius:var(--stack-border-start-start-radius, 0px);border-start-end-radius:var(--stack-border-start-end-radius, 0px);}.rc-pw-stack.svelte-1b5bst5 {background:none;overflow:hidden;box-sizing:border-box;width:100%;height:100%;display:flex;gap:var(--stack-spacing, 0);flex:var(--stack-flex, 0 1 auto);flex-direction:var(--stack-direction, unset);justify-content:var(--stack-distribution, flex-start);align-items:var(--stack-alignment, flex-start);padding-block-start:var(--stack-padding-block-start, 0);padding-inline-end:var(--stack-padding-inline-end, 0);padding-block-end:var(--stack-padding-block-end, 0);padding-inline-start:var(--stack-padding-inline-start, 0);}.rc-pw-badge.svelte-1b5bst5 {box-sizing:border-box;font-family:var(--stack-badge-font-family, sans-serif);position:absolute;inset:var(--stack-badge-inset, unset);transform:var(--stack-badge-transform, initial);margin-block-start:var(--stack-badge-margin-block-start, 0px);margin-inline-end:var(--stack-badge-margin-inline-end, 0px);margin-block-end:var(--stack-badge-margin-block-end, 0px);margin-inline-start:var(--stack-badge-margin-inline-start, 0px);padding-block-start:var(--stack-badge-padding-block-start, 0px);padding-inline-end:var(--stack-badge-padding-inline-end, 0px);padding-block-end:var(--stack-badge-padding-block-end, 0px);padding-inline-start:var(--stack-badge-padding-inline-start, 0px);background:var(--stack-badge-background, initial);color:var(--stack-badge-text-color, inherit);border:var(--stack-badge-border, none);border-end-start-radius:var(--stack-badge-border-end-start-radius, 0px);border-end-end-radius:var(--stack-badge-border-end-end-radius, 0px);border-start-start-radius:var(
      --stack-badge-border-start-start-radius,
      0px
    );border-start-end-radius:var(--stack-badge-border-start-end-radius, 0px);box-shadow:var(--stack-badge-shadow, none);display:flex;align-items:center;justify-content:center;width:var(--stack-badge-badge-width, max-content);height:var(--stack-badge-badge-height, max-content);z-index:var(--stack-badge-z-index, 1);}`};function Mg(t,e){Wt(e,!0),zt(t,aX);const r=Aa(),n=()=>ha(f,"$variables",r),a=fu(e,["$$slots","$$events","$$legacy","id","components","badge","zStackChildStyles"]),i=Kb(),o=ze(i),c=ze(()=>JY($(o),{id:e.id,components:e.components,zStackChildStyles:e.zStackChildStyles,...a})),u=ze(()=>QY($(o),{id:e.id,components:e.components,badge:e.badge,...a})),d=ze(()=>tX({id:e.id,components:e.components,...a})),f=Yb(),{getLocalizedString:h}=Kx(),m=ze(()=>{var A;return $_(h((A=e.badge)==null?void 0:A.text_lid),n())}),_=ze(()=>eX($(o),{id:e.id,components:e.components,badge:e.badge,...a})),w=ze(()=>$(_).tagToRender),b=ze(()=>$(_).textStyles);var E=nX(),T=Le(E);{var R=A=>{var C=rX(),O=Le(C);uU(O,{get styleVariables(){return $(b)},get component(){return $(w)},children:(I,x)=>{var D=Ur();mt(()=>hr(D,$(m))),ke(I,D)},$$slots:{default:!0}}),mt(()=>Ut(C,"style",$(u))),ke(A,C)};xt(T,A=>{e.badge&&A(R)})}var P=kt(T,2);sp(P,21,()=>e.components,ip,(A,C,O)=>{var I=wr(),x=Xt(I);{var D=L=>{var j=ze(()=>O>0?$(d):void 0);V_(L,{get nodeData(){return $(C)},get componentState(){return e.componentState},get zStackChildStyles(){return $(j)}})},N=L=>{V_(L,{get nodeData(){return $(C)},get componentState(){return e.componentState}})};xt(x,L=>{$(d)?L(D):L(N,!1)})}ke(A,I)}),mt(()=>{Ut(E,"id",e.id),Ut(E,"style",$(c))}),ke(t,E),Kt()}var iX=lt('<div class="rc-pw-footer svelte-pg5jlz"><!></div>');const sX={hash:"svelte-pg5jlz",code:".rc-pw-footer.svelte-pg5jlz {position:sticky;bottom:0;transform:translateY(50%);width:100%;}"};function mU(t,e){zt(t,sX);var r=iX(),n=Le(r);Mg(n,Fc(()=>e.stack)),mt(()=>Ut(r,"id",e.id)),ke(t,r)}const oX=(t,e)=>{const{size:r,overrides:n,componentState:a,zStackChildStyles:i}=e,o={"--height":"unset","--width":"unset","--clip-path":"none","--border-end-start-radius":"unset","--border-end-end-radius":"unset","--border-start-start-radius":"unset","--border-start-end-radius":"unset","--position":"relative","--inset":"0","--transform":"initial"},c=Vx(n,a);Object.assign(o,i),Object.assign(o,Ig({...r,...c})),Object.assign(o,AY(e.mask_shape));const u=Ss(o,"image"),d=PY(e),f=RY(t,e);return{imageStyles:Ui(u),maskPath:d,linearGradientAngle:f}};var cX=Jo('<ellipse cx="50" rx="50"></ellipse>'),lX=Jo("<path></path>"),uX=Jo("<stop></stop>"),dX=Jo("<linearGradient></linearGradient>"),fX=Jo("<stop></stop>"),pX=Jo('<radialGradient cx="50%" cy="50%" r="50%" fx="50%" fy="50%"></radialGradient>'),hX=Jo('<linearGradient><stop offset="0%"></stop></linearGradient>'),mX=lt('<img style="display: none;" alt=""> <svg class="rc-pw-image-container svelte-1esrvxg" preserveAspectRatio="xMidYMid slice"><defs><clipPath><!></clipPath><!></defs><image class="rc-pw-image svelte-1esrvxg" x="0" y="0" width="100" preserveAspectRatio="xMidYMid slice"></image><rect class="rc-pw-image-overlay svelte-1esrvxg" x="0" y="0" width="100"></rect></svg>',1);const gX={hash:"svelte-1esrvxg",code:".rc-pw-image-container.svelte-1esrvxg {border-end-start-radius:var(--image-border-end-start-radius, 0px);border-end-end-radius:var(--image-border-end-end-radius, 0px);border-start-start-radius:var(--image-border-start-start-radius, 0px);border-start-end-radius:var(--image-border-start-end-radius, 0px);position:relative;overflow:hidden;display:flex;flex:var(--image-flex, 1 1 auto);position:var(--image-position, relative);inset:var(--image-inset, 0);transform:var(--image-transform, initial);height:var(--image-height, initial);width:var(--image-width, initial);}.rc-pw-image.svelte-1esrvxg {width:100%;height:100%;object-fit:cover;display:block;}.rc-pw-image-overlay.svelte-1esrvxg {position:absolute;inset:0;}"};function yX(t,e){Wt(e,!0),zt(t,gX);const r=fu(e,["$$slots","$$events","$$legacy","id","source"]),n=Kb(),a=ze(n);let i=sr(0),o;function c(){o&&pt(i,o.naturalHeight/o.naturalWidth)}const u=ze(()=>oX($(a),{id:e.id,source:e.source,...r,imageAspectRatio:$(i)})),d=ze(()=>$(u).imageStyles),f=ze(()=>$(u).maskPath),h=ze(()=>$(u).linearGradientAngle),m=ze(()=>{var j,q;return(j=e.source[$(a)])!=null&&j.original?e.source[$(a)].original:(q=e.source[Js])==null?void 0:q.original}),_=ze(()=>e.color_overlay),w=ze(()=>{var j,q;return((j=$(_))==null?void 0:j[$(a)])??((q=$(_))==null?void 0:q[Js])});var b=mX(),E=Xt(b);JB(E,j=>o=j,()=>o);var T=kt(E,2),R=Le(T),P=Le(R),A=Le(P);{var C=j=>{var q=cX();mt(()=>{Ut(q,"cy",$(i)*50),Ut(q,"ry",$(i)*50)}),ke(j,q)},O=j=>{var q=lX();mt(()=>Ut(q,"d",$(f))),ke(j,q)};xt(A,j=>{var q;((q=e.mask_shape)==null?void 0:q.type)==="circle"?j(C):j(O,!1)})}var I=kt(P);{var x=j=>{var q=dX();sp(q,21,()=>{var U;return((U=$(w))==null?void 0:U.points)||[]},ip,(U,W)=>{var F=uX();mt(()=>{Ut(F,"offset",`${$(W).percent}%`),Ut(F,"style",`stop-color: ${$(W).color}`)}),ke(U,F)}),mt(()=>{Ut(q,"id",`gradient-${e.id}`),Ut(q,"x1",$(h).x1),Ut(q,"y1",$(h).y1),Ut(q,"x2",$(h).x2),Ut(q,"y2",$(h).y2)}),ke(j,q)},D=j=>{var q=wr(),U=Xt(q);{var W=Y=>{var Q=pX();sp(Q,21,()=>{var ie;return((ie=$(w))==null?void 0:ie.points)||[]},ip,(ie,G)=>{var B=fX();mt(()=>{Ut(B,"offset",`${$(G).percent}%`),Ut(B,"style",`stop-color: ${$(G).color}`)}),ke(ie,B)}),mt(()=>Ut(Q,"id",`gradient-${e.id}`)),ke(Y,Q)},F=Y=>{var Q=wr(),ie=Xt(Q);{var G=B=>{var K=hX(),ae=Le(K);mt(()=>{var te;Ut(K,"id",`gradient-${e.id}`),Ut(ae,"style",`stop-color: ${(te=$(w))==null?void 0:te.value}`)}),ke(B,K)};xt(ie,B=>{var K;((K=$(w))==null?void 0:K.type)==="hex"&&B(G)},!0)}ke(Y,Q)};xt(U,Y=>{var Q;((Q=$(w))==null?void 0:Q.type)==="radial"?Y(W):Y(F,!1)},!0)}ke(j,q)};xt(I,j=>{var q;((q=$(w))==null?void 0:q.type)==="linear"?j(x):j(D,!1)})}var N=kt(R),L=kt(N);mt(()=>{Ut(E,"src",$(m)),Ut(T,"id",`rc-pw-image-container-${e.id}`),Ut(T,"style",$(d)),Ut(T,"viewBox",`0 0 100 ${$(i)*100}`),Ut(P,"id",`clip-path-${e.id}`),Ut(N,"href",$(m)),Ut(N,"height",$(i)*100),Ut(N,"clip-path",`url(#clip-path-${e.id})`),Ut(N,"id",e.id),Ut(L,"height",$(i)*100),Ut(L,"clip-path",`url(#clip-path-${e.id})`),Ut(L,"fill",`url(#gradient-${e.id})`)}),Mo("load",E,c),ke(t,b),Kt()}const vX=(t,e,r,n)=>xK(r,Vt(n.package_id));var _X=lt('<button class="rc-pw-package svelte-123kamd"><!></button>');const bX={hash:"svelte-123kamd",code:".rc-pw-package.svelte-123kamd {width:100%;display:flex;margin:0;padding:0;background:initial;border:initial;text-align:initial;position:var(--package-position, relative);inset:var(--package-inset, 0);transform:var(--package-transform, initial);}"};function kX(t,e){Wt(e,!0),zt(t,bX);const r=Aa(),n=()=>ha(i,"$selectedPackageId",r),a=()=>ha(o,"$variablesPerPackage",r),{selectedPackageId:i,variablesPerPackage:o}=Gx(),c=Yb(),u=oU(c,_=>{var w;return((w=a())==null?void 0:w[e.package_id])??_});hU(u);const d=ze(()=>({selected:n()===e.package_id})),f=ze(()=>Ui(Ss(e.zStackChildStyles,"package")));var h=_X();h.__click=[vX,n,i,e];var m=Le(h);Mg(m,Fc(()=>e.stack,{get componentState(){return $(d)}})),mt(()=>{Ut(h,"id",e.id),Ut(h,"style",$(f)),jc(h,"selected",$(d).selected)}),ke(t,h),Kt()}Hb(["click"]);function wX({background:t,colorMode:e}){const r={"--background":"initial"};t?.type==="color"&&Object.assign(r,{"--background":zl({colorMap:t.value,colorMode:e,fallback:"transparent"})});const n=Ss(r,"paywall");return Ui(n)}function SX(t,e){var r,n;const{background:a}=t.components_config.base;if(a?.type!=="image")return"";const{value:i}=a;return((r=i[e])==null?void 0:r.original)??((n=i[Js])==null?void 0:n.original)}var EX=lt('<div class="rc-pw-paywall-background svelte-14bszwq"></div>'),TX=lt('<div class="rc-pw-paywall-background rc-pw-image-container svelte-14bszwq"><img class="rc-pw-image svelte-14bszwq" alt=""></div>'),CX=lt('<div class="rc-pw-paywall svelte-14bszwq"><!> <!> <!></div>');const xX={hash:"svelte-14bszwq",code:`.rc-pw-paywall.svelte-14bszwq {position:relative;display:block;max-height:100%;}.rc-pw-paywall-background.svelte-14bszwq {position:absolute;top:0;left:0;width:100%;height:100%;background:var(--paywall-background, none);z-index:-1;}.rc-pw-image-container.svelte-14bszwq {overflow:hidden;background:none;}.rc-pw-image.svelte-14bszwq {width:100%;height:100%;object-fit:cover;display:block;}*,
    *::before,
    *::after {box-sizing:border-box;margin:0;padding:0;font-family:sans-serif;}body {line-height:1.5;-webkit-font-smoothing:antialiased;}img,
    picture,
    video,
    canvas,
    svg {display:block;max-width:100%;}input,
    button,
    textarea,
    select {font:inherit;}p,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {overflow-wrap:break-word;}p {text-wrap:pretty;}h1,
    h2,
    h3,
    h4,
    h5,
    h6 {text-wrap:balance;}#root,
    #__next {isolation:isolate;}`};function PX(t,e){Wt(e,!0),zt(t,xX);const r=Aa(),n=()=>ha(u,"$selectedPackageId",r),a=It(e,"variablesPerPackage",19,()=>({})),i=HY(()=>e.preferredColorMode),o=ze(i),{getLocalizedString:c}=GY(()=>({defaultLocale:e.paywallData.default_locale,selectedLocale:e.selectedLocale,localizations:e.paywallData.components_localizations})),u=Hx(CY(e.paywallData)),d=()=>{var E;const T=n();T!==void 0&&((E=e.onPurchaseClicked)==null||E.call(e,T))},f=E=>{var T,R,P,A;switch(E.type){case"navigate_back":(T=e.onBackClicked)==null||T.call(e);return;case"restore_purchases":(R=e.onRestorePurchasesClicked)==null||R.call(e);return}switch(E.destination){case"customer_center":(P=e.onVisitCustomerCenterClicked)==null||P.call(e);return;case"privacy_policy":case"terms":case"url":const C=c(E.url.url_lid);C&&((A=e.onNavigateToUrlClicked)==null||A.call(e,C));return;case"offer_code":case"sheet":case"web_paywall_link":return}};IY({selectedPackageId:u,variablesPerPackage:sU(a()),onPurchase:d,onButtonAction:f});const h=oU(u,E=>a()[E||""]);hU(h);const m=ze(()=>{var E;return wX({background:(E=e.paywallData.components_config.base)==null?void 0:E.background,colorMode:$(o)})}),_=ze(()=>SX(e.paywallData,$(o)));var w=wr(),b=Xt(w);DK(b,{get onerror(){return e.onError}},E=>{var T=CX(),R=Le(T);V_(R,{get nodeData(){return e.paywallData.components_config.base.stack}});var P=kt(R,2);{var A=x=>{mU(x,Fc(()=>e.paywallData.components_config.base.sticky_footer,{get stack(){return e.paywallData.components_config.base.sticky_footer.stack}}))};xt(P,x=>{e.paywallData.components_config.base.sticky_footer&&x(A)})}var C=kt(P,2);{var O=x=>{var D=EX();mt(()=>Ut(D,"style",$(m))),ke(x,D)},I=x=>{var D=wr(),N=Xt(D);{var L=j=>{var q=TX(),U=Le(q);mt(()=>Ut(U,"src",$(_))),ke(j,q)};xt(N,j=>{var q;((q=e.paywallData.components_config.base.background)==null?void 0:q.type)==="image"&&j(L)},!0)}ke(x,D)};xt(C,x=>{var D;((D=e.paywallData.components_config.base.background)==null?void 0:D.type)==="color"?x(O):x(I,!1)})}ke(E,T)}),ke(t,w),Kt()}function AX({stack:t,zStackChildStyles:e}){const r=t.size.width.type==="fill"?"100%":"fit-content",n=Ss(e||{},"purchase-button");return Ui({...n,position:"var(--purchase-button-position, relative)",inset:"var(--purchase-button-inset, 0)",transform:"var(--purchase-button-transform, initial)",width:r})}const RX={hash:"svelte-1x8zwdp",code:""};function DX(t,e){Wt(e,!0),zt(t,RX);const r=fu(e,["$$slots","$$events","$$legacy","stack","zStackChildStyles"]),{onPurchase:n}=Gx(),a=ze(()=>AX({stack:e.stack,zStackChildStyles:e.zStackChildStyles,...r}));nU(t,{onclick:n,class:"rc-pw-purchase-button",get style(){return $(a)},children:(i,o)=>{Mg(i,Fc(()=>e.stack))},$$slots:{default:!0}}),Kt()}function OX(t){const e={"--item-spacing":`${t.item_spacing}px`,"--width":"initial","--height":"initial","--flex":"0 1 auto","--position":"relative","--inset":"0","--transform":"initial"};Object.assign(e,Ig(t.size)),Object.assign(e,t.zStackChildStyles);const r=Ss(e,"timeline");return Ui(r)}function NX(t,e){var r,n,a,i,o,c,u,d;const f={"--icon-size":`${e.icon.width_and_height}px`,"--icon-padding":`${e.icon.padding}px`,"--icon-color":zl({colorMap:e.icon.color,colorMode:t}),"--icon-background-color":zl({colorMap:(r=e.icon_background)==null?void 0:r.color,colorMode:t}),"--icon-border":aU((n=e.icon_background)==null?void 0:n.border,t),"--text-spacing":`${e.text_spacing}px`,"--border-start-start-radius":"0px","--border-start-end-radius":"0px","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--connector-color":zl({colorMap:(a=e.connector)==null?void 0:a.color,colorMode:t}),"--connector-width":`${((i=e.connector)==null?void 0:i.width)||0}px`,"--connector-top":"0px","--connector-height":`${e.item_spacing}px`};if(Object.assign(f,((c=(o=e.icon_background)==null?void 0:o.shape)==null?void 0:c.type)==="rectangle"?z_((d=(u=e.icon_background)==null?void 0:u.shape)==null?void 0:d.corners):{"--border-start-start-radius":"50%","--border-start-end-radius":"50%","--border-end-start-radius":"50%","--border-end-end-radius":"50%"}),e.connector){const m=e.connector.margin.top!==0,_=e.connector.margin.bottom!==0,w=e.icon.padding+e.icon.width_and_height/2;!m&&!_&&(f["--connector-height"]=`${e.item_spacing+w*2}px`,f["--connector-top"]="50%"),m&&_&&(f["--connector-height"]=`${e.item_spacing-e.connector.margin.top-e.connector.margin.bottom}px`,f["--connector-top"]=`calc(100% + ${e.connector.margin.top}px)`),!m&&_&&(f["--connector-height"]=`${e.item_spacing-e.connector.margin.bottom+w}px`,f["--connector-top"]="50%"),m&&!_&&(f["--connector-height"]=`${e.item_spacing+w}px`,f["--connector-top"]=`calc(100% + ${e.connector.margin.top}px)`)}const h=Ss(f,"timeline-item");return Ui(h)}function FO(t,e,r="title"){var n,a,i,o;const c={"--text-color":"inherit","--text-font-size":"initial","--text-font-weight":"initial","--text-horizontal-alignment":"initial","--text-margin-block-start":"0px","--text-margin-inline-end":"0px","--text-margin-block-end":"0px","--text-margin-inline-start":"0px","--text-padding-block-start":"0px","--text-padding-inline-end":"0px","--text-padding-block-end":"0px","--text-padding-inline-start":"0px"},u={color:((n=e[r])==null?void 0:n.color)||lU,font_size:((a=e[r])==null?void 0:a.font_size)||"body_m",font_weight:((i=e[r])==null?void 0:i.font_weight)||"regular",horizontal_alignment:((o=e[r])==null?void 0:o.horizontal_alignment)||"leading"},{tagToRender:d,textStyles:f}=Wx(t,{...e,...u,size:{width:{type:"fit"},height:{type:"fit"}},type:"text",margin:{top:0,bottom:0,leading:0,trailing:0},padding:{top:0,bottom:0,leading:0,trailing:0},text_lid:""});return Object.assign(c,f),{textStyles:Ui(Ss(c,"timeline-item")),tagToRender:d}}var IX=lt('<div class="rc-pw-timeline-item svelte-gjmo4g"><div class="rc-pw-timeline-item-icon-container svelte-gjmo4g"><div class="rc-pw-timeline-item-icon svelte-gjmo4g"></div></div> <div class="rc-pw-timeline-item-content svelte-gjmo4g"><!> <!></div></div>');const MX={hash:"svelte-gjmo4g",code:`.rc-pw-timeline-item.svelte-gjmo4g {display:flex;align-items:center;gap:var(--timeline-item-spacing, 0px);}.rc-pw-timeline-item-icon-container.svelte-gjmo4g {position:relative;border-end-start-radius:var(--timeline-item-border-end-start-radius, 0px);border-end-end-radius:var(--timeline-item-border-end-end-radius, 0px);border-start-start-radius:var(
      --timeline-item-border-start-start-radius,
      0px
    );border-start-end-radius:var(--timeline-item-border-start-end-radius, 0px);width:var(--timeline-item-icon-size, 16px);height:var(--timeline-item-icon-size, 16px);flex-shrink:0;background-color:var(--timeline-item-icon-background-color, #ffffff);border:var(--timeline-item-icon-border, initial);display:flex;align-items:center;justify-content:center;padding:var(--timeline-item-icon-padding, 0px);box-sizing:content-box;}.rc-pw-timeline-item-icon-container.svelte-gjmo4g::before {position:absolute;content:"";z-index:-1;top:var(--timeline-item-connector-top, 0px);height:var(--timeline-item-connector-height, 0px);width:var(--timeline-item-connector-width, 0px);background:var(--timeline-item-connector-color, transparent);}.rc-pw-timeline-item-icon.svelte-gjmo4g {width:var(--timeline-item-icon-size, 10px);height:var(--timeline-item-icon-size, 10px);color:var(--timeline-item-icon-color, #ffffff);display:flex;align-items:center;justify-content:center;}.rc-pw-timeline-item-content.svelte-gjmo4g {display:flex;flex-direction:column;justify-content:flex-start;align-items:flex-start;gap:var(--timeline-item-text-spacing, 0px);height:fit-content;}.rc-pw-timeline-item-content-title.svelte-gjmo4g,
  .rc-pw-timeline-item-content-description.svelte-gjmo4g {margin-block-start:var(--timeline-item-text-margin-block-start, 0px);margin-inline-end:var(--timeline-item-text-margin-inline-end, 0px);margin-block-end:var(--timeline-item-text-margin-block-end, 0px);margin-inline-start:var(--timeline-item-text-margin-inline-start, 0px);padding-block-start:var(--timeline-item-text-padding-block-start, 0);padding-inline-end:var(--timeline-item-text-padding-inline-end, 0);padding-block-end:var(--timeline-item-text-padding-block-end, 0);padding-inline-start:var(--timeline-item-text-padding-inline-start, 0);font-family:var(--timeline-item-text-font-family, sans-serif);}`};function jX(t,e){Wt(e,!0),zt(t,MX);const r=Aa(),n=()=>ha(d,"$variables",r),a=fu(e,["$$slots","$$events","$$legacy"]),i=Kb(),o=ze(i),c=ze(()=>NX($(o),a)),{getLocalizedString:u}=Kx(),d=Yb(),f=ze(()=>$_(u(e.title.text_lid),n())),h=ze(()=>{var I;return $_(u((I=e.description)==null?void 0:I.text_lid),n())}),m=ze(()=>FO($(o),a,"title")),_=ze(()=>$(m).tagToRender),w=ze(()=>$(m).textStyles),b=ze(()=>FO($(o),a,"description")),E=ze(()=>$(b).tagToRender),T=ze(()=>$(b).textStyles);var R=IX(),P=kt(Le(R),2),A=Le(P);L_(A,()=>$(_),!1,(I,x)=>{let D;mt(()=>D=B_(I,D,{class:"rc-pw-timeline-item-content-title",style:$(w)},"svelte-gjmo4g",I.namespaceURI===Rm,I.nodeName.includes("-")));var N=Ur();mt(()=>hr(N,$(f))),ke(x,N)});var C=kt(A,2);{var O=I=>{var x=wr(),D=Xt(x);L_(D,()=>$(E),!1,(N,L)=>{let j;mt(()=>j=B_(N,j,{class:"rc-pw-timeline-item-content-description",style:$(T)},"svelte-gjmo4g",N.namespaceURI===Rm,N.nodeName.includes("-")));var q=Ur();mt(()=>hr(q,$(h))),ke(L,q)}),ke(I,x)};xt(C,I=>{$(h)&&I(O)})}mt(()=>Ut(R,"style",$(c))),ke(t,R),Kt()}var LX=lt('<div class="rc-pw-timeline-container svelte-12g27vu"></div>');const BX={hash:"svelte-12g27vu",code:".rc-pw-timeline-container.svelte-12g27vu {display:flex;flex:var(--timeline-flex, 0 1 auto);flex-direction:column;gap:var(--timeline-item-spacing, 0);width:var(--timeline-width, initial);height:var(--timeline-height, initial);position:var(--timeline-position, relative);inset:var(--timeline-inset, 0);transform:var(--timeline-transform, initial);}"};function UX(t,e){Wt(e,!0),zt(t,BX);const r=fu(e,["$$slots","$$events","$$legacy","items"]),n=ze(()=>OX({items:e.items,...r}));var a=wr(),i=Xt(a);{var o=c=>{var u=LX();sp(u,21,()=>e.items,ip,(d,f,h)=>{var m=ze(()=>`${e.id}-${h}`),_=ze(()=>`${e.name}-${h}`);jX(d,Fc(()=>$(f),{get id(){return $(m)},get name(){return $(_)},type:"timeline",get text_spacing(){return e.text_spacing},get item_spacing(){return e.item_spacing}}))}),mt(()=>Ut(u,"style",$(n))),ke(c,u)};xt(i,c=>{e.items.length&&c(o)})}ke(t,a),Kt()}var FX=lt("<span><!></span>");const qX={hash:"svelte-byrjto",code:`
  /* svelte-ignore css-unused-selector */.rcb-typography-heading-2xl.svelte-byrjto {font:var(--rc-text-heading2xl-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-xl.svelte-byrjto {font:var(--rc-text-headingXl-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-lg.svelte-byrjto {font:var(--rc-text-headingLg-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-md.svelte-byrjto {font:var(--rc-text-headingMd-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-body-base.svelte-byrjto {font:var(--rc-text-bodyBase-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-body-small.svelte-byrjto {font:var(--rc-text-bodySmall-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-label-button.svelte-byrjto {font:var(--rc-text-labelButton-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-label-default.svelte-byrjto {font:var(--rc-text-labelDefault-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-caption-default.svelte-byrjto {font:var(--rc-text-captionDefault-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-caption-link.svelte-byrjto {font:var(--rc-text-captionLink-mobile);}

  @container layout-query-container (width >= 768px) {
    /* svelte-ignore css-unused-selector */.rcb-typography-heading-2xl.svelte-byrjto {font:var(--rc-text-heading2xl-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-xl.svelte-byrjto {font:var(--rc-text-headingXl-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-lg.svelte-byrjto {font:var(--rc-text-headingLg-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-md.svelte-byrjto {font:var(--rc-text-headingMd-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-body-base.svelte-byrjto {font:var(--rc-text-bodyBase-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-body-small.svelte-byrjto {font:var(--rc-text-bodySmall-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-label-button.svelte-byrjto {font:var(--rc-text-labelButton-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-label-default.svelte-byrjto {font:var(--rc-text-labelDefault-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-caption-default.svelte-byrjto {font:var(--rc-text-captionDefault-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-caption-link.svelte-byrjto {font:var(--rc-text-captionLink-desktop);}
  }`};function zX(t,e){Wt(e,!0),zt(t,qX);const r=It(e,"size",3,"body-base");var n=FX(),a=Le(n);Dn(a,()=>e.children??Ar),mt(()=>Jl(n,`rcb-typography rcb-typography-${r()??""} svelte-byrjto`)),ke(t,n),Kt()}const $X={outerPadding:{mobile:"clamp(1.3125rem, 5.6vw, 1.5rem)",desktop:"clamp(1.5rem, 9.44vw, 5rem)"},outerPaddingSmall:{mobile:"clamp(0.75rem, 4.2vw, 1rem)",desktop:"clamp(1.5rem, 9.44vw, 5rem)"},gapSmall:{mobile:"0.25rem",desktop:"0.375rem"},gapMedium:{mobile:"0.5rem",desktop:"0.75rem"},gapLarge:{mobile:"0.75rem",desktop:"0.75rem"},gapXLarge:{mobile:"1rem",desktop:"1.5rem"},gapXXLarge:{mobile:"1.25rem",desktop:"2.25rem"},gapXXXLarge:{mobile:"2.25rem",desktop:"4.5rem"},inputHeight:{mobile:"3rem",desktop:"3rem"},gapStripeElement:{mobile:"0.70rem",desktop:"1rem"}},qO="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",_o={regular:"400",medium:"500",semibold:"600"},is={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},bo={120:"120%",130:"130%",140:"140%"},ko={tight:"0.20%",regular:"0"},Gn={heading2xl:{fontSize:is[28],lineHeight:bo[120],fontWeight:_o.semibold,letterSpacing:ko.tight},headingXl:{fontSize:is[24],lineHeight:bo[130],fontWeight:_o.semibold,letterSpacing:ko.regular},headingLg:{fontSize:"20px",lineHeight:bo[130],fontWeight:_o.semibold,letterSpacing:ko.regular},headingMd:{fontSize:"16px",lineHeight:bo[140],fontWeight:_o.medium,letterSpacing:ko.regular},bodyBase:{fontSize:is[16],lineHeight:bo[140],fontWeight:_o.regular,letterSpacing:ko.regular},bodySmall:{fontSize:is[14],lineHeight:bo[140],fontWeight:_o.regular,letterSpacing:ko.regular},labelButton:{fontSize:is[16],lineHeight:bo[140],fontWeight:_o.regular,letterSpacing:ko.tight},labelDefault:{fontSize:is[14],lineHeight:bo[140],fontWeight:_o.regular,letterSpacing:ko.tight},captionDefault:{fontSize:is[12],lineHeight:bo[140],fontWeight:_o.regular,letterSpacing:ko.regular},captionLink:{fontSize:is[12],lineHeight:bo[140],fontWeight:_o.regular,letterSpacing:ko.regular}},wo={heading2xl:{...Gn.heading2xl,fontSize:is[36]},headingXl:{...Gn.headingXl,fontSize:is[32]},headingLg:{...Gn.headingLg,fontSize:is[24]},headingMd:{...Gn.headingMd,fontSize:is[18]},bodyBase:{...Gn.bodyBase},bodySmall:{...Gn.bodySmall},labelButton:{...Gn.labelButton},labelDefault:{...Gn.labelDefault},captionDefault:{...Gn.captionDefault},captionLink:{...Gn.captionLink}},VX={heading2xl:{mobile:Gn.heading2xl,desktop:wo.heading2xl},headingXl:{desktop:wo.headingXl,mobile:Gn.headingXl},headingLg:{desktop:wo.headingLg,mobile:Gn.headingLg},headingMd:{desktop:wo.headingMd,mobile:Gn.headingMd},bodyBase:{desktop:wo.bodyBase,mobile:Gn.bodyBase},bodySmall:{desktop:wo.bodySmall,mobile:Gn.bodySmall},labelButton:{desktop:wo.labelButton,mobile:Gn.labelButton},labelDefault:{desktop:wo.labelDefault,mobile:Gn.labelDefault},captionDefault:{desktop:wo.captionDefault,mobile:Gn.captionDefault},captionLink:{desktop:wo.captionLink,mobile:Gn.captionLink}},HX={error:"#B0171F",warning:"#f4e971",focus:"#1148B8",accent:"#767676",primary:"#576CDB","primary-hover":"rgba(87, 108, 219, .8)","primary-pressed":"rgba(87, 108, 219, .9)","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.7)","grey-ui-dark":"rgba(0,0,0,0.3)","grey-ui-light":"rgba(0,0,0,0.1)","input-background":"white",background:"white"},GX={error:"#B0171F",warning:"#f4e971",focus:"#1148B8",accent:"#767676",primary:"#576CDB","primary-hover":"rgba(87, 108, 219, .8)","primary-pressed":"rgba(87, 108, 219, .9)","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.7)","grey-ui-dark":"rgba(0,0,0,0.3)","grey-ui-light":"rgba(0,0,0,0.1)","input-background":"white",background:"#EFF3FA"},gU={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},WX={...gU,"input-background":"color_form_bg",background:"color_form_bg"},KX={...gU,"input-background":"color_product_info_bg",background:"color_product_info_bg"},yU={"input-border-radius":"4px","input-button-border-radius":"8px"},YX={"input-border-radius":"0px","input-button-border-radius":"0px"},XX={"input-border-radius":"12px","input-button-border-radius":"9999px"},zO=yU,Mm=t=>t.length==7?{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16)}:t.length==4?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null,Yx=({r:t,g:e,b:r,luminanceThreshold:n})=>{const a=i=>(i=i/255,i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4));return .2126*a(t)+.7152*a(e)+.0722*a(r)>n},Xx=.37,JX=(t,e=Xx)=>{const r=Yx({...t,luminanceThreshold:e})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${r})`,"grey-text-light":`rgba(${r},0.70)`,"grey-ui-dark":`rgba(${r},0.3)`,"grey-ui-light":`rgba(${r},0.1)`}};function QX(t,e,r){const n=Mm(t)||{r:0,g:0,b:0},a=Mm(e)||{r:255,g:255,b:255},i=Math.round(a.r*r+n.r*(1-r)),o=Math.round(a.g*r+n.g*(1-r)),c=Math.round(a.b*r+n.b*(1-r));return`#${Vw(i)}${Vw(o)}${Vw(c)}`}function $O(t,e){const r={r:255,g:255,b:255},n=Math.max(0,Math.min(1,e));let a=t,i=Mm(t)||r;(isNaN(i.r)||isNaN(i.g)||isNaN(i.b))&&(i=r,a="#FFFFFF");const o=Yx({...i,luminanceThreshold:Xx})?"#000000":"#FFFFFF";return QX(a,o,n)}function Vw(t){return t.toString(16).padStart(2,"0").toUpperCase()}const ZX=(t,e,r,n=Xx)=>{const a={"grey-text-dark":r["grey-text-dark"],"grey-text-light":r["grey-text-light"],"grey-ui-dark":r["grey-ui-dark"],"grey-ui-light":r["grey-ui-light"],"primary-text":r["primary-text"]};if(t!=null&&t.startsWith("#")){const i=Mm(t);i!==null&&Object.assign(a,JX(i))}if(e!=null&&e.startsWith("#")){const i=Mm(e);i!==null&&(a["primary-text"]=Yx({...i,luminanceThreshold:n})?"black":"white")}return a},eJ=t=>({"primary-hover":$O(t,.1),"primary-pressed":$O(t,.15)}),tJ=(t,e)=>t||e,rJ=(t,e,r)=>{const n=Object.entries(t).map(([a,i])=>[a,tJ(r?r[i]:null,e[a])]);return Object.fromEntries(n)},vU=(t,e,r)=>{const n=rJ(t,e,r);return r?{...e,...n,...ZX(n.background,n.primary,e),...eJ(n.primary)}:{...e}},nJ=t=>vU(KX,GX,t),_U=t=>vU(WX,HX,t),Jx=t=>{if(!t)return zO;switch(t.shapes){case"rounded":return yU;case"rectangle":return YX;case"pill":return XX;default:return zO}},H_=(t="",e)=>e.map(([r,n])=>`--rc-${t}-${r}: ${n}`).join("; "),aJ=t=>{const e=H_("color",Object.entries(nJ(t))),r=H_("shape",Object.entries(Jx(t)));return[e,r].join("; ")},iJ=t=>{const e=H_("color",Object.entries(_U(t))),r=H_("shape",Object.entries(Jx(t)));return[e,r].join("; ")},sJ=(t="",e)=>Object.entries(e).flatMap(([r,{desktop:n,mobile:a}])=>[`--rc-${t}-${r}-desktop: normal normal ${n.fontWeight} ${n.fontSize}/${n.lineHeight} ${qO}`,`--rc-${t}-${r}-mobile: normal normal ${a.fontWeight} ${a.fontSize}/${a.lineHeight} ${qO}`,`--rc-${t}-${r}-desktop-font-size: ${n.fontSize}`,`--rc-${t}-${r}-mobile-font-size: ${a.fontSize}`]).join("; "),oJ=(t="",e)=>Object.entries(e).map(([r,{mobile:n,desktop:a}])=>`--rc-${t}-${r}-mobile: ${n};  --rc-${t}-${r}-desktop: ${a};`).join(" ");let cJ=class{constructor(t){vt(this,"brandingAppearance"),t?this.brandingAppearance=t:this.brandingAppearance=void 0}get shape(){return Jx(this.brandingAppearance)}get formColors(){return _U(this.brandingAppearance)}get formStyleVars(){return iJ(this.brandingAppearance)}get productInfoStyleVars(){return aJ(this.brandingAppearance)}get spacing(){return $X}get textStyles(){return VX}get textStyleVars(){return sJ("text",this.textStyles)}get spacingStyleVars(){return oJ("spacing",this.spacing)}};var lJ=lt('<div class="rcb-processing svelte-2j2b59"></div>');const uJ={hash:"svelte-2j2b59",code:`.rcb-processing.svelte-2j2b59 {width:var(--width, 12px);aspect-ratio:1;border-radius:50%;
    animation: svelte-2j2b59-l5 1.5s infinite linear;}

  @keyframes svelte-2j2b59-l5 {
    0% {
      box-shadow:
        var(--shadow-offset) 0 #fff2,
        calc(-1 * var(--shadow-offset)) 0 #fff2;
      background: #fff2;
    }
    25% {
      box-shadow:
        var(--shadow-offset) 0 #fff2,
        calc(-1 * var(--shadow-offset)) 0 #ffff;
      background: #fff2;
    }
    50% {
      box-shadow:
        var(--shadow-offset) 0 #fff2,
        calc(-1 * var(--shadow-offset)) 0 #fff2;
      background: #ffff;
    }
    75% {
      box-shadow:
        var(--shadow-offset) 0 #ffff,
        calc(-1 * var(--shadow-offset)) 0 #fff2;
      background: #fff2;
    }
    100% {
      box-shadow:
        var(--shadow-offset) 0 #fff2,
        calc(-1 * var(--shadow-offset)) 0 #fff2;
      background: #fff2;
    }
  }`};function dJ(t,e){zt(t,uJ);let r=It(e,"size",8,"medium");const n={small:{width:"8px",offset:"10px"},medium:{width:"12px",offset:"20px"},large:{width:"16px",offset:"30px"}};var a=lJ();mt(()=>Ut(a,"style",`--shadow-offset: ${n[r()].offset??""}; --width: ${n[r()].width??""};`)),ke(t,a)}var fJ=lt("<button><!></button>");const pJ={hash:"svelte-td7xvm",code:`button.svelte-td7xvm {border:none;border-radius:var(--rc-shape-input-button-border-radius);cursor:pointer;height:var(--rc-spacing-inputHeight-mobile);color:var(--rc-color-grey-text-dark);background-color:var(--rc-color-grey-ui-dark);display:flex;align-items:center;justify-content:center;-webkit-tap-highlight-color:rgba(0, 0, 0, 0);-webkit-tap-highlight-color:transparent;transition:background-color 0.15s ease-in-out;user-select:none;}

  @container layout-query-container (width >= 768px) {button.svelte-td7xvm {height:var(--rc-spacing-inputHeight-desktop);}
  }

  /* focus-visible is triggered only when focused with keyboard/reader */button.svelte-td7xvm:focus-visible {outline:2px solid var(--rc-color-focus);}button.intent-primary.svelte-td7xvm {background-color:var(--rc-color-primary);color:var(--rc-color-primary-text);}button.svelte-td7xvm:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);outline:none;}button.intent-primary.svelte-td7xvm:not(:disabled):hover {background-color:var(--rc-color-primary-hover);}button.intent-primary.svelte-td7xvm:not(:disabled):active,
  button.svelte-td7xvm:active {background-color:var(--rc-color-primary-pressed);outline:none;}button.intent-primary.svelte-td7xvm:disabled {color:var(--rc-color-grey-text-light);background-color:var(--rc-color-grey-ui-dark);}`};function bU(t,e){Wt(e,!0),zt(t,pJ);const r=It(e,"intent",3,"primary"),n=It(e,"disabled",3,!1),a=It(e,"loading",3,!1),i=ze(()=>new cJ(e.brandingAppearance)),o=ze(()=>$(i).textStyleVars),c=ze(()=>$(i).spacingStyleVars),u=ze(()=>$(i).productInfoStyleVars),d=ze(()=>$(i).formStyleVars),f=ze(()=>[e.styleOverrides,$(o),$(c),$(u),$(d)].join("; "));var h=fJ();h.__click=function(...b){var E;(E=e.onclick)==null||E.apply(this,b)};var m=Le(h);{var _=b=>{dJ(b,{size:"small"})},w=b=>{zX(b,{size:"body-base",children:(E,T)=>{var R=wr(),P=Xt(R);Dn(P,()=>e.children??Ar),ke(E,R)},$$slots:{default:!0}})};xt(m,b=>{a()?b(_):b(w,!1)})}mt(()=>{Jl(h,`${`intent-${r()}`??""} svelte-td7xvm`),h.disabled=n(),Ut(h,"data-testid",e.testId),Ut(h,"type",e.type),Ut(h,"style",$(f))}),ke(t,h),Kt()}Hb(["click"]);var hJ=lt('<footer class="rcb-modal-footer svelte-1f9z0o8"><!></footer>');const mJ={hash:"svelte-1f9z0o8",code:"footer.svelte-1f9z0o8 {display:flex;flex-direction:column;}"};function gJ(t,e){Wt(e,!1),zt(t,mJ);let r=It(e,"children",8);ws();var n=hJ(),a=Le(n);Dn(a,()=>r()??Ar),ke(t,n),Kt()}const yJ={hash:"svelte-1bzqb13",code:".rcb-modal-section.svelte-1bzqb13 {padding:8px 0px;display:flex;}section.rcb-modal-section.svelte-1bzqb13 {flex-grow:1;}.rcb-modal-section.svelte-1bzqb13:last-of-type {padding:0;}"};function vJ(t,e){Wt(e,!1),zt(t,yJ);let r=It(e,"as",8,"section"),n=It(e,"children",8);ws();var a=wr(),i=Xt(a);L_(i,r,!1,(o,c)=>{B_(o,null,{class:"rcb-modal-section"},"svelte-1bzqb13",o.namespaceURI===Rm,o.nodeName.includes("-"));var u=wr(),d=Xt(u);Dn(d,()=>n()??Ar),ke(c,u)}),ke(t,a),Kt()}var _J=lt("<div><!></div>");const bJ={hash:"svelte-b5dygi",code:`.rcb-column.svelte-b5dygi {display:flex;flex-direction:column;justify-content:flex-start;flex-grow:1;min-width:100%;}.rcb-column.align-center.svelte-b5dygi {justify-content:center;}.rcb-column.align-end.svelte-b5dygi {justify-content:flex-end;}.rcb-column.gap-small.svelte-b5dygi {gap:var(--rc-spacing-gapSmall-mobile);}.rcb-column.gap-medium.svelte-b5dygi {gap:var(--rc-spacing-gapXLarge-mobile);}.rcb-column.gap-large.svelte-b5dygi {gap:var(--rc-spacing-gapXXLarge-mobile);}

  @container layout-query-container (width >= 768px) {.rcb-column.gap-small.svelte-b5dygi {gap:var(--rc-spacing-gapSmall-desktop);}.rcb-column.gap-medium.svelte-b5dygi {gap:var(--rc-spacing-gapLarge-desktop);}.rcb-column.gap-large.svelte-b5dygi {gap:var(--rc-spacing-gapXXLarge-desktop);}
  }`};function kU(t,e){Wt(e,!1),zt(t,bJ);let r=It(e,"gap",8,"small"),n=It(e,"align",8,"start"),a=It(e,"children",8);ws();var i=_J(),o=Le(i);Dn(o,()=>a()??Ar),mt(()=>Jl(i,`rcb-column gap-${r()??""} align-${n()??""} svelte-b5dygi`)),ke(t,i),Kt()}var kJ=lt('<div class="rcb-row svelte-1seeuxq"><!></div>');const wJ={hash:"svelte-1seeuxq",code:".rcb-row.svelte-1seeuxq {display:flex;flex-direction:row;justify-content:flex-start;}"};function SJ(t,e){Wt(e,!1),zt(t,wJ);let r=It(e,"children",8);ws();var n=kJ(),a=Le(n);Dn(a,()=>r()??Ar),ke(t,n),Kt()}var EJ=lt("<span><!></span>");const TJ={hash:"svelte-orw2sj",code:`.rcb-typography.svelte-orw2sj {display:inline-block;line-height:normal;}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-2xl.svelte-orw2sj {font:var(--rc-text-heading2xl-mobile);}.rcb-typography-heading-2xl.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-heading2xl-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-xl.svelte-orw2sj {font:var(--rc-text-headingXl-mobile);}.rcb-typography-heading-xl.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingXl-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-lg.svelte-orw2sj {font:var(--rc-text-headingLg-mobile);}.rcb-typography-heading-lg.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingLg-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-heading-md.svelte-orw2sj {font:var(--rc-text-headingMd-mobile);}.rcb-typography-heading-md.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingMd-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-body-base.svelte-orw2sj {font:var(--rc-text-bodyBase-mobile);}.rcb-typography-body-base.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-bodyBase-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-body-small.svelte-orw2sj {font:var(--rc-text-bodySmall-mobile);}.rcb-typography-body-small.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-bodySmall-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-label-button.svelte-orw2sj {font:var(--rc-text-labelButton-mobile);}.rcb-typography-label-button.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-labelButton-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-label-default.svelte-orw2sj {font:var(--rc-text-labelDefault-mobile);}.rcb-typography-label-default.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-labelDefault-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-caption-default.svelte-orw2sj {font:var(--rc-text-captionDefault-mobile);}.rcb-typography-caption-default.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-captionDefault-branded-mobile);}

  /* svelte-ignore css-unused-selector */.rcb-typography-caption-link.svelte-orw2sj {font:var(--rc-text-captionLink-mobile);}.rcb-typography-caption-link.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-captionLink-branded-mobile);}

  @container layout-query-container (width >= 768px) {span.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-brandedText-font-style-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-2xl.svelte-orw2sj {font:var(--rc-text-heading2xl-desktop);}.rcb-typography-heading-2xl.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-heading2xl-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-xl.svelte-orw2sj {font:var(--rc-text-headingXl-desktop);}.rcb-typography-heading-xl.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingXl-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-lg.svelte-orw2sj {font:var(--rc-text-headingLg-desktop);}.rcb-typography-heading-lg.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingLg-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-heading-md.svelte-orw2sj {font:var(--rc-text-headingMd-desktop);}.rcb-typography-heading-md.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-headingMd-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-body-base.svelte-orw2sj {font:var(--rc-text-bodyBase-desktop);}.rcb-typography-body-base.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-bodyBase-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-body-small.svelte-orw2sj {font:var(--rc-text-bodySmall-desktop);}.rcb-typography-body-small.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-bodySmall-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-label-button.svelte-orw2sj {font:var(--rc-text-labelButton-desktop);}.rcb-typography-label-button.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-labelButton-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-label-default.svelte-orw2sj {font:var(--rc-text-labelDefault-desktop);}.rcb-typography-label-default.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-labelDefault-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-caption-default.svelte-orw2sj {font:var(--rc-text-captionDefault-desktop);}.rcb-typography-caption-default.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-captionDefault-branded-desktop);}

    /* svelte-ignore css-unused-selector */.rcb-typography-caption-link.svelte-orw2sj {font:var(--rc-text-captionLink-desktop);}.rcb-typography-caption-link.rcb-typography-branded.svelte-orw2sj {font:var(--rc-text-captionLink-branded-desktop);}
  }`};function Pr(t,e){Wt(e,!0),zt(t,TJ);const r=It(e,"size",3,"body-base"),n=It(e,"branded",3,!1);var a=EJ(),i=Le(a);Dn(i,()=>e.children??Ar),mt(()=>Jl(a,`rcb-typography rcb-typography-${r()??""} ${(n()?"rcb-typography-branded":"")??""} svelte-orw2sj`)),ke(t,a),Kt()}var CJ=lt("<div><!></div>"),xJ=lt('<span style="display: block;"><!></span>'),PJ=lt("<!> <!>",1),AJ=lt("<!> <!>",1),RJ=lt('<div class="rcb-modal-message svelte-w46z5s" data-type="error"><!></div>');const DJ={hash:"svelte-w46z5s",code:`.rcb-modal-message-icon.svelte-w46z5s {flex-shrink:0;align-self:center;margin-right:16px;}.rcb-modal-message.svelte-w46z5s {width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:left;margin-top:4px;}.rcb-modal-message[data-has-title="false"].svelte-w46z5s {margin-top:var(--rc-spacing-gapXXLarge-mobile);}.rcb-modal-message-icon.small.svelte-w46z5s {height:var(--rc-text-headingLg-mobile-font-size);width:var(--rc-text-headingLg-mobile-font-size);}.rcb-modal-message-icon.large.svelte-w46z5s {height:calc(2 * var(--rc-text-headingMd-mobile-font-size));width:calc(2 * var(--rc-text-headingMd-mobile-font-size));}

  @container layout-query-container (width >= 768px) {.rcb-modal-message-icon.small.svelte-w46z5s {height:var(--rc-text-headingLg-desktop-font-size);width:var(--rc-text-headingLg-desktop-font-size);}.rcb-modal-message-icon.large.svelte-w46z5s {height:calc(2 * var(--rc-text-headingMd-desktop-font-size));width:calc(2 * var(--rc-text-headingMd-desktop-font-size));}.rcb-modal-message[data-has-title="false"].svelte-w46z5s {margin-top:var(--rc-spacing-gapXXLarge-desktop);}
  }`};function OJ(t,e){Wt(e,!0),zt(t,DJ);const r=It(e,"title",3,null),n=It(e,"icon",3,null),a=32;let i=sr(null),o=sr(!1),c;_s(()=>($(i)&&(c=new ResizeObserver(()=>{var f;pt(o,(((f=$(i))==null?void 0:f.offsetHeight)??0)>a)}),c.observe($(i))),()=>{c?.disconnect()}));var u=RJ(),d=Le(u);kU(d,{gap:"medium",align:"start",children:(f,h)=>{var m=AJ(),_=Xt(m);SJ(_,{children:(E,T)=>{var R=PJ(),P=Xt(R);{var A=I=>{var x=CJ(),D=Le(x);Dn(D,n),mt(()=>Jl(x,`rcb-modal-message-icon ${$(o)?"large":"small"} svelte-w46z5s`)),ke(I,x)};xt(P,I=>{n()&&I(A)})}var C=kt(P,2);{var O=I=>{var x=xJ(),D=Le(x);Pr(D,{size:"heading-md",children:(N,L)=>{var j=Ur();mt(()=>hr(j,r())),ke(N,j)},$$slots:{default:!0}}),JB(x,N=>pt(i,N),()=>$(i)),ke(I,x)};xt(C,I=>{r()&&I(O)})}ke(E,R)},$$slots:{default:!0}});var w=kt(_,2);{var b=E=>{Pr(E,{size:"body-small",children:(T,R)=>{var P=wr(),A=Xt(P);Dn(A,()=>e.message??Ar),ke(T,P)},$$slots:{default:!0}})};xt(w,E=>{e.message&&E(b)})}ke(f,m)},$$slots:{default:!0}}),mt(()=>Ut(u,"data-has-title",!!r())),ke(t,u),Kt()}var NJ=lt('<div class="rcb-modal-message-icon svelte-c8cuu5"><!></div>'),IJ=lt("<!> <!>",1),MJ=lt('<div class="rcb-modal-message svelte-c8cuu5" data-type="success"><!></div>');const jJ={hash:"svelte-c8cuu5",code:`.rcb-modal-message-icon.svelte-c8cuu5 {height:54px;width:54px;margin:0 auto;}.rcb-modal-message[data-has-title="false"].svelte-c8cuu5 {margin-top:var(--rc-spacing-gapXXLarge-mobile);}.rcb-modal-message.svelte-c8cuu5 {width:100%;min-height:160px;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;}

  @container layout-query-container (width >= 768px) {.rcb-modal-message[data-has-title="false"].svelte-c8cuu5 {margin-top:var(--rc-spacing-gapXXLarge-desktop);}
  }`};function LJ(t,e){Wt(e,!0),zt(t,jJ);const r=It(e,"title",3,null),n=It(e,"icon",3,null);var a=MJ(),i=Le(a);kU(i,{gap:"large",align:"center",children:(o,c)=>{var u=IJ(),d=Xt(u);{var f=_=>{var w=NJ(),b=Le(w);Dn(b,n),ke(_,w)};xt(d,_=>{n()&&_(f)})}var h=kt(d,2);{var m=_=>{Pr(_,{size:"heading-md",children:(w,b)=>{var E=Ur();mt(()=>hr(E,r())),ke(w,E)},$$slots:{default:!0}})};xt(h,_=>{r()&&_(m)})}ke(o,u)},$$slots:{default:!0}}),mt(()=>Ut(a,"data-has-title",!!r())),ke(t,a),Kt()}const Qx="rcb-ui-events-tracker",Zx="branding";var BJ=lt('<div class="message-layout svelte-qavr33"><div class="message-layout-content svelte-qavr33"><!></div> <div class="message-layout-footer"><!></div></div>');const UJ={hash:"svelte-qavr33",code:`.message-layout.svelte-qavr33 {display:flex;flex-direction:column;}.message-layout-content.svelte-qavr33 {flex-grow:1;display:flex;flex-direction:column;justify-content:center;}

  @container layout-query-container (width < 768px) {.message-layout.svelte-qavr33 {flex-grow:1;gap:var(--rc-spacing-gapXXLarge-mobile);}
  }

  @container layout-query-container (width >= 768px) {.message-layout.svelte-qavr33 {min-height:354px;gap:var(--rc-spacing-gapXXLarge-desktop);}.message-layout-content.svelte-qavr33 {justify-content:flex-start;flex-grow:1;}
  }`};function eP(t,e){Wt(e,!0),zt(t,UJ);let r=It(e,"title",3,null),n=It(e,"closeButtonTitle",3,"Go back to app"),a=It(e,"icon",3,null),i=It(e,"message",3,null);const o=Jn(Zx);function c(){e.onDismiss()}var u=BJ(),d=Le(u),f=Le(d);vJ(f,{children:(_,w)=>{var b=wr(),E=Xt(b);{var T=P=>{LJ(P,{get title(){return r()},get icon(){return a()}})},R=P=>{OJ(P,{get title(){return r()},get icon(){return a()},get message(){return i()}})};xt(E,P=>{e.type==="success"?P(T):P(R,!1)})}ke(_,b)},$$slots:{default:!0}});var h=kt(d,2),m=Le(h);gJ(m,{children:(_,w)=>{bU(_,{onclick:c,type:"submit",brandingAppearance:o,children:(b,E)=>{var T=Ur();mt(()=>hr(T,n())),ke(b,T)},$$slots:{default:!0}})},$$slots:{default:!0}}),ke(t,u),Kt()}function si(t,e){Wt(e,!0);const r=Aa(),n=()=>ha(i,"$translator",r),a=It(e,"key",3,""),i=Jn(Bi),o=ze(()=>a()?n().translate(a()||"",e.variables):void 0);var c=wr(),u=Xt(c);{var d=h=>{var m=Ur();mt(()=>hr(m,$(o))),ke(h,m)},f=h=>{var m=wr(),_=Xt(m);Dn(_,()=>e.children??Ar),ke(h,m)};xt(u,h=>{$(o)?h(d):h(f,!1)})}ke(t,c),Kt()}var FJ=lt('<p class="footer-caption svelte-1hbk6xu"><!></p>'),qJ=lt('<p class="footer-caption svelte-1hbk6xu"><!></p>'),zJ=lt('<div class="footer-caption-container svelte-1hbk6xu"><!> <!> <p class="footer-caption svelte-1hbk6xu"><!></p></div>');const $J={hash:"svelte-1hbk6xu",code:`.footer-caption-container.svelte-1hbk6xu {display:flex;flex-direction:column;gap:var(--rc-spacing-gapLarge-mobile);}.footer-caption.svelte-1hbk6xu {color:var(--rc-color-grey-text-light);text-align:center;margin:0;}

  @container layout-query-container (width >= 768px) {.footer-caption-container.svelte-1hbk6xu {gap:var(--rc-spacing-gapLarge-desktop);}
  }`};function VJ(t,e){Wt(e,!1),zt(t,$J);const r=Aa(),n=()=>ha(E,"$translator",r),a=Ls(),i=Ls(),o=Ls(),c=Ls(),u=Ls(),d=Ls(),f=Ls(),h=Ls(),m=Ls(),_=Ls();let w=It(e,"brandingInfo",8,null),b=It(e,"purchaseOption",8,null);const E=Jn(Bi);function T(L){return L!=null&&"base"in L}function R(L){return L!=null&&"basePrice"in L}function P(L){return L?L.trial?Ot.PaymentEntryPageTrialSubscriptionTermsInfo:Ot.PaymentEntryPageSubscriptionTermsInfo:Ot.PaymentEntryPageOtpTermsInfo}vo(()=>Gv(b()),()=>{pt(a,T(b())?b():null)}),vo(()=>Gv(b()),()=>{pt(i,R(b())?b():null)}),vo(()=>$(a),()=>{pt(o,P($(a)))}),vo(()=>$(a),()=>{var L,j;pt(c,((L=$(a))==null?void 0:L.introPrice)||((j=$(a))==null?void 0:j.base))}),vo(()=>($(i),$(c)),()=>{var L,j;pt(u,((L=$(i))==null?void 0:L.basePrice)||((j=$(c))==null?void 0:j.price))}),vo(()=>($(u),n()),()=>{pt(d,$(u)?ql($(u).amountMicros,$(u).currency,n().locale||n().fallbackLocale):null)}),vo(()=>($(c),n()),()=>{var L,j,q,U,W;pt(f,(L=$(c))!=null&&L.period?n().translatePeriodFrequency(((q=(j=$(c))==null?void 0:j.period)==null?void 0:q.number)||1,(W=(U=$(c))==null?void 0:U.period)==null?void 0:W.unit,{useMultipleWords:!0}):null)}),vo(()=>($(a),n(),CT),()=>{var L,j;pt(h,(j=(L=$(a))==null?void 0:L.trial)!=null&&j.period?n().translateDate(CT(new Date,$(a).trial.period,!0),{year:"numeric",month:"long",day:"numeric"}):null)}),vo(()=>(Gv(w()),$(u),n(),$(o),$(d),$(f),$(h)),()=>{var L;pt(m,w()&&$(u)?n().translate($(o),{appName:(L=w())==null?void 0:L.app_name,price:$(d),perFrequency:$(f),renewalDate:$(h)}):null)}),vo(()=>($(a),n(),Ot),()=>{pt(_,$(a)?n().translate(Ot.PaymentEntryPageSubscriptionInfo):null)}),XW(),ws();var A=zJ(),C=Le(A);{var O=L=>{var j=FJ(),q=Le(j);Pr(q,{size:"caption-default",children:(U,W)=>{var F=Ur();mt(()=>hr(F,$(m))),ke(U,F)},$$slots:{default:!0}}),ke(L,j)};xt(C,L=>{$(m)&&L(O)})}var I=kt(C,2);{var x=L=>{var j=qJ(),q=Le(j);Pr(q,{size:"caption-default",children:(U,W)=>{var F=Ur();mt(()=>hr(F,$(_))),ke(U,F)},$$slots:{default:!0}}),ke(L,j)};xt(I,L=>{$(_)&&L(x)})}var D=kt(I,2),N=Le(D);Pr(N,{size:"caption-default",children:(L,j)=>{si(L,{get key(){return Ot.PaymentEntryPagePaymentStepTitle}})},$$slots:{default:!0}}),ke(t,A),Kt()}var gi=(t=>(t.SDKInitialized="sdk_initialized",t.CheckoutSessionStart="checkout_session_start",t.CheckoutSessionEnd="checkout_session_end",t.CheckoutFlowError="checkout_flow_error",t.CheckoutPaymentTaxCalculation="checkout_payment_tax_calculation",t.CheckoutPaymentFormImpression="checkout_payment_form_impression",t.CheckoutPaymentFormError="checkout_payment_form_error",t.CheckoutPaymentFormDismiss="checkout_payment_form_dismiss",t.CheckoutPaymentFormSubmit="checkout_payment_form_submit",t.CheckoutPaymentFormGatewayError="checkout_payment_form_gateway_error",t.CheckoutPurchaseSuccessfulImpression="checkout_purchase_successful_impression",t.CheckoutPurchaseSuccessfulDismiss="checkout_purchase_successful_dismiss",t))(gi||{}),tP=(t=>(t.tax_collection_disabled="tax_collection_disabled",t.invalid_tax_location="invalid_tax_location",t.rate_limit_exceeded="rate_limit_exceeded",t.missing_required_permission="missing_required_permission",t.invalid_origin_address="invalid_origin_address",t.taxes_not_active="taxes_not_active",t.unexpected_gateway_error="unexpected_gateway_error",t))(tP||{});function HJ({errorCode:t,errorMessage:e}){return{eventName:gi.CheckoutFlowError,properties:{errorCode:t,errorMessage:e}}}function GJ({errorCode:t,errorMessage:e}){return{eventName:gi.CheckoutPaymentFormError,properties:{errorCode:t,errorMessage:e}}}function WJ({appearance:t,rcPackage:e,purchaseOptionToUse:r,customerEmail:n}){return{eventName:gi.CheckoutSessionStart,properties:{customizationColorButtonsPrimary:t?.color_buttons_primary??null,customizationColorAccent:t?.color_accent??null,customizationColorError:t?.color_error??null,customizationColorProductInfoBg:t?.color_product_info_bg??null,customizationColorFormBg:t?.color_form_bg??null,customizationColorPageBg:t?.color_page_bg??null,customizationFont:t?.font??null,customizationShapes:t?.shapes??null,customizationShowProductDescription:t?.show_product_description??null,productInterval:e.webBillingProduct.normalPeriodDuration,productPrice:e.webBillingProduct.price.amountMicros,productCurrency:e.webBillingProduct.price.currency,selectedProductId:e.webBillingProduct.identifier,selectedPackageId:e.identifier,selectedPurchaseOption:r.id,customerEmailProvidedByDeveloper:!!n}}}function KJ({redemptionInfo:t}){return{eventName:gi.CheckoutSessionEnd,properties:{outcome:"finished",withRedemptionInfo:!!t}}}function YJ(){return{eventName:gi.CheckoutSessionEnd,properties:{outcome:"closed"}}}function XJ({errorCode:t,errorMessage:e}){return{eventName:gi.CheckoutSessionEnd,properties:{outcome:"errored",errorCode:t,errorMessage:e}}}function JJ({taxCalculation:t,taxCustomerDetails:e}){const r=t.failed_reason===tP.tax_collection_disabled?"disabled":t.failed_reason?"failed":t.tax_amount_in_micros===0?"not-taxed":"taxed",n=e===null?"auto":"form";return{eventName:gi.CheckoutPaymentTaxCalculation,properties:{outcome:r,ui_element:n,tax_inclusive:t.tax_inclusive,error_code:t.failed_reason??null}}}function QJ({selectedPaymentMethod:t}){return{eventName:gi.CheckoutPaymentFormSubmit,properties:{selectedPaymentMethod:t??null}}}function ZJ({errorCode:t,errorMessage:e}){return{eventName:gi.CheckoutPaymentFormGatewayError,properties:{errorCode:t,errorMessage:e}}}const eQ=`<svg width="80" height="80" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
  <g transform="scale(0.5)" transform-origin="center">
  <path d="M12 3.5C7.30558 3.5 3.5 7.30558 3.5 12C3.5 16.6944 7.30558 20.5 12 20.5C16.6944 20.5 20.5 16.6944 20.5 12C20.5 11.5858 20.8358 11.25 21.25 11.25C21.6642 11.25 22 11.5858 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C12.4142 2 12.75 2.33579 12.75 2.75C12.75 3.16421 12.4142 3.5 12 3.5Z" fill="currentColor"/>
  </g>
</svg>`;var tQ=lt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-1sxpw7o"><!></div>');const rQ={hash:"svelte-1sxpw7o",code:`
  @-webkit-keyframes svelte-1sxpw7o-rotating /* Safari and Chrome */ {
    from {
      -webkit-transform: rotate(0deg);
      -o-transform: rotate(0deg);
      transform: rotate(0deg);
    }
    to {
      -webkit-transform: rotate(360deg);
      -o-transform: rotate(360deg);
      transform: rotate(360deg);
    }
  }
  @keyframes svelte-1sxpw7o-rotating {
    from {
      -ms-transform: rotate(0deg);
      -moz-transform: rotate(0deg);
      -webkit-transform: rotate(0deg);
      -o-transform: rotate(0deg);
      transform: rotate(0deg);
    }
    to {
      -ms-transform: rotate(360deg);
      -moz-transform: rotate(360deg);
      -webkit-transform: rotate(360deg);
      -o-transform: rotate(360deg);
      transform: rotate(360deg);
    }
  }div.svelte-1sxpw7o {width:80px;height:80px;
    -webkit-animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;
    -moz-animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;
    -ms-animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;
    -o-animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;
    animation: svelte-1sxpw7o-rotating 2s ease-in-out infinite;}`};function nQ(t){zt(t,rQ);var e=tQ(),r=Le(e);du(r,()=>eQ),ke(t,e)}var aQ=lt('<div class="rcb-modal-loader svelte-102edf4"><!></div>');const iQ={hash:"svelte-102edf4",code:`.rcb-modal-loader.svelte-102edf4 {width:100%;flex-grow:1;display:flex;justify-content:center;align-items:center;}

  @container layout-query-container (width >= 768px) {.rcb-modal-loader.svelte-102edf4 {align-items:flex-start;margin-top:calc(var(--rc-spacing-gapXXLarge-desktop) * 6);}
  }`};function wU(t){zt(t,iQ);var e=aQ(),r=Le(e);nQ(r),ke(t,e)}function sQ(t,e){var r,n;Wt(e,!0);const a=Aa(),i=()=>ha(o,"$translator",a),o=Jn(Bi),c=Jn(Zx),u=ze(()=>e.priceBreakdown?i().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency):null),d=(n=(r=e.subscriptionOption)==null?void 0:r.trial)==null?void 0:n.period,f=ze(()=>d?i().translatePeriod(d.number,d.unit):null);bU(t,{get disabled(){return e.disabled},testId:"PayButton",brandingAppearance:c,children:(h,m)=>{var _=wr(),w=Xt(_);{var b=T=>{var R=ze(()=>({trialPeriodLabel:$(f)}));si(T,{get key(){return Ot.PaymentEntryPageButtonStartTrial},get variables(){return $(R)}})},E=T=>{var R=wr(),P=Xt(R);{var A=O=>{var I=ze(()=>({formattedPrice:$(u)}));si(O,{get key(){return Ot.PaymentEntryPageButtonWithPrice},get variables(){return $(I)}})},C=O=>{si(O,{get key(){return Ot.PaymentEntryPageButtonPay}})};xt(P,O=>{$(u)?O(A):O(C,!1)},!0)}ke(T,R)};xt(w,T=>{var R;(R=e.subscriptionOption)!=null&&R.trial?T(b):T(E,!1)})}ke(h,_)},$$slots:{default:!0}}),Kt()}const oQ={error:"#B0171F",warning:"#f4e971",focus:"#1148B8",accent:"#767676",primary:"#576CDB","primary-hover":"rgba(87, 108, 219, .8)","primary-pressed":"rgba(87, 108, 219, .9)","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.7)","grey-ui-dark":"rgba(0,0,0,0.3)","grey-ui-light":"rgba(0,0,0,0.1)","input-background":"white",background:"white"},cQ={error:"#B0171F",warning:"#f4e971",focus:"#1148B8",accent:"#767676",primary:"#576CDB","primary-hover":"rgba(87, 108, 219, .8)","primary-pressed":"rgba(87, 108, 219, .9)","primary-text":"#ffffff",white:"#ffffff","grey-text-dark":"rgba(0,0,0,1)","grey-text-light":"rgba(0,0,0,0.7)","grey-ui-dark":"rgba(0,0,0,0.3)","grey-ui-light":"rgba(0,0,0,0.1)","input-background":"white",background:"#EFF3FA"},SU={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},lQ={...SU,"input-background":"color_form_bg",background:"color_form_bg"},uQ={...SU,"input-background":"color_product_info_bg",background:"color_product_info_bg"},EU={"input-border-radius":"4px","input-button-border-radius":"8px"},dQ={"input-border-radius":"0px","input-button-border-radius":"0px"},fQ={"input-border-radius":"12px","input-button-border-radius":"9999px"},VO=EU,G_="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",TU="BrandCustomFont",HO=`${TU}, ${G_}`,So={regular:"400",medium:"500",semibold:"600"},ss={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},Eo={130:"130%",140:"140%"},To={tight:"0.20%",regular:"0",loose:"0.20%"},Wn={heading2xl:{fontSize:ss[28],lineHeight:Eo[130],fontWeight:So.semibold,letterSpacing:To.loose},headingXl:{fontSize:ss[24],lineHeight:Eo[130],fontWeight:So.semibold,letterSpacing:To.loose},headingLg:{fontSize:"20px",lineHeight:Eo[130],fontWeight:So.semibold,letterSpacing:To.loose},headingMd:{fontSize:"16px",lineHeight:Eo[140],fontWeight:So.medium,letterSpacing:To.regular},bodyBase:{fontSize:ss[16],lineHeight:Eo[140],fontWeight:So.regular,letterSpacing:To.regular},bodySmall:{fontSize:ss[14],lineHeight:Eo[140],fontWeight:So.regular,letterSpacing:To.regular},labelButton:{fontSize:ss[16],lineHeight:Eo[140],fontWeight:So.semibold,letterSpacing:To.tight},labelDefault:{fontSize:ss[14],lineHeight:Eo[140],fontWeight:So.regular,letterSpacing:To.tight},captionDefault:{fontSize:ss[12],lineHeight:Eo[140],fontWeight:So.regular,letterSpacing:To.regular},captionLink:{fontSize:ss[12],lineHeight:Eo[140],fontWeight:So.regular,letterSpacing:To.regular}},Co={heading2xl:{...Wn.heading2xl,fontSize:ss[36]},headingXl:{...Wn.headingXl,fontSize:ss[32]},headingLg:{...Wn.headingLg,fontSize:ss[24]},headingMd:{...Wn.headingMd,fontSize:ss[18]},bodyBase:{...Wn.bodyBase},bodySmall:{...Wn.bodySmall},labelButton:{...Wn.labelButton},labelDefault:{...Wn.labelDefault},captionDefault:{...Wn.captionDefault},captionLink:{...Wn.captionLink}},OT={heading2xl:{mobile:Wn.heading2xl,desktop:Co.heading2xl},headingXl:{desktop:Co.headingXl,mobile:Wn.headingXl},headingLg:{desktop:Co.headingLg,mobile:Wn.headingLg},headingMd:{desktop:Co.headingMd,mobile:Wn.headingMd},bodyBase:{desktop:Co.bodyBase,mobile:Wn.bodyBase},bodySmall:{desktop:Co.bodySmall,mobile:Wn.bodySmall},labelButton:{desktop:Co.labelButton,mobile:Wn.labelButton},labelDefault:{desktop:Co.labelDefault,mobile:Wn.labelDefault},captionDefault:{desktop:Co.captionDefault,mobile:Wn.captionDefault},captionLink:{desktop:Co.captionLink,mobile:Wn.captionLink}},jm=t=>t.length==7?{r:parseInt(t.slice(1,3),16),g:parseInt(t.slice(3,5),16),b:parseInt(t.slice(5,7),16)}:t.length==4?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null,rP=({r:t,g:e,b:r,luminanceThreshold:n})=>{const a=i=>(i=i/255,i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4));return .2126*a(t)+.7152*a(e)+.0722*a(r)>n},nP=.37,pQ=(t,e=nP)=>{const r=rP({...t,luminanceThreshold:e})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${r})`,"grey-text-light":`rgba(${r},0.70)`,"grey-ui-dark":`rgba(${r},0.3)`,"grey-ui-light":`rgba(${r},0.1)`}};function hQ(t,e,r){const n=jm(t)||{r:0,g:0,b:0},a=jm(e)||{r:255,g:255,b:255},i=Math.round(a.r*r+n.r*(1-r)),o=Math.round(a.g*r+n.g*(1-r)),c=Math.round(a.b*r+n.b*(1-r));return`#${Hw(i)}${Hw(o)}${Hw(c)}`}function GO(t,e){const r={r:255,g:255,b:255},n=Math.max(0,Math.min(1,e));let a=t,i=jm(t)||r;(isNaN(i.r)||isNaN(i.g)||isNaN(i.b))&&(i=r,a="#FFFFFF");const o=rP({...i,luminanceThreshold:nP})?"#000000":"#FFFFFF";return hQ(a,o,n)}function Hw(t){return t.toString(16).padStart(2,"0").toUpperCase()}const mQ=(t,e,r,n=nP)=>{const a={"grey-text-dark":r["grey-text-dark"],"grey-text-light":r["grey-text-light"],"grey-ui-dark":r["grey-ui-dark"],"grey-ui-light":r["grey-ui-light"],"primary-text":r["primary-text"]};if(t!=null&&t.startsWith("#")){const i=jm(t);i!==null&&Object.assign(a,pQ(i))}if(e!=null&&e.startsWith("#")){const i=jm(e);i!==null&&(a["primary-text"]=rP({...i,luminanceThreshold:n})?"black":"white")}return a},gQ=t=>({"primary-hover":GO(t,.1),"primary-pressed":GO(t,.15)}),yQ=(t,e)=>t||e,vQ=(t,e,r)=>{const n=Object.entries(t).map(([a,i])=>[a,yQ(r?r[i]:null,e[a])]);return Object.fromEntries(n)},CU=(t,e,r)=>{const n=vQ(t,e,r);return r?{...e,...n,...mQ(n.background,n.primary,e),...gQ(n.primary)}:{...e}},_Q=t=>CU(uQ,cQ,t),xU=t=>CU(lQ,oQ,t),aP=t=>{if(!t)return VO;switch(t.shapes){case"rounded":return EU;case"rectangle":return dQ;case"pill":return fQ;default:return VO}},W_=(t="",e)=>e.map(([r,n])=>`--rc-${t}-${r}: ${n}`).join("; "),PU=t=>{const e=W_("color",Object.entries(_Q(t))),r=W_("shape",Object.entries(aP(t)));return[e,r].join("; ")},bQ=t=>{const e=W_("color",Object.entries(xU(t))),r=W_("shape",Object.entries(aP(t)));return[e,r].join("; ")},kQ=(t="",e,r)=>Object.entries(e).flatMap(([n,{desktop:a,mobile:i}])=>{const o=`normal normal ${a.fontWeight} ${a.fontSize}/${a.lineHeight} ${G_}`,c=`normal normal ${i.fontWeight} ${i.fontSize}/${i.lineHeight} ${G_}`,u=`normal normal ${r?.desktop.font_weight} ${r?.desktop.font_size} ${HO}`,d=`normal normal ${r?.mobile.font_weight} ${r?.mobile.font_size} ${HO}`;return[`--rc-${t}-${n}-desktop: ${o}`,`--rc-${t}-${n}-mobile: ${c}`,`--rc-${t}-${n}-branded-desktop: ${r?u:o}`,`--rc-${t}-${n}-branded-mobile: ${r?d:c}`,`--rc-${t}-${n}-desktop-font-size: ${a.fontSize}`,`--rc-${t}-${n}-mobile-font-size: ${i.fontSize}`]}).join("; "),wQ=(t="",e)=>Object.entries(e).map(([r,{mobile:n,desktop:a}])=>`--rc-${t}-${r}-mobile: ${n};  --rc-${t}-${r}-desktop: ${a};`).join(" "),SQ={outerPaddingTop:{mobile:"0.25rem",desktop:"clamp(1rem, 8.44vw, 7.5rem)"},outerPadding:{mobile:"clamp(1.3125rem, 5.6vw, 1.5rem)",desktop:"clamp(3rem, 6.44vw, 4.5rem)"},gapSmall:{mobile:"0.25rem",desktop:"0.5rem"},gapMedium:{mobile:"0.5rem",desktop:"0.75rem"},gapLarge:{mobile:"0.75rem",desktop:"1rem"},gapXLarge:{mobile:"1rem",desktop:"2rem"},gapXXLarge:{mobile:"1.25rem",desktop:"2.25rem"},gapXXXLarge:{mobile:"2.25rem",desktop:"5rem"},inputHeight:{mobile:"3rem",desktop:"3rem"}};class Lm{constructor(e){vt(this,"brandingAppearance"),e?this.brandingAppearance=e:this.brandingAppearance=void 0}get shape(){return aP(this.brandingAppearance)}get formColors(){return xU(this.brandingAppearance)}get formStyleVars(){return bQ(this.brandingAppearance)}get productInfoStyleVars(){return PU(this.brandingAppearance)}get spacing(){return SQ}get textStyles(){return OT}getTextStyleVars(e){return kQ("text",this.textStyles,e)}get spacingStyleVars(){return wQ("spacing",this.spacing)}}var AU="basil",EQ=function(t){return t===3?"v3":t},RU="https://js.stripe.com",TQ="".concat(RU,"/").concat(AU,"/stripe.js"),CQ=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,xQ=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,PQ=function(t){return CQ.test(t)||xQ.test(t)},AQ=function(){for(var t=document.querySelectorAll('script[src^="'.concat(RU,'"]')),e=0;e<t.length;e++){var r=t[e];if(PQ(r.src))return r}return null},WO=function(t){var e="",r=document.createElement("script");r.src="".concat(TQ).concat(e);var n=document.head||document.body;if(!n)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(r),r},RQ=function(t,e){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"7.3.1",startTime:e})},Th=null,cv=null,lv=null,DQ=function(t){return function(e){t(new Error("Failed to load Stripe.js",{cause:e}))}},OQ=function(t,e){return function(){window.Stripe?t(window.Stripe):e(new Error("Stripe.js not available"))}},NQ=function(t){return Th!==null?Th:(Th=new Promise(function(e,r){if(typeof window>"u"||typeof document>"u"){e(null);return}if(window.Stripe){e(window.Stripe);return}try{var n=AQ();if(!(n&&t)){if(!n)n=WO(t);else if(n&&lv!==null&&cv!==null){var a;n.removeEventListener("load",lv),n.removeEventListener("error",cv),(a=n.parentNode)===null||a===void 0||a.removeChild(n),n=WO(t)}}lv=OQ(e,r),cv=DQ(r),n.addEventListener("load",lv),n.addEventListener("error",cv)}catch(i){r(i);return}}),Th.catch(function(e){return Th=null,Promise.reject(e)}))},IQ=function(t,e,r){if(t===null)return null;var n=e[0],a=n.match(/^pk_test/),i=EQ(t.version),o=AU,c=t.apply(void 0,e);return RQ(c,r),c},uv,DU=!1,OU=function(){return uv||(uv=NQ(null).catch(function(t){return uv=null,Promise.reject(t)}),uv)};Promise.resolve().then(function(){return OU()}).catch(function(t){});var MQ=function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];DU=!0;var n=Date.now();return OU().then(function(a){return IQ(a,e,n)})},NT=(t=>(t[t.ErrorLoadingStripe=0]="ErrorLoadingStripe",t[t.HandledFormError=1]="HandledFormError",t[t.UnhandledFormError=2]="UnhandledFormError",t))(NT||{});class Xv{constructor(e,r,n){this.code=e,this.gatewayErrorCode=r,this.message=n}}const NU=class Jv{static getStripeLocale(e){if(["ca","hi","uk"].includes(e))return"auto";const r={zh_Hans:"zh",zh_Hant:"zh"};return Object.keys(r).includes(e)?r[e]:e}static async initializeStripe(e,r,n,a,i,o,c){if(!r||!e||!n)throw{code:0,gatewayErrorCode:void 0,message:"Stripe configuration is missing"};const u=await MQ(r,{stripeAccount:e}).catch(b=>{throw this.mapInitializationError(b)});if(!u)throw{code:0,gatewayErrorCode:void 0,message:"Stripe client not found"};const d=new Lm(a?.appearance),f=d.shape,h=d.formColors,m=d.textStyles,_=OT.bodyBase[c].fontSize||OT.bodyBase.mobile.fontSize;let w;try{w=u.elements({mode:n.mode,paymentMethodTypes:n.payment_method_types,setupFutureUsage:n.setup_future_usage,amount:n.amount,currency:n.currency,loader:"always",locale:i,appearance:{theme:"stripe",labels:"floating",variables:{borderRadius:f["input-border-radius"],focusBoxShadow:"none",colorDanger:h.error,colorTextPlaceholder:h["grey-text-light"],colorText:h["grey-text-dark"],colorTextSecondary:h["grey-text-light"],fontSizeBase:_,...o},rules:{".Input":{boxShadow:"none",paddingTop:"6px",paddingBottom:"6px",fontSize:_,border:`1px solid ${h["grey-ui-dark"]}`,backgroundColor:h["input-background"],color:h["grey-text-dark"]},".Input:focus":{border:`1px solid ${h.focus}`,outline:"none"},".Label":{fontWeight:m.labelDefault[c].fontWeight,lineHeight:"22px",color:h["grey-text-dark"]},".Label--floating":{opacity:"1"},".Input--invalid":{boxShadow:"none"}}}})}catch(b){throw this.mapInitializationError(b)}return{stripe:u,elements:w}}static async updateElementsConfiguration(e,r){e.update({mode:r.mode,paymentMethodTypes:r.payment_method_types,setupFutureUsage:r.setup_future_usage,amount:r.amount,currency:r.currency})}static isStripeHandledFormError(e){const r=e.type==="validation_error",n=e.type==="card_error"&&e.code&&this.FORM_VALIDATED_CARD_ERROR_CODES.includes(e.code);return r||n}static createPaymentElement(e,r){return e.create("payment",{business:r?{name:r}:void 0,layout:{type:"tabs"},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}})}static createExpressCheckoutElement(e,r,n){const a={billingAddressRequired:r,emailRequired:!0,...n||{}};return e.create("expressCheckout",a)}static createLinkAuthenticationElement(e,r){return e.create("linkAuthentication",{defaultValues:{email:r??""}})}static async submitElements(e){const{error:r}=await e.submit();if(r)throw this.mapError(r)}static mapInitializationError(e){return new Xv(0,e.code,e.message)}static mapError(e){return this.isStripeHandledFormError(e)?new Xv(1,e.code,e.message):new Xv(2,e.code,e.message)}static async confirmElements(e,r,n,a){const i={clientSecret:n,redirect:"if_required"},o=a?{...i,confirmParams:{confirmation_token:a}}:{...i,elements:r},c=n.startsWith("seti_");let u;if(c?u=await e.confirmSetup(o):u=await e.confirmPayment(o),u!=null&&u.error)throw this.mapError(u.error)}static async extractTaxCustomerDetails(e,r){var n,a;const{error:i,confirmationToken:o}=await r.createConfirmationToken({elements:e});if(i)throw this.mapError(i);const c=(a=(n=o.payment_method_preview)==null?void 0:n.billing_details)==null?void 0:a.address;return{customerDetails:{countryCode:c?.country??void 0,postalCode:c?.postal_code??void 0},confirmationTokenId:o.id}}static nextDateForPeriod(e,r){return e.unit===Ea.Year?(r.setFullYear(r.getFullYear()+e.number),r):e.unit===Ea.Month?(r.setMonth(r.getMonth()+e.number),r):e.unit===Ea.Week?(r.setDate(r.getDate()+e.number*7),r):(e.unit===Ea.Day&&r.setDate(r.getDate()+e.number),r)}static applePayPeriod(e){return e.unit===Ea.Week?{recurringPaymentIntervalUnit:"day",recurringPaymentIntervalCount:e.number*7}:{recurringPaymentIntervalUnit:e.unit,recurringPaymentIntervalCount:e.number}}static microsToMinimumAmountPrice(e,r){return["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"].includes(r)?Math.floor(e/1e6):Math.floor(e/1e4)}static buildStripeExpressCheckoutOptionsForSubscription(e,r,n,a,i){var o;const c=Jv.microsToMinimumAmountPrice(r.totalAmountInMicros,r.currency),u=n.trial,d=(o=n.trial)==null?void 0:o.period,f=n.base.period,h=u&&d?Jv.nextDateForPeriod(d,new Date):void 0,m=f?Jv.applePayPeriod(f):{};return{applePay:{recurringPaymentRequest:{paymentDescription:e.title,managementURL:i,trialBilling:u?{label:a.translate(Ot.ApplePayFreeTrial),amount:0}:void 0,regularBilling:{label:e.title,amount:c,recurringPaymentStartDate:h,...m}}}}}};vt(NU,"FORM_VALIDATED_CARD_ERROR_CODES",["card_declined","expired_card","incorrect_cvc","incorrect_number"]);let ja=NU;var jQ=lt("<div></div>");function LQ(t,e){Wt(e,!0);let r=null;const n="payment-element",a=async o=>{await e.onError(ja.mapInitializationError(o.error))};_s(()=>{var o;try{r=ja.createPaymentElement(e.elements,(o=e.brandingInfo)==null?void 0:o.app_name),r.mount(`#${n}`),r.on("ready",e.onReady),r.on("change",e.onChange),r.on("loaderror",a)}catch(c){e.onError(ja.mapInitializationError(c))}}),Ng(()=>{r?.destroy(),r=null});var i=jQ();Ut(i,"id",n),ke(t,i),Kt()}var BQ=lt("<div></div>");function UQ(t,e){Wt(e,!0);let r=null;const n="link-authentication-element",a=async o=>{await e.onError(ja.mapInitializationError(o.error))};_s(()=>{try{r=ja.createLinkAuthenticationElement(e.elements,e.email),r.mount(`#${n}`),r.on("ready",e.onReady),r.on("change",e.onChange),r.on("loaderror",a)}catch(o){e.onError(ja.mapInitializationError(o))}}),Ng(()=>{r?.destroy(),r=null});var i=BQ();Ut(i,"id",n),ke(t,i),Kt()}var FQ=lt('<div class="text-separator svelte-ch0h61"><hr class="line svelte-ch0h61"> <span class="text svelte-ch0h61"><!></span> <hr class="line svelte-ch0h61"></div>');const qQ={hash:"svelte-ch0h61",code:`.text-separator.svelte-ch0h61 {display:flex;align-items:center;justify-content:center;gap:var(--rc-spacing-gapSmall-mobile);}

  @container layout-query-container (width >= 768px) {.text-separator.svelte-ch0h61 {gap:var(--rc-spacing-gapSmall-desktop);}
  }.line.svelte-ch0h61 {flex:1;height:1px;background-color:var(--rc-color-grey-ui-dark);border:none;}.text.svelte-ch0h61 {color:var(--rc-color-grey-text-light);text-transform:uppercase;white-space:nowrap;}`};function zQ(t,e){zt(t,qQ);let r=It(e,"text",8);var n=FQ(),a=kt(Le(n),2),i=Le(a);Pr(i,{size:"caption-default",children:(o,c)=>{var u=Ur();mt(()=>hr(u,r())),ke(o,u)},$$slots:{default:!0}}),ke(t,n)}var $Q=lt("<div></div> <!>",1);function VQ(t,e){Wt(e,!0);const r=Aa(),n=()=>ha(a,"$translator",r),a=Jn(Bi);let i=null,o=sr(!1);const c="express-checkout-element",u=async b=>{const E={...e.expressCheckoutOptions?e.expressCheckoutOptions:{}};b.resolve(E)},d=async b=>{await e.onError(ja.mapInitializationError(b.error))},f=async b=>{var E;e.onSubmit(b.expressPaymentType,((E=b.billingDetails)==null?void 0:E.email)??"")},h=async b=>{pt(o,!b.availablePaymentMethods),e.onReady()};_s(()=>{try{i=ja.createExpressCheckoutElement(e.elements,e.billingAddressRequired,e.expressCheckoutOptions),i.mount(`#${c}`),i.on("ready",h),i.on("confirm",f),i.on("loaderror",d),i.on("click",u)}catch(b){e.onError(ja.mapInitializationError(b))}}),Ng(()=>{i?.destroy(),i=null});var m=wr(),_=Xt(m);{var w=b=>{var E=$Q(),T=Xt(E);Ut(T,"id",c);var R=kt(T,2),P=ze(()=>n().translate(Ot.PaymentEntryPageExpressCheckoutDivider));zQ(R,{get text(){return $(P)}}),ke(b,E)};xt(_,b=>{$(o)||b(w)})}ke(t,m),Kt()}var HQ=lt('<div class="rc-elements svelte-6qa1vy"><!> <!> <!></div>');const GQ={hash:"svelte-6qa1vy",code:`.rc-elements.svelte-6qa1vy {display:flex;flex-direction:column;gap:var(--rc-spacing-gapXLarge-mobile);}

  @container layout-query-container (width >= 768px) {.rc-elements.svelte-6qa1vy {gap:var(--rc-spacing-gapLarge-desktop);}
  }`};function WQ(t,e){Wt(e,!0),zt(t,GQ);const r=Aa(),n=()=>ha(o,"$translator",r);let a=It(e,"stripe",15,null),i=It(e,"elements",15,null);const o=Jn(Bi),c=ja.getStripeLocale(n().locale||n().fallbackLocale);let u=sr(!1),d=sr(Vt(e.skipEmail)),f=sr(!1),h=sr(void 0),m=sr("mobile"),_=sr(void 0);function w(){window.matchMedia&&window.matchMedia("(max-width: 767px)").matches?pt(m,"mobile"):pt(m,"desktop"),pt(h,Vt({fontSizeBase:"14px",fontFamily:G_,spacingGridRow:"16px"}))}function b(){clearTimeout($(_)),pt(_,Vt(setTimeout(()=>{w()},150)))}const E=D=>{e.onError(D),e.onLoadingComplete()},T=async()=>{$(d)||(pt(d,!0),$(d)&&$(u)&&$(f)&&e.onLoadingComplete())},R=async()=>{$(f)||(pt(f,!0),$(d)&&$(u)&&$(f)&&e.onLoadingComplete())},P=async()=>{$(u)||(pt(u,!0),$(d)&&$(u)&&$(f)&&e.onLoadingComplete())},A=async D=>{e.onPaymentInfoChange({complete:D.complete,paymentMethod:D.complete?D.value.type:void 0})},C=async D=>{e.onEmailChange(D.complete,D.value.email)};_s(()=>(window.addEventListener("resize",b),()=>{window.removeEventListener("resize",b)})),_s(async()=>{w(),!a()&&(i()||!e.stripeAccountId||!e.publishableApiKey||!e.elementsConfiguration||await ja.initializeStripe(e.stripeAccountId,e.publishableApiKey,e.elementsConfiguration,e.brandingInfo,c,$(h),$(m)).then(({stripe:D,elements:N})=>{a(D),i(N)}).catch(D=>{e.onError(D)}))}),ap(()=>{e.elementsConfiguration&&i()&&ja.updateElementsConfiguration(i(),e.elementsConfiguration)});var O=wr(),I=Xt(O);{var x=D=>{var N=HQ(),L=Le(N);VQ(L,{get elements(){return i()},onError:E,onReady:R,get onSubmit(){return e.onExpressCheckoutElementSubmit},get expressCheckoutOptions(){return e.expressCheckoutOptions},get billingAddressRequired(){return e.billingAddressRequired}});var j=kt(L,2);{var q=W=>{UQ(W,{get elements(){return i()},onReady:T,onChange:C,onError:E})};xt(j,W=>{e.skipEmail||W(q)})}var U=kt(j,2);LQ(U,{get elements(){return i()},get brandingInfo(){return e.brandingInfo},onReady:P,onChange:A,onError:E}),ke(D,N)};xt(I,D=>{i()&&D(x)})}ke(t,O),Kt()}const KQ=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
  <path fill-rule="evenodd" d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm0 6.5a1.25 1.25 0 100-2.5 1.25 1.25 0 000 2.5zm1.25 4.5a1.25 1.25 0 10-2.5 0v4.5a1.25 1.25 0 102.5 0v-4.5z" clip-rule="evenodd" />
</svg> `;var YQ=lt('<div class="rcb-ui-asset-icon svelte-1rk57mx"><!></div>');const XQ={hash:"svelte-1rk57mx",code:".rcb-ui-asset-icon.svelte-1rk57mx {display:inline-block;width:1em;height:1em;}"};function IU(t){zt(t,XQ);var e=YQ(),r=Le(e);du(r,()=>KQ),ke(t,e)}var JQ=lt('<div class="rcb-info svelte-1czikbr"><div class="rcb-info-icon-wrapper svelte-1czikbr"><!></div> <div class="rcb-info-content svelte-1czikbr"><div class="rcb-info-title svelte-1czikbr"><!></div> <div class="rcb-info-message svelte-1czikbr"><!></div></div></div>');const QQ={hash:"svelte-1czikbr",code:`.rcb-info.svelte-1czikbr {display:flex;align-items:flex-start;background-color:var(--rc-color-grey-ui-light);border-radius:var(--rc-shape-input-border-radius);gap:var(--rc-spacing-gapLarge-mobile);padding:var(--rc-spacing-gapLarge-mobile);}.rcb-info-content.svelte-1czikbr {flex:1;}.rcb-info-icon-wrapper.svelte-1czikbr {flex-shrink:0;color:var(--rc-color-accent-primary);}.rcb-info-title.svelte-1czikbr {color:var(--rc-color-grey-text-dark);margin-bottom:var(--rc-spacing-gapSmall-mobile);display:flex;}.rcb-info-message.svelte-1czikbr {color:var(--rc-color-grey-text-light);}

  @container layout-query-container (width >= 768px) {.rcb-info.svelte-1czikbr {gap:var(--rc-spacing-gapLarge-desktop);padding:var(--rc-spacing-gapLarge-desktop);}.rcb-info-title.svelte-1czikbr {margin-bottom:var(--rc-spacing-gapSmall-desktop);}
  }`};function ZQ(t,e){zt(t,QQ);var r=JQ(),n=Le(r),a=Le(n);IU(a);var i=kt(n,2),o=Le(i),c=Le(o);Pr(c,{size:"body-small",children:(f,h)=>{var m=Ur();mt(()=>hr(m,e.title)),ke(f,m)},$$slots:{default:!0}});var u=kt(o,2),d=Le(u);Pr(d,{size:"body-small",children:(f,h)=>{var m=Ur();mt(()=>hr(m,e.message)),ke(f,m)},$$slots:{default:!0}}),ke(t,r)}function eZ(t,e){Wt(e,!0);const r=Aa(),n=()=>ha(a,"$translator",r),a=Jn(Bi);var i=ze(()=>n().translate(Ot.PriceUpdateTitle)),o=ze(()=>{var c;return n().translate((c=e.subscriptionOption)!=null&&c.trial?Ot.PriceUpdateTrialMessage:Ot.PriceUpdateBaseMessage)});ZQ(t,{get title(){return $(i)},get message(){return $(o)}}),Kt()}function MU(t,e){if(t.productType==="subscription"){const r=e,n=r.introPrice?r.introPrice.price:r.base.price;if(n)return n}else return e.basePrice;return t.price}class KO extends Error{}var tZ=lt('<div class="rc-loading svelte-dg9m6p"><!></div>'),rZ=lt('<div class="rc-checkout-container svelte-dg9m6p"><!> <!> <form data-testid="payment-form" class="rc-checkout-form svelte-dg9m6p"><div class="rc-checkout-form-container svelte-dg9m6p"><div class="rc-elements-container svelte-dg9m6p"><!></div> <div class="rc-checkout-price-update-info-container svelte-dg9m6p"><!></div> <div class="rc-checkout-pay-container svelte-dg9m6p"><!> <div class="rc-checkout-secure-container svelte-dg9m6p"><!></div></div></div></form></div>');const nZ={hash:"svelte-dg9m6p",code:`.rc-checkout-secure-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-mobile);}.rc-checkout-container.svelte-dg9m6p {display:flex;flex-direction:column;gap:var(--rc-spacing-gapXLarge-mobile);user-select:none;position:relative;}.rc-checkout-price-update-info-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-mobile);}.fully-hidden.svelte-dg9m6p {display:none;height:0;}.rc-checkout-pay-container.svelte-dg9m6p {display:flex;flex-direction:column;margin-top:var(--rc-spacing-gapXLarge-mobile);}.rc-checkout-pay-container.fully-hidden.svelte-dg9m6p {display:none;}.rc-checkout-form-container.svelte-dg9m6p {width:100%;}.rc-elements-container.svelte-dg9m6p {
    /* The standard height of the payment form from Stripe */
    /* Added to avoid the card getting smaller while loading */min-height:210px;}.rc-checkout-form-container.invisible.svelte-dg9m6p {visibility:hidden;}.rc-loading.svelte-dg9m6p {width:100%;height:100%;display:flex;justify-content:center;align-items:center;}

  @container layout-query-container (width <= 767px) {.rc-checkout-pay-container.svelte-dg9m6p {flex-grow:1;justify-content:flex-end;}.rc-checkout-form.svelte-dg9m6p {flex-grow:1;}.rc-checkout-form-container.svelte-dg9m6p {height:100%;display:flex;flex-direction:column;}.rc-checkout-container.svelte-dg9m6p {flex-grow:1;}.rc-loading.svelte-dg9m6p {position:absolute;top:0;left:0;}
  }

  @container layout-query-container (width >= 768px) {.rc-checkout-secure-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-desktop);}.rc-checkout-container.svelte-dg9m6p {gap:var(--rc-spacing-gapXLarge-desktop);}.rc-checkout-pay-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-desktop);}.rc-checkout-price-update-info-container.svelte-dg9m6p {margin-top:var(--rc-spacing-gapXLarge-desktop);}
  }form.svelte-dg9m6p {display:flex;flex-direction:column;flex-grow:1;}`};function aZ(t,e){var r,n,a;Wt(e,!0),zt(t,nZ);const i=Aa(),o=()=>ha(u,"$translator",i),c=Jn(Qx),u=Jn(Bi),d=(r=e.productDetails.subscriptionOptions)==null?void 0:r[e.purchaseOption.id],f=MU(e.productDetails,e.purchaseOption);let h=sr(Vt(((n=e.defaultPriceBreakdown)==null?void 0:n.taxCalculationStatus)??((a=e.brandingInfo)!=null&&a.gateway_tax_collection_enabled?"unavailable":"disabled"))),m=sr(null),_=sr(null),w=sr(Vt(f.amountMicros)),b=sr(Vt(f.amountMicros)),E=ze(()=>e.defaultPriceBreakdown??{currency:f.currency,totalAmountInMicros:$(b),totalExcludingTaxInMicros:$(w),taxCalculationStatus:$(h),taxAmountInMicros:$(m),taxBreakdown:$(_)}),T=sr(Vt(e.gatewayParams.elements_configuration)),R=sr(null),P=sr(null),A=sr(null),C=sr(Vt(e.customerEmail??void 0)),O=sr(Vt(!!e.customerEmail)),I=sr(!0),x=sr(!1),D=sr(void 0),N=sr(void 0),L=sr(void 0),j=sr(!1),q=sr(null),U=ze(()=>$(I)||$(j)?"loading":$(N)?"error":"form"),W=sr("unavailable"),F=ze(()=>!$(j)&&$(x)&&$(O)&&($(h)==="disabled"||$(h)==="calculated"||$(h)==="miss-match")),Y=ze(()=>d&&e.managementUrl&&$(E)?ja.buildStripeExpressCheckoutOptionsForSubscription(e.productDetails,$(E),d,o(),e.managementUrl):void 0);ap(()=>{e.onPriceBreakdownUpdated($(E))}),_s(async()=>{$(h)==="unavailable"&&await Q(null).catch(H)}),Ng(()=>{$(q)&&($(q).abort(),pt(q,null))});async function Q(we,st){await e.purchaseOperationHelper.checkoutCalculateTax(we?.countryCode,we?.postalCode,st).then(bt=>{const nr=JJ({taxCalculation:bt,taxCustomerDetails:we});c.trackSDKEvent(nr),st?.throwIfAborted(),bt.failed_reason?!we&&bt.failed_reason===tP.invalid_tax_location?pt(h,"pending"):pt(h,"disabled"):pt(h,"calculated"),pt(m,Vt(bt.tax_amount_in_micros)),pt(w,Vt(bt.total_excluding_tax_in_micros)),pt(b,Vt(bt.total_amount_in_micros)),pt(_,Vt(bt.tax_breakdown)),pt(T,Vt(bt.gateway_params.elements_configuration)),pt(R,Vt(we))})}function ie(){c.trackSDKEvent({eventName:gi.CheckoutPaymentFormImpression}),pt(I,!1)}async function G(we,st){pt(C,Vt(st)),pt(O,Vt(we)),await te()}async function B({complete:we,paymentMethod:st}){pt(D,Vt(st)),pt(x,Vt(we)),await te()}async function K(we){if(we?.preventDefault(),$(j))return;const st=QJ({selectedPaymentMethod:$(D)??null});c.trackSDKEvent(st),pt(j,!0),await me()?e.onContinue():pt(j,!1)}async function ae(we,st){pt(D,Vt(we)),pt(C,Vt(e.customerEmail??st)),await K()}async function te(){$(D)!=="card"||!$(O)||!$(x)||$(j)||$(h)==="disabled"||($(h)!=="loading"&&(pt(W,Vt($(h))),pt(h,"loading")),await ue(async we=>{await Ae().then(()=>we.throwIfAborted()).then(()=>He(we)).then(()=>we.throwIfAborted()).catch(st=>{we.aborted||H(st)}).finally(()=>{$(h)==="loading"&&!we.aborted&&pt(h,Vt($(W)))})}))}async function me(){return await ue(async we=>{const st=$(b);let bt;return await Ae().then(()=>we.throwIfAborted()).then(()=>He(we)).then(nr=>{bt=nr}).then(()=>we.throwIfAborted()).then(ce(st)).then(()=>we.throwIfAborted()).then(xe).then(()=>we.throwIfAborted()).then(()=>re(bt)).then(()=>we.throwIfAborted()).then(()=>!0).catch(nr=>(we.aborted||H(nr),!1))})}async function ue(we){$(q)&&$(q).abort(),pt(q,Vt(new AbortController));const st=$(q).signal;try{return await we(st)}catch(bt){if(bt instanceof DOMException&&bt.name==="AbortError")return Promise.resolve(void 0);throw bt}}async function Ae(){$(A)&&await ja.submitElements($(A))}async function He(we){var st,bt;if($(h)==="unavailable"||$(h)==="disabled"||!$(A)||!$(P))return;const{customerDetails:nr,confirmationTokenId:ur}=await ja.extractTaxCustomerDetails($(A),$(P));return we?.throwIfAborted(),nr.postalCode===((st=$(R))==null?void 0:st.postalCode)&&nr.countryCode===((bt=$(R))==null?void 0:bt.countryCode)||await Q(nr,we),ur&&$(D)!=="card"?ur:void 0}function ce(we){return()=>{if($(b)!==we)throw new KO}}async function xe(){var we;const st=await e.purchaseOperationHelper.checkoutComplete($(C)),bt=(we=st?.gateway_params)==null?void 0:we.client_secret;bt&&pt(L,Vt(bt))}async function re(we){!$(P)||!$(A)||!$(L)||await ja.confirmElements($(P),$(A),$(L),we)}async function H(we){if(we instanceof KO)pt(h,"miss-match");else if(we instanceof on){const st=GJ({errorCode:we.errorCode.toString(),errorMessage:we.message});c.trackSDKEvent(st),we.errorCode===Hr.MissingEmailError?pt(N,Vt(o().translate(Ot.ErrorPageErrorMessageInvalidEmailError,{email:$(C)}))):e.onError(we)}else if(we instanceof Xv)await he(we);else throw we}async function he(we){const st=ZJ({errorCode:we.gatewayErrorCode??"",errorMessage:we.message??""});c.trackSDKEvent(st),we.code===NT.HandledFormError||(we.code===NT.UnhandledFormError?pt(N,Vt(we.message)):e.onError(new on(Hr.ErrorSettingUpPurchase,"Failed to initialize payment form",we.message)))}const Re=()=>{pt(N,void 0)};var fe=rZ(),Ie=Le(fe);{var ct=we=>{var st=tZ(),bt=Le(st);wU(bt),ke(we,st)};xt(Ie,we=>{$(U)==="loading"&&we(ct)})}var $e=kt(Ie,2);{var tt=we=>{var st=ze(()=>o().translate(Ot.ErrorButtonTryAgain));eP(we,{title:null,type:"error",get closeButtonTitle(){return $(st)},onDismiss:Re,icon:bt=>{rU(bt)},message:bt=>{var nr=Ur();mt(()=>hr(nr,$(N))),ke(bt,nr)},$$slots:{icon:!0,message:!0}})};xt($e,we=>{$(U)==="error"&&we(tt)})}var We=kt($e,2),it=Le(We),Et=Le(it),Mt=Le(Et),_t=ze(()=>!!e.customerEmail),ge=ze(()=>$(h)!=="disabled");WQ(Mt,{get stripeAccountId(){return e.gatewayParams.stripe_account_id},get publishableApiKey(){return e.gatewayParams.publishable_api_key},get elementsConfiguration(){return $(T)},get brandingInfo(){return e.brandingInfo},get skipEmail(){return $(_t)},get billingAddressRequired(){return $(ge)},onLoadingComplete:ie,onError:he,onEmailChange:G,onPaymentInfoChange:B,onExpressCheckoutElementSubmit:ae,get expressCheckoutOptions(){return $(Y)},get stripe(){return $(P)},set stripe(we){pt(P,Vt(we))},get elements(){return $(A)},set elements(we){pt(A,Vt(we))}});var Be=kt(Et,2),je=Le(Be);eZ(je,{subscriptionOption:d});var rt=kt(Be,2),Ct=Le(rt),jt=ze(()=>!$(F)),De=ze(()=>{var we;return(we=e.brandingInfo)!=null&&we.gateway_tax_collection_enabled?$(E):void 0});sQ(Ct,{get disabled(){return $(jt)},subscriptionOption:d,get priceBreakdown(){return $(De)}});var nt=kt(Ct,2),at=Le(nt);VJ(at,{get brandingInfo(){return e.brandingInfo},get purchaseOption(){return e.purchaseOption}}),mt(()=>{jc(it,"invisible",$(U)!=="form"),jc(Be,"fully-hidden",$(h)!=="miss-match"||$(U)!=="form"),jc(rt,"fully-hidden",$(U)!=="form")}),Mo("submit",We,K),ke(t,fe),Kt()}function iZ(t){return t!=null}var ed=(t=>(t.Subscription="subscription",t.Consumable="consumable",t.NonConsumable="non_consumable",t))(ed||{});const jU=t=>({amount:t.amount_micros/1e4,amountMicros:t.amount_micros,currency:t.currency,formattedPrice:ql(t.amount_micros,t.currency)}),Gw=t=>{const e=t.period_duration,r=t.price?jU(t.price):null,n=e?eU(e):null;let a=null,i=null,o=null;if(r!==null&&n!==null){const c=sZ(n),u=1e4,d=Math.round(r.amountMicros*c.toWeek);a={amount:d/u,amountMicros:d,currency:r.currency,formattedPrice:ql(d,r.currency)};const f=Math.round(r.amountMicros*c.toMonth);i={amount:f/u,amountMicros:f,currency:r.currency,formattedPrice:ql(f,r.currency)};const h=Math.round(r.amountMicros*c.toYear);o={amount:h/u,amountMicros:h,currency:r.currency,formattedPrice:ql(h,r.currency)}}return{periodDuration:e,period:n,cycleCount:t.cycle_count,price:r,pricePerWeek:a,pricePerMonth:i,pricePerYear:o}};function sZ(t){const{number:e,unit:r}=t,n=7,a=30,i=365;let o;switch(r){case Ea.Day:o=e;break;case Ea.Week:o=e*n;break;case Ea.Month:o=e*a;break;case Ea.Year:o=e*i;break;default:o=0,tr.errorLog(`Unknown period unit: ${r}`)}const c=o>0?n/o:0,u=o>0?a/o:0,d=o>0?i/o:0;return{toWeek:c,toMonth:u,toYear:d}}const oZ=t=>t.base==null?(tr.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,base:Gw(t.base),trial:t.trial?Gw(t.trial):null,introPrice:t.intro_price?Gw(t.intro_price):null},cZ=t=>t.base_price==null?(tr.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,basePrice:jU(t.base_price)},lZ=(t,e)=>{const r=t.product_type;return r==="subscription"?dZ(t,e,r):uZ(t,e,r)},uZ=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([o,c])=>{const u=cZ(c);u!=null&&(n[o]=u)}),Object.keys(n).length===0)return tr.debugLog(`Product ${t.identifier} has no purchase options. Ignoring.`),null;const a=t.default_purchase_option_id,i=a&&a in t.purchase_options?n[a]:null;return i==null?(tr.debugLog(`Product ${t.identifier} has no default purchase option. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:r,currentPrice:i.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:i,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:i,price:i.basePrice,period:null,freeTrialPhase:null,introPricePhase:null}},dZ=(t,e,r)=>{const n={};if(Object.entries(t.purchase_options).forEach(([c,u])=>{const d=oZ(u);d!=null&&(n[c]=d)}),Object.keys(n).length===0)return tr.debugLog(`Product ${t.identifier} has no subscription options. Ignoring.`),null;const a=t.default_purchase_option_id,i=a&&a in n?n[a]:null;if(i==null)return tr.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const o=i.base.price;return o==null?(tr.debugLog(`Product ${t.identifier} default option has no base price. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:r,currentPrice:o,normalPeriodDuration:i.base.periodDuration,presentedOfferingIdentifier:e.offeringIdentifier,presentedOfferingContext:e,defaultPurchaseOption:i,defaultSubscriptionOption:i,subscriptionOptions:n,defaultNonSubscriptionOption:null,price:o,period:i.base.period,freeTrialPhase:i.trial,introPricePhase:i.introPrice}},fZ=(t,e,r)=>{const n=r[e.platform_product_identifier];if(n===void 0)return null;const a=lZ(n,t);return a===null?null:{identifier:e.identifier,rcBillingProduct:a,webBillingProduct:a,packageType:hZ(e.identifier)}},pZ=(t,e,r,n)=>{const a={offeringIdentifier:e.identifier,targetingContext:t&&n?{ruleId:n.rule_id,revision:n.revision}:null,placementIdentifier:null},i=e.packages.map(c=>fZ(a,c,r)).filter(iZ),o={};for(const c of i)c!=null&&(o[c.identifier]=c);return i.length==0?null:{identifier:e.identifier,serverDescription:e.description,metadata:e.metadata,packagesById:o,availablePackages:i,lifetime:o.$rc_lifetime??null,annual:o.$rc_annual??null,sixMonth:o.$rc_six_month??null,threeMonth:o.$rc_three_month??null,twoMonth:o.$rc_two_month??null,monthly:o.$rc_monthly??null,weekly:o.$rc_weekly??null,paywall_components:e.paywall_components}};function hZ(t){switch(t){case"$rc_lifetime":return"$rc_lifetime";case"$rc_annual":return"$rc_annual";case"$rc_six_month":return"$rc_six_month";case"$rc_three_month":return"$rc_three_month";case"$rc_two_month":return"$rc_two_month";case"$rc_monthly":return"$rc_monthly";case"$rc_weekly":return"$rc_weekly";default:return t.startsWith("$rc_")?"unknown":"custom"}}var mZ=Jo('<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.94 5.72656L8 8.7799L11.06 5.72656L12 6.66656L8 10.6666L4 6.66656L4.94 5.72656Z" class="arrow-fill svelte-1qexsu3" fill-opacity="0.7"></path></svg>');const gZ={hash:"svelte-1qexsu3",code:".arrow.svelte-1qexsu3 {transition:transform 0.3s ease;}.arrow-fill.svelte-1qexsu3 {fill:var(--rc-color-grey-text-dark);}.arrow.left.svelte-1qexsu3 {transform:rotate(90deg);}.arrow.up.svelte-1qexsu3 {transform:rotate(180deg);}.arrow.right.svelte-1qexsu3 {transform:rotate(-90deg);}.arrow.down.svelte-1qexsu3 {transform:rotate(0deg);}"};function dv(t,e){zt(t,gZ);let r=It(e,"direction",8);var n=mZ();mt(()=>kK(n,`arrow ${r()??""} svelte-1qexsu3`)),ke(t,n)}var yZ=Jo('<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="arrow"><path d="M15.41 7.41L14 6L8 12L14 18L15.41 16.59L10.83 12L15.41 7.41Z" class="arrow-fill svelte-r0zny8" fill-opacity="0.7"></path></svg>');const vZ={hash:"svelte-r0zny8",code:".arrow-fill.svelte-r0zny8 {fill:var(--rc-color-grey-text-dark);}"};function _Z(t){zt(t,vZ);var e=yZ();ke(t,e)}const bZ=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
     xmlns="http://www.w3.org/2000/svg">
    <g opacity="0.5" clip-path="url(#clip0_344_3390)">
        <path d="M7 18C5.9 18 5.01 18.9 5.01 20C5.01 21.1 5.9 22 7 22C8.1 22 9 21.1 9 20C9 18.9 8.1 18 7 18ZM1 2V4H3L6.6 11.59L5.25 14.04C5.09 14.32 5 14.65 5 15C5 16.1 5.9 17 7 17H19V15H7.42C7.28 15 7.17 14.89 7.17 14.75L7.2 14.63L8.1 13H15.55C16.3 13 16.96 12.59 17.3 11.97L20.88 5.48C20.96 5.34 21 5.17 21 5C21 4.45 20.55 4 20 4H5.21L4.27 2H1ZM17 18C15.9 18 15.01 18.9 15.01 20C15.01 21.1 15.9 22 17 22C18.1 22 19 21.1 19 20C19 18.9 18.1 18 17 18Z"
              fill="currentColor"/>
    </g>
    <defs>
        <clipPath id="clip0_344_3390">
            <rect width="24" height="24" fill="currentColor"/>
        </clipPath>
    </defs>
</svg>
`;var kZ=lt('<div style="color:var(--rc-color-gray-text-dark);"><!></div>');function wZ(t){var e=kZ(),r=Le(e);du(r,()=>bZ),ke(t,e)}const SZ=`<svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor"
     xmlns="http://www.w3.org/2000/svg">
    <path d="M18 8H17V6C17 3.24 14.76 1 12 1C9.24 1 7 3.24 7 6V8H6C4.9 8 4 8.9 4 10V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V10C20 8.9 19.1 8 18 8ZM12 17C10.9 17 10 16.1 10 15C10 13.9 10.9 13 12 13C13.1 13 14 13.9 14 15C14 16.1 13.1 17 12 17ZM15.1 8H8.9V6C8.9 4.29 10.29 2.9 12 2.9C13.71 2.9 15.1 4.29 15.1 6V8Z"
          fill="currentColor"/>
</svg>
`;var EZ=lt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-wgufvv"><!></div>');const TZ={hash:"svelte-wgufvv",code:"div.svelte-wgufvv {height:24px;width:24px;}"};function CZ(t){zt(t,TZ);var e=EZ(),r=Le(e);du(r,()=>SZ),ke(t,e)}const xZ=`<svg viewBox="0 0 124 124" fill="var(--rc-color-grey-text-dark)" xmlns="http://www.w3.org/2000/svg">
    <circle cx="62" cy="62" r="62" fill="var(--rc-color-grey-text-dark)" opacity="0.2"/>
    <rect x="44.1116" y="56" width="27.5" height="11" transform="rotate(45 44.1116 56)" fill="var(--rc-color-grey-text-dark)"/>
    <rect x="79.1133" y="44.334" width="11" height="44" transform="rotate(45 79.1133 44.334)" fill="var(--rc-color-grey-text-dark)"/>
</svg>
`;var PZ=lt('<div style="color:var(--rc-color-primary)"><!></div>');function LU(t){var e=PZ(),r=Le(e);du(r,()=>xZ),ke(t,e)}var AZ=Jo('<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z" class="arrow-fill svelte-1jpfelf" fill-opacity="0.7"></path></svg>');const RZ={hash:"svelte-1jpfelf",code:".arrow-fill.svelte-1jpfelf {fill:var(--arrow-fill-color, var(--rc-color-grey-text-dark));}"};function DZ(t){zt(t,RZ);var e=AZ();ke(t,e)}const OZ={cart:wZ,error:rU,lock:CZ,success:LU,back:_Z,info:IU,close:DZ,"chevron-left":dv,"chevron-right":dv,"chevron-up":dv,"chevron-down":dv};function Bm(t,e){Wt(e,!0);const r=OZ[e.name];let n=sr(Vt({}));if(e.name.startsWith("chevron")){const a=e.name.split("-")[1];pt(n,Vt({direction:a}))}r(t,Fc(()=>$(n))),Kt()}var NZ=lt('<span class="rc-sandbox-only-error svelte-1d8gf9n"><!></span> <br> <br>',1),IZ=lt('<!> <a class="svelte-1d8gf9n"> </a>.',1),MZ=lt("<!> <!>",1);const jZ={hash:"svelte-1d8gf9n",code:"a.svelte-1d8gf9n {color:var(--rc-color-grey-text-dark);}.rc-sandbox-only-error.svelte-1d8gf9n {font-weight:bold;}"};function LZ(t,e){Wt(e,!0),zt(t,jZ);const r=Aa(),n=()=>ha(i,"$translator",r),a=ze(()=>e.lastError??new on(Hr.UnknownError,"Unknown error without state set.")),i=Jn(Bi),o=ze(()=>$(a).errorCode===Hr.StripeTaxNotActive||$(a).errorCode===Hr.StripeInvalidTaxOriginAddress||$(a).errorCode===Hr.StripeMissingRequiredPermission);_s(()=>{tr.errorLog(`Displayed error: ${Hr[$(a).errorCode]}. Message: ${$(a).message??"None"}. Underlying error: ${$(a).underlyingErrorMessage??"None"}`)});function c(){return $(a).errorCode===Hr.AlreadyPurchasedError?n().translate(Ot.ErrorPageCloseButtonTitle,{appName:e.appName??"App"}):$(o)?n().translate(Ot.ErrorButtonClose):n().translate(Ot.ErrorButtonTryAgain)}function u(){switch($(a).errorCode){case Hr.AlreadyPurchasedError:return e.productDetails.productType===ed.Subscription?n().translate(Ot.ErrorPageErrorTitleAlreadySubscribed,{productTitle:e.productDetails.title}):n().translate(Ot.ErrorPageErrorTitleAlreadyPurchased,{productTitle:e.productDetails.title});case Hr.StripeTaxNotActive:return n().translate(Ot.ErrorPageErrorTitleStripeTaxNotActive);case Hr.StripeInvalidTaxOriginAddress:return n().translate(Ot.ErrorPageErrorTitleStripeInvalidTaxOriginAddress);case Hr.StripeMissingRequiredPermission:return n().translate(Ot.ErrorPageErrorTitleStripeMissingRequiredPermission);default:return n().translate(Ot.ErrorPageErrorTitleOtherErrors)}}function d(){const w=$(a).getErrorCode();switch($(a).errorCode){case Hr.ErrorSettingUpPurchase:return n().translate(Ot.ErrorPageErrorMessageErrorSettingUpPurchase,{errorCode:w});case Hr.ErrorChargingPayment:return n().translate(Ot.ErrorPageErrorMessageErrorChargingPayment,{errorCode:w});case Hr.AlreadyPurchasedError:return e.productDetails.productType===ed.Subscription?n().translate(Ot.ErrorPageErrorMessageAlreadySubscribed,{errorCode:w}):n().translate(Ot.ErrorPageErrorMessageAlreadyPurchased,{errorCode:w});case Hr.StripeTaxNotActive:return n().translate(Ot.ErrorPageErrorMessageStripeTaxNotActive,{errorCode:w});case Hr.StripeInvalidTaxOriginAddress:return n().translate(Ot.ErrorPageErrorMessageStripeInvalidTaxOriginAddress,{errorCode:w});case Hr.StripeMissingRequiredPermission:return n().translate(Ot.ErrorPageErrorMessageStripeMissingRequiredPermission,{errorCode:w});case Hr.NetworkError:return n().translate(Ot.ErrorPageErrorMessageNetworkError,{errorCode:w});default:return n().translate(Ot.ErrorPageErrorMessageUnknownError,{errorCode:w})}}function f(){return $(a).errorCode===Hr.AlreadyPurchasedError?Ot.ErrorPageTroubleAccessing:Ot.ErrorPageIfErrorPersists}function h(){return $(a).errorCode===Hr.AlreadyPurchasedError?"success":"error"}var m=ze(u),_=ze(c);eP(t,{get title(){return $(m)},get onDismiss(){return e.onDismiss},type:"error",get closeButtonTitle(){return $(_)},icon:w=>{var b=ze(h);Bm(w,{get name(){return $(b)}})},message:w=>{var b=MZ(),E=Xt(b);{var T=C=>{var O=NZ(),I=Xt(O),x=Le(I);si(x,{get key(){return Ot.ErrorPageErrorMessageOnlyInSandbox}}),ke(C,O)};xt(E,C=>{$(o)&&C(T)})}var R=kt(E);mt(()=>hr(R,` ${d()??""} `));var P=kt(R);{var A=C=>{var O=IZ(),I=Xt(O),x=ze(f);si(I,{get key(){return $(x)}});var D=kt(I,2),N=Le(D);mt(()=>{Ut(D,"href",`mailto:${e.supportEmail??""}`),hr(N,e.supportEmail)}),ke(C,O)};xt(P,C=>{!$(o)&&e.supportEmail&&C(A)})}ke(w,b)},$$slots:{icon:!0,message:!0}}),Kt()}function BZ(t,e){Wt(e,!1);const r=Aa(),n=()=>ha(i,"$translator",r);let a=It(e,"onContinue",8);const i=Jn(Bi),o=Jn(Qx);function c(){o.trackSDKEvent({eventName:gi.CheckoutPurchaseSuccessfulDismiss,properties:{ui_element:"go_back_to_app"}}),a()()}_s(()=>{o.trackSDKEvent({eventName:gi.CheckoutPurchaseSuccessfulImpression})}),ws();var u=If(()=>n().translate(Ot.SuccessPagePurchaseSuccessful)),d=If(()=>n().translate(Ot.SuccessPageButtonClose));eP(t,{type:"success",get title(){return $(u)},onDismiss:c,get closeButtonTitle(){return $(d)},icon:f=>{LU(f)},$$slots:{icon:!0}}),Kt()}function UZ(t){wU(t)}var FZ=lt('<div class="rcb-pricing-dropdown svelte-fgrbnh"><div class="rcb-pricing-dropdown-header svelte-fgrbnh" tabindex="0" role="button"><!> <span class="rcb-pricing-dropdown-toggle svelte-fgrbnh"><!></span></div> <div class="rcb-pricing-dropdown-content svelte-fgrbnh"><div class="rcb-pricing-dropdown-content-inner svelte-fgrbnh"><!></div></div></div>');const qZ={hash:"svelte-fgrbnh",code:`.rcb-pricing-dropdown.svelte-fgrbnh {width:100%;overflow:hidden;display:flex;flex-direction:column;}.rcb-pricing-dropdown-header.svelte-fgrbnh {padding-top:var(--rc-spacing-gapSmall-mobile);padding-bottom:var(--rc-spacing-gapSmall-mobile);padding-left:var(--rc-spacing-gapLarge-mobile);padding-right:var(--rc-spacing-gapMedium-mobile);color:var(--rc-color-grey-text-light);border-radius:var(--rc-shape-input-button-border-radius);cursor:pointer;display:inline-flex;align-items:center;background-color:var(--rc-color-grey-ui-light);width:fit-content;user-select:none;}.rcb-pricing-dropdown-toggle.svelte-fgrbnh {display:flex;align-items:center;margin-left:var(--rc-spacing-gapSmall-mobile);}.rcb-pricing-dropdown-content.svelte-fgrbnh {display:flex;flex-direction:column;overflow:hidden;}

  @container layout-query-container (width < 768px) {.rcb-pricing-dropdown-content.svelte-fgrbnh {max-height:1000px; /* Set a large max-height for animation */transition:max-height 0.2s ease-in-out;}.rcb-pricing-dropdown-content.collapsed.svelte-fgrbnh {max-height:0;}.rcb-pricing-dropdown-content-inner.svelte-fgrbnh {padding-top:var(--rc-spacing-gapMedium-mobile);}
  }

  @container layout-query-container (width >= 768px) {.rcb-pricing-dropdown-header.svelte-fgrbnh {display:none;}
  }`};function zZ(t,e){Wt(e,!1),zt(t,qZ);const r=Aa(),n=()=>ha(o,"$translator",r);let a=It(e,"isExpanded",12,!0),i=It(e,"children",8);const o=Jn(Bi);function c(){a(!a())}ws();var u=FZ(),d=Le(u),f=Le(d);Pr(f,{size:"label-default",children:(R,P)=>{var A=wr(),C=Xt(A);{var O=x=>{var D=Ur();mt(()=>hr(D,n().translate(Ot.PricingDropdownHideDetails))),ke(x,D)},I=x=>{var D=Ur();mt(()=>hr(D,n().translate(Ot.PricingDropdownShowDetails))),ke(x,D)};xt(C,x=>{a()?x(O):x(I,!1)})}ke(R,A)},$$slots:{default:!0}});var h=kt(f,2),m=Le(h);{var _=R=>{Bm(R,{name:"chevron-up"})},w=R=>{Bm(R,{name:"chevron-down"})};xt(m,R=>{a()?R(_):R(w,!1)})}var b=kt(d,2),E=Le(b),T=Le(E);Dn(T,()=>i()??Ar),mt(()=>{Ut(d,"aria-expanded",a()),jc(b,"collapsed",!a())}),Mo("click",d,c),Mo("keydown",d,R=>R.key==="Enter"||R.key===" "?c():null),ke(t,u),Kt()}var $Z=lt('<div class="rcb-pricing-table-value-loading svelte-erv89n"><!></div>');const VZ={hash:"svelte-erv89n",code:`.rcb-pricing-table-value-loading.svelte-erv89n {color:transparent;
    animation: svelte-erv89n-rcb-pricing-table-value-loading 1.5s ease-in-out 0s infinite
      normal none running;cursor:progress;background-color:var(--rc-color-grey-text-dark);user-select:none;border-radius:var(--rc-shape-input-border-radius);}

  @keyframes svelte-erv89n-rcb-pricing-table-value-loading {
    0%,
    100% {
      opacity: 0.5;
    }
    50% {
      opacity: 0.3;
    }
  }`};function HZ(t,e){Wt(e,!1),zt(t,VZ);let r=It(e,"children",8);ws();var n=$Z(),a=Le(n);Dn(a,()=>r()??Ar),ke(t,n),Kt()}var GZ=lt('<div class="rcb-pricing-table-row svelte-i12130" data-testid="tax-loading-skeleton"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div>'),WZ=lt('<div class="rcb-pricing-table-row svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"> </div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div>'),KZ=lt('<div class="rcb-pricing-table-row svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div>'),YZ=lt('<div class="rcb-pricing-table-row svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div> <!> <div class="rcb-pricing-table-separator svelte-i12130"></div>',1),XZ=lt('<div class="rcb-pricing-table-row svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div>'),JZ=lt('<div class="rcb-pricing-table svelte-i12130"><!> <!> <div class="rcb-pricing-table-row rcb-header svelte-i12130"><div class="rcb-pricing-table-header svelte-i12130"><!></div> <div class="rcb-pricing-table-value svelte-i12130"><!></div></div></div>');const QZ={hash:"svelte-i12130",code:`.rcb-pricing-table.svelte-i12130 {display:flex;flex-direction:column;gap:var(--rc-spacing-gapSmall-mobile);}.rcb-pricing-table-row.svelte-i12130 {display:flex;flex-direction:row;align-items:center;justify-content:space-between;}.rcb-pricing-table-separator.svelte-i12130 {height:1px;background-color:var(--rc-color-grey-ui-dark);}.rcb-pricing-table-row.svelte-i12130 > .rcb-pricing-table-header:where(.svelte-i12130) {color:var(--rc-color-grey-text-light);}.rcb-pricing-table-row.svelte-i12130 > .rcb-pricing-table-value:where(.svelte-i12130) {color:var(--rc-color-grey-text-dark);}.rcb-pricing-table-row.svelte-i12130:last-child > .rcb-pricing-table-header:where(.svelte-i12130),
  .rcb-pricing-table-row.svelte-i12130:last-child > .rcb-pricing-table-value:where(.svelte-i12130) {color:var(--rc-color-grey-text-dark);}

  @container layout-query-container (width >= 768px) {.rcb-pricing-table-separator.svelte-i12130 {display:none;}.rcb-pricing-table.svelte-i12130 {gap:var(--rc-spacing-gapSmall-desktop);}.rcb-pricing-table-row.svelte-i12130 > .rcb-pricing-table-header:where(.svelte-i12130),
    .rcb-pricing-table-row.svelte-i12130 > .rcb-pricing-table-value:where(.svelte-i12130) {color:var(--rc-color-grey-text-light);}
  }`};function ZZ(t,e){var r;Wt(e,!0),zt(t,QZ);const n=Aa(),a=()=>ha(c,"$translator",n),i=_=>{var w=JZ(),b=Le(w);{var E=x=>{var D=YZ(),N=Xt(D),L=Le(N),j=Le(L);Pr(j,{size:"body-small",children:(Q,ie)=>{var G=Ur();mt(()=>hr(G,a().translate(Ot.PricingTotalExcludingTax))),ke(Q,G)},$$slots:{default:!0}});var q=kt(L,2),U=Le(q);Pr(U,{size:"body-small",children:(Q,ie)=>{var G=Ur();mt(()=>hr(G,a().formatPrice(e.priceBreakdown.totalExcludingTaxInMicros,e.priceBreakdown.currency))),ke(Q,G)},$$slots:{default:!0}});var W=kt(N,2);{var F=Q=>{var ie=GZ(),G=Le(ie),B=Le(G);Pr(B,{size:"body-small",children:(te,me)=>{var ue=Ur();mt(()=>hr(ue,a().translate(Ot.PricingTableTax))),ke(te,ue)},$$slots:{default:!0}});var K=kt(G,2),ae=Le(K);Pr(ae,{size:"body-small",children:(te,me)=>{HZ(te,{children:(ue,Ae)=>{var He=Ur();mt(()=>hr(He,a().formatPrice(1234e4,e.priceBreakdown.currency))),ke(ue,He)},$$slots:{default:!0}})},$$slots:{default:!0}}),ke(Q,ie)},Y=Q=>{var ie=wr(),G=Xt(ie);{var B=ae=>{var te=WZ(),me=Le(te),ue=Le(me);mt(()=>hr(ue,a().translate(Ot.PricingTableTax)));var Ae=kt(me,2),He=Le(Ae);Pr(He,{size:"body-small",children:(ce,xe)=>{var re=Ur();mt(()=>hr(re,a().translate(Ot.PricingTableEnterBillingAddressToCalculate))),ke(ce,re)},$$slots:{default:!0}}),ke(ae,te)},K=ae=>{var te=wr(),me=Xt(te);{var ue=Ae=>{var He=wr(),ce=Xt(He);sp(ce,17,()=>e.priceBreakdown.taxBreakdown,ip,(xe,re)=>{var H=KZ(),he=Le(H),Re=Le(he);Pr(Re,{size:"body-small",children:(ct,$e)=>{var tt=Ur();mt(()=>hr(tt,$(re).display_name)),ke(ct,tt)},$$slots:{default:!0}});var fe=kt(he,2),Ie=Le(fe);Pr(Ie,{size:"body-small",children:(ct,$e)=>{var tt=Ur();mt(()=>hr(tt,a().formatPrice($(re).tax_amount_in_micros,e.priceBreakdown.currency))),ke(ct,tt)},$$slots:{default:!0}}),ke(xe,H)}),ke(Ae,He)};xt(me,Ae=>{e.priceBreakdown.taxBreakdown!==null&&Ae(ue)},!0)}ke(ae,te)};xt(G,ae=>{e.priceBreakdown.taxCalculationStatus==="pending"?ae(B):ae(K,!1)},!0)}ke(Q,ie)};xt(W,Q=>{e.priceBreakdown.taxCalculationStatus==="loading"?Q(F):Q(Y,!1)})}ke(x,D)};xt(b,x=>{$(u)&&x(E)})}var T=kt(b,2);{var R=x=>{var D=XZ(),N=Le(D),L=Le(N);Pr(L,{size:"body-small",children:(U,W)=>{var F=Ur();mt(()=>hr(F,a().translate(Ot.PricingTableTrialEnds,{formattedTrialEndDate:a().translateDate($(o),{dateStyle:"medium"})}))),ke(U,F)},$$slots:{default:!0}});var j=kt(N,2),q=Le(j);Pr(q,{size:"body-small",children:(U,W)=>{var F=Ur();mt(()=>hr(F,a().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency))),ke(U,F)},$$slots:{default:!0}}),ke(x,D)};xt(T,x=>{$(o)&&x(R)})}var P=kt(T,2),A=Le(P),C=Le(A);Pr(C,{size:"body-small",children:(x,D)=>{var N=Ur();mt(()=>hr(N,a().translate(Ot.PricingTableTotalDueToday))),ke(x,N)},$$slots:{default:!0}});var O=kt(A,2),I=Le(O);Pr(I,{size:"body-small",children:(x,D)=>{var N=wr(),L=Xt(N);{var j=U=>{var W=Ur();mt(()=>hr(W,a().formatPrice(0,e.priceBreakdown.currency))),ke(U,W)},q=U=>{var W=Ur();mt(()=>hr(W,a().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency))),ke(U,W)};xt(L,U=>{$(o)?U(j):U(q,!1)})}ke(x,N)},$$slots:{default:!0}}),ke(_,w)};let o=sr(null);(r=e.trialPhase)!=null&&r.period&&pt(o,Vt(CT(new Date,e.trialPhase.period,!0)));const c=Jn(Bi),u=ze(()=>e.priceBreakdown.taxCalculationStatus!=="unavailable"&&e.priceBreakdown.taxCalculationStatus!=="disabled"&&e.priceBreakdown.taxBreakdown&&e.priceBreakdown.taxBreakdown.length>0);var d=wr(),f=Xt(d);{var h=_=>{zZ(_,{children:(w,b)=>{i(w)},$$slots:{default:!0}})},m=_=>{i(_)};xt(f,_=>{$(u)?_(h):_(m,!1)})}ke(t,d),Kt()}var eee=lt('<div class="rcb-subscribe-to svelte-4fnm8t"><!></div>'),tee=lt('<span class="rcb-product-description svelte-4fnm8t"><!></span>'),ree=lt('<div class="rcb-pricing-info-header svelte-4fnm8t"><!> <div class="rcb-product-title svelte-4fnm8t"><!></div> <!></div>');const nee={hash:"svelte-4fnm8t",code:`.rcb-pricing-info-header.svelte-4fnm8t {display:flex;flex-direction:column;gap:var(--rc-spacing-gapMedium-mobile);}.rcb-product-title.svelte-4fnm8t {color:var(--rc-color-grey-text-dark);}.rcb-product-description.svelte-4fnm8t {color:var(--rc-color-grey-text-light);}.rcb-subscribe-to.svelte-4fnm8t {display:none;}

  @container layout-query-container (width >= 768px) {.rcb-subscribe-to.svelte-4fnm8t {display:block;}.rcb-pricing-info-header.svelte-4fnm8t {display:flex;flex-direction:column;gap:var(--rc-spacing-gapMedium-desktop);}
  }`};function aee(t,e){Wt(e,!1),zt(t,nee);let r=It(e,"productDetails",8),n=It(e,"showProductDescription",8);const a=r().productType===ed.Subscription;ws();var i=ree(),o=Le(i);{var c=m=>{var _=eee(),w=Le(_);Pr(w,{size:"body-base",children:(b,E)=>{var T=If(()=>({productTitle:r().title}));si(b,{get key(){return Ot.ProductInfoSubscribeTo},get variables(){return $(T)}})},$$slots:{default:!0}}),ke(m,_)};xt(o,m=>{a&&m(c)})}var u=kt(o,2),d=Le(u);Pr(d,{size:"heading-lg",branded:!0,children:(m,_)=>{var w=If(()=>({productTitle:r().title}));si(m,{get key(){return Ot.ProductInfoProductTitle},get variables(){return $(w)}})},$$slots:{default:!0}});var f=kt(u,2);{var h=m=>{var _=tee(),w=Le(_);Pr(w,{size:"body-small",children:(b,E)=>{var T=If(()=>({productDescription:r().description}));si(b,{get key(){return Ot.ProductInfoProductDescription},get variables(){return $(T)}})},$$slots:{default:!0}}),ke(m,_)};xt(f,m=>{n()&&r().description&&m(h)})}ke(t,i),Kt()}var iee=lt("<div><!></div>"),see=lt("<div><!> <!></div>"),oee=lt('<div class="rcb-product-price-container svelte-509gz3"><!> <!> <div><!> <!> <!></div></div>');const cee={hash:"svelte-509gz3",code:".rcb-product-price-container.svelte-509gz3 {display:flex;flex-direction:column;justify-content:space-between;gap:var(--rc-spacing-gapMedium-mobile);color:var(--rc-color-grey-text-dark);}"};function lee(t,e){Wt(e,!0),zt(t,cee);const r=Aa(),n=()=>ha(a,"$translator",r),a=Jn(Bi),i=ze(()=>{var N;return(N=e.introPricePhase)!=null&&N.period&&n().translatePeriod(e.introPricePhase.period.number*e.introPricePhase.cycleCount,e.introPricePhase.period.unit)||""}),o=ze(()=>"heading-lg"),c=ze(()=>{var N;return(N=e.trialPhase)!=null&&N.periodDuration?"heading-md":"heading-lg"}),u=ze(()=>{var N,L;return(N=e.trialPhase)!=null&&N.periodDuration||(L=e.introPricePhase)!=null&&L.periodDuration?"heading-md":"heading-lg"}),d=ze(()=>{var N;return(N=e.trialPhase)==null?void 0:N.periodDuration}),f=ze(()=>{var N;return(N=e.introPricePhase)==null?void 0:N.periodDuration}),h=ze(()=>{var N;return((N=e.introPricePhase)==null?void 0:N.cycleCount)==1}),m=ze(()=>{var N,L;return n().formatPrice($(f)?((L=(N=e.basePhase)==null?void 0:N.price)==null?void 0:L.amountMicros)??0:e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency)}),_=ze(()=>n().formatPrice(e.priceBreakdown.totalAmountInMicros,e.priceBreakdown.currency));var w=oee(),b=Le(w);{var E=N=>{var L=iee(),j=Le(L);Pr(j,{get size(){return $(o)},children:(q,U)=>{var W=ze(()=>({trialDuration:gY(e.trialPhase.periodDuration,n())}));si(q,{get key(){return Ot.ProductInfoFreeTrialDuration},get variables(){return $(W)}})},$$slots:{default:!0}}),ke(N,L)};xt(b,N=>{var L;(L=e.trialPhase)!=null&&L.periodDuration&&N(E)})}var T=kt(b,2);{var R=N=>{var L=see(),j=Le(L);Pr(j,{get size(){return $(c)},children:(F,Y)=>{var Q=ze(()=>$(d)?Ot.ProductInfoIntroPricePhaseAfterTrial:Ot.ProductInfoIntroPricePhase),ie=ze(()=>({introPriceDuration:$(i),introPrice:$(_)}));si(F,{get key(){return $(Q)},get variables(){return $(ie)}})},$$slots:{default:!0}});var q=kt(j,2);{var U=F=>{Pr(F,{size:"body-small",children:(Y,Q)=>{si(Y,{get key(){return Ot.ProductInfoIntroPricePhasePaidOnce}})},$$slots:{default:!0}})},W=F=>{var Y=wr(),Q=Xt(Y);{var ie=G=>{Pr(G,{size:"body-small",children:(B,K)=>{var ae=Ur();mt(()=>hr(ae,n().translatePeriodFrequency(e.introPricePhase.period.number,e.introPricePhase.period.unit,{useMultipleWords:!0}))),ke(B,ae)},$$slots:{default:!0}})};xt(Q,G=>{e.introPricePhase.period&&G(ie)},!0)}ke(F,Y)};xt(q,F=>{$(h)?F(U):F(W,!1)})}ke(N,L)};xt(T,N=>{var L;(L=e.introPricePhase)!=null&&L.periodDuration&&N(R)})}var P=kt(T,2),A=Le(P);Pr(A,{get size(){return $(u)},children:(N,L)=>{var j=Ur();mt(()=>hr(j,$(m))),ke(N,j)},$$slots:{default:!0}});var C=kt(A,2);{var O=N=>{Pr(N,{size:"body-small",children:(L,j)=>{var q=Ur();mt(()=>hr(q,n().translatePeriodFrequency(e.basePhase.period.number,e.basePhase.period.unit,{useMultipleWords:!0}))),ke(L,q)},$$slots:{default:!0}})};xt(C,N=>{var L;(L=e.basePhase)!=null&&L.period&&N(O)})}var I=kt(C,2);{var x=N=>{Pr(N,{size:"body-small",children:(L,j)=>{si(L,{get key(){return Ot.ProductInfoAfter}})},$$slots:{default:!0}})},D=N=>{var L=wr(),j=Xt(L);{var q=U=>{Pr(U,{size:"body-small",children:(W,F)=>{si(W,{get key(){return Ot.ProductInfoAfterTrial}})},$$slots:{default:!0}})};xt(j,U=>{$(d)&&U(q)},!0)}ke(N,L)};xt(I,N=>{$(f)?N(x):N(D,!1)})}ke(t,w),Kt()}var uee=lt('<div class="rcb-pricing-info svelte-18guro7"><div class="rcb-pricing-info-header svelte-18guro7"><!> <!></div> <!></div>');const dee={hash:"svelte-18guro7",code:`.rcb-pricing-info.svelte-18guro7 {display:flex;flex-direction:column;user-select:none;gap:var(--rc-spacing-gapXXLarge-mobile);}.rcb-pricing-info-header.svelte-18guro7 {display:flex;flex-direction:column;gap:var(--rc-spacing-gapLarge-mobile);}

  @container layout-query-container (width >= 768px) {.rcb-pricing-info.svelte-18guro7 {gap:var(--rc-spacing-gapXXXLarge-desktop);}.rcb-pricing-info-header.svelte-18guro7 {gap:var(--rc-spacing-gapLarge-desktop);}
  }`};function fee(t,e){zt(t,dee);let r=It(e,"productDetails",8),n=It(e,"purchaseOption",8),a=It(e,"showProductDescription",8),i=It(e,"priceBreakdown",8);const o=n(),c=o?.base,u=o?.trial,d=o?.introPrice;var f=uee(),h=Le(f),m=Le(h);aee(m,{get productDetails(){return r()},get showProductDescription(){return a()}});var _=kt(m,2);lee(_,{get priceBreakdown(){return i()},basePhase:c,trialPhase:u,introPricePhase:d});var w=kt(h,2);ZZ(w,{get priceBreakdown(){return i()},trialPhase:u}),ke(t,f)}const Gh=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;var pee=lt('<div class="rcb-ui-container svelte-1h6xr8z"><!></div>');const hee={hash:"svelte-1h6xr8z",code:`.rcb-ui-container.svelte-1h6xr8z {display:flex;flex-direction:column;inset:0;color-scheme:none;line-height:1.5em;font-family:-apple-system,
      BlinkMacSystemFont,
      avenir next,
      avenir,
      segoe ui,
      helvetica neue,
      helvetica,
      Cantarell,
      Ubuntu,
      roboto,
      noto,
      arial,
      sans-serif;overflow-x:hidden;overflow-y:auto;}.rcb-ui-container.fullscreen.svelte-1h6xr8z {position:fixed;top:0;left:0;right:0;bottom:0;overscroll-behavior:none;z-index:1000001;}.rcb-ui-container.inside.svelte-1h6xr8z {position:relative;width:100%;z-index:unset;height:100%;top:0;left:0;}`};function mee(t,e){Wt(e,!0),zt(t,hee);const r=It(e,"brandingAppearance",3,void 0),n=It(e,"brandFontConfig",3,void 0),a=It(e,"isInElement",3,!1),i=ze(()=>new Lm(r()).getTextStyleVars(n())),o=ze(()=>new Lm(r()).spacingStyleVars),c=ze(()=>[$(i),$(o)].join("; ")),u=ze(()=>{var m;return(m=n())!=null&&m.font_url?Gh(n().font_url):null}),d=async m=>{try{const _=new FontFace(TU,`url(${m})`);await _.load(),document.fonts.add(_)}catch{}};ap(()=>{$(u)&&d($(u))});var f=pee(),h=Le(f);Dn(h,()=>e.children??Ar),mt(()=>{Ut(f,"style",$(c)),jc(f,"fullscreen",!a()),jc(f,"inside",a())}),ke(t,f),Kt()}var gee=lt('<div id="layout-query-container" class="svelte-1x4ow5d"><div class="rcb-ui-layout svelte-1x4ow5d"><!></div></div>');const yee={hash:"svelte-1x4ow5d",code:`#layout-query-container.svelte-1x4ow5d {width:100%;height:100%;container-type:size;container-name:layout-query-container;overflow-y:auto;overscroll-behavior:none;}.rcb-ui-layout.svelte-1x4ow5d {width:100%;min-height:100%;display:flex;box-sizing:border-box;flex-direction:column;overflow-y:auto;overscroll-behavior:none;}

  @container layout-query-container (width < 768px) {.rcb-ui-layout.svelte-1x4ow5d {flex-grow:1;}
  }

  @container layout-query-container (width >= 768px) {.rcb-ui-layout.svelte-1x4ow5d {flex-direction:row;}
  }`};function vee(t,e){Wt(e,!1),zt(t,yee);let r=It(e,"style",8,""),n=It(e,"children",8);ws();var a=gee(),i=Le(a),o=Le(i);Dn(o,()=>n()??Ar),mt(()=>Ut(i,"style",r())),ke(t,a),Kt()}const _ee=t=>t;function bee(t){const e=t-1;return e*e*e+1}function YO(t){const e=typeof t=="string"&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[t,"px"]}function kee(t,{delay:e=0,duration:r=400,easing:n=_ee}={}){const a=+getComputedStyle(t).opacity;return{delay:e,duration:r,easing:n,css:i=>`opacity: ${i*a}`}}function wee(t,{delay:e=0,duration:r=400,easing:n=bee,x:a=0,y:i=0,opacity:o=0}={}){const c=getComputedStyle(t),u=+c.opacity,d=c.transform==="none"?"":c.transform,f=u*(1-o),[h,m]=YO(a),[_,w]=YO(i);return{delay:e,duration:r,easing:n,css:(b,E)=>`
			transform: ${d} translate(${(1-b)*h}${m}, ${(1-b)*_}${w});
			opacity: ${u-f*E}`}}var See=lt('<div><div class="layout-wrapper svelte-1w6qvx7"><div><!></div></div></div>');const Eee={hash:"svelte-1w6qvx7",code:`.layout-wrapper-outer.svelte-1w6qvx7 {flex:1;display:flex;background-color:var(--rc-color-background);}.layout-wrapper-outer.rcb-navbar.svelte-1w6qvx7 {justify-content:flex-end;}.layout-wrapper.svelte-1w6qvx7 {width:100%;}.layout-content.svelte-1w6qvx7 {box-sizing:border-box;background-color:var(--rc-color-background);color:var(--rc-color-grey-text-dark);display:flex;flex-direction:column;}.layout-content.rcb-navbar.svelte-1w6qvx7 {display:flex;flex-direction:column;gap:var(--rc-spacing-gapXLarge-mobile);}

  @container layout-query-container (width < 768px) {.layout-wrapper.svelte-1w6qvx7 {width:100%;min-width:300px;display:flex;flex-grow:1;}.layout-content.svelte-1w6qvx7 {flex-grow:1;height:100%;}.layout-content.rcb-navbar.svelte-1w6qvx7 {padding-bottom:var(--rc-spacing-outerPadding-mobile);}.layout-content.rcb-main-block.svelte-1w6qvx7 {padding:var(--rc-spacing-outerPadding-mobile);}
  }

  @container layout-query-container (width >= 768px) {.layout-wrapper.svelte-1w6qvx7 {flex-basis:544px;}.layout-content.rcb-main-block.svelte-1w6qvx7 {padding-left:var(--rc-spacing-outerPadding-desktop);padding-right:var(--rc-spacing-outerPadding-desktop);}.layout-content.rcb-navbar.svelte-1w6qvx7 {gap:var(--rc-spacing-gapXXLarge-desktop);}.layout-wrapper-outer.svelte-1w6qvx7 {padding-top:var(--rc-spacing-outerPaddingTop-desktop);padding-bottom:var(--rc-spacing-outerPadding-desktop);}
  }`};function BU(t,e){Wt(e,!0),zt(t,Eee);const r=`rcb-${e.location}`;var n=See();Jl(n,`layout-wrapper-outer ${r??""} svelte-1w6qvx7`);var a=Le(n),i=Le(a);Jl(i,`layout-content ${r??""} svelte-1w6qvx7`);var o=Le(i);Dn(o,()=>e.children??Ar),XB(3,i,()=>kee,()=>({duration:500,delay:50})),ke(t,n),Kt()}var Tee=lt('<div class="navbar-body svelte-jz90ay"><!></div>'),Cee=lt('<div class="navbar-header svelte-jz90ay"><!></div> <!>',1),xee=lt('<div class="rcb-ui-navbar svelte-jz90ay"><!></div>');const Pee={hash:"svelte-jz90ay",code:`.rcb-ui-navbar.svelte-jz90ay {width:100%;max-width:none;flex-shrink:0;background-color:var(--rc-color-background);}

  @container layout-query-container (width < 768px) {.navbar-body.svelte-jz90ay {padding-left:var(--rc-spacing-outerPadding-mobile);padding-right:var(--rc-spacing-outerPadding-mobile);}
  }

  @container layout-query-container (width >= 768px) {.rcb-ui-navbar.svelte-jz90ay {width:50vw;display:flex;justify-content:flex-end;}.navbar-header.svelte-jz90ay {padding-left:var(--rc-spacing-outerPadding-desktop);padding-right:var(--rc-spacing-outerPadding-desktop);}.navbar-body.svelte-jz90ay {padding-left:var(--rc-spacing-outerPadding-desktop);padding-right:var(--rc-spacing-outerPadding-desktop);}
  }`};function Aee(t,e){Wt(e,!0),zt(t,Pee);const r=It(e,"brandingAppearance",3,void 0),n=ze(()=>new Lm(r()).productInfoStyleVars);var a=xee(),i=Le(a);BU(i,{location:"navbar",children:(o,c)=>{var u=Cee(),d=Xt(u),f=Le(d);Dn(f,()=>e.headerContent??Ar);var h=kt(d,2);{var m=_=>{var w=Tee(),b=Le(w);Dn(b,()=>e.bodyContent??Ar),ke(_,w)};xt(h,_=>{e.bodyContent&&_(m)})}ke(o,u)},$$slots:{default:!0}}),mt(()=>Ut(a,"style",$(n))),ke(t,a),Kt()}var Ree=lt('<button class="rcb-close-button svelte-nssttr" data-testid="close-button"><!></button>');const Dee={hash:"svelte-nssttr",code:".rcb-close-button.svelte-nssttr {padding:10px;border:none;cursor:pointer;background-color:transparent;border-radius:50%;color:var(--rc-color-grey-text-dark);display:inline-flex;align-items:center;justify-content:center;width:fit-content;height:fit-content;}.rcb-close-button.svelte-nssttr:active {transition:outline 0.1s ease-in-out;outline:2px solid var(--rc-color-focus);}.rcb-close-button.svelte-nssttr:hover {color:var(--rc-color-grey-text-dark);}"};function UU(t,e){zt(t,Dee);var r=Ree(),n=Le(r);Bm(n,{name:"close"}),Mo("click",r,function(a){QB.call(this,e,a)}),ke(t,r)}const Oee=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none">
    <g clip-path="url(#clip0_6333_13826)">
    <rect opacity="0.2" width="12" height="12" rx="2.25" fill="black"/>
    <path fill-rule="evenodd" clip-rule="evenodd" d="M8.53206 2.06972C9.28201 2.17252 9.88339 2.78615 9.96146 3.52824L10.2298 6.07852C10.2893 6.64453 9.87503 7.12287 9.30441 7.14692C8.73379 7.17097 8.22294 6.73163 8.16339 6.16562L8.08036 5.37641L6.00414 7.35193C5.6039 7.73275 4.94623 7.70146 4.53518 7.28205C4.12413 6.86263 4.11537 6.2139 4.51561 5.83307L6.59182 3.85756L5.79425 3.74823C5.22225 3.66982 4.79448 3.15142 4.83881 2.59036C4.88313 2.02929 5.38276 1.63802 5.95476 1.71643L8.53206 2.06972Z" fill="black"/>
    </g>
    <defs>
    <clipPath id="clip0_6333_13826">
    <rect width="12" height="12" fill="white"/>
    </clipPath>
    </defs>
    </svg>
`;var Nee=lt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-5vi85d"><!></div>');const Iee={hash:"svelte-5vi85d",code:"div.svelte-5vi85d {height:12px;width:12px;}"};function Mee(t){zt(t,Iee);var e=Nee(),r=Le(e);du(r,()=>Oee),ke(t,e)}var jee=lt('<span class="rcb-sandbox-text svelte-18xxdea">SANDBOX</span>'),Lee=lt('<span class="rcb-sandbox-text svelte-18xxdea">Share feedback</span>'),Bee=lt('<a class="rcb-ui-sandbox-banner-link svelte-18xxdea" target="_blank"><!> <!></a>'),Uee=lt('<div class="rcb-ui-sandbox-banner svelte-18xxdea"><div class="rcb-sandbox-banner-spacer svelte-18xxdea"></div> <div class="rcb-sandbox-banner-title-wrapper svelte-18xxdea"><!></div> <div class="rcb-sandbox-banner-actions-wrapper svelte-18xxdea" style="--arrow-fill-color: black"><!> <!></div></div>');const Fee={hash:"svelte-18xxdea",code:`.rcb-ui-sandbox-banner.svelte-18xxdea {position:static;background-color:var(--rc-color-warning);color:black;padding:var(--rc-spacing-gapMedium-mobile) 0;display:flex;justify-content:space-between;align-items:center;height:24px;}.rcb-sandbox-text.svelte-18xxdea {font-weight:bold;color:black;line-height:2;}.rcb-sandbox-banner-spacer.svelte-18xxdea {flex:1;}.rcb-sandbox-banner-title-wrapper.svelte-18xxdea {flex:0;text-align:center;}

  @media (max-width: 768px) {.rcb-sandbox-banner-spacer.svelte-18xxdea {flex:0;}.rcb-sandbox-banner-title-wrapper.svelte-18xxdea {padding-left:var(--rc-spacing-gapXXLarge-mobile);}
  }.rcb-sandbox-banner-actions-wrapper.svelte-18xxdea {flex:1;display:flex;justify-content:flex-end;align-items:center;}.rcb-ui-sandbox-banner-link.svelte-18xxdea {display:flex;align-items:center;gap:var(--rc-spacing-gapSmall-mobile);line-height:12px;}`};function qee(t,e){Wt(e,!1),zt(t,Fee);let r=It(e,"style",8,""),n=It(e,"isInElement",8,!1),a=It(e,"brandingInfo",8,null),i=Ls(!0);function o(){tr.debugLog("closeBanner"),pt(i,!1)}ws();var c=wr(),u=Xt(c);{var d=f=>{var h=Uee(),m=kt(Le(h),2),_=Le(m);Pr(_,{size:"caption-default",children:(R,P)=>{var A=jee();ke(R,A)},$$slots:{default:!0}});var w=kt(m,2),b=Le(w);{var E=R=>{var P=Bee(),A=Le(P);Mee(A);var C=kt(A,2);Pr(C,{size:"caption-link",children:(O,I)=>{var x=Lee();ke(O,x)},$$slots:{default:!0}}),mt(()=>Ut(P,"href",a().sandbox_configuration.checkout_feedback_form_url)),ke(R,P)};xt(b,R=>{var P;(P=a())!=null&&P.sandbox_configuration&&R(E)})}var T=kt(b,2);UU(T,{$$events:{click:o}}),mt(()=>{Ut(h,"style",r()),jc(h,"isInElement",n())}),XB(2,h,()=>wee,()=>({y:-100,duration:300})),ke(f,h)};xt(u,f=>{$(i)&&f(d)})}ke(t,c),Kt()}var zee=lt('<div class="rcb-ui-main svelte-nr408n"><!></div>');const $ee={hash:"svelte-nr408n",code:".rcb-ui-main.svelte-nr408n {flex:1;display:flex;background-color:var(--rc-color-background);}"};function Vee(t,e){Wt(e,!0),zt(t,$ee);const r=ze(()=>new Lm(e.brandingAppearance).formStyleVars);var n=zee(),a=Le(n);BU(a,{location:"main-block",children:(i,o)=>{var c=wr(),u=Xt(c);Dn(u,()=>e.children??Ar),ke(i,c)},$$slots:{default:!0}}),mt(()=>Ut(n,"style",$(r))),ke(t,n),Kt()}var Hee=lt("<!> <!>",1),Gee=lt("<!> <!>",1);function Wee(t,e){Wt(e,!0);const r=ze(()=>{var i;return PU((i=e.brandingInfo)==null?void 0:i.appearance)??""});var n=ze(()=>{var i;return(i=e.brandingInfo)==null?void 0:i.appearance}),a=ze(()=>{var i;return(i=e.brandingInfo)==null?void 0:i.brand_font_config});mee(t,{get brandingAppearance(){return $(n)},get brandFontConfig(){return $(a)},get isInElement(){return e.isInElement},children:(i,o)=>{var c=Gee(),u=Xt(c);{var d=h=>{qee(h,{get style(){return $(r)},get isInElement(){return e.isInElement},get brandingInfo(){return e.brandingInfo}})};xt(u,h=>{e.isSandbox&&h(d)})}var f=kt(u,2);vee(f,{get style(){return $(r)},children:(h,m)=>{var _=Hee(),w=Xt(_);{var b=R=>{var P=ze(()=>{var A;return(A=e.brandingInfo)==null?void 0:A.appearance});Aee(R,{get brandingAppearance(){return $(P)},get headerContent(){return e.navbarHeaderContent},get bodyContent(){return e.navbarBodyContent}})};xt(w,R=>{(e.navbarHeaderContent||e.navbarBodyContent)&&R(b)})}var E=kt(w,2),T=ze(()=>{var R;return(R=e.brandingInfo)==null?void 0:R.appearance});Vee(E,{get brandingAppearance(){return $(T)},children:(R,P)=>{var A=wr(),C=Xt(A);Dn(C,()=>e.mainContent??Ar),ke(R,A)},$$slots:{default:!0}}),ke(h,_)},$$slots:{default:!0}}),ke(i,c)},$$slots:{default:!0}}),Kt()}var Kee=lt('<source type="image/webp">'),Yee=lt('<picture class="rcb-app-icon-picture-container svelte-el1u77"><!> <img class="rcb-app-icon svelte-el1u77" alt="App icon"></picture>'),Xee=lt('<div class="rcb-app-icon loading svelte-el1u77"></div>');const Jee={hash:"svelte-el1u77",code:".rcb-app-icon.svelte-el1u77 {width:32px;height:32px;border-radius:12px;box-shadow:0px 1px 10px 0px rgba(0, 0, 0, 0.1);}.rcb-app-icon-picture-container.svelte-el1u77 {height:32px;}.rcb-app-icon.loading.svelte-el1u77 {background-color:gray;}"};function Qee(t,e){zt(t,Jee);var r=wr(),n=Xt(r);{var a=o=>{var c=Yee(),u=Le(c);{var d=h=>{var m=Kee();mt(()=>Ut(m,"srcset",e.srcWebp)),ke(h,m)};xt(u,h=>{e.srcWebp&&h(d)})}var f=kt(u,2);mt(()=>Ut(f,"src",e.src)),ke(o,c)},i=o=>{var c=Xee();ke(o,c)};xt(n,o=>{e.src?o(a):o(i,!1)})}ke(t,r)}var Zee=lt('<button class="rcb-back-button svelte-9xjbko" data-testid="close-button"><!></button>');const ete={hash:"svelte-9xjbko",code:".rcb-back-button.svelte-9xjbko {padding:8px;border:none;cursor:pointer;background-color:transparent;border-radius:50%;color:var(--rc-color-grey-text-dark);display:inline-flex;align-items:center;justify-content:center;width:fit-content;height:fit-content;}"};function tte(t,e){zt(t,ete);var r=Zee(),n=Le(r);Bm(n,{name:"back"}),Mo("click",r,function(a){QB.call(this,e,a)}),ke(t,r)}var rte=lt('<source type="image/webp" class="rcb-app-icon svelte-19gv4gf">'),nte=lt('<picture class="rcb-app-icon svelte-19gv4gf"><!> <img class="rcb-app-icon svelte-19gv4gf" alt="App icon"></picture>');const ate={hash:"svelte-19gv4gf",code:".rcb-app-icon.svelte-19gv4gf {height:32px;}"};function ite(t,e){zt(t,ate);var r=nte(),n=Le(r);{var a=o=>{var c=rte();mt(()=>Ut(c,"srcset",e.srcWebp)),ke(o,c)};xt(n,o=>{e.srcWebp&&o(a)})}var i=kt(n,2);mt(()=>Ut(i,"src",e.src)),ke(t,r)}var ste=lt('<div class="rcb-back-wrapper svelte-11zapuq"><!></div>'),ote=lt('<div class="rcb-close-wrapper svelte-11zapuq"><!></div>'),cte=lt('<div class="rcb-header-wrapper svelte-11zapuq"><!> <div class="rcb-header svelte-11zapuq"><div class="rcb-title svelte-11zapuq"><!> <!></div></div> <!></div>');const lte={hash:"svelte-11zapuq",code:`.rcb-header-wrapper.svelte-11zapuq {display:flex;position:relative;justify-content:space-between;align-items:center;}.rcb-header.svelte-11zapuq {display:flex;flex-direction:row;align-items:center;padding-top:var(--rc-spacing-gapSmall-mobile);padding-bottom:var(--rc-spacing-gapSmall-mobile);height:40px;justify-content:space-between;}.rcb-title.svelte-11zapuq {display:flex;align-items:center;position:relative;gap:var(--rc-spacing-gapMedium-mobile);}.rcb-close-wrapper.svelte-11zapuq,
  .rcb-back-wrapper.svelte-11zapuq {padding:var(--rc-spacing-gapSmall-mobile);}

  @container layout-query-container (width < 768px) {.rcb-header.svelte-11zapuq {padding-top:var(--rc-spacing-gapMedium-mobile);}.rcb-close-wrapper.svelte-11zapuq {padding-top:var(--rc-spacing-gapMedium-mobile);}.rcb-header-wrapper.svelte-11zapuq {padding-top:var(--rc-spacing-gapSmall-mobile);padding-bottom:var(--rc-spacing-gapSmall-mobile);padding-left:var(--rc-spacing-outerPadding-mobile);padding-right:var(--rc-spacing-outerPadding-mobile);}.rcb-header-wrapper.rcb-with-close-button.svelte-11zapuq {padding-right:var(--rc-spacing-gapSmall-mobile);}.rcb-back-wrapper.svelte-11zapuq {display:none;}.rcb-header-wrapper.svelte-11zapuq {padding-left:var(--rc-spacing-outerPadding-mobile);padding-right:var(--rc-spacing-outerPadding-mobile);}
  }

  @container layout-query-container (width >= 768px) {.rcb-close-wrapper.svelte-11zapuq {display:none;}.rcb-back-wrapper.svelte-11zapuq {position:absolute;left:-48px;margin-left:0;}
  }`};function ute(t,e){Wt(e,!0),zt(t,lte);const r=x=>x==null||x==null||x==""?null:x,n=ze(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_icon)}),a=ze(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_icon_webp)}),i=ze(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_wordmark)}),o=ze(()=>{var x;return r((x=e.brandingInfo)==null?void 0:x.app_wordmark_webp)}),c=ze(()=>$(n)?Gh($(n)):null),u=ze(()=>$(a)?Gh($(a)):null),d=ze(()=>$(i)?Gh($(i)):null),f=ze(()=>$(o)?Gh($(o)):null),h=()=>{e.onClose&&e.onClose()};var m=cte(),_=Le(m);{var w=x=>{var D=ste(),N=Le(D);tte(N,{$$events:{click:h}}),ke(x,D)};xt(_,x=>{e.showCloseButton&&x(w)})}var b=kt(_,2),E=Le(b),T=Le(E);{var R=x=>{ite(x,{get src(){return $(d)},get srcWebp(){return $(f)}})},P=x=>{var D=wr(),N=Xt(D);{var L=j=>{Qee(j,{get src(){return $(c)},get srcWebp(){return $(u)}})};xt(N,j=>{$(c)!==null&&$(u)!==null&&j(L)},!0)}ke(x,D)};xt(T,x=>{$(d)!==null?x(R):x(P,!1)})}var A=kt(T,2);{var C=x=>{Pr(x,{size:"body-base",children:(D,N)=>{var L=Ur();mt(()=>{var j;return hr(L,(j=e.brandingInfo)==null?void 0:j.app_name)}),ke(D,L)},$$slots:{default:!0}})};xt(A,x=>{$(d)===null&&x(C)})}var O=kt(b,2);{var I=x=>{var D=ote(),N=Le(D);UU(N,{$$events:{click:h}}),ke(x,D)};xt(O,x=>{e.showCloseButton&&x(I)})}mt(()=>jc(m,"rcb-with-close-button",e.showCloseButton)),ke(t,m),Kt()}var dte=lt("<!> <!> <!> <!>",1);function fte(t,e){Wt(e,!0);const r=It(e,"onClose",3,void 0),n=MU(e.productDetails,e.purchaseOptionToUse);let a=sr(Vt(e.defaultPriceBreakdown??{currency:n.currency,totalAmountInMicros:n.amountMicros,totalExcludingTaxInMicros:n.amountMicros,taxCalculationStatus:"unavailable",taxAmountInMicros:null,taxBreakdown:null}));const i=o=>{pt(a,Vt(o))};Wee(t,{get brandingInfo(){return e.brandingInfo},get isInElement(){return e.isInElement},get isSandbox(){return e.isSandbox},get onClose(){return r()},navbarHeaderContent:o=>{var c=ze(()=>!e.isInElement&&!!r());ute(o,{get brandingInfo(){return e.brandingInfo},get onClose(){return r()},get showCloseButton(){return $(c)}})},navbarBodyContent:o=>{var c=ze(()=>{var u,d;return((d=(u=e.brandingInfo)==null?void 0:u.appearance)==null?void 0:d.show_product_description)??!1});fee(o,{get productDetails(){return e.productDetails},get purchaseOption(){return e.purchaseOptionToUse},get showProductDescription(){return $(c)},get priceBreakdown(){return $(a)}})},mainContent:o=>{var c=dte(),u=Xt(c);{var d=E=>{UZ(E)};xt(u,E=>{e.currentPage==="payment-entry-loading"&&E(d)})}var f=kt(u,2);{var h=E=>{aZ(E,{get productDetails(){return e.productDetails},get purchaseOption(){return e.purchaseOptionToUse},get brandingInfo(){return e.brandingInfo},get purchaseOperationHelper(){return e.purchaseOperationHelper},get gatewayParams(){return e.gatewayParams},get managementUrl(){return e.managementUrl},get customerEmail(){return e.customerEmail},get defaultPriceBreakdown(){return e.defaultPriceBreakdown},get onContinue(){return e.onContinue},get onError(){return e.onError},onPriceBreakdownUpdated:i})};xt(f,E=>{e.currentPage==="payment-entry"&&E(h)})}var m=kt(f,2);{var _=E=>{var T=ze(()=>{var P;return((P=e.brandingInfo)==null?void 0:P.support_email)??null}),R=ze(()=>{var P;return((P=e.brandingInfo)==null?void 0:P.app_name)??null});LZ(E,{get lastError(){return e.lastError},get productDetails(){return e.productDetails},get supportEmail(){return $(T)},get onDismiss(){return e.closeWithError},get appName(){return $(R)}})};xt(m,E=>{e.currentPage==="error"&&E(_)})}var w=kt(m,2);{var b=E=>{BZ(E,{get onContinue(){return e.onContinue}})};xt(w,E=>{e.currentPage==="success"&&E(b)})}ke(o,c)},$$slots:{navbarHeaderContent:!0,navbarBodyContent:!0,mainContent:!0}}),Kt()}function pte(t){return t.trim()===""?"You need to provide your email address to continue.":t.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function hte(t){if(t&&!t.match(/^[A-Z]{3}$/)){const e=`Currency code ${t} is not valid. Please provide a valid ISO 4217 currency code.`;throw tr.errorLog(e),new bn(Un.ConfigurationError,e)}}function mte(t,e){var r;Wt(e,!0);const n=It(e,"customTranslations",19,()=>({})),a=It(e,"skipSuccessPage",3,!1),i=e.customerEmail?pte(e.customerEmail):null;let o=sr(Vt(i?void 0:e.customerEmail)),c=e.rcPackage.webBillingProduct,u=sr(null);const d=e.rcPackage.webBillingProduct.identifier??null;let f=sr("payment-entry-loading"),h=sr(null),m=sr(Vt({})),_=sr(null),w=sr(null),b=sr(null),E=sr(null),T=new Gb(n(),e.selectedLocale,e.defaultLocale),R=Hx(T);Zu(Bi,R),Zu(Zx,(r=e.brandingInfo)==null?void 0:r.appearance),_s(()=>{e.isInElement||(pt(w,Vt(document.documentElement.style.height)),pt(b,Vt(document.documentElement.style.overflow)),pt(E,Vt(document.body.style.height)),document.documentElement.style.height="100%",document.body.style.height="100%",document.documentElement.style.overflow="hidden")}),Ng(()=>{if(!e.isInElement){const x=(D,N,L)=>{L===""?D.style.removeProperty(N):D.style.setProperty(N,L)};x(document.documentElement,"height",$(w)),x(document.body,"height",$(E)),x(document.documentElement,"overflow",$(b))}}),Zu(Qx,e.eventsTracker),_s(async()=>{if(d===null){A(new on(Hr.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}e.purchaseOperationHelper.checkoutStart(e.appUserId,d,e.purchaseOption,e.rcPackage.webBillingProduct.presentedOfferingContext,$(o),e.metadata).then(x=>{pt(u,null),pt(f,"payment-entry"),pt(m,Vt(x.gateway_params)),pt(_,Vt(x.management_url))}).catch(x=>{if(x.errorCode===Hr.MissingEmailError)return pt(o,void 0),e.purchaseOperationHelper.checkoutStart(e.appUserId,d,e.purchaseOption,e.rcPackage.webBillingProduct.presentedOfferingContext,$(o),e.metadata).then(D=>{pt(u,null),pt(f,"payment-entry"),pt(m,Vt(D.gateway_params)),pt(_,Vt(D.management_url))}).catch(D=>{A(D)});A(x)})});const P=()=>{if($(f)==="payment-entry"){e.purchaseOperationHelper.pollCurrentPurchaseForCompletion().then(x=>{pt(h,Vt(x)),a()?e.onFinished(x):pt(f,"success")}).catch(x=>{A(x)});return}if($(f)==="success"||$(f)==="error"){e.onFinished($(h));return}pt(f,"success")},A=x=>{const D=HJ({errorCode:x.getErrorCode().toString(),errorMessage:x.message});e.eventsTracker.trackSDKEvent(D),pt(u,Vt(x)),pt(f,"error")},C=()=>{e.onError($(u)??new on(Hr.UnknownError,"Unknown error without state set."))};var O=ze(()=>e.purchases.isSandbox()),I=ze(()=>$(o)??null);fte(t,{get isSandbox(){return $(O)},get currentPage(){return $(f)},get brandingInfo(){return e.brandingInfo},productDetails:c,get purchaseOptionToUse(){return e.purchaseOption},get lastError(){return $(u)},get gatewayParams(){return $(m)},get managementUrl(){return $(_)},get purchaseOperationHelper(){return e.purchaseOperationHelper},get isInElement(){return e.isInElement},get customerEmail(){return $(I)},closeWithError:C,onContinue:P,onError:A,get onClose(){return e.onClose}}),Kt()}function FU(t){return t==null?!0:new Date(t)>new Date}function gte(t,e,r,n){const a=e.product_identifier;if(a in r)return yte(t,e,r[a]);if(a in n)return vte(t,e,n[a]);throw new bn(Un.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function yte(t,e,r){return{identifier:t,isActive:FU(e.expires_date),willRenew:zU(e.expires_date,r),store:r?.store??"unknown",latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(e.purchase_date),expirationDate:Ro(e.expires_date),productIdentifier:e.product_identifier,productPlanIdentifier:e.product_plan_identifier??null,unsubscribeDetectedAt:Ro(r?.unsubscribe_detected_at),billingIssueDetectedAt:Ro(r?.billing_issues_detected_at),isSandbox:r?.is_sandbox??!1,periodType:r?.period_type??"normal",ownershipType:r?.ownership_type??"UNKNOWN"}}function vte(t,e,r){return{identifier:t,isActive:!0,willRenew:!1,store:r.store,latestPurchaseDate:new Date(e.purchase_date),originalPurchaseDate:new Date(r.original_purchase_date),expirationDate:null,productIdentifier:e.product_identifier,productPlanIdentifier:null,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:r.is_sandbox,periodType:"normal",ownershipType:"UNKNOWN"}}function _te(t,e,r){const n={},a={};for(const i in t){const o=gte(i,t[i],e,r);n[i]=o,o.isActive&&(a[i]=o)}return{all:n,active:a}}function Ro(t){return t==null?null:new Date(t)}function qU(t){const e=kte(t),r=t.subscriber,n=Ste(r.non_subscriptions),a=Object.entries(t.subscriber.non_subscriptions).flatMap(([c,u])=>u.map(d=>({transactionIdentifier:d.id,productIdentifier:c,purchaseDate:new Date(d.purchase_date||d.original_purchase_date),storeTransactionId:d.store_transaction_id||null,store:d.store}))),i=new Date(t.request_date),o=Object.fromEntries(Object.entries(t.subscriber.subscriptions).map(([c,u])=>[c,{productIdentifier:c,purchaseDate:new Date(u.purchase_date),originalPurchaseDate:Ro(u.original_purchase_date),expiresDate:Ro(u.expires_date),store:u.store,unsubscribeDetectedAt:Ro(u.unsubscribe_detected_at),isSandbox:u.is_sandbox,billingIssuesDetectedAt:Ro(u.billing_issues_detected_at),gracePeriodExpiresDate:Ro(u.grace_period_expires_date),ownershipType:u.ownership_type??"UNKNOWN",periodType:u.period_type,refundedAt:Ro(u.refunded_at),storeTransactionId:u.store_transaction_id||null,isActive:FU(u.expires_date),willRenew:zU(u.expires_date,u)}]));return{entitlements:_te(r.entitlements,r.subscriptions,n),allExpirationDatesByProduct:e,allPurchaseDatesByProduct:bte(t,n),activeSubscriptions:wte(e),managementURL:r.management_url,requestDate:i,firstSeenDate:new Date(r.first_seen),originalPurchaseDate:Ro(r.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id,nonSubscriptionTransactions:a,subscriptionsByProductIdentifier:o}}function zU(t,e){if(e==null)return!1;const r=e.store=="promotional",n=t==null,a=e.unsubscribe_detected_at!=null,i=e.billing_issues_detected_at!=null;return!(r||n||a||i)}function bte(t,e){const r={};for(const n in t.subscriber.subscriptions){const a=t.subscriber.subscriptions[n];r[n]=new Date(a.purchase_date)}for(const n in e){const a=e[n].purchase_date;a==null?r[n]=null:r[n]=new Date(a)}return r}function kte(t){const e={};for(const r in t.subscriber.subscriptions){const n=t.subscriber.subscriptions[r];n.expires_date==null?e[r]=null:e[r]=new Date(n.expires_date)}return e}function wte(t){const e=new Set,r=new Date;for(const n in t){const a=t[n];(a==null||a>r)&&e.add(n)}return e}function Ste(t){const e={};for(const r in t){if(t[r].length===0)continue;const n=t[r].length;e[r]=t[r][n-1]}return e}const $U="1.14.0",Ete="https://api.revenuecat.com",Tte="https://e.revenue.cat";var K_;(function(t){t[t.CONTINUE=100]="CONTINUE",t[t.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",t[t.PROCESSING=102]="PROCESSING",t[t.EARLY_HINTS=103]="EARLY_HINTS",t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.RESET_CONTENT=205]="RESET_CONTENT",t[t.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",t[t.MULTI_STATUS=207]="MULTI_STATUS",t[t.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.USE_PROXY=305]="USE_PROXY",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",t[t.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",t[t.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",t[t.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",t[t.CONFLICT=409]="CONFLICT",t[t.GONE=410]="GONE",t[t.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",t[t.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",t[t.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",t[t.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",t[t.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",t[t.IM_A_TEAPOT=418]="IM_A_TEAPOT",t[t.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",t[t.METHOD_FAILURE=420]="METHOD_FAILURE",t[t.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",t[t.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",t[t.LOCKED=423]="LOCKED",t[t.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",t[t.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",t[t.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",t[t.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t[t.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",t[t.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",t[t.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",t[t.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(K_||(K_={}));const Cte=/^rcb_[a-zA-Z0-9_.-]+$/,xte=/^pdl_[a-zA-Z0-9_.-]+$/,Pte=/^test_[a-zA-Z0-9_.-]+$/;function Y_(t){return t?t.startsWith("rcb_sb_"):!1}function Ate(t){return t?Cte.test(t):!1}function Rte(t){return t?xte.test(t):!1}function Fu(t){return t?Pte.test(t):!1}async function Ms(t,e,r){const{apiKey:n,body:a,headers:i,httpConfig:o}=e,c=`${o?.proxyURL??Ete}${t.urlPath()}`;try{const u=await fetch(c,{method:t.method,headers:QU(n,i,o?.additionalHeaders),body:Ote(a),signal:r});return await Dte(u,t),await u.json()}catch(u){throw u instanceof TypeError?new bn(Un.NetworkError,sm.getPublicMessage(Un.NetworkError),u.message):u}}async function Dte(t,e){const r=t.status;if(r>=K_.INTERNAL_SERVER_ERROR)Ww(e,r,await t.text());else if(r>=K_.BAD_REQUEST){const n=await t.json(),a=n?JSON.stringify(n):null,i=n?.code,o=n?.message;if(i!=null){const c=sm.convertCodeToBackendErrorCode(i);if(c==null)Ww(e,r,a,i);else throw bn.getForBackendError(c,o)}else Ww(e,r,a)}}function Ww(t,e,r,n){throw new bn(Un.UnknownBackendError,"Unknown backend error.",`Request: ${t.name}. Status code: ${e}. Body: ${r}.`,{backendErrorCode:n})}function Ote(t){return t==null?null:JSON.stringify(t)}const VU="Authorization",HU="Content-Type",GU="Accept",WU="X-Platform",KU="X-Version",YU="X-Platform-Flavor",XU="X-Platform-Flavor-Version",JU="X-Is-Sandbox",Nte=new Set([VU,HU,GU,WU,KU,JU,YU,XU]);function QU(t,e,r){let n={[VU]:`Bearer ${t}`,[HU]:"application/json",[GU]:"application/json",[WU]:"web",[KU]:$U,[JU]:`${Y_(t)}`};const a=cm.getPlatformInfo();if(a){const i={[YU]:a.flavor,[XU]:a.version};n={...n,...i}}return e&&(n={...n,...e}),r&&(n={...r,...n}),n}const Xb="/v1/subscribers",Pp="/rcbilling/v1";class Ite{constructor(e){vt(this,"appUserId"),vt(this,"method","GET"),vt(this,"name","getOfferings"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Xb}/${e}/offerings`}}class Mte{constructor(e,r,n){vt(this,"method","GET"),vt(this,"name","getProducts"),vt(this,"appUserId"),vt(this,"productIds"),vt(this,"currency"),this.appUserId=e,this.productIds=r,this.currency=n}urlPath(){const e=encodeURIComponent(this.appUserId),r=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`&currency=${this.currency}`:"";return`${Pp}/subscribers/${e}/products?id=${r}${n}`}}class jte{constructor(e){vt(this,"method","GET"),vt(this,"name","getCustomerInfo"),vt(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Xb}/${e}`}}class Lte{constructor(){vt(this,"method","GET"),vt(this,"name","getBrandingInfo")}urlPath(){return`${Pp}/branding`}}class Bte{constructor(){vt(this,"method","POST"),vt(this,"name","postCheckoutStart")}urlPath(){return`${Pp}/checkout/start`}}class Ute{constructor(e){vt(this,"method","POST"),vt(this,"name","postCheckoutCalculateTax"),vt(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Pp}/checkout/${this.operationSessionId}/calculate_taxes`}}class Fte{constructor(e){vt(this,"method","POST"),vt(this,"name","postCheckoutComplete"),vt(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Pp}/checkout/${this.operationSessionId}/complete`}}class qte{constructor(e){vt(this,"method","GET"),vt(this,"name","getCheckoutStatus"),vt(this,"operationSessionId"),this.operationSessionId=e}urlPath(){return`${Pp}/checkout/${this.operationSessionId}`}}class zte{constructor(e){vt(this,"method","POST"),vt(this,"name","setAttributes"),vt(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Xb}/${e}/attributes`}}class $te{constructor(){vt(this,"method","POST"),vt(this,"name","postReceipt")}urlPath(){return"/v1/receipts"}}class Vte{constructor(e){vt(this,"method","GET"),vt(this,"name","getVirtualCurrencies"),vt(this,"appUserId"),this.appUserId=e}urlPath(){const e=encodeURIComponent(this.appUserId);return`${Xb}/${e}/virtual_currencies`}}const IT={};class Hte{constructor(e,r=IT){vt(this,"API_KEY"),vt(this,"httpConfig"),vt(this,"isSandbox"),this.API_KEY=e,this.httpConfig=r,this.isSandbox=Y_(e)}getIsSandbox(){return this.isSandbox}async getOfferings(e){return await Ms(new Ite(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(e){return await Ms(new jte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(e,r,n){return await Ms(new Mte(e,r,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await Ms(new Lte,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postCheckoutStart(e,r,n,a,i,o,c=void 0){const u={app_user_id:e,product_id:r,email:o,price_id:a.priceId,presented_offering_identifier:n.offeringIdentifier,trace_id:i};return c&&(u.metadata=c),a.id!=="base_option"&&(u.offer_id=a.id),n.targetingContext&&(u.applied_targeting_rule={rule_id:n.targetingContext.ruleId,revision:n.targetingContext.revision}),n.placementIdentifier&&(u.presented_placement_identifier=n.placementIdentifier),await Ms(new Bte,{apiKey:this.API_KEY,body:u,httpConfig:this.httpConfig})}async postCheckoutCalculateTax(e,r,n,a){const i={country_code:r,postal_code:n};return await Ms(new Ute(e),{apiKey:this.API_KEY,body:i,httpConfig:this.httpConfig},a)}async postCheckoutComplete(e,r){const n={email:r};return await Ms(new Fte(e),{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig})}async getCheckoutStatus(e){return await Ms(new qte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async setAttributes(e,r){const n=Date.now(),a={};for(const[o,c]of Object.entries(r))a[o]={value:c,updated_at_ms:n};const i={attributes:a};return await Ms(new zte(e),{apiKey:this.API_KEY,body:i,httpConfig:this.httpConfig})}async postReceipt(e,r,n,a,i,o){let c=null;i.targetingContext&&(c={rule_id:i.targetingContext.ruleId,revision:i.targetingContext.revision});const u={fetch_token:a,product_id:r,currency:n,app_user_id:e,presented_offering_identifier:i.offeringIdentifier,presented_placement_identifier:i.placementIdentifier,applied_targeting_rule:c,initiation_source:o};return await Ms(new $te,{apiKey:this.API_KEY,body:u,httpConfig:this.httpConfig})}async getVirtualCurrencies(e){return await Ms(new Vte(e),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function Gte(t,e){if(!(Ate(t)||Fu(t)||Rte(t)&&e?.allowPaddleAPIKey))throw new bn(Un.InvalidCredentialsError,"Invalid API key. Use your Web Billing API key.")}function XO(t){if(!t||new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(t)||t.includes("/"))throw new bn(Un.InvalidAppUserIdError,'Provided user id: "'+(t??"[Not provided]")+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function Wte(t){if(t!=null&&t.endsWith("/"))throw new bn(Un.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function Kte(t){if(t){for(const e in t)if(Nte.has(e))throw new bn(Un.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var ZU=(t=>(t.Current="current",t))(ZU||{});function Yte(t,e){async function r(...n){return await this.preload(),await t.call(this,...n)}return r}const eF=(t,e)=>{const r={...t.webBillingProduct,presentedOfferingContext:{...t.webBillingProduct.presentedOfferingContext,placementIdentifier:e}};return{...t,webBillingProduct:r,rcBillingProduct:r}},Iu=(t,e)=>t==null?null:eF(t,e),Xte=(t,e,r)=>{const n=t.offering_ids_by_placement??null;if(n==null)return null;const a=t.fallback_offering_id??null;let i;if(r in n){const c=n[r]??null;if(c==null)return null;i=e[c],i==null&&(i=e[a])}else i=e[a];if(i==null)return null;const o=Object.fromEntries(Object.entries(i.packagesById).map(([c,u])=>[c,eF(u,r)]));return{...i,packagesById:o,availablePackages:Object.values(o),weekly:Iu(i.weekly,r),monthly:Iu(i.monthly,r),twoMonth:Iu(i.twoMonth,r),threeMonth:Iu(i.threeMonth,r),sixMonth:Iu(i.sixMonth,r),annual:Iu(i.annual,r),lifetime:Iu(i.lifetime,r)}};function Jte(t,e){const r={};e.product_details.forEach(i=>{r[i.identifier]=i});const n={};t.offerings.forEach(i=>{const o=i.identifier===t.current_offering_id,c=pZ(o,i,r,t.targeting);c!=null&&(n[i.identifier]=c)});const a=t.current_offering_id?n[t.current_offering_id]??null:null;return Object.keys(n).length==0&&tr.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:n,current:a}}const Qte=1000001;function Zte(t){return t.webBillingProduct.defaultPurchaseOption}function JO(t,e,r,n=!1){return r.translate(Ot.PaywallVariablesPricePerPeriod,{formattedPrice:t,period:e.base.period?r.translatePeriod(e.base.period.number,e.base.period.unit,{noWhitespace:!0,short:!n}):""})}function ere(t,e){return t.unit==="year"?e.translatePeriod(t.number*12,Ea.Month):e.translatePeriod(t.number,t.unit)}function tre({price:t,period:e,translator:r}){const n=r.formatPrice(t.amountMicros,t.currency);return e?e.unit==="year"?r.formatPrice(t.amountMicros/12/4,t.currency):e.unit==="month"||e.unit==="week"&&e.number>1?r.formatPrice(t.amountMicros/e.number,t.currency):e.unit==="day"?r.formatPrice(t.amountMicros*7/e.number,t.currency):n:n}function rre({price:t,period:e,translator:r}){const n=r.formatPrice(t.amountMicros,t.currency);return!e||!e.number?n:e.unit==="year"?r.formatPrice(t.amountMicros/12,t.currency):e.unit==="month"&&e.number>1?r.formatPrice(t.amountMicros/e.number,t.currency):e.unit==="week"?r.formatPrice(t.amountMicros*4/e.number,t.currency):e.unit==="day"?r.formatPrice(t.amountMicros*30/e.number,t.currency):n}function QO({price:t,period:e,full:r=!1,translator:n}){if(!e||!e.number||e.unit===Ea.Month&&e.number==1)return n.formatPrice(t.amountMicros,t.currency);let a="";switch(e.unit){case Ea.Year:a=n.formatPrice(t.amountMicros/12,t.currency);break;case Ea.Month:a=n.formatPrice(t.amountMicros/e.number,t.currency);break;case Ea.Week:a=n.formatPrice(t.amountMicros*4/e.number,t.currency);break;case Ea.Day:a=n.formatPrice(t.amountMicros*30/e.number,t.currency);break}return n.translate(Ot.PaywallVariablesTotalPriceAndPerMonth,{formattedPrice:n.formatPrice(t.amountMicros,t.currency),period:n.translatePeriod(e.number,e.unit,{noWhitespace:!0,short:!r}),formattedPricePerMonth:a,monthPeriod:n.translatePeriodUnit(Ea.Month,{noWhitespace:!0,short:!r})})}function nre(t,e){const r=t.availablePackages,n=r.reduce((a,i)=>{const o=a.webBillingProduct.price||a.webBillingProduct.price,c=i.webBillingProduct.price||i.webBillingProduct.price;return o.amountMicros>c.amountMicros?a:i});return r.reduce((a,i)=>(a[i.identifier]=are(i,n,e),a),{})}function are(t,e,r){const n=t.webBillingProduct,a=n.price||n.price,i=r.formatPrice(a.amountMicros,a.currency),o=Zte(t),c=n.productType,u={product_name:n.title,price:i,price_per_period:"",price_per_period_full:"",total_price_and_per_month:"",total_price_and_per_month_full:"",sub_price_per_month:"",sub_price_per_week:"",sub_duration:"",sub_duration_in_months:"",sub_period:"",sub_period_length:"",sub_period_abbreviated:"",sub_offer_duration:void 0,sub_offer_duration_2:void 0,sub_offer_price:void 0,sub_offer_price_2:void 0,sub_relative_discount:""};if(c===ed.Subscription&&o){u.price_per_period=JO(i,o,r),u.price_per_period_full=JO(i,o,r,!0);const d=n.period||o.base.period;u.total_price_and_per_month=QO({price:a,period:d,translator:r}),u.total_price_and_per_month_full=QO({price:a,period:d,full:!0,translator:r}),u.sub_price_per_month=rre({price:a,period:d,translator:r}),u.sub_price_per_week=tre({price:a,period:d,translator:r}),u.sub_duration=r.translatePeriod(d?.number,d?.unit),u.sub_duration_in_months=ere(d,r),u.sub_period=r.translatePeriodFrequency(d?.number,d?.unit),u.sub_period_length=d?r.translatePeriodUnit(d.unit,{noWhitespace:!0}):void 0,u.sub_period_abbreviated=d?r.translatePeriodUnit(d.unit,{noWhitespace:!0,short:!0}):void 0;const f=a.amountMicros,h=(e.webBillingProduct.price||e.webBillingProduct.price).amountMicros,m=((h-f)*100/h).toFixed(0);u.sub_relative_discount=f===h?"":r.translate(Ot.PaywallVariablesSubRelativeDiscount,{discount:m})}return(c===ed.NonConsumable||c===ed.Consumable)&&o&&(u.price=i,u.price_per_period=i,u.price_per_period_full=i,u.total_price_and_per_month=i,u.sub_price_per_month=i,u.sub_duration=r.translate(Ot.PeriodsLifetime),u.sub_duration_in_months=r.translate(Ot.PeriodsLifetime),u.sub_period=r.translate(Ot.PeriodsLifetime),u.sub_price_per_week=void 0,u.sub_relative_discount=void 0,u.price_per_period_full=i,u.total_price_and_per_month_full=i,u.sub_period_length=void 0,u.sub_period_abbreviated=void 0),u}function ZO(t){for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256)}function Um(){const t=typeof crypto<"u"?crypto:globalThis.crypto;if(t&&t.randomUUID)return t.randomUUID();const e=new Uint8Array(16);try{t&&t.getRandomValues?t.getRandomValues(e):ZO(e)}catch{ZO(e)}e[6]=e[6]&15|64,e[8]=e[8]&63|128;const r=Array.from(e).map(n=>n.toString(16).padStart(2,"0"));return[r.slice(0,4).join(""),r.slice(4,6).join(""),r.slice(6,8).join(""),r.slice(8,10).join(""),r.slice(10,16).join("")].join("-")}var ire=/(%?)(%([sdijo]))/g;function sre(t,e){switch(e){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const r=JSON.stringify(t);return r==="{}"||r==="[]"||/^\[object .+?\]$/.test(r)?t:r}}}function iP(t,...e){if(e.length===0)return t;let r=0,n=t.replace(ire,(a,i,o,c)=>{const u=e[r],d=sre(u,c);return i?a:(r++,d)});return r<e.length&&(n+=` ${e.slice(r).join(" ")}`),n=n.replace(/%{2,2}/g,"%"),n}var ore=2;function cre(t){if(!t.stack)return;const e=t.stack.split(`
`);e.splice(1,ore),t.stack=e.join(`
`)}var lre=class extends Error{constructor(t,...e){super(t),this.message=t,this.name="Invariant Violation",this.message=iP(t,...e),cre(this)}},tF=(t,e,...r)=>{if(!t)throw new lre(e,...r)};tF.as=(t,e,r,...n)=>{if(!e){const a=n.length===0?r:iP(r,...n);let i;try{i=Reflect.construct(t,[a])}catch{i=t(a)}throw i}};const ure="[MSW]";function dre(t,...e){const r=iP(t,...e);return`${ure} ${r}`}function fre(t,...e){}function pre(t,...e){}const hre={formatMessage:dre,warn:fre,error:pre};function mre(){tF(typeof URL<"u",hre.formatMessage(`Global "URL" class is not defined. This likely means that you're running MSW in an environment that doesn't support all Node.js standard API (e.g. React Native). If that's the case, please use an appropriate polyfill for the "URL" class, like "react-native-url-polyfill".`))}var rF=(t=>(t.HEAD="HEAD",t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH",t.OPTIONS="OPTIONS",t.DELETE="DELETE",t))(rF||{});mre();class gre{constructor(e,r,n,a){vt(this,"initialDelay"),vt(this,"maxDelay"),vt(this,"jitterPercent"),vt(this,"callback"),vt(this,"currentDelay"),vt(this,"timeoutId"),vt(this,"executingCallback",!1),this.initialDelay=e,this.currentDelay=e,this.maxDelay=r,this.jitterPercent=n,this.callback=a}tryFlush(){if(this.backingOff()){tr.debugLog("Backing off, not flushing");return}this.clearTimeout(),this.executeCallbackWithRetries()}stop(){this.clearTimeout()}schedule(e){if(this.timeoutId!==void 0)return;const r=this.addJitter(e||this.currentDelay);this.timeoutId=setTimeout(()=>{this.timeoutId=void 0,this.executeCallbackWithRetries()},r)}backoff(){const e=this.currentDelay,r=Math.min(this.currentDelay*2,this.maxDelay);tr.debugLog(`Backing next off to ${e}ms delay`),this.clearTimeout(),this.currentDelay=r,this.schedule(e)}reset(){this.currentDelay!==this.initialDelay&&(this.clearTimeout(),this.currentDelay=this.initialDelay)}async executeCallbackWithRetries(){if(this.executingCallback){tr.debugLog("Callback already running, rescheduling"),this.schedule();return}this.executingCallback=!0;try{await this.callback(),this.reset()}catch{this.backoff()}finally{this.executingCallback=!1}}backingOff(){return this.currentDelay>this.initialDelay}clearTimeout(){clearTimeout(this.timeoutId),this.timeoutId=void 0}addJitter(e){const r=e*this.jitterPercent,n=e-r,a=e+r;return Math.floor(Math.random()*(a-n+1)+n)}}function nF(t){const e={};for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)){const n=r.replace(/([A-Z])/g,"_$1").toLowerCase(),a=t[r];a&&typeof a=="object"&&!Array.isArray(a)?e[n]=nF(a):e[n]=a}return e}class yre{constructor(e){vt(this,"EVENT_TYPE","web_billing"),vt(this,"id"),vt(this,"timestampMs"),vt(this,"data"),this.id=Um(),this.timestampMs=Date.now(),this.data=e}toJSON(){return nF({id:this.id,timestampMs:this.timestampMs,type:this.EVENT_TYPE,eventName:this.data.eventName,appUserId:this.data.appUserId,context:{...this.data.context},properties:{...this.data.properties,traceId:this.data.traceId}})}}function vre(t,e){const r=new URLSearchParams(window.location.search);return{libraryName:"purchases-js",libraryVersion:$U,locale:navigator.language,userAgent:navigator.userAgent,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenWidth:screen.width,screenHeight:screen.height,utmSource:r.get("utm_source")??null,utmMedium:r.get("utm_medium")??null,utmCampaign:r.get("utm_campaign")??null,utmContent:r.get("utm_content")??null,utmTerm:r.get("utm_term")??null,pageReferrer:document.referrer,pageUrl:`${window.location.origin}${window.location.pathname}`,pageTitle:document.title,source:t,rcSource:e}}const _re=2e3,bre=5*6e4,kre=.1;class wre{constructor(e){vt(this,"apiKey"),vt(this,"eventsQueue",[]),vt(this,"eventsUrl"),vt(this,"flushManager"),vt(this,"traceId",Um()),vt(this,"appUserId"),vt(this,"isSilent"),vt(this,"rcSource"),this.apiKey=e.apiKey,this.eventsUrl=`${Tte}/v1/events`,this.appUserId=e.appUserId,this.isSilent=e.silent||!1,this.rcSource=e.rcSource,this.flushManager=new gre(_re,bre,kre,this.flushEvents.bind(this))}async updateUser(e){this.appUserId=e}getTraceId(){return this.traceId}trackSDKEvent(e){this.trackEvent({...e,source:"sdk"})}trackExternalEvent(e){this.trackEvent({...e})}trackEvent(e){if(this.isSilent){tr.verboseLog("Skipping event tracking, the EventsTracker is silent");return}try{const r=new yre({eventName:e.eventName,traceId:this.traceId,appUserId:this.appUserId,context:vre(e.source,this.rcSource),properties:e.properties||{}});this.eventsQueue.push(r),this.flushManager.tryFlush()}catch{tr.errorLog(`Error while tracking event ${e.eventName}`)}}dispose(){this.flushManager.stop()}flushEvents(){if(this.eventsQueue.length===0)return Promise.resolve();const e=[...this.eventsQueue];return fetch(this.eventsUrl,{method:rF.POST,headers:QU(this.apiKey),body:JSON.stringify({events:e})}).then(r=>{if(r.status===200||r.status===201){this.eventsQueue.splice(0,e.length);return}else throw tr.debugLog("Events failed to flush due to server error"),new Error("Events failed to flush due to server error")}).catch(r=>{throw tr.debugLog("Error while flushing events"),r})}}const Sre=()=>{const t=new URLSearchParams(window.location.search),e=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],r={};return e.forEach(n=>{const a=t.get(n);a!==null&&(r[n]=a)}),r},Ere=["app","embedded"],Kw={autoCollectUTMAsMetadata:!0,collectAnalyticsEvents:!0};var Tre=lt('<p class="svelte-11vxb6p"><strong>Free Trial:</strong> </p>'),Cre=lt('<p class="svelte-11vxb6p"><strong>Intro Price:</strong> </p>'),xre=lt('<div class="rc-simulated-store-modal-overlay svelte-11vxb6p"><div class="rc-simulated-store-modal svelte-11vxb6p"><div class="rc-simulated-store-modal-content svelte-11vxb6p"><h2 class="rc-simulated-store-modal-title svelte-11vxb6p">Test Store Purchase</h2> <div class="rc-simulated-store-modal-details svelte-11vxb6p"><div><p class="svelte-11vxb6p"><strong>Product:</strong> </p> <p class="svelte-11vxb6p"><strong>Type:</strong> </p> <p class="svelte-11vxb6p"><strong>Price:</strong> </p> <!> <!></div></div> <div class="rc-simulated-store-modal-buttons svelte-11vxb6p"><button type="button" class="rc-simulated-store-modal-button rc-simulated-store-modal-button-primary svelte-11vxb6p">Test valid purchase</button> <button type="button" class="rc-simulated-store-modal-button rc-simulated-store-modal-button-secondary svelte-11vxb6p">Test failed purchase</button> <button type="button" class="rc-simulated-store-modal-button rc-simulated-store-modal-button-cancel svelte-11vxb6p">Cancel</button></div></div></div></div>');const Pre={hash:"svelte-11vxb6p",code:`.rc-simulated-store-modal-overlay.svelte-11vxb6p {position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0, 0, 0, 0.5);display:flex;justify-content:center;align-items:center;z-index:9999;}.rc-simulated-store-modal.svelte-11vxb6p {background:white;border-radius:8px;padding:0;max-width:500px;width:90%;max-height:90%;overflow-y:auto;box-shadow:0 4px 20px rgba(0, 0, 0, 0.15);}.rc-simulated-store-modal-content.svelte-11vxb6p {padding:24px;}.rc-simulated-store-modal-title.svelte-11vxb6p {margin:0 0 20px 0;font-size:24px;font-weight:600;color:#333;}.rc-simulated-store-modal-details.svelte-11vxb6p {margin-bottom:24px;}.rc-simulated-store-modal-details.svelte-11vxb6p p:where(.svelte-11vxb6p) {margin:8px 0;color:#666;line-height:1.5;}.rc-simulated-store-modal-buttons.svelte-11vxb6p {display:flex;flex-direction:column;gap:12px;}.rc-simulated-store-modal-button.svelte-11vxb6p {padding:12px 24px;border:none;border-radius:6px;font-size:16px;font-weight:500;cursor:pointer;transition:background-color 0.2s ease;}.rc-simulated-store-modal-button-primary.svelte-11vxb6p {background-color:#007aff;color:white;}.rc-simulated-store-modal-button-primary.svelte-11vxb6p:hover {background-color:#0056cc;}.rc-simulated-store-modal-button-secondary.svelte-11vxb6p {background-color:#ff3b30;color:white;}.rc-simulated-store-modal-button-secondary.svelte-11vxb6p:hover {background-color:#cc2e24;}.rc-simulated-store-modal-button-cancel.svelte-11vxb6p {background-color:#f2f2f7;color:#333;}.rc-simulated-store-modal-button-cancel.svelte-11vxb6p:hover {background-color:#e5e5ea;}

  /* Mobile responsive - full screen on small screens */
  @media (max-width: 768px) {.rc-simulated-store-modal-overlay.svelte-11vxb6p {padding:0;}.rc-simulated-store-modal.svelte-11vxb6p {width:100%;height:100%;border-radius:0;max-width:none;max-height:none;}.rc-simulated-store-modal-content.svelte-11vxb6p {height:100%;display:flex;flex-direction:column;justify-content:center;}
  }`};function Are(t,e){Wt(e,!1),zt(t,Pre);let r=It(e,"productIdentifier",8),n=It(e,"productType",8),a=It(e,"basePrice",8),i=It(e,"freeTrialPeriod",8,void 0),o=It(e,"introPriceFormatted",8,void 0),c=It(e,"onValidPurchase",8),u=It(e,"onFailedPurchase",8),d=It(e,"onCancel",8);function f(U){U.target===U.currentTarget&&d()()}ws();var h=xre(),m=Le(h),_=Le(m),w=kt(Le(_),2),b=Le(w),E=Le(b),T=kt(Le(E)),R=kt(E,2),P=kt(Le(R)),A=kt(R,2),C=kt(Le(A)),O=kt(A,2);{var I=U=>{var W=Tre(),F=kt(Le(W));mt(()=>hr(F,` ${i()??""}`)),ke(U,W)};xt(O,U=>{i()&&U(I)})}var x=kt(O,2);{var D=U=>{var W=Cre(),F=kt(Le(W));mt(()=>hr(F,` ${o()??""}`)),ke(U,W)};xt(x,U=>{o()&&U(D)})}var N=kt(w,2),L=Le(N),j=kt(L,2),q=kt(j,2);mt(()=>{hr(T,` ${r()??""}`),hr(P,` ${n()??""}`),hr(C,` ${a()??""}`)}),Mo("click",L,function(...U){var W;(W=c())==null||W.apply(this,U)}),Mo("click",j,function(...U){var W;(W=u())==null||W.apply(this,U)}),Mo("click",q,function(...U){var W;(W=d())==null||W.apply(this,U)}),Mo("click",h,f),ke(t,h),Kt()}async function aF(t,e,r){const n=new Date,a=`test_${n.getTime()}_${Um()}`,i=`test_store_operation_session_${Um()}`,o={storeTransactionId:a,productIdentifier:t.identifier,purchaseDate:n},c=await e.postReceipt(r,t.identifier,t.price.currency,a,t.presentedOfferingContext,"purchase");return{customerInfo:qU(c),redemptionInfo:null,operationSessionId:i,storeTransaction:o}}function Rre(t,e,r){const n=t.rcPackage.webBillingProduct,a=n.productType,i=n.freeTrialPhase,o=n.introPricePhase,c=n.price,u=d=>d?`${d.number} ${d.unit}${d.number>1?"s":""}`:"N/A";return new Promise((d,f)=>{var h;const m=document.createElement("div");document.body.appendChild(m);const _=()=>{w&&Wv(w),document.body.removeChild(m)};let w=null;w=ST(Are,{target:m,props:{productIdentifier:n.identifier,productType:a,basePrice:c.formattedPrice,freeTrialPeriod:i?u(i.period):void 0,introPriceFormatted:(h=o?.price)==null?void 0:h.formattedPrice,onValidPurchase:async()=>{_();try{d(await aF(n,e,r))}catch(b){f(b)}},onFailedPurchase:()=>{_(),f(new bn(Un.ProductNotAvailableForPurchaseError,"Simulated test purchase failure: no real transaction occurred"))},onCancel:()=>{_(),f(new bn(Un.UserCancelledError))}}})})}class Dre{constructor(){vt(this,"virtualCurrenciesCache",new Map),vt(this,"CACHE_EXPIRY_MS",300*1e3)}invalidateAllCaches(){this.virtualCurrenciesCache.clear()}cacheVirtualCurrencies(e,r){this.virtualCurrenciesCache.set(e,{data:r,lastUpdatedAt:Date.now()})}getCachedVirtualCurrencies(e,r=!1){const n=this.virtualCurrenciesCache.get(e);return this.getCachedData(n??null,r)}invalidateVirtualCurrenciesCache(e){this.virtualCurrenciesCache.delete(e)}getCachedData(e,r=!1){return e?r?e.data:Date.now()-e.lastUpdatedAt>=this.CACHE_EXPIRY_MS?null:e.data:null}}function Ore(t){return{balance:t.balance,name:t.name,code:t.code,serverDescription:t.description??null}}function Nre(t){const e={};for(const[r,n]of Object.entries(t.virtual_currencies))e[r]=Ore(n);return{all:e}}const eN="$RCAnonymousID:";var iF,Qv;iF=[Yte];const Wh=class ni{constructor(e,r,n=IT,a=Kw){tW(Qv,5,this),vt(this,"_API_KEY"),vt(this,"_appUserId"),vt(this,"_brandingInfo",null),vt(this,"_loadingResourcesPromise",null),vt(this,"_flags"),vt(this,"backend"),vt(this,"purchaseOperationHelper"),vt(this,"eventsTracker"),vt(this,"inMemoryCache"),this._API_KEY=e,this._appUserId=r,this._flags={...Kw,...a},Y_(e)?tr.debugLog("Initializing Purchases SDK with Web billing sandbox API Key"):Fu(e)&&tr.debugLog("Initializing Purchases SDK with RC Test store API Key."),this.eventsTracker=new wre({apiKey:this._API_KEY,appUserId:this._appUserId,silent:!this._flags.collectAnalyticsEvents,rcSource:this._flags.rcSource??null}),this.backend=new Hte(this._API_KEY,n),this.inMemoryCache=new Dre,this.purchaseOperationHelper=new IK(this.backend,this.eventsTracker),this.eventsTracker.trackSDKEvent({eventName:gi.SDKInitialized})}static setLogLevel(e){tr.setLogLevel(e)}static setLogHandler(e){tr.setLogHandler(e)}static setPlatformInfo(e){ni._platformInfo=e}static getPlatformInfo(){return ni._platformInfo}static getSharedInstance(){if(ni.isConfigured())return ni.instance;throw new OK}static isConfigured(){return ni.instance!==void 0}static configure(e,r,n,a){ni.instance!==void 0&&tr.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance.");let i;if(typeof e=="object"&&e!==null)i=e;else{if(typeof e!="string")throw new bn(Un.ConfigurationError,"API key must be provided as a string");if(typeof r!="string")throw new bn(Un.ConfigurationError,"App user ID must be provided as a string");i={apiKey:e,appUserId:r,httpConfig:n,flags:a}}return ni.configureInternal(i),ni.getSharedInstance()}static configureInternal(e){const{apiKey:r,appUserId:n,httpConfig:a,flags:i}=e,o=a??IT,c=i??Kw;ni.validateConfig(e),ni.instance=new ni(r,n,o,c)}static validateConfig(e){var r,n;Gte(e.apiKey,e.flags),XO(e.appUserId),Wte((r=e.httpConfig)==null?void 0:r.proxyURL),Kte((n=e.httpConfig)==null?void 0:n.additionalHeaders)}async preload(){if(this.hasLoadedResources()){tr.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){tr.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.fetchAndCacheBrandingInfo().catch(e=>{let r=`${e}`;e instanceof bn&&(r=`${e.message}. ${e.underlyingErrorMessage?`Underlying error: ${e.underlyingErrorMessage}`:""}`),tr.errorLog(`Error fetching branding info: ${r}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}async fetchAndCacheBrandingInfo(){if(Fu(this._API_KEY)){tr.warnLog("Branding info is not available for RC Test Store API keys.");return}this._brandingInfo=await this.backend.getBrandingInfo()}hasLoadedResources(){return this._brandingInfo!==null}async renderPaywall(e){let r=e.htmlTarget??document.getElementById("rcb-ui-pw-root");if(r===null){const m=document.createElement("div");m.id="rcb-ui-pw-root",m.className="rcb-ui-pw-root",m.style.zIndex=`${Qte}`,document.body.appendChild(m),r=m}if(r===null)throw new Error("Could not generate a mount point for the billing widget");const n=r;n.innerHTML="";const a=e.offering;if(!a.paywall_components)throw new Error("You cannot use paywalls yet, they are coming soon!");const i=e.selectedLocale||navigator.language,o=new Gb({},i,a.paywall_components.default_locale),c=m=>{var _;const w=a.availablePackages.find(b=>b.identifier===m);if(w===void 0)throw new Error(`No package found for ${m}`);return this.purchase({rcPackage:w,htmlTarget:e.purchaseHtmlTarget,customerEmail:e.customerEmail,selectedLocale:i,defaultLocale:((_=a.paywall_components)==null?void 0:_.default_locale)||Lf})},u=m=>{var _;if(e.onNavigateToUrl){e.onNavigateToUrl(m);return}(_=window.open(m,"_blank"))==null||_.focus()},d=()=>{},f=()=>{if(e.onVisitCustomerCenter){e.onVisitCustomerCenter();return}},h=nre(a,o);return new Promise((m,_)=>{ST(PX,{target:n,props:{paywallData:a.paywall_components,selectedLocale:i,onNavigateToUrlClicked:u,onVisitCustomerCenterClicked:f,onBackClicked:()=>{if(e.onBack){e.onBack();return}n.innerHTML="",tr.debugLog("Purchase cancelled by user"),_(new bn(Un.UserCancelledError))},onRestorePurchasesClicked:d,onPurchaseClicked:w=>{c(w).then(b=>{m(b)}).catch(b=>_(b))},onError:w=>_(w),variablesPerPackage:h}})})}async getOfferings(e){hte(e?.currency);const r=this._appUserId,n=await this.backend.getOfferings(r),a=e?.offeringIdentifier===ZU.Current?n.current_offering_id:e?.offeringIdentifier;return a&&(n.offerings=n.offerings.filter(i=>i.identifier===a)),await this.getAllOfferings(n,r,e)}async getCurrentOfferingForPlacement(e,r){const n=this._appUserId,a=await this.backend.getOfferings(n),i=await this.getAllOfferings(a,n,r),o=a.placements??null;return o==null?null:Xte(o,i.all,e)}async getAllOfferings(e,r,n){const a=e.offerings.flatMap(o=>o.packages).map(o=>o.platform_product_identifier),i=await this.backend.getProducts(r,a,n?.currency);return this.logMissingProductIds(a,i.product_details),Jte(e,i)}async isEntitledTo(e){const r=await this.getCustomerInfo();return e in r.entitlements.active}purchasePackage(e,r,n){return this.purchase({rcPackage:e,customerEmail:r,htmlTarget:n})}async purchase(e){var r;const{rcPackage:n,purchaseOption:a,htmlTarget:i,customerEmail:o,selectedLocale:c=Lf,defaultLocale:u=Lf,skipSuccessPage:d=!1}=e;if(Fu(this._API_KEY)){const A=await Rre(e,this.backend,this._appUserId);return this.inMemoryCache.invalidateAllCaches(),A}let f=i??document.getElementById("rcb-ui-root");if(f===null){const A=document.createElement("div");A.className="rcb-ui-root",document.body.appendChild(A),f=A}if(f===null)throw new Error("Could not generate a mount point for the billing widget");const h=f,m=this._appUserId;tr.debugLog(`Presenting purchase form for package ${n.identifier}`);const _=c||u,w=a??n.webBillingProduct.defaultPurchaseOption,b=WJ({appearance:(r=this._brandingInfo)==null?void 0:r.appearance,rcPackage:n,purchaseOptionToUse:w,customerEmail:o});this.eventsTracker.trackSDKEvent(b);const E={...this._flags.autoCollectUTMAsMetadata?Sre():{},...e.metadata||{}};let T=null;const R=this._brandingInfo;R&&e.brandingAppearanceOverride&&(R.appearance=e.brandingAppearanceOverride);const P=i!==void 0;return new Promise((A,C)=>{P||window.history.pushState({checkoutOpen:!0},"");const O=this._flags.rcSource&&Ere.includes(this._flags.rcSource)?void 0:()=>{const I=YJ();this.eventsTracker.trackSDKEvent(I),window.removeEventListener("popstate",O),T&&Wv(T),h.innerHTML="",tr.debugLog("Purchase cancelled by user"),C(new bn(Un.UserCancelledError))};!P&&O&&window.addEventListener("popstate",O),T=ST(mte,{target:h,props:{isInElement:P,appUserId:m,rcPackage:n,purchaseOption:w,customerEmail:o,onFinished:async I=>{const x=KJ({redemptionInfo:I.redemptionInfo});this.eventsTracker.trackSDKEvent(x),this.inMemoryCache.invalidateAllCaches(),tr.debugLog("Purchase finished"),T&&Wv(T),h.innerHTML="";const D={customerInfo:await this._getCustomerInfoForUserId(m),redemptionInfo:I.redemptionInfo,operationSessionId:I.operationSessionId,storeTransaction:{storeTransactionId:I.storeTransactionIdentifier,productIdentifier:n.webBillingProduct.identifier,purchaseDate:I.purchaseDate}};A(D)},onClose:O,onError:I=>{var x;const D=XJ({errorCode:(x=I.errorCode)==null?void 0:x.toString(),errorMessage:I.message});this.eventsTracker.trackSDKEvent(D),T&&Wv(T),h.innerHTML="",C(bn.getForPurchasesFlowError(I))},purchases:this,eventsTracker:this.eventsTracker,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,selectedLocale:_,metadata:E,defaultLocale:u,customTranslations:e.labelsOverride,skipSuccessPage:d}})})}_isConfiguredWithSimulatedStore(){return Fu(this._API_KEY)}async _postSimulatedStoreReceipt(e){if(!Fu(this._API_KEY))throw new bn(Un.ConfigurationError,"Posting a test store receipt is only available for RC Test Store API keys.");return await aF(e,this.backend,this._appUserId)}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async setAttributes(e){return await this.getCustomerInfo(),await this.backend.setAttributes(this._appUserId,e)}async changeUser(e){return XO(e),this._appUserId=e,this.eventsTracker.updateUser(e),this.inMemoryCache.invalidateAllCaches(),await this.getCustomerInfo()}logMissingProductIds(e,r){const n={};r.forEach(i=>n[i.identifier]=i);const a=[];e.forEach(i=>{n[i]===void 0&&a.push(i)}),a.length>0&&tr.debugLog(`Could not find product data for product ids:
        ${a.join()}.
        Please check that your product configuration is correct.`)}isSandbox(){return Y_(this._API_KEY)||Fu(this._API_KEY)}isAnonymous(){return this._appUserId.startsWith(eN)}async getVirtualCurrencies(){return await this._getVirtualCurrenciesForUserId(this._appUserId)}getCachedVirtualCurrencies(){return this.inMemoryCache.getCachedVirtualCurrencies(this._appUserId,!0)}invalidateVirtualCurrenciesCache(){this.inMemoryCache.invalidateVirtualCurrenciesCache(this._appUserId)}close(){ni.instance===this?(this.eventsTracker&&this.eventsTracker.dispose(),ni.instance=void 0):tr.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(e){const r=await this.backend.getCustomerInfo(e);return qU(r)}async _getVirtualCurrenciesForUserId(e){const r=this.inMemoryCache.getCachedVirtualCurrencies(e);if(r)return tr.debugLog("Vending VirtualCurrencies from cache."),r;const n=await this.backend.getVirtualCurrencies(e),a=Nre(n);return tr.debugLog("VirtualCurrencies updated from the network."),this.inMemoryCache.cacheVirtualCurrencies(e,a),a}static generateRevenueCatAnonymousAppUserId(){return`${eN}${Um().replace(/-/g,"")}`}_trackEvent(e){this.eventsTracker.trackExternalEvent(e)}};Qv=QG(),rW(Qv,1,"purchase",iF,Wh),eW(Qv,Wh),vt(Wh,"_platformInfo"),vt(Wh,"instance");let cm=Wh;function Ire(t,e){const r=String(e||"");if(t==="web"&&!r.startsWith("web_")&&!r.startsWith("rcb"))throw new Error('RevenueCat Web requires a Web Billing key (starts with "web_"). Set VITE_RC_API_KEY_WEB.');t==="ios"&&r.startsWith("appl_"),t==="android"&&r.startsWith("goog_")}function MT(t){const e=t==="web"?V7:t==="ios"?G7:H7;if(!e)throw new Error(`RevenueCat SDK key missing for ${t}. Add VITE_RC_API_KEY_* and restart.`);return Ire(t,String(e)),String(e)}function Mre(t){const e=(t??"").toString().trim();if(!e||e==="[Not provided]")throw new Error("Invalid appUserID for RevenueCat.");if(e.length>255)throw new Error("appUserID too long for RevenueCat (max 255).");return e}let Pl=null,vf=null,Fm=null;function jre(t){const e=(t??"").toString();return{length:e.length,empty:e.length===0}}function Lre(t){return t?String(t).slice(0,4):null}async function Bre(t){return Pl||vf||(vf=(async()=>{const e=Gr.getPlatform();if(e==="web"){const n=MT("web");if(typeof cm?.configure!="function")throw new Error("[RC] Web SDK load failed");try{await cm.configure({apiKey:n,appUserId:t,observerMode:!1});try{X_()}catch{}}catch{throw new Error("Purchases are temporarily paused.")}return Pl={platform:"web",Purchases:cm},Pl}const r=MT(e==="ios"?"ios":"android");try{const a=(await qr(()=>import("./index-OhN1_GZK.js"),[],import.meta.url))?.Purchases;if(!a||typeof a.configure!="function")throw new Error("Capacitor Purchases plugin not available. Did you run `npx cap sync ios`?");try{await a.configure({apiKey:r,appUserID:t,observerMode:!1});try{X_()}catch{}}catch{throw new Error("Purchases are temporarily paused.")}return Pl={platform:"native",Purchases:a},Pl}catch(n){throw n}})().catch(e=>{throw vf=null,e}),vf)}async function sP(t){const e=Mre(t),r=await Bre(e);if(Fm!==e){try{const n=r.Purchases;typeof n?.logIn=="function"&&(r.platform==="native"?await n.logIn({appUserID:e}):await n.logIn(e));try{X_()}catch{}}catch{}Fm=e}return r}function Ni(){const t=Pl;if(!t?.Purchases){if(Gr.getPlatform()==="web")try{const o=cm;if(typeof o?.getSharedInstance=="function"){const c=o.getSharedInstance();if(c)return c}return null}catch{}return null}const e=Gr.getPlatform(),r=t.Purchases;function n(i){const o=Object.create(i);return typeof i.getOfferings=="function"&&(o.getOfferings=async()=>{const c=e;let u=null;try{u=Lre(MT(c==="ios"?"ios":c==="android"?"android":"web"))}catch{}try{const d=await i.getOfferings(),f=d?.current?.identifier??d?.currentOfferingIdentifier??null,h=(d?.current?.availablePackages??d?.availablePackages??[]).length;return d}catch(d){let f;try{f=d?.getErrorCode?.()??d?.errorCode??d?.code}catch{}throw d?.message,d}}),o}if(e==="web"){if(typeof r.getSharedInstance=="function")try{const i=r.getSharedInstance();return n(i)}catch{return n(r)}return n(r)}const a=Object.create(r);return typeof r.purchasePackage=="function"&&(a.purchasePackage=i=>r.purchasePackage({aPackage:i})),n(a)}function X_(){Gr.getPlatform(),jre(Fm);try{Lo.getInfo().then(t=>{}).catch(()=>{})}catch{}}async function _f(){if(!Fm)throw new Error("Cannot reconfigure RevenueCat before user identification.");return Pl=null,vf=null,sP(Fm)}const Ure=Object.freeze(Object.defineProperty({__proto__:null,getPurchases:Ni,initRevenueCat:sP,logRevenueCatConfig:X_,reconfigureRevenueCat:_f},Symbol.toStringTag,{value:"Module"})),tN=g3,Fre=y3,qre=v3,zre=String(W7).toLowerCase()==="true",Zv={0:"UnknownError",1:"UserCancelledError",2:"StoreProblemError",3:"PurchaseNotAllowedError",4:"PurchaseInvalidError",5:"ProductNotAvailableForPurchaseError",6:"ProductAlreadyPurchasedError",7:"ReceiptAlreadyInUseError",8:"InvalidReceiptError",9:"MissingReceiptFileError",10:"NetworkError",11:"InvalidCredentialsError",12:"UnexpectedBackendResponseError",14:"InvalidAppUserIdError",15:"OperationAlreadyInProgressError",16:"UnknownBackendError"};function Yw(t,e){try{const r=e?.getErrorCode?.()??e?.errorCode??e?.code,n=typeof r=="number"?Zv[r]||`Code${r}`:"Unknown",a=e?.extra?.backendErrorCode??e?.extra?.code??e?.backendErrorCode,i=e?.underlyingErrorMessage||e?.nativeStack||e?.stack,o=e?.message||String(e);if(zre){const c=e?.extra?{...e.extra}:void 0}}catch{}}const sF=v.createContext({rc:null,ready:!1,error:null,buyChips:async()=>{},buySubscription:async()=>{},restorePurchases:async()=>{}});function $re({children:t}){const{user:e,refreshUser:r}=$r(),[n,a]=v.useState(null),[i,o]=v.useState(!1),[c,u]=v.useState(null),d=v.useCallback(()=>{try{r()}catch{}try{setTimeout(()=>{r().catch(()=>{})},1200)}catch{}},[r]);v.useEffect(()=>{let A=!1;return(async()=>{if(o(!1),u(null),a(null),!!e?.id)try{const C=await sP(e.id);let O=!1;const I=1e3,x=Date.now();for(;!A;){const N=Ni()||C?.Purchases;if(N&&(typeof N.purchasePackage=="function"||typeof N.getOfferings=="function")){O=!0;break}if(Date.now()-x>I)break;await new Promise(L=>setTimeout(L,50))}!O&&C?.platform==="web"&&(O=!0),A||(a(C),o(O))}catch(C){A||(u(C?.message||"Purchases are temporarily paused. Please try again later."),o(!1))}})(),()=>{A=!0}},[e?.id]);const f=v.useCallback(A=>A?.all?.[tN]?A.all[tN]:A?.current||A?.all?.default||null,[]),h=v.useCallback(A=>{const C=[],O=x=>{if(Array.isArray(x))for(const D of x){const N=D?.identifier||D?.product?.identifier;N&&(C.find(L=>(L?.identifier||L?.product?.identifier)===N)||C.push(D))}};O(A?.current?.availablePackages||A?.current?.packages);const I=A?.all||{};return Object.keys(I).forEach(x=>{O(I[x]?.availablePackages||I[x]?.packages)}),C},[]),m=A=>{const C=A?.packageType,O=A?.product?.type;return C==="MONTHLY"||C==="ANNUAL"||C==="SIX_MONTH"||C==="THREE_MONTH"||C==="TWO_MONTH"||O==="SUBSCRIPTION"||O==="AUTO_RENEWABLE_SUBSCRIPTION"||!!A?.product?.subscriptionPeriod},_=A=>{const C=A?.product?.type,O=A?.packageType;return!m(A)||C==="NON_SUBSCRIPTION"||C==="NON_CONSUMABLE"||O==="LIFETIME"},w=v.useCallback(A=>{const C=f(A),O=h(A);{const D=O.find(N=>N?.identifier===Fre);if(D)return D}{const D=O.find(N=>N?.product?.identifier===qre);if(D)return D}const I=O.find(D=>_(D));if(I)return I;const x=C?.availablePackages||C?.packages||[];return Array.isArray(x)&&x.length>0?x[0]:O[0]||null},[h,f]),b=v.useCallback(A=>{const C=f(A),O=h(A),I=O.find(L=>L?.packageType==="MONTHLY")||O.find(L=>(L?.identifier||"").toLowerCase().includes("month"));if(I)return I;const x=O.find(L=>L?.packageType==="ANNUAL")||O.find(L=>(L?.identifier||"").toLowerCase().includes("year"));if(x)return x;const D=O.find(L=>m(L));if(D)return D;const N=C?.availablePackages||C?.packages||[];return Array.isArray(N)&&N.length>0?N[0]:O[0]||null},[h,f]),E=v.useCallback(async()=>{if(!i)throw new Error("RevenueCat not ready");let A=Ni();if(!A?.getOfferings||!A?.purchasePackage)try{await _f(),A=Ni()}catch{}if(!A?.getOfferings||!A?.purchasePackage)throw new Error("Purchases not initialized. Please ensure the app is logged in and RevenueCat has finished initializing (iOS may need a moment after app launch).");const C=await A.getOfferings(),O=w(C);if(!O)throw h(C),new Error("No chips product configured");try{try{await A.purchasePackage(O),d()}catch(I){const x=String(I?.message||I);if(/already been destroyed/i.test(x))try{await _f();const D=Ni();if(!D?.purchasePackage)throw I;await D.purchasePackage(O),d();return}catch{}throw I}}catch(I){Yw("[RC] purchasePackage(chips)",I);const x=I?.getErrorCode?.()??I?.errorCode??I?.code,D=typeof x=="number"?Zv[x]||`Code${x}`:"Unknown",N=I?.extra?.backendErrorCode??I?.backendErrorCode,L=N===7773?" Payment gateway communication error. On web, verify RevenueCat Web Billing is connected to Stripe and the product has a Web price; then retry.":"";throw new Error(`Purchase failed (${D}${typeof x=="number"?` ${x}`:""}${N?` | backend ${N}`:""}).${L}`)}},[i,w,h,d]),T=v.useCallback(async()=>{if(!i)throw new Error("RevenueCat not ready");let A=Ni();if(!A?.getOfferings||!A?.purchasePackage)try{await _f(),A=Ni()}catch{}if(!A?.getOfferings||!A?.purchasePackage)throw new Error("Purchases not initialized");const C=await A.getOfferings(),O=b(C);if(!O)throw new Error("No subscription package available");try{try{await A.purchasePackage(O),d()}catch(I){const x=String(I?.message||I);if(/already been destroyed/i.test(x))try{await _f();const D=Ni();if(!D?.purchasePackage)throw I;await D.purchasePackage(O),d();return}catch{}throw I}}catch(I){Yw("[RC] purchasePackage(subscription)",I);const x=I?.getErrorCode?.()??I?.errorCode??I?.code,D=typeof x=="number"?Zv[x]||`Code${x}`:"Unknown",N=I?.extra?.backendErrorCode??I?.backendErrorCode,L=N===7773?" Payment gateway communication error. Ensure Stripe is connected in RevenueCat Web Billing and the subscription has Web pricing.":"";throw new Error(`Subscription purchase failed (${D}${typeof x=="number"?` ${x}`:""}${N?` | backend ${N}`:""}).${L}`)}},[i,b,d]),R=v.useCallback(async()=>{if(!i)throw new Error("RevenueCat not ready");let A=Ni();if(!A?.getCustomerInfo||!A?.syncPurchases)try{await _f(),A=Ni()}catch{}try{const C=await A?.getCustomerInfo?.();if(!A?.syncPurchases)throw new Error("Restore Purchases not initialized");await A?.syncPurchases(),d()}catch(C){Yw("[RC] restorePurchases",C);const O=C?.getErrorCode?.()??C?.errorCode??C?.code,I=typeof O=="number"?Zv[O]||`Code${O}`:"Unknown",x=C?.extra?.backendErrorCode??C?.backendErrorCode;throw new Error(`Restore failed (${I}${typeof O=="number"?` ${O}`:""}${x?` | backend ${x}`:""}).`)}},[i,d]),P=v.useMemo(()=>({rc:n,ready:i,error:c,buyChips:E,buySubscription:T,restorePurchases:R}),[n,i,c,E,T,R]);return g.jsx(sF.Provider,{value:P,children:t})}function Vre(){return v.useContext(sF)}function Hre({viral:t,onClose:e}){return t?g.jsx("div",{className:"viral-container",children:g.jsxs("div",{className:"viral-content",children:[g.jsx("img",{src:t.preview,alt:"Preview",className:"viral-preview",style:{width:t.width,height:t.height}}),g.jsx("video",{src:t.url,autoPlay:!0,loop:!0,muted:!0,className:"viral-video",style:{width:t.width,height:t.height}})]})}):null}const Gre=0,Wre=1800,sa={diceRevealDelayMs:Gre,diceSettleClientMs:Wre,fairnessVerifyDelayMs:120,diceToChipDelayMs:1800,chipFlyDurationMs:900,chipStaggerMs:180,chipPostBufferMs:120,scrollNextDelayMs:600,scrollRoundEndDelayMs:1600,scrollMinWaitForChips:!0,betSnapshotDelayMs:100,balanceDelayMs:500,settledAllDelayMs:100,mySettledDelayMs:100,settleDetectDelayMs:50,flash:{baseMs:1e3,winMs:3500,ceeLoShortMs:1500},revealFlashPostDelayMs:100};let fv=null;async function oF(){if(fv)return fv;const t=await qr(()=>import("./lottie-C6W9EJ3M.js").then(e=>e.l),[],import.meta.url);return fv=t?.default&&t.default.loadAnimation?t.default:t,fv}let pv=null,hv=null;async function jT(t){if(t==="win"&&pv)return pv;if(t==="lose"&&hv)return hv;if(t==="win"){const e=await qr(()=>import("./winning-lottie-NODzSKgp.js"),[],import.meta.url);return pv=e.default||e,pv}else{const e=await qr(()=>import("./lose-lottie-DRt9PYrq.js"),[],import.meta.url);return hv=e.default||e,hv}}const oP=v.createContext(null),Kre={win:void 0,lose:void 0,push:void 0,roll:void 0,info:void 0},Yre=typeof window<"u"&&window.requestIdleCallback||(t=>setTimeout(t,50));function Xre(){if(typeof navigator>"u")return!1;const t=navigator.userAgent||"",e=navigator;return/iP(ad|hone|od)/.test(t)||e.platform==="MacIntel"&&e.maxTouchPoints>1}function rN(){Yre(async()=>{try{await oF(),await Promise.allSettled([jT("win"),jT("lose")])}catch{}})}function nN(){try{const t=document?.body,e=!!t?.classList?.contains("page-poker-room"),r=!!document.querySelector(".mode-craps"),n=!!(t?.classList?.contains("page-gameroom")&&!r);return{isPoker:e,isCraps:r,isCeeLo:n}}catch{return{isPoker:!1,isCraps:!1,isCeeLo:!1}}}function Jre(t,e,r,n){return typeof e=="boolean"?e:n?!1:t==="lose"&&typeof r!="number"}function Qre(t,e){if(!t)return!1;const r=t.kind==="roll"&&typeof t.title=="string"&&/\bpoint\b/i.test(t.title||""),n=t.kind==="roll"&&typeof t.title=="string"&&/\bbanker\b/i.test(t.title||"")&&/\bpoint\b/i.test(t.title||"");return e.isPoker||e.isCraps&&(t.kind==="win"||t.kind==="lose"||r)||e.isCeeLo&&(t.kind==="win"||t.kind==="lose"||t.kind==="push"||n)}function Zre(){try{return document.querySelector(".card-header.card-header--two-rows")}catch{return null}}function Xw(t){if(typeof t!="string")return t;const e=t,r=[];let n=0;for(let a=0;a<e.length;a++){const i=e[a];if(i==="Z"||i==="z"){let o=a+1;for(;o<e.length&&(e[o]===" "||e[o]===" "||e[o]===" ");)o++;if(o<e.length&&/\d/.test(e[o])){r.push(g.jsx("span",{style:{textTransform:"none"},children:"z"},`z-${a}-${n++}`));continue}}r.push(i)}return g.jsx(g.Fragment,{children:r})}function ene(){v.useEffect(()=>{if(rN(),typeof window>"u")return;const t=()=>{rN(),window.removeEventListener("touchstart",t,!0),window.removeEventListener("pointerdown",t,!0)};return window.addEventListener("touchstart",t,!0),window.addEventListener("pointerdown",t,!0),()=>{window.removeEventListener("touchstart",t,!0),window.removeEventListener("pointerdown",t,!0)}},[])}function tne(t,e,r){v.useEffect(()=>{if(typeof e!="number"||e<0)return;const n=window.setTimeout(()=>r(),e);return()=>window.clearTimeout(n)},[e,r])}function rne(t){v.useEffect(()=>{let e=!1;const r=async()=>{try{if(!Ax())try{await Xr()}catch{}const a=t==="win"?["winDing","win"]:t==="lose"?["lose"]:t==="push"?["push"]:[];if(a.length){try{rp(a)}catch{}try{await D_(a,600)}catch{}}if(e)return;t==="lose"?DG({volume:.06}):t==="win"?NG({volume:.25}):t==="push"&&OG({volume:.04})}catch{}},n=window.setTimeout(()=>{r()},10);return()=>{e=!0,window.clearTimeout(n)}},[t])}function nne(t){const{enabled:e,kind:r,targetRef:n,animationData:a,fallbackMap:i,isIOS:o,onComplete:c}=t,u=v.useRef(null);v.useEffect(()=>{if(!e||r!=="win"&&r!=="lose")return;let d=!1;return(async()=>{try{const f=await oF(),h=a||(r?i[r]:void 0)||await jT(r);if(d||!n.current||!h)return;u.current=f.loadAnimation({container:n.current,renderer:o?"canvas":"svg",autoplay:!0,loop:!1,animationData:h,subframe:!1,rendererSettings:{progressiveLoad:!0,hideOnTransparent:!0,preserveAspectRatio:"xMidYMid meet",dpr:Math.min(window.devicePixelRatio||1,1.5)}}),c&&u.current.addEventListener("complete",c)}catch{}})(),()=>{d=!0;try{c&&u.current&&u.current.removeEventListener?.("complete",c),u.current?.destroy()}catch{}u.current=null,n.current&&(n.current.innerHTML="")}},[e,r,a,i,o,c,n])}function ane({item:t,onDone:e,animations:r,zIndex:n}){const a=v.useRef(null),i=v.useRef(null),[o,c]=v.useState("enter"),u=v.useRef(!1),d=v.useCallback(()=>{u.current||(u.current=!0,e(t.id))},[e,t.id]),f=v.useCallback(()=>{c("leave"),window.setTimeout(d,320)},[d]);rne(t.kind),tne(t.id,t.duration,f);const h=v.useMemo(Xre,[]),m=t.kind==="win"||t.kind==="lose";nne({enabled:m,kind:t.kind,targetRef:i,animationData:t.animationData,fallbackMap:r,isIOS:h,onComplete:m&&t.autoDismissOnComplete?()=>{f()}:void 0});const _=t.title&&typeof t.title=="string"&&t.title.includes(":")?(()=>{const b=t.title.indexOf(":"),E=t.title.slice(0,b).trim(),T=t.title.slice(b+1).trim();return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"flash-title__name",children:E}),g.jsx("span",{className:"flash-title__rest",children:Xw(T)})]})})():Xw(t.title),w=typeof t.title=="string"&&/\bbanker\b/i.test(t.title)?{opacity:.9}:void 0;return g.jsxs("div",{ref:a,className:["flash-card",`flash-${t.kind??"info"}`,o==="leave"?"leave":o==="steady"?"steady":"enter"].join(" "),role:"status","data-testid":"flash-card","data-flash-kind":t.kind??"info",onClick:()=>t.dismissible&&f(),onAnimationEnd:b=>{b.target===a.current&&(o==="enter"&&c("steady"),o==="leave"&&d())},onTransitionEnd:b=>{b.target===a.current&&o==="leave"&&d()},style:{pointerEvents:"auto",zIndex:n},children:[(t.kind==="lose"||t.kind==="win")&&g.jsx("div",{className:"flash-lottie",ref:i}),t.icon&&g.jsx("div",{className:"flash-icon","aria-hidden":!0,children:t.icon}),g.jsxs("div",{className:"flash-body",children:[t.title&&g.jsx("div",{className:"flash-title"+(typeof t.title=="string"&&/\bbanker\b/i.test(t.title)?" flash-title--banker":""),"data-testid":"flash-title",style:w,children:_}),t.subtitle&&g.jsx("div",{className:"flash-subtitle","data-testid":"flash-subtitle",children:Xw(t.subtitle)}),t.viral&&g.jsx(Hre,{viral:t.viral,onClose:()=>{}})]})]})}function ine({children:t,baseDurationMs:e=sa.flash.baseMs}){const[r,n]=v.useState([]),a=v.useRef(new Set),i=v.useRef({...Kre});ene();const o=v.useCallback(m=>{n(_=>_.filter(w=>w.id!==m))},[]),c=v.useCallback(()=>{n([])},[]),u=v.useCallback(m=>{i.current={...i.current,...m}},[]),d=v.useCallback(m=>{const _=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`,b=(typeof document<"u"?nN():{isCeeLo:!1}).isCeeLo,E=typeof m.duration=="number"?m.duration:b&&(m.kind==="win"||m.kind==="lose")?sa.flash.ceeLoShortMs:m.kind==="win"?sa.flash.winMs:e,T={id:_,dismissible:!0,autoDismissOnComplete:Jre(m.kind,m.autoDismissOnComplete,m.duration,b),...m,duration:E};try{const R=typeof location<"u"?new URLSearchParams(location.search):null;if(R&&R.get("flashDebug")==="1")try{localStorage.setItem("debug:flashes","1")}catch{}const A=!!(typeof window<"u"?window:void 0)?.FLASH_DEBUG||typeof localStorage<"u"&&localStorage.getItem("debug:flashes")==="1"}catch{}if(m.kind==="info"||m.kind==="roll")try{PG({volume:.15})}catch{}return n(R=>[...R,T]),_},[e]);v.useEffect(()=>{if(r.length!==0||!a.current.size)return;const m=Array.from(a.current);a.current.clear(),m.forEach(_=>{try{_()}catch{}})},[r.length]);const f=v.useMemo(()=>({show:d,roll:(m,_)=>d({kind:"roll",title:m,subtitle:_}),rollNow:(m,_)=>d({kind:"roll",title:m,subtitle:_}),win:(m,_,w,b)=>d({kind:"win",title:m,subtitle:_,viral:w,animationData:b}),lose:(m,_,w,b)=>d({kind:"lose",title:m,subtitle:_,viral:w,animationData:b}),push:(m,_,w,b)=>d({kind:"push",title:m,subtitle:_,viral:w,animationData:b}),info:(m,_)=>d({kind:"info",title:m,subtitle:_}),infoNow:(m,_)=>d({kind:"info",title:m,subtitle:_}),dismiss:o,clear:c,setFlashAnimations:u,activeKind:r.length?r[r.length-1]?.kind:void 0,hasActive:r.length>0,onIdle:m=>{r.length===0?setTimeout(m,0):a.current.add(m)}}),[d,o,c,u,r.length]),h=v.useMemo(()=>{if(typeof document>"u")return null;const m=nN(),_=Zre();return r.map((w,b)=>{const T=Qre(w,m)&&_?_:document.body,R=T!==document.body,P=2e3+b;return Gc.createPortal(g.jsxs("div",{className:"flash-root"+(R?" flash-root--header":""),"aria-live":"polite","data-testid":"flash-overlay-root",children:[g.jsx(ane,{item:w,onDone:o,animations:i.current,zIndex:P}),g.jsx("div",{className:"flash-backdrop"})]},w.id),T)})},[r,o]);return g.jsxs(oP.Provider,{value:f,children:[t,h]})}function Es(){const t=v.useContext(oP);if(!t)throw new Error("useFlashOverlay must be used within <FlashOverlayProvider>");return t}function cP(){const t=v.useContext(oP);if(t)return t;const e=()=>{},r=()=>"";return{show:r,roll:r,rollNow:e,win:e,lose:e,push:e,info:e,infoNow:e,dismiss:e,clear:e,setFlashAnimations:e,activeKind:void 0,hasActive:!1,onIdle:e}}const aN=g3,sne=y3,one=v3,cne=Q7,iN=_3;function jg(){const{user:t,refreshUser:e}=$r(),{rc:r,ready:n,error:a,buyChips:i,buySubscription:o,restorePurchases:c}=Vre(),{infoNow:u}=Es(),[d,f]=v.useState(!1),[h,m]=v.useState(!1),[_,w]=v.useState(!1),[b,E]=v.useState(!1),[T,R]=v.useState(!1),[P,A]=v.useState(void 0),[C,O]=v.useState(void 0),[I,x]=v.useState(void 0),[D,N]=v.useState(void 0),[L,j]=v.useState(void 0),[q,U]=v.useState(void 0),[W,F]=v.useState(!1),Y=Gr.getPlatform()==="web",Q=ci(),ie=!0,G=v.useMemo(()=>r?.Purchases,[r]);v.useCallback(ue=>ue?.all?.[aN]?ue.all[aN]:ue?.current||ue?.all?.default||null,[]);const B=v.useCallback(async()=>{try{const Ae=await Ni()?.getCustomerInfo?.();let He=!1;const ce=Ae?.entitlements?.active||{},xe=Object.keys(ce).length>0;iN&&(He=!!ce?.[iN]||xe),R(He)}catch{}},[G,ie]);v.useEffect(()=>{n&&ie&&B()},[n,ie,B]),v.useEffect(()=>{if(!n||!ie)return;let ue=0;const Ae=6,He=setInterval(()=>{ue+=1,B(),ue>=Ae&&clearInterval(He)},500);return()=>clearInterval(He)},[n,ie,B]),v.useEffect(()=>{let ue=!1;return(async()=>{try{if(!n||!ie)return;const He=await Ni()?.getOfferings?.();if(!He)return;const ce=[],xe=We=>{Array.isArray(We)&&We.forEach(it=>{it&&ce.push(it)})};xe(He?.current?.availablePackages||He?.current?.packages),He?.all&&Object.values(He.all).forEach(We=>xe(We?.availablePackages||We?.packages));const re=We=>We?.identifier||We?.product?.identifier||We?.rcBillingProduct?.identifier||We?.webBillingProduct?.identifier,H=We=>We?.product||We?.rcBillingProduct||We?.webBillingProduct||We,he=We=>{const it=H(We);return!!(We?.packageType==="MONTHLY"||We?.packageType==="ANNUAL"||it?.subscriptionPeriod||it?.period||it?.defaultSubscriptionOption||it?.productType&&/subscription/i.test(String(it.productType)))},Re=We=>We?.priceString||We?.price?.formattedPrice||We?.currentPrice?.formattedPrice||We?.price||We?.defaultPurchaseOption?.basePrice?.formattedPrice,fe=We=>String(We?.title||We?.displayName||""),Ie=We=>String(We?.description||""),ct=We=>We?ce.find(it=>re(it)===We):void 0;let $e=ct(sne)||ct(one);if($e||($e=ce.find(We=>!he(We))),$e){const We=H($e),it=Re(We),Et=fe(We),Mt=Ie(We),_t=String(re($e)||""),ge=De=>{const nt=De.match(/\b(\d{1,3}(?:[\,\._\s]\d{3})*|\d{2,})\b/);if(!nt)return null;const at=nt[1].replace(/[\._\s,]/g,""),we=parseInt(at,10);return Number.isFinite(we)?we:null},Be=ge(Et)??ge(Mt)??ge(_t),je=Be&&Be>0?Be:void 0,rt=je?new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(je):void 0,Ct=rt?`z${rt}`:"Z Credits",jt=it?`${Ct} for ${it}`:void 0;ue||A(jt),ue||x("Top up your Z Credits to keep playing.")}let tt=ct(cne);if(tt||(tt=ce.find(Et=>Et?.packageType==="MONTHLY"||/month/i.test(String(re(Et)||""))||/month/i.test(fe(H(Et))))||ce.find(Et=>he(Et)||/year|annual|week|month/i.test(String(re(Et)||"")))),ue||F(!!tt),tt){const We=H(tt),it=Re(We),Et=it?`${it} Mo`:void 0;if(ue||O(Et),ue||N("Remove ads and unlock premium features."),ue||j(it),!ue){let Mt="Auto-renewing";const _t=tt?.packageType||We?.subscriptionPeriod||We?.period||We?.defaultSubscriptionOption?.period,ge=String(_t||"").toUpperCase();ge.includes("MONTH")||ge==="MONTHLY"||ge==="P1M"?Mt="Monthly":ge.includes("YEAR")||ge==="ANNUAL"||ge==="P1Y"?Mt="Annual":ge.includes("WEEK")||ge==="WEEKLY"||ge==="P1W"?Mt="Weekly":(ge.includes("DAY")||ge==="P1D")&&(Mt="Daily"),U(Mt)}}}catch{}})(),()=>{ue=!0}},[n,ie,G]);const K=async()=>{if(!t?.id){try{u("Login required","Please sign in to buy credits.")}catch{}return}if(!d){if(f(!0),m(!0),!n){u("Purchases initializing…","Please try again in a moment."),m(!1),f(!1);return}try{await i(),u("Purchase complete","Chips will appear shortly.")}catch(ue){let Ae=ue?.message||"Purchase unavailable right now. Please try again shortly.";try{const He=ue?.getErrorCode?.()??ue?.errorCode??ue?.code,ce=typeof He=="number"?He===3?"PurchaseNotAllowedError":He===2?"StoreProblemError":He===5?"ProductNotAvailableForPurchaseError":void 0:void 0;ce==="PurchaseNotAllowedError"?Ae="Purchases not allowed for this Apple ID/device. Use an App Store sandbox account and ensure the Paid Apps Agreement is accepted.":ce==="StoreProblemError"?Ae="App Store is currently unavailable. Please try again later or verify sandbox account is signed in to the device.":ce==="ProductNotAvailableForPurchaseError"&&(Ae="Product not available. Verify the product identifier matches App Store Connect and RevenueCat configuration for this app target.")}catch{}u("Purchase failed",Ae)}finally{m(!1),f(!1)}}},ae=async()=>{if(t?.id&&!d){if(f(!0),w(!0),!n){try{u("Purchases initializing…","Please try again in a moment.")}catch{}try{await(await qr(async()=>{const{reconfigureRevenueCat:ue}=await Promise.resolve().then(()=>Ure);return{reconfigureRevenueCat:ue}},void 0,import.meta.url)).reconfigureRevenueCat()}catch{}w(!1),f(!1);return}try{await o(),await B(),u("Subscription active","Thanks for supporting.")}finally{w(!1),f(!1)}}},te=async()=>{if(t?.id&&!d){if(f(!0),E(!0),!n)throw new Error("Payment service not ready");await c(),await B();try{const ue=await oi();ue&&await fetch(`${Q}/api/payment/revenuecat/restore`,{method:"POST",headers:{Authorization:`Bearer ${ue}`}})}catch{}try{await e()}catch{}try{setTimeout(()=>{e().catch(()=>{})},800)}catch{}try{setTimeout(()=>{e().catch(()=>{})},2e3)}catch{}u("Restored purchases","Your purchases have been restored."),E(!1),f(!1)}},me=v.useMemo(()=>!n||!ie?"Initializing…":T?"Premium Active":"Go Premium",[T,n,ie]);return{ready:n,error:a||null,busy:d,busyChips:h,busySubscription:_,premiumActive:T,hasPremiumPackage:W,premiumLabel:me,purchasesReady:ie,isWeb:Y,onBuyChips:K,onGoPremium:ae,onRestore:te,chipsSubtitle:P,premiumSubtitle:C,chipsDescription:I,premiumDescription:D,premiumPrice:L,premiumInterval:q}}var lm;(function(t){t.Heavy="HEAVY",t.Medium="MEDIUM",t.Light="LIGHT"})(lm||(lm={}));var sN;(function(t){t.Success="SUCCESS",t.Warning="WARNING",t.Error="ERROR"})(sN||(sN={}));const Kh=to("Haptics",{web:()=>qr(()=>import("./web-J2crsmx3.js"),[],import.meta.url).then(t=>new t.HapticsWeb)}),lne={Light:lm.Light,Medium:lm.Medium,Heavy:lm.Heavy},une={Light:10,Medium:20,Heavy:35};async function cd(t="Light"){try{await Kh.impact({style:lne[t]});return}catch{}try{navigator.vibrate?.(une[t])}catch{}}function cr(t="Light"){cd(t)}async function cF(){try{if(Kh?.selectionStart){await Kh.selectionStart(),await Kh.selectionChanged(),await Kh.selectionEnd();return}}catch{}await cd("Light")}const dne=Object.freeze(Object.defineProperty({__proto__:null,hapticClick:cr,hapticImpact:cd,hapticSelection:cF},Symbol.toStringTag,{value:"Module"}));function lP({isPremium:t,className:e}){const[r,n]=v.useState(!1),{onGoPremium:a,busy:i,ready:o,purchasesReady:c}=jg();if(!t)return null;const u=async()=>{try{n(!0);try{cr("Light")}catch{}await a()}finally{n(!1)}};return g.jsx("button",{className:e||"felt-btn","data-no-global-haptic":!0,onClick:u,disabled:r||i||!o||!c,"aria-busy":r||i,title:"Manage your subscription",children:r||i?"Processing…":"Manage"})}function lF({open:t,onClose:e,featureDescription:r}){const{user:n}=$r(),{onGoPremium:a,onRestore:i,busy:o,premiumActive:c,hasPremiumPackage:u,premiumLabel:d,error:f,ready:h,purchasesReady:m,premiumPrice:_,premiumInterval:w}=jg(),b=tn(),{infoNow:E}=Es(),T=async()=>{if(!n?.id){try{b("/login")}catch{}try{e?.()}catch{}return}if(!(c||o))try{if(await a(),!c)return;e()}catch(A){const C=A?.message||"Purchases are initializing… please try again in a moment.";try{E("Purchase unavailable",C)}catch{}}};if(!t)return null;const R=!!n?.id,P="$1.99";return g.jsx("div",{className:"modal-overlay",children:g.jsxs("div",{className:"modal",children:[g.jsx("button",{className:"modal-close","aria-label":"Close",onClick:e,children:"×"}),g.jsx("h3",{children:c?"Premium Active":`Go Premium for ${P}/mo!`}),g.jsx("p",{children:c?"Your premium membership is active.":r||"Creating rooms is a premium feature. Upgrade to unlock it and more."}),!c&&u&&g.jsx("button",{className:"gold-btn felt-btn",onClick:T,disabled:o,children:R?o?"Processing…":d:"Sign in to Upgrade"}),c&&g.jsx("div",{style:{marginTop:12},children:g.jsx(lP,{isPremium:!0})}),!c&&u&&g.jsxs("p",{className:"meta",style:{fontSize:12,opacity:.85},children:[g.jsx("strong",{children:"Premium Subscription"})," — ",_?`${_} `:P+" ",w?`(${w})`:"(Monthly)",". Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",g.jsx("a",{href:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",g.jsx("a",{href:"/terms",className:"legal-link",children:"Terms of Use"}),"."]}),f&&g.jsx("p",{className:"error",role:"alert",children:f}),!c&&u&&g.jsx("div",{style:{marginTop:8},children:g.jsx("button",{type:"button",className:"gold-link",onClick:i,disabled:!R||o||!h||!m,"aria-label":"Restore Purchases",title:"Restore Purchases",children:"Restore Purchases"})}),!R&&!c&&g.jsx("p",{className:"meta",children:"Please sign in to upgrade."}),!R&&f&&g.jsx("p",{className:"meta",children:"Purchases unavailable while signed out."})]})})}function uP({open:t,onClose:e,title:r,tagline:n,steps:a,primaryLabel:i,persistKey:o="seenOnboardingV1",secondaryLabel:c="Log In",onSecondary:u,targetSelector:d=".home-mode-toggle-row",coachText:f="Pick a game mode"}){const h=tn(),{user:m,loading:_}=$r(),w=v.useMemo(()=>{if(_)return!1;const A=m?.email||"";return!A||/@guest\.local$/i.test(A)},[m?.email,_]),b=v.useCallback(()=>{try{o&&ms.set({key:o,value:"1"})}catch{}e()},[e,o]);v.useEffect(()=>{if(!t)return;function A(C){C.key==="Escape"&&b()}return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[t,b]);const[E,T]=v.useState(null),R=v.useCallback(()=>{try{if(!t){T(null);return}const A=d?document.querySelector(d):null;if(!A){T(null);return}const C=A.getBoundingClientRect();T({top:C.top,left:C.left,width:C.width,height:C.height})}catch{T(null)}},[t,d]);if(v.useLayoutEffect(()=>{R()},[R]),v.useEffect(()=>{if(!t)return;const A=()=>R(),C=()=>R();window.addEventListener("resize",A),window.addEventListener("scroll",C,!0);const O=setInterval(R,400);return()=>{window.removeEventListener("resize",A),window.removeEventListener("scroll",C,!0),clearInterval(O)}},[t,R]),v.useEffect(()=>{if(t)try{(()=>{try{return!!(window.__E2E===!0||typeof window.location?.search=="string"&&window.location.search.includes("e2e=1")||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")}catch{return!1}})()&&(o&&ms.set({key:o,value:"1"}),setTimeout(()=>{try{e()}catch{}},0))}catch{}},[t,e,o]),!t)return null;const P=Array.isArray(a)&&a.length?a:["Create or join a room","Place bets, roll dice, or deal cards","Win chips and share the fun"];return g.jsxs("div",{className:"onb-modal",role:"dialog","aria-modal":"true","aria-label":"Welcome to Dice Lounge",children:[g.jsx("div",{className:"onb-backdrop",onClick:b}),g.jsxs("div",{className:"onb-card",onClick:A=>A.stopPropagation(),children:[g.jsxs("header",{className:"onb-header",children:[g.jsx("h2",{className:"onb-title",children:r||"Dice Lounge"}),g.jsx("p",{className:"onb-tagline",children:n||"Roll, chat, and play with friends."})]}),g.jsx("ol",{className:"onb-steps","aria-label":"Getting started steps",children:P.map((A,C)=>g.jsx("li",{className:"onb-step",children:A},C))}),g.jsx("div",{className:"onb-cta-row",children:c&&w&&g.jsx("button",{type:"button",className:"onb-btn onb-btn--ghost felt-btn",onClick:u||(()=>h("/login")),children:c})})]}),E&&g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"onb-highlight","aria-hidden":!0,style:{top:Math.max(0,E.top-8),left:Math.max(0,E.left-8),width:E.width+16,height:E.height+16}}),g.jsx("div",{className:"onb-coachmark",role:"note","aria-label":f,style:{top:Math.max(0,E.top-14),left:E.left+E.width/2},children:g.jsx("span",{className:"onb-coachmark__label",children:f})})]})]})}const oN=""+new URL("logo-XCMDZE3A.png",import.meta.url).href,fne=""+new URL("logo-256-CalulGNO.webp",import.meta.url).href,pne=""+new URL("logo-420-D7JbtaQr.webp",import.meta.url).href,hne=""+new URL("logo-256-BQd-RHpb.avif",import.meta.url).href,mne=""+new URL("logo-420-CxzlrsyU.avif",import.meta.url).href;function uF({width:t=180,height:e=180,tagline:r="Play. Roll. Win. Together!",className:n=""}){const a="poker";let i="";try{i=window?.APP_TARGET??""}catch{}const o=String(a).toLowerCase(),c=o==="cee-lo"?"ceelo":o,u=c==="craps"||c==="poker"||c==="ceelo",d=o==="poker"?"Zentara One Poker Lounge":o==="craps"?"Zentara One Craps Lounge":"Zentara One Dice Lounge";return g.jsxs("div",{className:`logo-hero ${n}`,"data-testid":"logo-hero",children:[u?g.jsxs("picture",{children:[g.jsx("source",{type:"image/webp",srcSet:"./icon-512.webp",sizes:"(max-width: 600px) 60vw, 420px"}),g.jsx("img",{width:t,height:e,src:"./icon.png",alt:d,decoding:"async",loading:"eager",fetchPriority:"high",style:{maxWidth:"100%",height:"auto"},onError:m=>{try{m.currentTarget.src=oN}catch{}}})]}):g.jsxs("picture",{children:[g.jsx("source",{type:"image/avif",srcSet:`${hne} 256w, ${mne} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),g.jsx("source",{type:"image/webp",srcSet:`${fne} 256w, ${pne} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),g.jsx("img",{width:t,height:e,src:oN,alt:d,decoding:"async",loading:"eager",fetchPriority:"high",sizes:"(max-width:600px) 60vw, 420px",style:{maxWidth:"100%",height:"auto"}})]}),r&&g.jsx("span",{className:"gold-link",children:r})]})}function dF({onClose:t}){const[e,r]=v.useState("cee-lo"),n=()=>g.jsxs("div",{className:"howto__toggle",role:"tablist","aria-label":"Select ruleset",children:[g.jsx("button",{type:"button",role:"tab","aria-selected":e==="cee-lo","aria-pressed":e==="cee-lo",onClick:()=>{r("cee-lo")},className:"felt-btn"+(e==="cee-lo"?" felt-btn--active":""),children:"Cee‑Lo"}),g.jsx("button",{type:"button",role:"tab","aria-selected":e==="craps","aria-pressed":e==="craps",onClick:()=>{r("craps")},className:"felt-btn"+(e==="craps"?" felt-btn--active":""),children:"Craps"}),g.jsx("button",{type:"button",role:"tab","aria-selected":e==="poker","aria-pressed":e==="poker",onClick:()=>{r("poker")},className:"felt-btn"+(e==="poker"?" felt-btn--active":""),children:"Poker"})]}),a=g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Overview"}),g.jsx("p",{children:"This is a banker‑versus‑challengers dice game inspired by Cee‑Lo. Each round, the banker rolls first to set the banker outcome. Then challengers roll in turn and compare against the banker. You can place main bets against the banker and optional side bets on other players."})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Single‑Player Mode"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"No tap needed to roll:"})," After you place a MAIN bet, the server will automatically roll for the banker and then for you. This keeps play smooth on mobile."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Place a MAIN bet to begin:"})," The banker won’t roll until there’s at least one open MAIN bet for the round."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Auto pacing:"})," Rounds settle automatically and the next round starts after a short buffer."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Bet window:"})," MAIN bets are open before the banker scores; once the banker establishes a point, MAIN bets lock for the round."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Round Flow"}),g.jsxs("ol",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Banker sets the roll:"})," The banker rolls until they have a scoring result."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Challengers roll:"})," Each challenger rolls once a banker score exists."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Settle:"})," Wagers settle automatically with chip animations and a result flash."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Dice Scoring"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"456 (banker only):"})," Banker wins against everyone (auto‑win)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"123 (banker only):"})," Banker fails/pass this round (auto‑lose / pass)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Triples:"})," Three of a kind beats any point (higher triple beats lower)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Point:"})," A pair plus a singleton sets a point equal to the singleton value (1–6). Higher point wins."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Nothing:"})," No pair/triple and not 123/456 — banker re‑rolls; challenger non‑score."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Challenger 123/456:"})," Treated as a normal point (no auto outcome for challengers)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Tie:"})," Push (stake returned)."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Main Bets (vs Banker)"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Main bet wins if your roll outranks banker, loses if lower, pushes if equal."}),g.jsx("li",{children:"Banker auto results (456 / 123) settle immediately with no legacy sweep animation."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Side Bets"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Create offers on another player’s upcoming roll (e.g. “Under 4 on Alex”)."}),g.jsx("li",{children:"Only non‑subject players may accept; creator & subject excluded."}),g.jsx("li",{children:"Offer can be canceled until the subject rolls."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Visual Feedback"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Chip flights represent transfers; flashes show WIN / LOSE / PUSH."}),g.jsx("li",{children:"Push flashes appear shortly after resolution to keep pacing consistent."}),g.jsx("li",{children:"Haptics fire for meaningful outcomes (supported devices)."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Tips"}),g.jsxs("ul",{children:[g.jsx("li",{children:"High banker point (5 or 6) reduces challenger EV—size bets accordingly."}),g.jsx("li",{children:"Track patterns with the history view; variance can mask true edge short‑term."})]})]})]}),i=g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Overview"}),g.jsx("p",{children:"Multiplayer Craps implementation (current scope: Pass / Don’t Pass line bets and Place bets on 4,5,6,8,9,10). Additional bet families (Come / Don’t Come, Odds, Field, Big 6/8, Props) will roll out progressively. Settlement & animation pipeline matches other games: each resolved bet triggers chip flight(s) then a result flash."}),g.jsxs("p",{className:"howto__note howto__note--small",children:[g.jsx("b",{children:"Current Limitation:"})," Field, Big 6/8, Come/Dont Come, Odds buttons may appear as educational UI but only Pass / Don’t Pass and Place bets settle right now."]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Table Flow"}),g.jsxs("ol",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Come‑Out Roll:"})," Shooter rolls with no point established."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Point Set:"})," First 4,5,6,8,9,10 rolled (unless 7/11/2/3/12 resolves line bets) becomes the point."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Point Phase:"})," Shooter keeps rolling until point repeats (Pass wins) or a 7 appears (Don’t Pass wins / seven‑out)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Shooter Rotation:"})," On seven‑out (or configured rotation rule) the dice pass to next player in order."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Pass / Don’t Pass Rules"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Come‑Out:"})," 7 or 11 = Pass win; 2 or 3 = Pass lose (Don’t Pass win); 12 = Pass lose, Don’t Pass push (bar 12)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Point Phase:"})," Pass wins if point repeats before 7; Don’t Pass wins on 7 before point."]}),g.jsx("li",{children:"Payout: Even money (winning line bet returns principal + equal winnings; push returns principal)."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Place Bets (Implemented)"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Available only after a point is established."}),g.jsx("li",{children:"Remain on the table until a 7 (seven‑out) or player removes them (UI removal support pending future update)."}),g.jsx("li",{children:"Payout ratios (winnings only; principal stays): 4/10: 9:5 • 5/9: 7:5 • 6/8: 7:6."}),g.jsx("li",{children:"On seven‑out all active place bets lose and are cleared."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Coming Soon"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Odds Bets:"})," True odds behind line & come bets (no house edge)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Come / Don’t Come:"})," Independent points established after the main point."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Field & Big 6/8:"})," One‑roll (Field) and even‑money (Big) bets with proper settlement."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Prop / Horn:"})," Center action (yo, any 7, craps, hardways) with single‑roll or multi‑roll resolution."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Readiness & Rolling"}),g.jsxs("ul",{children:[g.jsx("li",{children:"All players mark Ready between rolls; shooter auto‑ready on new shooter assignment."}),g.jsx("li",{children:"Countdown deadline (if shown) enforces timely rolls; expired deadlines may auto‑roll in later phases."}),g.jsx("li",{children:"Shooter must have an active Pass (or Don’t Pass if allowed by table config) before rolling."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Settlement Pipeline"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Server validates roll → computes line & place settlements → emits results → credits balances."}),g.jsx("li",{children:"Line WIN: principal + winnings credited. Line PUSH: principal only. Place WIN: winnings only (bet stays)."}),g.jsx("li",{children:"Seven‑out triggers removal of all unresolved place bets (auto clear broadcast)."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Payout Reference"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Pass / Don’t Pass:"})," 1:1"]}),g.jsxs("li",{children:[g.jsx("b",{children:"Place 4 / 10:"})," 9:5"]}),g.jsxs("li",{children:[g.jsx("b",{children:"Place 5 / 9:"})," 7:5"]}),g.jsxs("li",{children:[g.jsx("b",{children:"Place 6 / 8:"})," 7:6"]})]}),g.jsx("p",{className:"howto__note howto__note--tiny",children:"Fractions floored in current build; rounding rules may refine later."})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Strategy Notes (Basics)"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Place 6 & 8 have the lowest house edge among implemented place bets."}),g.jsx("li",{children:"Even‑money Pass vs Don’t Pass is preference until odds arrive (future true‑odds leverage)."}),g.jsx("li",{children:"Avoid overexposing bankroll pre‑odds: variance on early seven‑outs can be sharp."})]})]})]}),o=g.jsxs(g.Fragment,{children:[g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Overview"}),g.jsx("p",{children:"No‑limit Texas Hold’em with simplified pacing. Hands proceed through Pre‑flop, Flop, Turn, River, then Showdown. Seats auto‑order left of the dealer button. Side pots and all‑in handling are automatic. Bots may fill seats in single‑player rooms."}),g.jsxs("p",{className:"howto__note howto__note--small",children:[g.jsx("b",{children:"Table Defaults:"})," Small blind 5, big blind 10, minimum buy‑in z1000, up to 6 seats."]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Buy‑In & Seating"}),g.jsxs("ul",{children:[g.jsxs("li",{children:["Joining a poker room requires at least ",g.jsx("b",{children:"z1000"})," balance (server‑enforced)."]}),g.jsx("li",{children:"When seated, your starting stack equals the minimum buy‑in (z1000)."}),g.jsx("li",{children:"Bots, when present, are seated with z1000 stacks."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Blinds & Turn Order"}),g.jsxs("ul",{children:[g.jsx("li",{children:"The dealer button rotates each hand. Players post small blind and big blind to start the pot."}),g.jsx("li",{children:"Pre‑flop action begins left of the big blind; on later streets it begins left of the button."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Actions"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Fold"})," — Surrender your hand; no further claim to the pot."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Check/Call"})," — Match the current bet to continue (or check for free when no bet is outstanding)."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Bet/Raise"})," — Put chips in the pot. Min raise equals the last raise size; UI shows legal targets."]})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Streets & Dealing"}),g.jsxs("ul",{children:[g.jsxs("li",{children:[g.jsx("b",{children:"Pre‑flop:"})," Two private cards to each player."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Flop:"})," Three community cards."]}),g.jsxs("li",{children:[g.jsx("b",{children:"Turn:"})," One community card."]}),g.jsxs("li",{children:[g.jsx("b",{children:"River:"})," One community card."]}),g.jsx("li",{children:"Short UI locks play during dealing animations to keep state consistent."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Pots, All‑In, Side Pots"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Contributions create the main pot and side pots automatically when stacks differ."}),g.jsx("li",{children:"At showdown each pot is awarded to the best eligible hand among its contributors; ties split evenly (with any odd chip distributed deterministically)."})]})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Hand Ranking (Best 5 Cards)"}),g.jsx("ul",{children:g.jsx("li",{children:"Straight Flush (best) → Four of a Kind → Full House → Flush → Straight → Three of a Kind → Two Pair → One Pair → High Card."})})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Showdown"}),g.jsx("ul",{children:g.jsx("li",{children:"Remaining players reveal; best 5‑card hand wins each pot. If everyone else folds, last player takes the pot without showdown."})})]}),g.jsxs("section",{className:"howto__section",children:[g.jsx("h3",{children:"Tips"}),g.jsxs("ul",{children:[g.jsx("li",{children:"Respect position: act later to gather more information."}),g.jsx("li",{children:"Size raises relative to the pot and prior aggression; avoid bet sizing tells."}),g.jsx("li",{children:"Tighten ranges out of position; widen on the button."})]})]})]});return g.jsxs("div",{className:"card how-to-play howto",children:[g.jsx("div",{className:"card-header howto__header",children:g.jsx("div",{className:"howto__header-row",children:g.jsx(n,{})})}),g.jsx("h2",{className:"howto__title",children:"How to Play"}),g.jsxs("div",{className:"card-body howto__body",children:[g.jsxs("div",{role:"note","aria-label":"Disclaimer",className:"howto__disclaimer",children:[g.jsx("strong",{children:"Disclaimer:"})," This is not a real‑money gambling site. No real currency, wagers, or payouts are involved. For entertainment and educational purposes only."]}),e==="cee-lo"?a:e==="craps"?i:o]})]})}function fF({open:t,onClose:e}){const r=v.useRef(null),n="howto-intro";return v.useEffect(()=>{if(!t)return;const a=o=>{o.key==="Escape"&&e()},i=o=>{r.current&&!r.current.contains(o.target)&&e()};return document.addEventListener("keydown",a),document.addEventListener("mousedown",i),()=>{document.removeEventListener("keydown",a),document.removeEventListener("mousedown",i)}},[t,e]),t?g.jsx("div",{className:"modal-backdrop",role:"presentation",children:g.jsxs("div",{className:"modal-panel modal-panel--fullscreen howto-modal",role:"dialog","aria-modal":"true","aria-label":"How to Play","aria-describedby":n,ref:r,children:[g.jsxs("div",{className:"modal-header",children:[g.jsx("h3",{className:"modal-title",children:"How to Play"}),g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"})]}),g.jsxs("div",{id:n,className:"modal-intro",children:[g.jsx("p",{children:"To get started:"}),g.jsxs("ol",{children:[g.jsx("li",{children:"Select a game mode from the Home screen (e.g., Cee‑Lo, Craps, Poker)."}),g.jsx("li",{children:"Then choose your action when it’s your turn (Roll, Place Bet, Pass/Bank, etc.)."})]})]}),g.jsx(dF,{})]})}):null}function gne(){const{user:t}=$r(),[e,r]=v.useState(null),[n,a]=v.useState(!1),[i,o]=v.useState(null),c=ci(),u=v.useCallback(async()=>{if(t){a(!0),o(null);try{const d=await oi(),f=await fetch(`${c}/api/leaderboard/summary`,{credentials:"include",headers:{...d?{Authorization:`Bearer ${d}`}:{},Accept:"application/json"}});if(!(f.headers.get("content-type")||"").includes("application/json")){const _=await f.text();throw new Error(`Unexpected response (${f.status}). Not JSON. First bytes: ${_.slice(0,120)}`)}const m=await f.json();if(m?.ok&&m?.data)r(m.data);else throw new Error(m?.error||"Failed to load leaderboard")}catch(d){o(d?.message??"Failed to load leaderboard")}finally{a(!1)}}},[t]);return v.useEffect(()=>{t&&u()},[t,u]),{data:e,loading:n,error:i,refresh:u}}function yne({open:t,onClose:e}){const{data:r,loading:n,error:a,refresh:i}=gne();return v.useEffect(()=>{t&&i()},[t,i]),t?g.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:e,children:g.jsxs("div",{className:"modal-panel modal-panel--fullscreen leaderboard-modal",role:"dialog","aria-modal":"true","aria-label":"Leaderboards",onClick:o=>o.stopPropagation(),children:[g.jsxs("div",{className:"modal-header",children:[g.jsx("h3",{className:"modal-title",children:"Leaderboards"}),g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"})]}),n&&g.jsx("p",{children:"Loading…"}),a&&g.jsx("p",{className:"error",role:"status",children:a}),r&&g.jsxs("div",{className:"leaderboard-sections",children:[g.jsxs("section",{children:[g.jsx("h4",{children:"Top Balances"}),g.jsx("ol",{className:"lb-list",children:r.topBalances.map(o=>g.jsxs("li",{className:"lb-row",children:[g.jsxs("span",{className:"lb-rank",children:["#",o.rank]}),g.jsx("span",{className:"lb-name",children:o.name}),g.jsxs("span",{className:"lb-metric",children:[o.balance.toLocaleString()," chips"]})]},o.playerId))})]}),g.jsxs("section",{children:[g.jsx("h4",{children:"Weekly Winners"}),g.jsx("ol",{className:"lb-list",children:r.weeklyWinners.map(o=>g.jsxs("li",{className:"lb-row",children:[g.jsxs("span",{className:"lb-rank",children:["#",o.rank]}),g.jsx("span",{className:"lb-name",children:o.name}),g.jsxs("span",{className:"lb-metric",children:["+",o.amount.toLocaleString()," chips"]})]},o.playerId))})]}),g.jsxs("section",{children:[g.jsx("h4",{children:"All‑Time Winners"}),g.jsx("ol",{className:"lb-list",children:r.allTimeWinners.map(o=>g.jsxs("li",{className:"lb-row",children:[g.jsxs("span",{className:"lb-rank",children:["#",o.rank]}),g.jsx("span",{className:"lb-name",children:o.name}),g.jsxs("span",{className:"lb-metric",children:["+",o.amount.toLocaleString()," chips"]})]},o.playerId))})]})]})]})}):null}function vne({open:t,onClose:e,onGoLogin:r,title:n,message:a}){const i=v.useRef(null),o=tn();if(v.useEffect(()=>{if(!t)return;const u=f=>{f.key==="Escape"&&e()},d=f=>{i.current&&!i.current.contains(f.target)&&e()};return document.addEventListener("keydown",u),document.addEventListener("mousedown",d),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",d)}},[t,e]),!t)return null;const c=()=>{try{(r??(()=>o("/login")))()}finally{e()}};return g.jsx("div",{className:"modal-backdrop",role:"presentation",children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Login required",ref:i,children:[g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"}),g.jsx("h3",{className:"modal-title",children:n??"Login Required"}),a?g.jsx("div",{style:{marginTop:8},children:a}):g.jsx("p",{style:{marginTop:8},children:"You need to be logged in to access this feature."}),g.jsxs("div",{style:{display:"flex",gap:12,marginTop:16,justifyContent:"flex-end"},children:[g.jsx("button",{className:"felt-btn btn--ghost",onClick:e,children:"Cancel"}),g.jsx("button",{className:"felt-btn felt-btn--primary",onClick:c,children:"Go to Login"})]})]})})}const bf=to("CapacitorUpdater",{web:()=>qr(()=>import("./web-B6YNFJgE.js"),[],import.meta.url).then(t=>new t.CapacitorUpdaterWeb)});var mv={exports:{}},Jw,cN;function Jb(){if(cN)return Jw;cN=1;const t="2.0.0",e=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,a=e-6;return Jw={MAX_LENGTH:e,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:a,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Jw}var Qw,lN;function Qb(){if(lN)return Qw;lN=1;var t={};return Qw=typeof process=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...r)=>{}:()=>{},Qw}var uN;function Lg(){return uN||(uN=1,(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:a}=Jb(),i=Qb();e=t.exports={};const o=e.re=[],c=e.safeRe=[],u=e.src=[],d=e.safeSrc=[],f=e.t={};let h=0;const m="[a-zA-Z0-9-]",_=[["\\s",1],["\\d",a],[m,n]],w=E=>{for(const[T,R]of _)E=E.split(`${T}*`).join(`${T}{0,${R}}`).split(`${T}+`).join(`${T}{1,${R}}`);return E},b=(E,T,R)=>{const P=w(T),A=h++;i(E,A,T),f[E]=A,u[A]=T,d[A]=P,o[A]=new RegExp(T,R?"g":void 0),c[A]=new RegExp(P,R?"g":void 0)};b("NUMERICIDENTIFIER","0|[1-9]\\d*"),b("NUMERICIDENTIFIERLOOSE","\\d+"),b("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${m}*`),b("MAINVERSION",`(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})\\.(${u[f.NUMERICIDENTIFIER]})`),b("MAINVERSIONLOOSE",`(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})\\.(${u[f.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASEIDENTIFIER",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIER]})`),b("PRERELEASEIDENTIFIERLOOSE",`(?:${u[f.NONNUMERICIDENTIFIER]}|${u[f.NUMERICIDENTIFIERLOOSE]})`),b("PRERELEASE",`(?:-(${u[f.PRERELEASEIDENTIFIER]}(?:\\.${u[f.PRERELEASEIDENTIFIER]})*))`),b("PRERELEASELOOSE",`(?:-?(${u[f.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[f.PRERELEASEIDENTIFIERLOOSE]})*))`),b("BUILDIDENTIFIER",`${m}+`),b("BUILD",`(?:\\+(${u[f.BUILDIDENTIFIER]}(?:\\.${u[f.BUILDIDENTIFIER]})*))`),b("FULLPLAIN",`v?${u[f.MAINVERSION]}${u[f.PRERELEASE]}?${u[f.BUILD]}?`),b("FULL",`^${u[f.FULLPLAIN]}$`),b("LOOSEPLAIN",`[v=\\s]*${u[f.MAINVERSIONLOOSE]}${u[f.PRERELEASELOOSE]}?${u[f.BUILD]}?`),b("LOOSE",`^${u[f.LOOSEPLAIN]}$`),b("GTLT","((?:<|>)?=?)"),b("XRANGEIDENTIFIERLOOSE",`${u[f.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),b("XRANGEIDENTIFIER",`${u[f.NUMERICIDENTIFIER]}|x|X|\\*`),b("XRANGEPLAIN",`[v=\\s]*(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:\\.(${u[f.XRANGEIDENTIFIER]})(?:${u[f.PRERELEASE]})?${u[f.BUILD]}?)?)?`),b("XRANGEPLAINLOOSE",`[v=\\s]*(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[f.XRANGEIDENTIFIERLOOSE]})(?:${u[f.PRERELEASELOOSE]})?${u[f.BUILD]}?)?)?`),b("XRANGE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAIN]}$`),b("XRANGELOOSE",`^${u[f.GTLT]}\\s*${u[f.XRANGEPLAINLOOSE]}$`),b("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),b("COERCE",`${u[f.COERCEPLAIN]}(?:$|[^\\d])`),b("COERCEFULL",u[f.COERCEPLAIN]+`(?:${u[f.PRERELEASE]})?(?:${u[f.BUILD]})?(?:$|[^\\d])`),b("COERCERTL",u[f.COERCE],!0),b("COERCERTLFULL",u[f.COERCEFULL],!0),b("LONETILDE","(?:~>?)"),b("TILDETRIM",`(\\s*)${u[f.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",b("TILDE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAIN]}$`),b("TILDELOOSE",`^${u[f.LONETILDE]}${u[f.XRANGEPLAINLOOSE]}$`),b("LONECARET","(?:\\^)"),b("CARETTRIM",`(\\s*)${u[f.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",b("CARET",`^${u[f.LONECARET]}${u[f.XRANGEPLAIN]}$`),b("CARETLOOSE",`^${u[f.LONECARET]}${u[f.XRANGEPLAINLOOSE]}$`),b("COMPARATORLOOSE",`^${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]})$|^$`),b("COMPARATOR",`^${u[f.GTLT]}\\s*(${u[f.FULLPLAIN]})$|^$`),b("COMPARATORTRIM",`(\\s*)${u[f.GTLT]}\\s*(${u[f.LOOSEPLAIN]}|${u[f.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",b("HYPHENRANGE",`^\\s*(${u[f.XRANGEPLAIN]})\\s+-\\s+(${u[f.XRANGEPLAIN]})\\s*$`),b("HYPHENRANGELOOSE",`^\\s*(${u[f.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[f.XRANGEPLAINLOOSE]})\\s*$`),b("STAR","(<|>)?=?\\s*\\*"),b("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),b("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(mv,mv.exports)),mv.exports}var Zw,dN;function dP(){if(dN)return Zw;dN=1;const t=Object.freeze({loose:!0}),e=Object.freeze({});return Zw=n=>n?typeof n!="object"?t:n:e,Zw}var eS,fN;function pF(){if(fN)return eS;fN=1;const t=/^[0-9]+$/,e=(n,a)=>{const i=t.test(n),o=t.test(a);return i&&o&&(n=+n,a=+a),n===a?0:i&&!o?-1:o&&!i?1:n<a?-1:1};return eS={compareIdentifiers:e,rcompareIdentifiers:(n,a)=>e(a,n)},eS}var tS,pN;function Ya(){if(pN)return tS;pN=1;const t=Qb(),{MAX_LENGTH:e,MAX_SAFE_INTEGER:r}=Jb(),{safeRe:n,t:a}=Lg(),i=dP(),{compareIdentifiers:o}=pF();class c{constructor(d,f){if(f=i(f),d instanceof c){if(d.loose===!!f.loose&&d.includePrerelease===!!f.includePrerelease)return d;d=d.version}else if(typeof d!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof d}".`);if(d.length>e)throw new TypeError(`version is longer than ${e} characters`);t("SemVer",d,f),this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease;const h=d.trim().match(f.loose?n[a.LOOSE]:n[a.FULL]);if(!h)throw new TypeError(`Invalid Version: ${d}`);if(this.raw=d,this.major=+h[1],this.minor=+h[2],this.patch=+h[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");h[4]?this.prerelease=h[4].split(".").map(m=>{if(/^[0-9]+$/.test(m)){const _=+m;if(_>=0&&_<r)return _}return m}):this.prerelease=[],this.build=h[5]?h[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(d){if(t("SemVer.compare",this.version,this.options,d),!(d instanceof c)){if(typeof d=="string"&&d===this.version)return 0;d=new c(d,this.options)}return d.version===this.version?0:this.compareMain(d)||this.comparePre(d)}compareMain(d){return d instanceof c||(d=new c(d,this.options)),o(this.major,d.major)||o(this.minor,d.minor)||o(this.patch,d.patch)}comparePre(d){if(d instanceof c||(d=new c(d,this.options)),this.prerelease.length&&!d.prerelease.length)return-1;if(!this.prerelease.length&&d.prerelease.length)return 1;if(!this.prerelease.length&&!d.prerelease.length)return 0;let f=0;do{const h=this.prerelease[f],m=d.prerelease[f];if(t("prerelease compare",f,h,m),h===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(h===void 0)return-1;if(h===m)continue;return o(h,m)}while(++f)}compareBuild(d){d instanceof c||(d=new c(d,this.options));let f=0;do{const h=this.build[f],m=d.build[f];if(t("build compare",f,h,m),h===void 0&&m===void 0)return 0;if(m===void 0)return 1;if(h===void 0)return-1;if(h===m)continue;return o(h,m)}while(++f)}inc(d,f,h){if(d.startsWith("pre")){if(!f&&h===!1)throw new Error("invalid increment argument: identifier is empty");if(f){const m=`-${f}`.match(this.options.loose?n[a.PRERELEASELOOSE]:n[a.PRERELEASE]);if(!m||m[1]!==f)throw new Error(`invalid identifier: ${f}`)}}switch(d){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",f,h);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",f,h);break;case"prepatch":this.prerelease.length=0,this.inc("patch",f,h),this.inc("pre",f,h);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",f,h),this.inc("pre",f,h);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const m=Number(h)?1:0;if(this.prerelease.length===0)this.prerelease=[m];else{let _=this.prerelease.length;for(;--_>=0;)typeof this.prerelease[_]=="number"&&(this.prerelease[_]++,_=-2);if(_===-1){if(f===this.prerelease.join(".")&&h===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(m)}}if(f){let _=[f,m];h===!1&&(_=[f]),o(this.prerelease[0],f)===0?isNaN(this.prerelease[1])&&(this.prerelease=_):this.prerelease=_}break}default:throw new Error(`invalid increment argument: ${d}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return tS=c,tS}var rS,hN;function Ap(){if(hN)return rS;hN=1;const t=Ya();return rS=(r,n,a=!1)=>{if(r instanceof t)return r;try{return new t(r,n)}catch(i){if(!a)return null;throw i}},rS}var nS,mN;function _ne(){if(mN)return nS;mN=1;const t=Ap();return nS=(r,n)=>{const a=t(r,n);return a?a.version:null},nS}var aS,gN;function bne(){if(gN)return aS;gN=1;const t=Ap();return aS=(r,n)=>{const a=t(r.trim().replace(/^[=v]+/,""),n);return a?a.version:null},aS}var iS,yN;function kne(){if(yN)return iS;yN=1;const t=Ya();return iS=(r,n,a,i,o)=>{typeof a=="string"&&(o=i,i=a,a=void 0);try{return new t(r instanceof t?r.version:r,a).inc(n,i,o).version}catch{return null}},iS}var sS,vN;function wne(){if(vN)return sS;vN=1;const t=Ap();return sS=(r,n)=>{const a=t(r,null,!0),i=t(n,null,!0),o=a.compare(i);if(o===0)return null;const c=o>0,u=c?a:i,d=c?i:a,f=!!u.prerelease.length;if(!!d.prerelease.length&&!f){if(!d.patch&&!d.minor)return"major";if(d.compareMain(u)===0)return d.minor&&!d.patch?"minor":"patch"}const m=f?"pre":"";return a.major!==i.major?m+"major":a.minor!==i.minor?m+"minor":a.patch!==i.patch?m+"patch":"prerelease"},sS}var oS,_N;function Sne(){if(_N)return oS;_N=1;const t=Ya();return oS=(r,n)=>new t(r,n).major,oS}var cS,bN;function Ene(){if(bN)return cS;bN=1;const t=Ya();return cS=(r,n)=>new t(r,n).minor,cS}var lS,kN;function Tne(){if(kN)return lS;kN=1;const t=Ya();return lS=(r,n)=>new t(r,n).patch,lS}var uS,wN;function Cne(){if(wN)return uS;wN=1;const t=Ap();return uS=(r,n)=>{const a=t(r,n);return a&&a.prerelease.length?a.prerelease:null},uS}var dS,SN;function ao(){if(SN)return dS;SN=1;const t=Ya();return dS=(r,n,a)=>new t(r,a).compare(new t(n,a)),dS}var fS,EN;function xne(){if(EN)return fS;EN=1;const t=ao();return fS=(r,n,a)=>t(n,r,a),fS}var pS,TN;function Pne(){if(TN)return pS;TN=1;const t=ao();return pS=(r,n)=>t(r,n,!0),pS}var hS,CN;function fP(){if(CN)return hS;CN=1;const t=Ya();return hS=(r,n,a)=>{const i=new t(r,a),o=new t(n,a);return i.compare(o)||i.compareBuild(o)},hS}var mS,xN;function Ane(){if(xN)return mS;xN=1;const t=fP();return mS=(r,n)=>r.sort((a,i)=>t(a,i,n)),mS}var gS,PN;function Rne(){if(PN)return gS;PN=1;const t=fP();return gS=(r,n)=>r.sort((a,i)=>t(i,a,n)),gS}var yS,AN;function Zb(){if(AN)return yS;AN=1;const t=ao();return yS=(r,n,a)=>t(r,n,a)>0,yS}var vS,RN;function pP(){if(RN)return vS;RN=1;const t=ao();return vS=(r,n,a)=>t(r,n,a)<0,vS}var _S,DN;function hF(){if(DN)return _S;DN=1;const t=ao();return _S=(r,n,a)=>t(r,n,a)===0,_S}var bS,ON;function mF(){if(ON)return bS;ON=1;const t=ao();return bS=(r,n,a)=>t(r,n,a)!==0,bS}var kS,NN;function hP(){if(NN)return kS;NN=1;const t=ao();return kS=(r,n,a)=>t(r,n,a)>=0,kS}var wS,IN;function mP(){if(IN)return wS;IN=1;const t=ao();return wS=(r,n,a)=>t(r,n,a)<=0,wS}var SS,MN;function gF(){if(MN)return SS;MN=1;const t=hF(),e=mF(),r=Zb(),n=hP(),a=pP(),i=mP();return SS=(c,u,d,f)=>{switch(u){case"===":return typeof c=="object"&&(c=c.version),typeof d=="object"&&(d=d.version),c===d;case"!==":return typeof c=="object"&&(c=c.version),typeof d=="object"&&(d=d.version),c!==d;case"":case"=":case"==":return t(c,d,f);case"!=":return e(c,d,f);case">":return r(c,d,f);case">=":return n(c,d,f);case"<":return a(c,d,f);case"<=":return i(c,d,f);default:throw new TypeError(`Invalid operator: ${u}`)}},SS}var ES,jN;function Dne(){if(jN)return ES;jN=1;const t=Ya(),e=Ap(),{safeRe:r,t:n}=Lg();return ES=(i,o)=>{if(i instanceof t)return i;if(typeof i=="number"&&(i=String(i)),typeof i!="string")return null;o=o||{};let c=null;if(!o.rtl)c=i.match(o.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const _=o.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let w;for(;(w=_.exec(i))&&(!c||c.index+c[0].length!==i.length);)(!c||w.index+w[0].length!==c.index+c[0].length)&&(c=w),_.lastIndex=w.index+w[1].length+w[2].length;_.lastIndex=-1}if(c===null)return null;const u=c[2],d=c[3]||"0",f=c[4]||"0",h=o.includePrerelease&&c[5]?`-${c[5]}`:"",m=o.includePrerelease&&c[6]?`+${c[6]}`:"";return e(`${u}.${d}.${f}${h}${m}`,o)},ES}var TS,LN;function One(){if(LN)return TS;LN=1;class t{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(r,n)}return this}}return TS=t,TS}var CS,BN;function io(){if(BN)return CS;BN=1;const t=/\s+/g;class e{constructor(W,F){if(F=a(F),W instanceof e)return W.loose===!!F.loose&&W.includePrerelease===!!F.includePrerelease?W:new e(W.raw,F);if(W instanceof i)return this.raw=W.value,this.set=[[W]],this.formatted=void 0,this;if(this.options=F,this.loose=!!F.loose,this.includePrerelease=!!F.includePrerelease,this.raw=W.trim().replace(t," "),this.set=this.raw.split("||").map(Y=>this.parseRange(Y.trim())).filter(Y=>Y.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const Y=this.set[0];if(this.set=this.set.filter(Q=>!b(Q[0])),this.set.length===0)this.set=[Y];else if(this.set.length>1){for(const Q of this.set)if(Q.length===1&&E(Q[0])){this.set=[Q];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let W=0;W<this.set.length;W++){W>0&&(this.formatted+="||");const F=this.set[W];for(let Y=0;Y<F.length;Y++)Y>0&&(this.formatted+=" "),this.formatted+=F[Y].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(W){const Y=((this.options.includePrerelease&&_)|(this.options.loose&&w))+":"+W,Q=n.get(Y);if(Q)return Q;const ie=this.options.loose,G=ie?u[d.HYPHENRANGELOOSE]:u[d.HYPHENRANGE];W=W.replace(G,j(this.options.includePrerelease)),o("hyphen replace",W),W=W.replace(u[d.COMPARATORTRIM],f),o("comparator trim",W),W=W.replace(u[d.TILDETRIM],h),o("tilde trim",W),W=W.replace(u[d.CARETTRIM],m),o("caret trim",W);let B=W.split(" ").map(me=>R(me,this.options)).join(" ").split(/\s+/).map(me=>L(me,this.options));ie&&(B=B.filter(me=>(o("loose invalid filter",me,this.options),!!me.match(u[d.COMPARATORLOOSE])))),o("range list",B);const K=new Map,ae=B.map(me=>new i(me,this.options));for(const me of ae){if(b(me))return[me];K.set(me.value,me)}K.size>1&&K.has("")&&K.delete("");const te=[...K.values()];return n.set(Y,te),te}intersects(W,F){if(!(W instanceof e))throw new TypeError("a Range is required");return this.set.some(Y=>T(Y,F)&&W.set.some(Q=>T(Q,F)&&Y.every(ie=>Q.every(G=>ie.intersects(G,F)))))}test(W){if(!W)return!1;if(typeof W=="string")try{W=new c(W,this.options)}catch{return!1}for(let F=0;F<this.set.length;F++)if(q(this.set[F],W,this.options))return!0;return!1}}CS=e;const r=One(),n=new r,a=dP(),i=e0(),o=Qb(),c=Ya(),{safeRe:u,t:d,comparatorTrimReplace:f,tildeTrimReplace:h,caretTrimReplace:m}=Lg(),{FLAG_INCLUDE_PRERELEASE:_,FLAG_LOOSE:w}=Jb(),b=U=>U.value==="<0.0.0-0",E=U=>U.value==="",T=(U,W)=>{let F=!0;const Y=U.slice();let Q=Y.pop();for(;F&&Y.length;)F=Y.every(ie=>Q.intersects(ie,W)),Q=Y.pop();return F},R=(U,W)=>(o("comp",U,W),U=O(U,W),o("caret",U),U=A(U,W),o("tildes",U),U=x(U,W),o("xrange",U),U=N(U,W),o("stars",U),U),P=U=>!U||U.toLowerCase()==="x"||U==="*",A=(U,W)=>U.trim().split(/\s+/).map(F=>C(F,W)).join(" "),C=(U,W)=>{const F=W.loose?u[d.TILDELOOSE]:u[d.TILDE];return U.replace(F,(Y,Q,ie,G,B)=>{o("tilde",U,Y,Q,ie,G,B);let K;return P(Q)?K="":P(ie)?K=`>=${Q}.0.0 <${+Q+1}.0.0-0`:P(G)?K=`>=${Q}.${ie}.0 <${Q}.${+ie+1}.0-0`:B?(o("replaceTilde pr",B),K=`>=${Q}.${ie}.${G}-${B} <${Q}.${+ie+1}.0-0`):K=`>=${Q}.${ie}.${G} <${Q}.${+ie+1}.0-0`,o("tilde return",K),K})},O=(U,W)=>U.trim().split(/\s+/).map(F=>I(F,W)).join(" "),I=(U,W)=>{o("caret",U,W);const F=W.loose?u[d.CARETLOOSE]:u[d.CARET],Y=W.includePrerelease?"-0":"";return U.replace(F,(Q,ie,G,B,K)=>{o("caret",U,Q,ie,G,B,K);let ae;return P(ie)?ae="":P(G)?ae=`>=${ie}.0.0${Y} <${+ie+1}.0.0-0`:P(B)?ie==="0"?ae=`>=${ie}.${G}.0${Y} <${ie}.${+G+1}.0-0`:ae=`>=${ie}.${G}.0${Y} <${+ie+1}.0.0-0`:K?(o("replaceCaret pr",K),ie==="0"?G==="0"?ae=`>=${ie}.${G}.${B}-${K} <${ie}.${G}.${+B+1}-0`:ae=`>=${ie}.${G}.${B}-${K} <${ie}.${+G+1}.0-0`:ae=`>=${ie}.${G}.${B}-${K} <${+ie+1}.0.0-0`):(o("no pr"),ie==="0"?G==="0"?ae=`>=${ie}.${G}.${B}${Y} <${ie}.${G}.${+B+1}-0`:ae=`>=${ie}.${G}.${B}${Y} <${ie}.${+G+1}.0-0`:ae=`>=${ie}.${G}.${B} <${+ie+1}.0.0-0`),o("caret return",ae),ae})},x=(U,W)=>(o("replaceXRanges",U,W),U.split(/\s+/).map(F=>D(F,W)).join(" ")),D=(U,W)=>{U=U.trim();const F=W.loose?u[d.XRANGELOOSE]:u[d.XRANGE];return U.replace(F,(Y,Q,ie,G,B,K)=>{o("xRange",U,Y,Q,ie,G,B,K);const ae=P(ie),te=ae||P(G),me=te||P(B),ue=me;return Q==="="&&ue&&(Q=""),K=W.includePrerelease?"-0":"",ae?Q===">"||Q==="<"?Y="<0.0.0-0":Y="*":Q&&ue?(te&&(G=0),B=0,Q===">"?(Q=">=",te?(ie=+ie+1,G=0,B=0):(G=+G+1,B=0)):Q==="<="&&(Q="<",te?ie=+ie+1:G=+G+1),Q==="<"&&(K="-0"),Y=`${Q+ie}.${G}.${B}${K}`):te?Y=`>=${ie}.0.0${K} <${+ie+1}.0.0-0`:me&&(Y=`>=${ie}.${G}.0${K} <${ie}.${+G+1}.0-0`),o("xRange return",Y),Y})},N=(U,W)=>(o("replaceStars",U,W),U.trim().replace(u[d.STAR],"")),L=(U,W)=>(o("replaceGTE0",U,W),U.trim().replace(u[W.includePrerelease?d.GTE0PRE:d.GTE0],"")),j=U=>(W,F,Y,Q,ie,G,B,K,ae,te,me,ue)=>(P(Y)?F="":P(Q)?F=`>=${Y}.0.0${U?"-0":""}`:P(ie)?F=`>=${Y}.${Q}.0${U?"-0":""}`:G?F=`>=${F}`:F=`>=${F}${U?"-0":""}`,P(ae)?K="":P(te)?K=`<${+ae+1}.0.0-0`:P(me)?K=`<${ae}.${+te+1}.0-0`:ue?K=`<=${ae}.${te}.${me}-${ue}`:U?K=`<${ae}.${te}.${+me+1}-0`:K=`<=${K}`,`${F} ${K}`.trim()),q=(U,W,F)=>{for(let Y=0;Y<U.length;Y++)if(!U[Y].test(W))return!1;if(W.prerelease.length&&!F.includePrerelease){for(let Y=0;Y<U.length;Y++)if(o(U[Y].semver),U[Y].semver!==i.ANY&&U[Y].semver.prerelease.length>0){const Q=U[Y].semver;if(Q.major===W.major&&Q.minor===W.minor&&Q.patch===W.patch)return!0}return!1}return!0};return CS}var xS,UN;function e0(){if(UN)return xS;UN=1;const t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(f,h){if(h=r(h),f instanceof e){if(f.loose===!!h.loose)return f;f=f.value}f=f.trim().split(/\s+/).join(" "),o("comparator",f,h),this.options=h,this.loose=!!h.loose,this.parse(f),this.semver===t?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(f){const h=this.options.loose?n[a.COMPARATORLOOSE]:n[a.COMPARATOR],m=f.match(h);if(!m)throw new TypeError(`Invalid comparator: ${f}`);this.operator=m[1]!==void 0?m[1]:"",this.operator==="="&&(this.operator=""),m[2]?this.semver=new c(m[2],this.options.loose):this.semver=t}toString(){return this.value}test(f){if(o("Comparator.test",f,this.options.loose),this.semver===t||f===t)return!0;if(typeof f=="string")try{f=new c(f,this.options)}catch{return!1}return i(f,this.operator,this.semver,this.options)}intersects(f,h){if(!(f instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new u(f.value,h).test(this.value):f.operator===""?f.value===""?!0:new u(this.value,h).test(f.semver):(h=r(h),h.includePrerelease&&(this.value==="<0.0.0-0"||f.value==="<0.0.0-0")||!h.includePrerelease&&(this.value.startsWith("<0.0.0")||f.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&f.operator.startsWith(">")||this.operator.startsWith("<")&&f.operator.startsWith("<")||this.semver.version===f.semver.version&&this.operator.includes("=")&&f.operator.includes("=")||i(this.semver,"<",f.semver,h)&&this.operator.startsWith(">")&&f.operator.startsWith("<")||i(this.semver,">",f.semver,h)&&this.operator.startsWith("<")&&f.operator.startsWith(">")))}}xS=e;const r=dP(),{safeRe:n,t:a}=Lg(),i=gF(),o=Qb(),c=Ya(),u=io();return xS}var PS,FN;function t0(){if(FN)return PS;FN=1;const t=io();return PS=(r,n,a)=>{try{n=new t(n,a)}catch{return!1}return n.test(r)},PS}var AS,qN;function Nne(){if(qN)return AS;qN=1;const t=io();return AS=(r,n)=>new t(r,n).set.map(a=>a.map(i=>i.value).join(" ").trim().split(" ")),AS}var RS,zN;function Ine(){if(zN)return RS;zN=1;const t=Ya(),e=io();return RS=(n,a,i)=>{let o=null,c=null,u=null;try{u=new e(a,i)}catch{return null}return n.forEach(d=>{u.test(d)&&(!o||c.compare(d)===-1)&&(o=d,c=new t(o,i))}),o},RS}var DS,$N;function Mne(){if($N)return DS;$N=1;const t=Ya(),e=io();return DS=(n,a,i)=>{let o=null,c=null,u=null;try{u=new e(a,i)}catch{return null}return n.forEach(d=>{u.test(d)&&(!o||c.compare(d)===1)&&(o=d,c=new t(o,i))}),o},DS}var OS,VN;function jne(){if(VN)return OS;VN=1;const t=Ya(),e=io(),r=Zb();return OS=(a,i)=>{a=new e(a,i);let o=new t("0.0.0");if(a.test(o)||(o=new t("0.0.0-0"),a.test(o)))return o;o=null;for(let c=0;c<a.set.length;++c){const u=a.set[c];let d=null;u.forEach(f=>{const h=new t(f.semver.version);switch(f.operator){case">":h.prerelease.length===0?h.patch++:h.prerelease.push(0),h.raw=h.format();case"":case">=":(!d||r(h,d))&&(d=h);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${f.operator}`)}}),d&&(!o||r(o,d))&&(o=d)}return o&&a.test(o)?o:null},OS}var NS,HN;function Lne(){if(HN)return NS;HN=1;const t=io();return NS=(r,n)=>{try{return new t(r,n).range||"*"}catch{return null}},NS}var IS,GN;function gP(){if(GN)return IS;GN=1;const t=Ya(),e=e0(),{ANY:r}=e,n=io(),a=t0(),i=Zb(),o=pP(),c=mP(),u=hP();return IS=(f,h,m,_)=>{f=new t(f,_),h=new n(h,_);let w,b,E,T,R;switch(m){case">":w=i,b=c,E=o,T=">",R=">=";break;case"<":w=o,b=u,E=i,T="<",R="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(f,h,_))return!1;for(let P=0;P<h.set.length;++P){const A=h.set[P];let C=null,O=null;if(A.forEach(I=>{I.semver===r&&(I=new e(">=0.0.0")),C=C||I,O=O||I,w(I.semver,C.semver,_)?C=I:E(I.semver,O.semver,_)&&(O=I)}),C.operator===T||C.operator===R||(!O.operator||O.operator===T)&&b(f,O.semver))return!1;if(O.operator===R&&E(f,O.semver))return!1}return!0},IS}var MS,WN;function Bne(){if(WN)return MS;WN=1;const t=gP();return MS=(r,n,a)=>t(r,n,">",a),MS}var jS,KN;function Une(){if(KN)return jS;KN=1;const t=gP();return jS=(r,n,a)=>t(r,n,"<",a),jS}var LS,YN;function Fne(){if(YN)return LS;YN=1;const t=io();return LS=(r,n,a)=>(r=new t(r,a),n=new t(n,a),r.intersects(n,a)),LS}var BS,XN;function qne(){if(XN)return BS;XN=1;const t=t0(),e=ao();return BS=(r,n,a)=>{const i=[];let o=null,c=null;const u=r.sort((m,_)=>e(m,_,a));for(const m of u)t(m,n,a)?(c=m,o||(o=m)):(c&&i.push([o,c]),c=null,o=null);o&&i.push([o,null]);const d=[];for(const[m,_]of i)m===_?d.push(m):!_&&m===u[0]?d.push("*"):_?m===u[0]?d.push(`<=${_}`):d.push(`${m} - ${_}`):d.push(`>=${m}`);const f=d.join(" || "),h=typeof n.raw=="string"?n.raw:String(n);return f.length<h.length?f:n},BS}var US,JN;function zne(){if(JN)return US;JN=1;const t=io(),e=e0(),{ANY:r}=e,n=t0(),a=ao(),i=(h,m,_={})=>{if(h===m)return!0;h=new t(h,_),m=new t(m,_);let w=!1;e:for(const b of h.set){for(const E of m.set){const T=u(b,E,_);if(w=w||T!==null,T)continue e}if(w)return!1}return!0},o=[new e(">=0.0.0-0")],c=[new e(">=0.0.0")],u=(h,m,_)=>{if(h===m)return!0;if(h.length===1&&h[0].semver===r){if(m.length===1&&m[0].semver===r)return!0;_.includePrerelease?h=o:h=c}if(m.length===1&&m[0].semver===r){if(_.includePrerelease)return!0;m=c}const w=new Set;let b,E;for(const x of h)x.operator===">"||x.operator===">="?b=d(b,x,_):x.operator==="<"||x.operator==="<="?E=f(E,x,_):w.add(x.semver);if(w.size>1)return null;let T;if(b&&E){if(T=a(b.semver,E.semver,_),T>0)return null;if(T===0&&(b.operator!==">="||E.operator!=="<="))return null}for(const x of w){if(b&&!n(x,String(b),_)||E&&!n(x,String(E),_))return null;for(const D of m)if(!n(x,String(D),_))return!1;return!0}let R,P,A,C,O=E&&!_.includePrerelease&&E.semver.prerelease.length?E.semver:!1,I=b&&!_.includePrerelease&&b.semver.prerelease.length?b.semver:!1;O&&O.prerelease.length===1&&E.operator==="<"&&O.prerelease[0]===0&&(O=!1);for(const x of m){if(C=C||x.operator===">"||x.operator===">=",A=A||x.operator==="<"||x.operator==="<=",b){if(I&&x.semver.prerelease&&x.semver.prerelease.length&&x.semver.major===I.major&&x.semver.minor===I.minor&&x.semver.patch===I.patch&&(I=!1),x.operator===">"||x.operator===">="){if(R=d(b,x,_),R===x&&R!==b)return!1}else if(b.operator===">="&&!n(b.semver,String(x),_))return!1}if(E){if(O&&x.semver.prerelease&&x.semver.prerelease.length&&x.semver.major===O.major&&x.semver.minor===O.minor&&x.semver.patch===O.patch&&(O=!1),x.operator==="<"||x.operator==="<="){if(P=f(E,x,_),P===x&&P!==E)return!1}else if(E.operator==="<="&&!n(E.semver,String(x),_))return!1}if(!x.operator&&(E||b)&&T!==0)return!1}return!(b&&A&&!E&&T!==0||E&&C&&!b&&T!==0||I||O)},d=(h,m,_)=>{if(!h)return m;const w=a(h.semver,m.semver,_);return w>0?h:w<0||m.operator===">"&&h.operator===">="?m:h},f=(h,m,_)=>{if(!h)return m;const w=a(h.semver,m.semver,_);return w<0?h:w>0||m.operator==="<"&&h.operator==="<="?m:h};return US=i,US}var FS,QN;function $ne(){if(QN)return FS;QN=1;const t=Lg(),e=Jb(),r=Ya(),n=pF(),a=Ap(),i=_ne(),o=bne(),c=kne(),u=wne(),d=Sne(),f=Ene(),h=Tne(),m=Cne(),_=ao(),w=xne(),b=Pne(),E=fP(),T=Ane(),R=Rne(),P=Zb(),A=pP(),C=hF(),O=mF(),I=hP(),x=mP(),D=gF(),N=Dne(),L=e0(),j=io(),q=t0(),U=Nne(),W=Ine(),F=Mne(),Y=jne(),Q=Lne(),ie=gP(),G=Bne(),B=Une(),K=Fne(),ae=qne(),te=zne();return FS={parse:a,valid:i,clean:o,inc:c,diff:u,major:d,minor:f,patch:h,prerelease:m,compare:_,rcompare:w,compareLoose:b,compareBuild:E,sort:T,rsort:R,gt:P,lt:A,eq:C,neq:O,gte:I,lte:x,cmp:D,coerce:N,Comparator:L,Range:j,satisfies:q,toComparators:U,maxSatisfying:W,minSatisfying:F,minVersion:Y,validRange:Q,outside:ie,gtr:G,ltr:B,intersects:K,simplifyRange:ae,subset:te,SemVer:r,re:t.re,src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:e.SEMVER_SPEC_VERSION,RELEASE_TYPES:e.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},FS}var Vne=$ne();const of=wg(Vne),Hne={},J_="https://updates.dicelounge.app";function Gne(){const e=String("poker").trim().toLowerCase();let r=e==="craps"||e==="ceelo"||e==="poker"?`${J_}/${e}/manifest.json`:`${J_}/manifest.json`;r=r.replace(/manifest\.jjson$/i,"manifest.json");try{}catch{}return r}function ZN(){return Date.now()}function Ch(){try{const e=globalThis.Capacitor?.getPlatform?.();return e==="ios"||e==="android"}catch{return!1}}function eI(t){if(!t)return"0.0.0";let e=t.replace(/^v/i,"").trim();const r=/^(\d+)\.0(\d+)$/.exec(e);if(r)return`${r[1]}.0.${parseInt(r[2],10)}`;const n=/^(\d+)\.(\d+)$/.exec(e);return n?`${n[1]}.${n[2]}.0`:e}function Wne(t){try{const e=new URL(t);return`${e.protocol}//${e.host}`===J_}catch{return!1}}async function Kne(t){if(!Wne(t))throw new Error("Manifest origin not allowed");const e=await fetch(t,{cache:"no-store",redirect:"error"});if(!e.ok)throw new Error(`HTTP ${e.status}`);return await e.json()}async function Yne(t){const e=await t.arrayBuffer(),r=await crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(r)).map(n=>n.toString(16).padStart(2,"0")).join("")}const tI=globalThis.OTA_PUBLIC_KEY_B64||Hne?.VITE_OTA_PUBKEY||iH,rI=!0,Xne=25*1024*1024,Jne=/^(\d{12,14}|v?\d+\.\d+\.\d+(?:[-+].+)?)$/;async function Qne(){try{let t=Uint8Array.from(atob(tI),e=>e.charCodeAt(0));if(t.length>40&&t[0]===48)try{const e=t.slice(-32);e.length===32&&(t=e)}catch{}try{return await crypto.subtle.importKey("raw",t,{name:"Ed25519"},!1,["verify"])}catch{try{t.length}catch{}return{legacyRaw:t}}}catch(t){try{t?.message}catch{}return null}}const Zne=Qne();async function eae(t,e){if(!t||!t.startsWith("ed25519:"))return!1;const r=t.slice(8);let n;try{n=Uint8Array.from(atob(r),c=>c.charCodeAt(0))}catch{return!1}const a=await Zne;if(!a)return!1;const i=`${e.webVersion}|${e.minNativeVersion}|${e.url}|${e.sha256}`,o=new TextEncoder().encode(i);try{const c=new Uint8Array(n);if(a.legacyRaw){try{}catch{}return!0}return await crypto.subtle.verify({name:"Ed25519"},a,c,o)}catch{return!1}}class tae{nativeVersion=null;activeWebVersion=null;pendingUpdateVersion=null;previousWebVersion=null;lastAppliedSha256=null;async init(){if(!Ch())return;const e=await Lo.getInfo();this.nativeVersion=e.version;const r=await ms.get({key:"ota_state"});if(r.value)try{const a=JSON.parse(r.value);this.activeWebVersion=a.activeWebVersion,this.pendingUpdateVersion=a.pendingUpdateVersion,this.previousWebVersion=a.previousWebVersion,this.lastAppliedSha256=a.lastAppliedSha256??null}catch{}const n=await bf.current().catch(()=>null);n?.version&&!this.activeWebVersion&&(this.activeWebVersion=n.version,await this.writePersist()),this.nativeVersion,this.activeWebVersion}getVersions(){return{nativeVersion:this.nativeVersion,webVersion:this.activeWebVersion}}async checkForUpdate(){let e=this.nativeVersion||null;if(!e&&Ch())try{e=(await Lo.getInfo()).version||null,this.nativeVersion=e}catch(r){r?.message}e=e||"0.0.0";try{const r=Gne(),a=(await Kne(r))?.latest;if(!a?.webVersion||!a?.minNativeVersion||!a?.url||!a?.sha256)return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};try{a.webVersion,a.sig,a.sig&&a.sig.slice(0,18),(()=>{try{return new URL(a.url).host}catch{return"parse_err"}})()}catch{}if(rI&&!a.sig)return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};if(!Jne.test(a.webVersion))return a.webVersion,{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};if(!/^https:\/\//.test(a.url))return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};if(!/^[a-f0-9]{64}$/i.test(a.sha256))return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:e,currentWebVersion:this.activeWebVersion};const i=eI(e),o=eI(a.minNativeVersion),c=of.coerce(o)||"0.0.0",u=of.coerce(i)||"0.0.0",d=of.gte(u,c);if(a.minNativeVersion,!d)return this.activeWebVersion,a.webVersion,{available:!1,reason:"INCOMPATIBLE_NATIVE",nativeVersion:e,currentWebVersion:this.activeWebVersion};if(this.pendingUpdateVersion&&this.pendingUpdateVersion===a.webVersion)return this.activeWebVersion,a.webVersion,{available:!1,reason:"NO_NEW_VERSION",nativeVersion:e,currentWebVersion:this.activeWebVersion};const f=this.activeWebVersion;if(f&&f===a.webVersion)return a.webVersion,{available:!1,reason:"NO_NEW_VERSION",nativeVersion:e,currentWebVersion:f};const h=f?of.valid(f):null,m=of.valid(a.webVersion);let _=!0;if(f)if(h&&m)_=of.gt(a.webVersion,f);else if(/^\d+$/.test(a.webVersion)&&/^\d+$/.test(f)){const E=Number(a.webVersion),T=Number(f);!Number.isNaN(E)&&!Number.isNaN(T)&&(_=E>T)}else _=a.webVersion>f;if(f&&!_)return a.webVersion,{available:!1,reason:"NO_NEW_VERSION",nativeVersion:e,currentWebVersion:f};const w={...a};return w.webVersion,{available:!0,reason:"OK",release:w,nativeVersion:e,currentWebVersion:f}}catch(r){return this.activeWebVersion,r?.message||String(r),{available:!1,reason:"NETWORK_ERROR",nativeVersion:e,currentWebVersion:this.activeWebVersion}}}async downloadUpdate(e,r){if(!Ch())throw new Error("OTA only applies on native platforms");r?.({stage:"downloading",percent:0});const n=new AbortController,a=setTimeout(()=>n.abort(),3e4),i=await fetch(e.url,{cache:"no-store",redirect:"error",signal:n.signal});if(clearTimeout(a),!i.ok||!i.body)throw new Error(`Download failed: ${i.status}`);const o=i.body.getReader(),c=[];let u=0;const d=Number(i.headers.get("content-length")||0);for(;;){const{done:w,value:b}=await o.read();if(w)break;if(b){if(c.push(b),u+=b.byteLength,u>Xne)throw new Error("SIZE_LIMIT");d>0&&r?.({stage:"downloading",bytes:u,total:d,percent:Math.round(u/d*100)})}}const f=new Blob(c,{type:"application/zip"});if(r?.({stage:"verifying"}),(await Yne(f)).toLowerCase()!==e.sha256.toLowerCase())throw e.sha256,new Error("SHA256_MISMATCH");try{const w=new URL(e.url);if(`${w.protocol}//${w.host}`!==J_)throw new Error("ORIGIN_MISMATCH")}catch{throw new Error("ORIGIN_MISMATCH")}const m=!!e.sig;if(!await eae(e.sig,e)){const w=m?"SIG_INVALID":"SIG_MISSING";if(w==="SIG_MISSING"&&rI)try{Object.keys(e),e.webVersion,e.url,e.sha256?.length}catch{}throw new Error(w)}return{blob:f}}async clearCaches(){try{if("caches"in window){const e=await caches.keys();await Promise.all(e.map(r=>caches.delete(r))),e.length}}catch{}try{if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistrations();await Promise.all(e.map(r=>r.unregister())),e.length}}catch{}}async applyUpdate(e,r){if(!Ch())throw new Error("OTA only applies on native platforms");e.webVersion,this.previousWebVersion=this.activeWebVersion,this.pendingUpdateVersion=e.webVersion,this.lastAppliedSha256=e.sha256,await this.writePersist(),await this.clearCaches();const n=await bf.download({url:e.url,version:e.webVersion});await bf.set({id:n.id}),this.previousWebVersion,e.webVersion}async healthCheck(){if(!Ch())return!0;const e=this.pendingUpdateVersion;if(!e)return!0;if(await this.tryFetchHealth(2e3).catch(()=>!1)||await this.waitForAppMounted(5e3).catch(()=>!1)){this.activeWebVersion=e,this.pendingUpdateVersion=null;try{await bf.notifyAppReady()}catch{}await this.writePersist();try{const n=window;n.__OTA_ACTIVATED__=!0,n.__OTA_ACTIVATED_VERSION__=this.activeWebVersion;try{window.dispatchEvent(new CustomEvent("ota:activated",{detail:{webVersion:this.activeWebVersion}}))}catch{}}catch{}return this.activeWebVersion,!0}return await this.rollbackIfBootFails(),!1}async tryFetchHealth(e){try{const r=new AbortController,n=setTimeout(()=>r.abort(),e),a=await fetch("/health",{signal:r.signal,cache:"no-store"});return clearTimeout(n),a.ok}catch{return!1}}async waitForAppMounted(e){const r=ZN(),n=window;for(;ZN()-r<e;){if(n.__APP_MOUNTED__)return!0;await new Promise(a=>setTimeout(a,100))}return!1}async rollbackIfBootFails(){try{await bf.reset(),this.pendingUpdateVersion=null,this.activeWebVersion=this.previousWebVersion??null,await this.writePersist(),this.activeWebVersion,location.reload()}catch(e){e?.message}}async writePersist(){const e={activeWebVersion:this.activeWebVersion??null,pendingUpdateVersion:this.pendingUpdateVersion??null,previousWebVersion:this.previousWebVersion??null,lastAppliedSha256:this.lastAppliedSha256??null};await ms.set({key:"ota_state",value:JSON.stringify(e)})}}const cs=new tae,nI="ota:lastCheckAt",rae=18e4;function nae(){try{const t=globalThis.__E2E_OTA_COOLDOWN_MS;if(typeof t=="number"&&t>=0)return t}catch{}return rae}function aae(){const[t,e]=v.useState(cs.getVersions()),[r,n]=v.useState(!1),[a,i]=v.useState(null),[o,c]=v.useState({stage:"idle"}),u=v.useRef(null);v.useEffect(()=>{e(cs.getVersions())},[]);const d=v.useCallback(async()=>{n(!0);try{try{const _=Date.now(),w=await Ws.get(nI),b=w?Number(w):0;if(b&&_-b<nae()){n(!1);return}}catch{}const m=await cs.checkForUpdate();if(m.available&&m.release){i(m),u.current=m.release;try{const _=window;if(!_.__OTA_AUTO_APPLY_RUNNING__){_.__OTA_AUTO_APPLY_RUNNING__=!0,c({stage:"downloading",percent:0});const{blob:w}=await cs.downloadUpdate(m.release,b=>c(b));c({stage:"applying"}),await cs.applyUpdate(m.release,w)}}catch{try{window.__OTA_AUTO_APPLY_RUNNING__=!1}catch{}}}else m.reason==="NO_NEW_VERSION"?(i(null),u.current=null):i(m);try{await Ws.set(nI,String(Date.now()))}catch{}}finally{n(!1)}},[]),f=v.useCallback(async()=>{const m=u.current;if(!m)return;c({stage:"downloading",percent:0});const{blob:_}=await cs.downloadUpdate(m,w=>c(w));c({stage:"applying"}),await cs.applyUpdate(m,_)},[]),h=v.useCallback(()=>{c({stage:"idle"})},[]);return v.useEffect(()=>{d()},[d]),{current:t,checking:r,available:a,progress:o,applyNow:f,later:h}}function iae({available:t,progress:e,applyNow:r,later:n}){if(!t?.available||!t.release)return null;const a=t.release;return a.mandatory,g.jsx("div",{style:{position:"fixed",bottom:12,left:12,right:12,zIndex:1e3},children:g.jsxs("div",{className:"banner card",style:{padding:12,display:"flex",gap:8,alignItems:"center"},children:[g.jsxs("div",{style:{flex:1},children:[g.jsx("strong",{children:"Update available"})," — ",a.webVersion]}),e.stage==="downloading"&&g.jsxs("span",{children:[e.percent??0,"%"]}),e.stage==="applying"&&g.jsx("span",{children:"Applying…"}),e.stage==="idle"&&g.jsx("span",{children:"Preparing…"})]})})}function sae({cooldownMs:t=3e4}){const e=v.useRef(!1);return v.useEffect(()=>{let r=[];async function n(o){if(!e.current){e.current=!0;try{const c=await cs.checkForUpdate();if(c.available&&c.release){try{const d=window;if(d.__OTA_AUTO_APPLY_RUNNING__)return;d.__OTA_AUTO_APPLY_RUNNING__=!0}catch{}const{blob:u}=await cs.downloadUpdate(c.release,d=>{});await cs.applyUpdate(c.release,u),setTimeout(()=>{try{window.location.reload()}catch{}},500)}}catch(c){c?.message;try{window.__OTA_AUTO_APPLY_RUNNING__=!1}catch{}}finally{e.current=!1}}}(async()=>{try{const o=await Lo.addListener("appStateChange",c=>{c.isActive&&n("native_foreground")});r.push(()=>{try{o.remove()}catch{}})}catch{}})();const a=()=>{document.visibilityState==="visible"&&n()};document.addEventListener("visibilitychange",a),r.push(()=>document.removeEventListener("visibilitychange",a));const i=setTimeout(()=>n(),4e3);return r.push(()=>clearTimeout(i)),()=>{r.forEach(o=>{try{o()}catch{}})}},[t]),null}const oae="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2064%2064'%20width='64'%20height='64'%20role='img'%20aria-label='Gold%20gear%2012%20teeth'%3e%3cdefs%3e%3cradialGradient%20id='gold12_body'%20cx='50%25'%20cy='40%25'%20r='60%25'%3e%3cstop%20offset='0%25'%20stop-color='%23fff5c4'/%3e%3cstop%20offset='45%25'%20stop-color='%23ffd35a'/%3e%3cstop%20offset='80%25'%20stop-color='%23d49a00'/%3e%3cstop%20offset='100%25'%20stop-color='%23a67100'/%3e%3c/radialGradient%3e%3clinearGradient%20id='gold12_edge'%20x1='0'%20y1='0'%20x2='1'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'%20stop-opacity='0.7'/%3e%3cstop%20offset='100%25'%20stop-color='%237a5200'%20stop-opacity='0.7'/%3e%3c/linearGradient%3e%3cfilter%20id='gold12_shadow'%20x='-20%25'%20y='-20%25'%20width='140%25'%20height='140%25'%3e%3cfeDropShadow%20dx='0'%20dy='1'%20stdDeviation='1.1'%20flood-color='%23000'%20flood-opacity='0.25'/%3e%3c/filter%3e%3cmask%20id='gold12_hole'%3e%3crect%20width='64'%20height='64'%20fill='%23fff'/%3e%3ccircle%20cx='32'%20cy='32'%20r='13.2'%20fill='%23000'/%3e%3c/mask%3e%3c/defs%3e%3cg%20mask='url(%23gold12_hole)'%20filter='url(%23gold12_shadow)'%3e%3ccircle%20cx='32'%20cy='32'%20r='25.6'%20fill='url(%23gold12_body)'/%3e%3cg%20fill='url(%23gold12_body)'%20stroke='url(%23gold12_edge)'%20stroke-width='0.6'%3e%3c!--%2012%20identical%20teeth%20--%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(0%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(30%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(60%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(90%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(120%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(150%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(180%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(210%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(240%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(270%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(300%2032%2032)'/%3e%3crect%20x='29'%20y='0.8'%20width='6'%20height='10.8'%20rx='1.1'%20ry='1.1'%20transform='rotate(330%2032%2032)'/%3e%3c/g%3e%3ccircle%20cx='32'%20cy='32'%20r='25.6'%20fill='none'%20stroke='url(%23gold12_edge)'%20stroke-width='1.4'/%3e%3c/g%3e%3ccircle%20cx='32'%20cy='32'%20r='13.2'%20fill='none'%20stroke='url(%23gold12_edge)'%20stroke-width='1.2'/%3e%3c/svg%3e",cae="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20width='24'%20height='24'%20role='img'%20aria-label='Help'%3e%3cdefs%3e%3c!--%20Polished%20gold%20body%20with%20higher%20contrast%20for%20small%20sizes%20--%3e%3clinearGradient%20id='qg-body'%20x1='0'%20y1='0'%20x2='0'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23fff6cf'/%3e%3cstop%20offset='40%25'%20stop-color='%23ffd873'/%3e%3cstop%20offset='72%25'%20stop-color='%23e0a614'/%3e%3cstop%20offset='100%25'%20stop-color='%239a6b00'/%3e%3c/linearGradient%3e%3c!--%20Subtle%20outline%20that%20remains%20crisp%20at%201x%20and%201.5x%20--%3e%3clinearGradient%20id='qg-edge'%20x1='0'%20y1='0'%20x2='1'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'%20stop-opacity='0.8'/%3e%3cstop%20offset='100%25'%20stop-color='%236e4a00'%20stop-opacity='0.6'/%3e%3c/linearGradient%3e%3c!--%20Inner%20shadow%20for%20depth%20--%3e%3cfilter%20id='qg-inner'%20x='-20%25'%20y='-20%25'%20width='140%25'%20height='140%25'%3e%3cfeOffset%20dy='0.2'/%3e%3cfeGaussianBlur%20stdDeviation='0.4'%20result='b'/%3e%3cfeComposite%20in2='b'%20in='SourceAlpha'%20operator='arithmetic'%20k2='-1'%20k3='1'%20result='inner'/%3e%3cfeColorMatrix%20in='inner'%20type='matrix'%20values='0%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200%200.55%200'/%3e%3cfeBlend%20in='SourceGraphic'%20mode='overlay'/%3e%3c/filter%3e%3c!--%20Gentle%20rim%20light%20on%20upper-left%20--%3e%3clinearGradient%20id='qg-sheen'%20x1='0'%20y1='0'%20x2='0'%20y2='1'%3e%3cstop%20offset='0%25'%20stop-color='%23ffffff'%20stop-opacity='0.55'/%3e%3cstop%20offset='60%25'%20stop-color='%23ffffff'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3cmask%20id='qg-top'%3e%3crect%20width='24'%20height='24'%20fill='%23000'/%3e%3crect%20width='24'%20height='11'%20fill='%23fff'/%3e%3c/mask%3e%3c/defs%3e%3cg%20filter='url(%23qg-inner)'%3e%3c!--%20Main%20mark%20--%3e%3cpath%20d='M12%202.2c-2.28%200-4.12.63-5.38%201.78C5.32%205.1%204.8%206.54%204.8%208.2c0%20.42.34.76.76.76h1.8c.36%200%20.67-.26.75-.61.18-.78.54-1.37%201.07-1.83.62-.54%201.58-.88%202.86-.88%201.07%200%201.9.23%202.43.68.53.45.8%201.06.8%201.92%200%20.76-.26%201.33-.83%201.83-.52.48-1.24.9-2.26%201.44-1.13.6-2.03%201.23-2.64%202.05-.65.86-.94%201.88-.94%203.2v.07c0%20.42.34.76.76.76h1.98c.42%200%20.76-.34.76-.76v-.07c0-.69.16-1.18.5-1.57.36-.42.98-.85%202-.36%201.19-.62%202.15-1.25%202.9-2.02.99-1.01%201.5-2.29%201.5-3.87%200-1.74-.64-3.21-1.83-4.25C16.12%202.76%2014.25%202.2%2012%202.2Z'%20fill='url(%23qg-body)'%20stroke='url(%23qg-edge)'%20stroke-width='0.9'%20stroke-linejoin='round'/%3e%3c!--%20Dot%20--%3e%3c!--%20Dot:%20centered%20under%20the%20stem%20for%20optical%20alignment%20at%2024–33px%20--%3e%3ccircle%20cx='11.2'%20cy='21.0'%20r='1.7'%20fill='url(%23qg-body)'%20stroke='url(%23qg-edge)'%20stroke-width='0.85'/%3e%3c!--%20Sheen%20overlay%20--%3e%3cpath%20d='M12%202.2c-2.28%200-4.12.63-5.38%201.78C5.32%205.1%204.8%206.54%204.8%208.2c0%20.42.34.76.76.76h1.8c.36%200%20.67-.26.75-.61.18-.78.54-1.37%201.07-1.83.62-.54%201.58-.88%202.86-.88%201.07%200%201.9.23%202.43.68.53.45.8%201.06.8%201.92%200%20.76-.26%201.33-.83%201.83-.52.48-1.24.9-2.26%201.44-1.13.6-2.03%201.23-2.64%202.05-.65.86-.94%201.88-.94%203.2v.07c0%20.42.34.76.76.76h1.98c.42%200%20.76-.34.76-.76v-.07c0-.69.16-1.18.5-1.57.36-.42.98-.85%202-.36%201.19-.62%202.15-1.25%202.9-2.02.99-1.01%201.5-2.29%201.5-3.87%200-1.74-.64-3.21-1.83-4.25C16.12%202.76%2014.25%202.2%2012%202.2Z'%20fill='url(%23qg-sheen)'%20mask='url(%23qg-top)'/%3e%3c/g%3e%3c/svg%3e";function yP(){return g.jsxs("footer",{className:"lp-footer",children:[g.jsxs("nav",{className:"lp-footer__links","aria-label":"Footer",children:[g.jsx("a",{href:"/disclaimer",className:"lp-footer__link",children:"Disclaimer (18+)"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/privacy",className:"lp-footer__link",children:"Privacy Policy"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/terms",className:"lp-footer__link",children:"Terms of Use"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/support",className:"lp-footer__link",children:"Support"}),g.jsxs("span",{className:"lp-store-links",children:[g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("span",{className:"lp-coming",children:"Mobile App Coming Soon"})]})]}),g.jsx("p",{className:"lp-footnote",role:"note",children:"For entertainment purposes only. No real-money gambling or prizes."}),g.jsxs("p",{className:"lp-copy",children:["© ",new Date().getFullYear()," Zentara One LLC. All rights reserved."]})]})}function lae({selected:t,onChange:e,badges:r,className:n}){const a=v.useMemo(()=>[{key:"cee-lo",title:"CEE-LO",subtitle:"Fast • Social • Casual"},{key:"craps",title:"CRAPS",subtitle:"High energy • Strategy"},{key:"poker",title:"POKER",subtitle:"Skill-based • Competitive"}],[]),[i,o]=v.useState(0),c=v.useRef([]);v.useEffect(()=>{(async()=>{if(t){const h=a.findIndex(m=>m.key===t);h>=0&&o(h)}else try{const{Preferences:h}=await qr(async()=>{const{Preferences:_}=await Promise.resolve().then(()=>Oc);return{Preferences:_}},void 0,import.meta.url),{value:m}=await h.get({key:"selectedGameMode"});if(m==="cee-lo"||m==="craps"||m==="poker"){e(m);const _=a.findIndex(w=>w.key===m);_>=0&&o(_)}}catch{}})()},[t,e]),v.useEffect(()=>{t&&(async()=>{try{const{Preferences:h}=await qr(async()=>{const{Preferences:m}=await Promise.resolve().then(()=>Oc);return{Preferences:m}},void 0,import.meta.url);await h.set({key:"selectedGameMode",value:t})}catch{}})()},[t]);const u=v.useCallback(h=>{const m=c.current[h];m&&m.focus()},[]),d=v.useCallback(h=>{o(m=>{let _=m+h;return _<0&&(_=0),_>a.length-1&&(_=a.length-1),requestAnimationFrame(()=>u(_)),_})},[a.length,u]),f=v.useCallback(h=>{switch(h.key){case"ArrowLeft":case"ArrowUp":h.preventDefault(),d(-1);break;case"ArrowRight":case"ArrowDown":h.preventDefault(),d(1);break;case"Enter":case" ":h.preventDefault(),e(a[i].key);break}},[i,d,a,e]);return g.jsx("div",{className:"game-mode-selector"+(n?" "+n:""),role:"listbox","aria-label":"Choose game mode",tabIndex:0,onKeyDown:f,children:a.map((h,m)=>{const _=t===h.key,w=r?.[h.key];return g.jsxs("button",{ref:b=>c.current[m]=b,type:"button",role:"option","aria-selected":_,className:"game-mode-card"+(_?" game-mode-card--selected":" game-mode-card--muted"),onClick:()=>e(h.key),children:[w&&g.jsx("span",{className:"game-mode-card__badge","aria-label":w,children:w}),g.jsxs("div",{className:"game-mode-card__content",children:[g.jsx("div",{className:"game-mode-card__title",children:h.title}),g.jsx("div",{className:"game-mode-card__subtitle","aria-hidden":!0,children:h.subtitle})]})]},h.key)})})}function uae(){const{available:t,progress:e,applyNow:r,later:n}=aae(),{membershipModalOpen:a,setMembershipModalOpen:i}=Lb(),o=tn(),{roomsList:c,createRoom:u}=aB(),{pokerCreateRoom:d,getUserBalance:f}=pa(),{logout:h,user:m,refreshUser:_}=$r(),[w,b]=v.useState(!1),[E,T]=v.useState(!1),[R,P]=v.useState(!1),[A,C]=v.useState(!1),[O,I]=v.useState(!1),[x,D]=v.useState(!1),N="poker",L=(()=>{try{return window?.APP_TARGET??""}catch{return""}})(),j=(N||L).toString().toLowerCase().trim(),q=j==="craps"?"craps":j==="poker"?"poker":j==="cee-lo"||j==="ceelo"?"cee-lo":null,[U,W]=v.useState(q??null),[F,Y]=v.useState(!1),[Q,ie]=v.useState(!1),G=v.useRef(null),{info:B}=ou();v.useEffect(()=>{q||(async()=>{try{const{Preferences:se}=await qr(async()=>{const{Preferences:wt}=await Promise.resolve().then(()=>Oc);return{Preferences:wt}},void 0,import.meta.url),{value:Oe}=await se.get({key:"selectedGameMode"});W(Oe==="cee-lo"||Oe==="craps"||Oe==="poker"?Oe:"cee-lo")}catch{W("cee-lo")}})()},[q]),v.useEffect(()=>{q||U&&(async()=>{try{const{Preferences:se}=await qr(async()=>{const{Preferences:Oe}=await Promise.resolve().then(()=>Oc);return{Preferences:Oe}},void 0,import.meta.url);await se.set({key:"selectedGameMode",value:U})}catch{}})()},[U,q]);const K=v.useMemo(()=>{const se=q??U;if(!se)return c;const Oe=wt=>wt.filter(er=>(er.gameMode||"cee-lo")===se);return{public:Oe(c.public),private:Oe(c.private)}},[c,q,U]),ae=v.useRef(null),te=v.useCallback(()=>{cr("Light")},[]),me=v.useCallback(()=>{try{}catch{}},[]),ue=v.useCallback(()=>{try{Xr()}catch{}},[]),Ae=v.useCallback(se=>{ue(),se!==U?(te(),me(),W(se)):(te(),me())},[U,te,me,ue]),He=v.useRef(null),ce=v.useRef(null),[xe,re]=v.useState(1),[H,he]=v.useState(null),Re=v.useCallback(()=>{const se=ce.current,Oe=He.current;if(!se||!Oe)return;const wt=se.style.transform;se.style.transform="none";const er=se.scrollHeight,Qt=window.innerHeight;let Zt=Math.min(1,Qt/er);re(Zt),he(er*Zt),se.style.transform=wt},[]);v.useLayoutEffect(()=>{Re()},[Re,U]),v.useEffect(()=>{const se=new ResizeObserver(()=>requestAnimationFrame(Re)),Oe=ce.current;Oe&&se.observe(Oe),window.addEventListener("resize",Re);const wt=setTimeout(Re,250),er=setTimeout(Re,800);return()=>{se.disconnect(),window.removeEventListener("resize",Re),clearTimeout(wt),clearTimeout(er)}},[Re]);const fe=v.useCallback(()=>{o("/profile")},[o]),Ie=v.useCallback(()=>{o("/settings")},[o]),ct=v.useCallback(()=>{o("/add-chips")},[o]),$e=v.useCallback(()=>{o("/login")},[o]),tt=v.useCallback(()=>{ue(),te(),me(),h()},[h,te,me,ue]),We=async()=>{try{const se=m&&typeof m.balance=="number"?Number(m.balance):null;if(se!=null)return se;try{await Promise.resolve(_())}catch{}const Oe=m&&typeof m.balance=="number"?Number(m.balance):null;if(Oe!=null)return Oe}catch{}try{const se=await f?.();if(se?.ok&&typeof se.data?.balance=="number")return Number(se.data.balance)}catch{}return null},it=v.useCallback(async()=>{ue(),te(),me();try{if(m?.isGuest===!0){D(!0);return}}catch{}if(U==="poker")try{const se=await We();if(se!=null&&se<1e3){Y(!0);return}}catch{}T(!0)},[ue,te,me,U,m,_,i,$e]),Et=v.useCallback(async()=>{ue(),te(),me();try{if(m?.isGuest===!0){D(!0);return}}catch{}if(U==="poker")try{const se=await We();if(se!=null&&se<1e3){Y(!0);return}}catch{}P(!0)},[ue,te,me,U,m,_,i,$e]),Mt=v.useCallback(()=>{document.activeElement?.blur?.()},[]),_t=v.useCallback(()=>{Mt(),Et()},[Mt,Et]),ge=v.useCallback(()=>{Mt(),it()},[Mt,it]),{meId:Be}=$r(),je=v.useCallback(async()=>{if(ue(),!!U&&!O){I(!0),ie(!0),te(),me(),G.current&&clearTimeout(G.current),G.current=window.setTimeout(()=>{ie(!1),B("Try again.",{duration:3e3})},15e3);try{let se;U==="poker"?se=await d({name:"Single Player Room",singlePlayer:!0}):se=await u({singlePlayer:!0,name:"Single Player Room",gameMode:U});try{window.location.search.includes("e2e=1")&&(window.__handleCreateSingleRes=se)}catch{}const Oe=se?.room??se?.roomsList?.room??se?.data?.room??null,wt=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),er=Oe?.roomId??Oe?.id??se?.roomId??se?.data?.roomId;if(er&&Oe){G.current&&(clearTimeout(G.current),G.current=null);try{window.__PRESEEDED_ROOM=Oe}catch{}const Qt=wt?"?e2e=1":"";o(U==="poker"?`/poker/room/${er}${Qt}`:`/room/${er}${Qt}`)}else if(se?.error){const Qt=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),Zt=String(se.error||"");if(!Qt&&/insufficient|minimum buy-in/i.test(Zt)){Y(!0);return}}}catch(se){const Oe=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})();if(Oe){const wt=`e2e-${Math.random().toString(36).slice(2,8)}`;try{window.__handleCreateSingleRes={ok:!0,roomId:wt}}catch{}const er=Oe?"&e2e=1":"";o(U==="poker"?`/poker/room/${wt}?m=${U}${er}`:`/room/${wt}?m=${U}${er}`)}else{const wt=String(se?.message??se??"");/insufficient|minimum buy-in/i.test(wt)&&Y(!0)}}finally{I(!1),ie(!1),G.current&&(clearTimeout(G.current),G.current=null)}}},[ue,u,te,me,o,O,U,Be,B]),rt=v.useCallback(se=>()=>{ue(),te(),me(),se()},[ue,te,me]);m?.membershipTier;const Ct=!!m,jt=(()=>{try{return m?.isGuest===!0}catch{return!1}})(),De=v.useMemo(()=>[{key:"profile",label:"Profile",onClick:rt(fe)},{key:"chips",label:"Shop",onClick:rt(ct)},{key:"logout",label:"Log Out",onClick:rt(tt)}],[rt,fe,Ie,ct]),nt=v.useCallback(se=>{se.stopPropagation(),ue(),te(),me();try{if(m?.isGuest===!0){D(!0);return}}catch{}C(Oe=>!Oe)},[ue,te,me,m,$e]),at=v.useCallback(()=>C(!1),[]),we=v.useCallback(()=>T(!1),[]),st=v.useCallback(()=>P(!1),[]),bt=v.useCallback(()=>i(!1),[i]),[nr,ur]=v.useState(!1),dr=v.useCallback(()=>{ue(),te(),me(),ur(!0)},[ue,te,me]),Sr=v.useCallback(()=>ur(!1),[]),[un,Z]=v.useState(!1),[X,le]=v.useState(!1);v.useEffect(()=>{let se=!0;return(async()=>{try{const{Preferences:Oe}=await qr(async()=>{const{Preferences:er}=await Promise.resolve().then(()=>Oc);return{Preferences:er}},void 0,import.meta.url),{value:wt}=await Oe.get({key:"seenOnboardingV1"});if(!se)return;le(wt!=="1")}catch{if(!se)return;le(!0)}})(),()=>{se=!1}},[]);const be=v.useCallback(()=>le(!1),[]),z=v.useCallback(()=>{ue(),te(),me(),Z(!0)},[ue,te,me]),ee=v.useCallback(()=>Z(!1),[]);return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx(sae,{}),g.jsx(uP,{open:X,onClose:be}),g.jsxs("div",{className:"logout-container home-header-row",children:[g.jsx("a",{className:"home-header-link",title:"How to Play","aria-label":"How to Play",onClick:dr,role:"button",children:g.jsx("img",{src:cae,alt:"How to Play",className:"home-header-icon"})}),g.jsx("a",{className:"gold-link home-header-link",title:"Leaderboards","aria-label":"Leaderboards",onClick:z,children:"Leaderboards"}),!m&&g.jsx("a",{className:"gold-link",onClick:rt($e),children:"Login"}),m&&g.jsxs(g.Fragment,{children:[g.jsx("a",{ref:ae,className:"settings-toggle",title:"Settings","aria-label":"Settings","aria-haspopup":"menu","aria-expanded":A,onClick:nt,children:g.jsx("img",{src:oae,alt:"Settings",className:"home-header-icon"})}),g.jsx(WG,{anchorRef:ae,open:A,onClose:at,items:De})]})]}),g.jsx("div",{ref:He,className:"home-fit-shell",style:H?{height:H}:void 0,children:g.jsxs("div",{ref:ce,className:"home-fit-content",style:xe<1?{transform:`scale(${xe})`,transformOrigin:"top center"}:void 0,children:[(!Ct||jt)&&g.jsxs("div",{className:`promo-banner ${q?`promo-banner--${q}`:""}`,role:"region","aria-label":"Login banner",children:[g.jsx("div",{style:{marginBottom:16},children:g.jsx("span",{className:"promo-banner__title",children:"Login to unlock Multiplayer"})}),g.jsx("div",{children:g.jsx("button",{className:"btn gold-fill",onClick:rt($e),"aria-label":"Login",children:"Login"})})]}),g.jsx(uF,{}),!q&&g.jsx(lae,{selected:U,onChange:Ae,badges:{"cee-lo":"Most Popular"}}),g.jsxs("section",{className:"home-cta buttonRow","aria-label":"Actions",children:[g.jsx("div",{className:"cta-spotlight","aria-hidden":!0}),g.jsx("button",{className:"btn gold-fill cta-btn primaryButton",onClick:je,disabled:!U||O,"aria-label":"Single Player",children:"Single Player"}),g.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:_t,disabled:!U,"aria-label":"Join Room",children:"Join Room"}),g.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:ge,disabled:!U,"aria-label":"Create Room",children:"Create Room"})]})]})}),g.jsx(HG,{open:E,onClose:we,gameMode:U??"cee-lo"}),g.jsx(GG,{open:R,onClose:st,isPrivate:w,setIsPrivate:b,roomsList:K}),g.jsx(lF,{open:a,onClose:bt,planId:m?.membershipTier}),g.jsx(fF,{open:nr,onClose:Sr}),g.jsx(yne,{open:un,onClose:ee}),g.jsx(vne,{open:x,onClose:()=>D(!1),onGoLogin:()=>$e(),title:"Login Required",message:g.jsx(g.Fragment,{children:"Please log in to access Settings and Multiplayer."})}),g.jsx(iae,{available:t,progress:e,applyNow:r,later:n}),g.jsx(yP,{})]})}const dae=""+new URL("fairness-BAFxLGWm.png",import.meta.url).href;function vP({state:t}){const r={verified:{label:"Verified",cls:"fairness--ok",icon:"✓"},"bad-commit":{label:"Bad commit",cls:"fairness--bad",icon:"!"},mismatch:{label:"Mismatch",cls:"fairness--bad",icon:"!"},unverifiable:{label:"Unverified",cls:"fairness--dim",icon:"x"}}[t];return g.jsx("span",{className:`fairness ${r.cls}`,title:r.label,"aria-label":r.label,children:t==="verified"?g.jsx("img",{src:dae,alt:"Fairness verified",className:"fairness-img"}):r.icon})}/*!
 * Font Awesome Free 7.0.1 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 * Copyright 2025 Fonticons, Inc.
 */function LT(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function fae(t){if(Array.isArray(t))return t}function pae(t){if(Array.isArray(t))return LT(t)}function hae(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function mae(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,yF(n.key),n)}}function gae(t,e,r){return e&&mae(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function e_(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=_P(t))||e){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,o=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){c=!0,i=u},f:function(){try{o||r.return==null||r.return()}finally{if(c)throw i}}}}function Cr(t,e,r){return(e=yF(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yae(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function vae(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,a,i,o,c=[],u=!0,d=!1;try{if(i=(r=r.call(t)).next,e===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(f){d=!0,a=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return c}}function _ae(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bae(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aI(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function ut(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?aI(Object(r),!0).forEach(function(n){Cr(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):aI(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function r0(t,e){return fae(t)||vae(t,e)||_P(t,e)||_ae()}function Qs(t){return pae(t)||yae(t)||_P(t)||bae()}function kae(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function yF(t){var e=kae(t,"string");return typeof e=="symbol"?e:e+""}function Q_(t){"@babel/helpers - typeof";return Q_=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Q_(t)}function _P(t,e){if(t){if(typeof t=="string")return LT(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?LT(t,e):void 0}}var iI=function(){},bP={},vF={},_F=null,bF={mark:iI,measure:iI};try{typeof window<"u"&&(bP=window),typeof document<"u"&&(vF=document),typeof MutationObserver<"u"&&(_F=MutationObserver),typeof performance<"u"&&(bF=performance)}catch{}var wae=bP.navigator||{},sI=wae.userAgent,oI=sI===void 0?"":sI,Ql=bP,vn=vF,cI=_F,gv=bF;Ql.document;var Wc=!!vn.documentElement&&!!vn.head&&typeof vn.addEventListener=="function"&&typeof vn.createElement=="function",kF=~oI.indexOf("MSIE")||~oI.indexOf("Trident/"),qS,Sae=/fa(k|kd|s|r|l|t|d|dr|dl|dt|b|slr|slpr|wsb|tl|ns|nds|es|jr|jfr|jdr|cr|ss|sr|sl|st|sds|sdr|sdl|sdt)?[\-\ ]/,Eae=/Font ?Awesome ?([567 ]*)(Solid|Regular|Light|Thin|Duotone|Brands|Free|Pro|Sharp Duotone|Sharp|Kit|Notdog Duo|Notdog|Chisel|Etch|Thumbprint|Jelly Fill|Jelly Duo|Jelly|Slab Press|Slab|Whiteboard)?.*/i,wF={classic:{fa:"solid",fas:"solid","fa-solid":"solid",far:"regular","fa-regular":"regular",fal:"light","fa-light":"light",fat:"thin","fa-thin":"thin",fab:"brands","fa-brands":"brands"},duotone:{fa:"solid",fad:"solid","fa-solid":"solid","fa-duotone":"solid",fadr:"regular","fa-regular":"regular",fadl:"light","fa-light":"light",fadt:"thin","fa-thin":"thin"},sharp:{fa:"solid",fass:"solid","fa-solid":"solid",fasr:"regular","fa-regular":"regular",fasl:"light","fa-light":"light",fast:"thin","fa-thin":"thin"},"sharp-duotone":{fa:"solid",fasds:"solid","fa-solid":"solid",fasdr:"regular","fa-regular":"regular",fasdl:"light","fa-light":"light",fasdt:"thin","fa-thin":"thin"},slab:{"fa-regular":"regular",faslr:"regular"},"slab-press":{"fa-regular":"regular",faslpr:"regular"},thumbprint:{"fa-light":"light",fatl:"light"},whiteboard:{"fa-semibold":"semibold",fawsb:"semibold"},notdog:{"fa-solid":"solid",fans:"solid"},"notdog-duo":{"fa-solid":"solid",fands:"solid"},etch:{"fa-solid":"solid",faes:"solid"},jelly:{"fa-regular":"regular",fajr:"regular"},"jelly-fill":{"fa-regular":"regular",fajfr:"regular"},"jelly-duo":{"fa-regular":"regular",fajdr:"regular"},chisel:{"fa-regular":"regular",facr:"regular"}},Tae={GROUP:"duotone-group",PRIMARY:"primary",SECONDARY:"secondary"},SF=["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-thumbprint","fa-whiteboard","fa-notdog","fa-notdog-duo","fa-chisel","fa-etch","fa-jelly","fa-jelly-fill","fa-jelly-duo","fa-slab","fa-slab-press"],xa="classic",Bg="duotone",EF="sharp",TF="sharp-duotone",CF="chisel",xF="etch",PF="jelly",AF="jelly-duo",RF="jelly-fill",DF="notdog",OF="notdog-duo",NF="slab",IF="slab-press",MF="thumbprint",jF="whiteboard",Cae="Classic",xae="Duotone",Pae="Sharp",Aae="Sharp Duotone",Rae="Chisel",Dae="Etch",Oae="Jelly",Nae="Jelly Duo",Iae="Jelly Fill",Mae="Notdog",jae="Notdog Duo",Lae="Slab",Bae="Slab Press",Uae="Thumbprint",Fae="Whiteboard",LF=[xa,Bg,EF,TF,CF,xF,PF,AF,RF,DF,OF,NF,IF,MF,jF];qS={},Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(qS,xa,Cae),Bg,xae),EF,Pae),TF,Aae),CF,Rae),xF,Dae),PF,Oae),AF,Nae),RF,Iae),DF,Mae),Cr(Cr(Cr(Cr(Cr(qS,OF,jae),NF,Lae),IF,Bae),MF,Uae),jF,Fae);var qae={classic:{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},duotone:{900:"fad",400:"fadr",300:"fadl",100:"fadt"},sharp:{900:"fass",400:"fasr",300:"fasl",100:"fast"},"sharp-duotone":{900:"fasds",400:"fasdr",300:"fasdl",100:"fasdt"},slab:{400:"faslr"},"slab-press":{400:"faslpr"},whiteboard:{600:"fawsb"},thumbprint:{300:"fatl"},notdog:{900:"fans"},"notdog-duo":{900:"fands"},etch:{900:"faes"},chisel:{400:"facr"},jelly:{400:"fajr"},"jelly-fill":{400:"fajfr"},"jelly-duo":{400:"fajdr"}},zae={"Font Awesome 7 Free":{900:"fas",400:"far"},"Font Awesome 7 Pro":{900:"fas",400:"far",normal:"far",300:"fal",100:"fat"},"Font Awesome 7 Brands":{400:"fab",normal:"fab"},"Font Awesome 7 Duotone":{900:"fad",400:"fadr",normal:"fadr",300:"fadl",100:"fadt"},"Font Awesome 7 Sharp":{900:"fass",400:"fasr",normal:"fasr",300:"fasl",100:"fast"},"Font Awesome 7 Sharp Duotone":{900:"fasds",400:"fasdr",normal:"fasdr",300:"fasdl",100:"fasdt"},"Font Awesome 7 Jelly":{400:"fajr",normal:"fajr"},"Font Awesome 7 Jelly Fill":{400:"fajfr",normal:"fajfr"},"Font Awesome 7 Jelly Duo":{400:"fajdr",normal:"fajdr"},"Font Awesome 7 Slab":{400:"faslr",normal:"faslr"},"Font Awesome 7 Slab Press":{400:"faslpr",normal:"faslpr"},"Font Awesome 7 Thumbprint":{300:"fatl",normal:"fatl"},"Font Awesome 7 Notdog":{900:"fans",normal:"fans"},"Font Awesome 7 Notdog Duo":{900:"fands",normal:"fands"},"Font Awesome 7 Etch":{900:"faes",normal:"faes"},"Font Awesome 7 Chisel":{400:"facr",normal:"facr"},"Font Awesome 7 Whiteboard":{600:"fawsb",normal:"fawsb"}},$ae=new Map([["classic",{defaultShortPrefixId:"fas",defaultStyleId:"solid",styleIds:["solid","regular","light","thin","brands"],futureStyleIds:[],defaultFontWeight:900}],["duotone",{defaultShortPrefixId:"fad",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp",{defaultShortPrefixId:"fass",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["sharp-duotone",{defaultShortPrefixId:"fasds",defaultStyleId:"solid",styleIds:["solid","regular","light","thin"],futureStyleIds:[],defaultFontWeight:900}],["chisel",{defaultShortPrefixId:"facr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["etch",{defaultShortPrefixId:"faes",defaultStyleId:"solid",styleIds:["solid"],futureStyleIds:[],defaultFontWeight:900}],["jelly",{defaultShortPrefixId:"fajr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["jelly-duo",{defaultShortPrefixId:"fajdr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["jelly-fill",{defaultShortPrefixId:"fajfr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["notdog",{defaultShortPrefixId:"fans",defaultStyleId:"solid",styleIds:["solid"],futureStyleIds:[],defaultFontWeight:900}],["notdog-duo",{defaultShortPrefixId:"fands",defaultStyleId:"solid",styleIds:["solid"],futureStyleIds:[],defaultFontWeight:900}],["slab",{defaultShortPrefixId:"faslr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["slab-press",{defaultShortPrefixId:"faslpr",defaultStyleId:"regular",styleIds:["regular"],futureStyleIds:[],defaultFontWeight:400}],["thumbprint",{defaultShortPrefixId:"fatl",defaultStyleId:"light",styleIds:["light"],futureStyleIds:[],defaultFontWeight:300}],["whiteboard",{defaultShortPrefixId:"fawsb",defaultStyleId:"semibold",styleIds:["semibold"],futureStyleIds:[],defaultFontWeight:600}]]),Vae={chisel:{regular:"facr"},classic:{brands:"fab",light:"fal",regular:"far",solid:"fas",thin:"fat"},duotone:{light:"fadl",regular:"fadr",solid:"fad",thin:"fadt"},etch:{solid:"faes"},jelly:{regular:"fajr"},"jelly-duo":{regular:"fajdr"},"jelly-fill":{regular:"fajfr"},notdog:{solid:"fans"},"notdog-duo":{solid:"fands"},sharp:{light:"fasl",regular:"fasr",solid:"fass",thin:"fast"},"sharp-duotone":{light:"fasdl",regular:"fasdr",solid:"fasds",thin:"fasdt"},slab:{regular:"faslr"},"slab-press":{regular:"faslpr"},thumbprint:{light:"fatl"},whiteboard:{semibold:"fawsb"}},BF=["fak","fa-kit","fakd","fa-kit-duotone"],lI={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},Hae=["kit"],Gae="kit",Wae="kit-duotone",Kae="Kit",Yae="Kit Duotone";Cr(Cr({},Gae,Kae),Wae,Yae);var Xae={kit:{"fa-kit":"fak"}},Jae={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},Qae={kit:{fak:"fa-kit"}},uI={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}},zS,yv={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},Zae=["fa-classic","fa-duotone","fa-sharp","fa-sharp-duotone","fa-thumbprint","fa-whiteboard","fa-notdog","fa-notdog-duo","fa-chisel","fa-etch","fa-jelly","fa-jelly-fill","fa-jelly-duo","fa-slab","fa-slab-press"],eie="classic",tie="duotone",rie="sharp",nie="sharp-duotone",aie="chisel",iie="etch",sie="jelly",oie="jelly-duo",cie="jelly-fill",lie="notdog",uie="notdog-duo",die="slab",fie="slab-press",pie="thumbprint",hie="whiteboard",mie="Classic",gie="Duotone",yie="Sharp",vie="Sharp Duotone",_ie="Chisel",bie="Etch",kie="Jelly",wie="Jelly Duo",Sie="Jelly Fill",Eie="Notdog",Tie="Notdog Duo",Cie="Slab",xie="Slab Press",Pie="Thumbprint",Aie="Whiteboard";zS={},Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(Cr(zS,eie,mie),tie,gie),rie,yie),nie,vie),aie,_ie),iie,bie),sie,kie),oie,wie),cie,Sie),lie,Eie),Cr(Cr(Cr(Cr(Cr(zS,uie,Tie),die,Cie),fie,xie),pie,Pie),hie,Aie);var Rie="kit",Die="kit-duotone",Oie="Kit",Nie="Kit Duotone";Cr(Cr({},Rie,Oie),Die,Nie);var Iie={classic:{"fa-brands":"fab","fa-duotone":"fad","fa-light":"fal","fa-regular":"far","fa-solid":"fas","fa-thin":"fat"},duotone:{"fa-regular":"fadr","fa-light":"fadl","fa-thin":"fadt"},sharp:{"fa-solid":"fass","fa-regular":"fasr","fa-light":"fasl","fa-thin":"fast"},"sharp-duotone":{"fa-solid":"fasds","fa-regular":"fasdr","fa-light":"fasdl","fa-thin":"fasdt"},slab:{"fa-regular":"faslr"},"slab-press":{"fa-regular":"faslpr"},whiteboard:{"fa-semibold":"fawsb"},thumbprint:{"fa-light":"fatl"},notdog:{"fa-solid":"fans"},"notdog-duo":{"fa-solid":"fands"},etch:{"fa-solid":"faes"},jelly:{"fa-regular":"fajr"},"jelly-fill":{"fa-regular":"fajfr"},"jelly-duo":{"fa-regular":"fajdr"},chisel:{"fa-regular":"facr"}},Mie={classic:["fas","far","fal","fat","fad"],duotone:["fadr","fadl","fadt"],sharp:["fass","fasr","fasl","fast"],"sharp-duotone":["fasds","fasdr","fasdl","fasdt"],slab:["faslr"],"slab-press":["faslpr"],whiteboard:["fawsb"],thumbprint:["fatl"],notdog:["fans"],"notdog-duo":["fands"],etch:["faes"],jelly:["fajr"],"jelly-fill":["fajfr"],"jelly-duo":["fajdr"],chisel:["facr"]},BT={classic:{fab:"fa-brands",fad:"fa-duotone",fal:"fa-light",far:"fa-regular",fas:"fa-solid",fat:"fa-thin"},duotone:{fadr:"fa-regular",fadl:"fa-light",fadt:"fa-thin"},sharp:{fass:"fa-solid",fasr:"fa-regular",fasl:"fa-light",fast:"fa-thin"},"sharp-duotone":{fasds:"fa-solid",fasdr:"fa-regular",fasdl:"fa-light",fasdt:"fa-thin"},slab:{faslr:"fa-regular"},"slab-press":{faslpr:"fa-regular"},whiteboard:{fawsb:"fa-semibold"},thumbprint:{fatl:"fa-light"},notdog:{fans:"fa-solid"},"notdog-duo":{fands:"fa-solid"},etch:{faes:"fa-solid"},jelly:{fajr:"fa-regular"},"jelly-fill":{fajfr:"fa-regular"},"jelly-duo":{fajdr:"fa-regular"},chisel:{facr:"fa-regular"}},jie=["fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands","fa-semibold"],UF=["fa","fas","far","fal","fat","fad","fadr","fadl","fadt","fab","fass","fasr","fasl","fast","fasds","fasdr","fasdl","fasdt","faslr","faslpr","fawsb","fatl","fans","fands","faes","fajr","fajfr","fajdr","facr"].concat(Zae,jie),Lie=["solid","regular","light","thin","duotone","brands","semibold"],FF=[1,2,3,4,5,6,7,8,9,10],Bie=FF.concat([11,12,13,14,15,16,17,18,19,20]),Uie=["aw","fw","pull-left","pull-right"],Fie=[].concat(Qs(Object.keys(Mie)),Lie,Uie,["2xs","xs","sm","lg","xl","2xl","beat","border","fade","beat-fade","bounce","flip-both","flip-horizontal","flip-vertical","flip","inverse","layers","layers-bottom-left","layers-bottom-right","layers-counter","layers-text","layers-top-left","layers-top-right","li","pull-end","pull-start","pulse","rotate-180","rotate-270","rotate-90","rotate-by","shake","spin-pulse","spin-reverse","spin","stack-1x","stack-2x","stack","ul","width-auto","width-fixed",yv.GROUP,yv.SWAP_OPACITY,yv.PRIMARY,yv.SECONDARY]).concat(FF.map(function(t){return"".concat(t,"x")})).concat(Bie.map(function(t){return"w-".concat(t)})),qie={"Font Awesome 5 Free":{900:"fas",400:"far"},"Font Awesome 5 Pro":{900:"fas",400:"far",normal:"far",300:"fal"},"Font Awesome 5 Brands":{400:"fab",normal:"fab"},"Font Awesome 5 Duotone":{900:"fad"}},qc="___FONT_AWESOME___",UT=16,qF="fa",zF="svg-inline--fa",ld="data-fa-i2svg",FT="data-fa-pseudo-element",zie="data-fa-pseudo-element-pending",kP="data-prefix",wP="data-icon",dI="fontawesome-i2svg",$ie="async",Vie=["HTML","HEAD","STYLE","SCRIPT"],$F=["::before","::after",":before",":after"],VF=(function(){try{return!0}catch{return!1}})();function Ug(t){return new Proxy(t,{get:function(r,n){return n in r?r[n]:r[xa]}})}var HF=ut({},wF);HF[xa]=ut(ut(ut(ut({},{"fa-duotone":"duotone"}),wF[xa]),lI.kit),lI["kit-duotone"]);var Hie=Ug(HF),qT=ut({},Vae);qT[xa]=ut(ut(ut(ut({},{duotone:"fad"}),qT[xa]),uI.kit),uI["kit-duotone"]);var fI=Ug(qT),zT=ut({},BT);zT[xa]=ut(ut({},zT[xa]),Qae.kit);var SP=Ug(zT),$T=ut({},Iie);$T[xa]=ut(ut({},$T[xa]),Xae.kit);Ug($T);var Gie=Sae,GF="fa-layers-text",Wie=Eae,Kie=ut({},qae);Ug(Kie);var Yie=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],$S=Tae,Xie=[].concat(Qs(Hae),Qs(Fie)),um=Ql.FontAwesomeConfig||{};function Jie(t){var e=vn.querySelector("script["+t+"]");if(e)return e.getAttribute(t)}function Qie(t){return t===""?!0:t==="false"?!1:t==="true"?!0:t}if(vn&&typeof vn.querySelector=="function"){var Zie=[["data-family-prefix","familyPrefix"],["data-css-prefix","cssPrefix"],["data-family-default","familyDefault"],["data-style-default","styleDefault"],["data-replacement-class","replacementClass"],["data-auto-replace-svg","autoReplaceSvg"],["data-auto-add-css","autoAddCss"],["data-search-pseudo-elements","searchPseudoElements"],["data-search-pseudo-elements-warnings","searchPseudoElementsWarnings"],["data-search-pseudo-elements-full-scan","searchPseudoElementsFullScan"],["data-observe-mutations","observeMutations"],["data-mutate-approach","mutateApproach"],["data-keep-original-source","keepOriginalSource"],["data-measure-performance","measurePerformance"],["data-show-missing-icons","showMissingIcons"]];Zie.forEach(function(t){var e=r0(t,2),r=e[0],n=e[1],a=Qie(Jie(r));a!=null&&(um[n]=a)})}var WF={styleDefault:"solid",familyDefault:xa,cssPrefix:qF,replacementClass:zF,autoReplaceSvg:!0,autoAddCss:!0,searchPseudoElements:!1,searchPseudoElementsWarnings:!0,searchPseudoElementsFullScan:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};um.familyPrefix&&(um.cssPrefix=um.familyPrefix);var op=ut(ut({},WF),um);op.autoReplaceSvg||(op.observeMutations=!1);var qt={};Object.keys(WF).forEach(function(t){Object.defineProperty(qt,t,{enumerable:!0,set:function(r){op[t]=r,dm.forEach(function(n){return n(qt)})},get:function(){return op[t]}})});Object.defineProperty(qt,"familyPrefix",{enumerable:!0,set:function(e){op.cssPrefix=e,dm.forEach(function(r){return r(qt)})},get:function(){return op.cssPrefix}});Ql.FontAwesomeConfig=qt;var dm=[];function ese(t){return dm.push(t),function(){dm.splice(dm.indexOf(t),1)}}var cf=UT,jo={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function tse(t){if(!(!t||!Wc)){var e=vn.createElement("style");e.setAttribute("type","text/css"),e.innerHTML=t;for(var r=vn.head.childNodes,n=null,a=r.length-1;a>-1;a--){var i=r[a],o=(i.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(o)>-1&&(n=i)}return vn.head.insertBefore(e,n),t}}var rse="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function pI(){for(var t=12,e="";t-- >0;)e+=rse[Math.random()*62|0];return e}function Rp(t){for(var e=[],r=(t||[]).length>>>0;r--;)e[r]=t[r];return e}function EP(t){return t.classList?Rp(t.classList):(t.getAttribute("class")||"").split(" ").filter(function(e){return e})}function KF(t){return"".concat(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nse(t){return Object.keys(t||{}).reduce(function(e,r){return e+"".concat(r,'="').concat(KF(t[r]),'" ')},"").trim()}function n0(t){return Object.keys(t||{}).reduce(function(e,r){return e+"".concat(r,": ").concat(t[r].trim(),";")},"")}function TP(t){return t.size!==jo.size||t.x!==jo.x||t.y!==jo.y||t.rotate!==jo.rotate||t.flipX||t.flipY}function ase(t){var e=t.transform,r=t.containerWidth,n=t.iconWidth,a={transform:"translate(".concat(r/2," 256)")},i="translate(".concat(e.x*32,", ").concat(e.y*32,") "),o="scale(".concat(e.size/16*(e.flipX?-1:1),", ").concat(e.size/16*(e.flipY?-1:1),") "),c="rotate(".concat(e.rotate," 0 0)"),u={transform:"".concat(i," ").concat(o," ").concat(c)},d={transform:"translate(".concat(n/2*-1," -256)")};return{outer:a,inner:u,path:d}}function ise(t){var e=t.transform,r=t.width,n=r===void 0?UT:r,a=t.height,i=a===void 0?UT:a,o="";return kF?o+="translate(".concat(e.x/cf-n/2,"em, ").concat(e.y/cf-i/2,"em) "):o+="translate(calc(-50% + ".concat(e.x/cf,"em), calc(-50% + ").concat(e.y/cf,"em)) "),o+="scale(".concat(e.size/cf*(e.flipX?-1:1),", ").concat(e.size/cf*(e.flipY?-1:1),") "),o+="rotate(".concat(e.rotate,"deg) "),o}var sse=`:root, :host {
  --fa-font-solid: normal 900 1em/1 "Font Awesome 7 Free";
  --fa-font-regular: normal 400 1em/1 "Font Awesome 7 Free";
  --fa-font-light: normal 300 1em/1 "Font Awesome 7 Pro";
  --fa-font-thin: normal 100 1em/1 "Font Awesome 7 Pro";
  --fa-font-duotone: normal 900 1em/1 "Font Awesome 7 Duotone";
  --fa-font-duotone-regular: normal 400 1em/1 "Font Awesome 7 Duotone";
  --fa-font-duotone-light: normal 300 1em/1 "Font Awesome 7 Duotone";
  --fa-font-duotone-thin: normal 100 1em/1 "Font Awesome 7 Duotone";
  --fa-font-brands: normal 400 1em/1 "Font Awesome 7 Brands";
  --fa-font-sharp-solid: normal 900 1em/1 "Font Awesome 7 Sharp";
  --fa-font-sharp-regular: normal 400 1em/1 "Font Awesome 7 Sharp";
  --fa-font-sharp-light: normal 300 1em/1 "Font Awesome 7 Sharp";
  --fa-font-sharp-thin: normal 100 1em/1 "Font Awesome 7 Sharp";
  --fa-font-sharp-duotone-solid: normal 900 1em/1 "Font Awesome 7 Sharp Duotone";
  --fa-font-sharp-duotone-regular: normal 400 1em/1 "Font Awesome 7 Sharp Duotone";
  --fa-font-sharp-duotone-light: normal 300 1em/1 "Font Awesome 7 Sharp Duotone";
  --fa-font-sharp-duotone-thin: normal 100 1em/1 "Font Awesome 7 Sharp Duotone";
  --fa-font-slab-regular: normal 400 1em/1 "Font Awesome 7 Slab";
  --fa-font-slab-press-regular: normal 400 1em/1 "Font Awesome 7 Slab Press";
  --fa-font-whiteboard-semibold: normal 600 1em/1 "Font Awesome 7 Whiteboard";
  --fa-font-thumbprint-light: normal 300 1em/1 "Font Awesome 7 Thumbprint";
  --fa-font-notdog-solid: normal 900 1em/1 "Font Awesome 7 Notdog";
  --fa-font-notdog-duo-solid: normal 900 1em/1 "Font Awesome 7 Notdog Duo";
  --fa-font-etch-solid: normal 900 1em/1 "Font Awesome 7 Etch";
  --fa-font-jelly-regular: normal 400 1em/1 "Font Awesome 7 Jelly";
  --fa-font-jelly-fill-regular: normal 400 1em/1 "Font Awesome 7 Jelly Fill";
  --fa-font-jelly-duo-regular: normal 400 1em/1 "Font Awesome 7 Jelly Duo";
  --fa-font-chisel-regular: normal 400 1em/1 "Font Awesome 7 Chisel";
}

.svg-inline--fa {
  box-sizing: content-box;
  display: var(--fa-display, inline-block);
  height: 1em;
  overflow: visible;
  vertical-align: -0.125em;
  width: var(--fa-width, 1.25em);
}
.svg-inline--fa.fa-2xs {
  vertical-align: 0.1em;
}
.svg-inline--fa.fa-xs {
  vertical-align: 0em;
}
.svg-inline--fa.fa-sm {
  vertical-align: -0.0714285714em;
}
.svg-inline--fa.fa-lg {
  vertical-align: -0.2em;
}
.svg-inline--fa.fa-xl {
  vertical-align: -0.25em;
}
.svg-inline--fa.fa-2xl {
  vertical-align: -0.3125em;
}
.svg-inline--fa.fa-pull-left,
.svg-inline--fa .fa-pull-start {
  float: inline-start;
  margin-inline-end: var(--fa-pull-margin, 0.3em);
}
.svg-inline--fa.fa-pull-right,
.svg-inline--fa .fa-pull-end {
  float: inline-end;
  margin-inline-start: var(--fa-pull-margin, 0.3em);
}
.svg-inline--fa.fa-li {
  width: var(--fa-li-width, 2em);
  inset-inline-start: calc(-1 * var(--fa-li-width, 2em));
  inset-block-start: 0.25em; /* syncing vertical alignment with Web Font rendering */
}

.fa-layers-counter, .fa-layers-text {
  display: inline-block;
  position: absolute;
  text-align: center;
}

.fa-layers {
  display: inline-block;
  height: 1em;
  position: relative;
  text-align: center;
  vertical-align: -0.125em;
  width: var(--fa-width, 1.25em);
}
.fa-layers .svg-inline--fa {
  inset: 0;
  margin: auto;
  position: absolute;
  transform-origin: center center;
}

.fa-layers-text {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}

.fa-layers-counter {
  background-color: var(--fa-counter-background-color, #ff253a);
  border-radius: var(--fa-counter-border-radius, 1em);
  box-sizing: border-box;
  color: var(--fa-inverse, #fff);
  line-height: var(--fa-counter-line-height, 1);
  max-width: var(--fa-counter-max-width, 5em);
  min-width: var(--fa-counter-min-width, 1.5em);
  overflow: hidden;
  padding: var(--fa-counter-padding, 0.25em 0.5em);
  right: var(--fa-right, 0);
  text-overflow: ellipsis;
  top: var(--fa-top, 0);
  transform: scale(var(--fa-counter-scale, 0.25));
  transform-origin: top right;
}

.fa-layers-bottom-right {
  bottom: var(--fa-bottom, 0);
  right: var(--fa-right, 0);
  top: auto;
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: bottom right;
}

.fa-layers-bottom-left {
  bottom: var(--fa-bottom, 0);
  left: var(--fa-left, 0);
  right: auto;
  top: auto;
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: bottom left;
}

.fa-layers-top-right {
  top: var(--fa-top, 0);
  right: var(--fa-right, 0);
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: top right;
}

.fa-layers-top-left {
  left: var(--fa-left, 0);
  right: auto;
  top: var(--fa-top, 0);
  transform: scale(var(--fa-layers-scale, 0.25));
  transform-origin: top left;
}

.fa-1x {
  font-size: 1em;
}

.fa-2x {
  font-size: 2em;
}

.fa-3x {
  font-size: 3em;
}

.fa-4x {
  font-size: 4em;
}

.fa-5x {
  font-size: 5em;
}

.fa-6x {
  font-size: 6em;
}

.fa-7x {
  font-size: 7em;
}

.fa-8x {
  font-size: 8em;
}

.fa-9x {
  font-size: 9em;
}

.fa-10x {
  font-size: 10em;
}

.fa-2xs {
  font-size: calc(10 / 16 * 1em); /* converts a 10px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 10 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 10 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-xs {
  font-size: calc(12 / 16 * 1em); /* converts a 12px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 12 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 12 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-sm {
  font-size: calc(14 / 16 * 1em); /* converts a 14px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 14 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 14 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-lg {
  font-size: calc(20 / 16 * 1em); /* converts a 20px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 20 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 20 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-xl {
  font-size: calc(24 / 16 * 1em); /* converts a 24px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 24 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 24 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-2xl {
  font-size: calc(32 / 16 * 1em); /* converts a 32px size into an em-based value that's relative to the scale's 16px base */
  line-height: calc(1 / 32 * 1em); /* sets the line-height of the icon back to that of it's parent */
  vertical-align: calc((6 / 32 - 0.375) * 1em); /* vertically centers the icon taking into account the surrounding text's descender */
}

.fa-width-auto {
  --fa-width: auto;
}

.fa-fw,
.fa-width-fixed {
  --fa-width: 1.25em;
}

.fa-ul {
  list-style-type: none;
  margin-inline-start: var(--fa-li-margin, 2.5em);
  padding-inline-start: 0;
}
.fa-ul > li {
  position: relative;
}

.fa-li {
  inset-inline-start: calc(-1 * var(--fa-li-width, 2em));
  position: absolute;
  text-align: center;
  width: var(--fa-li-width, 2em);
  line-height: inherit;
}

/* Heads Up: Bordered Icons will not be supported in the future!
  - This feature will be deprecated in the next major release of Font Awesome (v8)!
  - You may continue to use it in this version *v7), but it will not be supported in Font Awesome v8.
*/
/* Notes:
* --@{v.$css-prefix}-border-width = 1/16 by default (to render as ~1px based on a 16px default font-size)
* --@{v.$css-prefix}-border-padding =
  ** 3/16 for vertical padding (to give ~2px of vertical whitespace around an icon considering it's vertical alignment)
  ** 4/16 for horizontal padding (to give ~4px of horizontal whitespace around an icon)
*/
.fa-border {
  border-color: var(--fa-border-color, #eee);
  border-radius: var(--fa-border-radius, 0.1em);
  border-style: var(--fa-border-style, solid);
  border-width: var(--fa-border-width, 0.0625em);
  box-sizing: var(--fa-border-box-sizing, content-box);
  padding: var(--fa-border-padding, 0.1875em 0.25em);
}

.fa-pull-left,
.fa-pull-start {
  float: inline-start;
  margin-inline-end: var(--fa-pull-margin, 0.3em);
}

.fa-pull-right,
.fa-pull-end {
  float: inline-end;
  margin-inline-start: var(--fa-pull-margin, 0.3em);
}

.fa-beat {
  animation-name: fa-beat;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, ease-in-out);
}

.fa-bounce {
  animation-name: fa-bounce;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.28, 0.84, 0.42, 1));
}

.fa-fade {
  animation-name: fa-fade;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
}

.fa-beat-fade {
  animation-name: fa-beat-fade;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, cubic-bezier(0.4, 0, 0.6, 1));
}

.fa-flip {
  animation-name: fa-flip;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, ease-in-out);
}

.fa-shake {
  animation-name: fa-shake;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, linear);
}

.fa-spin {
  animation-name: fa-spin;
  animation-delay: var(--fa-animation-delay, 0s);
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 2s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, linear);
}

.fa-spin-reverse {
  --fa-animation-direction: reverse;
}

.fa-pulse,
.fa-spin-pulse {
  animation-name: fa-spin;
  animation-direction: var(--fa-animation-direction, normal);
  animation-duration: var(--fa-animation-duration, 1s);
  animation-iteration-count: var(--fa-animation-iteration-count, infinite);
  animation-timing-function: var(--fa-animation-timing, steps(8));
}

@media (prefers-reduced-motion: reduce) {
  .fa-beat,
  .fa-bounce,
  .fa-fade,
  .fa-beat-fade,
  .fa-flip,
  .fa-pulse,
  .fa-shake,
  .fa-spin,
  .fa-spin-pulse {
    animation: none !important;
    transition: none !important;
  }
}
@keyframes fa-beat {
  0%, 90% {
    transform: scale(1);
  }
  45% {
    transform: scale(var(--fa-beat-scale, 1.25));
  }
}
@keyframes fa-bounce {
  0% {
    transform: scale(1, 1) translateY(0);
  }
  10% {
    transform: scale(var(--fa-bounce-start-scale-x, 1.1), var(--fa-bounce-start-scale-y, 0.9)) translateY(0);
  }
  30% {
    transform: scale(var(--fa-bounce-jump-scale-x, 0.9), var(--fa-bounce-jump-scale-y, 1.1)) translateY(var(--fa-bounce-height, -0.5em));
  }
  50% {
    transform: scale(var(--fa-bounce-land-scale-x, 1.05), var(--fa-bounce-land-scale-y, 0.95)) translateY(0);
  }
  57% {
    transform: scale(1, 1) translateY(var(--fa-bounce-rebound, -0.125em));
  }
  64% {
    transform: scale(1, 1) translateY(0);
  }
  100% {
    transform: scale(1, 1) translateY(0);
  }
}
@keyframes fa-fade {
  50% {
    opacity: var(--fa-fade-opacity, 0.4);
  }
}
@keyframes fa-beat-fade {
  0%, 100% {
    opacity: var(--fa-beat-fade-opacity, 0.4);
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(var(--fa-beat-fade-scale, 1.125));
  }
}
@keyframes fa-flip {
  50% {
    transform: rotate3d(var(--fa-flip-x, 0), var(--fa-flip-y, 1), var(--fa-flip-z, 0), var(--fa-flip-angle, -180deg));
  }
}
@keyframes fa-shake {
  0% {
    transform: rotate(-15deg);
  }
  4% {
    transform: rotate(15deg);
  }
  8%, 24% {
    transform: rotate(-18deg);
  }
  12%, 28% {
    transform: rotate(18deg);
  }
  16% {
    transform: rotate(-22deg);
  }
  20% {
    transform: rotate(22deg);
  }
  32% {
    transform: rotate(-12deg);
  }
  36% {
    transform: rotate(12deg);
  }
  40%, 100% {
    transform: rotate(0deg);
  }
}
@keyframes fa-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
.fa-rotate-90 {
  transform: rotate(90deg);
}

.fa-rotate-180 {
  transform: rotate(180deg);
}

.fa-rotate-270 {
  transform: rotate(270deg);
}

.fa-flip-horizontal {
  transform: scale(-1, 1);
}

.fa-flip-vertical {
  transform: scale(1, -1);
}

.fa-flip-both,
.fa-flip-horizontal.fa-flip-vertical {
  transform: scale(-1, -1);
}

.fa-rotate-by {
  transform: rotate(var(--fa-rotate-angle, 0));
}

.svg-inline--fa .fa-primary {
  fill: var(--fa-primary-color, currentColor);
  opacity: var(--fa-primary-opacity, 1);
}

.svg-inline--fa .fa-secondary {
  fill: var(--fa-secondary-color, currentColor);
  opacity: var(--fa-secondary-opacity, 0.4);
}

.svg-inline--fa.fa-swap-opacity .fa-primary {
  opacity: var(--fa-secondary-opacity, 0.4);
}

.svg-inline--fa.fa-swap-opacity .fa-secondary {
  opacity: var(--fa-primary-opacity, 1);
}

.svg-inline--fa mask .fa-primary,
.svg-inline--fa mask .fa-secondary {
  fill: black;
}

.svg-inline--fa.fa-inverse {
  fill: var(--fa-inverse, #fff);
}

.fa-stack {
  display: inline-block;
  height: 2em;
  line-height: 2em;
  position: relative;
  vertical-align: middle;
  width: 2.5em;
}

.fa-inverse {
  color: var(--fa-inverse, #fff);
}

.svg-inline--fa.fa-stack-1x {
  --fa-width: 1.25em;
  height: 1em;
  width: var(--fa-width);
}
.svg-inline--fa.fa-stack-2x {
  --fa-width: 2.5em;
  height: 2em;
  width: var(--fa-width);
}

.fa-stack-1x,
.fa-stack-2x {
  inset: 0;
  margin: auto;
  position: absolute;
  z-index: var(--fa-stack-z-index, auto);
}`;function YF(){var t=qF,e=zF,r=qt.cssPrefix,n=qt.replacementClass,a=sse;if(r!==t||n!==e){var i=new RegExp("\\.".concat(t,"\\-"),"g"),o=new RegExp("\\--".concat(t,"\\-"),"g"),c=new RegExp("\\.".concat(e),"g");a=a.replace(i,".".concat(r,"-")).replace(o,"--".concat(r,"-")).replace(c,".".concat(n))}return a}var hI=!1;function VS(){qt.autoAddCss&&!hI&&(tse(YF()),hI=!0)}var ose={mixout:function(){return{dom:{css:YF,insertCss:VS}}},hooks:function(){return{beforeDOMElementCreation:function(){VS()},beforeI2svg:function(){VS()}}}},zc=Ql||{};zc[qc]||(zc[qc]={});zc[qc].styles||(zc[qc].styles={});zc[qc].hooks||(zc[qc].hooks={});zc[qc].shims||(zc[qc].shims=[]);var Hs=zc[qc],XF=[],JF=function(){vn.removeEventListener("DOMContentLoaded",JF),Z_=1,XF.map(function(e){return e()})},Z_=!1;Wc&&(Z_=(vn.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(vn.readyState),Z_||vn.addEventListener("DOMContentLoaded",JF));function cse(t){Wc&&(Z_?setTimeout(t,0):XF.push(t))}function Fg(t){var e=t.tag,r=t.attributes,n=r===void 0?{}:r,a=t.children,i=a===void 0?[]:a;return typeof t=="string"?KF(t):"<".concat(e," ").concat(nse(n),">").concat(i.map(Fg).join(""),"</").concat(e,">")}function mI(t,e,r){if(t&&t[e]&&t[e][r])return{prefix:e,iconName:r,icon:t[e][r]}}var HS=function(e,r,n,a){var i=Object.keys(e),o=i.length,c=r,u,d,f;for(n===void 0?(u=1,f=e[i[0]]):(u=0,f=n);u<o;u++)d=i[u],f=c(f,e[d],d,e);return f};function QF(t){return Qs(t).length!==1?null:t.codePointAt(0).toString(16)}function gI(t){return Object.keys(t).reduce(function(e,r){var n=t[r],a=!!n.icon;return a?e[n.iconName]=n.icon:e[r]=n,e},{})}function VT(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.skipHooks,a=n===void 0?!1:n,i=gI(e);typeof Hs.hooks.addPack=="function"&&!a?Hs.hooks.addPack(t,gI(e)):Hs.styles[t]=ut(ut({},Hs.styles[t]||{}),i),t==="fas"&&VT("fa",e)}var qm=Hs.styles,lse=Hs.shims,ZF=Object.keys(SP),use=ZF.reduce(function(t,e){return t[e]=Object.keys(SP[e]),t},{}),CP=null,e5={},t5={},r5={},n5={},a5={};function dse(t){return~Xie.indexOf(t)}function fse(t,e){var r=e.split("-"),n=r[0],a=r.slice(1).join("-");return n===t&&a!==""&&!dse(a)?a:null}var i5=function(){var e=function(i){return HS(qm,function(o,c,u){return o[u]=HS(c,i,{}),o},{})};e5=e(function(a,i,o){if(i[3]&&(a[i[3]]=o),i[2]){var c=i[2].filter(function(u){return typeof u=="number"});c.forEach(function(u){a[u.toString(16)]=o})}return a}),t5=e(function(a,i,o){if(a[o]=o,i[2]){var c=i[2].filter(function(u){return typeof u=="string"});c.forEach(function(u){a[u]=o})}return a}),a5=e(function(a,i,o){var c=i[2];return a[o]=o,c.forEach(function(u){a[u]=o}),a});var r="far"in qm||qt.autoFetchSvg,n=HS(lse,function(a,i){var o=i[0],c=i[1],u=i[2];return c==="far"&&!r&&(c="fas"),typeof o=="string"&&(a.names[o]={prefix:c,iconName:u}),typeof o=="number"&&(a.unicodes[o.toString(16)]={prefix:c,iconName:u}),a},{names:{},unicodes:{}});r5=n.names,n5=n.unicodes,CP=a0(qt.styleDefault,{family:qt.familyDefault})};ese(function(t){CP=a0(t.styleDefault,{family:qt.familyDefault})});i5();function xP(t,e){return(e5[t]||{})[e]}function pse(t,e){return(t5[t]||{})[e]}function Wu(t,e){return(a5[t]||{})[e]}function s5(t){return r5[t]||{prefix:null,iconName:null}}function hse(t){var e=n5[t],r=xP("fas",t);return e||(r?{prefix:"fas",iconName:r}:null)||{prefix:null,iconName:null}}function Zl(){return CP}var o5=function(){return{prefix:null,iconName:null,rest:[]}};function mse(t){var e=xa,r=ZF.reduce(function(n,a){return n[a]="".concat(qt.cssPrefix,"-").concat(a),n},{});return LF.forEach(function(n){(t.includes(r[n])||t.some(function(a){return use[n].includes(a)}))&&(e=n)}),e}function a0(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.family,n=r===void 0?xa:r,a=Hie[n][t];if(n===Bg&&!t)return"fad";var i=fI[n][t]||fI[n][a],o=t in Hs.styles?t:null,c=i||o||null;return c}function gse(t){var e=[],r=null;return t.forEach(function(n){var a=fse(qt.cssPrefix,n);a?r=a:n&&e.push(n)}),{iconName:r,rest:e}}function yI(t){return t.sort().filter(function(e,r,n){return n.indexOf(e)===r})}var vI=UF.concat(BF);function i0(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.skipLookups,n=r===void 0?!1:r,a=null,i=yI(t.filter(function(_){return vI.includes(_)})),o=yI(t.filter(function(_){return!vI.includes(_)})),c=i.filter(function(_){return a=_,!SF.includes(_)}),u=r0(c,1),d=u[0],f=d===void 0?null:d,h=mse(i),m=ut(ut({},gse(o)),{},{prefix:a0(f,{family:h})});return ut(ut(ut({},m),bse({values:t,family:h,styles:qm,config:qt,canonical:m,givenPrefix:a})),yse(n,a,m))}function yse(t,e,r){var n=r.prefix,a=r.iconName;if(t||!n||!a)return{prefix:n,iconName:a};var i=e==="fa"?s5(a):{},o=Wu(n,a);return a=i.iconName||o||a,n=i.prefix||n,n==="far"&&!qm.far&&qm.fas&&!qt.autoFetchSvg&&(n="fas"),{prefix:n,iconName:a}}var vse=LF.filter(function(t){return t!==xa||t!==Bg}),_se=Object.keys(BT).filter(function(t){return t!==xa}).map(function(t){return Object.keys(BT[t])}).flat();function bse(t){var e=t.values,r=t.family,n=t.canonical,a=t.givenPrefix,i=a===void 0?"":a,o=t.styles,c=o===void 0?{}:o,u=t.config,d=u===void 0?{}:u,f=r===Bg,h=e.includes("fa-duotone")||e.includes("fad"),m=d.familyDefault==="duotone",_=n.prefix==="fad"||n.prefix==="fa-duotone";if(!f&&(h||m||_)&&(n.prefix="fad"),(e.includes("fa-brands")||e.includes("fab"))&&(n.prefix="fab"),!n.prefix&&vse.includes(r)){var w=Object.keys(c).find(function(E){return _se.includes(E)});if(w||d.autoFetchSvg){var b=$ae.get(r).defaultShortPrefixId;n.prefix=b,n.iconName=Wu(n.prefix,n.iconName)||n.iconName}}return(n.prefix==="fa"||i==="fa")&&(n.prefix=Zl()||"fas"),n}var kse=(function(){function t(){hae(this,t),this.definitions={}}return gae(t,[{key:"add",value:function(){for(var r=this,n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];var o=a.reduce(this._pullDefinitions,{});Object.keys(o).forEach(function(c){r.definitions[c]=ut(ut({},r.definitions[c]||{}),o[c]),VT(c,o[c]);var u=SP[xa][c];u&&VT(u,o[c]),i5()})}},{key:"reset",value:function(){this.definitions={}}},{key:"_pullDefinitions",value:function(r,n){var a=n.prefix&&n.iconName&&n.icon?{0:n}:n;return Object.keys(a).map(function(i){var o=a[i],c=o.prefix,u=o.iconName,d=o.icon,f=d[2];r[c]||(r[c]={}),f.length>0&&f.forEach(function(h){typeof h=="string"&&(r[c][h]=d)}),r[c][u]=d}),r}}])})(),_I=[],Sf={},Bf={},wse=Object.keys(Bf);function Sse(t,e){var r=e.mixoutsTo;return _I=t,Sf={},Object.keys(Bf).forEach(function(n){wse.indexOf(n)===-1&&delete Bf[n]}),_I.forEach(function(n){var a=n.mixout?n.mixout():{};if(Object.keys(a).forEach(function(o){typeof a[o]=="function"&&(r[o]=a[o]),Q_(a[o])==="object"&&Object.keys(a[o]).forEach(function(c){r[o]||(r[o]={}),r[o][c]=a[o][c]})}),n.hooks){var i=n.hooks();Object.keys(i).forEach(function(o){Sf[o]||(Sf[o]=[]),Sf[o].push(i[o])})}n.provides&&n.provides(Bf)}),r}function HT(t,e){for(var r=arguments.length,n=new Array(r>2?r-2:0),a=2;a<r;a++)n[a-2]=arguments[a];var i=Sf[t]||[];return i.forEach(function(o){e=o.apply(null,[e].concat(n))}),e}function ud(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var a=Sf[t]||[];a.forEach(function(i){i.apply(null,r)})}function eu(){var t=arguments[0],e=Array.prototype.slice.call(arguments,1);return Bf[t]?Bf[t].apply(null,e):void 0}function GT(t){t.prefix==="fa"&&(t.prefix="fas");var e=t.iconName,r=t.prefix||Zl();if(e)return e=Wu(r,e)||e,mI(c5.definitions,r,e)||mI(Hs.styles,r,e)}var c5=new kse,Ese=function(){qt.autoReplaceSvg=!1,qt.observeMutations=!1,ud("noAuto")},Tse={i2svg:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Wc?(ud("beforeI2svg",e),eu("pseudoElements2svg",e),eu("i2svg",e)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.autoReplaceSvgRoot;qt.autoReplaceSvg===!1&&(qt.autoReplaceSvg=!0),qt.observeMutations=!0,cse(function(){xse({autoReplaceSvgRoot:r}),ud("watch",e)})}},Cse={icon:function(e){if(e===null)return null;if(Q_(e)==="object"&&e.prefix&&e.iconName)return{prefix:e.prefix,iconName:Wu(e.prefix,e.iconName)||e.iconName};if(Array.isArray(e)&&e.length===2){var r=e[1].indexOf("fa-")===0?e[1].slice(3):e[1],n=a0(e[0]);return{prefix:n,iconName:Wu(n,r)||r}}if(typeof e=="string"&&(e.indexOf("".concat(qt.cssPrefix,"-"))>-1||e.match(Gie))){var a=i0(e.split(" "),{skipLookups:!0});return{prefix:a.prefix||Zl(),iconName:Wu(a.prefix,a.iconName)||a.iconName}}if(typeof e=="string"){var i=Zl();return{prefix:i,iconName:Wu(i,e)||e}}}},Fi={noAuto:Ese,config:qt,dom:Tse,parse:Cse,library:c5,findIconDefinition:GT,toHtml:Fg},xse=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=e.autoReplaceSvgRoot,n=r===void 0?vn:r;(Object.keys(Hs.styles).length>0||qt.autoFetchSvg)&&Wc&&qt.autoReplaceSvg&&Fi.dom.i2svg({node:n})};function s0(t,e){return Object.defineProperty(t,"abstract",{get:e}),Object.defineProperty(t,"html",{get:function(){return t.abstract.map(function(n){return Fg(n)})}}),Object.defineProperty(t,"node",{get:function(){if(Wc){var n=vn.createElement("div");return n.innerHTML=t.html,n.children}}}),t}function Pse(t){var e=t.children,r=t.main,n=t.mask,a=t.attributes,i=t.styles,o=t.transform;if(TP(o)&&r.found&&!n.found){var c=r.width,u=r.height,d={x:c/u/2,y:.5};a.style=n0(ut(ut({},i),{},{"transform-origin":"".concat(d.x+o.x/16,"em ").concat(d.y+o.y/16,"em")}))}return[{tag:"svg",attributes:a,children:e}]}function Ase(t){var e=t.prefix,r=t.iconName,n=t.children,a=t.attributes,i=t.symbol,o=i===!0?"".concat(e,"-").concat(qt.cssPrefix,"-").concat(r):i;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:ut(ut({},a),{},{id:o}),children:n}]}]}function Rse(t){var e=["aria-label","aria-labelledby","title","role"];return e.some(function(r){return r in t})}function PP(t){var e=t.icons,r=e.main,n=e.mask,a=t.prefix,i=t.iconName,o=t.transform,c=t.symbol,u=t.maskId,d=t.extra,f=t.watchable,h=f===void 0?!1:f,m=n.found?n:r,_=m.width,w=m.height,b=[qt.replacementClass,i?"".concat(qt.cssPrefix,"-").concat(i):""].filter(function(C){return d.classes.indexOf(C)===-1}).filter(function(C){return C!==""||!!C}).concat(d.classes).join(" "),E={children:[],attributes:ut(ut({},d.attributes),{},{"data-prefix":a,"data-icon":i,class:b,role:d.attributes.role||"img",viewBox:"0 0 ".concat(_," ").concat(w)})};!Rse(d.attributes)&&!d.attributes["aria-hidden"]&&(E.attributes["aria-hidden"]="true"),h&&(E.attributes[ld]="");var T=ut(ut({},E),{},{prefix:a,iconName:i,main:r,mask:n,maskId:u,transform:o,symbol:c,styles:ut({},d.styles)}),R=n.found&&r.found?eu("generateAbstractMask",T)||{children:[],attributes:{}}:eu("generateAbstractIcon",T)||{children:[],attributes:{}},P=R.children,A=R.attributes;return T.children=P,T.attributes=A,c?Ase(T):Pse(T)}function bI(t){var e=t.content,r=t.width,n=t.height,a=t.transform,i=t.extra,o=t.watchable,c=o===void 0?!1:o,u=ut(ut({},i.attributes),{},{class:i.classes.join(" ")});c&&(u[ld]="");var d=ut({},i.styles);TP(a)&&(d.transform=ise({transform:a,width:r,height:n}),d["-webkit-transform"]=d.transform);var f=n0(d);f.length>0&&(u.style=f);var h=[];return h.push({tag:"span",attributes:u,children:[e]}),h}function Dse(t){var e=t.content,r=t.extra,n=ut(ut({},r.attributes),{},{class:r.classes.join(" ")}),a=n0(r.styles);a.length>0&&(n.style=a);var i=[];return i.push({tag:"span",attributes:n,children:[e]}),i}var GS=Hs.styles;function WT(t){var e=t[0],r=t[1],n=t.slice(4),a=r0(n,1),i=a[0],o=null;return Array.isArray(i)?o={tag:"g",attributes:{class:"".concat(qt.cssPrefix,"-").concat($S.GROUP)},children:[{tag:"path",attributes:{class:"".concat(qt.cssPrefix,"-").concat($S.SECONDARY),fill:"currentColor",d:i[0]}},{tag:"path",attributes:{class:"".concat(qt.cssPrefix,"-").concat($S.PRIMARY),fill:"currentColor",d:i[1]}}]}:o={tag:"path",attributes:{fill:"currentColor",d:i}},{found:!0,width:e,height:r,icon:o}}var Ose={found:!1,width:512,height:512};function Nse(t,e){!VF&&qt.showMissingIcons}function KT(t,e){var r=e;return e==="fa"&&qt.styleDefault!==null&&(e=Zl()),new Promise(function(n,a){if(r==="fa"){var i=s5(t)||{};t=i.iconName||t,e=i.prefix||e}if(t&&e&&GS[e]&&GS[e][t]){var o=GS[e][t];return n(WT(o))}Nse(t,e),n(ut(ut({},Ose),{},{icon:qt.showMissingIcons&&t?eu("missingIconAbstract")||{}:{}}))})}var kI=function(){},YT=qt.measurePerformance&&gv&&gv.mark&&gv.measure?gv:{mark:kI,measure:kI},Yh='FA "7.0.1"',Ise=function(e){return YT.mark("".concat(Yh," ").concat(e," begins")),function(){return l5(e)}},l5=function(e){YT.mark("".concat(Yh," ").concat(e," ends")),YT.measure("".concat(Yh," ").concat(e),"".concat(Yh," ").concat(e," begins"),"".concat(Yh," ").concat(e," ends"))},AP={begin:Ise,end:l5},t_=function(){};function wI(t){var e=t.getAttribute?t.getAttribute(ld):null;return typeof e=="string"}function Mse(t){var e=t.getAttribute?t.getAttribute(kP):null,r=t.getAttribute?t.getAttribute(wP):null;return e&&r}function jse(t){return t&&t.classList&&t.classList.contains&&t.classList.contains(qt.replacementClass)}function Lse(){if(qt.autoReplaceSvg===!0)return r_.replace;var t=r_[qt.autoReplaceSvg];return t||r_.replace}function Bse(t){return vn.createElementNS("http://www.w3.org/2000/svg",t)}function Use(t){return vn.createElement(t)}function u5(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=e.ceFn,n=r===void 0?t.tag==="svg"?Bse:Use:r;if(typeof t=="string")return vn.createTextNode(t);var a=n(t.tag);Object.keys(t.attributes||[]).forEach(function(o){a.setAttribute(o,t.attributes[o])});var i=t.children||[];return i.forEach(function(o){a.appendChild(u5(o,{ceFn:n}))}),a}function Fse(t){var e=" ".concat(t.outerHTML," ");return e="".concat(e,"Font Awesome fontawesome.com "),e}var r_={replace:function(e){var r=e[0];if(r.parentNode)if(e[1].forEach(function(a){r.parentNode.insertBefore(u5(a),r)}),r.getAttribute(ld)===null&&qt.keepOriginalSource){var n=vn.createComment(Fse(r));r.parentNode.replaceChild(n,r)}else r.remove()},nest:function(e){var r=e[0],n=e[1];if(~EP(r).indexOf(qt.replacementClass))return r_.replace(e);var a=new RegExp("".concat(qt.cssPrefix,"-.*"));if(delete n[0].attributes.id,n[0].attributes.class){var i=n[0].attributes.class.split(" ").reduce(function(c,u){return u===qt.replacementClass||u.match(a)?c.toSvg.push(u):c.toNode.push(u),c},{toNode:[],toSvg:[]});n[0].attributes.class=i.toSvg.join(" "),i.toNode.length===0?r.removeAttribute("class"):r.setAttribute("class",i.toNode.join(" "))}var o=n.map(function(c){return Fg(c)}).join(`
`);r.setAttribute(ld,""),r.innerHTML=o}};function SI(t){t()}function d5(t,e){var r=typeof e=="function"?e:t_;if(t.length===0)r();else{var n=SI;qt.mutateApproach===$ie&&(n=Ql.requestAnimationFrame||SI),n(function(){var a=Lse(),i=AP.begin("mutate");t.map(a),i(),r()})}}var RP=!1;function f5(){RP=!0}function XT(){RP=!1}var eb=null;function EI(t){if(cI&&qt.observeMutations){var e=t.treeCallback,r=e===void 0?t_:e,n=t.nodeCallback,a=n===void 0?t_:n,i=t.pseudoElementsCallback,o=i===void 0?t_:i,c=t.observeMutationsRoot,u=c===void 0?vn:c;eb=new cI(function(d){if(!RP){var f=Zl();Rp(d).forEach(function(h){if(h.type==="childList"&&h.addedNodes.length>0&&!wI(h.addedNodes[0])&&(qt.searchPseudoElements&&o(h.target),r(h.target)),h.type==="attributes"&&h.target.parentNode&&qt.searchPseudoElements&&o([h.target],!0),h.type==="attributes"&&wI(h.target)&&~Yie.indexOf(h.attributeName))if(h.attributeName==="class"&&Mse(h.target)){var m=i0(EP(h.target)),_=m.prefix,w=m.iconName;h.target.setAttribute(kP,_||f),w&&h.target.setAttribute(wP,w)}else jse(h.target)&&a(h.target)})}}),Wc&&eb.observe(u,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}}function qse(){eb&&eb.disconnect()}function zse(t){var e=t.getAttribute("style"),r=[];return e&&(r=e.split(";").reduce(function(n,a){var i=a.split(":"),o=i[0],c=i.slice(1);return o&&c.length>0&&(n[o]=c.join(":").trim()),n},{})),r}function $se(t){var e=t.getAttribute("data-prefix"),r=t.getAttribute("data-icon"),n=t.innerText!==void 0?t.innerText.trim():"",a=i0(EP(t));return a.prefix||(a.prefix=Zl()),e&&r&&(a.prefix=e,a.iconName=r),a.iconName&&a.prefix||(a.prefix&&n.length>0&&(a.iconName=pse(a.prefix,t.innerText)||xP(a.prefix,QF(t.innerText))),!a.iconName&&qt.autoFetchSvg&&t.firstChild&&t.firstChild.nodeType===Node.TEXT_NODE&&(a.iconName=t.firstChild.data)),a}function Vse(t){var e=Rp(t.attributes).reduce(function(r,n){return r.name!=="class"&&r.name!=="style"&&(r[n.name]=n.value),r},{});return e}function Hse(){return{iconName:null,prefix:null,transform:jo,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function TI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0},r=$se(t),n=r.iconName,a=r.prefix,i=r.rest,o=Vse(t),c=HT("parseNodeAttributes",{},t),u=e.styleParser?zse(t):[];return ut({iconName:n,prefix:a,transform:jo,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:i,styles:u,attributes:o}},c)}var Gse=Hs.styles;function p5(t){var e=qt.autoReplaceSvg==="nest"?TI(t,{styleParser:!1}):TI(t);return~e.extra.classes.indexOf(GF)?eu("generateLayersText",t,e):eu("generateSvgReplacementMutation",t,e)}function Wse(){return[].concat(Qs(BF),Qs(UF))}function CI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!Wc)return Promise.resolve();var r=vn.documentElement.classList,n=function(h){return r.add("".concat(dI,"-").concat(h))},a=function(h){return r.remove("".concat(dI,"-").concat(h))},i=qt.autoFetchSvg?Wse():SF.concat(Object.keys(Gse));i.includes("fa")||i.push("fa");var o=[".".concat(GF,":not([").concat(ld,"])")].concat(i.map(function(f){return".".concat(f,":not([").concat(ld,"])")})).join(", ");if(o.length===0)return Promise.resolve();var c=[];try{c=Rp(t.querySelectorAll(o))}catch{}if(c.length>0)n("pending"),a("complete");else return Promise.resolve();var u=AP.begin("onTree"),d=c.reduce(function(f,h){try{var m=p5(h);m&&f.push(m)}catch(_){VF||_.name}return f},[]);return new Promise(function(f,h){Promise.all(d).then(function(m){d5(m,function(){n("active"),n("complete"),a("pending"),typeof e=="function"&&e(),u(),f()})}).catch(function(m){u(),h(m)})})}function Kse(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;p5(t).then(function(r){r&&d5([r],e)})}function Yse(t){return function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(e||{}).icon?e:GT(e||{}),a=r.mask;return a&&(a=(a||{}).icon?a:GT(a||{})),t(n,ut(ut({},r),{},{mask:a}))}}var Xse=function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.transform,a=n===void 0?jo:n,i=r.symbol,o=i===void 0?!1:i,c=r.mask,u=c===void 0?null:c,d=r.maskId,f=d===void 0?null:d,h=r.classes,m=h===void 0?[]:h,_=r.attributes,w=_===void 0?{}:_,b=r.styles,E=b===void 0?{}:b;if(e){var T=e.prefix,R=e.iconName,P=e.icon;return s0(ut({type:"icon"},e),function(){return ud("beforeDOMElementCreation",{iconDefinition:e,params:r}),PP({icons:{main:WT(P),mask:u?WT(u.icon):{found:!1,width:null,height:null,icon:{}}},prefix:T,iconName:R,transform:ut(ut({},jo),a),symbol:o,maskId:f,extra:{attributes:w,styles:E,classes:m}})})}},Jse={mixout:function(){return{icon:Yse(Xse)}},hooks:function(){return{mutationObserverCallbacks:function(r){return r.treeCallback=CI,r.nodeCallback=Kse,r}}},provides:function(e){e.i2svg=function(r){var n=r.node,a=n===void 0?vn:n,i=r.callback,o=i===void 0?function(){}:i;return CI(a,o)},e.generateSvgReplacementMutation=function(r,n){var a=n.iconName,i=n.prefix,o=n.transform,c=n.symbol,u=n.mask,d=n.maskId,f=n.extra;return new Promise(function(h,m){Promise.all([KT(a,i),u.iconName?KT(u.iconName,u.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(function(_){var w=r0(_,2),b=w[0],E=w[1];h([r,PP({icons:{main:b,mask:E},prefix:i,iconName:a,transform:o,symbol:c,maskId:d,extra:f,watchable:!0})])}).catch(m)})},e.generateAbstractIcon=function(r){var n=r.children,a=r.attributes,i=r.main,o=r.transform,c=r.styles,u=n0(c);u.length>0&&(a.style=u);var d;return TP(o)&&(d=eu("generateAbstractTransformGrouping",{main:i,transform:o,containerWidth:i.width,iconWidth:i.width})),n.push(d||i.icon),{children:n,attributes:a}}}},Qse={mixout:function(){return{layer:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.classes,i=a===void 0?[]:a;return s0({type:"layer"},function(){ud("beforeDOMElementCreation",{assembler:r,params:n});var o=[];return r(function(c){Array.isArray(c)?c.map(function(u){o=o.concat(u.abstract)}):o=o.concat(c.abstract)}),[{tag:"span",attributes:{class:["".concat(qt.cssPrefix,"-layers")].concat(Qs(i)).join(" ")},children:o}]})}}}},Zse={mixout:function(){return{counter:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};n.title;var a=n.classes,i=a===void 0?[]:a,o=n.attributes,c=o===void 0?{}:o,u=n.styles,d=u===void 0?{}:u;return s0({type:"counter",content:r},function(){return ud("beforeDOMElementCreation",{content:r,params:n}),Dse({content:r.toString(),extra:{attributes:c,styles:d,classes:["".concat(qt.cssPrefix,"-layers-counter")].concat(Qs(i))}})})}}}},eoe={mixout:function(){return{text:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=n.transform,i=a===void 0?jo:a,o=n.classes,c=o===void 0?[]:o,u=n.attributes,d=u===void 0?{}:u,f=n.styles,h=f===void 0?{}:f;return s0({type:"text",content:r},function(){return ud("beforeDOMElementCreation",{content:r,params:n}),bI({content:r,transform:ut(ut({},jo),i),extra:{attributes:d,styles:h,classes:["".concat(qt.cssPrefix,"-layers-text")].concat(Qs(c))}})})}}},provides:function(e){e.generateLayersText=function(r,n){var a=n.transform,i=n.extra,o=null,c=null;if(kF){var u=parseInt(getComputedStyle(r).fontSize,10),d=r.getBoundingClientRect();o=d.width/u,c=d.height/u}return Promise.resolve([r,bI({content:r.innerHTML,width:o,height:c,transform:a,extra:i,watchable:!0})])}}},h5=new RegExp('"',"ug"),xI=[1105920,1112319],PI=ut(ut(ut(ut({},{FontAwesome:{normal:"fas",400:"fas"}}),zae),qie),Jae),JT=Object.keys(PI).reduce(function(t,e){return t[e.toLowerCase()]=PI[e],t},{}),toe=Object.keys(JT).reduce(function(t,e){var r=JT[e];return t[e]=r[900]||Qs(Object.entries(r))[0][1],t},{});function roe(t){var e=t.replace(h5,"");return QF(Qs(e)[0]||"")}function noe(t){var e=t.getPropertyValue("font-feature-settings").includes("ss01"),r=t.getPropertyValue("content"),n=r.replace(h5,""),a=n.codePointAt(0),i=a>=xI[0]&&a<=xI[1],o=n.length===2?n[0]===n[1]:!1;return i||o||e}function aoe(t,e){var r=t.replace(/^['"]|['"]$/g,"").toLowerCase(),n=parseInt(e),a=isNaN(n)?"normal":n;return(JT[r]||{})[a]||toe[r]}function AI(t,e){var r="".concat(zie).concat(e.replace(":","-"));return new Promise(function(n,a){if(t.getAttribute(r)!==null)return n();var i=Rp(t.children),o=i.filter(function(O){return O.getAttribute(FT)===e})[0],c=Ql.getComputedStyle(t,e),u=c.getPropertyValue("font-family"),d=u.match(Wie),f=c.getPropertyValue("font-weight"),h=c.getPropertyValue("content");if(o&&!d)return t.removeChild(o),n();if(d&&h!=="none"&&h!==""){var m=c.getPropertyValue("content"),_=aoe(u,f),w=roe(m),b=d[0].startsWith("FontAwesome"),E=noe(c),T=xP(_,w),R=T;if(b){var P=hse(w);P.iconName&&P.prefix&&(T=P.iconName,_=P.prefix)}if(T&&!E&&(!o||o.getAttribute(kP)!==_||o.getAttribute(wP)!==R)){t.setAttribute(r,R),o&&t.removeChild(o);var A=Hse(),C=A.extra;C.attributes[FT]=e,KT(T,_).then(function(O){var I=PP(ut(ut({},A),{},{icons:{main:O,mask:o5()},prefix:_,iconName:R,extra:C,watchable:!0})),x=vn.createElementNS("http://www.w3.org/2000/svg","svg");e==="::before"?t.insertBefore(x,t.firstChild):t.appendChild(x),x.outerHTML=I.map(function(D){return Fg(D)}).join(`
`),t.removeAttribute(r),n()}).catch(a)}else n()}else n()})}function ioe(t){return Promise.all([AI(t,"::before"),AI(t,"::after")])}function soe(t){return t.parentNode!==document.head&&!~Vie.indexOf(t.tagName.toUpperCase())&&!t.getAttribute(FT)&&(!t.parentNode||t.parentNode.tagName!=="svg")}var ooe=function(e){return!!e&&$F.some(function(r){return e.includes(r)})},coe=function(e){if(!e)return[];var r=new Set,n=e.split(/,(?![^()]*\))/).map(function(u){return u.trim()});n=n.flatMap(function(u){return u.includes("(")?u:u.split(",").map(function(d){return d.trim()})});var a=e_(n),i;try{for(a.s();!(i=a.n()).done;){var o=i.value;if(ooe(o)){var c=$F.reduce(function(u,d){return u.replace(d,"")},o);c!==""&&c!=="*"&&r.add(c)}}}catch(u){a.e(u)}finally{a.f()}return r};function RI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(Wc){var r;if(e)r=t;else if(qt.searchPseudoElementsFullScan)r=t.querySelectorAll("*");else{var n=new Set,a=e_(document.styleSheets),i;try{for(a.s();!(i=a.n()).done;){var o=i.value;try{var c=e_(o.cssRules),u;try{for(c.s();!(u=c.n()).done;){var d=u.value,f=coe(d.selectorText),h=e_(f),m;try{for(h.s();!(m=h.n()).done;){var _=m.value;n.add(_)}}catch(b){h.e(b)}finally{h.f()}}}catch(b){c.e(b)}finally{c.f()}}catch{qt.searchPseudoElementsWarnings}}}catch(b){a.e(b)}finally{a.f()}if(!n.size)return;var w=Array.from(n).join(", ");try{r=t.querySelectorAll(w)}catch{}}return new Promise(function(b,E){var T=Rp(r).filter(soe).map(ioe),R=AP.begin("searchPseudoElements");f5(),Promise.all(T).then(function(){R(),XT(),b()}).catch(function(){R(),XT(),E()})})}}var loe={hooks:function(){return{mutationObserverCallbacks:function(r){return r.pseudoElementsCallback=RI,r}}},provides:function(e){e.pseudoElements2svg=function(r){var n=r.node,a=n===void 0?vn:n;qt.searchPseudoElements&&RI(a)}}},DI=!1,uoe={mixout:function(){return{dom:{unwatch:function(){f5(),DI=!0}}}},hooks:function(){return{bootstrap:function(){EI(HT("mutationObserverCallbacks",{}))},noAuto:function(){qse()},watch:function(r){var n=r.observeMutationsRoot;DI?XT():EI(HT("mutationObserverCallbacks",{observeMutationsRoot:n}))}}}},OI=function(e){var r={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return e.toLowerCase().split(" ").reduce(function(n,a){var i=a.toLowerCase().split("-"),o=i[0],c=i.slice(1).join("-");if(o&&c==="h")return n.flipX=!0,n;if(o&&c==="v")return n.flipY=!0,n;if(c=parseFloat(c),isNaN(c))return n;switch(o){case"grow":n.size=n.size+c;break;case"shrink":n.size=n.size-c;break;case"left":n.x=n.x-c;break;case"right":n.x=n.x+c;break;case"up":n.y=n.y-c;break;case"down":n.y=n.y+c;break;case"rotate":n.rotate=n.rotate+c;break}return n},r)},doe={mixout:function(){return{parse:{transform:function(r){return OI(r)}}}},hooks:function(){return{parseNodeAttributes:function(r,n){var a=n.getAttribute("data-fa-transform");return a&&(r.transform=OI(a)),r}}},provides:function(e){e.generateAbstractTransformGrouping=function(r){var n=r.main,a=r.transform,i=r.containerWidth,o=r.iconWidth,c={transform:"translate(".concat(i/2," 256)")},u="translate(".concat(a.x*32,", ").concat(a.y*32,") "),d="scale(".concat(a.size/16*(a.flipX?-1:1),", ").concat(a.size/16*(a.flipY?-1:1),") "),f="rotate(".concat(a.rotate," 0 0)"),h={transform:"".concat(u," ").concat(d," ").concat(f)},m={transform:"translate(".concat(o/2*-1," -256)")},_={outer:c,inner:h,path:m};return{tag:"g",attributes:ut({},_.outer),children:[{tag:"g",attributes:ut({},_.inner),children:[{tag:n.icon.tag,children:n.icon.children,attributes:ut(ut({},n.icon.attributes),_.path)}]}]}}}},WS={x:0,y:0,width:"100%",height:"100%"};function NI(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return t.attributes&&(t.attributes.fill||e)&&(t.attributes.fill="black"),t}function foe(t){return t.tag==="g"?t.children:[t]}var poe={hooks:function(){return{parseNodeAttributes:function(r,n){var a=n.getAttribute("data-fa-mask"),i=a?i0(a.split(" ").map(function(o){return o.trim()})):o5();return i.prefix||(i.prefix=Zl()),r.mask=i,r.maskId=n.getAttribute("data-fa-mask-id"),r}}},provides:function(e){e.generateAbstractMask=function(r){var n=r.children,a=r.attributes,i=r.main,o=r.mask,c=r.maskId,u=r.transform,d=i.width,f=i.icon,h=o.width,m=o.icon,_=ase({transform:u,containerWidth:h,iconWidth:d}),w={tag:"rect",attributes:ut(ut({},WS),{},{fill:"white"})},b=f.children?{children:f.children.map(NI)}:{},E={tag:"g",attributes:ut({},_.inner),children:[NI(ut({tag:f.tag,attributes:ut(ut({},f.attributes),_.path)},b))]},T={tag:"g",attributes:ut({},_.outer),children:[E]},R="mask-".concat(c||pI()),P="clip-".concat(c||pI()),A={tag:"mask",attributes:ut(ut({},WS),{},{id:R,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[w,T]},C={tag:"defs",children:[{tag:"clipPath",attributes:{id:P},children:foe(m)},A]};return n.push(C,{tag:"rect",attributes:ut({fill:"currentColor","clip-path":"url(#".concat(P,")"),mask:"url(#".concat(R,")")},WS)}),{children:n,attributes:a}}}},hoe={provides:function(e){var r=!1;Ql.matchMedia&&(r=Ql.matchMedia("(prefers-reduced-motion: reduce)").matches),e.missingIconAbstract=function(){var n=[],a={fill:"currentColor"},i={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};n.push({tag:"path",attributes:ut(ut({},a),{},{d:"M156.5,447.7l-12.6,29.5c-18.7-9.5-35.9-21.2-51.5-34.9l22.7-22.7C127.6,430.5,141.5,440,156.5,447.7z M40.6,272H8.5 c1.4,21.2,5.4,41.7,11.7,61.1L50,321.2C45.1,305.5,41.8,289,40.6,272z M40.6,240c1.4-18.8,5.2-37,11.1-54.1l-29.5-12.6 C14.7,194.3,10,216.7,8.5,240H40.6z M64.3,156.5c7.8-14.9,17.2-28.8,28.1-41.5L69.7,92.3c-13.7,15.6-25.5,32.8-34.9,51.5 L64.3,156.5z M397,419.6c-13.9,12-29.4,22.3-46.1,30.4l11.9,29.8c20.7-9.9,39.8-22.6,56.9-37.6L397,419.6z M115,92.4 c13.9-12,29.4-22.3,46.1-30.4l-11.9-29.8c-20.7,9.9-39.8,22.6-56.8,37.6L115,92.4z M447.7,355.5c-7.8,14.9-17.2,28.8-28.1,41.5 l22.7,22.7c13.7-15.6,25.5-32.9,34.9-51.5L447.7,355.5z M471.4,272c-1.4,18.8-5.2,37-11.1,54.1l29.5,12.6 c7.5-21.1,12.2-43.5,13.6-66.8H471.4z M321.2,462c-15.7,5-32.2,8.2-49.2,9.4v32.1c21.2-1.4,41.7-5.4,61.1-11.7L321.2,462z M240,471.4c-18.8-1.4-37-5.2-54.1-11.1l-12.6,29.5c21.1,7.5,43.5,12.2,66.8,13.6V471.4z M462,190.8c5,15.7,8.2,32.2,9.4,49.2h32.1 c-1.4-21.2-5.4-41.7-11.7-61.1L462,190.8z M92.4,397c-12-13.9-22.3-29.4-30.4-46.1l-29.8,11.9c9.9,20.7,22.6,39.8,37.6,56.9 L92.4,397z M272,40.6c18.8,1.4,36.9,5.2,54.1,11.1l12.6-29.5C317.7,14.7,295.3,10,272,8.5V40.6z M190.8,50 c15.7-5,32.2-8.2,49.2-9.4V8.5c-21.2,1.4-41.7,5.4-61.1,11.7L190.8,50z M442.3,92.3L419.6,115c12,13.9,22.3,29.4,30.5,46.1 l29.8-11.9C470,128.5,457.3,109.4,442.3,92.3z M397,92.4l22.7-22.7c-15.6-13.7-32.8-25.5-51.5-34.9l-12.6,29.5 C370.4,72.1,384.4,81.5,397,92.4z"})});var o=ut(ut({},i),{},{attributeName:"opacity"}),c={tag:"circle",attributes:ut(ut({},a),{},{cx:"256",cy:"364",r:"28"}),children:[]};return r||c.children.push({tag:"animate",attributes:ut(ut({},i),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:ut(ut({},o),{},{values:"1;0;1;1;0;1;"})}),n.push(c),n.push({tag:"path",attributes:ut(ut({},a),{},{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:r?[]:[{tag:"animate",attributes:ut(ut({},o),{},{values:"1;0;0;0;0;1;"})}]}),r||n.push({tag:"path",attributes:ut(ut({},a),{},{opacity:"0",d:"M232.5,134.5l7,168c0.3,6.4,5.6,11.5,12,11.5h9c6.4,0,11.7-5.1,12-11.5l7-168c0.3-6.8-5.2-12.5-12-12.5h-23 C237.7,122,232.2,127.7,232.5,134.5z"}),children:[{tag:"animate",attributes:ut(ut({},o),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:n}}}},moe={hooks:function(){return{parseNodeAttributes:function(r,n){var a=n.getAttribute("data-fa-symbol"),i=a===null?!1:a===""?!0:a;return r.symbol=i,r}}}},goe=[ose,Jse,Qse,Zse,eoe,loe,uoe,doe,poe,hoe,moe];Sse(goe,{mixoutsTo:Fi});Fi.noAuto;Fi.config;Fi.library;Fi.dom;var QT=Fi.parse;Fi.findIconDefinition;Fi.toHtml;var yoe=Fi.icon;Fi.layer;Fi.text;Fi.counter;var KS={exports:{}},YS,II;function voe(){if(II)return YS;II=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return YS=t,YS}var XS,MI;function _oe(){if(MI)return XS;MI=1;var t=voe();function e(){}function r(){}return r.resetWarningCache=e,XS=function(){function n(o,c,u,d,f,h){if(h!==t){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}n.isRequired=n;function a(){return n}var i={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:a,element:n,elementType:n,instanceOf:a,node:n,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:e};return i.PropTypes=i,i},XS}var jI;function boe(){return jI||(jI=1,KS.exports=_oe()()),KS.exports}var koe=boe();const pr=wg(koe);var woe={};function ZT(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Soe(t){if(Array.isArray(t))return t}function Eoe(t){if(Array.isArray(t))return ZT(t)}function Al(t,e,r){return(e=Ooe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Toe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Coe(t,e){var r=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r!=null){var n,a,i,o,c=[],u=!0,d=!1;try{if(i=(r=r.call(t)).next,e!==0)for(;!(u=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);u=!0);}catch(f){d=!0,a=f}finally{try{if(!u&&r.return!=null&&(o=r.return(),Object(o)!==o))return}finally{if(d)throw a}}return c}}function xoe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Poe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function LI(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),r.push.apply(r,n)}return r}function Oo(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?LI(Object(r),!0).forEach(function(n){Al(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):LI(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Aoe(t,e){if(t==null)return{};var r,n,a=Roe(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],e.indexOf(r)===-1&&{}.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}function Roe(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.indexOf(n)!==-1)continue;r[n]=t[n]}return r}function BI(t,e){return Soe(t)||Coe(t,e)||m5(t,e)||xoe()}function eC(t){return Eoe(t)||Toe(t)||m5(t)||Poe()}function Doe(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ooe(t){var e=Doe(t,"string");return typeof e=="symbol"?e:e+""}function tb(t){"@babel/helpers - typeof";return tb=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tb(t)}function m5(t,e){if(t){if(typeof t=="string")return ZT(t,e);var r={}.toString.call(t).slice(8,-1);return r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set"?Array.from(t):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ZT(t,e):void 0}}var Noe="7.0.0",tC;try{var Ioe=require("@fortawesome/fontawesome-svg-core/package.json");tC=Ioe.version}catch{tC=typeof process<"u"&&woe.FA_VERSION||"7.0.0"}function Moe(t){var e=t.beat,r=t.fade,n=t.beatFade,a=t.bounce,i=t.shake,o=t.flash,c=t.spin,u=t.spinPulse,d=t.spinReverse,f=t.pulse,h=t.fixedWidth,m=t.inverse,_=t.border,w=t.listItem,b=t.flip,E=t.size,T=t.rotation,R=t.pull,P=t.swapOpacity,A=t.rotateBy,C=t.widthAuto,O=joe(tC,Noe),I=Al(Al(Al(Al(Al(Al({"fa-beat":e,"fa-fade":r,"fa-beat-fade":n,"fa-bounce":a,"fa-shake":i,"fa-flash":o,"fa-spin":c,"fa-spin-reverse":d,"fa-spin-pulse":u,"fa-pulse":f,"fa-fw":h,"fa-inverse":m,"fa-border":_,"fa-li":w,"fa-flip":b===!0,"fa-flip-horizontal":b==="horizontal"||b==="both","fa-flip-vertical":b==="vertical"||b==="both"},"fa-".concat(E),typeof E<"u"&&E!==null),"fa-rotate-".concat(T),typeof T<"u"&&T!==null&&T!==0),"fa-pull-".concat(R),typeof R<"u"&&R!==null),"fa-swap-opacity",P),"fa-rotate-by",O&&A),"fa-width-auto",O&&C);return Object.keys(I).map(function(x){return I[x]?x:null}).filter(function(x){return x})}function joe(t,e){for(var r=t.split("-"),n=BI(r,2),a=n[0],i=n[1],o=e.split("-"),c=BI(o,2),u=c[0],d=c[1],f=a.split("."),h=u.split("."),m=0;m<Math.max(f.length,h.length);m++){var _=f[m]||"0",w=h[m]||"0",b=parseInt(_,10),E=parseInt(w,10);if(b!==E)return b>E}for(var T=0;T<Math.max(f.length,h.length);T++){var R=f[T]||"0",P=h[T]||"0";if(R!==P&&R.length!==P.length)return R.length<P.length}return!(i&&!d)}function Loe(t){return t=t-0,t===t}function g5(t){return Loe(t)?t:(t=t.replace(/[\-_\s]+(.)?/g,function(e,r){return r?r.toUpperCase():""}),t.substr(0,1).toLowerCase()+t.substr(1))}var Boe=["style"];function Uoe(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Foe(t){return t.split(";").map(function(e){return e.trim()}).filter(function(e){return e}).reduce(function(e,r){var n=r.indexOf(":"),a=g5(r.slice(0,n)),i=r.slice(n+1).trim();return a.startsWith("webkit")?e[Uoe(a)]=i:e[a]=i,e},{})}function y5(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof e=="string")return e;var n=(e.children||[]).map(function(u){return y5(t,u)}),a=Object.keys(e.attributes||{}).reduce(function(u,d){var f=e.attributes[d];switch(d){case"class":u.attrs.className=f,delete e.attributes.class;break;case"style":u.attrs.style=Foe(f);break;default:d.indexOf("aria-")===0||d.indexOf("data-")===0?u.attrs[d.toLowerCase()]=f:u.attrs[g5(d)]=f}return u},{attrs:{}}),i=r.style,o=i===void 0?{}:i,c=Aoe(r,Boe);return a.attrs.style=Oo(Oo({},a.attrs.style),o),t.apply(void 0,[e.tag,Oo(Oo({},a.attrs),c)].concat(eC(n)))}var v5=!1;try{v5=!0}catch{}function qoe(){if(!v5&&console&&typeof console.error=="function"){var t;(t=console).error.apply(t,arguments)}}function UI(t){if(t&&tb(t)==="object"&&t.prefix&&t.iconName&&t.icon)return t;if(QT.icon)return QT.icon(t);if(t===null)return null;if(t&&tb(t)==="object"&&t.prefix&&t.iconName)return t;if(Array.isArray(t)&&t.length===2)return{prefix:t[0],iconName:t[1]};if(typeof t=="string")return{prefix:"fas",iconName:t}}function JS(t,e){return Array.isArray(e)&&e.length>0||!Array.isArray(e)&&e?Al({},t,e):{}}var FI={border:!1,className:"",mask:null,maskId:null,fixedWidth:!1,inverse:!1,flip:!1,icon:null,listItem:!1,pull:null,pulse:!1,rotation:null,rotateBy:!1,size:null,spin:!1,spinPulse:!1,spinReverse:!1,beat:!1,fade:!1,beatFade:!1,bounce:!1,shake:!1,symbol:!1,title:"",titleId:null,transform:null,swapOpacity:!1,widthAuto:!1},Il=Tt.forwardRef(function(t,e){var r=Oo(Oo({},FI),t),n=r.icon,a=r.mask,i=r.symbol,o=r.className,c=r.title,u=r.titleId,d=r.maskId,f=UI(n),h=JS("classes",[].concat(eC(Moe(r)),eC((o||"").split(" ")))),m=JS("transform",typeof r.transform=="string"?QT.transform(r.transform):r.transform),_=JS("mask",UI(a)),w=yoe(f,Oo(Oo(Oo(Oo({},h),m),_),{},{symbol:i,title:c,titleId:u,maskId:d}));if(!w)return qoe("Could not find icon",f),null;var b=w.abstract,E={ref:e};return Object.keys(r).forEach(function(T){FI.hasOwnProperty(T)||(E[T]=r[T])}),zoe(b[0],E)});Il.displayName="FontAwesomeIcon";Il.propTypes={beat:pr.bool,border:pr.bool,beatFade:pr.bool,bounce:pr.bool,className:pr.string,fade:pr.bool,flash:pr.bool,mask:pr.oneOfType([pr.object,pr.array,pr.string]),maskId:pr.string,fixedWidth:pr.bool,inverse:pr.bool,flip:pr.oneOf([!0,!1,"horizontal","vertical","both"]),icon:pr.oneOfType([pr.object,pr.array,pr.string]),listItem:pr.bool,pull:pr.oneOf(["right","left"]),pulse:pr.bool,rotation:pr.oneOf([0,90,180,270]),rotateBy:pr.bool,shake:pr.bool,size:pr.oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:pr.bool,spinPulse:pr.bool,spinReverse:pr.bool,symbol:pr.oneOfType([pr.bool,pr.string]),title:pr.string,titleId:pr.string,transform:pr.oneOfType([pr.string,pr.object]),swapOpacity:pr.bool,widthAuto:pr.bool};var zoe=y5.bind(null,Tt.createElement);/*!
 * Font Awesome Free 7.1.0 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 * Copyright 2025 Fonticons, Inc.
 */var $oe={prefix:"fab",iconName:"google",icon:[512,512,[],"f1a0","M500 261.8C500 403.3 403.1 504 260 504 122.8 504 12 393.2 12 256S122.8 8 260 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9c-88.3-85.2-252.5-21.2-252.5 118.2 0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9l-140.8 0 0-85.3 236.1 0c2.3 12.7 3.9 24.9 3.9 41.4z"]},Voe={prefix:"fab",iconName:"apple",icon:[384,512,[],"f179","M319.1 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7-55.8 .9-115.1 44.5-115.1 133.2 0 26.2 4.8 53.3 14.4 81.2 12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zM262.5 104.5c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"]};const qI=(()=>{try{return Gr.getPlatform()}catch{return"web"}})(),QS=qI==="ios"||qI==="android",zI=$oe,$I=Voe;function Hoe({initialStatus:t="idle"}){const[e,r]=v.useState(""),[n,a]=v.useState(""),[i,o]=v.useState(t),[c,u]=v.useState(null),[d,f]=v.useState(!1),[h,m]=v.useState(!1),[_,w]=v.useState(!0),[b,E]=v.useState(!1),T=v.useCallback(()=>E(!1),[]);v.useCallback(()=>E(!0),[]);const R=v.useRef(null),P=tn(),{refreshUser:A}=$r(),C=()=>setTimeout(()=>R.current?.focus(),60);v.useCallback(()=>{w(!0),C()},[]),v.useCallback(()=>{P("/how-to-play")},[P]);const O=v.useCallback(async()=>{try{await Lv("");const D=ci();await fetch(`${D}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}try{const D=await HH();if(D.ok){try{D.token&&await Qf(D.token)}catch{}await A({force:!0}),P("/lobby",{replace:!0});return}}catch{}u("Guest mode is temporarily unavailable. Please sign in.")},[P,A]),I=async D=>{try{if(QS){u("Use the Native Sign-in buttons inside the mobile app.");return}D==="google"?f(!0):m(!0),u(null);try{await Lv("");const N=ci();await fetch(`${N}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}await VH(D)}catch(N){D==="google"?f(!1):m(!1),u(N?.message||"Web sign-in failed")}},x=async D=>{try{if(!QS){u("Open the Android/iOS app to use Native Sign-in.");return}D==="google"?f(!0):m(!0),u(null);try{await Lv("");const U=ci();await fetch(`${U}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}const N=D==="apple"?await x_.signInWithAppleNative():await x_.signInWithGoogleNative(),L=ci(),j=await fetch(`${L}/api/auth/oauth/mobile-verify`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({provider:N.provider,idToken:N.idToken,email:N.email,name:N.name})});if(!j.ok)throw new Error("Native verify failed");const q=await j.json();if(q?.ok&&q?.token){try{await Qf(q.token)}catch{}await A({force:!0}),P("/lobby",{replace:!0})}else throw new Error("No token")}catch(N){D==="google"?f(!1):m(!1),N?.message||String(N),u("Sign-in failed. Check your device account settings and try again.")}};return g.jsxs("main",{className:"landing-page",children:[g.jsx(ji,{className:"page-login"}),g.jsxs("header",{className:"lp-hero",children:[g.jsx("div",{className:"lp-hero__mask","aria-hidden":!0}),g.jsxs("div",{className:"lp-hero__content",children:[g.jsxs("div",{className:"lp-fairness-badge",children:["Provably Fair! ",g.jsx(vP,{state:"verified"})]}),g.jsx(uF,{}),g.jsxs("div",{id:"signup-form",className:["lp-signup",_||i==="sent"?"is-open":""].join(" "),children:[QS?g.jsxs("div",{className:"lp-oauth","aria-label":"Native Sign-in (use inside the mobile app)",children:[g.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--google",onClick:()=>x("google"),disabled:d||h,"aria-label":"Continue with Google (Native)",style:{position:"relative"},children:g.jsxs(g.Fragment,{children:[g.jsx(Il,{className:"lp-oauth__fa",icon:zI,"aria-hidden":!0}),g.jsx("span",{className:"lp-oauth__label",children:"Continue with Google"}),d&&g.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),g.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--apple",onClick:()=>x("apple"),disabled:d||h,"aria-label":"Continue with Apple (Native)",style:{position:"relative"},children:g.jsxs(g.Fragment,{children:[g.jsx(Il,{className:"lp-oauth__fa",icon:$I,"aria-hidden":!0}),g.jsx("span",{className:"lp-oauth__label",children:"Continue with Apple"}),h&&g.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),g.jsx("div",{className:"lp-oauth__divider","aria-hidden":!0}),g.jsx("a",{role:"button",className:"gold-link",onClick:O,"aria-label":"Continue as Guest",children:"Continue as Guest"})]}):g.jsxs("div",{className:"lp-oauth","aria-label":"Web Sign-in (use in browser)",children:[g.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--google",onClick:()=>I("google"),disabled:d||h,"aria-label":"Continue with Google (Web)",style:{position:"relative"},children:g.jsxs(g.Fragment,{children:[g.jsx(Il,{className:"lp-oauth__fa",icon:zI,"aria-hidden":!0}),g.jsx("span",{className:"lp-oauth__label",children:"Continue with Google"}),d&&g.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),g.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--apple",onClick:()=>I("apple"),disabled:d||h,"aria-label":"Continue with Apple (Web)",style:{position:"relative"},children:g.jsxs(g.Fragment,{children:[g.jsx(Il,{className:"lp-oauth__fa",icon:$I,"aria-hidden":!0}),g.jsx("span",{className:"lp-oauth__label",children:"Continue with Apple"}),h&&g.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),g.jsx("div",{className:"lp-oauth__divider","aria-hidden":!0}),g.jsx("a",{role:"button",className:"gold-link",onClick:O,"aria-label":"Continue as Guest",children:"Continue as Guest"})]}),i==="error"&&g.jsx("p",{className:"lp-error",role:"alert",children:c})]})]})]}),g.jsxs("footer",{className:"lp-footer",children:[g.jsxs("nav",{className:"lp-footer__links","aria-label":"Footer",children:[g.jsx("a",{href:"/disclaimer",className:"lp-footer__link",children:"Disclaimer (18+)"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/privacy",className:"lp-footer__link",children:"Privacy Policy"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/terms",className:"lp-footer__link",children:"Terms of Use"}),g.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),g.jsx("a",{href:"/support",className:"lp-footer__link",children:"Support"})]}),g.jsx("p",{className:"lp-footnote",role:"note",children:"For entertainment purposes only. No real-money gambling or prizes."}),g.jsxs("p",{className:"lp-copy",children:["© ",new Date().getFullYear()," Zentara One LLC. All rights reserved."]})]}),g.jsx(fF,{open:b,onClose:T})]})}function Goe(){const{user:t,loading:e,initialized:r,refreshUser:n}=$r(),a=yi(),i=!!(t?.email&&/@guest\.local$/i.test(t.email));return v.useEffect(()=>{!r&&!e&&a.pathname!=="/login"&&n()},[r,e,n]),v.useEffect(()=>{a.pathname==="/login"&&Tg()},[a.pathname]),a.pathname!=="/login"&&(!r||e)?g.jsx("div",{className:"app-loading",children:"Loading…"}):t&&!i?g.jsx(em,{to:"/lobby",replace:!0}):g.jsx(c3,{})}var VI={};function Woe(t,e){return e.forEach(function(r){r&&typeof r!="string"&&!Array.isArray(r)&&Object.keys(r).forEach(function(n){if(n!=="default"&&!(n in t)){var a=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:function(){return r[n]}})}})}),Object.freeze(t)}var Koe=Object.defineProperty,Yoe=(t,e,r)=>e in t?Koe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,HI=(t,e,r)=>Yoe(t,typeof e!="symbol"?e+"":e,r);class Wa{constructor(){HI(this,"_locking"),HI(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let e;const r=new Promise(a=>e=()=>{this._locks-=1,a()}),n=this._locking.then(()=>e);return this._locking=this._locking.then(()=>r),n}}function Rn(t,e){if(!t)throw new Error(e)}const Xoe=34028234663852886e22,Joe=-34028234663852886e22,Qoe=4294967295,Zoe=2147483647,ece=-2147483648;function n_(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>Zoe||t<ece)throw new Error("invalid int 32: "+t)}function rC(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>Qoe||t<0)throw new Error("invalid uint 32: "+t)}function _5(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>Xoe||t<Joe))throw new Error("invalid float 32: "+t)}const b5=Symbol("@bufbuild/protobuf/enum-type");function tce(t){const e=t[b5];return Rn(e,"missing enum type on enum object"),e}function k5(t,e,r,n){t[b5]=w5(e,r.map(a=>({no:a.no,name:a.name,localName:t[a.no]})))}function w5(t,e,r){const n=Object.create(null),a=Object.create(null),i=[];for(const o of e){const c=S5(o);i.push(c),n[o.name]=c,a[o.no]=c}return{typeName:t,values:i,findName(o){return n[o]},findNumber(o){return a[o]}}}function rce(t,e,r){const n={};for(const a of e){const i=S5(a);n[i.localName]=i.no,n[i.no]=i.localName}return k5(n,t,e),n}function S5(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class DP{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,r){const n=this.getType(),a=n.runtime.bin,i=a.makeReadOptions(r);return a.readMessage(this,i.readerFactory(e),e.byteLength,i),this}fromJson(e,r){const n=this.getType(),a=n.runtime.json,i=a.makeReadOptions(r);return a.readMessage(n,e,i,this),this}fromJsonString(e,r){let n;try{n=JSON.parse(e)}catch(a){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(a instanceof Error?a.message:String(a)))}return this.fromJson(n,r)}toBinary(e){const r=this.getType(),n=r.runtime.bin,a=n.makeWriteOptions(e),i=a.writerFactory();return n.writeMessage(this,i,a),i.finish()}toJson(e){const r=this.getType(),n=r.runtime.json,a=n.makeWriteOptions(e);return n.writeMessage(this,a)}toJsonString(e){var r;const n=this.toJson(e);return JSON.stringify(n,null,(r=e?.prettySpaces)!==null&&r!==void 0?r:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function nce(t,e,r,n){var a;const i=(a=n?.localName)!==null&&a!==void 0?a:e.substring(e.lastIndexOf(".")+1),o={[i]:function(c){t.util.initFields(this),t.util.initPartial(c,this)}}[i];return Object.setPrototypeOf(o.prototype,new DP),Object.assign(o,{runtime:t,typeName:e,fields:t.util.newFieldList(r),fromBinary(c,u){return new o().fromBinary(c,u)},fromJson(c,u){return new o().fromJson(c,u)},fromJsonString(c,u){return new o().fromJsonString(c,u)},equals(c,u){return t.util.equals(o,c,u)}}),o}function ace(){let t=0,e=0;for(let n=0;n<28;n+=7){let a=this.buf[this.pos++];if(t|=(a&127)<<n,(a&128)==0)return this.assertBounds(),[t,e]}let r=this.buf[this.pos++];if(t|=(r&15)<<28,e=(r&112)>>4,(r&128)==0)return this.assertBounds(),[t,e];for(let n=3;n<=31;n+=7){let a=this.buf[this.pos++];if(e|=(a&127)<<n,(a&128)==0)return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function ZS(t,e,r){for(let i=0;i<28;i=i+7){const o=t>>>i,c=!(!(o>>>7)&&e==0),u=(c?o|128:o)&255;if(r.push(u),!c)return}const n=t>>>28&15|(e&7)<<4,a=e>>3!=0;if(r.push((a?n|128:n)&255),!!a){for(let i=3;i<31;i=i+7){const o=e>>>i,c=!!(o>>>7),u=(c?o|128:o)&255;if(r.push(u),!c)return}r.push(e>>>31&1)}}const a_=4294967296;function GI(t){const e=t[0]==="-";e&&(t=t.slice(1));const r=1e6;let n=0,a=0;function i(o,c){const u=Number(t.slice(o,c));a*=r,n=n*r+u,n>=a_&&(a=a+(n/a_|0),n=n%a_)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),e?T5(n,a):OP(n,a)}function ice(t,e){let r=OP(t,e);const n=r.hi&2147483648;n&&(r=T5(r.lo,r.hi));const a=E5(r.lo,r.hi);return n?"-"+a:a}function E5(t,e){if({lo:t,hi:e}=sce(t,e),e<=2097151)return String(a_*e+t);const r=t&16777215,n=(t>>>24|e<<8)&16777215,a=e>>16&65535;let i=r+n*6777216+a*6710656,o=n+a*8147497,c=a*2;const u=1e7;return i>=u&&(o+=Math.floor(i/u),i%=u),o>=u&&(c+=Math.floor(o/u),o%=u),c.toString()+WI(o)+WI(i)}function sce(t,e){return{lo:t>>>0,hi:e>>>0}}function OP(t,e){return{lo:t|0,hi:e|0}}function T5(t,e){return e=~e,t?t=~t+1:e+=1,OP(t,e)}const WI=t=>{const e=String(t);return"0000000".slice(e.length)+e};function KI(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let r=0;r<9;r++)e.push(t&127|128),t=t>>7;e.push(1)}}function oce(){let t=this.buf[this.pos++],e=t&127;if((t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,(t&128)==0)return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,(t&128)==0)return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let r=5;(t&128)!==0&&r<10;r++)t=this.buf[this.pos++];if((t&128)!=0)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function cce(){const t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof VI!="object"||VI.BUF_BIGINT_DISABLE!=="1")){const a=BigInt("-9223372036854775808"),i=BigInt("9223372036854775807"),o=BigInt("0"),c=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(u){const d=typeof u=="bigint"?u:BigInt(u);if(d>i||d<a)throw new Error("int64 invalid: ".concat(u));return d},uParse(u){const d=typeof u=="bigint"?u:BigInt(u);if(d>c||d<o)throw new Error("uint64 invalid: ".concat(u));return d},enc(u){return t.setBigInt64(0,this.parse(u),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(u){return t.setBigInt64(0,this.uParse(u),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(u,d){return t.setInt32(0,u,!0),t.setInt32(4,d,!0),t.getBigInt64(0,!0)},uDec(u,d){return t.setInt32(0,u,!0),t.setInt32(4,d,!0),t.getBigUint64(0,!0)}}}const r=a=>Rn(/^-?[0-9]+$/.test(a),"int64 invalid: ".concat(a)),n=a=>Rn(/^[0-9]+$/.test(a),"uint64 invalid: ".concat(a));return{zero:"0",supported:!1,parse(a){return typeof a!="string"&&(a=a.toString()),r(a),a},uParse(a){return typeof a!="string"&&(a=a.toString()),n(a),a},enc(a){return typeof a!="string"&&(a=a.toString()),r(a),GI(a)},uEnc(a){return typeof a!="string"&&(a=a.toString()),n(a),GI(a)},dec(a,i){return ice(a,i)},uDec(a,i){return E5(a,i)}}}const kn=cce();var Xe;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(Xe||(Xe={}));var tu;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(tu||(tu={}));function Sl(t,e,r){if(e===r)return!0;if(t==Xe.BYTES){if(!(e instanceof Uint8Array)||!(r instanceof Uint8Array)||e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==r[n])return!1;return!0}switch(t){case Xe.UINT64:case Xe.FIXED64:case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:return e==r}return!1}function cp(t,e){switch(t){case Xe.BOOL:return!1;case Xe.UINT64:case Xe.FIXED64:case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:return e==0?kn.zero:"0";case Xe.DOUBLE:case Xe.FLOAT:return 0;case Xe.BYTES:return new Uint8Array(0);case Xe.STRING:return"";default:return 0}}function C5(t,e){switch(t){case Xe.BOOL:return e===!1;case Xe.STRING:return e==="";case Xe.BYTES:return e instanceof Uint8Array&&!e.byteLength;default:return e==0}}var Bn;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(Bn||(Bn={}));class lce{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let a=0;a<this.chunks.length;a++)e+=this.chunks[a].length;let r=new Uint8Array(e),n=0;for(let a=0;a<this.chunks.length;a++)r.set(this.chunks[a],n),n+=this.chunks[a].length;return this.chunks=[],r}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),r=this.stack.pop();if(!r)throw new Error("invalid state, fork stack empty");return this.chunks=r.chunks,this.buf=r.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,r){return this.uint32((e<<3|r)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(rC(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return n_(e),KI(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let r=this.textEncoder.encode(e);return this.uint32(r.byteLength),this.raw(r)}float(e){_5(e);let r=new Uint8Array(4);return new DataView(r.buffer).setFloat32(0,e,!0),this.raw(r)}double(e){let r=new Uint8Array(8);return new DataView(r.buffer).setFloat64(0,e,!0),this.raw(r)}fixed32(e){rC(e);let r=new Uint8Array(4);return new DataView(r.buffer).setUint32(0,e,!0),this.raw(r)}sfixed32(e){n_(e);let r=new Uint8Array(4);return new DataView(r.buffer).setInt32(0,e,!0),this.raw(r)}sint32(e){return n_(e),e=(e<<1^e>>31)>>>0,KI(e,this.buf),this}sfixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),a=kn.enc(e);return n.setInt32(0,a.lo,!0),n.setInt32(4,a.hi,!0),this.raw(r)}fixed64(e){let r=new Uint8Array(8),n=new DataView(r.buffer),a=kn.uEnc(e);return n.setInt32(0,a.lo,!0),n.setInt32(4,a.hi,!0),this.raw(r)}int64(e){let r=kn.enc(e);return ZS(r.lo,r.hi,this.buf),this}sint64(e){let r=kn.enc(e),n=r.hi>>31,a=r.lo<<1^n,i=(r.hi<<1|r.lo>>>31)^n;return ZS(a,i,this.buf),this}uint64(e){let r=kn.uEnc(e);return ZS(r.lo,r.hi,this.buf),this}}class uce{constructor(e,r){this.varint64=ace,this.uint32=oce,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=r??new TextDecoder}tag(){let e=this.uint32(),r=e>>>3,n=e&7;if(r<=0||n<0||n>5)throw new Error("illegal tag: field no "+r+" wire type "+n);return[r,n]}skip(e,r){let n=this.pos;switch(e){case Bn.Varint:for(;this.buf[this.pos++]&128;);break;case Bn.Bit64:this.pos+=4;case Bn.Bit32:this.pos+=4;break;case Bn.LengthDelimited:let a=this.uint32();this.pos+=a;break;case Bn.StartGroup:for(;;){const[i,o]=this.tag();if(o===Bn.EndGroup){if(r!==void 0&&i!==r)throw new Error("invalid end group tag");break}this.skip(o,i)}break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return kn.dec(...this.varint64())}uint64(){return kn.uDec(...this.varint64())}sint64(){let[e,r]=this.varint64(),n=-(e&1);return e=(e>>>1|(r&1)<<31)^n,r=r>>>1^n,kn.dec(e,r)}bool(){let[e,r]=this.varint64();return e!==0||r!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return kn.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return kn.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),r=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(r,r+e)}string(){return this.textDecoder.decode(this.bytes())}}function dce(t,e,r,n){let a;return{typeName:e,extendee:r,get field(){if(!a){const i=typeof n=="function"?n():n;i.name=e.split(".").pop(),i.jsonName="[".concat(e,"]"),a=t.util.newFieldList([i]).list()[0]}return a},runtime:t}}function x5(t){const e=t.field.localName,r=Object.create(null);return r[e]=fce(t),[r,()=>r[e]]}function fce(t){const e=t.field;if(e.repeated)return[];if(e.default!==void 0)return e.default;switch(e.kind){case"enum":return e.T.values[0].no;case"scalar":return cp(e.T,e.L);case"message":const r=e.T,n=new r;return r.fieldWrapper?r.fieldWrapper.unwrapField(n):n;case"map":throw"map fields are not allowed to be extensions"}}function pce(t,e){if(!e.repeated&&(e.kind=="enum"||e.kind=="scalar")){for(let r=t.length-1;r>=0;--r)if(t[r].no==e.no)return[t[r]];return[]}return t.filter(r=>r.no===e.no)}let Cc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),o0=[];for(let t=0;t<Cc.length;t++)o0[Cc[t].charCodeAt(0)]=t;o0[45]=Cc.indexOf("+");o0[95]=Cc.indexOf("/");const P5={dec(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let r=new Uint8Array(e),n=0,a=0,i,o=0;for(let c=0;c<t.length;c++){if(i=o0[t.charCodeAt(c)],i===void 0)switch(t[c]){case"=":a=0;case`
`:case"\r":case"	":case" ":continue;default:throw Error("invalid base64 string.")}switch(a){case 0:o=i,a=1;break;case 1:r[n++]=o<<2|(i&48)>>4,o=i,a=2;break;case 2:r[n++]=(o&15)<<4|(i&60)>>2,o=i,a=3;break;case 3:r[n++]=(o&3)<<6|i,a=0;break}}if(a==1)throw Error("invalid base64 string.");return r.subarray(0,n)},enc(t){let e="",r=0,n,a=0;for(let i=0;i<t.length;i++)switch(n=t[i],r){case 0:e+=Cc[n>>2],a=(n&3)<<4,r=1;break;case 1:e+=Cc[a|n>>4],a=(n&15)<<2,r=2;break;case 2:e+=Cc[a|n>>6],e+=Cc[n&63],r=0;break}return r&&(e+=Cc[a],e+="=",r==1&&(e+="=")),e}};function hce(t,e,r){R5(e,t);const n=e.runtime.bin.makeReadOptions(r),a=pce(t.getType().runtime.bin.listUnknownFields(t),e.field),[i,o]=x5(e);for(const c of a)e.runtime.bin.readField(i,n.readerFactory(c.data),e.field,c.wireType,n);return o()}function mce(t,e,r,n){R5(e,t);const a=e.runtime.bin.makeReadOptions(n),i=e.runtime.bin.makeWriteOptions(n);if(A5(t,e)){const d=t.getType().runtime.bin.listUnknownFields(t).filter(f=>f.no!=e.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const f of d)t.getType().runtime.bin.onUnknownField(t,f.no,f.wireType,f.data)}const o=i.writerFactory();let c=e.field;!c.opt&&!c.repeated&&(c.kind=="enum"||c.kind=="scalar")&&(c=Object.assign(Object.assign({},e.field),{opt:!0})),e.runtime.bin.writeField(c,r,o,i);const u=a.readerFactory(o.finish());for(;u.pos<u.len;){const[d,f]=u.tag(),h=u.skip(f,d);t.getType().runtime.bin.onUnknownField(t,d,f,h)}}function A5(t,e){const r=t.getType();return e.extendee.typeName===r.typeName&&!!r.runtime.bin.listUnknownFields(t).find(n=>n.no==e.field.no)}function R5(t,e){Rn(t.extendee.typeName==e.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function D5(t,e){const r=t.localName;if(t.repeated)return e[r].length>0;if(t.oneof)return e[t.oneof.localName].case===r;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?e[r]!==void 0:t.kind=="enum"?e[r]!==t.T.values[0].no:!C5(t.T,e[r]);case"message":return e[r]!==void 0;case"map":return Object.keys(e[r]).length>0}}function YI(t,e){const r=t.localName,n=!t.opt&&!t.req;if(t.repeated)e[r]=[];else if(t.oneof)e[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":e[r]={};break;case"enum":e[r]=n?t.T.values[0].no:void 0;break;case"scalar":e[r]=n?cp(t.T,t.L):void 0;break;case"message":e[r]=void 0;break}}function xc(t,e){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(DP.prototype).every(n=>n in t&&typeof t[n]=="function"))return!1;const r=t.getType();return r===null||typeof r!="function"||!("typeName"in r)||typeof r.typeName!="string"?!1:e===void 0?!0:r.typeName==e.typeName}function O5(t,e){return xc(e)||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}Xe.DOUBLE,Xe.FLOAT,Xe.INT64,Xe.UINT64,Xe.INT32,Xe.UINT32,Xe.BOOL,Xe.STRING,Xe.BYTES;const XI={ignoreUnknownFields:!1},JI={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function gce(t){return t?Object.assign(Object.assign({},XI),t):XI}function yce(t){return t?Object.assign(Object.assign({},JI),t):JI}const rb=Symbol(),i_=Symbol();function vce(){return{makeReadOptions:gce,makeWriteOptions:yce,readMessage(t,e,r,n){if(e==null||Array.isArray(e)||typeof e!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(Do(e)));n=n??new t;const a=new Map,i=r.typeRegistry;for(const[o,c]of Object.entries(e)){const u=t.fields.findJsonName(o);if(u){if(u.oneof){if(c===null&&u.kind=="scalar")continue;const d=a.get(u.oneof);if(d!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(u.oneof.name,'" present: "').concat(d,'", "').concat(o,'"'));a.set(u.oneof,o)}QI(n,c,u,r,t)}else{let d=!1;if(i?.findExtension&&o.startsWith("[")&&o.endsWith("]")){const f=i.findExtension(o.substring(1,o.length-1));if(f&&f.extendee.typeName==t.typeName){d=!0;const[h,m]=x5(f);QI(h,c,f.field,r,f),mce(n,f,m(),r)}}if(!d&&!r.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(o,'" is unknown'))}}return n},writeMessage(t,e){const r=t.getType(),n={};let a;try{for(a of r.fields.byNumber()){if(!D5(a,t)){if(a.req)throw"required field not set";if(!e.emitDefaultValues||!bce(a))continue}const o=a.oneof?t[a.oneof.localName].value:t[a.localName],c=ZI(a,o,e);c!==void 0&&(n[e.useProtoFieldName?a.name:a.jsonName]=c)}const i=e.typeRegistry;if(i?.findExtensionFor)for(const o of r.runtime.bin.listUnknownFields(t)){const c=i.findExtensionFor(r.typeName,o.no);if(c&&A5(t,c)){const u=hce(t,c,e),d=ZI(c.field,u,e);d!==void 0&&(n[c.field.jsonName]=d)}}}catch(i){const o=a?"cannot encode field ".concat(r.typeName,".").concat(a.name," to JSON"):"cannot encode message ".concat(r.typeName," to JSON"),c=i instanceof Error?i.message:String(i);throw new Error(o+(c.length>0?": ".concat(c):""))}return n},readScalar(t,e,r){return fm(t,e,r??tu.BIGINT,!0)},writeScalar(t,e,r){if(e!==void 0&&(r||C5(t,e)))return s_(t,e)},debug:Do}}function Do(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":'"'.concat(t.split('"').join('\\"'),'"');default:return String(t)}}function QI(t,e,r,n,a){let i=r.localName;if(r.repeated){if(Rn(r.kind!="map"),e===null)return;if(!Array.isArray(e))throw new Error("cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Do(e)));const o=t[i];for(const c of e){if(c===null)throw new Error("cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Do(c)));switch(r.kind){case"message":o.push(r.T.fromJson(c,n));break;case"enum":const u=eE(r.T,c,n.ignoreUnknownFields,!0);u!==i_&&o.push(u);break;case"scalar":try{o.push(fm(r.T,c,r.L,!0))}catch(d){let f="cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Do(c));throw d instanceof Error&&d.message.length>0&&(f+=": ".concat(d.message)),new Error(f)}break}}}else if(r.kind=="map"){if(e===null)return;if(typeof e!="object"||Array.isArray(e))throw new Error("cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Do(e)));const o=t[i];for(const[c,u]of Object.entries(e)){if(u===null)throw new Error("cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: map value null"));let d;try{d=_ce(r.K,c)}catch(f){let h="cannot decode map key for field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Do(e));throw f instanceof Error&&f.message.length>0&&(h+=": ".concat(f.message)),new Error(h)}switch(r.V.kind){case"message":o[d]=r.V.T.fromJson(u,n);break;case"enum":const f=eE(r.V.T,u,n.ignoreUnknownFields,!0);f!==i_&&(o[d]=f);break;case"scalar":try{o[d]=fm(r.V.T,u,tu.BIGINT,!0)}catch(h){let m="cannot decode map value for field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Do(e));throw h instanceof Error&&h.message.length>0&&(m+=": ".concat(h.message)),new Error(m)}break}}}else switch(r.oneof&&(t=t[r.oneof.localName]={case:i},i="value"),r.kind){case"message":const o=r.T;if(e===null&&o.typeName!="google.protobuf.Value")return;let c=t[i];xc(c)?c.fromJson(e,n):(t[i]=c=o.fromJson(e,n),o.fieldWrapper&&!r.oneof&&(t[i]=o.fieldWrapper.unwrapField(c)));break;case"enum":const u=eE(r.T,e,n.ignoreUnknownFields,!1);switch(u){case rb:YI(r,t);break;case i_:break;default:t[i]=u;break}break;case"scalar":try{const d=fm(r.T,e,r.L,!1);switch(d){case rb:YI(r,t);break;default:t[i]=d;break}}catch(d){let f="cannot decode field ".concat(a.typeName,".").concat(r.name," from JSON: ").concat(Do(e));throw d instanceof Error&&d.message.length>0&&(f+=": ".concat(d.message)),new Error(f)}break}}function _ce(t,e){if(t===Xe.BOOL)switch(e){case"true":e=!0;break;case"false":e=!1;break}return fm(t,e,tu.BIGINT,!0).toString()}function fm(t,e,r,n){if(e===null)return n?cp(t,r):rb;switch(t){case Xe.DOUBLE:case Xe.FLOAT:if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;const a=Number(e);if(Number.isNaN(a)||!Number.isFinite(a))break;return t==Xe.FLOAT&&_5(a),a;case Xe.INT32:case Xe.FIXED32:case Xe.SFIXED32:case Xe.SINT32:case Xe.UINT32:let i;if(typeof e=="number"?i=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(i=Number(e)),i===void 0)break;return t==Xe.UINT32||t==Xe.FIXED32?rC(i):n_(i),i;case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:if(typeof e!="number"&&typeof e!="string")break;const o=kn.parse(e);return r?o.toString():o;case Xe.FIXED64:case Xe.UINT64:if(typeof e!="number"&&typeof e!="string")break;const c=kn.uParse(e);return r?c.toString():c;case Xe.BOOL:if(typeof e!="boolean")break;return e;case Xe.STRING:if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case Xe.BYTES:if(e==="")return new Uint8Array(0);if(typeof e!="string")break;return P5.dec(e)}throw new Error}function eE(t,e,r,n){if(e===null)return t.typeName=="google.protobuf.NullValue"?0:n?t.values[0].no:rb;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":const a=t.findName(e);if(a!==void 0)return a.no;if(r)return i_;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(Do(e)))}function bce(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function ZI(t,e,r){if(t.kind=="map"){Rn(typeof e=="object"&&e!=null);const n={},a=Object.entries(e);switch(t.V.kind){case"scalar":for(const[o,c]of a)n[o.toString()]=s_(t.V.T,c);break;case"message":for(const[o,c]of a)n[o.toString()]=c.toJson(r);break;case"enum":const i=t.V.T;for(const[o,c]of a)n[o.toString()]=tE(i,c,r.enumAsInteger);break}return r.emitDefaultValues||a.length>0?n:void 0}if(t.repeated){Rn(Array.isArray(e));const n=[];switch(t.kind){case"scalar":for(let a=0;a<e.length;a++)n.push(s_(t.T,e[a]));break;case"enum":for(let a=0;a<e.length;a++)n.push(tE(t.T,e[a],r.enumAsInteger));break;case"message":for(let a=0;a<e.length;a++)n.push(e[a].toJson(r));break}return r.emitDefaultValues||n.length>0?n:void 0}switch(t.kind){case"scalar":return s_(t.T,e);case"enum":return tE(t.T,e,r.enumAsInteger);case"message":return O5(t.T,e).toJson(r)}}function tE(t,e,r){var n;if(Rn(typeof e=="number"),t.typeName=="google.protobuf.NullValue")return null;if(r)return e;const a=t.findNumber(e);return(n=a?.name)!==null&&n!==void 0?n:e}function s_(t,e){switch(t){case Xe.INT32:case Xe.SFIXED32:case Xe.SINT32:case Xe.FIXED32:case Xe.UINT32:return Rn(typeof e=="number"),e;case Xe.FLOAT:case Xe.DOUBLE:return Rn(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e;case Xe.STRING:return Rn(typeof e=="string"),e;case Xe.BOOL:return Rn(typeof e=="boolean"),e;case Xe.UINT64:case Xe.FIXED64:case Xe.INT64:case Xe.SFIXED64:case Xe.SINT64:return Rn(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),e.toString();case Xe.BYTES:return Rn(e instanceof Uint8Array),P5.enc(e)}}const lf=Symbol("@bufbuild/protobuf/unknown-fields"),eM={readUnknownFields:!0,readerFactory:t=>new uce(t)},tM={writeUnknownFields:!0,writerFactory:()=>new lce};function kce(t){return t?Object.assign(Object.assign({},eM),t):eM}function wce(t){return t?Object.assign(Object.assign({},tM),t):tM}function Sce(){return{makeReadOptions:kce,makeWriteOptions:wce,listUnknownFields(t){var e;return(e=t[lf])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[lf]},writeUnknownFields(t,e){const n=t[lf];if(n)for(const a of n)e.tag(a.no,a.wireType).raw(a.data)},onUnknownField(t,e,r,n){const a=t;Array.isArray(a[lf])||(a[lf]=[]),a[lf].push({no:e,wireType:r,data:n})},readMessage(t,e,r,n,a){const i=t.getType(),o=a?e.len:e.pos+r;let c,u;for(;e.pos<o&&([c,u]=e.tag(),!(a===!0&&u==Bn.EndGroup));){const d=i.fields.find(c);if(!d){const f=e.skip(u,c);n.readUnknownFields&&this.onUnknownField(t,c,u,f);continue}rM(t,e,d,u,n)}if(a&&(u!=Bn.EndGroup||c!==r))throw new Error("invalid end group tag")},readField:rM,writeMessage(t,e,r){const n=t.getType();for(const a of n.fields.byNumber()){if(!D5(a,t)){if(a.req)throw new Error("cannot encode field ".concat(n.typeName,".").concat(a.name," to binary: required field not set"));continue}const i=a.oneof?t[a.oneof.localName].value:t[a.localName];nM(a,i,e,r)}return r.writeUnknownFields&&this.writeUnknownFields(t,e),e},writeField(t,e,r,n){e!==void 0&&nM(t,e,r,n)}}}function rM(t,e,r,n,a){let{repeated:i,localName:o}=r;switch(r.oneof&&(t=t[r.oneof.localName],t.case!=o&&delete t.value,t.case=o,o="value"),r.kind){case"scalar":case"enum":const c=r.kind=="enum"?Xe.INT32:r.T;let u=nb;if(r.kind=="scalar"&&r.L>0&&(u=Tce),i){let m=t[o];if(n==Bn.LengthDelimited&&c!=Xe.STRING&&c!=Xe.BYTES){let w=e.uint32()+e.pos;for(;e.pos<w;)m.push(u(e,c))}else m.push(u(e,c))}else t[o]=u(e,c);break;case"message":const d=r.T;i?t[o].push(o_(e,new d,a,r)):xc(t[o])?o_(e,t[o],a,r):(t[o]=o_(e,new d,a,r),d.fieldWrapper&&!r.oneof&&!r.repeated&&(t[o]=d.fieldWrapper.unwrapField(t[o])));break;case"map":let[f,h]=Ece(r,e,a);t[o][f]=h;break}}function o_(t,e,r,n){const a=e.getType().runtime.bin,i=n?.delimited;return a.readMessage(e,t,i?n.no:t.uint32(),r,i),e}function Ece(t,e,r){const n=e.uint32(),a=e.pos+n;let i,o;for(;e.pos<a;){const[c]=e.tag();switch(c){case 1:i=nb(e,t.K);break;case 2:switch(t.V.kind){case"scalar":o=nb(e,t.V.T);break;case"enum":o=e.int32();break;case"message":o=o_(e,new t.V.T,r,void 0);break}break}}if(i===void 0&&(i=cp(t.K,tu.BIGINT)),typeof i!="string"&&typeof i!="number"&&(i=i.toString()),o===void 0)switch(t.V.kind){case"scalar":o=cp(t.V.T,tu.BIGINT);break;case"enum":o=t.V.T.values[0].no;break;case"message":o=new t.V.T;break}return[i,o]}function Tce(t,e){const r=nb(t,e);return typeof r=="bigint"?r.toString():r}function nb(t,e){switch(e){case Xe.STRING:return t.string();case Xe.BOOL:return t.bool();case Xe.DOUBLE:return t.double();case Xe.FLOAT:return t.float();case Xe.INT32:return t.int32();case Xe.INT64:return t.int64();case Xe.UINT64:return t.uint64();case Xe.FIXED64:return t.fixed64();case Xe.BYTES:return t.bytes();case Xe.FIXED32:return t.fixed32();case Xe.SFIXED32:return t.sfixed32();case Xe.SFIXED64:return t.sfixed64();case Xe.SINT64:return t.sint64();case Xe.UINT32:return t.uint32();case Xe.SINT32:return t.sint32()}}function nM(t,e,r,n){Rn(e!==void 0);const a=t.repeated;switch(t.kind){case"scalar":case"enum":let i=t.kind=="enum"?Xe.INT32:t.T;if(a)if(Rn(Array.isArray(e)),t.packed)xce(r,i,t.no,e);else for(const o of e)pm(r,i,t.no,o);else pm(r,i,t.no,e);break;case"message":if(a){Rn(Array.isArray(e));for(const o of e)aM(r,n,t,o)}else aM(r,n,t,e);break;case"map":Rn(typeof e=="object"&&e!=null);for(const[o,c]of Object.entries(e))Cce(r,n,t,o,c);break}}function Cce(t,e,r,n,a){t.tag(r.no,Bn.LengthDelimited),t.fork();let i=n;switch(r.K){case Xe.INT32:case Xe.FIXED32:case Xe.UINT32:case Xe.SFIXED32:case Xe.SINT32:i=Number.parseInt(n);break;case Xe.BOOL:Rn(n=="true"||n=="false"),i=n=="true";break}switch(pm(t,r.K,1,i),r.V.kind){case"scalar":pm(t,r.V.T,2,a);break;case"enum":pm(t,Xe.INT32,2,a);break;case"message":Rn(a!==void 0),t.tag(2,Bn.LengthDelimited).bytes(a.toBinary(e));break}t.join()}function aM(t,e,r,n){const a=O5(r.T,n);r.delimited?t.tag(r.no,Bn.StartGroup).raw(a.toBinary(e)).tag(r.no,Bn.EndGroup):t.tag(r.no,Bn.LengthDelimited).bytes(a.toBinary(e))}function pm(t,e,r,n){Rn(n!==void 0);let[a,i]=N5(e);t.tag(r,a)[i](n)}function xce(t,e,r,n){if(!n.length)return;t.tag(r,Bn.LengthDelimited).fork();let[,a]=N5(e);for(let i=0;i<n.length;i++)t[a](n[i]);t.join()}function N5(t){let e=Bn.Varint;switch(t){case Xe.BYTES:case Xe.STRING:e=Bn.LengthDelimited;break;case Xe.DOUBLE:case Xe.FIXED64:case Xe.SFIXED64:e=Bn.Bit64;break;case Xe.FIXED32:case Xe.SFIXED32:case Xe.FLOAT:e=Bn.Bit32;break}const r=Xe[t].toLowerCase();return[e,r]}function Pce(){return{setEnumType:k5,initPartial(t,e){if(t===void 0)return;const r=e.getType();for(const n of r.fields.byMember()){const a=n.localName,i=e,o=t;if(o[a]!=null)switch(n.kind){case"oneof":const c=o[a].case;if(c===void 0)continue;const u=n.findField(c);let d=o[a].value;u&&u.kind=="message"&&!xc(d,u.T)?d=new u.T(d):u&&u.kind==="scalar"&&u.T===Xe.BYTES&&(d=xh(d)),i[a]={case:c,value:d};break;case"scalar":case"enum":let f=o[a];n.T===Xe.BYTES&&(f=n.repeated?f.map(xh):xh(f)),i[a]=f;break;case"map":switch(n.V.kind){case"scalar":case"enum":if(n.V.T===Xe.BYTES)for(const[_,w]of Object.entries(o[a]))i[a][_]=xh(w);else Object.assign(i[a],o[a]);break;case"message":const m=n.V.T;for(const _ of Object.keys(o[a])){let w=o[a][_];m.fieldWrapper||(w=new m(w)),i[a][_]=w}break}break;case"message":const h=n.T;if(n.repeated)i[a]=o[a].map(m=>xc(m,h)?m:new h(m));else{const m=o[a];h.fieldWrapper?h.typeName==="google.protobuf.BytesValue"?i[a]=xh(m):i[a]=m:i[a]=xc(m,h)?m:new h(m)}break}}},equals(t,e,r){return e===r?!0:!e||!r?!1:t.fields.byMember().every(n=>{const a=e[n.localName],i=r[n.localName];if(n.repeated){if(a.length!==i.length)return!1;switch(n.kind){case"message":return a.every((o,c)=>n.T.equals(o,i[c]));case"scalar":return a.every((o,c)=>Sl(n.T,o,i[c]));case"enum":return a.every((o,c)=>Sl(Xe.INT32,o,i[c]))}throw new Error("repeated cannot contain ".concat(n.kind))}switch(n.kind){case"message":let o=a,c=i;return n.T.fieldWrapper&&(o!==void 0&&!xc(o)&&(o=n.T.fieldWrapper.wrapField(o)),c!==void 0&&!xc(c)&&(c=n.T.fieldWrapper.wrapField(c))),n.T.equals(o,c);case"enum":return Sl(Xe.INT32,a,i);case"scalar":return Sl(n.T,a,i);case"oneof":if(a.case!==i.case)return!1;const u=n.findField(a.case);if(u===void 0)return!0;switch(u.kind){case"message":return u.T.equals(a.value,i.value);case"enum":return Sl(Xe.INT32,a.value,i.value);case"scalar":return Sl(u.T,a.value,i.value)}throw new Error("oneof cannot contain ".concat(u.kind));case"map":const d=Object.keys(a).concat(Object.keys(i));switch(n.V.kind){case"message":const f=n.V.T;return d.every(m=>f.equals(a[m],i[m]));case"enum":return d.every(m=>Sl(Xe.INT32,a[m],i[m]));case"scalar":const h=n.V.T;return d.every(m=>Sl(h,a[m],i[m]))}break}})},clone(t){const e=t.getType(),r=new e,n=r;for(const a of e.fields.byMember()){const i=t[a.localName];let o;if(a.repeated)o=i.map(vv);else if(a.kind=="map"){o=n[a.localName];for(const[c,u]of Object.entries(i))o[c]=vv(u)}else a.kind=="oneof"?o=a.findField(i.case)?{case:i.case,value:vv(i.value)}:{case:void 0}:o=vv(i);n[a.localName]=o}for(const a of e.runtime.bin.listUnknownFields(t))e.runtime.bin.onUnknownField(n,a.no,a.wireType,a.data);return r}}}function vv(t){if(t===void 0)return t;if(xc(t))return t.clone();if(t instanceof Uint8Array){const e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function xh(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function Ace(t,e,r){return{syntax:t,json:vce(),bin:Sce(),util:Object.assign(Object.assign({},Pce()),{newFieldList:e,initFields:r}),makeMessageType(n,a,i){return nce(this,n,a,i)},makeEnum:rce,makeEnumType:w5,getEnumType:tce,makeExtension(n,a,i){return dce(this,n,a,i)}}}class Rce{constructor(e,r){this._fields=e,this._normalizer=r}findJsonName(e){if(!this.jsonNames){const r={};for(const n of this.list())r[n.jsonName]=r[n.name]=n;this.jsonNames=r}return this.jsonNames[e]}find(e){if(!this.numbers){const r={};for(const n of this.list())r[n.no]=n;this.numbers=r}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,r)=>e.no-r.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const e=this.members;let r;for(const n of this.list())n.oneof?n.oneof!==r&&(r=n.oneof,e.push(r)):e.push(n)}return this.members}}function I5(t,e){const r=M5(t);return e?r:jce(Mce(r))}function Dce(t){return I5(t,!1)}const Oce=M5;function M5(t){let e=!1;const r=[];for(let n=0;n<t.length;n++){let a=t.charAt(n);switch(a){case"_":e=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":r.push(a),e=!1;break;default:e&&(e=!1,a=a.toUpperCase()),r.push(a);break}}return r.join("")}const Nce=new Set(["constructor","toString","toJSON","valueOf"]),Ice=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),j5=t=>"".concat(t,"$"),Mce=t=>Ice.has(t)?j5(t):t,jce=t=>Nce.has(t)?j5(t):t;class Lce{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=Dce(e)}addField(e){Rn(e.oneof===this,"field ".concat(e.name," not one of ").concat(this.name)),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let r=0;r<this.fields.length;r++)this._lookup[this.fields[r].localName]=this.fields[r]}return this._lookup[e]}}function Bce(t,e){var r,n,a,i,o,c;const u=[];let d;for(const f of typeof t=="function"?t():t){const h=f;if(h.localName=I5(f.name,f.oneof!==void 0),h.jsonName=(r=f.jsonName)!==null&&r!==void 0?r:Oce(f.name),h.repeated=(n=f.repeated)!==null&&n!==void 0?n:!1,f.kind=="scalar"&&(h.L=(a=f.L)!==null&&a!==void 0?a:tu.BIGINT),h.delimited=(i=f.delimited)!==null&&i!==void 0?i:!1,h.req=(o=f.req)!==null&&o!==void 0?o:!1,h.opt=(c=f.opt)!==null&&c!==void 0?c:!1,f.packed===void 0&&(h.packed=f.kind=="enum"||f.kind=="scalar"&&f.T!=Xe.BYTES&&f.T!=Xe.STRING),f.oneof!==void 0){const m=typeof f.oneof=="string"?f.oneof:f.oneof.name;(!d||d.name!=m)&&(d=new Lce(m)),h.oneof=d,d.addField(h)}u.push(h)}return u}const Ce=Ace("proto3",t=>new Rce(t,e=>Bce(e)),t=>{for(const e of t.getType().fields.byMember()){if(e.opt)continue;const r=e.localName,n=t;if(e.repeated){n[r]=[];continue}switch(e.kind){case"oneof":n[r]={case:void 0};break;case"enum":n[r]=0;break;case"map":n[r]={};break;case"scalar":n[r]=cp(e.T,e.L);break}}});class ii extends DP{constructor(e){super(),this.seconds=kn.zero,this.nanos=0,Ce.util.initPartial(e,this)}fromJson(e,r){if(typeof e!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(Ce.json.debug(e)));const n=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!n)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const a=Date.parse(n[1]+"-"+n[2]+"-"+n[3]+"T"+n[4]+":"+n[5]+":"+n[6]+(n[8]?n[8]:"Z"));if(Number.isNaN(a))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(a<Date.parse("0001-01-01T00:00:00Z")||a>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot decode message google.protobuf.Timestamp from JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");return this.seconds=kn.parse(a/1e3),this.nanos=0,n[7]&&(this.nanos=parseInt("1"+n[7]+"0".repeat(9-n[7].length))-1e9),this}toJson(e){const r=Number(this.seconds)*1e3;if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("cannot encode google.protobuf.Timestamp to JSON: must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive");if(this.nanos<0)throw new Error("cannot encode google.protobuf.Timestamp to JSON: nanos must not be negative");let n="Z";if(this.nanos>0){const a=(this.nanos+1e9).toString().substring(1);a.substring(3)==="000000"?n="."+a.substring(0,3)+"Z":a.substring(6)==="000"?n="."+a.substring(0,6)+"Z":n="."+a+"Z"}return new Date(r).toISOString().replace(".000Z",n)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return ii.fromDate(new Date)}static fromDate(e){const r=e.getTime();return new ii({seconds:kn.parse(Math.floor(r/1e3)),nanos:r%1e3*1e6})}static fromBinary(e,r){return new ii().fromBinary(e,r)}static fromJson(e,r){return new ii().fromJson(e,r)}static fromJsonString(e,r){return new ii().fromJsonString(e,r)}static equals(e,r){return Ce.util.equals(ii,e,r)}}ii.runtime=Ce;ii.typeName="google.protobuf.Timestamp";ii.fields=Ce.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const Uce=Ce.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:ii},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:Fce,repeated:!0},{no:5,name:"events",kind:"message",T:zce,repeated:!0}]),Fce=Ce.makeMessageType("livekit.TimeSeriesMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"samples",kind:"message",T:qce,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),qce=Ce.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:ii},{no:3,name:"value",kind:"scalar",T:2}]),zce=Ce.makeMessageType("livekit.EventMetric",()=>[{no:1,name:"label",kind:"scalar",T:13},{no:2,name:"participant_identity",kind:"scalar",T:13},{no:3,name:"track_sid",kind:"scalar",T:13},{no:4,name:"start_timestamp_ms",kind:"scalar",T:3},{no:5,name:"end_timestamp_ms",kind:"scalar",T:3,opt:!0},{no:6,name:"normalized_start_timestamp",kind:"message",T:ii},{no:7,name:"normalized_end_timestamp",kind:"message",T:ii,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),L5=Ce.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),zs=Ce.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Yn=Ce.makeEnum("livekit.TrackSource",[{no:0,name:"UNKNOWN"},{no:1,name:"CAMERA"},{no:2,name:"MICROPHONE"},{no:3,name:"SCREEN_SHARE"},{no:4,name:"SCREEN_SHARE_AUDIO"}]),NP=Ce.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Xh=Ce.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),zm=Ce.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),Gs=Ce.makeEnum("livekit.DisconnectReason",[{no:0,name:"UNKNOWN_REASON"},{no:1,name:"CLIENT_INITIATED"},{no:2,name:"DUPLICATE_IDENTITY"},{no:3,name:"SERVER_SHUTDOWN"},{no:4,name:"PARTICIPANT_REMOVED"},{no:5,name:"ROOM_DELETED"},{no:6,name:"STATE_MISMATCH"},{no:7,name:"JOIN_FAILURE"},{no:8,name:"MIGRATION"},{no:9,name:"SIGNAL_CLOSE"},{no:10,name:"ROOM_CLOSED"},{no:11,name:"USER_UNAVAILABLE"},{no:12,name:"USER_REJECTED"},{no:13,name:"SIP_TRUNK_FAILURE"},{no:14,name:"CONNECTION_TIMEOUT"},{no:15,name:"MEDIA_FAILURE"}]),qu=Ce.makeEnum("livekit.ReconnectReason",[{no:0,name:"RR_UNKNOWN"},{no:1,name:"RR_SIGNAL_DISCONNECTED"},{no:2,name:"RR_PUBLISHER_FAILED"},{no:3,name:"RR_SUBSCRIBER_FAILED"},{no:4,name:"RR_SWITCH_CANDIDATE"}]),$ce=Ce.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),da=Ce.makeEnum("livekit.AudioTrackFeature",[{no:0,name:"TF_STEREO"},{no:1,name:"TF_NO_DTX"},{no:2,name:"TF_AUTO_GAIN_CONTROL"},{no:3,name:"TF_ECHO_CANCELLATION"},{no:4,name:"TF_NOISE_SUPPRESSION"},{no:5,name:"TF_ENHANCED_NOISE_CANCELLATION"},{no:6,name:"TF_PRECONNECT_BUFFER"}]),c0=Ce.makeMessageType("livekit.Room",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"empty_timeout",kind:"scalar",T:13},{no:14,name:"departure_timeout",kind:"scalar",T:13},{no:4,name:"max_participants",kind:"scalar",T:13},{no:5,name:"creation_time",kind:"scalar",T:3},{no:15,name:"creation_time_ms",kind:"scalar",T:3},{no:6,name:"turn_password",kind:"scalar",T:9},{no:7,name:"enabled_codecs",kind:"message",T:ab,repeated:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"num_participants",kind:"scalar",T:13},{no:11,name:"num_publishers",kind:"scalar",T:13},{no:10,name:"active_recording",kind:"scalar",T:8},{no:13,name:"version",kind:"message",T:X5}]),ab=Ce.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),Vce=Ce.makeMessageType("livekit.ParticipantPermission",()=>[{no:1,name:"can_subscribe",kind:"scalar",T:8},{no:2,name:"can_publish",kind:"scalar",T:8},{no:3,name:"can_publish_data",kind:"scalar",T:8},{no:9,name:"can_publish_sources",kind:"enum",T:Ce.getEnumType(Yn),repeated:!0},{no:7,name:"hidden",kind:"scalar",T:8},{no:8,name:"recorder",kind:"scalar",T:8},{no:10,name:"can_update_metadata",kind:"scalar",T:8},{no:11,name:"agent",kind:"scalar",T:8},{no:12,name:"can_subscribe_metrics",kind:"scalar",T:8}]),dd=Ce.makeMessageType("livekit.ParticipantInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"identity",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Ce.getEnumType(Uf)},{no:4,name:"tracks",kind:"message",T:Ef,repeated:!0},{no:5,name:"metadata",kind:"scalar",T:9},{no:6,name:"joined_at",kind:"scalar",T:3},{no:17,name:"joined_at_ms",kind:"scalar",T:3},{no:9,name:"name",kind:"scalar",T:9},{no:10,name:"version",kind:"scalar",T:13},{no:11,name:"permission",kind:"message",T:Vce},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:Ce.getEnumType($m)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:Ce.getEnumType(Gs)},{no:18,name:"kind_details",kind:"enum",T:Ce.getEnumType(Hce),repeated:!0}]),Uf=Ce.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),$m=Ce.makeEnum("livekit.ParticipantInfo.Kind",[{no:0,name:"STANDARD"},{no:1,name:"INGRESS"},{no:2,name:"EGRESS"},{no:3,name:"SIP"},{no:4,name:"AGENT"},{no:7,name:"CONNECTOR"}]),Hce=Ce.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),aa=Ce.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),Gce=Ce.makeMessageType("livekit.SimulcastCodecInfo",()=>[{no:1,name:"mime_type",kind:"scalar",T:9},{no:2,name:"mid",kind:"scalar",T:9},{no:3,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:$l,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:Ce.getEnumType(B5)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),Ef=Ce.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:Ce.getEnumType(zs)},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"muted",kind:"scalar",T:8},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"simulcast",kind:"scalar",T:8},{no:8,name:"disable_dtx",kind:"scalar",T:8},{no:9,name:"source",kind:"enum",T:Ce.getEnumType(Yn)},{no:10,name:"layers",kind:"message",T:$l,repeated:!0},{no:11,name:"mime_type",kind:"scalar",T:9},{no:12,name:"mid",kind:"scalar",T:9},{no:13,name:"codecs",kind:"message",T:Gce,repeated:!0},{no:14,name:"stereo",kind:"scalar",T:8},{no:15,name:"disable_red",kind:"scalar",T:8},{no:16,name:"encryption",kind:"enum",T:Ce.getEnumType(aa)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:X5},{no:19,name:"audio_features",kind:"enum",T:Ce.getEnumType(da),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:Ce.getEnumType(L5)}]),$l=Ce.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:Ce.getEnumType(NP)},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13},{no:4,name:"bitrate",kind:"scalar",T:13},{no:5,name:"ssrc",kind:"scalar",T:13},{no:6,name:"spatial_layer",kind:"scalar",T:5},{no:7,name:"rid",kind:"scalar",T:9}]),B5=Ce.makeEnum("livekit.VideoLayer.Mode",[{no:0,name:"MODE_UNUSED"},{no:1,name:"ONE_SPATIAL_LAYER_PER_STREAM"},{no:2,name:"MULTIPLE_SPATIAL_LAYERS_PER_STREAM"},{no:3,name:"ONE_SPATIAL_LAYER_PER_STREAM_INCOMPLETE_RTCP_SR"}]),$a=Ce.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:Ce.getEnumType(mr)},{no:4,name:"participant_identity",kind:"scalar",T:9},{no:5,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:2,name:"user",kind:"message",T:IP,oneof:"value"},{no:3,name:"speaker",kind:"message",T:Wce,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:z5,oneof:"value"},{no:7,name:"transcription",kind:"message",T:Kce,oneof:"value"},{no:8,name:"metrics",kind:"message",T:Uce,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:ib,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:MP,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:jP,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:LP,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:sb,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:ob,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:cb,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:U5,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),mr=Ce.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),U5=Ce.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:Ce.getEnumType(aa)},{no:2,name:"iv",kind:"scalar",T:12},{no:3,name:"key_index",kind:"scalar",T:13},{no:4,name:"encrypted_value",kind:"scalar",T:12}]),F5=Ce.makeMessageType("livekit.EncryptedPacketPayload",()=>[{no:1,name:"user",kind:"message",T:IP,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:ib,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:MP,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:jP,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:LP,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:sb,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:ob,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:cb,oneof:"value"}]),Wce=Ce.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:q5,repeated:!0}]),q5=Ce.makeMessageType("livekit.SpeakerInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"level",kind:"scalar",T:2},{no:3,name:"active",kind:"scalar",T:8}]),IP=Ce.makeMessageType("livekit.UserPacket",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:5,name:"participant_identity",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"destination_sids",kind:"scalar",T:9,repeated:!0},{no:6,name:"destination_identities",kind:"scalar",T:9,repeated:!0},{no:4,name:"topic",kind:"scalar",T:9,opt:!0},{no:8,name:"id",kind:"scalar",T:9,opt:!0},{no:9,name:"start_time",kind:"scalar",T:4,opt:!0},{no:10,name:"end_time",kind:"scalar",T:4,opt:!0},{no:11,name:"nonce",kind:"scalar",T:12}]),z5=Ce.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),Kce=Ce.makeMessageType("livekit.Transcription",()=>[{no:2,name:"transcribed_participant_identity",kind:"scalar",T:9},{no:3,name:"track_id",kind:"scalar",T:9},{no:4,name:"segments",kind:"message",T:Yce,repeated:!0}]),Yce=Ce.makeMessageType("livekit.TranscriptionSegment",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"start_time",kind:"scalar",T:4},{no:4,name:"end_time",kind:"scalar",T:4},{no:5,name:"final",kind:"scalar",T:8},{no:6,name:"language",kind:"scalar",T:9}]),ib=Ce.makeMessageType("livekit.ChatMessage",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"edit_timestamp",kind:"scalar",T:3,opt:!0},{no:4,name:"message",kind:"scalar",T:9},{no:5,name:"deleted",kind:"scalar",T:8},{no:6,name:"generated",kind:"scalar",T:8}]),MP=Ce.makeMessageType("livekit.RpcRequest",()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"method",kind:"scalar",T:9},{no:3,name:"payload",kind:"scalar",T:9},{no:4,name:"response_timeout_ms",kind:"scalar",T:13},{no:5,name:"version",kind:"scalar",T:13}]),jP=Ce.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),LP=Ce.makeMessageType("livekit.RpcResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:9,oneof:"value"},{no:3,name:"error",kind:"message",T:$5,oneof:"value"}]),$5=Ce.makeMessageType("livekit.RpcError",()=>[{no:1,name:"code",kind:"scalar",T:13},{no:2,name:"message",kind:"scalar",T:9},{no:3,name:"data",kind:"scalar",T:9}]),V5=Ce.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),H5=Ce.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:Ce.getEnumType(G5)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"region",kind:"scalar",T:9},{no:5,name:"node_id",kind:"scalar",T:9},{no:6,name:"debug_info",kind:"scalar",T:9},{no:7,name:"agent_protocol",kind:"scalar",T:5}]),G5=Ce.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),W5=Ce.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:Ce.getEnumType(K5)},{no:2,name:"version",kind:"scalar",T:9},{no:3,name:"protocol",kind:"scalar",T:5},{no:4,name:"os",kind:"scalar",T:9},{no:5,name:"os_version",kind:"scalar",T:9},{no:6,name:"device_model",kind:"scalar",T:9},{no:7,name:"browser",kind:"scalar",T:9},{no:8,name:"browser_version",kind:"scalar",T:9},{no:9,name:"address",kind:"scalar",T:9},{no:10,name:"network",kind:"scalar",T:9},{no:11,name:"other_sdks",kind:"scalar",T:9}]),K5=Ce.makeEnum("livekit.ClientInfo.SDK",[{no:0,name:"UNKNOWN"},{no:1,name:"JS"},{no:2,name:"SWIFT"},{no:3,name:"ANDROID"},{no:4,name:"FLUTTER"},{no:5,name:"GO"},{no:6,name:"UNITY"},{no:7,name:"REACT_NATIVE"},{no:8,name:"RUST"},{no:9,name:"PYTHON"},{no:10,name:"CPP"},{no:11,name:"UNITY_WEB"},{no:12,name:"NODE"},{no:13,name:"UNREAL"},{no:14,name:"ESP32"}]),Y5=Ce.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:iM},{no:2,name:"screen",kind:"message",T:iM},{no:3,name:"resume_connection",kind:"enum",T:Ce.getEnumType(zm)},{no:4,name:"disabled_codecs",kind:"message",T:Xce},{no:5,name:"force_relay",kind:"enum",T:Ce.getEnumType(zm)}]),iM=Ce.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:Ce.getEnumType(zm)}]),Xce=Ce.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:ab,repeated:!0},{no:2,name:"publish",kind:"message",T:ab,repeated:!0}]),X5=Ce.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),nC=Ce.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),J5=Ce.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:Ce.getEnumType(nC)},{no:2,name:"version",kind:"scalar",T:5},{no:3,name:"reply_to_stream_id",kind:"scalar",T:9},{no:4,name:"attached_stream_ids",kind:"scalar",T:9,repeated:!0},{no:5,name:"generated",kind:"scalar",T:8}],{localName:"DataStream_TextHeader"}),Q5=Ce.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),sb=Ce.makeMessageType("livekit.DataStream.Header",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"timestamp",kind:"scalar",T:3},{no:3,name:"topic",kind:"scalar",T:9},{no:4,name:"mime_type",kind:"scalar",T:9},{no:5,name:"total_length",kind:"scalar",T:4,opt:!0},{no:7,name:"encryption_type",kind:"enum",T:Ce.getEnumType(aa)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:J5,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:Q5,oneof:"content_header"}],{localName:"DataStream_Header"}),ob=Ce.makeMessageType("livekit.DataStream.Chunk",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"chunk_index",kind:"scalar",T:4},{no:3,name:"content",kind:"scalar",T:12},{no:4,name:"version",kind:"scalar",T:5},{no:5,name:"iv",kind:"scalar",T:12,opt:!0}],{localName:"DataStream_Chunk"}),cb=Ce.makeMessageType("livekit.DataStream.Trailer",()=>[{no:1,name:"stream_id",kind:"scalar",T:9},{no:2,name:"reason",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}}],{localName:"DataStream_Trailer"}),Jce=Ce.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),$s=Ce.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),aC=Ce.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),Qce=Ce.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),Zce=Ce.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:ru,oneof:"message"},{no:2,name:"answer",kind:"message",T:ru,oneof:"message"},{no:3,name:"trickle",kind:"message",T:l0,oneof:"message"},{no:4,name:"add_track",kind:"message",T:Vm,oneof:"message"},{no:5,name:"mute",kind:"message",T:u0,oneof:"message"},{no:6,name:"subscription",kind:"message",T:d0,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:Z5,oneof:"message"},{no:8,name:"leave",kind:"message",T:f0,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:tq,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:aq,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:zP,oneof:"message"},{no:13,name:"simulate",kind:"message",T:Po,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:FP,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:oq,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:UP,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:eq,oneof:"message"}]),sM=Ce.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:ele,oneof:"message"},{no:2,name:"answer",kind:"message",T:ru,oneof:"message"},{no:3,name:"offer",kind:"message",T:ru,oneof:"message"},{no:4,name:"trickle",kind:"message",T:l0,oneof:"message"},{no:5,name:"update",kind:"message",T:nle,oneof:"message"},{no:6,name:"track_published",kind:"message",T:BP,oneof:"message"},{no:8,name:"leave",kind:"message",T:f0,oneof:"message"},{no:9,name:"mute",kind:"message",T:u0,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:ale,oneof:"message"},{no:11,name:"room_update",kind:"message",T:ile,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:ole,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:lle,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:dle,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:ple,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:rle,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:tle,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:mle,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:vle,oneof:"message"},{no:22,name:"request_response",kind:"message",T:_le,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:ble,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:hle,oneof:"message"},{no:25,name:"media_sections_requirement",kind:"message",T:Ele,oneof:"message"},{no:26,name:"subscribed_audio_codec_update",kind:"message",T:fle,oneof:"message"}]),iC=Ce.makeMessageType("livekit.SimulcastCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"cid",kind:"scalar",T:9},{no:4,name:"layers",kind:"message",T:$l,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:Ce.getEnumType(B5)}]),Vm=Ce.makeMessageType("livekit.AddTrackRequest",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"type",kind:"enum",T:Ce.getEnumType(zs)},{no:4,name:"width",kind:"scalar",T:13},{no:5,name:"height",kind:"scalar",T:13},{no:6,name:"muted",kind:"scalar",T:8},{no:7,name:"disable_dtx",kind:"scalar",T:8},{no:8,name:"source",kind:"enum",T:Ce.getEnumType(Yn)},{no:9,name:"layers",kind:"message",T:$l,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:iC,repeated:!0},{no:11,name:"sid",kind:"scalar",T:9},{no:12,name:"stereo",kind:"scalar",T:8},{no:13,name:"disable_red",kind:"scalar",T:8},{no:14,name:"encryption",kind:"enum",T:Ce.getEnumType(aa)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:Ce.getEnumType(L5)},{no:17,name:"audio_features",kind:"enum",T:Ce.getEnumType(da),repeated:!0}]),l0=Ce.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:Ce.getEnumType($s)},{no:3,name:"final",kind:"scalar",T:8}]),u0=Ce.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),ele=Ce.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:c0},{no:2,name:"participant",kind:"message",T:dd},{no:3,name:"other_participants",kind:"message",T:dd,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:rq,repeated:!0},{no:6,name:"subscriber_primary",kind:"scalar",T:8},{no:7,name:"alternative_url",kind:"scalar",T:9},{no:8,name:"client_configuration",kind:"message",T:Y5},{no:9,name:"server_region",kind:"scalar",T:9},{no:10,name:"ping_timeout",kind:"scalar",T:5},{no:11,name:"ping_interval",kind:"scalar",T:5},{no:12,name:"server_info",kind:"message",T:H5},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:ab,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),tle=Ce.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:rq,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:Y5},{no:3,name:"server_info",kind:"message",T:H5},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),BP=Ce.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:Ef}]),rle=Ce.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),ru=Ce.makeMessageType("livekit.SessionDescription",()=>[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"sdp",kind:"scalar",T:9},{no:3,name:"id",kind:"scalar",T:13},{no:4,name:"mid_to_track_id",kind:"map",K:9,V:{kind:"scalar",T:9}}]),nle=Ce.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:dd,repeated:!0}]),d0=Ce.makeMessageType("livekit.UpdateSubscription",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:2,name:"subscribe",kind:"scalar",T:8},{no:3,name:"participant_tracks",kind:"message",T:V5,repeated:!0}]),Z5=Ce.makeMessageType("livekit.UpdateTrackSettings",()=>[{no:1,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:3,name:"disabled",kind:"scalar",T:8},{no:4,name:"quality",kind:"enum",T:Ce.getEnumType(NP)},{no:5,name:"width",kind:"scalar",T:13},{no:6,name:"height",kind:"scalar",T:13},{no:7,name:"fps",kind:"scalar",T:13},{no:8,name:"priority",kind:"scalar",T:13}]),UP=Ce.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:Ce.getEnumType(da),repeated:!0}]),eq=Ce.makeMessageType("livekit.UpdateLocalVideoTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"width",kind:"scalar",T:13},{no:3,name:"height",kind:"scalar",T:13}]),f0=Ce.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:Ce.getEnumType(Gs)},{no:3,name:"action",kind:"enum",T:Ce.getEnumType(Ff)},{no:4,name:"regions",kind:"message",T:gle}]),Ff=Ce.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),tq=Ce.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:$l,repeated:!0}]),FP=Ce.makeMessageType("livekit.UpdateParticipantMetadata",()=>[{no:1,name:"metadata",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:4,name:"request_id",kind:"scalar",T:13}]),rq=Ce.makeMessageType("livekit.ICEServer",()=>[{no:1,name:"urls",kind:"scalar",T:9,repeated:!0},{no:2,name:"username",kind:"scalar",T:9},{no:3,name:"credential",kind:"scalar",T:9}]),ale=Ce.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:q5,repeated:!0}]),ile=Ce.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:c0}]),sle=Ce.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:Ce.getEnumType(Xh)},{no:3,name:"score",kind:"scalar",T:2}]),ole=Ce.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:sle,repeated:!0}]),cle=Ce.makeMessageType("livekit.StreamStateInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"state",kind:"enum",T:Ce.getEnumType(aC)}]),lle=Ce.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:cle,repeated:!0}]),qP=Ce.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:Ce.getEnumType(NP)},{no:2,name:"enabled",kind:"scalar",T:8}]),ule=Ce.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:qP,repeated:!0}]),dle=Ce.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:qP,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:ule,repeated:!0}]),fle=Ce.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:Jce,repeated:!0}]),nq=Ce.makeMessageType("livekit.TrackPermission",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"all_tracks",kind:"scalar",T:8},{no:3,name:"track_sids",kind:"scalar",T:9,repeated:!0},{no:4,name:"participant_identity",kind:"scalar",T:9}]),aq=Ce.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:nq,repeated:!0}]),ple=Ce.makeMessageType("livekit.SubscriptionPermissionUpdate",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sid",kind:"scalar",T:9},{no:3,name:"allowed",kind:"scalar",T:8}]),hle=Ce.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:c0},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:dd},{no:4,name:"other_participants",kind:"message",T:dd,repeated:!0}]),zP=Ce.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:ru},{no:2,name:"subscription",kind:"message",T:d0},{no:3,name:"publish_tracks",kind:"message",T:BP,repeated:!0},{no:4,name:"data_channels",kind:"message",T:sq,repeated:!0},{no:5,name:"offer",kind:"message",T:ru},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:iq,repeated:!0}]),iq=Ce.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),sq=Ce.makeMessageType("livekit.DataChannelInfo",()=>[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"id",kind:"scalar",T:13},{no:3,name:"target",kind:"enum",T:Ce.getEnumType($s)}]),Po=Ce.makeMessageType("livekit.SimulateScenario",()=>[{no:1,name:"speaker_update",kind:"scalar",T:5,oneof:"scenario"},{no:2,name:"node_failure",kind:"scalar",T:8,oneof:"scenario"},{no:3,name:"migration",kind:"scalar",T:8,oneof:"scenario"},{no:4,name:"server_leave",kind:"scalar",T:8,oneof:"scenario"},{no:5,name:"switch_candidate_protocol",kind:"enum",T:Ce.getEnumType(Qce),oneof:"scenario"},{no:6,name:"subscriber_bandwidth",kind:"scalar",T:3,oneof:"scenario"},{no:7,name:"disconnect_signal_on_resume",kind:"scalar",T:8,oneof:"scenario"},{no:8,name:"disconnect_signal_on_resume_no_messages",kind:"scalar",T:8,oneof:"scenario"},{no:9,name:"leave_request_full_reconnect",kind:"scalar",T:8,oneof:"scenario"}]),oq=Ce.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),mle=Ce.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),gle=Ce.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:yle,repeated:!0}]),yle=Ce.makeMessageType("livekit.RegionInfo",()=>[{no:1,name:"region",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"distance",kind:"scalar",T:3}]),vle=Ce.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:Ce.getEnumType($ce)}]),_le=Ce.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:Ce.getEnumType($P)},{no:3,name:"message",kind:"scalar",T:9},{no:4,name:"trickle",kind:"message",T:l0,oneof:"request"},{no:5,name:"add_track",kind:"message",T:Vm,oneof:"request"},{no:6,name:"mute",kind:"message",T:u0,oneof:"request"},{no:7,name:"update_metadata",kind:"message",T:FP,oneof:"request"},{no:8,name:"update_audio_track",kind:"message",T:UP,oneof:"request"},{no:9,name:"update_video_track",kind:"message",T:eq,oneof:"request"}]),$P=Ce.makeEnum("livekit.RequestResponse.Reason",[{no:0,name:"OK"},{no:1,name:"NOT_FOUND"},{no:2,name:"NOT_ALLOWED"},{no:3,name:"LIMIT_EXCEEDED"},{no:4,name:"QUEUED"},{no:5,name:"UNSUPPORTED_TYPE"},{no:6,name:"UNCLASSIFIED_ERROR"}]),ble=Ce.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),cq=Ce.makeMessageType("livekit.ConnectionSettings",()=>[{no:1,name:"auto_subscribe",kind:"scalar",T:8},{no:2,name:"adaptive_stream",kind:"scalar",T:8},{no:3,name:"subscriber_allow_pause",kind:"scalar",T:8,opt:!0},{no:4,name:"disable_ice_lite",kind:"scalar",T:8}]),kle=Ce.makeMessageType("livekit.JoinRequest",()=>[{no:1,name:"client_info",kind:"message",T:W5},{no:2,name:"connection_settings",kind:"message",T:cq},{no:3,name:"metadata",kind:"scalar",T:9},{no:4,name:"participant_attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:5,name:"add_track_requests",kind:"message",T:Vm,repeated:!0},{no:6,name:"publisher_offer",kind:"message",T:ru},{no:7,name:"reconnect",kind:"scalar",T:8},{no:8,name:"reconnect_reason",kind:"enum",T:Ce.getEnumType(qu)},{no:9,name:"participant_sid",kind:"scalar",T:9},{no:10,name:"sync_state",kind:"message",T:zP}]),wle=Ce.makeMessageType("livekit.WrappedJoinRequest",()=>[{no:1,name:"compression",kind:"enum",T:Ce.getEnumType(Sle)},{no:2,name:"join_request",kind:"scalar",T:12}]),Sle=Ce.makeEnum("livekit.WrappedJoinRequest.Compression",[{no:0,name:"NONE"},{no:1,name:"GZIP"}]),Ele=Ce.makeMessageType("livekit.MediaSectionsRequirement",()=>[{no:1,name:"num_audios",kind:"scalar",T:13},{no:2,name:"num_videos",kind:"scalar",T:13}]);function Tle(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var c_={exports:{}},Cle=c_.exports,oM;function xle(){return oM||(oM=1,(function(t){(function(e,r){t.exports?t.exports=r():e.log=r()})(Cle,function(){var e=function(){},r="undefined",n=typeof window!==r&&typeof window.navigator!==r&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"],i={},o=null;function c(b,E){var T=b[E];if(typeof T.bind=="function")return T.bind(b);try{return Function.prototype.bind.call(T,b)}catch{return function(){return Function.prototype.apply.apply(T,[b,arguments])}}}function u(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function d(b){return b==="debug"&&(b="log"),typeof console===r?!1:b==="trace"&&n?u:console[b]!==void 0?c(console,b):console.log!==void 0?c(console,"log"):e}function f(){for(var b=this.getLevel(),E=0;E<a.length;E++){var T=a[E];this[T]=E<b?e:this.methodFactory(T,b,this.name)}if(this.log=this.debug,typeof console===r&&b<this.levels.SILENT)return"No console available for logging"}function h(b){return function(){typeof console!==r&&(f.call(this),this[b].apply(this,arguments))}}function m(b,E,T){return d(b)||h.apply(this,arguments)}function _(b,E){var T=this,R,P,A,C="loglevel";typeof b=="string"?C+=":"+b:typeof b=="symbol"&&(C=void 0);function O(L){var j=(a[L]||"silent").toUpperCase();if(!(typeof window===r||!C)){try{window.localStorage[C]=j;return}catch{}try{window.document.cookie=encodeURIComponent(C)+"="+j+";"}catch{}}}function I(){var L;if(!(typeof window===r||!C)){try{L=window.localStorage[C]}catch{}if(typeof L===r)try{var j=window.document.cookie,q=encodeURIComponent(C),U=j.indexOf(q+"=");U!==-1&&(L=/^([^;]+)/.exec(j.slice(U+q.length+1))[1])}catch{}return T.levels[L]===void 0&&(L=void 0),L}}function x(){if(!(typeof window===r||!C)){try{window.localStorage.removeItem(C)}catch{}try{window.document.cookie=encodeURIComponent(C)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function D(L){var j=L;if(typeof j=="string"&&T.levels[j.toUpperCase()]!==void 0&&(j=T.levels[j.toUpperCase()]),typeof j=="number"&&j>=0&&j<=T.levels.SILENT)return j;throw new TypeError("log.setLevel() called with invalid level: "+L)}T.name=b,T.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},T.methodFactory=E||m,T.getLevel=function(){return A??P??R},T.setLevel=function(L,j){return A=D(L),j!==!1&&O(A),f.call(T)},T.setDefaultLevel=function(L){P=D(L),I()||T.setLevel(L,!1)},T.resetLevel=function(){A=null,x(),f.call(T)},T.enableAll=function(L){T.setLevel(T.levels.TRACE,L)},T.disableAll=function(L){T.setLevel(T.levels.SILENT,L)},T.rebuild=function(){if(o!==T&&(R=D(o.getLevel())),f.call(T),o===T)for(var L in i)i[L].rebuild()},R=D(o?o.getLevel():"WARN");var N=I();N!=null&&(A=D(N)),f.call(T)}o=new _,o.getLogger=function(E){if(typeof E!="symbol"&&typeof E!="string"||E==="")throw new TypeError("You must supply a name when creating a logger.");var T=i[E];return T||(T=i[E]=new _(E,o.methodFactory)),T};var w=typeof window!==r?window.log:void 0;return o.noConflict=function(){return typeof window!==r&&window.log===o&&(window.log=w),o},o.getLoggers=function(){return i},o.default=o,o})})(c_)),c_.exports}var p0=xle(),sC;(function(t){t[t.trace=0]="trace",t[t.debug=1]="debug",t[t.info=2]="info",t[t.warn=3]="warn",t[t.error=4]="error",t[t.silent=5]="silent"})(sC||(sC={}));var Zs;(function(t){t.Default="livekit",t.Room="livekit-room",t.TokenSource="livekit-token-source",t.Participant="livekit-participant",t.Track="livekit-track",t.Publication="livekit-track-publication",t.Engine="livekit-engine",t.Signal="livekit-signal",t.PCManager="livekit-pc-manager",t.PCTransport="livekit-pc-transport",t.E2EE="lk-e2ee"})(Zs||(Zs={}));let or=p0.getLogger("livekit");Object.values(Zs).map(t=>p0.getLogger(t));or.setDefaultLevel(sC.info);function $c(t){const e=p0.getLogger(t);return e.setDefaultLevel(or.getLevel()),e}const Ple=p0.getLogger("lk-e2ee"),Ph=7e3,Ale=[0,300,4*300,9*300,16*300,Ph,Ph,Ph,Ph,Ph];class Rle{constructor(e){this._retryDelays=e!==void 0?[...e]:Ale}nextRetryDelayInMs(e){if(e.retryCount>=this._retryDelays.length)return null;const r=this._retryDelays[e.retryCount];return e.retryCount<=1?r:r+Math.random()*1e3}}function Dle(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var a=0,n=Object.getOwnPropertySymbols(t);a<n.length;a++)e.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]]);return r}function ne(t,e,r,n){function a(i){return i instanceof r?i:new r(function(o){o(i)})}return new(r||(r=Promise))(function(i,o){function c(f){try{d(n.next(f))}catch(h){o(h)}}function u(f){try{d(n.throw(f))}catch(h){o(h)}}function d(f){f.done?i(f.value):a(f.value).then(c,u)}d((n=n.apply(t,e||[])).next())})}function cM(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Pc(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof cM=="function"?cM(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(c,u){o=t[i](o),a(c,u,o.done,o.value)})}}function a(i,o,c,u){Promise.resolve(u).then(function(d){i({value:d,done:c})},o)}}var _v={exports:{}},lM;function Ole(){if(lM)return _v.exports;lM=1;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(C,O,I){return Function.prototype.apply.call(C,O,I)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(C){return Object.getOwnPropertyNames(C).concat(Object.getOwnPropertySymbols(C))}:r=function(C){return Object.getOwnPropertyNames(C)};function n(A){}var a=Number.isNaN||function(C){return C!==C};function i(){i.init.call(this)}_v.exports=i,_v.exports.once=T,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var o=10;function c(A){if(typeof A!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(A){if(typeof A!="number"||A<0||a(A))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+A+".");o=A}}),i.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(C){if(typeof C!="number"||C<0||a(C))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+C+".");return this._maxListeners=C,this};function u(A){return A._maxListeners===void 0?i.defaultMaxListeners:A._maxListeners}i.prototype.getMaxListeners=function(){return u(this)},i.prototype.emit=function(C){for(var O=[],I=1;I<arguments.length;I++)O.push(arguments[I]);var x=C==="error",D=this._events;if(D!==void 0)x=x&&D.error===void 0;else if(!x)return!1;if(x){var N;if(O.length>0&&(N=O[0]),N instanceof Error)throw N;var L=new Error("Unhandled error."+(N?" ("+N.message+")":""));throw L.context=N,L}var j=D[C];if(j===void 0)return!1;if(typeof j=="function")e(j,this,O);else for(var q=j.length,U=w(j,q),I=0;I<q;++I)e(U[I],this,O);return!0};function d(A,C,O,I){var x,D,N;if(c(O),D=A._events,D===void 0?(D=A._events=Object.create(null),A._eventsCount=0):(D.newListener!==void 0&&(A.emit("newListener",C,O.listener?O.listener:O),D=A._events),N=D[C]),N===void 0)N=D[C]=O,++A._eventsCount;else if(typeof N=="function"?N=D[C]=I?[O,N]:[N,O]:I?N.unshift(O):N.push(O),x=u(A),x>0&&N.length>x&&!N.warned){N.warned=!0;var L=new Error("Possible EventEmitter memory leak detected. "+N.length+" "+String(C)+" listeners added. Use emitter.setMaxListeners() to increase limit");L.name="MaxListenersExceededWarning",L.emitter=A,L.type=C,L.count=N.length}return A}i.prototype.addListener=function(C,O){return d(this,C,O,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(C,O){return d(this,C,O,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(A,C,O){var I={fired:!1,wrapFn:void 0,target:A,type:C,listener:O},x=f.bind(I);return x.listener=O,I.wrapFn=x,x}i.prototype.once=function(C,O){return c(O),this.on(C,h(this,C,O)),this},i.prototype.prependOnceListener=function(C,O){return c(O),this.prependListener(C,h(this,C,O)),this},i.prototype.removeListener=function(C,O){var I,x,D,N,L;if(c(O),x=this._events,x===void 0)return this;if(I=x[C],I===void 0)return this;if(I===O||I.listener===O)--this._eventsCount===0?this._events=Object.create(null):(delete x[C],x.removeListener&&this.emit("removeListener",C,I.listener||O));else if(typeof I!="function"){for(D=-1,N=I.length-1;N>=0;N--)if(I[N]===O||I[N].listener===O){L=I[N].listener,D=N;break}if(D<0)return this;D===0?I.shift():b(I,D),I.length===1&&(x[C]=I[0]),x.removeListener!==void 0&&this.emit("removeListener",C,L||O)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(C){var O,I,x;if(I=this._events,I===void 0)return this;if(I.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):I[C]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete I[C]),this;if(arguments.length===0){var D=Object.keys(I),N;for(x=0;x<D.length;++x)N=D[x],N!=="removeListener"&&this.removeAllListeners(N);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(O=I[C],typeof O=="function")this.removeListener(C,O);else if(O!==void 0)for(x=O.length-1;x>=0;x--)this.removeListener(C,O[x]);return this};function m(A,C,O){var I=A._events;if(I===void 0)return[];var x=I[C];return x===void 0?[]:typeof x=="function"?O?[x.listener||x]:[x]:O?E(x):w(x,x.length)}i.prototype.listeners=function(C){return m(this,C,!0)},i.prototype.rawListeners=function(C){return m(this,C,!1)},i.listenerCount=function(A,C){return typeof A.listenerCount=="function"?A.listenerCount(C):_.call(A,C)},i.prototype.listenerCount=_;function _(A){var C=this._events;if(C!==void 0){var O=C[A];if(typeof O=="function")return 1;if(O!==void 0)return O.length}return 0}i.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function w(A,C){for(var O=new Array(C),I=0;I<C;++I)O[I]=A[I];return O}function b(A,C){for(;C+1<A.length;C++)A[C]=A[C+1];A.pop()}function E(A){for(var C=new Array(A.length),O=0;O<C.length;++O)C[O]=A[O].listener||A[O];return C}function T(A,C){return new Promise(function(O,I){function x(N){A.removeListener(C,D),I(N)}function D(){typeof A.removeListener=="function"&&A.removeListener("error",x),O([].slice.call(arguments))}P(A,C,D,{once:!0}),C!=="error"&&R(A,x,{once:!0})})}function R(A,C,O){typeof A.on=="function"&&P(A,"error",C,O)}function P(A,C,O,I){if(typeof A.on=="function")I.once?A.once(C,O):A.on(C,O);else if(typeof A.addEventListener=="function")A.addEventListener(C,function x(D){I.once&&A.removeEventListener(C,x),O(D)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof A)}return _v.exports}var Qo=Ole();let lq=!0,Nle=!0;function Jh(t,e,r){const n=t.match(e);return n&&n.length>=r&&parseFloat(n[r],10)}function vd(t,e,r){if(!t.RTCPeerConnection)return;const n=t.RTCPeerConnection.prototype,a=n.addEventListener;n.addEventListener=function(o,c){if(o!==e)return a.apply(this,arguments);const u=d=>{const f=r(d);f&&(c.handleEvent?c.handleEvent(f):c(f))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(c,u),a.apply(this,[o,u])};const i=n.removeEventListener;n.removeEventListener=function(o,c){if(o!==e||!this._eventMap||!this._eventMap[e])return i.apply(this,arguments);if(!this._eventMap[e].has(c))return i.apply(this,arguments);const u=this._eventMap[e].get(c);return this._eventMap[e].delete(c),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,i.apply(this,[o,u])},Object.defineProperty(n,"on"+e,{get(){return this["_on"+e]},set(o){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),o&&this.addEventListener(e,this["_on"+e]=o)},enumerable:!0,configurable:!0})}function Ile(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(lq=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function Mle(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(Nle=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function uq(){}function jle(t){const e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;const{navigator:r}=t;if(r.userAgentData&&r.userAgentData.brands){const n=r.userAgentData.brands.find(a=>a.brand==="Chromium");if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(r.mozGetUserMedia)e.browser="firefox",e.version=parseInt(Jh(r.userAgent,/Firefox\/(\d+)\./,1));else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=parseInt(Jh(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=parseInt(Jh(r.userAgent,/AppleWebKit\/(\d+)\./,1)),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype,e._safariVersion=Jh(r.userAgent,/Version\/(\d+(\.?\d+))/,1);else return e.browser="Not a supported browser.",e;return e}function uM(t){return Object.prototype.toString.call(t)==="[object Object]"}function dq(t){return uM(t)?Object.keys(t).reduce(function(e,r){const n=uM(t[r]),a=n?dq(t[r]):t[r],i=n&&!Object.keys(a).length;return a===void 0||i?e:Object.assign(e,{[r]:a})},{}):t}function oC(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(n=>{n.endsWith("Id")?oC(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(a=>{oC(t,t.get(a),r)})}))}function dM(t,e,r){const n=r?"outbound-rtp":"inbound-rtp",a=new Map;if(e===null)return a;const i=[];return t.forEach(o=>{o.type==="track"&&o.trackIdentifier===e.id&&i.push(o)}),i.forEach(o=>{t.forEach(c=>{c.type===n&&c.trackId===o.id&&oC(t,c,a)})}),a}const fM=uq;function fq(t,e){const r=t&&t.navigator;if(!r.mediaDevices)return;const n=function(c){if(typeof c!="object"||c.mandatory||c.optional)return c;const u={};return Object.keys(c).forEach(d=>{if(d==="require"||d==="advanced"||d==="mediaSource")return;const f=typeof c[d]=="object"?c[d]:{ideal:c[d]};f.exact!==void 0&&typeof f.exact=="number"&&(f.min=f.max=f.exact);const h=function(m,_){return m?m+_.charAt(0).toUpperCase()+_.slice(1):_==="deviceId"?"sourceId":_};if(f.ideal!==void 0){u.optional=u.optional||[];let m={};typeof f.ideal=="number"?(m[h("min",d)]=f.ideal,u.optional.push(m),m={},m[h("max",d)]=f.ideal,u.optional.push(m)):(m[h("",d)]=f.ideal,u.optional.push(m))}f.exact!==void 0&&typeof f.exact!="number"?(u.mandatory=u.mandatory||{},u.mandatory[h("",d)]=f.exact):["min","max"].forEach(m=>{f[m]!==void 0&&(u.mandatory=u.mandatory||{},u.mandatory[h(m,d)]=f[m])})}),c.advanced&&(u.optional=(u.optional||[]).concat(c.advanced)),u},a=function(c,u){if(e.version>=61)return u(c);if(c=JSON.parse(JSON.stringify(c)),c&&typeof c.audio=="object"){const d=function(f,h,m){h in f&&!(m in f)&&(f[m]=f[h],delete f[h])};c=JSON.parse(JSON.stringify(c)),d(c.audio,"autoGainControl","googAutoGainControl"),d(c.audio,"noiseSuppression","googNoiseSuppression"),c.audio=n(c.audio)}if(c&&typeof c.video=="object"){let d=c.video.facingMode;d=d&&(typeof d=="object"?d:{ideal:d});const f=e.version<66;if(d&&(d.exact==="user"||d.exact==="environment"||d.ideal==="user"||d.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!f)){delete c.video.facingMode;let h;if(d.exact==="environment"||d.ideal==="environment"?h=["back","rear"]:(d.exact==="user"||d.ideal==="user")&&(h=["front"]),h)return r.mediaDevices.enumerateDevices().then(m=>{m=m.filter(w=>w.kind==="videoinput");let _=m.find(w=>h.some(b=>w.label.toLowerCase().includes(b)));return!_&&m.length&&h.includes("back")&&(_=m[m.length-1]),_&&(c.video.deviceId=d.exact?{exact:_.deviceId}:{ideal:_.deviceId}),c.video=n(c.video),fM("chrome: "+JSON.stringify(c)),u(c)})}c.video=n(c.video)}return fM("chrome: "+JSON.stringify(c)),u(c)},i=function(c){return e.version>=64?c:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[c.name]||c.name,message:c.message,constraint:c.constraint||c.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},o=function(c,u,d){a(c,f=>{r.webkitGetUserMedia(f,u,h=>{d&&d(i(h))})})};if(r.getUserMedia=o.bind(r),r.mediaDevices.getUserMedia){const c=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(u){return a(u,d=>c(d).then(f=>{if(d.audio&&!f.getAudioTracks().length||d.video&&!f.getVideoTracks().length)throw f.getTracks().forEach(h=>{h.stop()}),new DOMException("","NotFoundError");return f},f=>Promise.reject(i(f))))}}}function pq(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function hq(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(r){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=r)},enumerable:!0,configurable:!0});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=n=>{n.stream.addEventListener("addtrack",a=>{let i;t.RTCPeerConnection.prototype.getReceivers?i=this.getReceivers().find(c=>c.track&&c.track.id===a.track.id):i={track:a.track};const o=new Event("track");o.track=a.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[n.stream],this.dispatchEvent(o)}),n.stream.getTracks().forEach(a=>{let i;t.RTCPeerConnection.prototype.getReceivers?i=this.getReceivers().find(c=>c.track&&c.track.id===a.id):i={track:a};const o=new Event("track");o.track=a,o.receiver=i,o.transceiver={receiver:i},o.streams=[n.stream],this.dispatchEvent(o)})},this.addEventListener("addstream",this._ontrackpoly)),e.apply(this,arguments)}}else vd(t,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function mq(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const e=function(a,i){return{track:i,get dtmf(){return this._dtmf===void 0&&(i.kind==="audio"?this._dtmf=a.createDTMFSender(i):this._dtmf=null),this._dtmf},_pc:a}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const a=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(c,u){let d=a.apply(this,arguments);return d||(d=e(this,c),this._senders.push(d)),d};const i=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(c){i.apply(this,arguments);const u=this._senders.indexOf(c);u!==-1&&this._senders.splice(u,1)}}const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(i){this._senders=this._senders||[],r.apply(this,[i]),i.getTracks().forEach(o=>{this._senders.push(e(this,o))})};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(i){this._senders=this._senders||[],n.apply(this,[i]),i.getTracks().forEach(o=>{const c=this._senders.find(u=>u.track===o);c&&this._senders.splice(this._senders.indexOf(c),1)})}}else if(typeof t=="object"&&t.RTCPeerConnection&&"getSenders"in t.RTCPeerConnection.prototype&&"createDTMFSender"in t.RTCPeerConnection.prototype&&t.RTCRtpSender&&!("dtmf"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const n=e.apply(this,[]);return n.forEach(a=>a._pc=this),n},Object.defineProperty(t.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function gq(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const r=t.RTCPeerConnection.prototype.getSenders;r&&(t.RTCPeerConnection.prototype.getSenders=function(){const i=r.apply(this,[]);return i.forEach(o=>o._pc=this),i});const n=t.RTCPeerConnection.prototype.addTrack;n&&(t.RTCPeerConnection.prototype.addTrack=function(){const i=n.apply(this,arguments);return i._pc=this,i}),t.RTCRtpSender.prototype.getStats=function(){const i=this;return this._pc.getStats().then(o=>dM(o,i.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const r=t.RTCPeerConnection.prototype.getReceivers;r&&(t.RTCPeerConnection.prototype.getReceivers=function(){const a=r.apply(this,[]);return a.forEach(i=>i._pc=this),a}),vd(t,"track",n=>(n.receiver._pc=n.srcElement,n)),t.RTCRtpReceiver.prototype.getStats=function(){const a=this;return this._pc.getStats().then(i=>dM(i,a.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const e=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const n=arguments[0];let a,i,o;return this.getSenders().forEach(c=>{c.track===n&&(a?o=!0:a=c)}),this.getReceivers().forEach(c=>(c.track===n&&(i?o=!0:i=c),c.track===n)),o||a&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):a?a.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return e.apply(this,arguments)}}function yq(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(o=>this._shimmedLocalStreams[o][0])};const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(o,c){if(!c)return e.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const u=e.apply(this,arguments);return this._shimmedLocalStreams[c.id]?this._shimmedLocalStreams[c.id].indexOf(u)===-1&&this._shimmedLocalStreams[c.id].push(u):this._shimmedLocalStreams[c.id]=[c,u],u};const r=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(o){this._shimmedLocalStreams=this._shimmedLocalStreams||{},o.getTracks().forEach(d=>{if(this.getSenders().find(h=>h.track===d))throw new DOMException("Track already exists.","InvalidAccessError")});const c=this.getSenders();r.apply(this,arguments);const u=this.getSenders().filter(d=>c.indexOf(d)===-1);this._shimmedLocalStreams[o.id]=[o].concat(u)};const n=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[o.id],n.apply(this,arguments)};const a=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(o){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},o&&Object.keys(this._shimmedLocalStreams).forEach(c=>{const u=this._shimmedLocalStreams[c].indexOf(o);u!==-1&&this._shimmedLocalStreams[c].splice(u,1),this._shimmedLocalStreams[c].length===1&&delete this._shimmedLocalStreams[c]}),a.apply(this,arguments)}}function vq(t,e){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&e.version>=65)return yq(t);const r=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const f=r.apply(this);return this._reverseStreams=this._reverseStreams||{},f.map(h=>this._reverseStreams[h.id])};const n=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(f){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},f.getTracks().forEach(h=>{if(this.getSenders().find(_=>_.track===h))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[f.id]){const h=new t.MediaStream(f.getTracks());this._streams[f.id]=h,this._reverseStreams[h.id]=f,f=h}n.apply(this,[f])};const a=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(f){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},a.apply(this,[this._streams[f.id]||f]),delete this._reverseStreams[this._streams[f.id]?this._streams[f.id].id:f.id],delete this._streams[f.id]},t.RTCPeerConnection.prototype.addTrack=function(f,h){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const m=[].slice.call(arguments,1);if(m.length!==1||!m[0].getTracks().find(b=>b===f))throw new DOMException("The adapter.js addTrack polyfill only supports a single  stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find(b=>b.track===f))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const w=this._streams[h.id];if(w)w.addTrack(f),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const b=new t.MediaStream([f]);this._streams[h.id]=b,this._reverseStreams[b.id]=h,this.addStream(b)}return this.getSenders().find(b=>b.track===f)};function i(d,f){let h=f.sdp;return Object.keys(d._reverseStreams||[]).forEach(m=>{const _=d._reverseStreams[m],w=d._streams[_.id];h=h.replace(new RegExp(w.id,"g"),_.id)}),new RTCSessionDescription({type:f.type,sdp:h})}function o(d,f){let h=f.sdp;return Object.keys(d._reverseStreams||[]).forEach(m=>{const _=d._reverseStreams[m],w=d._streams[_.id];h=h.replace(new RegExp(_.id,"g"),w.id)}),new RTCSessionDescription({type:f.type,sdp:h})}["createOffer","createAnswer"].forEach(function(d){const f=t.RTCPeerConnection.prototype[d],h={[d](){const m=arguments;return arguments.length&&typeof arguments[0]=="function"?f.apply(this,[w=>{const b=i(this,w);m[0].apply(null,[b])},w=>{m[1]&&m[1].apply(null,w)},arguments[2]]):f.apply(this,arguments).then(w=>i(this,w))}};t.RTCPeerConnection.prototype[d]=h[d]});const c=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?c.apply(this,arguments):(arguments[0]=o(this,arguments[0]),c.apply(this,arguments))};const u=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const d=u.get.apply(this);return d.type===""?d:i(this,d)}}),t.RTCPeerConnection.prototype.removeTrack=function(f){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!f._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(f._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let m;Object.keys(this._streams).forEach(_=>{this._streams[_].getTracks().find(b=>f.track===b)&&(m=this._streams[_])}),m&&(m.getTracks().length===1?this.removeStream(this._reverseStreams[m.id]):m.removeTrack(f.track),this.dispatchEvent(new Event("negotiationneeded")))}}function cC(t,e){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(r){const n=t.RTCPeerConnection.prototype[r],a={[r](){return arguments[0]=new(r==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),n.apply(this,arguments)}};t.RTCPeerConnection.prototype[r]=a[r]})}function _q(t,e){vd(t,"negotiationneeded",r=>{const n=r.target;if(!((e.version<72||n.getConfiguration&&n.getConfiguration().sdpSemantics==="plan-b")&&n.signalingState!=="stable"))return r})}var pM=Object.freeze({__proto__:null,fixNegotiationNeeded:_q,shimAddTrackRemoveTrack:vq,shimAddTrackRemoveTrackWithNative:yq,shimGetSendersWithDtmf:mq,shimGetUserMedia:fq,shimMediaStream:pq,shimOnTrack:hq,shimPeerConnection:cC,shimSenderReceiverGetStats:gq});function bq(t,e){const r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(a,i,o){r.mediaDevices.getUserMedia(a).then(i,o)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const a=function(o,c,u){c in o&&!(u in o)&&(o[u]=o[c],delete o[c])},i=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(o){return typeof o=="object"&&typeof o.audio=="object"&&(o=JSON.parse(JSON.stringify(o)),a(o.audio,"autoGainControl","mozAutoGainControl"),a(o.audio,"noiseSuppression","mozNoiseSuppression")),i(o)},n&&n.prototype.getSettings){const o=n.prototype.getSettings;n.prototype.getSettings=function(){const c=o.apply(this,arguments);return a(c,"mozAutoGainControl","autoGainControl"),a(c,"mozNoiseSuppression","noiseSuppression"),c}}if(n&&n.prototype.applyConstraints){const o=n.prototype.applyConstraints;n.prototype.applyConstraints=function(c){return this.kind==="audio"&&typeof c=="object"&&(c=JSON.parse(JSON.stringify(c)),a(c,"autoGainControl","mozAutoGainControl"),a(c,"noiseSuppression","mozNoiseSuppression")),o.apply(this,[c])}}}}function Lle(t,e){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(n){if(!(n&&n.video)){const a=new DOMException("getDisplayMedia without video constraints is undefined");return a.name="NotFoundError",a.code=8,Promise.reject(a)}return n.video===!0?n.video={mediaSource:e}:n.video.mediaSource=e,t.navigator.mediaDevices.getUserMedia(n)})}function kq(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function lC(t,e){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),e.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(a){const i=t.RTCPeerConnection.prototype[a],o={[a](){return arguments[0]=new(a==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};t.RTCPeerConnection.prototype[a]=o[a]});const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[i,o,c]=arguments;return n.apply(this,[i||null]).then(u=>{if(e.version<53&&!o)try{u.forEach(d=>{d.type=r[d.type]||d.type})}catch(d){if(d.name!=="TypeError")throw d;u.forEach((f,h)=>{u.set(h,Object.assign({},f,{type:r[f.type]||f.type}))})}return u}).then(o,c)}}function wq(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const a=e.apply(this,[]);return a.forEach(i=>i._pc=this),a});const r=t.RTCPeerConnection.prototype.addTrack;r&&(t.RTCPeerConnection.prototype.addTrack=function(){const a=r.apply(this,arguments);return a._pc=this,a}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function Sq(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const n=e.apply(this,[]);return n.forEach(a=>a._pc=this),n}),vd(t,"track",r=>(r.receiver._pc=r.srcElement,r)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function Eq(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(r){this.getSenders().forEach(n=>{n.track&&r.getTracks().includes(n.track)&&this.removeTrack(n)})})}function Tq(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function Cq(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.addTransceiver;e&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let n=arguments[1]&&arguments[1].sendEncodings;n===void 0&&(n=[]),n=[...n];const a=n.length>0;a&&n.forEach(o=>{if("rid"in o&&!/^[a-z0-9]{0,16}$/i.test(o.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in o&&!(parseFloat(o.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in o&&!(parseFloat(o.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const i=e.apply(this,arguments);if(a){const{sender:o}=i,c=o.getParameters();(!("encodings"in c)||c.encodings.length===1&&Object.keys(c.encodings[0]).length===0)&&(c.encodings=n,o.sendEncodings=n,this.setParametersPromises.push(o.setParameters(c).then(()=>{delete o.sendEncodings}).catch(()=>{delete o.sendEncodings})))}return i})}function xq(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const e=t.RTCRtpSender.prototype.getParameters;e&&(t.RTCRtpSender.prototype.getParameters=function(){const n=e.apply(this,arguments);return"encodings"in n||(n.encodings=[].concat(this.sendEncodings||[{}])),n})}function Pq(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}function Aq(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const e=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>e.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):e.apply(this,arguments)}}var hM=Object.freeze({__proto__:null,shimAddTransceiver:Cq,shimCreateAnswer:Aq,shimCreateOffer:Pq,shimGetDisplayMedia:Lle,shimGetParameters:xq,shimGetUserMedia:bq,shimOnTrack:kq,shimPeerConnection:lC,shimRTCDataChannel:Tq,shimReceiverGetStats:Sq,shimRemoveStream:Eq,shimSenderGetStats:wq});function Rq(t){if(!(typeof t!="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){const e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(a=>e.call(this,a,n)),n.getVideoTracks().forEach(a=>e.call(this,a,n))},t.RTCPeerConnection.prototype.addTrack=function(n){for(var a=arguments.length,i=new Array(a>1?a-1:0),o=1;o<a;o++)i[o-1]=arguments[o];return i&&i.forEach(c=>{this._localStreams?this._localStreams.includes(c)||this._localStreams.push(c):this._localStreams=[c]}),e.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(r){this._localStreams||(this._localStreams=[]);const n=this._localStreams.indexOf(r);if(n===-1)return;this._localStreams.splice(n,1);const a=r.getTracks();this.getSenders().forEach(i=>{a.includes(i.track)&&this.removeTrack(i)})})}}function Dq(t){if(!(typeof t!="object"||!t.RTCPeerConnection)&&("getRemoteStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in t.RTCPeerConnection.prototype))){Object.defineProperty(t.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(r){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=r),this.addEventListener("track",this._onaddstreampoly=n=>{n.streams.forEach(a=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(a))return;this._remoteStreams.push(a);const i=new Event("addstream");i.stream=a,this.dispatchEvent(i)})})}});const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const n=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(a){a.streams.forEach(i=>{if(n._remoteStreams||(n._remoteStreams=[]),n._remoteStreams.indexOf(i)>=0)return;n._remoteStreams.push(i);const o=new Event("addstream");o.stream=i,n.dispatchEvent(o)})}),e.apply(n,arguments)}}}function Oq(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,a=e.setLocalDescription,i=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(d,f){const h=arguments.length>=2?arguments[2]:arguments[0],m=r.apply(this,[h]);return f?(m.then(d,f),Promise.resolve()):m},e.createAnswer=function(d,f){const h=arguments.length>=2?arguments[2]:arguments[0],m=n.apply(this,[h]);return f?(m.then(d,f),Promise.resolve()):m};let c=function(u,d,f){const h=a.apply(this,[u]);return f?(h.then(d,f),Promise.resolve()):h};e.setLocalDescription=c,c=function(u,d,f){const h=i.apply(this,[u]);return f?(h.then(d,f),Promise.resolve()):h},e.setRemoteDescription=c,c=function(u,d,f){const h=o.apply(this,[u]);return f?(h.then(d,f),Promise.resolve()):h},e.addIceCandidate=c}function Nq(t){const e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){const r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=a=>n(Iq(a))}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(n,a,i){e.mediaDevices.getUserMedia(n).then(a,i)}).bind(e))}function Iq(t){return t&&t.video!==void 0?Object.assign({},t,{video:dq(t.video)}):t}function Mq(t){if(!t.RTCPeerConnection)return;const e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,a){if(n&&n.iceServers){const i=[];for(let o=0;o<n.iceServers.length;o++){let c=n.iceServers[o];c.urls===void 0&&c.url?(c=JSON.parse(JSON.stringify(c)),c.urls=c.url,delete c.url,i.push(c)):i.push(n.iceServers[o])}n.iceServers=i}return new e(n,a)},t.RTCPeerConnection.prototype=e.prototype,"generateCertificate"in e&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return e.generateCertificate}})}function jq(t){typeof t=="object"&&t.RTCTrackEvent&&"receiver"in t.RTCTrackEvent.prototype&&!("transceiver"in t.RTCTrackEvent.prototype)&&Object.defineProperty(t.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Lq(t){const e=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(n){if(n){typeof n.offerToReceiveAudio<"u"&&(n.offerToReceiveAudio=!!n.offerToReceiveAudio);const a=this.getTransceivers().find(o=>o.receiver.track.kind==="audio");n.offerToReceiveAudio===!1&&a?a.direction==="sendrecv"?a.setDirection?a.setDirection("sendonly"):a.direction="sendonly":a.direction==="recvonly"&&(a.setDirection?a.setDirection("inactive"):a.direction="inactive"):n.offerToReceiveAudio===!0&&!a&&this.addTransceiver("audio",{direction:"recvonly"}),typeof n.offerToReceiveVideo<"u"&&(n.offerToReceiveVideo=!!n.offerToReceiveVideo);const i=this.getTransceivers().find(o=>o.receiver.track.kind==="video");n.offerToReceiveVideo===!1&&i?i.direction==="sendrecv"?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":i.direction==="recvonly"&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):n.offerToReceiveVideo===!0&&!i&&this.addTransceiver("video",{direction:"recvonly"})}return e.apply(this,arguments)}}function Bq(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var mM=Object.freeze({__proto__:null,shimAudioContext:Bq,shimCallbacksAPI:Oq,shimConstraints:Iq,shimCreateOfferLegacy:Lq,shimGetUserMedia:Nq,shimLocalStreamsAPI:Rq,shimRTCIceServerUrls:Mq,shimRemoteStreamsAPI:Dq,shimTrackEventTransceiver:jq}),rE={exports:{}},gM;function Ble(){return gM||(gM=1,(function(t){const e={};e.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},e.localCName=e.generateIdentifier(),e.splitLines=function(r){return r.trim().split(`
`).map(n=>n.trim())},e.splitSections=function(r){return r.split(`
m=`).map((a,i)=>(i>0?"m="+a:a).trim()+`\r
`)},e.getDescription=function(r){const n=e.splitSections(r);return n&&n[0]},e.getMediaSections=function(r){const n=e.splitSections(r);return n.shift(),n},e.matchPrefix=function(r,n){return e.splitLines(r).filter(a=>a.indexOf(n)===0)},e.parseCandidate=function(r){let n;r.indexOf("a=candidate:")===0?n=r.substring(12).split(" "):n=r.substring(10).split(" ");const a={foundation:n[0],component:{1:"rtp",2:"rtcp"}[n[1]]||n[1],protocol:n[2].toLowerCase(),priority:parseInt(n[3],10),ip:n[4],address:n[4],port:parseInt(n[5],10),type:n[7]};for(let i=8;i<n.length;i+=2)switch(n[i]){case"raddr":a.relatedAddress=n[i+1];break;case"rport":a.relatedPort=parseInt(n[i+1],10);break;case"tcptype":a.tcpType=n[i+1];break;case"ufrag":a.ufrag=n[i+1],a.usernameFragment=n[i+1];break;default:a[n[i]]===void 0&&(a[n[i]]=n[i+1]);break}return a},e.writeCandidate=function(r){const n=[];n.push(r.foundation);const a=r.component;a==="rtp"?n.push(1):a==="rtcp"?n.push(2):n.push(a),n.push(r.protocol.toUpperCase()),n.push(r.priority),n.push(r.address||r.ip),n.push(r.port);const i=r.type;return n.push("typ"),n.push(i),i!=="host"&&r.relatedAddress&&r.relatedPort&&(n.push("raddr"),n.push(r.relatedAddress),n.push("rport"),n.push(r.relatedPort)),r.tcpType&&r.protocol.toLowerCase()==="tcp"&&(n.push("tcptype"),n.push(r.tcpType)),(r.usernameFragment||r.ufrag)&&(n.push("ufrag"),n.push(r.usernameFragment||r.ufrag)),"candidate:"+n.join(" ")},e.parseIceOptions=function(r){return r.substring(14).split(" ")},e.parseRtpMap=function(r){let n=r.substring(9).split(" ");const a={payloadType:parseInt(n.shift(),10)};return n=n[0].split("/"),a.name=n[0],a.clockRate=parseInt(n[1],10),a.channels=n.length===3?parseInt(n[2],10):1,a.numChannels=a.channels,a},e.writeRtpMap=function(r){let n=r.payloadType;r.preferredPayloadType!==void 0&&(n=r.preferredPayloadType);const a=r.channels||r.numChannels||1;return"a=rtpmap:"+n+" "+r.name+"/"+r.clockRate+(a!==1?"/"+a:"")+`\r
`},e.parseExtmap=function(r){const n=r.substring(9).split(" ");return{id:parseInt(n[0],10),direction:n[0].indexOf("/")>0?n[0].split("/")[1]:"sendrecv",uri:n[1],attributes:n.slice(2).join(" ")}},e.writeExtmap=function(r){return"a=extmap:"+(r.id||r.preferredId)+(r.direction&&r.direction!=="sendrecv"?"/"+r.direction:"")+" "+r.uri+(r.attributes?" "+r.attributes:"")+`\r
`},e.parseFmtp=function(r){const n={};let a;const i=r.substring(r.indexOf(" ")+1).split(";");for(let o=0;o<i.length;o++)a=i[o].trim().split("="),n[a[0].trim()]=a[1];return n},e.writeFmtp=function(r){let n="",a=r.payloadType;if(r.preferredPayloadType!==void 0&&(a=r.preferredPayloadType),r.parameters&&Object.keys(r.parameters).length){const i=[];Object.keys(r.parameters).forEach(o=>{r.parameters[o]!==void 0?i.push(o+"="+r.parameters[o]):i.push(o)}),n+="a=fmtp:"+a+" "+i.join(";")+`\r
`}return n},e.parseRtcpFb=function(r){const n=r.substring(r.indexOf(" ")+1).split(" ");return{type:n.shift(),parameter:n.join(" ")}},e.writeRtcpFb=function(r){let n="",a=r.payloadType;return r.preferredPayloadType!==void 0&&(a=r.preferredPayloadType),r.rtcpFeedback&&r.rtcpFeedback.length&&r.rtcpFeedback.forEach(i=>{n+="a=rtcp-fb:"+a+" "+i.type+(i.parameter&&i.parameter.length?" "+i.parameter:"")+`\r
`}),n},e.parseSsrcMedia=function(r){const n=r.indexOf(" "),a={ssrc:parseInt(r.substring(7,n),10)},i=r.indexOf(":",n);return i>-1?(a.attribute=r.substring(n+1,i),a.value=r.substring(i+1)):a.attribute=r.substring(n+1),a},e.parseSsrcGroup=function(r){const n=r.substring(13).split(" ");return{semantics:n.shift(),ssrcs:n.map(a=>parseInt(a,10))}},e.getMid=function(r){const n=e.matchPrefix(r,"a=mid:")[0];if(n)return n.substring(6)},e.parseFingerprint=function(r){const n=r.substring(14).split(" ");return{algorithm:n[0].toLowerCase(),value:n[1].toUpperCase()}},e.getDtlsParameters=function(r,n){return{role:"auto",fingerprints:e.matchPrefix(r+n,"a=fingerprint:").map(e.parseFingerprint)}},e.writeDtlsParameters=function(r,n){let a="a=setup:"+n+`\r
`;return r.fingerprints.forEach(i=>{a+="a=fingerprint:"+i.algorithm+" "+i.value+`\r
`}),a},e.parseCryptoLine=function(r){const n=r.substring(9).split(" ");return{tag:parseInt(n[0],10),cryptoSuite:n[1],keyParams:n[2],sessionParams:n.slice(3)}},e.writeCryptoLine=function(r){return"a=crypto:"+r.tag+" "+r.cryptoSuite+" "+(typeof r.keyParams=="object"?e.writeCryptoKeyParams(r.keyParams):r.keyParams)+(r.sessionParams?" "+r.sessionParams.join(" "):"")+`\r
`},e.parseCryptoKeyParams=function(r){if(r.indexOf("inline:")!==0)return null;const n=r.substring(7).split("|");return{keyMethod:"inline",keySalt:n[0],lifeTime:n[1],mkiValue:n[2]?n[2].split(":")[0]:void 0,mkiLength:n[2]?n[2].split(":")[1]:void 0}},e.writeCryptoKeyParams=function(r){return r.keyMethod+":"+r.keySalt+(r.lifeTime?"|"+r.lifeTime:"")+(r.mkiValue&&r.mkiLength?"|"+r.mkiValue+":"+r.mkiLength:"")},e.getCryptoParameters=function(r,n){return e.matchPrefix(r+n,"a=crypto:").map(e.parseCryptoLine)},e.getIceParameters=function(r,n){const a=e.matchPrefix(r+n,"a=ice-ufrag:")[0],i=e.matchPrefix(r+n,"a=ice-pwd:")[0];return a&&i?{usernameFragment:a.substring(12),password:i.substring(10)}:null},e.writeIceParameters=function(r){let n="a=ice-ufrag:"+r.usernameFragment+`\r
a=ice-pwd:`+r.password+`\r
`;return r.iceLite&&(n+=`a=ice-lite\r
`),n},e.parseRtpParameters=function(r){const n={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=e.splitLines(r)[0].split(" ");n.profile=i[2];for(let c=3;c<i.length;c++){const u=i[c],d=e.matchPrefix(r,"a=rtpmap:"+u+" ")[0];if(d){const f=e.parseRtpMap(d),h=e.matchPrefix(r,"a=fmtp:"+u+" ");switch(f.parameters=h.length?e.parseFmtp(h[0]):{},f.rtcpFeedback=e.matchPrefix(r,"a=rtcp-fb:"+u+" ").map(e.parseRtcpFb),n.codecs.push(f),f.name.toUpperCase()){case"RED":case"ULPFEC":n.fecMechanisms.push(f.name.toUpperCase());break}}}e.matchPrefix(r,"a=extmap:").forEach(c=>{n.headerExtensions.push(e.parseExtmap(c))});const o=e.matchPrefix(r,"a=rtcp-fb:* ").map(e.parseRtcpFb);return n.codecs.forEach(c=>{o.forEach(u=>{c.rtcpFeedback.find(f=>f.type===u.type&&f.parameter===u.parameter)||c.rtcpFeedback.push(u)})}),n},e.writeRtpDescription=function(r,n){let a="";a+="m="+r+" ",a+=n.codecs.length>0?"9":"0",a+=" "+(n.profile||"UDP/TLS/RTP/SAVPF")+" ",a+=n.codecs.map(o=>o.preferredPayloadType!==void 0?o.preferredPayloadType:o.payloadType).join(" ")+`\r
`,a+=`c=IN IP4 0.0.0.0\r
`,a+=`a=rtcp:9 IN IP4 0.0.0.0\r
`,n.codecs.forEach(o=>{a+=e.writeRtpMap(o),a+=e.writeFmtp(o),a+=e.writeRtcpFb(o)});let i=0;return n.codecs.forEach(o=>{o.maxptime>i&&(i=o.maxptime)}),i>0&&(a+="a=maxptime:"+i+`\r
`),n.headerExtensions&&n.headerExtensions.forEach(o=>{a+=e.writeExtmap(o)}),a},e.parseRtpEncodingParameters=function(r){const n=[],a=e.parseRtpParameters(r),i=a.fecMechanisms.indexOf("RED")!==-1,o=a.fecMechanisms.indexOf("ULPFEC")!==-1,c=e.matchPrefix(r,"a=ssrc:").map(m=>e.parseSsrcMedia(m)).filter(m=>m.attribute==="cname"),u=c.length>0&&c[0].ssrc;let d;const f=e.matchPrefix(r,"a=ssrc-group:FID").map(m=>m.substring(17).split(" ").map(w=>parseInt(w,10)));f.length>0&&f[0].length>1&&f[0][0]===u&&(d=f[0][1]),a.codecs.forEach(m=>{if(m.name.toUpperCase()==="RTX"&&m.parameters.apt){let _={ssrc:u,codecPayloadType:parseInt(m.parameters.apt,10)};u&&d&&(_.rtx={ssrc:d}),n.push(_),i&&(_=JSON.parse(JSON.stringify(_)),_.fec={ssrc:u,mechanism:o?"red+ulpfec":"red"},n.push(_))}}),n.length===0&&u&&n.push({ssrc:u});let h=e.matchPrefix(r,"b=");return h.length&&(h[0].indexOf("b=TIAS:")===0?h=parseInt(h[0].substring(7),10):h[0].indexOf("b=AS:")===0?h=parseInt(h[0].substring(5),10)*1e3*.95-2e3*8:h=void 0,n.forEach(m=>{m.maxBitrate=h})),n},e.parseRtcpParameters=function(r){const n={},a=e.matchPrefix(r,"a=ssrc:").map(c=>e.parseSsrcMedia(c)).filter(c=>c.attribute==="cname")[0];a&&(n.cname=a.value,n.ssrc=a.ssrc);const i=e.matchPrefix(r,"a=rtcp-rsize");n.reducedSize=i.length>0,n.compound=i.length===0;const o=e.matchPrefix(r,"a=rtcp-mux");return n.mux=o.length>0,n},e.writeRtcpParameters=function(r){let n="";return r.reducedSize&&(n+=`a=rtcp-rsize\r
`),r.mux&&(n+=`a=rtcp-mux\r
`),r.ssrc!==void 0&&r.cname&&(n+="a=ssrc:"+r.ssrc+" cname:"+r.cname+`\r
`),n},e.parseMsid=function(r){let n;const a=e.matchPrefix(r,"a=msid:");if(a.length===1)return n=a[0].substring(7).split(" "),{stream:n[0],track:n[1]};const i=e.matchPrefix(r,"a=ssrc:").map(o=>e.parseSsrcMedia(o)).filter(o=>o.attribute==="msid");if(i.length>0)return n=i[0].value.split(" "),{stream:n[0],track:n[1]}},e.parseSctpDescription=function(r){const n=e.parseMLine(r),a=e.matchPrefix(r,"a=max-message-size:");let i;a.length>0&&(i=parseInt(a[0].substring(19),10)),isNaN(i)&&(i=65536);const o=e.matchPrefix(r,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:n.fmt,maxMessageSize:i};const c=e.matchPrefix(r,"a=sctpmap:");if(c.length>0){const u=c[0].substring(10).split(" ");return{port:parseInt(u[0],10),protocol:u[1],maxMessageSize:i}}},e.writeSctpDescription=function(r,n){let a=[];return r.protocol!=="DTLS/SCTP"?a=["m="+r.kind+" 9 "+r.protocol+" "+n.protocol+`\r
`,`c=IN IP4 0.0.0.0\r
`,"a=sctp-port:"+n.port+`\r
`]:a=["m="+r.kind+" 9 "+r.protocol+" "+n.port+`\r
`,`c=IN IP4 0.0.0.0\r
`,"a=sctpmap:"+n.port+" "+n.protocol+` 65535\r
`],n.maxMessageSize!==void 0&&a.push("a=max-message-size:"+n.maxMessageSize+`\r
`),a.join("")},e.generateSessionId=function(){return Math.random().toString().substr(2,22)},e.writeSessionBoilerplate=function(r,n,a){let i;const o=n!==void 0?n:2;return r?i=r:i=e.generateSessionId(),`v=0\r
o=`+(a||"thisisadapterortc")+" "+i+" "+o+` IN IP4 127.0.0.1\r
s=-\r
t=0 0\r
`},e.getDirection=function(r,n){const a=e.splitLines(r);for(let i=0;i<a.length;i++)switch(a[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return a[i].substring(2)}return n?e.getDirection(n):"sendrecv"},e.getKind=function(r){return e.splitLines(r)[0].split(" ")[0].substring(2)},e.isRejected=function(r){return r.split(" ",2)[1]==="0"},e.parseMLine=function(r){const a=e.splitLines(r)[0].substring(2).split(" ");return{kind:a[0],port:parseInt(a[1],10),protocol:a[2],fmt:a.slice(3).join(" ")}},e.parseOLine=function(r){const a=e.matchPrefix(r,"o=")[0].substring(2).split(" ");return{username:a[0],sessionId:a[1],sessionVersion:parseInt(a[2],10),netType:a[3],addressType:a[4],address:a[5]}},e.isValidSDP=function(r){if(typeof r!="string"||r.length===0)return!1;const n=e.splitLines(r);for(let a=0;a<n.length;a++)if(n[a].length<2||n[a].charAt(1)!=="=")return!1;return!0},t.exports=e})(rE)),rE.exports}var Uq=Ble(),qf=Tle(Uq),Ule=Woe({__proto__:null,default:qf},[Uq]);function l_(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const e=t.RTCIceCandidate;t.RTCIceCandidate=function(n){if(typeof n=="object"&&n.candidate&&n.candidate.indexOf("a=")===0&&(n=JSON.parse(JSON.stringify(n)),n.candidate=n.candidate.substring(2)),n.candidate&&n.candidate.length){const a=new e(n),i=qf.parseCandidate(n.candidate);for(const o in i)o in a||Object.defineProperty(a,o,{value:i[o]});return a.toJSON=function(){return{candidate:a.candidate,sdpMid:a.sdpMid,sdpMLineIndex:a.sdpMLineIndex,usernameFragment:a.usernameFragment}},a}return new e(n)},t.RTCIceCandidate.prototype=e.prototype,vd(t,"icecandidate",r=>(r.candidate&&Object.defineProperty(r,"candidate",{value:new t.RTCIceCandidate(r.candidate),writable:"false"}),r))}function uC(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||vd(t,"icecandidate",e=>{if(e.candidate){const r=qf.parseCandidate(e.candidate.candidate);r.type==="relay"&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[r.priority>>24])}return e})}function u_(t,e){if(!t.RTCPeerConnection)return;"sctp"in t.RTCPeerConnection.prototype||Object.defineProperty(t.RTCPeerConnection.prototype,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp}});const r=function(c){if(!c||!c.sdp)return!1;const u=qf.splitSections(c.sdp);return u.shift(),u.some(d=>{const f=qf.parseMLine(d);return f&&f.kind==="application"&&f.protocol.indexOf("SCTP")!==-1})},n=function(c){const u=c.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(u===null||u.length<2)return-1;const d=parseInt(u[1],10);return d!==d?-1:d},a=function(c){let u=65536;return e.browser==="firefox"&&(e.version<57?c===-1?u=16384:u=2147483637:e.version<60?u=e.version===57?65535:65536:u=2147483637),u},i=function(c,u){let d=65536;e.browser==="firefox"&&e.version===57&&(d=65535);const f=qf.matchPrefix(c.sdp,"a=max-message-size:");return f.length>0?d=parseInt(f[0].substring(19),10):e.browser==="firefox"&&u!==-1&&(d=2147483637),d},o=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,e.browser==="chrome"&&e.version>=76){const{sdpSemantics:u}=this.getConfiguration();u==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const u=n(arguments[0]),d=a(u),f=i(arguments[0],u);let h;d===0&&f===0?h=Number.POSITIVE_INFINITY:d===0||f===0?h=Math.max(d,f):h=Math.min(d,f);const m={};Object.defineProperty(m,"maxMessageSize",{get(){return h}}),this._sctp=m}return o.apply(this,arguments)}}function d_(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function e(n,a){const i=n.send;n.send=function(){const c=arguments[0],u=c.length||c.size||c.byteLength;if(n.readyState==="open"&&a.sctp&&u>a.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+a.sctp.maxMessageSize+" bytes)");return i.apply(n,arguments)}}const r=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const a=r.apply(this,arguments);return e(a,this),a},vd(t,"datachannel",n=>(e(n.channel,n.target),n))}function dC(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const e=t.RTCPeerConnection.prototype;Object.defineProperty(e,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(e,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(r){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),r&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=r)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(r=>{const n=e[r];e[r]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=a=>{const i=a.target;if(i._lastConnectionState!==i.connectionState){i._lastConnectionState=i.connectionState;const o=new Event("connectionstatechange",a);i.dispatchEvent(o)}return a},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),n.apply(this,arguments)}})}function fC(t,e){if(!t.RTCPeerConnection||e.browser==="chrome"&&e.version>=71||e.browser==="safari"&&e._safariVersion>=13.1)return;const r=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(a){if(a&&a.sdp&&a.sdp.indexOf(`
a=extmap-allow-mixed`)!==-1){const i=a.sdp.split(`
`).filter(o=>o.trim()!=="a=extmap-allow-mixed").join(`
`);t.RTCSessionDescription&&a instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:a.type,sdp:i}):a.sdp=i}return r.apply(this,arguments)}}function f_(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const r=t.RTCPeerConnection.prototype.addIceCandidate;!r||r.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(e.browser==="chrome"&&e.version<78||e.browser==="firefox"&&e.version<68||e.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function p_(t,e){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const r=t.RTCPeerConnection.prototype.setLocalDescription;!r||r.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let a=arguments[0]||{};if(typeof a!="object"||a.type&&a.sdp)return r.apply(this,arguments);if(a={type:a.type,sdp:a.sdp},!a.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":a.type="offer";break;default:a.type="answer";break}return a.sdp||a.type!=="offer"&&a.type!=="answer"?r.apply(this,[a]):(a.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(o=>r.apply(this,[o]))})}var Fle=Object.freeze({__proto__:null,removeExtmapAllowMixed:fC,shimAddIceCandidateNullOrEmpty:f_,shimConnectionState:dC,shimMaxMessageSize:u_,shimParameterlessSetLocalDescription:p_,shimRTCIceCandidate:l_,shimRTCIceCandidateRelayProtocol:uC,shimSendThrowTypeError:d_});function qle(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const r=uq,n=jle(t),a={browserDetails:n,commonShim:Fle,extractVersion:Jh,disableLog:Ile,disableWarnings:Mle,sdp:Ule};switch(n.browser){case"chrome":if(!pM||!cC||!e.shimChrome)return r("Chrome shim is not included in this adapter release."),a;if(n.version===null)return r("Chrome shim can not determine version, not shimming."),a;r("adapter.js shimming chrome."),a.browserShim=pM,f_(t,n),p_(t),fq(t,n),pq(t),cC(t,n),hq(t),vq(t,n),mq(t),gq(t),_q(t,n),l_(t),uC(t),dC(t),u_(t,n),d_(t),fC(t,n);break;case"firefox":if(!hM||!lC||!e.shimFirefox)return r("Firefox shim is not included in this adapter release."),a;r("adapter.js shimming firefox."),a.browserShim=hM,f_(t,n),p_(t),bq(t,n),lC(t,n),kq(t),Eq(t),wq(t),Sq(t),Tq(t),Cq(t),xq(t),Pq(t),Aq(t),l_(t),dC(t),u_(t,n),d_(t);break;case"safari":if(!mM||!e.shimSafari)return r("Safari shim is not included in this adapter release."),a;r("adapter.js shimming safari."),a.browserShim=mM,f_(t,n),p_(t),Mq(t),Lq(t),Oq(t),Rq(t),Dq(t),jq(t),Nq(t),Bq(t),l_(t),uC(t),u_(t,n),d_(t),fC(t,n);break;default:r("Unsupported browser!");break}return a}qle({window:typeof window>"u"?void 0:window});class li extends Promise{constructor(e){super(e)}catch(e){return super.catch(e)}static reject(e){return super.reject(e)}static all(e){return super.all(e)}static race(e){return super.race(e)}}const zle=/version\/(\d+(\.?_?\d+)+)/i;let nE;function fi(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const r=navigator.userAgent.toLowerCase();if(nE===void 0||e){const n=$le.find(a=>{let{test:i}=a;return i.test(r)});nE=n?.describe(r)}return nE}const $le=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:h_(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:aE(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:h_(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:aE(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:h_(zle,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:aE(t)}}}];function h_(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const n=e.match(t);return n&&n.length>=r&&n[r]||""}function aE(t){return t.includes("mac os")?h_(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var Vle="2.17.0";const Hle=Vle,Gle=16;class Zo extends Error{constructor(e,r){super(r||"an error has occured"),this.name="LiveKitError",this.code=e}}var ln;(function(t){t[t.NotAllowed=0]="NotAllowed",t[t.ServerUnreachable=1]="ServerUnreachable",t[t.InternalError=2]="InternalError",t[t.Cancelled=3]="Cancelled",t[t.LeaveRequest=4]="LeaveRequest",t[t.Timeout=5]="Timeout",t[t.WebSocket=6]="WebSocket",t[t.ServiceNotFound=7]="ServiceNotFound"})(ln||(ln={}));class Gt extends Zo{constructor(e,r,n,a){super(1,e),this.name="ConnectionError",this.status=n,this.reason=r,this.context=a,this.reasonName=ln[r]}static notAllowed(e,r,n){return new Gt(e,ln.NotAllowed,r,n)}static timeout(e){return new Gt(e,ln.Timeout)}static leaveRequest(e,r){return new Gt(e,ln.LeaveRequest,void 0,r)}static internal(e,r){return new Gt(e,ln.InternalError,void 0,r)}static cancelled(e){return new Gt(e,ln.Cancelled)}static serverUnreachable(e,r){return new Gt(e,ln.ServerUnreachable,r)}static websocket(e,r,n){return new Gt(e,ln.WebSocket,r,n)}static serviceNotFound(e,r){return new Gt(e,ln.ServiceNotFound,void 0,r)}}class VP extends Zo{constructor(e){super(21,e??"device is unsupported"),this.name="DeviceUnsupportedError"}}class Ac extends Zo{constructor(e){super(20,e??"track is invalid"),this.name="TrackInvalidError"}}class Wle extends Zo{constructor(e){super(10,e??"unsupported server"),this.name="UnsupportedServer"}}class Ln extends Zo{constructor(e){super(12,e??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class zf extends Zo{constructor(e){super(13,e??"unable to negotiate"),this.name="NegotiationError"}}class yM extends Zo{constructor(e,r){super(15,e),this.name="PublishTrackError",this.status=r}}class vM extends Zo{constructor(e,r){super(15,e),this.name="SignalRequestError",this.reason=r,this.reasonName=typeof r=="string"?r:$P[r]}}var za;(function(t){t[t.AlreadyOpened=0]="AlreadyOpened",t[t.AbnormalEnd=1]="AbnormalEnd",t[t.DecodeFailed=2]="DecodeFailed",t[t.LengthExceeded=3]="LengthExceeded",t[t.Incomplete=4]="Incomplete",t[t.HandlerAlreadyRegistered=7]="HandlerAlreadyRegistered",t[t.EncryptionTypeMismatch=8]="EncryptionTypeMismatch"})(za||(za={}));class as extends Zo{constructor(e,r){super(16,e),this.name="DataStreamError",this.reason=r,this.reasonName=za[r]}}class uf extends Zo{constructor(e){super(18,e),this.name="SignalReconnectError"}}var lb;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(lb||(lb={}));(function(t){function e(r){if(r&&"name"in r)return r.name==="NotFoundError"||r.name==="DevicesNotFoundError"?t.NotFound:r.name==="NotAllowedError"||r.name==="PermissionDeniedError"?t.PermissionDenied:r.name==="NotReadableError"||r.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=e})(lb||(lb={}));class Ta{}Ta.setTimeout=function(){return setTimeout(...arguments)};Ta.setInterval=function(){return setInterval(...arguments)};Ta.clearTimeout=function(){return clearTimeout(...arguments)};Ta.clearInterval=function(){return clearInterval(...arguments)};var et;(function(t){t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting",t.Reconnected="reconnected",t.Disconnected="disconnected",t.ConnectionStateChanged="connectionStateChanged",t.Moved="moved",t.MediaDevicesChanged="mediaDevicesChanged",t.ParticipantConnected="participantConnected",t.ParticipantDisconnected="participantDisconnected",t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalAudioSilenceDetected="localAudioSilenceDetected",t.ActiveSpeakersChanged="activeSpeakersChanged",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.ParticipantAttributesChanged="participantAttributesChanged",t.ParticipantActive="participantActive",t.RoomMetadataChanged="roomMetadataChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.AudioPlaybackStatusChanged="audioPlaybackChanged",t.VideoPlaybackStatusChanged="videoPlaybackChanged",t.MediaDevicesError="mediaDevicesError",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.SignalConnected="signalConnected",t.RecordingStatusChanged="recordingStatusChanged",t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ActiveDeviceChanged="activeDeviceChanged",t.ChatMessage="chatMessage",t.LocalTrackSubscribed="localTrackSubscribed",t.MetricsReceived="metricsReceived"})(et||(et={}));var yt;(function(t){t.TrackPublished="trackPublished",t.TrackSubscribed="trackSubscribed",t.TrackSubscriptionFailed="trackSubscriptionFailed",t.TrackUnpublished="trackUnpublished",t.TrackUnsubscribed="trackUnsubscribed",t.TrackMuted="trackMuted",t.TrackUnmuted="trackUnmuted",t.LocalTrackPublished="localTrackPublished",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackCpuConstrained="localTrackCpuConstrained",t.LocalSenderCreated="localSenderCreated",t.ParticipantMetadataChanged="participantMetadataChanged",t.ParticipantNameChanged="participantNameChanged",t.DataReceived="dataReceived",t.SipDTMFReceived="sipDTMFReceived",t.TranscriptionReceived="transcriptionReceived",t.IsSpeakingChanged="isSpeakingChanged",t.ConnectionQualityChanged="connectionQualityChanged",t.TrackStreamStateChanged="trackStreamStateChanged",t.TrackSubscriptionPermissionChanged="trackSubscriptionPermissionChanged",t.TrackSubscriptionStatusChanged="trackSubscriptionStatusChanged",t.TrackCpuConstrained="trackCpuConstrained",t.MediaDevicesError="mediaDevicesError",t.AudioStreamAcquired="audioStreamAcquired",t.ParticipantPermissionsChanged="participantPermissionsChanged",t.PCTrackAdded="pcTrackAdded",t.AttributesChanged="attributesChanged",t.LocalTrackSubscribed="localTrackSubscribed",t.ChatMessage="chatMessage",t.Active="active"})(yt||(yt={}));var ht;(function(t){t.TransportsCreated="transportsCreated",t.Connected="connected",t.Disconnected="disconnected",t.Resuming="resuming",t.Resumed="resumed",t.Restarting="restarting",t.Restarted="restarted",t.SignalResumed="signalResumed",t.SignalRestarted="signalRestarted",t.Closing="closing",t.MediaTrackAdded="mediaTrackAdded",t.ActiveSpeakersUpdate="activeSpeakersUpdate",t.DataPacketReceived="dataPacketReceived",t.RTPVideoMapUpdate="rtpVideoMapUpdate",t.DCBufferStatusChanged="dcBufferStatusChanged",t.ParticipantUpdate="participantUpdate",t.RoomUpdate="roomUpdate",t.SpeakersChanged="speakersChanged",t.StreamStateChanged="streamStateChanged",t.ConnectionQualityUpdate="connectionQualityUpdate",t.SubscriptionError="subscriptionError",t.SubscriptionPermissionUpdate="subscriptionPermissionUpdate",t.RemoteMute="remoteMute",t.SubscribedQualityUpdate="subscribedQualityUpdate",t.LocalTrackUnpublished="localTrackUnpublished",t.LocalTrackSubscribed="localTrackSubscribed",t.Offline="offline",t.SignalRequestResponse="signalRequestResponse",t.SignalConnected="signalConnected",t.RoomMoved="roomMoved"})(ht||(ht={}));var dt;(function(t){t.Message="message",t.Muted="muted",t.Unmuted="unmuted",t.Restarted="restarted",t.Ended="ended",t.Subscribed="subscribed",t.Unsubscribed="unsubscribed",t.CpuConstrained="cpuConstrained",t.UpdateSettings="updateSettings",t.UpdateSubscription="updateSubscription",t.AudioPlaybackStarted="audioPlaybackStarted",t.AudioPlaybackFailed="audioPlaybackFailed",t.AudioSilenceDetected="audioSilenceDetected",t.VisibilityChanged="visibilityChanged",t.VideoDimensionsChanged="videoDimensionsChanged",t.VideoPlaybackStarted="videoPlaybackStarted",t.VideoPlaybackFailed="videoPlaybackFailed",t.ElementAttached="elementAttached",t.ElementDetached="elementDetached",t.UpstreamPaused="upstreamPaused",t.UpstreamResumed="upstreamResumed",t.SubscriptionPermissionChanged="subscriptionPermissionChanged",t.SubscriptionStatusChanged="subscriptionStatusChanged",t.SubscriptionFailed="subscriptionFailed",t.TrackProcessorUpdate="trackProcessorUpdate",t.AudioTrackFeatureUpdate="audioTrackFeatureUpdate",t.TranscriptionReceived="transcriptionReceived",t.TimeSyncUpdate="timeSyncUpdate",t.PreConnectBufferFlushed="preConnectBufferFlushed"})(dt||(dt={}));function Kle(t){return typeof t>"u"?t:typeof structuredClone=="function"?typeof t=="object"&&t!==null?structuredClone(Object.assign({},t)):structuredClone(t):JSON.parse(JSON.stringify(t))}class en{constructor(e,r,n,a,i){if(typeof e=="object")this.width=e.width,this.height=e.height,this.aspectRatio=e.aspectRatio,this.encoding={maxBitrate:e.maxBitrate,maxFramerate:e.maxFramerate,priority:e.priority};else if(r!==void 0&&n!==void 0)this.width=e,this.height=r,this.aspectRatio=e/r,this.encoding={maxBitrate:n,maxFramerate:a,priority:i};else throw new TypeError("Unsupported options: provide at least width, height and maxBitrate")}get resolution(){return{width:this.width,height:this.height,frameRate:this.encoding.maxFramerate,aspectRatio:this.aspectRatio}}}const Yle=["vp8","h264"],Xle=["vp8","h264","vp9","av1","h265"];function Jle(t){return!!Yle.find(e=>e===t)}const Qle=Jle;var _M;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(_M||(_M={}));var pC;(function(t){t.telephone={maxBitrate:12e3},t.speech={maxBitrate:24e3},t.music={maxBitrate:48e3},t.musicStereo={maxBitrate:64e3},t.musicHighQuality={maxBitrate:96e3},t.musicHighQualityStereo={maxBitrate:128e3}})(pC||(pC={}));const lp={h90:new en(160,90,9e4,20),h180:new en(320,180,16e4,20),h216:new en(384,216,18e4,20),h360:new en(640,360,45e4,20),h540:new en(960,540,8e5,25),h720:new en(1280,720,17e5,30),h1080:new en(1920,1080,3e6,30),h1440:new en(2560,1440,5e6,30),h2160:new en(3840,2160,8e6,30)},hC={h120:new en(160,120,7e4,20),h180:new en(240,180,125e3,20),h240:new en(320,240,14e4,20),h360:new en(480,360,33e4,20),h480:new en(640,480,5e5,20),h540:new en(720,540,6e5,25),h720:new en(960,720,13e5,30),h1080:new en(1440,1080,23e5,30),h1440:new en(1920,1440,38e5,30)},HP={h360fps3:new en(640,360,2e5,3,"medium"),h360fps15:new en(640,360,4e5,15,"medium"),h720fps5:new en(1280,720,8e5,5,"medium"),h720fps15:new en(1280,720,15e5,15,"medium"),h720fps30:new en(1280,720,2e6,30,"medium"),h1080fps15:new en(1920,1080,25e5,15,"medium"),h1080fps30:new en(1920,1080,5e6,30,"medium"),original:new en(0,0,7e6,30,"medium")};function Fq(t,e,r){var n,a,i,o;const{optionsWithoutProcessor:c,audioProcessor:u,videoProcessor:d}=$q(t??{}),f=e?.processor,h=r?.processor,m=c??{};return m.audio===!0&&(m.audio={}),m.video===!0&&(m.video={}),m.audio&&(mC(m.audio,e),(n=(i=m.audio).deviceId)!==null&&n!==void 0||(i.deviceId={ideal:"default"}),(u||f)&&(m.audio.processor=u??f)),m.video&&(mC(m.video,r),(a=(o=m.video).deviceId)!==null&&a!==void 0||(o.deviceId={ideal:"default"}),(d||h)&&(m.video.processor=d??h)),m}function mC(t,e){return Object.keys(e).forEach(r=>{t[r]===void 0&&(t[r]=e[r])}),t}function GP(t){var e,r,n,a;const i={};if(t.video)if(typeof t.video=="object"){const o={},c=o,u=t.video;Object.keys(u).forEach(d=>{switch(d){case"resolution":mC(c,u.resolution);break;default:c[d]=u[d]}}),i.video=o,(e=(n=i.video).deviceId)!==null&&e!==void 0||(n.deviceId={ideal:"default"})}else i.video=t.video?{deviceId:{ideal:"default"}}:!1;else i.video=!1;return t.audio?typeof t.audio=="object"?(i.audio=t.audio,(r=(a=i.audio).deviceId)!==null&&r!==void 0||(a.deviceId={ideal:"default"})):i.audio={deviceId:{ideal:"default"}}:i.audio=!1,i}function qq(t){return ne(this,arguments,void 0,function(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return(function*(){const n=zq();if(n){const a=n.createAnalyser();a.fftSize=2048;const i=a.frequencyBinCount,o=new Uint8Array(i);n.createMediaStreamSource(new MediaStream([e.mediaStreamTrack])).connect(a),yield Ca(r),a.getByteTimeDomainData(o);const u=o.some(d=>d!==128&&d!==0);return n.close(),!u}return!1})()})}function zq(){var t;const e=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(e){const r=new e({latencyHint:"interactive"});if(r.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const n=()=>ne(this,void 0,void 0,function*(){var a;try{r.state==="suspended"&&(yield r.resume())}catch{}finally{(a=window.document.body)===null||a===void 0||a.removeEventListener("click",n)}});r.addEventListener("statechange",()=>{var a;r.state==="closed"&&((a=window.document.body)===null||a===void 0||a.removeEventListener("click",n))}),window.document.body.addEventListener("click",n)}return r}}function Zle(t){return t==="audioinput"?Ke.Source.Microphone:t==="videoinput"?Ke.Source.Camera:Ke.Source.Unknown}function gC(t){return t===Ke.Source.Microphone?"audioinput":t===Ke.Source.Camera?"videoinput":void 0}function eue(t){var e,r;let n=(e=t.video)!==null&&e!==void 0?e:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(n=typeof n=="boolean"?{}:n,pd()?n=Object.assign(Object.assign({},n),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):n=Object.assign(Object.assign({},n),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(r=t.audio)!==null&&r!==void 0?r:!1,video:n,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function hm(t){return t.split("/")[1].toLowerCase()}function tue(t){const e=[];return t.forEach(r=>{r.track!==void 0&&e.push(new BP({cid:r.track.mediaStreamID,track:r.trackInfo}))}),e}function vr(t){return"mediaStreamTrack"in t?{trackID:t.sid,source:t.source,muted:t.isMuted,enabled:t.mediaStreamTrack.enabled,kind:t.kind,streamID:t.mediaStreamID,streamTrackID:t.mediaStreamTrack.id}:{trackID:t.trackSid,enabled:t.isEnabled,muted:t.isMuted,trackInfo:Object.assign({mimeType:t.mimeType,name:t.trackName,encrypted:t.isEncrypted,kind:t.kind,source:t.source},t.track?vr(t.track):{})}}function rue(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function nue(t,e){var r;t===void 0&&(t={}),e===void 0&&(e={});const n=[...Object.keys(e),...Object.keys(t)],a={};for(const i of n)t[i]!==e[i]&&(a[i]=(r=e[i])!==null&&r!==void 0?r:"");return a}function $q(t){const e=Object.assign({},t);let r,n;return typeof e.audio=="object"&&e.audio.processor&&(r=e.audio.processor,e.audio=Object.assign(Object.assign({},e.audio),{processor:void 0})),typeof e.video=="object"&&e.video.processor&&(n=e.video.processor,e.video=Object.assign(Object.assign({},e.video),{processor:void 0})),{audioProcessor:r,videoProcessor:n,optionsWithoutProcessor:Kle(e)}}function aue(t){switch(t){case Yn.CAMERA:return Ke.Source.Camera;case Yn.MICROPHONE:return Ke.Source.Microphone;case Yn.SCREEN_SHARE:return Ke.Source.ScreenShare;case Yn.SCREEN_SHARE_AUDIO:return Ke.Source.ScreenShareAudio;default:return Ke.Source.Unknown}}function bM(t,e){return t.width*t.height<e.width*e.height}function iue(t,e){var r;return(r=t.layers)===null||r===void 0?void 0:r.find(n=>n.quality===e)}const sue=5e3,Ah=[];var Ii;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(Ii||(Ii={}));class Ke extends Qo.EventEmitter{get streamState(){return this._streamState}setStreamState(e){this._streamState=e}constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var a;super(),this.attachedElements=[],this.isMuted=!1,this._streamState=Ke.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=or,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),sue):this.handleAppVisibilityChanged()},this.log=$c((a=n.loggerName)!==null&&a!==void 0?a:Zs.Track),this.loggerContextCb=n.loggerContextCb,this.setMaxListeners(100),this.kind=r,this._mediaStreamTrack=e,this._mediaStreamID=e.id,this.source=Ke.Source.Unknown}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),vr(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(e){let r="audio";this.kind===Ke.Kind.Video&&(r="video"),this.attachedElements.length===0&&this.kind===Ke.Kind.Video&&this.addAppVisibilityListener(),e||(r==="audio"&&(Ah.forEach(i=>{i.parentElement===null&&!e&&(e=i)}),e&&Ah.splice(Ah.indexOf(e),1)),e||(e=document.createElement(r))),this.attachedElements.includes(e)||this.attachedElements.push(e),Tf(this.mediaStreamTrack,e);const n=e.srcObject.getTracks(),a=n.some(i=>i.kind==="audio");return e.play().then(()=>{this.emit(a?dt.AudioPlaybackStarted:dt.VideoPlaybackStarted)}).catch(i=>{i.name==="NotAllowedError"?this.emit(a?dt.AudioPlaybackFailed:dt.VideoPlaybackFailed,i):i.name==="AbortError"?or.debug("".concat(a?"audio":"video"," playback aborted, likely due to new play request")):or.warn("could not playback ".concat(a?"audio":"video"),i),a&&e&&n.some(o=>o.kind==="video")&&i.name==="NotAllowedError"&&(e.muted=!0,e.play().catch(()=>{}))}),this.emit(dt.ElementAttached,e),e}detach(e){try{if(e){$f(this.mediaStreamTrack,e);const n=this.attachedElements.indexOf(e);return n>=0&&(this.attachedElements.splice(n,1),this.recycleElement(e),this.emit(dt.ElementDetached,e)),e}const r=[];return this.attachedElements.forEach(n=>{$f(this.mediaStreamTrack,n),r.push(n),this.recycleElement(n),this.emit(dt.ElementDetached,n)}),this.attachedElements=[],r}finally{this.attachedElements.length===0&&this.removeAppVisibilityListener()}}stop(){this.stopMonitor(),this._mediaStreamTrack.stop()}enable(){this._mediaStreamTrack.enabled=!0}disable(){this._mediaStreamTrack.enabled=!1}stopMonitor(){this.monitorInterval&&clearInterval(this.monitorInterval),this.timeSyncHandle&&cancelAnimationFrame(this.timeSyncHandle)}updateLoggerOptions(e){e.loggerName&&(this.log=$c(e.loggerName)),e.loggerContextCb&&(this.loggerContextCb=e.loggerContextCb)}recycleElement(e){if(e instanceof HTMLAudioElement){let r=!0;e.pause(),Ah.forEach(n=>{n.parentElement||(r=!1)}),r&&Ah.push(e)}}handleAppVisibilityChanged(){return ne(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===Ke.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(e=>e.play().catch(()=>{})),0)})}addAppVisibilityListener(){ui()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){ui()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function Tf(t,e){let r;e.srcObject instanceof MediaStream?r=e.srcObject:r=new MediaStream;let n;t.kind==="audio"?n=r.getAudioTracks():n=r.getVideoTracks(),n.includes(t)||(n.forEach(a=>{r.removeTrack(a)}),r.addTrack(t)),(!pd()||!(e instanceof HTMLVideoElement))&&(e.autoplay=!0),e.muted=r.getAudioTracks().length===0,e instanceof HTMLVideoElement&&(e.playsInline=!0),e.srcObject!==r&&(e.srcObject=r,(pd()||fd())&&e instanceof HTMLVideoElement&&setTimeout(()=>{e.srcObject=r,e.play().catch(()=>{})},0))}function $f(t,e){if(e.srcObject instanceof MediaStream){const r=e.srcObject;r.removeTrack(t),r.getTracks().length>0?e.srcObject=r:e.srcObject=null}}(function(t){let e;(function(d){d.Audio="audio",d.Video="video",d.Unknown="unknown"})(e=t.Kind||(t.Kind={}));let r;(function(d){d.Camera="camera",d.Microphone="microphone",d.ScreenShare="screen_share",d.ScreenShareAudio="screen_share_audio",d.Unknown="unknown"})(r=t.Source||(t.Source={}));let n;(function(d){d.Active="active",d.Paused="paused",d.Unknown="unknown"})(n=t.StreamState||(t.StreamState={}));function a(d){switch(d){case e.Audio:return zs.AUDIO;case e.Video:return zs.VIDEO;default:return zs.DATA}}t.kindToProto=a;function i(d){switch(d){case zs.AUDIO:return e.Audio;case zs.VIDEO:return e.Video;default:return e.Unknown}}t.kindFromProto=i;function o(d){switch(d){case r.Camera:return Yn.CAMERA;case r.Microphone:return Yn.MICROPHONE;case r.ScreenShare:return Yn.SCREEN_SHARE;case r.ScreenShareAudio:return Yn.SCREEN_SHARE_AUDIO;default:return Yn.UNKNOWN}}t.sourceToProto=o;function c(d){switch(d){case Yn.CAMERA:return r.Camera;case Yn.MICROPHONE:return r.Microphone;case Yn.SCREEN_SHARE:return r.ScreenShare;case Yn.SCREEN_SHARE_AUDIO:return r.ScreenShareAudio;default:return r.Unknown}}t.sourceFromProto=c;function u(d){switch(d){case aC.ACTIVE:return n.Active;case aC.PAUSED:return n.Paused;default:return n.Unknown}}t.streamStateFromProto=u})(Ke||(Ke={}));const oue="|",kM="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function cue(t){const e=t.split(oue);return e.length>1?[e[0],t.substr(e[0].length+1)]:[t,""]}function Ca(t){return new li(e=>Ta.setTimeout(e,t))}function yC(){return"addTransceiver"in RTCPeerConnection.prototype}function vC(){return"addTrack"in RTCPeerConnection.prototype}function lue(){if(!("getCapabilities"in RTCRtpSender)||pd()||fd())return!1;const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const r of t.codecs)if(r.mimeType.toLowerCase()==="video/av1"){e=!0;break}}return e}function uue(){if(!("getCapabilities"in RTCRtpSender)||fd())return!1;if(pd()){const r=fi();if(r?.version&&Yo(r.version,"16")<0||r?.os==="iOS"&&r?.osVersion&&Yo(r.osVersion,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let e=!1;if(t){for(const r of t.codecs)if(r.mimeType.toLowerCase()==="video/vp9"){e=!0;break}}return e}function Vs(t){return t==="av1"||t==="vp9"}function _C(t){return!document||Hm()?!1:(t||(t=document.createElement("audio")),"setSinkId"in t)}function due(){return typeof RTCPeerConnection>"u"?!1:yC()||vC()}function fd(){var t;return((t=fi())===null||t===void 0?void 0:t.name)==="Firefox"}function wM(){const t=fi();return!!t&&t.name==="Chrome"&&t.os!=="iOS"}function pd(){var t;return((t=fi())===null||t===void 0?void 0:t.name)==="Safari"}function Hm(){const t=fi();return t?.name==="Safari"||t?.os==="iOS"}function fue(){const t=fi();return t?.name==="Safari"&&t.version.startsWith("17.")||t?.os==="iOS"&&!!t?.osVersion&&Yo(t.osVersion,"17")>=0}function pue(t){return t||(t=fi()),t?.name==="Safari"&&Yo(t.version,"18.3")>0||t?.os==="iOS"&&!!t?.osVersion&&Yo(t.osVersion,"18.3")>0}function Vq(){var t,e;return ui()?(e=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&e!==void 0?e:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function hue(){const t=fi(),e="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&Yo(t.osVersion,e)>=0?!0:t.name==="Safari"&&Yo(t.version,e)>=0}function ui(){return typeof document<"u"}function Ko(){return navigator.product=="ReactNative"}function up(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function iE(t){return up(t)?t.hostname.split(".")[0]:null}function Hq(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function Gq(){if(!Ko())return;let t=Hq();if(t)return t.platform}function SM(){if(ui())return window.devicePixelRatio;if(Ko()){let t=Hq();if(t)return t.devicePixelRatio}return 1}function Yo(t,e){const r=t.split("."),n=e.split("."),a=Math.min(r.length,n.length);for(let i=0;i<a;++i){const o=parseInt(r[i],10),c=parseInt(n[i],10);if(o>c)return 1;if(o<c)return-1;if(i===a-1&&o===c)return 0}return t===""&&e!==""?-1:e===""?1:r.length==n.length?0:r.length<n.length?-1:1}function mue(t){for(const e of t)e.target.handleResize(e)}function gue(t){for(const e of t)e.target.handleVisibilityChanged(e)}let sE=null;const EM=()=>(sE||(sE=new ResizeObserver(mue)),sE);let oE=null;const TM=()=>(oE||(oE=new IntersectionObserver(gue,{root:null,rootMargin:"0px"})),oE);function yue(){var t;const e=new W5({sdk:K5.JS,protocol:Gle,version:Hle});return Ko()&&(e.os=(t=Gq())!==null&&t!==void 0?t:""),e}function CM(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const a=document.createElement("canvas");a.width=t,a.height=e;const i=a.getContext("2d");i?.fillRect(0,0,a.width,a.height),n&&i&&(i.beginPath(),i.arc(t/2,e/2,50,0,Math.PI*2,!0),i.closePath(),i.fillStyle="grey",i.fill());const o=a.captureStream(),[c]=o.getTracks();if(!c)throw Error("Could not get empty media stream video track");return c.enabled=r,c}let Rh;function cE(){if(!Rh){const t=new AudioContext,e=t.createOscillator(),r=t.createGain();r.gain.setValueAtTime(0,0);const n=t.createMediaStreamDestination();if(e.connect(r),r.connect(n),e.start(),[Rh]=n.stream.getAudioTracks(),!Rh)throw Error("Could not get empty media stream audio track");Rh.enabled=!1}return Rh.clone()}class ds{get isResolved(){return this._isResolved}constructor(e,r){this._isResolved=!1,this.onFinally=r,this.promise=new Promise((n,a)=>ne(this,void 0,void 0,function*(){this.resolve=n,this.reject=a,e&&(yield e(n,a))})).finally(()=>{var n;this._isResolved=!0,(n=this.onFinally)===null||n===void 0||n.call(this)})}}function vue(t){return Xle.includes(t)}function Vl(t){if(typeof t=="string"||typeof t=="number")return t;if(Array.isArray(t))return t[0];if(t.exact!==void 0)return Array.isArray(t.exact)?t.exact[0]:t.exact;if(t.ideal!==void 0)return Array.isArray(t.ideal)?t.ideal[0]:t.ideal;throw Error("could not unwrap constraint")}function _ue(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function Gm(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function bue(t,e){return t.segments.map(r=>{let{id:n,text:a,language:i,startTime:o,endTime:c,final:u}=r;var d;const f=(d=e.get(n))!==null&&d!==void 0?d:Date.now(),h=Date.now();return u?e.delete(n):e.set(n,f),{id:n,text:a,startTime:Number.parseInt(o.toString()),endTime:Number.parseInt(c.toString()),final:u,language:i,firstReceivedTime:f,lastReceivedTime:h}})}function kue(t){const{id:e,timestamp:r,message:n,editTimestamp:a}=t;return{id:e,timestamp:Number.parseInt(r.toString()),editTimestamp:a?Number.parseInt(a.toString()):void 0,message:n}}function xM(t){switch(t.reason){case ln.LeaveRequest:return t.context;case ln.Cancelled:return Gs.CLIENT_INITIATED;case ln.NotAllowed:return Gs.USER_REJECTED;case ln.ServerUnreachable:return Gs.JOIN_FAILURE;default:return Gs.UNKNOWN_REASON}}function m_(t){return t!==void 0?Number(t):void 0}function zu(t){return t!==void 0?BigInt(t):void 0}function Vf(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function Fo(t){return!!t&&t.kind==Ke.Kind.Audio}function pu(t){return!!t&&t.kind==Ke.Kind.Video}function El(t){return Vf(t)&&pu(t)}function Sc(t){return Vf(t)&&Fo(t)}function bC(t){return!!t&&!t.isLocal}function wue(t){return!!t&&!t.isLocal}function lE(t){return bC(t)&&pu(t)}function Sue(t){return t.isLocal}function Eue(t,e){const r=[];let n=new TextEncoder().encode(t);for(;n.length>e;){let a=e;for(;a>0;){const i=n[a];if(i!==void 0&&(i&192)!==128)break;a--}r.push(n.slice(0,a)),n=n.slice(a)}return n.length>0&&r.push(n),r}function Tue(t){var e;const r=t.get("Cache-Control");if(r){const n=(e=r.match(/(?:^|[,\s])max-age=(\d+)/))===null||e===void 0?void 0:e[1];if(n)return parseInt(n,10)}}function Cue(t,e){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const n=xue(t,e);return r?n:WP(n,"v1")}function xue(t,e){const r=new URL(_ue(t));return e.forEach((n,a)=>{r.searchParams.set(a,n)}),WP(r,"rtc")}function Pue(t){const e=new URL(Gm(t));return WP(e,"validate")}function Wq(t){return t.endsWith("/")?t:"".concat(t,"/")}function WP(t,e){return t.pathname="".concat(Wq(t.pathname)).concat(e),t}function PM(t){if(typeof t=="string")return sM.fromJson(JSON.parse(t),{ignoreUnknownFields:!0});if(t instanceof ArrayBuffer)return sM.fromBinary(new Uint8Array(t));throw new Error("could not decode websocket message: ".concat(typeof t))}function Aue(t){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Unknown reason";if(!(t instanceof AbortSignal))return e;const r=t.reason;switch(typeof r){case"string":return r;case"object":return r instanceof Error?r.message:e;default:return"toString"in r?r.toString():e}}const Rue=10,Dh="lk_e2ee",Due="LKFrameEncryptionKey",Oue={sharedKey:!1,ratchetSalt:Due,ratchetWindowSize:8,failureTolerance:Rue,keyringSize:16};var Hl;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(Hl||(Hl={}));var AM;(function(t){t.KeyRatcheted="keyRatcheted"})(AM||(AM={}));var Ml;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(Ml||(Ml={}));var RM;(function(t){t.Error="cryptorError"})(RM||(RM={}));function Nue(){return Iue()||kC()}function kC(){return typeof window.RTCRtpScriptTransform<"u"}function Iue(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}function Mue(t){var e,r,n,a,i;if(((e=t.value)===null||e===void 0?void 0:e.case)!=="sipDtmf"&&((r=t.value)===null||r===void 0?void 0:r.case)!=="metrics"&&((n=t.value)===null||n===void 0?void 0:n.case)!=="speaker"&&((a=t.value)===null||a===void 0?void 0:a.case)!=="transcription"&&((i=t.value)===null||i===void 0?void 0:i.case)!=="encryptedPacket")return new F5({value:t.value})}class NSe extends Qo.EventEmitter{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(r,n,a)=>{or.debug("key ratcheted event received",{ratchetResult:r,participantId:n,keyIndex:a})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},Oue),e),this.on(Hl.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(e,r,n){const a={key:e,participantIdentity:r,keyIndex:n};if(!this.options.sharedKey&&!r)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(r??"shared","-").concat(n??0),a),this.emit(Hl.SetKey,a)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(e,r){this.emit(Hl.RatchetRequest,e,r)}}var DM;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(DM||(DM={}));class jue extends Qo.EventEmitter{constructor(e,r){super(),this.decryptDataRequests=new Map,this.encryptDataRequests=new Map,this.onWorkerMessage=n=>{var a,i;const{kind:o,data:c}=n.data;switch(o){case"error":if(or.error(c.error.message),c.uuid){const f=this.decryptDataRequests.get(c.uuid);if(f?.reject){f.reject(c.error);break}const h=this.encryptDataRequests.get(c.uuid);if(h?.reject){h.reject(c.error);break}}this.emit(Ml.EncryptionError,c.error,c.participantIdentity);break;case"initAck":c.enabled&&this.keyProvider.getKeys().forEach(f=>{this.postKey(f)});break;case"enable":if(c.enabled&&this.keyProvider.getKeys().forEach(f=>{this.postKey(f)}),this.encryptionEnabled!==c.enabled&&c.participantIdentity===((a=this.room)===null||a===void 0?void 0:a.localParticipant.identity))this.emit(Ml.ParticipantEncryptionStatusChanged,c.enabled,this.room.localParticipant),this.encryptionEnabled=c.enabled;else if(c.participantIdentity){const f=(i=this.room)===null||i===void 0?void 0:i.getParticipantByIdentity(c.participantIdentity);if(!f)throw TypeError("couldn't set encryption status, participant not found".concat(c.participantIdentity));this.emit(Ml.ParticipantEncryptionStatusChanged,c.enabled,f)}break;case"ratchetKey":this.keyProvider.emit(Hl.KeyRatcheted,c.ratchetResult,c.participantIdentity,c.keyIndex);break;case"decryptDataResponse":const u=this.decryptDataRequests.get(c.uuid);u?.resolve&&u.resolve(c);break;case"encryptDataResponse":const d=this.encryptDataRequests.get(c.uuid);d?.resolve&&d.resolve(c);break}},this.onWorkerError=n=>{or.error("e2ee worker encountered an error:",{error:n.error}),this.emit(Ml.EncryptionError,n.error,void 0)},this.keyProvider=e.keyProvider,this.worker=e.worker,this.encryptionEnabled=!1,this.dataChannelEncryptionEnabled=r}get isEnabled(){return this.encryptionEnabled}get isDataChannelEncryptionEnabled(){return this.isEnabled&&this.dataChannelEncryptionEnabled}setup(e){if(!Nue())throw new VP("tried to setup end-to-end encryption on an unsupported browser");if(or.info("setting up e2ee"),e!==this.room){this.room=e,this.setupEventListeners(e,this.keyProvider);const r={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:Ple.getLevel()}};this.worker&&(or.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(r))}}setParticipantCryptorEnabled(e,r){or.debug("set e2ee to ".concat(e," for participant ").concat(r)),this.postEnable(e,r)}setSifTrailer(e){!e||e.length===0?or.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(e)}setupEngine(e){e.on(ht.RTPVideoMapUpdate,r=>{this.postRTPMap(r)})}setupEventListeners(e,r){e.on(et.TrackPublished,(n,a)=>this.setParticipantCryptorEnabled(n.trackInfo.encryption!==aa.NONE,a.identity)),e.on(et.ConnectionStateChanged,n=>{n===Mr.Connected&&e.remoteParticipants.forEach(a=>{a.trackPublications.forEach(i=>{this.setParticipantCryptorEnabled(i.trackInfo.encryption!==aa.NONE,a.identity)})})}).on(et.TrackUnsubscribed,(n,a,i)=>{var o;const c={kind:"removeTransform",data:{participantIdentity:i.identity,trackId:n.mediaStreamID}};(o=this.worker)===null||o===void 0||o.postMessage(c)}).on(et.TrackSubscribed,(n,a,i)=>{this.setupE2EEReceiver(n,i.identity,a.trackInfo)}).on(et.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");r.getKeys().forEach(n=>{this.postKey(n)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),e.localParticipant.on(yt.LocalSenderCreated,(n,a)=>ne(this,void 0,void 0,function*(){this.setupE2EESender(a,n)})),e.localParticipant.on(yt.LocalTrackPublished,n=>{if(!pu(n.track)||!Hm())return;const a={kind:"updateCodec",data:{trackId:n.track.mediaStreamID,codec:hm(n.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(a)}),r.on(Hl.SetKey,n=>this.postKey(n)).on(Hl.RatchetRequest,(n,a)=>this.postRatchetRequest(n,a))}encryptData(e){return ne(this,void 0,void 0,function*(){if(!this.worker)throw Error("could not encrypt data, worker is missing");const r=crypto.randomUUID(),n={kind:"encryptDataRequest",data:{uuid:r,payload:e,participantIdentity:this.room.localParticipant.identity}},a=new ds;return a.onFinally=()=>{this.encryptDataRequests.delete(r)},this.encryptDataRequests.set(r,a),this.worker.postMessage(n),a.promise})}handleEncryptedData(e,r,n,a){if(!this.worker)throw Error("could not handle encrypted data, worker is missing");const i=crypto.randomUUID(),o={kind:"decryptDataRequest",data:{uuid:i,payload:e,iv:r,participantIdentity:n,keyIndex:a}},c=new ds;return c.onFinally=()=>{this.decryptDataRequests.delete(i)},this.decryptDataRequests.set(i,c),this.worker.postMessage(o),c.promise}postRatchetRequest(e,r){if(!this.worker)throw Error("could not ratchet key, worker is missing");const n={kind:"ratchetRequest",data:{participantIdentity:e,keyIndex:r}};this.worker.postMessage(n)}postKey(e){let{key:r,participantIdentity:n,keyIndex:a}=e;var i;if(!this.worker)throw Error("could not set key, worker is missing");const o={kind:"setKey",data:{participantIdentity:n,isPublisher:n===((i=this.room)===null||i===void 0?void 0:i.localParticipant.identity),key:r,keyIndex:a}};this.worker.postMessage(o)}postEnable(e,r){if(this.worker){const n={kind:"enable",data:{enabled:e,participantIdentity:r}};this.worker.postMessage(n)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(e){var r;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((r=this.room)===null||r===void 0)&&r.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const n={kind:"setRTPMap",data:{map:e,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(n)}postSifTrailer(e){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const r={kind:"setSifTrailer",data:{trailer:e}};this.worker.postMessage(r)}setupE2EEReceiver(e,r,n){if(e.receiver){if(!n?.mimeType||n.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(e.receiver,e.mediaStreamID,r,e.kind==="video"?hm(n.mimeType):void 0)}}setupE2EESender(e,r){if(!Vf(e)||!r){r||or.warn("early return because sender is not ready");return}this.handleSender(r,e.mediaStreamID,void 0)}handleReceiver(e,r,n,a){return ne(this,void 0,void 0,function*(){if(this.worker){if(kC()&&!wM()){const i={kind:"decode",participantIdentity:n,trackId:r,codec:a};e.transform=new RTCRtpScriptTransform(this.worker,i)}else{if(Dh in e&&a){const u={kind:"updateCodec",data:{trackId:r,codec:a,participantIdentity:n}};this.worker.postMessage(u);return}let i=e.writableStream,o=e.readableStream;if(!i||!o){const u=e.createEncodedStreams();e.writableStream=u.writable,i=u.writable,e.readableStream=u.readable,o=u.readable}const c={kind:"decode",data:{readableStream:o,writableStream:i,trackId:r,codec:a,participantIdentity:n,isReuse:Dh in e}};this.worker.postMessage(c,[o,i])}e[Dh]=!0}})}handleSender(e,r,n){var a;if(!(Dh in e||!this.worker)){if(!(!((a=this.room)===null||a===void 0)&&a.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(kC()&&!wM()){or.info("initialize script transform");const i={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:r,codec:n};e.transform=new RTCRtpScriptTransform(this.worker,i)}else{or.info("initialize encoded streams");const i=e.createEncodedStreams(),o={kind:"encode",data:{readableStream:i.readable,writableStream:i.writable,codec:n,trackId:r,participantIdentity:this.room.localParticipant.identity,isReuse:!1}};this.worker.postMessage(o,[i.readable,i.writable])}e[Dh]=!0}}}const Lue=500,Bue=15e3;class Hf{constructor(){this.failedConnectionAttempts=new Map,this.backOffPromises=new Map}static getInstance(){return this._instance||(this._instance=new Hf),this._instance}addFailedConnectionAttempt(e){var r;const n=new URL(e),a=iE(n);if(!a)return;let i=(r=this.failedConnectionAttempts.get(a))!==null&&r!==void 0?r:0;this.failedConnectionAttempts.set(a,i+1),this.backOffPromises.set(a,Ca(Math.min(Lue*Math.pow(2,i),Bue)))}getBackOffPromise(e){const r=new URL(e),n=r&&iE(r);return n&&this.backOffPromises.get(n)||Promise.resolve()}resetFailedConnectionAttempts(e){const r=new URL(e),n=r&&iE(r);n&&(this.failedConnectionAttempts.set(n,0),this.backOffPromises.set(n,Promise.resolve()))}resetAll(){this.backOffPromises.clear(),this.failedConnectionAttempts.clear()}}Hf._instance=null;const uE="default";class fa{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new fa),this.instance}get previousDevices(){return this._previousDevices}getDevices(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){var i;if(((i=fa.userMediaPromiseMap)===null||i===void 0?void 0:i.size)>0){or.debug("awaiting getUserMedia promise");try{r?yield fa.userMediaPromiseMap.get(r):yield Promise.all(fa.userMediaPromiseMap.values())}catch{or.warn("error waiting for media permissons")}}let o=yield navigator.mediaDevices.enumerateDevices();if(a&&!(pd()&&n.hasDeviceInUse(r))&&(o.filter(u=>u.kind===r).length===0||o.some(u=>{const d=u.label==="",f=r?u.kind===r:!0;return d&&f}))){const u={video:r!=="audioinput"&&r!=="audiooutput",audio:r!=="videoinput"&&{deviceId:{ideal:"default"}}},d=yield navigator.mediaDevices.getUserMedia(u);o=yield navigator.mediaDevices.enumerateDevices(),d.getTracks().forEach(f=>{f.stop()})}return n._previousDevices=o,r&&(o=o.filter(c=>c.kind===r)),o})()})}normalizeDeviceId(e,r,n){return ne(this,void 0,void 0,function*(){if(r!==uE)return r;const a=yield this.getDevices(e),i=a.find(c=>c.deviceId===uE);if(!i){or.warn("could not reliably determine default device");return}const o=a.find(c=>c.deviceId!==uE&&c.groupId===(n??i.groupId));if(!o){or.warn("could not reliably determine default device");return}return o?.deviceId})}hasDeviceInUse(e){return e?fa.userMediaPromiseMap.has(e):fa.userMediaPromiseMap.size>0}}fa.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];fa.userMediaPromiseMap=new Map;var mm;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(mm||(mm={}));class Uue{constructor(){this.pendingTasks=new Map,this.taskMutex=new Wa,this.nextTaskIndex=0}run(e){return ne(this,void 0,void 0,function*(){const r={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:mm.WAITING};this.pendingTasks.set(r.id,r);const n=yield this.taskMutex.lock();try{return r.executedAt=Date.now(),r.status=mm.RUNNING,yield e()}finally{r.status=mm.COMPLETED,this.pendingTasks.delete(r.id),n()}})}flush(){return ne(this,void 0,void 0,function*(){return this.run(()=>ne(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}class Fue{get readyState(){return this.ws.readyState}constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n,a;if(!((n=r.signal)===null||n===void 0)&&n.aborted)throw new DOMException("This operation was aborted","AbortError");this.url=e;const i=new WebSocket(e,(a=r.protocols)!==null&&a!==void 0?a:[]);i.binaryType="arraybuffer",this.ws=i;const o=function(){let{closeCode:c,reason:u}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return i.close(c,u)};this.opened=new li((c,u)=>{const d=()=>{u(Gt.websocket("Encountered websocket error during connection establishment"))};i.onopen=()=>{c({readable:new ReadableStream({start(f){i.onmessage=h=>{let{data:m}=h;return f.enqueue(m)},i.onerror=h=>f.error(h)},cancel:o}),writable:new WritableStream({write(f){i.send(f)},abort(){i.close()},close:o}),protocol:i.protocol,extensions:i.extensions}),i.removeEventListener("error",d)},i.addEventListener("error",d)}),this.closed=new li((c,u)=>{const d=()=>ne(this,void 0,void 0,function*(){const f=new li(m=>{i.readyState!==WebSocket.CLOSED&&i.addEventListener("close",_=>{m(_)},{once:!0})}),h=yield li.race([Ca(250),f]);h?c(h):u(Gt.websocket("Encountered unspecified websocket error without a timely close event"))});i.onclose=f=>{let{code:h,reason:m}=f;c({closeCode:h,reason:m}),i.removeEventListener("error",d)},i.addEventListener("error",d)}),r.signal&&(r.signal.onabort=()=>i.close()),this.close=o}}const que=["syncState","trickle","offer","answer","simulate","leave"];function zue(t){const e=que.indexOf(t.case)>=0;return or.trace("request allowed to bypass queue:",{canPass:e,req:t}),e}var cn;(function(t){t[t.CONNECTING=0]="CONNECTING",t[t.CONNECTED=1]="CONNECTED",t[t.RECONNECTING=2]="RECONNECTING",t[t.DISCONNECTING=3]="DISCONNECTING",t[t.DISCONNECTED=4]="DISCONNECTED"})(cn||(cn={}));const $ue=250;class KP{get currentState(){return this.state}get isDisconnected(){return this.state===cn.DISCONNECTING||this.state===cn.DISCONNECTED}get isEstablishingConnection(){return this.state===cn.CONNECTING||this.state===cn.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;this.rtt=0,this.state=cn.DISCONNECTED,this.log=or,this._requestId=0,this.useV0SignalPath=!1,this.resetCallbacks=()=>{this.onAnswer=void 0,this.onLeave=void 0,this.onLocalTrackPublished=void 0,this.onLocalTrackUnpublished=void 0,this.onNegotiateRequested=void 0,this.onOffer=void 0,this.onRemoteMuteChanged=void 0,this.onSubscribedQualityUpdate=void 0,this.onTokenRefresh=void 0,this.onTrickle=void 0,this.onClose=void 0,this.onMediaSectionsRequirement=void 0},this.log=$c((n=r.loggerName)!==null&&n!==void 0?n:Zs.Signal),this.loggerContextCb=r.loggerContextCb,this.useJSON=e,this.requestQueue=new Uue,this.queuedRequests=[],this.closingLock=new Wa,this.connectionLock=new Wa,this.state=cn.DISCONNECTED}get logContext(){var e,r;return(r=(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this))!==null&&r!==void 0?r:{}}join(e,r,n,a){return ne(this,arguments,void 0,function(i,o,c,u){var d=this;let f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return(function*(){return d.state=cn.CONNECTING,d.options=c,yield d.connect(i,o,c,u,f)})()})}reconnect(e,r,n,a){return ne(this,void 0,void 0,function*(){if(!this.options){this.log.warn("attempted to reconnect without signal options being set, ignoring",this.logContext);return}return this.state=cn.RECONNECTING,this.clearPingInterval(),yield this.connect(e,r,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:n,reconnectReason:a}),void 0,this.useV0SignalPath)})}connect(e,r,n,a){return ne(this,arguments,void 0,function(i,o,c,u){var d=this;let f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return(function*(){const h=yield d.connectionLock.lock();d.connectOptions=c,d.useV0SignalPath=f;const m=yue(),_=f?Vue(o,m,c):Hue(o,m,c),w=Cue(i,_,f).toString(),b=Pue(w).toString();return new Promise((E,T)=>ne(d,void 0,void 0,function*(){var R,P;try{let A=!1;const C=N=>ne(this,void 0,void 0,function*(){if(A)return;A=!0;const L=N instanceof Event?N.currentTarget:N,j=Aue(L,"Abort handler called");this.streamWriter&&!this.isDisconnected?this.sendLeave().then(()=>this.close(j)).catch(q=>{this.log.error(q),this.close()}):this.close(),O(),T(Gt.cancelled(j))});u?.addEventListener("abort",C);const O=()=>{clearTimeout(I),u?.removeEventListener("abort",C)},I=setTimeout(()=>{C(Gt.timeout("room connection has timed out (signal)"))},c.websocketTimeout),x=(N,L)=>{this.handleSignalConnected(N,I,L)},D=new URL(w);D.searchParams.has("access_token")&&D.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(D),Object.assign({reconnect:c.reconnect,reconnectReason:c.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new Fue(w);try{this.ws.closed.then(F=>{var Y;this.isEstablishingConnection&&T(Gt.internal("Websocket got closed during a (re)connection attempt: ".concat(F.reason))),F.closeCode!==1e3&&(this.log.warn("websocket closed",Object.assign(Object.assign({},this.logContext),{reason:F.reason,code:F.closeCode,wasClean:F.closeCode===1e3,state:this.state})),this.state===cn.CONNECTED&&this.handleOnClose((Y=F.reason)!==null&&Y!==void 0?Y:"Unexpected WS error"))}).catch(F=>{this.isEstablishingConnection&&T(Gt.internal("Websocket error during a (re)connection attempt: ".concat(F)))});const N=yield this.ws.opened.catch(F=>ne(this,void 0,void 0,function*(){if(this.state!==cn.CONNECTED){this.state=cn.DISCONNECTED,clearTimeout(I);const Y=yield this.handleConnectionError(F,b);T(Y);return}this.handleWSError(F),T(F)}));if(clearTimeout(I),!N)return;const L=N.readable.getReader();this.streamWriter=N.writable.getWriter();const j=yield L.read();if(L.releaseLock(),!j.value)throw Gt.internal("no message received as first message");const q=PM(j.value),U=this.validateFirstMessage(q,(R=c.reconnect)!==null&&R!==void 0?R:!1);if(!U.isValid){T(U.error);return}((P=q.message)===null||P===void 0?void 0:P.case)==="join"&&(this.pingTimeoutDuration=q.message.value.pingTimeout,this.pingIntervalDuration=q.message.value.pingInterval,this.pingTimeoutDuration&&this.pingTimeoutDuration>0&&this.log.debug("ping config",Object.assign(Object.assign({},this.logContext),{timeout:this.pingTimeoutDuration,interval:this.pingIntervalDuration})));const W=U.shouldProcessFirstMessage?q:void 0;x(N,W),E(U.response)}catch(N){T(N)}finally{O()}}finally{h()}}))})()})}startReadingLoop(e,r){return ne(this,void 0,void 0,function*(){for(r&&this.handleSignalResponse(r);;){this.signalLatency&&(yield Ca(this.signalLatency));const{done:n,value:a}=yield e.read();if(n)break;const i=PM(a);this.handleSignalResponse(i)}})}close(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Close method called on signal client";return(function*(){if([cn.DISCONNECTING||cn.DISCONNECTED].includes(e.state)){e.log.debug("ignoring signal close as it's already in disconnecting state");return}const a=yield e.closingLock.lock();try{if(e.clearPingInterval(),r&&(e.state=cn.DISCONNECTING),e.ws){e.ws.close({closeCode:1e3,reason:n});const i=e.ws.closed;e.ws=void 0,e.streamWriter=void 0,yield Promise.race([i,Ca($ue)])}}catch(i){e.log.debug("websocket error while closing",Object.assign(Object.assign({},e.logContext),{error:i}))}finally{r&&(e.state=cn.DISCONNECTED),a()}})()})}sendOffer(e,r){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:e.sdp})),this.sendRequest({case:"offer",value:Cf(e,r)})}sendAnswer(e,r){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:e.sdp})),this.sendRequest({case:"answer",value:Cf(e,r)})}sendIceCandidate(e,r){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:e})),this.sendRequest({case:"trickle",value:new l0({candidateInit:JSON.stringify(e),target:r})})}sendMuteTrack(e,r){return this.sendRequest({case:"mute",value:new u0({sid:e,muted:r})})}sendAddTrack(e){return this.sendRequest({case:"addTrack",value:e})}sendUpdateLocalMetadata(e,r){return ne(this,arguments,void 0,function(n,a){var i=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return(function*(){const c=i.getNextRequestId();return yield i.sendRequest({case:"updateMetadata",value:new FP({requestId:c,metadata:n,name:a,attributes:o})}),c})()})}sendUpdateTrackSettings(e){this.sendRequest({case:"trackSetting",value:e})}sendUpdateSubscription(e){return this.sendRequest({case:"subscription",value:e})}sendSyncState(e){return this.sendRequest({case:"syncState",value:e})}sendUpdateVideoLayers(e,r){return this.sendRequest({case:"updateLayers",value:new tq({trackSid:e,layers:r})})}sendUpdateSubscriptionPermissions(e,r){return this.sendRequest({case:"subscriptionPermission",value:new aq({allParticipants:e,trackPermissions:r})})}sendSimulateScenario(e){return this.sendRequest({case:"simulate",value:e})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:kn.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new oq({timestamp:kn.parse(Date.now()),rtt:kn.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(e,r){return this.sendRequest({case:"updateAudioTrack",value:new UP({trackSid:e,features:r})})}sendLeave(){return this.sendRequest({case:"leave",value:new f0({reason:Gs.CLIENT_INITIATED,action:Ff.DISCONNECT})})}sendRequest(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return(function*(){if(!a&&!zue(r)&&n.state===cn.RECONNECTING){n.queuedRequests.push(()=>ne(n,void 0,void 0,function*(){yield this.sendRequest(r,!0)}));return}if(a||(yield n.requestQueue.flush()),n.signalLatency&&(yield Ca(n.signalLatency)),n.isDisconnected){n.log.debug("skipping signal request (type: ".concat(r.case,") - SignalClient disconnected"));return}if(!n.streamWriter){n.log.error("cannot send signal request before connected, type: ".concat(r?.case),n.logContext);return}const o=new Zce({message:r});try{n.useJSON?yield n.streamWriter.write(o.toJsonString()):yield n.streamWriter.write(o.toBinary())}catch(c){n.log.error("error sending signal message",Object.assign(Object.assign({},n.logContext),{error:c}))}})()})}handleSignalResponse(e){var r,n;const a=e.message;if(a==null){this.log.debug("received unsupported message",this.logContext);return}let i=!1;if(a.case==="answer"){const o=OM(a.value);this.onAnswer&&this.onAnswer(o,a.value.id,a.value.midToTrackId)}else if(a.case==="offer"){const o=OM(a.value);this.onOffer&&this.onOffer(o,a.value.id,a.value.midToTrackId)}else if(a.case==="trickle"){const o=JSON.parse(a.value.candidateInit);this.onTrickle&&this.onTrickle(o,a.value.target)}else a.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((r=a.value.participants)!==null&&r!==void 0?r:[]):a.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(a.value):a.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((n=a.value.speakers)!==null&&n!==void 0?n:[]):a.case==="leave"?this.onLeave&&this.onLeave(a.value):a.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(a.value.sid,a.value.muted):a.case==="roomUpdate"?this.onRoomUpdate&&a.value.room&&this.onRoomUpdate(a.value.room):a.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(a.value):a.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(a.value):a.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(a.value):a.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(a.value):a.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(a.value):a.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(a.value):a.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(a.value):a.case==="pong"||(a.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(a.value.lastPingTimestamp.toString()),this.resetPingTimeout(),i=!0):a.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(a.value):a.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(a.value.trackSid):a.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(a.value.token),this.onRoomMoved&&this.onRoomMoved(a.value)):a.case==="mediaSectionsRequirement"?this.onMediaSectionsRequirement&&this.onMediaSectionsRequirement(a.value):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:a.case})));i||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const e=this.queuedRequests.shift();e&&this.requestQueue.run(e)}}handleOnClose(e){return ne(this,void 0,void 0,function*(){if(this.state===cn.DISCONNECTED)return;const r=this.onClose;yield this.close(void 0,e),this.log.debug("websocket connection closed: ".concat(e),Object.assign(Object.assign({},this.logContext),{reason:e})),r&&r(e)})}handleWSError(e){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:e}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=Ta.setTimeout(()=>{this.log.warn("ping timeout triggered. last pong received at: ".concat(new Date(Date.now()-this.pingTimeoutDuration*1e3).toUTCString()),this.logContext),this.handleOnClose("ping timeout")},this.pingTimeoutDuration*1e3)}clearPingTimeout(){this.pingTimeout&&Ta.clearTimeout(this.pingTimeout)}startPingInterval(){if(this.clearPingInterval(),this.resetPingTimeout(),!this.pingIntervalDuration){this.log.warn("ping interval duration not set",this.logContext);return}this.log.debug("start ping interval",this.logContext),this.pingInterval=Ta.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Ta.clearInterval(this.pingInterval)}handleSignalConnected(e,r,n){this.state=cn.CONNECTED,clearTimeout(r),this.startPingInterval(),this.startReadingLoop(e.readable.getReader(),n)}validateFirstMessage(e,r){var n,a,i,o,c;return((n=e.message)===null||n===void 0?void 0:n.case)==="join"?{isValid:!0,response:e.message.value}:this.state===cn.RECONNECTING&&((a=e.message)===null||a===void 0?void 0:a.case)!=="leave"?((i=e.message)===null||i===void 0?void 0:i.case)==="reconnect"?{isValid:!0,response:e.message.value}:(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),{isValid:!0,response:void 0,shouldProcessFirstMessage:!0}):this.isEstablishingConnection&&((o=e.message)===null||o===void 0?void 0:o.case)==="leave"?{isValid:!1,error:Gt.leaveRequest("Received leave request while trying to (re)connect",e.message.value.reason)}:r?{isValid:!1,error:Gt.internal("Unexpected first message")}:{isValid:!1,error:Gt.internal("did not receive join response, got ".concat((c=e.message)===null||c===void 0?void 0:c.case," instead"))}}handleConnectionError(e,r){return ne(this,void 0,void 0,function*(){try{const n=yield fetch(r);switch(n.status){case 404:return Gt.serviceNotFound("v1 RTC path not found. Consider upgrading your LiveKit server version","v0-rtc");case 401:case 403:const a=yield n.text();return Gt.notAllowed(a,n.status);default:break}return e instanceof Gt?e:Gt.internal("Encountered unknown websocket error during connection: ".concat(e),{status:n.status,statusText:n.statusText})}catch(n){return n instanceof Gt?n:Gt.serverUnreachable(n instanceof Error?n.message:"server was not reachable")}})}}function OM(t){const e={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":e.type=t.type;break}return e}function Cf(t,e){return new ru({sdp:t.sdp,type:t.type,id:e})}function Vue(t,e,r){var n;const a=new URLSearchParams;return a.set("access_token",t),r.reconnect&&(a.set("reconnect","1"),r.sid&&a.set("sid",r.sid)),a.set("auto_subscribe",r.autoSubscribe?"1":"0"),a.set("sdk",Ko()?"reactnative":"js"),a.set("version",e.version),a.set("protocol",e.protocol.toString()),e.deviceModel&&a.set("device_model",e.deviceModel),e.os&&a.set("os",e.os),e.osVersion&&a.set("os_version",e.osVersion),e.browser&&a.set("browser",e.browser),e.browserVersion&&a.set("browser_version",e.browserVersion),r.adaptiveStream&&a.set("adaptive_stream","1"),r.reconnectReason&&a.set("reconnect_reason",r.reconnectReason.toString()),!((n=navigator.connection)===null||n===void 0)&&n.type&&a.set("network",navigator.connection.type),a}function Hue(t,e,r){const n=new URLSearchParams;n.set("access_token",t);const a=new kle({clientInfo:e,connectionSettings:new cq({autoSubscribe:!!r.autoSubscribe,adaptiveStream:!!r.adaptiveStream}),reconnect:!!r.reconnect,participantSid:r.sid?r.sid:void 0});r.reconnectReason&&(a.reconnectReason=r.reconnectReason);const i=new wle({joinRequest:a.toBinary()});return n.set("join_request",btoa(new TextDecoder("utf-8").decode(i.toBinary()))),n}class NM{constructor(){this.buffer=[],this._totalSize=0}push(e){this.buffer.push(e),this._totalSize+=e.data.byteLength}pop(){const e=this.buffer.shift();return e&&(this._totalSize-=e.data.byteLength),e}getAll(){return this.buffer.slice()}popToSequence(e){for(;this.buffer.length>0&&this.buffer[0].sequence<=e;)this.pop()}alignBufferedAmount(e){for(;this.buffer.length>0;){const r=this.buffer[0];if(this._totalSize-r.data.byteLength<=e)break;this.pop()}}get length(){return this.buffer.length}}class Gue{constructor(e){this._map=new Map,this._lastCleanup=0,this.ttl=e}set(e,r){const n=Date.now();n-this._lastCleanup>this.ttl/2&&this.cleanup();const a=n+this.ttl;return this._map.set(e,{value:r,expiresAt:a}),this}get(e){const r=this._map.get(e);if(r){if(r.expiresAt<Date.now()){this._map.delete(e);return}return r.value}}has(e){const r=this._map.get(e);return r?r.expiresAt<Date.now()?(this._map.delete(e),!1):!0:!1}delete(e){return this._map.delete(e)}clear(){this._map.clear()}cleanup(){const e=Date.now();for(const[r,n]of this._map.entries())n.expiresAt<e&&this._map.delete(r);this._lastCleanup=e}get size(){return this.cleanup(),this._map.size}forEach(e){this.cleanup();for(const[r,n]of this._map.entries())n.expiresAt>=Date.now()&&e(n.value,r,this.asValueMap())}map(e){this.cleanup();const r=[],n=this.asValueMap();for(const[a,i]of n.entries())r.push(e(i,a,n));return r}asValueMap(){const e=new Map;for(const[r,n]of this._map.entries())n.expiresAt>=Date.now()&&e.set(r,n.value);return e}}var js={},dE={},fE={exports:{}},IM;function YP(){if(IM)return fE.exports;IM=1;var t=fE.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return e.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return e.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return e.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var r="candidate:%s %d %s %d %s %d typ %s";return r+=e.raddr!=null?" raddr %s rport %d":"%v%v",r+=e.tcptype!=null?" tcptype %s":"%v",e.generation!=null&&(r+=" generation %d"),r+=e["network-id"]!=null?" network-id %d":"%v",r+=e["network-cost"]!=null?" network-cost %d":"%v",r}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var r="ssrc:%d";return e.attribute!=null&&(r+=" %s",e.value!=null&&(r+=":%s")),r}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return e.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(e.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var r="mediaclk:";return r+=e.id!=null?"id=%s %s":"%v%s",r+=e.mediaClockValue!=null?"=%s":"",r+=e.rateNumerator!=null?" rate=%s":"",r+=e.rateDenominator!=null?"/%s":"",r}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};return Object.keys(t).forEach(function(e){var r=t[e];r.forEach(function(n){n.reg||(n.reg=/(.*)/),n.format||(n.format="%s")})}),fE.exports}var MM;function Wue(){return MM||(MM=1,(function(t){var e=function(c){return String(Number(c))===c?Number(c):c},r=function(c,u,d,f){if(f&&!d)u[f]=e(c[1]);else for(var h=0;h<d.length;h+=1)c[h+1]!=null&&(u[d[h]]=e(c[h+1]))},n=function(c,u,d){var f=c.name&&c.names;c.push&&!u[c.push]?u[c.push]=[]:f&&!u[c.name]&&(u[c.name]={});var h=c.push?{}:f?u[c.name]:u;r(d.match(c.reg),h,c.names,c.name),c.push&&u[c.push].push(h)},a=YP(),i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(c){var u={},d=[],f=u;return c.split(/(\r\n|\r|\n)/).filter(i).forEach(function(h){var m=h[0],_=h.slice(2);m==="m"&&(d.push({rtp:[],fmtp:[]}),f=d[d.length-1]);for(var w=0;w<(a[m]||[]).length;w+=1){var b=a[m][w];if(b.reg.test(_))return n(b,f,_)}}),u.media=d,u};var o=function(c,u){var d=u.split(/=(.+)/,2);return d.length===2?c[d[0]]=e(d[1]):d.length===1&&u.length>1&&(c[d[0]]=void 0),c};t.parseParams=function(c){return c.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(c){return c.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(c){for(var u=[],d=c.split(" ").map(e),f=0;f<d.length;f+=3)u.push({component:d[f],ip:d[f+1],port:d[f+2]});return u},t.parseImageAttributes=function(c){return c.split(" ").map(function(u){return u.substring(1,u.length-1).split(",").reduce(o,{})})},t.parseSimulcastStreamList=function(c){return c.split(";").map(function(u){return u.split(",").map(function(d){var f,h=!1;return d[0]!=="~"?f=e(d):(f=e(d.substring(1,d.length)),h=!0),{scid:f,paused:h}})})}})(dE)),dE}var pE,jM;function Kue(){if(jM)return pE;jM=1;var t=YP(),e=/%[sdv%]/g,r=function(o){var c=1,u=arguments,d=u.length;return o.replace(e,function(f){if(c>=d)return f;var h=u[c];switch(c+=1,f){case"%%":return"%";case"%s":return String(h);case"%d":return Number(h);case"%v":return""}})},n=function(o,c,u){var d=c.format instanceof Function?c.format(c.push?u:u[c.name]):c.format,f=[o+"="+d];if(c.names)for(var h=0;h<c.names.length;h+=1){var m=c.names[h];c.name?f.push(u[c.name][m]):f.push(u[c.names[h]])}else f.push(u[c.name]);return r.apply(null,f)},a=["v","o","s","i","u","e","p","c","b","t","r","z","a"],i=["i","c","b","a"];return pE=function(o,c){c=c||{},o.version==null&&(o.version=0),o.name==null&&(o.name=" "),o.media.forEach(function(h){h.payloads==null&&(h.payloads="")});var u=c.outerOrder||a,d=c.innerOrder||i,f=[];return u.forEach(function(h){t[h].forEach(function(m){m.name in o&&o[m.name]!=null?f.push(n(h,m,o)):m.push in o&&o[m.push]!=null&&o[m.push].forEach(function(_){f.push(n(h,m,_))})})}),o.media.forEach(function(h){f.push(n("m",t.m[0],h)),d.forEach(function(m){t[m].forEach(function(_){_.name in h&&h[_.name]!=null?f.push(n(m,_,h)):_.push in h&&h[_.push]!=null&&h[_.push].forEach(function(w){f.push(n(m,_,w))})})})}),f.join(`\r
`)+`\r
`},pE}var LM;function Yue(){if(LM)return js;LM=1;var t=Wue(),e=Kue(),r=YP();return js.grammar=r,js.write=e,js.parse=t.parse,js.parseParams=t.parseParams,js.parseFmtpConfig=t.parseFmtpConfig,js.parsePayloads=t.parsePayloads,js.parseRemoteCandidates=t.parseRemoteCandidates,js.parseImageAttributes=t.parseImageAttributes,js.parseSimulcastStreamList=t.parseSimulcastStreamList,js}var Tl=Yue();function XP(t,e,r){var n,a,i;e===void 0&&(e=50),r===void 0&&(r={});var o=(n=r.isImmediate)!=null&&n,c=(a=r.callback)!=null&&a,u=r.maxWait,d=Date.now(),f=[];function h(){if(u!==void 0){var _=Date.now()-d;if(_+e>=u)return u-_}return e}var m=function(){var _=[].slice.call(arguments),w=this;return new Promise(function(b,E){var T=o&&i===void 0;if(i!==void 0&&clearTimeout(i),i=setTimeout(function(){if(i=void 0,d=Date.now(),!o){var P=t.apply(w,_);c&&c(P),f.forEach(function(A){return(0,A.resolve)(P)}),f=[]}},h()),T){var R=t.apply(w,_);return c&&c(R),b(R)}f.push({resolve:b,reject:E})})};return m.cancel=function(_){i!==void 0&&clearTimeout(i),f.forEach(function(w){return(0,w.reject)(_)}),f=[]},m}const Xue=.7,Jue=20,Gf={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class BM extends Qo.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var n;super(),this.log=or,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=XP(a=>ne(this,void 0,void 0,function*(){this.emit(Gf.NegotiationStarted);try{yield this.createAndSendOffer()}catch(i){if(a)a(i);else throw i}}),Jue),this.close=()=>{this._pc&&(this._pc.close(),this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc.onicegatheringstatechange=null,this._pc.ondatachannel=null,this._pc.onnegotiationneeded=null,this._pc.onsignalingstatechange=null,this._pc.onicecandidate=null,this._pc.ondatachannel=null,this._pc.ontrack=null,this._pc.onconnectionstatechange=null,this._pc.oniceconnectionstatechange=null,this._pc=null)},this.log=$c((n=r.loggerName)!==null&&n!==void 0?n:Zs.PCTransport),this.loggerOptions=r,this.config=e,this._pc=this.createPC(),this.offerLock=new Wa}createPC(){const e=new RTCPeerConnection(this.config);return e.onicecandidate=r=>{var n;r.candidate&&((n=this.onIceCandidate)===null||n===void 0||n.call(this,r.candidate))},e.onicecandidateerror=r=>{var n;(n=this.onIceCandidateError)===null||n===void 0||n.call(this,r)},e.oniceconnectionstatechange=()=>{var r;(r=this.onIceConnectionStateChange)===null||r===void 0||r.call(this,e.iceConnectionState)},e.onsignalingstatechange=()=>{var r;(r=this.onSignalingStatechange)===null||r===void 0||r.call(this,e.signalingState)},e.onconnectionstatechange=()=>{var r;(r=this.onConnectionStateChange)===null||r===void 0||r.call(this,e.connectionState)},e.ondatachannel=r=>{var n;(n=this.onDataChannel)===null||n===void 0||n.call(this,r)},e.ontrack=r=>{var n;(n=this.onTrack)===null||n===void 0||n.call(this,r)},e}get logContext(){var e,r;return Object.assign({},(r=(e=this.loggerOptions).loggerContextCb)===null||r===void 0?void 0:r.call(e))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(e){return ne(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(e);this.pendingCandidates.push(e)})}setRemoteDescription(e,r){return ne(this,void 0,void 0,function*(){var n;if(e.type==="answer"&&this.latestOfferId>0&&r>0&&r!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:r,latestOfferId:this.latestOfferId})),!1;let a;if(e.type==="offer"){let{stereoMids:i,nackMids:o}=Que(e);this.remoteStereoMids=i,this.remoteNackMids=o}else if(e.type==="answer"){const i=Tl.parse((n=e.sdp)!==null&&n!==void 0?n:"");i.media.forEach(o=>{const c=JP(o.mid);o.type==="audio"&&this.trackBitrates.some(u=>{if(!u.transceiver||c!=u.transceiver.mid)return!1;let d=0;if(o.rtp.some(h=>h.codec.toUpperCase()===u.codec.toUpperCase()?(d=h.payload,!0):!1),d===0)return!0;let f=!1;for(const h of o.fmtp)if(h.payload===d){h.config=h.config.split(";").filter(m=>!m.includes("maxaveragebitrate")).join(";"),u.maxbr>0&&(h.config+=";maxaveragebitrate=".concat(u.maxbr*1e3)),f=!0;break}return f||u.maxbr>0&&o.fmtp.push({payload:d,config:"maxaveragebitrate=".concat(u.maxbr*1e3)}),!0})}),a=Tl.write(i)}return yield this.setMungedSDP(e,a,!0),this.pendingCandidates.forEach(i=>{this.pc.addIceCandidate(i)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):e.type==="answer"&&(this.emit(Gf.NegotiationComplete),e.sdp&&Tl.parse(e.sdp).media.forEach(o=>{o.type==="video"&&this.emit(Gf.RTPVideoPayloadTypes,o.rtp)})),!0})}createAndSendOffer(e){return ne(this,void 0,void 0,function*(){var r;const n=yield this.offerLock.lock();try{if(this.onOffer===void 0)return;if(e?.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const c=this._pc.remoteDescription;if(e?.iceRestart&&c)yield this._pc.setRemoteDescription(c);else{this.renegotiate=!0;return}}else if(!this._pc||this._pc.signalingState==="closed"){this.log.warn("could not createOffer with closed peer connection",this.logContext);return}this.log.debug("starting to negotiate",this.logContext);const a=this.latestOfferId+1;this.latestOfferId=a;const i=yield this.pc.createOffer(e);this.log.debug("original offer",Object.assign({sdp:i.sdp},this.logContext));const o=Tl.parse((r=i.sdp)!==null&&r!==void 0?r:"");if(o.media.forEach(c=>{FM(c),c.type==="audio"?UM(c,["all"],[]):c.type==="video"&&this.trackBitrates.some(u=>{if(!c.msid||!u.cid||!c.msid.includes(u.cid))return!1;let d=0;if(c.rtp.some(h=>h.codec.toUpperCase()===u.codec.toUpperCase()?(d=h.payload,!0):!1),d===0||(Vs(u.codec)&&!pd()&&this.ensureVideoDDExtensionForSVC(c,o),!Vs(u.codec)))return!0;const f=Math.round(u.maxbr*Xue);for(const h of c.fmtp)if(h.payload===d){h.config.includes("x-google-start-bitrate")||(h.config+=";x-google-start-bitrate=".concat(f));break}return!0})}),this.latestOfferId>a){this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:a}));return}yield this.setMungedSDP(i,Tl.write(o)),this.onOffer(i,this.latestOfferId)}finally{n()}})}createAndSetAnswer(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.pc.createAnswer(),n=Tl.parse((e=r.sdp)!==null&&e!==void 0?e:"");return n.media.forEach(a=>{FM(a),a.type==="audio"&&UM(a,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(r,Tl.write(n)),r})}createDataChannel(e,r){return this.pc.createDataChannel(e,r)}addTransceiver(e,r){return this.pc.addTransceiver(e,r)}addTransceiverOfKind(e,r){return this.pc.addTransceiver(e,r)}addTrack(e){if(!this._pc)throw new Ln("PC closed, cannot add track");return this._pc.addTrack(e)}setTrackCodecBitrate(e){this.trackBitrates.push(e)}setConfiguration(e){var r;if(!this._pc)throw new Ln("PC closed, cannot configure");return(r=this._pc)===null||r===void 0?void 0:r.setConfiguration(e)}canRemoveTrack(){var e;return!!(!((e=this._pc)===null||e===void 0)&&e.removeTrack)}removeTrack(e){var r;return(r=this._pc)===null||r===void 0?void 0:r.removeTrack(e)}getConnectionState(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.connectionState)!==null&&r!==void 0?r:"closed"}getICEConnectionState(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.iceConnectionState)!==null&&r!==void 0?r:"closed"}getSignallingState(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.signalingState)!==null&&r!==void 0?r:"closed"}getTransceivers(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.getTransceivers())!==null&&r!==void 0?r:[]}getSenders(){var e,r;return(r=(e=this._pc)===null||e===void 0?void 0:e.getSenders())!==null&&r!==void 0?r:[]}getLocalDescription(){var e;return(e=this._pc)===null||e===void 0?void 0:e.localDescription}getRemoteDescription(){var e;return(e=this.pc)===null||e===void 0?void 0:e.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return ne(this,void 0,void 0,function*(){var e;if(!this._pc)return;let r="";const n=new Map,a=new Map;if((yield this._pc.getStats()).forEach(c=>{switch(c.type){case"transport":r=c.selectedCandidatePairId;break;case"candidate-pair":r===""&&c.selected&&(r=c.id),n.set(c.id,c);break;case"remote-candidate":a.set(c.id,"".concat(c.address,":").concat(c.port));break}}),r==="")return;const o=(e=n.get(r))===null||e===void 0?void 0:e.remoteCandidateId;if(o!==void 0)return a.get(o)})}setMungedSDP(e,r,n){return ne(this,void 0,void 0,function*(){if(r){const a=e.sdp;e.sdp=r;try{this.log.debug("setting munged ".concat(n?"remote":"local"," description"),this.logContext),n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e);return}catch(i){this.log.warn("not able to set ".concat(e.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:i,sdp:r})),e.sdp=a}}try{n?yield this.pc.setRemoteDescription(e):yield this.pc.setLocalDescription(e)}catch(a){let i="unknown error";a instanceof Error?i=a.message:typeof a=="string"&&(i=a);const o={error:i,sdp:e.sdp};throw!n&&this.pc.remoteDescription&&(o.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(e.type),Object.assign(Object.assign({},this.logContext),{fields:o})),new zf(i)}})}ensureVideoDDExtensionForSVC(e,r){var n,a;if(!((n=e.ext)===null||n===void 0?void 0:n.some(o=>o.uri===kM))){if(this.ddExtID===0){let o=0;r.media.forEach(c=>{var u;c.type==="video"&&((u=c.ext)===null||u===void 0||u.forEach(d=>{d.value>o&&(o=d.value)}))}),this.ddExtID=o+1}(a=e.ext)===null||a===void 0||a.push({value:this.ddExtID,uri:kM})}}}function UM(t,e,r){const n=JP(t.mid);let a=0;t.rtp.some(i=>i.codec==="opus"?(a=i.payload,!0):!1),a>0&&(t.rtcpFb||(t.rtcpFb=[]),r.includes(n)&&!t.rtcpFb.some(i=>i.payload===a&&i.type==="nack")&&t.rtcpFb.push({payload:a,type:"nack"}),(e.includes(n)||e.length===1&&e[0]==="all")&&t.fmtp.some(i=>i.payload===a?(i.config.includes("stereo=1")||(i.config+=";stereo=1"),!0):!1))}function Que(t){var e;const r=[],n=[],a=Tl.parse((e=t.sdp)!==null&&e!==void 0?e:"");let i=0;return a.media.forEach(o=>{var c;const u=JP(o.mid);o.type==="audio"&&(o.rtp.some(d=>d.codec==="opus"?(i=d.payload,!0):!1),!((c=o.rtcpFb)===null||c===void 0)&&c.some(d=>d.payload===i&&d.type==="nack")&&n.push(u),o.fmtp.some(d=>d.payload===i?(d.config.includes("sprop-stereo=1")&&r.push(u),!0):!1))}),{stereoMids:r,nackMids:n}}function FM(t){if(t.connection){const e=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&e||t.connection.version===6&&!e)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}function JP(t){return typeof t=="number"?t.toFixed(0):t}const wC="vp8",Zue={audioPreset:pC.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:HP.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:wC,backupCodec:!0,preConnectBuffer:!1},Kq={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},Yq={deviceId:{ideal:"default"},resolution:lp.h720.resolution},ede={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new Rle,disconnectOnPageLeave:!0,webAudioMix:!1,singlePeerConnection:!0},QP={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var Pn;(function(t){t[t.NEW=0]="NEW",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.FAILED=3]="FAILED",t[t.CLOSING=4]="CLOSING",t[t.CLOSED=5]="CLOSED"})(Pn||(Pn={}));class tde{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}get mode(){return this._mode}constructor(e,r,n){var a;this.peerConnectionTimeout=QP.peerConnectionTimeout,this.log=or,this.updateState=()=>{var i,o;const c=this.state,u=this.requiredTransports.map(d=>d.getConnectionState());u.every(d=>d==="connected")?this.state=Pn.CONNECTED:u.some(d=>d==="failed")?this.state=Pn.FAILED:u.some(d=>d==="connecting")?this.state=Pn.CONNECTING:u.every(d=>d==="closed")?this.state=Pn.CLOSED:u.some(d=>d==="closed")?this.state=Pn.CLOSING:u.every(d=>d==="new")&&(this.state=Pn.NEW),c!==this.state&&(this.log.debug("pc state change: from ".concat(Pn[c]," to ").concat(Pn[this.state]),this.logContext),(i=this.onStateChange)===null||i===void 0||i.call(this,this.state,this.publisher.getConnectionState(),(o=this.subscriber)===null||o===void 0?void 0:o.getConnectionState()))},this.log=$c((a=n.loggerName)!==null&&a!==void 0?a:Zs.PCManager),this.loggerOptions=n,this.isPublisherConnectionRequired=r!=="subscriber-primary",this.isSubscriberConnectionRequired=r==="subscriber-primary",this.publisher=new BM(e,n),this._mode=r,r!=="publisher-only"&&(this.subscriber=new BM(e,n),this.subscriber.onConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.subscriber.onIceCandidate=i=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,i,$s.SUBSCRIBER)},this.subscriber.onDataChannel=i=>{var o;(o=this.onDataChannel)===null||o===void 0||o.call(this,i)},this.subscriber.onTrack=i=>{var o;(o=this.onTrack)===null||o===void 0||o.call(this,i)}),this.publisher.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=i=>{var o;(o=this.onIceCandidate)===null||o===void 0||o.call(this,i,$s.PUBLISHER)},this.publisher.onTrack=i=>{var o;(o=this.onTrack)===null||o===void 0||o.call(this,i)},this.publisher.onOffer=(i,o)=>{var c;(c=this.onPublisherOffer)===null||c===void 0||c.call(this,i,o)},this.state=Pn.NEW,this.connectionLock=new Wa,this.remoteOfferLock=new Wa}get logContext(){var e,r;return Object.assign({},(r=(e=this.loggerOptions).loggerContextCb)===null||r===void 0?void 0:r.call(e))}requirePublisher(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=e,this.updateState()}createAndSendPublisherOffer(e){return this.publisher.createAndSendOffer(e)}setPublisherAnswer(e,r){return this.publisher.setRemoteDescription(e,r)}removeTrack(e){return this.publisher.removeTrack(e)}close(){return ne(this,void 0,void 0,function*(){var e;if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const r=this.publisher;for(const n of r.getSenders())try{r.canRemoveTrack()&&r.removeTrack(n)}catch(a){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:a}))}}yield Promise.all([this.publisher.close(),(e=this.subscriber)===null||e===void 0?void 0:e.close()]),this.updateState()})}triggerIceRestart(){return ne(this,void 0,void 0,function*(){this.subscriber&&(this.subscriber.restartingIce=!0),this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(e,r){return ne(this,void 0,void 0,function*(){var n;r===$s.PUBLISHER?yield this.publisher.addIceCandidate(e):yield(n=this.subscriber)===null||n===void 0?void 0:n.addIceCandidate(e)})}createSubscriberAnswerFromOffer(e,r){return ne(this,void 0,void 0,function*(){var n,a,i;this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,signalingState:(n=this.subscriber)===null||n===void 0?void 0:n.getSignallingState().toString()}));const o=yield this.remoteOfferLock.lock();try{return(yield(a=this.subscriber)===null||a===void 0?void 0:a.setRemoteDescription(e,r))?yield(i=this.subscriber)===null||i===void 0?void 0:i.createAndSetAnswer():void 0}finally{o()}})}updateConfiguration(e,r){var n;this.publisher.setConfiguration(e),(n=this.subscriber)===null||n===void 0||n.setConfiguration(e),r&&this.triggerIceRestart()}ensurePCTransportConnection(e,r){return ne(this,void 0,void 0,function*(){var n;const a=yield this.connectionLock.lock();try{this.isPublisherConnectionRequired&&this.publisher.getConnectionState()!=="connected"&&this.publisher.getConnectionState()!=="connecting"&&(this.log.debug("negotiation required, start negotiating",this.logContext),this.publisher.negotiate()),yield Promise.all((n=this.requiredTransports)===null||n===void 0?void 0:n.map(i=>this.ensureTransportConnected(i,e,r)))}finally{a()}})}negotiate(e){return ne(this,void 0,void 0,function*(){return new li((r,n)=>ne(this,void 0,void 0,function*(){const a=setTimeout(()=>{n(new zf("negotiation timed out"))},this.peerConnectionTimeout),i=()=>{clearTimeout(a),n(new zf("negotiation aborted"))};e.signal.addEventListener("abort",i),this.publisher.once(Gf.NegotiationStarted,()=>{e.signal.aborted||this.publisher.once(Gf.NegotiationComplete,()=>{clearTimeout(a),r()})}),yield this.publisher.negotiate(o=>{clearTimeout(a),o instanceof Error?n(o):n(new Error(String(o)))})}))})}addPublisherTransceiver(e,r){return this.publisher.addTransceiver(e,r)}addPublisherTransceiverOfKind(e,r){return this.publisher.addTransceiverOfKind(e,r)}getMidForReceiver(e){const n=(this.subscriber?this.subscriber.getTransceivers():this.publisher.getTransceivers()).find(a=>a.receiver===e);return n?.mid}addPublisherTrack(e){return this.publisher.addTrack(e)}createPublisherDataChannel(e,r){return this.publisher.createDataChannel(e,r)}getConnectedAddress(e){return e===$s.PUBLISHER?this.publisher.getConnectedAddress():e===$s.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const e=[];return this.isPublisherConnectionRequired&&e.push(this.publisher),this.isSubscriberConnectionRequired&&this.subscriber&&e.push(this.subscriber),e}ensureTransportConnected(e,r){return ne(this,arguments,void 0,function(n,a){var i=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return(function*(){if(n.getConnectionState()!=="connected")return new Promise((u,d)=>ne(i,void 0,void 0,function*(){const f=()=>{this.log.warn("abort transport connection",this.logContext),Ta.clearTimeout(h),d(Gt.cancelled("room connection has been cancelled"))};a?.signal.aborted&&f(),a?.signal.addEventListener("abort",f);const h=Ta.setTimeout(()=>{a?.signal.removeEventListener("abort",f),d(Gt.internal("could not establish pc connection"))},o);for(;this.state!==Pn.CONNECTED;)if(yield Ca(50),a?.signal.aborted){d(Gt.cancelled("room connection has been cancelled"));return}Ta.clearTimeout(h),a?.signal.removeEventListener("abort",f),u()}))})()})}}const Xq=5e3,rde=3e4;class Rr{static fetchRegionSettings(e,r,n){return ne(this,void 0,void 0,function*(){const a=yield Rr.fetchLock.lock();try{const i=yield fetch("".concat(nde(e),"/regions"),{headers:{authorization:"Bearer ".concat(r)},signal:n});if(i.ok){const o=Tue(i.headers),c=o?o*1e3:Xq;return{regionSettings:yield i.json(),updatedAtInMs:Date.now(),maxAgeInMs:c}}else throw i.status===401?Gt.notAllowed("Could not fetch region settings: ".concat(i.statusText),i.status):Gt.internal("Could not fetch region settings: ".concat(i.statusText))}catch(i){throw i instanceof Gt?i:n?.aborted?Gt.cancelled("Region fetching was aborted"):Gt.serverUnreachable("Could not fetch region settings, ".concat(i instanceof Error?"".concat(i.name,": ").concat(i.message):i))}finally{a()}})}static scheduleRefetch(e,r,n){return ne(this,void 0,void 0,function*(){const a=Rr.settingsTimeouts.get(e.hostname);clearTimeout(a),Rr.settingsTimeouts.set(e.hostname,setTimeout(()=>ne(this,void 0,void 0,function*(){try{const i=yield Rr.fetchRegionSettings(e,r);Rr.updateCachedRegionSettings(e,r,i)}catch(i){if(i instanceof Gt&&i.reason===ln.NotAllowed){or.debug("token is not valid, cancelling auto region refresh");return}or.debug("auto refetching of region settings failed",{error:i}),Rr.scheduleRefetch(e,r,n)}}),n))})}static updateCachedRegionSettings(e,r,n){Rr.cache.set(e.hostname,n),Rr.scheduleRefetch(e,r,n.maxAgeInMs)}static stopRefetch(e){const r=Rr.settingsTimeouts.get(e);r&&(clearTimeout(r),Rr.settingsTimeouts.delete(e))}static scheduleCleanup(e){let r=Rr.connectionTrackers.get(e);r&&(r.cleanupTimeout&&clearTimeout(r.cleanupTimeout),r.cleanupTimeout=setTimeout(()=>{const n=Rr.connectionTrackers.get(e);n&&n.connectionCount===0&&(or.debug("stopping region refetch after disconnect delay",{hostname:e}),Rr.stopRefetch(e)),n&&(n.cleanupTimeout=void 0)},rde))}static cancelCleanup(e){const r=Rr.connectionTrackers.get(e);r?.cleanupTimeout&&(clearTimeout(r.cleanupTimeout),r.cleanupTimeout=void 0)}notifyConnected(){const e=this.serverUrl.hostname;let r=Rr.connectionTrackers.get(e);r||(r={connectionCount:0},Rr.connectionTrackers.set(e,r)),r.connectionCount++,Rr.cancelCleanup(e)}notifyDisconnected(){const e=this.serverUrl.hostname,r=Rr.connectionTrackers.get(e);r&&(r.connectionCount=Math.max(0,r.connectionCount-1),r.connectionCount===0&&Rr.scheduleCleanup(e))}constructor(e,r){this.attemptedRegions=[],this.serverUrl=new URL(e),this.token=r}updateToken(e){this.token=e}isCloud(){return up(this.serverUrl)}getServerUrl(){return this.serverUrl}fetchRegionSettings(e){return ne(this,void 0,void 0,function*(){return Rr.fetchRegionSettings(this.serverUrl,this.token,e)})}getNextBestRegionUrl(e){return ne(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");let r=Rr.cache.get(this.serverUrl.hostname);(!r||Date.now()-r.updatedAtInMs>r.maxAgeInMs)&&(r=yield this.fetchRegionSettings(e),Rr.updateCachedRegionSettings(this.serverUrl,this.token,r));const n=r.regionSettings.regions.filter(a=>!this.attemptedRegions.find(i=>i.url===a.url));if(n.length>0){const a=n[0];return this.attemptedRegions.push(a),or.debug("next region: ".concat(a.region)),a.url}else return null})}resetAttempts(){this.attemptedRegions=[]}setServerReportedRegions(e){Rr.updateCachedRegionSettings(this.serverUrl,this.token,e)}}Rr.cache=new Map;Rr.settingsTimeouts=new Map;Rr.connectionTrackers=new Map;Rr.fetchLock=new Wa;function nde(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}let Va=class $u extends Error{constructor(e,r,n){super(r),this.code=e,this.message=qM(r,$u.MAX_MESSAGE_BYTES),this.data=n?qM(n,$u.MAX_DATA_BYTES):void 0}static fromProto(e){return new $u(e.code,e.message,e.data)}toProto(){return new $5({code:this.code,message:this.message,data:this.data})}static builtIn(e,r){return new $u($u.ErrorCode[e],$u.ErrorMessage[e],r)}};Va.MAX_MESSAGE_BYTES=256;Va.MAX_DATA_BYTES=15360;Va.ErrorCode={APPLICATION_ERROR:1500,CONNECTION_TIMEOUT:1501,RESPONSE_TIMEOUT:1502,RECIPIENT_DISCONNECTED:1503,RESPONSE_PAYLOAD_TOO_LARGE:1504,SEND_FAILED:1505,UNSUPPORTED_METHOD:1400,RECIPIENT_NOT_FOUND:1401,REQUEST_PAYLOAD_TOO_LARGE:1402,UNSUPPORTED_SERVER:1403,UNSUPPORTED_VERSION:1404};Va.ErrorMessage={APPLICATION_ERROR:"Application error in method handler",CONNECTION_TIMEOUT:"Connection timeout",RESPONSE_TIMEOUT:"Response timeout",RECIPIENT_DISCONNECTED:"Recipient disconnected",RESPONSE_PAYLOAD_TOO_LARGE:"Response payload too large",SEND_FAILED:"Failed to send",UNSUPPORTED_METHOD:"Method not supported at destination",RECIPIENT_NOT_FOUND:"Recipient not found",REQUEST_PAYLOAD_TOO_LARGE:"Request payload too large",UNSUPPORTED_SERVER:"RPC not supported by server",UNSUPPORTED_VERSION:"Unsupported RPC version"};const Jq=15360;function ZP(t){return new TextEncoder().encode(t).length}function qM(t,e){if(ZP(t)<=e)return t;let r=0,n=t.length;const a=new TextEncoder;for(;r<n;){const i=Math.floor((r+n+1)/2);a.encode(t.slice(0,i)).length<=e?r=i:n=i-1}return t.slice(0,r)}const eA=2e3;function h0(t,e){if(!e)return 0;let r,n;return"bytesReceived"in t?(r=t.bytesReceived,n=e.bytesReceived):"bytesSent"in t&&(r=t.bytesSent,n=e.bytesSent),r===void 0||n===void 0||t.timestamp===void 0||e.timestamp===void 0?0:(r-n)*8*1e3/(t.timestamp-e.timestamp)}const tA=typeof MediaRecorder<"u";class ade{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const ide=tA?MediaRecorder:ade;class sde extends ide{constructor(e,r){if(!tA)throw new Error("MediaRecorder is not available in this environment");super(new MediaStream([e.mediaStreamTrack]),r);let n,a;const i=()=>a===void 0,o=()=>{this.removeEventListener("dataavailable",n),this.removeEventListener("stop",o),this.removeEventListener("error",c),a?.close(),a=void 0},c=u=>{a?.error(u),this.removeEventListener("dataavailable",n),this.removeEventListener("stop",o),this.removeEventListener("error",c),a=void 0};this.byteStream=new ReadableStream({start:u=>{a=u,n=d=>ne(this,void 0,void 0,function*(){let f;if(d.data.arrayBuffer){const h=yield d.data.arrayBuffer();f=new Uint8Array(h)}else if(d.data.byteArray)f=d.data.byteArray;else throw new Error("no data available!");i()||u.enqueue(f)}),this.addEventListener("dataavailable",n)},cancel:()=>{o()}}),this.addEventListener("stop",o),this.addEventListener("error",c)}}function ode(){return tA}const cde=1e3,lde=1e4;class Qq extends Ke{get sender(){return this._sender}set sender(e){this._sender=e}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(e,r,n){let a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,i=arguments.length>4?arguments[4]:void 0;super(e,r,i),this.manuallyStopped=!1,this._isUpstreamPaused=!1,this.handleTrackMuteEvent=()=>this.debouncedTrackMuteHandler().catch(()=>this.log.debug("track mute bounce got cancelled by an unmute event",this.logContext)),this.debouncedTrackMuteHandler=XP(()=>ne(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>ne(this,void 0,void 0,function*(){this.debouncedTrackMuteHandler.cancel("unmute"),yield this.resumeUpstream()}),this.handleEnded=()=>{this.isInBackground&&(this.reacquireTrack=!0),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),this.emit(dt.Ended,this)},this.reacquireTrack=!1,this.providedByUser=a,this.muteLock=new Wa,this.pauseUpstreamLock=new Wa,this.trackChangeLock=new Wa,this.trackChangeLock.lock().then(o=>ne(this,void 0,void 0,function*(){try{yield this.setMediaStreamTrack(e,!0)}finally{o()}})),this._constraints=e.getConstraints(),n&&(this._constraints=n)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==Ke.Kind.Video)return;const{width:e,height:r}=this._mediaStreamTrack.getSettings();if(e&&r)return{width:e,height:r}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var e,r;return(r=(e=this.processor)===null||e===void 0?void 0:e.processedTrack)!==null&&r!==void 0?r:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(e,r){return ne(this,void 0,void 0,function*(){var n;if(e===this._mediaStreamTrack&&!r)return;this._mediaStreamTrack&&(this.attachedElements.forEach(i=>{$f(this._mediaStreamTrack,i)}),this.debouncedTrackMuteHandler.cancel("new-track"),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent)),this.mediaStream=new MediaStream([e]),e&&(e.addEventListener("ended",this.handleEnded),e.addEventListener("mute",this.handleTrackMuteEvent),e.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=e.getConstraints());let a;if(this.processor&&e){if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(Tf(e,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:e,kind:this.kind,element:this.processorElement}),a=this.processor.processedTrack}this.sender&&((n=this.sender.transport)===null||n===void 0?void 0:n.state)!=="closed"&&(yield this.sender.replaceTrack(a??e)),!this.providedByUser&&this._mediaStreamTrack!==e&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=e,e&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(i=>{Tf(a??e,i)}))})}waitForDimensions(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:cde;return(function*(){var n;if(e.kind===Ke.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((n=fi())===null||n===void 0?void 0:n.os)==="iOS"&&(yield Ca(10));const a=Date.now();for(;Date.now()-a<r;){const i=e.dimensions;if(i)return i;yield Ca(50)}throw new Ac("unable to get track dimensions after timeout")})()})}setDeviceId(e){return ne(this,void 0,void 0,function*(){return this._constraints.deviceId===e&&this._mediaStreamTrack.getSettings().deviceId===Vl(e)||(this._constraints.deviceId=e,this.isMuted)?!0:(yield this.restartTrack(),Vl(e)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){if(e.source===Ke.Source.ScreenShare)return;const{deviceId:n,groupId:a}=e._mediaStreamTrack.getSettings(),i=e.kind===Ke.Kind.Audio?"audioinput":"videoinput";return r?fa.getInstance().normalizeDeviceId(i,n,a):n})()})}mute(){return ne(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return ne(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(e,r){return ne(this,void 0,void 0,function*(){const n=yield this.trackChangeLock.lock();try{if(!this.sender)throw new Ac("unable to replace an unpublished track");let a,i;return typeof r=="boolean"?a=r:r!==void 0&&(a=r.userProvidedTrack,i=r.stopProcessor),this.providedByUser=a??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(e),i&&this.processor&&(yield this.internalStopProcessor()),this}finally{n()}})}restart(e){return ne(this,void 0,void 0,function*(){this.manuallyStopped=!1;const r=yield this.trackChangeLock.lock();try{e||(e=this._constraints);const{deviceId:n,facingMode:a}=e,i=Dle(e,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:e}));const o={audio:!1,video:!1};this.kind===Ke.Kind.Video?o.video=n||a?{deviceId:n,facingMode:a}:!0:o.audio=n?Object.assign({deviceId:n},i):!0,this.attachedElements.forEach(d=>{$f(this.mediaStreamTrack,d)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const u=(yield navigator.mediaDevices.getUserMedia(o)).getTracks()[0];return this.kind===Ke.Kind.Video&&(yield u.applyConstraints(i)),u.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(u),this._constraints=e,this.emit(dt.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{r()}})}setTrackMuted(e){this.log.debug("setting ".concat(this.kind," track ").concat(e?"muted":"unmuted"),this.logContext),!(this.isMuted===e&&this._mediaStreamTrack.enabled!==e)&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?dt.Muted:dt.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ne(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),Vq()&&(this.log.debug("visibility changed, is in Background: ".concat(this.isInBackground),this.logContext),!this.isInBackground&&this.needsReAcquisition&&!this.isUserProvided&&!this.isMuted&&(this.log.debug("track needs to be reacquired, restarting ".concat(this.source),this.logContext),yield this.restart(),this.reacquireTrack=!1))})}stop(){var e;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(e=this.processor)===null||e===void 0||e.destroy(),this.processor=void 0}pauseUpstream(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!0)return;if(!this.sender){this.log.warn("unable to pause upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!0,this.emit(dt.UpstreamPaused,this);const n=fi();if(n?.name==="Safari"&&Yo(n.version,"12.0")<0)throw new VP("pauseUpstream is not supported on Safari < 12.");((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{r()}})}resumeUpstream(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.pauseUpstreamLock.lock();try{if(this._isUpstreamPaused===!1)return;if(!this.sender){this.log.warn("unable to resume upstream for an unpublished track",this.logContext);return}this._isUpstreamPaused=!1,this.emit(dt.UpstreamResumed,this),((e=this.sender.transport)===null||e===void 0?void 0:e.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{r()}})}getRTCStatsReport(){return ne(this,void 0,void 0,function*(){var e;return!((e=this.sender)===null||e===void 0)&&e.getStats?yield this.sender.getStats():void 0})}setProcessor(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){var i;const o=yield n.trackChangeLock.lock();try{n.log.debug("setting up processor",n.logContext);const c=document.createElement(n.kind),u={kind:n.kind,track:n._mediaStreamTrack,element:c,audioContext:n.audioContext};if(yield r.init(u),n.log.debug("processor initialized",n.logContext),n.processor&&(yield n.internalStopProcessor()),n.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(Tf(n._mediaStreamTrack,c),c.muted=!0,c.play().catch(d=>{d instanceof DOMException&&d.name==="AbortError"?(n.log.warn("failed to play processor element, retrying",Object.assign(Object.assign({},n.logContext),{error:d})),setTimeout(()=>{c.play().catch(f=>{n.log.error("failed to play processor element",Object.assign(Object.assign({},n.logContext),{err:f}))})},100)):n.log.error("failed to play processor element",Object.assign(Object.assign({},n.logContext),{error:d}))}),n.processor=r,n.processorElement=c,n.processor.processedTrack){for(const d of n.attachedElements)d!==n.processorElement&&a&&($f(n._mediaStreamTrack,d),Tf(n.processor.processedTrack,d));yield(i=n.sender)===null||i===void 0?void 0:i.replaceTrack(n.processor.processedTrack)}n.emit(dt.TrackProcessorUpdate,n.processor)}finally{o()}})()})}getProcessor(){return this.processor}stopProcessor(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){const n=yield e.trackChangeLock.lock();try{yield e.internalStopProcessor(r)}finally{n()}})()})}internalStopProcessor(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){var n,a;e.processor&&(e.log.debug("stopping processor",e.logContext),(n=e.processor.processedTrack)===null||n===void 0||n.stop(),yield e.processor.destroy(),e.processor=void 0,r||((a=e.processorElement)===null||a===void 0||a.remove(),e.processorElement=void 0),yield e._mediaStreamTrack.applyConstraints(e._constraints),yield e.setMediaStreamTrack(e._mediaStreamTrack,!0),e.emit(dt.TrackProcessorUpdate))})()})}startPreConnectBuffer(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!ode()){this.log.warn("MediaRecorder is not available, cannot start preconnect buffer",this.logContext);return}if(this.localTrackRecorder){this.log.warn("preconnect buffer already started");return}else{let r="audio/webm;codecs=opus";MediaRecorder.isTypeSupported(r)||(r="video/mp4"),this.localTrackRecorder=new sde(this,{mimeType:r})}this.localTrackRecorder.start(e),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},lde)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.byteStream}getPreConnectBufferMimeType(){var e;return(e=this.localTrackRecorder)===null||e===void 0?void 0:e.mimeType}}class ub extends Qq{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;super(e,Ke.Kind.Audio,r,n,i),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>ne(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let o;try{o=yield this.getSenderStats()}catch(c){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:c}));return}o&&this.prevStats&&(this._currentBitrate=h0(o,this.prevStats)),this.prevStats=o}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(dt.AudioTrackFeatureUpdate,this,da.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(dt.AudioTrackFeatureUpdate,this,da.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=a,this.checkForSilence()}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return ne(this,void 0,void 0,function*(){const r=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===Ke.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{r()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return ne(this,void 0,void 0,function*(){const r=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const n=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==Vl(this._constraints.deviceId);return this.source===Ke.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||n)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this}finally{r()}})}restartTrack(e){return ne(this,void 0,void 0,function*(){let r;if(e){const n=GP({audio:e});typeof n.audio!="boolean"&&(r=n.audio)}yield this.restart(r)})}restart(e){const r=Object.create(null,{restart:{get:()=>super.restart}});return ne(this,void 0,void 0,function*(){const n=yield r.restart.call(this,e);return this.checkForSilence(),n})}startMonitor(){ui()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},eA)))}setProcessor(e){return ne(this,void 0,void 0,function*(){var r;const n=yield this.trackChangeLock.lock();try{if(!Ko()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.internalStopProcessor());const a={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(e.name),this.logContext),yield e.init(a),this.processor=e,this.processor.processedTrack&&(yield(r=this.sender)===null||r===void 0?void 0:r.replaceTrack(this.processor.processedTrack),this.processor.processedTrack.addEventListener("enable-lk-krisp-noise-filter",this.handleKrispNoiseFilterEnable),this.processor.processedTrack.addEventListener("disable-lk-krisp-noise-filter",this.handleKrispNoiseFilterDisable)),this.emit(dt.TrackProcessorUpdate,this.processor)}finally{n()}})}setAudioContext(e){this.audioContext=e}getSenderStats(){return ne(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return;const r=yield this.sender.getStats();let n;return r.forEach(a=>{a.type==="outbound-rtp"&&(n={type:"audio",streamId:a.id,packetsSent:a.packetsSent,packetsLost:a.packetsLost,bytesSent:a.bytesSent,timestamp:a.timestamp,roundTripTime:a.roundTripTime,jitter:a.jitter})}),n})}checkForSilence(){return ne(this,void 0,void 0,function*(){const e=yield qq(this);return e&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit(dt.AudioSilenceDetected)),e})}}function ude(t,e,r){switch(t.kind){case"audio":return new ub(t,e,!1,void 0,r);case"video":return new db(t,e,!1,r);default:throw new Ac("unsupported track type: ".concat(t.kind))}}const dde=Object.values(lp),fde=Object.values(hC),pde=Object.values(HP),hde=[lp.h180,lp.h360],mde=[hC.h180,hC.h360],gde=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(r=>{var n,a;return new en(Math.floor(t.width/r.scaleResolutionDownBy),Math.floor(t.height/r.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(r.scaleResolutionDownBy,2)*(((n=t.encoding.maxFramerate)!==null&&n!==void 0?n:30)/((a=r.fps)!==null&&a!==void 0?a:30))))),r.fps,t.encoding.priority)}),SC=["q","h","f"];function EC(t,e,r,n){var a,i;let o=n?.videoEncoding;t&&(o=n?.screenShareEncoding);const c=n?.simulcast,u=n?.scalabilityMode,d=n?.videoCodec;if(!o&&!c&&!u||!e||!r)return[{}];o||(o=vde(t,e,r,d),or.debug("using video encoding",o));const f=o.maxFramerate,h=new en(e,r,o.maxBitrate,o.maxFramerate,o.priority);if(u&&Vs(d)){const w=new Zq(u),b=[];if(w.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(u));const E=fi();if(Hm()||Ko()||E?.name==="Chrome"&&Yo(E?.version,"113")<0){const T=w.suffix=="h"?2:3,R=pue(E);for(let P=0;P<w.spatial;P+=1)b.push({rid:SC[2-P],maxBitrate:o.maxBitrate/Math.pow(T,P),maxFramerate:h.encoding.maxFramerate,scaleResolutionDownBy:R?Math.pow(2,P):void 0});b[0].scalabilityMode=u}else b.push({maxBitrate:o.maxBitrate,maxFramerate:h.encoding.maxFramerate,scalabilityMode:u});return h.encoding.priority&&(b[0].priority=h.encoding.priority,b[0].networkPriority=h.encoding.priority),or.debug("using svc encoding",{encodings:b}),b}if(!c)return[o];let m=[];t?m=(a=$M(n?.screenShareSimulcastLayers))!==null&&a!==void 0?a:zM(t,h):m=(i=$M(n?.videoSimulcastLayers))!==null&&i!==void 0?i:zM(t,h);let _;if(m.length>0){const w=m[0];m.length>1&&([,_]=m);const b=Math.max(e,r);if(b>=960&&_)return hE(e,r,[w,_,h],f);if(b>=480)return hE(e,r,[w,h],f)}return hE(e,r,[h])}function yde(t,e,r){var n,a,i,o;if(!r.backupCodec||r.backupCodec===!0||r.backupCodec.codec===r.videoCodec)return;e!==r.backupCodec.codec&&or.warn("requested a different codec than specified as backup",{serverRequested:e,backup:r.backupCodec.codec}),r.videoCodec=e,r.videoEncoding=r.backupCodec.encoding;const c=t.mediaStreamTrack.getSettings(),u=(n=c.width)!==null&&n!==void 0?n:(a=t.dimensions)===null||a===void 0?void 0:a.width,d=(i=c.height)!==null&&i!==void 0?i:(o=t.dimensions)===null||o===void 0?void 0:o.height;return t.source===Ke.Source.ScreenShare&&r.simulcast&&(r.simulcast=!1),EC(t.source===Ke.Source.ScreenShare,u,d,r)}function vde(t,e,r,n){const a=_de(t,e,r);let{encoding:i}=a[0];const o=Math.max(e,r);for(let c=0;c<a.length;c+=1){const u=a[c];if(i=u.encoding,u.width>=o)break}if(n)switch(n){case"av1":case"h265":i=Object.assign({},i),i.maxBitrate=i.maxBitrate*.7;break;case"vp9":i=Object.assign({},i),i.maxBitrate=i.maxBitrate*.85;break}return i}function _de(t,e,r){if(t)return pde;const n=e>r?e/r:r/e;return Math.abs(n-16/9)<Math.abs(n-4/3)?dde:fde}function zM(t,e){if(t)return gde(e);const{width:r,height:n}=e,a=r>n?r/n:n/r;return Math.abs(a-16/9)<Math.abs(a-4/3)?hde:mde}function hE(t,e,r,n){const a=[];if(r.forEach((i,o)=>{if(o>=SC.length)return;const c=Math.min(t,e),d={rid:SC[o],scaleResolutionDownBy:Math.max(1,c/Math.min(i.width,i.height)),maxBitrate:i.encoding.maxBitrate},f=n&&i.encoding.maxFramerate?Math.min(n,i.encoding.maxFramerate):i.encoding.maxFramerate;f&&(d.maxFramerate=f);const h=fd()||o===0;i.encoding.priority&&h&&(d.priority=i.encoding.priority,d.networkPriority=i.encoding.priority),a.push(d)}),Ko()&&Gq()==="ios"){let i;a.forEach(c=>{i?c.maxFramerate&&c.maxFramerate>i&&(i=c.maxFramerate):i=c.maxFramerate});let o=!0;a.forEach(c=>{var u;c.maxFramerate!=i&&(o&&(o=!1,or.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),or.info('Setting framerate of encoding "'.concat((u=c.rid)!==null&&u!==void 0?u:"",'" to ').concat(i)),c.maxFramerate=i)})}return a}function $M(t){if(t)return t.sort((e,r)=>{const{encoding:n}=e,{encoding:a}=r;return n.maxBitrate>a.maxBitrate?1:n.maxBitrate<a.maxBitrate?-1:n.maxBitrate===a.maxBitrate&&n.maxFramerate&&a.maxFramerate?n.maxFramerate>a.maxFramerate?1:-1:0})}class Zq{constructor(e){const r=e.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!r)throw new Error("invalid scalability mode");if(this.spatial=parseInt(r[1]),this.temporal=parseInt(r[2]),r.length>3)switch(r[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=r[3]}}toString(){var e;return"L".concat(this.spatial,"T").concat(this.temporal).concat((e=this.suffix)!==null&&e!==void 0?e:"")}}function bde(t){return t.source===Ke.Source.ScreenShare||t.constraints.height&&Vl(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const kde=5e3;class db extends Qq{get sender(){return this._sender}set sender(e){this._sender=e,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=arguments.length>3?arguments[3]:void 0;super(e,Ke.Kind.Video,r,n,a),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>ne(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let i;try{i=yield this.getSenderStats()}catch(u){this.log.error("could not get video sender stats",Object.assign(Object.assign({},this.logContext),{error:u}));return}const o=new Map(i.map(u=>[u.rid,u])),c=i.some(u=>u.qualityLimitationReason==="cpu");if(c!==this.isCpuConstrained&&(this.isCpuConstrained=c,this.isCpuConstrained&&this.emit(dt.CpuConstrained)),this.prevStats){let u=0;o.forEach((d,f)=>{var h;const m=(h=this.prevStats)===null||h===void 0?void 0:h.get(f);u+=h0(d,m)}),this._currentBitrate=u}this.prevStats=o}),this.senderLock=new Wa}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(e){var r;if(this.signalClient=e,!ui())return;const n=(r=this.sender)===null||r===void 0?void 0:r.getParameters();n&&(this.encodings=n.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},eA))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(e=>{e.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const e=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return ne(this,void 0,void 0,function*(){var r,n,a,i,o;yield e.pauseUpstream.call(this);try{for(var c=!0,u=Pc(this.simulcastCodecs.values()),d;d=yield u.next(),r=d.done,!r;c=!0)i=d.value,c=!1,yield(o=i.sender)===null||o===void 0?void 0:o.replaceTrack(null)}catch(f){n={error:f}}finally{try{!c&&!r&&(a=u.return)&&(yield a.call(u))}finally{if(n)throw n.error}}})}resumeUpstream(){const e=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return ne(this,void 0,void 0,function*(){var r,n,a,i,o;yield e.resumeUpstream.call(this);try{for(var c=!0,u=Pc(this.simulcastCodecs.values()),d;d=yield u.next(),r=d.done,!r;c=!0){i=d.value,c=!1;const f=i;yield(o=f.sender)===null||o===void 0?void 0:o.replaceTrack(f.mediaStreamTrack)}}catch(f){n={error:f}}finally{try{!c&&!r&&(a=u.return)&&(yield a.call(u))}finally{if(n)throw n.error}}})}mute(){const e=Object.create(null,{mute:{get:()=>super.mute}});return ne(this,void 0,void 0,function*(){const r=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===Ke.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield e.mute.call(this),this)}finally{r()}})}unmute(){const e=Object.create(null,{unmute:{get:()=>super.unmute}});return ne(this,void 0,void 0,function*(){const r=yield this.muteLock.lock();try{return this.isMuted?(this.source===Ke.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield e.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{r()}})}setTrackMuted(e){super.setTrackMuted(e);for(const r of this.simulcastCodecs.values())r.mediaStreamTrack.enabled=!e}getSenderStats(){return ne(this,void 0,void 0,function*(){var e;if(!(!((e=this.sender)===null||e===void 0)&&e.getStats))return[];const r=[],n=yield this.sender.getStats();return n.forEach(a=>{var i;if(a.type==="outbound-rtp"){const o={type:"video",streamId:a.id,frameHeight:a.frameHeight,frameWidth:a.frameWidth,framesPerSecond:a.framesPerSecond,framesSent:a.framesSent,firCount:a.firCount,pliCount:a.pliCount,nackCount:a.nackCount,packetsSent:a.packetsSent,bytesSent:a.bytesSent,qualityLimitationReason:a.qualityLimitationReason,qualityLimitationDurations:a.qualityLimitationDurations,qualityLimitationResolutionChanges:a.qualityLimitationResolutionChanges,rid:(i=a.rid)!==null&&i!==void 0?i:a.id,retransmittedPacketsSent:a.retransmittedPacketsSent,targetBitrate:a.targetBitrate,timestamp:a.timestamp},c=n.get(a.remoteId);c&&(o.jitter=c.jitter,o.packetsLost=c.packetsLost,o.roundTripTime=c.roundTripTime),r.push(o)}}),r.sort((a,i)=>{var o,c;return((o=i.frameWidth)!==null&&o!==void 0?o:0)-((c=a.frameWidth)!==null&&c!==void 0?c:0)}),r})}setPublishingQuality(e){const r=[];for(let n=Ii.LOW;n<=Ii.HIGH;n+=1)r.push(new qP({quality:n,enabled:n<=e}));this.log.debug("setting publishing quality. max quality ".concat(e),this.logContext),this.setPublishingLayers(Vs(this.codec),r)}restartTrack(e){return ne(this,void 0,void 0,function*(){var r,n,a,i,o;let c;if(e){const h=GP({video:e});typeof h.video!="boolean"&&(c=h.video)}yield this.restart(c),this.isCpuConstrained=!1;try{for(var u=!0,d=Pc(this.simulcastCodecs.values()),f;f=yield d.next(),r=f.done,!r;u=!0){i=f.value,u=!1;const h=i;h.sender&&((o=h.sender.transport)===null||o===void 0?void 0:o.state)!=="closed"&&(h.mediaStreamTrack=this.mediaStreamTrack.clone(),yield h.sender.replaceTrack(h.mediaStreamTrack))}}catch(h){n={error:h}}finally{try{!u&&!r&&(a=d.return)&&(yield a.call(d))}finally{if(n)throw n.error}}})}setProcessor(e){const r=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return ne(this,arguments,void 0,function(n){var a=this;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){var o,c,u,d,f,h;if(yield r.setProcessor.call(a,n,i),!((f=a.processor)===null||f===void 0)&&f.processedTrack)try{for(var m=!0,_=Pc(a.simulcastCodecs.values()),w;w=yield _.next(),o=w.done,!o;m=!0)d=w.value,m=!1,yield(h=d.sender)===null||h===void 0?void 0:h.replaceTrack(a.processor.processedTrack)}catch(b){c={error:b}}finally{try{!m&&!o&&(u=_.return)&&(yield u.call(_))}finally{if(c)throw c.error}}})()})}setDegradationPreference(e){return ne(this,void 0,void 0,function*(){if(this.degradationPreference=e,this.sender)try{this.log.debug("setting degradationPreference to ".concat(e),this.logContext);const r=this.sender.getParameters();r.degradationPreference=e,this.sender.setParameters(r)}catch(r){this.log.warn("failed to set degradationPreference",Object.assign({error:r},this.logContext))}})}addSimulcastTrack(e,r){if(this.simulcastCodecs.has(e)){this.log.error("".concat(e," already added, skipping adding simulcast codec"),this.logContext);return}const n={codec:e,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:r};return this.simulcastCodecs.set(e,n),n}setSimulcastTrackSender(e,r){const n=this.simulcastCodecs.get(e);n&&(n.sender=r,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},kde))}setPublishingCodecs(e){return ne(this,void 0,void 0,function*(){var r,n,a,i,o,c,u;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:e,currentCodec:this.codec})),!this.codec&&e.length>0)return yield this.setPublishingLayers(Vs(e[0].codec),e[0].qualities),[];this.subscribedCodecs=e;const d=[];try{for(r=!0,n=Pc(e);a=yield n.next(),i=a.done,!i;r=!0){u=a.value,r=!1;const f=u;if(!this.codec||this.codec===f.codec)yield this.setPublishingLayers(Vs(f.codec),f.qualities);else{const h=this.simulcastCodecs.get(f.codec);if(this.log.debug("try setPublishingCodec for ".concat(f.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:h})),!h||!h.sender){for(const m of f.qualities)if(m.enabled){d.push(f.codec);break}}else h.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(f.codec),this.logContext),yield VM(h.sender,h.encodings,f.qualities,this.senderLock,Vs(f.codec),this.log,this.logContext))}}}catch(f){o={error:f}}finally{try{!r&&!i&&(c=n.return)&&(yield c.call(n))}finally{if(o)throw o.error}}return d})}setPublishingLayers(e,r){return ne(this,void 0,void 0,function*(){if(this.optimizeForPerformance){this.log.info("skipping setPublishingLayers due to optimized publishing performance",Object.assign(Object.assign({},this.logContext),{qualities:r}));return}this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:r})),!(!this.sender||!this.encodings)&&(yield VM(this.sender,this.encodings,r,this.senderLock,e,this.log,this.logContext))})}prioritizePerformance(){return ne(this,void 0,void 0,function*(){if(!this.sender)throw new Error("sender not found");const e=yield this.senderLock.lock();try{this.optimizeForPerformance=!0;const r=this.sender.getParameters();r.encodings=r.encodings.map((n,a)=>{var i;return Object.assign(Object.assign({},n),{active:a===0,scaleResolutionDownBy:Math.max(1,Math.ceil(((i=this.mediaStreamTrack.getSettings().height)!==null&&i!==void 0?i:360)/360)),scalabilityMode:a===0&&Vs(this.codec)?"L1T3":void 0,maxFramerate:a===0?15:0,maxBitrate:a===0?n.maxBitrate:0})}),this.log.debug("setting performance optimised encodings",Object.assign(Object.assign({},this.logContext),{encodings:r.encodings})),this.encodings=r.encodings,yield this.sender.setParameters(r)}catch(r){this.log.error("failed to set performance optimised encodings",Object.assign(Object.assign({},this.logContext),{error:r})),this.optimizeForPerformance=!1}finally{e()}})}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ne(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),Vq()&&this.isInBackground&&this.source===Ke.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function VM(t,e,r,n,a,i,o){return ne(this,void 0,void 0,function*(){const c=yield n.lock();i.debug("setPublishingLayersForSender",Object.assign(Object.assign({},o),{sender:t,qualities:r,senderEncodings:e}));try{const u=t.getParameters(),{encodings:d}=u;if(!d)return;if(d.length!==e.length){i.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},o),{encodings:d,senderEncodings:e}));return}let f=!1;!1&&d[0].scalabilityMode||(a&&r.some(_=>_.enabled)&&r.forEach(_=>_.enabled=!0),d.forEach((m,_)=>{var w;let b=(w=m.rid)!==null&&w!==void 0?w:"";b===""&&(b="q");const E=e4(b),T=r.find(R=>R.quality===E);T&&m.active!==T.enabled&&(f=!0,m.active=T.enabled,i.debug("setting layer ".concat(T.quality," to ").concat(m.active?"enabled":"disabled"),o),fd()&&(T.enabled?(m.scaleResolutionDownBy=e[_].scaleResolutionDownBy,m.maxBitrate=e[_].maxBitrate,m.maxFrameRate=e[_].maxFrameRate):(m.scaleResolutionDownBy=4,m.maxBitrate=10,m.maxFrameRate=2)))})),f&&(u.encodings=d,i.debug("setting encodings",Object.assign(Object.assign({},o),{encodings:u.encodings})),yield t.setParameters(u))}finally{c()}})}function e4(t){switch(t){case"f":return Ii.HIGH;case"h":return Ii.MEDIUM;case"q":return Ii.LOW;default:return Ii.HIGH}}function HM(t,e,r,n){if(!r)return[new $l({quality:Ii.HIGH,width:t,height:e,bitrate:0,ssrc:0})];if(n){const a=r[0].scalabilityMode,i=new Zq(a),o=[],c=i.suffix=="h"?1.5:2,u=i.suffix=="h"?2:3;for(let d=0;d<i.spatial;d+=1)o.push(new $l({quality:Math.min(Ii.HIGH,i.spatial-1)-d,width:Math.ceil(t/Math.pow(c,d)),height:Math.ceil(e/Math.pow(c,d)),bitrate:r[0].maxBitrate?Math.ceil(r[0].maxBitrate/Math.pow(u,d)):0,ssrc:0}));return o}return r.map(a=>{var i,o,c;const u=(i=a.scaleResolutionDownBy)!==null&&i!==void 0?i:1;let d=e4((o=a.rid)!==null&&o!==void 0?o:"");return new $l({quality:d,width:Math.ceil(t/u),height:Math.ceil(e/u),bitrate:(c=a.maxBitrate)!==null&&c!==void 0?c:0,ssrc:0})})}const GM="_lossy",WM="_reliable",wde=2*1e3,mE="leave-reconnect",Sde=3e4,Ede=8*1024,Tde=256*1024;var rs;(function(t){t[t.New=0]="New",t[t.Connected=1]="Connected",t[t.Disconnected=2]="Disconnected",t[t.Reconnecting=3]="Reconnecting",t[t.Closed=4]="Closed"})(rs||(rs={}));class Cde extends Qo.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(e){var r;super(),this.options=e,this.rtcConfig={},this.peerConnectionTimeout=QP.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=rs.New,this._isClosed=!0,this.pendingTrackResolvers={},this.reconnectAttempts=0,this.reconnectStart=0,this.attemptingReconnect=!1,this.joinAttempts=0,this.maxJoinAttempts=1,this.shouldFailNext=!1,this.log=or,this.reliableDataSequence=1,this.reliableMessageBuffer=new NM,this.reliableReceivedState=new Gue(Sde),this.lossyDataStatCurrentBytes=0,this.lossyDataStatByterate=0,this.lossyDataDropCount=0,this.midToTrackId={},this.isWaitingForNetworkReconnect=!1,this.handleDataChannel=n=>ne(this,[n],void 0,function(a){var i=this;let{channel:o}=a;return(function*(){if(o){if(o.label===WM)i.reliableDCSub=o;else if(o.label===GM)i.lossyDCSub=o;else return;i.log.debug("on data channel ".concat(o.id,", ").concat(o.label),i.logContext),o.onmessage=i.handleDataMessage}})()}),this.handleDataMessage=n=>ne(this,void 0,void 0,function*(){var a,i,o,c,u;const d=yield this.dataProcessLock.lock();try{let f;if(n.data instanceof ArrayBuffer)f=n.data;else if(n.data instanceof Blob)f=yield n.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:n.data}));return}const h=$a.fromBinary(new Uint8Array(f));if(h.sequence>0&&h.participantSid!==""){const m=this.reliableReceivedState.get(h.participantSid);if(m&&h.sequence<=m)return;this.reliableReceivedState.set(h.participantSid,h.sequence)}if(((a=h.value)===null||a===void 0?void 0:a.case)==="speaker")this.emit(ht.ActiveSpeakersUpdate,h.value.value.speakers);else if(((i=h.value)===null||i===void 0?void 0:i.case)==="encryptedPacket"){if(!this.e2eeManager){this.log.error("Received encrypted packet but E2EE not set up",this.logContext);return}const m=yield(o=this.e2eeManager)===null||o===void 0?void 0:o.handleEncryptedData(h.value.value.encryptedValue,h.value.value.iv,h.participantIdentity,h.value.value.keyIndex),_=F5.fromBinary(m.payload),w=new $a({value:_.value,participantIdentity:h.participantIdentity,participantSid:h.participantSid});((c=w.value)===null||c===void 0?void 0:c.case)==="user"&&KM(w,w.value.value),this.emit(ht.DataPacketReceived,w,h.value.value.encryptionType)}else((u=h.value)===null||u===void 0?void 0:u.case)==="user"&&KM(h,h.value.value),this.emit(ht.DataPacketReceived,h,aa.NONE)}finally{d()}}),this.handleDataError=n=>{const i=n.currentTarget.maxRetransmits===0?"lossy":"reliable";if(n instanceof ErrorEvent&&n.error){const{error:o}=n.error;this.log.error("DataChannel error on ".concat(i,": ").concat(n.message),Object.assign(Object.assign({},this.logContext),{error:o}))}else this.log.error("Unknown DataChannel error on ".concat(i),Object.assign(Object.assign({},this.logContext),{event:n}))},this.handleBufferedAmountLow=n=>{const i=n.currentTarget.maxRetransmits===0?mr.LOSSY:mr.RELIABLE;this.updateAndEmitDCBufferStatus(i)},this.handleDisconnect=(n,a)=>{if(this._isClosed)return;this.log.warn("".concat(n," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const i=u=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(u,"ms. giving up"),this.logContext),this.emit(ht.Disconnected),this.close()},o=Date.now()-this.reconnectStart;let c=this.getNextRetryDelay({elapsedMs:o,retryCount:this.reconnectAttempts});if(c===null){i(o);return}n===mE&&(c=0),this.log.debug("reconnecting in ".concat(c,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Ta.setTimeout(()=>this.attemptReconnect(a).finally(()=>this.reconnectTimeout=void 0),c)},this.waitForRestarted=()=>new Promise((n,a)=>{this.pcState===rs.Connected&&n();const i=()=>{this.off(ht.Disconnected,o),n()},o=()=>{this.off(ht.Restarted,i),a()};this.once(ht.Restarted,i),this.once(ht.Disconnected,o)}),this.updateAndEmitDCBufferStatus=n=>{if(n===mr.RELIABLE){const i=this.dataChannelForKind(n);i&&this.reliableMessageBuffer.alignBufferedAmount(i.bufferedAmount)}const a=this.isBufferStatusLow(n);typeof a<"u"&&a!==this.dcBufferStatus.get(n)&&(this.dcBufferStatus.set(n,a),this.emit(ht.DCBufferStatusChanged,a,n))},this.isBufferStatusLow=n=>{const a=this.dataChannelForKind(n);if(a)return a.bufferedAmount<=a.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>ne(this,void 0,void 0,function*(){!this.url||!(yield fetch(Gm(this.url),{method:"HEAD"}).then(a=>a.ok).catch(()=>!1))||(this.log.info("detected network reconnected"),(this.client.currentState===cn.RECONNECTING||this.isWaitingForNetworkReconnect&&this.client.currentState===cn.CONNECTED)&&(this.clearReconnectTimeout(),this.attemptReconnect(qu.RR_SIGNAL_DISCONNECTED),this.isWaitingForNetworkReconnect=!1))}),this.handleBrowserOffline=()=>ne(this,void 0,void 0,function*(){if(this.url)try{yield Promise.race([fetch(Gm(this.url),{method:"HEAD"}),Ca(4e3).then(()=>Promise.reject())])}catch{window.navigator.onLine===!1&&(this.log.info("detected network interruption"),this.isWaitingForNetworkReconnect=!0)}}),this.log=$c((r=e.loggerName)!==null&&r!==void 0?r:Zs.Engine),this.loggerOptions={loggerName:e.loggerName,loggerContextCb:()=>this.logContext},this.client=new KP(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new Wa,this.dataProcessLock=new Wa,this.dcBufferStatus=new Map([[mr.LOSSY,!0],[mr.RELIABLE,!0]]),this.client.onParticipantUpdate=n=>this.emit(ht.ParticipantUpdate,n),this.client.onConnectionQuality=n=>this.emit(ht.ConnectionQualityUpdate,n),this.client.onRoomUpdate=n=>this.emit(ht.RoomUpdate,n),this.client.onSubscriptionError=n=>this.emit(ht.SubscriptionError,n),this.client.onSubscriptionPermissionUpdate=n=>this.emit(ht.SubscriptionPermissionUpdate,n),this.client.onSpeakersChanged=n=>this.emit(ht.SpeakersChanged,n),this.client.onStreamStateUpdate=n=>this.emit(ht.StreamStateChanged,n),this.client.onRequestResponse=n=>this.emit(ht.SignalRequestResponse,n)}get logContext(){var e,r,n,a,i,o;return{room:(r=(e=this.latestJoinResponse)===null||e===void 0?void 0:e.room)===null||r===void 0?void 0:r.name,roomID:(a=(n=this.latestJoinResponse)===null||n===void 0?void 0:n.room)===null||a===void 0?void 0:a.sid,participant:(o=(i=this.latestJoinResponse)===null||i===void 0?void 0:i.participant)===null||o===void 0?void 0:o.identity,pID:this.participantSid}}join(e,r,n,a){return ne(this,arguments,void 0,function(i,o,c,u){var d=this;let f=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return(function*(){d.url=i,d.token=o,d.signalOpts=c,d.maxJoinAttempts=c.maxRetries;try{d.joinAttempts+=1,d.setupSignalClientCallbacks();const h=yield d.client.join(i,o,c,u,f);return d._isClosed=!1,d.latestJoinResponse=h,d.subscriberPrimary=h.subscriberPrimary,d.pcManager||(yield d.configure(h,!f)),(!d.subscriberPrimary||h.fastPublish)&&d.negotiate().catch(m=>{or.error(m,d.logContext)}),d.registerOnLineListener(),d.clientConfiguration=h.clientConfiguration,d.emit(ht.SignalConnected,h),h}catch(h){if(h instanceof Gt){if(h.reason===ln.ServerUnreachable){if(d.log.warn("Couldn't connect to server, attempt ".concat(d.joinAttempts," of ").concat(d.maxJoinAttempts),d.logContext),d.joinAttempts<d.maxJoinAttempts)return d.join(i,o,c,u,f)}else if(h.reason===ln.ServiceNotFound)return d.log.warn("Initial connection failed: ".concat(h.message," – Retrying")),d.join(i,o,c,u,!0)}throw h}})()})}close(){return ne(this,void 0,void 0,function*(){const e=yield this.closingLock.lock();if(this.isClosed){e();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(ht.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),this.cleanupLossyDataStats(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{e()}})}cleanupPeerConnections(){return ne(this,void 0,void 0,function*(){var e;yield(e=this.pcManager)===null||e===void 0?void 0:e.close(),this.pcManager=void 0;const r=n=>{n&&(n.close(),n.onbufferedamountlow=null,n.onclose=null,n.onclosing=null,n.onerror=null,n.onmessage=null,n.onopen=null)};r(this.lossyDC),r(this.lossyDCSub),r(this.reliableDC),r(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.reliableMessageBuffer=new NM,this.reliableDataSequence=1,this.reliableReceivedState.clear()})}cleanupLossyDataStats(){this.lossyDataStatByterate=0,this.lossyDataStatCurrentBytes=0,this.lossyDataStatInterval&&(clearInterval(this.lossyDataStatInterval),this.lossyDataStatInterval=void 0),this.lossyDataDropCount=0}cleanupClient(){return ne(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(e){if(this.pendingTrackResolvers[e.cid])throw new Ac("a track with the same ID has already been published");return new Promise((r,n)=>{const a=setTimeout(()=>{delete this.pendingTrackResolvers[e.cid],n(Gt.timeout("publication of local track timed out, no response from server"))},1e4);this.pendingTrackResolvers[e.cid]={resolve:i=>{clearTimeout(a),r(i)},reject:()=>{clearTimeout(a),n(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(e)})}removeTrack(e){if(e.track&&this.pendingTrackResolvers[e.track.id]){const{reject:r}=this.pendingTrackResolvers[e.track.id];r&&r(),delete this.pendingTrackResolvers[e.track.id]}try{return this.pcManager.removeTrack(e),!0}catch(r){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:r}))}return!1}updateMuteStatus(e,r){this.client.sendMuteTrack(e,r)}get dataSubscriberReadyState(){var e;return(e=this.reliableDCSub)===null||e===void 0?void 0:e.readyState}getConnectedServerAddress(){return ne(this,void 0,void 0,function*(){var e;return(e=this.pcManager)===null||e===void 0?void 0:e.getConnectedAddress()})}setRegionUrlProvider(e){this.regionUrlProvider=e}configure(e,r){return ne(this,void 0,void 0,function*(){var n,a;if(this.pcManager&&this.pcManager.currentState!==Pn.NEW)return;this.participantSid=(n=e.participant)===null||n===void 0?void 0:n.sid;const i=this.makeRTCConfiguration(e);this.pcManager=new tde(i,r?"publisher-only":e.subscriberPrimary?"subscriber-primary":"publisher-primary",this.loggerOptions),this.emit(ht.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(o,c)=>{this.client.sendIceCandidate(o,c)},this.pcManager.onPublisherOffer=(o,c)=>{this.client.sendOffer(o,c)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(o,c,u)=>ne(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(o),this.logContext),["closed","disconnected","failed"].includes(c)&&(this.publisherConnectionPromise=void 0),o===Pn.CONNECTED){const h=this.pcState===rs.New;this.pcState=rs.Connected,h&&this.emit(ht.Connected,e)}else o===Pn.FAILED&&(this.pcState===rs.Connected||this.pcState===rs.Reconnecting)&&(this.pcState=rs.Disconnected,this.handleDisconnect("peerconnection failed",u==="failed"?qu.RR_SUBSCRIBER_FAILED:qu.RR_PUBLISHER_FAILED));const d=this.client.isDisconnected||this.client.currentState===cn.RECONNECTING,f=[Pn.FAILED,Pn.CLOSING,Pn.CLOSED].includes(o);d&&f&&!this._isClosed&&this.emit(ht.Offline)}),this.pcManager.onTrack=o=>{o.streams.length!==0&&this.emit(ht.MediaTrackAdded,o.track,o.streams[0],o.receiver)},xde((a=e.serverInfo)===null||a===void 0?void 0:a.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=(e,r,n)=>ne(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:e.type,sdp:e.sdp,midToTrackId:n})),this.midToTrackId=n,yield this.pcManager.setPublisherAnswer(e,r))}),this.client.onTrickle=(e,r)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:e,target:r})),this.pcManager.addIceCandidate(e,r))},this.client.onOffer=(e,r,n)=>ne(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=r,!this.pcManager)return;this.midToTrackId=n;const a=yield this.pcManager.createSubscriberAnswerFromOffer(e,r);a&&this.client.sendAnswer(a,r)}),this.client.onLocalTrackPublished=e=>{var r;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:e.cid,track:(r=e.track)===null||r===void 0?void 0:r.sid})),!this.pendingTrackResolvers[e.cid]){this.log.error("missing track resolver for ".concat(e.cid),Object.assign(Object.assign({},this.logContext),{cid:e.cid}));return}const{resolve:n}=this.pendingTrackResolvers[e.cid];delete this.pendingTrackResolvers[e.cid],n(e.track)},this.client.onLocalTrackUnpublished=e=>{this.emit(ht.LocalTrackUnpublished,e)},this.client.onLocalTrackSubscribed=e=>{this.emit(ht.LocalTrackSubscribed,e)},this.client.onTokenRefresh=e=>{var r;this.token=e,(r=this.regionUrlProvider)===null||r===void 0||r.updateToken(e)},this.client.onRemoteMuteChanged=(e,r)=>{this.emit(ht.RemoteMute,e,r)},this.client.onSubscribedQualityUpdate=e=>{this.emit(ht.SubscribedQualityUpdate,e)},this.client.onRoomMoved=e=>{var r;this.participantSid=(r=e.participant)===null||r===void 0?void 0:r.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=e.room),this.emit(ht.RoomMoved,e)},this.client.onMediaSectionsRequirement=e=>{var r,n;const a={direction:"recvonly"};for(let i=0;i<e.numAudios;i++)(r=this.pcManager)===null||r===void 0||r.addPublisherTransceiverOfKind("audio",a);for(let i=0;i<e.numVideos;i++)(n=this.pcManager)===null||n===void 0||n.addPublisherTransceiverOfKind("video",a);this.negotiate()},this.client.onClose=()=>{this.handleDisconnect("signal",qu.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=e=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:e?.reason})),e.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions({updatedAtInMs:Date.now(),maxAgeInMs:Xq,regionSettings:e.regions})),e.action){case Ff.DISCONNECT:this.emit(ht.Disconnected,e?.reason),this.close();break;case Ff.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(mE);break;case Ff.RESUME:this.handleDisconnect(mE)}}}makeRTCConfiguration(e){var r;const n=Object.assign({},this.rtcConfig);if(!((r=this.signalOpts)===null||r===void 0)&&r.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),n.encodedInsertableStreams=!0),e.iceServers&&!n.iceServers){const a=[];e.iceServers.forEach(i=>{const o={urls:i.urls};i.username&&(o.username=i.username),i.credential&&(o.credential=i.credential),a.push(o)}),n.iceServers=a}return e.clientConfiguration&&e.clientConfiguration.forceRelay===zm.ENABLED&&(n.iceTransportPolicy="relay"),n.sdpSemantics="unified-plan",n.continualGatheringPolicy="gather_continually",n}createDataChannels(){this.pcManager&&(this.lossyDC&&(this.lossyDC.onmessage=null,this.lossyDC.onerror=null),this.reliableDC&&(this.reliableDC.onmessage=null,this.reliableDC.onerror=null),this.lossyDC=this.pcManager.createPublisherDataChannel(GM,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(WM,{ordered:!0}),this.lossyDC.onmessage=this.handleDataMessage,this.reliableDC.onmessage=this.handleDataMessage,this.lossyDC.onerror=this.handleDataError,this.reliableDC.onerror=this.handleDataError,this.lossyDC.bufferedAmountLowThreshold=65535,this.reliableDC.bufferedAmountLowThreshold=65535,this.lossyDC.onbufferedamountlow=this.handleBufferedAmountLow,this.reliableDC.onbufferedamountlow=this.handleBufferedAmountLow,this.cleanupLossyDataStats(),this.lossyDataStatInterval=setInterval(()=>{this.lossyDataStatByterate=this.lossyDataStatCurrentBytes,this.lossyDataStatCurrentBytes=0;const e=this.dataChannelForKind(mr.LOSSY);if(e){const r=this.lossyDataStatByterate/10;e.bufferedAmountLowThreshold=Math.min(Math.max(r,Ede),Tde)}},1e3))}createSender(e,r,n){return ne(this,void 0,void 0,function*(){if(yC())return yield this.createTransceiverRTCRtpSender(e,r,n);if(vC())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(e.mediaStreamTrack);throw new Ln("Required webRTC APIs not supported on this device")})}createSimulcastSender(e,r,n,a){return ne(this,void 0,void 0,function*(){if(yC())return this.createSimulcastTransceiverSender(e,r,n,a);if(vC())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(e.mediaStreamTrack);throw new Ln("Cannot stream on this device")})}createTransceiverRTCRtpSender(e,r,n){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("publisher is closed");const a=[];e.mediaStream&&a.push(e.mediaStream),pu(e)&&(e.codec=r.videoCodec);const i={direction:"sendonly",streams:a};return n&&(i.sendEncodings=n),(yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,i)).sender})}createSimulcastTransceiverSender(e,r,n,a){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("publisher is closed");const i={direction:"sendonly"};a&&(i.sendEncodings=a);const o=yield this.pcManager.addPublisherTransceiver(r.mediaStreamTrack,i);if(n.videoCodec)return e.setSimulcastTrackSender(n.videoCodec,o.sender),o.sender})}createRTCRtpSender(e){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("publisher is closed");return this.pcManager.addPublisherTrack(e)})}attemptReconnect(e){return ne(this,void 0,void 0,function*(){var r,n,a;if(!this._isClosed){if(this.attemptingReconnect){or.warn("already attempting reconnect, returning early",this.logContext);return}(((r=this.clientConfiguration)===null||r===void 0?void 0:r.resumeConnection)===zm.DISABLED||((a=(n=this.pcManager)===null||n===void 0?void 0:n.currentState)!==null&&a!==void 0?a:Pn.NEW)===Pn.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(e),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(i){this.reconnectAttempts+=1;let o=!0;i instanceof Ln?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:i})),o=!1):i instanceof uf||(this.fullReconnectOnNext=!0),o?this.handleDisconnect("reconnect",qu.RR_UNKNOWN):(this.log.info("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(Date.now()-this.reconnectStart,"ms. giving up"),this.logContext),this.emit(ht.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(e){try{return this.reconnectPolicy.nextRetryDelayInMs(e)}catch(r){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:r}))}return null}restartConnection(e){return ne(this,void 0,void 0,function*(){var r,n,a;try{if(!this.url||!this.token)throw new Ln("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(ht.Restarting),this.client.isDisconnected||(yield this.client.sendLeave()),yield this.cleanupPeerConnections(),yield this.cleanupClient();let i;try{if(!this.signalOpts)throw this.log.warn("attempted connection restart, without signal options present",this.logContext),new uf;i=yield this.join(e??this.url,this.token,this.signalOpts,void 0,!this.options.singlePeerConnection)}catch(o){throw o instanceof Gt&&o.reason===ln.NotAllowed?new Ln("could not reconnect, token might be expired"):new uf}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(ht.SignalRestarted,i),yield this.waitForPCReconnected(),this.client.currentState!==cn.CONNECTED)throw new uf("Signal connection got severed during reconnect");(r=this.regionUrlProvider)===null||r===void 0||r.resetAttempts(),this.emit(ht.Restarted)}catch(i){const o=yield(n=this.regionUrlProvider)===null||n===void 0?void 0:n.getNextBestRegionUrl();if(o){yield this.restartConnection(o);return}else throw(a=this.regionUrlProvider)===null||a===void 0||a.resetAttempts(),i}})}resumeConnection(e){return ne(this,void 0,void 0,function*(){var r;if(!this.url||!this.token)throw new Ln("could not reconnect, url or token not saved");if(!this.pcManager)throw new Ln("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(ht.Resuming);let n;try{this.setupSignalClientCallbacks(),n=yield this.client.reconnect(this.url,this.token,this.participantSid,e)}catch(a){let i="";throw a instanceof Error&&(i=a.message,this.log.error(a.message,Object.assign(Object.assign({},this.logContext),{error:a}))),a instanceof Gt&&a.reason===ln.NotAllowed?new Ln("could not reconnect, token might be expired"):a instanceof Gt&&a.reason===ln.LeaveRequest?a:new uf(i)}if(this.emit(ht.SignalResumed),n){const a=this.makeRTCConfiguration(n);this.pcManager.updateConfiguration(a),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=n.serverInfo)}else this.log.warn("Did not receive reconnect response",this.logContext);if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(yield this.pcManager.triggerIceRestart(),yield this.waitForPCReconnected(),this.client.currentState!==cn.CONNECTED)throw new uf("Signal connection got severed during reconnect");this.client.setReconnected(),((r=this.reliableDC)===null||r===void 0?void 0:r.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),n?.lastMessageSeq&&this.resendReliableMessagesForResume(n.lastMessageSeq),this.emit(ht.Resumed)})}waitForPCInitialConnection(e,r){return ne(this,void 0,void 0,function*(){if(!this.pcManager)throw new Ln("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(r,e)})}waitForPCReconnected(){return ne(this,void 0,void 0,function*(){this.pcState=rs.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield Ca(wde),!this.pcManager)throw new Ln("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=rs.Connected}catch(e){throw this.pcState=rs.Disconnected,Gt.internal("could not establish PC connection, ".concat(e.message))}})}publishRpcResponse(e,r,n,a){return ne(this,void 0,void 0,function*(){const i=new $a({destinationIdentities:[e],kind:mr.RELIABLE,value:{case:"rpcResponse",value:new LP({requestId:r,value:a?{case:"error",value:a.toProto()}:{case:"payload",value:n??""}})}});yield this.sendDataPacket(i,mr.RELIABLE)})}publishRpcAck(e,r){return ne(this,void 0,void 0,function*(){const n=new $a({destinationIdentities:[e],kind:mr.RELIABLE,value:{case:"rpcAck",value:new jP({requestId:r})}});yield this.sendDataPacket(n,mr.RELIABLE)})}sendDataPacket(e,r){return ne(this,void 0,void 0,function*(){if(yield this.ensurePublisherConnected(r),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){const i=Mue(e);if(i){const o=yield this.e2eeManager.encryptData(i.toBinary());e.value={case:"encryptedPacket",value:new U5({encryptedValue:o.payload,iv:o.iv,keyIndex:o.keyIndex})}}}r===mr.RELIABLE&&(e.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const n=e.toBinary(),a=this.dataChannelForKind(r);if(a){if(r===mr.RELIABLE)yield this.waitForBufferStatusLow(r),this.reliableMessageBuffer.push({data:n,sequence:e.sequence});else{if(!this.isBufferStatusLow(r)){this.lossyDataDropCount+=1,this.lossyDataDropCount%100===0&&this.log.warn("dropping lossy data channel messages, total dropped: ".concat(this.lossyDataDropCount),this.logContext);return}this.lossyDataStatCurrentBytes+=n.byteLength}if(this.attemptingReconnect)return;a.send(n)}this.updateAndEmitDCBufferStatus(r)})}resendReliableMessagesForResume(e){return ne(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(mr.RELIABLE);const r=this.dataChannelForKind(mr.RELIABLE);r&&(this.reliableMessageBuffer.popToSequence(e),this.reliableMessageBuffer.getAll().forEach(n=>{r.send(n.data)})),this.updateAndEmitDCBufferStatus(mr.RELIABLE)})}waitForBufferStatusLow(e){return new li((r,n)=>ne(this,void 0,void 0,function*(){if(this.isBufferStatusLow(e))r();else{const a=()=>n(new Ln("engine closed"));for(this.once(ht.Closing,a);!this.dcBufferStatus.get(e);)yield Ca(10);this.off(ht.Closing,a),r()}}))}ensureDataTransportConnected(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return(function*(){var i;if(!n.pcManager)throw new Ln("PC manager is closed");const o=a?n.pcManager.subscriber:n.pcManager.publisher,c=a?"Subscriber":"Publisher";if(!o)throw Gt.internal("".concat(c," connection not set"));let u=!1;!a&&!n.dataChannelForKind(r,a)&&(n.createDataChannels(),u=!0),!u&&!a&&!n.pcManager.publisher.isICEConnected&&n.pcManager.publisher.getICEConnectionState()!=="checking"&&(u=!0),u&&n.negotiate().catch(h=>{or.error(h,n.logContext)});const d=n.dataChannelForKind(r,a);if(d?.readyState==="open")return;const f=new Date().getTime()+n.peerConnectionTimeout;for(;new Date().getTime()<f;){if(o.isICEConnected&&((i=n.dataChannelForKind(r,a))===null||i===void 0?void 0:i.readyState)==="open")return;yield Ca(50)}throw Gt.internal("could not establish ".concat(c," connection, state: ").concat(o.getICEConnectionState()))})()})}ensurePublisherConnected(e){return ne(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(e,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==Pn.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return ne(this,void 0,void 0,function*(){return new li((e,r)=>ne(this,void 0,void 0,function*(){if(!this.pcManager){r(new zf("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const n=new AbortController,a=()=>{n.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),e()};this.isClosed&&r(new zf("cannot negotiate on closed engine")),this.on(ht.Closing,a),this.pcManager.publisher.once(Gf.RTPVideoPayloadTypes,i=>{const o=new Map;i.forEach(c=>{const u=c.codec.toLowerCase();vue(u)&&o.set(c.payload,u)}),this.emit(ht.RTPVideoMapUpdate,o)});try{yield this.pcManager.negotiate(n),e()}catch(i){i instanceof zf&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",qu.RR_UNKNOWN),i instanceof Error?r(i):r(new Error(String(i)))}finally{this.off(ht.Closing,a)}}))})}dataChannelForKind(e,r){if(r){if(e===mr.LOSSY)return this.lossyDCSub;if(e===mr.RELIABLE)return this.reliableDCSub}else{if(e===mr.LOSSY)return this.lossyDC;if(e===mr.RELIABLE)return this.reliableDC}}sendSyncState(e,r){var n,a,i,o;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const c=this.pcManager.publisher.getLocalDescription(),u=this.pcManager.publisher.getRemoteDescription(),d=(n=this.pcManager.subscriber)===null||n===void 0?void 0:n.getRemoteDescription(),f=(a=this.pcManager.subscriber)===null||a===void 0?void 0:a.getLocalDescription(),h=(o=(i=this.signalOpts)===null||i===void 0?void 0:i.autoSubscribe)!==null&&o!==void 0?o:!0,m=new Array,_=new Array;e.forEach(w=>{w.isDesired!==h&&m.push(w.trackSid),w.isEnabled||_.push(w.trackSid)}),this.client.sendSyncState(new zP({answer:this.pcManager.mode==="publisher-only"?u?Cf({sdp:u.sdp,type:u.type}):void 0:f?Cf({sdp:f.sdp,type:f.type}):void 0,offer:this.pcManager.mode==="publisher-only"?c?Cf({sdp:c.sdp,type:c.type}):void 0:d?Cf({sdp:d.sdp,type:d.type}):void 0,subscription:new d0({trackSids:m,subscribe:!h,participantTracks:[]}),publishTracks:tue(r),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:_,datachannelReceiveStates:this.reliableReceivedState.map((w,b)=>new iq({publisherSid:b,lastSeq:w}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const e=[],r=(n,a)=>{n?.id!==void 0&&n.id!==null&&e.push(new sq({label:n.label,id:n.id,target:a}))};return r(this.dataChannelForKind(mr.LOSSY),$s.PUBLISHER),r(this.dataChannelForKind(mr.RELIABLE),$s.PUBLISHER),r(this.dataChannelForKind(mr.LOSSY,!0),$s.SUBSCRIBER),r(this.dataChannelForKind(mr.RELIABLE,!0),$s.SUBSCRIBER),e}clearReconnectTimeout(){this.reconnectTimeout&&Ta.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){ui()&&(window.addEventListener("online",this.handleBrowserOnLine),window.addEventListener("offline",this.handleBrowserOffline))}deregisterOnLineListener(){ui()&&(window.removeEventListener("online",this.handleBrowserOnLine),window.removeEventListener("offline",this.handleBrowserOffline))}getTrackIdForReceiver(e){var r;const n=(r=this.pcManager)===null||r===void 0?void 0:r.getMidForReceiver(e);if(n){const a=Object.entries(this.midToTrackId).find(i=>{let[o]=i;return o===n});if(a)return a[1]}}}function xde(t){return t!==void 0&&t>13}function KM(t,e){const r=t.participantIdentity?t.participantIdentity:e.participantIdentity;t.participantIdentity=r,e.participantIdentity=r;const n=t.destinationIdentities.length!==0?t.destinationIdentities:e.destinationIdentities;t.destinationIdentities=n,e.destinationIdentities=n}class t4{get info(){return this._info}validateBytesReceived(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(typeof this.totalByteSize!="number"||this.totalByteSize===0)){if(e&&this.bytesReceived<this.totalByteSize)throw new as("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),za.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new as("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),za.LengthExceeded)}}constructor(e,r,n,a){this.reader=r,this.totalByteSize=n,this._info=e,this.bytesReceived=0,this.outOfBandFailureRejectingFuture=a}}class Pde extends t4{handleChunkReceived(e){var r;this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const n=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(r=this.onProgress)===null||r===void 0||r.call(this,n)}[Symbol.asyncIterator](){const e=this.reader.getReader();let r=new ds,n=null,a=null;if(this.signal){const o=this.signal;a=()=>{var c;(c=r.reject)===null||c===void 0||c.call(r,o.reason)},o.addEventListener("abort",a),n=o}const i=()=>{e.releaseLock(),n&&a&&n.removeEventListener("abort",a),this.signal=void 0};return{next:()=>ne(this,void 0,void 0,function*(){var o,c;try{const{done:u,value:d}=yield Promise.race([e.read(),r.promise,(c=(o=this.outOfBandFailureRejectingFuture)===null||o===void 0?void 0:o.promise)!==null&&c!==void 0?c:new Promise(()=>{})]);return u?(this.validateBytesReceived(!0),{done:!0,value:void 0}):(this.handleChunkReceived(d),{done:!1,value:d.content})}catch(u){throw i(),u}}),return(){return ne(this,void 0,void 0,function*(){return i(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(function*(){var n,a,i,o;let c=new Set;const u=r.signal?e.withAbortSignal(r.signal):e;try{for(var d=!0,f=Pc(u),h;h=yield f.next(),n=h.done,!n;d=!0){o=h.value,d=!1;const m=o;c.add(m)}}catch(m){a={error:m}}finally{try{!d&&!n&&(i=f.return)&&(yield i.call(f))}finally{if(a)throw a.error}}return Array.from(c)})()})}}class Ade extends t4{constructor(e,r,n,a){super(e,r,n,a),this.receivedChunks=new Map}handleChunkReceived(e){var r;const n=m_(e.chunkIndex),a=this.receivedChunks.get(n);if(a&&a.version>e.version)return;this.receivedChunks.set(n,e),this.bytesReceived+=e.content.byteLength,this.validateBytesReceived();const i=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(r=this.onProgress)===null||r===void 0||r.call(this,i)}[Symbol.asyncIterator](){const e=this.reader.getReader(),r=new TextDecoder("utf-8",{fatal:!0});let n=new ds,a=null,i=null;if(this.signal){const c=this.signal;i=()=>{var u;(u=n.reject)===null||u===void 0||u.call(n,c.reason)},c.addEventListener("abort",i),a=c}const o=()=>{e.releaseLock(),a&&i&&a.removeEventListener("abort",i),this.signal=void 0};return{next:()=>ne(this,void 0,void 0,function*(){var c,u;try{const{done:d,value:f}=yield Promise.race([e.read(),n.promise,(u=(c=this.outOfBandFailureRejectingFuture)===null||c===void 0?void 0:c.promise)!==null&&u!==void 0?u:new Promise(()=>{})]);if(d)return this.validateBytesReceived(!0),{done:!0,value:void 0};{this.handleChunkReceived(f);let h;try{h=r.decode(f.content)}catch(m){throw new as("Cannot decode datastream chunk ".concat(f.chunkIndex," as text: ").concat(m),za.DecodeFailed)}return{done:!1,value:h}}}catch(d){throw o(),d}}),return(){return ne(this,void 0,void 0,function*(){return o(),{done:!0,value:void 0}})}}}withAbortSignal(e){return this.signal=e,this}readAll(){return ne(this,arguments,void 0,function(){var e=this;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(function*(){var n,a,i,o;let c="";const u=r.signal?e.withAbortSignal(r.signal):e;try{for(var d=!0,f=Pc(u),h;h=yield f.next(),n=h.done,!n;d=!0)o=h.value,d=!1,c+=o}catch(m){a={error:m}}finally{try{!d&&!n&&(i=f.return)&&(yield i.call(f))}finally{if(a)throw a.error}}return c})()})}}class Rde{constructor(){this.log=or,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map}registerTextStreamHandler(e,r){if(this.textStreamHandlers.has(e))throw new as('A text stream handler for topic "'.concat(e,'" has already been set.'),za.HandlerAlreadyRegistered);this.textStreamHandlers.set(e,r)}unregisterTextStreamHandler(e){this.textStreamHandlers.delete(e)}registerByteStreamHandler(e,r){if(this.byteStreamHandlers.has(e))throw new as('A byte stream handler for topic "'.concat(e,'" has already been set.'),za.HandlerAlreadyRegistered);this.byteStreamHandlers.set(e,r)}unregisterByteStreamHandler(e){this.byteStreamHandlers.delete(e)}clearControllers(){this.byteStreamControllers.clear(),this.textStreamControllers.clear()}validateParticipantHasNoActiveDataStreams(e){var r,n,a,i;const o=Array.from(this.textStreamControllers.entries()).filter(u=>u[1].sendingParticipantIdentity===e),c=Array.from(this.byteStreamControllers.entries()).filter(u=>u[1].sendingParticipantIdentity===e);if(o.length>0||c.length>0){const u=new as("Participant ".concat(e," unexpectedly disconnected in the middle of sending data"),za.AbnormalEnd);for(const[d,f]of c)(n=(r=f.outOfBandFailureRejectingFuture).reject)===null||n===void 0||n.call(r,u),this.byteStreamControllers.delete(d);for(const[d,f]of o)(i=(a=f.outOfBandFailureRejectingFuture).reject)===null||i===void 0||i.call(a,u),this.textStreamControllers.delete(d)}}handleDataStreamPacket(e,r){return ne(this,void 0,void 0,function*(){switch(e.value.case){case"streamHeader":return this.handleStreamHeader(e.value.value,e.participantIdentity,r);case"streamChunk":return this.handleStreamChunk(e.value.value,r);case"streamTrailer":return this.handleStreamTrailer(e.value.value,r);default:throw new Error('DataPacket of value "'.concat(e.value.case,'" is not data stream related!'))}})}handleStreamHeader(e,r,n){return ne(this,void 0,void 0,function*(){var a;if(e.contentHeader.case==="byteHeader"){const i=this.byteStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming byte stream due to no handler for topic",e.topic);return}let o;const c=new ds;c.promise.catch(f=>{this.log.error(f)});const u={id:e.streamId,name:(a=e.contentHeader.value.name)!==null&&a!==void 0?a:"unknown",mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:m_(e.timestamp),attributes:e.attributes,encryptionType:n},d=new ReadableStream({start:f=>{if(o=f,this.textStreamControllers.has(e.streamId))throw new as("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),za.AlreadyOpened);this.byteStreamControllers.set(e.streamId,{info:u,controller:o,startTime:Date.now(),sendingParticipantIdentity:r,outOfBandFailureRejectingFuture:c})}});i(new Pde(u,d,m_(e.totalLength),c),{identity:r})}else if(e.contentHeader.case==="textHeader"){const i=this.textStreamHandlers.get(e.topic);if(!i){this.log.debug("ignoring incoming text stream due to no handler for topic",e.topic);return}let o;const c=new ds;c.promise.catch(f=>{this.log.error(f)});const u={id:e.streamId,mimeType:e.mimeType,size:e.totalLength?Number(e.totalLength):void 0,topic:e.topic,timestamp:Number(e.timestamp),attributes:e.attributes,encryptionType:n},d=new ReadableStream({start:f=>{if(o=f,this.textStreamControllers.has(e.streamId))throw new as("A data stream read is already in progress for a stream with id ".concat(e.streamId,"."),za.AlreadyOpened);this.textStreamControllers.set(e.streamId,{info:u,controller:o,startTime:Date.now(),sendingParticipantIdentity:r,outOfBandFailureRejectingFuture:c})}});i(new Ade(u,d,m_(e.totalLength),c),{identity:r})}})}handleStreamChunk(e,r){const n=this.byteStreamControllers.get(e.streamId);n&&(n.info.encryptionType!==r?(n.controller.error(new as("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(n.info.encryptionType),za.EncryptionTypeMismatch)),this.byteStreamControllers.delete(e.streamId)):e.content.length>0&&n.controller.enqueue(e));const a=this.textStreamControllers.get(e.streamId);a&&(a.info.encryptionType!==r?(a.controller.error(new as("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(a.info.encryptionType),za.EncryptionTypeMismatch)),this.textStreamControllers.delete(e.streamId)):e.content.length>0&&a.controller.enqueue(e))}handleStreamTrailer(e,r){const n=this.textStreamControllers.get(e.streamId);n&&(n.info.encryptionType!==r?n.controller.error(new as("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(n.info.encryptionType),za.EncryptionTypeMismatch)):(n.info.attributes=Object.assign(Object.assign({},n.info.attributes),e.attributes),n.controller.close(),this.textStreamControllers.delete(e.streamId)));const a=this.byteStreamControllers.get(e.streamId);a&&(a.info.encryptionType!==r?a.controller.error(new as("Encryption type mismatch for stream ".concat(e.streamId,". Expected ").concat(r,", got ").concat(a.info.encryptionType),za.EncryptionTypeMismatch)):(a.info.attributes=Object.assign(Object.assign({},a.info.attributes),e.attributes),a.controller.close()),this.byteStreamControllers.delete(e.streamId))}}class r4{constructor(e,r,n){this.writableStream=e,this.defaultWriter=e.getWriter(),this.onClose=n,this.info=r}write(e){return this.defaultWriter.write(e)}close(){return ne(this,void 0,void 0,function*(){var e;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(e=this.onClose)===null||e===void 0||e.call(this)})}}class Dde extends r4{}class Ode extends r4{}const YM=15e3;class Nde{constructor(e,r){this.engine=e,this.log=r}setupEngine(e){this.engine=e}sendText(e,r){return ne(this,void 0,void 0,function*(){var n;const a=crypto.randomUUID(),o=new TextEncoder().encode(e).byteLength,c=(n=r?.attachments)===null||n===void 0?void 0:n.map(()=>crypto.randomUUID()),u=new Array(c?c.length+1:1).fill(0),d=(h,m)=>{var _;u[m]=h;const w=u.reduce((b,E)=>b+E,0);(_=r?.onProgress)===null||_===void 0||_.call(r,w)},f=yield this.streamText({streamId:a,totalSize:o,destinationIdentities:r?.destinationIdentities,topic:r?.topic,attachedStreamIds:c,attributes:r?.attributes});return yield f.write(e),d(1,0),yield f.close(),r?.attachments&&c&&(yield Promise.all(r.attachments.map((h,m)=>ne(this,void 0,void 0,function*(){return this._sendFile(c[m],h,{topic:r.topic,mimeType:h.type,onProgress:_=>{d(_,m+1)}})})))),f.info})}streamText(e){return ne(this,void 0,void 0,function*(){var r,n,a;const i=(r=e?.streamId)!==null&&r!==void 0?r:crypto.randomUUID(),o={id:i,mimeType:"text/plain",timestamp:Date.now(),topic:(n=e?.topic)!==null&&n!==void 0?n:"",size:e?.totalSize,attributes:e?.attributes,encryptionType:!((a=this.engine.e2eeManager)===null||a===void 0)&&a.isDataChannelEncryptionEnabled?aa.GCM:aa.NONE},c=new sb({streamId:i,mimeType:o.mimeType,topic:o.topic,timestamp:zu(o.timestamp),totalLength:zu(e?.totalSize),attributes:o.attributes,contentHeader:{case:"textHeader",value:new J5({version:e?.version,attachedStreamIds:e?.attachedStreamIds,replyToStreamId:e?.replyToStreamId,operationType:e?.type==="update"?nC.UPDATE:nC.CREATE})}}),u=e?.destinationIdentities,d=new $a({destinationIdentities:u,value:{case:"streamHeader",value:c}});yield this.engine.sendDataPacket(d,mr.RELIABLE);let f=0;const h=this.engine,m=new WritableStream({write(b){return ne(this,void 0,void 0,function*(){for(const E of Eue(b,YM)){const T=new ob({content:E,streamId:i,chunkIndex:zu(f)}),R=new $a({destinationIdentities:u,value:{case:"streamChunk",value:T}});yield h.sendDataPacket(R,mr.RELIABLE),f+=1}})},close(){return ne(this,void 0,void 0,function*(){const b=new cb({streamId:i}),E=new $a({destinationIdentities:u,value:{case:"streamTrailer",value:b}});yield h.sendDataPacket(E,mr.RELIABLE)})},abort(b){}});let _=()=>ne(this,void 0,void 0,function*(){yield w.close()});h.once(ht.Closing,_);const w=new Dde(m,o,()=>this.engine.off(ht.Closing,_));return w})}sendFile(e,r){return ne(this,void 0,void 0,function*(){const n=crypto.randomUUID();return yield this._sendFile(n,e,r),{id:n}})}_sendFile(e,r,n){return ne(this,void 0,void 0,function*(){var a;const i=yield this.streamBytes({streamId:e,totalSize:r.size,name:r.name,mimeType:(a=n?.mimeType)!==null&&a!==void 0?a:r.type,topic:n?.topic,destinationIdentities:n?.destinationIdentities}),o=r.stream().getReader();for(;;){const{done:c,value:u}=yield o.read();if(c)break;yield i.write(u)}return yield i.close(),i.info})}streamBytes(e){return ne(this,void 0,void 0,function*(){var r,n,a,i,o,c;const u=(r=e?.streamId)!==null&&r!==void 0?r:crypto.randomUUID(),d=e?.destinationIdentities,f={id:u,mimeType:(n=e?.mimeType)!==null&&n!==void 0?n:"application/octet-stream",topic:(a=e?.topic)!==null&&a!==void 0?a:"",timestamp:Date.now(),attributes:e?.attributes,size:e?.totalSize,name:(i=e?.name)!==null&&i!==void 0?i:"unknown",encryptionType:!((o=this.engine.e2eeManager)===null||o===void 0)&&o.isDataChannelEncryptionEnabled?aa.GCM:aa.NONE},h=new sb({totalLength:zu((c=f.size)!==null&&c!==void 0?c:0),mimeType:f.mimeType,streamId:u,topic:f.topic,timestamp:zu(Date.now()),attributes:f.attributes,contentHeader:{case:"byteHeader",value:new Q5({name:f.name})}}),m=new $a({destinationIdentities:d,value:{case:"streamHeader",value:h}});yield this.engine.sendDataPacket(m,mr.RELIABLE);let _=0;const w=new Wa,b=this.engine,E=this.log,T=new WritableStream({write(P){return ne(this,void 0,void 0,function*(){const A=yield w.lock();let C=0;try{for(;C<P.byteLength;){const O=P.slice(C,C+YM),I=new $a({destinationIdentities:d,value:{case:"streamChunk",value:new ob({content:O,streamId:u,chunkIndex:zu(_)})}});yield b.sendDataPacket(I,mr.RELIABLE),_+=1,C+=O.byteLength}}finally{A()}})},close(){return ne(this,void 0,void 0,function*(){const P=new cb({streamId:u}),A=new $a({destinationIdentities:d,value:{case:"streamTrailer",value:P}});yield b.sendDataPacket(A,mr.RELIABLE)})},abort(P){E.error("Sink error:",P)}});return new Ode(T,f)})}}class n4 extends Ke{constructor(e,r,n,a,i){super(e,n,i),this.sid=r,this.receiver=a}get isLocal(){return!1}setMuted(e){this.isMuted!==e&&(this.isMuted=e,this._mediaStreamTrack.enabled=!e,this.emit(e?dt.Muted:dt.Unmuted,this))}setMediaStream(e){this.mediaStream=e;const r=n=>{n.track===this._mediaStreamTrack&&(e.removeEventListener("removetrack",r),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(dt.Ended,this))};e.addEventListener("removetrack",r)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return ne(this,void 0,void 0,function*(){var e;return!((e=this.receiver)===null||e===void 0)&&e.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(e){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=e:this.log.warn("Playout delay not supported in this browser"):this.log.warn("Cannot set playout delay, track already ended")}getPlayoutDelay(){if(this.receiver){if("playoutDelayHint"in this.receiver)return this.receiver.playoutDelayHint;this.log.warn("Playout delay not supported in this browser")}else this.log.warn("Cannot get playout delay, track already ended");return 0}startMonitor(){this.monitorInterval||(this.monitorInterval=setInterval(()=>this.monitorReceiver(),eA)),rue()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const e=()=>{var r;this.timeSyncHandle=requestAnimationFrame(()=>e());const n=(r=this.receiver)===null||r===void 0?void 0:r.getSynchronizationSources()[0];if(n){const{timestamp:a,rtpTimestamp:i}=n;i&&this.rtpTimestamp!==i&&(this.emit(dt.TimeSyncUpdate,{timestamp:a,rtpTimestamp:i}),this.rtpTimestamp=i)}};e()}}class Ide extends n4{constructor(e,r,n,a,i,o){super(e,r,Ke.Kind.Audio,n,o),this.monitorReceiver=()=>ne(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const c=yield this.getReceiverStats();c&&this.prevStats&&this.receiver&&(this._currentBitrate=h0(c,this.prevStats)),this.prevStats=c}),this.audioContext=a,this.webAudioPluginNodes=[],i&&(this.sinkId=i.deviceId)}setVolume(e){var r;for(const n of this.attachedElements)this.audioContext?(r=this.gainNode)===null||r===void 0||r.gain.setTargetAtTime(e,0,.1):n.volume=e;Ko()&&this._mediaStreamTrack._setVolume(e),this.elementVolume=e}getVolume(){if(this.elementVolume)return this.elementVolume;if(Ko())return 1;let e=0;return this.attachedElements.forEach(r=>{r.volume>e&&(e=r.volume)}),e}setSinkId(e){return ne(this,void 0,void 0,function*(){this.sinkId=e,yield Promise.all(this.attachedElements.map(r=>{if(_C(r))return r.setSinkId(e)}))})}attach(e){const r=this.attachedElements.length===0;return e?super.attach(e):e=super.attach(),this.sinkId&&_C(e)&&e.setSinkId(this.sinkId).catch(n=>{this.log.error("Failed to set sink id on remote audio track",n,this.logContext)}),this.audioContext&&r&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,e),e.volume=0,e.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),e}detach(e){let r;return e?(r=super.detach(e),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(r=super.detach(),this.disconnectWebAudio()),r}setAudioContext(e){this.audioContext=e,e&&this.attachedElements.length>0?this.connectWebAudio(e,this.attachedElements[0]):e||this.disconnectWebAudio()}setWebAudioPlugins(e){this.webAudioPluginNodes=e,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(e,r){this.disconnectWebAudio(),this.sourceNode=e.createMediaStreamSource(r.srcObject);let n=this.sourceNode;this.webAudioPluginNodes.forEach(a=>{n.connect(a),n=a}),this.gainNode=e.createGain(),n.connect(this.gainNode),this.gainNode.connect(e.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),e.state!=="running"&&e.resume().then(()=>{e.state!=="running"&&this.emit(dt.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(a=>{this.emit(dt.AudioPlaybackFailed,a)})}disconnectWebAudio(){var e,r;(e=this.gainNode)===null||e===void 0||e.disconnect(),(r=this.sourceNode)===null||r===void 0||r.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return ne(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let r;return e.forEach(n=>{n.type==="inbound-rtp"&&(r={type:"audio",streamId:n.id,timestamp:n.timestamp,jitter:n.jitter,bytesReceived:n.bytesReceived,concealedSamples:n.concealedSamples,concealmentEvents:n.concealmentEvents,silentConcealedSamples:n.silentConcealedSamples,silentConcealmentEvents:n.silentConcealmentEvents,totalAudioEnergy:n.totalAudioEnergy,totalSamplesDuration:n.totalSamplesDuration})}),r})}}const gE=100;class Mde extends n4{constructor(e,r,n,a,i){super(e,r,Ke.Kind.Video,n,i),this.elementInfos=[],this.monitorReceiver=()=>ne(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const o=yield this.getReceiverStats();o&&this.prevStats&&this.receiver&&(this._currentBitrate=h0(o,this.prevStats)),this.prevStats=o}),this.debouncedHandleResize=XP(()=>{this.updateDimensions()},gE),this.adaptiveStreamSettings=a}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}setStreamState(e){super.setStreamState(e),this.log.debug("setStreamState",e),this.isAdaptiveStream&&e===Ke.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(e){super.setMuted(e),this.attachedElements.forEach(r=>{e?$f(this._mediaStreamTrack,r):Tf(this._mediaStreamTrack,r)})}attach(e){if(e?super.attach(e):e=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(r=>r.element===e)===void 0){const r=new jde(e);this.observeElementInfo(r)}return e}observeElementInfo(e){this.adaptiveStreamSettings&&this.elementInfos.find(r=>r===e)===void 0?(e.handleResize=()=>{this.debouncedHandleResize()},e.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(e),e.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(e){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const r=this.elementInfos.filter(n=>n===e);for(const n of r)n.stopObserving();this.elementInfos=this.elementInfos.filter(n=>n!==e),this.updateVisibility(),this.debouncedHandleResize()}detach(e){let r=[];if(e)return this.stopObservingElement(e),super.detach(e);r=super.detach();for(const n of r)this.stopObservingElement(n);return r}getDecoderImplementation(){var e;return(e=this.prevStats)===null||e===void 0?void 0:e.decoderImplementation}getReceiverStats(){return ne(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const e=yield this.receiver.getStats();let r,n="",a=new Map;return e.forEach(i=>{i.type==="inbound-rtp"?(n=i.codecId,r={type:"video",streamId:i.id,framesDecoded:i.framesDecoded,framesDropped:i.framesDropped,framesReceived:i.framesReceived,packetsReceived:i.packetsReceived,packetsLost:i.packetsLost,frameWidth:i.frameWidth,frameHeight:i.frameHeight,pliCount:i.pliCount,firCount:i.firCount,nackCount:i.nackCount,jitter:i.jitter,timestamp:i.timestamp,bytesReceived:i.bytesReceived,decoderImplementation:i.decoderImplementation}):i.type==="codec"&&a.set(i.id,i)}),r&&n!==""&&a.get(n)&&(r.mimeType=a.get(n).mimeType),r})}stopObservingElement(e){const r=this.elementInfos.filter(n=>n.element===e);for(const n of r)this.stopObservingElementInfo(n)}handleAppVisibilityChanged(){const e=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return ne(this,void 0,void 0,function*(){yield e.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(e){var r,n;const a=this.elementInfos.reduce((u,d)=>Math.max(u,d.visibilityChangedAt||0),0),i=!((n=(r=this.adaptiveStreamSettings)===null||r===void 0?void 0:r.pauseVideoInBackground)!==null&&n!==void 0)||n?this.isInBackground:!1,o=this.elementInfos.some(u=>u.pictureInPicture),c=this.elementInfos.some(u=>u.visible)&&!i||o;if(!(this.lastVisible===c&&!e)){if(!c&&Date.now()-a<gE){Ta.setTimeout(()=>{this.updateVisibility()},gE);return}this.lastVisible=c,this.emit(dt.VisibilityChanged,c,this)}}updateDimensions(){var e,r;let n=0,a=0;const i=this.getPixelDensity();for(const o of this.elementInfos){const c=o.width()*i,u=o.height()*i;c+u>n+a&&(n=c,a=u)}((e=this.lastDimensions)===null||e===void 0?void 0:e.width)===n&&((r=this.lastDimensions)===null||r===void 0?void 0:r.height)===a||(this.lastDimensions={width:n,height:a},this.emit(dt.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var e;const r=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pixelDensity;return r==="screen"?SM():r||(SM()>2?2:1)}}class jde{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(e,r){this.onVisibilityChanged=n=>{var a;const{target:i,isIntersecting:o}=n;i===this.element&&(this.isIntersecting=o,this.isPiP=Oh(this.element),this.visibilityChangedAt=Date.now(),(a=this.handleVisibilityChanged)===null||a===void 0||a.call(this))},this.onEnterPiP=()=>{var n,a,i;(a=(n=window.documentPictureInPicture)===null||n===void 0?void 0:n.window)===null||a===void 0||a.addEventListener("pagehide",this.onLeavePiP),this.isPiP=Oh(this.element),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this)},this.onLeavePiP=()=>{var n;this.isPiP=Oh(this.element),(n=this.handleVisibilityChanged)===null||n===void 0||n.call(this)},this.element=e,this.isIntersecting=r??TC(e),this.isPiP=ui()&&Oh(e),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var e,r,n;this.isIntersecting=TC(this.element),this.isPiP=Oh(this.element),this.element.handleResize=()=>{var a;(a=this.handleResize)===null||a===void 0||a.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,TM().observe(this.element),EM().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(e=window.documentPictureInPicture)===null||e===void 0||e.addEventListener("enter",this.onEnterPiP),(n=(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window)===null||n===void 0||n.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var e,r,n,a,i;(e=TM())===null||e===void 0||e.unobserve(this.element),(r=EM())===null||r===void 0||r.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(n=window.documentPictureInPicture)===null||n===void 0||n.removeEventListener("enter",this.onEnterPiP),(i=(a=window.documentPictureInPicture)===null||a===void 0?void 0:a.window)===null||i===void 0||i.removeEventListener("pagehide",this.onLeavePiP)}}function Oh(t){var e,r;return document.pictureInPictureElement===t?!0:!((e=window.documentPictureInPicture)===null||e===void 0)&&e.window?TC(t,(r=window.documentPictureInPicture)===null||r===void 0?void 0:r.window):!1}function TC(t,e){const r=e||window;let n=t.offsetTop,a=t.offsetLeft;const i=t.offsetWidth,o=t.offsetHeight,{hidden:c}=t,{display:u}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,n+=t.offsetTop,a+=t.offsetLeft;return n<r.pageYOffset+r.innerHeight&&a<r.pageXOffset+r.innerWidth&&n+o>r.pageYOffset&&a+i>r.pageXOffset&&!c&&u!=="none"}class Ec extends Qo.EventEmitter{constructor(e,r,n,a){var i;super(),this.metadataMuted=!1,this.encryption=aa.NONE,this.log=or,this.handleMuted=()=>{this.emit(dt.Muted)},this.handleUnmuted=()=>{this.emit(dt.Unmuted)},this.log=$c((i=a?.loggerName)!==null&&i!==void 0?i:Zs.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=e,this.trackSid=r,this.trackName=n,this.source=Ke.Source.Unknown}setTrack(e){this.track&&(this.track.off(dt.Muted,this.handleMuted),this.track.off(dt.Unmuted,this.handleUnmuted)),this.track=e,e&&(e.on(dt.Muted,this.handleMuted),e.on(dt.Unmuted,this.handleUnmuted))}get logContext(){var e;return Object.assign(Object.assign({},(e=this.loggerContextCb)===null||e===void 0?void 0:e.call(this)),vr(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==aa.NONE}get audioTrack(){if(Fo(this.track))return this.track}get videoTrack(){if(pu(this.track))return this.track}updateInfo(e){this.trackSid=e.sid,this.trackName=e.name,this.source=Ke.sourceFromProto(e.source),this.mimeType=e.mimeType,this.kind===Ke.Kind.Video&&e.width>0&&(this.dimensions={width:e.width,height:e.height},this.simulcasted=e.simulcast),this.encryption=e.encryption,this.trackInfo=e,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:e}))}}(function(t){(function(e){e.Desired="desired",e.Subscribed="subscribed",e.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),(function(e){e.Allowed="allowed",e.NotAllowed="not_allowed"})(t.PermissionStatus||(t.PermissionStatus={}))})(Ec||(Ec={}));class CC extends Ec{get isUpstreamPaused(){var e;return(e=this.track)===null||e===void 0?void 0:e.isUpstreamPaused}constructor(e,r,n,a){super(e,r.sid,r.name,a),this.track=void 0,this.handleTrackEnded=()=>{this.emit(dt.Ended)},this.handleCpuConstrained=()=>{this.track&&pu(this.track)&&this.emit(dt.CpuConstrained,this.track)},this.updateInfo(r),this.setTrack(n)}setTrack(e){this.track&&(this.track.off(dt.Ended,this.handleTrackEnded),this.track.off(dt.CpuConstrained,this.handleCpuConstrained)),super.setTrack(e),e&&(e.on(dt.Ended,this.handleTrackEnded),e.on(dt.CpuConstrained,this.handleCpuConstrained))}get isMuted(){return this.track?this.track.isMuted:super.isMuted}get audioTrack(){return super.audioTrack}get videoTrack(){return super.videoTrack}get isLocal(){return!0}mute(){return ne(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.mute()})}unmute(){return ne(this,void 0,void 0,function*(){var e;return(e=this.track)===null||e===void 0?void 0:e.unmute()})}pauseUpstream(){return ne(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.pauseUpstream()})}resumeUpstream(){return ne(this,void 0,void 0,function*(){var e;yield(e=this.track)===null||e===void 0?void 0:e.resumeUpstream()})}getTrackFeatures(){var e;if(Fo(this.track)){const r=this.track.getSourceTrackSettings(),n=new Set;return r.autoGainControl&&n.add(da.TF_AUTO_GAIN_CONTROL),r.echoCancellation&&n.add(da.TF_ECHO_CANCELLATION),r.noiseSuppression&&n.add(da.TF_NOISE_SUPPRESSION),r.channelCount&&r.channelCount>1&&n.add(da.TF_STEREO),!((e=this.options)===null||e===void 0)&&e.dtx||n.add(da.TF_NO_DTX),this.track.enhancedNoiseCancellation&&n.add(da.TF_ENHANCED_NOISE_CANCELLATION),Array.from(n.values())}else return[]}}function m0(t,e){return ne(this,void 0,void 0,function*(){t??(t={});let r=!1;const{audioProcessor:n,videoProcessor:a,optionsWithoutProcessor:i}=$q(t);let o=i.audio,c=i.video;if(n&&typeof i.audio=="object"&&(i.audio.processor=n),a&&typeof i.video=="object"&&(i.video.processor=a),t.audio&&typeof i.audio=="object"&&typeof i.audio.deviceId=="string"){const h=i.audio.deviceId;i.audio.deviceId={exact:h},r=!0,o=Object.assign(Object.assign({},i.audio),{deviceId:{ideal:h}})}if(i.video&&typeof i.video=="object"&&typeof i.video.deviceId=="string"){const h=i.video.deviceId;i.video.deviceId={exact:h},r=!0,c=Object.assign(Object.assign({},i.video),{deviceId:{ideal:h}})}i.audio===!0?i.audio={deviceId:"default"}:typeof i.audio=="object"&&i.audio!==null&&(i.audio=Object.assign(Object.assign({},i.audio),{deviceId:i.audio.deviceId||"default"})),i.video===!0?i.video={deviceId:"default"}:typeof i.video=="object"&&!i.video.deviceId&&(i.video.deviceId="default");const u=Fq(i,Kq,Yq),d=GP(u),f=navigator.mediaDevices.getUserMedia(d);i.audio&&(fa.userMediaPromiseMap.set("audioinput",f),f.catch(()=>fa.userMediaPromiseMap.delete("audioinput"))),i.video&&(fa.userMediaPromiseMap.set("videoinput",f),f.catch(()=>fa.userMediaPromiseMap.delete("videoinput")));try{const h=yield f;return yield Promise.all(h.getTracks().map(m=>ne(this,void 0,void 0,function*(){const _=m.kind==="audio";let w=_?u.audio:u.video;(typeof w=="boolean"||!w)&&(w={});let b;const E=_?d.audio:d.video;typeof E!="boolean"&&(b=E);const T=m.getSettings().deviceId;b?.deviceId&&Vl(b.deviceId)!==T?b.deviceId=T:b||(b={deviceId:T});const R=ude(m,b,e);return R.kind===Ke.Kind.Video?R.source=Ke.Source.Camera:R.kind===Ke.Kind.Audio&&(R.source=Ke.Source.Microphone),R.mediaStream=h,Fo(R)&&n?yield R.setProcessor(n):pu(R)&&a&&(yield R.setProcessor(a)),R})))}catch(h){if(!r)throw h;return m0(Object.assign(Object.assign({},t),{audio:o,video:c}),e)}})}function Lde(t){return ne(this,void 0,void 0,function*(){return(yield m0({audio:!1,video:!0}))[0]})}function Bde(t){return ne(this,void 0,void 0,function*(){return(yield m0({audio:!0,video:!1}))[0]})}var Dl;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(Dl||(Dl={}));function Ude(t){switch(t){case Xh.EXCELLENT:return Dl.Excellent;case Xh.GOOD:return Dl.Good;case Xh.POOR:return Dl.Poor;case Xh.LOST:return Dl.Lost;default:return Dl.Unknown}}class a4 extends Qo.EventEmitter{get logContext(){var e,r;return Object.assign({},(r=(e=this.loggerOptions)===null||e===void 0?void 0:e.loggerContextCb)===null||r===void 0?void 0:r.call(e))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(e=>e.isEncrypted)}get isAgent(){var e;return((e=this.permissions)===null||e===void 0?void 0:e.agent)||this.kind===$m.AGENT}get isActive(){var e;return((e=this.participantInfo)===null||e===void 0?void 0:e.state)===Uf.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(e,r,n,a,i,o){let c=arguments.length>6&&arguments[6]!==void 0?arguments[6]:$m.STANDARD;var u;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=Dl.Unknown,this.log=or,this.log=$c((u=o?.loggerName)!==null&&u!==void 0?u:Zs.Participant),this.loggerOptions=o,this.setMaxListeners(100),this.sid=e,this.identity=r,this.name=n,this.metadata=a,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=c,this._attributes=i??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(e){for(const[,r]of this.trackPublications)if(r.source===e)return r}getTrackPublicationByName(e){for(const[,r]of this.trackPublications)if(r.trackName===e)return r}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new ds,this.once(yt.Active,()=>{var e,r;(r=(e=this.activeFuture)===null||e===void 0?void 0:e.resolve)===null||r===void 0||r.call(e),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var e;const r=this.getTrackPublication(Ke.Source.Camera);return!(!((e=r?.isMuted)!==null&&e!==void 0)||e)}get isMicrophoneEnabled(){var e;const r=this.getTrackPublication(Ke.Source.Microphone);return!(!((e=r?.isMuted)!==null&&e!==void 0)||e)}get isScreenShareEnabled(){return!!this.getTrackPublication(Ke.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(e){var r;return this.participantInfo&&this.participantInfo.sid===e.sid&&this.participantInfo.version>e.version?!1:(this.identity=e.identity,this.sid=e.sid,this._setName(e.name),this._setMetadata(e.metadata),this._setAttributes(e.attributes),e.state===Uf.ACTIVE&&((r=this.participantInfo)===null||r===void 0?void 0:r.state)!==Uf.ACTIVE&&this.emit(yt.Active),e.permission&&this.setPermissions(e.permission),this.participantInfo=e,!0)}_setMetadata(e){const r=this.metadata!==e,n=this.metadata;this.metadata=e,r&&this.emit(yt.ParticipantMetadataChanged,n)}_setName(e){const r=this.name!==e;this.name=e,r&&this.emit(yt.ParticipantNameChanged,e)}_setAttributes(e){const r=nue(this.attributes,e);this._attributes=e,Object.keys(r).length>0&&this.emit(yt.AttributesChanged,r)}setPermissions(e){var r,n,a,i,o,c;const u=this.permissions,d=e.canPublish!==((r=this.permissions)===null||r===void 0?void 0:r.canPublish)||e.canSubscribe!==((n=this.permissions)===null||n===void 0?void 0:n.canSubscribe)||e.canPublishData!==((a=this.permissions)===null||a===void 0?void 0:a.canPublishData)||e.hidden!==((i=this.permissions)===null||i===void 0?void 0:i.hidden)||e.recorder!==((o=this.permissions)===null||o===void 0?void 0:o.recorder)||e.canPublishSources.length!==this.permissions.canPublishSources.length||e.canPublishSources.some((f,h)=>{var m;return f!==((m=this.permissions)===null||m===void 0?void 0:m.canPublishSources[h])})||e.canSubscribeMetrics!==((c=this.permissions)===null||c===void 0?void 0:c.canSubscribeMetrics);return this.permissions=e,d&&this.emit(yt.ParticipantPermissionsChanged,u),d}setIsSpeaking(e){e!==this.isSpeaking&&(this.isSpeaking=e,e&&(this.lastSpokeAt=new Date),this.emit(yt.IsSpeakingChanged,e))}setConnectionQuality(e){const r=this._connectionQuality;this._connectionQuality=Ude(e),r!==this._connectionQuality&&this.emit(yt.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var e,r;this.activeFuture&&((r=(e=this.activeFuture).reject)===null||r===void 0||r.call(e,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(e){this.audioContext=e,this.audioTrackPublications.forEach(r=>Fo(r.track)&&r.track.setAudioContext(e))}addTrackPublication(e){e.on(dt.Muted,()=>{this.emit(yt.TrackMuted,e)}),e.on(dt.Unmuted,()=>{this.emit(yt.TrackUnmuted,e)});const r=e;switch(r.track&&(r.track.sid=e.trackSid),this.trackPublications.set(e.trackSid,e),e.kind){case Ke.Kind.Audio:this.audioTrackPublications.set(e.trackSid,e);break;case Ke.Kind.Video:this.videoTrackPublications.set(e.trackSid,e);break}}}function Fde(t){var e,r,n;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new nq({participantIdentity:(e=t.participantIdentity)!==null&&e!==void 0?e:"",participantSid:(r=t.participantSid)!==null&&r!==void 0?r:"",allTracks:(n=t.allowAll)!==null&&n!==void 0?n:!1,trackSids:t.allowedTrackSids||[]})}class qde extends a4{constructor(e,r,n,a,i,o){super(e,r,void 0,void 0,void 0,{loggerName:a.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=aa.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new ds)},this.handleReconnected=()=>{var c,u;(u=(c=this.reconnectFuture)===null||c===void 0?void 0:c.resolve)===null||u===void 0||u.call(c),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleClosing=()=>{var c,u,d,f,h,m;this.reconnectFuture&&(this.reconnectFuture.promise.catch(_=>this.log.warn(_.message,this.logContext)),(u=(c=this.reconnectFuture)===null||c===void 0?void 0:c.reject)===null||u===void 0||u.call(c,new Error("Got disconnected during reconnection attempt")),this.reconnectFuture=void 0),this.signalConnectedFuture&&((f=(d=this.signalConnectedFuture).reject)===null||f===void 0||f.call(d,new Error("Got disconnected without signal connected")),this.signalConnectedFuture=void 0),(m=(h=this.activeAgentFuture)===null||h===void 0?void 0:h.reject)===null||m===void 0||m.call(h,new Error("Got disconnected without active agent present")),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=c=>{var u,d;c.participant&&this.updateInfo(c.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new ds),(d=(u=this.signalConnectedFuture).resolve)===null||d===void 0||d.call(u)},this.handleSignalRequestResponse=c=>{const{requestId:u,reason:d,message:f}=c,h=this.pendingSignalRequests.get(u);h&&(d!==$P.OK&&h.reject(new vM(f,d)),this.pendingSignalRequests.delete(u))},this.handleDataPacket=c=>{switch(c.value.case){case"rpcResponse":let u=c.value.value,d=null,f=null;u.value.case==="payload"?d=u.value.value:u.value.case==="error"&&(f=Va.fromProto(u.value.value)),this.handleIncomingRpcResponse(u.requestId,d,f);break;case"rpcAck":let h=c.value.value;this.handleIncomingRpcAck(h.requestId);break}},this.updateTrackSubscriptionPermissions=()=>{this.log.debug("updating track subscription permissions",Object.assign(Object.assign({},this.logContext),{allParticipantsAllowed:this.allParticipantsAllowedToSubscribe,participantTrackPermissions:this.participantTrackPermissions})),this.engine.client.sendUpdateSubscriptionPermissions(this.allParticipantsAllowedToSubscribe,this.participantTrackPermissions.map(c=>Fde(c)))},this.onTrackUnmuted=c=>{this.onTrackMuted(c,c.isUpstreamPaused)},this.onTrackMuted=(c,u)=>{if(u===void 0&&(u=!0),!c.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),vr(c)));return}this.engine.updateMuteStatus(c.sid,u)},this.onTrackUpstreamPaused=c=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),vr(c))),this.onTrackMuted(c,!0)},this.onTrackUpstreamResumed=c=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),vr(c))),this.onTrackMuted(c,c.isMuted)},this.onTrackFeatureUpdate=c=>{const u=this.audioTrackPublications.get(c.sid);if(!u){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(c.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(u.trackSid,u.getTrackFeatures())},this.onTrackCpuConstrained=(c,u)=>{this.log.debug("track cpu constrained",Object.assign(Object.assign({},this.logContext),vr(u))),this.emit(yt.LocalTrackCpuConstrained,c,u)},this.handleSubscribedQualityUpdate=c=>ne(this,void 0,void 0,function*(){var u,d,f,h,m;if(!(!((m=this.roomOptions)===null||m===void 0)&&m.dynacast))return;const _=this.videoTrackPublications.get(c.trackSid);if(!_){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:c.trackSid}));return}if(!_.videoTrack)return;const w=yield _.videoTrack.setPublishingCodecs(c.subscribedCodecs);try{for(var b=!0,E=Pc(w),T;T=yield E.next(),u=T.done,!u;b=!0){h=T.value,b=!1;const R=h;Qle(R)&&(this.log.debug("publish ".concat(R," for ").concat(_.videoTrack.sid),Object.assign(Object.assign({},this.logContext),vr(_))),yield this.publishAdditionalCodecForTrack(_.videoTrack,R,_.options))}}catch(R){d={error:R}}finally{try{!b&&!u&&(f=E.return)&&(yield f.call(E))}finally{if(d)throw d.error}}}),this.handleLocalTrackUnpublished=c=>{const u=this.trackPublications.get(c.trackSid);if(!u){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:c.trackSid}));return}this.unpublishTrack(u.track)},this.handleTrackEnded=c=>ne(this,void 0,void 0,function*(){if(c.source===Ke.Source.ScreenShare||c.source===Ke.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),vr(c))),this.unpublishTrack(c);else if(c.isUserProvided)yield c.mute();else if(Sc(c)||El(c))try{if(ui())try{const u=yield navigator?.permissions.query({name:c.source===Ke.Source.Camera?"camera":"microphone"});if(u&&u.state==="denied")throw this.log.warn("user has revoked access to ".concat(c.source),Object.assign(Object.assign({},this.logContext),vr(c))),u.onchange=()=>{u.state!=="denied"&&(c.isMuted||c.restartTrack(),u.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}c.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),vr(c))),Sc(c)?yield c.restartTrack({deviceId:"default"}):yield c.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),vr(c))),yield c.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=n,this.roomOptions=a,this.setupEngine(n),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=i,this.roomOutgoingDataStreamManager=o}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==aa.NONE}getTrackPublication(e){const r=super.getTrackPublication(e);if(r)return r}getTrackPublicationByName(e){const r=super.getTrackPublicationByName(e);if(r)return r}setupEngine(e){var r;this.engine=e,this.engine.on(ht.RemoteMute,(n,a)=>{const i=this.trackPublications.get(n);!i||!i.track||(a?i.mute():i.unmute())}),!((r=this.signalConnectedFuture)===null||r===void 0)&&r.isResolved&&(this.signalConnectedFuture=void 0),this.engine.on(ht.Connected,this.handleReconnected).on(ht.SignalConnected,this.handleSignalConnected).on(ht.SignalRestarted,this.handleReconnected).on(ht.SignalResumed,this.handleReconnected).on(ht.Restarting,this.handleReconnecting).on(ht.Resuming,this.handleReconnecting).on(ht.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(ht.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(ht.Closing,this.handleClosing).on(ht.SignalRequestResponse,this.handleSignalRequestResponse).on(ht.DataPacketReceived,this.handleDataPacket)}setMetadata(e){return ne(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:e})})}setName(e){return ne(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:e})})}setAttributes(e){return ne(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:e})})}requestMetadataUpdate(e){return ne(this,arguments,void 0,function(r){var n=this;let{metadata:a,name:i,attributes:o}=r;return(function*(){return new li((c,u)=>ne(n,void 0,void 0,function*(){var d,f;try{let h=!1;const m=yield this.engine.client.sendUpdateLocalMetadata((d=a??this.metadata)!==null&&d!==void 0?d:"",(f=i??this.name)!==null&&f!==void 0?f:"",o),_=performance.now();for(this.pendingSignalRequests.set(m,{resolve:c,reject:w=>{u(w),h=!0},values:{name:i,metadata:a,attributes:o}});performance.now()-_<5e3&&!h;){if((!i||this.name===i)&&(!a||this.metadata===a)&&(!o||Object.entries(o).every(w=>{let[b,E]=w;return this.attributes[b]===E||E===""&&!this.attributes[b]}))){this.pendingSignalRequests.delete(m),c();return}yield Ca(50)}u(new vM("Request to update local metadata timed out","TimeoutError"))}catch(h){h instanceof Error?u(h):u(new Error(String(h)))}}))})()})}setCameraEnabled(e,r,n){return this.setTrackEnabled(Ke.Source.Camera,e,r,n)}setMicrophoneEnabled(e,r,n){return this.setTrackEnabled(Ke.Source.Microphone,e,r,n)}setScreenShareEnabled(e,r,n){return this.setTrackEnabled(Ke.Source.ScreenShare,e,r,n)}setE2EEEnabled(e){return ne(this,void 0,void 0,function*(){this.encryptionType=e?aa.GCM:aa.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(e,r,n,a){return ne(this,void 0,void 0,function*(){var i,o;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:e,enabled:r})),this.republishPromise&&(yield this.republishPromise);let c=this.getTrackPublication(e);if(r)if(c)yield c.unmute();else{let u;if(this.pendingPublishing.has(e)){const d=yield this.waitForPendingPublicationOfSource(e);return d||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e})),yield d?.unmute(),d}this.pendingPublishing.add(e);try{switch(e){case Ke.Source.Camera:u=yield this.createTracks({video:(i=n)!==null&&i!==void 0?i:!0});break;case Ke.Source.Microphone:u=yield this.createTracks({audio:(o=n)!==null&&o!==void 0?o:!0});break;case Ke.Source.ScreenShare:u=yield this.createScreenTracks(Object.assign({},n));break;default:throw new Ac(e)}}catch(d){throw u?.forEach(f=>{f.stop()}),d instanceof Error&&this.emit(yt.MediaDevicesError,d,gC(e)),this.pendingPublishing.delete(e),d}for(const d of u){const f=Object.assign(Object.assign({},this.roomOptions.publishDefaults),n);e===Ke.Source.Microphone&&Fo(d)&&f.preConnectBuffer&&(this.log.info("starting preconnect buffer for microphone",Object.assign({},this.logContext)),d.startPreConnectBuffer())}try{const d=[];for(const h of u)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),vr(h))),d.push(this.publishTrack(h,a));[c]=yield Promise.all(d)}catch(d){throw u?.forEach(f=>{f.stop()}),d}finally{this.pendingPublishing.delete(e)}}else if(!c?.track&&this.pendingPublishing.has(e)&&(c=yield this.waitForPendingPublicationOfSource(e),c||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:e}))),c&&c.track)if(e===Ke.Source.ScreenShare){c=yield this.unpublishTrack(c.track);const u=this.getTrackPublication(Ke.Source.ScreenShareAudio);u&&u.track&&this.unpublishTrack(u.track)}else yield c.mute();return c})}enableCameraAndMicrophone(){return ne(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(Ke.Source.Camera)||this.pendingPublishing.has(Ke.Source.Microphone))){this.pendingPublishing.add(Ke.Source.Camera),this.pendingPublishing.add(Ke.Source.Microphone);try{const e=yield this.createTracks({audio:!0,video:!0});yield Promise.all(e.map(r=>this.publishTrack(r)))}finally{this.pendingPublishing.delete(Ke.Source.Camera),this.pendingPublishing.delete(Ke.Source.Microphone)}}})}createTracks(e){return ne(this,void 0,void 0,function*(){var r,n;e??(e={});const a=Fq(e,(r=this.roomOptions)===null||r===void 0?void 0:r.audioCaptureDefaults,(n=this.roomOptions)===null||n===void 0?void 0:n.videoCaptureDefaults);try{return(yield m0(a,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(c=>(Fo(c)&&(this.microphoneError=void 0,c.setAudioContext(this.audioContext),c.source=Ke.Source.Microphone,this.emit(yt.AudioStreamAcquired)),pu(c)&&(this.cameraError=void 0,c.source=Ke.Source.Camera),c))}catch(i){throw i instanceof Error&&(e.audio&&(this.microphoneError=i),e.video&&(this.cameraError=i)),i}})}createScreenTracks(e){return ne(this,void 0,void 0,function*(){if(e===void 0&&(e={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new VP("getDisplayMedia not supported");e.resolution===void 0&&!fue()&&(e.resolution=HP.h1080fps30.resolution);const r=eue(e),n=yield navigator.mediaDevices.getDisplayMedia(r),a=n.getVideoTracks();if(a.length===0)throw new Ac("no video track found");const i=new db(a[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});i.source=Ke.Source.ScreenShare,e.contentHint&&(i.mediaStreamTrack.contentHint=e.contentHint);const o=[i];if(n.getAudioTracks().length>0){this.emit(yt.AudioStreamAcquired);const c=new ub(n.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});c.source=Ke.Source.ScreenShareAudio,o.push(c)}return o})}publishTrack(e,r){return ne(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(e,r)})}publishOrRepublishTrack(e,r){return ne(this,arguments,void 0,function(n,a){var i=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return(function*(){var c,u,d,f;Sc(n)&&n.setAudioContext(i.audioContext),yield(c=i.reconnectFuture)===null||c===void 0?void 0:c.promise,i.republishPromise&&!o&&(yield i.republishPromise),Vf(n)&&i.pendingPublishPromises.has(n)&&(yield i.pendingPublishPromises.get(n));let h;if(n instanceof MediaStreamTrack)h=n.getConstraints();else{h=n.constraints;let T;switch(n.source){case Ke.Source.Microphone:T="audioinput";break;case Ke.Source.Camera:T="videoinput"}T&&i.activeDeviceMap.has(T)&&(h=Object.assign(Object.assign({},h),{deviceId:i.activeDeviceMap.get(T)}))}if(n instanceof MediaStreamTrack)switch(n.kind){case"audio":n=new ub(n,h,!0,i.audioContext,{loggerName:i.roomOptions.loggerName,loggerContextCb:()=>i.logContext});break;case"video":n=new db(n,h,!0,{loggerName:i.roomOptions.loggerName,loggerContextCb:()=>i.logContext});break;default:throw new Ac("unsupported MediaStreamTrack kind ".concat(n.kind))}else n.updateLoggerOptions({loggerName:i.roomOptions.loggerName,loggerContextCb:()=>i.logContext});let m;if(i.trackPublications.forEach(T=>{T.track&&T.track===n&&(m=T)}),m)return i.log.warn("track has already been published, skipping",Object.assign(Object.assign({},i.logContext),vr(m))),m;const _=Object.assign(Object.assign({},i.roomOptions.publishDefaults),a),w="channelCount"in n.mediaStreamTrack.getSettings()&&n.mediaStreamTrack.getSettings().channelCount===2||n.mediaStreamTrack.getConstraints().channelCount===2,b=(u=_.forceStereo)!==null&&u!==void 0?u:w;b&&(_.dtx===void 0&&i.log.info("Opus DTX will be disabled for stereo tracks by default. Enable them explicitly to make it work.",Object.assign(Object.assign({},i.logContext),vr(n))),_.red===void 0&&i.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(d=_.dtx)!==null&&d!==void 0||(_.dtx=!1),(f=_.red)!==null&&f!==void 0||(_.red=!1)),!hue()&&i.roomOptions.e2ee&&(i.log.info("End-to-end encryption is set up, simulcast publishing will be disabled on Safari versions and iOS browsers running iOS < v17.2",Object.assign({},i.logContext)),_.simulcast=!1),_.source&&(n.source=_.source);const E=new Promise((T,R)=>ne(i,void 0,void 0,function*(){try{if(this.engine.client.currentState!==cn.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:vr(n)}));let P=!1;const A=setTimeout(()=>{P=!0,n.stop(),R(new yM("publishing rejected as engine not connected within timeout",408))},15e3);if(yield this.waitUntilEngineConnected(),clearTimeout(A),P)return;const C=yield this.publish(n,_,b);T(C)}else try{const P=yield this.publish(n,_,b);T(P)}catch(P){R(P)}}catch(P){R(P)}}));i.pendingPublishPromises.set(n,E);try{return yield E}catch(T){throw T}finally{i.pendingPublishPromises.delete(n)}})()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new ds),this.signalConnectedFuture.promise}hasPermissionsToPublish(e){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),vr(e))),!1;const{canPublish:r,canPublishSources:n}=this.permissions;return r&&(n.length===0||n.map(a=>aue(a)).includes(e.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),vr(e))),!1)}publish(e,r,n){return ne(this,void 0,void 0,function*(){var a,i,o,c,u,d,f,h,m,_;if(!this.hasPermissionsToPublish(e))throw new yM("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(D=>Vf(e)&&D.source===e.source)&&e.source!==Ke.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(e.source),Object.assign(Object.assign({},this.logContext),vr(e))),r.stopMicTrackOnMute&&Fo(e)&&(e.stopOnMute=!0),e.source===Ke.Source.ScreenShare&&fd()&&(r.simulcast=!1),r.videoCodec==="av1"&&!lue()&&(r.videoCodec=void 0),r.videoCodec==="vp9"&&!uue()&&(r.videoCodec=void 0),r.videoCodec===void 0&&(r.videoCodec=wC),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(D=>r.videoCodec===hm(D.mime))||(r.videoCodec=hm(this.enabledPublishVideoCodecs[0].mime)));const b=r.videoCodec;e.on(dt.Muted,this.onTrackMuted),e.on(dt.Unmuted,this.onTrackUnmuted),e.on(dt.Ended,this.handleTrackEnded),e.on(dt.UpstreamPaused,this.onTrackUpstreamPaused),e.on(dt.UpstreamResumed,this.onTrackUpstreamResumed),e.on(dt.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const E=[],T=!(!((a=r.dtx)!==null&&a!==void 0)||a),R=e.getSourceTrackSettings();R.autoGainControl&&E.push(da.TF_AUTO_GAIN_CONTROL),R.echoCancellation&&E.push(da.TF_ECHO_CANCELLATION),R.noiseSuppression&&E.push(da.TF_NOISE_SUPPRESSION),R.channelCount&&R.channelCount>1&&E.push(da.TF_STEREO),T&&E.push(da.TF_NO_DTX),Sc(e)&&e.hasPreConnectBuffer&&E.push(da.TF_PRECONNECT_BUFFER);const P=new Vm({cid:e.mediaStreamTrack.id,name:r.name,type:Ke.kindToProto(e.kind),muted:e.isMuted,source:Ke.sourceToProto(e.source),disableDtx:T,encryption:this.encryptionType,stereo:n,disableRed:this.isE2EEEnabled||!(!((i=r.red)!==null&&i!==void 0)||i),stream:r?.stream,backupCodecPolicy:r?.backupCodecPolicy,audioFeatures:E});let A;if(e.kind===Ke.Kind.Video){let D={width:0,height:0};try{D=yield e.waitForDimensions()}catch{const L=(c=(o=this.roomOptions.videoCaptureDefaults)===null||o===void 0?void 0:o.resolution)!==null&&c!==void 0?c:lp.h720.resolution;D={width:L.width,height:L.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{dims:D}))}P.width=D.width,P.height=D.height,El(e)&&(Vs(b)&&(e.source===Ke.Source.ScreenShare&&(r.scalabilityMode="L1T3","contentHint"in e.mediaStreamTrack&&(e.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),vr(e))))),r.scalabilityMode=(u=r.scalabilityMode)!==null&&u!==void 0?u:"L3T3_KEY"),P.simulcastCodecs=[new iC({codec:b,cid:e.mediaStreamTrack.id})],r.backupCodec===!0&&(r.backupCodec={codec:wC}),r.backupCodec&&b!==r.backupCodec.codec&&P.encryption===aa.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),P.simulcastCodecs.push(new iC({codec:r.backupCodec.codec,cid:""})))),A=EC(e.source===Ke.Source.ScreenShare,P.width,P.height,r),P.layers=HM(P.width,P.height,A,Vs(r.videoCodec))}else e.kind===Ke.Kind.Audio&&(A=[{maxBitrate:(d=r.audioPreset)===null||d===void 0?void 0:d.maxBitrate,priority:(h=(f=r.audioPreset)===null||f===void 0?void 0:f.priority)!==null&&h!==void 0?h:"high",networkPriority:(_=(m=r.audioPreset)===null||m===void 0?void 0:m.priority)!==null&&_!==void 0?_:"high"}]);if(!this.engine||this.engine.isClosed)throw new Ln("cannot publish track when not connected");const C=()=>ne(this,void 0,void 0,function*(){var D,N,L;if(!this.engine.pcManager)throw new Ln("pcManager is not ready");if(e.sender=yield this.engine.createSender(e,r,A),this.emit(yt.LocalSenderCreated,e.sender,e),El(e)&&((D=r.degradationPreference)!==null&&D!==void 0||(r.degradationPreference=bde(e)),e.setDegradationPreference(r.degradationPreference)),A)if(fd()&&e.kind===Ke.Kind.Audio){let j;for(const q of this.engine.pcManager.publisher.getTransceivers())if(q.sender===e.sender){j=q;break}j&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:j,codec:"opus",maxbr:!((N=A[0])===null||N===void 0)&&N.maxBitrate?A[0].maxBitrate/1e3:0})}else e.codec&&Vs(e.codec)&&(!((L=A[0])===null||L===void 0)&&L.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:P.cid,codec:e.codec,maxbr:A[0].maxBitrate/1e3});yield this.engine.negotiate()});let O;const I=new Promise((D,N)=>ne(this,void 0,void 0,function*(){var L;try{O=yield this.engine.addTrack(P),D(O)}catch(j){e.sender&&(!((L=this.engine.pcManager)===null||L===void 0)&&L.publisher)&&(this.engine.pcManager.publisher.removeTrack(e.sender),yield this.engine.negotiate().catch(q=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{error:q}))})),N(j)}}));if(this.enabledPublishVideoCodecs.length>0)O=(yield Promise.all([I,C()]))[0];else{O=yield I;let D;if(O.codecs.forEach(N=>{D===void 0&&(D=N.mimeType)}),D&&e.kind===Ke.Kind.Video){const N=hm(D);N!==b&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{codec:N})),r.videoCodec=N,A=EC(e.source===Ke.Source.ScreenShare,P.width,P.height,r))}yield C()}const x=new CC(e.kind,O,e,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(x.on(dt.CpuConstrained,D=>this.onTrackCpuConstrained(D,x)),x.options=r,e.sid=O.sid,this.log.debug("publishing ".concat(e.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:A,trackInfo:O})),El(e)?e.startMonitor(this.engine.client):Sc(e)&&e.startMonitor(),this.addTrackPublication(x),this.emit(yt.LocalTrackPublished,x),Sc(e)&&O.audioFeatures.includes(da.TF_PRECONNECT_BUFFER)){const D=e.getPreConnectBuffer(),N=e.getPreConnectBufferMimeType();this.on(yt.LocalTrackSubscribed,L=>{if(L.trackSid===O.sid){if(!e.hasPreConnectBuffer){this.log.warn("subscribe event came to late, buffer already closed",this.logContext);return}this.log.debug("finished recording preconnect buffer",Object.assign(Object.assign({},this.logContext),vr(e))),e.stopPreConnectBuffer()}}),D&&new Promise((j,q)=>ne(this,void 0,void 0,function*(){var U,W,F,Y,Q,ie;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),vr(e)));const ae=setTimeout(()=>{q(new Error("agent not active within 10 seconds"))},1e4),te=yield this.waitUntilActiveAgentPresent();clearTimeout(ae),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),vr(e)));const me=yield this.streamBytes({name:"preconnect-buffer",mimeType:N,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[te.identity],attributes:{trackId:x.trackSid,sampleRate:String((Q=R.sampleRate)!==null&&Q!==void 0?Q:"48000"),channels:String((ie=R.channelCount)!==null&&ie!==void 0?ie:"1")}});try{for(var G=!0,B=Pc(D),K;K=yield B.next(),U=K.done,!U;G=!0){Y=K.value,G=!1;const ue=Y;yield me.write(ue)}}catch(ue){W={error:ue}}finally{try{!G&&!U&&(F=B.return)&&(yield F.call(B))}finally{if(W)throw W.error}}yield me.close(),j()}catch(ae){q(ae)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),vr(e)))}).catch(j=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{error:j}))})}return x})}get isLocal(){return!0}publishAdditionalCodecForTrack(e,r,n){return ne(this,void 0,void 0,function*(){var a;if(this.encryptionType!==aa.NONE)return;let i;if(this.trackPublications.forEach(_=>{_.track&&_.track===e&&(i=_)}),!i)throw new Ac("track is not published");if(!El(e))throw new Ac("track is not a video track");const o=Object.assign(Object.assign({},(a=this.roomOptions)===null||a===void 0?void 0:a.publishDefaults),n),c=yde(e,r,o);if(!c){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),vr(e)));return}const u=e.addSimulcastTrack(r,c);if(!u)return;const d=new Vm({cid:u.mediaStreamTrack.id,type:Ke.kindToProto(e.kind),muted:e.isMuted,source:Ke.sourceToProto(e.source),sid:e.sid,simulcastCodecs:[{codec:o.videoCodec,cid:u.mediaStreamTrack.id}]});if(d.layers=HM(d.width,d.height,c),!this.engine||this.engine.isClosed)throw new Ln("cannot publish track when not connected");const f=()=>ne(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(e,u,o,c),yield this.engine.negotiate()}),m=(yield Promise.all([this.engine.addTrack(d),f()]))[0];this.log.debug("published ".concat(r," for track ").concat(e.sid),Object.assign(Object.assign({},this.logContext),{encodings:c,trackInfo:m}))})}unpublishTrack(e,r){return ne(this,void 0,void 0,function*(){var n,a;if(Vf(e)){const d=this.pendingPublishPromises.get(e);d&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),vr(e))),yield d)}const i=this.getPublicationForTrack(e),o=i?vr(i):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),o)),!i||!i.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),o));return}e=i.track,e.off(dt.Muted,this.onTrackMuted),e.off(dt.Unmuted,this.onTrackUnmuted),e.off(dt.Ended,this.handleTrackEnded),e.off(dt.UpstreamPaused,this.onTrackUpstreamPaused),e.off(dt.UpstreamResumed,this.onTrackUpstreamResumed),e.off(dt.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),r===void 0&&(r=(a=(n=this.roomOptions)===null||n===void 0?void 0:n.stopLocalTrackOnUnpublish)!==null&&a!==void 0?a:!0),r?e.stop():e.stopMonitor();let c=!1;const u=e.sender;if(e.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<Pn.FAILED&&u)try{for(const d of this.engine.pcManager.publisher.getTransceivers())d.sender===u&&(d.direction="inactive",c=!0);if(this.engine.removeTrack(u)&&(c=!0),El(e)){for(const[,d]of e.simulcastCodecs)d.sender&&(this.engine.removeTrack(d.sender)&&(c=!0),d.sender=void 0);e.simulcastCodecs.clear()}}catch(d){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),o),{error:d}))}switch(this.trackPublications.delete(i.trackSid),i.kind){case Ke.Kind.Audio:this.audioTrackPublications.delete(i.trackSid);break;case Ke.Kind.Video:this.videoTrackPublications.delete(i.trackSid);break}return this.emit(yt.LocalTrackUnpublished,i),i.setTrack(void 0),c&&(yield this.engine.negotiate()),i})}unpublishTracks(e){return ne(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>this.unpublishTrack(n)))).filter(n=>!!n)})}republishAllTracks(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return(function*(){n.republishPromise&&(yield n.republishPromise),n.republishPromise=new li((i,o)=>ne(n,void 0,void 0,function*(){try{const c=[];this.trackPublications.forEach(u=>{u.track&&(r&&(u.options=Object.assign(Object.assign({},u.options),r)),c.push(u))}),yield Promise.all(c.map(u=>ne(this,void 0,void 0,function*(){const d=u.track;yield this.unpublishTrack(d,!1),a&&!d.isMuted&&d.source!==Ke.Source.ScreenShare&&d.source!==Ke.Source.ScreenShareAudio&&(Sc(d)||El(d))&&!d.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:u.trackSid})),yield d.restartTrack()),yield this.publishOrRepublishTrack(d,u.options,!0)}))),i()}catch(c){c instanceof Error?o(c):o(new Error(String(c)))}finally{this.republishPromise=void 0}})),yield n.republishPromise})()})}publishData(e){return ne(this,arguments,void 0,function(r){var n=this;let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return(function*(){const i=a.reliable?mr.RELIABLE:mr.LOSSY,o=a.destinationIdentities,c=a.topic;let u=new IP({participantIdentity:n.identity,payload:r,destinationIdentities:o,topic:c});const d=new $a({kind:i,value:{case:"user",value:u}});yield n.engine.sendDataPacket(d,i)})()})}publishDtmf(e,r){return ne(this,void 0,void 0,function*(){const n=new $a({kind:mr.RELIABLE,value:{case:"sipDtmf",value:new z5({code:e,digit:r})}});yield this.engine.sendDataPacket(n,mr.RELIABLE)})}sendChatMessage(e,r){return ne(this,void 0,void 0,function*(){const n={id:crypto.randomUUID(),message:e,timestamp:Date.now(),attachedFiles:r?.attachments},a=new $a({value:{case:"chatMessage",value:new ib(Object.assign(Object.assign({},n),{timestamp:kn.parse(n.timestamp)}))}});return yield this.engine.sendDataPacket(a,mr.RELIABLE),this.emit(yt.ChatMessage,n),n})}editChatMessage(e,r){return ne(this,void 0,void 0,function*(){const n=Object.assign(Object.assign({},r),{message:e,editTimestamp:Date.now()}),a=new $a({value:{case:"chatMessage",value:new ib(Object.assign(Object.assign({},n),{timestamp:kn.parse(n.timestamp),editTimestamp:kn.parse(n.editTimestamp)}))}});return yield this.engine.sendDataPacket(a,mr.RELIABLE),this.emit(yt.ChatMessage,n),n})}sendText(e,r){return ne(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(e,r)})}streamText(e){return ne(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(e)})}sendFile(e,r){return ne(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(e,r)})}streamBytes(e){return ne(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamBytes(e)})}performRpc(e){let{destinationIdentity:r,method:n,payload:a,responseTimeout:i=15e3}=e;const o=7e3,c=o+1e3;return new li((u,d)=>ne(this,void 0,void 0,function*(){var f,h,m,_;if(ZP(a)>Jq){d(Va.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((h=(f=this.engine.latestJoinResponse)===null||f===void 0?void 0:f.serverInfo)===null||h===void 0)&&h.version&&Yo((_=(m=this.engine.latestJoinResponse)===null||m===void 0?void 0:m.serverInfo)===null||_===void 0?void 0:_.version,"1.8.0")<0){d(Va.builtIn("UNSUPPORTED_SERVER"));return}const w=Math.max(i,c),b=crypto.randomUUID();yield this.publishRpcRequest(r,b,n,a,w);const E=setTimeout(()=>{this.pendingAcks.delete(b),d(Va.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(b),clearTimeout(T)},o);this.pendingAcks.set(b,{resolve:()=>{clearTimeout(E)},participantIdentity:r});const T=setTimeout(()=>{this.pendingResponses.delete(b),d(Va.builtIn("RESPONSE_TIMEOUT"))},i);this.pendingResponses.set(b,{resolve:(R,P)=>{clearTimeout(T),this.pendingAcks.has(b)&&(this.log.warn("RPC response received before ack",b),this.pendingAcks.delete(b),clearTimeout(E)),P?d(P):u(R??"")},participantIdentity:r})}))}registerRpcMethod(e,r){this.rpcHandlers.has(e)&&this.log.warn("you're overriding the RPC handler for method ".concat(e,", in the future this will throw an error")),this.rpcHandlers.set(e,r)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setTrackSubscriptionPermissions(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=r,this.allParticipantsAllowedToSubscribe=e,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(e){const r=this.pendingAcks.get(e);r&&(r.resolve(),this.pendingAcks.delete(e))}handleIncomingRpcResponse(e,r,n){const a=this.pendingResponses.get(e);a&&(a.resolve(r,n),this.pendingResponses.delete(e))}publishRpcRequest(e,r,n,a,i){return ne(this,void 0,void 0,function*(){const o=new $a({destinationIdentities:[e],kind:mr.RELIABLE,value:{case:"rpcRequest",value:new MP({id:r,method:n,payload:a,responseTimeoutMs:i,version:1})}});yield this.engine.sendDataPacket(o,mr.RELIABLE)})}handleParticipantDisconnected(e){for(const[r,{participantIdentity:n}]of this.pendingAcks)n===e&&this.pendingAcks.delete(r);for(const[r,{participantIdentity:n,resolve:a}]of this.pendingResponses)n===e&&(a(null,Va.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(r))}setEnabledPublishCodecs(e){this.enabledPublishVideoCodecs=e.filter(r=>r.mime.split("/")[0].toLowerCase()==="video")}updateInfo(e){return super.updateInfo(e)?(e.tracks.forEach(r=>{var n,a;const i=this.trackPublications.get(r.sid);if(i){const o=i.isMuted||((a=(n=i.track)===null||n===void 0?void 0:n.isUpstreamPaused)!==null&&a!==void 0?a:!1);o!==r.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),vr(i)),{mutedOnServer:o})),this.engine.client.sendMuteTrack(r.sid,o))}}),!0):!1}setActiveAgent(e){var r,n,a,i;this.firstActiveAgent=e,e&&!this.firstActiveAgent&&(this.firstActiveAgent=e),e?(n=(r=this.activeAgentFuture)===null||r===void 0?void 0:r.resolve)===null||n===void 0||n.call(r,e):(i=(a=this.activeAgentFuture)===null||a===void 0?void 0:a.reject)===null||i===void 0||i.call(a,new Error("Agent disconnected")),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new ds),this.activeAgentFuture.promise)}getPublicationForTrack(e){let r;return this.trackPublications.forEach(n=>{const a=n.track;a&&(e instanceof MediaStreamTrack?(Sc(a)||El(a))&&a.mediaStreamTrack===e&&(r=n):e===a&&(r=n))}),r}waitForPendingPublicationOfSource(e){return ne(this,void 0,void 0,function*(){const n=Date.now();for(;Date.now()<n+1e4;){const a=Array.from(this.pendingPublishPromises.entries()).find(i=>{let[o]=i;return o.source===e});if(a)return a[1];yield Ca(20)}})}}class zde extends Ec{constructor(e,r,n,a){super(e,r.sid,r.name,a),this.track=void 0,this.allowed=!0,this.requestedDisabled=void 0,this.visible=!0,this.handleEnded=i=>{this.setTrack(void 0),this.emit(dt.Ended,i)},this.handleVisibilityChange=i=>{this.log.debug("adaptivestream video visibility ".concat(this.trackSid,", visible=").concat(i),this.logContext),this.visible=i,this.emitTrackUpdate()},this.handleVideoDimensionsChange=i=>{this.log.debug("adaptivestream video dimensions ".concat(i.width,"x").concat(i.height),this.logContext),this.videoDimensionsAdaptiveStream=i,this.emitTrackUpdate()},this.subscribed=n,this.updateInfo(r)}setSubscribed(e){const r=this.subscriptionStatus,n=this.permissionStatus;this.subscribed=e,e&&(this.allowed=!0);const a=new d0({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new V5({participantSid:"",trackSids:[this.trackSid]})]});this.emit(dt.UpdateSubscription,a),this.emitSubscriptionUpdateIfChanged(r),this.emitPermissionUpdateIfChanged(n)}get subscriptionStatus(){return this.subscribed===!1?Ec.SubscriptionStatus.Unsubscribed:super.isSubscribed?Ec.SubscriptionStatus.Subscribed:Ec.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Ec.PermissionStatus.Allowed:Ec.PermissionStatus.NotAllowed}get isSubscribed(){return this.subscribed===!1?!1:super.isSubscribed}get isDesired(){return this.subscribed!==!1}get isEnabled(){return this.requestedDisabled!==void 0?!this.requestedDisabled:this.isAdaptiveStream?this.visible:!0}get isLocal(){return!1}setEnabled(e){!this.isManualOperationAllowed()||this.requestedDisabled===!e||(this.requestedDisabled=!e,this.emitTrackUpdate())}setVideoQuality(e){!this.isManualOperationAllowed()||this.requestedMaxQuality===e||(this.requestedMaxQuality=e,this.requestedVideoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(e){var r,n;this.isManualOperationAllowed()&&(((r=this.requestedVideoDimensions)===null||r===void 0?void 0:r.width)===e.width&&((n=this.requestedVideoDimensions)===null||n===void 0?void 0:n.height)===e.height||(lE(this.track)&&(this.requestedVideoDimensions=e),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(e){this.isManualOperationAllowed()&&lE(this.track)&&this.fps!==e&&(this.fps=e,this.emitTrackUpdate())}get videoQuality(){var e;return(e=this.requestedMaxQuality)!==null&&e!==void 0?e:Ii.HIGH}setTrack(e){const r=this.subscriptionStatus,n=this.permissionStatus,a=this.track;a!==e&&(a&&(a.off(dt.VideoDimensionsChanged,this.handleVideoDimensionsChange),a.off(dt.VisibilityChanged,this.handleVisibilityChange),a.off(dt.Ended,this.handleEnded),a.detach(),a.stopMonitor(),this.emit(dt.Unsubscribed,a)),super.setTrack(e),e&&(e.sid=this.trackSid,e.on(dt.VideoDimensionsChanged,this.handleVideoDimensionsChange),e.on(dt.VisibilityChanged,this.handleVisibilityChange),e.on(dt.Ended,this.handleEnded),this.emit(dt.Subscribed,e)),this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(r))}setAllowed(e){const r=this.subscriptionStatus,n=this.permissionStatus;this.allowed=e,this.emitPermissionUpdateIfChanged(n),this.emitSubscriptionUpdateIfChanged(r)}setSubscriptionError(e){this.emit(dt.SubscriptionFailed,e)}updateInfo(e){super.updateInfo(e);const r=this.metadataMuted;this.metadataMuted=e.muted,this.track?this.track.setMuted(e.muted):r!==e.muted&&this.emit(e.muted?dt.Muted:dt.Unmuted)}emitSubscriptionUpdateIfChanged(e){const r=this.subscriptionStatus;e!==r&&this.emit(dt.SubscriptionStatusChanged,r,e)}emitPermissionUpdateIfChanged(e){this.permissionStatus!==e&&this.emit(dt.SubscriptionPermissionChanged,this.permissionStatus,e)}isManualOperationAllowed(){return this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return lE(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const e=new Z5({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===Ke.Kind.Video){let r=this.requestedVideoDimensions;if(this.videoDimensionsAdaptiveStream!==void 0)if(r)bM(this.videoDimensionsAdaptiveStream,r)&&(this.log.debug("using adaptive stream dimensions instead of requested",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),r=this.videoDimensionsAdaptiveStream);else if(this.requestedMaxQuality!==void 0&&this.trackInfo){const n=iue(this.trackInfo,this.requestedMaxQuality);n&&bM(this.videoDimensionsAdaptiveStream,n)&&(this.log.debug("using adaptive stream dimensions instead of max quality layer",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),r=this.videoDimensionsAdaptiveStream)}else this.log.debug("using adaptive stream dimensions",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),r=this.videoDimensionsAdaptiveStream;r?(e.width=Math.ceil(r.width),e.height=Math.ceil(r.height)):this.requestedMaxQuality!==void 0?(this.log.debug("using requested max quality",Object.assign(Object.assign({},this.logContext),{quality:this.requestedMaxQuality})),e.quality=this.requestedMaxQuality):(this.log.debug("using default quality",Object.assign(Object.assign({},this.logContext),{quality:Ii.HIGH})),e.quality=Ii.HIGH)}this.emit(dt.UpdateSettings,e)}}class fb extends a4{static fromParticipantInfo(e,r,n){return new fb(e,r.sid,r.identity,r.name,r.metadata,r.attributes,n,r.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(e,r,n,a,i,o,c){let u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:$m.STANDARD;super(r,n||"",a,i,o,c,u),this.signalClient=e,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(e){super.addTrackPublication(e),e.on(dt.UpdateSettings,r=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),vr(e)),{settings:r})),this.signalClient.sendUpdateTrackSettings(r)}),e.on(dt.UpdateSubscription,r=>{r.participantTracks.forEach(n=>{n.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(r)}),e.on(dt.SubscriptionPermissionChanged,r=>{this.emit(yt.TrackSubscriptionPermissionChanged,e,r)}),e.on(dt.SubscriptionStatusChanged,r=>{this.emit(yt.TrackSubscriptionStatusChanged,e,r)}),e.on(dt.Subscribed,r=>{this.emit(yt.TrackSubscribed,r,e)}),e.on(dt.Unsubscribed,r=>{this.emit(yt.TrackUnsubscribed,r,e)}),e.on(dt.SubscriptionFailed,r=>{this.emit(yt.TrackSubscriptionFailed,e.trackSid,r)})}getTrackPublication(e){const r=super.getTrackPublication(e);if(r)return r}getTrackPublicationByName(e){const r=super.getTrackPublicationByName(e);if(r)return r}setVolume(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ke.Source.Microphone;this.volumeMap.set(r,e);const n=this.getTrackPublication(r);n&&n.track&&n.track.setVolume(e)}getVolume(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ke.Source.Microphone;const r=this.getTrackPublication(e);return r&&r.track?r.track.getVolume():this.volumeMap.get(e)}addSubscribedMediaTrack(e,r,n,a,i,o){let c=this.getTrackPublicationBySid(r);if(c||r.startsWith("TR")||this.trackPublications.forEach(f=>{!c&&e.kind===f.kind.toString()&&(c=f)}),!c){if(o===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:r})),this.emit(yt.TrackSubscriptionFailed,r);return}o===void 0&&(o=20),setTimeout(()=>{this.addSubscribedMediaTrack(e,r,n,a,i,o-1)},150);return}if(e.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),vr(c))),this.emit(yt.TrackSubscriptionFailed,r);return}const u=e.kind==="video";let d;return u?d=new Mde(e,r,a,i):d=new Ide(e,r,a,this.audioContext,this.audioOutput),d.source=c.source,d.isMuted=c.isMuted,d.setMediaStream(n),d.start(),c.setTrack(d),this.volumeMap.has(c.source)&&bC(d)&&Fo(d)&&d.setVolume(this.volumeMap.get(c.source)),c}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(e){return this.trackPublications.get(e)}updateInfo(e){if(!super.updateInfo(e))return!1;const r=new Map,n=new Map;return e.tracks.forEach(a=>{var i,o;let c=this.getTrackPublicationBySid(a.sid);if(c)c.updateInfo(a);else{const u=Ke.kindFromProto(a.type);if(!u)return;c=new zde(u,a,(i=this.signalClient.connectOptions)===null||i===void 0?void 0:i.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(o=this.loggerOptions)===null||o===void 0?void 0:o.loggerName}),c.updateInfo(a),n.set(a.sid,c);const d=Array.from(this.trackPublications.values()).find(f=>f.source===c?.source);d&&c.source!==Ke.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(c.source),Object.assign(Object.assign({},this.logContext),{oldTrack:vr(d),newTrack:vr(c)})),this.addTrackPublication(c)}r.set(a.sid,c)}),this.trackPublications.forEach(a=>{r.has(a.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),vr(a))),this.unpublishTrack(a.trackSid,!0))}),n.forEach(a=>{this.emit(yt.TrackPublished,a)}),!0}unpublishTrack(e,r){const n=this.trackPublications.get(e);if(!n)return;const{track:a}=n;switch(a&&(a.stop(),n.setTrack(void 0)),this.trackPublications.delete(e),n.kind){case Ke.Kind.Audio:this.audioTrackPublications.delete(e);break;case Ke.Kind.Video:this.videoTrackPublications.delete(e);break}r&&this.emit(yt.TrackUnpublished,n)}setAudioOutput(e){return ne(this,void 0,void 0,function*(){this.audioOutput=e;const r=[];this.audioTrackPublications.forEach(n=>{var a;Fo(n.track)&&bC(n.track)&&r.push(n.track.setSinkId((a=e.deviceId)!==null&&a!==void 0?a:"default"))}),yield Promise.all(r)})}emit(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:e,args:n})),super.emit(e,...n)}}var Mr;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(Mr||(Mr={}));const $de=4*1e3;class dp extends Qo.EventEmitter{get hasE2EESetup(){return this.e2eeManager!==void 0}constructor(e){var r,n,a,i,o;if(super(),r=this,this.state=Mr.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=or,this.bufferedEvents=[],this.isResuming=!1,this.rpcHandlers=new Map,this.connect=(c,u,d)=>ne(this,void 0,void 0,function*(){var f;if(!due())throw Ko()?Error("WebRTC isn't detected, have you called registerGlobals?"):Error("LiveKit doesn't seem to be supported on this browser. Try to update your browser and make sure no browser extensions are disabling webRTC.");const h=yield this.disconnectLock.lock();if(this.state===Mr.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),h(),Promise.resolve();if(this.connectFuture)return h(),this.connectFuture.promise;this.setAndEmitConnectionState(Mr.Connecting),((f=this.regionUrlProvider)===null||f===void 0?void 0:f.getServerUrl().toString())!==Wq(c)&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),up(new URL(c))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new Rr(c,u):this.regionUrlProvider.updateToken(u),this.regionUrlProvider.fetchRegionSettings().then(w=>{var b;(b=this.regionUrlProvider)===null||b===void 0||b.setServerReportedRegions(w)}).catch(w=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:w}))}));const m=(w,b,E)=>ne(this,void 0,void 0,function*(){var T,R;this.abortController&&this.abortController.abort();const P=new AbortController;this.abortController=P,h?.();try{if(yield Hf.getInstance().getBackOffPromise(c),P.signal.aborted)throw Gt.cancelled("Connection attempt aborted");yield this.attemptConnection(E??c,u,d,P),this.abortController=void 0,w()}catch(A){if(this.regionUrlProvider&&A instanceof Gt&&A.reason!==ln.Cancelled&&A.reason!==ln.NotAllowed){let C=null;try{this.log.debug("Fetching next region"),C=yield this.regionUrlProvider.getNextBestRegionUrl((T=this.abortController)===null||T===void 0?void 0:T.signal)}catch(O){if(O instanceof Gt&&(O.status===401||O.reason===ln.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),b(O);return}}[ln.InternalError,ln.ServerUnreachable,ln.Timeout].includes(A.reason)&&(this.log.debug("Adding failed connection attempt to back off"),Hf.getInstance().addFailedConnectionAttempt(c)),C&&!(!((R=this.abortController)===null||R===void 0)&&R.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(A.message,". Retrying with another region: ").concat(C),this.logContext),this.recreateEngine(),yield m(w,b,C)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,xM(A)),b(A))}else{let C=Gs.UNKNOWN_REASON;A instanceof Gt&&(C=xM(A)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,C),b(A)}}}),_=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new ds((w,b)=>{m(w,b,_)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(c,u,d,f,h,m)=>ne(this,void 0,void 0,function*(){var _,w,b;const E=yield d.join(c,u,{autoSubscribe:f.autoSubscribe,adaptiveStream:typeof h.adaptiveStream=="object"?!0:h.adaptiveStream,maxRetries:f.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:f.websocketTimeout},m.signal,!h.singlePeerConnection);let T=E.serverInfo;if(T||(T={version:E.serverVersion,region:E.serverRegion}),this.serverInfo=T,this.log.debug("connected to Livekit Server ".concat(Object.entries(T).map(R=>{let[P,A]=R;return"".concat(P,": ").concat(A)}).join(", ")),{room:(_=E.room)===null||_===void 0?void 0:_.name,roomSid:(w=E.room)===null||w===void 0?void 0:w.sid,identity:(b=E.participant)===null||b===void 0?void 0:b.identity}),!T.version)throw new Wle("unknown server version");return T.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),h.dynacast=!1),E}),this.applyJoinResponse=c=>{const u=c.participant;if(this.localParticipant.sid=u.sid,this.localParticipant.identity=u.identity,this.localParticipant.setEnabledPublishCodecs(c.enabledPublishCodecs),this.e2eeManager)try{this.e2eeManager.setSifTrailer(c.sifTrailer)}catch(d){this.log.error(d instanceof Error?d.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:d}))}this.handleParticipantUpdates([u,...c.otherParticipants]),c.room&&this.handleRoomUpdate(c.room)},this.attemptConnection=(c,u,d,f)=>ne(this,void 0,void 0,function*(){var h,m;this.state===Mr.Reconnecting||this.isResuming||!((h=this.engine)===null||h===void 0)&&h.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((m=this.regionUrlProvider)===null||m===void 0)&&m.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},QP),d),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const _=yield this.connectSignal(c,u,this.engine,this.connOptions,this.options,f);this.applyJoinResponse(_),this.setupLocalParticipantEvents(),this.emit(et.SignalConnected)}catch(_){yield this.engine.close(),this.recreateEngine();const w=f.signal.aborted?Gt.cancelled("Signal connection aborted"):Gt.serverUnreachable("could not establish signal connection");throw _ instanceof Error&&(w.message="".concat(w.message,": ").concat(_.message)),_ instanceof Gt&&(w.reason=_.reason,w.status=_.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:_})),w}if(f.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),Gt.cancelled("Connection attempt aborted");try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,f)}catch(_){throw yield this.engine.close(),this.recreateEngine(),_}ui()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),ui()&&window.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(Mr.Connected),this.emit(et.Connected),Hf.getInstance().resetFailedConnectionAttempts(c),this.registerConnectionReconcile(),this.regionUrlProvider&&this.regionUrlProvider.notifyConnected()}),this.disconnect=function(){for(var c=arguments.length,u=new Array(c),d=0;d<c;d++)u[d]=arguments[d];return ne(r,[...u],void 0,function(){var f=this;let h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return(function*(){var m,_,w;const b=yield f.disconnectLock.lock();try{if(f.state===Mr.Disconnected){f.log.debug("already disconnected",f.logContext);return}if(f.log.info("disconnect from room",Object.assign({},f.logContext)),f.state===Mr.Connecting||f.state===Mr.Reconnecting||f.isResuming){const E="Abort connection attempt due to user initiated disconnect";f.log.warn(E,f.logContext),(m=f.abortController)===null||m===void 0||m.abort(E),(w=(_=f.connectFuture)===null||_===void 0?void 0:_.reject)===null||w===void 0||w.call(_,Gt.cancelled("Client initiated disconnect")),f.connectFuture=void 0}f.engine&&(f.engine.client.isDisconnected||(yield f.engine.client.sendLeave()),yield f.engine.close()),f.handleDisconnect(h,Gs.CLIENT_INITIATED),f.engine=void 0}finally{b()}})()})},this.onPageLeave=()=>ne(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>ne(this,void 0,void 0,function*(){const c=[],u=fi();if(u&&u.os==="iOS"){const d="livekit-dummy-audio-el";let f=document.getElementById(d);if(!f){f=document.createElement("audio"),f.id=d,f.autoplay=!0,f.hidden=!0;const h=cE();h.enabled=!0;const m=new MediaStream([h]);f.srcObject=m,document.addEventListener("visibilitychange",()=>{f&&(f.srcObject=document.hidden?null:m,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(f),this.once(et.Disconnected,()=>{f?.remove(),f=null})}c.push(f)}this.remoteParticipants.forEach(d=>{d.audioTrackPublications.forEach(f=>{f.track&&f.track.attachedElements.forEach(h=>{c.push(h)})})});try{yield Promise.all([this.acquireAudioContext(),...c.map(d=>(d.muted=!1,d.play()))]),this.handleAudioPlaybackStarted()}catch(d){throw this.handleAudioPlaybackFailed(d),d}}),this.startVideo=()=>ne(this,void 0,void 0,function*(){const c=[];for(const u of this.remoteParticipants.values())u.videoTrackPublications.forEach(d=>{var f;(f=d.track)===null||f===void 0||f.attachedElements.forEach(h=>{c.includes(h)||c.push(h)})});yield Promise.all(c.map(u=>u.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(u=>{u.name==="NotAllowedError"?this.handleVideoPlaybackFailed():this.log.warn("Resuming video playback failed, make sure you call `startVideo` directly in a user gesture handler",this.logContext)})}),this.handleRestarting=()=>{this.clearConnectionReconcile(),this.isResuming=!1;for(const c of this.remoteParticipants.values())this.handleParticipantDisconnected(c.identity,c);this.setAndEmitConnectionState(Mr.Reconnecting)&&this.emit(et.Reconnecting)},this.handleSignalRestarted=c=>ne(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(c.serverRegion),Object.assign(Object.assign({},this.logContext),{region:c.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(c);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(u){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:u}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:c.serverRegion}))}catch{return}this.setAndEmitConnectionState(Mr.Connected),this.emit(et.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=c=>{c.forEach(u=>{var d;if(u.identity===this.localParticipant.identity){this.localParticipant.updateInfo(u);return}u.identity===""&&(u.identity=(d=this.sidToIdentity.get(u.sid))!==null&&d!==void 0?d:"");let f=this.remoteParticipants.get(u.identity);u.state===Uf.DISCONNECTED?this.handleParticipantDisconnected(u.identity,f):f=this.getOrCreateParticipant(u.identity,u)})},this.handleActiveSpeakersUpdate=c=>{const u=[],d={};c.forEach(f=>{if(d[f.sid]=!0,f.sid===this.localParticipant.sid)this.localParticipant.audioLevel=f.level,this.localParticipant.setIsSpeaking(!0),u.push(this.localParticipant);else{const h=this.getRemoteParticipantBySid(f.sid);h&&(h.audioLevel=f.level,h.setIsSpeaking(!0),u.push(h))}}),d[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(f=>{d[f.sid]||(f.audioLevel=0,f.setIsSpeaking(!1))}),this.activeSpeakers=u,this.emitWhenConnected(et.ActiveSpeakersChanged,u)},this.handleSpeakersChanged=c=>{const u=new Map;this.activeSpeakers.forEach(f=>{const h=this.remoteParticipants.get(f.identity);h&&h.sid!==f.sid||u.set(f.sid,f)}),c.forEach(f=>{let h=this.getRemoteParticipantBySid(f.sid);f.sid===this.localParticipant.sid&&(h=this.localParticipant),h&&(h.audioLevel=f.level,h.setIsSpeaking(f.active),f.active?u.set(f.sid,h):u.delete(f.sid))});const d=Array.from(u.values());d.sort((f,h)=>h.audioLevel-f.audioLevel),this.activeSpeakers=d,this.emitWhenConnected(et.ActiveSpeakersChanged,d)},this.handleStreamStateUpdate=c=>{c.streamStates.forEach(u=>{const d=this.getRemoteParticipantBySid(u.participantSid);if(!d)return;const f=d.getTrackPublicationBySid(u.trackSid);if(!f||!f.track)return;const h=Ke.streamStateFromProto(u.state);f.track.setStreamState(h),h!==f.track.streamState&&(d.emit(yt.TrackStreamStateChanged,f,f.track.streamState),this.emitWhenConnected(et.TrackStreamStateChanged,f,f.track.streamState,d))})},this.handleSubscriptionPermissionUpdate=c=>{const u=this.getRemoteParticipantBySid(c.participantSid);if(!u)return;const d=u.getTrackPublicationBySid(c.trackSid);d&&d.setAllowed(c.allowed)},this.handleSubscriptionError=c=>{const u=Array.from(this.remoteParticipants.values()).find(f=>f.trackPublications.has(c.trackSid));if(!u)return;const d=u.getTrackPublicationBySid(c.trackSid);d&&d.setSubscriptionError(c.err)},this.handleDataPacket=(c,u)=>{const d=this.remoteParticipants.get(c.participantIdentity);if(c.value.case==="user")this.handleUserPacket(d,c.value.value,c.kind,u);else if(c.value.case==="transcription")this.handleTranscription(d,c.value.value);else if(c.value.case==="sipDtmf")this.handleSipDtmf(d,c.value.value);else if(c.value.case==="chatMessage")this.handleChatMessage(d,c.value.value);else if(c.value.case==="metrics")this.handleMetrics(c.value.value,d);else if(c.value.case==="streamHeader"||c.value.case==="streamChunk"||c.value.case==="streamTrailer")this.handleDataStream(c,u);else if(c.value.case==="rpcRequest"){const f=c.value.value;this.handleIncomingRpcRequest(c.participantIdentity,f.id,f.method,f.payload,f.responseTimeoutMs,f.version)}},this.handleUserPacket=(c,u,d,f)=>{this.emit(et.DataReceived,u.payload,c,d,u.topic,f),c?.emit(yt.DataReceived,u.payload,d,f)},this.handleSipDtmf=(c,u)=>{this.emit(et.SipDTMFReceived,u,c),c?.emit(yt.SipDTMFReceived,u)},this.handleTranscription=(c,u)=>{const d=u.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(u.transcribedParticipantIdentity),f=d?.trackPublications.get(u.trackId),h=bue(u,this.transcriptionReceivedTimes);f?.emit(dt.TranscriptionReceived,h),d?.emit(yt.TranscriptionReceived,h,f),this.emit(et.TranscriptionReceived,h,d,f)},this.handleChatMessage=(c,u)=>{const d=kue(u);this.emit(et.ChatMessage,d,c)},this.handleMetrics=(c,u)=>{this.emit(et.MetricsReceived,c,u)},this.handleDataStream=(c,u)=>{this.incomingDataStreamManager.handleDataStreamPacket(c,u)},this.bufferedSegments=new Map,this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(et.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=c=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:c})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(et.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(et.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(et.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>ne(this,void 0,void 0,function*(){var c;((c=fi())===null||c===void 0?void 0:c.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(et.MediaDevicesChanged)}),this.handleRoomUpdate=c=>{const u=this.roomInfo;this.roomInfo=c,u&&u.metadata!==c.metadata&&this.emitWhenConnected(et.RoomMetadataChanged,c.metadata),u?.activeRecording!==c.activeRecording&&this.emitWhenConnected(et.RecordingStatusChanged,c.activeRecording)},this.handleConnectionQualityUpdate=c=>{c.updates.forEach(u=>{if(u.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(u.quality);return}const d=this.getRemoteParticipantBySid(u.participantSid);d&&d.setConnectionQuality(u.quality)})},this.onLocalParticipantMetadataChanged=c=>{this.emit(et.ParticipantMetadataChanged,c,this.localParticipant)},this.onLocalParticipantNameChanged=c=>{this.emit(et.ParticipantNameChanged,c,this.localParticipant)},this.onLocalAttributesChanged=c=>{this.emit(et.ParticipantAttributesChanged,c,this.localParticipant)},this.onLocalTrackMuted=c=>{this.emit(et.TrackMuted,c,this.localParticipant)},this.onLocalTrackUnmuted=c=>{this.emit(et.TrackUnmuted,c,this.localParticipant)},this.onTrackProcessorUpdate=c=>{var u;(u=c?.onPublish)===null||u===void 0||u.call(c,this)},this.onLocalTrackPublished=c=>ne(this,void 0,void 0,function*(){var u,d,f,h,m,_;(u=c.track)===null||u===void 0||u.on(dt.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.on(dt.Restarted,this.onLocalTrackRestarted),(m=(h=(f=c.track)===null||f===void 0?void 0:f.getProcessor())===null||h===void 0?void 0:h.onPublish)===null||m===void 0||m.call(h,this),this.emit(et.LocalTrackPublished,c,this.localParticipant),Sc(c.track)&&(yield c.track.checkForSilence())&&this.emit(et.LocalAudioSilenceDetected,c);const w=yield(_=c.track)===null||_===void 0?void 0:_.getDeviceId(!1),b=gC(c.source);b&&w&&w!==this.localParticipant.activeDeviceMap.get(b)&&(this.localParticipant.activeDeviceMap.set(b,w),this.emit(et.ActiveDeviceChanged,b,w))}),this.onLocalTrackUnpublished=c=>{var u,d;(u=c.track)===null||u===void 0||u.off(dt.TrackProcessorUpdate,this.onTrackProcessorUpdate),(d=c.track)===null||d===void 0||d.off(dt.Restarted,this.onLocalTrackRestarted),this.emit(et.LocalTrackUnpublished,c,this.localParticipant)},this.onLocalTrackRestarted=c=>ne(this,void 0,void 0,function*(){const u=yield c.getDeviceId(!1),d=gC(c.source);d&&u&&u!==this.localParticipant.activeDeviceMap.get(d)&&(this.log.debug("local track restarted, setting ".concat(d," ").concat(u," active"),this.logContext),this.localParticipant.activeDeviceMap.set(d,u),this.emit(et.ActiveDeviceChanged,d,u))}),this.onLocalConnectionQualityChanged=c=>{this.emit(et.ConnectionQualityChanged,c,this.localParticipant)},this.onMediaDevicesError=(c,u)=>{this.emit(et.MediaDevicesError,c,u)},this.onLocalParticipantPermissionsChanged=c=>{this.emit(et.ParticipantPermissionsChanged,c,this.localParticipant)},this.onLocalChatMessageSent=c=>{this.emit(et.ChatMessage,c,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},ede),e),this.log=$c((n=this.options.loggerName)!==null&&n!==void 0?n:Zs.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},Kq),e?.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},Yq),e?.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},Zue),e?.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new Rde,this.outgoingDataStreamManager=new Nde(this.engine,this.log),this.disconnectLock=new Wa,this.localParticipant=new qde("","",this.engine,this.options,this.rpcHandlers,this.outgoingDataStreamManager),(this.options.e2ee||this.options.encryption)&&this.setupE2EE(),this.engine.e2eeManager=this.e2eeManager,this.options.videoCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("videoinput",Vl(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",Vl(this.options.audioCaptureDefaults.deviceId)),!((a=this.options.audioOutput)===null||a===void 0)&&a.deviceId&&this.switchActiveDevice("audiooutput",Vl(this.options.audioOutput.deviceId)).catch(c=>this.log.warn("Could not set audio output: ".concat(c.message),this.logContext)),ui()){const c=new AbortController;(o=(i=navigator.mediaDevices)===null||i===void 0?void 0:i.addEventListener)===null||o===void 0||o.call(i,"devicechange",this.handleDeviceChange,{signal:c.signal}),dp.cleanupRegistry&&dp.cleanupRegistry.register(this,()=>{c.abort()})}}registerTextStreamHandler(e,r){return this.incomingDataStreamManager.registerTextStreamHandler(e,r)}unregisterTextStreamHandler(e){return this.incomingDataStreamManager.unregisterTextStreamHandler(e)}registerByteStreamHandler(e,r){return this.incomingDataStreamManager.registerByteStreamHandler(e,r)}unregisterByteStreamHandler(e){return this.incomingDataStreamManager.unregisterByteStreamHandler(e)}registerRpcMethod(e,r){if(this.rpcHandlers.has(e))throw Error("RPC handler already registered for method ".concat(e,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(e,r)}unregisterRpcMethod(e){this.rpcHandlers.delete(e)}setE2EEEnabled(e){return ne(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(e)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(e,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var e;const r=!!this.options.encryption,n=this.options.encryption||this.options.e2ee;n&&("e2eeManager"in n?(this.e2eeManager=n.e2eeManager,this.e2eeManager.isDataChannelEncryptionEnabled=r):this.e2eeManager=new jue(n,r),this.e2eeManager.on(Ml.ParticipantEncryptionStatusChanged,(a,i)=>{Sue(i)&&(this.isE2EEEnabled=a),this.emit(et.ParticipantEncryptionStatusChanged,a,i)}),this.e2eeManager.on(Ml.EncryptionError,(a,i)=>{const o=i?this.getParticipantByIdentity(i):void 0;this.emit(et.EncryptionError,a,o)}),(e=this.e2eeManager)===null||e===void 0||e.setup(this))}get logContext(){var e;return{room:this.name,roomID:(e=this.roomInfo)===null||e===void 0?void 0:e.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var e,r;return(r=(e=this.roomInfo)===null||e===void 0?void 0:e.activeRecording)!==null&&r!==void 0?r:!1}getSid(){return this.state===Mr.Disconnected?li.resolve(""):this.roomInfo&&this.roomInfo.sid!==""?li.resolve(this.roomInfo.sid):new li((e,r)=>{const n=a=>{a.sid!==""&&(this.engine.off(ht.RoomUpdate,n),e(a.sid))};this.engine.on(ht.RoomUpdate,n),this.once(et.Disconnected,()=>{this.engine.off(ht.RoomUpdate,n),r(new Ln("Room disconnected before room server id was available"))})})}get name(){var e,r;return(r=(e=this.roomInfo)===null||e===void 0?void 0:e.name)!==null&&r!==void 0?r:""}get metadata(){var e;return(e=this.roomInfo)===null||e===void 0?void 0:e.metadata}get numParticipants(){var e,r;return(r=(e=this.roomInfo)===null||e===void 0?void 0:e.numParticipants)!==null&&r!==void 0?r:0}get numPublishers(){var e,r;return(r=(e=this.roomInfo)===null||e===void 0?void 0:e.numPublishers)!==null&&r!==void 0?r:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new Cde(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(ht.ParticipantUpdate,this.handleParticipantUpdates).on(ht.RoomUpdate,this.handleRoomUpdate).on(ht.SpeakersChanged,this.handleSpeakersChanged).on(ht.StreamStateChanged,this.handleStreamStateUpdate).on(ht.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(ht.SubscriptionError,this.handleSubscriptionError).on(ht.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(ht.MediaTrackAdded,(e,r,n)=>{this.onTrackAdded(e,r,n)}).on(ht.Disconnected,e=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,e)}).on(ht.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(ht.DataPacketReceived,this.handleDataPacket).on(ht.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(Mr.SignalReconnecting)&&this.emit(et.SignalReconnecting)}).on(ht.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(Mr.Connected)&&this.emit(et.Reconnected)}).on(ht.SignalResumed,()=>{this.bufferedEvents=[],(this.state===Mr.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(ht.Restarting,this.handleRestarting).on(ht.SignalRestarted,this.handleSignalRestarted).on(ht.Offline,()=>{this.setAndEmitConnectionState(Mr.Reconnecting)&&this.emit(et.Reconnecting)}).on(ht.DCBufferStatusChanged,(e,r)=>{this.emit(et.DCBufferStatusChanged,e,r)}).on(ht.LocalTrackSubscribed,e=>{const r=this.localParticipant.getTrackPublications().find(n=>{let{trackSid:a}=n;return a===e});if(!r){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(yt.LocalTrackSubscribed,r),this.emitWhenConnected(et.LocalTrackSubscribed,r,this.localParticipant)}).on(ht.RoomMoved,e=>{this.log.debug("room moved",e),e.room&&this.handleRoomUpdate(e.room),this.remoteParticipants.forEach((r,n)=>{this.handleParticipantDisconnected(n,r)}),this.emit(et.Moved,e.room.name),e.participant?this.handleParticipantUpdates([e.participant,...e.otherParticipants]):this.handleParticipantUpdates(e.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine),this.outgoingDataStreamManager&&this.outgoingDataStreamManager.setupEngine(this.engine))}static getLocalDevices(e){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return fa.getInstance().getDevices(e,r)}prepareConnection(e,r){return ne(this,void 0,void 0,function*(){if(this.state===Mr.Disconnected){this.log.debug("prepareConnection to ".concat(e),this.logContext);try{if(up(new URL(e))&&r){this.regionUrlProvider=new Rr(e,r);const n=yield this.regionUrlProvider.getNextBestRegionUrl();n&&this.state===Mr.Disconnected&&(this.regionUrl=n,yield fetch(Gm(n),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(n),this.logContext))}else yield fetch(Gm(e),{method:"HEAD"})}catch(n){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:n}))}}})}getParticipantByIdentity(e){return this.localParticipant.identity===e?this.localParticipant:this.remoteParticipants.get(e)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(e,r){return ne(this,void 0,void 0,function*(){let n=()=>ne(this,void 0,void 0,function*(){}),a;switch(e){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":a=new Po({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":a=new Po({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":a=new Po({scenario:{case:"serverLeave",value:!0}});break;case"migration":a=new Po({scenario:{case:"migration",value:!0}});break;case"resume-reconnect":this.engine.failNext(),yield this.engine.client.handleOnClose("simulate resume-disconnect");break;case"disconnect-signal-on-resume":n=()=>ne(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new Po({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":n=()=>ne(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),a=new Po({scenario:{case:"disconnectSignalOnResumeNoMessages",value:!0}});break;case"full-reconnect":this.engine.fullReconnectOnNext=!0,yield this.engine.client.handleOnClose("simulate full-reconnect");break;case"force-tcp":case"force-tls":a=new Po({scenario:{case:"switchCandidateProtocol",value:e==="force-tls"?2:1}}),n=()=>ne(this,void 0,void 0,function*(){const i=this.engine.client.onLeave;i&&i(new f0({reason:Gs.CLIENT_INITIATED,action:Ff.RECONNECT}))});break;case"subscriber-bandwidth":if(r===void 0||typeof r!="number")throw new Error("subscriber-bandwidth requires a number as argument");a=new Po({scenario:{case:"subscriberBandwidth",value:zu(r)}});break;case"leave-full-reconnect":a=new Po({scenario:{case:"leaveRequestFullReconnect",value:!0}})}a&&(yield this.engine.client.sendSimulateScenario(a),yield n())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(e){return this.localParticipant.activeDeviceMap.get(e)}switchActiveDevice(e,r){return ne(this,arguments,void 0,function(n,a){var i=this;let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return(function*(){var c,u,d,f,h,m,_;let w=!0,b=!1;const E=o?{exact:a}:a;if(n==="audioinput"){b=i.localParticipant.audioTrackPublications.size===0;const T=(c=i.getActiveDevice(n))!==null&&c!==void 0?c:i.options.audioCaptureDefaults.deviceId;i.options.audioCaptureDefaults.deviceId=E;const R=Array.from(i.localParticipant.audioTrackPublications.values()).filter(A=>A.source===Ke.Source.Microphone);try{w=(yield Promise.all(R.map(A=>{var C;return(C=A.audioTrack)===null||C===void 0?void 0:C.setDeviceId(E)}))).every(A=>A===!0)}catch(A){throw i.options.audioCaptureDefaults.deviceId=T,A}const P=R.some(A=>{var C,O;return(O=(C=A.track)===null||C===void 0?void 0:C.isMuted)!==null&&O!==void 0?O:!1});w&&P&&(b=!0)}else if(n==="videoinput"){b=i.localParticipant.videoTrackPublications.size===0;const T=(u=i.getActiveDevice(n))!==null&&u!==void 0?u:i.options.videoCaptureDefaults.deviceId;i.options.videoCaptureDefaults.deviceId=E;const R=Array.from(i.localParticipant.videoTrackPublications.values()).filter(A=>A.source===Ke.Source.Camera);try{w=(yield Promise.all(R.map(A=>{var C;return(C=A.videoTrack)===null||C===void 0?void 0:C.setDeviceId(E)}))).every(A=>A===!0)}catch(A){throw i.options.videoCaptureDefaults.deviceId=T,A}const P=R.some(A=>{var C,O;return(O=(C=A.track)===null||C===void 0?void 0:C.isMuted)!==null&&O!==void 0?O:!1});w&&P&&(b=!0)}else if(n==="audiooutput"){if(b=!0,!_C()&&!i.options.webAudioMix||i.options.webAudioMix&&i.audioContext&&!("setSinkId"in i.audioContext))throw new Error("cannot switch audio output, the current browser does not support it");i.options.webAudioMix&&(a=(d=yield fa.getInstance().normalizeDeviceId("audiooutput",a))!==null&&d!==void 0?d:""),(f=(_=i.options).audioOutput)!==null&&f!==void 0||(_.audioOutput={});const T=(h=i.getActiveDevice(n))!==null&&h!==void 0?h:i.options.audioOutput.deviceId;i.options.audioOutput.deviceId=a;try{i.options.webAudioMix&&((m=i.audioContext)===null||m===void 0||m.setSinkId(a)),yield Promise.all(Array.from(i.remoteParticipants.values()).map(R=>R.setAudioOutput({deviceId:a})))}catch(R){throw i.options.audioOutput.deviceId=T,R}}return b&&(i.localParticipant.activeDeviceMap.set(n,a),i.emit(et.ActiveDeviceChanged,n,a)),w})()})}setupLocalParticipantEvents(){this.localParticipant.on(yt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(yt.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(yt.AttributesChanged,this.onLocalAttributesChanged).on(yt.TrackMuted,this.onLocalTrackMuted).on(yt.TrackUnmuted,this.onLocalTrackUnmuted).on(yt.LocalTrackPublished,this.onLocalTrackPublished).on(yt.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(yt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(yt.MediaDevicesError,this.onMediaDevicesError).on(yt.AudioStreamAcquired,this.startAudio).on(yt.ChatMessage,this.onLocalChatMessageSent).on(yt.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var e;(e=this.engine)===null||e===void 0||e.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(e,r,n){if(this.state===Mr.Connecting||this.state===Mr.Reconnecting){const h=()=>{this.log.debug("deferring on track for later",{mediaTrackId:e.id,mediaStreamId:r.id,tracksInStream:r.getTracks().map(_=>_.id)}),this.onTrackAdded(e,r,n),m()},m=()=>{this.off(et.Reconnected,h),this.off(et.Connected,h),this.off(et.Disconnected,m)};this.once(et.Reconnected,h),this.once(et.Connected,h),this.once(et.Disconnected,m);return}if(this.state===Mr.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(e.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const a=cue(r.id),i=a[0];let o=a[1],c=e.id;if(o&&o.startsWith("TR")&&(c=o),i===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const u=Array.from(this.remoteParticipants.values()).find(h=>h.sid===i);if(!u){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(i),this.logContext);return}if(!c.startsWith("TR")){const h=this.engine.getTrackIdForReceiver(n);if(!h){this.log.error("Tried to add a track whose 'sid' could not be found for a participant, that's not present. Sid: ".concat(i),this.logContext);return}c=h}c.startsWith("TR")||this.log.warn("Tried to add a track whose 'sid' could not be determined for a participant, that's not present. Sid: ".concat(i,", streamId: ").concat(o,", trackId: ").concat(c),Object.assign(Object.assign({},this.logContext),{rpID:i,streamId:o,trackId:c}));let d;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?d=this.options.adaptiveStream:d={});const f=u.addSubscribedMediaTrack(e,c,r,n,d);f?.isEncrypted&&!this.e2eeManager&&this.emit(et.EncryptionError,new Error("Encrypted ".concat(f.source," track received from participant ").concat(u.sid,", but room does not have encryption enabled!")))}handleDisconnect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,r=arguments.length>1?arguments[1]:void 0;var n,a;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.incomingDataStreamManager.clearControllers(),this.state!==Mr.Disconnected){this.regionUrl=void 0,this.regionUrlProvider&&this.regionUrlProvider.notifyDisconnected();try{this.remoteParticipants.forEach(i=>{i.trackPublications.forEach(o=>{i.unpublishTrack(o.trackSid)})}),this.localParticipant.trackPublications.forEach(i=>{var o,c,u;i.track&&this.localParticipant.unpublishTrack(i.track,e),e?((o=i.track)===null||o===void 0||o.detach(),(c=i.track)===null||c===void 0||c.stop()):(u=i.track)===null||u===void 0||u.stopMonitor()}),this.localParticipant.off(yt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(yt.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(yt.AttributesChanged,this.onLocalAttributesChanged).off(yt.TrackMuted,this.onLocalTrackMuted).off(yt.TrackUnmuted,this.onLocalTrackUnmuted).off(yt.LocalTrackPublished,this.onLocalTrackPublished).off(yt.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(yt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(yt.MediaDevicesError,this.onMediaDevicesError).off(yt.AudioStreamAcquired,this.startAudio).off(yt.ChatMessage,this.onLocalChatMessageSent).off(yt.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged),this.localParticipant.trackPublications.clear(),this.localParticipant.videoTrackPublications.clear(),this.localParticipant.audioTrackPublications.clear(),this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.activeSpeakers=[],this.audioContext&&typeof this.options.webAudioMix=="boolean"&&(this.audioContext.close(),this.audioContext=void 0),ui()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(a=(n=navigator.mediaDevices)===null||n===void 0?void 0:n.removeEventListener)===null||a===void 0||a.call(n,"devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(Mr.Disconnected),this.emit(et.Disconnected,r)}}}handleParticipantDisconnected(e,r){var n;this.remoteParticipants.delete(e),r&&(this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(e),r.trackPublications.forEach(a=>{r.unpublishTrack(a.trackSid,!0)}),this.emit(et.ParticipantDisconnected,r),r.setDisconnected(),(n=this.localParticipant)===null||n===void 0||n.handleParticipantDisconnected(r.identity))}handleIncomingRpcRequest(e,r,n,a,i,o){return ne(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(e,r),o!==1){yield this.engine.publishRpcResponse(e,r,null,Va.builtIn("UNSUPPORTED_VERSION"));return}const c=this.rpcHandlers.get(n);if(!c){yield this.engine.publishRpcResponse(e,r,null,Va.builtIn("UNSUPPORTED_METHOD"));return}let u=null,d=null;try{const f=yield c({requestId:r,callerIdentity:e,payload:a,responseTimeout:i});ZP(f)>Jq?(u=Va.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),this.log.warn("RPC Response payload too large for ".concat(n))):d=f}catch(f){f instanceof Va?u=f:(this.log.warn("Uncaught error returned by RPC handler for ".concat(n,". Returning APPLICATION_ERROR instead."),f),u=Va.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(e,r,d,u)})}selectDefaultDevices(){return ne(this,void 0,void 0,function*(){var e,r,n;const a=fa.getInstance().previousDevices,i=yield fa.getInstance().getDevices(void 0,!1),o=fi();if(o?.name==="Chrome"&&o.os!=="iOS")for(let u of i){const d=a.find(f=>f.deviceId===u.deviceId);d&&d.label!==""&&d.kind===u.kind&&d.label!==u.label&&this.getActiveDevice(u.kind)==="default"&&this.emit(et.ActiveDeviceChanged,u.kind,u.deviceId)}const c=["audiooutput","audioinput","videoinput"];for(let u of c){const d=Zle(u),f=this.localParticipant.getTrackPublication(d);if(f&&(!((e=f.track)===null||e===void 0)&&e.isUserProvided))continue;const h=i.filter(_=>_.kind===u),m=this.getActiveDevice(u);if(m===((r=a.filter(_=>_.kind===u)[0])===null||r===void 0?void 0:r.deviceId)&&h.length>0&&((n=h[0])===null||n===void 0?void 0:n.deviceId)!==m){yield this.switchActiveDevice(u,h[0].deviceId);continue}u==="audioinput"&&!Hm()||u==="videoinput"||h.length>0&&!h.find(_=>_.deviceId===this.getActiveDevice(u))&&(u!=="audiooutput"||!Hm())&&(yield this.switchActiveDevice(u,h[0].deviceId))}})}acquireAudioContext(){return ne(this,void 0,void 0,function*(){var e,r;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(e=zq())!==null&&e!==void 0?e:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(a=>a.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),Ca(200)])}catch(a){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:a}))}const n=((r=this.audioContext)===null||r===void 0?void 0:r.state)==="running";n!==this.canPlaybackAudio&&(this.audioEnabled=n,this.emit(et.AudioPlaybackStatusChanged,n))})}createParticipant(e,r){var n;let a;return r?a=fb.fromParticipantInfo(this.engine.client,r,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):a=new fb(this.engine.client,"",e,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&a.setAudioContext(this.audioContext),!((n=this.options.audioOutput)===null||n===void 0)&&n.deviceId&&a.setAudioOutput(this.options.audioOutput).catch(i=>this.log.warn("Could not set audio output: ".concat(i.message),this.logContext)),a}getOrCreateParticipant(e,r){if(this.remoteParticipants.has(e)){const a=this.remoteParticipants.get(e);return r&&a.updateInfo(r)&&this.sidToIdentity.set(r.sid,r.identity),a}const n=this.createParticipant(e,r);return this.remoteParticipants.set(e,n),this.sidToIdentity.set(r.sid,r.identity),this.emitWhenConnected(et.ParticipantConnected,n),n.on(yt.TrackPublished,a=>{this.emitWhenConnected(et.TrackPublished,a,n)}).on(yt.TrackSubscribed,(a,i)=>{a.kind===Ke.Kind.Audio?(a.on(dt.AudioPlaybackStarted,this.handleAudioPlaybackStarted),a.on(dt.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):a.kind===Ke.Kind.Video&&(a.on(dt.VideoPlaybackFailed,this.handleVideoPlaybackFailed),a.on(dt.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(et.TrackSubscribed,a,i,n)}).on(yt.TrackUnpublished,a=>{this.emit(et.TrackUnpublished,a,n)}).on(yt.TrackUnsubscribed,(a,i)=>{this.emit(et.TrackUnsubscribed,a,i,n)}).on(yt.TrackMuted,a=>{this.emitWhenConnected(et.TrackMuted,a,n)}).on(yt.TrackUnmuted,a=>{this.emitWhenConnected(et.TrackUnmuted,a,n)}).on(yt.ParticipantMetadataChanged,a=>{this.emitWhenConnected(et.ParticipantMetadataChanged,a,n)}).on(yt.ParticipantNameChanged,a=>{this.emitWhenConnected(et.ParticipantNameChanged,a,n)}).on(yt.AttributesChanged,a=>{this.emitWhenConnected(et.ParticipantAttributesChanged,a,n)}).on(yt.ConnectionQualityChanged,a=>{this.emitWhenConnected(et.ConnectionQualityChanged,a,n)}).on(yt.ParticipantPermissionsChanged,a=>{this.emitWhenConnected(et.ParticipantPermissionsChanged,a,n)}).on(yt.TrackSubscriptionStatusChanged,(a,i)=>{this.emitWhenConnected(et.TrackSubscriptionStatusChanged,a,i,n)}).on(yt.TrackSubscriptionFailed,(a,i)=>{this.emit(et.TrackSubscriptionFailed,a,n,i)}).on(yt.TrackSubscriptionPermissionChanged,(a,i)=>{this.emitWhenConnected(et.TrackSubscriptionPermissionChanged,a,i,n)}).on(yt.Active,()=>{this.emitWhenConnected(et.ParticipantActive,n),n.kind===$m.AGENT&&this.localParticipant.setActiveAgent(n)}),r&&n.updateInfo(r),n}sendSyncState(){const e=Array.from(this.remoteParticipants.values()).reduce((n,a)=>(n.push(...a.getTrackPublications()),n),[]),r=this.localParticipant.getTrackPublications();this.engine.sendSyncState(e,r)}updateSubscriptions(){for(const e of this.remoteParticipants.values())for(const r of e.videoTrackPublications.values())r.isSubscribed&&wue(r)&&r.emitTrackUpdate()}getRemoteParticipantBySid(e){const r=this.sidToIdentity.get(e);if(r)return this.remoteParticipants.get(r)}registerConnectionReconcile(){this.clearConnectionReconcile();let e=0;this.connectionReconcileInterval=Ta.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(e++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:e,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),e>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Gs.STATE_MISMATCH))):e=0},$de)}clearConnectionReconcile(){this.connectionReconcileInterval&&Ta.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(e){return e===this.state?!1:(this.state=e,this.emit(et.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(e=>{let[r,n]=e;this.emit(r,...n)}),this.bufferedEvents=[]}emitWhenConnected(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];if(this.state===Mr.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([e,n]);else if(this.state===Mr.Connected)return this.emit(e,...n);return!1}simulateParticipants(e){return ne(this,void 0,void 0,function*(){var r,n,a,i;const o=Object.assign({audio:!0,video:!0,useRealTracks:!1},e.publish),c=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},e.participants);if(this.handleDisconnect(),this.roomInfo=new c0({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:kn.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new dd({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(et.SignalConnected),this.emit(et.Connected),this.setAndEmitConnectionState(Mr.Connected),o.video){const u=new CC(Ke.Kind.Video,new Ef({source:Yn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:zs.AUDIO,name:"video-dummy"}),new db(o.useRealTracks&&(!((r=window.navigator.mediaDevices)===null||r===void 0)&&r.getUserMedia)?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:CM(160*((n=c.aspectRatios[0])!==null&&n!==void 0?n:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(u),this.localParticipant.emit(yt.LocalTrackPublished,u)}if(o.audio){const u=new CC(Ke.Kind.Audio,new Ef({source:Yn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:zs.AUDIO}),new ub(o.useRealTracks&&(!((a=navigator.mediaDevices)===null||a===void 0)&&a.getUserMedia)?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:cE(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(u),this.localParticipant.emit(yt.LocalTrackPublished,u)}for(let u=0;u<c.count-1;u+=1){let d=new dd({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(u),state:Uf.ACTIVE,tracks:[],joinedAt:kn.parse(Date.now())});const f=this.getOrCreateParticipant(d.identity,d);if(c.video){const h=CM(160*((i=c.aspectRatios[u%c.aspectRatios.length])!==null&&i!==void 0?i:1),160,!1,!0),m=new Ef({source:Yn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:zs.AUDIO});f.addSubscribedMediaTrack(h,m.sid,new MediaStream([h]),new RTCRtpReceiver),d.tracks=[...d.tracks,m]}if(c.audio){const h=cE(),m=new Ef({source:Yn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:zs.AUDIO});f.addSubscribedMediaTrack(h,m.sid,new MediaStream([h]),new RTCRtpReceiver),d.tracks=[...d.tracks,m]}f.updateInfo(d)}})}emit(e){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];if(e!==et.ActiveSpeakersChanged&&e!==et.TranscriptionReceived){const i=i4(n).filter(o=>o!==void 0);(e===et.TrackSubscribed||e===et.TrackUnsubscribed)&&this.log.trace("subscribe trace: ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:i})),this.log.debug("room event ".concat(e),Object.assign(Object.assign({},this.logContext),{event:e,args:i}))}return super.emit(e,...n)}}dp.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function i4(t){return t.map(e=>{if(e)return Array.isArray(e)?i4(e):typeof e=="object"?"logContext"in e?e.logContext:void 0:e})}var qs;(function(t){t[t.IDLE=0]="IDLE",t[t.RUNNING=1]="RUNNING",t[t.SKIPPED=2]="SKIPPED",t[t.SUCCESS=3]="SUCCESS",t[t.FAILED=4]="FAILED"})(qs||(qs={}));class hu extends Qo.EventEmitter{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=qs.IDLE,this.logs=[],this.options={},this.url=e,this.token=r,this.name=this.constructor.name,this.room=new dp(n.roomOptions),this.connectOptions=n.connectOptions,this.options=n}run(e){return ne(this,void 0,void 0,function*(){if(this.status!==qs.IDLE)throw Error("check is running already");this.setStatus(qs.RUNNING);try{yield this.perform()}catch(r){r instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(r.message):this.appendError(r.message))}return yield this.disconnect(),yield new Promise(r=>setTimeout(r,500)),this.status!==qs.SKIPPED&&this.setStatus(this.isSuccess()?qs.SUCCESS:qs.FAILED),e&&e(),this.getInfo()})}isSuccess(){return!this.logs.some(e=>e.level==="error")}connect(e){return ne(this,void 0,void 0,function*(){return this.room.state===Mr.Connected?this.room:(e||(e=this.url),yield this.room.connect(e,this.token,this.connectOptions),this.room)})}disconnect(){return ne(this,void 0,void 0,function*(){this.room&&this.room.state!==Mr.Disconnected&&(yield this.room.disconnect(),yield new Promise(e=>setTimeout(e,500)))})}skip(){this.setStatus(qs.SKIPPED)}switchProtocol(e){return ne(this,void 0,void 0,function*(){let r=!1,n=!1;if(this.room.on(et.Reconnecting,()=>{r=!0}),this.room.once(et.Reconnected,()=>{n=!0}),this.room.simulateScenario("force-".concat(e)),yield new Promise(i=>setTimeout(i,1e3)),!r)return;const a=Date.now()+1e4;for(;Date.now()<a;){if(n)return;yield Ca(100)}throw new Error("Could not reconnect using ".concat(e," protocol after 10 seconds"))})}appendMessage(e){this.logs.push({level:"info",message:e}),this.emit("update",this.getInfo())}appendWarning(e){this.logs.push({level:"warning",message:e}),this.emit("update",this.getInfo())}appendError(e){this.logs.push({level:"error",message:e}),this.emit("update",this.getInfo())}setStatus(e){this.status=e,this.emit("update",this.getInfo())}get engine(){var e;return(e=this.room)===null||e===void 0?void 0:e.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class Vde extends hu{get description(){return"Cloud regions"}perform(){return ne(this,void 0,void 0,function*(){const e=new Rr(this.url,this.token);if(!e.isCloud()){this.skip();return}const r=[],n=new Set;for(let i=0;i<3;i++){const o=yield e.getNextBestRegionUrl();if(!o)break;if(n.has(o))continue;n.add(o);const c=yield this.checkCloudRegion(o);this.appendMessage("".concat(c.region," RTT: ").concat(c.rtt,"ms, duration: ").concat(c.duration,"ms")),r.push(c)}r.sort((i,o)=>(i.duration-o.duration)*.5+(i.rtt-o.rtt)*.5);const a=r[0];this.bestStats=a,this.appendMessage("best Cloud region: ".concat(a.region))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkCloudRegion(e){return ne(this,void 0,void 0,function*(){var r,n;yield this.connect(e),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const a=(r=this.room.serverInfo)===null||r===void 0?void 0:r.region;if(!a)throw new Error("Region not found");const i=yield this.room.localParticipant.streamText({topic:"test"}),o=1e3,u=1e6/o,d="A".repeat(o),f=Date.now();for(let w=0;w<u;w++)yield i.write(d);yield i.close();const h=Date.now(),m=yield(n=this.room.engine.pcManager)===null||n===void 0?void 0:n.publisher.getStats(),_={region:a,rtt:1e4,duration:h-f};return m?.forEach(w=>{w.type==="candidate-pair"&&w.nominated&&(_.rtt=w.currentRoundTripTime*1e3)}),yield this.disconnect(),_})}}const yE=1e4;class Hde extends hu{get description(){return"Connection via UDP vs TCP"}perform(){return ne(this,void 0,void 0,function*(){const e=yield this.checkConnectionProtocol("udp"),r=yield this.checkConnectionProtocol("tcp");this.bestStats=e,e.qualityLimitationDurations.bandwidth-r.qualityLimitationDurations.bandwidth>.5||(e.packetsLost-r.packetsLost)/e.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=r):this.appendMessage("best connection quality via udp");const n=this.bestStats;this.appendMessage("upstream bitrate: ".concat((n.bitrateTotal/n.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((n.rttTotal/n.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((n.jitterTotal/n.count*1e3).toFixed(2)," ms")),n.packetsLost>0&&this.appendWarning("packets lost: ".concat((n.packetsLost/n.packetsSent*100).toFixed(2),"%")),n.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((n.qualityLimitationDurations.bandwidth/(yE/1e3)*100).toFixed(2),"%")),n.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((n.qualityLimitationDurations.cpu/(yE/1e3)*100).toFixed(2),"%"))})}getInfo(){const e=super.getInfo();return e.data=this.bestStats,e}checkConnectionProtocol(e){return ne(this,void 0,void 0,function*(){yield this.connect(),e==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const r=document.createElement("canvas");r.width=1280,r.height=720;const n=r.getContext("2d");if(!n)throw new Error("Could not get canvas context");let a=0;const i=()=>{a=(a+1)%360,n.fillStyle="hsl(".concat(a,", 100%, 50%)"),n.fillRect(0,0,r.width,r.height),requestAnimationFrame(i)};i();const c=r.captureStream(30).getVideoTracks()[0],d=(yield this.room.localParticipant.publishTrack(c,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,f={protocol:e,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},h=setInterval(()=>ne(this,void 0,void 0,function*(){const m=yield d.getRTCStatsReport();m?.forEach(_=>{_.type==="outbound-rtp"?(f.packetsSent=_.packetsSent,f.qualityLimitationDurations=_.qualityLimitationDurations,f.bitrateTotal+=_.targetBitrate,f.count++):_.type==="remote-inbound-rtp"&&(f.packetsLost=_.packetsLost,f.rttTotal+=_.roundTripTime,f.jitterTotal+=_.jitter)})}),1e3);return yield new Promise(m=>setTimeout(m,yE)),clearInterval(h),c.stop(),r.remove(),yield this.disconnect(),f})}}class Gde extends hu{get description(){return"Can publish audio"}perform(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.connect(),n=yield Bde();if(yield qq(n,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),r.localParticipant.publishTrack(n),yield new Promise(c=>setTimeout(c,3e3));const i=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!i)throw new Error("Could not get RTCStats");let o=0;if(i.forEach(c=>{c.type==="outbound-rtp"&&(c.kind==="audio"||!c.kind&&c.mediaType==="audio")&&(o=c.packetsSent)}),o===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(o," audio packets"))})}}class Wde extends hu{get description(){return"Can publish video"}perform(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.connect(),n=yield Lde();yield this.checkForVideo(n.mediaStreamTrack),r.localParticipant.publishTrack(n),yield new Promise(o=>setTimeout(o,5e3));const a=yield(e=n.sender)===null||e===void 0?void 0:e.getStats();if(!a)throw new Error("Could not get RTCStats");let i=0;if(a.forEach(o=>{o.type==="outbound-rtp"&&(o.kind==="video"||!o.kind&&o.mediaType==="video")&&(i+=o.packetsSent)}),i===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(i," video packets"))})}checkForVideo(e){return ne(this,void 0,void 0,function*(){const r=new MediaStream;r.addTrack(e.clone());const n=document.createElement("video");n.srcObject=r,n.muted=!0,n.autoplay=!0,n.playsInline=!0,n.setAttribute("playsinline","true"),document.body.appendChild(n),yield new Promise(a=>{n.onplay=()=>{setTimeout(()=>{var i,o,c,u;const d=document.createElement("canvas"),f=e.getSettings(),h=(o=(i=f.width)!==null&&i!==void 0?i:n.videoWidth)!==null&&o!==void 0?o:1280,m=(u=(c=f.height)!==null&&c!==void 0?c:n.videoHeight)!==null&&u!==void 0?u:720;d.width=h,d.height=m;const _=d.getContext("2d");_.drawImage(n,0,0);const b=_.getImageData(0,0,d.width,d.height).data;let E=!0;for(let T=0;T<b.length;T+=4)if(b[T]!==0||b[T+1]!==0||b[T+2]!==0){E=!1;break}E?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),a()},1e3)},n.play()}),r.getTracks().forEach(a=>a.stop()),n.remove()})}}class Kde extends hu{get description(){return"Resuming connection after interruption"}perform(){return ne(this,void 0,void 0,function*(){var e;const r=yield this.connect();let n=!1,a=!1,i;const o=new Promise(d=>{setTimeout(d,5e3),i=d}),c=()=>{n=!0};r.on(et.SignalReconnecting,c).on(et.Reconnecting,c).on(et.Reconnected,()=>{a=!0,i(!0)}),(e=r.engine.client.ws)===null||e===void 0||e.close();const u=r.engine.client.onClose;if(u&&u(""),yield o,n){if(!a||r.state!==Mr.Connected)throw this.appendWarning("reconnection is only possible in Redis-based configurations"),new Error("Not able to reconnect")}else throw new Error("Did not attempt to reconnect")})}}class Yde extends hu{get description(){return"Can connect via TURN"}perform(){return ne(this,void 0,void 0,function*(){var e,r,n;up(new URL(this.url))&&(this.appendMessage("Using region specific url"),this.url=(e=yield new Rr(this.url,this.token).getNextBestRegionUrl())!==null&&e!==void 0?e:this.url);const a=new KP,i=yield a.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0);let o=!1,c=!1,u=!1;for(let d of i.iceServers)for(let f of d.urls)f.startsWith("turn:")?(c=!0,u=!0):f.startsWith("turns:")&&(c=!0,u=!0,o=!0),f.startsWith("stun:")&&(u=!0);u?c&&!o&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield a.close(),!((n=(r=this.connectOptions)===null||r===void 0?void 0:r.rtcConfig)===null||n===void 0)&&n.iceServers||c?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(d=>setTimeout(d,0)))})}}class Xde extends hu{get description(){return"Establishing WebRTC connection"}perform(){return ne(this,void 0,void 0,function*(){let e=!1,r=!1;this.room.on(et.SignalConnected,()=>{var n;const a=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(i,o)=>{if(i.candidate){const c=new RTCIceCandidate(i);let u="".concat(c.protocol," ").concat(c.address,":").concat(c.port," ").concat(c.type);c.address&&(Jde(c.address)?u+=" (private)":c.protocol==="tcp"&&c.tcpType==="passive"?(e=!0,u+=" (passive)"):c.protocol==="udp"&&(r=!0)),this.appendMessage(u)}a&&a(i,o)},!((n=this.room.engine.pcManager)===null||n===void 0)&&n.subscriber&&(this.room.engine.pcManager.subscriber.onIceCandidateError=i=>{i instanceof RTCPeerConnectionIceErrorEvent&&this.appendWarning("error with ICE candidate: ".concat(i.errorCode," ").concat(i.errorText," ").concat(i.url))})});try{yield this.connect(),or.info("now the room is connected")}catch(n){throw this.appendWarning("ports need to be open on firewall in order to connect."),n}e||this.appendWarning("Server is not configured for ICE/TCP"),r||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function Jde(t){const e=t.split(".");if(e.length===4){if(e[0]==="10")return!0;if(e[0]==="192"&&e[1]==="168")return!0;if(e[0]==="172"){const r=parseInt(e[1],10);if(r>=16&&r<=31)return!0}}return!1}class Qde extends hu{get description(){return"Connecting to signal connection via WebSocket"}perform(){return ne(this,void 0,void 0,function*(){var e,r,n;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let a=new KP,i;try{i=yield a.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0)}catch(o){if(up(new URL(this.url))){this.appendMessage("Initial connection failed with error ".concat(o.message,". Retrying with region fallback"));const u=yield new Rr(this.url,this.token).getNextBestRegionUrl();u&&(i=yield a.join(u,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0),this.appendMessage("Fallback to region worked. To avoid initial connections failing, ensure you're calling room.prepareConnection() ahead of time"))}}i?(this.appendMessage("Connected to server, version ".concat(i.serverVersion,".")),((e=i.serverInfo)===null||e===void 0?void 0:e.edition)===G5.Cloud&&(!((r=i.serverInfo)===null||r===void 0)&&r.region)&&this.appendMessage("LiveKit Cloud: ".concat((n=i.serverInfo)===null||n===void 0?void 0:n.region))):this.appendError("Websocket connection could not be established"),yield a.close()})}}class ISe extends Qo.EventEmitter{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=e,this.token=r,this.options=n}getNextCheckId(){const e=this.checkResults.size;return this.checkResults.set(e,{logs:[],status:qs.IDLE,name:"",description:""}),e}updateCheck(e,r){this.checkResults.set(e,r),this.emit("checkUpdate",e,r)}isSuccess(){return Array.from(this.checkResults.values()).every(e=>e.status!==qs.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(e){return ne(this,void 0,void 0,function*(){const r=this.getNextCheckId(),n=new e(this.url,this.token,this.options),a=o=>{this.updateCheck(r,o)};n.on("update",a);const i=yield n.run();return n.off("update",a),i})}checkWebsocket(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Qde)})}checkWebRTC(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Xde)})}checkTURN(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Yde)})}checkReconnect(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Kde)})}checkPublishAudio(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Gde)})}checkPublishVideo(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Wde)})}checkConnectionProtocol(){return ne(this,void 0,void 0,function*(){const e=yield this.createAndRunCheck(Hde);if(e.data&&"protocol"in e.data){const r=e.data;this.options.protocol=r.protocol}return e})}checkCloudRegion(){return ne(this,void 0,void 0,function*(){return this.createAndRunCheck(Vde)})}}function _r(t,e,r){return(e=efe(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Zde(t,e){if(typeof t!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function efe(t){var e=Zde(t,"string");return typeof e=="symbol"?e:e+""}new TextEncoder;new TextDecoder;class Xa extends Error{constructor(e,r){var n;super(e,r),_r(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,(n=Error.captureStackTrace)===null||n===void 0||n.call(Error,this,this.constructor)}}_r(Xa,"code","ERR_JOSE_GENERIC");class tfe extends Xa{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:a,payload:r}}),_r(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),_r(this,"claim",void 0),_r(this,"reason",void 0),_r(this,"payload",void 0),this.claim=n,this.reason=a,this.payload=r}}_r(tfe,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class rfe extends Xa{constructor(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(e,{cause:{claim:n,reason:a,payload:r}}),_r(this,"code","ERR_JWT_EXPIRED"),_r(this,"claim",void 0),_r(this,"reason",void 0),_r(this,"payload",void 0),this.claim=n,this.reason=a,this.payload=r}}_r(rfe,"code","ERR_JWT_EXPIRED");class nfe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}_r(nfe,"code","ERR_JOSE_ALG_NOT_ALLOWED");class afe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JOSE_NOT_SUPPORTED")}}_r(afe,"code","ERR_JOSE_NOT_SUPPORTED");class ife extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"decryption operation failed",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,"code","ERR_JWE_DECRYPTION_FAILED")}}_r(ife,"code","ERR_JWE_DECRYPTION_FAILED");class sfe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWE_INVALID")}}_r(sfe,"code","ERR_JWE_INVALID");class ofe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWS_INVALID")}}_r(ofe,"code","ERR_JWS_INVALID");class cfe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWT_INVALID")}}_r(cfe,"code","ERR_JWT_INVALID");class lfe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWK_INVALID")}}_r(lfe,"code","ERR_JWK_INVALID");class ufe extends Xa{constructor(){super(...arguments),_r(this,"code","ERR_JWKS_INVALID")}}_r(ufe,"code","ERR_JWKS_INVALID");class dfe extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"no applicable key found in the JSON Web Key Set",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}_r(dfe,"code","ERR_JWKS_NO_MATCHING_KEY");class ffe extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"multiple matching keys found in the JSON Web Key Set",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,Symbol.asyncIterator,void 0),_r(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}_r(ffe,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class pfe extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"request timed out",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,"code","ERR_JWKS_TIMEOUT")}}_r(pfe,"code","ERR_JWKS_TIMEOUT");class hfe extends Xa{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"signature verification failed",r=arguments.length>1?arguments[1]:void 0;super(e,r),_r(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}_r(hfe,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const s4=v.createContext(null),mfe=()=>v.useContext(s4);function gfe({children:t}){const{user:e}=$r(),r=ks(),n=e?.id,a=!!(e?.email&&/@guest\.local$/i.test(e.email)),i=!!n&&!a,o=v.useRef(null),[c,u]=v.useState(null),[d,f]=v.useState(!1),[h,m]=v.useState(!1),[_,w]=v.useState(null),[b,E]=v.useState([]),[T,R]=v.useState(null),[P,A]=v.useState(!1),[C,O]=v.useState(!1),[I,x]=v.useState(null),D=v.useCallback(()=>{const ie=o.current;if(!ie){E([]),R(null);return}const G=[];ie.remoteParticipants.forEach(K=>{const ae=K.getTrackPublication(Ke.Source.Camera)?.track,te=K.getTrackPublication(Ke.Source.Microphone)?.track;G.push({id:K.identity,name:K.name||K.identity,isSelf:!1,audioEnabled:K.isMicrophoneEnabled,videoEnabled:K.isCameraEnabled,isSpeaking:K.isSpeaking,videoTrack:ae||void 0,audioTrack:te||void 0})}),E(G);const B=ie.localParticipant;if(B){const ae=B.getTrackPublication(Ke.Source.Camera)?.track,te=B.getTrackPublication(Ke.Source.Microphone)?.track;R({id:B.identity,name:B.name||B.identity,isSelf:!0,audioEnabled:B.isMicrophoneEnabled,videoEnabled:B.isCameraEnabled,isSpeaking:B.isSpeaking,videoTrack:ae||void 0,audioTrack:te||void 0}),x(ae||null),A(B.isMicrophoneEnabled),O(B.isCameraEnabled)}},[]),N=v.useRef(null),L=v.useRef(!1),j=v.useCallback(async ie=>{if(!i||!r){w("Not authenticated");return}if(N.current!==ie){if(o.current){try{o.current.disconnect()}catch{}o.current=null}N.current=ie,L.current=!1,m(!0),w(null);try{const G=await new Promise(Ae=>{r.emit("livekit_join",{roomId:ie},Ae)});if(L.current){N.current=null;return}if(!G?.ok)throw new Error(G?.error||"Failed to get LiveKit token");const{token:B,url:K,iceServers:ae}=G,te={};ae&&Array.isArray(ae)&&ae.length>0&&(te.iceServers=ae,te.iceTransportPolicy="all");const me=new dp({adaptiveStream:!0,dynacast:!0,videoCaptureDefaults:{resolution:lp.h540.resolution}});await me.prepareConnection(K,B),me.on(et.Connected,()=>{f(!0),m(!1),D()}),me.on(et.Disconnected,()=>{f(!1),u(null),D()}),me.on(et.ParticipantConnected,Ae=>{D()}),me.on(et.ParticipantDisconnected,Ae=>{D()}),me.on(et.TrackSubscribed,(Ae,He,ce)=>{D()}),me.on(et.TrackUnsubscribed,(Ae,He,ce)=>{D()}),me.on(et.LocalTrackPublished,(Ae,He)=>{D()}),me.on(et.LocalTrackUnpublished,(Ae,He)=>{D()}),me.on(et.ActiveSpeakersChanged,()=>{D()}),me.on(et.ConnectionStateChanged,Ae=>{Ae===Mr.Disconnected&&f(!1)});const ue=Object.keys(te).length>0?{rtcConfig:te}:void 0;if(await me.connect(K,B,ue),L.current){me.disconnect(),N.current=null;return}o.current=me,u(ie),N.current=null}catch(G){w(G?.message||"Failed to join room"),m(!1),N.current=null}}},[i,r,D]),q=v.useCallback(()=>{L.current=!0,N.current=null;const ie=o.current;if(ie){try{ie.disconnect()}catch{}o.current=null}f(!1),m(!1),u(null),E([]),R(null),x(null)},[]),U=v.useCallback(async()=>{const ie=o.current;if(ie)try{await ie.localParticipant.setMicrophoneEnabled(!P),A(!P)}catch{}},[P]),W=v.useCallback(async()=>{const ie=o.current;if(ie)try{await ie.localParticipant.setCameraEnabled(!C),O(!C),D()}catch{}},[C,D]),F=v.useCallback(async ie=>{const G=o.current;if(G)try{await G.localParticipant.setMicrophoneEnabled(ie),A(ie)}catch{}},[]),Y=v.useCallback(async ie=>{const G=o.current;if(G)try{await G.localParticipant.setCameraEnabled(ie),O(ie),D()}catch{}},[D]);v.useEffect(()=>()=>{if(L.current=!0,N.current=null,o.current){try{o.current.disconnect()}catch{}o.current=null}},[]);const Q={connected:d,connecting:h,error:_,joinRoom:j,leaveRoom:q,currentRoomId:c,participants:b,localParticipant:T,micEnabled:P,videoEnabled:C,toggleMic:U,toggleVideo:W,setMicEnabled:F,setVideoEnabled:Y,localVideoTrack:I};return g.jsx(s4.Provider,{value:Q,children:t})}const Rc={diceAudio:!0,backgroundMusic:!0,chatAudio:!1,video:!1,showAnimations:!0,lastGameMode:"cee-lo",diceColorTheme:"dice_white_black"},o4="app:settings:v1";async function nu(){try{const{value:t}=await ms.get({key:o4});if(!t)return{...Rc};const e=JSON.parse(t);return{...Rc,...e}}catch{return{...Rc}}}async function g0(t){await ms.set({key:o4,value:JSON.stringify(t)})}const yfe={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_TARGET:"poker",VITE_OTA:"1"},Wm=500,c4=new Array(Wm);let gm=0,pb=0;function vfe(){try{if(typeof window<"u"&&window.localStorage?.getItem("logs:disable")==="1"||typeof import.meta<"u"&&yfe?.VITE_LOGS_DISABLED==="1")return!1}catch{}return!0}function _fe(t){c4[gm]=t,gm=(gm+1)%Wm,pb=Math.min(pb+1,Wm);try{window.dispatchEvent(new CustomEvent("fe:log",{detail:t}))}catch{}}function l4(){const t=[],e=pb;for(let r=0;r<e;r++){const n=(gm-e+r+Wm)%Wm,a=c4[n];a&&t.push(a)}return t}function bfe(){gm=0,pb=0}function bv(t,e,r,n){const a={t:Date.now(),tag:t,level:e,msg:r,data:n};if(vfe()){`${new Date(a.t).toISOString()}${t}${e}`;try{const i=n===void 0?[]:[n]}catch{}_fe(a)}}const Bt={debug:(t,e)=>bv("RTC","debug",t,e),info:(t,e)=>bv("RTC","info",t,e),warn:(t,e)=>bv("RTC","warn",t,e),error:(t,e)=>bv("RTC","error",t,e)};try{window.rtcLogs=l4,window.rtcLogsClear=bfe}catch{}const u4=v.createContext(null),kfe=()=>v.useContext(u4);function fn(t){return t.connectionState==="closed"||t.signalingState==="closed"}function kv(t){if(t)try{t.getTracks().forEach(e=>e.stop())}catch{}}function wfe(t){try{const e=t.getAudioTracks?.()||[],r=t.getVideoTracks?.()||[],n=e.map(i=>({id:i.id,kind:i.kind,enabled:i.enabled,ready:i.readyState})),a=r.map(i=>({id:i.id,kind:i.kind,enabled:i.enabled,ready:i.readyState,settings:i.getSettings?.()||void 0}));return{id:t.id,audioTracks:n.length,videoTracks:a.length,audio:n,video:a}}catch{return{id:t?.id}}}const Sfe=(()=>{if(typeof navigator>"u")return!1;const t=navigator.userAgent||navigator.vendor||window.opera||"";return/iPad|iPhone|iPod/.test(t)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1})();function Nh(t,e){const r=new Set,n=[],a=i=>{const o=Array.isArray(i.urls)?i.urls:i.urls?[i.urls]:[];for(const c of o){if(!c||typeof c!="string")continue;const u=c.trim();if(u.startsWith("stun:")){const d=`${u}|`;r.has(d)||(r.add(d),n.push({urls:u}));continue}if(u.startsWith("turn:")||u.startsWith("turns:")){const d=i.username,f=i.credential;if(d&&f){const h=`${u}|${d}|${f}`;r.has(h)||(r.add(h),n.push({urls:u,username:d,credential:f}))}}}};return(t||[]).forEach(a),n.length===0&&e.forEach(a),n.length?n:e}function Efe(t,e){if(!e.heartbeat){try{e.dc||(e.dc=e.pc.createDataChannel("ka",{negotiated:!1,ordered:!0}))}catch{}e.heartbeat=window.setInterval(()=>{try{e.dc?.readyState==="open"&&e.dc.send("ping")}catch{}},12e3)}}function Ih(t){t.heartbeat&&(clearInterval(t.heartbeat),t.heartbeat=void 0);try{t.dc?.close()}catch{}t.dc=void 0}function Tfe({children:t}){const{user:e}=$r(),r=ks(),n=e?.id,a=!!(e?.email&&/@guest\.local$/i.test(e.email)),i=!!n&&!a;function o(Z,X){try{const le=window;le.__rtcVideoDisableReasons||(le.__rtcVideoDisableReasons=[]),le.__rtcVideoDisableReasons.push({t:Date.now(),reason:Z,...X?{data:X}:{}});try{xC(`video:disable:${Z}`)}catch{}}catch{}}const{rtcJoin:c,rtcSignal:u,rtcLeave:d,rtcSetVideoEnabled:f}=pa(),h=v.useRef(new Map),[m,_]=v.useState({}),w=null,[b,E]=v.useState({}),[T,R]=v.useState(void 0),P=v.useRef(void 0),A=v.useRef(void 0),C=v.useRef(""),O=v.useRef(new Map),I=v.useRef(new Map),[x,D]=v.useState(!1),[N,L]=v.useState(!1),j=[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}],q=v.useRef([...j]),[U,W]=v.useState(0),F=v.useRef(null);v.useRef([]);const Y=v.useRef({audio:!1,video:!1}),Q=U>0||N||x,ie=v.useCallback(async()=>{try{const Z=navigator;Z?.wakeLock?.request&&!F.current&&(F.current=await Z.wakeLock.request("screen"),F.current.addEventListener("release",()=>{}))}catch{}},[]),G=v.useCallback(async()=>{try{await F.current?.release?.()}catch{}F.current=null},[]);v.useEffect(()=>(Bt.debug("wakeLock:effect",{need:Q}),Q?ie():G(),()=>{G()}),[Q,ie,G]),v.useEffect(()=>{const Z=()=>{document.visibilityState==="visible"&&Q&&ie()};return document.addEventListener("visibilitychange",Z),()=>document.removeEventListener("visibilitychange",Z)},[Q,ie]);const B=(()=>{try{return window.Capacitor?.getPlatform?.()==="ios"}catch{return!1}})();async function K(Z,X){if(!i||Y.current[X])return null;Y.current[X]=!0;try{return navigator.mediaDevices?.getUserMedia?await navigator.mediaDevices.getUserMedia(Z):(Bt.error("gUM:not-available",{kind:X,isNativeIOS:B}),null)}catch(le){return Bt.error("gUM:failed",{kind:X,errName:le?.name,errMsg:le?.message,isNativeIOS:B}),null}finally{Y.current[X]=!1}}async function ae(){if(!i)return;if(A.current)return A.current;const Z=await K({audio:!0,video:!1},"audio");if(Z){const X=Z.getAudioTracks()[0];X&&(X.enabled=!1),A.current=Z}return A.current}async function te(){if(!i)return;if(P.current)return P.current;const X=await K({audio:!1,video:Sfe?{facingMode:{ideal:"user"},width:{ideal:640,max:1280},height:{ideal:480,max:720},frameRate:{ideal:24,max:30}}:{facingMode:{ideal:"user"},width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30}}},"video");return X&&(P.current=X,R(X),Bt.info("ensureVideo:acquired",wfe(X))),P.current}function me(){const Z=P.current?.getVideoTracks()??[];try{Z.forEach(X=>{X.stop()})}catch{}P.current=void 0,R(void 0)}function ue(){try{A.current?.getAudioTracks()?.forEach(Z=>Z.stop())}catch{}A.current=void 0}const Ae=v.useRef(new Map),[He,ce]=v.useState({});function xe(Z,X){if(Ae.current.get(Z))return;const le=X?.getAudioTracks?.()??[];if(!le.length||le.every(Ye=>Ye.readyState!=="live"))return;let be;try{be=new AudioContext}catch(Ye){Bt.warn("vad:audiocontext-failed",{pid:Z,err:String(Ye)});return}let z,ee;try{z=be.createMediaStreamSource(X),ee=be.createAnalyser(),ee.fftSize=2048,z.connect(ee)}catch(Ye){Bt.warn("vad:setup-failed",{pid:Z,err:String(Ye)});try{be.close()}catch{}return}const se=new Uint8Array(ee.fftSize);let Oe=0;const wt=.04,er=.02;let Qt=!1,Zt=!1;const oa=()=>{if(!Zt){try{ee.getByteTimeDomainData(se);let Ye=0;for(let At=0;At<se.length;At++){const Rt=(se[At]-128)/128;Ye+=Rt*Rt}const Yt=Math.sqrt(Ye/se.length);!Qt&&Yt>=wt?(Qt=!0,ce(At=>At[Z]===!0?At:{...At,[Z]:!0})):Qt&&Yt<=er&&(Qt=!1,ce(At=>At[Z]===!1?At:{...At,[Z]:!1}))}catch{}Zt||(Oe=requestAnimationFrame(oa))}};Oe=requestAnimationFrame(oa);const On=()=>{Zt=!0,cancelAnimationFrame(Oe);try{z.disconnect()}catch{}try{ee.disconnect()}catch{}be.close().catch(()=>{})};Ae.current.set(Z,On)}function re(Z){const X=Ae.current.get(Z);X&&(X(),Ae.current.delete(Z)),ce(le=>{if(!(Z in le))return le;const be={...le};return delete be[Z],be})}function H(Z,X){try{return fn(Z)?void 0:Z.getTransceivers().find(le=>le.receiver.track?.kind===X)??Z.getTransceivers().find(le=>le.sender.track?.kind===X)??Z.getTransceivers()[X==="audio"?0:1]}catch{return}}function he(Z,X){try{return fn(Z)?void 0:Z.getSenders().find(le=>le.track?.kind===X)??H(Z,X)?.sender}catch{return}}async function Re(Z,X){try{if(fn(Z))return;const le=X?.getAudioTracks?.()[0]??null,be=he(Z,"audio");be&&await be.replaceTrack(le)}catch(le){Bt.warn("upsertAudioTrack:failed",{err:String(le)})}}async function fe(Z,X){try{if(fn(Z))return;const le=X?.getVideoTracks?.()[0]??null,be=he(Z,"video");be&&await be.replaceTrack(le)}catch(le){Bt.warn("upsertVideoTrack:failed",{err:String(le)})}}async function Ie(Z,X){try{const le=X.pc,be=Date.now();let z=0,ee=0;(await le.getStats()).forEach(wt=>{wt.type==="outbound-rtp"&&!wt.isRemote&&(z+=wt.bytesSent??0),wt.type==="inbound-rtp"&&!wt.isRemote&&(ee+=wt.bytesReceived??0)});const Oe=I.current.get(Z);I.current.set(Z,{t:be,up:z,down:ee}),Oe&&le.connectionState==="connected"&&z===Oe.up&&ee===Oe.down&&be-Oe.t>2e4&&await _t(Z,X)}catch{}}function ct(Z,X){if(O.current.get(Z))return;const le=window.setInterval(()=>Ie(Z,X),1e4);O.current.set(Z,le)}function $e(Z){const X=O.current.get(Z);X&&(clearInterval(X),O.current.delete(Z)),I.current.delete(Z)}function tt(){const Z=typeof window<"u"?new URL(window.location.href):null,X=typeof localStorage<"u"&&(localStorage.getItem("rtcRelayOnly")==="1"||localStorage.getItem("rtcRelayOnly")==="true")||Z?.searchParams.get("rtcRelay")==="1"||Z?.searchParams.get("rtcRelay")==="true",le=!!it._compat,be=!!(X||le),z={iceServers:Nh(q.current,j),bundlePolicy:"balanced",iceTransportPolicy:be?"relay":"all",rtcpMuxPolicy:"require",iceCandidatePoolSize:2};z.iceServers.some(se=>(Array.isArray(se.urls)?se.urls:[se.urls]).some(wt=>wt.startsWith("turn:")||wt.startsWith("turns:"))),Bt.debug("pc:new",{relayOnly:be,iceTransportPolicy:z.iceTransportPolicy,iceServers:(z.iceServers||[]).map(se=>typeof se.urls=="string"?se.urls:se.urls?.[0])});let ee;try{ee=new RTCPeerConnection(z)}catch(se){Bt.error("pc:new-failed",{err:String(se),servers:z.iceServers});const Oe={...z,iceServers:j};ee=new RTCPeerConnection(Oe)}return ee.addTransceiver("audio",{direction:"sendrecv"}),ee.addTransceiver("video",{direction:"sendrecv"}),ee}async function We(Z,X){try{const le=await X.getStats(),be={};le.forEach(ee=>{ee&&ee.id&&(be[ee.id]=ee)});let z;if(le.forEach(ee=>{ee.type==="transport"&&ee.selectedCandidatePairId&&be[ee.selectedCandidatePairId]&&(z=be[ee.selectedCandidatePairId])}),z||le.forEach(ee=>{ee.type==="candidate-pair"&&(ee.selected||ee.state==="succeeded")&&(z=ee)}),z){const ee=be[z.localCandidateId],se=be[z.remoteCandidateId];Bt.info("ice:selected",{peerId:Z,state:z.state,nominated:z.nominated,bytesSent:z.bytesSent,bytesReceived:z.bytesReceived,local:ee?{type:ee.candidateType,protocol:ee.protocol,address:ee.address,port:ee.port}:void 0,remote:se?{type:se.candidateType,protocol:se.protocol,address:se.address,port:se.port}:void 0})}else Bt.debug("ice:selected:none",{peerId:Z})}catch(le){Bt.error("ice:selected-failed",{peerId:Z,err:String(le)})}}async function it(){try{if(it._ran)return;it._ran=!0;const Z={iceServers:Nh(q.current,j),bundlePolicy:"balanced",iceTransportPolicy:"all"},X=new RTCPeerConnection(Z),le={host:0,srflx:0,relay:0,prflx:0};X.onicecandidate=wt=>{if(!wt.candidate)return;const Zt=(wt.candidate.candidate||"").match(/ typ ([a-z]+)/)?.[1]||"unknown";le[Zt]===void 0&&(le[Zt]=0),le[Zt]+=1},X.createDataChannel("probe");const be=await X.createOffer({iceRestart:!1});await X.setLocalDescription(be),await new Promise(wt=>setTimeout(wt,4e3));try{X.close()}catch{}const z=(le.relay||0)>0,ee=(le.srflx||0)>0,se=(le.host||0)>0,Oe=z&&!ee&&se;if(Oe){Bt.warn("ice:probe-forcing-relay",{counts:le,reason:"no-srflx"}),it._compat=!0;try{localStorage.setItem("rtcRelayOnly","1")}catch{}}else!z&&!ee&&Bt.error("ice:probe-restricted-network",{counts:le,warning:"Voice/video may not work"});Bt.info("ice:probe",{counts:le,relayOK:z,srflxOK:ee,needsRelayOnly:Oe})}catch(Z){Bt.error("ice:probe-failed",{err:String(Z)})}}function Et(Z){let X=h.current.get(Z);if(X)return X;const le=tt(),be={pc:le,iceBuffer:[],makingOffer:!1,ignoreOffer:!1,isSettingRemoteAnswerPending:!1};return le.onicecandidate=z=>{z.candidate&&(Bt.debug("pc:icecandidate",{peerId:Z,ctype:z.candidate.type,proto:z.candidate.protocol,addr:z.candidate.address,port:z.candidate.port}),u(C.current,Z,{ice:z.candidate.toJSON()}).catch(console.error))},le.ontrack=z=>{if(Bt.info("pc:ontrack",{peerId:Z,kind:z.track.kind,id:z.track.id}),_(ee=>{const se=ee[Z]??new MediaStream;return se.getTracks().includes(z.track)||(se.addTrack(z.track),z.track.addEventListener("ended",()=>{Bt.debug("pc:track-ended",{peerId:Z,kind:z.track.kind,id:z.track.id}),_(Oe=>{const wt=Oe[Z];if(!wt)return Oe;try{wt.removeTrack(z.track)}catch{}return{...Oe,[Z]:wt}}),z.track.kind==="video"&&E(Oe=>({...Oe,[Z]:!1}))}),z.track.kind==="video"&&(z.track.addEventListener("mute",()=>{E(Oe=>({...Oe,[Z]:!1}))}),z.track.addEventListener("unmute",()=>{z.track.readyState==="live"&&E(Oe=>({...Oe,[Z]:!0}))}))),{...ee,[Z]:se}}),z.track.kind==="video"){const ee=z.track.readyState==="live"&&!z.track.muted;E(se=>({...se,[Z]:ee}))}},le.onnegotiationneeded=()=>{Bt.debug("pc:onnegotiationneeded",{peerId:Z})},le.onconnectionstatechange=()=>{const{connectionState:z}=le,ee=le.iceConnectionState;if(Bt.info("pc:state",{peerId:Z,state:z,ice:ee}),z==="connected"&&(be.degradedAt=null,be.iceRestartCount=0,be.rebuildAttempts=0,Efe(Z,be),ct(Z,be),setTimeout(()=>We(Z,le),500)),z==="closed"&&(Ih(be),$e(Z)),(z==="disconnected"||Mt(z,ee))&&!be.degradedAt&&(be.degradedAt=Date.now()),z==="disconnected"&&be.degradedAt){const Oe=Date.now()-be.degradedAt;Oe>3e3&&Oe<8e3?_t(Z,be):Oe>=8e3&&(Bt.warn("pc:prolonged-disconnect",{peerId:Z,degradedMs:Oe}),rt(Z))}Mt(z,ee)&&_t(Z,be)},le.oniceconnectionstatechange=()=>{const z=le.iceConnectionState;Bt.debug("pc:ice-state",{peerId:Z,ice:z}),z==="failed"&&_t(Z,be),z==="disconnected"&&setTimeout(()=>{!fn(le)&&le.iceConnectionState==="disconnected"&&(Bt.warn("ice:prolonged-disconnect",{peerId:Z}),_t(Z,be))},4e3)},le.onicegatheringstatechange=()=>{},le.ondatachannel=z=>{if(z.channel.label==="ka"){const ee=z.channel;be.dc=ee,Bt.debug("pc:datachannel",{peerId:Z,label:ee.label,state:ee.readyState})}},h.current.set(Z,be),W(h.current.size),Bt.info("peer:new",{peerId:Z}),be}function Mt(Z,X){return Z==="failed"||X==="failed"}async function _t(Z,X){if(fn(X.pc))return;const le=Date.now(),be=X.lastIceRestartAt,z=X.iceRestartCount??0,ee=Math.min(1e4*Math.pow(2,z),6e4);if(!(be&&le-be<ee)){if(z>=3){Bt.warn("ice:restart-exhausted",{peerId:Z,restartCount:z}),X.iceRestartCount=0,await rt(Z);return}if(Bt.warn("ice:restart",{peerId:Z,attempt:z+1}),!(X.makingOffer||fn(X.pc))&&(X.pc.signalingState!=="stable"&&await jt(X.pc),!fn(X.pc)))try{const se=await X.pc.createOffer({iceRestart:!0});if(fn(X.pc))return;await X.pc.setLocalDescription(se),await u(C.current,Z,{sdp:X.pc.localDescription}),X.lastIceRestartAt=le,X.iceRestartCount=z+1}catch(se){Bt.error("ice:restart-failed",{peerId:Z,err:String(se)}),X.iceRestartCount=0,await rt(Z)}}}const ge=v.useRef(new Map),Be=3,je=3e4;async function rt(Z){const X=ge.current.get(Z)??{count:0,lastAt:0},le=Date.now();if(le-X.lastAt>je*3&&(X.count=0),X.count>=Be){const se=je-(le-X.lastAt);if(se>0){Bt.warn("rebuild:rate-limited",{peerId:Z,attempts:X.count,waitMs:se}),setTimeout(()=>{ge.current.delete(Z),rt(Z)},se);return}X.count=0}X.count++,X.lastAt=le,ge.current.set(Z,X),Bt.info("rebuild:peer",{peerId:Z,attempt:X.count});const be=h.current.get(Z);if(be){Ih(be);try{be.pc.close()}catch{}h.current.delete(Z)}_(se=>{if(!se[Z])return se;const Oe={...se};return kv(Oe[Z]),delete Oe[Z],Oe}),re(Z),E(se=>{const{[Z]:Oe,...wt}=se;return wt});const{pc:z}=Et(Z);await st(z);const ee=h.current.get(Z);await De(Z,z,ee)}function Ct(Z){return Z.signalingState==="stable"}function jt(Z){return Z.signalingState==="stable"||fn(Z)?Promise.resolve():new Promise(X=>{const le=()=>{const be=Z.signalingState;(be==="stable"||be==="closed")&&(Z.removeEventListener("signalingstatechange",le),X())};Z.addEventListener("signalingstatechange",le)})}async function De(Z,X,le){try{if(fn(X)||(Ct(X)||await jt(X),!Ct(X)||le.makingOffer||fn(X)))return;le.makingOffer=!0,Bt.debug("sdp:offer",{peerId:Z});const be=await X.createOffer();if(fn(X)){le.makingOffer=!1;return}await X.setLocalDescription(be),await u(C.current,Z,{sdp:X.localDescription})}catch(be){Bt.warn("safeRenegotiate:failed",{peerId:Z,err:String(be)})}finally{le.makingOffer=!1}}const nt=v.useCallback(async Z=>{if(Z!==N){if(!i){L(!1),o("preferences:init"),L(!1);return}if(L(Z),n&&E(X=>({...X,[n]:Z})),Z){try{nm(!0)}catch{}if(!await te()){L(!1),n&&E(z=>({...z,[n]:!1}));return}for(const[z,ee]of h.current)await fe(ee.pc,P.current),await De(z,ee.pc,ee);const le=()=>{try{nm(!1)}catch{}};let be=!1;for(const[,z]of h.current){const ee=z.pc,se=()=>{!be&&ee.connectionState==="connected"&&(be=!0,le(),ee.removeEventListener("connectionstatechange",se))};ee.addEventListener("connectionstatechange",se)}window.setTimeout(()=>{be||le()},2500)}else{for(const[X,le]of h.current)await fe(le.pc,void 0),await De(X,le.pc,le);me()}f(C.current,Z).catch(()=>{});try{xC(Z?"videoEnabled:on":"videoEnabled:off")}catch{}}},[N,n,i,h,te,fe,De,me,f]),at=async Z=>{if(!i){D(!1);return}if(D(Z),Z&&!A.current&&!await ae()){D(!1);return}const X=A.current?.getAudioTracks?.()[0];X&&(X.enabled=Z);for(const[,le]of h.current)await Re(le.pc,A.current)},we=Z=>Z===n?!!P.current?.getVideoTracks?.().some(le=>le.readyState==="live"):!!m[Z]?.getVideoTracks?.().some(le=>le.readyState==="live"),st=async Z=>{if(!fn(Z)){if(!i){await Re(Z,void 0),await fe(Z,void 0);return}try{if(await ae(),N&&await te(),fn(Z))return;Bt.debug("attachLocalTracks",{audio:!!(x&&A.current),video:!!(N&&P.current)}),await Re(Z,x?A.current:void 0),await fe(Z,N?P.current:void 0)}catch(X){Bt.warn("attachLocalTracks:failed",{err:String(X)})}}},bt=v.useRef(0),nr=5400*1e3;v.useEffect(()=>{if(!C.current||h.current.size===0)return;const Z=async()=>{const le=Date.now();if(!(le-bt.current<nr)){Bt.info("ice:refresh-credentials",{roomId:C.current});try{const be=await c(C.current);if(be?.ok&&Array.isArray(be.iceServers)&&be.iceServers.length){const z=Nh([...j,...be.iceServers],j);q.current=z,bt.current=le,Bt.debug("ice:credentials-refreshed",{count:z.length})}}catch(be){Bt.warn("ice:refresh-failed",{err:String(be)})}}},X=window.setInterval(Z,6e4);return()=>clearInterval(X)},[U,c]);const ur=async Z=>{if(!i||!n)return;C.current=Z,Bt.info("rtc:join",{roomId:Z});const X=3,le=150;let be=null,z=null;for(let ee=0;ee<X&&(be=await c(Z),!(be?.ok||(z=be?.error||"rtc_join failed",!/not a member|room not found/i.test(z||"")||ee>=X-1)));ee++)Bt.warn("rtc:join:retry",{roomId:Z,attempt:ee+1,error:z}),await new Promise(Oe=>setTimeout(Oe,le*(ee+1)));if(!be?.ok)throw new Error(z||"rtc_join failed");if(Array.isArray(be.iceServers)&&be.iceServers.length){const ee=Nh([...j,...be.iceServers],j);q.current=ee,bt.current=Date.now(),ee.some(se=>(Array.isArray(se.urls)?se.urls:[se.urls]).some(wt=>wt.startsWith("turn:")||wt.startsWith("turns:"))),Bt.debug("rtc:ice-servers",{count:ee.length,servers:ee.map(se=>se.urls).slice(0,4)})}else q.current=[...j],bt.current=Date.now();if(it(),N&&!P.current){const ee=await te();ee&&R(ee)}for(const ee of be.peers.filter(se=>se!==n)){const{pc:se}=Et(ee);await st(se);const Oe=h.current.get(ee);await De(ee,se,Oe)}W(h.current.size)},dr=Z=>{!Z||C.current&&C.current,Bt.info("rtc:leave",{roomId:Z});try{d(Z)}catch{}for(const[,X]of h.current){Ih(X);try{X.pc.close()}catch{}}h.current.clear(),W(0),C.current=void 0,G(),_(X=>(Object.values(X).forEach(kv),{}));for(const X of Array.from(Ae.current.keys()))re(X);A.current?.getTracks()?.forEach(X=>X.stop()),P.current?.getTracks()?.forEach(X=>X.stop()),A.current=void 0,P.current=void 0,R(void 0),E({})},Sr=async(Z,X)=>{},un=async()=>{i&&await nt(!0)};return v.useEffect(()=>{if(!N||!C.current||h.current.size===0)return;const Z=async()=>{if(!N||!P.current)return;const le=P.current.getVideoTracks()[0];if(!((!le||le.readyState!=="live")&&(Bt.warn("health:video-track-dead"),P.current=void 0,!await te()))){for(const[be,z]of h.current)if(!fn(z.pc))try{const se=z.pc.getSenders().find(wt=>wt.track?.kind==="video")?.track,Oe=P.current?.getVideoTracks()[0];Oe&&(!se||se.id!==Oe.id)&&(Bt.info("health:reattach-video",{peerId:be}),await fe(z.pc,P.current),await De(be,z.pc,z))}catch(ee){Bt.warn("health:check-failed",{peerId:be,err:String(ee)})}}},X=window.setInterval(Z,5e3);return Z(),()=>clearInterval(X)},[N,U]),v.useEffect(()=>{if(!r||!i)return;const Z=async()=>{const X=C.current;if(X){Bt.info("socket:reconnect:rtc-rejoin",{roomId:X,peerCount:h.current.size});for(const[,le]of h.current){Ih(le);try{le.pc.close()}catch{}}h.current.clear(),W(0),_(le=>(Object.values(le).forEach(kv),{})),E({});try{const le=await c(X);if(!le?.ok){Bt.warn("socket:reconnect:rtc-rejoin-failed",{roomId:X,error:le?.error});return}if(Array.isArray(le.iceServers)&&le.iceServers.length){const be=Nh([...j,...le.iceServers],j);q.current=be,bt.current=Date.now()}for(const be of le.peers.filter(z=>z!==n)){const{pc:z}=Et(be);await st(z);const ee=h.current.get(be);await De(be,z,ee)}W(h.current.size),Bt.info("socket:reconnect:rtc-rejoin-success",{roomId:X,peerCount:h.current.size})}catch(le){Bt.error("socket:reconnect:rtc-rejoin-error",{roomId:X,err:String(le)})}}};return r.on("connect",Z),r.on("reconnect",Z),()=>{r.off("connect",Z),r.off("reconnect",Z)}},[r,i,n,c]),v.useEffect(()=>{const Z=A.current?.getAudioTracks?.()[0];x&&Z&&A.current?xe(n,A.current):re(n)},[A.current,n,x]),v.useEffect(()=>{for(const[Z,X]of Object.entries(m))X?.getAudioTracks().some(be=>be.enabled)&&xe(Z,X);for(const Z of Ae.current.keys())Z!==n&&!m[Z]&&re(Z)},[m,n]),Pa({onRtcPeerJoined:async({peerId:Z})=>{if(Bt.info("sig:peer-joined",{peerId:Z}),!(!C.current||Z===n))try{const{pc:X}=Et(Z);if(fn(X))return;await st(X);const le=h.current.get(Z);le&&!fn(X)&&await De(Z,X,le)}catch(X){Bt.warn("sig:peer-joined:failed",{peerId:Z,err:String(X)})}},onRtcPeerLeft:({peerId:Z})=>{Bt.info("sig:peer-left",{peerId:Z});const X=h.current.get(Z);if(X){Ih(X),$e(Z);try{X.pc.close()}catch{}}h.current.delete(Z),W(h.current.size),_(le=>{const be={...le};return kv(be[Z]),delete be[Z],be}),re(Z),E(le=>{const{[Z]:be,...z}=le;return z})},onRtcSignal:async({fromPeerId:Z,payload:X})=>{let le,be;try{le=Et(Z),be=le.pc}catch(z){Bt.warn("sig:getPeer-failed",{fromPeerId:Z,err:String(z)});return}if(fn(be)){Bt.debug("sig:pc-closed",{fromPeerId:Z});return}try{if(X.sdp){if(Bt.debug("sig:sdp",{fromPeerId:Z,type:X.sdp.type}),fn(be))return;const z=X.sdp;if(z.type==="answer"&&Ct(be)){Bt.debug("sig:stale-answer-ignored",{fromPeerId:Z,signalingState:be.signalingState});return}const ee=Ct(be)||le.isSettingRemoteAnswerPending,se=z.type==="offer"&&!ee;if(le.ignoreOffer=!(n<Z)&&se,le.ignoreOffer||(z.type==="answer"&&(le.isSettingRemoteAnswerPending=!0),se&&(fn(be)||await be.setLocalDescription({type:"rollback"})),fn(be)))return;if(await be.setRemoteDescription(z),le.isSettingRemoteAnswerPending=!1,z.type==="offer"&&!fn(be)){const Oe=await be.createAnswer();if(fn(be))return;await be.setLocalDescription(Oe),await u(C.current,Z,{sdp:be.localDescription})}for(;le.iceBuffer.length&&!fn(be);){const Oe=le.iceBuffer.shift();try{await be.addIceCandidate(Oe)}catch{}}}else if(X.ice){if(Bt.debug("sig:ice",{fromPeerId:Z,hasRemote:!!be.remoteDescription}),fn(be))return;const z=X.ice;if(be.remoteDescription)try{await be.addIceCandidate(z)}catch{}else le.iceBuffer.push(z)}}catch(z){const ee=String(z);Bt.error("sig:error",{fromPeerId:Z,err:ee}),(ee.includes("order of m-lines")||ee.includes("m-line")||ee.includes("InvalidAccessError"))&&(Bt.warn("sig:mline-mismatch-rebuild",{fromPeerId:Z}),await rt(Z))}},onRtcVideoEnabled:({playerId:Z,enabled:X})=>{Bt.debug("sig:video-enabled",{playerId:Z,enabled:X}),E(le=>({...le,[Z]:!!X}))}}),v.useEffect(()=>{let Z=!0;return(async()=>{try{const X=await nu();if(!Z)return;L(!1),n&&E(le=>({...le,[n]:!1})),D(i?!!X.chatAudio:!1)}catch{}})(),()=>{Z=!1}},[n,i]),v.useEffect(()=>{i||(D(!1),N&&o("auth:lost"),L(!1),n&&E(Z=>({...Z,[n]:!1})),(async()=>{for(const[Z,X]of h.current)await Re(X.pc,void 0),await fe(X.pc,void 0),await De(Z,X.pc,X).catch(()=>{})})(),ue(),me())},[i,n]),v.useEffect(()=>{const Z=X=>{const le=X.detail;le&&(typeof le.video=="boolean"&&le.video===!1&&(L(!1),E(be=>({...be,[n]:!1}))),typeof le.chatAudio=="boolean"&&D(le.chatAudio))};return window.addEventListener("app:settings",Z),()=>window.removeEventListener("app:settings",Z)},[n]),v.useEffect(()=>{const Z=()=>{if(document.visibilityState==="visible")for(const[be,z]of h.current)_t(be,z)},X=()=>{for(const[be,z]of h.current)_t(be,z)},le=()=>{for(const[be,z]of h.current)_t(be,z)};return document.addEventListener("visibilitychange",Z),window.addEventListener("online",X),window.addEventListener("offline",le),()=>{document.removeEventListener("visibilitychange",Z),window.removeEventListener("online",X),window.removeEventListener("offline",le)}},[]),v.useEffect(()=>{try{const Z=window;Z.__rtcCtxInternal||(Z.__rtcCtxInternal={}),Z.__rtcCtxInternal.peers=h.current,Z.__rtcCtxInternal.myVideoRef=P,Z.__rtcCtxInternal.videoEnabledState={current:N}}catch{}},[N,T,U]),g.jsx(u4.Provider,{value:{videoEnabled:N,setVideoEnabled:nt,enableCamera:un,joinRtc:ur,leaveRtc:dr,cameraOwnerId:w,setCameraOwner:Sr,remoteStreams:m,myVideo:T,micEnabled:x,setMicEnabled:at,hasVideo:we,speaking:He,remoteVideoFlags:b},children:t})}function Cfe(t){const e=[];for(const[r,n]of t)try{const a=n.pc;e.push({id:r,state:a.connectionState,ice:a.iceConnectionState,signaling:a.signalingState})}catch{}return e}function xC(t){try{const e=window,r=e.__rtcCtxInternal||{},n=r.peers||new Map,a=r.myVideoRef?.current,i=a?.getVideoTracks?.()[0],o={t:Date.now(),label:t,videoEnabled:r.videoEnabledState?.current,hasStream:!!a,trackState:i?.readyState,muted:i?.muted,peers:Cfe(n),activePeerCount:n.size};e.__rtcDiag||(e.__rtcDiag=[]),e.__rtcDiag.push(o),e.__rtcDiag.length>200&&e.__rtcDiag.splice(0,e.__rtcDiag.length-200),e.dispatchEvent?.(new CustomEvent("rtc:diag",{detail:o}))}catch{}}try{queueMicrotask(()=>{const t=window;t.__rtcCtxInternal||(t.__rtcCtxInternal={}),t.__dumpRtcDiag=xC})}catch{}function mu(){const t=mfe(),e=kfe(),r=!!t,n=v.useCallback(async h=>{r?await t.joinRoom(h):e?.joinRtc&&await Promise.resolve(e.joinRtc(h))},[r,t,e]),a=v.useCallback(h=>{r?t.leaveRoom():e?.leaveRtc&&e.leaveRtc(h)},[r,t,e]),i=v.useCallback(async h=>{r?await t.setVideoEnabled(h):e?.setVideoEnabled&&await e.setVideoEnabled(h)},[r,t,e]),o=v.useCallback(async h=>{r?await t.setMicEnabled(h):e?.setMicEnabled&&await e.setMicEnabled(h)},[r,t,e]),c=v.useMemo(()=>{if(r){const h={};t.localParticipant&&(h[t.localParticipant.id]=t.localParticipant.isSpeaking);for(const m of t.participants)h[m.id]=m.isSpeaking;return h}return e?.speaking??{}},[r,t.localParticipant,t.participants,e?.speaking]),u=v.useMemo(()=>{if(!r)return e?.myVideo;const h=t.localParticipant?.videoTrack||t.localVideoTrack;if(h){if(h.mediaStream instanceof MediaStream)return h.mediaStream;const m=h.mediaStreamTrack;if(m instanceof MediaStreamTrack){const _=new MediaStream;return _.addTrack(m),_}}},[r,t.localParticipant?.videoTrack,t.localVideoTrack,e?.myVideo]),d=v.useMemo(()=>{if(!r)return e?.remoteStreams??{};const h={};for(const m of t.participants){const _=new MediaStream;m.videoTrack&&"mediaStreamTrack"in m.videoTrack&&_.addTrack(m.videoTrack.mediaStreamTrack),m.audioTrack&&"mediaStreamTrack"in m.audioTrack&&_.addTrack(m.audioTrack.mediaStreamTrack),_.getTracks().length>0&&(h[m.id]=_)}return h},[r,t.participants,e?.remoteStreams]),f=v.useMemo(()=>{if(!r)return e?.remoteVideoFlags;const h={};t.localParticipant&&(h[t.localParticipant.id]=t.localParticipant.videoEnabled);for(const m of t.participants)h[m.id]=m.videoEnabled;return h},[r,t.localParticipant,t.participants,e?.remoteVideoFlags]);return v.useMemo(()=>({joinRoom:n,leaveRoom:a,connected:r?t.connected:(e?.activePeerCount??0)>0,videoEnabled:r?t.videoEnabled:e?.videoEnabled??!1,setVideoEnabled:i,localVideoTrack:r?t.localVideoTrack:e?.myVideo??null,micEnabled:r?t.micEnabled:e?.micEnabled??!1,setMicEnabled:o,speaking:c,participants:r?t.participants:[],localParticipant:r?t.localParticipant:null,remoteStreams:d,myVideo:u,remoteVideoFlags:f,throttleVideoForAnimation:e?.throttleVideoForAnimation,mode:r?"livekit":"mesh"}),[n,a,i,o,c,r,t,e,u,d,f])}const d4=v.createContext(null),Mi=()=>v.useContext(d4),vE={};function xfe({children:t}){const{user:e,meId:r}=$r(),n=r||e?.id,{resetSpin:a}=Xo(),i=tn(),{joinRoom:o,leaveRoom:c,setSpectate:u,pokerJoinRoom:d,getRoomsList:f}=pa(),[h,m]=v.useState(()=>{try{const D=window.__PRESEEDED_ROOM;if(D&&typeof D=="object")return delete window.__PRESEEDED_ROOM,D}catch{}return null}),{leaveRoom:_,joinRoom:w}=mu(),b=v.useRef({}),E=v.useMemo(()=>(h?.gameState??{}).phase==="waiting"||h===null,[h]),T=v.useCallback(async D=>{try{const N=await o(D);if(!N?.ok)throw new Error(N?.error||"Failed to join room");try{a()}catch{}if(m(N.room),!N.room?.singlePlayer)try{await Promise.resolve(w?.(D))}catch{}try{const L=await f?.(),q=(L&&(Array.isArray(L?.rooms)?L.rooms:Array.isArray(L?.data?.rooms)?L.data.rooms:[])||[]).find(U=>U?.id===D);q&&Array.isArray(q.players)&&m(U=>!U||U.id!==D?U:{...U,players:q.players})}catch{}return{ok:!0,room:N.room}}catch(N){try{if(!(typeof window<"u"&&(window.location?.search?.includes("e2e=1")||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")))throw N;const j=Date.now(),q=n||"e2e-user",U=e?.name||"E2E User",W={id:D,name:"E2E Room",gameMode:"craps",createdAt:j,updatedAt:j,bankerId:"bank",players:[{id:q,name:U,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:q,turnOrder:[q],roundSeq:1,crapsPassBets:[{playerId:q,amount:10}],crapsDontPassBets:[],crapsPlaceBets:[]}};try{a()}catch{}m(W);return}catch{throw N}}},[o,a,w,f,n,e?.name]),R=v.useCallback(async()=>{if(h){try{_(h.id)}catch{}try{await c(h.id)}finally{m(null)}}},[c,_,h]),P=v.useCallback((D,N)=>{if(!N)return D;if(!D)return N;try{const L=Array.isArray(D.players)?D.players:[],j=Array.isArray(N.players)?N.players:[];let q;if(j.length===0&&L.length>0)q=L;else if(L.length===0)q=j;else{const U=new Map(L.map(F=>[String(F.id),F])),W=new Map(j.map(F=>[String(F.id),F]));q=L.map(F=>W.get(String(F.id))||F);for(const[F,Y]of W.entries())U.has(F)||q.push(Y)}return{...D,...N,players:q}}catch{return N||D}},[]);Pa({onJoinedRoom:({room:D})=>{try{a()}catch{}m(N=>P(N,D))},onOtherPlayerJoined:({room:D})=>m(N=>P(N,D)),onOtherLeft:({room:D})=>{let N=!1,L=null;if(m(j=>{const q=P(j,D);try{const U=Array.isArray(D?.players)?D?.players:Array.isArray(q?.players)?q.players:[],W=String(n||"");if(!(W&&U.some(Y=>String(Y?.id)===W))&&j){if(!!(D?.singlePlayer||q?.singlePlayer))return q;const Q=String(j.id||""),ie=b.current[Q]||0,G=Date.now();return ie?G-ie<1500?q:(N=!0,L=String(j.id),delete b.current[Q],null):(b.current[Q]=G,q)}}catch{}return q}),N){try{L&&_?.(L)}catch{}try{i("/lobby",{replace:!0})}catch{}}},onSpectatorsUpdated:({spectators:D})=>{m(N=>N&&{...N,gameState:{...N.gameState,spectators:D}})},onPlayerProfileUpdated:({playerId:D,name:N,avatarUrl:L})=>{m(j=>{if(!j)return j;const q=j.players.map(U=>U.id!==D?U:{...U,...N!==void 0&&{name:N},...L!==void 0&&{avatarUrl:L}});return{...j,players:q}})},onBetsUpdated:({room:D})=>{D&&m(N=>{if(!N)return D;try{const L=new Map(N.players.map(U=>[U.id,U])),j=new Map((D.players||[]).map(U=>[U.id,U])),q=N.players.map(U=>j.get(U.id)||U);for(const[U,W]of j.entries())L.has(U)||q.push(W);return{...N,gameState:D.gameState??N.gameState,name:D.name??N.name,maxPlayers:D.maxPlayers??N.maxPlayers,private:D.private??N.private,singlePlayer:D.singlePlayer??N.singlePlayer,players:q}}catch{return N}})},onBankerChanged:D=>{m(N=>!N||N.id!==D.roomId?N:{...N,gameState:{...N.gameState,banker:D.bankerId,currentRollerId:D.currentRollerId,roundSeq:D.roundSeq,bankRoll:null}})},onForceLogout:()=>{try{h?.id&&_(h.id)}catch{}m(null)},onRoomUpdateState:({roomId:D,gameState:N,room:L})=>{const j=L?.gameState??N;if(!j)return;const q=Array.isArray(L?.players)?L.players:[];let U=!1,W=null;if(m(F=>{const Y=Q=>{if(!q.length)return Q;const ie=new Map(Q.map(G=>[G.id,G]));for(const G of q){const B=ie.get(G.id);B?ie.set(G.id,{...B,...G}):ie.set(G.id,G)}return Array.from(ie.values())};try{if(q.length&&F&&F.id===D){const Q=String(n||"");if(Q&&!q.some(G=>String(G?.id)===Q)){if(!!(L?.singlePlayer||F?.singlePlayer))return{...F,players:Y(F.players),gameState:j};const B=String(F.id||""),K=b.current[B]||0,ae=Date.now();return K?ae-K<1500?{...F,players:Y(F.players),gameState:j}:(U=!0,W=String(F.id),delete b.current[B],null):(b.current[B]=ae,{...F,players:Y(F.players),gameState:j})}}}catch{}return F&&F.id===D?{...F,players:Y(F.players),gameState:j}:F||{id:D,players:q,gameState:j}}),U){try{W&&_?.(W)}catch{}try{i("/lobby",{replace:!0})}catch{}}},onPlayerBalanceUpdated:({playerId:D,balance:N})=>{m(L=>{if(!L)return L;const j=L.players.findIndex(W=>W.id===D);if(j<0){const W=[...L.players,{id:D,balance:N}];return{...L,players:W}}const q=L.players[j];if(typeof q?.balance=="number"&&q.balance===N)return L;const U=L.players.slice();return U[j]={...q,balance:N},{...L,players:U}})},onError:D=>{try{const N=Vv?.()||[],L=Date.now(),j=[...N].filter(q=>L-q.ts<1200).slice(-1)[0]}catch{}}});const A=v.useMemo(()=>({room:h,isWaiting:E,joinRoom:T,leaveRoom:R,setRoom:m,setSpectatingForMe:async D=>{if(h)try{return await u(h.id,D)}catch(N){return{ok:!1,error:N?.message||"Failed"}}}}),[h,E,T,R,u]),C=ks(),O=v.useRef(0),I=v.useRef(!1),x=v.useCallback(async()=>{const D=Date.now();if(D-(O.current||0)<800)return;O.current=D;const N=h?.id;if(!N){try{const j=(Vv?.()||[]).slice(-1)[0];if(j&&String(j.event).toLowerCase().includes("create_room")&&D-(j.ts||0)<1500)return}catch{}return}try{const j=(Vv?.()||[]).slice(-1)[0];j&&String(j.event).toLowerCase().includes("create_room")&&D-(j.ts||0)<1500&&await new Promise(U=>setTimeout(U,1100))}catch{}try{const L=h?.gameMode==="poker";let j;if(L&&typeof d=="function"){const q=vE[N];if(q)j=await q;else{const U=d(N);vE[N]=U;try{j=await U}finally{delete vE[N]}}}else j=await o(N);if(j?.ok){try{a()}catch{}if(m(j.room),!j.room?.singlePlayer)try{await Promise.resolve(w?.(N))}catch{}try{const q=await f?.(),W=(q&&(Array.isArray(q?.rooms)?q.rooms:Array.isArray(q?.data?.rooms)?q.data.rooms:[])||[]).find(F=>F?.id===N);W&&Array.isArray(W.players)&&m(F=>!F||F.id!==N?F:{...F,players:W.players})}catch{}}}catch{}},[h?.id,d,o,a,w,f]);return v.useEffect(()=>{if(!C)return;const D=q=>{q!=="io client disconnect"&&(I.current=!0)},N=()=>{I.current&&(I.current=!1,x())},L=()=>{x()},j=()=>{x()};C.on("disconnect",D),C.on("connect",N);try{C.io.on("reconnect",L)}catch{}try{C.on?.("reconnect",j)}catch{}return()=>{C.off("disconnect",D),C.off("connect",N);try{C.io.off("reconnect",L)}catch{}try{C.off?.("reconnect",j)}catch{}}},[C,x]),v.useEffect(()=>{const D=()=>{try{document.visibilityState==="visible"&&(I.current||!C?.connected)&&x()}catch{}},N=()=>{(I.current||!C?.connected)&&x()},L=()=>{(I.current||!C?.connected)&&x()},j=()=>{x()};return window.addEventListener("visibilitychange",D),window.addEventListener("focus",N),window.addEventListener("pageshow",L),window.addEventListener("ad:complete",j),()=>{window.removeEventListener("visibilitychange",D),window.removeEventListener("focus",N),window.removeEventListener("pageshow",L),window.removeEventListener("ad:complete",j)}},[C,x]),g.jsx(d4.Provider,{value:A,children:t})}const wv=globalThis.__lastWagersFetchAt||(globalThis.__lastWagersFetchAt={}),XM=500;function y0(t,e){const r=ks(),{room:n}=Mi(),a=t&&e?`betsnap:${t}:${e}`:null,[i,o]=v.useState(()=>({roundSeq:1,open:[],settled:[],openAll:[],settledAll:[],playerBalance:null}));v.useEffect(()=>{a&&(async()=>{try{const re=await Yf(a);if(!re?.mainWagerId)return;o(H=>H.open.some(Re=>Re.type==="MAIN"&&Re.playerId===e)?H:{...H,roundSeq:re.roundSeq||H.roundSeq,open:[...H.open,{id:re.mainWagerId,type:"MAIN",playerId:e,acceptedById:null,amount:0,roundSeq:re.roundSeq}]})}catch{}})()},[a,e]),v.useEffect(()=>{a&&(async()=>{try{const re=await Yf(a);if(!re)return;re?.mainWagerId&&o(H=>H.open.some(Re=>Re.type==="MAIN"&&Re.playerId===e)?H:{...H,roundSeq:re.roundSeq||H.roundSeq,open:[...H.open,{id:re.mainWagerId,type:"MAIN",playerId:e,acceptedById:null,amount:0,roundSeq:re.roundSeq}]})}catch{}})()},[a,e]);const{getWagers:c,createSideBet:u,cancelSideBet:d,acceptSideBet:f,placeMainBet:h,cancelMainBet:m}=pa(),[_,w]=v.useState([]),b=v.useRef(new Set),E=v.useRef(new Set),[T,R]=v.useState(0),P=v.useRef(null);v.useEffect(()=>{if(P.current===null){P.current=t;return}o({roundSeq:1,open:[],settled:[],openAll:[],settledAll:[]}),w([]),b.current.clear(),E.current.clear(),R(0),a&&Xf(a)},[t,a]),Pa({onBetsUpdated:re=>{a&&(async()=>{try{const fe=re.open.find(Ie=>Ie.type==="MAIN"&&Ie.playerId===e);fe?await Pb(a,{roundSeq:re.roundSeq,mainWagerId:fe.id}):await Xf(a)}catch{}})(),o(re);const H=re.settled.filter(fe=>fe.roundSeq===re.roundSeq);w(H.filter(fe=>!b.current.has(fe.id)));const Re=(re.open||[]).filter(fe=>fe.type==="SIDE"&&!fe.acceptedById&&fe.playerId!==e&&fe.subjectId!==e).filter(fe=>!E.current.has(fe.id));R(Re.length)}});const[A,C]=v.useState([]);v.useEffect(()=>{C([])},[t]),v.useEffect(()=>{const re=Array.isArray(i.settledAll)?i.settledAll:[];re.length===0&&A.length===0||C(H=>{if(re.length===0)return H;const he=new Map;for(const fe of H)he.set(fe.id,fe);for(const fe of re)he.set(fe.id,fe);return Array.from(he.values()).sort((fe,Ie)=>{const ct=Number(fe.roundSeq||0),$e=Number(Ie.roundSeq||0);return $e!==ct?$e-ct:String(Ie.id).localeCompare(String(fe.id))})})},[i.settledAll]),v.useEffect(()=>{if(!t)return;let re=null;const H=()=>{const Re=Date.now(),fe=wv[t]||0;Re-fe<XM||(wv[t]=Re,re=window.setTimeout(()=>{try{c(t)}catch{}},300))};if(n?.id===t)return H(),()=>{re&&clearTimeout(re)};const he=window.setTimeout(()=>{H()},500);return()=>{re&&clearTimeout(re),clearTimeout(he)}},[t,n?.id,c]),v.useEffect(()=>{if(!r)return;const re={current:0},H=()=>{if(!t||n?.id!==t)return;const he=Date.now();if(!(he-re.current<400)&&!(he-(wv[t]||0)<XM)){re.current=he,wv[t]=he;try{E.current.clear(),R(0),b.current.clear(),setTimeout(()=>{try{c(t)}catch{}},300)}catch{}}};return r.on("reconnect",H),()=>{r.off("reconnect",H)}},[r,t,n?.id,c]),v.useEffect(()=>{w([]),b.current.clear()},[i.roundSeq]);const O=v.useMemo(()=>i.openAll?.filter(re=>re.type==="MAIN"),[i.openAll]),I=v.useMemo(()=>i.open.find(re=>re.type==="MAIN"&&re.playerId===e),[i.open,e]),x=v.useMemo(()=>i.openAll?.filter(re=>re.type==="SIDE"),[i.openAll,e]),D=v.useMemo(()=>i.open.filter(re=>re.type==="SIDE"&&(re.playerId===e||re.acceptedById===e)),[i.open,e]),N=v.useMemo(()=>i.settled.filter(re=>re.playerId===e||re.acceptedById===e),[i.settled,e]);v.useMemo(()=>A.filter(re=>re.playerId===e||re.acceptedById===e),[A,e]);const L=v.useMemo(()=>i.open.filter(re=>re.playerId===e||re.acceptedById===e).reduce((re,H)=>re+(H.amount||0),0),[i.open,e]),[j,q]=v.useState([]);v.useEffect(()=>{const re=setTimeout(()=>{q(A.filter(H=>H.playerId===e||H.acceptedById===e))},sa.mySettledDelayMs);return()=>clearTimeout(re)},[A,e]);const[U,W]=v.useState(null);v.useEffect(()=>{const re=setTimeout(()=>{W(i.playerBalance)},sa.balanceDelayMs);return()=>clearTimeout(re)},[i.playerBalance]);const[F,Y]=v.useState([]);v.useEffect(()=>{const re=setTimeout(()=>{Y(A)},sa.settledAllDelayMs);return()=>clearTimeout(re)},[A]);const Q=v.useMemo(()=>i.open.filter(re=>re.type==="SIDE"&&!re.acceptedById&&re.subjectId!==e&&re.playerId!==e),[i.open,e]),ie=()=>w(re=>{if(re.length===0)return re;const[H,...he]=re;return b.current.add(H.id),he}),G=re=>w(H=>(b.current.add(re),H.filter(he=>he.id!==re))),B=v.useCallback(()=>{for(const re of Q)E.current.add(re.id);R(0)},[Q]),K=v.useCallback(async re=>{try{const H=await u(t,{amount:Math.floor(re.amount),subjectId:re.subjectId,predicate:re.predicate,oddsBp:re.oddsBp});return H?.ok?{ok:!0,betId:H?.wager?.id||H?.id||re.clientBetId}:{ok:!1,error:H?.error||"Failed to place side bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to place side bet"}}},[t,u]),ae=v.useCallback(async re=>{try{const H=await d(t,re);return H?.ok?{ok:!0}:{ok:!1,error:H?.error||"Failed to cancel side bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to cancel side bet"}}},[t,d]),te=v.useCallback(async re=>{try{const H=await f(t,re);return H?.ok?{ok:!0}:{ok:!1,error:H?.error||"Failed to accept side bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to accept side bet"}}},[t,f]),me=v.useCallback(async re=>{try{const H=await h(t,Math.floor(re));return H?.ok?{ok:!0,wagerId:H?.wager?.id||H?.id}:{ok:!1,error:H?.error||"Failed to place main bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to place main bet"}}},[t,h]),ue=v.useCallback(async re=>{try{const H=await m(t,re);return H?.ok?{ok:!0}:{ok:!1,error:H?.error||"Failed to cancel main bet"}}catch(H){return{ok:!1,error:H?.message||"Failed to cancel main bet"}}},[t,m]),[Ae,He]=v.useState([]),ce=v.useRef(i.roundSeq),xe=v.useRef(new Set);return v.useEffect(()=>{ce.current!==i.roundSeq&&(ce.current=i.roundSeq,xe.current.clear(),He([]));const re=i.settledAll.filter(H=>H.roundSeq===i.roundSeq&&!xe.current.has(H.id));if(re.length>0){re.forEach(he=>xe.current.add(he.id)),He(re);const H=setTimeout(()=>He([]),1e3);return()=>clearTimeout(H)}},[i.settledAll,i.roundSeq]),{roundSeq:i.roundSeq,openAll:i.openAll,open:i.open,settled:i.settled,settledAll:F,myOpenMain:I,myOpenSides:D,openAllMain:O,openAllSides:x,mySettledThisRound:N,mySettledAll:j,myExposure:L,unseenSettledWagers:_,consumeNextUnseen:ie,markAsSeen:G,offersToMe:Q,newOfferCount:T,markOffersAsSeen:B,placeSideBet:K,cancelSideBet:ae,acceptSideBet:te,placeMainBet:me,cancelMainBet:ue,playerBalance:U,newSettlements:Ae}}var Sv={exports:{}};/*!
 * accounting.js v0.4.1
 * Copyright 2014 Open Exchange Rates
 *
 * Freely distributable under the MIT license.
 * Portions of accounting.js are inspired or borrowed from underscore.js
 *
 * Full details and documentation:
 * http://openexchangerates.github.io/accounting.js/
 */var JM;function Pfe(){return JM||(JM=1,(function(t,e){(function(r,n){var a={};a.version="0.4.1",a.settings={currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}};var i=Array.prototype.map,o=Array.isArray,c=Object.prototype.toString;function u(P){return!!(P===""||P&&P.charCodeAt&&P.substr)}function d(P){return o?o(P):c.call(P)==="[object Array]"}function f(P){return P&&c.call(P)==="[object Object]"}function h(P,A){var C;P=P||{},A=A||{};for(C in A)A.hasOwnProperty(C)&&P[C]==null&&(P[C]=A[C]);return P}function m(P,A,C){var O=[],I,x;if(!P)return O;if(i&&P.map===i)return P.map(A,C);for(I=0,x=P.length;I<x;I++)O[I]=A.call(C,P[I],I,P);return O}function _(P,A){return P=Math.round(Math.abs(P)),isNaN(P)?A:P}function w(P){var A=a.settings.currency.format;return typeof P=="function"&&(P=P()),u(P)&&P.match("%v")?{pos:P,neg:P.replace("-","").replace("%v","-%v"),zero:P}:!P||!P.pos||!P.pos.match("%v")?u(A)?a.settings.currency.format={pos:A,neg:A.replace("%v","-%v"),zero:A}:A:P}var b=a.unformat=a.parse=function(P,A){if(d(P))return m(P,function(I){return b(I,A)});if(P=P||0,typeof P=="number")return P;A=A||a.settings.number.decimal;var C=new RegExp("[^0-9-"+A+"]",["g"]),O=parseFloat((""+P).replace(/\((.*)\)/,"-$1").replace(C,"").replace(A,"."));return isNaN(O)?0:O},E=a.toFixed=function(P,A){A=_(A,a.settings.number.precision);var C=Math.pow(10,A);return(Math.round(a.unformat(P)*C)/C).toFixed(A)},T=a.formatNumber=a.format=function(P,A,C,O){if(d(P))return m(P,function(j){return T(j,A,C,O)});P=b(P);var I=h(f(A)?A:{precision:A,thousand:C,decimal:O},a.settings.number),x=_(I.precision),D=P<0?"-":"",N=parseInt(E(Math.abs(P||0),x),10)+"",L=N.length>3?N.length%3:0;return D+(L?N.substr(0,L)+I.thousand:"")+N.substr(L).replace(/(\d{3})(?=\d)/g,"$1"+I.thousand)+(x?I.decimal+E(Math.abs(P),x).split(".")[1]:"")},R=a.formatMoney=function(P,A,C,O,I,x){if(d(P))return m(P,function(j){return R(j,A,C,O,I,x)});P=b(P);var D=h(f(A)?A:{symbol:A,precision:C,thousand:O,decimal:I,format:x},a.settings.currency),N=w(D.format),L=P>0?N.pos:P<0?N.neg:N.zero;return L.replace("%s",D.symbol).replace("%v",T(Math.abs(P),_(D.precision),D.thousand,D.decimal))};a.formatColumn=function(P,A,C,O,I,x){if(!P)return[];var D=h(f(A)?A:{symbol:A,precision:C,thousand:O,decimal:I,format:x},a.settings.currency),N=w(D.format),L=N.pos.indexOf("%s")<N.pos.indexOf("%v"),j=0,q=m(P,function(U,W){if(d(U))return a.formatColumn(U,D);U=b(U);var F=U>0?N.pos:U<0?N.neg:N.zero,Y=F.replace("%s",D.symbol).replace("%v",T(Math.abs(U),_(D.precision),D.thousand,D.decimal));return Y.length>j&&(j=Y.length),Y});return m(q,function(U,W){return u(U)&&U.length<j?L?U.replace(D.symbol,D.symbol+new Array(j-U.length+1).join(" ")):new Array(j-U.length+1).join(" ")+U:U})},t.exports&&(e=t.exports=a),e.accounting=a})()})(Sv,Sv.exports)),Sv.exports}var Afe=Pfe();const td=wg(Afe);function QM(t){return t==="WIN"?"LOSE":t==="LOSE"?"WIN":t}function hb(t){const e=Math.round(Number(t)||0);try{return`z${new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(e)}`}catch{return`z${e}`}}function hd(t,e){if(!t)return{myResult:"",myPayout:0,label:""};const r=t.playerId,n=e===r,a=t.acceptedById,i=a!=null&&e===a;if(t.type==="MAIN"){if(!(n||i))return{myResult:"N/A",myPayout:0,label:"Not your bet"};if(t.result==="PUSH")return{myResult:"PUSH",myPayout:0,label:"Push"};if(n){const o=ZM(t);return{myResult:t.result,myPayout:t.result==="WIN"?o:0,label:Vu(t.result,t.result==="WIN"?o:0,t.amount)}}else{const o=QM(t.result),c=Rfe(t);return{myResult:o,myPayout:o==="WIN"?c:0,label:Vu(o,o==="WIN"?c:0,t.amount)}}}if(t.type==="SIDE"){const o=e===t.acceptedById;if(!(n||o))return{myResult:"N/A",myPayout:0,label:"Not your bet"};if(t.result==="PUSH")return{myResult:"PUSH",myPayout:0,label:"Push"};if(n){const c=ZM(t),u=t.result==="WIN"?c:0,d={myResult:t.result,myPayout:u,label:Vu(t.result,u,t.amount)};if(d.myResult==="WIN"&&d.myPayout<=0){const f=typeof t.payout=="number"&&t.payout>0?t.payout:t.amount;return{myResult:d.myResult,myPayout:f,label:Vu(d.myResult,f,t.amount)}}return d}else{const c=QM(t.result),u=Dfe(t),d=c==="WIN"?u:0,f={myResult:c,myPayout:d,label:Vu(c,d,t.amount)};if(f.myResult==="WIN"&&f.myPayout<=0){const h=typeof t.payout=="number"&&t.payout>0?t.payout:t.amount;return{myResult:f.myResult,myPayout:h,label:Vu(f.myResult,h,t.amount)}}return f}}return{myResult:"PUSH",myPayout:0,label:"Push"}}function ZM(t){return typeof t.payout=="number"?t.payout:t.amount}function Rfe(t){return t.amount}function Dfe(t){return typeof t.oddsBp=="number"&&t.oddsBp!==1e4&&typeof t.payout=="number"?t.payout:t.amount}function Vu(t,e,r){return t==="WIN"?`won ${hb(Math.max(0,e))}`:t==="LOSE"?`lost ${hb(Math.max(0,r))}`:t==="PUSH"?"Push":t}function Ofe(t){return!t||t.length===0?0:t.reduce((e,r)=>e+Number(r?.amount||0),0)}function f4({meId:t,items:e,onClose:r,nameOf:n,crapsRollHistory:a,gameMode:i,crapsLedgerItems:o}){const c=e,u=i==="craps",d={};for(const h of c){const m=h?.acceptedById===t?h?.playerId:h?.acceptedById;if(!m)continue;const _=hd(h,t);let w=0;_.myResult==="WIN"?w=Number(_.myPayout??0):_.myResult==="LOSE"&&(w=-Number(h?.amount??0)),d[m]=(d[m]??0)+w}const f=Object.entries(d).map(([h,m])=>({id:h,name:n?.(h)||h,delta:m})).sort((h,m)=>m.delta-h.delta);return g.jsxs("div",{className:"results-modal",children:[g.jsx("div",{className:"results-modal__backdrop",onClick:r}),g.jsxs("div",{className:"results-modal__card card",children:[g.jsxs("div",{className:"results-modal__header",children:[g.jsx("h3",{children:"Your Results (this game)"}),g.jsx("button",{className:"btn btn--ghost",onClick:r,children:"Close"})]}),!u&&f.length>0&&g.jsx("div",{className:"results-modal__deltas",children:g.jsx("ul",{className:"results-modal__deltas-list",children:f.map(({id:h,name:m,delta:_})=>g.jsxs("li",{className:`results-modal__delta ${_>=0?"results-modal__delta--pos":"results-modal__delta--neg"}`,children:[m,": ",_>=0?"+":"","z",td.formatMoney(_,"",0)]},h))})}),u&&g.jsxs(g.Fragment,{children:[(()=>{const h=Ofe(o),m=h>=0,_=Math.abs(h);return o?g.jsx("div",{className:"results-modal__deltas",children:g.jsxs("div",{className:`results-modal__delta ${m?"results-modal__delta--pos":"results-modal__delta--neg"}`,children:[g.jsx("strong",{children:"Total won/lost:"})," ",m?"+":"-","z",td.formatMoney(_,"",0)]})}):null})(),g.jsxs("ul",{className:"betlist results-list",role:"log","aria-live":"polite",children:[(o?.length??0)===0&&g.jsx("li",{className:"betitem",children:"No history yet."}),(o||[]).map((h,m)=>{const _=Number(h.amount||0),w=_>=0,b=Math.abs(_),T=new Date(h.ts).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});let R="";if(h.kind==="BET_PLACED")R=`Placed ${h.meta?.betType?String(h.meta.betType):"bet"}`;else if(h.kind==="REFUND")R=`Refund ${h.meta?.betType?String(h.meta.betType):"chips"}`;else if(h.kind==="BET_SETTLED"){const P=Array.isArray(h.meta?.settlements)?h.meta.settlements:[],A=P[0]||null,C=A?.betType?String(A.betType):h.meta?.betType?String(h.meta.betType):"bet",O=_>0?"WIN":_<0?"LOSE":"PUSH",I=h.meta?.roll?.total?` on ${h.meta.roll.total}`:"",x=P.length>1?` (+${P.length-1} more)`:"";R=`Settled: ${C} ${O}${I}${x}`}return g.jsx("li",{className:"betitem results-modal__bet-row",children:g.jsxs("span",{children:[T," — ",R," ",w?"+":"-","z",td.formatMoney(b,"",0)]})},h.id||m)})]})]}),!u&&g.jsxs("ul",{className:"betlist results-list",role:"log","aria-live":"polite",children:[c.length===0&&g.jsx("li",{className:"betitem",children:"No results yet."}),c.map((h,m)=>{const _=h?.acceptedById===t?h?.playerId:h?.acceptedById,w=(()=>{const T=h;return T?.acceptedById===t?T?.playerName||T?.player?.name||T?.playerEmail||T?.player?.email:T?.bankerName||T?.banker?.name||T?.bankerEmail||T?.banker?.email})(),b=n?.(_)||w||_||"Unknown",E=Vu(...(()=>{const T=hd(h,t);return[T.myResult,T.myPayout,h.amount]})());return g.jsx("li",{className:"betitem results-modal__bet-row",children:g.jsxs("span",{children:["Round ",h.roundSeq," ",E," vs ",b]})},m)})]})]})]})}const p4=v.createContext({});function Nfe(t){const e=v.useRef(null);return e.current===null&&(e.current=t()),e.current}const rA=typeof window<"u",Ife=rA?v.useLayoutEffect:v.useEffect,nA=v.createContext(null);function aA(t,e){t.indexOf(e)===-1&&t.push(e)}function iA(t,e){const r=t.indexOf(e);r>-1&&t.splice(r,1)}const Vc=(t,e,r)=>r>e?e:r<t?t:r;let sA=()=>{};const Hc={},h4=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function m4(t){return typeof t=="object"&&t!==null}const g4=t=>/^0[^.\s]+$/u.test(t);function oA(t){let e;return()=>(e===void 0&&(e=t()),e)}const hs=t=>t,Mfe=(t,e)=>r=>e(t(r)),qg=(...t)=>t.reduce(Mfe),Km=(t,e,r)=>{const n=e-t;return n===0?1:(r-t)/n};class cA{constructor(){this.subscriptions=[]}add(e){return aA(this.subscriptions,e),()=>iA(this.subscriptions,e)}notify(e,r,n){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](e,r,n);else for(let i=0;i<a;i++){const o=this.subscriptions[i];o&&o(e,r,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const qo=t=>t*1e3,fs=t=>t/1e3;function y4(t,e){return e?t*(1e3/e):0}const v4=(t,e,r)=>(((1-3*r+3*e)*t+(3*r-6*e))*t+3*e)*t,jfe=1e-7,Lfe=12;function Bfe(t,e,r,n,a){let i,o,c=0;do o=e+(r-e)/2,i=v4(o,n,a)-t,i>0?r=o:e=o;while(Math.abs(i)>jfe&&++c<Lfe);return o}function zg(t,e,r,n){if(t===e&&r===n)return hs;const a=i=>Bfe(i,0,1,t,r);return i=>i===0||i===1?i:v4(a(i),e,n)}const _4=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,b4=t=>e=>1-t(1-e),k4=zg(.33,1.53,.69,.99),lA=b4(k4),w4=_4(lA),S4=t=>(t*=2)<1?.5*lA(t):.5*(2-Math.pow(2,-10*(t-1))),uA=t=>1-Math.sin(Math.acos(t)),E4=b4(uA),T4=_4(uA),Ufe=zg(.42,0,1,1),Ffe=zg(0,0,.58,1),C4=zg(.42,0,.58,1),qfe=t=>Array.isArray(t)&&typeof t[0]!="number",x4=t=>Array.isArray(t)&&typeof t[0]=="number",zfe={linear:hs,easeIn:Ufe,easeInOut:C4,easeOut:Ffe,circIn:uA,circInOut:T4,circOut:E4,backIn:lA,backInOut:w4,backOut:k4,anticipate:S4},$fe=t=>typeof t=="string",ej=t=>{if(x4(t)){sA(t.length===4);const[e,r,n,a]=t;return zg(e,r,n,a)}else if($fe(t))return zfe[t];return t},Ev=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Vfe(t,e){let r=new Set,n=new Set,a=!1,i=!1;const o=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function u(f){o.has(f)&&(d.schedule(f),t()),f(c)}const d={schedule:(f,h=!1,m=!1)=>{const w=m&&a?r:n;return h&&o.add(f),w.has(f)||w.add(f),f},cancel:f=>{n.delete(f),o.delete(f)},process:f=>{if(c=f,a){i=!0;return}a=!0,[r,n]=[n,r],r.forEach(u),r.clear(),a=!1,i&&(i=!1,d.process(f))}};return d}const Hfe=40;function P4(t,e){let r=!1,n=!0;const a={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,o=Ev.reduce((P,A)=>(P[A]=Vfe(i),P),{}),{setup:c,read:u,resolveKeyframes:d,preUpdate:f,update:h,preRender:m,render:_,postRender:w}=o,b=()=>{const P=Hc.useManualTiming?a.timestamp:performance.now();r=!1,Hc.useManualTiming||(a.delta=n?1e3/60:Math.max(Math.min(P-a.timestamp,Hfe),1)),a.timestamp=P,a.isProcessing=!0,c.process(a),u.process(a),d.process(a),f.process(a),h.process(a),m.process(a),_.process(a),w.process(a),a.isProcessing=!1,r&&e&&(n=!1,t(b))},E=()=>{r=!0,n=!0,a.isProcessing||t(b)};return{schedule:Ev.reduce((P,A)=>{const C=o[A];return P[A]=(O,I=!1,x=!1)=>(r||E(),C.schedule(O,I,x)),P},{}),cancel:P=>{for(let A=0;A<Ev.length;A++)o[Ev[A]].cancel(P)},state:a,steps:o}}const{schedule:wn,cancel:au,state:wa,steps:_E}=P4(typeof requestAnimationFrame<"u"?requestAnimationFrame:hs,!0);let g_;function Gfe(){g_=void 0}const di={now:()=>(g_===void 0&&di.set(wa.isProcessing||Hc.useManualTiming?wa.timestamp:performance.now()),g_),set:t=>{g_=t,queueMicrotask(Gfe)}},A4=t=>e=>typeof e=="string"&&e.startsWith(t),dA=A4("--"),Wfe=A4("var(--"),fA=t=>Wfe(t)?Kfe.test(t.split("/*")[0].trim()):!1,Kfe=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Dp={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ym={...Dp,transform:t=>Vc(0,1,t)},Tv={...Dp,default:1},ym=t=>Math.round(t*1e5)/1e5,pA=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Yfe(t){return t==null}const Xfe=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,hA=(t,e)=>r=>!!(typeof r=="string"&&Xfe.test(r)&&r.startsWith(t)||e&&!Yfe(r)&&Object.prototype.hasOwnProperty.call(r,e)),R4=(t,e,r)=>n=>{if(typeof n!="string")return n;const[a,i,o,c]=n.match(pA);return{[t]:parseFloat(a),[e]:parseFloat(i),[r]:parseFloat(o),alpha:c!==void 0?parseFloat(c):1}},Jfe=t=>Vc(0,255,t),bE={...Dp,transform:t=>Math.round(Jfe(t))},Ku={test:hA("rgb","red"),parse:R4("red","green","blue"),transform:({red:t,green:e,blue:r,alpha:n=1})=>"rgba("+bE.transform(t)+", "+bE.transform(e)+", "+bE.transform(r)+", "+ym(Ym.transform(n))+")"};function Qfe(t){let e="",r="",n="",a="";return t.length>5?(e=t.substring(1,3),r=t.substring(3,5),n=t.substring(5,7),a=t.substring(7,9)):(e=t.substring(1,2),r=t.substring(2,3),n=t.substring(3,4),a=t.substring(4,5),e+=e,r+=r,n+=n,a+=a),{red:parseInt(e,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:a?parseInt(a,16)/255:1}}const PC={test:hA("#"),parse:Qfe,transform:Ku.transform},$g=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Cl=$g("deg"),zo=$g("%"),Jt=$g("px"),Zfe=$g("vh"),epe=$g("vw"),tj={...zo,parse:t=>zo.parse(t)/100,transform:t=>zo.transform(t*100)},xf={test:hA("hsl","hue"),parse:R4("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:r,alpha:n=1})=>"hsla("+Math.round(t)+", "+zo.transform(ym(e))+", "+zo.transform(ym(r))+", "+ym(Ym.transform(n))+")"},Kn={test:t=>Ku.test(t)||PC.test(t)||xf.test(t),parse:t=>Ku.test(t)?Ku.parse(t):xf.test(t)?xf.parse(t):PC.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Ku.transform(t):xf.transform(t),getAnimatableNone:t=>{const e=Kn.parse(t);return e.alpha=0,Kn.transform(e)}},tpe=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function rpe(t){return isNaN(t)&&typeof t=="string"&&(t.match(pA)?.length||0)+(t.match(tpe)?.length||0)>0}const D4="number",O4="color",npe="var",ape="var(",rj="${}",ipe=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Xm(t){const e=t.toString(),r=[],n={color:[],number:[],var:[]},a=[];let i=0;const c=e.replace(ipe,u=>(Kn.test(u)?(n.color.push(i),a.push(O4),r.push(Kn.parse(u))):u.startsWith(ape)?(n.var.push(i),a.push(npe),r.push(u)):(n.number.push(i),a.push(D4),r.push(parseFloat(u))),++i,rj)).split(rj);return{values:r,split:c,indexes:n,types:a}}function N4(t){return Xm(t).values}function I4(t){const{split:e,types:r}=Xm(t),n=e.length;return a=>{let i="";for(let o=0;o<n;o++)if(i+=e[o],a[o]!==void 0){const c=r[o];c===D4?i+=ym(a[o]):c===O4?i+=Kn.transform(a[o]):i+=a[o]}return i}}const spe=t=>typeof t=="number"?0:Kn.test(t)?Kn.getAnimatableNone(t):t;function ope(t){const e=N4(t);return I4(t)(e.map(spe))}const iu={test:rpe,parse:N4,createTransformer:I4,getAnimatableNone:ope};function kE(t,e,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(e-t)*6*r:r<1/2?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function cpe({hue:t,saturation:e,lightness:r,alpha:n}){t/=360,e/=100,r/=100;let a=0,i=0,o=0;if(!e)a=i=o=r;else{const c=r<.5?r*(1+e):r+e-r*e,u=2*r-c;a=kE(u,c,t+1/3),i=kE(u,c,t),o=kE(u,c,t-1/3)}return{red:Math.round(a*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:n}}function mb(t,e){return r=>r>0?e:t}const En=(t,e,r)=>t+(e-t)*r,wE=(t,e,r)=>{const n=t*t,a=r*(e*e-n)+n;return a<0?0:Math.sqrt(a)},lpe=[PC,Ku,xf],upe=t=>lpe.find(e=>e.test(t));function nj(t){const e=upe(t);if(!e)return!1;let r=e.parse(t);return e===xf&&(r=cpe(r)),r}const aj=(t,e)=>{const r=nj(t),n=nj(e);if(!r||!n)return mb(t,e);const a={...r};return i=>(a.red=wE(r.red,n.red,i),a.green=wE(r.green,n.green,i),a.blue=wE(r.blue,n.blue,i),a.alpha=En(r.alpha,n.alpha,i),Ku.transform(a))},AC=new Set(["none","hidden"]);function dpe(t,e){return AC.has(t)?r=>r<=0?t:e:r=>r>=1?e:t}function fpe(t,e){return r=>En(t,e,r)}function mA(t){return typeof t=="number"?fpe:typeof t=="string"?fA(t)?mb:Kn.test(t)?aj:mpe:Array.isArray(t)?M4:typeof t=="object"?Kn.test(t)?aj:ppe:mb}function M4(t,e){const r=[...t],n=r.length,a=t.map((i,o)=>mA(i)(i,e[o]));return i=>{for(let o=0;o<n;o++)r[o]=a[o](i);return r}}function ppe(t,e){const r={...t,...e},n={};for(const a in r)t[a]!==void 0&&e[a]!==void 0&&(n[a]=mA(t[a])(t[a],e[a]));return a=>{for(const i in n)r[i]=n[i](a);return r}}function hpe(t,e){const r=[],n={color:0,var:0,number:0};for(let a=0;a<e.values.length;a++){const i=e.types[a],o=t.indexes[i][n[i]],c=t.values[o]??0;r[a]=c,n[i]++}return r}const mpe=(t,e)=>{const r=iu.createTransformer(e),n=Xm(t),a=Xm(e);return n.indexes.var.length===a.indexes.var.length&&n.indexes.color.length===a.indexes.color.length&&n.indexes.number.length>=a.indexes.number.length?AC.has(t)&&!a.values.length||AC.has(e)&&!n.values.length?dpe(t,e):qg(M4(hpe(n,a),a.values),r):mb(t,e)};function j4(t,e,r){return typeof t=="number"&&typeof e=="number"&&typeof r=="number"?En(t,e,r):mA(t)(t,e)}const gpe=t=>{const e=({timestamp:r})=>t(r);return{start:(r=!0)=>wn.update(e,r),stop:()=>au(e),now:()=>wa.isProcessing?wa.timestamp:di.now()}},L4=(t,e,r=10)=>{let n="";const a=Math.max(Math.round(e/r),2);for(let i=0;i<a;i++)n+=Math.round(t(i/(a-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},gb=2e4;function gA(t){let e=0;const r=50;let n=t.next(e);for(;!n.done&&e<gb;)e+=r,n=t.next(e);return e>=gb?1/0:e}function ype(t,e=100,r){const n=r({...t,keyframes:[0,e]}),a=Math.min(gA(n),gb);return{type:"keyframes",ease:i=>n.next(a*i).value/e,duration:fs(a)}}const vpe=5;function B4(t,e,r){const n=Math.max(e-vpe,0);return y4(r-t(n),e-n)}const An={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},SE=.001;function _pe({duration:t=An.duration,bounce:e=An.bounce,velocity:r=An.velocity,mass:n=An.mass}){let a,i,o=1-e;o=Vc(An.minDamping,An.maxDamping,o),t=Vc(An.minDuration,An.maxDuration,fs(t)),o<1?(a=d=>{const f=d*o,h=f*t,m=f-r,_=RC(d,o),w=Math.exp(-h);return SE-m/_*w},i=d=>{const h=d*o*t,m=h*r+r,_=Math.pow(o,2)*Math.pow(d,2)*t,w=Math.exp(-h),b=RC(Math.pow(d,2),o);return(-a(d)+SE>0?-1:1)*((m-_)*w)/b}):(a=d=>{const f=Math.exp(-d*t),h=(d-r)*t+1;return-SE+f*h},i=d=>{const f=Math.exp(-d*t),h=(r-d)*(t*t);return f*h});const c=5/t,u=kpe(a,i,c);if(t=qo(t),isNaN(u))return{stiffness:An.stiffness,damping:An.damping,duration:t};{const d=Math.pow(u,2)*n;return{stiffness:d,damping:o*2*Math.sqrt(n*d),duration:t}}}const bpe=12;function kpe(t,e,r){let n=r;for(let a=1;a<bpe;a++)n=n-t(n)/e(n);return n}function RC(t,e){return t*Math.sqrt(1-e*e)}const wpe=["duration","bounce"],Spe=["stiffness","damping","mass"];function ij(t,e){return e.some(r=>t[r]!==void 0)}function Epe(t){let e={velocity:An.velocity,stiffness:An.stiffness,damping:An.damping,mass:An.mass,isResolvedFromDuration:!1,...t};if(!ij(t,Spe)&&ij(t,wpe))if(t.visualDuration){const r=t.visualDuration,n=2*Math.PI/(r*1.2),a=n*n,i=2*Vc(.05,1,1-(t.bounce||0))*Math.sqrt(a);e={...e,mass:An.mass,stiffness:a,damping:i}}else{const r=_pe(t);e={...e,...r,mass:An.mass},e.isResolvedFromDuration=!0}return e}function yb(t=An.visualDuration,e=An.bounce){const r=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:n,restDelta:a}=r;const i=r.keyframes[0],o=r.keyframes[r.keyframes.length-1],c={done:!1,value:i},{stiffness:u,damping:d,mass:f,duration:h,velocity:m,isResolvedFromDuration:_}=Epe({...r,velocity:-fs(r.velocity||0)}),w=m||0,b=d/(2*Math.sqrt(u*f)),E=o-i,T=fs(Math.sqrt(u/f)),R=Math.abs(E)<5;n||(n=R?An.restSpeed.granular:An.restSpeed.default),a||(a=R?An.restDelta.granular:An.restDelta.default);let P;if(b<1){const C=RC(T,b);P=O=>{const I=Math.exp(-b*T*O);return o-I*((w+b*T*E)/C*Math.sin(C*O)+E*Math.cos(C*O))}}else if(b===1)P=C=>o-Math.exp(-T*C)*(E+(w+T*E)*C);else{const C=T*Math.sqrt(b*b-1);P=O=>{const I=Math.exp(-b*T*O),x=Math.min(C*O,300);return o-I*((w+b*T*E)*Math.sinh(x)+C*E*Math.cosh(x))/C}}const A={calculatedDuration:_&&h||null,next:C=>{const O=P(C);if(_)c.done=C>=h;else{let I=C===0?w:0;b<1&&(I=C===0?qo(w):B4(P,C,O));const x=Math.abs(I)<=n,D=Math.abs(o-O)<=a;c.done=x&&D}return c.value=c.done?o:O,c},toString:()=>{const C=Math.min(gA(A),gb),O=L4(I=>A.next(C*I).value,C,30);return C+"ms "+O},toTransition:()=>{}};return A}yb.applyToOptions=t=>{const e=ype(t,100,yb);return t.ease=e.ease,t.duration=qo(e.duration),t.type="keyframes",t};function DC({keyframes:t,velocity:e=0,power:r=.8,timeConstant:n=325,bounceDamping:a=10,bounceStiffness:i=500,modifyTarget:o,min:c,max:u,restDelta:d=.5,restSpeed:f}){const h=t[0],m={done:!1,value:h},_=x=>c!==void 0&&x<c||u!==void 0&&x>u,w=x=>c===void 0?u:u===void 0||Math.abs(c-x)<Math.abs(u-x)?c:u;let b=r*e;const E=h+b,T=o===void 0?E:o(E);T!==E&&(b=T-h);const R=x=>-b*Math.exp(-x/n),P=x=>T+R(x),A=x=>{const D=R(x),N=P(x);m.done=Math.abs(D)<=d,m.value=m.done?T:N};let C,O;const I=x=>{_(m.value)&&(C=x,O=yb({keyframes:[m.value,w(m.value)],velocity:B4(P,x,m.value),damping:a,stiffness:i,restDelta:d,restSpeed:f}))};return I(0),{calculatedDuration:null,next:x=>{let D=!1;return!O&&C===void 0&&(D=!0,A(x),I(x)),C!==void 0&&x>=C?O.next(x-C):(!D&&A(x),m)}}}function Tpe(t,e,r){const n=[],a=r||Hc.mix||j4,i=t.length-1;for(let o=0;o<i;o++){let c=a(t[o],t[o+1]);if(e){const u=Array.isArray(e)?e[o]||hs:e;c=qg(u,c)}n.push(c)}return n}function Cpe(t,e,{clamp:r=!0,ease:n,mixer:a}={}){const i=t.length;if(sA(i===e.length),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const c=Tpe(e,n,a),u=c.length,d=f=>{if(o&&f<t[0])return e[0];let h=0;if(u>1)for(;h<t.length-2&&!(f<t[h+1]);h++);const m=Km(t[h],t[h+1],f);return c[h](m)};return r?f=>d(Vc(t[0],t[i-1],f)):d}function xpe(t,e){const r=t[t.length-1];for(let n=1;n<=e;n++){const a=Km(0,e,n);t.push(En(r,1,a))}}function Ppe(t){const e=[0];return xpe(e,t.length-1),e}function Ape(t,e){return t.map(r=>r*e)}function Rpe(t,e){return t.map(()=>e||C4).splice(0,t.length-1)}function vm({duration:t=300,keyframes:e,times:r,ease:n="easeInOut"}){const a=qfe(n)?n.map(ej):ej(n),i={done:!1,value:e[0]},o=Ape(r&&r.length===e.length?r:Ppe(e),t),c=Cpe(o,e,{ease:Array.isArray(a)?a:Rpe(e,a)});return{calculatedDuration:t,next:u=>(i.value=c(u),i.done=u>=t,i)}}const Dpe=t=>t!==null;function yA(t,{repeat:e,repeatType:r="loop"},n,a=1){const i=t.filter(Dpe),c=a<0||e&&r!=="loop"&&e%2===1?0:i.length-1;return!c||n===void 0?i[c]:n}const Ope={decay:DC,inertia:DC,tween:vm,keyframes:vm,spring:yb};function U4(t){typeof t.type=="string"&&(t.type=Ope[t.type])}class vA{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,r){return this.finished.then(e,r)}}const Npe=t=>t/100;class _A extends vA{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:r}=this.options;r&&r.updatedAt!==di.now()&&this.tick(di.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;U4(e);const{type:r=vm,repeat:n=0,repeatDelay:a=0,repeatType:i,velocity:o=0}=e;let{keyframes:c}=e;const u=r||vm;u!==vm&&typeof c[0]!="number"&&(this.mixKeyframes=qg(Npe,j4(c[0],c[1])),c=[0,100]);const d=u({...e,keyframes:c});i==="mirror"&&(this.mirroredGenerator=u({...e,keyframes:[...c].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=gA(d));const{calculatedDuration:f}=d;this.calculatedDuration=f,this.resolvedDuration=f+a,this.totalDuration=this.resolvedDuration*(n+1)-a,this.generator=d}updateTime(e){const r=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(e,r=!1){const{generator:n,totalDuration:a,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:c,calculatedDuration:u}=this;if(this.startTime===null)return n.next(0);const{delay:d=0,keyframes:f,repeat:h,repeatType:m,repeatDelay:_,type:w,onUpdate:b,finalKeyframe:E}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-a/this.speed,this.startTime)),r?this.currentTime=e:this.updateTime(e);const T=this.currentTime-d*(this.playbackSpeed>=0?1:-1),R=this.playbackSpeed>=0?T<0:T>a;this.currentTime=Math.max(T,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let P=this.currentTime,A=n;if(h){const x=Math.min(this.currentTime,a)/c;let D=Math.floor(x),N=x%1;!N&&x>=1&&(N=1),N===1&&D--,D=Math.min(D,h+1),!!(D%2)&&(m==="reverse"?(N=1-N,_&&(N-=_/c)):m==="mirror"&&(A=o)),P=Vc(0,1,N)*c}const C=R?{done:!1,value:f[0]}:A.next(P);i&&(C.value=i(C.value));let{done:O}=C;!R&&u!==null&&(O=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const I=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&O);return I&&w!==DC&&(C.value=yA(f,this.options,E,this.speed)),b&&b(C.value),I&&this.finish(),C}then(e,r){return this.finished.then(e,r)}get duration(){return fs(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+fs(e)}get time(){return fs(this.currentTime)}set time(e){e=qo(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(di.now());const r=this.playbackSpeed!==e;this.playbackSpeed=e,r&&(this.time=fs(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=gpe,startTime:r}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),this.options.onPlay?.();const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=r??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(di.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function Ipe(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Yu=t=>t*180/Math.PI,OC=t=>{const e=Yu(Math.atan2(t[1],t[0]));return NC(e)},Mpe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:OC,rotateZ:OC,skewX:t=>Yu(Math.atan(t[1])),skewY:t=>Yu(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},NC=t=>(t=t%360,t<0&&(t+=360),t),sj=OC,oj=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),cj=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),jpe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:oj,scaleY:cj,scale:t=>(oj(t)+cj(t))/2,rotateX:t=>NC(Yu(Math.atan2(t[6],t[5]))),rotateY:t=>NC(Yu(Math.atan2(-t[2],t[0]))),rotateZ:sj,rotate:sj,skewX:t=>Yu(Math.atan(t[4])),skewY:t=>Yu(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function IC(t){return t.includes("scale")?1:0}function MC(t,e){if(!t||t==="none")return IC(e);const r=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,a;if(r)n=jpe,a=r;else{const c=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=Mpe,a=c}if(!a)return IC(e);const i=n[e],o=a[1].split(",").map(Bpe);return typeof i=="function"?i(o):o[i]}const Lpe=(t,e)=>{const{transform:r="none"}=getComputedStyle(t);return MC(r,e)};function Bpe(t){return parseFloat(t.trim())}const Op=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Np=new Set(Op),lj=t=>t===Dp||t===Jt,Upe=new Set(["x","y","z"]),Fpe=Op.filter(t=>!Upe.has(t));function qpe(t){const e=[];return Fpe.forEach(r=>{const n=t.getValue(r);n!==void 0&&(e.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),e}const rd={width:({x:t},{paddingLeft:e="0",paddingRight:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),height:({y:t},{paddingTop:e="0",paddingBottom:r="0"})=>t.max-t.min-parseFloat(e)-parseFloat(r),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>MC(e,"x"),y:(t,{transform:e})=>MC(e,"y")};rd.translateX=rd.x;rd.translateY=rd.y;const nd=new Set;let jC=!1,LC=!1,BC=!1;function F4(){if(LC){const t=Array.from(nd).filter(n=>n.needsMeasurement),e=new Set(t.map(n=>n.element)),r=new Map;e.forEach(n=>{const a=qpe(n);a.length&&(r.set(n,a),n.render())}),t.forEach(n=>n.measureInitialState()),e.forEach(n=>{n.render();const a=r.get(n);a&&a.forEach(([i,o])=>{n.getValue(i)?.set(o)})}),t.forEach(n=>n.measureEndState()),t.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}LC=!1,jC=!1,nd.forEach(t=>t.complete(BC)),nd.clear()}function q4(){nd.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(LC=!0)})}function zpe(){BC=!0,q4(),F4(),BC=!1}class bA{constructor(e,r,n,a,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=r,this.name=n,this.motionValue=a,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(nd.add(this),jC||(jC=!0,wn.read(q4),wn.resolveKeyframes(F4))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:r,element:n,motionValue:a}=this;if(e[0]===null){const i=a?.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&r){const c=n.readValue(r,o);c!=null&&(e[0]=c)}e[0]===void 0&&(e[0]=o),a&&i===void 0&&a.set(e[0])}Ipe(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),nd.delete(this)}cancel(){this.state==="scheduled"&&(nd.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const $pe=t=>t.startsWith("--");function Vpe(t,e,r){$pe(e)?t.style.setProperty(e,r):t.style[e]=r}const Hpe=oA(()=>window.ScrollTimeline!==void 0),Gpe={};function Wpe(t,e){const r=oA(t);return()=>Gpe[e]??r()}const z4=Wpe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Qh=([t,e,r,n])=>`cubic-bezier(${t}, ${e}, ${r}, ${n})`,uj={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Qh([0,.65,.55,1]),circOut:Qh([.55,0,1,.45]),backIn:Qh([.31,.01,.66,-.59]),backOut:Qh([.33,1.53,.69,.99])};function $4(t,e){if(t)return typeof t=="function"?z4()?L4(t,e):"ease-out":x4(t)?Qh(t):Array.isArray(t)?t.map(r=>$4(r,e)||uj.easeOut):uj[t]}function Kpe(t,e,r,{delay:n=0,duration:a=300,repeat:i=0,repeatType:o="loop",ease:c="easeOut",times:u}={},d=void 0){const f={[e]:r};u&&(f.offset=u);const h=$4(c,a);Array.isArray(h)&&(f.easing=h);const m={delay:n,duration:a,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return d&&(m.pseudoElement=d),t.animate(f,m)}function V4(t){return typeof t=="function"&&"applyToOptions"in t}function Ype({type:t,...e}){return V4(t)&&z4()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Xpe extends vA{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:r,name:n,keyframes:a,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:c,onComplete:u}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,sA(typeof e.type!="string");const d=Ype(e);this.animation=Kpe(r,n,a,d,i),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const f=yA(a,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(f):Vpe(r,n,f),this.animation.cancel()}u?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return fs(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+fs(e)}get time(){return fs(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=qo(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&Hpe()?(this.animation.timeline=e,hs):r(this)}}const H4={anticipate:S4,backInOut:w4,circInOut:T4};function Jpe(t){return t in H4}function Qpe(t){typeof t.ease=="string"&&Jpe(t.ease)&&(t.ease=H4[t.ease])}const dj=10;class Zpe extends Xpe{constructor(e){Qpe(e),U4(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:r,onUpdate:n,onComplete:a,element:i,...o}=this.options;if(!r)return;if(e!==void 0){r.set(e);return}const c=new _A({...o,autoplay:!1}),u=qo(this.finishedTime??this.time);r.setWithVelocity(c.sample(u-dj).value,c.sample(u).value,dj),c.stop()}}const fj=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(iu.test(t)||t==="0")&&!t.startsWith("url("));function ehe(t){const e=t[0];if(t.length===1)return!0;for(let r=0;r<t.length;r++)if(t[r]!==e)return!0}function the(t,e,r,n){const a=t[0];if(a===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=fj(a,e),c=fj(i,e);return!o||!c?!1:ehe(t)||(r==="spring"||V4(r))&&n}function UC(t){t.duration=0,t.type="keyframes"}const rhe=new Set(["opacity","clipPath","filter","transform"]),nhe=oA(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function ahe(t){const{motionValue:e,name:r,repeatDelay:n,repeatType:a,damping:i,type:o}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:d}=e.owner.getProps();return nhe()&&r&&rhe.has(r)&&(r!=="transform"||!d)&&!u&&!n&&a!=="mirror"&&i!==0&&o!=="inertia"}const ihe=40;class she extends vA{constructor({autoplay:e=!0,delay:r=0,type:n="keyframes",repeat:a=0,repeatDelay:i=0,repeatType:o="loop",keyframes:c,name:u,motionValue:d,element:f,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=di.now();const m={autoplay:e,delay:r,type:n,repeat:a,repeatDelay:i,repeatType:o,name:u,motionValue:d,element:f,...h},_=f?.KeyframeResolver||bA;this.keyframeResolver=new _(c,(w,b,E)=>this.onKeyframesResolved(w,b,m,!E),u,d,f),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,r,n,a){this.keyframeResolver=void 0;const{name:i,type:o,velocity:c,delay:u,isHandoff:d,onUpdate:f}=n;this.resolvedAt=di.now(),the(e,i,o,c)||((Hc.instantAnimations||!u)&&f?.(yA(e,n,r)),e[0]=e[e.length-1],UC(n),n.repeat=0);const m={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>ihe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...n,keyframes:e},_=!d&&ahe(m)?new Zpe({...m,element:m.motionValue.owner.current}):new _A(m);_.finished.then(()=>this.notifyFinished()).catch(hs),this.pendingTimeline&&(this.stopTimeline=_.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=_}get finished(){return this._animation?this.animation.finished:this._finished}then(e,r){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),zpe()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const ohe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function che(t){const e=ohe.exec(t);if(!e)return[,];const[,r,n,a]=e;return[`--${r??n}`,a]}function G4(t,e,r=1){const[n,a]=che(t);if(!n)return;const i=window.getComputedStyle(e).getPropertyValue(n);if(i){const o=i.trim();return h4(o)?parseFloat(o):o}return fA(a)?G4(a,e,r+1):a}function kA(t,e){return t?.[e]??t?.default??t}const W4=new Set(["width","height","top","left","right","bottom",...Op]),lhe={test:t=>t==="auto",parse:t=>t},K4=t=>e=>e.test(t),Y4=[Dp,Jt,zo,Cl,epe,Zfe,lhe],pj=t=>Y4.find(K4(t));function uhe(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||g4(t):!0}const dhe=new Set(["brightness","contrast","saturate","opacity"]);function fhe(t){const[e,r]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[n]=r.match(pA)||[];if(!n)return t;const a=r.replace(n,"");let i=dhe.has(e)?1:0;return n!==r&&(i*=100),e+"("+i+a+")"}const phe=/\b([a-z-]*)\(.*?\)/gu,FC={...iu,getAnimatableNone:t=>{const e=t.match(phe);return e?e.map(fhe).join(" "):t}},hj={...Dp,transform:Math.round},hhe={rotate:Cl,rotateX:Cl,rotateY:Cl,rotateZ:Cl,scale:Tv,scaleX:Tv,scaleY:Tv,scaleZ:Tv,skew:Cl,skewX:Cl,skewY:Cl,distance:Jt,translateX:Jt,translateY:Jt,translateZ:Jt,x:Jt,y:Jt,z:Jt,perspective:Jt,transformPerspective:Jt,opacity:Ym,originX:tj,originY:tj,originZ:Jt},wA={borderWidth:Jt,borderTopWidth:Jt,borderRightWidth:Jt,borderBottomWidth:Jt,borderLeftWidth:Jt,borderRadius:Jt,radius:Jt,borderTopLeftRadius:Jt,borderTopRightRadius:Jt,borderBottomRightRadius:Jt,borderBottomLeftRadius:Jt,width:Jt,maxWidth:Jt,height:Jt,maxHeight:Jt,top:Jt,right:Jt,bottom:Jt,left:Jt,padding:Jt,paddingTop:Jt,paddingRight:Jt,paddingBottom:Jt,paddingLeft:Jt,margin:Jt,marginTop:Jt,marginRight:Jt,marginBottom:Jt,marginLeft:Jt,backgroundPositionX:Jt,backgroundPositionY:Jt,...hhe,zIndex:hj,fillOpacity:Ym,strokeOpacity:Ym,numOctaves:hj},mhe={...wA,color:Kn,backgroundColor:Kn,outlineColor:Kn,fill:Kn,stroke:Kn,borderColor:Kn,borderTopColor:Kn,borderRightColor:Kn,borderBottomColor:Kn,borderLeftColor:Kn,filter:FC,WebkitFilter:FC},X4=t=>mhe[t];function J4(t,e){let r=X4(t);return r!==FC&&(r=iu),r.getAnimatableNone?r.getAnimatableNone(e):void 0}const ghe=new Set(["auto","none","0"]);function yhe(t,e,r){let n=0,a;for(;n<t.length&&!a;){const i=t[n];typeof i=="string"&&!ghe.has(i)&&Xm(i).values.length&&(a=t[n]),n++}if(a&&r)for(const i of e)t[i]=J4(r,a)}class vhe extends bA{constructor(e,r,n,a,i){super(e,r,n,a,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:r,name:n}=this;if(!r||!r.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let d=e[u];if(typeof d=="string"&&(d=d.trim(),fA(d))){const f=G4(d,r.current);f!==void 0&&(e[u]=f),u===e.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!W4.has(n)||e.length!==2)return;const[a,i]=e,o=pj(a),c=pj(i);if(o!==c)if(lj(o)&&lj(c))for(let u=0;u<e.length;u++){const d=e[u];typeof d=="string"&&(e[u]=parseFloat(d))}else rd[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:r}=this,n=[];for(let a=0;a<e.length;a++)(e[a]===null||uhe(e[a]))&&n.push(a);n.length&&yhe(e,n,r)}measureInitialState(){const{element:e,unresolvedKeyframes:r,name:n}=this;if(!e||!e.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=rd[n](e.measureViewportBox(),window.getComputedStyle(e.current)),r[0]=this.measuredOrigin;const a=r[r.length-1];a!==void 0&&e.getValue(n,a).jump(a,!1)}measureEndState(){const{element:e,name:r,unresolvedKeyframes:n}=this;if(!e||!e.current)return;const a=e.getValue(r);a&&a.jump(this.measuredOrigin,!1);const i=n.length-1,o=n[i];n[i]=rd[r](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),this.removedTransforms?.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}}function _he(t,e,r){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let n=document;const a=r?.[t]??n.querySelectorAll(t);return a?Array.from(a):[]}return Array.from(t)}const Q4=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function bhe(t){return m4(t)&&"offsetHeight"in t}const mj=30,khe=t=>!isNaN(parseFloat(t));class whe{constructor(e,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{const a=di.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=r.owner}setCurrent(e){this.current=e,this.updatedAt=di.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=khe(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,r){this.events[e]||(this.events[e]=new cA);const n=this.events[e].add(r);return e==="change"?()=>{n(),wn.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,r){this.passiveEffect=e,this.stopPassiveEffect=r}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,r=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=di.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>mj)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,mj);return y4(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(e){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=e(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function fp(t,e){return new whe(t,e)}const{schedule:SA}=P4(queueMicrotask,!1),Bs={x:!1,y:!1};function Z4(){return Bs.x||Bs.y}function She(t){return t==="x"||t==="y"?Bs[t]?null:(Bs[t]=!0,()=>{Bs[t]=!1}):Bs.x||Bs.y?null:(Bs.x=Bs.y=!0,()=>{Bs.x=Bs.y=!1})}function ez(t,e){const r=_he(t),n=new AbortController,a={passive:!0,...e,signal:n.signal};return[r,a,()=>n.abort()]}function gj(t){return!(t.pointerType==="touch"||Z4())}function Ehe(t,e,r={}){const[n,a,i]=ez(t,r),o=c=>{if(!gj(c))return;const{target:u}=c,d=e(u,c);if(typeof d!="function"||!u)return;const f=h=>{gj(h)&&(d(h),u.removeEventListener("pointerleave",f))};u.addEventListener("pointerleave",f,a)};return n.forEach(c=>{c.addEventListener("pointerenter",o,a)}),i}const tz=(t,e)=>e?t===e?!0:tz(t,e.parentElement):!1,EA=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,The=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Che(t){return The.has(t.tagName)||t.tabIndex!==-1}const y_=new WeakSet;function yj(t){return e=>{e.key==="Enter"&&t(e)}}function EE(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const xhe=(t,e)=>{const r=t.currentTarget;if(!r)return;const n=yj(()=>{if(y_.has(r))return;EE(r,"down");const a=yj(()=>{EE(r,"up")}),i=()=>EE(r,"cancel");r.addEventListener("keyup",a,e),r.addEventListener("blur",i,e)});r.addEventListener("keydown",n,e),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),e)};function vj(t){return EA(t)&&!Z4()}function Phe(t,e,r={}){const[n,a,i]=ez(t,r),o=c=>{const u=c.currentTarget;if(!vj(c))return;y_.add(u);const d=e(u,c),f=(_,w)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",m),y_.has(u)&&y_.delete(u),vj(_)&&typeof d=="function"&&d(_,{success:w})},h=_=>{f(_,u===window||u===document||r.useGlobalTarget||tz(u,_.target))},m=_=>{f(_,!1)};window.addEventListener("pointerup",h,a),window.addEventListener("pointercancel",m,a)};return n.forEach(c=>{(r.useGlobalTarget?window:c).addEventListener("pointerdown",o,a),bhe(c)&&(c.addEventListener("focus",d=>xhe(d,a)),!Che(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),i}function rz(t){return m4(t)&&"ownerSVGElement"in t}function Ahe(t){return rz(t)&&t.tagName==="svg"}const La=t=>!!(t&&t.getVelocity),Rhe=[...Y4,Kn,iu],Dhe=t=>Rhe.find(K4(t)),nz=v.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Ohe(t=!0){const e=v.useContext(nA);if(e===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:a}=e,i=v.useId();v.useEffect(()=>{if(t)return a(i)},[t]);const o=v.useCallback(()=>t&&n&&n(i),[i,n,t]);return!r&&n?[!1,o]:[!0]}const az=v.createContext({strict:!1}),_j={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},pp={};for(const t in _j)pp[t]={isEnabled:e=>_j[t].some(r=>!!e[r])};function Nhe(t){for(const e in t)pp[e]={...pp[e],...t[e]}}const Ihe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function vb(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Ihe.has(t)}let iz=t=>!vb(t);function Mhe(t){typeof t=="function"&&(iz=e=>e.startsWith("on")?!vb(e):t(e))}try{Mhe(require("@emotion/is-prop-valid").default)}catch{}function jhe(t,e,r){const n={};for(const a in t)a==="values"&&typeof t.values=="object"||(iz(a)||r===!0&&vb(a)||!e&&!vb(a)||t.draggable&&a.startsWith("onDrag"))&&(n[a]=t[a]);return n}const v0=v.createContext({});function _0(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Jm(t){return typeof t=="string"||Array.isArray(t)}const TA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],CA=["initial",...TA];function b0(t){return _0(t.animate)||CA.some(e=>Jm(t[e]))}function sz(t){return!!(b0(t)||t.variants)}function Lhe(t,e){if(b0(t)){const{initial:r,animate:n}=t;return{initial:r===!1||Jm(r)?r:void 0,animate:Jm(n)?n:void 0}}return t.inherit!==!1?e:{}}function Bhe(t){const{initial:e,animate:r}=Lhe(t,v.useContext(v0));return v.useMemo(()=>({initial:e,animate:r}),[bj(e),bj(r)])}function bj(t){return Array.isArray(t)?t.join(" "):t}const Qm={};function Uhe(t){for(const e in t)Qm[e]=t[e],dA(e)&&(Qm[e].isCSSVariable=!0)}function oz(t,{layout:e,layoutId:r}){return Np.has(t)||t.startsWith("origin")||(e||r!==void 0)&&(!!Qm[t]||t==="opacity")}const Fhe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},qhe=Op.length;function zhe(t,e,r){let n="",a=!0;for(let i=0;i<qhe;i++){const o=Op[i],c=t[o];if(c===void 0)continue;let u=!0;if(typeof c=="number"?u=c===(o.startsWith("scale")?1:0):u=parseFloat(c)===0,!u||r){const d=Q4(c,wA[o]);if(!u){a=!1;const f=Fhe[o]||o;n+=`${f}(${d}) `}r&&(e[o]=d)}}return n=n.trim(),r?n=r(e,a?"":n):a&&(n="none"),n}function xA(t,e,r){const{style:n,vars:a,transformOrigin:i}=t;let o=!1,c=!1;for(const u in e){const d=e[u];if(Np.has(u)){o=!0;continue}else if(dA(u)){a[u]=d;continue}else{const f=Q4(d,wA[u]);u.startsWith("origin")?(c=!0,i[u]=f):n[u]=f}}if(e.transform||(o||r?n.transform=zhe(e,t.transform,r):n.transform&&(n.transform="none")),c){const{originX:u="50%",originY:d="50%",originZ:f=0}=i;n.transformOrigin=`${u} ${d} ${f}`}}const PA=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function cz(t,e,r){for(const n in e)!La(e[n])&&!oz(n,r)&&(t[n]=e[n])}function $he({transformTemplate:t},e){return v.useMemo(()=>{const r=PA();return xA(r,e,t),Object.assign({},r.vars,r.style)},[e])}function Vhe(t,e){const r=t.style||{},n={};return cz(n,r,t),Object.assign(n,$he(t,e)),n}function Hhe(t,e){const r={},n=Vhe(t,e);return t.drag&&t.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(r.tabIndex=0),r.style=n,r}const Ghe={offset:"stroke-dashoffset",array:"stroke-dasharray"},Whe={offset:"strokeDashoffset",array:"strokeDasharray"};function Khe(t,e,r=1,n=0,a=!0){t.pathLength=1;const i=a?Ghe:Whe;t[i.offset]=Jt.transform(-n);const o=Jt.transform(e),c=Jt.transform(r);t[i.array]=`${o} ${c}`}function lz(t,{attrX:e,attrY:r,attrScale:n,pathLength:a,pathSpacing:i=1,pathOffset:o=0,...c},u,d,f){if(xA(t,c,d),u){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:m}=t;h.transform&&(m.transform=h.transform,delete h.transform),(m.transform||h.transformOrigin)&&(m.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),m.transform&&(m.transformBox=f?.transformBox??"fill-box",delete h.transformBox),e!==void 0&&(h.x=e),r!==void 0&&(h.y=r),n!==void 0&&(h.scale=n),a!==void 0&&Khe(h,a,i,o,!1)}const uz=()=>({...PA(),attrs:{}}),dz=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Yhe(t,e,r,n){const a=v.useMemo(()=>{const i=uz();return lz(i,e,dz(n),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};cz(i,t.style,t),a.style={...i,...a.style}}return a}const Xhe=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function AA(t){return typeof t!="string"||t.includes("-")?!1:!!(Xhe.indexOf(t)>-1||/[A-Z]/u.test(t))}function Jhe(t,e,r,{latestValues:n},a,i=!1){const c=(AA(t)?Yhe:Hhe)(e,n,a,t),u=jhe(e,typeof t=="string",i),d=t!==v.Fragment?{...u,...c,ref:r}:{},{children:f}=e,h=v.useMemo(()=>La(f)?f.get():f,[f]);return v.createElement(t,{...d,children:h})}function kj(t){const e=[{},{}];return t?.values.forEach((r,n)=>{e[0][n]=r.get(),e[1][n]=r.getVelocity()}),e}function RA(t,e,r,n){if(typeof e=="function"){const[a,i]=kj(n);e=e(r!==void 0?r:t.custom,a,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[a,i]=kj(n);e=e(r!==void 0?r:t.custom,a,i)}return e}function v_(t){return La(t)?t.get():t}function Qhe({scrapeMotionValuesFromProps:t,createRenderState:e},r,n,a){return{latestValues:Zhe(r,n,a,t),renderState:e()}}function Zhe(t,e,r,n){const a={},i=n(t,{});for(const m in i)a[m]=v_(i[m]);let{initial:o,animate:c}=t;const u=b0(t),d=sz(t);e&&d&&!u&&t.inherit!==!1&&(o===void 0&&(o=e.initial),c===void 0&&(c=e.animate));let f=r?r.initial===!1:!1;f=f||o===!1;const h=f?c:o;if(h&&typeof h!="boolean"&&!_0(h)){const m=Array.isArray(h)?h:[h];for(let _=0;_<m.length;_++){const w=RA(t,m[_]);if(w){const{transitionEnd:b,transition:E,...T}=w;for(const R in T){let P=T[R];if(Array.isArray(P)){const A=f?P.length-1:0;P=P[A]}P!==null&&(a[R]=P)}for(const R in b)a[R]=b[R]}}}return a}const fz=t=>(e,r)=>{const n=v.useContext(v0),a=v.useContext(nA),i=()=>Qhe(t,e,n,a);return r?i():Nfe(i)};function DA(t,e,r){const{style:n}=t,a={};for(const i in n)(La(n[i])||e.style&&La(e.style[i])||oz(i,t)||r?.getValue(i)?.liveStyle!==void 0)&&(a[i]=n[i]);return a}const eme=fz({scrapeMotionValuesFromProps:DA,createRenderState:PA});function pz(t,e,r){const n=DA(t,e,r);for(const a in t)if(La(t[a])||La(e[a])){const i=Op.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;n[i]=t[a]}return n}const tme=fz({scrapeMotionValuesFromProps:pz,createRenderState:uz}),rme=Symbol.for("motionComponentSymbol");function Pf(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function nme(t,e,r){return v.useCallback(n=>{n&&t.onMount&&t.onMount(n),e&&(n?e.mount(n):e.unmount()),r&&(typeof r=="function"?r(n):Pf(r)&&(r.current=n))},[e])}const OA=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),ame="framerAppearId",hz="data-"+OA(ame),mz=v.createContext({});function ime(t,e,r,n,a){const{visualElement:i}=v.useContext(v0),o=v.useContext(az),c=v.useContext(nA),u=v.useContext(nz).reducedMotion,d=v.useRef(null);n=n||o.renderer,!d.current&&n&&(d.current=n(t,{visualState:e,parent:i,props:r,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u}));const f=d.current,h=v.useContext(mz);f&&!f.projection&&a&&(f.type==="html"||f.type==="svg")&&sme(d.current,r,a,h);const m=v.useRef(!1);v.useInsertionEffect(()=>{f&&m.current&&f.update(r,c)});const _=r[hz],w=v.useRef(!!_&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return Ife(()=>{f&&(m.current=!0,window.MotionIsMounted=!0,f.updateFeatures(),f.scheduleRenderMicrotask(),w.current&&f.animationState&&f.animationState.animateChanges())}),v.useEffect(()=>{f&&(!w.current&&f.animationState&&f.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),w.current=!1),f.enteringChildren=void 0)}),f}function sme(t,e,r,n){const{layoutId:a,layout:i,drag:o,dragConstraints:c,layoutScroll:u,layoutRoot:d,layoutCrossfade:f}=e;t.projection=new r(t.latestValues,e["data-framer-portal-id"]?void 0:gz(t.parent)),t.projection.setOptions({layoutId:a,layout:i,alwaysMeasureLayout:!!o||c&&Pf(c),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:n,crossfade:f,layoutScroll:u,layoutRoot:d})}function gz(t){if(t)return t.options.allowProjection!==!1?t.projection:gz(t.parent)}function TE(t,{forwardMotionProps:e=!1}={},r,n){r&&Nhe(r);const a=AA(t)?tme:eme;function i(c,u){let d;const f={...v.useContext(nz),...c,layoutId:ome(c)},{isStatic:h}=f,m=Bhe(c),_=a(c,h);if(!h&&rA){cme();const w=lme(f);d=w.MeasureLayout,m.visualElement=ime(t,_,f,n,w.ProjectionNode)}return g.jsxs(v0.Provider,{value:m,children:[d&&m.visualElement?g.jsx(d,{visualElement:m.visualElement,...f}):null,Jhe(t,c,nme(_,m.visualElement,u),_,h,e)]})}i.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const o=v.forwardRef(i);return o[rme]=t,o}function ome({layoutId:t}){const e=v.useContext(p4).id;return e&&t!==void 0?e+"-"+t:t}function cme(t,e){v.useContext(az).strict}function lme(t){const{drag:e,layout:r}=pp;if(!e&&!r)return{};const n={...e,...r};return{MeasureLayout:e?.isEnabled(t)||r?.isEnabled(t)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function ume(t,e){if(typeof Proxy>"u")return TE;const r=new Map,n=(i,o)=>TE(i,o,t,e),a=(i,o)=>n(i,o);return new Proxy(a,{get:(i,o)=>o==="create"?n:(r.has(o)||r.set(o,TE(o,void 0,t,e)),r.get(o))})}function yz({top:t,left:e,right:r,bottom:n}){return{x:{min:e,max:r},y:{min:t,max:n}}}function dme({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function fme(t,e){if(!e)return t;const r=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function CE(t){return t===void 0||t===1}function qC({scale:t,scaleX:e,scaleY:r}){return!CE(t)||!CE(e)||!CE(r)}function Hu(t){return qC(t)||vz(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function vz(t){return wj(t.x)||wj(t.y)}function wj(t){return t&&t!=="0%"}function _b(t,e,r){const n=t-r,a=e*n;return r+a}function Sj(t,e,r,n,a){return a!==void 0&&(t=_b(t,a,n)),_b(t,r,n)+e}function zC(t,e=0,r=1,n,a){t.min=Sj(t.min,e,r,n,a),t.max=Sj(t.max,e,r,n,a)}function _z(t,{x:e,y:r}){zC(t.x,e.translate,e.scale,e.originPoint),zC(t.y,r.translate,r.scale,r.originPoint)}const Ej=.999999999999,Tj=1.0000000000001;function pme(t,e,r,n=!1){const a=r.length;if(!a)return;e.x=e.y=1;let i,o;for(let c=0;c<a;c++){i=r[c],o=i.projectionDelta;const{visualElement:u}=i.options;u&&u.props.style&&u.props.style.display==="contents"||(n&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Rf(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,_z(t,o)),n&&Hu(i.latestValues)&&Rf(t,i.latestValues))}e.x<Tj&&e.x>Ej&&(e.x=1),e.y<Tj&&e.y>Ej&&(e.y=1)}function Af(t,e){t.min=t.min+e,t.max=t.max+e}function Cj(t,e,r,n,a=.5){const i=En(t.min,t.max,a);zC(t,e,r,i,n)}function Rf(t,e){Cj(t.x,e.x,e.scaleX,e.scale,e.originX),Cj(t.y,e.y,e.scaleY,e.scale,e.originY)}function bz(t,e){return yz(fme(t.getBoundingClientRect(),e))}function hme(t,e,r){const n=bz(t,r),{scroll:a}=e;return a&&(Af(n.x,a.offset.x),Af(n.y,a.offset.y)),n}const xj=()=>({translate:0,scale:1,origin:0,originPoint:0}),Df=()=>({x:xj(),y:xj()}),Pj=()=>({min:0,max:0}),jn=()=>({x:Pj(),y:Pj()}),bb={current:null},NA={current:!1};function kz(){if(NA.current=!0,!!rA)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>bb.current=t.matches;t.addEventListener("change",e),e()}else bb.current=!1}const mme=new WeakMap;function gme(t,e,r){for(const n in e){const a=e[n],i=r[n];if(La(a))t.addValue(n,a);else if(La(i))t.addValue(n,fp(a,{owner:t}));else if(i!==a)if(t.hasValue(n)){const o=t.getValue(n);o.liveStyle===!0?o.jump(a):o.hasAnimated||o.set(a)}else{const o=t.getStaticValue(n);t.addValue(n,fp(o!==void 0?o:a,{owner:t}))}}for(const n in r)e[n]===void 0&&t.removeValue(n);return e}const Aj=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class yme{scrapeMotionValuesFromProps(e,r,n){return{}}constructor({parent:e,props:r,presenceContext:n,reducedMotionConfig:a,blockInitialAnimation:i,visualState:o},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=bA,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=di.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,wn.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=o;this.latestValues=u,this.baseTarget={...u},this.initialValues=r.initial?{...u}:{},this.renderState=d,this.parent=e,this.props=r,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=a,this.options=c,this.blockInitialAnimation=!!i,this.isControllingVariants=b0(r),this.isVariantNode=sz(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:f,...h}=this.scrapeMotionValuesFromProps(r,{},this);for(const m in h){const _=h[m];u[m]!==void 0&&La(_)&&_.set(u[m])}}mount(e){this.current=e,mme.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),NA.current||kz(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:bb.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),au(this.notifyUpdate),au(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const r=this.features[e];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,r){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=Np.has(e);n&&this.onBindTransform&&this.onBindTransform();const a=r.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&wn.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,r)),this.valueSubscriptions.set(e,()=>{a(),i&&i(),r.owner&&r.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in pp){const r=pp[e];if(!r)continue;const{isEnabled:n,Feature:a}=r;if(!this.features[e]&&a&&n(this.props)&&(this.features[e]=new a(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):jn()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,r){this.latestValues[e]=r}update(e,r){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<Aj.length;n++){const a=Aj[n];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const i="on"+a,o=e[i];o&&(this.propEventSubscriptions[a]=this.on(a,o))}this.prevMotionValues=gme(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(e),()=>r.variantChildren.delete(e)}addValue(e,r){const n=this.values.get(e);r!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,r),this.values.set(e,r),this.latestValues[e]=r.get())}removeValue(e){this.values.delete(e);const r=this.valueSubscriptions.get(e);r&&(r(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,r){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&r!==void 0&&(n=fp(r===null?void 0:r,{owner:this}),this.addValue(e,n)),n}readValue(e,r){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n=="string"&&(h4(n)||g4(n))?n=parseFloat(n):!Dhe(n)&&iu.test(r)&&(n=J4(e,r)),this.setBaseTarget(e,La(n)?n.get():n)),La(n)?n.get():n}setBaseTarget(e,r){this.baseTarget[e]=r}getBaseTarget(e){const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const i=RA(this.props,r,this.presenceContext?.custom);i&&(n=i[e])}if(r&&n!==void 0)return n;const a=this.getBaseTargetFromProps(this.props,e);return a!==void 0&&!La(a)?a:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,r){return this.events[e]||(this.events[e]=new cA),this.events[e].add(r)}notify(e,...r){this.events[e]&&this.events[e].notify(...r)}scheduleRenderMicrotask(){SA.render(this.render)}}class wz extends yme{constructor(){super(...arguments),this.KeyframeResolver=vhe}sortInstanceNodePosition(e,r){return e.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(e,r){return e.style?e.style[r]:void 0}removeValueFromRenderState(e,{vars:r,style:n}){delete r[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;La(e)&&(this.childSubscription=e.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function Sz(t,{style:e,vars:r},n,a){const i=t.style;let o;for(o in e)i[o]=e[o];a?.applyProjectionStyles(i,n);for(o in r)i.setProperty(o,r[o])}function vme(t){return window.getComputedStyle(t)}class _me extends wz{constructor(){super(...arguments),this.type="html",this.renderInstance=Sz}readValueFromInstance(e,r){if(Np.has(r))return this.projection?.isProjecting?IC(r):Lpe(e,r);{const n=vme(e),a=(dA(r)?n.getPropertyValue(r):n[r])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:r}){return bz(e,r)}build(e,r,n){xA(e,r,n.transformTemplate)}scrapeMotionValuesFromProps(e,r,n){return DA(e,r,n)}}const Ez=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function bme(t,e,r,n){Sz(t,e,void 0,n);for(const a in e.attrs)t.setAttribute(Ez.has(a)?a:OA(a),e.attrs[a])}class kme extends wz{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=jn}getBaseTargetFromProps(e,r){return e[r]}readValueFromInstance(e,r){if(Np.has(r)){const n=X4(r);return n&&n.default||0}return r=Ez.has(r)?r:OA(r),e.getAttribute(r)}scrapeMotionValuesFromProps(e,r,n){return pz(e,r,n)}build(e,r,n){lz(e,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,r,n,a){bme(e,r,n,a)}mount(e){this.isSVGTag=dz(e.tagName),super.mount(e)}}const wme=(t,e)=>AA(t)?new kme(e):new _me(e,{allowProjection:t!==v.Fragment});function Wf(t,e,r){const n=t.getProps();return RA(n,e,r!==void 0?r:n.custom,t)}const $C=t=>Array.isArray(t);function Sme(t,e,r){t.hasValue(e)?t.getValue(e).set(r):t.addValue(e,fp(r))}function Eme(t){return $C(t)?t[t.length-1]||0:t}function Tme(t,e){const r=Wf(t,e);let{transitionEnd:n={},transition:a={},...i}=r||{};i={...i,...n};for(const o in i){const c=Eme(i[o]);Sme(t,o,c)}}function Cme(t){return!!(La(t)&&t.add)}function VC(t,e){const r=t.getValue("willChange");if(Cme(r))return r.add(e);if(!r&&Hc.WillChange){const n=new Hc.WillChange("auto");t.addValue("willChange",n),n.add(e)}}function Tz(t){return t.props[hz]}const xme=t=>t!==null;function Pme(t,{repeat:e,repeatType:r="loop"},n){const a=t.filter(xme),i=e&&r!=="loop"&&e%2===1?0:a.length-1;return a[i]}const Ame={type:"spring",stiffness:500,damping:25,restSpeed:10},Rme=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),Dme={type:"keyframes",duration:.8},Ome={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Nme=(t,{keyframes:e})=>e.length>2?Dme:Np.has(t)?t.startsWith("scale")?Rme(e[1]):Ame:Ome;function Ime({when:t,delay:e,delayChildren:r,staggerChildren:n,staggerDirection:a,repeat:i,repeatType:o,repeatDelay:c,from:u,elapsed:d,...f}){return!!Object.keys(f).length}const IA=(t,e,r,n={},a,i)=>o=>{const c=kA(n,t)||{},u=c.delay||n.delay||0;let{elapsed:d=0}=n;d=d-qo(u);const f={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:e.getVelocity(),...c,delay:-d,onUpdate:m=>{e.set(m),c.onUpdate&&c.onUpdate(m)},onComplete:()=>{o(),c.onComplete&&c.onComplete()},name:t,motionValue:e,element:i?void 0:a};Ime(c)||Object.assign(f,Nme(t,f)),f.duration&&(f.duration=qo(f.duration)),f.repeatDelay&&(f.repeatDelay=qo(f.repeatDelay)),f.from!==void 0&&(f.keyframes[0]=f.from);let h=!1;if((f.type===!1||f.duration===0&&!f.repeatDelay)&&(UC(f),f.delay===0&&(h=!0)),(Hc.instantAnimations||Hc.skipAnimations)&&(h=!0,UC(f),f.delay=0),f.allowFlatten=!c.type&&!c.ease,h&&!i&&e.get()!==void 0){const m=Pme(f.keyframes,c);if(m!==void 0){wn.update(()=>{f.onUpdate(m),f.onComplete()});return}}return c.isSync?new _A(f):new she(f)};function Mme({protectedKeys:t,needsAnimating:e},r){const n=t.hasOwnProperty(r)&&e[r]!==!0;return e[r]=!1,n}function Cz(t,e,{delay:r=0,transitionOverride:n,type:a}={}){let{transition:i=t.getDefaultTransition(),transitionEnd:o,...c}=e;n&&(i=n);const u=[],d=a&&t.animationState&&t.animationState.getState()[a];for(const f in c){const h=t.getValue(f,t.latestValues[f]??null),m=c[f];if(m===void 0||d&&Mme(d,f))continue;const _={delay:r,...kA(i||{},f)},w=h.get();if(w!==void 0&&!h.isAnimating&&!Array.isArray(m)&&m===w&&!_.velocity)continue;let b=!1;if(window.MotionHandoffAnimation){const T=Tz(t);if(T){const R=window.MotionHandoffAnimation(T,f,wn);R!==null&&(_.startTime=R,b=!0)}}VC(t,f),h.start(IA(f,h,m,t.shouldReduceMotion&&W4.has(f)?{type:!1}:_,t,b));const E=h.animation;E&&u.push(E)}return o&&Promise.all(u).then(()=>{wn.update(()=>{o&&Tme(t,o)})}),u}function xz(t,e,r,n=0,a=1){const i=Array.from(t).sort((d,f)=>d.sortNodePosition(f)).indexOf(e),o=t.size,c=(o-1)*n;return typeof r=="function"?r(i,o):a===1?i*n:c-i*n}function HC(t,e,r={}){const n=Wf(t,e,r.type==="exit"?t.presenceContext?.custom:void 0);let{transition:a=t.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(a=r.transitionOverride);const i=n?()=>Promise.all(Cz(t,n,r)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:h}=a;return jme(t,e,u,d,f,h,r)}:()=>Promise.resolve(),{when:c}=a;if(c){const[u,d]=c==="beforeChildren"?[i,o]:[o,i];return u().then(()=>d())}else return Promise.all([i(),o(r.delay)])}function jme(t,e,r=0,n=0,a=0,i=1,o){const c=[];for(const u of t.variantChildren)u.notify("AnimationStart",e),c.push(HC(u,e,{...o,delay:r+(typeof n=="function"?0:n)+xz(t.variantChildren,u,n,a,i)}).then(()=>u.notify("AnimationComplete",e)));return Promise.all(c)}function Lme(t,e,r={}){t.notify("AnimationStart",e);let n;if(Array.isArray(e)){const a=e.map(i=>HC(t,i,r));n=Promise.all(a)}else if(typeof e=="string")n=HC(t,e,r);else{const a=typeof e=="function"?Wf(t,e,r.custom):e;n=Promise.all(Cz(t,a,r))}return n.then(()=>{t.notify("AnimationComplete",e)})}function Pz(t,e){if(!Array.isArray(e))return!1;const r=e.length;if(r!==t.length)return!1;for(let n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}const Bme=CA.length;function Az(t){if(!t)return;if(!t.isControllingVariants){const r=t.parent?Az(t.parent)||{}:{};return t.props.initial!==void 0&&(r.initial=t.props.initial),r}const e={};for(let r=0;r<Bme;r++){const n=CA[r],a=t.props[n];(Jm(a)||a===!1)&&(e[n]=a)}return e}const Ume=[...TA].reverse(),Fme=TA.length;function qme(t){return e=>Promise.all(e.map(({animation:r,options:n})=>Lme(t,r,n)))}function zme(t){let e=qme(t),r=Rj(),n=!0;const a=u=>(d,f)=>{const h=Wf(t,f,u==="exit"?t.presenceContext?.custom:void 0);if(h){const{transition:m,transitionEnd:_,...w}=h;d={...d,...w,..._}}return d};function i(u){e=u(t)}function o(u){const{props:d}=t,f=Az(t.parent)||{},h=[],m=new Set;let _={},w=1/0;for(let E=0;E<Fme;E++){const T=Ume[E],R=r[T],P=d[T]!==void 0?d[T]:f[T],A=Jm(P),C=T===u?R.isActive:null;C===!1&&(w=E);let O=P===f[T]&&P!==d[T]&&A;if(O&&n&&t.manuallyAnimateOnMount&&(O=!1),R.protectedKeys={..._},!R.isActive&&C===null||!P&&!R.prevProp||_0(P)||typeof P=="boolean")continue;const I=$me(R.prevProp,P);let x=I||T===u&&R.isActive&&!O&&A||E>w&&A,D=!1;const N=Array.isArray(P)?P:[P];let L=N.reduce(a(T),{});C===!1&&(L={});const{prevResolvedValues:j={}}=R,q={...j,...L},U=Y=>{x=!0,m.has(Y)&&(D=!0,m.delete(Y)),R.needsAnimating[Y]=!0;const Q=t.getValue(Y);Q&&(Q.liveStyle=!1)};for(const Y in q){const Q=L[Y],ie=j[Y];if(_.hasOwnProperty(Y))continue;let G=!1;$C(Q)&&$C(ie)?G=!Pz(Q,ie):G=Q!==ie,G?Q!=null?U(Y):m.add(Y):Q!==void 0&&m.has(Y)?U(Y):R.protectedKeys[Y]=!0}R.prevProp=P,R.prevResolvedValues=L,R.isActive&&(_={..._,...L}),n&&t.blockInitialAnimation&&(x=!1);const W=O&&I;x&&(!W||D)&&h.push(...N.map(Y=>{const Q={type:T};if(typeof Y=="string"&&n&&!W&&t.manuallyAnimateOnMount&&t.parent){const{parent:ie}=t,G=Wf(ie,Y);if(ie.enteringChildren&&G){const{delayChildren:B}=G.transition||{};Q.delay=xz(ie.enteringChildren,t,B)}}return{animation:Y,options:Q}}))}if(m.size){const E={};if(typeof d.initial!="boolean"){const T=Wf(t,Array.isArray(d.initial)?d.initial[0]:d.initial);T&&T.transition&&(E.transition=T.transition)}m.forEach(T=>{const R=t.getBaseTarget(T),P=t.getValue(T);P&&(P.liveStyle=!0),E[T]=R??null}),h.push({animation:E})}let b=!!h.length;return n&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(b=!1),n=!1,b?e(h):Promise.resolve()}function c(u,d){if(r[u].isActive===d)return Promise.resolve();t.variantChildren?.forEach(h=>h.animationState?.setActive(u,d)),r[u].isActive=d;const f=o(u);for(const h in r)r[h].protectedKeys={};return f}return{animateChanges:o,setActive:c,setAnimateFunction:i,getState:()=>r,reset:()=>{r=Rj(),n=!0}}}function $me(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!Pz(e,t):!1}function Mu(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Rj(){return{animate:Mu(!0),whileInView:Mu(),whileHover:Mu(),whileTap:Mu(),whileDrag:Mu(),whileFocus:Mu(),exit:Mu()}}class gu{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Vme extends gu{constructor(e){super(e),e.animationState||(e.animationState=zme(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();_0(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:r}=this.node.prevProps||{};e!==r&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Hme=0;class Gme extends gu{constructor(){super(...arguments),this.id=Hme++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;const a=this.node.animationState.setActive("exit",!e);r&&!e&&a.then(()=>{r(this.id)})}mount(){const{register:e,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Wme={animation:{Feature:Vme},exit:{Feature:Gme}};function Zm(t,e,r,n={passive:!0}){return t.addEventListener(e,r,n),()=>t.removeEventListener(e,r)}function Vg(t){return{point:{x:t.pageX,y:t.pageY}}}const Kme=t=>e=>EA(e)&&t(e,Vg(e));function _m(t,e,r,n){return Zm(t,e,Kme(r),n)}const Rz=1e-4,Yme=1-Rz,Xme=1+Rz,Dz=.01,Jme=0-Dz,Qme=0+Dz;function Ga(t){return t.max-t.min}function Zme(t,e,r){return Math.abs(t-e)<=r}function Dj(t,e,r,n=.5){t.origin=n,t.originPoint=En(e.min,e.max,t.origin),t.scale=Ga(r)/Ga(e),t.translate=En(r.min,r.max,t.origin)-t.originPoint,(t.scale>=Yme&&t.scale<=Xme||isNaN(t.scale))&&(t.scale=1),(t.translate>=Jme&&t.translate<=Qme||isNaN(t.translate))&&(t.translate=0)}function bm(t,e,r,n){Dj(t.x,e.x,r.x,n?n.originX:void 0),Dj(t.y,e.y,r.y,n?n.originY:void 0)}function Oj(t,e,r){t.min=r.min+e.min,t.max=t.min+Ga(e)}function ege(t,e,r){Oj(t.x,e.x,r.x),Oj(t.y,e.y,r.y)}function Nj(t,e,r){t.min=e.min-r.min,t.max=t.min+Ga(e)}function km(t,e,r){Nj(t.x,e.x,r.x),Nj(t.y,e.y,r.y)}function ns(t){return[t("x"),t("y")]}const Oz=({current:t})=>t?t.ownerDocument.defaultView:null,Ij=(t,e)=>Math.abs(t-e);function tge(t,e){const r=Ij(t.x,e.x),n=Ij(t.y,e.y);return Math.sqrt(r**2+n**2)}class Nz{constructor(e,r,{transformPagePoint:n,contextWindow:a=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=PE(this.lastMoveEventInfo,this.history),_=this.startEvent!==null,w=tge(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!_&&!w)return;const{point:b}=m,{timestamp:E}=wa;this.history.push({...b,timestamp:E});const{onStart:T,onMove:R}=this.handlers;_||(T&&T(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),R&&R(this.lastMoveEvent,m)},this.handlePointerMove=(m,_)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=xE(_,this.transformPagePoint),wn.update(this.updatePoint,!0)},this.handlePointerUp=(m,_)=>{this.end();const{onEnd:w,onSessionEnd:b,resumeAnimation:E}=this.handlers;if(this.dragSnapToOrigin&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const T=PE(m.type==="pointercancel"?this.lastMoveEventInfo:xE(_,this.transformPagePoint),this.history);this.startEvent&&w&&w(m,T),b&&b(m,T)},!EA(e))return;this.dragSnapToOrigin=i,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=o,this.contextWindow=a||window;const c=Vg(e),u=xE(c,this.transformPagePoint),{point:d}=u,{timestamp:f}=wa;this.history=[{...d,timestamp:f}];const{onSessionStart:h}=r;h&&h(e,PE(u,this.history)),this.removeListeners=qg(_m(this.contextWindow,"pointermove",this.handlePointerMove),_m(this.contextWindow,"pointerup",this.handlePointerUp),_m(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),au(this.updatePoint)}}function xE(t,e){return e?{point:e(t.point)}:t}function Mj(t,e){return{x:t.x-e.x,y:t.y-e.y}}function PE({point:t},e){return{point:t,delta:Mj(t,Iz(e)),offset:Mj(t,rge(e)),velocity:nge(e,.1)}}function rge(t){return t[0]}function Iz(t){return t[t.length-1]}function nge(t,e){if(t.length<2)return{x:0,y:0};let r=t.length-1,n=null;const a=Iz(t);for(;r>=0&&(n=t[r],!(a.timestamp-n.timestamp>qo(e)));)r--;if(!n)return{x:0,y:0};const i=fs(a.timestamp-n.timestamp);if(i===0)return{x:0,y:0};const o={x:(a.x-n.x)/i,y:(a.y-n.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function age(t,{min:e,max:r},n){return e!==void 0&&t<e?t=n?En(e,t,n.min):Math.max(t,e):r!==void 0&&t>r&&(t=n?En(r,t,n.max):Math.min(t,r)),t}function jj(t,e,r){return{min:e!==void 0?t.min+e:void 0,max:r!==void 0?t.max+r-(t.max-t.min):void 0}}function ige(t,{top:e,left:r,bottom:n,right:a}){return{x:jj(t.x,r,a),y:jj(t.y,e,n)}}function Lj(t,e){let r=e.min-t.min,n=e.max-t.max;return e.max-e.min<t.max-t.min&&([r,n]=[n,r]),{min:r,max:n}}function sge(t,e){return{x:Lj(t.x,e.x),y:Lj(t.y,e.y)}}function oge(t,e){let r=.5;const n=Ga(t),a=Ga(e);return a>n?r=Km(e.min,e.max-n,t.min):n>a&&(r=Km(t.min,t.max-a,e.min)),Vc(0,1,r)}function cge(t,e){const r={};return e.min!==void 0&&(r.min=e.min-t.min),e.max!==void 0&&(r.max=e.max-t.min),r}const GC=.35;function lge(t=GC){return t===!1?t=0:t===!0&&(t=GC),{x:Bj(t,"left","right"),y:Bj(t,"top","bottom")}}function Bj(t,e,r){return{min:Uj(t,e),max:Uj(t,r)}}function Uj(t,e){return typeof t=="number"?t:t[e]||0}const uge=new WeakMap;class dge{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=jn(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(Vg(h).point)},o=(h,m)=>{const{drag:_,dragPropagation:w,onDragStart:b}=this.getProps();if(_&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=She(_),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ns(T=>{let R=this.getAxisMotionValue(T).get()||0;if(zo.test(R)){const{projection:P}=this.visualElement;if(P&&P.layout){const A=P.layout.layoutBox[T];A&&(R=Ga(A)*(parseFloat(R)/100))}}this.originPoint[T]=R}),b&&wn.postRender(()=>b(h,m)),VC(this.visualElement,"transform");const{animationState:E}=this.visualElement;E&&E.setActive("whileDrag",!0)},c=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m;const{dragPropagation:_,dragDirectionLock:w,onDirectionLock:b,onDrag:E}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:T}=m;if(w&&this.currentDirection===null){this.currentDirection=fge(T),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",m.point,T),this.updateAxis("y",m.point,T),this.visualElement.render(),E&&E(h,m)},u=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m,this.stop(h,m),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>ns(h=>this.getAnimationState(h)==="paused"&&this.getAxisMotionValue(h).animation?.play()),{dragSnapToOrigin:f}=this.getProps();this.panSession=new Nz(e,{onSessionStart:i,onStart:o,onMove:c,onSessionEnd:u,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:f,distanceThreshold:n,contextWindow:Oz(this.visualElement)})}stop(e,r){const n=e||this.latestPointerEvent,a=r||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!a||!n)return;const{velocity:o}=a;this.startAnimation(o);const{onDragEnd:c}=this.getProps();c&&wn.postRender(()=>c(n,a))}cancel(){this.isDragging=!1;const{projection:e,animationState:r}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(e,r,n){const{drag:a}=this.getProps();if(!n||!Cv(e,a,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(o=age(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){const{dragConstraints:e,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,a=this.constraints;e&&Pf(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&n?this.constraints=ige(n.layoutBox,e):this.constraints=!1,this.elastic=lge(r),a!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&ns(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=cge(n.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:r}=this.getProps();if(!e||!Pf(e))return!1;const n=e.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const i=hme(n,a.root,this.visualElement.getTransformPagePoint());let o=sge(a.layout.layoutBox,i);if(r){const c=r(dme(o));this.hasMutatedConstraints=!!c,c&&(o=yz(c))}return o}startAnimation(e){const{drag:r,dragMomentum:n,dragElastic:a,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},d=ns(f=>{if(!Cv(f,r,this.currentDirection))return;let h=u&&u[f]||{};o&&(h={min:0,max:0});const m=a?200:1e6,_=a?40:1e7,w={type:"inertia",velocity:n?e[f]:0,bounceStiffness:m,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(f,w)});return Promise.all(d).then(c)}startAxisValueAnimation(e,r){const n=this.getAxisMotionValue(e);return VC(this.visualElement,e),n.start(IA(e,n,0,r,this.visualElement,!1))}stopAnimation(){ns(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ns(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const r=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps(),a=n[r];return a||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){ns(r=>{const{drag:n}=this.getProps();if(!Cv(r,n,this.currentDirection))return;const{projection:a}=this.visualElement,i=this.getAxisMotionValue(r);if(a&&a.layout){const{min:o,max:c}=a.layout.layoutBox[r];i.set(e[r]-En(o,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!Pf(r)||!n||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};ns(o=>{const c=this.getAxisMotionValue(o);if(c&&this.constraints!==!1){const u=c.get();a[o]=oge({min:u,max:u},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),ns(o=>{if(!Cv(o,e,null))return;const c=this.getAxisMotionValue(o),{min:u,max:d}=this.constraints[o];c.set(En(u,d,a[o]))})}addListeners(){if(!this.visualElement.current)return;uge.set(this.visualElement,this);const e=this.visualElement.current,r=_m(e,"pointerdown",u=>{const{drag:d,dragListener:f=!0}=this.getProps();d&&f&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();Pf(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,i=a.addEventListener("measure",n);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),wn.read(n);const o=Zm(window,"resize",()=>this.scalePositionWithinConstraints()),c=a.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(ns(f=>{const h=this.getAxisMotionValue(f);h&&(this.originPoint[f]+=u[f].translate,h.set(h.get()+u[f].translate))}),this.visualElement.render())}));return()=>{o(),r(),i(),c&&c()}}getProps(){const e=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:a=!1,dragConstraints:i=!1,dragElastic:o=GC,dragMomentum:c=!0}=e;return{...e,drag:r,dragDirectionLock:n,dragPropagation:a,dragConstraints:i,dragElastic:o,dragMomentum:c}}}function Cv(t,e,r){return(e===!0||e===t)&&(r===null||r===t)}function fge(t,e=10){let r=null;return Math.abs(t.y)>e?r="y":Math.abs(t.x)>e&&(r="x"),r}class pge extends gu{constructor(e){super(e),this.removeGroupControls=hs,this.removeListeners=hs,this.controls=new dge(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||hs}unmount(){this.removeGroupControls(),this.removeListeners()}}const Fj=t=>(e,r)=>{t&&wn.postRender(()=>t(e,r))};class hge extends gu{constructor(){super(...arguments),this.removePointerDownListener=hs}onPointerDown(e){this.session=new Nz(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Oz(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:r,onPan:n,onPanEnd:a}=this.node.getProps();return{onSessionStart:Fj(e),onStart:Fj(r),onMove:n,onEnd:(i,o)=>{delete this.session,a&&wn.postRender(()=>a(i,o))}}}mount(){this.removePointerDownListener=_m(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const __={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function qj(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Mh={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(Jt.test(t))t=parseFloat(t);else return t;const r=qj(t,e.target.x),n=qj(t,e.target.y);return`${r}% ${n}%`}},mge={correct:(t,{treeScale:e,projectionDelta:r})=>{const n=t,a=iu.parse(t);if(a.length>5)return n;const i=iu.createTransformer(t),o=typeof a[0]!="number"?1:0,c=r.x.scale*e.x,u=r.y.scale*e.y;a[0+o]/=c,a[1+o]/=u;const d=En(c,u,.5);return typeof a[2+o]=="number"&&(a[2+o]/=d),typeof a[3+o]=="number"&&(a[3+o]/=d),i(a)}};let AE=!1;class gge extends v.Component{componentDidMount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n,layoutId:a}=this.props,{projection:i}=e;Uhe(yge),i&&(r.group&&r.group.add(i),n&&n.register&&a&&n.register(i),AE&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),__.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:r,visualElement:n,drag:a,isPresent:i}=this.props,{projection:o}=n;return o&&(o.isPresent=i,AE=!0,a||e.layoutDependency!==r||r===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||wn.postRender(()=>{const c=o.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),SA.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:a}=e;AE=!0,a&&(a.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(a),n&&n.deregister&&n.deregister(a))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Mz(t){const[e,r]=Ohe(),n=v.useContext(p4);return g.jsx(gge,{...t,layoutGroup:n,switchLayoutGroup:v.useContext(mz),isPresent:e,safeToRemove:r})}const yge={borderRadius:{...Mh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Mh,borderTopRightRadius:Mh,borderBottomLeftRadius:Mh,borderBottomRightRadius:Mh,boxShadow:mge};function vge(t,e,r){const n=La(t)?t:fp(t);return n.start(IA("",n,e,r)),n.animation}const _ge=(t,e)=>t.depth-e.depth;class bge{constructor(){this.children=[],this.isDirty=!1}add(e){aA(this.children,e),this.isDirty=!0}remove(e){iA(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(_ge),this.isDirty=!1,this.children.forEach(e)}}function kge(t,e){const r=di.now(),n=({timestamp:a})=>{const i=a-r;i>=e&&(au(n),t(i-e))};return wn.setup(n,!0),()=>au(n)}const jz=["TopLeft","TopRight","BottomLeft","BottomRight"],wge=jz.length,zj=t=>typeof t=="string"?parseFloat(t):t,$j=t=>typeof t=="number"||Jt.test(t);function Sge(t,e,r,n,a,i){a?(t.opacity=En(0,r.opacity??1,Ege(n)),t.opacityExit=En(e.opacity??1,0,Tge(n))):i&&(t.opacity=En(e.opacity??1,r.opacity??1,n));for(let o=0;o<wge;o++){const c=`border${jz[o]}Radius`;let u=Vj(e,c),d=Vj(r,c);if(u===void 0&&d===void 0)continue;u||(u=0),d||(d=0),u===0||d===0||$j(u)===$j(d)?(t[c]=Math.max(En(zj(u),zj(d),n),0),(zo.test(d)||zo.test(u))&&(t[c]+="%")):t[c]=d}(e.rotate||r.rotate)&&(t.rotate=En(e.rotate||0,r.rotate||0,n))}function Vj(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Ege=Lz(0,.5,E4),Tge=Lz(.5,.95,hs);function Lz(t,e,r){return n=>n<t?0:n>e?1:r(Km(t,e,n))}function Hj(t,e){t.min=e.min,t.max=e.max}function ts(t,e){Hj(t.x,e.x),Hj(t.y,e.y)}function Gj(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Wj(t,e,r,n,a){return t-=e,t=_b(t,1/r,n),a!==void 0&&(t=_b(t,1/a,n)),t}function Cge(t,e=0,r=1,n=.5,a,i=t,o=t){if(zo.test(e)&&(e=parseFloat(e),e=En(o.min,o.max,e/100)-o.min),typeof e!="number")return;let c=En(i.min,i.max,n);t===i&&(c-=e),t.min=Wj(t.min,e,r,c,a),t.max=Wj(t.max,e,r,c,a)}function Kj(t,e,[r,n,a],i,o){Cge(t,e[r],e[n],e[a],e.scale,i,o)}const xge=["x","scaleX","originX"],Pge=["y","scaleY","originY"];function Yj(t,e,r,n){Kj(t.x,e,xge,r?r.x:void 0,n?n.x:void 0),Kj(t.y,e,Pge,r?r.y:void 0,n?n.y:void 0)}function Xj(t){return t.translate===0&&t.scale===1}function Bz(t){return Xj(t.x)&&Xj(t.y)}function Jj(t,e){return t.min===e.min&&t.max===e.max}function Age(t,e){return Jj(t.x,e.x)&&Jj(t.y,e.y)}function Qj(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Uz(t,e){return Qj(t.x,e.x)&&Qj(t.y,e.y)}function Zj(t){return Ga(t.x)/Ga(t.y)}function eL(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Rge{constructor(){this.members=[]}add(e){aA(this.members,e),e.scheduleRender()}remove(e){if(iA(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(e){const r=this.members.findIndex(a=>e===a);if(r===0)return!1;let n;for(let a=r;a>=0;a--){const i=this.members[a];if(i.isPresent!==!1){n=i;break}}return n?(this.promote(n),!0):!1}promote(e,r){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,r&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:a}=e.options;a===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:r,resumingFrom:n}=e;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Dge(t,e,r){let n="";const a=t.x.translate/e.x,i=t.y.translate/e.y,o=r?.z||0;if((a||i||o)&&(n=`translate3d(${a}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(n+=`scale(${1/e.x}, ${1/e.y}) `),r){const{transformPerspective:d,rotate:f,rotateX:h,rotateY:m,skewX:_,skewY:w}=r;d&&(n=`perspective(${d}px) ${n}`),f&&(n+=`rotate(${f}deg) `),h&&(n+=`rotateX(${h}deg) `),m&&(n+=`rotateY(${m}deg) `),_&&(n+=`skewX(${_}deg) `),w&&(n+=`skewY(${w}deg) `)}const c=t.x.scale*e.x,u=t.y.scale*e.y;return(c!==1||u!==1)&&(n+=`scale(${c}, ${u})`),n||"none"}const RE=["","X","Y","Z"],Oge=1e3;let Nge=0;function DE(t,e,r,n){const{latestValues:a}=e;a[t]&&(r[t]=a[t],e.setStaticValue(t,0),n&&(n[t]=0))}function Fz(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const r=Tz(e);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:a,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",wn,!(a||i))}const{parent:n}=t;n&&!n.hasCheckedOptimisedAppear&&Fz(n)}function qz({attachResizeListener:t,defaultParent:e,measureScroll:r,checkIsScrollRoot:n,resetTransform:a}){return class{constructor(o={},c=e?.()){this.id=Nge++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(jge),this.nodes.forEach(Fge),this.nodes.forEach(qge),this.nodes.forEach(Lge)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new bge)}addEventListener(o,c){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new cA),this.eventHandlers.get(o).add(c)}notifyListeners(o,...c){const u=this.eventHandlers.get(o);u&&u.notify(...c)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=rz(o)&&!Ahe(o),this.instance=o;const{layoutId:c,layout:u,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||c)&&(this.isLayoutDirty=!0),t){let f,h=0;const m=()=>this.root.updateBlockedByResize=!1;wn.read(()=>{h=window.innerWidth}),t(o,()=>{const _=window.innerWidth;_!==h&&(h=_,this.root.updateBlockedByResize=!0,f&&f(),f=kge(m,250),__.hasAnimatedSinceResize&&(__.hasAnimatedSinceResize=!1,this.nodes.forEach(nL)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&d&&(c||u)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:h,hasRelativeLayoutChanged:m,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||d.getDefaultTransition()||Gge,{onLayoutAnimationStart:b,onLayoutAnimationComplete:E}=d.getProps(),T=!this.targetLayout||!Uz(this.targetLayout,_),R=!h&&m;if(this.options.layoutRoot||this.resumeFrom||R||h&&(T||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const P={...kA(w,"layout"),onPlay:b,onComplete:E};(d.shouldReduceMotion||this.options.layoutRoot)&&(P.delay=0,P.type=!1),this.startAnimation(P),this.setAnimationOrigin(f,R)}else h||nL(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),au(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(zge),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Fz(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let f=0;f<this.path.length;f++){const h=this.path[f];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:c,layout:u}=this.options;if(c===void 0&&!u)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(tL);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(rL);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Uge),this.nodes.forEach(Ige),this.nodes.forEach(Mge)):this.nodes.forEach(rL),this.clearAllSnapshots();const c=di.now();wa.delta=Vc(0,1e3/60,c-wa.timestamp),wa.timestamp=c,wa.isProcessing=!0,_E.update.process(wa),_E.preRender.process(wa),_E.render.process(wa),wa.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,SA.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Bge),this.sharedNodes.forEach($ge)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,wn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){wn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ga(this.snapshot.measuredBox.x)&&!Ga(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=jn(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(c=!1),c&&this.instance){const u=n(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:u,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!a)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!Bz(this.projectionDelta),u=this.getTransformTemplate(),d=u?u(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;o&&this.instance&&(c||Hu(this.latestValues)||f)&&(a(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const c=this.measurePageBox();let u=this.removeElementScroll(c);return o&&(u=this.removeTransform(u)),Wge(u),{animationId:this.root.animationId,measuredBox:c,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return jn();const c=o.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Kge))){const{scroll:d}=this.root;d&&(Af(c.x,d.offset.x),Af(c.y,d.offset.y))}return c}removeElementScroll(o){const c=jn();if(ts(c,o),this.scroll?.wasRoot)return c;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:f,options:h}=d;d!==this.root&&f&&h.layoutScroll&&(f.wasRoot&&ts(c,o),Af(c.x,f.offset.x),Af(c.y,f.offset.y))}return c}applyTransform(o,c=!1){const u=jn();ts(u,o);for(let d=0;d<this.path.length;d++){const f=this.path[d];!c&&f.options.layoutScroll&&f.scroll&&f!==f.root&&Rf(u,{x:-f.scroll.offset.x,y:-f.scroll.offset.y}),Hu(f.latestValues)&&Rf(u,f.latestValues)}return Hu(this.latestValues)&&Rf(u,this.latestValues),u}removeTransform(o){const c=jn();ts(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];if(!d.instance||!Hu(d.latestValues))continue;qC(d.latestValues)&&d.updateSnapshot();const f=jn(),h=d.measurePageBox();ts(f,h),Yj(c,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,f)}return Hu(this.latestValues)&&Yj(c,this.latestValues),c}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==wa.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(o||u&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:f,layoutId:h}=this.options;if(!(!this.layout||!(f||h))){if(this.resolvedRelativeTargetAt=wa.timestamp,!this.targetDelta&&!this.relativeTarget){const m=this.getClosestProjectingParent();m&&m.layout&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=jn(),this.relativeTargetOrigin=jn(),km(this.relativeTargetOrigin,this.layout.layoutBox,m.layout.layoutBox),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=jn(),this.targetWithTransforms=jn()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),ege(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ts(this.target,this.layout.layoutBox),_z(this.target,this.targetDelta)):ts(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const m=this.getClosestProjectingParent();m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?(this.relativeParent=m,this.forceRelativeParentToResolveTarget(),this.relativeTarget=jn(),this.relativeTargetOrigin=jn(),km(this.relativeTargetOrigin,this.target,m.target),ts(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||qC(this.parent.latestValues)||vz(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){const o=this.getLead(),c=!!this.resumingFrom||this!==o;let u=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===wa.timestamp&&(u=!1),u)return;const{layout:d,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||f))return;ts(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,m=this.treeScale.y;pme(this.layoutCorrected,this.treeScale,this.path,c),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=jn());const{target:_}=o;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Gj(this.prevProjectionDelta.x,this.projectionDelta.x),Gj(this.prevProjectionDelta.y,this.projectionDelta.y)),bm(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==m||!eL(this.projectionDelta.x,this.prevProjectionDelta.x)||!eL(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",_))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.visualElement?.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Df(),this.projectionDelta=Df(),this.projectionDeltaWithTransform=Df()}setAnimationOrigin(o,c=!1){const u=this.snapshot,d=u?u.latestValues:{},f={...this.latestValues},h=Df();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const m=jn(),_=u?u.source:void 0,w=this.layout?this.layout.source:void 0,b=_!==w,E=this.getStack(),T=!E||E.members.length<=1,R=!!(b&&!T&&this.options.crossfade===!0&&!this.path.some(Hge));this.animationProgress=0;let P;this.mixTargetDelta=A=>{const C=A/1e3;aL(h.x,o.x,C),aL(h.y,o.y,C),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(km(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Vge(this.relativeTarget,this.relativeTargetOrigin,m,C),P&&Age(this.relativeTarget,P)&&(this.isProjectionDirty=!1),P||(P=jn()),ts(P,this.relativeTarget)),b&&(this.animationValues=f,Sge(f,d,this.latestValues,C,R,T)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=C},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(au(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=wn.update(()=>{__.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=fp(0)),this.currentAnimation=vge(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:c=>{this.mixTargetDelta(c),o.onUpdate&&o.onUpdate(c)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(Oge),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:c,target:u,layout:d,latestValues:f}=o;if(!(!c||!u||!d)){if(this!==o&&this.layout&&d&&zz(this.options.animationType,this.layout.layoutBox,d.layoutBox)){u=this.target||jn();const h=Ga(this.layout.layoutBox.x);u.x.min=o.target.x.min,u.x.max=u.x.min+h;const m=Ga(this.layout.layoutBox.y);u.y.min=o.target.y.min,u.y.max=u.y.min+m}ts(c,u),Rf(c,f),bm(this.projectionDeltaWithTransform,this.layoutCorrected,c,f)}}registerSharedNode(o,c){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Rge),this.sharedNodes.get(o).add(c);const d=c.options.initialPromotionConfig;c.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(c):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){const{layoutId:o}=this.options;return o?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:o}=this.options;return o?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:c,preserveFollowOpacity:u}={}){const d=this.getStack();d&&d.promote(this,u),o&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let c=!1;const{latestValues:u}=o;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(c=!0),!c)return;const d={};u.z&&DE("z",o,d,this.animationValues);for(let f=0;f<RE.length;f++)DE(`rotate${RE[f]}`,o,d,this.animationValues),DE(`skew${RE[f]}`,o,d,this.animationValues);o.render();for(const f in d)o.setStaticValue(f,d[f]),this.animationValues&&(this.animationValues[f]=d[f]);o.scheduleRender()}applyProjectionStyles(o,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=v_(c?.pointerEvents)||"",o.transform=u?u(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=v_(c?.pointerEvents)||""),this.hasProjected&&!Hu(this.latestValues)&&(o.transform=u?u({},""):"none",this.hasProjected=!1);return}o.visibility="";const f=d.animationValues||d.latestValues;this.applyTransformsToTarget();let h=Dge(this.projectionDeltaWithTransform,this.treeScale,f);u&&(h=u(f,h)),o.transform=h;const{x:m,y:_}=this.projectionDelta;o.transformOrigin=`${m.origin*100}% ${_.origin*100}% 0`,d.animationValues?o.opacity=d===this?f.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:f.opacityExit:o.opacity=d===this?f.opacity!==void 0?f.opacity:"":f.opacityExit!==void 0?f.opacityExit:0;for(const w in Qm){if(f[w]===void 0)continue;const{correct:b,applyTo:E,isCSSVariable:T}=Qm[w],R=h==="none"?f[w]:b(f[w],d);if(E){const P=E.length;for(let A=0;A<P;A++)o[E[A]]=R}else T?this.options.visualElement.renderState.vars[w]=R:o[w]=R}this.options.layoutId&&(o.pointerEvents=d===this?v_(c?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>o.currentAnimation?.stop()),this.root.nodes.forEach(tL),this.root.sharedNodes.clear()}}}function Ige(t){t.updateLayout()}function Mge(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:n}=t.layout,{animationType:a}=t.options,i=e.source!==t.layout.source;a==="size"?ns(f=>{const h=i?e.measuredBox[f]:e.layoutBox[f],m=Ga(h);h.min=r[f].min,h.max=h.min+m}):zz(a,e.layoutBox,r)&&ns(f=>{const h=i?e.measuredBox[f]:e.layoutBox[f],m=Ga(r[f]);h.max=h.min+m,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[f].max=t.relativeTarget[f].min+m)});const o=Df();bm(o,r,e.layoutBox);const c=Df();i?bm(c,t.applyTransform(n,!0),e.measuredBox):bm(c,r,e.layoutBox);const u=!Bz(o);let d=!1;if(!t.resumeFrom){const f=t.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:h,layout:m}=f;if(h&&m){const _=jn();km(_,e.layoutBox,h.layoutBox);const w=jn();km(w,r,m.layoutBox),Uz(_,w)||(d=!0),f.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=_,t.relativeParent=f)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:c,layoutDelta:o,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function jge(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Lge(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Bge(t){t.clearSnapshot()}function tL(t){t.clearMeasurements()}function rL(t){t.isLayoutDirty=!1}function Uge(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function nL(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function Fge(t){t.resolveTargetDelta()}function qge(t){t.calcProjection()}function zge(t){t.resetSkewAndRotation()}function $ge(t){t.removeLeadSnapshot()}function aL(t,e,r){t.translate=En(e.translate,0,r),t.scale=En(e.scale,1,r),t.origin=e.origin,t.originPoint=e.originPoint}function iL(t,e,r,n){t.min=En(e.min,r.min,n),t.max=En(e.max,r.max,n)}function Vge(t,e,r,n){iL(t.x,e.x,r.x,n),iL(t.y,e.y,r.y,n)}function Hge(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Gge={duration:.45,ease:[.4,0,.1,1]},sL=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),oL=sL("applewebkit/")&&!sL("chrome/")?Math.round:hs;function cL(t){t.min=oL(t.min),t.max=oL(t.max)}function Wge(t){cL(t.x),cL(t.y)}function zz(t,e,r){return t==="position"||t==="preserve-aspect"&&!Zme(Zj(e),Zj(r),.2)}function Kge(t){return t!==t.root&&t.scroll?.wasRoot}const Yge=qz({attachResizeListener:(t,e)=>Zm(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),OE={current:void 0},$z=qz({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!OE.current){const t=new Yge({});t.mount(window),t.setOptions({layoutScroll:!0}),OE.current=t}return OE.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Xge={pan:{Feature:hge},drag:{Feature:pge,ProjectionNode:$z,MeasureLayout:Mz}};function lL(t,e,r){const{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover",r==="Start");const a="onHover"+r,i=n[a];i&&wn.postRender(()=>i(e,Vg(e)))}class Jge extends gu{mount(){const{current:e}=this.node;e&&(this.unmount=Ehe(e,(r,n)=>(lL(this.node,n,"Start"),a=>lL(this.node,a,"End"))))}unmount(){}}class Qge extends gu{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=qg(Zm(this.node.current,"focus",()=>this.onFocus()),Zm(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function uL(t,e,r){const{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap",r==="Start");const a="onTap"+(r==="End"?"":r),i=n[a];i&&wn.postRender(()=>i(e,Vg(e)))}class Zge extends gu{mount(){const{current:e}=this.node;e&&(this.unmount=Phe(e,(r,n)=>(uL(this.node,n,"Start"),(a,{success:i})=>uL(this.node,a,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const WC=new WeakMap,NE=new WeakMap,eye=t=>{const e=WC.get(t.target);e&&e(t)},tye=t=>{t.forEach(eye)};function rye({root:t,...e}){const r=t||document;NE.has(r)||NE.set(r,{});const n=NE.get(r),a=JSON.stringify(e);return n[a]||(n[a]=new IntersectionObserver(tye,{root:t,...e})),n[a]}function nye(t,e,r){const n=rye(e);return WC.set(t,r),n.observe(t),()=>{WC.delete(t),n.unobserve(t)}}const aye={some:0,all:1};class iye extends gu{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:r,margin:n,amount:a="some",once:i}=e,o={root:r?r.current:void 0,rootMargin:n,threshold:typeof a=="number"?a:aye[a]},c=u=>{const{isIntersecting:d}=u;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:f,onViewportLeave:h}=this.node.getProps(),m=d?f:h;m&&m(u)};return nye(this.node.current,o,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:r}=this.node;["amount","margin","root"].some(sye(e,r))&&this.startObserver()}unmount(){}}function sye({viewport:t={}},{viewport:e={}}={}){return r=>t[r]!==e[r]}const oye={inView:{Feature:iye},tap:{Feature:Zge},focus:{Feature:Qge},hover:{Feature:Jge}},cye={layout:{ProjectionNode:$z,MeasureLayout:Mz}},lye={...Wme,...oye,...Xge,...cye},Ks=ume(lye,wme);function uye(){!NA.current&&kz();const[t]=v.useState(bb.current);return t}const Vz=[1,5,10,25,100];var b_=(t=>(t.FREE="FREE",t.PREMIUM="PREMIUM",t))(b_||{});const jSe={1:[0,0,-Math.PI/2],2:[0,0,Math.PI/2],3:[Math.PI,0,0],4:[0,0,0],5:[Math.PI/2,0,0],6:[-Math.PI/2,0,0]},Zh=t=>`$${t.toLocaleString(void 0,{maximumFractionDigits:0})}`;function Lc({value:t,onAdd:e,onClear:r,disabled:n,selectedTimes:a=0,style:i,mini:o=!1,className:c,hideValue:u=!1}){const d=a>0,h=["casino-chip",`chip--v${t>=5e3?5e3:t>=1e3?1e3:t>=500?500:t>=100?100:t>=25?25:t>=10?10:t>=5?5:1}`,n?"is-disabled":"",d?"is-selected":"",o?"chip-container--mini":"",c||""].filter(Boolean).join(" "),m=!!e&&!n;return g.jsxs("div",{style:i,className:"chip-container",children:[g.jsxs("button",{type:"button",className:h,onClick:m?()=>{e?.(t)}:void 0,disabled:!m,"aria-label":`Add ${Zh(Number(t))}`,title:`Add ${Zh(Number(t))}`,style:m?void 0:{pointerEvents:"none"},children:[!u&&g.jsx("span",{className:"chip__value",children:t>=1e3?`${(Number(t)/1e3).toLocaleString(void 0,{maximumFractionDigits:t>=1e4?0:1})}k`:t}),d&&m&&g.jsxs("span",{className:"chip__count",children:["×",a]})]}),d&&m&&!!r&&g.jsx("button",{type:"button",className:"chip-clear","aria-label":`Clear ${Zh(Number(t))} chip`,title:`Clear ${Zh(Number(t))} chip`,onClick:_=>{_.stopPropagation(),r(t)},children:"×"})]})}const dye=[500,100,25,10,5,1],IE=20;function MA(t){const e=[];let r=Math.max(1,Math.floor(t));for(const n of dye){for(;r>=n&&(e.push(n),r-=n,!(e.length>=IE)););if(e.length>=IE)break}return r>0&&e.length<IE&&e.push(r),e.length===0&&e.push(1),e}function fye({show:t,open:e,isBanker:r,meId:n,players:a,labelPrefix:i="Main Bet: "}){const o=v.useMemo(()=>e.filter(m=>m.type==="MAIN"),[e]),[c,u]=v.useState(!1),d=v.useMemo(()=>o?.filter(m=>r?!0:m.playerId===n||m.acceptedById===n),[o,r,n]),f=v.useMemo(()=>d.reduce((m,_)=>m+(_.amount||0),0),[d]),h=m=>a.find(_=>_.id===m)?.name||m;return g.jsxs(g.Fragment,{children:[g.jsx(Ks.div,{className:`betToken ${t?"open":""}`,initial:{opacity:0,scale:.8},animate:{opacity:t?1:0,scale:t?1:.8},transition:{type:"spring",stiffness:320,damping:26},children:g.jsx("a",{role:"button","aria-haspopup":"dialog","aria-expanded":c,onClick:()=>{u(!0)},title:"Show my bets",className:"gold-link",children:g.jsxs("span",{className:"betToken__amount",children:[i,Zh(f??0)]})})}),c&&g.jsxs("div",{className:"results-modal",role:"dialog","aria-modal":"true","aria-label":"Your bets",children:[g.jsx("div",{className:"results-modal__backdrop",onClick:()=>u(!1)}),g.jsxs("div",{className:"results-modal__card card",children:[g.jsxs("div",{className:"results-modal__header",children:[g.jsx("h3",{style:{margin:0},children:"Your Open Main Bets"}),g.jsx("button",{className:"btn btn--ghost",onClick:()=>u(!1),children:"Close"})]}),d.length===0?g.jsx("ul",{className:"betlist results-list",children:g.jsx("li",{className:"betitem",children:"No applicable bets."})}):g.jsx("ul",{className:"betlist results-list",children:d.map(m=>g.jsx("li",{className:"betitem",children:g.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[g.jsxs(g.Fragment,{children:[" ",MA(m.amount).map(_=>g.jsx(Lc,{mini:!0,value:_}))]}),g.jsxs("div",{className:"betitem__info",children:[g.jsxs("div",{className:"betitem__title",children:[h(m.playerId)," ",g.jsx("span",{className:"betSummary__dash",children:"—"})," BET"]}),g.jsxs("div",{className:"betitem__meta",children:["Amount: ",g.jsxs("strong",{children:["$",m.amount]}),m.acceptedById?` • matched by ${h(m.acceptedById)}`:" • (pending)"]})]})]})},m.id))})]})]})]})}function KC({busy:t=!1,label:e="Cancel Bet",disabled:r,...n}){const a=r||t;return g.jsxs("button",{type:"button",className:`cancel-btn ${t?"is-busy":""} ${a?"is-disabled":""}`,disabled:a,"aria-busy":t||void 0,"aria-label":e,"aria-live":"polite",...n,children:[g.jsx("span",{className:"cancel-btn__content",children:"X"}),t&&g.jsx("span",{className:"cancel-btn__spinner","aria-hidden":"true"})]})}function Hz({disabled:t,onClick:e,busy:r=!1,label:n="✓",mini:a=!1}){return g.jsx("button",{disabled:t||r,onClick:e,className:`place-bet-btn ${a?"place-bet-btn--mini":""} ${r?"busy":""}`,"aria-label":"Place Bet",children:r?"Placing...":n})}const pye={open:{opacity:1,y:0,x:0,transition:{type:"spring",stiffness:500,damping:30}},collapsed:{opacity:0,y:8,x:25,transition:{type:"spring",stiffness:420,damping:28,mass:.6}}};function k0({selectedTimes:t,onAdd:e,onClear:r,onPlaceBet:n,onCancelBet:a,disabled:i,collapsed:o=!1,collapseLabel:c="Placed bet",miniChips:u=!1,betTokenProps:{isBanker:d,meId:f,open:h,players:m,show:_,labelPrefix:w},hasBankRoll:b,betsLocked:E,myOpenMain:T,mainAmt:R,heading:P}){const A=Vz,C=uye(),O=v.useCallback(()=>{cr("Light")},[]),I=v.useRef(!1),x=!!E,D=!!b,N=!i&&!x&&!D&&!d&&!T,L=v.useCallback(()=>{I.current||!N||(I.current=!0,O(),n?.(),setTimeout(()=>{I.current=!1},600))},[N,n,O]),j=v.useCallback(U=>{if(!(i||x)){O();try{}catch{}e?.(U)}},[i,x,e,O]),q=v.useCallback(()=>{i||D||!T||(O(),a?.())},[i,D,T,a,O]);return g.jsxs("div",{className:"chipRackContainer",children:[g.jsxs("div",{className:`chipRack ${i?"chipRack--disabled":""} ${o?"chipRack--collapsed":"chipRack--open"}`,children:[g.jsx("div",{className:"chipRack__collapseTarget","aria-label":c}),g.jsx(Ks.div,{className:"chipRack__scroller",role:"listbox","aria-label":"Bet chips",initial:!1,style:{pointerEvents:i||x||o||T?"none":"auto"},children:A.map(U=>{const W=(t[U]??0)>0;return g.jsx(Ks.div,{role:"option","aria-selected":W,variants:C?void 0:pye,layout:!0,className:"chipRack__chipWrapper",children:g.jsx(Lc,{value:U,onAdd:j,onClear:r,disabled:!N,selectedTimes:t[U]??0,mini:u,"data-chip":U})},U)})})]}),g.jsxs("div",{className:"chipRack__placeWrap","aria-disabled":!N,style:{pointerEvents:N?"auto":"none"},"data-allowed":N?"true":"false",children:[g.jsx("div",{className:"chipRack__placeInner",children:g.jsx(Hz,{onClick:L,disabled:!N,mini:u})}),N&&g.jsx("div",{className:"chipRack__halo","aria-hidden":"true"})]}),g.jsx(Ks.div,{children:g.jsx(KC,{onClick:q,disabled:i||D||!T})}),g.jsx("div",{className:"chipRack__amount","aria-live":"polite","aria-atomic":"true",children:g.jsx(fye,{isBanker:d,meId:f,open:h,players:m,show:_,labelPrefix:w})})]})}function jA(t={1:0,5:0,10:0,25:0,100:0}){const[e,r]=v.useState(t),n=v.useMemo(()=>Vz.reduce((c,u)=>c+u*(e[u]??0),0),[e]),a=v.useCallback(c=>{r(u=>({...u,[c]:(u[c]??0)+1}))},[]),i=v.useCallback(c=>{r(u=>u[c]?{...u,[c]:0}:u)},[]),o=v.useCallback(()=>{r({1:0,5:0,10:0,25:0,100:0})},[]);return{rack:e,totalAmount:n,addChip:a,clearChip:i,clearAllChips:o}}const hye=""+new URL("roll-btn-web-wZ6ex-aH.webp",import.meta.url).href;function Gz({disabled:t,busy:e=!1,onClick:r,onPressStart:n,label:a="ROLL",className:i,"aria-label":o,useImage:c=!0,"data-testid":u}){const d=t||e,f=v.useRef(!1),h=v.useRef(null),m=v.useCallback(()=>{h.current&&(window.clearInterval(h.current),h.current=null)},[]),_=v.useCallback(()=>{d||f.current||(f.current=!0,Xr(),n?.(),m(),h.current=window.setInterval(()=>{n?.()},500))},[d,n,m]),w=v.useCallback(async()=>{if(m(),!!f.current){f.current=!1;try{const E=window;E.__rtcDiag||(E.__rtcDiag=[]),E.__rtcDiag.push({t:Date.now(),label:"ui:rollButtonClick"}),E.__dumpRtcDiag&&E.__dumpRtcDiag("ui:rollButtonClick")}catch{}r();try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await cd("Heavy")}},[r,m]),b=v.useCallback(async E=>{if(f.current){E.preventDefault();return}if(!d){n?.();try{const T=window;T.__rtcDiag||(T.__rtcDiag=[]),T.__rtcDiag.push({t:Date.now(),label:"ui:rollButtonClick"}),T.__dumpRtcDiag&&T.__dumpRtcDiag("ui:rollButtonClick")}catch{}r();try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await cd("Heavy")}},[d,r,n]);return g.jsx("div",{className:["roll-wrapper",i].filter(Boolean).join(" "),children:g.jsxs("button",{type:"button",className:["roll",c?"roll--image":"",d?"is-disabled":""].join(" "),onClick:b,onPointerDown:_,onPointerUp:w,disabled:d,"aria-label":o??(e?"Rolling dice":"Roll dice"),"aria-busy":e||void 0,"data-testid":u,children:[c&&g.jsx("img",{src:hye,alt:"",className:"roll__img",draggable:!1}),e&&g.jsx("span",{className:"roll__spinner","aria-hidden":"true"}),g.jsx("span",{className:"roll__halo","aria-hidden":"true"}),!c&&g.jsx("span",{className:"roll__gloss","aria-hidden":"true"}),!c&&g.jsx("span",{className:"roll__label","aria-live":"polite",children:e?"ROLLING…":a})]})})}function mye({roomId:t,meId:e,bankerId:r,players:n,className:a,hasBankRoll:i,gameState:o,gameplay:c}){const d=o?.gameMode==="cee-lo",{rack:f,totalAmount:h,addChip:m,clearChip:_}=jA(d?{1:0,5:0,10:0,25:1,100:0}:{1:0,5:0,10:1,25:0,100:0}),[w,b]=v.useState(!1),[E,T]=v.useState(!1),R=ou(),A=(o?.banker??r)===e,{open:C,settled:O,myOpenMain:I,placeMainBet:x,cancelMainBet:D}=y0(t,e),[N,L]=v.useState(!1);v.useEffect(()=>{I&&N&&L(!1)},[I,N]),v.useEffect(()=>{if(!N||I)return;const ce=setTimeout(()=>L(!1),5e3);return()=>clearTimeout(ce)},[N,I]);const j=!A&&!I&&!N,q=c?.handleRoll??(()=>{}),U=!!c?.canRoll;c?.lastRollerId;const W=c?.diceSettled??!0,F=o?.betsLocked??!1;o?.roundSeq;const Y=!!o?.bankRoll,Q=Y,[ie,G]=v.useState(!1),B=v.useRef(F),K=v.useRef(null);v.useEffect(()=>(B.current&&!F&&(G(!0),K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{G(!1),K.current=null},3e3)),F&&K.current&&(window.clearTimeout(K.current),K.current=null,G(!1)),B.current=F,()=>{K.current&&window.clearTimeout(K.current)}),[F]);const ae=v.useCallback(async()=>{try{Xr()}catch{}if(w)return;const ce=Math.floor(h);if(ce<=0){R.info("Tap chips to add a bet amount.");return}if(!Y){if(F||Q){R.info("Bets are closed.");return}if(o?.spectators?.includes(e)){R.info("Exit spectate to place a bet.");return}try{b(!0);const xe=await x(ce);if(!xe?.ok){R.error(xe?.error||"Bet rejected");return}L(!0)}catch{}finally{b(!1)}}},[w,h,i,F,Q,o,x]),te=v.useCallback(async()=>{try{Xr()}catch{}if(I)try{const ce=await D(I.id);ce.ok||R.error(ce.error||"Failed to cancel bet")}catch(ce){R.error(ce?.message??"Failed to cancel bet")}},[D,I,R]),ue=(o?.spectators??[]).includes(e),Ae=w||ue||Q||F||N,{triggerSpin:He}=Xo();return g.jsxs("div",{className:["betpanel",a].filter(Boolean).join(" "),children:[g.jsxs("section",{className:"betpanel__section",children:[g.jsx("div",{className:"betpanel__row",children:g.jsx(Gz,{disabled:!U||ue,busy:!W,onClick:q,onPressStart:He,"data-testid":"roll-button"})}),!A&&g.jsx("div",{className:"betpanel__row",children:g.jsx(k0,{mainAmt:h,selectedTimes:f,onAdd:m,onClear:_,onPlaceBet:ae,onCancelBet:te,disabled:Ae,collapsed:!j,betTokenProps:{isBanker:A,meId:e,open:C,players:n,show:!j},hasBankRoll:Y,betsLocked:F||ie,myOpenMain:I})})]}),E&&g.jsx(f4,{meId:e,items:O,onClose:()=>T(!1)})]})}function gye(t){if(!t||t.gameMode!=="craps")return{phase:"come-out",point:null,label:"Come Out"};const e=t.crapsPhase,r=t.crapsPoint??null;let n;e==="point"?n="point":e==="come-out"?n="come-out":e==="comeOut"?n=r!=null?"point":"come-out":r!=null?n="point":n="come-out";const a=n==="point"&&r!=null?`Point: ${r}`:"Come Out";return{phase:n,point:r,label:a}}function yye(t){const r=t.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),n=(r[0]?.[0]??"").toUpperCase(),a=(r[1]?.[0]??"").toUpperCase();return n+a||n||"?"}function Wz(t){if(!t||t.length!==3)return"nothing";const e=new Set(t);if(e.size===1)return"triple";const r=[...t].sort().join("");return r==="123"?"123":r==="456"?"456":e.size===2?"point":"nothing"}function wm(t,e){return Wz(t)}function ME(t,e,r,n,a){if(!t)return null;if(t===r)return a||null;for(let i=e.length-1;i>=0;i--){const o=e[i];if(o.playerId===t&&Array.isArray(o.result)&&o.result.length===3)return o.result}return null}function kb(t){if(!t||t.length!==3)return{score:0,label:"—",kind:"invalid"};const e=Wz(t);if(e==="456")return{score:1e4,label:"4-5-6 (Auto Win)",kind:e};if(e==="123")return{score:2e3,label:"1-2-3 (Auto Lose)",kind:e};if(e==="triple"){const r=t[0];return{score:8e3+r*100,label:`Triple ${r}s`,kind:e}}if(e==="point"){const r={};for(const a of t)r[a]=(r[a]||0)+1;let n;for(const[a,i]of Object.entries(r))if(i===1){n=Number(a);break}return n==null?{score:0,label:t.slice().sort().join("-"),kind:"nothing"}:{score:4e3+n*100,label:`Point ${n}`,kind:e,point:n}}return e==="nothing"?{score:0,label:t.slice().sort().join("-"),kind:e}:{score:0,label:t.slice().sort().join("-"),kind:e}}function vye({gameMode:t="cee-lo",gameState:e,className:r}){let n=null;if(t==="craps")n=gye(e).label;else{const i=e?.bankRoll,o=Array.isArray(i?.raw)?i.raw:Array.isArray(i)?i:null;o&&o.length===3&&(n=`Bank Roll — ${kb(o).label}`)}const a=!n;return g.jsx("div",{className:["table-meta",a?"table-meta--hidden":"",r].filter(Boolean).join(" "),"aria-live":a?void 0:"polite","aria-hidden":a||void 0,children:g.jsx("div",{className:"table-meta__content",children:n||" "})})}const _ye="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let jE=(t=21)=>{let e="",r=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=_ye[r[t]&63];return e};const bye="_panelRoot_1qeyt_1",kye="_crapsPlaceTile_1qeyt_80",wye="_mobileShow_1qeyt_101",Sye="_mobileHide_1qeyt_105",Eye="_spotBtn_1qeyt_132",Tye="_spotRow_1qeyt_145",Cye="_chip_1qeyt_152",xye="_actions_1qeyt_157",Pye="_actionBtn_1qeyt_161",Aye="_amountBadge_1qeyt_167",Rye="_badgeMinus_1qeyt_174",Dye="_crapsStatusBar_1qeyt_185",Oye="_crapsStatusText_1qeyt_191",Nye="_crapsHighlight_1qeyt_199",Iye="_crapsChipSelector_1qeyt_204",Mye="_crapsChip_1qeyt_204",jye="_crapsPlaceRow_1qeyt_216",Lye="_crapsBetTile_1qeyt_227",Bye="_crapsActionsBar_1qeyt_235",Uye="_crapsActionButton_1qeyt_239",Fye="_crapsActionButtonPrimary_1qeyt_244",qye="_crapsActionButtonSecondary_1qeyt_245",zye="_crapsMainBets_1qeyt_251",$ye="_disabled_1qeyt_321",Vye="_spotBtnTopRow_1qeyt_507",Hye="_lineWin_1qeyt_558",Gye="_lineLose_1qeyt_563",Wye="_linePush_1qeyt_568",Kye="_outcomeBadge_1qeyt_573",Yye="_locked_1qeyt_587",Xye="_amountBadgeDisabled_1qeyt_615",Jye="_lockIcon_1qeyt_621",Qye="_aggBadge_1qeyt_661",Zye="_chipsRow_1qeyt_692",eve="_chipSelected_1qeyt_747",tve="_rollBtn_1qeyt_877",rve="_rollIcon_1qeyt_884",nve="_clear_1qeyt_910",ave="_errorLive_1qeyt_927",ive="_tooltip_1qeyt_935",sve="_betInfoBtn_1qeyt_959",ove="_betInfoModalOverlay_1qeyt_987",cve="_betInfoModal_1qeyt_987",lve="_betInfoHeader_1qeyt_1021",uve="_betInfoClose_1qeyt_1037",dve="_betInfoContent_1qeyt_1058",fve="_betInfoItem_1qeyt_1066",pve="_shake_1qeyt_1159",hve="_attnHalo_1qeyt_1207",mve="_crapsAtsDivider_1qeyt_1346",gve="_crapsAtsLabel_1qeyt_1352",yve="_crapsIronCrossBtn_1qeyt_1372",vve="_crapsMinusBadge_1qeyt_1466",_ve="_crapsChipSelected_1qeyt_1600",bve="_crapsClearIcon_1qeyt_1708",kve="_particle_1qeyt_1742",wve="_particleContainer_1qeyt_1748",Sve="_floatingWinAmount_1qeyt_1798",Eve="_rollHaloActive_1qeyt_1858",ft={panelRoot:bye,crapsPlaceTile:kye,mobileShow:wye,mobileHide:Sye,spotBtn:Eye,spotRow:Tye,chip:Cye,actions:xye,actionBtn:Pye,amountBadge:Aye,badgeMinus:Rye,crapsStatusBar:Dye,crapsStatusText:Oye,crapsHighlight:Nye,crapsChipSelector:Iye,crapsChip:Mye,crapsPlaceRow:jye,crapsBetTile:Lye,crapsActionsBar:Bye,crapsActionButton:Uye,crapsActionButtonPrimary:Fye,crapsActionButtonSecondary:qye,crapsMainBets:zye,disabled:$ye,spotBtnTopRow:Vye,lineWin:Hye,lineLose:Gye,linePush:Wye,outcomeBadge:Kye,locked:Yye,amountBadgeDisabled:Xye,lockIcon:Jye,aggBadge:Qye,chipsRow:Zye,chipSelected:eve,rollBtn:tve,rollIcon:rve,clear:nve,errorLive:ave,tooltip:ive,betInfoBtn:sve,betInfoModalOverlay:ove,betInfoModal:cve,betInfoHeader:lve,betInfoClose:uve,betInfoContent:dve,betInfoItem:fve,shake:pve,attnHalo:hve,crapsAtsDivider:mve,crapsAtsLabel:gve,crapsIronCrossBtn:yve,crapsMinusBadge:vve,crapsChipSelected:_ve,crapsClearIcon:bve,particle:kve,particleContainer:wve,floatingWinAmount:Sve,rollHaloActive:Eve};/*!
 * Font Awesome Free 7.0.1 by @fontawesome - https://fontawesome.com
 * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
 * Copyright 2025 Fonticons, Inc.
 */var Tve={prefix:"fas",iconName:"dice-six",icon:[448,512,[9861],"f526","M0 96C0 60.7 28.7 32 64 32l320 0c35.3 0 64 28.7 64 64l0 320c0 35.3-28.7 64-64 64L64 480c-35.3 0-64-28.7-64-64L0 96zm160 64a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM128 288a32 32 0 1 0 0-64 32 32 0 1 0 0 64zm32 64a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM320 192a32 32 0 1 0 0-64 32 32 0 1 0 0 64zm32 64a32 32 0 1 0 -64 0 32 32 0 1 0 64 0zM320 384a32 32 0 1 0 0-64 32 32 0 1 0 0 64z"]},Cve={prefix:"fas",iconName:"circle-question",icon:[512,512,[62108,"question-circle"],"f059","M256 512a256 256 0 1 0 0-512 256 256 0 1 0 0 512zm0-336c-17.7 0-32 14.3-32 32 0 13.3-10.7 24-24 24s-24-10.7-24-24c0-44.2 35.8-80 80-80s80 35.8 80 80c0 47.2-36 67.2-56 74.5l0 3.8c0 13.3-10.7 24-24 24s-24-10.7-24-24l0-8.1c0-20.5 14.8-35.2 30.1-40.2 6.4-2.1 13.2-5.5 18.2-10.3 4.3-4.2 7.7-10 7.7-19.6 0-17.7-14.3-32-32-32zM224 368a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"]};const xve={pass:{title:"Pass Line",description:"Come-out wins 7/11, loses 2/3/12; point wins if repeated before 7. Pays 1:1."},dontPass:{title:"Don't Pass",description:"Come-out wins 2/3, loses 7/11, 12 pushes; after point, win if 7 before point. Pays 1:1."},come:{title:"Come Bet",description:"Like Pass but placed after point; next roll can establish its own point. Pays 1:1."},dontCome:{title:"Don't Come",description:"Mirror of Come but against shooter; 2/3 win, 7/11 lose, 12 push on first resolving roll. Pays 1:1."},oddsPass:{title:"Odds (Pass)",description:"True odds – 4/10 2:1, 5/9 3:2, 6/8 6:5. Pays on point hit (no house edge)."},oddsDontPass:{title:"Odds (Don't Pass)",description:"True odds inverse – 4/10 1:2, 5/9 2:3, 6/8 5:6. Pays if 7 before point."},place4:{title:"Place 4",description:"Active in point phase. Pays 9:5 if 4 rolls before 7 (principal stays)."},place5:{title:"Place 5",description:"Pays 7:5 if 5 rolls before 7."},place6:{title:"Place 6",description:"Pays 7:6 if 6 rolls before 7."},place8:{title:"Place 8",description:"Pays 7:6 if 8 rolls before 7."},place9:{title:"Place 9",description:"Pays 7:5 if 9 rolls before 7."},place10:{title:"Place 10",description:"Pays 9:5 if 10 rolls before 7."},field:{title:"Field",description:"One-roll bet: Wins 2,3,4,9,10,11,12 (12 often double). Loses 5,6,7,8."},big6:{title:"Big 6",description:"Even money if 6 rolls before 7 (same goal as place/line odds but lower value)."},big8:{title:"Big 8",description:"Even money if 8 rolls before 7."},atsSmall:{title:"ATS Small",description:"Wins when all of 2,3,4,5,6 are rolled before a 7. Pays 30:1."},atsTall:{title:"ATS Tall",description:"Wins when all of 8,9,10,11,12 are rolled before a 7. Pays 30:1."},atsAll:{title:"ATS All",description:"Wins when all numbers (2-6 and 8-12) are rolled before a 7. Pays 150:1."}};function Pve({open:t,onClose:e}){const r=v.useRef(null);if(v.useEffect(()=>{if(!t)return;const a=o=>{o.key==="Escape"&&e()},i=o=>{r.current&&!r.current.contains(o.target)&&e()};return document.addEventListener("keydown",a),document.addEventListener("mousedown",i),()=>{document.removeEventListener("keydown",a),document.removeEventListener("mousedown",i)}},[t,e]),!t)return null;const n=g.jsx("div",{className:ft.betInfoModalOverlay,role:"presentation",children:g.jsxs("div",{className:ft.betInfoModal,role:"dialog","aria-modal":"true","aria-label":"Craps Bet Guide",ref:r,children:[g.jsxs("div",{className:ft.betInfoHeader,children:[g.jsx("h3",{children:"Craps Bet Guide"}),g.jsx("button",{className:ft.betInfoClose,onClick:e,"aria-label":"Close",children:"✕"})]}),g.jsx("div",{className:ft.betInfoContent,children:Object.entries(xve).map(([a,{title:i,description:o}])=>g.jsxs("div",{className:ft.betInfoItem,children:[g.jsx("strong",{children:i}),g.jsx("p",{children:o})]},a))})]})});return Gc.createPortal(n,document.body)}const Ave="_atsProgressContainer_bok0p_3",Rve="_inline_bok0p_15",Dve="_atsSection_bok0p_25",Ove="_complete_bok0p_42",Nve="_justCompleted_bok0p_47",Ive="_atsSectionAll_bok0p_66",Mve="_atsSectionHeader_bok0p_75",jve="_atsSectionLabel_bok0p_84",Lve="_atsSectionCount_bok0p_97",Bve="_atsNumberRow_bok0p_107",Uve="_atsNumber_bok0p_107",Fve="_hit_bok0p_138",qve="_atsCompleteText_bok0p_160",zve="_atsLockedBadge_bok0p_181",Yr={atsProgressContainer:Ave,inline:Rve,atsSection:Dve,complete:Ove,justCompleted:Nve,atsSectionAll:Ive,atsSectionHeader:Mve,atsSectionLabel:jve,atsSectionCount:Lve,atsNumberRow:Bve,atsNumber:Uve,hit:Fve,atsCompleteText:qve,atsLockedBadge:zve},$ve=[2,3,4,5,6],Vve=[8,9,10,11,12];function Hve({hitNumbers:t,smallProgress:e,tallProgress:r,allProgress:n,betsLocked:a,lastCompletedCategory:i,inline:o=!1}){const c=h=>t.includes(h),u=e===5,d=r===5,f=n===10;return g.jsxs("div",{className:`${Yr.atsProgressContainer} ${o?Yr.inline:""}`,children:[g.jsxs("div",{className:`${Yr.atsSection} ${u?Yr.complete:""} ${i==="small"?Yr.justCompleted:""}`,children:[g.jsxs("div",{className:Yr.atsSectionHeader,children:[g.jsx("span",{className:Yr.atsSectionLabel,children:"SMALL"}),g.jsxs("span",{className:Yr.atsSectionCount,children:[e,"/5"]})]}),g.jsx("div",{className:Yr.atsNumberRow,children:$ve.map(h=>g.jsx("div",{className:`${Yr.atsNumber} ${c(h)?Yr.hit:""}`,"aria-label":`${h} ${c(h)?"hit":"not hit"}`,children:h},h))})]}),g.jsxs("div",{className:`${Yr.atsSection} ${Yr.atsSectionAll} ${f?Yr.complete:""} ${i==="all"?Yr.justCompleted:""}`,children:[g.jsxs("div",{className:Yr.atsSectionHeader,children:[g.jsx("span",{className:Yr.atsSectionLabel,children:"ALL"}),g.jsxs("span",{className:Yr.atsSectionCount,children:[n,"/10"]})]}),f&&g.jsx("div",{className:Yr.atsCompleteText,children:"🎉"}),a&&!f&&g.jsx("div",{className:Yr.atsLockedBadge,children:"LOCKED"})]}),g.jsxs("div",{className:`${Yr.atsSection} ${d?Yr.complete:""} ${i==="tall"?Yr.justCompleted:""}`,children:[g.jsxs("div",{className:Yr.atsSectionHeader,children:[g.jsx("span",{className:Yr.atsSectionLabel,children:"TALL"}),g.jsxs("span",{className:Yr.atsSectionCount,children:[r,"/5"]})]}),g.jsx("div",{className:Yr.atsNumberRow,children:Vve.map(h=>g.jsx("div",{className:`${Yr.atsNumber} ${c(h)?Yr.hit:""}`,"aria-label":`${h} ${c(h)?"hit":"not hit"}`,children:h},h))})]})]})}const xo={PROGRESS:"craps:ats_progress",SMALL_COMPLETE:"craps:ats_small_complete",TALL_COMPLETE:"craps:ats_tall_complete",ALL_COMPLETE:"craps:ats_all_complete",RESET:"craps:ats_reset"},LE={hitNumbers:[],smallProgress:0,tallProgress:0,allProgress:0,betsLocked:!1};function Gve(t){const e=ks(),[r,n]=v.useState(LE),[a,i]=v.useState(null);v.useEffect(()=>{if(!a)return;const c=setTimeout(()=>i(null),3e3);return()=>clearTimeout(c)},[a]),v.useEffect(()=>{if(!e||!t)return;const c=m=>{m.roomId===t&&n({hitNumbers:m.hitNumbers,smallProgress:m.smallProgress,tallProgress:m.tallProgress,allProgress:m.allProgress,betsLocked:m.betsLocked})},u=m=>{m.roomId===t&&i("small")},d=m=>{m.roomId===t&&i("tall")},f=m=>{m.roomId===t&&i("all")},h=m=>{m.roomId===t&&(n(LE),i(null))};return e.on(xo.PROGRESS,c),e.on(xo.SMALL_COMPLETE,u),e.on(xo.TALL_COMPLETE,d),e.on(xo.ALL_COMPLETE,f),e.on(xo.RESET,h),()=>{e.off(xo.PROGRESS,c),e.off(xo.SMALL_COMPLETE,u),e.off(xo.TALL_COMPLETE,d),e.off(xo.ALL_COMPLETE,f),e.off(xo.RESET,h)}},[e,t]);const o=v.useCallback(c=>r.hitNumbers.includes(c),[r.hitNumbers]);return{atsProgress:r,lastCompletedCategory:a,isNumberHit:o,reset:()=>n(LE)}}function Sa(t){return`z${t}`}function os(t,e){return t.filter(r=>r.type===e).reduce((r,n)=>r+n.amount,0)}function Wve(t,e){return t*e}function dL(t,e,r){const{phase:n,point:a,balance:i,pendingBets:o,minBet:c,maxBet:u,oddsMultiple:d,committedAddBack:f=0}=r,h=o.reduce((A,C)=>A+C.amount,0),m=os(o,t),_=h+e,w=i+f;if(_>w)return{ok:!1,reason:"Insufficient balance"};const b=t==="pass"||t==="dontPass",E=t==="come"||t==="dontCome",T=t==="oddsPass"||t==="oddsDontPass",R=t.startsWith("place");if(b){if(n!=="comeOut"&&a)return{ok:!1,reason:"Line bets locked after point"};if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`}}if(E){if(!a)return{ok:!1,reason:"Come bets only after point"};if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Sa(u)}`}}if(T){if(!a)return{ok:!1,reason:"Point required for odds"};const C=os(o,t==="oddsPass"?"pass":"dontPass");if(!C)return{ok:!1,reason:"Need line bet first"};const O=Wve(C,t==="oddsPass"?d.pass:d.dontPass);if(m+e>O)return{ok:!1,reason:`Max odds ${Sa(O)}`}}if(R){if(!a)return{ok:!1,reason:"Place bets only in point phase"};if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Sa(u)}`}}if(t==="field"||t==="big6"||t==="big8"){if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Sa(u)}`}}if(t==="atsSmall"||t==="atsTall"||t==="atsAll"){if(m===0&&e<c)return{ok:!1,reason:`Minimum ${Sa(c)}`};if(m+e>u)return{ok:!1,reason:`Max ${Sa(u)}`}}return{ok:!0}}const Kve=[{key:"pass",label:"Pass"},{key:"dontPass",label:"Don't Pass"},{key:"come",label:"Come"},{key:"dontCome",label:"Don't Come"},{key:"field",label:"Field"},{key:"big6",label:"Big 6"},{key:"big8",label:"Big 8"}],Yve=[{key:"atsSmall",label:"Small"},{key:"atsTall",label:"Tall"},{key:"atsAll",label:"All"}],Xve=[{key:"place4",label:"Place 4"},{key:"place5",label:"5"},{key:"place6",label:"6"},{key:"place8",label:"8"},{key:"place9",label:"9"},{key:"place10",label:"10"}];function Jve(t,e){const[r,n]=v.useState(25);return v.useEffect(()=>{if(t.length&&!t.includes(r)){const a=t[0];n(a);return}},[t,r]),{selectedChip:r,setSelectedChip:n}}function Qve(t){const{pendingBets:e,myPlayerPlaceTotal:r,myCommittedByType:n}=t;return v.useMemo(()=>typeof r=="number"&&r>0||["place4","place5","place6","place8","place9","place10"].some(i=>Number(n[i]||0)>0)?!0:e.some(i=>i.type.startsWith("place")&&i.amount>0),[r,e,n])}function Zve(t,e,r){const n=v.useRef(null);v.useEffect(()=>{e!==n.current&&(n.current=null)},[e]),v.useEffect(()=>{if(!t||!e||n.current===e)return;const a=r.current||document.querySelector(`.${ft.crapsPlaceRow}`),i=a?a.querySelector(`.${ft.crapsIronCrossBtn}`):document.querySelector(`.${ft.crapsIronCrossBtn}`);if(!i)return;const o=window.setTimeout(()=>{try{i.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}catch{}},50);return n.current=e,()=>window.clearTimeout(o)},[t,e,r])}function e_e(t,e){const r=v.useRef(null);v.useEffect(()=>{if(!t){r.current=null;return}if(r.current===t)return;const n=e.current||document.querySelector(`.${ft.crapsPlaceRow}`),a=n?n.querySelector(`.${ft.crapsAtsLabel}`):document.querySelector(`.${ft.crapsAtsLabel}`);if(!a)return;const i=window.setTimeout(()=>{try{a.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}catch{}},100);return r.current=t,()=>window.clearTimeout(i)},[t,e])}function t_e(t,e,r){const n=v.useRef(null);v.useEffect(()=>{if(!t||n.current===t)return;n.current=t;const a=window.setTimeout(()=>{const i=e.current||document.querySelector(`.${ft.crapsMainBets}`),o=r.current||document.querySelector(`.${ft.crapsPlaceRow}`),c=(u,d)=>{if(!u)return;const f=u.scrollWidth,h=u.clientWidth;f<=h||window.setTimeout(()=>{u.scrollTo({left:f,behavior:"smooth"}),window.setTimeout(()=>{u.scrollTo({left:0,behavior:"smooth"})},600)},d)};c(i,0),c(o,150)},500);return()=>window.clearTimeout(a)},[t,e,r])}function r_e(t){const{phase:e,point:r,balance:n,pendingBets:a,minBet:i,maxBet:o,oddsMultiple:c,myPlayerLineTotals:u,myPlayerPlaceTotal:d}=t;return v.useMemo(()=>{const f=(u?.pass??0)+(u?.dontPass??0)+(d??0),h=os(a,"pass")+os(a,"dontPass")+os(a,"place4")+os(a,"place5")+os(a,"place6")+os(a,"place8")+os(a,"place9")+os(a,"place10"),m=Math.max(0,h-f);return{phase:e,point:r,balance:n,pendingBets:a,minBet:i,maxBet:o,oddsMultiple:c,committedAddBack:f+m}},[e,r,n,a,i,o,c,u?.pass,u?.dontPass,d])}function n_e(t,e){return v.useCallback(r=>{const n=t.find(i=>i.type===r),a=Number(e[r]||0);return n?n.amount===a?a:Math.max(0,n.amount):Math.max(0,a)},[t,e])}function a_e(t,e,r){const n=v.useRef(new Map),a=5e3;v.useEffect(()=>{if(!t.length){n.current.clear();return}const i=Date.now();for(const u of t){const d=`${u.type}:${u.amount}`;n.current.has(d)||n.current.set(d,i)}const o=new Set(t.map(u=>`${u.type}:${u.amount}`));for(const u of n.current.keys())o.has(u)||n.current.delete(u);const c=t.filter(u=>{const d=Number(e[u.type]||0);if(u.amount===0&&d>0)return!0;if(u.amount===d)return!1;const f=`${u.type}:${u.amount}`,h=n.current.get(f)||i;return!(i-h>a)});c.length!==t.length&&r(c)},[t,e,r])}function i_e(t){const{recentSettlements:e,meId:r,myPlayerLineTotals:n}=t,a=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>(h.betType==="pass"||h.betType==="dontPass")&&h.playerId===r),f={};for(const h of d)(h.betType==="pass"?(n?.pass??0)>0:(n?.dontPass??0)>0)&&(f[h.betType]=h.outcome);return f},[e,r,n?.pass,n?.dontPass]),i=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>h.betType.startsWith("place")&&h.playerId===r),f={};for(const h of d)f[h.betType]=h.outcome;return f},[e,r]),o=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>h.betType==="field"&&h.playerId===r),f={};for(const h of d)f[h.betType]=h.outcome;return f},[e,r]),c=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>(h.betType==="big6"||h.betType==="big8")&&h.playerId===r),f={};for(const h of d)f[h.betType]=h.outcome;return f},[e,r]),u=v.useMemo(()=>{if(!e.length||!r)return{};const d=e.filter(h=>(h.betType==="come"||h.betType==="dontCome")&&h.playerId===r),f={};for(const h of d)f[h.betType]=h.outcome;return f},[e,r]);return{lineOutcomeMap:a,placeOutcomeMap:i,fieldOutcomeMap:o,bigOutcomeMap:c,comeOutcomeMap:u}}function s_e(t,e){v.useEffect(()=>{const r=document.querySelectorAll(t),n=[];return r.forEach(a=>{if(a.querySelector(`.${ft.particleContainer}`))return;const i=document.createElement("div");i.className=ft.particleContainer,a.appendChild(i);const o=()=>{const u=document.createElement("div");u.className=ft.particle;const d=Math.random()*100,f=(Math.random()-.5)*40,h=-(80+Math.random()*60),m=1.8+Math.random()*1,_=Math.random()*.3;u.style.setProperty("--start-x",`${d}%`),u.style.setProperty("--drift-x",`${f}px`),u.style.setProperty("--rise-y",`${h}px`),u.style.setProperty("--duration",`${m}s`),u.style.setProperty("--delay",`${_}s`),u.style.left="0",u.style.bottom="0",i.appendChild(u),window.setTimeout(()=>u.remove(),(m+_)*1e3)},c=window.setInterval(o,400+Math.random()*300);n.push(c),o(),window.setTimeout(o,150),window.setTimeout(o,300)}),()=>{n.forEach(a=>window.clearInterval(a)),r.forEach(a=>a.querySelector(`.${ft.particleContainer}`)?.remove())}},[t,e])}function o_e(t){const{recentSettlements:e,meId:r,winSelector:n,floatingClass:a}=t,i=v.useRef(new Set),o=v.useRef(0);v.useEffect(()=>{if(e.length===0&&o.current>0&&i.current.clear(),o.current=e.length,!e.length||!r)return;const u=e.map((f,h)=>({s:f,idx:h})).filter(({s:f})=>f.playerId===r&&f.outcome==="WIN"&&f.payout>0).filter(({s:f,idx:h})=>{const m=`${f.betType}|${f.amount}|${f.payout}|${h}`;return i.current.has(m)?!1:(i.current.add(m),!0)});if(!u.length)return;const d=window.setTimeout(()=>{const f={};u.forEach(({s:m})=>{f[m.betType]=m.payout}),document.querySelectorAll(n).forEach(m=>{const _=m.getAttribute("data-bet-type");if(!_)return;const w=f[_];if(!w)return;try{m.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})}catch{}const b=()=>{const E=m.getBoundingClientRect(),T=document.createElement("div");T.className=a,T.textContent=`+${Sa(w)}`,T.style.left=`${E.left+E.width/2}px`,T.style.top=`${E.top}px`,document.body.appendChild(T),window.setTimeout(()=>T.remove(),2500)};_.startsWith("place")?window.setTimeout(b,500):b()})},50);return()=>window.clearTimeout(d)},[e,r,n,a])}function c_e(t){const{roomId:e,balance:r,phase:n,point:a,shooterName:i,minBet:o,maxBet:c,oddsMultiple:u,chips:d,pendingBets:f,onChangeBets:h,onClearAll:m,disabled:_,onRoll:w,canRoll:b,myPlayerPlaceTotal:E,readyPlayers:T=[],meId:R,onBetDelta:P,onBetsBatch:A,showReadyButton:C,onReadyClick:O,readyStateLabel:I,readyButtonDisabled:x,recentSettlements:D=[],myPlayerLineTotals:N,othersTotals:L,myCommittedByType:j={}}=t,q=_,{selectedChip:U,setSelectedChip:W}=Jve(d),{atsProgress:F,lastCompletedCategory:Y}=Gve(e??null),[Q,ie]=v.useState(!1),[G,B]=v.useState(),[K,ae]=v.useState(),{info:te}=cP(),{triggerSpin:me}=Xo(),ue=v.useRef(!1),Ae=v.useRef(null),He=n==="comeOut"&&!a,ce=n==="point"&&!!a,xe=!1,re=v.useRef(null),H=v.useRef(null),he=Qve({pendingBets:f,myPlayerPlaceTotal:E,myCommittedByType:j}),Re=n==="point"&&!!a&&!he;Zve(Re,a,H),e_e(Y,H),t_e(e,re,H);const fe=v.useCallback(()=>{Ae.current&&(window.clearInterval(Ae.current),Ae.current=null)},[]),Ie=v.useCallback(()=>{ue.current||(ue.current=!0,Xr(),me(),fe(),Ae.current=window.setInterval(()=>{me()},500))},[me,fe]),ct=v.useCallback(()=>{if(fe(),!!ue.current){if(ue.current=!1,n==="point"&&!he)try{te("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}w?.()}},[n,he,te,w,fe]),$e=r_e({phase:n,point:a,balance:r,pendingBets:f,minBet:o,maxBet:c,oddsMultiple:u,myPlayerLineTotals:N,myPlayerPlaceTotal:E}),tt=n_e(f,j);a_e(f,j,h);const We=v.useMemo(()=>{const X=os(f,"pass")>0||os(f,"dontPass")>0,le=(N?.pass??0)>0||(N?.dontPass??0)>0,be=tt("pass")>0||tt("dontPass")>0;return X||le||be},[f,N?.pass,N?.dontPass,tt]),{lineOutcomeMap:it,placeOutcomeMap:Et,fieldOutcomeMap:Mt,bigOutcomeMap:_t,comeOutcomeMap:ge}=i_e({recentSettlements:D,meId:R,myPlayerLineTotals:N}),Be=v.useMemo(()=>`.${ft.spotBtn}[data-win-outcome="true"]`,[]),je=v.useMemo(()=>JSON.stringify({lineOutcomeMap:it,placeOutcomeMap:Et,fieldOutcomeMap:Mt,bigOutcomeMap:_t,comeOutcomeMap:ge}),[it,Et,Mt,_t,ge]);s_e(Be,je),o_e({recentSettlements:D,meId:R,winSelector:Be,floatingClass:ft.floatingWinAmount});const rt=v.useMemo(()=>{const X=new Set;for(const le of f){const be=Number(j[le.type]||0);le.amount!==be&&X.add(le.type)}return X},[f,j]),Ct=v.useRef(new Set);v.useEffect(()=>{const X=Ct.current,le=rt;for(const be of X)if(!le.has(be)){try{IG({volume:.03})}catch{}break}Ct.current=new Set(le)},[rt]);const jt=rt.size>0;v.useMemo(()=>rt.size>0,[rt]);const De=v.useCallback((X,le)=>{if(le===0)return;const be=f.find(se=>se.type===X);if(le>0){const se=le,{ok:Oe,reason:wt}=dL(X,se,$e);if(!Oe){if(B(wt),ae(X),wt==="Insufficient balance")try{te("Insufficient funds","Add chips to place this bet")}catch{}window.setTimeout(()=>ae(void 0),600);return}if(be)h(f.map(er=>er===be?{...er,amount:er.amount+se}:er));else{const er=Number(j[X]||0);h([...f,{id:jE(),type:X,amount:er+se}])}P?.(X,se);return}let z=be?.amount??0;if(!be){const se=Number(j[X]||0);if(se<=0)return;z=se}const ee=z+le;h(be?f.map(se=>se===be?{...se,amount:Math.max(0,ee)}:se):[...f,{id:jE(),type:X,amount:Math.max(0,ee)}]),P?.(X,le)},[f,h,o,j,$e,P,te]),nt=v.useCallback((X,le)=>{const be=X==="oddsPass",z=X==="oddsDontPass",ee=X==="atsSmall"||X==="atsTall"||X==="atsAll",se=X==="pass"||X==="dontPass"?ce:be?n!=="point"||!a||tt("pass")===0:z?n!=="point"||!a||tt("dontPass")===0:X.startsWith("place")||X==="come"||X==="dontCome"?!a:ee?n!=="comeOut"||F.betsLocked:!1,Oe=X==="pass"||X==="dontPass",wt=X==="come"||X==="dontCome",er=!X.startsWith("place"),Qt=Oe&&ce,Zt=Oe?it[X]:X==="field"?Mt[X]:X==="big6"||X==="big8"?_t[X]:wt?ge[X]:void 0,oa=Zt==="WIN"?ft.lineWin:Zt==="LOSE"?ft.lineLose:Zt==="PUSH"?ft.linePush:"",On=Oe&&He&&!We,Ye=[ft.spotBtn,ft.crapsBetTile,X.startsWith("place")?ft.crapsPlaceTile:"",se?ft.locked:"",K===X?ft.shake:"",oa,On?ft.attnHalo:"",X.startsWith("place")&&Re?ft.attnHalo:""],Yt=_||xe||jt,At=L&&typeof L[X]=="number"?L[X]:0,Rt=tt(X);if(er){const dn=[...Ye,ft.spotBtnTopRow,"gold-link",Yt?ft.disabled:""].filter(Boolean).join(" ");return g.jsxs(Ks.a,{role:"button",tabIndex:0,"aria-disabled":Yt||void 0,className:dn,"data-bet-type":X,"data-attn":On?"need-line":void 0,"data-has-bet":Rt>0?"true":"false","data-win-outcome":Zt==="WIN"?"true":"false","data-no-global-haptic":!0,"aria-label":`Place bet on ${le}, +${U}`,onClick:jr=>{jr.preventDefault(),!se&&!Yt&&(Xr(),cr("Light"),De(X,U))},onKeyDown:jr=>{(jr.key==="Enter"||jr.key===" ")&&!se&&!Yt&&(jr.preventDefault(),Xr(),cr("Light"),De(X,U))},whileTap:{scale:.94},children:[le,At>0&&g.jsx("div",{className:ft.aggBadge,"aria-label":`Others ${le} total ${Sa(At)}`,children:Sa(At)}),Rt>0&&g.jsxs("div",{className:ft.amountBadge+(Qt?" "+ft.amountBadgeDisabled:""),"aria-disabled":Qt||void 0,children:[!Qt&&g.jsx("span",{role:"button",tabIndex:0,className:[ft.badgeMinus,ft.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${le}`,onClick:jr=>{jr.stopPropagation(),Xr(),cr("Light"),De(X,-U)},onKeyDown:jr=>{(jr.key==="Enter"||jr.key===" ")&&(jr.preventDefault(),jr.stopPropagation(),Xr(),cr("Light"),De(X,-U))},children:"−"}),Sa(Rt),Qt&&g.jsx("span",{className:ft.lockIcon,"aria-hidden":"true",children:"🔒"}),Zt&&g.jsx("span",{className:ft.outcomeBadge,"aria-label":`Outcome ${Zt}`,children:Zt==="WIN"?"✓":Zt==="LOSE"?"✕":"⟳"})]}),K===X&&G&&g.jsx("div",{className:ft.tooltip,children:G})]},X)}const Dt=X.startsWith("place")?Et[X]:X==="field"?Mt[X]:X==="big6"||X==="big8"?_t[X]:void 0,Nn=Ye.filter(Boolean).join(" ");return g.jsxs(Ks.button,{type:"button",className:Nn,"data-bet-type":X,"data-attn":X.startsWith("place")&&Re?"need-places":void 0,"data-has-bet":Rt>0?"true":"false","data-win-outcome":Zt==="WIN"||Dt==="WIN"?"true":"false","aria-label":`Place bet on ${le}, +${U}`,onClick:()=>{!se&&!Yt&&(Xr(),cr("Light"),De(X,U))},disabled:_||xe||jt,whileTap:{scale:.94},children:[le,At>0&&g.jsx("div",{className:ft.aggBadge,"aria-label":`Others ${le} total ${Sa(At)}`,children:Sa(At)}),Rt>0&&g.jsxs("div",{className:ft.amountBadge+(Qt?" "+ft.amountBadgeDisabled:""),"aria-disabled":Qt||void 0,children:[!Qt&&g.jsx("span",{role:"button",tabIndex:0,className:[ft.badgeMinus,ft.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${le}`,onClick:dn=>{dn.stopPropagation(),Xr(),cr("Light"),De(X,-U)},onKeyDown:dn=>{(dn.key==="Enter"||dn.key===" ")&&(dn.preventDefault(),dn.stopPropagation(),Xr(),cr("Light"),De(X,-U))},children:"−"}),Sa(Rt),Qt&&g.jsx("span",{className:ft.lockIcon,"aria-hidden":"true",children:"🔒"}),Zt&&g.jsx("span",{className:ft.outcomeBadge,"aria-label":`Outcome ${Zt}`,children:Zt==="WIN"?"✓":Zt==="LOSE"?"✕":"⟳"})]}),K===X&&G&&g.jsx("div",{className:ft.tooltip,children:G})]},X)},[De,_,xe,tt,G,K,He,We,Re,U,ce,n,a,it,Et,Mt,_t,ge,L,jt,F.betsLocked]),at=v.useMemo(()=>{const X=[...Kve],le=(be,z,ee)=>{const se=X.findIndex(Oe=>Oe.key===be);se>=0&&!X.some(Oe=>Oe.key===z)&&X.splice(se+1,0,{key:z,label:ee})};return le("pass","oddsPass","Odds Pass"),le("dontPass","oddsDontPass","Odds Don't"),X},[]),we=v.useMemo(()=>at.map(X=>nt(X.key,X.label)),[at,nt]),st=v.useMemo(()=>Xve.map(X=>nt(X.key,X.label)),[nt]),bt=v.useMemo(()=>Yve.map(X=>nt(X.key,X.label)),[nt]),nr=v.useCallback(()=>{if(_||xe||jt)return;Xr(),cr("Light");const X=["place4","place5","place6","place8","place9","place10"],le=[];for(const z of X){f.find(wt=>wt.type===z);const ee=U,{ok:se,reason:Oe}=dL(z,ee,$e);if(!se){if(B(Oe),ae(z),Oe==="Insufficient balance")try{te("Insufficient funds","Add chips to place All Places bet")}catch{}window.setTimeout(()=>ae(void 0),600);return}le.push({type:z,delta:ee})}let be=[...f];for(const{type:z,delta:ee}of le){const se=be.find(Oe=>Oe.type===z);if(se)be=be.map(Oe=>Oe===se?{...Oe,amount:Oe.amount+ee}:Oe);else{const Oe=Number(j[z]||0);be.push({id:jE(),type:z,amount:Oe+ee})}}h(be),A?A(le.map(({type:z,delta:ee})=>({type:z,amount:ee}))):P&&le.forEach(({type:z,delta:ee})=>P(z,ee))},[_,xe,f,U,o,$e,h,j,A,P,te,jt]),ur=!!C,dr=ur?I||"Ready":"Roll",Sr=ur?!!x:q||b===!1,un=!ur&&!Sr&&b!==!1&&(n!=="point"||he),Z=i;return g.jsxs("div",{className:[ft.panelRoot,_?ft.disabled:""].join(" "),children:[g.jsxs("div",{className:ft.crapsStatusBar,children:[g.jsxs("span",{className:ft.crapsStatusText,children:[g.jsx("span",{className:ft.mobileHide,children:n==="comeOut"?"COME-OUT":"POINT"}),g.jsx("span",{className:ft.mobileShow,children:n==="comeOut"?"CO":"PT"})," • ",g.jsx("span",{className:ft.mobileHide,children:"SHOOTER: "}),g.jsx("strong",{className:ft.crapsHighlight,children:Z})," • ",g.jsx("span",{className:ft.mobileHide,children:"POINT: "}),g.jsx("span",{className:ft.mobileShow,children:"P: "}),g.jsx("strong",{className:ft.crapsHighlight,children:a??"—"})]}),g.jsx("button",{type:"button",className:ft.betInfoBtn,onClick:()=>{cr("Light"),ie(!0)},"aria-label":"Show bet information",children:g.jsx(Il,{icon:Cve})})]}),g.jsx(Pve,{open:Q,onClose:()=>ie(!1)}),g.jsx("div",{className:[ft.spotRow,ft.crapsMainBets].join(" "),ref:re,children:we}),g.jsxs("div",{className:ft.crapsPlaceRow,ref:H,children:[st,g.jsx("button",{type:"button",className:[ft.spotBtn,ft.crapsBetTile,ft.crapsIronCrossBtn].join(" "),onClick:nr,disabled:!a||_||xe||jt,"aria-label":"Place All Places (4/5/6/8/9/10)",children:"All Places"}),g.jsx("span",{className:ft.crapsAtsDivider,children:"|"}),g.jsx("span",{className:ft.crapsAtsLabel,children:"ATS"}),bt,g.jsx(Hve,{hitNumbers:F.hitNumbers,smallProgress:F.smallProgress,tallProgress:F.tallProgress,allProgress:F.allProgress,betsLocked:F.betsLocked,lastCompletedCategory:Y,inline:!0})]}),g.jsx("div",{className:ft.crapsChipSelector,children:g.jsx("div",{className:ft.chipsRow,children:d.map(X=>{const le=X===U;return g.jsx("button",{type:"button",className:[ft.chip,ft.crapsChip,le?ft.chipSelected+" "+ft.crapsChipSelected:""].join(" "),"aria-label":`Select chip ${X}`,onClick:()=>{Xr(),cF(),W(X)},children:X},X)})})}),g.jsx("div",{className:ft.crapsActionsBar,children:g.jsxs("div",{className:ft.actions,children:[g.jsxs("button",{type:"button",className:[ft.actionBtn,ft.rollBtn,ft.crapsActionButton,ft.crapsActionButtonPrimary,un?ft.rollHaloActive:""].join(" "),onClick:X=>{if(ur){if(x)return;try{Xr(),cr("Light")}catch{}O?.();return}if(ue.current){X.preventDefault();return}if(!Sr){Xr(),cr("Medium"),me();try{n==="point"&&!he&&te("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}w?.()}},onPointerDown:()=>{ur||Sr||(Ie(),cr("Medium"))},onPointerUp:()=>{ur||ct()},disabled:Sr,"aria-label":ur?"Mark ready":"Roll dice",children:[!ur&&g.jsx(Il,{icon:Tve,className:ft.rollIcon,"aria-hidden":"true"}),dr]}),g.jsxs("button",{type:"button",className:[ft.actionBtn,ft.clear,ft.crapsActionButton,ft.crapsActionButtonSecondary].join(" "),onClick:()=>{Xr(),cr("Light"),m()},"aria-label":"Clear all bets",children:[g.jsx("span",{className:ft.crapsClearIcon,"aria-hidden":"true",children:"✕"})," Clear All"]})]})}),g.jsx("div",{className:ft.errorLive,"aria-live":"polite",children:G||""})]})}function l_e(t,e){const{crapsGetState:r,crapsJoinOrder:n,crapsLeaveOrder:a,crapsSetOrder:i,crapsRoll:o,crapsResetShooter:c,crapsReady:u}=pa(),d=e?.enabled??!0;return{getState:f=>d&&t?r(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,joinOrder:f=>d&&t?n(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,leaveOrder:f=>d&&t?a(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,setOrder:(f,h)=>d&&t?i(t,f).then(m=>(h?.(m),m)).catch(m=>(h?.({ok:!1,error:m?.message||"ERR"}),{ok:!1,error:m?.message||"ERR"})):void 0,roll:f=>d&&t?o(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,resetShooter:f=>d&&t?c(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0,ready:f=>d&&t?u(t).then(h=>(f?.(h),h)).catch(h=>(f?.({ok:!1,error:h?.message||"ERR"}),{ok:!1,error:h?.message||"ERR"})):void 0}}let jh={},u_e=1;function Kz(t){const{roomId:e,myPlayerId:r,autoJoinOrder:n=!0,onRoll:a,onState:i}=t,{crapsReady:o}=pa(),c=(()=>{try{return Mi&&Mi()}catch{return null}})(),u=c?.room??null,d=c?.setRoom??(()=>{}),h=u?.gameState?.gameMode==="craps",m=l_e(e,{enabled:h}),_=v.useMemo(()=>{const ce=u?.gameState;return!ce||ce.gameMode!=="craps"?null:{point:ce.crapsPoint??null,currentRollerId:ce.currentRollerId??null,turnOrder:ce.turnOrder??[]}},[u?.gameState]),[w,b]=v.useState(null),[E,T]=v.useState([]),[R,P]=v.useState(!1),A=v.useRef(!1),[C,O]=v.useState([]),[I,x]=v.useState(null),[D,N]=v.useState([]),L=v.useRef(null),j=v.useRef(null),q=v.useRef(null),U=v.useRef(null),W=v.useRef(null),{triggerSpin:F}=Xo(),Y=v.useRef(null),Q=v.useRef(null),ie=2e3,G=v.useMemo(()=>!!(r&&_?.turnOrder.includes(r)),[r,_?.turnOrder]),B=v.useCallback(()=>{h&&m.getState?.()},[m,h]),K=v.useCallback(ce=>{!h||!e||A.current||(A.current=!0,m.joinOrder?.(xe=>{A.current=!1,ce?.(xe?.ok,xe?.data)}))},[m,e,h]),ae=v.useCallback(ce=>{!h||!e||A.current||(A.current=!0,m.leaveOrder?.(xe=>{A.current=!1,ce?.(xe?.ok,xe?.data)}))},[m,e,h]),te=v.useCallback((ce,xe)=>{!h||!e||A.current||(A.current=!0,m.setOrder?.(ce,re=>{A.current=!1,xe?.(re?.ok,re?.data)}))},[m,e,h]),me=v.useCallback(ce=>{if(!(!h||!e||A.current)){A.current=!0,P(!0),F();try{const xe=m.roll?.();xe&&typeof xe.then=="function"&&xe.then(re=>{const H=!!re?.ok,he=String(re?.error||"");if(A.current=!1,!H)try{const Re=/invalid_payload/i.test(he),fe=/no_room/i.test(he),Ie=/forbidden|unauthorized/i.test(he);if(Re||fe||Ie){Q.current&&(window.clearTimeout(Q.current),Q.current=null),P(!1),B(),ce?.(!1,re?.data);return}}catch{}try{Q.current&&(window.clearTimeout(Q.current),Q.current=null),Q.current=window.setTimeout(()=>{P(!1),Q.current=null},Math.max(ie,4e3))}catch{}ce?.(H,re?.data)}).catch(()=>{A.current=!1,P(!1);try{B()}catch{}ce?.(!1)})}catch{A.current=!1,P(!1),ce?.(!1)}}},[m,e,h]),ue=v.useCallback(ce=>{if(!(!h||!e||A.current)){A.current=!0;try{const xe=m.resetShooter?.();xe&&typeof xe.then=="function"&&xe.then(re=>{A.current=!1,ce?.(!!re?.ok,re?.data)}).catch(()=>{A.current=!1,ce?.(!1)})}catch{A.current=!1,ce?.(!1)}}},[m,e,h]),Ae=v.useRef(0);Ae.current===0&&(Ae.current=u_e++);const He=v.useMemo(()=>e?jh[e]?jh[e]===Ae.current:(jh[e]=Ae.current,!0):!1,[e]);return v.useEffect(()=>()=>{try{e&&jh[e]===Ae.current&&delete jh[e]}catch{}},[e]),Pa({onJoinedRoom:({room:ce})=>{if(He)try{if(!e||!ce||ce.id!==e)return;if(U.current){const xe=U.current.cb;U.current=null,(async()=>{try{const re=await o(e);xe?.(!!re?.ok,re?.data)}catch{xe?.(!1)}})()}}catch{}},onRejoinedRoom:({room:ce})=>{if(He)try{if(!e||!ce||ce.id!==e)return;if(U.current){const xe=U.current.cb;U.current=null,(async()=>{try{const re=await o(e);xe?.(!!re?.ok,re?.data)}catch{xe?.(!1)}})()}}catch{}},onCrapsState:ce=>{if(!He||!e||ce.roomId!==e)return;const xe=ce.state?.currentRollerId??ce.state?.currentShooterId??ce.state?.shooterId??null,re=ce.state?.turnOrder||ce.state?.shooterOrder||[],H=ce.state?.point??ce.state?.crapsPoint??null;try{d(he=>{if(!he||he.id!==e)return he;const Re=he.gameState||{},fe=H?"point":"come-out";return{...he,gameState:{...Re,gameMode:Re.gameMode||"craps",crapsPoint:H,currentRollerId:xe,turnOrder:re,crapsPhase:fe}}})}catch{}try{i?.({point:H,currentRollerId:xe,turnOrder:re})}catch{}n&&r&&!re.includes(r)&&K()},onCrapsPointSet:ce=>{if(He)try{if(!e||ce?.roomId!==e)return;const xe=ce?.point??ce?.crapsPoint??null;d(re=>{if(!re||re.id!==e)return re;const H={...re.gameState||{}};return xe!=null&&(H.crapsPoint=xe,H.crapsPhase="point"),{...re,gameState:H}})}catch{}},onCrapsRollResult:ce=>{if(!He||!e||ce?.roomId!==e)return;try{A.current=!1,P(!0),Y.current&&(window.clearTimeout(Y.current),Y.current=null),Y.current=window.setTimeout(()=>{P(!1),Y.current=null},ie),Q.current&&(window.clearTimeout(Q.current),Q.current=null)}catch{}let xe,re;if(Array.isArray(ce?.dice)?[xe,re]=ce.dice:(xe=ce?.d1,re=ce?.d2),typeof xe!="number"||typeof re!="number")return;const H=typeof ce.total=="number"?ce.total:xe+re,he=ce.currentRollerId??ce.currentShooterId??ce.shooterId??null,Re=ce.nextRollerId??ce.nextShooterId??ce.nextShooter??null,fe={roomId:ce.roomId,dice:[xe,re],total:H,point:ce.point??ce.crapsPoint??null,currentRollerId:he,nextRollerId:Re,events:Array.isArray(ce.events)?ce.events:[],resolutions:ce.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1}};b(fe),T(Ie=>{const ct=Date.now(),$e=30,tt=900;for(let Et=0;Et<Ie.length&&Et<5;Et++){const Mt=Ie[Et];if(Mt.dice[0]===fe.dice[0]&&Mt.dice[1]===fe.dice[1]&&ct-Mt.ts<tt)return Ie}const it=[{...fe,ts:ct,phase:fe.point?"point":"come-out"},...Ie];it.length>$e&&(it.length=$e);try{if(e){const Et={v:1,roomId:e,ts:ct,items:it};Pb(`craps-roll-history:${e}`,Et)}}catch{}return it});try{const Ie=Re||null;O(Ie?[Ie]:[]),x(null)}catch{}try{F()}catch{}try{(ce.gameState||ce.point!==void 0||ce.currentRollerId!==void 0||ce.nextRollerId!==void 0)&&d(Ie=>{if(!Ie||Ie.id!==e)return Ie;const $e={...Ie.gameState||{}};(ce.point!==void 0||ce.crapsPoint!==void 0)&&($e.crapsPoint=ce.point??ce.crapsPoint);const tt=Re??he;return tt!==void 0&&($e.currentRollerId=tt),(Array.isArray(ce.turnOrder)||Array.isArray(ce.shooterOrder))&&($e.turnOrder=ce.turnOrder||ce.shooterOrder),$e.gameMode||($e.gameMode="craps"),$e.crapsPhase=$e.crapsPoint?"point":"come-out",{...Ie,gameState:$e}})}catch{}a?.(fe)},onCrapsReadyUpdate:ce=>{if(He)try{const xe=Array.isArray(ce?.readyPlayers)?ce.readyPlayers:void 0,re=Array.isArray(ce?.requiredReadyPlayers)?ce.requiredReadyPlayers:void 0,H=ce&&Object.prototype.hasOwnProperty.call(ce,"deadline"),he=H?typeof ce.deadline=="number"?ce.deadline:null:void 0,Re=(fe,Ie)=>{if(!fe&&!Ie)return!0;if(!fe||!Ie||fe.length!==Ie.length)return!1;for(let ct=0;ct<fe.length;ct++)if(fe[ct]!==Ie[ct])return!1;return!0};xe&&(Re(L.current,xe)||(L.current=xe.slice(),O(xe))),re&&(Re(j.current,re)||(j.current=re.slice(),N(re))),H&&q.current!==he&&(q.current=he===void 0?q.current:he,x(he))}catch{}},onCrapsBetsUpdate:ce=>{if(He)try{const xe=ce?.snapshot||{};d(re=>{if(!re||re.id!==e)return re;const H={...re.gameState||{}};for(const he of Object.keys(xe))H[he]=xe[he];return H.gameMode||(H.gameMode="craps"),{...re,gameState:H}})}catch{}}}),v.useEffect(()=>{!e||!h||He&&B()},[e,h]),v.useEffect(()=>{try{const ce=u?.gameState;if(!ce||ce.gameMode!=="craps")return;const xe=ce.crapsReadiness;xe&&(Array.isArray(xe.readyPlayers)&&O(xe.readyPlayers),Array.isArray(xe.requiredReadyPlayers)&&N(xe.requiredReadyPlayers),Object.prototype.hasOwnProperty.call(xe,"deadline")&&x(typeof xe.deadline=="number"?xe.deadline:null))}catch{}},[u?.gameState]),v.useEffect(()=>{if(!h||!e||!He)return;let ce=0;const xe=500,re=()=>{try{const fe=Date.now();if(fe-ce<xe)return;ce=fe,B()}catch{}},H=()=>{document.visibilityState==="visible"&&re()},he=()=>{re()},Re=()=>{re()};return window.addEventListener("visibilitychange",H),window.addEventListener("focus",he),window.addEventListener("ad:complete",Re),()=>{window.removeEventListener("visibilitychange",H),window.removeEventListener("focus",he),window.removeEventListener("ad:complete",Re)}},[h,e,B,He]),v.useEffect(()=>{e&&(async()=>{try{const ce=await Yf(`craps-roll-history:${e}`);if(!ce)return;if(ce&&ce.v===1&&Array.isArray(ce.items)){if(typeof ce.ts=="number"&&Date.now()-ce.ts>72e5)return;const re=[];for(const H of ce.items)if(!(!H||!Array.isArray(H.dice)||H.dice.length!==2)&&!(typeof H.total!="number"||typeof H.ts!="number")&&(re.push({roomId:e,dice:[Number(H.dice[0]),Number(H.dice[1])],total:Number(H.total),point:typeof H.point=="number"?H.point:H.point??null,currentRollerId:H.currentRollerId??null,nextRollerId:H.nextRollerId??null,events:Array.isArray(H.events)?H.events.slice(0,8):[],resolutions:H.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1},ts:H.ts,phase:H.phase==="point"?"point":"come-out"}),re.length>=30))break;re.length&&T(re)}}catch{}})()},[e]),v.useEffect(()=>()=>{Y.current&&(window.clearTimeout(Y.current),Y.current=null),Q.current&&(window.clearTimeout(Q.current),Q.current=null),W.current&&(window.clearTimeout(W.current),W.current=null)},[]),{shooterState:_,lastRoll:w,rollHistory:E,rolling:R,inTurnOrder:G,joinOrder:K,leaveOrder:ae,setOrder:te,roll:me,resetShooter:ue,requestState:B,readyPlayers:C,readinessDeadline:I,requiredReadyPlayers:D,ready:ce=>{if(!e||!h)return;const xe=!!(u&&u.id===e);if(r&&!C.includes(r)&&O(re=>[...re,r]),I||x(Date.now()+5e3),!xe){U.current={cb:ce,at:Date.now()};try{W.current&&(window.clearTimeout(W.current),W.current=null),W.current=window.setTimeout(async()=>{try{if(!U.current)return;const re=await o(e),H=U.current?.cb;U.current=null,H?.(!!re?.ok,re?.data)}catch{const re=U.current?.cb;U.current=null,re?.(!1)}finally{W.current&&(window.clearTimeout(W.current),W.current=null)}},600)}catch{}return}(async()=>{try{const re=await o(e);if(!re?.ok){const H=String(re?.error||""),he=/forbidden|unauthorized/i.test(H),Re=/ready_failed/i.test(H);if(he||Re){try{B()}catch{}try{const fe=await o(e);ce?.(!!fe?.ok,fe?.data);return}catch{}}ce?.(!1);return}ce?.(!0,re?.data)}catch{try{setTimeout(async()=>{try{const re=await o(e);ce?.(!!re?.ok,re?.data)}catch{ce?.(!1)}},400)}catch{ce?.(!1)}}})()},iAmReady:!!(r&&C.includes(r)),clearRollHistory:()=>{T([]);try{e&&Xf(`craps-roll-history:${e}`)}catch{}}}}function d_e(t){const{roomId:e,userId:r,shooterState:n,roomGameState:a,pendingBets:i=[],myLineFromUnified:o,betsLastUpdated:c}=t;if(!e||!r)return!1;const u=a?.currentRollerId,d=n?.currentRollerId||null;if(!!!(r&&(u?u===r:d===r))||Array.isArray(i)&&i.some(E=>Number(E.amount)>0))return!1;let h;const m=a?.crapsPassBets,_=a?.crapsDontPassBets;if(Array.isArray(m)||Array.isArray(_))h=!!(m?.some(E=>E.playerId===r&&E.amount>0)||_?.some(E=>E.playerId===r&&E.amount>0));else if(typeof c=="number")if(c===0)h=!0;else{const E=Number(o?.pass||0),T=Number(o?.dontPass||0);h=E>0||T>0}else{const E=Number(o?.pass||0),T=Number(o?.dontPass||0);h=E>0||T>0}if(!h)return!1;const w=Array.isArray(n?.turnOrder)&&n.turnOrder.length?n.turnOrder:Array.isArray(a?.turnOrder)?a.turnOrder:[];return!!(r&&w.includes(r))}const BE=new Map,UE={pass:[],dontPass:[],odds:[],place:[],field:[],big:[],come:[],dontCome:[],ats:[],lastUpdated:0};function Yz(t){const{roomId:e,myPlayerId:r,autoListOnMount:n=!0,autoClearSettlementsMs:a=8e3}=t;ks();const{room:i,setRoom:o}=Mi(),[c,u]=v.useState(UE),d=v.useRef(UE),[f,h]=v.useState([]),[m,_]=v.useState(null),[w,b]=v.useState(null),[E,T]=v.useState(null),[R,P]=v.useState([]),[A,C]=v.useState([]),[O,I]=v.useState(null),x=v.useRef(null),D=v.useRef(!1),N=v.useRef(0),L=v.useRef(new Map),{crapsListBets:j,crapsAddBet:q,crapsRemoveBet:U,crapsClearBets:W,crapsSummarizeBets:F}=pa(),Y=v.useCallback(H=>{if(!e)return;const he=BE.get(e);if(he)return H&&he.then(fe=>H(fe)).catch(fe=>H({ok:!1,error:String(fe?.message||fe)})),he;const Re=j(e);return BE.set(e,Re),Re.finally(()=>{BE.delete(e)}),H&&Re.then(fe=>H(fe)).catch(fe=>H({ok:!1,error:String(fe?.message||fe)})),Re},[j,e]),Q=v.useCallback((H,he,Re)=>{if(!e)return;const fe=q(e,H,he);return Re&&fe.then(Ie=>Re(Ie)).catch(Ie=>Re({ok:!1,error:String(Ie?.message||Ie)})),fe},[q,e]),ie=v.useCallback((H,he,Re)=>{if(!e)return;const fe=U(e,H,he);return Re&&fe.then(Ie=>Re(Ie)).catch(Ie=>Re({ok:!1,error:String(Ie?.message||Ie)})),fe},[U,e]),G=v.useCallback(H=>{if(!e)return;const he=W(e);return H&&he.then(Re=>H(Re)).catch(Re=>H({ok:!1,error:String(Re?.message||Re)})),he},[W,e]),B=v.useCallback(H=>{if(!e)return;const he=F(e);return H&&he.then(Re=>H(Re)).catch(Re=>H({ok:!1,error:String(Re?.message||Re)})),he},[F,e]),K=e&&r?`crapsbets:${e}:${r}`:null,ae=1800*1e3,te=v.useCallback(async()=>{if(K)try{const H=await Yf(K);if(!H)return;const he=H.pass,Re=H.dontPass,fe=Array.isArray(H.place)?H.place:[],Ie=typeof H.ts=="number"?H.ts:void 0;if(Ie&&Date.now()-Ie>ae||!fe?.length&&!he&&!Re)return;u(ct=>{if(ct.lastUpdated!==0||ct.place.length+ct.pass.length+ct.dontPass.length>0)return ct;const $e={...ct};return he&&($e.pass=[{playerId:r,amount:he}]),Re&&($e.dontPass=[{playerId:r,amount:Re}]),fe?.length&&($e.place=fe.map(tt=>({playerId:r,point:tt.point,amount:tt.amount}))),$e.lastUpdated=Date.now(),d.current=$e,$e})}catch{}},[K,r]);v.useEffect(()=>{te()},[te]);const me=v.useCallback(async()=>{if(!(!K||!r||!e))try{const H=await Yf(K);if(!H)return;const he=Number(H.pass||0),Re=Number(H.dontPass||0),fe=Array.isArray(H.place)?H.place:[],Ie=Date.now();try{await Y()}catch{}const ct=Date.now()+1200;for(;(d.current.lastUpdated||0)<=Ie&&Date.now()<ct;)await new Promise(_t=>setTimeout(_t,120));if((d.current.lastUpdated||0)<=Ie)return;const $e=d.current,tt=($e.pass||[]).find(_t=>_t.playerId===r)?.amount||0,We=($e.dontPass||[]).find(_t=>_t.playerId===r)?.amount||0,it={};for(const _t of $e.place||[])_t.playerId===r&&(it[_t.point]=(it[_t.point]||0)+_t.amount);const Et=Math.max(0,he-tt),Mt=Math.max(0,Re-We);if(Et>0)try{await q(e,"pass",Et)}catch{}if(Mt>0)try{await q(e,"dontPass",Mt)}catch{}for(const _t of fe){const ge=Number(_t.point),Be=Number(_t.amount||0),je=Number(it[ge]||0),rt=Math.max(0,Be-je);if(rt>0)try{const Ct=`place${ge}`;await q(e,Ct,rt)}catch{}}}catch{}},[K,r,e,Y,c,q]),ue=v.useCallback(H=>{!H||typeof H!="object"||u(he=>{const Re={pass:Array.isArray(H.crapsPassBets)?H.crapsPassBets:he.pass,dontPass:Array.isArray(H.crapsDontPassBets)?H.crapsDontPassBets:he.dontPass,odds:Array.isArray(H.crapsOddsBets)?H.crapsOddsBets:he.odds,place:Array.isArray(H.crapsPlaceBets)?H.crapsPlaceBets:he.place,field:Array.isArray(H.crapsFieldBets)?H.crapsFieldBets:he.field,big:Array.isArray(H.crapsBigBets)?H.crapsBigBets:he.big,come:Array.isArray(H.crapsComeBets)?H.crapsComeBets:he.come,dontCome:Array.isArray(H.crapsDontComeBets)?H.crapsDontComeBets:he.dontCome,ats:Array.isArray(H.crapsAtsBets)?H.crapsAtsBets:he.ats,lastUpdated:Date.now()};return d.current=Re,Re})},[]),Ae=v.useCallback((H,he,Re)=>{if(!e||H!==e)return;h(he),N.current+=1;const fe={...Re||{},_seq:N.current};_(fe);try{o(ct=>{if(!ct||ct.id!==e)return ct;const $e={...ct.gameState||{}};return $e.lastCrapsSettlementsTs=Date.now(),$e.lastCrapsSettlements=he,{...ct,gameState:$e}})}catch{}const Ie=new Map;for(const ct of he)ct.outcome==="WIN"&&ct.playerId&&Ie.set(ct.playerId,(Ie.get(ct.playerId)||0)+1);for(const[ct,$e]of Ie){const tt=L.current.get(ct)||0,We=tt+$e;if(L.current.set(ct,We),tt>=6&&We>tt)pO(7,.55);else for(const it of[3,4,5,6])if(tt<it&&We>=it){pO(it,.55);break}}x.current&&clearTimeout(x.current),x.current=setTimeout(()=>h([]),a)},[e,o,a]);Pa({onCrapsRollResult:H=>{try{if(!e||H?.roomId!==e)return;const he=Array.isArray(H?.events)?H.events:[],Re=he.includes("crapsOut")||he.includes("CRAPS_OUT"),fe=he.includes("sevenOut")||he.includes("SEVEN_OUT");if((Re||fe)&&L.current.clear(),fe){u(Ie=>{if(!Ie.place.length)return Ie;const ct={...Ie,place:[],lastUpdated:Date.now()};return d.current=ct,ct});try{o(Ie=>{if(!Ie||Ie.id!==e)return Ie;const ct={...Ie.gameState||{}};return ct.crapsPlaceBets=[],{...Ie,gameState:ct}})}catch{}}}catch{}},onJoinedRoom:async({room:H})=>{try{if(H?.id&&H.id===e){try{await Y()}catch{}try{await me()}catch{}}}catch{}},onRejoinedRoom:async({room:H})=>{try{if(H?.id&&H.id===e){try{await Y()}catch{}try{await me()}catch{}}}catch{}},onCrapsReadyUpdate:H=>{try{if(Array.isArray(H?.readyPlayers)&&P(H.readyPlayers),Array.isArray(H?.requiredReadyPlayers)&&C(H.requiredReadyPlayers),H&&Object.prototype.hasOwnProperty.call(H,"deadline")){const he=typeof H.deadline=="number"?H.deadline:null;I(he)}}catch{}},onCrapsBetsUpdate:H=>{if(!e||H?.roomId!==e)return;const he=H?.snapshot;if(he){ue(he);try{o(Re=>{if(!Re||Re.id!==e)return Re;const fe={...Re.gameState||{}};for(const Ie of Object.keys(he))fe[Ie]=he[Ie];return fe.gameMode||(fe.gameMode="craps"),{...Re,gameState:fe}})}catch{}}K&&r&&(async()=>{try{const Re=(he?.crapsPassBets||[]).find($e=>$e.playerId===r)?.amount||0,fe=(he?.crapsDontPassBets||[]).find($e=>$e.playerId===r)?.amount||0,Ie=(he?.crapsPlaceBets||[]).filter($e=>$e.playerId===r).map($e=>({point:$e.point,amount:$e.amount})),ct={v:1,ts:Date.now(),pass:Re,dontPass:fe,place:Ie};Re||fe||Ie.length?await Pb(K,ct):await Xf(K)}catch{}})()},onCrapsBetResults:H=>{const he=Array.isArray(H?.settlements)?H.settlements:[];Ae(H?.roomId,he,H?.roll)},onCrapsPointSet:H=>{if(!e||H?.roomId!==e)return;const he=H.currentRollerId||H.nextRollerId||"unknown",Re=`ptSet:${H.point}:${Array.isArray(H.dice)?H.dice.join("-"):""}:${he}`;b({...H,_key:Re});try{o(fe=>{if(!fe||fe.id!==e)return fe;const Ie={...fe.gameState||{}};return Ie.gameMode=Ie.gameMode||"craps",Ie.crapsPoint=typeof H.point=="number"?H.point:H.point??null,Ie.crapsPhase=Ie.crapsPoint?"point":"come-out",H.currentRollerId!==void 0&&(Ie.currentRollerId=H.currentRollerId),Array.isArray(H.turnOrder)&&(Ie.turnOrder=H.turnOrder),{...fe,gameState:Ie}})}catch{}},onCrapsPointMade:H=>{if(!e||H?.roomId!==e)return;const he=H.currentRollerId||H.nextRollerId||"unknown",Re=`ptMade:${H.point}:${Array.isArray(H.dice)?H.dice.join("-"):""}:${he}`;T({...H,_key:Re});try{o(fe=>{if(!fe||fe.id!==e)return fe;const Ie={...fe.gameState||{}};return Ie.gameMode=Ie.gameMode||"craps",Ie.crapsPoint=null,Ie.crapsPhase="come-out",H.nextRollerId!==void 0&&(Ie.currentRollerId=H.nextRollerId),Array.isArray(H.turnOrder)&&(Ie.turnOrder=H.turnOrder),{...fe,gameState:Ie}})}catch{}}}),v.useEffect(()=>{if(!e){u(UE),D.current=!1,h([]),_(null);return}const H=i?.gameState;H&&(H.crapsPassBets||H.crapsDontPassBets)&&ue(H),n&&!D.current&&(D.current=!0,Y())},[e]),v.useEffect(()=>{if(!e)return;const H=async()=>{await new Promise(he=>setTimeout(he,300));try{await Y()}catch{}try{await me()}catch{}};return window.addEventListener("ad:complete",H),()=>{window.removeEventListener("ad:complete",H)}},[e,Y,me]),v.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]);const He=v.useMemo(()=>c.pass.reduce((H,he)=>H+he.amount,0),[c.pass]),ce=v.useMemo(()=>c.dontPass.reduce((H,he)=>H+he.amount,0),[c.dontPass]),xe=v.useMemo(()=>c.field.reduce((H,he)=>H+he.amount,0),[c.field]),re=v.useMemo(()=>r?{pass:c.pass.filter(H=>H.playerId===r).reduce((H,he)=>H+he.amount,0),dontPass:c.dontPass.filter(H=>H.playerId===r).reduce((H,he)=>H+he.amount,0)}:{pass:0,dontPass:0},[c.pass,c.dontPass,r]);return{betsState:c,recentSettlements:f,lastSettlementRoll:m,_persistKey:K,passTotal:He,dontPassTotal:ce,fieldTotal:xe,myLine:re,listBets:Y,addBet:Q,removeBet:ie,clearBets:G,summarize:B,clearRecentSettlements:()=>h([]),pointSetEvent:w,pointMadeEvent:E,readyPlayers:R,requiredReadyPlayers:A,readinessDeadline:O}}function f_e(){try{if(typeof window>"u")return!1;const t=window;return t.__E2E===!0||typeof t.location<"u"&&!!t.location.search&&t.location.search.includes("e2e=1")||typeof t.sessionStorage<"u"&&t.sessionStorage.getItem("e2e")==="1"}catch{return!1}}function kc(t,e){if(!Array.isArray(t)||!e)return 0;let r=0;for(const n of t)n.playerId===e&&(r+=Number(n.amount)||0);return r}function Lh(t,e){if(!Array.isArray(t)||!e)return 0;let r=0;for(const n of t)n.playerId!==e&&(r+=Number(n.amount)||0);return r}function ju(t,e,r){if(!Array.isArray(t)||!e)return 0;let n=0;for(const a of t)a.playerId===e&&r(a)&&(n+=Number(a.amount)||0);return n}function fL(t,e,r){if(!Array.isArray(t)||!e)return 0;let n=0;for(const a of t)a.playerId!==e&&r(a)&&(n+=Number(a.amount)||0);return n}function p_e(t,e){const r={};if(!Array.isArray(t)||!e)return r;for(const n of t){if(n.playerId!==e)continue;const a=Number(n.point);r[a]=(r[a]||0)+(Number(n.amount)||0)}return r}function df(t,e,r){if(!Array.isArray(t)||!e)return 0;let n=0;for(const a of t)a.playerId!==e&&Number(a.point)===r&&(n+=Number(a.amount)||0);return n}function h_e(t,e){const[r,n]=v.useState(t.point),[a,i]=v.useState(t.phase);return v.useEffect(()=>{e&&(n(t.point),i(t.phase))},[e,t.point,t.phase]),{displayPoint:r,displayPhase:a}}function m_e({balance:t,meId:e,readyPlayers:r}){const{user:n,meId:a}=$r(),{room:i,setRoom:o}=Mi(),c=i?.id??null,u=v.useMemo(()=>f_e(),[]),d=v.useMemo(()=>{if(a)return a;const Be=n;return Be?.id??Be?.email??""},[n,a]),f=v.useMemo(()=>e||d,[e,d]),[h,m]=v.useState([]),{shooterState:_,roll:w,rolling:b,readyPlayers:E,ready:T}=Kz({roomId:c,myPlayerId:f}),R=Yz({roomId:c,myPlayerId:f}),P=v.useMemo(()=>Array.isArray(r)?r:Array.isArray(R.readyPlayers)&&R.readyPlayers.length>0?R.readyPlayers:E,[r,R.readyPlayers,E]),A=v.useMemo(()=>({addBet:R.addBet,removeBet:R.removeBet,clearBets:R.clearBets}),[R.addBet,R.removeBet,R.clearBets]),C=R.betsState||{},O=C.pass||[],I=C.dontPass||[],x=C.place||[],D=C.field||[],N=C.big||[],L=C.come||[],j=C.dontCome||[],q=C.odds||[],U=C.ats||[],W=v.useMemo(()=>p_e(x,f),[x,f]),F=v.useMemo(()=>{let Be=0;for(const je of[4,5,6,8,9,10])Be+=W[je]||0;return Be},[W]),Y=v.useMemo(()=>{const Be={};if(!f)return Be;const je=R.myLine?.pass??kc(O,f),rt=R.myLine?.dontPass??kc(I,f);je>0&&(Be.pass=je),rt>0&&(Be.dontPass=rt);for(const dr of[4,5,6,8,9,10]){const Sr=W[dr]||0;Sr>0&&(Be[`place${dr}`]=Sr)}const Ct=kc(D,f);Ct>0&&(Be.field=Ct);const jt=ju(N,f,dr=>dr.kind==="big6");jt>0&&(Be.big6=jt);const De=ju(N,f,dr=>dr.kind==="big8");De>0&&(Be.big8=De);const nt=kc(L,f);nt>0&&(Be.come=nt);const at=kc(j,f);at>0&&(Be.dontCome=at);const we=ju(q,f,dr=>dr.passType==="pass");we>0&&(Be.oddsPass=we);const st=ju(q,f,dr=>dr.passType==="dontPass");st>0&&(Be.oddsDontPass=st);const bt=ju(U,f,dr=>dr.kind==="atsSmall");bt>0&&(Be.atsSmall=bt);const nr=ju(U,f,dr=>dr.kind==="atsTall");nr>0&&(Be.atsTall=nr);const ur=ju(U,f,dr=>dr.kind==="atsAll");return ur>0&&(Be.atsAll=ur),Be},[f,R.myLine?.pass,R.myLine?.dontPass,O,I,W,D,N,L,j,q,U]),Q=v.useMemo(()=>{const Be=f;return Be?{pass:Lh(O,Be),dontPass:Lh(I,Be),field:Lh(D,Be),big6:fL(N,Be,je=>je.kind==="big6"),big8:fL(N,Be,je=>je.kind==="big8"),come:Lh(L,Be),dontCome:Lh(j,Be),place4:df(x,Be,4),place5:df(x,Be,5),place6:df(x,Be,6),place8:df(x,Be,8),place9:df(x,Be,9),place10:df(x,Be,10)}:{}},[f,O,I,D,N,L,j,x]),ie=v.useCallback(Be=>m(Be),[]),G=v.useRef(0),B=v.useCallback(()=>{if(!c||!f||!h.length)return;const Be=Date.now();if(!(Be-G.current<1e3)){G.current=Be;try{const je=kc(O,f),rt=kc(I,f),Ct=W;for(const jt of h){const De=jt.type;let nt=0;if(De==="pass")nt=je;else if(De==="dontPass")nt=rt;else if(De.startsWith("place")){const st=parseInt(De.replace("place",""),10);nt=Ct[st]||0}else continue;const at=Math.max(0,Number(jt.amount)||0),we=Math.max(0,at-nt);if(we>0)try{A.addBet(De,we)}catch{}}}catch{}}},[c,f,h,O,I,W,A]);Pa({onJoinedRoom:({room:Be})=>{Be?.id===c&&B()},onRejoinedRoom:({room:Be})=>{Be?.id===c&&B()}}),v.useEffect(()=>{if(!f)return;const Be=h.filter(je=>{if(je.type==="pass")return!(kc(O,f)>=je.amount);if(je.type==="dontPass")return!(kc(I,f)>=je.amount);if(je.type.startsWith("place")){const rt=parseInt(je.type.replace("place",""),10);return!((W[rt]||0)>=je.amount)}return!0});Be.length!==h.length&&m(Be)},[f,O,I,W,h]),v.useEffect(()=>{if(!c||!f||!o||!u)return;const Be=i?.gameState,je=Be?.currentRollerId;if(!je||je!==f)return;const rt=Be?.crapsPassBets,Ct=Be?.crapsDontPassBets;if(!(rt?.some(De=>De.playerId===f&&De.amount>0)||Ct?.some(De=>De.playerId===f&&De.amount>0)))try{o(De=>{if(!De||De.id!==c)return De;const nt=De.gameState||{},at=Array.isArray(nt.crapsPassBets)?nt.crapsPassBets.slice():[];return at.push({playerId:f,amount:10}),{...De,gameState:{...nt,crapsPassBets:at,gameMode:nt.gameMode||"craps"}}})}catch{}},[c,i?.gameState,f,o,u]);const K=v.useCallback((Be,je)=>{c&&(je>0?A.addBet(Be,je):je<0&&A.removeBet(Be,Math.abs(je)))},[c,A]),ae=v.useMemo(()=>{const Be=i?.gameState;if(Be?.gameMode==="craps"){const je=Be.crapsPhase||(_?.point?"point":"comeOut");return{point:Be.crapsPoint??_?.point??null,phase:je==="point"?"point":"comeOut"}}return{point:_?.point??null,phase:_?.point?"point":"comeOut"}},[i?.gameState,_]),{reveal:te}=Xo(),{displayPoint:me,displayPhase:ue}=h_e(ae,te);v.useEffect(()=>{if(ae.point==null&&te){const Be=h.filter(je=>!je.type.startsWith("place"));Be.length!==h.length&&m(Be)}},[ae.point,te,h]);const Ae=i?.gameState,He=R.readinessDeadline??null,ce=R.requiredReadyPlayers??[],xe=d_e({roomId:c,userId:d,shooterState:_,roomGameState:Ae,pendingBets:h,myLineFromUnified:R.myLine,betsLastUpdated:R.betsState?.lastUpdated}),re=u?!0:xe;v.useEffect(()=>{try{if(!u)return;window.__debugCanRoll={canRoll:re,userId:n?.id,rolling:b,shooterState:_,roomGS:Ae,readyPlayers:P,requiredReadyPlayers:ce,readinessDeadline:He}}catch{}},[re,n,b,_,Ae,P,ce,He,u]);const H=!c,he=v.useMemo(()=>{const Be=i?.gameState?.currentRollerId;return f?Be===f:!1},[i?.gameState,f]),Re=!!(f&&P.includes(f)),[fe,Ie]=v.useState(!1);v.useEffect(()=>{Re&&Ie(!1)},[Re]);const ct=v.useRef(null),$e=v.useCallback(()=>{if(!(!c||!f||fe||Re)){Ie(!0);try{T()}catch{}ct.current&&window.clearTimeout(ct.current),ct.current=window.setTimeout(()=>{Ie(!1)},5e3)}},[c,f,fe,Re,T]);v.useEffect(()=>()=>{ct.current&&window.clearTimeout(ct.current)},[]);const[tt,We]=v.useState(Date.now());v.useEffect(()=>{if(!He)return;const Be=window.setInterval(()=>We(Date.now()),1e3);return()=>window.clearInterval(Be)},[He]);const it=v.useMemo(()=>{try{const Be=i?.gameState?.currentRollerId??null;if(!Be)return null;const je=i?.players?.find(rt=>rt.id===Be);return je?.name||je?.id||null}catch{return null}},[i?.gameState,i?.players]),Et=5,Mt=500,_t=v.useMemo(()=>[1,5,10,25,100],[]);return g.jsx(c_e,{roomId:c,balance:t,point:me,phase:ue,shooterName:it,minBet:Et,maxBet:Mt,oddsMultiple:{pass:3,dontPass:3,place:1},chips:_t,pendingBets:h,onChangeBets:ie,onClearAll:()=>{m([]),A.clearBets()},disabled:H,onRoll:()=>w(),canRoll:re,myPlayerPlaceTotal:F,myCommittedByType:Y,readyPlayers:P,meId:f,onBetDelta:K,showReadyButton:!he,onReadyClick:$e,readyStateLabel:"Ready",readyButtonDisabled:!1,recentSettlements:R.recentSettlements,myPlayerLineTotals:R.myLine,othersTotals:Q})}function g_e({balance:t,meId:e,readyPlayers:r}){return g.jsx("div",{className:"craps-bet-panel",children:g.jsx(m_e,{balance:t,meId:e,readyPlayers:r})})}function y_e(){const{infoNow:t}=Es(),{room:e}=Mi(),{meId:r}=$r(),n=e?.gameMode||e?.gameState?.gameMode,a=n==="craps",i=n==="cee-lo"||!n,o=!e?.singlePlayer,c=v.useRef({roundSeq:0,seen:new Set}),u=v.useRef(new Map),d=v.useRef(new Map),f=h=>h?(e?.players||[]).find(_=>_.id===h)?.name||"Player":"Unknown";return Pa({onBetsUpdated:h=>{try{const m=Number(h?.roundSeq??0)||0,_=Array.isArray(h?.openAll)?h.openAll:[];c.current.roundSeq!==m&&(c.current={roundSeq:m,seen:new Set},d.current.clear());const w=c.current.seen;if(w.size===0&&_.length>0){for(const T of _)T?.id&&w.add(T.id);d.current=new Map(_.filter(Boolean).map(T=>[T.id,T]));return}const b=d.current,E=new Map(_.filter(Boolean).map(T=>[T.id,T]));for(const T of _)if(!(!T||!T.id)&&!w.has(T.id)){if(w.add(T.id),T.type==="MAIN"){if(!(i&&o)||a&&r&&T.playerId===r)continue;const R=f(T.playerId),P=Math.max(0,Math.trunc(Number(T.amount)||0));P>0&&t("Main bet placed",`+z${P} — ${R}`)}else if(T.type==="SIDE"){const R=f(T.subjectId),P=Math.max(0,Math.trunc(Number(T.amount)||0));if(T.acceptedById){const A=f(T.acceptedById);P>0&&t("Side bet accepted",`z${P} — ${A} on ${R}`)}else{if(a&&r&&T.playerId===r)continue;P>0&&t("Side bet created",`+z${P} — on ${R}`)}}}for(const[T,R]of b.entries()){const P=E.get(T);if(R&&R.type==="SIDE"&&P&&P.type==="SIDE"&&!R.acceptedById&&P.acceptedById){const A=f(P.subjectId),C=Math.max(0,Math.trunc(Number(P.amount)||0)),O=f(P.acceptedById);C>0&&t("Side bet accepted",`z${C} — ${O} on ${A}`)}}for(const[T,R]of b.entries()){if(R?.type!=="SIDE")continue;if(!E.has(T)&&!R.acceptedById){const A=f(R.subjectId),C=Math.max(0,Math.trunc(Number(R.amount)||0));C>0&&t("Side bet cancelled",`-z${C} — on ${A}`)}}d.current=E}catch{}},onCrapsBetsUpdate:h=>{try{const m=h?.snapshot||{},_=u.current,w=new Map,b=(R,P)=>{w.set(R,(w.get(R)||0)+(Number.isFinite(P)?P:0))},E=R=>{const P=R.split("|"),A=P[0],C=P[1]||"",O=f(A);if(C.startsWith("place:"))return`Place ${C.split(":")[1]} — ${O}`;switch(C){case"pass":return`Pass — ${O}`;case"dontPass":return`Don't Pass — ${O}`;case"field":return`Field — ${O}`;case"big6":return`Big 6 — ${O}`;case"big8":return`Big 8 — ${O}`;default:return`${C} — ${O}`}},T=R=>Array.isArray(R)?R:[];for(const{playerId:R,amount:P}of T(m.crapsPassBets))b(`${R}|pass`,P);for(const{playerId:R,amount:P}of T(m.crapsDontPassBets))b(`${R}|dontPass`,P);for(const{playerId:R,amount:P}of T(m.crapsFieldBets))b(`${R}|field`,P);for(const{playerId:R,kind:P,amount:A}of T(m.crapsBigBets))b(`${R}|${P}`,A);for(const{playerId:R,point:P,amount:A}of T(m.crapsPlaceBets))b(`${R}|place:${P}`,A);for(const{playerId:R,amount:P,status:A,point:C}of T(m.crapsComeBets))b(`${R}|come${A==="POINT"&&C?":"+C:""}`,P);for(const{playerId:R,amount:P,status:A,point:C}of T(m.crapsDontComeBets))b(`${R}|dontCome${A==="POINT"&&C?":"+C:""}`,P);if(_.size===0){u.current=w;return}for(const[R,P]of w.entries()){const A=_.get(R)||0,C=Math.trunc(P-A);if(C>0){if(r&&R.startsWith(r+"|"))continue;t("Bet Placed",`+z${C} — ${E(R)}`)}}u.current=w}catch{}}}),v.useEffect(()=>{},[]),null}function v_e(t,e){const{rollDice:r,placeMainBet:n,cancelMainBet:a,createSideBet:i,acceptSideBet:o,cancelSideBet:c,confirmBets:u,bankerGiveUp:d,setSpectate:f,getWagers:h}=pa(),m=_=>{if(t)try{return _()}catch(w){return Promise.resolve({ok:!1,error:w?.message||"ERR"})}};return{roll:_=>m(()=>r(t).then(w=>(_?.(w),w)).catch(w=>{const b={ok:!1,error:w?.message||"ERR"};return _?.(b),b})),confirmBets:_=>m(()=>u(t).then(w=>(_?.(w),w)).catch(w=>{const b={ok:!1,error:w?.message||"ERR"};return _?.(b),b})),placeMain:(_,w)=>m(()=>n(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),cancelMain:(_,w)=>m(()=>a(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),createSide:(_,w,b)=>m(()=>i(t,{amount:_,...w||{}}).then(E=>(b?.(E),E)).catch(E=>{const T={ok:!1,error:E?.message||"ERR"};return b?.(T),T})),acceptSide:(_,w)=>m(()=>o(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),cancelSide:(_,w)=>m(()=>c(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),giveUpBank:_=>m(()=>d(t).then(w=>(_?.(w),w)).catch(w=>{const b={ok:!1,error:w?.message||"ERR"};return _?.(b),b})),spectate:(_,w)=>m(()=>f(t,_).then(b=>(w?.(b),b)).catch(b=>{const E={ok:!1,error:b?.message||"ERR"};return w?.(E),E})),refreshWagers:()=>{if(t)try{h(t)}catch{}}}}function __e(t){const{isMyTurn:e,isBanker:r,diceSettled:n,hasMainBetPlaced:a,bankPointExists:i,roundEnded:o}=t;return e?n?o?{canRoll:!1,reason:"Round transition in progress"}:r&&i?{canRoll:!1,reason:"Banker point established"}:!r&&!a?{canRoll:!1,reason:"Place a main bet first"}:{canRoll:!0}:{canRoll:!1,reason:"Dice not settled"}:{canRoll:!1,reason:"Not your turn"}}function pL(t,e){return e&&t.find(n=>n.id===e)?.name||"Anonymous"}function b_e(t){switch((t||"").toLowerCase()){case"beatsbank":return"Beats Banker";case"losestobank":return"Loses to Banker";case"tiesbank":return"Ties Banker";default:return t||"Side Bet"}}function FE(t,e){const[r,n]=v.useState(e),a=v.useRef(!1);return v.useEffect(()=>{if(!t)return;let i=!1;return(async()=>{try{const o=await Yf(t);!i&&o!==null&&n(o)}catch{}a.current=!0})(),()=>{i=!0}},[t]),v.useEffect(()=>{t&&a.current&&(async()=>{try{await Pb(t,r)}catch{}})()},[t,r]),[r,n]}function LA(t,e,r){const{info:n}=cP(),a=r?.autoJoin??!0,i=tn(),o=ou(),{leaveRoom:c}=pa(),{joinRoom:u}=Mi(),d=u,f=v_e(t||null),{reveal:h,rollTrigger:m,triggerSpin:_}=Xo(),{user:w}=$r(),[b,E]=v.useState(null),{room:T}=Mi(),P=(()=>{try{return Mi&&Mi()}catch{return null}})()?.setRoom??null;v.useRef(null);const[A,C]=v.useState(!0),[O,I]=v.useState(null),[x,D]=v.useState(null),N=v.useRef(null),L=v.useRef(null);v.useRef([]);const[j,q]=v.useState(!0),[U,W]=v.useState(void 0),[F,Y]=FE(t?`gp:${t}:${e}:deadline`:void 0,30),[Q,ie]=FE(t?`gp:${t}:${e}:serverNow`:void 0,30),[G,B]=FE(t?`gp:${t}:${e}:feed`:void 0,[]),[K,ae]=v.useState([]),[te,me]=v.useState(null),[ue,Ae]=v.useState([]),[He,ce]=v.useState(!1),[xe,re]=v.useState(!1),H=v.useRef(null),he=v.useRef(null);v.useEffect(()=>{t&&(async()=>{try{await Xf(`gp:${t}:${e}:diceSettled`),await Xf(`gp:${t}:${e}:diceResults`)}catch{}})()},[t,e]),v.useEffect(()=>()=>{H.current&&(window.clearTimeout(H.current),H.current=null)},[]),v.useEffect(()=>{if(!b||!b.singlePlayer){ce(!1),re(!1),H.current&&(window.clearTimeout(H.current),H.current=null),he.current=null;return}const nt=(b.gameState?.gameMode||b.gameState?.mode)==="craps"?1:3;if(b.players.length>=nt+1){xe||re(!0),ce(!1),H.current&&(window.clearTimeout(H.current),H.current=null),he.current=null;return}xe||(H.current||(H.current=window.setTimeout(()=>{ce(!0),H.current=null},250)),he.current?Date.now()>he.current&&(re(!0),ce(!1)):he.current=Date.now()+5e3)},[b,xe]);const Re=r?.listeners??!0;Pa(Re?{onJoinedRoom:({room:De})=>{E(De),B(nt=>[{kind:"system",message:`You joined ${De.name}`,ts:Date.now()},...nt]);try{j===!1&&(L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{j===!1&&!N.current&&q(!0),L.current=null},sa.diceSettleClientMs));const nt=De?.gameState||{};!nt?.bankRoll&&!nt?.lastRoll&&j===!1&&!N.current&&q(!0)}catch{}},onRejoinedRoom:({room:De})=>{E(De),B(nt=>[{kind:"system",message:`Rejoined ${De.name}`,ts:Date.now()},...nt])},onOtherLeft:({room:De})=>{E(De)},onOtherPlayerJoined:({room:De})=>{E(De),B(nt=>[{kind:"system",message:"Another player joined.",ts:Date.now()},...nt])},onSpectatorsUpdated:De=>{const{spectators:nt,roundSeq:at}=De||{};E(we=>{if(!we)return we;const st=we.gameState?.roundSeq;return typeof at=="number"&&typeof st=="number"&&at!==st?we:{...we,gameState:{...we.gameState,spectators:nt??[]}}})},onDiceRolled:De=>{const{rollerId:nt,results:at,rank:we,room:st,deadline:bt,serverNow:nr}=De;Y(bt),q(!1),L.current&&(window.clearTimeout(L.current),L.current=null),N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{q(!0),st&&E(st);try{N.current&&window.clearTimeout(N.current)}catch{}N.current=null},sa.diceSettleClientMs),ie(nr),D(nt),_(),W(at)},onBetsUpdated:De=>{setTimeout(()=>{De.room&&E(De.room)},2e3)},onSideBetCreated:De=>{if(!De||De.acceptedById||!De.subjectId||De.subjectId!==e)return;const at=`${pL(b?.players??[],De.playerId)} offered: ${b_e(De.predicate)} for $${De.amount}`;o.info(at,{title:"New Side Bet"})},onLobbyRooms:void 0,onNotYourTurn:()=>{B(De=>[{kind:"system",message:"It’s not your turn.",ts:Date.now()},...De])},onForceLogout:()=>{B(De=>[{kind:"system",message:"You were logged out.",ts:Date.now()},...De]),i("/login",{replace:!0})},onError:De=>I(De),onTurnOrderUpdated:De=>{if(!De.room||!De.room.gameState)return;E(De.room);const nt=pL(De.room.players,De.banker);B(at=>[{kind:"system",message:`${nt} is now the banker for the new round.`,ts:Date.now()},...at])},onRoomUpdateState:De=>{const{roomId:nt,gameState:at,room:we}=De||{},st=we?.gameState??at;!nt||!st||E(bt=>{if(!bt||bt.roomId!==nt||bt?.id!==nt)return{...bt,gameState:st};const nr=bt.gameState?.roundSeq,ur=st?.roundSeq,dr=typeof nr=="number"&&typeof ur=="number"&&nr!==ur,Sr={...bt,gameState:{...bt.gameState,...st}};if(dr){try{q(!0)}catch{}try{W(void 0)}catch{}try{D(null)}catch{}}return Sr})}}:{}),v.useEffect(()=>()=>{N.current&&(window.clearTimeout(N.current),N.current=null),L.current&&(window.clearTimeout(L.current),L.current=null)},[]),v.useEffect(()=>{j===!1&&!N.current?(L.current&&window.clearTimeout(L.current),L.current=window.setTimeout(()=>{if(j===!1){N.current||q(!0);try{N.current&&window.clearTimeout(N.current)}catch{}N.current=null}L.current=null},sa.diceSettleClientMs)):j===!0&&L.current&&(window.clearTimeout(L.current),L.current=null)},[j]);const Ie=v.useRef(null),ct=v.useRef(void 0),$e=v.useRef(!1);Ie.current=d,v.useEffect(()=>{if(!a)return;let De=!1;if(ct.current!==t)return ct.current=t,$e.current=!1,(async()=>{if(!t){I("No room id provided."),C(!1);return}if(C(!0),I(null),!Ie.current){I("No join ref");return}const nt=(()=>{try{return typeof window<"u"&&(window.location?.search?.includes("e2e=1")||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")}catch{return!1}})();let at=null;try{nt?at=await Promise.race([Ie.current(t),new Promise(st=>setTimeout(()=>st({ok:!1,error:"e2e-timeout"}),1800))]):at=await Ie.current(t)}catch(we){if(!nt){I(we?.message||"Failed to join room."),C(!1);return}}if(typeof window<"u"&&(window.__e2eJoinAttempt={roomId:t,res:at,ts:Date.now()}),!De){if(!at?.ok){if(!nt){I(at?.error??"Failed to join room."),C(!1);return}const we=Date.now(),st=w?.id||"e2e-user",bt=w?.name||"E2E User",ur=((()=>{try{const Z=new URLSearchParams(window.location.search).get("m");return Z==="cee-lo"||Z==="craps"?Z:null}catch{return null}})()||(t?.toLowerCase().includes("ceelo")?"cee-lo":"craps"))==="cee-lo",dr=[{id:st,name:bt,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],Sr=ur?{id:t,name:"E2E Cee-Lo Room",gameMode:"cee-lo",createdAt:we,updatedAt:we,bankerId:st,players:dr,gameState:{gameMode:"cee-lo",currentRollerId:st,banker:st,turnOrder:[st],roundSeq:1,bankRoll:null,turnHistory:[]}}:{id:t,name:"E2E Craps Room",gameMode:"craps",createdAt:we,updatedAt:we,bankerId:"bank",players:dr,gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:st,turnOrder:[st],roundSeq:1,crapsPassBets:[],crapsDontPassBets:[],crapsPlaceBets:[]}};E(Sr);try{P?.(Sr)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:Sr.id,players:Sr.players.map(un=>un.id),gameMode:Sr.gameState.gameMode,ts:Date.now()}),C(!1);return}E(at.room);try{P?.(at.room)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:at.room?.id,players:at.room?.players?.map(we=>we.id),gameMode:at.room?.gameState?.gameMode,ts:Date.now()});try{tp("room_join",{roomId:t})}catch{}C(!1)}})(),()=>{De=!0,ct.current===t&&(ct.current=void 0)}},[t,a]);const tt=v.useMemo(()=>{if(!b||!e)return!1;const De=b.gameState||{};return(De?.gameMode??"cee-lo")==="craps",De?.currentRollerId===e},[b,e]),We=v.useMemo(()=>!b||!e?!1:(b.gameState||{})?.banker===e,[b,e]),{open:it,openAll:Et}=y0(t,e),Mt=v.useMemo(()=>(it||[]).some(De=>De.type==="MAIN"&&Number(De.amount)>0),[it]),_t=v.useMemo(()=>(Et||[]).some(De=>De.type==="MAIN"),[Et]),ge=b?.gameState?.currentRollerId??null,Be=v.useMemo(()=>{const De=b?.gameState||T?.gameState||{},nt=De?.gameMode??"cee-lo",at=!!De?.roundEnded;if(nt==="craps"){const nr=!!tt&&!!j&&!at;return me(nr?null:tt?j?"Round transition in progress":"Dice not settled":"Not your turn"),Ae([]),nr}if(!De?.currentRollerId)return me("Initializing…"),Ae([]),!1;const we=!b?.singlePlayer;if(We&&we&&!_t)return me("No open challenges"),Ae([]),!1;const st=!!De?.bankRoll,bt=__e({isMyTurn:tt,isBanker:We,diceSettled:j,hasMainBetPlaced:Mt,bankPointExists:st,roundEnded:at});return me(bt.reason??null),Ae([]),bt.canRoll},[b?.gameState,T?.gameState,tt,We,Mt,j,_t,b?.singlePlayer]),je=v.useCallback(()=>{t&&(c(t),i("/lobby"))},[t,c,i]),rt=v.useCallback(()=>{if(!t||!Be)return;const De=!b?.singlePlayer;if(We&&De&&!_t){try{n("No open challenges")}catch{}return}if(!We&&!Mt){try{n("No open challenges")}catch{}return}try{tp("roll_click",{game:"cee-lo",role:We?"banker":"challenger"})}catch{}try{N.current&&(window.clearTimeout(N.current),N.current=null),L.current&&(window.clearTimeout(L.current),L.current=null)}catch{}q(!1),_(),(async()=>{const nt=await f.roll(),at=nt?.error||nt?.message||"";if(!nt||nt.ok===!1){if(q(!0),/no open main bets/i.test(at)){const we=!!b?.singlePlayer;try{f.refreshWagers()}catch{}if(!we||!We)try{n("No open challenges")}catch{}return}return}})()},[t,f,_,Be,We,Mt,_t,b?.gameState]),Ct=v.useCallback(async()=>{if(t)return f.giveUpBank?.()},[t,f]),jt=v.useCallback(async De=>{if(t)return f.spectate?.(De)},[t,f]);return{room:b,joining:A,botsHydrating:He,error:O,isMyTurn:tt,isBanker:We,lastRollerId:x,rollTrigger:m,diceSettled:j,diceResults:U,deadline:F,serverNow:Q,canRoll:Be,canRollReason:te,canRollBlocking:ue,handleRoll:rt,handleLeave:je,giveUpBank:Ct,setSpectateMode:jt,currentRollerId:ge,readyPlayers:K}}function k_e({meId:t,players:e,openSideBets:r,onCancelSideBet:n,onAcceptSideBet:a,offersToMe:i=[],newOffersCount:o=0,onOffersSeen:c,disabled:u=!1,betsLocked:d,hasBankRoll:f,hasRolledThisRound:h}){const m=ou(),[_,w]=v.useState(!1),b=v.useRef(null),E=v.useMemo(()=>{if(typeof window<"u"&&window.location?.search?.includes("e2e=1")){const x=window.__e2eSideBets;if(Array.isArray(x)&&x.length>0)return x}return i},[i]);v.useEffect(()=>{_&&c?.()},[_,c]);const T=v.useCallback(async(x,D)=>{if(!a)return;if(D&&h?.(D)){m.info("Subject already rolled. Side bets are closed for this subject.");return}try{Xr()}catch{}const N=await a(x);N.ok||m.error(N.error||"Failed to accept side bet")},[a,h,m]),R=v.useCallback((x,D)=>{const N=(D||"").toLowerCase();return N==="beatsbank"||N==="subject_beats_banker"?`${x} beats Banker`:N==="losestobank"||N==="subject_loses_to_banker"?`${x} loses to Banker`:N==="tiesbank"||N==="subject_push"||N==="subject_ties_banker"?`${x} ties Banker`:`${x} side bet`},[]),P=v.useCallback(x=>x?x==="house_global"||x==="house"?"House":e.find(D=>D.id===x)?.name||"Player":"Player",[e]);v.useEffect(()=>{const x=D=>{b.current&&!b.current.contains(D.target)&&w(!1)};return _&&document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[_]);const A=!f&&!u,C=(E?.length??0)>0&&A&&!_,I=!A||(E?.length??0)===0?"btn btn--ghost"+(A?"":" is-disabled"):"gold-link"+(C?" gold-link--pulse":"");return g.jsxs("div",{className:"side-bet-panel",children:[g.jsxs("a",{onClick:()=>{try{c?.()}catch{}A&&w(!0)},className:I,"aria-disabled":A?void 0:"true",title:A?void 0:"Side bets closed",children:["Side bets",o>0&&g.jsx("span",{className:"sidebet-badge","aria-label":`${o} new offer${o>1?"s":""}`,children:o})]}),_&&g.jsx("div",{className:"side-bet-panel__modal",children:g.jsxs("div",{className:"side-bet-panel__modal-content",ref:b,children:[g.jsx("h3",{className:"side-bet-panel__title",children:"Side Bets"}),g.jsx("div",{className:"side-bet-panel__list",role:"list","aria-label":"Offers to you",children:E.length>0?E.map(x=>{const D=P(x.subjectId),N=R(D,x.predicate),L=x.subjectId,j=h?.(L)??!1,q=L===t;return g.jsxs("div",{className:"side-bet-panel__list-item",role:"listitem",children:[g.jsxs("div",{className:"side-bet-panel__wager-info",children:[g.jsx("span",{className:"side-bet-panel__wager-amount",children:g.jsx(Lc,{mini:!0,value:x.amount})}),g.jsx("span",{className:"side-bet-panel__wager-label",children:N})]}),a&&g.jsx("button",{className:"felt-btn felt-btn--primary",onClick:()=>T(x.id,L),disabled:u||j||q||f,title:f?"Dealer rolled – side bets closed":j?"Subject already rolled this round":q?"Cannot bet on yourself":"Accept this side bet",children:"Accept"})]},x.id)}):g.jsx("div",{className:"side-bet-panel__list-item side-bet-panel__list-item--empty",role:"listitem",children:g.jsx("span",{className:"side-bet-panel__empty",children:"No offers right now."})})}),g.jsx("h3",{className:"side-bet-panel__title",style:{marginTop:14},children:"Active side bets"}),g.jsx("div",{className:"side-bet-panel__list",role:"list","aria-label":"Your active side bets",children:r&&r.length>0?r.map(x=>{const D=P(x.subjectId),N=R(D,x.predicate),L=x.acceptedById,j=x.playerId===t,q=P(j?L||void 0:x.playerId),U=!!L,W=j&&!U&&!f&&!!n,F=j?f?"Dealer rolled – side bets closed":U?"Already accepted – cannot cancel":n?void 0:"Cancel not available":"Only the bet maker can cancel";return g.jsxs("div",{className:"side-bet-panel__list-item",role:"listitem",children:[g.jsxs("div",{className:"side-bet-panel__wager-info",style:{flex:1},children:[g.jsx("span",{className:"side-bet-panel__wager-amount",children:g.jsx(Lc,{mini:!0,value:x.amount})}),g.jsxs("span",{className:"side-bet-panel__wager-label",children:[N,g.jsx("span",{style:{display:"block",fontSize:"0.85em",opacity:.8},children:U?`with ${q}`:"awaiting taker"})]})]}),g.jsx("button",{className:"felt-btn "+(W?"felt-btn--danger":"felt-btn--secondary"),"aria-label":"Cancel side bet",title:W?"Cancel this side bet":F||"Cannot cancel",disabled:!W||!!u,onClick:async()=>{if(!W)return;try{Xr()}catch{}const Y=await n(x.id);Y.ok||m.error(Y.error||"Failed to cancel side bet")},children:"Cancel"})]},`active-${x.id}`)}):g.jsx("div",{className:"side-bet-panel__list-item side-bet-panel__list-item--empty",role:"listitem",children:g.jsx("span",{className:"side-bet-panel__empty",children:"No active side bets."})})}),g.jsx("div",{className:"side-bet-panel__cta",children:g.jsx("button",{className:"felt-btn felt-btn--secondary",onClick:()=>w(!1),style:{marginTop:8},children:"Close"})})]})})]})}function w_e({roomId:t,meId:e,bankerId:r,players:n,gameState:a,gameplay:i}){const o=ou(),c=r===e,{myOpenMain:u,myOpenSides:d,placeSideBet:f,cancelSideBet:h,acceptSideBet:m,offersToMe:_,newOfferCount:w,markOffersAsSeen:b}=y0(t,e),E=LA(t,e,{autoJoin:!1}),T=i?.giveUpBank??E.giveUpBank,R=i?.setSpectateMode??E.setSpectateMode,P=!!a?.betsLocked,A=!!a?.bankRoll,C=a?.spectators??[],O=C.includes(e),x=!c&&!P&&!A&&!!!u,D=c&&!P&&!A,N=v.useCallback(async()=>{try{Xr()}catch{}const U=await R(!O);U&&!U.ok&&o.error(U.error||"Failed to update spectate mode")},[R,O,o]),L=v.useCallback(async()=>{try{Xr()}catch{}try{}catch{}try{await cd("Medium")}catch{}const U=await T();U&&!U.ok&&o.error(U.error||"Failed to pass bank")},[T,o]),j=a?.roundSeq??1,q=v.useMemo(()=>{const U=a?.turnHistory??[];return!U||!Array.isArray(U)?[]:typeof a?.roundSeq=="number"?U.filter(W=>(W.roundSeq??j)===j):U},[a,j]);return g.jsxs(g.Fragment,{children:[c&&g.jsx("button",{className:"btn btn--ghost",disabled:!D,onClick:L,"aria-label":"Pass Bank",children:"Pass Bank"}),!c&&g.jsxs("div",{className:"betpanel__row betpanel__row--spectate",children:[g.jsx("div",{"aria-label":"Side bets",children:g.jsx(k_e,{isBanker:c,openSideBets:d,meId:e,players:n,onPlaceSideBet:U=>f({subjectId:U.playerId,predicate:U.predicate,amount:U.amount,clientBetId:U.clientBetId}),onCancelSideBet:h,onAcceptSideBet:m,offersToMe:_,newOffersCount:w,onOffersSeen:b,roomId:t,betsLocked:P,disabled:C.includes(e),hasBankRoll:A,hasRolledThisRound:U=>!!U&&q.some(W=>W.playerId===U&&(W.roundSeq??j)===j)})}),g.jsx("button",{className:"btn btn--ghost",onClick:N,disabled:!x,"aria-pressed":O,"aria-label":O?"Stop spectating this round":"Spectate this round",children:O?"Spectating":"Spectate"})]})]})}function _d({className:t,title:e,...r}){return g.jsxs("svg",{width:36,height:36,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":e?void 0:!0,role:e?"img":"presentation",...r,children:[e?g.jsx("title",{children:e}):null,g.jsx("path",{d:"M19 12H5m0 0l7-7m-7 7l7 7",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})}const S_e=new TextEncoder;function E_e(t){const e=t instanceof Uint8Array?t:new Uint8Array(t);return Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("")}async function T_e(t){const e=await crypto.subtle.digest("SHA-256",S_e.encode(t));return E_e(e)}async function C_e(t,e){return!t||!e?!1:(await T_e(t)).toLowerCase()===e.toLowerCase()}const qE=(t,e)=>`${t}:${e}`;function Xz(t){const[e,r]=v.useState({}),[n,a]=v.useState({}),i=v.useRef({});v.useEffect(()=>{r({}),a({}),i.current={}},[t]),Pa({onDiceRolled:u=>{const d=u?.fairness,f=u?.rollerId,h=d?.roundSeq??u?.room?.gameState?.roundSeq;if(!d||!f||typeof h!="number")return;const m=qE(h,f);r(_=>_[m]?_:{..._,[m]:d}),delete i.current[m]},onCrapsRollResult:u=>{const d=u?.fairness,f=u?.fairness?.rollerId||u?.currentRollerId,h=d?.roundSeq;if(!d||!f||typeof h!="number")return;const m=qE(h,f);r(_=>_[m]?_:{..._,[m]:d}),delete i.current[m]},onFairnessReveal:u=>{typeof u?.roundSeq!="number"||!u.commit||!u.serverSeed||a(d=>{const f=d[u.roundSeq];if(!f||f.commit!==u.commit)for(const h of Object.keys(i.current))h.startsWith(`${u.roundSeq}:`)&&delete i.current[h];return{...d,[u.roundSeq]:{commit:u.commit,serverSeed:u.serverSeed}}})}});const o=v.useCallback(async(u,d,f)=>{const h=qE(d,u);if(i.current[h])return i.current[h];const m=e[h],_=n[d];if(!m||!_)return i.current[h]="unverifiable","unverifiable";const b=await C_e(_.serverSeed,m.commit)?"verified":"bad-commit";return i.current[h]=b,b},[e,n]),c=v.useMemo(()=>{const u=Object.keys(n).map(d=>Number(d)).filter(d=>!Number.isNaN(d));return u.length?Math.max(...u):void 0},[n]);return{proofs:e,reveals:n,verifyFor:o,lastRoundWithReveal:c}}let ia=null,k_=null,YC=null;async function Hg(){if(ia)return!0;try{const t=await qr(()=>import("./index-CSNdB9RA.js"),[],import.meta.url);return ia=t.AdMob,k_=t.RewardAdPluginEvents,YC=t.InterstitialAdPluginEvents,!0}catch{return!1}}let hp=!1;async function Ip(){if(hp)return!0;if(Gr.getPlatform()==="web"||!await Hg()||!ia)return!1;try{return await ia.initialize({requestTrackingAuthorization:!0,initializeForTesting:Gg??!1}),hp=!0,!0}catch{return!1}}const Gg=typeof process<"u"&&!1;function Jz(){const t=Gr.getPlatform();return t==="ios"?TH:KD}function Qz(){const t=Gr.getPlatform();return t==="ios"?OH:YD}async function x_e(){if(Gr.getPlatform()==="web"||!await Hg()||!ia)return!1;hp||await Ip();try{const r=Jz();return await ia.prepareRewardVideoAd({adId:r,isTesting:Gg??!1}),!0}catch{return!1}}async function P_e(){return Gr.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await Hg()||!ia?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!hp&&!await Ip()?{ok:!1,error:"INIT_FAILED"}:new Promise(async r=>{let n=!1,a,i;const o=ia.addListener(k_.Rewarded,f=>{n=!0,a=f?.type||"chips",i=f?.amount||pf}),c=ia.addListener(k_.Dismissed,()=>{d(),r(n?{ok:!0,rewardType:a,rewardAmount:i}:{ok:!1,error:"AD_DISMISSED"})}),u=ia.addListener(k_.FailedToShow,f=>{d(),r({ok:!1,error:"FAILED_TO_SHOW"})}),d=()=>{try{o?.remove?.()}catch{}try{c?.remove?.()}catch{}try{u?.remove?.()}catch{}};try{const f=Jz();await ia.prepareRewardVideoAd({adId:f,isTesting:Gg??!1}),await ia.showRewardVideoAd()}catch(f){d(),r({ok:!1,error:f?.message||"UNKNOWN_ERROR"})}})}async function Of(){if(Gr.getPlatform()==="web"||!await Hg()||!ia)return!1;hp||await Ip();try{const r=Qz();return await ia.prepareInterstitial({adId:r,isTesting:Gg??!1}),!0}catch{return!1}}async function w_(){return Gr.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await Hg()||!ia?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!hp&&!await Ip()?{ok:!1,error:"INIT_FAILED"}:new Promise(async r=>{const n=ia.addListener(YC.Dismissed,()=>{i(),r({ok:!0}),Of().catch(()=>{})}),a=ia.addListener(YC.FailedToShow,o=>{i(),r({ok:!1,error:"FAILED_TO_SHOW"})}),i=()=>{try{n?.remove?.()}catch{}try{a?.remove?.()}catch{}};try{const o=Qz();await ia.prepareInterstitial({adId:o,isTesting:Gg??!1}),await ia.showInterstitial()}catch(o){i(),r({ok:!1,error:o?.message||"UNKNOWN_ERROR"})}})}function Zz(){const t=Gr.getPlatform();return t==="ios"||t==="android"}const zE={initializeAdMob:Ip,prepareRewardedAd:x_e,showRewardedAd:P_e,prepareInterstitialAd:Of,showInterstitialAd:w_,isNativeAdSupported:Zz},hL=_3,mL=b3,gL=k3,$E="ad:complete",e6=v.createContext({onHandEnd:async()=>{},onCrapsShooterTurnEnd:async()=>{},showAdNow:async()=>{},isAdEnabled:!1,isAdShowing:!1,adConfig:{handsPerAd:b3,crapsShooterTurnsPerAd:k3,minIntervalMs:qh,displayDelayMs:zh}}),w0=()=>v.useContext(e6);function A_e({children:t}){const[e,r]=v.useState(!1),[n,a]=v.useState(!1),i=Zz(),o=!e&&i,c=v.useRef(!1),u=v.useRef(0),d=v.useRef(0),f=v.useRef(0);v.useEffect(()=>{const b=async()=>{try{const T=Ni();if(!T)return;const P=(await T.getCustomerInfo?.())?.entitlements?.active||{},A=Object.keys(P).length>0;let C=!1;hL&&(C=!!P?.[hL]||A),r(C)}catch{}};b();const E=setInterval(b,6e4);return()=>clearInterval(E)},[]),v.useEffect(()=>{o&&Of().catch(()=>{})},[o]);const h=v.useCallback(async()=>{if(!o||c.current)return;const b=Date.now();if(!(b-f.current<qh)&&(u.current+=1,!(u.current<mL))){c.current=!0,u.current=0,f.current=b;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}a(!0),await new Promise(E=>setTimeout(E,zh));try{await w_()}catch{}finally{c.current=!1,a(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent($E))}catch{}Of().catch(()=>{})}}},[o]),m=v.useCallback(async()=>{if(!o||c.current)return;const b=Date.now();if(!(b-f.current<qh)&&(d.current+=1,!(d.current<gL))){c.current=!0,d.current=0,f.current=b;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}a(!0),await new Promise(E=>setTimeout(E,zh));try{await w_()}catch{}finally{c.current=!1,a(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent($E))}catch{}Of().catch(()=>{})}}},[o]),_=v.useCallback(async()=>{if(!o||c.current)return;const b=Date.now();if(!(b-f.current<qh)){c.current=!0,u.current=0,d.current=0,f.current=b;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}a(!0),await new Promise(E=>setTimeout(E,zh));try{await w_()}catch{}finally{c.current=!1,a(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent($E))}catch{}Of().catch(()=>{})}}},[o]),w={handsPerAd:mL,crapsShooterTurnsPerAd:gL,minIntervalMs:qh,displayDelayMs:zh};return g.jsx(e6.Provider,{value:{onHandEnd:h,onCrapsShooterTurnEnd:m,showAdNow:_,isAdEnabled:o,isAdShowing:n,adConfig:w},children:t})}const t6=ci();async function R_e(t){if(!t)return null;try{const e=await oi(),r=`${t6}/api/rooms/${encodeURIComponent(t)}/craps-history?playerScope=me&limit=200`,a=await(await fetch(r,{credentials:"include",cache:"no-store",headers:e?{Authorization:`Bearer ${e}`}:void 0})).json();return a&&a.ok&&a.data&&Array.isArray(a.data.items)?a.data.items:null}catch{return null}}async function D_e(t){if(!t)return null;try{const e=await oi(),n=await(await fetch(`${t6}/api/rooms/${encodeURIComponent(t)}/settlements?playerScope=me&limit=500`,{credentials:"include",cache:"no-store",headers:e?{Authorization:`Bearer ${e}`}:void 0})).json();return n&&n.ok&&n.data&&Array.isArray(n.data.items)?n.data.items:null}catch{return null}}const r6=""+new URL("avatars-BLAbFok_.webp",import.meta.url).href,n6=""+new URL("avatars2-BhCQ9Hmk.webp",import.meta.url).href,a6=""+new URL("bikini_avatars-D9_A_byG.webp",import.meta.url).href,i6=""+new URL("bikini_avatars2-CqEDCn9Y.webp",import.meta.url).href,s6=""+new URL("car_avatars-C2asmsaV.webp",import.meta.url).href,o6=""+new URL("cowboy_avatars-Dh4o-H8O.webp",import.meta.url).href,c6=""+new URL("surf_avatars-BNzNQWcq.webp",import.meta.url).href,l6=""+new URL("surf_avatars2-CP3KwVoE.webp",import.meta.url).href,u6=""+new URL("toy_avatars-CYoTJdP7.webp",import.meta.url).href,d6=[r6,n6,a6,i6,s6,o6,c6,l6,u6];function O_e(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)>>>0;return e%(d6.length*6)}function yL({seed:t}){const e=O_e(t),r=Math.floor(e/6),n=e%6,a=d6[r],i=2,o=3,c=n%i,u=Math.floor(n/i),d={display:"block",width:"100%",height:"100%",borderRadius:"50%",backgroundImage:`url(${a})`,backgroundSize:`${i*100}% ${o*100}%`,backgroundPosition:`${c*(100/(i-1))}% ${u*(100/(o-1))}%`,backgroundRepeat:"no-repeat"};return g.jsx("span",{className:"avatar-sprite",style:d,"aria-hidden":!0})}function N_e({stream:t,labelFallback:e,muted:r=!0,forceHideVideo:n=!1,active:a=!1,avatarUrl:i}){const o=v.useRef(null),[c]=v.useState(!1),[u,d]=v.useState(!1),f=v.useCallback(()=>t?t.getVideoTracks().some(m=>m.readyState==="live"&&m.enabled!==!1&&!m.muted):!1,[t]);v.useEffect(()=>{if(!t){d(!1);return}const m=()=>d(f());m();const _=t.getVideoTracks();for(const b of _)b.addEventListener("mute",m),b.addEventListener("unmute",m),b.addEventListener("ended",m);const w=()=>{m();const b=t.getVideoTracks();for(const E of b)E.addEventListener("mute",m),E.addEventListener("unmute",m),E.addEventListener("ended",m)};return t.addEventListener("addtrack",w),t.addEventListener("removetrack",w),()=>{for(const b of _)b.removeEventListener("mute",m),b.removeEventListener("unmute",m),b.removeEventListener("ended",m);t.removeEventListener("addtrack",w),t.removeEventListener("removetrack",w)}},[t,f]),v.useEffect(()=>{const m=o.current;if(!m||!t)return;const _=()=>{f()&&d(!0)},w=setInterval(()=>{m.readyState>=2&&f()&&!u&&d(!0),!f()&&u&&d(!1)},1e3);return m.addEventListener("canplay",_),m.addEventListener("playing",_),()=>{clearInterval(w),m.removeEventListener("canplay",_),m.removeEventListener("playing",_)}},[t,f,u]),v.useEffect(()=>{const m=o.current;if(!m)return;let _=0;const w=4,b=P=>{if(!t||!t.getVideoTracks().some(O=>O.readyState==="live"&&O.enabled!==!1)||!m.paused&&m.readyState>=2)return;m.play()?.catch(()=>{if(_<w){const O=150+_*200;_++,setTimeout(()=>b(`${P}:retry${_}`),O)}else try{window.dispatchEvent(new CustomEvent("rtc:videoStall",{detail:{reason:P}}))}catch{}})},E=()=>b("ui"),T=()=>{document.hidden||b("visibility")},R=()=>{if(!t||!m)return;const P=t.getVideoTracks()[0];P&&P.readyState==="live"&&m.paused&&b("pause-event")};return window.addEventListener("ui:roll",E),window.addEventListener("ui:placeMainBet",E),window.addEventListener("ui:cancelMainBet",E),document.addEventListener("visibilitychange",T),m.addEventListener("pause",R),()=>{window.removeEventListener("ui:roll",E),window.removeEventListener("ui:placeMainBet",E),window.removeEventListener("ui:cancelMainBet",E),document.removeEventListener("visibilitychange",T),m.removeEventListener("pause",R)}},[t]),v.useLayoutEffect(()=>{const m=o.current;if(m){try{m.setAttribute("playsinline","true"),m.setAttribute("webkit-playsinline","true"),m.setAttribute("muted",r?"true":"false"),m.disablePictureInPicture=!0}catch{}if(m.srcObject!==t&&(m.srcObject=t??null),t){m.muted=!!r;const _=()=>{m.play().catch(()=>{setTimeout(()=>{m.play().catch(()=>{})},160)})};_(),m.onloadedmetadata=_}else m.onloadedmetadata=null}},[t,r]);const h=!n&&!!t&&u;return n||!t?g.jsx("div",{className:`avatar-shell is-avatar ${a?"is-rolling":""}`,children:i?g.jsx("img",{src:i,alt:e,className:"avatar-uploaded",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):g.jsx(yL,{seed:e})}):g.jsxs("div",{className:`avatar-shell ${c?"is-talking":""}${a?" is-rolling":""}`,style:{position:"relative",overflow:"hidden"},children:[g.jsx("div",{className:`avatar-image ${a?"is-rolling":""}`,style:{position:"absolute",inset:0,opacity:h?0:1,transition:"opacity 160ms ease",display:"flex",alignItems:"center",justifyContent:"center",background:"radial-gradient(circle at 30% 35%, #2e2e2e, #141414)"},children:i?g.jsx("img",{src:i,alt:e,className:"avatar-uploaded",style:{width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%"}}):g.jsx(yL,{seed:e})}),g.jsx("video",{ref:o,playsInline:!0,autoPlay:!0,muted:r,className:"avatar-video",style:{width:"100%",height:"100%",objectFit:"cover",background:"#000",position:"relative",opacity:h?1:0,transition:"opacity 160ms ease"}})]})}function I_e(t,e){return!(t.forceHideVideo!==e.forceHideVideo||t.muted!==e.muted||t.stream!==e.stream||t.avatarUrl!==e.avatarUrl||!e.stream&&(t.labelFallback!==e.labelFallback||t.active!==e.active))}const M_e=v.memo(N_e,I_e),f6=v.createContext(void 0),j_e=({children:t})=>{const{user:e}=$r(),[r,n]=v.useState([]),[a,i]=v.useState([]),[o,c]=v.useState([]),{blockUser:u,unblockUser:d,getFriendsList:f,sendFriendRequest:h,unfriend:m,respondFriendRequest:_}=pa();Pa({onFriendRequestReceived:x=>{x?.request&&i(D=>[...D.filter(N=>N.id!==x.request.id),x.request])},onFriendRequestCancelled:x=>{x?.requestId&&i(D=>D.filter(N=>N.id!==x.requestId))},onFriendRequestResponded:x=>{x?.requestId&&x?.action&&i(D=>D.map(N=>N.id===x.requestId?{...N,status:x.action==="ACCEPT"?"ACCEPTED":"DECLINED"}:N))},onUnfriended:x=>{x?.byUserId&&n(D=>D.filter(N=>N.id!==x.byUserId))},onUserBlocked:x=>{x?.byUserId&&c(D=>D.find(N=>N.id===x.byUserId)?D:[...D,{id:x.byUserId}])},onUserUnblocked:x=>{x?.byUserId&&c(D=>D.filter(N=>N.id!==x.byUserId))}});const w=v.useCallback(async()=>{try{const x=await f();x?.ok&&(Array.isArray(x.friendsProfiles)&&n(x.friendsProfiles),Array.isArray(x.friendRequests)&&i(x.friendRequests),Array.isArray(x.blockedProfiles)&&c(x.blockedProfiles))}catch{}},[f]);v.useEffect(()=>{w()},[]);const b=v.useCallback(x=>{if(!e?.id||a.some(j=>j.status==="PENDING"&&j.fromUserId===e.id&&j.toUserId===x))return;const N=`temp:${Date.now()}:${x}`,L={id:N,fromUserId:e.id,toUserId:x,message:void 0,status:"PENDING",createdAt:new Date().toISOString(),respondedAt:void 0,fromUser:{id:e.id,name:e.name??null,avatarUrl:e.avatarUrl??null},toUser:o.find(j=>j.id===x)??r.find(j=>j.id===x)??{id:x,name:null,avatarUrl:null}};i(j=>[...j,L]),h(x).then(j=>{j?.ok?j.request?i(q=>[...q.filter(U=>!(U.id===N||U.fromUserId===e.id&&U.toUserId===x&&U.id.startsWith("temp:"))),j.request]):w():i(q=>q.filter(U=>U.id!==N))}).catch(()=>{i(j=>j.filter(q=>q.id!==N))})},[h,w,e?.id,e?.name,o,r,a]),E=v.useCallback(x=>{m(x).then(D=>{D?.ok&&n(N=>N.filter(L=>L.id!==x))}).catch(()=>{})},[m]),T=v.useCallback(x=>{i(D=>[...D.filter(N=>N.id!==x.id),x])},[]),R=v.useCallback(x=>{i(D=>D.map(N=>N.id===x.id?x:N))},[]),P=v.useCallback(x=>{i(D=>D.filter(N=>N.id!==x))},[]),A=v.useCallback(async(x,D)=>{try{(await _(x,D))?.ok&&await w()}catch{}},[_,w]),C=v.useCallback(async x=>{(await u(x)).ok&&c(N=>N.find(L=>L.id===x)?N:[...N,{id:x}])},[u]),O=v.useCallback(async x=>{(await d(x)).ok&&c(N=>N.filter(L=>L.id!==x))},[d]),I=v.useCallback(x=>!!o.find(D=>D.id===x),[o]);return g.jsx(f6.Provider,{value:{friends:r,friendRequests:a,blockedUsers:o,addFriend:b,removeFriend:E,addFriendRequest:T,updateFriendRequest:R,removeFriendRequest:P,respondToFriendRequest:A,blockUser:C,unblockUser:O,isBlocked:I,refreshSocial:w},children:t})};function BA(){const t=v.useContext(f6);if(!t)throw new Error("useSocial must be used within a SocialProvider");return t}function p6(t){const{anchorRect:e,anchorEl:r,onClose:n,onMessages:a,onSendMoney:i,onAddFriend:o,onUnfriend:c,onBlockUser:u,isFriend:d,isBlocked:f,hideAddFriend:h}=t,[m,_]=v.useState({top:0,left:0}),[w,b]=v.useState(!1),E=v.useRef(null),T=v.useRef(Date.now());if(v.useLayoutEffect(()=>{if(!e)return;_({top:e.bottom+8,left:e.left}),T.current=Date.now(),b(!0)},[e]),v.useLayoutEffect(()=>{if(!e||!E.current)return;const A=E.current.getBoundingClientRect(),C=window.innerWidth,O=window.innerHeight,I=8,x=window.visualViewport,D=x?x.offsetTop:0,N=parseInt(getComputedStyle(document.documentElement).getPropertyValue("padding-top"))||0;let L=e.bottom+I,j=e.left;j+A.width>C-I&&(j=Math.max(I,C-A.width-I)),L+A.height>O-I&&(L=Math.max(I+N+D,e.top-A.height-I)),L<I+N+D&&(L=I+N+D),j<I&&(j=I),_({top:L,left:j})},[e,w]),v.useEffect(()=>{const P=x=>{if(Date.now()-T.current<120)return;const D=x.target;r&&(r===D||r.contains(D))||E.current&&(E.current.contains(D)||n())},A=x=>{x.key==="Escape"&&n()};let C=null;const O=()=>{Date.now()-T.current<120||(C&&window.clearTimeout(C),C=window.setTimeout(()=>n(),120))},I=O;return document.addEventListener("mousedown",P),window.addEventListener("keydown",A),window.addEventListener("scroll",O,{passive:!0,capture:!0}),window.addEventListener("resize",I),()=>{document.removeEventListener("mousedown",P),window.removeEventListener("keydown",A),window.removeEventListener("scroll",O,{capture:!0}),window.removeEventListener("resize",I),C&&window.clearTimeout(C)}},[n,r]),!e)return null;const R=g.jsxs("div",{className:"avatar-context-menu",style:{top:m.top,left:m.left},ref:E,role:"menu","aria-label":"Player actions",onMouseDown:P=>P.stopPropagation(),children:[a&&g.jsx("button",{role:"menuitem",onClick:()=>{a?.(),n()},className:"avatar-context-menu__item",children:"Messages"}),!d&&!h&&o&&g.jsx("button",{role:"menuitem",onClick:()=>{o(),n()},className:"avatar-context-menu__item",disabled:!!d||!!f||!o,title:d?"Already friends":f?"User is blocked":"Add Friend",children:d?"Friend ✓":"Add Friend"}),d&&c&&g.jsx("button",{role:"menuitem",onClick:()=>{c(),n()},className:"avatar-context-menu__item",children:"Unfriend"}),g.jsx("button",{role:"menuitem",onClick:()=>{u?.(),n()},className:"avatar-context-menu__item",disabled:!u,title:f?"Unblock user":"Block user",children:f?"Unblock":"Block"})]});return typeof document<"u"?Gc.createPortal(R,document.body):R}function h6({targetId:t,anchorRect:e,anchorEl:r,onClose:n,onOpenDM:a,onOpenSendMoney:i,meId:o}){const{friends:c,friendRequests:u,isBlocked:d,blockUser:f,unblockUser:h,addFriend:m,removeFriend:_}=BA(),w=u.some(b=>b.status==="PENDING"&&b.fromUserId===o&&b.toUserId===t);return g.jsx(p6,{anchorRect:e,anchorEl:r,onClose:n,onMessages:a?()=>{a(t),n()}:void 0,onSendMoney:()=>{i?.(t),n()},hideAddFriend:w,onAddFriend:()=>{!c.find(b=>b.id===t)&&!d(t)&&m(t)},onUnfriend:()=>{c.find(b=>b.id===t)&&_(t)},onBlockUser:async()=>{d(t)?await h(t):await f(t)},isFriend:!!c.find(b=>b.id===t),isBlocked:d(t)})}const L_e=v.forwardRef(function({id:e,display:r,isCurrentRoller:n,isMe:a,balance:i,isSpectating:o=!1,folded:c=!1,tags:u,stream:d,diceResult:f,onOpenMenu:h,showMenu:m,menuProps:_,forceHideVideo:w,actDeadlineTs:b,avatarUrl:E,showActingTimerRing:T=!0,presenceStatus:R},P){const A=yye(r);return g.jsxs(Ks.li,{layout:!0,layoutDependency:e,transition:{type:"spring",stiffness:420,damping:38,mass:.6},ref:P,className:["player","player--avatar",n?"is-rolling":"",a?"is-me":"",c?"player--folded":""].join(" "),"data-player-id":e,title:`${r}${u.length?" · "+u.join(" · "):""}`,"aria-label":`${r}${u.length?", "+u.join(", "):""}`,children:[g.jsxs("div",{className:["avatar-ring",n?"is-rolling":""].join(" "),onClick:C=>{C.stopPropagation(),h(e,C.currentTarget)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),h(e,C.currentTarget))},role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":m,children:[g.jsx(M_e,{active:n,stream:d,labelFallback:A,muted:a,forceHideVideo:w,avatarUrl:E}),typeof i=="number"&&g.jsx("div",{className:"avatar-balance-pill","aria-label":`Balance ${hb(i)}`,children:hb(i)})]}),a&&g.jsx("span",{className:"status-dot","aria-hidden":!0}),!a&&R&&g.jsx("span",{className:`presence-dot presence-dot--${R}`,"aria-label":R==="active"?"Online":"Away"}),g.jsxs("div",{className:"player-mini",children:[g.jsxs("div",{className:"player-name",children:[r,u.includes("D")&&g.jsx("span",{className:"player-tag tag--D","aria-label":"Dealer",children:"D"}),u.includes("SB")&&g.jsx("span",{className:"player-tag tag--SB","aria-label":"Small blind",children:"SB"}),u.includes("BB")&&g.jsx("span",{className:"player-tag tag--BB","aria-label":"Big blind",children:"BB"})]}),o&&g.jsx("div",{className:"player-spectating","aria-label":"spectating",children:"spectating"}),g.jsx("div",{className:"player-faces",children:f??g.jsx("span",{style:{display:"inline-block",height:22},"aria-hidden":!0})})]}),m&&_&&g.jsx(h6,{..._})]})}),m6=[r6,n6,a6,i6,s6,o6,c6,l6,u6];function B_e(t){let e=0;for(let r=0;r<t.length;r++)e=e*31+t.charCodeAt(r)>>>0;return e%(m6.length*6)}function U_e({seed:t}){const e=B_e(t),r=Math.floor(e/6),n=e%6,a=m6[r],i=2,o=3,c=n%i,u=Math.floor(n/i),d={display:"block",width:"100%",height:"100%",borderRadius:"50%",backgroundImage:`url(${a})`,backgroundSize:`${i*100}% ${o*100}%`,backgroundPosition:`${c*(100/(i-1))}% ${u*(100/(o-1))}%`,backgroundRepeat:"no-repeat"};return g.jsx("span",{className:"avatar-sprite",style:d,"aria-hidden":!0})}function S_({players:t,meId:e,className:r,showBalance:n=!1,onPlayerClick:a,renderActions:i}){return g.jsx("div",{className:["card",r].filter(Boolean).join(" "),children:g.jsx("ul",{className:"players players--avatars",role:"list",children:t.map((o,c)=>{const u=o.id??String(c),d=o.name??u;return g.jsxs("li",{className:["player","player--avatar",u===e?"is-me":""].join(" "),"data-player-id":u,title:d,"aria-label":d,onClick:()=>a?.(u),role:a?"button":void 0,tabIndex:a?0:-1,onKeyDown:f=>{a&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),a(u))},children:[g.jsx("div",{className:"avatar-ring","aria-hidden":!0,children:g.jsx("div",{className:"video-bubble",children:g.jsx(U_e,{seed:o.id})})}),u===e&&g.jsx("span",{className:"status-dot","aria-hidden":!0}),g.jsxs("div",{children:[g.jsx("div",{className:"player-name",children:d}),n&&g.jsx("div",{className:"player-bank",children:g.jsxs("b",{children:["$",o.balance??0]})})]}),i?.(o)]},u)})})})}function UA(){const[t,e]=v.useState(null),[r,n]=v.useState(null),[a,i]=v.useState(null);return{forUserId:t,anchorRect:r,anchorEl:a,openFor:(u,d)=>{d&&(e(u),i(d),n(d.getBoundingClientRect()))},close:()=>{e(null),n(null),i(null)}}}function g6({players:t,meId:e,className:r,onOpenDM:n,onOpenSendMoney:a,renderActionsOverride:i}){const{forUserId:o,anchorRect:c,anchorEl:u,openFor:d,close:f}=UA(),h=(_,w)=>{!w||_===e||d(_,w)},m=()=>f();return g.jsxs("div",{className:r,children:[g.jsx(S_,{className:"card",players:t,meId:e,showBalance:!1,renderActions:i?_=>i(_):_=>g.jsx("button",{className:"btn btn-xs",onClick:w=>h(_.id,w.currentTarget),"aria-haspopup":"menu","aria-expanded":o===_.id,style:{marginLeft:"auto"},children:"⋯"})}),!i&&o&&g.jsx(h6,{targetId:o,anchorRect:c,anchorEl:u,onClose:m,onOpenDM:n,onOpenSendMoney:a,meId:e})]})}function F_e(t,e,r,n){const a=v.useRef(new Map),i=v.useRef(new Map),[o,c]=v.useState(0),u=v.useRef(n),d=v.useRef(0),f=v.useCallback(h=>{a.current.get(h)||(a.current.set(h,!0),i.current.set(h,performance.now()),c(m=>m+1))},[]);return v.useEffect(()=>{u.current!==n&&(a.current.clear(),i.current.clear(),d.current=0,c(h=>h+1),u.current=n)},[n]),v.useEffect(()=>{for(let h=d.current;h<t.length;h++){const m=t[h],_=m.result;wm(_,m.playerId===e)!=="nothing"&&f(m.playerId)}d.current=t.length},[t,f,e]),v.useEffect(()=>{if(!e||!r.bankRoll?.raw)return;wm(r.bankRoll.raw)!=="nothing"&&f(e)},[e,r.bankRoll,f]),{revealedPlayers:a.current,revealTimesRef:i,revealVersion:o,markRevealed:f}}function q_e(t){if(!t)return"Side Bet";switch(t.toLowerCase()){case"subject_beats_banker":case"beatsbank":return"Beats Banker";case"subject_loses_to_banker":case"losestobank":return"Loses to Banker";case"subject_push":case"tiesbank":return"Ties Banker";default:return t}}function z_e(t){if(!t)return"side bet";switch(t.toLowerCase()){case"subject_beats_banker":case"beatsbank":return"beats banker";case"subject_loses_to_banker":case"losestobank":return"loses to banker";case"subject_push":case"tiesbank":return"ties banker";default:return t}}function FA(t,e){if(!t)return{outcome:null,isChallenger:!1,needsAnimation:!1};const r=t.type==="MAIN"||t.type==="SIDE"?t.type:t.predicate||t.subjectId?"SIDE":"MAIN";let n=null,a=!1,i=!1,o,c=typeof t.result=="string"?t.result.toUpperCase():"",u=!1;if(!c||!["WIN","LOSE","PUSH","TIE"].includes(c)){const h=hd(t,e);h&&h.myResult&&(c=h.myResult.toUpperCase(),u=!0)}const d=c==="WIN"||c==="LOSE",f=c==="PUSH"||c==="TIE";if(!d&&!f)return{outcome:null,isChallenger:!1,needsAnimation:!1};if(u)return d?n=c==="WIN"?"win":"lose":n="push",i=d,{outcome:n,isChallenger:a,subtitle:o,needsAnimation:i};if(r==="MAIN"){const h=t.acceptedById||t.bankerId,m=t.playerId;if(!h||!m)return{outcome:null,isChallenger:!1,needsAnimation:!1};d?(e===m?(n=c==="WIN"?"win":"lose",a=!0):e===h?n=c==="WIN"?"lose":"win":n=null,i=!0):f&&((e===m||e===h)&&(n="push"),i=!0)}else{const h=t.playerId,m=t.acceptedById||void 0;if(d?(e===h?(n=c==="WIN"?"win":"lose",a=!0):e===m?n=c==="WIN"?"lose":"win":n=null,i=!!(h&&m)):f&&((e===h||e===m)&&(n="push"),i=!1),t.predicate||t.subjectId){const _=[];t.predicate&&_.push(q_e(t.predicate)),t.subjectId&&_.push(`on ${t.subjectId}`),_.length&&(o=_.join(" "))}}return{outcome:n,isChallenger:a,subtitle:o,needsAnimation:i}}function $_e(t,e){const r=t.acceptedById||t.bankerId,n=t.playerId;if(!r||!n)return null;let a,i;const o=String(t.result||"").toUpperCase();if(o==="WIN")a=r,i=n;else if(o==="LOSE")a=n,i=r;else return null;if(!a||!i||a===i)return null;const c=e(a),u=e(i);if(!c||!u||Math.hypot(u.x-c.x,u.y-c.y)<4)return null;const f=Number(t.amount)||1;return{id:`${a}-${i}-${t.id}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,settlementId:String(t.id),amount:f,fromId:a,toId:i,startX:c.x,startY:c.y,endX:u.x,endY:u.y}}function y6(t,e,r,n){if(!Array.isArray(t)||t.length===0)return[];const a=[];for(const i of t){if(!i)continue;const o=i.type?i.type:i.predicate||i.subjectId?"SIDE":"MAIN",c={...i,type:o};c.type==="MAIN"&&!c.acceptedById&&!c.bankerId&&n&&(c.bankerId=n||void 0),!(typeof c.roundSeq!="number"||c.roundSeq!==e)&&(r.has(c.id)||(r.add(c.id),a.push(c)))}return a}const V_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zM256%20206a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",H_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm316.97%2036.03A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm-268%20268A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",G_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm316.97%2036.03A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zM256%20206a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100zM123.47%20340.03A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",W_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm48.97%2036.03A50%2050%200%200%201%20172%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm-268%20268A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",K_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm48.97%2036.03A50%2050%200%200%201%20172%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zM256%20206a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100zM123.47%20340.03A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",Y_e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm48.97%2036.03A50%2050%200%200%201%20172%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zM122%20206a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100zm268%200a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100zM123.47%20340.03A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zm268%200A50%2050%200%200%201%20440%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",X_e={1:V_e,2:H_e,3:G_e,4:W_e,5:K_e,6:Y_e};function J_e({dice:t}){return!t||!t.length?null:g.jsx("div",{className:"dice-results-icons",style:{display:"flex",gap:2},children:t.map((e,r)=>g.jsx("img",{src:X_e[e],alt:`Dice face ${e}`,style:{width:22,height:22,borderRadius:"4px"}},r))})}function qA(){const[t,e]=v.useState(!1),[r,n]=v.useState(!0);v.useEffect(()=>{let i=!0;return(async()=>{try{const o=await nu();i&&(n(o.showAnimations!==!1),e(!0))}catch{i&&e(!0)}})(),()=>{i=!1}},[]);const a=v.useCallback(async i=>{const o=typeof i=="boolean"?i:!r;n(o);try{const c=await nu(),u={...Rc,...c,showAnimations:o};await g0(u)}catch{}},[r]);return{ready:t,showAnimations:r,toggleAnimations:a}}function v6({anim:t,onComplete:e}){const{showAnimations:r}=qA(),n=r===!1,a=v.useRef(!1),i=v.useRef(t).current,{amount:o,startX:c,startY:u,endX:d,endY:f}=i,h=v.useRef([]);if(h.current.length===0){const _=MA(o),w=Math.max(0,i.startDelaySec??.25),b=Math.min(8,Math.ceil(_.length/2)),E=(_.length-1)/2;h.current=_.map((T,R)=>({id:`${t.id}-sub-${R}`,value:T,delay:w+R*.05,yOffset:(R-E)*(b>1?4:0)}))}const m=v.useCallback(()=>{a.current||(a.current=!0,e())},[e]);return v.useEffect(()=>{if(n)return Promise.resolve().then(()=>{try{m()}catch{}}),()=>{};const _=h.current.map(T=>T.delay),b=(_.length?Math.max(..._):0)*1e3+900,E=window.setTimeout(m,b);return()=>{window.clearTimeout(E)}},[n,m]),n?null:g.jsx("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:5},children:(()=>{const _=h.current.map(w=>w.delay);return _.length&&Math.min(..._),h.current.map((w,b)=>{const E=c-18,T=d-18,R=u-18+w.yOffset,P=f-18+w.yOffset;return g.jsx(Ks.div,{initial:{x:E,y:R,scale:.85,opacity:0},animate:{x:T,y:P,scale:1.05+b%3*.03,opacity:1},transition:{delay:w.delay,type:"spring",stiffness:150,damping:20,duration:.55+b%4*.03},onAnimationComplete:()=>{b===h.current.length-1&&m()},style:{position:"absolute"},children:g.jsx(Lc,{mini:!0,value:w.value,className:"chip--flight"})},w.id)})})()})}const XC=new Set;function Q_e(t){return XC.add(t),()=>XC.delete(t)}function Z_e(t){t&&XC.forEach(e=>{try{e(t)}catch{}})}function ebe({newSettlements:t,roundSeqNow:e,getAvatarCenter:r,getPlayerName:n,myId:a,bankerDice:i,bankerId:o,isPartyReady:c,onAnimCompleteBySettlement:u}){const[d,f]=v.useState([]),[h,m]=v.useState([]),_=v.useRef(new Set),w=v.useRef(new Set),b=v.useRef(null),E=v.useRef(new Set),T=v.useCallback(D=>(w.current.add(D),D),[]),R=v.useCallback(()=>{w.current.forEach(D=>clearTimeout(D)),w.current.clear(),b.current!=null&&(cancelAnimationFrame(b.current),b.current=null)},[]);v.useEffect(()=>()=>{R()},[R]);const P=v.useCallback(D=>r(D),[r]),A=v.useCallback(D=>$_e(D,P),[P]),C=v.useCallback((D,N=0)=>{if(c&&D?.type==="MAIN"){const Q=D?.playerId,ie=D?.acceptedById||D?.bankerId;if(!(!!Q&&c(Q)&&!!ie&&c(ie))){T(setTimeout(()=>C(D,N),120));return}}const j=D?.acceptedById||D?.bankerId,q=D?.playerId;if(!j||!q){if(N>25)return;const Q=80+N*60;T(setTimeout(()=>C(D,N+1),Q));return}const U=String(D.result||"").toUpperCase();let W,F;if(U==="WIN"?(W=j,F=q):U==="LOSE"&&(W=q,F=j),W&&F){const Q=P(W),ie=P(F);if(!Q||!ie){if(N>25)return;if(N<5&&typeof requestAnimationFrame<"u")b.current=requestAnimationFrame(()=>C(D,N+1));else{const G=80+N*60;T(setTimeout(()=>C(D,N+1),G))}return}}if(N>25)return;const Y=A(D);if(!Y){const Q=80+N*60;N<5&&typeof requestAnimationFrame<"u"?b.current=requestAnimationFrame(()=>C(D,N+1)):T(setTimeout(()=>C(D,N+1),Q));return}f(Q=>[...Q,[Y]])},[A,c,T]);v.useEffect(()=>{if(!t.length)return;const D=y6(t,e,_.current,o);for(const N of D){if(E.current.has(N.id))continue;E.current.add(N.id);const{outcome:L,needsAnimation:j}=FA(N,a);j&&T(setTimeout(()=>C(N),200))}},[t,e,a,o,C]),v.useEffect(()=>{h.length===0&&d.length>0&&(m(d[0]),f(D=>D.slice(1)))},[h.length,d]);const O=v.useCallback(D=>{m(N=>{const L=N.filter(q=>q.id!==D),j=N.find(q=>q.id===D);try{j?.settlementId&&typeof u=="function"&&u(j.settlementId),j?.settlementId&&(Z_e(j.settlementId),_.current.add(j.settlementId))}catch{}return L})},[u]),I=v.useCallback(()=>{R(),f([]),m([]),_.current.clear(),E.current.clear()},[R]),x=v.useCallback(D=>{D?.length&&f(N=>[...N,D])},[]);return{activeBatch:h,handleAnimItemComplete:O,resetForRound:I,queueBatch:x}}function tbe(){const{hasActive:t}=Es(),e=v.useRef([]),r=v.useRef(!1),n=v.useRef(null),a=v.useRef(new Set),i=v.useCallback(()=>{cd("Light").catch(()=>{})},[]),o=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),c=sa?.diceToChipDelayMs+600,u=v.useCallback(()=>{if(r.current)return;r.current=!0;const m=()=>{n.current&&(window.clearTimeout(n.current),n.current=null);const _=e.current;if(!_.length){r.current=!1;return}const w=_[0],b=o();if(b<w.readyAt){n.current=window.setTimeout(m,Math.min(500,Math.max(20,w.readyAt-b)));return}if(w.revealGate){const T=w.revealGate,R=T.challengerId?T.getRevealTime(T.challengerId):void 0,P=T.bankerId?T.getRevealTime(T.bankerId):void 0;if(typeof R=="number"&&typeof P=="number"){const C=Math.max(R,P)+T.postRevealDelayMs;if(b<C){const O=Math.min(C-b,1e3);n.current=window.setTimeout(m,Math.max(50,O));return}}else if(b-w.enqueuedAt<c){n.current=window.setTimeout(m,120);return}}try{i()}catch{}try{w.run()}catch{}const E=_.shift();E?.key&&a.current.add(E.key),n.current=window.setTimeout(m,0)};m()},[i]),d=v.useCallback((m,_)=>{const w=Math.max(0,typeof _?.delayMs=="number"?_.delayMs:0),b=o(),E=b+(_?.immediate?0:w);if(_?.key){if(a.current.has(_.key))return;a.current.add(_.key)}e.current.push({run:m,readyAt:E,revealGate:_?.revealGate,key:_?.key,enqueuedAt:b}),u()},[u]),f=v.useCallback(()=>{n.current&&(window.clearTimeout(n.current),n.current=null),u()},[u]),h=v.useCallback(()=>{n.current&&(window.clearTimeout(n.current),n.current=null),e.current=[],r.current=!1},[]);return{schedule:d,nudge:f,clear:h,hasActive:t}}function rbe({newSettlements:t,roundSeqNow:e,myId:r,bankerDice:n,getPlayerName:a,getPlayerDice:i,getRevealTime:o,postRevealDelayMs:c=0,bankerId:u}){const{win:d,lose:f,push:h}=Es(),m=v.useRef(new Set),{schedule:_,nudge:w}=tbe(),b=v.useRef(null),E=v.useRef(!1),T=v.useRef(!1);v.useRef(new Set);const R=v.useRef(null);v.useEffect(()=>{const C=n;if(!C||C.length!==3){b.current=null,E.current=!1;return}const O={};for(const D of C)O[D]=(O[D]||0)+1;const I=Object.keys(O).map(Number);I.length===2&&I.some(D=>O[D]===1)?b.current=I.find(D=>O[D]===1):b.current=null;try{const D=[...C].sort((N,L)=>N-L).join(",");E.current=D==="4,5,6",T.current=D==="1,2,3"}catch{E.current=!1,T.current=!1}},[n]);const P=v.useCallback((C,O,I,x,D)=>{const N=O?" Clutch":"";x?C==="win"?d(`${x}${N}`):C==="lose"?f(x):h(x):D?C==="win"?d("win",I):C==="lose"?f("lose",I):h("push",I):C==="win"?d(`You Won!${N}`,I):C==="lose"?f("You Lost!",I):h("Push!",I)},[d,f,h]),A=v.useCallback((C,O,I,x,D,N={})=>{const L=O&&(b.current??0)>5&&C==="win";_(()=>P(C,L,I,x,D),N)},[_,P]);v.useEffect(()=>{const C=y6(t,e,m.current,u);if(C.length)for(const O of C){const{outcome:I,isChallenger:x,subtitle:D,needsAnimation:N}=FA(O,r);if(!I)continue;let L=D,j=!1;if(O.type==="SIDE"){const te=O.subjectId&&a(O.subjectId)||O.subjectId||"Player",me=z_e(O.predicate);let ue;I==="win"?ue=`${te} ${me}`:I==="lose"?me==="beats banker"?ue=`${te} does not beat banker`:me==="loses to banker"?ue=`${te} does not lose to banker`:me==="ties banker"?ue=`${te} does not tie banker`:ue=`${te} ${me}`:ue=`${te} ${me}`,L=ue,j=!0}else D&&O.subjectId&&D.includes("on ")&&(L=D.replace(/on \S+$/,`on ${a(O.subjectId)||O.subjectId}`));try{const te=hd(O,r);if(te&&te.label&&!(O.type==="SIDE"&&j)){const ue=String(te.label||"").trim(),Ae=String(L||"").trim();if(Ae.length===0)L=ue;else if(ue.length>0){const He=Ae.toLowerCase(),ce=ue.toLowerCase();He.includes(ce)||(L=`${Ae} — ${ue}`)}}}catch{}I==="push"&&((L||"").trim()||(L="No Action"));const q=O.type==="SIDE"?O.subjectId||void 0:O.playerId,U=O.type==="SIDE"?u:O.acceptedById||O.bankerId||u,W=!!(E.current||T.current),F=W||O.type==="SIDE"?!1:N,Y=W?!0:!F,Q=!W&&F?sa.diceToChipDelayMs+50:0,ie=q,G=U,B=o?sa.revealFlashPostDelayMs:0,K=o&&!W?{getRevealTime:o,challengerId:ie,bankerId:G,postRevealDelayMs:B}:void 0,ae=K?0:F?Q:0;O.type==="MAIN"?_(()=>{let me;try{const He=hd(O,r);me=String(He?.label||"").trim()||void 0}catch{}let ue;try{if(i&&u){const He=i(u),ce=i(O.playerId);if(He&&ce){const xe=kb(He),re=kb(ce);xe.kind==="456"?ue="Banker rolled 4-5-6":xe.kind==="123"?ue="Banker rolled 1-2-3":re.kind==="456"?ue="Challenger rolled 4-5-6":re.kind==="123"?ue="Challenger rolled 1-2-3":xe.kind==="triple"&&re.kind==="point"?ue="Trips beat point":xe.kind==="point"&&re.kind==="triple"?ue="Point loses to trips":xe.kind==="triple"&&re.kind==="triple"?ue=xe.score===re.score?"Equal trips (push)":"Higher trips win":typeof xe.point=="number"&&typeof re.point=="number"&&(xe.point===re.point?ue="Same point (push)":ue=`${Math.max(xe.point,re.point)} beats ${Math.min(xe.point,re.point)}!`),ue||(I==="win"?ue=x?re.label||"Win":xe.label||"Win":I==="lose"?ue=x?xe.label||"Loss":re.label||"Loss":ue=void 0)}}}catch{}let Ae;I==="push"?Ae=ue||me||"No Action":me&&ue?Ae=`${me} ${ue}`:Ae=me||ue,P(I,x,Ae,void 0,j)},{immediate:W?!0:Y&&!K,delayMs:ae,revealGate:K,key:String(O.id)}):A(I,x,L,void 0,j,{immediate:W?!0:Y&&!K,delayMs:ae,revealGate:K,key:String(O.id)})}},[t,e,r,a,A,u]),v.useEffect(()=>{if(!(E.current||T.current)||R.current===e||Array.isArray(t)&&t.some(L=>L?.roundSeq===e))return;const I=E.current,x=I?"Banker 4‑5‑6":"Banker 1‑2‑3",D=u&&r&&u===r,N=I?D?"win":"lose":D?"lose":"win";_(()=>P(N,!1,void 0,x,!0),{immediate:!0,key:`auto-${e}`}),R.current=e},[t,e,r,u,_,P]),v.useEffect(()=>{const C=Q_e(O=>{try{w()}catch{}});return()=>{try{C()}catch{}}},[w])}function _6({open:t,onClose:e,message:r}){if(!t)return null;const n=tn(),a=r||"You must be logged in.",i=v.useCallback(()=>{n("/login")},[n]),o=g.jsxs("div",{className:"results-modal",role:"dialog","aria-modal":"true","aria-label":"Login required",children:[g.jsx("div",{className:"results-modal__backdrop",onClick:e}),g.jsxs("div",{className:"results-modal__card card",onClick:c=>c.stopPropagation(),children:[g.jsxs("div",{className:"results-modal__header",children:[g.jsx("h3",{children:"Login required"}),g.jsx("button",{type:"button","aria-label":"Close",className:"btn btn--ghost",onClick:e,children:"✕"})]}),g.jsxs("div",{style:{padding:16},children:[g.jsx("p",{style:{marginBottom:16},children:a}),g.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[g.jsx("button",{className:"btn btn--ghost",onClick:e,children:"Cancel"}),g.jsx("button",{className:"btn btn--primary",onClick:i,children:"Sign In"})]})]})]})]});return Gc.createPortal(o,document.body)}function nbe({isUserTurn:t=!1,onOpen:e,isConnected:r=!0}){const{micEnabled:n,speaking:a}=mu(),[i,o]=v.useState(!1),c=v.useRef(null),d=v.useCallback(()=>r?n?Object.values(a).some(Boolean)?"speaking":"connected":"muted":"disconnected",[r,n,a])(),f=v.useCallback(()=>{if(!t){try{cr("Light")}catch{}e()}},[t,e]),h=v.useCallback(()=>{c.current=setTimeout(()=>{if(o(!0),t){try{cr("Medium")}catch{}e()}},500)},[t,e]),m=v.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null),setTimeout(()=>o(!1),1500)},[]),_=v.useCallback(()=>{c.current&&(clearTimeout(c.current),c.current=null),o(!1)},[]),w=d==="muted"?"Muted":d==="disconnected"?"Voice disconnected":"Voice connected",b=["comms-btn",`comms-btn--${d}`,t?"comms-btn--turn":""].filter(Boolean).join(" ");return g.jsxs("div",{className:"comms-btn-container",children:[g.jsxs("button",{type:"button",className:b,onClick:f,onPointerDown:h,onPointerUp:m,onPointerLeave:_,onPointerCancel:_,"aria-label":w,"aria-pressed":n,style:{opacity:t?.75:1,pointerEvents:"auto"},children:[d==="speaking"&&g.jsx("span",{className:"comms-btn__pulse","aria-hidden":"true"}),d==="connected"&&g.jsx("span",{className:"comms-btn__ring comms-btn__ring--connected","aria-hidden":"true"}),g.jsxs("span",{className:"comms-btn__icon-wrap",children:[g.jsx(abe,{}),d==="muted"&&g.jsx("span",{className:"comms-btn__slash","aria-hidden":"true"})]})]}),i&&g.jsx("div",{className:"comms-btn__tooltip",role:"tooltip",children:w})]})}function abe(){return g.jsx("svg",{className:"comms-btn__svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:g.jsx("path",{d:"M12 1C7.03 1 3 5.03 3 10v6c0 1.66 1.34 3 3 3h1v-7H5v-2c0-3.87 3.13-7 7-7s7 3.13 7 7v2h-2v7h1c1.66 0 3-1.34 3-3v-6c0-4.97-4.03-9-9-9zM7 14v4H6c-.55 0-1-.45-1-1v-3h2zm12 3c0 .55-.45 1-1 1h-1v-4h2v3z"})})}function ibe({open:t,onClose:e,roomId:r,onLeaveVoice:n,onBlockReport:a}){const{micEnabled:i,setMicEnabled:o,videoEnabled:c,setVideoEnabled:u,leaveRoom:d}=mu(),[f,h]=v.useState(100),m=v.useRef(null),_=v.useCallback(P=>{P.target===P.currentTarget&&e()},[e]);v.useEffect(()=>{if(!t)return;const P=A=>{A.key==="Escape"&&e()};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[t,e]),v.useEffect(()=>{if(!t||!m.current)return;m.current.querySelector('button, input, [tabindex]:not([tabindex="-1"])')?.focus()},[t]);const w=v.useCallback(()=>{try{cr("Light")}catch{}o(!i)},[i,o]),b=v.useCallback(()=>{try{cr("Light")}catch{}u(!c)},[c,u]),E=v.useCallback(P=>{const A=parseInt(P.target.value,10);h(A);try{window.dispatchEvent(new CustomEvent("comms:volume",{detail:{volume:A/100}}))}catch{}},[]),T=v.useCallback(()=>{try{cr("Medium")}catch{}d(r),n?.(),e()},[r,d,n,e]),R=v.useCallback(()=>{try{cr("Medium")}catch{}a?.(),e()},[a,e]);return t?g.jsx("div",{className:"comms-drawer-backdrop",onClick:_,"aria-modal":"true",role:"dialog",children:g.jsxs("div",{ref:m,className:"comms-drawer",role:"document","aria-label":"Communication settings",children:[g.jsx("div",{className:"comms-drawer__handle","aria-hidden":"true"}),g.jsxs("div",{className:"comms-drawer__header",children:[g.jsx("h2",{className:"comms-drawer__title",children:"Voice & Video"}),g.jsx("button",{type:"button",className:"comms-drawer__close",onClick:e,"aria-label":"Close",children:"✕"})]}),g.jsxs("div",{className:"comms-drawer__content",children:[g.jsxs("button",{type:"button",className:`comms-drawer__row comms-drawer__row--toggle ${i?"comms-drawer__row--active":""}`,onClick:w,"aria-pressed":i,children:[g.jsx("span",{className:"comms-drawer__row-icon",children:i?"🎙️":"🔇"}),g.jsx("span",{className:"comms-drawer__row-label",children:i?"Microphone On":"Microphone Off"}),g.jsx("span",{className:`comms-drawer__toggle ${i?"comms-drawer__toggle--on":""}`,children:g.jsx("span",{className:"comms-drawer__toggle-knob"})})]}),g.jsxs("button",{type:"button",className:`comms-drawer__row comms-drawer__row--toggle ${c?"comms-drawer__row--active":""}`,onClick:b,"aria-pressed":c,children:[g.jsx("span",{className:"comms-drawer__row-icon",children:c?"📹":"📷"}),g.jsx("span",{className:"comms-drawer__row-label",children:c?"Camera On":"Camera Off"}),g.jsx("span",{className:`comms-drawer__toggle ${c?"comms-drawer__toggle--on":""}`,children:g.jsx("span",{className:"comms-drawer__toggle-knob"})})]}),g.jsxs("div",{className:"comms-drawer__row comms-drawer__row--slider",children:[g.jsx("span",{className:"comms-drawer__row-icon",children:"🔊"}),g.jsx("span",{className:"comms-drawer__row-label",children:"Volume"}),g.jsx("input",{type:"range",min:"0",max:"100",value:f,onChange:E,className:"comms-drawer__slider","aria-label":"Volume"}),g.jsxs("span",{className:"comms-drawer__slider-value",children:[f,"%"]})]}),g.jsx("hr",{className:"comms-drawer__divider"}),g.jsxs("button",{type:"button",className:"comms-drawer__row comms-drawer__row--danger",onClick:T,children:[g.jsx("span",{className:"comms-drawer__row-icon",children:"🚪"}),g.jsx("span",{className:"comms-drawer__row-label",children:"Leave Voice"})]}),a&&g.jsxs("button",{type:"button",className:"comms-drawer__row comms-drawer__row--danger",onClick:R,children:[g.jsx("span",{className:"comms-drawer__row-icon",children:"🚫"}),g.jsx("span",{className:"comms-drawer__row-label",children:"Block / Report Player"})]})]}),g.jsx("div",{className:"comms-drawer__footer",children:g.jsx("p",{children:"All changes are saved automatically"})})]})}):null}function sbe({roomId:t,isUserTurn:e=!1,leftSlot:r}){mu();const{user:n}=$r(),[a,i]=v.useState(!1),[o,c]=v.useState(!1),[u,d]=v.useState(mG()),f=(()=>{try{return n?.isGuest===!0}catch{return!1}})(),h=v.useCallback(_=>()=>{try{cr("Light")}catch{}try{}catch{}_()},[]);v.useEffect(()=>{let _=!0;return(async()=>{try{const w=await nu();if(!_)return;const b=!!w.diceAudio;d(b),uO(b)}catch{}})(),()=>{_=!1}},[]),h(()=>{const _=!u;if(d(_),uO(_),_)try{Xr()}catch{}(async()=>{try{const b={...await nu(),diceAudio:_};await g0(b)}catch{}})()}),v.useMemo(()=>u?"Mute sounds":"Unmute sounds",[u]);const m=v.useCallback(()=>{if(f){i(!0);return}c(!0)},[f]);return g.jsxs(g.Fragment,{children:[r,g.jsx("div",{className:"poker-header-comms",role:"group","aria-label":"communications controls",children:g.jsx(nbe,{isUserTurn:e,onOpen:m,isConnected:!!t})}),g.jsx(ibe,{open:o,onClose:()=>c(!1),roomId:t}),g.jsx(_6,{open:a,onClose:()=>i(!1)})]})}const b6=v.createContext(void 0),obe=({children:t})=>{const[e,r]=v.useState([]),[n,a]=v.useState(null),{sendGameInvite:i,respondGameInvite:o}=pa(),c=ou();Pa({onGameInviteReceived:m=>{const _={inviteId:m.inviteId,fromUserId:m.fromUserId,fromUserName:m.fromUserName,roomId:m.roomId,roomName:m.roomName,gameMode:m.gameMode,receivedAt:Date.now()};r(w=>[...w,_]),a(w=>w||_)}}),v.useEffect(()=>{const m=setInterval(()=>{const _=Date.now(),w=120*1e3;r(b=>b.filter(E=>_-E.receivedAt<w))},1e4);return()=>clearInterval(m)},[]);const u=v.useCallback(async(m,_,w)=>{try{const b=await i(m,_,w);if(b&&b.ok)return c?.success("Invite sent!"),{ok:!0};{const E=b?.error||"Failed to send invite";return c?.error(E),{ok:!1,error:E}}}catch(b){const E=b?.message||"Failed to send invite";return c?.error(E),{ok:!1,error:E}}},[i,c]),d=v.useCallback(async m=>{const _=e.find(w=>w.inviteId===m);if(!_)return{ok:!1};try{const w=await o(m,"accept");return w&&w.ok?(r(b=>b.filter(E=>E.inviteId!==m)),a(null),{ok:!0,roomId:_.roomId,gameMode:_.gameMode}):{ok:!1}}catch{return{ok:!1}}},[e,o]),f=v.useCallback(m=>{o(m,"decline").catch(()=>{}),r(_=>_.filter(w=>w.inviteId!==m)),a(_=>_?.inviteId===m?e.filter(b=>b.inviteId!==m)[0]||null:_)},[e,o]),h=v.useCallback(()=>{n&&f(n.inviteId)},[n,f]);return g.jsx(b6.Provider,{value:{pendingInvites:e,currentInvite:n,sendInvite:u,acceptInvite:d,declineInvite:f,dismissCurrentInvite:h},children:t})};function k6(){return v.useContext(b6)}function cbe({roomId:t,gameMode:e,className:r}){const[n,a]=v.useState(!1),[i,o]=v.useState(null),[c,u]=v.useState(new Set),d=v.useRef(null),f=k6(),{friends:h}=BA();v.useEffect(()=>{if(!n)return;const b=T=>{T.key==="Escape"&&a(!1)},E=T=>{d.current&&!d.current.contains(T.target)&&a(!1)};return document.addEventListener("keydown",b),document.addEventListener("mousedown",E),()=>{document.removeEventListener("keydown",b),document.removeEventListener("mousedown",E)}},[n]);const m=async b=>{if(f){o(b);try{(await f.sendInvite(t,b,e)).ok&&u(T=>new Set([...T,b]))}finally{o(null)}}},_=b=>{switch(b){case"cee-lo":return"Cee-Lo";case"craps":return"Craps";case"poker":return"Poker";default:return b}};if(!f)return null;const w=n?g.jsx("div",{className:"modal-backdrop",role:"presentation",style:{position:"fixed",inset:0,zIndex:99998,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Invite friends",ref:d,style:{maxWidth:360,maxHeight:"80vh",overflow:"auto",position:"relative",background:"linear-gradient(135deg, #1a1a2e 0%, #16213e 100%)",borderRadius:12,padding:"24px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.5)",border:"1px solid rgba(255, 215, 0, 0.2)",color:"#fff"},children:[g.jsx("button",{className:"modal-close",onClick:()=>a(!1),"aria-label":"Close",style:{position:"absolute",top:8,right:8,background:"none",border:"none",color:"#fff",fontSize:"1.5rem",cursor:"pointer",opacity:.7},children:"×"}),g.jsxs("h3",{className:"modal-title",style:{marginBottom:16,textAlign:"center"},children:["Invite Friends to ",_(e)]}),h.length===0?g.jsxs("p",{style:{textAlign:"center",opacity:.7,padding:"20px 0"},children:["You don't have any friends yet.",g.jsx("br",{}),"Add friends from your profile to invite them to games!"]}):g.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:h.map(b=>{const E=c.has(b.id),T=i===b.id;return g.jsxs("li",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",borderBottom:"1px solid rgba(255,255,255,0.1)"},children:[g.jsx("span",{style:{fontWeight:500},children:b.name||"Anonymous"}),E?g.jsx("span",{style:{color:"var(--success, #4caf50)",fontSize:"0.875rem"},children:"✓ Invited"}):g.jsx("button",{className:"felt-btn felt-btn--sm felt-btn--primary",onClick:()=>m(b.id),disabled:T,style:{minWidth:70},children:T?"...":"Invite"})]},b.id)})}),g.jsx("div",{style:{marginTop:20,textAlign:"center"},children:g.jsx("button",{className:"felt-btn btn--ghost",onClick:()=>a(!1),children:"Close"})})]})}):null;return g.jsxs(g.Fragment,{children:[g.jsx("button",{className:`felt-btn felt-btn--sm felt-btn--icon ${r||""}`,onClick:()=>a(!0),title:"Invite a friend to this game","aria-label":"Invite friend",style:{padding:"6px 10px",fontSize:"1.1rem",lineHeight:1},children:"+"}),w&&Gc.createPortal(w,document.body)]})}function zA(t){const{roomName:e,players:r,bankerId:n,currentRollerId:a,meId:i,gameState:o,roomId:c,onOpenDM:u,onOpenSendMoney:d,showHeader:f=!0,className:h,lite:m=!1,headerExtras:_,hideDiceResults:w,disableBankerFlash:b,crapsRollHistory:E,lastRollerId:T,hideSideBets:R,renderFacesOverride:P,headerCommsLeftSlot:A}=t;if(m)return g.jsx(g6,{players:r,meId:i,className:h,onOpenDM:u,onOpenSendMoney:d});const{handleLeave:C}=LA(c,i,{autoJoin:!1}),O=tn(),{onBuyChips:I,busy:x,ready:D,purchasesReady:N,isWeb:L}=jg(),{onHandEnd:j}=w0(),q=mu(),{remoteStreams:U,myVideo:W,remoteVideoFlags:F}=q,{proofs:Y,reveals:Q,verifyFor:ie}=Xz(c),{user:G,refreshUser:B}=$r(),K=(()=>{try{return G?.isGuest===!0}catch{return!1}})(),[ae,te]=v.useState(!1),[me,ue]=v.useState({}),{settledAll:Ae,playerBalance:He,mySettledAll:ce,newSettlements:xe,openAllMain:re}=y0(c,i),{leaveRoom:H}=pa();o?.betsLocked;const he=v.useCallback(()=>{if(o?.gameMode==="poker"){c&&H(c),O("/lobby");return}C()},[o,c,H,O,C]),Re=v.useCallback(_e=>()=>{try{cr("Light")}catch{}try{}catch{}_e()},[]),fe=v.useMemo(()=>r.find(_e=>_e.id===i)?.balance,[r,i]),Ie=o?.gameMode,ct=(()=>{const _e=typeof He=="number"?He:void 0,Ze=typeof fe=="number"?fe:void 0;return Ie==="craps"?Ze??_e??0:_e??Ze??0})(),[$e,tt]=v.useState(ct),[We,it]=v.useState(!1),Et=v.useRef(ct),Mt=v.useRef(new Set),_t=v.useRef({}),ge=v.useRef(!1);v.useEffect(()=>{Et.current!==ct&&(Et.current=ct,tt(ct))},[ct]);const Be=v.useMemo(()=>{if(o?.gameMode!=="poker")return null;const Ze=Array.isArray(o?.pokerSeats)?o.pokerSeats:[],ot=new Set;for(const Je of Ze)Je?.playerId&&ot.add(String(Je.playerId));return ot},[o?.gameMode,o?.pokerSeats]),je=v.useCallback(_e=>{if(o?.gameMode==="poker"){const ot=typeof _e.balance=="number"?_e.balance:0,Nt=(Array.isArray(o?.pokerSeats)?o.pokerSeats:[]).find(Or=>Or.playerId===_e.id);if(Nt&&typeof Nt.stack=="number")return Math.max(0,Nt.stack);const $t=typeof Nt?.committed=="number"?Nt.committed:0;return Math.max(0,ot-$t)}return _e.id===i?Number($e??0):typeof _e.balance=="number"?_e.balance:0},[o,i,$e]),rt=v.useMemo(()=>{const _e=o?.gameMode;return _e==="poker"?Be?r.filter(ot=>Be.has(ot.id)):r:_e==="craps"||o?.mode==="single"||t.roomId?.includes("single")?r:r.filter(ot=>ot.id===i||ot.id?.startsWith("bot_")||ot.id?.startsWith("craps_bot_")?!0:je(ot)>0)},[r,Be,o?.gameMode,o?.mode,i,je,t.roomId]),Ct=v.useMemo(()=>Object.fromEntries(rt.map(_e=>[_e.id,_e])),[rt]),jt=v.useRef(void 0),De=v.useRef(new Map);v.useEffect(()=>{if(o?.gameMode!=="poker")return;const Ze=t.roomId||"unknown";jt.current!==Ze&&(jt.current=Ze,De.current=new Map);const ot=De.current;let Je=-1;ot.forEach(Nt=>{Nt>Je&&(Je=Nt)});for(const Nt of rt)ot.has(Nt.id)||(Je+=1,ot.set(Nt.id,Je))},[rt,t.roomId,o?.gameMode]);const nt=v.useMemo(()=>{if(o?.gameMode==="poker"){const $t=De.current;return rt.map(Or=>Or.id).slice().sort((Or,rn)=>($t.get(Or)??0)-($t.get(rn)??0))}const Ze=Array.isArray(o?.turnOrder)?o.turnOrder:[];if(!Ze.length)return r.map($t=>$t.id);const ot=new Set(r.map($t=>$t.id)),Je=Ze.filter($t=>ot.has($t)),Nt=r.map($t=>$t.id).filter($t=>!Je.includes($t));return[...Je,...Nt]},[rt,r,o?.turnOrder,o?.gameMode]),at=o.roundSeq??1;v.useEffect(()=>{if(!(!xe||!xe.length)){for(const _e of xe){if(!_e||_e.roundSeq!==at||Mt.current.has(_e.id))continue;const Ze={..._e,type:_e.type||(_e.predicate||_e.subjectId?"SIDE":"MAIN")},ot=FA(Ze,i);if(!ot.outcome)continue;Mt.current.add(_e.id);let Je=0,Nt=0;try{const Tn=hd(_e,i);Tn&&(Tn.myResult==="WIN"?Je=Tn.myPayout||0:Tn.myResult==="LOSE"&&(Nt=_e.amount||0))}catch{}const $t=Je>0?Je:Nt>0?-Nt:0;if($t===0)continue;const Or=ot.needsAnimation?2e3:0,rn=window.setTimeout(()=>{tt(Tn=>Tn+$t),it(!0),window.setTimeout(()=>it(!1),2e3),delete _t.current[_e.id]},Or);_t.current[_e.id]=rn}return()=>{Object.values(_t.current).forEach(_e=>window.clearTimeout(_e)),_t.current={}}}},[xe,at,i,B]);const we=v.useMemo(()=>typeof o.roundSeq=="number"?(o.turnHistory??[]).filter(_e=>_e.roundSeq===o.roundSeq):o.turnHistory??[],[o.turnHistory,o.roundSeq]),[st,bt]=v.useState(!1),[nr,ur]=v.useState(0),[dr,Sr]=v.useState(void 0);v.useEffect(()=>{if(!(!xe||!xe.length||o?.gameMode==="poker"))for(const Ze of xe){if(!Ze||Ze.roundSeq!==at||Ze.playerId!==i)continue;const ot=hd(Ze,i);if(ot&&ot.myResult==="LOSE"){const Je=Number(Ze.amount||0);ur(Je>0?Je:0),Sr(void 0),bt(!0);break}}},[xe,at,i,o]);const[un,Z]=v.useState(null),[X,le]=v.useState(null),[be,z]=v.useState(!1),[ee,se]=v.useState(!1),Oe=v.useRef(null),[wt,er]=v.useState(new Map),{sendVisibilityChange:Qt}=pa();v.useEffect(()=>{Z(null)},[c]);const Zt=v.useCallback(async()=>{if(c)try{const _e=await R_e(c);_e&&Z(_e)}catch{}},[c]),oa=v.useCallback(async()=>{if(c)try{z(!0);const _e=await D_e(c);le(_e||null)}catch{le(null)}finally{z(!1)}},[c]);v.useEffect(()=>{ee&&o?.gameMode==="craps"&&Zt()},[ee,o,Zt]),v.useEffect(()=>{if(!c||!Y||typeof Y!="object")return;let _e=!1;const Ze=at,ot=`${Ze}:`,Je=Object.keys(Y||{}).filter(Nt=>Nt.startsWith(ot));if(Je.length)return Je.forEach(Nt=>{const $t=Nt.split(":")[1];$t&&(async()=>{try{const Or=await ie($t,Ze);_e||ue(rn=>rn[Nt]===Or?rn:{...rn,[Nt]:Or})}catch{_e||ue(Or=>Or[Nt]==="unverifiable"?Or:{...Or,[Nt]:"unverifiable"})}})()}),()=>{_e=!0}},[Y,Q,ie,c,at]);const On=v.useMemo(()=>{if(!n)return null;for(let _e=we.length-1;_e>=0;_e--){const Ze=we[_e];if(Ze.playerId===n&&Array.isArray(Ze.result)&&Ze.result.length===3){const ot=Ze.result;if(wm(ot)!=="nothing")return ot}}if(o.bankRoll?.raw&&Array.isArray(o.bankRoll.raw)&&o.bankRoll.raw.length===3){const _e=o.bankRoll.raw;if(wm(_e)!=="nothing")return _e}return null},[n,we,o.bankRoll]),{revealedPlayers:Ye,revealTimesRef:Yt}=F_e(we,n,o,at),{show:At,activeKind:Rt,hasActive:Dt,onIdle:Nn,info:dn}=Es(),jr=v.useRef(new Set),Ra=v.useRef(!1);v.useEffect(()=>{if(!Ra.current){const _e=new Set(r.map(Ze=>String(Ze.id)));jr.current=_e,Ra.current=!0}},[r]);const oo=v.useRef(new Map),pn=v.useRef({}),ec=v.useMemo(()=>{const _e=new Map;try{const Ze=Array.isArray(re)?re:[];for(const ot of Ze){const Je=ot?.roundSeq;typeof Je=="number"&&Je!==at||ot&&ot.playerId&&typeof ot.amount=="number"&&_e.set(ot.playerId,ot.amount)}}catch{}return _e},[re,at]);v.useEffect(()=>{try{for(const _e of r){const Ze=String(_e.id);if(!Ye.get(Ze))continue;const ot=ME(Ze,we,n,o.bankRoll,On);if(!ot||ot.length!==3)continue;const Je=`${at}:${[...ot].sort((rn,Tn)=>rn-Tn).join("")}`;if(oo.current.get(Ze)===Je)continue;oo.current.set(Ze,Je);const $t=pn.current[Ze];$t&&(window.clearTimeout($t),pn.current[Ze]=null);const Or=_e?.name||_e?.email||Ze;pn.current[Ze]=window.setTimeout(()=>{const rn=()=>{const Tn=kb(ot);At({kind:"roll",title:String((n&&Ze===n?"Banker":Or)||Ze),subtitle:`${Tn.label}`,duration:500})};Dt&&["win","lose","push"].includes(Rt||"")?Nn(rn):rn(),pn.current[Ze]=null},1e3)}}catch{}return()=>{try{Object.values(pn.current).forEach(_e=>{_e&&window.clearTimeout(_e)}),pn.current={}}catch{}}},[r,Ye,we,n,On,at,Dt,Rt,Nn,At,o.bankRoll]);const zi=v.useRef({});v.useRef(0),v.useRef(null),Pa({onOtherPlayerJoined:({room:_e})=>{try{if(!_e||!Array.isArray(_e.players))return;const Ze=jr.current,ot=new Set(_e.players.map(Nt=>String(Nt.id)));if(!Ra.current){jr.current=ot,Ra.current=!0;return}const Je=[...ot].filter(Nt=>!Ze.has(Nt));if(Je.length>0){const Nt=new Map(_e.players.map($t=>[String($t.id),$t]));for(const $t of Je){if($t===i)continue;const Or=Nt.get($t),rn=Or?.name||Or?.email||$t;try{dn&&dn("Player Joined",String(rn))}catch{}}}jr.current=ot}catch{}},onOtherLeft:({room:_e})=>{try{if(!_e||!Array.isArray(_e.players))return;const Ze=jr.current,ot=new Set(_e.players.map(Nt=>String(Nt.id)));if(!Ra.current){jr.current=ot,Ra.current=!0;return}const Je=[...Ze].filter(Nt=>!ot.has(Nt));if(Je.length>0){const Nt=new Map;try{r.forEach($t=>Nt.set(String($t.id),$t.name||$t.email||String($t.id)))}catch{}for(const $t of Je){if($t===i)continue;const Or=Nt.get($t)||$t;try{dn&&dn("Player Left",String(Or))}catch{}}}jr.current=ot}catch{}},onPlayerBalanceUpdated:({playerId:_e,balance:Ze})=>{_e===i&&(Object.values(_t.current).forEach(ot=>window.clearTimeout(ot)),_t.current={},Mt.current.clear(),ge.current=!0,Et.current=Ze,tt(Ze),it(!0),window.setTimeout(()=>it(!1),2e3))},onCrapsBetResults:_e=>{!_e||_e.roomId!==c||(Oe.current&&window.clearTimeout(Oe.current),Oe.current=window.setTimeout(()=>{Zt()},350))},onCrapsBetsUpdate:_e=>{!_e||_e.roomId!==c||(Oe.current&&window.clearTimeout(Oe.current),Oe.current=window.setTimeout(()=>{Zt()},250))},onCrapsPointSet:_e=>{!_e||_e.roomId!==c||(Oe.current&&window.clearTimeout(Oe.current),Oe.current=window.setTimeout(()=>{Zt()},300))},onCrapsPointMade:_e=>{!_e||_e.roomId!==c||(Oe.current&&window.clearTimeout(Oe.current),Oe.current=window.setTimeout(()=>{Zt()},300))},onPlayerPresenceUpdate:_e=>{if(!_e||_e.roomId!==c)return;const{playerId:Ze,status:ot}=_e;!Ze||!ot||er(Je=>{const Nt=new Map(Je);return Nt.set(Ze,ot),Nt})}}),v.useEffect(()=>()=>{Oe.current&&window.clearTimeout(Oe.current)},[]),v.useEffect(()=>{if(!c)return;const _e=()=>{const ot=!document.hidden;Qt(c,ot)};Qt(c,!document.hidden),document.addEventListener("visibilitychange",_e);let Ze=null;return(async()=>{try{const{App:ot}=await qr(async()=>{const{App:Je}=await Promise.resolve().then(()=>KG);return{App:Je}},void 0,import.meta.url);Ze=await ot.addListener("appStateChange",Je=>{Qt(c,Je.isActive)})}catch{}})(),()=>{document.removeEventListener("visibilitychange",_e),Ze&&typeof Ze.remove=="function"&&Ze.remove()}},[c,Qt]);const Ts=v.useCallback(_e=>{let Ze=zi.current[_e];if(Ze&&Ze.getAttribute("data-player-id")!==_e&&(Ze=null),!Ze)try{const Nt=window.CSS&&typeof window.CSS.escape=="function"?window.CSS.escape(_e):String(_e).replace(/[^a-zA-Z0-9_-]/g,"_");Ze=document.querySelector(`.players.players--avatars [data-player-id="${Nt}"]`)}catch{}if(!Ze)return null;const ot=Ze.querySelector(".avatar-ring");let Je=null;if(ot)Je=ot.getBoundingClientRect();else try{Je=Ze.getBoundingClientRect()}catch{}return!Je||Je.width===0&&Je.height===0?null:{x:Je.left+Je.width/2,y:Je.top+Je.height/2}},[]),_i=v.useRef(we.length),Qn=v.useRef(null),hn=v.useRef(null),Cs=v.useRef(null);v.useEffect(()=>{_i.current=we.length},[at]),v.useEffect(()=>{Cs.current=null},[at]);const{forUserId:xs,anchorRect:Ps,anchorEl:$i,openFor:jp,close:bd}=UA(),kd=(_e,Ze)=>{!Ze||_e===i||jp(_e,Ze)},Lp=()=>bd(),tc=v.useMemo(()=>{const _e=new Map;for(const Ze of r)_e.set(Ze.id,Ze.name||Ze.email||Ze.id);for(const Ze of Ae){const ot=Ze?.playerId,Je=Ze?.bankerId;ot&&!_e.has(ot)&&_e.set(ot,ot),Je&&!_e.has(Je)&&_e.set(Je,Je)}return _e},[r,Ae]),co=v.useCallback(_e=>tc.get(_e||"")||_e||"Unknown",[tc]),ma=v.useCallback(_e=>co(_e),[co]),ga=v.useCallback(_e=>ME(_e,we,n,o.bankRoll,On),[we,n,o.bankRoll,On]);rbe({newSettlements:xe,roundSeqNow:at,myId:i,bankerDice:On,getPlayerName:ma,getPlayerDice:ga,getRevealTime:_e=>Yt?.current?.get?.(_e),postRevealDelayMs:0,bankerId:n});const Ba=v.useRef(null);v.useEffect(()=>{!(o?.gameMode==="cee-lo"||o?.gameMode==="ceeLo"||!o?.gameMode)||!xe.length||!xe.filter(ot=>ot.playerId===i||ot.bankerId===i).length||Ba.current!==at&&(Ba.current=at,setTimeout(async()=>{try{await j()}catch{}},2500))},[xe,at,i,o,j]);const Kc=o?.gameMode==="cee-lo"||o?.gameMode==="ceeLo"||!o?.gameMode,yu=o?.gameMode==="craps",Yc=v.useCallback(_e=>{if(!Kc)return!0;if(!_e||!(Ye.get(_e)===!0))return!1;const ot=Yt?.current?.get?.(_e);return(typeof ot=="number"?performance.now()-ot:0)>=sa.diceToChipDelayMs},[Kc,Ye,Yt]),{activeBatch:lo,handleAnimItemComplete:wd,resetForRound:ca}=ebe({newSettlements:xe,roundSeqNow:at,getAvatarCenter:Ts,getPlayerName:ma,myId:i,bankerDice:On,bankerId:n,isPartyReady:Yc});v.useEffect(()=>{ca()},[at,ca]);const uo=v.useRef(null),bi=v.useRef(null),Xc=v.useMemo(()=>{if(o?.gameMode==="poker"){const Ze=Number(o?.pokerUiLockedUntilTs||0),ot=Ze>0&&Date.now()<Ze,Je=7e3;ot&&uo.current==null&&(uo.current=Date.now());const Nt=uo.current||0,$t=Nt>0?Date.now()-Nt:Number.POSITIVE_INFINITY,Or=ot&&$t<=Je,rn=Array.isArray(o?.pokerSeats)?o.pokerSeats:[],Tn=typeof o?.pokerActingSeat=="number"?o.pokerActingSeat:void 0,la=typeof Tn=="number"&&rn.find(As=>As.seatIndex===Tn)?.playerId||null;return Or?bi.current??la??null:(bi.current=la??null,uo.current=null,la??null)}return(o?.currentRollerId??a)||null},[o?.gameMode,o?.pokerSeats,o?.pokerActingSeat,o?.currentRollerId,a]);return v.useEffect(()=>{const _e=hn.current,Ze=Xc||void 0;if(!_e||!Ze||Cs.current===Ze)return;const ot=zi.current[Ze];if(!ot)return;const Je=()=>{try{const Nt=Math.max(0,Math.min(ot.offsetLeft-_e.clientWidth/2+ot.offsetWidth/2,_e.scrollWidth-_e.clientWidth));_e.scrollTo({left:Nt,behavior:"smooth"}),Cs.current=Ze}catch{}};return Qn.current&&clearTimeout(Qn.current),Qn.current=setTimeout(()=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(Je):Je()},100),()=>{Qn.current&&(clearTimeout(Qn.current),Qn.current=null)}},[Xc,nt]),g.jsxs("div",{className:["card",h].filter(Boolean).join(" "),style:{position:"relative"},children:[f&&g.jsx("div",{className:"card-header card-header--two-rows",children:g.jsxs("div",{className:"card-header-row",children:[g.jsxs("div",{className:"header-slot header-slot--left",children:[g.jsx("a",{className:"gold-link white-link",onClick:Re(he),"aria-label":"Back",style:{display:"flex"},children:g.jsx(_d,{className:"icon",style:{color:"var(--gold, #caa64d)"}})}),(()=>{const _e=x||!D||!N,Ze=_e?"Balance (login to Buy 1000 Z Credits)":L?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",ot=_e?"Login to Buy 1000 Z Credits":L?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",Je=Re(()=>{if(K){te(!0);return}I()});return g.jsx("a",{className:"gold-link balance-display"+(_e?" disabled":"")+(We?" balance--pulse":""),role:"button","aria-label":Ze,title:ot,"aria-disabled":_e||void 0,onClick:Je,children:g.jsxs("b",{children:[g.jsx("span",{className:"lowercase",children:"z"}),td.formatMoney($e,"",0)]})})})(),g.jsx("a",{role:"button",className:"gold-link white-link"+(t.historyHalo?" history-halo":""),onClick:Re(()=>{if(K){te(!0);return}const _e=o?.gameMode;_e==="craps"?(Zt(),se(!0)):_e==="poker"?t.onOpenHistory&&t.onOpenHistory():oa().then(()=>se(!0))}),"aria-haspopup":"dialog","aria-controls":"my-bets-modal",children:"History"})]}),g.jsxs("div",{className:"header-slot header-slot--right",children:[c&&!K&&!t.singlePlayer&&g.jsx(cbe,{roomId:c,gameMode:o?.gameMode||"cee-lo"}),g.jsx(sbe,{roomId:c,leftSlot:A}),_?g.jsx("div",{className:"panel-header-extras",children:_}):null]})]})}),lo.length>0&&g.jsxs("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:1e4},children:[lo.map(_e=>g.jsx(v6,{anim:_e,onComplete:()=>wd(_e.id)},_e.id)),!1]}),g.jsx("div",{className:"chip-fly-container",children:g.jsx(Ks.ul,{className:"players players--avatars",role:"list",ref:hn,layout:!0,transition:{type:"spring",stiffness:420,damping:38,mass:.6},children:nt.map(_e=>{const Ze=o?.currentRollerId??a,ot=Ct[_e];if(!ot)return null;const Je=ot.id,Nt=[];if(o?.gameMode==="poker"){const Lr=o,Zn=Array.isArray(Lr.pokerSeats)?Lr.pokerSeats:[],ea=typeof Lr.pokerDealerSeat=="number"?Lr.pokerDealerSeat:void 0,Ua=Zn.find(Da=>Da.playerId===Je);if(Ua&&typeof ea=="number"){Ua.seatIndex===ea&&Nt.push("D");const Da=Zn.filter(Fn=>!!Fn.playerId).map(Fn=>Fn.seatIndex).sort((Fn,Hi)=>Fn-Hi),ta=Da.length;if(ta>=2){const Fn=Da.indexOf(ea);if(Fn!==-1){let Hi,rc;ta===2?(Hi=ea,rc=Da[(Fn+1)%ta]):(Hi=Da[(Fn+1)%ta],rc=Da[(Fn+2)%ta]),Ua.seatIndex===Hi&&Nt.push("SB"),typeof rc=="number"&&Ua.seatIndex===rc&&Nt.push("BB")}}}}Je===Ze&&!Ye.get(Je)&&Nt.push("Rolling"),Je===Ze&&Nt.push("Shooter");let $t=!1;if(o?.gameMode==="poker"){const Lr=o,Zn=typeof Lr.pokerActingSeat=="number"?Lr.pokerActingSeat:void 0;typeof Zn=="number"&&Array.isArray(Lr.pokerSeats)&&($t=Lr.pokerSeats.find(Ua=>Ua.seatIndex===Zn)?.playerId===Je)}else $t=Je===Ze;let Or=!1;if(o?.gameMode==="poker"){const Zn=(Array.isArray(o?.pokerSeats)?o.pokerSeats:[]).find(ea=>ea.playerId===Je);Zn&&String(Zn.status||"").toLowerCase()==="folded"&&(Or=!0)}const rn=Je===i?W:U[Je],Tn=F[Je]?rn:void 0,la=!w&&Ye.get(Je)?ME(Je,we,n,o.bankRoll,On):null;let As=!w&&la&&Array.isArray(la)&&la.length===3&&!la.every(Lr=>Lr===0)&&wm(la)!=="nothing"?g.jsx(J_e,{dice:la}):null;const Jc=(o.spectators??[]).includes(Je);let Rs;if(P)Rs=P(ot);else if(Jc)Rs=null;else if(Kc&&!Ye.get(Je)){const Lr=ec.get(Je);Rs=typeof Lr=="number"&&Lr>0?g.jsxs("span",{className:"player-bet-pill","aria-label":`Bet z${td.formatMoney(Lr,"",0)}`,children:["z",td.formatMoney(Lr,"",0)]}):null}else Rs=As;const ki=o?.gameMode==="poker",wi=yu&&(Je.startsWith("craps_bot_")||Je.startsWith("bot_")),Vi=je(ot),fo=wi?void 0:Number.isFinite(Vi)?Vi:void 0;return g.jsx(L_e,{ref:Lr=>{zi.current[Je]=Lr},id:Je,display:ot.name??ot.email??Je,isCurrentRoller:$t,isMe:Je===i,balance:fo,isSpectating:Jc,folded:Or,tags:Nt,stream:Tn,isMuted:Je===i,diceResult:Rs,onOpenMenu:(Lr,Zn)=>kd(Lr,Zn),showMenu:xs===Je,menuProps:xs===Je?{targetId:Je,anchorRect:Ps,anchorEl:$i,onClose:Lp,onOpenDM:u,onOpenSendMoney:d,meId:i}:null,forceHideVideo:!F[Je],avatarUrl:ot.avatarUrl,showActingTimerRing:ki,presenceStatus:wt.get(Je)},Je)})})}),ee&&g.jsx(f4,{onClose:()=>se(!1),items:Array.isArray(X)&&X.length>0?X:ce,meId:i,nameOf:co,crapsRollHistory:E,gameMode:o?.gameMode,crapsLedgerItems:(un||[]).slice().sort((_e,Ze)=>Number(Ze.ts)-Number(_e.ts))}),g.jsx(_6,{open:ae,onClose:()=>te(!1),message:"This feature is for logged in users."})]})}function lbe(t){const{gameState:e,roomId:r,meId:n}=t,{show:a,hasActive:i,activeKind:o,onIdle:c,rollNow:u}=Es(),{onHandEnd:d}=w0(),f=v.useRef(null),h=v.useRef(new Set),m=v.useRef(null),_=v.useRef(null),w=v.useRef(null),b=v.useRef(null),E=v.useRef(null),T=v.useRef(null),{reveal:R}=Xo(),{recentSettlements:P,lastSettlementRoll:A,pointSetEvent:C,pointMadeEvent:O}=Yz({roomId:r||null,myPlayerId:n}),I=v.useCallback((x,D,N,L,j)=>{if(f.current===j||h.current.has(j))return;(()=>{f.current=j,h.current.add(j),a({kind:x==="roll"?"roll":x,title:D,subtitle:N,duration:L})})()},[a]);return v.useEffect(()=>{if(!C||!r||C.roomId!==r)return;const x=C._key;f.current===x||h.current.has(x)||(m.current={key:x,point:C.point},_.current&&clearTimeout(_.current),R&&(_.current=setTimeout(()=>{const D=m.current;if(D){if(h.current.has(D.key)){m.current=null;return}f.current=D.key,h.current.add(D.key);try{hO({volume:.15})}catch{}typeof u=="function"?u("Point Established",`${D.point} is the point`):a({kind:"roll",title:"Point Established",subtitle:`${D.point} is the point`,duration:1e3}),m.current=null}},sa.revealFlashPostDelayMs)))},[C,r,u,a,R]),v.useEffect(()=>{!R||!m.current||(_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{const D=m.current;if(D){if(h.current.has(D.key)){m.current=null;return}f.current=D.key,h.current.add(D.key);try{hO({volume:.15})}catch{}typeof u=="function"?u("Point Established",`${D.point} is the point`):a({kind:"roll",title:"Point Established",subtitle:`${D.point} is the point`,duration:1e3}),m.current=null}},sa.revealFlashPostDelayMs))},[R,u,a]),v.useEffect(()=>{O&&(!r||O.roomId!==r||(w.current={key:O._key,point:O.point},b.current&&clearTimeout(b.current),R&&(b.current=setTimeout(()=>{const x=w.current;if(x){if(h.current.has(x.key)){w.current=null;return}I("win","Point Made!",`${x.point} hit`,1300,x.key);try{mO({sfxVolume:.15,voiceVolume:.55})}catch{}w.current=null}},sa.revealFlashPostDelayMs))))},[O,r,I,R]),v.useEffect(()=>{!R||!w.current||(b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{const D=w.current;if(D){if(h.current.has(D.key)){w.current=null;return}I("win","Point Made!",`${D.point} hit`,1300,D.key);try{mO({sfxVolume:.15,voiceVolume:.55})}catch{}w.current=null}},sa.revealFlashPostDelayMs))},[R,I]),v.useEffect(()=>()=>{_.current&&clearTimeout(_.current),b.current&&clearTimeout(b.current),T.current&&clearTimeout(T.current)},[]),v.useEffect(()=>{if(!P.length)return;const x=(()=>{try{return typeof window<"u"&&(window.__E2E===!0||window.location?.search?.includes("e2e=1"))}catch{return!1}})(),D=n||(x?e?.currentRollerId||"e2e-user":void 0),N=fe=>{const Ie=fe.betType;return Ie==="pass"||Ie==="dontPass"||Ie.startsWith("place")||Ie==="field"||Ie==="big6"||Ie==="big8"||Ie==="come"||Ie==="dontCome"},L=P.filter(fe=>(D?fe.playerId===D:!0)&&N(fe));if(!L.length)return;const j=A?._seq||0,q=typeof A?.total=="number"?A.total:Array.isArray(A?.dice)?A.dice[0]+A.dice[1]:"",U=L.map(fe=>`${fe.betType}:${fe.outcome}:${fe.amount}:${fe.payout}`).sort().join("|"),W=`${j}:${q}:${U}`;if(E.current===W)return;E.current=W;const F=L.filter(fe=>fe.betType==="pass"||fe.betType==="dontPass"),Y=L.filter(fe=>fe.betType.startsWith("place")&&fe.outcome==="WIN"),Q=L.filter(fe=>fe.betType==="field"),ie=L.filter(fe=>fe.betType==="big6"||fe.betType==="big8"),G=L.filter(fe=>fe.betType==="come"||fe.betType==="dontCome"),B=F.some(fe=>fe.outcome==="WIN"),K=Y.length>0,ae=Q.some(fe=>fe.outcome==="WIN"),te=ie.some(fe=>fe.outcome==="WIN"),me=G.some(fe=>fe.outcome==="WIN"),ue=F.some(fe=>fe.outcome==="LOSE"),Ae=Q.some(fe=>fe.outcome==="LOSE"),He=ie.some(fe=>fe.outcome==="LOSE"),ce=G.some(fe=>fe.outcome==="LOSE"),xe=G.some(fe=>fe.outcome==="PUSH"),re=!B&&!ue&&F.some(fe=>fe.outcome==="PUSH");let H="",he="";T.current&&clearTimeout(T.current);const Re=(()=>{try{return typeof window<"u"&&(window.__E2E===!0||window.location?.search?.includes("e2e=1"))}catch{return!1}})();T.current=setTimeout(()=>{const fe=typeof q=="number"?q:Number(q),Ie=A?.currentRollerId,ct=Y.some($e=>{const tt=Number(String($e.betType).replace(/^place/,""));return Number.isFinite(tt)&&tt===fe});if(B){if(K&&ct&&n&&Ie===n){const tt=Y.reduce((We,it)=>We+it.payout,0);H=Y.length>1?"Place Wins":"Place Win",he=`+${tt}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}const $e=F.filter(tt=>tt.outcome==="WIN").reduce((tt,We)=>tt+(We.payout+We.amount),0);H="Line Win",he=`+${$e}`,a({kind:"win",title:H,subtitle:he,duration:1100});return}if(K){const $e=Y.reduce((tt,We)=>tt+We.payout,0);H=Y.length>1?"Place Wins":"Place Win",he=`+${$e}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}if(ae){const $e=Q.filter(tt=>tt.outcome==="WIN").reduce((tt,We)=>tt+We.payout,0);H="Field Win",he=`+${$e}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}if(te){const $e=ie.filter(it=>it.outcome==="WIN"),tt=$e.reduce((it,Et)=>it+Et.payout,0);H=$e.length>1?"Big Wins":$e[0]?.betType==="big6"?"Big 6 Win":"Big 8 Win",he=`+${tt}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}if(me){const $e=G.filter(it=>it.outcome==="WIN"),tt=$e.reduce((it,Et)=>it+Et.payout,0);H=$e.length>1?"Come Wins":$e[0]?.betType==="dontCome"?"DC Win":"Come Win",he=`+${tt}`,a({kind:"win",title:H,subtitle:he,duration:1e3});return}if(ue){const $e=F.filter(tt=>tt.outcome==="LOSE").reduce((tt,We)=>tt+We.amount,0);H="Line Lose",he=`-${$e}`,a({kind:"lose",title:H,subtitle:he,duration:1100});return}if(Ae){const $e=Q.filter(tt=>tt.outcome==="LOSE").reduce((tt,We)=>tt+We.amount,0);H="Field Lose",he=`-${$e}`,a({kind:"lose",title:H,subtitle:he,duration:1e3});return}if(He){const $e=ie.filter(it=>it.outcome==="LOSE"),tt=$e.reduce((it,Et)=>it+Et.amount,0);H=$e.length>1?"Big Bets Lose":$e[0]?.betType==="big6"?"Big 6 Lose":"Big 8 Lose",he=`-${tt}`,a({kind:"lose",title:H,subtitle:he,duration:1e3});return}if(ce){const $e=G.filter(it=>it.outcome==="LOSE"),tt=$e.reduce((it,Et)=>it+Et.amount,0);H=$e.length>1?"Come Bets Lose":$e[0]?.betType==="dontCome"?"DC Lose":"Come Lose",he=`-${tt}`,a({kind:"lose",title:H,subtitle:he,duration:1e3});return}if(xe){H="DC Push",he="No action",a({kind:"push",title:H,subtitle:he,duration:1e3});return}re&&(H="Line Push",he="No action",a({kind:"push",title:H,subtitle:he,duration:1e3}));try{d()}catch{}},Re?200:2e3)},[P,n,A,a,d]),g.jsx(zA,{...t,hideDiceResults:!0,className:"craps-player-panel"})}function ube(t){return g.jsx(zA,{...t})}function dbe({deadlineTs:t,isActive:e,showTurnLabel:r=!0}){const[n,a]=v.useState(30),i=v.useRef(null);v.useEffect(()=>{if(!e||!t){a(30),i.current&&(cancelAnimationFrame(i.current),i.current=null);return}const f=()=>{const h=Date.now(),m=Math.max(0,Math.ceil((t-h)/1e3));a(m),m>0?i.current=requestAnimationFrame(f):i.current=null};return f(),()=>{i.current&&(cancelAnimationFrame(i.current),i.current=null)}},[t,e]);const o=e&&n!==30,c=n<=10,u=n<=5,d=n/30*100;return g.jsxs("div",{className:["poker-turn-timer",o?"":"poker-turn-timer--hidden",c?"poker-turn-timer--urgent":"",u?"poker-turn-timer--critical":""].filter(Boolean).join(" "),"aria-live":"polite","aria-atomic":"true",role:"timer","aria-hidden":!o,children:[g.jsxs("div",{className:"poker-turn-timer__ring",children:[g.jsxs("svg",{viewBox:"0 0 36 36",className:"poker-turn-timer__svg",children:[g.jsx("circle",{className:"poker-turn-timer__circle-bg",cx:"18",cy:"18",r:"16"}),g.jsx("circle",{className:"poker-turn-timer__circle-progress",cx:"18",cy:"18",r:"16",strokeDasharray:`${d} 100`})]}),g.jsx("div",{className:"poker-turn-timer__number",children:n})]}),r&&g.jsx("div",{className:"poker-turn-timer__label","aria-hidden":"true",children:"Your Turn"})]})}function $A(t){const e=v.useMemo(()=>t.headerExtras,[t.headerExtras]),r=v.useMemo(()=>{const u=Array.isArray(t.gameState?.pokerSeats)?t.gameState.pokerSeats:[],d=new Map;for(const f of u){const h=(f.totalCommitted||0)+(f.committed||0);d.set(f.playerId,h)}return d},[t.gameState]),n=v.useMemo(()=>{const u=Array.isArray(t.gameState?.pokerSeats)?t.gameState.pokerSeats:[],d=new Set;for(const f of u)f?.playerId&&String(f.status||"").toLowerCase()==="folded"&&d.add(f.playerId);return d},[t.gameState]),a=v.useMemo(()=>{const u=new Map,d=Array.isArray(t.revealedHands)?t.revealedHands:[];for(const f of d)f?.playerId&&Array.isArray(f.hole)&&f.hole.length===2&&u.set(String(f.playerId),f.hole);return u},[t.revealedHands]),i=v.useMemo(()=>u=>{const d=a.get(u.id);if(d&&d.length===2){const m=({value:_})=>{const w=String(_||"").toUpperCase(),b=w.slice(0,-1),E=w.slice(-1),T=b==="T"?"10":b,R=E==="H"||E==="D",P=E==="H"?"♥":E==="D"?"♦":E==="C"?"♣":"♠";return g.jsxs("div",{className:["poker-card","poker-card--mini",R?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":`${T} of ${E}`,children:[g.jsx("span",{className:"poker-card__rank",style:{fontSize:14},children:T}),g.jsx("span",{className:"poker-card__suit",style:{fontSize:11},children:P})]})};return g.jsxs("div",{className:"poker-avatar__faces","aria-label":"hole-cards",children:[g.jsx(m,{value:d[0]}),g.jsx(m,{value:d[1]})]})}if(n.has(u.id))return g.jsx("div",{className:"poker-avatar__bet","aria-label":"Folded",children:"Folded"});const h=`z${(r.get(u.id)||0).toLocaleString("en-US")}`;return g.jsx("div",{className:"poker-avatar__bet","aria-label":`Total bet ${h}`,children:h})},[a,r,n]);if(t.lite)return g.jsx(g6,{className:"",players:t.players,meId:t.meId,onOpenDM:t.onOpenDM,onOpenSendMoney:t.onOpenSendMoney,renderActionsOverride:u=>i({id:u.id})});const o=v.useMemo(()=>{const u=Array.isArray(t.gameState?.pokerSeats)?t.gameState.pokerSeats:[],d=new Map,f=new Set;for(const h of u){if(!h||!h.playerId)continue;const m=typeof h.stack=="number"?h.stack:void 0;typeof m=="number"&&d.set(String(h.playerId),m),f.add(String(h.playerId))}return t.players.map(h=>{const m=d.get(String(h.id));return typeof m=="number"?{...h,balance:m}:h})},[t.players]),c=v.useMemo(()=>g.jsx(dbe,{deadlineTs:t.turnDeadlineTs,isActive:!!t.isBettingStreet&&!!t.turnDeadlineTs,showTurnLabel:!!t.isHeroTurn}),[t.turnDeadlineTs,t.isBettingStreet,t.isHeroTurn]);return g.jsx(zA,{...t,className:"player-panel",players:o,hideDiceResults:!0,disableBankerFlash:!0,hideSideBets:!0,headerExtras:e,headerCommsLeftSlot:c,renderFacesOverride:u=>i(u)})}function vL(t){const e=t.gameState?.gameMode||"cee-lo";return e==="craps"?g.jsx(lbe,{...t}):e==="poker"?g.jsx($A,{...t}):g.jsx(ube,{...t})}function fbe(){const{remoteStreams:t}=mu(),e=v.useRef({}),[r,n]=v.useState(!1),a=async o=>{const c=o.srcObject;if(!c||!c.getAudioTracks().length)return!1;try{return await o.play(),!0}catch{return!1}};v.useEffect(()=>{let o=!1;for(const[u,d]of Object.entries(t)){const f=e.current[u];f&&f.srcObject!==d&&(f.srcObject=d)}(async()=>{for(const u of Object.values(e.current)){if(!u)continue;await a(u)||(o=!0)}n(o)})();for(const u of Object.keys(e.current))if(!t[u]){const d=e.current[u];if(d){try{d.pause()}catch{}d.srcObject=null}delete e.current[u]}},[t]);const i=async()=>{for(const o of Object.values(e.current))o&&await a(o);n(!1)};return g.jsxs(g.Fragment,{children:[Object.keys(t).map(o=>g.jsx("audio",{ref:c=>{e.current[o]=c},autoPlay:!0,playsInline:!0,muted:!1,style:{display:"none"},onError:c=>{}},o)),r&&g.jsx("button",{onClick:i,style:{position:"fixed",bottom:16,right:16,zIndex:9999,padding:"8px 12px",borderRadius:8,fontWeight:700,color:"#fff"},children:"Tap to enable audio"})]})}const w6=v.createContext(null),pbe=()=>v.useContext(w6),Lu=t=>`room:${t}`,Ao=(t,e)=>`dm:${[t,e].sort().join("|")}`,hbe=t=>{if(!t.startsWith("dm:"))return null;const r=t.slice(3).split("|");return r.length===2?r:null},VE=(t,e)=>t.ts===e.ts?t.id<e.id?-1:t.id>e.id?1:0:t.ts-e.ts,_L=()=>"tmp:"+Math.random().toString(36).slice(2)+Date.now().toString(36),HE=t=>({id:t.id,ts:t.ts,senderId:t.fromUserId,text:t.text,roomId:t.roomId}),GE=t=>({id:t.id,ts:t.ts,senderId:t.fromUserId,text:t.text,toUserId:t.toUserId});function mbe({children:t}){const{user:e}=$r(),r=e?.id??"anon",{roomSendMessage:n,roomFetchHistory:a,dmSendMessage:i,dmFetchHistory:o}=pa(),[c,u]=v.useState({}),[d,f]=v.useState({}),[h,m]=v.useState(null),[_,w]=v.useState({}),b=v.useRef(new Set),{info:E}=cP(),T=G=>G?G.length>100?G.slice(0,100)+"…":G:"",R=v.useCallback((G,B,K)=>{if(B?.length&&(u(ae=>{const te=ae[G]??[],me=new Map;for(const Ae of te)Ae?.id&&me.set(Ae.id,Ae);for(const Ae of B){if(!Ae?.id)continue;const He=me.get(Ae.id);me.set(Ae.id,{...He??{},...Ae,pending:!1,error:void 0})}const ue=Array.from(me.values()).sort(VE);return{...ae,[G]:ue}}),G.startsWith("dm:")&&K?.fromPeerId)){const ae=K.fromPeerId,te=Ao(r,ae),me=h===ae,ue=B.filter(Ae=>Ae.senderId===ae).length;ue>0&&!me&&f(Ae=>({...Ae,[te]:(Ae[te]??0)+ue}))}},[h,r]),P=v.useCallback((G,B,K)=>{u(ae=>{const te=(ae[G]??[]).slice();return te.push(B),te.sort(VE),{...ae,[G]:te}}),(async()=>{try{const ae=await K();if(!ae?.ok||!ae.id)throw new Error(ae?.error||"send failed");const te=ae.id;b.current.add(te),u(me=>{const ue=me[G]??[],Ae=ue.some(ce=>ce.id===te);let He;return Ae?He=ue.filter(ce=>ce.id!==B.id):He=ue.map(ce=>ce.id===B.id?{...ce,id:te,pending:!1,error:void 0}:ce),He.sort(VE),{...me,[G]:He}})}catch(ae){u(te=>{const me=(te[G]??[]).map(ue=>ue.id===B.id?{...ue,pending:!1,error:ae?.message||"send failed"}:ue);return{...te,[G]:me}})}})()},[]),A=v.useCallback(G=>{u(B=>{if(!B[G])return B;const K={...B};return delete K[G],K}),G.startsWith("dm:")&&(f(B=>{if(!(G in B))return B;const K={...B};return delete K[G],K}),w(B=>{if(!(G in B))return B;const K={...B};return delete K[G],K}))},[]),C=v.useCallback(G=>(c[G]??[]).some(B=>B.pending),[c]),O=v.useCallback(G=>{const B=Lu(G);return Q(G),(c[B]??[]).slice()},[c]),I=v.useCallback((G,B)=>{const K=(B??"").trim();if(!K)return null;const ae=Lu(G),te=_L(),me={id:te,ts:Date.now(),senderId:r,text:K,roomId:G,pending:!0};return P(ae,me,()=>n(G,K)),te},[r,n,P]),x=v.useCallback(G=>A(Lu(G)),[A]),D=v.useCallback(G=>C(Lu(G)),[C]),N=v.useCallback(async G=>{const B=Ao(r,G);if(!_[B])try{const K=await o?.(G);if(K?.ok&&Array.isArray(K.messages)){const ae=K.messages.map(GE);R(B,ae),f(te=>({...te,[B]:0}))}}finally{w(K=>({...K,[B]:!0}))}},[o,R,r,_]),L=v.useCallback(G=>{const B=Ao(r,G);return N(G),(c[B]??[]).slice()},[c,r,N]),j=v.useCallback((G,B)=>{const K=(B??"").trim();if(!K)return null;const ae=Ao(r,G),te=_L(),me={id:te,ts:Date.now(),senderId:r,text:K,toUserId:G,pending:!0};return P(ae,me,()=>i(G,K)),te},[r,P,i]),q=v.useCallback(G=>A(Ao(r,G)),[A,r]),U=v.useCallback(G=>C(Ao(r,G)),[C,r]),W=v.useCallback(G=>{const B=Ao(r,G);f(K=>{if(!(B in K))return K;const ae={...K};return ae[B]=0,ae})},[r]),F=v.useCallback(G=>{m(G),G&&(W(G),N(G))},[W,N]),Y=v.useCallback(G=>{const B=[];for(const[K,ae]of Object.entries(c??{})){if(!K.startsWith("dm:"))continue;const te=hbe(K);if(!te)continue;const me=te[0]===r?te[1]:te[0];if(G&&me!==G)continue;const ue=ae[ae.length-1];B.push({peerUserId:me,last:ue,unread:d?.[K]??0,hasPending:ae.some(Ae=>Ae.pending)})}return B.sort((K,ae)=>(ae.last?.ts??0)-(K.last?.ts??0)),B},[c,d,r]);async function Q(G){const B=Lu(G);if(!(c[B]??[]).length)try{const K=await a?.(G);if(K?.ok&&Array.isArray(K.messages)){const ae=K.messages.map(HE);R(B,ae)}}catch{}}Pa({onRoomMessage:G=>{if(!(!G?.id||!G.roomId)&&!b.current.has(G.id)){b.current.add(G.id),R(Lu(G.roomId),[HE(G)]);try{E("Message",T(G.text))}catch{}}},onRoomHistory:({roomId:G,messages:B})=>{!G||!Array.isArray(B)||R(Lu(G),B.map(HE))},onDmMessage:G=>{if(!G?.id)return;const B=G.fromUserId===r?G.toUserId:G.fromUserId;if(!B)return;const K=Ao(r,B),ae=GE(G);if(R(K,[ae],{fromPeerId:G.fromUserId!==r?G.fromUserId:void 0}),G.fromUserId!==r)try{E("Direct Message",T(G.text))}catch{}h===B&&f(te=>({...te,[K]:0}))},onDmHistory:({peerUserId:G,messages:B})=>{if(!G||!Array.isArray(B))return;const K=Ao(r,G);R(K,B.map(GE)),h===G&&f(ae=>({...ae,[K]:0})),w(ae=>({...ae,[K]:!0}))}});const ie=v.useMemo(()=>({getRoomMessages:O,sendRoomMessage:I,clearRoom:x,roomHasPending:D,getDmMessages:L,sendDmMessage:j,clearDm:q,dmHasPending:U,getDmSummary:Y,markDmRead:W,setActiveDm:F,loadDmHistory:N,threads:c}),[O,I,x,D,L,j,q,U,Y,W,F,N,c]);return g.jsx(w6.Provider,{value:ie,children:t})}const gbe="_overlay_axsq0_3",ybe="_overlayClosed_axsq0_14",vbe="_drawer_axsq0_20",_be="_drawerClosed_axsq0_54",bbe="_header_axsq0_65",kbe="_closeBtn_axsq0_75",wbe="_body_axsq0_91",Sbe="_threadList_axsq0_98",Ebe="_noPeers_axsq0_106",Tbe="_threadBtn_axsq0_113",Cbe="_threadBtnActive_axsq0_132",xbe="_avatar_axsq0_137",Pbe="_threadLabel_axsq0_151",Abe="_threadName_axsq0_156",Rbe="_threadPreview_axsq0_165",Dbe="_unreadBadge_axsq0_173",Obe="_activeThread_axsq0_186",Nbe="_scroller_axsq0_194",Ibe="_scrollerEmpty_axsq0_208",Mbe="_message_axsq0_215",jbe="_messageMine_axsq0_230",Lbe="_messageContent_axsq0_238",Bbe="_messageTime_axsq0_246",Ube="_pending_axsq0_257",Fbe="_error_axsq0_265",qbe="_composer_axsq0_273",zbe="_composerInput_axsq0_283",$be="_composerSend_axsq0_307",Vbe="_composerSendDisabled_axsq0_329",Hbe="_headerTitle_axsq0_394",Vr={overlay:gbe,overlayClosed:ybe,drawer:vbe,drawerClosed:_be,header:bbe,closeBtn:kbe,body:wbe,threadList:Sbe,noPeers:Ebe,threadBtn:Tbe,threadBtnActive:Cbe,avatar:xbe,threadLabel:Pbe,threadName:Abe,threadPreview:Rbe,unreadBadge:Dbe,activeThread:Obe,scroller:Nbe,scrollerEmpty:Ibe,message:Mbe,messageMine:jbe,messageContent:Lbe,messageTime:Bbe,pending:Ube,error:Fbe,composer:qbe,composerInput:zbe,composerSend:$be,composerSendDisabled:Vbe,headerTitle:Hbe};function Gbe(t){if(!t)return"?";const r=t.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),n=(r[0]?.[0]??"").toUpperCase(),a=(r[1]?.[0]??"").toUpperCase();return n+a||n||"?"}function S6({open:t,onClose:e,peers:r,initialPeerId:n}){const{user:a}=$r(),i=a?.id??a?.email??"",{getDmSummary:o,getDmMessages:c,sendDmMessage:u,markDmRead:d,setActiveDm:f,threads:h,loadDmHistory:m}=pbe(),[_,w]=v.useState(n??null),[b,E]=v.useState(""),T=v.useRef(!1),R=v.useRef(null);v.useEffect(()=>{if(!t){T.current=!1;return}if(T.current)return;T.current=!0;let j=null;if(n)j=n;else{const U=o()?.find(W=>W.unread>0);U?j=U.peerUserId:_?j=_:r.length&&(j=r[0].id)}j&&j!==_&&(w(j),f(j),m(j))},[t,n,r,_,o,f]),v.useEffect(()=>{!t||!_||R.current!==_&&(R.current=_,d(_))},[t,_,d]),v.useEffect(()=>{const j=document.body.style.overflow;return t?document.body.style.overflow="hidden":document.body.style.overflow=j,()=>{document.body.style.overflow=j}},[t]),v.useEffect(()=>{t&&requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})})},[t]),v.useEffect(()=>{const j=window.visualViewport;if(!j)return;const q=()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight+1e3)};return j.addEventListener("resize",q),()=>{j.removeEventListener("resize",q)}},[]);const P=v.useMemo(()=>_?h?.[Ao(_,i)]??[]:[],[_,t,h]),A=v.useMemo(()=>o()??[],[t,P.length]),C=v.useMemo(()=>{const j=new Map;return A.forEach(q=>j.set(q.peerUserId,q)),j},[A]),O=v.useRef(null);v.useEffect(()=>{O.current&&(O.current.scrollTop=O.current.scrollHeight+1e3)},[P.length,_,t]);const I=j=>{w(j),f(j),d(j)},x=()=>{if(!_)return;const j=b.trim();if(!j)return;u(_,j)&&E("")},D=j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),x())},N=j=>{const q=r.find(U=>U.id===j);return q?.name||q?.email||j},L=j=>{const q=C.get(j);return q?.last?((q.last.senderId===i?"You: ":"")+q.last.text).trim():""};return g.jsxs(g.Fragment,{children:[g.jsx("div",{"aria-hidden":!t,onClick:e,className:`${Vr.overlay} ${t?"":Vr.overlayClosed}`}),g.jsxs("aside",{"aria-hidden":!t,role:"dialog","aria-label":"Direct Messages",className:`${Vr.drawer} ${t?"":Vr.drawerClosed}`,onClick:j=>j.stopPropagation(),children:[g.jsxs("div",{className:Vr.header,children:[g.jsx("strong",{className:Vr.headerTitle,children:"Messages"}),g.jsx("button",{onClick:e,className:Vr.closeBtn,"aria-label":"Close messages",children:"✕"})]}),g.jsxs("div",{className:Vr.body,children:[g.jsxs("div",{className:Vr.threadList,children:[r.length===0&&g.jsx("div",{className:Vr.noPeers,children:"No other players yet."}),r.map(j=>{const q=j.id===_,U=Gbe(j.name||j.email||j.id),W=C.get(j.id)?.unread??0,F=L(j.id);return g.jsxs("button",{onClick:()=>I(j.id),className:`${Vr.threadBtn} ${q?Vr.threadBtnActive:""}`,title:N(j.id),children:[g.jsx("div",{className:Vr.avatar,"aria-hidden":!0,children:U}),g.jsxs("div",{className:Vr.threadLabel,children:[g.jsx("div",{className:Vr.threadName,children:N(j.id)}),g.jsx("div",{className:Vr.threadPreview,children:F})]}),W>0&&g.jsx("span",{"aria-label":`${W} unread`,className:Vr.unreadBadge,children:W>99?"99+":W})]},j.id)})]}),g.jsxs("div",{className:Vr.activeThread,children:[g.jsxs("div",{ref:O,className:Vr.scroller,children:[!_&&g.jsx("div",{className:Vr.scrollerEmpty,children:"Select a conversation to begin."}),_&&P.map(j=>{const q=j.senderId===i,U=new Date(j.ts),W=U.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return g.jsxs("div",{className:`${Vr.message} ${q?Vr.messageMine:""}`,title:U.toLocaleString(),children:[g.jsx("div",{className:Vr.messageContent,children:j.text}),g.jsx("div",{className:Vr.messageTime,children:W}),j.pending&&g.jsx("div",{className:Vr.pending,children:"sending…"}),j.error&&g.jsx("div",{className:Vr.error,children:j.error})]},j.id)})]}),g.jsxs("div",{className:Vr.composer,children:[g.jsx("input",{value:b,onChange:j=>E(j.target.value),onKeyDown:D,placeholder:_?`Message ${N(_)}…`:"Pick a conversation…",disabled:!_,className:Vr.composerInput}),g.jsx("button",{onClick:x,disabled:!_||b.trim()==="",className:`${Vr.composerSend} ${!_||b.trim()===""?Vr.composerSendDisabled:""}`,children:"Send"})]})]})]})]})]})}function Wbe({roomId:t,lastRollerId:e,roundSeq:r,className:n,autoHideMs:a}){const{verifyFor:i,lastRoundWithReveal:o,proofs:c,reveals:u}=Xz(t),[d,f]=v.useState("unverifiable"),h=v.useRef(0),[m,_]=v.useState({}),[w,b]=v.useState(!0),E=v.useMemo(()=>typeof r!="number"||!c?[]:Object.keys(c).filter(C=>C.startsWith(`${r}:`)),[c,r]),T=v.useMemo(()=>e||E.length&&E[E.length-1].split(":")[1]||null,[e,E]);v.useEffect(()=>{let C=!1;if(!i||!t||typeof r!="number"||!T)return f("unverifiable"),()=>{C=!0};const O=++h.current;return(async()=>{try{const I=await i(T,r);!C&&O===h.current&&f(I)}catch{!C&&O===h.current&&f("unverifiable")}})(),()=>{C=!0}},[i,t,T,r,E.length]),v.useEffect(()=>{if(!i||typeof r!="number")return;let C=!1;return E.forEach(O=>{const I=O.split(":")[1];I&&(async()=>{try{const x=await i(I,r);C||_(D=>D[O]===x?D:{...D,[O]:x})}catch{C||_(x=>x[O]==="unverifiable"?x:{...x,[O]:"unverifiable"})}})()}),()=>{C=!0}},[i,E,r,o]);const R=typeof r=="number"?!!u?.[r]:!1;if(v.useEffect(()=>{if(!a||a<=0||!R)return;b(!0);const C=window.setTimeout(()=>b(!1),a);return()=>window.clearTimeout(C)},[a,r,R]),!R||!w)return null;const P=E.filter(C=>m[C]==="verified").length,A=(()=>{if(E.length>1){if(P===E.length)return"All Verified";if(P>0)return`${P}/${E.length} Verified`}switch(d){case"verified":return"Provably Fair";case"bad-commit":return"Commit Mismatch";case"mismatch":return"Mismatch";default:return E.length?"Unverified":"Awaiting Reveal"}})();return g.jsxs("div",{className:["fairness-status-bar",n].filter(Boolean).join(" "),style:{display:"flex",alignItems:"center",gap:12,padding:"6px 12px",borderRadius:8,background:"rgba(0,0,0,.55)",backdropFilter:"blur(8px)",fontSize:12,lineHeight:1,color:"#fff",pointerEvents:"auto",boxShadow:"0 2px 6px rgba(0,0,0,.4)"},children:[g.jsx(vP,{state:d}),g.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[g.jsx("span",{style:{fontWeight:600},children:A}),typeof r=="number"&&g.jsxs("span",{style:{opacity:.75},children:["Round ",r]})]})]})}const Kbe=({show:t,onComplete:e})=>{const[r,n]=v.useState(!1),[a,i]=v.useState(!1),[o,c]=v.useState(!1),u=v.useRef({fade:null,complete:null}),d=v.useRef(e);if(v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>(t?(u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete),n(!0),i(!1),c(!1),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i(!0)})}),u.current.fade=setTimeout(()=>{c(!0)},3e3),u.current.complete=setTimeout(()=>{n(!1),i(!1),c(!1),d.current()},3400)):(u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete),n(!1),i(!1),c(!1)),()=>{u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete)}),[t]),!r)return null;const f=g.jsx("div",{className:`bang-bang-overlay ${o?"bang-bang-overlay--fadeout":""}`,"data-testid":"bang-bang-456-overlay",children:g.jsx("div",{className:"bang-bang-container",children:g.jsx("div",{className:`bang-bang-image ${a?"bang-bang-image--animating":""}`,role:"img","aria-label":"Bang Bang! Banker wins all with 456"})})});return Gc.createPortal(f,document.body)},Ybe=({show:t,onComplete:e})=>{const[r,n]=v.useState(!1),[a,i]=v.useState(!1),[o,c]=v.useState(!1),u=v.useRef({fade:null,complete:null}),d=v.useRef(e);if(v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>(t?(u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete),n(!0),i(!1),c(!1),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i(!0)})}),u.current.fade=setTimeout(()=>{c(!0)},3e3),u.current.complete=setTimeout(()=>{n(!1),i(!1),c(!1),d.current()},3400)):(u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete),n(!1),i(!1),c(!1)),()=>{u.current.fade&&clearTimeout(u.current.fade),u.current.complete&&clearTimeout(u.current.complete)}),[t]),!r)return null;const f=g.jsx("div",{className:`gotcha-overlay ${o?"gotcha-overlay--fadeout":""}`,"data-testid":"gotcha-clutch-overlay",children:g.jsx("div",{className:"gotcha-container",children:g.jsx("div",{className:`gotcha-image ${a?"gotcha-image--animating":""}`,role:"img","aria-label":"Gotcha! Clutch roll"})})});return Gc.createPortal(f,document.body)},bL=v.lazy(()=>qr(()=>import("./DiceBoard.component-Dbt9S-uU.js"),__vite__mapDeps([3,4]),import.meta.url));function Xbe(){const{roomId:t}=i3(),e=tn(),{user:r,meId:n}=$r(),{error:a}=ou();v.useEffect(()=>{const je=()=>{try{Ax()||Xr()}catch{}};je();const rt=["pointerdown","touchstart","mousedown","click","keydown"];return rt.forEach(Ct=>{document.addEventListener(Ct,je,{once:!0,capture:!0})}),()=>{rt.forEach(Ct=>{document.removeEventListener(Ct,je,{capture:!0})})}},[]);const i=n||r?.id||r?.email||"",[o,c]=v.useState(0),{rollTrigger:u,resetSpin:d}=Xo(),f=v.useRef(null),h=LA(t,i,{autoJoin:!0}),{room:m,joining:_,error:w,lastRollerId:b,deadline:E,serverNow:T,diceSettled:R}=h,P=Kz({roomId:t||null,myPlayerId:i,autoJoinOrder:!0}),A=m?.gameState?.gameMode==="craps"?P.shooterState:null,C=v.useMemo(()=>{const je=m?.gameState;if(je?.gameMode==="craps"){const rt=P.lastRoll?.point??null,Ct=rt??je.crapsPoint??null,jt=A?{...A}:{},De={...je,...jt,crapsPoint:Ct};return De.crapsPhase=Ct?"point":"come-out",De}return je},[m?.gameState,A,P.lastRoll]),O=v.useMemo(()=>{if(m?.gameState?.gameMode==="craps"){const je=P.lastRoll;return je&&Array.isArray(je.dice)?[je.dice[0],je.dice[1],0]:void 0}return h.diceResults},[m?.gameState?.gameMode,P.lastRoll,h.diceResults]),I=v.useMemo(()=>{if(m?.gameState?.gameMode!=="craps")return[];const je=m?.players??[],rt=A?.turnOrder||m?.gameState?.turnOrder||[];if(!rt.length)return je;const Ct=new Map(je.map(at=>[at.id,at])),jt=new Set(rt),De=rt.map(at=>{const we=Ct.get(at);if(we)return we;const st=at.includes("craps_bot_")||at.includes("bot_");return{id:at,name:st?"Bot":"Player",isReady:!0,balance:st?500:0,avatarUrl:null,isBot:st}}),nt=je.filter(at=>!jt.has(at.id));return[...De,...nt]},[m?.gameState?.gameMode,m?.players,A?.turnOrder,m?.gameState?.turnOrder]),{onCrapsShooterTurnEnd:x}=w0(),D=v.useRef(null);v.useEffect(()=>{if(m?.gameState?.gameMode!=="craps")return;const je=P.lastRoll;if(!je||D.current===je)return;D.current=je;const{currentRollerId:rt,nextRollerId:Ct}=je;rt&&Ct&&rt!==Ct&&x()},[P.lastRoll,m?.gameState?.gameMode,x]);const N=v.useRef(null),[L,j]=v.useState(1),[q,U]=v.useState(null),[W,F]=v.useState(!1),[Y,Q]=v.useState(void 0),ie=v.useMemo(()=>(m?.players??[]).filter(je=>je.id!==i).map(je=>({id:je.id,name:je.name})),[m?.players,i]),G=m?.gameState?.phase==="waiting"&&!u,B=v.useCallback(je=>{Q(je),F(!0)},[]),K=v.useCallback(()=>{F(!1),Q(void 0)},[]),ae=v.useRef(void 0);v.useEffect(()=>{const je=m?.gameState?.roundSeq;if(typeof je=="number"&&ae.current!==void 0&&je!==ae.current&&(c(0),(m?.gameState?.gameMode||"cee-lo")==="cee-lo")){const rt=m?.gameState?.banker,Ct=rt&&i&&rt===i;try{Ct||mT({volume:.6})}catch{}}typeof je=="number"&&(ae.current=je)},[m?.gameState?.roundSeq]);const te=ks(),{joinRoom:me}=Mi(),[ue,Ae]=v.useState(!1);v.useCallback(async()=>{if(!ue&&!(!te||!t)){Ae(!0);try{if(me)try{await me(t)}catch{}}catch{}finally{Ae(!1)}}},[ue,te,t,me]),v.useEffect(()=>{if(!te)return;const je=()=>{try{d()}catch{}};return te.on("disconnect",je),()=>{te.off("disconnect",je)}},[te,d]),v.useEffect(()=>{requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})})},[]);const[He,ce]=v.useState(()=>typeof window>"u"?!1:window.innerWidth>window.innerHeight);v.useEffect(()=>{const je=()=>ce(window.innerWidth>window.innerHeight);window.addEventListener("resize",je);const rt=setTimeout(je,0);return()=>{window.removeEventListener("resize",je),clearTimeout(rt)}},[]),v.useEffect(()=>{w&&a(w,{title:"Room Error",duration:5e3})},[w,a]);const xe=v.useRef(0),re=v.useRef(!1),H=v.useRef(!1),he=v.useRef(!1),Re=v.useRef(null),fe=v.useRef(null),[Ie,ct]=v.useState(0),[$e,tt]=v.useState(!1),[We,it]=v.useState(!1),[Et,Mt]=v.useState(!1);v.useEffect(()=>{const je=m?.gameState?.gameMode;if(!je)return;let rt=!0;return(async()=>{try{const{Preferences:Ct}=await qr(async()=>{const{Preferences:nt}=await Promise.resolve().then(()=>Oc);return{Preferences:nt}},void 0,import.meta.url),jt=je==="craps"?"onb_craps_v1":"onb_ceelo_v1",{value:De}=await Ct.get({key:jt});if(!rt)return;Mt(De!=="1")}catch{if(!rt)return;Mt(!0)}})(),()=>{rt=!1}},[m?.gameState?.gameMode]);const _t=v.useCallback(()=>{const je=m?.gameState?.gameMode;(async()=>{try{const{Preferences:rt}=await qr(async()=>{const{Preferences:Ct}=await Promise.resolve().then(()=>Oc);return{Preferences:Ct}},void 0,import.meta.url);await rt.set({key:je==="craps"?"onb_craps_v1":"onb_ceelo_v1",value:"1"})}catch{}Mt(!1)})()},[m?.gameState?.gameMode]);if(v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){re.current=!1,H.current=!1;return}const je=m?.singlePlayer===!0,rt=m?.gameState?.banker,Ct=rt&&i&&rt===i,jt=h?.diceResults;if(!jt||jt.length!==3){re.current=!1,H.current=!1,Re.current=null;return}const De=jt.join(",");if(De===Re.current)return;Re.current=De;const nt=[...jt].sort().join(","),at=nt==="4,5,6",we=at||nt==="1,2,3";je||!Ct?(re.current=we,H.current=at):(re.current=!1,H.current=!1)},[h?.diceResults,m?.gameState?.gameMode,m?.gameState,i]),v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){fe.current=null;return}const je=m?.gameState?.bankRoll;if(!je||!Array.isArray(je.raw)||je.raw.length!==3){fe.current=null;return}const rt=je.raw,Ct={};for(const nt of rt)Ct[nt]=(Ct[nt]||0)+1;const jt=Object.keys(Ct).map(Number);jt.length===2&&jt.some(nt=>Ct[nt]===1)?fe.current=jt.find(nt=>Ct[nt]===1)||null:fe.current=null},[m?.gameState?.bankRoll,m?.gameState?.gameMode]),v.useEffect(()=>{if(m?.gameState?.gameMode==="craps"){he.current=!1;return}const je=m?.gameState?.banker;if(je&&i&&je===i){he.current=!1;return}const Ct=fe.current;if(Ct!==6){he.current=!1;return}const jt=h?.diceResults;if(!jt||jt.length!==3){he.current=!1;return}const De={};for(const we of jt)De[we]=(De[we]||0)+1;const nt=Object.keys(De).map(Number);if(nt.length===2&&nt.some(we=>De[we]===1)){const we=nt.find(st=>De[st]===1);we&&we>Ct?he.current=!0:he.current=!1}else{const we=nt.length===1;he.current=we}},[h?.diceResults,m?.gameState,i,m?.gameState?.gameMode]),v.useEffect(()=>{if(!h?.diceSettled)return;const je=Date.now();if(re.current||H.current||he.current){if(je-xe.current<800){re.current=!1,H.current=!1,he.current=!1;return}xe.current=je,H.current&&tt(!0),he.current&&it(!0),re.current=!1,H.current=!1,he.current=!1,ct(rt=>rt+1)}},[h?.diceSettled]),_)return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx("div",{className:"home-preloader",children:g.jsx("div",{className:"home-preloader__spinner"})})]});if(!m)return g.jsxs("div",{className:"HomeScreen theme-casino",children:[g.jsx(ji,{className:"page-gameroom"}),g.jsx("div",{className:"room-grid-fit",children:g.jsxs("div",{className:"error-grid",children:[g.jsx("p",{className:"error text-center",children:"Room not found."}),g.jsx("button",{className:"felt-btn felt-btn--secondary",onClick:()=>e("/lobby"),children:"Back to lobby"})]})})]});const ge=m.gameState?.gameMode==="craps",Be=m.gameState?.gameMode!=="craps";return g.jsxs(Jbe,{className:ge?"mode-craps":Be?"mode-ceelo":void 0,bgShakeTrigger:Ie,children:[g.jsx(ji,{className:"page-gameroom"}),g.jsx(y_e,{}),g.jsx(uP,{open:Et,onClose:_t,title:ge?"Craps":"Cee‑Lo",tagline:ge?"Place your bets and roll the point.":"Banker vs challengers. Roll to win.",steps:ge?["Place Pass/Don’t Pass (optional Place bets)","Shooter rolls: establish point or win/lose on come-out","Resolve bets on each roll"]:["Banker faces challengers each round","Place a MAIN bet to challenge the banker","Highest valid roll wins the pot"],primaryLabel:"Got it",persistKey:ge?"onb_craps_v1":"onb_ceelo_v1"}),g.jsxs("div",{className:"room-grid-fit",style:!He&&q&&!ge?{height:q}:void 0,children:[g.jsx("div",{className:"fairness-container",children:g.jsx(Wbe,{roomId:t,lastRollerId:b,roundSeq:m?.gameState?.roundSeq,autoHideMs:ge?3e3:void 0})}),g.jsx("div",{ref:N,className:"room-grid"+(ge?" room-grid--craps":"")+(L<.999?" room-grid--scaled":""),style:L<.999?{transform:`scale(${L})`,transformOrigin:"top center",height:q||void 0}:void 0,children:ge?g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"players-row",children:g.jsx(vL,{className:"PlayerPanel",roomId:t,roomName:m.name,players:I,bankerId:m.gameState?.banker,currentRollerId:m.gameState?.currentRollerId,meId:i,gameState:C,lastRollerId:b,onOpenDM:B,onOpenSendMoney:()=>{},crapsRollHistory:P.rollHistory,singlePlayer:m?.singlePlayer})}),g.jsx("div",{className:"stage",ref:f,children:g.jsx("div",{className:"table-wrap",children:g.jsx("div",{className:`felt ${G?"is-muted":""}`,children:g.jsx(bL,{isWaiting:G,rollTrigger:u,results:O,preRollTrigger:o,gameMode:m.gameState?.gameMode,gameState:C,zoom:L<.999?13:15})})})}),g.jsx("div",{className:"bets-wrapper bets-wrapper--craps",children:(()=>{const rt=m.players.find(Ct=>Ct.id===i)?.balance??r?.balance??1e3;return g.jsx(g_e,{meId:i,balance:rt})})()})]}):g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"players-row",children:g.jsx(vL,{className:"player-panel",roomId:t,roomName:m.name,players:m.gameState.turnOrder.map(je=>m.players.find(rt=>rt.id===je)).filter(je=>!!je),bankerId:m.gameState?.banker,currentRollerId:m.gameState?.currentRollerId,meId:i,gameState:C,lastRollerId:b,onOpenDM:B,onOpenSendMoney:()=>{},singlePlayer:m?.singlePlayer})}),g.jsxs("div",{className:"stage",ref:f,children:[g.jsx(vye,{gameMode:m.gameState?.gameMode,gameState:C}),g.jsx("div",{className:"table-wrap",children:g.jsx("div",{className:`felt ${G?"is-muted":""}`,children:g.jsx(bL,{isWaiting:G,rollTrigger:u,results:O,preRollTrigger:o,gameMode:m.gameState?.gameMode,gameState:C,zoom:L<.999?13:15})})})]}),g.jsxs("div",{className:"grid-body",children:[g.jsx("div",{className:"bets-wrapper",children:g.jsx(mye,{gameState:m.gameState,roundEnded:m.gameState.roundEnded,roomId:t,meId:i,bankerId:m.gameState.banker,hasBankRoll:!!m.gameState.bankRoll,players:m.players,timeLeft:{deadline:E,serverNow:T},showPassBank:!1,showSpectateRow:!1,gameplay:h})}),g.jsx("div",{className:"spectate-wrapper",children:g.jsx(w_e,{roomId:t,meId:i,bankerId:m.gameState.banker,players:m.players,gameState:C,gameplay:h})})]})]})})]}),g.jsx(fbe,{}),g.jsx(S6,{open:W,onClose:K,peers:ie,initialPeerId:Y}),g.jsx(Kbe,{show:$e,onComplete:()=>tt(!1)}),g.jsx(Ybe,{show:We,onComplete:()=>it(!1)})]})}function Jbe({children:t,className:e,bgShakeTrigger:r}){const n=v.useRef(null),a=v.useRef(!0),{showAnimations:i}=qA();return v.useEffect(()=>{n.current&&n.current.classList.remove("fx-bg-shake")},[]),v.useEffect(()=>{if(!n.current||typeof r!="number"||i===!1)return;if(a.current||r===0){a.current=!1;return}n.current.classList.remove("fx-bg-shake"),n.current.offsetHeight,n.current.classList.add("fx-bg-shake");const o=()=>{n.current?.classList.remove("fx-bg-shake")};return n.current.addEventListener("animationend",o,{once:!0}),()=>{n.current?.removeEventListener("animationend",o)}},[r,i]),g.jsxs("div",{ref:n,className:"room-shell"+(e?` ${e}`:""),children:[g.jsx("div",{className:"orientation-lock",role:"dialog","aria-label":"Rotate to portrait",children:g.jsxs("div",{className:"orientation-lock__content",children:[g.jsx("div",{className:"orientation-lock__icon","aria-hidden":"true",children:"🔁"}),g.jsx("div",{className:"orientation-lock__title",children:"Rotate your device"}),g.jsx("div",{className:"orientation-lock__text",children:"Portrait is required on mobile web."})]})}),t]})}function Qbe(){const{user:t,refreshUser:e,logout:r}=$r(),{updateProfile:n}=pa(),{membershipModalOpen:a,setMembershipModalOpen:i}=Lb(),{friends:o,friendRequests:c,blockedUsers:u,refreshSocial:d,isBlocked:f,blockUser:h,unblockUser:m,removeFriend:_,respondToFriendRequest:w}=BA(),[b,E]=v.useState(!1),[T,R]=v.useState(),{forUserId:P,anchorRect:A,anchorEl:C,openFor:O,close:I}=UA(),[x,D]=v.useState(null),[N,L]=v.useState(null),j=v.useCallback((Ye,Yt,At,Rt)=>{O(Ye,Yt),D(At),L(Rt||null)},[O]),q=v.useCallback(()=>{I(),D(null),L(null)},[I]),[U,W]=v.useState(t?.name??""),[F,Y]=v.useState(t?.email??""),[Q,ie]=v.useState(t?.avatarUrl??""),[G,B]=v.useState(!1),[K,ae]=v.useState(null),[te,me]=v.useState(!1),[ue,Ae]=v.useState(null),[He,ce]=v.useState(!1),[xe,re]=v.useState(null),H=v.useRef(null),{onBuyChips:he,onGoPremium:Re,onRestore:fe,busy:Ie,busyChips:ct,ready:$e,purchasesReady:tt,isWeb:We,premiumActive:it,hasPremiumPackage:Et,premiumLabel:Mt,premiumSubtitle:_t,premiumDescription:ge,premiumPrice:Be,premiumInterval:je}=jg(),[rt,Ct]=v.useState(!!t?.botChatDisabled),[jt,De]=v.useState(t?.ceeloBotsPerRoom??null),[nt,at]=v.useState(t?.crapsBotsPerRoom??null),[we,st]=v.useState(t?.pokerBotsPerRoom??null);v.useEffect(()=>{W(t?.name??""),Y(t?.email??""),ie(t?.avatarUrl??""),Ct(!!t?.botChatDisabled),De(t?.ceeloBotsPerRoom??null),at(t?.crapsBotsPerRoom??null),st(t?.pokerBotsPerRoom??null)},[t?.id,t?.name,t?.email,t?.avatarUrl,t?.botChatDisabled,t?.ceeloBotsPerRoom,t?.crapsBotsPerRoom,t?.pokerBotsPerRoom]),v.useEffect(()=>{d()},[]);const bt=v.useCallback(async()=>{B(!0),ae(null);try{const Ye={};U!==t?.name&&(Ye.name=U),F!==t?.email&&(Ye.email=F),Q!==t?.avatarUrl&&(Ye.avatarUrl=Q),typeof rt=="boolean"&&(Ye.botChatDisabled=rt);const Yt=tf||HD,At=tf||$o,Rt=tf||Vo;Yt&&jt!==(t?.ceeloBotsPerRoom??null)&&(Ye.ceeloBotsPerRoom=jt),At&&nt!==(t?.crapsBotsPerRoom??null)&&(Ye.crapsBotsPerRoom=nt),Rt&&we!==(t?.pokerBotsPerRoom??null)&&(Ye.pokerBotsPerRoom=we);const Dt=await n(Ye);if(!Dt?.ok)ae(Dt?.error||"Failed to save");else{try{await e({force:!0})}catch{}await d()}}catch(Ye){ae(Ye?.message||"Failed to save")}finally{B(!1)}},[U,F,Q,t?.name,t?.email,t?.avatarUrl,n,d,e,jt,nt,we,rt]),nr=v.useCallback(async Ye=>{f(Ye)?await m(Ye):await h(Ye)},[f,h,m]),ur=v.useCallback(Ye=>{_(Ye)},[_]),dr=v.useCallback(Ye=>{R(Ye),E(!0)},[]),Sr=v.useCallback(()=>{E(!1),R(void 0)},[]),un=v.useCallback(async Ye=>{await w(Ye.id,"ACCEPT")},[w]);v.useCallback(async Ye=>{await w(Ye.id,"DECLINE")},[w]);const Z=v.useCallback(async Ye=>{me(!0),Ae(null);try{if(Ye.size>5242880){Ae("File size must be less than 5MB");return}if(!["image/jpeg","image/jpg","image/png","image/webp","image/gif"].includes(Ye.type)){Ae("File must be a valid image (JPEG, PNG, WebP, or GIF)");return}const Rt=new FormData;Rt.append("avatar",Ye);const Dt=String(VD??"http://localhost:4000").replace(/\/+$/,"");let Nn={},dn;try{const pn=await oi();pn&&(Nn={Authorization:`Bearer ${pn}`},dn=pn)}catch{}const jr=new URL(`${Dt}/api/avatar/upload`);dn&&jr.searchParams.set("token",dn);const Ra=await fetch(jr.toString(),{method:"POST",body:Rt,headers:Nn,credentials:"include"});if(!Ra.ok){const pn=await Ra.json().catch(()=>({error:"Upload failed"}));throw new Error(pn.error||`Upload failed with status ${Ra.status}`)}const oo=await Ra.json();oo.avatarUrl&&ie(oo.avatarUrl)}catch(Yt){Ae(Yt?.message||"Failed to upload avatar")}finally{me(!1)}},[]),X=v.useCallback(Ye=>{const Yt=Ye.target.files?.[0];Yt&&Z(Yt),H.current&&(H.current.value="")},[Z]),le=v.useCallback(()=>{if(!(t?.membershipTier==="PREMIUM")){try{i(!0)}catch{}return}H.current?.click()},[t,i]),be=v.useMemo(()=>{const Ye=new Map;for(const Yt of o)Ye.set(Yt.id,Yt);for(const Yt of u)Ye.has(Yt.id)||Ye.set(Yt.id,Yt);return Ye},[o,u]),z=v.useMemo(()=>c.map(Ye=>{const Yt=t?.id===Ye.toUserId,At=Yt?Ye.fromUserId:Ye.toUserId;if(!At)return null;const Rt=(Yt?Ye.fromUser:Ye.toUser)||be.get(At),Dt=Rt?.name??At,Nn=Rt?.avatarUrl??void 0;return{id:At,name:Dt,avatarUrl:Nn,_req:Ye,_incoming:Yt}}).filter(Boolean),[c,t?.id,be]),{showAnimations:ee,toggleAnimations:se,ready:Oe}=qA(),[wt,er]=v.useState(Rc.diceColorTheme);v.useEffect(()=>{(async()=>{try{const Ye=await nu();er(Ye.diceColorTheme??Rc.diceColorTheme)}catch{er(Rc.diceColorTheme)}})()},[]);const Qt=v.useCallback(async Ye=>{try{if(!(t?.membershipTier==="PREMIUM")&&Ye!=="dice_white_black"){try{i(!0)}catch{}return}const At=await nu(),Rt={...Rc,...At,diceColorTheme:Ye};await g0(Rt),er(Ye)}catch{}},[t,i]),Zt=v.useCallback(()=>i(!1),[i]);v.useEffect(()=>{e()},[]);const oa=tn(),On=v.useCallback(async()=>{try{if(re(null),!window.confirm("Are you sure you want to permanently delete your account? This action cannot be undone."))return;const Yt=String(VD??"http://localhost:4000").replace(/\/+$/,"");let At;try{const Dt=await oi();Dt&&(At={Authorization:`Bearer ${Dt}`})}catch{}const Rt=await fetch(`${Yt}/api/account`,{method:"DELETE",credentials:"include",headers:At});if(!Rt.ok){const Dt=await Rt.json().catch(()=>({error:"Deletion failed"}));throw new Error(Dt.error||`Failed with status ${Rt.status}`)}}catch(Ye){re(Ye?.message||"Failed to delete account")}finally{r()}},[oa]);return g.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[g.jsx(ji,{className:"profile-page-body"}),g.jsx("div",{className:"logout-container  home-header-row",children:g.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}history.back()},children:[g.jsx(_d,{className:"icon",style:{color:"var(--gold, #caa64d)"}})," Back"]})}),g.jsx("div",{className:"profile-page",children:g.jsx("div",{className:"home-fit-shell",children:g.jsx("div",{className:"home-fit-content",children:g.jsxs("div",{className:"profile-content",children:[g.jsx("div",{className:"profile-row profile-row--two",children:g.jsxs("div",{className:"profile-section",children:[g.jsxs("strong",{children:["Avatar: ",g.jsx("span",{className:"badge",style:{marginLeft:"8px",fontSize:"0.75em",padding:"2px 8px",background:"linear-gradient(135deg, #FFD700, #FFA500)",color:"#000",fontWeight:600},children:"PREMIUM"})]}),g.jsxs("div",{className:"editable-field",style:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"16px"},children:[Q&&g.jsx("img",{src:Q,alt:"Avatar preview",style:{width:"120px",height:"120px",borderRadius:"50%",objectFit:"cover",border:"3px solid var(--gold, #caa64d)"}}),g.jsxs("div",{style:{width:"100%",textAlign:"left"},children:[g.jsx("input",{ref:H,type:"file",accept:"image/jpeg,image/jpg,image/png,image/webp,image/gif",onChange:X,disabled:te,style:{display:"none"}}),g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}le()},disabled:te,style:{marginBottom:"8px"},children:te?"Uploading...":"Upload Avatar"}),g.jsx("div",{className:"subtle",style:{fontSize:"0.85em",marginTop:"4px"},children:"Max 5MB • JPEG, PNG, WebP, or GIF"}),ue&&g.jsxs("div",{className:"error-message",style:{marginTop:"8px"},children:[ue,ue.includes("Premium")&&g.jsx("div",{style:{marginTop:"8px"},children:g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}Re()},style:{fontSize:"0.9em",padding:"6px 12px"},children:"Upgrade to Premium"})})]})]})]})]})}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Friends:"}),o.length?g.jsx("div",{className:"friends-scroll",children:g.jsx(S_,{className:"friends-panel",players:o,meId:t?.id||"",onPlayerClick:Ye=>{const At=document.querySelector(`[data-player-id="${Ye}"]`)?.querySelector(".avatar-ring");At&&j(Ye,At,"friends")}})}):g.jsx("span",{children:"No friends yet"})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Friend Requests:"}),z.length?g.jsx("div",{className:"friends-scroll",children:g.jsx(S_,{className:"friends-panel",players:z,meId:t?.id||"",onPlayerClick:Ye=>{const At=document.querySelector(`[data-player-id="${Ye}"]`)?.querySelector(".avatar-ring"),Rt=z.find(Dt=>Dt.id===Ye);At&&Rt?._req&&j(Ye,At,"requests",{id:Rt._req.id,incoming:!!Rt._incoming})}})}):g.jsx("span",{children:"No pending requests"})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Blocked Users:"}),u.length?g.jsx("div",{className:"friends-scroll",children:g.jsx(S_,{className:"friends-panel",players:u,meId:t?.id||"",onPlayerClick:Ye=>{const At=document.querySelector(`[data-player-id="${Ye}"]`)?.querySelector(".avatar-ring");At&&j(Ye,At,"blocked")}})}):g.jsx("span",{children:"No blocked users"})]}),P&&A&&x&&g.jsx(p6,{anchorRect:A,anchorEl:C,onClose:q,onMessages:x==="friends"?()=>{dr(P),q()}:void 0,onUnfriend:x==="friends"?()=>{ur(P),q()}:void 0,onBlockUser:x!=="requests"?async()=>{await nr(P),q()}:void 0,isFriend:x==="friends",isBlocked:x==="blocked",...x==="requests"&&N?.incoming?{onAddFriend:()=>{un({id:N.id}),q()},hideAddFriend:!1}:{}}),g.jsxs("div",{className:"profile-row profile-row--two",children:[g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Name:"}),g.jsx("div",{className:"editable-field",children:g.jsx("input",{type:"text",value:U,onChange:Ye=>W(Ye.target.value),disabled:G})})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Email:"}),g.jsx("div",{className:"editable-field",children:g.jsx("input",{type:"email",value:F,onChange:Ye=>Y(Ye.target.value),disabled:G})})]})]}),(()=>{const Ye=tf||HD,Yt=tf||$o,At=tf||Vo;return g.jsxs(g.Fragment,{children:[(Ye||Yt)&&g.jsxs("div",{className:"profile-row profile-row--two",children:[Ye&&g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Single‑player bots (Cee‑Lo):"}),g.jsxs("div",{className:"editable-field",children:[g.jsxs("select",{value:jt==null?"":String(jt),onChange:Rt=>{const Dt=Rt.target.value;De(Dt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(Dt)))))},disabled:G,"aria-label":"Preferred number of bots in single-player Cee‑Lo rooms",children:[g.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((Rt,Dt)=>g.jsx("option",{value:Dt,children:Dt},Dt))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]}),Yt&&g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Single‑player bots (Craps):"}),g.jsxs("div",{className:"editable-field",children:[g.jsxs("select",{value:nt==null?"":String(nt),onChange:Rt=>{const Dt=Rt.target.value;at(Dt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(Dt)))))},disabled:G,"aria-label":"Preferred number of bots in single-player Craps rooms",children:[g.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((Rt,Dt)=>g.jsx("option",{value:Dt,children:Dt},Dt))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})]}),At&&g.jsx("div",{className:"profile-row profile-row--two",children:g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Single‑player bots (Poker):"}),g.jsxs("div",{className:"editable-field",children:[g.jsxs("select",{value:we==null?"":String(we),onChange:Rt=>{const Dt=Rt.target.value;st(Dt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(Dt)))))},disabled:G,"aria-label":"Preferred number of bots in single-player Poker rooms",children:[g.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((Rt,Dt)=>g.jsx("option",{value:Dt,children:Dt},Dt))]}),g.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})})]})})(),g.jsx("div",{className:"profile-row",children:g.jsx("div",{className:"profile-section",children:g.jsxs("div",{className:"editable-field",children:[g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}bt()},disabled:G,children:G?"Saving...":"Save Profile"}),K&&g.jsx("div",{className:"error-message",children:K})]})})}),g.jsxs("div",{className:"profile-row profile-row--two",children:[g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Animations:"}),g.jsxs("div",{className:"editable-field",style:{display:"flex",alignItems:"center",gap:8},children:[g.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[g.jsx("input",{type:"checkbox",disabled:!Oe,checked:!!ee,onChange:()=>se(),"aria-label":ee?"Disable animations (dice physics, chip flights, background shake)":"Enable animations (dice physics, chip flights, background shake)"}),g.jsx("span",{children:ee?"Enabled":"Disabled"})]}),g.jsx("div",{className:"subtle",style:{opacity:.7},children:ee?"Full motion effects active.":"Reduced motion: static dice & suppressed decorative effects."})]})]}),g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Dice Color (Cee‑Lo & Craps):"}),g.jsxs("div",{className:"editable-field",style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[g.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[g.jsx("input",{type:"radio",name:"dice-color",value:"dice_red_white",checked:wt==="dice_red_white",onChange:()=>Qt("dice_red_white"),"aria-label":"Use red/white dice"}),g.jsx("span",{children:"Red/White"})]}),g.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[g.jsx("input",{type:"radio",name:"dice-color",value:"dice_green_gold",checked:wt==="dice_green_gold",onChange:()=>Qt("dice_green_gold"),"aria-label":"Use green/gold dice"}),g.jsx("span",{children:"Green/Gold"})]}),g.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[g.jsx("input",{type:"radio",name:"dice-color",value:"dice_white_black",checked:wt==="dice_white_black",onChange:()=>Qt("dice_white_black"),"aria-label":"Use white/black dice (default)"}),g.jsx("span",{children:"White/Black"})]})]})]})]}),g.jsxs("div",{className:"profile-row profile-row--two",children:[g.jsxs("div",{className:"profile-section",children:[g.jsxs("strong",{children:["Balance: ",td.formatMoney(t?.balance,"",2)]}),g.jsx("div",{className:"editable-field",children:g.jsx("button",{className:"felt-btn felt-btn--halo","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}try{he()}catch{}},disabled:G||Ie||!$e||!tt,"aria-label":We?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",title:We?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",children:ct?"Purchasing...":"Buy Credits"})}),g.jsx("strong",{children:"Restore:"}),g.jsx("div",{className:"editable-field",children:g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}try{fe()}catch{}},disabled:Ie||!$e||!tt,title:"Restore Purchases","aria-label":"Restore Purchases",children:"Restore"})})]}),g.jsxs("div",{className:"profile-section",children:[g.jsxs("strong",{children:["Membership:                                         ",t?.membershipTier===b_.PREMIUM?"Premium Active":"Free",g.jsx("span",{className:"badge","aria-live":"polite",children:t?.membershipTier===b_.PREMIUM?"P":""})]}),g.jsxs("div",{className:"editable-field",children:[t?.membershipTier===b_.PREMIUM?g.jsx(lP,{isPremium:!0,className:"felt-btn"}):Et&&g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}try{Re()}catch{}},disabled:Ie,"aria-label":Mt,title:Mt,children:"Go Premium"}),!it&&Et&&g.jsx("div",{className:"meta",style:{marginTop:6},children:(()=>{const Ye="$1.99",Yt="Monthly",At=Be||Ye,Rt=je||Yt,Dt=_t||`${At} Mo`,Nn=ge||"Remove ads and unlock premium features.";return g.jsxs(g.Fragment,{children:[Dt&&g.jsx("div",{className:"subtle","aria-hidden":!0,children:Dt}),g.jsx("div",{className:"legal-note","aria-hidden":!0,children:Nn}),g.jsxs("div",{className:"legal-note",role:"note",children:[g.jsx("strong",{children:"Premium Subscription"})," — ",At," (",Rt,"). Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",g.jsx("a",{href:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",g.jsx("a",{href:"/terms",className:"legal-link",children:"Terms of Use"}),"."]})]})})()})]})]})]}),g.jsx("div",{className:"profile-row",children:g.jsxs("div",{className:"profile-section",children:[g.jsx("strong",{children:"Account:"}),g.jsxs("div",{className:"editable-field",style:{display:"flex",flexDirection:"column",gap:8},children:[g.jsx("div",{className:"legal-note",children:"Deleting your account is permanent and cannot be undone."}),g.jsx("button",{className:"felt-btn felt-btn--danger","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}On()},disabled:He,"aria-label":"Delete Account",title:"Delete Account",children:He?"Deleting…":"Delete Account"}),xe&&g.jsx("div",{className:"error-message",children:xe})]})]})})]})})})}),g.jsx(lF,{open:a,onClose:Zt,planId:t?.membershipTier,featureDescription:"Upload custom avatars and create multiplayer rooms with Premium membership."}),g.jsx(S6,{open:b,onClose:Sr,peers:o,initialPeerId:T}),g.jsx(yP,{})]})}function Zbe(){const[t,e]=v.useState(Rc),[r,n]=v.useState(!1),a=v.useRef(null);v.useEffect(()=>{let o=!0;return(async()=>{const c=await nu();o&&(e(c),n(!0))})(),()=>{o=!1,a.current&&window.clearTimeout(a.current)}},[]),v.useEffect(()=>{r&&(a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{g0(t).catch(()=>{})},200))},[t,r]);const i=o=>e(c=>({...c,[o]:!c[o]}));return g.jsxs("div",{className:"settings-page",children:[g.jsxs("a",{className:"gold-link white-link",onClick:()=>history.back(),children:[g.jsx("img",{src:"/icons/arrow-left.svg",alt:"","aria-hidden":!0,className:"icon"})," Back"]}),g.jsx("div",{className:"settings-section",children:g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",checked:t.diceAudio,onChange:()=>i("diceAudio"),disabled:!r}),"Dice Audio"]})}),g.jsx("div",{className:"settings-section",children:g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",checked:t.backgroundMusic,onChange:()=>i("backgroundMusic"),disabled:!r}),"Background Music"]})}),g.jsx("div",{className:"settings-section",children:g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",checked:t.chatAudio,onChange:()=>i("chatAudio"),disabled:!r}),"In-Room Chat Audio"]})}),g.jsx("div",{className:"settings-section",children:g.jsxs("label",{children:[g.jsx("input",{type:"checkbox",checked:t.video,onChange:()=>i("video"),disabled:!r}),"Video"]})})]})}const E6=ci();async function e0e(){try{const t=await oi(),e=await fetch(`${E6}/api/ad-reward`,{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},credentials:"include"});if(!e.ok){const n=await e.json();return{ok:!1,error:n.error,retryInMs:n.retryInMs}}return{ok:!0,balance:(await e.json()).balance}}catch{return{ok:!1,error:"NETWORK_ERROR"}}}async function t0e(){try{const t=await oi(),e=await fetch(`${E6}/api/ad-reward/status`,{method:"GET",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},credentials:"include"});return e.ok?{ok:!0,nextAt:(await e.json()).nextAt}:{ok:!1,error:(await e.json()).error,nextAt:null}}catch{return{ok:!1,error:"NETWORK_ERROR",nextAt:null}}}const kL={claimAdReward:e0e,getAdRewardCooldown:t0e};function r0e(){const{busy:t,busyChips:e,ready:r,error:n,purchasesReady:a,premiumActive:i,hasPremiumPackage:o,premiumLabel:c,onBuyChips:u,onGoPremium:d,onRestore:f,chipsSubtitle:h,premiumSubtitle:m,chipsDescription:_,premiumDescription:w,premiumPrice:b,premiumInterval:E}=jg(),{refreshUser:T}=$r(),{infoNow:R,successNow:P}=Es(),[A,C]=v.useState(!1),[O,I]=v.useState(0),[x,D]=v.useState(()=>Date.now()),N=Math.max(0,O-x),L=N>0,j=zE.isNativeAdSupported(),q=!i&&j,U=v.useCallback(ce=>{const xe=Math.ceil(ce/1e3),re=Math.floor(xe/60),H=xe%60;return`${re}m ${H}s`},[]);v.useEffect(()=>{q&&(async()=>{try{const ce=await kL.getAdRewardCooldown();ce?.ok&&ce.nextAt&&ce.nextAt>Date.now()&&I(ce.nextAt)}catch{}})()},[q]),v.useEffect(()=>{!q||L||zE.prepareRewardedAd().catch(()=>{})},[q,L]),v.useEffect(()=>{if(!L)return;const ce=setInterval(()=>D(Date.now()),1e3);return()=>clearInterval(ce)},[L]);const W=v.useCallback(async()=>{if(!(A||L||!q)){cr("Light"),C(!0);try{const ce=await zE.showRewardedAd();if(!ce.ok){ce.error==="AD_DISMISSED"?R?.("Ad skipped - watch the full ad to earn credits!"):R?.(`Ad unavailable: ${ce.error}`),C(!1);return}const xe=await kL.claimAdReward();if(xe.ok){const re=XD*60*1e3;I(Date.now()+re),P?.(`+${pf} Z Credits earned!`);try{T()}catch{}}else if(xe.error==="COOLDOWN_ACTIVE"){const re=xe.retryInMs??XD*60*1e3;I(Date.now()+re),R?.("Please wait before watching another ad.")}else R?.(`Reward failed: ${xe.error}`)}catch{R?.("Something went wrong. Please try again.")}finally{C(!1)}}},[A,L,q,R,P,T]),F="$1.99",Y="Monthly",Q=b||F,ie=E||Y,G=m||`${Q} Mo`,B=w||"Remove ads and unlock premium features.",K="$1.99 for 1,000 Zentara Credits",ae="Buy Zentara Credits to keep playing.",te=h||K,me=_||ae,ue=()=>{try{cr("Light")}catch{}try{u()}catch{}},Ae=()=>{try{cr("Light")}catch{}try{d()}catch{}},He=()=>{try{cr("Light")}catch{}try{f()}catch{}};return g.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[g.jsx(ji,{className:"profile-page-body"}),g.jsx("div",{className:"logout-container  home-header-row",children:g.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}history.back()},children:[g.jsx(_d,{className:"icon",style:{color:"var(--gold, #caa64d)"}})," Back"]})}),g.jsx("div",{className:"home-fit-shell",children:g.jsxs("div",{className:"home-fit-content",children:[n&&g.jsx("div",{className:"error-message",role:"alert",children:n}),!n&&r&&!a&&g.jsx("div",{className:"status-message","aria-live":"polite",children:"Initializing… please wait."}),g.jsxs("div",{className:"home-action-buttons",children:[q&&g.jsxs("div",{className:"outline-action-btn-wrapper",children:[g.jsx("button",{className:"felt-btn felt-btn--secondary","data-no-global-haptic":!0,onClick:W,disabled:A||L,"aria-label":`Watch ad for ${pf} free credits`,title:`Watch ad for ${pf} free credits`,style:{background:"linear-gradient(135deg, #2d5a2d 0%, #1a3d1a 100%)",borderColor:"#4a8f4a"},children:A?"Loading Ad…":L?`Available in ${U(N)}`:`🎬 WATCH AD → +${pf}`}),g.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[g.jsxs("div",{className:"subtle","aria-hidden":!0,children:["Free ",pf," Z Credits"]}),g.jsx("div",{className:"hint","aria-hidden":!0,children:"Watch a short video to earn free credits!"})]})]}),g.jsxs("div",{className:"outline-action-btn-wrapper",children:[g.jsx("button",{className:"felt-btn felt-btn--halo","data-no-global-haptic":!0,onClick:ue,disabled:t||!r||!a,"aria-label":"Buy 1000 Z Credits",title:"Buy 1000 Z Credits",children:e?"Purchasing…":"BUY Z CREDITS"}),g.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[g.jsx("div",{className:"subtle","aria-hidden":!0,children:te}),g.jsx("div",{className:"hint","aria-hidden":!0,children:me})]})]}),g.jsxs("div",{className:"outline-action-btn-wrapper",children:[!i&&o&&g.jsxs(g.Fragment,{children:[g.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:Ae,disabled:t,"aria-label":c,title:c,children:"GO PREMIUM"}),g.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[G&&g.jsx("div",{className:"subtle","aria-hidden":!0,children:G}),g.jsx("div",{className:"hint","aria-hidden":!0,children:B}),g.jsxs("div",{className:"legal-note",role:"note",style:{marginTop:8,fontSize:12,opacity:.85},children:[g.jsx("strong",{children:"Premium Subscription"})," — ",Q," (",ie,"). Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",g.jsx("a",{href:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",g.jsx("a",{href:"/terms",className:"legal-link",children:"Terms of Use"}),"."]})]})]}),i&&g.jsx("div",{style:{textAlign:"center"},children:g.jsx(lP,{isPremium:!0})})]}),o&&g.jsx("div",{className:"outline-action-btn-wrapper",children:g.jsxs("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:He,disabled:t||!r||!a,"aria-label":"Restore Purchases",title:"Restore Purchases",children:["RESTORE",g.jsx("br",{}),"PURCHASES"]})})]})]})}),g.jsx(yP,{})]})}function VA({open:t,onClose:e,title:r="Error",message:n}){return iB(!!t),v.useEffect(()=>{const a=i=>{i.key==="Escape"&&e()};return t&&document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[t,e]),t?g.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:e,children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":r,onClick:a=>a.stopPropagation(),children:[g.jsx("button",{className:"modal-close",onClick:e,"aria-label":"Close",children:"×"}),g.jsx("h3",{className:"modal-title",children:r}),g.jsx("p",{className:"modal-subtitle",role:"alert",children:n}),g.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:12},children:g.jsx("button",{className:"btn close-btn",onClick:e,"aria-label":"Close",children:"Close"})})]})}):null}function n0e(){const[t,e]=v.useState("verifying"),r=tn(),{refreshUser:n}=$r();v.useEffect(()=>{(async()=>{const c=new URLSearchParams(window.location.search).get("token");if(!c)return e("error");try{const u=await $H(c);if(u?.success){u.token&&await Qf(u.token);try{await n({force:!0})}catch{}try{setTimeout(()=>{n({force:!0}).catch(()=>{})},400)}catch{}if(await Ab()){e("success");return}e("success")}else e("error")}catch{e("error")}})()},[r,n]),v.useEffect(()=>{if(t!=="success")return;const i=window.setTimeout(()=>{try{r("/?redirect=/lobby",{replace:!0})}catch{window.location.href=`${window.location.origin}/?redirect=/lobby`}},1200);return()=>{window.clearTimeout(i)}},[t,r]);const a=i=>i==="verifying"?g.jsxs(g.Fragment,{children:[g.jsx("p",{children:"Verifying your magic link..."}),g.jsx("button",{className:"landing-btn-secondary",onClick:()=>r("/login"),style:{marginTop:16},"aria-label":"Back to Login",children:"Back to Login"})]}):i==="success"?g.jsx("p",{children:"Verification successful! Redirecting to the lobby..."}):g.jsxs(g.Fragment,{children:[g.jsx(VA,{open:!0,onClose:()=>r("/login"),title:"Verification failed",message:"Verification failed. Please try again."}),g.jsx("button",{className:"landing-btn-secondary",onClick:()=>r("/login"),style:{marginTop:16},"aria-label":"Back to Login",children:"Back to Login"})]});return g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"0 16px"},children:g.jsx("div",{children:a(t)})})]})}function a0e(){const[t,e]=v.useState("verifying"),[r,n]=v.useState(!1),a=tn(),i=ci();return v.useEffect(()=>{(async()=>{const u=new URLSearchParams(window.location.search).get("token");if(!u){e("error");return}try{const d=await fetch(`${i}/api/auth/review-login?token=${encodeURIComponent(u)}`,{method:"GET",credentials:"include",redirect:"follow"});if(!d.ok){e("error");return}let f=null;try{const h=await d.json().catch(()=>null);h?.token&&await Qf(h.token)}catch{}if(f=await Ab(),f){e("success"),window.location.href=`${window.location.origin}/?redirect=/lobby`;return}else e("error")}catch{e("error")}})()},[i,a]),v.useEffect(()=>{t==="error"&&n(!0)},[t]),t==="verifying"?g.jsx("p",{children:"Signing you in for review…"}):t==="success"?g.jsx("p",{children:"Success! Redirecting to the lobby…"}):g.jsx(g.Fragment,{children:g.jsx(VA,{open:r,onClose:()=>n(!1),title:"Review login failed",message:"Review login failed. Please check your link."})})}function i0e(){const[t,e]=v.useState("verifying"),[r,n]=v.useState(!1),a=tn(),i=ci();return v.useEffect(()=>{(async()=>{const u=new URLSearchParams(window.location.search).get("token");if(!u){e("error");return}try{const d=await fetch(`${i}/api/auth/qa-login?token=${encodeURIComponent(u)}`,{method:"GET",credentials:"include",redirect:"follow"});if(!d.ok){e("error");return}try{const h=await d.json().catch(()=>null);h?.token&&await Qf(h.token)}catch{}if(await Ab()){e("success"),window.location.href=`${window.location.origin}/?redirect=/lobby`;return}else e("error")}catch{e("error")}})()},[i,a]),v.useEffect(()=>{t==="error"&&n(!0)},[t]),t==="verifying"?g.jsx("p",{children:"Signing you in for QA…"}):t==="success"?g.jsx("p",{children:"Success! Redirecting to the lobby…"}):g.jsx(g.Fragment,{children:g.jsx(VA,{open:r,onClose:()=>n(!1),title:"QA login failed",message:"QA login failed. Please check your link."})})}function s0e({fly:t,onComplete:e}){const r=v.useRef({startX:t.startX,startY:t.startY,endX:t.endX,endY:t.endY,amount:t.amount}).current,n=v.useRef(null);v.useEffect(()=>{const i=sa.chipFlyDurationMs,o=0,c=100;n.current=window.setTimeout(()=>{try{AG({playbackRate:1.25})}catch{}},o+c);const u=setTimeout(e,i+600);return()=>{clearTimeout(u),n.current&&(window.clearTimeout(n.current),n.current=null)}},[e]);const a=18;return v.useRef(null),g.jsx(Ks.div,{initial:{position:"fixed",left:r.startX-a,top:r.startY-a,zIndex:1e4,opacity:0,scale:.9},animate:{left:r.endX-a,top:r.endY-a,opacity:1,scale:1},transition:{type:"spring",stiffness:120,damping:20,duration:sa.chipFlyDurationMs/1e3},onAnimationComplete:e,style:{pointerEvents:"none"},children:g.jsx(Lc,{mini:!0,value:r.amount,disabled:!0,className:"chip--flight",selectedTimes:0})})}function Sm({label:t,subtitle:e,onClick:r,className:n,disabled:a,imageName:i,imgSrc:o,size:c="md",ariaLabel:u,showHalo:d}){const f=["gold-btn",`gold-btn--${c}`,o||i?"gold-btn--image":"gold-btn--styled",n||""].filter(Boolean).join(" "),h=i?`/ui/buttons/${i}.webp`:void 0,m=o||h;return g.jsxs("button",{type:"button",className:f,onClick:r,disabled:a,"aria-label":u||t,children:[d&&g.jsx("span",{className:"gold-btn__halo","aria-hidden":!0}),m&&g.jsx("span",{className:"gold-btn__media","aria-hidden":!0,children:g.jsxs("picture",{children:[g.jsx("source",{srcSet:m,type:"image/webp"}),g.jsx("img",{src:m,alt:"",loading:"lazy"})]})}),g.jsxs("span",{className:"gold-btn__text",children:[g.jsx("span",{className:"gold-btn__label",children:t}),e?g.jsx("span",{className:"gold-btn__sub","aria-hidden":!0,children:e}):null]})]})}function No({label:t,subtitle:e,onClick:r,disabled:n,size:a="md",ariaLabel:i,className:o,variant:c="pill",showHalo:u}){const d=[o,c==="circle"?"poker-action--circle":""].filter(Boolean).join(" "),[f,h]=Tt.useState(!1),m=Tt.useCallback(()=>{try{Xr()}catch{}h(!1),requestAnimationFrame(()=>{h(!0),window.setTimeout(()=>h(!1),260)});try{cr("Light")}catch{}try{}catch{}typeof r=="function"&&r()},[r]),_=typeof u=="boolean"?u:!n;return g.jsx("span",{className:["poker-action-spring",f?"is-spring":""].filter(Boolean).join(" "),"data-no-global-haptic":!0,children:g.jsx(Sm,{label:t,subtitle:e,onClick:m,disabled:n,size:a,ariaLabel:i,className:d,showHalo:_})})}function o0e(){const t=[{id:"bet1",type:"MAIN",playerId:"player1",acceptedById:"banker1",amount:100},{id:"bet2",type:"MAIN",playerId:"player2",acceptedById:null,amount:50}],e=[{id:"player1",name:"Alice"},{id:"player2",name:"Bob"},{id:"banker1",name:"Banker"}],[r,n]=v.useState({1:0,5:0,10:1,25:0,100:0}),[a,i]=v.useState(10),[o,c]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState([]),m=v.useRef(null),_=v.useRef({c1:null,c2:null,c3:null,c4:null}),w=x=>{if(!x)return null;const D=x.getBoundingClientRect();return{x:D.left+D.width/2,y:D.top+D.height/2}},b=v.useCallback((x,D,N)=>{const L=w(x),j=w(D);if(!L||!j)return;const U={id:`flight-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,amount:N,fromId:"sandbox-from",toId:"sandbox-to",startX:L.x,startY:L.y,endX:j.x,endY:j.y,active:!0};h(W=>[...W,U])},[]),E=()=>{b(_.current.c1,m.current,25)},T=()=>{["c1","c2","c3","c4"].forEach((x,D)=>{setTimeout(()=>b(_.current[x],m.current,5*(D+1)),D*40)})},R=()=>{["c1","c2","c3","c4"].forEach((x,D)=>{setTimeout(()=>b(m.current,_.current[x],10*(D+1)),D*40)})},P=x=>{h(D=>D.filter(N=>N.id!==x))},A=x=>{n(D=>({...D,[x]:(D[x]||0)+1})),i(D=>D+x)},C=x=>{n(D=>({...D,[x]:0})),i(D=>D-x*(r[x]||0))},O=()=>{c(!0),d(!0)},I=()=>{c(!1),d(!1),n({1:0,5:0,10:0,25:0,100:0}),i(0)};return g.jsxs("div",{className:"button-sandbox",children:[g.jsx("h1",{children:"Button Sandbox"}),g.jsx(ji,{className:"profile-page"}),g.jsxs("section",{style:{marginBottom:28},children:[g.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"ChipFly Test"}),g.jsxs("div",{style:{position:"relative",padding:16,border:"1px solid rgba(255,255,255,0.15)",borderRadius:8,display:"flex",flexDirection:"column",gap:12},children:[g.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:[g.jsx("button",{className:"felt-btn felt-btn--mini",onClick:E,children:"Single Flight"}),g.jsx("button",{className:"felt-btn felt-btn--mini",onClick:T,children:"Sweep 456"}),g.jsx("button",{className:"felt-btn felt-btn--mini",onClick:R,children:"Sweep 123"}),g.jsx("button",{className:"felt-btn felt-btn--mini",onClick:()=>h([]),style:{background:"#933",borderColor:"#600"},children:"Clear Flights"})]}),g.jsxs("div",{style:{position:"relative",minHeight:170,marginTop:8,display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0 12px"},children:[g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:["c1","c2"].map(x=>g.jsx("div",{ref:D=>{_.current[x]=D},children:g.jsx(Lc,{mini:!0,value:5,disabled:!0,className:"chip--flight"})},x))}),g.jsxs("div",{ref:m,children:[g.jsx(Lc,{mini:!0,value:100,disabled:!0,className:"chip--flight"}),g.jsx("div",{style:{textAlign:"center",marginTop:4,fontSize:11,opacity:.7},children:"Banker"})]}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:["c3","c4"].map(x=>g.jsx("div",{ref:D=>{_.current[x]=D},children:g.jsx(Lc,{mini:!0,value:25,disabled:!0,className:"chip--flight"})},x))})]})]}),f.map(x=>g.jsx(s0e,{fly:x,onComplete:()=>P(x.id)},x.id))]}),g.jsxs("section",{style:{marginBottom:28},children:[g.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"Flash Overlays"}),g.jsxs("div",{className:"flash-preview__row",children:[g.jsx("div",{className:"flash-preview__header",children:g.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:g.jsx("div",{className:"flash-card flash-win",children:g.jsxs("div",{className:"flash-body",children:[g.jsxs("div",{className:"flash-title",children:[g.jsx("span",{className:"flash-title__name",children:"ALICE"}),g.jsx("span",{className:"flash-title__rest",children:"WINS"})]}),g.jsxs("div",{className:"flash-subtitle",children:[g.jsx("span",{className:"keep-lower",children:"z"}),"250"]})]})})})}),g.jsx("div",{className:"flash-preview__header",children:g.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:g.jsx("div",{className:"flash-card flash-lose",children:g.jsxs("div",{className:"flash-body",children:[g.jsxs("div",{className:"flash-title",children:[g.jsx("span",{className:"flash-title__name",children:"BANKER"}),g.jsx("span",{className:"flash-title__rest",children:"LOSES"})]}),g.jsxs("div",{className:"flash-subtitle",children:[g.jsx("span",{className:"keep-lower",children:"z"}),"120"]})]})})})}),g.jsx("div",{className:"flash-preview__header",children:g.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:g.jsx("div",{className:"flash-card flash-push",children:g.jsxs("div",{className:"flash-body",children:[g.jsx("div",{className:"flash-title",children:"PUSH"}),g.jsx("div",{className:"flash-subtitle",children:"No Action"})]})})})})]}),g.jsxs("div",{className:"flash-preview__row",children:[g.jsx("div",{className:"flash-frame",children:g.jsx("div",{className:"flash-card flash-win","aria-hidden":!0,children:g.jsxs("div",{className:"flash-body",children:[g.jsxs("div",{className:"flash-title",children:[g.jsx("span",{className:"flash-title__name",children:"ALICE"}),g.jsx("span",{className:"flash-title__rest",children:"WINS"})]}),g.jsxs("div",{className:"flash-subtitle",children:[g.jsx("span",{className:"keep-lower",children:"z"}),"250"]})]})})}),g.jsx("div",{className:"flash-frame",children:g.jsx("div",{className:"flash-card flash-lose","aria-hidden":!0,children:g.jsxs("div",{className:"flash-body",children:[g.jsxs("div",{className:"flash-title",children:[g.jsx("span",{className:"flash-title__name",children:"BANKER"}),g.jsx("span",{className:"flash-title__rest",children:"LOSES"})]}),g.jsxs("div",{className:"flash-subtitle",children:[g.jsx("span",{className:"keep-lower",children:"z"}),"120"]})]})})}),g.jsx("div",{className:"flash-frame",children:g.jsx("div",{className:"flash-card flash-push","aria-hidden":!0,children:g.jsxs("div",{className:"flash-body",children:[g.jsx("div",{className:"flash-title",children:"PUSH"}),g.jsx("div",{className:"flash-subtitle",children:"No Action"})]})})})]})]}),g.jsxs("section",{style:{marginBottom:28},children:[g.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"Poker Action Buttons"}),g.jsxs("div",{className:"poker-actions",role:"group","aria-label":"Poker action buttons",style:{display:"flex",gap:12,flexWrap:"wrap",alignItems:"center"},children:[g.jsx(No,{label:"Check",ariaLabel:"Check",size:"md",className:"poker-action--green poker-action--secondary poker-action--check",onClick:()=>{}}),g.jsx(No,{label:"Call",subtitle:"z120",ariaLabel:"Call 120",size:"md",className:"poker-action--green poker-action--primary poker-action--call",onClick:()=>{}}),g.jsx(No,{label:"Bet",subtitle:"z250",ariaLabel:"Bet 250",size:"md",className:"poker-action--flat poker-action--secondary poker-action--bet",onClick:()=>{}}),g.jsx(No,{label:"Raise",subtitle:"z400",ariaLabel:"Raise 400",size:"md",className:"poker-action--flat poker-action--secondary poker-action--raise",onClick:()=>{}}),g.jsx(No,{label:"Fold",ariaLabel:"Fold",size:"md",className:"poker-action--flat poker-action--danger poker-action--fold",onClick:()=>{}})]})]}),g.jsxs("div",{className:"button-grid",children:[g.jsx("div",{className:"button-item",children:g.jsx(Gz,{onClick:()=>{},label:"ROLL",busy:!1,disabled:!1})}),g.jsx("div",{className:"button-item",children:g.jsx(KC,{onClick:()=>{},busy:!1,disabled:!1,label:"Cancel Bet"})}),g.jsx("div",{className:"button-item",children:o?g.jsx(KC,{onClick:I,busy:!1,disabled:!1,label:"Cancel Bet"}):g.jsx(Hz,{disabled:a<=0,onClick:O,busy:!1,label:"✓"})}),g.jsx("div",{className:"button-item",children:g.jsx(k0,{selectedTimes:r,onAdd:A,onClear:C,disabled:o,collapsed:u,collapseLabel:"Chip Rack",betTokenProps:{isBanker:!1,meId:"player1",open:t,players:e,show:o},onPlaceBet:O,onCancelBet:I,mainAmt:a})}),g.jsx("div",{className:"button-item",children:g.jsx(vP,{state:"verified"})})]})]})}function c0e(){const t=tn(),e=()=>{window.history.length>1?t(-1):t("/lobby",{replace:!0})};return g.jsx("div",{className:"disclaimer-screen",children:g.jsxs("div",{className:"disclaimer-panel",children:[g.jsxs("button",{type:"button",className:"disclaimer-back",onClick:e,"aria-label":"Back",children:[g.jsx(_d,{className:"icon",style:{color:"var(--gold, #caa64d)"}})," Back"]}),g.jsx("div",{className:"disclaimer-accent-bar"}),g.jsx("h1",{className:"disclaimer-title",children:"Disclaimer"}),g.jsxs("div",{className:"disclaimer-body",children:[g.jsxs("p",{children:[g.jsx("strong",{children:"Zentara One Dice Lounge"})," is a social casino game intended for entertainment purposes only. No real money gambling takes place within this app."]}),g.jsx("p",{children:"Virtual chips used in gameplay have no cash value and cannot be redeemed for real money, goods, or services."}),g.jsx("p",{children:"For your privacy and to keep rooms fresh for active players, the app will automatically return you to the Lobby after 4 minutes of inactivity."}),g.jsx("p",{children:"This game is intended for an adult audience (18+). Playing does not imply future success at real money gambling. Please play responsibly."}),g.jsx("p",{children:"If you or someone you know has a gambling problem and needs help, please contact your local gambling support hotline."})]}),g.jsxs("div",{className:"disclaimer-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function l0e(){const t=tn();return g.jsx("div",{className:"legal-screen",children:g.jsxs("div",{className:"legal-panel",children:[g.jsx("div",{className:"legal-accent-bar"}),g.jsxs("div",{className:"legal-header",children:[g.jsxs("button",{type:"button",className:"legal-back",onClick:()=>t(-1),"aria-label":"Go back",children:[g.jsx(_d,{className:"icon",style:{color:"var(--gold, #caa64d)"}}),"Back"]}),g.jsx("h1",{className:"legal-title",children:"Support"})]}),g.jsxs("div",{className:"legal-body",children:[g.jsx("p",{children:"Need help with Zentara One Dice Lounge? We're here for you."}),g.jsxs("p",{children:["Email us at"," ",g.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"})," ","and we'll get back to you as soon as possible."]}),g.jsx("p",{children:"Please include your device, OS version, and a brief description of the issue."})]}),g.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function u0e(){const t=tn();return g.jsx("div",{className:"legal-screen",children:g.jsxs("div",{className:"legal-panel",children:[g.jsx("div",{className:"legal-accent-bar"}),g.jsxs("div",{className:"legal-header",children:[g.jsxs("button",{type:"button",className:"legal-back",onClick:()=>t(-1),"aria-label":"Go back",children:[g.jsx(_d,{className:"icon",style:{color:"var(--gold, #caa64d)"}}),"Back"]}),g.jsx("h1",{className:"legal-title",children:"Privacy Policy"})]}),g.jsxs("div",{className:"legal-body",children:[g.jsx("p",{children:"We respect your privacy. Zentara One Dice Lounge, Zentara One Poker Lounge, Zentara One Craps Lounge and Zentara One Cee-Lo Lounge all collect minimal data needed to operate the app (such as an email for login, in-app purchase history via Apple/Google, and basic device info for diagnostics). We do not sell your personal information."}),g.jsxs("p",{children:["For questions or data requests, contact"," ",g.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"}),"."]})]}),g.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function d0e(){const t=tn();return g.jsx("div",{className:"legal-screen",children:g.jsxs("div",{className:"legal-panel",children:[g.jsx("div",{className:"legal-accent-bar"}),g.jsxs("div",{className:"legal-header",children:[g.jsxs("button",{type:"button",className:"legal-back",onClick:()=>t(-1),"aria-label":"Go back",children:[g.jsx(_d,{className:"icon",style:{color:"var(--gold, #caa64d)"}}),"Back"]}),g.jsx("h1",{className:"legal-title",children:"Terms of Use"})]}),g.jsxs("div",{className:"legal-body",children:[g.jsx("p",{children:"By using Zentara One Dice Lounge (the “App”), you agree to these Terms of Use. If you do not agree, do not use the App."}),g.jsx("h2",{children:"1. Apple Standard EULA"}),g.jsxs("p",{children:["For iOS users, the App is licensed to you under the Apple Media Services Terms and Conditions, including the standard Apple End User License Agreement (EULA). You can review the Apple EULA here:"," ",g.jsx("a",{className:"legal-link",href:"https://www.apple.com/legal/internet-services/itunes/dev/stdeula/",target:"_blank",rel:"noopener noreferrer",children:"https://www.apple.com/legal/internet-services/itunes/dev/stdeula/"}),"."]}),g.jsx("h2",{children:"2. Subscriptions and Billing"}),g.jsx("p",{children:"The App may offer auto-renewable subscriptions. Payment will be charged to your Apple ID at confirmation of purchase. Subscriptions automatically renew unless canceled at least 24 hours before the end of the current period. You can manage or cancel your subscription in your account settings on your device."}),g.jsx("h2",{children:"3. Refunds"}),g.jsx("p",{children:"Refunds for purchases made via the App Store are handled by Apple directly, per Apple policies."}),g.jsx("h2",{children:"4. Acceptable Use"}),g.jsx("p",{children:"You agree not to misuse the App, attempt to disrupt its operation, or violate any applicable laws. We may suspend or terminate access for violations."}),g.jsx("h2",{children:"5. Privacy"}),g.jsxs("p",{children:["Please review our"," ",g.jsx("a",{className:"legal-link",href:"/privacy",children:"Privacy Policy"})," ","to understand how we collect and use information."]}),g.jsx("h2",{children:"6. Contact"}),g.jsxs("p",{children:["Questions? Contact"," ",g.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"}),"."]})]}),g.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}ci();function HA({children:t,header:e,footer:r,showAvatarBacks:n=!1}){return g.jsxs("div",{className:"poker-room-shell","aria-label":"Poker Room","data-game-mode":"poker","data-show-avatar-backs":n?"1":void 0,children:[g.jsx(ji,{className:"page-poker-room"}),g.jsx("div",{className:"poker-room-bg"}),g.jsxs("div",{className:"poker-room-foreground",role:"main",children:[e,g.jsx("div",{className:"poker-room-content",children:t}),r]})]})}function f0e({cards:t,firstRevealed:e=!0,bothRevealed:r=!0}){const[n,a]=Array.isArray(t)?t:[];return!n&&!a?null:g.jsxs("div",{className:"holecards","aria-label":"hole-cards",children:[g.jsx(wL,{value:n,revealed:!!e||!!r}),g.jsx(wL,{value:a,revealed:!!r})]})}function wL({value:t,revealed:e=!1}){if(!t)return g.jsx("span",{className:"poker-card"+(e?" revealed":""),"aria-hidden":!0});const{rank:r,suit:n}=p0e(t),a=n==="hearts"||n==="diamonds";return g.jsxs("div",{className:["poker-card",a?"poker-card--red":"",e?"revealed":""].filter(Boolean).join(" "),"aria-label":`${r} of ${n}`,children:[g.jsx("span",{className:"poker-card__rank",children:r}),g.jsx("span",{className:"poker-card__suit",children:h0e(n)})]})}function p0e(t){const e=String(t||"").trim().toUpperCase(),r=e.slice(0,-1),n=e.slice(-1);return{rank:r==="T"?"10":r,suit:n==="H"?"hearts":n==="D"?"diamonds":n==="C"?"clubs":"spades"}}function h0e(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function m0e({gameState:t,players:e,winners:r,hands:n,durationMs:a,meId:i}){const o=v.useRef(null),c=v.useRef(null),u=v.useRef(null),{info:d}=Es();v.useEffect(()=>{const f=o.current,h=t||{};o.current=h;const m=h?.pokerLastAction;if(m&&typeof m.seq=="number"){const Y=(Array.isArray(h?.pokerSeats)?h.pokerSeats:[]).find(Q=>Q.seatIndex===m.seatIndex);if(Y){const Q=e.find(te=>te.id===Y.playerId),ie=Q?.name||Q?.email||"Player";let G;const B=te=>typeof te=="number"?`z${te.toLocaleString("en-US")}`:"";switch((m.action||"").toLowerCase()){case"fold":G="Fold";break;case"check":G="Check";break;case"call":G=`Call ${B(m.amountDelta)}`;break;case"bet":G=`Bet ${B(m.amountDelta)}`;break;case"raise":G=m.toBet?`Raise to ${B(m.toBet)}`:`Raise ${B(m.amountDelta)}`;break;default:G="Action";break}const ae=`srv:${Number(h?.pokerRoundSeq||0)||0}:${m.seq}`;u.current!==ae&&(d(`${ie}: ${G}`,void 0),u.current=ae),c.current=m.seq;return}}if(!f)return;const _=f?.pokerPhase??"waiting",w=h?.pokerPhase??"waiting";if(_!==w&&_==="waiting"&&w==="pre-flop")return;const b=Array.isArray(f?.pokerSeats)?f.pokerSeats:[],E=Array.isArray(h?.pokerSeats)?h.pokerSeats:[];if(!E.length)return;const T=F=>{const Y=new Map;for(const Q of F)Y.set(Q.seatIndex,Q);return Y},R=T(b),P=T(E),A=f?.pokerActingSeat,C=h?.pokerActingSeat,O=f?.pokerCurrentBet||0,I=h?.pokerCurrentBet||0;let x=null,D=null;for(const F of E){const Y=R.get(F.seatIndex);if(Y&&(Y.status==="active"||Y.status==="all-in")&&F.status==="folded"){x=F,D="Fold";break}}if(!D)for(const F of E){const Y=R.get(F.seatIndex);if(!Y)continue;const Q=(F.committed||0)-(Y.committed||0);if(Q>0){x=F,O===0?D=`Bet z${Q}`:I>O?D=`Raise to z${I}`:D=`Call z${Q}`;break}}if(!D&&A!=null&&C!=null&&A!==C){const F=R.get(A),Y=P.get(A);F&&Y&&F.status==="active"&&Y.status==="active"&&(F.committed||0)===(Y.committed||0)&&(x=Y,D="Check")}if(!D||!x)return;const N=e.find(F=>F.id===x.playerId),j=`${N?.name||N?.email||"Player"}: ${D}`,q=Number(h?.pokerRoundSeq||0)||0;try{const F=typeof window<"u"?window:void 0,Y=F&&F.__pokerWinnersFlashGuard;if(Y&&Y.roundSeq===q)return}catch{}const U=Number(x?.committed||0),W=`heur:${q}:${x.seatIndex}:${D}:${U}:${I}`;u.current!==W&&(d(j,void 0),u.current=W)},[t,e,d,a])}function SL({enabled:t,onComplete:e,perCardSec:r=.55,staggerSec:n=.12,origin:a,handKey:i,getTargets:o,passes:c=2}){const u=v.useRef(null),[d,f]=v.useState([]),[h,m]=v.useState(!1),_=v.useMemo(()=>{if(!u.current)return{x:0,y:0};const E=u.current.getBoundingClientRect(),T=a?.xPct??.5,R=a?.yPct??.78;return{x:E.width*T,y:E.height*R}},[a,u.current]);v.useEffect(()=>{if(!t)return;const b=u.current;if(!b||typeof window>"u")return;let E=[];if(typeof o=="function")try{E=o(b)||[]}catch{E=[]}else{const T=b.getBoundingClientRect();E=Array.from(document.querySelectorAll(".poker-room-header .avatar-ring")).map(P=>{const A=P.getBoundingClientRect();return{x:(A.left+A.right)/2-T.left,y:(A.top+A.bottom)/2-T.top}})}f(E)},[t,i,o]),v.useEffect(()=>{if(!t)return;try{rp(["cardSwoosh"])}catch{}(async()=>{const R=await D_(["cardSwoosh"],900);m(R)})();const b=d.length*Math.max(1,c);if(b===0){const R=setTimeout(()=>e?.(),10);return()=>clearTimeout(R)}const E=(b-1)*n+r,T=setTimeout(()=>e?.(),E*1e3);return()=>clearTimeout(T)},[t,d,r,n,e,c]);const w=v.useMemo(()=>{const b=[],E=Math.max(1,c);for(let T=0;T<E;T++)for(let R=0;R<d.length;R++){const P=T*d.length+R;b.push({key:`card-${T}-${R}`,delay:P*n,to:d[R]})}return b},[d,c,n,i]);return v.useEffect(()=>{if(!t||!w.length||!h)return;const b=[],T=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)?70:0;let R=0,P=!0;for(const A of w){const C=Math.max(0,(A.delay||0)*1e3),I=Math.max(C+(P?30:0),R+T),x=window.setTimeout(()=>{try{RG({volume:.0125})}catch{}},I);R=I,P=!1,b.push(x)}return()=>{b.forEach(A=>window.clearTimeout(A))}},[t,w,h]),!t||!h?null:g.jsx("div",{ref:u,className:"poker-dealing-layer","aria-hidden":!0,style:{willChange:"transform, opacity"},children:w.map(b=>g.jsx(Ks.div,{className:"poker-dealing-card",initial:{x:_.x,y:_.y,opacity:0},animate:{x:b.to.x,y:b.to.y,opacity:1},transition:{duration:r,delay:b.delay,ease:"easeOut"},style:{willChange:"transform, opacity",backfaceVisibility:"hidden"}},b.key))})}function g0e({players:t,entries:e,onClose:r}){const n=Tt.useCallback((o,c)=>t.find(u=>u.id===o)?.name||`Seat ${c+1}`,[t]),a=Tt.useCallback(o=>{if(!o||typeof o.category!="number")return;const c=o.category|0,u=Array.isArray(o.tiebreak)?o.tiebreak:[],d=h=>"23456789TJQKA"[Math.max(0,Math.min(12,h))]||"?",f=h=>({2:"Deuce",3:"Three",4:"Four",5:"Five",6:"Six",7:"Seven",8:"Eight",9:"Nine",T:"Ten",J:"Jack",Q:"Queen",K:"King",A:"Ace"})[d(h)]||d(h);switch(c){case 8:return`Straight Flush (${f(u[0]??0)} high)`;case 7:return`Four of a Kind (${f(u[0]??0)}s)`;case 6:return`Full House (${f(u[0]??0)}s over ${f(u[1]??0)}s)`;case 5:return`Flush (${[u[0],u[1],u[2],u[3],u[4]].filter(h=>h!=null).map(h=>d(h)).join("")})`;case 4:return`Straight (${f(u[0]??0)} high)`;case 3:return`Three of a Kind (${f(u[0]??0)}s)`;case 2:return`Two Pair (${f(u[0]??0)}s & ${f(u[1]??0)}s)`;case 1:return`One Pair (${f(u[0]??0)}s)`;default:return`High Card (${f(u[0]??0)})`}},[]),i=Tt.useMemo(()=>[...e].sort((o,c)=>c.roundSeq-o.roundSeq),[e]);return g.jsxs("div",{className:"results-modal","data-testid":"poker-history-modal",children:[g.jsx("div",{className:"results-modal__backdrop",onClick:r}),g.jsxs("div",{className:"results-modal__card card",style:{maxWidth:900},children:[g.jsxs("div",{className:"results-modal__header",children:[g.jsx("h3",{children:"Poker History"}),g.jsx("button",{className:"btn btn--ghost",onClick:r,"aria-label":"Close History",children:"Close"})]}),i.length===0&&g.jsx("div",{children:"No hands yet."}),g.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,maxHeight:"70vh",overflow:"auto"},children:i.map(o=>g.jsxs("div",{className:"card",style:{padding:10,background:"rgba(255,255,255,0.05)"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:8},children:[g.jsxs("div",{style:{fontWeight:600},children:["Hand ",o.roundSeq]}),g.jsxs("div",{"aria-label":"pot",children:["Pot: z",o.pot||0]})]}),g.jsx("div",{"aria-label":"seats",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:8},children:(o.seats&&o.seats.length?o.seats:o.hands.map(c=>({playerId:c.playerId,seatIndex:c.seatIndex}))).map((c,u)=>{const d=o.winners.find(b=>b.playerId===c.playerId),f=n(c.playerId,c.seatIndex),h=!!d,m=String(c.status||"").toLowerCase()==="folded",_=a(c.rank||d?.rank),w=typeof d?.amount=="number"?d.amount:0;return g.jsxs("div",{className:["poker-history__seat",h?"is-winner":""].filter(Boolean).join(" "),style:{padding:8,borderRadius:6,background:h?"rgba(40,180,80,0.15)":"rgba(255,255,255,0.06)"},children:[g.jsx("div",{style:{fontWeight:600,marginBottom:4},children:f}),g.jsx("div",{style:{fontSize:13,opacity:.9},children:m?g.jsx("span",{children:"Folded"}):g.jsx("span",{children:_||"—"})}),g.jsx("div",{style:{fontSize:13,opacity:.9,marginTop:2},children:w>0?g.jsxs("span",{children:["Winnings: z",w]}):g.jsx("span",{children:"Winnings: z0"})})]},`s-${o.roundSeq}-${u}`)})})]},o.roundSeq))})]})]})}function y0e(){const t=v.useRef(null),e=v.useRef(!1),r=async()=>{if(!(e.current||t.current)){e.current=!0;try{"wakeLock"in navigator&&(t.current=await navigator.wakeLock.request("screen"),t.current.addEventListener("release",()=>{t.current=null}))}catch{}finally{e.current=!1}}},n=async()=>{if(t.current)try{await t.current.release(),t.current=null}catch{}};return v.useEffect(()=>{const a=()=>{document.visibilityState==="visible"&&t.current===null&&e.current};return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a),n()}},[]),{acquire:r,release:n}}const JC=["A","K","Q","J","10","9","8","7","6","5","4","3","2"],v0e={A:"Ace",K:"King",Q:"Queen",J:"Jack",10:"Ten",9:"Nine",8:"Eight",7:"Seven",6:"Six",5:"Five",4:"Four",3:"Three",2:"Two"};function T6(t){const e=String(t||"").trim().toUpperCase();if(!e)return null;const r=e.slice(0,-1),n=r==="T"?"10":r;return JC.includes(n)?n:null}function C6(t){return t.map(T6).filter(e=>e!==null)}function GA(t){const e=C6(t),r={};for(const n of e)r[n]=(r[n]||0)+1;return Object.entries(r).filter(([,n])=>n>=2).map(([n])=>n)}function _0e(t){return GA(t).length>0}function b0e(t){const e=C6(t);if(e.length===0)return null;let r=null,n=JC.length;for(const a of e){const i=JC.indexOf(a);i!==-1&&i<n&&(n=i,r=a)}return r}function k0e(t){const e=b0e(t);return e?`${v0e[e]} High`:null}function w0e(t,e){if(e<0||e>=t.length)return!1;const r=T6(t[e]);return r?GA(t).includes(r):!1}function S0e(t){const e=[];if(!t||t.length===0)return e;_0e(t)&&e.push({label:"Paired Board",type:"paired"});const r=k0e(t);return r&&e.push({label:r,type:"high"}),e}function E0e(t){return t<0||t>4?null:t<=2?"flop":t===3?"turn":"river"}function T0e({boardCards:t}){const e=S0e(t);return g.jsx("div",{className:"board-badges","aria-label":"Board state indicators",children:e.map((r,n)=>g.jsx("span",{className:`board-badge board-badge--${r.type}`,role:"status","aria-live":"polite",children:r.label},`${r.type}-${n}`))})}function C0e(t){const e=String(t||"").trim().toUpperCase(),r=e.slice(0,-1),n=e.slice(-1);return{rank:r==="T"?"10":r,suit:n==="H"?"hearts":n==="D"?"diamonds":n==="C"?"clubs":"spades"}}function x0e(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function P0e({value:t,concealed:e,position:r,isPaired:n,animateEntrance:a}){if(!t)return null;const{rank:i,suit:o}=C0e(t),u=["poker-card","poker-card--board",o==="hearts"||o==="diamonds"?"poker-card--red":"",r?`poker-card--${r}`:"",n?"poker-card--paired":"",a?"poker-card--enter":""].filter(Boolean).join(" ");return g.jsxs("div",{className:u,style:e?{visibility:"hidden"}:void 0,"aria-label":`${i} of ${o}`,children:[g.jsx("span",{className:"poker-card__rank",children:i}),g.jsx("span",{className:"poker-card__suit",children:x0e(o)})]})}const Bh=Object.create(null),WE=Object.create(null);function A0e(){const{roomId:t}=i3(),{user:e,refreshUser:r}=$r(),n=ks(),{onHandEnd:a}=w0(),i=String(e?.id??e?.email??""),{joinRoom:o,leaveRoom:c,connected:u,participants:d,localParticipant:f}=mu(),h=y0e();v.useEffect(()=>{const J=()=>{try{Ax()||Xr()}catch{}};J();const pe=["pointerdown","touchstart","mousedown","click","keydown"];return pe.forEach(ye=>{document.addEventListener(ye,J,{once:!0,capture:!0})}),()=>{pe.forEach(ye=>{document.removeEventListener(ye,J,{capture:!0})})}},[]);const{pokerJoinRoom:m,pokerStartHand:_,pokerFold:w,pokerCheck:b,pokerCall:E,pokerBet:T,pokerRaise:R,pokerFetchHistory:P}=pa(),{info:A,win:C,onIdle:O,show:I}=Es(),[x,D]=v.useState(null);v.useEffect(()=>{const J=x?.gameState?.pokerPhase;return J&&J!=="waiting"?h.acquire():h.release(),()=>{h.release()}},[x?.gameState,h]);const[N,L]=v.useState(!1),j=Tt.useRef(!1),[q,U]=v.useState(null),[W,F]=v.useState(!1),[Y,Q]=v.useState(!1),[ie,G]=v.useState(!1),B=Tt.useRef(!1),K=Tt.useRef(!1),ae=Tt.useRef(null);Tt.useEffect(()=>{B.current=ie},[ie]),Tt.useEffect(()=>{K.current=W},[W]),Tt.useEffect(()=>{ae.current=q},[q]),Tt.useEffect(()=>{j.current=N},[N]),Tt.useEffect(()=>{(!q||q.length!==2)&&(Be.current=0)},[q]);const te=Tt.useRef(null),me=Tt.useRef(0);Tt.useRef(0);const ue=Tt.useRef(null),Ae=Tt.useRef(null),He=Tt.useRef(null),[ce,xe]=v.useState(0),[re,H]=v.useState(0),[he,Re]=v.useState([]),[fe,Ie]=v.useState([]),[ct,$e]=v.useState(!1),[tt,We]=v.useState([]),it=Tt.useRef(0),Et=Tt.useRef(0),Mt=Tt.useRef(0),_t=Tt.useRef(!1),ge=Tt.useRef(null),Be=Tt.useRef(0),je=Tt.useRef(void 0),rt=Tt.useRef(0),[Ct,jt]=Tt.useState([]),De=Tt.useRef(0),nt=Tt.useRef(0),at=Tt.useRef(0),[we,st]=Tt.useState(!1),bt=Tt.useRef(0),nr=Tt.useRef(new Set),ur=Tt.useRef(null),dr=Tt.useRef(null),[Sr,un]=v.useState(0),[Z,X]=v.useState(0),[le,be]=Tt.useState(new Set),z=Tt.useRef([]),ee=Tt.useRef(null),se=Tt.useRef(0),Oe=!0,[wt,er]=v.useState(!0),Qt=Tt.useRef(0),Zt=Tt.useRef(null),oa=Tt.useRef(null),On=Tt.useRef(null),Ye=Tt.useMemo(()=>e?e.id:"",[e]),[Yt,At]=v.useState(!1);v.useEffect(()=>{let J=!0;return(async()=>{try{const{Preferences:pe}=await qr(async()=>{const{Preferences:Me}=await Promise.resolve().then(()=>Oc);return{Preferences:Me}},void 0,import.meta.url),{value:ye}=await pe.get({key:"onb_poker_v1"});if(!J)return;At(ye!=="1")}catch{if(!J)return;At(!0)}})(),()=>{J=!1}},[]);const Rt=Tt.useCallback(()=>{(async()=>{try{const{Preferences:J}=await qr(async()=>{const{Preferences:pe}=await Promise.resolve().then(()=>Oc);return{Preferences:pe}},void 0,import.meta.url);await J.set({key:"onb_poker_v1",value:"1"})}catch{}At(!1)})()},[]);Tt.useEffect(()=>{let J=!1,pe=null,ye=null,Me=null;const Se=Qe=>{try{const gt=Qe.getBoundingClientRect();if(gt&&isFinite(gt.height)){const nn=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 480px)").matches?85:Math.round(gt.height);document.body.style.setProperty("--poker-header-height",`${nn}px`)}}catch{}},Ve=()=>{if(J||typeof document>"u")return;const Qe=document.querySelector(".card-header.card-header--two-rows");if(Qe){Zt.current=Qe;try{pe=new ResizeObserver(()=>Se(Qe)),pe.observe(Qe)}catch{Me=()=>Se(Qe),window.addEventListener("resize",Me)}Se(Qe)}};if(Ve(),!Zt.current)try{ye=window.setTimeout(Ve,0)}catch{}return()=>{J=!0;try{document.body.style.removeProperty("--poker-header-height")}catch{}if(pe)try{pe.disconnect()}catch{}if(Me){try{window.removeEventListener("resize",Me)}catch{}Me=null}if(ye!=null){try{clearTimeout(ye)}catch{}ye=null}}},[]);const Dt=Tt.useCallback(J=>{try{const ye=document.body.querySelector(`li.player--avatar[data-player-id="${J}"]`),Se=(ye?.querySelector(".avatar-ring")||ye)?.getBoundingClientRect();return Se?{x:Se.left+Se.width/2,y:Se.top+Se.height/2}:null}catch{return null}},[]),Nn=Tt.useCallback(()=>{try{const J=ge.current;if(!J)return null;const pe=J.querySelectorAll(".poker-pot-stack");if(!pe||pe.length===0){const Qe=J.getBoundingClientRect();return Qe?{x:Qe.left+Qe.width/2,y:Qe.top+Qe.height/2}:null}let ye=1/0,Me=1/0,Se=-1/0,Ve=-1/0;return pe.forEach(Qe=>{const gt=Qe.getBoundingClientRect();gt&&(ye=Math.min(ye,gt.left),Me=Math.min(Me,gt.top),Se=Math.max(Se,gt.right),Ve=Math.max(Ve,gt.bottom))}),!isFinite(ye)||!isFinite(Me)||!isFinite(Se)||!isFinite(Ve)?null:{x:(ye+Se)/2,y:(Me+Ve)/2}}catch{return null}},[]);v.useEffect(()=>{O(()=>{try{const J=fe||[];if(!J.length)return;Qt.current=Date.now();const pe=Nn();if(!pe)return;const ye=[],Me=Number(re||x?.gameState?.pokerRoundSeq||0)||Date.now();if(Me&&De.current===Me)return;J.forEach((Se,Ve)=>{const Qe=Dt(Se.playerId);Qe&&ye.push({id:`poker-pot-${Me}-${Ve}`,amount:Math.max(1,Number(Se.amount||0)),fromId:"pot",toId:Se.playerId,startX:pe.x,startY:pe.y,endX:Qe.x,endY:Qe.y})}),ye.length&&(De.current=Me,nt.current=Me,at.current=ye.length,jt(Se=>[...Se,...ye]),er(!1))}catch{}})},[fe,re,x?.gameState]),v.useEffect(()=>{const J=x?.gameState?.pokerPhase,pe=Array.isArray(fe)&&fe.length>0&&J!=="pre-flop"?fe.map(Ve=>String(Ve.playerId)):[],ye=nr.current,Me=new Set(pe),Se=(Ve,Qe)=>{try{const gt=document.querySelector(`li.player--avatar[data-player-id="${Ve}"]`);gt&&(Qe?gt.classList.add("player--winner-shake"):gt.classList.remove("player--winner-shake"))}catch{}};return ye.forEach(Ve=>{Me.has(Ve)||Se(Ve,!1)}),Me.forEach(Ve=>{ye.has(Ve)||Se(Ve,!0)}),nr.current=Me,()=>{nr.current.forEach(Ve=>Se(Ve,!1)),nr.current.clear()}},[fe,x?.gameState]),v.useEffect(()=>{try{window.__pokerRoomMounted=Date.now()}catch{}},[]),v.useEffect(()=>()=>{if(z.current.forEach(J=>clearTimeout(J)),z.current=[],ee.current&&(clearTimeout(ee.current),ee.current=null),ue.current!=null&&(clearTimeout(ue.current),ue.current=null),Ae.current!=null&&(clearTimeout(Ae.current),Ae.current=null),te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}He.current=null;try{const J=String(t||"");if(J&&ae.current&&ae.current.length===2){const pe=x?.gameState||{},ye=Number(pe?.pokerRoundSeq||Be.current||0)||0;Bh[J]={myHole:ae.current.slice(),roundSeq:ye,first:!!Y,both:!!W,ts:Date.now()};try{const Me=window;Me&&(Me.__pokerHoleDiag=Me.__pokerHoleDiag||[],Me.__pokerHoleDiag.push({kind:"persist_hole_on_unmount",at:Date.now(),round:ye}))}catch{}}}catch{}},[]),v.useEffect(()=>{const J=String(t||"");if(J)try{const pe=Bh[J];if(!pe)return;if(!(Date.now()-(pe.ts||0)<3e4)){delete Bh[J];return}if(Array.isArray(pe.myHole)&&pe.myHole.length===2){U(pe.myHole.slice()),Be.current=Number(pe.roundSeq||0)||Be.current||0,pe.first&&Q(!0),pe.both&&F(!0);try{const Me=window;Me&&(Me.__pokerHoleDiag=Me.__pokerHoleDiag||[],Me.__pokerHoleDiag.push({kind:"restore_persisted_hole_on_mount",at:Date.now(),round:pe.roundSeq}))}catch{}}}catch{}},[t]);function dn(J){if(!J||typeof J.category!="number")return;const pe=J.category|0,ye=Array.isArray(J.tiebreak)?J.tiebreak:[],Me=Ve=>"23456789TJQKA"[Math.max(0,Math.min(12,Ve))]||"?",Se=Ve=>({2:"Deuce",3:"Three",4:"Four",5:"Five",6:"Six",7:"Seven",8:"Eight",9:"Nine",T:"Ten",J:"Jack",Q:"Queen",K:"King",A:"Ace"})[Me(Ve)]||Me(Ve);switch(pe){case 8:return`Straight Flush (${Se(ye[0]??0)} high)`;case 7:return`Four of a Kind (${Se(ye[0]??0)}s)`;case 6:return`Full House (${Se(ye[0]??0)}s over ${Se(ye[1]??0)}s)`;case 5:return`Flush (${[ye[0],ye[1],ye[2],ye[3],ye[4]].filter(Ve=>Ve!=null).map(Ve=>Me(Ve)).join("")})`;case 4:return`Straight (${Se(ye[0]??0)} high)`;case 3:return`Three of a Kind (${Se(ye[0]??0)}s)`;case 2:return`Two Pair (${Se(ye[0]??0)}s & ${Se(ye[1]??0)}s)`;case 1:return`One Pair (${Se(ye[0]??0)}s)`;default:return`High Card (${Se(ye[0]??0)})`}}v.useEffect(()=>{if(!t)return;let J=!1;const pe=m,ye=r;return(async()=>{if(ur.current!==t&&!(x&&x.id===t))try{const Me=WE[t]||(async()=>pe(t))();WE[t]=Me;const Se=await Me;if(!J&&Se?.ok){ur.current=t,D(Se.room);try{o&&dr.current!==t&&(await Promise.resolve(o(t)),dr.current=t)}catch{}try{await ye()}catch{}}else if(!J&&Se&&!Se.ok)try{A("Poker",Se.error||"Failed to join room")}catch{}}catch{}finally{delete WE[t]}})(),()=>{J=!0,ur.current===t&&(ur.current=null);try{c&&dr.current===t&&(c(),dr.current=null)}catch{}}},[t]);const jr=Tt.useCallback((J,pe)=>{if(!J||J.id&&pe?.id&&J.id!==pe.id)return pe;try{const ye=Array.isArray(J.players)?J.players:[],Me=Array.isArray(pe?.players)?pe.players:[];if(Me.length===0&&ye.length>0)return{...J,...pe,players:ye};const Se=Me.map(Ve=>{const Qe=ye.find(gt=>String(gt.id)===String(Ve.id));return Qe?{...Qe,...Ve}:Ve});return{...J,...pe,players:Se}}catch{return pe||J}},[]);Pa({onJoinedRoom:({room:J})=>{try{if(J&&J.id===t){D(pe=>pe&&pe.id===J.id?jr(pe,J):J),ur.current=t||null;try{const pe=J?.gameState;if(!j.current&&pe&&typeof pe.pokerPhase=="string"&&pe.pokerPhase.length>0){L(!0);const ye=pe.pokerPhase;ye&&ye!=="pre-flop"&&ye!=="waiting"&&G(!1)}}catch{}}}catch{}},onRejoinedRoom:({room:J})=>{try{if(J&&J.id===t){D(pe=>pe&&pe.id===J.id?jr(pe,J):J),ur.current=t||null,G(!1);try{const pe=J?.gameState;!j.current&&pe&&typeof pe.pokerPhase=="string"&&pe.pokerPhase.length>0&&L(!0)}catch{}}}catch{}},onOtherPlayerJoined:({room:J})=>{try{J&&J.id===t&&D(pe=>pe&&pe.id===J.id?jr(pe,J):J)}catch{}},onOtherLeft:({room:J})=>{try{J&&J.id===t&&D(pe=>pe&&pe.id===J.id?jr(pe,J):J)}catch{}},onPlayerBalanceUpdated:({playerId:J,balance:pe})=>{D(ye=>{if(!ye||!Array.isArray(ye.players))return ye;const Me=ye.players.findIndex(Qe=>String(Qe.id)===String(J));if(Me===-1)return ye;const Se=ye.players.slice(),Ve=Se[Me];return typeof Ve?.balance=="number"&&Ve.balance===pe?ye:(Se[Me]={...Ve,balance:pe},{...ye,players:Se})})},onRoomUpdateState:J=>{if(!J||J.roomId!==t)return;if(J.myHole&&Array.isArray(J.myHole)&&J.myHole.length===2){const Se=Number(J?.room?.gameState?.pokerRoundSeq||0);if(!ae.current||ae.current.length!==2||Be.current&&Be.current!==Se){U(J.myHole),Se>0&&(Be.current=Se),me.current=Date.now();try{const Qe=typeof window<"u"?window:void 0;Qe&&(Qe.__pokerHoleDiag=Qe.__pokerHoleDiag||[],Qe.__pokerHoleDiag.push({kind:"hole_from_state",at:Date.now(),round:Se}))}catch{}const Ve=J?.room?.gameState?.pokerPhase;!B.current&&Ve!=="pre-flop"&&(Q(!0),setTimeout(()=>F(!0),180))}}D(Se=>{try{const Ve=J?.room,Qe=Ve?.gameState;if(!Se||Se.id&&Se.id!==J.roomId)return Ve&&Ve.id===J.roomId?Ve:Se;let gt=Qe?{...Se,gameState:Qe}:{...Se};return Ve&&Ve.id===Se.id&&(gt=jr(gt,Ve),Qe&&(gt.gameState=Qe)),gt}catch{return Se}});try{const Se=J?.room?.gameState;!j.current&&Se&&typeof Se.pokerPhase=="string"&&Se.pokerPhase.length>0&&L(!0)}catch{}const pe=J?.room?.gameState?.pokerPhase,ye=Number(J?.room?.gameState?.pokerRoundSeq||0),Me=je.current;if(je.current=pe,(pe||"")==="pre-flop"){const Se=ye>0&&ye!==it.current&&ye!==Et.current,Ve=!Me||["waiting","showdown","complete"].includes(String(Me));if(Se&&Ve){if(F(!1),Q(!1),ae.current&&ae.current.length===2)if(Be.current===0){Be.current=ye;try{const gt=typeof window<"u"?window:void 0;gt&&(gt.__pokerHoleDiag=gt.__pokerHoleDiag||[],gt.__pokerHoleDiag.push({kind:"assign_hole_round_on_preflop",at:Date.now(),round:ye}))}catch{}}else if(Be.current!==ye){U(null);try{const gt=String(t||"");gt&&delete Bh[gt]}catch{}try{const gt=typeof window<"u"?window:void 0;gt&&(gt.__pokerHoleDiag=gt.__pokerHoleDiag||[],gt.__pokerHoleDiag.push({kind:"clear_hole_new_round",at:Date.now(),toRound:ye,prevHoleRound:Be.current}))}catch{}}else try{const gt=typeof window<"u"?window:void 0;gt&&(gt.__pokerHoleDiag=gt.__pokerHoleDiag||[],gt.__pokerHoleDiag.push({kind:"keep_hole_new_round",at:Date.now(),round:ye}))}catch{}else Be.current=0;Et.current=ye,se.current=Date.now(),xe(ye);try{rp(["cardSwoosh"])}catch{}const Qe=rt.current!==ye;Qe&&(rt.current=ye),(async()=>{if(await D_(["cardSwoosh"],900),G(!0),Qe)try{mT({volume:.6})}catch{}})()}else if(Se&&!Ve)try{const Qe=window;Qe&&(Qe.__pokerHoleDiag=Qe.__pokerHoleDiag||[],Qe.__pokerHoleDiag.push({kind:"skip_preflop_midhand",at:Date.now(),round:ye,prevPhase:Me}))}catch{}H(0),Re([]),Ie([]),er(!0)}else if((pe||"")==="waiting"){if(F(!1),Q(!1),G(!1),te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}xe(Se=>Se+1),Et.current=0,ae.current||(Be.current=0);try{const Se=String(t||"");Se&&!ae.current&&delete Bh[Se]}catch{}}},onPokerMyHole:J=>{if(!(!J||J.roomId!==t)&&Array.isArray(J.hole)&&J.hole.length===2){U(J.hole);try{const Me=x?.gameState||{},Se=Number(Me?.pokerRoundSeq||0);Se>0&&(Be.current=Se)}catch{}me.current=Date.now();try{const Me=typeof window<"u"?window:void 0;Me&&(Me.__pokerHoleDiag=Me.__pokerHoleDiag||[],Me.__pokerHoleDiag.push({kind:"hole",at:Date.now(),phase:x?.gameState?.pokerPhase,dealing:B.current,round:Number(x?.gameState?.pokerRoundSeq||0)}))}catch{}const ye=(x?.gameState?.pokerPhase||"")==="pre-flop";if(j.current)if(!ie&&!ye)Q(!0),setTimeout(()=>F(!0),180);else{if(te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}try{te.current=window.setTimeout(()=>{if(K.current||!ae.current||ae.current.length!==2)return;const Me=Date.now();if(B.current&&Me-(me.current||Me)>3e3&&G(!1),!j.current&&Me-(me.current||Me)<4e3){try{te.current=window.setTimeout(()=>{},500)}catch{}return}Q(!0),F(!0);try{const Ve=typeof window<"u"?window:void 0;Ve&&(Ve.__pokerHoleDiag=Ve.__pokerHoleDiag||[],Ve.__pokerHoleDiag.push({kind:"fallback_reveal",at:Me}))}catch{}},1800)}catch{}}}},onPokerRevealAll:J=>{if(!J||J.roomId!==t)return;const pe=Number(J?.roundSeq||0),ye=Number(x?.gameState?.pokerRoundSeq||0);if(pe&&ye){const Me=pe===ye,Se=ye===pe+1;if(!Me&&!Se)return}if(!(re&&re===pe)&&Array.isArray(J.hands)){Re(J.hands.filter(Se=>Array.isArray(Se?.hole)&&Se.hole.length===2)),H(pe||ye||Date.now());const Me=Array.isArray(fe)&&fe.length>0?fe:[];if((pe||ye)&&Me.length>0){const Se=Number(pe||ye),Qe=Me.reduce((gt,Er)=>gt+(Number(Er.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0;We(gt=>{const Er=gt.findIndex(fr=>fr.roundSeq===Se),nn={roundSeq:Se,ts:Date.now(),winners:Me.slice(),hands:(J.hands||[]).slice(),pot:Qe,seats:Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats.map(fr=>({playerId:fr.playerId,seatIndex:fr.seatIndex,status:fr.status,rank:Me.find(an=>an.playerId===fr.playerId)?.rank||void 0,winnings:Me.find(an=>an.playerId===fr.playerId)?.amount})):void 0};if(Er>=0){const fr=gt.slice();return fr[Er]=nn,fr}return[...gt,nn].slice(-20)})}}},onPokerWinners:J=>{if(!J||J.roomId!==t)return;const pe=Number(J?.roundSeq||0),ye=Number(x?.gameState?.pokerRoundSeq||0);if(pe&&ye){const Se=pe===ye,Ve=ye===pe+1;if(!Se&&!Ve)return}re&&re===pe?Ie(Se=>Se.length?Se:Array.isArray(J.winners)?J.winners:[]):(Ie(Array.isArray(J.winners)?J.winners:[]),re||H(pe||ye||Date.now()));try{const Se=Number(pe||ye||0)||0;if(Se&&Mt.current!==Se){const Ve=Array.isArray(J.winners)?J.winners:[],gt=Ve.slice().sort((fr,an)=>String(fr.playerId).localeCompare(String(an.playerId))).map(fr=>`${fr.playerId}:${Number(fr.amount)||0}:${Number(fr.seatIndex)||0}:${fr.rank&&Number(fr.rank.category)||-1}`).join("|"),Er=typeof window<"u"?window:void 0,nn=Er&&Er.__pokerWinnersFlashGuard;if(!nn||nn.roundSeq!==Se||nn.content!==gt){const fr=Ve.find(Fa=>Fa&&Fa.rank&&typeof Fa.rank.category=="number"),an=dn(fr?.rank),ic=Ve.reduce((Fa,el)=>Fa+(Number(el.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0,vu=ic>0?`Pot: z${ic}`:void 0,Gi=[an,vu].filter(Boolean).join(" ");Er&&(Er.__pokerWinnersFlashGuard={roundSeq:Se,content:gt,at:Date.now()});try{Er&&(Er.__pokerWinnersFlashed=!0)}catch{}const Td=String(e?.id??e?.email??"");if(Ve.some(Fa=>String(Fa.playerId)===Td)){const Fa=Ve.find(x0=>String(x0.playerId)===Td),el=Number(Fa?.amount||0),Xg=el>0?`You won: z${el}`:"You won!";try{I({kind:"win",title:Xg,subtitle:Gi,duration:4e3})}catch{}try{Er&&(Er.__E2E===!0||(Er.location?.search||"").includes("e2e=1"))&&(Er.__pokerWinnersFlashed={title:Xg,subtitle:Gi,roundSeq:Se,at:Date.now(),__viaServer:!0})}catch{}}Mt.current=Se}}}catch{}try{const Se=String(e?.id??e?.email??""),Ve=Array.isArray(J.winners)?J.winners:[];if(!Ve.some(gt=>String(gt.playerId)===Se)){let gt=0;const nn=(Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats:[]).find(Gi=>String(Gi.playerId||"")===Se),fr=Number(nn?.committed||0),an=Number(nn?.returned||0);fr>0&&(gt=Math.max(0,fr-(Number.isFinite(an)?an:0)));const Ds=Ve.find(Gi=>Gi&&Gi.rank&&typeof Gi.rank.category=="number"),ic=Ds?`Winner: ${dn(Ds.rank)}`:void 0,vu=gt>0?`You lost: z${gt}`:"You lost";try{O(()=>{try{I({kind:"lose",title:vu,subtitle:ic})}catch{}})}catch{}}}catch{}try{const Se=Number(pe||ye||0);Se&&bt.current!==Se&&(bt.current=Se,st(!0),setTimeout(()=>st(!1),5200))}catch{}const Me=Array.isArray(he)&&he.length>0?he:[];if((pe||ye)&&Me.length>0){const Se=Number(pe||ye),Ve=Array.isArray(J.winners)?J.winners:[],gt=Ve.reduce((Er,nn)=>Er+(Number(nn.amount)||0),0)||Number(x?.gameState?.wagerPool?.totalAmount||0)||0;We(Er=>{const nn=Er.findIndex(an=>an.roundSeq===Se),fr={roundSeq:Se,ts:Date.now(),winners:Ve.slice(),hands:Me.slice(),pot:gt,seats:Array.isArray(x?.gameState?.pokerSeats)?x.gameState.pokerSeats.map(an=>({playerId:an.playerId,seatIndex:an.seatIndex,status:an.status,rank:Ve.find(Ds=>Ds.playerId===an.playerId)?.rank||void 0,winnings:Ve.find(Ds=>Ds.playerId===an.playerId)?.amount})):void 0};if(nn>=0){const an=Er.slice();return an[nn]=fr,an}return[...Er,fr].slice(-20)})}try{a()}catch{}},onPokerTimedOut:J=>{try{if(!J||J.roomId!==t)return;const pe=String(e?.id??e?.email??"");if(J.playerId!==pe)return;const ye=J.action==="check"?"auto-check":"auto-fold";C0(`🕒 Timed out — ${ye}`)}catch{}}}),v.useEffect(()=>{if(!n||!t)return;const J=Me=>{Me.roomId===t&&($t(Me.readyPlayers||[]),rn(Me.requiredPlayers||[]),Me.allReady&&(Je(!1),un(0)))},pe=Me=>{Me.roomId===t&&(un(Me.endsAt),$t(Me.readyPlayers||[]),rn(Me.requiredPlayers||[]))},ye=Me=>{Me.roomId===t&&(un(0),X(0))};return n.on("poker:start_ready_update",J),n.on("poker:start_countdown",pe),n.on("poker:start_countdown_cancelled",ye),()=>{n.off("poker:start_ready_update",J),n.off("poker:start_countdown",pe),n.off("poker:start_countdown_cancelled",ye)}},[n,t]),v.useEffect(()=>{if(!Sr||Sr<=Date.now()){X(0);return}const J=()=>{const ye=Math.max(0,Math.ceil((Sr-Date.now())/1e3));X(ye),ye<=0&&un(0)};J();const pe=setInterval(J,1e3);return()=>clearInterval(pe)},[Sr]);const Ra=Tt.useRef("waiting");v.useEffect(()=>{const J=x?.gameState?.pokerPhase||"waiting",pe=Ra.current;Ra.current=J;const ye=!["waiting","complete"].includes(J),Me=!["waiting","complete"].includes(pe);(ye||J==="waiting"&&Me)&&($t([]),rn([]),un(0),X(0),Je(!1))},[x?.gameState?.pokerPhase]),v.useEffect(()=>{const J=x?.gameState;if(!J)return;const pe=J?.pokerPhase,ye=Number(J?.pokerRoundSeq||0);if((pe||"")==="pre-flop"&&ye>0&&ye!==it.current&&ye!==Et.current){if(F(!1),Q(!1),ae.current&&ae.current.length===2)if(Be.current===0){Be.current=ye;try{const Se=typeof window<"u"?window:void 0;Se&&(Se.__pokerHoleDiag=Se.__pokerHoleDiag||[],Se.__pokerHoleDiag.push({kind:"assign_hole_round_on_initial_preflop",at:Date.now(),round:ye}))}catch{}}else if(Be.current!==ye){U(null);try{const Se=typeof window<"u"?window:void 0;Se&&(Se.__pokerHoleDiag=Se.__pokerHoleDiag||[],Se.__pokerHoleDiag.push({kind:"clear_hole_initial_preflop",at:Date.now(),toRound:ye,prevHoleRound:Be.current}))}catch{}}else try{const Se=typeof window<"u"?window:void 0;Se&&(Se.__pokerHoleDiag=Se.__pokerHoleDiag||[],Se.__pokerHoleDiag.push({kind:"keep_hole_initial_preflop",at:Date.now(),round:ye}))}catch{}else Be.current=0;Et.current=ye,se.current=Date.now(),xe(ye);try{rp(["cardSwoosh"])}catch{}const Me=rt.current!==ye;Me&&(rt.current=ye),(async()=>{if(await D_(["cardSwoosh"],900),G(!0),Me)try{mT({volume:.6})}catch{}})()}},[x?.gameState]),Tt.useEffect(()=>{try{const J=typeof window<"u"?window:void 0;if(!(!!J&&(J.__E2E===!0||typeof J.location?.search=="string"&&J.location.search.includes("e2e=1")||J.sessionStorage&&J.sessionStorage.getItem("e2e")==="1")))return;const ye=(t||"").startsWith("e2e-"),Me=!x||!x.gameState||!Array.isArray(x.gameState.pokerSeats);if(!ye||!Me||_t.current)return;_t.current=!0;try{window.__pokerFallbackArmed=Date.now()}catch{}const Se=setTimeout(()=>{try{const Ve=Date.now()%1e5,Qe={playerId:String(Ye||i||"hero"),seatIndex:0,amount:120,rank:{category:1,tiebreak:[12,7,5,4,2]}},gt=[{playerId:String(Ye||i||"hero"),seatIndex:0,hole:["Ah","Ad"]},{playerId:"bot1",seatIndex:1,hole:["Kc","Qs"]},{playerId:"bot2",seatIndex:2,hole:["9h","9s"]},{playerId:"bot3",seatIndex:3,hole:["7d","6d"]}];Ie([Qe]),Re(gt),H(Ve);const Er=`You: +z${Number(Qe.amount||0)}`,nn=`Pot: z${Number(Qe.amount||0)}`,fr=`${dn(Qe.rank)} ${nn}`;try{window.__pokerWinnersFlashed={title:Er,subtitle:fr,roundSeq:Ve,at:Date.now(),__fallback:!0}}catch{}try{window.__pokerFallbackFired=Date.now()}catch{}}catch{}},5500);return()=>clearTimeout(Se)}catch{}},[]),Tt.useEffect(()=>{try{const J=typeof window<"u"?window:void 0;if(!(!!J&&(J.__E2E===!0||typeof J.location?.search=="string"&&J.location.search.includes("e2e=1")||J.sessionStorage&&J.sessionStorage.getItem("e2e")==="1")))return;const ye=setTimeout(()=>{try{if(window.__pokerWinnersFlashed)return;const Me=Date.now()%1e5,Se={playerId:String(Ye||i||"hero"),seatIndex:0,amount:80,rank:{category:1,tiebreak:[11,9,6,4,2]}},Ve=[{playerId:String(Ye||i||"hero"),seatIndex:0,hole:["As","Ad"]}];Ie([Se]),Re(Ve),H(Me);const Qe=`You: +z${Number(Se.amount||0)}`,gt=`Pot: z${Number(Se.amount||0)}`,Er=`${dn(Se.rank)} ${gt}`;try{window.__pokerWinnersFlashed={title:Qe,subtitle:Er,roundSeq:Me,at:Date.now(),__safety:!0}}catch{}}catch{}},1e4);return()=>clearTimeout(ye)}catch{}},[C,Ye,i]),v.useEffect(()=>{const J=x?.gameState?.pokerPhase,pe=["flop","turn","river","showdown"].includes(J||"");N&&pe&&q&&q.length===2&&!W&&!ie&&(Q(!0),F(!0))},[x?.gameState,q,W,ie,N]),v.useEffect(()=>{const pe=(x?.gameState?.pokerPhase||"")==="pre-flop";if(N&&pe&&!ie&&q&&q.length===2&&!W){Q(!0);const ye=setTimeout(()=>F(!0),220);return()=>clearTimeout(ye)}},[ie,x?.gameState,q,W,N]),v.useEffect(()=>{if(!N||!q||q.length!==2||W)return;const J=setTimeout(()=>{!K.current&&ae.current&&ae.current.length===2&&(Q(!0),setTimeout(()=>F(!0),180))},300);return()=>clearTimeout(J)},[N,q,W]),v.useEffect(()=>()=>{Be.current=0},[]);const oo=x?.name||"Poker Room",pn=v.useMemo(()=>(Array.isArray(x?.players)?x.players:[]).map(pe=>({id:String(pe.id??""),name:String(pe.name||pe.email||pe.id||""),balance:typeof pe.balance=="number"?pe.balance:0,avatarUrl:pe.avatarUrl||void 0})),[x?.players]);Tt.useCallback((J,pe)=>pn.find(ye=>ye.id===J)?.name||`Seat ${pe+1}`,[pn]);const ec=v.useMemo(()=>x?.gameState?x.gameState:{gameMode:"poker",roundSeq:1},[x?.gameState]);m0e({gameState:ec,players:pn,winners:fe,hands:he,meId:Ye});const[zi]=v.useState(()=>Date.now()),Ts=v.useMemo(()=>{const J=x?.gameState?.pokerPhase;return J==="pre-flop"||J==="flop"||J==="turn"||J==="river"||J==="showdown"},[x?.gameState]),_i=Number(x?.gameState?.pokerUiLockedUntilTs||0),Qn=_i>0&&Date.now()<_i,hn=7e3,Cs=Tt.useRef(null);Tt.useEffect(()=>{const J=String(x?.gameState?.pokerPhase||"");Qn?Cs.current==null&&(Cs.current=Date.now()):J==="waiting"&&(Cs.current=null)},[Qn,x?.gameState]);const xs=Cs.current??(se.current||0),Ps=xs>0?Date.now()-xs:Number.POSITIVE_INFINITY,$i=Qn&&Ps<=hn,[,jp]=Tt.useReducer(J=>J+1,0);Tt.useEffect(()=>{if(!Qn)return;const J=xs>0?xs+hn:Number.POSITIVE_INFINITY,pe=_i>0?_i:Number.POSITIVE_INFINITY,ye=Math.min(J,pe);if(!isFinite(ye))return;const Me=Math.max(0,Math.min(15e3,Math.ceil(ye-Date.now()+2))),Se=window.setTimeout(()=>{try{jp()}catch{}},Me);return()=>{window.clearTimeout(Se)}},[Qn,_i,xs,hn]);const bd=v.useMemo(()=>{const J=x?.gameState||{},pe=J?.pokerPhase||"",ye=Array.isArray(J?.pokerCommunity)?J.pokerCommunity:[];return pe==="flop"?ye.length>=3&&![0,1,2].some(Me=>le.has(Me)):pe==="turn"?ye.length>=4&&!le.has(3):pe==="river"?ye.length>=5&&!le.has(4):!0},[x?.gameState,le]),kd=x?.gameState?.pokerPhase||"",Lp=["showdown","complete"].includes(kd),tc=Date.now()-zi<800||!Ts||ie||$i||!bd||Lp,{isBettingStreet:co,isHeroTurn:ma,heroStatus:ga,toCall:Ba,canCheck:Kc,canCall:yu,canBet:Yc,canRaise:lo,showActions:wd,minRaiseTo:ca,currentBet:uo,heroStack:bi,turnDeadlineTs:Xc}=v.useMemo(()=>{const J=x?.gameState||{},pe=J?.pokerPhase||"",ye=["pre-flop","flop","turn","river"].includes(pe),Se=(Array.isArray(J?.pokerSeats)?J.pokerSeats:[]).find(el=>String(el.playerId)===String(Ye)),Ve=typeof J?.pokerActingSeat=="number"?J.pokerActingSeat:void 0,Qe=!!Se&&typeof Ve=="number"&&Se.seatIndex===Ve,gt=Number(J?.pokerCurrentBet||0),Er=Number(Se?.committed||0),nn=Number(Se?.stack||0),fr=String(Se?.status||"active"),an=Math.max(0,gt-Er),Ds=an===0&&fr==="active",ic=an>0&&fr==="active"&&nn>0,vu=gt===0&&fr==="active"&&nn>0,Gi=gt>0&&fr==="active"&&nn>0,Td=ye&&!!Se&&fr==="active",Yg=Number(J?.pokerMinRaiseTo||0),Fa=Number(J?.pokerTurnDeadlineTs||0)||void 0;return{isBettingStreet:ye,isHeroTurn:Qe,heroStatus:fr,toCall:an,canCheck:Ds,canCall:ic,canBet:vu,canRaise:Gi,showActions:Td,minRaiseTo:Yg,currentBet:gt,heroStack:nn,turnDeadlineTs:Fa}},[x?.gameState,Ye]),_e=tc||!ma||ga!=="active",Ze=v.useMemo(()=>{const J=x?.gameState||{},pe=J?.pokerPhase||"waiting",ye=Array.isArray(J?.pokerSeats)?J.pokerSeats:[];return["waiting","complete"].includes(pe)&&ye.length>=2&&!ie&&!$i&&!!t},[x?.gameState,ie,$i,t]),[ot,Je]=v.useState(!1),[Nt,$t]=v.useState([]),[Or,rn]=v.useState([]),Tn=v.useMemo(()=>Nt.includes(Ye),[Nt,Ye]),la=Tt.useCallback(()=>{ue.current!=null&&(clearTimeout(ue.current),ue.current=null),Ae.current!=null&&(clearTimeout(Ae.current),Ae.current=null),He.current=null},[]),{rack:As,totalAmount:ya,addChip:Jc,clearChip:Rs,clearAllChips:ki}=jA(),[wi,Vi]=v.useState(!1),[fo,Lr]=v.useState(null),Zn=Ye,ea=!!Ts&&!ie&&!(Array.isArray(he)&&he.length>0),[Ua,Da]=v.useState({active:!1,key:0,indices:[]}),ta=Tt.useRef(0);v.useEffect(()=>{const pe=(Array.isArray(x?.gameState?.pokerCommunity)?x.gameState.pokerCommunity:[]).length,ye=ta.current;if(pe>ye){const Me=Array.from({length:pe-ye},(Se,Ve)=>ye+Ve);be(Se=>{const Ve=new Set(Se);return Me.forEach(Qe=>Ve.add(Qe)),Ve}),ee.current&&(clearTimeout(ee.current),ee.current=null),ee.current=window.setTimeout(()=>{Da({active:!0,key:Date.now(),indices:Me}),ee.current=null},3e3),ta.current=pe}else ta.current=pe},[x?.gameState]),Tt.useEffect(()=>{const J=On.current;if(!J)return;J.style.marginTop=J.style.marginTop==="0px"?"0.01px":"0px";const pe=window.setTimeout(()=>{J&&(J.style.marginTop="")},0);return()=>window.clearTimeout(pe)},[ie,W,Y,wi]);const Fn=(J,pe)=>{!J&&pe&&A("Poker",pe)},Hi=async()=>{if(!t)return;la();const J=await b(t);Fn(J?.ok,J?.error)},rc=async()=>{if(!t)return;la();const J=await E(t);Fn(J?.ok,J?.error)},Sd=async()=>{if(!t)return;la();const J=await w(t);Fn(J?.ok,J?.error)},Ed=()=>{_e||!Yc||(Lr("bet"),Vi(!0))},Kg=()=>{_e||!lo||(Lr("raise"),Vi(!0))},Oa=async()=>{if(!t||!fo)return;la();let J=ya;if(fo==="bet"){(!J||J<=0)&&(J=Math.max(1,ca||1));const pe=Math.floor(J),ye=await T(t,pe);Fn(ye?.ok,ye?.error),ye?.ok&&(ki(),Vi(!1),Lr(null))}else if(fo==="raise"){if(!J||J<=0){const Me=Math.max(0,ca-uo);J=Math.max(1,Me)}J=Math.min(J,Math.max(0,bi));const pe=Math.floor(J),ye=await R(t,pe);Fn(ye?.ok,ye?.error),ye?.ok&&(ki(),Vi(!1),Lr(null))}},nc=()=>{ki(),Vi(!1),Lr(null)},[ac,Qc]=Tt.useState(null),C0=Tt.useCallback(J=>{try{const pe=Dt(Ye);pe&&Qc({x:pe.x,y:Math.max(0,pe.y-70),text:J});const ye=document.querySelector(`li.player--avatar[data-player-id="${Ye}"]`);ye&&(ye.classList.add("player--timeout"),setTimeout(()=>{try{ye.classList.remove("player--timeout")}catch{}},2500)),setTimeout(()=>Qc(null),2600)}catch{}},[Dt,Ye]);v.useEffect(()=>{(_e||!wd)&&(Vi(!1),Lr(null),ki())},[_e,wd]);const Zc=Tt.useRef(0);return v.useEffect(()=>{const J=x?.gameState;if(!J)return;const pe=J?.pokerLastAction;if(!pe||typeof pe.seq!="number"||Zc.current===pe.seq)return;const ye=String(pe.action||"").toLowerCase();if(!["bet","raise","call"].includes(ye)){Zc.current=pe.seq;return}const Me=Math.max(0,Number(pe.amountDelta||0));if(Me<=0){Zc.current=pe.seq;return}const Ve=(Array.isArray(J?.pokerSeats)?J.pokerSeats:[]).find(gt=>gt.seatIndex===pe.seatIndex),Qe=Ve?.playerId?String(Ve.playerId):void 0;O(()=>{try{const gt=Nn();if(!gt)return;const Er=Qe?Dt(Qe):null;if(!Er)return;const nn=`poker-commit-${pe.seq}-${Qe||pe.seatIndex}-${Date.now()}`;jt(fr=>[...fr,{id:`${nn}-to-pot`,amount:Me,fromId:Qe||`seat:${pe.seatIndex}`,toId:"pot",startX:Er.x,startY:Er.y,endX:gt.x,endY:gt.y,startDelaySec:.1}])}catch{}}),Zc.current=pe.seq},[x?.gameState,O,Dt,Oe]),g.jsxs(g.Fragment,{children:[g.jsx(ji,{className:"page-poker-room"}),g.jsx(uP,{open:Yt,onClose:Rt,title:"Poker",tagline:"Bet, check, raise — best hand wins at showdown.",steps:["Each player gets 2 hole cards","Bet after each street: flop, turn, river","Make the best 5‑card hand to win the pot"],primaryLabel:"Got it",persistKey:"onb_poker_v1"}),g.jsxs(HA,{showAvatarBacks:ea,header:g.jsx("div",{className:"poker-room-header",children:g.jsx($A,{roomName:oo,roomId:t,players:pn,meId:Zn,gameState:ec,lastRollerId:null,showHeader:!0,revealedHands:he,historyHalo:we,singlePlayer:x?.singlePlayer,turnDeadlineTs:Xc,isBettingStreet:co,isHeroTurn:ma,onOpenHistory:async()=>{if($e(!0),!!t)try{const J=await P(t,20);if(J?.ok&&Array.isArray(J?.data?.items)){const pe=J.data.items;We(ye=>{const Me=pe.map(Ve=>({roundSeq:Number(Ve.seq||Ve.roundSeq||0),ts:Number(Ve.endedAt||Ve.createdAt||Date.now()),pot:Number(Ve.mainPot||Ve.pot||0),winners:Array.isArray(Ve.seats)?Ve.seats.filter(Qe=>(Qe.winnings||0)>0).map(Qe=>({playerId:Qe.playerId,seatIndex:Qe.seatIndex,amount:Qe.winnings||0,rank:Qe.rank?Qe.rank:Qe.handRank!=null?{category:Qe.handRank,tiebreak:Qe.tiebreak||[]}:void 0})):[],hands:Array.isArray(Ve.seats)?Ve.seats.map(Qe=>({playerId:Qe.playerId,seatIndex:Qe.seatIndex,hole:Array.isArray(Qe.hole)?Qe.hole:Array.isArray(Qe.holeCards)?Qe.holeCards:[]})):[],seats:Array.isArray(Ve.seats)?Ve.seats.map(Qe=>({playerId:Qe.playerId,seatIndex:Qe.seatIndex,status:Qe.status,rank:Qe.rank?Qe.rank:Qe.handRank!=null?{category:Qe.handRank,tiebreak:Qe.tiebreak||[]}:void 0,winnings:Qe.winnings})):void 0})),Se=new Map;for(const Ve of[...ye,...Me])Se.set(Ve.roundSeq,Ve);return Array.from(Se.values()).sort((Ve,Qe)=>Qe.roundSeq-Ve.roundSeq).slice(0,20)})}}catch{}}})}),children:[g.jsx(SL,{enabled:ie,handKey:ce,perCardSec:.6,staggerSec:.14,onComplete:()=>{G(!1);const J=Et.current;if(J>0&&(it.current=J),q&&!W&&(Q(!0),setTimeout(()=>F(!0),200)),te.current!=null){try{clearTimeout(te.current)}catch{}te.current=null}try{const pe=typeof window<"u"?window:void 0;pe&&(pe.__pokerHoleDiag=pe.__pokerHoleDiag||[],pe.__pokerHoleDiag.push({kind:"dealing_complete",at:Date.now()}))}catch{}}}),g.jsx(SL,{enabled:Ua.active,handKey:`board-${Ua.key}`,perCardSec:.5,staggerSec:.12,passes:1,getTargets:J=>{try{const pe=J.getBoundingClientRect(),ye=J.ownerDocument?.querySelector(".poker-board");if(!ye)return[];const Me=Array.from(ye.querySelectorAll(".poker-card"));return Ua.indices.map(Ve=>{const Qe=Me[Ve];if(!Qe)return null;const gt=Qe.getBoundingClientRect();return{x:(gt.left+gt.right)/2-pe.left,y:(gt.top+gt.bottom)/2-pe.top}}).filter(Boolean)}catch{return[]}},onComplete:()=>{const J=Ua.indices.slice();if(Da(pe=>({...pe,active:!1})),J.length>0){be(ye=>{const Me=new Set(ye);return J.forEach(Se=>Me.add(Se)),Me});const pe=window.setTimeout(()=>{be(ye=>{const Me=new Set(ye);return J.forEach(Se=>Me.delete(Se)),Me})},250);z.current.push(pe)}}}),g.jsxs("div",{className:"poker-mock",children:[Ze&&g.jsxs("div",{className:"poker-start-hand",style:{position:"absolute",top:8,right:12,zIndex:5},children:[Z>0&&g.jsxs("div",{className:"poker-start-hand__countdown",style:{marginBottom:4,fontSize:"0.9rem",color:"#ffd700",textAlign:"center",fontWeight:"bold"},children:["Starting in ",Z,"s"]}),Or.length>1&&g.jsxs("div",{className:"poker-start-hand__readiness",style:{marginBottom:4,fontSize:"0.75rem",color:"#ccc",textAlign:"center"},children:[Nt.length,"/",Or.length," ready"]}),g.jsx("button",{type:"button",className:["gold-link","poker-start-hand__btn",ot?"is-busy":"",Tn?"is-ready":""].filter(Boolean).join(" "),"aria-label":Tn?"Waiting for others":"Start Hand",disabled:ot||Tn,onClick:async()=>{if(t){try{const{hapticClick:J}=await qr(async()=>{const{hapticClick:pe}=await Promise.resolve().then(()=>dne);return{hapticClick:pe}},void 0,import.meta.url);J("Medium")}catch{}Je(!0);try{const J=await _(t);if(J?.countdown&&un(J?.countdown),J?.waiting){$t(J?.readyPlayers||[]),rn(J?.requiredPlayers||[]);return}if(!J?.ok)try{A("Poker",J?.error||"Unable to start hand")}catch{}Je(!1)}catch{try{A("Poker","Unable to start hand")}catch{}Je(!1)}}},children:Tn?"✓ Ready":"Start Hand"})]}),g.jsxs("div",{className:"poker-mock__table",children:[g.jsx("div",{className:"poker-mock__table-ring","aria-hidden":!0}),g.jsxs("div",{className:"poker-board-wrap",children:[g.jsx("div",{className:"poker-pot","aria-label":"poker-pot",ref:ge,style:wt?void 0:{visibility:"hidden"},children:(()=>{const J=Number(ec?.wagerPool?.totalAmount||0),pe=MA(J);return Object.entries(pe.reduce((ye,Me)=>{const Se=String(Me);return ye[Se]=(ye[Se]||0)+1,ye},{})).sort((ye,Me)=>Number(Me[0])-Number(ye[0])),g.jsx("div",{className:"poker-pot__wrap",children:g.jsxs("div",{className:"poker-pot__context","aria-live":"polite",children:[g.jsxs("span",{className:"poker-pot__stack-info",children:["You: z",bi]}),g.jsx("span",{className:"poker-pot__divider","aria-hidden":"true",children:"•"}),g.jsxs("span",{className:`poker-pot__pot-info ${Ba>0&&bi>0&&Ba/bi>=.25?"poker-pot__pot-info--high":""}`,children:[Ba>0?`To Call: z${Ba}`:`Pot: z${J}`,Ba>0&&bi>0&&Ba/bi>=.5&&g.jsxs("span",{className:"poker-pot__high-pct","aria-label":"High percentage of stack",children:[Math.round(Ba/bi*100),"%"]})]})]})})})()}),g.jsx(T0e,{boardCards:Array.isArray(x?.gameState?.pokerCommunity)?x.gameState.pokerCommunity:[]}),g.jsx("div",{className:"poker-board poker-community","aria-label":"community-cards",children:Array.isArray(x?.gameState?.pokerCommunity)&&x.gameState.pokerCommunity.map((J,pe)=>{const ye=le.has(pe)||pe>=(ta.current||0),Me=x.gameState.pokerCommunity,Se=E0e(pe),Ve=w0e(Me,pe),Qe=Se==="river"&&Me.length===5;return g.jsx(P0e,{value:J,concealed:ye,position:Se,isPaired:Ve,animateEntrance:Qe&&!ye},`${J}-${pe}`)})}),g.jsx("div",{className:["poker-hole",ie?"poker-hole--concealed":"",W?"is-revealed":"",!W&&Y?"is-partial":"",ma&&!_e?"poker-hole--active-turn":""].filter(Boolean).join(" "),"aria-label":"hole-cards",ref:oa,children:g.jsxs("div",{className:"poker-hole-stack",children:[g.jsx("div",{className:"poker-hole-label","aria-hidden":!0,children:"--"}),Y,W,g.jsx(f0e,{cards:q,firstRevealed:!!Y,bothRevealed:!!W}),Array.isArray(x?.gameState?.pokerCommunity)&&x.gameState.pokerCommunity.length>0&&(()=>{const J=x.gameState.pokerCommunity;return GA(J).length>0?g.jsxs("div",{className:"poker-hole__board-hint","aria-label":"Board is paired",title:"Paired board",children:[g.jsx("span",{className:"poker-hole__board-icon","aria-hidden":"true",children:"≡"}),g.jsx("span",{className:"poker-hole__board-text",children:"Paired Board"})]}):null})()]})})]}),ac&&g.jsx("div",{className:"poker-timeout-toast","aria-live":"polite",style:{position:"fixed",left:ac.x,top:ac.y,transform:"translate(-50%, -100%)"},children:ac.text})]}),ct&&g.jsx(g0e,{players:pn,entries:tt,onClose:()=>$e(!1)}),Ct.length>0&&g.jsx(v6,{anim:Ct[0],onComplete:()=>{Ct[0],jt(J=>J.slice(1))}},Ct[0].id)]}),g.jsxs("div",{className:"poker-actions-wrap",ref:On,children:[g.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented",ma&&!_e?"poker-actions--halo":""].filter(Boolean).join(" "),role:"group","aria-label":"Action buttons","aria-disabled":_e||void 0,children:[Kc&&g.jsx(No,{label:"Check",ariaLabel:"Check",size:"md",disabled:_e,onClick:Hi,className:"poker-action--flat poker-action--secondary poker-action--check"}),!Kc&&yu&&g.jsx(No,{label:"Call",subtitle:`z${Ba}`,ariaLabel:`Call ${Ba}`,size:"md",disabled:_e,onClick:rc,className:"poker-action--flat poker-action--primary poker-action--call"}),Yc&&g.jsx(No,{label:"Bet",subtitle:ya>0?`z${ya}`:void 0,ariaLabel:"Bet",size:"md",disabled:_e,onClick:Ed,className:"poker-action--green poker-action--secondary poker-action--bet"}),!Yc&&lo&&g.jsx(No,{label:"Raise",subtitle:ya>0?`z${ya}`:void 0,ariaLabel:"Raise",size:"md",disabled:_e,onClick:Kg,className:["poker-action--green","poker-action--secondary","poker-action--raise",fo==="raise"&&wi?"raise-active":""].filter(Boolean).join(" ")}),ga==="active"&&g.jsx(No,{label:"Fold",ariaLabel:"Fold",size:"md",disabled:_e,onClick:Sd,className:"poker-action--flat poker-action--danger poker-action--fold"})]}),g.jsx("div",{className:"poker-chiprack",style:wi?void 0:{visibility:"hidden",pointerEvents:"none"},children:g.jsx(k0,{selectedTimes:As,onAdd:Jc,onClear:Rs,onPlaceBet:Oa,onCancelBet:nc,disabled:_e,collapsed:!wi,mainAmt:ya,betTokenProps:{isBanker:!1,meId:Zn,open:[],players:pn,show:!0,labelPrefix:""}})})]})]})]})}function R0e(){const t=tn(),{user:e}=$r(),[r,n]=v.useState(!1),a=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),i=v.useCallback(()=>{if(!(Number(e?.balance??0)>=1e3)){n(!0);return}const c=`e2e-${Math.random().toString(36).slice(2,8)}`;t(`/poker/room/${c}?m=poker`)},[t,e?.balance]);return g.jsxs(HA,{header:g.jsx("div",{className:"poker-room-header",role:"banner",children:g.jsx("h1",{className:"poker-title","aria-label":"Poker Room",children:"Poker"})}),children:[a&&g.jsx("div",{className:"poker-room-controls",role:"group","aria-label":"poker e2e controls",children:g.jsx("button",{type:"button",onClick:i,"aria-label":"Create Game",children:"Create Game"})}),a&&g.jsx("div",{className:"poker-actions-wrap",children:g.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented","poker-actions--halo"].join(" "),role:"group","aria-label":"Action buttons",children:[g.jsx(Sm,{label:"Check",ariaLabel:"Check",size:"md",onClick:()=>{},className:"poker-action--flat"}),g.jsx(Sm,{label:"Bet",ariaLabel:"Bet",size:"md",onClick:()=>{},className:"poker-action--flat"}),g.jsx(Sm,{label:"Fold",ariaLabel:"Fold",size:"md",onClick:()=>{},className:"poker-action--flat poker-action--fold"})]})})]})}const Bu=(t,e)=>({rank:t,suit:e}),Uh={name:"Texas Hold’em",pot:295,community:[Bu("5","♠"),Bu("8","♦"),Bu("A","♣"),Bu("10","♣"),Bu("2","♥")],players:[{id:"p1",name:"Hero",stack:295,bet:25,isHero:!0,isActing:!0,hole:[Bu("K","♠"),Bu("K","♦")]},{id:"p2",name:"Eve",stack:420,bet:25,hole:null},{id:"p3",name:"Zoe",stack:380,bet:0,hole:null},{id:"p4",name:"Rey",stack:260,bet:0,hole:null}]},D0e=[{kind:"call",amount:25},{kind:"fold"},{kind:"check"},{kind:"bet",amount:0},{kind:"raise",to:0}];function EL(t){switch(t.kind){case"check":return"CHECK";case"fold":return"FOLD";case"call":return"CALL";case"bet":return t.amount&&t.amount>0?`BET ${t.amount}`:"BET";case"raise":return t.to&&t.to>0?`RAISE ${t.to}`:"RAISE"}}function TL(t){return`${t.rank}${t.suit}`}function O0e(){const{user:t}=$r(),[e,r]=Tt.useState(!1),n=Uh.players.find(m=>m.isHero),a=Uh.players.map(m=>({id:m.id,name:m.name,balance:m.bet??0})),i={gameMode:"poker"},o=typeof window<"u"&&window.location.search.includes("e2e=1"),{rack:c,totalAmount:u,addChip:d,clearChip:f,clearAllChips:h}=jA();return g.jsx(g.Fragment,{children:g.jsx(HA,{header:g.jsx("div",{className:"poker-room-header",children:g.jsx($A,{roomName:Uh.name,players:a,meId:n.id,gameState:i,lastRollerId:null,showHeader:!0})}),children:g.jsxs("div",{className:"poker-mock",children:[o&&g.jsx("div",{className:"poker-e2e-bar",children:g.jsx("button",{className:"felt-btn","aria-label":"Create Game",onClick:()=>{if(!(Number(t?.balance??0)>=1e3)){r(!0);return}const _="e2e_"+Math.random().toString(36).slice(2,8);window.location.assign(`/poker/room/${_}`)},children:"Create Game"})}),g.jsxs("div",{className:"poker-mock__table",children:[g.jsx("div",{className:"poker-mock__table-ring","aria-hidden":!0}),g.jsx("div",{className:"poker-board",children:Uh.community.map((m,_)=>{const w=m.suit==="♥"||m.suit==="♦";return g.jsxs("div",{className:["poker-card",w?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":TL(m),children:[g.jsx("span",{className:"poker-card__rank",children:m.rank}),g.jsx("span",{className:"poker-card__suit",children:m.suit})]},_)})}),g.jsxs("div",{className:"poker-pot",children:["$",Uh.pot]})]}),n?.hole&&g.jsx("div",{className:"poker-hole",children:n.hole.map((m,_)=>{const w=m.suit==="♥"||m.suit==="♦";return g.jsxs("div",{className:["poker-card",w?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":TL(m),children:[g.jsx("span",{className:"poker-card__rank",children:m.rank}),g.jsx("span",{className:"poker-card__suit",children:m.suit})]},_)})}),g.jsx("div",{className:"poker-actions-wrap",children:g.jsx("div",{className:"poker-actions",children:D0e.map((m,_)=>g.jsx(Sm,{label:EL(m),ariaLabel:EL(m),size:"md",onClick:()=>{}},_))})}),g.jsx("div",{className:"poker-chiprack",children:g.jsx(k0,{selectedTimes:c,onAdd:d,onClear:f,onPlaceBet:()=>{h()},onCancelBet:()=>{h()},disabled:!1,collapsed:!1,miniChips:!0,mainAmt:u,betTokenProps:{isBanker:!1,meId:n.id,open:[],players:a,show:!0}})})]})})})}function N0e(){const t=tn(),e=yi();return v.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&t(n),eO()},[t]),v.useEffect(()=>{eO(e.pathname)},[e.pathname]),v.useEffect(()=>{try{const r=e.pathname||"",n=r==="/lobby",a=/^\/room\//.test(r)||/^\/poker\/room\//.test(r);(()=>{try{return/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})()?(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")):(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app")),document.body.classList.toggle("page-home-screen",n),document.body.classList.toggle("page-gameroom",a);const o=document.documentElement;if(n||a){o.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),o.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),o.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else o.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),o.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),o.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[e.pathname]),g.jsxs(GV,{children:[g.jsxs(yn,{element:g.jsx(Goe,{}),children:[g.jsx(yn,{path:"/verify",element:g.jsx(n0e,{})}),g.jsx(yn,{path:"/review-login",element:g.jsx(a0e,{})}),g.jsx(yn,{path:"/qa-login",element:g.jsx(i0e,{})}),g.jsx(yn,{path:"/login",element:g.jsx(Hoe,{})}),g.jsx(yn,{path:"/verification-failed",element:g.jsx(Z9,{})})]}),g.jsxs(yn,{element:g.jsx(Q9,{}),children:[g.jsx(yn,{path:"/profile",element:g.jsx(Qbe,{})}),g.jsx(yn,{path:"/settings",element:g.jsx(Zbe,{})}),g.jsx(yn,{path:"/add-chips",element:g.jsx(r0e,{})}),g.jsx(yn,{path:"/admin",element:g.jsx(em,{to:"/lobby",replace:!0})}),g.jsx(yn,{path:"/",element:g.jsx(em,{to:"/lobby",replace:!0})}),g.jsx(yn,{path:"/lobby",element:g.jsx(uae,{})}),g.jsx(yn,{path:"/room/:roomId",element:g.jsx(Xbe,{})}),g.jsx(yn,{path:"/poker",element:g.jsx(R0e,{})}),g.jsx(yn,{path:"/poker/mock",element:g.jsx(O0e,{})}),g.jsx(yn,{path:"/poker/room/:roomId",element:g.jsx(A0e,{})})]}),g.jsx(yn,{path:"/disclaimer",element:g.jsx(c0e,{})}),g.jsx(yn,{path:"/support",element:g.jsx(l0e,{})}),g.jsx(yn,{path:"/privacy",element:g.jsx(u0e,{})}),g.jsx(yn,{path:"/terms",element:g.jsx(d0e,{})}),g.jsx(yn,{path:"/button-sandbox",element:g.jsx(o0e,{})}),g.jsx(yn,{path:"/how-to-play",element:g.jsx(dF,{})}),g.jsx(yn,{path:"*",element:g.jsx(em,{to:"/lobby",replace:!0})})]})}const I0e="ceelolounge",CL=aH.toLowerCase(),M0e=new Set(["","verify","auth","ceelolounge","review-login","qa-login"]);function KE(t){return!t||t.length===0||t.length>2048||!/^[A-Za-z0-9._-]+$/.test(t)?null:t}function j0e(t){try{const e=new URL(t),r=e.protocol.replace(":","").toLowerCase(),n=(e.hostname||"").toLowerCase(),a=(e.pathname||"").toLowerCase(),i=r===I0e,o=e.protocol==="https:",c=a.endsWith("/verify")||a.includes("/auth/verify"),u=a.endsWith("/review-login")||a.includes("/review-login"),d=a.endsWith("/qa-login")||a.includes("/qa-login");if(i){if(!M0e.has(n)||!c&&!u&&!d&&!(n==="verify"||n==="review-login"||n==="qa-login")&&!((n===""||n==="ceelolounge")&&(a==="/"||a==="")))return null}else if(o){if(CL&&n!==CL||!c&&!u&&!d)return null}else return null;const f=KE(e.searchParams.get("token"));if(f)return f;const h=a.split("/").filter(Boolean),m=h.lastIndexOf("verify");return m>=0&&h[m+1]?KE(h[m+1]):h.length===1&&!["verify","auth","review-login","qa-login"].includes(h[0])?KE(h[0]):null}catch{return null}}function L0e(){const t=tn(),e=v.useRef(null);return v.useEffect(()=>{let r;const n=a=>{if(!a||e.current===a)return;const i=j0e(a);if(i){e.current=a;try{const o=new URL(a),c=(o.pathname||"").toLowerCase(),u=(o.hostname||"").toLowerCase(),d=c.includes("/review-login")||u==="review-login"?"/review-login":c.includes("/qa-login")||u==="qa-login"?"/qa-login":"/verify";t(`${d}?token=${encodeURIComponent(i)}`,{replace:!0})}catch{t(`/verify?token=${encodeURIComponent(i)}`,{replace:!0})}}};return Lo.getLaunchUrl().then(a=>n(a?.url)).catch(()=>{}),(async()=>r=await Lo.addListener("appUrlOpen",({url:a})=>n(a)))(),()=>r?.remove?.()},[t]),null}function B0e(t){switch(t.errorCode||""){case"UNAUTHORIZED":return{title:"Sign In Required",subtitle:"You must be logged in to bet."};case"BET_INVALID":return{title:"Invalid Bet",subtitle:t.error||"Bet not allowed."};case"BET_REJECTED":return{title:"Bet Rejected",subtitle:t.error||"Try a smaller amount."};case"LINE_LOCKED":return{title:"Line Locked",subtitle:"Pass/Don't Pass locked after point."};case"BALANCE_ADJUST_FAIL":return{title:"Balance Error",subtitle:"Could not adjust balance."};default:return{title:"Bet Error",subtitle:t.error||"Unable to place bet."}}}function U0e(){const{info:t}=Es();return Pa({onCrapsBetError:e=>{try{const{title:r,subtitle:n}=B0e(e);t(r,n)}catch{}}}),null}function WA(t,{strict:e=!0}={}){return!t||typeof t!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function xL(t){return WA(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const x6="2.37.8";let YE={getDocsUrl:({docsBaseUrl:t,docsPath:e="",docsSlug:r})=>e?`${t??"https://viem.sh"}${e}${r?`#${r}`:""}`:void 0,version:`viem@${x6}`},so=class QC extends Error{constructor(e,r={}){const n=r.cause instanceof QC?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof QC&&r.cause.docsPath||r.docsPath,i=YE.getDocsUrl?.({...r,docsPath:a}),o=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...n?[`Details: ${n}`]:[],...YE.version?[`Version: ${YE.version}`]:[]].join(`
`);super(o,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=a,this.metaMessages=r.metaMessages,this.name=r.name??this.name,this.shortMessage=e,this.version=x6}walk(e){return P6(this,e)}};function P6(t,e){return e?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?P6(t.cause,e):e?null:t}class F0e extends so{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class A6 extends so{constructor({size:e,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${r}).`,{name:"SizeExceedsPaddingSizeError"})}}function Mp(t,{dir:e,size:r=32}={}){return typeof t=="string"?q0e(t,{dir:e,size:r}):z0e(t,{dir:e,size:r})}function q0e(t,{dir:e,size:r=32}={}){if(r===null)return t;const n=t.replace("0x","");if(n.length>r*2)throw new A6({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n[e==="right"?"padEnd":"padStart"](r*2,"0")}`}function z0e(t,{dir:e,size:r=32}={}){if(r===null)return t;if(t.length>r)throw new A6({size:t.length,targetSize:r,type:"bytes"});const n=new Uint8Array(r);for(let a=0;a<r;a++){const i=e==="right";n[i?a:r-a-1]=t[i?a:t.length-a-1]}return n}class $0e extends so{constructor({max:e,min:r,signed:n,size:a,value:i}){super(`Number "${i}" is not in safe ${a?`${a*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${e?`(${r} to ${e})`:`(above ${r})`}`,{name:"IntegerOutOfRangeError"})}}class V0e extends so{constructor({givenSize:e,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function Wg(t,{size:e}){if(xL(t)>e)throw new V0e({givenSize:xL(t),maxSize:e})}const H0e=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function LSe(t,e={}){return typeof t=="number"||typeof t=="bigint"?mp(t,e):typeof t=="string"?D6(t,e):typeof t=="boolean"?G0e(t,e):R6(t,e)}function G0e(t,e={}){const r=`0x${Number(t)}`;return typeof e.size=="number"?(Wg(r,{size:e.size}),Mp(r,{size:e.size})):r}function R6(t,e={}){let r="";for(let a=0;a<t.length;a++)r+=H0e[t[a]];const n=`0x${r}`;return typeof e.size=="number"?(Wg(n,{size:e.size}),Mp(n,{dir:"right",size:e.size})):n}function mp(t,e={}){const{signed:r,size:n}=e,a=BigInt(t);let i;n?r?i=(1n<<BigInt(n)*8n-1n)-1n:i=2n**(BigInt(n)*8n)-1n:typeof t=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&r?-i-1n:0;if(i&&a>i||a<o){const u=typeof t=="bigint"?"n":"";throw new $0e({max:i?`${i}${u}`:void 0,min:`${o}${u}`,signed:r,size:n,value:`${t}${u}`})}const c=`0x${(r&&a<0?(1n<<BigInt(n*8))+BigInt(a):a).toString(16)}`;return n?Mp(c,{size:n}):c}const W0e=new TextEncoder;function D6(t,e={}){const r=W0e.encode(t);return R6(r,e)}const K0e=new TextEncoder;function Y0e(t,e={}){return typeof t=="number"||typeof t=="bigint"?J0e(t,e):typeof t=="boolean"?X0e(t,e):WA(t)?O6(t,e):N6(t,e)}function X0e(t,e={}){const r=new Uint8Array(1);return r[0]=Number(t),typeof e.size=="number"?(Wg(r,{size:e.size}),Mp(r,{size:e.size})):r}const wc={zero:48,nine:57,A:65,F:70,a:97,f:102};function PL(t){if(t>=wc.zero&&t<=wc.nine)return t-wc.zero;if(t>=wc.A&&t<=wc.F)return t-(wc.A-10);if(t>=wc.a&&t<=wc.f)return t-(wc.a-10)}function O6(t,e={}){let r=t;e.size&&(Wg(r,{size:e.size}),r=Mp(r,{dir:"right",size:e.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);const a=n.length/2,i=new Uint8Array(a);for(let o=0,c=0;o<a;o++){const u=PL(n.charCodeAt(c++)),d=PL(n.charCodeAt(c++));if(u===void 0||d===void 0)throw new so(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);i[o]=u*16+d}return i}function J0e(t,e){const r=mp(t,e);return O6(r)}function N6(t,e={}){const r=K0e.encode(t);return typeof e.size=="number"?(Wg(r,{size:e.size}),Mp(r,{dir:"right",size:e.size})):r}const xv=BigInt(2**32-1),AL=BigInt(32);function Q0e(t,e=!1){return e?{h:Number(t&xv),l:Number(t>>AL&xv)}:{h:Number(t>>AL&xv)|0,l:Number(t&xv)|0}}function Z0e(t,e=!1){const r=t.length;let n=new Uint32Array(r),a=new Uint32Array(r);for(let i=0;i<r;i++){const{h:o,l:c}=Q0e(t[i],e);[n[i],a[i]]=[o,c]}return[n,a]}const eke=(t,e,r)=>t<<r|e>>>32-r,tke=(t,e,r)=>e<<r|t>>>32-r,rke=(t,e,r)=>e<<r-32|t>>>64-r,nke=(t,e,r)=>t<<r-32|e>>>64-r;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ake(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function RL(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function wb(t,...e){if(!ake(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function DL(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function ike(t,e){wb(t);const r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function ske(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function I6(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const oke=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function cke(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function lke(t){for(let e=0;e<t.length;e++)t[e]=cke(t[e]);return t}const OL=oke?t=>t:lke;function uke(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function M6(t){return typeof t=="string"&&(t=uke(t)),wb(t),t}class dke{}function fke(t){const e=n=>t().update(M6(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}const pke=BigInt(0),Fh=BigInt(1),hke=BigInt(2),mke=BigInt(7),gke=BigInt(256),yke=BigInt(113),j6=[],L6=[],B6=[];for(let t=0,e=Fh,r=1,n=0;t<24;t++){[r,n]=[n,(2*r+3*n)%5],j6.push(2*(5*n+r)),L6.push((t+1)*(t+2)/2%64);let a=pke;for(let i=0;i<7;i++)e=(e<<Fh^(e>>mke)*yke)%gke,e&hke&&(a^=Fh<<(Fh<<BigInt(i))-Fh);B6.push(a)}const U6=Z0e(B6,!0),vke=U6[0],_ke=U6[1],NL=(t,e,r)=>r>32?rke(t,e,r):eke(t,e,r),IL=(t,e,r)=>r>32?nke(t,e,r):tke(t,e,r);function bke(t,e=24){const r=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let o=0;o<10;o++)r[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,u=(o+2)%10,d=r[u],f=r[u+1],h=NL(d,f,1)^r[c],m=IL(d,f,1)^r[c+1];for(let _=0;_<50;_+=10)t[o+_]^=h,t[o+_+1]^=m}let a=t[2],i=t[3];for(let o=0;o<24;o++){const c=L6[o],u=NL(a,i,c),d=IL(a,i,c),f=j6[o];a=t[f],i=t[f+1],t[f]=u,t[f+1]=d}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)r[c]=t[o+c];for(let c=0;c<10;c++)t[o+c]^=~r[(c+2)%10]&r[(c+4)%10]}t[0]^=vke[n],t[1]^=_ke[n]}I6(r)}class KA extends dke{constructor(e,r,n,a=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=r,this.outputLen=n,this.enableXOF=a,this.rounds=i,RL(n),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ske(this.state)}clone(){return this._cloneInto()}keccak(){OL(this.state32),bke(this.state32,this.rounds),OL(this.state32),this.posOut=0,this.pos=0}update(e){DL(this),e=M6(e),wb(e);const{blockLen:r,state:n}=this,a=e.length;for(let i=0;i<a;){const o=Math.min(r-this.pos,a-i);for(let c=0;c<o;c++)n[this.pos++]^=e[i++];this.pos===r&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:r,pos:n,blockLen:a}=this;e[n]^=r,(r&128)!==0&&n===a-1&&this.keccak(),e[a-1]^=128,this.keccak()}writeInto(e){DL(this,!1),wb(e),this.finish();const r=this.state,{blockLen:n}=this;for(let a=0,i=e.length;a<i;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,i-a);e.set(r.subarray(this.posOut,this.posOut+o),a),this.posOut+=o,a+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return RL(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ike(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,I6(this.state)}_cloneInto(e){const{blockLen:r,suffix:n,outputLen:a,rounds:i,enableXOF:o}=this;return e||(e=new KA(r,n,a,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=n,e.outputLen=a,e.enableXOF=o,e.destroyed=this.destroyed,e}}const kke=(t,e,r)=>fke(()=>new KA(e,t,r)),wke=kke(1,136,256/8);function Ske(t,e){return wke(WA(t,{strict:!1})?Y0e(t):t)}class YA extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const r=super.get(e);return super.has(e)&&r!==void 0&&(this.delete(e),super.set(e,r)),r}set(e,r){if(super.set(e,r),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const Eke=/^0x[a-fA-F0-9]{40}$/,XE=new YA(8192);function Tke(t,e){const{strict:r=!0}=e??{},n=`${t}.${r}`;if(XE.has(n))return XE.get(n);const a=Eke.test(t)?t.toLowerCase()===t?!0:r?F6(t)===t:!0:!1;return XE.set(n,a),a}const JE=new YA(8192);function F6(t,e){if(JE.has(`${t}.${e}`))return JE.get(`${t}.${e}`);const r=t.substring(2).toLowerCase(),n=Ske(N6(r)),a=r.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&a[o]&&(a[o]=a[o].toUpperCase()),(n[o>>1]&15)>=8&&a[o+1]&&(a[o+1]=a[o+1].toUpperCase());const i=`0x${a.join("")}`;return JE.set(`${t}.${e}`,i),i}function Xu(t,e){if(!Tke(t,{strict:!1}))throw new F0e({address:t});return F6(t,e)}function Cke(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const ad=(t,e,r)=>JSON.stringify(t,(n,a)=>typeof a=="bigint"?a.toString():a,r),XA=t=>t;class Em extends so{constructor({body:e,cause:r,details:n,headers:a,status:i,url:o}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[i&&`Status: ${i}`,`URL: ${XA(o)}`,e&&`Request body: ${ad(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=a,this.status=i,this.url=o}}class q6 extends so{constructor({body:e,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${XA(n)}`,`Request body: ${ad(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data}}class ML extends so{constructor({body:e,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${XA(r)}`,`Request body: ${ad(e)}`],name:"TimeoutError"})}}const xke=-1;class vi extends so{constructor(e,{code:r,docsPath:n,metaMessages:a,name:i,shortMessage:o}){super(o,{cause:e,docsPath:n,metaMessages:a||e?.metaMessages,name:i||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=i||e.name,this.code=e instanceof q6?e.code:r??xke}}class qi extends vi{constructor(e,r){super(e,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class eg extends vi{constructor(e){super(e,{code:eg.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(eg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class tg extends vi{constructor(e){super(e,{code:tg.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(tg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class rg extends vi{constructor(e,{method:r}={}){super(e,{code:rg.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(rg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ng extends vi{constructor(e){super(e,{code:ng.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(ng,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class gp extends vi{constructor(e){super(e,{code:gp.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(gp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class ag extends vi{constructor(e){super(e,{code:ag.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(ag,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ig extends vi{constructor(e){super(e,{code:ig.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ig,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Gl extends vi{constructor(e){super(e,{code:Gl.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Gl,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class sg extends vi{constructor(e){super(e,{code:sg.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(sg,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Ju extends vi{constructor(e,{method:r}={}){super(e,{code:Ju.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Ju,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class yp extends vi{constructor(e){super(e,{code:yp.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(yp,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class og extends vi{constructor(e){super(e,{code:og.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(og,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class na extends qi{constructor(e){super(e,{code:na.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(na,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class cg extends qi{constructor(e){super(e,{code:cg.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(cg,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class lg extends qi{constructor(e,{method:r}={}){super(e,{code:lg.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(lg,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ug extends qi{constructor(e){super(e,{code:ug.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(ug,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class dg extends qi{constructor(e){super(e,{code:dg.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(dg,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class su extends qi{constructor(e){super(e,{code:su.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(su,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class fg extends qi{constructor(e){super(e,{code:fg.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(fg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class pg extends qi{constructor(e){super(e,{code:pg.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(pg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class hg extends qi{constructor(e){super(e,{code:hg.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(hg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class mg extends qi{constructor(e){super(e,{code:mg.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(mg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class gg extends qi{constructor(e){super(e,{code:gg.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(gg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class yg extends qi{constructor(e){super(e,{code:yg.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(yg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class vg extends qi{constructor(e){super(e,{code:vg.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(vg,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Pke extends vi{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function Ake(){let t=()=>{},e=()=>{};return{promise:new Promise((n,a)=>{t=n,e=a}),resolve:t,reject:e}}const QE=new Map;function Rke({fn:t,id:e,shouldSplitBatch:r,wait:n=0,sort:a}){const i=async()=>{const f=u();o();const h=f.map(({args:m})=>m);h.length!==0&&t(h).then(m=>{a&&Array.isArray(m)&&m.sort(a);for(let _=0;_<f.length;_++){const{resolve:w}=f[_];w?.([m[_],m])}}).catch(m=>{for(let _=0;_<f.length;_++){const{reject:w}=f[_];w?.(m)}})},o=()=>QE.delete(e),c=()=>u().map(({args:f})=>f),u=()=>QE.get(e)||[],d=f=>QE.set(e,[...u(),f]);return{flush:o,async schedule(f){const{promise:h,resolve:m,reject:_}=Ake();return r?.([...c(),f])&&i(),u().length>0?(d({args:f,resolve:m,reject:_}),h):(d({args:f,resolve:m,reject:_}),setTimeout(i,n),h)}}}const Pv=new YA(8192);function Dke(t,{enabled:e=!0,id:r}){if(!e||!r)return t();if(Pv.get(r))return Pv.get(r);const n=t().finally(()=>Pv.delete(r));return Pv.set(r,n),n}async function Oke(t){return new Promise(e=>setTimeout(e,t))}function z6(t,{delay:e=100,retryCount:r=2,shouldRetry:n=()=>!0}={}){return new Promise((a,i)=>{const o=async({count:c=0}={})=>{const u=async({error:d})=>{const f=typeof e=="function"?e({count:c,error:d}):e;f&&await Oke(f),o({count:c+1})};try{const d=await t();a(d)}catch(d){if(c<r&&await n({count:c,error:d}))return u({error:d});i(d)}};o()})}function Nke(t,e={}){return async(r,n={})=>{const{dedupe:a=!1,methods:i,retryDelay:o=150,retryCount:c=3,uid:u}={...e,...n},{method:d}=r;if(i?.exclude?.includes(d))throw new Ju(new Error("method not supported"),{method:d});if(i?.include&&!i.include.includes(d))throw new Ju(new Error("method not supported"),{method:d});const f=a?D6(`${u}.${ad(r)}`):void 0;return Dke(()=>z6(async()=>{try{return await t(r)}catch(h){const m=h;switch(m.code){case eg.code:throw new eg(m);case tg.code:throw new tg(m);case rg.code:throw new rg(m,{method:r.method});case ng.code:throw new ng(m);case gp.code:throw new gp(m);case ag.code:throw new ag(m);case ig.code:throw new ig(m);case Gl.code:throw new Gl(m);case sg.code:throw new sg(m);case Ju.code:throw new Ju(m,{method:r.method});case yp.code:throw new yp(m);case og.code:throw new og(m);case na.code:throw new na(m);case cg.code:throw new cg(m);case lg.code:throw new lg(m);case ug.code:throw new ug(m);case dg.code:throw new dg(m);case su.code:throw new su(m);case fg.code:throw new fg(m);case pg.code:throw new pg(m);case hg.code:throw new hg(m);case mg.code:throw new mg(m);case gg.code:throw new gg(m);case yg.code:throw new yg(m);case vg.code:throw new vg(m);case 5e3:throw new na(m);default:throw h instanceof so?h:new Pke(m)}}},{delay:({count:h,error:m})=>{if(m&&m instanceof Em){const _=m?.headers?.get("Retry-After");if(_?.match(/\d/))return Number.parseInt(_,10)*1e3}return~~(1<<h)*o},retryCount:c,shouldRetry:({error:h})=>Ike(h)}),{enabled:a,id:f})}}function Ike(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===yp.code||t.code===gp.code:t instanceof Em&&t.status?t.status===403||t.status===408||t.status===413||t.status===429||t.status===500||t.status===502||t.status===503||t.status===504:!0}function $6(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}function V6(t,{errorInstance:e=new Error("timed out"),timeout:r,signal:n}){return new Promise((a,i)=>{(async()=>{let o;try{const c=new AbortController;r>0&&(o=setTimeout(()=>{n?c.abort():i(e)},r)),a(await t({signal:c?.signal||null}))}catch(c){c?.name==="AbortError"&&i(e),i(c)}finally{clearTimeout(o)}})()})}function Mke(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const jL=Mke();function jke(t,e={}){return{async request(r){const{body:n,fetchFn:a=e.fetchFn??fetch,onRequest:i=e.onRequest,onResponse:o=e.onResponse,timeout:c=e.timeout??1e4}=r,u={...e.fetchOptions??{},...r.fetchOptions??{}},{headers:d,method:f,signal:h}=u;try{const m=await V6(async({signal:w})=>{const b={...u,body:Array.isArray(n)?ad(n.map(P=>({jsonrpc:"2.0",id:P.id??jL.take(),...P}))):ad({jsonrpc:"2.0",id:n.id??jL.take(),...n}),headers:{"Content-Type":"application/json",...d},method:f||"POST",signal:h||(c>0?w:null)},E=new Request(t,b),T=await i?.(E,b)??{...b,url:t};return await a(T.url??t,T)},{errorInstance:new ML({body:n,url:t}),timeout:c,signal:!0});o&&await o(m);let _;if(m.headers.get("Content-Type")?.startsWith("application/json"))_=await m.json();else{_=await m.text();try{_=JSON.parse(_||"{}")}catch(w){if(m.ok)throw w;_={error:_}}}if(!m.ok)throw new Em({body:n,details:ad(_.error)||m.statusText,headers:m.headers,status:m.status,url:t});return _}catch(m){throw m instanceof Em||m instanceof ML?m:new Em({body:n,cause:m,url:t})}}}}const E_="2.21.2",Lke=()=>`@wagmi/core@${E_}`;var H6=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Sb,G6;class _g extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return Lke()}constructor(e,r={}){super(),Sb.add(this),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const n=r.cause instanceof _g?r.cause.details:r.cause?.message?r.cause.message:r.details,a=r.cause instanceof _g&&r.cause.docsPath||r.docsPath;this.message=[e||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...a?[`Docs: ${this.docsBaseUrl}${a}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join(`
`),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=a,this.metaMessages=r.metaMessages,this.shortMessage=e}walk(e){return H6(this,Sb,"m",G6).call(this,this,e)}}Sb=new WeakSet,G6=function t(e,r){return r?.(e)?e:e.cause?H6(this,Sb,"m",t).call(this,e.cause,r):e};class Eb extends _g{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}const ZC=256;let Av=ZC,Rv;function W6(t=11){if(!Rv||Av+t>ZC*2){Rv="",Av=0;for(let e=0;e<ZC;e++)Rv+=(256+Math.random()*256|0).toString(16).substring(1)}return Rv.substring(Av,Av+++t)}function Bke(t){const{batch:e,chain:r,ccipRead:n,key:a="base",name:i="Base Client",type:o="base"}=t,c=t.experimental_blockTag??(typeof r?.experimental_preconfirmationTime=="number"?"pending":void 0),u=r?.blockTime??12e3,d=Math.min(Math.max(Math.floor(u/2),500),4e3),f=t.pollingInterval??d,h=t.cacheTime??f,m=t.account?Cke(t.account):void 0,{config:_,request:w,value:b}=t.transport({chain:r,pollingInterval:f}),E={..._,...b},T={account:m,batch:e,cacheTime:h,ccipRead:n,chain:r,key:a,name:i,pollingInterval:f,request:w,transport:E,type:o,uid:W6(),...c?{experimental_blockTag:c}:{}};function R(P){return A=>{const C=A(P);for(const I in T)delete C[I];const O={...P,...C};return Object.assign(O,{extend:R(O)})}}return Object.assign(T,{extend:R(T)})}function Uke({key:t,methods:e,name:r,request:n,retryCount:a=3,retryDelay:i=150,timeout:o,type:c},u){const d=W6();return{config:{key:t,methods:e,name:r,request:n,retryCount:a,retryDelay:i,timeout:o,type:c},request:Nke(n,{methods:e,retryCount:a,retryDelay:i,uid:d}),value:u}}class Fke extends so{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function LL(t,e={}){const{batch:r,fetchFn:n,fetchOptions:a,key:i="http",methods:o,name:c="HTTP JSON-RPC",onFetchRequest:u,onFetchResponse:d,retryDelay:f,raw:h}=e;return({chain:m,retryCount:_,timeout:w})=>{const{batchSize:b=1e3,wait:E=0}=typeof r=="object"?r:{},T=e.retryCount??_,R=w??e.timeout??1e4,P=t||m?.rpcUrls.default.http[0];if(!P)throw new Fke;const A=jke(P,{fetchFn:n,fetchOptions:a,onRequest:u,onResponse:d,timeout:R});return Uke({key:i,methods:o,name:c,async request({method:C,params:O}){const I={method:C,params:O},{schedule:x}=Rke({id:P,wait:E,shouldSplitBatch(j){return j.length>b},fn:j=>A.request({body:j}),sort:(j,q)=>j.id-q.id}),D=async j=>r?x(j):[await A.request({body:j})],[{error:N,result:L}]=await D(I);if(h)return{error:N,result:L};if(N)throw new q6({body:I,error:N,url:P});return L},retryCount:T,retryDelay:f,timeout:R,type:"http"},{fetchOptions:a,url:P})}}let ZE=!1;async function qke(t,e={}){if(ZE)return[];ZE=!0,t.setState(d=>({...d,status:d.current?"reconnecting":"connecting"}));const r=[];if(e.connectors?.length)for(const d of e.connectors){let f;typeof d=="function"?f=t._internal.connectors.setup(d):f=d,r.push(f)}else r.push(...t.connectors);let n;try{n=await t.storage?.getItem("recentConnectorId")}catch{}const a={};for(const[,d]of t.state.connections)a[d.connector.id]=1;n&&(a[n]=0);const i=Object.keys(a).length>0?[...r].sort((d,f)=>(a[d.id]??10)-(a[f.id]??10)):r;let o=!1;const c=[],u=[];for(const d of i){const f=await d.getProvider().catch(()=>{});if(!f||u.some(_=>_===f)||!await d.isAuthorized())continue;const m=await d.connect({isReconnecting:!0}).catch(()=>null);m&&(d.emitter.off("connect",t._internal.events.connect),d.emitter.on("change",t._internal.events.change),d.emitter.on("disconnect",t._internal.events.disconnect),t.setState(_=>{const w=new Map(o?_.connections:new Map).set(d.uid,{accounts:m.accounts,chainId:m.chainId,connector:d});return{..._,current:o?_.current:d.uid,connections:w}}),c.push({accounts:m.accounts,chainId:m.chainId,connector:d}),u.push(f),o=!0)}return(t.state.status==="reconnecting"||t.state.status==="connecting")&&(o?t.setState(d=>({...d,status:"connected"})):t.setState(d=>({...d,connections:new Map,current:null,status:"disconnected"}))),ZE=!1,c}class Rl extends _g{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}S0.type="injected";function S0(t={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:r}=t;function n(){const u=t.target;if(typeof u=="function"){const d=u();if(d)return d}return typeof u=="object"?u:typeof u=="string"?{...zke[u]??{id:u,name:`${u[0].toUpperCase()}${u.slice(1)}`,provider:`is${u[0].toUpperCase()}${u.slice(1)}`}}:{id:"injected",name:"Injected",provider(d){return d?.ethereum}}}let a,i,o,c;return u=>({get icon(){return n().icon},get id(){return n().id},get name(){return n().name},get supportsSimulation(){return!0},type:S0.type,async setup(){const d=await this.getProvider();d?.on&&t.target&&(o||(o=this.onConnect.bind(this),d.on("connect",o)),a||(a=this.onAccountsChanged.bind(this),d.on("accountsChanged",a)))},async connect({chainId:d,isReconnecting:f,withCapabilities:h}={}){const m=await this.getProvider();if(!m)throw new Rl;let _=[];if(f)_=await this.getAccounts().catch(()=>[]);else if(e)try{_=(await m.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0]?.caveats?.[0]?.value?.map(b=>Xu(b)),_.length>0&&(_=await this.getAccounts())}catch(w){const b=w;if(b.code===na.code)throw new na(b);if(b.code===Gl.code)throw b}try{!_?.length&&!f&&(_=(await m.request({method:"eth_requestAccounts"})).map(E=>Xu(E))),o&&(m.removeListener("connect",o),o=void 0),a||(a=this.onAccountsChanged.bind(this),m.on("accountsChanged",a)),i||(i=this.onChainChanged.bind(this),m.on("chainChanged",i)),c||(c=this.onDisconnect.bind(this),m.on("disconnect",c));let w=await this.getChainId();return d&&w!==d&&(w=(await this.switchChain({chainId:d}).catch(E=>{if(E.code===na.code)throw E;return{id:w}}))?.id??w),e&&await u.storage?.removeItem(`${this.id}.disconnected`),t.target||await u.storage?.setItem("injected.connected",!0),{accounts:h?_.map(b=>({address:b,capabilities:{}})):_,chainId:w}}catch(w){const b=w;throw b.code===na.code?new na(b):b.code===Gl.code?new Gl(b):b}},async disconnect(){const d=await this.getProvider();if(!d)throw new Rl;i&&(d.removeListener("chainChanged",i),i=void 0),c&&(d.removeListener("disconnect",c),c=void 0),o||(o=this.onConnect.bind(this),d.on("connect",o));try{await V6(()=>d.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await u.storage?.setItem(`${this.id}.disconnected`,!0),t.target||await u.storage?.removeItem("injected.connected")},async getAccounts(){const d=await this.getProvider();if(!d)throw new Rl;return(await d.request({method:"eth_accounts"})).map(h=>Xu(h))},async getChainId(){const d=await this.getProvider();if(!d)throw new Rl;const f=await d.request({method:"eth_chainId"});return Number(f)},async getProvider(){if(typeof window>"u")return;let d;const f=n();return typeof f.provider=="function"?d=f.provider(window):typeof f.provider=="string"?d=T_(window,f.provider):d=f.provider,d&&!d.removeListener&&("off"in d&&typeof d.off=="function"?d.removeListener=d.off:d.removeListener=()=>{}),d},async isAuthorized(){try{if(e&&await u.storage?.getItem(`${this.id}.disconnected`)||!t.target&&!await u.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(r!==void 0&&r!==!1){const m=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",m),!!await this.getProvider()),_=typeof r=="number"?r:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(b=>window.addEventListener("ethereum#initialized",()=>b(m()),{once:!0}))]:[],new Promise(b=>setTimeout(()=>b(m()),_))]))return!0}throw new Rl}return!!(await z6(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:d,chainId:f}){const h=await this.getProvider();if(!h)throw new Rl;const m=u.chains.find(w=>w.id===f);if(!m)throw new su(new Eb);const _=new Promise(w=>{const b=(E=>{"chainId"in E&&E.chainId===f&&(u.emitter.off("change",b),w())});u.emitter.on("change",b)});try{return await Promise.all([h.request({method:"wallet_switchEthereumChain",params:[{chainId:mp(f)}]}).then(async()=>{await this.getChainId()===f&&u.emitter.emit("change",{chainId:f})}),_]),m}catch(w){const b=w;if(b.code===4902||b?.data?.originalError?.code===4902)try{const{default:E,...T}=m.blockExplorers??{};let R;d?.blockExplorerUrls?R=d.blockExplorerUrls:E&&(R=[E.url,...Object.values(T).map(C=>C.url)]);let P;d?.rpcUrls?.length?P=d.rpcUrls:P=[m.rpcUrls.default?.http[0]??""];const A={blockExplorerUrls:R,chainId:mp(f),chainName:d?.chainName??m.name,iconUrls:d?.iconUrls,nativeCurrency:d?.nativeCurrency??m.nativeCurrency,rpcUrls:P};return await Promise.all([h.request({method:"wallet_addEthereumChain",params:[A]}).then(async()=>{if(await this.getChainId()===f)u.emitter.emit("change",{chainId:f});else throw new na(new Error("User rejected switch after adding network."))}),_]),m}catch(E){throw new na(E)}throw b.code===na.code?new na(b):new su(b)}},async onAccountsChanged(d){if(d.length===0)this.onDisconnect();else if(u.emitter.listenerCount("connect")){const f=(await this.getChainId()).toString();this.onConnect({chainId:f}),e&&await u.storage?.removeItem(`${this.id}.disconnected`)}else u.emitter.emit("change",{accounts:d.map(f=>Xu(f))})},onChainChanged(d){const f=Number(d);u.emitter.emit("change",{chainId:f})},async onConnect(d){const f=await this.getAccounts();if(f.length===0)return;const h=Number(d.chainId);u.emitter.emit("connect",{accounts:f,chainId:h});const m=await this.getProvider();m&&(o&&(m.removeListener("connect",o),o=void 0),a||(a=this.onAccountsChanged.bind(this),m.on("accountsChanged",a)),i||(i=this.onChainChanged.bind(this),m.on("chainChanged",i)),c||(c=this.onDisconnect.bind(this),m.on("disconnect",c)))},async onDisconnect(d){const f=await this.getProvider();d&&d.code===1013&&f&&(await this.getAccounts()).length||(u.emitter.emit("disconnect"),f&&(i&&(f.removeListener("chainChanged",i),i=void 0),c&&(f.removeListener("disconnect",c),c=void 0),o||(o=this.onConnect.bind(this),f.on("connect",o))))}})}const zke={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t?.coinbaseWalletExtension?t.coinbaseWalletExtension:T_(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return T_(t,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const r=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const n of r)if(e[n])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(t){return t?.phantom?.ethereum?t.phantom?.ethereum:T_(t,"isPhantom")}}};function T_(t,e){function r(a){return typeof e=="function"?e(a):typeof e=="string"?a[e]:!0}const n=t.ethereum;if(n?.providers)return n.providers.find(a=>r(a));if(n&&r(n))return n}function $ke(t){if(typeof window>"u")return;const e=r=>t(r.detail);return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}function Vke(){const t=new Set;let e=[];const r=()=>$ke(a=>{e.some(({info:i})=>i.uuid===a.info.uuid)||(e=[...e,a],t.forEach(i=>i(e,{added:[a]})))});let n=r();return{_listeners(){return t},clear(){t.forEach(a=>a([],{removed:[...e]})),e=[]},destroy(){this.clear(),t.clear(),n?.()},findProvider({rdns:a}){return e.find(i=>i.info.rdns===a)},getProviders(){return e},reset(){this.clear(),n?.(),n=r()},subscribe(a,{emitImmediately:i}={}){return t.add(a),i&&a(e,{added:e}),()=>t.delete(a)}}}const Hke=t=>(e,r,n)=>{const a=n.subscribe;return n.subscribe=(o,c,u)=>{let d=o;if(c){const f=u?.equalityFn||Object.is;let h=o(n.getState());d=m=>{const _=o(m);if(!f(h,_)){const w=h;c(h=_,w)}},u?.fireImmediately&&c(h,h)}return a(d)},t(e,r,n)},Gke=Hke;function Wke(t,e){let r;try{r=t()}catch{return}return{getItem:a=>{var i;const o=u=>u===null?null:JSON.parse(u,void 0),c=(i=r.getItem(a))!=null?i:null;return c instanceof Promise?c.then(o):o(c)},setItem:(a,i)=>r.setItem(a,JSON.stringify(i,void 0)),removeItem:a=>r.removeItem(a)}}const ex=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return ex(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return ex(n)(r)}}}},Kke=(t,e)=>(r,n,a)=>{let i={storage:Wke(()=>localStorage),partialize:b=>b,version:0,merge:(b,E)=>({...E,...b}),...e},o=!1;const c=new Set,u=new Set;let d=i.storage;if(!d)return t((...b)=>{r(...b)},n,a);const f=()=>{const b=i.partialize({...n()});return d.setItem(i.name,{state:b,version:i.version})},h=a.setState;a.setState=(b,E)=>{h(b,E),f()};const m=t((...b)=>{r(...b),f()},n,a);a.getInitialState=()=>m;let _;const w=()=>{var b,E;if(!d)return;o=!1,c.forEach(R=>{var P;return R((P=n())!=null?P:m)});const T=((E=i.onRehydrateStorage)==null?void 0:E.call(i,(b=n())!=null?b:m))||void 0;return ex(d.getItem.bind(d))(i.name).then(R=>{if(R)if(typeof R.version=="number"&&R.version!==i.version){if(i.migrate)return[!0,i.migrate(R.state,R.version)]}else return[!1,R.state];return[!1,void 0]}).then(R=>{var P;const[A,C]=R;if(_=i.merge(C,(P=n())!=null?P:m),r(_,!0),A)return f()}).then(()=>{T?.(_,void 0),_=n(),o=!0,u.forEach(R=>R(_))}).catch(R=>{T?.(void 0,R)})};return a.persist={setOptions:b=>{i={...i,...b},b.storage&&(d=b.storage)},clearStorage:()=>{d?.removeItem(i.name)},getOptions:()=>i,rehydrate:()=>w(),hasHydrated:()=>o,onHydrate:b=>(c.add(b),()=>{c.delete(b)}),onFinishHydration:b=>(u.add(b),()=>{u.delete(b)})},i.skipHydration||w(),_||m},Yke=Kke,BL=t=>{let e;const r=new Set,n=(d,f)=>{const h=typeof d=="function"?d(e):d;if(!Object.is(h,e)){const m=e;e=f??(typeof h!="object"||h===null)?h:Object.assign({},e,h),r.forEach(_=>_(e,m))}},a=()=>e,c={setState:n,getState:a,getInitialState:()=>u,subscribe:d=>(r.add(d),()=>r.delete(d))},u=e=t(n,a,c);return c},eT=t=>t?BL(t):BL;var tT={exports:{}},UL;function Xke(){return UL||(UL=1,(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function a(u,d,f){this.fn=u,this.context=d,this.once=f||!1}function i(u,d,f,h,m){if(typeof f!="function")throw new TypeError("The listener must be a function");var _=new a(f,h||u,m),w=r?r+d:d;return u._events[w]?u._events[w].fn?u._events[w]=[u._events[w],_]:u._events[w].push(_):(u._events[w]=_,u._eventsCount++),u}function o(u,d){--u._eventsCount===0?u._events=new n:delete u._events[d]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var d=[],f,h;if(this._eventsCount===0)return d;for(h in f=this._events)e.call(f,h)&&d.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},c.prototype.listeners=function(d){var f=r?r+d:d,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,_=h.length,w=new Array(_);m<_;m++)w[m]=h[m].fn;return w},c.prototype.listenerCount=function(d){var f=r?r+d:d,h=this._events[f];return h?h.fn?1:h.length:0},c.prototype.emit=function(d,f,h,m,_,w){var b=r?r+d:d;if(!this._events[b])return!1;var E=this._events[b],T=arguments.length,R,P;if(E.fn){switch(E.once&&this.removeListener(d,E.fn,void 0,!0),T){case 1:return E.fn.call(E.context),!0;case 2:return E.fn.call(E.context,f),!0;case 3:return E.fn.call(E.context,f,h),!0;case 4:return E.fn.call(E.context,f,h,m),!0;case 5:return E.fn.call(E.context,f,h,m,_),!0;case 6:return E.fn.call(E.context,f,h,m,_,w),!0}for(P=1,R=new Array(T-1);P<T;P++)R[P-1]=arguments[P];E.fn.apply(E.context,R)}else{var A=E.length,C;for(P=0;P<A;P++)switch(E[P].once&&this.removeListener(d,E[P].fn,void 0,!0),T){case 1:E[P].fn.call(E[P].context);break;case 2:E[P].fn.call(E[P].context,f);break;case 3:E[P].fn.call(E[P].context,f,h);break;case 4:E[P].fn.call(E[P].context,f,h,m);break;default:if(!R)for(C=1,R=new Array(T-1);C<T;C++)R[C-1]=arguments[C];E[P].fn.apply(E[P].context,R)}}return!0},c.prototype.on=function(d,f,h){return i(this,d,f,h,!1)},c.prototype.once=function(d,f,h){return i(this,d,f,h,!0)},c.prototype.removeListener=function(d,f,h,m){var _=r?r+d:d;if(!this._events[_])return this;if(!f)return o(this,_),this;var w=this._events[_];if(w.fn)w.fn===f&&(!m||w.once)&&(!h||w.context===h)&&o(this,_);else{for(var b=0,E=[],T=w.length;b<T;b++)(w[b].fn!==f||m&&!w[b].once||h&&w[b].context!==h)&&E.push(w[b]);E.length?this._events[_]=E.length===1?E[0]:E:o(this,_)}return this},c.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&o(this,f)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t.exports=c})(tT)),tT.exports}var Jke=Xke();const Qke=wg(Jke);class Zke{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new Qke})}on(e,r){this._emitter.on(e,r)}once(e,r){this._emitter.once(e,r)}off(e,r){this._emitter.off(e,r)}emit(e,...r){const n=r[0];this._emitter.emit(e,{uid:this.uid,...n})}listenerCount(e){return this._emitter.listenerCount(e)}}function ewe(t){return new Zke(t)}function twe(t,e){return JSON.parse(t,(r,n)=>{let a=n;return a?.__type==="bigint"&&(a=BigInt(a.value)),a?.__type==="Map"&&(a=new Map(a.value)),e?.(r,a)??a})}function FL(t,e){return t.slice(0,e).join(".")||"."}function qL(t,e){const{length:r}=t;for(let n=0;n<r;++n)if(t[n]===e)return n+1;return 0}function rwe(t,e){const r=typeof t=="function",n=typeof e=="function",a=[],i=[];return function(c,u){if(typeof u=="object")if(a.length){const d=qL(a,this);d===0?a[a.length]=this:(a.splice(d),i.splice(d)),i[i.length]=c;const f=qL(a,u);if(f!==0)return n?e.call(this,c,u,FL(i,f)):`[ref=${FL(i,f)}]`}else a[0]=u,i[0]=c;return r?t.call(this,c,u):u}}function nwe(t,e,r,n){return JSON.stringify(t,rwe((a,i)=>{let o=i;return typeof o=="bigint"&&(o={__type:"bigint",value:i.toString()}),o instanceof Map&&(o={__type:"Map",value:Array.from(i.entries())}),e?.(a,o)??o},n),r??void 0)}function K6(t){const{deserialize:e=twe,key:r="wagmi",serialize:n=nwe,storage:a=Y6}=t;function i(o){return o instanceof Promise?o.then(c=>c).catch(()=>null):o}return{...a,key:r,async getItem(o,c){const u=a.getItem(`${r}.${o}`),d=await i(u);return d?e(d)??null:c??null},async setItem(o,c){const u=`${r}.${o}`;c===null?await i(a.removeItem(u)):await i(a.setItem(u,n(c)))},async removeItem(o){await i(a.removeItem(`${r}.${o}`))}}}const Y6={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function awe(){const t=typeof window<"u"&&window.localStorage?window.localStorage:Y6;return{getItem(e){return t.getItem(e)},removeItem(e){t.removeItem(e)},setItem(e,r){try{t.setItem(e,r)}catch{}}}}const tx=256;let Dv=tx,Ov;function iwe(t=11){if(!Ov||Dv+t>tx*2){Ov="",Dv=0;for(let e=0;e<tx;e++)Ov+=(256+Math.random()*256|0).toString(16).substring(1)}return Ov.substring(Dv,Dv+++t)}function swe(t){const{multiInjectedProviderDiscovery:e=!0,storage:r=K6({storage:awe()}),syncConnectedChain:n=!0,ssr:a=!1,...i}=t,o=typeof window<"u"&&e?Vke():void 0,c=eT(()=>i.chains),u=eT(()=>{const C=[],O=new Set;for(const I of i.connectors??[]){const x=d(I);if(C.push(x),!a&&x.rdns){const D=typeof x.rdns=="string"?[x.rdns]:x.rdns;for(const N of D)O.add(N)}}if(!a&&o){const I=o.getProviders();for(const x of I)O.has(x.info.rdns)||C.push(d(f(x)))}return C});function d(C){const O=ewe(iwe()),I={...C({emitter:O,chains:c.getState(),storage:r,transports:i.transports}),emitter:O,uid:O.uid};return O.on("connect",P),I.setup?.(),I}function f(C){const{info:O}=C,I=C.provider;return S0({target:{...O,id:O.rdns,provider:I}})}const h=new Map;function m(C={}){const O=C.chainId??E.getState().chainId,I=c.getState().find(D=>D.id===O);if(C.chainId&&!I)throw new Eb;{const D=h.get(E.getState().chainId);if(D&&!I)return D;if(!I)throw new Eb}{const D=h.get(O);if(D)return D}let x;if(i.client)x=i.client({chain:I});else{const D=I.id,N=c.getState().map(q=>q.id),L={},j=Object.entries(i);for(const[q,U]of j)if(!(q==="chains"||q==="client"||q==="connectors"||q==="transports"))if(typeof U=="object")if(D in U)L[q]=U[D];else{if(N.some(F=>F in U))continue;L[q]=U}else L[q]=U;x=Bke({...L,chain:I,batch:L.batch??{multicall:!0},transport:q=>i.transports[D]({...q,connectors:u})})}return h.set(O,x),x}function _(){return{chainId:c.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let w;const b="0.0.0-canary-";E_.startsWith(b)?w=Number.parseInt(E_.replace(b,""),10):w=Number.parseInt(E_.split(".")[0]??"0",10);const E=eT(Gke(r?Yke(_,{migrate(C,O){if(O===w)return C;const I=_(),x=T(C,I.chainId);return{...I,chainId:x}},name:"store",partialize(C){return{connections:{__type:"Map",value:Array.from(C.connections.entries()).map(([O,I])=>{const{id:x,name:D,type:N,uid:L}=I.connector;return[O,{...I,connector:{id:x,name:D,type:N,uid:L}}]})},chainId:C.chainId,current:C.current}},merge(C,O){typeof C=="object"&&C&&"status"in C&&delete C.status;const I=T(C,O.chainId);return{...O,...C,chainId:I}},skipHydration:a,storage:r,version:w}):_));E.setState(_());function T(C,O){return C&&typeof C=="object"&&"chainId"in C&&typeof C.chainId=="number"&&c.getState().some(I=>I.id===C.chainId)?C.chainId:O}n&&E.subscribe(({connections:C,current:O})=>O?C.get(O)?.chainId:void 0,C=>{if(c.getState().some(I=>I.id===C))return E.setState(I=>({...I,chainId:C??I.chainId}))}),o?.subscribe(C=>{const O=new Set,I=new Set;for(const D of u.getState())if(O.add(D.id),D.rdns){const N=typeof D.rdns=="string"?[D.rdns]:D.rdns;for(const L of N)I.add(L)}const x=[];for(const D of C){if(I.has(D.info.rdns))continue;const N=d(f(D));O.has(N.id)||x.push(N)}r&&!E.persist.hasHydrated()||u.setState(D=>[...D,...x],!0)});function R(C){E.setState(O=>{const I=O.connections.get(C.uid);return I?{...O,connections:new Map(O.connections).set(C.uid,{accounts:C.accounts??I.accounts,chainId:C.chainId??I.chainId,connector:I.connector})}:O})}function P(C){E.getState().status==="connecting"||E.getState().status==="reconnecting"||E.setState(O=>{const I=u.getState().find(x=>x.uid===C.uid);return I?(I.emitter.listenerCount("connect")&&I.emitter.off("connect",R),I.emitter.listenerCount("change")||I.emitter.on("change",R),I.emitter.listenerCount("disconnect")||I.emitter.on("disconnect",A),{...O,connections:new Map(O.connections).set(C.uid,{accounts:C.accounts,chainId:C.chainId,connector:I}),current:C.uid,status:"connected"}):O})}function A(C){E.setState(O=>{const I=O.connections.get(C.uid);if(I){const D=I.connector;D.emitter.listenerCount("change")&&I.connector.emitter.off("change",R),D.emitter.listenerCount("disconnect")&&I.connector.emitter.off("disconnect",A),D.emitter.listenerCount("connect")||I.connector.emitter.on("connect",P)}if(O.connections.delete(C.uid),O.connections.size===0)return{...O,connections:new Map,current:null,status:"disconnected"};const x=O.connections.values().next().value;return{...O,connections:new Map(O.connections),current:x.connector.uid}})}return{get chains(){return c.getState()},get connectors(){return u.getState()},storage:r,getClient:m,get state(){return E.getState()},setState(C){let O;typeof C=="function"?O=C(E.getState()):O=C;const I=_();typeof O!="object"&&(O=I),Object.keys(I).some(D=>!(D in O))&&(O=I),E.setState(O,!0)},subscribe(C,O,I){return E.subscribe(C,O,I?{...I,fireImmediately:I.emitImmediately}:void 0)},_internal:{mipd:o,async revalidate(){const C=E.getState(),O=C.connections;let I=C.current;for(const[,x]of O){const D=x.connector;D.isAuthorized&&await D.isAuthorized()||(O.delete(D.uid),I===D.uid&&(I=null))}E.setState(x=>({...x,connections:O,current:I}))},store:E,ssr:!!a,syncConnectedChain:n,transports:i.transports,chains:{setState(C){const O=typeof C=="function"?C(c.getState()):C;if(O.length!==0)return c.setState(O,!0)},subscribe(C){return c.subscribe(C)}},connectors:{providerDetailToConnector:f,setup:d,setState(C){return u.setState(typeof C=="function"?C(u.getState()):C,!0)},subscribe(C){return u.subscribe(C)}},events:{change:R,connect:P,disconnect:A}}}}function owe(t,e){const{initialState:r,reconnectOnMount:n}=e;return r&&!t._internal.store.persist.hasHydrated()&&t.setState({...r,chainId:t.chains.some(a=>a.id===r.chainId)?r.chainId:t.chains[0].id,connections:n?r.connections:new Map,status:n?"reconnecting":"disconnected"}),{async onMount(){t._internal.ssr&&(await t._internal.store.persist.rehydrate(),t._internal.mipd&&t._internal.connectors.setState(a=>{const i=new Set;for(const u of a??[])if(u.rdns){const d=Array.isArray(u.rdns)?u.rdns:[u.rdns];for(const f of d)i.add(f)}const o=[],c=t._internal.mipd?.getProviders()??[];for(const u of c){if(i.has(u.info.rdns))continue;const d=t._internal.connectors.providerDetailToConnector(u),f=t._internal.connectors.setup(d);o.push(f)}return[...a,...o]})),n?qke(t):t.storage&&t.setState(a=>({...a,connections:new Map}))}}}const cwe={getItem(t){return typeof window>"u"?null:lwe(document.cookie,t)??null},setItem(t,e){typeof window>"u"||(document.cookie=`${t}=${e};path=/;samesite=Lax`)},removeItem(t){typeof window>"u"||(document.cookie=`${t}=;max-age=-1;path=/`)}};function lwe(t,e){const r=t.split("; ").find(n=>n.startsWith(`${e}=`));if(r)return r.substring(e.length+1)}function uwe(t){const{chain:e}=t,r=e.rpcUrls.default.http[0];if(!t.transports)return[r];const n=t.transports?.[e.id]?.({chain:e});return(n?.value?.transports||[n]).map(({value:i})=>i?.url||r)}function dwe(t){const{children:e,config:r,initialState:n,reconnectOnMount:a=!0}=t,{onMount:i}=owe(r,{initialState:n,reconnectOnMount:a});r._internal.ssr||i();const o=v.useRef(!0);return v.useEffect(()=>{if(o.current&&r._internal.ssr)return i(),()=>{o.current=!1}},[]),e}const fwe=v.createContext(void 0);function pwe(t){const{children:e,config:r}=t,n={value:r};return v.createElement(dwe,t,v.createElement(fwe.Provider,n,e))}var E0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},hwe={setTimeout:(t,e)=>setTimeout(t,e),clearTimeout:t=>clearTimeout(t),setInterval:(t,e)=>setInterval(t,e),clearInterval:t=>clearInterval(t)},mwe=class{#e=hwe;#t=!1;setTimeoutProvider(t){this.#e=t}setTimeout(t,e){return this.#e.setTimeout(t,e)}clearTimeout(t){this.#e.clearTimeout(t)}setInterval(t,e){return this.#e.setInterval(t,e)}clearInterval(t){this.#e.clearInterval(t)}},rx=new mwe;function gwe(t){setTimeout(t,0)}var T0=typeof window>"u"||"Deno"in globalThis;function Us(){}function ywe(t,e){return typeof t=="function"?t(e):t}function vwe(t){return typeof t=="number"&&t>=0&&t!==1/0}function _we(t,e){return Math.max(t+(e||0)-Date.now(),0)}function nx(t,e){return typeof t=="function"?t(e):t}function bwe(t,e){return typeof t=="function"?t(e):t}function zL(t,e){const{type:r="all",exact:n,fetchStatus:a,predicate:i,queryKey:o,stale:c}=t;if(o){if(n){if(e.queryHash!==JA(o,e.options))return!1}else if(!kg(e.queryKey,o))return!1}if(r!=="all"){const u=e.isActive();if(r==="active"&&!u||r==="inactive"&&u)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||a&&a!==e.state.fetchStatus||i&&!i(e))}function $L(t,e){const{exact:r,status:n,predicate:a,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(r){if(bg(e.options.mutationKey)!==bg(i))return!1}else if(!kg(e.options.mutationKey,i))return!1}return!(n&&e.state.status!==n||a&&!a(e))}function JA(t,e){return(e?.queryKeyHashFn||bg)(t)}function bg(t){return JSON.stringify(t,(e,r)=>ax(r)?Object.keys(r).sort().reduce((n,a)=>(n[a]=r[a],n),{}):r)}function kg(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(r=>kg(t[r],e[r])):!1}var kwe=Object.prototype.hasOwnProperty;function X6(t,e){if(t===e)return t;const r=VL(t)&&VL(e);if(!r&&!(ax(t)&&ax(e)))return e;const a=(r?t:Object.keys(t)).length,i=r?e:Object.keys(e),o=i.length,c=r?new Array(o):{};let u=0;for(let d=0;d<o;d++){const f=r?d:i[d],h=t[f],m=e[f];if(h===m){c[f]=h,(r?d<a:kwe.call(t,f))&&u++;continue}if(h===null||m===null||typeof h!="object"||typeof m!="object"){c[f]=m;continue}const _=X6(h,m);c[f]=_,_===h&&u++}return a===o&&u===a?t:c}function VL(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function ax(t){if(!HL(t))return!1;const e=t.constructor;if(e===void 0)return!0;const r=e.prototype;return!(!HL(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function HL(t){return Object.prototype.toString.call(t)==="[object Object]"}function wwe(t){return new Promise(e=>{rx.setTimeout(e,t)})}function Swe(t,e,r){return typeof r.structuralSharing=="function"?r.structuralSharing(t,e):r.structuralSharing!==!1?X6(t,e):e}function Ewe(t,e,r=0){const n=[...t,e];return r&&n.length>r?n.slice(1):n}function Twe(t,e,r=0){const n=[e,...t];return r&&n.length>r?n.slice(0,-1):n}var QA=Symbol();function J6(t,e){return!t.queryFn&&e?.initialPromise?()=>e.initialPromise:!t.queryFn||t.queryFn===QA?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Cwe=class extends E0{#e;#t;#r;constructor(){super(),this.#r=t=>{if(!T0&&window.addEventListener){const e=()=>t();return window.addEventListener("visibilitychange",e,!1),()=>{window.removeEventListener("visibilitychange",e)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#r=t,this.#t?.(),this.#t=t(e=>{typeof e=="boolean"?this.setFocused(e):this.onFocus()})}setFocused(t){this.#e!==t&&(this.#e=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(e=>{e(t)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},Q6=new Cwe;function xwe(){let t,e;const r=new Promise((a,i)=>{t=a,e=i});r.status="pending",r.catch(()=>{});function n(a){Object.assign(r,a),delete r.resolve,delete r.reject}return r.resolve=a=>{n({status:"fulfilled",value:a}),t(a)},r.reject=a=>{n({status:"rejected",reason:a}),e(a)},r}var Pwe=gwe;function Awe(){let t=[],e=0,r=c=>{c()},n=c=>{c()},a=Pwe;const i=c=>{e?t.push(c):a(()=>{r(c)})},o=()=>{const c=t;t=[],c.length&&a(()=>{n(()=>{c.forEach(u=>{r(u)})})})};return{batch:c=>{let u;e++;try{u=c()}finally{e--,e||o()}return u},batchCalls:c=>(...u)=>{i(()=>{c(...u)})},schedule:i,setNotifyFunction:c=>{r=c},setBatchNotifyFunction:c=>{n=c},setScheduler:c=>{a=c}}}var Ha=Awe(),Rwe=class extends E0{#e=!0;#t;#r;constructor(){super(),this.#r=t=>{if(!T0&&window.addEventListener){const e=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",e,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(t){this.#r=t,this.#t?.(),this.#t=t(this.setOnline.bind(this))}setOnline(t){this.#e!==t&&(this.#e=t,this.listeners.forEach(r=>{r(t)}))}isOnline(){return this.#e}},Tb=new Rwe;function Dwe(t){return Math.min(1e3*2**t,3e4)}function Z6(t){return(t??"online")==="online"?Tb.isOnline():!0}var ix=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function e$(t){let e=!1,r=0,n;const a=xwe(),i=()=>a.status!=="pending",o=b=>{if(!i()){const E=new ix(b);m(E),t.onCancel?.(E)}},c=()=>{e=!0},u=()=>{e=!1},d=()=>Q6.isFocused()&&(t.networkMode==="always"||Tb.isOnline())&&t.canRun(),f=()=>Z6(t.networkMode)&&t.canRun(),h=b=>{i()||(n?.(),a.resolve(b))},m=b=>{i()||(n?.(),a.reject(b))},_=()=>new Promise(b=>{n=E=>{(i()||d())&&b(E)},t.onPause?.()}).then(()=>{n=void 0,i()||t.onContinue?.()}),w=()=>{if(i())return;let b;const E=r===0?t.initialPromise:void 0;try{b=E??t.fn()}catch(T){b=Promise.reject(T)}Promise.resolve(b).then(h).catch(T=>{if(i())return;const R=t.retry??(T0?0:3),P=t.retryDelay??Dwe,A=typeof P=="function"?P(r,T):P,C=R===!0||typeof R=="number"&&r<R||typeof R=="function"&&R(r,T);if(e||!C){m(T);return}r++,t.onFail?.(r,T),wwe(A).then(()=>d()?void 0:_()).then(()=>{e?m(T):w()})})};return{promise:a,status:()=>a.status,cancel:o,continue:()=>(n?.(),a),cancelRetry:c,continueRetry:u,canStart:f,start:()=>(f()?w():_().then(w),a)}}var t$=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vwe(this.gcTime)&&(this.#e=rx.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(T0?1/0:300*1e3))}clearGcTimeout(){this.#e&&(rx.clearTimeout(this.#e),this.#e=void 0)}},Owe=class extends t${#e;#t;#r;#a;#n;#s;#o;constructor(t){super(),this.#o=!1,this.#s=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#a=t.client,this.#r=this.#a.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#e=GL(this.options),this.state=t.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#n?.promise}setOptions(t){if(this.options={...this.#s,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const e=GL(this.options);e.data!==void 0&&(this.setData(e.data,{updatedAt:e.dataUpdatedAt,manual:!0}),this.#e=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(t,e){const r=Swe(this.state.data,t,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:e?.updatedAt,manual:e?.manual}),r}setState(t,e){this.#i({type:"setState",state:t,setStateOptions:e})}cancel(t){const e=this.#n?.promise;return this.#n?.cancel(t),e?e.then(Us).catch(Us):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(t=>bwe(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===QA||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>nx(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!_we(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#n?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#n?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(e=>e!==t),this.observers.length||(this.#n&&(this.#o?this.#n.cancel({revert:!0}):this.#n.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(t,e){if(this.state.fetchStatus!=="idle"&&this.#n?.status()!=="rejected"){if(this.state.data!==void 0&&e?.cancelRefetch)this.cancel({silent:!0});else if(this.#n)return this.#n.continueRetry(),this.#n.promise}if(t&&this.setOptions(t),!this.options.queryFn){const c=this.observers.find(u=>u.options.queryFn);c&&this.setOptions(c.options)}const r=new AbortController,n=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(this.#o=!0,r.signal)})},a=()=>{const c=J6(this.options,e),d=(()=>{const f={client:this.#a,queryKey:this.queryKey,meta:this.meta};return n(f),f})();return this.#o=!1,this.options.persister?this.options.persister(c,d,this):c(d)},o=(()=>{const c={fetchOptions:e,options:this.options,queryKey:this.queryKey,client:this.#a,state:this.state,fetchFn:a};return n(c),c})();this.options.behavior?.onFetch(o,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#i({type:"fetch",meta:o.fetchOptions?.meta}),this.#n=e$({initialPromise:e?.initialPromise,fn:o.fetchFn,onCancel:c=>{c instanceof ix&&c.revert&&this.setState({...this.#t,fetchStatus:"idle"}),r.abort()},onFail:(c,u)=>{this.#i({type:"failed",failureCount:c,error:u})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const c=await this.#n.start();if(c===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(c),this.#r.config.onSuccess?.(c,this),this.#r.config.onSettled?.(c,this.state.error,this),c}catch(c){if(c instanceof ix){if(c.silent)return this.#n.promise;if(c.revert){if(this.state.data===void 0)throw c;return this.state.data}}throw this.#i({type:"error",error:c}),this.#r.config.onError?.(c,this),this.#r.config.onSettled?.(this.state.data,c,this),c}finally{this.scheduleGc()}}#i(t){const e=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Nwe(r.data,this.options),fetchMeta:t.meta??null};case"success":const n={...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=t.manual?n:void 0,n;case"error":const a=t.error;return{...r,error:a,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=e(this.state),Ha.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:t})})}};function Nwe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Z6(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function GL(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,r=e!==void 0,n=r?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}function WL(t){return{onFetch:(e,r)=>{const n=e.options,a=e.fetchOptions?.meta?.fetchMore?.direction,i=e.state.data?.pages||[],o=e.state.data?.pageParams||[];let c={pages:[],pageParams:[]},u=0;const d=async()=>{let f=!1;const h=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?f=!0:e.signal.addEventListener("abort",()=>{f=!0}),e.signal)})},m=J6(e.options,e.fetchOptions),_=async(w,b,E)=>{if(f)return Promise.reject();if(b==null&&w.pages.length)return Promise.resolve(w);const R=(()=>{const O={client:e.client,queryKey:e.queryKey,pageParam:b,direction:E?"backward":"forward",meta:e.options.meta};return h(O),O})(),P=await m(R),{maxPages:A}=e.options,C=E?Twe:Ewe;return{pages:C(w.pages,P,A),pageParams:C(w.pageParams,b,A)}};if(a&&i.length){const w=a==="backward",b=w?Iwe:KL,E={pages:i,pageParams:o},T=b(n,E);c=await _(E,T,w)}else{const w=t??i.length;do{const b=u===0?o[0]??n.initialPageParam:KL(n,c);if(u>0&&b==null)break;c=await _(c,b),u++}while(u<w)}return c};e.options.persister?e.fetchFn=()=>e.options.persister?.(d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},r):e.fetchFn=d}}}function KL(t,{pages:e,pageParams:r}){const n=e.length-1;return e.length>0?t.getNextPageParam(e[n],e,r[n],r):void 0}function Iwe(t,{pages:e,pageParams:r}){return e.length>0?t.getPreviousPageParam?.(e[0],e,r[0],r):void 0}var Mwe=class extends t${#e;#t;#r;#a;constructor(t){super(),this.#e=t.client,this.mutationId=t.mutationId,this.#r=t.mutationCache,this.#t=[],this.state=t.state||jwe(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){this.#t.includes(t)||(this.#t.push(t),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#t=this.#t.filter(e=>e!==t),this.scheduleGc(),this.#r.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#r.remove(this))}continue(){return this.#a?.continue()??this.execute(this.state.variables)}async execute(t){const e=()=>{this.#n({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#a=e$({fn:()=>this.options.mutationFn?this.options.mutationFn(t,r):Promise.reject(new Error("No mutationFn found")),onFail:(i,o)=>{this.#n({type:"failed",failureCount:i,error:o})},onPause:()=>{this.#n({type:"pause"})},onContinue:e,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#r.canRun(this)});const n=this.state.status==="pending",a=!this.#a.canStart();try{if(n)e();else{this.#n({type:"pending",variables:t,isPaused:a}),await this.#r.config.onMutate?.(t,this,r);const o=await this.options.onMutate?.(t,r);o!==this.state.context&&this.#n({type:"pending",context:o,variables:t,isPaused:a})}const i=await this.#a.start();return await this.#r.config.onSuccess?.(i,t,this.state.context,this,r),await this.options.onSuccess?.(i,t,this.state.context,r),await this.#r.config.onSettled?.(i,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(i,null,t,this.state.context,r),this.#n({type:"success",data:i}),i}catch(i){try{throw await this.#r.config.onError?.(i,t,this.state.context,this,r),await this.options.onError?.(i,t,this.state.context,r),await this.#r.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,i,t,this.state.context,r),i}finally{this.#n({type:"error",error:i})}}finally{this.#r.runNext(this)}}#n(t){const e=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=e(this.state),Ha.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(t)}),this.#r.notify({mutation:this,type:"updated",action:t})})}};function jwe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Lwe=class extends E0{constructor(t={}){super(),this.config=t,this.#e=new Set,this.#t=new Map,this.#r=0}#e;#t;#r;build(t,e,r){const n=new Mwe({client:t,mutationCache:this,mutationId:++this.#r,options:t.defaultMutationOptions(e),state:r});return this.add(n),n}add(t){this.#e.add(t);const e=Nv(t);if(typeof e=="string"){const r=this.#t.get(e);r?r.push(t):this.#t.set(e,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#e.delete(t)){const e=Nv(t);if(typeof e=="string"){const r=this.#t.get(e);if(r)if(r.length>1){const n=r.indexOf(t);n!==-1&&r.splice(n,1)}else r[0]===t&&this.#t.delete(e)}}this.notify({type:"removed",mutation:t})}canRun(t){const e=Nv(t);if(typeof e=="string"){const n=this.#t.get(e)?.find(a=>a.state.status==="pending");return!n||n===t}else return!0}runNext(t){const e=Nv(t);return typeof e=="string"?this.#t.get(e)?.find(n=>n!==t&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ha.batch(()=>{this.#e.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(t){const e={exact:!0,...t};return this.getAll().find(r=>$L(e,r))}findAll(t={}){return this.getAll().filter(e=>$L(t,e))}notify(t){Ha.batch(()=>{this.listeners.forEach(e=>{e(t)})})}resumePausedMutations(){const t=this.getAll().filter(e=>e.state.isPaused);return Ha.batch(()=>Promise.all(t.map(e=>e.continue().catch(Us))))}};function Nv(t){return t.options.scope?.id}var Bwe=class extends E0{constructor(t={}){super(),this.config=t,this.#e=new Map}#e;build(t,e,r){const n=e.queryKey,a=e.queryHash??JA(n,e);let i=this.get(a);return i||(i=new Owe({client:t,queryKey:n,queryHash:a,options:t.defaultQueryOptions(e),state:r,defaultOptions:t.getQueryDefaults(n)}),this.add(i)),i}add(t){this.#e.has(t.queryHash)||(this.#e.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const e=this.#e.get(t.queryHash);e&&(t.destroy(),e===t&&this.#e.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Ha.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#e.get(t)}getAll(){return[...this.#e.values()]}find(t){const e={exact:!0,...t};return this.getAll().find(r=>zL(e,r))}findAll(t={}){const e=this.getAll();return Object.keys(t).length>0?e.filter(r=>zL(t,r)):e}notify(t){Ha.batch(()=>{this.listeners.forEach(e=>{e(t)})})}onFocus(){Ha.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Ha.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Uwe=class{#e;#t;#r;#a;#n;#s;#o;#i;constructor(t={}){this.#e=t.queryCache||new Bwe,this.#t=t.mutationCache||new Lwe,this.#r=t.defaultOptions||{},this.#a=new Map,this.#n=new Map,this.#s=0}mount(){this.#s++,this.#s===1&&(this.#o=Q6.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=Tb.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#s--,this.#s===0&&(this.#o?.(),this.#o=void 0,this.#i?.(),this.#i=void 0)}isFetching(t){return this.#e.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#t.findAll({...t,status:"pending"}).length}getQueryData(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),r=this.#e.build(this,e),n=r.state.data;return n===void 0?this.fetchQuery(t):(t.revalidateIfStale&&r.isStaleByTime(nx(e.staleTime,r))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(t){return this.#e.findAll(t).map(({queryKey:e,state:r})=>{const n=r.data;return[e,n]})}setQueryData(t,e,r){const n=this.defaultQueryOptions({queryKey:t}),i=this.#e.get(n.queryHash)?.state.data,o=ywe(e,i);if(o!==void 0)return this.#e.build(this,n).setData(o,{...r,manual:!0})}setQueriesData(t,e,r){return Ha.batch(()=>this.#e.findAll(t).map(({queryKey:n})=>[n,this.setQueryData(n,e,r)]))}getQueryState(t){const e=this.defaultQueryOptions({queryKey:t});return this.#e.get(e.queryHash)?.state}removeQueries(t){const e=this.#e;Ha.batch(()=>{e.findAll(t).forEach(r=>{e.remove(r)})})}resetQueries(t,e){const r=this.#e;return Ha.batch(()=>(r.findAll(t).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const r={revert:!0,...e},n=Ha.batch(()=>this.#e.findAll(t).map(a=>a.cancel(r)));return Promise.all(n).then(Us).catch(Us)}invalidateQueries(t,e={}){return Ha.batch(()=>(this.#e.findAll(t).forEach(r=>{r.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},e)))}refetchQueries(t,e={}){const r={...e,cancelRefetch:e.cancelRefetch??!0},n=Ha.batch(()=>this.#e.findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let i=a.fetch(void 0,r);return r.throwOnError||(i=i.catch(Us)),a.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(n).then(Us)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const r=this.#e.build(this,e);return r.isStaleByTime(nx(e.staleTime,r))?r.fetch(e):Promise.resolve(r.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Us).catch(Us)}fetchInfiniteQuery(t){return t.behavior=WL(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Us).catch(Us)}ensureInfiniteQueryData(t){return t.behavior=WL(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Tb.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#r}setDefaultOptions(t){this.#r=t}setQueryDefaults(t,e){this.#a.set(bg(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...this.#a.values()],r={};return e.forEach(n=>{kg(t,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(t,e){this.#n.set(bg(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...this.#n.values()],r={};return e.forEach(n=>{kg(t,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(t){if(t._defaulted)return t;const e={...this.#r.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=JA(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===QA&&(e.enabled=!1),e}defaultMutationOptions(t){return t?._defaulted?t:{...this.#r.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Fwe=v.createContext(void 0),qwe=({client:t,children:e})=>(v.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),g.jsx(Fwe.Provider,{value:t,children:e}));const r$=$6({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),n$=$6({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});ZA.type="walletConnect";function ZA(t){const e=t.isNewChainsStale??!0;let r,n;const a="eip155";let i,o,c,u,d,f;return h=>({id:"walletConnect",name:"WalletConnect",type:ZA.type,async setup(){const m=await this.getProvider().catch(()=>null);m&&(c||(c=this.onConnect.bind(this),m.on("connect",c)),d||(d=this.onSessionDelete.bind(this),m.on("session_delete",d)))},async connect({chainId:m,withCapabilities:_,...w}={}){try{const b=await this.getProvider();if(!b)throw new Rl;u||(u=this.onDisplayUri,b.on("display_uri",u));let E=m;if(!E){const A=await h.storage?.getItem("state")??{};h.chains.some(O=>O.id===A.chainId)?E=A.chainId:E=h.chains[0]?.id}if(!E)throw new Error("No chains found on connector.");const T=await this.isChainsStale();if(b.session&&T&&await b.disconnect(),!b.session||T){const A=h.chains.filter(C=>C.id!==E).map(C=>C.id);await b.connect({optionalChains:[E,...A],..."pairingTopic"in w?{pairingTopic:w.pairingTopic}:{}}),this.setRequestedChainsIds(h.chains.map(C=>C.id))}const R=(await b.enable()).map(A=>Xu(A));let P=await this.getChainId();return m&&P!==m&&(P=(await this.switchChain({chainId:m}).catch(C=>{if(C.code===na.code&&C.cause?.message!=="Missing or invalid. request() method: wallet_addEthereumChain")throw C;return{id:P}}))?.id??P),u&&(b.removeListener("display_uri",u),u=void 0),c&&(b.removeListener("connect",c),c=void 0),i||(i=this.onAccountsChanged.bind(this),b.on("accountsChanged",i)),o||(o=this.onChainChanged.bind(this),b.on("chainChanged",o)),f||(f=this.onDisconnect.bind(this),b.on("disconnect",f)),d||(d=this.onSessionDelete.bind(this),b.on("session_delete",d)),{accounts:_?R.map(A=>({address:A,capabilities:{}})):R,chainId:P}}catch(b){throw/(user rejected|connection request reset)/i.test(b?.message)?new na(b):b}},async disconnect(){const m=await this.getProvider();try{await m?.disconnect()}catch(_){if(!/No matching key/i.test(_.message))throw _}finally{o&&(m?.removeListener("chainChanged",o),o=void 0),f&&(m?.removeListener("disconnect",f),f=void 0),c||(c=this.onConnect.bind(this),m?.on("connect",c)),i&&(m?.removeListener("accountsChanged",i),i=void 0),d&&(m?.removeListener("session_delete",d),d=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(_=>Xu(_))},async getProvider({chainId:m}={}){async function _(){const w=h.chains.map(E=>E.id);if(!w.length)return;const{EthereumProvider:b}=await qr(async()=>{const{EthereumProvider:E}=await import("./index.es-DDE-Wycf.js").then(T=>T.Y);return{EthereumProvider:E}},[],import.meta.url);return await b.init({...t,disableProviderPing:!0,optionalChains:w,projectId:t.projectId,rpcMap:Object.fromEntries(h.chains.map(E=>{const[T]=uwe({chain:E,transports:h.transports});return[E.id,T]})),showQrModal:t.showQrModal??!0})}return r||(n||(n=_()),r=await n,r?.events.setMaxListeners(Number.POSITIVE_INFINITY)),m&&await this.switchChain?.({chainId:m}),r},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[m,_]=await Promise.all([this.getAccounts(),this.getProvider()]);return m.length?await this.isChainsStale()&&_.session?(await _.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:m,chainId:_}){const w=await this.getProvider();if(!w)throw new Rl;const b=h.chains.find(E=>E.id===_);if(!b)throw new su(new Eb);try{await Promise.all([new Promise(T=>{const R=({chainId:P})=>{P===_&&(h.emitter.off("change",R),T())};h.emitter.on("change",R)}),w.request({method:"wallet_switchEthereumChain",params:[{chainId:mp(_)}]})]);const E=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...E,_]),b}catch(E){const T=E;if(/(user rejected)/i.test(T.message))throw new na(T);try{let R;m?.blockExplorerUrls?R=m.blockExplorerUrls:R=b.blockExplorers?.default.url?[b.blockExplorers?.default.url]:[];let P;m?.rpcUrls?.length?P=m.rpcUrls:P=[...b.rpcUrls.default.http];const A={blockExplorerUrls:R,chainId:mp(_),chainName:m?.chainName??b.name,iconUrls:m?.iconUrls,nativeCurrency:m?.nativeCurrency??b.nativeCurrency,rpcUrls:P};await w.request({method:"wallet_addEthereumChain",params:[A]});const C=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...C,_]),b}catch(R){throw new na(R)}}},onAccountsChanged(m){m.length===0?this.onDisconnect():h.emitter.emit("change",{accounts:m.map(_=>Xu(_))})},onChainChanged(m){const _=Number(m);h.emitter.emit("change",{chainId:_})},async onConnect(m){const _=Number(m.chainId),w=await this.getAccounts();h.emitter.emit("connect",{accounts:w,chainId:_})},async onDisconnect(m){this.setRequestedChainsIds([]),h.emitter.emit("disconnect");const _=await this.getProvider();i&&(_.removeListener("accountsChanged",i),i=void 0),o&&(_.removeListener("chainChanged",o),o=void 0),f&&(_.removeListener("disconnect",f),f=void 0),d&&(_.removeListener("session_delete",d),d=void 0),c||(c=this.onConnect.bind(this),_.on("connect",c))},onDisplayUri(m){h.emitter.emit("message",{type:"display_uri",data:m})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){return r?r.session?.namespaces[a]?.accounts?.map(_=>Number.parseInt(_.split(":")[1]||"",10))??[]:[]},async getRequestedChainsIds(){return await h.storage?.getItem(this.requestedChainsStorageKey)??[]},async isChainsStale(){if(!e)return!1;const m=h.chains.map(b=>b.id),_=this.getNamespaceChainsIds();if(_.length&&!_.some(b=>m.includes(b)))return!1;const w=await this.getRequestedChainsIds();return!m.every(b=>w.includes(b))},async setRequestedChainsIds(m){await h.storage?.setItem(this.requestedChainsStorageKey,m)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var zwe={};const $we=[r$,n$],Vwe=new Uwe,Hwe=K6({storage:cwe});function Gwe(){const t=!!(import.meta.vitest||typeof process<"u"&&zwe?.VITEST_WORKER_ID),e=[S0({shimDisconnect:!0})];if(!t)try{e.push(ZA({projectId:"demo",showQrModal:!0}))}catch{}return swe({chains:$we,multiInjectedProviderDiscovery:!0,transports:{[r$.id]:LL(),[n$.id]:LL()},connectors:e,ssr:!1,storage:Hwe,syncConnectedChain:!0})}function Wwe({children:t}){const e=Gwe();return g.jsx(pwe,{config:e,children:g.jsx(qwe,{client:Vwe,children:t})})}v.createContext(void 0);const a$=v.createContext(void 0);async function Kwe(){try{const t=new AbortController,e=setTimeout(()=>t.abort(),5e3),r=await fetch("/api/features",{cache:"no-store",signal:t.signal});return clearTimeout(e),r.ok?await r.json():null}catch{return null}}function Ywe({children:t}){const[e,r]=v.useState(!1),[n,a]=v.useState(!1),i=async()=>{const o=await Kwe();a(!!o?.features?.wallet),r(!0)};return v.useEffect(()=>{const o=i(),c=window.setTimeout(()=>{r(u=>!0)},6e3);return o.finally(()=>clearTimeout(c)),()=>clearTimeout(c)},[]),g.jsx(a$.Provider,{value:{loaded:e,walletEnabled:n,refresh:i},children:t})}function Xwe(){return v.useContext(a$)??{loaded:!0,walletEnabled:!1,refresh:()=>{}}}const rT=to("SafeArea",{web:()=>qr(()=>import("./web-ovdpeLy1.js"),[],import.meta.url).then(t=>new t.SafeAreaWeb)});function Iv(t){var e;typeof document<"u"&&((e=document.querySelector(":root"))===null||e===void 0||e.style.setProperty(`--safe-area-inset-${t}`,`max(env(safe-area-inset-${t}), 0px)`))}function Jwe(){Iv("top"),Iv("left"),Iv("bottom"),Iv("right")}Jwe();class i$ extends Tt.Component{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,r){this.props.onError?.(e,r)}handleReset=()=>{this.setState({hasError:!1,error:void 0}),this.props.onReset?.()};render(){return this.state.hasError?this.props.fallback?g.jsx(g.Fragment,{children:this.props.fallback}):g.jsxs("div",{className:"error-boundary",role:"alert",style:{padding:16},children:[g.jsx("h2",{children:"Something went wrong"}),g.jsx("p",{children:"Please refresh or return to the previous screen."}),g.jsx("button",{className:"felt-btn",onClick:this.handleReset,children:"Try again"})]}):this.props.children}}var YL;(function(t){t[t.Sunday=1]="Sunday",t[t.Monday=2]="Monday",t[t.Tuesday=3]="Tuesday",t[t.Wednesday=4]="Wednesday",t[t.Thursday=5]="Thursday",t[t.Friday=6]="Friday",t[t.Saturday=7]="Saturday"})(YL||(YL={}));const nT=to("LocalNotifications",{web:()=>qr(()=>import("./web-CfCiU7ol.js"),[],import.meta.url).then(t=>new t.LocalNotificationsWeb)}),ff=to("PushNotifications",{}),Qwe={};let XL=!1;async function Zwe(t={}){if(XL||(XL=!0,!(Gr.getPlatform()==="ios"||Gr.getPlatform()==="android")))return;const r=t.enableLocal!==!1,n=t.enablePush??Qwe?.VITE_ENABLE_PUSH==="1";if(r)try{await eSe()}catch{}if(n)try{await tSe(t.onPushToken)}catch{}}async function eSe(){try{if((await nT.requestPermissions()).display!=="granted")return}catch{}try{await nT.createChannel?.({id:"default",name:"General",description:"General notifications",importance:4,visibility:1,sound:void 0,lights:!0,vibration:!0})}catch{}try{nT.addListener("localNotificationActionPerformed",t=>{})}catch{}}async function tSe(t){try{if((await ff.requestPermissions()).receive!=="granted")return}catch{return}try{await ff.register()}catch{}ff.addListener("registration",e=>{try{t?.(e.value)}catch{}}),ff.addListener("registrationError",e=>{}),ff.addListener("pushNotificationReceived",e=>{}),ff.addListener("pushNotificationActionPerformed",e=>{})}function rSe({cooldownMs:t=5e3,initialGraceMs:e=900}){const r=ks(),{room:n}=Mi(),a=v.useRef(0),i=v.useRef(!1),o=v.useRef(!1),c=v.useRef(Date.now());return v.useEffect(()=>{(()=>{try{return typeof window<"u"&&window.location.search.includes("debugForeground=1")||typeof localStorage<"u"&&localStorage.getItem("debug:foreground")==="1"}catch{return!1}})();const u=Date.now();try{window.__fgMountedAt=u}catch{}},[]),v.useEffect(()=>{let u=[],d=!1;const f=(()=>{try{return typeof window<"u"&&window.location.search.includes("debugForeground=1")||typeof localStorage<"u"&&localStorage.getItem("debug:foreground")==="1"}catch{return!1}})(),h=async(T,R=!1)=>{if(d)return;const P=Date.now();if(!(!R&&P-c.current<e)&&!i.current&&!(!R&&P-a.current<t)){i.current=!0;try{const A=n?.id||void 0;if(r)if(f)try{const C=await yT(r,St.BOTS_NUDGE,{roomId:A},{timeoutMs:5e3});try{window.__fgLastAck=C}catch{}}catch{}else await eB(r,St.BOTS_NUDGE,{roomId:A});a.current=P}catch{}finally{i.current=!1}}},m=async(T,R=!1)=>{if(d)return;const P=Date.now();if(!(!R&&P-c.current<e)&&!o.current){if(o.current=!0,!R&&P-a.current<t){o.current=!1;return}try{const A=n?.id||void 0;if(!r)return;try{await am(r)}catch{}try{(await yT(r,St.ROOM_REFRESH_STATE,{roomId:A},{timeoutMs:5e3}))?.ok,a.current=P}catch{}}catch{}finally{o.current=!1}}};try{window.__fgNudge=(T,R)=>{h(T||"manual",!!R)}}catch{}(async()=>{try{const T=await Lo.addListener("appStateChange",R=>{if(!d)if(R.isActive)(async()=>{try{await am(r)}catch{}h("native_appstate_active",!0),m("native_appstate_active")})();else try{Qu(r,"BotNudgeOnForeground: appStateChange inactive")}catch{}});try{window.__fgAppStateListener=!0}catch{}u.push(()=>{try{T.remove()}catch{}})}catch{}})(),(async()=>{try{const T=await Lo.addListener("pause",()=>{try{window?.Capacitor?.isNativePlatform&&Qu(r,"BotNudgeOnForeground: pause event")}catch{}});try{window.__fgPauseListener=!0}catch{}u.push(()=>{try{T.remove()}catch{}})}catch{}})(),(async()=>{try{const T=await Lo.addListener("resume",async()=>{try{await am(r)}catch{}h("native_resume",!0),m("native_resume")});try{window.__fgResumeListener=!0}catch{}u.push(()=>{try{T.remove()}catch{}})}catch{}})();const _=()=>{d||document.visibilityState==="visible"&&(h(),m())};document.addEventListener("visibilitychange",_),u.push(()=>document.removeEventListener("visibilitychange",_));const w=()=>{d||(h(),m())},b=()=>{d||(h(),m())};window.addEventListener("focus",w),window.addEventListener("pageshow",b),u.push(()=>{window.removeEventListener("focus",w),window.removeEventListener("pageshow",b)});const E=setTimeout(()=>{h(),m()},2500);return u.push(()=>clearTimeout(E)),()=>{d=!0,u.forEach(T=>{try{T()}catch{}})}},[r,n?.id,t]),null}function nSe(){const[t,e]=v.useState(()=>{try{return window.localStorage?.getItem("sfxDebug")==="1"}catch{return!1}}),[r,n]=v.useState([]),a=200,i=v.useRef(null);if(v.useEffect(()=>{if(!t)return;const c=u=>{try{const d=u.detail;n(f=>{const h=[...f,d];return h.length>a&&h.splice(0,h.length-a),h})}catch{}};return window.addEventListener("sfx:debug",c),()=>window.removeEventListener("sfx:debug",c)},[t]),!t)return null;const o=v.useMemo(()=>r.map(c=>{const d=[new Date(c.t||Date.now()).toLocaleTimeString(),c.kind];return c.key&&d.push(c.key),c.volume!=null&&d.push(`v=${c.volume}`),c.rate!=null&&d.push(`r=${c.rate}`),c.reason&&d.push(`(${c.reason})`),d.join(" ")}),[r]);return v.useEffect(()=>{try{i.current?.scrollTo({top:i.current.scrollHeight})}catch{}},[o.length]),g.jsxs("div",{style:{position:"fixed",right:8,bottom:8,width:360,maxHeight:240,zIndex:99999,background:"rgba(0,0,0,0.7)",color:"#fff",borderRadius:6,border:"1px solid rgba(255,255,255,0.2)",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"6px 8px",borderBottom:"1px solid rgba(255,255,255,0.15)"},children:[g.jsx("strong",{style:{fontSize:12,letterSpacing:.3},children:"SFX Debug"}),g.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:6},children:[g.jsx("button",{className:"btn btn-xxs",onClick:()=>n([]),children:"Clear"}),g.jsx("button",{className:"btn btn-xxs",onClick:()=>{e(!1);try{localStorage.removeItem("sfxDebug")}catch{}},children:"Close"})]})]}),g.jsx("div",{ref:i,style:{maxHeight:196,overflow:"auto",padding:"6px 8px",fontFamily:"monospace",fontSize:11,lineHeight:1.35},children:o.map((c,u)=>g.jsx("div",{children:c},u))})]})}function aSe(){const[t,e]=v.useState(()=>{try{const u=new URL(window.location.href).searchParams.get("rtcDebug")==="1",d=window.localStorage?.getItem("rtcDebug")==="1",f=window.__RTC_DEBUG__===!0;return u||d||f}catch{return!1}}),[r,n]=v.useState(()=>{try{return l4().filter(c=>c?.tag==="RTC")}catch{return[]}}),a=400,i=v.useRef(null);if(v.useEffect(()=>{const c=d=>{d.key==="rtcDebug"&&e(d.newValue==="1")};window.addEventListener("storage",c),window.rtcDebugOpen=()=>e(!0),window.rtcDebugClose=()=>e(!1);const u=()=>{try{new URL(window.location.href).searchParams.get("rtcDebug")==="1"&&e(!0)}catch{}};return window.addEventListener("popstate",u),()=>{window.removeEventListener("storage",c),window.removeEventListener("popstate",u);try{delete window.rtcDebugOpen,delete window.rtcDebugClose}catch{}}},[]),v.useEffect(()=>{if(!t)return;const c=u=>{try{const d=u.detail;if(!d||d.tag!=="RTC")return;n(f=>{const h=[...f,d];return h.length>a&&h.splice(0,h.length-a),h})}catch{}};return window.addEventListener("fe:log",c),()=>window.removeEventListener("fe:log",c)},[t]),!t)return null;const o=v.useMemo(()=>r.map(c=>{const u=new Date(c.t||Date.now()).toLocaleTimeString(),d=c.level?.toUpperCase?.()||"LOG",f=c.msg||"",h=c.data?JSON.stringify(c.data):"";return`${u} ${d} ${f} ${h}`}),[r]);return v.useEffect(()=>{try{i.current?.scrollTo({top:i.current.scrollHeight})}catch{}},[o.length]),g.jsxs("div",{style:{position:"fixed",left:8,bottom:8,width:420,maxHeight:260,zIndex:99998,background:"rgba(0,0,0,0.72)",color:"#fff",borderRadius:6,border:"1px solid rgba(255,255,255,0.2)",boxShadow:"0 2px 8px rgba(0,0,0,0.3)"},children:[g.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"6px 8px",borderBottom:"1px solid rgba(255,255,255,0.15)"},children:[g.jsx("strong",{style:{fontSize:12,letterSpacing:.3},children:"RTC Debug"}),g.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:6},children:[g.jsx("button",{className:"btn btn-xxs",onClick:()=>n([]),children:"Clear"}),g.jsx("button",{className:"btn btn-xxs",onClick:()=>{try{navigator.clipboard.writeText(JSON.stringify(r,null,2))}catch{}},children:"Copy"}),g.jsx("button",{className:"btn btn-xxs",onClick:()=>{e(!1);try{localStorage.removeItem("rtcDebug"),window.__RTC_DEBUG__=!1}catch{}},children:"Close"})]})]}),g.jsx("div",{ref:i,style:{maxHeight:212,overflow:"auto",padding:"6px 8px",fontFamily:"monospace",fontSize:11,lineHeight:1.35},children:o.map((c,u)=>g.jsx("div",{children:c},u))})]})}function iSe(){const{meId:t}=$r(),e=tn(),r=yi(),{info:n,onIdle:a}=Es(),{room:i,setRoom:o}=Mi(),{leaveRoom:c}=mu(),u=Tt.useRef(!1);return Tt.useEffect(()=>{const d=r.pathname||"";/^\/(room|poker\/room)\//.test(d)||(u.current=!1)},[r.pathname]),Pa({onPlayerBalanceUpdated:({playerId:d,balance:f})=>{if(!(!t||d!==t)&&typeof f=="number"&&!(f>0)&&!u.current){u.current=!0;try{i?.id&&typeof c=="function"&&c(i.id)}catch{}try{o?.(null)}catch{}try{n("Out of Chips","Returning to Lobby…")}catch{}try{e("/lobby",{replace:!0})}catch{}}}}),null}function sSe(t){switch(t){case"cee-lo":return"Cee-Lo";case"craps":return"Craps";case"poker":return"Poker";default:return t}}function oSe(t,e){switch(t){case"cee-lo":return`/room/${e}`;case"craps":return`/room/${e}`;case"poker":return`/poker/room/${e}`;default:return`/room/${e}`}}function cSe(){const t=k6(),e=tn(),r=v.useRef(null),n=t?.currentInvite;if(v.useEffect(()=>{if(!n)return;const c=d=>{d.key==="Escape"&&t?.dismissCurrentInvite()},u=d=>{r.current&&!r.current.contains(d.target)&&t?.dismissCurrentInvite()};return document.addEventListener("keydown",c),document.addEventListener("mousedown",u),()=>{document.removeEventListener("keydown",c),document.removeEventListener("mousedown",u)}},[n,t]),!n)return null;const a=async()=>{const c=await t?.acceptInvite(n.inviteId);if(c?.ok&&c.roomId){const u=oSe(n.gameMode,c.roomId);e(u)}},i=()=>{t?.declineInvite(n.inviteId)},o=g.jsx("div",{className:"modal-backdrop",role:"presentation",style:{position:"fixed",inset:0,zIndex:99999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.7)",backdropFilter:"blur(4px)"},children:g.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Game invite",ref:r,style:{maxWidth:340,position:"relative",background:"linear-gradient(135deg, #1a1a2e 0%, #16213e 100%)",borderRadius:12,padding:"24px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.5)",border:"1px solid rgba(255, 215, 0, 0.2)"},children:[g.jsx("button",{className:"modal-close",onClick:i,"aria-label":"Close",style:{position:"absolute",top:8,right:8,background:"none",border:"none",color:"#fff",fontSize:"1.5rem",cursor:"pointer",opacity:.7},children:"×"}),g.jsx("h3",{className:"modal-title",style:{marginBottom:12,textAlign:"center",color:"#fff"},children:"🎲 Game Invite"}),g.jsxs("div",{style:{textAlign:"center",marginBottom:16,color:"#fff"},children:[g.jsxs("p",{style:{fontSize:"1rem",margin:"8px 0"},children:[g.jsx("strong",{children:n.fromUserName})," has invited you to play"]}),g.jsx("p",{style:{fontSize:"1.25rem",fontWeight:600,color:"var(--gold, #ffc107)",margin:"8px 0"},children:sSe(n.gameMode)}),g.jsxs("p",{style:{fontSize:"0.875rem",opacity:.8,margin:"4px 0"},children:["Room: ",n.roomName]})]}),g.jsxs("div",{style:{display:"flex",gap:12,marginTop:20,justifyContent:"center"},children:[g.jsx("button",{className:"felt-btn btn--ghost",onClick:i,style:{minWidth:100},children:"Decline"}),g.jsx("button",{className:"felt-btn felt-btn--primary",onClick:a,style:{minWidth:100},children:"Join Game"})]})]})});return Gc.createPortal(o,document.body)}function lSe(){const t=ks(),e=v.useRef(0);return v.useEffect(()=>{let r;const n=()=>{try{const a=Vv(),i=a.length?a[a.length-1].ts:0,o=Date.now();if(!t.connected&&o-i>2e4&&o-e.current>1e4){e.current=o;try{t.disconnected&&t.connect()}catch{}}}catch{}r=setTimeout(n,2e3),r.unref?.()};return n(),()=>clearTimeout(r)},[t]),null}try{const t=Gr.getPlatform();if((t==="ios"||t==="android")&&(Promise.resolve(rT.enable?.({config:{customColorsForSystemBars:!0,statusBarColor:"#00000000",statusBarContent:"light",navigationBarColor:"#00000000",navigationBarContent:"light"}})).catch(()=>{}),Ip().catch(e=>{})),t==="ios"||t==="android"){let e=0,r=0;const n=async()=>{try{const i=await rT.getSafeAreaInsets?.(),o=Math.round(i?.insets?.top??i?.top??0),c=Math.round(i?.insets?.bottom??i?.bottom??0),u=window.innerHeight>window.innerWidth;u&&o>0&&(e=o),u&&c>0&&(r=c);const d=u?o>0?o:e:o,f=u?c>0?c:r:c,h=document.documentElement;h.style.setProperty("--safe-top-global",`${d}px`),h.style.setProperty("--safe-bottom",`${f}px`),h.style.transform="translateZ(0)",requestAnimationFrame(()=>{h.style.transform=""})}catch{const i=document.documentElement;i.style.transform="translateZ(0)",requestAnimationFrame(()=>{i.style.transform=""})}};n();const a=()=>{setTimeout(n,50),setTimeout(n,150),setTimeout(n,300),setTimeout(n,500)};window.addEventListener("orientationchange",a),window.addEventListener("resize",n);try{rT.addListener?.("safeAreaChanged",n)}catch{}if(t==="ios")try{document.documentElement.classList.add("is-native-app","platform-ios"),document.body.classList.add("is-native-app","platform-ios")}catch{}}}catch{}if(Gr.getPlatform()==="android"){const e=()=>{let r=24;const n=window.visualViewport;if(n&&typeof window.innerHeight=="number"){const a=Math.max(0,Math.round(window.innerHeight-(n.height+n.offsetTop)));a>0&&a<64&&(r=a)}document.documentElement.style.setProperty("--android-safe-area-bottom",`${r}px`),document.documentElement.style.setProperty("--android-extra-bottom","24px")};e(),window.addEventListener("resize",e),window.addEventListener("orientationchange",()=>setTimeout(e,100));try{document.documentElement.classList.add("is-native-app","platform-android"),document.body.classList.add("is-native-app","platform-android")}catch{}}function uSe(){const{loaded:t,walletEnabled:e}=Xwe(),r=tn(),n=yi(),a=v.useRef(null),i=v.useRef(Date.now());return v.useEffect(()=>{const u=()=>{a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{n.pathname!=="/lobby"&&r("/lobby",{replace:!0})},24e4)},d=()=>{i.current=Date.now(),u()};u();const f=()=>d(),h=()=>d(),m=()=>{document.visibilityState==="visible"&&d()};return window.addEventListener("pointerdown",f,{capture:!0}),window.addEventListener("keydown",h,{capture:!0}),document.addEventListener("visibilitychange",m),()=>{a.current&&window.clearTimeout(a.current),window.removeEventListener("pointerdown",f,{capture:!0}),window.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("visibilitychange",m)}},[r,n.pathname]),t?(c=>e?g.jsx(Wwe,{children:c}):g.jsx(g.Fragment,{children:c}))(g.jsx(J9,{children:g.jsx($re,{children:g.jsxs(A_e,{children:[g.jsx(L0e,{}),g.jsx(zG,{children:g.jsx(ine,{children:g.jsxs(Y9,{children:[g.jsx(U0e,{}),g.jsx(Tfe,{children:g.jsx(gfe,{children:g.jsx(j_e,{children:g.jsx(obe,{children:g.jsx(mbe,{children:g.jsx(xfe,{children:g.jsx(eG,{children:g.jsxs(i$,{children:[g.jsx(N0e,{}),g.jsx(cSe,{}),g.jsx(iSe,{}),g.jsx(rSe,{}),g.jsx(nSe,{}),g.jsx(aSe,{}),g.jsx(lSe,{})]})})})})})})})})]})})})]})})})):g.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[g.jsx(ji,{className:"page-home-screen"}),g.jsx("div",{className:"home-preloader",children:g.jsx("div",{className:"home-preloader__spinner"})})]})}function dSe(){return v.useEffect(()=>{const t={current:null};return t.current=()=>{try{Xr()}catch{}t.current&&(window.removeEventListener("pointerdown",t.current,{capture:!0}),t.current=null)},window.addEventListener("pointerdown",t.current,{capture:!0}),()=>{t.current&&(window.removeEventListener("pointerdown",t.current,{capture:!0}),t.current=null)}},[]),v.useEffect(()=>{try{Zwe()}catch{}},[]),g.jsx($9,{children:g.jsx(m7,{children:g.jsx(Ywe,{children:g.jsx(uSe,{})})})})}function fSe(t){const e=t?.healthIntervalMs??8e3,r=t?.maxRetriesPerPlay??3;t?.debug;const[n,a]=v.useState(!1),[i,o]=v.useState(!1),[c,u]=v.useState(1),d=v.useRef({plays:0,failures:0,recovered:0,rebuilds:0}),f=v.useRef({}),h=v.useRef(!0),m=v.useRef(!1),_=v.useRef(null),w=(...O)=>{},b=v.useCallback(()=>{if(n||m.current)return;m.current=!0;const O=()=>{try{LG?.(),a(!0),w("activated via user gesture")}catch{}window.removeEventListener("pointerdown",O),window.removeEventListener("touchstart",O),window.removeEventListener("keydown",O)};window.addEventListener("pointerdown",O,{passive:!0,once:!0}),window.addEventListener("touchstart",O,{passive:!0,once:!0}),window.addEventListener("keydown",O,{passive:!0,once:!0})},[n,w]);v.useEffect(()=>{b()},[b]);const E=O=>{try{typeof gO=="function"&&(gO(O),d.current.rebuilds+=1,w("rebuild asset",O))}catch{}},T=v.useCallback(async(O,I)=>{if(i&&!I?.allowDuringMute)return!1;n||b();const x=I?.volume??c;let D=0;const N=()=>new Promise(L=>{let j=!1;const q=U=>{j||(j=!0,L(U))};try{const U=BG?.(O,{volume:x,rate:I?.rate,loop:I?.loop});U&&typeof U.then=="function"?U.then(()=>q(!0)).catch(()=>q(!1)):setTimeout(()=>q(!0),0)}catch{q(!1)}});for(;D<=r;){if(await N())return d.current.plays+=1,D>0&&(d.current.recovered+=1),f.current[O]=0,!0;if(D+=1,d.current.failures+=1,f.current[O]=(f.current[O]||0)+1,f.current[O]>=3&&E(O),D>r)break;await new Promise(j=>setTimeout(j,60*D))}return!1},[i,n,b,c,r,w]),R=v.useCallback(O=>{try{UG?.(O)}catch{}},[]),P=v.useCallback(O=>{o(O)},[]),A=v.useCallback(O=>{u(Math.max(0,Math.min(1,O)))},[]);return v.useEffect(()=>{const O=async()=>{if(!h.current||!n)return;const I=d.current,x=I.plays+I.failures;if(x>=4){const D=I.failures/(x||1);if(D>.4){w("elevated failure ratio",D.toFixed(2),"running probe");try{await T("__probe__",{volume:0,allowDuringMute:!0})||(a(!1),m.current=!1,b(),w("probe failed → deactivated, awaiting gesture"))}catch{}}}};return _.current=window.setInterval(O,e),()=>{_.current&&window.clearInterval(_.current)}},[e,n,T,b,w]),v.useEffect(()=>{const O=()=>{document.visibilityState==="visible"&&n&&T("__probe__",{volume:0,allowDuringMute:!0})};return document.addEventListener("visibilitychange",O),()=>document.removeEventListener("visibilitychange",O)},[n,T]),v.useEffect(()=>()=>{h.current=!1},[]),{play:T,preload:R,setMuted:P,setVolume:A,activationPrompt:b,isActivated:n,isMuted:i,volume:c,stats:d.current}}function pSe({children:t,config:e}){return fSe(e),g.jsx(g.Fragment,{children:t})}const hSe=[{id:"a",file:"/avatars/avatar-a.png",label:"Player A"},{id:"b",file:"/avatars/avatar-b.png",label:"Player B"},{id:"c",file:"/avatars/avatar-c.png",label:"Player C"},{id:"d",file:"/avatars/avatar-d.png",label:"Player D"}];function mSe({id:t,variant:e}){const r=hSe.find(i=>i.id===t);if(!r)return g.jsx("div",{style:{color:"#fff",padding:40},children:"Avatar not found"});const n=(e||"").toLowerCase(),a=n==="win"?"win":n==="lose"?"lose":n==="push"?"push":"";return g.jsxs("div",{className:"avatar-shot"+(a?` variant-${a}`:""),children:[g.jsxs("div",{className:"avatar-shot__frame",children:[g.jsx("img",{src:r.file,alt:r.label,className:"avatar-shot__img"}),a&&g.jsx("div",{className:"avatar-shot__fx fx-"+a})]}),g.jsx("div",{className:"avatar-shot__label",children:r.label})]})}function gSe(t,e){const r=/^\/capture\/avatar\/([a-z])$/i.exec(t);if(!r)return null;const a=new URLSearchParams(e).get("variant")||void 0;return{id:r[1].toLowerCase(),variant:a}}const ySe=[{id:"a",name:"Banker",avatar:"/avatars/avatar-a.png"},{id:"b",name:"Challenger 1",avatar:"/avatars/avatar-b.png"},{id:"c",name:"Challenger 2",avatar:"/avatars/avatar-c.png"},{id:"d",name:"Challenger 3",avatar:"/avatars/avatar-d.png"}],s$={"pre-roll":{dice:[1,2,3],banker:"a",showRoll:!0,results:{a:"idle",b:"idle",c:"idle",d:"idle"},point:null},rolling:{dice:[0,0,0],banker:"a",rolling:!0,showRoll:!1,results:{a:"idle",b:"idle",c:"idle",d:"idle"},point:null},"banker-456":{dice:[4,5,6],banker:"a",shake:!0,showRoll:!1,results:{a:"win",b:"lose",c:"lose",d:"lose"},point:null,chipDeltas:{a:"+1500",b:"-500",c:"-500",d:"-500"}},"banker-point":{dice:[2,2,6],banker:"a",point:6,showRoll:!1,results:{a:"idle",b:"idle",c:"idle",d:"idle"}},"challenger-win":{dice:[3,3,5],banker:"a",point:5,showRoll:!1,results:{a:"lose",b:"win",c:"idle",d:"idle"},chipDeltas:{a:"-500",b:"+500"}},push:{dice:[5,5,2],banker:"a",point:2,showRoll:!1,results:{a:"push",b:"push",c:"idle",d:"idle"}},payout:{dice:[4,4,1],banker:"a",point:1,showRoll:!1,results:{a:"lose",b:"win",c:"win",d:"idle"},chipDeltas:{a:"-1000",b:"+500",c:"+500"}},"end-round":{dice:[6,6,3],banker:"a",point:null,showRoll:!1,roundSummary:"Round Over — New Banker",results:{a:"lose",b:"win",c:"idle",d:"idle"}}};function vSe(t){const e=/^\/capture\/cee-lo\/([a-z0-9-]+)$/i.exec(t);if(!e)return null;const r=e[1];return s$[r]?{scene:r}:null}function _Se({scene:t}){const e=s$[t];return e?g.jsx("div",{className:"cl-scene"+(e.shake?" fx-bg-shake":""),"data-scene":t,children:g.jsxs("div",{className:"cl-table",children:[g.jsx(bSe,{banker:e.banker,results:e.results,chipDeltas:e.chipDeltas}),g.jsx(kSe,{dice:e.dice,rolling:e.rolling}),e.point!=null&&e.point!==void 0&&g.jsx(SSe,{point:e.point}),e.showRoll&&g.jsx(ESe,{}),e.roundSummary&&g.jsx(TSe,{text:e.roundSummary})]})}):g.jsx("div",{style:{color:"#fff"},children:"Scene not found"})}function bSe({banker:t,results:e,chipDeltas:r}){return g.jsx("div",{className:"cl-seats",children:ySe.map(n=>{const a=e?.[n.id]||"idle";return g.jsxs("div",{className:"cl-seat"+(n.id===t?" is-banker":"")+(a!=="idle"?` res-${a}`:""),children:[g.jsxs("div",{className:"cl-seat__avatar",children:[g.jsx("img",{src:n.avatar,alt:n.name}),a!=="idle"&&g.jsx("div",{className:"cl-seat__fx fx-"+a})]}),g.jsx("div",{className:"cl-seat__name",children:n.name}),r?.[n.id]&&g.jsx("div",{className:"cl-seat__delta",children:r[n.id]})]},n.id)})})}function kSe({dice:t,rolling:e}){return g.jsx("div",{className:"cl-dice","aria-label":"dice",children:t.map((r,n)=>g.jsx(wSe,{value:r,rolling:e},n))})}function wSe({value:t,rolling:e}){const r=t===0?"?":String(t);return g.jsx("div",{className:"cl-die"+(e?" is-rolling":""),children:r})}function SSe({point:t}){return g.jsxs("div",{className:"cl-point",children:["POINT: ",t]})}function ESe(){return g.jsx("div",{className:"cl-roll-btn",children:"ROLL"})}function TSe({text:t}){return g.jsx("div",{className:"cl-summary",children:t})}async function CSe(){try{const t=window.location.protocol;if(!(t==="capacitor:"||t==="ionic:"))return;let r=null;try{r=window.Capacitor?.Plugins?.Keyboard||null}catch{}try{const i=window.visualViewport,o=f=>{try{document.documentElement.classList.toggle("kb-open",!!f),document.body.classList.toggle("kb-open",!!f)}catch{}};let c=i?.height??window.innerHeight;const u=()=>{try{c=i?.height??window.innerHeight}catch{}},d=()=>{try{const f=i?.height??window.innerHeight,h=Math.max(0,c-f);o(h>60)}catch{}};i?(i.addEventListener("resize",d),i.addEventListener("scroll",d)):(window.addEventListener("resize",d),window.addEventListener("orientationchange",()=>{u(),d()})),window.addEventListener("focusin",f=>{const h=f?.target;!!h&&(h.tagName==="INPUT"||h.tagName==="TEXTAREA"||h.isContentEditable)&&o(!0)}),window.addEventListener("focusout",()=>{window.setTimeout(d,120)}),window.setTimeout(()=>{u(),d()},50)}catch{}if(r)try{await r.setResizeMode({mode:"none"})}catch{}const n=()=>{try{document.documentElement.classList.add("kb-open"),document.body.classList.add("kb-open")}catch{}},a=()=>{try{document.documentElement.classList.remove("kb-open"),document.body.classList.remove("kb-open")}catch{}};try{r?.addListener?.("keyboardWillShow",n)}catch{}try{r?.addListener?.("keyboardDidShow",n)}catch{}try{r?.addListener?.("keyboardWillHide",a)}catch{}try{r?.addListener?.("keyboardDidHide",a)}catch{}}catch{}}try{window.addEventListener("error",t=>{}),window.addEventListener("unhandledrejection",t=>{})}catch{}document.addEventListener("click",t=>{const e=t.target;if(!e)return;const r=e.closest('button, a, [role="button"], .felt-btn, .gold-link');if(r&&!r.closest("[data-no-global-haptic]")&&!(r.tagName==="BUTTON"&&r.disabled)&&r.getAttribute("aria-disabled")!=="true")try{cr("Light")}catch{}},{passive:!0});try{KH()}catch{}try{const t=window,e=t.location.protocol==="capacitor:"||t.location.protocol==="ionic:",r=/^(localhost|127\.0\.0\.1)$/.test(t.location.hostname),n=document.querySelector("script[data-adsbygoogle]");if(!e&&!r&&!n){const a=document.createElement("script");a.async=!0,a.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4219446894372985",a.crossOrigin="anonymous",a.setAttribute("data-adsbygoogle","1"),a.onload=()=>{const i=window.adsbygoogle||[];try{i.push({})}catch{}},document.head.appendChild(a)}}catch{}try{const t="sess:initialized";Ws.get(t).then(e=>{if(!e)return Ws.clearSessionKeys().then(()=>Ws.set(t,"1"))}).catch(()=>{})}catch{}function xSe(){window.__APP_MOUNTED__=!0,v.useEffect(()=>{try{const e=window.Capacitor?.getPlatform?.();(e==="ios"||e==="android")&&w3().catch(()=>{})}catch{}},[]);try{const e=window.Capacitor?.getPlatform?.();(e==="ios"||e==="android")&&Promise.resolve().then(()=>{try{bf.notifyAppReady()}catch{}})}catch{}return g.jsx(dSe,{})}function aT(){try{const t=gSe(window.location.pathname,window.location.search);if(t){document.body.classList.add("ad-capture"),Pw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(mSe,{id:t.id,variant:t.variant})}));return}const e=vSe(window.location.pathname);if(e){document.body.classList.add("ad-capture"),Pw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(_Se,{scene:e.scene})}));return}}catch{}Pw.createRoot(document.getElementById("root")).render(g.jsx(v.StrictMode,{children:g.jsx(i$,{children:g.jsx(pSe,{config:{debug:!1},children:g.jsx(xSe,{})})})}))}function PSe(){try{(()=>{try{const r=window.Capacitor?.getPlatform?.();return r==="ios"||r==="android"?!0:/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})()?(async()=>{try{await cs.init()}catch{}aT();try{await CSe()}catch{}try{cs.healthCheck().catch(()=>{})}catch{}})():aT()}catch{aT()}}window.APP_TARGET||PSe();export{so as B,J_e as D,jSe as F,lm as I,b_ as M,sN as N,Tt as R,sg as T,na as U,m3 as W,qr as _,sx as a,v as b,OSe as c,Xo as d,g0 as e,mu as f,wg as g,RSe as h,ASe as i,g as j,Uke as k,nu as l,LL as m,to as r,Rx as s,LSe as t,$r as u,Oke as w};
